ivprog.bundle.js 2.3 MB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086130871308813089130901309113092130931309413095130961309713098130991310013101131021310313104131051310613107131081310913110131111311213113131141311513116131171311813119131201312113122131231312413125131261312713128131291313013131131321313313134131351313613137131381313913140131411314213143131441314513146131471314813149131501315113152131531315413155131561315713158131591316013161131621316313164131651316613167131681316913170131711317213173131741317513176131771317813179131801318113182131831318413185131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206132071320813209132101321113212132131321413215132161321713218132191322013221132221322313224132251322613227132281322913230132311323213233132341323513236132371323813239132401324113242132431324413245132461324713248132491325013251132521325313254132551325613257132581325913260132611326213263132641326513266132671326813269132701327113272132731327413275132761327713278132791328013281132821328313284132851328613287132881328913290132911329213293132941329513296132971329813299133001330113302133031330413305133061330713308133091331013311133121331313314133151331613317133181331913320133211332213323133241332513326133271332813329133301333113332133331333413335133361333713338133391334013341133421334313344133451334613347133481334913350133511335213353133541335513356133571335813359133601336113362133631336413365133661336713368133691337013371133721337313374133751337613377133781337913380133811338213383133841338513386133871338813389133901339113392133931339413395133961339713398133991340013401134021340313404134051340613407134081340913410134111341213413134141341513416134171341813419134201342113422134231342413425134261342713428134291343013431134321343313434134351343613437134381343913440134411344213443134441344513446134471344813449134501345113452134531345413455134561345713458134591346013461134621346313464134651346613467134681346913470134711347213473134741347513476134771347813479134801348113482134831348413485134861348713488134891349013491134921349313494134951349613497134981349913500135011350213503135041350513506135071350813509135101351113512135131351413515135161351713518135191352013521135221352313524135251352613527135281352913530135311353213533135341353513536135371353813539135401354113542135431354413545135461354713548135491355013551135521355313554135551355613557135581355913560135611356213563135641356513566135671356813569135701357113572135731357413575135761357713578135791358013581135821358313584135851358613587135881358913590135911359213593135941359513596135971359813599136001360113602136031360413605136061360713608136091361013611136121361313614136151361613617136181361913620136211362213623136241362513626136271362813629136301363113632136331363413635136361363713638136391364013641136421364313644136451364613647136481364913650136511365213653136541365513656136571365813659136601366113662136631366413665136661366713668136691367013671136721367313674136751367613677136781367913680136811368213683136841368513686136871368813689136901369113692136931369413695136961369713698136991370013701137021370313704137051370613707137081370913710137111371213713137141371513716137171371813719137201372113722137231372413725137261372713728137291373013731137321373313734137351373613737137381373913740137411374213743137441374513746137471374813749137501375113752137531375413755137561375713758137591376013761137621376313764137651376613767137681376913770137711377213773137741377513776137771377813779137801378113782137831378413785137861378713788137891379013791137921379313794137951379613797137981379913800138011380213803138041380513806138071380813809138101381113812138131381413815138161381713818138191382013821138221382313824138251382613827138281382913830138311383213833138341383513836138371383813839138401384113842138431384413845138461384713848138491385013851138521385313854138551385613857138581385913860138611386213863138641386513866138671386813869138701387113872138731387413875138761387713878138791388013881138821388313884138851388613887138881388913890138911389213893138941389513896138971389813899139001390113902139031390413905139061390713908139091391013911139121391313914139151391613917139181391913920139211392213923139241392513926139271392813929139301393113932139331393413935139361393713938139391394013941139421394313944139451394613947139481394913950139511395213953139541395513956139571395813959139601396113962139631396413965139661396713968139691397013971139721397313974139751397613977139781397913980139811398213983139841398513986139871398813989139901399113992139931399413995139961399713998139991400014001140021400314004140051400614007140081400914010140111401214013140141401514016140171401814019140201402114022140231402414025140261402714028140291403014031140321403314034140351403614037140381403914040140411404214043140441404514046140471404814049140501405114052140531405414055140561405714058140591406014061140621406314064140651406614067140681406914070140711407214073140741407514076140771407814079140801408114082140831408414085140861408714088140891409014091140921409314094140951409614097140981409914100141011410214103141041410514106141071410814109141101411114112141131411414115141161411714118141191412014121141221412314124141251412614127141281412914130141311413214133141341413514136141371413814139141401414114142141431414414145141461414714148141491415014151141521415314154141551415614157141581415914160141611416214163141641416514166141671416814169141701417114172141731417414175141761417714178141791418014181141821418314184141851418614187141881418914190141911419214193141941419514196141971419814199142001420114202142031420414205142061420714208142091421014211142121421314214142151421614217142181421914220142211422214223142241422514226142271422814229142301423114232142331423414235142361423714238142391424014241142421424314244142451424614247142481424914250142511425214253142541425514256142571425814259142601426114262142631426414265142661426714268142691427014271142721427314274142751427614277142781427914280142811428214283142841428514286142871428814289142901429114292142931429414295142961429714298142991430014301143021430314304143051430614307143081430914310143111431214313143141431514316143171431814319143201432114322143231432414325143261432714328143291433014331143321433314334143351433614337143381433914340143411434214343143441434514346143471434814349143501435114352143531435414355143561435714358143591436014361143621436314364143651436614367143681436914370143711437214373143741437514376143771437814379143801438114382143831438414385143861438714388143891439014391143921439314394143951439614397143981439914400144011440214403144041440514406144071440814409144101441114412144131441414415144161441714418144191442014421144221442314424144251442614427144281442914430144311443214433144341443514436144371443814439144401444114442144431444414445144461444714448144491445014451144521445314454144551445614457144581445914460144611446214463144641446514466144671446814469144701447114472144731447414475144761447714478144791448014481144821448314484144851448614487144881448914490144911449214493144941449514496144971449814499145001450114502145031450414505145061450714508145091451014511145121451314514145151451614517145181451914520145211452214523145241452514526145271452814529145301453114532145331453414535145361453714538145391454014541145421454314544145451454614547145481454914550145511455214553145541455514556145571455814559145601456114562145631456414565145661456714568145691457014571145721457314574145751457614577145781457914580145811458214583145841458514586145871458814589145901459114592145931459414595145961459714598145991460014601146021460314604146051460614607146081460914610146111461214613146141461514616146171461814619146201462114622146231462414625146261462714628146291463014631146321463314634146351463614637146381463914640146411464214643146441464514646146471464814649146501465114652146531465414655146561465714658146591466014661146621466314664146651466614667146681466914670146711467214673146741467514676146771467814679146801468114682146831468414685146861468714688146891469014691146921469314694146951469614697146981469914700147011470214703147041470514706147071470814709147101471114712147131471414715147161471714718147191472014721147221472314724147251472614727147281472914730147311473214733147341473514736147371473814739147401474114742147431474414745147461474714748147491475014751147521475314754147551475614757147581475914760147611476214763147641476514766147671476814769147701477114772147731477414775147761477714778147791478014781147821478314784147851478614787147881478914790147911479214793147941479514796147971479814799148001480114802148031480414805148061480714808148091481014811148121481314814148151481614817148181481914820148211482214823148241482514826148271482814829148301483114832148331483414835148361483714838148391484014841148421484314844148451484614847148481484914850148511485214853148541485514856148571485814859148601486114862148631486414865148661486714868148691487014871148721487314874148751487614877148781487914880148811488214883148841488514886148871488814889148901489114892148931489414895148961489714898148991490014901149021490314904149051490614907149081490914910149111491214913149141491514916149171491814919149201492114922149231492414925149261492714928149291493014931149321493314934149351493614937149381493914940149411494214943149441494514946149471494814949149501495114952149531495414955149561495714958149591496014961149621496314964149651496614967149681496914970149711497214973149741497514976149771497814979149801498114982149831498414985149861498714988149891499014991149921499314994149951499614997149981499915000150011500215003150041500515006150071500815009150101501115012150131501415015150161501715018150191502015021150221502315024150251502615027150281502915030150311503215033150341503515036150371503815039150401504115042150431504415045150461504715048150491505015051150521505315054150551505615057150581505915060150611506215063150641506515066150671506815069150701507115072150731507415075150761507715078150791508015081150821508315084150851508615087150881508915090150911509215093150941509515096150971509815099151001510115102151031510415105151061510715108151091511015111151121511315114151151511615117151181511915120151211512215123151241512515126151271512815129151301513115132151331513415135151361513715138151391514015141151421514315144151451514615147151481514915150151511515215153151541515515156151571515815159151601516115162151631516415165151661516715168151691517015171151721517315174151751517615177151781517915180151811518215183151841518515186151871518815189151901519115192151931519415195151961519715198151991520015201152021520315204152051520615207152081520915210152111521215213152141521515216152171521815219152201522115222152231522415225152261522715228152291523015231152321523315234152351523615237152381523915240152411524215243152441524515246152471524815249152501525115252152531525415255152561525715258152591526015261152621526315264152651526615267152681526915270152711527215273152741527515276152771527815279152801528115282152831528415285152861528715288152891529015291152921529315294152951529615297152981529915300153011530215303153041530515306153071530815309153101531115312153131531415315153161531715318153191532015321153221532315324153251532615327153281532915330153311533215333153341533515336153371533815339153401534115342153431534415345153461534715348153491535015351153521535315354153551535615357153581535915360153611536215363153641536515366153671536815369153701537115372153731537415375153761537715378153791538015381153821538315384153851538615387153881538915390153911539215393153941539515396153971539815399154001540115402154031540415405154061540715408154091541015411154121541315414154151541615417154181541915420154211542215423154241542515426154271542815429154301543115432154331543415435154361543715438154391544015441154421544315444154451544615447154481544915450154511545215453154541545515456154571545815459154601546115462154631546415465154661546715468154691547015471154721547315474154751547615477154781547915480154811548215483154841548515486154871548815489154901549115492154931549415495154961549715498154991550015501155021550315504155051550615507155081550915510155111551215513155141551515516155171551815519155201552115522155231552415525155261552715528155291553015531155321553315534155351553615537155381553915540155411554215543155441554515546155471554815549155501555115552155531555415555155561555715558155591556015561155621556315564155651556615567155681556915570155711557215573155741557515576155771557815579155801558115582155831558415585155861558715588155891559015591155921559315594155951559615597155981559915600156011560215603156041560515606156071560815609156101561115612156131561415615156161561715618156191562015621156221562315624156251562615627156281562915630156311563215633156341563515636156371563815639156401564115642156431564415645156461564715648156491565015651156521565315654156551565615657156581565915660156611566215663156641566515666156671566815669156701567115672156731567415675156761567715678156791568015681156821568315684156851568615687156881568915690156911569215693156941569515696156971569815699157001570115702157031570415705157061570715708157091571015711157121571315714157151571615717157181571915720157211572215723157241572515726157271572815729157301573115732157331573415735157361573715738157391574015741157421574315744157451574615747157481574915750157511575215753157541575515756157571575815759157601576115762157631576415765157661576715768157691577015771157721577315774157751577615777157781577915780157811578215783157841578515786157871578815789157901579115792157931579415795157961579715798157991580015801158021580315804158051580615807158081580915810158111581215813158141581515816158171581815819158201582115822158231582415825158261582715828158291583015831158321583315834158351583615837158381583915840158411584215843158441584515846158471584815849158501585115852158531585415855158561585715858158591586015861158621586315864158651586615867158681586915870158711587215873158741587515876158771587815879158801588115882158831588415885158861588715888158891589015891158921589315894158951589615897158981589915900159011590215903159041590515906159071590815909159101591115912159131591415915159161591715918159191592015921159221592315924159251592615927159281592915930159311593215933159341593515936159371593815939159401594115942159431594415945159461594715948159491595015951159521595315954159551595615957159581595915960159611596215963159641596515966159671596815969159701597115972159731597415975159761597715978159791598015981159821598315984159851598615987159881598915990159911599215993159941599515996159971599815999160001600116002160031600416005160061600716008160091601016011160121601316014160151601616017160181601916020160211602216023160241602516026160271602816029160301603116032160331603416035160361603716038160391604016041160421604316044160451604616047160481604916050160511605216053160541605516056160571605816059160601606116062160631606416065160661606716068160691607016071160721607316074160751607616077160781607916080160811608216083160841608516086160871608816089160901609116092160931609416095160961609716098160991610016101161021610316104161051610616107161081610916110161111611216113161141611516116161171611816119161201612116122161231612416125161261612716128161291613016131161321613316134161351613616137161381613916140161411614216143161441614516146161471614816149161501615116152161531615416155161561615716158161591616016161161621616316164161651616616167161681616916170161711617216173161741617516176161771617816179161801618116182161831618416185161861618716188161891619016191161921619316194161951619616197161981619916200162011620216203162041620516206162071620816209162101621116212162131621416215162161621716218162191622016221162221622316224162251622616227162281622916230162311623216233162341623516236162371623816239162401624116242162431624416245162461624716248162491625016251162521625316254162551625616257162581625916260162611626216263162641626516266162671626816269162701627116272162731627416275162761627716278162791628016281162821628316284162851628616287162881628916290162911629216293162941629516296162971629816299163001630116302163031630416305163061630716308163091631016311163121631316314163151631616317163181631916320163211632216323163241632516326163271632816329163301633116332163331633416335163361633716338163391634016341163421634316344163451634616347163481634916350163511635216353163541635516356163571635816359163601636116362163631636416365163661636716368163691637016371163721637316374163751637616377163781637916380163811638216383163841638516386163871638816389163901639116392163931639416395163961639716398163991640016401164021640316404164051640616407164081640916410164111641216413164141641516416164171641816419164201642116422164231642416425164261642716428164291643016431164321643316434164351643616437164381643916440164411644216443164441644516446164471644816449164501645116452164531645416455164561645716458164591646016461164621646316464164651646616467164681646916470164711647216473164741647516476164771647816479164801648116482164831648416485164861648716488164891649016491164921649316494164951649616497164981649916500165011650216503165041650516506165071650816509165101651116512165131651416515165161651716518165191652016521165221652316524165251652616527165281652916530165311653216533165341653516536165371653816539165401654116542165431654416545165461654716548165491655016551165521655316554165551655616557165581655916560165611656216563165641656516566165671656816569165701657116572165731657416575165761657716578165791658016581165821658316584165851658616587165881658916590165911659216593165941659516596165971659816599166001660116602166031660416605166061660716608166091661016611166121661316614166151661616617166181661916620166211662216623166241662516626166271662816629166301663116632166331663416635166361663716638166391664016641166421664316644166451664616647166481664916650166511665216653166541665516656166571665816659166601666116662166631666416665166661666716668166691667016671166721667316674166751667616677166781667916680166811668216683166841668516686166871668816689166901669116692166931669416695166961669716698166991670016701167021670316704167051670616707167081670916710167111671216713167141671516716167171671816719167201672116722167231672416725167261672716728167291673016731167321673316734167351673616737167381673916740167411674216743167441674516746167471674816749167501675116752167531675416755167561675716758167591676016761167621676316764167651676616767167681676916770167711677216773167741677516776167771677816779167801678116782167831678416785167861678716788167891679016791167921679316794167951679616797167981679916800168011680216803168041680516806168071680816809168101681116812168131681416815168161681716818168191682016821168221682316824168251682616827168281682916830168311683216833168341683516836168371683816839168401684116842168431684416845168461684716848168491685016851168521685316854168551685616857168581685916860168611686216863168641686516866168671686816869168701687116872168731687416875168761687716878168791688016881168821688316884168851688616887168881688916890168911689216893168941689516896168971689816899169001690116902169031690416905169061690716908169091691016911169121691316914169151691616917169181691916920169211692216923169241692516926169271692816929169301693116932169331693416935169361693716938169391694016941169421694316944169451694616947169481694916950169511695216953169541695516956169571695816959169601696116962169631696416965169661696716968169691697016971169721697316974169751697616977169781697916980169811698216983169841698516986169871698816989169901699116992169931699416995169961699716998169991700017001170021700317004170051700617007170081700917010170111701217013170141701517016170171701817019170201702117022170231702417025170261702717028170291703017031170321703317034170351703617037170381703917040170411704217043170441704517046170471704817049170501705117052170531705417055170561705717058170591706017061170621706317064170651706617067170681706917070170711707217073170741707517076170771707817079170801708117082170831708417085170861708717088170891709017091170921709317094170951709617097170981709917100171011710217103171041710517106171071710817109171101711117112171131711417115171161711717118171191712017121171221712317124171251712617127171281712917130171311713217133171341713517136171371713817139171401714117142171431714417145171461714717148171491715017151171521715317154171551715617157171581715917160171611716217163171641716517166171671716817169171701717117172171731717417175171761717717178171791718017181171821718317184171851718617187171881718917190171911719217193171941719517196171971719817199172001720117202172031720417205172061720717208172091721017211172121721317214172151721617217172181721917220172211722217223172241722517226172271722817229172301723117232172331723417235172361723717238172391724017241172421724317244172451724617247172481724917250172511725217253172541725517256172571725817259172601726117262172631726417265172661726717268172691727017271172721727317274172751727617277172781727917280172811728217283172841728517286172871728817289172901729117292172931729417295172961729717298172991730017301173021730317304173051730617307173081730917310173111731217313173141731517316173171731817319173201732117322173231732417325173261732717328173291733017331173321733317334173351733617337173381733917340173411734217343173441734517346173471734817349173501735117352173531735417355173561735717358173591736017361173621736317364173651736617367173681736917370173711737217373173741737517376173771737817379173801738117382173831738417385173861738717388173891739017391173921739317394173951739617397173981739917400174011740217403174041740517406174071740817409174101741117412174131741417415174161741717418174191742017421174221742317424174251742617427174281742917430174311743217433174341743517436174371743817439174401744117442174431744417445174461744717448174491745017451174521745317454174551745617457174581745917460174611746217463174641746517466174671746817469174701747117472174731747417475174761747717478174791748017481174821748317484174851748617487174881748917490174911749217493174941749517496174971749817499175001750117502175031750417505175061750717508175091751017511175121751317514175151751617517175181751917520175211752217523175241752517526175271752817529175301753117532175331753417535175361753717538175391754017541175421754317544175451754617547175481754917550175511755217553175541755517556175571755817559175601756117562175631756417565175661756717568175691757017571175721757317574175751757617577175781757917580175811758217583175841758517586175871758817589175901759117592175931759417595175961759717598175991760017601176021760317604176051760617607176081760917610176111761217613176141761517616176171761817619176201762117622176231762417625176261762717628176291763017631176321763317634176351763617637176381763917640176411764217643176441764517646176471764817649176501765117652176531765417655176561765717658176591766017661176621766317664176651766617667176681766917670176711767217673176741767517676176771767817679176801768117682176831768417685176861768717688176891769017691176921769317694176951769617697176981769917700177011770217703177041770517706177071770817709177101771117712177131771417715177161771717718177191772017721177221772317724177251772617727177281772917730177311773217733177341773517736177371773817739177401774117742177431774417745177461774717748177491775017751177521775317754177551775617757177581775917760177611776217763177641776517766177671776817769177701777117772177731777417775177761777717778177791778017781177821778317784177851778617787177881778917790177911779217793177941779517796177971779817799178001780117802178031780417805178061780717808178091781017811178121781317814178151781617817178181781917820178211782217823178241782517826178271782817829178301783117832178331783417835178361783717838178391784017841178421784317844178451784617847178481784917850178511785217853178541785517856178571785817859178601786117862178631786417865178661786717868178691787017871178721787317874178751787617877178781787917880178811788217883178841788517886178871788817889178901789117892178931789417895178961789717898178991790017901179021790317904179051790617907179081790917910179111791217913179141791517916179171791817919179201792117922179231792417925179261792717928179291793017931179321793317934179351793617937179381793917940179411794217943179441794517946179471794817949179501795117952179531795417955179561795717958179591796017961179621796317964179651796617967179681796917970179711797217973179741797517976179771797817979179801798117982179831798417985179861798717988179891799017991179921799317994179951799617997179981799918000180011800218003180041800518006180071800818009180101801118012180131801418015180161801718018180191802018021180221802318024180251802618027180281802918030180311803218033180341803518036180371803818039180401804118042180431804418045180461804718048180491805018051180521805318054180551805618057180581805918060180611806218063180641806518066180671806818069180701807118072180731807418075180761807718078180791808018081180821808318084180851808618087180881808918090180911809218093180941809518096180971809818099181001810118102181031810418105181061810718108181091811018111181121811318114181151811618117181181811918120181211812218123181241812518126181271812818129181301813118132181331813418135181361813718138181391814018141181421814318144181451814618147181481814918150181511815218153181541815518156181571815818159181601816118162181631816418165181661816718168181691817018171181721817318174181751817618177181781817918180181811818218183181841818518186181871818818189181901819118192181931819418195181961819718198181991820018201182021820318204182051820618207182081820918210182111821218213182141821518216182171821818219182201822118222182231822418225182261822718228182291823018231182321823318234182351823618237182381823918240182411824218243182441824518246182471824818249182501825118252182531825418255182561825718258182591826018261182621826318264182651826618267182681826918270182711827218273182741827518276182771827818279182801828118282182831828418285182861828718288182891829018291182921829318294182951829618297182981829918300183011830218303183041830518306183071830818309183101831118312183131831418315183161831718318183191832018321183221832318324183251832618327183281832918330183311833218333183341833518336183371833818339183401834118342183431834418345183461834718348183491835018351183521835318354183551835618357183581835918360183611836218363183641836518366183671836818369183701837118372183731837418375183761837718378183791838018381183821838318384183851838618387183881838918390183911839218393183941839518396183971839818399184001840118402184031840418405184061840718408184091841018411184121841318414184151841618417184181841918420184211842218423184241842518426184271842818429184301843118432184331843418435184361843718438184391844018441184421844318444184451844618447184481844918450184511845218453184541845518456184571845818459184601846118462184631846418465184661846718468184691847018471184721847318474184751847618477184781847918480184811848218483184841848518486184871848818489184901849118492184931849418495184961849718498184991850018501185021850318504185051850618507185081850918510185111851218513185141851518516185171851818519185201852118522185231852418525185261852718528185291853018531185321853318534185351853618537185381853918540185411854218543185441854518546185471854818549185501855118552185531855418555185561855718558185591856018561185621856318564185651856618567185681856918570185711857218573185741857518576185771857818579185801858118582185831858418585185861858718588185891859018591185921859318594185951859618597185981859918600186011860218603186041860518606186071860818609186101861118612186131861418615186161861718618186191862018621186221862318624186251862618627186281862918630186311863218633186341863518636186371863818639186401864118642186431864418645186461864718648186491865018651186521865318654186551865618657186581865918660186611866218663186641866518666186671866818669186701867118672186731867418675186761867718678186791868018681186821868318684186851868618687186881868918690186911869218693186941869518696186971869818699187001870118702187031870418705187061870718708187091871018711187121871318714187151871618717187181871918720187211872218723187241872518726187271872818729187301873118732187331873418735187361873718738187391874018741187421874318744187451874618747187481874918750187511875218753187541875518756187571875818759187601876118762187631876418765187661876718768187691877018771187721877318774187751877618777187781877918780187811878218783187841878518786187871878818789187901879118792187931879418795187961879718798187991880018801188021880318804188051880618807188081880918810188111881218813188141881518816188171881818819188201882118822188231882418825188261882718828188291883018831188321883318834188351883618837188381883918840188411884218843188441884518846188471884818849188501885118852188531885418855188561885718858188591886018861188621886318864188651886618867188681886918870188711887218873188741887518876188771887818879188801888118882188831888418885188861888718888188891889018891188921889318894188951889618897188981889918900189011890218903189041890518906189071890818909189101891118912189131891418915189161891718918189191892018921189221892318924189251892618927189281892918930189311893218933189341893518936189371893818939189401894118942189431894418945189461894718948189491895018951189521895318954189551895618957189581895918960189611896218963189641896518966189671896818969189701897118972189731897418975189761897718978189791898018981189821898318984189851898618987189881898918990189911899218993189941899518996189971899818999190001900119002190031900419005190061900719008190091901019011190121901319014190151901619017190181901919020190211902219023190241902519026190271902819029190301903119032190331903419035190361903719038190391904019041190421904319044190451904619047190481904919050190511905219053190541905519056190571905819059190601906119062190631906419065190661906719068190691907019071190721907319074190751907619077190781907919080190811908219083190841908519086190871908819089190901909119092190931909419095190961909719098190991910019101191021910319104191051910619107191081910919110191111911219113191141911519116191171911819119191201912119122191231912419125191261912719128191291913019131191321913319134191351913619137191381913919140191411914219143191441914519146191471914819149191501915119152191531915419155191561915719158191591916019161191621916319164191651916619167191681916919170191711917219173191741917519176191771917819179191801918119182191831918419185191861918719188191891919019191191921919319194191951919619197191981919919200192011920219203192041920519206192071920819209192101921119212192131921419215192161921719218192191922019221192221922319224192251922619227192281922919230192311923219233192341923519236192371923819239192401924119242192431924419245192461924719248192491925019251192521925319254192551925619257192581925919260192611926219263192641926519266192671926819269192701927119272192731927419275192761927719278192791928019281192821928319284192851928619287192881928919290192911929219293192941929519296192971929819299193001930119302193031930419305193061930719308193091931019311193121931319314193151931619317193181931919320193211932219323193241932519326193271932819329193301933119332193331933419335193361933719338193391934019341193421934319344193451934619347193481934919350193511935219353193541935519356193571935819359193601936119362193631936419365193661936719368193691937019371193721937319374193751937619377193781937919380193811938219383193841938519386193871938819389193901939119392193931939419395193961939719398193991940019401194021940319404194051940619407194081940919410194111941219413194141941519416194171941819419194201942119422194231942419425194261942719428194291943019431194321943319434194351943619437194381943919440194411944219443194441944519446194471944819449194501945119452194531945419455194561945719458194591946019461194621946319464194651946619467194681946919470194711947219473194741947519476194771947819479194801948119482194831948419485194861948719488194891949019491194921949319494194951949619497194981949919500195011950219503195041950519506195071950819509195101951119512195131951419515195161951719518195191952019521195221952319524195251952619527195281952919530195311953219533195341953519536195371953819539195401954119542195431954419545195461954719548195491955019551195521955319554195551955619557195581955919560195611956219563195641956519566195671956819569195701957119572195731957419575195761957719578195791958019581195821958319584195851958619587195881958919590195911959219593195941959519596195971959819599196001960119602196031960419605196061960719608196091961019611196121961319614196151961619617196181961919620196211962219623196241962519626196271962819629196301963119632196331963419635196361963719638196391964019641196421964319644196451964619647196481964919650196511965219653196541965519656196571965819659196601966119662196631966419665196661966719668196691967019671196721967319674196751967619677196781967919680196811968219683196841968519686196871968819689196901969119692196931969419695196961969719698196991970019701197021970319704197051970619707197081970919710197111971219713197141971519716197171971819719197201972119722197231972419725197261972719728197291973019731197321973319734197351973619737197381973919740197411974219743197441974519746197471974819749197501975119752197531975419755197561975719758197591976019761197621976319764197651976619767197681976919770197711977219773197741977519776197771977819779197801978119782197831978419785197861978719788197891979019791197921979319794197951979619797197981979919800198011980219803198041980519806198071980819809198101981119812198131981419815198161981719818198191982019821198221982319824198251982619827198281982919830198311983219833198341983519836198371983819839198401984119842198431984419845198461984719848198491985019851198521985319854198551985619857198581985919860198611986219863198641986519866198671986819869198701987119872198731987419875198761987719878198791988019881198821988319884198851988619887198881988919890198911989219893198941989519896198971989819899199001990119902199031990419905199061990719908199091991019911199121991319914199151991619917199181991919920199211992219923199241992519926199271992819929199301993119932199331993419935199361993719938199391994019941199421994319944199451994619947199481994919950199511995219953199541995519956199571995819959199601996119962199631996419965199661996719968199691997019971199721997319974199751997619977199781997919980199811998219983199841998519986199871998819989199901999119992199931999419995199961999719998199992000020001200022000320004200052000620007200082000920010200112001220013200142001520016200172001820019200202002120022200232002420025200262002720028200292003020031200322003320034200352003620037200382003920040200412004220043200442004520046200472004820049200502005120052200532005420055200562005720058200592006020061200622006320064200652006620067200682006920070200712007220073200742007520076200772007820079200802008120082200832008420085200862008720088200892009020091200922009320094200952009620097200982009920100201012010220103201042010520106201072010820109201102011120112201132011420115201162011720118201192012020121201222012320124201252012620127201282012920130201312013220133201342013520136201372013820139201402014120142201432014420145201462014720148201492015020151201522015320154201552015620157201582015920160201612016220163201642016520166201672016820169201702017120172201732017420175201762017720178201792018020181201822018320184201852018620187201882018920190201912019220193201942019520196201972019820199202002020120202202032020420205202062020720208202092021020211202122021320214202152021620217202182021920220202212022220223202242022520226202272022820229202302023120232202332023420235202362023720238202392024020241202422024320244202452024620247202482024920250202512025220253202542025520256202572025820259202602026120262202632026420265202662026720268202692027020271202722027320274202752027620277202782027920280202812028220283202842028520286202872028820289202902029120292202932029420295202962029720298202992030020301203022030320304203052030620307203082030920310203112031220313203142031520316203172031820319203202032120322203232032420325203262032720328203292033020331203322033320334203352033620337203382033920340203412034220343203442034520346203472034820349203502035120352203532035420355203562035720358203592036020361203622036320364203652036620367203682036920370203712037220373203742037520376203772037820379203802038120382203832038420385203862038720388203892039020391203922039320394203952039620397203982039920400204012040220403204042040520406204072040820409204102041120412204132041420415204162041720418204192042020421204222042320424204252042620427204282042920430204312043220433204342043520436204372043820439204402044120442204432044420445204462044720448204492045020451204522045320454204552045620457204582045920460204612046220463204642046520466204672046820469204702047120472204732047420475204762047720478204792048020481204822048320484204852048620487204882048920490204912049220493204942049520496204972049820499205002050120502205032050420505205062050720508205092051020511205122051320514205152051620517205182051920520205212052220523205242052520526205272052820529205302053120532205332053420535205362053720538205392054020541205422054320544205452054620547205482054920550205512055220553205542055520556205572055820559205602056120562205632056420565205662056720568205692057020571205722057320574205752057620577205782057920580205812058220583205842058520586205872058820589205902059120592205932059420595205962059720598205992060020601206022060320604206052060620607206082060920610206112061220613206142061520616206172061820619206202062120622206232062420625206262062720628206292063020631206322063320634206352063620637206382063920640206412064220643206442064520646206472064820649206502065120652206532065420655206562065720658206592066020661206622066320664206652066620667206682066920670206712067220673206742067520676206772067820679206802068120682206832068420685206862068720688206892069020691206922069320694206952069620697206982069920700207012070220703207042070520706207072070820709207102071120712207132071420715207162071720718207192072020721207222072320724207252072620727207282072920730207312073220733207342073520736207372073820739207402074120742207432074420745207462074720748207492075020751207522075320754207552075620757207582075920760207612076220763207642076520766207672076820769207702077120772207732077420775207762077720778207792078020781207822078320784207852078620787207882078920790207912079220793207942079520796207972079820799208002080120802208032080420805208062080720808208092081020811208122081320814208152081620817208182081920820208212082220823208242082520826208272082820829208302083120832208332083420835208362083720838208392084020841208422084320844208452084620847208482084920850208512085220853208542085520856208572085820859208602086120862208632086420865208662086720868208692087020871208722087320874208752087620877208782087920880208812088220883208842088520886208872088820889208902089120892208932089420895208962089720898208992090020901209022090320904209052090620907209082090920910209112091220913209142091520916209172091820919209202092120922209232092420925209262092720928209292093020931209322093320934209352093620937209382093920940209412094220943209442094520946209472094820949209502095120952209532095420955209562095720958209592096020961209622096320964209652096620967209682096920970209712097220973209742097520976209772097820979209802098120982209832098420985209862098720988209892099020991209922099320994209952099620997209982099921000210012100221003210042100521006210072100821009210102101121012210132101421015210162101721018210192102021021210222102321024210252102621027210282102921030210312103221033210342103521036210372103821039210402104121042210432104421045210462104721048210492105021051210522105321054210552105621057210582105921060210612106221063210642106521066210672106821069210702107121072210732107421075210762107721078210792108021081210822108321084210852108621087210882108921090210912109221093210942109521096210972109821099211002110121102211032110421105211062110721108211092111021111211122111321114211152111621117211182111921120211212112221123211242112521126211272112821129211302113121132211332113421135211362113721138211392114021141211422114321144211452114621147211482114921150211512115221153211542115521156211572115821159211602116121162211632116421165211662116721168211692117021171211722117321174211752117621177211782117921180211812118221183211842118521186211872118821189211902119121192211932119421195211962119721198211992120021201212022120321204212052120621207212082120921210212112121221213212142121521216212172121821219212202122121222212232122421225212262122721228212292123021231212322123321234212352123621237212382123921240212412124221243212442124521246212472124821249212502125121252212532125421255212562125721258212592126021261212622126321264212652126621267212682126921270212712127221273212742127521276212772127821279212802128121282212832128421285212862128721288212892129021291212922129321294212952129621297212982129921300213012130221303213042130521306213072130821309213102131121312213132131421315213162131721318213192132021321213222132321324213252132621327213282132921330213312133221333213342133521336213372133821339213402134121342213432134421345213462134721348213492135021351213522135321354213552135621357213582135921360213612136221363213642136521366213672136821369213702137121372213732137421375213762137721378213792138021381213822138321384213852138621387213882138921390213912139221393213942139521396213972139821399214002140121402214032140421405214062140721408214092141021411214122141321414214152141621417214182141921420214212142221423214242142521426214272142821429214302143121432214332143421435214362143721438214392144021441214422144321444214452144621447214482144921450214512145221453214542145521456214572145821459214602146121462214632146421465214662146721468214692147021471214722147321474214752147621477214782147921480214812148221483214842148521486214872148821489214902149121492214932149421495214962149721498214992150021501215022150321504215052150621507215082150921510215112151221513215142151521516215172151821519215202152121522215232152421525215262152721528215292153021531215322153321534215352153621537215382153921540215412154221543215442154521546215472154821549215502155121552215532155421555215562155721558215592156021561215622156321564215652156621567215682156921570215712157221573215742157521576215772157821579215802158121582215832158421585215862158721588215892159021591215922159321594215952159621597215982159921600216012160221603216042160521606216072160821609216102161121612216132161421615216162161721618216192162021621216222162321624216252162621627216282162921630216312163221633216342163521636216372163821639216402164121642216432164421645216462164721648216492165021651216522165321654216552165621657216582165921660216612166221663216642166521666216672166821669216702167121672216732167421675216762167721678216792168021681216822168321684216852168621687216882168921690216912169221693216942169521696216972169821699217002170121702217032170421705217062170721708217092171021711217122171321714217152171621717217182171921720217212172221723217242172521726217272172821729217302173121732217332173421735217362173721738217392174021741217422174321744217452174621747217482174921750217512175221753217542175521756217572175821759217602176121762217632176421765217662176721768217692177021771217722177321774217752177621777217782177921780217812178221783217842178521786217872178821789217902179121792217932179421795217962179721798217992180021801218022180321804218052180621807218082180921810218112181221813218142181521816218172181821819218202182121822218232182421825218262182721828218292183021831218322183321834218352183621837218382183921840218412184221843218442184521846218472184821849218502185121852218532185421855218562185721858218592186021861218622186321864218652186621867218682186921870218712187221873218742187521876218772187821879218802188121882218832188421885218862188721888218892189021891218922189321894218952189621897218982189921900219012190221903219042190521906219072190821909219102191121912219132191421915219162191721918219192192021921219222192321924219252192621927219282192921930219312193221933219342193521936219372193821939219402194121942219432194421945219462194721948219492195021951219522195321954219552195621957219582195921960219612196221963219642196521966219672196821969219702197121972219732197421975219762197721978219792198021981219822198321984219852198621987219882198921990219912199221993219942199521996219972199821999220002200122002220032200422005220062200722008220092201022011220122201322014220152201622017220182201922020220212202222023220242202522026220272202822029220302203122032220332203422035220362203722038220392204022041220422204322044220452204622047220482204922050220512205222053220542205522056220572205822059220602206122062220632206422065220662206722068220692207022071220722207322074220752207622077220782207922080220812208222083220842208522086220872208822089220902209122092220932209422095220962209722098220992210022101221022210322104221052210622107221082210922110221112211222113221142211522116221172211822119221202212122122221232212422125221262212722128221292213022131221322213322134221352213622137221382213922140221412214222143221442214522146221472214822149221502215122152221532215422155221562215722158221592216022161221622216322164221652216622167221682216922170221712217222173221742217522176221772217822179221802218122182221832218422185221862218722188221892219022191221922219322194221952219622197221982219922200222012220222203222042220522206222072220822209222102221122212222132221422215222162221722218222192222022221222222222322224222252222622227222282222922230222312223222233222342223522236222372223822239222402224122242222432224422245222462224722248222492225022251222522225322254222552225622257222582225922260222612226222263222642226522266222672226822269222702227122272222732227422275222762227722278222792228022281222822228322284222852228622287222882228922290222912229222293222942229522296222972229822299223002230122302223032230422305223062230722308223092231022311223122231322314223152231622317223182231922320223212232222323223242232522326223272232822329223302233122332223332233422335223362233722338223392234022341223422234322344223452234622347223482234922350223512235222353223542235522356223572235822359223602236122362223632236422365223662236722368223692237022371223722237322374223752237622377223782237922380223812238222383223842238522386223872238822389223902239122392223932239422395223962239722398223992240022401224022240322404224052240622407224082240922410224112241222413224142241522416224172241822419224202242122422224232242422425224262242722428224292243022431224322243322434224352243622437224382243922440224412244222443224442244522446224472244822449224502245122452224532245422455224562245722458224592246022461224622246322464224652246622467224682246922470224712247222473224742247522476224772247822479224802248122482224832248422485224862248722488224892249022491224922249322494224952249622497224982249922500225012250222503225042250522506225072250822509225102251122512225132251422515225162251722518225192252022521225222252322524225252252622527225282252922530225312253222533225342253522536225372253822539225402254122542225432254422545225462254722548225492255022551225522255322554225552255622557225582255922560225612256222563225642256522566225672256822569225702257122572225732257422575225762257722578225792258022581225822258322584225852258622587225882258922590225912259222593225942259522596225972259822599226002260122602226032260422605226062260722608226092261022611226122261322614226152261622617226182261922620226212262222623226242262522626226272262822629226302263122632226332263422635226362263722638226392264022641226422264322644226452264622647226482264922650226512265222653226542265522656226572265822659226602266122662226632266422665226662266722668226692267022671226722267322674226752267622677226782267922680226812268222683226842268522686226872268822689226902269122692226932269422695226962269722698226992270022701227022270322704227052270622707227082270922710227112271222713227142271522716227172271822719227202272122722227232272422725227262272722728227292273022731227322273322734227352273622737227382273922740227412274222743227442274522746227472274822749227502275122752227532275422755227562275722758227592276022761227622276322764227652276622767227682276922770227712277222773227742277522776227772277822779227802278122782227832278422785227862278722788227892279022791227922279322794227952279622797227982279922800228012280222803228042280522806228072280822809228102281122812228132281422815228162281722818228192282022821228222282322824228252282622827228282282922830228312283222833228342283522836228372283822839228402284122842228432284422845228462284722848228492285022851228522285322854228552285622857228582285922860228612286222863228642286522866228672286822869228702287122872228732287422875228762287722878228792288022881228822288322884228852288622887228882288922890228912289222893228942289522896228972289822899229002290122902229032290422905229062290722908229092291022911229122291322914229152291622917229182291922920229212292222923229242292522926229272292822929229302293122932229332293422935229362293722938229392294022941229422294322944229452294622947229482294922950229512295222953229542295522956229572295822959229602296122962229632296422965229662296722968229692297022971229722297322974229752297622977229782297922980229812298222983229842298522986229872298822989229902299122992229932299422995229962299722998229992300023001230022300323004230052300623007230082300923010230112301223013230142301523016230172301823019230202302123022230232302423025230262302723028230292303023031230322303323034230352303623037230382303923040230412304223043230442304523046230472304823049230502305123052230532305423055230562305723058230592306023061230622306323064230652306623067230682306923070230712307223073230742307523076230772307823079230802308123082230832308423085230862308723088230892309023091230922309323094230952309623097230982309923100231012310223103231042310523106231072310823109231102311123112231132311423115231162311723118231192312023121231222312323124231252312623127231282312923130231312313223133231342313523136231372313823139231402314123142231432314423145231462314723148231492315023151231522315323154231552315623157231582315923160231612316223163231642316523166231672316823169231702317123172231732317423175231762317723178231792318023181231822318323184231852318623187231882318923190231912319223193231942319523196231972319823199232002320123202232032320423205232062320723208232092321023211232122321323214232152321623217232182321923220232212322223223232242322523226232272322823229232302323123232232332323423235232362323723238232392324023241232422324323244232452324623247232482324923250232512325223253232542325523256232572325823259232602326123262232632326423265232662326723268232692327023271232722327323274232752327623277232782327923280232812328223283232842328523286232872328823289232902329123292232932329423295232962329723298232992330023301233022330323304233052330623307233082330923310233112331223313233142331523316233172331823319233202332123322233232332423325233262332723328233292333023331233322333323334233352333623337233382333923340233412334223343233442334523346233472334823349233502335123352233532335423355233562335723358233592336023361233622336323364233652336623367233682336923370233712337223373233742337523376233772337823379233802338123382233832338423385233862338723388233892339023391233922339323394233952339623397233982339923400234012340223403234042340523406234072340823409234102341123412234132341423415234162341723418234192342023421234222342323424234252342623427234282342923430234312343223433234342343523436234372343823439234402344123442234432344423445234462344723448234492345023451234522345323454234552345623457234582345923460234612346223463234642346523466234672346823469234702347123472234732347423475234762347723478234792348023481234822348323484234852348623487234882348923490234912349223493234942349523496234972349823499235002350123502235032350423505235062350723508235092351023511235122351323514235152351623517235182351923520235212352223523235242352523526235272352823529235302353123532235332353423535235362353723538235392354023541235422354323544235452354623547235482354923550235512355223553235542355523556235572355823559235602356123562235632356423565235662356723568235692357023571235722357323574235752357623577235782357923580235812358223583235842358523586235872358823589235902359123592235932359423595235962359723598235992360023601236022360323604236052360623607236082360923610236112361223613236142361523616236172361823619236202362123622236232362423625236262362723628236292363023631236322363323634236352363623637236382363923640236412364223643236442364523646236472364823649236502365123652236532365423655236562365723658236592366023661236622366323664236652366623667236682366923670236712367223673236742367523676236772367823679236802368123682236832368423685236862368723688236892369023691236922369323694236952369623697236982369923700237012370223703237042370523706237072370823709237102371123712237132371423715237162371723718237192372023721237222372323724237252372623727237282372923730237312373223733237342373523736237372373823739237402374123742237432374423745237462374723748237492375023751237522375323754237552375623757237582375923760237612376223763237642376523766237672376823769237702377123772237732377423775237762377723778237792378023781237822378323784237852378623787237882378923790237912379223793237942379523796237972379823799238002380123802238032380423805238062380723808238092381023811238122381323814238152381623817238182381923820238212382223823238242382523826238272382823829238302383123832238332383423835238362383723838238392384023841238422384323844238452384623847238482384923850238512385223853238542385523856238572385823859238602386123862238632386423865238662386723868238692387023871238722387323874238752387623877238782387923880238812388223883238842388523886238872388823889238902389123892238932389423895238962389723898238992390023901239022390323904239052390623907239082390923910239112391223913239142391523916239172391823919239202392123922239232392423925239262392723928239292393023931239322393323934239352393623937239382393923940239412394223943239442394523946239472394823949239502395123952239532395423955239562395723958239592396023961239622396323964239652396623967239682396923970239712397223973239742397523976239772397823979239802398123982239832398423985239862398723988239892399023991239922399323994239952399623997239982399924000240012400224003240042400524006240072400824009240102401124012240132401424015240162401724018240192402024021240222402324024240252402624027240282402924030240312403224033240342403524036240372403824039240402404124042240432404424045240462404724048240492405024051240522405324054240552405624057240582405924060240612406224063240642406524066240672406824069240702407124072240732407424075240762407724078240792408024081240822408324084240852408624087240882408924090240912409224093240942409524096240972409824099241002410124102241032410424105241062410724108241092411024111241122411324114241152411624117241182411924120241212412224123241242412524126241272412824129241302413124132241332413424135241362413724138241392414024141241422414324144241452414624147241482414924150241512415224153241542415524156241572415824159241602416124162241632416424165241662416724168241692417024171241722417324174241752417624177241782417924180241812418224183241842418524186241872418824189241902419124192241932419424195241962419724198241992420024201242022420324204242052420624207242082420924210242112421224213242142421524216242172421824219242202422124222242232422424225242262422724228242292423024231242322423324234242352423624237242382423924240242412424224243242442424524246242472424824249242502425124252242532425424255242562425724258242592426024261242622426324264242652426624267242682426924270242712427224273242742427524276242772427824279242802428124282242832428424285242862428724288242892429024291242922429324294242952429624297242982429924300243012430224303243042430524306243072430824309243102431124312243132431424315243162431724318243192432024321243222432324324243252432624327243282432924330243312433224333243342433524336243372433824339243402434124342243432434424345243462434724348243492435024351243522435324354243552435624357243582435924360243612436224363243642436524366243672436824369243702437124372243732437424375243762437724378243792438024381243822438324384243852438624387243882438924390243912439224393243942439524396243972439824399244002440124402244032440424405244062440724408244092441024411244122441324414244152441624417244182441924420244212442224423244242442524426244272442824429244302443124432244332443424435244362443724438244392444024441244422444324444244452444624447244482444924450244512445224453244542445524456244572445824459244602446124462244632446424465244662446724468244692447024471244722447324474244752447624477244782447924480244812448224483244842448524486244872448824489244902449124492244932449424495244962449724498244992450024501245022450324504245052450624507245082450924510245112451224513245142451524516245172451824519245202452124522245232452424525245262452724528245292453024531245322453324534245352453624537245382453924540245412454224543245442454524546245472454824549245502455124552245532455424555245562455724558245592456024561245622456324564245652456624567245682456924570245712457224573245742457524576245772457824579245802458124582245832458424585245862458724588245892459024591245922459324594245952459624597245982459924600246012460224603246042460524606246072460824609246102461124612246132461424615246162461724618246192462024621246222462324624246252462624627246282462924630246312463224633246342463524636246372463824639246402464124642246432464424645246462464724648246492465024651246522465324654246552465624657246582465924660246612466224663246642466524666246672466824669246702467124672246732467424675246762467724678246792468024681246822468324684246852468624687246882468924690246912469224693246942469524696246972469824699247002470124702247032470424705247062470724708247092471024711247122471324714247152471624717247182471924720247212472224723247242472524726247272472824729247302473124732247332473424735247362473724738247392474024741247422474324744247452474624747247482474924750247512475224753247542475524756247572475824759247602476124762247632476424765247662476724768247692477024771247722477324774247752477624777247782477924780247812478224783247842478524786247872478824789247902479124792247932479424795247962479724798247992480024801248022480324804248052480624807248082480924810248112481224813248142481524816248172481824819248202482124822248232482424825248262482724828248292483024831248322483324834248352483624837248382483924840248412484224843248442484524846248472484824849248502485124852248532485424855248562485724858248592486024861248622486324864248652486624867248682486924870248712487224873248742487524876248772487824879248802488124882248832488424885248862488724888248892489024891248922489324894248952489624897248982489924900249012490224903249042490524906249072490824909249102491124912249132491424915249162491724918249192492024921249222492324924249252492624927249282492924930249312493224933249342493524936249372493824939249402494124942249432494424945249462494724948249492495024951249522495324954249552495624957249582495924960249612496224963249642496524966249672496824969249702497124972249732497424975249762497724978249792498024981249822498324984249852498624987249882498924990249912499224993249942499524996249972499824999250002500125002250032500425005250062500725008250092501025011250122501325014250152501625017250182501925020250212502225023250242502525026250272502825029250302503125032250332503425035250362503725038250392504025041250422504325044250452504625047250482504925050250512505225053250542505525056250572505825059250602506125062250632506425065250662506725068250692507025071250722507325074250752507625077250782507925080250812508225083250842508525086250872508825089250902509125092250932509425095250962509725098250992510025101251022510325104251052510625107251082510925110251112511225113251142511525116251172511825119251202512125122251232512425125251262512725128251292513025131251322513325134251352513625137251382513925140251412514225143251442514525146251472514825149251502515125152251532515425155251562515725158251592516025161251622516325164251652516625167251682516925170251712517225173251742517525176251772517825179251802518125182251832518425185251862518725188251892519025191251922519325194251952519625197251982519925200252012520225203252042520525206252072520825209252102521125212252132521425215252162521725218252192522025221252222522325224252252522625227252282522925230252312523225233252342523525236252372523825239252402524125242252432524425245252462524725248252492525025251252522525325254252552525625257252582525925260252612526225263252642526525266252672526825269252702527125272252732527425275252762527725278252792528025281252822528325284252852528625287252882528925290252912529225293252942529525296252972529825299253002530125302253032530425305253062530725308253092531025311253122531325314253152531625317253182531925320253212532225323253242532525326253272532825329253302533125332253332533425335253362533725338253392534025341253422534325344253452534625347253482534925350253512535225353253542535525356253572535825359253602536125362253632536425365253662536725368253692537025371253722537325374253752537625377253782537925380253812538225383253842538525386253872538825389253902539125392253932539425395253962539725398253992540025401254022540325404254052540625407254082540925410254112541225413254142541525416254172541825419254202542125422254232542425425254262542725428254292543025431254322543325434254352543625437254382543925440254412544225443254442544525446254472544825449254502545125452254532545425455254562545725458254592546025461254622546325464254652546625467254682546925470254712547225473254742547525476254772547825479254802548125482254832548425485254862548725488254892549025491254922549325494254952549625497254982549925500255012550225503255042550525506255072550825509255102551125512255132551425515255162551725518255192552025521255222552325524255252552625527255282552925530255312553225533255342553525536255372553825539255402554125542255432554425545255462554725548255492555025551255522555325554255552555625557255582555925560255612556225563255642556525566255672556825569255702557125572255732557425575255762557725578255792558025581255822558325584255852558625587255882558925590255912559225593255942559525596255972559825599256002560125602256032560425605256062560725608256092561025611256122561325614256152561625617256182561925620256212562225623256242562525626256272562825629256302563125632256332563425635256362563725638256392564025641256422564325644256452564625647256482564925650256512565225653256542565525656256572565825659256602566125662256632566425665256662566725668256692567025671256722567325674256752567625677256782567925680256812568225683256842568525686256872568825689256902569125692256932569425695256962569725698256992570025701257022570325704257052570625707257082570925710257112571225713257142571525716257172571825719257202572125722257232572425725257262572725728257292573025731257322573325734257352573625737257382573925740257412574225743257442574525746257472574825749257502575125752257532575425755257562575725758257592576025761257622576325764257652576625767257682576925770257712577225773257742577525776257772577825779257802578125782257832578425785257862578725788257892579025791257922579325794257952579625797257982579925800258012580225803258042580525806258072580825809258102581125812258132581425815258162581725818258192582025821258222582325824258252582625827258282582925830258312583225833258342583525836258372583825839258402584125842258432584425845258462584725848258492585025851258522585325854258552585625857258582585925860258612586225863258642586525866258672586825869258702587125872258732587425875258762587725878258792588025881258822588325884258852588625887258882588925890258912589225893258942589525896258972589825899259002590125902259032590425905259062590725908259092591025911259122591325914259152591625917259182591925920259212592225923259242592525926259272592825929259302593125932259332593425935259362593725938259392594025941259422594325944259452594625947259482594925950259512595225953259542595525956259572595825959259602596125962259632596425965259662596725968259692597025971259722597325974259752597625977259782597925980259812598225983259842598525986259872598825989259902599125992259932599425995259962599725998259992600026001260022600326004260052600626007260082600926010260112601226013260142601526016260172601826019260202602126022260232602426025260262602726028260292603026031260322603326034260352603626037260382603926040260412604226043260442604526046260472604826049260502605126052260532605426055260562605726058260592606026061260622606326064260652606626067260682606926070260712607226073260742607526076260772607826079260802608126082260832608426085260862608726088260892609026091260922609326094260952609626097260982609926100261012610226103261042610526106261072610826109261102611126112261132611426115261162611726118261192612026121261222612326124261252612626127261282612926130261312613226133261342613526136261372613826139261402614126142261432614426145261462614726148261492615026151261522615326154261552615626157261582615926160261612616226163261642616526166261672616826169261702617126172261732617426175261762617726178261792618026181261822618326184261852618626187261882618926190261912619226193261942619526196261972619826199262002620126202262032620426205262062620726208262092621026211262122621326214262152621626217262182621926220262212622226223262242622526226262272622826229262302623126232262332623426235262362623726238262392624026241262422624326244262452624626247262482624926250262512625226253262542625526256262572625826259262602626126262262632626426265262662626726268262692627026271262722627326274262752627626277262782627926280262812628226283262842628526286262872628826289262902629126292262932629426295262962629726298262992630026301263022630326304263052630626307263082630926310263112631226313263142631526316263172631826319263202632126322263232632426325263262632726328263292633026331263322633326334263352633626337263382633926340263412634226343263442634526346263472634826349263502635126352263532635426355263562635726358263592636026361263622636326364263652636626367263682636926370263712637226373263742637526376263772637826379263802638126382263832638426385263862638726388263892639026391263922639326394263952639626397263982639926400264012640226403264042640526406264072640826409264102641126412264132641426415264162641726418264192642026421264222642326424264252642626427264282642926430264312643226433264342643526436264372643826439264402644126442264432644426445264462644726448264492645026451264522645326454264552645626457264582645926460264612646226463264642646526466264672646826469264702647126472264732647426475264762647726478264792648026481264822648326484264852648626487264882648926490264912649226493264942649526496264972649826499265002650126502265032650426505265062650726508265092651026511265122651326514265152651626517265182651926520265212652226523265242652526526265272652826529265302653126532265332653426535265362653726538265392654026541265422654326544265452654626547265482654926550265512655226553265542655526556265572655826559265602656126562265632656426565265662656726568265692657026571265722657326574265752657626577265782657926580265812658226583265842658526586265872658826589265902659126592265932659426595265962659726598265992660026601266022660326604266052660626607266082660926610266112661226613266142661526616266172661826619266202662126622266232662426625266262662726628266292663026631266322663326634266352663626637266382663926640266412664226643266442664526646266472664826649266502665126652266532665426655266562665726658266592666026661266622666326664266652666626667266682666926670266712667226673266742667526676266772667826679266802668126682266832668426685266862668726688266892669026691266922669326694266952669626697266982669926700267012670226703267042670526706267072670826709267102671126712267132671426715267162671726718267192672026721267222672326724267252672626727267282672926730267312673226733267342673526736267372673826739267402674126742267432674426745267462674726748267492675026751267522675326754267552675626757267582675926760267612676226763267642676526766267672676826769267702677126772267732677426775267762677726778267792678026781267822678326784267852678626787267882678926790267912679226793267942679526796267972679826799268002680126802268032680426805268062680726808268092681026811268122681326814268152681626817268182681926820268212682226823268242682526826268272682826829268302683126832268332683426835268362683726838268392684026841268422684326844268452684626847268482684926850268512685226853268542685526856268572685826859268602686126862268632686426865268662686726868268692687026871268722687326874268752687626877268782687926880268812688226883268842688526886268872688826889268902689126892268932689426895268962689726898268992690026901269022690326904269052690626907269082690926910269112691226913269142691526916269172691826919269202692126922269232692426925269262692726928269292693026931269322693326934269352693626937269382693926940269412694226943269442694526946269472694826949269502695126952269532695426955269562695726958269592696026961269622696326964269652696626967269682696926970269712697226973269742697526976269772697826979269802698126982269832698426985269862698726988269892699026991269922699326994269952699626997269982699927000270012700227003270042700527006270072700827009270102701127012270132701427015270162701727018270192702027021270222702327024270252702627027270282702927030270312703227033270342703527036270372703827039270402704127042270432704427045270462704727048270492705027051270522705327054270552705627057270582705927060270612706227063270642706527066270672706827069270702707127072270732707427075270762707727078270792708027081270822708327084270852708627087270882708927090270912709227093270942709527096270972709827099271002710127102271032710427105271062710727108271092711027111271122711327114271152711627117271182711927120271212712227123271242712527126271272712827129271302713127132271332713427135271362713727138271392714027141271422714327144271452714627147271482714927150271512715227153271542715527156271572715827159271602716127162271632716427165271662716727168271692717027171271722717327174271752717627177271782717927180271812718227183271842718527186271872718827189271902719127192271932719427195271962719727198271992720027201272022720327204272052720627207272082720927210272112721227213272142721527216272172721827219272202722127222272232722427225272262722727228272292723027231272322723327234272352723627237272382723927240272412724227243272442724527246272472724827249272502725127252272532725427255272562725727258272592726027261272622726327264272652726627267272682726927270272712727227273272742727527276272772727827279272802728127282272832728427285272862728727288272892729027291272922729327294272952729627297272982729927300273012730227303273042730527306273072730827309273102731127312273132731427315273162731727318273192732027321273222732327324273252732627327273282732927330273312733227333273342733527336273372733827339273402734127342273432734427345273462734727348273492735027351273522735327354273552735627357273582735927360273612736227363273642736527366273672736827369273702737127372273732737427375273762737727378273792738027381273822738327384273852738627387273882738927390273912739227393273942739527396273972739827399274002740127402274032740427405274062740727408274092741027411274122741327414274152741627417274182741927420274212742227423274242742527426274272742827429274302743127432274332743427435274362743727438274392744027441274422744327444274452744627447274482744927450274512745227453274542745527456274572745827459274602746127462274632746427465274662746727468274692747027471274722747327474274752747627477274782747927480274812748227483274842748527486274872748827489274902749127492274932749427495274962749727498274992750027501275022750327504275052750627507275082750927510275112751227513275142751527516275172751827519275202752127522275232752427525275262752727528275292753027531275322753327534275352753627537275382753927540275412754227543275442754527546275472754827549275502755127552275532755427555275562755727558275592756027561275622756327564275652756627567275682756927570275712757227573275742757527576275772757827579275802758127582275832758427585275862758727588275892759027591275922759327594275952759627597275982759927600276012760227603276042760527606276072760827609276102761127612276132761427615276162761727618276192762027621276222762327624276252762627627276282762927630276312763227633276342763527636276372763827639276402764127642276432764427645276462764727648276492765027651276522765327654276552765627657276582765927660276612766227663276642766527666276672766827669276702767127672276732767427675276762767727678276792768027681276822768327684276852768627687276882768927690276912769227693276942769527696276972769827699277002770127702277032770427705277062770727708277092771027711277122771327714277152771627717277182771927720277212772227723277242772527726277272772827729277302773127732277332773427735277362773727738277392774027741277422774327744277452774627747277482774927750277512775227753277542775527756277572775827759277602776127762277632776427765277662776727768277692777027771277722777327774277752777627777277782777927780277812778227783277842778527786277872778827789277902779127792277932779427795277962779727798277992780027801278022780327804278052780627807278082780927810278112781227813278142781527816278172781827819278202782127822278232782427825278262782727828278292783027831278322783327834278352783627837278382783927840278412784227843278442784527846278472784827849278502785127852278532785427855278562785727858278592786027861278622786327864278652786627867278682786927870278712787227873278742787527876278772787827879278802788127882278832788427885278862788727888278892789027891278922789327894278952789627897278982789927900279012790227903279042790527906279072790827909279102791127912279132791427915279162791727918279192792027921279222792327924279252792627927279282792927930279312793227933279342793527936279372793827939279402794127942279432794427945279462794727948279492795027951279522795327954279552795627957279582795927960279612796227963279642796527966279672796827969279702797127972279732797427975279762797727978279792798027981279822798327984279852798627987279882798927990279912799227993279942799527996279972799827999280002800128002280032800428005280062800728008280092801028011280122801328014280152801628017280182801928020280212802228023280242802528026280272802828029280302803128032280332803428035280362803728038280392804028041280422804328044280452804628047280482804928050280512805228053280542805528056280572805828059280602806128062280632806428065280662806728068280692807028071280722807328074280752807628077280782807928080280812808228083280842808528086280872808828089280902809128092280932809428095280962809728098280992810028101281022810328104281052810628107281082810928110281112811228113281142811528116281172811828119281202812128122281232812428125281262812728128281292813028131281322813328134281352813628137281382813928140281412814228143281442814528146281472814828149281502815128152281532815428155281562815728158281592816028161281622816328164281652816628167281682816928170281712817228173281742817528176281772817828179281802818128182281832818428185281862818728188281892819028191281922819328194281952819628197281982819928200282012820228203282042820528206282072820828209282102821128212282132821428215282162821728218282192822028221282222822328224282252822628227282282822928230282312823228233282342823528236282372823828239282402824128242282432824428245282462824728248282492825028251282522825328254282552825628257282582825928260282612826228263282642826528266282672826828269282702827128272282732827428275282762827728278282792828028281282822828328284282852828628287282882828928290282912829228293282942829528296282972829828299283002830128302283032830428305283062830728308283092831028311283122831328314283152831628317283182831928320283212832228323283242832528326283272832828329283302833128332283332833428335283362833728338283392834028341283422834328344283452834628347283482834928350283512835228353283542835528356283572835828359283602836128362283632836428365283662836728368283692837028371283722837328374283752837628377283782837928380283812838228383283842838528386283872838828389283902839128392283932839428395283962839728398283992840028401284022840328404284052840628407284082840928410284112841228413284142841528416284172841828419284202842128422284232842428425284262842728428284292843028431284322843328434284352843628437284382843928440284412844228443284442844528446284472844828449284502845128452284532845428455284562845728458284592846028461284622846328464284652846628467284682846928470284712847228473284742847528476284772847828479284802848128482284832848428485284862848728488284892849028491284922849328494284952849628497284982849928500285012850228503285042850528506285072850828509285102851128512285132851428515285162851728518285192852028521285222852328524285252852628527285282852928530285312853228533285342853528536285372853828539285402854128542285432854428545285462854728548285492855028551285522855328554285552855628557285582855928560285612856228563285642856528566285672856828569285702857128572285732857428575285762857728578285792858028581285822858328584285852858628587285882858928590285912859228593285942859528596285972859828599286002860128602286032860428605286062860728608286092861028611286122861328614286152861628617286182861928620286212862228623286242862528626286272862828629286302863128632286332863428635286362863728638286392864028641286422864328644286452864628647286482864928650286512865228653286542865528656286572865828659286602866128662286632866428665286662866728668286692867028671286722867328674286752867628677286782867928680286812868228683286842868528686286872868828689286902869128692286932869428695286962869728698286992870028701287022870328704287052870628707287082870928710287112871228713287142871528716287172871828719287202872128722287232872428725287262872728728287292873028731287322873328734287352873628737287382873928740287412874228743287442874528746287472874828749287502875128752287532875428755287562875728758287592876028761287622876328764287652876628767287682876928770287712877228773287742877528776287772877828779287802878128782287832878428785287862878728788287892879028791287922879328794287952879628797287982879928800288012880228803288042880528806288072880828809288102881128812288132881428815288162881728818288192882028821288222882328824288252882628827288282882928830288312883228833288342883528836288372883828839288402884128842288432884428845288462884728848288492885028851288522885328854288552885628857288582885928860288612886228863288642886528866288672886828869288702887128872288732887428875288762887728878288792888028881288822888328884288852888628887288882888928890288912889228893288942889528896288972889828899289002890128902289032890428905289062890728908289092891028911289122891328914289152891628917289182891928920289212892228923289242892528926289272892828929289302893128932289332893428935289362893728938289392894028941289422894328944289452894628947289482894928950289512895228953289542895528956289572895828959289602896128962289632896428965289662896728968289692897028971289722897328974289752897628977289782897928980289812898228983289842898528986289872898828989289902899128992289932899428995289962899728998289992900029001290022900329004290052900629007290082900929010290112901229013290142901529016290172901829019290202902129022290232902429025290262902729028290292903029031290322903329034290352903629037290382903929040290412904229043290442904529046290472904829049290502905129052290532905429055290562905729058290592906029061290622906329064290652906629067290682906929070290712907229073290742907529076290772907829079290802908129082290832908429085290862908729088290892909029091290922909329094290952909629097290982909929100291012910229103291042910529106291072910829109291102911129112291132911429115291162911729118291192912029121291222912329124291252912629127291282912929130291312913229133291342913529136291372913829139291402914129142291432914429145291462914729148291492915029151291522915329154291552915629157291582915929160291612916229163291642916529166291672916829169291702917129172291732917429175291762917729178291792918029181291822918329184291852918629187291882918929190291912919229193291942919529196291972919829199292002920129202292032920429205292062920729208292092921029211292122921329214292152921629217292182921929220292212922229223292242922529226292272922829229292302923129232292332923429235292362923729238292392924029241292422924329244292452924629247292482924929250292512925229253292542925529256292572925829259292602926129262292632926429265292662926729268292692927029271292722927329274292752927629277292782927929280292812928229283292842928529286292872928829289292902929129292292932929429295292962929729298292992930029301293022930329304293052930629307293082930929310293112931229313293142931529316293172931829319293202932129322293232932429325293262932729328293292933029331293322933329334293352933629337293382933929340293412934229343293442934529346293472934829349293502935129352293532935429355293562935729358293592936029361293622936329364293652936629367293682936929370293712937229373293742937529376293772937829379293802938129382293832938429385293862938729388293892939029391293922939329394293952939629397293982939929400294012940229403294042940529406294072940829409294102941129412294132941429415294162941729418294192942029421294222942329424294252942629427294282942929430294312943229433294342943529436294372943829439294402944129442294432944429445294462944729448294492945029451294522945329454294552945629457294582945929460294612946229463294642946529466294672946829469294702947129472294732947429475294762947729478294792948029481294822948329484294852948629487294882948929490294912949229493294942949529496294972949829499295002950129502295032950429505295062950729508295092951029511295122951329514295152951629517295182951929520295212952229523295242952529526295272952829529295302953129532295332953429535295362953729538295392954029541295422954329544295452954629547295482954929550295512955229553295542955529556295572955829559295602956129562295632956429565295662956729568295692957029571295722957329574295752957629577295782957929580295812958229583295842958529586295872958829589295902959129592295932959429595295962959729598295992960029601296022960329604296052960629607296082960929610296112961229613296142961529616296172961829619296202962129622296232962429625296262962729628296292963029631296322963329634296352963629637296382963929640296412964229643296442964529646296472964829649296502965129652296532965429655296562965729658296592966029661296622966329664296652966629667296682966929670296712967229673296742967529676296772967829679296802968129682296832968429685296862968729688296892969029691296922969329694296952969629697296982969929700297012970229703297042970529706297072970829709297102971129712297132971429715297162971729718297192972029721297222972329724297252972629727297282972929730297312973229733297342973529736297372973829739297402974129742297432974429745297462974729748297492975029751297522975329754297552975629757297582975929760297612976229763297642976529766297672976829769297702977129772297732977429775297762977729778297792978029781297822978329784297852978629787297882978929790297912979229793297942979529796297972979829799298002980129802298032980429805298062980729808298092981029811298122981329814298152981629817298182981929820298212982229823298242982529826298272982829829298302983129832298332983429835298362983729838298392984029841298422984329844298452984629847298482984929850298512985229853298542985529856298572985829859298602986129862298632986429865298662986729868298692987029871298722987329874298752987629877298782987929880298812988229883298842988529886298872988829889298902989129892298932989429895298962989729898298992990029901299022990329904299052990629907299082990929910299112991229913299142991529916299172991829919299202992129922299232992429925299262992729928299292993029931299322993329934299352993629937299382993929940299412994229943299442994529946299472994829949299502995129952299532995429955299562995729958299592996029961299622996329964299652996629967299682996929970299712997229973299742997529976299772997829979299802998129982299832998429985299862998729988299892999029991299922999329994299952999629997299982999930000300013000230003300043000530006300073000830009300103001130012300133001430015300163001730018300193002030021300223002330024300253002630027300283002930030300313003230033300343003530036300373003830039300403004130042300433004430045300463004730048300493005030051300523005330054300553005630057300583005930060300613006230063300643006530066300673006830069300703007130072300733007430075300763007730078300793008030081300823008330084300853008630087300883008930090300913009230093300943009530096300973009830099301003010130102301033010430105301063010730108301093011030111301123011330114301153011630117301183011930120301213012230123301243012530126301273012830129301303013130132301333013430135301363013730138301393014030141301423014330144301453014630147301483014930150301513015230153301543015530156301573015830159301603016130162301633016430165301663016730168301693017030171301723017330174301753017630177301783017930180301813018230183301843018530186301873018830189301903019130192301933019430195301963019730198301993020030201302023020330204302053020630207302083020930210302113021230213302143021530216302173021830219302203022130222302233022430225302263022730228302293023030231302323023330234302353023630237302383023930240302413024230243302443024530246302473024830249302503025130252302533025430255302563025730258302593026030261302623026330264302653026630267302683026930270302713027230273302743027530276302773027830279302803028130282302833028430285302863028730288302893029030291302923029330294302953029630297302983029930300303013030230303303043030530306303073030830309303103031130312303133031430315303163031730318303193032030321303223032330324303253032630327303283032930330303313033230333303343033530336303373033830339303403034130342303433034430345303463034730348303493035030351303523035330354303553035630357303583035930360303613036230363303643036530366303673036830369303703037130372303733037430375303763037730378303793038030381303823038330384303853038630387303883038930390303913039230393303943039530396303973039830399304003040130402304033040430405304063040730408304093041030411304123041330414304153041630417304183041930420304213042230423304243042530426304273042830429304303043130432304333043430435304363043730438304393044030441304423044330444304453044630447304483044930450304513045230453304543045530456304573045830459304603046130462304633046430465304663046730468304693047030471304723047330474304753047630477304783047930480304813048230483304843048530486304873048830489304903049130492304933049430495304963049730498304993050030501305023050330504305053050630507305083050930510305113051230513305143051530516305173051830519305203052130522305233052430525305263052730528305293053030531305323053330534305353053630537305383053930540305413054230543305443054530546305473054830549305503055130552305533055430555305563055730558305593056030561305623056330564305653056630567305683056930570305713057230573305743057530576305773057830579305803058130582305833058430585305863058730588305893059030591305923059330594305953059630597305983059930600306013060230603306043060530606306073060830609306103061130612306133061430615306163061730618306193062030621306223062330624306253062630627306283062930630306313063230633306343063530636306373063830639306403064130642306433064430645306463064730648306493065030651306523065330654306553065630657306583065930660306613066230663306643066530666306673066830669306703067130672306733067430675306763067730678306793068030681306823068330684306853068630687306883068930690306913069230693306943069530696306973069830699307003070130702307033070430705307063070730708307093071030711307123071330714307153071630717307183071930720307213072230723307243072530726307273072830729307303073130732307333073430735307363073730738307393074030741307423074330744307453074630747307483074930750307513075230753307543075530756307573075830759307603076130762307633076430765307663076730768307693077030771307723077330774307753077630777307783077930780307813078230783307843078530786307873078830789307903079130792307933079430795307963079730798307993080030801308023080330804308053080630807308083080930810308113081230813308143081530816308173081830819308203082130822308233082430825308263082730828308293083030831308323083330834308353083630837308383083930840308413084230843308443084530846308473084830849308503085130852308533085430855308563085730858308593086030861308623086330864308653086630867308683086930870308713087230873308743087530876308773087830879308803088130882308833088430885308863088730888308893089030891308923089330894308953089630897308983089930900309013090230903309043090530906309073090830909309103091130912309133091430915309163091730918309193092030921309223092330924309253092630927309283092930930309313093230933309343093530936309373093830939309403094130942309433094430945309463094730948309493095030951309523095330954309553095630957309583095930960309613096230963309643096530966309673096830969309703097130972309733097430975309763097730978309793098030981309823098330984309853098630987309883098930990309913099230993309943099530996309973099830999310003100131002310033100431005310063100731008310093101031011310123101331014310153101631017310183101931020310213102231023310243102531026310273102831029310303103131032310333103431035310363103731038310393104031041310423104331044310453104631047310483104931050310513105231053310543105531056310573105831059310603106131062310633106431065310663106731068310693107031071310723107331074310753107631077310783107931080310813108231083310843108531086310873108831089310903109131092310933109431095310963109731098310993110031101311023110331104311053110631107311083110931110311113111231113311143111531116311173111831119311203112131122311233112431125311263112731128311293113031131311323113331134311353113631137311383113931140311413114231143311443114531146311473114831149311503115131152311533115431155311563115731158311593116031161311623116331164311653116631167311683116931170311713117231173311743117531176311773117831179311803118131182311833118431185311863118731188311893119031191311923119331194311953119631197311983119931200312013120231203312043120531206312073120831209312103121131212312133121431215312163121731218312193122031221312223122331224312253122631227312283122931230312313123231233312343123531236312373123831239312403124131242312433124431245312463124731248312493125031251312523125331254312553125631257312583125931260312613126231263312643126531266312673126831269312703127131272312733127431275312763127731278312793128031281312823128331284312853128631287312883128931290312913129231293312943129531296312973129831299313003130131302313033130431305313063130731308313093131031311313123131331314313153131631317313183131931320313213132231323313243132531326313273132831329313303133131332313333133431335313363133731338313393134031341313423134331344313453134631347313483134931350313513135231353313543135531356313573135831359313603136131362313633136431365313663136731368313693137031371313723137331374313753137631377313783137931380313813138231383313843138531386313873138831389313903139131392313933139431395313963139731398313993140031401314023140331404314053140631407314083140931410314113141231413314143141531416314173141831419314203142131422314233142431425314263142731428314293143031431314323143331434314353143631437314383143931440314413144231443314443144531446314473144831449314503145131452314533145431455314563145731458314593146031461314623146331464314653146631467314683146931470314713147231473314743147531476314773147831479314803148131482314833148431485314863148731488314893149031491314923149331494314953149631497314983149931500315013150231503315043150531506315073150831509315103151131512315133151431515315163151731518315193152031521315223152331524315253152631527315283152931530315313153231533315343153531536315373153831539315403154131542315433154431545315463154731548315493155031551315523155331554315553155631557315583155931560315613156231563315643156531566315673156831569315703157131572315733157431575315763157731578315793158031581315823158331584315853158631587315883158931590315913159231593315943159531596315973159831599316003160131602316033160431605316063160731608316093161031611316123161331614316153161631617316183161931620316213162231623316243162531626316273162831629316303163131632316333163431635316363163731638316393164031641316423164331644316453164631647316483164931650316513165231653316543165531656316573165831659316603166131662316633166431665316663166731668316693167031671316723167331674316753167631677316783167931680316813168231683316843168531686316873168831689316903169131692316933169431695316963169731698316993170031701317023170331704317053170631707317083170931710317113171231713317143171531716317173171831719317203172131722317233172431725317263172731728317293173031731317323173331734317353173631737317383173931740317413174231743317443174531746317473174831749317503175131752317533175431755317563175731758317593176031761317623176331764317653176631767317683176931770317713177231773317743177531776317773177831779317803178131782317833178431785317863178731788317893179031791317923179331794317953179631797317983179931800318013180231803318043180531806318073180831809318103181131812318133181431815318163181731818318193182031821318223182331824318253182631827318283182931830318313183231833318343183531836318373183831839318403184131842318433184431845318463184731848318493185031851318523185331854318553185631857318583185931860318613186231863318643186531866318673186831869318703187131872318733187431875318763187731878318793188031881318823188331884318853188631887318883188931890318913189231893318943189531896318973189831899319003190131902319033190431905319063190731908319093191031911319123191331914319153191631917319183191931920319213192231923319243192531926319273192831929319303193131932319333193431935319363193731938319393194031941319423194331944319453194631947319483194931950319513195231953319543195531956319573195831959319603196131962319633196431965319663196731968319693197031971319723197331974319753197631977319783197931980319813198231983319843198531986319873198831989319903199131992319933199431995319963199731998319993200032001320023200332004320053200632007320083200932010320113201232013320143201532016320173201832019320203202132022320233202432025320263202732028320293203032031320323203332034320353203632037320383203932040320413204232043320443204532046320473204832049320503205132052320533205432055320563205732058320593206032061320623206332064320653206632067320683206932070320713207232073320743207532076320773207832079320803208132082320833208432085320863208732088320893209032091320923209332094320953209632097320983209932100321013210232103321043210532106321073210832109321103211132112321133211432115321163211732118321193212032121321223212332124321253212632127321283212932130321313213232133321343213532136321373213832139321403214132142321433214432145321463214732148321493215032151321523215332154321553215632157321583215932160321613216232163321643216532166321673216832169321703217132172321733217432175321763217732178321793218032181321823218332184321853218632187321883218932190321913219232193321943219532196321973219832199322003220132202322033220432205322063220732208322093221032211322123221332214322153221632217322183221932220322213222232223322243222532226322273222832229322303223132232322333223432235322363223732238322393224032241322423224332244322453224632247322483224932250322513225232253322543225532256322573225832259322603226132262322633226432265322663226732268322693227032271322723227332274322753227632277322783227932280322813228232283322843228532286322873228832289322903229132292322933229432295322963229732298322993230032301323023230332304323053230632307323083230932310323113231232313323143231532316323173231832319323203232132322323233232432325323263232732328323293233032331323323233332334323353233632337323383233932340323413234232343323443234532346323473234832349323503235132352323533235432355323563235732358323593236032361323623236332364323653236632367323683236932370323713237232373323743237532376323773237832379323803238132382323833238432385323863238732388323893239032391323923239332394323953239632397323983239932400324013240232403324043240532406324073240832409324103241132412324133241432415324163241732418324193242032421324223242332424324253242632427324283242932430324313243232433324343243532436324373243832439324403244132442324433244432445324463244732448324493245032451324523245332454324553245632457324583245932460324613246232463324643246532466324673246832469324703247132472324733247432475324763247732478324793248032481324823248332484324853248632487324883248932490324913249232493324943249532496324973249832499325003250132502325033250432505325063250732508325093251032511325123251332514325153251632517325183251932520325213252232523325243252532526325273252832529325303253132532325333253432535325363253732538325393254032541325423254332544325453254632547325483254932550325513255232553325543255532556325573255832559325603256132562325633256432565325663256732568325693257032571325723257332574325753257632577325783257932580325813258232583325843258532586325873258832589325903259132592325933259432595325963259732598325993260032601326023260332604326053260632607326083260932610326113261232613326143261532616326173261832619326203262132622326233262432625326263262732628326293263032631326323263332634326353263632637326383263932640326413264232643326443264532646326473264832649326503265132652326533265432655326563265732658326593266032661326623266332664326653266632667326683266932670326713267232673326743267532676326773267832679326803268132682326833268432685326863268732688326893269032691326923269332694326953269632697326983269932700327013270232703327043270532706327073270832709327103271132712327133271432715327163271732718327193272032721327223272332724327253272632727327283272932730327313273232733327343273532736327373273832739327403274132742327433274432745327463274732748327493275032751327523275332754327553275632757327583275932760327613276232763327643276532766327673276832769327703277132772327733277432775327763277732778327793278032781327823278332784327853278632787327883278932790327913279232793327943279532796327973279832799328003280132802328033280432805328063280732808328093281032811328123281332814328153281632817328183281932820328213282232823328243282532826328273282832829328303283132832328333283432835328363283732838328393284032841328423284332844328453284632847328483284932850328513285232853328543285532856328573285832859328603286132862328633286432865328663286732868328693287032871328723287332874328753287632877328783287932880328813288232883328843288532886328873288832889328903289132892328933289432895328963289732898328993290032901329023290332904329053290632907329083290932910329113291232913329143291532916329173291832919329203292132922329233292432925329263292732928329293293032931329323293332934329353293632937329383293932940329413294232943329443294532946329473294832949329503295132952329533295432955329563295732958329593296032961329623296332964329653296632967329683296932970329713297232973329743297532976329773297832979329803298132982329833298432985329863298732988329893299032991329923299332994329953299632997329983299933000330013300233003330043300533006330073300833009330103301133012330133301433015330163301733018330193302033021330223302333024330253302633027330283302933030330313303233033330343303533036330373303833039330403304133042330433304433045330463304733048330493305033051330523305333054330553305633057330583305933060330613306233063330643306533066330673306833069330703307133072330733307433075330763307733078330793308033081330823308333084330853308633087330883308933090330913309233093330943309533096330973309833099331003310133102331033310433105331063310733108331093311033111331123311333114331153311633117331183311933120331213312233123331243312533126331273312833129331303313133132331333313433135331363313733138331393314033141331423314333144331453314633147331483314933150331513315233153331543315533156331573315833159331603316133162331633316433165331663316733168331693317033171331723317333174331753317633177331783317933180331813318233183331843318533186331873318833189331903319133192331933319433195331963319733198331993320033201332023320333204332053320633207332083320933210332113321233213332143321533216332173321833219332203322133222332233322433225332263322733228332293323033231332323323333234332353323633237332383323933240332413324233243332443324533246332473324833249332503325133252332533325433255332563325733258332593326033261332623326333264332653326633267332683326933270332713327233273332743327533276332773327833279332803328133282332833328433285332863328733288332893329033291332923329333294332953329633297332983329933300333013330233303333043330533306333073330833309333103331133312333133331433315333163331733318333193332033321333223332333324333253332633327333283332933330333313333233333333343333533336333373333833339333403334133342333433334433345333463334733348333493335033351333523335333354333553335633357333583335933360333613336233363333643336533366333673336833369333703337133372333733337433375333763337733378333793338033381333823338333384333853338633387333883338933390333913339233393333943339533396333973339833399334003340133402334033340433405334063340733408334093341033411334123341333414334153341633417334183341933420334213342233423334243342533426334273342833429334303343133432334333343433435334363343733438334393344033441334423344333444334453344633447334483344933450334513345233453334543345533456334573345833459334603346133462334633346433465334663346733468334693347033471334723347333474334753347633477334783347933480334813348233483334843348533486334873348833489334903349133492334933349433495334963349733498334993350033501335023350333504335053350633507335083350933510335113351233513335143351533516335173351833519335203352133522335233352433525335263352733528335293353033531335323353333534335353353633537335383353933540335413354233543335443354533546335473354833549335503355133552335533355433555335563355733558335593356033561335623356333564335653356633567335683356933570335713357233573335743357533576335773357833579335803358133582335833358433585335863358733588335893359033591335923359333594335953359633597335983359933600336013360233603336043360533606336073360833609336103361133612336133361433615336163361733618336193362033621336223362333624336253362633627336283362933630336313363233633336343363533636336373363833639336403364133642336433364433645336463364733648336493365033651336523365333654336553365633657336583365933660336613366233663336643366533666336673366833669336703367133672336733367433675336763367733678336793368033681336823368333684336853368633687336883368933690336913369233693336943369533696336973369833699337003370133702337033370433705337063370733708337093371033711337123371333714337153371633717337183371933720337213372233723337243372533726337273372833729337303373133732337333373433735337363373733738337393374033741337423374333744337453374633747337483374933750337513375233753337543375533756337573375833759337603376133762337633376433765337663376733768337693377033771337723377333774337753377633777337783377933780337813378233783337843378533786337873378833789337903379133792337933379433795337963379733798337993380033801338023380333804338053380633807338083380933810338113381233813338143381533816338173381833819338203382133822338233382433825338263382733828338293383033831338323383333834338353383633837338383383933840338413384233843338443384533846338473384833849338503385133852338533385433855338563385733858338593386033861338623386333864338653386633867338683386933870338713387233873338743387533876338773387833879338803388133882338833388433885338863388733888338893389033891338923389333894338953389633897338983389933900339013390233903339043390533906339073390833909339103391133912339133391433915339163391733918339193392033921339223392333924339253392633927339283392933930339313393233933339343393533936339373393833939339403394133942339433394433945339463394733948339493395033951339523395333954339553395633957339583395933960339613396233963339643396533966339673396833969339703397133972339733397433975339763397733978339793398033981339823398333984339853398633987339883398933990339913399233993339943399533996339973399833999340003400134002340033400434005340063400734008340093401034011340123401334014340153401634017340183401934020340213402234023340243402534026340273402834029340303403134032340333403434035340363403734038340393404034041340423404334044340453404634047340483404934050340513405234053340543405534056340573405834059340603406134062340633406434065340663406734068340693407034071340723407334074340753407634077340783407934080340813408234083340843408534086340873408834089340903409134092340933409434095340963409734098340993410034101341023410334104341053410634107341083410934110341113411234113341143411534116341173411834119341203412134122341233412434125341263412734128341293413034131341323413334134341353413634137341383413934140341413414234143341443414534146341473414834149341503415134152341533415434155341563415734158341593416034161341623416334164341653416634167341683416934170341713417234173341743417534176341773417834179341803418134182341833418434185341863418734188341893419034191341923419334194341953419634197341983419934200342013420234203342043420534206342073420834209342103421134212342133421434215342163421734218342193422034221342223422334224342253422634227342283422934230342313423234233342343423534236342373423834239342403424134242342433424434245342463424734248342493425034251342523425334254342553425634257342583425934260342613426234263342643426534266342673426834269342703427134272342733427434275342763427734278342793428034281342823428334284342853428634287342883428934290342913429234293342943429534296342973429834299343003430134302343033430434305343063430734308343093431034311343123431334314343153431634317343183431934320343213432234323343243432534326343273432834329343303433134332343333433434335343363433734338343393434034341343423434334344343453434634347343483434934350343513435234353343543435534356343573435834359343603436134362343633436434365343663436734368343693437034371343723437334374343753437634377343783437934380343813438234383343843438534386343873438834389343903439134392343933439434395343963439734398343993440034401344023440334404344053440634407344083440934410344113441234413344143441534416344173441834419344203442134422344233442434425344263442734428344293443034431344323443334434344353443634437344383443934440344413444234443344443444534446344473444834449344503445134452344533445434455344563445734458344593446034461344623446334464344653446634467344683446934470344713447234473344743447534476344773447834479344803448134482344833448434485344863448734488344893449034491344923449334494344953449634497344983449934500345013450234503345043450534506345073450834509345103451134512345133451434515345163451734518345193452034521345223452334524345253452634527345283452934530345313453234533345343453534536345373453834539345403454134542345433454434545345463454734548345493455034551345523455334554345553455634557345583455934560345613456234563345643456534566345673456834569345703457134572345733457434575345763457734578345793458034581345823458334584345853458634587345883458934590345913459234593345943459534596345973459834599346003460134602346033460434605346063460734608346093461034611346123461334614346153461634617346183461934620346213462234623346243462534626346273462834629346303463134632346333463434635346363463734638346393464034641346423464334644346453464634647346483464934650346513465234653346543465534656346573465834659346603466134662346633466434665346663466734668346693467034671346723467334674346753467634677346783467934680346813468234683346843468534686346873468834689346903469134692346933469434695346963469734698346993470034701347023470334704347053470634707347083470934710347113471234713347143471534716347173471834719347203472134722347233472434725347263472734728347293473034731347323473334734347353473634737347383473934740347413474234743347443474534746347473474834749347503475134752347533475434755347563475734758347593476034761347623476334764347653476634767347683476934770347713477234773347743477534776347773477834779347803478134782347833478434785347863478734788347893479034791347923479334794347953479634797347983479934800348013480234803348043480534806348073480834809348103481134812348133481434815348163481734818348193482034821348223482334824348253482634827348283482934830348313483234833348343483534836348373483834839348403484134842348433484434845348463484734848348493485034851348523485334854348553485634857348583485934860348613486234863348643486534866348673486834869348703487134872348733487434875348763487734878348793488034881348823488334884348853488634887348883488934890348913489234893348943489534896348973489834899349003490134902349033490434905349063490734908349093491034911349123491334914349153491634917349183491934920349213492234923349243492534926349273492834929349303493134932349333493434935349363493734938349393494034941349423494334944349453494634947349483494934950349513495234953349543495534956349573495834959349603496134962349633496434965349663496734968349693497034971349723497334974349753497634977349783497934980349813498234983349843498534986349873498834989349903499134992349933499434995349963499734998349993500035001350023500335004350053500635007350083500935010350113501235013350143501535016350173501835019350203502135022350233502435025350263502735028350293503035031350323503335034350353503635037350383503935040350413504235043350443504535046350473504835049350503505135052350533505435055350563505735058350593506035061350623506335064350653506635067350683506935070350713507235073350743507535076350773507835079350803508135082350833508435085350863508735088350893509035091350923509335094350953509635097350983509935100351013510235103351043510535106351073510835109351103511135112351133511435115351163511735118351193512035121351223512335124351253512635127351283512935130351313513235133351343513535136351373513835139351403514135142351433514435145351463514735148351493515035151351523515335154351553515635157351583515935160351613516235163351643516535166351673516835169351703517135172351733517435175351763517735178351793518035181351823518335184351853518635187351883518935190351913519235193351943519535196351973519835199352003520135202352033520435205352063520735208352093521035211352123521335214352153521635217352183521935220352213522235223352243522535226352273522835229352303523135232352333523435235352363523735238352393524035241352423524335244352453524635247352483524935250352513525235253352543525535256352573525835259352603526135262352633526435265352663526735268352693527035271352723527335274352753527635277352783527935280352813528235283352843528535286352873528835289352903529135292352933529435295352963529735298352993530035301353023530335304353053530635307353083530935310353113531235313353143531535316353173531835319353203532135322353233532435325353263532735328353293533035331353323533335334353353533635337353383533935340353413534235343353443534535346353473534835349353503535135352353533535435355353563535735358353593536035361353623536335364353653536635367353683536935370353713537235373353743537535376353773537835379353803538135382353833538435385353863538735388353893539035391353923539335394353953539635397353983539935400354013540235403354043540535406354073540835409354103541135412354133541435415354163541735418354193542035421354223542335424354253542635427354283542935430354313543235433354343543535436354373543835439354403544135442354433544435445354463544735448354493545035451354523545335454354553545635457354583545935460354613546235463354643546535466354673546835469354703547135472354733547435475354763547735478354793548035481354823548335484354853548635487354883548935490354913549235493354943549535496354973549835499355003550135502355033550435505355063550735508355093551035511355123551335514355153551635517355183551935520355213552235523355243552535526355273552835529355303553135532355333553435535355363553735538355393554035541355423554335544355453554635547355483554935550355513555235553355543555535556355573555835559355603556135562355633556435565355663556735568355693557035571355723557335574355753557635577355783557935580355813558235583355843558535586355873558835589355903559135592355933559435595355963559735598355993560035601356023560335604356053560635607356083560935610356113561235613356143561535616356173561835619356203562135622356233562435625356263562735628356293563035631356323563335634356353563635637356383563935640356413564235643356443564535646356473564835649356503565135652356533565435655356563565735658356593566035661356623566335664356653566635667356683566935670356713567235673356743567535676356773567835679356803568135682356833568435685356863568735688356893569035691356923569335694356953569635697356983569935700357013570235703357043570535706357073570835709357103571135712357133571435715357163571735718357193572035721357223572335724357253572635727357283572935730357313573235733357343573535736357373573835739357403574135742357433574435745357463574735748357493575035751357523575335754357553575635757357583575935760357613576235763357643576535766357673576835769357703577135772357733577435775357763577735778357793578035781357823578335784357853578635787357883578935790357913579235793357943579535796357973579835799358003580135802358033580435805358063580735808358093581035811358123581335814358153581635817358183581935820358213582235823358243582535826358273582835829358303583135832358333583435835358363583735838358393584035841358423584335844358453584635847358483584935850358513585235853358543585535856358573585835859358603586135862358633586435865358663586735868358693587035871358723587335874358753587635877358783587935880358813588235883358843588535886358873588835889358903589135892358933589435895358963589735898358993590035901359023590335904359053590635907359083590935910359113591235913359143591535916359173591835919359203592135922359233592435925359263592735928359293593035931359323593335934359353593635937359383593935940359413594235943359443594535946359473594835949359503595135952359533595435955359563595735958359593596035961359623596335964359653596635967359683596935970359713597235973359743597535976359773597835979359803598135982359833598435985359863598735988359893599035991359923599335994359953599635997359983599936000360013600236003360043600536006360073600836009360103601136012360133601436015360163601736018360193602036021360223602336024360253602636027360283602936030360313603236033360343603536036360373603836039360403604136042360433604436045360463604736048360493605036051360523605336054360553605636057360583605936060360613606236063360643606536066360673606836069360703607136072360733607436075360763607736078360793608036081360823608336084360853608636087360883608936090360913609236093360943609536096360973609836099361003610136102361033610436105361063610736108361093611036111361123611336114361153611636117361183611936120361213612236123361243612536126361273612836129361303613136132361333613436135361363613736138361393614036141361423614336144361453614636147361483614936150361513615236153361543615536156361573615836159361603616136162361633616436165361663616736168361693617036171361723617336174361753617636177361783617936180361813618236183361843618536186361873618836189361903619136192361933619436195361963619736198361993620036201362023620336204362053620636207362083620936210362113621236213362143621536216362173621836219362203622136222362233622436225362263622736228362293623036231362323623336234362353623636237362383623936240362413624236243362443624536246362473624836249362503625136252362533625436255362563625736258362593626036261362623626336264362653626636267362683626936270362713627236273362743627536276362773627836279362803628136282362833628436285362863628736288362893629036291362923629336294362953629636297362983629936300363013630236303363043630536306363073630836309363103631136312363133631436315363163631736318363193632036321363223632336324363253632636327363283632936330363313633236333363343633536336363373633836339363403634136342363433634436345363463634736348363493635036351363523635336354363553635636357363583635936360363613636236363363643636536366363673636836369363703637136372363733637436375363763637736378363793638036381363823638336384363853638636387363883638936390363913639236393363943639536396363973639836399364003640136402364033640436405364063640736408364093641036411364123641336414364153641636417364183641936420364213642236423364243642536426364273642836429364303643136432364333643436435364363643736438364393644036441364423644336444364453644636447364483644936450364513645236453364543645536456364573645836459364603646136462364633646436465364663646736468364693647036471364723647336474364753647636477364783647936480364813648236483364843648536486364873648836489364903649136492364933649436495364963649736498364993650036501365023650336504365053650636507365083650936510365113651236513365143651536516365173651836519365203652136522365233652436525365263652736528365293653036531365323653336534365353653636537365383653936540365413654236543365443654536546365473654836549365503655136552365533655436555365563655736558365593656036561365623656336564365653656636567365683656936570365713657236573365743657536576365773657836579365803658136582365833658436585365863658736588365893659036591365923659336594365953659636597365983659936600366013660236603366043660536606366073660836609366103661136612366133661436615366163661736618366193662036621366223662336624366253662636627366283662936630366313663236633366343663536636366373663836639366403664136642366433664436645366463664736648366493665036651366523665336654366553665636657366583665936660366613666236663366643666536666366673666836669366703667136672366733667436675366763667736678366793668036681366823668336684366853668636687366883668936690366913669236693366943669536696366973669836699367003670136702367033670436705367063670736708367093671036711367123671336714367153671636717367183671936720367213672236723367243672536726367273672836729367303673136732367333673436735367363673736738367393674036741367423674336744367453674636747367483674936750367513675236753367543675536756367573675836759367603676136762367633676436765367663676736768367693677036771367723677336774367753677636777367783677936780367813678236783367843678536786367873678836789367903679136792367933679436795367963679736798367993680036801368023680336804368053680636807368083680936810368113681236813368143681536816368173681836819368203682136822368233682436825368263682736828368293683036831368323683336834368353683636837368383683936840368413684236843368443684536846368473684836849368503685136852368533685436855368563685736858368593686036861368623686336864368653686636867368683686936870368713687236873368743687536876368773687836879368803688136882368833688436885368863688736888368893689036891368923689336894368953689636897368983689936900369013690236903369043690536906369073690836909369103691136912369133691436915369163691736918369193692036921369223692336924369253692636927369283692936930369313693236933369343693536936369373693836939369403694136942369433694436945369463694736948369493695036951369523695336954369553695636957369583695936960369613696236963369643696536966369673696836969369703697136972369733697436975369763697736978369793698036981369823698336984369853698636987369883698936990369913699236993369943699536996369973699836999370003700137002370033700437005370063700737008370093701037011370123701337014370153701637017370183701937020370213702237023370243702537026370273702837029370303703137032370333703437035370363703737038370393704037041370423704337044370453704637047370483704937050370513705237053370543705537056370573705837059370603706137062370633706437065370663706737068370693707037071370723707337074370753707637077370783707937080370813708237083370843708537086370873708837089370903709137092370933709437095370963709737098370993710037101371023710337104371053710637107371083710937110371113711237113371143711537116371173711837119371203712137122371233712437125371263712737128371293713037131371323713337134371353713637137371383713937140371413714237143371443714537146371473714837149371503715137152371533715437155371563715737158371593716037161371623716337164371653716637167371683716937170371713717237173371743717537176371773717837179371803718137182371833718437185371863718737188371893719037191371923719337194371953719637197371983719937200372013720237203372043720537206372073720837209372103721137212372133721437215372163721737218372193722037221372223722337224372253722637227372283722937230372313723237233372343723537236372373723837239372403724137242372433724437245372463724737248372493725037251372523725337254372553725637257372583725937260372613726237263372643726537266372673726837269372703727137272372733727437275372763727737278372793728037281372823728337284372853728637287372883728937290372913729237293372943729537296372973729837299373003730137302373033730437305373063730737308373093731037311373123731337314373153731637317373183731937320373213732237323373243732537326373273732837329373303733137332373333733437335373363733737338373393734037341373423734337344373453734637347373483734937350373513735237353373543735537356373573735837359373603736137362373633736437365373663736737368373693737037371373723737337374373753737637377373783737937380373813738237383373843738537386373873738837389373903739137392373933739437395373963739737398373993740037401374023740337404374053740637407374083740937410374113741237413374143741537416374173741837419374203742137422374233742437425374263742737428374293743037431374323743337434374353743637437374383743937440374413744237443374443744537446374473744837449374503745137452374533745437455374563745737458374593746037461374623746337464374653746637467374683746937470374713747237473374743747537476374773747837479374803748137482374833748437485374863748737488374893749037491374923749337494374953749637497374983749937500375013750237503375043750537506375073750837509375103751137512375133751437515375163751737518375193752037521375223752337524375253752637527375283752937530375313753237533375343753537536375373753837539375403754137542375433754437545375463754737548375493755037551375523755337554375553755637557375583755937560375613756237563375643756537566375673756837569375703757137572375733757437575375763757737578375793758037581375823758337584375853758637587375883758937590375913759237593375943759537596375973759837599376003760137602376033760437605376063760737608376093761037611376123761337614376153761637617376183761937620376213762237623376243762537626376273762837629376303763137632376333763437635376363763737638376393764037641376423764337644376453764637647376483764937650376513765237653376543765537656376573765837659376603766137662376633766437665376663766737668376693767037671376723767337674376753767637677376783767937680376813768237683376843768537686376873768837689376903769137692376933769437695376963769737698376993770037701377023770337704377053770637707377083770937710377113771237713377143771537716377173771837719377203772137722377233772437725377263772737728377293773037731377323773337734377353773637737377383773937740377413774237743377443774537746377473774837749377503775137752377533775437755377563775737758377593776037761377623776337764377653776637767377683776937770377713777237773377743777537776377773777837779377803778137782377833778437785377863778737788377893779037791377923779337794377953779637797377983779937800378013780237803378043780537806378073780837809378103781137812378133781437815378163781737818378193782037821378223782337824378253782637827378283782937830378313783237833378343783537836378373783837839378403784137842378433784437845378463784737848378493785037851378523785337854378553785637857378583785937860378613786237863378643786537866378673786837869378703787137872378733787437875378763787737878378793788037881378823788337884378853788637887378883788937890378913789237893378943789537896378973789837899379003790137902379033790437905379063790737908379093791037911379123791337914379153791637917379183791937920379213792237923379243792537926379273792837929379303793137932379333793437935379363793737938379393794037941379423794337944379453794637947379483794937950379513795237953379543795537956379573795837959379603796137962379633796437965379663796737968379693797037971379723797337974379753797637977379783797937980379813798237983379843798537986379873798837989379903799137992379933799437995379963799737998379993800038001380023800338004380053800638007380083800938010380113801238013380143801538016380173801838019380203802138022380233802438025380263802738028380293803038031380323803338034380353803638037380383803938040380413804238043380443804538046380473804838049380503805138052380533805438055380563805738058380593806038061380623806338064380653806638067380683806938070380713807238073380743807538076380773807838079380803808138082380833808438085380863808738088380893809038091380923809338094380953809638097380983809938100381013810238103381043810538106381073810838109381103811138112381133811438115381163811738118381193812038121381223812338124381253812638127381283812938130381313813238133381343813538136381373813838139381403814138142381433814438145381463814738148381493815038151381523815338154381553815638157381583815938160381613816238163381643816538166381673816838169381703817138172381733817438175381763817738178381793818038181381823818338184381853818638187381883818938190381913819238193381943819538196381973819838199382003820138202382033820438205382063820738208382093821038211382123821338214382153821638217382183821938220382213822238223382243822538226382273822838229382303823138232382333823438235382363823738238382393824038241382423824338244382453824638247382483824938250382513825238253382543825538256382573825838259382603826138262382633826438265382663826738268382693827038271382723827338274382753827638277382783827938280382813828238283382843828538286382873828838289382903829138292382933829438295382963829738298382993830038301383023830338304383053830638307383083830938310383113831238313383143831538316383173831838319383203832138322383233832438325383263832738328383293833038331383323833338334383353833638337383383833938340383413834238343383443834538346383473834838349383503835138352383533835438355383563835738358383593836038361383623836338364383653836638367383683836938370383713837238373383743837538376383773837838379383803838138382383833838438385383863838738388383893839038391383923839338394383953839638397383983839938400384013840238403384043840538406384073840838409384103841138412384133841438415384163841738418384193842038421384223842338424384253842638427384283842938430384313843238433384343843538436384373843838439384403844138442384433844438445384463844738448384493845038451384523845338454384553845638457384583845938460384613846238463384643846538466384673846838469384703847138472384733847438475384763847738478384793848038481384823848338484384853848638487384883848938490384913849238493384943849538496384973849838499385003850138502385033850438505385063850738508385093851038511385123851338514385153851638517385183851938520385213852238523385243852538526385273852838529385303853138532385333853438535385363853738538385393854038541385423854338544385453854638547385483854938550385513855238553385543855538556385573855838559385603856138562385633856438565385663856738568385693857038571385723857338574385753857638577385783857938580385813858238583385843858538586385873858838589385903859138592385933859438595385963859738598385993860038601386023860338604386053860638607386083860938610386113861238613386143861538616386173861838619386203862138622386233862438625386263862738628386293863038631386323863338634386353863638637386383863938640386413864238643386443864538646386473864838649386503865138652386533865438655386563865738658386593866038661386623866338664386653866638667386683866938670386713867238673386743867538676386773867838679386803868138682386833868438685386863868738688386893869038691386923869338694386953869638697386983869938700387013870238703387043870538706387073870838709387103871138712387133871438715387163871738718387193872038721387223872338724387253872638727387283872938730387313873238733387343873538736387373873838739387403874138742387433874438745387463874738748387493875038751387523875338754387553875638757387583875938760387613876238763387643876538766387673876838769387703877138772387733877438775387763877738778387793878038781387823878338784387853878638787387883878938790387913879238793387943879538796387973879838799388003880138802388033880438805388063880738808388093881038811388123881338814388153881638817388183881938820388213882238823388243882538826388273882838829388303883138832388333883438835388363883738838388393884038841388423884338844388453884638847388483884938850388513885238853388543885538856388573885838859388603886138862388633886438865388663886738868388693887038871388723887338874388753887638877388783887938880388813888238883388843888538886388873888838889388903889138892388933889438895388963889738898388993890038901389023890338904389053890638907389083890938910389113891238913389143891538916389173891838919389203892138922389233892438925389263892738928389293893038931389323893338934389353893638937389383893938940389413894238943389443894538946389473894838949389503895138952389533895438955389563895738958389593896038961389623896338964389653896638967389683896938970389713897238973389743897538976389773897838979389803898138982389833898438985389863898738988389893899038991389923899338994389953899638997389983899939000390013900239003390043900539006390073900839009390103901139012390133901439015390163901739018390193902039021390223902339024390253902639027390283902939030390313903239033390343903539036390373903839039390403904139042390433904439045390463904739048390493905039051390523905339054390553905639057390583905939060390613906239063390643906539066390673906839069390703907139072390733907439075390763907739078390793908039081390823908339084390853908639087390883908939090390913909239093390943909539096390973909839099391003910139102391033910439105391063910739108391093911039111391123911339114391153911639117391183911939120391213912239123391243912539126391273912839129391303913139132391333913439135391363913739138391393914039141391423914339144391453914639147391483914939150391513915239153391543915539156391573915839159391603916139162391633916439165391663916739168391693917039171391723917339174391753917639177391783917939180391813918239183391843918539186391873918839189391903919139192391933919439195391963919739198391993920039201392023920339204392053920639207392083920939210392113921239213392143921539216392173921839219392203922139222392233922439225392263922739228392293923039231392323923339234392353923639237392383923939240392413924239243392443924539246392473924839249392503925139252392533925439255392563925739258392593926039261392623926339264392653926639267392683926939270392713927239273392743927539276392773927839279392803928139282392833928439285392863928739288392893929039291392923929339294392953929639297392983929939300393013930239303393043930539306393073930839309393103931139312393133931439315393163931739318393193932039321393223932339324393253932639327393283932939330393313933239333393343933539336393373933839339393403934139342393433934439345393463934739348393493935039351393523935339354393553935639357393583935939360393613936239363393643936539366393673936839369393703937139372393733937439375393763937739378393793938039381393823938339384393853938639387393883938939390393913939239393393943939539396393973939839399394003940139402394033940439405394063940739408394093941039411394123941339414394153941639417394183941939420394213942239423394243942539426394273942839429394303943139432394333943439435394363943739438394393944039441394423944339444394453944639447394483944939450394513945239453394543945539456394573945839459394603946139462394633946439465394663946739468394693947039471394723947339474394753947639477394783947939480394813948239483394843948539486394873948839489394903949139492394933949439495394963949739498394993950039501395023950339504395053950639507395083950939510395113951239513395143951539516395173951839519395203952139522395233952439525395263952739528395293953039531395323953339534395353953639537395383953939540395413954239543395443954539546395473954839549395503955139552395533955439555395563955739558395593956039561395623956339564395653956639567395683956939570395713957239573395743957539576395773957839579395803958139582395833958439585395863958739588395893959039591395923959339594395953959639597395983959939600396013960239603396043960539606396073960839609396103961139612396133961439615396163961739618396193962039621396223962339624396253962639627396283962939630396313963239633396343963539636396373963839639396403964139642396433964439645396463964739648396493965039651396523965339654396553965639657396583965939660396613966239663396643966539666396673966839669396703967139672396733967439675396763967739678396793968039681396823968339684396853968639687396883968939690396913969239693396943969539696396973969839699397003970139702397033970439705397063970739708397093971039711397123971339714397153971639717397183971939720397213972239723397243972539726397273972839729397303973139732397333973439735397363973739738397393974039741397423974339744397453974639747397483974939750397513975239753397543975539756397573975839759397603976139762397633976439765397663976739768397693977039771397723977339774397753977639777397783977939780397813978239783397843978539786397873978839789397903979139792397933979439795397963979739798397993980039801398023980339804398053980639807398083980939810398113981239813398143981539816398173981839819398203982139822398233982439825398263982739828398293983039831398323983339834398353983639837398383983939840398413984239843398443984539846398473984839849398503985139852398533985439855398563985739858398593986039861398623986339864398653986639867398683986939870398713987239873398743987539876398773987839879398803988139882398833988439885398863988739888398893989039891398923989339894398953989639897398983989939900399013990239903399043990539906399073990839909399103991139912399133991439915399163991739918399193992039921399223992339924399253992639927399283992939930399313993239933399343993539936399373993839939399403994139942399433994439945399463994739948399493995039951399523995339954399553995639957399583995939960399613996239963399643996539966399673996839969399703997139972399733997439975399763997739978399793998039981399823998339984399853998639987399883998939990399913999239993399943999539996399973999839999400004000140002400034000440005400064000740008400094001040011400124001340014400154001640017400184001940020400214002240023400244002540026400274002840029400304003140032400334003440035400364003740038400394004040041400424004340044400454004640047400484004940050400514005240053400544005540056400574005840059400604006140062400634006440065400664006740068400694007040071400724007340074400754007640077400784007940080400814008240083400844008540086400874008840089400904009140092400934009440095400964009740098400994010040101401024010340104401054010640107401084010940110401114011240113401144011540116401174011840119401204012140122401234012440125401264012740128401294013040131401324013340134401354013640137401384013940140401414014240143401444014540146401474014840149401504015140152401534015440155401564015740158401594016040161401624016340164401654016640167401684016940170401714017240173401744017540176401774017840179401804018140182401834018440185401864018740188401894019040191401924019340194401954019640197401984019940200402014020240203402044020540206402074020840209402104021140212402134021440215402164021740218402194022040221402224022340224402254022640227402284022940230402314023240233402344023540236402374023840239402404024140242402434024440245402464024740248402494025040251402524025340254402554025640257402584025940260402614026240263402644026540266402674026840269402704027140272402734027440275402764027740278402794028040281402824028340284402854028640287402884028940290402914029240293402944029540296402974029840299403004030140302403034030440305403064030740308403094031040311403124031340314403154031640317403184031940320403214032240323403244032540326403274032840329403304033140332403334033440335403364033740338403394034040341403424034340344403454034640347403484034940350403514035240353403544035540356403574035840359403604036140362403634036440365403664036740368403694037040371403724037340374403754037640377403784037940380403814038240383403844038540386403874038840389403904039140392403934039440395403964039740398403994040040401404024040340404404054040640407404084040940410404114041240413404144041540416404174041840419404204042140422404234042440425404264042740428404294043040431404324043340434404354043640437404384043940440404414044240443404444044540446404474044840449404504045140452404534045440455404564045740458404594046040461404624046340464404654046640467404684046940470404714047240473404744047540476404774047840479404804048140482404834048440485404864048740488404894049040491404924049340494404954049640497404984049940500405014050240503405044050540506405074050840509405104051140512405134051440515405164051740518405194052040521405224052340524405254052640527405284052940530405314053240533405344053540536405374053840539405404054140542405434054440545405464054740548405494055040551405524055340554405554055640557405584055940560405614056240563405644056540566405674056840569405704057140572405734057440575405764057740578405794058040581405824058340584405854058640587405884058940590405914059240593405944059540596405974059840599406004060140602406034060440605406064060740608406094061040611406124061340614406154061640617406184061940620406214062240623406244062540626406274062840629406304063140632406334063440635406364063740638406394064040641406424064340644406454064640647406484064940650406514065240653406544065540656406574065840659406604066140662406634066440665406664066740668406694067040671406724067340674406754067640677406784067940680406814068240683406844068540686406874068840689406904069140692406934069440695406964069740698406994070040701407024070340704407054070640707407084070940710407114071240713407144071540716407174071840719407204072140722407234072440725407264072740728407294073040731407324073340734407354073640737407384073940740407414074240743407444074540746407474074840749407504075140752407534075440755407564075740758407594076040761407624076340764407654076640767407684076940770407714077240773407744077540776407774077840779407804078140782407834078440785407864078740788407894079040791407924079340794407954079640797407984079940800408014080240803408044080540806408074080840809408104081140812408134081440815408164081740818408194082040821408224082340824408254082640827408284082940830408314083240833408344083540836408374083840839408404084140842408434084440845408464084740848408494085040851408524085340854408554085640857408584085940860408614086240863408644086540866408674086840869408704087140872408734087440875408764087740878408794088040881408824088340884408854088640887408884088940890408914089240893408944089540896408974089840899409004090140902409034090440905409064090740908409094091040911409124091340914409154091640917409184091940920409214092240923409244092540926409274092840929409304093140932409334093440935409364093740938409394094040941409424094340944409454094640947409484094940950409514095240953409544095540956409574095840959409604096140962409634096440965409664096740968409694097040971409724097340974409754097640977409784097940980409814098240983409844098540986409874098840989409904099140992409934099440995409964099740998409994100041001410024100341004410054100641007410084100941010410114101241013410144101541016410174101841019410204102141022410234102441025410264102741028410294103041031410324103341034410354103641037410384103941040410414104241043410444104541046410474104841049410504105141052410534105441055410564105741058410594106041061410624106341064410654106641067410684106941070410714107241073410744107541076410774107841079410804108141082410834108441085410864108741088410894109041091410924109341094410954109641097410984109941100411014110241103411044110541106411074110841109411104111141112411134111441115411164111741118411194112041121411224112341124411254112641127411284112941130411314113241133411344113541136411374113841139411404114141142411434114441145411464114741148411494115041151411524115341154411554115641157411584115941160411614116241163411644116541166411674116841169411704117141172411734117441175411764117741178411794118041181411824118341184411854118641187411884118941190411914119241193411944119541196411974119841199412004120141202412034120441205412064120741208412094121041211412124121341214412154121641217412184121941220412214122241223412244122541226412274122841229412304123141232412334123441235412364123741238412394124041241412424124341244412454124641247412484124941250412514125241253412544125541256412574125841259412604126141262412634126441265412664126741268412694127041271412724127341274412754127641277412784127941280412814128241283412844128541286412874128841289412904129141292412934129441295412964129741298412994130041301413024130341304413054130641307413084130941310413114131241313413144131541316413174131841319413204132141322413234132441325413264132741328413294133041331413324133341334413354133641337413384133941340413414134241343413444134541346413474134841349413504135141352413534135441355413564135741358413594136041361413624136341364413654136641367413684136941370413714137241373413744137541376413774137841379413804138141382413834138441385413864138741388413894139041391413924139341394413954139641397413984139941400414014140241403414044140541406414074140841409414104141141412414134141441415414164141741418414194142041421414224142341424414254142641427414284142941430414314143241433414344143541436414374143841439414404144141442414434144441445414464144741448414494145041451414524145341454414554145641457414584145941460414614146241463414644146541466414674146841469414704147141472414734147441475414764147741478414794148041481414824148341484414854148641487414884148941490414914149241493414944149541496414974149841499415004150141502415034150441505415064150741508415094151041511415124151341514415154151641517415184151941520415214152241523415244152541526415274152841529415304153141532415334153441535415364153741538415394154041541415424154341544415454154641547415484154941550415514155241553415544155541556415574155841559415604156141562415634156441565415664156741568415694157041571415724157341574415754157641577415784157941580415814158241583415844158541586415874158841589415904159141592415934159441595415964159741598415994160041601416024160341604416054160641607416084160941610416114161241613416144161541616416174161841619416204162141622416234162441625416264162741628416294163041631416324163341634416354163641637416384163941640416414164241643416444164541646416474164841649416504165141652416534165441655416564165741658416594166041661416624166341664416654166641667416684166941670416714167241673416744167541676416774167841679416804168141682416834168441685416864168741688416894169041691416924169341694416954169641697416984169941700417014170241703417044170541706417074170841709417104171141712417134171441715417164171741718417194172041721417224172341724417254172641727417284172941730417314173241733417344173541736417374173841739417404174141742417434174441745417464174741748417494175041751417524175341754417554175641757417584175941760417614176241763417644176541766417674176841769417704177141772417734177441775417764177741778417794178041781417824178341784417854178641787417884178941790417914179241793417944179541796417974179841799418004180141802418034180441805418064180741808418094181041811418124181341814418154181641817418184181941820418214182241823418244182541826418274182841829418304183141832418334183441835418364183741838418394184041841418424184341844418454184641847418484184941850418514185241853418544185541856418574185841859418604186141862418634186441865418664186741868418694187041871418724187341874418754187641877418784187941880418814188241883418844188541886418874188841889418904189141892418934189441895418964189741898418994190041901419024190341904419054190641907419084190941910419114191241913419144191541916419174191841919419204192141922419234192441925419264192741928419294193041931419324193341934419354193641937419384193941940419414194241943419444194541946419474194841949419504195141952419534195441955419564195741958419594196041961419624196341964419654196641967419684196941970419714197241973419744197541976419774197841979419804198141982419834198441985419864198741988419894199041991419924199341994419954199641997419984199942000420014200242003420044200542006420074200842009420104201142012420134201442015420164201742018420194202042021420224202342024420254202642027420284202942030420314203242033420344203542036420374203842039420404204142042420434204442045420464204742048420494205042051420524205342054420554205642057420584205942060420614206242063420644206542066420674206842069420704207142072420734207442075420764207742078420794208042081420824208342084420854208642087420884208942090420914209242093420944209542096420974209842099421004210142102421034210442105421064210742108421094211042111421124211342114421154211642117421184211942120421214212242123421244212542126421274212842129421304213142132421334213442135421364213742138421394214042141421424214342144421454214642147421484214942150421514215242153421544215542156421574215842159421604216142162421634216442165421664216742168421694217042171421724217342174421754217642177421784217942180421814218242183421844218542186421874218842189421904219142192421934219442195421964219742198421994220042201422024220342204422054220642207422084220942210422114221242213422144221542216422174221842219422204222142222422234222442225422264222742228422294223042231422324223342234422354223642237422384223942240422414224242243422444224542246422474224842249422504225142252422534225442255422564225742258422594226042261422624226342264422654226642267422684226942270422714227242273422744227542276422774227842279422804228142282422834228442285422864228742288422894229042291422924229342294422954229642297422984229942300423014230242303423044230542306423074230842309423104231142312423134231442315423164231742318423194232042321423224232342324423254232642327423284232942330423314233242333423344233542336423374233842339423404234142342423434234442345423464234742348423494235042351423524235342354423554235642357423584235942360423614236242363423644236542366423674236842369423704237142372423734237442375423764237742378423794238042381423824238342384423854238642387423884238942390423914239242393423944239542396423974239842399424004240142402424034240442405424064240742408424094241042411424124241342414424154241642417424184241942420424214242242423424244242542426424274242842429424304243142432424334243442435424364243742438424394244042441424424244342444424454244642447424484244942450424514245242453424544245542456424574245842459424604246142462424634246442465424664246742468424694247042471424724247342474424754247642477424784247942480424814248242483424844248542486424874248842489424904249142492424934249442495424964249742498424994250042501425024250342504425054250642507425084250942510425114251242513425144251542516425174251842519425204252142522425234252442525425264252742528425294253042531425324253342534425354253642537425384253942540425414254242543425444254542546425474254842549425504255142552425534255442555425564255742558425594256042561425624256342564425654256642567425684256942570425714257242573425744257542576425774257842579425804258142582425834258442585425864258742588425894259042591425924259342594425954259642597425984259942600426014260242603426044260542606426074260842609426104261142612426134261442615426164261742618426194262042621426224262342624426254262642627426284262942630426314263242633426344263542636426374263842639426404264142642426434264442645426464264742648426494265042651426524265342654426554265642657426584265942660426614266242663426644266542666426674266842669426704267142672426734267442675426764267742678426794268042681426824268342684426854268642687426884268942690426914269242693426944269542696426974269842699427004270142702427034270442705427064270742708427094271042711427124271342714427154271642717427184271942720427214272242723427244272542726427274272842729427304273142732427334273442735427364273742738427394274042741427424274342744427454274642747427484274942750427514275242753427544275542756427574275842759427604276142762427634276442765427664276742768427694277042771427724277342774427754277642777427784277942780427814278242783427844278542786427874278842789427904279142792427934279442795427964279742798427994280042801428024280342804428054280642807428084280942810428114281242813428144281542816428174281842819428204282142822428234282442825428264282742828428294283042831428324283342834428354283642837428384283942840428414284242843428444284542846428474284842849428504285142852428534285442855428564285742858428594286042861428624286342864428654286642867428684286942870428714287242873428744287542876428774287842879428804288142882428834288442885428864288742888428894289042891428924289342894428954289642897428984289942900429014290242903429044290542906429074290842909429104291142912429134291442915429164291742918429194292042921429224292342924429254292642927429284292942930429314293242933429344293542936429374293842939429404294142942429434294442945429464294742948429494295042951429524295342954429554295642957429584295942960429614296242963429644296542966429674296842969429704297142972429734297442975429764297742978429794298042981429824298342984429854298642987429884298942990429914299242993429944299542996429974299842999430004300143002430034300443005430064300743008430094301043011430124301343014430154301643017430184301943020430214302243023430244302543026430274302843029430304303143032430334303443035430364303743038430394304043041430424304343044430454304643047430484304943050430514305243053430544305543056430574305843059430604306143062430634306443065430664306743068430694307043071430724307343074430754307643077430784307943080430814308243083430844308543086430874308843089430904309143092430934309443095430964309743098430994310043101431024310343104431054310643107431084310943110431114311243113431144311543116431174311843119431204312143122431234312443125431264312743128431294313043131431324313343134431354313643137431384313943140431414314243143431444314543146431474314843149431504315143152431534315443155431564315743158431594316043161431624316343164431654316643167431684316943170431714317243173431744317543176431774317843179431804318143182431834318443185431864318743188431894319043191431924319343194431954319643197431984319943200432014320243203432044320543206432074320843209432104321143212432134321443215432164321743218432194322043221432224322343224432254322643227432284322943230432314323243233432344323543236432374323843239432404324143242432434324443245432464324743248432494325043251432524325343254432554325643257432584325943260432614326243263432644326543266432674326843269432704327143272432734327443275432764327743278432794328043281432824328343284432854328643287432884328943290432914329243293432944329543296432974329843299433004330143302433034330443305433064330743308433094331043311433124331343314433154331643317433184331943320433214332243323433244332543326433274332843329433304333143332433334333443335433364333743338433394334043341433424334343344433454334643347433484334943350433514335243353433544335543356433574335843359433604336143362433634336443365433664336743368433694337043371433724337343374433754337643377433784337943380433814338243383433844338543386433874338843389433904339143392433934339443395433964339743398433994340043401434024340343404434054340643407434084340943410434114341243413434144341543416434174341843419434204342143422434234342443425434264342743428434294343043431434324343343434434354343643437434384343943440434414344243443434444344543446434474344843449434504345143452434534345443455434564345743458434594346043461434624346343464434654346643467434684346943470434714347243473434744347543476434774347843479434804348143482434834348443485434864348743488434894349043491434924349343494434954349643497434984349943500435014350243503435044350543506435074350843509435104351143512435134351443515435164351743518435194352043521435224352343524435254352643527435284352943530435314353243533435344353543536435374353843539435404354143542435434354443545435464354743548435494355043551435524355343554435554355643557435584355943560435614356243563435644356543566435674356843569435704357143572435734357443575435764357743578435794358043581435824358343584435854358643587435884358943590435914359243593435944359543596435974359843599436004360143602436034360443605436064360743608436094361043611436124361343614436154361643617436184361943620436214362243623436244362543626436274362843629436304363143632436334363443635436364363743638436394364043641436424364343644436454364643647436484364943650436514365243653436544365543656436574365843659436604366143662436634366443665436664366743668436694367043671436724367343674436754367643677436784367943680436814368243683436844368543686436874368843689436904369143692436934369443695436964369743698436994370043701437024370343704437054370643707437084370943710437114371243713437144371543716437174371843719437204372143722437234372443725437264372743728437294373043731437324373343734437354373643737437384373943740437414374243743437444374543746437474374843749437504375143752437534375443755437564375743758437594376043761437624376343764437654376643767437684376943770437714377243773437744377543776437774377843779437804378143782437834378443785437864378743788437894379043791437924379343794437954379643797437984379943800438014380243803438044380543806438074380843809438104381143812438134381443815438164381743818438194382043821438224382343824438254382643827438284382943830438314383243833438344383543836438374383843839438404384143842438434384443845438464384743848438494385043851438524385343854438554385643857438584385943860438614386243863438644386543866438674386843869438704387143872438734387443875438764387743878438794388043881438824388343884438854388643887438884388943890438914389243893438944389543896438974389843899439004390143902439034390443905439064390743908439094391043911439124391343914439154391643917439184391943920439214392243923439244392543926439274392843929439304393143932439334393443935439364393743938439394394043941439424394343944439454394643947439484394943950439514395243953439544395543956439574395843959439604396143962439634396443965439664396743968439694397043971439724397343974439754397643977439784397943980439814398243983439844398543986439874398843989439904399143992439934399443995439964399743998439994400044001440024400344004440054400644007440084400944010440114401244013440144401544016440174401844019440204402144022440234402444025440264402744028440294403044031440324403344034440354403644037440384403944040440414404244043440444404544046440474404844049440504405144052440534405444055440564405744058440594406044061440624406344064440654406644067440684406944070440714407244073440744407544076440774407844079440804408144082440834408444085440864408744088440894409044091440924409344094440954409644097440984409944100441014410244103441044410544106441074410844109441104411144112441134411444115441164411744118441194412044121441224412344124441254412644127441284412944130441314413244133441344413544136441374413844139441404414144142441434414444145441464414744148441494415044151441524415344154441554415644157441584415944160441614416244163441644416544166441674416844169441704417144172441734417444175441764417744178441794418044181441824418344184441854418644187441884418944190441914419244193441944419544196441974419844199442004420144202442034420444205442064420744208442094421044211442124421344214442154421644217442184421944220442214422244223442244422544226442274422844229442304423144232442334423444235442364423744238442394424044241442424424344244442454424644247442484424944250442514425244253442544425544256442574425844259442604426144262442634426444265442664426744268442694427044271442724427344274442754427644277442784427944280442814428244283442844428544286442874428844289442904429144292442934429444295442964429744298442994430044301443024430344304443054430644307443084430944310443114431244313443144431544316443174431844319443204432144322443234432444325443264432744328443294433044331443324433344334443354433644337443384433944340443414434244343443444434544346443474434844349443504435144352443534435444355443564435744358443594436044361443624436344364443654436644367443684436944370443714437244373443744437544376443774437844379443804438144382443834438444385443864438744388443894439044391443924439344394443954439644397443984439944400444014440244403444044440544406444074440844409444104441144412444134441444415444164441744418444194442044421444224442344424444254442644427444284442944430444314443244433444344443544436444374443844439444404444144442444434444444445444464444744448444494445044451444524445344454444554445644457444584445944460444614446244463444644446544466444674446844469444704447144472444734447444475444764447744478444794448044481444824448344484444854448644487444884448944490444914449244493444944449544496444974449844499445004450144502445034450444505445064450744508445094451044511445124451344514445154451644517445184451944520445214452244523445244452544526445274452844529445304453144532445334453444535445364453744538445394454044541445424454344544445454454644547445484454944550445514455244553445544455544556445574455844559445604456144562445634456444565445664456744568445694457044571445724457344574445754457644577445784457944580445814458244583445844458544586445874458844589445904459144592445934459444595445964459744598445994460044601446024460344604446054460644607446084460944610446114461244613446144461544616446174461844619446204462144622446234462444625446264462744628446294463044631446324463344634446354463644637446384463944640446414464244643446444464544646446474464844649446504465144652446534465444655446564465744658446594466044661446624466344664446654466644667446684466944670446714467244673446744467544676446774467844679446804468144682446834468444685446864468744688446894469044691446924469344694446954469644697446984469944700447014470244703447044470544706447074470844709447104471144712447134471444715447164471744718447194472044721447224472344724447254472644727447284472944730447314473244733447344473544736447374473844739447404474144742447434474444745447464474744748447494475044751447524475344754447554475644757447584475944760447614476244763447644476544766447674476844769447704477144772447734477444775447764477744778447794478044781447824478344784447854478644787447884478944790447914479244793447944479544796447974479844799448004480144802448034480444805448064480744808448094481044811448124481344814448154481644817448184481944820448214482244823448244482544826448274482844829448304483144832448334483444835448364483744838448394484044841448424484344844448454484644847448484484944850448514485244853448544485544856448574485844859448604486144862448634486444865448664486744868448694487044871448724487344874448754487644877448784487944880448814488244883448844488544886448874488844889448904489144892448934489444895448964489744898448994490044901449024490344904449054490644907449084490944910449114491244913449144491544916449174491844919449204492144922449234492444925449264492744928449294493044931449324493344934449354493644937449384493944940449414494244943449444494544946449474494844949449504495144952449534495444955449564495744958449594496044961449624496344964449654496644967449684496944970449714497244973449744497544976449774497844979449804498144982449834498444985449864498744988449894499044991449924499344994449954499644997449984499945000450014500245003450044500545006450074500845009450104501145012450134501445015450164501745018450194502045021450224502345024450254502645027450284502945030450314503245033450344503545036450374503845039450404504145042450434504445045450464504745048450494505045051450524505345054450554505645057450584505945060450614506245063450644506545066450674506845069450704507145072450734507445075450764507745078450794508045081450824508345084450854508645087450884508945090450914509245093450944509545096450974509845099451004510145102451034510445105451064510745108451094511045111451124511345114451154511645117451184511945120451214512245123451244512545126451274512845129451304513145132451334513445135451364513745138451394514045141451424514345144451454514645147451484514945150451514515245153451544515545156451574515845159451604516145162451634516445165451664516745168451694517045171451724517345174451754517645177451784517945180451814518245183451844518545186451874518845189451904519145192451934519445195451964519745198451994520045201452024520345204452054520645207452084520945210452114521245213452144521545216452174521845219452204522145222452234522445225452264522745228452294523045231452324523345234452354523645237452384523945240452414524245243452444524545246452474524845249452504525145252452534525445255452564525745258452594526045261452624526345264452654526645267452684526945270452714527245273452744527545276452774527845279452804528145282452834528445285452864528745288452894529045291452924529345294452954529645297452984529945300453014530245303453044530545306453074530845309453104531145312453134531445315453164531745318453194532045321453224532345324453254532645327453284532945330453314533245333453344533545336453374533845339453404534145342453434534445345453464534745348453494535045351453524535345354453554535645357453584535945360453614536245363453644536545366453674536845369453704537145372453734537445375453764537745378453794538045381453824538345384453854538645387453884538945390453914539245393453944539545396453974539845399454004540145402454034540445405454064540745408454094541045411454124541345414454154541645417454184541945420454214542245423454244542545426454274542845429454304543145432454334543445435454364543745438454394544045441454424544345444454454544645447454484544945450454514545245453454544545545456454574545845459454604546145462454634546445465454664546745468454694547045471454724547345474454754547645477454784547945480454814548245483454844548545486454874548845489454904549145492454934549445495454964549745498454994550045501455024550345504455054550645507455084550945510455114551245513455144551545516455174551845519455204552145522455234552445525455264552745528455294553045531455324553345534455354553645537455384553945540455414554245543455444554545546455474554845549455504555145552455534555445555455564555745558455594556045561455624556345564455654556645567455684556945570455714557245573455744557545576455774557845579455804558145582455834558445585455864558745588455894559045591455924559345594455954559645597455984559945600456014560245603456044560545606456074560845609456104561145612456134561445615456164561745618456194562045621456224562345624456254562645627456284562945630456314563245633456344563545636456374563845639456404564145642456434564445645456464564745648456494565045651456524565345654456554565645657456584565945660456614566245663456644566545666456674566845669456704567145672456734567445675456764567745678456794568045681456824568345684456854568645687456884568945690456914569245693456944569545696456974569845699457004570145702457034570445705457064570745708457094571045711457124571345714457154571645717457184571945720457214572245723457244572545726457274572845729457304573145732457334573445735457364573745738457394574045741457424574345744457454574645747457484574945750457514575245753457544575545756457574575845759457604576145762457634576445765457664576745768457694577045771457724577345774457754577645777457784577945780457814578245783457844578545786457874578845789457904579145792457934579445795457964579745798457994580045801458024580345804458054580645807458084580945810458114581245813458144581545816458174581845819458204582145822458234582445825458264582745828458294583045831458324583345834458354583645837458384583945840458414584245843458444584545846458474584845849458504585145852458534585445855458564585745858458594586045861458624586345864458654586645867458684586945870458714587245873458744587545876458774587845879458804588145882458834588445885458864588745888458894589045891458924589345894458954589645897458984589945900459014590245903459044590545906459074590845909459104591145912459134591445915459164591745918459194592045921459224592345924459254592645927459284592945930459314593245933459344593545936459374593845939459404594145942459434594445945459464594745948459494595045951459524595345954459554595645957459584595945960459614596245963459644596545966459674596845969459704597145972459734597445975459764597745978459794598045981459824598345984459854598645987459884598945990459914599245993459944599545996459974599845999460004600146002460034600446005460064600746008460094601046011460124601346014460154601646017460184601946020460214602246023460244602546026460274602846029460304603146032460334603446035460364603746038460394604046041460424604346044460454604646047460484604946050460514605246053460544605546056460574605846059460604606146062460634606446065460664606746068460694607046071460724607346074460754607646077460784607946080460814608246083460844608546086460874608846089460904609146092460934609446095460964609746098460994610046101461024610346104461054610646107461084610946110461114611246113461144611546116461174611846119461204612146122461234612446125461264612746128461294613046131461324613346134461354613646137461384613946140461414614246143461444614546146461474614846149461504615146152461534615446155461564615746158461594616046161461624616346164461654616646167461684616946170461714617246173461744617546176461774617846179461804618146182461834618446185461864618746188461894619046191461924619346194461954619646197461984619946200462014620246203462044620546206462074620846209462104621146212462134621446215462164621746218462194622046221462224622346224462254622646227462284622946230462314623246233462344623546236462374623846239462404624146242462434624446245462464624746248462494625046251462524625346254462554625646257462584625946260462614626246263462644626546266462674626846269462704627146272462734627446275462764627746278462794628046281462824628346284462854628646287462884628946290462914629246293462944629546296462974629846299463004630146302463034630446305463064630746308463094631046311463124631346314463154631646317463184631946320463214632246323463244632546326463274632846329463304633146332463334633446335463364633746338463394634046341463424634346344463454634646347463484634946350463514635246353463544635546356463574635846359463604636146362463634636446365463664636746368463694637046371463724637346374463754637646377463784637946380463814638246383463844638546386463874638846389463904639146392463934639446395463964639746398463994640046401464024640346404464054640646407464084640946410464114641246413464144641546416464174641846419464204642146422464234642446425464264642746428464294643046431464324643346434464354643646437464384643946440464414644246443464444644546446464474644846449464504645146452464534645446455464564645746458464594646046461464624646346464464654646646467464684646946470464714647246473464744647546476464774647846479464804648146482464834648446485464864648746488464894649046491464924649346494464954649646497464984649946500465014650246503465044650546506465074650846509465104651146512465134651446515465164651746518465194652046521465224652346524465254652646527465284652946530465314653246533465344653546536465374653846539465404654146542465434654446545465464654746548465494655046551465524655346554465554655646557465584655946560465614656246563465644656546566465674656846569465704657146572465734657446575465764657746578465794658046581465824658346584465854658646587465884658946590465914659246593465944659546596465974659846599466004660146602466034660446605466064660746608466094661046611466124661346614466154661646617466184661946620466214662246623466244662546626466274662846629466304663146632466334663446635466364663746638466394664046641466424664346644466454664646647466484664946650466514665246653466544665546656466574665846659466604666146662466634666446665466664666746668466694667046671466724667346674466754667646677466784667946680466814668246683466844668546686466874668846689466904669146692466934669446695466964669746698466994670046701467024670346704467054670646707467084670946710467114671246713467144671546716467174671846719467204672146722467234672446725467264672746728467294673046731467324673346734467354673646737467384673946740467414674246743467444674546746467474674846749467504675146752467534675446755467564675746758467594676046761467624676346764467654676646767467684676946770467714677246773467744677546776467774677846779467804678146782467834678446785467864678746788467894679046791467924679346794467954679646797467984679946800468014680246803468044680546806468074680846809468104681146812468134681446815468164681746818468194682046821468224682346824468254682646827468284682946830468314683246833468344683546836468374683846839468404684146842468434684446845468464684746848468494685046851468524685346854468554685646857468584685946860468614686246863468644686546866468674686846869468704687146872468734687446875468764687746878468794688046881468824688346884468854688646887468884688946890468914689246893468944689546896468974689846899469004690146902469034690446905469064690746908469094691046911469124691346914469154691646917469184691946920469214692246923469244692546926469274692846929469304693146932469334693446935469364693746938469394694046941469424694346944469454694646947469484694946950469514695246953469544695546956469574695846959469604696146962469634696446965469664696746968469694697046971469724697346974469754697646977469784697946980469814698246983469844698546986469874698846989469904699146992469934699446995469964699746998469994700047001470024700347004470054700647007470084700947010470114701247013470144701547016470174701847019470204702147022470234702447025470264702747028470294703047031470324703347034470354703647037470384703947040470414704247043470444704547046470474704847049470504705147052470534705447055470564705747058470594706047061470624706347064470654706647067470684706947070470714707247073470744707547076470774707847079470804708147082470834708447085470864708747088470894709047091470924709347094470954709647097470984709947100471014710247103471044710547106471074710847109471104711147112471134711447115471164711747118471194712047121471224712347124471254712647127471284712947130471314713247133471344713547136471374713847139471404714147142471434714447145471464714747148471494715047151471524715347154471554715647157471584715947160471614716247163471644716547166471674716847169471704717147172471734717447175471764717747178471794718047181471824718347184471854718647187471884718947190471914719247193471944719547196471974719847199472004720147202472034720447205472064720747208472094721047211472124721347214472154721647217472184721947220472214722247223472244722547226472274722847229472304723147232472334723447235472364723747238472394724047241472424724347244472454724647247472484724947250472514725247253472544725547256472574725847259472604726147262472634726447265472664726747268472694727047271472724727347274472754727647277472784727947280472814728247283472844728547286472874728847289472904729147292472934729447295472964729747298472994730047301473024730347304473054730647307473084730947310473114731247313473144731547316473174731847319473204732147322473234732447325473264732747328473294733047331473324733347334473354733647337473384733947340473414734247343473444734547346473474734847349473504735147352473534735447355473564735747358473594736047361473624736347364473654736647367473684736947370473714737247373473744737547376473774737847379473804738147382473834738447385473864738747388473894739047391473924739347394473954739647397473984739947400474014740247403474044740547406474074740847409474104741147412474134741447415474164741747418474194742047421474224742347424474254742647427474284742947430474314743247433474344743547436474374743847439474404744147442474434744447445474464744747448474494745047451474524745347454474554745647457474584745947460474614746247463474644746547466474674746847469474704747147472474734747447475474764747747478474794748047481474824748347484474854748647487474884748947490474914749247493474944749547496474974749847499475004750147502475034750447505475064750747508475094751047511475124751347514475154751647517475184751947520475214752247523475244752547526475274752847529475304753147532475334753447535475364753747538475394754047541475424754347544475454754647547475484754947550475514755247553475544755547556475574755847559475604756147562475634756447565475664756747568475694757047571475724757347574475754757647577475784757947580475814758247583475844758547586475874758847589475904759147592475934759447595475964759747598475994760047601476024760347604476054760647607476084760947610476114761247613476144761547616476174761847619476204762147622476234762447625476264762747628476294763047631476324763347634476354763647637476384763947640476414764247643476444764547646476474764847649476504765147652476534765447655476564765747658476594766047661476624766347664476654766647667476684766947670476714767247673476744767547676476774767847679476804768147682476834768447685476864768747688476894769047691476924769347694476954769647697476984769947700477014770247703477044770547706477074770847709477104771147712477134771447715477164771747718477194772047721477224772347724477254772647727477284772947730477314773247733477344773547736477374773847739477404774147742477434774447745477464774747748477494775047751477524775347754477554775647757477584775947760477614776247763477644776547766477674776847769477704777147772477734777447775477764777747778477794778047781477824778347784477854778647787477884778947790477914779247793477944779547796477974779847799478004780147802478034780447805478064780747808478094781047811478124781347814478154781647817478184781947820478214782247823478244782547826478274782847829478304783147832478334783447835478364783747838478394784047841478424784347844478454784647847478484784947850478514785247853478544785547856478574785847859478604786147862478634786447865478664786747868478694787047871478724787347874478754787647877478784787947880478814788247883478844788547886478874788847889478904789147892478934789447895478964789747898478994790047901479024790347904479054790647907479084790947910479114791247913479144791547916479174791847919479204792147922479234792447925479264792747928479294793047931479324793347934479354793647937479384793947940479414794247943479444794547946479474794847949479504795147952479534795447955479564795747958479594796047961479624796347964479654796647967479684796947970479714797247973479744797547976479774797847979479804798147982479834798447985479864798747988479894799047991479924799347994479954799647997479984799948000480014800248003480044800548006480074800848009480104801148012480134801448015480164801748018480194802048021480224802348024480254802648027480284802948030480314803248033480344803548036480374803848039480404804148042480434804448045480464804748048480494805048051480524805348054480554805648057480584805948060480614806248063480644806548066480674806848069480704807148072480734807448075480764807748078480794808048081480824808348084480854808648087480884808948090480914809248093480944809548096480974809848099481004810148102481034810448105481064810748108481094811048111481124811348114481154811648117481184811948120481214812248123481244812548126481274812848129481304813148132481334813448135481364813748138481394814048141481424814348144481454814648147481484814948150481514815248153481544815548156481574815848159481604816148162481634816448165481664816748168481694817048171481724817348174481754817648177481784817948180481814818248183481844818548186481874818848189481904819148192481934819448195481964819748198481994820048201482024820348204482054820648207482084820948210482114821248213482144821548216482174821848219482204822148222482234822448225482264822748228482294823048231482324823348234482354823648237482384823948240482414824248243482444824548246482474824848249482504825148252482534825448255482564825748258482594826048261482624826348264482654826648267482684826948270482714827248273482744827548276482774827848279482804828148282482834828448285482864828748288482894829048291482924829348294482954829648297482984829948300483014830248303483044830548306483074830848309483104831148312483134831448315483164831748318483194832048321483224832348324483254832648327483284832948330483314833248333483344833548336483374833848339483404834148342483434834448345483464834748348483494835048351483524835348354483554835648357483584835948360483614836248363483644836548366483674836848369483704837148372483734837448375483764837748378483794838048381483824838348384483854838648387483884838948390483914839248393483944839548396483974839848399484004840148402484034840448405484064840748408484094841048411484124841348414484154841648417484184841948420484214842248423484244842548426484274842848429484304843148432484334843448435484364843748438484394844048441484424844348444484454844648447484484844948450484514845248453484544845548456484574845848459484604846148462484634846448465484664846748468484694847048471484724847348474484754847648477484784847948480484814848248483484844848548486484874848848489484904849148492484934849448495484964849748498484994850048501485024850348504485054850648507485084850948510485114851248513485144851548516485174851848519485204852148522485234852448525485264852748528485294853048531485324853348534485354853648537485384853948540485414854248543485444854548546485474854848549485504855148552485534855448555485564855748558485594856048561485624856348564485654856648567485684856948570485714857248573485744857548576485774857848579485804858148582485834858448585485864858748588485894859048591485924859348594485954859648597485984859948600486014860248603486044860548606486074860848609486104861148612486134861448615486164861748618486194862048621486224862348624486254862648627486284862948630486314863248633486344863548636486374863848639486404864148642486434864448645486464864748648486494865048651486524865348654486554865648657486584865948660486614866248663486644866548666486674866848669486704867148672486734867448675486764867748678486794868048681486824868348684486854868648687486884868948690486914869248693486944869548696486974869848699487004870148702487034870448705487064870748708487094871048711487124871348714487154871648717487184871948720487214872248723487244872548726487274872848729487304873148732487334873448735487364873748738487394874048741487424874348744487454874648747487484874948750487514875248753487544875548756487574875848759487604876148762487634876448765487664876748768487694877048771487724877348774487754877648777487784877948780487814878248783487844878548786487874878848789487904879148792487934879448795487964879748798487994880048801488024880348804488054880648807488084880948810488114881248813488144881548816488174881848819488204882148822488234882448825488264882748828488294883048831488324883348834488354883648837488384883948840488414884248843488444884548846488474884848849488504885148852488534885448855488564885748858488594886048861488624886348864488654886648867488684886948870488714887248873488744887548876488774887848879488804888148882488834888448885488864888748888488894889048891488924889348894488954889648897488984889948900489014890248903489044890548906489074890848909489104891148912489134891448915489164891748918489194892048921489224892348924489254892648927489284892948930489314893248933489344893548936489374893848939489404894148942489434894448945489464894748948489494895048951489524895348954489554895648957489584895948960489614896248963489644896548966489674896848969489704897148972489734897448975489764897748978489794898048981489824898348984489854898648987489884898948990489914899248993489944899548996489974899848999490004900149002490034900449005490064900749008490094901049011490124901349014490154901649017490184901949020490214902249023490244902549026490274902849029490304903149032490334903449035490364903749038490394904049041490424904349044490454904649047490484904949050490514905249053490544905549056490574905849059490604906149062490634906449065490664906749068490694907049071490724907349074490754907649077490784907949080490814908249083490844908549086490874908849089490904909149092490934909449095490964909749098490994910049101491024910349104491054910649107491084910949110491114911249113491144911549116491174911849119491204912149122491234912449125491264912749128491294913049131491324913349134491354913649137491384913949140491414914249143491444914549146491474914849149491504915149152491534915449155491564915749158491594916049161491624916349164491654916649167491684916949170491714917249173491744917549176491774917849179491804918149182491834918449185491864918749188491894919049191491924919349194491954919649197491984919949200492014920249203492044920549206492074920849209492104921149212492134921449215492164921749218492194922049221492224922349224492254922649227492284922949230492314923249233492344923549236492374923849239492404924149242492434924449245492464924749248492494925049251492524925349254492554925649257492584925949260492614926249263492644926549266492674926849269492704927149272492734927449275492764927749278492794928049281492824928349284492854928649287492884928949290492914929249293492944929549296492974929849299493004930149302493034930449305493064930749308493094931049311493124931349314493154931649317493184931949320493214932249323493244932549326493274932849329493304933149332493334933449335493364933749338493394934049341493424934349344493454934649347493484934949350493514935249353493544935549356493574935849359493604936149362493634936449365493664936749368493694937049371493724937349374493754937649377493784937949380493814938249383493844938549386493874938849389493904939149392493934939449395493964939749398493994940049401494024940349404494054940649407494084940949410494114941249413494144941549416494174941849419494204942149422494234942449425494264942749428494294943049431494324943349434494354943649437494384943949440494414944249443494444944549446494474944849449494504945149452494534945449455494564945749458494594946049461494624946349464494654946649467494684946949470494714947249473494744947549476494774947849479494804948149482494834948449485494864948749488494894949049491494924949349494494954949649497494984949949500495014950249503495044950549506495074950849509495104951149512495134951449515495164951749518495194952049521495224952349524495254952649527495284952949530495314953249533495344953549536495374953849539495404954149542495434954449545495464954749548495494955049551495524955349554495554955649557495584955949560495614956249563495644956549566495674956849569495704957149572495734957449575495764957749578495794958049581495824958349584495854958649587495884958949590495914959249593495944959549596495974959849599496004960149602496034960449605496064960749608496094961049611496124961349614496154961649617496184961949620496214962249623496244962549626496274962849629496304963149632496334963449635496364963749638496394964049641496424964349644496454964649647496484964949650496514965249653496544965549656496574965849659496604966149662496634966449665496664966749668496694967049671496724967349674496754967649677496784967949680496814968249683496844968549686496874968849689496904969149692496934969449695496964969749698496994970049701497024970349704497054970649707497084970949710497114971249713497144971549716497174971849719497204972149722497234972449725497264972749728497294973049731497324973349734497354973649737497384973949740497414974249743497444974549746497474974849749497504975149752497534975449755497564975749758497594976049761497624976349764497654976649767497684976949770497714977249773497744977549776497774977849779497804978149782497834978449785497864978749788497894979049791497924979349794497954979649797497984979949800498014980249803498044980549806498074980849809498104981149812498134981449815498164981749818498194982049821498224982349824498254982649827498284982949830498314983249833498344983549836498374983849839498404984149842498434984449845498464984749848498494985049851498524985349854498554985649857498584985949860498614986249863498644986549866498674986849869498704987149872498734987449875498764987749878498794988049881498824988349884498854988649887498884988949890498914989249893498944989549896498974989849899499004990149902499034990449905499064990749908499094991049911499124991349914499154991649917499184991949920499214992249923499244992549926499274992849929499304993149932499334993449935499364993749938499394994049941499424994349944499454994649947499484994949950499514995249953499544995549956499574995849959499604996149962499634996449965499664996749968499694997049971499724997349974499754997649977499784997949980499814998249983499844998549986499874998849989499904999149992499934999449995499964999749998499995000050001500025000350004500055000650007500085000950010500115001250013500145001550016500175001850019500205002150022500235002450025500265002750028500295003050031500325003350034500355003650037500385003950040500415004250043500445004550046500475004850049500505005150052500535005450055500565005750058500595006050061500625006350064500655006650067500685006950070500715007250073500745007550076500775007850079500805008150082500835008450085500865008750088500895009050091500925009350094500955009650097500985009950100501015010250103501045010550106501075010850109501105011150112501135011450115501165011750118501195012050121501225012350124501255012650127501285012950130501315013250133501345013550136501375013850139501405014150142501435014450145501465014750148501495015050151501525015350154501555015650157501585015950160501615016250163501645016550166501675016850169501705017150172501735017450175501765017750178501795018050181501825018350184501855018650187501885018950190501915019250193501945019550196501975019850199502005020150202502035020450205502065020750208502095021050211502125021350214502155021650217502185021950220502215022250223502245022550226502275022850229502305023150232502335023450235502365023750238502395024050241502425024350244502455024650247502485024950250502515025250253502545025550256502575025850259502605026150262502635026450265502665026750268502695027050271502725027350274502755027650277502785027950280502815028250283502845028550286502875028850289502905029150292502935029450295502965029750298502995030050301503025030350304503055030650307503085030950310503115031250313503145031550316503175031850319503205032150322503235032450325503265032750328503295033050331503325033350334503355033650337503385033950340503415034250343503445034550346503475034850349503505035150352503535035450355503565035750358503595036050361503625036350364503655036650367503685036950370503715037250373503745037550376503775037850379503805038150382503835038450385503865038750388503895039050391503925039350394503955039650397503985039950400504015040250403504045040550406504075040850409504105041150412504135041450415504165041750418504195042050421504225042350424504255042650427504285042950430504315043250433504345043550436504375043850439504405044150442504435044450445504465044750448504495045050451504525045350454504555045650457504585045950460504615046250463504645046550466504675046850469504705047150472504735047450475504765047750478504795048050481504825048350484504855048650487504885048950490504915049250493504945049550496504975049850499505005050150502505035050450505505065050750508505095051050511505125051350514505155051650517505185051950520505215052250523505245052550526505275052850529505305053150532505335053450535505365053750538505395054050541505425054350544505455054650547505485054950550505515055250553505545055550556505575055850559505605056150562505635056450565505665056750568505695057050571505725057350574505755057650577505785057950580505815058250583505845058550586505875058850589505905059150592505935059450595505965059750598505995060050601506025060350604506055060650607506085060950610506115061250613506145061550616506175061850619506205062150622506235062450625506265062750628506295063050631506325063350634506355063650637506385063950640506415064250643506445064550646506475064850649506505065150652506535065450655506565065750658506595066050661506625066350664506655066650667506685066950670506715067250673506745067550676506775067850679506805068150682506835068450685506865068750688506895069050691506925069350694506955069650697506985069950700507015070250703507045070550706507075070850709507105071150712507135071450715507165071750718507195072050721507225072350724507255072650727507285072950730507315073250733507345073550736507375073850739507405074150742507435074450745507465074750748507495075050751507525075350754507555075650757507585075950760507615076250763507645076550766507675076850769507705077150772507735077450775507765077750778507795078050781507825078350784507855078650787507885078950790507915079250793507945079550796507975079850799508005080150802508035080450805508065080750808508095081050811508125081350814508155081650817508185081950820508215082250823508245082550826508275082850829508305083150832508335083450835508365083750838508395084050841508425084350844508455084650847508485084950850508515085250853508545085550856508575085850859508605086150862508635086450865508665086750868508695087050871508725087350874508755087650877508785087950880508815088250883508845088550886508875088850889508905089150892508935089450895508965089750898508995090050901509025090350904509055090650907509085090950910509115091250913509145091550916509175091850919509205092150922509235092450925509265092750928509295093050931509325093350934509355093650937509385093950940509415094250943509445094550946509475094850949509505095150952509535095450955509565095750958509595096050961509625096350964509655096650967509685096950970509715097250973509745097550976509775097850979509805098150982509835098450985509865098750988509895099050991509925099350994509955099650997509985099951000510015100251003510045100551006510075100851009510105101151012510135101451015510165101751018510195102051021510225102351024510255102651027510285102951030510315103251033510345103551036510375103851039510405104151042510435104451045510465104751048510495105051051510525105351054510555105651057510585105951060510615106251063510645106551066510675106851069510705107151072510735107451075510765107751078510795108051081510825108351084510855108651087510885108951090510915109251093510945109551096510975109851099511005110151102511035110451105511065110751108511095111051111511125111351114511155111651117511185111951120511215112251123511245112551126511275112851129511305113151132511335113451135511365113751138511395114051141511425114351144511455114651147511485114951150511515115251153511545115551156511575115851159511605116151162511635116451165511665116751168511695117051171511725117351174511755117651177511785117951180511815118251183511845118551186511875118851189511905119151192511935119451195511965119751198511995120051201512025120351204512055120651207512085120951210512115121251213512145121551216512175121851219512205122151222512235122451225512265122751228512295123051231512325123351234512355123651237512385123951240512415124251243512445124551246512475124851249512505125151252512535125451255512565125751258512595126051261512625126351264512655126651267512685126951270512715127251273512745127551276512775127851279512805128151282512835128451285512865128751288512895129051291512925129351294512955129651297512985129951300513015130251303513045130551306513075130851309513105131151312513135131451315513165131751318513195132051321513225132351324513255132651327513285132951330513315133251333513345133551336513375133851339513405134151342513435134451345513465134751348513495135051351513525135351354513555135651357513585135951360513615136251363513645136551366513675136851369513705137151372513735137451375513765137751378513795138051381513825138351384513855138651387513885138951390513915139251393513945139551396513975139851399514005140151402514035140451405514065140751408514095141051411514125141351414514155141651417514185141951420514215142251423514245142551426514275142851429514305143151432514335143451435514365143751438514395144051441514425144351444514455144651447514485144951450514515145251453514545145551456514575145851459514605146151462514635146451465514665146751468514695147051471514725147351474514755147651477514785147951480514815148251483514845148551486514875148851489514905149151492514935149451495514965149751498514995150051501515025150351504515055150651507515085150951510515115151251513515145151551516515175151851519515205152151522515235152451525515265152751528515295153051531515325153351534515355153651537515385153951540515415154251543515445154551546515475154851549515505155151552515535155451555515565155751558515595156051561515625156351564515655156651567515685156951570515715157251573515745157551576515775157851579515805158151582515835158451585515865158751588515895159051591515925159351594515955159651597515985159951600516015160251603516045160551606516075160851609516105161151612516135161451615516165161751618516195162051621516225162351624516255162651627516285162951630516315163251633516345163551636516375163851639516405164151642516435164451645516465164751648516495165051651516525165351654516555165651657516585165951660516615166251663516645166551666516675166851669516705167151672516735167451675516765167751678516795168051681516825168351684516855168651687516885168951690516915169251693516945169551696516975169851699517005170151702517035170451705517065170751708517095171051711517125171351714517155171651717517185171951720517215172251723517245172551726517275172851729517305173151732517335173451735517365173751738517395174051741517425174351744517455174651747517485174951750517515175251753517545175551756517575175851759517605176151762517635176451765517665176751768517695177051771517725177351774517755177651777517785177951780517815178251783517845178551786517875178851789517905179151792517935179451795517965179751798517995180051801518025180351804518055180651807518085180951810518115181251813518145181551816518175181851819518205182151822518235182451825518265182751828518295183051831518325183351834518355183651837518385183951840518415184251843518445184551846518475184851849518505185151852518535185451855518565185751858518595186051861518625186351864518655186651867518685186951870518715187251873518745187551876518775187851879518805188151882518835188451885518865188751888518895189051891518925189351894518955189651897518985189951900519015190251903519045190551906519075190851909519105191151912519135191451915519165191751918519195192051921519225192351924519255192651927519285192951930519315193251933519345193551936519375193851939519405194151942519435194451945519465194751948519495195051951519525195351954519555195651957519585195951960519615196251963519645196551966519675196851969519705197151972519735197451975519765197751978519795198051981519825198351984519855198651987519885198951990519915199251993519945199551996519975199851999520005200152002520035200452005520065200752008520095201052011520125201352014520155201652017520185201952020520215202252023520245202552026520275202852029520305203152032520335203452035520365203752038520395204052041520425204352044520455204652047520485204952050520515205252053520545205552056520575205852059520605206152062520635206452065520665206752068520695207052071520725207352074520755207652077520785207952080520815208252083520845208552086520875208852089520905209152092520935209452095520965209752098520995210052101521025210352104521055210652107521085210952110521115211252113521145211552116521175211852119521205212152122521235212452125521265212752128521295213052131521325213352134521355213652137521385213952140521415214252143521445214552146521475214852149521505215152152521535215452155521565215752158521595216052161521625216352164521655216652167521685216952170521715217252173521745217552176521775217852179521805218152182521835218452185521865218752188521895219052191521925219352194521955219652197521985219952200522015220252203522045220552206522075220852209522105221152212522135221452215522165221752218522195222052221522225222352224522255222652227522285222952230522315223252233522345223552236522375223852239522405224152242522435224452245522465224752248522495225052251522525225352254522555225652257522585225952260522615226252263522645226552266522675226852269522705227152272522735227452275522765227752278522795228052281522825228352284522855228652287522885228952290522915229252293522945229552296522975229852299523005230152302523035230452305523065230752308523095231052311523125231352314523155231652317523185231952320523215232252323523245232552326523275232852329523305233152332523335233452335523365233752338523395234052341523425234352344523455234652347523485234952350523515235252353523545235552356523575235852359523605236152362523635236452365523665236752368523695237052371523725237352374523755237652377523785237952380523815238252383523845238552386523875238852389523905239152392523935239452395523965239752398523995240052401524025240352404524055240652407524085240952410524115241252413524145241552416524175241852419524205242152422524235242452425524265242752428524295243052431524325243352434524355243652437524385243952440524415244252443524445244552446524475244852449524505245152452524535245452455524565245752458524595246052461524625246352464524655246652467524685246952470524715247252473524745247552476524775247852479524805248152482524835248452485524865248752488524895249052491524925249352494524955249652497524985249952500525015250252503525045250552506525075250852509525105251152512525135251452515525165251752518525195252052521525225252352524525255252652527525285252952530525315253252533525345253552536525375253852539525405254152542525435254452545525465254752548525495255052551525525255352554525555255652557525585255952560525615256252563525645256552566525675256852569525705257152572525735257452575525765257752578525795258052581525825258352584525855258652587525885258952590525915259252593525945259552596525975259852599526005260152602526035260452605526065260752608526095261052611526125261352614526155261652617526185261952620526215262252623526245262552626526275262852629526305263152632526335263452635526365263752638526395264052641526425264352644526455264652647526485264952650526515265252653526545265552656526575265852659526605266152662526635266452665526665266752668526695267052671526725267352674526755267652677526785267952680526815268252683526845268552686526875268852689526905269152692526935269452695526965269752698526995270052701527025270352704527055270652707527085270952710527115271252713527145271552716527175271852719527205272152722527235272452725527265272752728527295273052731527325273352734527355273652737527385273952740527415274252743527445274552746527475274852749527505275152752527535275452755527565275752758527595276052761527625276352764527655276652767527685276952770527715277252773527745277552776527775277852779527805278152782527835278452785527865278752788527895279052791527925279352794527955279652797527985279952800528015280252803528045280552806528075280852809528105281152812528135281452815528165281752818528195282052821528225282352824528255282652827528285282952830528315283252833528345283552836528375283852839528405284152842528435284452845528465284752848528495285052851528525285352854528555285652857528585285952860528615286252863528645286552866528675286852869528705287152872528735287452875528765287752878528795288052881528825288352884528855288652887528885288952890528915289252893528945289552896528975289852899529005290152902529035290452905529065290752908529095291052911529125291352914529155291652917529185291952920529215292252923529245292552926529275292852929529305293152932529335293452935529365293752938529395294052941529425294352944529455294652947529485294952950529515295252953529545295552956529575295852959529605296152962529635296452965529665296752968529695297052971529725297352974529755297652977529785297952980529815298252983529845298552986529875298852989529905299152992529935299452995529965299752998529995300053001530025300353004530055300653007530085300953010530115301253013530145301553016530175301853019530205302153022530235302453025530265302753028530295303053031530325303353034530355303653037530385303953040530415304253043530445304553046530475304853049530505305153052530535305453055530565305753058530595306053061530625306353064530655306653067530685306953070530715307253073530745307553076530775307853079530805308153082530835308453085530865308753088530895309053091530925309353094530955309653097530985309953100531015310253103531045310553106531075310853109531105311153112531135311453115531165311753118531195312053121531225312353124531255312653127531285312953130531315313253133531345313553136531375313853139531405314153142531435314453145531465314753148531495315053151531525315353154531555315653157531585315953160531615316253163531645316553166531675316853169531705317153172531735317453175531765317753178531795318053181531825318353184531855318653187531885318953190531915319253193531945319553196531975319853199532005320153202532035320453205532065320753208532095321053211532125321353214532155321653217532185321953220532215322253223532245322553226532275322853229532305323153232532335323453235532365323753238532395324053241532425324353244532455324653247532485324953250532515325253253532545325553256532575325853259532605326153262532635326453265532665326753268532695327053271532725327353274532755327653277532785327953280532815328253283532845328553286532875328853289532905329153292532935329453295532965329753298532995330053301533025330353304533055330653307533085330953310533115331253313533145331553316533175331853319533205332153322533235332453325533265332753328533295333053331533325333353334533355333653337533385333953340533415334253343533445334553346533475334853349533505335153352533535335453355533565335753358533595336053361533625336353364533655336653367533685336953370533715337253373533745337553376533775337853379533805338153382533835338453385533865338753388533895339053391533925339353394533955339653397533985339953400534015340253403534045340553406534075340853409534105341153412534135341453415534165341753418534195342053421534225342353424534255342653427534285342953430534315343253433534345343553436534375343853439534405344153442534435344453445534465344753448534495345053451534525345353454534555345653457534585345953460534615346253463534645346553466534675346853469534705347153472534735347453475534765347753478534795348053481534825348353484534855348653487534885348953490534915349253493534945349553496534975349853499535005350153502535035350453505535065350753508535095351053511535125351353514535155351653517535185351953520535215352253523535245352553526535275352853529535305353153532535335353453535535365353753538535395354053541535425354353544535455354653547535485354953550535515355253553535545355553556535575355853559535605356153562535635356453565535665356753568535695357053571535725357353574535755357653577535785357953580535815358253583535845358553586535875358853589535905359153592535935359453595535965359753598535995360053601536025360353604536055360653607536085360953610536115361253613536145361553616536175361853619536205362153622536235362453625536265362753628536295363053631536325363353634536355363653637536385363953640536415364253643536445364553646536475364853649536505365153652536535365453655536565365753658536595366053661536625366353664536655366653667536685366953670536715367253673536745367553676536775367853679536805368153682536835368453685536865368753688536895369053691536925369353694536955369653697536985369953700537015370253703537045370553706537075370853709537105371153712537135371453715537165371753718537195372053721537225372353724537255372653727537285372953730537315373253733537345373553736537375373853739537405374153742537435374453745537465374753748537495375053751537525375353754537555375653757537585375953760537615376253763537645376553766537675376853769537705377153772537735377453775537765377753778537795378053781537825378353784537855378653787537885378953790537915379253793537945379553796537975379853799538005380153802538035380453805538065380753808538095381053811538125381353814538155381653817538185381953820538215382253823538245382553826538275382853829538305383153832538335383453835538365383753838538395384053841538425384353844538455384653847538485384953850538515385253853538545385553856538575385853859538605386153862538635386453865538665386753868538695387053871538725387353874538755387653877538785387953880538815388253883538845388553886538875388853889538905389153892538935389453895538965389753898538995390053901539025390353904539055390653907539085390953910539115391253913539145391553916539175391853919539205392153922539235392453925539265392753928539295393053931539325393353934539355393653937539385393953940539415394253943539445394553946539475394853949539505395153952539535395453955539565395753958539595396053961539625396353964539655396653967539685396953970539715397253973539745397553976539775397853979539805398153982539835398453985539865398753988539895399053991539925399353994539955399653997539985399954000540015400254003540045400554006540075400854009540105401154012540135401454015540165401754018540195402054021540225402354024540255402654027540285402954030540315403254033540345403554036540375403854039540405404154042540435404454045540465404754048540495405054051540525405354054540555405654057540585405954060540615406254063540645406554066540675406854069540705407154072540735407454075540765407754078540795408054081540825408354084540855408654087540885408954090540915409254093540945409554096540975409854099541005410154102541035410454105541065410754108541095411054111541125411354114541155411654117541185411954120541215412254123541245412554126541275412854129541305413154132541335413454135541365413754138541395414054141541425414354144541455414654147541485414954150541515415254153541545415554156541575415854159541605416154162541635416454165541665416754168541695417054171541725417354174541755417654177541785417954180541815418254183541845418554186541875418854189541905419154192541935419454195541965419754198541995420054201542025420354204542055420654207542085420954210542115421254213542145421554216542175421854219542205422154222542235422454225542265422754228542295423054231542325423354234542355423654237542385423954240542415424254243542445424554246542475424854249542505425154252542535425454255542565425754258542595426054261542625426354264542655426654267542685426954270542715427254273542745427554276542775427854279542805428154282542835428454285542865428754288542895429054291542925429354294542955429654297542985429954300543015430254303543045430554306543075430854309543105431154312543135431454315543165431754318543195432054321543225432354324543255432654327543285432954330543315433254333543345433554336543375433854339543405434154342543435434454345543465434754348543495435054351543525435354354543555435654357543585435954360543615436254363543645436554366543675436854369543705437154372543735437454375543765437754378543795438054381543825438354384543855438654387543885438954390543915439254393543945439554396543975439854399544005440154402544035440454405544065440754408544095441054411544125441354414544155441654417544185441954420544215442254423544245442554426544275442854429544305443154432544335443454435544365443754438544395444054441544425444354444544455444654447544485444954450544515445254453544545445554456544575445854459544605446154462544635446454465544665446754468544695447054471544725447354474544755447654477544785447954480544815448254483544845448554486544875448854489544905449154492544935449454495544965449754498544995450054501545025450354504545055450654507545085450954510545115451254513545145451554516545175451854519545205452154522545235452454525545265452754528545295453054531545325453354534545355453654537545385453954540545415454254543545445454554546545475454854549545505455154552545535455454555545565455754558545595456054561545625456354564545655456654567545685456954570545715457254573545745457554576545775457854579545805458154582545835458454585545865458754588545895459054591545925459354594545955459654597545985459954600546015460254603546045460554606546075460854609546105461154612546135461454615546165461754618546195462054621546225462354624546255462654627546285462954630546315463254633546345463554636546375463854639546405464154642546435464454645546465464754648546495465054651546525465354654546555465654657546585465954660546615466254663546645466554666546675466854669546705467154672546735467454675546765467754678546795468054681546825468354684546855468654687546885468954690546915469254693546945469554696546975469854699547005470154702547035470454705547065470754708547095471054711547125471354714547155471654717547185471954720547215472254723547245472554726547275472854729547305473154732547335473454735547365473754738547395474054741547425474354744547455474654747547485474954750547515475254753547545475554756547575475854759547605476154762547635476454765547665476754768547695477054771547725477354774547755477654777547785477954780547815478254783547845478554786547875478854789547905479154792547935479454795547965479754798547995480054801548025480354804548055480654807548085480954810548115481254813548145481554816548175481854819548205482154822548235482454825548265482754828548295483054831548325483354834548355483654837548385483954840548415484254843548445484554846548475484854849548505485154852548535485454855548565485754858548595486054861548625486354864548655486654867548685486954870548715487254873548745487554876548775487854879548805488154882548835488454885548865488754888548895489054891548925489354894548955489654897548985489954900549015490254903549045490554906549075490854909549105491154912549135491454915549165491754918549195492054921549225492354924549255492654927549285492954930549315493254933549345493554936549375493854939549405494154942549435494454945549465494754948549495495054951549525495354954549555495654957549585495954960549615496254963549645496554966549675496854969549705497154972549735497454975549765497754978549795498054981549825498354984549855498654987549885498954990549915499254993549945499554996549975499854999550005500155002550035500455005550065500755008550095501055011550125501355014550155501655017550185501955020550215502255023550245502555026550275502855029550305503155032550335503455035550365503755038550395504055041550425504355044550455504655047550485504955050550515505255053550545505555056550575505855059550605506155062550635506455065550665506755068550695507055071550725507355074550755507655077550785507955080550815508255083550845508555086550875508855089550905509155092550935509455095550965509755098550995510055101551025510355104551055510655107551085510955110551115511255113551145511555116551175511855119551205512155122551235512455125551265512755128551295513055131551325513355134551355513655137551385513955140551415514255143551445514555146551475514855149551505515155152551535515455155551565515755158551595516055161551625516355164551655516655167551685516955170551715517255173551745517555176551775517855179551805518155182551835518455185551865518755188551895519055191551925519355194551955519655197551985519955200552015520255203552045520555206552075520855209552105521155212552135521455215552165521755218552195522055221552225522355224552255522655227552285522955230552315523255233552345523555236552375523855239552405524155242552435524455245552465524755248552495525055251552525525355254552555525655257552585525955260552615526255263552645526555266552675526855269552705527155272552735527455275552765527755278552795528055281552825528355284552855528655287552885528955290552915529255293552945529555296552975529855299553005530155302553035530455305553065530755308553095531055311553125531355314553155531655317553185531955320553215532255323553245532555326553275532855329553305533155332553335533455335553365533755338553395534055341553425534355344553455534655347553485534955350553515535255353553545535555356553575535855359553605536155362553635536455365553665536755368553695537055371553725537355374553755537655377553785537955380553815538255383553845538555386553875538855389553905539155392553935539455395553965539755398553995540055401554025540355404554055540655407554085540955410554115541255413554145541555416554175541855419554205542155422554235542455425554265542755428554295543055431554325543355434554355543655437554385543955440554415544255443554445544555446554475544855449554505545155452554535545455455554565545755458554595546055461554625546355464554655546655467554685546955470554715547255473554745547555476554775547855479554805548155482554835548455485554865548755488554895549055491554925549355494554955549655497554985549955500555015550255503555045550555506555075550855509555105551155512555135551455515555165551755518555195552055521555225552355524555255552655527555285552955530555315553255533555345553555536555375553855539555405554155542555435554455545555465554755548555495555055551555525555355554555555555655557555585555955560555615556255563555645556555566555675556855569555705557155572555735557455575555765557755578555795558055581555825558355584555855558655587555885558955590555915559255593555945559555596555975559855599556005560155602556035560455605556065560755608556095561055611556125561355614556155561655617556185561955620556215562255623556245562555626556275562855629556305563155632556335563455635556365563755638556395564055641556425564355644556455564655647556485564955650556515565255653556545565555656556575565855659556605566155662556635566455665556665566755668556695567055671556725567355674556755567655677556785567955680556815568255683556845568555686556875568855689556905569155692556935569455695556965569755698556995570055701557025570355704557055570655707557085570955710557115571255713557145571555716557175571855719557205572155722557235572455725557265572755728557295573055731557325573355734557355573655737557385573955740557415574255743557445574555746557475574855749557505575155752557535575455755557565575755758557595576055761557625576355764557655576655767557685576955770557715577255773557745577555776557775577855779557805578155782557835578455785557865578755788557895579055791557925579355794557955579655797557985579955800558015580255803558045580555806558075580855809558105581155812558135581455815558165581755818558195582055821558225582355824558255582655827558285582955830558315583255833558345583555836558375583855839558405584155842558435584455845558465584755848558495585055851558525585355854558555585655857558585585955860558615586255863558645586555866558675586855869558705587155872558735587455875558765587755878558795588055881558825588355884558855588655887558885588955890558915589255893558945589555896558975589855899559005590155902559035590455905559065590755908559095591055911559125591355914559155591655917559185591955920559215592255923559245592555926559275592855929559305593155932559335593455935559365593755938559395594055941559425594355944559455594655947559485594955950559515595255953559545595555956559575595855959559605596155962559635596455965559665596755968559695597055971559725597355974559755597655977559785597955980559815598255983559845598555986559875598855989559905599155992559935599455995559965599755998559995600056001560025600356004560055600656007560085600956010560115601256013560145601556016560175601856019560205602156022560235602456025560265602756028560295603056031560325603356034560355603656037560385603956040560415604256043560445604556046560475604856049560505605156052560535605456055560565605756058560595606056061560625606356064560655606656067560685606956070560715607256073560745607556076560775607856079560805608156082560835608456085560865608756088560895609056091560925609356094560955609656097560985609956100561015610256103561045610556106561075610856109561105611156112561135611456115561165611756118561195612056121561225612356124561255612656127561285612956130561315613256133561345613556136561375613856139561405614156142561435614456145561465614756148561495615056151561525615356154561555615656157561585615956160561615616256163561645616556166561675616856169561705617156172561735617456175561765617756178561795618056181561825618356184561855618656187561885618956190561915619256193561945619556196561975619856199562005620156202562035620456205562065620756208562095621056211562125621356214562155621656217562185621956220562215622256223562245622556226562275622856229562305623156232562335623456235562365623756238562395624056241562425624356244562455624656247562485624956250562515625256253562545625556256562575625856259562605626156262562635626456265562665626756268562695627056271562725627356274562755627656277562785627956280562815628256283562845628556286562875628856289562905629156292562935629456295562965629756298562995630056301563025630356304563055630656307563085630956310563115631256313563145631556316563175631856319563205632156322563235632456325563265632756328563295633056331563325633356334563355633656337563385633956340563415634256343563445634556346563475634856349563505635156352563535635456355563565635756358563595636056361563625636356364563655636656367563685636956370563715637256373563745637556376563775637856379563805638156382563835638456385563865638756388563895639056391563925639356394563955639656397563985639956400564015640256403564045640556406564075640856409564105641156412564135641456415564165641756418564195642056421564225642356424564255642656427564285642956430564315643256433564345643556436564375643856439564405644156442564435644456445564465644756448564495645056451564525645356454564555645656457564585645956460564615646256463564645646556466564675646856469564705647156472564735647456475564765647756478564795648056481564825648356484564855648656487564885648956490564915649256493564945649556496564975649856499565005650156502565035650456505565065650756508565095651056511565125651356514565155651656517565185651956520565215652256523565245652556526565275652856529565305653156532565335653456535565365653756538565395654056541565425654356544565455654656547565485654956550565515655256553565545655556556565575655856559565605656156562565635656456565565665656756568565695657056571565725657356574565755657656577565785657956580565815658256583565845658556586565875658856589565905659156592565935659456595565965659756598565995660056601566025660356604566055660656607566085660956610566115661256613566145661556616566175661856619566205662156622566235662456625566265662756628566295663056631566325663356634566355663656637566385663956640566415664256643566445664556646566475664856649566505665156652566535665456655566565665756658566595666056661566625666356664566655666656667566685666956670566715667256673566745667556676566775667856679566805668156682566835668456685566865668756688566895669056691566925669356694566955669656697566985669956700567015670256703567045670556706567075670856709567105671156712567135671456715567165671756718567195672056721567225672356724567255672656727567285672956730567315673256733567345673556736567375673856739567405674156742567435674456745567465674756748567495675056751567525675356754567555675656757567585675956760567615676256763567645676556766567675676856769567705677156772567735677456775567765677756778567795678056781567825678356784567855678656787567885678956790567915679256793567945679556796567975679856799568005680156802568035680456805568065680756808568095681056811568125681356814568155681656817568185681956820568215682256823568245682556826568275682856829568305683156832568335683456835568365683756838568395684056841568425684356844568455684656847568485684956850568515685256853568545685556856568575685856859568605686156862568635686456865568665686756868568695687056871568725687356874568755687656877568785687956880568815688256883568845688556886568875688856889568905689156892568935689456895568965689756898568995690056901569025690356904569055690656907569085690956910569115691256913569145691556916569175691856919569205692156922569235692456925569265692756928569295693056931569325693356934569355693656937569385693956940569415694256943569445694556946569475694856949569505695156952569535695456955569565695756958569595696056961569625696356964569655696656967569685696956970569715697256973569745697556976569775697856979569805698156982569835698456985569865698756988569895699056991569925699356994569955699656997569985699957000570015700257003570045700557006570075700857009570105701157012570135701457015570165701757018570195702057021570225702357024570255702657027570285702957030570315703257033570345703557036570375703857039570405704157042570435704457045570465704757048570495705057051570525705357054570555705657057570585705957060570615706257063570645706557066570675706857069570705707157072570735707457075570765707757078570795708057081570825708357084570855708657087570885708957090570915709257093570945709557096570975709857099571005710157102571035710457105571065710757108571095711057111571125711357114571155711657117571185711957120571215712257123571245712557126571275712857129571305713157132571335713457135571365713757138571395714057141571425714357144571455714657147571485714957150571515715257153571545715557156571575715857159571605716157162571635716457165571665716757168571695717057171571725717357174571755717657177571785717957180571815718257183571845718557186571875718857189571905719157192571935719457195571965719757198571995720057201572025720357204572055720657207572085720957210572115721257213572145721557216572175721857219572205722157222572235722457225572265722757228572295723057231572325723357234572355723657237572385723957240572415724257243572445724557246572475724857249572505725157252572535725457255572565725757258572595726057261572625726357264572655726657267572685726957270572715727257273572745727557276572775727857279572805728157282572835728457285572865728757288572895729057291572925729357294572955729657297572985729957300573015730257303573045730557306573075730857309573105731157312573135731457315573165731757318573195732057321573225732357324573255732657327573285732957330573315733257333573345733557336573375733857339573405734157342573435734457345573465734757348573495735057351573525735357354573555735657357573585735957360573615736257363573645736557366573675736857369573705737157372573735737457375573765737757378573795738057381573825738357384573855738657387573885738957390573915739257393573945739557396573975739857399574005740157402574035740457405574065740757408574095741057411574125741357414574155741657417574185741957420574215742257423574245742557426574275742857429574305743157432574335743457435574365743757438574395744057441574425744357444574455744657447574485744957450574515745257453574545745557456574575745857459574605746157462574635746457465574665746757468574695747057471574725747357474574755747657477574785747957480574815748257483574845748557486574875748857489574905749157492574935749457495574965749757498574995750057501575025750357504575055750657507575085750957510575115751257513575145751557516575175751857519575205752157522575235752457525575265752757528575295753057531575325753357534575355753657537575385753957540575415754257543575445754557546575475754857549575505755157552575535755457555575565755757558575595756057561575625756357564575655756657567575685756957570575715757257573575745757557576575775757857579575805758157582575835758457585575865758757588575895759057591575925759357594575955759657597575985759957600576015760257603576045760557606576075760857609576105761157612576135761457615576165761757618576195762057621576225762357624576255762657627576285762957630576315763257633576345763557636576375763857639576405764157642576435764457645576465764757648576495765057651576525765357654576555765657657576585765957660576615766257663576645766557666576675766857669576705767157672576735767457675576765767757678576795768057681576825768357684576855768657687576885768957690576915769257693576945769557696576975769857699577005770157702577035770457705577065770757708577095771057711577125771357714577155771657717577185771957720577215772257723577245772557726577275772857729577305773157732577335773457735577365773757738577395774057741577425774357744577455774657747577485774957750577515775257753577545775557756577575775857759577605776157762577635776457765577665776757768577695777057771577725777357774577755777657777577785777957780577815778257783577845778557786577875778857789577905779157792577935779457795577965779757798577995780057801578025780357804578055780657807578085780957810578115781257813578145781557816578175781857819578205782157822578235782457825578265782757828578295783057831578325783357834578355783657837578385783957840578415784257843578445784557846578475784857849578505785157852578535785457855578565785757858578595786057861578625786357864578655786657867578685786957870578715787257873578745787557876578775787857879578805788157882578835788457885578865788757888578895789057891578925789357894578955789657897578985789957900579015790257903579045790557906579075790857909579105791157912579135791457915579165791757918579195792057921579225792357924579255792657927579285792957930579315793257933579345793557936579375793857939579405794157942579435794457945579465794757948579495795057951579525795357954579555795657957579585795957960579615796257963579645796557966579675796857969579705797157972579735797457975579765797757978579795798057981579825798357984579855798657987579885798957990579915799257993579945799557996579975799857999580005800158002580035800458005580065800758008580095801058011580125801358014580155801658017580185801958020580215802258023580245802558026580275802858029580305803158032580335803458035580365803758038580395804058041580425804358044580455804658047580485804958050580515805258053580545805558056580575805858059580605806158062580635806458065580665806758068580695807058071580725807358074580755807658077580785807958080580815808258083580845808558086580875808858089580905809158092580935809458095580965809758098580995810058101581025810358104581055810658107581085810958110581115811258113581145811558116581175811858119581205812158122581235812458125581265812758128581295813058131581325813358134581355813658137581385813958140581415814258143581445814558146581475814858149581505815158152581535815458155581565815758158581595816058161581625816358164581655816658167581685816958170581715817258173581745817558176581775817858179581805818158182581835818458185581865818758188581895819058191581925819358194581955819658197581985819958200582015820258203582045820558206582075820858209582105821158212582135821458215582165821758218582195822058221582225822358224582255822658227582285822958230582315823258233582345823558236582375823858239582405824158242582435824458245582465824758248582495825058251582525825358254582555825658257582585825958260582615826258263582645826558266582675826858269582705827158272582735827458275582765827758278582795828058281582825828358284582855828658287582885828958290582915829258293582945829558296582975829858299583005830158302583035830458305583065830758308583095831058311583125831358314583155831658317583185831958320583215832258323583245832558326583275832858329583305833158332583335833458335583365833758338583395834058341583425834358344583455834658347583485834958350583515835258353583545835558356583575835858359583605836158362583635836458365583665836758368583695837058371583725837358374583755837658377583785837958380583815838258383583845838558386583875838858389583905839158392583935839458395583965839758398583995840058401584025840358404584055840658407584085840958410584115841258413584145841558416584175841858419584205842158422584235842458425584265842758428584295843058431584325843358434584355843658437584385843958440584415844258443584445844558446584475844858449584505845158452584535845458455584565845758458584595846058461584625846358464584655846658467584685846958470584715847258473584745847558476584775847858479584805848158482584835848458485584865848758488584895849058491584925849358494584955849658497584985849958500585015850258503585045850558506585075850858509585105851158512585135851458515585165851758518585195852058521585225852358524585255852658527585285852958530585315853258533585345853558536585375853858539585405854158542585435854458545585465854758548585495855058551585525855358554585555855658557585585855958560585615856258563585645856558566585675856858569585705857158572585735857458575585765857758578585795858058581585825858358584585855858658587585885858958590585915859258593585945859558596585975859858599586005860158602586035860458605586065860758608586095861058611586125861358614586155861658617586185861958620586215862258623586245862558626586275862858629586305863158632586335863458635586365863758638586395864058641586425864358644586455864658647586485864958650586515865258653586545865558656586575865858659586605866158662586635866458665586665866758668586695867058671586725867358674586755867658677586785867958680586815868258683586845868558686586875868858689586905869158692586935869458695586965869758698586995870058701587025870358704587055870658707587085870958710587115871258713587145871558716587175871858719587205872158722587235872458725587265872758728587295873058731587325873358734587355873658737587385873958740587415874258743587445874558746587475874858749587505875158752587535875458755587565875758758587595876058761587625876358764587655876658767587685876958770587715877258773587745877558776587775877858779587805878158782587835878458785587865878758788587895879058791587925879358794587955879658797587985879958800588015880258803588045880558806588075880858809588105881158812588135881458815588165881758818588195882058821588225882358824588255882658827588285882958830588315883258833588345883558836588375883858839588405884158842588435884458845588465884758848588495885058851588525885358854588555885658857588585885958860588615886258863588645886558866588675886858869588705887158872588735887458875588765887758878588795888058881588825888358884588855888658887588885888958890588915889258893588945889558896588975889858899589005890158902589035890458905589065890758908589095891058911589125891358914589155891658917589185891958920589215892258923589245892558926589275892858929589305893158932589335893458935589365893758938589395894058941589425894358944589455894658947589485894958950589515895258953589545895558956589575895858959589605896158962589635896458965589665896758968589695897058971589725897358974589755897658977589785897958980589815898258983589845898558986589875898858989589905899158992589935899458995589965899758998589995900059001590025900359004590055900659007590085900959010590115901259013590145901559016590175901859019590205902159022590235902459025590265902759028590295903059031590325903359034590355903659037590385903959040590415904259043590445904559046590475904859049590505905159052590535905459055590565905759058590595906059061590625906359064590655906659067590685906959070590715907259073590745907559076590775907859079590805908159082590835908459085590865908759088590895909059091590925909359094590955909659097590985909959100591015910259103591045910559106591075910859109591105911159112591135911459115591165911759118591195912059121591225912359124591255912659127591285912959130591315913259133591345913559136591375913859139591405914159142591435914459145591465914759148591495915059151591525915359154591555915659157591585915959160591615916259163591645916559166591675916859169591705917159172591735917459175591765917759178591795918059181591825918359184591855918659187591885918959190591915919259193591945919559196591975919859199592005920159202592035920459205592065920759208592095921059211592125921359214592155921659217592185921959220592215922259223592245922559226592275922859229592305923159232592335923459235592365923759238592395924059241592425924359244592455924659247592485924959250592515925259253592545925559256592575925859259592605926159262592635926459265592665926759268592695927059271592725927359274592755927659277592785927959280592815928259283592845928559286592875928859289592905929159292592935929459295592965929759298592995930059301593025930359304593055930659307593085930959310593115931259313593145931559316593175931859319593205932159322593235932459325593265932759328593295933059331593325933359334593355933659337593385933959340593415934259343593445934559346593475934859349593505935159352593535935459355593565935759358593595936059361593625936359364593655936659367593685936959370593715937259373593745937559376593775937859379593805938159382593835938459385593865938759388593895939059391593925939359394593955939659397593985939959400594015940259403594045940559406594075940859409594105941159412594135941459415594165941759418594195942059421594225942359424594255942659427594285942959430594315943259433594345943559436594375943859439594405944159442594435944459445594465944759448594495945059451594525945359454594555945659457594585945959460594615946259463594645946559466594675946859469594705947159472594735947459475594765947759478594795948059481594825948359484594855948659487594885948959490594915949259493594945949559496594975949859499595005950159502595035950459505595065950759508595095951059511595125951359514595155951659517595185951959520595215952259523595245952559526595275952859529595305953159532595335953459535595365953759538595395954059541595425954359544595455954659547595485954959550595515955259553595545955559556595575955859559595605956159562595635956459565595665956759568595695957059571595725957359574
  1. (function webpackUniversalModuleDefinition(root, factory) {
  2. if(typeof exports === 'object' && typeof module === 'object')
  3. module.exports = factory();
  4. else if(typeof define === 'function' && define.amd)
  5. define([], factory);
  6. else if(typeof exports === 'object')
  7. exports["ivprogCore"] = factory();
  8. else
  9. root["ivprogCore"] = factory();
  10. })(window, function() {
  11. return /******/ (function(modules) { // webpackBootstrap
  12. /******/ // The module cache
  13. /******/ var installedModules = {};
  14. /******/
  15. /******/ // The require function
  16. /******/ function __webpack_require__(moduleId) {
  17. /******/
  18. /******/ // Check if module is in cache
  19. /******/ if(installedModules[moduleId]) {
  20. /******/ return installedModules[moduleId].exports;
  21. /******/ }
  22. /******/ // Create a new module (and put it into the cache)
  23. /******/ var module = installedModules[moduleId] = {
  24. /******/ i: moduleId,
  25. /******/ l: false,
  26. /******/ exports: {}
  27. /******/ };
  28. /******/
  29. /******/ // Execute the module function
  30. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  31. /******/
  32. /******/ // Flag the module as loaded
  33. /******/ module.l = true;
  34. /******/
  35. /******/ // Return the exports of the module
  36. /******/ return module.exports;
  37. /******/ }
  38. /******/
  39. /******/
  40. /******/ // expose the modules object (__webpack_modules__)
  41. /******/ __webpack_require__.m = modules;
  42. /******/
  43. /******/ // expose the module cache
  44. /******/ __webpack_require__.c = installedModules;
  45. /******/
  46. /******/ // define getter function for harmony exports
  47. /******/ __webpack_require__.d = function(exports, name, getter) {
  48. /******/ if(!__webpack_require__.o(exports, name)) {
  49. /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
  50. /******/ }
  51. /******/ };
  52. /******/
  53. /******/ // define __esModule on exports
  54. /******/ __webpack_require__.r = function(exports) {
  55. /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  56. /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  57. /******/ }
  58. /******/ Object.defineProperty(exports, '__esModule', { value: true });
  59. /******/ };
  60. /******/
  61. /******/ // create a fake namespace object
  62. /******/ // mode & 1: value is a module id, require it
  63. /******/ // mode & 2: merge all properties of value into the ns
  64. /******/ // mode & 4: return value when already ns object
  65. /******/ // mode & 8|1: behave like require
  66. /******/ __webpack_require__.t = function(value, mode) {
  67. /******/ if(mode & 1) value = __webpack_require__(value);
  68. /******/ if(mode & 8) return value;
  69. /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
  70. /******/ var ns = Object.create(null);
  71. /******/ __webpack_require__.r(ns);
  72. /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
  73. /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
  74. /******/ return ns;
  75. /******/ };
  76. /******/
  77. /******/ // getDefaultExport function for compatibility with non-harmony modules
  78. /******/ __webpack_require__.n = function(module) {
  79. /******/ var getter = module && module.__esModule ?
  80. /******/ function getDefault() { return module['default']; } :
  81. /******/ function getModuleExports() { return module; };
  82. /******/ __webpack_require__.d(getter, 'a', getter);
  83. /******/ return getter;
  84. /******/ };
  85. /******/
  86. /******/ // Object.prototype.hasOwnProperty.call
  87. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  88. /******/
  89. /******/ // __webpack_public_path__
  90. /******/ __webpack_require__.p = "";
  91. /******/
  92. /******/
  93. /******/ // Load entry module and return exports
  94. /******/ return __webpack_require__(__webpack_require__.s = "./js/main.js");
  95. /******/ })
  96. /************************************************************************/
  97. /******/ ({
  98. /***/ "./.ima_version.json":
  99. /*!***************************!*\
  100. !*** ./.ima_version.json ***!
  101. \***************************/
  102. /*! exports provided: version, default */
  103. /***/ (function(module) {
  104. module.exports = {"version":"2019_03_01 13_44"};
  105. /***/ }),
  106. /***/ "./grammar/en/ivprog.g4":
  107. /*!******************************!*\
  108. !*** ./grammar/en/ivprog.g4 ***!
  109. \******************************/
  110. /*! no static exports found */
  111. /***/ (function(module, exports, __webpack_require__) {
  112. module.exports =
  113. /******/ (function(modules) { // webpackBootstrap
  114. /******/ // The module cache
  115. /******/ var installedModules = {};
  116. /******/
  117. /******/ // The require function
  118. /******/ function __webpack_require__(moduleId) {
  119. /******/
  120. /******/ // Check if module is in cache
  121. /******/ if(installedModules[moduleId]) {
  122. /******/ return installedModules[moduleId].exports;
  123. /******/ }
  124. /******/ // Create a new module (and put it into the cache)
  125. /******/ var module = installedModules[moduleId] = {
  126. /******/ i: moduleId,
  127. /******/ l: false,
  128. /******/ exports: {}
  129. /******/ };
  130. /******/
  131. /******/ // Execute the module function
  132. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  133. /******/
  134. /******/ // Flag the module as loaded
  135. /******/ module.l = true;
  136. /******/
  137. /******/ // Return the exports of the module
  138. /******/ return module.exports;
  139. /******/ }
  140. /******/
  141. /******/
  142. /******/ // expose the modules object (__webpack_modules__)
  143. /******/ __webpack_require__.m = modules;
  144. /******/
  145. /******/ // expose the module cache
  146. /******/ __webpack_require__.c = installedModules;
  147. /******/
  148. /******/ // identity function for calling harmony imports with the correct context
  149. /******/ __webpack_require__.i = function(value) { return value; };
  150. /******/
  151. /******/ // define getter function for harmony exports
  152. /******/ __webpack_require__.d = function(exports, name, getter) {
  153. /******/ if(!__webpack_require__.o(exports, name)) {
  154. /******/ Object.defineProperty(exports, name, {
  155. /******/ configurable: false,
  156. /******/ enumerable: true,
  157. /******/ get: getter
  158. /******/ });
  159. /******/ }
  160. /******/ };
  161. /******/
  162. /******/ // getDefaultExport function for compatibility with non-harmony modules
  163. /******/ __webpack_require__.n = function(module) {
  164. /******/ var getter = module && module.__esModule ?
  165. /******/ function getDefault() { return module['default']; } :
  166. /******/ function getModuleExports() { return module; };
  167. /******/ __webpack_require__.d(getter, 'a', getter);
  168. /******/ return getter;
  169. /******/ };
  170. /******/
  171. /******/ // Object.prototype.hasOwnProperty.call
  172. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  173. /******/
  174. /******/ // __webpack_public_path__
  175. /******/ __webpack_require__.p = "";
  176. /******/
  177. /******/ // Load entry module and return exports
  178. /******/ return __webpack_require__(__webpack_require__.s = 1);
  179. /******/ })
  180. /************************************************************************/
  181. /******/ ([
  182. /* 0 */
  183. /***/ (function(module, exports, __webpack_require__) {
  184. // Generated from /tmp/tmp-8968Xo5t2xDXm8hW/ivprog.g4 by ANTLR 4.7
  185. // jshint ignore: start
  186. var antlr4 = __webpack_require__(2);
  187. var serializedATN = ["\u0003\u608b\ua72a\u8133\ub9ed\u417c\u3be7\u7786\u5964",
  188. "\u0002/\u01d1\b\u0001\u0004\u0002\t\u0002\u0004\u0003\t\u0003\u0004",
  189. "\u0004\t\u0004\u0004\u0005\t\u0005\u0004\u0006\t\u0006\u0004\u0007\t",
  190. "\u0007\u0004\b\t\b\u0004\t\t\t\u0004\n\t\n\u0004\u000b\t\u000b\u0004",
  191. "\f\t\f\u0004\r\t\r\u0004\u000e\t\u000e\u0004\u000f\t\u000f\u0004\u0010",
  192. "\t\u0010\u0004\u0011\t\u0011\u0004\u0012\t\u0012\u0004\u0013\t\u0013",
  193. "\u0004\u0014\t\u0014\u0004\u0015\t\u0015\u0004\u0016\t\u0016\u0004\u0017",
  194. "\t\u0017\u0004\u0018\t\u0018\u0004\u0019\t\u0019\u0004\u001a\t\u001a",
  195. "\u0004\u001b\t\u001b\u0004\u001c\t\u001c\u0004\u001d\t\u001d\u0004\u001e",
  196. "\t\u001e\u0004\u001f\t\u001f\u0004 \t \u0004!\t!\u0004\"\t\"\u0004#",
  197. "\t#\u0004$\t$\u0004%\t%\u0004&\t&\u0004\'\t\'\u0004(\t(\u0004)\t)\u0004",
  198. "*\t*\u0004+\t+\u0004,\t,\u0004-\t-\u0004.\t.\u0004/\t/\u00040\t0\u0004",
  199. "1\t1\u00042\t2\u00043\t3\u00044\t4\u00045\t5\u00046\t6\u00047\t7\u0004",
  200. "8\t8\u00049\t9\u0003\u0002\u0003\u0002\u0003\u0002\u0003\u0002\u0003",
  201. "\u0002\u0003\u0002\u0003\u0002\u0003\u0002\u0003\u0003\u0003\u0003\u0003",
  202. "\u0003\u0003\u0003\u0003\u0003\u0003\u0004\u0003\u0004\u0003\u0004\u0003",
  203. "\u0004\u0003\u0004\u0003\u0005\u0003\u0005\u0003\u0005\u0003\u0005\u0003",
  204. "\u0005\u0003\u0005\u0003\u0005\u0003\u0005\u0003\u0006\u0003\u0006\u0003",
  205. "\u0006\u0003\u0006\u0003\u0006\u0003\u0006\u0003\u0006\u0003\u0007\u0003",
  206. "\u0007\u0003\u0007\u0003\u0007\u0003\u0007\u0003\u0007\u0003\u0007\u0003",
  207. "\u0007\u0003\b\u0003\b\u0003\b\u0003\b\u0003\b\u0003\b\u0003\b\u0003",
  208. "\b\u0003\b\u0003\b\u0003\t\u0003\t\u0003\t\u0003\t\u0003\t\u0003\t\u0003",
  209. "\t\u0003\n\u0003\n\u0003\n\u0003\n\u0003\n\u0003\u000b\u0003\u000b\u0003",
  210. "\u000b\u0003\u000b\u0003\u000b\u0003\u000b\u0003\u000b\u0003\u000b\u0003",
  211. "\u000b\u0003\u000b\u0003\f\u0003\f\u0003\f\u0003\f\u0003\f\u0003\f\u0003",
  212. "\r\u0003\r\u0003\r\u0003\r\u0003\r\u0003\r\u0003\r\u0003\r\u0003\r\u0003",
  213. "\u000e\u0003\u000e\u0003\u000e\u0003\u000e\u0003\u000e\u0003\u000e\u0003",
  214. "\u000e\u0003\u000f\u0003\u000f\u0003\u000f\u0003\u000f\u0003\u0010\u0003",
  215. "\u0010\u0003\u0010\u0003\u0010\u0003\u0010\u0003\u0010\u0003\u0011\u0003",
  216. "\u0011\u0003\u0011\u0003\u0012\u0003\u0012\u0003\u0012\u0003\u0012\u0003",
  217. "\u0012\u0003\u0012\u0003\u0013\u0003\u0013\u0003\u0013\u0003\u0014\u0003",
  218. "\u0014\u0003\u0014\u0003\u0014\u0003\u0014\u0003\u0015\u0003\u0015\u0003",
  219. "\u0015\u0003\u0015\u0003\u0015\u0003\u0015\u0003\u0016\u0003\u0016\u0003",
  220. "\u0016\u0003\u0016\u0003\u0016\u0003\u0017\u0003\u0017\u0003\u0017\u0003",
  221. "\u0017\u0003\u0018\u0003\u0018\u0003\u0018\u0003\u0018\u0003\u0019\u0003",
  222. "\u0019\u0003\u0019\u0003\u001a\u0003\u001a\u0003\u001b\u0003\u001b\u0003",
  223. "\u001c\u0003\u001c\u0003\u001d\u0003\u001d\u0003\u001e\u0003\u001e\u0003",
  224. "\u001f\u0003\u001f\u0003 \u0003 \u0003!\u0003!\u0003\"\u0003\"\u0003",
  225. "#\u0003#\u0003$\u0003$\u0003%\u0003%\u0003&\u0003&\u0003&\u0003&\u0003",
  226. "&\u0003&\u0003&\u0003&\u0003&\u0005&\u0125\n&\u0003\'\u0003\'\u0003",
  227. "(\u0003(\u0003)\u0003)\u0007)\u012d\n)\f)\u000e)\u0130\u000b)\u0003",
  228. "*\u0003*\u0003*\u0003*\u0003+\u0006+\u0137\n+\r+\u000e+\u0138\u0003",
  229. "+\u0003+\u0003+\u0003+\u0005+\u013f\n+\u0003+\u0006+\u0142\n+\r+\u000e",
  230. "+\u0143\u0003+\u0003+\u0003+\u0003+\u0005+\u014a\n+\u0003+\u0006+\u014d",
  231. "\n+\r+\u000e+\u014e\u0005+\u0151\n+\u0003,\u0006,\u0154\n,\r,\u000e",
  232. ",\u0155\u0003,\u0003,\u0006,\u015a\n,\r,\u000e,\u015b\u0003,\u0006,",
  233. "\u015f\n,\r,\u000e,\u0160\u0003,\u0003,\u0007,\u0165\n,\f,\u000e,\u0168",
  234. "\u000b,\u0003,\u0005,\u016b\n,\u0003-\u0003-\u0005-\u016f\n-\u0003-",
  235. "\u0006-\u0172\n-\r-\u000e-\u0173\u0003.\u0003.\u0007.\u0178\n.\f.\u000e",
  236. ".\u017b\u000b.\u0003.\u0003.\u0003/\u0003/\u0005/\u0181\n/\u00030\u0003",
  237. "0\u00030\u00050\u0186\n0\u00030\u00030\u00031\u00031\u00031\u00031\u0003",
  238. "2\u00032\u00033\u00063\u0191\n3\r3\u000e3\u0192\u00033\u00053\u0196",
  239. "\n3\u00034\u00034\u00035\u00035\u00036\u00036\u00036\u00036\u00056\u01a0",
  240. "\n6\u00037\u00037\u00037\u00037\u00037\u00037\u00037\u00037\u00037\u0003",
  241. "7\u00037\u00057\u01ad\n7\u00038\u00038\u00038\u00038\u00038\u00038\u0003",
  242. "8\u00039\u00039\u00039\u00039\u00079\u01ba\n9\f9\u000e9\u01bd\u000b",
  243. "9\u00039\u00059\u01c0\n9\u00039\u00039\u00039\u00039\u00039\u00079\u01c7",
  244. "\n9\f9\u000e9\u01ca\u000b9\u00039\u00039\u00059\u01ce\n9\u00039\u0003",
  245. "9\u0003\u01c8\u0002:\u0003\u0003\u0005\u0004\u0007\u0005\t\u0006\u000b",
  246. "\u0007\r\b\u000f\t\u0011\n\u0013\u000b\u0015\f\u0017\r\u0019\u000e\u001b",
  247. "\u000f\u001d\u0010\u001f\u0011!\u0012#\u0013%\u0014\'\u0015)\u0016+",
  248. "\u0017-\u0002/\u00021\u00023\u00185\u00197\u001a9\u001b;\u001c=\u001d",
  249. "?\u001eA\u001fC E!G\"I#K$M%O&Q\'S(U)W*Y\u0002[+]\u0002_,a-c\u0002e.",
  250. "g\u0002i\u0002k\u0002m\u0002o\u0002q/\u0003\u0002\u0012\u0004\u0002",
  251. "--//\u0005\u0002\'\',,11\u0004\u0002>>@@\u0005\u0002C\\aac|\u0006\u0002",
  252. "2;C\\aac|\u0003\u00022;\u0003\u000223\u0004\u0002GGgg\u0006\u0002\f",
  253. "\f\u000f\u000f$$^^\u0006\u0002\f\f\u000f\u000f))^^\u0004\u0002\u000b",
  254. "\u000b\"\"\u0004\u0002\f\f\u000f\u000f\u0005\u00022;CHch\u0003\u0002",
  255. "29\n\u0002$$))^^ddhhppttvv\u0003\u000225\u0002\u01e5\u0002\u0003\u0003",
  256. "\u0002\u0002\u0002\u0002\u0005\u0003\u0002\u0002\u0002\u0002\u0007\u0003",
  257. "\u0002\u0002\u0002\u0002\t\u0003\u0002\u0002\u0002\u0002\u000b\u0003",
  258. "\u0002\u0002\u0002\u0002\r\u0003\u0002\u0002\u0002\u0002\u000f\u0003",
  259. "\u0002\u0002\u0002\u0002\u0011\u0003\u0002\u0002\u0002\u0002\u0013\u0003",
  260. "\u0002\u0002\u0002\u0002\u0015\u0003\u0002\u0002\u0002\u0002\u0017\u0003",
  261. "\u0002\u0002\u0002\u0002\u0019\u0003\u0002\u0002\u0002\u0002\u001b\u0003",
  262. "\u0002\u0002\u0002\u0002\u001d\u0003\u0002\u0002\u0002\u0002\u001f\u0003",
  263. "\u0002\u0002\u0002\u0002!\u0003\u0002\u0002\u0002\u0002#\u0003\u0002",
  264. "\u0002\u0002\u0002%\u0003\u0002\u0002\u0002\u0002\'\u0003\u0002\u0002",
  265. "\u0002\u0002)\u0003\u0002\u0002\u0002\u0002+\u0003\u0002\u0002\u0002",
  266. "\u00023\u0003\u0002\u0002\u0002\u00025\u0003\u0002\u0002\u0002\u0002",
  267. "7\u0003\u0002\u0002\u0002\u00029\u0003\u0002\u0002\u0002\u0002;\u0003",
  268. "\u0002\u0002\u0002\u0002=\u0003\u0002\u0002\u0002\u0002?\u0003\u0002",
  269. "\u0002\u0002\u0002A\u0003\u0002\u0002\u0002\u0002C\u0003\u0002\u0002",
  270. "\u0002\u0002E\u0003\u0002\u0002\u0002\u0002G\u0003\u0002\u0002\u0002",
  271. "\u0002I\u0003\u0002\u0002\u0002\u0002K\u0003\u0002\u0002\u0002\u0002",
  272. "M\u0003\u0002\u0002\u0002\u0002O\u0003\u0002\u0002\u0002\u0002Q\u0003",
  273. "\u0002\u0002\u0002\u0002S\u0003\u0002\u0002\u0002\u0002U\u0003\u0002",
  274. "\u0002\u0002\u0002W\u0003\u0002\u0002\u0002\u0002[\u0003\u0002\u0002",
  275. "\u0002\u0002_\u0003\u0002\u0002\u0002\u0002a\u0003\u0002\u0002\u0002",
  276. "\u0002e\u0003\u0002\u0002\u0002\u0002q\u0003\u0002\u0002\u0002\u0003",
  277. "s\u0003\u0002\u0002\u0002\u0005{\u0003\u0002\u0002\u0002\u0007\u0080",
  278. "\u0003\u0002\u0002\u0002\t\u0085\u0003\u0002\u0002\u0002\u000b\u008d",
  279. "\u0003\u0002\u0002\u0002\r\u0094\u0003\u0002\u0002\u0002\u000f\u009c",
  280. "\u0003\u0002\u0002\u0002\u0011\u00a6\u0003\u0002\u0002\u0002\u0013\u00ad",
  281. "\u0003\u0002\u0002\u0002\u0015\u00b2\u0003\u0002\u0002\u0002\u0017\u00bc",
  282. "\u0003\u0002\u0002\u0002\u0019\u00c2\u0003\u0002\u0002\u0002\u001b\u00cb",
  283. "\u0003\u0002\u0002\u0002\u001d\u00d2\u0003\u0002\u0002\u0002\u001f\u00d6",
  284. "\u0003\u0002\u0002\u0002!\u00dc\u0003\u0002\u0002\u0002#\u00df\u0003",
  285. "\u0002\u0002\u0002%\u00e5\u0003\u0002\u0002\u0002\'\u00e8\u0003\u0002",
  286. "\u0002\u0002)\u00ed\u0003\u0002\u0002\u0002+\u00f3\u0003\u0002\u0002",
  287. "\u0002-\u00f8\u0003\u0002\u0002\u0002/\u00fc\u0003\u0002\u0002\u0002",
  288. "1\u0100\u0003\u0002\u0002\u00023\u0103\u0003\u0002\u0002\u00025\u0105",
  289. "\u0003\u0002\u0002\u00027\u0107\u0003\u0002\u0002\u00029\u0109\u0003",
  290. "\u0002\u0002\u0002;\u010b\u0003\u0002\u0002\u0002=\u010d\u0003\u0002",
  291. "\u0002\u0002?\u010f\u0003\u0002\u0002\u0002A\u0111\u0003\u0002\u0002",
  292. "\u0002C\u0113\u0003\u0002\u0002\u0002E\u0115\u0003\u0002\u0002\u0002",
  293. "G\u0117\u0003\u0002\u0002\u0002I\u0119\u0003\u0002\u0002\u0002K\u0124",
  294. "\u0003\u0002\u0002\u0002M\u0126\u0003\u0002\u0002\u0002O\u0128\u0003",
  295. "\u0002\u0002\u0002Q\u012a\u0003\u0002\u0002\u0002S\u0131\u0003\u0002",
  296. "\u0002\u0002U\u0150\u0003\u0002\u0002\u0002W\u016a\u0003\u0002\u0002",
  297. "\u0002Y\u016c\u0003\u0002\u0002\u0002[\u0175\u0003\u0002\u0002\u0002",
  298. "]\u0180\u0003\u0002\u0002\u0002_\u0182\u0003\u0002\u0002\u0002a\u0189",
  299. "\u0003\u0002\u0002\u0002c\u018d\u0003\u0002\u0002\u0002e\u0195\u0003",
  300. "\u0002\u0002\u0002g\u0197\u0003\u0002\u0002\u0002i\u0199\u0003\u0002",
  301. "\u0002\u0002k\u019f\u0003\u0002\u0002\u0002m\u01ac\u0003\u0002\u0002",
  302. "\u0002o\u01ae\u0003\u0002\u0002\u0002q\u01cd\u0003\u0002\u0002\u0002",
  303. "st\u0007r\u0002\u0002tu\u0007t\u0002\u0002uv\u0007q\u0002\u0002vw\u0007",
  304. "i\u0002\u0002wx\u0007t\u0002\u0002xy\u0007c\u0002\u0002yz\u0007o\u0002",
  305. "\u0002z\u0004\u0003\u0002\u0002\u0002{|\u0007t\u0002\u0002|}\u0007g",
  306. "\u0002\u0002}~\u0007c\u0002\u0002~\u007f\u0007n\u0002\u0002\u007f\u0006",
  307. "\u0003\u0002\u0002\u0002\u0080\u0081\u0007x\u0002\u0002\u0081\u0082",
  308. "\u0007q\u0002\u0002\u0082\u0083\u0007k\u0002\u0002\u0083\u0084\u0007",
  309. "f\u0002\u0002\u0084\b\u0003\u0002\u0002\u0002\u0085\u0086\u0007d\u0002",
  310. "\u0002\u0086\u0087\u0007q\u0002\u0002\u0087\u0088\u0007q\u0002\u0002",
  311. "\u0088\u0089\u0007n\u0002\u0002\u0089\u008a\u0007g\u0002\u0002\u008a",
  312. "\u008b\u0007c\u0002\u0002\u008b\u008c\u0007p\u0002\u0002\u008c\n\u0003",
  313. "\u0002\u0002\u0002\u008d\u008e\u0007u\u0002\u0002\u008e\u008f\u0007",
  314. "v\u0002\u0002\u008f\u0090\u0007t\u0002\u0002\u0090\u0091\u0007k\u0002",
  315. "\u0002\u0091\u0092\u0007p\u0002\u0002\u0092\u0093\u0007i\u0002\u0002",
  316. "\u0093\f\u0003\u0002\u0002\u0002\u0094\u0095\u0007k\u0002\u0002\u0095",
  317. "\u0096\u0007p\u0002\u0002\u0096\u0097\u0007v\u0002\u0002\u0097\u0098",
  318. "\u0007g\u0002\u0002\u0098\u0099\u0007i\u0002\u0002\u0099\u009a\u0007",
  319. "g\u0002\u0002\u009a\u009b\u0007t\u0002\u0002\u009b\u000e\u0003\u0002",
  320. "\u0002\u0002\u009c\u009d\u0007e\u0002\u0002\u009d\u009e\u0007j\u0002",
  321. "\u0002\u009e\u009f\u0007c\u0002\u0002\u009f\u00a0\u0007t\u0002\u0002",
  322. "\u00a0\u00a1\u0007c\u0002\u0002\u00a1\u00a2\u0007e\u0002\u0002\u00a2",
  323. "\u00a3\u0007v\u0002\u0002\u00a3\u00a4\u0007g\u0002\u0002\u00a4\u00a5",
  324. "\u0007t\u0002\u0002\u00a5\u0010\u0003\u0002\u0002\u0002\u00a6\u00a7",
  325. "\u0007u\u0002\u0002\u00a7\u00a8\u0007y\u0002\u0002\u00a8\u00a9\u0007",
  326. "k\u0002\u0002\u00a9\u00aa\u0007v\u0002\u0002\u00aa\u00ab\u0007e\u0002",
  327. "\u0002\u00ab\u00ac\u0007j\u0002\u0002\u00ac\u0012\u0003\u0002\u0002",
  328. "\u0002\u00ad\u00ae\u0007e\u0002\u0002\u00ae\u00af\u0007c\u0002\u0002",
  329. "\u00af\u00b0\u0007u\u0002\u0002\u00b0\u00b1\u0007g\u0002\u0002\u00b1",
  330. "\u0014\u0003\u0002\u0002\u0002\u00b2\u00b3\u0007q\u0002\u0002\u00b3",
  331. "\u00b4\u0007v\u0002\u0002\u00b4\u00b5\u0007j\u0002\u0002\u00b5\u00b6",
  332. "\u0007g\u0002\u0002\u00b6\u00b7\u0007t\u0002\u0002\u00b7\u00b8\u0007",
  333. "y\u0002\u0002\u00b8\u00b9\u0007k\u0002\u0002\u00b9\u00ba\u0007u\u0002",
  334. "\u0002\u00ba\u00bb\u0007g\u0002\u0002\u00bb\u0016\u0003\u0002\u0002",
  335. "\u0002\u00bc\u00bd\u0007e\u0002\u0002\u00bd\u00be\u0007q\u0002\u0002",
  336. "\u00be\u00bf\u0007p\u0002\u0002\u00bf\u00c0\u0007u\u0002\u0002\u00c0",
  337. "\u00c1\u0007v\u0002\u0002\u00c1\u0018\u0003\u0002\u0002\u0002\u00c2",
  338. "\u00c3\u0007h\u0002\u0002\u00c3\u00c4\u0007w\u0002\u0002\u00c4\u00c5",
  339. "\u0007p\u0002\u0002\u00c5\u00c6\u0007e\u0002\u0002\u00c6\u00c7\u0007",
  340. "v\u0002\u0002\u00c7\u00c8\u0007k\u0002\u0002\u00c8\u00c9\u0007q\u0002",
  341. "\u0002\u00c9\u00ca\u0007p\u0002\u0002\u00ca\u001a\u0003\u0002\u0002",
  342. "\u0002\u00cb\u00cc\u0007t\u0002\u0002\u00cc\u00cd\u0007g\u0002\u0002",
  343. "\u00cd\u00ce\u0007v\u0002\u0002\u00ce\u00cf\u0007w\u0002\u0002\u00cf",
  344. "\u00d0\u0007t\u0002\u0002\u00d0\u00d1\u0007p\u0002\u0002\u00d1\u001c",
  345. "\u0003\u0002\u0002\u0002\u00d2\u00d3\u0007h\u0002\u0002\u00d3\u00d4",
  346. "\u0007q\u0002\u0002\u00d4\u00d5\u0007t\u0002\u0002\u00d5\u001e\u0003",
  347. "\u0002\u0002\u0002\u00d6\u00d7\u0007d\u0002\u0002\u00d7\u00d8\u0007",
  348. "t\u0002\u0002\u00d8\u00d9\u0007g\u0002\u0002\u00d9\u00da\u0007c\u0002",
  349. "\u0002\u00da\u00db\u0007m\u0002\u0002\u00db \u0003\u0002\u0002\u0002",
  350. "\u00dc\u00dd\u0007f\u0002\u0002\u00dd\u00de\u0007q\u0002\u0002\u00de",
  351. "\"\u0003\u0002\u0002\u0002\u00df\u00e0\u0007y\u0002\u0002\u00e0\u00e1",
  352. "\u0007j\u0002\u0002\u00e1\u00e2\u0007k\u0002\u0002\u00e2\u00e3\u0007",
  353. "n\u0002\u0002\u00e3\u00e4\u0007g\u0002\u0002\u00e4$\u0003\u0002\u0002",
  354. "\u0002\u00e5\u00e6\u0007k\u0002\u0002\u00e6\u00e7\u0007h\u0002\u0002",
  355. "\u00e7&\u0003\u0002\u0002\u0002\u00e8\u00e9\u0007g\u0002\u0002\u00e9",
  356. "\u00ea\u0007n\u0002\u0002\u00ea\u00eb\u0007u\u0002\u0002\u00eb\u00ec",
  357. "\u0007g\u0002\u0002\u00ec(\u0003\u0002\u0002\u0002\u00ed\u00ee\u0007",
  358. "h\u0002\u0002\u00ee\u00ef\u0007c\u0002\u0002\u00ef\u00f0\u0007n\u0002",
  359. "\u0002\u00f0\u00f1\u0007u\u0002\u0002\u00f1\u00f2\u0007g\u0002\u0002",
  360. "\u00f2*\u0003\u0002\u0002\u0002\u00f3\u00f4\u0007v\u0002\u0002\u00f4",
  361. "\u00f5\u0007t\u0002\u0002\u00f5\u00f6\u0007w\u0002\u0002\u00f6\u00f7",
  362. "\u0007g\u0002\u0002\u00f7,\u0003\u0002\u0002\u0002\u00f8\u00f9\u0007",
  363. "p\u0002\u0002\u00f9\u00fa\u0007q\u0002\u0002\u00fa\u00fb\u0007v\u0002",
  364. "\u0002\u00fb.\u0003\u0002\u0002\u0002\u00fc\u00fd\u0007C\u0002\u0002",
  365. "\u00fd\u00fe\u0007P\u0002\u0002\u00fe\u00ff\u0007F\u0002\u0002\u00ff",
  366. "0\u0003\u0002\u0002\u0002\u0100\u0101\u0007Q\u0002\u0002\u0101\u0102",
  367. "\u0007T\u0002\u0002\u01022\u0003\u0002\u0002\u0002\u0103\u0104\u0007",
  368. "*\u0002\u0002\u01044\u0003\u0002\u0002\u0002\u0105\u0106\u0007+\u0002",
  369. "\u0002\u01066\u0003\u0002\u0002\u0002\u0107\u0108\u0007]\u0002\u0002",
  370. "\u01088\u0003\u0002\u0002\u0002\u0109\u010a\u0007_\u0002\u0002\u010a",
  371. ":\u0003\u0002\u0002\u0002\u010b\u010c\u0007}\u0002\u0002\u010c<\u0003",
  372. "\u0002\u0002\u0002\u010d\u010e\u0007\u007f\u0002\u0002\u010e>\u0003",
  373. "\u0002\u0002\u0002\u010f\u0110\u0007.\u0002\u0002\u0110@\u0003\u0002",
  374. "\u0002\u0002\u0111\u0112\u0007?\u0002\u0002\u0112B\u0003\u0002\u0002",
  375. "\u0002\u0113\u0114\t\u0002\u0002\u0002\u0114D\u0003\u0002\u0002\u0002",
  376. "\u0115\u0116\t\u0003\u0002\u0002\u0116F\u0003\u0002\u0002\u0002\u0117",
  377. "\u0118\u0005/\u0018\u0002\u0118H\u0003\u0002\u0002\u0002\u0119\u011a",
  378. "\u00051\u0019\u0002\u011aJ\u0003\u0002\u0002\u0002\u011b\u011c\u0007",
  379. "@\u0002\u0002\u011c\u0125\u0007?\u0002\u0002\u011d\u011e\u0007?\u0002",
  380. "\u0002\u011e\u0125\u0007?\u0002\u0002\u011f\u0120\u0007>\u0002\u0002",
  381. "\u0120\u0125\u0007?\u0002\u0002\u0121\u0125\t\u0004\u0002\u0002\u0122",
  382. "\u0123\u0007#\u0002\u0002\u0123\u0125\u0007?\u0002\u0002\u0124\u011b",
  383. "\u0003\u0002\u0002\u0002\u0124\u011d\u0003\u0002\u0002\u0002\u0124\u011f",
  384. "\u0003\u0002\u0002\u0002\u0124\u0121\u0003\u0002\u0002\u0002\u0124\u0122",
  385. "\u0003\u0002\u0002\u0002\u0125L\u0003\u0002\u0002\u0002\u0126\u0127",
  386. "\u0007<\u0002\u0002\u0127N\u0003\u0002\u0002\u0002\u0128\u0129\u0005",
  387. "-\u0017\u0002\u0129P\u0003\u0002\u0002\u0002\u012a\u012e\t\u0005\u0002",
  388. "\u0002\u012b\u012d\t\u0006\u0002\u0002\u012c\u012b\u0003\u0002\u0002",
  389. "\u0002\u012d\u0130\u0003\u0002\u0002\u0002\u012e\u012c\u0003\u0002\u0002",
  390. "\u0002\u012e\u012f\u0003\u0002\u0002\u0002\u012fR\u0003\u0002\u0002",
  391. "\u0002\u0130\u012e\u0003\u0002\u0002\u0002\u0131\u0132\u0005Q)\u0002",
  392. "\u0132\u0133\u00070\u0002\u0002\u0133\u0134\u0005Q)\u0002\u0134T\u0003",
  393. "\u0002\u0002\u0002\u0135\u0137\t\u0007\u0002\u0002\u0136\u0135\u0003",
  394. "\u0002\u0002\u0002\u0137\u0138\u0003\u0002\u0002\u0002\u0138\u0136\u0003",
  395. "\u0002\u0002\u0002\u0138\u0139\u0003\u0002\u0002\u0002\u0139\u0151\u0003",
  396. "\u0002\u0002\u0002\u013a\u013b\u00072\u0002\u0002\u013b\u013f\u0007",
  397. "z\u0002\u0002\u013c\u013d\u00072\u0002\u0002\u013d\u013f\u0007Z\u0002",
  398. "\u0002\u013e\u013a\u0003\u0002\u0002\u0002\u013e\u013c\u0003\u0002\u0002",
  399. "\u0002\u013f\u0141\u0003\u0002\u0002\u0002\u0140\u0142\u0005g4\u0002",
  400. "\u0141\u0140\u0003\u0002\u0002\u0002\u0142\u0143\u0003\u0002\u0002\u0002",
  401. "\u0143\u0141\u0003\u0002\u0002\u0002\u0143\u0144\u0003\u0002\u0002\u0002",
  402. "\u0144\u0151\u0003\u0002\u0002\u0002\u0145\u0146\u00072\u0002\u0002",
  403. "\u0146\u014a\u0007d\u0002\u0002\u0147\u0148\u00072\u0002\u0002\u0148",
  404. "\u014a\u0007D\u0002\u0002\u0149\u0145\u0003\u0002\u0002\u0002\u0149",
  405. "\u0147\u0003\u0002\u0002\u0002\u014a\u014c\u0003\u0002\u0002\u0002\u014b",
  406. "\u014d\t\b\u0002\u0002\u014c\u014b\u0003\u0002\u0002\u0002\u014d\u014e",
  407. "\u0003\u0002\u0002\u0002\u014e\u014c\u0003\u0002\u0002\u0002\u014e\u014f",
  408. "\u0003\u0002\u0002\u0002\u014f\u0151\u0003\u0002\u0002\u0002\u0150\u0136",
  409. "\u0003\u0002\u0002\u0002\u0150\u013e\u0003\u0002\u0002\u0002\u0150\u0149",
  410. "\u0003\u0002\u0002\u0002\u0151V\u0003\u0002\u0002\u0002\u0152\u0154",
  411. "\t\u0007\u0002\u0002\u0153\u0152\u0003\u0002\u0002\u0002\u0154\u0155",
  412. "\u0003\u0002\u0002\u0002\u0155\u0153\u0003\u0002\u0002\u0002\u0155\u0156",
  413. "\u0003\u0002\u0002\u0002\u0156\u0157\u0003\u0002\u0002\u0002\u0157\u0159",
  414. "\u00070\u0002\u0002\u0158\u015a\t\u0007\u0002\u0002\u0159\u0158\u0003",
  415. "\u0002\u0002\u0002\u015a\u015b\u0003\u0002\u0002\u0002\u015b\u0159\u0003",
  416. "\u0002\u0002\u0002\u015b\u015c\u0003\u0002\u0002\u0002\u015c\u016b\u0003",
  417. "\u0002\u0002\u0002\u015d\u015f\t\u0007\u0002\u0002\u015e\u015d\u0003",
  418. "\u0002\u0002\u0002\u015f\u0160\u0003\u0002\u0002\u0002\u0160\u015e\u0003",
  419. "\u0002\u0002\u0002\u0160\u0161\u0003\u0002\u0002\u0002\u0161\u0162\u0003",
  420. "\u0002\u0002\u0002\u0162\u0166\u00070\u0002\u0002\u0163\u0165\t\u0007",
  421. "\u0002\u0002\u0164\u0163\u0003\u0002\u0002\u0002\u0165\u0168\u0003\u0002",
  422. "\u0002\u0002\u0166\u0164\u0003\u0002\u0002\u0002\u0166\u0167\u0003\u0002",
  423. "\u0002\u0002\u0167\u0169\u0003\u0002\u0002\u0002\u0168\u0166\u0003\u0002",
  424. "\u0002\u0002\u0169\u016b\u0005Y-\u0002\u016a\u0153\u0003\u0002\u0002",
  425. "\u0002\u016a\u015e\u0003\u0002\u0002\u0002\u016bX\u0003\u0002\u0002",
  426. "\u0002\u016c\u016e\t\t\u0002\u0002\u016d\u016f\t\u0002\u0002\u0002\u016e",
  427. "\u016d\u0003\u0002\u0002\u0002\u016e\u016f\u0003\u0002\u0002\u0002\u016f",
  428. "\u0171\u0003\u0002\u0002\u0002\u0170\u0172\t\u0007\u0002\u0002\u0171",
  429. "\u0170\u0003\u0002\u0002\u0002\u0172\u0173\u0003\u0002\u0002\u0002\u0173",
  430. "\u0171\u0003\u0002\u0002\u0002\u0173\u0174\u0003\u0002\u0002\u0002\u0174",
  431. "Z\u0003\u0002\u0002\u0002\u0175\u0179\u0007$\u0002\u0002\u0176\u0178",
  432. "\u0005]/\u0002\u0177\u0176\u0003\u0002\u0002\u0002\u0178\u017b\u0003",
  433. "\u0002\u0002\u0002\u0179\u0177\u0003\u0002\u0002\u0002\u0179\u017a\u0003",
  434. "\u0002\u0002\u0002\u017a\u017c\u0003\u0002\u0002\u0002\u017b\u0179\u0003",
  435. "\u0002\u0002\u0002\u017c\u017d\u0007$\u0002\u0002\u017d\\\u0003\u0002",
  436. "\u0002\u0002\u017e\u0181\n\n\u0002\u0002\u017f\u0181\u0005k6\u0002\u0180",
  437. "\u017e\u0003\u0002\u0002\u0002\u0180\u017f\u0003\u0002\u0002\u0002\u0181",
  438. "^\u0003\u0002\u0002\u0002\u0182\u0185\u0007)\u0002\u0002\u0183\u0186",
  439. "\u0005k6\u0002\u0184\u0186\n\u000b\u0002\u0002\u0185\u0183\u0003\u0002",
  440. "\u0002\u0002\u0185\u0184\u0003\u0002\u0002\u0002\u0186\u0187\u0003\u0002",
  441. "\u0002\u0002\u0187\u0188\u0007)\u0002\u0002\u0188`\u0003\u0002\u0002",
  442. "\u0002\u0189\u018a\t\f\u0002\u0002\u018a\u018b\u0003\u0002\u0002\u0002",
  443. "\u018b\u018c\b1\u0002\u0002\u018cb\u0003\u0002\u0002\u0002\u018d\u018e",
  444. "\u0007=\u0002\u0002\u018ed\u0003\u0002\u0002\u0002\u018f\u0191\t\r\u0002",
  445. "\u0002\u0190\u018f\u0003\u0002\u0002\u0002\u0191\u0192\u0003\u0002\u0002",
  446. "\u0002\u0192\u0190\u0003\u0002\u0002\u0002\u0192\u0193\u0003\u0002\u0002",
  447. "\u0002\u0193\u0196\u0003\u0002\u0002\u0002\u0194\u0196\u0005c2\u0002",
  448. "\u0195\u0190\u0003\u0002\u0002\u0002\u0195\u0194\u0003\u0002\u0002\u0002",
  449. "\u0196f\u0003\u0002\u0002\u0002\u0197\u0198\t\u000e\u0002\u0002\u0198",
  450. "h\u0003\u0002\u0002\u0002\u0199\u019a\t\u000f\u0002\u0002\u019aj\u0003",
  451. "\u0002\u0002\u0002\u019b\u019c\u0007^\u0002\u0002\u019c\u01a0\t\u0010",
  452. "\u0002\u0002\u019d\u01a0\u0005o8\u0002\u019e\u01a0\u0005m7\u0002\u019f",
  453. "\u019b\u0003\u0002\u0002\u0002\u019f\u019d\u0003\u0002\u0002\u0002\u019f",
  454. "\u019e\u0003\u0002\u0002\u0002\u01a0l\u0003\u0002\u0002\u0002\u01a1",
  455. "\u01a2\u0007^\u0002\u0002\u01a2\u01a3\t\u0011\u0002\u0002\u01a3\u01a4",
  456. "\u0005i5\u0002\u01a4\u01a5\u0005i5\u0002\u01a5\u01ad\u0003\u0002\u0002",
  457. "\u0002\u01a6\u01a7\u0007^\u0002\u0002\u01a7\u01a8\u0005i5\u0002\u01a8",
  458. "\u01a9\u0005i5\u0002\u01a9\u01ad\u0003\u0002\u0002\u0002\u01aa\u01ab",
  459. "\u0007^\u0002\u0002\u01ab\u01ad\u0005i5\u0002\u01ac\u01a1\u0003\u0002",
  460. "\u0002\u0002\u01ac\u01a6\u0003\u0002\u0002\u0002\u01ac\u01aa\u0003\u0002",
  461. "\u0002\u0002\u01adn\u0003\u0002\u0002\u0002\u01ae\u01af\u0007^\u0002",
  462. "\u0002\u01af\u01b0\u0007w\u0002\u0002\u01b0\u01b1\u0005g4\u0002\u01b1",
  463. "\u01b2\u0005g4\u0002\u01b2\u01b3\u0005g4\u0002\u01b3\u01b4\u0005g4\u0002",
  464. "\u01b4p\u0003\u0002\u0002\u0002\u01b5\u01b6\u00071\u0002\u0002\u01b6",
  465. "\u01b7\u00071\u0002\u0002\u01b7\u01bb\u0003\u0002\u0002\u0002\u01b8",
  466. "\u01ba\n\r\u0002\u0002\u01b9\u01b8\u0003\u0002\u0002\u0002\u01ba\u01bd",
  467. "\u0003\u0002\u0002\u0002\u01bb\u01b9\u0003\u0002\u0002\u0002\u01bb\u01bc",
  468. "\u0003\u0002\u0002\u0002\u01bc\u01bf\u0003\u0002\u0002\u0002\u01bd\u01bb",
  469. "\u0003\u0002\u0002\u0002\u01be\u01c0\u0007\u000f\u0002\u0002\u01bf\u01be",
  470. "\u0003\u0002\u0002\u0002\u01bf\u01c0\u0003\u0002\u0002\u0002\u01c0\u01c1",
  471. "\u0003\u0002\u0002\u0002\u01c1\u01ce\u0007\f\u0002\u0002\u01c2\u01c3",
  472. "\u00071\u0002\u0002\u01c3\u01c4\u0007,\u0002\u0002\u01c4\u01c8\u0003",
  473. "\u0002\u0002\u0002\u01c5\u01c7\u000b\u0002\u0002\u0002\u01c6\u01c5\u0003",
  474. "\u0002\u0002\u0002\u01c7\u01ca\u0003\u0002\u0002\u0002\u01c8\u01c9\u0003",
  475. "\u0002\u0002\u0002\u01c8\u01c6\u0003\u0002\u0002\u0002\u01c9\u01cb\u0003",
  476. "\u0002\u0002\u0002\u01ca\u01c8\u0003\u0002\u0002\u0002\u01cb\u01cc\u0007",
  477. ",\u0002\u0002\u01cc\u01ce\u00071\u0002\u0002\u01cd\u01b5\u0003\u0002",
  478. "\u0002\u0002\u01cd\u01c2\u0003\u0002\u0002\u0002\u01ce\u01cf\u0003\u0002",
  479. "\u0002\u0002\u01cf\u01d0\b9\u0003\u0002\u01d0r\u0003\u0002\u0002\u0002",
  480. "\u001d\u0002\u0124\u012e\u0138\u013e\u0143\u0149\u014e\u0150\u0155\u015b",
  481. "\u0160\u0166\u016a\u016e\u0173\u0179\u0180\u0185\u0192\u0195\u019f\u01ac",
  482. "\u01bb\u01bf\u01c8\u01cd\u0004\b\u0002\u0002\u0002\u0003\u0002"].join("");
  483. var atn = new antlr4.atn.ATNDeserializer().deserialize(serializedATN);
  484. var decisionsToDFA = atn.decisionToState.map( function(ds, index) { return new antlr4.dfa.DFA(ds, index); });
  485. function ivprog(input) {
  486. antlr4.Lexer.call(this, input);
  487. this._interp = new antlr4.atn.LexerATNSimulator(this, atn, decisionsToDFA, new antlr4.PredictionContextCache());
  488. return this;
  489. }
  490. ivprog.prototype = Object.create(antlr4.Lexer.prototype);
  491. ivprog.prototype.constructor = ivprog;
  492. ivprog.EOF = antlr4.Token.EOF;
  493. ivprog.RK_PROGRAM = 1;
  494. ivprog.RK_REAL = 2;
  495. ivprog.RK_VOID = 3;
  496. ivprog.RK_BOOLEAN = 4;
  497. ivprog.RK_STRING = 5;
  498. ivprog.RK_INTEGER = 6;
  499. ivprog.RK_CHARACTER = 7;
  500. ivprog.RK_SWITCH = 8;
  501. ivprog.RK_CASE = 9;
  502. ivprog.RK_DEFAULT = 10;
  503. ivprog.RK_CONST = 11;
  504. ivprog.RK_FUNCTION = 12;
  505. ivprog.RK_RETURN = 13;
  506. ivprog.RK_FOR = 14;
  507. ivprog.RK_BREAK = 15;
  508. ivprog.RK_DO = 16;
  509. ivprog.RK_WHILE = 17;
  510. ivprog.RK_IF = 18;
  511. ivprog.RK_ELSE = 19;
  512. ivprog.RK_FALSE = 20;
  513. ivprog.RK_TRUE = 21;
  514. ivprog.OPEN_PARENTHESIS = 22;
  515. ivprog.CLOSE_PARENTHESIS = 23;
  516. ivprog.OPEN_BRACE = 24;
  517. ivprog.CLOSE_BRACE = 25;
  518. ivprog.OPEN_CURLY = 26;
  519. ivprog.CLOSE_CURLY = 27;
  520. ivprog.COMMA = 28;
  521. ivprog.EQUAL = 29;
  522. ivprog.SUM_OP = 30;
  523. ivprog.MULTI_OP = 31;
  524. ivprog.AND_OPERATOR = 32;
  525. ivprog.OR_OPERATOR = 33;
  526. ivprog.RELATIONAL_OPERATOR = 34;
  527. ivprog.COLON = 35;
  528. ivprog.NOT_OPERATOR = 36;
  529. ivprog.ID = 37;
  530. ivprog.LIB_ID = 38;
  531. ivprog.INTEGER = 39;
  532. ivprog.REAL = 40;
  533. ivprog.STRING = 41;
  534. ivprog.CHARACTER = 42;
  535. ivprog.WHITESPACE = 43;
  536. ivprog.EOS = 44;
  537. ivprog.COMMENTS = 45;
  538. ivprog.prototype.channelNames = [ "DEFAULT_TOKEN_CHANNEL", "HIDDEN" ];
  539. ivprog.prototype.modeNames = [ "DEFAULT_MODE" ];
  540. ivprog.prototype.literalNames = [ null, "'program'", "'real'", "'void'",
  541. "'boolean'", "'string'", "'integer'",
  542. "'character'", "'switch'", "'case'", "'otherwise'",
  543. "'const'", "'function'", "'return'", "'for'",
  544. "'break'", "'do'", "'while'", "'if'",
  545. "'else'", "'false'", "'true'", "'('",
  546. "')'", "'['", "']'", "'{'", "'}'", "','",
  547. "'='", null, null, null, null, null, "':'" ];
  548. ivprog.prototype.symbolicNames = [ null, "RK_PROGRAM", "RK_REAL", "RK_VOID",
  549. "RK_BOOLEAN", "RK_STRING", "RK_INTEGER",
  550. "RK_CHARACTER", "RK_SWITCH", "RK_CASE",
  551. "RK_DEFAULT", "RK_CONST", "RK_FUNCTION",
  552. "RK_RETURN", "RK_FOR", "RK_BREAK", "RK_DO",
  553. "RK_WHILE", "RK_IF", "RK_ELSE", "RK_FALSE",
  554. "RK_TRUE", "OPEN_PARENTHESIS", "CLOSE_PARENTHESIS",
  555. "OPEN_BRACE", "CLOSE_BRACE", "OPEN_CURLY",
  556. "CLOSE_CURLY", "COMMA", "EQUAL", "SUM_OP",
  557. "MULTI_OP", "AND_OPERATOR", "OR_OPERATOR",
  558. "RELATIONAL_OPERATOR", "COLON", "NOT_OPERATOR",
  559. "ID", "LIB_ID", "INTEGER", "REAL", "STRING",
  560. "CHARACTER", "WHITESPACE", "EOS", "COMMENTS" ];
  561. ivprog.prototype.ruleNames = [ "RK_PROGRAM", "RK_REAL", "RK_VOID", "RK_BOOLEAN",
  562. "RK_STRING", "RK_INTEGER", "RK_CHARACTER",
  563. "RK_SWITCH", "RK_CASE", "RK_DEFAULT", "RK_CONST",
  564. "RK_FUNCTION", "RK_RETURN", "RK_FOR", "RK_BREAK",
  565. "RK_DO", "RK_WHILE", "RK_IF", "RK_ELSE",
  566. "RK_FALSE", "RK_TRUE", "RK_LOGICAL_NOT",
  567. "RK_LOGICAL_AND", "RK_LOGICAL_OR", "OPEN_PARENTHESIS",
  568. "CLOSE_PARENTHESIS", "OPEN_BRACE", "CLOSE_BRACE",
  569. "OPEN_CURLY", "CLOSE_CURLY", "COMMA", "EQUAL",
  570. "SUM_OP", "MULTI_OP", "AND_OPERATOR", "OR_OPERATOR",
  571. "RELATIONAL_OPERATOR", "COLON", "NOT_OPERATOR",
  572. "ID", "LIB_ID", "INTEGER", "REAL", "ExponentPart",
  573. "STRING", "STRING_CHARACTER", "CHARACTER",
  574. "WHITESPACE", "SEMICOLON", "EOS", "HEX_DIGIT",
  575. "OCTAL_DIGIT", "ESC_SEQ", "ESC_OCTAL", "ESC_UNICODE",
  576. "COMMENTS" ];
  577. ivprog.prototype.grammarFileName = "ivprog.g4";
  578. exports.ivprog = ivprog;
  579. /***/ }),
  580. /* 1 */
  581. /***/ (function(module, exports, __webpack_require__) {
  582. module.exports = {
  583. ivprog: __webpack_require__(0).ivprog
  584. };
  585. /***/ }),
  586. /* 2 */
  587. /***/ (function(module, exports) {
  588. module.exports = __webpack_require__(/*! antlr4/index */ "./node_modules/antlr4/index.js");
  589. /***/ })
  590. /******/ ]);
  591. /***/ }),
  592. /***/ "./grammar/en/langFunctions.js":
  593. /*!*************************************!*\
  594. !*** ./grammar/en/langFunctions.js ***!
  595. \*************************************/
  596. /*! exports provided: default */
  597. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  598. "use strict";
  599. __webpack_require__.r(__webpack_exports__);
  600. /* This is a dictionary of the language defined functions
  601. **/
  602. /* harmony default export */ __webpack_exports__["default"] = ({
  603. main_function: "start",
  604. $read: "read",
  605. $write: "write",
  606. $numElements: "total_of_elements",
  607. $matrixLines: "total_of_lines",
  608. $matrixColumns: "total_of_columns",
  609. $substring: "subcadeia",
  610. $length: "comprimento",
  611. $uppercase: "caixa_alta",
  612. $lowercase: "caixa_baixa",
  613. $charAt: "char_at",
  614. $isReal: "is_real",
  615. $isInt: "is_integer",
  616. $isBool: "is_logic",
  617. $castReal: "to_real",
  618. $castInt: "to_integer",
  619. $castBool: "to_logic",
  620. $castString: "to_string",
  621. $sin: "sin",
  622. $cos: "cos",
  623. $tan: "tan",
  624. $sqrt: "sqrt",
  625. $pow: "pow",
  626. $log: "log",
  627. $abs: "abs",
  628. $negate: "negate",
  629. $invert: "invert",
  630. $max: "maximum",
  631. $min: "minimum"
  632. });
  633. /***/ }),
  634. /***/ "./grammar/en/langLibs.js":
  635. /*!********************************!*\
  636. !*** ./grammar/en/langLibs.js ***!
  637. \********************************/
  638. /*! exports provided: default */
  639. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  640. "use strict";
  641. __webpack_require__.r(__webpack_exports__);
  642. /**
  643. * This is the dictionary of the language defined libraries
  644. */
  645. /* harmony default export */ __webpack_exports__["default"] = ({
  646. $mathLib: "Mathematic",
  647. $ioLib: "ES",
  648. $strLib: "Texto",
  649. $arrayLib: "Arranjo",
  650. $langLib: "Conversion"
  651. });
  652. /***/ }),
  653. /***/ "./grammar/es/ivprog.g4":
  654. /*!******************************!*\
  655. !*** ./grammar/es/ivprog.g4 ***!
  656. \******************************/
  657. /*! no static exports found */
  658. /***/ (function(module, exports, __webpack_require__) {
  659. module.exports =
  660. /******/ (function(modules) { // webpackBootstrap
  661. /******/ // The module cache
  662. /******/ var installedModules = {};
  663. /******/
  664. /******/ // The require function
  665. /******/ function __webpack_require__(moduleId) {
  666. /******/
  667. /******/ // Check if module is in cache
  668. /******/ if(installedModules[moduleId]) {
  669. /******/ return installedModules[moduleId].exports;
  670. /******/ }
  671. /******/ // Create a new module (and put it into the cache)
  672. /******/ var module = installedModules[moduleId] = {
  673. /******/ i: moduleId,
  674. /******/ l: false,
  675. /******/ exports: {}
  676. /******/ };
  677. /******/
  678. /******/ // Execute the module function
  679. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  680. /******/
  681. /******/ // Flag the module as loaded
  682. /******/ module.l = true;
  683. /******/
  684. /******/ // Return the exports of the module
  685. /******/ return module.exports;
  686. /******/ }
  687. /******/
  688. /******/
  689. /******/ // expose the modules object (__webpack_modules__)
  690. /******/ __webpack_require__.m = modules;
  691. /******/
  692. /******/ // expose the module cache
  693. /******/ __webpack_require__.c = installedModules;
  694. /******/
  695. /******/ // identity function for calling harmony imports with the correct context
  696. /******/ __webpack_require__.i = function(value) { return value; };
  697. /******/
  698. /******/ // define getter function for harmony exports
  699. /******/ __webpack_require__.d = function(exports, name, getter) {
  700. /******/ if(!__webpack_require__.o(exports, name)) {
  701. /******/ Object.defineProperty(exports, name, {
  702. /******/ configurable: false,
  703. /******/ enumerable: true,
  704. /******/ get: getter
  705. /******/ });
  706. /******/ }
  707. /******/ };
  708. /******/
  709. /******/ // getDefaultExport function for compatibility with non-harmony modules
  710. /******/ __webpack_require__.n = function(module) {
  711. /******/ var getter = module && module.__esModule ?
  712. /******/ function getDefault() { return module['default']; } :
  713. /******/ function getModuleExports() { return module; };
  714. /******/ __webpack_require__.d(getter, 'a', getter);
  715. /******/ return getter;
  716. /******/ };
  717. /******/
  718. /******/ // Object.prototype.hasOwnProperty.call
  719. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  720. /******/
  721. /******/ // __webpack_public_path__
  722. /******/ __webpack_require__.p = "";
  723. /******/
  724. /******/ // Load entry module and return exports
  725. /******/ return __webpack_require__(__webpack_require__.s = 1);
  726. /******/ })
  727. /************************************************************************/
  728. /******/ ([
  729. /* 0 */
  730. /***/ (function(module, exports, __webpack_require__) {
  731. // Generated from /tmp/tmp-8968f8EVvXgSZh3d/ivprog.g4 by ANTLR 4.7
  732. // jshint ignore: start
  733. var antlr4 = __webpack_require__(2);
  734. var serializedATN = ["\u0003\u608b\ua72a\u8133\ub9ed\u417c\u3be7\u7786\u5964",
  735. "\u0002/\u01dc\b\u0001\u0004\u0002\t\u0002\u0004\u0003\t\u0003\u0004",
  736. "\u0004\t\u0004\u0004\u0005\t\u0005\u0004\u0006\t\u0006\u0004\u0007\t",
  737. "\u0007\u0004\b\t\b\u0004\t\t\t\u0004\n\t\n\u0004\u000b\t\u000b\u0004",
  738. "\f\t\f\u0004\r\t\r\u0004\u000e\t\u000e\u0004\u000f\t\u000f\u0004\u0010",
  739. "\t\u0010\u0004\u0011\t\u0011\u0004\u0012\t\u0012\u0004\u0013\t\u0013",
  740. "\u0004\u0014\t\u0014\u0004\u0015\t\u0015\u0004\u0016\t\u0016\u0004\u0017",
  741. "\t\u0017\u0004\u0018\t\u0018\u0004\u0019\t\u0019\u0004\u001a\t\u001a",
  742. "\u0004\u001b\t\u001b\u0004\u001c\t\u001c\u0004\u001d\t\u001d\u0004\u001e",
  743. "\t\u001e\u0004\u001f\t\u001f\u0004 \t \u0004!\t!\u0004\"\t\"\u0004#",
  744. "\t#\u0004$\t$\u0004%\t%\u0004&\t&\u0004\'\t\'\u0004(\t(\u0004)\t)\u0004",
  745. "*\t*\u0004+\t+\u0004,\t,\u0004-\t-\u0004.\t.\u0004/\t/\u00040\t0\u0004",
  746. "1\t1\u00042\t2\u00043\t3\u00044\t4\u00045\t5\u00046\t6\u00047\t7\u0004",
  747. "8\t8\u00049\t9\u0003\u0002\u0003\u0002\u0003\u0002\u0003\u0002\u0003",
  748. "\u0002\u0003\u0002\u0003\u0002\u0003\u0002\u0003\u0002\u0003\u0003\u0003",
  749. "\u0003\u0003\u0003\u0003\u0003\u0003\u0003\u0003\u0004\u0003\u0004\u0003",
  750. "\u0004\u0003\u0004\u0003\u0004\u0003\u0004\u0003\u0005\u0003\u0005\u0003",
  751. "\u0005\u0003\u0005\u0003\u0005\u0003\u0005\u0003\u0005\u0003\u0006\u0003",
  752. "\u0006\u0003\u0006\u0003\u0006\u0003\u0006\u0003\u0006\u0003\u0006\u0003",
  753. "\u0007\u0003\u0007\u0003\u0007\u0003\u0007\u0003\u0007\u0003\u0007\u0003",
  754. "\u0007\u0003\u0007\u0003\b\u0003\b\u0003\b\u0003\b\u0003\b\u0003\b\u0003",
  755. "\b\u0003\b\u0003\b\u0003\b\u0003\t\u0003\t\u0003\t\u0003\t\u0003\t\u0003",
  756. "\t\u0003\t\u0003\t\u0003\n\u0003\n\u0003\n\u0003\n\u0003\n\u0003\u000b",
  757. "\u0003\u000b\u0003\u000b\u0003\u000b\u0003\u000b\u0003\u000b\u0003\u000b",
  758. "\u0003\u000b\u0003\u000b\u0003\u000b\u0003\f\u0003\f\u0003\f\u0003\f",
  759. "\u0003\f\u0003\f\u0003\r\u0003\r\u0003\r\u0003\r\u0003\r\u0003\r\u0003",
  760. "\r\u0003\u000e\u0003\u000e\u0003\u000e\u0003\u000e\u0003\u000e\u0003",
  761. "\u000e\u0003\u000e\u0003\u000e\u0003\u000f\u0003\u000f\u0003\u000f\u0003",
  762. "\u000f\u0003\u000f\u0003\u0010\u0003\u0010\u0003\u0010\u0003\u0010\u0003",
  763. "\u0010\u0003\u0011\u0003\u0011\u0003\u0011\u0003\u0011\u0003\u0011\u0003",
  764. "\u0012\u0003\u0012\u0003\u0012\u0003\u0012\u0003\u0012\u0003\u0012\u0003",
  765. "\u0012\u0003\u0012\u0003\u0012\u0003\u0013\u0003\u0013\u0003\u0013\u0003",
  766. "\u0014\u0003\u0014\u0003\u0014\u0003\u0014\u0003\u0014\u0003\u0014\u0003",
  767. "\u0015\u0003\u0015\u0003\u0015\u0003\u0015\u0003\u0015\u0003\u0015\u0003",
  768. "\u0016\u0003\u0016\u0003\u0016\u0003\u0016\u0003\u0016\u0003\u0016\u0003",
  769. "\u0016\u0003\u0016\u0003\u0016\u0003\u0016\u0003\u0016\u0003\u0017\u0003",
  770. "\u0017\u0003\u0017\u0003\u0017\u0003\u0018\u0003\u0018\u0003\u0019\u0003",
  771. "\u0019\u0003\u0019\u0003\u001a\u0003\u001a\u0003\u001b\u0003\u001b\u0003",
  772. "\u001c\u0003\u001c\u0003\u001d\u0003\u001d\u0003\u001e\u0003\u001e\u0003",
  773. "\u001f\u0003\u001f\u0003 \u0003 \u0003!\u0003!\u0003\"\u0003\"\u0003",
  774. "#\u0003#\u0003$\u0003$\u0003%\u0003%\u0003&\u0003&\u0003&\u0003&\u0003",
  775. "&\u0003&\u0003&\u0003&\u0003&\u0005&\u0130\n&\u0003\'\u0003\'\u0003",
  776. "(\u0003(\u0003)\u0003)\u0007)\u0138\n)\f)\u000e)\u013b\u000b)\u0003",
  777. "*\u0003*\u0003*\u0003*\u0003+\u0006+\u0142\n+\r+\u000e+\u0143\u0003",
  778. "+\u0003+\u0003+\u0003+\u0005+\u014a\n+\u0003+\u0006+\u014d\n+\r+\u000e",
  779. "+\u014e\u0003+\u0003+\u0003+\u0003+\u0005+\u0155\n+\u0003+\u0006+\u0158",
  780. "\n+\r+\u000e+\u0159\u0005+\u015c\n+\u0003,\u0006,\u015f\n,\r,\u000e",
  781. ",\u0160\u0003,\u0003,\u0006,\u0165\n,\r,\u000e,\u0166\u0003,\u0006,",
  782. "\u016a\n,\r,\u000e,\u016b\u0003,\u0003,\u0007,\u0170\n,\f,\u000e,\u0173",
  783. "\u000b,\u0003,\u0005,\u0176\n,\u0003-\u0003-\u0005-\u017a\n-\u0003-",
  784. "\u0006-\u017d\n-\r-\u000e-\u017e\u0003.\u0003.\u0007.\u0183\n.\f.\u000e",
  785. ".\u0186\u000b.\u0003.\u0003.\u0003/\u0003/\u0005/\u018c\n/\u00030\u0003",
  786. "0\u00030\u00050\u0191\n0\u00030\u00030\u00031\u00031\u00031\u00031\u0003",
  787. "2\u00032\u00033\u00063\u019c\n3\r3\u000e3\u019d\u00033\u00053\u01a1",
  788. "\n3\u00034\u00034\u00035\u00035\u00036\u00036\u00036\u00036\u00056\u01ab",
  789. "\n6\u00037\u00037\u00037\u00037\u00037\u00037\u00037\u00037\u00037\u0003",
  790. "7\u00037\u00057\u01b8\n7\u00038\u00038\u00038\u00038\u00038\u00038\u0003",
  791. "8\u00039\u00039\u00039\u00039\u00079\u01c5\n9\f9\u000e9\u01c8\u000b",
  792. "9\u00039\u00059\u01cb\n9\u00039\u00039\u00039\u00039\u00039\u00079\u01d2",
  793. "\n9\f9\u000e9\u01d5\u000b9\u00039\u00039\u00059\u01d9\n9\u00039\u0003",
  794. "9\u0003\u01d3\u0002:\u0003\u0003\u0005\u0004\u0007\u0005\t\u0006\u000b",
  795. "\u0007\r\b\u000f\t\u0011\n\u0013\u000b\u0015\f\u0017\r\u0019\u000e\u001b",
  796. "\u000f\u001d\u0010\u001f\u0011!\u0012#\u0013%\u0014\'\u0015)\u0016+",
  797. "\u0017-\u0002/\u00021\u00023\u00185\u00197\u001a9\u001b;\u001c=\u001d",
  798. "?\u001eA\u001fC E!G\"I#K$M%O&Q\'S(U)W*Y\u0002[+]\u0002_,a-c\u0002e.",
  799. "g\u0002i\u0002k\u0002m\u0002o\u0002q/\u0003\u0002\u0012\u0004\u0002",
  800. "--//\u0005\u0002\'\',,11\u0004\u0002>>@@\u0005\u0002C\\aac|\u0006\u0002",
  801. "2;C\\aac|\u0003\u00022;\u0003\u000223\u0004\u0002GGgg\u0006\u0002\f",
  802. "\f\u000f\u000f$$^^\u0006\u0002\f\f\u000f\u000f))^^\u0004\u0002\u000b",
  803. "\u000b\"\"\u0004\u0002\f\f\u000f\u000f\u0005\u00022;CHch\u0003\u0002",
  804. "29\n\u0002$$))^^ddhhppttvv\u0003\u000225\u0002\u01f0\u0002\u0003\u0003",
  805. "\u0002\u0002\u0002\u0002\u0005\u0003\u0002\u0002\u0002\u0002\u0007\u0003",
  806. "\u0002\u0002\u0002\u0002\t\u0003\u0002\u0002\u0002\u0002\u000b\u0003",
  807. "\u0002\u0002\u0002\u0002\r\u0003\u0002\u0002\u0002\u0002\u000f\u0003",
  808. "\u0002\u0002\u0002\u0002\u0011\u0003\u0002\u0002\u0002\u0002\u0013\u0003",
  809. "\u0002\u0002\u0002\u0002\u0015\u0003\u0002\u0002\u0002\u0002\u0017\u0003",
  810. "\u0002\u0002\u0002\u0002\u0019\u0003\u0002\u0002\u0002\u0002\u001b\u0003",
  811. "\u0002\u0002\u0002\u0002\u001d\u0003\u0002\u0002\u0002\u0002\u001f\u0003",
  812. "\u0002\u0002\u0002\u0002!\u0003\u0002\u0002\u0002\u0002#\u0003\u0002",
  813. "\u0002\u0002\u0002%\u0003\u0002\u0002\u0002\u0002\'\u0003\u0002\u0002",
  814. "\u0002\u0002)\u0003\u0002\u0002\u0002\u0002+\u0003\u0002\u0002\u0002",
  815. "\u00023\u0003\u0002\u0002\u0002\u00025\u0003\u0002\u0002\u0002\u0002",
  816. "7\u0003\u0002\u0002\u0002\u00029\u0003\u0002\u0002\u0002\u0002;\u0003",
  817. "\u0002\u0002\u0002\u0002=\u0003\u0002\u0002\u0002\u0002?\u0003\u0002",
  818. "\u0002\u0002\u0002A\u0003\u0002\u0002\u0002\u0002C\u0003\u0002\u0002",
  819. "\u0002\u0002E\u0003\u0002\u0002\u0002\u0002G\u0003\u0002\u0002\u0002",
  820. "\u0002I\u0003\u0002\u0002\u0002\u0002K\u0003\u0002\u0002\u0002\u0002",
  821. "M\u0003\u0002\u0002\u0002\u0002O\u0003\u0002\u0002\u0002\u0002Q\u0003",
  822. "\u0002\u0002\u0002\u0002S\u0003\u0002\u0002\u0002\u0002U\u0003\u0002",
  823. "\u0002\u0002\u0002W\u0003\u0002\u0002\u0002\u0002[\u0003\u0002\u0002",
  824. "\u0002\u0002_\u0003\u0002\u0002\u0002\u0002a\u0003\u0002\u0002\u0002",
  825. "\u0002e\u0003\u0002\u0002\u0002\u0002q\u0003\u0002\u0002\u0002\u0003",
  826. "s\u0003\u0002\u0002\u0002\u0005|\u0003\u0002\u0002\u0002\u0007\u0081",
  827. "\u0003\u0002\u0002\u0002\t\u0087\u0003\u0002\u0002\u0002\u000b\u008e",
  828. "\u0003\u0002\u0002\u0002\r\u0095\u0003\u0002\u0002\u0002\u000f\u009d",
  829. "\u0003\u0002\u0002\u0002\u0011\u00a7\u0003\u0002\u0002\u0002\u0013\u00af",
  830. "\u0003\u0002\u0002\u0002\u0015\u00b4\u0003\u0002\u0002\u0002\u0017\u00be",
  831. "\u0003\u0002\u0002\u0002\u0019\u00c4\u0003\u0002\u0002\u0002\u001b\u00cb",
  832. "\u0003\u0002\u0002\u0002\u001d\u00d3\u0003\u0002\u0002\u0002\u001f\u00d8",
  833. "\u0003\u0002\u0002\u0002!\u00dd\u0003\u0002\u0002\u0002#\u00e2\u0003",
  834. "\u0002\u0002\u0002%\u00eb\u0003\u0002\u0002\u0002\'\u00ee\u0003\u0002",
  835. "\u0002\u0002)\u00f4\u0003\u0002\u0002\u0002+\u00fa\u0003\u0002\u0002",
  836. "\u0002-\u0105\u0003\u0002\u0002\u0002/\u0109\u0003\u0002\u0002\u0002",
  837. "1\u010b\u0003\u0002\u0002\u00023\u010e\u0003\u0002\u0002\u00025\u0110",
  838. "\u0003\u0002\u0002\u00027\u0112\u0003\u0002\u0002\u00029\u0114\u0003",
  839. "\u0002\u0002\u0002;\u0116\u0003\u0002\u0002\u0002=\u0118\u0003\u0002",
  840. "\u0002\u0002?\u011a\u0003\u0002\u0002\u0002A\u011c\u0003\u0002\u0002",
  841. "\u0002C\u011e\u0003\u0002\u0002\u0002E\u0120\u0003\u0002\u0002\u0002",
  842. "G\u0122\u0003\u0002\u0002\u0002I\u0124\u0003\u0002\u0002\u0002K\u012f",
  843. "\u0003\u0002\u0002\u0002M\u0131\u0003\u0002\u0002\u0002O\u0133\u0003",
  844. "\u0002\u0002\u0002Q\u0135\u0003\u0002\u0002\u0002S\u013c\u0003\u0002",
  845. "\u0002\u0002U\u015b\u0003\u0002\u0002\u0002W\u0175\u0003\u0002\u0002",
  846. "\u0002Y\u0177\u0003\u0002\u0002\u0002[\u0180\u0003\u0002\u0002\u0002",
  847. "]\u018b\u0003\u0002\u0002\u0002_\u018d\u0003\u0002\u0002\u0002a\u0194",
  848. "\u0003\u0002\u0002\u0002c\u0198\u0003\u0002\u0002\u0002e\u01a0\u0003",
  849. "\u0002\u0002\u0002g\u01a2\u0003\u0002\u0002\u0002i\u01a4\u0003\u0002",
  850. "\u0002\u0002k\u01aa\u0003\u0002\u0002\u0002m\u01b7\u0003\u0002\u0002",
  851. "\u0002o\u01b9\u0003\u0002\u0002\u0002q\u01d8\u0003\u0002\u0002\u0002",
  852. "st\u0007r\u0002\u0002tu\u0007t\u0002\u0002uv\u0007q\u0002\u0002vw\u0007",
  853. "i\u0002\u0002wx\u0007t\u0002\u0002xy\u0007c\u0002\u0002yz\u0007o\u0002",
  854. "\u0002z{\u0007c\u0002\u0002{\u0004\u0003\u0002\u0002\u0002|}\u0007t",
  855. "\u0002\u0002}~\u0007g\u0002\u0002~\u007f\u0007c\u0002\u0002\u007f\u0080",
  856. "\u0007n\u0002\u0002\u0080\u0006\u0003\u0002\u0002\u0002\u0081\u0082",
  857. "\u0007x\u0002\u0002\u0082\u0083\u0007c\u0002\u0002\u0083\u0084\u0007",
  858. "|\u0002\u0002\u0084\u0085\u0007k\u0002\u0002\u0085\u0086\u0007q\u0002",
  859. "\u0002\u0086\b\u0003\u0002\u0002\u0002\u0087\u0088\u0007n\u0002\u0002",
  860. "\u0088\u0089\u0007q\u0002\u0002\u0089\u008a\u0007i\u0002\u0002\u008a",
  861. "\u008b\u0007k\u0002\u0002\u008b\u008c\u0007e\u0002\u0002\u008c\u008d",
  862. "\u0007q\u0002\u0002\u008d\n\u0003\u0002\u0002\u0002\u008e\u008f\u0007",
  863. "e\u0002\u0002\u008f\u0090\u0007c\u0002\u0002\u0090\u0091\u0007f\u0002",
  864. "\u0002\u0091\u0092\u0007g\u0002\u0002\u0092\u0093\u0007k\u0002\u0002",
  865. "\u0093\u0094\u0007c\u0002\u0002\u0094\f\u0003\u0002\u0002\u0002\u0095",
  866. "\u0096\u0007k\u0002\u0002\u0096\u0097\u0007p\u0002\u0002\u0097\u0098",
  867. "\u0007v\u0002\u0002\u0098\u0099\u0007g\u0002\u0002\u0099\u009a\u0007",
  868. "k\u0002\u0002\u009a\u009b\u0007t\u0002\u0002\u009b\u009c\u0007q\u0002",
  869. "\u0002\u009c\u000e\u0003\u0002\u0002\u0002\u009d\u009e\u0007e\u0002",
  870. "\u0002\u009e\u009f\u0007c\u0002\u0002\u009f\u00a0\u0007t\u0002\u0002",
  871. "\u00a0\u00a1\u0007c\u0002\u0002\u00a1\u00a2\u0007e\u0002\u0002\u00a2",
  872. "\u00a3\u0007v\u0002\u0002\u00a3\u00a4\u0007g\u0002\u0002\u00a4\u00a5",
  873. "\u0007t\u0002\u0002\u00a5\u00a6\u0007g\u0002\u0002\u00a6\u0010\u0003",
  874. "\u0002\u0002\u0002\u00a7\u00a8\u0007g\u0002\u0002\u00a8\u00a9\u0007",
  875. "u\u0002\u0002\u00a9\u00aa\u0007e\u0002\u0002\u00aa\u00ab\u0007q\u0002",
  876. "\u0002\u00ab\u00ac\u0007n\u0002\u0002\u00ac\u00ad\u0007j\u0002\u0002",
  877. "\u00ad\u00ae\u0007c\u0002\u0002\u00ae\u0012\u0003\u0002\u0002\u0002",
  878. "\u00af\u00b0\u0007e\u0002\u0002\u00b0\u00b1\u0007c\u0002\u0002\u00b1",
  879. "\u00b2\u0007u\u0002\u0002\u00b2\u00b3\u0007q\u0002\u0002\u00b3\u0014",
  880. "\u0003\u0002\u0002\u0002\u00b4\u00b5\u0007e\u0002\u0002\u00b5\u00b6",
  881. "\u0007q\u0002\u0002\u00b6\u00b7\u0007p\u0002\u0002\u00b7\u00b8\u0007",
  882. "v\u0002\u0002\u00b8\u00b9\u0007t\u0002\u0002\u00b9\u00ba\u0007c\u0002",
  883. "\u0002\u00ba\u00bb\u0007t\u0002\u0002\u00bb\u00bc\u0007k\u0002\u0002",
  884. "\u00bc\u00bd\u0007q\u0002\u0002\u00bd\u0016\u0003\u0002\u0002\u0002",
  885. "\u00be\u00bf\u0007e\u0002\u0002\u00bf\u00c0\u0007q\u0002\u0002\u00c0",
  886. "\u00c1\u0007p\u0002\u0002\u00c1\u00c2\u0007u\u0002\u0002\u00c2\u00c3",
  887. "\u0007v\u0002\u0002\u00c3\u0018\u0003\u0002\u0002\u0002\u00c4\u00c5",
  888. "\u0007h\u0002\u0002\u00c5\u00c6\u0007w\u0002\u0002\u00c6\u00c7\u0007",
  889. "p\u0002\u0002\u00c7\u00c8\u0007e\u0002\u0002\u00c8\u00c9\u0007c\u0002",
  890. "\u0002\u00c9\u00ca\u0007q\u0002\u0002\u00ca\u001a\u0003\u0002\u0002",
  891. "\u0002\u00cb\u00cc\u0007t\u0002\u0002\u00cc\u00cd\u0007g\u0002\u0002",
  892. "\u00cd\u00ce\u0007v\u0002\u0002\u00ce\u00cf\u0007q\u0002\u0002\u00cf",
  893. "\u00d0\u0007t\u0002\u0002\u00d0\u00d1\u0007p\u0002\u0002\u00d1\u00d2",
  894. "\u0007g\u0002\u0002\u00d2\u001c\u0003\u0002\u0002\u0002\u00d3\u00d4",
  895. "\u0007r\u0002\u0002\u00d4\u00d5\u0007c\u0002\u0002\u00d5\u00d6\u0007",
  896. "t\u0002\u0002\u00d6\u00d7\u0007c\u0002\u0002\u00d7\u001e\u0003\u0002",
  897. "\u0002\u0002\u00d8\u00d9\u0007r\u0002\u0002\u00d9\u00da\u0007c\u0002",
  898. "\u0002\u00da\u00db\u0007t\u0002\u0002\u00db\u00dc\u0007g\u0002\u0002",
  899. "\u00dc \u0003\u0002\u0002\u0002\u00dd\u00de\u0007h\u0002\u0002\u00de",
  900. "\u00df\u0007c\u0002\u0002\u00df\u00e0\u0007e\u0002\u0002\u00e0\u00e1",
  901. "\u0007c\u0002\u0002\u00e1\"\u0003\u0002\u0002\u0002\u00e2\u00e3\u0007",
  902. "g\u0002\u0002\u00e3\u00e4\u0007p\u0002\u0002\u00e4\u00e5\u0007s\u0002",
  903. "\u0002\u00e5\u00e6\u0007w\u0002\u0002\u00e6\u00e7\u0007c\u0002\u0002",
  904. "\u00e7\u00e8\u0007p\u0002\u0002\u00e8\u00e9\u0007v\u0002\u0002\u00e9",
  905. "\u00ea\u0007q\u0002\u0002\u00ea$\u0003\u0002\u0002\u0002\u00eb\u00ec",
  906. "\u0007u\u0002\u0002\u00ec\u00ed\u0007g\u0002\u0002\u00ed&\u0003\u0002",
  907. "\u0002\u0002\u00ee\u00ef\u0007u\u0002\u0002\u00ef\u00f0\u0007g\u0002",
  908. "\u0002\u00f0\u00f1\u0007p\u0002\u0002\u00f1\u00f2\u0007c\u0002\u0002",
  909. "\u00f2\u00f3\u0007q\u0002\u0002\u00f3(\u0003\u0002\u0002\u0002\u00f4",
  910. "\u00f5\u0007h\u0002\u0002\u00f5\u00f6\u0007c\u0002\u0002\u00f6\u00f7",
  911. "\u0007n\u0002\u0002\u00f7\u00f8\u0007u\u0002\u0002\u00f8\u00f9\u0007",
  912. "q\u0002\u0002\u00f9*\u0003\u0002\u0002\u0002\u00fa\u00fb\u0007x\u0002",
  913. "\u0002\u00fb\u00fc\u0007g\u0002\u0002\u00fc\u00fd\u0007t\u0002\u0002",
  914. "\u00fd\u00fe\u0007f\u0002\u0002\u00fe\u00ff\u0007c\u0002\u0002\u00ff",
  915. "\u0100\u0007f\u0002\u0002\u0100\u0101\u0007g\u0002\u0002\u0101\u0102",
  916. "\u0007k\u0002\u0002\u0102\u0103\u0007t\u0002\u0002\u0103\u0104\u0007",
  917. "q\u0002\u0002\u0104,\u0003\u0002\u0002\u0002\u0105\u0106\u0007p\u0002",
  918. "\u0002\u0106\u0107\u0007c\u0002\u0002\u0107\u0108\u0007q\u0002\u0002",
  919. "\u0108.\u0003\u0002\u0002\u0002\u0109\u010a\u0007G\u0002\u0002\u010a",
  920. "0\u0003\u0002\u0002\u0002\u010b\u010c\u0007Q\u0002\u0002\u010c\u010d",
  921. "\u0007W\u0002\u0002\u010d2\u0003\u0002\u0002\u0002\u010e\u010f\u0007",
  922. "*\u0002\u0002\u010f4\u0003\u0002\u0002\u0002\u0110\u0111\u0007+\u0002",
  923. "\u0002\u01116\u0003\u0002\u0002\u0002\u0112\u0113\u0007]\u0002\u0002",
  924. "\u01138\u0003\u0002\u0002\u0002\u0114\u0115\u0007_\u0002\u0002\u0115",
  925. ":\u0003\u0002\u0002\u0002\u0116\u0117\u0007}\u0002\u0002\u0117<\u0003",
  926. "\u0002\u0002\u0002\u0118\u0119\u0007\u007f\u0002\u0002\u0119>\u0003",
  927. "\u0002\u0002\u0002\u011a\u011b\u0007.\u0002\u0002\u011b@\u0003\u0002",
  928. "\u0002\u0002\u011c\u011d\u0007?\u0002\u0002\u011dB\u0003\u0002\u0002",
  929. "\u0002\u011e\u011f\t\u0002\u0002\u0002\u011fD\u0003\u0002\u0002\u0002",
  930. "\u0120\u0121\t\u0003\u0002\u0002\u0121F\u0003\u0002\u0002\u0002\u0122",
  931. "\u0123\u0005/\u0018\u0002\u0123H\u0003\u0002\u0002\u0002\u0124\u0125",
  932. "\u00051\u0019\u0002\u0125J\u0003\u0002\u0002\u0002\u0126\u0127\u0007",
  933. "@\u0002\u0002\u0127\u0130\u0007?\u0002\u0002\u0128\u0129\u0007?\u0002",
  934. "\u0002\u0129\u0130\u0007?\u0002\u0002\u012a\u012b\u0007>\u0002\u0002",
  935. "\u012b\u0130\u0007?\u0002\u0002\u012c\u0130\t\u0004\u0002\u0002\u012d",
  936. "\u012e\u0007#\u0002\u0002\u012e\u0130\u0007?\u0002\u0002\u012f\u0126",
  937. "\u0003\u0002\u0002\u0002\u012f\u0128\u0003\u0002\u0002\u0002\u012f\u012a",
  938. "\u0003\u0002\u0002\u0002\u012f\u012c\u0003\u0002\u0002\u0002\u012f\u012d",
  939. "\u0003\u0002\u0002\u0002\u0130L\u0003\u0002\u0002\u0002\u0131\u0132",
  940. "\u0007<\u0002\u0002\u0132N\u0003\u0002\u0002\u0002\u0133\u0134\u0005",
  941. "-\u0017\u0002\u0134P\u0003\u0002\u0002\u0002\u0135\u0139\t\u0005\u0002",
  942. "\u0002\u0136\u0138\t\u0006\u0002\u0002\u0137\u0136\u0003\u0002\u0002",
  943. "\u0002\u0138\u013b\u0003\u0002\u0002\u0002\u0139\u0137\u0003\u0002\u0002",
  944. "\u0002\u0139\u013a\u0003\u0002\u0002\u0002\u013aR\u0003\u0002\u0002",
  945. "\u0002\u013b\u0139\u0003\u0002\u0002\u0002\u013c\u013d\u0005Q)\u0002",
  946. "\u013d\u013e\u00070\u0002\u0002\u013e\u013f\u0005Q)\u0002\u013fT\u0003",
  947. "\u0002\u0002\u0002\u0140\u0142\t\u0007\u0002\u0002\u0141\u0140\u0003",
  948. "\u0002\u0002\u0002\u0142\u0143\u0003\u0002\u0002\u0002\u0143\u0141\u0003",
  949. "\u0002\u0002\u0002\u0143\u0144\u0003\u0002\u0002\u0002\u0144\u015c\u0003",
  950. "\u0002\u0002\u0002\u0145\u0146\u00072\u0002\u0002\u0146\u014a\u0007",
  951. "z\u0002\u0002\u0147\u0148\u00072\u0002\u0002\u0148\u014a\u0007Z\u0002",
  952. "\u0002\u0149\u0145\u0003\u0002\u0002\u0002\u0149\u0147\u0003\u0002\u0002",
  953. "\u0002\u014a\u014c\u0003\u0002\u0002\u0002\u014b\u014d\u0005g4\u0002",
  954. "\u014c\u014b\u0003\u0002\u0002\u0002\u014d\u014e\u0003\u0002\u0002\u0002",
  955. "\u014e\u014c\u0003\u0002\u0002\u0002\u014e\u014f\u0003\u0002\u0002\u0002",
  956. "\u014f\u015c\u0003\u0002\u0002\u0002\u0150\u0151\u00072\u0002\u0002",
  957. "\u0151\u0155\u0007d\u0002\u0002\u0152\u0153\u00072\u0002\u0002\u0153",
  958. "\u0155\u0007D\u0002\u0002\u0154\u0150\u0003\u0002\u0002\u0002\u0154",
  959. "\u0152\u0003\u0002\u0002\u0002\u0155\u0157\u0003\u0002\u0002\u0002\u0156",
  960. "\u0158\t\b\u0002\u0002\u0157\u0156\u0003\u0002\u0002\u0002\u0158\u0159",
  961. "\u0003\u0002\u0002\u0002\u0159\u0157\u0003\u0002\u0002\u0002\u0159\u015a",
  962. "\u0003\u0002\u0002\u0002\u015a\u015c\u0003\u0002\u0002\u0002\u015b\u0141",
  963. "\u0003\u0002\u0002\u0002\u015b\u0149\u0003\u0002\u0002\u0002\u015b\u0154",
  964. "\u0003\u0002\u0002\u0002\u015cV\u0003\u0002\u0002\u0002\u015d\u015f",
  965. "\t\u0007\u0002\u0002\u015e\u015d\u0003\u0002\u0002\u0002\u015f\u0160",
  966. "\u0003\u0002\u0002\u0002\u0160\u015e\u0003\u0002\u0002\u0002\u0160\u0161",
  967. "\u0003\u0002\u0002\u0002\u0161\u0162\u0003\u0002\u0002\u0002\u0162\u0164",
  968. "\u00070\u0002\u0002\u0163\u0165\t\u0007\u0002\u0002\u0164\u0163\u0003",
  969. "\u0002\u0002\u0002\u0165\u0166\u0003\u0002\u0002\u0002\u0166\u0164\u0003",
  970. "\u0002\u0002\u0002\u0166\u0167\u0003\u0002\u0002\u0002\u0167\u0176\u0003",
  971. "\u0002\u0002\u0002\u0168\u016a\t\u0007\u0002\u0002\u0169\u0168\u0003",
  972. "\u0002\u0002\u0002\u016a\u016b\u0003\u0002\u0002\u0002\u016b\u0169\u0003",
  973. "\u0002\u0002\u0002\u016b\u016c\u0003\u0002\u0002\u0002\u016c\u016d\u0003",
  974. "\u0002\u0002\u0002\u016d\u0171\u00070\u0002\u0002\u016e\u0170\t\u0007",
  975. "\u0002\u0002\u016f\u016e\u0003\u0002\u0002\u0002\u0170\u0173\u0003\u0002",
  976. "\u0002\u0002\u0171\u016f\u0003\u0002\u0002\u0002\u0171\u0172\u0003\u0002",
  977. "\u0002\u0002\u0172\u0174\u0003\u0002\u0002\u0002\u0173\u0171\u0003\u0002",
  978. "\u0002\u0002\u0174\u0176\u0005Y-\u0002\u0175\u015e\u0003\u0002\u0002",
  979. "\u0002\u0175\u0169\u0003\u0002\u0002\u0002\u0176X\u0003\u0002\u0002",
  980. "\u0002\u0177\u0179\t\t\u0002\u0002\u0178\u017a\t\u0002\u0002\u0002\u0179",
  981. "\u0178\u0003\u0002\u0002\u0002\u0179\u017a\u0003\u0002\u0002\u0002\u017a",
  982. "\u017c\u0003\u0002\u0002\u0002\u017b\u017d\t\u0007\u0002\u0002\u017c",
  983. "\u017b\u0003\u0002\u0002\u0002\u017d\u017e\u0003\u0002\u0002\u0002\u017e",
  984. "\u017c\u0003\u0002\u0002\u0002\u017e\u017f\u0003\u0002\u0002\u0002\u017f",
  985. "Z\u0003\u0002\u0002\u0002\u0180\u0184\u0007$\u0002\u0002\u0181\u0183",
  986. "\u0005]/\u0002\u0182\u0181\u0003\u0002\u0002\u0002\u0183\u0186\u0003",
  987. "\u0002\u0002\u0002\u0184\u0182\u0003\u0002\u0002\u0002\u0184\u0185\u0003",
  988. "\u0002\u0002\u0002\u0185\u0187\u0003\u0002\u0002\u0002\u0186\u0184\u0003",
  989. "\u0002\u0002\u0002\u0187\u0188\u0007$\u0002\u0002\u0188\\\u0003\u0002",
  990. "\u0002\u0002\u0189\u018c\n\n\u0002\u0002\u018a\u018c\u0005k6\u0002\u018b",
  991. "\u0189\u0003\u0002\u0002\u0002\u018b\u018a\u0003\u0002\u0002\u0002\u018c",
  992. "^\u0003\u0002\u0002\u0002\u018d\u0190\u0007)\u0002\u0002\u018e\u0191",
  993. "\u0005k6\u0002\u018f\u0191\n\u000b\u0002\u0002\u0190\u018e\u0003\u0002",
  994. "\u0002\u0002\u0190\u018f\u0003\u0002\u0002\u0002\u0191\u0192\u0003\u0002",
  995. "\u0002\u0002\u0192\u0193\u0007)\u0002\u0002\u0193`\u0003\u0002\u0002",
  996. "\u0002\u0194\u0195\t\f\u0002\u0002\u0195\u0196\u0003\u0002\u0002\u0002",
  997. "\u0196\u0197\b1\u0002\u0002\u0197b\u0003\u0002\u0002\u0002\u0198\u0199",
  998. "\u0007=\u0002\u0002\u0199d\u0003\u0002\u0002\u0002\u019a\u019c\t\r\u0002",
  999. "\u0002\u019b\u019a\u0003\u0002\u0002\u0002\u019c\u019d\u0003\u0002\u0002",
  1000. "\u0002\u019d\u019b\u0003\u0002\u0002\u0002\u019d\u019e\u0003\u0002\u0002",
  1001. "\u0002\u019e\u01a1\u0003\u0002\u0002\u0002\u019f\u01a1\u0005c2\u0002",
  1002. "\u01a0\u019b\u0003\u0002\u0002\u0002\u01a0\u019f\u0003\u0002\u0002\u0002",
  1003. "\u01a1f\u0003\u0002\u0002\u0002\u01a2\u01a3\t\u000e\u0002\u0002\u01a3",
  1004. "h\u0003\u0002\u0002\u0002\u01a4\u01a5\t\u000f\u0002\u0002\u01a5j\u0003",
  1005. "\u0002\u0002\u0002\u01a6\u01a7\u0007^\u0002\u0002\u01a7\u01ab\t\u0010",
  1006. "\u0002\u0002\u01a8\u01ab\u0005o8\u0002\u01a9\u01ab\u0005m7\u0002\u01aa",
  1007. "\u01a6\u0003\u0002\u0002\u0002\u01aa\u01a8\u0003\u0002\u0002\u0002\u01aa",
  1008. "\u01a9\u0003\u0002\u0002\u0002\u01abl\u0003\u0002\u0002\u0002\u01ac",
  1009. "\u01ad\u0007^\u0002\u0002\u01ad\u01ae\t\u0011\u0002\u0002\u01ae\u01af",
  1010. "\u0005i5\u0002\u01af\u01b0\u0005i5\u0002\u01b0\u01b8\u0003\u0002\u0002",
  1011. "\u0002\u01b1\u01b2\u0007^\u0002\u0002\u01b2\u01b3\u0005i5\u0002\u01b3",
  1012. "\u01b4\u0005i5\u0002\u01b4\u01b8\u0003\u0002\u0002\u0002\u01b5\u01b6",
  1013. "\u0007^\u0002\u0002\u01b6\u01b8\u0005i5\u0002\u01b7\u01ac\u0003\u0002",
  1014. "\u0002\u0002\u01b7\u01b1\u0003\u0002\u0002\u0002\u01b7\u01b5\u0003\u0002",
  1015. "\u0002\u0002\u01b8n\u0003\u0002\u0002\u0002\u01b9\u01ba\u0007^\u0002",
  1016. "\u0002\u01ba\u01bb\u0007w\u0002\u0002\u01bb\u01bc\u0005g4\u0002\u01bc",
  1017. "\u01bd\u0005g4\u0002\u01bd\u01be\u0005g4\u0002\u01be\u01bf\u0005g4\u0002",
  1018. "\u01bfp\u0003\u0002\u0002\u0002\u01c0\u01c1\u00071\u0002\u0002\u01c1",
  1019. "\u01c2\u00071\u0002\u0002\u01c2\u01c6\u0003\u0002\u0002\u0002\u01c3",
  1020. "\u01c5\n\r\u0002\u0002\u01c4\u01c3\u0003\u0002\u0002\u0002\u01c5\u01c8",
  1021. "\u0003\u0002\u0002\u0002\u01c6\u01c4\u0003\u0002\u0002\u0002\u01c6\u01c7",
  1022. "\u0003\u0002\u0002\u0002\u01c7\u01ca\u0003\u0002\u0002\u0002\u01c8\u01c6",
  1023. "\u0003\u0002\u0002\u0002\u01c9\u01cb\u0007\u000f\u0002\u0002\u01ca\u01c9",
  1024. "\u0003\u0002\u0002\u0002\u01ca\u01cb\u0003\u0002\u0002\u0002\u01cb\u01cc",
  1025. "\u0003\u0002\u0002\u0002\u01cc\u01d9\u0007\f\u0002\u0002\u01cd\u01ce",
  1026. "\u00071\u0002\u0002\u01ce\u01cf\u0007,\u0002\u0002\u01cf\u01d3\u0003",
  1027. "\u0002\u0002\u0002\u01d0\u01d2\u000b\u0002\u0002\u0002\u01d1\u01d0\u0003",
  1028. "\u0002\u0002\u0002\u01d2\u01d5\u0003\u0002\u0002\u0002\u01d3\u01d4\u0003",
  1029. "\u0002\u0002\u0002\u01d3\u01d1\u0003\u0002\u0002\u0002\u01d4\u01d6\u0003",
  1030. "\u0002\u0002\u0002\u01d5\u01d3\u0003\u0002\u0002\u0002\u01d6\u01d7\u0007",
  1031. ",\u0002\u0002\u01d7\u01d9\u00071\u0002\u0002\u01d8\u01c0\u0003\u0002",
  1032. "\u0002\u0002\u01d8\u01cd\u0003\u0002\u0002\u0002\u01d9\u01da\u0003\u0002",
  1033. "\u0002\u0002\u01da\u01db\b9\u0003\u0002\u01dbr\u0003\u0002\u0002\u0002",
  1034. "\u001d\u0002\u012f\u0139\u0143\u0149\u014e\u0154\u0159\u015b\u0160\u0166",
  1035. "\u016b\u0171\u0175\u0179\u017e\u0184\u018b\u0190\u019d\u01a0\u01aa\u01b7",
  1036. "\u01c6\u01ca\u01d3\u01d8\u0004\b\u0002\u0002\u0002\u0003\u0002"].join("");
  1037. var atn = new antlr4.atn.ATNDeserializer().deserialize(serializedATN);
  1038. var decisionsToDFA = atn.decisionToState.map( function(ds, index) { return new antlr4.dfa.DFA(ds, index); });
  1039. function ivprog(input) {
  1040. antlr4.Lexer.call(this, input);
  1041. this._interp = new antlr4.atn.LexerATNSimulator(this, atn, decisionsToDFA, new antlr4.PredictionContextCache());
  1042. return this;
  1043. }
  1044. ivprog.prototype = Object.create(antlr4.Lexer.prototype);
  1045. ivprog.prototype.constructor = ivprog;
  1046. ivprog.EOF = antlr4.Token.EOF;
  1047. ivprog.RK_PROGRAM = 1;
  1048. ivprog.RK_REAL = 2;
  1049. ivprog.RK_VOID = 3;
  1050. ivprog.RK_BOOLEAN = 4;
  1051. ivprog.RK_STRING = 5;
  1052. ivprog.RK_INTEGER = 6;
  1053. ivprog.RK_CHARACTER = 7;
  1054. ivprog.RK_SWITCH = 8;
  1055. ivprog.RK_CASE = 9;
  1056. ivprog.RK_DEFAULT = 10;
  1057. ivprog.RK_CONST = 11;
  1058. ivprog.RK_FUNCTION = 12;
  1059. ivprog.RK_RETURN = 13;
  1060. ivprog.RK_FOR = 14;
  1061. ivprog.RK_BREAK = 15;
  1062. ivprog.RK_DO = 16;
  1063. ivprog.RK_WHILE = 17;
  1064. ivprog.RK_IF = 18;
  1065. ivprog.RK_ELSE = 19;
  1066. ivprog.RK_FALSE = 20;
  1067. ivprog.RK_TRUE = 21;
  1068. ivprog.OPEN_PARENTHESIS = 22;
  1069. ivprog.CLOSE_PARENTHESIS = 23;
  1070. ivprog.OPEN_BRACE = 24;
  1071. ivprog.CLOSE_BRACE = 25;
  1072. ivprog.OPEN_CURLY = 26;
  1073. ivprog.CLOSE_CURLY = 27;
  1074. ivprog.COMMA = 28;
  1075. ivprog.EQUAL = 29;
  1076. ivprog.SUM_OP = 30;
  1077. ivprog.MULTI_OP = 31;
  1078. ivprog.AND_OPERATOR = 32;
  1079. ivprog.OR_OPERATOR = 33;
  1080. ivprog.RELATIONAL_OPERATOR = 34;
  1081. ivprog.COLON = 35;
  1082. ivprog.NOT_OPERATOR = 36;
  1083. ivprog.ID = 37;
  1084. ivprog.LIB_ID = 38;
  1085. ivprog.INTEGER = 39;
  1086. ivprog.REAL = 40;
  1087. ivprog.STRING = 41;
  1088. ivprog.CHARACTER = 42;
  1089. ivprog.WHITESPACE = 43;
  1090. ivprog.EOS = 44;
  1091. ivprog.COMMENTS = 45;
  1092. ivprog.prototype.channelNames = [ "DEFAULT_TOKEN_CHANNEL", "HIDDEN" ];
  1093. ivprog.prototype.modeNames = [ "DEFAULT_MODE" ];
  1094. ivprog.prototype.literalNames = [ null, "'programa'", "'real'", "'vazio'",
  1095. "'logico'", "'cadeia'", "'inteiro'", "'caractere'",
  1096. "'escolha'", "'caso'", "'contrario'",
  1097. "'const'", "'funcao'", "'retorne'", "'para'",
  1098. "'pare'", "'faca'", "'enquanto'", "'se'",
  1099. "'senao'", "'falso'", "'verdadeiro'",
  1100. "'('", "')'", "'['", "']'", "'{'", "'}'",
  1101. "','", "'='", null, null, null, null,
  1102. null, "':'" ];
  1103. ivprog.prototype.symbolicNames = [ null, "RK_PROGRAM", "RK_REAL", "RK_VOID",
  1104. "RK_BOOLEAN", "RK_STRING", "RK_INTEGER",
  1105. "RK_CHARACTER", "RK_SWITCH", "RK_CASE",
  1106. "RK_DEFAULT", "RK_CONST", "RK_FUNCTION",
  1107. "RK_RETURN", "RK_FOR", "RK_BREAK", "RK_DO",
  1108. "RK_WHILE", "RK_IF", "RK_ELSE", "RK_FALSE",
  1109. "RK_TRUE", "OPEN_PARENTHESIS", "CLOSE_PARENTHESIS",
  1110. "OPEN_BRACE", "CLOSE_BRACE", "OPEN_CURLY",
  1111. "CLOSE_CURLY", "COMMA", "EQUAL", "SUM_OP",
  1112. "MULTI_OP", "AND_OPERATOR", "OR_OPERATOR",
  1113. "RELATIONAL_OPERATOR", "COLON", "NOT_OPERATOR",
  1114. "ID", "LIB_ID", "INTEGER", "REAL", "STRING",
  1115. "CHARACTER", "WHITESPACE", "EOS", "COMMENTS" ];
  1116. ivprog.prototype.ruleNames = [ "RK_PROGRAM", "RK_REAL", "RK_VOID", "RK_BOOLEAN",
  1117. "RK_STRING", "RK_INTEGER", "RK_CHARACTER",
  1118. "RK_SWITCH", "RK_CASE", "RK_DEFAULT", "RK_CONST",
  1119. "RK_FUNCTION", "RK_RETURN", "RK_FOR", "RK_BREAK",
  1120. "RK_DO", "RK_WHILE", "RK_IF", "RK_ELSE",
  1121. "RK_FALSE", "RK_TRUE", "RK_LOGICAL_NOT",
  1122. "RK_LOGICAL_AND", "RK_LOGICAL_OR", "OPEN_PARENTHESIS",
  1123. "CLOSE_PARENTHESIS", "OPEN_BRACE", "CLOSE_BRACE",
  1124. "OPEN_CURLY", "CLOSE_CURLY", "COMMA", "EQUAL",
  1125. "SUM_OP", "MULTI_OP", "AND_OPERATOR", "OR_OPERATOR",
  1126. "RELATIONAL_OPERATOR", "COLON", "NOT_OPERATOR",
  1127. "ID", "LIB_ID", "INTEGER", "REAL", "ExponentPart",
  1128. "STRING", "STRING_CHARACTER", "CHARACTER",
  1129. "WHITESPACE", "SEMICOLON", "EOS", "HEX_DIGIT",
  1130. "OCTAL_DIGIT", "ESC_SEQ", "ESC_OCTAL", "ESC_UNICODE",
  1131. "COMMENTS" ];
  1132. ivprog.prototype.grammarFileName = "ivprog.g4";
  1133. exports.ivprog = ivprog;
  1134. /***/ }),
  1135. /* 1 */
  1136. /***/ (function(module, exports, __webpack_require__) {
  1137. module.exports = {
  1138. ivprog: __webpack_require__(0).ivprog
  1139. };
  1140. /***/ }),
  1141. /* 2 */
  1142. /***/ (function(module, exports) {
  1143. module.exports = __webpack_require__(/*! antlr4/index */ "./node_modules/antlr4/index.js");
  1144. /***/ })
  1145. /******/ ]);
  1146. /***/ }),
  1147. /***/ "./grammar/es/langFunctions.js":
  1148. /*!*************************************!*\
  1149. !*** ./grammar/es/langFunctions.js ***!
  1150. \*************************************/
  1151. /*! exports provided: default */
  1152. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1153. "use strict";
  1154. __webpack_require__.r(__webpack_exports__);
  1155. /* This is a dictionary of the language defined functions
  1156. **/
  1157. /* harmony default export */ __webpack_exports__["default"] = ({
  1158. main_function: "inicio",
  1159. $read: "leia",
  1160. $write: "escreva",
  1161. $numElements: "total_of_elements",
  1162. $matrixLines: "total_of_lines",
  1163. $matrixColumns: "total_of_columns",
  1164. $substring: "subcadeia",
  1165. $length: "comprimento",
  1166. $uppercase: "caixa_alta",
  1167. $lowercase: "caixa_baixa",
  1168. $charAt: "char_at",
  1169. $isReal: "is_real",
  1170. $isInt: "is_integer",
  1171. $isBool: "is_logic",
  1172. $castReal: "to_real",
  1173. $castInt: "to_integer",
  1174. $castBool: "to_logic",
  1175. $castString: "to_string",
  1176. $sin: "sin",
  1177. $cos: "cos",
  1178. $tan: "tan",
  1179. $sqrt: "sqrt",
  1180. $pow: "pow",
  1181. $log: "log",
  1182. $abs: "abs",
  1183. $negate: "negate",
  1184. $invert: "invert",
  1185. $max: "maximum",
  1186. $min: "minimum"
  1187. });
  1188. /***/ }),
  1189. /***/ "./grammar/es/langLibs.js":
  1190. /*!********************************!*\
  1191. !*** ./grammar/es/langLibs.js ***!
  1192. \********************************/
  1193. /*! exports provided: default */
  1194. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1195. "use strict";
  1196. __webpack_require__.r(__webpack_exports__);
  1197. /**
  1198. * This is the dictionary of the language defined libraries
  1199. */
  1200. /* harmony default export */ __webpack_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. /*! exports provided: default */
  1213. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1214. "use strict";
  1215. __webpack_require__.r(__webpack_exports__);
  1216. /* harmony import */ var _pt_ivprog_g4__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./pt/ivprog.g4 */ "./grammar/pt/ivprog.g4");
  1217. /* harmony import */ var _pt_ivprog_g4__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_pt_ivprog_g4__WEBPACK_IMPORTED_MODULE_0__);
  1218. /* harmony import */ var _pt_langFunctions__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./pt/langFunctions */ "./grammar/pt/langFunctions.js");
  1219. /* harmony import */ var _pt_langLibs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./pt/langLibs */ "./grammar/pt/langLibs.js");
  1220. /* harmony import */ var _en_ivprog_g4__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./en/ivprog.g4 */ "./grammar/en/ivprog.g4");
  1221. /* harmony import */ var _en_ivprog_g4__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_en_ivprog_g4__WEBPACK_IMPORTED_MODULE_3__);
  1222. /* harmony import */ var _en_langFunctions__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./en/langFunctions */ "./grammar/en/langFunctions.js");
  1223. /* harmony import */ var _en_langLibs__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./en/langLibs */ "./grammar/en/langLibs.js");
  1224. /* harmony import */ var _es_ivprog_g4__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./es/ivprog.g4 */ "./grammar/es/ivprog.g4");
  1225. /* harmony import */ var _es_ivprog_g4__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(_es_ivprog_g4__WEBPACK_IMPORTED_MODULE_6__);
  1226. /* harmony import */ var _es_langFunctions__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./es/langFunctions */ "./grammar/es/langFunctions.js");
  1227. /* harmony import */ var _es_langLibs__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./es/langLibs */ "./grammar/es/langLibs.js");
  1228. /* harmony default export */ __webpack_exports__["default"] = ({
  1229. pt: {
  1230. lexer: _pt_ivprog_g4__WEBPACK_IMPORTED_MODULE_0__["ivprog"],
  1231. langFuncs: _pt_langFunctions__WEBPACK_IMPORTED_MODULE_1__["default"],
  1232. langLibs: _pt_langLibs__WEBPACK_IMPORTED_MODULE_2__["default"]
  1233. },
  1234. en: {
  1235. lexer: _en_ivprog_g4__WEBPACK_IMPORTED_MODULE_3__["ivprog"],
  1236. langFuncs: _en_langFunctions__WEBPACK_IMPORTED_MODULE_4__["default"],
  1237. langLibs: _en_langLibs__WEBPACK_IMPORTED_MODULE_5__["default"]
  1238. },
  1239. es: {
  1240. lexer: _es_ivprog_g4__WEBPACK_IMPORTED_MODULE_6__["ivprog"],
  1241. langFuncs: _es_langFunctions__WEBPACK_IMPORTED_MODULE_7__["default"],
  1242. langLibs: _es_langLibs__WEBPACK_IMPORTED_MODULE_8__["default"]
  1243. }
  1244. });
  1245. /***/ }),
  1246. /***/ "./grammar/pt/ivprog.g4":
  1247. /*!******************************!*\
  1248. !*** ./grammar/pt/ivprog.g4 ***!
  1249. \******************************/
  1250. /*! no static exports found */
  1251. /***/ (function(module, exports, __webpack_require__) {
  1252. module.exports =
  1253. /******/ (function(modules) { // webpackBootstrap
  1254. /******/ // The module cache
  1255. /******/ var installedModules = {};
  1256. /******/
  1257. /******/ // The require function
  1258. /******/ function __webpack_require__(moduleId) {
  1259. /******/
  1260. /******/ // Check if module is in cache
  1261. /******/ if(installedModules[moduleId]) {
  1262. /******/ return installedModules[moduleId].exports;
  1263. /******/ }
  1264. /******/ // Create a new module (and put it into the cache)
  1265. /******/ var module = installedModules[moduleId] = {
  1266. /******/ i: moduleId,
  1267. /******/ l: false,
  1268. /******/ exports: {}
  1269. /******/ };
  1270. /******/
  1271. /******/ // Execute the module function
  1272. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  1273. /******/
  1274. /******/ // Flag the module as loaded
  1275. /******/ module.l = true;
  1276. /******/
  1277. /******/ // Return the exports of the module
  1278. /******/ return module.exports;
  1279. /******/ }
  1280. /******/
  1281. /******/
  1282. /******/ // expose the modules object (__webpack_modules__)
  1283. /******/ __webpack_require__.m = modules;
  1284. /******/
  1285. /******/ // expose the module cache
  1286. /******/ __webpack_require__.c = installedModules;
  1287. /******/
  1288. /******/ // identity function for calling harmony imports with the correct context
  1289. /******/ __webpack_require__.i = function(value) { return value; };
  1290. /******/
  1291. /******/ // define getter function for harmony exports
  1292. /******/ __webpack_require__.d = function(exports, name, getter) {
  1293. /******/ if(!__webpack_require__.o(exports, name)) {
  1294. /******/ Object.defineProperty(exports, name, {
  1295. /******/ configurable: false,
  1296. /******/ enumerable: true,
  1297. /******/ get: getter
  1298. /******/ });
  1299. /******/ }
  1300. /******/ };
  1301. /******/
  1302. /******/ // getDefaultExport function for compatibility with non-harmony modules
  1303. /******/ __webpack_require__.n = function(module) {
  1304. /******/ var getter = module && module.__esModule ?
  1305. /******/ function getDefault() { return module['default']; } :
  1306. /******/ function getModuleExports() { return module; };
  1307. /******/ __webpack_require__.d(getter, 'a', getter);
  1308. /******/ return getter;
  1309. /******/ };
  1310. /******/
  1311. /******/ // Object.prototype.hasOwnProperty.call
  1312. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  1313. /******/
  1314. /******/ // __webpack_public_path__
  1315. /******/ __webpack_require__.p = "";
  1316. /******/
  1317. /******/ // Load entry module and return exports
  1318. /******/ return __webpack_require__(__webpack_require__.s = 1);
  1319. /******/ })
  1320. /************************************************************************/
  1321. /******/ ([
  1322. /* 0 */
  1323. /***/ (function(module, exports, __webpack_require__) {
  1324. // Generated from /tmp/tmp-8968NW1IW7LG9m8z/ivprog.g4 by ANTLR 4.7
  1325. // jshint ignore: start
  1326. var antlr4 = __webpack_require__(2);
  1327. var serializedATN = ["\u0003\u608b\ua72a\u8133\ub9ed\u417c\u3be7\u7786\u5964",
  1328. "\u0002/\u01dc\b\u0001\u0004\u0002\t\u0002\u0004\u0003\t\u0003\u0004",
  1329. "\u0004\t\u0004\u0004\u0005\t\u0005\u0004\u0006\t\u0006\u0004\u0007\t",
  1330. "\u0007\u0004\b\t\b\u0004\t\t\t\u0004\n\t\n\u0004\u000b\t\u000b\u0004",
  1331. "\f\t\f\u0004\r\t\r\u0004\u000e\t\u000e\u0004\u000f\t\u000f\u0004\u0010",
  1332. "\t\u0010\u0004\u0011\t\u0011\u0004\u0012\t\u0012\u0004\u0013\t\u0013",
  1333. "\u0004\u0014\t\u0014\u0004\u0015\t\u0015\u0004\u0016\t\u0016\u0004\u0017",
  1334. "\t\u0017\u0004\u0018\t\u0018\u0004\u0019\t\u0019\u0004\u001a\t\u001a",
  1335. "\u0004\u001b\t\u001b\u0004\u001c\t\u001c\u0004\u001d\t\u001d\u0004\u001e",
  1336. "\t\u001e\u0004\u001f\t\u001f\u0004 \t \u0004!\t!\u0004\"\t\"\u0004#",
  1337. "\t#\u0004$\t$\u0004%\t%\u0004&\t&\u0004\'\t\'\u0004(\t(\u0004)\t)\u0004",
  1338. "*\t*\u0004+\t+\u0004,\t,\u0004-\t-\u0004.\t.\u0004/\t/\u00040\t0\u0004",
  1339. "1\t1\u00042\t2\u00043\t3\u00044\t4\u00045\t5\u00046\t6\u00047\t7\u0004",
  1340. "8\t8\u00049\t9\u0003\u0002\u0003\u0002\u0003\u0002\u0003\u0002\u0003",
  1341. "\u0002\u0003\u0002\u0003\u0002\u0003\u0002\u0003\u0002\u0003\u0003\u0003",
  1342. "\u0003\u0003\u0003\u0003\u0003\u0003\u0003\u0003\u0004\u0003\u0004\u0003",
  1343. "\u0004\u0003\u0004\u0003\u0004\u0003\u0004\u0003\u0005\u0003\u0005\u0003",
  1344. "\u0005\u0003\u0005\u0003\u0005\u0003\u0005\u0003\u0005\u0003\u0006\u0003",
  1345. "\u0006\u0003\u0006\u0003\u0006\u0003\u0006\u0003\u0006\u0003\u0006\u0003",
  1346. "\u0007\u0003\u0007\u0003\u0007\u0003\u0007\u0003\u0007\u0003\u0007\u0003",
  1347. "\u0007\u0003\u0007\u0003\b\u0003\b\u0003\b\u0003\b\u0003\b\u0003\b\u0003",
  1348. "\b\u0003\b\u0003\b\u0003\b\u0003\t\u0003\t\u0003\t\u0003\t\u0003\t\u0003",
  1349. "\t\u0003\t\u0003\t\u0003\n\u0003\n\u0003\n\u0003\n\u0003\n\u0003\u000b",
  1350. "\u0003\u000b\u0003\u000b\u0003\u000b\u0003\u000b\u0003\u000b\u0003\u000b",
  1351. "\u0003\u000b\u0003\u000b\u0003\u000b\u0003\f\u0003\f\u0003\f\u0003\f",
  1352. "\u0003\f\u0003\f\u0003\r\u0003\r\u0003\r\u0003\r\u0003\r\u0003\r\u0003",
  1353. "\r\u0003\u000e\u0003\u000e\u0003\u000e\u0003\u000e\u0003\u000e\u0003",
  1354. "\u000e\u0003\u000e\u0003\u000e\u0003\u000f\u0003\u000f\u0003\u000f\u0003",
  1355. "\u000f\u0003\u000f\u0003\u0010\u0003\u0010\u0003\u0010\u0003\u0010\u0003",
  1356. "\u0010\u0003\u0011\u0003\u0011\u0003\u0011\u0003\u0011\u0003\u0011\u0003",
  1357. "\u0012\u0003\u0012\u0003\u0012\u0003\u0012\u0003\u0012\u0003\u0012\u0003",
  1358. "\u0012\u0003\u0012\u0003\u0012\u0003\u0013\u0003\u0013\u0003\u0013\u0003",
  1359. "\u0014\u0003\u0014\u0003\u0014\u0003\u0014\u0003\u0014\u0003\u0014\u0003",
  1360. "\u0015\u0003\u0015\u0003\u0015\u0003\u0015\u0003\u0015\u0003\u0015\u0003",
  1361. "\u0016\u0003\u0016\u0003\u0016\u0003\u0016\u0003\u0016\u0003\u0016\u0003",
  1362. "\u0016\u0003\u0016\u0003\u0016\u0003\u0016\u0003\u0016\u0003\u0017\u0003",
  1363. "\u0017\u0003\u0017\u0003\u0017\u0003\u0018\u0003\u0018\u0003\u0019\u0003",
  1364. "\u0019\u0003\u0019\u0003\u001a\u0003\u001a\u0003\u001b\u0003\u001b\u0003",
  1365. "\u001c\u0003\u001c\u0003\u001d\u0003\u001d\u0003\u001e\u0003\u001e\u0003",
  1366. "\u001f\u0003\u001f\u0003 \u0003 \u0003!\u0003!\u0003\"\u0003\"\u0003",
  1367. "#\u0003#\u0003$\u0003$\u0003%\u0003%\u0003&\u0003&\u0003&\u0003&\u0003",
  1368. "&\u0003&\u0003&\u0003&\u0003&\u0005&\u0130\n&\u0003\'\u0003\'\u0003",
  1369. "(\u0003(\u0003)\u0003)\u0007)\u0138\n)\f)\u000e)\u013b\u000b)\u0003",
  1370. "*\u0003*\u0003*\u0003*\u0003+\u0006+\u0142\n+\r+\u000e+\u0143\u0003",
  1371. "+\u0003+\u0003+\u0003+\u0005+\u014a\n+\u0003+\u0006+\u014d\n+\r+\u000e",
  1372. "+\u014e\u0003+\u0003+\u0003+\u0003+\u0005+\u0155\n+\u0003+\u0006+\u0158",
  1373. "\n+\r+\u000e+\u0159\u0005+\u015c\n+\u0003,\u0006,\u015f\n,\r,\u000e",
  1374. ",\u0160\u0003,\u0003,\u0006,\u0165\n,\r,\u000e,\u0166\u0003,\u0006,",
  1375. "\u016a\n,\r,\u000e,\u016b\u0003,\u0003,\u0007,\u0170\n,\f,\u000e,\u0173",
  1376. "\u000b,\u0003,\u0005,\u0176\n,\u0003-\u0003-\u0005-\u017a\n-\u0003-",
  1377. "\u0006-\u017d\n-\r-\u000e-\u017e\u0003.\u0003.\u0007.\u0183\n.\f.\u000e",
  1378. ".\u0186\u000b.\u0003.\u0003.\u0003/\u0003/\u0005/\u018c\n/\u00030\u0003",
  1379. "0\u00030\u00050\u0191\n0\u00030\u00030\u00031\u00031\u00031\u00031\u0003",
  1380. "2\u00032\u00033\u00063\u019c\n3\r3\u000e3\u019d\u00033\u00053\u01a1",
  1381. "\n3\u00034\u00034\u00035\u00035\u00036\u00036\u00036\u00036\u00056\u01ab",
  1382. "\n6\u00037\u00037\u00037\u00037\u00037\u00037\u00037\u00037\u00037\u0003",
  1383. "7\u00037\u00057\u01b8\n7\u00038\u00038\u00038\u00038\u00038\u00038\u0003",
  1384. "8\u00039\u00039\u00039\u00039\u00079\u01c5\n9\f9\u000e9\u01c8\u000b",
  1385. "9\u00039\u00059\u01cb\n9\u00039\u00039\u00039\u00039\u00039\u00079\u01d2",
  1386. "\n9\f9\u000e9\u01d5\u000b9\u00039\u00039\u00059\u01d9\n9\u00039\u0003",
  1387. "9\u0003\u01d3\u0002:\u0003\u0003\u0005\u0004\u0007\u0005\t\u0006\u000b",
  1388. "\u0007\r\b\u000f\t\u0011\n\u0013\u000b\u0015\f\u0017\r\u0019\u000e\u001b",
  1389. "\u000f\u001d\u0010\u001f\u0011!\u0012#\u0013%\u0014\'\u0015)\u0016+",
  1390. "\u0017-\u0002/\u00021\u00023\u00185\u00197\u001a9\u001b;\u001c=\u001d",
  1391. "?\u001eA\u001fC E!G\"I#K$M%O&Q\'S(U)W*Y\u0002[+]\u0002_,a-c\u0002e.",
  1392. "g\u0002i\u0002k\u0002m\u0002o\u0002q/\u0003\u0002\u0012\u0004\u0002",
  1393. "--//\u0005\u0002\'\',,11\u0004\u0002>>@@\u0005\u0002C\\aac|\u0006\u0002",
  1394. "2;C\\aac|\u0003\u00022;\u0003\u000223\u0004\u0002GGgg\u0006\u0002\f",
  1395. "\f\u000f\u000f$$^^\u0006\u0002\f\f\u000f\u000f))^^\u0004\u0002\u000b",
  1396. "\u000b\"\"\u0004\u0002\f\f\u000f\u000f\u0005\u00022;CHch\u0003\u0002",
  1397. "29\n\u0002$$))^^ddhhppttvv\u0003\u000225\u0002\u01f0\u0002\u0003\u0003",
  1398. "\u0002\u0002\u0002\u0002\u0005\u0003\u0002\u0002\u0002\u0002\u0007\u0003",
  1399. "\u0002\u0002\u0002\u0002\t\u0003\u0002\u0002\u0002\u0002\u000b\u0003",
  1400. "\u0002\u0002\u0002\u0002\r\u0003\u0002\u0002\u0002\u0002\u000f\u0003",
  1401. "\u0002\u0002\u0002\u0002\u0011\u0003\u0002\u0002\u0002\u0002\u0013\u0003",
  1402. "\u0002\u0002\u0002\u0002\u0015\u0003\u0002\u0002\u0002\u0002\u0017\u0003",
  1403. "\u0002\u0002\u0002\u0002\u0019\u0003\u0002\u0002\u0002\u0002\u001b\u0003",
  1404. "\u0002\u0002\u0002\u0002\u001d\u0003\u0002\u0002\u0002\u0002\u001f\u0003",
  1405. "\u0002\u0002\u0002\u0002!\u0003\u0002\u0002\u0002\u0002#\u0003\u0002",
  1406. "\u0002\u0002\u0002%\u0003\u0002\u0002\u0002\u0002\'\u0003\u0002\u0002",
  1407. "\u0002\u0002)\u0003\u0002\u0002\u0002\u0002+\u0003\u0002\u0002\u0002",
  1408. "\u00023\u0003\u0002\u0002\u0002\u00025\u0003\u0002\u0002\u0002\u0002",
  1409. "7\u0003\u0002\u0002\u0002\u00029\u0003\u0002\u0002\u0002\u0002;\u0003",
  1410. "\u0002\u0002\u0002\u0002=\u0003\u0002\u0002\u0002\u0002?\u0003\u0002",
  1411. "\u0002\u0002\u0002A\u0003\u0002\u0002\u0002\u0002C\u0003\u0002\u0002",
  1412. "\u0002\u0002E\u0003\u0002\u0002\u0002\u0002G\u0003\u0002\u0002\u0002",
  1413. "\u0002I\u0003\u0002\u0002\u0002\u0002K\u0003\u0002\u0002\u0002\u0002",
  1414. "M\u0003\u0002\u0002\u0002\u0002O\u0003\u0002\u0002\u0002\u0002Q\u0003",
  1415. "\u0002\u0002\u0002\u0002S\u0003\u0002\u0002\u0002\u0002U\u0003\u0002",
  1416. "\u0002\u0002\u0002W\u0003\u0002\u0002\u0002\u0002[\u0003\u0002\u0002",
  1417. "\u0002\u0002_\u0003\u0002\u0002\u0002\u0002a\u0003\u0002\u0002\u0002",
  1418. "\u0002e\u0003\u0002\u0002\u0002\u0002q\u0003\u0002\u0002\u0002\u0003",
  1419. "s\u0003\u0002\u0002\u0002\u0005|\u0003\u0002\u0002\u0002\u0007\u0081",
  1420. "\u0003\u0002\u0002\u0002\t\u0087\u0003\u0002\u0002\u0002\u000b\u008e",
  1421. "\u0003\u0002\u0002\u0002\r\u0095\u0003\u0002\u0002\u0002\u000f\u009d",
  1422. "\u0003\u0002\u0002\u0002\u0011\u00a7\u0003\u0002\u0002\u0002\u0013\u00af",
  1423. "\u0003\u0002\u0002\u0002\u0015\u00b4\u0003\u0002\u0002\u0002\u0017\u00be",
  1424. "\u0003\u0002\u0002\u0002\u0019\u00c4\u0003\u0002\u0002\u0002\u001b\u00cb",
  1425. "\u0003\u0002\u0002\u0002\u001d\u00d3\u0003\u0002\u0002\u0002\u001f\u00d8",
  1426. "\u0003\u0002\u0002\u0002!\u00dd\u0003\u0002\u0002\u0002#\u00e2\u0003",
  1427. "\u0002\u0002\u0002%\u00eb\u0003\u0002\u0002\u0002\'\u00ee\u0003\u0002",
  1428. "\u0002\u0002)\u00f4\u0003\u0002\u0002\u0002+\u00fa\u0003\u0002\u0002",
  1429. "\u0002-\u0105\u0003\u0002\u0002\u0002/\u0109\u0003\u0002\u0002\u0002",
  1430. "1\u010b\u0003\u0002\u0002\u00023\u010e\u0003\u0002\u0002\u00025\u0110",
  1431. "\u0003\u0002\u0002\u00027\u0112\u0003\u0002\u0002\u00029\u0114\u0003",
  1432. "\u0002\u0002\u0002;\u0116\u0003\u0002\u0002\u0002=\u0118\u0003\u0002",
  1433. "\u0002\u0002?\u011a\u0003\u0002\u0002\u0002A\u011c\u0003\u0002\u0002",
  1434. "\u0002C\u011e\u0003\u0002\u0002\u0002E\u0120\u0003\u0002\u0002\u0002",
  1435. "G\u0122\u0003\u0002\u0002\u0002I\u0124\u0003\u0002\u0002\u0002K\u012f",
  1436. "\u0003\u0002\u0002\u0002M\u0131\u0003\u0002\u0002\u0002O\u0133\u0003",
  1437. "\u0002\u0002\u0002Q\u0135\u0003\u0002\u0002\u0002S\u013c\u0003\u0002",
  1438. "\u0002\u0002U\u015b\u0003\u0002\u0002\u0002W\u0175\u0003\u0002\u0002",
  1439. "\u0002Y\u0177\u0003\u0002\u0002\u0002[\u0180\u0003\u0002\u0002\u0002",
  1440. "]\u018b\u0003\u0002\u0002\u0002_\u018d\u0003\u0002\u0002\u0002a\u0194",
  1441. "\u0003\u0002\u0002\u0002c\u0198\u0003\u0002\u0002\u0002e\u01a0\u0003",
  1442. "\u0002\u0002\u0002g\u01a2\u0003\u0002\u0002\u0002i\u01a4\u0003\u0002",
  1443. "\u0002\u0002k\u01aa\u0003\u0002\u0002\u0002m\u01b7\u0003\u0002\u0002",
  1444. "\u0002o\u01b9\u0003\u0002\u0002\u0002q\u01d8\u0003\u0002\u0002\u0002",
  1445. "st\u0007r\u0002\u0002tu\u0007t\u0002\u0002uv\u0007q\u0002\u0002vw\u0007",
  1446. "i\u0002\u0002wx\u0007t\u0002\u0002xy\u0007c\u0002\u0002yz\u0007o\u0002",
  1447. "\u0002z{\u0007c\u0002\u0002{\u0004\u0003\u0002\u0002\u0002|}\u0007t",
  1448. "\u0002\u0002}~\u0007g\u0002\u0002~\u007f\u0007c\u0002\u0002\u007f\u0080",
  1449. "\u0007n\u0002\u0002\u0080\u0006\u0003\u0002\u0002\u0002\u0081\u0082",
  1450. "\u0007x\u0002\u0002\u0082\u0083\u0007c\u0002\u0002\u0083\u0084\u0007",
  1451. "|\u0002\u0002\u0084\u0085\u0007k\u0002\u0002\u0085\u0086\u0007q\u0002",
  1452. "\u0002\u0086\b\u0003\u0002\u0002\u0002\u0087\u0088\u0007n\u0002\u0002",
  1453. "\u0088\u0089\u0007q\u0002\u0002\u0089\u008a\u0007i\u0002\u0002\u008a",
  1454. "\u008b\u0007k\u0002\u0002\u008b\u008c\u0007e\u0002\u0002\u008c\u008d",
  1455. "\u0007q\u0002\u0002\u008d\n\u0003\u0002\u0002\u0002\u008e\u008f\u0007",
  1456. "e\u0002\u0002\u008f\u0090\u0007c\u0002\u0002\u0090\u0091\u0007f\u0002",
  1457. "\u0002\u0091\u0092\u0007g\u0002\u0002\u0092\u0093\u0007k\u0002\u0002",
  1458. "\u0093\u0094\u0007c\u0002\u0002\u0094\f\u0003\u0002\u0002\u0002\u0095",
  1459. "\u0096\u0007k\u0002\u0002\u0096\u0097\u0007p\u0002\u0002\u0097\u0098",
  1460. "\u0007v\u0002\u0002\u0098\u0099\u0007g\u0002\u0002\u0099\u009a\u0007",
  1461. "k\u0002\u0002\u009a\u009b\u0007t\u0002\u0002\u009b\u009c\u0007q\u0002",
  1462. "\u0002\u009c\u000e\u0003\u0002\u0002\u0002\u009d\u009e\u0007e\u0002",
  1463. "\u0002\u009e\u009f\u0007c\u0002\u0002\u009f\u00a0\u0007t\u0002\u0002",
  1464. "\u00a0\u00a1\u0007c\u0002\u0002\u00a1\u00a2\u0007e\u0002\u0002\u00a2",
  1465. "\u00a3\u0007v\u0002\u0002\u00a3\u00a4\u0007g\u0002\u0002\u00a4\u00a5",
  1466. "\u0007t\u0002\u0002\u00a5\u00a6\u0007g\u0002\u0002\u00a6\u0010\u0003",
  1467. "\u0002\u0002\u0002\u00a7\u00a8\u0007g\u0002\u0002\u00a8\u00a9\u0007",
  1468. "u\u0002\u0002\u00a9\u00aa\u0007e\u0002\u0002\u00aa\u00ab\u0007q\u0002",
  1469. "\u0002\u00ab\u00ac\u0007n\u0002\u0002\u00ac\u00ad\u0007j\u0002\u0002",
  1470. "\u00ad\u00ae\u0007c\u0002\u0002\u00ae\u0012\u0003\u0002\u0002\u0002",
  1471. "\u00af\u00b0\u0007e\u0002\u0002\u00b0\u00b1\u0007c\u0002\u0002\u00b1",
  1472. "\u00b2\u0007u\u0002\u0002\u00b2\u00b3\u0007q\u0002\u0002\u00b3\u0014",
  1473. "\u0003\u0002\u0002\u0002\u00b4\u00b5\u0007e\u0002\u0002\u00b5\u00b6",
  1474. "\u0007q\u0002\u0002\u00b6\u00b7\u0007p\u0002\u0002\u00b7\u00b8\u0007",
  1475. "v\u0002\u0002\u00b8\u00b9\u0007t\u0002\u0002\u00b9\u00ba\u0007c\u0002",
  1476. "\u0002\u00ba\u00bb\u0007t\u0002\u0002\u00bb\u00bc\u0007k\u0002\u0002",
  1477. "\u00bc\u00bd\u0007q\u0002\u0002\u00bd\u0016\u0003\u0002\u0002\u0002",
  1478. "\u00be\u00bf\u0007e\u0002\u0002\u00bf\u00c0\u0007q\u0002\u0002\u00c0",
  1479. "\u00c1\u0007p\u0002\u0002\u00c1\u00c2\u0007u\u0002\u0002\u00c2\u00c3",
  1480. "\u0007v\u0002\u0002\u00c3\u0018\u0003\u0002\u0002\u0002\u00c4\u00c5",
  1481. "\u0007h\u0002\u0002\u00c5\u00c6\u0007w\u0002\u0002\u00c6\u00c7\u0007",
  1482. "p\u0002\u0002\u00c7\u00c8\u0007e\u0002\u0002\u00c8\u00c9\u0007c\u0002",
  1483. "\u0002\u00c9\u00ca\u0007q\u0002\u0002\u00ca\u001a\u0003\u0002\u0002",
  1484. "\u0002\u00cb\u00cc\u0007t\u0002\u0002\u00cc\u00cd\u0007g\u0002\u0002",
  1485. "\u00cd\u00ce\u0007v\u0002\u0002\u00ce\u00cf\u0007q\u0002\u0002\u00cf",
  1486. "\u00d0\u0007t\u0002\u0002\u00d0\u00d1\u0007p\u0002\u0002\u00d1\u00d2",
  1487. "\u0007g\u0002\u0002\u00d2\u001c\u0003\u0002\u0002\u0002\u00d3\u00d4",
  1488. "\u0007r\u0002\u0002\u00d4\u00d5\u0007c\u0002\u0002\u00d5\u00d6\u0007",
  1489. "t\u0002\u0002\u00d6\u00d7\u0007c\u0002\u0002\u00d7\u001e\u0003\u0002",
  1490. "\u0002\u0002\u00d8\u00d9\u0007r\u0002\u0002\u00d9\u00da\u0007c\u0002",
  1491. "\u0002\u00da\u00db\u0007t\u0002\u0002\u00db\u00dc\u0007g\u0002\u0002",
  1492. "\u00dc \u0003\u0002\u0002\u0002\u00dd\u00de\u0007h\u0002\u0002\u00de",
  1493. "\u00df\u0007c\u0002\u0002\u00df\u00e0\u0007e\u0002\u0002\u00e0\u00e1",
  1494. "\u0007c\u0002\u0002\u00e1\"\u0003\u0002\u0002\u0002\u00e2\u00e3\u0007",
  1495. "g\u0002\u0002\u00e3\u00e4\u0007p\u0002\u0002\u00e4\u00e5\u0007s\u0002",
  1496. "\u0002\u00e5\u00e6\u0007w\u0002\u0002\u00e6\u00e7\u0007c\u0002\u0002",
  1497. "\u00e7\u00e8\u0007p\u0002\u0002\u00e8\u00e9\u0007v\u0002\u0002\u00e9",
  1498. "\u00ea\u0007q\u0002\u0002\u00ea$\u0003\u0002\u0002\u0002\u00eb\u00ec",
  1499. "\u0007u\u0002\u0002\u00ec\u00ed\u0007g\u0002\u0002\u00ed&\u0003\u0002",
  1500. "\u0002\u0002\u00ee\u00ef\u0007u\u0002\u0002\u00ef\u00f0\u0007g\u0002",
  1501. "\u0002\u00f0\u00f1\u0007p\u0002\u0002\u00f1\u00f2\u0007c\u0002\u0002",
  1502. "\u00f2\u00f3\u0007q\u0002\u0002\u00f3(\u0003\u0002\u0002\u0002\u00f4",
  1503. "\u00f5\u0007h\u0002\u0002\u00f5\u00f6\u0007c\u0002\u0002\u00f6\u00f7",
  1504. "\u0007n\u0002\u0002\u00f7\u00f8\u0007u\u0002\u0002\u00f8\u00f9\u0007",
  1505. "q\u0002\u0002\u00f9*\u0003\u0002\u0002\u0002\u00fa\u00fb\u0007x\u0002",
  1506. "\u0002\u00fb\u00fc\u0007g\u0002\u0002\u00fc\u00fd\u0007t\u0002\u0002",
  1507. "\u00fd\u00fe\u0007f\u0002\u0002\u00fe\u00ff\u0007c\u0002\u0002\u00ff",
  1508. "\u0100\u0007f\u0002\u0002\u0100\u0101\u0007g\u0002\u0002\u0101\u0102",
  1509. "\u0007k\u0002\u0002\u0102\u0103\u0007t\u0002\u0002\u0103\u0104\u0007",
  1510. "q\u0002\u0002\u0104,\u0003\u0002\u0002\u0002\u0105\u0106\u0007p\u0002",
  1511. "\u0002\u0106\u0107\u0007c\u0002\u0002\u0107\u0108\u0007q\u0002\u0002",
  1512. "\u0108.\u0003\u0002\u0002\u0002\u0109\u010a\u0007G\u0002\u0002\u010a",
  1513. "0\u0003\u0002\u0002\u0002\u010b\u010c\u0007Q\u0002\u0002\u010c\u010d",
  1514. "\u0007W\u0002\u0002\u010d2\u0003\u0002\u0002\u0002\u010e\u010f\u0007",
  1515. "*\u0002\u0002\u010f4\u0003\u0002\u0002\u0002\u0110\u0111\u0007+\u0002",
  1516. "\u0002\u01116\u0003\u0002\u0002\u0002\u0112\u0113\u0007]\u0002\u0002",
  1517. "\u01138\u0003\u0002\u0002\u0002\u0114\u0115\u0007_\u0002\u0002\u0115",
  1518. ":\u0003\u0002\u0002\u0002\u0116\u0117\u0007}\u0002\u0002\u0117<\u0003",
  1519. "\u0002\u0002\u0002\u0118\u0119\u0007\u007f\u0002\u0002\u0119>\u0003",
  1520. "\u0002\u0002\u0002\u011a\u011b\u0007.\u0002\u0002\u011b@\u0003\u0002",
  1521. "\u0002\u0002\u011c\u011d\u0007?\u0002\u0002\u011dB\u0003\u0002\u0002",
  1522. "\u0002\u011e\u011f\t\u0002\u0002\u0002\u011fD\u0003\u0002\u0002\u0002",
  1523. "\u0120\u0121\t\u0003\u0002\u0002\u0121F\u0003\u0002\u0002\u0002\u0122",
  1524. "\u0123\u0005/\u0018\u0002\u0123H\u0003\u0002\u0002\u0002\u0124\u0125",
  1525. "\u00051\u0019\u0002\u0125J\u0003\u0002\u0002\u0002\u0126\u0127\u0007",
  1526. "@\u0002\u0002\u0127\u0130\u0007?\u0002\u0002\u0128\u0129\u0007?\u0002",
  1527. "\u0002\u0129\u0130\u0007?\u0002\u0002\u012a\u012b\u0007>\u0002\u0002",
  1528. "\u012b\u0130\u0007?\u0002\u0002\u012c\u0130\t\u0004\u0002\u0002\u012d",
  1529. "\u012e\u0007#\u0002\u0002\u012e\u0130\u0007?\u0002\u0002\u012f\u0126",
  1530. "\u0003\u0002\u0002\u0002\u012f\u0128\u0003\u0002\u0002\u0002\u012f\u012a",
  1531. "\u0003\u0002\u0002\u0002\u012f\u012c\u0003\u0002\u0002\u0002\u012f\u012d",
  1532. "\u0003\u0002\u0002\u0002\u0130L\u0003\u0002\u0002\u0002\u0131\u0132",
  1533. "\u0007<\u0002\u0002\u0132N\u0003\u0002\u0002\u0002\u0133\u0134\u0005",
  1534. "-\u0017\u0002\u0134P\u0003\u0002\u0002\u0002\u0135\u0139\t\u0005\u0002",
  1535. "\u0002\u0136\u0138\t\u0006\u0002\u0002\u0137\u0136\u0003\u0002\u0002",
  1536. "\u0002\u0138\u013b\u0003\u0002\u0002\u0002\u0139\u0137\u0003\u0002\u0002",
  1537. "\u0002\u0139\u013a\u0003\u0002\u0002\u0002\u013aR\u0003\u0002\u0002",
  1538. "\u0002\u013b\u0139\u0003\u0002\u0002\u0002\u013c\u013d\u0005Q)\u0002",
  1539. "\u013d\u013e\u00070\u0002\u0002\u013e\u013f\u0005Q)\u0002\u013fT\u0003",
  1540. "\u0002\u0002\u0002\u0140\u0142\t\u0007\u0002\u0002\u0141\u0140\u0003",
  1541. "\u0002\u0002\u0002\u0142\u0143\u0003\u0002\u0002\u0002\u0143\u0141\u0003",
  1542. "\u0002\u0002\u0002\u0143\u0144\u0003\u0002\u0002\u0002\u0144\u015c\u0003",
  1543. "\u0002\u0002\u0002\u0145\u0146\u00072\u0002\u0002\u0146\u014a\u0007",
  1544. "z\u0002\u0002\u0147\u0148\u00072\u0002\u0002\u0148\u014a\u0007Z\u0002",
  1545. "\u0002\u0149\u0145\u0003\u0002\u0002\u0002\u0149\u0147\u0003\u0002\u0002",
  1546. "\u0002\u014a\u014c\u0003\u0002\u0002\u0002\u014b\u014d\u0005g4\u0002",
  1547. "\u014c\u014b\u0003\u0002\u0002\u0002\u014d\u014e\u0003\u0002\u0002\u0002",
  1548. "\u014e\u014c\u0003\u0002\u0002\u0002\u014e\u014f\u0003\u0002\u0002\u0002",
  1549. "\u014f\u015c\u0003\u0002\u0002\u0002\u0150\u0151\u00072\u0002\u0002",
  1550. "\u0151\u0155\u0007d\u0002\u0002\u0152\u0153\u00072\u0002\u0002\u0153",
  1551. "\u0155\u0007D\u0002\u0002\u0154\u0150\u0003\u0002\u0002\u0002\u0154",
  1552. "\u0152\u0003\u0002\u0002\u0002\u0155\u0157\u0003\u0002\u0002\u0002\u0156",
  1553. "\u0158\t\b\u0002\u0002\u0157\u0156\u0003\u0002\u0002\u0002\u0158\u0159",
  1554. "\u0003\u0002\u0002\u0002\u0159\u0157\u0003\u0002\u0002\u0002\u0159\u015a",
  1555. "\u0003\u0002\u0002\u0002\u015a\u015c\u0003\u0002\u0002\u0002\u015b\u0141",
  1556. "\u0003\u0002\u0002\u0002\u015b\u0149\u0003\u0002\u0002\u0002\u015b\u0154",
  1557. "\u0003\u0002\u0002\u0002\u015cV\u0003\u0002\u0002\u0002\u015d\u015f",
  1558. "\t\u0007\u0002\u0002\u015e\u015d\u0003\u0002\u0002\u0002\u015f\u0160",
  1559. "\u0003\u0002\u0002\u0002\u0160\u015e\u0003\u0002\u0002\u0002\u0160\u0161",
  1560. "\u0003\u0002\u0002\u0002\u0161\u0162\u0003\u0002\u0002\u0002\u0162\u0164",
  1561. "\u00070\u0002\u0002\u0163\u0165\t\u0007\u0002\u0002\u0164\u0163\u0003",
  1562. "\u0002\u0002\u0002\u0165\u0166\u0003\u0002\u0002\u0002\u0166\u0164\u0003",
  1563. "\u0002\u0002\u0002\u0166\u0167\u0003\u0002\u0002\u0002\u0167\u0176\u0003",
  1564. "\u0002\u0002\u0002\u0168\u016a\t\u0007\u0002\u0002\u0169\u0168\u0003",
  1565. "\u0002\u0002\u0002\u016a\u016b\u0003\u0002\u0002\u0002\u016b\u0169\u0003",
  1566. "\u0002\u0002\u0002\u016b\u016c\u0003\u0002\u0002\u0002\u016c\u016d\u0003",
  1567. "\u0002\u0002\u0002\u016d\u0171\u00070\u0002\u0002\u016e\u0170\t\u0007",
  1568. "\u0002\u0002\u016f\u016e\u0003\u0002\u0002\u0002\u0170\u0173\u0003\u0002",
  1569. "\u0002\u0002\u0171\u016f\u0003\u0002\u0002\u0002\u0171\u0172\u0003\u0002",
  1570. "\u0002\u0002\u0172\u0174\u0003\u0002\u0002\u0002\u0173\u0171\u0003\u0002",
  1571. "\u0002\u0002\u0174\u0176\u0005Y-\u0002\u0175\u015e\u0003\u0002\u0002",
  1572. "\u0002\u0175\u0169\u0003\u0002\u0002\u0002\u0176X\u0003\u0002\u0002",
  1573. "\u0002\u0177\u0179\t\t\u0002\u0002\u0178\u017a\t\u0002\u0002\u0002\u0179",
  1574. "\u0178\u0003\u0002\u0002\u0002\u0179\u017a\u0003\u0002\u0002\u0002\u017a",
  1575. "\u017c\u0003\u0002\u0002\u0002\u017b\u017d\t\u0007\u0002\u0002\u017c",
  1576. "\u017b\u0003\u0002\u0002\u0002\u017d\u017e\u0003\u0002\u0002\u0002\u017e",
  1577. "\u017c\u0003\u0002\u0002\u0002\u017e\u017f\u0003\u0002\u0002\u0002\u017f",
  1578. "Z\u0003\u0002\u0002\u0002\u0180\u0184\u0007$\u0002\u0002\u0181\u0183",
  1579. "\u0005]/\u0002\u0182\u0181\u0003\u0002\u0002\u0002\u0183\u0186\u0003",
  1580. "\u0002\u0002\u0002\u0184\u0182\u0003\u0002\u0002\u0002\u0184\u0185\u0003",
  1581. "\u0002\u0002\u0002\u0185\u0187\u0003\u0002\u0002\u0002\u0186\u0184\u0003",
  1582. "\u0002\u0002\u0002\u0187\u0188\u0007$\u0002\u0002\u0188\\\u0003\u0002",
  1583. "\u0002\u0002\u0189\u018c\n\n\u0002\u0002\u018a\u018c\u0005k6\u0002\u018b",
  1584. "\u0189\u0003\u0002\u0002\u0002\u018b\u018a\u0003\u0002\u0002\u0002\u018c",
  1585. "^\u0003\u0002\u0002\u0002\u018d\u0190\u0007)\u0002\u0002\u018e\u0191",
  1586. "\u0005k6\u0002\u018f\u0191\n\u000b\u0002\u0002\u0190\u018e\u0003\u0002",
  1587. "\u0002\u0002\u0190\u018f\u0003\u0002\u0002\u0002\u0191\u0192\u0003\u0002",
  1588. "\u0002\u0002\u0192\u0193\u0007)\u0002\u0002\u0193`\u0003\u0002\u0002",
  1589. "\u0002\u0194\u0195\t\f\u0002\u0002\u0195\u0196\u0003\u0002\u0002\u0002",
  1590. "\u0196\u0197\b1\u0002\u0002\u0197b\u0003\u0002\u0002\u0002\u0198\u0199",
  1591. "\u0007=\u0002\u0002\u0199d\u0003\u0002\u0002\u0002\u019a\u019c\t\r\u0002",
  1592. "\u0002\u019b\u019a\u0003\u0002\u0002\u0002\u019c\u019d\u0003\u0002\u0002",
  1593. "\u0002\u019d\u019b\u0003\u0002\u0002\u0002\u019d\u019e\u0003\u0002\u0002",
  1594. "\u0002\u019e\u01a1\u0003\u0002\u0002\u0002\u019f\u01a1\u0005c2\u0002",
  1595. "\u01a0\u019b\u0003\u0002\u0002\u0002\u01a0\u019f\u0003\u0002\u0002\u0002",
  1596. "\u01a1f\u0003\u0002\u0002\u0002\u01a2\u01a3\t\u000e\u0002\u0002\u01a3",
  1597. "h\u0003\u0002\u0002\u0002\u01a4\u01a5\t\u000f\u0002\u0002\u01a5j\u0003",
  1598. "\u0002\u0002\u0002\u01a6\u01a7\u0007^\u0002\u0002\u01a7\u01ab\t\u0010",
  1599. "\u0002\u0002\u01a8\u01ab\u0005o8\u0002\u01a9\u01ab\u0005m7\u0002\u01aa",
  1600. "\u01a6\u0003\u0002\u0002\u0002\u01aa\u01a8\u0003\u0002\u0002\u0002\u01aa",
  1601. "\u01a9\u0003\u0002\u0002\u0002\u01abl\u0003\u0002\u0002\u0002\u01ac",
  1602. "\u01ad\u0007^\u0002\u0002\u01ad\u01ae\t\u0011\u0002\u0002\u01ae\u01af",
  1603. "\u0005i5\u0002\u01af\u01b0\u0005i5\u0002\u01b0\u01b8\u0003\u0002\u0002",
  1604. "\u0002\u01b1\u01b2\u0007^\u0002\u0002\u01b2\u01b3\u0005i5\u0002\u01b3",
  1605. "\u01b4\u0005i5\u0002\u01b4\u01b8\u0003\u0002\u0002\u0002\u01b5\u01b6",
  1606. "\u0007^\u0002\u0002\u01b6\u01b8\u0005i5\u0002\u01b7\u01ac\u0003\u0002",
  1607. "\u0002\u0002\u01b7\u01b1\u0003\u0002\u0002\u0002\u01b7\u01b5\u0003\u0002",
  1608. "\u0002\u0002\u01b8n\u0003\u0002\u0002\u0002\u01b9\u01ba\u0007^\u0002",
  1609. "\u0002\u01ba\u01bb\u0007w\u0002\u0002\u01bb\u01bc\u0005g4\u0002\u01bc",
  1610. "\u01bd\u0005g4\u0002\u01bd\u01be\u0005g4\u0002\u01be\u01bf\u0005g4\u0002",
  1611. "\u01bfp\u0003\u0002\u0002\u0002\u01c0\u01c1\u00071\u0002\u0002\u01c1",
  1612. "\u01c2\u00071\u0002\u0002\u01c2\u01c6\u0003\u0002\u0002\u0002\u01c3",
  1613. "\u01c5\n\r\u0002\u0002\u01c4\u01c3\u0003\u0002\u0002\u0002\u01c5\u01c8",
  1614. "\u0003\u0002\u0002\u0002\u01c6\u01c4\u0003\u0002\u0002\u0002\u01c6\u01c7",
  1615. "\u0003\u0002\u0002\u0002\u01c7\u01ca\u0003\u0002\u0002\u0002\u01c8\u01c6",
  1616. "\u0003\u0002\u0002\u0002\u01c9\u01cb\u0007\u000f\u0002\u0002\u01ca\u01c9",
  1617. "\u0003\u0002\u0002\u0002\u01ca\u01cb\u0003\u0002\u0002\u0002\u01cb\u01cc",
  1618. "\u0003\u0002\u0002\u0002\u01cc\u01d9\u0007\f\u0002\u0002\u01cd\u01ce",
  1619. "\u00071\u0002\u0002\u01ce\u01cf\u0007,\u0002\u0002\u01cf\u01d3\u0003",
  1620. "\u0002\u0002\u0002\u01d0\u01d2\u000b\u0002\u0002\u0002\u01d1\u01d0\u0003",
  1621. "\u0002\u0002\u0002\u01d2\u01d5\u0003\u0002\u0002\u0002\u01d3\u01d4\u0003",
  1622. "\u0002\u0002\u0002\u01d3\u01d1\u0003\u0002\u0002\u0002\u01d4\u01d6\u0003",
  1623. "\u0002\u0002\u0002\u01d5\u01d3\u0003\u0002\u0002\u0002\u01d6\u01d7\u0007",
  1624. ",\u0002\u0002\u01d7\u01d9\u00071\u0002\u0002\u01d8\u01c0\u0003\u0002",
  1625. "\u0002\u0002\u01d8\u01cd\u0003\u0002\u0002\u0002\u01d9\u01da\u0003\u0002",
  1626. "\u0002\u0002\u01da\u01db\b9\u0003\u0002\u01dbr\u0003\u0002\u0002\u0002",
  1627. "\u001d\u0002\u012f\u0139\u0143\u0149\u014e\u0154\u0159\u015b\u0160\u0166",
  1628. "\u016b\u0171\u0175\u0179\u017e\u0184\u018b\u0190\u019d\u01a0\u01aa\u01b7",
  1629. "\u01c6\u01ca\u01d3\u01d8\u0004\b\u0002\u0002\u0002\u0003\u0002"].join("");
  1630. var atn = new antlr4.atn.ATNDeserializer().deserialize(serializedATN);
  1631. var decisionsToDFA = atn.decisionToState.map( function(ds, index) { return new antlr4.dfa.DFA(ds, index); });
  1632. function ivprog(input) {
  1633. antlr4.Lexer.call(this, input);
  1634. this._interp = new antlr4.atn.LexerATNSimulator(this, atn, decisionsToDFA, new antlr4.PredictionContextCache());
  1635. return this;
  1636. }
  1637. ivprog.prototype = Object.create(antlr4.Lexer.prototype);
  1638. ivprog.prototype.constructor = ivprog;
  1639. ivprog.EOF = antlr4.Token.EOF;
  1640. ivprog.RK_PROGRAM = 1;
  1641. ivprog.RK_REAL = 2;
  1642. ivprog.RK_VOID = 3;
  1643. ivprog.RK_BOOLEAN = 4;
  1644. ivprog.RK_STRING = 5;
  1645. ivprog.RK_INTEGER = 6;
  1646. ivprog.RK_CHARACTER = 7;
  1647. ivprog.RK_SWITCH = 8;
  1648. ivprog.RK_CASE = 9;
  1649. ivprog.RK_DEFAULT = 10;
  1650. ivprog.RK_CONST = 11;
  1651. ivprog.RK_FUNCTION = 12;
  1652. ivprog.RK_RETURN = 13;
  1653. ivprog.RK_FOR = 14;
  1654. ivprog.RK_BREAK = 15;
  1655. ivprog.RK_DO = 16;
  1656. ivprog.RK_WHILE = 17;
  1657. ivprog.RK_IF = 18;
  1658. ivprog.RK_ELSE = 19;
  1659. ivprog.RK_FALSE = 20;
  1660. ivprog.RK_TRUE = 21;
  1661. ivprog.OPEN_PARENTHESIS = 22;
  1662. ivprog.CLOSE_PARENTHESIS = 23;
  1663. ivprog.OPEN_BRACE = 24;
  1664. ivprog.CLOSE_BRACE = 25;
  1665. ivprog.OPEN_CURLY = 26;
  1666. ivprog.CLOSE_CURLY = 27;
  1667. ivprog.COMMA = 28;
  1668. ivprog.EQUAL = 29;
  1669. ivprog.SUM_OP = 30;
  1670. ivprog.MULTI_OP = 31;
  1671. ivprog.AND_OPERATOR = 32;
  1672. ivprog.OR_OPERATOR = 33;
  1673. ivprog.RELATIONAL_OPERATOR = 34;
  1674. ivprog.COLON = 35;
  1675. ivprog.NOT_OPERATOR = 36;
  1676. ivprog.ID = 37;
  1677. ivprog.LIB_ID = 38;
  1678. ivprog.INTEGER = 39;
  1679. ivprog.REAL = 40;
  1680. ivprog.STRING = 41;
  1681. ivprog.CHARACTER = 42;
  1682. ivprog.WHITESPACE = 43;
  1683. ivprog.EOS = 44;
  1684. ivprog.COMMENTS = 45;
  1685. ivprog.prototype.channelNames = [ "DEFAULT_TOKEN_CHANNEL", "HIDDEN" ];
  1686. ivprog.prototype.modeNames = [ "DEFAULT_MODE" ];
  1687. ivprog.prototype.literalNames = [ null, "'programa'", "'real'", "'vazio'",
  1688. "'logico'", "'cadeia'", "'inteiro'", "'caractere'",
  1689. "'escolha'", "'caso'", "'contrario'",
  1690. "'const'", "'funcao'", "'retorne'", "'para'",
  1691. "'pare'", "'faca'", "'enquanto'", "'se'",
  1692. "'senao'", "'falso'", "'verdadeiro'",
  1693. "'('", "')'", "'['", "']'", "'{'", "'}'",
  1694. "','", "'='", null, null, null, null,
  1695. null, "':'" ];
  1696. ivprog.prototype.symbolicNames = [ null, "RK_PROGRAM", "RK_REAL", "RK_VOID",
  1697. "RK_BOOLEAN", "RK_STRING", "RK_INTEGER",
  1698. "RK_CHARACTER", "RK_SWITCH", "RK_CASE",
  1699. "RK_DEFAULT", "RK_CONST", "RK_FUNCTION",
  1700. "RK_RETURN", "RK_FOR", "RK_BREAK", "RK_DO",
  1701. "RK_WHILE", "RK_IF", "RK_ELSE", "RK_FALSE",
  1702. "RK_TRUE", "OPEN_PARENTHESIS", "CLOSE_PARENTHESIS",
  1703. "OPEN_BRACE", "CLOSE_BRACE", "OPEN_CURLY",
  1704. "CLOSE_CURLY", "COMMA", "EQUAL", "SUM_OP",
  1705. "MULTI_OP", "AND_OPERATOR", "OR_OPERATOR",
  1706. "RELATIONAL_OPERATOR", "COLON", "NOT_OPERATOR",
  1707. "ID", "LIB_ID", "INTEGER", "REAL", "STRING",
  1708. "CHARACTER", "WHITESPACE", "EOS", "COMMENTS" ];
  1709. ivprog.prototype.ruleNames = [ "RK_PROGRAM", "RK_REAL", "RK_VOID", "RK_BOOLEAN",
  1710. "RK_STRING", "RK_INTEGER", "RK_CHARACTER",
  1711. "RK_SWITCH", "RK_CASE", "RK_DEFAULT", "RK_CONST",
  1712. "RK_FUNCTION", "RK_RETURN", "RK_FOR", "RK_BREAK",
  1713. "RK_DO", "RK_WHILE", "RK_IF", "RK_ELSE",
  1714. "RK_FALSE", "RK_TRUE", "RK_LOGICAL_NOT",
  1715. "RK_LOGICAL_AND", "RK_LOGICAL_OR", "OPEN_PARENTHESIS",
  1716. "CLOSE_PARENTHESIS", "OPEN_BRACE", "CLOSE_BRACE",
  1717. "OPEN_CURLY", "CLOSE_CURLY", "COMMA", "EQUAL",
  1718. "SUM_OP", "MULTI_OP", "AND_OPERATOR", "OR_OPERATOR",
  1719. "RELATIONAL_OPERATOR", "COLON", "NOT_OPERATOR",
  1720. "ID", "LIB_ID", "INTEGER", "REAL", "ExponentPart",
  1721. "STRING", "STRING_CHARACTER", "CHARACTER",
  1722. "WHITESPACE", "SEMICOLON", "EOS", "HEX_DIGIT",
  1723. "OCTAL_DIGIT", "ESC_SEQ", "ESC_OCTAL", "ESC_UNICODE",
  1724. "COMMENTS" ];
  1725. ivprog.prototype.grammarFileName = "ivprog.g4";
  1726. exports.ivprog = ivprog;
  1727. /***/ }),
  1728. /* 1 */
  1729. /***/ (function(module, exports, __webpack_require__) {
  1730. module.exports = {
  1731. ivprog: __webpack_require__(0).ivprog
  1732. };
  1733. /***/ }),
  1734. /* 2 */
  1735. /***/ (function(module, exports) {
  1736. module.exports = __webpack_require__(/*! antlr4/index */ "./node_modules/antlr4/index.js");
  1737. /***/ })
  1738. /******/ ]);
  1739. /***/ }),
  1740. /***/ "./grammar/pt/langFunctions.js":
  1741. /*!*************************************!*\
  1742. !*** ./grammar/pt/langFunctions.js ***!
  1743. \*************************************/
  1744. /*! exports provided: default */
  1745. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1746. "use strict";
  1747. __webpack_require__.r(__webpack_exports__);
  1748. /* This is a dictionary of the language defined functions
  1749. **/
  1750. /* harmony default export */ __webpack_exports__["default"] = ({
  1751. main_function: "inicio",
  1752. $read: "leia",
  1753. $write: "escreva",
  1754. $numElements: "total_de_elementos",
  1755. $matrixLines: "total_de_linhas",
  1756. $matrixColumns: "total_de_colunas",
  1757. $substring: "subcadeia",
  1758. $length: "comprimento",
  1759. $uppercase: "caixa_alta",
  1760. $lowercase: "caixa_baixa",
  1761. $charAt: "char_at",
  1762. $isReal: "e_real",
  1763. $isInt: "e_inteiro",
  1764. $isBool: "e_logico",
  1765. $castReal: "como_real",
  1766. $castInt: "como_inteiro",
  1767. $castBool: "como_logico",
  1768. $castString: "como_cadeia",
  1769. $sin: "seno",
  1770. $cos: "cosseno",
  1771. $tan: "tangente",
  1772. $sqrt: "raiz_quadrada",
  1773. $pow: "potencia",
  1774. $log: "logaritmo",
  1775. $abs: "modulo",
  1776. $negate: "trocar_sinal",
  1777. $invert: "inverter_valor",
  1778. $max: "maximo",
  1779. $min: "minimo"
  1780. });
  1781. /***/ }),
  1782. /***/ "./grammar/pt/langLibs.js":
  1783. /*!********************************!*\
  1784. !*** ./grammar/pt/langLibs.js ***!
  1785. \********************************/
  1786. /*! exports provided: default */
  1787. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1788. "use strict";
  1789. __webpack_require__.r(__webpack_exports__);
  1790. /**
  1791. * This is the dictionary of the language defined libraries
  1792. */
  1793. /* harmony default export */ __webpack_exports__["default"] = ({
  1794. $mathLib: "Matematica",
  1795. $ioLib: "ES",
  1796. $strLib: "Texto",
  1797. $arrayLib: "Arranjo",
  1798. $langLib: "Conversao"
  1799. });
  1800. /***/ }),
  1801. /***/ "./i18n/en/error.json":
  1802. /*!****************************!*\
  1803. !*** ./i18n/en/error.json ***!
  1804. \****************************/
  1805. /*! exports provided: token_missing_one, token_missing_two, eos_missing, invalid_type, invalid_array_dimension, invalid_array_size, extra_lines, invalid_main_return, invalid_var_declaration, invalid_break_command, invalid_terminal, const_not_init, id_missing, invalid_id_format, main_missing, invalid_global_var, not_implemented, function_missing, function_missing_full, invalid_parameters_size_full, invalid_parameters_size, invalid_ref_full, invalid_ref, invalid_parameter_type_full, invalid_parameter_type, unknown_command_full, unknown_command, loop_condition_type_full, loop_condition_type, endless_loop_full, endless_loop, for_condition_type_full, for_condition_type, if_condition_type_full, if_condition_type, invalid_return_type_full, invalid_return_type, invalid_void_return_full, invalid_void_return, unexpected_break_command_full, unexpected_break_command, invalid_dimension, void_in_expression_full, void_in_expression, invalid_array_access_full, invalid_array_access, invalid_matrix_access_full, invalid_matrix_access, matrix_column_outbounds_full, matrix_column_outbounds, matrix_line_outbounds_full, matrix_line_outbounds, vector_line_outbounds_full, vector_line_outbounds, vector_not_matrix_full, vector_not_matrix, invalid_infix_op_full, invalid_infix_op, invalid_unary_op_full, invalid_unary_op, unknown_op, duplicate_function, duplicate_variable, main_parameters, symbol_not_found_full, symbol_not_found, array_dimension_not_int_full, array_dimension_not_int, array_dimension_not_positive_full, array_dimension_not_positive, incompatible_types_full, incompatible_types, incompatible_types_array_full, incompatible_types_array, invalid_case_type_full, invalid_case_type, function_no_return, invalid_array_literal_type_full, invalid_array_literal_type, invalid_array_literal_line_full, invalid_array_literal_line, invalid_array_literal_column_full, invalid_array_literal_column, exceeded_input_request, test_case_few_reads, test_case_failed, test_case_failed_exception, default */
  1806. /***/ (function(module) {
  1807. module.exports = {"token_missing_one":"Erro de sintaxe: Espera-se $0, mas encontrou-se $1 na linha:$2, coluna:$3","token_missing_two":"Erro de sintaxe: Esperava-se $0 ou $1 mas encontrou-se $2 na liha:$3, coluna: $4","eos_missing":"Falta uma nova linha ou ; na linha: $0, coluna: $1","invalid_type":"$0 na linha: $1, coluna: $2 é um tipo inválido. Os tipos válidos são: $3","invalid_array_dimension":"A dimensão inválida na linha: $0, coluna: $1. Insira um $2 ou identificador válido do mesmo tipo.","invalid_array_size":"O tamnho do vetor/matriz excede o máximo de 2 na linha $0","extra_lines":"Nenhum texto é permitido após '}' em 'programa {...}'","invalid_main_return":"A função $0 deve retornar $1 na linha $2","invalid_var_declaration":"Erro na linha $0. Variáveis só podem ser declarados no corpo principal da função e de preferência nas primeiras linhas.","invalid_break_command":"Erro na linha $0. O comando $1 não pode ser usado fora de uma estrutura de repetição ou 'escolha...caso'","invalid_terminal":"Não é possível utilizar $0 na expressão da linha: $1, coluna: $2. Tente um valor númerico, variável ou chamada de função.","const_not_init":"Erro na linha: $0, coluna: $1. Uma variável declarada como const deve ser inicializada","id_missing":"Esperava-se um identificador, mas encontrou-se $0 na linha: $1, coluna: $2","invalid_id_format":"$0 na linha: $1, coluna: $2 não é um identificador válido. O símbolo '.' não é permitido neste contexto.","main_missing":"A função principal não foi encontrada","invalid_global_var":"Erro crítico: Chamada inválida da função initGlobal fora do contexto BASE","not_implemented":"Erro interno crítico: A função definida pelo sistema $0 não foi implementada.","function_missing":"A função $0 não foi encontrada","function_missing_full":"A função $0 na linha: $1, coluna: $2 não foi encontrada","invalid_parameters_size_full":"Erro na linha $0: a quantidade de parâmetros fornecidos à função $1 está incorreta. Esperava-se $2, encontrou-se $3.","invalid_parameters_size":"A quantidade de parâmetros fornecidos à função $0 está incorreta. Esperava-se $1, encontrou-se $2","invalid_ref_full":"A expressão $0 fornecida como parâmetro para a função $1 na linha $2 não é válida para esta função. Use uma variável ou posição de vetor.","invalid_ref":"A expressão $0 fornecida como parâmetro para a função $1 não é válida para esta função. Use uma variável ou posição de vetor.","invalid_parameter_type_full":"A expressão $0 fornecida como parâmetro para a função $1 na linha $2 não é compatível com o tipo esperado.","invalid_parameter_type":"A expressão $0 fornecida como parâmetro para a função $1 não é compatível com o tipo esperado.","unknown_command_full":"Erro interno crítico: comando desconhecido encontrado na linha $0","unknown_command":"Erro interno crítico: comando desconhecido encontrado!","loop_condition_type_full":"Erro na linha: $0, coluna $1: a condição $2 do laço de repetição deve ser do tipo lógico","loop_condition_type":"A condição $0 do laço de repetição deve ser do tipo lógico","endless_loop_full":"Possível laço infinito detectado no seu código. Verifique a linha $0","endless_loop":"Possível laço infinito detectado no seu código.","for_condition_type_full":"Erro na linha: $0, coluna $1: a condição de parada $2 do comando para(...) deve ser do tipo lógico","for_condition_type":"A condição de parada $0 do comando para(...) deve ser do tipo lógico","if_condition_type_full":"Erro na linha: $0, coluna $1: a condição $2 do comando se...senao deve ser do tipo lógico","if_condition_type":"A condição $0 do comando se...senao deve ser do tipo lógico","invalid_return_type_full":"Erro na linha $0: a expressão não produz um tipo compatível com a função $1. Tipo esperado: $2.","invalid_return_type":"A expressão não produz um tipo compatível com a função $0. Tipo esperado: $1.","invalid_void_return_full":"Erro na linha $0: a função $1 não pode retornar uma expressão vazia, use uma espressão do tipo $2","invalid_void_return":"A função $0 não pode retornar uma expressão vazia, use uma espressão do tipo $1","unexpected_break_command_full":"Erro interno crítico: comando pare encontrado fora do contexto de um laço/escolha..caso na linha $0","unexpected_break_command":"Erro interno crítico: comando pare encontrado fora do contexto de um laço/escolha..caso","invalid_dimension":"As dimensões de um vetor/matriz devem ser do tipo inteiro","void_in_expression_full":"Erro na linha: $0, coluna: $1: a função $2 não pode ser utilizada em uma expressão pois seu tipo de retorno é vazio","void_in_expression":"A função $0 não pode ser utilizada em uma expressão pois seu tipo de retorno é vazio","invalid_array_access_full":"Identificador $0 na linha: $1, coluna: $2 não se refere a um vetor/matriz válido","invalid_array_access":"Identificador $0 não se refere a um vetor/matriz válido","invalid_matrix_access_full":"Identificador $0 na linha: $1, coluna: $2 não se refere a uma matriz válida","invalid_matrix_access":"Identificador $0 não se refere a uma matriz válida","matrix_column_outbounds_full":"Erro na linha $0: número de colunas $1 é inválido para a matriz $2 que possui $3 colunas","matrix_column_outbounds":"Número de colunas $0 é inválido para a matriz $1 que possui $2 colunas","matrix_line_outbounds_full":"Erro na linha $0: número de linhas $1 é inválido para a matriz $2 que possui $3 linhas","matrix_line_outbounds":"Número de linhas $0 é inválido para a matriz $1 que possui $2 linhas","vector_line_outbounds_full":"Erro na linha $0: número de linhas $1 é inválido para a matriz $2 que possui $3 linhas","vector_line_outbounds":"Número de linhas $0 é inválido para a matriz $1 que possui $2 linhas","vector_not_matrix_full":"Erro na linha $0: $1 não é uma matriz","vector_not_matrix":"$1 não é uma matriz","invalid_infix_op_full":"Erro na linha $0: não é possível aplicar a operação $1 entre os tipos $2 e $3","invalid_infix_op":"Não é possível aplicar a operação $0 entre os tipos $1 e $2","invalid_unary_op_full":"Erro na linha $0: não é possível aplicar a operação $1 ao tipo $2","invalid_unary_op":"Não é possível aplicar a operação $0 ao tipo $1","unknown_op":"Erro interno crítico: Operação $0 desconhecida","duplicate_function":"A função $0 na linha: $1, coluna: $2 já foi definida anteriormente.","duplicate_variable":"A variável $0 na linha: $1, coluna: $2 já foi declarada anteriormente.","main_parameters":"A função inicio não pode ter parâmetros.","symbol_not_found_full":"A variável $0 na linha: $1, coluna: $2 não foi declarada","symbol_not_found":"A variável $0 não foi declarada","array_dimension_not_int_full":"As dimensões de um vetor/matriz na linha: $0 devem ser do tipo inteiro.","array_dimension_not_int":"As dimensões de um vetor/matriz devem ser do tipo inteiro.","array_dimension_not_positive_full":"As dimensões de um vetor/matriz na linha: $0 devem ser valores positivos.","array_dimension_not_positive":"As dimensões de um vetor/matriz devem ser valores positivos.","incompatible_types_full":"O tipo $0 não é compatível com o tipo resultante da expressão na linha $1","incompatible_types":"O tipo $0 não é compatível com o tipo resultante da expressão fornecida.","incompatible_types_array_full":"A expressão $0 é incompatível com o tipo $1 na linha: $2, coluna: $3.","incompatible_types_array":"A expressão $0 é incompatível com o tipo $1.","invalid_case_type_full":"O caso $0 na linha $1 é incompatível com o tipo $2.","invalid_case_type":"O caso $0 é incompatível com o tipo $1.","function_no_return":"A função $0 não possui um retorno acessível. Toda função deve ter ao menos um retorno no seu corpo principal.","invalid_array_literal_type_full":"Erro na linha $0: a expressão $1 não resulta em um tipo compatível.","invalid_array_literal_type":"A expressão $0 não resulta em um tipo compatível.","invalid_array_literal_line_full":"Erro na linha $0: esperava-se $1 linhas mas encontrou $2.","invalid_array_literal_line":"Esperava-se $0 linhas mas encontrou $1.","invalid_array_literal_column_full":"Erro na linha $0: esperava-se $1 colunas mas encontrou $2.","invalid_array_literal_column":"Esperava-se $0 colunas mas encontrou $1.","exceeded_input_request":"A quantidade de leituras requisitadas execedeu a quantidade de entradas disponíveis.","test_case_few_reads":"Caso de teste $0 falhou: ainda restam entradas!","test_case_failed":"Caso de teste $0 falhou: entradas:<$1>; saída esperada:<$2>; saída:<$3>","test_case_failed_exception":"Caso de teste $0 falhou: $1"};
  1808. /***/ }),
  1809. /***/ "./i18n/en/index.js":
  1810. /*!**************************!*\
  1811. !*** ./i18n/en/index.js ***!
  1812. \**************************/
  1813. /*! exports provided: default */
  1814. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1815. "use strict";
  1816. __webpack_require__.r(__webpack_exports__);
  1817. /* harmony import */ var _error_json__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./error.json */ "./i18n/en/error.json");
  1818. var _error_json__WEBPACK_IMPORTED_MODULE_0___namespace = /*#__PURE__*/__webpack_require__.t(/*! ./error.json */ "./i18n/en/error.json", 1);
  1819. /* harmony import */ var _message_json__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./message.json */ "./i18n/en/message.json");
  1820. var _message_json__WEBPACK_IMPORTED_MODULE_1___namespace = /*#__PURE__*/__webpack_require__.t(/*! ./message.json */ "./i18n/en/message.json", 1);
  1821. /* harmony import */ var _ui_json__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./ui.json */ "./i18n/en/ui.json");
  1822. var _ui_json__WEBPACK_IMPORTED_MODULE_2___namespace = /*#__PURE__*/__webpack_require__.t(/*! ./ui.json */ "./i18n/en/ui.json", 1);
  1823. /* harmony default export */ __webpack_exports__["default"] = ({
  1824. 'message': _message_json__WEBPACK_IMPORTED_MODULE_1__,
  1825. 'error': _error_json__WEBPACK_IMPORTED_MODULE_0__,
  1826. 'ui': _ui_json__WEBPACK_IMPORTED_MODULE_2__
  1827. });
  1828. /***/ }),
  1829. /***/ "./i18n/en/message.json":
  1830. /*!******************************!*\
  1831. !*** ./i18n/en/message.json ***!
  1832. \******************************/
  1833. /*! exports provided: test_case_success, test_case_duration, default */
  1834. /***/ (function(module) {
  1835. module.exports = {"test_case_success":"Caso de teste $0: OK","test_case_duration":"Levou $0ms"};
  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, inform_valid_name, inform_valid_content, inform_valid_expression, inform_valid_name_duplicated, inform_valid_global_duplicated, inform_valid_variable_duplicated, arrangement, conversion, $sin, $cos, $tan, $sqrt, $pow, $log, $abs, $negate, $invert, $max, $min, $substring, $length, $uppercase, $lowercase, $charAt, $numElements, $matrixLines, $matrixColumns, $isReal, $isInt, $isBool, $castReal, $castInt, $castBool, $castString, text_ivprog_version, default */
  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":"Relational Expression","text_iftrue":"If true then","text_receives":"receives","text_repeatNtimes":"Repeat N times","text_return":"return","text_btn_return":"Return","text_whiletrue":"While true","text_dowhiletrue":"Do while true","text_switch":"Switch","text_functioncall":"Function call","text_value":"Value","text_operator":"Operator","text_parentheses":"Parentheses","text_change":"Change","text_teacher_algorithm":"Algorithm","text_teacher_algorithm_include":"Include the following algorithm in exercise","text_teacher_test_case":"Test cases","text_teacher_config":"Settings","text_teacher_data_types":"Data types","text_teacher_commands":"Commands","text_teacher_functions":"Functions","text_teacher_create_functions":"Create new functions","text_teacher_create_movement_functions":"Move functions","text_teacher_test_case_input":"Input","text_teacher_test_case_output":"Output","text_teacher_test_case_actions":"Actions","text_teacher_test_case_add":"Add test cases","text_header_ivprog_functions":"iVProg Functions","text_menu_functions_math":"Mathematic","text_menu_functions_text":"Text","text_menu_functions_arrangement":"Arrangement","text_menu_functions_conversion":"Conversion","text_none_variable":"There is no declared variable","text_none_variable_instruction":"Create a new variable to use it","text_ivprog_description":"Interactive Visual Programming on the Internet","tooltip_visual":"Visual programming","tooltip_textual":"Textual programming","tooltip_upload":"Upload code file","tooltip_download":"Download code file","tooltip_undo":"Undo","tooltip_redo":"Redo","tooltip_run":"Run program","tooltip_evaluate":"Evaluate program","tooltip_help":"Help","tooltip_add_global":"Add global variable","tooltip_minimize":"Hidde function elements","tooltip_console":"Open/Close console","var_menu_select_var":"Select a var","var_menu_select_all":"Select","var_menu_select_function":"Select a function","expression_menu_select":"Construct any logical condition","math":"Mathematic","text_t":"Text","inform_valid_name":"Inform a valid name!","inform_valid_content":"Enter some content!","inform_valid_expression":"Construct the logical condition!","inform_valid_name_duplicated":"This name is already in use by other function.","inform_valid_global_duplicated":"A global variable with this name already exists.","inform_valid_variable_duplicated":"A local variable with this name already exists.","arrangement":"Arrangement","conversion":"Conversion","$sin":"sin","$cos":"cos","$tan":"tan","$sqrt":"sqrt","$pow":"pow","$log":"log","$abs":"abs","$negate":"negate","$invert":"invert","$max":"maximum","$min":"minimum","$substring":"substring","$length":"length","$uppercase":"uppercase","$lowercase":"lowercase","$charAt":"char_at","$numElements":"total_of_elements","$matrixLines":"total_of_lines","$matrixColumns":"total_of_columns","$isReal":"is_real","$isInt":"is_integer","$isBool":"is_logic","$castReal":"to_real","$castInt":"to_integer","$castBool":"to_logic","$castString":"to_string","text_ivprog_version":"Version"};
  1844. /***/ }),
  1845. /***/ "./i18n/es/error.json":
  1846. /*!****************************!*\
  1847. !*** ./i18n/es/error.json ***!
  1848. \****************************/
  1849. /*! exports provided: token_missing_one, token_missing_two, eos_missing, invalid_type, invalid_array_dimension, invalid_array_size, extra_lines, invalid_main_return, invalid_var_declaration, invalid_break_command, invalid_terminal, const_not_init, id_missing, invalid_id_format, main_missing, invalid_global_var, not_implemented, function_missing, function_missing_full, invalid_parameters_size_full, invalid_parameters_size, invalid_ref_full, invalid_ref, invalid_parameter_type_full, invalid_parameter_type, unknown_command_full, unknown_command, loop_condition_type_full, loop_condition_type, endless_loop_full, endless_loop, for_condition_type_full, for_condition_type, if_condition_type_full, if_condition_type, invalid_return_type_full, invalid_return_type, invalid_void_return_full, invalid_void_return, unexpected_break_command_full, unexpected_break_command, invalid_dimension, void_in_expression_full, void_in_expression, invalid_array_access_full, invalid_array_access, invalid_matrix_access_full, invalid_matrix_access, matrix_column_outbounds_full, matrix_column_outbounds, matrix_line_outbounds_full, matrix_line_outbounds, vector_line_outbounds_full, vector_line_outbounds, vector_not_matrix_full, vector_not_matrix, invalid_infix_op_full, invalid_infix_op, invalid_unary_op_full, invalid_unary_op, unknown_op, duplicate_function, duplicate_variable, main_parameters, symbol_not_found_full, symbol_not_found, array_dimension_not_int_full, array_dimension_not_int, array_dimension_not_positive_full, array_dimension_not_positive, incompatible_types_full, incompatible_types, incompatible_types_array_full, incompatible_types_array, invalid_case_type_full, invalid_case_type, function_no_return, invalid_array_literal_type_full, invalid_array_literal_type, invalid_array_literal_line_full, invalid_array_literal_line, invalid_array_literal_column_full, invalid_array_literal_column, exceeded_input_request, test_case_few_reads, test_case_failed, test_case_failed_exception, default */
  1850. /***/ (function(module) {
  1851. module.exports = {"token_missing_one":"Erro de sintaxe: Espera-se $0, mas encontrou-se $1 na linha:$2, coluna:$3","token_missing_two":"Erro de sintaxe: Esperava-se $0 ou $1 mas encontrou-se $2 na liha:$3, coluna: $4","eos_missing":"Falta uma nova linha ou ; na linha: $0, coluna: $1","invalid_type":"$0 na linha: $1, coluna: $2 é um tipo inválido. Os tipos válidos são: $3","invalid_array_dimension":"A dimensão inválida na linha: $0, coluna: $1. Insira um $2 ou identificador válido do mesmo tipo.","invalid_array_size":"O tamnho do vetor/matriz excede o máximo de 2 na linha $0","extra_lines":"Nenhum texto é permitido após '}' em 'programa {...}'","invalid_main_return":"A função $0 deve retornar $1 na linha $2","invalid_var_declaration":"Erro na linha $0. Variáveis só podem ser declarados no corpo principal da função e de preferência nas primeiras linhas.","invalid_break_command":"Erro na linha $0. O comando $1 não pode ser usado fora de uma estrutura de repetição ou 'escolha...caso'","invalid_terminal":"Não é possível utilizar $0 na expressão da linha: $1, coluna: $2. Tente um valor númerico, variável ou chamada de função.","const_not_init":"Erro na linha: $0, coluna: $1. Uma variável declarada como const deve ser inicializada","id_missing":"Esperava-se um identificador, mas encontrou-se $0 na linha: $1, coluna: $2","invalid_id_format":"$0 na linha: $1, coluna: $2 não é um identificador válido. O símbolo '.' não é permitido neste contexto.","main_missing":"A função principal não foi encontrada","invalid_global_var":"Erro crítico: Chamada inválida da função initGlobal fora do contexto BASE","not_implemented":"Erro interno crítico: A função definida pelo sistema $0 não foi implementada.","function_missing":"A função $0 não foi encontrada","function_missing_full":"A função $0 na linha: $1, coluna: $2 não foi encontrada","invalid_parameters_size_full":"Erro na linha $0: a quantidade de parâmetros fornecidos à função $1 está incorreta. Esperava-se $2, encontrou-se $3.","invalid_parameters_size":"A quantidade de parâmetros fornecidos à função $0 está incorreta. Esperava-se $1, encontrou-se $2","invalid_ref_full":"A expressão $0 fornecida como parâmetro para a função $1 na linha $2 não é válida para esta função. Use uma variável ou posição de vetor.","invalid_ref":"A expressão $0 fornecida como parâmetro para a função $1 não é válida para esta função. Use uma variável ou posição de vetor.","invalid_parameter_type_full":"A expressão $0 fornecida como parâmetro para a função $1 na linha $2 não é compatível com o tipo esperado.","invalid_parameter_type":"A expressão $0 fornecida como parâmetro para a função $1 não é compatível com o tipo esperado.","unknown_command_full":"Erro interno crítico: comando desconhecido encontrado na linha $0","unknown_command":"Erro interno crítico: comando desconhecido encontrado!","loop_condition_type_full":"Erro na linha: $0, coluna $1: a condição $2 do laço de repetição deve ser do tipo lógico","loop_condition_type":"A condição $0 do laço de repetição deve ser do tipo lógico","endless_loop_full":"Possível laço infinito detectado no seu código. Verifique a linha $0","endless_loop":"Possível laço infinito detectado no seu código.","for_condition_type_full":"Erro na linha: $0, coluna $1: a condição de parada $2 do comando para(...) deve ser do tipo lógico","for_condition_type":"A condição de parada $0 do comando para(...) deve ser do tipo lógico","if_condition_type_full":"Erro na linha: $0, coluna $1: a condição $2 do comando se...senao deve ser do tipo lógico","if_condition_type":"A condição $0 do comando se...senao deve ser do tipo lógico","invalid_return_type_full":"Erro na linha $0: a expressão não produz um tipo compatível com a função $1. Tipo esperado: $2.","invalid_return_type":"A expressão não produz um tipo compatível com a função $0. Tipo esperado: $1.","invalid_void_return_full":"Erro na linha $0: a função $1 não pode retornar uma expressão vazia, use uma espressão do tipo $2","invalid_void_return":"A função $0 não pode retornar uma expressão vazia, use uma espressão do tipo $1","unexpected_break_command_full":"Erro interno crítico: comando pare encontrado fora do contexto de um laço/escolha..caso na linha $0","unexpected_break_command":"Erro interno crítico: comando pare encontrado fora do contexto de um laço/escolha..caso","invalid_dimension":"As dimensões de um vetor/matriz devem ser do tipo inteiro","void_in_expression_full":"Erro na linha: $0, coluna: $1: a função $2 não pode ser utilizada em uma expressão pois seu tipo de retorno é vazio","void_in_expression":"A função $0 não pode ser utilizada em uma expressão pois seu tipo de retorno é vazio","invalid_array_access_full":"Identificador $0 na linha: $1, coluna: $2 não se refere a um vetor/matriz válido","invalid_array_access":"Identificador $0 não se refere a um vetor/matriz válido","invalid_matrix_access_full":"Identificador $0 na linha: $1, coluna: $2 não se refere a uma matriz válida","invalid_matrix_access":"Identificador $0 não se refere a uma matriz válida","matrix_column_outbounds_full":"Erro na linha $0: número de colunas $1 é inválido para a matriz $2 que possui $3 colunas","matrix_column_outbounds":"Número de colunas $0 é inválido para a matriz $1 que possui $2 colunas","matrix_line_outbounds_full":"Erro na linha $0: número de linhas $1 é inválido para a matriz $2 que possui $3 linhas","matrix_line_outbounds":"Número de linhas $0 é inválido para a matriz $1 que possui $2 linhas","vector_line_outbounds_full":"Erro na linha $0: número de linhas $1 é inválido para a matriz $2 que possui $3 linhas","vector_line_outbounds":"Número de linhas $0 é inválido para a matriz $1 que possui $2 linhas","vector_not_matrix_full":"Erro na linha $0: $1 não é uma matriz","vector_not_matrix":"$1 não é uma matriz","invalid_infix_op_full":"Erro na linha $0: não é possível aplicar a operação $1 entre os tipos $2 e $3","invalid_infix_op":"Não é possível aplicar a operação $0 entre os tipos $1 e $2","invalid_unary_op_full":"Erro na linha $0: não é possível aplicar a operação $1 ao tipo $2","invalid_unary_op":"Não é possível aplicar a operação $0 ao tipo $1","unknown_op":"Erro interno crítico: Operação $0 desconhecida","duplicate_function":"A função $0 na linha: $1, coluna: $2 já foi definida anteriormente.","duplicate_variable":"A variável $0 na linha: $1, coluna: $2 já foi declarada anteriormente.","main_parameters":"A função inicio não pode ter parâmetros.","symbol_not_found_full":"A variável $0 na linha: $1, coluna: $2 não foi declarada","symbol_not_found":"A variável $0 não foi declarada","array_dimension_not_int_full":"As dimensões de um vetor/matriz na linha: $0 devem ser do tipo inteiro.","array_dimension_not_int":"As dimensões de um vetor/matriz devem ser do tipo inteiro.","array_dimension_not_positive_full":"As dimensões de um vetor/matriz na linha: $0 devem ser valores positivos.","array_dimension_not_positive":"As dimensões de um vetor/matriz devem ser valores positivos.","incompatible_types_full":"O tipo $0 não é compatível com o tipo resultante da expressão na linha $1","incompatible_types":"O tipo $0 não é compatível com o tipo resultante da expressão fornecida.","incompatible_types_array_full":"A expressão $0 é incompatível com o tipo $1 na linha: $2, coluna: $3.","incompatible_types_array":"A expressão $0 é incompatível com o tipo $1.","invalid_case_type_full":"O caso $0 na linha $1 é incompatível com o tipo $2.","invalid_case_type":"O caso $0 é incompatível com o tipo $1.","function_no_return":"A função $0 não possui um retorno acessível. Toda função deve ter ao menos um retorno no seu corpo principal.","invalid_array_literal_type_full":"Erro na linha $0: a expressão $1 não resulta em um tipo compatível.","invalid_array_literal_type":"A expressão $0 não resulta em um tipo compatível.","invalid_array_literal_line_full":"Erro na linha $0: esperava-se $1 linhas mas encontrou $2.","invalid_array_literal_line":"Esperava-se $0 linhas mas encontrou $1.","invalid_array_literal_column_full":"Erro na linha $0: esperava-se $1 colunas mas encontrou $2.","invalid_array_literal_column":"Esperava-se $0 colunas mas encontrou $1.","exceeded_input_request":"A quantidade de leituras requisitadas execedeu a quantidade de entradas disponíveis.","test_case_few_reads":"Caso de teste $0 falhou: ainda restam entradas!","test_case_failed":"Caso de teste $0 falhou: entradas:<$1>; saída esperada:<$2>; saída:<$3>","test_case_failed_exception":"Caso de teste $0 falhou: $1"};
  1852. /***/ }),
  1853. /***/ "./i18n/es/index.js":
  1854. /*!**************************!*\
  1855. !*** ./i18n/es/index.js ***!
  1856. \**************************/
  1857. /*! exports provided: default */
  1858. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1859. "use strict";
  1860. __webpack_require__.r(__webpack_exports__);
  1861. /* harmony import */ var _error_json__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./error.json */ "./i18n/es/error.json");
  1862. var _error_json__WEBPACK_IMPORTED_MODULE_0___namespace = /*#__PURE__*/__webpack_require__.t(/*! ./error.json */ "./i18n/es/error.json", 1);
  1863. /* harmony import */ var _message_json__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./message.json */ "./i18n/es/message.json");
  1864. var _message_json__WEBPACK_IMPORTED_MODULE_1___namespace = /*#__PURE__*/__webpack_require__.t(/*! ./message.json */ "./i18n/es/message.json", 1);
  1865. /* harmony import */ var _ui_json__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./ui.json */ "./i18n/es/ui.json");
  1866. var _ui_json__WEBPACK_IMPORTED_MODULE_2___namespace = /*#__PURE__*/__webpack_require__.t(/*! ./ui.json */ "./i18n/es/ui.json", 1);
  1867. /* harmony default export */ __webpack_exports__["default"] = ({
  1868. 'message': _message_json__WEBPACK_IMPORTED_MODULE_1__,
  1869. 'error': _error_json__WEBPACK_IMPORTED_MODULE_0__,
  1870. 'ui': _ui_json__WEBPACK_IMPORTED_MODULE_2__
  1871. });
  1872. /***/ }),
  1873. /***/ "./i18n/es/message.json":
  1874. /*!******************************!*\
  1875. !*** ./i18n/es/message.json ***!
  1876. \******************************/
  1877. /*! exports provided: test_case_success, test_case_duration, default */
  1878. /***/ (function(module) {
  1879. module.exports = {"test_case_success":"Caso de teste $0: OK","test_case_duration":"Levou $0ms"};
  1880. /***/ }),
  1881. /***/ "./i18n/es/ui.json":
  1882. /*!*************************!*\
  1883. !*** ./i18n/es/ui.json ***!
  1884. \*************************/
  1885. /*! exports provided: function, btn_clear, btn_function, btn_arithmetic_plus, btn_arithmetic_minus, btn_arithmetic_multiplication, btn_arithmetic_division, btn_arithmetic_module, btn_break, btn_case, start, void, integer, real, program, text, text_start, boolean, true, false, variable, command, new_parameter, new_variable, new_global, new_function, vector, text_comment_start, text_comment_main, text_read_var, text_write_var, text_command_read, text_command_write, text_comment, text_attribution, text_if, text_else, text_break, text_for, text_code_while, text_code_do, text_command_do, text_code_switch, text_code_case, text_logic_expression, text_arithmetic_expression, text_iftrue, text_receives, text_repeatNtimes, text_return, text_btn_return, text_whiletrue, text_dowhiletrue, text_switch, text_functioncall, text_value, text_operator, text_parentheses, text_change, text_teacher_algorithm, text_teacher_algorithm_include, text_teacher_test_case, text_teacher_config, text_teacher_data_types, text_teacher_commands, text_teacher_functions, text_teacher_create_functions, text_teacher_create_movement_functions, text_teacher_test_case_input, text_teacher_test_case_output, text_teacher_test_case_actions, text_teacher_test_case_add, text_header_ivprog_functions, text_menu_functions_math, text_menu_functions_text, text_menu_functions_arrangement, text_menu_functions_conversion, text_none_variable, text_none_variable_instruction, text_ivprog_description, tooltip_visual, tooltip_textual, tooltip_upload, tooltip_download, tooltip_undo, tooltip_redo, tooltip_run, tooltip_evaluate, tooltip_help, tooltip_add_global, tooltip_minimize, tooltip_console, var_menu_select_var, var_menu_select_all, var_menu_select_function, expression_menu_select, math, text_t, inform_valid_name, inform_valid_content, inform_valid_expression, inform_valid_name_duplicated, inform_valid_global_duplicated, inform_valid_variable_duplicated, arrangement, conversion, $sin, $cos, $tan, $sqrt, $pow, $log, $abs, $negate, $invert, $max, $min, $substring, $length, $uppercase, $lowercase, $charAt, $numElements, $matrixLines, $matrixColumns, $isReal, $isInt, $isBool, $castReal, $castInt, $castBool, $castString, text_ivprog_version, default */
  1886. /***/ (function(module) {
  1887. module.exports = {"function":"function","btn_clear":"Clear","btn_function":"Function","btn_arithmetic_plus":"Sum","btn_arithmetic_minus":"Minus","btn_arithmetic_multiplication":"Multiplication","btn_arithmetic_division":"Division","btn_arithmetic_module":"Module","btn_break":"Break","btn_case":"Case","start":"start","void":"void","integer":"integer","real":"real","program":"program","text":"string","text_start":"text","boolean":"boolean","true":"true","false":"false","variable":"Variable","command":"Command","new_parameter":"new_parameter","new_variable":"new_variable","new_global":"new_global","new_function":"new_function","vector":"vector","text_comment_start":"Initial comment of function...","text_comment_main":"This is the main function...","text_read_var":"Reading data","text_write_var":"Writing data","text_command_read":"read","text_command_write":"write","text_comment":"Comment","text_attribution":"Attribution","text_if":"if","text_else":"else","text_break":"break","text_for":"for","text_code_while":"while","text_code_do":"do","text_command_do":"do","text_code_switch":"switch","text_code_case":"case","text_logic_expression":"Logic Expression","text_arithmetic_expression":"Relational Expression","text_iftrue":"If true then","text_receives":"receives","text_repeatNtimes":"Repeat N times","text_return":"return","text_btn_return":"Return","text_whiletrue":"While true","text_dowhiletrue":"Do while true","text_switch":"Switch","text_functioncall":"Function call","text_value":"Value","text_operator":"Operator","text_parentheses":"Parentheses","text_change":"Change","text_teacher_algorithm":"Algorithm","text_teacher_algorithm_include":"Include the following algorithm in exercise","text_teacher_test_case":"Test cases","text_teacher_config":"Settings","text_teacher_data_types":"Data types","text_teacher_commands":"Commands","text_teacher_functions":"Functions","text_teacher_create_functions":"Create new functions","text_teacher_create_movement_functions":"Move functions","text_teacher_test_case_input":"Input","text_teacher_test_case_output":"Output","text_teacher_test_case_actions":"Actions","text_teacher_test_case_add":"Add test cases","text_header_ivprog_functions":"iVProg Functions","text_menu_functions_math":"Mathematic","text_menu_functions_text":"Text","text_menu_functions_arrangement":"Arrangement","text_menu_functions_conversion":"Conversion","text_none_variable":"There is no declared variable","text_none_variable_instruction":"Create a new variable to use it","text_ivprog_description":"Interactive Visual Programming on the Internet","tooltip_visual":"Visual programming","tooltip_textual":"Textual programming","tooltip_upload":"Upload code file","tooltip_download":"Download code file","tooltip_undo":"Undo","tooltip_redo":"Redo","tooltip_run":"Run program","tooltip_evaluate":"Evaluate program","tooltip_help":"Help","tooltip_add_global":"Add global variable","tooltip_minimize":"Hidde function elements","tooltip_console":"Open/Close console","var_menu_select_var":"Select a var","var_menu_select_all":"Select","var_menu_select_function":"Select a function","expression_menu_select":"Construct any logical condition","math":"Mathematic","text_t":"Text","inform_valid_name":"Inform a valid name!","inform_valid_content":"Enter some content!","inform_valid_expression":"Construct the logical condition!","inform_valid_name_duplicated":"This name is already in use by other function.","inform_valid_global_duplicated":"A global variable with this name already exists.","inform_valid_variable_duplicated":"A local variable with this name already exists.","arrangement":"Arrangement","conversion":"Conversion","$sin":"sin","$cos":"cos","$tan":"tan","$sqrt":"sqrt","$pow":"pow","$log":"log","$abs":"abs","$negate":"negate","$invert":"invert","$max":"maximum","$min":"minimum","$substring":"substring","$length":"length","$uppercase":"uppercase","$lowercase":"lowercase","$charAt":"char_at","$numElements":"total_of_elements","$matrixLines":"total_of_lines","$matrixColumns":"total_of_columns","$isReal":"is_real","$isInt":"is_integer","$isBool":"is_logic","$castReal":"to_real","$castInt":"to_integer","$castBool":"to_logic","$castString":"to_string","text_ivprog_version":"Version"};
  1888. /***/ }),
  1889. /***/ "./i18n/index.js":
  1890. /*!***********************!*\
  1891. !*** ./i18n/index.js ***!
  1892. \***********************/
  1893. /*! exports provided: default */
  1894. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1895. "use strict";
  1896. __webpack_require__.r(__webpack_exports__);
  1897. /* harmony import */ var _en__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./en */ "./i18n/en/index.js");
  1898. /* harmony import */ var _pt__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./pt */ "./i18n/pt/index.js");
  1899. /* harmony import */ var _es__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./es */ "./i18n/es/index.js");
  1900. /* harmony default export */ __webpack_exports__["default"] = ({
  1901. 'en': _en__WEBPACK_IMPORTED_MODULE_0__["default"],
  1902. 'pt': _pt__WEBPACK_IMPORTED_MODULE_1__["default"],
  1903. 'es': _es__WEBPACK_IMPORTED_MODULE_2__["default"]
  1904. });
  1905. /***/ }),
  1906. /***/ "./i18n/pt/error.json":
  1907. /*!****************************!*\
  1908. !*** ./i18n/pt/error.json ***!
  1909. \****************************/
  1910. /*! exports provided: token_missing_one, token_missing_two, eos_missing, invalid_type, invalid_array_dimension, invalid_array_size, extra_lines, invalid_main_return, invalid_var_declaration, invalid_break_command, invalid_terminal, const_not_init, id_missing, invalid_id_format, main_missing, invalid_global_var, not_implemented, function_missing, function_missing_full, invalid_parameters_size_full, invalid_parameters_size, invalid_ref_full, invalid_ref, invalid_parameter_type_full, invalid_parameter_type, unknown_command_full, unknown_command, loop_condition_type_full, loop_condition_type, endless_loop_full, endless_loop, for_condition_type_full, for_condition_type, if_condition_type_full, if_condition_type, invalid_return_type_full, invalid_return_type, invalid_void_return_full, invalid_void_return, unexpected_break_command_full, unexpected_break_command, invalid_dimension, void_in_expression_full, void_in_expression, invalid_array_access_full, invalid_array_access, invalid_matrix_access_full, invalid_matrix_access, matrix_column_outbounds_full, matrix_column_outbounds, matrix_line_outbounds_full, matrix_line_outbounds, vector_line_outbounds_full, vector_line_outbounds, vector_not_matrix_full, vector_not_matrix, invalid_infix_op_full, invalid_infix_op, invalid_unary_op_full, invalid_unary_op, unknown_op, duplicate_function, duplicate_variable, main_parameters, symbol_not_found_full, symbol_not_found, array_dimension_not_int_full, array_dimension_not_int, array_dimension_not_positive_full, array_dimension_not_positive, incompatible_types_full, incompatible_types, incompatible_types_array_full, incompatible_types_array, invalid_case_type_full, invalid_case_type, function_no_return, invalid_array_literal_type_full, invalid_array_literal_type, invalid_array_literal_line_full, invalid_array_literal_line, invalid_array_literal_column_full, invalid_array_literal_column, exceeded_input_request, test_case_few_reads, test_case_failed, test_case_failed_exception, invalid_type_conversion, default */
  1911. /***/ (function(module) {
  1912. module.exports = {"token_missing_one":"Erro de sintaxe: Espera-se $0, mas encontrou-se $1 na linha:$2, coluna:$3","token_missing_two":"Erro de sintaxe: Esperava-se $0 ou $1 mas encontrou-se $2 na liha:$3, coluna: $4","eos_missing":"Falta uma nova linha ou ; na linha: $0, coluna: $1","invalid_type":"$0 na linha: $1, coluna: $2 é um tipo inválido. Os tipos válidos são: $3","invalid_array_dimension":"A dimensão inválida na linha: $0, coluna: $1. Insira um $2 ou identificador válido do mesmo tipo.","invalid_array_size":"O tamnho do vetor/matriz excede o máximo de 2 na linha $0","extra_lines":"Nenhum texto é permitido após '}' em 'programa {...}'","invalid_main_return":"A função $0 deve retornar $1 na linha $2","invalid_var_declaration":"Erro na linha $0. Variáveis só podem ser declarados no corpo principal da função e de preferência nas primeiras linhas.","invalid_break_command":"Erro na linha $0. O comando $1 não pode ser usado fora de uma estrutura de repetição ou 'escolha...caso'","invalid_terminal":"Não é possível utilizar $0 na expressão da linha: $1, coluna: $2. Tente um valor númerico, variável ou chamada de função.","const_not_init":"Erro na linha: $0, coluna: $1. Uma variável declarada como const deve ser inicializada","id_missing":"Esperava-se um identificador, mas encontrou-se $0 na linha: $1, coluna: $2","invalid_id_format":"$0 na linha: $1, coluna: $2 não é um identificador válido. O símbolo '.' não é permitido neste contexto.","main_missing":"A função principal não foi encontrada","invalid_global_var":"Erro crítico: Chamada inválida da função initGlobal fora do contexto BASE","not_implemented":"Erro interno crítico: A função definida pelo sistema $0 não foi implementada.","function_missing":"A função $0 não foi encontrada","function_missing_full":"A função $0 na linha: $1, coluna: $2 não foi encontrada","invalid_parameters_size_full":"Erro na linha $0: a quantidade de parâmetros fornecidos à função $1 está incorreta. Esperava-se $2, encontrou-se $3.","invalid_parameters_size":"A quantidade de parâmetros fornecidos à função $0 está incorreta. Esperava-se $1, encontrou-se $2","invalid_ref_full":"A expressão $0 fornecida como parâmetro para a função $1 na linha $2 não é válida para esta função. Use uma variável ou posição de vetor.","invalid_ref":"A expressão $0 fornecida como parâmetro para a função $1 não é válida para esta função. Use uma variável ou posição de vetor.","invalid_parameter_type_full":"A expressão $0 fornecida como parâmetro para a função $1 na linha $2 não é compatível com o tipo esperado.","invalid_parameter_type":"A expressão $0 fornecida como parâmetro para a função $1 não é compatível com o tipo esperado.","unknown_command_full":"Erro interno crítico: comando desconhecido encontrado na linha $0","unknown_command":"Erro interno crítico: comando desconhecido encontrado!","loop_condition_type_full":"Erro na linha: $0, coluna $1: a condição $2 do laço de repetição deve ser do tipo lógico","loop_condition_type":"A condição $0 do laço de repetição deve ser do tipo lógico","endless_loop_full":"Possível laço infinito detectado no seu código. Verifique a linha $0","endless_loop":"Possível laço infinito detectado no seu código.","for_condition_type_full":"Erro na linha: $0, coluna $1: a condição de parada $2 do comando para(...) deve ser do tipo lógico","for_condition_type":"A condição de parada $0 do comando para(...) deve ser do tipo lógico","if_condition_type_full":"Erro na linha: $0, coluna $1: a condição $2 do comando se...senao deve ser do tipo lógico","if_condition_type":"A condição $0 do comando se...senao deve ser do tipo lógico","invalid_return_type_full":"Erro na linha $0: a expressão não produz um tipo compatível com a função $1. Tipo esperado: $2.","invalid_return_type":"A expressão não produz um tipo compatível com a função $0. Tipo esperado: $1.","invalid_void_return_full":"Erro na linha $0: a função $1 não pode retornar uma expressão vazia, use uma espressão do tipo $2","invalid_void_return":"A função $0 não pode retornar uma expressão vazia, use uma espressão do tipo $1","unexpected_break_command_full":"Erro interno crítico: comando pare encontrado fora do contexto de um laço/escolha..caso na linha $0","unexpected_break_command":"Erro interno crítico: comando pare encontrado fora do contexto de um laço/escolha..caso","invalid_dimension":"As dimensões de um vetor/matriz devem ser do tipo inteiro","void_in_expression_full":"Erro na linha: $0, coluna: $1: a função $2 não pode ser utilizada em uma expressão pois seu tipo de retorno é vazio","void_in_expression":"A função $0 não pode ser utilizada em uma expressão pois seu tipo de retorno é vazio","invalid_array_access_full":"Identificador $0 na linha: $1, coluna: $2 não se refere a um vetor/matriz válido","invalid_array_access":"Identificador $0 não se refere a um vetor/matriz válido","invalid_matrix_access_full":"Identificador $0 na linha: $1, coluna: $2 não se refere a uma matriz válida","invalid_matrix_access":"Identificador $0 não se refere a uma matriz válida","matrix_column_outbounds_full":"Erro na linha $0: número de colunas $1 é inválido para a matriz $2 que possui $3 colunas","matrix_column_outbounds":"Número de colunas $0 é inválido para a matriz $1 que possui $2 colunas","matrix_line_outbounds_full":"Erro na linha $0: número de linhas $1 é inválido para a matriz $2 que possui $3 linhas","matrix_line_outbounds":"Número de linhas $0 é inválido para a matriz $1 que possui $2 linhas","vector_line_outbounds_full":"Erro na linha $0: número de linhas $1 é inválido para a matriz $2 que possui $3 linhas","vector_line_outbounds":"Número de linhas $0 é inválido para a matriz $1 que possui $2 linhas","vector_not_matrix_full":"Erro na linha $0: $1 não é uma matriz","vector_not_matrix":"$1 não é uma matriz","invalid_infix_op_full":"Erro na linha $0: não é possível aplicar a operação $1 entre os tipos $2 e $3","invalid_infix_op":"Não é possível aplicar a operação $0 entre os tipos $1 e $2","invalid_unary_op_full":"Erro na linha $0: não é possível aplicar a operação $1 ao tipo $2","invalid_unary_op":"Não é possível aplicar a operação $0 ao tipo $1","unknown_op":"Erro interno crítico: Operação $0 desconhecida","duplicate_function":"A função $0 na linha: $1, coluna: $2 já foi definida anteriormente.","duplicate_variable":"A variável $0 na linha: $1, coluna: $2 já foi declarada anteriormente.","main_parameters":"A função inicio não pode ter parâmetros.","symbol_not_found_full":"A variável $0 na linha: $1, coluna: $2 não foi declarada","symbol_not_found":"A variável $0 não foi declarada","array_dimension_not_int_full":"As dimensões de um vetor/matriz na linha: $0 devem ser do tipo inteiro.","array_dimension_not_int":"As dimensões de um vetor/matriz devem ser do tipo inteiro.","array_dimension_not_positive_full":"As dimensões de um vetor/matriz na linha: $0 devem ser valores positivos.","array_dimension_not_positive":"As dimensões de um vetor/matriz devem ser valores positivos.","incompatible_types_full":"O tipo $0 não é compatível com o tipo resultante da expressão na linha $1","incompatible_types":"O tipo $0 não é compatível com o tipo resultante da expressão fornecida.","incompatible_types_array_full":"A expressão $0 é incompatível com o tipo $1 na linha: $2, coluna: $3.","incompatible_types_array":"A expressão $0 é incompatível com o tipo $1.","invalid_case_type_full":"O caso $0 na linha $1 é incompatível com o tipo $2.","invalid_case_type":"O caso $0 é incompatível com o tipo $1.","function_no_return":"A função $0 não possui um retorno acessível. Toda função deve ter ao menos um retorno no seu corpo principal.","invalid_array_literal_type_full":"Erro na linha $0: a expressão $1 não resulta em um tipo compatível.","invalid_array_literal_type":"A expressão $0 não resulta em um tipo compatível.","invalid_array_literal_line_full":"Erro na linha $0: esperava-se $1 linhas mas encontrou $2.","invalid_array_literal_line":"Esperava-se $0 linhas mas encontrou $1.","invalid_array_literal_column_full":"Erro na linha $0: esperava-se $1 colunas mas encontrou $2.","invalid_array_literal_column":"Esperava-se $0 colunas mas encontrou $1.","exceeded_input_request":"A quantidade de leituras requisitadas execedeu a quantidade de entradas disponíveis.","test_case_few_reads":"Caso de teste $0 falhou: ainda restam entradas!","test_case_failed":"Caso de teste $0 falhou: entradas:<$1>; saída esperada:<$2>; saída:<$3>","test_case_failed_exception":"Caso de teste $0 falhou: $1","invalid_type_conversion":"O valor $0 não pode ser convertido para o tipo $1"};
  1913. /***/ }),
  1914. /***/ "./i18n/pt/index.js":
  1915. /*!**************************!*\
  1916. !*** ./i18n/pt/index.js ***!
  1917. \**************************/
  1918. /*! exports provided: default */
  1919. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1920. "use strict";
  1921. __webpack_require__.r(__webpack_exports__);
  1922. /* harmony import */ var _error_json__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./error.json */ "./i18n/pt/error.json");
  1923. var _error_json__WEBPACK_IMPORTED_MODULE_0___namespace = /*#__PURE__*/__webpack_require__.t(/*! ./error.json */ "./i18n/pt/error.json", 1);
  1924. /* harmony import */ var _message_json__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./message.json */ "./i18n/pt/message.json");
  1925. var _message_json__WEBPACK_IMPORTED_MODULE_1___namespace = /*#__PURE__*/__webpack_require__.t(/*! ./message.json */ "./i18n/pt/message.json", 1);
  1926. /* harmony import */ var _ui_json__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./ui.json */ "./i18n/pt/ui.json");
  1927. var _ui_json__WEBPACK_IMPORTED_MODULE_2___namespace = /*#__PURE__*/__webpack_require__.t(/*! ./ui.json */ "./i18n/pt/ui.json", 1);
  1928. /* harmony default export */ __webpack_exports__["default"] = ({
  1929. 'message': _message_json__WEBPACK_IMPORTED_MODULE_1__,
  1930. 'error': _error_json__WEBPACK_IMPORTED_MODULE_0__,
  1931. 'ui': _ui_json__WEBPACK_IMPORTED_MODULE_2__
  1932. });
  1933. /***/ }),
  1934. /***/ "./i18n/pt/message.json":
  1935. /*!******************************!*\
  1936. !*** ./i18n/pt/message.json ***!
  1937. \******************************/
  1938. /*! exports provided: test_case_success, test_case_duration, default */
  1939. /***/ (function(module) {
  1940. module.exports = {"test_case_success":"Caso de teste $0: OK","test_case_duration":"Levou $0ms"};
  1941. /***/ }),
  1942. /***/ "./i18n/pt/ui.json":
  1943. /*!*************************!*\
  1944. !*** ./i18n/pt/ui.json ***!
  1945. \*************************/
  1946. /*! 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, math, text_t, inform_valid_name, inform_valid_content, inform_valid_expression, inform_valid_name_duplicated, inform_valid_global_duplicated, inform_valid_variable_duplicated, arrangement, conversion, $sin, $cos, $tan, $sqrt, $pow, $log, $abs, $negate, $invert, $max, $min, $substring, $length, $uppercase, $lowercase, $charAt, $numElements, $matrixLines, $matrixColumns, $isReal, $isInt, $isBool, $castReal, $castInt, $castBool, $castString, text_ivprog_version, default */
  1947. /***/ (function(module) {
  1948. module.exports = {"function":"funcao","btn_clear":"Limpar","btn_function":"Função","btn_arithmetic_plus":"Adição","btn_arithmetic_minus":"Subtração","btn_arithmetic_multiplication":"Multiplicação","btn_arithmetic_division":"Divisão","btn_arithmetic_module":"Módulo","btn_break":"Pare","btn_case":"Caso","start":"inicio","void":"vazio","integer":"inteiro","and":"E","or":"OU","not":"nao","real":"real","program":"programa","text":"cadeia","text_start":"texto","boolean":"logico","true":"verdadeiro","false":"falso","variable":"Variável","command":"Comando","new_parameter":"novo_parametro","new_variable":"nova_variavel","new_global":"nova_global","new_function":"nova_funcao","vector":"vetor","text_comment_start":"Comentário inicial da função...","text_comment_main":"Esta é a função principal...","text_read_var":"Leitura de dados","text_write_var":"Escrita de dados","text_command_read":"leia","text_command_write":"escreva","text_return":"retorne","text_btn_return":"Retorno","text_comment":"Comentário","join_or":"ou","matrix_string":"matriz de $0","vector_string":"vetor de $0","text_attribution":"Atribuição","text_if":"se","text_break":"pare","text_else":"senao","text_for":"para","text_code_while":"enquanto","text_code_do":"faca","text_command_do":"faça","text_code_switch":"escolha","text_code_case":"caso","text_logic_expression":"Expressão Lógica","text_arithmetic_expression":"Expressão Relacional","text_iftrue":"Se verdadeiro então","text_repeatNtimes":"Repita N vezes","text_receives":"recebe","text_whiletrue":"Enquanto verdadeiro","text_dowhiletrue":"Faça enquanto verdadeiro","text_switch":"Escolha","text_functioncall":"Chamada de função","text_value":"Valor","text_operator":"Operador","text_parentheses":"Parênteses","text_change":"Alterar","text_teacher_algorithm":"Algoritmo","text_teacher_algorithm_include":"Incluir o algoritmo abaixo no exercício","text_teacher_test_case":"Casos de teste","text_teacher_config":"Configurações","text_teacher_data_types":"Tipos de dados","text_teacher_commands":"Comandos","text_teacher_functions":"Funções","text_teacher_create_functions":"Criar novas funções","text_teacher_create_movement_functions":"Movimentar funções","text_teacher_test_case_input":"Entrada","text_teacher_test_case_output":"Saída","text_teacher_test_case_actions":"Ações","text_teacher_test_case_add":"Adicionar caso de teste","text_header_ivprog_functions":"Funções do iVProg","text_menu_functions_math":"Matemática","text_menu_functions_text":"Texto","text_menu_functions_arrangement":"Arranjo","text_menu_functions_conversion":"Conversão","text_none_variable":"Nenhuma variável declarada","text_none_variable_instruction":"Antes de utilizar uma variável, é necessário criá-la","text_ivprog_description":"Programação Visual interativa na Internet","tooltip_visual":"Programação visual","tooltip_textual":"Programação textual","tooltip_upload":"Upload de código fonte","tooltip_download":"Download do código fonte","tooltip_undo":"Desfazer","tooltip_redo":"Refazer","tooltip_run":"Executar o programa","tooltip_evaluate":"Avaliar o programa","tooltip_help":"Ajuda","tooltip_add_global":"Adicionar variável global","tooltip_minimize":"Ocultar os elementos da função","tooltip_console":"Abrir/fechar o terminal","var_menu_select_var":"Selecione uma variável","var_menu_select_all":"Selecione","var_menu_select_function":"Selecione uma função","expression_menu_select":"Construir uma expressão lógica","math":"Matematica","text_t":"Texto","inform_valid_name":"Informe um nome válido!","inform_valid_content":"Informe o conteúdo!","inform_valid_expression":"Construa uma expressão lógica!","inform_valid_name_duplicated":"Este nome já está em uso por outra função!","inform_valid_global_duplicated":"Já existe uma variável global com o nome informado.","inform_valid_variable_duplicated":"Já existe uma variável local com o nome informado.","arrangement":"Arranjo","conversion":"Conversao","$sin":"seno","$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"};
  1949. /***/ }),
  1950. /***/ "./js/Sortable.js":
  1951. /*!************************!*\
  1952. !*** ./js/Sortable.js ***!
  1953. \************************/
  1954. /*! no static exports found */
  1955. /***/ (function(module, exports, __webpack_require__) {
  1956. var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  1957. /**!
  1958. * Sortable
  1959. * @author RubaXa <trash@rubaxa.org>
  1960. * @license MIT
  1961. */
  1962. (function sortableModule(factory) {
  1963. "use strict";
  1964. if (true) {
  1965. !(__WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
  1966. __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
  1967. (__WEBPACK_AMD_DEFINE_FACTORY__.call(exports, __webpack_require__, exports, module)) :
  1968. __WEBPACK_AMD_DEFINE_FACTORY__),
  1969. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  1970. } else {}
  1971. })(function sortableFactory() {
  1972. "use strict";
  1973. if (typeof window == "undefined" || !window.document) {
  1974. return function sortableError() {
  1975. throw new Error("Sortable.js requires a window with a document");
  1976. };
  1977. }
  1978. var dragEl,
  1979. parentEl,
  1980. ghostEl,
  1981. cloneEl,
  1982. rootEl,
  1983. nextEl,
  1984. lastDownEl,
  1985. scrollEl,
  1986. scrollParentEl,
  1987. scrollCustomFn,
  1988. lastEl,
  1989. lastCSS,
  1990. lastParentCSS,
  1991. oldIndex,
  1992. newIndex,
  1993. activeGroup,
  1994. putSortable,
  1995. autoScroll = {},
  1996. tapEvt,
  1997. touchEvt,
  1998. moved,
  1999. /** @const */
  2000. R_SPACE = /\s+/g,
  2001. R_FLOAT = /left|right|inline/,
  2002. expando = 'Sortable' + new Date().getTime(),
  2003. win = window,
  2004. document = win.document,
  2005. parseInt = win.parseInt,
  2006. $ = win.jQuery || win.Zepto,
  2007. Polymer = win.Polymer,
  2008. captureMode = false,
  2009. supportDraggable = !!('draggable' in document.createElement('div')),
  2010. supportCssPointerEvents = function (el) {
  2011. // false when IE11
  2012. if (!!navigator.userAgent.match(/Trident.*rv[ :]?11\./)) {
  2013. return false;
  2014. }
  2015. el = document.createElement('x');
  2016. el.style.cssText = 'pointer-events:auto';
  2017. return el.style.pointerEvents === 'auto';
  2018. }(),
  2019. _silent = false,
  2020. abs = Math.abs,
  2021. min = Math.min,
  2022. savedInputChecked = [],
  2023. touchDragOverListeners = [],
  2024. _autoScroll = _throttle(function (
  2025. /**Event*/
  2026. evt,
  2027. /**Object*/
  2028. options,
  2029. /**HTMLElement*/
  2030. rootEl) {
  2031. // Bug: https://bugzilla.mozilla.org/show_bug.cgi?id=505521
  2032. if (rootEl && options.scroll) {
  2033. var _this = rootEl[expando],
  2034. el,
  2035. rect,
  2036. sens = options.scrollSensitivity,
  2037. speed = options.scrollSpeed,
  2038. x = evt.clientX,
  2039. y = evt.clientY,
  2040. winWidth = window.innerWidth,
  2041. winHeight = window.innerHeight,
  2042. vx,
  2043. vy,
  2044. scrollOffsetX,
  2045. scrollOffsetY; // Delect scrollEl
  2046. if (scrollParentEl !== rootEl) {
  2047. scrollEl = options.scroll;
  2048. scrollParentEl = rootEl;
  2049. scrollCustomFn = options.scrollFn;
  2050. if (scrollEl === true) {
  2051. scrollEl = rootEl;
  2052. do {
  2053. if (scrollEl.offsetWidth < scrollEl.scrollWidth || scrollEl.offsetHeight < scrollEl.scrollHeight) {
  2054. break;
  2055. }
  2056. /* jshint boss:true */
  2057. } while (scrollEl = scrollEl.parentNode);
  2058. }
  2059. }
  2060. if (scrollEl) {
  2061. el = scrollEl;
  2062. rect = scrollEl.getBoundingClientRect();
  2063. vx = (abs(rect.right - x) <= sens) - (abs(rect.left - x) <= sens);
  2064. vy = (abs(rect.bottom - y) <= sens) - (abs(rect.top - y) <= sens);
  2065. }
  2066. if (!(vx || vy)) {
  2067. vx = (winWidth - x <= sens) - (x <= sens);
  2068. vy = (winHeight - y <= sens) - (y <= sens);
  2069. /* jshint expr:true */
  2070. (vx || vy) && (el = win);
  2071. }
  2072. if (autoScroll.vx !== vx || autoScroll.vy !== vy || autoScroll.el !== el) {
  2073. autoScroll.el = el;
  2074. autoScroll.vx = vx;
  2075. autoScroll.vy = vy;
  2076. clearInterval(autoScroll.pid);
  2077. if (el) {
  2078. autoScroll.pid = setInterval(function () {
  2079. scrollOffsetY = vy ? vy * speed : 0;
  2080. scrollOffsetX = vx ? vx * speed : 0;
  2081. if ('function' === typeof scrollCustomFn) {
  2082. return scrollCustomFn.call(_this, scrollOffsetX, scrollOffsetY, evt);
  2083. }
  2084. if (el === win) {
  2085. win.scrollTo(win.pageXOffset + scrollOffsetX, win.pageYOffset + scrollOffsetY);
  2086. } else {
  2087. el.scrollTop += scrollOffsetY;
  2088. el.scrollLeft += scrollOffsetX;
  2089. }
  2090. }, 24);
  2091. }
  2092. }
  2093. }
  2094. }, 30),
  2095. _prepareGroup = function _prepareGroup(options) {
  2096. function toFn(value, pull) {
  2097. if (value === void 0 || value === true) {
  2098. value = group.name;
  2099. }
  2100. if (typeof value === 'function') {
  2101. return value;
  2102. } else {
  2103. return function (to, from) {
  2104. var fromGroup = from.options.group.name;
  2105. return pull ? value : value && (value.join ? value.indexOf(fromGroup) > -1 : fromGroup == value);
  2106. };
  2107. }
  2108. }
  2109. var group = {};
  2110. var originalGroup = options.group;
  2111. if (!originalGroup || _typeof(originalGroup) != 'object') {
  2112. originalGroup = {
  2113. name: originalGroup
  2114. };
  2115. }
  2116. group.name = originalGroup.name;
  2117. group.checkPull = toFn(originalGroup.pull, true);
  2118. group.checkPut = toFn(originalGroup.put);
  2119. group.revertClone = originalGroup.revertClone;
  2120. options.group = group;
  2121. };
  2122. /**
  2123. * @class Sortable
  2124. * @param {HTMLElement} el
  2125. * @param {Object} [options]
  2126. */
  2127. function Sortable(el, options) {
  2128. if (!(el && el.nodeType && el.nodeType === 1)) {
  2129. throw 'Sortable: `el` must be HTMLElement, and not ' + {}.toString.call(el);
  2130. }
  2131. this.el = el; // root element
  2132. this.options = options = _extend({}, options); // Export instance
  2133. el[expando] = this; // Default options
  2134. var defaults = {
  2135. group: Math.random(),
  2136. sort: true,
  2137. disabled: false,
  2138. store: null,
  2139. handle: null,
  2140. scroll: true,
  2141. scrollSensitivity: 30,
  2142. scrollSpeed: 10,
  2143. draggable: /[uo]l/i.test(el.nodeName) ? 'li' : '>*',
  2144. ghostClass: 'sortable-ghost',
  2145. chosenClass: 'sortable-chosen',
  2146. dragClass: 'sortable-drag',
  2147. ignore: 'a, img',
  2148. filter: null,
  2149. preventOnFilter: true,
  2150. animation: 0,
  2151. setData: function setData(dataTransfer, dragEl) {
  2152. dataTransfer.setData('Text', dragEl.textContent);
  2153. },
  2154. dropBubble: false,
  2155. dragoverBubble: false,
  2156. dataIdAttr: 'data-id',
  2157. delay: 0,
  2158. forceFallback: false,
  2159. fallbackClass: 'sortable-fallback',
  2160. fallbackOnBody: false,
  2161. fallbackTolerance: 0,
  2162. fallbackOffset: {
  2163. x: 0,
  2164. y: 0
  2165. }
  2166. }; // Set default options
  2167. for (var name in defaults) {
  2168. !(name in options) && (options[name] = defaults[name]);
  2169. }
  2170. _prepareGroup(options); // Bind all private methods
  2171. for (var fn in this) {
  2172. if (fn.charAt(0) === '_' && typeof this[fn] === 'function') {
  2173. this[fn] = this[fn].bind(this);
  2174. }
  2175. } // Setup drag mode
  2176. this.nativeDraggable = options.forceFallback ? false : supportDraggable; // Bind events
  2177. _on(el, 'mousedown', this._onTapStart);
  2178. _on(el, 'touchstart', this._onTapStart);
  2179. _on(el, 'pointerdown', this._onTapStart);
  2180. if (this.nativeDraggable) {
  2181. _on(el, 'dragover', this);
  2182. _on(el, 'dragenter', this);
  2183. }
  2184. touchDragOverListeners.push(this._onDragOver); // Restore sorting
  2185. options.store && this.sort(options.store.get(this));
  2186. }
  2187. Sortable.prototype =
  2188. /** @lends Sortable.prototype */
  2189. {
  2190. constructor: Sortable,
  2191. _onTapStart: function _onTapStart(
  2192. /** Event|TouchEvent */
  2193. evt) {
  2194. var _this = this,
  2195. el = this.el,
  2196. options = this.options,
  2197. preventOnFilter = options.preventOnFilter,
  2198. type = evt.type,
  2199. touch = evt.touches && evt.touches[0],
  2200. target = (touch || evt).target,
  2201. originalTarget = evt.target.shadowRoot && evt.path && evt.path[0] || target,
  2202. filter = options.filter,
  2203. startIndex;
  2204. _saveInputCheckedState(el); // Don't trigger start event when an element is been dragged, otherwise the evt.oldindex always wrong when set option.group.
  2205. if (dragEl) {
  2206. return;
  2207. }
  2208. if (/mousedown|pointerdown/.test(type) && evt.button !== 0 || options.disabled) {
  2209. return; // only left button or enabled
  2210. }
  2211. target = _closest(target, options.draggable, el);
  2212. if (!target) {
  2213. return;
  2214. }
  2215. if (lastDownEl === target) {
  2216. // Ignoring duplicate `down`
  2217. return;
  2218. } // Get the index of the dragged element within its parent
  2219. startIndex = _index(target, options.draggable); // Check filter
  2220. if (typeof filter === 'function') {
  2221. if (filter.call(this, evt, target, this)) {
  2222. _dispatchEvent(_this, originalTarget, 'filter', target, el, startIndex);
  2223. preventOnFilter && evt.preventDefault();
  2224. return; // cancel dnd
  2225. }
  2226. } else if (filter) {
  2227. filter = filter.split(',').some(function (criteria) {
  2228. criteria = _closest(originalTarget, criteria.trim(), el);
  2229. if (criteria) {
  2230. _dispatchEvent(_this, criteria, 'filter', target, el, startIndex);
  2231. return true;
  2232. }
  2233. });
  2234. if (filter) {
  2235. preventOnFilter && evt.preventDefault();
  2236. return; // cancel dnd
  2237. }
  2238. }
  2239. if (options.handle && !_closest(originalTarget, options.handle, el)) {
  2240. return;
  2241. } // Prepare `dragstart`
  2242. this._prepareDragStart(evt, touch, target, startIndex);
  2243. },
  2244. _prepareDragStart: function _prepareDragStart(
  2245. /** Event */
  2246. evt,
  2247. /** Touch */
  2248. touch,
  2249. /** HTMLElement */
  2250. target,
  2251. /** Number */
  2252. startIndex) {
  2253. var _this = this,
  2254. el = _this.el,
  2255. options = _this.options,
  2256. ownerDocument = el.ownerDocument,
  2257. dragStartFn;
  2258. if (target && !dragEl && target.parentNode === el) {
  2259. tapEvt = evt;
  2260. rootEl = el;
  2261. dragEl = target;
  2262. parentEl = dragEl.parentNode;
  2263. nextEl = dragEl.nextSibling;
  2264. lastDownEl = target;
  2265. activeGroup = options.group;
  2266. oldIndex = startIndex;
  2267. this._lastX = (touch || evt).clientX;
  2268. this._lastY = (touch || evt).clientY;
  2269. dragEl.style['will-change'] = 'transform';
  2270. dragStartFn = function dragStartFn() {
  2271. // Delayed drag has been triggered
  2272. // we can re-enable the events: touchmove/mousemove
  2273. _this._disableDelayedDrag(); // Make the element draggable
  2274. dragEl.draggable = _this.nativeDraggable; // Chosen item
  2275. _toggleClass(dragEl, options.chosenClass, true); // Bind the events: dragstart/dragend
  2276. _this._triggerDragStart(evt, touch); // Drag start event
  2277. _dispatchEvent(_this, rootEl, 'choose', dragEl, rootEl, oldIndex);
  2278. }; // Disable "draggable"
  2279. options.ignore.split(',').forEach(function (criteria) {
  2280. _find(dragEl, criteria.trim(), _disableDraggable);
  2281. });
  2282. _on(ownerDocument, 'mouseup', _this._onDrop);
  2283. _on(ownerDocument, 'touchend', _this._onDrop);
  2284. _on(ownerDocument, 'touchcancel', _this._onDrop);
  2285. _on(ownerDocument, 'pointercancel', _this._onDrop);
  2286. _on(ownerDocument, 'selectstart', _this);
  2287. if (options.delay) {
  2288. // If the user moves the pointer or let go the click or touch
  2289. // before the delay has been reached:
  2290. // disable the delayed drag
  2291. _on(ownerDocument, 'mouseup', _this._disableDelayedDrag);
  2292. _on(ownerDocument, 'touchend', _this._disableDelayedDrag);
  2293. _on(ownerDocument, 'touchcancel', _this._disableDelayedDrag);
  2294. _on(ownerDocument, 'mousemove', _this._disableDelayedDrag);
  2295. _on(ownerDocument, 'touchmove', _this._disableDelayedDrag);
  2296. _on(ownerDocument, 'pointermove', _this._disableDelayedDrag);
  2297. _this._dragStartTimer = setTimeout(dragStartFn, options.delay);
  2298. } else {
  2299. dragStartFn();
  2300. }
  2301. }
  2302. },
  2303. _disableDelayedDrag: function _disableDelayedDrag() {
  2304. var ownerDocument = this.el.ownerDocument;
  2305. clearTimeout(this._dragStartTimer);
  2306. _off(ownerDocument, 'mouseup', this._disableDelayedDrag);
  2307. _off(ownerDocument, 'touchend', this._disableDelayedDrag);
  2308. _off(ownerDocument, 'touchcancel', this._disableDelayedDrag);
  2309. _off(ownerDocument, 'mousemove', this._disableDelayedDrag);
  2310. _off(ownerDocument, 'touchmove', this._disableDelayedDrag);
  2311. _off(ownerDocument, 'pointermove', this._disableDelayedDrag);
  2312. },
  2313. _triggerDragStart: function _triggerDragStart(
  2314. /** Event */
  2315. evt,
  2316. /** Touch */
  2317. touch) {
  2318. touch = touch || (evt.pointerType == 'touch' ? evt : null);
  2319. if (touch) {
  2320. // Touch device support
  2321. tapEvt = {
  2322. target: dragEl,
  2323. clientX: touch.clientX,
  2324. clientY: touch.clientY
  2325. };
  2326. this._onDragStart(tapEvt, 'touch');
  2327. } else if (!this.nativeDraggable) {
  2328. this._onDragStart(tapEvt, true);
  2329. } else {
  2330. _on(dragEl, 'dragend', this);
  2331. _on(rootEl, 'dragstart', this._onDragStart);
  2332. }
  2333. try {
  2334. if (document.selection) {
  2335. // Timeout neccessary for IE9
  2336. setTimeout(function () {
  2337. document.selection.empty();
  2338. });
  2339. } else {
  2340. window.getSelection().removeAllRanges();
  2341. }
  2342. } catch (err) {}
  2343. },
  2344. _dragStarted: function _dragStarted() {
  2345. if (rootEl && dragEl) {
  2346. var options = this.options; // Apply effect
  2347. _toggleClass(dragEl, options.ghostClass, true);
  2348. _toggleClass(dragEl, options.dragClass, false);
  2349. Sortable.active = this; // Drag start event
  2350. _dispatchEvent(this, rootEl, 'start', dragEl, rootEl, oldIndex);
  2351. } else {
  2352. this._nulling();
  2353. }
  2354. },
  2355. _emulateDragOver: function _emulateDragOver() {
  2356. if (touchEvt) {
  2357. if (this._lastX === touchEvt.clientX && this._lastY === touchEvt.clientY) {
  2358. return;
  2359. }
  2360. this._lastX = touchEvt.clientX;
  2361. this._lastY = touchEvt.clientY;
  2362. if (!supportCssPointerEvents) {
  2363. _css(ghostEl, 'display', 'none');
  2364. }
  2365. var target = document.elementFromPoint(touchEvt.clientX, touchEvt.clientY),
  2366. parent = target,
  2367. i = touchDragOverListeners.length;
  2368. if (parent) {
  2369. do {
  2370. if (parent[expando]) {
  2371. while (i--) {
  2372. touchDragOverListeners[i]({
  2373. clientX: touchEvt.clientX,
  2374. clientY: touchEvt.clientY,
  2375. target: target,
  2376. rootEl: parent
  2377. });
  2378. }
  2379. break;
  2380. }
  2381. target = parent; // store last element
  2382. }
  2383. /* jshint boss:true */
  2384. while (parent = parent.parentNode);
  2385. }
  2386. if (!supportCssPointerEvents) {
  2387. _css(ghostEl, 'display', '');
  2388. }
  2389. }
  2390. },
  2391. _onTouchMove: function _onTouchMove(
  2392. /**TouchEvent*/
  2393. evt) {
  2394. if (tapEvt) {
  2395. var options = this.options,
  2396. fallbackTolerance = options.fallbackTolerance,
  2397. fallbackOffset = options.fallbackOffset,
  2398. touch = evt.touches ? evt.touches[0] : evt,
  2399. dx = touch.clientX - tapEvt.clientX + fallbackOffset.x,
  2400. dy = touch.clientY - tapEvt.clientY + fallbackOffset.y,
  2401. translate3d = evt.touches ? 'translate3d(' + dx + 'px,' + dy + 'px,0)' : 'translate(' + dx + 'px,' + dy + 'px)'; // only set the status to dragging, when we are actually dragging
  2402. if (!Sortable.active) {
  2403. if (fallbackTolerance && min(abs(touch.clientX - this._lastX), abs(touch.clientY - this._lastY)) < fallbackTolerance) {
  2404. return;
  2405. }
  2406. this._dragStarted();
  2407. } // as well as creating the ghost element on the document body
  2408. this._appendGhost();
  2409. moved = true;
  2410. touchEvt = touch;
  2411. _css(ghostEl, 'webkitTransform', translate3d);
  2412. _css(ghostEl, 'mozTransform', translate3d);
  2413. _css(ghostEl, 'msTransform', translate3d);
  2414. _css(ghostEl, 'transform', translate3d);
  2415. evt.preventDefault();
  2416. }
  2417. },
  2418. _appendGhost: function _appendGhost() {
  2419. if (!ghostEl) {
  2420. var rect = dragEl.getBoundingClientRect(),
  2421. css = _css(dragEl),
  2422. options = this.options,
  2423. ghostRect;
  2424. ghostEl = dragEl.cloneNode(true);
  2425. _toggleClass(ghostEl, options.ghostClass, false);
  2426. _toggleClass(ghostEl, options.fallbackClass, true);
  2427. _toggleClass(ghostEl, options.dragClass, true);
  2428. _css(ghostEl, 'top', rect.top - parseInt(css.marginTop, 10));
  2429. _css(ghostEl, 'left', rect.left - parseInt(css.marginLeft, 10));
  2430. _css(ghostEl, 'width', rect.width);
  2431. _css(ghostEl, 'height', rect.height);
  2432. _css(ghostEl, 'opacity', '0.8');
  2433. _css(ghostEl, 'position', 'fixed');
  2434. _css(ghostEl, 'zIndex', '100000');
  2435. _css(ghostEl, 'pointerEvents', 'none');
  2436. options.fallbackOnBody && document.body.appendChild(ghostEl) || rootEl.appendChild(ghostEl); // Fixing dimensions.
  2437. ghostRect = ghostEl.getBoundingClientRect();
  2438. _css(ghostEl, 'width', rect.width * 2 - ghostRect.width);
  2439. _css(ghostEl, 'height', rect.height * 2 - ghostRect.height);
  2440. }
  2441. },
  2442. _onDragStart: function _onDragStart(
  2443. /**Event*/
  2444. evt,
  2445. /**boolean*/
  2446. useFallback) {
  2447. var dataTransfer = evt.dataTransfer,
  2448. options = this.options;
  2449. this._offUpEvents();
  2450. if (activeGroup.checkPull(this, this, dragEl, evt)) {
  2451. cloneEl = _clone(dragEl);
  2452. cloneEl.draggable = false;
  2453. cloneEl.style['will-change'] = '';
  2454. _css(cloneEl, 'display', 'none');
  2455. _toggleClass(cloneEl, this.options.chosenClass, false);
  2456. rootEl.insertBefore(cloneEl, dragEl);
  2457. _dispatchEvent(this, rootEl, 'clone', dragEl);
  2458. }
  2459. _toggleClass(dragEl, options.dragClass, true);
  2460. if (useFallback) {
  2461. if (useFallback === 'touch') {
  2462. // Bind touch events
  2463. _on(document, 'touchmove', this._onTouchMove);
  2464. _on(document, 'touchend', this._onDrop);
  2465. _on(document, 'touchcancel', this._onDrop);
  2466. _on(document, 'pointermove', this._onTouchMove);
  2467. _on(document, 'pointerup', this._onDrop);
  2468. } else {
  2469. // Old brwoser
  2470. _on(document, 'mousemove', this._onTouchMove);
  2471. _on(document, 'mouseup', this._onDrop);
  2472. }
  2473. this._loopId = setInterval(this._emulateDragOver, 50);
  2474. } else {
  2475. if (dataTransfer) {
  2476. dataTransfer.effectAllowed = 'move';
  2477. options.setData && options.setData.call(this, dataTransfer, dragEl);
  2478. }
  2479. _on(document, 'drop', this);
  2480. setTimeout(this._dragStarted, 0);
  2481. }
  2482. },
  2483. _onDragOver: function _onDragOver(
  2484. /**Event*/
  2485. evt) {
  2486. var el = this.el,
  2487. target,
  2488. dragRect,
  2489. targetRect,
  2490. revert,
  2491. options = this.options,
  2492. group = options.group,
  2493. activeSortable = Sortable.active,
  2494. isOwner = activeGroup === group,
  2495. isMovingBetweenSortable = false,
  2496. canSort = options.sort;
  2497. if (evt.preventDefault !== void 0) {
  2498. evt.preventDefault();
  2499. !options.dragoverBubble && evt.stopPropagation();
  2500. }
  2501. if (dragEl.animated) {
  2502. return;
  2503. }
  2504. moved = true;
  2505. if (activeSortable && !options.disabled && (isOwner ? canSort || (revert = !rootEl.contains(dragEl)) // Reverting item into the original list
  2506. : 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
  2507. ) {
  2508. // Smart auto-scrolling
  2509. _autoScroll(evt, options, this.el);
  2510. if (_silent) {
  2511. return;
  2512. }
  2513. target = _closest(evt.target, options.draggable, el);
  2514. dragRect = dragEl.getBoundingClientRect();
  2515. if (putSortable !== this) {
  2516. putSortable = this;
  2517. isMovingBetweenSortable = true;
  2518. }
  2519. if (revert) {
  2520. _cloneHide(activeSortable, true);
  2521. parentEl = rootEl; // actualization
  2522. if (cloneEl || nextEl) {
  2523. rootEl.insertBefore(dragEl, cloneEl || nextEl);
  2524. } else if (!canSort) {
  2525. rootEl.appendChild(dragEl);
  2526. }
  2527. return;
  2528. }
  2529. if (el.children.length === 0 || el.children[0] === ghostEl || el === evt.target && _ghostIsLast(el, evt)) {
  2530. //assign target only if condition is true
  2531. if (el.children.length !== 0 && el.children[0] !== ghostEl && el === evt.target) {
  2532. target = el.lastElementChild;
  2533. }
  2534. if (target) {
  2535. if (target.animated) {
  2536. return;
  2537. }
  2538. targetRect = target.getBoundingClientRect();
  2539. }
  2540. _cloneHide(activeSortable, isOwner);
  2541. if (_onMove(rootEl, el, dragEl, dragRect, target, targetRect, evt) !== false) {
  2542. if (!dragEl.contains(el)) {
  2543. el.appendChild(dragEl);
  2544. parentEl = el; // actualization
  2545. }
  2546. this._animate(dragRect, dragEl);
  2547. target && this._animate(targetRect, target);
  2548. }
  2549. } else if (target && !target.animated && target !== dragEl && target.parentNode[expando] !== void 0) {
  2550. if (lastEl !== target) {
  2551. lastEl = target;
  2552. lastCSS = _css(target);
  2553. lastParentCSS = _css(target.parentNode);
  2554. }
  2555. targetRect = target.getBoundingClientRect();
  2556. var width = targetRect.right - targetRect.left,
  2557. height = targetRect.bottom - targetRect.top,
  2558. floating = R_FLOAT.test(lastCSS.cssFloat + lastCSS.display) || lastParentCSS.display == 'flex' && lastParentCSS['flex-direction'].indexOf('row') === 0,
  2559. isWide = target.offsetWidth > dragEl.offsetWidth,
  2560. isLong = target.offsetHeight > dragEl.offsetHeight,
  2561. halfway = (floating ? (evt.clientX - targetRect.left) / width : (evt.clientY - targetRect.top) / height) > 0.5,
  2562. nextSibling = target.nextElementSibling,
  2563. after = false;
  2564. if (floating) {
  2565. var elTop = dragEl.offsetTop,
  2566. tgTop = target.offsetTop;
  2567. if (elTop === tgTop) {
  2568. after = target.previousElementSibling === dragEl && !isWide || halfway && isWide;
  2569. } else if (target.previousElementSibling === dragEl || dragEl.previousElementSibling === target) {
  2570. after = (evt.clientY - targetRect.top) / height > 0.5;
  2571. } else {
  2572. after = tgTop > elTop;
  2573. }
  2574. } else if (!isMovingBetweenSortable) {
  2575. after = nextSibling !== dragEl && !isLong || halfway && isLong;
  2576. }
  2577. var moveVector = _onMove(rootEl, el, dragEl, dragRect, target, targetRect, evt, after);
  2578. if (moveVector !== false) {
  2579. if (moveVector === 1 || moveVector === -1) {
  2580. after = moveVector === 1;
  2581. }
  2582. _silent = true;
  2583. setTimeout(_unsilent, 30);
  2584. _cloneHide(activeSortable, isOwner);
  2585. if (!dragEl.contains(el)) {
  2586. if (after && !nextSibling) {
  2587. el.appendChild(dragEl);
  2588. } else {
  2589. target.parentNode.insertBefore(dragEl, after ? nextSibling : target);
  2590. }
  2591. }
  2592. parentEl = dragEl.parentNode; // actualization
  2593. this._animate(dragRect, dragEl);
  2594. this._animate(targetRect, target);
  2595. }
  2596. }
  2597. }
  2598. },
  2599. _animate: function _animate(prevRect, target) {
  2600. var ms = this.options.animation;
  2601. if (ms) {
  2602. var currentRect = target.getBoundingClientRect();
  2603. if (prevRect.nodeType === 1) {
  2604. prevRect = prevRect.getBoundingClientRect();
  2605. }
  2606. _css(target, 'transition', 'none');
  2607. _css(target, 'transform', 'translate3d(' + (prevRect.left - currentRect.left) + 'px,' + (prevRect.top - currentRect.top) + 'px,0)');
  2608. target.offsetWidth; // repaint
  2609. _css(target, 'transition', 'all ' + ms + 'ms');
  2610. _css(target, 'transform', 'translate3d(0,0,0)');
  2611. clearTimeout(target.animated);
  2612. target.animated = setTimeout(function () {
  2613. _css(target, 'transition', '');
  2614. _css(target, 'transform', '');
  2615. target.animated = false;
  2616. }, ms);
  2617. }
  2618. },
  2619. _offUpEvents: function _offUpEvents() {
  2620. var ownerDocument = this.el.ownerDocument;
  2621. _off(document, 'touchmove', this._onTouchMove);
  2622. _off(document, 'pointermove', this._onTouchMove);
  2623. _off(ownerDocument, 'mouseup', this._onDrop);
  2624. _off(ownerDocument, 'touchend', this._onDrop);
  2625. _off(ownerDocument, 'pointerup', this._onDrop);
  2626. _off(ownerDocument, 'touchcancel', this._onDrop);
  2627. _off(ownerDocument, 'pointercancel', this._onDrop);
  2628. _off(ownerDocument, 'selectstart', this);
  2629. },
  2630. _onDrop: function _onDrop(
  2631. /**Event*/
  2632. evt) {
  2633. var el = this.el,
  2634. options = this.options;
  2635. clearInterval(this._loopId);
  2636. clearInterval(autoScroll.pid);
  2637. clearTimeout(this._dragStartTimer); // 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'] = ''; // Remove class's
  2660. _toggleClass(dragEl, this.options.ghostClass, false);
  2661. _toggleClass(dragEl, this.options.chosenClass, false); // Drag stop event
  2662. _dispatchEvent(this, rootEl, 'unchoose', dragEl, rootEl, oldIndex);
  2663. if (rootEl !== parentEl) {
  2664. newIndex = _index(dragEl, options.draggable);
  2665. if (newIndex >= 0) {
  2666. // Add event
  2667. _dispatchEvent(null, parentEl, 'add', dragEl, rootEl, oldIndex, newIndex); // Remove event
  2668. _dispatchEvent(this, rootEl, 'remove', dragEl, rootEl, oldIndex, newIndex); // drag from one list and drop into another
  2669. _dispatchEvent(null, parentEl, 'sort', dragEl, rootEl, oldIndex, newIndex);
  2670. _dispatchEvent(this, rootEl, 'sort', dragEl, rootEl, oldIndex, newIndex);
  2671. }
  2672. } else {
  2673. if (dragEl.nextSibling !== nextEl) {
  2674. // Get the index of the dragged element within its parent
  2675. newIndex = _index(dragEl, options.draggable);
  2676. if (newIndex >= 0) {
  2677. // drag & drop within the same list
  2678. _dispatchEvent(this, rootEl, 'update', dragEl, rootEl, oldIndex, newIndex);
  2679. _dispatchEvent(this, rootEl, 'sort', dragEl, rootEl, oldIndex, newIndex);
  2680. }
  2681. }
  2682. }
  2683. if (Sortable.active) {
  2684. /* jshint eqnull:true */
  2685. if (newIndex == null || newIndex === -1) {
  2686. newIndex = oldIndex;
  2687. }
  2688. _dispatchEvent(this, rootEl, 'end', dragEl, rootEl, oldIndex, newIndex); // Save sorting
  2689. this.save();
  2690. }
  2691. }
  2692. }
  2693. this._nulling();
  2694. },
  2695. _nulling: function _nulling() {
  2696. rootEl = dragEl = parentEl = ghostEl = nextEl = cloneEl = lastDownEl = scrollEl = scrollParentEl = tapEvt = touchEvt = moved = newIndex = lastEl = lastCSS = putSortable = activeGroup = Sortable.active = null;
  2697. savedInputChecked.forEach(function (el) {
  2698. el.checked = true;
  2699. });
  2700. savedInputChecked.length = 0;
  2701. },
  2702. handleEvent: function handleEvent(
  2703. /**Event*/
  2704. evt) {
  2705. switch (evt.type) {
  2706. case 'drop':
  2707. case 'dragend':
  2708. this._onDrop(evt);
  2709. break;
  2710. case 'dragover':
  2711. case 'dragenter':
  2712. if (dragEl) {
  2713. this._onDragOver(evt);
  2714. _globalDragOver(evt);
  2715. }
  2716. break;
  2717. case 'selectstart':
  2718. evt.preventDefault();
  2719. break;
  2720. }
  2721. },
  2722. /**
  2723. * Serializes the item into an array of string.
  2724. * @returns {String[]}
  2725. */
  2726. toArray: function toArray() {
  2727. var order = [],
  2728. el,
  2729. children = this.el.children,
  2730. i = 0,
  2731. n = children.length,
  2732. options = this.options;
  2733. for (; i < n; i++) {
  2734. el = children[i];
  2735. if (_closest(el, options.draggable, this.el)) {
  2736. order.push(el.getAttribute(options.dataIdAttr) || _generateId(el));
  2737. }
  2738. }
  2739. return order;
  2740. },
  2741. /**
  2742. * Sorts the elements according to the array.
  2743. * @param {String[]} order order of the items
  2744. */
  2745. sort: function sort(order) {
  2746. var items = {},
  2747. rootEl = this.el;
  2748. this.toArray().forEach(function (id, i) {
  2749. var el = rootEl.children[i];
  2750. if (_closest(el, this.options.draggable, rootEl)) {
  2751. items[id] = el;
  2752. }
  2753. }, this);
  2754. order.forEach(function (id) {
  2755. if (items[id]) {
  2756. rootEl.removeChild(items[id]);
  2757. rootEl.appendChild(items[id]);
  2758. }
  2759. });
  2760. },
  2761. /**
  2762. * Save the current sorting
  2763. */
  2764. save: function save() {
  2765. var store = this.options.store;
  2766. store && store.set(this);
  2767. },
  2768. /**
  2769. * 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.
  2770. * @param {HTMLElement} el
  2771. * @param {String} [selector] default: `options.draggable`
  2772. * @returns {HTMLElement|null}
  2773. */
  2774. closest: function closest(el, selector) {
  2775. return _closest(el, selector || this.options.draggable, this.el);
  2776. },
  2777. /**
  2778. * Set/get option
  2779. * @param {string} name
  2780. * @param {*} [value]
  2781. * @returns {*}
  2782. */
  2783. option: function option(name, value) {
  2784. var options = this.options;
  2785. if (value === void 0) {
  2786. return options[name];
  2787. } else {
  2788. options[name] = value;
  2789. if (name === 'group') {
  2790. _prepareGroup(options);
  2791. }
  2792. }
  2793. },
  2794. /**
  2795. * Destroy
  2796. */
  2797. destroy: function destroy() {
  2798. var el = this.el;
  2799. el[expando] = null;
  2800. _off(el, 'mousedown', this._onTapStart);
  2801. _off(el, 'touchstart', this._onTapStart);
  2802. _off(el, 'pointerdown', this._onTapStart);
  2803. if (this.nativeDraggable) {
  2804. _off(el, 'dragover', this);
  2805. _off(el, 'dragenter', this);
  2806. } // Remove draggable attributes
  2807. Array.prototype.forEach.call(el.querySelectorAll('[draggable]'), function (el) {
  2808. el.removeAttribute('draggable');
  2809. });
  2810. touchDragOverListeners.splice(touchDragOverListeners.indexOf(this._onDragOver), 1);
  2811. this._onDrop();
  2812. this.el = el = null;
  2813. }
  2814. };
  2815. function _cloneHide(sortable, state) {
  2816. if (sortable.lastPullMode !== 'clone') {
  2817. state = true;
  2818. }
  2819. if (cloneEl && cloneEl.state !== state) {
  2820. _css(cloneEl, 'display', state ? 'none' : '');
  2821. if (!state) {
  2822. if (cloneEl.state) {
  2823. if (sortable.options.group.revertClone) {
  2824. rootEl.insertBefore(cloneEl, nextEl);
  2825. sortable._animate(dragEl, cloneEl);
  2826. } else {
  2827. rootEl.insertBefore(cloneEl, dragEl);
  2828. }
  2829. }
  2830. }
  2831. cloneEl.state = state;
  2832. }
  2833. }
  2834. function _closest(
  2835. /**HTMLElement*/
  2836. el,
  2837. /**String*/
  2838. selector,
  2839. /**HTMLElement*/
  2840. ctx) {
  2841. if (el) {
  2842. ctx = ctx || document;
  2843. do {
  2844. if (selector === '>*' && el.parentNode === ctx || _matches(el, selector)) {
  2845. return el;
  2846. }
  2847. /* jshint boss:true */
  2848. } while (el = _getParentOrHost(el));
  2849. }
  2850. return null;
  2851. }
  2852. function _getParentOrHost(el) {
  2853. var parent = el.host;
  2854. return parent && parent.nodeType ? parent : el.parentNode;
  2855. }
  2856. function _globalDragOver(
  2857. /**Event*/
  2858. evt) {
  2859. if (evt.dataTransfer) {
  2860. evt.dataTransfer.dropEffect = 'move';
  2861. }
  2862. evt.preventDefault();
  2863. }
  2864. function _on(el, event, fn) {
  2865. el.addEventListener(event, fn, captureMode);
  2866. }
  2867. function _off(el, event, fn) {
  2868. el.removeEventListener(event, fn, captureMode);
  2869. }
  2870. function _toggleClass(el, name, state) {
  2871. if (el) {
  2872. if (el.classList) {
  2873. el.classList[state ? 'add' : 'remove'](name);
  2874. } else {
  2875. var className = (' ' + el.className + ' ').replace(R_SPACE, ' ').replace(' ' + name + ' ', ' ');
  2876. el.className = (className + (state ? ' ' + name : '')).replace(R_SPACE, ' ');
  2877. }
  2878. }
  2879. }
  2880. function _css(el, prop, val) {
  2881. var style = el && el.style;
  2882. if (style) {
  2883. if (val === void 0) {
  2884. if (document.defaultView && document.defaultView.getComputedStyle) {
  2885. val = document.defaultView.getComputedStyle(el, '');
  2886. } else if (el.currentStyle) {
  2887. val = el.currentStyle;
  2888. }
  2889. return prop === void 0 ? val : val[prop];
  2890. } else {
  2891. if (!(prop in style)) {
  2892. prop = '-webkit-' + prop;
  2893. }
  2894. style[prop] = val + (typeof val === 'string' ? '' : 'px');
  2895. }
  2896. }
  2897. }
  2898. function _find(ctx, tagName, iterator) {
  2899. if (ctx) {
  2900. var list = ctx.getElementsByTagName(tagName),
  2901. i = 0,
  2902. n = list.length;
  2903. if (iterator) {
  2904. for (; i < n; i++) {
  2905. iterator(list[i], i);
  2906. }
  2907. }
  2908. return list;
  2909. }
  2910. return [];
  2911. }
  2912. function _dispatchEvent(sortable, rootEl, name, targetEl, fromEl, startIndex, newIndex) {
  2913. sortable = sortable || rootEl[expando];
  2914. var evt = document.createEvent('Event'),
  2915. options = sortable.options,
  2916. onName = 'on' + name.charAt(0).toUpperCase() + name.substr(1);
  2917. evt.initEvent(name, true, true);
  2918. evt.to = rootEl;
  2919. evt.from = fromEl || rootEl;
  2920. evt.item = targetEl || rootEl;
  2921. evt.clone = cloneEl;
  2922. evt.oldIndex = startIndex;
  2923. evt.newIndex = newIndex;
  2924. rootEl.dispatchEvent(evt);
  2925. if (options[onName]) {
  2926. options[onName].call(sortable, evt);
  2927. }
  2928. }
  2929. function _onMove(fromEl, toEl, dragEl, dragRect, targetEl, targetRect, originalEvt, willInsertAfter) {
  2930. var evt,
  2931. sortable = fromEl[expando],
  2932. onMoveFn = sortable.options.onMove,
  2933. retVal;
  2934. evt = document.createEvent('Event');
  2935. evt.initEvent('move', true, true);
  2936. evt.to = toEl;
  2937. evt.from = fromEl;
  2938. evt.dragged = dragEl;
  2939. evt.draggedRect = dragRect;
  2940. evt.related = targetEl || toEl;
  2941. evt.relatedRect = targetRect || toEl.getBoundingClientRect();
  2942. evt.willInsertAfter = willInsertAfter;
  2943. fromEl.dispatchEvent(evt);
  2944. if (onMoveFn) {
  2945. retVal = onMoveFn.call(sortable, evt, originalEvt);
  2946. }
  2947. return retVal;
  2948. }
  2949. function _disableDraggable(el) {
  2950. el.draggable = false;
  2951. }
  2952. function _unsilent() {
  2953. _silent = false;
  2954. }
  2955. /** @returns {HTMLElement|false} */
  2956. function _ghostIsLast(el, evt) {
  2957. var lastEl = el.lastElementChild,
  2958. rect = lastEl.getBoundingClientRect(); // 5 — min delta
  2959. // abs — нельзя добавлять, а то глюки при наведении сверху
  2960. return evt.clientY - (rect.top + rect.height) > 5 || evt.clientX - (rect.left + rect.width) > 5;
  2961. }
  2962. /**
  2963. * Generate id
  2964. * @param {HTMLElement} el
  2965. * @returns {String}
  2966. * @private
  2967. */
  2968. function _generateId(el) {
  2969. var str = el.tagName + el.className + el.src + el.href + el.textContent,
  2970. i = str.length,
  2971. sum = 0;
  2972. while (i--) {
  2973. sum += str.charCodeAt(i);
  2974. }
  2975. return sum.toString(36);
  2976. }
  2977. /**
  2978. * Returns the index of an element within its parent for a selected set of
  2979. * elements
  2980. * @param {HTMLElement} el
  2981. * @param {selector} selector
  2982. * @return {number}
  2983. */
  2984. function _index(el, selector) {
  2985. var index = 0;
  2986. if (!el || !el.parentNode) {
  2987. return -1;
  2988. }
  2989. while (el && (el = el.previousElementSibling)) {
  2990. if (el.nodeName.toUpperCase() !== 'TEMPLATE' && (selector === '>*' || _matches(el, selector))) {
  2991. index++;
  2992. }
  2993. }
  2994. return index;
  2995. }
  2996. function _matches(
  2997. /**HTMLElement*/
  2998. el,
  2999. /**String*/
  3000. selector) {
  3001. if (el) {
  3002. selector = selector.split('.');
  3003. var tag = selector.shift().toUpperCase(),
  3004. re = new RegExp('\\s(' + selector.join('|') + ')(?=\\s)', 'g');
  3005. return (tag === '' || el.nodeName.toUpperCase() == tag) && (!selector.length || ((' ' + el.className + ' ').match(re) || []).length == selector.length);
  3006. }
  3007. return false;
  3008. }
  3009. function _throttle(callback, ms) {
  3010. var args, _this;
  3011. return function () {
  3012. if (args === void 0) {
  3013. args = arguments;
  3014. _this = this;
  3015. setTimeout(function () {
  3016. if (args.length === 1) {
  3017. callback.call(_this, args[0]);
  3018. } else {
  3019. callback.apply(_this, args);
  3020. }
  3021. args = void 0;
  3022. }, ms);
  3023. }
  3024. };
  3025. }
  3026. function _extend(dst, src) {
  3027. if (dst && src) {
  3028. for (var key in src) {
  3029. if (src.hasOwnProperty(key)) {
  3030. dst[key] = src[key];
  3031. }
  3032. }
  3033. }
  3034. return dst;
  3035. }
  3036. function _clone(el) {
  3037. return $ ? $(el).clone(true)[0] : Polymer && Polymer.dom ? Polymer.dom(el).cloneNode(true) : el.cloneNode(true);
  3038. }
  3039. function _saveInputCheckedState(root) {
  3040. var inputs = root.getElementsByTagName('input');
  3041. var idx = inputs.length;
  3042. while (idx--) {
  3043. var el = inputs[idx];
  3044. el.checked && savedInputChecked.push(el);
  3045. }
  3046. } // Fixed #973:
  3047. _on(document, 'touchmove', function (evt) {
  3048. if (Sortable.active) {
  3049. evt.preventDefault();
  3050. }
  3051. });
  3052. try {
  3053. window.addEventListener('test', null, Object.defineProperty({}, 'passive', {
  3054. get: function get() {
  3055. captureMode = {
  3056. capture: false,
  3057. passive: false
  3058. };
  3059. }
  3060. }));
  3061. } catch (err) {} // Export utils
  3062. Sortable.utils = {
  3063. on: _on,
  3064. off: _off,
  3065. css: _css,
  3066. find: _find,
  3067. is: function is(el, selector) {
  3068. return !!_closest(el, selector, el);
  3069. },
  3070. extend: _extend,
  3071. throttle: _throttle,
  3072. closest: _closest,
  3073. toggleClass: _toggleClass,
  3074. clone: _clone,
  3075. index: _index
  3076. };
  3077. /**
  3078. * Create sortable instance
  3079. * @param {HTMLElement} el
  3080. * @param {Object} [options]
  3081. */
  3082. Sortable.create = function (el, options) {
  3083. return new Sortable(el, options);
  3084. }; // Export
  3085. Sortable.version = '1.6.1';
  3086. return Sortable;
  3087. });
  3088. /***/ }),
  3089. /***/ "./js/assessment/ivprogAssessment.js":
  3090. /*!*******************************************!*\
  3091. !*** ./js/assessment/ivprogAssessment.js ***!
  3092. \*******************************************/
  3093. /*! exports provided: IVProgAssessment */
  3094. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  3095. "use strict";
  3096. __webpack_require__.r(__webpack_exports__);
  3097. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "IVProgAssessment", function() { return IVProgAssessment; });
  3098. /* harmony import */ var _ast_ivprogParser__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./../ast/ivprogParser */ "./js/ast/ivprogParser.js");
  3099. /* harmony import */ var _processor_semantic_semanticAnalyser__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./../processor/semantic/semanticAnalyser */ "./js/processor/semantic/semanticAnalyser.js");
  3100. /* harmony import */ var _processor_ivprogProcessor__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./../processor/ivprogProcessor */ "./js/processor/ivprogProcessor.js");
  3101. /* harmony import */ var _util_inputTest__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./../util/inputTest */ "./js/util/inputTest.js");
  3102. /* harmony import */ var _util_outputTest__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./../util/outputTest */ "./js/util/outputTest.js");
  3103. /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  3104. /* harmony import */ var decimal_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! decimal.js */ "./node_modules/decimal.js/decimal.js");
  3105. /* harmony import */ var decimal_js__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(decimal_js__WEBPACK_IMPORTED_MODULE_6__);
  3106. /* harmony import */ var _util_config__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../util/config */ "./js/util/config.js");
  3107. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3108. 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); } }
  3109. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  3110. var LocalizedStrings = _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_5__["getInstance"]();
  3111. var IVProgAssessment =
  3112. /*#__PURE__*/
  3113. function () {
  3114. function IVProgAssessment(textCode, testCases, domConsole) {
  3115. _classCallCheck(this, IVProgAssessment);
  3116. this.textCode = textCode;
  3117. this.testCases = testCases;
  3118. this.domConsole = domConsole;
  3119. }
  3120. _createClass(IVProgAssessment, [{
  3121. key: "runTest",
  3122. value: function runTest() {
  3123. var _this = this;
  3124. try {
  3125. // try and show error messages through domconsole
  3126. var parser = _ast_ivprogParser__WEBPACK_IMPORTED_MODULE_0__["IVProgParser"].createParser(this.textCode);
  3127. var semantic = new _processor_semantic_semanticAnalyser__WEBPACK_IMPORTED_MODULE_1__["SemanticAnalyser"](parser.parseTree());
  3128. var validTree = semantic.analyseTree(); // loop test cases and show messages through domconsole
  3129. var partialTests = this.testCases.map(function (t, name) {
  3130. return _this.partialEvaluateTestCase(new _processor_ivprogProcessor__WEBPACK_IMPORTED_MODULE_2__["IVProgProcessor"](validTree), t.input, t.output, name);
  3131. });
  3132. var testResult = partialTests.reduce(function (acc, curr) {
  3133. return acc.then(curr);
  3134. }, Promise.resolve(0));
  3135. return testResult.then(function (total) {
  3136. return Promise.resolve(total / _this.testCases.length);
  3137. }).catch(function (err) {
  3138. _this.domConsole.err("Erro durante a execução do programa"); // try and show error messages through domconsole
  3139. _this.domConsole.err(err.message);
  3140. return Promise.resolve(0);
  3141. });
  3142. } catch (error) {
  3143. this.domConsole.err("Erro durante a execução do programa"); // try and show error messages through domconsole
  3144. this.domConsole.err(error.message);
  3145. return Promise.resolve(0);
  3146. }
  3147. }
  3148. }, {
  3149. key: "evaluateTestCase",
  3150. value: function evaluateTestCase(prog, inputList, outputList, name, accumulator) {
  3151. var outerThis = this;
  3152. var input = new _util_inputTest__WEBPACK_IMPORTED_MODULE_3__["InputTest"](inputList);
  3153. var output = new _util_outputTest__WEBPACK_IMPORTED_MODULE_4__["OutputTest"]();
  3154. prog.registerInput(input);
  3155. prog.registerOutput(output);
  3156. var startTime = Date.now();
  3157. return prog.interpretAST().then(function (_) {
  3158. var millis = Date.now() - startTime;
  3159. if (input.inputList.length !== input.index) {
  3160. outerThis.showErrorMessage('test_case_few_reads', name + 1);
  3161. outerThis.showMessage('test_case_duration', millis);
  3162. return Promise.resolve(accumulator + 1 * (input.index / inputList.length));
  3163. } else if (output.list.length < outputList.length) {
  3164. outerThis.showErrorMessage('test_case_failed', name + 1, inputList.join(','), outputList.join(','), output.list.join(','));
  3165. outerThis.showMessage('test_case_duration', millis);
  3166. return Promise.resolve(accumulator + 1 * (output.list.length / outputList.length));
  3167. } else if (output.list.length > outputList.length) {
  3168. outerThis.showErrorMessage('test_case_failed', name + 1, inputList.join(','), outputList.join(','), output.list.join(','));
  3169. outerThis.showMessage('test_case_duration', millis);
  3170. return Promise.resolve(accumulator + 1 * (outputList.length / output.list.length));
  3171. } else {
  3172. var isOk = outerThis.checkOutput(output.list, outputList);
  3173. if (!isOk) {
  3174. outerThis.showErrorMessage('test_case_failed', name + 1, inputList.join(','), outputList.join(','), output.list.join(','));
  3175. outerThis.showMessage('test_case_duration', millis);
  3176. return Promise.resolve(accumulator);
  3177. } else {
  3178. outerThis.showMessage('test_case_success', name + 1);
  3179. outerThis.showMessage('test_case_duration', millis);
  3180. return Promise.resolve(accumulator + 1);
  3181. }
  3182. }
  3183. }).catch(function (error) {
  3184. outerThis.showErrorMessage('test_case_failed_exception', name + 1, error.message);
  3185. return Promise.resolve(accumulator);
  3186. });
  3187. }
  3188. }, {
  3189. key: "partialEvaluateTestCase",
  3190. value: function partialEvaluateTestCase(prog, inputList, outputList, name) {
  3191. return this.evaluateTestCase.bind(this, prog, inputList, outputList, name);
  3192. }
  3193. }, {
  3194. key: "checkOutput",
  3195. value: function checkOutput(aList, bList) {
  3196. for (var i = 0; i < aList.length; i++) {
  3197. var outValue = aList[i];
  3198. var castNumberA = parseFloat(outValue);
  3199. if (!Number.isNaN(castNumberA)) {
  3200. var castNumberB = parseFloat(bList[i]);
  3201. if (Number.isNaN(castNumberB)) {
  3202. return false;
  3203. }
  3204. castNumberA = new decimal_js__WEBPACK_IMPORTED_MODULE_6__["Decimal"](castNumberA);
  3205. castNumberB = new decimal_js__WEBPACK_IMPORTED_MODULE_6__["Decimal"](castNumberB);
  3206. var decimalPlaces = Math.min(castNumberB.dp(), _util_config__WEBPACK_IMPORTED_MODULE_7__["Config"].decimalPlaces);
  3207. decimal_js__WEBPACK_IMPORTED_MODULE_6__["Decimal"].set({
  3208. rounding: decimal_js__WEBPACK_IMPORTED_MODULE_6__["Decimal"].ROUND_FLOOR
  3209. });
  3210. castNumberA = new decimal_js__WEBPACK_IMPORTED_MODULE_6__["Decimal"](castNumberA.toFixed(decimalPlaces));
  3211. castNumberB = new decimal_js__WEBPACK_IMPORTED_MODULE_6__["Decimal"](castNumberB.toFixed(decimalPlaces));
  3212. var aEqualsB = castNumberA.eq(castNumberB);
  3213. decimal_js__WEBPACK_IMPORTED_MODULE_6__["Decimal"].set({
  3214. rounding: decimal_js__WEBPACK_IMPORTED_MODULE_6__["Decimal"].ROUND_HALF_UP
  3215. });
  3216. if (!aEqualsB) {
  3217. return false;
  3218. }
  3219. } else if (outValue != bList[i]) {
  3220. return false;
  3221. }
  3222. }
  3223. return true;
  3224. }
  3225. }, {
  3226. key: "showErrorMessage",
  3227. value: function showErrorMessage(errorID) {
  3228. for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
  3229. args[_key - 1] = arguments[_key];
  3230. }
  3231. this.domConsole.err(LocalizedStrings.getError(errorID, args));
  3232. }
  3233. }, {
  3234. key: "showMessage",
  3235. value: function showMessage(msgID) {
  3236. for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
  3237. args[_key2 - 1] = arguments[_key2];
  3238. }
  3239. this.domConsole.info(LocalizedStrings.getMessage(msgID, args));
  3240. }
  3241. }]);
  3242. return IVProgAssessment;
  3243. }();
  3244. /***/ }),
  3245. /***/ "./js/ast/commands/arrayAssign.js":
  3246. /*!****************************************!*\
  3247. !*** ./js/ast/commands/arrayAssign.js ***!
  3248. \****************************************/
  3249. /*! exports provided: ArrayIndexAssign */
  3250. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  3251. "use strict";
  3252. __webpack_require__.r(__webpack_exports__);
  3253. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ArrayIndexAssign", function() { return ArrayIndexAssign; });
  3254. /* harmony import */ var _assign__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./assign */ "./js/ast/commands/assign.js");
  3255. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  3256. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3257. function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
  3258. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  3259. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  3260. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
  3261. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  3262. var ArrayIndexAssign =
  3263. /*#__PURE__*/
  3264. function (_Assign) {
  3265. _inherits(ArrayIndexAssign, _Assign);
  3266. function ArrayIndexAssign(id, lineExpression, columnExpression, expression) {
  3267. var _this;
  3268. _classCallCheck(this, ArrayIndexAssign);
  3269. _this = _possibleConstructorReturn(this, _getPrototypeOf(ArrayIndexAssign).call(this, id, expression));
  3270. _this.line = lineExpression;
  3271. _this.column = columnExpression;
  3272. return _this;
  3273. }
  3274. return ArrayIndexAssign;
  3275. }(_assign__WEBPACK_IMPORTED_MODULE_0__["Assign"]);
  3276. /***/ }),
  3277. /***/ "./js/ast/commands/arrayDeclaration.js":
  3278. /*!*********************************************!*\
  3279. !*** ./js/ast/commands/arrayDeclaration.js ***!
  3280. \*********************************************/
  3281. /*! exports provided: ArrayDeclaration */
  3282. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  3283. "use strict";
  3284. __webpack_require__.r(__webpack_exports__);
  3285. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ArrayDeclaration", function() { return ArrayDeclaration; });
  3286. /* harmony import */ var _declaration__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./declaration */ "./js/ast/commands/declaration.js");
  3287. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  3288. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3289. function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
  3290. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  3291. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  3292. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
  3293. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  3294. var ArrayDeclaration =
  3295. /*#__PURE__*/
  3296. function (_Declaration) {
  3297. _inherits(ArrayDeclaration, _Declaration);
  3298. function ArrayDeclaration(id, type, lines, columns, initial, isConst) {
  3299. var _this;
  3300. _classCallCheck(this, ArrayDeclaration);
  3301. _this = _possibleConstructorReturn(this, _getPrototypeOf(ArrayDeclaration).call(this, id, type, initial, isConst));
  3302. _this.lines = lines;
  3303. _this.columns = columns;
  3304. return _this;
  3305. }
  3306. return ArrayDeclaration;
  3307. }(_declaration__WEBPACK_IMPORTED_MODULE_0__["Declaration"]);
  3308. /***/ }),
  3309. /***/ "./js/ast/commands/assign.js":
  3310. /*!***********************************!*\
  3311. !*** ./js/ast/commands/assign.js ***!
  3312. \***********************************/
  3313. /*! exports provided: Assign */
  3314. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  3315. "use strict";
  3316. __webpack_require__.r(__webpack_exports__);
  3317. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Assign", function() { return Assign; });
  3318. /* harmony import */ var _command__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./command */ "./js/ast/commands/command.js");
  3319. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  3320. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3321. function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
  3322. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  3323. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  3324. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
  3325. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  3326. var Assign =
  3327. /*#__PURE__*/
  3328. function (_Command) {
  3329. _inherits(Assign, _Command);
  3330. function Assign(id, expression) {
  3331. var _this;
  3332. _classCallCheck(this, Assign);
  3333. _this = _possibleConstructorReturn(this, _getPrototypeOf(Assign).call(this));
  3334. _this.id = id;
  3335. _this.expression = expression;
  3336. return _this;
  3337. }
  3338. return Assign;
  3339. }(_command__WEBPACK_IMPORTED_MODULE_0__["Command"]);
  3340. /***/ }),
  3341. /***/ "./js/ast/commands/break.js":
  3342. /*!**********************************!*\
  3343. !*** ./js/ast/commands/break.js ***!
  3344. \**********************************/
  3345. /*! exports provided: Break */
  3346. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  3347. "use strict";
  3348. __webpack_require__.r(__webpack_exports__);
  3349. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Break", function() { return Break; });
  3350. /* harmony import */ var _command__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./command */ "./js/ast/commands/command.js");
  3351. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  3352. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3353. function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
  3354. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  3355. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  3356. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
  3357. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  3358. var Break =
  3359. /*#__PURE__*/
  3360. function (_Command) {
  3361. _inherits(Break, _Command);
  3362. function Break() {
  3363. _classCallCheck(this, Break);
  3364. return _possibleConstructorReturn(this, _getPrototypeOf(Break).call(this));
  3365. }
  3366. return Break;
  3367. }(_command__WEBPACK_IMPORTED_MODULE_0__["Command"]);
  3368. /***/ }),
  3369. /***/ "./js/ast/commands/case.js":
  3370. /*!*********************************!*\
  3371. !*** ./js/ast/commands/case.js ***!
  3372. \*********************************/
  3373. /*! exports provided: Case */
  3374. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  3375. "use strict";
  3376. __webpack_require__.r(__webpack_exports__);
  3377. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Case", function() { return Case; });
  3378. /* harmony import */ var _command__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./command */ "./js/ast/commands/command.js");
  3379. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  3380. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3381. 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); } }
  3382. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  3383. function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
  3384. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  3385. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  3386. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
  3387. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  3388. var Case =
  3389. /*#__PURE__*/
  3390. function (_Command) {
  3391. _inherits(Case, _Command);
  3392. function Case(expression) {
  3393. var _this;
  3394. _classCallCheck(this, Case);
  3395. _this = _possibleConstructorReturn(this, _getPrototypeOf(Case).call(this));
  3396. _this.expression = expression;
  3397. _this.commands = [];
  3398. return _this;
  3399. }
  3400. _createClass(Case, [{
  3401. key: "setCommands",
  3402. value: function setCommands(commands) {
  3403. this.commands = commands;
  3404. }
  3405. }, {
  3406. key: "isDefault",
  3407. get: function get() {
  3408. return this.expression === null;
  3409. }
  3410. }]);
  3411. return Case;
  3412. }(_command__WEBPACK_IMPORTED_MODULE_0__["Command"]);
  3413. /***/ }),
  3414. /***/ "./js/ast/commands/command.js":
  3415. /*!************************************!*\
  3416. !*** ./js/ast/commands/command.js ***!
  3417. \************************************/
  3418. /*! exports provided: Command */
  3419. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  3420. "use strict";
  3421. __webpack_require__.r(__webpack_exports__);
  3422. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Command", function() { return Command; });
  3423. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3424. 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); } }
  3425. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  3426. var Command =
  3427. /*#__PURE__*/
  3428. function () {
  3429. function Command() {
  3430. _classCallCheck(this, Command);
  3431. this._sourceInfo = null;
  3432. }
  3433. _createClass(Command, [{
  3434. key: "sourceInfo",
  3435. set: function set(sourceInfo) {
  3436. this._sourceInfo = sourceInfo;
  3437. },
  3438. get: function get() {
  3439. return this._sourceInfo;
  3440. }
  3441. }]);
  3442. return Command;
  3443. }();
  3444. /***/ }),
  3445. /***/ "./js/ast/commands/commandBlock.js":
  3446. /*!*****************************************!*\
  3447. !*** ./js/ast/commands/commandBlock.js ***!
  3448. \*****************************************/
  3449. /*! exports provided: CommandBlock */
  3450. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  3451. "use strict";
  3452. __webpack_require__.r(__webpack_exports__);
  3453. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CommandBlock", function() { return CommandBlock; });
  3454. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3455. 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); } }
  3456. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  3457. var CommandBlock =
  3458. /*#__PURE__*/
  3459. function () {
  3460. function CommandBlock(variables, commands) {
  3461. _classCallCheck(this, CommandBlock);
  3462. this.variables = variables;
  3463. this.commands = commands;
  3464. this._sourceInfo = null;
  3465. }
  3466. _createClass(CommandBlock, [{
  3467. key: "sourceInfo",
  3468. set: function set(sourceInfo) {
  3469. this._sourceInfo = sourceInfo;
  3470. },
  3471. get: function get() {
  3472. return this._sourceInfo;
  3473. }
  3474. }]);
  3475. return CommandBlock;
  3476. }();
  3477. /***/ }),
  3478. /***/ "./js/ast/commands/declaration.js":
  3479. /*!****************************************!*\
  3480. !*** ./js/ast/commands/declaration.js ***!
  3481. \****************************************/
  3482. /*! exports provided: Declaration */
  3483. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  3484. "use strict";
  3485. __webpack_require__.r(__webpack_exports__);
  3486. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Declaration", function() { return Declaration; });
  3487. /* harmony import */ var _command__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./command */ "./js/ast/commands/command.js");
  3488. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  3489. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3490. function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
  3491. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  3492. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  3493. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
  3494. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  3495. var Declaration =
  3496. /*#__PURE__*/
  3497. function (_Command) {
  3498. _inherits(Declaration, _Command);
  3499. function Declaration(id, type, initial, isConst) {
  3500. var _this;
  3501. _classCallCheck(this, Declaration);
  3502. _this = _possibleConstructorReturn(this, _getPrototypeOf(Declaration).call(this));
  3503. _this.id = id;
  3504. _this.type = type;
  3505. _this.initial = initial;
  3506. _this.isConst = isConst;
  3507. return _this;
  3508. }
  3509. return Declaration;
  3510. }(_command__WEBPACK_IMPORTED_MODULE_0__["Command"]);
  3511. /***/ }),
  3512. /***/ "./js/ast/commands/doWhile.js":
  3513. /*!************************************!*\
  3514. !*** ./js/ast/commands/doWhile.js ***!
  3515. \************************************/
  3516. /*! exports provided: DoWhile */
  3517. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  3518. "use strict";
  3519. __webpack_require__.r(__webpack_exports__);
  3520. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DoWhile", function() { return DoWhile; });
  3521. /* harmony import */ var _while__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./while */ "./js/ast/commands/while.js");
  3522. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  3523. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3524. 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); } }
  3525. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  3526. function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
  3527. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  3528. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  3529. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
  3530. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  3531. var DoWhile =
  3532. /*#__PURE__*/
  3533. function (_While) {
  3534. _inherits(DoWhile, _While);
  3535. function DoWhile(condition, commandBlock) {
  3536. _classCallCheck(this, DoWhile);
  3537. return _possibleConstructorReturn(this, _getPrototypeOf(DoWhile).call(this, condition, commandBlock));
  3538. }
  3539. _createClass(DoWhile, [{
  3540. key: "testFirst",
  3541. get: function get() {
  3542. return false;
  3543. }
  3544. }]);
  3545. return DoWhile;
  3546. }(_while__WEBPACK_IMPORTED_MODULE_0__["While"]);
  3547. /***/ }),
  3548. /***/ "./js/ast/commands/for.js":
  3549. /*!********************************!*\
  3550. !*** ./js/ast/commands/for.js ***!
  3551. \********************************/
  3552. /*! exports provided: For */
  3553. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  3554. "use strict";
  3555. __webpack_require__.r(__webpack_exports__);
  3556. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "For", function() { return For; });
  3557. /* harmony import */ var _command__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./command */ "./js/ast/commands/command.js");
  3558. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  3559. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3560. 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); } }
  3561. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  3562. function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
  3563. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  3564. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  3565. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
  3566. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  3567. var For =
  3568. /*#__PURE__*/
  3569. function (_Command) {
  3570. _inherits(For, _Command);
  3571. function For(assignment, condition, increment, commandBlock) {
  3572. var _this;
  3573. _classCallCheck(this, For);
  3574. _this = _possibleConstructorReturn(this, _getPrototypeOf(For).call(this));
  3575. _this.assignment = assignment;
  3576. _this.condition = condition;
  3577. _this.increment = increment;
  3578. _this.commandBlock = commandBlock;
  3579. return _this;
  3580. }
  3581. _createClass(For, [{
  3582. key: "commands",
  3583. get: function get() {
  3584. return this.commandBlock.commands;
  3585. }
  3586. }]);
  3587. return For;
  3588. }(_command__WEBPACK_IMPORTED_MODULE_0__["Command"]);
  3589. /***/ }),
  3590. /***/ "./js/ast/commands/formalParameter.js":
  3591. /*!********************************************!*\
  3592. !*** ./js/ast/commands/formalParameter.js ***!
  3593. \********************************************/
  3594. /*! exports provided: FormalParameter */
  3595. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  3596. "use strict";
  3597. __webpack_require__.r(__webpack_exports__);
  3598. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "FormalParameter", function() { return FormalParameter; });
  3599. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3600. 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); } }
  3601. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  3602. var FormalParameter =
  3603. /*#__PURE__*/
  3604. function () {
  3605. function FormalParameter(type, id) {
  3606. var byRef = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  3607. _classCallCheck(this, FormalParameter);
  3608. this.type = type;
  3609. this.id = id;
  3610. this.byRef = byRef;
  3611. this._sourceInfo = null;
  3612. }
  3613. _createClass(FormalParameter, [{
  3614. key: "sourceInfo",
  3615. set: function set(sourceInfo) {
  3616. this._sourceInfo = sourceInfo;
  3617. },
  3618. get: function get() {
  3619. return this._sourceInfo;
  3620. }
  3621. }]);
  3622. return FormalParameter;
  3623. }();
  3624. /***/ }),
  3625. /***/ "./js/ast/commands/function.js":
  3626. /*!*************************************!*\
  3627. !*** ./js/ast/commands/function.js ***!
  3628. \*************************************/
  3629. /*! exports provided: Function */
  3630. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  3631. "use strict";
  3632. __webpack_require__.r(__webpack_exports__);
  3633. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Function", function() { return Function; });
  3634. /* harmony import */ var _typeSystem_types__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./../../typeSystem/types */ "./js/typeSystem/types.js");
  3635. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3636. 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); } }
  3637. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  3638. var Function =
  3639. /*#__PURE__*/
  3640. function () {
  3641. function Function(name, returnType, formalParameters, commandBlock) {
  3642. _classCallCheck(this, Function);
  3643. this.name = name;
  3644. this.returnType = returnType;
  3645. this.formalParameters = formalParameters;
  3646. this.commandBlock = commandBlock;
  3647. this._sourceInfo = null;
  3648. }
  3649. _createClass(Function, [{
  3650. key: "isMain",
  3651. get: function get() {
  3652. return this.name === null && this.returnType.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].VOID);
  3653. }
  3654. }, {
  3655. key: "commands",
  3656. get: function get() {
  3657. return this.commandBlock.commands;
  3658. }
  3659. }, {
  3660. key: "variablesDeclarations",
  3661. get: function get() {
  3662. return this.commandBlock.variables;
  3663. }
  3664. }, {
  3665. key: "sourceInfo",
  3666. set: function set(sourceInfo) {
  3667. this._sourceInfo = sourceInfo;
  3668. },
  3669. get: function get() {
  3670. return this._sourceInfo;
  3671. }
  3672. }]);
  3673. return Function;
  3674. }();
  3675. /***/ }),
  3676. /***/ "./js/ast/commands/ifThenElse.js":
  3677. /*!***************************************!*\
  3678. !*** ./js/ast/commands/ifThenElse.js ***!
  3679. \***************************************/
  3680. /*! exports provided: IfThenElse */
  3681. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  3682. "use strict";
  3683. __webpack_require__.r(__webpack_exports__);
  3684. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "IfThenElse", function() { return IfThenElse; });
  3685. /* harmony import */ var _command__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./command */ "./js/ast/commands/command.js");
  3686. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  3687. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3688. function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
  3689. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  3690. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  3691. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
  3692. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  3693. var IfThenElse =
  3694. /*#__PURE__*/
  3695. function (_Command) {
  3696. _inherits(IfThenElse, _Command);
  3697. function IfThenElse(condition, ifTrue, ifFalse) {
  3698. var _this;
  3699. _classCallCheck(this, IfThenElse);
  3700. _this = _possibleConstructorReturn(this, _getPrototypeOf(IfThenElse).call(this));
  3701. _this.condition = condition;
  3702. _this.ifTrue = ifTrue;
  3703. _this.ifFalse = ifFalse;
  3704. return _this;
  3705. }
  3706. return IfThenElse;
  3707. }(_command__WEBPACK_IMPORTED_MODULE_0__["Command"]);
  3708. /***/ }),
  3709. /***/ "./js/ast/commands/index.js":
  3710. /*!**********************************!*\
  3711. !*** ./js/ast/commands/index.js ***!
  3712. \**********************************/
  3713. /*! exports provided: Break, Return, Assign, ArrayIndexAssign, Declaration, ArrayDeclaration, While, For, Function, IfThenElse, CommandBlock, DoWhile, Switch, Case, SysCall, FormalParameter, FunctionCall */
  3714. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  3715. "use strict";
  3716. __webpack_require__.r(__webpack_exports__);
  3717. /* harmony import */ var _break__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./break */ "./js/ast/commands/break.js");
  3718. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Break", function() { return _break__WEBPACK_IMPORTED_MODULE_0__["Break"]; });
  3719. /* harmony import */ var _return__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./return */ "./js/ast/commands/return.js");
  3720. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Return", function() { return _return__WEBPACK_IMPORTED_MODULE_1__["Return"]; });
  3721. /* harmony import */ var _assign__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./assign */ "./js/ast/commands/assign.js");
  3722. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Assign", function() { return _assign__WEBPACK_IMPORTED_MODULE_2__["Assign"]; });
  3723. /* harmony import */ var _arrayAssign__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./arrayAssign */ "./js/ast/commands/arrayAssign.js");
  3724. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "ArrayIndexAssign", function() { return _arrayAssign__WEBPACK_IMPORTED_MODULE_3__["ArrayIndexAssign"]; });
  3725. /* harmony import */ var _declaration__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./declaration */ "./js/ast/commands/declaration.js");
  3726. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Declaration", function() { return _declaration__WEBPACK_IMPORTED_MODULE_4__["Declaration"]; });
  3727. /* harmony import */ var _arrayDeclaration__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./arrayDeclaration */ "./js/ast/commands/arrayDeclaration.js");
  3728. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "ArrayDeclaration", function() { return _arrayDeclaration__WEBPACK_IMPORTED_MODULE_5__["ArrayDeclaration"]; });
  3729. /* harmony import */ var _while__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./while */ "./js/ast/commands/while.js");
  3730. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "While", function() { return _while__WEBPACK_IMPORTED_MODULE_6__["While"]; });
  3731. /* harmony import */ var _for__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./for */ "./js/ast/commands/for.js");
  3732. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "For", function() { return _for__WEBPACK_IMPORTED_MODULE_7__["For"]; });
  3733. /* harmony import */ var _function__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./function */ "./js/ast/commands/function.js");
  3734. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Function", function() { return _function__WEBPACK_IMPORTED_MODULE_8__["Function"]; });
  3735. /* harmony import */ var _ifThenElse__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./ifThenElse */ "./js/ast/commands/ifThenElse.js");
  3736. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "IfThenElse", function() { return _ifThenElse__WEBPACK_IMPORTED_MODULE_9__["IfThenElse"]; });
  3737. /* harmony import */ var _commandBlock__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./commandBlock */ "./js/ast/commands/commandBlock.js");
  3738. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "CommandBlock", function() { return _commandBlock__WEBPACK_IMPORTED_MODULE_10__["CommandBlock"]; });
  3739. /* harmony import */ var _doWhile__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./doWhile */ "./js/ast/commands/doWhile.js");
  3740. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "DoWhile", function() { return _doWhile__WEBPACK_IMPORTED_MODULE_11__["DoWhile"]; });
  3741. /* harmony import */ var _switch__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./switch */ "./js/ast/commands/switch.js");
  3742. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Switch", function() { return _switch__WEBPACK_IMPORTED_MODULE_12__["Switch"]; });
  3743. /* harmony import */ var _case__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./case */ "./js/ast/commands/case.js");
  3744. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Case", function() { return _case__WEBPACK_IMPORTED_MODULE_13__["Case"]; });
  3745. /* harmony import */ var _sysCall__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./sysCall */ "./js/ast/commands/sysCall.js");
  3746. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "SysCall", function() { return _sysCall__WEBPACK_IMPORTED_MODULE_14__["SysCall"]; });
  3747. /* harmony import */ var _formalParameter__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./formalParameter */ "./js/ast/commands/formalParameter.js");
  3748. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "FormalParameter", function() { return _formalParameter__WEBPACK_IMPORTED_MODULE_15__["FormalParameter"]; });
  3749. /* harmony import */ var _expressions_functionCall__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./../expressions/functionCall */ "./js/ast/expressions/functionCall.js");
  3750. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "FunctionCall", function() { return _expressions_functionCall__WEBPACK_IMPORTED_MODULE_16__["FunctionCall"]; });
  3751. //Proxy to expression since they do exatcly the same thing
  3752. /***/ }),
  3753. /***/ "./js/ast/commands/return.js":
  3754. /*!***********************************!*\
  3755. !*** ./js/ast/commands/return.js ***!
  3756. \***********************************/
  3757. /*! exports provided: Return */
  3758. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  3759. "use strict";
  3760. __webpack_require__.r(__webpack_exports__);
  3761. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Return", function() { return Return; });
  3762. /* harmony import */ var _command__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./command */ "./js/ast/commands/command.js");
  3763. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  3764. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3765. function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
  3766. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  3767. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  3768. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
  3769. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  3770. var Return =
  3771. /*#__PURE__*/
  3772. function (_Command) {
  3773. _inherits(Return, _Command);
  3774. function Return(expression) {
  3775. var _this;
  3776. _classCallCheck(this, Return);
  3777. _this = _possibleConstructorReturn(this, _getPrototypeOf(Return).call(this));
  3778. _this.expression = expression;
  3779. return _this;
  3780. }
  3781. return Return;
  3782. }(_command__WEBPACK_IMPORTED_MODULE_0__["Command"]);
  3783. /***/ }),
  3784. /***/ "./js/ast/commands/switch.js":
  3785. /*!***********************************!*\
  3786. !*** ./js/ast/commands/switch.js ***!
  3787. \***********************************/
  3788. /*! exports provided: Switch */
  3789. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  3790. "use strict";
  3791. __webpack_require__.r(__webpack_exports__);
  3792. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Switch", function() { return Switch; });
  3793. /* harmony import */ var _command__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./command */ "./js/ast/commands/command.js");
  3794. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  3795. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3796. function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
  3797. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  3798. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  3799. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
  3800. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  3801. var Switch =
  3802. /*#__PURE__*/
  3803. function (_Command) {
  3804. _inherits(Switch, _Command);
  3805. function Switch(expression, cases) {
  3806. var _this;
  3807. _classCallCheck(this, Switch);
  3808. _this = _possibleConstructorReturn(this, _getPrototypeOf(Switch).call(this));
  3809. _this.expression = expression;
  3810. _this.cases = cases;
  3811. return _this;
  3812. }
  3813. return Switch;
  3814. }(_command__WEBPACK_IMPORTED_MODULE_0__["Command"]);
  3815. /***/ }),
  3816. /***/ "./js/ast/commands/sysCall.js":
  3817. /*!************************************!*\
  3818. !*** ./js/ast/commands/sysCall.js ***!
  3819. \************************************/
  3820. /*! exports provided: SysCall */
  3821. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  3822. "use strict";
  3823. __webpack_require__.r(__webpack_exports__);
  3824. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SysCall", function() { return SysCall; });
  3825. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3826. /**
  3827. * This class represents all the language defined functions.
  3828. * The language processor uses the id provided here to properly execute the desired function.
  3829. * The function is actually implemented inside the language processor.
  3830. * All the functions can be found at: js/processor/definedFunctions.js
  3831. */
  3832. var SysCall = function SysCall(langFunc) {
  3833. _classCallCheck(this, SysCall);
  3834. this.langFunc = langFunc;
  3835. };
  3836. /***/ }),
  3837. /***/ "./js/ast/commands/while.js":
  3838. /*!**********************************!*\
  3839. !*** ./js/ast/commands/while.js ***!
  3840. \**********************************/
  3841. /*! exports provided: While */
  3842. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  3843. "use strict";
  3844. __webpack_require__.r(__webpack_exports__);
  3845. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "While", function() { return While; });
  3846. /* harmony import */ var _command__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./command */ "./js/ast/commands/command.js");
  3847. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  3848. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3849. 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); } }
  3850. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  3851. function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
  3852. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  3853. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  3854. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
  3855. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  3856. var While =
  3857. /*#__PURE__*/
  3858. function (_Command) {
  3859. _inherits(While, _Command);
  3860. function While(expression, commandBlock) {
  3861. var _this;
  3862. _classCallCheck(this, While);
  3863. _this = _possibleConstructorReturn(this, _getPrototypeOf(While).call(this));
  3864. _this.expression = expression;
  3865. _this.commandBlock = commandBlock;
  3866. return _this;
  3867. }
  3868. _createClass(While, [{
  3869. key: "commands",
  3870. get: function get() {
  3871. return this.commandBlock.commands;
  3872. }
  3873. }, {
  3874. key: "testFirst",
  3875. get: function get() {
  3876. return true;
  3877. }
  3878. }]);
  3879. return While;
  3880. }(_command__WEBPACK_IMPORTED_MODULE_0__["Command"]);
  3881. /***/ }),
  3882. /***/ "./js/ast/error/syntaxError.js":
  3883. /*!*************************************!*\
  3884. !*** ./js/ast/error/syntaxError.js ***!
  3885. \*************************************/
  3886. /*! exports provided: SyntaxError */
  3887. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  3888. "use strict";
  3889. __webpack_require__.r(__webpack_exports__);
  3890. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SyntaxError", function() { return SyntaxError; });
  3891. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  3892. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3893. function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
  3894. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  3895. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
  3896. function _wrapNativeSuper(Class) { var _cache = typeof Map === "function" ? new Map() : undefined; _wrapNativeSuper = function _wrapNativeSuper(Class) { if (Class === null || !_isNativeFunction(Class)) return Class; if (typeof Class !== "function") { throw new TypeError("Super expression must either be null or a function"); } if (typeof _cache !== "undefined") { if (_cache.has(Class)) return _cache.get(Class); _cache.set(Class, Wrapper); } function Wrapper() { return _construct(Class, arguments, _getPrototypeOf(this).constructor); } Wrapper.prototype = Object.create(Class.prototype, { constructor: { value: Wrapper, enumerable: false, writable: true, configurable: true } }); return _setPrototypeOf(Wrapper, Class); }; return _wrapNativeSuper(Class); }
  3897. function isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
  3898. function _construct(Parent, args, Class) { if (isNativeReflectConstruct()) { _construct = Reflect.construct; } else { _construct = function _construct(Parent, args, Class) { var a = [null]; a.push.apply(a, args); var Constructor = Function.bind.apply(Parent, a); var instance = new Constructor(); if (Class) _setPrototypeOf(instance, Class.prototype); return instance; }; } return _construct.apply(null, arguments); }
  3899. function _isNativeFunction(fn) { return Function.toString.call(fn).indexOf("[native code]") !== -1; }
  3900. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  3901. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  3902. var SyntaxError =
  3903. /*#__PURE__*/
  3904. function (_Error) {
  3905. _inherits(SyntaxError, _Error);
  3906. function SyntaxError() {
  3907. var _getPrototypeOf2;
  3908. var _this;
  3909. _classCallCheck(this, SyntaxError);
  3910. for (var _len = arguments.length, msg = new Array(_len), _key = 0; _key < _len; _key++) {
  3911. msg[_key] = arguments[_key];
  3912. }
  3913. _this = _possibleConstructorReturn(this, (_getPrototypeOf2 = _getPrototypeOf(SyntaxError)).call.apply(_getPrototypeOf2, [this].concat(msg)));
  3914. if (Error.captureStackTrace) Error.captureStackTrace(_assertThisInitialized(_this), SyntaxError);
  3915. return _this;
  3916. }
  3917. return SyntaxError;
  3918. }(_wrapNativeSuper(Error));
  3919. /***/ }),
  3920. /***/ "./js/ast/error/syntaxErrorFactory.js":
  3921. /*!********************************************!*\
  3922. !*** ./js/ast/error/syntaxErrorFactory.js ***!
  3923. \********************************************/
  3924. /*! exports provided: SyntaxErrorFactory */
  3925. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  3926. "use strict";
  3927. __webpack_require__.r(__webpack_exports__);
  3928. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SyntaxErrorFactory", function() { return SyntaxErrorFactory; });
  3929. /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  3930. /* harmony import */ var _syntaxError__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./syntaxError */ "./js/ast/error/syntaxError.js");
  3931. var LocalizedStrings = _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_0__["getInstance"]();
  3932. var SyntaxErrorFactory = Object.freeze({
  3933. extra_lines: function extra_lines() {
  3934. return new _syntaxError__WEBPACK_IMPORTED_MODULE_1__["SyntaxError"](LocalizedStrings.getError("extra_lines"));
  3935. },
  3936. token_missing_one: function token_missing_one(expected, token) {
  3937. var context = [expected, token.text, token.line, token.column];
  3938. return new _syntaxError__WEBPACK_IMPORTED_MODULE_1__["SyntaxError"](LocalizedStrings.getError("token_missing_one", context));
  3939. },
  3940. token_missing_list: function token_missing_list(expectedList, token) {
  3941. var line = expectedList.join(LocalizedStrings.getOR());
  3942. return SyntaxErrorFactory.token_missing_one(line, token);
  3943. },
  3944. id_missing: function id_missing(token) {
  3945. var context = [token.text, token.line, token.column];
  3946. return new _syntaxError__WEBPACK_IMPORTED_MODULE_1__["SyntaxError"](LocalizedStrings.getError("id_missing", context));
  3947. },
  3948. eos_missing: function eos_missing(token) {
  3949. var context = [token.line, token.column];
  3950. return new _syntaxError__WEBPACK_IMPORTED_MODULE_1__["SyntaxError"](LocalizedStrings.getError("eos_missing", context));
  3951. },
  3952. invalid_array_dimension: function invalid_array_dimension(typeName, token) {
  3953. var context = [token.line, token.column, typeName];
  3954. return new _syntaxError__WEBPACK_IMPORTED_MODULE_1__["SyntaxError"](LocalizedStrings.getError("invalid_array_dimension", context));
  3955. },
  3956. invalid_array_size: function invalid_array_size(token) {
  3957. var context = [token.line];
  3958. return new _syntaxError__WEBPACK_IMPORTED_MODULE_1__["SyntaxError"](LocalizedStrings.getError("invalid_array_size", context));
  3959. },
  3960. invalid_main_return: function invalid_main_return(name, typeName, token) {
  3961. var context = [name, typeName, token.line];
  3962. return new _syntaxError__WEBPACK_IMPORTED_MODULE_1__["SyntaxError"](LocalizedStrings.getError("invalid_main_return", context));
  3963. },
  3964. invalid_var_declaration: function invalid_var_declaration(token) {
  3965. var context = [token.line];
  3966. return new _syntaxError__WEBPACK_IMPORTED_MODULE_1__["SyntaxError"](LocalizedStrings.getError("invalid_var_declaration", context));
  3967. },
  3968. invalid_break_command: function invalid_break_command(cmdName, token) {
  3969. var context = [token.line, cmdName];
  3970. return new _syntaxError__WEBPACK_IMPORTED_MODULE_1__["SyntaxError"](LocalizedStrings.getError("invalid_break_command", context));
  3971. },
  3972. invalid_terminal: function invalid_terminal(token) {
  3973. var context = [token.text, token.line, token.column];
  3974. return new _syntaxError__WEBPACK_IMPORTED_MODULE_1__["SyntaxError"](LocalizedStrings.getError('invalid_terminal', context));
  3975. },
  3976. invalid_type: function invalid_type(list, token) {
  3977. var line = list.join(LocalizedStrings.getOR());
  3978. var context = [token.text, token.line, token.column, line];
  3979. return new _syntaxError__WEBPACK_IMPORTED_MODULE_1__["SyntaxError"](LocalizedStrings.getError("invalid_type", context));
  3980. },
  3981. const_not_init: function const_not_init(token) {
  3982. var context = [token.line, token.column];
  3983. return new _syntaxError__WEBPACK_IMPORTED_MODULE_1__["SyntaxError"](LocalizedStrings.getError("const_not_init", context));
  3984. },
  3985. invalid_id_format: function invalid_id_format(token) {
  3986. var context = [token.text, token.line, token.column];
  3987. return new _syntaxError__WEBPACK_IMPORTED_MODULE_1__["SyntaxError"](LocalizedStrings.getError("invalid_id_format", context));
  3988. },
  3989. duplicate_function: function duplicate_function(token) {
  3990. var context = [token.text, token.line, token.column];
  3991. return new _syntaxError__WEBPACK_IMPORTED_MODULE_1__["SyntaxError"](LocalizedStrings.getError("duplicate_function", context));
  3992. },
  3993. main_parameters: function main_parameters() {
  3994. return new _syntaxError__WEBPACK_IMPORTED_MODULE_1__["SyntaxError"](LocalizedStrings.getError("main_parameters"));
  3995. },
  3996. duplicate_variable: function duplicate_variable(token) {
  3997. var context = [token.text, token.line, token.column];
  3998. return new _syntaxError__WEBPACK_IMPORTED_MODULE_1__["SyntaxError"](LocalizedStrings.getError("duplicate_variable", context));
  3999. }
  4000. });
  4001. /***/ }),
  4002. /***/ "./js/ast/expressions/arrayAccess.js":
  4003. /*!*******************************************!*\
  4004. !*** ./js/ast/expressions/arrayAccess.js ***!
  4005. \*******************************************/
  4006. /*! exports provided: ArrayAccess */
  4007. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  4008. "use strict";
  4009. __webpack_require__.r(__webpack_exports__);
  4010. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ArrayAccess", function() { return ArrayAccess; });
  4011. /* harmony import */ var _expression__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./expression */ "./js/ast/expressions/expression.js");
  4012. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  4013. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4014. 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); } }
  4015. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  4016. function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
  4017. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  4018. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  4019. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
  4020. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  4021. var ArrayAccess =
  4022. /*#__PURE__*/
  4023. function (_Expression) {
  4024. _inherits(ArrayAccess, _Expression);
  4025. function ArrayAccess(id, line, column) {
  4026. var _this;
  4027. _classCallCheck(this, ArrayAccess);
  4028. _this = _possibleConstructorReturn(this, _getPrototypeOf(ArrayAccess).call(this));
  4029. _this.id = id;
  4030. _this.line = line;
  4031. _this.column = column;
  4032. return _this;
  4033. }
  4034. _createClass(ArrayAccess, [{
  4035. key: "toString",
  4036. value: function toString() {
  4037. var strLine = this.line.toString();
  4038. var strColumn = null;
  4039. if (this.column) {
  4040. strColumn = this.column.toString();
  4041. }
  4042. if (strColumn) {
  4043. return "".concat(this.id, "[").concat(strLine, "][").concat(strColumn, "]");
  4044. } else {
  4045. return "".concat(this.id, "[").concat(strLine, "]");
  4046. }
  4047. }
  4048. }]);
  4049. return ArrayAccess;
  4050. }(_expression__WEBPACK_IMPORTED_MODULE_0__["Expression"]);
  4051. /***/ }),
  4052. /***/ "./js/ast/expressions/arrayLiteral.js":
  4053. /*!********************************************!*\
  4054. !*** ./js/ast/expressions/arrayLiteral.js ***!
  4055. \********************************************/
  4056. /*! exports provided: ArrayLiteral */
  4057. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  4058. "use strict";
  4059. __webpack_require__.r(__webpack_exports__);
  4060. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ArrayLiteral", function() { return ArrayLiteral; });
  4061. /* harmony import */ var _literal__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./literal */ "./js/ast/expressions/literal.js");
  4062. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  4063. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4064. 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); } }
  4065. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  4066. function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
  4067. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  4068. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  4069. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
  4070. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  4071. var ArrayLiteral =
  4072. /*#__PURE__*/
  4073. function (_Literal) {
  4074. _inherits(ArrayLiteral, _Literal);
  4075. function ArrayLiteral(type, value) {
  4076. var _this;
  4077. _classCallCheck(this, ArrayLiteral);
  4078. _this = _possibleConstructorReturn(this, _getPrototypeOf(ArrayLiteral).call(this, type));
  4079. _this.value = value;
  4080. return _this;
  4081. }
  4082. _createClass(ArrayLiteral, [{
  4083. key: "validateType",
  4084. value: function validateType() {
  4085. // let valid = true;
  4086. // if(this.columns !== null) {
  4087. // const len = this.columns;
  4088. // const len2 = this.lines;
  4089. // for (let i = len - 1; i >= 0; i--) {
  4090. // for (let j = len2 - 1; j >= 0; j--) {
  4091. // if(this.value[i].value[j].type !== this.subtype) {
  4092. // valid = false;
  4093. // break;
  4094. // }
  4095. // }
  4096. // }
  4097. // } else {
  4098. // const len = this.lines;
  4099. // for (var i = len - 1; i >= 0; i--) {
  4100. // if(this.value[i].type !== this.subtype) {
  4101. // valid = false;
  4102. // break;
  4103. // }
  4104. // }
  4105. // }
  4106. return true; //valid;
  4107. }
  4108. }, {
  4109. key: "validateSize",
  4110. value: function validateSize() {
  4111. var valid = true;
  4112. if (this.columns !== null) {
  4113. var equalityTest = data.value.map(function (v) {
  4114. return v.length;
  4115. }).reduce(function (old, next) {
  4116. if (old === null) {
  4117. return next;
  4118. } else if (old === next) {
  4119. return old;
  4120. } else {
  4121. return -1;
  4122. }
  4123. }, null);
  4124. valid = equalityTest !== -1;
  4125. }
  4126. return valid;
  4127. }
  4128. }, {
  4129. key: "toString",
  4130. value: function toString() {
  4131. var strList = this.value.map(function (arrayLiteral) {
  4132. return arrayLiteral.toString();
  4133. });
  4134. return "{" + strList.join(',') + "}";
  4135. }
  4136. }, {
  4137. key: "subtype",
  4138. get: function get() {
  4139. var element = this.value[0];
  4140. if (element instanceof ArrayLiteral) {
  4141. return element.value[0].type;
  4142. } else {
  4143. return element.type;
  4144. }
  4145. }
  4146. }, {
  4147. key: "lines",
  4148. get: function get() {
  4149. return this.value.length;
  4150. }
  4151. }, {
  4152. key: "columns",
  4153. get: function get() {
  4154. var element = this.value[0];
  4155. if (!(element instanceof ArrayLiteral)) {
  4156. return null;
  4157. } else {
  4158. return element.value[0].length;
  4159. }
  4160. }
  4161. }, {
  4162. key: "isVector",
  4163. get: function get() {
  4164. return this.columns === null;
  4165. }
  4166. }, {
  4167. key: "isValid",
  4168. get: function get() {
  4169. return true; //this.validateType() && this.validateSize();
  4170. }
  4171. }]);
  4172. return ArrayLiteral;
  4173. }(_literal__WEBPACK_IMPORTED_MODULE_0__["Literal"]);
  4174. /***/ }),
  4175. /***/ "./js/ast/expressions/boolLiteral.js":
  4176. /*!*******************************************!*\
  4177. !*** ./js/ast/expressions/boolLiteral.js ***!
  4178. \*******************************************/
  4179. /*! exports provided: BoolLiteral */
  4180. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  4181. "use strict";
  4182. __webpack_require__.r(__webpack_exports__);
  4183. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "BoolLiteral", function() { return BoolLiteral; });
  4184. /* harmony import */ var _literal__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./literal */ "./js/ast/expressions/literal.js");
  4185. /* harmony import */ var _typeSystem_types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./../../typeSystem/types */ "./js/typeSystem/types.js");
  4186. /* harmony import */ var _typeSystem_parsers__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./../../typeSystem/parsers */ "./js/typeSystem/parsers.js");
  4187. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  4188. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4189. 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); } }
  4190. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  4191. function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
  4192. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  4193. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  4194. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
  4195. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  4196. var BoolLiteral =
  4197. /*#__PURE__*/
  4198. function (_Literal) {
  4199. _inherits(BoolLiteral, _Literal);
  4200. function BoolLiteral(value) {
  4201. var _this;
  4202. _classCallCheck(this, BoolLiteral);
  4203. _this = _possibleConstructorReturn(this, _getPrototypeOf(BoolLiteral).call(this, _typeSystem_types__WEBPACK_IMPORTED_MODULE_1__["Types"].BOOLEAN));
  4204. _this.value = value;
  4205. return _this;
  4206. }
  4207. _createClass(BoolLiteral, [{
  4208. key: "toString",
  4209. value: function toString() {
  4210. return Object(_typeSystem_parsers__WEBPACK_IMPORTED_MODULE_2__["convertBoolToString"])(this.value);
  4211. }
  4212. }]);
  4213. return BoolLiteral;
  4214. }(_literal__WEBPACK_IMPORTED_MODULE_0__["Literal"]);
  4215. /***/ }),
  4216. /***/ "./js/ast/expressions/expression.js":
  4217. /*!******************************************!*\
  4218. !*** ./js/ast/expressions/expression.js ***!
  4219. \******************************************/
  4220. /*! exports provided: Expression */
  4221. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  4222. "use strict";
  4223. __webpack_require__.r(__webpack_exports__);
  4224. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Expression", function() { return Expression; });
  4225. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4226. 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); } }
  4227. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  4228. var Expression =
  4229. /*#__PURE__*/
  4230. function () {
  4231. function Expression() {
  4232. _classCallCheck(this, Expression);
  4233. this._sourceInfo = null;
  4234. }
  4235. _createClass(Expression, [{
  4236. key: "sourceInfo",
  4237. set: function set(sourceInfo) {
  4238. this._sourceInfo = sourceInfo;
  4239. },
  4240. get: function get() {
  4241. return this._sourceInfo;
  4242. }
  4243. }]);
  4244. return Expression;
  4245. }();
  4246. /***/ }),
  4247. /***/ "./js/ast/expressions/functionCall.js":
  4248. /*!********************************************!*\
  4249. !*** ./js/ast/expressions/functionCall.js ***!
  4250. \********************************************/
  4251. /*! exports provided: FunctionCall */
  4252. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  4253. "use strict";
  4254. __webpack_require__.r(__webpack_exports__);
  4255. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "FunctionCall", function() { return FunctionCall; });
  4256. /* harmony import */ var _expression__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./expression */ "./js/ast/expressions/expression.js");
  4257. /* harmony import */ var _processor_definedFunctions__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../processor/definedFunctions */ "./js/processor/definedFunctions.js");
  4258. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  4259. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4260. 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); } }
  4261. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  4262. function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
  4263. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  4264. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  4265. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
  4266. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  4267. var FunctionCall =
  4268. /*#__PURE__*/
  4269. function (_Expression) {
  4270. _inherits(FunctionCall, _Expression);
  4271. function FunctionCall(id, actualParameters) {
  4272. var _this;
  4273. _classCallCheck(this, FunctionCall);
  4274. _this = _possibleConstructorReturn(this, _getPrototypeOf(FunctionCall).call(this));
  4275. _this.id = id;
  4276. _this.actualParameters = actualParameters;
  4277. return _this;
  4278. }
  4279. _createClass(FunctionCall, [{
  4280. key: "toString",
  4281. value: function toString() {
  4282. var name = null;
  4283. if (this.isMainCall) {
  4284. name = _processor_definedFunctions__WEBPACK_IMPORTED_MODULE_1__["LanguageDefinedFunction"].getMainFunctionName();
  4285. } else {
  4286. name = _processor_definedFunctions__WEBPACK_IMPORTED_MODULE_1__["LanguageDefinedFunction"].getLocalName(this.id);
  4287. }
  4288. var params = null;
  4289. if (this.actualParameters.length == 0) {
  4290. params = "()";
  4291. } else {
  4292. var strParams = this.actualParameters.map(function (v) {
  4293. return v.toString();
  4294. });
  4295. params = "(" + strParams.join(",") + ")";
  4296. }
  4297. return name + params;
  4298. }
  4299. }, {
  4300. key: "isMainCall",
  4301. get: function get() {
  4302. return this.id === null;
  4303. }
  4304. }, {
  4305. key: "parametersSize",
  4306. get: function get() {
  4307. return this.actualParameters.length;
  4308. }
  4309. }]);
  4310. return FunctionCall;
  4311. }(_expression__WEBPACK_IMPORTED_MODULE_0__["Expression"]);
  4312. /***/ }),
  4313. /***/ "./js/ast/expressions/index.js":
  4314. /*!*************************************!*\
  4315. !*** ./js/ast/expressions/index.js ***!
  4316. \*************************************/
  4317. /*! exports provided: ArrayAccess, FunctionCall, IntLiteral, RealLiteral, BoolLiteral, StringLiteral, ArrayLiteral, VariableLiteral, InfixApp, UnaryApp */
  4318. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  4319. "use strict";
  4320. __webpack_require__.r(__webpack_exports__);
  4321. /* harmony import */ var _arrayAccess__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./arrayAccess */ "./js/ast/expressions/arrayAccess.js");
  4322. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "ArrayAccess", function() { return _arrayAccess__WEBPACK_IMPORTED_MODULE_0__["ArrayAccess"]; });
  4323. /* harmony import */ var _functionCall__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./functionCall */ "./js/ast/expressions/functionCall.js");
  4324. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "FunctionCall", function() { return _functionCall__WEBPACK_IMPORTED_MODULE_1__["FunctionCall"]; });
  4325. /* harmony import */ var _intLiteral__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./intLiteral */ "./js/ast/expressions/intLiteral.js");
  4326. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "IntLiteral", function() { return _intLiteral__WEBPACK_IMPORTED_MODULE_2__["IntLiteral"]; });
  4327. /* harmony import */ var _realLiteral__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./realLiteral */ "./js/ast/expressions/realLiteral.js");
  4328. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "RealLiteral", function() { return _realLiteral__WEBPACK_IMPORTED_MODULE_3__["RealLiteral"]; });
  4329. /* harmony import */ var _boolLiteral__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./boolLiteral */ "./js/ast/expressions/boolLiteral.js");
  4330. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "BoolLiteral", function() { return _boolLiteral__WEBPACK_IMPORTED_MODULE_4__["BoolLiteral"]; });
  4331. /* harmony import */ var _stringLiteral__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./stringLiteral */ "./js/ast/expressions/stringLiteral.js");
  4332. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "StringLiteral", function() { return _stringLiteral__WEBPACK_IMPORTED_MODULE_5__["StringLiteral"]; });
  4333. /* harmony import */ var _arrayLiteral__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./arrayLiteral */ "./js/ast/expressions/arrayLiteral.js");
  4334. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "ArrayLiteral", function() { return _arrayLiteral__WEBPACK_IMPORTED_MODULE_6__["ArrayLiteral"]; });
  4335. /* harmony import */ var _variableLiteral__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./variableLiteral */ "./js/ast/expressions/variableLiteral.js");
  4336. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "VariableLiteral", function() { return _variableLiteral__WEBPACK_IMPORTED_MODULE_7__["VariableLiteral"]; });
  4337. /* harmony import */ var _infixApp__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./infixApp */ "./js/ast/expressions/infixApp.js");
  4338. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "InfixApp", function() { return _infixApp__WEBPACK_IMPORTED_MODULE_8__["InfixApp"]; });
  4339. /* harmony import */ var _unaryApp__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./unaryApp */ "./js/ast/expressions/unaryApp.js");
  4340. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "UnaryApp", function() { return _unaryApp__WEBPACK_IMPORTED_MODULE_9__["UnaryApp"]; });
  4341. /***/ }),
  4342. /***/ "./js/ast/expressions/infixApp.js":
  4343. /*!****************************************!*\
  4344. !*** ./js/ast/expressions/infixApp.js ***!
  4345. \****************************************/
  4346. /*! exports provided: InfixApp */
  4347. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  4348. "use strict";
  4349. __webpack_require__.r(__webpack_exports__);
  4350. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "InfixApp", function() { return InfixApp; });
  4351. /* harmony import */ var _expression__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./expression */ "./js/ast/expressions/expression.js");
  4352. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  4353. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4354. 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); } }
  4355. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  4356. function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
  4357. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  4358. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  4359. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
  4360. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  4361. var InfixApp =
  4362. /*#__PURE__*/
  4363. function (_Expression) {
  4364. _inherits(InfixApp, _Expression);
  4365. function InfixApp(op, left, right) {
  4366. var _this;
  4367. _classCallCheck(this, InfixApp);
  4368. _this = _possibleConstructorReturn(this, _getPrototypeOf(InfixApp).call(this));
  4369. _this.op = op;
  4370. _this.left = left;
  4371. _this.right = right;
  4372. return _this;
  4373. }
  4374. _createClass(InfixApp, [{
  4375. key: "toString",
  4376. value: function toString() {
  4377. var l = this.left.toString();
  4378. var op = this.op.value;
  4379. var r = this.right.toString();
  4380. return l + op + r;
  4381. }
  4382. }]);
  4383. return InfixApp;
  4384. }(_expression__WEBPACK_IMPORTED_MODULE_0__["Expression"]);
  4385. /***/ }),
  4386. /***/ "./js/ast/expressions/intLiteral.js":
  4387. /*!******************************************!*\
  4388. !*** ./js/ast/expressions/intLiteral.js ***!
  4389. \******************************************/
  4390. /*! exports provided: IntLiteral */
  4391. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  4392. "use strict";
  4393. __webpack_require__.r(__webpack_exports__);
  4394. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "IntLiteral", function() { return IntLiteral; });
  4395. /* harmony import */ var _literal__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./literal */ "./js/ast/expressions/literal.js");
  4396. /* harmony import */ var _typeSystem_types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./../../typeSystem/types */ "./js/typeSystem/types.js");
  4397. /* harmony import */ var _typeSystem_parsers__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./../../typeSystem/parsers */ "./js/typeSystem/parsers.js");
  4398. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  4399. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4400. 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); } }
  4401. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  4402. function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
  4403. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  4404. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  4405. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
  4406. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  4407. var IntLiteral =
  4408. /*#__PURE__*/
  4409. function (_Literal) {
  4410. _inherits(IntLiteral, _Literal);
  4411. function IntLiteral(value) {
  4412. var _this;
  4413. _classCallCheck(this, IntLiteral);
  4414. _this = _possibleConstructorReturn(this, _getPrototypeOf(IntLiteral).call(this, _typeSystem_types__WEBPACK_IMPORTED_MODULE_1__["Types"].INTEGER));
  4415. _this.value = value;
  4416. return _this;
  4417. }
  4418. _createClass(IntLiteral, [{
  4419. key: "toString",
  4420. value: function toString() {
  4421. return Object(_typeSystem_parsers__WEBPACK_IMPORTED_MODULE_2__["convertToString"])(this.value, this.type);
  4422. }
  4423. }]);
  4424. return IntLiteral;
  4425. }(_literal__WEBPACK_IMPORTED_MODULE_0__["Literal"]);
  4426. /***/ }),
  4427. /***/ "./js/ast/expressions/literal.js":
  4428. /*!***************************************!*\
  4429. !*** ./js/ast/expressions/literal.js ***!
  4430. \***************************************/
  4431. /*! exports provided: Literal */
  4432. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  4433. "use strict";
  4434. __webpack_require__.r(__webpack_exports__);
  4435. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Literal", function() { return Literal; });
  4436. /* harmony import */ var _expression__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./expression */ "./js/ast/expressions/expression.js");
  4437. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  4438. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4439. function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
  4440. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  4441. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  4442. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
  4443. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  4444. var Literal =
  4445. /*#__PURE__*/
  4446. function (_Expression) {
  4447. _inherits(Literal, _Expression);
  4448. function Literal(type) {
  4449. var _this;
  4450. _classCallCheck(this, Literal);
  4451. _this = _possibleConstructorReturn(this, _getPrototypeOf(Literal).call(this));
  4452. _this.type = type;
  4453. return _this;
  4454. }
  4455. return Literal;
  4456. }(_expression__WEBPACK_IMPORTED_MODULE_0__["Expression"]);
  4457. /***/ }),
  4458. /***/ "./js/ast/expressions/realLiteral.js":
  4459. /*!*******************************************!*\
  4460. !*** ./js/ast/expressions/realLiteral.js ***!
  4461. \*******************************************/
  4462. /*! exports provided: RealLiteral */
  4463. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  4464. "use strict";
  4465. __webpack_require__.r(__webpack_exports__);
  4466. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "RealLiteral", function() { return RealLiteral; });
  4467. /* harmony import */ var _literal__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./literal */ "./js/ast/expressions/literal.js");
  4468. /* harmony import */ var _typeSystem_types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./../../typeSystem/types */ "./js/typeSystem/types.js");
  4469. /* harmony import */ var _typeSystem_parsers__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./../../typeSystem/parsers */ "./js/typeSystem/parsers.js");
  4470. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  4471. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4472. 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); } }
  4473. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  4474. function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
  4475. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  4476. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  4477. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
  4478. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  4479. var RealLiteral =
  4480. /*#__PURE__*/
  4481. function (_Literal) {
  4482. _inherits(RealLiteral, _Literal);
  4483. function RealLiteral(value) {
  4484. var _this;
  4485. _classCallCheck(this, RealLiteral);
  4486. _this = _possibleConstructorReturn(this, _getPrototypeOf(RealLiteral).call(this, _typeSystem_types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL));
  4487. _this.value = value;
  4488. return _this;
  4489. }
  4490. _createClass(RealLiteral, [{
  4491. key: "toString",
  4492. value: function toString() {
  4493. return Object(_typeSystem_parsers__WEBPACK_IMPORTED_MODULE_2__["convertToString"])(this.value, this.type);
  4494. }
  4495. }]);
  4496. return RealLiteral;
  4497. }(_literal__WEBPACK_IMPORTED_MODULE_0__["Literal"]);
  4498. /***/ }),
  4499. /***/ "./js/ast/expressions/stringLiteral.js":
  4500. /*!*********************************************!*\
  4501. !*** ./js/ast/expressions/stringLiteral.js ***!
  4502. \*********************************************/
  4503. /*! exports provided: StringLiteral */
  4504. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  4505. "use strict";
  4506. __webpack_require__.r(__webpack_exports__);
  4507. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "StringLiteral", function() { return StringLiteral; });
  4508. /* harmony import */ var _literal__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./literal */ "./js/ast/expressions/literal.js");
  4509. /* harmony import */ var _typeSystem_types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./../../typeSystem/types */ "./js/typeSystem/types.js");
  4510. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  4511. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4512. 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); } }
  4513. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  4514. function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
  4515. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  4516. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  4517. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
  4518. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  4519. var StringLiteral =
  4520. /*#__PURE__*/
  4521. function (_Literal) {
  4522. _inherits(StringLiteral, _Literal);
  4523. function StringLiteral(value) {
  4524. var _this;
  4525. _classCallCheck(this, StringLiteral);
  4526. _this = _possibleConstructorReturn(this, _getPrototypeOf(StringLiteral).call(this, _typeSystem_types__WEBPACK_IMPORTED_MODULE_1__["Types"].STRING));
  4527. _this.value = value;
  4528. return _this;
  4529. }
  4530. _createClass(StringLiteral, [{
  4531. key: "toString",
  4532. value: function toString() {
  4533. return '"' + this.value + '"';
  4534. }
  4535. }]);
  4536. return StringLiteral;
  4537. }(_literal__WEBPACK_IMPORTED_MODULE_0__["Literal"]);
  4538. /***/ }),
  4539. /***/ "./js/ast/expressions/unaryApp.js":
  4540. /*!****************************************!*\
  4541. !*** ./js/ast/expressions/unaryApp.js ***!
  4542. \****************************************/
  4543. /*! exports provided: UnaryApp */
  4544. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  4545. "use strict";
  4546. __webpack_require__.r(__webpack_exports__);
  4547. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "UnaryApp", function() { return UnaryApp; });
  4548. /* harmony import */ var _infixApp__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./infixApp */ "./js/ast/expressions/infixApp.js");
  4549. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  4550. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4551. 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); } }
  4552. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  4553. function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
  4554. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  4555. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  4556. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
  4557. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  4558. var UnaryApp =
  4559. /*#__PURE__*/
  4560. function (_InfixApp) {
  4561. _inherits(UnaryApp, _InfixApp);
  4562. function UnaryApp(op, left) {
  4563. _classCallCheck(this, UnaryApp);
  4564. return _possibleConstructorReturn(this, _getPrototypeOf(UnaryApp).call(this, op, left, null));
  4565. }
  4566. _createClass(UnaryApp, [{
  4567. key: "toString",
  4568. value: function toString() {
  4569. var l = this.left.toString();
  4570. var op = this.op.value;
  4571. return op + l;
  4572. }
  4573. }]);
  4574. return UnaryApp;
  4575. }(_infixApp__WEBPACK_IMPORTED_MODULE_0__["InfixApp"]);
  4576. /***/ }),
  4577. /***/ "./js/ast/expressions/variableLiteral.js":
  4578. /*!***********************************************!*\
  4579. !*** ./js/ast/expressions/variableLiteral.js ***!
  4580. \***********************************************/
  4581. /*! exports provided: VariableLiteral */
  4582. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  4583. "use strict";
  4584. __webpack_require__.r(__webpack_exports__);
  4585. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "VariableLiteral", function() { return VariableLiteral; });
  4586. /* harmony import */ var _literal__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./literal */ "./js/ast/expressions/literal.js");
  4587. /* harmony import */ var _typeSystem_types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./../../typeSystem/types */ "./js/typeSystem/types.js");
  4588. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  4589. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4590. 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); } }
  4591. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  4592. function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
  4593. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  4594. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  4595. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
  4596. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  4597. var VariableLiteral =
  4598. /*#__PURE__*/
  4599. function (_Literal) {
  4600. _inherits(VariableLiteral, _Literal);
  4601. function VariableLiteral(id) {
  4602. var _this;
  4603. _classCallCheck(this, VariableLiteral);
  4604. _this = _possibleConstructorReturn(this, _getPrototypeOf(VariableLiteral).call(this, _typeSystem_types__WEBPACK_IMPORTED_MODULE_1__["Types"].UNDEFINED));
  4605. _this.id = id;
  4606. return _this;
  4607. }
  4608. _createClass(VariableLiteral, [{
  4609. key: "toString",
  4610. value: function toString() {
  4611. return this.id;
  4612. }
  4613. }]);
  4614. return VariableLiteral;
  4615. }(_literal__WEBPACK_IMPORTED_MODULE_0__["Literal"]);
  4616. /***/ }),
  4617. /***/ "./js/ast/ivprogParser.js":
  4618. /*!********************************!*\
  4619. !*** ./js/ast/ivprogParser.js ***!
  4620. \********************************/
  4621. /*! exports provided: IVProgParser */
  4622. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  4623. "use strict";
  4624. __webpack_require__.r(__webpack_exports__);
  4625. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "IVProgParser", function() { return IVProgParser; });
  4626. /* harmony import */ var antlr4_index__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! antlr4/index */ "./node_modules/antlr4/index.js");
  4627. /* harmony import */ var antlr4_index__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(antlr4_index__WEBPACK_IMPORTED_MODULE_0__);
  4628. /* harmony import */ var _expressions___WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./expressions/ */ "./js/ast/expressions/index.js");
  4629. /* harmony import */ var _commands___WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./commands/ */ "./js/ast/commands/index.js");
  4630. /* harmony import */ var _typeSystem_parsers__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./../typeSystem/parsers */ "./js/typeSystem/parsers.js");
  4631. /* harmony import */ var _typeSystem_types__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./../typeSystem/types */ "./js/typeSystem/types.js");
  4632. /* harmony import */ var _typeSystem_compoundType__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./../typeSystem/compoundType */ "./js/typeSystem/compoundType.js");
  4633. /* harmony import */ var _sourceInfo__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./sourceInfo */ "./js/ast/sourceInfo.js");
  4634. /* harmony import */ var _operators__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./operators */ "./js/ast/operators.js");
  4635. /* harmony import */ var _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./error/syntaxErrorFactory */ "./js/ast/error/syntaxErrorFactory.js");
  4636. /* harmony import */ var _processor_definedFunctions__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./../processor/definedFunctions */ "./js/processor/definedFunctions.js");
  4637. /* harmony import */ var _services_languageService__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../services/languageService */ "./js/services/languageService.js");
  4638. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4639. 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); } }
  4640. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  4641. var IVProgParser =
  4642. /*#__PURE__*/
  4643. function () {
  4644. _createClass(IVProgParser, null, [{
  4645. key: "createParser",
  4646. value: function createParser(input) {
  4647. var lexerClass = _services_languageService__WEBPACK_IMPORTED_MODULE_10__["LanguageService"].getCurrentLexer();
  4648. return new IVProgParser(input, lexerClass);
  4649. } // <BEGIN scope consts>
  4650. }, {
  4651. key: "BASE",
  4652. get: function get() {
  4653. return 0;
  4654. }
  4655. }, {
  4656. key: "FUNCTION",
  4657. get: function get() {
  4658. return 1;
  4659. }
  4660. }, {
  4661. key: "COMMAND",
  4662. get: function get() {
  4663. return 2;
  4664. }
  4665. }, {
  4666. key: "BREAKABLE",
  4667. get: function get() {
  4668. return 4;
  4669. } // </ END scope consts>
  4670. }]);
  4671. function IVProgParser(input, lexerClass) {
  4672. _classCallCheck(this, IVProgParser);
  4673. this.lexerClass = lexerClass;
  4674. this.lexer = new lexerClass(new antlr4_index__WEBPACK_IMPORTED_MODULE_0__["InputStream"](input));
  4675. this.tokenStream = new antlr4_index__WEBPACK_IMPORTED_MODULE_0__["CommonTokenStream"](this.lexer);
  4676. this.tokenStream.fill();
  4677. this.pos = 1;
  4678. this.variableTypes = [this.lexerClass.RK_INTEGER, this.lexerClass.RK_REAL, this.lexerClass.RK_BOOLEAN, this.lexerClass.RK_STRING];
  4679. this.functionTypes = this.variableTypes.concat(this.lexerClass.RK_VOID);
  4680. this.parsingArrayDimension = 0;
  4681. this.scope = [];
  4682. this.langFuncs = _services_languageService__WEBPACK_IMPORTED_MODULE_10__["LanguageService"].getCurrentLangFuncs();
  4683. this.definedFuncsNameList = [];
  4684. this.definedVariablesStack = [];
  4685. }
  4686. _createClass(IVProgParser, [{
  4687. key: "parseTree",
  4688. value: function parseTree() {
  4689. return this.parseProgram();
  4690. }
  4691. }, {
  4692. key: "getToken",
  4693. value: function getToken() {
  4694. var index = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.pos;
  4695. // if(index === null)
  4696. // index = this.pos;
  4697. return this.tokenStream.LT(index);
  4698. }
  4699. }, {
  4700. key: "insideScope",
  4701. value: function insideScope(scope) {
  4702. if (this.scope.length <= 0) {
  4703. return IVProgParser.BASE === scope;
  4704. } else {
  4705. return this.scope[this.scope.length - 1] === scope;
  4706. }
  4707. }
  4708. }, {
  4709. key: "pushScope",
  4710. value: function pushScope(scope) {
  4711. this.scope.push(scope);
  4712. }
  4713. }, {
  4714. key: "pushVariableStack",
  4715. value: function pushVariableStack() {
  4716. this.definedVariablesStack.push([]);
  4717. }
  4718. }, {
  4719. key: "popScope",
  4720. value: function popScope() {
  4721. return this.scope.pop();
  4722. }
  4723. }, {
  4724. key: "popVariableStack",
  4725. value: function popVariableStack() {
  4726. return this.definedVariablesStack.pop();
  4727. }
  4728. }, {
  4729. key: "getCurrentVariableStack",
  4730. value: function getCurrentVariableStack() {
  4731. return this.definedVariablesStack[this.definedVariablesStack.length - 1];
  4732. }
  4733. }, {
  4734. key: "isEOF",
  4735. value: function isEOF() {
  4736. this.getToken(this.pos);
  4737. return this.tokenStream.fetchedEOF;
  4738. }
  4739. }, {
  4740. key: "parseProgram",
  4741. value: function parseProgram() {
  4742. var token = this.getToken();
  4743. var globalVars = [];
  4744. var functions = [];
  4745. if (this.lexerClass.RK_PROGRAM === token.type) {
  4746. this.pos++;
  4747. this.consumeNewLines();
  4748. this.checkOpenCurly();
  4749. this.pos++;
  4750. this.pushVariableStack();
  4751. while (true) {
  4752. this.consumeNewLines();
  4753. var _token = this.getToken();
  4754. if (_token.type === this.lexerClass.RK_CONST || this.isVariableType(_token)) {
  4755. globalVars = globalVars.concat(this.parseGlobalVariables());
  4756. } else if (_token.type === this.lexerClass.RK_FUNCTION) {
  4757. this.pushVariableStack();
  4758. functions = functions.concat(this.parseFunction());
  4759. this.popVariableStack();
  4760. } else {
  4761. break;
  4762. }
  4763. }
  4764. this.consumeNewLines();
  4765. this.checkCloseCurly();
  4766. this.pos++;
  4767. this.consumeNewLines();
  4768. if (!this.isEOF()) {
  4769. throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_8__["SyntaxErrorFactory"].extra_lines();
  4770. }
  4771. this.popVariableStack();
  4772. return {
  4773. global: globalVars,
  4774. functions: functions
  4775. };
  4776. } else {
  4777. throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_8__["SyntaxErrorFactory"].token_missing_one(this.lexer.literalNames[this.lexerClass.RK_PROGRAM], token);
  4778. }
  4779. }
  4780. }, {
  4781. key: "checkOpenCurly",
  4782. value: function checkOpenCurly() {
  4783. var attempt = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  4784. var token = this.getToken();
  4785. if (this.lexerClass.OPEN_CURLY !== token.type) {
  4786. if (!attempt) throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_8__["SyntaxErrorFactory"].token_missing_one('{', token);else return false;
  4787. }
  4788. return true;
  4789. }
  4790. }, {
  4791. key: "checkCloseCurly",
  4792. value: function checkCloseCurly() {
  4793. var attempt = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  4794. var token = this.getToken();
  4795. if (this.lexerClass.CLOSE_CURLY !== token.type) {
  4796. if (!attempt) throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_8__["SyntaxErrorFactory"].token_missing_one('}', token);else return false;
  4797. }
  4798. return true;
  4799. }
  4800. /* It checks if the current token at position pos is a ']'.
  4801. * As a check function it doesn't increment pos.
  4802. *
  4803. * @params bool:attempt, indicates that the token is optional. Defaults: false
  4804. *
  4805. * @returns true if the attempt is true and current token is '[',
  4806. * false is attempt is true and current token is not '['
  4807. **/
  4808. }, {
  4809. key: "checkOpenBrace",
  4810. value: function checkOpenBrace() {
  4811. var attempt = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  4812. var token = this.getToken();
  4813. if (this.lexerClass.OPEN_BRACE !== token.type) {
  4814. if (!attempt) {
  4815. throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_8__["SyntaxErrorFactory"].token_missing_one('[', token);
  4816. } else {
  4817. return false;
  4818. }
  4819. }
  4820. return true;
  4821. }
  4822. }, {
  4823. key: "checkCloseBrace",
  4824. value: function checkCloseBrace() {
  4825. var attempt = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  4826. var token = this.getToken();
  4827. if (this.lexerClass.CLOSE_BRACE !== token.type) {
  4828. if (!attempt) {
  4829. throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_8__["SyntaxErrorFactory"].token_missing_one(']', token);
  4830. } else {
  4831. return false;
  4832. }
  4833. }
  4834. return true;
  4835. }
  4836. }, {
  4837. key: "checkOpenParenthesis",
  4838. value: function checkOpenParenthesis() {
  4839. var attempt = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  4840. var token = this.getToken();
  4841. if (this.lexerClass.OPEN_PARENTHESIS !== token.type) {
  4842. if (!attempt) {
  4843. throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_8__["SyntaxErrorFactory"].token_missing_one('(', token);
  4844. } else {
  4845. return false;
  4846. }
  4847. }
  4848. return true;
  4849. }
  4850. }, {
  4851. key: "checkCloseParenthesis",
  4852. value: function checkCloseParenthesis() {
  4853. var attempt = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  4854. var token = this.getToken();
  4855. if (this.lexerClass.CLOSE_PARENTHESIS !== token.type) {
  4856. if (!attempt) {
  4857. throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_8__["SyntaxErrorFactory"].token_missing_one(')', token);
  4858. } else {
  4859. return false;
  4860. }
  4861. }
  4862. return true;
  4863. }
  4864. }, {
  4865. key: "checkEOS",
  4866. value: function checkEOS() {
  4867. var attempt = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  4868. var eosToken = this.getToken();
  4869. if (eosToken.type !== this.lexerClass.EOS) {
  4870. if (!attempt) throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_8__["SyntaxErrorFactory"].eos_missing(eosToken);else return false;
  4871. }
  4872. return true;
  4873. }
  4874. }, {
  4875. key: "checkFunctionDuplicate",
  4876. value: function checkFunctionDuplicate(functionID, funcIDToken) {
  4877. var id = functionID === null ? "$main" : functionID;
  4878. var index = this.definedFuncsNameList.indexOf(id);
  4879. if (index !== -1) {
  4880. throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_8__["SyntaxErrorFactory"].duplicate_function(funcIDToken);
  4881. }
  4882. this.definedFuncsNameList.push(id);
  4883. }
  4884. }, {
  4885. key: "checkVariableDuplicate",
  4886. value: function checkVariableDuplicate(variableID, variableIDToken) {
  4887. var index = this.getCurrentVariableStack().indexOf(variableID);
  4888. if (index !== -1) {
  4889. throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_8__["SyntaxErrorFactory"].duplicate_variable(variableIDToken);
  4890. }
  4891. this.getCurrentVariableStack().push(variableID);
  4892. }
  4893. }, {
  4894. key: "consumeForSemiColon",
  4895. value: function consumeForSemiColon() {
  4896. var eosToken = this.getToken();
  4897. if (eosToken.type === this.lexerClass.EOS && eosToken.text.match(';')) {
  4898. this.pos++;
  4899. return;
  4900. }
  4901. throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_8__["SyntaxErrorFactory"].token_missing_one(';', eosToken);
  4902. }
  4903. }, {
  4904. key: "parseGlobalVariables",
  4905. value: function parseGlobalVariables() {
  4906. var decl = this.parseMaybeConst();
  4907. this.checkEOS();
  4908. this.pos++;
  4909. return decl;
  4910. }
  4911. /*
  4912. * Checks if the next token is PR_CONST. It's only available
  4913. * at global variables declaration level
  4914. * @returns Declararion(const, type, id, initVal?)
  4915. **/
  4916. }, {
  4917. key: "parseMaybeConst",
  4918. value: function parseMaybeConst() {
  4919. var constToken = this.getToken();
  4920. if (constToken.type === this.lexerClass.RK_CONST) {
  4921. this.pos++;
  4922. var typeString = this.parseType();
  4923. return this.parseDeclaration(typeString, true);
  4924. } else if (this.isVariableType(constToken)) {
  4925. var _typeString = this.parseType();
  4926. return this.parseDeclaration(_typeString);
  4927. } else {
  4928. throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_8__["SyntaxErrorFactory"].token_missing_list([this.lexer.literalNames[this.lexerClass.RK_CONST]].concat(this.getTypeArray()), constToken);
  4929. }
  4930. }
  4931. /*
  4932. * Parses a declarion of the form: type --- id --- (= --- EAnd)?
  4933. * @returns a list of Declararion(const, type, id, initVal?)
  4934. **/
  4935. }, {
  4936. key: "parseDeclaration",
  4937. value: function parseDeclaration(typeString) {
  4938. var isConst = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  4939. var initial = null;
  4940. var dim1 = null;
  4941. var dim2 = null;
  4942. var idToken = this.getToken();
  4943. var idString = this.parseID();
  4944. this.checkVariableDuplicate(idString, idToken); // Check for array or vector
  4945. // ID[int/IDi][int/IDj]
  4946. if (this.checkOpenBrace(true)) {
  4947. this.pos++;
  4948. this.consumeNewLines();
  4949. dim1 = this.parseArrayDimension();
  4950. this.consumeNewLines();
  4951. this.checkCloseBrace();
  4952. this.pos++;
  4953. if (this.checkOpenBrace(true)) {
  4954. this.pos++;
  4955. this.consumeNewLines();
  4956. dim2 = this.parseArrayDimension();
  4957. this.consumeNewLines();
  4958. this.checkCloseBrace();
  4959. this.pos++;
  4960. }
  4961. }
  4962. var equalsToken = this.getToken();
  4963. if (isConst && equalsToken.type !== this.lexerClass.EQUAL) {
  4964. throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_8__["SyntaxErrorFactory"].const_not_init(idToken);
  4965. }
  4966. if (equalsToken.type === this.lexerClass.EQUAL) {
  4967. this.pos++;
  4968. initial = this.parseExpressionOR();
  4969. }
  4970. var declaration = null;
  4971. var dimensions = 0;
  4972. if (dim1 !== null) {
  4973. dimensions++;
  4974. if (dim2 !== null) {
  4975. dimensions++;
  4976. }
  4977. declaration = new _commands___WEBPACK_IMPORTED_MODULE_2__["ArrayDeclaration"](idString, new _typeSystem_compoundType__WEBPACK_IMPORTED_MODULE_5__["CompoundType"](typeString, dimensions), dim1, dim2, initial, isConst);
  4978. } else {
  4979. declaration = new _commands___WEBPACK_IMPORTED_MODULE_2__["Declaration"](idString, typeString, initial, isConst);
  4980. }
  4981. declaration.sourceInfo = _sourceInfo__WEBPACK_IMPORTED_MODULE_6__["SourceInfo"].createSourceInfo(idToken);
  4982. var commaToken = this.getToken();
  4983. if (commaToken.type === this.lexerClass.COMMA) {
  4984. this.pos++;
  4985. this.consumeNewLines();
  4986. return [declaration].concat(this.parseDeclaration(typeString, isConst));
  4987. } else {
  4988. return [declaration];
  4989. }
  4990. }
  4991. }, {
  4992. key: "consumeNewLines",
  4993. value: function consumeNewLines() {
  4994. var token = this.getToken();
  4995. while (token.type === this.lexerClass.EOS && token.text.match('[\r\n]+')) {
  4996. this.pos++;
  4997. token = this.getToken();
  4998. }
  4999. }
  5000. }, {
  5001. key: "isVariableType",
  5002. value: function isVariableType(token) {
  5003. return this.variableTypes.find(function (v) {
  5004. return v === token.type;
  5005. });
  5006. }
  5007. /*
  5008. * Reads the next token of the stream to check if it is a Integer or an ID.
  5009. * @returns Integer | ID
  5010. **/
  5011. }, {
  5012. key: "parseArrayDimension",
  5013. value: function parseArrayDimension() {
  5014. var dimToken = this.getToken();
  5015. if (dimToken.type === this.lexerClass.INTEGER) {
  5016. //parse as int literal
  5017. this.pos++;
  5018. return this.getIntLiteral(dimToken);
  5019. } else if (dimToken.type === this.lexerClass.ID) {
  5020. //parse as variable
  5021. this.pos++;
  5022. return this.parseVariable(dimToken);
  5023. } else {
  5024. throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_8__["SyntaxErrorFactory"].invalid_array_dimension(this.lexer.literalNames[this.lexerClass.RK_INTEGER], dimToken);
  5025. }
  5026. }
  5027. /*
  5028. * Returns an object {type: 'int', value: value}.
  5029. * It checks for binary and hexadecimal integers.
  5030. * @returns object with fields type and value
  5031. **/
  5032. }, {
  5033. key: "getIntLiteral",
  5034. value: function getIntLiteral(token) {
  5035. var text = token.text;
  5036. var sourceInfo = _sourceInfo__WEBPACK_IMPORTED_MODULE_6__["SourceInfo"].createSourceInfo(token);
  5037. var exp = new _expressions___WEBPACK_IMPORTED_MODULE_1__["IntLiteral"](Object(_typeSystem_parsers__WEBPACK_IMPORTED_MODULE_3__["toInt"])(text));
  5038. exp.sourceInfo = sourceInfo;
  5039. return exp;
  5040. }
  5041. }, {
  5042. key: "getRealLiteral",
  5043. value: function getRealLiteral(token) {
  5044. var sourceInfo = _sourceInfo__WEBPACK_IMPORTED_MODULE_6__["SourceInfo"].createSourceInfo(token);
  5045. var exp = new _expressions___WEBPACK_IMPORTED_MODULE_1__["RealLiteral"](Object(_typeSystem_parsers__WEBPACK_IMPORTED_MODULE_3__["toReal"])(token.text));
  5046. exp.sourceInfo = sourceInfo;
  5047. return exp;
  5048. }
  5049. }, {
  5050. key: "getStringLiteral",
  5051. value: function getStringLiteral(token) {
  5052. var text = token.text;
  5053. var sourceInfo = _sourceInfo__WEBPACK_IMPORTED_MODULE_6__["SourceInfo"].createSourceInfo(token);
  5054. var exp = new _expressions___WEBPACK_IMPORTED_MODULE_1__["StringLiteral"](Object(_typeSystem_parsers__WEBPACK_IMPORTED_MODULE_3__["toString"])(text));
  5055. exp.sourceInfo = sourceInfo;
  5056. return exp;
  5057. }
  5058. }, {
  5059. key: "getBoolLiteral",
  5060. value: function getBoolLiteral(token) {
  5061. var val = Object(_typeSystem_parsers__WEBPACK_IMPORTED_MODULE_3__["toBool"])(token.text);
  5062. var exp = new _expressions___WEBPACK_IMPORTED_MODULE_1__["BoolLiteral"](val);
  5063. exp.sourceInfo = _sourceInfo__WEBPACK_IMPORTED_MODULE_6__["SourceInfo"].createSourceInfo(token);
  5064. ;
  5065. return exp;
  5066. }
  5067. }, {
  5068. key: "parseArrayLiteral",
  5069. value: function parseArrayLiteral() {
  5070. this.checkOpenCurly();
  5071. var beginArray = this.getToken();
  5072. if (this.parsingArrayDimension >= 2) {
  5073. throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_8__["SyntaxErrorFactory"].token_missing_list("Array dimensions exceed maximum size of 2 at line ".concat(beginArray.line));
  5074. }
  5075. this.pos++;
  5076. this.parsingArrayDimension++;
  5077. this.consumeNewLines();
  5078. var data = this.parseExpressionList();
  5079. this.consumeNewLines();
  5080. this.checkCloseCurly();
  5081. var endArray = this.getToken();
  5082. this.pos++;
  5083. this.parsingArrayDimension--;
  5084. if (this.parsingArrayDimension === 0) {// if (!data.isValid) {
  5085. // // TODO: better error message
  5086. // console.log('invalid array');
  5087. // throw new Error(`Invalid array at line ${beginArray.line}`);
  5088. // }
  5089. }
  5090. var sourceInfo = _sourceInfo__WEBPACK_IMPORTED_MODULE_6__["SourceInfo"].createSourceInfoFromList(beginArray, endArray);
  5091. var dataDim = 1;
  5092. if (data[0] instanceof _expressions___WEBPACK_IMPORTED_MODULE_1__["ArrayLiteral"]) {
  5093. dataDim++;
  5094. }
  5095. var type = new _typeSystem_compoundType__WEBPACK_IMPORTED_MODULE_5__["CompoundType"](_typeSystem_types__WEBPACK_IMPORTED_MODULE_4__["Types"].UNDEFINED, dataDim);
  5096. var exp = new _expressions___WEBPACK_IMPORTED_MODULE_1__["ArrayLiteral"](type, data);
  5097. exp.sourceInfo = sourceInfo;
  5098. return exp;
  5099. }
  5100. /*
  5101. * Returns an object {type: 'variable', value: value}.
  5102. * @returns object with fields type and value
  5103. **/
  5104. }, {
  5105. key: "parseVariable",
  5106. value: function parseVariable(token) {
  5107. var sourceInfo = _sourceInfo__WEBPACK_IMPORTED_MODULE_6__["SourceInfo"].createSourceInfo(token);
  5108. var exp = new _expressions___WEBPACK_IMPORTED_MODULE_1__["VariableLiteral"](token.text);
  5109. exp.sourceInfo = sourceInfo;
  5110. return exp;
  5111. }
  5112. /*
  5113. * Returns an object representing a function. It has
  5114. * four attributes: returnType, id, formalParams and block.
  5115. * The block object has two attributes: declarations and commands
  5116. **/
  5117. }, {
  5118. key: "parseFunction",
  5119. value: function parseFunction() {
  5120. this.pushScope(IVProgParser.FUNCTION);
  5121. var formalParams = [];
  5122. var token = this.getToken();
  5123. if (token.type !== this.lexerClass.RK_FUNCTION) {
  5124. //throw SyntaxError.createError(this.lexer.literalNames[this.lexerClass.PR_FUNCAO], token);
  5125. return null;
  5126. }
  5127. this.pos++;
  5128. var funType = this.parseType();
  5129. var dimensions = 0;
  5130. if (this.checkOpenBrace(true)) {
  5131. this.pos++;
  5132. this.checkCloseBrace();
  5133. this.pos++;
  5134. dimensions++;
  5135. if (this.checkOpenBrace(true)) {
  5136. this.pos++;
  5137. this.checkCloseBrace();
  5138. this.pos++;
  5139. dimensions++;
  5140. }
  5141. }
  5142. var funcIDToken = this.getToken();
  5143. var functionID = this.parseID();
  5144. this.checkFunctionDuplicate(functionID, funcIDToken);
  5145. this.checkOpenParenthesis();
  5146. this.pos++;
  5147. this.consumeNewLines();
  5148. if (!this.checkCloseParenthesis(true)) {
  5149. formalParams = this.parseFormalParameters(); // formal parameters
  5150. this.consumeNewLines();
  5151. this.checkCloseParenthesis();
  5152. this.pos++;
  5153. } else {
  5154. this.pos++;
  5155. }
  5156. this.consumeNewLines();
  5157. var commandsBlock = this.parseCommandBlock();
  5158. var returnType = funType;
  5159. if (dimensions > 0) {
  5160. returnType = new _typeSystem_compoundType__WEBPACK_IMPORTED_MODULE_5__["CompoundType"](funType, dimensions);
  5161. }
  5162. var func = new _commands___WEBPACK_IMPORTED_MODULE_2__["Function"](functionID, returnType, formalParams, commandsBlock);
  5163. if (functionID === null && !func.isMain) {
  5164. throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_8__["SyntaxErrorFactory"].invalid_main_return(_processor_definedFunctions__WEBPACK_IMPORTED_MODULE_9__["LanguageDefinedFunction"].getMainFunctionName(), this.lexer.literalNames[this.lexerClass.RK_VOID], token.line);
  5165. } else if (func.isMain && formalParams.length !== 0) {
  5166. throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_8__["SyntaxErrorFactory"].main_parameters();
  5167. }
  5168. this.popScope();
  5169. return func;
  5170. }
  5171. /*
  5172. * Parse the formal parameters of a function.
  5173. * @returns a list of objects with the following attributes: type, id and dimensions.
  5174. **/
  5175. }, {
  5176. key: "parseFormalParameters",
  5177. value: function parseFormalParameters() {
  5178. var list = [];
  5179. while (true) {
  5180. var dimensions = 0;
  5181. var typeString = this.parseType();
  5182. var idToken = this.getToken();
  5183. var idString = this.parseID();
  5184. this.checkVariableDuplicate(idString, idToken);
  5185. if (this.checkOpenBrace(true)) {
  5186. this.pos++;
  5187. dimensions++;
  5188. this.checkCloseBrace();
  5189. this.pos++;
  5190. if (this.checkOpenBrace(true)) {
  5191. this.pos++;
  5192. dimensions++;
  5193. this.checkCloseBrace();
  5194. this.pos++;
  5195. }
  5196. }
  5197. var type = null;
  5198. if (dimensions > 0) {
  5199. type = new _typeSystem_compoundType__WEBPACK_IMPORTED_MODULE_5__["CompoundType"](typeString, dimensions);
  5200. } else {
  5201. type = typeString;
  5202. }
  5203. list.push(new _commands___WEBPACK_IMPORTED_MODULE_2__["FormalParameter"](type, idString));
  5204. var commaToken = this.getToken();
  5205. if (commaToken.type !== this.lexerClass.COMMA) break;
  5206. this.pos++;
  5207. this.consumeNewLines();
  5208. }
  5209. return list;
  5210. }
  5211. }, {
  5212. key: "parseID",
  5213. value: function parseID() {
  5214. var token = this.getToken();
  5215. if (token.type !== this.lexerClass.ID) {
  5216. throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_8__["SyntaxErrorFactory"].id_missing(token);
  5217. }
  5218. this.pos++;
  5219. if (this.insideScope(IVProgParser.FUNCTION)) {
  5220. if (token.text === _processor_definedFunctions__WEBPACK_IMPORTED_MODULE_9__["LanguageDefinedFunction"].getMainFunctionName()) {
  5221. return null;
  5222. }
  5223. }
  5224. return token.text;
  5225. }
  5226. }, {
  5227. key: "parseMaybeLibID",
  5228. value: function parseMaybeLibID() {
  5229. var token = this.getToken();
  5230. if (token.type !== this.lexerClass.ID && token.type !== this.lexerClass.LIB_ID) {
  5231. throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_8__["SyntaxErrorFactory"].id_missing(token);
  5232. }
  5233. this.pos++;
  5234. return token.text;
  5235. }
  5236. }, {
  5237. key: "parseType",
  5238. value: function parseType() {
  5239. var token = this.getToken();
  5240. if (token.type === this.lexerClass.ID && this.insideScope(IVProgParser.FUNCTION)) {
  5241. return _typeSystem_types__WEBPACK_IMPORTED_MODULE_4__["Types"].VOID;
  5242. } else if (token.type === this.lexerClass.RK_VOID && this.insideScope(IVProgParser.FUNCTION)) {
  5243. this.pos++;
  5244. return _typeSystem_types__WEBPACK_IMPORTED_MODULE_4__["Types"].VOID;
  5245. } else if (this.isVariableType(token)) {
  5246. this.pos++;
  5247. switch (token.type) {
  5248. case this.lexerClass.RK_INTEGER:
  5249. return _typeSystem_types__WEBPACK_IMPORTED_MODULE_4__["Types"].INTEGER;
  5250. case this.lexerClass.RK_BOOLEAN:
  5251. return _typeSystem_types__WEBPACK_IMPORTED_MODULE_4__["Types"].BOOLEAN;
  5252. case this.lexerClass.RK_REAL:
  5253. return _typeSystem_types__WEBPACK_IMPORTED_MODULE_4__["Types"].REAL;
  5254. case this.lexerClass.RK_STRING:
  5255. return _typeSystem_types__WEBPACK_IMPORTED_MODULE_4__["Types"].STRING;
  5256. default:
  5257. break;
  5258. }
  5259. }
  5260. throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_8__["SyntaxErrorFactory"].invalid_type(this.getTypeArray(), token);
  5261. }
  5262. }, {
  5263. key: "parseCommandBlock",
  5264. value: function parseCommandBlock() {
  5265. var optionalCurly = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  5266. var variablesDecl = [];
  5267. var commands = [];
  5268. var hasOpen = false;
  5269. if (this.checkOpenCurly(optionalCurly)) {
  5270. this.pos++;
  5271. hasOpen = true;
  5272. }
  5273. this.consumeNewLines();
  5274. while (true) {
  5275. var cmd = this.parseCommand();
  5276. if (cmd === null) break;
  5277. if (cmd !== -1) {
  5278. if (cmd instanceof Array) {
  5279. variablesDecl = variablesDecl.concat(cmd);
  5280. } else {
  5281. commands.push(cmd);
  5282. }
  5283. }
  5284. }
  5285. this.consumeNewLines();
  5286. if (hasOpen) {
  5287. this.checkCloseCurly();
  5288. this.pos++;
  5289. this.consumeNewLines();
  5290. }
  5291. return new _commands___WEBPACK_IMPORTED_MODULE_2__["CommandBlock"](variablesDecl, commands);
  5292. }
  5293. }, {
  5294. key: "parseCommand",
  5295. value: function parseCommand() {
  5296. var token = this.getToken();
  5297. if (this.isVariableType(token)) {
  5298. if (!this.insideScope(IVProgParser.FUNCTION)) {
  5299. throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_8__["SyntaxErrorFactory"].invalid_var_declaration(token.line);
  5300. }
  5301. this.pushScope(IVProgParser.BASE);
  5302. var varType = this.parseType();
  5303. this.popScope();
  5304. var cmd = this.parseDeclaration(varType);
  5305. this.checkEOS();
  5306. this.pos++;
  5307. return cmd;
  5308. } else if (token.type === this.lexerClass.ID) {
  5309. return this.parseIDCommand();
  5310. } else if (token.type === this.lexerClass.LIB_ID) {
  5311. return this.parseIDCommand();
  5312. } else if (token.type === this.lexerClass.RK_RETURN) {
  5313. return this.parseReturn();
  5314. } else if (token.type === this.lexerClass.RK_WHILE) {
  5315. return this.parseWhile();
  5316. } else if (token.type === this.lexerClass.RK_FOR) {
  5317. return this.parseFor();
  5318. } else if (token.type === this.lexerClass.RK_BREAK) {
  5319. if (!this.insideScope(IVProgParser.BREAKABLE)) {
  5320. throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_8__["SyntaxErrorFactory"].invalid_break_command(this.lexer.literalNames[this.lexerClass.RK_BREAK], token);
  5321. }
  5322. return this.parseBreak();
  5323. } else if (token.type === this.lexerClass.RK_SWITCH) {
  5324. return this.parseSwitchCase();
  5325. } else if (token.type === this.lexerClass.RK_DO) {
  5326. return this.parseDoWhile();
  5327. } else if (token.type === this.lexerClass.RK_IF) {
  5328. return this.parseIfThenElse();
  5329. } else if (this.checkEOS(true)) {
  5330. this.pos++;
  5331. return -1;
  5332. } else {
  5333. return null;
  5334. }
  5335. }
  5336. }, {
  5337. key: "parseSwitchCase",
  5338. value: function parseSwitchCase() {
  5339. this.pushScope(IVProgParser.BREAKABLE);
  5340. this.pos++;
  5341. this.checkOpenParenthesis();
  5342. this.pos++;
  5343. this.consumeNewLines();
  5344. var exp = this.parseExpressionOR();
  5345. this.consumeNewLines();
  5346. this.checkCloseParenthesis();
  5347. this.pos++;
  5348. this.consumeNewLines();
  5349. this.checkOpenCurly();
  5350. this.pos++;
  5351. this.consumeNewLines();
  5352. var casesList = this.parseCases();
  5353. this.consumeNewLines();
  5354. this.checkCloseCurly();
  5355. this.pos++;
  5356. this.consumeNewLines();
  5357. this.popScope();
  5358. return new _commands___WEBPACK_IMPORTED_MODULE_2__["Switch"](exp, casesList);
  5359. }
  5360. }, {
  5361. key: "parseDoWhile",
  5362. value: function parseDoWhile() {
  5363. this.pos++;
  5364. this.consumeNewLines();
  5365. this.pushScope(IVProgParser.BREAKABLE);
  5366. var commandsBlock = this.parseCommandBlock();
  5367. this.consumeNewLines(); //Maybe not...
  5368. var whileToken = this.getToken();
  5369. if (whileToken.type !== this.lexerClass.RK_WHILE) {
  5370. throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_8__["SyntaxErrorFactory"].token_missing_one(this.lexer.literalNames[this.lexerClass.RK_WHILE], whileToken);
  5371. }
  5372. this.pos++;
  5373. this.checkOpenParenthesis();
  5374. this.pos++;
  5375. this.consumeNewLines();
  5376. var condition = this.parseExpressionOR();
  5377. this.consumeNewLines();
  5378. this.checkCloseParenthesis();
  5379. this.pos++;
  5380. this.checkEOS();
  5381. this.popScope();
  5382. return new _commands___WEBPACK_IMPORTED_MODULE_2__["DoWhile"](condition, commandsBlock);
  5383. }
  5384. }, {
  5385. key: "parseIfThenElse",
  5386. value: function parseIfThenElse() {
  5387. if (this.insideScope(IVProgParser.BREAKABLE)) {
  5388. this.pushScope(IVProgParser.BREAKABLE);
  5389. } else {
  5390. this.pushScope(IVProgParser.COMMAND);
  5391. }
  5392. var token = this.getToken();
  5393. this.pos++;
  5394. this.checkOpenParenthesis();
  5395. this.pos++;
  5396. this.consumeNewLines();
  5397. var logicalExpression = this.parseExpressionOR();
  5398. this.consumeNewLines();
  5399. this.checkCloseParenthesis();
  5400. this.pos++;
  5401. this.consumeNewLines();
  5402. var cmdBlocks = this.parseCommandBlock();
  5403. var maybeElse = this.getToken();
  5404. if (maybeElse.type === this.lexerClass.RK_ELSE) {
  5405. this.pos++;
  5406. this.consumeNewLines();
  5407. var maybeIf = this.getToken();
  5408. var elseBlock = null;
  5409. if (this.checkOpenCurly(true)) {
  5410. elseBlock = this.parseCommandBlock();
  5411. } else if (maybeIf.type === this.lexerClass.RK_IF) {
  5412. elseBlock = this.parseIfThenElse();
  5413. } else {
  5414. throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_8__["SyntaxErrorFactory"].token_missing_list([this.lexer.literalNames[this.lexerClass.RK_IF], '{'], maybeIf);
  5415. }
  5416. this.popScope();
  5417. var _cmd = new _commands___WEBPACK_IMPORTED_MODULE_2__["IfThenElse"](logicalExpression, cmdBlocks, elseBlock);
  5418. _cmd.sourceInfo = _sourceInfo__WEBPACK_IMPORTED_MODULE_6__["SourceInfo"].createSourceInfo(token);
  5419. return _cmd;
  5420. }
  5421. this.popScope();
  5422. var cmd = new _commands___WEBPACK_IMPORTED_MODULE_2__["IfThenElse"](logicalExpression, cmdBlocks, null);
  5423. cmd.sourceInfo = _sourceInfo__WEBPACK_IMPORTED_MODULE_6__["SourceInfo"].createSourceInfo(token);
  5424. return cmd;
  5425. }
  5426. }, {
  5427. key: "parseFor",
  5428. value: function parseFor() {
  5429. this.pushScope(IVProgParser.BREAKABLE);
  5430. this.pos++;
  5431. this.checkOpenParenthesis();
  5432. this.pos++;
  5433. this.consumeNewLines();
  5434. var attribution = this.parseForAssign();
  5435. this.consumeNewLines();
  5436. var condition = this.parseExpressionOR();
  5437. this.consumeForSemiColon();
  5438. var increment = this.parseForAssign(true);
  5439. this.checkCloseParenthesis();
  5440. this.pos++;
  5441. this.consumeNewLines();
  5442. var commandsBlock = this.parseCommandBlock();
  5443. this.popScope();
  5444. return new _commands___WEBPACK_IMPORTED_MODULE_2__["For"](attribution, condition, increment, commandsBlock);
  5445. }
  5446. }, {
  5447. key: "parseWhile",
  5448. value: function parseWhile() {
  5449. this.pushScope(IVProgParser.BREAKABLE);
  5450. var token = this.getToken();
  5451. this.pos++;
  5452. this.checkOpenParenthesis();
  5453. this.pos++;
  5454. this.consumeNewLines();
  5455. var logicalExpression = this.parseExpressionOR();
  5456. this.consumeNewLines();
  5457. this.checkCloseParenthesis();
  5458. this.pos++;
  5459. this.consumeNewLines();
  5460. var cmdBlocks = this.parseCommandBlock();
  5461. this.popScope();
  5462. var cmd = new _commands___WEBPACK_IMPORTED_MODULE_2__["While"](logicalExpression, cmdBlocks);
  5463. cmd.sourceInfo = _sourceInfo__WEBPACK_IMPORTED_MODULE_6__["SourceInfo"].createSourceInfo(token);
  5464. return cmd;
  5465. }
  5466. }, {
  5467. key: "parseBreak",
  5468. value: function parseBreak() {
  5469. this.pos++;
  5470. this.checkEOS();
  5471. this.pos++;
  5472. return new _commands___WEBPACK_IMPORTED_MODULE_2__["Break"]();
  5473. }
  5474. }, {
  5475. key: "parseReturn",
  5476. value: function parseReturn() {
  5477. this.pos++;
  5478. var exp = null;
  5479. if (!this.checkEOS(true)) {
  5480. exp = this.parseExpressionOR();
  5481. this.checkEOS();
  5482. }
  5483. this.pos++;
  5484. return new _commands___WEBPACK_IMPORTED_MODULE_2__["Return"](exp);
  5485. }
  5486. }, {
  5487. key: "parseIDCommand",
  5488. value: function parseIDCommand() {
  5489. var refToken = this.getToken();
  5490. var isID = refToken.type === this.lexerClass.ID;
  5491. var id = this.parseMaybeLibID();
  5492. if (this.checkOpenBrace(true)) {
  5493. this.pos++;
  5494. var lineExpression = null;
  5495. var columnExpression = null;
  5496. this.consumeNewLines();
  5497. lineExpression = this.parseExpression();
  5498. this.consumeNewLines();
  5499. this.checkCloseBrace();
  5500. this.pos++;
  5501. if (this.checkOpenBrace(true)) {
  5502. this.pos++;
  5503. this.consumeNewLines();
  5504. columnExpression = this.parseExpression();
  5505. this.consumeNewLines();
  5506. this.checkCloseBrace();
  5507. this.pos++;
  5508. }
  5509. var equalToken = this.getToken();
  5510. if (equalToken.type !== this.lexerClass.EQUAL) {
  5511. throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_8__["SyntaxErrorFactory"].token_missing_one('=', equalToken);
  5512. }
  5513. this.pos++;
  5514. var exp = this.parseExpressionOR();
  5515. this.checkEOS();
  5516. this.pos++;
  5517. var cmd = new _commands___WEBPACK_IMPORTED_MODULE_2__["ArrayIndexAssign"](id, lineExpression, columnExpression, exp);
  5518. cmd.sourceInfo = _sourceInfo__WEBPACK_IMPORTED_MODULE_6__["SourceInfo"].createSourceInfo(equalToken);
  5519. return cmd;
  5520. }
  5521. var equalOrParenthesis = this.getToken();
  5522. if (isID && equalOrParenthesis.type === this.lexerClass.EQUAL) {
  5523. this.pos++;
  5524. var _exp = this.parseExpressionOR();
  5525. this.checkEOS();
  5526. this.pos++;
  5527. var _cmd2 = new _commands___WEBPACK_IMPORTED_MODULE_2__["Assign"](id, _exp);
  5528. _cmd2.sourceInfo = _sourceInfo__WEBPACK_IMPORTED_MODULE_6__["SourceInfo"].createSourceInfo(equalOrParenthesis);
  5529. return _cmd2;
  5530. } else if (equalOrParenthesis.type === this.lexerClass.OPEN_PARENTHESIS) {
  5531. var funcCall = this.parseFunctionCallCommand(id);
  5532. this.checkEOS();
  5533. this.pos++;
  5534. return funcCall;
  5535. } else if (isID) {
  5536. throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_8__["SyntaxErrorFactory"].token_missing_list(['=', '('], equalOrParenthesis);
  5537. } else {
  5538. throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_8__["SyntaxErrorFactory"].invalid_id_format(refToken);
  5539. }
  5540. }
  5541. }, {
  5542. key: "parseForAssign",
  5543. value: function parseForAssign() {
  5544. var isLast = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  5545. if (!isLast) this.consumeNewLines();
  5546. if (this.checkEOS(true)) {
  5547. return null;
  5548. }
  5549. var id = this.parseID();
  5550. var equal = this.getToken();
  5551. if (equal.type !== this.lexerClass.EQUAL) {
  5552. throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_8__["SyntaxErrorFactory"].token_missing_one('=', equal);
  5553. }
  5554. this.pos++;
  5555. var exp = this.parseExpressionOR();
  5556. if (!isLast) {
  5557. this.consumeForSemiColon();
  5558. }
  5559. var sourceInfo = _sourceInfo__WEBPACK_IMPORTED_MODULE_6__["SourceInfo"].createSourceInfo(equal);
  5560. var cmd = new _commands___WEBPACK_IMPORTED_MODULE_2__["Assign"](id, exp);
  5561. cmd.sourceInfo = sourceInfo;
  5562. return cmd;
  5563. }
  5564. }, {
  5565. key: "parseCases",
  5566. value: function parseCases() {
  5567. var token = this.getToken();
  5568. if (token.type !== this.lexerClass.RK_CASE) {
  5569. throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_8__["SyntaxErrorFactory"].token_missing_one(this.lexer.literalNames[this.lexerClass.RK_CASE], token);
  5570. }
  5571. this.pos++;
  5572. var nextToken = this.getToken();
  5573. if (nextToken.type === this.lexerClass.RK_DEFAULT) {
  5574. this.pos++;
  5575. var colonToken = this.getToken();
  5576. if (colonToken.type !== this.lexerClass.COLON) {
  5577. throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_8__["SyntaxErrorFactory"].token_missing_one(':', colonToken);
  5578. }
  5579. this.pos++;
  5580. this.consumeNewLines();
  5581. var block = this.parseCommandBlock(true);
  5582. var defaultCase = new _commands___WEBPACK_IMPORTED_MODULE_2__["Case"](null);
  5583. defaultCase.setCommands(block.commands);
  5584. return [defaultCase];
  5585. } else {
  5586. var exp = this.parseExpressionOR();
  5587. var _colonToken = this.getToken();
  5588. if (_colonToken.type !== this.lexerClass.COLON) {
  5589. throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_8__["SyntaxErrorFactory"].token_missing_one(':', _colonToken);
  5590. }
  5591. this.pos++;
  5592. this.consumeNewLines();
  5593. var _block = this.parseCommandBlock(true);
  5594. var aCase = new _commands___WEBPACK_IMPORTED_MODULE_2__["Case"](exp);
  5595. aCase.setCommands(_block.commands);
  5596. var caseToken = this.getToken();
  5597. if (caseToken.type === this.lexerClass.RK_CASE) {
  5598. return [aCase].concat(this.parseCases());
  5599. } else {
  5600. return [aCase];
  5601. }
  5602. }
  5603. }
  5604. /*
  5605. * Parses an Expression following the structure:
  5606. *
  5607. * EOR => EAnd ( 'or' EOR)? #expression and
  5608. *
  5609. * EOR => ENot ('and' EOR)? #expression or
  5610. *
  5611. * ENot => 'not'? ER #expression not
  5612. *
  5613. * ER => E ((>=, <=, ==, >, <) E)? #expression relational
  5614. *
  5615. * E => factor ((+, -) E)? #expression
  5616. *
  5617. * factor=> term ((*, /, %) factor)?
  5618. *
  5619. * term => literal || arrayAccess || FuncCall || ID || '('EAnd')'
  5620. **/
  5621. }, {
  5622. key: "parseExpressionOR",
  5623. value: function parseExpressionOR() {
  5624. var exp1 = this.parseExpressionAND();
  5625. while (this.getToken().type === this.lexerClass.OR_OPERATOR) {
  5626. var opToken = this.getToken();
  5627. this.pos++;
  5628. var or = Object(_operators__WEBPACK_IMPORTED_MODULE_7__["convertFromString"])('or');
  5629. this.consumeNewLines();
  5630. var exp2 = this.parseExpressionAND();
  5631. var _finalExp = new _expressions___WEBPACK_IMPORTED_MODULE_1__["InfixApp"](or, exp1, exp2);
  5632. _finalExp.sourceInfo = _sourceInfo__WEBPACK_IMPORTED_MODULE_6__["SourceInfo"].createSourceInfo(opToken);
  5633. exp1 = _finalExp;
  5634. }
  5635. return exp1;
  5636. }
  5637. }, {
  5638. key: "parseExpressionAND",
  5639. value: function parseExpressionAND() {
  5640. var exp1 = this.parseExpressionNot();
  5641. while (this.getToken().type === this.lexerClass.AND_OPERATOR) {
  5642. var opToken = this.getToken();
  5643. this.pos++;
  5644. var and = Object(_operators__WEBPACK_IMPORTED_MODULE_7__["convertFromString"])('and');
  5645. this.consumeNewLines();
  5646. var exp2 = this.parseExpressionNot();
  5647. var _finalExp2 = new _expressions___WEBPACK_IMPORTED_MODULE_1__["InfixApp"](and, exp1, exp2);
  5648. _finalExp2.sourceInfo = _sourceInfo__WEBPACK_IMPORTED_MODULE_6__["SourceInfo"].createSourceInfo(opToken);
  5649. exp1 = _finalExp2;
  5650. }
  5651. return exp1;
  5652. }
  5653. }, {
  5654. key: "parseExpressionNot",
  5655. value: function parseExpressionNot() {
  5656. var maybeNotToken = this.getToken();
  5657. if (maybeNotToken.type === this.lexerClass.NOT_OPERATOR) {
  5658. var opToken = this.getToken();
  5659. this.pos++;
  5660. var not = Object(_operators__WEBPACK_IMPORTED_MODULE_7__["convertFromString"])('not');
  5661. var exp1 = this.parseExpressionRel();
  5662. finalExp = new _expressions___WEBPACK_IMPORTED_MODULE_1__["UnaryApp"](not, exp1);
  5663. finalExp.sourceInfo = _sourceInfo__WEBPACK_IMPORTED_MODULE_6__["SourceInfo"].createSourceInfo(opToken);
  5664. return finalExp;
  5665. } else {
  5666. return this.parseExpressionRel();
  5667. }
  5668. }
  5669. }, {
  5670. key: "parseExpressionRel",
  5671. value: function parseExpressionRel() {
  5672. var exp1 = this.parseExpression();
  5673. while (this.getToken().type === this.lexerClass.RELATIONAL_OPERATOR) {
  5674. var relToken = this.getToken();
  5675. this.pos++;
  5676. var rel = Object(_operators__WEBPACK_IMPORTED_MODULE_7__["convertFromString"])(relToken.text);
  5677. var exp2 = this.parseExpression();
  5678. var _finalExp3 = new _expressions___WEBPACK_IMPORTED_MODULE_1__["InfixApp"](rel, exp1, exp2);
  5679. _finalExp3.sourceInfo = _sourceInfo__WEBPACK_IMPORTED_MODULE_6__["SourceInfo"].createSourceInfo(relToken);
  5680. exp1 = _finalExp3;
  5681. }
  5682. return exp1;
  5683. }
  5684. }, {
  5685. key: "parseExpression",
  5686. value: function parseExpression() {
  5687. var factor = this.parseFactor();
  5688. while (this.getToken().type === this.lexerClass.SUM_OP) {
  5689. var sumOpToken = this.getToken();
  5690. this.pos++;
  5691. var op = Object(_operators__WEBPACK_IMPORTED_MODULE_7__["convertFromString"])(sumOpToken.text);
  5692. var factor2 = this.parseFactor();
  5693. var _finalExp4 = new _expressions___WEBPACK_IMPORTED_MODULE_1__["InfixApp"](op, factor, factor2);
  5694. _finalExp4.sourceInfo = _sourceInfo__WEBPACK_IMPORTED_MODULE_6__["SourceInfo"].createSourceInfo(sumOpToken);
  5695. factor = _finalExp4;
  5696. }
  5697. return factor;
  5698. }
  5699. }, {
  5700. key: "parseFactor",
  5701. value: function parseFactor() {
  5702. var term = this.parseTerm();
  5703. while (this.getToken().type === this.lexerClass.MULTI_OP) {
  5704. var multOpToken = this.getToken();
  5705. this.pos++;
  5706. var op = Object(_operators__WEBPACK_IMPORTED_MODULE_7__["convertFromString"])(multOpToken.text);
  5707. var term2 = this.parseTerm();
  5708. var _finalExp5 = new _expressions___WEBPACK_IMPORTED_MODULE_1__["InfixApp"](op, term, term2);
  5709. _finalExp5.sourceInfo = _sourceInfo__WEBPACK_IMPORTED_MODULE_6__["SourceInfo"].createSourceInfo(multOpToken);
  5710. term = _finalExp5;
  5711. }
  5712. return term;
  5713. }
  5714. }, {
  5715. key: "parseTerm",
  5716. value: function parseTerm() {
  5717. var token = this.getToken();
  5718. var sourceInfo = null;
  5719. switch (token.type) {
  5720. case this.lexerClass.SUM_OP:
  5721. this.pos++;
  5722. sourceInfo = _sourceInfo__WEBPACK_IMPORTED_MODULE_6__["SourceInfo"].createSourceInfo(token);
  5723. var exp = new _expressions___WEBPACK_IMPORTED_MODULE_1__["UnaryApp"](Object(_operators__WEBPACK_IMPORTED_MODULE_7__["convertFromString"])(token.text), this.parseTerm());
  5724. exp.sourceInfo = sourceInfo;
  5725. return exp;
  5726. case this.lexerClass.INTEGER:
  5727. this.pos++;
  5728. return this.getIntLiteral(token);
  5729. case this.lexerClass.REAL:
  5730. this.pos++;
  5731. return this.getRealLiteral(token);
  5732. case this.lexerClass.STRING:
  5733. this.pos++;
  5734. return this.getStringLiteral(token);
  5735. case this.lexerClass.RK_TRUE:
  5736. case this.lexerClass.RK_FALSE:
  5737. this.pos++;
  5738. return this.getBoolLiteral(token);
  5739. case this.lexerClass.OPEN_CURLY:
  5740. return this.parseArrayLiteral();
  5741. case this.lexerClass.ID:
  5742. case this.lexerClass.LIB_ID:
  5743. return this.parseIDTerm();
  5744. case this.lexerClass.OPEN_PARENTHESIS:
  5745. return this.parseParenthesisExp();
  5746. default:
  5747. throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_8__["SyntaxErrorFactory"].invalid_terminal(token);
  5748. }
  5749. }
  5750. }, {
  5751. key: "parseIDTerm",
  5752. value: function parseIDTerm() {
  5753. var tokenA = this.getToken();
  5754. var id = this.parseMaybeLibID();
  5755. var isID = tokenA.type === this.lexerClass.ID;
  5756. if (isID && this.checkOpenBrace(true)) {
  5757. var tokenB = null;
  5758. this.pos++;
  5759. var firstIndex = this.parseExpression();
  5760. var secondIndex = null;
  5761. this.consumeNewLines();
  5762. this.checkCloseBrace();
  5763. tokenB = this.getToken();
  5764. this.pos++;
  5765. if (this.checkOpenBrace(true)) {
  5766. this.pos++;
  5767. secondIndex = this.parseExpression();
  5768. this.consumeNewLines();
  5769. this.checkCloseBrace();
  5770. tokenB = this.getToken();
  5771. this.pos++;
  5772. }
  5773. var sourceInfo = _sourceInfo__WEBPACK_IMPORTED_MODULE_6__["SourceInfo"].createSourceInfoFromList(tokenA, tokenB);
  5774. var exp = new _expressions___WEBPACK_IMPORTED_MODULE_1__["ArrayAccess"](id, firstIndex, secondIndex);
  5775. exp.sourceInfo = sourceInfo;
  5776. return exp;
  5777. } else if (this.checkOpenParenthesis(true)) {
  5778. return this.parseFunctionCallExpression(id);
  5779. } else if (isID) {
  5780. var _sourceInfo = _sourceInfo__WEBPACK_IMPORTED_MODULE_6__["SourceInfo"].createSourceInfo(tokenA);
  5781. var _exp2 = new _expressions___WEBPACK_IMPORTED_MODULE_1__["VariableLiteral"](id);
  5782. _exp2.sourceInfo = _sourceInfo;
  5783. return _exp2;
  5784. } else {
  5785. throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_8__["SyntaxErrorFactory"].invalid_id_format(tokenA);
  5786. }
  5787. }
  5788. }, {
  5789. key: "getFunctionName",
  5790. value: function getFunctionName(id) {
  5791. var name = _processor_definedFunctions__WEBPACK_IMPORTED_MODULE_9__["LanguageDefinedFunction"].getInternalName(id);
  5792. if (name === null) {
  5793. if (id === _processor_definedFunctions__WEBPACK_IMPORTED_MODULE_9__["LanguageDefinedFunction"].getMainFunctionName()) {
  5794. return null;
  5795. }
  5796. return id;
  5797. } else {
  5798. return name;
  5799. }
  5800. }
  5801. }, {
  5802. key: "parseFunctionCallExpression",
  5803. value: function parseFunctionCallExpression(id) {
  5804. var tokenA = this.getToken(this.pos - 1);
  5805. var actualParameters = this.parseActualParameters();
  5806. var tokenB = this.getToken(this.pos - 1);
  5807. var funcName = this.getFunctionName(id);
  5808. var sourceInfo = _sourceInfo__WEBPACK_IMPORTED_MODULE_6__["SourceInfo"].createSourceInfoFromList(tokenA, tokenB);
  5809. var cmd = new _expressions___WEBPACK_IMPORTED_MODULE_1__["FunctionCall"](funcName, actualParameters);
  5810. cmd.sourceInfo = sourceInfo;
  5811. return cmd;
  5812. }
  5813. }, {
  5814. key: "parseFunctionCallCommand",
  5815. value: function parseFunctionCallCommand(id) {
  5816. return this.parseFunctionCallExpression(id);
  5817. }
  5818. }, {
  5819. key: "parseParenthesisExp",
  5820. value: function parseParenthesisExp() {
  5821. this.checkOpenParenthesis();
  5822. var tokenA = this.getToken();
  5823. this.pos++;
  5824. this.consumeNewLines();
  5825. var exp = this.parseExpressionOR();
  5826. this.consumeNewLines();
  5827. this.checkCloseParenthesis();
  5828. var tokenB = this.getToken();
  5829. var sourceInfo = _sourceInfo__WEBPACK_IMPORTED_MODULE_6__["SourceInfo"].createSourceInfoFromList(tokenA, tokenB);
  5830. this.pos++;
  5831. exp.sourceInfo = sourceInfo;
  5832. return exp;
  5833. }
  5834. }, {
  5835. key: "parseActualParameters",
  5836. value: function parseActualParameters() {
  5837. this.checkOpenParenthesis();
  5838. this.pos++;
  5839. if (this.checkCloseParenthesis(true)) {
  5840. this.pos++;
  5841. return [];
  5842. }
  5843. this.consumeNewLines();
  5844. var list = this.parseExpressionList();
  5845. this.consumeNewLines();
  5846. this.checkCloseParenthesis();
  5847. this.pos++;
  5848. return list;
  5849. }
  5850. }, {
  5851. key: "parseExpressionList",
  5852. value: function parseExpressionList() {
  5853. var list = [];
  5854. while (true) {
  5855. var exp = this.parseExpressionOR();
  5856. list.push(exp);
  5857. var maybeToken = this.getToken();
  5858. if (maybeToken.type !== this.lexerClass.COMMA) {
  5859. break;
  5860. } else {
  5861. this.pos++;
  5862. this.consumeNewLines();
  5863. }
  5864. }
  5865. return list;
  5866. }
  5867. }, {
  5868. key: "getTypeArray",
  5869. value: function getTypeArray() {
  5870. var _this = this;
  5871. var types = this.insideScope(IVProgParser.FUNCTION) ? this.functionTypes : this.variableTypes;
  5872. return types.map(function (x) {
  5873. return _this.lexer.literalNames[x];
  5874. });
  5875. }
  5876. }]);
  5877. return IVProgParser;
  5878. }();
  5879. /***/ }),
  5880. /***/ "./js/ast/operators.js":
  5881. /*!*****************************!*\
  5882. !*** ./js/ast/operators.js ***!
  5883. \*****************************/
  5884. /*! exports provided: Operators, convertFromString */
  5885. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  5886. "use strict";
  5887. __webpack_require__.r(__webpack_exports__);
  5888. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Operators", function() { return Operators; });
  5889. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "convertFromString", function() { return convertFromString; });
  5890. var Operators = Object.freeze({
  5891. ADD: {
  5892. ord: 0,
  5893. value: "+"
  5894. },
  5895. SUB: {
  5896. ord: 1,
  5897. value: "-"
  5898. },
  5899. MULT: {
  5900. ord: 2,
  5901. value: '*'
  5902. },
  5903. DIV: {
  5904. ord: 3,
  5905. value: '/'
  5906. },
  5907. MOD: {
  5908. ord: 4,
  5909. value: '%'
  5910. },
  5911. GT: {
  5912. ord: 5,
  5913. value: '>'
  5914. },
  5915. GE: {
  5916. ord: 6,
  5917. value: '>='
  5918. },
  5919. LT: {
  5920. ord: 7,
  5921. value: '<'
  5922. },
  5923. LE: {
  5924. ord: 8,
  5925. value: '<='
  5926. },
  5927. EQ: {
  5928. ord: 9,
  5929. value: '=='
  5930. },
  5931. NEQ: {
  5932. ord: 10,
  5933. value: '!='
  5934. },
  5935. AND: {
  5936. ord: 11,
  5937. value: 'and'
  5938. },
  5939. OR: {
  5940. ord: 12,
  5941. value: 'or'
  5942. },
  5943. NOT: {
  5944. ord: 13,
  5945. value: 'not'
  5946. }
  5947. });
  5948. function convertFromString(op) {
  5949. switch (op) {
  5950. case '+':
  5951. return Operators.ADD;
  5952. case '-':
  5953. return Operators.SUB;
  5954. case '*':
  5955. return Operators.MULT;
  5956. case '/':
  5957. return Operators.DIV;
  5958. case '%':
  5959. return Operators.MOD;
  5960. case '>':
  5961. return Operators.GT;
  5962. case '>=':
  5963. return Operators.GE;
  5964. case '<':
  5965. return Operators.LT;
  5966. case '<=':
  5967. return Operators.LE;
  5968. case '==':
  5969. return Operators.EQ;
  5970. case '!=':
  5971. return Operators.NEQ;
  5972. case 'and':
  5973. return Operators.AND;
  5974. case 'or':
  5975. return Operators.OR;
  5976. case 'not':
  5977. return Operators.NOT;
  5978. }
  5979. }
  5980. /***/ }),
  5981. /***/ "./js/ast/sourceInfo.js":
  5982. /*!******************************!*\
  5983. !*** ./js/ast/sourceInfo.js ***!
  5984. \******************************/
  5985. /*! exports provided: SourceInfo */
  5986. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  5987. "use strict";
  5988. __webpack_require__.r(__webpack_exports__);
  5989. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SourceInfo", function() { return SourceInfo; });
  5990. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  5991. 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); } }
  5992. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  5993. var SourceInfo =
  5994. /*#__PURE__*/
  5995. function () {
  5996. _createClass(SourceInfo, null, [{
  5997. key: "createSourceInfo",
  5998. value: function createSourceInfo(token) {
  5999. return new SourceInfo(token.line, token.column, token.text.length);
  6000. }
  6001. }, {
  6002. key: "createSourceInfoFromList",
  6003. value: function createSourceInfoFromList(tokenA, tokenB) {
  6004. var line = tokenA.line;
  6005. var column = tokenA.column; // copied from https://github.com/UNIVALI-LITE/Portugol-Studio/blob/master/core/src/main/java/br/univali/portugol/nucleo/analise/sintatica/Portugol.g
  6006. // No idea why...
  6007. var size = tokenB.tokenIndex + 1 - tokenA.tokenIndex;
  6008. return new SourceInfo(line, column, size);
  6009. }
  6010. }]);
  6011. function SourceInfo(line, column, size) {
  6012. _classCallCheck(this, SourceInfo);
  6013. this.line = line;
  6014. this.column = column;
  6015. this.size = size;
  6016. }
  6017. return SourceInfo;
  6018. }();
  6019. /***/ }),
  6020. /***/ "./js/io/domConsole.js":
  6021. /*!*****************************!*\
  6022. !*** ./js/io/domConsole.js ***!
  6023. \*****************************/
  6024. /*! exports provided: DOMConsole */
  6025. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  6026. "use strict";
  6027. __webpack_require__.r(__webpack_exports__);
  6028. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DOMConsole", function() { return DOMConsole; });
  6029. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  6030. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_0__);
  6031. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  6032. 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); } }
  6033. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  6034. var DOMConsole =
  6035. /*#__PURE__*/
  6036. function () {
  6037. _createClass(DOMConsole, null, [{
  6038. key: "USER",
  6039. get: function get() {
  6040. return 0;
  6041. }
  6042. }, {
  6043. key: "INFO",
  6044. get: function get() {
  6045. return 1;
  6046. }
  6047. }, {
  6048. key: "ERR",
  6049. get: function get() {
  6050. return 2;
  6051. }
  6052. }]);
  6053. function DOMConsole(elementID) {
  6054. _classCallCheck(this, DOMConsole);
  6055. this.input = null;
  6056. this.needInput = false;
  6057. this.termDiv = null;
  6058. this.anyKey = false;
  6059. this.parent = jquery__WEBPACK_IMPORTED_MODULE_0___default()(elementID);
  6060. this.setup();
  6061. this.inputListeners = [];
  6062. }
  6063. _createClass(DOMConsole, [{
  6064. key: "setup",
  6065. value: function setup() {
  6066. this._setupDom();
  6067. this._setupEvents();
  6068. }
  6069. }, {
  6070. key: "_setupEvents",
  6071. value: function _setupEvents() {
  6072. var _this = this;
  6073. this.input.on("keydown", function (event) {
  6074. if (!_this.needInput) {
  6075. event.preventDefault();
  6076. return;
  6077. }
  6078. var keyCode = event.which;
  6079. if (keyCode === 13 || _this.anyKey) {
  6080. var text = _this.input.val();
  6081. text = text.replace('[\n\r]+', '');
  6082. _this.notifyListeners(text);
  6083. _this.write(text);
  6084. _this.input.val("");
  6085. }
  6086. });
  6087. }
  6088. }, {
  6089. key: "_setupDom",
  6090. value: function _setupDom() {
  6091. this.termDiv = jquery__WEBPACK_IMPORTED_MODULE_0___default()("<div></div>");
  6092. this.termDiv.addClass("ivprog-term-div");
  6093. this.input = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<input text="type">');
  6094. this.input.addClass("ivprog-term-input");
  6095. this.termDiv.append(this.input);
  6096. this.parent.append(this.termDiv);
  6097. }
  6098. }, {
  6099. key: "notifyListeners",
  6100. value: function notifyListeners(text) {
  6101. this.inputListeners.forEach(function (resolve) {
  6102. return resolve(text);
  6103. });
  6104. this.inputListeners.splice(0, this.inputListeners.length);
  6105. this.hideInput();
  6106. this.anyKey = false;
  6107. }
  6108. }, {
  6109. key: "write",
  6110. value: function write(text) {
  6111. this._appendText(text, DOMConsole.USER);
  6112. }
  6113. }, {
  6114. key: "info",
  6115. value: function info(text) {
  6116. this._appendText(text, DOMConsole.INFO);
  6117. }
  6118. }, {
  6119. key: "err",
  6120. value: function err(text) {
  6121. this._appendText(text, DOMConsole.ERR);
  6122. }
  6123. }, {
  6124. key: "_appendText",
  6125. value: function _appendText(text, type) {
  6126. var divClass = this.getClassForType(type);
  6127. var textDiv = jquery__WEBPACK_IMPORTED_MODULE_0___default()("<div></div>");
  6128. textDiv.addClass(divClass);
  6129. textDiv.append(text);
  6130. textDiv.insertBefore(this.input);
  6131. this.scrollTerm();
  6132. }
  6133. }, {
  6134. key: "scrollTerm",
  6135. value: function scrollTerm() {
  6136. this.termDiv.animate({
  6137. scrollTop: this.termDiv.prop('scrollHeight')
  6138. }, 0);
  6139. }
  6140. }, {
  6141. key: "getClassForType",
  6142. value: function getClassForType(type) {
  6143. switch (type) {
  6144. case DOMConsole.USER:
  6145. return "ivprog-term-userText";
  6146. case DOMConsole.INFO:
  6147. return "ivprog-term-info";
  6148. case DOMConsole.ERR:
  6149. return "ivprog-term-error";
  6150. }
  6151. }
  6152. }, {
  6153. key: "dispose",
  6154. value: function dispose() {
  6155. this.parent.off();
  6156. this.input.off();
  6157. this.input = null;
  6158. this.parent.empty();
  6159. }
  6160. }, {
  6161. key: "showInput",
  6162. value: function showInput() {
  6163. this.needInput = true;
  6164. this.input.show();
  6165. this.input.focus();
  6166. }
  6167. }, {
  6168. key: "hideInput",
  6169. value: function hideInput() {
  6170. this.needInput = false;
  6171. this.input.hide();
  6172. }
  6173. }, {
  6174. key: "requestInput",
  6175. value: function requestInput(callback) {
  6176. var anyKey = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  6177. this.inputListeners.push(callback);
  6178. this.anyKey = anyKey;
  6179. this.showInput();
  6180. }
  6181. }, {
  6182. key: "sendOutput",
  6183. value: function sendOutput(text) {
  6184. var _this2 = this;
  6185. var output = "" + text;
  6186. output.split("\n").forEach(function (t) {
  6187. t = t.replace(/\t/g, '&#9;');
  6188. _this2.write(t);
  6189. });
  6190. }
  6191. }, {
  6192. key: "clear",
  6193. value: function clear() {
  6194. this.input.parent().children().not(this.input).remove();
  6195. this.input.val("");
  6196. }
  6197. }]);
  6198. return DOMConsole;
  6199. }();
  6200. /***/ }),
  6201. /***/ "./js/io/input.js":
  6202. /*!************************!*\
  6203. !*** ./js/io/input.js ***!
  6204. \************************/
  6205. /*! exports provided: Input */
  6206. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  6207. "use strict";
  6208. __webpack_require__.r(__webpack_exports__);
  6209. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Input", function() { return Input; });
  6210. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  6211. 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); } }
  6212. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  6213. var Input =
  6214. /*#__PURE__*/
  6215. function () {
  6216. function Input() {
  6217. _classCallCheck(this, Input);
  6218. }
  6219. _createClass(Input, [{
  6220. key: "requestInput",
  6221. value: function requestInput(callback) {
  6222. throw new Error("Must be implemented");
  6223. }
  6224. }]);
  6225. return Input;
  6226. }();
  6227. /***/ }),
  6228. /***/ "./js/io/output.js":
  6229. /*!*************************!*\
  6230. !*** ./js/io/output.js ***!
  6231. \*************************/
  6232. /*! exports provided: Output */
  6233. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  6234. "use strict";
  6235. __webpack_require__.r(__webpack_exports__);
  6236. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Output", function() { return Output; });
  6237. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  6238. 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); } }
  6239. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  6240. var Output =
  6241. /*#__PURE__*/
  6242. function () {
  6243. function Output() {
  6244. _classCallCheck(this, Output);
  6245. }
  6246. _createClass(Output, [{
  6247. key: "sendOutput",
  6248. value: function sendOutput(text) {
  6249. throw new Error("Must be implemented");
  6250. }
  6251. }]);
  6252. return Output;
  6253. }();
  6254. /***/ }),
  6255. /***/ "./js/main.js":
  6256. /*!********************!*\
  6257. !*** ./js/main.js ***!
  6258. \********************/
  6259. /*! exports provided: runner, initVisualUI, addFunctionChangeListener, addGlobalChangeListener, removeFunctionListener, removeGlobalListener, LocalizedStrings, i18n */
  6260. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  6261. "use strict";
  6262. __webpack_require__.r(__webpack_exports__);
  6263. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "LocalizedStrings", function() { return LocalizedStrings; });
  6264. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "i18n", function() { return i18n; });
  6265. /* harmony import */ var _runner__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./runner */ "./js/runner.js");
  6266. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "runner", function() { return _runner__WEBPACK_IMPORTED_MODULE_0__["runner"]; });
  6267. /* harmony import */ var _visualUI_functions__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./visualUI/functions */ "./js/visualUI/functions.js");
  6268. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "initVisualUI", function() { return _visualUI_functions__WEBPACK_IMPORTED_MODULE_1__["initVisualUI"]; });
  6269. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "addFunctionChangeListener", function() { return _visualUI_functions__WEBPACK_IMPORTED_MODULE_1__["addFunctionChangeListener"]; });
  6270. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "addGlobalChangeListener", function() { return _visualUI_functions__WEBPACK_IMPORTED_MODULE_1__["addGlobalChangeListener"]; });
  6271. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "removeFunctionListener", function() { return _visualUI_functions__WEBPACK_IMPORTED_MODULE_1__["removeFunctionListener"]; });
  6272. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "removeGlobalListener", function() { return _visualUI_functions__WEBPACK_IMPORTED_MODULE_1__["removeGlobalListener"]; });
  6273. /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./services/localizedStringsService */ "./js/services/localizedStringsService.js");
  6274. /* harmony import */ var _services_i18nHelper__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./services/i18nHelper */ "./js/services/i18nHelper.js");
  6275. var i18n = _services_i18nHelper__WEBPACK_IMPORTED_MODULE_3__["i18nHelper"].i18n;
  6276. var LocalizedStrings = _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__["getInstance"]();
  6277. /***/ }),
  6278. /***/ "./js/processor/compatibilityTable.js":
  6279. /*!********************************************!*\
  6280. !*** ./js/processor/compatibilityTable.js ***!
  6281. \********************************************/
  6282. /*! exports provided: resultTypeAfterInfixOp, resultTypeAfterUnaryOp */
  6283. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  6284. "use strict";
  6285. __webpack_require__.r(__webpack_exports__);
  6286. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "resultTypeAfterInfixOp", function() { return resultTypeAfterInfixOp; });
  6287. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "resultTypeAfterUnaryOp", function() { return resultTypeAfterUnaryOp; });
  6288. /* harmony import */ var _typeSystem_types__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./../typeSystem/types */ "./js/typeSystem/types.js");
  6289. /* harmony import */ var _ast_operators__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./../ast/operators */ "./js/ast/operators.js");
  6290. /* harmony import */ var _typeSystem_multiType__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../typeSystem/multiType */ "./js/typeSystem/multiType.js");
  6291. /* harmony import */ var _util_config__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../util/config */ "./js/util/config.js");
  6292. function buildInfixAddTable() {
  6293. var table = [[], [], [], []];
  6294. table[_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].INTEGER.ord][_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].INTEGER.ord] = _typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].INTEGER;
  6295. table[_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].INTEGER.ord][_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].REAL.ord] = _typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].REAL;
  6296. table[_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].INTEGER.ord][_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].STRING.ord] = _typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].STRING;
  6297. table[_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].REAL.ord][_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].INTEGER.ord] = _typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].REAL;
  6298. table[_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].REAL.ord][_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].REAL.ord] = _typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].REAL;
  6299. table[_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].REAL.ord][_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].STRING.ord] = _typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].STRING;
  6300. table[_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].STRING.ord][_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].INTEGER.ord] = _typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].STRING;
  6301. table[_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].STRING.ord][_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].REAL.ord] = _typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].STRING;
  6302. table[_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].STRING.ord][_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].STRING.ord] = _typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].STRING;
  6303. table[_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].STRING.ord][_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].BOOLEAN.ord] = _typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].STRING;
  6304. return table;
  6305. }
  6306. function buildInfixMultiDivSubTable() {
  6307. var table = [[], [], [], []];
  6308. table[_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].INTEGER.ord][_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].INTEGER.ord] = _typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].INTEGER;
  6309. table[_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].INTEGER.ord][_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].REAL.ord] = _typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].REAL;
  6310. table[_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].REAL.ord][_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].INTEGER.ord] = _typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].REAL;
  6311. table[_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].REAL.ord][_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].REAL.ord] = _typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].REAL;
  6312. return table;
  6313. }
  6314. function buildInfixEqualityInequalityTable() {
  6315. var table = [[], [], [], []];
  6316. table[_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].INTEGER.ord][_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].INTEGER.ord] = _typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].BOOLEAN;
  6317. table[_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].REAL.ord][_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].REAL.ord] = _typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].BOOLEAN;
  6318. table[_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].BOOLEAN.ord][_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].BOOLEAN.ord] = _typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].BOOLEAN;
  6319. table[_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].STRING.ord][_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].STRING.ord] = _typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].BOOLEAN;
  6320. return table;
  6321. }
  6322. function buildInfixRelationalTable() {
  6323. var table = [[], [], [], []];
  6324. table[_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].INTEGER.ord][_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].INTEGER.ord] = _typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].BOOLEAN;
  6325. table[_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].REAL.ord][_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].REAL.ord] = _typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].BOOLEAN;
  6326. table[_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].STRING.ord][_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].STRING.ord] = _typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].BOOLEAN;
  6327. return table;
  6328. }
  6329. function buildInfixAndOrTable() {
  6330. var table = [[], [], [], []];
  6331. table[_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].BOOLEAN.ord][_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].BOOLEAN.ord] = _typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].BOOLEAN;
  6332. return table;
  6333. }
  6334. function buildInfixModTable() {
  6335. var table = [[], [], [], []];
  6336. table[_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].INTEGER.ord][_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].INTEGER.ord] = _typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].INTEGER;
  6337. return table;
  6338. }
  6339. function buildUnarySumSubList() {
  6340. var list = [];
  6341. list[_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].INTEGER.ord] = _typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].INTEGER;
  6342. list[_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].REAL.ord] = _typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].REAL;
  6343. return list;
  6344. }
  6345. function buildUnaryNegList() {
  6346. var list = [];
  6347. list[_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].BOOLEAN.ord] = _typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].BOOLEAN;
  6348. return list;
  6349. }
  6350. function buildInfixCompatibilityTable() {
  6351. var compatibilityMap = new WeakMap();
  6352. compatibilityMap.set(_ast_operators__WEBPACK_IMPORTED_MODULE_1__["Operators"].ADD, buildInfixAddTable());
  6353. compatibilityMap.set(_ast_operators__WEBPACK_IMPORTED_MODULE_1__["Operators"].SUB, buildInfixMultiDivSubTable());
  6354. compatibilityMap.set(_ast_operators__WEBPACK_IMPORTED_MODULE_1__["Operators"].MULT, buildInfixMultiDivSubTable());
  6355. compatibilityMap.set(_ast_operators__WEBPACK_IMPORTED_MODULE_1__["Operators"].DIV, buildInfixMultiDivSubTable());
  6356. compatibilityMap.set(_ast_operators__WEBPACK_IMPORTED_MODULE_1__["Operators"].EQ, buildInfixEqualityInequalityTable());
  6357. compatibilityMap.set(_ast_operators__WEBPACK_IMPORTED_MODULE_1__["Operators"].NEQ, buildInfixEqualityInequalityTable());
  6358. compatibilityMap.set(_ast_operators__WEBPACK_IMPORTED_MODULE_1__["Operators"].GE, buildInfixRelationalTable());
  6359. compatibilityMap.set(_ast_operators__WEBPACK_IMPORTED_MODULE_1__["Operators"].GT, buildInfixRelationalTable());
  6360. compatibilityMap.set(_ast_operators__WEBPACK_IMPORTED_MODULE_1__["Operators"].LE, buildInfixRelationalTable());
  6361. compatibilityMap.set(_ast_operators__WEBPACK_IMPORTED_MODULE_1__["Operators"].LT, buildInfixRelationalTable());
  6362. compatibilityMap.set(_ast_operators__WEBPACK_IMPORTED_MODULE_1__["Operators"].OR, buildInfixAndOrTable());
  6363. compatibilityMap.set(_ast_operators__WEBPACK_IMPORTED_MODULE_1__["Operators"].AND, buildInfixAndOrTable());
  6364. compatibilityMap.set(_ast_operators__WEBPACK_IMPORTED_MODULE_1__["Operators"].MOD, buildInfixModTable());
  6365. return compatibilityMap;
  6366. }
  6367. function buildUnaryCompatibilityTable() {
  6368. var compatibilityMap = new WeakMap();
  6369. compatibilityMap.set(_ast_operators__WEBPACK_IMPORTED_MODULE_1__["Operators"].ADD, buildUnarySumSubList());
  6370. compatibilityMap.set(_ast_operators__WEBPACK_IMPORTED_MODULE_1__["Operators"].SUB, buildUnarySumSubList());
  6371. compatibilityMap.set(_ast_operators__WEBPACK_IMPORTED_MODULE_1__["Operators"].NOT, buildUnaryNegList());
  6372. return compatibilityMap;
  6373. }
  6374. var infixMap = buildInfixCompatibilityTable();
  6375. var unaryMap = buildUnaryCompatibilityTable();
  6376. function resultTypeAfterInfixOp(operator, leftExpressionType, rightExpressionType) {
  6377. try {
  6378. if (leftExpressionType instanceof _typeSystem_multiType__WEBPACK_IMPORTED_MODULE_2__["MultiType"] && rightExpressionType instanceof _typeSystem_multiType__WEBPACK_IMPORTED_MODULE_2__["MultiType"]) {
  6379. var newMulti = [];
  6380. for (var i = 0; i < leftExpressionType.types.length; ++i) {
  6381. var typeA = leftExpressionType.types[i];
  6382. for (var j = 0; j < rightExpressionType.types.length; ++i) {
  6383. var typeB = rightExpressionType.types[j];
  6384. newMulti.push(resultTypeAfterInfixOp(operator, typeA, typeB));
  6385. }
  6386. }
  6387. newMulti = newMulti.filter(function (x) {
  6388. return !x.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].UNDEFINED);
  6389. });
  6390. if (newMulti.length <= 0) {
  6391. if (_util_config__WEBPACK_IMPORTED_MODULE_3__["Config"].enable_type_casting) {
  6392. if (leftExpressionType.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].INTEGER) || leftExpressionType.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].REAL)) {
  6393. if (rightExpressionType.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].INTEGER) || rightExpressionType.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].REAL)) {
  6394. return new _typeSystem_multiType__WEBPACK_IMPORTED_MODULE_2__["MultiType"]([_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].INTEGER, _typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].REAL]);
  6395. }
  6396. }
  6397. }
  6398. return _typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].UNDEFINED;
  6399. } else {
  6400. return new _typeSystem_multiType__WEBPACK_IMPORTED_MODULE_2__["MultiType"](newMulti);
  6401. }
  6402. } else if (leftExpressionType instanceof _typeSystem_multiType__WEBPACK_IMPORTED_MODULE_2__["MultiType"]) {
  6403. if (leftExpressionType.isCompatible(rightExpressionType)) {
  6404. return resultTypeAfterInfixOp(operator, rightExpressionType, rightExpressionType);
  6405. } else {
  6406. if (_util_config__WEBPACK_IMPORTED_MODULE_3__["Config"].enable_type_casting) {
  6407. if (leftExpressionType.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].INTEGER) || leftExpressionType.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].REAL)) {
  6408. if (rightExpressionType.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].INTEGER) || rightExpressionType.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].REAL)) {
  6409. return rightExpressionType;
  6410. }
  6411. }
  6412. }
  6413. return _typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].UNDEFINED;
  6414. }
  6415. } else if (rightExpressionType instanceof _typeSystem_multiType__WEBPACK_IMPORTED_MODULE_2__["MultiType"]) {
  6416. if (rightExpressionType.isCompatible(leftExpressionType)) {
  6417. return resultTypeAfterInfixOp(operator, leftExpressionType, leftExpressionType);
  6418. } else {
  6419. if (_util_config__WEBPACK_IMPORTED_MODULE_3__["Config"].enable_type_casting) {
  6420. if (leftExpressionType.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].INTEGER) || leftExpressionType.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].REAL)) {
  6421. if (rightExpressionType.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].INTEGER) || rightExpressionType.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].REAL)) {
  6422. return leftExpressionType;
  6423. }
  6424. }
  6425. }
  6426. return _typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].UNDEFINED;
  6427. }
  6428. }
  6429. var resultType = infixMap.get(operator)[leftExpressionType.ord][rightExpressionType.ord];
  6430. if (resultType === null || resultType === undefined) {
  6431. if (_util_config__WEBPACK_IMPORTED_MODULE_3__["Config"].enable_type_casting) {
  6432. if (leftExpressionType.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].INTEGER) || leftExpressionType.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].REAL)) {
  6433. if (rightExpressionType.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].INTEGER) || rightExpressionType.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].REAL)) {
  6434. if (operator === _ast_operators__WEBPACK_IMPORTED_MODULE_1__["Operators"].MOD) {
  6435. return _typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].INTEGER;
  6436. } else if (operator.ord >= 5 && operator.ord <= 10) {
  6437. return _typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].BOOLEAN;
  6438. }
  6439. }
  6440. }
  6441. }
  6442. return _typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].UNDEFINED;
  6443. }
  6444. return resultType;
  6445. } catch (e) {
  6446. if (e instanceof TypeError) {
  6447. return _typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].UNDEFINED;
  6448. } else {
  6449. throw e;
  6450. }
  6451. }
  6452. }
  6453. function resultTypeAfterUnaryOp(operator, leftExpressionType) {
  6454. try {
  6455. if (leftExpressionType instanceof _typeSystem_multiType__WEBPACK_IMPORTED_MODULE_2__["MultiType"]) {
  6456. return leftExpressionType;
  6457. }
  6458. return unaryMap.get(operator)[leftExpressionType.ord];
  6459. } catch (e) {
  6460. if (e instanceof TypeError) {
  6461. return _typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].UNDEFINED;
  6462. } else {
  6463. throw e;
  6464. }
  6465. }
  6466. }
  6467. /***/ }),
  6468. /***/ "./js/processor/context.js":
  6469. /*!*********************************!*\
  6470. !*** ./js/processor/context.js ***!
  6471. \*********************************/
  6472. /*! exports provided: Context */
  6473. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  6474. "use strict";
  6475. __webpack_require__.r(__webpack_exports__);
  6476. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Context", function() { return Context; });
  6477. var Context = Object.freeze({
  6478. BASE: Symbol('context:base'),
  6479. BREAKABLE: Symbol('context:breakable'),
  6480. FUNCTION: Symbol('context:function')
  6481. });
  6482. /***/ }),
  6483. /***/ "./js/processor/definedFunctions.js":
  6484. /*!******************************************!*\
  6485. !*** ./js/processor/definedFunctions.js ***!
  6486. \******************************************/
  6487. /*! exports provided: LanguageDefinedFunction */
  6488. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  6489. "use strict";
  6490. __webpack_require__.r(__webpack_exports__);
  6491. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "LanguageDefinedFunction", function() { return LanguageDefinedFunction; });
  6492. /* harmony import */ var _services_languageService__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../services/languageService */ "./js/services/languageService.js");
  6493. /* harmony import */ var _lib_io__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./lib/io */ "./js/processor/lib/io.js");
  6494. /* harmony import */ var _lib_strings__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./lib/strings */ "./js/processor/lib/strings.js");
  6495. /* harmony import */ var _lib_arrays__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./lib/arrays */ "./js/processor/lib/arrays.js");
  6496. /* harmony import */ var _lib_lang__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./lib/lang */ "./js/processor/lib/lang.js");
  6497. /* harmony import */ var _lib_math__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./lib/math */ "./js/processor/lib/math.js");
  6498. function valueToKey(value, object) {
  6499. for (var key in object) {
  6500. if (object.hasOwnProperty(key)) {
  6501. if (object[key] === value) {
  6502. return key;
  6503. }
  6504. }
  6505. }
  6506. return null;
  6507. }
  6508. function concatObjects() {
  6509. var result = {};
  6510. for (var i = 0; i < arguments.length; i++) {
  6511. var obj = i < 0 || arguments.length <= i ? undefined : arguments[i];
  6512. for (var key in obj) {
  6513. if (obj.hasOwnProperty(key)) {
  6514. result[key] = obj[key];
  6515. }
  6516. }
  6517. }
  6518. return result;
  6519. }
  6520. var libsObject = {
  6521. $mathLib: {
  6522. $sin: Object(_lib_math__WEBPACK_IMPORTED_MODULE_5__["createSinFun"])(),
  6523. $cos: Object(_lib_math__WEBPACK_IMPORTED_MODULE_5__["createCosFun"])(),
  6524. $tan: Object(_lib_math__WEBPACK_IMPORTED_MODULE_5__["createTanFun"])(),
  6525. $sqrt: Object(_lib_math__WEBPACK_IMPORTED_MODULE_5__["createSqrtFun"])(),
  6526. $pow: Object(_lib_math__WEBPACK_IMPORTED_MODULE_5__["createPowFun"])(),
  6527. $log: Object(_lib_math__WEBPACK_IMPORTED_MODULE_5__["createLogFun"])(),
  6528. $abs: Object(_lib_math__WEBPACK_IMPORTED_MODULE_5__["createAbsFun"])(),
  6529. $negate: Object(_lib_math__WEBPACK_IMPORTED_MODULE_5__["createNegateFun"])(),
  6530. $invert: Object(_lib_math__WEBPACK_IMPORTED_MODULE_5__["createInvertFun"])(),
  6531. $max: Object(_lib_math__WEBPACK_IMPORTED_MODULE_5__["createMaxFun"])(),
  6532. $min: Object(_lib_math__WEBPACK_IMPORTED_MODULE_5__["createMinFun"])()
  6533. },
  6534. $ioLib: {
  6535. $read: Object(_lib_io__WEBPACK_IMPORTED_MODULE_1__["createInputFun"])(),
  6536. $write: Object(_lib_io__WEBPACK_IMPORTED_MODULE_1__["createOutputFun"])()
  6537. },
  6538. $strLib: {
  6539. $substring: Object(_lib_strings__WEBPACK_IMPORTED_MODULE_2__["createSubstringFun"])(),
  6540. $length: Object(_lib_strings__WEBPACK_IMPORTED_MODULE_2__["createLengthFun"])(),
  6541. $uppercase: Object(_lib_strings__WEBPACK_IMPORTED_MODULE_2__["createUppercaseFun"])(),
  6542. $lowercase: Object(_lib_strings__WEBPACK_IMPORTED_MODULE_2__["createLowercaseFun"])(),
  6543. $charAt: Object(_lib_strings__WEBPACK_IMPORTED_MODULE_2__["createrCharAtFun"])()
  6544. },
  6545. $arrayLib: {
  6546. $numElements: Object(_lib_arrays__WEBPACK_IMPORTED_MODULE_3__["createNumElementsFun"])(),
  6547. $matrixLines: Object(_lib_arrays__WEBPACK_IMPORTED_MODULE_3__["createMatrixLinesFun"])(),
  6548. $matrixColumns: Object(_lib_arrays__WEBPACK_IMPORTED_MODULE_3__["createMatrixColumnsFun"])()
  6549. },
  6550. $langLib: {
  6551. $isReal: Object(_lib_lang__WEBPACK_IMPORTED_MODULE_4__["createIsRealFun"])(),
  6552. $isInt: Object(_lib_lang__WEBPACK_IMPORTED_MODULE_4__["createIsIntFun"])(),
  6553. $isBool: Object(_lib_lang__WEBPACK_IMPORTED_MODULE_4__["createIsBoolFun"])(),
  6554. $castReal: Object(_lib_lang__WEBPACK_IMPORTED_MODULE_4__["createCastRealFun"])(),
  6555. $castInt: Object(_lib_lang__WEBPACK_IMPORTED_MODULE_4__["createCastIntFun"])(),
  6556. $castBool: Object(_lib_lang__WEBPACK_IMPORTED_MODULE_4__["createCastBoolFun"])(),
  6557. $castString: Object(_lib_lang__WEBPACK_IMPORTED_MODULE_4__["createCastStringFun"])()
  6558. }
  6559. };
  6560. var funcsObject = concatObjects(libsObject.$ioLib, libsObject.$langLib, libsObject.$strLib, libsObject.$arrayLib);
  6561. var LanguageDefinedFunction = Object.freeze({
  6562. getMainFunctionName: function getMainFunctionName() {
  6563. return _services_languageService__WEBPACK_IMPORTED_MODULE_0__["LanguageService"].getCurrentLangFuncs().main_function;
  6564. },
  6565. getInternalName: function getInternalName(localName) {
  6566. if (localName.indexOf(".") !== -1) {
  6567. var names = localName.split(".");
  6568. var lib = valueToKey(names[0], _services_languageService__WEBPACK_IMPORTED_MODULE_0__["LanguageService"].getCurrentLangLibs());
  6569. var internalName = valueToKey(names[1], _services_languageService__WEBPACK_IMPORTED_MODULE_0__["LanguageService"].getCurrentLangFuncs());
  6570. if (lib === null || internalName === null) {
  6571. return null;
  6572. }
  6573. return lib + "." + internalName;
  6574. }
  6575. var funcName = valueToKey(localName, _services_languageService__WEBPACK_IMPORTED_MODULE_0__["LanguageService"].getCurrentLangFuncs());
  6576. if (funcName !== null) {
  6577. if (funcsObject[funcName]) {
  6578. return funcName;
  6579. }
  6580. }
  6581. return null;
  6582. },
  6583. getFunction: function getFunction(internalName) {
  6584. if (internalName.indexOf(".") !== -1) {
  6585. var names = internalName.split(".");
  6586. var libName = names[0];
  6587. var funName = names[1];
  6588. return libsObject[libName][funName];
  6589. }
  6590. return funcsObject[internalName];
  6591. },
  6592. getLocalName: function getLocalName(internalName) {
  6593. if (internalName.indexOf(".") !== -1) {
  6594. var names = internalName.split(".");
  6595. var libName = _services_languageService__WEBPACK_IMPORTED_MODULE_0__["LanguageService"].getCurrentLangLibs()[names[0]];
  6596. var funName = _services_languageService__WEBPACK_IMPORTED_MODULE_0__["LanguageService"].getCurrentLangFuncs()[names[1]];
  6597. return "".concat(libName, ".").concat(funName);
  6598. } else if (_services_languageService__WEBPACK_IMPORTED_MODULE_0__["LanguageService"].getCurrentLangFuncs()[internalName]) {
  6599. return _services_languageService__WEBPACK_IMPORTED_MODULE_0__["LanguageService"].getCurrentLangFuncs()[internalName];
  6600. } else {
  6601. return internalName;
  6602. }
  6603. }
  6604. });
  6605. /***/ }),
  6606. /***/ "./js/processor/error/processorErrorFactory.js":
  6607. /*!*****************************************************!*\
  6608. !*** ./js/processor/error/processorErrorFactory.js ***!
  6609. \*****************************************************/
  6610. /*! exports provided: ProcessorErrorFactory */
  6611. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  6612. "use strict";
  6613. __webpack_require__.r(__webpack_exports__);
  6614. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ProcessorErrorFactory", function() { return ProcessorErrorFactory; });
  6615. /* harmony import */ var _runtimeError__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./runtimeError */ "./js/processor/error/runtimeError.js");
  6616. /* harmony import */ var _semanticError__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./semanticError */ "./js/processor/error/semanticError.js");
  6617. /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  6618. var LocalizedStrings = _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__["getInstance"]();
  6619. var ProcessorErrorFactory = Object.freeze({
  6620. symbol_not_found_full: function symbol_not_found_full(id, sourceInfo) {
  6621. if (sourceInfo) {
  6622. var context = [id, sourceInfo.line, sourceInfo.column];
  6623. return new _semanticError__WEBPACK_IMPORTED_MODULE_1__["SemanticError"](LocalizedStrings.getError("symbol_not_found_full", context));
  6624. } else {
  6625. return ProcessorErrorFactory.symbol_not_found(id);
  6626. }
  6627. },
  6628. symbol_not_found: function symbol_not_found(id) {
  6629. var context = [id];
  6630. return new _semanticError__WEBPACK_IMPORTED_MODULE_1__["SemanticError"](LocalizedStrings.getError("symbol_not_found", context));
  6631. },
  6632. function_missing_full: function function_missing_full(id, sourceInfo) {
  6633. if (sourceInfo) {
  6634. var context = [id, sourceInfo.line, sourceInfo.column];
  6635. return new _semanticError__WEBPACK_IMPORTED_MODULE_1__["SemanticError"](LocalizedStrings.getError("function_missing_full", context));
  6636. } else {
  6637. return ProcessorErrorFactory.function_missing(id);
  6638. }
  6639. },
  6640. function_missing: function function_missing(id) {
  6641. var context = [id];
  6642. return new _semanticError__WEBPACK_IMPORTED_MODULE_1__["SemanticError"](LocalizedStrings.getError("function_missing", context));
  6643. },
  6644. main_missing: function main_missing() {
  6645. return new _semanticError__WEBPACK_IMPORTED_MODULE_1__["SemanticError"](LocalizedStrings.getError("main_missing"));
  6646. },
  6647. // TODO: better urgent error message
  6648. array_dimension_not_int_full: function array_dimension_not_int_full(sourceInfo) {
  6649. if (sourceInfo) {
  6650. var context = [sourceInfo.line];
  6651. return new _semanticError__WEBPACK_IMPORTED_MODULE_1__["SemanticError"](LocalizedStrings.getError("array_dimension_not_int_full", context));
  6652. } else {
  6653. return ProcessorErrorFactory.array_dimension_not_int();
  6654. }
  6655. },
  6656. array_dimension_not_int: function array_dimension_not_int() {
  6657. return new _semanticError__WEBPACK_IMPORTED_MODULE_1__["SemanticError"](LocalizedStrings.getError("array_dimension_not_int"));
  6658. },
  6659. unknown_command_full: function unknown_command_full(sourceInfo) {
  6660. if (sourceInfo) {
  6661. var context = [sourceInfo.line];
  6662. return new _runtimeError__WEBPACK_IMPORTED_MODULE_0__["RuntimeError"](LocalizedStrings.getError("unknown_command_full", context));
  6663. } else {
  6664. return ProcessorErrorFactory.unknown_command();
  6665. }
  6666. },
  6667. unknown_command: function unknown_command() {
  6668. return new _runtimeError__WEBPACK_IMPORTED_MODULE_0__["RuntimeError"](LocalizedStrings.getError("unknown_command"));
  6669. },
  6670. incompatible_types_full: function incompatible_types_full(type, dim, sourceInfo) {
  6671. if (sourceInfo) {
  6672. var context = [LocalizedStrings.translateType(type, dim), sourceInfo.line, sourceInfo.column];
  6673. return new _semanticError__WEBPACK_IMPORTED_MODULE_1__["SemanticError"](LocalizedStrings.getError("incompatible_types_full", context));
  6674. } else {
  6675. return ProcessorErrorFactory.incompatible_types(type, dim);
  6676. }
  6677. },
  6678. incompatible_types: function incompatible_types(type, dim) {
  6679. var context = [LocalizedStrings.translateType(type, dim)];
  6680. return new _semanticError__WEBPACK_IMPORTED_MODULE_1__["SemanticError"](LocalizedStrings.getError("incompatible_types", context));
  6681. },
  6682. incompatible_types_array_full: function incompatible_types_array_full(exp, type, dim, sourceInfo) {
  6683. if (sourceInfo) {
  6684. var context = [exp, LocalizedStrings.translateType(type, dim), sourceInfo.line, sourceInfo.column];
  6685. return new _semanticError__WEBPACK_IMPORTED_MODULE_1__["SemanticError"](LocalizedStrings.getError("incompatible_types_array_full", context));
  6686. } else {
  6687. return ProcessorErrorFactory.incompatible_types_array(exp, type, dim);
  6688. }
  6689. },
  6690. incompatible_types_array: function incompatible_types_array(exp, type, dim) {
  6691. var context = [exp, LocalizedStrings.translateType(type, dim)];
  6692. return new _semanticError__WEBPACK_IMPORTED_MODULE_1__["SemanticError"](LocalizedStrings.getError("incompatible_types_array", context));
  6693. },
  6694. loop_condition_type_full: function loop_condition_type_full(exp, sourceInfo) {
  6695. if (sourceInfo) {
  6696. var context = [sourceInfo.line, sourceInfo.column, exp];
  6697. return new _semanticError__WEBPACK_IMPORTED_MODULE_1__["SemanticError"](LocalizedStrings.getError("loop_condition_type_full", context));
  6698. } else {
  6699. return ProcessorErrorFactory.loop_condition_type(exp);
  6700. }
  6701. },
  6702. loop_condition_type: function loop_condition_type(exp) {
  6703. var context = [exp];
  6704. return new _semanticError__WEBPACK_IMPORTED_MODULE_1__["SemanticError"](LocalizedStrings.getError("loop_condition_type", context));
  6705. },
  6706. endless_loop_full: function endless_loop_full(sourceInfo) {
  6707. if (sourceInfo) {
  6708. var context = [sourceInfo.line];
  6709. return new _semanticError__WEBPACK_IMPORTED_MODULE_1__["SemanticError"](LocalizedStrings.getError("endless_loop_full", context));
  6710. } else {
  6711. return ProcessorErrorFactory.endless_loop();
  6712. }
  6713. },
  6714. endless_loop: function endless_loop() {
  6715. return new _semanticError__WEBPACK_IMPORTED_MODULE_1__["SemanticError"](LocalizedStrings.getError("endless_loop"));
  6716. },
  6717. for_condition_type_full: function for_condition_type_full(exp, sourceInfo) {
  6718. if (sourceInfo) {
  6719. var context = [sourceInfo.line, sourceInfo.column, exp];
  6720. return new _semanticError__WEBPACK_IMPORTED_MODULE_1__["SemanticError"](LocalizedStrings.getError("for_condition_type_full", context));
  6721. } else {
  6722. return ProcessorErrorFactory.for_condition_type(exp);
  6723. }
  6724. },
  6725. for_condition_type: function for_condition_type(exp) {
  6726. var context = [exp];
  6727. return new _semanticError__WEBPACK_IMPORTED_MODULE_1__["SemanticError"](LocalizedStrings.getError("for_condition_type", context));
  6728. },
  6729. if_condition_type_full: function if_condition_type_full(exp, sourceInfo) {
  6730. if (sourceInfo) {
  6731. var context = [sourceInfo.line, sourceInfo.column, exp];
  6732. return new _semanticError__WEBPACK_IMPORTED_MODULE_1__["SemanticError"](LocalizedStrings.getError("if_condition_type_full", context));
  6733. } else {
  6734. return ProcessorErrorFactory.if_condition_type(exp);
  6735. }
  6736. },
  6737. if_condition_type: function if_condition_type(exp) {
  6738. var context = [exp];
  6739. return new _semanticError__WEBPACK_IMPORTED_MODULE_1__["SemanticError"](LocalizedStrings.getError("if_condition_type", context));
  6740. },
  6741. invalid_global_var: function invalid_global_var() {
  6742. return new _runtimeError__WEBPACK_IMPORTED_MODULE_0__["RuntimeError"](LocalizedStrings.getError("invalid_global_var"));
  6743. },
  6744. not_implemented: function not_implemented(id) {
  6745. var context = [id];
  6746. return new _runtimeError__WEBPACK_IMPORTED_MODULE_0__["RuntimeError"](LocalizedStrings.getError("not_implemented", context));
  6747. },
  6748. invalid_case_type_full: function invalid_case_type_full(exp, type, dim, sourceInfo) {
  6749. if (sourceInfo) {
  6750. var context = [exp, LocalizedStrings.translateType(type, dim), sourceInfo.line, sourceInfo.column];
  6751. return new _semanticError__WEBPACK_IMPORTED_MODULE_1__["SemanticError"](LocalizedStrings.getError("invalid_case_type_full", context));
  6752. } else {
  6753. return ProcessorErrorFactory.invalid_case_type(exp, type, dim);
  6754. }
  6755. },
  6756. invalid_case_type: function invalid_case_type(exp, type, dim) {
  6757. var context = [exp, LocalizedStrings.translateType(type, dim)];
  6758. return new _semanticError__WEBPACK_IMPORTED_MODULE_1__["SemanticError"](LocalizedStrings.getError("invalid_case_type", context));
  6759. },
  6760. void_in_expression_full: function void_in_expression_full(id, sourceInfo) {
  6761. if (sourceInfo) {
  6762. var context = [sourceInfo.line, sourceInfo.column, id];
  6763. return new _semanticError__WEBPACK_IMPORTED_MODULE_1__["SemanticError"](LocalizedStrings.getError("void_in_expression_full", context));
  6764. } else {
  6765. return ProcessorErrorFactory.void_in_expression(id);
  6766. }
  6767. },
  6768. void_in_expression: function void_in_expression(id) {
  6769. var context = [id];
  6770. return new _semanticError__WEBPACK_IMPORTED_MODULE_1__["SemanticError"](LocalizedStrings.getError("void_in_expression", context));
  6771. },
  6772. invalid_array_access_full: function invalid_array_access_full(id, sourceInfo) {
  6773. if (sourceInfo) {
  6774. var context = [id, sourceInfo.line, sourceInfo.column];
  6775. return new _semanticError__WEBPACK_IMPORTED_MODULE_1__["SemanticError"](LocalizedStrings.getError("invalid_array_access_full", context));
  6776. } else {
  6777. return ProcessorErrorFactory.invalid_array_access(id);
  6778. }
  6779. },
  6780. invalid_array_access: function invalid_array_access(id) {
  6781. var context = [id];
  6782. return new _semanticError__WEBPACK_IMPORTED_MODULE_1__["SemanticError"](LocalizedStrings.getError("invalid_array_access", context));
  6783. },
  6784. invalid_matrix_access_full: function invalid_matrix_access_full(id, sourceInfo) {
  6785. if (sourceInfo) {
  6786. var context = [id, sourceInfo.line, sourceInfo.column];
  6787. return new _semanticError__WEBPACK_IMPORTED_MODULE_1__["SemanticError"](LocalizedStrings.getError("invalid_matrix_access_full", context));
  6788. } else {
  6789. return ProcessorErrorFactory.invalid_matrix_access(id);
  6790. }
  6791. },
  6792. invalid_matrix_access: function invalid_matrix_access(id) {
  6793. var context = [id];
  6794. return new _semanticError__WEBPACK_IMPORTED_MODULE_1__["SemanticError"](LocalizedStrings.getError("invalid_matrix_access", context));
  6795. },
  6796. matrix_column_outbounds_full: function matrix_column_outbounds_full(id, value, columns, sourceInfo) {
  6797. if (sourceInfo) {
  6798. var context = [sourceInfo.line, value, id, columns];
  6799. return new _runtimeError__WEBPACK_IMPORTED_MODULE_0__["RuntimeError"](LocalizedStrings.getError("matrix_column_outbounds_full", context));
  6800. } else {
  6801. return ProcessorErrorFactory.matrix_column_outbounds(id, value, columns);
  6802. }
  6803. },
  6804. matrix_column_outbounds: function matrix_column_outbounds(id, value, columns) {
  6805. var context = [value, id, columns];
  6806. return new _runtimeError__WEBPACK_IMPORTED_MODULE_0__["RuntimeError"](LocalizedStrings.getError("matrix_column_outbounds", context));
  6807. },
  6808. matrix_line_outbounds_full: function matrix_line_outbounds_full(id, value, lines, sourceInfo) {
  6809. if (sourceInfo) {
  6810. var context = [sourceInfo.line, value, id, lines];
  6811. return new _runtimeError__WEBPACK_IMPORTED_MODULE_0__["RuntimeError"](LocalizedStrings.getError("matrix_line_outbounds_full", context));
  6812. } else {
  6813. return ProcessorErrorFactory.matrix_line_outbounds(id, value, lines);
  6814. }
  6815. },
  6816. matrix_line_outbounds: function matrix_line_outbounds(id, value, lines) {
  6817. var context = [value, id, lines];
  6818. return new _runtimeError__WEBPACK_IMPORTED_MODULE_0__["RuntimeError"](LocalizedStrings.getError("matrix_line_outbounds", context));
  6819. },
  6820. vector_line_outbounds_full: function vector_line_outbounds_full(id, value, lines, sourceInfo) {
  6821. if (sourceInfo) {
  6822. var context = [sourceInfo.line, value, id, lines];
  6823. return new _runtimeError__WEBPACK_IMPORTED_MODULE_0__["RuntimeError"](LocalizedStrings.getError("vector_line_outbounds_full", context));
  6824. } else {
  6825. return ProcessorErrorFactory.vector_line_outbounds(id, value, lines);
  6826. }
  6827. },
  6828. vector_line_outbounds: function vector_line_outbounds(id, value, lines) {
  6829. var context = [value, id, lines];
  6830. return new _runtimeError__WEBPACK_IMPORTED_MODULE_0__["RuntimeError"](LocalizedStrings.getError("vector_line_outbounds", context));
  6831. },
  6832. vector_not_matrix_full: function vector_not_matrix_full(id, sourceInfo) {
  6833. if (sourceInfo) {
  6834. var context = [sourceInfo.line, id];
  6835. return new _runtimeError__WEBPACK_IMPORTED_MODULE_0__["RuntimeError"](LocalizedStrings.getError("vector_not_matrix_full", context));
  6836. } else {
  6837. return ProcessorErrorFactory.vector_not_matrix(id);
  6838. }
  6839. },
  6840. vector_not_matrix: function vector_not_matrix(id) {
  6841. var context = [id];
  6842. return new _runtimeError__WEBPACK_IMPORTED_MODULE_0__["RuntimeError"](LocalizedStrings.getError("vector_not_matrix", context));
  6843. },
  6844. function_no_return: function function_no_return(id) {
  6845. var context = [id];
  6846. return new _semanticError__WEBPACK_IMPORTED_MODULE_1__["SemanticError"](LocalizedStrings.getError("function_no_return", context));
  6847. },
  6848. invalid_void_return_full: function invalid_void_return_full(id, type, dim, sourceInfo) {
  6849. if (sourceInfo) {
  6850. var context = [sourceInfo.line, id, LocalizedStrings.translateType(type, dim)];
  6851. return new _semanticError__WEBPACK_IMPORTED_MODULE_1__["SemanticError"](LocalizedStrings.getError("invalid_void_return_full", context));
  6852. } else {
  6853. return ProcessorErrorFactory.invalid_void_return(id, type, dim);
  6854. }
  6855. },
  6856. invalid_void_return: function invalid_void_return(id, type, dim) {
  6857. var context = [id, LocalizedStrings.translateType(type, dim)];
  6858. return new _semanticError__WEBPACK_IMPORTED_MODULE_1__["SemanticError"](LocalizedStrings.getError("invalid_void_return_full", context));
  6859. },
  6860. invalid_return_type_full: function invalid_return_type_full(id, type, dim, sourceInfo) {
  6861. if (sourceInfo) {
  6862. var context = [sourceInfo.line, id, LocalizedStrings.translateType(type, dim)];
  6863. return new _semanticError__WEBPACK_IMPORTED_MODULE_1__["SemanticError"](LocalizedStrings.getError("invalid_return_type_full", context));
  6864. } else {
  6865. return ProcessorErrorFactory.invalid_return_type(id, type, dim);
  6866. }
  6867. },
  6868. invalid_return_type: function invalid_return_type(id, type, dim) {
  6869. var context = [id, LocalizedStrings.translateType(type, dim)];
  6870. return new _semanticError__WEBPACK_IMPORTED_MODULE_1__["SemanticError"](LocalizedStrings.getError("invalid_return_type", context));
  6871. },
  6872. invalid_parameters_size_full: function invalid_parameters_size_full(id, expected, actual, sourceInfo) {
  6873. if (sourceInfo) {
  6874. var context = [sourceInfo.line, id, expected, actual];
  6875. return new _semanticError__WEBPACK_IMPORTED_MODULE_1__["SemanticError"](LocalizedStrings.getError("invalid_parameters_size_full", context));
  6876. } else {
  6877. return ProcessorErrorFactory.invalid_parameters_size(id, expected, actual);
  6878. }
  6879. },
  6880. invalid_parameters_size: function invalid_parameters_size(id, expected, actual) {
  6881. var context = [id, expected, actual];
  6882. return new _semanticError__WEBPACK_IMPORTED_MODULE_1__["SemanticError"](LocalizedStrings.getError("invalid_parameters_size", context));
  6883. },
  6884. invalid_parameter_type_full: function invalid_parameter_type_full(id, exp, sourceInfo) {
  6885. if (sourceInfo) {
  6886. var context = [exp, id, sourceInfo.line];
  6887. return new _semanticError__WEBPACK_IMPORTED_MODULE_1__["SemanticError"](LocalizedStrings.getError("invalid_parameter_type_full", context));
  6888. } else {
  6889. return ProcessorErrorFactory.invalid_parameter_type(id, exp);
  6890. }
  6891. },
  6892. invalid_parameter_type: function invalid_parameter_type(id, exp) {
  6893. var context = [exp, id];
  6894. return new _semanticError__WEBPACK_IMPORTED_MODULE_1__["SemanticError"](LocalizedStrings.getError("invalid_parameter_type_full", context));
  6895. },
  6896. invalid_ref_full: function invalid_ref_full(id, exp, sourceInfo) {
  6897. if (sourceInfo) {
  6898. var context = [exp, id, sourceInfo.line];
  6899. return new _semanticError__WEBPACK_IMPORTED_MODULE_1__["SemanticError"](LocalizedStrings.getError("invalid_ref_full", context));
  6900. } else {
  6901. return ProcessorErrorFactory.invalid_ref(id, exp);
  6902. }
  6903. },
  6904. invalid_ref: function invalid_ref(id, exp) {
  6905. var context = [exp, id];
  6906. return new _semanticError__WEBPACK_IMPORTED_MODULE_1__["SemanticError"](LocalizedStrings.getError("invalid_ref", context));
  6907. },
  6908. unexpected_break_command_full: function unexpected_break_command_full(sourceInfo) {
  6909. if (sourceInfo) {
  6910. var context = [sourceInfo.line];
  6911. return new _runtimeError__WEBPACK_IMPORTED_MODULE_0__["RuntimeError"](LocalizedStrings.getError("unexpected_break_command_full", context));
  6912. } else {
  6913. return ProcessorErrorFactory.unexpected_break_command();
  6914. }
  6915. },
  6916. unexpected_break_command: function unexpected_break_command() {
  6917. return new _runtimeError__WEBPACK_IMPORTED_MODULE_0__["RuntimeError"](LocalizedStrings.getError("unexpected_break_command"));
  6918. },
  6919. invalid_array_literal_type_full: function invalid_array_literal_type_full(exp, sourceInfo) {
  6920. if (sourceInfo) {
  6921. var context = [sourceInfo.line, exp];
  6922. return new _runtimeError__WEBPACK_IMPORTED_MODULE_0__["RuntimeError"](LocalizedStrings.getError("invalid_array_literal_type_full", context));
  6923. } else {
  6924. return ProcessorErrorFactory.invalid_array_literal_type(exp);
  6925. }
  6926. },
  6927. invalid_array_literal_type: function invalid_array_literal_type(exp) {
  6928. var context = [exp];
  6929. return new _runtimeError__WEBPACK_IMPORTED_MODULE_0__["RuntimeError"](LocalizedStrings.getError("invalid_array_literal_type", context));
  6930. },
  6931. invalid_array_literal_line_full: function invalid_array_literal_line_full(expected, actual, sourceInfo) {
  6932. if (sourceInfo) {
  6933. var context = [sourceInfo.line, expected, actual];
  6934. return new _runtimeError__WEBPACK_IMPORTED_MODULE_0__["RuntimeError"](LocalizedStrings.getError("invalid_array_literal_line_full", context));
  6935. } else {
  6936. return ProcessorErrorFactory.invalid_array_literal_type(expected, actual);
  6937. }
  6938. },
  6939. invalid_array_literal_line: function invalid_array_literal_line(expected, actual) {
  6940. var context = [expected, actual];
  6941. return new _runtimeError__WEBPACK_IMPORTED_MODULE_0__["RuntimeError"](LocalizedStrings.getError("invalid_array_literal_line", context));
  6942. },
  6943. invalid_array_literal_column_full: function invalid_array_literal_column_full(expected, actual, sourceInfo) {
  6944. if (sourceInfo) {
  6945. var context = [sourceInfo.line, expected, actual];
  6946. return new _runtimeError__WEBPACK_IMPORTED_MODULE_0__["RuntimeError"](LocalizedStrings.getError("invalid_array_literal_column_full", context));
  6947. } else {
  6948. return ProcessorErrorFactory.invalid_array_literal_column(expected, actual);
  6949. }
  6950. },
  6951. invalid_array_literal_column: function invalid_array_literal_column(expected, actual) {
  6952. var context = [expected, actual];
  6953. return new _runtimeError__WEBPACK_IMPORTED_MODULE_0__["RuntimeError"](LocalizedStrings.getError("invalid_array_literal_column", context));
  6954. },
  6955. invalid_unary_op_full: function invalid_unary_op_full(opName, type, dim, sourceInfo) {
  6956. if (sourceInfo) {
  6957. var context = [sourceInfo.line, LocalizedStrings.translateOp(opName), LocalizedStrings.translateType(type, dim)];
  6958. return new _runtimeError__WEBPACK_IMPORTED_MODULE_0__["RuntimeError"](LocalizedStrings.getError("invalid_unary_op_full", context));
  6959. } else {
  6960. return ProcessorErrorFactory.invalid_unary_op(opName, type, dim);
  6961. }
  6962. },
  6963. invalid_unary_op: function invalid_unary_op(opName, type, dim) {
  6964. var context = [LocalizedStrings.translateOp(opName), LocalizedStrings.translateType(type, dim)];
  6965. return new _runtimeError__WEBPACK_IMPORTED_MODULE_0__["RuntimeError"](LocalizedStrings.getError("invalid_unary_op", context));
  6966. },
  6967. invalid_infix_op_full: function invalid_infix_op_full(opName, typeLeft, dimLeft, typeRight, dimRight, sourceInfo) {
  6968. if (sourceInfo) {
  6969. var context = [sourceInfo.line, LocalizedStrings.translateOp(opName), LocalizedStrings.translateType(typeLeft, dimLeft), LocalizedStrings.translateType(typeRight, dimRight)];
  6970. return new _runtimeError__WEBPACK_IMPORTED_MODULE_0__["RuntimeError"](LocalizedStrings.getError("invalid_infix_op_full", context));
  6971. } else {
  6972. return ProcessorErrorFactory.invalid_infix_op(opName, typeLeft, dimLeft, typeRight, dimRight);
  6973. }
  6974. },
  6975. invalid_infix_op: function invalid_infix_op(opName, typeLeft, dimLeft, typeRight, dimRight) {
  6976. var context = [LocalizedStrings.translateOp(opName), LocalizedStrings.translateType(typeLeft, dimLeft), LocalizedStrings.translateType(typeRight, dimRight)];
  6977. return new _runtimeError__WEBPACK_IMPORTED_MODULE_0__["RuntimeError"](LocalizedStrings.getError("invalid_infix_op", context));
  6978. },
  6979. array_dimension_not_positive_full: function array_dimension_not_positive_full(sourceInfo) {
  6980. if (sourceInfo) {
  6981. var context = [sourceInfo.line];
  6982. return new _semanticError__WEBPACK_IMPORTED_MODULE_1__["SemanticError"](LocalizedStrings.getError("array_dimension_not_positive_full", context));
  6983. } else {
  6984. return ProcessorErrorFactory.array_dimension_not_positive();
  6985. }
  6986. },
  6987. array_dimension_not_positive: function array_dimension_not_positive() {
  6988. return new _semanticError__WEBPACK_IMPORTED_MODULE_1__["SemanticError"](LocalizedStrings.getError("array_dimension_not_positive"));
  6989. },
  6990. invalid_type_conversion: function invalid_type_conversion(value, type, dim) {
  6991. var context = [value, LocalizedStrings.translateType(type, dim)];
  6992. return new _runtimeError__WEBPACK_IMPORTED_MODULE_0__["RuntimeError"](LocalizedStrings.getError("invalid_type_conversion", context));
  6993. }
  6994. });
  6995. /***/ }),
  6996. /***/ "./js/processor/error/runtimeError.js":
  6997. /*!********************************************!*\
  6998. !*** ./js/processor/error/runtimeError.js ***!
  6999. \********************************************/
  7000. /*! exports provided: RuntimeError */
  7001. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  7002. "use strict";
  7003. __webpack_require__.r(__webpack_exports__);
  7004. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "RuntimeError", function() { return RuntimeError; });
  7005. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  7006. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  7007. function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
  7008. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  7009. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
  7010. function _wrapNativeSuper(Class) { var _cache = typeof Map === "function" ? new Map() : undefined; _wrapNativeSuper = function _wrapNativeSuper(Class) { if (Class === null || !_isNativeFunction(Class)) return Class; if (typeof Class !== "function") { throw new TypeError("Super expression must either be null or a function"); } if (typeof _cache !== "undefined") { if (_cache.has(Class)) return _cache.get(Class); _cache.set(Class, Wrapper); } function Wrapper() { return _construct(Class, arguments, _getPrototypeOf(this).constructor); } Wrapper.prototype = Object.create(Class.prototype, { constructor: { value: Wrapper, enumerable: false, writable: true, configurable: true } }); return _setPrototypeOf(Wrapper, Class); }; return _wrapNativeSuper(Class); }
  7011. function isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
  7012. function _construct(Parent, args, Class) { if (isNativeReflectConstruct()) { _construct = Reflect.construct; } else { _construct = function _construct(Parent, args, Class) { var a = [null]; a.push.apply(a, args); var Constructor = Function.bind.apply(Parent, a); var instance = new Constructor(); if (Class) _setPrototypeOf(instance, Class.prototype); return instance; }; } return _construct.apply(null, arguments); }
  7013. function _isNativeFunction(fn) { return Function.toString.call(fn).indexOf("[native code]") !== -1; }
  7014. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  7015. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  7016. var RuntimeError =
  7017. /*#__PURE__*/
  7018. function (_Error) {
  7019. _inherits(RuntimeError, _Error);
  7020. function RuntimeError() {
  7021. var _getPrototypeOf2;
  7022. var _this;
  7023. _classCallCheck(this, RuntimeError);
  7024. for (var _len = arguments.length, msg = new Array(_len), _key = 0; _key < _len; _key++) {
  7025. msg[_key] = arguments[_key];
  7026. }
  7027. _this = _possibleConstructorReturn(this, (_getPrototypeOf2 = _getPrototypeOf(RuntimeError)).call.apply(_getPrototypeOf2, [this].concat(msg)));
  7028. if (Error.captureStackTrace) Error.captureStackTrace(_assertThisInitialized(_this), RuntimeError);
  7029. return _this;
  7030. }
  7031. return RuntimeError;
  7032. }(_wrapNativeSuper(Error));
  7033. /***/ }),
  7034. /***/ "./js/processor/error/semanticError.js":
  7035. /*!*********************************************!*\
  7036. !*** ./js/processor/error/semanticError.js ***!
  7037. \*********************************************/
  7038. /*! exports provided: SemanticError */
  7039. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  7040. "use strict";
  7041. __webpack_require__.r(__webpack_exports__);
  7042. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SemanticError", function() { return SemanticError; });
  7043. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  7044. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  7045. function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
  7046. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  7047. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
  7048. function _wrapNativeSuper(Class) { var _cache = typeof Map === "function" ? new Map() : undefined; _wrapNativeSuper = function _wrapNativeSuper(Class) { if (Class === null || !_isNativeFunction(Class)) return Class; if (typeof Class !== "function") { throw new TypeError("Super expression must either be null or a function"); } if (typeof _cache !== "undefined") { if (_cache.has(Class)) return _cache.get(Class); _cache.set(Class, Wrapper); } function Wrapper() { return _construct(Class, arguments, _getPrototypeOf(this).constructor); } Wrapper.prototype = Object.create(Class.prototype, { constructor: { value: Wrapper, enumerable: false, writable: true, configurable: true } }); return _setPrototypeOf(Wrapper, Class); }; return _wrapNativeSuper(Class); }
  7049. function isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
  7050. function _construct(Parent, args, Class) { if (isNativeReflectConstruct()) { _construct = Reflect.construct; } else { _construct = function _construct(Parent, args, Class) { var a = [null]; a.push.apply(a, args); var Constructor = Function.bind.apply(Parent, a); var instance = new Constructor(); if (Class) _setPrototypeOf(instance, Class.prototype); return instance; }; } return _construct.apply(null, arguments); }
  7051. function _isNativeFunction(fn) { return Function.toString.call(fn).indexOf("[native code]") !== -1; }
  7052. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  7053. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  7054. var SemanticError =
  7055. /*#__PURE__*/
  7056. function (_Error) {
  7057. _inherits(SemanticError, _Error);
  7058. function SemanticError() {
  7059. var _getPrototypeOf2;
  7060. var _this;
  7061. _classCallCheck(this, SemanticError);
  7062. for (var _len = arguments.length, msg = new Array(_len), _key = 0; _key < _len; _key++) {
  7063. msg[_key] = arguments[_key];
  7064. }
  7065. _this = _possibleConstructorReturn(this, (_getPrototypeOf2 = _getPrototypeOf(SemanticError)).call.apply(_getPrototypeOf2, [this].concat(msg)));
  7066. if (Error.captureStackTrace) Error.captureStackTrace(_assertThisInitialized(_this), SemanticError);
  7067. return _this;
  7068. }
  7069. return SemanticError;
  7070. }(_wrapNativeSuper(Error));
  7071. /***/ }),
  7072. /***/ "./js/processor/ivprogProcessor.js":
  7073. /*!*****************************************!*\
  7074. !*** ./js/processor/ivprogProcessor.js ***!
  7075. \*****************************************/
  7076. /*! exports provided: IVProgProcessor */
  7077. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  7078. "use strict";
  7079. __webpack_require__.r(__webpack_exports__);
  7080. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "IVProgProcessor", function() { return IVProgProcessor; });
  7081. /* harmony import */ var _store_store__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./store/store */ "./js/processor/store/store.js");
  7082. /* harmony import */ var _store_storeObject__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./store/storeObject */ "./js/processor/store/storeObject.js");
  7083. /* harmony import */ var _store_storeObjectArray__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./store/storeObjectArray */ "./js/processor/store/storeObjectArray.js");
  7084. /* harmony import */ var _store_storeObjectRef__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./store/storeObjectRef */ "./js/processor/store/storeObjectRef.js");
  7085. /* harmony import */ var _modes__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./modes */ "./js/processor/modes.js");
  7086. /* harmony import */ var _context__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./context */ "./js/processor/context.js");
  7087. /* harmony import */ var _typeSystem_types__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./../typeSystem/types */ "./js/typeSystem/types.js");
  7088. /* harmony import */ var _ast_operators__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./../ast/operators */ "./js/ast/operators.js");
  7089. /* harmony import */ var _definedFunctions__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./definedFunctions */ "./js/processor/definedFunctions.js");
  7090. /* harmony import */ var _compatibilityTable__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./compatibilityTable */ "./js/processor/compatibilityTable.js");
  7091. /* harmony import */ var _ast_commands___WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./../ast/commands/ */ "./js/ast/commands/index.js");
  7092. /* harmony import */ var _ast_expressions___WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./../ast/expressions/ */ "./js/ast/expressions/index.js");
  7093. /* harmony import */ var _store_storeObjectArrayAddress__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./store/storeObjectArrayAddress */ "./js/processor/store/storeObjectArrayAddress.js");
  7094. /* harmony import */ var _store_storeObjectArrayAddressRef__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./store/storeObjectArrayAddressRef */ "./js/processor/store/storeObjectArrayAddressRef.js");
  7095. /* harmony import */ var _typeSystem_compoundType__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./../typeSystem/compoundType */ "./js/typeSystem/compoundType.js");
  7096. /* harmony import */ var _typeSystem_parsers__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ../typeSystem/parsers */ "./js/typeSystem/parsers.js");
  7097. /* harmony import */ var _util_config__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ../util/config */ "./js/util/config.js");
  7098. /* harmony import */ var decimal_js__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! decimal.js */ "./node_modules/decimal.js/decimal.js");
  7099. /* harmony import */ var decimal_js__WEBPACK_IMPORTED_MODULE_17___default = /*#__PURE__*/__webpack_require__.n(decimal_js__WEBPACK_IMPORTED_MODULE_17__);
  7100. /* harmony import */ var _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ./error/processorErrorFactory */ "./js/processor/error/processorErrorFactory.js");
  7101. /* harmony import */ var _error_runtimeError__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! ./error/runtimeError */ "./js/processor/error/runtimeError.js");
  7102. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  7103. 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); } }
  7104. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  7105. var IVProgProcessor =
  7106. /*#__PURE__*/
  7107. function () {
  7108. _createClass(IVProgProcessor, null, [{
  7109. key: "LOOP_TIMEOUT",
  7110. get: function get() {
  7111. return _util_config__WEBPACK_IMPORTED_MODULE_16__["Config"].loopTimeout;
  7112. },
  7113. set: function set(ms) {
  7114. _util_config__WEBPACK_IMPORTED_MODULE_16__["Config"].setConfig({
  7115. loopTimeout: ms
  7116. });
  7117. }
  7118. }, {
  7119. key: "MAIN_INTERNAL_ID",
  7120. get: function get() {
  7121. return "$main";
  7122. }
  7123. }]);
  7124. function IVProgProcessor(ast) {
  7125. _classCallCheck(this, IVProgProcessor);
  7126. this.ast = ast;
  7127. this.globalStore = new _store_store__WEBPACK_IMPORTED_MODULE_0__["Store"]("$global");
  7128. this.stores = [this.globalStore];
  7129. this.context = [_context__WEBPACK_IMPORTED_MODULE_5__["Context"].BASE];
  7130. this.input = null;
  7131. this.forceKill = false;
  7132. this.loopTimers = [];
  7133. this.output = null;
  7134. }
  7135. _createClass(IVProgProcessor, [{
  7136. key: "registerInput",
  7137. value: function registerInput(input) {
  7138. if (this.input !== null) this.input = null;
  7139. this.input = input;
  7140. }
  7141. }, {
  7142. key: "registerOutput",
  7143. value: function registerOutput(output) {
  7144. if (this.output !== null) this.output = null;
  7145. this.output = output;
  7146. }
  7147. }, {
  7148. key: "checkContext",
  7149. value: function checkContext(context) {
  7150. return this.context[this.context.length - 1] === context;
  7151. }
  7152. }, {
  7153. key: "ignoreSwitchCases",
  7154. value: function ignoreSwitchCases(store) {
  7155. if (store.mode === _modes__WEBPACK_IMPORTED_MODULE_4__["Modes"].RETURN) {
  7156. return true;
  7157. } else if (store.mode === _modes__WEBPACK_IMPORTED_MODULE_4__["Modes"].BREAK) {
  7158. return true;
  7159. } else {
  7160. return false;
  7161. }
  7162. }
  7163. }, {
  7164. key: "prepareState",
  7165. value: function prepareState() {
  7166. if (this.stores !== null) {
  7167. for (var i = 0; i < this.stores.length; i++) {
  7168. delete this.stores[i];
  7169. }
  7170. this.stores = null;
  7171. }
  7172. if (this.globalStore !== null) this.globalStore = null;
  7173. this.globalStore = new _store_store__WEBPACK_IMPORTED_MODULE_0__["Store"]("$global");
  7174. this.stores = [this.globalStore];
  7175. this.context = [_context__WEBPACK_IMPORTED_MODULE_5__["Context"].BASE];
  7176. }
  7177. }, {
  7178. key: "interpretAST",
  7179. value: function interpretAST() {
  7180. var _this = this;
  7181. this.prepareState();
  7182. return this.initGlobal().then(function (_) {
  7183. var mainFunc = _this.findMainFunction();
  7184. if (mainFunc === null) {
  7185. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_18__["ProcessorErrorFactory"].main_missing();
  7186. }
  7187. return _this.runFunction(mainFunc, [], _this.globalStore);
  7188. });
  7189. }
  7190. }, {
  7191. key: "initGlobal",
  7192. value: function initGlobal() {
  7193. if (!this.checkContext(_context__WEBPACK_IMPORTED_MODULE_5__["Context"].BASE)) {
  7194. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_18__["ProcessorErrorFactory"].invalid_global_var();
  7195. }
  7196. return this.executeCommands(this.globalStore, this.ast.global);
  7197. }
  7198. }, {
  7199. key: "findMainFunction",
  7200. value: function findMainFunction() {
  7201. return this.ast.functions.find(function (v) {
  7202. return v.isMain;
  7203. });
  7204. }
  7205. }, {
  7206. key: "findFunction",
  7207. value: function findFunction(name) {
  7208. if (name.match(/^\$.+$/)) {
  7209. var fun = _definedFunctions__WEBPACK_IMPORTED_MODULE_8__["LanguageDefinedFunction"].getFunction(name);
  7210. if (!!!fun) {
  7211. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_18__["ProcessorErrorFactory"].not_implemented(name);
  7212. }
  7213. return fun;
  7214. } else {
  7215. var val = this.ast.functions.find(function (v) {
  7216. return v.name === name;
  7217. });
  7218. if (!!!val) {
  7219. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_18__["ProcessorErrorFactory"].function_missing(name);
  7220. }
  7221. return val;
  7222. }
  7223. }
  7224. }, {
  7225. key: "runFunction",
  7226. value: function runFunction(func, actualParameters, store) {
  7227. var _this2 = this;
  7228. var funcName = func.isMain ? IVProgProcessor.MAIN_INTERNAL_ID : func.name;
  7229. var funcStore = new _store_store__WEBPACK_IMPORTED_MODULE_0__["Store"](funcName);
  7230. funcStore.extendStore(this.globalStore);
  7231. var returnStoreObject = null;
  7232. if (func.returnType instanceof _typeSystem_compoundType__WEBPACK_IMPORTED_MODULE_14__["CompoundType"]) {
  7233. if (func.returnType.dimensions > 1) {
  7234. returnStoreObject = new _store_storeObjectArray__WEBPACK_IMPORTED_MODULE_2__["StoreObjectArray"](func.returnType, -1, -1, [[]]);
  7235. } else {
  7236. returnStoreObject = new _store_storeObjectArray__WEBPACK_IMPORTED_MODULE_2__["StoreObjectArray"](func.returnType, -1, null, []);
  7237. }
  7238. } else {
  7239. returnStoreObject = new _store_storeObject__WEBPACK_IMPORTED_MODULE_1__["StoreObject"](func.returnType, null);
  7240. }
  7241. funcStore.insertStore('$', returnStoreObject);
  7242. var newFuncStore$ = this.associateParameters(func.formalParameters, actualParameters, store, funcStore);
  7243. var outerRef = this;
  7244. return newFuncStore$.then(function (sto) {
  7245. _this2.context.push(_context__WEBPACK_IMPORTED_MODULE_5__["Context"].FUNCTION);
  7246. _this2.stores.push(sto);
  7247. return _this2.executeCommands(sto, func.variablesDeclarations).then(function (stoWithVars) {
  7248. return outerRef.executeCommands(stoWithVars, func.commands);
  7249. }).then(function (finalSto) {
  7250. outerRef.stores.pop();
  7251. outerRef.context.pop();
  7252. return finalSto;
  7253. });
  7254. });
  7255. }
  7256. }, {
  7257. key: "associateParameters",
  7258. value: function associateParameters(formalList, actualList, callerStore, calleeStore) {
  7259. var _this3 = this;
  7260. var funcName = calleeStore.name === IVProgProcessor.MAIN_INTERNAL_ID ? _definedFunctions__WEBPACK_IMPORTED_MODULE_8__["LanguageDefinedFunction"].getMainFunctionName() : calleeStore.name;
  7261. if (formalList.length != actualList.length) {
  7262. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_18__["ProcessorErrorFactory"].invalid_parameters_size(funcName, formalList.length, actualList.length);
  7263. }
  7264. var promises$ = actualList.map(function (actualParameter) {
  7265. return _this3.evaluateExpression(callerStore, actualParameter);
  7266. });
  7267. return Promise.all(promises$).then(function (values) {
  7268. for (var i = 0; i < values.length; i++) {
  7269. var stoObj = values[i];
  7270. var exp = actualList[i];
  7271. var shouldTypeCast = false;
  7272. var formalParameter = formalList[i];
  7273. if (!formalParameter.type.isCompatible(stoObj.type)) {
  7274. if (_util_config__WEBPACK_IMPORTED_MODULE_16__["Config"].enable_type_casting && !formalParameter.byRef && _store_store__WEBPACK_IMPORTED_MODULE_0__["Store"].canImplicitTypeCast(formalParameter.type, stoObj.type)) {
  7275. shouldTypeCast = true;
  7276. } else {
  7277. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_18__["ProcessorErrorFactory"].invalid_parameter_type(funcName, exp.toString());
  7278. }
  7279. }
  7280. if (formalParameter.byRef && !stoObj.inStore) {
  7281. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_18__["ProcessorErrorFactory"].invalid_ref(funcName, exp.toString());
  7282. }
  7283. if (formalParameter.byRef) {
  7284. var ref = null;
  7285. if (stoObj instanceof _store_storeObjectArrayAddress__WEBPACK_IMPORTED_MODULE_12__["StoreObjectArrayAddress"]) {
  7286. ref = new _store_storeObjectArrayAddressRef__WEBPACK_IMPORTED_MODULE_13__["StoreObjectArrayAddressRef"](stoObj);
  7287. } else {
  7288. ref = new _store_storeObjectRef__WEBPACK_IMPORTED_MODULE_3__["StoreObjectRef"](stoObj.id, callerStore);
  7289. }
  7290. calleeStore.insertStore(formalParameter.id, ref);
  7291. } else {
  7292. var realValue = _this3.parseStoreObjectValue(stoObj);
  7293. if (shouldTypeCast) {
  7294. realValue = _store_store__WEBPACK_IMPORTED_MODULE_0__["Store"].doImplicitCasting(formalParameter.type, realValue);
  7295. }
  7296. calleeStore.insertStore(formalParameter.id, realValue);
  7297. }
  7298. }
  7299. return calleeStore;
  7300. });
  7301. }
  7302. }, {
  7303. key: "executeCommands",
  7304. value: function executeCommands(store, cmds) {
  7305. // helper to partially apply a function, in this case executeCommand
  7306. var outerRef = this;
  7307. var partial = function partial(fun, cmd) {
  7308. return function (sto) {
  7309. return fun(sto, cmd);
  7310. };
  7311. };
  7312. return cmds.reduce(function (lastCommand, next) {
  7313. var nextCommand = partial(outerRef.executeCommand.bind(outerRef), next);
  7314. return lastCommand.then(nextCommand);
  7315. }, Promise.resolve(store));
  7316. }
  7317. }, {
  7318. key: "executeCommand",
  7319. value: function executeCommand(store, cmd) {
  7320. if (this.forceKill) {
  7321. return Promise.reject("FORCED_KILL!");
  7322. } else if (store.mode === _modes__WEBPACK_IMPORTED_MODULE_4__["Modes"].PAUSE) {
  7323. return Promise.resolve(this.executeCommand(store, cmd));
  7324. } else if (store.mode === _modes__WEBPACK_IMPORTED_MODULE_4__["Modes"].RETURN) {
  7325. return Promise.resolve(store);
  7326. } else if (this.checkContext(_context__WEBPACK_IMPORTED_MODULE_5__["Context"].BREAKABLE) && store.mode === _modes__WEBPACK_IMPORTED_MODULE_4__["Modes"].BREAK) {
  7327. return Promise.resolve(store);
  7328. }
  7329. if (cmd instanceof _ast_commands___WEBPACK_IMPORTED_MODULE_10__["Declaration"]) {
  7330. return this.executeDeclaration(store, cmd);
  7331. } else if (cmd instanceof _ast_commands___WEBPACK_IMPORTED_MODULE_10__["ArrayIndexAssign"]) {
  7332. return this.executeArrayIndexAssign(store, cmd);
  7333. } else if (cmd instanceof _ast_commands___WEBPACK_IMPORTED_MODULE_10__["Assign"]) {
  7334. return this.executeAssign(store, cmd);
  7335. } else if (cmd instanceof _ast_commands___WEBPACK_IMPORTED_MODULE_10__["Break"]) {
  7336. return this.executeBreak(store, cmd);
  7337. } else if (cmd instanceof _ast_commands___WEBPACK_IMPORTED_MODULE_10__["Return"]) {
  7338. return this.executeReturn(store, cmd);
  7339. } else if (cmd instanceof _ast_commands___WEBPACK_IMPORTED_MODULE_10__["IfThenElse"]) {
  7340. return this.executeIfThenElse(store, cmd);
  7341. } else if (cmd instanceof _ast_commands___WEBPACK_IMPORTED_MODULE_10__["DoWhile"]) {
  7342. return this.executeDoWhile(store, cmd);
  7343. } else if (cmd instanceof _ast_commands___WEBPACK_IMPORTED_MODULE_10__["While"]) {
  7344. return this.executeWhile(store, cmd);
  7345. } else if (cmd instanceof _ast_commands___WEBPACK_IMPORTED_MODULE_10__["For"]) {
  7346. return this.executeFor(store, cmd);
  7347. } else if (cmd instanceof _ast_commands___WEBPACK_IMPORTED_MODULE_10__["Switch"]) {
  7348. return this.executeSwitch(store, cmd);
  7349. } else if (cmd instanceof _ast_expressions___WEBPACK_IMPORTED_MODULE_11__["FunctionCall"]) {
  7350. return this.executeFunctionCall(store, cmd);
  7351. } else if (cmd instanceof _ast_commands___WEBPACK_IMPORTED_MODULE_10__["SysCall"]) {
  7352. return this.executeSysCall(store, cmd);
  7353. } else {
  7354. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_18__["ProcessorErrorFactory"].unknown_command(cmd.sourceInfo);
  7355. }
  7356. }
  7357. }, {
  7358. key: "executeSysCall",
  7359. value: function executeSysCall(store, cmd) {
  7360. var func = cmd.langFunc.bind(this);
  7361. return func(store, cmd);
  7362. }
  7363. }, {
  7364. key: "executeFunctionCall",
  7365. value: function executeFunctionCall(store, cmd) {
  7366. var func = null;
  7367. if (cmd.isMainCall) {
  7368. func = this.findMainFunction();
  7369. } else {
  7370. func = this.findFunction(cmd.id);
  7371. }
  7372. return this.runFunction(func, cmd.actualParameters, store).then(function (sto) {
  7373. if (!_typeSystem_types__WEBPACK_IMPORTED_MODULE_6__["Types"].VOID.isCompatible(func.returnType) && sto.mode !== _modes__WEBPACK_IMPORTED_MODULE_4__["Modes"].RETURN) {
  7374. var funcName = func.name === IVProgProcessor.MAIN_INTERNAL_ID ? _definedFunctions__WEBPACK_IMPORTED_MODULE_8__["LanguageDefinedFunction"].getMainFunctionName() : func.name;
  7375. return Promise.reject(_error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_18__["ProcessorErrorFactory"].function_no_return(funcName));
  7376. } else {
  7377. return store;
  7378. }
  7379. });
  7380. }
  7381. }, {
  7382. key: "executeSwitch",
  7383. value: function executeSwitch(store, cmd) {
  7384. var _this4 = this;
  7385. this.context.push(_context__WEBPACK_IMPORTED_MODULE_5__["Context"].BREAKABLE);
  7386. var auxCaseFun = function auxCaseFun(promise, switchExp, aCase) {
  7387. return promise.then(function (result) {
  7388. var sto = result.sto;
  7389. if (_this4.ignoreSwitchCases(sto)) {
  7390. return Promise.resolve(result);
  7391. } else if (result.wasTrue || aCase.isDefault) {
  7392. var $newSto = _this4.executeCommands(result.sto, aCase.commands);
  7393. return $newSto.then(function (nSto) {
  7394. return Promise.resolve({
  7395. wasTrue: true,
  7396. sto: nSto
  7397. });
  7398. });
  7399. } else {
  7400. var $value = _this4.evaluateExpression(sto, new _ast_expressions___WEBPACK_IMPORTED_MODULE_11__["InfixApp"](_ast_operators__WEBPACK_IMPORTED_MODULE_7__["Operators"].EQ, switchExp, aCase.expression));
  7401. return $value.then(function (vl) {
  7402. if (vl.value) {
  7403. var _$newSto = _this4.executeCommands(result.sto, aCase.commands);
  7404. return _$newSto.then(function (nSto) {
  7405. return Promise.resolve({
  7406. wasTrue: true,
  7407. sto: nSto
  7408. });
  7409. });
  7410. } else {
  7411. return Promise.resolve({
  7412. wasTrue: false,
  7413. sto: sto
  7414. });
  7415. }
  7416. });
  7417. }
  7418. });
  7419. };
  7420. try {
  7421. var breakLoop = false;
  7422. var $result = Promise.resolve({
  7423. wasTrue: false,
  7424. sto: store
  7425. });
  7426. for (var index = 0; index < cmd.cases.length && !breakLoop; index++) {
  7427. var aCase = cmd.cases[index];
  7428. $result = auxCaseFun($result, cmd.expression, aCase);
  7429. $result.then(function (r) {
  7430. return breakLoop = _this4.ignoreSwitchCases(r.sto);
  7431. });
  7432. }
  7433. return $result.then(function (r) {
  7434. _this4.context.pop();
  7435. if (r.sto.mode === _modes__WEBPACK_IMPORTED_MODULE_4__["Modes"].BREAK) {
  7436. r.sto.mode = _modes__WEBPACK_IMPORTED_MODULE_4__["Modes"].RUN;
  7437. }
  7438. return r.sto;
  7439. });
  7440. } catch (error) {
  7441. return Promise.reject(error);
  7442. }
  7443. }
  7444. }, {
  7445. key: "executeFor",
  7446. value: function executeFor(store, cmd) {
  7447. try {
  7448. //BEGIN for -> while rewrite
  7449. var initCmd = cmd.assignment;
  7450. var condition = cmd.condition;
  7451. var increment = cmd.increment;
  7452. var whileBlock = new _ast_commands___WEBPACK_IMPORTED_MODULE_10__["CommandBlock"]([], cmd.commands.concat(increment));
  7453. var forAsWhile = new _ast_commands___WEBPACK_IMPORTED_MODULE_10__["While"](condition, whileBlock);
  7454. forAsWhile.sourceInfo = cmd.sourceInfo; //END for -> while rewrite
  7455. var newCmdList = [initCmd, forAsWhile];
  7456. return this.executeCommands(store, newCmdList);
  7457. } catch (error) {
  7458. return Promise.reject(error);
  7459. }
  7460. }
  7461. }, {
  7462. key: "executeDoWhile",
  7463. value: function executeDoWhile(store, cmd) {
  7464. var outerRef = this;
  7465. try {
  7466. outerRef.loopTimers.push(Date.now());
  7467. outerRef.context.push(_context__WEBPACK_IMPORTED_MODULE_5__["Context"].BREAKABLE);
  7468. var $newStore = outerRef.executeCommands(store, cmd.commands);
  7469. return $newStore.then(function (sto) {
  7470. if (sto.mode === _modes__WEBPACK_IMPORTED_MODULE_4__["Modes"].BREAK) {
  7471. outerRef.context.pop();
  7472. sto.mode = _modes__WEBPACK_IMPORTED_MODULE_4__["Modes"].RUN;
  7473. outerRef.loopTimers.pop();
  7474. return sto;
  7475. }
  7476. var $value = outerRef.evaluateExpression(sto, cmd.expression);
  7477. return $value.then(function (vl) {
  7478. if (!vl.type.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_6__["Types"].BOOLEAN)) {
  7479. return Promise.reject(_error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_18__["ProcessorErrorFactory"].loop_condition_type_full(cmd.sourceInfo));
  7480. }
  7481. if (vl.value) {
  7482. outerRef.context.pop();
  7483. for (var i = 0; i < outerRef.loopTimers.length; i++) {
  7484. var time = outerRef.loopTimers[i];
  7485. if (Date.now() - time >= IVProgProcessor.LOOP_TIMEOUT) {
  7486. outerRef.forceKill = true;
  7487. return Promise.reject(_error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_18__["ProcessorErrorFactory"].endless_loop_full(cmd.sourceInfo));
  7488. }
  7489. }
  7490. return outerRef.executeCommand(sto, cmd);
  7491. } else {
  7492. outerRef.context.pop();
  7493. outerRef.loopTimers.pop();
  7494. return sto;
  7495. }
  7496. });
  7497. });
  7498. } catch (error) {
  7499. return Promise.reject(error);
  7500. }
  7501. }
  7502. }, {
  7503. key: "executeWhile",
  7504. value: function executeWhile(store, cmd) {
  7505. var outerRef = this;
  7506. try {
  7507. outerRef.loopTimers.push(Date.now());
  7508. outerRef.context.push(_context__WEBPACK_IMPORTED_MODULE_5__["Context"].BREAKABLE);
  7509. var $value = outerRef.evaluateExpression(store, cmd.expression);
  7510. return $value.then(function (vl) {
  7511. if (vl.type.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_6__["Types"].BOOLEAN)) {
  7512. if (vl.value) {
  7513. var $newStore = outerRef.executeCommands(store, cmd.commands);
  7514. return $newStore.then(function (sto) {
  7515. outerRef.context.pop();
  7516. if (sto.mode === _modes__WEBPACK_IMPORTED_MODULE_4__["Modes"].BREAK) {
  7517. outerRef.loopTimers.pop();
  7518. sto.mode = _modes__WEBPACK_IMPORTED_MODULE_4__["Modes"].RUN;
  7519. return sto;
  7520. }
  7521. for (var i = 0; i < outerRef.loopTimers.length; i++) {
  7522. var time = outerRef.loopTimers[i];
  7523. if (Date.now() - time >= IVProgProcessor.LOOP_TIMEOUT) {
  7524. outerRef.forceKill = true;
  7525. return Promise.reject(_error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_18__["ProcessorErrorFactory"].endless_loop_full(cmd.sourceInfo));
  7526. }
  7527. }
  7528. return outerRef.executeCommand(sto, cmd);
  7529. });
  7530. } else {
  7531. outerRef.context.pop();
  7532. outerRef.loopTimers.pop();
  7533. return store;
  7534. }
  7535. } else {
  7536. return Promise.reject(_error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_18__["ProcessorErrorFactory"].loop_condition_type_full(cmd.expression.toString(), cmd.sourceInfo));
  7537. }
  7538. });
  7539. } catch (error) {
  7540. return Promise.reject(error);
  7541. }
  7542. }
  7543. }, {
  7544. key: "executeIfThenElse",
  7545. value: function executeIfThenElse(store, cmd) {
  7546. var _this5 = this;
  7547. try {
  7548. var $value = this.evaluateExpression(store, cmd.condition);
  7549. return $value.then(function (vl) {
  7550. if (vl.type.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_6__["Types"].BOOLEAN)) {
  7551. if (vl.value) {
  7552. return _this5.executeCommands(store, cmd.ifTrue.commands);
  7553. } else if (cmd.ifFalse !== null) {
  7554. if (cmd.ifFalse instanceof _ast_commands___WEBPACK_IMPORTED_MODULE_10__["IfThenElse"]) {
  7555. return _this5.executeCommand(store, cmd.ifFalse);
  7556. } else {
  7557. return _this5.executeCommands(store, cmd.ifFalse.commands);
  7558. }
  7559. } else {
  7560. return Promise.resolve(store);
  7561. }
  7562. } else {
  7563. return Promise.reject(_error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_18__["ProcessorErrorFactory"].if_condition_type_full(cmd.condition.toString(), cmd.sourceInfo));
  7564. }
  7565. });
  7566. } catch (error) {
  7567. return Promise.reject(error);
  7568. }
  7569. }
  7570. }, {
  7571. key: "executeReturn",
  7572. value: function executeReturn(store, cmd) {
  7573. var _this6 = this;
  7574. try {
  7575. var funcType = store.applyStore('$').type;
  7576. var $value = this.evaluateExpression(store, cmd.expression);
  7577. var funcName = store.name === IVProgProcessor.MAIN_INTERNAL_ID ? _definedFunctions__WEBPACK_IMPORTED_MODULE_8__["LanguageDefinedFunction"].getMainFunctionName() : store.name;
  7578. return $value.then(function (vl) {
  7579. if (vl === null && funcType.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_6__["Types"].VOID)) {
  7580. store.mode = _modes__WEBPACK_IMPORTED_MODULE_4__["Modes"].RETURN;
  7581. return Promise.resolve(store);
  7582. }
  7583. if (vl === null || !funcType.isCompatible(vl.type)) {
  7584. var stringInfo = funcType.stringInfo();
  7585. var info = stringInfo[0];
  7586. return Promise.reject(_error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_18__["ProcessorErrorFactory"].invalid_return_type_full(funcName, info.type, info.dim, cmd.sourceInfo));
  7587. } else {
  7588. var realValue = _this6.parseStoreObjectValue(vl);
  7589. store.updateStore('$', realValue);
  7590. store.mode = _modes__WEBPACK_IMPORTED_MODULE_4__["Modes"].RETURN;
  7591. return Promise.resolve(store);
  7592. }
  7593. });
  7594. } catch (error) {
  7595. return Promise.reject(error);
  7596. }
  7597. }
  7598. }, {
  7599. key: "executeBreak",
  7600. value: function executeBreak(store, cmd) {
  7601. if (this.checkContext(_context__WEBPACK_IMPORTED_MODULE_5__["Context"].BREAKABLE)) {
  7602. store.mode = _modes__WEBPACK_IMPORTED_MODULE_4__["Modes"].BREAK;
  7603. return Promise.resolve(store);
  7604. } else {
  7605. return Promise.reject(_error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_18__["ProcessorErrorFactory"].unexpected_break_command_full(cmd.sourceInfo));
  7606. }
  7607. }
  7608. }, {
  7609. key: "executeAssign",
  7610. value: function executeAssign(store, cmd) {
  7611. var _this7 = this;
  7612. try {
  7613. var inStore = store.applyStore(cmd.id);
  7614. var $value = this.evaluateExpression(store, cmd.expression);
  7615. return $value.then(function (vl) {
  7616. var realValue = _this7.parseStoreObjectValue(vl);
  7617. if (!inStore.type.isCompatible(realValue.type)) {
  7618. if (_util_config__WEBPACK_IMPORTED_MODULE_16__["Config"].enable_type_casting && _store_store__WEBPACK_IMPORTED_MODULE_0__["Store"].canImplicitTypeCast(inStore.type, vl.type)) {
  7619. realValue = _store_store__WEBPACK_IMPORTED_MODULE_0__["Store"].doImplicitCasting(inStore.type, realValue);
  7620. } else {
  7621. var stringInfo = inStore.type.stringInfo();
  7622. var info = stringInfo[0];
  7623. return Promise.reject(_error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_18__["ProcessorErrorFactory"].incompatible_types_full(info.type, info.dim, cmd.sourceInfo));
  7624. }
  7625. }
  7626. store.updateStore(cmd.id, realValue);
  7627. return store;
  7628. });
  7629. } catch (error) {
  7630. return Promise.reject(error);
  7631. }
  7632. }
  7633. }, {
  7634. key: "executeArrayIndexAssign",
  7635. value: function executeArrayIndexAssign(store, cmd) {
  7636. var _this8 = this;
  7637. var mustBeArray = store.applyStore(cmd.id);
  7638. if (!(mustBeArray.type instanceof _typeSystem_compoundType__WEBPACK_IMPORTED_MODULE_14__["CompoundType"])) {
  7639. return Promise.reject(_error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_18__["ProcessorErrorFactory"].invalid_array_access_full(cmd.id, cmd.sourceInfo));
  7640. }
  7641. var line$ = this.evaluateExpression(store, cmd.line);
  7642. var column$ = this.evaluateExpression(store, cmd.column);
  7643. var value$ = this.evaluateExpression(store, cmd.expression);
  7644. return Promise.all([line$, column$, value$]).then(function (results) {
  7645. var lineSO = results[0];
  7646. if (!_typeSystem_types__WEBPACK_IMPORTED_MODULE_6__["Types"].INTEGER.isCompatible(lineSO.type)) {
  7647. return Promise.reject(_error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_18__["ProcessorErrorFactory"].array_dimension_not_int_full(cmd.sourceInfo));
  7648. }
  7649. var line = lineSO.number;
  7650. var columnSO = results[1];
  7651. var column = null;
  7652. if (columnSO !== null) {
  7653. if (!_typeSystem_types__WEBPACK_IMPORTED_MODULE_6__["Types"].INTEGER.isCompatible(columnSO.type)) {
  7654. return Promise.reject(_error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_18__["ProcessorErrorFactory"].array_dimension_not_int_full(cmd.sourceInfo));
  7655. }
  7656. column = columnSO.number;
  7657. }
  7658. var value = _this8.parseStoreObjectValue(results[2]);
  7659. if (line >= mustBeArray.lines) {
  7660. if (mustBeArray.isVector) {
  7661. return Promise.reject(_error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_18__["ProcessorErrorFactory"].vector_line_outbounds_full(cmd.id, line, mustBeArray.lines, cmd.sourceInfo));
  7662. } else {
  7663. return Promise.reject(_error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_18__["ProcessorErrorFactory"].matrix_line_outbounds_full(cmd.id, line, mustBeArray.lines, cmd.sourceInfo));
  7664. }
  7665. } else if (line < 0) {
  7666. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_18__["ProcessorErrorFactory"].array_dimension_not_positive_full(cmd.sourceInfo);
  7667. }
  7668. if (column !== null && mustBeArray.columns === null) {
  7669. return Promise.reject(_error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_18__["ProcessorErrorFactory"].vector_not_matrix_full(cmd.id, cmd.sourceInfo));
  7670. }
  7671. if (column !== null) {
  7672. if (column >= mustBeArray.columns) {
  7673. return Promise.reject(_error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_18__["ProcessorErrorFactory"].matrix_column_outbounds_full(cmd.id, column, mustBeArray.columns, cmd.sourceInfo));
  7674. } else if (column < 0) {
  7675. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_18__["ProcessorErrorFactory"].array_dimension_not_positive_full(cmd.sourceInfo);
  7676. }
  7677. }
  7678. var newArray = Object.assign(new _store_storeObjectArray__WEBPACK_IMPORTED_MODULE_2__["StoreObjectArray"](null, null, null), mustBeArray);
  7679. if (column !== null) {
  7680. if (value.type instanceof _typeSystem_compoundType__WEBPACK_IMPORTED_MODULE_14__["CompoundType"] || !newArray.type.canAccept(value.type)) {
  7681. var type = mustBeArray.type.innerType;
  7682. var stringInfo = type.stringInfo();
  7683. var info = stringInfo[0];
  7684. return Promise.reject(_error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_18__["ProcessorErrorFactory"].incompatible_types_full(info.type, info.dim, cmd.sourceInfo));
  7685. }
  7686. newArray.value[line].value[column] = value;
  7687. store.updateStore(cmd.id, newArray);
  7688. } else {
  7689. if (mustBeArray.columns !== null && value.type instanceof _typeSystem_compoundType__WEBPACK_IMPORTED_MODULE_14__["CompoundType"] || !newArray.type.canAccept(value.type)) {
  7690. var _type = mustBeArray.type;
  7691. var _stringInfo = _type.stringInfo();
  7692. var _info = _stringInfo[0];
  7693. var exp = cmd.expression.toString();
  7694. return Promise.reject(_error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_18__["ProcessorErrorFactory"].incompatible_types_array_full(exp, _info.type, _info.dim - 1, cmd.sourceInfo));
  7695. }
  7696. newArray.value[line] = value;
  7697. store.updateStore(cmd.id, newArray);
  7698. }
  7699. return store;
  7700. });
  7701. }
  7702. }, {
  7703. key: "executeDeclaration",
  7704. value: function executeDeclaration(store, cmd) {
  7705. try {
  7706. var $value = this.evaluateExpression(store, cmd.initial);
  7707. if (cmd instanceof _ast_commands___WEBPACK_IMPORTED_MODULE_10__["ArrayDeclaration"]) {
  7708. var $lines = this.evaluateExpression(store, cmd.lines);
  7709. var $columns = cmd.columns === null ? null : this.evaluateExpression(store, cmd.columns);
  7710. return Promise.all([$lines, $columns, $value]).then(function (values) {
  7711. var lineSO = values[0];
  7712. if (!_typeSystem_types__WEBPACK_IMPORTED_MODULE_6__["Types"].INTEGER.isCompatible(lineSO.type)) {
  7713. return Promise.reject(_error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_18__["ProcessorErrorFactory"].array_dimension_not_int_full(cmd.sourceInfo));
  7714. }
  7715. var line = lineSO.number;
  7716. if (line < 0) {
  7717. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_18__["ProcessorErrorFactory"].array_dimension_not_positive_full(cmd.sourceInfo);
  7718. }
  7719. var columnSO = values[1];
  7720. var column = null;
  7721. if (columnSO !== null) {
  7722. if (!_typeSystem_types__WEBPACK_IMPORTED_MODULE_6__["Types"].INTEGER.isCompatible(columnSO.type)) {
  7723. return Promise.reject(_error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_18__["ProcessorErrorFactory"].array_dimension_not_int_full(cmd.sourceInfo));
  7724. }
  7725. column = columnSO.number;
  7726. if (column < 0) {
  7727. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_18__["ProcessorErrorFactory"].array_dimension_not_positive_full(cmd.sourceInfo);
  7728. }
  7729. }
  7730. var value = values[2];
  7731. var temp = new _store_storeObjectArray__WEBPACK_IMPORTED_MODULE_2__["StoreObjectArray"](cmd.type, line, column, null);
  7732. store.insertStore(cmd.id, temp);
  7733. var realValue = value;
  7734. if (value !== null) {
  7735. if (value instanceof _store_storeObjectArrayAddress__WEBPACK_IMPORTED_MODULE_12__["StoreObjectArrayAddress"]) {
  7736. if (value.type instanceof _typeSystem_compoundType__WEBPACK_IMPORTED_MODULE_14__["CompoundType"]) {
  7737. realValue = Object.assign(new _store_storeObjectArray__WEBPACK_IMPORTED_MODULE_2__["StoreObjectArray"](null, null, null), value.refValue);
  7738. } else {
  7739. realValue = Object.assign(new _store_storeObject__WEBPACK_IMPORTED_MODULE_1__["StoreObject"](null, null), value.refValue);
  7740. }
  7741. }
  7742. } else {
  7743. realValue = new _store_storeObjectArray__WEBPACK_IMPORTED_MODULE_2__["StoreObjectArray"](cmd.type, line, column, []);
  7744. if (column !== null) {
  7745. for (var i = 0; i < line; i++) {
  7746. realValue.value.push(new _store_storeObjectArray__WEBPACK_IMPORTED_MODULE_2__["StoreObjectArray"](new _typeSystem_compoundType__WEBPACK_IMPORTED_MODULE_14__["CompoundType"](cmd.type.innerType, 1), column, null, []));
  7747. }
  7748. }
  7749. }
  7750. realValue.readOnly = cmd.isConst;
  7751. store.updateStore(cmd.id, realValue);
  7752. return store;
  7753. });
  7754. } else {
  7755. var temp = new _store_storeObject__WEBPACK_IMPORTED_MODULE_1__["StoreObject"](cmd.type, null);
  7756. store.insertStore(cmd.id, temp);
  7757. return $value.then(function (vl) {
  7758. var realValue = vl;
  7759. if (vl !== null) {
  7760. if (!vl.type.isCompatible(cmd.type)) {
  7761. if (_util_config__WEBPACK_IMPORTED_MODULE_16__["Config"].enable_type_casting && _store_store__WEBPACK_IMPORTED_MODULE_0__["Store"].canImplicitTypeCast(cmd.type, vl.type)) {
  7762. realValue = _store_store__WEBPACK_IMPORTED_MODULE_0__["Store"].doImplicitCasting(cmd.type, realValue);
  7763. } else {
  7764. var stringInfo = typeInfo.type.stringInfo();
  7765. var info = stringInfo[0];
  7766. return Promise.reject(_error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_18__["ProcessorErrorFactory"].incompatible_types_full(info.type, info.dim, cmd.sourceInfo));
  7767. }
  7768. }
  7769. if (vl instanceof _store_storeObjectArrayAddress__WEBPACK_IMPORTED_MODULE_12__["StoreObjectArrayAddress"]) {
  7770. if (vl.type instanceof _typeSystem_compoundType__WEBPACK_IMPORTED_MODULE_14__["CompoundType"]) {
  7771. return Promise.reject(new Error("!!!Critical Error: Compatibility check failed, a Type accepts a CompoundType"));
  7772. } else {
  7773. realValue = Object.assign(new _store_storeObject__WEBPACK_IMPORTED_MODULE_1__["StoreObject"](null, null), vl.refValue);
  7774. }
  7775. }
  7776. } else {
  7777. realValue = new _store_storeObject__WEBPACK_IMPORTED_MODULE_1__["StoreObject"](cmd.type, 0);
  7778. }
  7779. realValue.readOnly = cmd.isConst;
  7780. store.updateStore(cmd.id, realValue);
  7781. return store;
  7782. });
  7783. }
  7784. } catch (e) {
  7785. return Promise.reject(e);
  7786. }
  7787. }
  7788. }, {
  7789. key: "evaluateExpression",
  7790. value: function evaluateExpression(store, exp) {
  7791. if (exp instanceof _ast_expressions___WEBPACK_IMPORTED_MODULE_11__["UnaryApp"]) {
  7792. return this.evaluateUnaryApp(store, exp);
  7793. } else if (exp instanceof _ast_expressions___WEBPACK_IMPORTED_MODULE_11__["InfixApp"]) {
  7794. return this.evaluateInfixApp(store, exp);
  7795. } else if (exp instanceof _ast_expressions___WEBPACK_IMPORTED_MODULE_11__["ArrayAccess"]) {
  7796. return this.evaluateArrayAccess(store, exp);
  7797. } else if (exp instanceof _ast_expressions___WEBPACK_IMPORTED_MODULE_11__["VariableLiteral"]) {
  7798. return this.evaluateVariableLiteral(store, exp);
  7799. } else if (exp instanceof _ast_expressions___WEBPACK_IMPORTED_MODULE_11__["IntLiteral"]) {
  7800. return this.evaluateLiteral(store, exp);
  7801. } else if (exp instanceof _ast_expressions___WEBPACK_IMPORTED_MODULE_11__["RealLiteral"]) {
  7802. return this.evaluateLiteral(store, exp);
  7803. } else if (exp instanceof _ast_expressions___WEBPACK_IMPORTED_MODULE_11__["BoolLiteral"]) {
  7804. return this.evaluateLiteral(store, exp);
  7805. } else if (exp instanceof _ast_expressions___WEBPACK_IMPORTED_MODULE_11__["StringLiteral"]) {
  7806. return this.evaluateLiteral(store, exp);
  7807. } else if (exp instanceof _ast_expressions___WEBPACK_IMPORTED_MODULE_11__["ArrayLiteral"]) {
  7808. return this.evaluateArrayLiteral(store, exp);
  7809. } else if (exp instanceof _ast_expressions___WEBPACK_IMPORTED_MODULE_11__["FunctionCall"]) {
  7810. return this.evaluateFunctionCall(store, exp);
  7811. }
  7812. return Promise.resolve(null);
  7813. }
  7814. }, {
  7815. key: "evaluateFunctionCall",
  7816. value: function evaluateFunctionCall(store, exp) {
  7817. if (exp.isMainCall) {
  7818. return Promise.reject(_error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_18__["ProcessorErrorFactory"].void_in_expression_full(_definedFunctions__WEBPACK_IMPORTED_MODULE_8__["LanguageDefinedFunction"].getMainFunctionName(), exp.sourceInfo));
  7819. }
  7820. var func = this.findFunction(exp.id);
  7821. if (_typeSystem_types__WEBPACK_IMPORTED_MODULE_6__["Types"].VOID.isCompatible(func.returnType)) {
  7822. return Promise.reject(_error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_18__["ProcessorErrorFactory"].void_in_expression_full(exp.id, exp.sourceInfo));
  7823. }
  7824. var $newStore = this.runFunction(func, exp.actualParameters, store);
  7825. return $newStore.then(function (sto) {
  7826. if (sto.mode !== _modes__WEBPACK_IMPORTED_MODULE_4__["Modes"].RETURN) {
  7827. return Promise.reject(new Error("The function that was called did not had a return command: " + exp.id));
  7828. }
  7829. var val = sto.applyStore('$');
  7830. if (val instanceof _store_storeObjectArray__WEBPACK_IMPORTED_MODULE_2__["StoreObjectArray"]) {
  7831. return Promise.resolve(Object.assign(new _store_storeObjectArray__WEBPACK_IMPORTED_MODULE_2__["StoreObjectArray"](null, null, null, null, null), val));
  7832. } else {
  7833. return Promise.resolve(Object.assign(new _store_storeObject__WEBPACK_IMPORTED_MODULE_1__["StoreObject"](null, null), val));
  7834. }
  7835. });
  7836. }
  7837. }, {
  7838. key: "evaluateArrayLiteral",
  7839. value: function evaluateArrayLiteral(store, exp) {
  7840. var errorHelperFunction = function errorHelperFunction(validationResult, exp) {
  7841. var errorCode = validationResult[0];
  7842. switch (errorCode) {
  7843. case _store_storeObjectArray__WEBPACK_IMPORTED_MODULE_2__["StoreObjectArray"].WRONG_COLUMN_NUMBER:
  7844. {
  7845. var columnValue = validationResult[1];
  7846. return Promise.reject(_error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_18__["ProcessorErrorFactory"].invalid_array_literal_column_full(arr.columns, columnValue, exp.sourceInfo));
  7847. }
  7848. case _store_storeObjectArray__WEBPACK_IMPORTED_MODULE_2__["StoreObjectArray"].WRONG_LINE_NUMBER:
  7849. {
  7850. var lineValue = validationResult[1];
  7851. return Promise.reject(_error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_18__["ProcessorErrorFactory"].invalid_array_literal_line_full(arr.lines, lineValue, exp.sourceInfo));
  7852. }
  7853. case _store_storeObjectArray__WEBPACK_IMPORTED_MODULE_2__["StoreObjectArray"].WRONG_TYPE:
  7854. {
  7855. var line = null;
  7856. var strExp = null;
  7857. if (validationResult.length > 2) {
  7858. line = validationResult[1];
  7859. var column = validationResult[2];
  7860. strExp = exp.value[line].value[column].toString();
  7861. } else {
  7862. line = validationResult[1];
  7863. strExp = exp.value[line].toString();
  7864. }
  7865. return Promise.reject(_error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_18__["ProcessorErrorFactory"].invalid_array_literal_type_full(strExp, exp.sourceInfo));
  7866. }
  7867. }
  7868. };
  7869. if (!exp.isVector) {
  7870. var $matrix = this.evaluateMatrix(store, exp.value);
  7871. return $matrix.then(function (list) {
  7872. var type = new _typeSystem_compoundType__WEBPACK_IMPORTED_MODULE_14__["CompoundType"](list[0].type.innerType, 2);
  7873. var arr = new _store_storeObjectArray__WEBPACK_IMPORTED_MODULE_2__["StoreObjectArray"](type, list.length, list[0].lines, list);
  7874. var checkResult = arr.isValid;
  7875. if (checkResult.length == 0) return Promise.resolve(arr);else {
  7876. return errorHelperFunction(checkResult, exp);
  7877. }
  7878. });
  7879. } else {
  7880. return this.evaluateVector(store, exp.value).then(function (list) {
  7881. var type = new _typeSystem_compoundType__WEBPACK_IMPORTED_MODULE_14__["CompoundType"](list[0].type, 1);
  7882. var stoArray = new _store_storeObjectArray__WEBPACK_IMPORTED_MODULE_2__["StoreObjectArray"](type, list.length, null, list);
  7883. var checkResult = stoArray.isValid;
  7884. if (checkResult.length == 0) return Promise.resolve(stoArray);else {
  7885. return errorHelperFunction(checkResult, exp);
  7886. }
  7887. });
  7888. }
  7889. }
  7890. }, {
  7891. key: "evaluateVector",
  7892. value: function evaluateVector(store, exps) {
  7893. var _this9 = this;
  7894. return Promise.all(exps.map(function (exp) {
  7895. return _this9.evaluateExpression(store, exp);
  7896. }));
  7897. }
  7898. }, {
  7899. key: "evaluateMatrix",
  7900. value: function evaluateMatrix(store, exps) {
  7901. var _this10 = this;
  7902. return Promise.all(exps.map(function (vector) {
  7903. var $vector = _this10.evaluateVector(store, vector.value);
  7904. return $vector.then(function (list) {
  7905. var type = new _typeSystem_compoundType__WEBPACK_IMPORTED_MODULE_14__["CompoundType"](list[0].type, 1);
  7906. return new _store_storeObjectArray__WEBPACK_IMPORTED_MODULE_2__["StoreObjectArray"](type, list.length, null, list);
  7907. });
  7908. }));
  7909. }
  7910. }, {
  7911. key: "evaluateLiteral",
  7912. value: function evaluateLiteral(_, exp) {
  7913. return Promise.resolve(new _store_storeObject__WEBPACK_IMPORTED_MODULE_1__["StoreObject"](exp.type, exp.value));
  7914. }
  7915. }, {
  7916. key: "evaluateVariableLiteral",
  7917. value: function evaluateVariableLiteral(store, exp) {
  7918. try {
  7919. var val = store.applyStore(exp.id);
  7920. if (val instanceof _store_storeObjectArray__WEBPACK_IMPORTED_MODULE_2__["StoreObjectArray"]) {
  7921. return Promise.resolve(Object.assign(new _store_storeObjectArray__WEBPACK_IMPORTED_MODULE_2__["StoreObjectArray"](null, null, null, null), val));
  7922. } else {
  7923. return Promise.resolve(Object.assign(new _store_storeObject__WEBPACK_IMPORTED_MODULE_1__["StoreObject"](null, null), val));
  7924. }
  7925. } catch (error) {
  7926. return Promise.reject(error);
  7927. }
  7928. }
  7929. }, {
  7930. key: "evaluateArrayAccess",
  7931. value: function evaluateArrayAccess(store, exp) {
  7932. var mustBeArray = store.applyStore(exp.id);
  7933. if (!(mustBeArray.type instanceof _typeSystem_compoundType__WEBPACK_IMPORTED_MODULE_14__["CompoundType"])) {
  7934. return Promise.reject(_error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_18__["ProcessorErrorFactory"].invalid_array_access_full(exp.id, exp.sourceInfo));
  7935. }
  7936. var $line = this.evaluateExpression(store, exp.line);
  7937. var $column = this.evaluateExpression(store, exp.column);
  7938. return Promise.all([$line, $column]).then(function (values) {
  7939. var lineSO = values[0];
  7940. var columnSO = values[1];
  7941. if (!_typeSystem_types__WEBPACK_IMPORTED_MODULE_6__["Types"].INTEGER.isCompatible(lineSO.type)) {
  7942. return Promise.reject(_error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_18__["ProcessorErrorFactory"].array_dimension_not_int_full(exp.sourceInfo));
  7943. }
  7944. var line = lineSO.number;
  7945. var column = null;
  7946. if (columnSO !== null) {
  7947. if (!_typeSystem_types__WEBPACK_IMPORTED_MODULE_6__["Types"].INTEGER.isCompatible(columnSO.type)) {
  7948. return Promise.reject(_error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_18__["ProcessorErrorFactory"].array_dimension_not_int_full(exp.sourceInfo));
  7949. }
  7950. column = columnSO.number;
  7951. }
  7952. if (line >= mustBeArray.lines) {
  7953. if (mustBeArray.isVector) {
  7954. return Promise.reject(_error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_18__["ProcessorErrorFactory"].vector_line_outbounds_full(exp.id, line, mustBeArray.lines, exp.sourceInfo));
  7955. } else {
  7956. return Promise.reject(_error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_18__["ProcessorErrorFactory"].matrix_line_outbounds_full(exp.id, line, mustBeArray.lines, exp.sourceInfo));
  7957. }
  7958. } else if (line < 0) {
  7959. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_18__["ProcessorErrorFactory"].array_dimension_not_positive_full(exp.sourceInfo);
  7960. }
  7961. if (column !== null && mustBeArray.columns === null) {
  7962. return Promise.reject(_error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_18__["ProcessorErrorFactory"].vector_not_matrix_full(exp.id, exp.sourceInfo));
  7963. }
  7964. if (column !== null) {
  7965. if (column >= mustBeArray.columns) {
  7966. return Promise.reject(_error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_18__["ProcessorErrorFactory"].matrix_column_outbounds_full(exp.id, column, mustBeArray.columns, exp.sourceInfo));
  7967. } else if (column < 0) {
  7968. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_18__["ProcessorErrorFactory"].array_dimension_not_positive_full(exp.sourceInfo);
  7969. }
  7970. }
  7971. return Promise.resolve(new _store_storeObjectArrayAddress__WEBPACK_IMPORTED_MODULE_12__["StoreObjectArrayAddress"](mustBeArray.id, line, column, store));
  7972. });
  7973. }
  7974. }, {
  7975. key: "evaluateUnaryApp",
  7976. value: function evaluateUnaryApp(store, unaryApp) {
  7977. var $left = this.evaluateExpression(store, unaryApp.left);
  7978. return $left.then(function (left) {
  7979. var resultType = Object(_compatibilityTable__WEBPACK_IMPORTED_MODULE_9__["resultTypeAfterUnaryOp"])(unaryApp.op, left.type);
  7980. if (_typeSystem_types__WEBPACK_IMPORTED_MODULE_6__["Types"].UNDEFINED.isCompatible(resultType)) {
  7981. var stringInfo = left.type.stringInfo();
  7982. var info = stringInfo[0];
  7983. return Promise.reject(_error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_18__["ProcessorErrorFactory"].invalid_unary_op_full(unaryApp.op, info.type, info.dim, unaryApp.sourceInfo));
  7984. }
  7985. switch (unaryApp.op.ord) {
  7986. case _ast_operators__WEBPACK_IMPORTED_MODULE_7__["Operators"].ADD.ord:
  7987. return new _store_storeObject__WEBPACK_IMPORTED_MODULE_1__["StoreObject"](resultType, left.value);
  7988. case _ast_operators__WEBPACK_IMPORTED_MODULE_7__["Operators"].SUB.ord:
  7989. return new _store_storeObject__WEBPACK_IMPORTED_MODULE_1__["StoreObject"](resultType, left.value.negated());
  7990. case _ast_operators__WEBPACK_IMPORTED_MODULE_7__["Operators"].NOT.ord:
  7991. return new _store_storeObject__WEBPACK_IMPORTED_MODULE_1__["StoreObject"](resultType, !left.value);
  7992. default:
  7993. return Promise.reject(new _error_runtimeError__WEBPACK_IMPORTED_MODULE_19__["RuntimeError"]('!!!Critical Invalid UnaryApp ' + unaryApp.op));
  7994. }
  7995. });
  7996. }
  7997. }, {
  7998. key: "evaluateInfixApp",
  7999. value: function evaluateInfixApp(store, infixApp) {
  8000. var $left = this.evaluateExpression(store, infixApp.left);
  8001. var $right = this.evaluateExpression(store, infixApp.right);
  8002. return Promise.all([$left, $right]).then(function (values) {
  8003. var shouldImplicitCast = false;
  8004. var left = values[0];
  8005. var right = values[1];
  8006. var resultType = Object(_compatibilityTable__WEBPACK_IMPORTED_MODULE_9__["resultTypeAfterInfixOp"])(infixApp.op, left.type, right.type);
  8007. if (_typeSystem_types__WEBPACK_IMPORTED_MODULE_6__["Types"].UNDEFINED.isCompatible(resultType)) {
  8008. if (_util_config__WEBPACK_IMPORTED_MODULE_16__["Config"].enable_type_casting && _store_store__WEBPACK_IMPORTED_MODULE_0__["Store"].canImplicitTypeCast(left.type, right.type)) {
  8009. shouldImplicitCast = true;
  8010. } else {
  8011. var stringInfoLeft = left.type.stringInfo();
  8012. var infoLeft = stringInfoLeft[0];
  8013. var stringInfoRight = right.type.stringInfo();
  8014. var infoRight = stringInfoRight[0];
  8015. return Promise.reject(_error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_18__["ProcessorErrorFactory"].invalid_infix_op_full(infixApp.op, infoLeft.type, infoLeft.dim, infoRight.type, infoRight.dim, infixApp.sourceInfo));
  8016. }
  8017. }
  8018. var result = null;
  8019. switch (infixApp.op.ord) {
  8020. case _ast_operators__WEBPACK_IMPORTED_MODULE_7__["Operators"].ADD.ord:
  8021. {
  8022. if (_typeSystem_types__WEBPACK_IMPORTED_MODULE_6__["Types"].STRING.isCompatible(left.type)) {
  8023. var rightStr = Object(_typeSystem_parsers__WEBPACK_IMPORTED_MODULE_15__["convertToString"])(right.value, right.type);
  8024. return new _store_storeObject__WEBPACK_IMPORTED_MODULE_1__["StoreObject"](resultType, left.value + rightStr);
  8025. } else if (_typeSystem_types__WEBPACK_IMPORTED_MODULE_6__["Types"].STRING.isCompatible(right.type)) {
  8026. var leftStr = Object(_typeSystem_parsers__WEBPACK_IMPORTED_MODULE_15__["convertToString"])(left.value, left.type);
  8027. return new _store_storeObject__WEBPACK_IMPORTED_MODULE_1__["StoreObject"](resultType, leftStr + right.value);
  8028. } else {
  8029. return new _store_storeObject__WEBPACK_IMPORTED_MODULE_1__["StoreObject"](resultType, left.value.plus(right.value));
  8030. }
  8031. }
  8032. case _ast_operators__WEBPACK_IMPORTED_MODULE_7__["Operators"].SUB.ord:
  8033. return new _store_storeObject__WEBPACK_IMPORTED_MODULE_1__["StoreObject"](resultType, left.value.minus(right.value));
  8034. case _ast_operators__WEBPACK_IMPORTED_MODULE_7__["Operators"].MULT.ord:
  8035. {
  8036. result = left.value.times(right.value);
  8037. if (result.dp() > _util_config__WEBPACK_IMPORTED_MODULE_16__["Config"].decimalPlaces) {
  8038. result = new decimal_js__WEBPACK_IMPORTED_MODULE_17___default.a(result.toFixed(_util_config__WEBPACK_IMPORTED_MODULE_16__["Config"].decimalPlaces));
  8039. }
  8040. return new _store_storeObject__WEBPACK_IMPORTED_MODULE_1__["StoreObject"](resultType, result);
  8041. }
  8042. case _ast_operators__WEBPACK_IMPORTED_MODULE_7__["Operators"].DIV.ord:
  8043. {
  8044. if (_typeSystem_types__WEBPACK_IMPORTED_MODULE_6__["Types"].INTEGER.isCompatible(resultType)) result = left.value.divToInt(right.value);else result = left.value.div(right.value);
  8045. if (result.dp() > _util_config__WEBPACK_IMPORTED_MODULE_16__["Config"].decimalPlaces) {
  8046. result = new decimal_js__WEBPACK_IMPORTED_MODULE_17___default.a(result.toFixed(_util_config__WEBPACK_IMPORTED_MODULE_16__["Config"].decimalPlaces));
  8047. }
  8048. return new _store_storeObject__WEBPACK_IMPORTED_MODULE_1__["StoreObject"](resultType, result);
  8049. }
  8050. case _ast_operators__WEBPACK_IMPORTED_MODULE_7__["Operators"].MOD.ord:
  8051. {
  8052. var leftValue = left.value;
  8053. var rightValue = right.value;
  8054. if (shouldImplicitCast) {
  8055. resultType = _typeSystem_types__WEBPACK_IMPORTED_MODULE_6__["Types"].INTEGER;
  8056. leftValue = leftValue.trunc();
  8057. rightValue = rightValue.trunc();
  8058. }
  8059. result = leftValue.modulo(rightValue);
  8060. if (result.dp() > _util_config__WEBPACK_IMPORTED_MODULE_16__["Config"].decimalPlaces) {
  8061. result = new decimal_js__WEBPACK_IMPORTED_MODULE_17___default.a(result.toFixed(_util_config__WEBPACK_IMPORTED_MODULE_16__["Config"].decimalPlaces));
  8062. }
  8063. return new _store_storeObject__WEBPACK_IMPORTED_MODULE_1__["StoreObject"](resultType, result);
  8064. }
  8065. case _ast_operators__WEBPACK_IMPORTED_MODULE_7__["Operators"].GT.ord:
  8066. {
  8067. var _leftValue = left.value;
  8068. var _rightValue = right.value;
  8069. if (_typeSystem_types__WEBPACK_IMPORTED_MODULE_6__["Types"].STRING.isCompatible(left.type)) {
  8070. result = left.value.length > right.value.length;
  8071. } else {
  8072. if (shouldImplicitCast) {
  8073. resultType = _typeSystem_types__WEBPACK_IMPORTED_MODULE_6__["Types"].BOOLEAN;
  8074. _leftValue = _leftValue.trunc();
  8075. _rightValue = _rightValue.trunc();
  8076. }
  8077. result = _leftValue.gt(_rightValue);
  8078. }
  8079. return new _store_storeObject__WEBPACK_IMPORTED_MODULE_1__["StoreObject"](resultType, result);
  8080. }
  8081. case _ast_operators__WEBPACK_IMPORTED_MODULE_7__["Operators"].GE.ord:
  8082. {
  8083. var _leftValue2 = left.value;
  8084. var _rightValue2 = right.value;
  8085. if (_typeSystem_types__WEBPACK_IMPORTED_MODULE_6__["Types"].STRING.isCompatible(left.type)) {
  8086. result = left.value.length >= right.value.length;
  8087. } else {
  8088. if (shouldImplicitCast) {
  8089. resultType = _typeSystem_types__WEBPACK_IMPORTED_MODULE_6__["Types"].BOOLEAN;
  8090. _leftValue2 = _leftValue2.trunc();
  8091. _rightValue2 = _rightValue2.trunc();
  8092. }
  8093. result = _leftValue2.gte(_rightValue2);
  8094. }
  8095. return new _store_storeObject__WEBPACK_IMPORTED_MODULE_1__["StoreObject"](resultType, result);
  8096. }
  8097. case _ast_operators__WEBPACK_IMPORTED_MODULE_7__["Operators"].LT.ord:
  8098. {
  8099. var _leftValue3 = left.value;
  8100. var _rightValue3 = right.value;
  8101. if (_typeSystem_types__WEBPACK_IMPORTED_MODULE_6__["Types"].STRING.isCompatible(left.type)) {
  8102. result = left.value.length < right.value.length;
  8103. } else {
  8104. if (shouldImplicitCast) {
  8105. resultType = _typeSystem_types__WEBPACK_IMPORTED_MODULE_6__["Types"].BOOLEAN;
  8106. _leftValue3 = _leftValue3.trunc();
  8107. _rightValue3 = _rightValue3.trunc();
  8108. }
  8109. result = _leftValue3.lt(_rightValue3);
  8110. }
  8111. return new _store_storeObject__WEBPACK_IMPORTED_MODULE_1__["StoreObject"](resultType, result);
  8112. }
  8113. case _ast_operators__WEBPACK_IMPORTED_MODULE_7__["Operators"].LE.ord:
  8114. {
  8115. var _leftValue4 = left.value;
  8116. var _rightValue4 = right.value;
  8117. if (_typeSystem_types__WEBPACK_IMPORTED_MODULE_6__["Types"].STRING.isCompatible(left.type)) {
  8118. result = left.value.length <= right.value.length;
  8119. } else {
  8120. if (shouldImplicitCast) {
  8121. resultType = _typeSystem_types__WEBPACK_IMPORTED_MODULE_6__["Types"].BOOLEAN;
  8122. _leftValue4 = _leftValue4.trunc();
  8123. _rightValue4 = _rightValue4.trunc();
  8124. }
  8125. result = _leftValue4.lte(_rightValue4);
  8126. }
  8127. return new _store_storeObject__WEBPACK_IMPORTED_MODULE_1__["StoreObject"](resultType, result);
  8128. }
  8129. case _ast_operators__WEBPACK_IMPORTED_MODULE_7__["Operators"].EQ.ord:
  8130. {
  8131. var _leftValue5 = left.value;
  8132. var _rightValue5 = right.value;
  8133. if (_typeSystem_types__WEBPACK_IMPORTED_MODULE_6__["Types"].INTEGER.isCompatible(left.type) || _typeSystem_types__WEBPACK_IMPORTED_MODULE_6__["Types"].REAL.isCompatible(left.type)) {
  8134. if (shouldImplicitCast) {
  8135. resultType = _typeSystem_types__WEBPACK_IMPORTED_MODULE_6__["Types"].BOOLEAN;
  8136. _leftValue5 = _leftValue5.trunc();
  8137. _rightValue5 = _rightValue5.trunc();
  8138. }
  8139. result = _leftValue5.eq(_rightValue5);
  8140. } else {
  8141. result = left.value === right.value;
  8142. }
  8143. return new _store_storeObject__WEBPACK_IMPORTED_MODULE_1__["StoreObject"](resultType, result);
  8144. }
  8145. case _ast_operators__WEBPACK_IMPORTED_MODULE_7__["Operators"].NEQ.ord:
  8146. {
  8147. var _leftValue6 = left.value;
  8148. var _rightValue6 = right.value;
  8149. if (_typeSystem_types__WEBPACK_IMPORTED_MODULE_6__["Types"].INTEGER.isCompatible(left.type) || _typeSystem_types__WEBPACK_IMPORTED_MODULE_6__["Types"].REAL.isCompatible(left.type)) {
  8150. if (shouldImplicitCast) {
  8151. resultType = _typeSystem_types__WEBPACK_IMPORTED_MODULE_6__["Types"].BOOLEAN;
  8152. _leftValue6 = _leftValue6.trunc();
  8153. _rightValue6 = _rightValue6.trunc();
  8154. }
  8155. result = !_leftValue6.eq(_rightValue6);
  8156. } else {
  8157. result = left.value !== right.value;
  8158. }
  8159. return new _store_storeObject__WEBPACK_IMPORTED_MODULE_1__["StoreObject"](resultType, result);
  8160. }
  8161. case _ast_operators__WEBPACK_IMPORTED_MODULE_7__["Operators"].AND.ord:
  8162. return new _store_storeObject__WEBPACK_IMPORTED_MODULE_1__["StoreObject"](resultType, left.value && right.value);
  8163. case _ast_operators__WEBPACK_IMPORTED_MODULE_7__["Operators"].OR.ord:
  8164. return new _store_storeObject__WEBPACK_IMPORTED_MODULE_1__["StoreObject"](resultType, left.value || right.value);
  8165. default:
  8166. return Promise.reject(new _error_runtimeError__WEBPACK_IMPORTED_MODULE_19__["RuntimeError"]('!!!Critical Invalid InfixApp ' + infixApp.op));
  8167. }
  8168. });
  8169. }
  8170. }, {
  8171. key: "parseStoreObjectValue",
  8172. value: function parseStoreObjectValue(vl) {
  8173. var realValue = vl;
  8174. if (vl instanceof _store_storeObjectArrayAddress__WEBPACK_IMPORTED_MODULE_12__["StoreObjectArrayAddress"]) {
  8175. if (vl.type instanceof _typeSystem_compoundType__WEBPACK_IMPORTED_MODULE_14__["CompoundType"]) {
  8176. switch (vl.type.dimensions) {
  8177. case 1:
  8178. {
  8179. realValue = new _store_storeObjectArray__WEBPACK_IMPORTED_MODULE_2__["StoreObjectArray"](vl.type, vl.value);
  8180. break;
  8181. }
  8182. default:
  8183. {
  8184. throw new _error_runtimeError__WEBPACK_IMPORTED_MODULE_19__["RuntimeError"]("Three dimensional array address...");
  8185. }
  8186. }
  8187. } else {
  8188. realValue = new _store_storeObject__WEBPACK_IMPORTED_MODULE_1__["StoreObject"](vl.type, vl.value);
  8189. }
  8190. }
  8191. return realValue;
  8192. }
  8193. }]);
  8194. return IVProgProcessor;
  8195. }();
  8196. /***/ }),
  8197. /***/ "./js/processor/lib/arrays.js":
  8198. /*!************************************!*\
  8199. !*** ./js/processor/lib/arrays.js ***!
  8200. \************************************/
  8201. /*! exports provided: createNumElementsFun, createMatrixLinesFun, createMatrixColumnsFun */
  8202. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  8203. "use strict";
  8204. __webpack_require__.r(__webpack_exports__);
  8205. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createNumElementsFun", function() { return createNumElementsFun; });
  8206. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createMatrixLinesFun", function() { return createMatrixLinesFun; });
  8207. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createMatrixColumnsFun", function() { return createMatrixColumnsFun; });
  8208. /* harmony import */ var _store_storeObject__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../store/storeObject */ "./js/processor/store/storeObject.js");
  8209. /* harmony import */ var _ast_commands__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./../../ast/commands */ "./js/ast/commands/index.js");
  8210. /* harmony import */ var _typeSystem_types__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./../../typeSystem/types */ "./js/typeSystem/types.js");
  8211. /* harmony import */ var _typeSystem_parsers__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./../../typeSystem/parsers */ "./js/typeSystem/parsers.js");
  8212. /* harmony import */ var _typeSystem_compoundType__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../typeSystem/compoundType */ "./js/typeSystem/compoundType.js");
  8213. /* harmony import */ var _modes__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../modes */ "./js/processor/modes.js");
  8214. /**
  8215. * num_elements
  8216. * matrix_lines
  8217. * matrix_columns
  8218. */
  8219. function createNumElementsFun() {
  8220. var numElementsFun = function numElementsFun(sto, _) {
  8221. var vector = sto.applyStore("vector");
  8222. var temp = new _store_storeObject__WEBPACK_IMPORTED_MODULE_0__["StoreObject"](_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].INTEGER, Object(_typeSystem_parsers__WEBPACK_IMPORTED_MODULE_3__["toInt"])(vector.lines));
  8223. sto.mode = _modes__WEBPACK_IMPORTED_MODULE_5__["Modes"].RETURN;
  8224. return Promise.resolve(sto.updateStore("$", temp));
  8225. };
  8226. var block = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["CommandBlock"]([], [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["SysCall"](numElementsFun)]);
  8227. var func = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["Function"]('$numElements', _typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].INTEGER, [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["FormalParameter"](new _typeSystem_compoundType__WEBPACK_IMPORTED_MODULE_4__["CompoundType"](_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].ALL, 1), 'vector', false)], block);
  8228. return func;
  8229. }
  8230. function createMatrixLinesFun() {
  8231. var matrixLinesFun = function matrixLinesFun(sto, _) {
  8232. var matrix = sto.applyStore("matrix");
  8233. var temp = new _store_storeObject__WEBPACK_IMPORTED_MODULE_0__["StoreObject"](_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].INTEGER, Object(_typeSystem_parsers__WEBPACK_IMPORTED_MODULE_3__["toInt"])(matrix.lines));
  8234. sto.mode = _modes__WEBPACK_IMPORTED_MODULE_5__["Modes"].RETURN;
  8235. return Promise.resolve(sto.updateStore("$", temp));
  8236. };
  8237. var block = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["CommandBlock"]([], [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["SysCall"](matrixLinesFun)]);
  8238. var func = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["Function"]('$matrixLines', _typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].INTEGER, [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["FormalParameter"](new _typeSystem_compoundType__WEBPACK_IMPORTED_MODULE_4__["CompoundType"](_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].ALL, 2), 'matrix', false)], block);
  8239. return func;
  8240. }
  8241. function createMatrixColumnsFun() {
  8242. var matrixColumnsFun = function matrixColumnsFun(sto, _) {
  8243. var matrix = sto.applyStore("matrix");
  8244. var temp = new _store_storeObject__WEBPACK_IMPORTED_MODULE_0__["StoreObject"](_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].INTEGER, Object(_typeSystem_parsers__WEBPACK_IMPORTED_MODULE_3__["toInt"])(matrix.columns));
  8245. sto.mode = _modes__WEBPACK_IMPORTED_MODULE_5__["Modes"].RETURN;
  8246. return Promise.resolve(sto.updateStore("$", temp));
  8247. };
  8248. var block = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["CommandBlock"]([], [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["SysCall"](matrixColumnsFun)]);
  8249. var func = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["Function"]('$matrixColumns', _typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].INTEGER, [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["FormalParameter"](new _typeSystem_compoundType__WEBPACK_IMPORTED_MODULE_4__["CompoundType"](_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].ALL, 2), 'matrix', false)], block);
  8250. return func;
  8251. }
  8252. /***/ }),
  8253. /***/ "./js/processor/lib/io.js":
  8254. /*!********************************!*\
  8255. !*** ./js/processor/lib/io.js ***!
  8256. \********************************/
  8257. /*! exports provided: createOutputFun, createInputFun */
  8258. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  8259. "use strict";
  8260. __webpack_require__.r(__webpack_exports__);
  8261. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createOutputFun", function() { return createOutputFun; });
  8262. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createInputFun", function() { return createInputFun; });
  8263. /* harmony import */ var _store_storeObject__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./../store/storeObject */ "./js/processor/store/storeObject.js");
  8264. /* harmony import */ var _ast_commands__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./../../ast/commands */ "./js/ast/commands/index.js");
  8265. /* harmony import */ var _typeSystem_parsers__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./../../typeSystem/parsers */ "./js/typeSystem/parsers.js");
  8266. /* harmony import */ var _typeSystem_types__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./../../typeSystem/types */ "./js/typeSystem/types.js");
  8267. function createOutputFun() {
  8268. var writeFunction = function writeFunction(store, _) {
  8269. var val = store.applyStore('p1');
  8270. this.output.sendOutput(Object(_typeSystem_parsers__WEBPACK_IMPORTED_MODULE_2__["convertToString"])(val.value, val.type));
  8271. return Promise.resolve(store);
  8272. };
  8273. var block = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["CommandBlock"]([], [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["SysCall"](writeFunction)]);
  8274. var func = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["Function"]('$write', _typeSystem_types__WEBPACK_IMPORTED_MODULE_3__["Types"].VOID, [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["FormalParameter"](_typeSystem_types__WEBPACK_IMPORTED_MODULE_3__["Types"].ALL, 'p1', false)], block);
  8275. return func;
  8276. }
  8277. function createInputFun() {
  8278. var readFunction = function readFunction(store, _) {
  8279. var _this = this;
  8280. var request = new Promise(function (resolve, _) {
  8281. _this.input.requestInput(resolve);
  8282. });
  8283. return request.then(function (text) {
  8284. var typeToConvert = store.applyStore('p1').type;
  8285. var stoObj = null;
  8286. if (typeToConvert.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_3__["Types"].INTEGER)) {
  8287. var val = Object(_typeSystem_parsers__WEBPACK_IMPORTED_MODULE_2__["toInt"])(text);
  8288. stoObj = new _store_storeObject__WEBPACK_IMPORTED_MODULE_0__["StoreObject"](_typeSystem_types__WEBPACK_IMPORTED_MODULE_3__["Types"].INTEGER, val.trunc());
  8289. } else if (typeToConvert.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_3__["Types"].REAL)) {
  8290. stoObj = new _store_storeObject__WEBPACK_IMPORTED_MODULE_0__["StoreObject"](_typeSystem_types__WEBPACK_IMPORTED_MODULE_3__["Types"].REAL, Object(_typeSystem_parsers__WEBPACK_IMPORTED_MODULE_2__["toReal"])(text));
  8291. } else if (typeToConvert.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_3__["Types"].BOOLEAN)) {
  8292. stoObj = new _store_storeObject__WEBPACK_IMPORTED_MODULE_0__["StoreObject"](_typeSystem_types__WEBPACK_IMPORTED_MODULE_3__["Types"].BOOLEAN, Object(_typeSystem_parsers__WEBPACK_IMPORTED_MODULE_2__["toBool"])(text));
  8293. } else if (typeToConvert.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_3__["Types"].STRING)) {
  8294. stoObj = new _store_storeObject__WEBPACK_IMPORTED_MODULE_0__["StoreObject"](_typeSystem_types__WEBPACK_IMPORTED_MODULE_3__["Types"].STRING, Object(_typeSystem_parsers__WEBPACK_IMPORTED_MODULE_2__["toString"])(text));
  8295. }
  8296. _this.loopTimers.splice(0, _this.loopTimers.length);
  8297. store.updateStore('p1', stoObj);
  8298. return Promise.resolve(store);
  8299. });
  8300. };
  8301. var block = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["CommandBlock"]([], [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["SysCall"](readFunction)]);
  8302. var func = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["Function"]('$read', _typeSystem_types__WEBPACK_IMPORTED_MODULE_3__["Types"].VOID, [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["FormalParameter"](_typeSystem_types__WEBPACK_IMPORTED_MODULE_3__["Types"].ALL, 'p1', true)], block);
  8303. return func;
  8304. }
  8305. /***/ }),
  8306. /***/ "./js/processor/lib/lang.js":
  8307. /*!**********************************!*\
  8308. !*** ./js/processor/lib/lang.js ***!
  8309. \**********************************/
  8310. /*! exports provided: createIsRealFun, createIsIntFun, createIsBoolFun, createCastRealFun, createCastIntFun, createCastBoolFun, createCastStringFun */
  8311. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  8312. "use strict";
  8313. __webpack_require__.r(__webpack_exports__);
  8314. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createIsRealFun", function() { return createIsRealFun; });
  8315. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createIsIntFun", function() { return createIsIntFun; });
  8316. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createIsBoolFun", function() { return createIsBoolFun; });
  8317. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createCastRealFun", function() { return createCastRealFun; });
  8318. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createCastIntFun", function() { return createCastIntFun; });
  8319. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createCastBoolFun", function() { return createCastBoolFun; });
  8320. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createCastStringFun", function() { return createCastStringFun; });
  8321. /* harmony import */ var _store_storeObject__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../store/storeObject */ "./js/processor/store/storeObject.js");
  8322. /* harmony import */ var _ast_commands__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./../../ast/commands */ "./js/ast/commands/index.js");
  8323. /* harmony import */ var _typeSystem_types__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./../../typeSystem/types */ "./js/typeSystem/types.js");
  8324. /* harmony import */ var _typeSystem_parsers__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./../../typeSystem/parsers */ "./js/typeSystem/parsers.js");
  8325. /* harmony import */ var _ast_ivprogParser__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../ast/ivprogParser */ "./js/ast/ivprogParser.js");
  8326. /* harmony import */ var _ast_expressions__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../ast/expressions */ "./js/ast/expressions/index.js");
  8327. /* harmony import */ var _modes__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../modes */ "./js/processor/modes.js");
  8328. /* harmony import */ var _typeSystem_multiType__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../../typeSystem/multiType */ "./js/typeSystem/multiType.js");
  8329. /* harmony import */ var _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../error/processorErrorFactory */ "./js/processor/error/processorErrorFactory.js");
  8330. /**
  8331. *
  8332. * is_real
  8333. * is_int
  8334. * is_bool
  8335. * cast_real
  8336. * cast_int
  8337. * cast_bool
  8338. * cast_string
  8339. */
  8340. function createIsRealFun() {
  8341. var isRealFun = function isRealFun(sto, _) {
  8342. var str = sto.applyStore("str");
  8343. var parser = _ast_ivprogParser__WEBPACK_IMPORTED_MODULE_4__["IVProgParser"].createParser(str.value);
  8344. var result = false;
  8345. try {
  8346. var val = parser.parseTerm();
  8347. if (val instanceof _ast_expressions__WEBPACK_IMPORTED_MODULE_5__["RealLiteral"]) {
  8348. result = true;
  8349. }
  8350. } catch (error) {}
  8351. var temp = new _store_storeObject__WEBPACK_IMPORTED_MODULE_0__["StoreObject"](_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].BOOLEAN, result);
  8352. sto.mode = _modes__WEBPACK_IMPORTED_MODULE_6__["Modes"].RETURN;
  8353. return Promise.resolve(sto.updateStore("$", temp));
  8354. };
  8355. var block = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["CommandBlock"]([], [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["SysCall"](isRealFun)]);
  8356. var func = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["Function"]('$isReal', _typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].BOOLEAN, [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["FormalParameter"](_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].STRING, 'str', false)], block);
  8357. return func;
  8358. }
  8359. function createIsIntFun() {
  8360. var isIntFun = function isIntFun(sto, _) {
  8361. var str = sto.applyStore("str");
  8362. var parser = _ast_ivprogParser__WEBPACK_IMPORTED_MODULE_4__["IVProgParser"].createParser(str.value);
  8363. var result = false;
  8364. try {
  8365. var val = parser.parseTerm();
  8366. if (val instanceof _ast_expressions__WEBPACK_IMPORTED_MODULE_5__["IntLiteral"]) {
  8367. result = true;
  8368. }
  8369. } catch (error) {}
  8370. var temp = new _store_storeObject__WEBPACK_IMPORTED_MODULE_0__["StoreObject"](_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].BOOLEAN, result);
  8371. sto.mode = _modes__WEBPACK_IMPORTED_MODULE_6__["Modes"].RETURN;
  8372. return Promise.resolve(sto.updateStore("$", temp));
  8373. };
  8374. var block = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["CommandBlock"]([], [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["SysCall"](isIntFun)]);
  8375. var func = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["Function"]('$isInt', _typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].BOOLEAN, [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["FormalParameter"](_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].STRING, 'str', false)], block);
  8376. return func;
  8377. }
  8378. function createIsBoolFun() {
  8379. var isBoolFun = function isBoolFun(sto, _) {
  8380. var str = sto.applyStore("str");
  8381. var parser = _ast_ivprogParser__WEBPACK_IMPORTED_MODULE_4__["IVProgParser"].createParser(str.value);
  8382. var result = false;
  8383. try {
  8384. var val = parser.parseTerm();
  8385. if (val instanceof _ast_expressions__WEBPACK_IMPORTED_MODULE_5__["BoolLiteral"]) {
  8386. result = true;
  8387. }
  8388. } catch (error) {}
  8389. var temp = new _store_storeObject__WEBPACK_IMPORTED_MODULE_0__["StoreObject"](_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].BOOLEAN, result);
  8390. sto.mode = _modes__WEBPACK_IMPORTED_MODULE_6__["Modes"].RETURN;
  8391. return Promise.resolve(sto.updateStore("$", temp));
  8392. };
  8393. var block = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["CommandBlock"]([], [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["SysCall"](isBoolFun)]);
  8394. var func = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["Function"]('$isBool', _typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].BOOLEAN, [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["FormalParameter"](_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].STRING, 'str', false)], block);
  8395. return func;
  8396. }
  8397. function createCastRealFun() {
  8398. var castRealFun = function castRealFun(sto, _) {
  8399. var val = sto.applyStore("val");
  8400. var value = val.value;
  8401. switch (val.type.ord) {
  8402. case _typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].INTEGER.ord:
  8403. {
  8404. value = value.toNumber();
  8405. var temp = new _store_storeObject__WEBPACK_IMPORTED_MODULE_0__["StoreObject"](_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].REAL, Object(_typeSystem_parsers__WEBPACK_IMPORTED_MODULE_3__["toReal"])(value));
  8406. sto.mode = _modes__WEBPACK_IMPORTED_MODULE_6__["Modes"].RETURN;
  8407. return Promise.resolve(sto.updateStore("$", temp));
  8408. }
  8409. case _typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].STRING.ord:
  8410. {
  8411. var parser = _ast_ivprogParser__WEBPACK_IMPORTED_MODULE_4__["IVProgParser"].createParser(value);
  8412. try {
  8413. var result = parser.parseTerm();
  8414. if (result instanceof _ast_expressions__WEBPACK_IMPORTED_MODULE_5__["RealLiteral"]) {
  8415. var _temp = new _store_storeObject__WEBPACK_IMPORTED_MODULE_0__["StoreObject"](_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].REAL, result.value);
  8416. sto.mode = _modes__WEBPACK_IMPORTED_MODULE_6__["Modes"].RETURN;
  8417. return Promise.resolve(sto.updateStore("$", _temp));
  8418. }
  8419. } catch (error) {}
  8420. }
  8421. }
  8422. var typeStringInfoArray = _typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].REAL.stringInfo();
  8423. var typeInfo = typeStringInfoArray[0];
  8424. return Promise.reject(_error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_8__["ProcessorErrorFactory"].invalid_type_conversion(value, typeInfo.type, typeInfo.dim));
  8425. };
  8426. var block = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["CommandBlock"]([], [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["SysCall"](castRealFun)]);
  8427. var func = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["Function"]('$castReal', _typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].REAL, [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["FormalParameter"](new _typeSystem_multiType__WEBPACK_IMPORTED_MODULE_7__["MultiType"]([_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].INTEGER, _typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].STRING]), 'val', false)], block);
  8428. return func;
  8429. }
  8430. function createCastIntFun() {
  8431. var castIntFun = function castIntFun(sto, _) {
  8432. var val = sto.applyStore("val");
  8433. var value = val.value;
  8434. switch (val.type.ord) {
  8435. case _typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].REAL.ord:
  8436. {
  8437. value = value.toNumber();
  8438. var temp = new _store_storeObject__WEBPACK_IMPORTED_MODULE_0__["StoreObject"](_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].INTEGER, Math.floor(value));
  8439. sto.mode = _modes__WEBPACK_IMPORTED_MODULE_6__["Modes"].RETURN;
  8440. return Promise.resolve(sto.updateStore("$", temp));
  8441. }
  8442. case _typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].STRING.ord:
  8443. {
  8444. var parser = _ast_ivprogParser__WEBPACK_IMPORTED_MODULE_4__["IVProgParser"].createParser(value);
  8445. try {
  8446. var result = parser.parseTerm();
  8447. if (result instanceof _ast_expressions__WEBPACK_IMPORTED_MODULE_5__["IntLiteral"]) {
  8448. var _temp2 = new _store_storeObject__WEBPACK_IMPORTED_MODULE_0__["StoreObject"](_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].INTEGER, result.value);
  8449. sto.mode = _modes__WEBPACK_IMPORTED_MODULE_6__["Modes"].RETURN;
  8450. return Promise.resolve(sto.updateStore("$", _temp2));
  8451. }
  8452. } catch (error) {}
  8453. }
  8454. }
  8455. var typeStringInfoArray = _typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].INTEGER.stringInfo();
  8456. var typeInfo = typeStringInfoArray[0];
  8457. return Promise.reject(_error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_8__["ProcessorErrorFactory"].invalid_type_conversion(value, typeInfo.type, typeInfo.dim));
  8458. };
  8459. var block = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["CommandBlock"]([], [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["SysCall"](castIntFun)]);
  8460. var func = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["Function"]('$castInt', _typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].INTEGER, [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["FormalParameter"](new _typeSystem_multiType__WEBPACK_IMPORTED_MODULE_7__["MultiType"]([_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].REAL, _typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].STRING]), 'val', false)], block);
  8461. return func;
  8462. }
  8463. function createCastBoolFun() {
  8464. var castBoolFun = function castBoolFun(sto, _) {
  8465. var str = sto.applyStore("str");
  8466. var value = str.value;
  8467. var parser = _ast_ivprogParser__WEBPACK_IMPORTED_MODULE_4__["IVProgParser"].createParser(value);
  8468. try {
  8469. var val = parser.parseTerm();
  8470. if (val instanceof _ast_expressions__WEBPACK_IMPORTED_MODULE_5__["BoolLiteral"]) {
  8471. var temp = new _store_storeObject__WEBPACK_IMPORTED_MODULE_0__["StoreObject"](_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].BOOLEAN, val.value);
  8472. sto.mode = _modes__WEBPACK_IMPORTED_MODULE_6__["Modes"].RETURN;
  8473. return Promise.resolve(sto.updateStore("$", temp));
  8474. }
  8475. } catch (error) {}
  8476. var typeStringInfoArray = _typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].BOOLEAN.stringInfo();
  8477. var typeInfo = typeStringInfoArray[0];
  8478. return Promise.reject(_error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_8__["ProcessorErrorFactory"].invalid_type_conversion(value, typeInfo.type, typeInfo.dim));
  8479. };
  8480. var block = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["CommandBlock"]([], [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["SysCall"](castBoolFun)]);
  8481. var func = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["Function"]('$castBool', _typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].BOOLEAN, [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["FormalParameter"](_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].STRING, 'str', false)], block);
  8482. return func;
  8483. }
  8484. function createCastStringFun() {
  8485. var castStringFun = function castStringFun(store, _) {
  8486. var val = store.applyStore('str');
  8487. var result = Object(_typeSystem_parsers__WEBPACK_IMPORTED_MODULE_3__["convertToString"])(val);
  8488. var temp = new _store_storeObject__WEBPACK_IMPORTED_MODULE_0__["StoreObject"](_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].STRING, result);
  8489. sto.mode = _modes__WEBPACK_IMPORTED_MODULE_6__["Modes"].RETURN;
  8490. return Promise.resolve(sto.updateStore("$", temp));
  8491. };
  8492. var block = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["CommandBlock"]([], [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["SysCall"](castStringFun)]);
  8493. var func = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["Function"]('$castString', _typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].STRING, [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["FormalParameter"](_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].ALL, 'str', false)], block);
  8494. return func;
  8495. }
  8496. /***/ }),
  8497. /***/ "./js/processor/lib/math.js":
  8498. /*!**********************************!*\
  8499. !*** ./js/processor/lib/math.js ***!
  8500. \**********************************/
  8501. /*! exports provided: createSinFun, createCosFun, createTanFun, createSqrtFun, createPowFun, createLogFun, createAbsFun, createNegateFun, createInvertFun, createMaxFun, createMinFun */
  8502. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  8503. "use strict";
  8504. __webpack_require__.r(__webpack_exports__);
  8505. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createSinFun", function() { return createSinFun; });
  8506. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createCosFun", function() { return createCosFun; });
  8507. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createTanFun", function() { return createTanFun; });
  8508. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createSqrtFun", function() { return createSqrtFun; });
  8509. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createPowFun", function() { return createPowFun; });
  8510. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createLogFun", function() { return createLogFun; });
  8511. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createAbsFun", function() { return createAbsFun; });
  8512. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createNegateFun", function() { return createNegateFun; });
  8513. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createInvertFun", function() { return createInvertFun; });
  8514. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createMaxFun", function() { return createMaxFun; });
  8515. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createMinFun", function() { return createMinFun; });
  8516. /* harmony import */ var _store_storeObject__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../store/storeObject */ "./js/processor/store/storeObject.js");
  8517. /* harmony import */ var _ast_commands__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./../../ast/commands */ "./js/ast/commands/index.js");
  8518. /* harmony import */ var _typeSystem_types__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./../../typeSystem/types */ "./js/typeSystem/types.js");
  8519. /* harmony import */ var _typeSystem_parsers__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./../../typeSystem/parsers */ "./js/typeSystem/parsers.js");
  8520. /* harmony import */ var decimal_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! decimal.js */ "./node_modules/decimal.js/decimal.js");
  8521. /* harmony import */ var decimal_js__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(decimal_js__WEBPACK_IMPORTED_MODULE_4__);
  8522. /* harmony import */ var _typeSystem_multiType__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../typeSystem/multiType */ "./js/typeSystem/multiType.js");
  8523. /* harmony import */ var _typeSystem_compoundType__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../typeSystem/compoundType */ "./js/typeSystem/compoundType.js");
  8524. /* harmony import */ var _modes__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../modes */ "./js/processor/modes.js");
  8525. /* harmony import */ var _util_config__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../../util/config */ "./js/util/config.js");
  8526. function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); }
  8527. function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance"); }
  8528. function _iterableToArray(iter) { if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter); }
  8529. function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } }
  8530. /**
  8531. * sin
  8532. * cos
  8533. * tan
  8534. * sqrt
  8535. * pow
  8536. * log
  8537. * abs
  8538. * negate
  8539. * invert
  8540. * max
  8541. * min
  8542. */
  8543. function convertToRadians(degrees) {
  8544. return degrees.times(decimal_js__WEBPACK_IMPORTED_MODULE_4__["Decimal"].acos(-1)).div(180);
  8545. }
  8546. function createSinFun() {
  8547. var sinFun = function sinFun(sto, _) {
  8548. var x = sto.applyStore('x');
  8549. var angle = x.value.mod(360);
  8550. var result = null;
  8551. if (angle.eq(90)) {
  8552. result = new decimal_js__WEBPACK_IMPORTED_MODULE_4__["Decimal"](1);
  8553. } else if (angle.eq(180)) {
  8554. result = new decimal_js__WEBPACK_IMPORTED_MODULE_4__["Decimal"](0);
  8555. } else if (angle.eq(270)) {
  8556. result = new decimal_js__WEBPACK_IMPORTED_MODULE_4__["Decimal"](-1);
  8557. } else {
  8558. result = decimal_js__WEBPACK_IMPORTED_MODULE_4__["Decimal"].sin(convertToRadians(angle));
  8559. }
  8560. if (result.dp() > _util_config__WEBPACK_IMPORTED_MODULE_8__["Config"].decimalPlaces) {
  8561. result = new decimal_js__WEBPACK_IMPORTED_MODULE_4__["Decimal"](result.toFixed(_util_config__WEBPACK_IMPORTED_MODULE_8__["Config"].decimalPlaces));
  8562. }
  8563. var temp = new _store_storeObject__WEBPACK_IMPORTED_MODULE_0__["StoreObject"](_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].REAL, result);
  8564. sto.mode = _modes__WEBPACK_IMPORTED_MODULE_7__["Modes"].RETURN;
  8565. return Promise.resolve(sto.updateStore('$', temp));
  8566. };
  8567. var block = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["CommandBlock"]([], [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["SysCall"](sinFun)]);
  8568. var func = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["Function"]('$sin', _typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].REAL, [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["FormalParameter"](new _typeSystem_multiType__WEBPACK_IMPORTED_MODULE_5__["MultiType"]([_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].INTEGER, _typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].REAL]), 'x', false)], block);
  8569. return func;
  8570. }
  8571. function createCosFun() {
  8572. var cosFun = function cosFun(sto, _) {
  8573. var x = sto.applyStore('x');
  8574. var angle = x.value.mod(360);
  8575. var result = null;
  8576. if (angle.eq(90)) {
  8577. result = new decimal_js__WEBPACK_IMPORTED_MODULE_4__["Decimal"](0);
  8578. } else if (angle.eq(180)) {
  8579. result = new decimal_js__WEBPACK_IMPORTED_MODULE_4__["Decimal"](-1);
  8580. } else if (angle.eq(270)) {
  8581. result = new decimal_js__WEBPACK_IMPORTED_MODULE_4__["Decimal"](0);
  8582. }
  8583. result = decimal_js__WEBPACK_IMPORTED_MODULE_4__["Decimal"].cos(convertToRadians(angle));
  8584. if (result.dp() > _util_config__WEBPACK_IMPORTED_MODULE_8__["Config"].decimalPlaces) {
  8585. result = new decimal_js__WEBPACK_IMPORTED_MODULE_4__["Decimal"](result.toFixed(_util_config__WEBPACK_IMPORTED_MODULE_8__["Config"].decimalPlaces));
  8586. }
  8587. var temp = new _store_storeObject__WEBPACK_IMPORTED_MODULE_0__["StoreObject"](_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].REAL, result);
  8588. sto.mode = _modes__WEBPACK_IMPORTED_MODULE_7__["Modes"].RETURN;
  8589. return Promise.resolve(sto.updateStore('$', temp));
  8590. };
  8591. var block = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["CommandBlock"]([], [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["SysCall"](cosFun)]);
  8592. var func = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["Function"]('$cos', _typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].REAL, [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["FormalParameter"](new _typeSystem_multiType__WEBPACK_IMPORTED_MODULE_5__["MultiType"]([_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].INTEGER, _typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].REAL]), 'x', false)], block);
  8593. return func;
  8594. }
  8595. function createTanFun() {
  8596. var tanFun = function tanFun(sto, _) {
  8597. var x = sto.applyStore('x');
  8598. var angle = x.value.mod(360);
  8599. if (angle.eq(90) || angle.eq(270)) {
  8600. return Promise.reject("Tangent of " + x.value.toNumber() + "° is undefined.");
  8601. }
  8602. var result = decimal_js__WEBPACK_IMPORTED_MODULE_4__["Decimal"].tan(convertToRadians(angle));
  8603. if (result.dp() > _util_config__WEBPACK_IMPORTED_MODULE_8__["Config"].decimalPlaces) {
  8604. result = new decimal_js__WEBPACK_IMPORTED_MODULE_4__["Decimal"](result.toFixed(_util_config__WEBPACK_IMPORTED_MODULE_8__["Config"].decimalPlaces));
  8605. }
  8606. var temp = new _store_storeObject__WEBPACK_IMPORTED_MODULE_0__["StoreObject"](_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].REAL, result);
  8607. sto.mode = _modes__WEBPACK_IMPORTED_MODULE_7__["Modes"].RETURN;
  8608. return Promise.resolve(sto.updateStore('$', temp));
  8609. };
  8610. var block = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["CommandBlock"]([], [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["SysCall"](tanFun)]);
  8611. var func = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["Function"]('$tan', _typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].REAL, [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["FormalParameter"](new _typeSystem_multiType__WEBPACK_IMPORTED_MODULE_5__["MultiType"]([_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].INTEGER, _typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].REAL]), 'x', false)], block);
  8612. return func;
  8613. }
  8614. function createSqrtFun() {
  8615. var sqrtFun = function sqrtFun(sto, _) {
  8616. var x = sto.applyStore('x');
  8617. var result = x.value.sqrt();
  8618. if (result.dp() > _util_config__WEBPACK_IMPORTED_MODULE_8__["Config"].decimalPlaces) {
  8619. result = new decimal_js__WEBPACK_IMPORTED_MODULE_4__["Decimal"](result.toFixed(_util_config__WEBPACK_IMPORTED_MODULE_8__["Config"].decimalPlaces));
  8620. }
  8621. var temp = new _store_storeObject__WEBPACK_IMPORTED_MODULE_0__["StoreObject"](_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].REAL, result);
  8622. sto.mode = _modes__WEBPACK_IMPORTED_MODULE_7__["Modes"].RETURN;
  8623. return Promise.resolve(sto.updateStore('$', temp));
  8624. };
  8625. var block = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["CommandBlock"]([], [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["SysCall"](sqrtFun)]);
  8626. var func = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["Function"]('$sqrt', _typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].REAL, [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["FormalParameter"](new _typeSystem_multiType__WEBPACK_IMPORTED_MODULE_5__["MultiType"]([_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].INTEGER, _typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].REAL]), 'x', false)], block);
  8627. return func;
  8628. }
  8629. function createPowFun() {
  8630. var powFun = function powFun(sto, _) {
  8631. var x = sto.applyStore('x');
  8632. var y = sto.applyStore('y');
  8633. var result = x.value.pow(y.value);
  8634. if (result.dp() > _util_config__WEBPACK_IMPORTED_MODULE_8__["Config"].decimalPlaces) {
  8635. result = new decimal_js__WEBPACK_IMPORTED_MODULE_4__["Decimal"](result.toFixed(_util_config__WEBPACK_IMPORTED_MODULE_8__["Config"].decimalPlaces));
  8636. }
  8637. var temp = new _store_storeObject__WEBPACK_IMPORTED_MODULE_0__["StoreObject"](_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].REAL, result);
  8638. sto.mode = _modes__WEBPACK_IMPORTED_MODULE_7__["Modes"].RETURN;
  8639. return Promise.resolve(sto.updateStore('$', temp));
  8640. };
  8641. var block = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["CommandBlock"]([], [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["SysCall"](powFun)]);
  8642. var func = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["Function"]('$pow', _typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].REAL, [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["FormalParameter"](new _typeSystem_multiType__WEBPACK_IMPORTED_MODULE_5__["MultiType"]([_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].INTEGER, _typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].REAL]), 'x', false), new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["FormalParameter"](new _typeSystem_multiType__WEBPACK_IMPORTED_MODULE_5__["MultiType"]([_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].INTEGER, _typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].REAL]), 'y', false)], block);
  8643. return func;
  8644. }
  8645. function createLogFun() {
  8646. var logFun = function logFun(sto, _) {
  8647. var x = sto.applyStore('x');
  8648. if (x.value.isNegative()) {
  8649. return Promise.reject("the value passed to log function cannot be negative");
  8650. }
  8651. var result = decimal_js__WEBPACK_IMPORTED_MODULE_4__["Decimal"].log10(x.value);
  8652. if (result.dp() > _util_config__WEBPACK_IMPORTED_MODULE_8__["Config"].decimalPlaces) {
  8653. result = new decimal_js__WEBPACK_IMPORTED_MODULE_4__["Decimal"](result.toFixed(_util_config__WEBPACK_IMPORTED_MODULE_8__["Config"].decimalPlaces));
  8654. }
  8655. var temp = new _store_storeObject__WEBPACK_IMPORTED_MODULE_0__["StoreObject"](_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].REAL, result);
  8656. sto.mode = _modes__WEBPACK_IMPORTED_MODULE_7__["Modes"].RETURN;
  8657. return Promise.resolve(sto.updateStore('$', temp));
  8658. };
  8659. var block = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["CommandBlock"]([], [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["SysCall"](logFun)]);
  8660. var func = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["Function"]('$log', _typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].REAL, [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["FormalParameter"](new _typeSystem_multiType__WEBPACK_IMPORTED_MODULE_5__["MultiType"]([_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].INTEGER, _typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].REAL]), 'x', false)], block);
  8661. return func;
  8662. }
  8663. function createAbsFun() {
  8664. var absFun = function absFun(sto, _) {
  8665. var x = sto.applyStore('x');
  8666. var result = x.value.abs();
  8667. var temp = new _store_storeObject__WEBPACK_IMPORTED_MODULE_0__["StoreObject"](x.type, result);
  8668. sto.updateStore('$', temp);
  8669. sto.mode = _modes__WEBPACK_IMPORTED_MODULE_7__["Modes"].RETURN;
  8670. return Promise.resolve(sto);
  8671. };
  8672. var block = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["CommandBlock"]([], [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["SysCall"](absFun)]);
  8673. var func = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["Function"]('$abs', new _typeSystem_multiType__WEBPACK_IMPORTED_MODULE_5__["MultiType"]([_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].INTEGER, _typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].REAL]), [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["FormalParameter"](new _typeSystem_multiType__WEBPACK_IMPORTED_MODULE_5__["MultiType"]([_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].INTEGER, _typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].REAL]), 'x', false)], block);
  8674. return func;
  8675. }
  8676. function createNegateFun() {
  8677. var negateFun = function negateFun(sto, _) {
  8678. var x = sto.applyStore('x');
  8679. var result = x.value.negated();
  8680. var temp = new _store_storeObject__WEBPACK_IMPORTED_MODULE_0__["StoreObject"](x.type, result);
  8681. sto.mode = _modes__WEBPACK_IMPORTED_MODULE_7__["Modes"].RETURN;
  8682. return Promise.resolve(sto.updateStore('$', temp));
  8683. };
  8684. var block = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["CommandBlock"]([], [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["SysCall"](negateFun)]);
  8685. var func = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["Function"]('$negate', new _typeSystem_multiType__WEBPACK_IMPORTED_MODULE_5__["MultiType"]([_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].INTEGER, _typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].REAL]), [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["FormalParameter"](new _typeSystem_multiType__WEBPACK_IMPORTED_MODULE_5__["MultiType"]([_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].INTEGER, _typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].REAL]), 'x', false)], block);
  8686. return func;
  8687. }
  8688. function createInvertFun() {
  8689. var invertFun = function invertFun(sto, _) {
  8690. var x = sto.applyStore('x');
  8691. var result = Object(_typeSystem_parsers__WEBPACK_IMPORTED_MODULE_3__["toReal"])(1).dividedBy(x.value);
  8692. if (result.dp() > _util_config__WEBPACK_IMPORTED_MODULE_8__["Config"].decimalPlaces) {
  8693. result = new decimal_js__WEBPACK_IMPORTED_MODULE_4__["Decimal"](result.toFixed(_util_config__WEBPACK_IMPORTED_MODULE_8__["Config"].decimalPlaces));
  8694. }
  8695. var temp = new _store_storeObject__WEBPACK_IMPORTED_MODULE_0__["StoreObject"](_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].REAL, result);
  8696. sto.mode = _modes__WEBPACK_IMPORTED_MODULE_7__["Modes"].RETURN;
  8697. return Promise.resolve(sto.updateStore('$', temp));
  8698. };
  8699. var block = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["CommandBlock"]([], [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["SysCall"](invertFun)]);
  8700. var func = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["Function"]('$invert', _typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].REAL, [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["FormalParameter"](new _typeSystem_multiType__WEBPACK_IMPORTED_MODULE_5__["MultiType"]([_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].INTEGER, _typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].REAL]), 'x', false)], block);
  8701. return func;
  8702. }
  8703. function createMaxFun() {
  8704. var maxFun = function maxFun(sto, _) {
  8705. var x = sto.applyStore('x');
  8706. var numbers = x.value.map(function (stoObj) {
  8707. return stoObj.value;
  8708. });
  8709. var result = decimal_js__WEBPACK_IMPORTED_MODULE_4__["Decimal"].max.apply(decimal_js__WEBPACK_IMPORTED_MODULE_4__["Decimal"], _toConsumableArray(numbers));
  8710. var temp = new _store_storeObject__WEBPACK_IMPORTED_MODULE_0__["StoreObject"](x.type.innerType, result);
  8711. sto.mode = _modes__WEBPACK_IMPORTED_MODULE_7__["Modes"].RETURN;
  8712. return Promise.resolve(sto.updateStore('$', temp));
  8713. };
  8714. var paramType = new _typeSystem_compoundType__WEBPACK_IMPORTED_MODULE_6__["CompoundType"](new _typeSystem_multiType__WEBPACK_IMPORTED_MODULE_5__["MultiType"]([_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].INTEGER, _typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].REAL]), 1);
  8715. var block = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["CommandBlock"]([], [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["SysCall"](maxFun)]);
  8716. var func = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["Function"]('$max', new _typeSystem_multiType__WEBPACK_IMPORTED_MODULE_5__["MultiType"]([_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].INTEGER, _typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].REAL]), [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["FormalParameter"](paramType, 'x', false)], block);
  8717. return func;
  8718. }
  8719. function createMinFun() {
  8720. var minFun = function minFun(sto, _) {
  8721. var x = sto.applyStore('x');
  8722. var numbers = x.value.map(function (stoObj) {
  8723. return stoObj.value;
  8724. });
  8725. var result = decimal_js__WEBPACK_IMPORTED_MODULE_4__["Decimal"].min.apply(decimal_js__WEBPACK_IMPORTED_MODULE_4__["Decimal"], _toConsumableArray(numbers));
  8726. var temp = new _store_storeObject__WEBPACK_IMPORTED_MODULE_0__["StoreObject"](x.type.innerType, result);
  8727. sto.mode = _modes__WEBPACK_IMPORTED_MODULE_7__["Modes"].RETURN;
  8728. return Promise.resolve(sto.updateStore('$', temp));
  8729. };
  8730. var paramType = new _typeSystem_compoundType__WEBPACK_IMPORTED_MODULE_6__["CompoundType"](new _typeSystem_multiType__WEBPACK_IMPORTED_MODULE_5__["MultiType"]([_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].INTEGER, _typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].REAL]), 1);
  8731. var block = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["CommandBlock"]([], [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["SysCall"](minFun)]);
  8732. var func = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["Function"]('$min', new _typeSystem_multiType__WEBPACK_IMPORTED_MODULE_5__["MultiType"]([_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].INTEGER, _typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].REAL]), [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["FormalParameter"](paramType, 'x', false)], block);
  8733. return func;
  8734. }
  8735. /***/ }),
  8736. /***/ "./js/processor/lib/strings.js":
  8737. /*!*************************************!*\
  8738. !*** ./js/processor/lib/strings.js ***!
  8739. \*************************************/
  8740. /*! exports provided: createSubstringFun, createLengthFun, createUppercaseFun, createLowercaseFun, createrCharAtFun */
  8741. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  8742. "use strict";
  8743. __webpack_require__.r(__webpack_exports__);
  8744. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createSubstringFun", function() { return createSubstringFun; });
  8745. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createLengthFun", function() { return createLengthFun; });
  8746. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createUppercaseFun", function() { return createUppercaseFun; });
  8747. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createLowercaseFun", function() { return createLowercaseFun; });
  8748. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createrCharAtFun", function() { return createrCharAtFun; });
  8749. /* harmony import */ var _store_storeObject__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../store/storeObject */ "./js/processor/store/storeObject.js");
  8750. /* harmony import */ var _ast_commands__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./../../ast/commands */ "./js/ast/commands/index.js");
  8751. /* harmony import */ var _typeSystem_types__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./../../typeSystem/types */ "./js/typeSystem/types.js");
  8752. /* harmony import */ var _typeSystem_parsers__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./../../typeSystem/parsers */ "./js/typeSystem/parsers.js");
  8753. /* harmony import */ var _modes__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../modes */ "./js/processor/modes.js");
  8754. /*
  8755. * substring
  8756. * length
  8757. * uppercase
  8758. * lowercase
  8759. * charAt
  8760. **/
  8761. function createSubstringFun() {
  8762. var substringFun = function substringFun(sto, _) {
  8763. var str = sto.applyStore("str");
  8764. var start = sto.applyStore("start");
  8765. var end = sto.applyStore("end");
  8766. var result = str.value.substring(start.value, end.value);
  8767. var temp = new _store_storeObject__WEBPACK_IMPORTED_MODULE_0__["StoreObject"](_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].STRING, result);
  8768. sto.mode = _modes__WEBPACK_IMPORTED_MODULE_4__["Modes"].RETURN;
  8769. return Promise.resolve(sto.updateStore("$", temp));
  8770. };
  8771. var block = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["CommandBlock"]([], [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["SysCall"](substringFun)]);
  8772. var func = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["Function"]('$substring', _typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].STRING, [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["FormalParameter"](_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].STRING, 'str', false), new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["FormalParameter"](_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].INTEGER, 'start', false), new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["FormalParameter"](_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].INTEGER, 'end', false)], block);
  8773. return func;
  8774. }
  8775. function createLengthFun() {
  8776. var lengthFun = function lengthFun(sto, _) {
  8777. var str = sto.applyStore("str");
  8778. var temp = new _store_storeObject__WEBPACK_IMPORTED_MODULE_0__["StoreObject"](_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].INTEGER, Object(_typeSystem_parsers__WEBPACK_IMPORTED_MODULE_3__["toInt"])(str.value.length));
  8779. sto.mode = _modes__WEBPACK_IMPORTED_MODULE_4__["Modes"].RETURN;
  8780. return Promise.resolve(sto.updateStore("$", temp));
  8781. };
  8782. var block = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["CommandBlock"]([], [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["SysCall"](lengthFun)]);
  8783. var func = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["Function"]('$length', _typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].INTEGER, [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["FormalParameter"](_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].STRING, 'str', false)], block);
  8784. return func;
  8785. }
  8786. function createUppercaseFun() {
  8787. var uppercaseFun = function uppercaseFun(sto, _) {
  8788. var str = sto.applyStore("str");
  8789. var temp = new _store_storeObject__WEBPACK_IMPORTED_MODULE_0__["StoreObject"](_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].STRING, str.value.toUpperCase());
  8790. sto.mode = _modes__WEBPACK_IMPORTED_MODULE_4__["Modes"].RETURN;
  8791. return Promise.resolve(sto.updateStore("$", temp));
  8792. };
  8793. var block = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["CommandBlock"]([], [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["SysCall"](uppercaseFun)]);
  8794. var func = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["Function"]('$uppercase', _typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].STRING, [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["FormalParameter"](_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].STRING, 'str', false)], block);
  8795. return func;
  8796. }
  8797. function createLowercaseFun() {
  8798. var lowercaseFun = function lowercaseFun(sto, _) {
  8799. var str = sto.applyStore("str");
  8800. var temp = new _store_storeObject__WEBPACK_IMPORTED_MODULE_0__["StoreObject"](_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].STRING, str.value.toLowerCase());
  8801. sto.mode = _modes__WEBPACK_IMPORTED_MODULE_4__["Modes"].RETURN;
  8802. return Promise.resolve(sto.updateStore("$", temp));
  8803. };
  8804. var block = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["CommandBlock"]([], [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["SysCall"](lowercaseFun)]);
  8805. var func = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["Function"]('$lowercase', _typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].STRING, [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["FormalParameter"](_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].STRING, 'str', false)], block);
  8806. return func;
  8807. }
  8808. function createrCharAtFun() {
  8809. var charAtFun = function charAtFun(sto, _) {
  8810. var str = sto.applyStore("str");
  8811. var idx = sto.applyStore("index");
  8812. if (idx.value.toNumber() < 0 || idx.value.toNumber() >= str.value.length) {
  8813. return Promise.reject(new Error("invalid string position"));
  8814. }
  8815. var temp = new _store_storeObject__WEBPACK_IMPORTED_MODULE_0__["StoreObject"](_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].STRING, str.value.charAt(idx.value.toNumber()));
  8816. sto.mode = _modes__WEBPACK_IMPORTED_MODULE_4__["Modes"].RETURN;
  8817. return Promise.resolve(sto.updateStore("$", temp));
  8818. };
  8819. var block = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["CommandBlock"]([], [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["SysCall"](charAtFun)]);
  8820. var func = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["Function"]('$charAt', _typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].STRING, [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["FormalParameter"](_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].STRING, 'str', false), new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["FormalParameter"](_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].INTEGER, 'index', false)], block);
  8821. return func;
  8822. }
  8823. /***/ }),
  8824. /***/ "./js/processor/modes.js":
  8825. /*!*******************************!*\
  8826. !*** ./js/processor/modes.js ***!
  8827. \*******************************/
  8828. /*! exports provided: Modes */
  8829. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  8830. "use strict";
  8831. __webpack_require__.r(__webpack_exports__);
  8832. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Modes", function() { return Modes; });
  8833. var Modes = Object.freeze({
  8834. RETURN: Symbol('mode:return'),
  8835. BREAK: Symbol('mode:break'),
  8836. PAUSE: Symbol('mode:pause'),
  8837. RUN: Symbol('mode:run')
  8838. });
  8839. /***/ }),
  8840. /***/ "./js/processor/semantic/semanticAnalyser.js":
  8841. /*!***************************************************!*\
  8842. !*** ./js/processor/semantic/semanticAnalyser.js ***!
  8843. \***************************************************/
  8844. /*! exports provided: SemanticAnalyser */
  8845. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  8846. "use strict";
  8847. __webpack_require__.r(__webpack_exports__);
  8848. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SemanticAnalyser", function() { return SemanticAnalyser; });
  8849. /* harmony import */ var _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./../error/processorErrorFactory */ "./js/processor/error/processorErrorFactory.js");
  8850. /* harmony import */ var _definedFunctions__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./../definedFunctions */ "./js/processor/definedFunctions.js");
  8851. /* harmony import */ var _services_languageService__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./../../services/languageService */ "./js/services/languageService.js");
  8852. /* harmony import */ var _ast_commands__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../ast/commands */ "./js/ast/commands/index.js");
  8853. /* harmony import */ var _ast_expressions__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../ast/expressions */ "./js/ast/expressions/index.js");
  8854. /* harmony import */ var _ast_expressions_literal__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../ast/expressions/literal */ "./js/ast/expressions/literal.js");
  8855. /* harmony import */ var _compatibilityTable__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../compatibilityTable */ "./js/processor/compatibilityTable.js");
  8856. /* harmony import */ var _typeSystem_types__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../../typeSystem/types */ "./js/typeSystem/types.js");
  8857. /* harmony import */ var _typeSystem_compoundType__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../../typeSystem/compoundType */ "./js/typeSystem/compoundType.js");
  8858. /* harmony import */ var _typeSystem_multiType__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../../typeSystem/multiType */ "./js/typeSystem/multiType.js");
  8859. /* harmony import */ var _util_config__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../../util/config */ "./js/util/config.js");
  8860. /* harmony import */ var _store_store__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../store/store */ "./js/processor/store/store.js");
  8861. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  8862. 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); } }
  8863. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  8864. var SemanticAnalyser =
  8865. /*#__PURE__*/
  8866. function () {
  8867. function SemanticAnalyser(ast) {
  8868. _classCallCheck(this, SemanticAnalyser);
  8869. this.ast = ast;
  8870. this.lexerClass = _services_languageService__WEBPACK_IMPORTED_MODULE_2__["LanguageService"].getCurrentLexer();
  8871. var lexer = new this.lexerClass(null);
  8872. this.literalNames = lexer.literalNames;
  8873. this.symbolMap = null;
  8874. this.currentFunction = null;
  8875. }
  8876. _createClass(SemanticAnalyser, [{
  8877. key: "pushMap",
  8878. value: function pushMap() {
  8879. if (this.symbolMap === null) {
  8880. this.symbolMap = {
  8881. map: {},
  8882. next: null
  8883. };
  8884. } else {
  8885. var n = {
  8886. map: {},
  8887. next: this.symbolMap
  8888. };
  8889. this.symbolMap = n;
  8890. }
  8891. }
  8892. }, {
  8893. key: "popMap",
  8894. value: function popMap() {
  8895. if (this.symbolMap !== null) {
  8896. this.symbolMap = this.symbolMap.next;
  8897. }
  8898. }
  8899. }, {
  8900. key: "insertSymbol",
  8901. value: function insertSymbol(id, typeInfo) {
  8902. this.symbolMap.map[id] = typeInfo;
  8903. }
  8904. }, {
  8905. key: "findSymbol",
  8906. value: function findSymbol(id, symMap) {
  8907. if (!symMap.map[id]) {
  8908. if (symMap.next) {
  8909. return this.findSymbol(id, symMap.next);
  8910. }
  8911. return null;
  8912. } else {
  8913. return symMap.map[id];
  8914. }
  8915. }
  8916. }, {
  8917. key: "getMainFunction",
  8918. value: function getMainFunction() {
  8919. return this.ast.functions.find(function (v) {
  8920. return v.isMain;
  8921. });
  8922. }
  8923. }, {
  8924. key: "findFunction",
  8925. value: function findFunction(name) {
  8926. if (name.match(/^\$.+$/)) {
  8927. var fun = _definedFunctions__WEBPACK_IMPORTED_MODULE_1__["LanguageDefinedFunction"].getFunction(name);
  8928. if (!!!fun) {
  8929. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_0__["ProcessorErrorFactory"].not_implemented(name);
  8930. }
  8931. return fun;
  8932. } else {
  8933. var val = this.ast.functions.find(function (v) {
  8934. return v.name === name;
  8935. });
  8936. if (!!!val) {
  8937. return null;
  8938. }
  8939. return val;
  8940. }
  8941. }
  8942. }, {
  8943. key: "analyseTree",
  8944. value: function analyseTree() {
  8945. var globalVars = this.ast.global;
  8946. this.pushMap();
  8947. this.assertDeclarations(globalVars);
  8948. var functions = this.ast.functions;
  8949. var mainFunc = functions.filter(function (f) {
  8950. return f.name === null;
  8951. });
  8952. if (mainFunc.length <= 0) {
  8953. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_0__["ProcessorErrorFactory"].main_missing();
  8954. }
  8955. for (var i = 0; i < functions.length; i++) {
  8956. var fun = functions[i];
  8957. this.assertFunction(fun);
  8958. }
  8959. return this.ast;
  8960. }
  8961. }, {
  8962. key: "assertDeclarations",
  8963. value: function assertDeclarations(list) {
  8964. for (var i = 0; i < list.length; i++) {
  8965. this.assertDeclaration(list[i]);
  8966. }
  8967. }
  8968. }, {
  8969. key: "assertDeclaration",
  8970. value: function assertDeclaration(declaration) {
  8971. if (declaration instanceof _ast_commands__WEBPACK_IMPORTED_MODULE_3__["ArrayDeclaration"]) {
  8972. if (declaration.initial === null) {
  8973. var lineType = this.evaluateExpressionType(declaration.lines);
  8974. if (!lineType.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_7__["Types"].INTEGER)) {
  8975. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_0__["ProcessorErrorFactory"].array_dimension_not_int_full(declaration.sourceInfo);
  8976. }
  8977. if (declaration.columns !== null) {
  8978. var columnType = this.evaluateExpressionType(declaration.columns);
  8979. if (!columnType.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_7__["Types"].INTEGER)) {
  8980. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_0__["ProcessorErrorFactory"].array_dimension_not_int_full(declaration.sourceInfo);
  8981. }
  8982. }
  8983. this.insertSymbol(declaration.id, {
  8984. id: declaration.id,
  8985. lines: declaration.lines,
  8986. columns: declaration.columns,
  8987. type: declaration.type
  8988. });
  8989. return;
  8990. }
  8991. this.evaluateArrayLiteral(declaration.id, declaration.lines, declaration.columns, declaration.type, declaration.initial);
  8992. this.insertSymbol(declaration.id, {
  8993. id: declaration.id,
  8994. lines: declaration.lines,
  8995. columns: declaration.columns,
  8996. type: declaration.type
  8997. });
  8998. } else {
  8999. if (declaration.initial === null) {
  9000. this.insertSymbol(declaration.id, {
  9001. id: declaration.id,
  9002. type: declaration.type
  9003. });
  9004. return;
  9005. }
  9006. var resultType = this.evaluateExpressionType(declaration.initial);
  9007. if (resultType instanceof _typeSystem_multiType__WEBPACK_IMPORTED_MODULE_9__["MultiType"]) {
  9008. if (!resultType.isCompatible(declaration.type)) {
  9009. var stringInfo = declaration.type.stringInfo();
  9010. var info = stringInfo[0];
  9011. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_0__["ProcessorErrorFactory"].incompatible_types_full(info.type, info.dim, declaration.sourceInfo);
  9012. }
  9013. this.insertSymbol(declaration.id, {
  9014. id: declaration.id,
  9015. type: declaration.type
  9016. });
  9017. } else if (!declaration.type.isCompatible(resultType) && !_util_config__WEBPACK_IMPORTED_MODULE_10__["Config"].enable_type_casting || !declaration.type.isCompatible(resultType) && _util_config__WEBPACK_IMPORTED_MODULE_10__["Config"].enable_type_casting && !_store_store__WEBPACK_IMPORTED_MODULE_11__["Store"].canImplicitTypeCast(declaration.type, resultType)) {
  9018. var _stringInfo = declaration.type.stringInfo();
  9019. var _info = _stringInfo[0];
  9020. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_0__["ProcessorErrorFactory"].incompatible_types_full(_info.type, _info.dim, declaration.sourceInfo);
  9021. } else {
  9022. this.insertSymbol(declaration.id, {
  9023. id: declaration.id,
  9024. type: declaration.type
  9025. });
  9026. }
  9027. }
  9028. }
  9029. }, {
  9030. key: "evaluateExpressionType",
  9031. value: function evaluateExpressionType(expression) {
  9032. if (expression instanceof _ast_expressions__WEBPACK_IMPORTED_MODULE_4__["UnaryApp"]) {
  9033. var op = expression.op;
  9034. var resultType = this.evaluateExpressionType(expression.left);
  9035. return Object(_compatibilityTable__WEBPACK_IMPORTED_MODULE_6__["resultTypeAfterUnaryOp"])(op, resultType);
  9036. } else if (expression instanceof _ast_expressions__WEBPACK_IMPORTED_MODULE_4__["InfixApp"]) {
  9037. var _op = expression.op;
  9038. var resultTypeLeft = this.evaluateExpressionType(expression.left);
  9039. var resultTypeRight = this.evaluateExpressionType(expression.right);
  9040. return Object(_compatibilityTable__WEBPACK_IMPORTED_MODULE_6__["resultTypeAfterInfixOp"])(_op, resultTypeLeft, resultTypeRight);
  9041. } else if (expression instanceof _ast_expressions_literal__WEBPACK_IMPORTED_MODULE_5__["Literal"]) {
  9042. return this.evaluateLiteralType(expression);
  9043. } else if (expression instanceof _ast_expressions__WEBPACK_IMPORTED_MODULE_4__["FunctionCall"]) {
  9044. if (expression.isMainCall) {
  9045. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_0__["ProcessorErrorFactory"].void_in_expression_full(_definedFunctions__WEBPACK_IMPORTED_MODULE_1__["LanguageDefinedFunction"].getMainFunctionName(), expression.sourceInfo);
  9046. }
  9047. var fun = this.findFunction(expression.id);
  9048. if (fun === null) {
  9049. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_0__["ProcessorErrorFactory"].function_missing_full(expression.id, expression.sourceInfo);
  9050. }
  9051. if (fun.returnType.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_7__["Types"].VOID)) {
  9052. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_0__["ProcessorErrorFactory"].void_in_expression_full(expression.id, expression.sourceInfo);
  9053. }
  9054. this.assertParameters(fun, expression.actualParameters);
  9055. return fun.returnType;
  9056. } else if (expression instanceof _ast_expressions__WEBPACK_IMPORTED_MODULE_4__["ArrayAccess"]) {
  9057. var arrayTypeInfo = this.findSymbol(expression.id, this.symbolMap);
  9058. if (arrayTypeInfo === null) {
  9059. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_0__["ProcessorErrorFactory"].symbol_not_found_full(expression.id, expression.sourceInfo);
  9060. }
  9061. if (!(arrayTypeInfo.type instanceof _typeSystem_compoundType__WEBPACK_IMPORTED_MODULE_8__["CompoundType"])) {
  9062. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_0__["ProcessorErrorFactory"].invalid_array_access_full(expression.id, expression.sourceInfo);
  9063. }
  9064. var lineType = this.evaluateExpressionType(expression.line);
  9065. if (!lineType.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_7__["Types"].INTEGER)) {
  9066. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_0__["ProcessorErrorFactory"].array_dimension_not_int_full(expression.sourceInfo);
  9067. }
  9068. if (expression.column !== null) {
  9069. if (arrayTypeInfo.columns === null) {
  9070. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_0__["ProcessorErrorFactory"].invalid_matrix_access_full(expression.id, expression.sourceInfo);
  9071. }
  9072. var columnType = this.evaluateExpressionType(expression.column);
  9073. if (!columnType.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_7__["Types"].INTEGER)) {
  9074. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_0__["ProcessorErrorFactory"].array_dimension_not_int_full(expression.sourceInfo);
  9075. }
  9076. }
  9077. var arrType = arrayTypeInfo.type;
  9078. if (expression.column !== null) {
  9079. // indexing matrix
  9080. return arrType.innerType;
  9081. } else {
  9082. if (arrayTypeInfo.columns === null) {
  9083. return arrType.innerType;
  9084. }
  9085. return new _typeSystem_compoundType__WEBPACK_IMPORTED_MODULE_8__["CompoundType"](arrType.innerType, 1);
  9086. }
  9087. }
  9088. }
  9089. }, {
  9090. key: "evaluateLiteralType",
  9091. value: function evaluateLiteralType(literal) {
  9092. if (literal instanceof _ast_expressions__WEBPACK_IMPORTED_MODULE_4__["IntLiteral"]) {
  9093. return literal.type;
  9094. } else if (literal instanceof _ast_expressions__WEBPACK_IMPORTED_MODULE_4__["RealLiteral"]) {
  9095. return literal.type;
  9096. } else if (literal instanceof _ast_expressions__WEBPACK_IMPORTED_MODULE_4__["StringLiteral"]) {
  9097. return literal.type;
  9098. } else if (literal instanceof _ast_expressions__WEBPACK_IMPORTED_MODULE_4__["BoolLiteral"]) {
  9099. return literal.type;
  9100. } else if (literal instanceof _ast_expressions__WEBPACK_IMPORTED_MODULE_4__["VariableLiteral"]) {
  9101. var typeInfo = this.findSymbol(literal.id, this.symbolMap);
  9102. if (typeInfo === null) {
  9103. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_0__["ProcessorErrorFactory"].symbol_not_found_full(literal.id, literal.sourceInfo);
  9104. }
  9105. if (typeInfo.type instanceof _typeSystem_compoundType__WEBPACK_IMPORTED_MODULE_8__["CompoundType"]) {
  9106. return typeInfo.type;
  9107. }
  9108. return typeInfo.type;
  9109. } else {
  9110. console.warn("Evaluating type only for an array literal...");
  9111. var last = null;
  9112. if (literal.value.length === 1) {
  9113. last = this.evaluateExpressionType(literal.value[0]);
  9114. } else {
  9115. for (var i = 0; i < literal.value.length; i++) {
  9116. var e = this.evaluateExpressionType(literal.value[i]);
  9117. if (last === null) {
  9118. last = e;
  9119. } else if (!last.isCompatible(e)) {
  9120. var strInfo = last.stringInfo();
  9121. var info = strInfo[0];
  9122. var strExp = literal.toString();
  9123. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_0__["ProcessorErrorFactory"].incompatible_types_array_full(strExp, info.type, info.dim, literal.sourceInfo);
  9124. }
  9125. }
  9126. }
  9127. if (last instanceof _typeSystem_compoundType__WEBPACK_IMPORTED_MODULE_8__["CompoundType"]) {
  9128. return new _typeSystem_compoundType__WEBPACK_IMPORTED_MODULE_8__["CompoundType"](last.innerType, last.dimensions + 1);
  9129. }
  9130. return new _typeSystem_compoundType__WEBPACK_IMPORTED_MODULE_8__["CompoundType"](last, 1);
  9131. }
  9132. }
  9133. }, {
  9134. key: "evaluateArrayLiteral",
  9135. value: function evaluateArrayLiteral(id, lines, columns, type, literal) {
  9136. /* if (literal instanceof ArrayLiteral) {
  9137. const dimType = this.evaluateExpressionType(lines);
  9138. if (!dimType.isCompatible(Types.INTEGER)) {
  9139. throw ProcessorErrorFactory.array_dimension_not_int_full(literal.sourceInfo);
  9140. }
  9141. if ((lines instanceof IntLiteral)) {
  9142. if (!lines.value.eq(literal.value.length)) {
  9143. if(type.dimensions > 1) {
  9144. throw ProcessorErrorFactory.matrix_line_outbounds_full(id, literal.value.length, lines.value.toNumber(), literal.sourceInfo)
  9145. } else {
  9146. throw ProcessorErrorFactory.vector_line_outbounds_full(id, literal.value.length, lines.value.toNumber(), literal.sourceInfo)
  9147. }
  9148. } else if (lines.value.isNeg()) {
  9149. throw ProcessorErrorFactory.array_dimension_not_positive_full(literal.sourceInfo);
  9150. }
  9151. }
  9152. if (columns === null) {
  9153. // it's a vector...
  9154. literal.value.reduce((last, next) => {
  9155. const eType = this.evaluateExpressionType(next);
  9156. if (!last.canAccept(eType)) {
  9157. const strInfo = last.stringInfo();
  9158. const info = strInfo[0];
  9159. const strExp = literal.toString();
  9160. throw ProcessorErrorFactory.incompatible_types_array_full(strExp,info.type, info.dim, literal.sourceInfo);
  9161. }
  9162. return last;
  9163. }, type);
  9164. return true;
  9165. } else {
  9166. const dimType = this.evaluateExpressionType(columns);
  9167. if (!dimType.isCompatible(Types.INTEGER)) {
  9168. throw ProcessorErrorFactory.array_dimension_not_int_full(literal.sourceInfo);
  9169. }
  9170. if ((columns instanceof IntLiteral)) {
  9171. const columnValue = literal.value[0].value.length;
  9172. if (!columns.value.eq(columnValue)) {
  9173. if(type.dimensions > 1) {
  9174. throw ProcessorErrorFactory.matrix_column_outbounds_full(id, literal.value.length, columns.value.toNumber(), literal.sourceInfo)
  9175. } else {
  9176. throw ProcessorErrorFactory.invalid_matrix_access_full(id, literal.sourceInfo);
  9177. }
  9178. } else if (columns.value.isNeg()) {
  9179. throw ProcessorErrorFactory.array_dimension_not_positive_full(literal.sourceInfo);
  9180. }
  9181. for (let i = 0; i < columns; i++) {
  9182. const anotherArray = literal.value[i];
  9183. this.evaluateArrayLiteral(id, columns, null, type, anotherArray)
  9184. }
  9185. }
  9186. }
  9187. } else {
  9188. const resultType = this.evaluateExpressionType(literal);
  9189. if (!(resultType instanceof CompoundType)) {
  9190. const strInfo = type.stringInfo();
  9191. const info = strInfo[0];
  9192. const strExp = literal.toString();
  9193. throw ProcessorErrorFactory.incompatible_types_array_full(strExp,info.type, info.dim, literal.sourceInfo);
  9194. }
  9195. if (!type.isCompatible(resultType)) {
  9196. const strInfo = type.stringInfo();
  9197. const info = strInfo[0];
  9198. const strExp = literal.toString();
  9199. throw ProcessorErrorFactory.incompatible_types_array_full(strExp,info.type, info.dim, literal.sourceInfo);
  9200. }
  9201. return true;
  9202. } */
  9203. return true;
  9204. }
  9205. }, {
  9206. key: "assertFunction",
  9207. value: function assertFunction(fun) {
  9208. var _this = this;
  9209. this.pushMap();
  9210. this.currentFunction = fun;
  9211. fun.formalParameters.forEach(function (formalParam) {
  9212. if (formalParam.type instanceof _typeSystem_compoundType__WEBPACK_IMPORTED_MODULE_8__["CompoundType"]) {
  9213. if (formalParam.type.dimensions > 1) {
  9214. _this.insertSymbol(formalParam.id, {
  9215. id: formalParam.id,
  9216. lines: -1,
  9217. columns: -1,
  9218. type: formalParam.type
  9219. });
  9220. } else {
  9221. _this.insertSymbol(formalParam.id, {
  9222. id: formalParam.id,
  9223. lines: -1,
  9224. columns: null,
  9225. type: formalParam.type
  9226. });
  9227. }
  9228. } else {
  9229. _this.insertSymbol(formalParam.id, {
  9230. id: formalParam.id,
  9231. type: formalParam.type
  9232. });
  9233. }
  9234. });
  9235. this.assertDeclarations(fun.variablesDeclarations);
  9236. var optional = fun.returnType.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_7__["Types"].VOID);
  9237. var valid = this.assertReturn(fun, optional);
  9238. if (!valid) {
  9239. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_0__["ProcessorErrorFactory"].function_no_return(fun.name);
  9240. }
  9241. this.popMap();
  9242. }
  9243. }, {
  9244. key: "assertReturn",
  9245. value: function assertReturn(fun, optional) {
  9246. var _this2 = this;
  9247. return fun.commands.reduce(function (last, next) {
  9248. return _this2.checkCommand(fun.returnType, next, optional) || last;
  9249. }, optional);
  9250. }
  9251. }, {
  9252. key: "checkCommand",
  9253. value: function checkCommand(type, cmd, optional) {
  9254. if (cmd instanceof _ast_commands__WEBPACK_IMPORTED_MODULE_3__["While"]) {
  9255. var resultType = this.evaluateExpressionType(cmd.expression);
  9256. if (!resultType.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_7__["Types"].BOOLEAN)) {
  9257. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_0__["ProcessorErrorFactory"].loop_condition_type_full(cmd.expression.toString(), cmd.sourceInfo);
  9258. }
  9259. this.checkCommands(type, cmd.commands, optional);
  9260. return false;
  9261. } else if (cmd instanceof _ast_commands__WEBPACK_IMPORTED_MODULE_3__["For"]) {
  9262. this.checkCommand(type, cmd.assignment, optional);
  9263. var _resultType = this.evaluateExpressionType(cmd.condition);
  9264. if (!_resultType.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_7__["Types"].BOOLEAN)) {
  9265. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_0__["ProcessorErrorFactory"].for_condition_type_full(cmd.condition.toString(), cmd.sourceInfo);
  9266. }
  9267. this.checkCommand(type, cmd.increment, optional);
  9268. this.checkCommands(type, cmd.commands, optional);
  9269. return false;
  9270. } else if (cmd instanceof _ast_commands__WEBPACK_IMPORTED_MODULE_3__["Switch"]) {
  9271. var sType = this.evaluateExpressionType(cmd.expression);
  9272. var result = optional;
  9273. var hasDefault = false;
  9274. for (var i = 0; i < cmd.cases.length; i++) {
  9275. var aCase = cmd.cases[i];
  9276. if (aCase.expression !== null) {
  9277. var caseType = this.evaluateExpressionType(aCase.expression);
  9278. if (!sType.isCompatible(caseType)) {
  9279. var strInfo = sType.stringInfo();
  9280. var info = strInfo[0];
  9281. var strExp = aCase.expression.toString();
  9282. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_0__["ProcessorErrorFactory"].invalid_case_type_full(strExp, info.type, info.dim, aCase.sourceInfo);
  9283. }
  9284. } else {
  9285. hasDefault = true;
  9286. }
  9287. result = result && this.checkCommands(type, aCase.commands, result);
  9288. }
  9289. return result && hasDefault;
  9290. } else if (cmd instanceof _ast_commands__WEBPACK_IMPORTED_MODULE_3__["ArrayIndexAssign"]) {
  9291. var typeInfo = this.findSymbol(cmd.id, this.symbolMap);
  9292. if (typeInfo === null) {
  9293. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_0__["ProcessorErrorFactory"].symbol_not_found_full(cmd.id, cmd.sourceInfo);
  9294. }
  9295. if (!(typeInfo.type instanceof _typeSystem_compoundType__WEBPACK_IMPORTED_MODULE_8__["CompoundType"])) {
  9296. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_0__["ProcessorErrorFactory"].invalid_array_access_full(cmd.id, cmd.sourceInfo);
  9297. }
  9298. var exp = cmd.expression;
  9299. var lineExp = cmd.line;
  9300. var lineType = this.evaluateExpressionType(lineExp);
  9301. if (!lineType.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_7__["Types"].INTEGER)) {
  9302. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_0__["ProcessorErrorFactory"].array_dimension_not_int_full(cmd.sourceInfo);
  9303. }
  9304. var columnExp = cmd.column;
  9305. if (typeInfo.columns === null && columnExp !== null) {
  9306. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_0__["ProcessorErrorFactory"].invalid_matrix_access_full(cmd.id, cmd.sourceInfo);
  9307. } else if (columnExp !== null) {
  9308. var columnType = this.evaluateExpressionType(columnExp);
  9309. if (!columnType.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_7__["Types"].INTEGER)) {
  9310. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_0__["ProcessorErrorFactory"].array_dimension_not_int_full(cmd.sourceInfo);
  9311. }
  9312. } // exp can be a arrayLiteral, a single value exp or an array access
  9313. if (exp instanceof _ast_expressions__WEBPACK_IMPORTED_MODULE_4__["ArrayLiteral"]) {
  9314. this.evaluateArrayLiteral(cmd.id, typeInfo.lines, columnExp ? typeInfo.columns : null, typeInfo.type, exp);
  9315. } else {// cannot properly evaluate since type system is poorly constructed
  9316. }
  9317. return optional;
  9318. } else if (cmd instanceof _ast_commands__WEBPACK_IMPORTED_MODULE_3__["Assign"]) {
  9319. var _typeInfo = this.findSymbol(cmd.id, this.symbolMap);
  9320. if (_typeInfo === null) {
  9321. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_0__["ProcessorErrorFactory"].symbol_not_found_full(cmd.id, cmd.sourceInfo);
  9322. }
  9323. var _exp = cmd.expression;
  9324. if (_exp instanceof _ast_expressions__WEBPACK_IMPORTED_MODULE_4__["ArrayLiteral"]) {
  9325. if (!(_typeInfo.type instanceof _typeSystem_compoundType__WEBPACK_IMPORTED_MODULE_8__["CompoundType"])) {
  9326. var stringInfo = _typeInfo.type.stringInfo();
  9327. var _info2 = stringInfo[0];
  9328. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_0__["ProcessorErrorFactory"].incompatible_types_full(_info2.type, _info2.dim, cmd.sourceInfo);
  9329. }
  9330. this.evaluateArrayLiteral(cmd.id, _typeInfo.lines, _typeInfo.columns, _typeInfo.type, _exp);
  9331. } else {
  9332. var _resultType2 = this.evaluateExpressionType(_exp);
  9333. if (!_resultType2.isCompatible(_typeInfo.type) && !_util_config__WEBPACK_IMPORTED_MODULE_10__["Config"].enable_type_casting || !_resultType2.isCompatible(_typeInfo.type) && _util_config__WEBPACK_IMPORTED_MODULE_10__["Config"].enable_type_casting && !_store_store__WEBPACK_IMPORTED_MODULE_11__["Store"].canImplicitTypeCast(_typeInfo.type, _resultType2)) {
  9334. var _stringInfo2 = _typeInfo.type.stringInfo();
  9335. var _info3 = _stringInfo2[0];
  9336. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_0__["ProcessorErrorFactory"].incompatible_types_full(_info3.type, _info3.dim, cmd.sourceInfo);
  9337. }
  9338. }
  9339. return optional;
  9340. } else if (cmd instanceof _ast_commands__WEBPACK_IMPORTED_MODULE_3__["Break"]) {
  9341. return optional;
  9342. } else if (cmd instanceof _ast_commands__WEBPACK_IMPORTED_MODULE_3__["IfThenElse"]) {
  9343. var _resultType3 = this.evaluateExpressionType(cmd.condition);
  9344. if (!_resultType3.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_7__["Types"].BOOLEAN)) {
  9345. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_0__["ProcessorErrorFactory"].if_condition_type_full(cmd.condition.toString(), cmd.sourceInfo);
  9346. }
  9347. if (cmd.ifFalse instanceof _ast_commands__WEBPACK_IMPORTED_MODULE_3__["IfThenElse"]) {
  9348. return this.checkCommands(type, cmd.ifTrue.commands, optional) && this.checkCommand(type, cmd.ifFalse, optional);
  9349. } else {
  9350. return this.checkCommands(type, cmd.ifTrue.commands, optional) && this.checkCommands(type, cmd.ifFalse.commands, optional);
  9351. }
  9352. } else if (cmd instanceof _ast_expressions__WEBPACK_IMPORTED_MODULE_4__["FunctionCall"]) {
  9353. var fun = null;
  9354. if (cmd.isMainCall) {
  9355. fun = this.getMainFunction();
  9356. } else {
  9357. fun = this.findFunction(cmd.id);
  9358. }
  9359. if (fun === null) {
  9360. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_0__["ProcessorErrorFactory"].function_missing_full(cmd.id, cmd.sourceInfo);
  9361. }
  9362. this.assertParameters(fun, cmd.actualParameters);
  9363. return optional;
  9364. } else if (cmd instanceof _ast_commands__WEBPACK_IMPORTED_MODULE_3__["Return"]) {
  9365. var funcName = this.currentFunction.isMain ? _definedFunctions__WEBPACK_IMPORTED_MODULE_1__["LanguageDefinedFunction"].getMainFunctionName() : this.currentFunction.name;
  9366. if (cmd.expression === null && !type.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_7__["Types"].VOID)) {
  9367. var _stringInfo3 = type.stringInfo();
  9368. var _info4 = _stringInfo3[0];
  9369. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_0__["ProcessorErrorFactory"].invalid_void_return_full(funcName, _info4.type, _info4.dim, cmd.sourceInfo);
  9370. } else if (cmd.expression !== null) {
  9371. var _resultType4 = this.evaluateExpressionType(cmd.expression);
  9372. if (!type.isCompatible(_resultType4)) {
  9373. var _stringInfo4 = type.stringInfo();
  9374. var _info5 = _stringInfo4[0];
  9375. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_0__["ProcessorErrorFactory"].invalid_return_type_full(funcName, _info5.type, _info5.dim, cmd.sourceInfo);
  9376. } else {
  9377. return true;
  9378. }
  9379. } else {
  9380. return true;
  9381. }
  9382. }
  9383. }
  9384. }, {
  9385. key: "checkCommands",
  9386. value: function checkCommands(type, cmds, optional) {
  9387. var _this3 = this;
  9388. return cmds.reduce(function (last, next) {
  9389. return _this3.checkCommand(type, next, optional) || last;
  9390. }, optional);
  9391. }
  9392. }, {
  9393. key: "assertParameters",
  9394. value: function assertParameters(fun, actualParametersList) {
  9395. if (fun.formalParameters.length !== actualParametersList.length) {
  9396. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_0__["ProcessorErrorFactory"].invalid_parameters_size_full(fun.name, actualParametersList.length, fun.formalParameters.length, null);
  9397. }
  9398. for (var i = 0; i < actualParametersList.length; i++) {
  9399. var param = actualParametersList[i];
  9400. var formalParam = fun.formalParameters[i];
  9401. var id = formalParam.id;
  9402. if (formalParam.byRef) {
  9403. if (!(param instanceof _ast_expressions__WEBPACK_IMPORTED_MODULE_4__["VariableLiteral"] || param instanceof _ast_expressions__WEBPACK_IMPORTED_MODULE_4__["ArrayAccess"])) {
  9404. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_0__["ProcessorErrorFactory"].invalid_parameter_type_full(id, param.toString(), param.sourceInfo);
  9405. }
  9406. }
  9407. var resultType = this.evaluateExpressionType(param);
  9408. if (resultType instanceof _typeSystem_multiType__WEBPACK_IMPORTED_MODULE_9__["MultiType"] && formalParam.type instanceof _typeSystem_multiType__WEBPACK_IMPORTED_MODULE_9__["MultiType"]) {
  9409. var shared = 0;
  9410. for (var j = 0; j < resultType.types.length; j++) {
  9411. var element = resultType.types[j];
  9412. if (formalParam.type.types.indexOf(element) !== -1) {
  9413. shared++;
  9414. }
  9415. }
  9416. if (shared <= 0) {
  9417. if (_util_config__WEBPACK_IMPORTED_MODULE_10__["Config"].enable_type_casting && !formalParam.byRef) {
  9418. if (resultType.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_7__["Types"].INTEGER) || resultType.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_7__["Types"].REAL)) {
  9419. if (formalParam.type.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_7__["Types"].INTEGER) || formalParam.type.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_7__["Types"].REAL)) {
  9420. continue;
  9421. }
  9422. }
  9423. }
  9424. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_0__["ProcessorErrorFactory"].invalid_parameter_type_full(id, param.toString(), param.sourceInfo);
  9425. }
  9426. } else if (resultType instanceof _typeSystem_multiType__WEBPACK_IMPORTED_MODULE_9__["MultiType"]) {
  9427. if (!resultType.isCompatible(formalParam.type)) {
  9428. if (_util_config__WEBPACK_IMPORTED_MODULE_10__["Config"].enable_type_casting && !formalParam.byRef) {
  9429. if (resultType.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_7__["Types"].INTEGER) || resultType.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_7__["Types"].REAL)) {
  9430. if (formalParam.type.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_7__["Types"].INTEGER) || formalParam.type.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_7__["Types"].REAL)) {
  9431. continue;
  9432. }
  9433. }
  9434. }
  9435. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_0__["ProcessorErrorFactory"].invalid_parameter_type_full(id, param.toString(), param.sourceInfo);
  9436. }
  9437. } else if (!formalParam.type.isCompatible(resultType)) {
  9438. if (_util_config__WEBPACK_IMPORTED_MODULE_10__["Config"].enable_type_casting && !formalParam.byRef) {
  9439. if (_store_store__WEBPACK_IMPORTED_MODULE_11__["Store"].canImplicitTypeCast(formalParam.type, resultType)) {
  9440. continue;
  9441. }
  9442. }
  9443. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_0__["ProcessorErrorFactory"].invalid_parameter_type_full(id, param.toString(), param.sourceInfo);
  9444. }
  9445. }
  9446. }
  9447. }]);
  9448. return SemanticAnalyser;
  9449. }();
  9450. /***/ }),
  9451. /***/ "./js/processor/store/store.js":
  9452. /*!*************************************!*\
  9453. !*** ./js/processor/store/store.js ***!
  9454. \*************************************/
  9455. /*! exports provided: Store */
  9456. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  9457. "use strict";
  9458. __webpack_require__.r(__webpack_exports__);
  9459. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Store", function() { return Store; });
  9460. /* harmony import */ var _modes__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./../modes */ "./js/processor/modes.js");
  9461. /* harmony import */ var _typeSystem_types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./../../typeSystem/types */ "./js/typeSystem/types.js");
  9462. /* harmony import */ var _storeObject__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./storeObject */ "./js/processor/store/storeObject.js");
  9463. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  9464. 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); } }
  9465. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  9466. var Store =
  9467. /*#__PURE__*/
  9468. function () {
  9469. _createClass(Store, null, [{
  9470. key: "canImplicitTypeCast",
  9471. value: function canImplicitTypeCast(castType, sourceType) {
  9472. if (castType.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_1__["Types"].INTEGER) || castType.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL)) {
  9473. if (sourceType.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_1__["Types"].INTEGER) || sourceType.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL)) {
  9474. return true;
  9475. }
  9476. }
  9477. return false;
  9478. }
  9479. }, {
  9480. key: "doImplicitCasting",
  9481. value: function doImplicitCasting(castType, stoObj) {
  9482. if (!Store.canImplicitTypeCast(castType, stoObj.type)) {
  9483. throw new Error("!!!Critical error: attempted to type cast invalid types");
  9484. }
  9485. if (castType.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_1__["Types"].INTEGER)) {
  9486. return new _storeObject__WEBPACK_IMPORTED_MODULE_2__["StoreObject"](_typeSystem_types__WEBPACK_IMPORTED_MODULE_1__["Types"].INTEGER, stoObj.value.trunc());
  9487. } else {
  9488. return new _storeObject__WEBPACK_IMPORTED_MODULE_2__["StoreObject"](_typeSystem_types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL, stoObj.value);
  9489. }
  9490. }
  9491. }]);
  9492. function Store(name) {
  9493. _classCallCheck(this, Store);
  9494. this.name = name;
  9495. this.store = {};
  9496. this.nextStore = null;
  9497. this.mode = _modes__WEBPACK_IMPORTED_MODULE_0__["Modes"].RUN;
  9498. }
  9499. _createClass(Store, [{
  9500. key: "extendStore",
  9501. value: function extendStore(nextStore) {
  9502. this.nextStore = nextStore;
  9503. }
  9504. }, {
  9505. key: "applyStore",
  9506. value: function applyStore(id) {
  9507. if (!this.store[id]) {
  9508. if (this.nextStore !== null) {
  9509. return this.nextStore.applyStore(id);
  9510. } else {
  9511. throw new Error("Variable ".concat(id, " not found."));
  9512. }
  9513. }
  9514. var val = this.store[id];
  9515. if (val.isRef) {
  9516. return val.getRefObj();
  9517. }
  9518. return this.store[id];
  9519. }
  9520. }, {
  9521. key: "updateStore",
  9522. value: function updateStore(id, stoObj) {
  9523. if (!this.store[id]) {
  9524. if (this.nextStore !== null) {
  9525. this.nextStore.updateStore(id, stoObj);
  9526. return this;
  9527. } else {
  9528. // TODO: better error message
  9529. throw new Error("Variable ".concat(id, " not found."));
  9530. }
  9531. } else {
  9532. var oldObj = this.store[id];
  9533. if (oldObj.readOnly) {
  9534. // TODO: better error message
  9535. throw new Error("Cannot change value of a read only variable: " + id);
  9536. }
  9537. if (oldObj.isRef) {
  9538. oldObj.updateRef(stoObj);
  9539. return this;
  9540. } else if (oldObj.isCompatible(stoObj)) {
  9541. stoObj.setID(id);
  9542. this.store[id] = Object.freeze(stoObj);
  9543. return this;
  9544. } else {
  9545. var oldType = oldObj.type;
  9546. var stoType = stoObj.type; // TODO: better error message
  9547. throw new Error("".concat(oldType, " is not compatible with type ").concat(stoType, " given"));
  9548. }
  9549. }
  9550. } //In case of future use of ref, it needs to have a special function to update the storeRefObject
  9551. // and no the StoreObject refferenced by it
  9552. // updateStoreRef(id, stoObjAddress) {...}
  9553. }, {
  9554. key: "insertStore",
  9555. value: function insertStore(id, stoObj) {
  9556. if (this.store[id]) {
  9557. // TODO: better error message
  9558. throw new Error("".concat(id, " is already defined"));
  9559. }
  9560. stoObj.setID(id);
  9561. this.store[id] = Object.freeze(stoObj);
  9562. return this;
  9563. }
  9564. }]);
  9565. return Store;
  9566. }();
  9567. /***/ }),
  9568. /***/ "./js/processor/store/storeObject.js":
  9569. /*!*******************************************!*\
  9570. !*** ./js/processor/store/storeObject.js ***!
  9571. \*******************************************/
  9572. /*! exports provided: StoreObject */
  9573. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  9574. "use strict";
  9575. __webpack_require__.r(__webpack_exports__);
  9576. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "StoreObject", function() { return StoreObject; });
  9577. /* harmony import */ var decimal_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! decimal.js */ "./node_modules/decimal.js/decimal.js");
  9578. /* harmony import */ var decimal_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(decimal_js__WEBPACK_IMPORTED_MODULE_0__);
  9579. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  9580. 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); } }
  9581. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  9582. var StoreObject =
  9583. /*#__PURE__*/
  9584. function () {
  9585. function StoreObject(type, value) {
  9586. var readOnly = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  9587. _classCallCheck(this, StoreObject);
  9588. this._type = type;
  9589. this._value = value;
  9590. this._readOnly = readOnly;
  9591. this._id = null;
  9592. }
  9593. _createClass(StoreObject, [{
  9594. key: "setID",
  9595. value: function setID(id) {
  9596. this._id = id;
  9597. }
  9598. }, {
  9599. key: "isCompatible",
  9600. value: function isCompatible(another) {
  9601. if (another instanceof StoreObject) {
  9602. return this.type.isCompatible(another.type);
  9603. }
  9604. return false;
  9605. }
  9606. }, {
  9607. key: "id",
  9608. get: function get() {
  9609. return this._id;
  9610. }
  9611. }, {
  9612. key: "inStore",
  9613. get: function get() {
  9614. return this.id !== null;
  9615. }
  9616. }, {
  9617. key: "type",
  9618. get: function get() {
  9619. return this._type;
  9620. }
  9621. }, {
  9622. key: "value",
  9623. get: function get() {
  9624. return this._value;
  9625. }
  9626. }, {
  9627. key: "number",
  9628. get: function get() {
  9629. if (this._value instanceof decimal_js__WEBPACK_IMPORTED_MODULE_0___default.a) {
  9630. return this._value.toNumber();
  9631. } else {
  9632. return null;
  9633. }
  9634. }
  9635. }, {
  9636. key: "readOnly",
  9637. get: function get() {
  9638. return this._readOnly;
  9639. },
  9640. set: function set(value) {
  9641. this._readOnly = value;
  9642. }
  9643. }]);
  9644. return StoreObject;
  9645. }();
  9646. /***/ }),
  9647. /***/ "./js/processor/store/storeObjectArray.js":
  9648. /*!************************************************!*\
  9649. !*** ./js/processor/store/storeObjectArray.js ***!
  9650. \************************************************/
  9651. /*! exports provided: StoreObjectArray */
  9652. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  9653. "use strict";
  9654. __webpack_require__.r(__webpack_exports__);
  9655. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "StoreObjectArray", function() { return StoreObjectArray; });
  9656. /* harmony import */ var _storeObject__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./storeObject */ "./js/processor/store/storeObject.js");
  9657. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  9658. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  9659. function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
  9660. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  9661. function _get(target, property, receiver) { if (typeof Reflect !== "undefined" && Reflect.get) { _get = Reflect.get; } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(receiver); } return desc.value; }; } return _get(target, property, receiver || target); }
  9662. function _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; }
  9663. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  9664. 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); } }
  9665. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  9666. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
  9667. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  9668. var StoreObjectArray =
  9669. /*#__PURE__*/
  9670. function (_StoreObject) {
  9671. _inherits(StoreObjectArray, _StoreObject);
  9672. _createClass(StoreObjectArray, null, [{
  9673. key: "WRONG_LINE_NUMBER",
  9674. get: function get() {
  9675. return 1;
  9676. }
  9677. }, {
  9678. key: "WRONG_TYPE",
  9679. get: function get() {
  9680. return 2;
  9681. }
  9682. }, {
  9683. key: "WRONG_COLUMN_NUMBER",
  9684. get: function get() {
  9685. return 3;
  9686. }
  9687. }]);
  9688. function StoreObjectArray(type, lines, columns) {
  9689. var _this;
  9690. var value = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
  9691. var readOnly = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
  9692. _classCallCheck(this, StoreObjectArray);
  9693. _this = _possibleConstructorReturn(this, _getPrototypeOf(StoreObjectArray).call(this, type, value, readOnly));
  9694. _this._lines = lines;
  9695. _this._columns = columns;
  9696. return _this;
  9697. }
  9698. _createClass(StoreObjectArray, [{
  9699. key: "isCompatible",
  9700. value: function isCompatible(another) {
  9701. if (another instanceof _storeObject__WEBPACK_IMPORTED_MODULE_0__["StoreObject"]) {
  9702. if (this.lines === -1 && another.lines > 0 || this.lines === another.lines) {
  9703. if (this.columns === -1 && another.columns > 0 || this.columns === another.columns) {
  9704. return _get(_getPrototypeOf(StoreObjectArray.prototype), "isCompatible", this).call(this, another);
  9705. }
  9706. }
  9707. }
  9708. return false;
  9709. }
  9710. }, {
  9711. key: "lines",
  9712. get: function get() {
  9713. return this._lines;
  9714. }
  9715. }, {
  9716. key: "columns",
  9717. get: function get() {
  9718. return this._columns;
  9719. }
  9720. }, {
  9721. key: "isVector",
  9722. get: function get() {
  9723. return this.type.dimensions === 1;
  9724. }
  9725. }, {
  9726. key: "isValid",
  9727. get: function get() {
  9728. var _this2 = this;
  9729. if (this.value !== null) {
  9730. if (this.isVector) {
  9731. if (this.value.length !== this.lines) {
  9732. return [StoreObjectArray.WRONG_LINE_NUMBER, this.value.length];
  9733. ;
  9734. }
  9735. var mustBeNull = this.value.find(function (v) {
  9736. return !_this2.type.canAccept(v.type);
  9737. });
  9738. if (!!mustBeNull) {
  9739. return [StoreObjectArray.WRONG_TYPE, this.value.indexOf(mustBeNull)];
  9740. ;
  9741. }
  9742. }
  9743. return [];
  9744. } else {
  9745. if (this.lines !== this.value.length) {
  9746. return [StoreObjectArray.WRONG_LINE_NUMBER, this.value.length];
  9747. }
  9748. for (var i = 0; i < this.lines; i++) {
  9749. for (var j = 0; j < this.columns; j++) {
  9750. var arr = this.value[i];
  9751. if (arr.length !== this.columns) {
  9752. return [StoreObjectArray.WRONG_COLUMN_NUMBER, arr.length];
  9753. }
  9754. var _mustBeNull = arr.find(function (v) {
  9755. return !_this2.type.canAccept(v.type);
  9756. });
  9757. if (!!_mustBeNull) {
  9758. return [StoreObjectArray.WRONG_TYPE, i, arr.indexOf(_mustBeNull)];
  9759. }
  9760. }
  9761. }
  9762. return [];
  9763. }
  9764. }
  9765. }]);
  9766. return StoreObjectArray;
  9767. }(_storeObject__WEBPACK_IMPORTED_MODULE_0__["StoreObject"]);
  9768. /***/ }),
  9769. /***/ "./js/processor/store/storeObjectArrayAddress.js":
  9770. /*!*******************************************************!*\
  9771. !*** ./js/processor/store/storeObjectArrayAddress.js ***!
  9772. \*******************************************************/
  9773. /*! exports provided: StoreObjectArrayAddress */
  9774. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  9775. "use strict";
  9776. __webpack_require__.r(__webpack_exports__);
  9777. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "StoreObjectArrayAddress", function() { return StoreObjectArrayAddress; });
  9778. /* harmony import */ var _storeObject__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./storeObject */ "./js/processor/store/storeObject.js");
  9779. /* harmony import */ var _storeObjectArray__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./storeObjectArray */ "./js/processor/store/storeObjectArray.js");
  9780. /* harmony import */ var _typeSystem_compoundType__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../typeSystem/compoundType */ "./js/typeSystem/compoundType.js");
  9781. /* harmony import */ var _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../error/processorErrorFactory */ "./js/processor/error/processorErrorFactory.js");
  9782. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  9783. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  9784. 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); } }
  9785. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  9786. function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
  9787. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  9788. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  9789. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
  9790. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  9791. var StoreObjectArrayAddress =
  9792. /*#__PURE__*/
  9793. function (_StoreObject) {
  9794. _inherits(StoreObjectArrayAddress, _StoreObject);
  9795. function StoreObjectArrayAddress(refID, line, column, store) {
  9796. var _this;
  9797. _classCallCheck(this, StoreObjectArrayAddress);
  9798. _this = _possibleConstructorReturn(this, _getPrototypeOf(StoreObjectArrayAddress).call(this, null, null, false));
  9799. _this.refID = refID;
  9800. _this.store = store;
  9801. _this.line = line;
  9802. _this.column = column;
  9803. return _this;
  9804. }
  9805. _createClass(StoreObjectArrayAddress, [{
  9806. key: "getArrayObject",
  9807. value: function getArrayObject() {
  9808. return this.store.applyStore(this.refID);
  9809. }
  9810. }, {
  9811. key: "updateArrayObject",
  9812. value: function updateArrayObject(stoObj) {
  9813. var anArray = this.getArrayObject();
  9814. var newArray = Object.assign(new _storeObjectArray__WEBPACK_IMPORTED_MODULE_1__["StoreObjectArray"](null, null, null), anArray);
  9815. if (!stoObj.type.isCompatible(this.type)) {
  9816. throw new Error("Invalid operation: cannot assign the value given to ".concat(this.refID));
  9817. } else if (this.type instanceof _typeSystem_compoundType__WEBPACK_IMPORTED_MODULE_2__["CompoundType"] && this.type.canAccept(stoObj.type)) {
  9818. throw new Error("Invalid operation: cannot assign the value given to ".concat(this.refID));
  9819. }
  9820. if (this.column !== null) {
  9821. newArray.value[this.line].value[this.column] = stoObj;
  9822. return newArray;
  9823. } else {
  9824. newArray.value[this.line] = stoObj;
  9825. return newArray;
  9826. }
  9827. }
  9828. }, {
  9829. key: "isCompatible",
  9830. value: function isCompatible(another) {
  9831. if (this.type.isCompatible(another.type)) {
  9832. if (another.type instanceof _typeSystem_compoundType__WEBPACK_IMPORTED_MODULE_2__["CompoundType"]) {
  9833. return this.lines === another.lines && this.columns === another.columns;
  9834. } else {
  9835. this.refValue.isCompatible(another);
  9836. }
  9837. }
  9838. }
  9839. }, {
  9840. key: "isRef",
  9841. get: function get() {
  9842. return false;
  9843. }
  9844. }, {
  9845. key: "inStore",
  9846. get: function get() {
  9847. return true;
  9848. }
  9849. }, {
  9850. key: "refValue",
  9851. get: function get() {
  9852. var refLine = this.store.applyStore(this.refID).value[this.line];
  9853. if (!refLine) {
  9854. if (this.getArrayObject().isVector) {
  9855. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_3__["ProcessorErrorFactory"].vector_line_outbounds(this.refID, this.line, this.getArrayObject().lines);
  9856. } else {
  9857. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_3__["ProcessorErrorFactory"].matrix_line_outbounds(this.refID, this.line, this.getArrayObject().lines);
  9858. }
  9859. }
  9860. if (this.column !== null) {
  9861. var refColumn = refLine.value[this.column];
  9862. if (!refColumn) {
  9863. if (this.getArrayObject().isVector) {
  9864. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_3__["ProcessorErrorFactory"].vector_not_matrix(this.refID);
  9865. } else {
  9866. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_3__["ProcessorErrorFactory"].matrix_column_outbounds(this.refID, this.column, this.getArrayObject().columns);
  9867. }
  9868. }
  9869. return refColumn;
  9870. }
  9871. return refLine;
  9872. }
  9873. }, {
  9874. key: "value",
  9875. get: function get() {
  9876. return this.refValue.value;
  9877. }
  9878. }, {
  9879. key: "type",
  9880. get: function get() {
  9881. return this.refValue.type;
  9882. }
  9883. }, {
  9884. key: "lines",
  9885. get: function get() {
  9886. if (!(this.type instanceof _typeSystem_compoundType__WEBPACK_IMPORTED_MODULE_2__["CompoundType"])) {
  9887. return null;
  9888. }
  9889. return this.refValue.value.length;
  9890. }
  9891. }, {
  9892. key: "columns",
  9893. get: function get() {
  9894. switch (this.type.dimensions) {
  9895. case 2:
  9896. return this.refValue.value[0].value.length;
  9897. default:
  9898. return null;
  9899. }
  9900. }
  9901. }]);
  9902. return StoreObjectArrayAddress;
  9903. }(_storeObject__WEBPACK_IMPORTED_MODULE_0__["StoreObject"]);
  9904. /***/ }),
  9905. /***/ "./js/processor/store/storeObjectArrayAddressRef.js":
  9906. /*!**********************************************************!*\
  9907. !*** ./js/processor/store/storeObjectArrayAddressRef.js ***!
  9908. \**********************************************************/
  9909. /*! exports provided: StoreObjectArrayAddressRef */
  9910. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  9911. "use strict";
  9912. __webpack_require__.r(__webpack_exports__);
  9913. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "StoreObjectArrayAddressRef", function() { return StoreObjectArrayAddressRef; });
  9914. /* harmony import */ var _storeObject__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./storeObject */ "./js/processor/store/storeObject.js");
  9915. /* harmony import */ var decimal_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! decimal.js */ "./node_modules/decimal.js/decimal.js");
  9916. /* harmony import */ var decimal_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(decimal_js__WEBPACK_IMPORTED_MODULE_1__);
  9917. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  9918. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  9919. 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); } }
  9920. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  9921. function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
  9922. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  9923. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  9924. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
  9925. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  9926. var StoreObjectArrayAddressRef =
  9927. /*#__PURE__*/
  9928. function (_StoreObject) {
  9929. _inherits(StoreObjectArrayAddressRef, _StoreObject);
  9930. function StoreObjectArrayAddressRef(address) {
  9931. var _this;
  9932. _classCallCheck(this, StoreObjectArrayAddressRef);
  9933. _this = _possibleConstructorReturn(this, _getPrototypeOf(StoreObjectArrayAddressRef).call(this, null, null, false));
  9934. _this.address = address;
  9935. return _this;
  9936. }
  9937. _createClass(StoreObjectArrayAddressRef, [{
  9938. key: "getRefObj",
  9939. value: function getRefObj() {
  9940. return this.address.refValue;
  9941. }
  9942. }, {
  9943. key: "updateRef",
  9944. value: function updateRef(stoObj) {
  9945. var newArray = this.address.updateArrayObject(stoObj);
  9946. this.address.store.updateStore(this.address.refID, newArray);
  9947. }
  9948. }, {
  9949. key: "isCompatible",
  9950. value: function isCompatible(another) {
  9951. return this.address.isCompatible(another);
  9952. }
  9953. }, {
  9954. key: "isRef",
  9955. get: function get() {
  9956. return true;
  9957. }
  9958. }, {
  9959. key: "type",
  9960. get: function get() {
  9961. return this.address.type;
  9962. }
  9963. }, {
  9964. key: "value",
  9965. get: function get() {
  9966. return this.address.value;
  9967. }
  9968. }, {
  9969. key: "number",
  9970. get: function get() {
  9971. if (this.value instanceof decimal_js__WEBPACK_IMPORTED_MODULE_1___default.a) {
  9972. return this.value.toNumber();
  9973. } else {
  9974. return null;
  9975. }
  9976. }
  9977. }]);
  9978. return StoreObjectArrayAddressRef;
  9979. }(_storeObject__WEBPACK_IMPORTED_MODULE_0__["StoreObject"]);
  9980. /***/ }),
  9981. /***/ "./js/processor/store/storeObjectRef.js":
  9982. /*!**********************************************!*\
  9983. !*** ./js/processor/store/storeObjectRef.js ***!
  9984. \**********************************************/
  9985. /*! exports provided: StoreObjectRef */
  9986. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  9987. "use strict";
  9988. __webpack_require__.r(__webpack_exports__);
  9989. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "StoreObjectRef", function() { return StoreObjectRef; });
  9990. /* harmony import */ var _storeObject__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./storeObject */ "./js/processor/store/storeObject.js");
  9991. /* harmony import */ var decimal_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! decimal.js */ "./node_modules/decimal.js/decimal.js");
  9992. /* harmony import */ var decimal_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(decimal_js__WEBPACK_IMPORTED_MODULE_1__);
  9993. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  9994. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  9995. 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); } }
  9996. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  9997. function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
  9998. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  9999. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  10000. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
  10001. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  10002. var StoreObjectRef =
  10003. /*#__PURE__*/
  10004. function (_StoreObject) {
  10005. _inherits(StoreObjectRef, _StoreObject);
  10006. function StoreObjectRef(refID, store) {
  10007. var _this;
  10008. _classCallCheck(this, StoreObjectRef);
  10009. _this = _possibleConstructorReturn(this, _getPrototypeOf(StoreObjectRef).call(this, null, null, false));
  10010. _this.refID = refID;
  10011. _this.store = store;
  10012. return _this;
  10013. }
  10014. _createClass(StoreObjectRef, [{
  10015. key: "getRefObj",
  10016. value: function getRefObj() {
  10017. return this.store.applyStore(this.refID);
  10018. }
  10019. }, {
  10020. key: "updateRef",
  10021. value: function updateRef(stoObj) {
  10022. this.store.updateStore(this.refID, stoObj);
  10023. }
  10024. }, {
  10025. key: "isCompatible",
  10026. value: function isCompatible(another) {
  10027. return this.store.applyStore(this.refID).isCompatible(another);
  10028. }
  10029. }, {
  10030. key: "isRef",
  10031. get: function get() {
  10032. return true;
  10033. }
  10034. }, {
  10035. key: "type",
  10036. get: function get() {
  10037. return this.store.applyStore(this.refID).type;
  10038. }
  10039. }, {
  10040. key: "value",
  10041. get: function get() {
  10042. return this.store.applyStore(this.refID).value;
  10043. }
  10044. }, {
  10045. key: "number",
  10046. get: function get() {
  10047. if (this.value instanceof decimal_js__WEBPACK_IMPORTED_MODULE_1___default.a) {
  10048. return this.value.toNumber();
  10049. } else {
  10050. return null;
  10051. }
  10052. }
  10053. }]);
  10054. return StoreObjectRef;
  10055. }(_storeObject__WEBPACK_IMPORTED_MODULE_0__["StoreObject"]);
  10056. /***/ }),
  10057. /***/ "./js/runner.js":
  10058. /*!**********************!*\
  10059. !*** ./js/runner.js ***!
  10060. \**********************/
  10061. /*! exports provided: runner */
  10062. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  10063. "use strict";
  10064. __webpack_require__.r(__webpack_exports__);
  10065. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "runner", function() { return runner; });
  10066. /* harmony import */ var _ast_ivprogParser__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./ast/ivprogParser */ "./js/ast/ivprogParser.js");
  10067. /* harmony import */ var _processor_ivprogProcessor__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./processor/ivprogProcessor */ "./js/processor/ivprogProcessor.js");
  10068. /* harmony import */ var _io_domConsole__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./io/domConsole */ "./js/io/domConsole.js");
  10069. /* harmony import */ var _services_languageService__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./services/languageService */ "./js/services/languageService.js");
  10070. /* harmony import */ var _processor_semantic_semanticAnalyser__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./processor/semantic/semanticAnalyser */ "./js/processor/semantic/semanticAnalyser.js");
  10071. function runner() {
  10072. var ivprogLexer = _services_languageService__WEBPACK_IMPORTED_MODULE_3__["LanguageService"].getCurrentLexer(); // const lexer = new ivprogLexer(new InputStream(input));
  10073. // const stream = new CommonTokenStream(lexer);
  10074. // stream.fill();
  10075. // let i = 1;
  10076. // let token = null;
  10077. // while ((token = stream.LT(i)).type !== ivprogLexer.EOF && token.type !== ivprogLexer.WHITESPACE) {
  10078. // console.log(`${token.type}-${token.text}`);
  10079. // console.log('\n')
  10080. // i++;
  10081. // }
  10082. // const anaSin = new IVProgParser(input, ivprogLexer);
  10083. var editor = new JsonEditor('#json-renderer', {});
  10084. var domConsole = new _io_domConsole__WEBPACK_IMPORTED_MODULE_2__["DOMConsole"]("#console"); // proc.interpretAST().then( sto => {
  10085. // console.log(sto.applyStore('a'));
  10086. // }).catch(e => console.log(e));
  10087. try {
  10088. $('#btn').click(function () {
  10089. var input = $('#input').val();
  10090. var analiser = new _ast_ivprogParser__WEBPACK_IMPORTED_MODULE_0__["IVProgParser"](input, ivprogLexer);
  10091. try {
  10092. var data = analiser.parseTree();
  10093. var semAna = new _processor_semantic_semanticAnalyser__WEBPACK_IMPORTED_MODULE_4__["SemanticAnalyser"](data);
  10094. var proc = new _processor_ivprogProcessor__WEBPACK_IMPORTED_MODULE_1__["IVProgProcessor"](semAna.analyseTree());
  10095. proc.registerInput(domConsole);
  10096. domConsole.clear();
  10097. proc.registerOutput(domConsole);
  10098. proc.interpretAST().then(function (sto) {
  10099. return editor.load(sto.store);
  10100. }).catch(function (e) {
  10101. alert(e);
  10102. console.log(e);
  10103. });
  10104. } catch (error) {
  10105. alert(error);
  10106. console.log(error);
  10107. }
  10108. });
  10109. } catch (a) {
  10110. console.log(a);
  10111. }
  10112. }
  10113. /***/ }),
  10114. /***/ "./js/semantic/semantic.min.js":
  10115. /*!*************************************!*\
  10116. !*** ./js/semantic/semantic.min.js ***!
  10117. \*************************************/
  10118. /*! no static exports found */
  10119. /***/ (function(module, exports) {
  10120. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  10121. /*
  10122. * # Semantic UI - 2.3.3
  10123. * https://github.com/Semantic-Org/Semantic-UI
  10124. * http://www.semantic-ui.com/
  10125. *
  10126. * Copyright 2014 Contributors
  10127. * Released under the MIT license
  10128. * http://opensource.org/licenses/MIT
  10129. *
  10130. */
  10131. !function (e, t, n, i) {
  10132. e.site = e.fn.site = function (o) {
  10133. var a,
  10134. r,
  10135. s = new Date().getTime(),
  10136. l = [],
  10137. c = arguments[0],
  10138. u = "string" == typeof c,
  10139. d = [].slice.call(arguments, 1),
  10140. f = e.isPlainObject(o) ? e.extend(!0, {}, e.site.settings, o) : e.extend({}, e.site.settings),
  10141. m = f.namespace,
  10142. g = f.error,
  10143. p = "module-" + m,
  10144. h = e(n),
  10145. v = this,
  10146. b = h.data(p);
  10147. return a = {
  10148. initialize: function initialize() {
  10149. a.instantiate();
  10150. },
  10151. instantiate: function instantiate() {
  10152. a.verbose("Storing instance of site", a), b = a, h.data(p, a);
  10153. },
  10154. normalize: function normalize() {
  10155. a.fix.console(), a.fix.requestAnimationFrame();
  10156. },
  10157. fix: {
  10158. console: function (_console) {
  10159. function console() {
  10160. return _console.apply(this, arguments);
  10161. }
  10162. console.toString = function () {
  10163. return _console.toString();
  10164. };
  10165. return console;
  10166. }(function () {
  10167. 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 () {});
  10168. }),
  10169. consoleClear: function consoleClear() {
  10170. a.debug("Disabling programmatic console clearing"), t.console.clear = function () {};
  10171. },
  10172. requestAnimationFrame: function requestAnimationFrame() {
  10173. 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) {
  10174. setTimeout(e, 0);
  10175. });
  10176. }
  10177. },
  10178. moduleExists: function moduleExists(t) {
  10179. return e.fn[t] !== i && e.fn[t].settings !== i;
  10180. },
  10181. enabled: {
  10182. modules: function modules(t) {
  10183. var n = [];
  10184. return t = t || f.modules, e.each(t, function (e, t) {
  10185. a.moduleExists(t) && n.push(t);
  10186. }), n;
  10187. }
  10188. },
  10189. disabled: {
  10190. modules: function modules(t) {
  10191. var n = [];
  10192. return t = t || f.modules, e.each(t, function (e, t) {
  10193. a.moduleExists(t) || n.push(t);
  10194. }), n;
  10195. }
  10196. },
  10197. change: {
  10198. setting: function setting(t, n, o, r) {
  10199. o = "string" == typeof o ? "all" === o ? f.modules : [o] : o || f.modules, r = r === i || r, e.each(o, function (i, o) {
  10200. var s,
  10201. l = !a.moduleExists(o) || e.fn[o].settings.namespace || !1;
  10202. 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)));
  10203. });
  10204. },
  10205. settings: function settings(t, n, o) {
  10206. n = "string" == typeof n ? [n] : n || f.modules, o = o === i || o, e.each(n, function (n, i) {
  10207. var r;
  10208. 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)));
  10209. });
  10210. }
  10211. },
  10212. enable: {
  10213. console: function console() {
  10214. a.console(!0);
  10215. },
  10216. debug: function debug(e, t) {
  10217. e = e || f.modules, a.debug("Enabling debug for modules", e), a.change.setting("debug", !0, e, t);
  10218. },
  10219. verbose: function verbose(e, t) {
  10220. e = e || f.modules, a.debug("Enabling verbose debug for modules", e), a.change.setting("verbose", !0, e, t);
  10221. }
  10222. },
  10223. disable: {
  10224. console: function console() {
  10225. a.console(!1);
  10226. },
  10227. debug: function debug(e, t) {
  10228. e = e || f.modules, a.debug("Disabling debug for modules", e), a.change.setting("debug", !1, e, t);
  10229. },
  10230. verbose: function verbose(e, t) {
  10231. e = e || f.modules, a.debug("Disabling verbose debug for modules", e), a.change.setting("verbose", !1, e, t);
  10232. }
  10233. },
  10234. console: function console(e) {
  10235. if (e) {
  10236. if (b.cache.console === i) return void a.error(g.console);
  10237. a.debug("Restoring console function"), t.console = b.cache.console;
  10238. } else a.debug("Disabling console function"), b.cache.console = t.console, t.console = {
  10239. clear: function clear() {},
  10240. error: function error() {},
  10241. group: function group() {},
  10242. groupCollapsed: function groupCollapsed() {},
  10243. groupEnd: function groupEnd() {},
  10244. info: function info() {},
  10245. log: function log() {},
  10246. markTimeline: function markTimeline() {},
  10247. warn: function warn() {}
  10248. };
  10249. },
  10250. destroy: function destroy() {
  10251. a.verbose("Destroying previous site for", h), h.removeData(p);
  10252. },
  10253. cache: {},
  10254. setting: function setting(t, n) {
  10255. if (e.isPlainObject(t)) e.extend(!0, f, t);else {
  10256. if (n === i) return f[t];
  10257. f[t] = n;
  10258. }
  10259. },
  10260. internal: function internal(t, n) {
  10261. if (e.isPlainObject(t)) e.extend(!0, a, t);else {
  10262. if (n === i) return a[t];
  10263. a[t] = n;
  10264. }
  10265. },
  10266. debug: function debug() {
  10267. f.debug && (f.performance ? a.performance.log(arguments) : (a.debug = Function.prototype.bind.call(console.info, console, f.name + ":"), a.debug.apply(console, arguments)));
  10268. },
  10269. verbose: function verbose() {
  10270. 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)));
  10271. },
  10272. error: function error() {
  10273. a.error = Function.prototype.bind.call(console.error, console, f.name + ":"), a.error.apply(console, arguments);
  10274. },
  10275. performance: {
  10276. log: function log(e) {
  10277. var t, n;
  10278. f.performance && (n = (t = new Date().getTime()) - (s || t), s = t, l.push({
  10279. Element: v,
  10280. Name: e[0],
  10281. Arguments: [].slice.call(e, 1) || "",
  10282. "Execution Time": n
  10283. })), clearTimeout(a.performance.timer), a.performance.timer = setTimeout(a.performance.display, 500);
  10284. },
  10285. display: function display() {
  10286. var t = f.name + ":",
  10287. n = 0;
  10288. s = !1, clearTimeout(a.performance.timer), e.each(l, function (e, t) {
  10289. n += t["Execution Time"];
  10290. }), 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) {
  10291. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  10292. }), console.groupEnd()), l = [];
  10293. }
  10294. },
  10295. invoke: function invoke(t, n, o) {
  10296. var s,
  10297. l,
  10298. c,
  10299. u = b;
  10300. 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) {
  10301. var r = n != s ? o + t[n + 1].charAt(0).toUpperCase() + t[n + 1].slice(1) : t;
  10302. if (e.isPlainObject(u[r]) && n != s) u = u[r];else {
  10303. if (u[r] !== i) return l = u[r], !1;
  10304. if (!e.isPlainObject(u[o]) || n == s) return u[o] !== i ? (l = u[o], !1) : (a.error(g.method, t), !1);
  10305. u = u[o];
  10306. }
  10307. })), 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;
  10308. }
  10309. }, u ? (b === i && a.initialize(), a.invoke(c)) : (b !== i && a.destroy(), a.initialize()), r !== i ? r : this;
  10310. }, e.site.settings = {
  10311. name: "Site",
  10312. namespace: "site",
  10313. error: {
  10314. console: "Console cannot be restored, most likely it was overwritten outside of module",
  10315. method: "The method you called is not defined."
  10316. },
  10317. debug: !1,
  10318. verbose: !1,
  10319. performance: !0,
  10320. modules: ["accordion", "api", "checkbox", "dimmer", "dropdown", "embed", "form", "modal", "nag", "popup", "rating", "shape", "sidebar", "state", "sticky", "tab", "transition", "visit", "visibility"],
  10321. siteNamespace: "site",
  10322. namespaceStub: {
  10323. cache: {},
  10324. config: {},
  10325. sections: {},
  10326. section: {},
  10327. utilities: {}
  10328. }
  10329. }, e.extend(e.expr[":"], {
  10330. data: e.expr.createPseudo ? e.expr.createPseudo(function (t) {
  10331. return function (n) {
  10332. return !!e.data(n, t);
  10333. };
  10334. }) : function (t, n, i) {
  10335. return !!e.data(t, i[3]);
  10336. }
  10337. });
  10338. }(jQuery, window, document), function (e, t, n, i) {
  10339. "use strict";
  10340. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.form = function (t) {
  10341. var o,
  10342. a = e(this),
  10343. r = a.selector || "",
  10344. s = new Date().getTime(),
  10345. l = [],
  10346. c = arguments[0],
  10347. u = arguments[1],
  10348. d = "string" == typeof c,
  10349. f = [].slice.call(arguments, 1);
  10350. return a.each(function () {
  10351. var m,
  10352. g,
  10353. p,
  10354. h,
  10355. v,
  10356. b,
  10357. y,
  10358. x,
  10359. C,
  10360. w,
  10361. S,
  10362. k,
  10363. T,
  10364. A,
  10365. R,
  10366. P,
  10367. E = e(this),
  10368. F = this,
  10369. O = [],
  10370. D = !1;
  10371. (P = {
  10372. initialize: function initialize() {
  10373. 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());
  10374. },
  10375. instantiate: function instantiate() {
  10376. P.verbose("Storing instance of module", P), R = P, E.data(T, P);
  10377. },
  10378. destroy: function destroy() {
  10379. P.verbose("Destroying previous module", R), P.removeEvents(), E.removeData(T);
  10380. },
  10381. refresh: function refresh() {
  10382. 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);
  10383. },
  10384. submit: function submit() {
  10385. P.verbose("Submitting form", E), E.submit();
  10386. },
  10387. attachEvents: function attachEvents(t, n) {
  10388. n = n || "submit", e(t).on("click" + A, function (e) {
  10389. P[n](), e.preventDefault();
  10390. });
  10391. },
  10392. bindEvents: function bindEvents() {
  10393. 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 () {
  10394. var t = e(this),
  10395. n = t.prop("type"),
  10396. i = P.get.changeEvent(n, t);
  10397. e(this).on(i + A, P.event.field.change);
  10398. });
  10399. },
  10400. clear: function clear() {
  10401. m.each(function () {
  10402. var t = e(this),
  10403. n = t.parent(),
  10404. i = t.closest(g),
  10405. o = i.find(x.prompt),
  10406. a = t.data(y.defaultValue) || "",
  10407. r = n.is(x.uiCheckbox),
  10408. s = n.is(x.uiDropdown);
  10409. 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(""));
  10410. });
  10411. },
  10412. reset: function reset() {
  10413. m.each(function () {
  10414. var t = e(this),
  10415. n = t.parent(),
  10416. o = t.closest(g),
  10417. a = o.find(x.prompt),
  10418. r = t.data(y.defaultValue),
  10419. s = n.is(x.uiCheckbox),
  10420. l = n.is(x.uiDropdown),
  10421. c = o.hasClass(C.error);
  10422. 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)));
  10423. });
  10424. },
  10425. determine: {
  10426. isValid: function isValid() {
  10427. var t = !0;
  10428. return e.each(b, function (e, n) {
  10429. P.validate.field(n, e, !0) || (t = !1);
  10430. }), t;
  10431. }
  10432. },
  10433. is: {
  10434. bracketedRule: function bracketedRule(e) {
  10435. return e.type && e.type.match(v.regExp.bracket);
  10436. },
  10437. shorthandFields: function shorthandFields(e) {
  10438. var t = e[Object.keys(e)[0]];
  10439. return P.is.shorthandRules(t);
  10440. },
  10441. shorthandRules: function shorthandRules(t) {
  10442. return "string" == typeof t || e.isArray(t);
  10443. },
  10444. empty: function empty(e) {
  10445. return !e || 0 === e.length || (e.is('input[type="checkbox"]') ? !e.is(":checked") : P.is.blank(e));
  10446. },
  10447. blank: function blank(t) {
  10448. return "" === e.trim(t.val());
  10449. },
  10450. valid: function valid(t) {
  10451. var n = !0;
  10452. 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) {
  10453. P.is.valid(e) || (n = !1);
  10454. }), n);
  10455. }
  10456. },
  10457. removeEvents: function removeEvents() {
  10458. E.off(A), m.off(A), h.off(A), m.off(A);
  10459. },
  10460. event: {
  10461. field: {
  10462. keydown: function keydown(t) {
  10463. var n = e(this),
  10464. i = t.which,
  10465. o = n.is(x.input),
  10466. a = n.is(x.checkbox),
  10467. r = n.closest(x.uiDropdown).length > 0,
  10468. s = 13;
  10469. 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);
  10470. },
  10471. keyup: function keyup() {
  10472. D = !1;
  10473. },
  10474. blur: function blur(t) {
  10475. var n = e(this),
  10476. i = n.closest(g),
  10477. o = P.get.validation(n);
  10478. i.hasClass(C.error) ? (P.debug("Revalidating field", n, o), o && P.validate.field(o)) : "blur" == v.on && o && P.validate.field(o);
  10479. },
  10480. change: function change(t) {
  10481. var n = e(this),
  10482. i = n.closest(g),
  10483. o = P.get.validation(n);
  10484. o && ("change" == v.on || i.hasClass(C.error) && v.revalidate) && (clearTimeout(P.timer), P.timer = setTimeout(function () {
  10485. P.debug("Revalidating field", n, P.get.validation(n)), P.validate.field(o);
  10486. }, v.delay));
  10487. }
  10488. }
  10489. },
  10490. get: {
  10491. ancillaryValue: function ancillaryValue(e) {
  10492. return !(!e.type || !e.value && !P.is.bracketedRule(e)) && (e.value !== i ? e.value : e.type.match(v.regExp.bracket)[1] + "");
  10493. },
  10494. ruleName: function ruleName(e) {
  10495. return P.is.bracketedRule(e) ? e.type.replace(e.type.match(v.regExp.bracket)[0], "") : e.type;
  10496. },
  10497. changeEvent: function changeEvent(e, t) {
  10498. return "checkbox" == e || "radio" == e || "hidden" == e || t.is("select") ? "change" : P.get.inputEvent();
  10499. },
  10500. inputEvent: function inputEvent() {
  10501. return n.createElement("input").oninput !== i ? "input" : n.createElement("input").onpropertychange !== i ? "propertychange" : "keyup";
  10502. },
  10503. fieldsFromShorthand: function fieldsFromShorthand(t) {
  10504. var n = {};
  10505. return e.each(t, function (t, i) {
  10506. "string" == typeof i && (i = [i]), n[t] = {
  10507. rules: []
  10508. }, e.each(i, function (e, i) {
  10509. n[t].rules.push({
  10510. type: i
  10511. });
  10512. });
  10513. }), n;
  10514. },
  10515. prompt: function prompt(t, n) {
  10516. var i,
  10517. o,
  10518. a = P.get.ruleName(t),
  10519. r = P.get.ancillaryValue(t),
  10520. s = P.get.field(n.identifier),
  10521. l = s.val(),
  10522. c = e.isFunction(t.prompt) ? t.prompt(l) : t.prompt || v.prompt[a] || v.text.unspecifiedRule,
  10523. u = -1 !== c.search("{value}"),
  10524. d = -1 !== c.search("{name}");
  10525. 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;
  10526. },
  10527. settings: function settings() {
  10528. if (e.isPlainObject(t)) {
  10529. var n = Object.keys(t);
  10530. 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));
  10531. } else v = e.fn.form.settings, b = e.fn.form.settings.defaults, P.verbose("Using default form validation", b, v);
  10532. 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();
  10533. },
  10534. field: function field(t) {
  10535. 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/>");
  10536. },
  10537. fields: function fields(t) {
  10538. var n = e();
  10539. return e.each(t, function (e, t) {
  10540. n = n.add(P.get.field(t));
  10541. }), n;
  10542. },
  10543. validation: function validation(t) {
  10544. var n, i;
  10545. return !!b && (e.each(b, function (e, o) {
  10546. i = o.identifier || e, P.get.field(i)[0] == t[0] && (o.identifier = i, n = o);
  10547. }), n || !1);
  10548. },
  10549. value: function value(e) {
  10550. var t = [];
  10551. return t.push(e), P.get.values.call(F, t)[e];
  10552. },
  10553. values: function values(t) {
  10554. var n = {};
  10555. return (e.isArray(t) ? P.get.fields(t) : m).each(function (t, o) {
  10556. var a = e(o),
  10557. r = (a.prop("type"), a.prop("name")),
  10558. s = a.val(),
  10559. l = a.is(x.checkbox),
  10560. c = a.is(x.radio),
  10561. u = -1 !== r.indexOf("[]"),
  10562. d = !!l && a.is(":checked");
  10563. 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);
  10564. }), n;
  10565. }
  10566. },
  10567. has: {
  10568. field: function field(e) {
  10569. 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;
  10570. }
  10571. },
  10572. escape: {
  10573. string: function string(e) {
  10574. return (e = String(e)).replace(w.escape, "\\$&");
  10575. }
  10576. },
  10577. add: {
  10578. rule: function rule(e, t) {
  10579. P.add.field(e, t);
  10580. },
  10581. field: function field(t, n) {
  10582. var i = {};
  10583. P.is.shorthandRules(n) ? (n = e.isArray(n) ? n : [n], i[t] = {
  10584. rules: []
  10585. }, e.each(n, function (e, n) {
  10586. i[t].rules.push({
  10587. type: n
  10588. });
  10589. })) : i[t] = n, b = e.extend({}, b, i), P.debug("Adding rules", i, b);
  10590. },
  10591. fields: function fields(t) {
  10592. var n;
  10593. n = t && P.is.shorthandFields(t) ? P.get.fieldsFromShorthand(t) : t, b = e.extend({}, b, n);
  10594. },
  10595. prompt: function prompt(t, n) {
  10596. var o = P.get.field(t).closest(g),
  10597. a = o.children(x.prompt),
  10598. r = 0 !== a.length;
  10599. 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)));
  10600. },
  10601. errors: function errors(e) {
  10602. P.debug("Adding form error messages", e), P.set.error(), p.html(v.templates.error(e));
  10603. }
  10604. },
  10605. remove: {
  10606. rule: function rule(t, n) {
  10607. var o = e.isArray(n) ? n : [n];
  10608. if (n == i) return P.debug("Removed all rules"), void (b[t].rules = []);
  10609. b[t] != i && e.isArray(b[t].rules) && e.each(b[t].rules, function (e, n) {
  10610. -1 !== o.indexOf(n.type) && (P.debug("Removed rule", n.type), b[t].rules.splice(e, 1));
  10611. });
  10612. },
  10613. field: function field(t) {
  10614. var n = e.isArray(t) ? t : [t];
  10615. e.each(n, function (e, t) {
  10616. P.remove.rule(t);
  10617. });
  10618. },
  10619. rules: function rules(t, n) {
  10620. e.isArray(t) ? e.each(fields, function (e, t) {
  10621. P.remove.rule(t, n);
  10622. }) : P.remove.rule(t, n);
  10623. },
  10624. fields: function fields(e) {
  10625. P.remove.field(e);
  10626. },
  10627. prompt: function prompt(t) {
  10628. var n = P.get.field(t).closest(g),
  10629. o = n.children(x.prompt);
  10630. 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 () {
  10631. o.remove();
  10632. }) : o.fadeOut(v.duration, function () {
  10633. o.remove();
  10634. }));
  10635. }
  10636. },
  10637. set: {
  10638. success: function success() {
  10639. E.removeClass(C.error).addClass(C.success);
  10640. },
  10641. defaults: function defaults() {
  10642. m.each(function () {
  10643. var t = e(this),
  10644. n = t.filter(x.checkbox).length > 0 ? t.is(":checked") : t.val();
  10645. t.data(y.defaultValue, n);
  10646. });
  10647. },
  10648. error: function error() {
  10649. E.removeClass(C.success).addClass(C.error);
  10650. },
  10651. value: function value(e, t) {
  10652. var n = {};
  10653. return n[e] = t, P.set.values.call(F, n);
  10654. },
  10655. values: function values(t) {
  10656. e.isEmptyObject(t) || e.each(t, function (t, n) {
  10657. var i,
  10658. o = P.get.field(t),
  10659. a = o.parent(),
  10660. r = e.isArray(n),
  10661. s = a.is(x.uiCheckbox),
  10662. l = a.is(x.uiDropdown),
  10663. c = o.is(x.radio) && s;
  10664. o.length > 0 && (r && s ? (P.verbose("Selecting multiple", n, o), a.checkbox("uncheck"), e.each(n, function (e, t) {
  10665. i = o.filter('[value="' + t + '"]'), a = i.parent(), i.length > 0 && a.checkbox("check");
  10666. })) : 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)));
  10667. });
  10668. }
  10669. },
  10670. validate: {
  10671. form: function form(e, t) {
  10672. var n = P.get.values();
  10673. if (D) return !1;
  10674. if (O = [], P.determine.isValid()) {
  10675. if (P.debug("Form has no validation errors, submitting"), P.set.success(), !0 !== t) return v.onSuccess.call(F, e, n);
  10676. } 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);
  10677. },
  10678. field: function field(t, n, o) {
  10679. o = o === i || o, "string" == typeof t && (P.verbose("Validating field", t), n = t, t = b[t]);
  10680. var a = t.identifier || n,
  10681. r = P.get.field(a),
  10682. s = !!t.depends && P.get.field(t.depends),
  10683. l = !0,
  10684. c = [];
  10685. 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) {
  10686. 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);
  10687. }), 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);
  10688. },
  10689. rule: function rule(t, n) {
  10690. var o = P.get.field(t.identifier),
  10691. a = (n.type, o.val()),
  10692. r = P.get.ancillaryValue(n),
  10693. s = P.get.ruleName(n),
  10694. l = v.rules[s];
  10695. if (e.isFunction(l)) return a = a === i || "" === a || null === a ? "" : e.trim(a + ""), l.call(o, a, r);
  10696. P.error(S.noRule, s);
  10697. }
  10698. },
  10699. setting: function setting(t, n) {
  10700. if (e.isPlainObject(t)) e.extend(!0, v, t);else {
  10701. if (n === i) return v[t];
  10702. v[t] = n;
  10703. }
  10704. },
  10705. internal: function internal(t, n) {
  10706. if (e.isPlainObject(t)) e.extend(!0, P, t);else {
  10707. if (n === i) return P[t];
  10708. P[t] = n;
  10709. }
  10710. },
  10711. debug: function debug() {
  10712. !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)));
  10713. },
  10714. verbose: function verbose() {
  10715. !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)));
  10716. },
  10717. error: function error() {
  10718. v.silent || (P.error = Function.prototype.bind.call(console.error, console, v.name + ":"), P.error.apply(console, arguments));
  10719. },
  10720. performance: {
  10721. log: function log(e) {
  10722. var t, n;
  10723. v.performance && (n = (t = new Date().getTime()) - (s || t), s = t, l.push({
  10724. Name: e[0],
  10725. Arguments: [].slice.call(e, 1) || "",
  10726. Element: F,
  10727. "Execution Time": n
  10728. })), clearTimeout(P.performance.timer), P.performance.timer = setTimeout(P.performance.display, 500);
  10729. },
  10730. display: function display() {
  10731. var t = v.name + ":",
  10732. n = 0;
  10733. s = !1, clearTimeout(P.performance.timer), e.each(l, function (e, t) {
  10734. n += t["Execution Time"];
  10735. }), 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) {
  10736. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  10737. }), console.groupEnd()), l = [];
  10738. }
  10739. },
  10740. invoke: function invoke(t, n, a) {
  10741. var r,
  10742. s,
  10743. l,
  10744. c = R;
  10745. 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) {
  10746. var a = n != r ? o + t[n + 1].charAt(0).toUpperCase() + t[n + 1].slice(1) : t;
  10747. if (e.isPlainObject(c[a]) && n != r) c = c[a];else {
  10748. if (c[a] !== i) return s = c[a], !1;
  10749. if (!e.isPlainObject(c[o]) || n == r) return c[o] !== i && (s = c[o], !1);
  10750. c = c[o];
  10751. }
  10752. })), 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;
  10753. }
  10754. }).initialize();
  10755. }), o !== i ? o : this;
  10756. }, e.fn.form.settings = {
  10757. name: "Form",
  10758. namespace: "form",
  10759. debug: !1,
  10760. verbose: !1,
  10761. performance: !0,
  10762. fields: !1,
  10763. keyboardShortcuts: !0,
  10764. on: "submit",
  10765. inline: !1,
  10766. delay: 200,
  10767. revalidate: !0,
  10768. transition: "scale",
  10769. duration: 200,
  10770. onValid: function onValid() {},
  10771. onInvalid: function onInvalid() {},
  10772. onSuccess: function onSuccess() {
  10773. return !0;
  10774. },
  10775. onFailure: function onFailure() {
  10776. return !1;
  10777. },
  10778. metadata: {
  10779. defaultValue: "default",
  10780. validate: "validate"
  10781. },
  10782. regExp: {
  10783. htmlID: /^[a-zA-Z][\w:.-]*$/g,
  10784. bracket: /\[(.*)\]/i,
  10785. decimal: /^\d+\.?\d*$/,
  10786. email: /^[a-z0-9!#$%&'*+\/=?^_`{|}~.-]+@[a-z0-9]([a-z0-9-]*[a-z0-9])?(\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)*$/i,
  10787. escape: /[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,
  10788. flags: /^\/(.*)\/(.*)?/,
  10789. integer: /^\-?\d+$/,
  10790. number: /^\-?\d*(\.\d+)?$/,
  10791. url: /(https?:\/\/(?:www\.|(?!www))[^\s\.]+\.[^\s]{2,}|www\.[^\s]+\.[^\s]{2,})/i
  10792. },
  10793. text: {
  10794. unspecifiedRule: "Please enter a valid value",
  10795. unspecifiedField: "This field"
  10796. },
  10797. prompt: {
  10798. empty: "{name} must have a value",
  10799. checked: "{name} must be checked",
  10800. email: "{name} must be a valid e-mail",
  10801. url: "{name} must be a valid url",
  10802. regExp: "{name} is not formatted correctly",
  10803. integer: "{name} must be an integer",
  10804. decimal: "{name} must be a decimal number",
  10805. number: "{name} must be set to a number",
  10806. is: '{name} must be "{ruleValue}"',
  10807. isExactly: '{name} must be exactly "{ruleValue}"',
  10808. not: '{name} cannot be set to "{ruleValue}"',
  10809. notExactly: '{name} cannot be set to exactly "{ruleValue}"',
  10810. contain: '{name} must contain "{ruleValue}"',
  10811. containExactly: '{name} must contain exactly "{ruleValue}"',
  10812. doesntContain: '{name} cannot contain "{ruleValue}"',
  10813. doesntContainExactly: '{name} cannot contain exactly "{ruleValue}"',
  10814. minLength: "{name} must be at least {ruleValue} characters",
  10815. length: "{name} must be at least {ruleValue} characters",
  10816. exactLength: "{name} must be exactly {ruleValue} characters",
  10817. maxLength: "{name} cannot be longer than {ruleValue} characters",
  10818. match: "{name} must match {ruleValue} field",
  10819. different: "{name} must have a different value than {ruleValue} field",
  10820. creditCard: "{name} must be a valid credit card number",
  10821. minCount: "{name} must have at least {ruleValue} choices",
  10822. exactCount: "{name} must have exactly {ruleValue} choices",
  10823. maxCount: "{name} must have {ruleValue} or less choices"
  10824. },
  10825. selector: {
  10826. checkbox: 'input[type="checkbox"], input[type="radio"]',
  10827. clear: ".clear",
  10828. field: "input, textarea, select",
  10829. group: ".field",
  10830. input: "input",
  10831. message: ".error.message",
  10832. prompt: ".prompt.label",
  10833. radio: 'input[type="radio"]',
  10834. reset: '.reset:not([type="reset"])',
  10835. submit: '.submit:not([type="submit"])',
  10836. uiCheckbox: ".ui.checkbox",
  10837. uiDropdown: ".ui.dropdown"
  10838. },
  10839. className: {
  10840. error: "error",
  10841. label: "ui prompt label",
  10842. pressed: "down",
  10843. success: "success"
  10844. },
  10845. error: {
  10846. identifier: "You must specify a string identifier for each field",
  10847. method: "The method you called is not defined.",
  10848. noRule: "There is no rule matching the one you specified",
  10849. oldSyntax: "Starting in 2.0 forms now only take a single settings object. Validation settings converted to new syntax automatically."
  10850. },
  10851. templates: {
  10852. error: function error(t) {
  10853. var n = '<ul class="list">';
  10854. return e.each(t, function (e, t) {
  10855. n += "<li>" + t + "</li>";
  10856. }), e(n += "</ul>");
  10857. },
  10858. prompt: function prompt(t) {
  10859. return e("<div/>").addClass("ui basic red pointing prompt label").html(t[0]);
  10860. }
  10861. },
  10862. rules: {
  10863. empty: function empty(t) {
  10864. return !(t === i || "" === t || e.isArray(t) && 0 === t.length);
  10865. },
  10866. checked: function checked() {
  10867. return e(this).filter(":checked").length > 0;
  10868. },
  10869. email: function email(t) {
  10870. return e.fn.form.settings.regExp.email.test(t);
  10871. },
  10872. url: function url(t) {
  10873. return e.fn.form.settings.regExp.url.test(t);
  10874. },
  10875. regExp: function regExp(t, n) {
  10876. if (n instanceof RegExp) return t.match(n);
  10877. var i,
  10878. o = n.match(e.fn.form.settings.regExp.flags);
  10879. return o && (n = o.length >= 2 ? o[1] : n, i = o.length >= 3 ? o[2] : ""), t.match(new RegExp(n, i));
  10880. },
  10881. integer: function integer(t, n) {
  10882. var o,
  10883. a,
  10884. r,
  10885. s = e.fn.form.settings.regExp.integer;
  10886. 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);
  10887. },
  10888. decimal: function decimal(t) {
  10889. return e.fn.form.settings.regExp.decimal.test(t);
  10890. },
  10891. number: function number(t) {
  10892. return e.fn.form.settings.regExp.number.test(t);
  10893. },
  10894. is: function is(e, t) {
  10895. return t = "string" == typeof t ? t.toLowerCase() : t, (e = "string" == typeof e ? e.toLowerCase() : e) == t;
  10896. },
  10897. isExactly: function isExactly(e, t) {
  10898. return e == t;
  10899. },
  10900. not: function not(e, t) {
  10901. return (e = "string" == typeof e ? e.toLowerCase() : e) != (t = "string" == typeof t ? t.toLowerCase() : t);
  10902. },
  10903. notExactly: function notExactly(e, t) {
  10904. return e != t;
  10905. },
  10906. contains: function contains(t, n) {
  10907. return n = n.replace(e.fn.form.settings.regExp.escape, "\\$&"), -1 !== t.search(new RegExp(n, "i"));
  10908. },
  10909. containsExactly: function containsExactly(t, n) {
  10910. return n = n.replace(e.fn.form.settings.regExp.escape, "\\$&"), -1 !== t.search(new RegExp(n));
  10911. },
  10912. doesntContain: function doesntContain(t, n) {
  10913. return n = n.replace(e.fn.form.settings.regExp.escape, "\\$&"), -1 === t.search(new RegExp(n, "i"));
  10914. },
  10915. doesntContainExactly: function doesntContainExactly(t, n) {
  10916. return n = n.replace(e.fn.form.settings.regExp.escape, "\\$&"), -1 === t.search(new RegExp(n));
  10917. },
  10918. minLength: function minLength(e, t) {
  10919. return e !== i && e.length >= t;
  10920. },
  10921. length: function length(e, t) {
  10922. return e !== i && e.length >= t;
  10923. },
  10924. exactLength: function exactLength(e, t) {
  10925. return e !== i && e.length == t;
  10926. },
  10927. maxLength: function maxLength(e, t) {
  10928. return e !== i && e.length <= t;
  10929. },
  10930. match: function match(t, n) {
  10931. var o;
  10932. e(this);
  10933. 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();
  10934. },
  10935. different: function different(t, n) {
  10936. var o;
  10937. e(this);
  10938. 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();
  10939. },
  10940. creditCard: function creditCard(t, n) {
  10941. var i,
  10942. o,
  10943. a = {
  10944. visa: {
  10945. pattern: /^4/,
  10946. length: [16]
  10947. },
  10948. amex: {
  10949. pattern: /^3[47]/,
  10950. length: [15]
  10951. },
  10952. mastercard: {
  10953. pattern: /^5[1-5]/,
  10954. length: [16]
  10955. },
  10956. discover: {
  10957. 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)/,
  10958. length: [16]
  10959. },
  10960. unionPay: {
  10961. pattern: /^(62|88)/,
  10962. length: [16, 17, 18, 19]
  10963. },
  10964. jcb: {
  10965. pattern: /^35(2[89]|[3-8][0-9])/,
  10966. length: [16]
  10967. },
  10968. maestro: {
  10969. pattern: /^(5018|5020|5038|6304|6759|676[1-3])/,
  10970. length: [12, 13, 14, 15, 16, 17, 18, 19]
  10971. },
  10972. dinersClub: {
  10973. pattern: /^(30[0-5]|^36)/,
  10974. length: [14]
  10975. },
  10976. laser: {
  10977. pattern: /^(6304|670[69]|6771)/,
  10978. length: [16, 17, 18, 19]
  10979. },
  10980. visaElectron: {
  10981. pattern: /^(4026|417500|4508|4844|491(3|7))/,
  10982. length: [16]
  10983. }
  10984. },
  10985. r = {},
  10986. s = !1,
  10987. l = "string" == typeof n && n.split(",");
  10988. if ("string" == typeof t && 0 !== t.length) {
  10989. if (t = t.replace(/[\-]/g, ""), l && (e.each(l, function (n, i) {
  10990. (o = a[i]) && (r = {
  10991. length: -1 !== e.inArray(t.length, o.length),
  10992. pattern: -1 !== t.search(o.pattern)
  10993. }).length && r.pattern && (s = !0);
  10994. }), !s)) return !1;
  10995. if ((i = {
  10996. number: -1 !== e.inArray(t.length, a.unionPay.length),
  10997. pattern: -1 !== t.search(a.unionPay.pattern)
  10998. }).number && i.pattern) return !0;
  10999. 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--;) {
  11000. f += d[u][parseInt(t.charAt(c), 10)], u ^= 1;
  11001. }
  11002. return f % 10 == 0 && f > 0;
  11003. }
  11004. },
  11005. minCount: function minCount(e, t) {
  11006. return 0 == t || (1 == t ? "" !== e : e.split(",").length >= t);
  11007. },
  11008. exactCount: function exactCount(e, t) {
  11009. return 0 == t ? "" === e : 1 == t ? "" !== e && -1 === e.search(",") : e.split(",").length == t;
  11010. },
  11011. maxCount: function maxCount(e, t) {
  11012. return 0 != t && (1 == t ? -1 === e.search(",") : e.split(",").length <= t);
  11013. }
  11014. }
  11015. };
  11016. }(jQuery, window, document), function (e, t, n, i) {
  11017. "use strict";
  11018. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.accordion = function (n) {
  11019. var o,
  11020. a = e(this),
  11021. r = new Date().getTime(),
  11022. s = [],
  11023. l = arguments[0],
  11024. c = "string" == typeof l,
  11025. u = [].slice.call(arguments, 1);
  11026. t.requestAnimationFrame || t.mozRequestAnimationFrame || t.webkitRequestAnimationFrame || t.msRequestAnimationFrame;
  11027. return a.each(function () {
  11028. var d,
  11029. f,
  11030. m = e.isPlainObject(n) ? e.extend(!0, {}, e.fn.accordion.settings, n) : e.extend({}, e.fn.accordion.settings),
  11031. g = m.className,
  11032. p = m.namespace,
  11033. h = m.selector,
  11034. v = m.error,
  11035. b = "." + p,
  11036. y = "module-" + p,
  11037. x = a.selector || "",
  11038. C = e(this),
  11039. w = C.find(h.title),
  11040. S = C.find(h.content),
  11041. k = this,
  11042. T = C.data(y);
  11043. f = {
  11044. initialize: function initialize() {
  11045. f.debug("Initializing", C), f.bind.events(), m.observeChanges && f.observeChanges(), f.instantiate();
  11046. },
  11047. instantiate: function instantiate() {
  11048. T = f, C.data(y, f);
  11049. },
  11050. destroy: function destroy() {
  11051. f.debug("Destroying previous instance", C), C.off(b).removeData(y);
  11052. },
  11053. refresh: function refresh() {
  11054. w = C.find(h.title), S = C.find(h.content);
  11055. },
  11056. observeChanges: function observeChanges() {
  11057. "MutationObserver" in t && ((d = new MutationObserver(function (e) {
  11058. f.debug("DOM tree modified, updating selector cache"), f.refresh();
  11059. })).observe(k, {
  11060. childList: !0,
  11061. subtree: !0
  11062. }), f.debug("Setting up mutation observer", d));
  11063. },
  11064. bind: {
  11065. events: function events() {
  11066. f.debug("Binding delegated events"), C.on(m.on + b, h.trigger, f.event.click);
  11067. }
  11068. },
  11069. event: {
  11070. click: function click() {
  11071. f.toggle.call(this);
  11072. }
  11073. },
  11074. toggle: function toggle(t) {
  11075. var n = t !== i ? "number" == typeof t ? w.eq(t) : e(t).closest(h.title) : e(this).closest(h.title),
  11076. o = n.next(S),
  11077. a = o.hasClass(g.animating),
  11078. r = o.hasClass(g.active),
  11079. s = r && !a,
  11080. l = !r && a;
  11081. 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);
  11082. },
  11083. open: function open(t) {
  11084. var n = t !== i ? "number" == typeof t ? w.eq(t) : e(t).closest(h.title) : e(this).closest(h.title),
  11085. o = n.next(S),
  11086. a = o.hasClass(g.animating);
  11087. 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({
  11088. animation: "fade in",
  11089. queue: !1,
  11090. useFailSafe: !0,
  11091. debug: m.debug,
  11092. verbose: m.verbose,
  11093. duration: m.duration
  11094. }) : o.children().stop(!0, !0).animate({
  11095. opacity: 1
  11096. }, m.duration, f.resetOpacity)), o.slideDown(m.duration, m.easing, function () {
  11097. o.removeClass(g.animating).addClass(g.active), f.reset.display.call(this), m.onOpen.call(this), m.onChange.call(this);
  11098. }));
  11099. },
  11100. close: function close(t) {
  11101. var n = t !== i ? "number" == typeof t ? w.eq(t) : e(t).closest(h.title) : e(this).closest(h.title),
  11102. o = n.next(S),
  11103. a = o.hasClass(g.animating),
  11104. r = o.hasClass(g.active);
  11105. !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({
  11106. animation: "fade out",
  11107. queue: !1,
  11108. useFailSafe: !0,
  11109. debug: m.debug,
  11110. verbose: m.verbose,
  11111. duration: m.duration
  11112. }) : o.children().stop(!0, !0).animate({
  11113. opacity: 0
  11114. }, m.duration, f.resetOpacity)), o.slideUp(m.duration, m.easing, function () {
  11115. o.removeClass(g.animating).removeClass(g.active), f.reset.display.call(this), m.onClose.call(this), m.onChange.call(this);
  11116. }));
  11117. },
  11118. closeOthers: function closeOthers(t) {
  11119. var n,
  11120. o,
  11121. a,
  11122. r = t !== i ? w.eq(t) : e(this).closest(h.title),
  11123. s = r.parents(h.content).prev(h.title),
  11124. l = r.closest(h.accordion),
  11125. c = h.title + "." + g.active + ":visible",
  11126. u = h.content + "." + g.active + ":visible";
  11127. 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({
  11128. animation: "fade out",
  11129. useFailSafe: !0,
  11130. debug: m.debug,
  11131. verbose: m.verbose,
  11132. duration: m.duration
  11133. }) : a.children().stop(!0, !0).animate({
  11134. opacity: 0
  11135. }, m.duration, f.resetOpacity)), a.slideUp(m.duration, m.easing, function () {
  11136. e(this).removeClass(g.active), f.reset.display.call(this);
  11137. }));
  11138. },
  11139. reset: {
  11140. display: function display() {
  11141. f.verbose("Removing inline display from element", this), e(this).css("display", ""), "" === e(this).attr("style") && e(this).attr("style", "").removeAttr("style");
  11142. },
  11143. opacity: function opacity() {
  11144. f.verbose("Removing inline opacity from element", this), e(this).css("opacity", ""), "" === e(this).attr("style") && e(this).attr("style", "").removeAttr("style");
  11145. }
  11146. },
  11147. setting: function setting(t, n) {
  11148. if (f.debug("Changing setting", t, n), e.isPlainObject(t)) e.extend(!0, m, t);else {
  11149. if (n === i) return m[t];
  11150. e.isPlainObject(m[t]) ? e.extend(!0, m[t], n) : m[t] = n;
  11151. }
  11152. },
  11153. internal: function internal(t, n) {
  11154. if (f.debug("Changing internal", t, n), n === i) return f[t];
  11155. e.isPlainObject(t) ? e.extend(!0, f, t) : f[t] = n;
  11156. },
  11157. debug: function debug() {
  11158. !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)));
  11159. },
  11160. verbose: function verbose() {
  11161. !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)));
  11162. },
  11163. error: function error() {
  11164. m.silent || (f.error = Function.prototype.bind.call(console.error, console, m.name + ":"), f.error.apply(console, arguments));
  11165. },
  11166. performance: {
  11167. log: function log(e) {
  11168. var t, n;
  11169. m.performance && (n = (t = new Date().getTime()) - (r || t), r = t, s.push({
  11170. Name: e[0],
  11171. Arguments: [].slice.call(e, 1) || "",
  11172. Element: k,
  11173. "Execution Time": n
  11174. })), clearTimeout(f.performance.timer), f.performance.timer = setTimeout(f.performance.display, 500);
  11175. },
  11176. display: function display() {
  11177. var t = m.name + ":",
  11178. n = 0;
  11179. r = !1, clearTimeout(f.performance.timer), e.each(s, function (e, t) {
  11180. n += t["Execution Time"];
  11181. }), 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) {
  11182. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  11183. }), console.groupEnd()), s = [];
  11184. }
  11185. },
  11186. invoke: function invoke(t, n, a) {
  11187. var r,
  11188. s,
  11189. l,
  11190. c = T;
  11191. 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) {
  11192. var a = n != r ? o + t[n + 1].charAt(0).toUpperCase() + t[n + 1].slice(1) : t;
  11193. if (e.isPlainObject(c[a]) && n != r) c = c[a];else {
  11194. if (c[a] !== i) return s = c[a], !1;
  11195. if (!e.isPlainObject(c[o]) || n == r) return c[o] !== i ? (s = c[o], !1) : (f.error(v.method, t), !1);
  11196. c = c[o];
  11197. }
  11198. })), 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;
  11199. }
  11200. }, c ? (T === i && f.initialize(), f.invoke(l)) : (T !== i && T.invoke("destroy"), f.initialize());
  11201. }), o !== i ? o : this;
  11202. }, e.fn.accordion.settings = {
  11203. name: "Accordion",
  11204. namespace: "accordion",
  11205. silent: !1,
  11206. debug: !1,
  11207. verbose: !1,
  11208. performance: !0,
  11209. on: "click",
  11210. observeChanges: !0,
  11211. exclusive: !0,
  11212. collapsible: !0,
  11213. closeNested: !1,
  11214. animateChildren: !0,
  11215. duration: 350,
  11216. easing: "easeOutQuad",
  11217. onOpening: function onOpening() {},
  11218. onClosing: function onClosing() {},
  11219. onChanging: function onChanging() {},
  11220. onOpen: function onOpen() {},
  11221. onClose: function onClose() {},
  11222. onChange: function onChange() {},
  11223. error: {
  11224. method: "The method you called is not defined"
  11225. },
  11226. className: {
  11227. active: "active",
  11228. animating: "animating"
  11229. },
  11230. selector: {
  11231. accordion: ".accordion",
  11232. title: ".title",
  11233. trigger: ".title",
  11234. content: ".content"
  11235. }
  11236. }, e.extend(e.easing, {
  11237. easeOutQuad: function easeOutQuad(e, t, n, i, o) {
  11238. return -i * (t /= o) * (t - 2) + n;
  11239. }
  11240. });
  11241. }(jQuery, window, document), function (e, t, n, i) {
  11242. "use strict";
  11243. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.checkbox = function (o) {
  11244. var a,
  11245. r = e(this),
  11246. s = r.selector || "",
  11247. l = new Date().getTime(),
  11248. c = [],
  11249. u = arguments[0],
  11250. d = "string" == typeof u,
  11251. f = [].slice.call(arguments, 1);
  11252. return r.each(function () {
  11253. var r,
  11254. m,
  11255. g = e.extend(!0, {}, e.fn.checkbox.settings, o),
  11256. p = g.className,
  11257. h = g.namespace,
  11258. v = g.selector,
  11259. b = g.error,
  11260. y = "." + h,
  11261. x = "module-" + h,
  11262. C = e(this),
  11263. w = e(this).children(v.label),
  11264. S = e(this).children(v.input),
  11265. k = S[0],
  11266. T = !1,
  11267. A = !1,
  11268. R = C.data(x),
  11269. P = this;
  11270. m = {
  11271. initialize: function initialize() {
  11272. m.verbose("Initializing checkbox", g), m.create.label(), m.bind.events(), m.set.tabbable(), m.hide.input(), m.observeChanges(), m.instantiate(), m.setup();
  11273. },
  11274. instantiate: function instantiate() {
  11275. m.verbose("Storing instance of module", m), R = m, C.data(x, m);
  11276. },
  11277. destroy: function destroy() {
  11278. m.verbose("Destroying module"), m.unbind.events(), m.show.input(), C.removeData(x);
  11279. },
  11280. fix: {
  11281. reference: function reference() {
  11282. C.is(v.input) && (m.debug("Behavior called on <input> adjusting invoked element"), C = C.closest(v.checkbox), m.refresh());
  11283. }
  11284. },
  11285. setup: function setup() {
  11286. 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();
  11287. },
  11288. refresh: function refresh() {
  11289. w = C.children(v.label), S = C.children(v.input), k = S[0];
  11290. },
  11291. hide: {
  11292. input: function input() {
  11293. m.verbose("Modifying <input> z-index to be unselectable"), S.addClass(p.hidden);
  11294. }
  11295. },
  11296. show: {
  11297. input: function input() {
  11298. m.verbose("Modifying <input> z-index to be selectable"), S.removeClass(p.hidden);
  11299. }
  11300. },
  11301. observeChanges: function observeChanges() {
  11302. "MutationObserver" in t && ((r = new MutationObserver(function (e) {
  11303. m.debug("DOM tree modified, updating selector cache"), m.refresh();
  11304. })).observe(P, {
  11305. childList: !0,
  11306. subtree: !0
  11307. }), m.debug("Setting up mutation observer", r));
  11308. },
  11309. attachEvents: function attachEvents(t, n) {
  11310. var i = e(t);
  11311. 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);
  11312. },
  11313. event: {
  11314. click: function click(t) {
  11315. var n = e(t.target);
  11316. 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());
  11317. },
  11318. keydown: function keydown(e) {
  11319. var t = e.which,
  11320. n = 13,
  11321. i = 32;
  11322. 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);
  11323. },
  11324. keyup: function keyup(e) {
  11325. A && e.preventDefault();
  11326. }
  11327. },
  11328. check: function check() {
  11329. m.should.allowCheck() && (m.debug("Checking checkbox", S), m.set.checked(), m.should.ignoreCallbacks() || (g.onChecked.call(k), g.onChange.call(k)));
  11330. },
  11331. uncheck: function uncheck() {
  11332. m.should.allowUncheck() && (m.debug("Unchecking checkbox"), m.set.unchecked(), m.should.ignoreCallbacks() || (g.onUnchecked.call(k), g.onChange.call(k)));
  11333. },
  11334. indeterminate: function indeterminate() {
  11335. 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)));
  11336. },
  11337. determinate: function determinate() {
  11338. 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)));
  11339. },
  11340. enable: function enable() {
  11341. m.is.enabled() ? m.debug("Checkbox is already enabled") : (m.debug("Enabling checkbox"), m.set.enabled(), g.onEnable.call(k), g.onEnabled.call(k));
  11342. },
  11343. disable: function disable() {
  11344. m.is.disabled() ? m.debug("Checkbox is already disabled") : (m.debug("Disabling checkbox"), m.set.disabled(), g.onDisable.call(k), g.onDisabled.call(k));
  11345. },
  11346. get: {
  11347. radios: function radios() {
  11348. var t = m.get.name();
  11349. return e('input[name="' + t + '"]').closest(v.checkbox);
  11350. },
  11351. otherRadios: function otherRadios() {
  11352. return m.get.radios().not(C);
  11353. },
  11354. name: function name() {
  11355. return S.attr("name");
  11356. }
  11357. },
  11358. is: {
  11359. initialLoad: function initialLoad() {
  11360. return T;
  11361. },
  11362. radio: function radio() {
  11363. return S.hasClass(p.radio) || "radio" == S.attr("type");
  11364. },
  11365. indeterminate: function indeterminate() {
  11366. return S.prop("indeterminate") !== i && S.prop("indeterminate");
  11367. },
  11368. checked: function checked() {
  11369. return S.prop("checked") !== i && S.prop("checked");
  11370. },
  11371. disabled: function disabled() {
  11372. return S.prop("disabled") !== i && S.prop("disabled");
  11373. },
  11374. enabled: function enabled() {
  11375. return !m.is.disabled();
  11376. },
  11377. determinate: function determinate() {
  11378. return !m.is.indeterminate();
  11379. },
  11380. unchecked: function unchecked() {
  11381. return !m.is.checked();
  11382. }
  11383. },
  11384. should: {
  11385. allowCheck: function allowCheck() {
  11386. 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);
  11387. },
  11388. allowUncheck: function allowUncheck() {
  11389. 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);
  11390. },
  11391. allowIndeterminate: function allowIndeterminate() {
  11392. 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);
  11393. },
  11394. allowDeterminate: function allowDeterminate() {
  11395. 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);
  11396. },
  11397. forceCallbacks: function forceCallbacks() {
  11398. return m.is.initialLoad() && g.fireOnInit;
  11399. },
  11400. ignoreCallbacks: function ignoreCallbacks() {
  11401. return T && !g.fireOnInit;
  11402. }
  11403. },
  11404. can: {
  11405. change: function change() {
  11406. return !(C.hasClass(p.disabled) || C.hasClass(p.readOnly) || S.prop("disabled") || S.prop("readonly"));
  11407. },
  11408. uncheck: function uncheck() {
  11409. return "boolean" == typeof g.uncheckable ? g.uncheckable : !m.is.radio();
  11410. }
  11411. },
  11412. set: {
  11413. initialLoad: function initialLoad() {
  11414. T = !0;
  11415. },
  11416. checked: function checked() {
  11417. 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");
  11418. },
  11419. unchecked: function unchecked() {
  11420. 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");
  11421. },
  11422. indeterminate: function indeterminate() {
  11423. 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());
  11424. },
  11425. determinate: function determinate() {
  11426. 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));
  11427. },
  11428. disabled: function disabled() {
  11429. 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());
  11430. },
  11431. enabled: function enabled() {
  11432. 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());
  11433. },
  11434. tabbable: function tabbable() {
  11435. m.verbose("Adding tabindex to checkbox"), S.attr("tabindex") === i && S.attr("tabindex", 0);
  11436. }
  11437. },
  11438. remove: {
  11439. initialLoad: function initialLoad() {
  11440. T = !1;
  11441. }
  11442. },
  11443. trigger: {
  11444. change: function change() {
  11445. var e = n.createEvent("HTMLEvents"),
  11446. t = S[0];
  11447. t && (m.verbose("Triggering native change event"), e.initEvent("change", !0, !1), t.dispatchEvent(e));
  11448. }
  11449. },
  11450. create: {
  11451. label: function label() {
  11452. 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));
  11453. }
  11454. },
  11455. has: {
  11456. label: function label() {
  11457. return w.length > 0;
  11458. }
  11459. },
  11460. bind: {
  11461. events: function events() {
  11462. 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);
  11463. }
  11464. },
  11465. unbind: {
  11466. events: function events() {
  11467. m.debug("Removing events"), C.off(y);
  11468. }
  11469. },
  11470. uncheckOthers: function uncheckOthers() {
  11471. var e = m.get.otherRadios();
  11472. m.debug("Unchecking other radios", e), e.removeClass(p.checked);
  11473. },
  11474. toggle: function toggle() {
  11475. 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");
  11476. },
  11477. setting: function setting(t, n) {
  11478. if (m.debug("Changing setting", t, n), e.isPlainObject(t)) e.extend(!0, g, t);else {
  11479. if (n === i) return g[t];
  11480. e.isPlainObject(g[t]) ? e.extend(!0, g[t], n) : g[t] = n;
  11481. }
  11482. },
  11483. internal: function internal(t, n) {
  11484. if (e.isPlainObject(t)) e.extend(!0, m, t);else {
  11485. if (n === i) return m[t];
  11486. m[t] = n;
  11487. }
  11488. },
  11489. debug: function debug() {
  11490. !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)));
  11491. },
  11492. verbose: function verbose() {
  11493. !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)));
  11494. },
  11495. error: function error() {
  11496. g.silent || (m.error = Function.prototype.bind.call(console.error, console, g.name + ":"), m.error.apply(console, arguments));
  11497. },
  11498. performance: {
  11499. log: function log(e) {
  11500. var t, n;
  11501. g.performance && (n = (t = new Date().getTime()) - (l || t), l = t, c.push({
  11502. Name: e[0],
  11503. Arguments: [].slice.call(e, 1) || "",
  11504. Element: P,
  11505. "Execution Time": n
  11506. })), clearTimeout(m.performance.timer), m.performance.timer = setTimeout(m.performance.display, 500);
  11507. },
  11508. display: function display() {
  11509. var t = g.name + ":",
  11510. n = 0;
  11511. l = !1, clearTimeout(m.performance.timer), e.each(c, function (e, t) {
  11512. n += t["Execution Time"];
  11513. }), 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) {
  11514. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  11515. }), console.groupEnd()), c = [];
  11516. }
  11517. },
  11518. invoke: function invoke(t, n, o) {
  11519. var r,
  11520. s,
  11521. l,
  11522. c = R;
  11523. 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) {
  11524. var a = n != r ? o + t[n + 1].charAt(0).toUpperCase() + t[n + 1].slice(1) : t;
  11525. if (e.isPlainObject(c[a]) && n != r) c = c[a];else {
  11526. if (c[a] !== i) return s = c[a], !1;
  11527. if (!e.isPlainObject(c[o]) || n == r) return c[o] !== i ? (s = c[o], !1) : (m.error(b.method, t), !1);
  11528. c = c[o];
  11529. }
  11530. })), 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;
  11531. }
  11532. }, d ? (R === i && m.initialize(), m.invoke(u)) : (R !== i && R.invoke("destroy"), m.initialize());
  11533. }), a !== i ? a : this;
  11534. }, e.fn.checkbox.settings = {
  11535. name: "Checkbox",
  11536. namespace: "checkbox",
  11537. silent: !1,
  11538. debug: !1,
  11539. verbose: !0,
  11540. performance: !0,
  11541. uncheckable: "auto",
  11542. fireOnInit: !1,
  11543. onChange: function onChange() {},
  11544. beforeChecked: function beforeChecked() {},
  11545. beforeUnchecked: function beforeUnchecked() {},
  11546. beforeDeterminate: function beforeDeterminate() {},
  11547. beforeIndeterminate: function beforeIndeterminate() {},
  11548. onChecked: function onChecked() {},
  11549. onUnchecked: function onUnchecked() {},
  11550. onDeterminate: function onDeterminate() {},
  11551. onIndeterminate: function onIndeterminate() {},
  11552. onEnable: function onEnable() {},
  11553. onDisable: function onDisable() {},
  11554. onEnabled: function onEnabled() {},
  11555. onDisabled: function onDisabled() {},
  11556. className: {
  11557. checked: "checked",
  11558. indeterminate: "indeterminate",
  11559. disabled: "disabled",
  11560. hidden: "hidden",
  11561. radio: "radio",
  11562. readOnly: "read-only"
  11563. },
  11564. error: {
  11565. method: "The method you called is not defined"
  11566. },
  11567. selector: {
  11568. checkbox: ".ui.checkbox",
  11569. label: "label, .box",
  11570. input: 'input[type="checkbox"], input[type="radio"]',
  11571. link: "a[href]"
  11572. }
  11573. };
  11574. }(jQuery, window, document), function (e, t, n, i) {
  11575. "use strict";
  11576. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.dimmer = function (t) {
  11577. var o,
  11578. a = e(this),
  11579. r = new Date().getTime(),
  11580. s = [],
  11581. l = arguments[0],
  11582. c = "string" == typeof l,
  11583. u = [].slice.call(arguments, 1);
  11584. return a.each(function () {
  11585. var d,
  11586. f,
  11587. m,
  11588. g = e.isPlainObject(t) ? e.extend(!0, {}, e.fn.dimmer.settings, t) : e.extend({}, e.fn.dimmer.settings),
  11589. p = g.selector,
  11590. h = g.namespace,
  11591. v = g.className,
  11592. b = g.error,
  11593. y = "." + h,
  11594. x = "module-" + h,
  11595. C = a.selector || "",
  11596. w = "ontouchstart" in n.documentElement ? "touchstart" : "click",
  11597. S = e(this),
  11598. k = this,
  11599. T = S.data(x);
  11600. (m = {
  11601. preinitialize: function preinitialize() {
  11602. 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());
  11603. },
  11604. initialize: function initialize() {
  11605. m.debug("Initializing dimmer", g), m.bind.events(), m.set.dimmable(), m.instantiate();
  11606. },
  11607. instantiate: function instantiate() {
  11608. m.verbose("Storing instance of module", m), T = m, S.data(x, T);
  11609. },
  11610. destroy: function destroy() {
  11611. m.verbose("Destroying previous module", d), m.unbind.events(), m.remove.variation(), f.off(y);
  11612. },
  11613. bind: {
  11614. events: function events() {
  11615. m.is.page() && f.get(0).addEventListener("touchmove", m.event.preventScroll, {
  11616. passive: !1
  11617. }), "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));
  11618. }
  11619. },
  11620. unbind: {
  11621. events: function events() {
  11622. m.is.page() && f.get(0).removeEventListener("touchmove", m.event.preventScroll, {
  11623. passive: !1
  11624. }), S.removeData(x), f.off(y);
  11625. }
  11626. },
  11627. event: {
  11628. click: function click(t) {
  11629. 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());
  11630. },
  11631. preventScroll: function preventScroll(e) {
  11632. e.preventDefault();
  11633. }
  11634. },
  11635. addContent: function addContent(t) {
  11636. var n = e(t);
  11637. m.debug("Add content to dimmer", n), n.parent()[0] !== d[0] && n.detach().appendTo(d);
  11638. },
  11639. create: function create() {
  11640. var t = e(g.template.dimmer());
  11641. return g.dimmerName && (m.debug("Creating named dimmer", g.dimmerName), t.addClass(g.dimmerName)), t.appendTo(f), t;
  11642. },
  11643. show: function show(t) {
  11644. 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));
  11645. },
  11646. hide: function hide(t) {
  11647. 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");
  11648. },
  11649. toggle: function toggle() {
  11650. m.verbose("Toggling dimmer visibility", d), m.is.dimmed() ? m.hide() : m.show();
  11651. },
  11652. animate: {
  11653. show: function show(t) {
  11654. t = e.isFunction(t) ? t : function () {}, g.useCSS && e.fn.transition !== i && d.transition("is supported") ? ("auto" !== g.opacity && m.set.opacity(), d.transition({
  11655. displayType: "flex",
  11656. animation: g.transition + " in",
  11657. queue: !1,
  11658. duration: m.get.duration(),
  11659. useFailSafe: !0,
  11660. onStart: function onStart() {
  11661. m.set.dimmed();
  11662. },
  11663. onComplete: function onComplete() {
  11664. m.set.active(), t();
  11665. }
  11666. })) : (m.verbose("Showing dimmer animation with javascript"), m.set.dimmed(), "auto" == g.opacity && (g.opacity = .8), d.stop().css({
  11667. opacity: 0,
  11668. width: "100%",
  11669. height: "100%"
  11670. }).fadeTo(m.get.duration(), g.opacity, function () {
  11671. d.removeAttr("style"), m.set.active(), t();
  11672. }));
  11673. },
  11674. hide: function hide(t) {
  11675. t = e.isFunction(t) ? t : function () {}, g.useCSS && e.fn.transition !== i && d.transition("is supported") ? (m.verbose("Hiding dimmer with css"), d.transition({
  11676. displayType: "flex",
  11677. animation: g.transition + " out",
  11678. queue: !1,
  11679. duration: m.get.duration(),
  11680. useFailSafe: !0,
  11681. onStart: function onStart() {
  11682. m.remove.dimmed();
  11683. },
  11684. onComplete: function onComplete() {
  11685. m.remove.active(), t();
  11686. }
  11687. })) : (m.verbose("Hiding dimmer with javascript"), m.remove.dimmed(), d.stop().fadeOut(m.get.duration(), function () {
  11688. m.remove.active(), d.removeAttr("style"), t();
  11689. }));
  11690. }
  11691. },
  11692. get: {
  11693. dimmer: function dimmer() {
  11694. return d;
  11695. },
  11696. duration: function duration() {
  11697. return "object" == _typeof(g.duration) ? m.is.active() ? g.duration.hide : g.duration.show : g.duration;
  11698. }
  11699. },
  11700. has: {
  11701. dimmer: function dimmer() {
  11702. return g.dimmerName ? S.find(p.dimmer).filter("." + g.dimmerName).length > 0 : S.find(p.dimmer).length > 0;
  11703. }
  11704. },
  11705. is: {
  11706. active: function active() {
  11707. return d.hasClass(v.active);
  11708. },
  11709. animating: function animating() {
  11710. return d.is(":animated") || d.hasClass(v.animating);
  11711. },
  11712. closable: function closable() {
  11713. return "auto" == g.closable ? "hover" != g.on : g.closable;
  11714. },
  11715. dimmer: function dimmer() {
  11716. return S.hasClass(v.dimmer);
  11717. },
  11718. dimmable: function dimmable() {
  11719. return S.hasClass(v.dimmable);
  11720. },
  11721. dimmed: function dimmed() {
  11722. return f.hasClass(v.dimmed);
  11723. },
  11724. disabled: function disabled() {
  11725. return f.hasClass(v.disabled);
  11726. },
  11727. enabled: function enabled() {
  11728. return !m.is.disabled();
  11729. },
  11730. page: function page() {
  11731. return f.is("body");
  11732. },
  11733. pageDimmer: function pageDimmer() {
  11734. return d.hasClass(v.pageDimmer);
  11735. }
  11736. },
  11737. can: {
  11738. show: function show() {
  11739. return !d.hasClass(v.disabled);
  11740. }
  11741. },
  11742. set: {
  11743. opacity: function opacity(e) {
  11744. var t = d.css("background-color"),
  11745. n = t.split(","),
  11746. i = n && 3 == n.length,
  11747. o = n && 4 == n.length;
  11748. 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);
  11749. },
  11750. active: function active() {
  11751. d.addClass(v.active);
  11752. },
  11753. dimmable: function dimmable() {
  11754. f.addClass(v.dimmable);
  11755. },
  11756. dimmed: function dimmed() {
  11757. f.addClass(v.dimmed);
  11758. },
  11759. pageDimmer: function pageDimmer() {
  11760. d.addClass(v.pageDimmer);
  11761. },
  11762. disabled: function disabled() {
  11763. d.addClass(v.disabled);
  11764. },
  11765. variation: function variation(e) {
  11766. (e = e || g.variation) && d.addClass(e);
  11767. }
  11768. },
  11769. remove: {
  11770. active: function active() {
  11771. d.removeClass(v.active);
  11772. },
  11773. dimmed: function dimmed() {
  11774. f.removeClass(v.dimmed);
  11775. },
  11776. disabled: function disabled() {
  11777. d.removeClass(v.disabled);
  11778. },
  11779. variation: function variation(e) {
  11780. (e = e || g.variation) && d.removeClass(e);
  11781. }
  11782. },
  11783. setting: function setting(t, n) {
  11784. if (m.debug("Changing setting", t, n), e.isPlainObject(t)) e.extend(!0, g, t);else {
  11785. if (n === i) return g[t];
  11786. e.isPlainObject(g[t]) ? e.extend(!0, g[t], n) : g[t] = n;
  11787. }
  11788. },
  11789. internal: function internal(t, n) {
  11790. if (e.isPlainObject(t)) e.extend(!0, m, t);else {
  11791. if (n === i) return m[t];
  11792. m[t] = n;
  11793. }
  11794. },
  11795. debug: function debug() {
  11796. !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)));
  11797. },
  11798. verbose: function verbose() {
  11799. !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)));
  11800. },
  11801. error: function error() {
  11802. g.silent || (m.error = Function.prototype.bind.call(console.error, console, g.name + ":"), m.error.apply(console, arguments));
  11803. },
  11804. performance: {
  11805. log: function log(e) {
  11806. var t, n;
  11807. g.performance && (n = (t = new Date().getTime()) - (r || t), r = t, s.push({
  11808. Name: e[0],
  11809. Arguments: [].slice.call(e, 1) || "",
  11810. Element: k,
  11811. "Execution Time": n
  11812. })), clearTimeout(m.performance.timer), m.performance.timer = setTimeout(m.performance.display, 500);
  11813. },
  11814. display: function display() {
  11815. var t = g.name + ":",
  11816. n = 0;
  11817. r = !1, clearTimeout(m.performance.timer), e.each(s, function (e, t) {
  11818. n += t["Execution Time"];
  11819. }), 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) {
  11820. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  11821. }), console.groupEnd()), s = [];
  11822. }
  11823. },
  11824. invoke: function invoke(t, n, a) {
  11825. var r,
  11826. s,
  11827. l,
  11828. c = T;
  11829. 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) {
  11830. var a = n != r ? o + t[n + 1].charAt(0).toUpperCase() + t[n + 1].slice(1) : t;
  11831. if (e.isPlainObject(c[a]) && n != r) c = c[a];else {
  11832. if (c[a] !== i) return s = c[a], !1;
  11833. if (!e.isPlainObject(c[o]) || n == r) return c[o] !== i ? (s = c[o], !1) : (m.error(b.method, t), !1);
  11834. c = c[o];
  11835. }
  11836. })), 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;
  11837. }
  11838. }).preinitialize(), c ? (T === i && m.initialize(), m.invoke(l)) : (T !== i && T.invoke("destroy"), m.initialize());
  11839. }), o !== i ? o : this;
  11840. }, e.fn.dimmer.settings = {
  11841. name: "Dimmer",
  11842. namespace: "dimmer",
  11843. silent: !1,
  11844. debug: !1,
  11845. verbose: !1,
  11846. performance: !0,
  11847. dimmerName: !1,
  11848. variation: !1,
  11849. closable: "auto",
  11850. useCSS: !0,
  11851. transition: "fade",
  11852. on: !1,
  11853. opacity: "auto",
  11854. duration: {
  11855. show: 500,
  11856. hide: 500
  11857. },
  11858. onChange: function onChange() {},
  11859. onShow: function onShow() {},
  11860. onHide: function onHide() {},
  11861. error: {
  11862. method: "The method you called is not defined."
  11863. },
  11864. className: {
  11865. active: "active",
  11866. animating: "animating",
  11867. dimmable: "dimmable",
  11868. dimmed: "dimmed",
  11869. dimmer: "dimmer",
  11870. disabled: "disabled",
  11871. hide: "hide",
  11872. pageDimmer: "page",
  11873. show: "show"
  11874. },
  11875. selector: {
  11876. dimmer: "> .ui.dimmer",
  11877. content: ".ui.dimmer > .content, .ui.dimmer > .content > .center"
  11878. },
  11879. template: {
  11880. dimmer: function dimmer() {
  11881. return e("<div />").attr("class", "ui dimmer");
  11882. }
  11883. }
  11884. };
  11885. }(jQuery, window, document), function (e, t, n, i) {
  11886. "use strict";
  11887. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.dropdown = function (o) {
  11888. var a,
  11889. r = e(this),
  11890. s = e(n),
  11891. l = r.selector || "",
  11892. c = "ontouchstart" in n.documentElement,
  11893. u = new Date().getTime(),
  11894. d = [],
  11895. f = arguments[0],
  11896. m = "string" == typeof f,
  11897. g = [].slice.call(arguments, 1);
  11898. return r.each(function (p) {
  11899. var h,
  11900. v,
  11901. b,
  11902. y,
  11903. x,
  11904. C,
  11905. w,
  11906. S,
  11907. k = e.isPlainObject(o) ? e.extend(!0, {}, e.fn.dropdown.settings, o) : e.extend({}, e.fn.dropdown.settings),
  11908. T = k.className,
  11909. A = k.message,
  11910. R = k.fields,
  11911. P = k.keys,
  11912. E = k.metadata,
  11913. F = k.namespace,
  11914. O = k.regExp,
  11915. D = k.selector,
  11916. q = k.error,
  11917. j = k.templates,
  11918. z = "." + F,
  11919. I = "module-" + F,
  11920. M = e(this),
  11921. L = e(k.context),
  11922. V = M.find(D.text),
  11923. N = M.find(D.search),
  11924. H = M.find(D.sizer),
  11925. U = M.find(D.input),
  11926. W = M.find(D.icon),
  11927. B = M.prev().find(D.text).length > 0 ? M.prev().find(D.text) : M.prev(),
  11928. Q = M.children(D.menu),
  11929. X = Q.find(D.item),
  11930. $ = !1,
  11931. Y = !1,
  11932. Z = !1,
  11933. K = this,
  11934. J = M.data(I);
  11935. S = {
  11936. initialize: function initialize() {
  11937. 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());
  11938. },
  11939. instantiate: function instantiate() {
  11940. S.verbose("Storing instance of dropdown", S), J = S, M.data(I, S);
  11941. },
  11942. destroy: function destroy() {
  11943. 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();
  11944. },
  11945. observeChanges: function observeChanges() {
  11946. "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());
  11947. },
  11948. disconnect: {
  11949. menuObserver: function menuObserver() {
  11950. w && w.disconnect();
  11951. },
  11952. selectObserver: function selectObserver() {
  11953. C && C.disconnect();
  11954. }
  11955. },
  11956. observe: {
  11957. select: function select() {
  11958. S.has.input() && C.observe(M[0], {
  11959. childList: !0,
  11960. subtree: !0
  11961. });
  11962. },
  11963. menu: function menu() {
  11964. S.has.menu() && w.observe(Q[0], {
  11965. childList: !0,
  11966. subtree: !0
  11967. });
  11968. }
  11969. },
  11970. create: {
  11971. id: function id() {
  11972. x = (Math.random().toString(16) + "000000000").substr(2, 8), y = "." + x, S.verbose("Creating unique id for element", x);
  11973. },
  11974. userChoice: function userChoice(t) {
  11975. var n, o, a;
  11976. return !!(t = t || S.get.userValues()) && (t = e.isArray(t) ? t : [t], e.each(t, function (t, r) {
  11977. !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));
  11978. }), n);
  11979. },
  11980. userLabels: function userLabels(t) {
  11981. var n = S.get.userValues();
  11982. n && (S.debug("Adding user labels", n), e.each(n, function (e, t) {
  11983. S.verbose("Adding custom user value"), S.add.label(t, t);
  11984. }));
  11985. },
  11986. menu: function menu() {
  11987. Q = e("<div />").addClass(T.menu).appendTo(M);
  11988. },
  11989. sizer: function sizer() {
  11990. H = e("<span />").addClass(T.sizer).insertAfter(N);
  11991. }
  11992. },
  11993. search: function search(e) {
  11994. e = e !== i ? e : S.get.query(), S.verbose("Searching for query", e), S.has.minCharacters(e) ? S.filter(e) : S.hide();
  11995. },
  11996. select: {
  11997. firstUnfiltered: function firstUnfiltered() {
  11998. S.verbose("Selecting first non-filtered element"), S.remove.selectedItem(), X.not(D.unselectable).not(D.addition + D.hidden).eq(0).addClass(T.selected);
  11999. },
  12000. nextAvailable: function nextAvailable(e) {
  12001. var t = (e = e.eq(0)).nextAll(D.item).not(D.unselectable).eq(0),
  12002. n = e.prevAll(D.item).not(D.unselectable).eq(0);
  12003. t.length > 0 ? (S.verbose("Moving selection to", t), t.addClass(T.selected)) : (S.verbose("Moving selection to", n), n.addClass(T.selected));
  12004. }
  12005. },
  12006. setup: {
  12007. api: function api() {
  12008. var e = {
  12009. debug: k.debug,
  12010. urlData: {
  12011. value: S.get.value(),
  12012. query: S.get.query()
  12013. },
  12014. on: !1
  12015. };
  12016. S.verbose("First request, initializing API"), M.api(e);
  12017. },
  12018. layout: function layout() {
  12019. 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();
  12020. },
  12021. select: function select() {
  12022. var t = S.get.selectValues();
  12023. 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();
  12024. },
  12025. menu: function menu(e) {
  12026. Q.html(j.menu(e, R)), X = Q.find(D.item);
  12027. },
  12028. reference: function reference() {
  12029. 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();
  12030. },
  12031. returnedObject: function returnedObject() {
  12032. var e = r.slice(0, p),
  12033. t = r.slice(p + 1);
  12034. r = e.add(M).add(t);
  12035. }
  12036. },
  12037. refresh: function refresh() {
  12038. S.refreshSelectors(), S.refreshData();
  12039. },
  12040. refreshItems: function refreshItems() {
  12041. X = Q.find(D.item);
  12042. },
  12043. refreshSelectors: function refreshSelectors() {
  12044. 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);
  12045. },
  12046. refreshData: function refreshData() {
  12047. S.verbose("Refreshing cached metadata"), X.removeData(E.text).removeData(E.value);
  12048. },
  12049. clearData: function clearData() {
  12050. S.verbose("Clearing metadata"), X.removeData(E.text).removeData(E.value), M.removeData(E.defaultText).removeData(E.defaultValue).removeData(E.placeholderText);
  12051. },
  12052. toggle: function toggle() {
  12053. S.verbose("Toggling menu visibility"), S.is.active() ? S.hide() : S.show();
  12054. },
  12055. show: function show(t) {
  12056. 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()) {
  12057. if (S.debug("Showing dropdown"), !S.has.message() || S.has.maxSelections() || S.has.allResultsFiltered() || S.remove.message(), S.is.allFiltered()) return !0;
  12058. !1 !== k.onShow.call(K) && S.animate.show(function () {
  12059. S.can.click() && S.bind.intent(), S.has.menuSearch() && S.focusSearch(), S.set.visible(), t.call(K);
  12060. });
  12061. }
  12062. },
  12063. hide: function hide(t) {
  12064. 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 () {
  12065. S.remove.visible(), t.call(K);
  12066. }));
  12067. },
  12068. hideOthers: function hideOthers() {
  12069. S.verbose("Finding other dropdowns to hide"), r.not(M).has(D.menu + "." + T.visible).dropdown("hide");
  12070. },
  12071. hideMenu: function hideMenu() {
  12072. S.verbose("Hiding menu instantaneously"), S.remove.active(), S.remove.visible(), Q.transition("hide");
  12073. },
  12074. hideSubMenus: function hideSubMenus() {
  12075. var e = Q.children(D.item).find(D.menu);
  12076. S.verbose("Hiding sub menus", e), e.transition("hide");
  12077. },
  12078. bind: {
  12079. events: function events() {
  12080. c && S.bind.touchEvents(), S.bind.keyboardEvents(), S.bind.inputEvents(), S.bind.mouseEvents();
  12081. },
  12082. touchEvents: function touchEvents() {
  12083. 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);
  12084. },
  12085. keyboardEvents: function keyboardEvents() {
  12086. 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);
  12087. },
  12088. inputEvents: function inputEvents() {
  12089. S.verbose("Binding input change events"), M.on("change" + z, D.input, S.event.change);
  12090. },
  12091. mouseEvents: function mouseEvents() {
  12092. 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);
  12093. },
  12094. intent: function intent() {
  12095. 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);
  12096. }
  12097. },
  12098. unbind: {
  12099. intent: function intent() {
  12100. S.verbose("Removing hide intent event from document"), c && s.off("touchstart" + y).off("touchmove" + y), s.off("click" + y);
  12101. }
  12102. },
  12103. filter: function filter(e) {
  12104. var t = e !== i ? e : S.get.query(),
  12105. n = function n() {
  12106. 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();
  12107. };
  12108. k.useLabels && S.has.maxSelections() || (k.apiSettings ? S.can.useAPI() ? S.queryRemote(t, function () {
  12109. k.filterRemoteData && S.filterItems(t), n();
  12110. }) : S.error(q.noAPI) : (S.filterItems(t), n()));
  12111. },
  12112. queryRemote: function queryRemote(t, n) {
  12113. var i = {
  12114. errorDuration: !1,
  12115. cache: "local",
  12116. throttle: k.throttle,
  12117. urlData: {
  12118. query: t
  12119. },
  12120. onError: function onError() {
  12121. S.add.message(A.serverError), n();
  12122. },
  12123. onFailure: function onFailure() {
  12124. S.add.message(A.serverError), n();
  12125. },
  12126. onSuccess: function onSuccess(t) {
  12127. var i = t[R.remoteValues];
  12128. e.isArray(i) && i.length > 0 ? (S.remove.message(), S.setup.menu({
  12129. values: t[R.remoteValues]
  12130. })) : S.add.message(A.noResults), n();
  12131. }
  12132. };
  12133. M.api("get request") || S.setup.api(), i = e.extend(!0, {}, i, k.apiSettings), M.api("setting", i).api("query");
  12134. },
  12135. filterItems: function filterItems(t) {
  12136. var n = t !== i ? t : S.get.query(),
  12137. o = null,
  12138. a = S.escape.string(n),
  12139. r = new RegExp("^" + a, "igm");
  12140. S.has.query() && (o = [], S.verbose("Searching for matching values", n), X.each(function () {
  12141. var t,
  12142. i,
  12143. a = e(this);
  12144. if ("both" == k.match || "text" == k.match) {
  12145. if (-1 !== (t = String(S.get.choiceText(a, !1))).search(r)) return o.push(this), !0;
  12146. if ("exact" === k.fullTextSearch && S.exactSearch(n, t)) return o.push(this), !0;
  12147. if (!0 === k.fullTextSearch && S.fuzzySearch(n, t)) return o.push(this), !0;
  12148. }
  12149. if ("both" == k.match || "value" == k.match) {
  12150. if (-1 !== (i = String(S.get.choiceValue(a, t))).search(r)) return o.push(this), !0;
  12151. if ("exact" === k.fullTextSearch && S.exactSearch(n, i)) return o.push(this), !0;
  12152. if (!0 === k.fullTextSearch && S.fuzzySearch(n, i)) return o.push(this), !0;
  12153. }
  12154. })), S.debug("Showing only matched items", n), S.remove.filteredItem(), o && X.not(o).addClass(T.filtered);
  12155. },
  12156. fuzzySearch: function fuzzySearch(e, t) {
  12157. var n = t.length,
  12158. i = e.length;
  12159. if (e = e.toLowerCase(), t = t.toLowerCase(), i > n) return !1;
  12160. if (i === n) return e === t;
  12161. e: for (var o = 0, a = 0; o < i; o++) {
  12162. for (var r = e.charCodeAt(o); a < n;) {
  12163. if (t.charCodeAt(a++) === r) continue e;
  12164. }
  12165. return !1;
  12166. }
  12167. return !0;
  12168. },
  12169. exactSearch: function exactSearch(e, t) {
  12170. return e = e.toLowerCase(), (t = t.toLowerCase()).indexOf(e) > -1;
  12171. },
  12172. filterActive: function filterActive() {
  12173. k.useLabels && X.filter("." + T.active).addClass(T.filtered);
  12174. },
  12175. focusSearch: function focusSearch(e) {
  12176. 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());
  12177. },
  12178. forceSelection: function forceSelection() {
  12179. var e = X.not(T.filtered).filter("." + T.selected).eq(0),
  12180. t = X.not(T.filtered).filter("." + T.active).eq(0),
  12181. n = e.length > 0 ? e : t;
  12182. 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);
  12183. k.allowAdditions ? (S.set.selected(S.get.query()), S.remove.searchTerm()) : S.remove.searchTerm();
  12184. },
  12185. change: {
  12186. values: function values(t) {
  12187. k.allowAdditions || S.clear(), S.debug("Creating dropdown with specified values", t), S.setup.menu({
  12188. values: t
  12189. }), e.each(t, function (e, t) {
  12190. if (1 == t.selected) return S.debug("Setting initial selection to", t.value), S.set.selected(t.value), !0;
  12191. });
  12192. }
  12193. },
  12194. event: {
  12195. change: function change() {
  12196. Z || (S.debug("Input changed, updating selection"), S.set.selected());
  12197. },
  12198. focus: function focus() {
  12199. k.showOnFocus && !$ && S.is.hidden() && !v && S.show();
  12200. },
  12201. blur: function blur(e) {
  12202. v = n.activeElement === this, $ || v || (S.remove.activeLabel(), S.hide());
  12203. },
  12204. mousedown: function mousedown() {
  12205. S.is.searchSelection() ? b = !0 : $ = !0;
  12206. },
  12207. mouseup: function mouseup() {
  12208. S.is.searchSelection() ? b = !1 : $ = !1;
  12209. },
  12210. click: function click(t) {
  12211. e(t.target).is(M) && (S.is.focusedOnSearch() ? S.show() : S.focusSearch());
  12212. },
  12213. search: {
  12214. focus: function focus() {
  12215. $ = !0, S.is.multiple() && S.remove.activeLabel(), k.showOnFocus && S.search();
  12216. },
  12217. blur: function blur(e) {
  12218. v = n.activeElement === this, S.is.searchSelection() && !b && (Y || v || (k.forceSelection && S.forceSelection(), S.hide())), b = !1;
  12219. }
  12220. },
  12221. icon: {
  12222. click: function click(e) {
  12223. S.toggle();
  12224. }
  12225. },
  12226. text: {
  12227. focus: function focus(e) {
  12228. $ = !0, S.focusSearch();
  12229. }
  12230. },
  12231. input: function input(e) {
  12232. (S.is.multiple() || S.is.searchSelection()) && S.set.filtered(), clearTimeout(S.timer), S.timer = setTimeout(S.search, k.delay.search);
  12233. },
  12234. label: {
  12235. click: function click(t) {
  12236. var n = e(this),
  12237. i = M.find(D.label),
  12238. o = i.filter("." + T.active),
  12239. a = n.nextAll("." + T.active),
  12240. r = n.prevAll("." + T.active),
  12241. s = a.length > 0 ? n.nextUntil(a).add(o).add(n) : n.prevUntil(r).add(o).add(n);
  12242. 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));
  12243. }
  12244. },
  12245. remove: {
  12246. click: function click() {
  12247. var t = e(this).parent();
  12248. t.hasClass(T.active) ? S.remove.activeLabels() : S.remove.activeLabels(t);
  12249. }
  12250. },
  12251. test: {
  12252. toggle: function toggle(e) {
  12253. var t = S.is.multiple() ? S.show : S.toggle;
  12254. S.is.bubbledLabelClick(e) || S.is.bubbledIconClick(e) || S.determine.eventOnElement(e, t) && e.preventDefault();
  12255. },
  12256. touch: function touch(e) {
  12257. S.determine.eventOnElement(e, function () {
  12258. "touchstart" == e.type ? S.timer = setTimeout(function () {
  12259. S.hide();
  12260. }, k.delay.touch) : "touchmove" == e.type && clearTimeout(S.timer);
  12261. }), e.stopPropagation();
  12262. },
  12263. hide: function hide(e) {
  12264. S.determine.eventInModule(e, S.hide);
  12265. }
  12266. },
  12267. select: {
  12268. mutation: function mutation(t) {
  12269. S.debug("<select> modified, recreating menu");
  12270. var n = !1;
  12271. e.each(t, function (t, i) {
  12272. if (e(i.target).is("select") || e(i.addedNodes).is("select")) return n = !0, !0;
  12273. }), n && (S.disconnect.selectObserver(), S.refresh(), S.setup.select(), S.set.selected(), S.observe.select());
  12274. }
  12275. },
  12276. menu: {
  12277. mutation: function mutation(t) {
  12278. var n = t[0],
  12279. i = n.addedNodes ? e(n.addedNodes[0]) : e(!1),
  12280. o = n.removedNodes ? e(n.removedNodes[0]) : e(!1),
  12281. a = i.add(o),
  12282. r = a.is(D.addition) || a.closest(D.addition).length > 0,
  12283. s = a.is(D.message) || a.closest(D.message).length > 0;
  12284. r || s ? (S.debug("Updating item selector cache"), S.refreshItems()) : (S.debug("Menu modified, updating selector cache"), S.refresh());
  12285. },
  12286. mousedown: function mousedown() {
  12287. Y = !0;
  12288. },
  12289. mouseup: function mouseup() {
  12290. Y = !1;
  12291. }
  12292. },
  12293. item: {
  12294. mouseenter: function mouseenter(t) {
  12295. var n = e(t.target),
  12296. i = e(this),
  12297. o = i.children(D.menu),
  12298. a = i.siblings(D.item).children(D.menu),
  12299. r = o.length > 0;
  12300. !(o.find(n).length > 0) && r && (clearTimeout(S.itemTimer), S.itemTimer = setTimeout(function () {
  12301. S.verbose("Showing sub-menu", o), e.each(a, function () {
  12302. S.animate.hide(!1, e(this));
  12303. }), S.animate.show(!1, o);
  12304. }, k.delay.show), t.preventDefault());
  12305. },
  12306. mouseleave: function mouseleave(t) {
  12307. var n = e(this).children(D.menu);
  12308. n.length > 0 && (clearTimeout(S.itemTimer), S.itemTimer = setTimeout(function () {
  12309. S.verbose("Hiding sub-menu", n), S.animate.hide(!1, n);
  12310. }, k.delay.hide));
  12311. },
  12312. click: function click(t, i) {
  12313. var o = e(this),
  12314. a = e(t ? t.target : ""),
  12315. r = o.find(D.menu),
  12316. s = S.get.choiceText(o),
  12317. l = S.get.choiceValue(o, s),
  12318. c = r.length > 0,
  12319. u = r.find(a).length > 0;
  12320. 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));
  12321. }
  12322. },
  12323. document: {
  12324. keydown: function keydown(e) {
  12325. var t = e.which;
  12326. if (S.is.inObject(t, P)) {
  12327. var n = M.find(D.label),
  12328. i = n.filter("." + T.active),
  12329. o = (i.data(E.value), n.index(i)),
  12330. a = n.length,
  12331. r = i.length > 0,
  12332. s = i.length > 1,
  12333. l = 0 === o,
  12334. c = o + 1 == a,
  12335. u = S.is.searchSelection(),
  12336. d = S.is.focusedOnSearch(),
  12337. f = S.is.focused(),
  12338. m = d && 0 === S.get.caretPosition();
  12339. if (u && !r && !d) return;
  12340. 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);
  12341. }
  12342. }
  12343. },
  12344. keydown: function keydown(e) {
  12345. var t = e.which;
  12346. if (S.is.inObject(t, P)) {
  12347. var n,
  12348. i = X.not(D.unselectable).filter("." + T.selected).eq(0),
  12349. o = Q.children("." + T.active).eq(0),
  12350. a = i.length > 0 ? i : o,
  12351. r = a.length > 0 ? a.siblings(":not(." + T.filtered + ")").addBack() : Q.children(":not(." + T.filtered + ")"),
  12352. s = a.children(D.menu),
  12353. l = a.closest(D.menu),
  12354. c = l.hasClass(T.visible) || l.hasClass(T.animating) || l.parent(D.menu).length > 0,
  12355. u = s.length > 0,
  12356. d = a.length > 0,
  12357. f = a.not(D.unselectable).length > 0,
  12358. m = t == P.delimiter && k.allowAdditions && S.is.multiple();
  12359. 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()) {
  12360. 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) {
  12361. 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();
  12362. 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();
  12363. }
  12364. if (t == P.downArrow) {
  12365. 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();
  12366. 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();
  12367. }
  12368. 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());
  12369. } else m && e.preventDefault(), t != P.downArrow || S.is.visible() || (S.verbose("Down key pressed, showing dropdown"), S.show(), e.preventDefault());
  12370. } else S.has.search() || S.set.selectedLetter(String.fromCharCode(t));
  12371. }
  12372. },
  12373. trigger: {
  12374. change: function change() {
  12375. var e = n.createEvent("HTMLEvents"),
  12376. t = U[0];
  12377. t && (S.verbose("Triggering native change event"), e.initEvent("change", !0, !1), t.dispatchEvent(e));
  12378. }
  12379. },
  12380. determine: {
  12381. selectAction: function selectAction(t, n) {
  12382. 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);
  12383. },
  12384. eventInModule: function eventInModule(t, i) {
  12385. var o = e(t.target),
  12386. a = o.closest(n.documentElement).length > 0,
  12387. r = o.closest(M).length > 0;
  12388. 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);
  12389. },
  12390. eventOnElement: function eventOnElement(t, i) {
  12391. var o = e(t.target),
  12392. a = o.closest(D.siblingLabel),
  12393. r = n.body.contains(t.target),
  12394. s = 0 === M.find(a).length,
  12395. l = 0 === o.closest(Q).length;
  12396. 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);
  12397. }
  12398. },
  12399. action: {
  12400. nothing: function nothing() {},
  12401. activate: function activate(t, n, o) {
  12402. if (n = n !== i ? n : t, S.can.activate(e(o))) {
  12403. if (S.set.selected(n, e(o)), S.is.multiple() && !S.is.allFiltered()) return;
  12404. S.hideAndClear();
  12405. }
  12406. },
  12407. select: function select(t, n, o) {
  12408. if (n = n !== i ? n : t, S.can.activate(e(o))) {
  12409. if (S.set.value(n, t, e(o)), S.is.multiple() && !S.is.allFiltered()) return;
  12410. S.hideAndClear();
  12411. }
  12412. },
  12413. combo: function combo(t, n, o) {
  12414. n = n !== i ? n : t, S.set.selected(n, e(o)), S.hideAndClear();
  12415. },
  12416. hide: function hide(e, t, n) {
  12417. S.set.value(t, e), S.hideAndClear();
  12418. }
  12419. },
  12420. get: {
  12421. id: function id() {
  12422. return x;
  12423. },
  12424. defaultText: function defaultText() {
  12425. return M.data(E.defaultText);
  12426. },
  12427. defaultValue: function defaultValue() {
  12428. return M.data(E.defaultValue);
  12429. },
  12430. placeholderText: function placeholderText() {
  12431. return "auto" != k.placeholder && "string" == typeof k.placeholder ? k.placeholder : M.data(E.placeholderText) || "";
  12432. },
  12433. text: function text() {
  12434. return V.text();
  12435. },
  12436. query: function query() {
  12437. return e.trim(N.val());
  12438. },
  12439. searchWidth: function searchWidth(e) {
  12440. return e = e !== i ? e : N.val(), H.text(e), Math.ceil(H.width() + 1);
  12441. },
  12442. selectionCount: function selectionCount() {
  12443. var t = S.get.values();
  12444. return S.is.multiple() ? e.isArray(t) ? t.length : 0 : "" !== S.get.value() ? 1 : 0;
  12445. },
  12446. transition: function transition(e) {
  12447. return "auto" == k.transition ? S.is.upward(e) ? "slide up" : "slide down" : k.transition;
  12448. },
  12449. userValues: function userValues() {
  12450. var t = S.get.values();
  12451. return !!t && (t = e.isArray(t) ? t : [t], e.grep(t, function (e) {
  12452. return !1 === S.get.item(e);
  12453. }));
  12454. },
  12455. uniqueArray: function uniqueArray(t) {
  12456. return e.grep(t, function (n, i) {
  12457. return e.inArray(n, t) === i;
  12458. });
  12459. },
  12460. caretPosition: function caretPosition() {
  12461. var e,
  12462. t,
  12463. i = N.get(0);
  12464. 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;
  12465. },
  12466. value: function value() {
  12467. var t = U.length > 0 ? U.val() : M.data(E.value),
  12468. n = e.isArray(t) && 1 === t.length && "" === t[0];
  12469. return t === i || n ? "" : t;
  12470. },
  12471. values: function values() {
  12472. var e = S.get.value();
  12473. return "" === e ? "" : !S.has.selectInput() && S.is.multiple() ? "string" == typeof e ? e.split(k.delimiter) : "" : e;
  12474. },
  12475. remoteValues: function remoteValues() {
  12476. var t = S.get.values(),
  12477. n = !1;
  12478. return t && ("string" == typeof t && (t = [t]), e.each(t, function (e, t) {
  12479. var i = S.read.remoteData(t);
  12480. S.verbose("Restoring value from session data", i, t), i && (n || (n = {}), n[t] = i);
  12481. })), n;
  12482. },
  12483. choiceText: function choiceText(t, n) {
  12484. 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());
  12485. },
  12486. choiceValue: function choiceValue(t, n) {
  12487. 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));
  12488. },
  12489. inputEvent: function inputEvent() {
  12490. var e = N[0];
  12491. return !!e && (e.oninput !== i ? "input" : e.onpropertychange !== i ? "propertychange" : "keyup");
  12492. },
  12493. selectValues: function selectValues() {
  12494. var t = {
  12495. values: []
  12496. };
  12497. return M.find("option").each(function () {
  12498. var n = e(this),
  12499. o = n.html(),
  12500. a = n.attr("disabled"),
  12501. r = n.attr("value") !== i ? n.attr("value") : o;
  12502. "auto" === k.placeholder && "" === r ? t.placeholder = o : t.values.push({
  12503. name: o,
  12504. value: r,
  12505. disabled: a
  12506. });
  12507. }), 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) {
  12508. return e.name > t.name ? 1 : -1;
  12509. }), S.debug("Retrieved and sorted values from select", t)) : S.debug("Retrieved values from select", t), t;
  12510. },
  12511. activeItem: function activeItem() {
  12512. return X.filter("." + T.active);
  12513. },
  12514. selectedItem: function selectedItem() {
  12515. var e = X.not(D.unselectable).filter("." + T.selected);
  12516. return e.length > 0 ? e : X.eq(0);
  12517. },
  12518. itemWithAdditions: function itemWithAdditions(e) {
  12519. var t = S.get.item(e),
  12520. n = S.create.userChoice(e);
  12521. return n && n.length > 0 && (t = t.length > 0 ? t.add(n) : n), t;
  12522. },
  12523. item: function item(t, n) {
  12524. var o,
  12525. a,
  12526. r = !1;
  12527. 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 () {
  12528. var o = e(this),
  12529. s = S.get.choiceText(o),
  12530. l = S.get.choiceValue(o, s);
  12531. 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) {
  12532. if (S.verbose("Ambiguous dropdown value using strict type check", o, t), l === t || s === t) return r = o, !0;
  12533. } else if (String(l) == String(t) || s == t) return S.verbose("Found select item by value", l, t), r = o, !0;
  12534. }), r;
  12535. }
  12536. },
  12537. check: {
  12538. maxSelections: function maxSelections(e) {
  12539. 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));
  12540. }
  12541. },
  12542. restore: {
  12543. defaults: function defaults() {
  12544. S.clear(), S.restore.defaultText(), S.restore.defaultValue();
  12545. },
  12546. defaultText: function defaultText() {
  12547. var e = S.get.defaultText();
  12548. 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));
  12549. },
  12550. placeholderText: function placeholderText() {
  12551. S.set.placeholderText();
  12552. },
  12553. defaultValue: function defaultValue() {
  12554. var e = S.get.defaultValue();
  12555. e !== i && (S.debug("Restoring default value", e), "" !== e ? (S.set.value(e), S.set.selected()) : (S.remove.activeItem(), S.remove.selectedItem()));
  12556. },
  12557. labels: function labels() {
  12558. k.allowAdditions && (k.useLabels || (S.error(q.labels), k.useLabels = !0), S.debug("Restoring selected values"), S.create.userLabels()), S.check.maxSelections();
  12559. },
  12560. selected: function selected() {
  12561. S.restore.values(), S.is.multiple() ? (S.debug("Restoring previously selected values and labels"), S.restore.labels()) : S.debug("Restoring previously selected values");
  12562. },
  12563. values: function values() {
  12564. S.set.initialLoad(), k.apiSettings && k.saveRemoteData && S.get.remoteValues() ? S.restore.remoteValues() : S.set.selected(), S.remove.initialLoad();
  12565. },
  12566. remoteValues: function remoteValues() {
  12567. var t = S.get.remoteValues();
  12568. S.debug("Recreating selected from session data", t), t && (S.is.single() ? e.each(t, function (e, t) {
  12569. S.set.text(t);
  12570. }) : e.each(t, function (e, t) {
  12571. S.add.label(e, t);
  12572. }));
  12573. }
  12574. },
  12575. read: {
  12576. remoteData: function remoteData(e) {
  12577. var n;
  12578. if (t.Storage !== i) return (n = sessionStorage.getItem(e)) !== i && n;
  12579. S.error(q.noStorage);
  12580. }
  12581. },
  12582. save: {
  12583. defaults: function defaults() {
  12584. S.save.defaultText(), S.save.placeholderText(), S.save.defaultValue();
  12585. },
  12586. defaultValue: function defaultValue() {
  12587. var e = S.get.value();
  12588. S.verbose("Saving default value as", e), M.data(E.defaultValue, e);
  12589. },
  12590. defaultText: function defaultText() {
  12591. var e = S.get.text();
  12592. S.verbose("Saving default text as", e), M.data(E.defaultText, e);
  12593. },
  12594. placeholderText: function placeholderText() {
  12595. var e;
  12596. !1 !== k.placeholder && V.hasClass(T.placeholder) && (e = S.get.text(), S.verbose("Saving placeholder text as", e), M.data(E.placeholderText, e));
  12597. },
  12598. remoteData: function remoteData(e, n) {
  12599. t.Storage !== i ? (S.verbose("Saving remote data to session storage", n, e), sessionStorage.setItem(n, e)) : S.error(q.noStorage);
  12600. }
  12601. },
  12602. clear: function clear() {
  12603. S.is.multiple() && k.useLabels ? S.remove.labels() : (S.remove.activeItem(), S.remove.selectedItem()), S.set.placeholderText(), S.clearValue();
  12604. },
  12605. clearValue: function clearValue() {
  12606. S.set.value("");
  12607. },
  12608. scrollPage: function scrollPage(e, t) {
  12609. var n,
  12610. i,
  12611. o = t || S.get.selectedItem(),
  12612. a = o.closest(D.menu),
  12613. r = a.outerHeight(),
  12614. s = a.scrollTop(),
  12615. l = X.eq(0).outerHeight(),
  12616. c = Math.floor(r / l),
  12617. u = (a.prop("scrollHeight"), "up" == e ? s - l * c : s + l * c),
  12618. d = X.not(D.unselectable);
  12619. 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));
  12620. },
  12621. set: {
  12622. filtered: function filtered() {
  12623. var e = S.is.multiple(),
  12624. t = S.is.searchSelection(),
  12625. n = e && t,
  12626. i = t ? S.get.query() : "",
  12627. o = "string" == typeof i && i.length > 0,
  12628. a = S.get.searchWidth(),
  12629. r = "" !== i;
  12630. 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));
  12631. },
  12632. empty: function empty() {
  12633. M.addClass(T.empty);
  12634. },
  12635. loading: function loading() {
  12636. M.addClass(T.loading);
  12637. },
  12638. placeholderText: function placeholderText(e) {
  12639. e = e || S.get.placeholderText(), S.debug("Setting placeholder text", e), S.set.text(e), V.addClass(T.placeholder);
  12640. },
  12641. tabbable: function tabbable() {
  12642. 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)));
  12643. },
  12644. initialLoad: function initialLoad() {
  12645. S.verbose("Setting initial load"), h = !0;
  12646. },
  12647. activeItem: function activeItem(e) {
  12648. k.allowAdditions && e.filter(D.addition).length > 0 ? e.addClass(T.filtered) : e.addClass(T.active);
  12649. },
  12650. partialSearch: function partialSearch(e) {
  12651. var t = S.get.query().length;
  12652. N.val(e.substr(0, t));
  12653. },
  12654. scrollPosition: function scrollPosition(e, t) {
  12655. var n, o, a, r, s, l;
  12656. 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));
  12657. },
  12658. text: function text(e) {
  12659. "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)));
  12660. },
  12661. selectedItem: function selectedItem(e) {
  12662. var t = S.get.choiceValue(e),
  12663. n = S.get.choiceText(e, !1),
  12664. i = S.get.choiceText(e, !0);
  12665. 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);
  12666. },
  12667. selectedLetter: function selectedLetter(t) {
  12668. var n,
  12669. i = X.filter("." + T.selected),
  12670. o = !1;
  12671. 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 () {
  12672. if (S.has.firstLetter(e(this), t)) return o = e(this), !1;
  12673. }), 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));
  12674. },
  12675. direction: function direction(e) {
  12676. "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);
  12677. },
  12678. upward: function upward(e) {
  12679. (e || M).addClass(T.upward);
  12680. },
  12681. leftward: function leftward(e) {
  12682. (e || Q).addClass(T.leftward);
  12683. },
  12684. value: function value(e, t, n) {
  12685. var o = S.escape.value(e),
  12686. a = U.length > 0,
  12687. r = S.get.values(),
  12688. s = e !== i ? String(e) : e;
  12689. if (a) {
  12690. if (!k.allowReselection && s == r && (S.verbose("Skipping value update already same value", e, r), !S.is.initialLoad())) return;
  12691. 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;
  12692. } else S.verbose("Storing value in metadata", o, U), o !== r && M.data(E.value, s);
  12693. !1 === k.fireOnInit && S.is.initialLoad() ? S.verbose("No callback on initial load", k.onChange) : k.onChange.call(K, e, t, n);
  12694. },
  12695. active: function active() {
  12696. M.addClass(T.active);
  12697. },
  12698. multiple: function multiple() {
  12699. M.addClass(T.multiple);
  12700. },
  12701. visible: function visible() {
  12702. M.addClass(T.visible);
  12703. },
  12704. exactly: function exactly(e, t) {
  12705. S.debug("Setting selected to exact values"), S.clear(), S.set.selected(e, t);
  12706. },
  12707. selected: function selected(t, n) {
  12708. var i = S.is.multiple();
  12709. (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 () {
  12710. var t = e(this),
  12711. o = S.get.choiceText(t),
  12712. a = S.get.choiceValue(t, o),
  12713. r = t.hasClass(T.filtered),
  12714. s = t.hasClass(T.active),
  12715. l = t.hasClass(T.addition),
  12716. c = i && 1 == n.length;
  12717. 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));
  12718. }));
  12719. }
  12720. },
  12721. add: {
  12722. label: function label(t, n, i) {
  12723. var o,
  12724. a = S.is.searchSelection() ? N : V,
  12725. r = S.escape.value(t);
  12726. 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)));
  12727. },
  12728. message: function message(t) {
  12729. var n = Q.children(D.message),
  12730. i = k.templates.message(S.add.variables(t));
  12731. n.length > 0 ? n.html(i) : n = e("<div/>").html(i).addClass(T.message).appendTo(Q);
  12732. },
  12733. optionValue: function optionValue(t) {
  12734. var n = S.escape.value(t);
  12735. 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());
  12736. },
  12737. userSuggestion: function userSuggestion(e) {
  12738. var t,
  12739. n = Q.children(D.addition),
  12740. i = S.get.item(e),
  12741. o = i && i.not(D.addition).length,
  12742. a = n.length > 0;
  12743. 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()));
  12744. },
  12745. variables: function variables(e, t) {
  12746. var n,
  12747. i,
  12748. o = -1 !== e.search("{count}"),
  12749. a = -1 !== e.search("{maxCount}"),
  12750. r = -1 !== e.search("{term}");
  12751. 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;
  12752. },
  12753. value: function value(t, n, i) {
  12754. var o,
  12755. a = S.get.values();
  12756. 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");
  12757. }
  12758. },
  12759. remove: {
  12760. active: function active() {
  12761. M.removeClass(T.active);
  12762. },
  12763. activeLabel: function activeLabel() {
  12764. M.find(D.label).removeClass(T.active);
  12765. },
  12766. empty: function empty() {
  12767. M.removeClass(T.empty);
  12768. },
  12769. loading: function loading() {
  12770. M.removeClass(T.loading);
  12771. },
  12772. initialLoad: function initialLoad() {
  12773. h = !1;
  12774. },
  12775. upward: function upward(e) {
  12776. (e || M).removeClass(T.upward);
  12777. },
  12778. leftward: function leftward(e) {
  12779. (e || Q).removeClass(T.leftward);
  12780. },
  12781. visible: function visible() {
  12782. M.removeClass(T.visible);
  12783. },
  12784. activeItem: function activeItem() {
  12785. X.removeClass(T.active);
  12786. },
  12787. filteredItem: function filteredItem() {
  12788. k.useLabels && S.has.maxSelections() || (k.useLabels && S.is.multiple() ? X.not("." + T.active).removeClass(T.filtered) : X.removeClass(T.filtered), S.remove.empty());
  12789. },
  12790. optionValue: function optionValue(e) {
  12791. var t = S.escape.value(e),
  12792. n = U.find('option[value="' + S.escape.string(t) + '"]');
  12793. 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], {
  12794. childList: !0,
  12795. subtree: !0
  12796. }));
  12797. },
  12798. message: function message() {
  12799. Q.children(D.message).remove();
  12800. },
  12801. searchWidth: function searchWidth() {
  12802. N.css("width", "");
  12803. },
  12804. searchTerm: function searchTerm() {
  12805. S.verbose("Cleared search term"), N.val(""), S.set.filtered();
  12806. },
  12807. userAddition: function userAddition() {
  12808. X.filter(D.addition).remove();
  12809. },
  12810. selected: function selected(t, n) {
  12811. if (!(n = k.allowAdditions ? n || S.get.itemWithAdditions(t) : n || S.get.item(t))) return !1;
  12812. n.each(function () {
  12813. var t = e(this),
  12814. n = S.get.choiceText(t),
  12815. i = S.get.choiceValue(t, n);
  12816. 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);
  12817. });
  12818. },
  12819. selectedItem: function selectedItem() {
  12820. X.removeClass(T.selected);
  12821. },
  12822. value: function value(e, t, n) {
  12823. var i,
  12824. o = S.get.values();
  12825. 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();
  12826. },
  12827. arrayValue: function arrayValue(t, n) {
  12828. return e.isArray(n) || (n = [n]), n = e.grep(n, function (e) {
  12829. return t != e;
  12830. }), S.verbose("Removed value from delimited string", t, n), n;
  12831. },
  12832. label: function label(e, t) {
  12833. var n = M.find(D.label).filter("[data-" + E.value + '="' + S.escape.string(e) + '"]');
  12834. S.verbose("Removing label", n), n.remove();
  12835. },
  12836. activeLabels: function activeLabels(e) {
  12837. e = e || M.find(D.label).filter("." + T.active), S.verbose("Removing active label selections", e), S.remove.labels(e);
  12838. },
  12839. labels: function labels(t) {
  12840. t = t || M.find(D.label), S.verbose("Removing labels", t), t.each(function () {
  12841. var t = e(this),
  12842. n = t.data(E.value),
  12843. o = n !== i ? String(n) : n,
  12844. a = S.is.userValue(o);
  12845. !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");
  12846. });
  12847. },
  12848. tabbable: function tabbable() {
  12849. 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"));
  12850. }
  12851. },
  12852. has: {
  12853. menuSearch: function menuSearch() {
  12854. return S.has.search() && N.closest(Q).length > 0;
  12855. },
  12856. search: function search() {
  12857. return N.length > 0;
  12858. },
  12859. sizer: function sizer() {
  12860. return H.length > 0;
  12861. },
  12862. selectInput: function selectInput() {
  12863. return U.is("select");
  12864. },
  12865. minCharacters: function minCharacters(e) {
  12866. return !k.minCharacters || (e = e !== i ? String(e) : String(S.get.query())).length >= k.minCharacters;
  12867. },
  12868. firstLetter: function firstLetter(e, t) {
  12869. var n;
  12870. return !(!e || 0 === e.length || "string" != typeof t) && (n = S.get.choiceText(e, !1), (t = t.toLowerCase()) == String(n).charAt(0).toLowerCase());
  12871. },
  12872. input: function input() {
  12873. return U.length > 0;
  12874. },
  12875. items: function items() {
  12876. return X.length > 0;
  12877. },
  12878. menu: function menu() {
  12879. return Q.length > 0;
  12880. },
  12881. message: function message() {
  12882. return 0 !== Q.children(D.message).length;
  12883. },
  12884. label: function label(e) {
  12885. var t = S.escape.value(e),
  12886. n = M.find(D.label);
  12887. return k.ignoreCase && (t = t.toLowerCase()), n.filter("[data-" + E.value + '="' + S.escape.string(t) + '"]').length > 0;
  12888. },
  12889. maxSelections: function maxSelections() {
  12890. return k.maxSelections && S.get.selectionCount() >= k.maxSelections;
  12891. },
  12892. allResultsFiltered: function allResultsFiltered() {
  12893. var e = X.not(D.addition);
  12894. return e.filter(D.unselectable).length === e.length;
  12895. },
  12896. userSuggestion: function userSuggestion() {
  12897. return Q.children(D.addition).length > 0;
  12898. },
  12899. query: function query() {
  12900. return "" !== S.get.query();
  12901. },
  12902. value: function value(e) {
  12903. return k.ignoreCase ? S.has.valueIgnoringCase(e) : S.has.valueMatchingCase(e);
  12904. },
  12905. valueMatchingCase: function valueMatchingCase(t) {
  12906. var n = S.get.values();
  12907. return !!(e.isArray(n) ? n && -1 !== e.inArray(t, n) : n == t);
  12908. },
  12909. valueIgnoringCase: function valueIgnoringCase(t) {
  12910. var n = S.get.values(),
  12911. i = !1;
  12912. return e.isArray(n) || (n = [n]), e.each(n, function (e, n) {
  12913. if (String(t).toLowerCase() == String(n).toLowerCase()) return i = !0, !1;
  12914. }), i;
  12915. }
  12916. },
  12917. is: {
  12918. active: function active() {
  12919. return M.hasClass(T.active);
  12920. },
  12921. animatingInward: function animatingInward() {
  12922. return Q.transition("is inward");
  12923. },
  12924. animatingOutward: function animatingOutward() {
  12925. return Q.transition("is outward");
  12926. },
  12927. bubbledLabelClick: function bubbledLabelClick(t) {
  12928. return e(t.target).is("select, input") && M.closest("label").length > 0;
  12929. },
  12930. bubbledIconClick: function bubbledIconClick(t) {
  12931. return e(t.target).closest(W).length > 0;
  12932. },
  12933. alreadySetup: function alreadySetup() {
  12934. return M.is("select") && M.parent(D.dropdown).data(I) !== i && 0 === M.prev().length;
  12935. },
  12936. animating: function animating(e) {
  12937. return e ? e.transition && e.transition("is animating") : Q.transition && Q.transition("is animating");
  12938. },
  12939. leftward: function leftward(e) {
  12940. return (e || Q).hasClass(T.leftward);
  12941. },
  12942. disabled: function disabled() {
  12943. return M.hasClass(T.disabled);
  12944. },
  12945. focused: function focused() {
  12946. return n.activeElement === M[0];
  12947. },
  12948. focusedOnSearch: function focusedOnSearch() {
  12949. return n.activeElement === N[0];
  12950. },
  12951. allFiltered: function allFiltered() {
  12952. return (S.is.multiple() || S.has.search()) && !(0 == k.hideAdditions && S.has.userSuggestion()) && !S.has.message() && S.has.allResultsFiltered();
  12953. },
  12954. hidden: function hidden(e) {
  12955. return !S.is.visible(e);
  12956. },
  12957. initialLoad: function initialLoad() {
  12958. return h;
  12959. },
  12960. inObject: function inObject(t, n) {
  12961. var i = !1;
  12962. return e.each(n, function (e, n) {
  12963. if (n == t) return i = !0, !0;
  12964. }), i;
  12965. },
  12966. multiple: function multiple() {
  12967. return M.hasClass(T.multiple);
  12968. },
  12969. remote: function remote() {
  12970. return k.apiSettings && S.can.useAPI();
  12971. },
  12972. single: function single() {
  12973. return !S.is.multiple();
  12974. },
  12975. selectMutation: function selectMutation(t) {
  12976. var n = !1;
  12977. return e.each(t, function (t, i) {
  12978. if (i.target && e(i.target).is("select")) return n = !0, !0;
  12979. }), n;
  12980. },
  12981. search: function search() {
  12982. return M.hasClass(T.search);
  12983. },
  12984. searchSelection: function searchSelection() {
  12985. return S.has.search() && 1 === N.parent(D.dropdown).length;
  12986. },
  12987. selection: function selection() {
  12988. return M.hasClass(T.selection);
  12989. },
  12990. userValue: function userValue(t) {
  12991. return -1 !== e.inArray(t, S.get.userValues());
  12992. },
  12993. upward: function upward(e) {
  12994. return (e || M).hasClass(T.upward);
  12995. },
  12996. visible: function visible(e) {
  12997. return e ? e.hasClass(T.visible) : Q.hasClass(T.visible);
  12998. },
  12999. verticallyScrollableContext: function verticallyScrollableContext() {
  13000. var e = L.get(0) !== t && L.css("overflow-y");
  13001. return "auto" == e || "scroll" == e;
  13002. },
  13003. horizontallyScrollableContext: function horizontallyScrollableContext() {
  13004. var e = L.get(0) !== t && L.css("overflow-X");
  13005. return "auto" == e || "scroll" == e;
  13006. }
  13007. },
  13008. can: {
  13009. activate: function activate(e) {
  13010. return !!k.useLabels || !S.has.maxSelections() || !(!S.has.maxSelections() || !e.hasClass(T.active));
  13011. },
  13012. openDownward: function openDownward(e) {
  13013. var n,
  13014. i,
  13015. o = e || Q,
  13016. a = !0;
  13017. return o.addClass(T.loading), i = {
  13018. context: {
  13019. offset: L.get(0) === t ? {
  13020. top: 0,
  13021. left: 0
  13022. } : L.offset(),
  13023. scrollTop: L.scrollTop(),
  13024. height: L.outerHeight()
  13025. },
  13026. menu: {
  13027. offset: o.offset(),
  13028. height: o.outerHeight()
  13029. }
  13030. }, S.is.verticallyScrollableContext() && (i.menu.offset.top += i.context.scrollTop), (n = {
  13031. above: i.context.scrollTop <= i.menu.offset.top - i.context.offset.top - i.menu.height,
  13032. below: i.context.scrollTop + i.context.height >= i.menu.offset.top - i.context.offset.top + i.menu.height
  13033. }).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;
  13034. },
  13035. openRightward: function openRightward(e) {
  13036. var n,
  13037. i,
  13038. o = e || Q,
  13039. a = !0;
  13040. return o.addClass(T.loading), i = {
  13041. context: {
  13042. offset: L.get(0) === t ? {
  13043. top: 0,
  13044. left: 0
  13045. } : L.offset(),
  13046. scrollLeft: L.scrollLeft(),
  13047. width: L.outerWidth()
  13048. },
  13049. menu: {
  13050. offset: o.offset(),
  13051. width: o.outerWidth()
  13052. }
  13053. }, 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;
  13054. },
  13055. click: function click() {
  13056. return c || "click" == k.on;
  13057. },
  13058. extendSelect: function extendSelect() {
  13059. return k.allowAdditions || k.apiSettings;
  13060. },
  13061. show: function show() {
  13062. return !S.is.disabled() && (S.has.items() || S.has.message());
  13063. },
  13064. useAPI: function useAPI() {
  13065. return e.fn.api !== i;
  13066. }
  13067. },
  13068. animate: {
  13069. show: function show(t, n) {
  13070. var o,
  13071. a = n || Q,
  13072. r = n ? function () {} : function () {
  13073. S.hideSubMenus(), S.hideOthers(), S.set.active();
  13074. };
  13075. 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({
  13076. animation: o + " in",
  13077. debug: k.debug,
  13078. verbose: k.verbose,
  13079. duration: k.duration,
  13080. queue: !0,
  13081. onStart: r,
  13082. onComplete: function onComplete() {
  13083. t.call(K);
  13084. }
  13085. }) : S.error(q.noTransition, o));
  13086. },
  13087. hide: function hide(t, n) {
  13088. var o = n || Q,
  13089. a = (n ? k.duration : k.duration, n ? function () {} : function () {
  13090. S.can.click() && S.unbind.intent(), S.remove.active();
  13091. }),
  13092. r = S.get.transition(n);
  13093. 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({
  13094. animation: r + " out",
  13095. duration: k.duration,
  13096. debug: k.debug,
  13097. verbose: k.verbose,
  13098. queue: !1,
  13099. onStart: a,
  13100. onComplete: function onComplete() {
  13101. t.call(K);
  13102. }
  13103. }) : S.error(q.transition));
  13104. }
  13105. },
  13106. hideAndClear: function hideAndClear() {
  13107. S.remove.searchTerm(), S.has.maxSelections() || (S.has.search() ? S.hide(function () {
  13108. S.remove.filteredItem();
  13109. }) : S.hide());
  13110. },
  13111. delay: {
  13112. show: function show() {
  13113. S.verbose("Delaying show event to ensure user intent"), clearTimeout(S.timer), S.timer = setTimeout(S.show, k.delay.show);
  13114. },
  13115. hide: function hide() {
  13116. S.verbose("Delaying hide event to ensure user intent"), clearTimeout(S.timer), S.timer = setTimeout(S.hide, k.delay.hide);
  13117. }
  13118. },
  13119. escape: {
  13120. value: function value(t) {
  13121. var n = e.isArray(t),
  13122. i = "string" == typeof t,
  13123. o = !i && !n,
  13124. a = i && -1 !== t.search(O.quote),
  13125. r = [];
  13126. return o || !a ? t : (S.debug("Encoding quote values for use in select", t), n ? (e.each(t, function (e, t) {
  13127. r.push(t.replace(O.quote, "&quot;"));
  13128. }), r) : t.replace(O.quote, "&quot;"));
  13129. },
  13130. string: function string(e) {
  13131. return (e = String(e)).replace(O.escape, "\\$&");
  13132. }
  13133. },
  13134. setting: function setting(t, n) {
  13135. if (S.debug("Changing setting", t, n), e.isPlainObject(t)) e.extend(!0, k, t);else {
  13136. if (n === i) return k[t];
  13137. e.isPlainObject(k[t]) ? e.extend(!0, k[t], n) : k[t] = n;
  13138. }
  13139. },
  13140. internal: function internal(t, n) {
  13141. if (e.isPlainObject(t)) e.extend(!0, S, t);else {
  13142. if (n === i) return S[t];
  13143. S[t] = n;
  13144. }
  13145. },
  13146. debug: function debug() {
  13147. !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)));
  13148. },
  13149. verbose: function verbose() {
  13150. !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)));
  13151. },
  13152. error: function error() {
  13153. k.silent || (S.error = Function.prototype.bind.call(console.error, console, k.name + ":"), S.error.apply(console, arguments));
  13154. },
  13155. performance: {
  13156. log: function log(e) {
  13157. var t, n;
  13158. k.performance && (n = (t = new Date().getTime()) - (u || t), u = t, d.push({
  13159. Name: e[0],
  13160. Arguments: [].slice.call(e, 1) || "",
  13161. Element: K,
  13162. "Execution Time": n
  13163. })), clearTimeout(S.performance.timer), S.performance.timer = setTimeout(S.performance.display, 500);
  13164. },
  13165. display: function display() {
  13166. var t = k.name + ":",
  13167. n = 0;
  13168. u = !1, clearTimeout(S.performance.timer), e.each(d, function (e, t) {
  13169. n += t["Execution Time"];
  13170. }), 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) {
  13171. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  13172. }), console.groupEnd()), d = [];
  13173. }
  13174. },
  13175. invoke: function invoke(t, n, o) {
  13176. var r,
  13177. s,
  13178. l,
  13179. c = J;
  13180. 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) {
  13181. var a = n != r ? o + t[n + 1].charAt(0).toUpperCase() + t[n + 1].slice(1) : t;
  13182. if (e.isPlainObject(c[a]) && n != r) c = c[a];else {
  13183. if (c[a] !== i) return s = c[a], !1;
  13184. if (!e.isPlainObject(c[o]) || n == r) return c[o] !== i ? (s = c[o], !1) : (S.error(q.method, t), !1);
  13185. c = c[o];
  13186. }
  13187. })), 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;
  13188. }
  13189. }, m ? (J === i && S.initialize(), S.invoke(f)) : (J !== i && J.invoke("destroy"), S.initialize());
  13190. }), a !== i ? a : r;
  13191. }, e.fn.dropdown.settings = {
  13192. silent: !1,
  13193. debug: !1,
  13194. verbose: !1,
  13195. performance: !0,
  13196. on: "click",
  13197. action: "activate",
  13198. values: !1,
  13199. apiSettings: !1,
  13200. selectOnKeydown: !0,
  13201. minCharacters: 0,
  13202. filterRemoteData: !1,
  13203. saveRemoteData: !0,
  13204. throttle: 200,
  13205. context: t,
  13206. direction: "auto",
  13207. keepOnScreen: !0,
  13208. match: "both",
  13209. fullTextSearch: !1,
  13210. placeholder: "auto",
  13211. preserveHTML: !0,
  13212. sortSelect: !1,
  13213. forceSelection: !0,
  13214. allowAdditions: !1,
  13215. ignoreCase: !1,
  13216. hideAdditions: !0,
  13217. maxSelections: !1,
  13218. useLabels: !0,
  13219. delimiter: ",",
  13220. showOnFocus: !0,
  13221. allowReselection: !1,
  13222. allowTab: !0,
  13223. allowCategorySelection: !1,
  13224. fireOnInit: !1,
  13225. transition: "auto",
  13226. duration: 200,
  13227. glyphWidth: 1.037,
  13228. label: {
  13229. transition: "scale",
  13230. duration: 200,
  13231. variation: !1
  13232. },
  13233. delay: {
  13234. hide: 300,
  13235. show: 200,
  13236. search: 20,
  13237. touch: 50
  13238. },
  13239. onChange: function onChange(e, t, n) {},
  13240. onAdd: function onAdd(e, t, n) {},
  13241. onRemove: function onRemove(e, t, n) {},
  13242. onLabelSelect: function onLabelSelect(e) {},
  13243. onLabelCreate: function onLabelCreate(t, n) {
  13244. return e(this);
  13245. },
  13246. onLabelRemove: function onLabelRemove(e) {
  13247. return !0;
  13248. },
  13249. onNoResults: function onNoResults(e) {
  13250. return !0;
  13251. },
  13252. onShow: function onShow() {},
  13253. onHide: function onHide() {},
  13254. name: "Dropdown",
  13255. namespace: "dropdown",
  13256. message: {
  13257. addResult: "Add <b>{term}</b>",
  13258. count: "{count} selected",
  13259. maxSelections: "Max {maxCount} selections",
  13260. noResults: "No results found.",
  13261. serverError: "There was an error contacting the server"
  13262. },
  13263. error: {
  13264. action: "You called a dropdown action that was not defined",
  13265. alreadySetup: "Once a select has been initialized behaviors must be called on the created ui dropdown",
  13266. labels: "Allowing user additions currently requires the use of labels.",
  13267. missingMultiple: "<select> requires multiple property to be set to correctly preserve multiple values",
  13268. method: "The method you called is not defined.",
  13269. noAPI: "The API module is required to load resources remotely",
  13270. noStorage: "Saving remote data requires session storage",
  13271. noTransition: "This module requires ui transitions <https://github.com/Semantic-Org/UI-Transition>"
  13272. },
  13273. regExp: {
  13274. escape: /[-[\]{}()*+?.,\\^$|#\s]/g,
  13275. quote: /"/g
  13276. },
  13277. metadata: {
  13278. defaultText: "defaultText",
  13279. defaultValue: "defaultValue",
  13280. placeholderText: "placeholder",
  13281. text: "text",
  13282. value: "value"
  13283. },
  13284. fields: {
  13285. remoteValues: "results",
  13286. values: "values",
  13287. disabled: "disabled",
  13288. name: "name",
  13289. value: "value",
  13290. text: "text"
  13291. },
  13292. keys: {
  13293. backspace: 8,
  13294. delimiter: 188,
  13295. deleteKey: 46,
  13296. enter: 13,
  13297. escape: 27,
  13298. pageUp: 33,
  13299. pageDown: 34,
  13300. leftArrow: 37,
  13301. upArrow: 38,
  13302. rightArrow: 39,
  13303. downArrow: 40
  13304. },
  13305. selector: {
  13306. addition: ".addition",
  13307. dropdown: ".ui.dropdown",
  13308. hidden: ".hidden",
  13309. icon: "> .dropdown.icon",
  13310. input: '> input[type="hidden"], > select',
  13311. item: ".item",
  13312. label: "> .label",
  13313. remove: "> .label > .delete.icon",
  13314. siblingLabel: ".label",
  13315. menu: ".menu",
  13316. message: ".message",
  13317. menuIcon: ".dropdown.icon",
  13318. search: "input.search, .menu > .search > input, .menu input.search",
  13319. sizer: "> input.sizer",
  13320. text: "> .text:not(.icon)",
  13321. unselectable: ".disabled, .filtered"
  13322. },
  13323. className: {
  13324. active: "active",
  13325. addition: "addition",
  13326. animating: "animating",
  13327. disabled: "disabled",
  13328. empty: "empty",
  13329. dropdown: "ui dropdown",
  13330. filtered: "filtered",
  13331. hidden: "hidden transition",
  13332. item: "item",
  13333. label: "ui label",
  13334. loading: "loading",
  13335. menu: "menu",
  13336. message: "message",
  13337. multiple: "multiple",
  13338. placeholder: "default",
  13339. sizer: "sizer",
  13340. search: "search",
  13341. selected: "selected",
  13342. selection: "selection",
  13343. upward: "upward",
  13344. leftward: "left",
  13345. visible: "visible"
  13346. }
  13347. }, e.fn.dropdown.settings.templates = {
  13348. dropdown: function dropdown(t) {
  13349. var n = t.placeholder || !1,
  13350. i = (t.values, "");
  13351. 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) {
  13352. i += t.disabled ? '<div class="disabled item" data-value="' + t.value + '">' + t.name + "</div>" : '<div class="item" data-value="' + t.value + '">' + t.name + "</div>";
  13353. }), i += "</div>";
  13354. },
  13355. menu: function menu(t, n) {
  13356. var i = t[n.values] || {},
  13357. o = "";
  13358. return e.each(i, function (e, t) {
  13359. var i = t[n.text] ? 'data-text="' + t[n.text] + '"' : "",
  13360. a = t[n.disabled] ? "disabled " : "";
  13361. o += '<div class="' + a + 'item" data-value="' + t[n.value] + '"' + i + ">", o += t[n.name], o += "</div>";
  13362. }), o;
  13363. },
  13364. label: function label(e, t) {
  13365. return t + '<i class="delete icon"></i>';
  13366. },
  13367. message: function message(e) {
  13368. return e;
  13369. },
  13370. addition: function addition(e) {
  13371. return e;
  13372. }
  13373. };
  13374. }(jQuery, window, document), function (e, t, n, i) {
  13375. "use strict";
  13376. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.embed = function (n) {
  13377. var o,
  13378. a = e(this),
  13379. r = a.selector || "",
  13380. s = new Date().getTime(),
  13381. l = [],
  13382. c = arguments[0],
  13383. u = "string" == typeof c,
  13384. d = [].slice.call(arguments, 1);
  13385. return a.each(function () {
  13386. var f,
  13387. m = e.isPlainObject(n) ? e.extend(!0, {}, e.fn.embed.settings, n) : e.extend({}, e.fn.embed.settings),
  13388. g = m.selector,
  13389. p = m.className,
  13390. h = m.sources,
  13391. v = m.error,
  13392. b = m.metadata,
  13393. y = m.namespace,
  13394. x = m.templates,
  13395. C = "." + y,
  13396. w = "module-" + y,
  13397. S = (e(t), e(this)),
  13398. k = (S.find(g.placeholder), S.find(g.icon), S.find(g.embed)),
  13399. T = this,
  13400. A = S.data(w);
  13401. f = {
  13402. initialize: function initialize() {
  13403. f.debug("Initializing embed"), f.determine.autoplay(), f.create(), f.bind.events(), f.instantiate();
  13404. },
  13405. instantiate: function instantiate() {
  13406. f.verbose("Storing instance of module", f), A = f, S.data(w, f);
  13407. },
  13408. destroy: function destroy() {
  13409. f.verbose("Destroying previous instance of embed"), f.reset(), S.removeData(w).off(C);
  13410. },
  13411. refresh: function refresh() {
  13412. f.verbose("Refreshing selector cache"), S.find(g.placeholder), S.find(g.icon), k = S.find(g.embed);
  13413. },
  13414. bind: {
  13415. events: function events() {
  13416. f.has.placeholder() && (f.debug("Adding placeholder events"), S.on("click" + C, g.placeholder, f.createAndShow).on("click" + C, g.icon, f.createAndShow));
  13417. }
  13418. },
  13419. create: function create() {
  13420. f.get.placeholder() ? f.createPlaceholder() : f.createAndShow();
  13421. },
  13422. createPlaceholder: function createPlaceholder(e) {
  13423. var t = f.get.icon(),
  13424. n = f.get.url();
  13425. f.generate.embed(n);
  13426. e = e || f.get.placeholder(), S.html(x.placeholder(e, t)), f.debug("Creating placeholder for embed", e, t);
  13427. },
  13428. createEmbed: function createEmbed(t) {
  13429. 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);
  13430. },
  13431. changeEmbed: function changeEmbed(e) {
  13432. k.html(f.generate.embed(e));
  13433. },
  13434. createAndShow: function createAndShow() {
  13435. f.createEmbed(), f.show();
  13436. },
  13437. change: function change(e, t, n) {
  13438. 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();
  13439. },
  13440. reset: function reset() {
  13441. f.debug("Clearing embed and showing placeholder"), f.remove.active(), f.remove.embed(), f.showPlaceholder(), m.onReset.call(T);
  13442. },
  13443. show: function show() {
  13444. f.debug("Showing embed"), f.set.active(), m.onDisplay.call(T);
  13445. },
  13446. hide: function hide() {
  13447. f.debug("Hiding embed"), f.showPlaceholder();
  13448. },
  13449. showPlaceholder: function showPlaceholder() {
  13450. f.debug("Showing placeholder image"), f.remove.active(), m.onPlaceholderDisplay.call(T);
  13451. },
  13452. get: {
  13453. id: function id() {
  13454. return m.id || S.data(b.id);
  13455. },
  13456. placeholder: function placeholder() {
  13457. return m.placeholder || S.data(b.placeholder);
  13458. },
  13459. icon: function icon() {
  13460. return m.icon ? m.icon : S.data(b.icon) !== i ? S.data(b.icon) : f.determine.icon();
  13461. },
  13462. source: function source(e) {
  13463. return m.source ? m.source : S.data(b.source) !== i ? S.data(b.source) : f.determine.source();
  13464. },
  13465. type: function type() {
  13466. var e = f.get.source();
  13467. return h[e] !== i && h[e].type;
  13468. },
  13469. url: function url() {
  13470. return m.url ? m.url : S.data(b.url) !== i ? S.data(b.url) : f.determine.url();
  13471. }
  13472. },
  13473. determine: {
  13474. autoplay: function autoplay() {
  13475. f.should.autoplay() && (m.autoplay = !0);
  13476. },
  13477. source: function source(t) {
  13478. var n = !1;
  13479. return (t = t || f.get.url()) && e.each(h, function (e, i) {
  13480. if (-1 !== t.search(i.domain)) return n = e, !1;
  13481. }), n;
  13482. },
  13483. icon: function icon() {
  13484. var e = f.get.source();
  13485. return h[e] !== i && h[e].icon;
  13486. },
  13487. url: function url() {
  13488. var e,
  13489. t = m.id || S.data(b.id),
  13490. n = m.source || S.data(b.source);
  13491. return (e = h[n] !== i && h[n].url.replace("{id}", t)) && S.data(b.url, e), e;
  13492. }
  13493. },
  13494. set: {
  13495. active: function active() {
  13496. S.addClass(p.active);
  13497. }
  13498. },
  13499. remove: {
  13500. active: function active() {
  13501. S.removeClass(p.active);
  13502. },
  13503. embed: function embed() {
  13504. k.empty();
  13505. }
  13506. },
  13507. encode: {
  13508. parameters: function parameters(e) {
  13509. var t,
  13510. n = [];
  13511. for (t in e) {
  13512. n.push(encodeURIComponent(t) + "=" + encodeURIComponent(e[t]));
  13513. }
  13514. return n.join("&amp;");
  13515. }
  13516. },
  13517. generate: {
  13518. embed: function embed(e) {
  13519. f.debug("Generating embed html");
  13520. var t,
  13521. n,
  13522. i = f.get.source();
  13523. return (e = f.get.url(e)) ? (n = f.generate.parameters(i), t = x.iframe(e, n)) : f.error(v.noURL, S), t;
  13524. },
  13525. parameters: function parameters(t, n) {
  13526. var o = h[t] && h[t].parameters !== i ? h[t].parameters(m) : {};
  13527. return (n = n || m.parameters) && (o = e.extend({}, o, n)), o = m.onEmbed(o), f.encode.parameters(o);
  13528. }
  13529. },
  13530. has: {
  13531. embed: function embed() {
  13532. return k.length > 0;
  13533. },
  13534. placeholder: function placeholder() {
  13535. return m.placeholder || S.data(b.placeholder);
  13536. }
  13537. },
  13538. should: {
  13539. autoplay: function autoplay() {
  13540. return "auto" === m.autoplay ? m.placeholder || S.data(b.placeholder) !== i : m.autoplay;
  13541. }
  13542. },
  13543. is: {
  13544. video: function video() {
  13545. return "video" == f.get.type();
  13546. }
  13547. },
  13548. setting: function setting(t, n) {
  13549. if (f.debug("Changing setting", t, n), e.isPlainObject(t)) e.extend(!0, m, t);else {
  13550. if (n === i) return m[t];
  13551. e.isPlainObject(m[t]) ? e.extend(!0, m[t], n) : m[t] = n;
  13552. }
  13553. },
  13554. internal: function internal(t, n) {
  13555. if (e.isPlainObject(t)) e.extend(!0, f, t);else {
  13556. if (n === i) return f[t];
  13557. f[t] = n;
  13558. }
  13559. },
  13560. debug: function debug() {
  13561. !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)));
  13562. },
  13563. verbose: function verbose() {
  13564. !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)));
  13565. },
  13566. error: function error() {
  13567. m.silent || (f.error = Function.prototype.bind.call(console.error, console, m.name + ":"), f.error.apply(console, arguments));
  13568. },
  13569. performance: {
  13570. log: function log(e) {
  13571. var t, n;
  13572. m.performance && (n = (t = new Date().getTime()) - (s || t), s = t, l.push({
  13573. Name: e[0],
  13574. Arguments: [].slice.call(e, 1) || "",
  13575. Element: T,
  13576. "Execution Time": n
  13577. })), clearTimeout(f.performance.timer), f.performance.timer = setTimeout(f.performance.display, 500);
  13578. },
  13579. display: function display() {
  13580. var t = m.name + ":",
  13581. n = 0;
  13582. s = !1, clearTimeout(f.performance.timer), e.each(l, function (e, t) {
  13583. n += t["Execution Time"];
  13584. }), 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) {
  13585. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  13586. }), console.groupEnd()), l = [];
  13587. }
  13588. },
  13589. invoke: function invoke(t, n, a) {
  13590. var r,
  13591. s,
  13592. l,
  13593. c = A;
  13594. 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) {
  13595. var a = n != r ? o + t[n + 1].charAt(0).toUpperCase() + t[n + 1].slice(1) : t;
  13596. if (e.isPlainObject(c[a]) && n != r) c = c[a];else {
  13597. if (c[a] !== i) return s = c[a], !1;
  13598. if (!e.isPlainObject(c[o]) || n == r) return c[o] !== i ? (s = c[o], !1) : (f.error(v.method, t), !1);
  13599. c = c[o];
  13600. }
  13601. })), 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;
  13602. }
  13603. }, u ? (A === i && f.initialize(), f.invoke(c)) : (A !== i && A.invoke("destroy"), f.initialize());
  13604. }), o !== i ? o : this;
  13605. }, e.fn.embed.settings = {
  13606. name: "Embed",
  13607. namespace: "embed",
  13608. silent: !1,
  13609. debug: !1,
  13610. verbose: !1,
  13611. performance: !0,
  13612. icon: !1,
  13613. source: !1,
  13614. url: !1,
  13615. id: !1,
  13616. autoplay: "auto",
  13617. color: "#444444",
  13618. hd: !0,
  13619. brandedUI: !1,
  13620. parameters: !1,
  13621. onDisplay: function onDisplay() {},
  13622. onPlaceholderDisplay: function onPlaceholderDisplay() {},
  13623. onReset: function onReset() {},
  13624. onCreate: function onCreate(e) {},
  13625. onEmbed: function onEmbed(e) {
  13626. return e;
  13627. },
  13628. metadata: {
  13629. id: "id",
  13630. icon: "icon",
  13631. placeholder: "placeholder",
  13632. source: "source",
  13633. url: "url"
  13634. },
  13635. error: {
  13636. noURL: "No URL specified",
  13637. method: "The method you called is not defined"
  13638. },
  13639. className: {
  13640. active: "active",
  13641. embed: "embed"
  13642. },
  13643. selector: {
  13644. embed: ".embed",
  13645. placeholder: ".placeholder",
  13646. icon: ".icon"
  13647. },
  13648. sources: {
  13649. youtube: {
  13650. name: "youtube",
  13651. type: "video",
  13652. icon: "video play",
  13653. domain: "youtube.com",
  13654. url: "//www.youtube.com/embed/{id}",
  13655. parameters: function parameters(e) {
  13656. return {
  13657. autohide: !e.brandedUI,
  13658. autoplay: e.autoplay,
  13659. color: e.color || i,
  13660. hq: e.hd,
  13661. jsapi: e.api,
  13662. modestbranding: !e.brandedUI
  13663. };
  13664. }
  13665. },
  13666. vimeo: {
  13667. name: "vimeo",
  13668. type: "video",
  13669. icon: "video play",
  13670. domain: "vimeo.com",
  13671. url: "//player.vimeo.com/video/{id}",
  13672. parameters: function parameters(e) {
  13673. return {
  13674. api: e.api,
  13675. autoplay: e.autoplay,
  13676. byline: e.brandedUI,
  13677. color: e.color || i,
  13678. portrait: e.brandedUI,
  13679. title: e.brandedUI
  13680. };
  13681. }
  13682. }
  13683. },
  13684. templates: {
  13685. iframe: function iframe(e, t) {
  13686. var n = e;
  13687. return t && (n += "?" + t), '<iframe src="' + n + '" width="100%" height="100%" frameborder="0" scrolling="no" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>';
  13688. },
  13689. placeholder: function placeholder(e, t) {
  13690. var n = "";
  13691. return t && (n += '<i class="' + t + ' icon"></i>'), e && (n += '<img class="placeholder" src="' + e + '">'), n;
  13692. }
  13693. },
  13694. api: !1,
  13695. onPause: function onPause() {},
  13696. onPlay: function onPlay() {},
  13697. onStop: function onStop() {}
  13698. };
  13699. }(jQuery, window, document), function (e, t, n, i) {
  13700. "use strict";
  13701. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.modal = function (o) {
  13702. var a,
  13703. r = e(this),
  13704. s = e(t),
  13705. l = e(n),
  13706. c = e("body"),
  13707. u = r.selector || "",
  13708. d = new Date().getTime(),
  13709. f = [],
  13710. m = arguments[0],
  13711. g = "string" == typeof m,
  13712. p = [].slice.call(arguments, 1),
  13713. h = t.requestAnimationFrame || t.mozRequestAnimationFrame || t.webkitRequestAnimationFrame || t.msRequestAnimationFrame || function (e) {
  13714. setTimeout(e, 0);
  13715. };
  13716. return r.each(function () {
  13717. var r,
  13718. v,
  13719. b,
  13720. y,
  13721. x,
  13722. C,
  13723. w,
  13724. S,
  13725. k,
  13726. T = e.isPlainObject(o) ? e.extend(!0, {}, e.fn.modal.settings, o) : e.extend({}, e.fn.modal.settings),
  13727. A = T.selector,
  13728. R = T.className,
  13729. P = T.namespace,
  13730. E = T.error,
  13731. F = "." + P,
  13732. O = "module-" + P,
  13733. D = e(this),
  13734. q = e(T.context),
  13735. j = D.find(A.close),
  13736. z = this,
  13737. I = D.data(O),
  13738. M = !1;
  13739. k = {
  13740. initialize: function initialize() {
  13741. k.verbose("Initializing dimmer", q), k.create.id(), k.create.dimmer(), k.refreshModals(), k.bind.events(), T.observeChanges && k.observeChanges(), k.instantiate();
  13742. },
  13743. instantiate: function instantiate() {
  13744. k.verbose("Storing instance of modal"), I = k, D.data(O, I);
  13745. },
  13746. create: {
  13747. dimmer: function dimmer() {
  13748. var t = {
  13749. debug: T.debug,
  13750. variation: !T.centered && "top aligned",
  13751. dimmerName: "modals"
  13752. },
  13753. n = e.extend(!0, t, T.dimmerSettings);
  13754. 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);
  13755. },
  13756. id: function id() {
  13757. w = (Math.random().toString(16) + "000000000").substr(2, 8), C = "." + w, k.verbose("Creating unique id for element", w);
  13758. }
  13759. },
  13760. destroy: function destroy() {
  13761. k.verbose("Destroying previous modal"), D.removeData(O).off(F), s.off(C), x.off(C), j.off(F), q.dimmer("destroy");
  13762. },
  13763. observeChanges: function observeChanges() {
  13764. "MutationObserver" in t && ((S = new MutationObserver(function (e) {
  13765. k.debug("DOM tree modified, refreshing"), k.refresh();
  13766. })).observe(z, {
  13767. childList: !0,
  13768. subtree: !0
  13769. }), k.debug("Setting up mutation observer", S));
  13770. },
  13771. refresh: function refresh() {
  13772. k.remove.scrolling(), k.cacheSizes(), k.set.screenHeight(), k.set.type();
  13773. },
  13774. refreshModals: function refreshModals() {
  13775. v = D.siblings(A.modal), r = v.add(D);
  13776. },
  13777. attachEvents: function attachEvents(t, n) {
  13778. var i = e(t);
  13779. 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);
  13780. },
  13781. bind: {
  13782. events: function events() {
  13783. 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);
  13784. }
  13785. },
  13786. get: {
  13787. id: function id() {
  13788. return (Math.random().toString(16) + "000000000").substr(2, 8);
  13789. }
  13790. },
  13791. event: {
  13792. approve: function approve() {
  13793. M || !1 === T.onApprove.call(z, e(this)) ? k.verbose("Approve callback returned false cancelling hide") : (M = !0, k.hide(function () {
  13794. M = !1;
  13795. }));
  13796. },
  13797. deny: function deny() {
  13798. M || !1 === T.onDeny.call(z, e(this)) ? k.verbose("Deny callback returned false cancelling hide") : (M = !0, k.hide(function () {
  13799. M = !1;
  13800. }));
  13801. },
  13802. close: function close() {
  13803. k.hide();
  13804. },
  13805. click: function click(t) {
  13806. if (T.closable) {
  13807. var i = e(t.target).closest(A.modal).length > 0,
  13808. o = e.contains(n.documentElement, t.target);
  13809. !i && o && k.is.active() && (k.debug("Dimmer clicked, hiding all modals"), k.remove.clickaway(), T.allowMultiple ? k.hide() : k.hideAll());
  13810. } else k.verbose("Dimmer clicked but closable setting is disabled");
  13811. },
  13812. debounce: function debounce(e, t) {
  13813. clearTimeout(k.timer), k.timer = setTimeout(e, t);
  13814. },
  13815. keyboard: function keyboard(e) {
  13816. 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());
  13817. },
  13818. resize: function resize() {
  13819. y.dimmer("is active") && (k.is.animating() || k.is.active()) && h(k.refresh);
  13820. }
  13821. },
  13822. toggle: function toggle() {
  13823. k.is.active() || k.is.animating() ? k.hide() : k.show();
  13824. },
  13825. show: function show(t) {
  13826. t = e.isFunction(t) ? t : function () {}, k.refreshModals(), k.set.dimmerSettings(), k.showModal(t);
  13827. },
  13828. hide: function hide(t) {
  13829. t = e.isFunction(t) ? t : function () {}, k.refreshModals(), k.hideModal(t);
  13830. },
  13831. showModal: function showModal(t) {
  13832. 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({
  13833. debug: T.debug,
  13834. animation: T.transition + " in",
  13835. queue: T.queue,
  13836. duration: T.duration,
  13837. useFailSafe: !0,
  13838. onComplete: function onComplete() {
  13839. T.onVisible.apply(z), T.keyboardShortcuts && k.add.keyboardShortcuts(), k.save.focus(), k.set.active(), T.autofocus && k.set.autofocus(), t();
  13840. }
  13841. })) : k.error(E.noTransition))) : k.debug("Modal is already visible");
  13842. },
  13843. hideModal: function hideModal(t, n) {
  13844. 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({
  13845. debug: T.debug,
  13846. animation: T.transition + " out",
  13847. queue: T.queue,
  13848. duration: T.duration,
  13849. useFailSafe: !0,
  13850. onStart: function onStart() {
  13851. k.others.active() || n || k.hideDimmer(), T.keyboardShortcuts && k.remove.keyboardShortcuts();
  13852. },
  13853. onComplete: function onComplete() {
  13854. T.onHidden.call(z), k.restore.focus(), t();
  13855. }
  13856. })) : k.error(E.noTransition)) : k.verbose("Hide callback returned false cancelling hide");
  13857. },
  13858. showDimmer: function showDimmer() {
  13859. y.dimmer("is animating") || !y.dimmer("is active") ? (k.debug("Showing dimmer"), y.dimmer("show")) : k.debug("Dimmer already visible");
  13860. },
  13861. hideDimmer: function hideDimmer() {
  13862. y.dimmer("is animating") || y.dimmer("is active") ? y.dimmer("hide", function () {
  13863. k.remove.clickaway(), k.remove.screenHeight();
  13864. }) : k.debug("Dimmer is not visible cannot hide");
  13865. },
  13866. hideAll: function hideAll(t) {
  13867. var n = r.filter("." + R.active + ", ." + R.animating);
  13868. t = e.isFunction(t) ? t : function () {}, n.length > 0 && (k.debug("Hiding all visible modals"), k.hideDimmer(), n.modal("hide modal", t));
  13869. },
  13870. hideOthers: function hideOthers(t) {
  13871. var n = v.filter("." + R.active + ", ." + R.animating);
  13872. t = e.isFunction(t) ? t : function () {}, n.length > 0 && (k.debug("Hiding other modals", v), n.modal("hide modal", t, !0));
  13873. },
  13874. others: {
  13875. active: function active() {
  13876. return v.filter("." + R.active).length > 0;
  13877. },
  13878. animating: function animating() {
  13879. return v.filter("." + R.animating).length > 0;
  13880. }
  13881. },
  13882. add: {
  13883. keyboardShortcuts: function keyboardShortcuts() {
  13884. k.verbose("Adding keyboard shortcuts"), l.on("keyup" + F, k.event.keyboard);
  13885. }
  13886. },
  13887. save: {
  13888. focus: function focus() {
  13889. e(n.activeElement).closest(D).length > 0 || (b = e(n.activeElement).blur());
  13890. }
  13891. },
  13892. restore: {
  13893. focus: function focus() {
  13894. b && b.length > 0 && b.focus();
  13895. }
  13896. },
  13897. remove: {
  13898. active: function active() {
  13899. D.removeClass(R.active);
  13900. },
  13901. clickaway: function clickaway() {
  13902. x.off("click" + C);
  13903. },
  13904. bodyStyle: function bodyStyle() {
  13905. "" === c.attr("style") && (k.verbose("Removing style attribute"), c.removeAttr("style"));
  13906. },
  13907. screenHeight: function screenHeight() {
  13908. k.debug("Removing page height"), c.css("height", "");
  13909. },
  13910. keyboardShortcuts: function keyboardShortcuts() {
  13911. k.verbose("Removing keyboard shortcuts"), l.off("keyup" + F);
  13912. },
  13913. scrolling: function scrolling() {
  13914. y.removeClass(R.scrolling), D.removeClass(R.scrolling);
  13915. }
  13916. },
  13917. cacheSizes: function cacheSizes() {
  13918. D.addClass(R.loading);
  13919. var o = D.prop("scrollHeight"),
  13920. a = D.outerHeight();
  13921. k.cache !== i && 0 === a || (k.cache = {
  13922. pageHeight: e(n).outerHeight(),
  13923. height: a + T.offset,
  13924. scrollHeight: o + T.offset,
  13925. contextHeight: "body" == T.context ? e(t).height() : y.height()
  13926. }, k.cache.topOffset = -k.cache.height / 2), D.removeClass(R.loading), k.debug("Caching modal and container sizes", k.cache);
  13927. },
  13928. can: {
  13929. fit: function fit() {
  13930. var e = k.cache.contextHeight,
  13931. t = k.cache.contextHeight / 2,
  13932. n = k.cache.topOffset,
  13933. i = k.cache.scrollHeight,
  13934. o = k.cache.height,
  13935. a = T.padding;
  13936. return i > o ? t + n + i + a < e : o + 2 * a < e;
  13937. }
  13938. },
  13939. is: {
  13940. active: function active() {
  13941. return D.hasClass(R.active);
  13942. },
  13943. animating: function animating() {
  13944. return D.transition("is supported") ? D.transition("is animating") : D.is(":visible");
  13945. },
  13946. scrolling: function scrolling() {
  13947. return y.hasClass(R.scrolling);
  13948. },
  13949. modernBrowser: function modernBrowser() {
  13950. return !(t.ActiveXObject || "ActiveXObject" in t);
  13951. }
  13952. },
  13953. set: {
  13954. autofocus: function autofocus() {
  13955. var e = D.find("[tabindex], :input").filter(":visible"),
  13956. t = e.filter("[autofocus]"),
  13957. n = t.length > 0 ? t.first() : e.first();
  13958. n.length > 0 && n.focus();
  13959. },
  13960. clickaway: function clickaway() {
  13961. x.on("click" + C, k.event.click);
  13962. },
  13963. dimmerSettings: function dimmerSettings() {
  13964. if (e.fn.dimmer !== i) {
  13965. var t = {
  13966. debug: T.debug,
  13967. dimmerName: "modals",
  13968. closable: "auto",
  13969. variation: !T.centered && "top aligned",
  13970. duration: {
  13971. show: T.duration,
  13972. hide: T.duration
  13973. }
  13974. },
  13975. n = e.extend(!0, t, T.dimmerSettings);
  13976. 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);
  13977. } else k.error(E.dimmer);
  13978. },
  13979. screenHeight: function screenHeight() {
  13980. 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));
  13981. },
  13982. active: function active() {
  13983. D.addClass(R.active);
  13984. },
  13985. scrolling: function scrolling() {
  13986. y.addClass(R.scrolling), D.addClass(R.scrolling);
  13987. },
  13988. type: function type() {
  13989. 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());
  13990. },
  13991. undetached: function undetached() {
  13992. y.addClass(R.undetached);
  13993. }
  13994. },
  13995. setting: function setting(t, n) {
  13996. if (k.debug("Changing setting", t, n), e.isPlainObject(t)) e.extend(!0, T, t);else {
  13997. if (n === i) return T[t];
  13998. e.isPlainObject(T[t]) ? e.extend(!0, T[t], n) : T[t] = n;
  13999. }
  14000. },
  14001. internal: function internal(t, n) {
  14002. if (e.isPlainObject(t)) e.extend(!0, k, t);else {
  14003. if (n === i) return k[t];
  14004. k[t] = n;
  14005. }
  14006. },
  14007. debug: function debug() {
  14008. !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)));
  14009. },
  14010. verbose: function verbose() {
  14011. !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)));
  14012. },
  14013. error: function error() {
  14014. T.silent || (k.error = Function.prototype.bind.call(console.error, console, T.name + ":"), k.error.apply(console, arguments));
  14015. },
  14016. performance: {
  14017. log: function log(e) {
  14018. var t, n;
  14019. T.performance && (n = (t = new Date().getTime()) - (d || t), d = t, f.push({
  14020. Name: e[0],
  14021. Arguments: [].slice.call(e, 1) || "",
  14022. Element: z,
  14023. "Execution Time": n
  14024. })), clearTimeout(k.performance.timer), k.performance.timer = setTimeout(k.performance.display, 500);
  14025. },
  14026. display: function display() {
  14027. var t = T.name + ":",
  14028. n = 0;
  14029. d = !1, clearTimeout(k.performance.timer), e.each(f, function (e, t) {
  14030. n += t["Execution Time"];
  14031. }), 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) {
  14032. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  14033. }), console.groupEnd()), f = [];
  14034. }
  14035. },
  14036. invoke: function invoke(t, n, o) {
  14037. var r,
  14038. s,
  14039. l,
  14040. c = I;
  14041. 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) {
  14042. var a = n != r ? o + t[n + 1].charAt(0).toUpperCase() + t[n + 1].slice(1) : t;
  14043. if (e.isPlainObject(c[a]) && n != r) c = c[a];else {
  14044. if (c[a] !== i) return s = c[a], !1;
  14045. if (!e.isPlainObject(c[o]) || n == r) return c[o] !== i && (s = c[o], !1);
  14046. c = c[o];
  14047. }
  14048. })), 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;
  14049. }
  14050. }, g ? (I === i && k.initialize(), k.invoke(m)) : (I !== i && I.invoke("destroy"), k.initialize());
  14051. }), a !== i ? a : this;
  14052. }, e.fn.modal.settings = {
  14053. name: "Modal",
  14054. namespace: "modal",
  14055. silent: !1,
  14056. debug: !1,
  14057. verbose: !1,
  14058. performance: !0,
  14059. observeChanges: !1,
  14060. allowMultiple: !1,
  14061. detachable: !0,
  14062. closable: !0,
  14063. autofocus: !0,
  14064. inverted: !1,
  14065. blurring: !1,
  14066. centered: !0,
  14067. dimmerSettings: {
  14068. closable: !1,
  14069. useCSS: !0
  14070. },
  14071. keyboardShortcuts: !0,
  14072. context: "body",
  14073. queue: !1,
  14074. duration: 500,
  14075. offset: 0,
  14076. transition: "scale",
  14077. padding: 50,
  14078. onShow: function onShow() {},
  14079. onVisible: function onVisible() {},
  14080. onHide: function onHide() {
  14081. return !0;
  14082. },
  14083. onHidden: function onHidden() {},
  14084. onApprove: function onApprove() {
  14085. return !0;
  14086. },
  14087. onDeny: function onDeny() {
  14088. return !0;
  14089. },
  14090. selector: {
  14091. close: "> .close",
  14092. approve: ".actions .positive, .actions .approve, .actions .ok",
  14093. deny: ".actions .negative, .actions .deny, .actions .cancel",
  14094. modal: ".ui.modal"
  14095. },
  14096. error: {
  14097. dimmer: "UI Dimmer, a required component is not included in this page",
  14098. method: "The method you called is not defined.",
  14099. notFound: "The element you specified could not be found"
  14100. },
  14101. className: {
  14102. active: "active",
  14103. animating: "animating",
  14104. blurring: "blurring",
  14105. inverted: "inverted",
  14106. loading: "loading",
  14107. scrolling: "scrolling",
  14108. undetached: "undetached"
  14109. }
  14110. };
  14111. }(jQuery, window, document), function (e, t, n, i) {
  14112. "use strict";
  14113. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.nag = function (n) {
  14114. var o,
  14115. a = e(this),
  14116. r = a.selector || "",
  14117. s = new Date().getTime(),
  14118. l = [],
  14119. c = arguments[0],
  14120. u = "string" == typeof c,
  14121. d = [].slice.call(arguments, 1);
  14122. return a.each(function () {
  14123. var a,
  14124. f = e.isPlainObject(n) ? e.extend(!0, {}, e.fn.nag.settings, n) : e.extend({}, e.fn.nag.settings),
  14125. m = (f.className, f.selector),
  14126. g = f.error,
  14127. p = f.namespace,
  14128. h = "." + p,
  14129. v = p + "-module",
  14130. b = e(this),
  14131. y = (b.find(m.close), f.context ? e(f.context) : e("body")),
  14132. x = this,
  14133. C = b.data(v);
  14134. t.requestAnimationFrame || t.mozRequestAnimationFrame || t.webkitRequestAnimationFrame || t.msRequestAnimationFrame;
  14135. a = {
  14136. initialize: function initialize() {
  14137. 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();
  14138. },
  14139. destroy: function destroy() {
  14140. a.verbose("Destroying instance"), b.removeData(v).off(h);
  14141. },
  14142. show: function show() {
  14143. 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));
  14144. },
  14145. hide: function hide() {
  14146. a.debug("Showing nag", f.animation.hide), "fade" == f.animation.show ? b.fadeIn(f.duration, f.easing) : b.slideUp(f.duration, f.easing);
  14147. },
  14148. onHide: function onHide() {
  14149. a.debug("Removing nag", f.animation.hide), b.remove(), f.onHide && f.onHide();
  14150. },
  14151. dismiss: function dismiss(e) {
  14152. f.storageMethod && a.storage.set(f.key, f.value), a.hide(), e.stopImmediatePropagation(), e.preventDefault();
  14153. },
  14154. should: {
  14155. show: function show() {
  14156. 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);
  14157. }
  14158. },
  14159. get: {
  14160. storageOptions: function storageOptions() {
  14161. var e = {};
  14162. return f.expires && (e.expires = f.expires), f.domain && (e.domain = f.domain), f.path && (e.path = f.path), e;
  14163. }
  14164. },
  14165. clear: function clear() {
  14166. a.storage.remove(f.key);
  14167. },
  14168. storage: {
  14169. set: function set(n, o) {
  14170. var r = a.get.storageOptions();
  14171. 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 {
  14172. if (e.cookie === i) return void a.error(g.noCookieStorage);
  14173. e.cookie(n, o, r), a.debug("Value stored using cookie", n, o, r);
  14174. }
  14175. },
  14176. get: function get(n, o) {
  14177. var r;
  14178. 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;
  14179. },
  14180. remove: function remove(n) {
  14181. var o = a.get.storageOptions();
  14182. "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);
  14183. }
  14184. },
  14185. setting: function setting(t, n) {
  14186. if (a.debug("Changing setting", t, n), e.isPlainObject(t)) e.extend(!0, f, t);else {
  14187. if (n === i) return f[t];
  14188. e.isPlainObject(f[t]) ? e.extend(!0, f[t], n) : f[t] = n;
  14189. }
  14190. },
  14191. internal: function internal(t, n) {
  14192. if (e.isPlainObject(t)) e.extend(!0, a, t);else {
  14193. if (n === i) return a[t];
  14194. a[t] = n;
  14195. }
  14196. },
  14197. debug: function debug() {
  14198. !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)));
  14199. },
  14200. verbose: function verbose() {
  14201. !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)));
  14202. },
  14203. error: function error() {
  14204. f.silent || (a.error = Function.prototype.bind.call(console.error, console, f.name + ":"), a.error.apply(console, arguments));
  14205. },
  14206. performance: {
  14207. log: function log(e) {
  14208. var t, n;
  14209. f.performance && (n = (t = new Date().getTime()) - (s || t), s = t, l.push({
  14210. Name: e[0],
  14211. Arguments: [].slice.call(e, 1) || "",
  14212. Element: x,
  14213. "Execution Time": n
  14214. })), clearTimeout(a.performance.timer), a.performance.timer = setTimeout(a.performance.display, 500);
  14215. },
  14216. display: function display() {
  14217. var t = f.name + ":",
  14218. n = 0;
  14219. s = !1, clearTimeout(a.performance.timer), e.each(l, function (e, t) {
  14220. n += t["Execution Time"];
  14221. }), 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) {
  14222. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  14223. }), console.groupEnd()), l = [];
  14224. }
  14225. },
  14226. invoke: function invoke(t, n, r) {
  14227. var s,
  14228. l,
  14229. c,
  14230. u = C;
  14231. 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) {
  14232. var r = n != s ? o + t[n + 1].charAt(0).toUpperCase() + t[n + 1].slice(1) : t;
  14233. if (e.isPlainObject(u[r]) && n != s) u = u[r];else {
  14234. if (u[r] !== i) return l = u[r], !1;
  14235. if (!e.isPlainObject(u[o]) || n == s) return u[o] !== i ? (l = u[o], !1) : (a.error(g.method, t), !1);
  14236. u = u[o];
  14237. }
  14238. })), 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;
  14239. }
  14240. }, u ? (C === i && a.initialize(), a.invoke(c)) : (C !== i && C.invoke("destroy"), a.initialize());
  14241. }), o !== i ? o : this;
  14242. }, e.fn.nag.settings = {
  14243. name: "Nag",
  14244. silent: !1,
  14245. debug: !1,
  14246. verbose: !1,
  14247. performance: !0,
  14248. namespace: "Nag",
  14249. persist: !1,
  14250. displayTime: 0,
  14251. animation: {
  14252. show: "slide",
  14253. hide: "slide"
  14254. },
  14255. context: !1,
  14256. detachable: !1,
  14257. expires: 30,
  14258. domain: !1,
  14259. path: "/",
  14260. storageMethod: "cookie",
  14261. key: "nag",
  14262. value: "dismiss",
  14263. error: {
  14264. noCookieStorage: "$.cookie is not included. A storage solution is required.",
  14265. noStorage: "Neither $.cookie or store is defined. A storage solution is required for storing state",
  14266. method: "The method you called is not defined."
  14267. },
  14268. className: {
  14269. bottom: "bottom",
  14270. fixed: "fixed"
  14271. },
  14272. selector: {
  14273. close: ".close.icon"
  14274. },
  14275. speed: 500,
  14276. easing: "easeOutQuad",
  14277. onHide: function onHide() {}
  14278. }, e.extend(e.easing, {
  14279. easeOutQuad: function easeOutQuad(e, t, n, i, o) {
  14280. return -i * (t /= o) * (t - 2) + n;
  14281. }
  14282. });
  14283. }(jQuery, window, document), function (e, t, n, i) {
  14284. "use strict";
  14285. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.popup = function (o) {
  14286. var a,
  14287. r = e(this),
  14288. s = e(n),
  14289. l = e(t),
  14290. c = e("body"),
  14291. u = r.selector || "",
  14292. d = new Date().getTime(),
  14293. f = [],
  14294. m = arguments[0],
  14295. g = "string" == typeof m,
  14296. p = [].slice.call(arguments, 1);
  14297. return r.each(function () {
  14298. var r,
  14299. h,
  14300. v,
  14301. b,
  14302. y,
  14303. x,
  14304. C = e.isPlainObject(o) ? e.extend(!0, {}, e.fn.popup.settings, o) : e.extend({}, e.fn.popup.settings),
  14305. w = C.selector,
  14306. S = C.className,
  14307. k = C.error,
  14308. T = C.metadata,
  14309. A = C.namespace,
  14310. R = "." + C.namespace,
  14311. P = "module-" + A,
  14312. E = e(this),
  14313. F = e(C.context),
  14314. O = e(C.scrollContext),
  14315. D = e(C.boundary),
  14316. q = C.target ? e(C.target) : E,
  14317. j = 0,
  14318. z = !1,
  14319. I = !1,
  14320. M = this,
  14321. L = E.data(P);
  14322. x = {
  14323. initialize: function initialize() {
  14324. x.debug("Initializing", E), x.createID(), x.bind.events(), !x.exists() && C.preserve && x.create(), C.observeChanges && x.observeChanges(), x.instantiate();
  14325. },
  14326. instantiate: function instantiate() {
  14327. x.verbose("Storing instance", x), L = x, E.data(P, L);
  14328. },
  14329. observeChanges: function observeChanges() {
  14330. "MutationObserver" in t && ((v = new MutationObserver(x.event.documentChanged)).observe(n, {
  14331. childList: !0,
  14332. subtree: !0
  14333. }), x.debug("Setting up mutation observer", v));
  14334. },
  14335. refresh: function refresh() {
  14336. 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();
  14337. },
  14338. reposition: function reposition() {
  14339. x.refresh(), x.set.position();
  14340. },
  14341. destroy: function destroy() {
  14342. 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);
  14343. },
  14344. event: {
  14345. start: function start(t) {
  14346. var n = e.isPlainObject(C.delay) ? C.delay.show : C.delay;
  14347. clearTimeout(x.hideTimer), I || (x.showTimer = setTimeout(x.show, n));
  14348. },
  14349. end: function end() {
  14350. var t = e.isPlainObject(C.delay) ? C.delay.hide : C.delay;
  14351. clearTimeout(x.showTimer), x.hideTimer = setTimeout(x.hide, t);
  14352. },
  14353. touchstart: function touchstart(e) {
  14354. I = !0, x.show();
  14355. },
  14356. resize: function resize() {
  14357. x.is.visible() && x.set.position();
  14358. },
  14359. documentChanged: function documentChanged(t) {
  14360. [].forEach.call(t, function (t) {
  14361. t.removedNodes && [].forEach.call(t.removedNodes, function (t) {
  14362. (t == M || e(t).find(M).length > 0) && (x.debug("Element removed from DOM, tearing down events"), x.destroy());
  14363. });
  14364. });
  14365. },
  14366. hideGracefully: function hideGracefully(t) {
  14367. var i = e(t.target),
  14368. o = e.contains(n.documentElement, t.target),
  14369. a = i.closest(w.popup).length > 0;
  14370. t && !a && o ? (x.debug("Click occurred outside popup hiding popup"), x.hide()) : x.debug("Click was inside popup, keeping popup open");
  14371. }
  14372. },
  14373. create: function create() {
  14374. var t = x.get.html(),
  14375. n = x.get.title(),
  14376. i = x.get.content();
  14377. t || i || n ? (x.debug("Creating pop-up html"), t || (t = C.templates.popup({
  14378. title: n,
  14379. content: i
  14380. })), 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);
  14381. },
  14382. createID: function createID() {
  14383. y = (Math.random().toString(16) + "000000000").substr(2, 8), b = "." + y, x.verbose("Creating unique id for element", y);
  14384. },
  14385. toggle: function toggle() {
  14386. 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());
  14387. },
  14388. show: function show(e) {
  14389. if (e = e || function () {}, x.debug("Showing pop-up", C.transition), x.is.hidden() && (!x.is.active() || !x.is.dropdown())) {
  14390. if (x.exists() || x.create(), !1 === C.onShow.call(r, M)) return void x.debug("onShow callback returned false, cancelling popup animation");
  14391. C.preserve || C.popup || x.refresh(), r && x.set.position() && (x.save.conditions(), C.exclusive && x.hideAll(), x.animate.show(e));
  14392. }
  14393. },
  14394. hide: function hide(e) {
  14395. if (e = e || function () {}, x.is.visible() || x.is.animating()) {
  14396. if (!1 === C.onHide.call(r, M)) return void x.debug("onHide callback returned false, cancelling popup animation");
  14397. x.remove.visible(), x.unbind.close(), x.restore.conditions(), x.animate.hide(e);
  14398. }
  14399. },
  14400. hideAll: function hideAll() {
  14401. e(w.popup).filter("." + S.popupVisible).each(function () {
  14402. e(this).data(T.activator).popup("hide");
  14403. });
  14404. },
  14405. exists: function exists() {
  14406. return !!r && (C.inline || C.popup ? x.has.popup() : r.closest(F).length >= 1);
  14407. },
  14408. removePopup: function removePopup() {
  14409. x.has.popup() && !C.popup && (x.debug("Removing popup", r), r.remove(), r = i, C.onRemove.call(r, M));
  14410. },
  14411. save: {
  14412. conditions: function conditions() {
  14413. x.cache = {
  14414. title: E.attr("title")
  14415. }, x.cache.title && E.removeAttr("title"), x.verbose("Saving original attributes", x.cache.title);
  14416. }
  14417. },
  14418. restore: {
  14419. conditions: function conditions() {
  14420. return x.cache && x.cache.title && (E.attr("title", x.cache.title), x.verbose("Restoring original attributes", x.cache.title)), !0;
  14421. }
  14422. },
  14423. supports: {
  14424. svg: function svg() {
  14425. return "undefined" == typeof SVGGraphicsElement;
  14426. }
  14427. },
  14428. animate: {
  14429. show: function show(t) {
  14430. t = e.isFunction(t) ? t : function () {}, C.transition && e.fn.transition !== i && E.transition("is supported") ? (x.set.visible(), r.transition({
  14431. animation: C.transition + " in",
  14432. queue: !1,
  14433. debug: C.debug,
  14434. verbose: C.verbose,
  14435. duration: C.duration,
  14436. onComplete: function onComplete() {
  14437. x.bind.close(), t.call(r, M), C.onVisible.call(r, M);
  14438. }
  14439. })) : x.error(k.noTransition);
  14440. },
  14441. hide: function hide(t) {
  14442. 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({
  14443. animation: C.transition + " out",
  14444. queue: !1,
  14445. duration: C.duration,
  14446. debug: C.debug,
  14447. verbose: C.verbose,
  14448. onComplete: function onComplete() {
  14449. x.reset(), t.call(r, M), C.onHidden.call(r, M);
  14450. }
  14451. }) : x.error(k.noTransition) : x.debug("onHide callback returned false, cancelling popup animation");
  14452. }
  14453. },
  14454. change: {
  14455. content: function content(e) {
  14456. r.html(e);
  14457. }
  14458. },
  14459. get: {
  14460. html: function html() {
  14461. return E.removeData(T.html), E.data(T.html) || C.html;
  14462. },
  14463. title: function title() {
  14464. return E.removeData(T.title), E.data(T.title) || C.title;
  14465. },
  14466. content: function content() {
  14467. return E.removeData(T.content), E.data(T.content) || C.content || E.attr("title");
  14468. },
  14469. variation: function variation() {
  14470. return E.removeData(T.variation), E.data(T.variation) || C.variation;
  14471. },
  14472. popup: function popup() {
  14473. return r;
  14474. },
  14475. popupOffset: function popupOffset() {
  14476. return r.offset();
  14477. },
  14478. calculations: function calculations() {
  14479. var e,
  14480. n = x.get.offsetParent(r),
  14481. i = q[0],
  14482. o = D[0] == t,
  14483. a = C.inline || C.popup && C.movePopup ? q.position() : q.offset(),
  14484. s = o ? {
  14485. top: 0,
  14486. left: 0
  14487. } : D.offset(),
  14488. c = {},
  14489. u = o ? {
  14490. top: l.scrollTop(),
  14491. left: l.scrollLeft()
  14492. } : {
  14493. top: 0,
  14494. left: 0
  14495. };
  14496. if (c = {
  14497. target: {
  14498. element: q[0],
  14499. width: q.outerWidth(),
  14500. height: q.outerHeight(),
  14501. top: a.top,
  14502. left: a.left,
  14503. margin: {}
  14504. },
  14505. popup: {
  14506. width: r.outerWidth(),
  14507. height: r.outerHeight()
  14508. },
  14509. parent: {
  14510. width: h.outerWidth(),
  14511. height: h.outerHeight()
  14512. },
  14513. screen: {
  14514. top: s.top,
  14515. left: s.left,
  14516. scroll: {
  14517. top: u.top,
  14518. left: u.left
  14519. },
  14520. width: D.width(),
  14521. height: D.height()
  14522. }
  14523. }, n.get(0) !== h.get(0)) {
  14524. var d = n.offset();
  14525. c.target.top -= d.top, c.target.left -= d.left, c.parent.width = n.outerWidth(), c.parent.height = n.outerHeight();
  14526. }
  14527. return C.setFluidWidth && x.is.fluid() && (c.container = {
  14528. width: r.parent().outerWidth()
  14529. }, 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 = {
  14530. top: e.top + e.scroll.top,
  14531. bottom: e.top + e.scroll.top + e.height,
  14532. left: e.left + e.scroll.left,
  14533. right: e.left + e.scroll.left + e.width
  14534. }, c;
  14535. },
  14536. id: function id() {
  14537. return y;
  14538. },
  14539. startEvent: function startEvent() {
  14540. return "hover" == C.on ? "mouseenter" : "focus" == C.on && "focus";
  14541. },
  14542. scrollEvent: function scrollEvent() {
  14543. return "scroll";
  14544. },
  14545. endEvent: function endEvent() {
  14546. return "hover" == C.on ? "mouseleave" : "focus" == C.on && "blur";
  14547. },
  14548. distanceFromBoundary: function distanceFromBoundary(e, t) {
  14549. var n,
  14550. i,
  14551. o = {};
  14552. return n = (t = t || x.get.calculations()).popup, i = t.boundary, e && (o = {
  14553. top: e.top - i.top,
  14554. left: e.left - i.left,
  14555. right: i.right - (e.left + n.width),
  14556. bottom: i.bottom - (e.top + n.height)
  14557. }, x.verbose("Distance from boundaries determined", e, o)), o;
  14558. },
  14559. offsetParent: function offsetParent(t) {
  14560. var n = (t !== i ? t[0] : q[0]).parentNode,
  14561. o = e(n);
  14562. if (n) for (var a = "none" === o.css("transform"), r = "static" === o.css("position"), s = o.is("body"); n && !s && r && a;) {
  14563. n = n.parentNode, a = "none" === (o = e(n)).css("transform"), r = "static" === o.css("position"), s = o.is("body");
  14564. }
  14565. return o && o.length > 0 ? o : e();
  14566. },
  14567. positions: function positions() {
  14568. return {
  14569. "top left": !1,
  14570. "top center": !1,
  14571. "top right": !1,
  14572. "bottom left": !1,
  14573. "bottom center": !1,
  14574. "bottom right": !1,
  14575. "left center": !1,
  14576. "right center": !1
  14577. };
  14578. },
  14579. nextPosition: function nextPosition(e) {
  14580. var t = e.split(" "),
  14581. n = t[0],
  14582. i = t[1],
  14583. o = "top" == n || "bottom" == n,
  14584. a = !1,
  14585. r = !1,
  14586. s = !1;
  14587. 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 = [{
  14588. top: "bottom",
  14589. bottom: "top",
  14590. left: "right",
  14591. right: "left"
  14592. }[n], i]).join(" "), a = !0 === z[s], x.debug("Trying opposite strategy", s)), "adjacent" === C.prefer && o && (s = (s = [n, {
  14593. left: "center",
  14594. center: "right",
  14595. right: "left"
  14596. }[i]]).join(" "), r = !0 === z[s], x.debug("Trying adjacent strategy", s)), (r || a) && (x.debug("Using backup position", s), s = {
  14597. "top left": "top center",
  14598. "top center": "top right",
  14599. "top right": "right center",
  14600. "right center": "bottom right",
  14601. "bottom right": "bottom center",
  14602. "bottom center": "bottom left",
  14603. "bottom left": "left center",
  14604. "left center": "top left"
  14605. }[e]), s;
  14606. }
  14607. },
  14608. set: {
  14609. position: function position(e, t) {
  14610. if (0 !== q.length && 0 !== r.length) {
  14611. var n, o, a, s, l, c, u, d;
  14612. 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;
  14613. 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) {
  14614. return "left" == e ? "right" : "left";
  14615. }), x.debug("RTL: Popup position updated", e)), j == C.maxSearchDepth && "string" == typeof C.lastResort && (e = C.lastResort), e) {
  14616. case "top left":
  14617. c = {
  14618. top: "auto",
  14619. bottom: l.height - a.top + o,
  14620. left: a.left + n,
  14621. right: "auto"
  14622. };
  14623. break;
  14624. case "top center":
  14625. c = {
  14626. bottom: l.height - a.top + o,
  14627. left: a.left + a.width / 2 - s.width / 2 + n,
  14628. top: "auto",
  14629. right: "auto"
  14630. };
  14631. break;
  14632. case "top right":
  14633. c = {
  14634. bottom: l.height - a.top + o,
  14635. right: l.width - a.left - a.width - n,
  14636. top: "auto",
  14637. left: "auto"
  14638. };
  14639. break;
  14640. case "left center":
  14641. c = {
  14642. top: a.top + a.height / 2 - s.height / 2 + n,
  14643. right: l.width - a.left + o,
  14644. left: "auto",
  14645. bottom: "auto"
  14646. };
  14647. break;
  14648. case "right center":
  14649. c = {
  14650. top: a.top + a.height / 2 - s.height / 2 + n,
  14651. left: a.left + a.width + o,
  14652. bottom: "auto",
  14653. right: "auto"
  14654. };
  14655. break;
  14656. case "bottom left":
  14657. c = {
  14658. top: a.top + a.height + o,
  14659. left: a.left + n,
  14660. bottom: "auto",
  14661. right: "auto"
  14662. };
  14663. break;
  14664. case "bottom center":
  14665. c = {
  14666. top: a.top + a.height + o,
  14667. left: a.left + a.width / 2 - s.width / 2 + n,
  14668. bottom: "auto",
  14669. right: "auto"
  14670. };
  14671. break;
  14672. case "bottom right":
  14673. c = {
  14674. top: a.top + a.height + o,
  14675. right: l.width - a.left - a.width - n,
  14676. left: "auto",
  14677. bottom: "auto"
  14678. };
  14679. }
  14680. 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)) {
  14681. 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);
  14682. 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;
  14683. x.debug("No position found, showing with last position");
  14684. }
  14685. return x.debug("Position is on stage", e), x.remove.attempts(), x.remove.loading(), C.setFluidWidth && x.is.fluid() && x.set.fluidWidth(t), !0;
  14686. }
  14687. x.error(k.notFound);
  14688. },
  14689. fluidWidth: function fluidWidth(e) {
  14690. e = e || x.get.calculations(), x.debug("Automatically setting element width to parent width", e.parent.width), r.css("width", e.container.width);
  14691. },
  14692. variation: function variation(e) {
  14693. (e = e || x.get.variation()) && x.has.popup() && (x.verbose("Adding variation to popup", e), r.addClass(e));
  14694. },
  14695. visible: function visible() {
  14696. E.addClass(S.visible);
  14697. }
  14698. },
  14699. remove: {
  14700. loading: function loading() {
  14701. r.removeClass(S.loading);
  14702. },
  14703. variation: function variation(e) {
  14704. (e = e || x.get.variation()) && (x.verbose("Removing variation", e), r.removeClass(e));
  14705. },
  14706. visible: function visible() {
  14707. E.removeClass(S.visible);
  14708. },
  14709. attempts: function attempts() {
  14710. x.verbose("Resetting all searched positions"), j = 0, z = !1;
  14711. }
  14712. },
  14713. bind: {
  14714. events: function events() {
  14715. 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);
  14716. },
  14717. popup: function popup() {
  14718. 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);
  14719. },
  14720. close: function close() {
  14721. (!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();
  14722. },
  14723. closeOnScroll: function closeOnScroll() {
  14724. x.verbose("Binding scroll close event to document"), O.one(x.get.scrollEvent() + b, x.event.hideGracefully);
  14725. },
  14726. touchClose: function touchClose() {
  14727. x.verbose("Binding popup touchclose event to document"), s.on("touchstart" + b, function (e) {
  14728. x.verbose("Touched away from popup"), x.event.hideGracefully.call(M, e);
  14729. });
  14730. },
  14731. clickaway: function clickaway() {
  14732. x.verbose("Binding popup close event to document"), s.on("click" + b, function (e) {
  14733. x.verbose("Clicked away from popup"), x.event.hideGracefully.call(M, e);
  14734. });
  14735. }
  14736. },
  14737. unbind: {
  14738. events: function events() {
  14739. l.off(b), E.off(R);
  14740. },
  14741. close: function close() {
  14742. s.off(b), O.off(b);
  14743. }
  14744. },
  14745. has: {
  14746. popup: function popup() {
  14747. return r && r.length > 0;
  14748. }
  14749. },
  14750. should: {
  14751. centerArrow: function centerArrow(e) {
  14752. return !x.is.basic() && e.target.width <= 2 * C.arrowPixelsFromEdge;
  14753. }
  14754. },
  14755. is: {
  14756. offstage: function offstage(t, n) {
  14757. var i = [];
  14758. return e.each(t, function (e, t) {
  14759. t < -C.jitter && (x.debug("Position exceeds allowable distance from edge", e, t, n), i.push(e));
  14760. }), i.length > 0;
  14761. },
  14762. svg: function svg(e) {
  14763. return x.supports.svg() && e instanceof SVGGraphicsElement;
  14764. },
  14765. basic: function basic() {
  14766. return E.hasClass(S.basic);
  14767. },
  14768. active: function active() {
  14769. return E.hasClass(S.active);
  14770. },
  14771. animating: function animating() {
  14772. return r !== i && r.hasClass(S.animating);
  14773. },
  14774. fluid: function fluid() {
  14775. return r !== i && r.hasClass(S.fluid);
  14776. },
  14777. visible: function visible() {
  14778. return r !== i && r.hasClass(S.popupVisible);
  14779. },
  14780. dropdown: function dropdown() {
  14781. return E.hasClass(S.dropdown);
  14782. },
  14783. hidden: function hidden() {
  14784. return !x.is.visible();
  14785. },
  14786. rtl: function rtl() {
  14787. return "rtl" == E.css("direction");
  14788. }
  14789. },
  14790. reset: function reset() {
  14791. x.remove.visible(), C.preserve ? e.fn.transition !== i && r.transition("remove transition") : x.removePopup();
  14792. },
  14793. setting: function setting(t, n) {
  14794. if (e.isPlainObject(t)) e.extend(!0, C, t);else {
  14795. if (n === i) return C[t];
  14796. C[t] = n;
  14797. }
  14798. },
  14799. internal: function internal(t, n) {
  14800. if (e.isPlainObject(t)) e.extend(!0, x, t);else {
  14801. if (n === i) return x[t];
  14802. x[t] = n;
  14803. }
  14804. },
  14805. debug: function debug() {
  14806. !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)));
  14807. },
  14808. verbose: function verbose() {
  14809. !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)));
  14810. },
  14811. error: function error() {
  14812. C.silent || (x.error = Function.prototype.bind.call(console.error, console, C.name + ":"), x.error.apply(console, arguments));
  14813. },
  14814. performance: {
  14815. log: function log(e) {
  14816. var t, n;
  14817. C.performance && (n = (t = new Date().getTime()) - (d || t), d = t, f.push({
  14818. Name: e[0],
  14819. Arguments: [].slice.call(e, 1) || "",
  14820. Element: M,
  14821. "Execution Time": n
  14822. })), clearTimeout(x.performance.timer), x.performance.timer = setTimeout(x.performance.display, 500);
  14823. },
  14824. display: function display() {
  14825. var t = C.name + ":",
  14826. n = 0;
  14827. d = !1, clearTimeout(x.performance.timer), e.each(f, function (e, t) {
  14828. n += t["Execution Time"];
  14829. }), 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) {
  14830. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  14831. }), console.groupEnd()), f = [];
  14832. }
  14833. },
  14834. invoke: function invoke(t, n, o) {
  14835. var r,
  14836. s,
  14837. l,
  14838. c = L;
  14839. 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) {
  14840. var a = n != r ? o + t[n + 1].charAt(0).toUpperCase() + t[n + 1].slice(1) : t;
  14841. if (e.isPlainObject(c[a]) && n != r) c = c[a];else {
  14842. if (c[a] !== i) return s = c[a], !1;
  14843. if (!e.isPlainObject(c[o]) || n == r) return c[o] !== i && (s = c[o], !1);
  14844. c = c[o];
  14845. }
  14846. })), 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;
  14847. }
  14848. }, g ? (L === i && x.initialize(), x.invoke(m)) : (L !== i && L.invoke("destroy"), x.initialize());
  14849. }), a !== i ? a : this;
  14850. }, e.fn.popup.settings = {
  14851. name: "Popup",
  14852. silent: !1,
  14853. debug: !1,
  14854. verbose: !1,
  14855. performance: !0,
  14856. namespace: "popup",
  14857. observeChanges: !0,
  14858. onCreate: function onCreate() {},
  14859. onRemove: function onRemove() {},
  14860. onShow: function onShow() {},
  14861. onVisible: function onVisible() {},
  14862. onHide: function onHide() {},
  14863. onUnplaceable: function onUnplaceable() {},
  14864. onHidden: function onHidden() {},
  14865. on: "hover",
  14866. boundary: t,
  14867. addTouchEvents: !0,
  14868. position: "top left",
  14869. variation: "",
  14870. movePopup: !0,
  14871. target: !1,
  14872. popup: !1,
  14873. inline: !1,
  14874. preserve: !1,
  14875. hoverable: !1,
  14876. content: !1,
  14877. html: !1,
  14878. title: !1,
  14879. closable: !0,
  14880. hideOnScroll: "auto",
  14881. exclusive: !1,
  14882. context: "body",
  14883. scrollContext: t,
  14884. prefer: "opposite",
  14885. lastResort: !1,
  14886. arrowPixelsFromEdge: 20,
  14887. delay: {
  14888. show: 50,
  14889. hide: 70
  14890. },
  14891. setFluidWidth: !0,
  14892. duration: 200,
  14893. transition: "scale",
  14894. distanceAway: 0,
  14895. jitter: 2,
  14896. offset: 0,
  14897. maxSearchDepth: 15,
  14898. error: {
  14899. invalidPosition: "The position you specified is not a valid position",
  14900. cannotPlace: "Popup does not fit within the boundaries of the viewport",
  14901. method: "The method you called is not defined.",
  14902. noTransition: "This module requires ui transitions <https://github.com/Semantic-Org/UI-Transition>",
  14903. notFound: "The target or popup you specified does not exist on the page"
  14904. },
  14905. metadata: {
  14906. activator: "activator",
  14907. content: "content",
  14908. html: "html",
  14909. offset: "offset",
  14910. position: "position",
  14911. title: "title",
  14912. variation: "variation"
  14913. },
  14914. className: {
  14915. active: "active",
  14916. basic: "basic",
  14917. animating: "animating",
  14918. dropdown: "dropdown",
  14919. fluid: "fluid",
  14920. loading: "loading",
  14921. popup: "ui popup",
  14922. position: "top left center bottom right",
  14923. visible: "visible",
  14924. popupVisible: "visible"
  14925. },
  14926. selector: {
  14927. popup: ".ui.popup"
  14928. },
  14929. templates: {
  14930. escape: function escape(e) {
  14931. var t = {
  14932. "&": "&amp;",
  14933. "<": "&lt;",
  14934. ">": "&gt;",
  14935. '"': "&quot;",
  14936. "'": "&#x27;",
  14937. "`": "&#x60;"
  14938. };
  14939. return /[&<>"'`]/.test(e) ? e.replace(/[&<>"'`]/g, function (e) {
  14940. return t[e];
  14941. }) : e;
  14942. },
  14943. popup: function popup(t) {
  14944. var n = "",
  14945. o = e.fn.popup.settings.templates.escape;
  14946. return _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;
  14947. }
  14948. }
  14949. };
  14950. }(jQuery, window, document), function (e, t, n, i) {
  14951. "use strict";
  14952. 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")());
  14953. e.fn.progress = function (t) {
  14954. var o,
  14955. a = e(this),
  14956. r = a.selector || "",
  14957. s = new Date().getTime(),
  14958. l = [],
  14959. c = arguments[0],
  14960. u = "string" == typeof c,
  14961. d = [].slice.call(arguments, 1);
  14962. return a.each(function () {
  14963. var a,
  14964. f = e.isPlainObject(t) ? e.extend(!0, {}, e.fn.progress.settings, t) : e.extend({}, e.fn.progress.settings),
  14965. m = f.className,
  14966. g = f.metadata,
  14967. p = f.namespace,
  14968. h = f.selector,
  14969. v = f.error,
  14970. b = "." + p,
  14971. y = "module-" + p,
  14972. x = e(this),
  14973. C = e(this).find(h.bar),
  14974. w = e(this).find(h.progress),
  14975. S = e(this).find(h.label),
  14976. k = this,
  14977. T = x.data(y),
  14978. A = !1;
  14979. a = {
  14980. initialize: function initialize() {
  14981. a.debug("Initializing progress bar", f), a.set.duration(), a.set.transitionEvent(), a.read.metadata(), a.read.settings(), a.instantiate();
  14982. },
  14983. instantiate: function instantiate() {
  14984. a.verbose("Storing instance of progress", a), T = a, x.data(y, a);
  14985. },
  14986. destroy: function destroy() {
  14987. a.verbose("Destroying previous progress for", x), clearInterval(T.interval), a.remove.state(), x.removeData(y), T = i;
  14988. },
  14989. reset: function reset() {
  14990. a.remove.nextValue(), a.update.progress(0);
  14991. },
  14992. complete: function complete() {
  14993. (a.percent === i || a.percent < 100) && (a.remove.progressPoll(), a.set.percent(100));
  14994. },
  14995. read: {
  14996. metadata: function metadata() {
  14997. var e = {
  14998. percent: x.data(g.percent),
  14999. total: x.data(g.total),
  15000. value: x.data(g.value)
  15001. };
  15002. 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));
  15003. },
  15004. settings: function settings() {
  15005. !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));
  15006. }
  15007. },
  15008. bind: {
  15009. transitionEnd: function transitionEnd(e) {
  15010. var t = a.get.transitionEnd();
  15011. C.one(t + b, function (t) {
  15012. clearTimeout(a.failSafeTimer), e.call(this, t);
  15013. }), a.failSafeTimer = setTimeout(function () {
  15014. C.triggerHandler(t);
  15015. }, f.duration + f.failSafeDelay), a.verbose("Adding fail safe timer", a.timer);
  15016. }
  15017. },
  15018. increment: function increment(e) {
  15019. var t, n;
  15020. 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);
  15021. },
  15022. decrement: function decrement(e) {
  15023. var t, n;
  15024. 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);
  15025. },
  15026. has: {
  15027. progressPoll: function progressPoll() {
  15028. return a.progressPoll;
  15029. },
  15030. total: function total() {
  15031. return !1 !== a.get.total();
  15032. }
  15033. },
  15034. get: {
  15035. text: function text(e) {
  15036. var t = a.value || 0,
  15037. n = a.total || 0,
  15038. i = A ? a.get.displayPercent() : a.percent || 0,
  15039. o = a.total > 0 ? n - t : 100 - i;
  15040. 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;
  15041. },
  15042. normalizedValue: function normalizedValue(e) {
  15043. if (e < 0) return a.debug("Value cannot decrement below 0"), 0;
  15044. if (a.has.total()) {
  15045. if (e > a.total) return a.debug("Value cannot increment above total", a.total), a.total;
  15046. } else if (e > 100) return a.debug("Value cannot increment above 100 percent"), 100;
  15047. return e;
  15048. },
  15049. updateInterval: function updateInterval() {
  15050. return "auto" == f.updateInterval ? f.duration : f.updateInterval;
  15051. },
  15052. randomValue: function randomValue() {
  15053. return a.debug("Generating random increment percentage"), Math.floor(Math.random() * f.random.max + f.random.min);
  15054. },
  15055. numericValue: function numericValue(e) {
  15056. return "string" == typeof e ? "" !== e.replace(/[^\d.]/g, "") && +e.replace(/[^\d.]/g, "") : e;
  15057. },
  15058. transitionEnd: function transitionEnd() {
  15059. var e,
  15060. t = n.createElement("element"),
  15061. o = {
  15062. transition: "transitionend",
  15063. OTransition: "oTransitionEnd",
  15064. MozTransition: "transitionend",
  15065. WebkitTransition: "webkitTransitionEnd"
  15066. };
  15067. for (e in o) {
  15068. if (t.style[e] !== i) return o[e];
  15069. }
  15070. },
  15071. displayPercent: function displayPercent() {
  15072. var e = C.width(),
  15073. t = x.width(),
  15074. n = e > parseInt(C.css("min-width"), 10) ? e / t * 100 : a.percent;
  15075. return f.precision > 0 ? Math.round(n * (10 * f.precision)) / (10 * f.precision) : Math.round(n);
  15076. },
  15077. percent: function percent() {
  15078. return a.percent || 0;
  15079. },
  15080. value: function value() {
  15081. return a.nextValue || a.value || 0;
  15082. },
  15083. total: function total() {
  15084. return a.total || !1;
  15085. }
  15086. },
  15087. create: {
  15088. progressPoll: function progressPoll() {
  15089. a.progressPoll = setTimeout(function () {
  15090. a.update.toNextValue(), a.remove.progressPoll();
  15091. }, a.get.updateInterval());
  15092. }
  15093. },
  15094. is: {
  15095. complete: function complete() {
  15096. return a.is.success() || a.is.warning() || a.is.error();
  15097. },
  15098. success: function success() {
  15099. return x.hasClass(m.success);
  15100. },
  15101. warning: function warning() {
  15102. return x.hasClass(m.warning);
  15103. },
  15104. error: function error() {
  15105. return x.hasClass(m.error);
  15106. },
  15107. active: function active() {
  15108. return x.hasClass(m.active);
  15109. },
  15110. visible: function visible() {
  15111. return x.is(":visible");
  15112. }
  15113. },
  15114. remove: {
  15115. progressPoll: function progressPoll() {
  15116. a.verbose("Removing progress poll timer"), a.progressPoll && (clearTimeout(a.progressPoll), delete a.progressPoll);
  15117. },
  15118. nextValue: function nextValue() {
  15119. a.verbose("Removing progress value stored for next update"), delete a.nextValue;
  15120. },
  15121. state: function state() {
  15122. a.verbose("Removing stored state"), delete a.total, delete a.percent, delete a.value;
  15123. },
  15124. active: function active() {
  15125. a.verbose("Removing active state"), x.removeClass(m.active);
  15126. },
  15127. success: function success() {
  15128. a.verbose("Removing success state"), x.removeClass(m.success);
  15129. },
  15130. warning: function warning() {
  15131. a.verbose("Removing warning state"), x.removeClass(m.warning);
  15132. },
  15133. error: function error() {
  15134. a.verbose("Removing error state"), x.removeClass(m.error);
  15135. }
  15136. },
  15137. set: {
  15138. barWidth: function barWidth(e) {
  15139. 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)));
  15140. },
  15141. duration: function duration(e) {
  15142. e = "number" == typeof (e = e || f.duration) ? e + "ms" : e, a.verbose("Setting progress bar transition duration", e), C.css({
  15143. "transition-duration": e
  15144. });
  15145. },
  15146. percent: function percent(e) {
  15147. 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);
  15148. },
  15149. labelInterval: function labelInterval() {
  15150. clearInterval(a.interval), a.bind.transitionEnd(function () {
  15151. a.verbose("Bar finished animating, removing continuous label updates"), clearInterval(a.interval), A = !1, a.set.labels();
  15152. }), A = !0, a.interval = setInterval(function () {
  15153. e.contains(n.documentElement, k) || (clearInterval(a.interval), A = !1), a.set.labels();
  15154. }, f.framerate);
  15155. },
  15156. labels: function labels() {
  15157. a.verbose("Setting both bar progress and outer label text"), a.set.barLabel(), a.set.state();
  15158. },
  15159. label: function label(e) {
  15160. (e = e || "") && (e = a.get.text(e), a.verbose("Setting label to text", e), S.text(e));
  15161. },
  15162. state: function state(e) {
  15163. 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));
  15164. },
  15165. barLabel: function barLabel(e) {
  15166. 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)));
  15167. },
  15168. active: function active(e) {
  15169. 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 () {
  15170. f.onActive.call(k, a.value, a.total);
  15171. });
  15172. },
  15173. success: function success(e) {
  15174. 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 () {
  15175. f.onSuccess.call(k, a.total);
  15176. });
  15177. },
  15178. warning: function warning(e) {
  15179. 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 () {
  15180. f.onWarning.call(k, a.value, a.total);
  15181. });
  15182. },
  15183. error: function error(e) {
  15184. 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 () {
  15185. f.onError.call(k, a.value, a.total);
  15186. });
  15187. },
  15188. transitionEvent: function transitionEvent() {
  15189. a.get.transitionEnd();
  15190. },
  15191. total: function total(e) {
  15192. a.total = e;
  15193. },
  15194. value: function value(e) {
  15195. a.value = e;
  15196. },
  15197. progress: function progress(e) {
  15198. 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());
  15199. },
  15200. nextValue: function nextValue(e) {
  15201. a.nextValue = e;
  15202. }
  15203. },
  15204. update: {
  15205. toNextValue: function toNextValue() {
  15206. var e = a.nextValue;
  15207. e && (a.debug("Update interval complete using last updated value", e), a.update.progress(e), a.remove.nextValue());
  15208. },
  15209. progress: function progress(e) {
  15210. var t;
  15211. !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));
  15212. }
  15213. },
  15214. setting: function setting(t, n) {
  15215. if (a.debug("Changing setting", t, n), e.isPlainObject(t)) e.extend(!0, f, t);else {
  15216. if (n === i) return f[t];
  15217. e.isPlainObject(f[t]) ? e.extend(!0, f[t], n) : f[t] = n;
  15218. }
  15219. },
  15220. internal: function internal(t, n) {
  15221. if (e.isPlainObject(t)) e.extend(!0, a, t);else {
  15222. if (n === i) return a[t];
  15223. a[t] = n;
  15224. }
  15225. },
  15226. debug: function debug() {
  15227. !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)));
  15228. },
  15229. verbose: function verbose() {
  15230. !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)));
  15231. },
  15232. error: function error() {
  15233. f.silent || (a.error = Function.prototype.bind.call(console.error, console, f.name + ":"), a.error.apply(console, arguments));
  15234. },
  15235. performance: {
  15236. log: function log(e) {
  15237. var t, n;
  15238. f.performance && (n = (t = new Date().getTime()) - (s || t), s = t, l.push({
  15239. Name: e[0],
  15240. Arguments: [].slice.call(e, 1) || "",
  15241. Element: k,
  15242. "Execution Time": n
  15243. })), clearTimeout(a.performance.timer), a.performance.timer = setTimeout(a.performance.display, 500);
  15244. },
  15245. display: function display() {
  15246. var t = f.name + ":",
  15247. n = 0;
  15248. s = !1, clearTimeout(a.performance.timer), e.each(l, function (e, t) {
  15249. n += t["Execution Time"];
  15250. }), 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) {
  15251. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  15252. }), console.groupEnd()), l = [];
  15253. }
  15254. },
  15255. invoke: function invoke(t, n, r) {
  15256. var s,
  15257. l,
  15258. c,
  15259. u = T;
  15260. 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) {
  15261. var r = n != s ? o + t[n + 1].charAt(0).toUpperCase() + t[n + 1].slice(1) : t;
  15262. if (e.isPlainObject(u[r]) && n != s) u = u[r];else {
  15263. if (u[r] !== i) return l = u[r], !1;
  15264. if (!e.isPlainObject(u[o]) || n == s) return u[o] !== i ? (l = u[o], !1) : (a.error(v.method, t), !1);
  15265. u = u[o];
  15266. }
  15267. })), 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;
  15268. }
  15269. }, u ? (T === i && a.initialize(), a.invoke(c)) : (T !== i && T.invoke("destroy"), a.initialize());
  15270. }), o !== i ? o : this;
  15271. }, e.fn.progress.settings = {
  15272. name: "Progress",
  15273. namespace: "progress",
  15274. silent: !1,
  15275. debug: !1,
  15276. verbose: !1,
  15277. performance: !0,
  15278. random: {
  15279. min: 2,
  15280. max: 5
  15281. },
  15282. duration: 300,
  15283. updateInterval: "auto",
  15284. autoSuccess: !0,
  15285. showActivity: !0,
  15286. limitValues: !0,
  15287. label: "percent",
  15288. precision: 0,
  15289. framerate: 1e3 / 30,
  15290. percent: !1,
  15291. total: !1,
  15292. value: !1,
  15293. failSafeDelay: 100,
  15294. onLabelUpdate: function onLabelUpdate(e, t, n, i) {
  15295. return t;
  15296. },
  15297. onChange: function onChange(e, t, n) {},
  15298. onSuccess: function onSuccess(e) {},
  15299. onActive: function onActive(e, t) {},
  15300. onError: function onError(e, t) {},
  15301. onWarning: function onWarning(e, t) {},
  15302. error: {
  15303. method: "The method you called is not defined.",
  15304. nonNumeric: "Progress value is non numeric",
  15305. tooHigh: "Value specified is above 100%",
  15306. tooLow: "Value specified is below 0%"
  15307. },
  15308. regExp: {
  15309. variable: /\{\$*[A-z0-9]+\}/g
  15310. },
  15311. metadata: {
  15312. percent: "percent",
  15313. total: "total",
  15314. value: "value"
  15315. },
  15316. selector: {
  15317. bar: "> .bar",
  15318. label: "> .label",
  15319. progress: ".bar > .progress"
  15320. },
  15321. text: {
  15322. active: !1,
  15323. error: !1,
  15324. success: !1,
  15325. warning: !1,
  15326. percent: "{percent}%",
  15327. ratio: "{value} of {total}"
  15328. },
  15329. className: {
  15330. active: "active",
  15331. error: "error",
  15332. success: "success",
  15333. warning: "warning"
  15334. }
  15335. };
  15336. }(jQuery, window, document), function (e, t, n, i) {
  15337. "use strict";
  15338. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.rating = function (t) {
  15339. var n,
  15340. o = e(this),
  15341. a = o.selector || "",
  15342. r = new Date().getTime(),
  15343. s = [],
  15344. l = arguments[0],
  15345. c = "string" == typeof l,
  15346. u = [].slice.call(arguments, 1);
  15347. return o.each(function () {
  15348. var d,
  15349. f,
  15350. m = e.isPlainObject(t) ? e.extend(!0, {}, e.fn.rating.settings, t) : e.extend({}, e.fn.rating.settings),
  15351. g = m.namespace,
  15352. p = m.className,
  15353. h = m.metadata,
  15354. v = m.selector,
  15355. b = (m.error, "." + g),
  15356. y = "module-" + g,
  15357. x = this,
  15358. C = e(this).data(y),
  15359. w = e(this),
  15360. S = w.find(v.icon);
  15361. f = {
  15362. initialize: function initialize() {
  15363. 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();
  15364. },
  15365. instantiate: function instantiate() {
  15366. f.verbose("Instantiating module", m), C = f, w.data(y, f);
  15367. },
  15368. destroy: function destroy() {
  15369. f.verbose("Destroying previous instance", C), f.remove.events(), w.removeData(y);
  15370. },
  15371. refresh: function refresh() {
  15372. S = w.find(v.icon);
  15373. },
  15374. setup: {
  15375. layout: function layout() {
  15376. var t = f.get.maxRating(),
  15377. n = e.fn.rating.settings.templates.icon(t);
  15378. f.debug("Generating icon html dynamically"), w.html(n), f.refresh();
  15379. }
  15380. },
  15381. event: {
  15382. mouseenter: function mouseenter() {
  15383. var t = e(this);
  15384. t.nextAll().removeClass(p.selected), w.addClass(p.selected), t.addClass(p.selected).prevAll().addClass(p.selected);
  15385. },
  15386. mouseleave: function mouseleave() {
  15387. w.removeClass(p.selected), S.removeClass(p.selected);
  15388. },
  15389. click: function click() {
  15390. var t = e(this),
  15391. n = f.get.rating(),
  15392. i = S.index(t) + 1;
  15393. ("auto" == m.clearable ? 1 === S.length : m.clearable) && n == i ? f.clearRating() : f.set.rating(i);
  15394. }
  15395. },
  15396. clearRating: function clearRating() {
  15397. f.debug("Clearing current rating"), f.set.rating(0);
  15398. },
  15399. bind: {
  15400. events: function events() {
  15401. 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);
  15402. }
  15403. },
  15404. remove: {
  15405. events: function events() {
  15406. f.verbose("Removing events"), w.off(b);
  15407. },
  15408. initialLoad: function initialLoad() {
  15409. d = !1;
  15410. }
  15411. },
  15412. enable: function enable() {
  15413. f.debug("Setting rating to interactive mode"), f.bind.events(), w.removeClass(p.disabled);
  15414. },
  15415. disable: function disable() {
  15416. f.debug("Setting rating to read-only mode"), f.remove.events(), w.addClass(p.disabled);
  15417. },
  15418. is: {
  15419. initialLoad: function initialLoad() {
  15420. return d;
  15421. }
  15422. },
  15423. get: {
  15424. initialRating: function initialRating() {
  15425. return w.data(h.rating) !== i ? (w.removeData(h.rating), w.data(h.rating)) : m.initialRating;
  15426. },
  15427. maxRating: function maxRating() {
  15428. return w.data(h.maxRating) !== i ? (w.removeData(h.maxRating), w.data(h.maxRating)) : m.maxRating;
  15429. },
  15430. rating: function rating() {
  15431. var e = S.filter("." + p.active).length;
  15432. return f.verbose("Current rating retrieved", e), e;
  15433. }
  15434. },
  15435. set: {
  15436. rating: function rating(e) {
  15437. var t = e - 1 >= 0 ? e - 1 : 0,
  15438. n = S.eq(t);
  15439. 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);
  15440. },
  15441. initialLoad: function initialLoad() {
  15442. d = !0;
  15443. }
  15444. },
  15445. setting: function setting(t, n) {
  15446. if (f.debug("Changing setting", t, n), e.isPlainObject(t)) e.extend(!0, m, t);else {
  15447. if (n === i) return m[t];
  15448. e.isPlainObject(m[t]) ? e.extend(!0, m[t], n) : m[t] = n;
  15449. }
  15450. },
  15451. internal: function internal(t, n) {
  15452. if (e.isPlainObject(t)) e.extend(!0, f, t);else {
  15453. if (n === i) return f[t];
  15454. f[t] = n;
  15455. }
  15456. },
  15457. debug: function debug() {
  15458. !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)));
  15459. },
  15460. verbose: function verbose() {
  15461. !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)));
  15462. },
  15463. error: function error() {
  15464. m.silent || (f.error = Function.prototype.bind.call(console.error, console, m.name + ":"), f.error.apply(console, arguments));
  15465. },
  15466. performance: {
  15467. log: function log(e) {
  15468. var t, n;
  15469. m.performance && (n = (t = new Date().getTime()) - (r || t), r = t, s.push({
  15470. Name: e[0],
  15471. Arguments: [].slice.call(e, 1) || "",
  15472. Element: x,
  15473. "Execution Time": n
  15474. })), clearTimeout(f.performance.timer), f.performance.timer = setTimeout(f.performance.display, 500);
  15475. },
  15476. display: function display() {
  15477. var t = m.name + ":",
  15478. n = 0;
  15479. r = !1, clearTimeout(f.performance.timer), e.each(s, function (e, t) {
  15480. n += t["Execution Time"];
  15481. }), 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) {
  15482. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  15483. }), console.groupEnd()), s = [];
  15484. }
  15485. },
  15486. invoke: function invoke(t, o, a) {
  15487. var r,
  15488. s,
  15489. l,
  15490. c = C;
  15491. 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) {
  15492. var a = n != r ? o + t[n + 1].charAt(0).toUpperCase() + t[n + 1].slice(1) : t;
  15493. if (e.isPlainObject(c[a]) && n != r) c = c[a];else {
  15494. if (c[a] !== i) return s = c[a], !1;
  15495. if (!e.isPlainObject(c[o]) || n == r) return c[o] !== i && (s = c[o], !1);
  15496. c = c[o];
  15497. }
  15498. })), 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;
  15499. }
  15500. }, c ? (C === i && f.initialize(), f.invoke(l)) : (C !== i && C.invoke("destroy"), f.initialize());
  15501. }), n !== i ? n : this;
  15502. }, e.fn.rating.settings = {
  15503. name: "Rating",
  15504. namespace: "rating",
  15505. slent: !1,
  15506. debug: !1,
  15507. verbose: !1,
  15508. performance: !0,
  15509. initialRating: 0,
  15510. interactive: !0,
  15511. maxRating: 4,
  15512. clearable: "auto",
  15513. fireOnInit: !1,
  15514. onRate: function onRate(e) {},
  15515. error: {
  15516. method: "The method you called is not defined",
  15517. noMaximum: "No maximum rating specified. Cannot generate HTML automatically"
  15518. },
  15519. metadata: {
  15520. rating: "rating",
  15521. maxRating: "maxRating"
  15522. },
  15523. className: {
  15524. active: "active",
  15525. disabled: "disabled",
  15526. selected: "selected",
  15527. loading: "loading"
  15528. },
  15529. selector: {
  15530. icon: ".icon"
  15531. },
  15532. templates: {
  15533. icon: function icon(e) {
  15534. for (var t = 1, n = ""; t <= e;) {
  15535. n += '<i class="icon"></i>', t++;
  15536. }
  15537. return n;
  15538. }
  15539. }
  15540. };
  15541. }(jQuery, window, document), function (e, t, n, i) {
  15542. "use strict";
  15543. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.search = function (o) {
  15544. var a,
  15545. r = e(this),
  15546. s = r.selector || "",
  15547. l = new Date().getTime(),
  15548. c = [],
  15549. u = arguments[0],
  15550. d = "string" == typeof u,
  15551. f = [].slice.call(arguments, 1);
  15552. return e(this).each(function () {
  15553. var m,
  15554. g = e.isPlainObject(o) ? e.extend(!0, {}, e.fn.search.settings, o) : e.extend({}, e.fn.search.settings),
  15555. p = g.className,
  15556. h = g.metadata,
  15557. v = g.regExp,
  15558. b = g.fields,
  15559. y = g.selector,
  15560. x = g.error,
  15561. C = g.namespace,
  15562. w = "." + C,
  15563. S = C + "-module",
  15564. k = e(this),
  15565. T = k.find(y.prompt),
  15566. A = k.find(y.searchButton),
  15567. R = k.find(y.results),
  15568. P = k.find(y.result),
  15569. E = (k.find(y.category), this),
  15570. F = k.data(S),
  15571. O = !1,
  15572. D = !1;
  15573. m = {
  15574. initialize: function initialize() {
  15575. m.verbose("Initializing module"), m.get.settings(), m.determine.searchFields(), m.bind.events(), m.set.type(), m.create.results(), m.instantiate();
  15576. },
  15577. instantiate: function instantiate() {
  15578. m.verbose("Storing instance of module", m), F = m, k.data(S, m);
  15579. },
  15580. destroy: function destroy() {
  15581. m.verbose("Destroying instance"), k.off(w).removeData(S);
  15582. },
  15583. refresh: function refresh() {
  15584. 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);
  15585. },
  15586. refreshResults: function refreshResults() {
  15587. R = k.find(y.results), P = k.find(y.result);
  15588. },
  15589. bind: {
  15590. events: function events() {
  15591. 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);
  15592. }
  15593. },
  15594. determine: {
  15595. searchFields: function searchFields() {
  15596. o && o.searchFields !== i && (g.searchFields = o.searchFields);
  15597. }
  15598. },
  15599. event: {
  15600. input: function input() {
  15601. g.searchDelay ? (clearTimeout(m.timer), m.timer = setTimeout(function () {
  15602. m.is.focused() && m.query();
  15603. }, g.searchDelay)) : m.query();
  15604. },
  15605. focus: function focus() {
  15606. m.set.focus(), g.searchOnFocus && m.has.minimumCharacters() && m.query(function () {
  15607. m.can.show() && m.showResults();
  15608. });
  15609. },
  15610. blur: function blur(e) {
  15611. var t = function t() {
  15612. m.cancel.query(), m.remove.focus(), m.timer = setTimeout(m.hideResults, g.hideDelay);
  15613. };
  15614. 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) {
  15615. m.is.inMessage(e) || O ? T.focus() : (O = !1, m.is.animating() || m.is.hidden() || t());
  15616. })) : (m.debug("Input blurred without user action, closing results"), t()));
  15617. },
  15618. result: {
  15619. mousedown: function mousedown() {
  15620. m.resultsClicked = !0;
  15621. },
  15622. mouseup: function mouseup() {
  15623. m.resultsClicked = !1;
  15624. },
  15625. click: function click(n) {
  15626. m.debug("Search result selected");
  15627. var i = e(this),
  15628. o = i.find(y.title).eq(0),
  15629. a = i.is("a[href]") ? i : i.find("a[href]").eq(0),
  15630. r = a.attr("href") || !1,
  15631. s = a.attr("target") || !1,
  15632. l = (o.html(), o.length > 0 && o.text()),
  15633. c = m.get.results(),
  15634. u = i.data(h.result) || m.get.result(l, c);
  15635. 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);
  15636. 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);
  15637. }
  15638. }
  15639. },
  15640. handleKeyboard: function handleKeyboard(e) {
  15641. var t,
  15642. n = k.find(y.result),
  15643. i = k.find(y.category),
  15644. o = n.filter("." + p.active),
  15645. a = n.index(o),
  15646. r = n.length,
  15647. s = o.length > 0,
  15648. l = e.which,
  15649. c = 13,
  15650. u = 38,
  15651. d = 40;
  15652. if (l == 27 && (m.verbose("Escape key pressed, blurring search field"), m.hideResults(), D = !0), m.is.visible()) {
  15653. if (l == c) {
  15654. 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;
  15655. } 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());
  15656. } else l == c && (m.verbose("Enter key pressed, executing query"), m.query(), m.set.buttonPressed(), T.one("keyup", m.remove.buttonFocus));
  15657. },
  15658. setup: {
  15659. api: function api(t, n) {
  15660. var i = {
  15661. debug: g.debug,
  15662. on: !1,
  15663. cache: g.cache,
  15664. action: "search",
  15665. urlData: {
  15666. query: t
  15667. },
  15668. onSuccess: function onSuccess(e) {
  15669. m.parse.response.call(E, e, t), n();
  15670. },
  15671. onFailure: function onFailure() {
  15672. m.displayMessage(x.serverError), n();
  15673. },
  15674. onAbort: function onAbort(e) {},
  15675. onError: m.error
  15676. };
  15677. e.extend(!0, i, g.apiSettings), m.verbose("Setting up API request", i), k.api(i);
  15678. }
  15679. },
  15680. can: {
  15681. useAPI: function useAPI() {
  15682. return e.fn.api !== i;
  15683. },
  15684. show: function show() {
  15685. return m.is.focused() && !m.is.visible() && !m.is.empty();
  15686. },
  15687. transition: function transition() {
  15688. return g.transition && e.fn.transition !== i && k.transition("is supported");
  15689. }
  15690. },
  15691. is: {
  15692. animating: function animating() {
  15693. return R.hasClass(p.animating);
  15694. },
  15695. hidden: function hidden() {
  15696. return R.hasClass(p.hidden);
  15697. },
  15698. inMessage: function inMessage(t) {
  15699. if (t.target) {
  15700. var i = e(t.target);
  15701. return e.contains(n.documentElement, t.target) && i.closest(y.message).length > 0;
  15702. }
  15703. },
  15704. empty: function empty() {
  15705. return "" === R.html();
  15706. },
  15707. visible: function visible() {
  15708. return R.filter(":visible").length > 0;
  15709. },
  15710. focused: function focused() {
  15711. return T.filter(":focus").length > 0;
  15712. }
  15713. },
  15714. get: {
  15715. settings: function settings() {
  15716. e.isPlainObject(o) && o.searchFullText && (g.fullTextSearch = o.searchFullText, m.error(g.error.oldSearchSyntax, E));
  15717. },
  15718. inputEvent: function inputEvent() {
  15719. var e = T[0];
  15720. return e !== i && e.oninput !== i ? "input" : e !== i && e.onpropertychange !== i ? "propertychange" : "keyup";
  15721. },
  15722. value: function value() {
  15723. return T.val();
  15724. },
  15725. results: function results() {
  15726. return k.data(h.results);
  15727. },
  15728. result: function result(t, n) {
  15729. var o = ["title", "id"],
  15730. a = !1;
  15731. 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) {
  15732. if (e.isArray(i.results) && (a = m.search.object(t, i.results, o)[0])) return !1;
  15733. })) : (m.debug("Finding result in results object", t), a = m.search.object(t, n, o)[0]), a || !1;
  15734. }
  15735. },
  15736. select: {
  15737. firstResult: function firstResult() {
  15738. m.verbose("Selecting first result"), P.first().addClass(p.active);
  15739. }
  15740. },
  15741. set: {
  15742. focus: function focus() {
  15743. k.addClass(p.focus);
  15744. },
  15745. loading: function loading() {
  15746. k.addClass(p.loading);
  15747. },
  15748. value: function value(e) {
  15749. m.verbose("Setting search input value", e), T.val(e);
  15750. },
  15751. type: function type(e) {
  15752. e = e || g.type, "category" == g.type && k.addClass(g.type);
  15753. },
  15754. buttonPressed: function buttonPressed() {
  15755. A.addClass(p.pressed);
  15756. }
  15757. },
  15758. remove: {
  15759. loading: function loading() {
  15760. k.removeClass(p.loading);
  15761. },
  15762. focus: function focus() {
  15763. k.removeClass(p.focus);
  15764. },
  15765. buttonPressed: function buttonPressed() {
  15766. A.removeClass(p.pressed);
  15767. }
  15768. },
  15769. query: function query(t) {
  15770. t = e.isFunction(t) ? t : function () {};
  15771. var n = m.get.value(),
  15772. i = m.read.cache(n);
  15773. 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();
  15774. },
  15775. search: {
  15776. local: function local(e) {
  15777. var t,
  15778. n = m.search.object(e, g.content);
  15779. 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({
  15780. results: n
  15781. }), m.remove.loading(), m.addResults(t), m.inject.id(n), m.write.cache(e, {
  15782. html: t,
  15783. results: n
  15784. });
  15785. },
  15786. remote: function remote(t, n) {
  15787. n = e.isFunction(n) ? n : function () {}, k.api("is loading") && k.api("abort"), m.setup.api(t, n), k.api("query");
  15788. },
  15789. object: function object(t, n, o) {
  15790. var a = [],
  15791. r = [],
  15792. s = [],
  15793. l = t.toString().replace(v.escape, "\\$&"),
  15794. c = new RegExp(v.beginsWith + l, "i"),
  15795. u = function u(t, n) {
  15796. var i = -1 == e.inArray(n, a),
  15797. o = -1 == e.inArray(n, s),
  15798. l = -1 == e.inArray(n, r);
  15799. i && o && l && t.push(n);
  15800. };
  15801. 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) {
  15802. e.each(n, function (e, n) {
  15803. "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));
  15804. });
  15805. }), e.merge(r, s), e.merge(a, r), a);
  15806. }
  15807. },
  15808. exactSearch: function exactSearch(e, t) {
  15809. return e = e.toLowerCase(), (t = t.toLowerCase()).indexOf(e) > -1;
  15810. },
  15811. fuzzySearch: function fuzzySearch(e, t) {
  15812. var n = t.length,
  15813. i = e.length;
  15814. if ("string" != typeof e) return !1;
  15815. if (e = e.toLowerCase(), t = t.toLowerCase(), i > n) return !1;
  15816. if (i === n) return e === t;
  15817. e: for (var o = 0, a = 0; o < i; o++) {
  15818. for (var r = e.charCodeAt(o); a < n;) {
  15819. if (t.charCodeAt(a++) === r) continue e;
  15820. }
  15821. return !1;
  15822. }
  15823. return !0;
  15824. },
  15825. parse: {
  15826. response: function response(e, t) {
  15827. var n = m.generateResults(e);
  15828. 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, {
  15829. html: n,
  15830. results: e[b.results]
  15831. }), m.save.results(e[b.results]));
  15832. }
  15833. },
  15834. cancel: {
  15835. query: function query() {
  15836. m.can.useAPI() && k.api("abort");
  15837. }
  15838. },
  15839. has: {
  15840. minimumCharacters: function minimumCharacters() {
  15841. return m.get.value().length >= g.minCharacters;
  15842. },
  15843. results: function results() {
  15844. return 0 !== R.length && "" != R.html();
  15845. }
  15846. },
  15847. clear: {
  15848. cache: function cache(e) {
  15849. var t = k.data(h.cache);
  15850. 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));
  15851. }
  15852. },
  15853. read: {
  15854. cache: function cache(e) {
  15855. var t = k.data(h.cache);
  15856. return !!g.cache && (m.verbose("Checking cache for generated html for query", e), "object" == _typeof(t) && t[e] !== i && t[e]);
  15857. }
  15858. },
  15859. create: {
  15860. categoryResults: function categoryResults(t) {
  15861. var n = {};
  15862. return e.each(t, function (e, t) {
  15863. t.category && (n[t.category] === i ? (m.verbose("Creating new category of results", t.category), n[t.category] = {
  15864. name: t.category,
  15865. results: [t]
  15866. }) : n[t.category].results.push(t));
  15867. }), n;
  15868. },
  15869. id: function id(e, t) {
  15870. var n,
  15871. o = e + 1;
  15872. 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;
  15873. },
  15874. results: function results() {
  15875. 0 === R.length && (R = e("<div />").addClass(p.results).appendTo(k));
  15876. }
  15877. },
  15878. inject: {
  15879. result: function result(e, t, n) {
  15880. m.verbose("Injecting result into results");
  15881. var o = n !== i ? R.children().eq(n).children(y.results).first().children(y.result).eq(t) : R.children(y.result).eq(t);
  15882. m.verbose("Injecting results metadata", o), o.data(h.result, e);
  15883. },
  15884. id: function id(t) {
  15885. m.debug("Injecting unique ids into results");
  15886. var n = 0,
  15887. o = 0;
  15888. return "category" === g.type ? e.each(t, function (t, a) {
  15889. o = 0, e.each(a.results, function (e, t) {
  15890. var r = a.results[e];
  15891. r.id === i && (r.id = m.create.id(o, n)), m.inject.result(r, o, n), o++;
  15892. }), n++;
  15893. }) : e.each(t, function (e, n) {
  15894. var a = t[e];
  15895. a.id === i && (a.id = m.create.id(o)), m.inject.result(a, o), o++;
  15896. }), t;
  15897. }
  15898. },
  15899. save: {
  15900. results: function results(e) {
  15901. m.verbose("Saving current search results to metadata", e), k.data(h.results, e);
  15902. }
  15903. },
  15904. write: {
  15905. cache: function cache(e, t) {
  15906. var n = k.data(h.cache) !== i ? k.data(h.cache) : {};
  15907. g.cache && (m.verbose("Writing generated html to cache", e, t), n[e] = t, k.data(h.cache, n));
  15908. }
  15909. },
  15910. addResults: function addResults(t) {
  15911. if (e.isFunction(g.onResultsAdd) && !1 === g.onResultsAdd.call(R, t)) return m.debug("onResultsAdd callback cancelled default action"), !1;
  15912. t ? (R.html(t), m.refreshResults(), g.selectFirstResult && m.select.firstResult(), m.showResults()) : m.hideResults(function () {
  15913. R.empty();
  15914. });
  15915. },
  15916. showResults: function showResults(t) {
  15917. 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({
  15918. animation: g.transition + " in",
  15919. debug: g.debug,
  15920. verbose: g.verbose,
  15921. duration: g.duration,
  15922. onComplete: function onComplete() {
  15923. t();
  15924. },
  15925. queue: !0
  15926. })) : (m.debug("Showing results with javascript"), R.stop().fadeIn(g.duration, g.easing)), g.onResultsOpen.call(R));
  15927. },
  15928. hideResults: function hideResults(t) {
  15929. t = e.isFunction(t) ? t : function () {}, m.is.visible() && (m.can.transition() ? (m.debug("Hiding results with css animations"), R.transition({
  15930. animation: g.transition + " out",
  15931. debug: g.debug,
  15932. verbose: g.verbose,
  15933. duration: g.duration,
  15934. onComplete: function onComplete() {
  15935. t();
  15936. },
  15937. queue: !0
  15938. })) : (m.debug("Hiding results with javascript"), R.stop().fadeOut(g.duration, g.easing)), g.onResultsClose.call(R));
  15939. },
  15940. generateResults: function generateResults(t) {
  15941. m.debug("Generating html from response", t);
  15942. var n = g.templates[g.type],
  15943. i = e.isPlainObject(t[b.results]) && !e.isEmptyObject(t[b.results]),
  15944. o = e.isArray(t[b.results]) && t[b.results].length > 0,
  15945. a = "";
  15946. 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;
  15947. },
  15948. displayMessage: function displayMessage(e, t) {
  15949. return t = t || "standard", m.debug("Displaying message", e, t), m.addResults(g.templates.message(e, t)), g.templates.message(e, t);
  15950. },
  15951. setting: function setting(t, n) {
  15952. if (e.isPlainObject(t)) e.extend(!0, g, t);else {
  15953. if (n === i) return g[t];
  15954. g[t] = n;
  15955. }
  15956. },
  15957. internal: function internal(t, n) {
  15958. if (e.isPlainObject(t)) e.extend(!0, m, t);else {
  15959. if (n === i) return m[t];
  15960. m[t] = n;
  15961. }
  15962. },
  15963. debug: function debug() {
  15964. !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)));
  15965. },
  15966. verbose: function verbose() {
  15967. !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)));
  15968. },
  15969. error: function error() {
  15970. g.silent || (m.error = Function.prototype.bind.call(console.error, console, g.name + ":"), m.error.apply(console, arguments));
  15971. },
  15972. performance: {
  15973. log: function log(e) {
  15974. var t, n;
  15975. g.performance && (n = (t = new Date().getTime()) - (l || t), l = t, c.push({
  15976. Name: e[0],
  15977. Arguments: [].slice.call(e, 1) || "",
  15978. Element: E,
  15979. "Execution Time": n
  15980. })), clearTimeout(m.performance.timer), m.performance.timer = setTimeout(m.performance.display, 500);
  15981. },
  15982. display: function display() {
  15983. var t = g.name + ":",
  15984. n = 0;
  15985. l = !1, clearTimeout(m.performance.timer), e.each(c, function (e, t) {
  15986. n += t["Execution Time"];
  15987. }), 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) {
  15988. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  15989. }), console.groupEnd()), c = [];
  15990. }
  15991. },
  15992. invoke: function invoke(t, n, o) {
  15993. var r,
  15994. s,
  15995. l,
  15996. c = F;
  15997. 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) {
  15998. var a = n != r ? o + t[n + 1].charAt(0).toUpperCase() + t[n + 1].slice(1) : t;
  15999. if (e.isPlainObject(c[a]) && n != r) c = c[a];else {
  16000. if (c[a] !== i) return s = c[a], !1;
  16001. if (!e.isPlainObject(c[o]) || n == r) return c[o] !== i && (s = c[o], !1);
  16002. c = c[o];
  16003. }
  16004. })), 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;
  16005. }
  16006. }, d ? (F === i && m.initialize(), m.invoke(u)) : (F !== i && F.invoke("destroy"), m.initialize());
  16007. }), a !== i ? a : this;
  16008. }, e.fn.search.settings = {
  16009. name: "Search",
  16010. namespace: "search",
  16011. silent: !1,
  16012. debug: !1,
  16013. verbose: !1,
  16014. performance: !0,
  16015. type: "standard",
  16016. minCharacters: 1,
  16017. selectFirstResult: !1,
  16018. apiSettings: !1,
  16019. source: !1,
  16020. searchOnFocus: !0,
  16021. searchFields: ["title", "description"],
  16022. displayField: "",
  16023. fullTextSearch: "exact",
  16024. automatic: !0,
  16025. hideDelay: 0,
  16026. searchDelay: 200,
  16027. maxResults: 7,
  16028. cache: !0,
  16029. showNoResults: !0,
  16030. transition: "scale",
  16031. duration: 200,
  16032. easing: "easeOutExpo",
  16033. onSelect: !1,
  16034. onResultsAdd: !1,
  16035. onSearchQuery: function onSearchQuery(e) {},
  16036. onResults: function onResults(e) {},
  16037. onResultsOpen: function onResultsOpen() {},
  16038. onResultsClose: function onResultsClose() {},
  16039. className: {
  16040. animating: "animating",
  16041. active: "active",
  16042. empty: "empty",
  16043. focus: "focus",
  16044. hidden: "hidden",
  16045. loading: "loading",
  16046. results: "results",
  16047. pressed: "down"
  16048. },
  16049. error: {
  16050. source: "Cannot search. No source used, and Semantic API module was not included",
  16051. noResults: "Your search returned no results",
  16052. logging: "Error in debug logging, exiting.",
  16053. noEndpoint: "No search endpoint was specified",
  16054. noTemplate: "A valid template name was not specified.",
  16055. oldSearchSyntax: "searchFullText setting has been renamed fullTextSearch for consistency, please adjust your settings.",
  16056. serverError: "There was an issue querying the server.",
  16057. maxResults: "Results must be an array to use maxResults setting",
  16058. method: "The method you called is not defined."
  16059. },
  16060. metadata: {
  16061. cache: "cache",
  16062. results: "results",
  16063. result: "result"
  16064. },
  16065. regExp: {
  16066. escape: /[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,
  16067. beginsWith: "(?:s|^)"
  16068. },
  16069. fields: {
  16070. categories: "results",
  16071. categoryName: "name",
  16072. categoryResults: "results",
  16073. description: "description",
  16074. image: "image",
  16075. price: "price",
  16076. results: "results",
  16077. title: "title",
  16078. url: "url",
  16079. action: "action",
  16080. actionText: "text",
  16081. actionURL: "url"
  16082. },
  16083. selector: {
  16084. prompt: ".prompt",
  16085. searchButton: ".search.button",
  16086. results: ".results",
  16087. message: ".results > .message",
  16088. category: ".category",
  16089. result: ".result",
  16090. title: ".title, .name"
  16091. },
  16092. templates: {
  16093. escape: function escape(e) {
  16094. var t = {
  16095. "&": "&amp;",
  16096. "<": "&lt;",
  16097. ">": "&gt;",
  16098. '"': "&quot;",
  16099. "'": "&#x27;",
  16100. "`": "&#x60;"
  16101. };
  16102. return /[&<>"'`]/.test(e) ? e.replace(/[&<>"'`]/g, function (e) {
  16103. return t[e];
  16104. }) : e;
  16105. },
  16106. message: function message(e, t) {
  16107. var n = "";
  16108. 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;
  16109. },
  16110. category: function category(t, n) {
  16111. var o = "";
  16112. e.fn.search.settings.templates.escape;
  16113. return t[n.categoryResults] !== i && (e.each(t[n.categoryResults], function (t, a) {
  16114. 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) {
  16115. 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>";
  16116. }), o += "</div>", o += "</div>");
  16117. }), t[n.action] && (o += '<a href="' + t[n.action][n.actionURL] + '" class="action">' + t[n.action][n.actionText] + "</a>"), o);
  16118. },
  16119. standard: function standard(t, n) {
  16120. var o = "";
  16121. return t[n.results] !== i && (e.each(t[n.results], function (e, t) {
  16122. 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>";
  16123. }), t[n.action] && (o += '<a href="' + t[n.action][n.actionURL] + '" class="action">' + t[n.action][n.actionText] + "</a>"), o);
  16124. }
  16125. }
  16126. };
  16127. }(jQuery, window, document), function (e, t, n, i) {
  16128. "use strict";
  16129. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.shape = function (o) {
  16130. var a,
  16131. r = e(this),
  16132. s = (e("body"), new Date().getTime()),
  16133. l = [],
  16134. c = arguments[0],
  16135. u = "string" == typeof c,
  16136. d = [].slice.call(arguments, 1),
  16137. f = t.requestAnimationFrame || t.mozRequestAnimationFrame || t.webkitRequestAnimationFrame || t.msRequestAnimationFrame || function (e) {
  16138. setTimeout(e, 0);
  16139. };
  16140. return r.each(function () {
  16141. var t,
  16142. m,
  16143. g,
  16144. p = r.selector || "",
  16145. h = e.isPlainObject(o) ? e.extend(!0, {}, e.fn.shape.settings, o) : e.extend({}, e.fn.shape.settings),
  16146. v = h.namespace,
  16147. b = h.selector,
  16148. y = h.error,
  16149. x = h.className,
  16150. C = "." + v,
  16151. w = "module-" + v,
  16152. S = e(this),
  16153. k = S.find(b.sides),
  16154. T = S.find(b.side),
  16155. A = !1,
  16156. R = this,
  16157. P = S.data(w);
  16158. g = {
  16159. initialize: function initialize() {
  16160. g.verbose("Initializing module for", R), g.set.defaultSide(), g.instantiate();
  16161. },
  16162. instantiate: function instantiate() {
  16163. g.verbose("Storing instance of module", g), P = g, S.data(w, P);
  16164. },
  16165. destroy: function destroy() {
  16166. g.verbose("Destroying previous module for", R), S.removeData(w).off(C);
  16167. },
  16168. refresh: function refresh() {
  16169. g.verbose("Refreshing selector cache for", R), S = e(R), k = e(this).find(b.shape), T = e(this).find(b.side);
  16170. },
  16171. repaint: function repaint() {
  16172. g.verbose("Forcing repaint event");
  16173. (k[0] || n.createElement("div")).offsetWidth;
  16174. },
  16175. animate: function animate(e, n) {
  16176. g.verbose("Animating box with properties", e), n = n || function (e) {
  16177. g.verbose("Executing animation callback"), e !== i && e.stopPropagation(), g.reset(), g.set.active();
  16178. }, 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 () {
  16179. S.addClass(x.animating), t.addClass(x.hidden);
  16180. })) : n();
  16181. },
  16182. queue: function queue(e) {
  16183. g.debug("Queueing animation of", e), k.one(g.get.transitionEvent(), function () {
  16184. g.debug("Executing queued animation"), setTimeout(function () {
  16185. S.shape(e);
  16186. }, 0);
  16187. });
  16188. },
  16189. reset: function reset() {
  16190. 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");
  16191. },
  16192. is: {
  16193. complete: function complete() {
  16194. return T.filter("." + x.active)[0] == m[0];
  16195. },
  16196. animating: function animating() {
  16197. return S.hasClass(x.animating);
  16198. }
  16199. },
  16200. set: {
  16201. defaultSide: function defaultSide() {
  16202. 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);
  16203. },
  16204. duration: function duration(e) {
  16205. 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({
  16206. "-webkit-transition-duration": e,
  16207. "-moz-transition-duration": e,
  16208. "-ms-transition-duration": e,
  16209. "-o-transition-duration": e,
  16210. "transition-duration": e
  16211. });
  16212. },
  16213. currentStageSize: function currentStageSize() {
  16214. var e = S.find("." + h.className.active),
  16215. t = e.outerWidth(!0),
  16216. n = e.outerHeight(!0);
  16217. S.css({
  16218. width: t,
  16219. height: n
  16220. });
  16221. },
  16222. stageSize: function stageSize() {
  16223. var e = S.clone().addClass(x.loading),
  16224. t = e.find("." + h.className.active),
  16225. n = A ? e.find(b.side).eq(A) : t.next(b.side).length > 0 ? t.next(b.side) : e.find(b.side).first(),
  16226. i = "next" == h.width ? n.outerWidth(!0) : "initial" == h.width ? S.width() : h.width,
  16227. o = "next" == h.height ? n.outerHeight(!0) : "initial" == h.height ? S.height() : h.height;
  16228. 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));
  16229. },
  16230. nextSide: function nextSide(e) {
  16231. 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);
  16232. },
  16233. active: function active() {
  16234. g.verbose("Setting new side to active", m), T.removeClass(x.active), m.addClass(x.active), h.onChange.call(m[0]), g.set.defaultSide();
  16235. }
  16236. },
  16237. flip: {
  16238. up: function up() {
  16239. if (!g.is.complete() || g.is.animating() || h.allowRepeats) {
  16240. if (g.is.animating()) g.queue("flip up");else {
  16241. g.debug("Flipping up", m);
  16242. var e = g.get.transform.up();
  16243. g.set.stageSize(), g.stage.above(), g.animate(e);
  16244. }
  16245. } else g.debug("Side already visible", m);
  16246. },
  16247. down: function down() {
  16248. if (!g.is.complete() || g.is.animating() || h.allowRepeats) {
  16249. if (g.is.animating()) g.queue("flip down");else {
  16250. g.debug("Flipping down", m);
  16251. var e = g.get.transform.down();
  16252. g.set.stageSize(), g.stage.below(), g.animate(e);
  16253. }
  16254. } else g.debug("Side already visible", m);
  16255. },
  16256. left: function left() {
  16257. if (!g.is.complete() || g.is.animating() || h.allowRepeats) {
  16258. if (g.is.animating()) g.queue("flip left");else {
  16259. g.debug("Flipping left", m);
  16260. var e = g.get.transform.left();
  16261. g.set.stageSize(), g.stage.left(), g.animate(e);
  16262. }
  16263. } else g.debug("Side already visible", m);
  16264. },
  16265. right: function right() {
  16266. if (!g.is.complete() || g.is.animating() || h.allowRepeats) {
  16267. if (g.is.animating()) g.queue("flip right");else {
  16268. g.debug("Flipping right", m);
  16269. var e = g.get.transform.right();
  16270. g.set.stageSize(), g.stage.right(), g.animate(e);
  16271. }
  16272. } else g.debug("Side already visible", m);
  16273. },
  16274. over: function over() {
  16275. !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);
  16276. },
  16277. back: function back() {
  16278. !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);
  16279. }
  16280. },
  16281. get: {
  16282. transform: {
  16283. up: function up() {
  16284. return {
  16285. transform: "translateY(" + -(t.outerHeight(!0) - m.outerHeight(!0)) / 2 + "px) translateZ(" + -t.outerHeight(!0) / 2 + "px) rotateX(-90deg)"
  16286. };
  16287. },
  16288. down: function down() {
  16289. return {
  16290. transform: "translateY(" + -(t.outerHeight(!0) - m.outerHeight(!0)) / 2 + "px) translateZ(" + -t.outerHeight(!0) / 2 + "px) rotateX(90deg)"
  16291. };
  16292. },
  16293. left: function left() {
  16294. return {
  16295. transform: "translateX(" + -(t.outerWidth(!0) - m.outerWidth(!0)) / 2 + "px) translateZ(" + -t.outerWidth(!0) / 2 + "px) rotateY(90deg)"
  16296. };
  16297. },
  16298. right: function right() {
  16299. return {
  16300. transform: "translateX(" + -(t.outerWidth(!0) - m.outerWidth(!0)) / 2 + "px) translateZ(" + -t.outerWidth(!0) / 2 + "px) rotateY(-90deg)"
  16301. };
  16302. },
  16303. over: function over() {
  16304. return {
  16305. transform: "translateX(" + -(t.outerWidth(!0) - m.outerWidth(!0)) / 2 + "px) rotateY(180deg)"
  16306. };
  16307. },
  16308. back: function back() {
  16309. return {
  16310. transform: "translateX(" + -(t.outerWidth(!0) - m.outerWidth(!0)) / 2 + "px) rotateY(-180deg)"
  16311. };
  16312. }
  16313. },
  16314. transitionEvent: function transitionEvent() {
  16315. var e,
  16316. t = n.createElement("element"),
  16317. o = {
  16318. transition: "transitionend",
  16319. OTransition: "oTransitionEnd",
  16320. MozTransition: "transitionend",
  16321. WebkitTransition: "webkitTransitionEnd"
  16322. };
  16323. for (e in o) {
  16324. if (t.style[e] !== i) return o[e];
  16325. }
  16326. },
  16327. nextSide: function nextSide() {
  16328. return t.next(b.side).length > 0 ? t.next(b.side) : S.find(b.side).first();
  16329. }
  16330. },
  16331. stage: {
  16332. above: function above() {
  16333. var e = {
  16334. origin: (t.outerHeight(!0) - m.outerHeight(!0)) / 2,
  16335. depth: {
  16336. active: m.outerHeight(!0) / 2,
  16337. next: t.outerHeight(!0) / 2
  16338. }
  16339. };
  16340. g.verbose("Setting the initial animation position as above", m, e), k.css({
  16341. transform: "translateZ(-" + e.depth.active + "px)"
  16342. }), t.css({
  16343. transform: "rotateY(0deg) translateZ(" + e.depth.active + "px)"
  16344. }), m.addClass(x.animating).css({
  16345. top: e.origin + "px",
  16346. transform: "rotateX(90deg) translateZ(" + e.depth.next + "px)"
  16347. });
  16348. },
  16349. below: function below() {
  16350. var e = {
  16351. origin: (t.outerHeight(!0) - m.outerHeight(!0)) / 2,
  16352. depth: {
  16353. active: m.outerHeight(!0) / 2,
  16354. next: t.outerHeight(!0) / 2
  16355. }
  16356. };
  16357. g.verbose("Setting the initial animation position as below", m, e), k.css({
  16358. transform: "translateZ(-" + e.depth.active + "px)"
  16359. }), t.css({
  16360. transform: "rotateY(0deg) translateZ(" + e.depth.active + "px)"
  16361. }), m.addClass(x.animating).css({
  16362. top: e.origin + "px",
  16363. transform: "rotateX(-90deg) translateZ(" + e.depth.next + "px)"
  16364. });
  16365. },
  16366. left: function left() {
  16367. var e = t.outerWidth(!0),
  16368. n = m.outerWidth(!0),
  16369. i = {
  16370. origin: (e - n) / 2,
  16371. depth: {
  16372. active: n / 2,
  16373. next: e / 2
  16374. }
  16375. };
  16376. g.verbose("Setting the initial animation position as left", m, i), k.css({
  16377. transform: "translateZ(-" + i.depth.active + "px)"
  16378. }), t.css({
  16379. transform: "rotateY(0deg) translateZ(" + i.depth.active + "px)"
  16380. }), m.addClass(x.animating).css({
  16381. left: i.origin + "px",
  16382. transform: "rotateY(-90deg) translateZ(" + i.depth.next + "px)"
  16383. });
  16384. },
  16385. right: function right() {
  16386. var e = t.outerWidth(!0),
  16387. n = m.outerWidth(!0),
  16388. i = {
  16389. origin: (e - n) / 2,
  16390. depth: {
  16391. active: n / 2,
  16392. next: e / 2
  16393. }
  16394. };
  16395. g.verbose("Setting the initial animation position as left", m, i), k.css({
  16396. transform: "translateZ(-" + i.depth.active + "px)"
  16397. }), t.css({
  16398. transform: "rotateY(0deg) translateZ(" + i.depth.active + "px)"
  16399. }), m.addClass(x.animating).css({
  16400. left: i.origin + "px",
  16401. transform: "rotateY(90deg) translateZ(" + i.depth.next + "px)"
  16402. });
  16403. },
  16404. behind: function behind() {
  16405. var e = t.outerWidth(!0),
  16406. n = m.outerWidth(!0),
  16407. i = {
  16408. origin: (e - n) / 2,
  16409. depth: {
  16410. active: n / 2,
  16411. next: e / 2
  16412. }
  16413. };
  16414. g.verbose("Setting the initial animation position as behind", m, i), t.css({
  16415. transform: "rotateY(0deg)"
  16416. }), m.addClass(x.animating).css({
  16417. left: i.origin + "px",
  16418. transform: "rotateY(-180deg)"
  16419. });
  16420. }
  16421. },
  16422. setting: function setting(t, n) {
  16423. if (g.debug("Changing setting", t, n), e.isPlainObject(t)) e.extend(!0, h, t);else {
  16424. if (n === i) return h[t];
  16425. e.isPlainObject(h[t]) ? e.extend(!0, h[t], n) : h[t] = n;
  16426. }
  16427. },
  16428. internal: function internal(t, n) {
  16429. if (e.isPlainObject(t)) e.extend(!0, g, t);else {
  16430. if (n === i) return g[t];
  16431. g[t] = n;
  16432. }
  16433. },
  16434. debug: function debug() {
  16435. !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)));
  16436. },
  16437. verbose: function verbose() {
  16438. !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)));
  16439. },
  16440. error: function error() {
  16441. h.silent || (g.error = Function.prototype.bind.call(console.error, console, h.name + ":"), g.error.apply(console, arguments));
  16442. },
  16443. performance: {
  16444. log: function log(e) {
  16445. var t, n;
  16446. h.performance && (n = (t = new Date().getTime()) - (s || t), s = t, l.push({
  16447. Name: e[0],
  16448. Arguments: [].slice.call(e, 1) || "",
  16449. Element: R,
  16450. "Execution Time": n
  16451. })), clearTimeout(g.performance.timer), g.performance.timer = setTimeout(g.performance.display, 500);
  16452. },
  16453. display: function display() {
  16454. var t = h.name + ":",
  16455. n = 0;
  16456. s = !1, clearTimeout(g.performance.timer), e.each(l, function (e, t) {
  16457. n += t["Execution Time"];
  16458. }), 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) {
  16459. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  16460. }), console.groupEnd()), l = [];
  16461. }
  16462. },
  16463. invoke: function invoke(t, n, o) {
  16464. var r,
  16465. s,
  16466. l,
  16467. c = P;
  16468. 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) {
  16469. var a = n != r ? o + t[n + 1].charAt(0).toUpperCase() + t[n + 1].slice(1) : t;
  16470. if (e.isPlainObject(c[a]) && n != r) c = c[a];else {
  16471. if (c[a] !== i) return s = c[a], !1;
  16472. if (!e.isPlainObject(c[o]) || n == r) return c[o] !== i && (s = c[o], !1);
  16473. c = c[o];
  16474. }
  16475. })), 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;
  16476. }
  16477. }, u ? (P === i && g.initialize(), g.invoke(c)) : (P !== i && P.invoke("destroy"), g.initialize());
  16478. }), a !== i ? a : this;
  16479. }, e.fn.shape.settings = {
  16480. name: "Shape",
  16481. silent: !1,
  16482. debug: !1,
  16483. verbose: !1,
  16484. jitter: 0,
  16485. performance: !0,
  16486. namespace: "shape",
  16487. width: "initial",
  16488. height: "initial",
  16489. beforeChange: function beforeChange() {},
  16490. onChange: function onChange() {},
  16491. allowRepeats: !1,
  16492. duration: !1,
  16493. error: {
  16494. side: "You tried to switch to a side that does not exist.",
  16495. method: "The method you called is not defined"
  16496. },
  16497. className: {
  16498. animating: "animating",
  16499. hidden: "hidden",
  16500. loading: "loading",
  16501. active: "active"
  16502. },
  16503. selector: {
  16504. sides: ".sides",
  16505. side: ".side"
  16506. }
  16507. };
  16508. }(jQuery, window, document), function (e, t, n, i) {
  16509. "use strict";
  16510. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.sidebar = function (o) {
  16511. var a,
  16512. r = e(this),
  16513. s = e(t),
  16514. l = e(n),
  16515. c = e("html"),
  16516. u = e("head"),
  16517. d = r.selector || "",
  16518. f = new Date().getTime(),
  16519. m = [],
  16520. g = arguments[0],
  16521. p = "string" == typeof g,
  16522. h = [].slice.call(arguments, 1),
  16523. v = t.requestAnimationFrame || t.mozRequestAnimationFrame || t.webkitRequestAnimationFrame || t.msRequestAnimationFrame || function (e) {
  16524. setTimeout(e, 0);
  16525. };
  16526. return r.each(function () {
  16527. var r,
  16528. b,
  16529. y,
  16530. x,
  16531. C,
  16532. w,
  16533. S = e.isPlainObject(o) ? e.extend(!0, {}, e.fn.sidebar.settings, o) : e.extend({}, e.fn.sidebar.settings),
  16534. k = S.selector,
  16535. T = S.className,
  16536. A = S.namespace,
  16537. R = S.regExp,
  16538. P = S.error,
  16539. E = "." + A,
  16540. F = "module-" + A,
  16541. O = e(this),
  16542. D = e(S.context),
  16543. q = O.children(k.sidebar),
  16544. j = (D.children(k.fixed), D.children(k.pusher)),
  16545. z = this,
  16546. I = O.data(F);
  16547. w = {
  16548. initialize: function initialize() {
  16549. w.debug("Initializing sidebar", o), w.create.id(), C = w.get.transitionEvent(), S.delaySetup ? v(w.setup.layout) : w.setup.layout(), v(function () {
  16550. w.setup.cache();
  16551. }), w.instantiate();
  16552. },
  16553. instantiate: function instantiate() {
  16554. w.verbose("Storing instance of module", w), I = w, O.data(F, w);
  16555. },
  16556. create: {
  16557. id: function id() {
  16558. y = (Math.random().toString(16) + "000000000").substr(2, 8), b = "." + y, w.verbose("Creating unique id for element", y);
  16559. }
  16560. },
  16561. destroy: function destroy() {
  16562. 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);
  16563. },
  16564. event: {
  16565. clickaway: function clickaway(e) {
  16566. var t = j.find(e.target).length > 0 || j.is(e.target),
  16567. n = D.is(e.target);
  16568. t && (w.verbose("User clicked on dimmed page"), w.hide()), n && (w.verbose("User clicked on dimmable context (scaled out page)"), w.hide());
  16569. },
  16570. touch: function touch(e) {},
  16571. containScroll: function containScroll(e) {
  16572. z.scrollTop <= 0 && (z.scrollTop = 1), z.scrollTop + z.offsetHeight >= z.scrollHeight && (z.scrollTop = z.scrollHeight - z.offsetHeight - 1);
  16573. },
  16574. scroll: function scroll(t) {
  16575. 0 === e(t.target).closest(k.sidebar).length && t.preventDefault();
  16576. }
  16577. },
  16578. bind: {
  16579. clickaway: function clickaway() {
  16580. w.verbose("Adding clickaway events to context", D), S.closable && D.on("click" + b, w.event.clickaway).on("touchend" + b, w.event.clickaway);
  16581. },
  16582. scrollLock: function scrollLock() {
  16583. 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);
  16584. }
  16585. },
  16586. unbind: {
  16587. clickaway: function clickaway() {
  16588. w.verbose("Removing clickaway events from context", D), D.off(b);
  16589. },
  16590. scrollLock: function scrollLock() {
  16591. w.verbose("Removing scroll lock from page"), l.off(b), s.off(b), O.off("scroll" + E);
  16592. }
  16593. },
  16594. add: {
  16595. inlineCSS: function inlineCSS() {
  16596. var t,
  16597. n = w.cache.width || O.outerWidth(),
  16598. i = w.cache.height || O.outerHeight(),
  16599. o = w.is.rtl(),
  16600. a = w.get.direction(),
  16601. s = {
  16602. left: n,
  16603. right: -n,
  16604. top: i,
  16605. bottom: -i
  16606. };
  16607. 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);
  16608. }
  16609. },
  16610. refresh: function refresh() {
  16611. 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();
  16612. },
  16613. refreshSidebars: function refreshSidebars() {
  16614. w.verbose("Refreshing other sidebars"), q = D.children(k.sidebar);
  16615. },
  16616. repaint: function repaint() {
  16617. w.verbose("Forcing repaint event"), z.style.display = "none";
  16618. z.offsetHeight;
  16619. z.scrollTop = z.scrollTop, z.style.display = "";
  16620. },
  16621. setup: {
  16622. cache: function cache() {
  16623. w.cache = {
  16624. width: O.outerWidth(),
  16625. height: O.outerHeight(),
  16626. rtl: "rtl" == O.css("direction")
  16627. };
  16628. },
  16629. layout: function layout() {
  16630. 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();
  16631. }
  16632. },
  16633. attachEvents: function attachEvents(t, n) {
  16634. var i = e(t);
  16635. 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);
  16636. },
  16637. show: function show(t) {
  16638. if (t = e.isFunction(t) ? t : function () {}, w.is.hidden()) {
  16639. 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) {
  16640. if ("overlay" != S.transition) return void w.hideOthers(w.show);
  16641. w.hideOthers();
  16642. } else S.transition = "overlay";
  16643. w.pushPage(function () {
  16644. t.call(z), S.onShow.call(z);
  16645. }), S.onChange.call(z), S.onVisible.call(z);
  16646. } else w.debug("Sidebar is already visible");
  16647. },
  16648. hide: function hide(t) {
  16649. t = e.isFunction(t) ? t : function () {}, (w.is.visible() || w.is.animating()) && (w.debug("Hiding sidebar", t), w.refreshSidebars(), w.pullPage(function () {
  16650. t.call(z), S.onHidden.call(z);
  16651. }), S.onChange.call(z), S.onHide.call(z));
  16652. },
  16653. othersAnimating: function othersAnimating() {
  16654. return q.not(O).filter("." + T.animating).length > 0;
  16655. },
  16656. othersVisible: function othersVisible() {
  16657. return q.not(O).filter("." + T.visible).length > 0;
  16658. },
  16659. othersActive: function othersActive() {
  16660. return w.othersVisible() || w.othersAnimating();
  16661. },
  16662. hideOthers: function hideOthers(e) {
  16663. var t = q.not(O).filter("." + T.visible),
  16664. n = t.length,
  16665. i = 0;
  16666. e = e || function () {}, t.sidebar("hide", function () {
  16667. ++i == n && e();
  16668. });
  16669. },
  16670. toggle: function toggle() {
  16671. w.verbose("Determining toggled direction"), w.is.hidden() ? w.show() : w.hide();
  16672. },
  16673. pushPage: function pushPage(t) {
  16674. var n,
  16675. i,
  16676. _o,
  16677. a = w.get.transition(),
  16678. r = "overlay" === a || w.othersActive() ? O : j;
  16679. t = e.isFunction(t) ? t : function () {}, "scale down" == S.transition && w.scrollToTop(), w.set.transition(a), w.repaint(), n = function n() {
  16680. w.bind.clickaway(), w.add.inlineCSS(), w.set.animating(), w.set.visible();
  16681. }, i = function i() {
  16682. w.set.dimmed();
  16683. }, _o = function o(e) {
  16684. e.target == r[0] && (r.off(C + b, _o), w.remove.animating(), w.bind.scrollLock(), t.call(z));
  16685. }, r.off(C + b), r.on(C + b, _o), v(n), S.dimPage && !w.othersVisible() && v(i);
  16686. },
  16687. pullPage: function pullPage(t) {
  16688. var n,
  16689. _i,
  16690. o = w.get.transition(),
  16691. a = "overlay" == o || w.othersActive() ? O : j;
  16692. t = e.isFunction(t) ? t : function () {}, w.verbose("Removing context push state", w.get.direction()), w.unbind.clickaway(), w.unbind.scrollLock(), n = function n() {
  16693. w.set.transition(o), w.set.animating(), w.remove.visible(), S.dimPage && !w.othersVisible() && j.removeClass(T.dimmed);
  16694. }, _i = function i(e) {
  16695. 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));
  16696. }, a.off(C + b), a.on(C + b, _i), v(n);
  16697. },
  16698. scrollToTop: function scrollToTop() {
  16699. w.verbose("Scrolling to top of page to avoid animation issues"), x = e(t).scrollTop(), O.scrollTop(0), t.scrollTo(0, 0);
  16700. },
  16701. scrollBack: function scrollBack() {
  16702. w.verbose("Scrolling back to original page position"), t.scrollTo(0, x);
  16703. },
  16704. clear: {
  16705. cache: function cache() {
  16706. w.verbose("Clearing cached dimensions"), w.cache = {};
  16707. }
  16708. },
  16709. set: {
  16710. ios: function ios() {
  16711. c.addClass(T.ios);
  16712. },
  16713. pushed: function pushed() {
  16714. D.addClass(T.pushed);
  16715. },
  16716. pushable: function pushable() {
  16717. D.addClass(T.pushable);
  16718. },
  16719. dimmed: function dimmed() {
  16720. j.addClass(T.dimmed);
  16721. },
  16722. active: function active() {
  16723. O.addClass(T.active);
  16724. },
  16725. animating: function animating() {
  16726. O.addClass(T.animating);
  16727. },
  16728. transition: function transition(e) {
  16729. e = e || w.get.transition(), O.addClass(e);
  16730. },
  16731. direction: function direction(e) {
  16732. e = e || w.get.direction(), O.addClass(T[e]);
  16733. },
  16734. visible: function visible() {
  16735. O.addClass(T.visible);
  16736. },
  16737. overlay: function overlay() {
  16738. O.addClass(T.overlay);
  16739. }
  16740. },
  16741. remove: {
  16742. inlineCSS: function inlineCSS() {
  16743. w.debug("Removing inline css styles", r), r && r.length > 0 && r.remove();
  16744. },
  16745. ios: function ios() {
  16746. c.removeClass(T.ios);
  16747. },
  16748. pushed: function pushed() {
  16749. D.removeClass(T.pushed);
  16750. },
  16751. pushable: function pushable() {
  16752. D.removeClass(T.pushable);
  16753. },
  16754. active: function active() {
  16755. O.removeClass(T.active);
  16756. },
  16757. animating: function animating() {
  16758. O.removeClass(T.animating);
  16759. },
  16760. transition: function transition(e) {
  16761. e = e || w.get.transition(), O.removeClass(e);
  16762. },
  16763. direction: function direction(e) {
  16764. e = e || w.get.direction(), O.removeClass(T[e]);
  16765. },
  16766. visible: function visible() {
  16767. O.removeClass(T.visible);
  16768. },
  16769. overlay: function overlay() {
  16770. O.removeClass(T.overlay);
  16771. }
  16772. },
  16773. get: {
  16774. direction: function direction() {
  16775. return O.hasClass(T.top) ? T.top : O.hasClass(T.right) ? T.right : O.hasClass(T.bottom) ? T.bottom : T.left;
  16776. },
  16777. transition: function transition() {
  16778. var e,
  16779. t = w.get.direction();
  16780. 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;
  16781. },
  16782. transitionEvent: function transitionEvent() {
  16783. var e,
  16784. t = n.createElement("element"),
  16785. o = {
  16786. transition: "transitionend",
  16787. OTransition: "oTransitionEnd",
  16788. MozTransition: "transitionend",
  16789. WebkitTransition: "webkitTransitionEnd"
  16790. };
  16791. for (e in o) {
  16792. if (t.style[e] !== i) return o[e];
  16793. }
  16794. }
  16795. },
  16796. is: {
  16797. ie: function ie() {
  16798. return !t.ActiveXObject && "ActiveXObject" in t || "ActiveXObject" in t;
  16799. },
  16800. ios: function ios() {
  16801. var e = navigator.userAgent,
  16802. t = e.match(R.ios),
  16803. n = e.match(R.mobileChrome);
  16804. return !(!t || n) && (w.verbose("Browser was found to be iOS", e), !0);
  16805. },
  16806. mobile: function mobile() {
  16807. var e = navigator.userAgent;
  16808. 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);
  16809. },
  16810. hidden: function hidden() {
  16811. return !w.is.visible();
  16812. },
  16813. visible: function visible() {
  16814. return O.hasClass(T.visible);
  16815. },
  16816. open: function open() {
  16817. return w.is.visible();
  16818. },
  16819. closed: function closed() {
  16820. return w.is.hidden();
  16821. },
  16822. vertical: function vertical() {
  16823. return O.hasClass(T.top);
  16824. },
  16825. animating: function animating() {
  16826. return D.hasClass(T.animating);
  16827. },
  16828. rtl: function rtl() {
  16829. return w.cache.rtl === i && (w.cache.rtl = "rtl" == O.css("direction")), w.cache.rtl;
  16830. }
  16831. },
  16832. setting: function setting(t, n) {
  16833. if (w.debug("Changing setting", t, n), e.isPlainObject(t)) e.extend(!0, S, t);else {
  16834. if (n === i) return S[t];
  16835. e.isPlainObject(S[t]) ? e.extend(!0, S[t], n) : S[t] = n;
  16836. }
  16837. },
  16838. internal: function internal(t, n) {
  16839. if (e.isPlainObject(t)) e.extend(!0, w, t);else {
  16840. if (n === i) return w[t];
  16841. w[t] = n;
  16842. }
  16843. },
  16844. debug: function debug() {
  16845. !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)));
  16846. },
  16847. verbose: function verbose() {
  16848. !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)));
  16849. },
  16850. error: function error() {
  16851. S.silent || (w.error = Function.prototype.bind.call(console.error, console, S.name + ":"), w.error.apply(console, arguments));
  16852. },
  16853. performance: {
  16854. log: function log(e) {
  16855. var t, n;
  16856. S.performance && (n = (t = new Date().getTime()) - (f || t), f = t, m.push({
  16857. Name: e[0],
  16858. Arguments: [].slice.call(e, 1) || "",
  16859. Element: z,
  16860. "Execution Time": n
  16861. })), clearTimeout(w.performance.timer), w.performance.timer = setTimeout(w.performance.display, 500);
  16862. },
  16863. display: function display() {
  16864. var t = S.name + ":",
  16865. n = 0;
  16866. f = !1, clearTimeout(w.performance.timer), e.each(m, function (e, t) {
  16867. n += t["Execution Time"];
  16868. }), 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) {
  16869. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  16870. }), console.groupEnd()), m = [];
  16871. }
  16872. },
  16873. invoke: function invoke(t, n, o) {
  16874. var r,
  16875. s,
  16876. l,
  16877. c = I;
  16878. 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) {
  16879. var a = n != r ? o + t[n + 1].charAt(0).toUpperCase() + t[n + 1].slice(1) : t;
  16880. if (e.isPlainObject(c[a]) && n != r) c = c[a];else {
  16881. if (c[a] !== i) return s = c[a], !1;
  16882. if (!e.isPlainObject(c[o]) || n == r) return c[o] !== i ? (s = c[o], !1) : (w.error(P.method, t), !1);
  16883. c = c[o];
  16884. }
  16885. })), 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;
  16886. }
  16887. }, p ? (I === i && w.initialize(), w.invoke(g)) : (I !== i && w.invoke("destroy"), w.initialize());
  16888. }), a !== i ? a : this;
  16889. }, e.fn.sidebar.settings = {
  16890. name: "Sidebar",
  16891. namespace: "sidebar",
  16892. silent: !1,
  16893. debug: !1,
  16894. verbose: !1,
  16895. performance: !0,
  16896. transition: "auto",
  16897. mobileTransition: "auto",
  16898. defaultTransition: {
  16899. computer: {
  16900. left: "uncover",
  16901. right: "uncover",
  16902. top: "overlay",
  16903. bottom: "overlay"
  16904. },
  16905. mobile: {
  16906. left: "uncover",
  16907. right: "uncover",
  16908. top: "overlay",
  16909. bottom: "overlay"
  16910. }
  16911. },
  16912. context: "body",
  16913. exclusive: !1,
  16914. closable: !0,
  16915. dimPage: !0,
  16916. scrollLock: !1,
  16917. returnScroll: !1,
  16918. delaySetup: !1,
  16919. duration: 500,
  16920. onChange: function onChange() {},
  16921. onShow: function onShow() {},
  16922. onHide: function onHide() {},
  16923. onHidden: function onHidden() {},
  16924. onVisible: function onVisible() {},
  16925. className: {
  16926. active: "active",
  16927. animating: "animating",
  16928. dimmed: "dimmed",
  16929. ios: "ios",
  16930. pushable: "pushable",
  16931. pushed: "pushed",
  16932. right: "right",
  16933. top: "top",
  16934. left: "left",
  16935. bottom: "bottom",
  16936. visible: "visible"
  16937. },
  16938. selector: {
  16939. fixed: ".fixed",
  16940. omitted: "script, link, style, .ui.modal, .ui.dimmer, .ui.nag, .ui.fixed",
  16941. pusher: ".pusher",
  16942. sidebar: ".ui.sidebar"
  16943. },
  16944. regExp: {
  16945. ios: /(iPad|iPhone|iPod)/g,
  16946. mobileChrome: /(CriOS)/g,
  16947. 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
  16948. },
  16949. error: {
  16950. method: "The method you called is not defined.",
  16951. pusher: "Had to add pusher element. For optimal performance make sure body content is inside a pusher element",
  16952. movedSidebar: "Had to move sidebar. For optimal performance make sure sidebar and pusher are direct children of your body tag",
  16953. overlay: "The overlay setting is no longer supported, use animation: overlay",
  16954. notFound: "There were no elements that matched the specified selector"
  16955. }
  16956. };
  16957. }(jQuery, window, document), function (e, t, n, i) {
  16958. "use strict";
  16959. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.sticky = function (o) {
  16960. var a,
  16961. r = e(this),
  16962. s = r.selector || "",
  16963. l = new Date().getTime(),
  16964. c = [],
  16965. u = arguments[0],
  16966. d = "string" == typeof u,
  16967. f = [].slice.call(arguments, 1);
  16968. return r.each(function () {
  16969. var r,
  16970. m,
  16971. g,
  16972. p,
  16973. h,
  16974. v = e.isPlainObject(o) ? e.extend(!0, {}, e.fn.sticky.settings, o) : e.extend({}, e.fn.sticky.settings),
  16975. b = v.className,
  16976. y = v.namespace,
  16977. x = v.error,
  16978. C = "." + y,
  16979. w = "module-" + y,
  16980. S = e(this),
  16981. k = e(t),
  16982. T = e(v.scrollContext),
  16983. A = (S.selector, S.data(w)),
  16984. R = t.requestAnimationFrame || t.mozRequestAnimationFrame || t.webkitRequestAnimationFrame || t.msRequestAnimationFrame || function (e) {
  16985. setTimeout(e, 0);
  16986. },
  16987. P = this;
  16988. h = {
  16989. initialize: function initialize() {
  16990. h.determineContainer(), h.determineContext(), h.verbose("Initializing sticky", v, r), h.save.positions(), h.checkErrors(), h.bind.events(), v.observeChanges && h.observeChanges(), h.instantiate();
  16991. },
  16992. instantiate: function instantiate() {
  16993. h.verbose("Storing instance of module", h), A = h, S.data(w, h);
  16994. },
  16995. destroy: function destroy() {
  16996. 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);
  16997. },
  16998. observeChanges: function observeChanges() {
  16999. "MutationObserver" in t && (g = new MutationObserver(h.event.documentChanged), p = new MutationObserver(h.event.changed), g.observe(n, {
  17000. childList: !0,
  17001. subtree: !0
  17002. }), p.observe(P, {
  17003. childList: !0,
  17004. subtree: !0
  17005. }), p.observe(m[0], {
  17006. childList: !0,
  17007. subtree: !0
  17008. }), h.debug("Setting up mutation observer", p));
  17009. },
  17010. determineContainer: function determineContainer() {
  17011. r = v.container ? e(v.container) : S.offsetParent();
  17012. },
  17013. determineContext: function determineContext() {
  17014. 0 !== (m = v.context ? e(v.context) : r).length || h.error(x.invalidContext, v.context, S);
  17015. },
  17016. checkErrors: function checkErrors() {
  17017. 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);
  17018. },
  17019. bind: {
  17020. events: function events() {
  17021. 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);
  17022. }
  17023. },
  17024. event: {
  17025. changed: function changed(e) {
  17026. clearTimeout(h.timer), h.timer = setTimeout(function () {
  17027. h.verbose("DOM tree modified, updating sticky menu", e), h.refresh();
  17028. }, 100);
  17029. },
  17030. documentChanged: function documentChanged(t) {
  17031. [].forEach.call(t, function (t) {
  17032. t.removedNodes && [].forEach.call(t.removedNodes, function (t) {
  17033. (t == P || e(t).find(P).length > 0) && (h.debug("Element removed from DOM, tearing down events"), h.destroy());
  17034. });
  17035. });
  17036. },
  17037. load: function load() {
  17038. h.verbose("Page contents finished loading"), R(h.refresh);
  17039. },
  17040. resize: function resize() {
  17041. h.verbose("Window resized"), R(h.refresh);
  17042. },
  17043. scroll: function scroll() {
  17044. R(function () {
  17045. T.triggerHandler("scrollchange" + C, T.scrollTop());
  17046. });
  17047. },
  17048. scrollchange: function scrollchange(e, t) {
  17049. h.stick(t), v.onScroll.call(P);
  17050. }
  17051. },
  17052. refresh: function refresh(e) {
  17053. h.reset(), v.context || h.determineContext(), e && h.determineContainer(), h.save.positions(), h.stick(), v.onReposition.call(P);
  17054. },
  17055. supports: {
  17056. sticky: function sticky() {
  17057. var t = e("<div/>");
  17058. t[0];
  17059. return t.addClass(b.supported), t.css("position").match("sticky");
  17060. }
  17061. },
  17062. save: {
  17063. lastScroll: function lastScroll(e) {
  17064. h.lastScroll = e;
  17065. },
  17066. elementScroll: function elementScroll(e) {
  17067. h.elementScroll = e;
  17068. },
  17069. positions: function positions() {
  17070. var e = {
  17071. height: T.height()
  17072. },
  17073. t = {
  17074. margin: {
  17075. top: parseInt(S.css("margin-top"), 10),
  17076. bottom: parseInt(S.css("margin-bottom"), 10)
  17077. },
  17078. offset: S.offset(),
  17079. width: S.outerWidth(),
  17080. height: S.outerHeight()
  17081. },
  17082. n = {
  17083. offset: m.offset(),
  17084. height: m.outerHeight()
  17085. };
  17086. r.outerHeight();
  17087. 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 = {
  17088. fits: t.height + v.offset <= e.height,
  17089. sameHeight: t.height == n.height,
  17090. scrollContext: {
  17091. height: e.height
  17092. },
  17093. element: {
  17094. margin: t.margin,
  17095. top: t.offset.top - t.margin.top,
  17096. left: t.offset.left,
  17097. width: t.width,
  17098. height: t.height,
  17099. bottom: t.offset.top + t.height
  17100. },
  17101. context: {
  17102. top: n.offset.top,
  17103. height: n.height,
  17104. bottom: n.offset.top + n.height
  17105. }
  17106. }, h.set.containerSize(), h.stick(), h.debug("Caching element positions", h.cache);
  17107. }
  17108. },
  17109. get: {
  17110. direction: function direction(e) {
  17111. var t = "down";
  17112. return e = e || T.scrollTop(), h.lastScroll !== i && (h.lastScroll < e ? t = "down" : h.lastScroll > e && (t = "up")), t;
  17113. },
  17114. scrollChange: function scrollChange(e) {
  17115. return e = e || T.scrollTop(), h.lastScroll ? e - h.lastScroll : 0;
  17116. },
  17117. currentElementScroll: function currentElementScroll() {
  17118. return h.elementScroll ? h.elementScroll : h.is.top() ? Math.abs(parseInt(S.css("top"), 10)) || 0 : Math.abs(parseInt(S.css("bottom"), 10)) || 0;
  17119. },
  17120. elementScroll: function elementScroll(e) {
  17121. e = e || T.scrollTop();
  17122. var t = h.cache.element,
  17123. n = h.cache.scrollContext,
  17124. i = h.get.scrollChange(e),
  17125. o = t.height - n.height + v.offset,
  17126. a = h.get.currentElementScroll(),
  17127. r = a + i;
  17128. return a = h.cache.fits || r < 0 ? 0 : r > o ? o : r;
  17129. }
  17130. },
  17131. remove: {
  17132. lastScroll: function lastScroll() {
  17133. delete h.lastScroll;
  17134. },
  17135. elementScroll: function elementScroll(e) {
  17136. delete h.elementScroll;
  17137. },
  17138. minimumSize: function minimumSize() {
  17139. r.css("min-height", "");
  17140. },
  17141. offset: function offset() {
  17142. S.css("margin-top", "");
  17143. }
  17144. },
  17145. set: {
  17146. offset: function offset() {
  17147. h.verbose("Setting offset on element", v.offset), S.css("margin-top", v.offset);
  17148. },
  17149. containerSize: function containerSize() {
  17150. var e = r.get(0).tagName;
  17151. "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({
  17152. height: h.cache.context.height
  17153. }));
  17154. },
  17155. minimumSize: function minimumSize() {
  17156. var e = h.cache.element;
  17157. r.css("min-height", e.height);
  17158. },
  17159. scroll: function scroll(e) {
  17160. 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));
  17161. },
  17162. size: function size() {
  17163. 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"));
  17164. }
  17165. },
  17166. is: {
  17167. standardScroll: function standardScroll() {
  17168. return T[0] == t;
  17169. },
  17170. top: function top() {
  17171. return S.hasClass(b.top);
  17172. },
  17173. bottom: function bottom() {
  17174. return S.hasClass(b.bottom);
  17175. },
  17176. initialPosition: function initialPosition() {
  17177. return !h.is.fixed() && !h.is.bound();
  17178. },
  17179. hidden: function hidden() {
  17180. return !S.is(":visible");
  17181. },
  17182. bound: function bound() {
  17183. return S.hasClass(b.bound);
  17184. },
  17185. fixed: function fixed() {
  17186. return S.hasClass(b.fixed);
  17187. }
  17188. },
  17189. stick: function stick(e) {
  17190. var t = e || T.scrollTop(),
  17191. n = h.cache,
  17192. i = n.fits,
  17193. o = n.sameHeight,
  17194. a = n.element,
  17195. r = n.scrollContext,
  17196. s = n.context,
  17197. l = h.is.bottom() && v.pushing ? v.bottomOffset : v.offset,
  17198. c = (e = {
  17199. top: t + l,
  17200. bottom: t + l + r.height
  17201. }, h.get.direction(e.top), i ? 0 : h.get.elementScroll(e.top)),
  17202. u = !i;
  17203. 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())));
  17204. },
  17205. bindTop: function bindTop() {
  17206. h.debug("Binding element to top of parent container"), h.remove.offset(), S.css({
  17207. left: "",
  17208. top: "",
  17209. marginBottom: ""
  17210. }).removeClass(b.fixed).removeClass(b.bottom).addClass(b.bound).addClass(b.top), v.onTop.call(P), v.onUnstick.call(P);
  17211. },
  17212. bindBottom: function bindBottom() {
  17213. h.debug("Binding element to bottom of parent container"), h.remove.offset(), S.css({
  17214. left: "",
  17215. top: ""
  17216. }).removeClass(b.fixed).removeClass(b.top).addClass(b.bound).addClass(b.bottom), v.onBottom.call(P), v.onUnstick.call(P);
  17217. },
  17218. setInitialPosition: function setInitialPosition() {
  17219. h.debug("Returning to initial position"), h.unfix(), h.unbind();
  17220. },
  17221. fixTop: function fixTop() {
  17222. h.debug("Fixing element to top of page"), v.setSize && h.set.size(), h.set.minimumSize(), h.set.offset(), S.css({
  17223. left: h.cache.element.left,
  17224. bottom: "",
  17225. marginBottom: ""
  17226. }).removeClass(b.bound).removeClass(b.bottom).addClass(b.fixed).addClass(b.top), v.onStick.call(P);
  17227. },
  17228. fixBottom: function fixBottom() {
  17229. h.debug("Sticking element to bottom of page"), v.setSize && h.set.size(), h.set.minimumSize(), h.set.offset(), S.css({
  17230. left: h.cache.element.left,
  17231. bottom: "",
  17232. marginBottom: ""
  17233. }).removeClass(b.bound).removeClass(b.top).addClass(b.fixed).addClass(b.bottom), v.onStick.call(P);
  17234. },
  17235. unbind: function unbind() {
  17236. h.is.bound() && (h.debug("Removing container bound position on element"), h.remove.offset(), S.removeClass(b.bound).removeClass(b.top).removeClass(b.bottom));
  17237. },
  17238. unfix: function unfix() {
  17239. 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));
  17240. },
  17241. reset: function reset() {
  17242. h.debug("Resetting elements position"), h.unbind(), h.unfix(), h.resetCSS(), h.remove.offset(), h.remove.lastScroll();
  17243. },
  17244. resetCSS: function resetCSS() {
  17245. S.css({
  17246. width: "",
  17247. height: ""
  17248. }), r.css({
  17249. height: ""
  17250. });
  17251. },
  17252. setting: function setting(t, n) {
  17253. if (e.isPlainObject(t)) e.extend(!0, v, t);else {
  17254. if (n === i) return v[t];
  17255. v[t] = n;
  17256. }
  17257. },
  17258. internal: function internal(t, n) {
  17259. if (e.isPlainObject(t)) e.extend(!0, h, t);else {
  17260. if (n === i) return h[t];
  17261. h[t] = n;
  17262. }
  17263. },
  17264. debug: function debug() {
  17265. !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)));
  17266. },
  17267. verbose: function verbose() {
  17268. !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)));
  17269. },
  17270. error: function error() {
  17271. v.silent || (h.error = Function.prototype.bind.call(console.error, console, v.name + ":"), h.error.apply(console, arguments));
  17272. },
  17273. performance: {
  17274. log: function log(e) {
  17275. var t, n;
  17276. v.performance && (n = (t = new Date().getTime()) - (l || t), l = t, c.push({
  17277. Name: e[0],
  17278. Arguments: [].slice.call(e, 1) || "",
  17279. Element: P,
  17280. "Execution Time": n
  17281. })), clearTimeout(h.performance.timer), h.performance.timer = setTimeout(h.performance.display, 0);
  17282. },
  17283. display: function display() {
  17284. var t = v.name + ":",
  17285. n = 0;
  17286. l = !1, clearTimeout(h.performance.timer), e.each(c, function (e, t) {
  17287. n += t["Execution Time"];
  17288. }), 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) {
  17289. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  17290. }), console.groupEnd()), c = [];
  17291. }
  17292. },
  17293. invoke: function invoke(t, n, o) {
  17294. var r,
  17295. s,
  17296. l,
  17297. c = A;
  17298. 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) {
  17299. var a = n != r ? o + t[n + 1].charAt(0).toUpperCase() + t[n + 1].slice(1) : t;
  17300. if (e.isPlainObject(c[a]) && n != r) c = c[a];else {
  17301. if (c[a] !== i) return s = c[a], !1;
  17302. if (!e.isPlainObject(c[o]) || n == r) return c[o] !== i && (s = c[o], !1);
  17303. c = c[o];
  17304. }
  17305. })), 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;
  17306. }
  17307. }, d ? (A === i && h.initialize(), h.invoke(u)) : (A !== i && A.invoke("destroy"), h.initialize());
  17308. }), a !== i ? a : this;
  17309. }, e.fn.sticky.settings = {
  17310. name: "Sticky",
  17311. namespace: "sticky",
  17312. silent: !1,
  17313. debug: !1,
  17314. verbose: !0,
  17315. performance: !0,
  17316. pushing: !1,
  17317. context: !1,
  17318. container: !1,
  17319. scrollContext: t,
  17320. offset: 0,
  17321. bottomOffset: 0,
  17322. jitter: 5,
  17323. setSize: !0,
  17324. observeChanges: !1,
  17325. onReposition: function onReposition() {},
  17326. onScroll: function onScroll() {},
  17327. onStick: function onStick() {},
  17328. onUnstick: function onUnstick() {},
  17329. onTop: function onTop() {},
  17330. onBottom: function onBottom() {},
  17331. error: {
  17332. container: "Sticky element must be inside a relative container",
  17333. visible: "Element is hidden, you must call refresh after element becomes visible. Use silent setting to surpress this warning in production.",
  17334. method: "The method you called is not defined.",
  17335. invalidContext: "Context specified does not exist",
  17336. elementSize: "Sticky element is larger than its container, cannot create sticky."
  17337. },
  17338. className: {
  17339. bound: "bound",
  17340. fixed: "fixed",
  17341. supported: "native",
  17342. top: "top",
  17343. bottom: "bottom"
  17344. }
  17345. };
  17346. }(jQuery, window, document), function (e, t, n, i) {
  17347. "use strict";
  17348. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.tab = function (o) {
  17349. var a,
  17350. r = e.isFunction(this) ? e(t) : e(this),
  17351. s = r.selector || "",
  17352. l = new Date().getTime(),
  17353. c = [],
  17354. u = arguments[0],
  17355. d = "string" == typeof u,
  17356. f = [].slice.call(arguments, 1),
  17357. m = !1;
  17358. return r.each(function () {
  17359. var g,
  17360. p,
  17361. h,
  17362. v,
  17363. b,
  17364. y,
  17365. x = e.isPlainObject(o) ? e.extend(!0, {}, e.fn.tab.settings, o) : e.extend({}, e.fn.tab.settings),
  17366. C = x.className,
  17367. w = x.metadata,
  17368. S = x.selector,
  17369. k = x.error,
  17370. T = "." + x.namespace,
  17371. A = "module-" + x.namespace,
  17372. R = e(this),
  17373. P = {},
  17374. E = !0,
  17375. F = 0,
  17376. O = this,
  17377. D = R.data(A);
  17378. b = {
  17379. initialize: function initialize() {
  17380. 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();
  17381. },
  17382. instantiate: function instantiate() {
  17383. b.verbose("Storing instance of module", b), D = b, R.data(A, b);
  17384. },
  17385. destroy: function destroy() {
  17386. b.debug("Destroying tabs", R), R.removeData(A).off(T);
  17387. },
  17388. bind: {
  17389. events: function events() {
  17390. e.isWindow(O) || (b.debug("Attaching tab activation events to element", R), R.on("click" + T, b.event.click));
  17391. }
  17392. },
  17393. determineTabs: function determineTabs() {
  17394. var t;
  17395. "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));
  17396. },
  17397. fix: {
  17398. callbacks: function callbacks() {
  17399. 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));
  17400. }
  17401. },
  17402. initializeHistory: function initializeHistory() {
  17403. if (b.debug("Initializing page state"), e.address === i) return b.error(k.state), !1;
  17404. if ("state" == x.historyType) {
  17405. if (b.debug("Using HTML5 to manage state"), !1 === x.path) return b.error(k.path), !1;
  17406. e.address.history(!0).state(x.path);
  17407. }
  17408. e.address.bind("change", b.event.history.change);
  17409. },
  17410. event: {
  17411. click: function click(t) {
  17412. var n = e(this).data(w.tab);
  17413. 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");
  17414. },
  17415. history: {
  17416. change: function change(t) {
  17417. var n = t.pathNames.join("/") || b.get.initialPath(),
  17418. o = x.templates.determineTitle(n) || !1;
  17419. b.performance.display(), b.debug("History change event", n, t), y = t, n !== i && b.changeTab(n), o && e.address.title(o);
  17420. }
  17421. }
  17422. },
  17423. refresh: function refresh() {
  17424. h && (b.debug("Refreshing tab", h), b.changeTab(h));
  17425. },
  17426. cache: {
  17427. read: function read(e) {
  17428. return e !== i && P[e];
  17429. },
  17430. add: function add(e, t) {
  17431. e = e || h, b.debug("Adding cached content for", e), P[e] = t;
  17432. },
  17433. remove: function remove(e) {
  17434. e = e || h, b.debug("Removing cached content for", e), delete P[e];
  17435. }
  17436. },
  17437. set: {
  17438. auto: function auto() {
  17439. var t = "string" == typeof x.path ? x.path.replace(/\/$/, "") + "/{$tab}" : "/{$tab}";
  17440. b.verbose("Setting up automatic tab retrieval from server", t), e.isPlainObject(x.apiSettings) ? x.apiSettings.url = t : x.apiSettings = {
  17441. url: t
  17442. };
  17443. },
  17444. loading: function loading(e) {
  17445. var t = b.get.tabElement(e);
  17446. 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));
  17447. },
  17448. state: function state(t) {
  17449. e.address.value(t);
  17450. }
  17451. },
  17452. changeTab: function changeTab(n) {
  17453. var i = t.history && t.history.pushState && x.ignoreFirstLoad && E,
  17454. o = x.auto || e.isPlainObject(x.apiSettings),
  17455. a = o && !i ? b.utilities.pathToArray(n) : b.get.defaultPathArray(n);
  17456. n = b.utilities.arrayToPath(a), e.each(a, function (t, r) {
  17457. var s,
  17458. l,
  17459. c,
  17460. u,
  17461. d = a.slice(0, t + 1),
  17462. f = b.utilities.arrayToPath(d),
  17463. m = b.is.tab(f),
  17464. p = t + 1 == a.length,
  17465. S = b.get.tabElement(f);
  17466. if (b.verbose("Looking for tab", r), m) {
  17467. 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;
  17468. 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);
  17469. } else {
  17470. if (-1 != n.search("/") || "" === n) return b.error(k.missingTab, R, g, f), !1;
  17471. 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 () {
  17472. b.scrollTo(s);
  17473. }, 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;
  17474. }
  17475. });
  17476. },
  17477. scrollTo: function scrollTo(t) {
  17478. var i = !!(t && t.length > 0) && t.offset().top;
  17479. !1 !== i && (b.debug("Forcing scroll to an in-page link in a hidden tab", i, t), e(n).scrollTop(i));
  17480. },
  17481. update: {
  17482. content: function content(t, n, o) {
  17483. var a = b.get.tabElement(t),
  17484. r = a[0];
  17485. 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);
  17486. }
  17487. },
  17488. fetch: {
  17489. content: function content(t, n) {
  17490. var o,
  17491. a,
  17492. r = b.get.tabElement(t),
  17493. s = {
  17494. dataType: "html",
  17495. encodeParameters: !1,
  17496. on: "now",
  17497. cache: x.alwaysRefresh,
  17498. headers: {
  17499. "X-Remote": !0
  17500. },
  17501. onSuccess: function onSuccess(e) {
  17502. "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 () {
  17503. var e = r.children().clone(!0);
  17504. e = e.not("script"), b.cache.add(n, e);
  17505. }, 0) : b.cache.add(n, r.html());
  17506. },
  17507. urlData: {
  17508. tab: n
  17509. }
  17510. },
  17511. l = r.api("get request") || !1,
  17512. c = l && "pending" === l.state();
  17513. 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);
  17514. }
  17515. },
  17516. activate: {
  17517. all: function all(e) {
  17518. b.activate.tab(e), b.activate.navigation(e);
  17519. },
  17520. tab: function tab(e) {
  17521. var t = b.get.tabElement(e),
  17522. n = "siblings" == x.deactivate ? t.siblings(p) : p.not(t),
  17523. i = t.hasClass(C.active);
  17524. 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));
  17525. },
  17526. navigation: function navigation(e) {
  17527. var t = b.get.navElement(e),
  17528. n = "siblings" == x.deactivate ? t.siblings(r) : r.not(t),
  17529. i = t.hasClass(C.active);
  17530. b.verbose("Activating tab navigation for", t, e), i || (t.addClass(C.active), n.removeClass(C.active + " " + C.loading));
  17531. }
  17532. },
  17533. deactivate: {
  17534. all: function all() {
  17535. b.deactivate.navigation(), b.deactivate.tabs();
  17536. },
  17537. navigation: function navigation() {
  17538. r.removeClass(C.active);
  17539. },
  17540. tabs: function tabs() {
  17541. p.removeClass(C.active + " " + C.loading);
  17542. }
  17543. },
  17544. is: {
  17545. tab: function tab(e) {
  17546. return e !== i && b.get.tabElement(e).length > 0;
  17547. }
  17548. },
  17549. get: {
  17550. initialPath: function initialPath() {
  17551. return r.eq(0).data(w.tab) || p.eq(0).data(w.tab);
  17552. },
  17553. path: function path() {
  17554. return e.address.value();
  17555. },
  17556. defaultPathArray: function defaultPathArray(e) {
  17557. return b.utilities.pathToArray(b.get.defaultPath(e));
  17558. },
  17559. defaultPath: function defaultPath(e) {
  17560. var t = r.filter("[data-" + w.tab + '^="' + e + '/"]').eq(0).data(w.tab) || !1;
  17561. if (t) {
  17562. if (b.debug("Found default tab", t), F < x.maxDepth) return F++, b.get.defaultPath(t);
  17563. b.error(k.recursion);
  17564. } else b.debug("No default tabs found for", e, p);
  17565. return F = 0, e;
  17566. },
  17567. navElement: function navElement(e) {
  17568. return e = e || h, r.filter("[data-" + w.tab + '="' + e + '"]');
  17569. },
  17570. tabElement: function tabElement(e) {
  17571. var t, n, i, o;
  17572. 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;
  17573. },
  17574. tab: function tab() {
  17575. return h;
  17576. }
  17577. },
  17578. utilities: {
  17579. filterArray: function filterArray(t, n) {
  17580. return e.grep(t, function (t) {
  17581. return -1 == e.inArray(t, n);
  17582. });
  17583. },
  17584. last: function last(t) {
  17585. return !!e.isArray(t) && t[t.length - 1];
  17586. },
  17587. pathToArray: function pathToArray(e) {
  17588. return e === i && (e = h), "string" == typeof e ? e.split("/") : [e];
  17589. },
  17590. arrayToPath: function arrayToPath(t) {
  17591. return !!e.isArray(t) && t.join("/");
  17592. }
  17593. },
  17594. setting: function setting(t, n) {
  17595. if (b.debug("Changing setting", t, n), e.isPlainObject(t)) e.extend(!0, x, t);else {
  17596. if (n === i) return x[t];
  17597. e.isPlainObject(x[t]) ? e.extend(!0, x[t], n) : x[t] = n;
  17598. }
  17599. },
  17600. internal: function internal(t, n) {
  17601. if (e.isPlainObject(t)) e.extend(!0, b, t);else {
  17602. if (n === i) return b[t];
  17603. b[t] = n;
  17604. }
  17605. },
  17606. debug: function debug() {
  17607. !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)));
  17608. },
  17609. verbose: function verbose() {
  17610. !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)));
  17611. },
  17612. error: function error() {
  17613. x.silent || (b.error = Function.prototype.bind.call(console.error, console, x.name + ":"), b.error.apply(console, arguments));
  17614. },
  17615. performance: {
  17616. log: function log(e) {
  17617. var t, n;
  17618. x.performance && (n = (t = new Date().getTime()) - (l || t), l = t, c.push({
  17619. Name: e[0],
  17620. Arguments: [].slice.call(e, 1) || "",
  17621. Element: O,
  17622. "Execution Time": n
  17623. })), clearTimeout(b.performance.timer), b.performance.timer = setTimeout(b.performance.display, 500);
  17624. },
  17625. display: function display() {
  17626. var t = x.name + ":",
  17627. n = 0;
  17628. l = !1, clearTimeout(b.performance.timer), e.each(c, function (e, t) {
  17629. n += t["Execution Time"];
  17630. }), 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) {
  17631. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  17632. }), console.groupEnd()), c = [];
  17633. }
  17634. },
  17635. invoke: function invoke(t, n, o) {
  17636. var r,
  17637. s,
  17638. l,
  17639. c = D;
  17640. 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) {
  17641. var a = n != r ? o + t[n + 1].charAt(0).toUpperCase() + t[n + 1].slice(1) : t;
  17642. if (e.isPlainObject(c[a]) && n != r) c = c[a];else {
  17643. if (c[a] !== i) return s = c[a], !1;
  17644. if (!e.isPlainObject(c[o]) || n == r) return c[o] !== i ? (s = c[o], !1) : (b.error(k.method, t), !1);
  17645. c = c[o];
  17646. }
  17647. })), 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;
  17648. }
  17649. }, d ? (D === i && b.initialize(), b.invoke(u)) : (D !== i && D.invoke("destroy"), b.initialize());
  17650. }), a !== i ? a : this;
  17651. }, e.tab = function () {
  17652. e(t).tab.apply(this, arguments);
  17653. }, e.fn.tab.settings = {
  17654. name: "Tab",
  17655. namespace: "tab",
  17656. silent: !1,
  17657. debug: !1,
  17658. verbose: !1,
  17659. performance: !0,
  17660. auto: !1,
  17661. history: !1,
  17662. historyType: "hash",
  17663. path: !1,
  17664. context: !1,
  17665. childrenOnly: !1,
  17666. maxDepth: 25,
  17667. deactivate: "siblings",
  17668. alwaysRefresh: !1,
  17669. cache: !0,
  17670. loadOnce: !1,
  17671. cacheType: "response",
  17672. ignoreFirstLoad: !1,
  17673. apiSettings: !1,
  17674. evaluateScripts: "once",
  17675. onFirstLoad: function onFirstLoad(e, t, n) {},
  17676. onLoad: function onLoad(e, t, n) {},
  17677. onVisible: function onVisible(e, t, n) {},
  17678. onRequest: function onRequest(e, t, n) {},
  17679. templates: {
  17680. determineTitle: function determineTitle(e) {}
  17681. },
  17682. error: {
  17683. api: "You attempted to load content without API module",
  17684. method: "The method you called is not defined",
  17685. missingTab: "Activated tab cannot be found. Tabs are case-sensitive.",
  17686. noContent: "The tab you specified is missing a content url.",
  17687. path: "History enabled, but no path was specified",
  17688. recursion: "Max recursive depth reached",
  17689. legacyInit: "onTabInit has been renamed to onFirstLoad in 2.0, please adjust your code.",
  17690. legacyLoad: "onTabLoad has been renamed to onLoad in 2.0. Please adjust your code",
  17691. state: "History requires Asual's Address library <https://github.com/asual/jquery-address>"
  17692. },
  17693. metadata: {
  17694. tab: "tab",
  17695. loaded: "loaded",
  17696. promise: "promise"
  17697. },
  17698. className: {
  17699. loading: "loading",
  17700. active: "active"
  17701. },
  17702. selector: {
  17703. tabs: ".ui.tab",
  17704. ui: ".ui"
  17705. }
  17706. };
  17707. }(jQuery, window, document), function (e, t, n, i) {
  17708. "use strict";
  17709. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.transition = function () {
  17710. var o,
  17711. a = e(this),
  17712. r = a.selector || "",
  17713. s = new Date().getTime(),
  17714. l = [],
  17715. c = arguments,
  17716. u = c[0],
  17717. d = [].slice.call(arguments, 1),
  17718. f = "string" == typeof u;
  17719. t.requestAnimationFrame || t.mozRequestAnimationFrame || t.webkitRequestAnimationFrame || t.msRequestAnimationFrame;
  17720. return a.each(function (t) {
  17721. var m,
  17722. g,
  17723. p,
  17724. h,
  17725. v,
  17726. b,
  17727. y,
  17728. x,
  17729. C,
  17730. w = e(this),
  17731. S = this;
  17732. (C = {
  17733. initialize: function initialize() {
  17734. 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());
  17735. },
  17736. instantiate: function instantiate() {
  17737. C.verbose("Storing instance of module", C), g = C, w.data(y, g);
  17738. },
  17739. destroy: function destroy() {
  17740. C.verbose("Destroying previous module for", S), w.removeData(y);
  17741. },
  17742. refresh: function refresh() {
  17743. C.verbose("Refreshing display type on next animation"), delete C.displayType;
  17744. },
  17745. forceRepaint: function forceRepaint() {
  17746. C.verbose("Forcing element repaint");
  17747. var e = w.parent(),
  17748. t = w.next();
  17749. 0 === t.length ? w.detach().appendTo(e) : w.detach().insertBefore(t);
  17750. },
  17751. repaint: function repaint() {
  17752. C.verbose("Repainting element");
  17753. S.offsetWidth;
  17754. },
  17755. delay: function delay(e) {
  17756. var n,
  17757. o = C.get.animationDirection();
  17758. 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);
  17759. },
  17760. animate: function animate(e) {
  17761. if (m = e || m, !C.is.supported()) return C.error(p.support), !1;
  17762. if (C.debug("Preparing animation", m.animation), C.is.animating()) {
  17763. 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;
  17764. if (!m.allowRepeats && C.is.occurring()) return C.debug("Animation is already occurring, will not execute repeated animation", m.animation), !1;
  17765. C.debug("New animation started, completing previous early", m.animation), g.complete();
  17766. }
  17767. C.can.animate() ? C.set.animating(m.animation) : C.error(p.noAnimation, m.animation, S);
  17768. },
  17769. reset: function reset() {
  17770. C.debug("Resetting animation to beginning conditions"), C.remove.animationCallbacks(), C.restore.conditions(), C.remove.animating();
  17771. },
  17772. queue: function queue(e) {
  17773. C.debug("Queueing animation of", e), C.queuing = !0, w.one(b + ".queue" + x, function () {
  17774. C.queuing = !1, C.repaint(), C.animate.apply(this, m);
  17775. });
  17776. },
  17777. complete: function complete(e) {
  17778. 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)));
  17779. },
  17780. force: {
  17781. visible: function visible() {
  17782. var e = w.attr("style"),
  17783. t = C.get.userStyle(),
  17784. n = C.get.displayType(),
  17785. o = t + "display: " + n + " !important;",
  17786. a = w.css("display"),
  17787. r = e === i || "" === e;
  17788. a !== n ? (C.verbose("Overriding default display to show element", n), w.attr("style", o)) : r && w.removeAttr("style");
  17789. },
  17790. hidden: function hidden() {
  17791. var e = w.attr("style"),
  17792. t = w.css("display"),
  17793. n = e === i || "" === e;
  17794. "none" === t || C.is.hidden() ? n && w.removeAttr("style") : (C.verbose("Overriding default display to hide element"), w.css("display", "none"));
  17795. }
  17796. },
  17797. has: {
  17798. direction: function direction(t) {
  17799. var n = !1;
  17800. return "string" == typeof (t = t || m.animation) && (t = t.split(" "), e.each(t, function (e, t) {
  17801. t !== h.inward && t !== h.outward || (n = !0);
  17802. })), n;
  17803. },
  17804. inlineDisplay: function inlineDisplay() {
  17805. var t = w.attr("style") || "";
  17806. return e.isArray(t.match(/display.*?;/, ""));
  17807. }
  17808. },
  17809. set: {
  17810. animating: function animating(e) {
  17811. var t;
  17812. 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);
  17813. },
  17814. duration: function duration(e, t) {
  17815. ((t = "number" == typeof (t = t || m.duration) ? t + "ms" : t) || 0 === t) && (C.verbose("Setting animation duration", t), w.css({
  17816. "animation-duration": t
  17817. }));
  17818. },
  17819. direction: function direction(e) {
  17820. (e = e || C.get.direction()) == h.inward ? C.set.inward() : C.set.outward();
  17821. },
  17822. looping: function looping() {
  17823. C.debug("Transition set to loop"), w.addClass(h.looping);
  17824. },
  17825. hidden: function hidden() {
  17826. w.addClass(h.transition).addClass(h.hidden);
  17827. },
  17828. inward: function inward() {
  17829. C.debug("Setting direction to inward"), w.removeClass(h.outward).addClass(h.inward);
  17830. },
  17831. outward: function outward() {
  17832. C.debug("Setting direction to outward"), w.removeClass(h.inward).addClass(h.outward);
  17833. },
  17834. visible: function visible() {
  17835. w.addClass(h.transition).addClass(h.visible);
  17836. }
  17837. },
  17838. start: {
  17839. animation: function animation(e) {
  17840. 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);
  17841. }
  17842. },
  17843. save: {
  17844. animation: function animation(e) {
  17845. C.cache || (C.cache = {}), C.cache.animation = e;
  17846. },
  17847. displayType: function displayType(e) {
  17848. "none" !== e && w.data(v.displayType, e);
  17849. },
  17850. transitionExists: function transitionExists(t, n) {
  17851. e.fn.transition.exists[t] = n, C.verbose("Saving existence of transition", t, n);
  17852. }
  17853. },
  17854. restore: {
  17855. conditions: function conditions() {
  17856. var e = C.get.currentAnimation();
  17857. e && (w.removeClass(e), C.verbose("Removing animation class", C.cache)), C.remove.duration();
  17858. }
  17859. },
  17860. add: {
  17861. failSafe: function failSafe() {
  17862. var e = C.get.duration();
  17863. C.timer = setTimeout(function () {
  17864. w.triggerHandler(b);
  17865. }, e + m.failSafeDelay), C.verbose("Adding fail safe timer", C.timer);
  17866. }
  17867. },
  17868. remove: {
  17869. animating: function animating() {
  17870. w.removeClass(h.animating);
  17871. },
  17872. animationCallbacks: function animationCallbacks() {
  17873. C.remove.queueCallback(), C.remove.completeCallback();
  17874. },
  17875. queueCallback: function queueCallback() {
  17876. w.off(".queue" + x);
  17877. },
  17878. completeCallback: function completeCallback() {
  17879. w.off(".complete" + x);
  17880. },
  17881. display: function display() {
  17882. w.css("display", "");
  17883. },
  17884. direction: function direction() {
  17885. w.removeClass(h.inward).removeClass(h.outward);
  17886. },
  17887. duration: function duration() {
  17888. w.css("animation-duration", "");
  17889. },
  17890. failSafe: function failSafe() {
  17891. C.verbose("Removing fail safe timer", C.timer), C.timer && clearTimeout(C.timer);
  17892. },
  17893. hidden: function hidden() {
  17894. w.removeClass(h.hidden);
  17895. },
  17896. visible: function visible() {
  17897. w.removeClass(h.visible);
  17898. },
  17899. looping: function looping() {
  17900. C.debug("Transitions are no longer looping"), C.is.looping() && (C.reset(), w.removeClass(h.looping));
  17901. },
  17902. transition: function transition() {
  17903. w.removeClass(h.visible).removeClass(h.hidden);
  17904. }
  17905. },
  17906. get: {
  17907. settings: function settings(t, n, i) {
  17908. return "object" == _typeof(t) ? e.extend(!0, {}, e.fn.transition.settings, t) : "function" == typeof i ? e.extend({}, e.fn.transition.settings, {
  17909. animation: t,
  17910. onComplete: i,
  17911. duration: n
  17912. }) : "string" == typeof n || "number" == typeof n ? e.extend({}, e.fn.transition.settings, {
  17913. animation: t,
  17914. duration: n
  17915. }) : "object" == _typeof(n) ? e.extend({}, e.fn.transition.settings, n, {
  17916. animation: t
  17917. }) : "function" == typeof n ? e.extend({}, e.fn.transition.settings, {
  17918. animation: t,
  17919. onComplete: n
  17920. }) : e.extend({}, e.fn.transition.settings, {
  17921. animation: t
  17922. });
  17923. },
  17924. animationClass: function animationClass(e) {
  17925. var t = e || m.animation,
  17926. n = C.can.transition() && !C.has.direction() ? C.get.direction() + " " : "";
  17927. return h.animating + " " + h.transition + " " + n + t;
  17928. },
  17929. currentAnimation: function currentAnimation() {
  17930. return !(!C.cache || C.cache.animation === i) && C.cache.animation;
  17931. },
  17932. currentDirection: function currentDirection() {
  17933. return C.is.inward() ? h.inward : h.outward;
  17934. },
  17935. direction: function direction() {
  17936. return C.is.hidden() || !C.is.visible() ? h.inward : h.outward;
  17937. },
  17938. animationDirection: function animationDirection(t) {
  17939. var n;
  17940. return "string" == typeof (t = t || m.animation) && (t = t.split(" "), e.each(t, function (e, t) {
  17941. t === h.inward ? n = h.inward : t === h.outward && (n = h.outward);
  17942. })), n || !1;
  17943. },
  17944. duration: function duration(e) {
  17945. 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;
  17946. },
  17947. displayType: function displayType(e) {
  17948. return e = e === i || e, m.displayType ? m.displayType : (e && w.data(v.displayType) === i && C.can.transition(!0), w.data(v.displayType));
  17949. },
  17950. userStyle: function userStyle(e) {
  17951. return (e = e || w.attr("style") || "").replace(/display.*?;/, "");
  17952. },
  17953. transitionExists: function transitionExists(t) {
  17954. return e.fn.transition.exists[t];
  17955. },
  17956. animationStartEvent: function animationStartEvent() {
  17957. var e,
  17958. t = n.createElement("div"),
  17959. o = {
  17960. animation: "animationstart",
  17961. OAnimation: "oAnimationStart",
  17962. MozAnimation: "mozAnimationStart",
  17963. WebkitAnimation: "webkitAnimationStart"
  17964. };
  17965. for (e in o) {
  17966. if (t.style[e] !== i) return o[e];
  17967. }
  17968. return !1;
  17969. },
  17970. animationEndEvent: function animationEndEvent() {
  17971. var e,
  17972. t = n.createElement("div"),
  17973. o = {
  17974. animation: "animationend",
  17975. OAnimation: "oAnimationEnd",
  17976. MozAnimation: "mozAnimationEnd",
  17977. WebkitAnimation: "webkitAnimationEnd"
  17978. };
  17979. for (e in o) {
  17980. if (t.style[e] !== i) return o[e];
  17981. }
  17982. return !1;
  17983. }
  17984. },
  17985. can: {
  17986. transition: function transition(t) {
  17987. var n,
  17988. o,
  17989. a,
  17990. r,
  17991. s,
  17992. l,
  17993. c = m.animation,
  17994. u = C.get.transitionExists(c),
  17995. d = C.get.displayType(!1);
  17996. if (u === i || t) {
  17997. 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 {
  17998. if ("none" == r || !r) return void C.debug("No animation defined in css", c);
  17999. C.debug("Static animation found", c, d), l = !1;
  18000. }
  18001. C.save.transitionExists(c, l);
  18002. }
  18003. return u !== i ? u : l;
  18004. },
  18005. animate: function animate() {
  18006. return C.can.transition() !== i;
  18007. }
  18008. },
  18009. is: {
  18010. animating: function animating() {
  18011. return w.hasClass(h.animating);
  18012. },
  18013. inward: function inward() {
  18014. return w.hasClass(h.inward);
  18015. },
  18016. outward: function outward() {
  18017. return w.hasClass(h.outward);
  18018. },
  18019. looping: function looping() {
  18020. return w.hasClass(h.looping);
  18021. },
  18022. occurring: function occurring(e) {
  18023. return e = "." + (e = e || m.animation).replace(" ", "."), w.filter(e).length > 0;
  18024. },
  18025. visible: function visible() {
  18026. return w.is(":visible");
  18027. },
  18028. hidden: function hidden() {
  18029. return "hidden" === w.css("visibility");
  18030. },
  18031. supported: function supported() {
  18032. return !1 !== b;
  18033. }
  18034. },
  18035. hide: function hide() {
  18036. 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);
  18037. },
  18038. show: function show(e) {
  18039. C.verbose("Showing element", e), C.remove.hidden(), C.set.visible(), C.force.visible(), m.onShow.call(S), m.onComplete.call(S);
  18040. },
  18041. toggle: function toggle() {
  18042. C.is.visible() ? C.hide() : C.show();
  18043. },
  18044. stop: function stop() {
  18045. C.debug("Stopping current animation"), w.triggerHandler(b);
  18046. },
  18047. stopAll: function stopAll() {
  18048. C.debug("Stopping all animation"), C.remove.queueCallback(), w.triggerHandler(b);
  18049. },
  18050. clear: {
  18051. queue: function queue() {
  18052. C.debug("Clearing animation queue"), C.remove.queueCallback();
  18053. }
  18054. },
  18055. enable: function enable() {
  18056. C.verbose("Starting animation"), w.removeClass(h.disabled);
  18057. },
  18058. disable: function disable() {
  18059. C.debug("Stopping animation"), w.addClass(h.disabled);
  18060. },
  18061. setting: function setting(t, n) {
  18062. if (C.debug("Changing setting", t, n), e.isPlainObject(t)) e.extend(!0, m, t);else {
  18063. if (n === i) return m[t];
  18064. e.isPlainObject(m[t]) ? e.extend(!0, m[t], n) : m[t] = n;
  18065. }
  18066. },
  18067. internal: function internal(t, n) {
  18068. if (e.isPlainObject(t)) e.extend(!0, C, t);else {
  18069. if (n === i) return C[t];
  18070. C[t] = n;
  18071. }
  18072. },
  18073. debug: function debug() {
  18074. !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)));
  18075. },
  18076. verbose: function verbose() {
  18077. !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)));
  18078. },
  18079. error: function error() {
  18080. m.silent || (C.error = Function.prototype.bind.call(console.error, console, m.name + ":"), C.error.apply(console, arguments));
  18081. },
  18082. performance: {
  18083. log: function log(e) {
  18084. var t, n;
  18085. m.performance && (n = (t = new Date().getTime()) - (s || t), s = t, l.push({
  18086. Name: e[0],
  18087. Arguments: [].slice.call(e, 1) || "",
  18088. Element: S,
  18089. "Execution Time": n
  18090. })), clearTimeout(C.performance.timer), C.performance.timer = setTimeout(C.performance.display, 500);
  18091. },
  18092. display: function display() {
  18093. var t = m.name + ":",
  18094. n = 0;
  18095. s = !1, clearTimeout(C.performance.timer), e.each(l, function (e, t) {
  18096. n += t["Execution Time"];
  18097. }), 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) {
  18098. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  18099. }), console.groupEnd()), l = [];
  18100. }
  18101. },
  18102. invoke: function invoke(t, n, a) {
  18103. var r,
  18104. s,
  18105. l,
  18106. c = g;
  18107. 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) {
  18108. var a = n != r ? o + t[n + 1].charAt(0).toUpperCase() + t[n + 1].slice(1) : t;
  18109. if (e.isPlainObject(c[a]) && n != r) c = c[a];else {
  18110. if (c[a] !== i) return s = c[a], !1;
  18111. if (!e.isPlainObject(c[o]) || n == r) return c[o] !== i && (s = c[o], !1);
  18112. c = c[o];
  18113. }
  18114. })), 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;
  18115. }
  18116. }).initialize();
  18117. }), o !== i ? o : this;
  18118. }, e.fn.transition.exists = {}, e.fn.transition.settings = {
  18119. name: "Transition",
  18120. silent: !1,
  18121. debug: !1,
  18122. verbose: !1,
  18123. performance: !0,
  18124. namespace: "transition",
  18125. interval: 0,
  18126. reverse: "auto",
  18127. onStart: function onStart() {},
  18128. onComplete: function onComplete() {},
  18129. onShow: function onShow() {},
  18130. onHide: function onHide() {},
  18131. useFailSafe: !0,
  18132. failSafeDelay: 100,
  18133. allowRepeats: !1,
  18134. displayType: !1,
  18135. animation: "fade",
  18136. duration: !1,
  18137. queue: !0,
  18138. metadata: {
  18139. displayType: "display"
  18140. },
  18141. className: {
  18142. animating: "animating",
  18143. disabled: "disabled",
  18144. hidden: "hidden",
  18145. inward: "in",
  18146. loading: "loading",
  18147. looping: "looping",
  18148. outward: "out",
  18149. transition: "transition",
  18150. visible: "visible"
  18151. },
  18152. error: {
  18153. noAnimation: "Element is no longer attached to DOM. Unable to animate. Use silent setting to surpress this warning in production.",
  18154. repeated: "That animation is already occurring, cancelling repeated animation",
  18155. method: "The method you called is not defined",
  18156. support: "This browser does not support CSS animations"
  18157. }
  18158. };
  18159. }(jQuery, window, document), function (e, t, n, i) {
  18160. "use strict";
  18161. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")();
  18162. e.api = e.fn.api = function (n) {
  18163. var o,
  18164. a = e.isFunction(this) ? e(t) : e(this),
  18165. r = a.selector || "",
  18166. s = new Date().getTime(),
  18167. l = [],
  18168. c = arguments[0],
  18169. u = "string" == typeof c,
  18170. d = [].slice.call(arguments, 1);
  18171. return a.each(function () {
  18172. var a,
  18173. f,
  18174. m,
  18175. g,
  18176. p,
  18177. h,
  18178. v = e.isPlainObject(n) ? e.extend(!0, {}, e.fn.api.settings, n) : e.extend({}, e.fn.api.settings),
  18179. b = v.namespace,
  18180. y = v.metadata,
  18181. x = v.selector,
  18182. C = v.error,
  18183. w = v.className,
  18184. S = "." + b,
  18185. k = "module-" + b,
  18186. T = e(this),
  18187. A = T.closest(x.form),
  18188. R = v.stateContext ? e(v.stateContext) : T,
  18189. P = this,
  18190. E = R[0],
  18191. F = T.data(k);
  18192. h = {
  18193. initialize: function initialize() {
  18194. u || h.bind.events(), h.instantiate();
  18195. },
  18196. instantiate: function instantiate() {
  18197. h.verbose("Storing instance of module", h), F = h, T.data(k, F);
  18198. },
  18199. destroy: function destroy() {
  18200. h.verbose("Destroying previous module for", P), T.removeData(k).off(S);
  18201. },
  18202. bind: {
  18203. events: function events() {
  18204. var e = h.get.event();
  18205. 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());
  18206. }
  18207. },
  18208. decode: {
  18209. json: function json(e) {
  18210. if (e !== i && "string" == typeof e) try {
  18211. e = JSON.parse(e);
  18212. } catch (e) {}
  18213. return e;
  18214. }
  18215. },
  18216. read: {
  18217. cachedResponse: function cachedResponse(e) {
  18218. var n;
  18219. if (t.Storage !== i) return n = sessionStorage.getItem(e), h.debug("Using cached response", e, n), n = h.decode.json(n);
  18220. h.error(C.noStorage);
  18221. }
  18222. },
  18223. write: {
  18224. cachedResponse: function cachedResponse(n, o) {
  18225. 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);
  18226. }
  18227. },
  18228. query: function query() {
  18229. if (h.is.disabled()) h.debug("Element is disabled API request aborted");else {
  18230. if (h.is.loading()) {
  18231. if (!v.interruptRequests) return void h.debug("Cancelling request, previous request is still pending");
  18232. h.debug("Interrupting previous request"), h.abort();
  18233. }
  18234. 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);
  18235. if (h.cancelled = !1, (m = h.get.templatedURL()) || h.is.mocked()) {
  18236. if ((m = h.add.urlData(m)) || h.is.mocked()) {
  18237. if (f.url = v.base + m, a = e.extend(!0, {}, v, {
  18238. type: v.method || v.type,
  18239. data: g,
  18240. url: v.base + m,
  18241. beforeSend: v.beforeXHR,
  18242. success: function success() {},
  18243. failure: function failure() {},
  18244. complete: function complete() {}
  18245. }), 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)]);
  18246. v.throttle ? v.throttleFirstRequest || h.timer ? (h.debug("Throttling request", v.throttle), clearTimeout(h.timer), h.timer = setTimeout(function () {
  18247. h.timer && delete h.timer, h.debug("Sending throttled request", g, a.method), h.send.request();
  18248. }, 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());
  18249. }
  18250. } else h.error(C.missingURL);
  18251. }
  18252. },
  18253. should: {
  18254. removeError: function removeError() {
  18255. return !0 === v.hideError || "auto" === v.hideError && !h.is.form();
  18256. }
  18257. },
  18258. is: {
  18259. disabled: function disabled() {
  18260. return T.filter(x.disabled).length > 0;
  18261. },
  18262. expectingJSON: function expectingJSON() {
  18263. return "json" === v.dataType || "jsonp" === v.dataType;
  18264. },
  18265. form: function form() {
  18266. return T.is("form") || R.is("form");
  18267. },
  18268. mocked: function mocked() {
  18269. return v.mockResponse || v.mockResponseAsync || v.response || v.responseAsync;
  18270. },
  18271. input: function input() {
  18272. return T.is("input");
  18273. },
  18274. loading: function loading() {
  18275. return !!h.request && "pending" == h.request.state();
  18276. },
  18277. abortedRequest: function abortedRequest(e) {
  18278. 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);
  18279. },
  18280. validResponse: function validResponse(t) {
  18281. 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);
  18282. }
  18283. },
  18284. was: {
  18285. cancelled: function cancelled() {
  18286. return h.cancelled || !1;
  18287. },
  18288. succesful: function succesful() {
  18289. return h.request && "resolved" == h.request.state();
  18290. },
  18291. failure: function failure() {
  18292. return h.request && "rejected" == h.request.state();
  18293. },
  18294. complete: function complete() {
  18295. return h.request && ("resolved" == h.request.state() || "rejected" == h.request.state());
  18296. }
  18297. },
  18298. add: {
  18299. urlData: function urlData(t, n) {
  18300. var o, a;
  18301. 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) {
  18302. var r = -1 !== a.indexOf("$") ? a.substr(2, a.length - 3) : a.substr(1, a.length - 2),
  18303. 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];
  18304. if (s === i) return h.error(C.requiredParameter, r, t), t = !1, !1;
  18305. h.verbose("Found required variable", r, s), s = v.encodeParameters ? h.get.urlEncodedValue(s) : s, t = t.replace(a, s);
  18306. })), a && (h.debug("Looking for optional URL variables", o), e.each(a, function (o, a) {
  18307. var r = -1 !== a.indexOf("$") ? a.substr(3, a.length - 4) : a.substr(2, a.length - 3),
  18308. 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];
  18309. 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, ""));
  18310. }))), t;
  18311. },
  18312. formData: function formData(t) {
  18313. var n = e.fn.serializeObject !== i,
  18314. o = n ? A.serializeObject() : A.serialize();
  18315. 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;
  18316. }
  18317. },
  18318. send: {
  18319. request: function request() {
  18320. 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);
  18321. }
  18322. },
  18323. event: {
  18324. trigger: function trigger(e) {
  18325. h.query(), "submit" != e.type && "click" != e.type || e.preventDefault();
  18326. },
  18327. xhr: {
  18328. always: function always() {},
  18329. done: function done(t, n, i) {
  18330. var o = this,
  18331. a = new Date().getTime() - p,
  18332. r = v.loadingDuration - a,
  18333. s = !!e.isFunction(v.onResponse) && (h.is.expectingJSON() ? v.onResponse.call(o, e.extend(!0, {}, t)) : v.onResponse.call(o, t));
  18334. 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 () {
  18335. h.is.validResponse(t) ? h.request.resolveWith(o, [t, i]) : h.request.rejectWith(o, [i, "invalid"]);
  18336. }, r);
  18337. },
  18338. fail: function fail(e, t, n) {
  18339. var i = this,
  18340. o = new Date().getTime() - p,
  18341. a = v.loadingDuration - o;
  18342. (a = a > 0 ? a : 0) > 0 && h.debug("Response completed early delaying state change by", a), setTimeout(function () {
  18343. h.is.abortedRequest(e) ? h.request.rejectWith(i, [e, "aborted", n]) : h.request.rejectWith(i, [e, "error", t, n]);
  18344. }, a);
  18345. }
  18346. },
  18347. request: {
  18348. done: function done(e, t) {
  18349. 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);
  18350. },
  18351. complete: function complete(e, t) {
  18352. var n, i;
  18353. h.was.succesful() ? (i = e, n = t) : (n = e, i = h.get.responseFromXHR(n)), h.remove.loading(), v.onComplete.call(E, i, T, n);
  18354. },
  18355. fail: function fail(e, t, n) {
  18356. var o = h.get.responseFromXHR(e),
  18357. r = h.get.errorFromRequest(o, t, n);
  18358. 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;
  18359. "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);
  18360. }
  18361. }
  18362. },
  18363. create: {
  18364. request: function request() {
  18365. return e.Deferred().always(h.event.request.complete).done(h.event.request.done).fail(h.event.request.fail);
  18366. },
  18367. mockedXHR: function mockedXHR() {
  18368. var t,
  18369. n,
  18370. i,
  18371. o = v.mockResponse || v.response,
  18372. a = v.mockResponseAsync || v.responseAsync;
  18373. 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, {
  18374. responseText: n
  18375. }])) : e.isFunction(a) && (t = function t(e) {
  18376. h.debug("Async callback returned response", e), e ? i.resolveWith(E, [e, !1, {
  18377. responseText: e
  18378. }]) : i.rejectWith(E, [{
  18379. responseText: e
  18380. }, !1, !1]);
  18381. }, h.debug("Using specified async response callback", a), a.call(E, f, t)), i;
  18382. },
  18383. xhr: function xhr() {
  18384. var t;
  18385. 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;
  18386. }
  18387. },
  18388. set: {
  18389. error: function error() {
  18390. h.verbose("Adding error state to element", R), R.addClass(w.error);
  18391. },
  18392. loading: function loading() {
  18393. h.verbose("Adding loading state to element", R), R.addClass(w.loading), p = new Date().getTime();
  18394. }
  18395. },
  18396. remove: {
  18397. error: function error() {
  18398. h.verbose("Removing error state from element", R), R.removeClass(w.error);
  18399. },
  18400. loading: function loading() {
  18401. h.verbose("Removing loading state from element", R), R.removeClass(w.loading);
  18402. }
  18403. },
  18404. get: {
  18405. responseFromXHR: function responseFromXHR(t) {
  18406. return !!e.isPlainObject(t) && (h.is.expectingJSON() ? h.decode.json(t.responseText) : t.responseText);
  18407. },
  18408. errorFromRequest: function errorFromRequest(t, n, o) {
  18409. return e.isPlainObject(t) && t.error !== i ? t.error : v.error[n] !== i ? v.error[n] : o;
  18410. },
  18411. request: function request() {
  18412. return h.request || !1;
  18413. },
  18414. xhr: function xhr() {
  18415. return h.xhr || !1;
  18416. },
  18417. settings: function settings() {
  18418. var t;
  18419. 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);
  18420. },
  18421. urlEncodedValue: function urlEncodedValue(e) {
  18422. var n = t.decodeURIComponent(e),
  18423. i = t.encodeURIComponent(e);
  18424. return n !== e ? (h.debug("URL value is already encoded, avoiding double encoding", e), e) : (h.verbose("Encoding value using encodeURIComponent", e, i), i);
  18425. },
  18426. defaultData: function defaultData() {
  18427. var t = {};
  18428. return e.isWindow(P) || (h.is.input() ? t.value = T.val() : h.is.form() || (t.text = T.text())), t;
  18429. },
  18430. event: function event() {
  18431. 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;
  18432. },
  18433. templatedURL: function templatedURL(e) {
  18434. 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;
  18435. if (e) {
  18436. 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);
  18437. m = v.api[e];
  18438. } else h.is.form() && (m = T.attr("action") || R.attr("action") || !1, h.debug("No url or action specified, defaulting to form action", m));
  18439. return m;
  18440. }
  18441. },
  18442. abort: function abort() {
  18443. var e = h.get.xhr();
  18444. e && "resolved" !== e.state() && (h.debug("Cancelling API request"), e.abort());
  18445. },
  18446. reset: function reset() {
  18447. h.remove.error(), h.remove.loading();
  18448. },
  18449. setting: function setting(t, n) {
  18450. if (h.debug("Changing setting", t, n), e.isPlainObject(t)) e.extend(!0, v, t);else {
  18451. if (n === i) return v[t];
  18452. e.isPlainObject(v[t]) ? e.extend(!0, v[t], n) : v[t] = n;
  18453. }
  18454. },
  18455. internal: function internal(t, n) {
  18456. if (e.isPlainObject(t)) e.extend(!0, h, t);else {
  18457. if (n === i) return h[t];
  18458. h[t] = n;
  18459. }
  18460. },
  18461. debug: function debug() {
  18462. !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)));
  18463. },
  18464. verbose: function verbose() {
  18465. !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)));
  18466. },
  18467. error: function error() {
  18468. v.silent || (h.error = Function.prototype.bind.call(console.error, console, v.name + ":"), h.error.apply(console, arguments));
  18469. },
  18470. performance: {
  18471. log: function log(e) {
  18472. var t, n;
  18473. v.performance && (n = (t = new Date().getTime()) - (s || t), s = t, l.push({
  18474. Name: e[0],
  18475. Arguments: [].slice.call(e, 1) || "",
  18476. "Execution Time": n
  18477. })), clearTimeout(h.performance.timer), h.performance.timer = setTimeout(h.performance.display, 500);
  18478. },
  18479. display: function display() {
  18480. var t = v.name + ":",
  18481. n = 0;
  18482. s = !1, clearTimeout(h.performance.timer), e.each(l, function (e, t) {
  18483. n += t["Execution Time"];
  18484. }), 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) {
  18485. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  18486. }), console.groupEnd()), l = [];
  18487. }
  18488. },
  18489. invoke: function invoke(t, n, a) {
  18490. var r,
  18491. s,
  18492. l,
  18493. c = F;
  18494. 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) {
  18495. var a = n != r ? o + t[n + 1].charAt(0).toUpperCase() + t[n + 1].slice(1) : t;
  18496. if (e.isPlainObject(c[a]) && n != r) c = c[a];else {
  18497. if (c[a] !== i) return s = c[a], !1;
  18498. if (!e.isPlainObject(c[o]) || n == r) return c[o] !== i ? (s = c[o], !1) : (h.error(C.method, t), !1);
  18499. c = c[o];
  18500. }
  18501. })), 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;
  18502. }
  18503. }, u ? (F === i && h.initialize(), h.invoke(c)) : (F !== i && F.invoke("destroy"), h.initialize());
  18504. }), o !== i ? o : this;
  18505. }, e.api.settings = {
  18506. name: "API",
  18507. namespace: "api",
  18508. debug: !1,
  18509. verbose: !1,
  18510. performance: !0,
  18511. api: {},
  18512. cache: !0,
  18513. interruptRequests: !0,
  18514. on: "auto",
  18515. stateContext: !1,
  18516. loadingDuration: 0,
  18517. hideError: "auto",
  18518. errorDuration: 2e3,
  18519. encodeParameters: !0,
  18520. action: !1,
  18521. url: !1,
  18522. base: "",
  18523. urlData: {},
  18524. defaultData: !0,
  18525. serializeForm: !1,
  18526. throttle: 0,
  18527. throttleFirstRequest: !0,
  18528. method: "get",
  18529. data: {},
  18530. dataType: "json",
  18531. mockResponse: !1,
  18532. mockResponseAsync: !1,
  18533. response: !1,
  18534. responseAsync: !1,
  18535. beforeSend: function beforeSend(e) {
  18536. return e;
  18537. },
  18538. beforeXHR: function beforeXHR(e) {},
  18539. onRequest: function onRequest(e, t) {},
  18540. onResponse: !1,
  18541. onSuccess: function onSuccess(e, t) {},
  18542. onComplete: function onComplete(e, t) {},
  18543. onFailure: function onFailure(e, t) {},
  18544. onError: function onError(e, t) {},
  18545. onAbort: function onAbort(e, t) {},
  18546. successTest: !1,
  18547. error: {
  18548. beforeSend: "The before send function has aborted the request",
  18549. error: "There was an error with your request",
  18550. exitConditions: "API Request Aborted. Exit conditions met",
  18551. JSONParse: "JSON could not be parsed during error handling",
  18552. legacyParameters: "You are using legacy API success callback names",
  18553. method: "The method you called is not defined",
  18554. missingAction: "API action used but no url was defined",
  18555. missingSerialize: "jquery-serialize-object is required to add form data to an existing data object",
  18556. missingURL: "No URL specified for api event",
  18557. noReturnedValue: "The beforeSend callback must return a settings object, beforeSend ignored.",
  18558. noStorage: "Caching responses locally requires session storage",
  18559. parseError: "There was an error parsing your request",
  18560. requiredParameter: "Missing a required URL parameter: ",
  18561. statusMessage: "Server gave an error: ",
  18562. timeout: "Your request timed out"
  18563. },
  18564. regExp: {
  18565. required: /\{\$*[A-z0-9]+\}/g,
  18566. optional: /\{\/\$*[A-z0-9]+\}/g
  18567. },
  18568. className: {
  18569. loading: "loading",
  18570. error: "error"
  18571. },
  18572. selector: {
  18573. disabled: ".disabled",
  18574. form: "form"
  18575. },
  18576. metadata: {
  18577. action: "action",
  18578. url: "url"
  18579. }
  18580. };
  18581. }(jQuery, window, document), function (e, t, n, i) {
  18582. "use strict";
  18583. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.visibility = function (o) {
  18584. var a,
  18585. r = e(this),
  18586. s = r.selector || "",
  18587. l = new Date().getTime(),
  18588. c = [],
  18589. u = arguments[0],
  18590. d = "string" == typeof u,
  18591. f = [].slice.call(arguments, 1),
  18592. m = r.length,
  18593. g = 0;
  18594. return r.each(function () {
  18595. var r,
  18596. p,
  18597. h,
  18598. v,
  18599. b = e.isPlainObject(o) ? e.extend(!0, {}, e.fn.visibility.settings, o) : e.extend({}, e.fn.visibility.settings),
  18600. y = b.className,
  18601. x = b.namespace,
  18602. C = b.error,
  18603. w = b.metadata,
  18604. S = "." + x,
  18605. k = "module-" + x,
  18606. T = e(t),
  18607. A = e(this),
  18608. R = e(b.context),
  18609. P = (A.selector, A.data(k)),
  18610. E = t.requestAnimationFrame || t.mozRequestAnimationFrame || t.webkitRequestAnimationFrame || t.msRequestAnimationFrame || function (e) {
  18611. setTimeout(e, 0);
  18612. },
  18613. F = this,
  18614. O = !1;
  18615. v = {
  18616. initialize: function initialize() {
  18617. 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();
  18618. },
  18619. instantiate: function instantiate() {
  18620. v.debug("Storing instance", v), A.data(k, v), P = v;
  18621. },
  18622. destroy: function destroy() {
  18623. 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);
  18624. },
  18625. observeChanges: function observeChanges() {
  18626. "MutationObserver" in t && (p = new MutationObserver(v.event.contextChanged), h = new MutationObserver(v.event.changed), p.observe(n, {
  18627. childList: !0,
  18628. subtree: !0
  18629. }), h.observe(F, {
  18630. childList: !0,
  18631. subtree: !0
  18632. }), v.debug("Setting up mutation observer", h));
  18633. },
  18634. bind: {
  18635. events: function events() {
  18636. 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);
  18637. }
  18638. },
  18639. event: {
  18640. changed: function changed(e) {
  18641. v.verbose("DOM tree modified, updating visibility calculations"), v.timer = setTimeout(function () {
  18642. v.verbose("DOM tree modified, updating sticky menu"), v.refresh();
  18643. }, 100);
  18644. },
  18645. contextChanged: function contextChanged(t) {
  18646. [].forEach.call(t, function (t) {
  18647. t.removedNodes && [].forEach.call(t.removedNodes, function (t) {
  18648. (t == F || e(t).find(F).length > 0) && (v.debug("Element removed from DOM, tearing down events"), v.destroy());
  18649. });
  18650. });
  18651. },
  18652. resize: function resize() {
  18653. v.debug("Window resized"), b.refreshOnResize && E(v.refresh);
  18654. },
  18655. load: function load() {
  18656. v.debug("Page finished loading"), E(v.refresh);
  18657. },
  18658. scroll: function scroll() {
  18659. b.throttle ? (clearTimeout(v.timer), v.timer = setTimeout(function () {
  18660. R.triggerHandler("scrollchange" + S, [R.scrollTop()]);
  18661. }, b.throttle)) : E(function () {
  18662. R.triggerHandler("scrollchange" + S, [R.scrollTop()]);
  18663. });
  18664. },
  18665. scrollchange: function scrollchange(e, t) {
  18666. v.checkVisibility(t);
  18667. }
  18668. },
  18669. precache: function precache(t, i) {
  18670. t instanceof Array || (t = [t]);
  18671. for (var o = t.length, a = 0, r = [], s = n.createElement("img"), l = function l() {
  18672. ++a >= t.length && e.isFunction(i) && i();
  18673. }; o--;) {
  18674. (s = n.createElement("img")).onload = l, s.onerror = l, s.src = t[o], r.push(s);
  18675. }
  18676. },
  18677. enableCallbacks: function enableCallbacks() {
  18678. v.debug("Allowing callbacks to occur"), O = !1;
  18679. },
  18680. disableCallbacks: function disableCallbacks() {
  18681. v.debug("Disabling all callbacks temporarily"), O = !0;
  18682. },
  18683. should: {
  18684. trackChanges: function trackChanges() {
  18685. return d ? (v.debug("One time query, no need to bind events"), !1) : (v.debug("Callbacks being attached"), !0);
  18686. }
  18687. },
  18688. setup: {
  18689. cache: function cache() {
  18690. v.cache = {
  18691. occurred: {},
  18692. screen: {},
  18693. element: {}
  18694. };
  18695. },
  18696. image: function image() {
  18697. var e = A.data(w.src);
  18698. e && (v.verbose("Lazy loading image", e), b.once = !0, b.observeChanges = !1, b.onOnScreen = function () {
  18699. v.debug("Image on screen", F), v.precache(e, function () {
  18700. v.set.image(e, function () {
  18701. ++g == m && b.onAllLoaded.call(this), b.onLoad.call(this);
  18702. });
  18703. });
  18704. });
  18705. },
  18706. fixed: function fixed() {
  18707. 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 () {
  18708. 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);
  18709. }, b.onTopPassedReverse = function () {
  18710. v.debug("Element returned to position, removing fixed", A), v.hide.placeholder(), v.remove.fixed();
  18711. };
  18712. }
  18713. },
  18714. create: {
  18715. placeholder: function placeholder() {
  18716. v.verbose("Creating fixed position placeholder"), r = A.clone(!1).css("display", "none").addClass(y.placeholder).insertAfter(A);
  18717. }
  18718. },
  18719. show: {
  18720. placeholder: function placeholder() {
  18721. v.verbose("Showing placeholder"), r.css("display", "block").css("visibility", "hidden");
  18722. }
  18723. },
  18724. hide: {
  18725. placeholder: function placeholder() {
  18726. v.verbose("Hiding placeholder"), r.css("display", "none").css("visibility", "");
  18727. }
  18728. },
  18729. set: {
  18730. fixed: function fixed() {
  18731. v.verbose("Setting element to fixed position"), A.addClass(y.fixed).css({
  18732. position: "fixed",
  18733. top: b.offset + "px",
  18734. left: "auto",
  18735. zIndex: b.zIndex
  18736. }), b.onFixed.call(F);
  18737. },
  18738. image: function image(t, n) {
  18739. if (A.attr("src", t), b.transition) {
  18740. if (e.fn.transition !== i) {
  18741. if (A.hasClass(y.visible)) return void v.debug("Transition already occurred on this image, skipping animation");
  18742. A.transition(b.transition, b.duration, n);
  18743. } else A.fadeIn(b.duration, n);
  18744. } else A.show();
  18745. }
  18746. },
  18747. is: {
  18748. onScreen: function onScreen() {
  18749. return v.get.elementCalculations().onScreen;
  18750. },
  18751. offScreen: function offScreen() {
  18752. return v.get.elementCalculations().offScreen;
  18753. },
  18754. visible: function visible() {
  18755. return !(!v.cache || !v.cache.element) && !(0 === v.cache.element.width && 0 === v.cache.element.offset.top);
  18756. },
  18757. verticallyScrollableContext: function verticallyScrollableContext() {
  18758. var e = R.get(0) !== t && R.css("overflow-y");
  18759. return "auto" == e || "scroll" == e;
  18760. },
  18761. horizontallyScrollableContext: function horizontallyScrollableContext() {
  18762. var e = R.get(0) !== t && R.css("overflow-x");
  18763. return "auto" == e || "scroll" == e;
  18764. }
  18765. },
  18766. refresh: function refresh() {
  18767. v.debug("Refreshing constants (width/height)"), "fixed" == b.type && v.resetFixed(), v.reset(), v.save.position(), b.checkOnRefresh && v.checkVisibility(), b.onRefresh.call(F);
  18768. },
  18769. resetFixed: function resetFixed() {
  18770. v.remove.fixed(), v.remove.occurred();
  18771. },
  18772. reset: function reset() {
  18773. v.verbose("Resetting all cached values"), e.isPlainObject(v.cache) && (v.cache.screen = {}, v.cache.element = {});
  18774. },
  18775. checkVisibility: function checkVisibility(e) {
  18776. 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()));
  18777. },
  18778. passed: function passed(t, n) {
  18779. var o = v.get.elementCalculations();
  18780. if (t && n) b.onPassed[t] = n;else {
  18781. if (t !== i) return v.get.pixelsPassed(t) > o.pixelsPassed;
  18782. o.passing && e.each(b.onPassed, function (e, t) {
  18783. o.bottomVisible || o.pixelsPassed > v.get.pixelsPassed(e) ? v.execute(t, e) : b.once || v.remove.occurred(t);
  18784. });
  18785. }
  18786. },
  18787. onScreen: function onScreen(e) {
  18788. var t = v.get.elementCalculations(),
  18789. n = e || b.onOnScreen,
  18790. o = "onScreen";
  18791. 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;
  18792. },
  18793. offScreen: function offScreen(e) {
  18794. var t = v.get.elementCalculations(),
  18795. n = e || b.onOffScreen,
  18796. o = "offScreen";
  18797. 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;
  18798. },
  18799. passing: function passing(e) {
  18800. var t = v.get.elementCalculations(),
  18801. n = e || b.onPassing,
  18802. o = "passing";
  18803. 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;
  18804. },
  18805. topVisible: function topVisible(e) {
  18806. var t = v.get.elementCalculations(),
  18807. n = e || b.onTopVisible,
  18808. o = "topVisible";
  18809. 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;
  18810. },
  18811. bottomVisible: function bottomVisible(e) {
  18812. var t = v.get.elementCalculations(),
  18813. n = e || b.onBottomVisible,
  18814. o = "bottomVisible";
  18815. 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;
  18816. },
  18817. topPassed: function topPassed(e) {
  18818. var t = v.get.elementCalculations(),
  18819. n = e || b.onTopPassed,
  18820. o = "topPassed";
  18821. 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;
  18822. },
  18823. bottomPassed: function bottomPassed(e) {
  18824. var t = v.get.elementCalculations(),
  18825. n = e || b.onBottomPassed,
  18826. o = "bottomPassed";
  18827. 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;
  18828. },
  18829. passingReverse: function passingReverse(e) {
  18830. var t = v.get.elementCalculations(),
  18831. n = e || b.onPassingReverse,
  18832. o = "passingReverse";
  18833. 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;
  18834. },
  18835. topVisibleReverse: function topVisibleReverse(e) {
  18836. var t = v.get.elementCalculations(),
  18837. n = e || b.onTopVisibleReverse,
  18838. o = "topVisibleReverse";
  18839. 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;
  18840. },
  18841. bottomVisibleReverse: function bottomVisibleReverse(e) {
  18842. var t = v.get.elementCalculations(),
  18843. n = e || b.onBottomVisibleReverse,
  18844. o = "bottomVisibleReverse";
  18845. 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;
  18846. },
  18847. topPassedReverse: function topPassedReverse(e) {
  18848. var t = v.get.elementCalculations(),
  18849. n = e || b.onTopPassedReverse,
  18850. o = "topPassedReverse";
  18851. 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;
  18852. },
  18853. bottomPassedReverse: function bottomPassedReverse(e) {
  18854. var t = v.get.elementCalculations(),
  18855. n = e || b.onBottomPassedReverse,
  18856. o = "bottomPassedReverse";
  18857. 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;
  18858. },
  18859. execute: function execute(e, t) {
  18860. var n = v.get.elementCalculations(),
  18861. i = v.get.screenCalculations();
  18862. (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);
  18863. },
  18864. remove: {
  18865. fixed: function fixed() {
  18866. v.debug("Removing fixed position"), A.removeClass(y.fixed).css({
  18867. position: "",
  18868. top: "",
  18869. left: "",
  18870. zIndex: ""
  18871. }), b.onUnfixed.call(F);
  18872. },
  18873. placeholder: function placeholder() {
  18874. v.debug("Removing placeholder content"), r && r.remove();
  18875. },
  18876. occurred: function occurred(e) {
  18877. if (e) {
  18878. var t = v.cache.occurred;
  18879. t[e] !== i && !0 === t[e] && (v.debug("Callback can now be called again", e), v.cache.occurred[e] = !1);
  18880. } else v.cache.occurred = {};
  18881. }
  18882. },
  18883. save: {
  18884. calculations: function calculations() {
  18885. v.verbose("Saving all calculations necessary to determine positioning"), v.save.direction(), v.save.screenCalculations(), v.save.elementCalculations();
  18886. },
  18887. occurred: function occurred(e) {
  18888. e && (v.cache.occurred[e] !== i && !0 === v.cache.occurred[e] || (v.verbose("Saving callback occurred", e), v.cache.occurred[e] = !0));
  18889. },
  18890. scroll: function scroll(e) {
  18891. e = e + b.offset || R.scrollTop() + b.offset, v.cache.scroll = e;
  18892. },
  18893. direction: function direction() {
  18894. var e,
  18895. t = v.get.scroll(),
  18896. n = v.get.lastScroll();
  18897. return e = t > n && n ? "down" : t < n && n ? "up" : "static", v.cache.direction = e, v.cache.direction;
  18898. },
  18899. elementPosition: function elementPosition() {
  18900. var e = v.cache.element,
  18901. t = v.get.screenSize();
  18902. 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;
  18903. },
  18904. elementCalculations: function elementCalculations() {
  18905. var e = v.get.screenCalculations(),
  18906. t = v.get.elementPosition();
  18907. 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;
  18908. },
  18909. screenCalculations: function screenCalculations() {
  18910. var e = v.get.scroll();
  18911. return v.save.direction(), v.cache.screen.top = e, v.cache.screen.bottom = e + v.cache.screen.height, v.cache.screen;
  18912. },
  18913. screenSize: function screenSize() {
  18914. v.verbose("Saving window position"), v.cache.screen = {
  18915. height: R.height()
  18916. };
  18917. },
  18918. position: function position() {
  18919. v.save.screenSize(), v.save.elementPosition();
  18920. }
  18921. },
  18922. get: {
  18923. pixelsPassed: function pixelsPassed(e) {
  18924. var t = v.get.elementCalculations();
  18925. return e.search("%") > -1 ? t.height * (parseInt(e, 10) / 100) : parseInt(e, 10);
  18926. },
  18927. occurred: function occurred(e) {
  18928. return v.cache.occurred !== i && v.cache.occurred[e] || !1;
  18929. },
  18930. direction: function direction() {
  18931. return v.cache.direction === i && v.save.direction(), v.cache.direction;
  18932. },
  18933. elementPosition: function elementPosition() {
  18934. return v.cache.element === i && v.save.elementPosition(), v.cache.element;
  18935. },
  18936. elementCalculations: function elementCalculations() {
  18937. return v.cache.element === i && v.save.elementCalculations(), v.cache.element;
  18938. },
  18939. screenCalculations: function screenCalculations() {
  18940. return v.cache.screen === i && v.save.screenCalculations(), v.cache.screen;
  18941. },
  18942. screenSize: function screenSize() {
  18943. return v.cache.screen === i && v.save.screenSize(), v.cache.screen;
  18944. },
  18945. scroll: function scroll() {
  18946. return v.cache.scroll === i && v.save.scroll(), v.cache.scroll;
  18947. },
  18948. lastScroll: function lastScroll() {
  18949. return v.cache.screen === i ? (v.debug("First scroll event, no last scroll could be found"), !1) : v.cache.screen.top;
  18950. }
  18951. },
  18952. setting: function setting(t, n) {
  18953. if (e.isPlainObject(t)) e.extend(!0, b, t);else {
  18954. if (n === i) return b[t];
  18955. b[t] = n;
  18956. }
  18957. },
  18958. internal: function internal(t, n) {
  18959. if (e.isPlainObject(t)) e.extend(!0, v, t);else {
  18960. if (n === i) return v[t];
  18961. v[t] = n;
  18962. }
  18963. },
  18964. debug: function debug() {
  18965. !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)));
  18966. },
  18967. verbose: function verbose() {
  18968. !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)));
  18969. },
  18970. error: function error() {
  18971. b.silent || (v.error = Function.prototype.bind.call(console.error, console, b.name + ":"), v.error.apply(console, arguments));
  18972. },
  18973. performance: {
  18974. log: function log(e) {
  18975. var t, n;
  18976. b.performance && (n = (t = new Date().getTime()) - (l || t), l = t, c.push({
  18977. Name: e[0],
  18978. Arguments: [].slice.call(e, 1) || "",
  18979. Element: F,
  18980. "Execution Time": n
  18981. })), clearTimeout(v.performance.timer), v.performance.timer = setTimeout(v.performance.display, 500);
  18982. },
  18983. display: function display() {
  18984. var t = b.name + ":",
  18985. n = 0;
  18986. l = !1, clearTimeout(v.performance.timer), e.each(c, function (e, t) {
  18987. n += t["Execution Time"];
  18988. }), 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) {
  18989. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  18990. }), console.groupEnd()), c = [];
  18991. }
  18992. },
  18993. invoke: function invoke(t, n, o) {
  18994. var r,
  18995. s,
  18996. l,
  18997. c = P;
  18998. 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) {
  18999. var a = n != r ? o + t[n + 1].charAt(0).toUpperCase() + t[n + 1].slice(1) : t;
  19000. if (e.isPlainObject(c[a]) && n != r) c = c[a];else {
  19001. if (c[a] !== i) return s = c[a], !1;
  19002. if (!e.isPlainObject(c[o]) || n == r) return c[o] !== i ? (s = c[o], !1) : (v.error(C.method, t), !1);
  19003. c = c[o];
  19004. }
  19005. })), 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;
  19006. }
  19007. }, d ? (P === i && v.initialize(), P.save.scroll(), P.save.calculations(), v.invoke(u)) : (P !== i && P.invoke("destroy"), v.initialize());
  19008. }), a !== i ? a : this;
  19009. }, e.fn.visibility.settings = {
  19010. name: "Visibility",
  19011. namespace: "visibility",
  19012. debug: !1,
  19013. verbose: !1,
  19014. performance: !0,
  19015. observeChanges: !0,
  19016. initialCheck: !0,
  19017. refreshOnLoad: !0,
  19018. refreshOnResize: !0,
  19019. checkOnRefresh: !0,
  19020. once: !0,
  19021. continuous: !1,
  19022. offset: 0,
  19023. includeMargin: !1,
  19024. context: t,
  19025. throttle: !1,
  19026. type: !1,
  19027. zIndex: "10",
  19028. transition: "fade in",
  19029. duration: 1e3,
  19030. onPassed: {},
  19031. onOnScreen: !1,
  19032. onOffScreen: !1,
  19033. onPassing: !1,
  19034. onTopVisible: !1,
  19035. onBottomVisible: !1,
  19036. onTopPassed: !1,
  19037. onBottomPassed: !1,
  19038. onPassingReverse: !1,
  19039. onTopVisibleReverse: !1,
  19040. onBottomVisibleReverse: !1,
  19041. onTopPassedReverse: !1,
  19042. onBottomPassedReverse: !1,
  19043. onLoad: function onLoad() {},
  19044. onAllLoaded: function onAllLoaded() {},
  19045. onFixed: function onFixed() {},
  19046. onUnfixed: function onUnfixed() {},
  19047. onUpdate: !1,
  19048. onRefresh: function onRefresh() {},
  19049. metadata: {
  19050. src: "src"
  19051. },
  19052. className: {
  19053. fixed: "fixed",
  19054. placeholder: "placeholder",
  19055. visible: "visible"
  19056. },
  19057. error: {
  19058. method: "The method you called is not defined.",
  19059. visible: "Element is hidden, you must call refresh after element becomes visible"
  19060. }
  19061. };
  19062. }(jQuery, window, document);
  19063. /***/ }),
  19064. /***/ "./js/services/i18nHelper.js":
  19065. /*!***********************************!*\
  19066. !*** ./js/services/i18nHelper.js ***!
  19067. \***********************************/
  19068. /*! exports provided: i18nHelper */
  19069. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  19070. "use strict";
  19071. __webpack_require__.r(__webpack_exports__);
  19072. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "i18nHelper", function() { return i18nHelper; });
  19073. /* harmony import */ var line_i18n__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! line-i18n */ "./node_modules/line-i18n/dist/index.js");
  19074. /* harmony import */ var _localizedStringsService__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./localizedStringsService */ "./js/services/localizedStringsService.js");
  19075. var StringTypes = line_i18n__WEBPACK_IMPORTED_MODULE_0__["default"].StringTypes;
  19076. var i18nHelper = Object.freeze({
  19077. i18n: function i18n(identifier) {
  19078. var opts = identifier.split(':');
  19079. var type = opts[0].toLowerCase();
  19080. var id = opts[1];
  19081. if (StringTypes.ERROR === type) {
  19082. return _localizedStringsService__WEBPACK_IMPORTED_MODULE_1__["LocalizedStrings"].getError(id);
  19083. } else if (StringTypes.MESSAGE === type) {
  19084. return _localizedStringsService__WEBPACK_IMPORTED_MODULE_1__["LocalizedStrings"].getMessage(id);
  19085. } else if (StringTypes.UI === type) {
  19086. return _localizedStringsService__WEBPACK_IMPORTED_MODULE_1__["LocalizedStrings"].getUI(id);
  19087. } else {
  19088. console.warn("A string has been passed to the i18n helper function that was not in the form type:id -> " + identifier);
  19089. return _localizedStringsService__WEBPACK_IMPORTED_MODULE_1__["LocalizedStrings"].getString(identifier, type);
  19090. }
  19091. }
  19092. });
  19093. /***/ }),
  19094. /***/ "./js/services/languageService.js":
  19095. /*!****************************************!*\
  19096. !*** ./js/services/languageService.js ***!
  19097. \****************************************/
  19098. /*! exports provided: LanguageService */
  19099. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  19100. "use strict";
  19101. __webpack_require__.r(__webpack_exports__);
  19102. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "LanguageService", function() { return LanguageService; });
  19103. /* harmony import */ var _grammar___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./../../grammar/ */ "./grammar/index.js");
  19104. /* harmony import */ var line_i18n__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! line-i18n */ "./node_modules/line-i18n/dist/index.js");
  19105. /* harmony import */ var _util_config__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./../util/config */ "./js/util/config.js");
  19106. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  19107. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  19108. 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); } }
  19109. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  19110. function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
  19111. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  19112. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  19113. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
  19114. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  19115. var LanguageServiceExtended =
  19116. /*#__PURE__*/
  19117. function (_line_i18n$LanguageSe) {
  19118. _inherits(LanguageServiceExtended, _line_i18n$LanguageSe);
  19119. function LanguageServiceExtended() {
  19120. _classCallCheck(this, LanguageServiceExtended);
  19121. return _possibleConstructorReturn(this, _getPrototypeOf(LanguageServiceExtended).call(this, typeof iLMparameters === 'undefined' ? _util_config__WEBPACK_IMPORTED_MODULE_2__["Config"].default_lang : iLMparameters.lang));
  19122. }
  19123. _createClass(LanguageServiceExtended, [{
  19124. key: "getCurrentLexer",
  19125. value: function getCurrentLexer() {
  19126. var langInfo = _grammar___WEBPACK_IMPORTED_MODULE_0__["default"][this.getLang()];
  19127. if (langInfo === null || langInfo === undefined) {
  19128. return _grammar___WEBPACK_IMPORTED_MODULE_0__["default"][this.getDefaultLang()].lexer;
  19129. } else {
  19130. return langInfo.lexer;
  19131. }
  19132. }
  19133. }, {
  19134. key: "getCurrentLangFuncs",
  19135. value: function getCurrentLangFuncs() {
  19136. var langInfo = _grammar___WEBPACK_IMPORTED_MODULE_0__["default"][this.getLang()];
  19137. if (langInfo === null || langInfo === undefined) {
  19138. return _grammar___WEBPACK_IMPORTED_MODULE_0__["default"][this.getDefaultLang()].langFuncs;
  19139. } else {
  19140. return langInfo.langFuncs;
  19141. }
  19142. }
  19143. }, {
  19144. key: "getCurrentLangLibs",
  19145. value: function getCurrentLangLibs() {
  19146. var langInfo = _grammar___WEBPACK_IMPORTED_MODULE_0__["default"][this.getLang()];
  19147. if (langInfo === null || langInfo === undefined) {
  19148. return _grammar___WEBPACK_IMPORTED_MODULE_0__["default"][this.getDefaultLang()].langLibs;
  19149. }
  19150. return langInfo.langLibs;
  19151. }
  19152. }]);
  19153. return LanguageServiceExtended;
  19154. }(line_i18n__WEBPACK_IMPORTED_MODULE_1__["default"].LanguageServiceNoLS);
  19155. var LanguageService = new LanguageServiceExtended();
  19156. /***/ }),
  19157. /***/ "./js/services/localizedStringsService.js":
  19158. /*!************************************************!*\
  19159. !*** ./js/services/localizedStringsService.js ***!
  19160. \************************************************/
  19161. /*! exports provided: LocalizedStrings, getInstance */
  19162. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  19163. "use strict";
  19164. __webpack_require__.r(__webpack_exports__);
  19165. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "LocalizedStrings", function() { return LocalizedStrings; });
  19166. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getInstance", function() { return getInstance; });
  19167. /* harmony import */ var _languageService__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./languageService */ "./js/services/languageService.js");
  19168. /* harmony import */ var line_i18n__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! line-i18n */ "./node_modules/line-i18n/dist/index.js");
  19169. /* harmony import */ var _i18n__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./../../i18n */ "./i18n/index.js");
  19170. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  19171. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  19172. 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); } }
  19173. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  19174. function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
  19175. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  19176. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  19177. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
  19178. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  19179. var IVProgLocalizedStrings =
  19180. /*#__PURE__*/
  19181. function (_line_i18n$LocalizedS) {
  19182. _inherits(IVProgLocalizedStrings, _line_i18n$LocalizedS);
  19183. function IVProgLocalizedStrings(langService, langsJsons) {
  19184. var shouldListenToChange = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  19185. _classCallCheck(this, IVProgLocalizedStrings);
  19186. return _possibleConstructorReturn(this, _getPrototypeOf(IVProgLocalizedStrings).call(this, langService, langsJsons, shouldListenToChange));
  19187. }
  19188. _createClass(IVProgLocalizedStrings, [{
  19189. key: "translateType",
  19190. value: function translateType(type, dim) {
  19191. switch (dim) {
  19192. case 0:
  19193. return this.getUI(type);
  19194. default:
  19195. var transType = this.getUI(type);
  19196. if (dim === 1) return this.getUI("vector_string", [transType]);else return this.getUI("matrix_string", [transType]);
  19197. }
  19198. }
  19199. }, {
  19200. key: "translateOp",
  19201. value: function translateOp(op) {
  19202. switch (op.ord) {
  19203. case Operators.AND.ord:
  19204. case Operators.OR.ord:
  19205. case Operators.NOT.ord:
  19206. return this.getUI(op.value);
  19207. default:
  19208. return op.value;
  19209. }
  19210. }
  19211. }]);
  19212. return IVProgLocalizedStrings;
  19213. }(line_i18n__WEBPACK_IMPORTED_MODULE_1__["default"].LocalizedStrings);
  19214. var LocalizedStrings = Object.freeze(new IVProgLocalizedStrings(_languageService__WEBPACK_IMPORTED_MODULE_0__["LanguageService"], _i18n__WEBPACK_IMPORTED_MODULE_2__["default"], true));
  19215. var _instance = null;
  19216. function getInstance() {
  19217. if (_instance == null) {
  19218. _instance = new IVProgLocalizedStrings(_languageService__WEBPACK_IMPORTED_MODULE_0__["LanguageService"], _i18n__WEBPACK_IMPORTED_MODULE_2__["default"]);
  19219. }
  19220. return _instance;
  19221. }
  19222. /***/ }),
  19223. /***/ "./js/typeSystem/baseTypes.js":
  19224. /*!************************************!*\
  19225. !*** ./js/typeSystem/baseTypes.js ***!
  19226. \************************************/
  19227. /*! exports provided: BaseTypes */
  19228. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  19229. "use strict";
  19230. __webpack_require__.r(__webpack_exports__);
  19231. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "BaseTypes", function() { return BaseTypes; });
  19232. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  19233. 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); } }
  19234. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  19235. var BaseType =
  19236. /*#__PURE__*/
  19237. function () {
  19238. function BaseType(name, ord) {
  19239. _classCallCheck(this, BaseType);
  19240. this.name = name;
  19241. this.ord = ord;
  19242. }
  19243. _createClass(BaseType, [{
  19244. key: "isCompatible",
  19245. value: function isCompatible(another) {
  19246. if (another instanceof BaseType) {
  19247. return this.name === another.name && this.ord === another.ord;
  19248. }
  19249. return false;
  19250. }
  19251. }, {
  19252. key: "value",
  19253. get: function get() {
  19254. return this.name;
  19255. }
  19256. }]);
  19257. return BaseType;
  19258. }(); // Base types names are the same as i18n ui type keys
  19259. var BaseTypes = Object.freeze({
  19260. INTEGER: new BaseType("integer", 0),
  19261. REAL: new BaseType("real", 1),
  19262. STRING: new BaseType("text", 2),
  19263. BOOLEAN: new BaseType("boolean", 3),
  19264. VOID: new BaseType("void", 4),
  19265. UNDEFINED: new BaseType("undefined", 5)
  19266. });
  19267. /***/ }),
  19268. /***/ "./js/typeSystem/compoundType.js":
  19269. /*!***************************************!*\
  19270. !*** ./js/typeSystem/compoundType.js ***!
  19271. \***************************************/
  19272. /*! exports provided: CompoundType */
  19273. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  19274. "use strict";
  19275. __webpack_require__.r(__webpack_exports__);
  19276. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CompoundType", function() { return CompoundType; });
  19277. /* harmony import */ var _type__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./type */ "./js/typeSystem/type.js");
  19278. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  19279. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  19280. 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); } }
  19281. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  19282. function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
  19283. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  19284. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  19285. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
  19286. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  19287. var CompoundType =
  19288. /*#__PURE__*/
  19289. function (_Type) {
  19290. _inherits(CompoundType, _Type);
  19291. function CompoundType(type, dimensions) {
  19292. var _this;
  19293. _classCallCheck(this, CompoundType);
  19294. _this = _possibleConstructorReturn(this, _getPrototypeOf(CompoundType).call(this, null));
  19295. _this.innerType = type;
  19296. _this.dimensions = dimensions;
  19297. return _this;
  19298. }
  19299. _createClass(CompoundType, [{
  19300. key: "isCompatible",
  19301. value: function isCompatible(another) {
  19302. if (another instanceof CompoundType) {
  19303. if (this.dimensions !== another.dimensions) {
  19304. return false;
  19305. }
  19306. return this.innerType.isCompatible(another.innerType);
  19307. }
  19308. return false;
  19309. }
  19310. }, {
  19311. key: "stringInfo",
  19312. value: function stringInfo() {
  19313. var _this2 = this;
  19314. var list = this.innerType.stringInfo();
  19315. list.forEach(function (v) {
  19316. v.dim = _this2.dimensions;
  19317. });
  19318. return list;
  19319. }
  19320. }, {
  19321. key: "canAccept",
  19322. value: function canAccept(another) {
  19323. if (another instanceof CompoundType) {
  19324. return this.dimensions > another.dimensions && this.innerType.isCompatible(another.innerType);
  19325. } else {
  19326. return this.innerType.isCompatible(another);
  19327. }
  19328. }
  19329. }]);
  19330. return CompoundType;
  19331. }(_type__WEBPACK_IMPORTED_MODULE_0__["Type"]);
  19332. /***/ }),
  19333. /***/ "./js/typeSystem/multiType.js":
  19334. /*!************************************!*\
  19335. !*** ./js/typeSystem/multiType.js ***!
  19336. \************************************/
  19337. /*! exports provided: MultiType */
  19338. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  19339. "use strict";
  19340. __webpack_require__.r(__webpack_exports__);
  19341. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MultiType", function() { return MultiType; });
  19342. /* harmony import */ var _type__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./type */ "./js/typeSystem/type.js");
  19343. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  19344. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  19345. 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); } }
  19346. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  19347. function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
  19348. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  19349. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  19350. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
  19351. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  19352. var MultiType =
  19353. /*#__PURE__*/
  19354. function (_Type) {
  19355. _inherits(MultiType, _Type);
  19356. function MultiType(types) {
  19357. var _this;
  19358. _classCallCheck(this, MultiType);
  19359. _this = _possibleConstructorReturn(this, _getPrototypeOf(MultiType).call(this, null));
  19360. _this.types = types;
  19361. return _this;
  19362. }
  19363. _createClass(MultiType, [{
  19364. key: "stringInfo",
  19365. value: function stringInfo() {
  19366. var list = [];
  19367. for (var i = 0; i < this.types.length; i++) {
  19368. var t = this.types[i];
  19369. list = list.concat(t.stringInfo());
  19370. }
  19371. return list;
  19372. }
  19373. }, {
  19374. key: "isCompatible",
  19375. value: function isCompatible(another) {
  19376. if (another instanceof _type__WEBPACK_IMPORTED_MODULE_0__["Type"]) {
  19377. for (var i = 0; i < this.types.length; i++) {
  19378. var t = this.types[i];
  19379. if (another.isCompatible(t)) {
  19380. return true;
  19381. }
  19382. }
  19383. }
  19384. return false;
  19385. }
  19386. }, {
  19387. key: "value",
  19388. get: function get() {
  19389. return null;
  19390. }
  19391. }, {
  19392. key: "ord",
  19393. get: function get() {
  19394. return null;
  19395. }
  19396. }]);
  19397. return MultiType;
  19398. }(_type__WEBPACK_IMPORTED_MODULE_0__["Type"]);
  19399. /***/ }),
  19400. /***/ "./js/typeSystem/parsers.js":
  19401. /*!**********************************!*\
  19402. !*** ./js/typeSystem/parsers.js ***!
  19403. \**********************************/
  19404. /*! exports provided: toInt, toString, toReal, toBool, convertBoolToString, convertToString */
  19405. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  19406. "use strict";
  19407. __webpack_require__.r(__webpack_exports__);
  19408. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "toInt", function() { return toInt; });
  19409. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "toString", function() { return toString; });
  19410. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "toReal", function() { return toReal; });
  19411. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "toBool", function() { return toBool; });
  19412. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "convertBoolToString", function() { return convertBoolToString; });
  19413. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "convertToString", function() { return convertToString; });
  19414. /* harmony import */ var _services_languageService__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../services/languageService */ "./js/services/languageService.js");
  19415. /* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./types */ "./js/typeSystem/types.js");
  19416. /* harmony import */ var decimal_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! decimal.js */ "./node_modules/decimal.js/decimal.js");
  19417. /* harmony import */ var decimal_js__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(decimal_js__WEBPACK_IMPORTED_MODULE_2__);
  19418. function toInt(str) {
  19419. return new decimal_js__WEBPACK_IMPORTED_MODULE_2___default.a(str);
  19420. }
  19421. function toString(str) {
  19422. var value = str.replace(/^"/, '');
  19423. value = value.replace(/"$/, '');
  19424. value = value.replace(/\\b/g, "\b");
  19425. value = value.replace(/\\t/g, "\t");
  19426. value = value.replace(/\\n/g, "\n");
  19427. value = value.replace(/\\r/g, "\r");
  19428. value = value.replace(/\\\"/g, "\"");
  19429. value = value.replace(/\\\'/g, "\'");
  19430. value = value.replace(/\\\\/g, "\\");
  19431. return value;
  19432. }
  19433. function toReal(value) {
  19434. return new decimal_js__WEBPACK_IMPORTED_MODULE_2___default.a(value);
  19435. }
  19436. function toBool(str) {
  19437. var val = "'" + str + "'";
  19438. var lexer = _services_languageService__WEBPACK_IMPORTED_MODULE_0__["LanguageService"].getCurrentLexer();
  19439. var instance = new lexer(null);
  19440. if (instance.literalNames[lexer.RK_TRUE] === val) {
  19441. return true;
  19442. } else if (instance.literalNames[lexer.RK_FALSE] === val) {
  19443. return false;
  19444. } else {
  19445. // TODO: better error message
  19446. throw new Error(str + "not a valid boolean");
  19447. }
  19448. }
  19449. function convertBoolToString(bool) {
  19450. var lexer = _services_languageService__WEBPACK_IMPORTED_MODULE_0__["LanguageService"].getCurrentLexer();
  19451. var instance = new lexer(null);
  19452. if (bool) {
  19453. return instance.literalNames[lexer.RK_TRUE];
  19454. } else {
  19455. return instance.literalNames[lexer.RK_FALSE];
  19456. }
  19457. }
  19458. function convertToString(value, type) {
  19459. switch (type.ord) {
  19460. case _types__WEBPACK_IMPORTED_MODULE_1__["Types"].INTEGER.ord:
  19461. return value.toString();
  19462. case _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL.ord:
  19463. {
  19464. if (value.dp() <= 0) {
  19465. return value.toFixed(1);
  19466. } else {
  19467. return value.toNumber();
  19468. }
  19469. }
  19470. case _types__WEBPACK_IMPORTED_MODULE_1__["Types"].BOOLEAN.ord:
  19471. return convertBoolToString(value);
  19472. default:
  19473. return value;
  19474. }
  19475. }
  19476. /***/ }),
  19477. /***/ "./js/typeSystem/type.js":
  19478. /*!*******************************!*\
  19479. !*** ./js/typeSystem/type.js ***!
  19480. \*******************************/
  19481. /*! exports provided: Type */
  19482. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  19483. "use strict";
  19484. __webpack_require__.r(__webpack_exports__);
  19485. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Type", function() { return Type; });
  19486. /* harmony import */ var _util_config__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../util/config */ "./js/util/config.js");
  19487. /* harmony import */ var _baseTypes__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./baseTypes */ "./js/typeSystem/baseTypes.js");
  19488. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  19489. 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); } }
  19490. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  19491. var Type =
  19492. /*#__PURE__*/
  19493. function () {
  19494. function Type(baseType) {
  19495. _classCallCheck(this, Type);
  19496. this.baseType = baseType;
  19497. }
  19498. _createClass(Type, [{
  19499. key: "stringInfo",
  19500. value: function stringInfo() {
  19501. return [{
  19502. type: this.baseType.name,
  19503. dim: 0
  19504. }];
  19505. }
  19506. }, {
  19507. key: "isCompatible",
  19508. value: function isCompatible(another) {
  19509. if (another instanceof Type) {
  19510. return this.baseType.isCompatible(another.baseType);
  19511. }
  19512. return false;
  19513. }
  19514. }, {
  19515. key: "value",
  19516. get: function get() {
  19517. return this.baseType.value;
  19518. }
  19519. }, {
  19520. key: "ord",
  19521. get: function get() {
  19522. return this.baseType.ord;
  19523. }
  19524. }]);
  19525. return Type;
  19526. }();
  19527. /***/ }),
  19528. /***/ "./js/typeSystem/types.js":
  19529. /*!********************************!*\
  19530. !*** ./js/typeSystem/types.js ***!
  19531. \********************************/
  19532. /*! exports provided: Types */
  19533. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  19534. "use strict";
  19535. __webpack_require__.r(__webpack_exports__);
  19536. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Types", function() { return Types; });
  19537. /* harmony import */ var _baseTypes__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./baseTypes */ "./js/typeSystem/baseTypes.js");
  19538. /* harmony import */ var _type__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./type */ "./js/typeSystem/type.js");
  19539. /* harmony import */ var _multiType__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./multiType */ "./js/typeSystem/multiType.js");
  19540. var INTEGER = new _type__WEBPACK_IMPORTED_MODULE_1__["Type"](_baseTypes__WEBPACK_IMPORTED_MODULE_0__["BaseTypes"].INTEGER);
  19541. var REAL = new _type__WEBPACK_IMPORTED_MODULE_1__["Type"](_baseTypes__WEBPACK_IMPORTED_MODULE_0__["BaseTypes"].REAL);
  19542. var STRING = new _type__WEBPACK_IMPORTED_MODULE_1__["Type"](_baseTypes__WEBPACK_IMPORTED_MODULE_0__["BaseTypes"].STRING);
  19543. var BOOLEAN = new _type__WEBPACK_IMPORTED_MODULE_1__["Type"](_baseTypes__WEBPACK_IMPORTED_MODULE_0__["BaseTypes"].BOOLEAN);
  19544. var VOID = new _type__WEBPACK_IMPORTED_MODULE_1__["Type"](_baseTypes__WEBPACK_IMPORTED_MODULE_0__["BaseTypes"].VOID);
  19545. var UNDEFINED = new _type__WEBPACK_IMPORTED_MODULE_1__["Type"](_baseTypes__WEBPACK_IMPORTED_MODULE_0__["BaseTypes"].UNDEFINED);
  19546. var ALL = new _multiType__WEBPACK_IMPORTED_MODULE_2__["MultiType"]([INTEGER, REAL, STRING, BOOLEAN]);
  19547. var Types = Object.freeze({
  19548. INTEGER: INTEGER,
  19549. REAL: REAL,
  19550. STRING: STRING,
  19551. BOOLEAN: BOOLEAN,
  19552. VOID: VOID,
  19553. UNDEFINED: UNDEFINED,
  19554. ALL: ALL
  19555. });
  19556. /***/ }),
  19557. /***/ "./js/util/config.js":
  19558. /*!***************************!*\
  19559. !*** ./js/util/config.js ***!
  19560. \***************************/
  19561. /*! exports provided: Config */
  19562. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  19563. "use strict";
  19564. __webpack_require__.r(__webpack_exports__);
  19565. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Config", function() { return Config; });
  19566. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  19567. 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); } }
  19568. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  19569. var ConfigObject =
  19570. /*#__PURE__*/
  19571. function () {
  19572. function ConfigObject() {
  19573. _classCallCheck(this, ConfigObject);
  19574. this.loopTimeout = 5000;
  19575. this.decimalPlaces = 8;
  19576. this.intConvertRoundMode = 2;
  19577. this.default_lang = 'pt';
  19578. this.enable_type_casting = true;
  19579. }
  19580. _createClass(ConfigObject, [{
  19581. key: "setConfig",
  19582. value: function setConfig(opts) {
  19583. for (var key in opts) {
  19584. if (this.hasOwnProperty(key)) {
  19585. this[key] = opts[key];
  19586. }
  19587. }
  19588. }
  19589. }]);
  19590. return ConfigObject;
  19591. }();
  19592. var config = new ConfigObject();
  19593. var Config = config;
  19594. /***/ }),
  19595. /***/ "./js/util/inputTest.js":
  19596. /*!******************************!*\
  19597. !*** ./js/util/inputTest.js ***!
  19598. \******************************/
  19599. /*! exports provided: InputTest */
  19600. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  19601. "use strict";
  19602. __webpack_require__.r(__webpack_exports__);
  19603. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "InputTest", function() { return InputTest; });
  19604. /* harmony import */ var _io_input__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./../io/input */ "./js/io/input.js");
  19605. /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  19606. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  19607. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  19608. 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); } }
  19609. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  19610. function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
  19611. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  19612. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  19613. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
  19614. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  19615. var InputTest =
  19616. /*#__PURE__*/
  19617. function (_Input) {
  19618. _inherits(InputTest, _Input);
  19619. function InputTest(inputList) {
  19620. var _this;
  19621. _classCallCheck(this, InputTest);
  19622. _this = _possibleConstructorReturn(this, _getPrototypeOf(InputTest).call(this));
  19623. _this.index = 0;
  19624. _this.inputList = inputList;
  19625. return _this;
  19626. }
  19627. _createClass(InputTest, [{
  19628. key: "requestInput",
  19629. value: function requestInput(callback) {
  19630. if (this.index < this.inputList.length) {
  19631. callback(this.inputList[this.index]);
  19632. this.index++;
  19633. } else {
  19634. throw new Error(_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_1__["LocalizedStrings"].getError("exceeded_input_request"));
  19635. }
  19636. }
  19637. }]);
  19638. return InputTest;
  19639. }(_io_input__WEBPACK_IMPORTED_MODULE_0__["Input"]);
  19640. /***/ }),
  19641. /***/ "./js/util/outputTest.js":
  19642. /*!*******************************!*\
  19643. !*** ./js/util/outputTest.js ***!
  19644. \*******************************/
  19645. /*! exports provided: OutputTest */
  19646. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  19647. "use strict";
  19648. __webpack_require__.r(__webpack_exports__);
  19649. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "OutputTest", function() { return OutputTest; });
  19650. /* harmony import */ var _io_output__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./../io/output */ "./js/io/output.js");
  19651. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  19652. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  19653. 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); } }
  19654. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  19655. function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
  19656. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  19657. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  19658. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
  19659. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  19660. var OutputTest =
  19661. /*#__PURE__*/
  19662. function (_Output) {
  19663. _inherits(OutputTest, _Output);
  19664. function OutputTest() {
  19665. var _this;
  19666. _classCallCheck(this, OutputTest);
  19667. _this = _possibleConstructorReturn(this, _getPrototypeOf(OutputTest).call(this));
  19668. _this.list = [];
  19669. return _this;
  19670. }
  19671. _createClass(OutputTest, [{
  19672. key: "sendOutput",
  19673. value: function sendOutput(text) {
  19674. this.list.push(text);
  19675. }
  19676. }]);
  19677. return OutputTest;
  19678. }(_io_output__WEBPACK_IMPORTED_MODULE_0__["Output"]);
  19679. /***/ }),
  19680. /***/ "./js/visualUI/algorithm.js":
  19681. /*!**********************************!*\
  19682. !*** ./js/visualUI/algorithm.js ***!
  19683. \**********************************/
  19684. /*! exports provided: renderAlgorithm */
  19685. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  19686. "use strict";
  19687. __webpack_require__.r(__webpack_exports__);
  19688. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "renderAlgorithm", function() { return renderAlgorithm; });
  19689. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  19690. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_0__);
  19691. /* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./types */ "./js/visualUI/types.js");
  19692. /* harmony import */ var _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  19693. /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  19694. /* harmony import */ var _globals__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./globals */ "./js/visualUI/globals.js");
  19695. /* harmony import */ var _variables__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./variables */ "./js/visualUI/variables.js");
  19696. /* harmony import */ var _commands__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./commands */ "./js/visualUI/commands.js");
  19697. /* harmony import */ var _code_generator__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./code_generator */ "./js/visualUI/code_generator.js");
  19698. /* harmony import */ var _commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./commands/variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  19699. /* harmony import */ var _functions__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./functions */ "./js/visualUI/functions.js");
  19700. /* harmony import */ var _io_domConsole__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./../io/domConsole */ "./js/io/domConsole.js");
  19701. /* harmony import */ var _ast_ivprogParser__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./../ast/ivprogParser */ "./js/ast/ivprogParser.js");
  19702. /* harmony import */ var _processor_ivprogProcessor__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./../processor/ivprogProcessor */ "./js/processor/ivprogProcessor.js");
  19703. /* harmony import */ var _services_languageService__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ../services/languageService */ "./js/services/languageService.js");
  19704. window.block_render = false;
  19705. function renderAlgorithm() {
  19706. if (window.block_render) {
  19707. return;
  19708. }
  19709. if (window.draging) {
  19710. return;
  19711. }
  19712. window.block_render = true;
  19713. console.log('rendering algorithm');
  19714. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.all_functions').children().off();
  19715. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.all_functions').empty();
  19716. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.list_globals').children().off();
  19717. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.list_globals').empty();
  19718. for (var i = 0; i < window.program_obj.functions.length; i++) {
  19719. _functions__WEBPACK_IMPORTED_MODULE_9__["renderFunction"](window.program_obj.functions[i]);
  19720. }
  19721. for (var i = 0; i < window.program_obj.globals.length; i++) {
  19722. _globals__WEBPACK_IMPORTED_MODULE_4__["renderGlobal"](window.program_obj.globals[i]);
  19723. }
  19724. setTimeout(function () {
  19725. window.block_render = false;
  19726. }, 100);
  19727. console.log('fim do render');
  19728. }
  19729. /***/ }),
  19730. /***/ "./js/visualUI/code_generator.js":
  19731. /*!***************************************!*\
  19732. !*** ./js/visualUI/code_generator.js ***!
  19733. \***************************************/
  19734. /*! exports provided: generate */
  19735. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  19736. "use strict";
  19737. __webpack_require__.r(__webpack_exports__);
  19738. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "generate", function() { return generate; });
  19739. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  19740. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_0__);
  19741. /* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./types */ "./js/visualUI/types.js");
  19742. /* harmony import */ var _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  19743. /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  19744. /* harmony import */ var _globals__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./globals */ "./js/visualUI/globals.js");
  19745. /* harmony import */ var _variables__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./variables */ "./js/visualUI/variables.js");
  19746. /* harmony import */ var _commands__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./commands */ "./js/visualUI/commands.js");
  19747. /* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./utils */ "./js/visualUI/utils.js");
  19748. function generate() {
  19749. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.ivprog_visual_panel').find('.error_icon').remove();
  19750. var code = _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('program') + ' { ';
  19751. code += globalsCode();
  19752. code += '\n';
  19753. var has_error = false;
  19754. for (var i = 0; i < window.program_obj.functions.length; i++) {
  19755. var n_code = functionsCode(window.program_obj.functions[i]);
  19756. if (n_code == null) {
  19757. has_error = true;
  19758. }
  19759. code += n_code;
  19760. code += '\n';
  19761. }
  19762. code += '\n}';
  19763. if (has_error) {
  19764. return null;
  19765. } else {
  19766. return code;
  19767. }
  19768. }
  19769. function functionsCode(function_obj) {
  19770. var ret = '\n\t' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('function') + ' ';
  19771. var has_error = false;
  19772. switch (function_obj.return_type) {
  19773. case _types__WEBPACK_IMPORTED_MODULE_1__["Types"].INTEGER:
  19774. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('integer');
  19775. break;
  19776. case _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL:
  19777. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('real');
  19778. break;
  19779. case _types__WEBPACK_IMPORTED_MODULE_1__["Types"].TEXT:
  19780. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text');
  19781. break;
  19782. case _types__WEBPACK_IMPORTED_MODULE_1__["Types"].BOOLEAN:
  19783. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('boolean');
  19784. break;
  19785. case _types__WEBPACK_IMPORTED_MODULE_1__["Types"].VOID:
  19786. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('void');
  19787. break;
  19788. }
  19789. ret += ' ';
  19790. if (function_obj.return_dimensions == 1) {
  19791. ret += '[] ';
  19792. } else if (function_obj.return_dimensions == 2) {
  19793. ret += '[][] ';
  19794. }
  19795. ret += function_obj.name + ' ( ';
  19796. for (var j = 0; j < function_obj.parameters_list.length; j++) {
  19797. ret += parametersCode(function_obj.parameters_list[j]);
  19798. if (j + 1 < function_obj.parameters_list.length) {
  19799. ret += ',';
  19800. }
  19801. }
  19802. ret += ' ) {';
  19803. for (var j = 0; j < function_obj.variables_list.length; j++) {
  19804. ret += variablesCode(function_obj.variables_list[j]);
  19805. }
  19806. for (var j = 0; j < function_obj.commands.length; j++) {
  19807. try {
  19808. ret += commandsCode(function_obj.commands[j]);
  19809. } catch (err) {
  19810. has_error = true;
  19811. console.error(err.message);
  19812. var todos = jquery__WEBPACK_IMPORTED_MODULE_0___default()('body').find('.command_container');
  19813. for (var i = 0; i < todos.length; i++) {
  19814. if (jquery__WEBPACK_IMPORTED_MODULE_0___default()(todos[i]).data('command') == function_obj.commands[j]) {
  19815. jquery__WEBPACK_IMPORTED_MODULE_0___default()(todos[i]).prepend(' <i class="ui icon red exclamation triangle error_icon"></i> ');
  19816. break;
  19817. }
  19818. }
  19819. }
  19820. }
  19821. ret += '\n\t}';
  19822. if (has_error) {
  19823. return null;
  19824. } else {
  19825. return ret;
  19826. }
  19827. }
  19828. function commandsCode(command_obj) {
  19829. var indentation = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 2;
  19830. switch (command_obj.type) {
  19831. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].break:
  19832. return breaksCode(command_obj, indentation);
  19833. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].comment:
  19834. return commentsCode(command_obj, indentation);
  19835. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].reader:
  19836. return readersCode(command_obj, indentation);
  19837. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].writer:
  19838. return writersCode(command_obj, indentation);
  19839. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].functioncall:
  19840. return functioncallsCode(command_obj, indentation);
  19841. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].attribution:
  19842. return attributionsCode(command_obj, indentation);
  19843. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].whiletrue:
  19844. return whiletruesCode(command_obj, indentation);
  19845. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].dowhiletrue:
  19846. return doWhilesCode(command_obj, indentation);
  19847. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].iftrue:
  19848. return iftruesCode(command_obj, indentation);
  19849. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].repeatNtimes:
  19850. return repeatNtimesCode(command_obj, indentation);
  19851. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].switch:
  19852. return switchsCode(command_obj, indentation);
  19853. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].return:
  19854. return returnsCode(command_obj, indentation);
  19855. }
  19856. }
  19857. function returnsCode(command_obj, indentation) {
  19858. var ret = '\n';
  19859. for (var i = 0; i < indentation; i++) {
  19860. ret += '\t';
  19861. }
  19862. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_return');
  19863. if (command_obj.variable_value_menu) {
  19864. try {
  19865. ret += ' ' + variableValueMenuCode(command_obj.variable_value_menu, true);
  19866. } catch (err) {}
  19867. }
  19868. return ret;
  19869. }
  19870. function breaksCode(command_obj, indentation) {
  19871. var ret = '\n';
  19872. for (var i = 0; i < indentation; i++) {
  19873. ret += '\t';
  19874. }
  19875. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_break');
  19876. return ret;
  19877. }
  19878. function switchsCode(command_obj, indentation) {
  19879. var ret = '\n';
  19880. for (var i = 0; i < indentation; i++) {
  19881. ret += '\t';
  19882. }
  19883. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_code_switch') + ' ( ';
  19884. ret += variableValueMenuCode(command_obj.variable);
  19885. ret += ' ) { ';
  19886. if (command_obj.cases) {
  19887. for (var i = 0; i < command_obj.cases.length; i++) {
  19888. ret += switchcasesCode(command_obj.cases[i], indentation + 1);
  19889. }
  19890. }
  19891. ret += '\n';
  19892. for (var i = 0; i < indentation; i++) {
  19893. ret += '\t';
  19894. }
  19895. ret += '} ';
  19896. return ret;
  19897. }
  19898. function switchcasesCode(switchcase, indentation) {
  19899. var ret = '\n';
  19900. for (var i = 0; i < indentation; i++) {
  19901. ret += '\t';
  19902. }
  19903. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_code_case') + ' ';
  19904. ret += variableValueMenuCode(switchcase.variable_value_menu);
  19905. ret += ' :';
  19906. if (switchcase.commands_block) {
  19907. for (var i = 0; i < switchcase.commands_block.length; i++) {
  19908. ret += commandsCode(switchcase.commands_block[i], indentation + 1);
  19909. }
  19910. }
  19911. return ret;
  19912. }
  19913. function repeatNtimesCode(command_obj, indentation) {
  19914. var ret = '\n';
  19915. for (var i = 0; i < indentation; i++) {
  19916. ret += '\t';
  19917. }
  19918. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_for') + ' ( ';
  19919. if (command_obj.var_attribution) {
  19920. ret += variableValueMenuCode(command_obj.var_attribution);
  19921. ret += ' = ';
  19922. ret += variableValueMenuCode(command_obj.expression1);
  19923. }
  19924. ret += ' ; ';
  19925. if (command_obj.expression2) {
  19926. switch (command_obj.expression2.expression.type) {
  19927. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_logic:
  19928. ret += logicExpressionCode(command_obj.expression2.expression);
  19929. break;
  19930. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_arithmetic:
  19931. ret += arithmeticExpressionCode(command_obj.expression2.expression);
  19932. break;
  19933. }
  19934. }
  19935. ret += ' ; ';
  19936. if (command_obj.var_incrementation) {
  19937. ret += variableValueMenuCode(command_obj.var_incrementation);
  19938. ret += ' = ';
  19939. ret += variableValueMenuCode(command_obj.expression3.itens[0]);
  19940. switch (command_obj.expression3.itens[1]) {
  19941. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].plus:
  19942. ret += ' + ';
  19943. break;
  19944. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].minus:
  19945. ret += ' - ';
  19946. break;
  19947. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].multiplication:
  19948. ret += ' * ';
  19949. break;
  19950. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].division:
  19951. ret += ' / ';
  19952. break;
  19953. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].module:
  19954. ret += ' % ';
  19955. break;
  19956. }
  19957. ret += variableValueMenuCode(command_obj.expression3.itens[2]);
  19958. }
  19959. ret += ' ) { ';
  19960. if (command_obj.commands_block) {
  19961. for (var i = 0; i < command_obj.commands_block.length; i++) {
  19962. ret += commandsCode(command_obj.commands_block[i], indentation + 1);
  19963. }
  19964. }
  19965. ret += '\n';
  19966. for (var i = 0; i < indentation; i++) {
  19967. ret += '\t';
  19968. }
  19969. ret += '}';
  19970. return ret;
  19971. }
  19972. function iftruesCode(command_obj, indentation) {
  19973. var ret = '\n';
  19974. for (var i = 0; i < indentation; i++) {
  19975. ret += '\t';
  19976. }
  19977. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_if');
  19978. if (!command_obj.expression.expression) {
  19979. _utils__WEBPACK_IMPORTED_MODULE_7__["renderErrorMessage"](command_obj.expression.dom_object, _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('inform_valid_expression'));
  19980. }
  19981. switch (command_obj.expression.expression.type) {
  19982. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_logic:
  19983. ret += logicExpressionCode(command_obj.expression.expression);
  19984. break;
  19985. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_arithmetic:
  19986. ret += arithmeticExpressionCode(command_obj.expression.expression);
  19987. break;
  19988. }
  19989. ret += ' { ';
  19990. if (command_obj.commands_block) {
  19991. for (var i = 0; i < command_obj.commands_block.length; i++) {
  19992. ret += commandsCode(command_obj.commands_block[i], indentation + 1);
  19993. }
  19994. }
  19995. ret += '\n';
  19996. for (var i = 0; i < indentation; i++) {
  19997. ret += '\t';
  19998. }
  19999. ret += '} ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_else') + ' {';
  20000. if (command_obj.commands_else) {
  20001. for (var i = 0; i < command_obj.commands_else.length; i++) {
  20002. ret += commandsCode(command_obj.commands_else[i], indentation + 1);
  20003. }
  20004. }
  20005. ret += '\n';
  20006. for (var i = 0; i < indentation; i++) {
  20007. ret += '\t';
  20008. }
  20009. ret += '}';
  20010. return ret;
  20011. }
  20012. function doWhilesCode(command_obj, indentation) {
  20013. var ret = '\n';
  20014. for (var i = 0; i < indentation; i++) {
  20015. ret += '\t';
  20016. }
  20017. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_code_do') + ' { ';
  20018. if (command_obj.commands_block) {
  20019. for (var i = 0; i < command_obj.commands_block.length; i++) {
  20020. ret += commandsCode(command_obj.commands_block[i], indentation + 1);
  20021. }
  20022. }
  20023. ret += '\n';
  20024. for (var i = 0; i < indentation; i++) {
  20025. ret += '\t';
  20026. }
  20027. ret += '} ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_code_while');
  20028. if (!command_obj.expression.expression) {
  20029. _utils__WEBPACK_IMPORTED_MODULE_7__["renderErrorMessage"](command_obj.expression.dom_object, _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('inform_valid_expression'));
  20030. }
  20031. switch (command_obj.expression.expression.type) {
  20032. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_logic:
  20033. ret += logicExpressionCode(command_obj.expression.expression);
  20034. break;
  20035. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_arithmetic:
  20036. ret += arithmeticExpressionCode(command_obj.expression.expression);
  20037. break;
  20038. }
  20039. return ret;
  20040. }
  20041. function whiletruesCode(command_obj, indentation) {
  20042. var ret = '\n';
  20043. for (var i = 0; i < indentation; i++) {
  20044. ret += '\t';
  20045. }
  20046. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_code_while');
  20047. if (!command_obj.expression.expression) {
  20048. _utils__WEBPACK_IMPORTED_MODULE_7__["renderErrorMessage"](command_obj.expression.dom_object, _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('inform_valid_expression'));
  20049. }
  20050. switch (command_obj.expression.expression.type) {
  20051. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_logic:
  20052. ret += logicExpressionCode(command_obj.expression.expression);
  20053. break;
  20054. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_arithmetic:
  20055. ret += arithmeticExpressionCode(command_obj.expression.expression);
  20056. break;
  20057. }
  20058. ret += ' { ';
  20059. if (command_obj.commands_block) {
  20060. for (var i = 0; i < command_obj.commands_block.length; i++) {
  20061. ret += commandsCode(command_obj.commands_block[i], indentation + 1);
  20062. }
  20063. }
  20064. ret += '\n';
  20065. for (var i = 0; i < indentation; i++) {
  20066. ret += '\t';
  20067. }
  20068. ret += '}';
  20069. return ret;
  20070. }
  20071. function logicExpressionCode(expression) {
  20072. var ret = ' ( ';
  20073. if (expression.first_operand.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_logic) {
  20074. ret += logicExpressionCode(expression.first_operand);
  20075. } else if (expression.first_operand.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_arithmetic) {
  20076. ret += arithmeticExpressionCode(expression.first_operand);
  20077. } else {
  20078. ret += variableValueMenuCode(expression.first_operand);
  20079. }
  20080. if (expression.operator) {
  20081. switch (expression.operator) {
  20082. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["LOGIC_COMPARISON"].equals_to:
  20083. ret += ' == ';
  20084. break;
  20085. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["LOGIC_COMPARISON"].not_equals_to:
  20086. ret += ' != ';
  20087. break;
  20088. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["LOGIC_COMPARISON"].and:
  20089. ret += ' && ';
  20090. break;
  20091. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["LOGIC_COMPARISON"].or:
  20092. ret += ' || ';
  20093. break;
  20094. }
  20095. if (expression.second_operand.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_logic) {
  20096. ret += logicExpressionCode(expression.second_operand);
  20097. } else if (expression.second_operand.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_arithmetic) {
  20098. ret += arithmeticExpressionCode(expression.second_operand);
  20099. } else {
  20100. ret += variableValueMenuCode(expression.second_operand);
  20101. }
  20102. }
  20103. ret += ' ) ';
  20104. return ret;
  20105. }
  20106. function arithmeticExpressionCode(expression) {
  20107. var ret = ' ( ';
  20108. if (expression.first_operand.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_logic) {
  20109. ret += logicExpressionCode(expression.first_operand);
  20110. } else if (expression.first_operand.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_arithmetic) {
  20111. ret += arithmeticExpressionCode(expression.first_operand);
  20112. } else {
  20113. ret += variableValueMenuCode(expression.first_operand);
  20114. }
  20115. switch (expression.operator) {
  20116. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_COMPARISON"].greater_than:
  20117. ret += ' > ';
  20118. break;
  20119. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_COMPARISON"].less_than:
  20120. ret += ' < ';
  20121. break;
  20122. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_COMPARISON"].equals_to:
  20123. ret += ' == ';
  20124. break;
  20125. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_COMPARISON"].not_equals_to:
  20126. ret += ' != ';
  20127. break;
  20128. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_COMPARISON"].greater_than_or_equals_to:
  20129. ret += ' >= ';
  20130. break;
  20131. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_COMPARISON"].less_than_or_equals_to:
  20132. ret += ' <= ';
  20133. break;
  20134. }
  20135. if (expression.second_operand.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_logic) {
  20136. ret += logicExpressionCode(expression.second_operand);
  20137. } else if (expression.second_operand.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_arithmetic) {
  20138. ret += arithmeticExpressionCode(expression.second_operand);
  20139. } else {
  20140. ret += variableValueMenuCode(expression.second_operand);
  20141. }
  20142. ret += ' ) ';
  20143. return ret;
  20144. }
  20145. function attributionsCode(command_obj, indentation) {
  20146. var ret = '\n';
  20147. for (var i = 0; i < indentation; i++) {
  20148. ret += '\t';
  20149. }
  20150. ret += variableValueMenuCode(command_obj.variable) + ' = ';
  20151. for (var i = 0; i < command_obj.expression.length; i++) {
  20152. ret += elementExpressionCode(command_obj.expression[i]);
  20153. }
  20154. return ret;
  20155. }
  20156. function elementExpressionCode(expression_obj) {
  20157. var ret = '';
  20158. for (var i = 0; i < expression_obj.itens.length; i++) {
  20159. if (expression_obj.itens[i].type) {
  20160. ret += variableValueMenuCode(expression_obj.itens[i]);
  20161. } else if (expression_obj.itens[i].type_exp) {
  20162. if (expression_obj.itens[i].type_exp == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_ELEMENTS"].par_exp_par) {
  20163. ret += ' ( ';
  20164. }
  20165. ret += elementExpressionCode(expression_obj.itens[i]);
  20166. if (expression_obj.itens[i].type_exp == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_ELEMENTS"].par_exp_par) {
  20167. ret += ' ) ';
  20168. }
  20169. } else {
  20170. switch (expression_obj.itens[i]) {
  20171. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].plus:
  20172. ret += ' + ';
  20173. break;
  20174. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].minus:
  20175. ret += ' - ';
  20176. break;
  20177. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].multiplication:
  20178. ret += ' * ';
  20179. break;
  20180. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].division:
  20181. ret += ' / ';
  20182. break;
  20183. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].module:
  20184. ret += ' % ';
  20185. break;
  20186. }
  20187. }
  20188. }
  20189. return ret;
  20190. }
  20191. function functioncallsCode(command_obj, indentation) {
  20192. var ret = '\n';
  20193. for (var i = 0; i < indentation; i++) {
  20194. ret += '\t';
  20195. }
  20196. ret += variableValueMenuCode(command_obj.function_called);
  20197. return ret;
  20198. }
  20199. function readersCode(command_obj, indentation) {
  20200. var ret = '\n';
  20201. for (var i = 0; i < indentation; i++) {
  20202. ret += '\t';
  20203. }
  20204. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_command_read') + ' ( ';
  20205. ret += variableValueMenuCode(command_obj.variable_value_menu);
  20206. ret += ' ) ';
  20207. return ret;
  20208. }
  20209. function variableValueMenuCode(variable_obj) {
  20210. var is_return = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  20211. var ret = '';
  20212. try {
  20213. if (variable_obj.function_called) {
  20214. if (variable_obj.function_called.name) {
  20215. ret += variable_obj.function_called.name + ' ( ';
  20216. } else {
  20217. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI(variable_obj.function_called.category) + '.' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI(variable_obj.function_called.identifier) + ' ( ';
  20218. }
  20219. if (variable_obj.parameters_list) {
  20220. for (var i = 0; i < variable_obj.parameters_list.length; i++) {
  20221. ret += variableValueMenuCode(variable_obj.parameters_list[i]);
  20222. if (i + 1 < variable_obj.parameters_list.length) {
  20223. ret += ', ';
  20224. }
  20225. }
  20226. }
  20227. ret += ' )';
  20228. } else if (variable_obj.content.type) {
  20229. ret += variable_obj.content.name;
  20230. if (variable_obj.content.dimensions == 1 && variable_obj.dimensions != 1) {
  20231. ret += ' [ ' + variableValueMenuCode(variable_obj.column) + ' ] ';
  20232. }
  20233. if (variable_obj.content.dimensions == 2 && variable_obj.dimensions != 2) {
  20234. ret += ' [ ' + variableValueMenuCode(variable_obj.row) + ' ] ';
  20235. ret += ' [ ' + variableValueMenuCode(variable_obj.column) + ' ] ';
  20236. }
  20237. } else {
  20238. if (isNaN(variable_obj.content)) {
  20239. ret += '"' + variable_obj.content + '"';
  20240. } else {
  20241. ret += variable_obj.content;
  20242. }
  20243. }
  20244. } catch (err) {
  20245. if (!is_return) {
  20246. _utils__WEBPACK_IMPORTED_MODULE_7__["renderErrorMessage"](variable_obj.dom_object, _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('inform_valid_content'));
  20247. throw err;
  20248. }
  20249. }
  20250. return ret;
  20251. }
  20252. function writersCode(command_obj, indentation) {
  20253. var ret = '\n';
  20254. for (var i = 0; i < indentation; i++) {
  20255. ret += '\t';
  20256. }
  20257. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_command_write') + ' ( ';
  20258. for (var i = 0; i < command_obj.content.length; i++) {
  20259. ret += variableValueMenuCode(command_obj.content[i]);
  20260. if (i + 1 < command_obj.content.length) {
  20261. ret += ' + ';
  20262. }
  20263. }
  20264. ret += ' ) ';
  20265. return ret;
  20266. }
  20267. function commentsCode(command_obj, indentation) {
  20268. var ret = '\n';
  20269. for (var i = 0; i < indentation; i++) {
  20270. ret += '\t';
  20271. }
  20272. ret += '// ';
  20273. ret += command_obj.comment_text.content;
  20274. return ret;
  20275. }
  20276. function parametersCode(parameter_obj) {
  20277. var ret = '';
  20278. switch (parameter_obj.type) {
  20279. case _types__WEBPACK_IMPORTED_MODULE_1__["Types"].INTEGER:
  20280. ret += ' ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('integer') + ' ';
  20281. break;
  20282. case _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL:
  20283. ret += ' ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('real') + ' ';
  20284. break;
  20285. case _types__WEBPACK_IMPORTED_MODULE_1__["Types"].TEXT:
  20286. ret += ' ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text') + ' ';
  20287. break;
  20288. case _types__WEBPACK_IMPORTED_MODULE_1__["Types"].BOOLEAN:
  20289. ret += ' ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('boolean') + ' ';
  20290. break;
  20291. }
  20292. ret += parameter_obj.name + '';
  20293. if (parameter_obj.dimensions == 1) {
  20294. ret += ' []';
  20295. } else if (parameter_obj.dimensions == 2) {
  20296. ret += ' [][]';
  20297. }
  20298. return ret;
  20299. }
  20300. function variablesCode(variable_obj) {
  20301. var ret = '';
  20302. var temp = variable_obj;
  20303. ret += '\n\t\t';
  20304. if (temp.is_constant) {
  20305. ret += 'const ';
  20306. }
  20307. switch (temp.type) {
  20308. case _types__WEBPACK_IMPORTED_MODULE_1__["Types"].INTEGER:
  20309. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('integer') + ' ';
  20310. break;
  20311. case _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL:
  20312. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('real') + ' ';
  20313. break;
  20314. case _types__WEBPACK_IMPORTED_MODULE_1__["Types"].TEXT:
  20315. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text') + ' ';
  20316. break;
  20317. case _types__WEBPACK_IMPORTED_MODULE_1__["Types"].BOOLEAN:
  20318. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('boolean') + ' ';
  20319. break;
  20320. }
  20321. ret += temp.name + ' ';
  20322. if (temp.dimensions == 1) {
  20323. ret += '[' + temp.columns + '] ';
  20324. switch (temp.type) {
  20325. case _types__WEBPACK_IMPORTED_MODULE_1__["Types"].INTEGER:
  20326. ret += '= {' + temp.value + '}';
  20327. break;
  20328. case _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL:
  20329. ret += '= {' + temp.value.toFixed(2) + '}';
  20330. break;
  20331. case _types__WEBPACK_IMPORTED_MODULE_1__["Types"].TEXT:
  20332. ret += '= {';
  20333. for (var j = 0; j < temp.value.length; j++) {
  20334. ret += '"' + temp.value[j] + '"';
  20335. if (j + 1 < temp.value.length) {
  20336. ret += ',';
  20337. }
  20338. }
  20339. ret += '}';
  20340. break;
  20341. case _types__WEBPACK_IMPORTED_MODULE_1__["Types"].BOOLEAN:
  20342. ret += '= {';
  20343. for (var j = 0; j < temp.value.length; j++) {
  20344. if (temp.value[j]) {
  20345. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI("true");
  20346. } else {
  20347. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI("false");
  20348. }
  20349. if (j + 1 < temp.value.length) {
  20350. ret += ',';
  20351. }
  20352. }
  20353. ret += '}';
  20354. break;
  20355. }
  20356. } else if (temp.dimensions == 2) {
  20357. ret += '[' + temp.rows + '][' + temp.columns + '] ';
  20358. switch (temp.type) {
  20359. case _types__WEBPACK_IMPORTED_MODULE_1__["Types"].INTEGER:
  20360. ret += '= {';
  20361. for (var j = 0; j < temp.rows; j++) {
  20362. ret += '{' + temp.value[j] + '}';
  20363. if (j + 1 < temp.rows) {
  20364. ret += ',';
  20365. }
  20366. }
  20367. ret += '}';
  20368. break;
  20369. case _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL:
  20370. ret += '= {';
  20371. for (var j = 0; j < temp.rows; j++) {
  20372. ret += '{' + temp.value[j].toFixed(2) + '}';
  20373. if (j + 1 < temp.rows) {
  20374. ret += ',';
  20375. }
  20376. }
  20377. ret += '}';
  20378. break;
  20379. case _types__WEBPACK_IMPORTED_MODULE_1__["Types"].TEXT:
  20380. ret += '= {';
  20381. for (var j = 0; j < temp.rows; j++) {
  20382. ret += '{';
  20383. for (var k = 0; k < temp.columns; k++) {
  20384. ret += '"' + temp.value[j][k] + '"';
  20385. if (k + 1 < temp.columns) {
  20386. ret += ',';
  20387. }
  20388. }
  20389. ret += '}';
  20390. if (j + 1 < temp.rows) {
  20391. ret += ',';
  20392. }
  20393. }
  20394. ret += '}';
  20395. break;
  20396. case _types__WEBPACK_IMPORTED_MODULE_1__["Types"].BOOLEAN:
  20397. ret += '= {';
  20398. for (var j = 0; j < temp.rows; j++) {
  20399. ret += '{';
  20400. for (var k = 0; k < temp.columns; k++) {
  20401. if (temp.value[j][k]) {
  20402. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI("true");
  20403. } else {
  20404. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI("false");
  20405. }
  20406. if (k + 1 < temp.columns) {
  20407. ret += ',';
  20408. }
  20409. }
  20410. ret += '}';
  20411. if (j + 1 < temp.rows) {
  20412. ret += ',';
  20413. }
  20414. }
  20415. ret += '}';
  20416. break;
  20417. }
  20418. } else {
  20419. switch (temp.type) {
  20420. case _types__WEBPACK_IMPORTED_MODULE_1__["Types"].INTEGER:
  20421. ret += '= ' + temp.value;
  20422. break;
  20423. case _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL:
  20424. ret += '= ' + temp.value.toFixed(2);
  20425. break;
  20426. case _types__WEBPACK_IMPORTED_MODULE_1__["Types"].TEXT:
  20427. ret += '= "' + temp.value + '"';
  20428. break;
  20429. case _types__WEBPACK_IMPORTED_MODULE_1__["Types"].BOOLEAN:
  20430. ret += '= ';
  20431. if (temp.value) {
  20432. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI("true");
  20433. } else {
  20434. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI("false");
  20435. }
  20436. break;
  20437. }
  20438. }
  20439. return ret;
  20440. }
  20441. function globalsCode() {
  20442. var ret = '';
  20443. if (window.program_obj.globals) {
  20444. for (var i = 0; i < window.program_obj.globals.length; i++) {
  20445. var temp = window.program_obj.globals[i];
  20446. ret += '\n\t';
  20447. if (temp.is_constant) {
  20448. ret += 'const ';
  20449. }
  20450. switch (temp.type) {
  20451. case _types__WEBPACK_IMPORTED_MODULE_1__["Types"].INTEGER:
  20452. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('integer');
  20453. break;
  20454. case _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL:
  20455. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('real');
  20456. break;
  20457. case _types__WEBPACK_IMPORTED_MODULE_1__["Types"].TEXT:
  20458. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text');
  20459. break;
  20460. case _types__WEBPACK_IMPORTED_MODULE_1__["Types"].BOOLEAN:
  20461. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('boolean');
  20462. break;
  20463. }
  20464. ret += ' ' + temp.name + ' ';
  20465. if (temp.dimensions == 1) {
  20466. ret += '[' + temp.columns + '] ';
  20467. switch (temp.type) {
  20468. case _types__WEBPACK_IMPORTED_MODULE_1__["Types"].INTEGER:
  20469. ret += '= {' + temp.value + '}';
  20470. break;
  20471. case _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL:
  20472. ret += '= {';
  20473. for (var j = 0; j < temp.value.length; j++) {
  20474. ret += temp.value[j].toFixed(2);
  20475. if (j + 1 < temp.value.length) {
  20476. ret += ',';
  20477. }
  20478. }
  20479. ret += '}';
  20480. break;
  20481. case _types__WEBPACK_IMPORTED_MODULE_1__["Types"].TEXT:
  20482. ret += '= {';
  20483. for (var j = 0; j < temp.value.length; j++) {
  20484. ret += '"' + temp.value[j] + '"';
  20485. if (j + 1 < temp.value.length) {
  20486. ret += ',';
  20487. }
  20488. }
  20489. ret += '}';
  20490. break;
  20491. case _types__WEBPACK_IMPORTED_MODULE_1__["Types"].BOOLEAN:
  20492. ret += '= {';
  20493. for (var j = 0; j < temp.value.length; j++) {
  20494. if (temp.value[j]) {
  20495. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI("true");
  20496. } else {
  20497. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI("false");
  20498. }
  20499. if (j + 1 < temp.value.length) {
  20500. ret += ',';
  20501. }
  20502. }
  20503. ret += '}';
  20504. break;
  20505. }
  20506. } else if (temp.dimensions == 2) {
  20507. ret += '[' + temp.rows + '][' + temp.columns + '] ';
  20508. switch (temp.type) {
  20509. case _types__WEBPACK_IMPORTED_MODULE_1__["Types"].INTEGER:
  20510. ret += '= {';
  20511. for (var j = 0; j < temp.rows; j++) {
  20512. ret += '{' + temp.value[j] + '}';
  20513. if (j + 1 < temp.rows) {
  20514. ret += ',';
  20515. }
  20516. }
  20517. ret += '}';
  20518. break;
  20519. case _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL:
  20520. ret += '= {';
  20521. for (var j = 0; j < temp.rows; j++) {
  20522. ret += '{';
  20523. for (var k = 0; k < temp.columns; k++) {
  20524. ret += temp.value[j][k].toFixed(2);
  20525. if (k + 1 < temp.columns) {
  20526. ret += ',';
  20527. }
  20528. }
  20529. ret += '}';
  20530. if (j + 1 < temp.rows) {
  20531. ret += ',';
  20532. }
  20533. }
  20534. ret += '}';
  20535. break;
  20536. case _types__WEBPACK_IMPORTED_MODULE_1__["Types"].TEXT:
  20537. ret += '= {';
  20538. for (var j = 0; j < temp.rows; j++) {
  20539. ret += '{';
  20540. for (var k = 0; k < temp.columns; k++) {
  20541. ret += '"' + temp.value[j][k] + '"';
  20542. if (k + 1 < temp.columns) {
  20543. ret += ',';
  20544. }
  20545. }
  20546. ret += '}';
  20547. if (j + 1 < temp.rows) {
  20548. ret += ',';
  20549. }
  20550. }
  20551. ret += '}';
  20552. break;
  20553. case _types__WEBPACK_IMPORTED_MODULE_1__["Types"].BOOLEAN:
  20554. ret += '= {';
  20555. for (var j = 0; j < temp.rows; j++) {
  20556. ret += '{';
  20557. for (var k = 0; k < temp.columns; k++) {
  20558. if (temp.value[j][k]) {
  20559. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI("true");
  20560. } else {
  20561. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI("false");
  20562. }
  20563. if (k + 1 < temp.columns) {
  20564. ret += ',';
  20565. }
  20566. }
  20567. ret += '}';
  20568. if (j + 1 < temp.rows) {
  20569. ret += ',';
  20570. }
  20571. }
  20572. ret += '}';
  20573. break;
  20574. }
  20575. } else {
  20576. switch (temp.type) {
  20577. case _types__WEBPACK_IMPORTED_MODULE_1__["Types"].INTEGER:
  20578. ret += '= ' + temp.value;
  20579. break;
  20580. case _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL:
  20581. ret += '= ' + temp.value.toFixed(2);
  20582. break;
  20583. case _types__WEBPACK_IMPORTED_MODULE_1__["Types"].TEXT:
  20584. ret += '= "' + temp.value + '"';
  20585. break;
  20586. case _types__WEBPACK_IMPORTED_MODULE_1__["Types"].BOOLEAN:
  20587. ret += '= ';
  20588. if (temp.value) {
  20589. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI("true");
  20590. ;
  20591. } else {
  20592. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI("false");
  20593. ;
  20594. }
  20595. break;
  20596. }
  20597. }
  20598. }
  20599. }
  20600. return ret;
  20601. }
  20602. /***/ }),
  20603. /***/ "./js/visualUI/commands.js":
  20604. /*!*********************************!*\
  20605. !*** ./js/visualUI/commands.js ***!
  20606. \*********************************/
  20607. /*! exports provided: removeCommand, createFloatingCommand, renderCommand, genericCreateCommand */
  20608. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  20609. "use strict";
  20610. __webpack_require__.r(__webpack_exports__);
  20611. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "removeCommand", function() { return removeCommand; });
  20612. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createFloatingCommand", function() { return createFloatingCommand; });
  20613. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "renderCommand", function() { return renderCommand; });
  20614. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "genericCreateCommand", function() { return genericCreateCommand; });
  20615. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  20616. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_0__);
  20617. /* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./types */ "./js/visualUI/types.js");
  20618. /* harmony import */ var _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  20619. /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  20620. /* harmony import */ var _globals__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./globals */ "./js/visualUI/globals.js");
  20621. /* harmony import */ var _variables__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./variables */ "./js/visualUI/variables.js");
  20622. /* harmony import */ var _commands_comment__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./commands/comment */ "./js/visualUI/commands/comment.js");
  20623. /* harmony import */ var _commands_reader__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./commands/reader */ "./js/visualUI/commands/reader.js");
  20624. /* harmony import */ var _commands_writer__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./commands/writer */ "./js/visualUI/commands/writer.js");
  20625. /* harmony import */ var _commands_attribution__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./commands/attribution */ "./js/visualUI/commands/attribution.js");
  20626. /* harmony import */ var _commands_iftrue__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./commands/iftrue */ "./js/visualUI/commands/iftrue.js");
  20627. /* harmony import */ var _commands_repeatNtimes__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./commands/repeatNtimes */ "./js/visualUI/commands/repeatNtimes.js");
  20628. /* harmony import */ var _commands_whiletrue__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./commands/whiletrue */ "./js/visualUI/commands/whiletrue.js");
  20629. /* harmony import */ var _commands_dowhiletrue__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./commands/dowhiletrue */ "./js/visualUI/commands/dowhiletrue.js");
  20630. /* harmony import */ var _commands_switch__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./commands/switch */ "./js/visualUI/commands/switch.js");
  20631. /* harmony import */ var _commands_functioncall__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./commands/functioncall */ "./js/visualUI/commands/functioncall.js");
  20632. /* harmony import */ var _commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./commands/variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  20633. /* harmony import */ var _commands_break__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ./commands/break */ "./js/visualUI/commands/break.js");
  20634. /* harmony import */ var _commands_return__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ./commands/return */ "./js/visualUI/commands/return.js");
  20635. var has_element_created_draged = false;
  20636. var which_element_is_draged = null;
  20637. function removeCommand(command, function_obj, dom_obj) {
  20638. if (function_obj.commands.indexOf(command) > -1) {
  20639. function_obj.commands.splice(function_obj.commands.indexOf(command), 1);
  20640. return true;
  20641. } // Utilize dois parantNode, pois o primeiro é o div de comandos
  20642. try {
  20643. if (dom_obj.parent().parent().data('command').commands_block.indexOf(command) > -1) {
  20644. dom_obj.parent().parent().data('command').commands_block.splice(dom_obj.parent().parent().data('command').commands_block.indexOf(command), 1);
  20645. return true;
  20646. }
  20647. } catch (err) {}
  20648. try {
  20649. if (dom_obj.parent().parent().data('command').type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].iftrue) {
  20650. if (dom_obj.parent().parent().data('command').commands_else.indexOf(command) > -1) {
  20651. dom_obj.parent().parent().data('command').commands_else.splice(dom_obj.parent().parent().data('command').commands_else.indexOf(command), 1);
  20652. return true;
  20653. }
  20654. }
  20655. } catch (err) {}
  20656. if (dom_obj.parent().data('switchcase')) {
  20657. console.log("o que encontrei: ");
  20658. console.log(dom_obj.parent().data('switchcase'));
  20659. dom_obj.parent().data('switchcase').commands_block.splice(dom_obj.parent().data('switchcase').commands_block.indexOf(command), 1);
  20660. return true;
  20661. }
  20662. return false;
  20663. }
  20664. window.function_container_active = null;
  20665. function createFloatingCommand(function_obj, function_container, command_type, mouse_event) {
  20666. var floatingObject;
  20667. switch (command_type) {
  20668. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].break:
  20669. floatingObject = _commands_break__WEBPACK_IMPORTED_MODULE_17__["createFloatingCommand"]();
  20670. break;
  20671. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].comment:
  20672. floatingObject = _commands_comment__WEBPACK_IMPORTED_MODULE_6__["createFloatingCommand"]();
  20673. break;
  20674. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].reader:
  20675. floatingObject = _commands_reader__WEBPACK_IMPORTED_MODULE_7__["createFloatingCommand"]();
  20676. break;
  20677. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].writer:
  20678. floatingObject = _commands_writer__WEBPACK_IMPORTED_MODULE_8__["createFloatingCommand"]();
  20679. break;
  20680. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].attribution:
  20681. floatingObject = _commands_attribution__WEBPACK_IMPORTED_MODULE_9__["createFloatingCommand"]();
  20682. break;
  20683. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].iftrue:
  20684. floatingObject = _commands_iftrue__WEBPACK_IMPORTED_MODULE_10__["createFloatingCommand"]();
  20685. break;
  20686. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].repeatNtimes:
  20687. floatingObject = _commands_repeatNtimes__WEBPACK_IMPORTED_MODULE_11__["createFloatingCommand"]();
  20688. break;
  20689. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].whiletrue:
  20690. floatingObject = _commands_whiletrue__WEBPACK_IMPORTED_MODULE_12__["createFloatingCommand"]();
  20691. break;
  20692. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].dowhiletrue:
  20693. floatingObject = _commands_dowhiletrue__WEBPACK_IMPORTED_MODULE_13__["createFloatingCommand"]();
  20694. break;
  20695. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].switch:
  20696. floatingObject = _commands_switch__WEBPACK_IMPORTED_MODULE_14__["createFloatingCommand"]();
  20697. break;
  20698. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].functioncall:
  20699. floatingObject = _commands_functioncall__WEBPACK_IMPORTED_MODULE_15__["createFloatingCommand"]();
  20700. break;
  20701. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].return:
  20702. floatingObject = _commands_return__WEBPACK_IMPORTED_MODULE_18__["createFloatingCommand"]();
  20703. break;
  20704. }
  20705. floatingObject.draggable().appendTo("body");
  20706. jquery__WEBPACK_IMPORTED_MODULE_0___default()('body').mouseup(function (evt) {
  20707. manageCommand(function_obj, function_container, evt, command_type);
  20708. jquery__WEBPACK_IMPORTED_MODULE_0___default()('body').off('mouseup');
  20709. jquery__WEBPACK_IMPORTED_MODULE_0___default()('body').off('mouseover');
  20710. });
  20711. if (!function_container.hasClass('function_div') || function_container.length < 1) {
  20712. window.mouse_event = mouse_event;
  20713. function_container = jquery__WEBPACK_IMPORTED_MODULE_0___default()(mouse_event.originalEvent.srcElement.closest('.function_div'));
  20714. }
  20715. console.log('function_container', function_container);
  20716. function_container_active = function_container;
  20717. function_container.find('.commands_list_div').on('mousemove', function (evt) {
  20718. addGhostDiv(evt);
  20719. });
  20720. function_container.find('.commands_list_div').find("*").on('mousemove', function (evt) {
  20721. addGhostDiv(evt);
  20722. });
  20723. function_container.on('mouseout', function (event) {
  20724. var el = jquery__WEBPACK_IMPORTED_MODULE_0___default()(document.elementFromPoint(event.clientX, event.clientY));
  20725. if (el.closest('.commands_list_div').length < 1) {
  20726. window.ghostDiv.remove();
  20727. }
  20728. });
  20729. floatingObject.css("position", "absolute");
  20730. mouse_event.type = "mousedown.draggable";
  20731. mouse_event.target = floatingObject[0];
  20732. floatingObject.css("left", mouse_event.pageX - window.divx);
  20733. floatingObject.css("top", mouse_event.pageY);
  20734. floatingObject.trigger(mouse_event);
  20735. }
  20736. window.divx = 100;
  20737. window.ghostDiv = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="ghost_div">');
  20738. window.active_container = null;
  20739. function addGhostToEmptyBlock(element, evt) {
  20740. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.ghost_div').remove();
  20741. var container = element.closest('.command_container');
  20742. if (container.hasClass('switch')) {
  20743. container = jquery__WEBPACK_IMPORTED_MODULE_0___default()(evt.target).closest('.case_div');
  20744. }
  20745. if (!container.hasClass('dowhiletrue') && !container.hasClass('iftrue') && !container.hasClass('repeatNtimes') && !container.hasClass('case_div') && !container.hasClass('whiletrue')) {
  20746. addGhostToNotEmptyBlock(element, evt);
  20747. return;
  20748. }
  20749. if (window.active_container != null) {
  20750. if (window.active_container.is(container)) {
  20751. console.log('é o mesmo, não mudou!');
  20752. } else {
  20753. if (container.length < 1) {
  20754. container = element.closest('.commands_list_div');
  20755. if (window.active_container.is(container)) {
  20756. console.log('é o mesmo command list');
  20757. } else {
  20758. console.log('mudou para um command list');
  20759. window.active_container = container;
  20760. }
  20761. } else {
  20762. console.log('mudou para um outro container?');
  20763. }
  20764. }
  20765. }
  20766. window.active_container = container;
  20767. if (container.hasClass('iftrue')) {
  20768. var containerIf = container.find('.commands_if').get(0);
  20769. var containerElse = container.find('.commands_else').get(0);
  20770. var topIfDistance = Math.abs(evt.clientY - containerIf.getBoundingClientRect().top);
  20771. var bottomIfDistance = Math.abs(containerIf.getBoundingClientRect().top + containerIf.getBoundingClientRect().height - evt.clientY);
  20772. var topElseDistance = Math.abs(evt.clientY - containerElse.getBoundingClientRect().top);
  20773. var bottomElseDistance = Math.abs(containerElse.getBoundingClientRect().top + containerElse.getBoundingClientRect().height - evt.clientY);
  20774. if (topIfDistance < topElseDistance && topIfDistance < bottomElseDistance) {
  20775. jquery__WEBPACK_IMPORTED_MODULE_0___default()(containerIf).append(window.ghostDiv);
  20776. } else {
  20777. jquery__WEBPACK_IMPORTED_MODULE_0___default()(containerElse).append(window.ghostDiv);
  20778. }
  20779. } else if (container.hasClass('case_div')) {
  20780. container.find('.case_commands_block').append(window.ghostDiv);
  20781. } else {
  20782. container.find('.block_commands').append(window.ghostDiv);
  20783. }
  20784. }
  20785. function addGhostToNotEmptyBlock(element, evt) {
  20786. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.ghost_div').remove();
  20787. var container = element.closest('.dowhiletrue, .iftrue, .repeatNtimes, .case_div, .whiletrue'); //console.log("\n\nNOT EMPTY: ", container);
  20788. //if (window.active_container != null) {
  20789. //}
  20790. if (container.length < 1) {
  20791. container = element.closest('.commands_list_div');
  20792. window.active_container = container;
  20793. addGhostToFunctionArea(element, evt);
  20794. } else {//console.log('mudou para um outro container?');
  20795. }
  20796. window.active_container = container; // quem está mais próximo? // Essa regra se aplica somente quando o over está sobre um comando
  20797. var allfilhos;
  20798. console.log('olha o container: ', container);
  20799. if (container.hasClass('iftrue')) {
  20800. if (jquery__WEBPACK_IMPORTED_MODULE_0___default()(evt.target).closest('.data_block_if').length > 0) {
  20801. allfilhos = container.find('.commands_if').children('.command_container');
  20802. } else if (jquery__WEBPACK_IMPORTED_MODULE_0___default()(evt.target).closest('.data_block_else').length > 0) {
  20803. allfilhos = container.find('.commands_else').children('.command_container');
  20804. } else {
  20805. var containerIf = container.find('.commands_if').get(0);
  20806. var containerElse = container.find('.commands_else').get(0);
  20807. var topIfDistance = Math.abs(evt.clientY - containerIf.getBoundingClientRect().top);
  20808. var bottomIfDistance = Math.abs(containerIf.getBoundingClientRect().top + containerIf.getBoundingClientRect().height - evt.clientY);
  20809. var topElseDistance = Math.abs(evt.clientY - containerElse.getBoundingClientRect().top);
  20810. var bottomElseDistance = Math.abs(containerElse.getBoundingClientRect().top + containerElse.getBoundingClientRect().height - evt.clientY);
  20811. if (topIfDistance < topElseDistance && topIfDistance < bottomElseDistance) {
  20812. allfilhos = jquery__WEBPACK_IMPORTED_MODULE_0___default()(containerIf).children('.command_container');
  20813. } else {
  20814. allfilhos = jquery__WEBPACK_IMPORTED_MODULE_0___default()(containerElse).children('.command_container');
  20815. }
  20816. }
  20817. } else if (container.hasClass('case_div')) {
  20818. allfilhos = container.children('.case_commands_block').children('.command_container');
  20819. } else if (container.hasClass('commands_list_div')) {
  20820. allfilhos = container.children('.command_container');
  20821. } else {
  20822. allfilhos = container.children('.block_commands').children('.command_container');
  20823. }
  20824. var topDistances = [];
  20825. var bottomDistances = [];
  20826. for (var i = 0; i < allfilhos.length; i++) {
  20827. var topD = Math.abs(evt.clientY - allfilhos.get(i).getBoundingClientRect().top);
  20828. topDistances.push(topD);
  20829. var botD = Math.abs(allfilhos.get(i).getBoundingClientRect().top + allfilhos.get(i).getBoundingClientRect().height - evt.clientY);
  20830. bottomDistances.push(botD);
  20831. }
  20832. console.log('topDistances\n', topDistances, '\nbottomDistances\n', bottomDistances);
  20833. var menorTop = Math.min.apply(null, topDistances);
  20834. var indiceTop = topDistances.indexOf(menorTop);
  20835. var menorBot = Math.min.apply(null, bottomDistances);
  20836. var indiceBot = bottomDistances.indexOf(menorBot);
  20837. if (menorTop < menorBot) {
  20838. window.ghostDiv.insertBefore(jquery__WEBPACK_IMPORTED_MODULE_0___default()(allfilhos.get(indiceTop)));
  20839. } else {
  20840. window.ghostDiv.insertAfter(jquery__WEBPACK_IMPORTED_MODULE_0___default()(allfilhos.get(indiceBot)));
  20841. }
  20842. console.log('distancias: menorTop ', menorTop, ' menorBot ', menorBot);
  20843. }
  20844. function addGhostToFunctionArea(undermouse, evt) {
  20845. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.ghost_div').remove();
  20846. var allfilhos = undermouse.closest('.commands_list_div').children('.command_container');
  20847. var topDistances = [];
  20848. var bottomDistances = [];
  20849. for (var i = 0; i < allfilhos.length; i++) {
  20850. var topD = Math.abs(evt.clientY - allfilhos.get(i).getBoundingClientRect().top);
  20851. topDistances.push(topD);
  20852. var botD = Math.abs(allfilhos.get(i).getBoundingClientRect().top + allfilhos.get(i).getBoundingClientRect().height - evt.clientY);
  20853. bottomDistances.push(botD);
  20854. }
  20855. var menorTop = Math.min.apply(null, topDistances);
  20856. var indiceTop = topDistances.indexOf(menorTop);
  20857. var menorBot = Math.min.apply(null, bottomDistances);
  20858. var indiceBot = bottomDistances.indexOf(menorBot);
  20859. if (menorTop < menorBot) {
  20860. window.ghostDiv.insertBefore(jquery__WEBPACK_IMPORTED_MODULE_0___default()(allfilhos.get(indiceTop)));
  20861. } else {
  20862. window.ghostDiv.insertAfter(jquery__WEBPACK_IMPORTED_MODULE_0___default()(allfilhos.get(indiceBot)));
  20863. }
  20864. }
  20865. function addGhostDiv(evt) {
  20866. console.log('a');
  20867. var undermouse = jquery__WEBPACK_IMPORTED_MODULE_0___default()(evt.target);
  20868. console.log('undermouse', undermouse);
  20869. if (undermouse.hasClass('ghost_div')) {
  20870. return;
  20871. } else if (undermouse.hasClass('commands_list_div')) {
  20872. addGhostToFunctionArea(undermouse, evt);
  20873. return;
  20874. } else if (undermouse.hasClass('block_commands')) {
  20875. if (undermouse.find('.command_container').length > 0) {
  20876. addGhostToNotEmptyBlock(undermouse, evt);
  20877. } else {
  20878. addGhostToEmptyBlock(undermouse, evt);
  20879. }
  20880. } else if (undermouse.hasClass('case_div')) {
  20881. if (undermouse.find('.case_commands_block').find('.command_container').length > 0) {
  20882. addGhostToNotEmptyBlock(undermouse, evt);
  20883. } else {
  20884. addGhostToEmptyBlock(undermouse, evt);
  20885. }
  20886. } else {
  20887. addGhostToNotEmptyBlock(undermouse, evt);
  20888. }
  20889. }
  20890. function borderMouseDragCommand(function_obj, function_container, evt) {
  20891. function_container.find('.over_command_drag').each(function (index) {
  20892. jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).removeClass('over_command_drag');
  20893. });
  20894. var prev = null;
  20895. function_container.find('.commands_list_div').each(function (index) {
  20896. prev = jquery__WEBPACK_IMPORTED_MODULE_0___default()(this);
  20897. if (prev) {
  20898. var objLeft = prev.offset().left;
  20899. var objTop = prev.offset().top;
  20900. var objRight = objLeft + prev.width();
  20901. var objBottom = objTop + prev.height();
  20902. if (evt.pageX > objLeft && evt.pageX < objRight && evt.pageY > objTop && evt.pageY < objBottom) {
  20903. prev.addClass("over_command_drag");
  20904. }
  20905. }
  20906. });
  20907. function_container.find('.command_container').each(function (index) {
  20908. var obj = jquery__WEBPACK_IMPORTED_MODULE_0___default()(this);
  20909. var objLeft = obj.offset().left;
  20910. var objTop = obj.offset().top;
  20911. var objRight = objLeft + obj.width();
  20912. var objBottom = objTop + obj.height();
  20913. if (evt.pageX > objLeft && evt.pageX < objRight && evt.pageY > objTop && evt.pageY < objBottom) {
  20914. if (prev) {
  20915. prev.removeClass('over_command_drag');
  20916. }
  20917. obj.addClass("over_command_drag");
  20918. return;
  20919. }
  20920. });
  20921. } // before_after_inside: 1 -> before, 2 -> after, 3 -> inside
  20922. function renderCommand(command, element_reference, before_after_inside, function_obj) {
  20923. var createdElement;
  20924. switch (command.type) {
  20925. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].comment:
  20926. createdElement = _commands_comment__WEBPACK_IMPORTED_MODULE_6__["renderCommand"](command, function_obj);
  20927. break;
  20928. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].break:
  20929. createdElement = _commands_break__WEBPACK_IMPORTED_MODULE_17__["renderCommand"](command, function_obj);
  20930. break;
  20931. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].reader:
  20932. createdElement = _commands_reader__WEBPACK_IMPORTED_MODULE_7__["renderCommand"](command, function_obj);
  20933. break;
  20934. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].writer:
  20935. createdElement = _commands_writer__WEBPACK_IMPORTED_MODULE_8__["renderCommand"](command, function_obj);
  20936. break;
  20937. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].attribution:
  20938. createdElement = _commands_attribution__WEBPACK_IMPORTED_MODULE_9__["renderCommand"](command, function_obj);
  20939. break;
  20940. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].functioncall:
  20941. createdElement = _commands_functioncall__WEBPACK_IMPORTED_MODULE_15__["renderCommand"](command, function_obj);
  20942. break;
  20943. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].iftrue:
  20944. createdElement = _commands_iftrue__WEBPACK_IMPORTED_MODULE_10__["renderCommand"](command, function_obj);
  20945. break;
  20946. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].repeatNtimes:
  20947. createdElement = _commands_repeatNtimes__WEBPACK_IMPORTED_MODULE_11__["renderCommand"](command, function_obj);
  20948. break;
  20949. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].whiletrue:
  20950. createdElement = _commands_whiletrue__WEBPACK_IMPORTED_MODULE_12__["renderCommand"](command, function_obj);
  20951. break;
  20952. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].dowhiletrue:
  20953. createdElement = _commands_dowhiletrue__WEBPACK_IMPORTED_MODULE_13__["renderCommand"](command, function_obj);
  20954. break;
  20955. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].switch:
  20956. createdElement = _commands_switch__WEBPACK_IMPORTED_MODULE_14__["renderCommand"](command, function_obj);
  20957. break;
  20958. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].return:
  20959. createdElement = _commands_return__WEBPACK_IMPORTED_MODULE_18__["renderCommand"](command, function_obj);
  20960. break;
  20961. }
  20962. switch (before_after_inside) {
  20963. case 1:
  20964. createdElement.insertBefore(element_reference);
  20965. break;
  20966. case 2:
  20967. createdElement.insertAfter(element_reference);
  20968. break;
  20969. case 3:
  20970. element_reference.append(createdElement);
  20971. break;
  20972. }
  20973. }
  20974. function genericCreateCommand(command_type) {
  20975. switch (command_type) {
  20976. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].break:
  20977. return new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["Break"]();
  20978. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].comment:
  20979. return new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["Comment"](new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_16__["VAR_OR_VALUE_TYPES"].only_value, _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_comment'), null, null, false));
  20980. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].reader:
  20981. return new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["Reader"](new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_16__["VAR_OR_VALUE_TYPES"].only_variable, null, null, null, false));
  20982. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].writer:
  20983. return new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["Writer"]([new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_16__["VAR_OR_VALUE_TYPES"].all, null, null, null, true)]);
  20984. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].attribution:
  20985. return new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["Attribution"](new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_16__["VAR_OR_VALUE_TYPES"].only_variable, null, null, null, false), []);
  20986. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].functioncall:
  20987. return new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["FunctionCall"](new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_16__["VAR_OR_VALUE_TYPES"].only_function, null, null, null, false), null);
  20988. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].iftrue:
  20989. return new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["IfTrue"](new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ConditionalExpression"](null), null, null);
  20990. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].repeatNtimes:
  20991. return new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["RepeatNTimes"](new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_16__["VAR_OR_VALUE_TYPES"].only_variable, null, null, null, false), new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_16__["VAR_OR_VALUE_TYPES"].only_variable, null, null, null, false), null, new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ConditionalExpression"](null), null, null);
  20992. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].whiletrue:
  20993. return new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["WhileTrue"](new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ConditionalExpression"](null), null);
  20994. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].dowhiletrue:
  20995. return new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["DoWhileTrue"](new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ConditionalExpression"](null), null);
  20996. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].switch:
  20997. var sc = [new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SwitchCase"](new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_16__["VAR_OR_VALUE_TYPES"].all, null, null, null, true))];
  20998. return new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["Switch"](new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_16__["VAR_OR_VALUE_TYPES"].variable_and_function, null, null, null, true), sc);
  20999. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].return:
  21000. return new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["Return"](new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_16__["VAR_OR_VALUE_TYPES"].all, null, null, null, true));
  21001. }
  21002. }
  21003. function dragTrash(event) {
  21004. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.ghost_div').remove();
  21005. var trash = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<i class="ui icon trash alternate outline"></i>');
  21006. jquery__WEBPACK_IMPORTED_MODULE_0___default()('body').append(trash);
  21007. trash.css('position', 'absolute');
  21008. trash.css('top', event.clientY);
  21009. trash.css('left', event.clientX - 20);
  21010. trash.css('font-size', '3em');
  21011. trash.css('display', 'none');
  21012. function_container_active.find('.commands_list_div').off('mousemove');
  21013. function_container_active.find('.commands_list_div').find("*").off('mousemove');
  21014. trash.fadeIn(200, function () {
  21015. trash.fadeOut(200, function () {
  21016. trash.remove();
  21017. });
  21018. });
  21019. }
  21020. function manageCommand(function_obj, function_container, event, command_type) {
  21021. jquery__WEBPACK_IMPORTED_MODULE_0___default()(".created_element").each(function (index) {
  21022. jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).remove();
  21023. });
  21024. var el = jquery__WEBPACK_IMPORTED_MODULE_0___default()(document.elementFromPoint(event.clientX, event.clientY));
  21025. if (el.hasClass('ghost_div')) {
  21026. if (el.closest('.command_container').length < 1) {
  21027. console.log('\n\nvou tentar!!!!');
  21028. console.log(el.closest('.commands_list_div'), '\n\n');
  21029. el.closest('.commands_list_div').css('height', el.closest('.commands_list_div').css('height') + 30); //$('.ghost_div').remove();
  21030. el = el.closest('.commands_list_div');
  21031. }
  21032. }
  21033. console.log('soltou no: ');
  21034. console.log(el);
  21035. console.log(el.data('fun')); // Primeiro verificar se ele soltou no espaço da função correta:
  21036. var hier = el.parentsUntil(".all_functions");
  21037. var esta_correto = false;
  21038. var esta_na_div_correta = false;
  21039. if (el.hasClass("commands_list_div")) {
  21040. esta_na_div_correta = true;
  21041. }
  21042. for (var i = 0; i < hier.length; i++) {
  21043. var temp = jquery__WEBPACK_IMPORTED_MODULE_0___default()(hier[i]);
  21044. if (temp.hasClass("commands_list_div")) {
  21045. esta_na_div_correta = true;
  21046. }
  21047. if (temp.data('fun') == function_obj) {
  21048. esta_correto = true;
  21049. break;
  21050. }
  21051. }
  21052. if (!esta_correto) {
  21053. has_element_created_draged = false;
  21054. which_element_is_draged = null;
  21055. dragTrash(event);
  21056. return;
  21057. } else {
  21058. if (!esta_na_div_correta) {
  21059. has_element_created_draged = false;
  21060. which_element_is_draged = null;
  21061. dragTrash(event);
  21062. return;
  21063. }
  21064. } // Agora é descobrir qual o escopo para adicionar o comando:
  21065. // Se o elemento clicado possuir o atributo "fun", então, é direto na div dos comandos:
  21066. if (typeof el.data('fun') !== 'undefined') {
  21067. // Se a lista de comandos estiver vazia, então é o primeiro.
  21068. // Portanto, ele deve soltar o elemento obrigatoriamente no objeto vazio
  21069. if (el.data('fun').commands == null || el.data('fun').commands.length == 0) {
  21070. // pode adicionar
  21071. el.data('fun').commands = [];
  21072. var new_cmd = genericCreateCommand(command_type);
  21073. el.data('fun').commands.push(new_cmd);
  21074. renderCommand(new_cmd, jquery__WEBPACK_IMPORTED_MODULE_0___default()(function_container).find('.commands_list_div'), 3, function_obj);
  21075. } else {
  21076. // Entra nesse else, caso já existam outros comandos no bloco:
  21077. findNearbyCommandToAddInFunctionScope(el, event, jquery__WEBPACK_IMPORTED_MODULE_0___default()(function_container).find('.commands_list_div'), function_obj, command_type);
  21078. }
  21079. } else {
  21080. console.log("soltou em um comando"); // descobrir em qual comando ele soltou:
  21081. var hier_find = el.parentsUntil(".commands_list_div");
  21082. var hierarquia_bottom_up = [];
  21083. if (typeof el.data('command') !== 'undefined') {
  21084. hierarquia_bottom_up.push(el.data('command'));
  21085. }
  21086. for (var i = 0; i < hier_find.length; i++) {
  21087. if (typeof jquery__WEBPACK_IMPORTED_MODULE_0___default()(hier_find[i]).data('command') !== 'undefined') {
  21088. hierarquia_bottom_up.push(jquery__WEBPACK_IMPORTED_MODULE_0___default()(hier_find[i]).data('command'));
  21089. }
  21090. }
  21091. console.log("comando em que soltou: ");
  21092. console.log(hierarquia_bottom_up[0]);
  21093. console.log("hierarquia de baixo para cima na árvore, de onde ele soltou: ");
  21094. for (var i = 0; i < hierarquia_bottom_up.length; i++) {
  21095. console.log(hierarquia_bottom_up[i]);
  21096. } // Se for do tipo break, verificar se está no contexto correto:
  21097. // Caso não esteja no contexto, apenas retorna sem dar continuidade:
  21098. var is_correct_context = false;
  21099. if (command_type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].break) {
  21100. for (var i = 0; i < hierarquia_bottom_up.length; i++) {
  21101. if (hierarquia_bottom_up[i].type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].repeatNtimes || hierarquia_bottom_up[i].type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].whiletrue || hierarquia_bottom_up[i].type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].dowhiletrue || hierarquia_bottom_up[i].type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].switch) {
  21102. is_correct_context = true;
  21103. break;
  21104. }
  21105. }
  21106. if (!is_correct_context) {
  21107. console.error("Context not allowed to insert BREAK COMMAND!");
  21108. return;
  21109. }
  21110. } // se a hierarquia possuir apenas um elemento, então está na raiz dos comandos:
  21111. if (hierarquia_bottom_up.length == 1) {
  21112. console.log('QQ1');
  21113. var sub_elemento = false;
  21114. for (var i = 0; i < hier_find.length; i++) {
  21115. if (typeof jquery__WEBPACK_IMPORTED_MODULE_0___default()(hier_find[i]).data('command') !== 'undefined') {
  21116. console.log('QQ2');
  21117. findBeforeOrAfterCommandToAdd(hier_find[i], event, function_obj, command_type);
  21118. sub_elemento = true;
  21119. break;
  21120. }
  21121. }
  21122. if (!sub_elemento) {
  21123. console.log('QQ3');
  21124. findBeforeOrAfterCommandToAdd(el[0], event, function_obj, command_type);
  21125. }
  21126. } else {
  21127. console.log('QQ4'); // caso exista mais de um elemento na hierarquia:
  21128. if (typeof jquery__WEBPACK_IMPORTED_MODULE_0___default()(el).data('command') !== 'undefined') {
  21129. console.log('QQ5');
  21130. console.log("PPP1");
  21131. insertCommandInBlockHierar(el[0], event, function_obj, command_type, hier_find, hierarquia_bottom_up);
  21132. } else {
  21133. console.log('QQ6');
  21134. var sub_elemento = false;
  21135. for (var i = 0; i < hier_find.length; i++) {
  21136. if (typeof jquery__WEBPACK_IMPORTED_MODULE_0___default()(hier_find[i]).data('command') !== 'undefined') {
  21137. console.log('QQ7');
  21138. insertCommandInBlockHierar(hier_find[i], event, function_obj, command_type, hier_find, hierarquia_bottom_up);
  21139. sub_elemento = true;
  21140. break;
  21141. }
  21142. }
  21143. }
  21144. }
  21145. }
  21146. has_element_created_draged = false;
  21147. which_element_is_draged = null;
  21148. renderAlgorithm();
  21149. }
  21150. function insertCommandInBlockHierar(el, event, function_obj, command_type, hier_dom, hier_obj) {
  21151. var el_jq = jquery__WEBPACK_IMPORTED_MODULE_0___default()(el);
  21152. var command_parent = el_jq.data('command');
  21153. if (el_jq.data('command').type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].repeatNtimes || el_jq.data('command').type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].whiletrue || el_jq.data('command').type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].dowhiletrue || el_jq.data('command').type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].switch) {
  21154. console.log('QQ17');
  21155. if (el_jq.data('command').type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].repeatNtimes || el_jq.data('command').type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].whiletrue || el_jq.data('command').type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].dowhiletrue) {
  21156. console.log('QQ18'); // Se não tiver outro comando ainda no bloco, só adiciona:
  21157. if (command_parent.commands_block == null || command_parent.commands_block.length == 0) {
  21158. command_parent.commands_block = [];
  21159. var recentComand = genericCreateCommand(command_type);
  21160. command_parent.commands_block.push(recentComand);
  21161. renderCommand(recentComand, el_jq.find('.block_commands'), 3, function_obj);
  21162. } else {
  21163. // Se já tem algum comando no bloco:
  21164. findNearbyCommandToAddInBlockScope(el, event, el, function_obj, command_type, command_parent);
  21165. }
  21166. } else {
  21167. // QUANDO FOR BLOCO DO TIPO IF OU SWITCH/CASE:
  21168. addCommandToSwitchCase(event, function_obj, command_type);
  21169. }
  21170. } else {
  21171. console.log('QQ19'); // entra neste bloco, se soltou o comando sobre outro comando dentro de um subbloco:
  21172. findBeforeOrAfterCommandToAddInsertBlock(el, event, function_obj, command_type);
  21173. }
  21174. }
  21175. function findNearbyCommandToAddInBlockScope(el, event, node_list_commands, function_obj, command_type, command_parent) {
  21176. var all_sub = jquery__WEBPACK_IMPORTED_MODULE_0___default()(node_list_commands).find('div.command_container');
  21177. var menor_distancia = 999999999;
  21178. var elemento_menor_distancia = null;
  21179. var antes = true;
  21180. var t_bot;
  21181. var t_top; // Descobrindo o elemento mais próximo:
  21182. for (var i = 0; i < all_sub.length; i++) {
  21183. t_top = all_sub[i].getBoundingClientRect().top;
  21184. t_bot = all_sub[i].getBoundingClientRect().top + all_sub[i].getBoundingClientRect().height;
  21185. if (t_top - event.clientY < menor_distancia) {
  21186. menor_distancia = event.clientY - t_top;
  21187. elemento_menor_distancia = all_sub[i];
  21188. }
  21189. }
  21190. var borda_inferior = elemento_menor_distancia.parentNode.getBoundingClientRect().top + elemento_menor_distancia.parentNode.getBoundingClientRect().height; // Está mais próximo da borda de baixo, ou seja.. inserir por último:
  21191. if (borda_inferior - event.clientY < menor_distancia) {
  21192. var recentComand = genericCreateCommand(command_type);
  21193. command_parent.commands_block.push(recentComand); //
  21194. renderCommand(recentComand, node_list_commands, 3, function_obj);
  21195. } else {
  21196. var recentComand = genericCreateCommand(command_type);
  21197. var index = command_parent.commands_block.indexOf(jquery__WEBPACK_IMPORTED_MODULE_0___default()(elemento_menor_distancia).data('command'));
  21198. if (index > -1) {
  21199. command_parent.commands_block.splice(index, 0, recentComand);
  21200. }
  21201. renderCommand(recentComand, elemento_menor_distancia, 1, function_obj);
  21202. }
  21203. }
  21204. function findBeforeOrAfterCommandToAddInsertBlock(el, event, function_obj, command_type) {
  21205. var el_jq = jquery__WEBPACK_IMPORTED_MODULE_0___default()(el);
  21206. var command_parent = jquery__WEBPACK_IMPORTED_MODULE_0___default()(el.parentNode.parentNode).data('command');
  21207. var command_target = el_jq.data('command');
  21208. var temp_parent = jquery__WEBPACK_IMPORTED_MODULE_0___default()(el.parentNode.parentNode);
  21209. var is_in_else = false;
  21210. if (!command_parent) {
  21211. command_parent = el_jq.data('command');
  21212. temp_parent = el_jq;
  21213. var hier = el_jq.parentsUntil(".command_container");
  21214. for (var i = 0; i < hier.length; i++) {
  21215. var temp = jquery__WEBPACK_IMPORTED_MODULE_0___default()(hier[i]);
  21216. if (typeof temp.data('else') != 'undefined') {
  21217. is_in_else = true;
  21218. }
  21219. if (typeof temp.data('command') != 'undefined') {
  21220. command_parent = temp.data('command');
  21221. temp_parent = temp;
  21222. }
  21223. }
  21224. }
  21225. var hier = el_jq.parentsUntil(".command_container");
  21226. for (var i = 0; i < hier.length; i++) {
  21227. var temp = jquery__WEBPACK_IMPORTED_MODULE_0___default()(hier[i]);
  21228. if (typeof temp.data('else') != 'undefined') {
  21229. is_in_else = true;
  21230. }
  21231. }
  21232. if (command_parent == command_target) {
  21233. var hier = el_jq.parentsUntil(".command_container");
  21234. for (var i = 0; i < hier.length; i++) {
  21235. var temp = jquery__WEBPACK_IMPORTED_MODULE_0___default()(hier[i]);
  21236. if (typeof temp.data('else') !== 'undefined') {
  21237. is_in_else = true;
  21238. break;
  21239. }
  21240. }
  21241. }
  21242. if (command_parent.type != _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].iftrue && command_parent.type != _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].switch) {
  21243. var hier = temp_parent.parentsUntil(".all_cases_div");
  21244. console.log("vou procurar!!");
  21245. for (var i = 0; i < hier.length; i++) {
  21246. console.log("estou vasculhando...");
  21247. var temp = jquery__WEBPACK_IMPORTED_MODULE_0___default()(hier[i]);
  21248. if (typeof temp.data('switchcase') !== 'undefined') {
  21249. console.log("encontrei");
  21250. command_parent = temp.data('switchcase');
  21251. is_in_else = false;
  21252. break;
  21253. }
  21254. }
  21255. }
  21256. console.log('debugging:');
  21257. console.log('el_jq');
  21258. console.log(el_jq);
  21259. console.log('command_parent');
  21260. console.log(command_parent);
  21261. console.log('command_target');
  21262. console.log(command_target);
  21263. var menor_distancia = 999999999;
  21264. var antes = true;
  21265. var t_bot;
  21266. var t_top;
  21267. t_top = el.getBoundingClientRect().top;
  21268. t_bot = el.getBoundingClientRect().top + el.getBoundingClientRect().height;
  21269. var d_top = event.clientY - t_top; // distancia topo
  21270. var d_bot = t_bot - event.clientY; // distancia baixo
  21271. // Está mais próximo da borda de baixo, ou seja.. inserir por último:
  21272. if (d_top < d_bot) {
  21273. var recentComand = genericCreateCommand(command_type);
  21274. console.log('MMM1');
  21275. if (is_in_else) {
  21276. console.log('MMM2');
  21277. if (command_parent == command_target) {
  21278. console.log('MMM3');
  21279. if (command_parent.commands_else == null || command_parent.commands_else.length == 0) {
  21280. command_parent.commands_else = [];
  21281. var recentComand = genericCreateCommand(command_type);
  21282. command_parent.commands_else.push(recentComand);
  21283. renderCommand(recentComand, el_jq, 3, function_obj);
  21284. } else {
  21285. // Se já tem algum comando no bloco:
  21286. findInBlockCorrectPlace(el_jq, event, function_obj, command_type, true);
  21287. }
  21288. return;
  21289. }
  21290. console.log('MMM7');
  21291. var index = command_parent.commands_else.indexOf(command_target);
  21292. if (index > -1) {
  21293. command_parent.commands_else.splice(index, 0, recentComand);
  21294. }
  21295. renderCommand(recentComand, el, 1, function_obj);
  21296. } else {
  21297. console.log('MMM4');
  21298. if (command_parent == command_target) {
  21299. console.log('Nxxxx5');
  21300. if (command_parent.commands_block == null || command_parent.commands_block.length == 0) {
  21301. command_parent.commands_block = [];
  21302. console.log('SSS4');
  21303. var recentComand = genericCreateCommand(command_type);
  21304. command_parent.commands_block.push(recentComand);
  21305. renderCommand(recentComand, el_jq, 3, function_obj);
  21306. } else {
  21307. console.log('SSS5');
  21308. findInBlockCorrectPlace(el_jq, event, function_obj, command_type);
  21309. }
  21310. return;
  21311. }
  21312. console.log('MMM6');
  21313. var index = command_parent.commands_block.indexOf(command_target);
  21314. if (index > -1) {
  21315. command_parent.commands_block.splice(index, 0, recentComand);
  21316. }
  21317. renderCommand(recentComand, el, 1, function_obj);
  21318. }
  21319. } else {
  21320. console.log('XXX1');
  21321. var recentComand = genericCreateCommand(command_type);
  21322. if (is_in_else) {
  21323. if (command_parent == command_target) {
  21324. console.log('MMM3');
  21325. if (command_parent.commands_else == null || command_parent.commands_else.length == 0) {
  21326. command_parent.commands_else = [];
  21327. console.log('SSS1');
  21328. var recentComand = genericCreateCommand(command_type);
  21329. command_parent.commands_else.push(recentComand);
  21330. renderCommand(recentComand, el_jq, 3, function_obj);
  21331. } else {
  21332. // Se já tem algum comando no bloco:
  21333. console.log('SSS2');
  21334. findInBlockCorrectPlace(el_jq, event, function_obj, command_type, true);
  21335. }
  21336. return;
  21337. }
  21338. console.log('XXX2');
  21339. var index = command_parent.commands_else.indexOf(command_target);
  21340. if (index > -1) {
  21341. command_parent.commands_else.splice(index + 1, 0, recentComand);
  21342. }
  21343. renderCommand(recentComand, el, 2, function_obj);
  21344. } else {
  21345. if (command_parent == command_target) {
  21346. console.log('Nxxxx78');
  21347. if (command_parent.commands_block == null || command_parent.commands_block.length == 0) {
  21348. command_parent.commands_block = [];
  21349. var recentComand = genericCreateCommand(command_type);
  21350. command_parent.commands_block.push(recentComand);
  21351. console.log('SSS6');
  21352. renderCommand(recentComand, el_jq, 3, function_obj);
  21353. } else {
  21354. console.log('SSS7');
  21355. findInBlockCorrectPlace(el_jq, event, function_obj, command_type);
  21356. }
  21357. return;
  21358. }
  21359. console.log('XXX3');
  21360. var index = command_parent.commands_block.indexOf(command_target);
  21361. if (index > -1) {
  21362. command_parent.commands_block.splice(index + 1, 0, recentComand);
  21363. }
  21364. renderCommand(recentComand, el, 2, function_obj);
  21365. }
  21366. }
  21367. }
  21368. function insertCommandInBlock(el, event, function_obj, command_type) {
  21369. var el_jq = jquery__WEBPACK_IMPORTED_MODULE_0___default()(el);
  21370. var command_parent = el_jq.data('command');
  21371. if (el_jq.data('command').type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].repeatNtimes || el_jq.data('command').type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].whiletrue || el_jq.data('command').type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].dowhiletrue) {
  21372. // Se não tiver outro comando ainda no bloco, só adiciona:
  21373. if (command_parent.commands_block == null || command_parent.commands_block.length == 0) {
  21374. command_parent.commands_block = [];
  21375. var recentComand = genericCreateCommand(command_type);
  21376. command_parent.commands_block.push(recentComand);
  21377. renderCommand(recentComand, el_jq.find('.block_commands'), 3, function_obj);
  21378. } else {
  21379. // Se já tem algum comando no bloco:
  21380. findInBlockCorrectPlace(el, event, function_obj, command_type);
  21381. }
  21382. } else if (el_jq.data('command').type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].iftrue) {
  21383. console.log('QQ9'); // no if ou no else?
  21384. var correct_div = jquery__WEBPACK_IMPORTED_MODULE_0___default()(document.elementFromPoint(event.pageX, event.pageY));
  21385. var is_in_if = true;
  21386. if (correct_div.data('if')) {
  21387. is_in_if = true;
  21388. } else if (correct_div.data('else')) {
  21389. is_in_if = false;
  21390. } else {
  21391. var hier = correct_div.parentsUntil(".command_container");
  21392. for (var i = 0; i < hier.length; i++) {
  21393. var temp = jquery__WEBPACK_IMPORTED_MODULE_0___default()(hier[i]);
  21394. if (typeof temp.data('if') !== 'undefined') {
  21395. is_in_if = true;
  21396. break;
  21397. }
  21398. if (typeof temp.data('else') !== 'undefined') {
  21399. is_in_if = false;
  21400. break;
  21401. }
  21402. }
  21403. }
  21404. if (is_in_if) {
  21405. if (command_parent.commands_block == null || command_parent.commands_block.length == 0) {
  21406. command_parent.commands_block = [];
  21407. var recentComand = genericCreateCommand(command_type);
  21408. command_parent.commands_block.push(recentComand);
  21409. renderCommand(recentComand, el_jq.find('.commands_if'), 3, function_obj);
  21410. } else {
  21411. // Se já tem algum comando no bloco:
  21412. findInBlockCorrectPlace(el_jq.find('.commands_if'), event, function_obj, command_type);
  21413. }
  21414. } else {
  21415. if (command_parent.commands_else == null || command_parent.commands_else.length == 0) {
  21416. command_parent.commands_else = [];
  21417. var recentComand = genericCreateCommand(command_type);
  21418. command_parent.commands_else.push(recentComand);
  21419. renderCommand(recentComand, el_jq.find('.commands_else'), 3, function_obj);
  21420. } else {
  21421. // Se já tem algum comando no bloco:
  21422. findInBlockCorrectPlace(el_jq.find('.commands_else'), event, function_obj, command_type, true);
  21423. }
  21424. }
  21425. } else {
  21426. // é do tipo switch
  21427. console.log("está tentando inserir em um switch que está na raiz!");
  21428. addCommandToSwitchCase(event, function_obj, command_type);
  21429. }
  21430. }
  21431. function addCommandToSwitchCase(event, function_obj, command_type) {
  21432. var el = jquery__WEBPACK_IMPORTED_MODULE_0___default()(document.elementFromPoint(event.clientX, event.clientY));
  21433. var which_case = el.data('switchcase');
  21434. var case_div = el;
  21435. if (!which_case) {
  21436. var hier_find = el.parentsUntil(".all_cases_div");
  21437. for (var i = 0; i < hier_find.length; i++) {
  21438. if (typeof jquery__WEBPACK_IMPORTED_MODULE_0___default()(hier_find[i]).data('switchcase') !== 'undefined') {
  21439. which_case = jquery__WEBPACK_IMPORTED_MODULE_0___default()(hier_find[i]).data('switchcase');
  21440. case_div = jquery__WEBPACK_IMPORTED_MODULE_0___default()(hier_find[i]);
  21441. break;
  21442. }
  21443. }
  21444. }
  21445. if (which_case.commands_block == null || which_case.commands_block.length < 1) {
  21446. which_case.commands_block = [];
  21447. var recentComand = genericCreateCommand(command_type);
  21448. which_case.commands_block.push(recentComand);
  21449. renderCommand(recentComand, case_div.find('.case_commands_block'), 3, function_obj);
  21450. } else {
  21451. findInBlockCorrectPlaceInSwitchCase(which_case, case_div, event, function_obj, command_type);
  21452. }
  21453. }
  21454. function findInBlockCorrectPlaceInSwitchCase(which_case, case_div, event, function_obj, command_type) {
  21455. var all_sub = case_div.find('div.command_container');
  21456. var menor_distancia = 999999999;
  21457. var elemento_menor_distancia = null;
  21458. var antes = true;
  21459. var t_bot;
  21460. var t_top; // Descobrindo o elemento mais próximo:
  21461. for (var i = 0; i < all_sub.length; i++) {
  21462. t_top = all_sub[i].getBoundingClientRect().top;
  21463. t_bot = all_sub[i].getBoundingClientRect().top + all_sub[i].getBoundingClientRect().height;
  21464. if (t_top - event.clientY < menor_distancia) {
  21465. menor_distancia = event.clientY - t_top;
  21466. elemento_menor_distancia = all_sub[i];
  21467. }
  21468. }
  21469. var borda_inferior = elemento_menor_distancia.parentNode.getBoundingClientRect().top + elemento_menor_distancia.parentNode.getBoundingClientRect().height; // Está mais próximo da borda de baixo, ou seja.. inserir por último:
  21470. if (borda_inferior - event.clientY < menor_distancia) {
  21471. var recentComand = genericCreateCommand(command_type);
  21472. which_case.commands_block.push(recentComand);
  21473. renderCommand(recentComand, jquery__WEBPACK_IMPORTED_MODULE_0___default()(case_div.find('.case_commands_block')[0]), 3, function_obj);
  21474. } else {
  21475. var recentComand = genericCreateCommand(command_type);
  21476. var index = which_case.commands_block.indexOf(jquery__WEBPACK_IMPORTED_MODULE_0___default()(elemento_menor_distancia).data('command'));
  21477. if (index > -1) {
  21478. which_case.commands_block.splice(index, 0, recentComand);
  21479. renderCommand(recentComand, elemento_menor_distancia, 1, function_obj);
  21480. }
  21481. }
  21482. }
  21483. function findInBlockCorrectPlace(el, event, function_obj, command_type) {
  21484. var is_in_else = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
  21485. var el_jq = jquery__WEBPACK_IMPORTED_MODULE_0___default()(el);
  21486. var all_sub = el_jq.find('div.command_container');
  21487. var menor_distancia = 999999999;
  21488. var elemento_menor_distancia = null;
  21489. var antes = true;
  21490. var t_bot;
  21491. var t_top; // Descobrindo o elemento mais próximo:
  21492. for (var i = 0; i < all_sub.length; i++) {
  21493. t_top = all_sub[i].getBoundingClientRect().top;
  21494. t_bot = all_sub[i].getBoundingClientRect().top + all_sub[i].getBoundingClientRect().height;
  21495. if (t_top - event.clientY < menor_distancia) {
  21496. menor_distancia = event.clientY - t_top;
  21497. elemento_menor_distancia = all_sub[i];
  21498. }
  21499. }
  21500. var borda_inferior = elemento_menor_distancia.parentNode.getBoundingClientRect().top + elemento_menor_distancia.parentNode.getBoundingClientRect().height;
  21501. console.log("menor_distancia: ");
  21502. console.log(elemento_menor_distancia); // Está mais próximo da borda de baixo, ou seja.. inserir por último:
  21503. if (borda_inferior - event.clientY < menor_distancia) {
  21504. console.log('QQ11');
  21505. var recentComand = genericCreateCommand(command_type);
  21506. var command_parent = el_jq.data('command');
  21507. if (is_in_else) {
  21508. console.log('QQ15');
  21509. command_parent.commands_else.push(recentComand);
  21510. console.log('el_jq');
  21511. console.log(el_jq);
  21512. console.log("$(el_jq.find('.commands_else')[0]):: ");
  21513. console.log(jquery__WEBPACK_IMPORTED_MODULE_0___default()(el_jq.find('.commands_else')[0]));
  21514. renderCommand(recentComand, el_jq, 3, function_obj);
  21515. } else {
  21516. console.log('QQ16');
  21517. command_parent.commands_block.push(recentComand);
  21518. renderCommand(recentComand, jquery__WEBPACK_IMPORTED_MODULE_0___default()(el_jq.find('.block_commands')[0]), 3, function_obj);
  21519. }
  21520. } else {
  21521. console.log('QQ12');
  21522. var recentComand = genericCreateCommand(command_type);
  21523. var command_parent = el_jq.data('command');
  21524. if (is_in_else) {
  21525. var index = command_parent.commands_else.indexOf(jquery__WEBPACK_IMPORTED_MODULE_0___default()(elemento_menor_distancia).data('command'));
  21526. if (index > -1) {
  21527. command_parent.commands_else.splice(index, 0, recentComand);
  21528. renderCommand(recentComand, elemento_menor_distancia, 1, function_obj);
  21529. }
  21530. } else {
  21531. var index = command_parent.commands_block.indexOf(jquery__WEBPACK_IMPORTED_MODULE_0___default()(elemento_menor_distancia).data('command'));
  21532. if (index > -1) {
  21533. command_parent.commands_block.splice(index, 0, recentComand);
  21534. renderCommand(recentComand, elemento_menor_distancia, 1, function_obj);
  21535. }
  21536. }
  21537. }
  21538. }
  21539. function findBeforeOrAfterCommandToAdd(el, event, function_obj, command_type) {
  21540. switch (jquery__WEBPACK_IMPORTED_MODULE_0___default()(el).data('command').type) {
  21541. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].iftrue:
  21542. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].switch:
  21543. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].repeatNtimes:
  21544. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].whiletrue:
  21545. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].dowhiletrue:
  21546. insertCommandInBlock(el, event, function_obj, command_type);
  21547. return;
  21548. }
  21549. var menor_distancia = 999999999;
  21550. var antes = true;
  21551. var t_bot;
  21552. var t_top;
  21553. t_top = el.getBoundingClientRect().top;
  21554. t_bot = el.getBoundingClientRect().top + el.getBoundingClientRect().height;
  21555. var d_top = event.clientY - t_top; // distancia topo
  21556. var d_bot = t_bot - event.clientY; // distancia baixo
  21557. // Está mais próximo da borda de baixo, ou seja.. inserir por último:
  21558. if (d_top < d_bot) {
  21559. var recentComand = genericCreateCommand(command_type);
  21560. var index = function_obj.commands.indexOf(jquery__WEBPACK_IMPORTED_MODULE_0___default()(el).data('command'));
  21561. if (index > -1) {
  21562. function_obj.commands.splice(index, 0, recentComand);
  21563. }
  21564. renderCommand(recentComand, el, 1, function_obj);
  21565. } else {
  21566. var recentComand = genericCreateCommand(command_type);
  21567. var index = function_obj.commands.indexOf(jquery__WEBPACK_IMPORTED_MODULE_0___default()(el).data('command'));
  21568. if (index > -1) {
  21569. function_obj.commands.splice(index + 1, 0, recentComand);
  21570. }
  21571. renderCommand(recentComand, el, 2, function_obj);
  21572. }
  21573. }
  21574. function findNearbyCommandToAddInFunctionScope(el, event, node_list_commands, function_obj, command_type) {
  21575. var all_sub = jquery__WEBPACK_IMPORTED_MODULE_0___default()(node_list_commands).find('div.command_container');
  21576. var menor_distancia = 999999999;
  21577. var elemento_menor_distancia = null;
  21578. var antes = true;
  21579. var t_bot;
  21580. var t_top; // Descobrindo o elemento mais próximo:
  21581. for (var i = 0; i < all_sub.length; i++) {
  21582. t_top = all_sub[i].getBoundingClientRect().top;
  21583. t_bot = all_sub[i].getBoundingClientRect().top + all_sub[i].getBoundingClientRect().height;
  21584. if (t_top - event.clientY < menor_distancia) {
  21585. menor_distancia = event.clientY - t_top;
  21586. elemento_menor_distancia = all_sub[i];
  21587. }
  21588. }
  21589. var borda_inferior = elemento_menor_distancia.parentNode.getBoundingClientRect().top + elemento_menor_distancia.parentNode.getBoundingClientRect().height; // Está mais próximo da borda de baixo, ou seja.. inserir por último:
  21590. if (borda_inferior - event.clientY < menor_distancia) {
  21591. var recentComand = genericCreateCommand(command_type);
  21592. function_obj.commands.push(recentComand); //
  21593. renderCommand(recentComand, node_list_commands, 3, function_obj);
  21594. } else {
  21595. var recentComand = genericCreateCommand(command_type);
  21596. var index = function_obj.commands.indexOf(jquery__WEBPACK_IMPORTED_MODULE_0___default()(elemento_menor_distancia).data('command'));
  21597. if (index > -1) {
  21598. function_obj.commands.splice(index, 0, recentComand);
  21599. }
  21600. renderCommand(recentComand, elemento_menor_distancia, 1, function_obj);
  21601. }
  21602. }
  21603. /***/ }),
  21604. /***/ "./js/visualUI/commands/attribution.js":
  21605. /*!*********************************************!*\
  21606. !*** ./js/visualUI/commands/attribution.js ***!
  21607. \*********************************************/
  21608. /*! exports provided: createFloatingCommand, renderCommand, manageExpressionElements, renderMenuOperations */
  21609. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  21610. "use strict";
  21611. __webpack_require__.r(__webpack_exports__);
  21612. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createFloatingCommand", function() { return createFloatingCommand; });
  21613. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "renderCommand", function() { return renderCommand; });
  21614. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "manageExpressionElements", function() { return manageExpressionElements; });
  21615. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "renderMenuOperations", function() { return renderMenuOperations; });
  21616. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  21617. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_0__);
  21618. /* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  21619. /* harmony import */ var _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  21620. /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  21621. /* harmony import */ var _globals__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../globals */ "./js/visualUI/globals.js");
  21622. /* harmony import */ var _variables__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../variables */ "./js/visualUI/variables.js");
  21623. /* harmony import */ var _variable_value_menu__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  21624. /* harmony import */ var _commands__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  21625. function createFloatingCommand() {
  21626. return jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="ui attribution created_element"> <i class="ui icon small arrow left"></i> <span> x = 1 + 1 </span></div>');
  21627. }
  21628. function renderCommand(command, function_obj) {
  21629. var el = jquery__WEBPACK_IMPORTED_MODULE_0___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">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_receives') + '</span> ' + '<div class="expression_elements"></div> </div>');
  21630. el.data('command', command);
  21631. _variable_value_menu__WEBPACK_IMPORTED_MODULE_6__["renderMenu"](command, command.variable, el.find('.var_attributed'), function_obj);
  21632. if (!command.expression || command.expression.length < 1) {
  21633. var exp = new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ExpressionElement"](_ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_ELEMENTS"].op_exp, [_ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].none, new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_variable_value_menu__WEBPACK_IMPORTED_MODULE_6__["VAR_OR_VALUE_TYPES"].all, null, null, null, true)]);
  21634. command.expression.push(exp);
  21635. }
  21636. addHandlers(command, function_obj, el);
  21637. renderExpressionElements(command, function_obj, el);
  21638. return el;
  21639. }
  21640. function manageExpressionElements(command, ref_object, dom_object, menu_var_or_value, function_obj, selectedItem, expression_element) {
  21641. var index_to_move = expression_element.itens.indexOf(ref_object);
  21642. switch (selectedItem.data('exp')) {
  21643. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_ELEMENTS"].exp_op_exp:
  21644. var exp = new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ExpressionElement"](_ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_ELEMENTS"].exp_op_exp, [expression_element.itens[index_to_move], _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].plus, new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_variable_value_menu__WEBPACK_IMPORTED_MODULE_6__["VAR_OR_VALUE_TYPES"].all, null, null, null, true)]);
  21645. expression_element.itens[index_to_move] = exp;
  21646. break;
  21647. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_ELEMENTS"].op_exp:
  21648. var exp = new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ExpressionElement"](_ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_ELEMENTS"].op_exp, [_ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].plus, expression_element.itens[index_to_move]]);
  21649. expression_element.itens[index_to_move] = exp;
  21650. break;
  21651. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_ELEMENTS"].par_exp_par:
  21652. var exp = new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ExpressionElement"](_ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_ELEMENTS"].par_exp_par, [expression_element.itens[index_to_move]]);
  21653. expression_element.itens[index_to_move] = exp;
  21654. break;
  21655. }
  21656. renderExpressionElements(command, function_obj, dom_object);
  21657. }
  21658. function renderExpressionElements(command, function_obj, el) {
  21659. var expression_div = el.find('.expression_elements');
  21660. var command_container;
  21661. if (el.hasClass("command_container") == false) {
  21662. var hier = el.parentsUntil(".command_container");
  21663. for (var i = 0; i < hier.length; i++) {
  21664. if (jquery__WEBPACK_IMPORTED_MODULE_0___default()(hier[i]).hasClass("command_container")) {
  21665. command_container = jquery__WEBPACK_IMPORTED_MODULE_0___default()(hier[i]);
  21666. break;
  21667. }
  21668. if (jquery__WEBPACK_IMPORTED_MODULE_0___default()(hier[i]).hasClass("expression_elements")) {
  21669. expression_div = jquery__WEBPACK_IMPORTED_MODULE_0___default()(hier[i]);
  21670. break;
  21671. }
  21672. }
  21673. }
  21674. if (command_container) {
  21675. expression_div = command_container.find('.expression_elements');
  21676. }
  21677. expression_div.text('');
  21678. for (var i = 0; i < command.expression.length; i++) {
  21679. var temp = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="expression_element"></div>');
  21680. temp.data('ref_element', command.expression[i]);
  21681. temp.data('ref_index', i);
  21682. expression_div.append(temp);
  21683. renderElement(command, function_obj, temp, command.expression[i]);
  21684. }
  21685. }
  21686. function renderOperator(command, function_obj, temp_op, expression_element, index_op) {
  21687. var context_menu = '<div class="ui dropdown"><div class="text">';
  21688. switch (expression_element.itens[index_op]) {
  21689. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].plus:
  21690. context_menu += '+';
  21691. break;
  21692. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].minus:
  21693. context_menu += '-';
  21694. break;
  21695. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].multiplication:
  21696. context_menu += '*';
  21697. break;
  21698. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].division:
  21699. context_menu += '/';
  21700. break;
  21701. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].module:
  21702. context_menu += '%';
  21703. break;
  21704. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].none:
  21705. context_menu += '...';
  21706. break;
  21707. }
  21708. context_menu += '</div><div class="menu">';
  21709. context_menu += '<div class="item" data-value="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].plus + '">+</div>';
  21710. context_menu += '<div class="item" data-value="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].minus + '">-</div>';
  21711. context_menu += '<div class="item" data-value="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].multiplication + '">*</div>';
  21712. context_menu += '<div class="item" data-value="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].division + '">/</div>';
  21713. context_menu += '<div class="item" data-value="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].module + '">%</div>';
  21714. context_menu += '<div class="item" data-value="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].none + '" data-text="...">Nenhum</div>';
  21715. context_menu += '</div></div>';
  21716. context_menu = jquery__WEBPACK_IMPORTED_MODULE_0___default()(context_menu);
  21717. temp_op.append(context_menu);
  21718. context_menu.dropdown({
  21719. onChange: function onChange(value, text, $selectedItem) {
  21720. expression_element.itens[index_op] = value;
  21721. }
  21722. });
  21723. }
  21724. function renderMenuAddExpression(command, function_obj, el, dom_append_menu, expression_append_new_expression) {
  21725. if (el.hasClass("command_container") == false) {
  21726. var hier = el.parentsUntil(".commands_list_div");
  21727. for (var i = 0; i < hier.length; i++) {
  21728. if (jquery__WEBPACK_IMPORTED_MODULE_0___default()(hier[i]).hasClass("command_container")) {
  21729. el = jquery__WEBPACK_IMPORTED_MODULE_0___default()(hier[i]);
  21730. break;
  21731. }
  21732. }
  21733. }
  21734. if (dom_append_menu.hasClass("expression_elements") == false) {
  21735. var hier = el.parentsUntil(".commands_list_div");
  21736. for (var i = 0; i < hier.length; i++) {
  21737. if (jquery__WEBPACK_IMPORTED_MODULE_0___default()(hier[i]).hasClass("expression_elements")) {
  21738. dom_append_menu = jquery__WEBPACK_IMPORTED_MODULE_0___default()(hier[i]);
  21739. break;
  21740. }
  21741. }
  21742. }
  21743. var context_menu = '<div class="ui dropdown"><div class="text"></div><i class="ui icon arrow alternate circle right outline"></i><div class="menu">';
  21744. context_menu += '<div class="item" data-value="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_ELEMENTS"].exp_op_exp + '">EXP OP EXP</div>';
  21745. context_menu += '<div class="item" data-value="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_ELEMENTS"].op_exp + '">OP EXP</div>';
  21746. context_menu += '<div class="item" data-value="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_ELEMENTS"].par_exp_par + '">( EXP )</div>';
  21747. context_menu += '</div></div>';
  21748. context_menu = jquery__WEBPACK_IMPORTED_MODULE_0___default()(context_menu);
  21749. dom_append_menu.append(context_menu);
  21750. context_menu.dropdown({
  21751. onChange: function onChange(value, text, $selectedItem) {
  21752. switch (value) {
  21753. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_ELEMENTS"].exp_op_exp:
  21754. var exp = new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ExpressionElement"](_ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_ELEMENTS"].exp_op_exp, [new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_variable_value_menu__WEBPACK_IMPORTED_MODULE_6__["VAR_OR_VALUE_TYPES"].all, null, null, null, true), _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].plus, new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_variable_value_menu__WEBPACK_IMPORTED_MODULE_6__["VAR_OR_VALUE_TYPES"].all, null, null, null, true)]);
  21755. expression_append_new_expression.push(exp);
  21756. break;
  21757. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_ELEMENTS"].op_exp:
  21758. var exp = new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ExpressionElement"](_ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_ELEMENTS"].op_exp, [_ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].plus, new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_variable_value_menu__WEBPACK_IMPORTED_MODULE_6__["VAR_OR_VALUE_TYPES"].all, null, null, null, true)]);
  21759. expression_append_new_expression.push(exp);
  21760. break;
  21761. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_ELEMENTS"].par_exp_par:
  21762. var exp = new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ExpressionElement"](_ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_ELEMENTS"].par_exp_par, [new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_variable_value_menu__WEBPACK_IMPORTED_MODULE_6__["VAR_OR_VALUE_TYPES"].all, null, null, null, true)]);
  21763. expression_append_new_expression.push(exp);
  21764. break;
  21765. }
  21766. renderExpressionElements(command, function_obj, el);
  21767. }
  21768. });
  21769. }
  21770. function renderElement(command, function_obj, el, expression_element) {
  21771. switch (expression_element.type_exp) {
  21772. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_ELEMENTS"].exp_op_exp:
  21773. var temp_op = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="component_element"></div>');
  21774. var temp_exp_1 = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="component_element"></div>');
  21775. var temp_exp_2 = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="component_element"></div>');
  21776. el.append(temp_exp_1);
  21777. el.append(temp_op);
  21778. el.append(temp_exp_2);
  21779. if (expression_element.itens[0].type) {
  21780. _variable_value_menu__WEBPACK_IMPORTED_MODULE_6__["renderMenu"](command, expression_element.itens[0], temp_exp_1, function_obj, 2, expression_element);
  21781. } else {
  21782. renderElement(command, function_obj, temp_exp_1, expression_element.itens[0]);
  21783. }
  21784. renderOperator(command, function_obj, temp_op, expression_element, 1);
  21785. if (expression_element.itens[2].type) {
  21786. _variable_value_menu__WEBPACK_IMPORTED_MODULE_6__["renderMenu"](command, expression_element.itens[2], temp_exp_2, function_obj, 2, expression_element);
  21787. } else {
  21788. renderElement(command, function_obj, temp_exp_2, expression_element.itens[2]);
  21789. }
  21790. break;
  21791. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_ELEMENTS"].op_exp:
  21792. var temp_op = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="component_element"></div>');
  21793. var temp_exp = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="component_element"></div>');
  21794. el.append(temp_op);
  21795. el.append(temp_exp);
  21796. renderOperator(command, function_obj, temp_op, expression_element, 0);
  21797. if (expression_element.itens[1].type) {
  21798. _variable_value_menu__WEBPACK_IMPORTED_MODULE_6__["renderMenu"](command, expression_element.itens[1], temp_exp, function_obj, 2, expression_element);
  21799. } else {
  21800. renderElement(command, function_obj, temp_exp, expression_element.itens[1]);
  21801. }
  21802. break;
  21803. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_ELEMENTS"].par_exp_par:
  21804. var temp_par_1 = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="component_element"> ( </div>');
  21805. var temp_exp = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="component_element"></div>');
  21806. var temp_par_2 = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="component_element"> ) </div>');
  21807. el.append(temp_par_1);
  21808. el.append(temp_exp);
  21809. for (var j = 0; j < expression_element.itens.length; j++) {
  21810. if (expression_element.itens[j].type) {
  21811. _variable_value_menu__WEBPACK_IMPORTED_MODULE_6__["renderMenu"](command, expression_element.itens[j], temp_exp, function_obj, 2, expression_element);
  21812. } else {
  21813. renderElement(command, function_obj, temp_exp, expression_element.itens[j]);
  21814. }
  21815. } //renderMenuAddExpression(command, function_obj, el, el, expression_element.itens);
  21816. el.append(temp_par_2);
  21817. break;
  21818. }
  21819. }
  21820. function renderExpression(command, function_obj, el) {
  21821. var expression_div = el.find('.expression_elements');
  21822. expression_div.text('');
  21823. var menu_add_item = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="menu_add_item"></div>');
  21824. menu_add_item.data('index_add', 0);
  21825. expression_div.append(menu_add_item);
  21826. for (var i = 0; i < command.expression.length; i++) {
  21827. if (command.expression[i].type) {
  21828. var temp = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="expression_element"></div>');
  21829. temp.data('ref_element', command.expression[i]);
  21830. temp.data('ref_index', i);
  21831. expression_div.append(temp);
  21832. _variable_value_menu__WEBPACK_IMPORTED_MODULE_6__["renderMenu"](command, command.expression[i], temp, function_obj);
  21833. } else if (command.expression[i] == "(" || command.expression[i] == ")") {
  21834. var temp = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="expression_element">' + command.expression[i] + '</div>');
  21835. temp.data('ref_element', command.expression[i]);
  21836. temp.data('ref_index', i);
  21837. expression_div.append(temp);
  21838. } else {
  21839. var temp = '<div class="expression_element">';
  21840. switch (command.expression[i]) {
  21841. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].plus:
  21842. temp += '+';
  21843. break;
  21844. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].minus:
  21845. temp += '-';
  21846. break;
  21847. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].multiplication:
  21848. temp += '*';
  21849. break;
  21850. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].division:
  21851. temp += '/';
  21852. break;
  21853. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].module:
  21854. temp += '%';
  21855. break;
  21856. }
  21857. temp += '</div>';
  21858. temp = jquery__WEBPACK_IMPORTED_MODULE_0___default()(temp);
  21859. temp.data('ref_element', command.expression[i]);
  21860. temp.data('ref_index', i);
  21861. expression_div.append(temp);
  21862. }
  21863. var menu_add_item_seq = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="menu_add_item"></div>');
  21864. var index_temp = i + 1;
  21865. menu_add_item_seq.data('index_add', index_temp);
  21866. expression_div.append(menu_add_item_seq);
  21867. }
  21868. addMenuItens(command, function_obj, el);
  21869. }
  21870. function addMenuItens(command, function_obj, expression_div) {
  21871. var divs_expression = expression_div.find('.menu_add_item');
  21872. for (var i = 0; i < divs_expression.length; i++) {
  21873. var temp = jquery__WEBPACK_IMPORTED_MODULE_0___default()(divs_expression[i]).data('index_add');
  21874. var context_menu = '<div class="ui dropdown context_menu_clear"><i class="ui icon plus square outline"></i><div class="menu">';
  21875. context_menu += '<div class="item" data-option="value" data-index="' + temp + '">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_value') + '</div>';
  21876. context_menu += '<div class="item" data-option="operator" data-index="' + temp + '">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_operator') + '</div>';
  21877. context_menu += '<div class="item" data-option="parentheses" data-index="' + temp + '">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_parentheses') + '</div>';
  21878. context_menu += '</div></div>';
  21879. context_menu = jquery__WEBPACK_IMPORTED_MODULE_0___default()(context_menu);
  21880. jquery__WEBPACK_IMPORTED_MODULE_0___default()(divs_expression[i]).append(context_menu);
  21881. context_menu.dropdown({
  21882. on: 'hover',
  21883. onChange: function onChange(value, text, $selectedItem) {
  21884. switch ($selectedItem.data('option')) {
  21885. case "value":
  21886. command.expression.splice($selectedItem.data('index'), 0, new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_variable_value_menu__WEBPACK_IMPORTED_MODULE_6__["VAR_OR_VALUE_TYPES"].all, null, null, null, true));
  21887. renderExpression(command, function_obj, expression_div);
  21888. break;
  21889. case "operator":
  21890. command.expression.splice($selectedItem.data('index'), 0, _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].plus);
  21891. renderExpression(command, function_obj, expression_div);
  21892. break;
  21893. case "parentheses":
  21894. command.expression.splice($selectedItem.data('index'), 0, "(");
  21895. command.expression.splice($selectedItem.data('index') + 1, 0, new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_variable_value_menu__WEBPACK_IMPORTED_MODULE_6__["VAR_OR_VALUE_TYPES"].all, null, null, null, true));
  21896. command.expression.splice($selectedItem.data('index') + 2, 0, ")");
  21897. renderExpression(command, function_obj, expression_div);
  21898. break;
  21899. }
  21900. }
  21901. });
  21902. }
  21903. }
  21904. function addHandlers(command, function_obj, attribution_dom) {
  21905. attribution_dom.find('.button_remove_command').on('click', function () {
  21906. if (_commands__WEBPACK_IMPORTED_MODULE_7__["removeCommand"](command, function_obj, attribution_dom)) {
  21907. attribution_dom.fadeOut(400, function () {
  21908. attribution_dom.remove();
  21909. });
  21910. }
  21911. });
  21912. attribution_dom.find('.button_refresh_attribution').on('click', function () {
  21913. renderExpressionElements(command, function_obj, attribution_dom);
  21914. });
  21915. }
  21916. function renderMenuOperations(command, ref_object, dom_object, menu_var_or_value, function_obj, variable_selected) {
  21917. /*console.log("recebido o seguinte DOM: ");
  21918. console.log(dom_object);
  21919. if (dom_object.hasClass('var_attributed')) {
  21920. return;
  21921. } else {
  21922. var hier = dom_object.parentsUntil(".command_container");
  21923. for (var i = 0; i < hier.length; i++) {
  21924. if ($(hier[i]).hasClass('var_attributed') || $(hier[i]).hasClass('parameters_function_called')) {
  21925. return;
  21926. }
  21927. }
  21928. }
  21929. dom_object.find('.context_menu_clear').remove();
  21930. var menu_operations = '<div class="ui dropdown menu_operations"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
  21931. for (var tm in Models.ARITHMETIC_TYPES) {
  21932. menu_operations += '<div class="item" data-option="'+tm+'">'+LocalizedStrings.getUI('btn_arithmetic_' + tm)+'</div>';
  21933. }
  21934. menu_operations += '<div class="item" data-option="clear">'+LocalizedStrings.getUI('btn_clear')+'</div>';
  21935. menu_operations += '</div></div>';
  21936. menu_operations = $(menu_operations);
  21937. dom_object.append(menu_operations);
  21938. menu_operations.dropdown({
  21939. onChange: function(value, text, $selectedItem) {
  21940. switch ($($selectedItem).data('option')) {
  21941. case "clear":
  21942. $(dom_object).text('');
  21943. VariableValueMenu.renderMenu(command, ref_object, dom_object, function_obj);
  21944. break;
  21945. default:
  21946. createExpressionAround(command, ref_object, dom_object, function_obj);
  21947. menu_operations.find('.text').text('');
  21948. }
  21949. }
  21950. });*/
  21951. }
  21952. function createExpressionAround(command, ref_object, dom_object, function_obj) {
  21953. jquery__WEBPACK_IMPORTED_MODULE_0___default()('<span> ( </span>').insertBefore(dom_object);
  21954. jquery__WEBPACK_IMPORTED_MODULE_0___default()('<span> ) </span>').insertAfter(dom_object);
  21955. _variable_value_menu__WEBPACK_IMPORTED_MODULE_6__["renderMenu"](command, new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_variable_value_menu__WEBPACK_IMPORTED_MODULE_6__["VAR_OR_VALUE_TYPES"].all, null, null, null, true), dom_object, function_obj);
  21956. }
  21957. /***/ }),
  21958. /***/ "./js/visualUI/commands/break.js":
  21959. /*!***************************************!*\
  21960. !*** ./js/visualUI/commands/break.js ***!
  21961. \***************************************/
  21962. /*! exports provided: createFloatingCommand, renderCommand */
  21963. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  21964. "use strict";
  21965. __webpack_require__.r(__webpack_exports__);
  21966. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createFloatingCommand", function() { return createFloatingCommand; });
  21967. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "renderCommand", function() { return renderCommand; });
  21968. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  21969. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_0__);
  21970. /* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  21971. /* harmony import */ var _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  21972. /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  21973. /* harmony import */ var _commands__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  21974. function createFloatingCommand() {
  21975. return jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="ui comment created_element"> <i class="ui icon small quote left"></i> <span> ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_break') + ' </span></div>');
  21976. }
  21977. function renderCommand(command, function_obj) {
  21978. var el = jquery__WEBPACK_IMPORTED_MODULE_0___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>' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_break') + '</span> </div>');
  21979. el.data('command', command);
  21980. addHandlers(command, function_obj, el);
  21981. return el;
  21982. }
  21983. function addHandlers(command, function_obj, break_dom) {
  21984. break_dom.find('.button_remove_command').on('click', function () {
  21985. if (_commands__WEBPACK_IMPORTED_MODULE_4__["removeCommand"](command, function_obj, break_dom)) {
  21986. break_dom.fadeOut(400, function () {
  21987. break_dom.remove();
  21988. });
  21989. }
  21990. });
  21991. }
  21992. /***/ }),
  21993. /***/ "./js/visualUI/commands/comment.js":
  21994. /*!*****************************************!*\
  21995. !*** ./js/visualUI/commands/comment.js ***!
  21996. \*****************************************/
  21997. /*! exports provided: createFloatingCommand, renderCommand */
  21998. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  21999. "use strict";
  22000. __webpack_require__.r(__webpack_exports__);
  22001. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createFloatingCommand", function() { return createFloatingCommand; });
  22002. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "renderCommand", function() { return renderCommand; });
  22003. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  22004. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_0__);
  22005. /* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  22006. /* harmony import */ var _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  22007. /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  22008. /* harmony import */ var _globals__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../globals */ "./js/visualUI/globals.js");
  22009. /* harmony import */ var _variables__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../variables */ "./js/visualUI/variables.js");
  22010. /* harmony import */ var _variable_value_menu__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  22011. /* harmony import */ var _commands__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  22012. function createFloatingCommand() {
  22013. return jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="ui comment created_element"> <i class="ui icon small quote left"></i> <span class="span_comment_text" "> ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_comment') + ' </span></div>');
  22014. }
  22015. function renderCommand(command, function_obj) {
  22016. var el = jquery__WEBPACK_IMPORTED_MODULE_0___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>');
  22017. el.data('command', command);
  22018. addHandlers(command, function_obj, el);
  22019. renderTextComment(command, function_obj, el);
  22020. return el;
  22021. }
  22022. function renderTextComment(command, function_obj, el) {
  22023. _variable_value_menu__WEBPACK_IMPORTED_MODULE_6__["renderMenu"](command, command.comment_text, el.find('.var_value_menu_div'), function_obj, 20);
  22024. }
  22025. function addHandlers(command, function_obj, comment_dom) {
  22026. comment_dom.find('.button_remove_command').on('click', function () {
  22027. if (_commands__WEBPACK_IMPORTED_MODULE_7__["removeCommand"](command, function_obj, comment_dom)) {
  22028. comment_dom.fadeOut(400, function () {
  22029. comment_dom.remove();
  22030. });
  22031. }
  22032. });
  22033. }
  22034. /***/ }),
  22035. /***/ "./js/visualUI/commands/conditional_expression.js":
  22036. /*!********************************************************!*\
  22037. !*** ./js/visualUI/commands/conditional_expression.js ***!
  22038. \********************************************************/
  22039. /*! exports provided: renderExpression */
  22040. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  22041. "use strict";
  22042. __webpack_require__.r(__webpack_exports__);
  22043. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "renderExpression", function() { return renderExpression; });
  22044. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  22045. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_0__);
  22046. /* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  22047. /* harmony import */ var _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  22048. /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  22049. /* harmony import */ var _globals__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../globals */ "./js/visualUI/globals.js");
  22050. /* harmony import */ var _variables__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../variables */ "./js/visualUI/variables.js");
  22051. /* harmony import */ var _variable_value_menu__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  22052. function renderExpression(command, expression, function_obj, initial_el_to_render) {
  22053. expression.dom_object = initial_el_to_render;
  22054. if (expression.expression == null || expression.expression.length < 1) {
  22055. renderStartMenu(command, expression, function_obj, initial_el_to_render);
  22056. } else {
  22057. var main_div = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="expression_elements"></div>');
  22058. switch (expression.expression.type) {
  22059. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_logic:
  22060. renderLogicExpression(command, expression, expression.expression, function_obj, main_div, initial_el_to_render);
  22061. break;
  22062. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_arithmetic:
  22063. renderArithmeticExpression(command, expression, expression.expression, function_obj, main_div);
  22064. break;
  22065. }
  22066. initial_el_to_render.append(main_div);
  22067. var restartMenu = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="ui restart_expression"><i class="ui icon undo"></i></div>');
  22068. initial_el_to_render.append(restartMenu);
  22069. restartMenu.on('click', function (e) {
  22070. expression.expression = null;
  22071. initial_el_to_render.empty();
  22072. renderExpression(command, expression, function_obj, initial_el_to_render);
  22073. });
  22074. }
  22075. }
  22076. function renderArithmeticOperator(command, all_expression, expression_arithmetic, arithmetic_operator, function_obj, element_to_append) {
  22077. var menu_operator = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="ui dropdown"><div class="text"></div><i class="dropdown icon"></i></div>');
  22078. menu_operator.dropdown({
  22079. values: [{
  22080. name: '>',
  22081. value: _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_COMPARISON"].greater_than,
  22082. selected: arithmetic_operator == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_COMPARISON"].greater_than
  22083. }, {
  22084. name: '<',
  22085. value: _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_COMPARISON"].less_than,
  22086. selected: arithmetic_operator == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_COMPARISON"].less_than
  22087. }, {
  22088. name: '==',
  22089. value: _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_COMPARISON"].equals_to,
  22090. selected: arithmetic_operator == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_COMPARISON"].equals_to
  22091. }, {
  22092. name: '!=',
  22093. value: _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_COMPARISON"].not_equals_to,
  22094. selected: arithmetic_operator == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_COMPARISON"].not_equals_to
  22095. }, {
  22096. name: '>=',
  22097. value: _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_COMPARISON"].greater_than_or_equals_to,
  22098. selected: arithmetic_operator == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_COMPARISON"].greater_than_or_equals_to
  22099. }, {
  22100. name: '<=',
  22101. value: _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_COMPARISON"].less_than_or_equals_to,
  22102. selected: arithmetic_operator == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_COMPARISON"].less_than_or_equals_to
  22103. }],
  22104. onChange: function onChange(value, text, $selectedItem) {
  22105. expression_arithmetic.operator = value;
  22106. }
  22107. });
  22108. element_to_append.append(menu_operator);
  22109. }
  22110. function renderLogicOperator(command, all_expression, expression_logic, logic_operator, function_obj, element_to_append, initial_el_to_render) {
  22111. var menu_operator = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="ui dropdown"><div class="text"></div><i class="dropdown icon"></i></div>');
  22112. menu_operator.dropdown({
  22113. values: [{
  22114. name: '==',
  22115. value: _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["LOGIC_COMPARISON"].equals_to,
  22116. selected: logic_operator == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["LOGIC_COMPARISON"].equals_to
  22117. }, {
  22118. name: '!=',
  22119. value: _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["LOGIC_COMPARISON"].not_equals_to,
  22120. selected: logic_operator == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["LOGIC_COMPARISON"].not_equals_to
  22121. }, {
  22122. name: '&&',
  22123. value: _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["LOGIC_COMPARISON"].and,
  22124. selected: logic_operator == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["LOGIC_COMPARISON"].and
  22125. }, {
  22126. name: '||',
  22127. value: _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["LOGIC_COMPARISON"].or,
  22128. selected: logic_operator == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["LOGIC_COMPARISON"].or
  22129. }],
  22130. onChange: function onChange(value, text, $selectedItem) {
  22131. if ($selectedItem) {
  22132. expression_logic.operator = value;
  22133. if (expression_logic.second_operand == null) {
  22134. expression_logic.second_operand = new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_variable_value_menu__WEBPACK_IMPORTED_MODULE_6__["VAR_OR_VALUE_TYPES"].all, null, null, null, true);
  22135. initial_el_to_render.empty();
  22136. renderExpression(command, all_expression, function_obj, initial_el_to_render);
  22137. }
  22138. }
  22139. }
  22140. });
  22141. element_to_append.append(menu_operator);
  22142. }
  22143. function renderLogicExpression(command, all_expression, expression_logic, function_obj, element_to_append, initial_el_to_render) {
  22144. var exp_el_par_1 = jquery__WEBPACK_IMPORTED_MODULE_0___default()(' <span class="span_command_spec"> </span> ');
  22145. var exp_el_expr_el_1 = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="expression_element"></div>');
  22146. var exp_el_expr_operand = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="expression_element"></div>');
  22147. var exp_el_expr_el_2 = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="expression_element"></div>');
  22148. var exp_el_par_2 = jquery__WEBPACK_IMPORTED_MODULE_0___default()(' <span class="span_command_spec"> </span> ');
  22149. if (expression_logic.first_operand.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_logic) {
  22150. renderLogicExpression(command, all_expression, expression_logic.first_operand, function_obj, exp_el_expr_el_1);
  22151. } else if (expression_logic.first_operand.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_arithmetic) {
  22152. renderArithmeticExpression(command, all_expression, expression_logic.first_operand, function_obj, exp_el_expr_el_1);
  22153. } else {
  22154. _variable_value_menu__WEBPACK_IMPORTED_MODULE_6__["renderMenu"](command, expression_logic.first_operand, exp_el_expr_el_1, function_obj);
  22155. }
  22156. element_to_append.append(exp_el_par_1);
  22157. element_to_append.append(exp_el_expr_el_1);
  22158. renderLogicOperator(command, all_expression, expression_logic, expression_logic.operator, function_obj, exp_el_expr_operand, initial_el_to_render);
  22159. element_to_append.append(exp_el_expr_operand);
  22160. if (expression_logic.second_operand) {
  22161. if (expression_logic.second_operand.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_logic) {
  22162. renderLogicExpression(command, all_expression, expression_logic.second_operand, function_obj, exp_el_expr_el_2);
  22163. } else if (expression_logic.second_operand.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_arithmetic) {
  22164. renderArithmeticExpression(command, all_expression, expression_logic.second_operand, function_obj, exp_el_expr_el_2);
  22165. } else {
  22166. _variable_value_menu__WEBPACK_IMPORTED_MODULE_6__["renderMenu"](command, expression_logic.second_operand, exp_el_expr_el_2, function_obj);
  22167. }
  22168. element_to_append.append(exp_el_expr_el_2);
  22169. }
  22170. element_to_append.append(exp_el_par_2);
  22171. }
  22172. function renderArithmeticExpression(command, all_expression, expression_arithmetic, function_obj, element_to_append) {
  22173. var exp_el_par_1 = jquery__WEBPACK_IMPORTED_MODULE_0___default()(' <span class="span_command_spec"> </span> ');
  22174. var exp_el_expr_el_1 = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="expression_element"></div>');
  22175. var exp_el_expr_operand = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="expression_element"></div>');
  22176. var exp_el_expr_el_2 = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="expression_element"></div>');
  22177. var exp_el_par_2 = jquery__WEBPACK_IMPORTED_MODULE_0___default()(' <span class="span_command_spec"> </span> ');
  22178. if (expression_arithmetic.first_operand.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_logic) {
  22179. renderLogicExpression(command, all_expression, expression_arithmetic.first_operand, function_obj, exp_el_expr_el_1);
  22180. } else if (expression_arithmetic.first_operand.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_arithmetic) {
  22181. renderArithmeticExpression(command, all_expression, expression_arithmetic.first_operand, function_obj, exp_el_expr_el_1);
  22182. } else {
  22183. _variable_value_menu__WEBPACK_IMPORTED_MODULE_6__["renderMenu"](command, expression_arithmetic.first_operand, exp_el_expr_el_1, function_obj);
  22184. }
  22185. if (expression_arithmetic.second_operand.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_logic) {
  22186. renderLogicExpression(command, all_expression, expression_arithmetic.second_operand, function_obj, exp_el_expr_el_2);
  22187. } else if (expression_arithmetic.second_operand.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_arithmetic) {
  22188. renderArithmeticExpression(command, all_expression, expression_arithmetic.second_operand, function_obj, exp_el_expr_el_2);
  22189. } else {
  22190. _variable_value_menu__WEBPACK_IMPORTED_MODULE_6__["renderMenu"](command, expression_arithmetic.second_operand, exp_el_expr_el_2, function_obj);
  22191. }
  22192. renderArithmeticOperator(command, all_expression, expression_arithmetic, expression_arithmetic.operator, function_obj, exp_el_expr_operand);
  22193. element_to_append.append(exp_el_par_1);
  22194. element_to_append.append(exp_el_expr_el_1);
  22195. element_to_append.append(exp_el_expr_operand);
  22196. element_to_append.append(exp_el_expr_el_2);
  22197. element_to_append.append(exp_el_par_2);
  22198. }
  22199. function renderStartMenu(command, expression, function_obj, initial_el_to_render) {
  22200. var start_menu = '';
  22201. start_menu += '<div class="ui dropdown menu_start_rendered"><div class="text"><i>' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('expression_menu_select') + '</i></div><i class="dropdown icon"></i><div class="menu">';
  22202. start_menu += '<div class="item" data-exp="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_logic + '">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_logic_expression') + ' (EL == EL and EL)</div>';
  22203. start_menu += '<div class="item" data-exp="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_arithmetic + '">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_arithmetic_expression') + ' (EA < EA)</div>';
  22204. start_menu += '</div></div>';
  22205. start_menu = jquery__WEBPACK_IMPORTED_MODULE_0___default()(start_menu);
  22206. start_menu.dropdown({
  22207. onChange: function onChange(value, text, $selectedItem) {
  22208. switch ($selectedItem.data('exp')) {
  22209. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_logic:
  22210. expression.expression = new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["LogicExpression"](false, new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_variable_value_menu__WEBPACK_IMPORTED_MODULE_6__["VAR_OR_VALUE_TYPES"].all, null, null, null, true));
  22211. break;
  22212. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_arithmetic:
  22213. expression.expression = new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ArithmeticExpression"](new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_variable_value_menu__WEBPACK_IMPORTED_MODULE_6__["VAR_OR_VALUE_TYPES"].all, null, null, null, true), new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_variable_value_menu__WEBPACK_IMPORTED_MODULE_6__["VAR_OR_VALUE_TYPES"].all, null, null, null, true), _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_COMPARISON"].less_than);
  22214. break;
  22215. }
  22216. initial_el_to_render.html('');
  22217. renderExpression(command, expression, function_obj, initial_el_to_render);
  22218. },
  22219. selectOnKeydown: false
  22220. });
  22221. initial_el_to_render.append(' <span class="span_command_spec"> </span> ');
  22222. initial_el_to_render.append(start_menu);
  22223. initial_el_to_render.append(' <span class="span_command_spec"> </span> ');
  22224. }
  22225. /***/ }),
  22226. /***/ "./js/visualUI/commands/contextualized_menu.js":
  22227. /*!*****************************************************!*\
  22228. !*** ./js/visualUI/commands/contextualized_menu.js ***!
  22229. \*****************************************************/
  22230. /*! exports provided: renderMenu */
  22231. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  22232. "use strict";
  22233. __webpack_require__.r(__webpack_exports__);
  22234. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "renderMenu", function() { return renderMenu; });
  22235. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  22236. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_0__);
  22237. /* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  22238. /* harmony import */ var _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  22239. /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  22240. /* harmony import */ var _commands__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  22241. /* harmony import */ var _variable_value_menu__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  22242. /* harmony import */ var _switch__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./switch */ "./js/visualUI/commands/switch.js");
  22243. /* harmony import */ var _repeatNtimes__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./repeatNtimes */ "./js/visualUI/commands/repeatNtimes.js");
  22244. function renderMenu(command, dom_where_render, function_obj, dom_command) {
  22245. var menu_div = '<div class="ui dropdown menu_commands" ><i class="icon code"></i> <div class="menu"> ';
  22246. if (command.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].repeatNtimes || command.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].whiletrue || command.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].dowhiletrue) {
  22247. menu_div += '<a class="item" data-command="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].break + '"><i class="download icon"></i> ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('btn_break') + ' </a>';
  22248. } else {
  22249. menu_div += '<a class="item" data-command="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].break + '"><i class="download icon"></i> ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('btn_break') + ' </a>';
  22250. menu_div += '<a class="item" data-command="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].switchcase + '"><i class="download icon"></i> ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('btn_case') + ' </a>';
  22251. }
  22252. menu_div += '</div></div>';
  22253. menu_div = jquery__WEBPACK_IMPORTED_MODULE_0___default()(menu_div);
  22254. dom_where_render.append(menu_div);
  22255. addHandlers(command, dom_where_render, function_obj, dom_command);
  22256. }
  22257. function addHandlers(command, dom_where_render, function_obj, dom_command) {
  22258. dom_where_render.find('.menu_commands').dropdown({
  22259. on: 'hover'
  22260. });
  22261. dom_where_render.find('.menu_commands a').on('click', function (evt) {
  22262. if (command.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].repeatNtimes || command.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].whiletrue || command.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].dowhiletrue) {
  22263. if (command.commands_block == null || command.commands_block.length == 0) {
  22264. command.commands_block = [];
  22265. var new_cmd = _commands__WEBPACK_IMPORTED_MODULE_4__["genericCreateCommand"](jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).data('command'));
  22266. command.commands_block.push(new_cmd);
  22267. _commands__WEBPACK_IMPORTED_MODULE_4__["renderCommand"](new_cmd, dom_command.find('.block_commands'), 3, function_obj);
  22268. } else {
  22269. _commands__WEBPACK_IMPORTED_MODULE_4__["createFloatingCommand"](function_obj, dom_command.find('.block_commands'), jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).data('command'), evt);
  22270. }
  22271. } else {
  22272. switch (jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).data('command')) {
  22273. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].break:
  22274. _commands__WEBPACK_IMPORTED_MODULE_4__["createFloatingCommand"](function_obj, dom_command.find('.block_commands'), jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).data('command'), evt);
  22275. break;
  22276. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].switchcase:
  22277. addCaseToSwitch(command, dom_where_render, function_obj, dom_command);
  22278. break;
  22279. }
  22280. }
  22281. });
  22282. }
  22283. function addCaseToSwitch(command, dom_where_render, function_obj, dom_command) {
  22284. if (command.cases == null) {
  22285. command.cases = [];
  22286. }
  22287. var sc = new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SwitchCase"](new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_variable_value_menu__WEBPACK_IMPORTED_MODULE_5__["VAR_OR_VALUE_TYPES"].all, null, null, null, true));
  22288. command.cases.push(sc);
  22289. _switch__WEBPACK_IMPORTED_MODULE_6__["renderCase"](sc, command, function_obj, dom_command.find('.all_cases_div'));
  22290. }
  22291. /***/ }),
  22292. /***/ "./js/visualUI/commands/dowhiletrue.js":
  22293. /*!*********************************************!*\
  22294. !*** ./js/visualUI/commands/dowhiletrue.js ***!
  22295. \*********************************************/
  22296. /*! exports provided: createFloatingCommand, renderCommand */
  22297. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  22298. "use strict";
  22299. __webpack_require__.r(__webpack_exports__);
  22300. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createFloatingCommand", function() { return createFloatingCommand; });
  22301. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "renderCommand", function() { return renderCommand; });
  22302. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  22303. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_0__);
  22304. /* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  22305. /* harmony import */ var _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  22306. /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  22307. /* harmony import */ var _globals__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../globals */ "./js/visualUI/globals.js");
  22308. /* harmony import */ var _variables__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../variables */ "./js/visualUI/variables.js");
  22309. /* harmony import */ var _commands__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  22310. /* harmony import */ var _conditional_expression__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./conditional_expression */ "./js/visualUI/commands/conditional_expression.js");
  22311. /* harmony import */ var _contextualized_menu__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./contextualized_menu */ "./js/visualUI/commands/contextualized_menu.js");
  22312. function createFloatingCommand() {
  22313. return jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="ui dowhiletrue created_element"> <i class="ui icon small sync"></i> <span> ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_command_do') + ' <br> ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_code_while') + '(x < 10) </span></div>');
  22314. }
  22315. function renderCommand(command, function_obj) {
  22316. var ret = '';
  22317. ret += '<div class="ui dowhiletrue command_container"> <i class="ui icon small sync command_drag"></i> <i class="ui icon times red button_remove_command"></i> <div class="ui context_menu"></div> <span class="span_command_spec"> ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_command_do') + ' </span>';
  22318. ret += '<div class="ui block_commands" data-subblock="" data-idcommand="">';
  22319. ret += '</div>';
  22320. ret += ' <span class="span_command_spec"> ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_code_while') + ' </span> <span class="span_command_spec"> ( </span> <div class="conditional_expression"></div> <span class="span_command_spec"> ) </span>';
  22321. ret += '</div>';
  22322. var el = jquery__WEBPACK_IMPORTED_MODULE_0___default()(ret);
  22323. el.data('command', command);
  22324. el.find('.block_commands').data('command', command);
  22325. addHandlers(command, function_obj, el);
  22326. _contextualized_menu__WEBPACK_IMPORTED_MODULE_8__["renderMenu"](command, el.find('.context_menu'), function_obj, el);
  22327. _conditional_expression__WEBPACK_IMPORTED_MODULE_7__["renderExpression"](command, command.expression, function_obj, el.find('.conditional_expression'));
  22328. if (command.commands_block) {
  22329. for (var j = 0; j < command.commands_block.length; j++) {
  22330. _commands__WEBPACK_IMPORTED_MODULE_6__["renderCommand"](command.commands_block[j], jquery__WEBPACK_IMPORTED_MODULE_0___default()(el.find('.block_commands')[0]), 3, function_obj);
  22331. }
  22332. }
  22333. return el;
  22334. }
  22335. function addHandlers(command, function_obj, dowhiletrue_dom) {
  22336. dowhiletrue_dom.find('.button_remove_command').on('click', function () {
  22337. if (_commands__WEBPACK_IMPORTED_MODULE_6__["removeCommand"](command, function_obj, dowhiletrue_dom)) {
  22338. dowhiletrue_dom.fadeOut(400, function () {
  22339. dowhiletrue_dom.remove();
  22340. });
  22341. }
  22342. });
  22343. }
  22344. /***/ }),
  22345. /***/ "./js/visualUI/commands/functioncall.js":
  22346. /*!**********************************************!*\
  22347. !*** ./js/visualUI/commands/functioncall.js ***!
  22348. \**********************************************/
  22349. /*! exports provided: createFloatingCommand, renderCommand */
  22350. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  22351. "use strict";
  22352. __webpack_require__.r(__webpack_exports__);
  22353. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createFloatingCommand", function() { return createFloatingCommand; });
  22354. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "renderCommand", function() { return renderCommand; });
  22355. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  22356. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_0__);
  22357. /* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  22358. /* harmony import */ var _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  22359. /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  22360. /* harmony import */ var _globals__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../globals */ "./js/visualUI/globals.js");
  22361. /* harmony import */ var _variables__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../variables */ "./js/visualUI/variables.js");
  22362. /* harmony import */ var _variable_value_menu__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  22363. /* harmony import */ var _commands__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  22364. function createFloatingCommand() {
  22365. return jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="ui functioncall created_element"> <i class="hand point right icon"></i> <span> funcao() </span></div>');
  22366. }
  22367. function renderCommand(command, function_obj) {
  22368. var el = jquery__WEBPACK_IMPORTED_MODULE_0___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>');
  22369. el.data('command', command);
  22370. _variable_value_menu__WEBPACK_IMPORTED_MODULE_6__["renderMenu"](command, command.function_called, el.find('.var_value_menu_div'), function_obj);
  22371. addHandlers(command, function_obj, el);
  22372. return el;
  22373. }
  22374. function addHandlers(command, function_obj, functioncall_dom) {
  22375. functioncall_dom.find('.button_remove_command').on('click', function () {
  22376. if (_commands__WEBPACK_IMPORTED_MODULE_7__["removeCommand"](command, function_obj, functioncall_dom)) {
  22377. functioncall_dom.fadeOut(400, function () {
  22378. functioncall_dom.remove();
  22379. });
  22380. }
  22381. });
  22382. }
  22383. /***/ }),
  22384. /***/ "./js/visualUI/commands/iftrue.js":
  22385. /*!****************************************!*\
  22386. !*** ./js/visualUI/commands/iftrue.js ***!
  22387. \****************************************/
  22388. /*! exports provided: createFloatingCommand, renderCommand */
  22389. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  22390. "use strict";
  22391. __webpack_require__.r(__webpack_exports__);
  22392. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createFloatingCommand", function() { return createFloatingCommand; });
  22393. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "renderCommand", function() { return renderCommand; });
  22394. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  22395. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_0__);
  22396. /* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  22397. /* harmony import */ var _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  22398. /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  22399. /* harmony import */ var _globals__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../globals */ "./js/visualUI/globals.js");
  22400. /* harmony import */ var _variables__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../variables */ "./js/visualUI/variables.js");
  22401. /* harmony import */ var _commands__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  22402. /* harmony import */ var _conditional_expression__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./conditional_expression */ "./js/visualUI/commands/conditional_expression.js");
  22403. function createFloatingCommand() {
  22404. return jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="ui iftrue created_element"> <i class="ui icon small random"></i> <span> if (x < 1) { } </span></div>');
  22405. }
  22406. function renderCommand(command, function_obj) {
  22407. var ret = '';
  22408. 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>';
  22409. ret += '<span class="span_command_spec"> ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_if') + '</span>';
  22410. ret += ' <span class="span_command_spec"> ( </span> <div class="conditional_expression"></div> <span class="span_command_spec"> ) </span>';
  22411. ret += '<span> </span> ';
  22412. ret += '<div class="ui block_commands commands_if conditional_comands_block" data-if="true">';
  22413. ret += '</div></div>';
  22414. ret += '<div class="ui data_block_else" data-else="true"> <span class="span_command_spec"> ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_else') + ' </span>';
  22415. ret += '<div class="ui block_commands commands_else conditional_comands_block" data-else="true">';
  22416. ret += '</div>';
  22417. ret += '<span></span></div>';
  22418. ret += '</div>';
  22419. var el = jquery__WEBPACK_IMPORTED_MODULE_0___default()(ret);
  22420. el.data('command', command);
  22421. el.find('.block_commands').data('command', command);
  22422. el.find('.data_block_if').data('command', command);
  22423. el.find('.data_block_else').data('command', command);
  22424. el.find('.commands_if').data('command', command);
  22425. addHandlers(command, function_obj, el);
  22426. _conditional_expression__WEBPACK_IMPORTED_MODULE_7__["renderExpression"](command, command.expression, function_obj, el.find('.conditional_expression'));
  22427. if (command.commands_block) {
  22428. for (var j = 0; j < command.commands_block.length; j++) {
  22429. _commands__WEBPACK_IMPORTED_MODULE_6__["renderCommand"](command.commands_block[j], jquery__WEBPACK_IMPORTED_MODULE_0___default()(el.find('.commands_if')[0]), 3, function_obj);
  22430. }
  22431. }
  22432. if (command.commands_else) {
  22433. for (var j = 0; j < command.commands_else.length; j++) {
  22434. _commands__WEBPACK_IMPORTED_MODULE_6__["renderCommand"](command.commands_else[j], jquery__WEBPACK_IMPORTED_MODULE_0___default()(el.find('.commands_else')[0]), 3, function_obj);
  22435. }
  22436. }
  22437. return el;
  22438. }
  22439. function addHandlers(command, function_obj, iftrue_dom) {
  22440. iftrue_dom.find('.button_remove_command').on('click', function () {
  22441. if (_commands__WEBPACK_IMPORTED_MODULE_6__["removeCommand"](command, function_obj, iftrue_dom)) {
  22442. iftrue_dom.fadeOut(400, function () {
  22443. iftrue_dom.remove();
  22444. });
  22445. }
  22446. });
  22447. }
  22448. /***/ }),
  22449. /***/ "./js/visualUI/commands/reader.js":
  22450. /*!****************************************!*\
  22451. !*** ./js/visualUI/commands/reader.js ***!
  22452. \****************************************/
  22453. /*! exports provided: createFloatingCommand, renderCommand */
  22454. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  22455. "use strict";
  22456. __webpack_require__.r(__webpack_exports__);
  22457. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createFloatingCommand", function() { return createFloatingCommand; });
  22458. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "renderCommand", function() { return renderCommand; });
  22459. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  22460. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_0__);
  22461. /* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  22462. /* harmony import */ var _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  22463. /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  22464. /* harmony import */ var _globals__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../globals */ "./js/visualUI/globals.js");
  22465. /* harmony import */ var _variables__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../variables */ "./js/visualUI/variables.js");
  22466. /* harmony import */ var _variable_value_menu__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  22467. /* harmony import */ var _commands__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  22468. function createFloatingCommand() {
  22469. return jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="ui reader created_element"> <i class="ui icon small download"></i> <span> ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_command_read') + ' var </span></div>');
  22470. }
  22471. function renderCommand(command, function_obj) {
  22472. 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">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_command_read') + ' ( </span> <div class="var_value_menu_div"></div> <span class="close_parentheses span_command_spec">)</span> </div>';
  22473. el = jquery__WEBPACK_IMPORTED_MODULE_0___default()(el);
  22474. el.data('command', command);
  22475. _variable_value_menu__WEBPACK_IMPORTED_MODULE_6__["renderMenu"](command, command.variable_value_menu, el.find('.var_value_menu_div'), function_obj);
  22476. addHandlers(command, function_obj, el);
  22477. return el;
  22478. }
  22479. function addHandlers(command, function_obj, reader_dom) {
  22480. reader_dom.find('.button_remove_command').on('click', function () {
  22481. if (_commands__WEBPACK_IMPORTED_MODULE_7__["removeCommand"](command, function_obj, reader_dom)) {
  22482. reader_dom.fadeOut(400, function () {
  22483. reader_dom.remove();
  22484. });
  22485. }
  22486. });
  22487. }
  22488. /***/ }),
  22489. /***/ "./js/visualUI/commands/repeatNtimes.js":
  22490. /*!**********************************************!*\
  22491. !*** ./js/visualUI/commands/repeatNtimes.js ***!
  22492. \**********************************************/
  22493. /*! exports provided: createFloatingCommand, renderCommand, manageExpressionElements, manageClearExpressionElements */
  22494. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  22495. "use strict";
  22496. __webpack_require__.r(__webpack_exports__);
  22497. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createFloatingCommand", function() { return createFloatingCommand; });
  22498. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "renderCommand", function() { return renderCommand; });
  22499. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "manageExpressionElements", function() { return manageExpressionElements; });
  22500. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "manageClearExpressionElements", function() { return manageClearExpressionElements; });
  22501. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  22502. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_0__);
  22503. /* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  22504. /* harmony import */ var _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  22505. /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  22506. /* harmony import */ var _globals__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../globals */ "./js/visualUI/globals.js");
  22507. /* harmony import */ var _variables__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../variables */ "./js/visualUI/variables.js");
  22508. /* harmony import */ var _commands__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  22509. /* harmony import */ var _conditional_expression__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./conditional_expression */ "./js/visualUI/commands/conditional_expression.js");
  22510. /* harmony import */ var _variable_value_menu__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  22511. /* harmony import */ var _contextualized_menu__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./contextualized_menu */ "./js/visualUI/commands/contextualized_menu.js");
  22512. function createFloatingCommand() {
  22513. return jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="ui repeatNtimes created_element"> <i class="ui icon small sync"></i> <span> para (x = 0; x < 10; x ++) <br> </span></div>');
  22514. }
  22515. function renderCommand(command, function_obj) {
  22516. var ret = '<div class="ui repeatNtimes command_container"> <i class="ui icon small sync command_drag"></i> <i class="ui icon times red button_remove_command"></i> <div class="ui context_menu"></div> <span class="span_command_spec"> ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["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>';
  22517. ret += '<div class="ui block_commands">';
  22518. ret += '</div>';
  22519. ret += '<span> </span>';
  22520. ret += '</div>';
  22521. var el = jquery__WEBPACK_IMPORTED_MODULE_0___default()(ret);
  22522. el.data('command', command);
  22523. el.find('.block_commands').data('command', command);
  22524. addHandlers(command, function_obj, el);
  22525. _contextualized_menu__WEBPACK_IMPORTED_MODULE_9__["renderMenu"](command, el.find('.context_menu'), function_obj, el);
  22526. _variable_value_menu__WEBPACK_IMPORTED_MODULE_8__["renderMenu"](command, command.var_attribution, el.find('.variable_attribution'), function_obj);
  22527. _conditional_expression__WEBPACK_IMPORTED_MODULE_7__["renderExpression"](command, command.expression2, function_obj, el.find('.conditional_expression'));
  22528. _variable_value_menu__WEBPACK_IMPORTED_MODULE_8__["renderMenu"](command, command.var_incrementation, el.find('.incrementation_variable'), function_obj);
  22529. if (command.expression1) {
  22530. el.find('.text_receives').text(_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_receives'));
  22531. _variable_value_menu__WEBPACK_IMPORTED_MODULE_8__["renderMenu"](command, command.expression1, el.find('.var_value_expression'), function_obj);
  22532. }
  22533. if (command.expression3) {
  22534. el.find('.text_inc_receives').text(_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_receives'));
  22535. _variable_value_menu__WEBPACK_IMPORTED_MODULE_8__["renderMenu"](command, command.expression3.itens[0], el.find('.first_operand'), function_obj);
  22536. renderOperator(command, function_obj, el.find('.operator'), command.expression3, 1);
  22537. _variable_value_menu__WEBPACK_IMPORTED_MODULE_8__["renderMenu"](command, command.expression3.itens[2], el.find('.second_operand'), function_obj);
  22538. }
  22539. if (command.commands_block) {
  22540. for (var j = 0; j < command.commands_block.length; j++) {
  22541. _commands__WEBPACK_IMPORTED_MODULE_6__["renderCommand"](command.commands_block[j], jquery__WEBPACK_IMPORTED_MODULE_0___default()(el.find('.block_commands')[0]), 3, function_obj);
  22542. }
  22543. }
  22544. return el;
  22545. }
  22546. function manageExpressionElements(command, ref_object, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element) {
  22547. if (dom_object.hasClass('variable_attribution')) {
  22548. if (!command.expression3) {
  22549. var exp = new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ExpressionElement"](_ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_ELEMENTS"].exp_op_exp, [command.var_attribution, _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].plus, new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_variable_value_menu__WEBPACK_IMPORTED_MODULE_8__["VAR_OR_VALUE_TYPES"].all, "1", null, null, true)]);
  22550. command.expression3 = exp;
  22551. command.var_incrementation = command.var_attribution;
  22552. var cond_exp = new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ArithmeticExpression"](command.var_attribution, new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_variable_value_menu__WEBPACK_IMPORTED_MODULE_8__["VAR_OR_VALUE_TYPES"].all, null, null, null, true), _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_COMPARISON"].less_than);
  22553. command.expression2.expression = cond_exp;
  22554. }
  22555. dom_object.parent().find('.text_receives').text(_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_receives'));
  22556. command.expression1 = new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_variable_value_menu__WEBPACK_IMPORTED_MODULE_8__["VAR_OR_VALUE_TYPES"].all, "0", null, null, true);
  22557. dom_object.parent().find('.var_value_expression').empty();
  22558. _variable_value_menu__WEBPACK_IMPORTED_MODULE_8__["renderMenu"](command, command.expression1, dom_object.parent().find('.var_value_expression'), function_obj);
  22559. renderAlgorithm();
  22560. }
  22561. if (dom_object.hasClass('incrementation_variable')) {
  22562. dom_object.parent().find('.text_inc_receives').text(_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_receives'));
  22563. var exp = new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ExpressionElement"](_ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_ELEMENTS"].exp_op_exp, [new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_variable_value_menu__WEBPACK_IMPORTED_MODULE_8__["VAR_OR_VALUE_TYPES"].all, null, null, null, true), _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].plus, new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_variable_value_menu__WEBPACK_IMPORTED_MODULE_8__["VAR_OR_VALUE_TYPES"].all, null, null, null, true)]);
  22564. command.expression3 = exp;
  22565. _variable_value_menu__WEBPACK_IMPORTED_MODULE_8__["renderMenu"](command, command.expression3.itens[0], dom_object.parent().find('.first_operand'), function_obj);
  22566. renderOperator(command, function_obj, dom_object.parent().find('.operator'), command.expression3, 1);
  22567. _variable_value_menu__WEBPACK_IMPORTED_MODULE_8__["renderMenu"](command, command.expression3.itens[2], dom_object.parent().find('.second_operand'), function_obj);
  22568. }
  22569. }
  22570. function manageClearExpressionElements(command, ref_object, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element) {
  22571. if (dom_object.hasClass('variable_attribution')) {
  22572. jquery__WEBPACK_IMPORTED_MODULE_0___default()(dom_object).parent().find('.text_receives').text('');
  22573. command.expression1 = null;
  22574. jquery__WEBPACK_IMPORTED_MODULE_0___default()(dom_object).parent().find('.var_value_expression').empty();
  22575. }
  22576. if (dom_object.hasClass('incrementation_variable')) {
  22577. jquery__WEBPACK_IMPORTED_MODULE_0___default()(dom_object).parent().find('.text_inc_receives').text('');
  22578. command.expression3 = null;
  22579. jquery__WEBPACK_IMPORTED_MODULE_0___default()(dom_object).parent().find('.first_operand').empty();
  22580. jquery__WEBPACK_IMPORTED_MODULE_0___default()(dom_object).parent().find('.operator').empty();
  22581. jquery__WEBPACK_IMPORTED_MODULE_0___default()(dom_object).parent().find('.second_operand').empty();
  22582. }
  22583. }
  22584. function addHandlers(command, function_obj, repeatNtimes_dom) {
  22585. repeatNtimes_dom.find('.button_remove_command').on('click', function () {
  22586. if (_commands__WEBPACK_IMPORTED_MODULE_6__["removeCommand"](command, function_obj, repeatNtimes_dom)) {
  22587. repeatNtimes_dom.fadeOut(400, function () {
  22588. repeatNtimes_dom.remove();
  22589. });
  22590. }
  22591. });
  22592. }
  22593. function renderOperator(command, function_obj, temp_op, expression_element, index_op) {
  22594. var menu_operator = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="ui dropdown"><div class="text"></div></div>');
  22595. menu_operator.dropdown({
  22596. values: [{
  22597. name: '+',
  22598. value: _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].plus,
  22599. selected: expression_element.itens[index_op] == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].plus
  22600. }, {
  22601. name: '-',
  22602. value: _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].minus,
  22603. selected: expression_element.itens[index_op] == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].minus
  22604. }, {
  22605. name: '*',
  22606. value: _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].multiplication,
  22607. selected: expression_element.itens[index_op] == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].multiplication
  22608. }, {
  22609. name: '/',
  22610. value: _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].division,
  22611. selected: expression_element.itens[index_op] == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].division
  22612. }, {
  22613. name: '%',
  22614. value: _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].module,
  22615. selected: expression_element.itens[index_op] == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].module
  22616. }],
  22617. onChange: function onChange(value, text, $selectedItem) {
  22618. expression_element.itens[index_op] = value;
  22619. }
  22620. });
  22621. temp_op.append(menu_operator);
  22622. }
  22623. /***/ }),
  22624. /***/ "./js/visualUI/commands/return.js":
  22625. /*!****************************************!*\
  22626. !*** ./js/visualUI/commands/return.js ***!
  22627. \****************************************/
  22628. /*! exports provided: createFloatingCommand, renderCommand */
  22629. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  22630. "use strict";
  22631. __webpack_require__.r(__webpack_exports__);
  22632. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createFloatingCommand", function() { return createFloatingCommand; });
  22633. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "renderCommand", function() { return renderCommand; });
  22634. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  22635. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_0__);
  22636. /* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  22637. /* harmony import */ var _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  22638. /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  22639. /* harmony import */ var _globals__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../globals */ "./js/visualUI/globals.js");
  22640. /* harmony import */ var _variables__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../variables */ "./js/visualUI/variables.js");
  22641. /* harmony import */ var _variable_value_menu__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  22642. /* harmony import */ var _commands__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  22643. function createFloatingCommand() {
  22644. return jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="ui return created_element"> <i class="ui icon small reply"></i> <span> ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_return') + ' </span></div>');
  22645. }
  22646. function renderCommand(command, function_obj) {
  22647. var el = jquery__WEBPACK_IMPORTED_MODULE_0___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"> ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_return') + ' </span> <div class="var_value_menu_div"></div></div>');
  22648. el.data('command', command);
  22649. addHandlers(command, function_obj, el);
  22650. if (function_obj.return_type != _types__WEBPACK_IMPORTED_MODULE_1__["Types"].VOID) {
  22651. _variable_value_menu__WEBPACK_IMPORTED_MODULE_6__["renderMenu"](command, command.variable_value_menu, el.find('.var_value_menu_div'), function_obj);
  22652. } else {
  22653. el.find('.var_value_menu_div').remove();
  22654. command.variable_value_menu = null;
  22655. }
  22656. return el;
  22657. }
  22658. function addHandlers(command, function_obj, return_dom) {
  22659. return_dom.find('.button_remove_command').on('click', function () {
  22660. if (_commands__WEBPACK_IMPORTED_MODULE_7__["removeCommand"](command, function_obj, return_dom)) {
  22661. return_dom.fadeOut(400, function () {
  22662. return_dom.remove();
  22663. });
  22664. }
  22665. });
  22666. }
  22667. /***/ }),
  22668. /***/ "./js/visualUI/commands/switch.js":
  22669. /*!****************************************!*\
  22670. !*** ./js/visualUI/commands/switch.js ***!
  22671. \****************************************/
  22672. /*! exports provided: createFloatingCommand, renderCommand, renderCase */
  22673. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  22674. "use strict";
  22675. __webpack_require__.r(__webpack_exports__);
  22676. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createFloatingCommand", function() { return createFloatingCommand; });
  22677. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "renderCommand", function() { return renderCommand; });
  22678. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "renderCase", function() { return renderCase; });
  22679. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  22680. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_0__);
  22681. /* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  22682. /* harmony import */ var _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  22683. /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  22684. /* harmony import */ var _globals__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../globals */ "./js/visualUI/globals.js");
  22685. /* harmony import */ var _variables__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../variables */ "./js/visualUI/variables.js");
  22686. /* harmony import */ var _commands__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  22687. /* harmony import */ var _variable_value_menu__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  22688. /* harmony import */ var _contextualized_menu__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./contextualized_menu */ "./js/visualUI/commands/contextualized_menu.js");
  22689. function createFloatingCommand() {
  22690. return jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="ui switch created_element"> <i class="ui icon small random"></i> <span> ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_code_switch') + ' ( x ) { <br> ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_code_case') + ' 1: <br> ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_code_case') + ' 2: <br> } </span></div>');
  22691. }
  22692. function renderCommand(command, function_obj) {
  22693. var ret = '';
  22694. 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> ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_code_switch') + ' ( <div class="ui variable_to_switch"></div> ) <div class="ui all_cases_div"></div></span>';
  22695. ret += '</div>';
  22696. var el = jquery__WEBPACK_IMPORTED_MODULE_0___default()(ret);
  22697. el.data('command', command);
  22698. addHandlers(command, function_obj, el);
  22699. _contextualized_menu__WEBPACK_IMPORTED_MODULE_8__["renderMenu"](command, el.find('.context_menu'), function_obj, el);
  22700. _variable_value_menu__WEBPACK_IMPORTED_MODULE_7__["renderMenu"](command, command.variable, el.find('.variable_to_switch'), function_obj);
  22701. if (command.cases) {
  22702. for (var i = 0; i < command.cases.length; i++) {
  22703. renderCase(command.cases[i], command, function_obj, el.find('.all_cases_div'));
  22704. }
  22705. }
  22706. return el;
  22707. }
  22708. function renderCase(switchcase, command, function_obj, el) {
  22709. var casediv = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="ui case_div"><i class="ui icon times red button_remove_command"></i><span>' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_code_case') + '</span> <div class="ui variable_case"></div>: <div class="case_commands_block"></div></div>');
  22710. _variable_value_menu__WEBPACK_IMPORTED_MODULE_7__["renderMenu"](command, switchcase.variable_value_menu, casediv.find('.variable_case'), function_obj);
  22711. casediv.data('switchcase', switchcase);
  22712. casediv.find('.case_commands_block').data('switchcase', switchcase);
  22713. el.append(casediv);
  22714. if (switchcase.commands_block) {
  22715. for (var j = 0; j < switchcase.commands_block.length; j++) {
  22716. _commands__WEBPACK_IMPORTED_MODULE_6__["renderCommand"](switchcase.commands_block[j], jquery__WEBPACK_IMPORTED_MODULE_0___default()(casediv.find('.case_commands_block')[0]), 3, function_obj);
  22717. }
  22718. }
  22719. casediv.find('.button_remove_command').on('click', function () {
  22720. for (var i = 0; i < command.cases.length; i++) {
  22721. if (switchcase == command.cases[i]) {
  22722. delete command.cases[i];
  22723. command.cases.splice(i, 1);
  22724. casediv.remove();
  22725. break;
  22726. }
  22727. }
  22728. });
  22729. }
  22730. function addHandlers(command, function_obj, switch_dom) {
  22731. switch_dom.find('.button_remove_command').on('click', function () {
  22732. if (_commands__WEBPACK_IMPORTED_MODULE_6__["removeCommand"](command, function_obj, switch_dom)) {
  22733. switch_dom.fadeOut(400, function () {
  22734. switch_dom.remove();
  22735. });
  22736. }
  22737. });
  22738. }
  22739. /***/ }),
  22740. /***/ "./js/visualUI/commands/variable_value_menu.js":
  22741. /*!*****************************************************!*\
  22742. !*** ./js/visualUI/commands/variable_value_menu.js ***!
  22743. \*****************************************************/
  22744. /*! exports provided: VAR_OR_VALUE_TYPES, renderMenu */
  22745. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  22746. "use strict";
  22747. __webpack_require__.r(__webpack_exports__);
  22748. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "VAR_OR_VALUE_TYPES", function() { return VAR_OR_VALUE_TYPES; });
  22749. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "renderMenu", function() { return renderMenu; });
  22750. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  22751. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_0__);
  22752. /* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  22753. /* harmony import */ var _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  22754. /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  22755. /* harmony import */ var _globals__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../globals */ "./js/visualUI/globals.js");
  22756. /* harmony import */ var _variables__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../variables */ "./js/visualUI/variables.js");
  22757. /* harmony import */ var _attribution__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./attribution */ "./js/visualUI/commands/attribution.js");
  22758. /* harmony import */ var _writer__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./writer */ "./js/visualUI/commands/writer.js");
  22759. /* harmony import */ var _repeatNtimes__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./repeatNtimes */ "./js/visualUI/commands/repeatNtimes.js");
  22760. var VAR_OR_VALUE_TYPES = Object.freeze({
  22761. only_variable: 1,
  22762. only_value: 2,
  22763. only_function: 3,
  22764. variable_and_function: 4,
  22765. variable_and_value_opt: 5,
  22766. value_and_function: 6,
  22767. all: 7
  22768. });
  22769. function renderMenu(command, ref_object, dom_object, function_obj) {
  22770. var size_field = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 2;
  22771. var expression_element = arguments.length > 5 ? arguments[5] : undefined;
  22772. // Verificar se o objeto atual trata-se de uma chamada de função e conferir se possui a quantidade correta de parâmetros
  22773. // Caso não possua, tem que adicionar as variáveis que servirão de parâmetros:
  22774. if (ref_object.function_called) {
  22775. if (ref_object.function_called.parameters_list) {
  22776. while (ref_object.function_called.parameters_list.length != ref_object.parameters_list.length) {
  22777. if (ref_object.parameters_list.length > ref_object.function_called.parameters_list.length) {
  22778. ref_object.parameters_list.pop();
  22779. } else {
  22780. ref_object.parameters_list.push(new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](VAR_OR_VALUE_TYPES.all, null, null, null, true));
  22781. }
  22782. }
  22783. }
  22784. }
  22785. var menu_var_or_value = '<div class="ui dropdown menu_var_or_value_dom" data-varmenu="true"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
  22786. if (ref_object.variable_and_value == VAR_OR_VALUE_TYPES.only_variable) {
  22787. menu_var_or_value = '<div class="ui dropdown menu_var_or_value_dom" data-varmenu="true"><div class="text"></div><i class="dropdown icon"></i><div class="menu menu_only_vars">';
  22788. menu_var_or_value += '</div>';
  22789. }
  22790. 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) {
  22791. menu_var_or_value += '<div class="item" data-option="' + VAR_OR_VALUE_TYPES.only_variable + '"><i class="dropdown icon"></i>' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('variable');
  22792. menu_var_or_value += '<div class="menu menu_only_vars">';
  22793. menu_var_or_value += '</div></div>';
  22794. }
  22795. if (ref_object.variable_and_value == VAR_OR_VALUE_TYPES.only_value) {
  22796. menu_var_or_value = '<input type="text" class="width-dynamic" size="' + size_field + '" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" />';
  22797. }
  22798. 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) {
  22799. menu_var_or_value += '<div class="item" data-option="' + VAR_OR_VALUE_TYPES.only_value + '">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_value') + '</div>';
  22800. }
  22801. if (ref_object.variable_and_value == VAR_OR_VALUE_TYPES.only_function) {
  22802. menu_var_or_value = '<div class="ui dropdown menu_var_or_value_dom" data-varmenu="true"><div class="text"></div><i class="dropdown icon"></i><div class="menu menu_only_functions">';
  22803. menu_var_or_value += '</div>';
  22804. }
  22805. 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) {
  22806. menu_var_or_value += '<div class="item" data-option="' + VAR_OR_VALUE_TYPES.only_function + '"><i class="dropdown icon"></i>' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('btn_function');
  22807. menu_var_or_value += '<div class="menu menu_only_functions">';
  22808. menu_var_or_value += '</div></div>';
  22809. if (command.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].attribution) {
  22810. menu_var_or_value += '<div class="item"><i class="dropdown icon"></i>' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_change');
  22811. menu_var_or_value += '<div class="menu">';
  22812. menu_var_or_value += '<div class="item" data-exp="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_ELEMENTS"].exp_op_exp + '">EXP OP EXP</div>';
  22813. menu_var_or_value += '<div class="item" data-exp="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_ELEMENTS"].op_exp + '">OP EXP</div>';
  22814. menu_var_or_value += '<div class="item" data-exp="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_ELEMENTS"].par_exp_par + '">( EXP )</div>';
  22815. menu_var_or_value += '</div></div>';
  22816. }
  22817. }
  22818. menu_var_or_value += '</div></div>';
  22819. menu_var_or_value = jquery__WEBPACK_IMPORTED_MODULE_0___default()(menu_var_or_value);
  22820. dom_object.append(menu_var_or_value);
  22821. ref_object.dom_object = menu_var_or_value;
  22822. addHandlers(command, ref_object, dom_object, menu_var_or_value, function_obj, expression_element);
  22823. addVariablesToMenu(function_obj, menu_var_or_value, ref_object, expression_element);
  22824. addFunctionsToMenu(function_obj, menu_var_or_value, ref_object, expression_element);
  22825. addIVProgFunctionsToMenu(function_obj, menu_var_or_value, ref_object, expression_element);
  22826. if (ref_object.content || ref_object.function_called) {
  22827. if (ref_object.content) {
  22828. // Verificar se a variável ainda existe:
  22829. var variable_fun = isVarInProgram(ref_object.content, function_obj);
  22830. if (variable_fun) {
  22831. ref_object.content = variable_fun;
  22832. renderPreviousContent(function_obj, menu_var_or_value, ref_object, dom_object, command, expression_element);
  22833. } else {
  22834. if (ref_object.content && ref_object.content.type) {
  22835. ref_object.content = null;
  22836. appendSelectText(ref_object, menu_var_or_value);
  22837. } else {
  22838. renderPreviousContent(function_obj, menu_var_or_value, ref_object, dom_object, command, expression_element);
  22839. }
  22840. }
  22841. } else if (ref_object.function_called) {
  22842. // Verificar se a função ainda existe:
  22843. var ret_function = isFunctionInProgram(ref_object.function_called);
  22844. if (ret_function) {
  22845. ref_object.function_called = ret_function;
  22846. renderPreviousContent(function_obj, menu_var_or_value, ref_object, dom_object, command, expression_element);
  22847. } else {
  22848. ref_object.content = null;
  22849. ref_object.row = null;
  22850. ref_object.column = null;
  22851. delete ref_object.function_called;
  22852. delete ref_object.parameters_list;
  22853. appendSelectText(ref_object, menu_var_or_value);
  22854. }
  22855. }
  22856. } else {
  22857. appendSelectText(ref_object, menu_var_or_value);
  22858. }
  22859. }
  22860. function appendSelectText(ref_object, menu_var_or_value) {
  22861. switch (ref_object.variable_and_value) {
  22862. case VAR_OR_VALUE_TYPES.only_variable:
  22863. menu_var_or_value.find('.text').append('<i>' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('var_menu_select_var') + '</i>');
  22864. break;
  22865. case VAR_OR_VALUE_TYPES.all:
  22866. menu_var_or_value.find('.text').append('<i>' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('var_menu_select_all') + '</i>');
  22867. break;
  22868. case VAR_OR_VALUE_TYPES.variable_and_function:
  22869. menu_var_or_value.find('.text').append('<i>' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('var_menu_select_all') + '</i>');
  22870. break;
  22871. case VAR_OR_VALUE_TYPES.only_function:
  22872. menu_var_or_value.find('.text').append('<i>' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('var_menu_select_function') + '</i>');
  22873. break;
  22874. }
  22875. }
  22876. function isFunctionInProgram(function_called_obj) {
  22877. if (function_called_obj.name) {
  22878. if (window.program_obj.functions) {
  22879. for (var i = 0; i < window.program_obj.functions.length; i++) {
  22880. if (window.program_obj.functions[i] == function_called_obj) {
  22881. return window.program_obj.functions[i];
  22882. }
  22883. }
  22884. for (var i = 0; i < window.program_obj.functions.length; i++) {
  22885. if (window.program_obj.functions[i].name == function_called_obj.name) {
  22886. return window.program_obj.functions[i];
  22887. }
  22888. }
  22889. }
  22890. } else if (function_called_obj.identifier) {
  22891. for (var i = 0; i < window.system_functions.length; i++) {
  22892. if (window.system_functions[i].identifier == function_called_obj.identifier) {
  22893. return window.system_functions[i];
  22894. }
  22895. }
  22896. }
  22897. return null;
  22898. }
  22899. function isVarInProgram(var_obj, function_obj) {
  22900. // Verify in locals:
  22901. if (function_obj.variables_list) {
  22902. for (var i = 0; i < function_obj.variables_list.length; i++) {
  22903. if (function_obj.variables_list[i] == var_obj) {
  22904. return function_obj.variables_list[i];
  22905. }
  22906. }
  22907. } // Verify in parameters:
  22908. if (function_obj.parameters_list) {
  22909. for (var i = 0; i < function_obj.parameters_list.length; i++) {
  22910. if (function_obj.parameters_list[i] == var_obj) {
  22911. return function_obj.parameters_list[i];
  22912. }
  22913. }
  22914. } // Verify in globals:
  22915. if (window.program_obj.globals) {
  22916. for (var i = 0; i < window.program_obj.globals.length; i++) {
  22917. if (window.program_obj.globals[i] == var_obj) {
  22918. return window.program_obj.globals[i];
  22919. }
  22920. }
  22921. } // If not found, verify if the reference was lost
  22922. if (var_obj) {
  22923. if (function_obj.variables_list) {
  22924. for (var i = 0; i < function_obj.variables_list.length; i++) {
  22925. if (function_obj.variables_list[i].name == var_obj.name) {
  22926. return function_obj.variables_list[i];
  22927. }
  22928. }
  22929. }
  22930. if (function_obj.parameters_list) {
  22931. for (var i = 0; i < function_obj.parameters_list.length; i++) {
  22932. if (function_obj.parameters_list[i].name == var_obj.name) {
  22933. return function_obj.parameters_list[i];
  22934. }
  22935. }
  22936. }
  22937. if (window.program_obj.globals) {
  22938. for (var i = 0; i < window.program_obj.globals.length; i++) {
  22939. if (window.program_obj.globals[i].name == var_obj.name) {
  22940. return window.program_obj.globals[i];
  22941. }
  22942. }
  22943. }
  22944. }
  22945. return null;
  22946. }
  22947. function renderPreviousContent(function_obj, menu_var_or_value, ref_object, dom_object, command, expression_element) {
  22948. if (ref_object.function_called) {
  22949. menu_var_or_value.remove();
  22950. variableValueMenuCode(command, ref_object, dom_object, function_obj, menu_var_or_value, expression_element);
  22951. } else if (ref_object.content.type) {
  22952. menu_var_or_value.remove();
  22953. variableValueMenuCode(command, ref_object, dom_object, function_obj, menu_var_or_value, expression_element);
  22954. } else {
  22955. menu_var_or_value.remove();
  22956. variableValueMenuCode(command, ref_object, dom_object, function_obj, menu_var_or_value, expression_element);
  22957. }
  22958. }
  22959. function variableValueMenuCode(command, variable_obj, dom_object, function_obj, menu_var_or_value, expression_element) {
  22960. if (variable_obj.content || variable_obj.function_called) {
  22961. // Verificar se a variável ainda existe:
  22962. var var_fun = isVarInProgram(variable_obj.content, function_obj);
  22963. if (var_fun) {
  22964. variable_obj.content = var_fun;
  22965. } else {
  22966. if (variable_obj.content && variable_obj.content.type) {
  22967. variable_obj.content = null;
  22968. appendSelectText(variable_obj, menu_var_or_value);
  22969. }
  22970. }
  22971. } else {
  22972. appendSelectText(variable_obj, menu_var_or_value);
  22973. }
  22974. if (variable_obj.content == null && variable_obj.function_called == null) {
  22975. renderMenu(command, variable_obj, dom_object, function_obj, 2, expression_element);
  22976. return;
  22977. }
  22978. var ret = '';
  22979. if (variable_obj.function_called) {
  22980. if (variable_obj.function_called.parameters_list == null || variable_obj.function_called.length == 0) {
  22981. menu_var_or_value.find('.text').text(' ');
  22982. dom_object.find('.menu_var_or_value_dom').remove();
  22983. var parameters_menu;
  22984. if (variable_obj.function_called.name) {
  22985. parameters_menu = '<div class="parameters_function_called"> ' + variable_obj.function_called.name + ' <span> ( </span>';
  22986. } else {
  22987. parameters_menu = '<div class="parameters_function_called"> <i>' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI(variable_obj.function_called.category) + '.' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI(variable_obj.function_called.identifier) + '</i> <span> ( </span>';
  22988. }
  22989. parameters_menu += '<span> ) </span></div>';
  22990. parameters_menu = jquery__WEBPACK_IMPORTED_MODULE_0___default()(parameters_menu);
  22991. dom_object.append(parameters_menu);
  22992. var context_menu = '<div class="ui dropdown context_menu_clear"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
  22993. context_menu += '<div class="item" data-clear="true">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('btn_clear') + '</div>';
  22994. if (command.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].attribution) {
  22995. context_menu += '<div class="item"><i class="dropdown icon"></i>' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_change');
  22996. context_menu += '<div class="menu">';
  22997. context_menu += '<div class="item" data-exp="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_ELEMENTS"].exp_op_exp + '">EXP OP EXP</div>';
  22998. context_menu += '<div class="item" data-exp="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_ELEMENTS"].op_exp + '">OP EXP</div>';
  22999. context_menu += '<div class="item" data-exp="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_ELEMENTS"].par_exp_par + '">( EXP )</div>';
  23000. context_menu += '</div></div>';
  23001. }
  23002. context_menu += '</div></div>';
  23003. context_menu = jquery__WEBPACK_IMPORTED_MODULE_0___default()(context_menu);
  23004. context_menu.insertAfter(dom_object.find('.parameters_function_called'));
  23005. context_menu.dropdown({
  23006. onChange: function onChange(value, text, $selectedItem) {
  23007. console.log('S1');
  23008. if ($selectedItem.data('clear')) {
  23009. console.log('PP1');
  23010. dom_object.text('');
  23011. variable_obj.content = null;
  23012. variable_obj.row = null;
  23013. variable_obj.column = null;
  23014. delete variable_obj.function_called;
  23015. delete variable_obj.parameters_list;
  23016. renderMenu(command, variable_obj, dom_object, function_obj, 2, expression_element);
  23017. }
  23018. if ($selectedItem.data('exp')) {
  23019. _attribution__WEBPACK_IMPORTED_MODULE_6__["manageExpressionElements"](command, variable_obj, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  23020. }
  23021. },
  23022. selectOnKeydown: false
  23023. });
  23024. } else {
  23025. menu_var_or_value.find('.text').text(' ');
  23026. dom_object.find('.menu_var_or_value_dom').remove();
  23027. var parameters_menu;
  23028. if (variable_obj.function_called.name) {
  23029. parameters_menu = '<div class="parameters_function_called"> ' + variable_obj.function_called.name + ' <span> ( </span>';
  23030. } else {
  23031. parameters_menu = '<div class="parameters_function_called"> <i>' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI(variable_obj.function_called.category) + '.' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI(variable_obj.function_called.identifier) + '</i> <span> ( </span>';
  23032. }
  23033. for (var j = 0; j < variable_obj.function_called.parameters_list.length; j++) {
  23034. parameters_menu += '<div class="render_style_param parameter_' + j + '"></div>';
  23035. if (j + 1 != variable_obj.function_called.parameters_list.length) {
  23036. parameters_menu += ' , ';
  23037. }
  23038. }
  23039. parameters_menu += '<span> ) </span></div>';
  23040. parameters_menu = jquery__WEBPACK_IMPORTED_MODULE_0___default()(parameters_menu);
  23041. dom_object.append(parameters_menu);
  23042. for (var j = 0; j < variable_obj.function_called.parameters_list.length; j++) {
  23043. renderMenu(command, variable_obj.parameters_list[j], parameters_menu.find('.parameter_' + j), function_obj, 2, expression_element);
  23044. }
  23045. var context_menu = '<div class="ui dropdown context_menu_clear"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
  23046. context_menu += '<div class="item" data-clear="true">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('btn_clear') + '</div>';
  23047. if (command.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].attribution) {
  23048. context_menu += '<div class="item"><i class="dropdown icon"></i>' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_change');
  23049. context_menu += '<div class="menu">';
  23050. context_menu += '<div class="item" data-exp="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_ELEMENTS"].exp_op_exp + '">EXP OP EXP</div>';
  23051. context_menu += '<div class="item" data-exp="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_ELEMENTS"].op_exp + '">OP EXP</div>';
  23052. context_menu += '<div class="item" data-exp="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_ELEMENTS"].par_exp_par + '">( EXP )</div>';
  23053. context_menu += '</div></div>';
  23054. }
  23055. context_menu += '</div></div>';
  23056. context_menu = jquery__WEBPACK_IMPORTED_MODULE_0___default()(context_menu);
  23057. context_menu.insertAfter(parameters_menu);
  23058. context_menu.dropdown({
  23059. onChange: function onChange(value, text, $selectedItem) {
  23060. console.log('S2');
  23061. if ($selectedItem.data('clear')) {
  23062. console.log('PP2');
  23063. dom_object.text('');
  23064. variable_obj.content = null;
  23065. variable_obj.row = null;
  23066. variable_obj.column = null;
  23067. delete variable_obj.function_called;
  23068. delete variable_obj.parameters_list;
  23069. renderMenu(command, variable_obj, dom_object, function_obj, 2, expression_element);
  23070. }
  23071. if ($selectedItem.data('exp')) {
  23072. _attribution__WEBPACK_IMPORTED_MODULE_6__["manageExpressionElements"](command, variable_obj, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  23073. }
  23074. },
  23075. selectOnKeydown: false
  23076. });
  23077. }
  23078. } else if (variable_obj.content.type) {
  23079. var variable_render = "";
  23080. if (variable_obj.content.dimensions == 1 && variable_obj.dimensions != 1) {
  23081. variable_render = '<div class="variable_rendered"> <span class="var_name">' + variable_obj.content.name + '</span>';
  23082. variable_render += ' <span>[ </span> <div class="column_container"></div> <span> ]</span>';
  23083. variable_render += '</div>';
  23084. variable_render = jquery__WEBPACK_IMPORTED_MODULE_0___default()(variable_render);
  23085. dom_object.append(variable_render);
  23086. var context_menu = '<div class="ui dropdown context_menu_clear"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
  23087. context_menu += '<div class="item" data-clear="true">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('btn_clear') + '</div>';
  23088. if (command.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].attribution) {
  23089. context_menu += '<div class="item"><i class="dropdown icon"></i>' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_change');
  23090. context_menu += '<div class="menu">';
  23091. context_menu += '<div class="item" data-exp="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_ELEMENTS"].exp_op_exp + '">EXP OP EXP</div>';
  23092. context_menu += '<div class="item" data-exp="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_ELEMENTS"].op_exp + '">OP EXP</div>';
  23093. context_menu += '<div class="item" data-exp="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_ELEMENTS"].par_exp_par + '">( EXP )</div>';
  23094. context_menu += '</div></div>';
  23095. }
  23096. context_menu += '</div></div>';
  23097. context_menu = jquery__WEBPACK_IMPORTED_MODULE_0___default()(context_menu);
  23098. variable_render.append(context_menu);
  23099. context_menu.dropdown({
  23100. onChange: function onChange(value, text, $selectedItem) {
  23101. console.log('S3');
  23102. if ($selectedItem.data('clear')) {
  23103. console.log('PP3');
  23104. dom_object.text('');
  23105. variable_obj.content = null;
  23106. variable_obj.row = null;
  23107. variable_obj.column = null;
  23108. delete variable_obj.function_called;
  23109. delete variable_obj.parameters_list;
  23110. renderMenu(command, variable_obj, dom_object, function_obj, 2, expression_element);
  23111. }
  23112. if ($selectedItem.data('exp')) {
  23113. _attribution__WEBPACK_IMPORTED_MODULE_6__["manageExpressionElements"](command, variable_obj, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  23114. }
  23115. },
  23116. selectOnKeydown: false
  23117. });
  23118. if (!variable_obj.column) {
  23119. variable_obj.column = new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](VAR_OR_VALUE_TYPES.all, null, null, null, true);
  23120. }
  23121. variableValueMenuCode(command, variable_obj.column, jquery__WEBPACK_IMPORTED_MODULE_0___default()(variable_render.find('.column_container')), function_obj, menu_var_or_value, expression_element);
  23122. } else if (variable_obj.content.dimensions == 2 && variable_obj.dimensions != 2) {
  23123. variable_render = '<div class="variable_rendered"> <span class="var_name">' + variable_obj.content.name + '</span>';
  23124. variable_render += ' <span>[ </span> <div class="row_container"></div> <span> ]</span>';
  23125. variable_render += ' <span>[ </span> <div class="column_container"></div> <span> ] </span>';
  23126. variable_render += '</div>';
  23127. variable_render = jquery__WEBPACK_IMPORTED_MODULE_0___default()(variable_render);
  23128. dom_object.append(variable_render);
  23129. var context_menu = '<div class="ui dropdown context_menu_clear"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
  23130. context_menu += '<div class="item" data-clear="true">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('btn_clear') + '</div>';
  23131. if (command.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].attribution) {
  23132. context_menu += '<div class="item"><i class="dropdown icon"></i>' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_change');
  23133. context_menu += '<div class="menu">';
  23134. context_menu += '<div class="item" data-exp="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_ELEMENTS"].exp_op_exp + '">EXP OP EXP</div>';
  23135. context_menu += '<div class="item" data-exp="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_ELEMENTS"].op_exp + '">OP EXP</div>';
  23136. context_menu += '<div class="item" data-exp="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_ELEMENTS"].par_exp_par + '">( EXP )</div>';
  23137. context_menu += '</div></div>';
  23138. }
  23139. context_menu += '</div></div>';
  23140. context_menu = jquery__WEBPACK_IMPORTED_MODULE_0___default()(context_menu);
  23141. variable_render.append(context_menu);
  23142. context_menu.dropdown({
  23143. onChange: function onChange(value, text, $selectedItem) {
  23144. console.log('S4');
  23145. if ($selectedItem.data('clear')) {
  23146. console.log('PP4');
  23147. dom_object.text('');
  23148. variable_obj.content = null;
  23149. variable_obj.row = null;
  23150. variable_obj.column = null;
  23151. delete variable_obj.function_called;
  23152. delete variable_obj.parameters_list;
  23153. renderMenu(command, variable_obj, dom_object, function_obj, 2, expression_element);
  23154. }
  23155. if ($selectedItem.data('exp')) {
  23156. _attribution__WEBPACK_IMPORTED_MODULE_6__["manageExpressionElements"](command, variable_obj, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  23157. }
  23158. },
  23159. selectOnKeydown: false
  23160. });
  23161. if (!variable_obj.column) {
  23162. variable_obj.column = new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](VAR_OR_VALUE_TYPES.all, null, null, null, true);
  23163. }
  23164. if (!variable_obj.row) {
  23165. variable_obj.row = new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](VAR_OR_VALUE_TYPES.all, null, null, null, true);
  23166. }
  23167. variableValueMenuCode(command, variable_obj.row, jquery__WEBPACK_IMPORTED_MODULE_0___default()(variable_render.find('.row_container')), function_obj, menu_var_or_value, expression_element);
  23168. variableValueMenuCode(command, variable_obj.column, jquery__WEBPACK_IMPORTED_MODULE_0___default()(variable_render.find('.column_container')), function_obj, menu_var_or_value, expression_element);
  23169. } else {
  23170. variable_render = '<div class="variable_rendered"> <span class="var_name">' + variable_obj.content.name + '</span>';
  23171. variable_render += '</div>';
  23172. variable_render = jquery__WEBPACK_IMPORTED_MODULE_0___default()(variable_render);
  23173. dom_object.append(variable_render);
  23174. var context_menu = '<div class="ui dropdown context_menu_clear"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
  23175. context_menu += '<div class="item" data-clear="true">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('btn_clear') + '</div>';
  23176. if (command.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].attribution && !dom_object.hasClass('var_attributed')) {
  23177. console.log('dom_object6');
  23178. console.log(dom_object);
  23179. context_menu += '<div class="item"><i class="dropdown icon"></i>' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_change');
  23180. context_menu += '<div class="menu">';
  23181. context_menu += '<div class="item" data-exp="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_ELEMENTS"].exp_op_exp + '">EXP OP EXP</div>';
  23182. context_menu += '<div class="item" data-exp="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_ELEMENTS"].op_exp + '">OP EXP</div>';
  23183. context_menu += '<div class="item" data-exp="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_ELEMENTS"].par_exp_par + '">( EXP )</div>';
  23184. context_menu += '</div></div>';
  23185. }
  23186. context_menu += '</div></div>';
  23187. context_menu = jquery__WEBPACK_IMPORTED_MODULE_0___default()(context_menu);
  23188. variable_render.append(context_menu);
  23189. context_menu.dropdown({
  23190. onChange: function onChange(value, text, $selectedItem) {
  23191. console.log('S5');
  23192. if ($selectedItem.data('clear')) {
  23193. console.log('PP5');
  23194. dom_object.text('');
  23195. variable_obj.content = null;
  23196. variable_obj.row = null;
  23197. variable_obj.column = null;
  23198. delete variable_obj.function_called;
  23199. delete variable_obj.parameters_list;
  23200. renderMenu(command, variable_obj, dom_object, function_obj, 2, expression_element);
  23201. }
  23202. if ($selectedItem.data('exp')) {
  23203. _attribution__WEBPACK_IMPORTED_MODULE_6__["manageExpressionElements"](command, variable_obj, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  23204. }
  23205. },
  23206. selectOnKeydown: false
  23207. });
  23208. }
  23209. } else {
  23210. var variable_render = '<div class="variable_rendered"> <span class="var_name">' + variable_obj.content + '</span>';
  23211. variable_render += '</div>';
  23212. variable_render = jquery__WEBPACK_IMPORTED_MODULE_0___default()(variable_render);
  23213. dom_object.append(variable_render);
  23214. var context_menu = '<div class="ui dropdown context_menu_clear"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
  23215. context_menu += '<div class="item" data-clear="true">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('btn_clear') + '</div>';
  23216. if (command.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].attribution) {
  23217. context_menu += '<div class="item"><i class="dropdown icon"></i>' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_change');
  23218. context_menu += '<div class="menu">';
  23219. context_menu += '<div class="item" data-exp="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_ELEMENTS"].exp_op_exp + '">EXP OP EXP</div>';
  23220. context_menu += '<div class="item" data-exp="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_ELEMENTS"].op_exp + '">OP EXP</div>';
  23221. context_menu += '<div class="item" data-exp="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_ELEMENTS"].par_exp_par + '">( EXP )</div>';
  23222. context_menu += '</div></div>';
  23223. }
  23224. context_menu += '</div></div>';
  23225. context_menu = jquery__WEBPACK_IMPORTED_MODULE_0___default()(context_menu);
  23226. if (variable_obj.variable_and_value != VAR_OR_VALUE_TYPES.only_value) {
  23227. context_menu.insertAfter(variable_render);
  23228. }
  23229. context_menu.dropdown({
  23230. onChange: function onChange(value, text, $selectedItem) {
  23231. console.log('S6');
  23232. if ($selectedItem.data('clear')) {
  23233. console.log('PP6');
  23234. dom_object.text('');
  23235. variable_obj.content = null;
  23236. variable_obj.row = null;
  23237. variable_obj.column = null;
  23238. delete variable_obj.function_called;
  23239. delete variable_obj.parameters_list;
  23240. dom_object.find('.value_rendered').remove();
  23241. dom_object.find('.context_menu_clear').remove();
  23242. dom_object.find('.width-dynamic-minus').remove();
  23243. renderMenu(command, variable_obj, dom_object, function_obj, 2, expression_element);
  23244. }
  23245. if ($selectedItem.data('exp')) {
  23246. _attribution__WEBPACK_IMPORTED_MODULE_6__["manageExpressionElements"](command, variable_obj, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  23247. }
  23248. },
  23249. selectOnKeydown: false
  23250. });
  23251. variable_render.on('click', function (e) {
  23252. variable_render.remove();
  23253. variable_render.empty();
  23254. variable_render.remove();
  23255. dom_object.empty();
  23256. dom_object.append('<span class="menu_var_or_value_dom"> </span>');
  23257. openInputToValue(command, variable_obj, dom_object, menu_var_or_value, function_obj, expression_element);
  23258. });
  23259. }
  23260. }
  23261. function addIVProgFunctionsToMenu(function_obj, menu_var_or_value, ref_object, expression_element) {
  23262. var sub_menu = menu_var_or_value.find('.menu_only_functions');
  23263. sub_menu.append('<div class="divider"></div><div class="header">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_header_ivprog_functions') + '</div>');
  23264. sub_menu.append('<div class="item"><i class="dropdown icon"></i>' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_menu_functions_math') + '<div class="menu menu_math_functions"></div></div>');
  23265. sub_menu.append('<div class="item"><i class="dropdown icon"></i>' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_menu_functions_text') + '<div class="menu menu_text_functions"></div></div>');
  23266. sub_menu.append('<div class="item"><i class="dropdown icon"></i>' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_menu_functions_arrangement') + '<div class="menu menu_arrangement_functions"></div></div>');
  23267. sub_menu.append('<div class="item"><i class="dropdown icon"></i>' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_menu_functions_conversion') + '<div class="menu menu_conversion_functions"></div></div>'); // Insert Math functions:
  23268. for (var i = 0; i < window.system_functions.length; i++) {
  23269. var t = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="item"></div>');
  23270. t.data('function_reference', window.system_functions[i]);
  23271. t.data('option', VAR_OR_VALUE_TYPES.only_function);
  23272. t.text(_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI(window.system_functions[i].identifier));
  23273. switch (window.system_functions[i].category) {
  23274. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SYSTEM_FUNCTIONS_CATEGORIES"].math:
  23275. sub_menu.find('.menu_math_functions').append(t);
  23276. break;
  23277. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SYSTEM_FUNCTIONS_CATEGORIES"].text:
  23278. sub_menu.find('.menu_text_functions').append(t);
  23279. break;
  23280. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SYSTEM_FUNCTIONS_CATEGORIES"].arrangement:
  23281. sub_menu.find('.menu_arrangement_functions').append(t);
  23282. break;
  23283. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SYSTEM_FUNCTIONS_CATEGORIES"].conversion:
  23284. sub_menu.find('.menu_conversion_functions').append(t);
  23285. break;
  23286. }
  23287. }
  23288. }
  23289. function addFunctionsToMenu(function_obj, menu_var_or_value, ref_object, expression_element) {
  23290. var sub_menu = menu_var_or_value.find('.menu_only_functions');
  23291. sub_menu.text('');
  23292. for (var i = 0; i < window.program_obj.functions.length; i++) {
  23293. var temp = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="item" data-option="' + VAR_OR_VALUE_TYPES.only_function + '">' + window.program_obj.functions[i].name + ' </div>');
  23294. temp.data('function_reference', window.program_obj.functions[i]);
  23295. sub_menu.append(temp);
  23296. }
  23297. }
  23298. function addVariablesToMenu(function_obj, menu_var_or_value, ref_object, expression_element) {
  23299. var sub_menu = menu_var_or_value.find('.menu_only_vars');
  23300. sub_menu.text('');
  23301. var is_there = false;
  23302. if (window.program_obj.globals) {
  23303. if (ref_object.include_constant) {
  23304. for (var i = 0; i < window.program_obj.globals.length; i++) {
  23305. var temp = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="item" data-option="' + VAR_OR_VALUE_TYPES.only_variable + '">' + window.program_obj.globals[i].name + ' </div>');
  23306. temp.data('variable_reference', window.program_obj.globals[i]);
  23307. sub_menu.append(temp);
  23308. is_there = true;
  23309. }
  23310. } else {
  23311. for (var i = 0; i < window.program_obj.globals.length; i++) {
  23312. if (!window.program_obj.globals[i].is_constant) {
  23313. var temp = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="item" data-option="' + VAR_OR_VALUE_TYPES.only_variable + '">' + window.program_obj.globals[i].name + ' </div>');
  23314. temp.data('variable_reference', window.program_obj.globals[i]);
  23315. sub_menu.append(temp);
  23316. is_there = true;
  23317. }
  23318. }
  23319. }
  23320. }
  23321. if (function_obj.parameters_list) {
  23322. for (var i = 0; i < function_obj.parameters_list.length; i++) {
  23323. var temp = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="item" data-option="' + VAR_OR_VALUE_TYPES.only_variable + '">' + function_obj.parameters_list[i].name + ' </div>');
  23324. temp.data('variable_reference', function_obj.parameters_list[i]);
  23325. sub_menu.append(temp);
  23326. is_there = true;
  23327. }
  23328. }
  23329. if (function_obj.variables_list) {
  23330. for (var i = 0; i < function_obj.variables_list.length; i++) {
  23331. var temp = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="item" data-option="' + VAR_OR_VALUE_TYPES.only_variable + '">' + function_obj.variables_list[i].name + ' </div>');
  23332. temp.data('variable_reference', function_obj.variables_list[i]);
  23333. sub_menu.append(temp);
  23334. is_there = true;
  23335. }
  23336. }
  23337. if (!is_there) {
  23338. sub_menu.append(jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="header">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_none_variable') + '</div>'));
  23339. sub_menu.append(jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="item disabled">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_none_variable_instruction') + '</div>'));
  23340. }
  23341. }
  23342. function addHandlers(command, ref_object, dom_object, menu_var_or_value, function_obj, expression_element) {
  23343. if (ref_object.variable_and_value != VAR_OR_VALUE_TYPES.only_value) {
  23344. menu_var_or_value.dropdown({
  23345. onChange: function onChange(value, text, $selectedItem) {
  23346. console.log('S7');
  23347. dom_object.find('.var_name').remove();
  23348. switch ($selectedItem.data('option')) {
  23349. case VAR_OR_VALUE_TYPES.only_function:
  23350. openInputToFunction(command, ref_object, dom_object, menu_var_or_value, function_obj, jquery__WEBPACK_IMPORTED_MODULE_0___default()($selectedItem).data('function_reference'), expression_element);
  23351. break;
  23352. case VAR_OR_VALUE_TYPES.only_value:
  23353. openInputToValue(command, ref_object, dom_object, menu_var_or_value, function_obj, expression_element);
  23354. break;
  23355. case VAR_OR_VALUE_TYPES.only_variable:
  23356. openInputToVariable(command, ref_object, dom_object, menu_var_or_value, function_obj, jquery__WEBPACK_IMPORTED_MODULE_0___default()($selectedItem).data('variable_reference'), expression_element);
  23357. break;
  23358. }
  23359. if ($selectedItem.data('exp')) {
  23360. _attribution__WEBPACK_IMPORTED_MODULE_6__["manageExpressionElements"](command, ref_object, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  23361. }
  23362. if (command.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].repeatNtimes) {
  23363. _repeatNtimes__WEBPACK_IMPORTED_MODULE_8__["manageExpressionElements"](command, ref_object, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  23364. }
  23365. },
  23366. selectOnKeydown: false
  23367. });
  23368. }
  23369. dom_object.find('.width-dynamic').on('input', function () {
  23370. var inputWidth = jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).textWidth() + 10;
  23371. jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).focus();
  23372. var tmpStr = jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).val();
  23373. jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).val('');
  23374. jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).val(tmpStr);
  23375. jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).css({
  23376. width: inputWidth
  23377. });
  23378. }).trigger('input');
  23379. if (command.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].comment) {
  23380. dom_object.parent().on('click', function (e) {
  23381. dom_object.find('.value_rendered').remove();
  23382. dom_object.find('.value_rendered').empty();
  23383. dom_object.find('.value_rendered').remove();
  23384. dom_object.empty();
  23385. dom_object.append('<span class="menu_var_or_value_dom"> </span>');
  23386. openInputToValue(command, ref_object, dom_object, menu_var_or_value, function_obj, expression_element);
  23387. });
  23388. }
  23389. }
  23390. function openInputToFunction(command, ref_object, dom_object, menu_var_or_value, function_obj, function_selected, expression_element) {
  23391. ref_object.function_called = function_selected;
  23392. ref_object.parameters_list = [];
  23393. if (function_selected.parameters_list != null && function_selected.parameters_list.length > 0) {
  23394. menu_var_or_value.find('.text').text(' ');
  23395. dom_object.find('.menu_var_or_value_dom').remove();
  23396. var parameters_menu;
  23397. if (function_selected.name) {
  23398. parameters_menu = '<div class="parameters_function_called"> ' + function_selected.name + ' <span> ( </span>';
  23399. } else {
  23400. parameters_menu = '<div class="parameters_function_called"> <i>' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI(function_selected.category) + '.' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI(function_selected.identifier) + '</i> <span> ( </span>';
  23401. }
  23402. for (var j = 0; j < function_selected.parameters_list.length; j++) {
  23403. parameters_menu += '<div class="render_style_param parameter_' + j + '"></div>';
  23404. if (j + 1 != function_selected.parameters_list.length) {
  23405. parameters_menu += ' , ';
  23406. }
  23407. }
  23408. parameters_menu += '<span> ) </span></div>';
  23409. parameters_menu = jquery__WEBPACK_IMPORTED_MODULE_0___default()(parameters_menu);
  23410. dom_object.append(parameters_menu);
  23411. for (var j = 0; j < function_selected.parameters_list.length; j++) {
  23412. var temp;
  23413. if (function_selected.parameters_list[j].dimensions > 0) {
  23414. temp = new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](VAR_OR_VALUE_TYPES.variable_and_function, null, null, null, true, function_selected.parameters_list[j].dimensions);
  23415. } else {
  23416. temp = new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](VAR_OR_VALUE_TYPES.all, null, null, null, true);
  23417. }
  23418. ref_object.parameters_list.push(temp);
  23419. renderMenu(command, temp, parameters_menu.find('.parameter_' + j), function_obj, 2, expression_element);
  23420. }
  23421. var context_menu = '<div class="ui dropdown context_menu_clear"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
  23422. context_menu += '<div class="item" data-clear="true">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('btn_clear') + '</div>';
  23423. if (command.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].attribution) {
  23424. context_menu += '<div class="item"><i class="dropdown icon"></i>' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_change');
  23425. context_menu += '<div class="menu">';
  23426. context_menu += '<div class="item" data-exp="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_ELEMENTS"].exp_op_exp + '">EXP OP EXP</div>';
  23427. context_menu += '<div class="item" data-exp="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_ELEMENTS"].op_exp + '">OP EXP</div>';
  23428. context_menu += '<div class="item" data-exp="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_ELEMENTS"].par_exp_par + '">( EXP )</div>';
  23429. context_menu += '</div></div>';
  23430. }
  23431. context_menu += '</div></div>';
  23432. context_menu = jquery__WEBPACK_IMPORTED_MODULE_0___default()(context_menu);
  23433. context_menu.insertAfter(dom_object.find('.parameters_function_called'));
  23434. context_menu.dropdown({
  23435. onChange: function onChange(value, text, $selectedItem) {
  23436. console.log('S8');
  23437. if ($selectedItem.data('clear')) {
  23438. console.log('PP7');
  23439. dom_object.text('');
  23440. ref_object.content = null;
  23441. ref_object.row = null;
  23442. ref_object.column = null;
  23443. delete ref_object.function_called;
  23444. delete ref_object.parameters_list;
  23445. renderMenu(command, ref_object, dom_object, function_obj, 2, expression_element);
  23446. }
  23447. if ($selectedItem.data('exp')) {
  23448. _attribution__WEBPACK_IMPORTED_MODULE_6__["manageExpressionElements"](command, ref_object, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  23449. }
  23450. },
  23451. selectOnKeydown: false
  23452. });
  23453. } else {
  23454. menu_var_or_value.find('.text').text(' ');
  23455. dom_object.find('.menu_var_or_value_dom').remove();
  23456. var parameters_menu;
  23457. if (function_selected.name) {
  23458. parameters_menu = '<div class="parameters_function_called"> ' + function_selected.name + ' <span> ( </span>';
  23459. } else {
  23460. parameters_menu = '<div class="parameters_function_called"> <i>' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI(function_selected.category) + '.' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI(function_selected.identifier) + '</i> <span> ( </span>';
  23461. }
  23462. parameters_menu += '<span> ) </span></div>';
  23463. parameters_menu = jquery__WEBPACK_IMPORTED_MODULE_0___default()(parameters_menu);
  23464. dom_object.append(parameters_menu);
  23465. var context_menu = '<div class="ui dropdown context_menu_clear"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
  23466. context_menu += '<div class="item" data-clear="true">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('btn_clear') + '</div>';
  23467. if (command.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].attribution) {
  23468. context_menu += '<div class="item"><i class="dropdown icon"></i>' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_change');
  23469. context_menu += '<div class="menu">';
  23470. context_menu += '<div class="item" data-exp="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_ELEMENTS"].exp_op_exp + '">EXP OP EXP</div>';
  23471. context_menu += '<div class="item" data-exp="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_ELEMENTS"].op_exp + '">OP EXP</div>';
  23472. context_menu += '<div class="item" data-exp="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_ELEMENTS"].par_exp_par + '">( EXP )</div>';
  23473. context_menu += '</div></div>';
  23474. }
  23475. context_menu += '</div></div>';
  23476. context_menu = jquery__WEBPACK_IMPORTED_MODULE_0___default()(context_menu);
  23477. context_menu.insertAfter(dom_object.find('.parameters_function_called'));
  23478. context_menu.dropdown({
  23479. onChange: function onChange(value, text, $selectedItem) {
  23480. console.log('S9');
  23481. if ($selectedItem.data('clear')) {
  23482. console.log('PP8');
  23483. dom_object.text('');
  23484. ref_object.content = null;
  23485. ref_object.row = null;
  23486. ref_object.column = null;
  23487. delete ref_object.function_called;
  23488. delete ref_object.parameters_list;
  23489. renderMenu(command, ref_object, dom_object, function_obj, 2, expression_element);
  23490. }
  23491. if ($selectedItem.data('exp')) {
  23492. _attribution__WEBPACK_IMPORTED_MODULE_6__["manageExpressionElements"](command, ref_object, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  23493. }
  23494. },
  23495. selectOnKeydown: false
  23496. });
  23497. }
  23498. if (command.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].attribution) {
  23499. _attribution__WEBPACK_IMPORTED_MODULE_6__["renderMenuOperations"](command, ref_object, dom_object, menu_var_or_value, function_obj);
  23500. }
  23501. }
  23502. function openInputToVariable(command, ref_object, dom_object, menu_var_or_value, function_obj, variable_selected, expression_element) {
  23503. ref_object.content = variable_selected;
  23504. menu_var_or_value.find('.text').text(' ');
  23505. dom_object.find('.menu_var_or_value_dom').remove();
  23506. var variable_render = '<div class="variable_rendered"> <span class="var_name">' + variable_selected.name + '</span>';
  23507. if (variable_selected.dimensions == 1 && ref_object.dimensions != 1) {
  23508. variable_render += ' <span>[ </span> <div class="column_container"></div> <span> ]</span>';
  23509. }
  23510. if (variable_selected.dimensions == 2 && ref_object.dimensions != 2) {
  23511. variable_render += ' <span>[ </span> <div class="row_container"></div> <span> ]</span> ';
  23512. variable_render += ' <span>[ </span> <div class="column_container"></div> <span> ]</span>';
  23513. }
  23514. variable_render += '</div>';
  23515. variable_render = jquery__WEBPACK_IMPORTED_MODULE_0___default()(variable_render);
  23516. dom_object.append(variable_render);
  23517. if (variable_selected.dimensions == 1 && ref_object.dimensions != 1) {
  23518. ref_object.column = new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](VAR_OR_VALUE_TYPES.all, null, null, null, true);
  23519. renderMenu(command, ref_object.column, variable_render.find('.column_container'), function_obj, 2, expression_element);
  23520. }
  23521. if (variable_selected.dimensions == 2 && ref_object.dimensions != 2) {
  23522. ref_object.row = new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](VAR_OR_VALUE_TYPES.all, null, null, null, true);
  23523. renderMenu(command, ref_object.row, variable_render.find('.row_container'), function_obj, 2, expression_element);
  23524. ref_object.column = new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](VAR_OR_VALUE_TYPES.all, null, null, null, true);
  23525. renderMenu(command, ref_object.column, variable_render.find('.column_container'), function_obj, 2, expression_element);
  23526. }
  23527. var context_menu = '<div class="ui dropdown context_menu_clear"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
  23528. context_menu += '<div class="item" data-clear="true">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('btn_clear') + '</div>';
  23529. if (command.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].attribution && !dom_object.hasClass('var_attributed')) {
  23530. console.log("dom_object 10: ");
  23531. console.log(dom_object);
  23532. context_menu += '<div class="item"><i class="dropdown icon"></i>' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_change');
  23533. context_menu += '<div class="menu">';
  23534. context_menu += '<div class="item" data-exp="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_ELEMENTS"].exp_op_exp + '">EXP OP EXP</div>';
  23535. context_menu += '<div class="item" data-exp="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_ELEMENTS"].op_exp + '">OP EXP</div>';
  23536. context_menu += '<div class="item" data-exp="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_ELEMENTS"].par_exp_par + '">( EXP )</div>';
  23537. context_menu += '</div></div>';
  23538. }
  23539. context_menu += '</div></div>';
  23540. context_menu = jquery__WEBPACK_IMPORTED_MODULE_0___default()(context_menu);
  23541. context_menu.insertAfter(dom_object.find('.variable_rendered'));
  23542. context_menu.dropdown({
  23543. onChange: function onChange(value, text, $selectedItem) {
  23544. console.log('S10');
  23545. if ($selectedItem.data('clear')) {
  23546. console.log('PP9');
  23547. dom_object.text('');
  23548. ref_object.content = null;
  23549. ref_object.row = null;
  23550. ref_object.column = null;
  23551. delete ref_object.function_called;
  23552. delete ref_object.parameters_list;
  23553. renderMenu(command, ref_object, dom_object, function_obj, 2, expression_element);
  23554. }
  23555. if ($selectedItem.data('exp')) {
  23556. _attribution__WEBPACK_IMPORTED_MODULE_6__["manageExpressionElements"](command, ref_object, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  23557. }
  23558. if (command.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].repeatNtimes) {
  23559. _repeatNtimes__WEBPACK_IMPORTED_MODULE_8__["manageClearExpressionElements"](command, ref_object, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  23560. }
  23561. },
  23562. selectOnKeydown: false
  23563. });
  23564. if (command.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].attribution) {
  23565. _attribution__WEBPACK_IMPORTED_MODULE_6__["renderMenuOperations"](command, ref_object, dom_object, menu_var_or_value, function_obj, variable_selected);
  23566. }
  23567. }
  23568. function openInputToValue(command, ref_object, dom_object, menu_var_or_value, function_obj, expression_element) {
  23569. if (ref_object.content == null) {
  23570. ref_object.content = "";
  23571. }
  23572. menu_var_or_value.find('.text').text(' ');
  23573. var field = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<input type="text" size="2" class="width-dynamic-minus" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" />');
  23574. field.insertBefore(dom_object.find('.menu_var_or_value_dom'));
  23575. var rendered = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="value_rendered"></div>');
  23576. rendered.insertBefore(field);
  23577. field.focus();
  23578. field.val(ref_object.content);
  23579. var context_menu = '<div class="ui dropdown context_menu_clear"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
  23580. context_menu += '<div class="item" data-clear="true">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('btn_clear') + '</div>';
  23581. if (command.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].attribution) {
  23582. context_menu += '<div class="item"><i class="dropdown icon"></i>' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_change');
  23583. context_menu += '<div class="menu">';
  23584. context_menu += '<div class="item" data-exp="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_ELEMENTS"].exp_op_exp + '">EXP OP EXP</div>';
  23585. context_menu += '<div class="item" data-exp="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_ELEMENTS"].op_exp + '">OP EXP</div>';
  23586. context_menu += '<div class="item" data-exp="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_ELEMENTS"].par_exp_par + '">( EXP )</div>';
  23587. context_menu += '</div></div>';
  23588. }
  23589. context_menu += '</div></div>';
  23590. context_menu = jquery__WEBPACK_IMPORTED_MODULE_0___default()(context_menu);
  23591. dom_object.find('.menu_var_or_value_dom').remove();
  23592. if (ref_object.variable_and_value != VAR_OR_VALUE_TYPES.only_value) {
  23593. context_menu.insertAfter(field);
  23594. }
  23595. context_menu.dropdown({
  23596. onChange: function onChange(value, text, $selectedItem) {
  23597. console.log('S11');
  23598. if ($selectedItem.data('clear')) {
  23599. console.log('PP10');
  23600. dom_object.text('');
  23601. dom_object.find('.value_rendered').remove();
  23602. dom_object.find('.context_menu_clear').remove();
  23603. dom_object.find('.width-dynamic-minus').remove();
  23604. ref_object.content = null;
  23605. ref_object.row = null;
  23606. ref_object.column = null;
  23607. delete ref_object.function_called;
  23608. delete ref_object.parameters_list;
  23609. renderMenu(command, ref_object, dom_object, function_obj, 2, expression_element);
  23610. }
  23611. if ($selectedItem.data('exp')) {
  23612. _attribution__WEBPACK_IMPORTED_MODULE_6__["manageExpressionElements"](command, ref_object, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  23613. }
  23614. },
  23615. selectOnKeydown: false
  23616. });
  23617. dom_object.find('.width-dynamic-minus').focusout(function () {
  23618. if (jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).val().trim()) {
  23619. ref_object.content = jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).val().trim();
  23620. }
  23621. rendered.text(ref_object.content);
  23622. jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).remove();
  23623. });
  23624. dom_object.find('.width-dynamic-minus').on('keydown', function (e) {
  23625. var code = e.keyCode || e.which;
  23626. if (code == 13) {
  23627. if (jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).val().trim()) {
  23628. ref_object.content = jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).val().trim();
  23629. }
  23630. rendered.text(ref_object.content);
  23631. jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).remove();
  23632. }
  23633. if (code == 27) {
  23634. rendered.text(ref_object.content);
  23635. jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).remove();
  23636. }
  23637. });
  23638. if (command.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].comment) {
  23639. /*rendered.parent().on('click', function(e) {
  23640. rendered.parent().off();
  23641. console.log("TTT14");
  23642. rendered.remove();
  23643. rendered.empty();
  23644. rendered.remove();
  23645. dom_object.empty();
  23646. dom_object.append('<span class="menu_var_or_value_dom"> </span>');
  23647. openInputToValue(command, ref_object, dom_object, menu_var_or_value, function_obj, expression_element)
  23648. });*/
  23649. }
  23650. rendered.on('click', function (e) {
  23651. console.log("TTT2");
  23652. rendered.remove();
  23653. rendered.empty();
  23654. rendered.remove();
  23655. dom_object.empty();
  23656. dom_object.append('<span class="menu_var_or_value_dom"> </span>');
  23657. openInputToValue(command, ref_object, dom_object, menu_var_or_value, function_obj, expression_element);
  23658. });
  23659. if (command.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].attribution) {
  23660. _attribution__WEBPACK_IMPORTED_MODULE_6__["renderMenuOperations"](command, ref_object, dom_object, menu_var_or_value, function_obj);
  23661. }
  23662. }
  23663. jquery__WEBPACK_IMPORTED_MODULE_0___default.a.fn.textWidth = function (text, font) {
  23664. if (!jquery__WEBPACK_IMPORTED_MODULE_0___default.a.fn.textWidth.fakeEl) jquery__WEBPACK_IMPORTED_MODULE_0___default.a.fn.textWidth.fakeEl = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<span>').hide().appendTo(document.body);
  23665. jquery__WEBPACK_IMPORTED_MODULE_0___default.a.fn.textWidth.fakeEl.text(text || this.val() || this.text() || this.attr('placeholder')).css('font', font || this.css('font'));
  23666. return jquery__WEBPACK_IMPORTED_MODULE_0___default.a.fn.textWidth.fakeEl.width();
  23667. };
  23668. /***/ }),
  23669. /***/ "./js/visualUI/commands/whiletrue.js":
  23670. /*!*******************************************!*\
  23671. !*** ./js/visualUI/commands/whiletrue.js ***!
  23672. \*******************************************/
  23673. /*! exports provided: createFloatingCommand, renderCommand */
  23674. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  23675. "use strict";
  23676. __webpack_require__.r(__webpack_exports__);
  23677. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createFloatingCommand", function() { return createFloatingCommand; });
  23678. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "renderCommand", function() { return renderCommand; });
  23679. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  23680. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_0__);
  23681. /* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  23682. /* harmony import */ var _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  23683. /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  23684. /* harmony import */ var _globals__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../globals */ "./js/visualUI/globals.js");
  23685. /* harmony import */ var _variables__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../variables */ "./js/visualUI/variables.js");
  23686. /* harmony import */ var _commands__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  23687. /* harmony import */ var _conditional_expression__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./conditional_expression */ "./js/visualUI/commands/conditional_expression.js");
  23688. /* harmony import */ var _contextualized_menu__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./contextualized_menu */ "./js/visualUI/commands/contextualized_menu.js");
  23689. function createFloatingCommand() {
  23690. return jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="ui whiletrue created_element"> <i class="ui icon small sync"></i> <span> ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_code_while') + ' ( x < 10 ) <br> </span></div>');
  23691. }
  23692. function renderCommand(command, function_obj) {
  23693. var ret = '';
  23694. ret += '<div class="ui whiletrue command_container"> <i class="ui icon small sync command_drag"></i> <i class="ui icon times red button_remove_command"></i> <div class="ui context_menu"></div> <span class="span_command_spec"> ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_code_while') + ' </span>';
  23695. ret += '<span class="span_command_spec"> ( </span> <div class="conditional_expression"></div> <span class="span_command_spec"> ) </span>';
  23696. ret += ' </span>';
  23697. ret += '<div class="ui block_commands">';
  23698. ret += '</div>';
  23699. ret += '<span> </span>';
  23700. ret += '</div>';
  23701. var el = jquery__WEBPACK_IMPORTED_MODULE_0___default()(ret);
  23702. el.data('command', command);
  23703. el.find('.block_commands').data('command', command);
  23704. addHandlers(command, function_obj, el);
  23705. _contextualized_menu__WEBPACK_IMPORTED_MODULE_8__["renderMenu"](command, el.find('.context_menu'), function_obj, el);
  23706. _conditional_expression__WEBPACK_IMPORTED_MODULE_7__["renderExpression"](command, command.expression, function_obj, el.find('.conditional_expression'));
  23707. if (command.commands_block) {
  23708. for (var j = 0; j < command.commands_block.length; j++) {
  23709. _commands__WEBPACK_IMPORTED_MODULE_6__["renderCommand"](command.commands_block[j], jquery__WEBPACK_IMPORTED_MODULE_0___default()(el.find('.block_commands')[0]), 3, function_obj);
  23710. }
  23711. }
  23712. return el;
  23713. }
  23714. function addHandlers(command, function_obj, whiletrue_dom) {
  23715. whiletrue_dom.find('.button_remove_command').on('click', function () {
  23716. if (_commands__WEBPACK_IMPORTED_MODULE_6__["removeCommand"](command, function_obj, whiletrue_dom)) {
  23717. whiletrue_dom.fadeOut(400, function () {
  23718. whiletrue_dom.remove();
  23719. });
  23720. }
  23721. });
  23722. }
  23723. /***/ }),
  23724. /***/ "./js/visualUI/commands/writer.js":
  23725. /*!****************************************!*\
  23726. !*** ./js/visualUI/commands/writer.js ***!
  23727. \****************************************/
  23728. /*! exports provided: createFloatingCommand, renderCommand, addContent */
  23729. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  23730. "use strict";
  23731. __webpack_require__.r(__webpack_exports__);
  23732. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createFloatingCommand", function() { return createFloatingCommand; });
  23733. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "renderCommand", function() { return renderCommand; });
  23734. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "addContent", function() { return addContent; });
  23735. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  23736. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_0__);
  23737. /* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  23738. /* harmony import */ var _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  23739. /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  23740. /* harmony import */ var _globals__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../globals */ "./js/visualUI/globals.js");
  23741. /* harmony import */ var _variables__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../variables */ "./js/visualUI/variables.js");
  23742. /* harmony import */ var _variable_value_menu__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  23743. /* harmony import */ var _commands__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  23744. /* harmony import */ var _Sortable_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../../Sortable.js */ "./js/Sortable.js");
  23745. /* harmony import */ var _Sortable_js__WEBPACK_IMPORTED_MODULE_8___default = /*#__PURE__*/__webpack_require__.n(_Sortable_js__WEBPACK_IMPORTED_MODULE_8__);
  23746. function createFloatingCommand() {
  23747. return jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="ui writer created_element"> <i class="ui icon small upload"></i> <span> ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_command_write') + ' var </span></div>');
  23748. }
  23749. function renderCommand(command, function_obj) {
  23750. var ret = '';
  23751. 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">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_command_write') + ' ( </span><div class="all_elements_write"></div> <span class="close_parentheses span_command_spec">)</span> </div>';
  23752. var el = jquery__WEBPACK_IMPORTED_MODULE_0___default()(ret);
  23753. el.data('command', command);
  23754. for (var i = 0; i < command.content.length; i++) {
  23755. var new_div_item = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="var_value_menu_div"></div>');
  23756. var div_parent_with_handler = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="div_parent_handler"></div>');
  23757. div_parent_with_handler.append(jquery__WEBPACK_IMPORTED_MODULE_0___default()('<i class="ui icon ellipsis vertical inverted handler"></i>'));
  23758. div_parent_with_handler.append(new_div_item);
  23759. div_parent_with_handler.append(jquery__WEBPACK_IMPORTED_MODULE_0___default()('<i class="white inverted icon times handler"></i>'));
  23760. el.find('.all_elements_write').append(div_parent_with_handler);
  23761. _variable_value_menu__WEBPACK_IMPORTED_MODULE_6__["renderMenu"](command, command.content[i], new_div_item, function_obj);
  23762. addHandlerIconAdd(el.find('.all_elements_write'), command, function_obj);
  23763. addHandlersManager(command, function_obj, el, div_parent_with_handler, command.content[i]);
  23764. }
  23765. if (command.content.length == 0) {
  23766. addHandlerIconAdd(el.find('.all_elements_write'), command, function_obj);
  23767. }
  23768. addHandlers(command, function_obj, el);
  23769. return el;
  23770. }
  23771. function addHandlersManager(command, function_obj, writer_dom, item_div, content_element) {
  23772. item_div.find('.times').on('click', function () {
  23773. for (var i = 0; i < command.content.length; i++) {
  23774. if (command.content[i] == content_element) {
  23775. delete command.content[i];
  23776. command.content.splice(i, 1);
  23777. item_div.children().off();
  23778. item_div.off();
  23779. item_div.fadeOut();
  23780. if (command.content.length > 0) {
  23781. item_div.next('.icon_add_item_to_writer').fadeOut();
  23782. }
  23783. break;
  23784. }
  23785. }
  23786. });
  23787. }
  23788. function addHandlers(command, function_obj, writer_dom) {
  23789. writer_dom.find('.button_remove_command').on('click', function () {
  23790. if (_commands__WEBPACK_IMPORTED_MODULE_7__["removeCommand"](command, function_obj, writer_dom)) {
  23791. writer_dom.fadeOut(400, function () {
  23792. writer_dom.remove();
  23793. });
  23794. }
  23795. });
  23796. Sortable.create(writer_dom.find(".all_elements_write")[0], {
  23797. handle: '.ellipsis',
  23798. animation: 100,
  23799. ghostClass: 'ghost',
  23800. group: 'writer_' + Math.floor(Math.random() * 10000000),
  23801. draggable: '.div_parent_handler',
  23802. onEnd: function onEnd(evt) {
  23803. command.content.splice(evt.newIndex, 0, command.content.splice(evt.oldIndex, 1)[0]);
  23804. writer_dom.empty();
  23805. writer_dom.replaceWith(renderCommand(command, function_obj));
  23806. }
  23807. });
  23808. }
  23809. function addHandlerIconAdd(dom_object, command, function_obj) {
  23810. var insert_after = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
  23811. var after_which = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : null;
  23812. var icon_add_item = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<i class="ui icon plus square outline icon_add_item_to_writer"></i> ');
  23813. if (!insert_after) {
  23814. dom_object.append(icon_add_item);
  23815. } else {
  23816. icon_add_item.insertAfter(after_which);
  23817. }
  23818. icon_add_item.on('click', function (e) {
  23819. var div_parent_with_handler = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="div_parent_handler" style="display:none;"></div>');
  23820. var new_div_item = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="var_value_menu_div"></div>');
  23821. div_parent_with_handler.append(jquery__WEBPACK_IMPORTED_MODULE_0___default()('<i class="ui icon ellipsis vertical inverted handler"></i>'));
  23822. div_parent_with_handler.append(new_div_item);
  23823. div_parent_with_handler.append(jquery__WEBPACK_IMPORTED_MODULE_0___default()('<i class="white inverted icon times handler"></i>'));
  23824. div_parent_with_handler.insertAfter(icon_add_item);
  23825. var new_related_menu = new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_variable_value_menu__WEBPACK_IMPORTED_MODULE_6__["VAR_OR_VALUE_TYPES"].all, null, null, null, true);
  23826. _variable_value_menu__WEBPACK_IMPORTED_MODULE_6__["renderMenu"](command, new_related_menu, new_div_item, function_obj);
  23827. addHandlerIconAdd(dom_object, command, function_obj, true, div_parent_with_handler);
  23828. addHandlersManager(command, function_obj, dom_object, div_parent_with_handler, new_related_menu);
  23829. var pos = 1;
  23830. dom_object.find('.icon_add_item_to_writer').each(function () {
  23831. if (jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).get(0) === icon_add_item.get(0)) {
  23832. command.content.splice(pos, 0, new_related_menu);
  23833. } else {
  23834. pos++;
  23835. }
  23836. });
  23837. if (command.content.length == 1) {
  23838. icon_add_item.remove();
  23839. }
  23840. div_parent_with_handler.fadeIn();
  23841. });
  23842. }
  23843. function addContent(command, ref_object, dom_object, menu_var_or_value, function_obj, ref_object_content) {
  23844. if (dom_object.hasClass('var_value_menu_div')) {
  23845. var icon_add_item = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<i class="ui icon plus square outline icon_add_item_to_writer"></i> ');
  23846. icon_add_item.insertAfter(dom_object);
  23847. icon_add_item.on('click', function (e) {
  23848. var div_parent_with_handler = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="div_parent_handler"></div>');
  23849. div_parent_with_handler.append(jquery__WEBPACK_IMPORTED_MODULE_0___default()('<i class="ui icon ellipsis vertical inverted handler"></i>'));
  23850. div_parent_with_handler.append(new_div_item);
  23851. div_parent_with_handler.append(jquery__WEBPACK_IMPORTED_MODULE_0___default()('<i class="white inverted icon times handler"></i>'));
  23852. div_parent_with_handler.insertAfter(icon_add_item);
  23853. var new_related_menu = new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_variable_value_menu__WEBPACK_IMPORTED_MODULE_6__["VAR_OR_VALUE_TYPES"].all, null, null, null, true);
  23854. _variable_value_menu__WEBPACK_IMPORTED_MODULE_6__["renderMenu"](command, new_related_menu, new_div_item, function_obj);
  23855. addHandlersManager(command, function_obj, dom_object, div_parent_with_handler, new_related_menu);
  23856. command.content.push(new_related_menu);
  23857. if (command.content.length == 1) {
  23858. icon_add_item.remove();
  23859. }
  23860. });
  23861. }
  23862. }
  23863. /***/ }),
  23864. /***/ "./js/visualUI/functions.js":
  23865. /*!**********************************!*\
  23866. !*** ./js/visualUI/functions.js ***!
  23867. \**********************************/
  23868. /*! exports provided: renderFunction, initVisualUI, addFunctionChangeListener, addGlobalChangeListener, removeGlobalListener, removeFunctionListener */
  23869. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  23870. "use strict";
  23871. __webpack_require__.r(__webpack_exports__);
  23872. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "renderFunction", function() { return renderFunction; });
  23873. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "initVisualUI", function() { return initVisualUI; });
  23874. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "addFunctionChangeListener", function() { return addFunctionChangeListener; });
  23875. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "addGlobalChangeListener", function() { return addGlobalChangeListener; });
  23876. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "removeGlobalListener", function() { return removeGlobalListener; });
  23877. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "removeFunctionListener", function() { return removeFunctionListener; });
  23878. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  23879. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_0__);
  23880. /* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./types */ "./js/visualUI/types.js");
  23881. /* harmony import */ var _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  23882. /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  23883. /* harmony import */ var _globals__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./globals */ "./js/visualUI/globals.js");
  23884. /* harmony import */ var _variables__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./variables */ "./js/visualUI/variables.js");
  23885. /* harmony import */ var _commands__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./commands */ "./js/visualUI/commands.js");
  23886. /* harmony import */ var _code_generator__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./code_generator */ "./js/visualUI/code_generator.js");
  23887. /* harmony import */ var _commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./commands/variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  23888. /* harmony import */ var _io_domConsole__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./../io/domConsole */ "./js/io/domConsole.js");
  23889. /* harmony import */ var _ast_ivprogParser__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./../ast/ivprogParser */ "./js/ast/ivprogParser.js");
  23890. /* harmony import */ var _processor_ivprogProcessor__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./../processor/ivprogProcessor */ "./js/processor/ivprogProcessor.js");
  23891. /* harmony import */ var melanke_watchjs__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! melanke-watchjs */ "./node_modules/melanke-watchjs/src/watch.js");
  23892. /* harmony import */ var melanke_watchjs__WEBPACK_IMPORTED_MODULE_12___default = /*#__PURE__*/__webpack_require__.n(melanke_watchjs__WEBPACK_IMPORTED_MODULE_12__);
  23893. /* harmony import */ var _processor_semantic_semanticAnalyser__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ../processor/semantic/semanticAnalyser */ "./js/processor/semantic/semanticAnalyser.js");
  23894. /* harmony import */ var _assessment_ivprogAssessment__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ../assessment/ivprogAssessment */ "./js/assessment/ivprogAssessment.js");
  23895. /* harmony import */ var _algorithm__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./algorithm */ "./js/visualUI/algorithm.js");
  23896. /* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./utils */ "./js/visualUI/utils.js");
  23897. /* harmony import */ var _ima_version_json__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ./../../.ima_version.json */ "./.ima_version.json");
  23898. var _ima_version_json__WEBPACK_IMPORTED_MODULE_17___namespace = /*#__PURE__*/__webpack_require__.t(/*! ./../../.ima_version.json */ "./.ima_version.json", 1);
  23899. /* harmony import */ var _Sortable_js__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ../Sortable.js */ "./js/Sortable.js");
  23900. /* harmony import */ var _Sortable_js__WEBPACK_IMPORTED_MODULE_18___default = /*#__PURE__*/__webpack_require__.n(_Sortable_js__WEBPACK_IMPORTED_MODULE_18__);
  23901. var counter_new_functions = 0;
  23902. var counter_new_parameters = 0;
  23903. var ivprog_version = _ima_version_json__WEBPACK_IMPORTED_MODULE_17__.version;
  23904. var globalChangeListeners = [];
  23905. var functionsChangeListeners = [];
  23906. var domConsole = null;
  23907. window.studentGrade = null;
  23908. window.LocalizedStrings = _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"];
  23909. var program = new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["Program"]();
  23910. window.system_functions = []; // Adding math functions:
  23911. window.system_functions.push(new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SystemFunction"]('$sin', _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL, 0, [new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_8__["VAR_OR_VALUE_TYPES"].all, null, null, null, true)], null, _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SYSTEM_FUNCTIONS_CATEGORIES"].math));
  23912. window.system_functions.push(new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SystemFunction"]('$cos', _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL, 0, [new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_8__["VAR_OR_VALUE_TYPES"].all, null, null, null, true)], null, _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SYSTEM_FUNCTIONS_CATEGORIES"].math));
  23913. window.system_functions.push(new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SystemFunction"]('$tan', _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL, 0, [new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_8__["VAR_OR_VALUE_TYPES"].all, null, null, null, true)], null, _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SYSTEM_FUNCTIONS_CATEGORIES"].math));
  23914. window.system_functions.push(new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SystemFunction"]('$sqrt', _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL, 0, [new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_8__["VAR_OR_VALUE_TYPES"].all, null, null, null, true)], null, _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SYSTEM_FUNCTIONS_CATEGORIES"].math));
  23915. window.system_functions.push(new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SystemFunction"]('$pow', _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL, 0, [new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_8__["VAR_OR_VALUE_TYPES"].all, null, null, null, true), new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_8__["VAR_OR_VALUE_TYPES"].all, null, null, null, true)], null, _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SYSTEM_FUNCTIONS_CATEGORIES"].math));
  23916. window.system_functions.push(new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SystemFunction"]('$log', _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL, 0, [new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_8__["VAR_OR_VALUE_TYPES"].all, null, null, null, true)], null, _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SYSTEM_FUNCTIONS_CATEGORIES"].math));
  23917. window.system_functions.push(new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SystemFunction"]('$abs', _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL, 0, [new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_8__["VAR_OR_VALUE_TYPES"].all, null, null, null, true)], null, _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SYSTEM_FUNCTIONS_CATEGORIES"].math));
  23918. window.system_functions.push(new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SystemFunction"]('$negate', _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL, 0, [new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_8__["VAR_OR_VALUE_TYPES"].all, null, null, null, true)], null, _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SYSTEM_FUNCTIONS_CATEGORIES"].math));
  23919. window.system_functions.push(new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SystemFunction"]('$invert', _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL, 0, [new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_8__["VAR_OR_VALUE_TYPES"].all, null, null, null, true)], null, _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SYSTEM_FUNCTIONS_CATEGORIES"].math));
  23920. window.system_functions.push(new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SystemFunction"]('$max', _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL, 0, [new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_8__["VAR_OR_VALUE_TYPES"].all, null, null, null, true)], null, _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SYSTEM_FUNCTIONS_CATEGORIES"].math));
  23921. window.system_functions.push(new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SystemFunction"]('$min', _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL, 0, [new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_8__["VAR_OR_VALUE_TYPES"].all, null, null, null, true)], null, _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SYSTEM_FUNCTIONS_CATEGORIES"].math)); // Adding text functions:
  23922. window.system_functions.push(new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SystemFunction"]('$substring', _types__WEBPACK_IMPORTED_MODULE_1__["Types"].TEXT, 0, [new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_8__["VAR_OR_VALUE_TYPES"].all, null, null, null, true), new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_8__["VAR_OR_VALUE_TYPES"].all, null, null, null, true), new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_8__["VAR_OR_VALUE_TYPES"].all, null, null, null, true)], null, _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SYSTEM_FUNCTIONS_CATEGORIES"].text));
  23923. window.system_functions.push(new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SystemFunction"]('$length', _types__WEBPACK_IMPORTED_MODULE_1__["Types"].INTEGER, 0, [new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_8__["VAR_OR_VALUE_TYPES"].all, null, null, null, true)], null, _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SYSTEM_FUNCTIONS_CATEGORIES"].text));
  23924. window.system_functions.push(new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SystemFunction"]('$uppercase', _types__WEBPACK_IMPORTED_MODULE_1__["Types"].TEXT, 0, [new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_8__["VAR_OR_VALUE_TYPES"].all, null, null, null, true)], null, _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SYSTEM_FUNCTIONS_CATEGORIES"].text));
  23925. window.system_functions.push(new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SystemFunction"]('$lowercase', _types__WEBPACK_IMPORTED_MODULE_1__["Types"].TEXT, 0, [new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_8__["VAR_OR_VALUE_TYPES"].all, null, null, null, true)], null, _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SYSTEM_FUNCTIONS_CATEGORIES"].text));
  23926. window.system_functions.push(new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SystemFunction"]('$charAt', _types__WEBPACK_IMPORTED_MODULE_1__["Types"].TEXT, 0, [new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_8__["VAR_OR_VALUE_TYPES"].all, null, null, null, true), new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_8__["VAR_OR_VALUE_TYPES"].all, null, null, null, true)], null, _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SYSTEM_FUNCTIONS_CATEGORIES"].text)); // Adding arrangement functions:
  23927. window.system_functions.push(new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SystemFunction"]('$numElements', _types__WEBPACK_IMPORTED_MODULE_1__["Types"].INTEGER, 0, [new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_8__["VAR_OR_VALUE_TYPES"].variable_and_function, null, null, null, true, 1)], null, _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SYSTEM_FUNCTIONS_CATEGORIES"].arrangement));
  23928. window.system_functions.push(new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SystemFunction"]('$matrixLines', _types__WEBPACK_IMPORTED_MODULE_1__["Types"].INTEGER, 0, [new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_8__["VAR_OR_VALUE_TYPES"].variable_and_function, null, null, null, true, 2)], null, _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SYSTEM_FUNCTIONS_CATEGORIES"].arrangement));
  23929. window.system_functions.push(new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SystemFunction"]('$matrixColumns', _types__WEBPACK_IMPORTED_MODULE_1__["Types"].INTEGER, 0, [new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_8__["VAR_OR_VALUE_TYPES"].variable_and_function, null, null, null, true, 2)], null, _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SYSTEM_FUNCTIONS_CATEGORIES"].arrangement)); // Adding conversion functions:
  23930. window.system_functions.push(new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SystemFunction"]('$isReal', _types__WEBPACK_IMPORTED_MODULE_1__["Types"].BOOLEAN, 0, [new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_8__["VAR_OR_VALUE_TYPES"].all, null, null, null, true)], null, _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SYSTEM_FUNCTIONS_CATEGORIES"].conversion));
  23931. window.system_functions.push(new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SystemFunction"]('$isInt', _types__WEBPACK_IMPORTED_MODULE_1__["Types"].BOOLEAN, 0, [new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_8__["VAR_OR_VALUE_TYPES"].all, null, null, null, true)], null, _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SYSTEM_FUNCTIONS_CATEGORIES"].conversion));
  23932. window.system_functions.push(new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SystemFunction"]('$isBool', _types__WEBPACK_IMPORTED_MODULE_1__["Types"].BOOLEAN, 0, [new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_8__["VAR_OR_VALUE_TYPES"].all, null, null, null, true)], null, _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SYSTEM_FUNCTIONS_CATEGORIES"].conversion));
  23933. window.system_functions.push(new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SystemFunction"]('$castReal', _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL, 0, [new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_8__["VAR_OR_VALUE_TYPES"].all, null, null, null, true)], null, _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SYSTEM_FUNCTIONS_CATEGORIES"].conversion));
  23934. window.system_functions.push(new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SystemFunction"]('$castInt', _types__WEBPACK_IMPORTED_MODULE_1__["Types"].INTEGER, 0, [new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_8__["VAR_OR_VALUE_TYPES"].all, null, null, null, true)], null, _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SYSTEM_FUNCTIONS_CATEGORIES"].conversion));
  23935. window.system_functions.push(new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SystemFunction"]('$castBool', _types__WEBPACK_IMPORTED_MODULE_1__["Types"].BOOLEAN, 0, [new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_8__["VAR_OR_VALUE_TYPES"].all, null, null, null, true)], null, _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SYSTEM_FUNCTIONS_CATEGORIES"].conversion));
  23936. window.system_functions.push(new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SystemFunction"]('$castString', _types__WEBPACK_IMPORTED_MODULE_1__["Types"].TEXT, 0, [new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_8__["VAR_OR_VALUE_TYPES"].all, null, null, null, true)], null, _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SYSTEM_FUNCTIONS_CATEGORIES"].conversion));
  23937. console.log(' ___ ___ ________ \n / / / / / ____/ \n / / / / / / \n / / / / ______ ___ / /__ \n / / / / / \\ / / / ___/ \n / /______ / / / /\\ \\/ / / / \n / / / / / / \\ / / /____ \n/__________/ /___/ /___/ \\___/ /________/ \n\n Laboratório de Informática na Educação\n http://line.ime.usp.br');
  23938. var mainFunction = new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["Function"](_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI("start"), _types__WEBPACK_IMPORTED_MODULE_1__["Types"].VOID, 0, [], true, false);
  23939. mainFunction.function_comment = new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["Comment"](_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_comment_main'));
  23940. program.addFunction(mainFunction);
  23941. window.program_obj = program;
  23942. window.generator = _code_generator__WEBPACK_IMPORTED_MODULE_7__["generate"];
  23943. window.runCodeAssessment = runCodeAssessment;
  23944. window.renderAlgorithm = _algorithm__WEBPACK_IMPORTED_MODULE_15__["renderAlgorithm"];
  23945. window.insertContext = false;
  23946. window.watchW = melanke_watchjs__WEBPACK_IMPORTED_MODULE_12___default.a;
  23947. melanke_watchjs__WEBPACK_IMPORTED_MODULE_12___default.a.watch(window.program_obj.globals, function () {
  23948. if (window.insertContext) {
  23949. setTimeout(function () {
  23950. _algorithm__WEBPACK_IMPORTED_MODULE_15__["renderAlgorithm"]();
  23951. globalChangeListeners.forEach(function (x) {
  23952. return x();
  23953. });
  23954. }, 300);
  23955. window.insertContext = false;
  23956. } else {
  23957. _algorithm__WEBPACK_IMPORTED_MODULE_15__["renderAlgorithm"]();
  23958. globalChangeListeners.forEach(function (x) {
  23959. return x();
  23960. });
  23961. }
  23962. }, 1);
  23963. melanke_watchjs__WEBPACK_IMPORTED_MODULE_12___default.a.watch(window.program_obj.functions, function () {
  23964. if (window.insertContext) {
  23965. setTimeout(function () {
  23966. _algorithm__WEBPACK_IMPORTED_MODULE_15__["renderAlgorithm"]();
  23967. functionsChangeListeners.forEach(function (x) {
  23968. return x();
  23969. });
  23970. }, 300);
  23971. window.insertContext = false;
  23972. } else {
  23973. _algorithm__WEBPACK_IMPORTED_MODULE_15__["renderAlgorithm"]();
  23974. functionsChangeListeners.forEach(function (x) {
  23975. return x();
  23976. });
  23977. }
  23978. }, 1);
  23979. function addFunctionHandler() {
  23980. var new_function = new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["Function"](_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI("new_function") + "_" + counter_new_functions, _types__WEBPACK_IMPORTED_MODULE_1__["Types"].VOID, 0, [], false, false, [], new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["Comment"](_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_comment_start')));
  23981. program.addFunction(new_function);
  23982. counter_new_functions++;
  23983. window.insertContext = true;
  23984. var newe = renderFunction(new_function);
  23985. /*newe.css('display', 'none');
  23986. newe.fadeIn();*/
  23987. }
  23988. function addParameter(function_obj, function_container) {
  23989. var is_from_click = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  23990. if (function_obj.parameters_list == null) {
  23991. function_obj.parameters_list = [];
  23992. }
  23993. var new_parameter = new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["Variable"](_types__WEBPACK_IMPORTED_MODULE_1__["Types"].INTEGER, _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI("new_parameter") + "_" + counter_new_parameters);
  23994. function_obj.parameters_list.push(new_parameter);
  23995. counter_new_parameters++;
  23996. var newe = renderParameter(function_obj, new_parameter, function_container);
  23997. if (is_from_click) {
  23998. /*newe.css('display', 'none');
  23999. newe.fadeIn();*/
  24000. }
  24001. }
  24002. function updateReturnType(function_obj, new_type) {
  24003. var new_dimensions = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
  24004. function_obj.return_type = new_type;
  24005. function_obj.return_dimensions = new_dimensions;
  24006. }
  24007. function removeFunction(function_obj) {
  24008. var index = program.functions.indexOf(function_obj);
  24009. if (index > -1) {
  24010. program.functions.splice(index, 1);
  24011. }
  24012. }
  24013. function minimizeFunction(function_obj) {
  24014. function_obj.is_hidden = !function_obj.is_hidden;
  24015. }
  24016. function addHandlers(function_obj, function_container) {
  24017. function_container.find('.ui.dropdown.function_return').dropdown({
  24018. onChange: function onChange(value, text, $selectedItem) {
  24019. if ($selectedItem.data('dimensions')) {
  24020. updateReturnType(function_obj, _types__WEBPACK_IMPORTED_MODULE_1__["Types"][$selectedItem.data('type')], $selectedItem.data('dimensions'));
  24021. } else {
  24022. updateReturnType(function_obj, _types__WEBPACK_IMPORTED_MODULE_1__["Types"][$selectedItem.data('type')]);
  24023. }
  24024. },
  24025. selectOnKeydown: false
  24026. });
  24027. function_container.find(".name_function_updated").on('click', function (e) {
  24028. enableNameFunctionUpdate(function_obj, function_container);
  24029. });
  24030. function_container.find(".add_parameter_button").on('click', function (e) {
  24031. window.insertContext = true;
  24032. addParameter(function_obj, function_container, true);
  24033. });
  24034. function_container.find('.menu_commands').dropdown({
  24035. on: 'hover'
  24036. });
  24037. function_container.find('.menu_commands a').on('click', function (evt) {
  24038. if (function_obj.commands == null || function_obj.commands.length == 0) {
  24039. function_obj.commands = [];
  24040. var new_cmd = _commands__WEBPACK_IMPORTED_MODULE_6__["genericCreateCommand"](jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).data('command'));
  24041. function_obj.commands.push(new_cmd);
  24042. _commands__WEBPACK_IMPORTED_MODULE_6__["renderCommand"](new_cmd, function_container.find('.commands_list_div'), 3, function_obj);
  24043. } else {
  24044. _commands__WEBPACK_IMPORTED_MODULE_6__["createFloatingCommand"](function_obj, function_container, jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).data('command'), evt);
  24045. }
  24046. });
  24047. function_container.find('.add_var_button_function').on('click', function (e) {
  24048. window.insertContext = true;
  24049. _variables__WEBPACK_IMPORTED_MODULE_5__["addVariable"](function_obj, function_container, true);
  24050. });
  24051. function_container.find('.remove_function_button').on('click', function (e) {
  24052. removeFunction(function_obj);
  24053. function_container.fadeOut();
  24054. });
  24055. function_container.find('.minimize_function_button').on('click', function (e) {
  24056. minimizeFunction(function_obj);
  24057. if (function_obj.is_hidden) {
  24058. function_container.find(".add_var_button_function").toggle();
  24059. function_container.find(".inline_add_command").toggle();
  24060. function_container.find(".function_area").slideToggle();
  24061. } else {
  24062. function_container.find(".function_area").slideToggle(function () {
  24063. function_container.find(".add_var_button_function").toggle();
  24064. function_container.find(".inline_add_command").toggle();
  24065. });
  24066. }
  24067. });
  24068. } // Essa função imprime o tipo de retorno da função e cria o menu do tipo 'select' para alteração
  24069. function renderFunctionReturn(function_obj, function_element) {
  24070. var ret = '<div class="ui dropdown function_return">';
  24071. if (function_obj.return_dimensions > 0) {
  24072. ret += '<div class="text">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI("vector") + ':' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI(function_obj.return_type);
  24073. if (function_obj.return_dimensions == 1) {
  24074. ret += ' [ ] ';
  24075. } else {
  24076. ret += ' [ ] [ ] ';
  24077. }
  24078. ret += '</div>';
  24079. } else {
  24080. ret += '<div class="text">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI(function_obj.return_type) + '</div>';
  24081. }
  24082. ret += '<div class="menu">';
  24083. for (var tm in _types__WEBPACK_IMPORTED_MODULE_1__["Types"]) {
  24084. ret += '<div class="item ' + (function_obj.return_type == tm.toLowerCase() && function_obj.return_dimensions < 1 ? ' selected ' : '') + '" data-type="' + tm + '" >' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI(tm.toLowerCase()) + '</div>';
  24085. }
  24086. for (var tm in _types__WEBPACK_IMPORTED_MODULE_1__["Types"]) {
  24087. if (tm == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].VOID.toUpperCase()) {
  24088. continue;
  24089. }
  24090. ret += '<div class="item">' + '<i class="dropdown icon"></i>' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('vector') + ':' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI(tm.toLowerCase()) + '<div class="menu">' + '<div class="item ' + (function_obj.return_type == tm.toLowerCase() && function_obj.return_dimensions > 0 ? ' selected ' : '') + '" data-text="' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('vector') + ':' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["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="' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('vector') + ':' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI(tm.toLowerCase()) + ' [ ] [ ] " data-type="' + tm + '" data-dimensions="2">[ ] [ ] </div>' + '</div>' + '</div>';
  24091. }
  24092. ret += '</div></div>';
  24093. ret = jquery__WEBPACK_IMPORTED_MODULE_0___default()(ret);
  24094. function_element.find('.function_return').append(ret);
  24095. }
  24096. var cont = 0;
  24097. function renderFunction(function_obj) {
  24098. var appender = '<div class="ui secondary segment function_div list-group-item function_cont_' + cont + '">';
  24099. if (function_obj.function_comment) {//appender += renderComment(function_obj.function_comment, sequence, true, -1);
  24100. }
  24101. appender += '<span class="glyphicon glyphicon-move move_function" aria-hidden="true"><i class="icon sort alternate vertical"></i></span>';
  24102. 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>';
  24103. appender += '<div class="function_signature_div">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI("function") + ' ';
  24104. if (function_obj.is_main) {
  24105. appender += '<div class="function_name_div"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["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">';
  24106. } else {
  24107. appender += '<div class="ui function_return"></div>';
  24108. 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">';
  24109. }
  24110. appender += '</div> <span class="parethesis_function"> ) </span> </div>' + (function_obj.is_hidden ? ' <div class="function_area" style="display: none;"> ' : ' <div class="function_area"> ');
  24111. 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>';
  24112. appender += '<div class="ui top attached segment variables_list_div"></div>';
  24113. appender += '<div class="ui bottom attached segment commands_list_div commands_cont_' + cont + '">' + '<div class="ui rail" style="width: 35px; margin-left: -36px;"><div class="ui sticky sticky_cont_' + cont + '" style="top: 50px !important;">';
  24114. appender += '<i class="icon plus circle purple"></i><i class="icon circle white back"></i><div class="ui icon button dropdown menu_commands orange" ><i class="icon code"></i> <div class="menu"> ';
  24115. appender += '<a class="item" data-command="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].reader + '"><i class="download icon"></i> ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_read_var') + '</a>' + '<a class="item" data-command="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].writer + '"><i class="upload icon"></i> ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_write_var') + '</a>' + '<a class="item" data-command="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].comment + '"><i class="quote left icon"></i> ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_comment') + '</a>' + '<a class="item" data-command="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].attribution + '"><i class="arrow left icon"></i> ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_attribution') + '</a>' + '<a class="item" data-command="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].functioncall + '"><i class="hand point right icon"></i> ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_functioncall') + '</a>' + '<a class="item" data-command="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].iftrue + '" ><i class="random icon"></i> ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_iftrue') + '</a>' + '<a class="item" data-command="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].repeatNtimes + '"><i class="sync icon"></i> ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_repeatNtimes') + '</a>' + '<a class="item" data-command="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].whiletrue + '"><i class="sync icon"></i> ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_whiletrue') + '</a>' + '<a class="item" data-command="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].dowhiletrue + '"><i class="sync icon"></i> ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_dowhiletrue') + '</a>' + '<a class="item" data-command="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].switch + '"><i class="list icon"></i> ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_switch') + '</a>' + '<a class="item" data-command="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].return + '"><i class="reply icon"></i> ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_btn_return') + '</a>' + '</div></div>';
  24116. appender += '</div></div>' + '</div>';
  24117. appender += '</div></div>';
  24118. appender = jquery__WEBPACK_IMPORTED_MODULE_0___default()(appender);
  24119. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.all_functions').append(appender);
  24120. appender.data('fun', function_obj);
  24121. appender.find('.commands_list_div').data('fun', function_obj);
  24122. renderFunctionReturn(function_obj, appender);
  24123. addHandlers(function_obj, appender); // Rendering parameters:
  24124. for (var j = 0; j < function_obj.parameters_list.length; j++) {
  24125. renderParameter(function_obj, function_obj.parameters_list[j], appender);
  24126. } // Rendering variables:
  24127. for (var j = 0; j < function_obj.variables_list.length; j++) {
  24128. _variables__WEBPACK_IMPORTED_MODULE_5__["renderVariable"](appender, function_obj.variables_list[j], function_obj);
  24129. } // Rendering commands:
  24130. for (var j = 0; j < function_obj.commands.length; j++) {
  24131. _commands__WEBPACK_IMPORTED_MODULE_6__["renderCommand"](function_obj.commands[j], jquery__WEBPACK_IMPORTED_MODULE_0___default()(appender.find('.commands_list_div')[0]), 3, function_obj);
  24132. }
  24133. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.minimize_function_button').popup({
  24134. content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI("tooltip_minimize"),
  24135. delay: {
  24136. show: 750,
  24137. hide: 0
  24138. }
  24139. });
  24140. var function_index = program.functions.indexOf(function_obj);
  24141. Sortable.create(appender.find(".variables_list_div")[0], {
  24142. handle: '.ellipsis',
  24143. animation: 100,
  24144. ghostClass: 'ghost',
  24145. group: 'local_vars_drag_' + function_index,
  24146. onEnd: function onEnd(evt) {
  24147. updateSequenceLocals(evt.oldIndex, evt.newIndex, function_obj);
  24148. }
  24149. });
  24150. addSortableHandler(appender.find(".commands_list_div")[0], function_index);
  24151. if (!function_obj.is_main) {
  24152. Sortable.create(appender.find(".container_parameters_list")[0], {
  24153. handle: '.ellipsis',
  24154. animation: 100,
  24155. ghostClass: 'ghost',
  24156. group: 'parameters_drag_' + program.functions.indexOf(function_obj),
  24157. onEnd: function onEnd(evt) {
  24158. updateSequenceParameters(evt.oldIndex, evt.newIndex, function_obj);
  24159. }
  24160. });
  24161. }
  24162. var teste = '.ui.sticky.sticky_cont_' + cont;
  24163. jquery__WEBPACK_IMPORTED_MODULE_0___default()(teste).sticky({
  24164. context: '.ui.bottom.attached.segment.commands_list_div.commands_cont_' + cont,
  24165. scrollContext: '.ivprog_visual_panel',
  24166. observeChanges: true,
  24167. offset: 40,
  24168. onStick: function onStick(evt) {
  24169. jquery__WEBPACK_IMPORTED_MODULE_0___default()(teste).css('top', '20px', 'important');
  24170. },
  24171. onBottom: function onBottom(evt) {
  24172. jquery__WEBPACK_IMPORTED_MODULE_0___default()(teste).css('top', '20px', 'important');
  24173. },
  24174. onUnstick: function onUnstick(evt) {
  24175. jquery__WEBPACK_IMPORTED_MODULE_0___default()(teste).css('top', '20px', 'important');
  24176. },
  24177. onReposition: function onReposition(evt) {
  24178. jquery__WEBPACK_IMPORTED_MODULE_0___default()(teste).css('top', '20px', 'important');
  24179. },
  24180. onScroll: function onScroll(evt) {
  24181. jquery__WEBPACK_IMPORTED_MODULE_0___default()(teste).css('top', '20px', 'important');
  24182. if (!isVisible(jquery__WEBPACK_IMPORTED_MODULE_0___default()(teste), jquery__WEBPACK_IMPORTED_MODULE_0___default()(teste).parent())) {
  24183. jquery__WEBPACK_IMPORTED_MODULE_0___default()(teste).removeClass('fixed');
  24184. }
  24185. },
  24186. onTop: function onTop(evt) {
  24187. jquery__WEBPACK_IMPORTED_MODULE_0___default()(teste).css('top', '20px', 'important');
  24188. }
  24189. });
  24190. cont++;
  24191. return appender;
  24192. }
  24193. function isVisible(element, container) {
  24194. var elementTop = jquery__WEBPACK_IMPORTED_MODULE_0___default()(element).offset().top,
  24195. elementHeight = jquery__WEBPACK_IMPORTED_MODULE_0___default()(element).height(),
  24196. containerTop = jquery__WEBPACK_IMPORTED_MODULE_0___default()(container).offset().top,
  24197. containerHeight = jquery__WEBPACK_IMPORTED_MODULE_0___default()(container).height() - 30;
  24198. return elementTop - containerTop + elementHeight > 0 && elementTop - containerTop < containerHeight;
  24199. }
  24200. window.evento_drag;
  24201. function updateProgramObjDrag() {
  24202. var nodes = Array.prototype.slice.call(jquery__WEBPACK_IMPORTED_MODULE_0___default()('.all_functions').children());
  24203. var function_index;
  24204. var start_index;
  24205. var function_obj;
  24206. jquery__WEBPACK_IMPORTED_MODULE_0___default()(evento_drag.item).parentsUntil(".all_functions").each(function (index) {
  24207. if (jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).hasClass('function_div')) {
  24208. function_index = nodes.indexOf(this);
  24209. start_index = index;
  24210. function_obj = jquery__WEBPACK_IMPORTED_MODULE_0___default()(this);
  24211. }
  24212. });
  24213. console.log(function_index);
  24214. var path_target = [];
  24215. jquery__WEBPACK_IMPORTED_MODULE_0___default()(evento_drag.item).parentsUntil(".all_functions").each(function (index) {
  24216. if (jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).hasClass('command_container')) {
  24217. path_target.push(this);
  24218. }
  24219. });
  24220. if (path_target.length == 0) {//console.log('soltou na raiz, na posição: ' + evento_drag.newIndex + ' mas ainda não sei de onde saiu ');
  24221. } else {//console.log('soltou dentro de algum bloco, sequência vem logo abaixo (de baixo pra cima): ');
  24222. //console.log(path_target);
  24223. }
  24224. var index_each = [];
  24225. var path_relative = [];
  24226. for (var i = path_target.length - 1; i >= 0; i--) {
  24227. console.log('da vez', jquery__WEBPACK_IMPORTED_MODULE_0___default()(path_target[i + 1]));
  24228. if (i == path_target.length - 1) {
  24229. // está na raiz
  24230. var indice_na_raiz = function_obj.find('.command_container').index(path_target[i]);
  24231. console.log('índice na raiz: ', indice_na_raiz);
  24232. } else {
  24233. if (jquery__WEBPACK_IMPORTED_MODULE_0___default()(path_target[i + 1]).hasClass('iftrue')) {
  24234. if (jquery__WEBPACK_IMPORTED_MODULE_0___default()(path_target[i]).parent().hasClass('commands_if')) {
  24235. path_relative.push('if');
  24236. index_each.push(jquery__WEBPACK_IMPORTED_MODULE_0___default()(path_target[i]).parent().find('.command_container').index(path_target[i]));
  24237. } else {
  24238. path_relative.push('else');
  24239. index_each.push(jquery__WEBPACK_IMPORTED_MODULE_0___default()(path_target[i]).parent().find('.command_container').index(path_target[i]));
  24240. }
  24241. } else if (jquery__WEBPACK_IMPORTED_MODULE_0___default()(path_target[i + 1]).hasClass('dowhiletrue')) {
  24242. path_relative.push('dowhiletrue');
  24243. index_each.push(jquery__WEBPACK_IMPORTED_MODULE_0___default()(path_target[i + 1]).find('.command_container').index(path_target[i]));
  24244. } else if (jquery__WEBPACK_IMPORTED_MODULE_0___default()(path_target[i + 1]).hasClass('repeatNtimes')) {
  24245. path_relative.push('repeatNtimes');
  24246. index_each.push(jquery__WEBPACK_IMPORTED_MODULE_0___default()(path_target[i + 1]).find('.command_container').index(path_target[i]));
  24247. } else if (jquery__WEBPACK_IMPORTED_MODULE_0___default()(path_target[i + 1]).hasClass('whiletrue')) {
  24248. path_relative.push('whiletrue');
  24249. index_each.push(jquery__WEBPACK_IMPORTED_MODULE_0___default()(path_target[i + 1]).find('.command_container').index(path_target[i]));
  24250. } else if (jquery__WEBPACK_IMPORTED_MODULE_0___default()(path_target[i + 1]).hasClass('switch')) {
  24251. path_relative.push('switch'); //index_each.push($(path_target[i + 1]).find('.command_container').index(path_target[i]));
  24252. }
  24253. }
  24254. }
  24255. var index_in_block = -1;
  24256. var is_in_else = jquery__WEBPACK_IMPORTED_MODULE_0___default()(evento_drag.item).parent().hasClass('commands_else');
  24257. index_in_block = jquery__WEBPACK_IMPORTED_MODULE_0___default()(evento_drag.item).parent().find('.command_container').index(evento_drag.item);
  24258. var is_in_case_switch = jquery__WEBPACK_IMPORTED_MODULE_0___default()(evento_drag.item).parent().hasClass('case_commands_block');
  24259. var index_case_of_switch = -1;
  24260. if (is_in_case_switch) {
  24261. index_case_of_switch = jquery__WEBPACK_IMPORTED_MODULE_0___default()(evento_drag.item).parent().parent().parent().find('.case_div').index(jquery__WEBPACK_IMPORTED_MODULE_0___default()(evento_drag.item).parent().parent());
  24262. }
  24263. /*console.log('path_relative:');
  24264. console.log(path_relative);
  24265. console.log('index_each:');
  24266. console.log(index_each);
  24267. console.log('index_in_block:');
  24268. console.log(index_in_block);
  24269. console.log('ele está em algum bloco de senão? ');
  24270. console.log(is_in_else);
  24271. console.log('ele está dentro de um case de switch?');
  24272. console.log(is_in_case_switch);
  24273. console.log('qual é o índice do case: ');
  24274. console.log(index_case_of_switch);*/
  24275. // encontrar o elemento na árvore:
  24276. var command_start_point = window.program_obj.functions[function_index].commands[indice_na_raiz];
  24277. var block_to_insert = command_start_point;
  24278. for (var i = 0; i < index_each.length; i++) {
  24279. if (path_relative[i] == "else") {
  24280. block_to_insert = block_to_insert.commands_else[index_each[i]];
  24281. } else if (path_relative[i] == "switch") {} else {
  24282. block_to_insert = block_to_insert.commands_block[index_each[i]];
  24283. }
  24284. } //console.log('command_start_point', command_start_point);
  24285. //console.log('block_to_insert', block_to_insert);
  24286. // agora tem que alocar o comando na árvore, mas considerar as quatro situações:
  24287. // (1) se está em um else ou (2) se está em switch ou (3) será um caso padrão ou (4) se será na raiz.
  24288. if (path_target.length == 0) {
  24289. // soltou na raiz:
  24290. window.program_obj.functions[function_index].commands.splice(evento_drag.newIndex, 0, command_in_drag);
  24291. } else if (is_in_else) {
  24292. if (block_to_insert.commands_else) {
  24293. block_to_insert.commands_else.splice(evento_drag.newIndex, 0, command_in_drag);
  24294. } else {
  24295. block_to_insert.commands_else = [];
  24296. block_to_insert.commands_else.push(command_in_drag);
  24297. }
  24298. } else if (is_in_case_switch) {} else {
  24299. // verificar se tem alguma coisa no bloco:
  24300. if (block_to_insert.commands_block) {
  24301. block_to_insert.commands_block.splice(evento_drag.newIndex, 0, command_in_drag);
  24302. } else {
  24303. block_to_insert.commands_block = [];
  24304. block_to_insert.commands_block.push(command_in_drag);
  24305. }
  24306. }
  24307. window.draging = false;
  24308. renderAlgorithm();
  24309. }
  24310. function prepareDragHandler(evt) {
  24311. window.draging = true;
  24312. var nodes = Array.prototype.slice.call(jquery__WEBPACK_IMPORTED_MODULE_0___default()('.all_functions').children());
  24313. var function_index;
  24314. var function_obj;
  24315. jquery__WEBPACK_IMPORTED_MODULE_0___default()(evt.item).parentsUntil(".all_functions").each(function (index) {
  24316. if (jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).hasClass('function_div')) {
  24317. function_index = nodes.indexOf(this);
  24318. function_obj = window.program_obj.functions[function_index];
  24319. }
  24320. });
  24321. command_in_drag = jquery__WEBPACK_IMPORTED_MODULE_0___default()(evt.item).data("command"); //console.log('$(evt.item).parent(): ');
  24322. //console.log($(evt.item).parent());
  24323. // descobrir qual das quatro situações:
  24324. if (jquery__WEBPACK_IMPORTED_MODULE_0___default()(evt.item).parent().hasClass('commands_list_div')) {
  24325. // está na raiz:
  24326. if (function_obj.commands.indexOf(command_in_drag) > -1) {
  24327. function_obj.commands.splice(function_obj.commands.indexOf(command_in_drag), 1);
  24328. }
  24329. } else if (jquery__WEBPACK_IMPORTED_MODULE_0___default()(evt.item).parent().hasClass('commands_else')) {
  24330. // está no else:
  24331. if (jquery__WEBPACK_IMPORTED_MODULE_0___default()(evt.item).parent().data('command').commands_else.indexOf(command_in_drag) > -1) {
  24332. jquery__WEBPACK_IMPORTED_MODULE_0___default()(evt.item).parent().data('command').commands_else.splice(jquery__WEBPACK_IMPORTED_MODULE_0___default()(evt.item).parent().data('command').commands_else.indexOf(command_in_drag), 1);
  24333. }
  24334. } else if (jquery__WEBPACK_IMPORTED_MODULE_0___default()(evt.item).parent().hasClass('case_commands_block')) {// está em um switch:
  24335. } else {
  24336. // caso padrão:
  24337. if (jquery__WEBPACK_IMPORTED_MODULE_0___default()(evt.item).parent().data('command').commands_block.indexOf(command_in_drag) > -1) {
  24338. jquery__WEBPACK_IMPORTED_MODULE_0___default()(evt.item).parent().data('command').commands_block.splice(jquery__WEBPACK_IMPORTED_MODULE_0___default()(evt.item).parent().data('command').commands_block.indexOf(command_in_drag), 1);
  24339. }
  24340. }
  24341. }
  24342. var command_in_drag;
  24343. function addSortableHandler(element, id_function) {
  24344. var n_group = 'commands_drag_' + id_function;
  24345. Sortable.create(element, {
  24346. handle: '.command_drag',
  24347. ghostClass: 'ghost',
  24348. animation: 300,
  24349. group: {
  24350. name: n_group
  24351. },
  24352. onEnd: function onEnd(evt) {
  24353. //updateSequenceLocals(evt.oldIndex, evt.newIndex, function_obj);
  24354. var itemEl = evt.item; // dragged HTMLElement
  24355. evt.to; // target list
  24356. evt.from; // previous list
  24357. evt.oldIndex; // element's old index within old parent
  24358. evt.newIndex; // element's new index within new parent
  24359. //console.log('::EVT::');
  24360. //console.log(evt);
  24361. window.evento_drag = evt;
  24362. try {
  24363. updateProgramObjDrag();
  24364. } catch (e) {
  24365. window.draging = false;
  24366. }
  24367. },
  24368. onStart: function onStart(evt) {
  24369. //console.log("START::EVT::");
  24370. //console.log(evt);
  24371. //console.log("\n\ncommand_in_drag");
  24372. try {
  24373. prepareDragHandler(evt);
  24374. } catch (e) {
  24375. window.draging = false;
  24376. }
  24377. }
  24378. });
  24379. element = jquery__WEBPACK_IMPORTED_MODULE_0___default()(element);
  24380. element.find(".iftrue").each(function (index) {
  24381. addSortableHandler(jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).find(".block_commands")[0], id_function);
  24382. addSortableHandler(jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).find(".block_commands")[1], id_function);
  24383. });
  24384. element.find(".repeatNtimes").each(function (index) {
  24385. addSortableHandler(jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).find(".block_commands")[0], id_function);
  24386. });
  24387. element.find(".dowhiletrue").each(function (index) {
  24388. addSortableHandler(jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).find(".block_commands")[0], id_function);
  24389. });
  24390. element.find(".whiletrue").each(function (index) {
  24391. addSortableHandler(jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).find(".block_commands")[0], id_function);
  24392. });
  24393. element.find(".switch").each(function (index) {
  24394. jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).find(".case_div").each(function (index) {
  24395. addSortableHandler(jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).find(".case_commands_block")[0], id_function);
  24396. });
  24397. });
  24398. }
  24399. function initVisualUI() {
  24400. // MUST USE CONST, LET, OR VAR !!!!!!
  24401. var mainDiv = jquery__WEBPACK_IMPORTED_MODULE_0___default()('#visual-main-div'); // fill mainDiv with functions and globals...
  24402. // renderAlgorithm()...
  24403. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.add_function_button').on('click', function () {
  24404. addFunctionHandler();
  24405. });
  24406. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.add_global_button').on('click', function () {
  24407. window.insertContext = true;
  24408. _globals__WEBPACK_IMPORTED_MODULE_4__["addGlobal"](program, true);
  24409. });
  24410. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.run_button').on('click', function () {
  24411. runCode();
  24412. });
  24413. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.visual_coding_button').on('click', function () {
  24414. toggleVisualCoding();
  24415. });
  24416. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.textual_coding_button').on('click', function () {
  24417. toggleTextualCoding();
  24418. });
  24419. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.assessment').on('click', function () {
  24420. runCodeAssessment();
  24421. is_iassign = true;
  24422. });
  24423. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.div_toggle_console').on('click', function () {
  24424. toggleConsole();
  24425. });
  24426. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.expand_button').on('click', function () {
  24427. full_screen();
  24428. });
  24429. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.main_title h2').prop('title', _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_ivprog_description'));
  24430. }
  24431. var is_iassign = false;
  24432. jquery__WEBPACK_IMPORTED_MODULE_0___default()(document).ready(function () {
  24433. var time_show = 750;
  24434. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.visual_coding_button').popup({
  24435. content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI("tooltip_visual"),
  24436. delay: {
  24437. show: time_show,
  24438. hide: 0
  24439. }
  24440. });
  24441. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.textual_coding_button').popup({
  24442. content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI("tooltip_textual"),
  24443. delay: {
  24444. show: time_show,
  24445. hide: 0
  24446. }
  24447. });
  24448. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.upload_file_button').popup({
  24449. content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI("tooltip_upload"),
  24450. delay: {
  24451. show: time_show,
  24452. hide: 0
  24453. }
  24454. });
  24455. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.download_file_button').popup({
  24456. content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI("tooltip_download"),
  24457. delay: {
  24458. show: time_show,
  24459. hide: 0
  24460. }
  24461. });
  24462. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.undo_button').popup({
  24463. content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI("tooltip_undo"),
  24464. delay: {
  24465. show: time_show,
  24466. hide: 0
  24467. }
  24468. });
  24469. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.redo_button').popup({
  24470. content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI("tooltip_redo"),
  24471. delay: {
  24472. show: time_show,
  24473. hide: 0
  24474. }
  24475. });
  24476. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.run_button').popup({
  24477. content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI("tooltip_run"),
  24478. delay: {
  24479. show: time_show,
  24480. hide: 0
  24481. }
  24482. });
  24483. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.assessment_button').popup({
  24484. content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI("tooltip_evaluate"),
  24485. delay: {
  24486. show: time_show,
  24487. hide: 0
  24488. }
  24489. });
  24490. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.help_button').popup({
  24491. content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI("tooltip_help") + ' - ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI("text_ivprog_version") + ' ' + ivprog_version,
  24492. delay: {
  24493. show: time_show,
  24494. hide: 0
  24495. }
  24496. });
  24497. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.add_global_button').popup({
  24498. content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI("tooltip_add_global"),
  24499. delay: {
  24500. show: time_show,
  24501. hide: 0
  24502. }
  24503. });
  24504. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.div_toggle_console').popup({
  24505. content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI("tooltip_console"),
  24506. delay: {
  24507. show: time_show,
  24508. hide: 0
  24509. }
  24510. });
  24511. Sortable.create(listWithHandle, {
  24512. handle: '.glyphicon-move',
  24513. animation: 100,
  24514. ghostClass: 'ghost',
  24515. group: 'functions_divs_drag',
  24516. onEnd: function onEnd(evt) {
  24517. updateSequenceFunction(evt.oldIndex, evt.newIndex);
  24518. }
  24519. });
  24520. var listGlobalsHandle = document.getElementById("listGlobalsHandle");
  24521. Sortable.create(listGlobalsHandle, {
  24522. handle: '.ellipsis',
  24523. animation: 100,
  24524. ghostClass: 'ghost',
  24525. group: 'globals_divs_drag',
  24526. onEnd: function onEnd(evt) {
  24527. updateSequenceGlobals(evt.oldIndex, evt.newIndex);
  24528. }
  24529. });
  24530. });
  24531. function updateSequenceParameters(oldIndex, newIndex, function_obj) {
  24532. function_obj.parameters_list.splice(newIndex, 0, function_obj.parameters_list.splice(oldIndex, 1)[0]);
  24533. }
  24534. function updateSequenceLocals(oldIndex, newIndex, function_obj) {
  24535. function_obj.variables_list.splice(newIndex, 0, function_obj.variables_list.splice(oldIndex, 1)[0]);
  24536. }
  24537. function updateSequenceGlobals(oldIndex, newIndex) {
  24538. program_obj.globals.splice(newIndex, 0, program_obj.globals.splice(oldIndex, 1)[0]);
  24539. }
  24540. function updateSequenceFunction(oldIndex, newIndex) {
  24541. program_obj.functions.splice(newIndex, 0, program_obj.functions.splice(oldIndex, 1)[0]);
  24542. }
  24543. function runCodeAssessment() {
  24544. window.studentGrade = null;
  24545. studentTemp = null;
  24546. var strCode = _code_generator__WEBPACK_IMPORTED_MODULE_7__["generate"]();
  24547. if (strCode == null) {
  24548. return;
  24549. }
  24550. toggleConsole(true);
  24551. if (domConsole == null) domConsole = new _io_domConsole__WEBPACK_IMPORTED_MODULE_9__["DOMConsole"]("#ivprog-term");
  24552. jquery__WEBPACK_IMPORTED_MODULE_0___default()("#ivprog-term").slideDown(500);
  24553. var runner = new _assessment_ivprogAssessment__WEBPACK_IMPORTED_MODULE_14__["IVProgAssessment"](strCode, testCases, domConsole);
  24554. runner.runTest().then(function (grade) {
  24555. if (!is_iassign) {
  24556. parent.getEvaluationCallback(grade);
  24557. } else {
  24558. is_iassign = false;
  24559. }
  24560. }).catch(function (err) {
  24561. return console.log(err);
  24562. });
  24563. }
  24564. function runCode() {
  24565. var strCode = _code_generator__WEBPACK_IMPORTED_MODULE_7__["generate"]();
  24566. if (strCode == null) {
  24567. return;
  24568. }
  24569. toggleConsole(true);
  24570. if (domConsole == null) domConsole = new _io_domConsole__WEBPACK_IMPORTED_MODULE_9__["DOMConsole"]("#ivprog-term");
  24571. jquery__WEBPACK_IMPORTED_MODULE_0___default()("#ivprog-term").slideDown(500);
  24572. try {
  24573. var parser = _ast_ivprogParser__WEBPACK_IMPORTED_MODULE_10__["IVProgParser"].createParser(strCode);
  24574. var analyser = new _processor_semantic_semanticAnalyser__WEBPACK_IMPORTED_MODULE_13__["SemanticAnalyser"](parser.parseTree());
  24575. var data = analyser.analyseTree();
  24576. var proc = new _processor_ivprogProcessor__WEBPACK_IMPORTED_MODULE_11__["IVProgProcessor"](data);
  24577. proc.registerInput(domConsole);
  24578. proc.registerOutput(domConsole);
  24579. jquery__WEBPACK_IMPORTED_MODULE_0___default()("#ivprog-term").addClass('ivprog-term-active');
  24580. proc.interpretAST().then(function (_) {
  24581. domConsole.info("Programa executado com sucesso!");
  24582. jquery__WEBPACK_IMPORTED_MODULE_0___default()("#ivprog-term").removeClass('ivprog-term-active');
  24583. }).catch(function (err) {
  24584. domConsole.err(err.message);
  24585. jquery__WEBPACK_IMPORTED_MODULE_0___default()("#ivprog-term").removeClass('ivprog-term-active');
  24586. });
  24587. } catch (error) {
  24588. domConsole.err(error.message);
  24589. console.log(error);
  24590. }
  24591. }
  24592. function toggleConsole(is_running) {
  24593. if (is_running) {
  24594. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.ivprog-term-div').css('display', 'block');
  24595. jquery__WEBPACK_IMPORTED_MODULE_0___default()('#ivprog-term').css('min-height', '160px');
  24596. jquery__WEBPACK_IMPORTED_MODULE_0___default()('#ivprog-term').css('margin-top', '-170px');
  24597. return;
  24598. }
  24599. if (jquery__WEBPACK_IMPORTED_MODULE_0___default()('#ivprog-term').css('min-height') == '160px') {
  24600. // esconder
  24601. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.ivprog-term-div').css('display', 'none');
  24602. jquery__WEBPACK_IMPORTED_MODULE_0___default()('#ivprog-term').css('min-height', '0');
  24603. jquery__WEBPACK_IMPORTED_MODULE_0___default()('#ivprog-term').css('margin-top', '-30px');
  24604. jquery__WEBPACK_IMPORTED_MODULE_0___default()('#ivprog-term').css('padding', '5px');
  24605. } else {
  24606. // mostrar
  24607. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.ivprog-term-div').css('display', 'block');
  24608. jquery__WEBPACK_IMPORTED_MODULE_0___default()('#ivprog-term').css('min-height', '160px');
  24609. jquery__WEBPACK_IMPORTED_MODULE_0___default()('#ivprog-term').css('margin-top', '-170px');
  24610. }
  24611. }
  24612. function waitToCloseConsole() {
  24613. domConsole.info("Aperte qualquer tecla para fechar...");
  24614. var p = new Promise(function (resolve, _) {
  24615. domConsole.requestInput(resolve, true);
  24616. });
  24617. p.then(function (_) {
  24618. domConsole.dispose();
  24619. domConsole = null;
  24620. jquery__WEBPACK_IMPORTED_MODULE_0___default()("#ivprog-term").hide();
  24621. });
  24622. }
  24623. function toggleTextualCoding() {
  24624. var code = _code_generator__WEBPACK_IMPORTED_MODULE_7__["generate"]();
  24625. if (code == null) {
  24626. return;
  24627. }
  24628. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.ivprog_visual_panel').css('display', 'none');
  24629. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.ivprog_textual_panel').css('display', 'block');
  24630. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.ivprog_textual_panel').removeClass('loading');
  24631. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.ivprog_textual_code').text(code);
  24632. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.visual_coding_button').removeClass('active');
  24633. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.textual_coding_button').addClass('active');
  24634. }
  24635. function toggleVisualCoding() {
  24636. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.ivprog_textual_panel').addClass('loading');
  24637. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.ivprog_textual_panel').css('display', 'none');
  24638. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.ivprog_visual_panel').css('display', 'block');
  24639. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.textual_coding_button').removeClass('active');
  24640. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.visual_coding_button').addClass('active');
  24641. }
  24642. function removeParameter(function_obj, parameter_obj, parameter_container) {
  24643. var index = function_obj.parameters_list.indexOf(parameter_obj);
  24644. if (index > -1) {
  24645. window.insertContext = true;
  24646. function_obj.parameters_list.splice(index, 1);
  24647. }
  24648. jquery__WEBPACK_IMPORTED_MODULE_0___default()(parameter_container).fadeOut();
  24649. }
  24650. function updateParameterType(parameter_obj, new_type) {
  24651. var new_dimensions = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
  24652. parameter_obj.type = new_type;
  24653. parameter_obj.dimensions = new_dimensions;
  24654. if (new_dimensions > 0) {
  24655. parameter_obj.rows = new_dimensions;
  24656. parameter_obj.columns = 2;
  24657. }
  24658. }
  24659. function renderParameter(function_obj, parameter_obj, function_container) {
  24660. var ret = "";
  24661. ret += '<div class="ui label function_name_parameter pink"><i class="ui icon ellipsis vertical inverted"></i>';
  24662. ret += '<div class="ui dropdown parameter_type">';
  24663. if (parameter_obj.dimensions > 0) {
  24664. ret += '<div class="text">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('vector') + ':' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI(parameter_obj.type);
  24665. if (parameter_obj.dimensions == 1) {
  24666. ret += ' [ ] ';
  24667. } else {
  24668. ret += ' [ ] [ ] ';
  24669. }
  24670. ret += '</div>';
  24671. } else {
  24672. ret += '<div class="text">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI(parameter_obj.type) + '</div>';
  24673. }
  24674. ret += '<div class="menu">';
  24675. for (var tm in _types__WEBPACK_IMPORTED_MODULE_1__["Types"]) {
  24676. if (tm == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].VOID.toUpperCase()) {
  24677. continue;
  24678. }
  24679. ret += '<div class="item ' + (parameter_obj.type == tm.toLowerCase() ? ' selected ' : '') + '" data-type="' + tm + '" >' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI(tm.toLowerCase()) + '</div>';
  24680. }
  24681. for (var tm in _types__WEBPACK_IMPORTED_MODULE_1__["Types"]) {
  24682. if (tm == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].VOID.toUpperCase()) {
  24683. continue;
  24684. }
  24685. ret += '<div class="item">' + '<i class="dropdown icon"></i>' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('vector') + ':' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI(tm.toLowerCase()) + '<div class="menu">' + '<div class="item" data-text="' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('vector') + ':' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI(tm.toLowerCase()) + ' [ ] " data-type="' + tm + '" data-dimensions="1">[ ]</div>' + '<div class="item" data-text="' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('vector') + ':' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI(tm.toLowerCase()) + ' [ ] [ ] " data-type="' + tm + '" data-dimensions="2">[ ] [ ] </div>' + '</div>' + '</div>';
  24686. }
  24687. ret += '</div></div>';
  24688. ret += '<div class="parameter_div_edit"><span class="span_name_parameter label_enable_name_parameter">' + parameter_obj.name + '</span></div> ';
  24689. ret += ' <i class="yellow inverted icon times remove_parameter"></i></div>';
  24690. ret = jquery__WEBPACK_IMPORTED_MODULE_0___default()(ret);
  24691. function_container.find('.container_parameters_list').append(ret);
  24692. ret.find('.remove_parameter').on('click', function (e) {
  24693. removeParameter(function_obj, parameter_obj, ret);
  24694. });
  24695. ret.find('.ui.dropdown.parameter_type').dropdown({
  24696. onChange: function onChange(value, text, $selectedItem) {
  24697. if ($selectedItem.data('dimensions')) {
  24698. updateParameterType(parameter_obj, _types__WEBPACK_IMPORTED_MODULE_1__["Types"][$selectedItem.data('type')], $selectedItem.data('dimensions'));
  24699. } else {
  24700. updateParameterType(parameter_obj, _types__WEBPACK_IMPORTED_MODULE_1__["Types"][$selectedItem.data('type')]);
  24701. }
  24702. },
  24703. selectOnKeydown: false
  24704. });
  24705. ret.find('.label_enable_name_parameter').on('click', function (e) {
  24706. enableNameParameterUpdate(parameter_obj, ret, function_obj);
  24707. });
  24708. return ret;
  24709. }
  24710. function updateParameterName(parameter_var, new_name, parameter_obj_dom, function_obj) {
  24711. if (parameter_var.name == new_name) {
  24712. return;
  24713. }
  24714. if (isValidIdentifier(new_name)) {
  24715. if (variableNameAlreadyExists(new_name, function_obj)) {
  24716. _utils__WEBPACK_IMPORTED_MODULE_16__["renderErrorMessage"](parameter_obj_dom.find('.parameter_div_edit'), _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('inform_valid_variable_duplicated'));
  24717. } else {
  24718. parameter_var.name = new_name;
  24719. }
  24720. } else {
  24721. _utils__WEBPACK_IMPORTED_MODULE_16__["renderErrorMessage"](parameter_obj_dom.find('.parameter_div_edit'), _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('inform_valid_name'));
  24722. }
  24723. }
  24724. function variableNameAlreadyExists(name_var, function_obj) {
  24725. if (function_obj.parameters_list) {
  24726. for (var i = 0; i < function_obj.parameters_list.length; i++) {
  24727. if (function_obj.parameters_list[i].name == name_var) {
  24728. return true;
  24729. }
  24730. }
  24731. }
  24732. if (function_obj.variables_list) {
  24733. for (var i = 0; i < function_obj.variables_list.length; i++) {
  24734. if (function_obj.variables_list[i].name == name_var) {
  24735. return true;
  24736. }
  24737. }
  24738. }
  24739. return false;
  24740. }
  24741. function updateFunctionName(function_var, new_name, function_obj_dom) {
  24742. if (function_var.name == new_name) {
  24743. return;
  24744. }
  24745. if (isValidIdentifier(new_name)) {
  24746. if (functionNameAlreadyExists(new_name)) {
  24747. _utils__WEBPACK_IMPORTED_MODULE_16__["renderErrorMessage"](function_obj_dom.find('.function_name_div'), _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('inform_valid_name_duplicated'));
  24748. } else {
  24749. function_var.name = new_name;
  24750. }
  24751. } else {
  24752. _utils__WEBPACK_IMPORTED_MODULE_16__["renderErrorMessage"](function_obj_dom.find('.function_name_div'), _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('inform_valid_name'));
  24753. }
  24754. }
  24755. function functionNameAlreadyExists(function_name) {
  24756. for (var i = 0; i < window.program_obj.functions.length; i++) {
  24757. if (window.program_obj.functions[i].name == function_name) {
  24758. return true;
  24759. }
  24760. }
  24761. return false;
  24762. }
  24763. function isValidIdentifier(identifier_str) {
  24764. return /^[a-zA-Z_][a-zA-Z0-9_]*$/.test(identifier_str);
  24765. }
  24766. var opened_name_parameter = false;
  24767. var opened_input_parameter = null;
  24768. function enableNameParameterUpdate(parameter_obj, parent_node, function_obj) {
  24769. if (opened_name_parameter) {
  24770. opened_input_parameter.focus();
  24771. return;
  24772. }
  24773. opened_name_parameter = true;
  24774. parent_node = jquery__WEBPACK_IMPORTED_MODULE_0___default()(parent_node);
  24775. var input_field;
  24776. parent_node.find('.span_name_parameter').text('');
  24777. input_field = jquery__WEBPACK_IMPORTED_MODULE_0___default()("<input type='text' class='width-dynamic input_name_function' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' value='" + parameter_obj.name + "' />");
  24778. input_field.insertBefore(parent_node.find('.span_name_parameter'));
  24779. input_field.on('input', function () {
  24780. var inputWidth = input_field.textWidth() + 10;
  24781. opened_input_parameter = input_field;
  24782. input_field.focus();
  24783. var tmpStr = input_field.val();
  24784. input_field.val('');
  24785. input_field.val(tmpStr);
  24786. input_field.css({
  24787. width: inputWidth
  24788. });
  24789. }).trigger('input');
  24790. input_field.focusout(function () {
  24791. /// update array:
  24792. if (input_field.val().trim()) {
  24793. updateParameterName(parameter_obj, input_field.val().trim(), parent_node, function_obj);
  24794. parent_node.find('.span_name_parameter').text(parameter_obj.name);
  24795. }
  24796. input_field.off();
  24797. input_field.remove(); /// update elements:
  24798. opened_name_parameter = false;
  24799. opened_input_parameter = false;
  24800. });
  24801. input_field.on('keydown', function (e) {
  24802. var code = e.keyCode || e.which;
  24803. if (code == 13) {
  24804. if (input_field.val().trim()) {
  24805. updateParameterName(parameter_obj, input_field.val().trim(), parent_node, function_obj);
  24806. parent_node.find('.span_name_parameter').text(parameter_obj.name);
  24807. }
  24808. input_field.off();
  24809. input_field.remove(); /// update elements:
  24810. opened_name_parameter = false;
  24811. opened_input_parameter = false;
  24812. }
  24813. if (code == 27) {
  24814. parent_node.find('.span_name_parameter').text(parameter_obj.name);
  24815. input_field.off();
  24816. input_field.remove(); /// update elements:
  24817. opened_name_parameter = false;
  24818. opened_input_parameter = false;
  24819. }
  24820. });
  24821. input_field.select();
  24822. }
  24823. var opened_name_function = false;
  24824. var opened_input = null;
  24825. var previousPadding = null;
  24826. function enableNameFunctionUpdate(function_obj, parent_node) {
  24827. if (opened_name_function) {
  24828. opened_input.focus();
  24829. return;
  24830. }
  24831. parent_node = jquery__WEBPACK_IMPORTED_MODULE_0___default()(parent_node);
  24832. parent_node.find('.span_name_function').text('');
  24833. var input_field;
  24834. if (!previousPadding) {
  24835. previousPadding = parent_node.find('.span_name_function').css('padding-left');
  24836. }
  24837. parent_node.find('.span_name_function').css('padding-left', '0');
  24838. parent_node.find('.span_name_function').css('padding-right', '0');
  24839. input_field = jquery__WEBPACK_IMPORTED_MODULE_0___default()("<input type='text' class='width-dynamic input_name_function' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' value='" + function_obj.name + "' />");
  24840. input_field.insertBefore(parent_node.find('.span_name_function'));
  24841. input_field.on('input', function () {
  24842. var inputWidth = input_field.textWidth() + 10;
  24843. opened_input = input_field;
  24844. input_field.focus();
  24845. var tmpStr = input_field.val();
  24846. input_field.val('');
  24847. input_field.val(tmpStr);
  24848. input_field.css({
  24849. width: inputWidth
  24850. });
  24851. }).trigger('input');
  24852. input_field.focusout(function () {
  24853. /// update array:
  24854. if (input_field.val().trim()) {
  24855. updateFunctionName(function_obj, input_field.val().trim(), parent_node);
  24856. }
  24857. input_field.off();
  24858. input_field.remove();
  24859. parent_node.find('.span_name_function').css('padding-left', previousPadding);
  24860. parent_node.find('.span_name_function').css('padding-right', previousPadding);
  24861. parent_node.find('.span_name_function').text(function_obj.name); /// update elements:
  24862. opened_name_function = false;
  24863. opened_input = false;
  24864. });
  24865. input_field.on('keydown', function (e) {
  24866. var code = e.keyCode || e.which;
  24867. if (code == 13) {
  24868. if (input_field.val().trim()) {
  24869. updateFunctionName(function_obj, input_field.val().trim(), parent_node);
  24870. }
  24871. input_field.off();
  24872. input_field.remove();
  24873. parent_node.find('.span_name_function').css('padding-left', previousPadding);
  24874. parent_node.find('.span_name_function').css('padding-right', previousPadding);
  24875. parent_node.find('.span_name_function').text(function_obj.name); /// update elements:
  24876. opened_name_function = false;
  24877. opened_input = false;
  24878. }
  24879. if (code == 27) {
  24880. input_field.off();
  24881. input_field.remove();
  24882. parent_node.find('.span_name_function').css('padding-left', previousPadding);
  24883. parent_node.find('.span_name_function').css('padding-right', previousPadding);
  24884. parent_node.find('.span_name_function').text(function_obj.name); /// update elements:
  24885. opened_name_function = false;
  24886. opened_input = false;
  24887. }
  24888. });
  24889. input_field.select();
  24890. }
  24891. function addFunctionChangeListener(callback) {
  24892. functionsChangeListeners.push(callback);
  24893. return functionsChangeListeners.length - 1;
  24894. }
  24895. function addGlobalChangeListener(callback) {
  24896. globalChangeListeners.push(callback);
  24897. return globalChangeListeners.length - 1;
  24898. }
  24899. function removeGlobalListener(index) {
  24900. globalChangeListeners.splice(index, 1);
  24901. }
  24902. function removeFunctionListener(index) {
  24903. functionsChangeListeners.splice(index);
  24904. }
  24905. /***/ }),
  24906. /***/ "./js/visualUI/globals.js":
  24907. /*!********************************!*\
  24908. !*** ./js/visualUI/globals.js ***!
  24909. \********************************/
  24910. /*! exports provided: addGlobal, renderGlobal */
  24911. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  24912. "use strict";
  24913. __webpack_require__.r(__webpack_exports__);
  24914. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "addGlobal", function() { return addGlobal; });
  24915. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "renderGlobal", function() { return renderGlobal; });
  24916. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  24917. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_0__);
  24918. /* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./types */ "./js/visualUI/types.js");
  24919. /* harmony import */ var _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  24920. /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  24921. /* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./utils */ "./js/visualUI/utils.js");
  24922. /* harmony import */ var _semantic_semantic_min_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../semantic/semantic.min.js */ "./js/semantic/semantic.min.js");
  24923. /* harmony import */ var _semantic_semantic_min_js__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_semantic_semantic_min_js__WEBPACK_IMPORTED_MODULE_5__);
  24924. window.jQuery = jquery__WEBPACK_IMPORTED_MODULE_0___default.a;
  24925. var counter_new_globals = 0;
  24926. function addGlobal(program) {
  24927. var is_from_click = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  24928. var new_global = new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["Variable"](_types__WEBPACK_IMPORTED_MODULE_1__["Types"].INTEGER, _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('new_global') + '_' + counter_new_globals, 1);
  24929. counter_new_globals++;
  24930. program.addGlobal(new_global);
  24931. var newe = renderGlobal(new_global);
  24932. if (is_from_click) {
  24933. newe.css('display', 'none');
  24934. newe.fadeIn();
  24935. }
  24936. }
  24937. function toggleConstant(global_var) {
  24938. global_var.is_constant = !global_var.is_constant;
  24939. }
  24940. function updateName(global_var, new_name, global_obj_dom) {
  24941. if (global_var.name == new_name) {
  24942. return;
  24943. }
  24944. if (isValidIdentifier(new_name)) {
  24945. if (globalNameAlreadyExists(new_name)) {
  24946. _utils__WEBPACK_IMPORTED_MODULE_4__["renderErrorMessage"](global_obj_dom.find('.editing_name_var'), _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('inform_valid_global_duplicated'));
  24947. } else {
  24948. global_var.name = new_name;
  24949. }
  24950. } else {
  24951. _utils__WEBPACK_IMPORTED_MODULE_4__["renderErrorMessage"](global_obj_dom.find('.editing_name_var'), _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('inform_valid_name'));
  24952. }
  24953. }
  24954. function globalNameAlreadyExists(global_name) {
  24955. for (var i = 0; i < window.program_obj.globals.length; i++) {
  24956. if (window.program_obj.globals[i].name == global_name) {
  24957. return true;
  24958. }
  24959. }
  24960. return false;
  24961. }
  24962. function isValidIdentifier(identifier_str) {
  24963. return /^[a-zA-Z_][a-zA-Z0-9_]*$/.test(identifier_str);
  24964. }
  24965. function updateType(global_var, new_type) {
  24966. var new_dimensions = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
  24967. global_var.type = new_type;
  24968. global_var.dimensions = new_dimensions;
  24969. if (new_dimensions > 0) {
  24970. global_var.rows = new_dimensions;
  24971. global_var.columns = 2;
  24972. }
  24973. updateInitialValues(global_var);
  24974. }
  24975. function removeGlobal(global_var, global_container) {
  24976. var index = window.program_obj.globals.indexOf(global_var);
  24977. if (index > -1) {
  24978. window.insertContext = true;
  24979. window.program_obj.globals.splice(index, 1);
  24980. }
  24981. global_container.children().off();
  24982. global_container.off();
  24983. global_container.fadeOut();
  24984. }
  24985. function updateInitialValues(global_var) {
  24986. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].INTEGER) {
  24987. if (global_var.dimensions == 0) {
  24988. global_var.value = 1;
  24989. }
  24990. if (global_var.dimensions == 1) {
  24991. global_var.value = [1, 1];
  24992. }
  24993. if (global_var.dimensions == 2) {
  24994. global_var.value = [[1, 1], [1, 1]];
  24995. }
  24996. }
  24997. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  24998. if (global_var.dimensions == 0) {
  24999. global_var.value = 1.0;
  25000. }
  25001. if (global_var.dimensions == 1) {
  25002. global_var.value = [1.0, 1.0];
  25003. }
  25004. if (global_var.dimensions == 2) {
  25005. global_var.value = [[1.0, 1.0], [1.0, 1.0]];
  25006. }
  25007. }
  25008. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].TEXT) {
  25009. if (global_var.dimensions == 0) {
  25010. global_var.value = _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_start');
  25011. }
  25012. if (global_var.dimensions == 1) {
  25013. global_var.value = [_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_start'), _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_start')];
  25014. }
  25015. if (global_var.dimensions == 2) {
  25016. global_var.value = [[_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_start'), _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_start')], [_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_start'), _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_start')]];
  25017. }
  25018. }
  25019. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].BOOLEAN) {
  25020. if (global_var.dimensions == 0) {
  25021. global_var.value = true;
  25022. }
  25023. if (global_var.dimensions == 1) {
  25024. global_var.value = [true, true];
  25025. }
  25026. if (global_var.dimensions == 2) {
  25027. global_var.value = [[true, true], [true, true]];
  25028. }
  25029. }
  25030. }
  25031. function alternateBooleanGlobalValue(global_var, value_container) {
  25032. global_var.value = !global_var.value;
  25033. jquery__WEBPACK_IMPORTED_MODULE_0___default()(value_container).find('.span_value_variable').text(_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI(global_var.value));
  25034. }
  25035. function alternateBooleanGlobalVectorValue(global_var, index, value_container) {
  25036. global_var.value[index] = !global_var.value[index];
  25037. jquery__WEBPACK_IMPORTED_MODULE_0___default()(value_container).find('.span_value_variable').text(_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI(global_var.value[index]));
  25038. }
  25039. function removeGlobalColumnVector(global_var) {
  25040. if (global_var.columns == 0) {
  25041. return;
  25042. }
  25043. global_var.columns--;
  25044. global_var.value.splice(global_var.value.length - 1, 1);
  25045. }
  25046. function addGlobalColumnVector(global_var) {
  25047. global_var.columns++;
  25048. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].INTEGER) {
  25049. global_var.value.push(1);
  25050. }
  25051. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  25052. global_var.value.push(1.0);
  25053. }
  25054. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].TEXT) {
  25055. global_var.value.push(_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_start'));
  25056. }
  25057. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].BOOLEAN) {
  25058. global_var.value.push(true);
  25059. }
  25060. }
  25061. function removeColumnGlobalMatrix(global_var) {
  25062. if (global_var.columns == 0) {
  25063. return;
  25064. }
  25065. global_var.columns--;
  25066. for (var i = 0; i < global_var.rows; i++) {
  25067. global_var.value[i].splice(global_var.value[i].length - 1, 1);
  25068. }
  25069. }
  25070. function addColumnGlobalMatrix(global_var) {
  25071. global_var.columns++;
  25072. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].INTEGER) {
  25073. for (var i = 0; i < global_var.rows; i++) {
  25074. global_var.value[i].push(1);
  25075. }
  25076. }
  25077. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  25078. for (var i = 0; i < global_var.rows; i++) {
  25079. global_var.value[i].push(1.0);
  25080. }
  25081. }
  25082. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].TEXT) {
  25083. for (var i = 0; i < global_var.rows; i++) {
  25084. global_var.value[i].push(_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_start'));
  25085. }
  25086. }
  25087. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].BOOLEAN) {
  25088. for (var i = 0; i < global_var.rows; i++) {
  25089. global_var.value[i].push(true);
  25090. }
  25091. }
  25092. }
  25093. function removeLineGlobalMatrix(global_var) {
  25094. if (global_var.rows == 0) {
  25095. return;
  25096. }
  25097. global_var.rows--;
  25098. global_var.value.splice(global_var.value.length - 1, 1);
  25099. }
  25100. function addLineGlobalMatrix(global_var) {
  25101. global_var.rows++;
  25102. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].INTEGER) {
  25103. var n_l = [];
  25104. for (var i = 0; i < global_var.columns; i++) {
  25105. n_l.push(1);
  25106. }
  25107. global_var.value.push(n_l);
  25108. }
  25109. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  25110. var n_l = [];
  25111. for (i = 0; i < global_var.columns; i++) {
  25112. n_l.push(1.0);
  25113. }
  25114. global_var.value.push(n_l);
  25115. }
  25116. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].TEXT) {
  25117. var n_l = [];
  25118. for (i = 0; i < global_var.columns; i++) {
  25119. n_l.push(_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_start'));
  25120. }
  25121. global_var.value.push(n_l);
  25122. }
  25123. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].BOOLEAN) {
  25124. var n_l = [];
  25125. for (i = 0; i < global_var.columns; i++) {
  25126. n_l.push(true);
  25127. }
  25128. global_var.value.push(n_l);
  25129. }
  25130. }
  25131. function alternateBooleanGlobalMatrixValue(global_var, row, index, value_container) {
  25132. global_var.value[row][index] = !global_var.value[row][index];
  25133. jquery__WEBPACK_IMPORTED_MODULE_0___default()(value_container).find('.span_value_variable').text(_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI(global_var.value[row][index]));
  25134. }
  25135. function renderValues(global_var, global_container) {
  25136. var ret = "";
  25137. var j = 0;
  25138. if (global_var.dimensions == 0) {
  25139. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  25140. ret += '<div class="created_div_valor_var"><span class="span_value_variable simple_var">' + global_var.value.toFixed(1) + '</span> </div> ';
  25141. } else {
  25142. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].BOOLEAN) {
  25143. ret += '<div class="created_div_valor_var"><span class="span_value_variable boolean_simple_type">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI(global_var.value) + '</span> </div> ';
  25144. } else {
  25145. ret += '<div class="created_div_valor_var"><span class="span_value_variable simple_var">' + global_var.value + '</span> </div> ';
  25146. }
  25147. }
  25148. } else {
  25149. ret += '<table class="tabela_var">';
  25150. if (global_var.dimensions == 1) {
  25151. ret += '<tr>';
  25152. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  25153. for (var k = 0; k < global_var.columns; k++) {
  25154. ret += '<td><span class="span_value_variable vector_var" data-index="' + k + '">' + global_var.value[k].toFixed(1) + '</span></td>';
  25155. }
  25156. } else {
  25157. for (var k = 0; k < global_var.columns; k++) {
  25158. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].BOOLEAN) {
  25159. ret += '<td><span class="span_value_variable boolean_vector_var" data-index="' + k + '">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI(global_var.value[k]) + '</span></td>';
  25160. } else {
  25161. ret += '<td><span class="span_value_variable vector_var" data-index="' + k + '">' + global_var.value[k] + '</span>' + '</td>';
  25162. }
  25163. }
  25164. }
  25165. ret += '</tr>';
  25166. ret += '</table>';
  25167. 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>';
  25168. }
  25169. if (global_var.dimensions == 2) {
  25170. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  25171. for (var l = 0; l < global_var.rows; l++) {
  25172. ret += '<tr>';
  25173. for (var k = 0; k < global_var.columns; k++) {
  25174. ret += '<td><span class="span_value_variable matrix_var" data-index="' + k + '" data-row="' + l + '">' + global_var.value[l][k].toFixed(1) + '</span>' + '</td>';
  25175. }
  25176. ret += '</tr>';
  25177. }
  25178. } else {
  25179. for (var l = 0; l < global_var.rows; l++) {
  25180. ret += '<tr>';
  25181. for (var k = 0; k < global_var.columns; k++) {
  25182. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].BOOLEAN) {
  25183. ret += '<td><span class="span_value_variable boolean_matrix_var" data-index="' + k + '" data-row="' + l + '">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI(global_var.value[l][k]) + '</span></td>';
  25184. } else {
  25185. ret += '<td><span class="span_value_variable matrix_var" data-index="' + k + '" data-row="' + l + '">' + global_var.value[l][k] + '</span></td>';
  25186. }
  25187. }
  25188. ret += '</tr>';
  25189. }
  25190. }
  25191. if (global_var.rows == 0) {
  25192. ret += '<tr><td></td></tr>';
  25193. }
  25194. 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>';
  25195. ret += '</table>';
  25196. 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>';
  25197. }
  25198. }
  25199. global_container.find(".div_valor_var").html('');
  25200. ret = jquery__WEBPACK_IMPORTED_MODULE_0___default()(ret);
  25201. ret.find('.span_value_variable').data('associatedOject', global_var);
  25202. ret.find(".boolean_simple_type").on('click', function (e) {
  25203. alternateBooleanGlobalValue(global_var, this.parentNode);
  25204. });
  25205. ret.find(".simple_var").on('click', function (e) {
  25206. enableGlobalValueUpdate(global_var, this.parentNode);
  25207. });
  25208. ret.find(".boolean_vector_var").on('click', function (e) {
  25209. alternateBooleanGlobalVectorValue(global_var, jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).data('index'), this.parentNode);
  25210. });
  25211. ret.find(".vector_var").on('click', function (e) {
  25212. enableGlobalVectorValueUpdate(global_var, jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).data('index'), this.parentNode);
  25213. });
  25214. ret.find(".remove_global_vector_column").on('click', function (e) {
  25215. removeGlobalColumnVector(global_var);
  25216. global_container.find(".div_valor_var").html('');
  25217. renderValues(global_var, global_container);
  25218. });
  25219. ret.find(".add_global_vector_column").on('click', function (e) {
  25220. addGlobalColumnVector(global_var);
  25221. global_container.find(".div_valor_var").html('');
  25222. renderValues(global_var, global_container);
  25223. });
  25224. ret.find(".remove_global_matrix_column").on('click', function (e) {
  25225. removeColumnGlobalMatrix(global_var);
  25226. global_container.find(".div_valor_var").html('');
  25227. renderValues(global_var, global_container);
  25228. });
  25229. ret.find(".add_global_matrix_column").on('click', function (e) {
  25230. addColumnGlobalMatrix(global_var);
  25231. global_container.find(".div_valor_var").html('');
  25232. renderValues(global_var, global_container);
  25233. });
  25234. ret.find(".remove_global_matrix_line").on('click', function (e) {
  25235. removeLineGlobalMatrix(global_var);
  25236. global_container.find(".div_valor_var").html('');
  25237. renderValues(global_var, global_container);
  25238. });
  25239. ret.find(".add_global_matrix_line").on('click', function (e) {
  25240. addLineGlobalMatrix(global_var);
  25241. global_container.find(".div_valor_var").html('');
  25242. renderValues(global_var, global_container);
  25243. });
  25244. ret.find(".boolean_matrix_var").on('click', function (e) {
  25245. alternateBooleanGlobalMatrixValue(global_var, jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).data('row'), jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).data('index'), this.parentNode);
  25246. });
  25247. ret.find(".matrix_var").on('click', function (e) {
  25248. enableGlobalMatrixValueUpdate(global_var, jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).data('row'), jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).data('index'), this.parentNode);
  25249. });
  25250. global_container.find(".div_valor_var").append(ret);
  25251. updateColumnsAndRowsText(global_container, global_var);
  25252. }
  25253. function addHandlers(global_container) {
  25254. var global_var = global_container.data('associatedOject'); // Manage constant option:
  25255. global_container.find(".alternate_constant").on('click', function (e) {
  25256. toggleConstant(global_var);
  25257. jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).removeClass("on off");
  25258. if (global_var.is_constant) {
  25259. jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).addClass("on");
  25260. } else {
  25261. jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).addClass("off");
  25262. }
  25263. }); // Manage global name:
  25264. global_container.find(".enable_edit_name_parameter").on('click', function (e) {
  25265. enableNameUpdate(global_container);
  25266. }); // Menu to change type:
  25267. global_container.find('.ui.dropdown.global_type').dropdown({
  25268. onChange: function onChange(value, text, $selectedItem) {
  25269. if ($selectedItem.data('dimensions')) {
  25270. updateType(global_var, _types__WEBPACK_IMPORTED_MODULE_1__["Types"][$selectedItem.data('type')], $selectedItem.data('dimensions'));
  25271. } else {
  25272. updateType(global_var, _types__WEBPACK_IMPORTED_MODULE_1__["Types"][$selectedItem.data('type')]);
  25273. }
  25274. renderValues(global_var, global_container);
  25275. },
  25276. selectOnKeydown: false
  25277. }); // Remove global:
  25278. global_container.find(".remove_global").on('click', function (e) {
  25279. removeGlobal(global_var, global_container);
  25280. });
  25281. }
  25282. function updateColumnsAndRowsText(global_container, global_var) {
  25283. var prev = global_container.find('.text').text().split('[');
  25284. if (prev.length == 2) {
  25285. var ff = prev[0] + '[ ' + global_var.columns + ' ] ';
  25286. global_container.find('.text').empty();
  25287. global_container.find('.text').text(ff);
  25288. }
  25289. if (prev.length == 3) {
  25290. var ff = prev[0] + '[ ' + global_var.columns + ' ] [ ' + global_var.rows + ' ] ';
  25291. global_container.find('.text').empty();
  25292. global_container.find('.text').text(ff);
  25293. }
  25294. }
  25295. function renderGlobal(global_var) {
  25296. var element = '<div class="ui label global_container pink"><i class="ui icon ellipsis vertical inverted"></i><div class="global_const">const: ';
  25297. element += '<i class="ui icon toggle ' + (global_var.is_constant ? "on" : "off") + ' alternate_constant"></i></div>';
  25298. element += '<div class="ui dropdown global_type">';
  25299. if (global_var.dimensions > 0) {
  25300. element += '<div class="text">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('vector') + ':' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI(global_var.type);
  25301. for (var i = 0; i < global_var.dimensions; i++) {
  25302. element += ' [ <span class="dimensions_' + i + '"></span> ] ';
  25303. }
  25304. element += '</div>';
  25305. } else {
  25306. element += '<div class="text">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI(global_var.type.toLowerCase()) + '</div>';
  25307. }
  25308. element += '<div class="menu">';
  25309. for (var tm in _types__WEBPACK_IMPORTED_MODULE_1__["Types"]) {
  25310. if (tm == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].VOID.toUpperCase()) {
  25311. continue;
  25312. }
  25313. element += '<div class="item ' + (global_var.type == tm.toLowerCase() ? ' selected ' : '') + '" data-type="' + tm + '" >' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI(tm.toLowerCase()) + '</div>';
  25314. }
  25315. for (var tm in _types__WEBPACK_IMPORTED_MODULE_1__["Types"]) {
  25316. if (tm == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].VOID.toUpperCase()) {
  25317. continue;
  25318. }
  25319. element += '<div class="item">' + '<i class="dropdown icon"></i>' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('vector') + ':' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI(tm.toLowerCase()) + '<div class="menu">' + '<div class="item" data-text="' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('vector') + ':' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI(tm.toLowerCase()) + ' [ ] " data-type="' + tm + '" data-dimensions="1">[ ]</div>' + '<div class="item" data-text="' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('vector') + ':' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI(tm.toLowerCase()) + ' [ ] [ ] " data-type="' + tm + '" data-dimensions="2">[ ] [ ] </div>' + '</div>' + '</div>';
  25320. }
  25321. 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> ';
  25322. element += '<div class="ui div_valor_var">' + global_var.value + '</div>';
  25323. element += ' <i class="yellow inverted icon times remove_global"></i></div>';
  25324. var complete_element = jquery__WEBPACK_IMPORTED_MODULE_0___default()(element);
  25325. complete_element.data('associatedOject', global_var);
  25326. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.list_globals').append(complete_element);
  25327. addHandlers(complete_element);
  25328. renderValues(global_var, complete_element);
  25329. if (global_var.dimensions == 1) {
  25330. complete_element.find('.dimensions_0').text(global_var.columns);
  25331. }
  25332. if (global_var.dimensions == 2) {
  25333. complete_element.find('.dimensions_0').text(global_var.columns);
  25334. complete_element.find('.dimensions_1').text(global_var.rows);
  25335. }
  25336. return complete_element;
  25337. }
  25338. var opened_name_value_matrix_global_v = false;
  25339. var opened_input_value_matrix_global_v = null;
  25340. function enableGlobalMatrixValueUpdate(global_var, row, index, parent_node) {
  25341. if (opened_name_value_matrix_global_v) {
  25342. opened_input_value_matrix_global_v.focus();
  25343. return;
  25344. }
  25345. parent_node = jquery__WEBPACK_IMPORTED_MODULE_0___default()(parent_node);
  25346. opened_name_value_matrix_global_v = true;
  25347. parent_node.find('.span_value_variable').text('');
  25348. var input_field;
  25349. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  25350. input_field = jquery__WEBPACK_IMPORTED_MODULE_0___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) + "' />");
  25351. input_field.insertBefore(parent_node.find('.span_value_variable'));
  25352. } else {
  25353. input_field = jquery__WEBPACK_IMPORTED_MODULE_0___default()("<input type='text' class='width-dynamic input_name_function' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' value='" + global_var.value[row][index] + "' />");
  25354. input_field.insertBefore(parent_node.find('.span_value_variable'));
  25355. }
  25356. input_field.on('input', function () {
  25357. var inputWidth = input_field.textWidth() + 10;
  25358. opened_input_value_matrix_global_v = input_field;
  25359. input_field.focus();
  25360. var tmpStr = input_field.val();
  25361. input_field.val('');
  25362. input_field.val(tmpStr);
  25363. input_field.css({
  25364. width: inputWidth
  25365. });
  25366. }).trigger('input');
  25367. input_field.focusout(function () {
  25368. /// update array:
  25369. if (input_field.val().trim()) {
  25370. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  25371. global_var.value[row][index] = parseFloat(input_field.val().trim());
  25372. parent_node.find('.span_value_variable').text(global_var.value[row][index].toFixed(1));
  25373. } else {
  25374. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].INTEGER) {
  25375. global_var.value[row][index] = parseInt(input_field.val().trim());
  25376. } else {
  25377. global_var.value[row][index] = input_field.val().trim();
  25378. }
  25379. parent_node.find('.span_value_variable').text(global_var.value[row][index]);
  25380. }
  25381. } else {
  25382. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  25383. parent_node.find('.span_value_variable').text(global_var.value[row][index].toFixed(1));
  25384. } else {
  25385. parent_node.find('.span_value_variable').text(global_var.value[row][index]);
  25386. }
  25387. }
  25388. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].TEXT) {
  25389. global_var.value[row][index] = input_field.val();
  25390. parent_node.find('.span_value_variable').text(global_var.value[row][index]);
  25391. }
  25392. input_field.off();
  25393. input_field.remove(); /// update elements:
  25394. opened_name_value_matrix_global_v = false;
  25395. opened_input_value_matrix_global_v = false;
  25396. });
  25397. input_field.on('keydown', function (e) {
  25398. var code = e.keyCode || e.which;
  25399. if (code == 13) {
  25400. if (input_field.val().trim()) {
  25401. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  25402. global_var.value[row][index] = parseFloat(input_field.val().trim());
  25403. parent_node.find('.span_value_variable').text(global_var.value[row][index].toFixed(1));
  25404. } else {
  25405. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].INTEGER) {
  25406. global_var.value[row][index] = parseInt(input_field.val().trim());
  25407. } else {
  25408. global_var.value[row][index] = input_field.val().trim();
  25409. }
  25410. parent_node.find('.span_value_variable').text(global_var.value[row][index]);
  25411. }
  25412. } else {
  25413. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  25414. parent_node.find('.span_value_variable').text(global_var.value[row][index].toFixed(1));
  25415. } else {
  25416. parent_node.find('.span_value_variable').text(global_var.value[row][index]);
  25417. }
  25418. }
  25419. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].TEXT) {
  25420. global_var.value[row][index] = input_field.val();
  25421. parent_node.find('.span_value_variable').text(global_var.value[row][index]);
  25422. }
  25423. input_field.off();
  25424. input_field.remove(); /// update elements:
  25425. opened_name_value_matrix_global_v = false;
  25426. opened_input_value_matrix_global_v = false;
  25427. }
  25428. if (code == 27) {
  25429. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  25430. parent_node.find('.span_value_variable').text(global_var.value[row][index].toFixed(1));
  25431. } else {
  25432. parent_node.find('.span_value_variable').text(global_var.value[row][index]);
  25433. }
  25434. input_field.off();
  25435. input_field.remove(); /// update elements:
  25436. opened_name_value_matrix_global_v = false;
  25437. opened_input_value_matrix_global_v = false;
  25438. }
  25439. });
  25440. input_field.select();
  25441. }
  25442. var opened_name_value_global_var = false;
  25443. var opened_input_value_global_ar = null;
  25444. function enableGlobalValueUpdate(global_var, parent_node) {
  25445. if (opened_name_value_global_var) {
  25446. opened_input_value_global_ar.focus();
  25447. return;
  25448. }
  25449. parent_node = jquery__WEBPACK_IMPORTED_MODULE_0___default()(parent_node);
  25450. opened_name_value_global_var = true;
  25451. parent_node.find('.span_value_variable').text('');
  25452. var input_field;
  25453. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  25454. input_field = jquery__WEBPACK_IMPORTED_MODULE_0___default()("<input type='text' class='width-dynamic input_name_function' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' value='" + global_var.value.toFixed(1) + "' />");
  25455. input_field.insertBefore(parent_node.find('.span_value_variable'));
  25456. } else {
  25457. input_field = jquery__WEBPACK_IMPORTED_MODULE_0___default()("<input type='text' class='width-dynamic input_name_function' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' value='" + global_var.value + "' />");
  25458. input_field.insertBefore(parent_node.find('.span_value_variable'));
  25459. }
  25460. input_field.on('input', function () {
  25461. var inputWidth = input_field.textWidth() + 10;
  25462. opened_input_value_global_ar = input_field;
  25463. input_field.focus();
  25464. var tmpStr = input_field.val();
  25465. input_field.val('');
  25466. input_field.val(tmpStr);
  25467. input_field.css({
  25468. width: inputWidth
  25469. });
  25470. }).trigger('input');
  25471. input_field.focusout(function () {
  25472. /// update array:
  25473. if (input_field.val().trim()) {
  25474. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  25475. global_var.value = parseFloat(input_field.val().trim());
  25476. parent_node.find('.span_value_variable').text(global_var.value.toFixed(1));
  25477. } else {
  25478. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].INTEGER) {
  25479. global_var.value = parseInt(input_field.val().trim());
  25480. } else {
  25481. global_var.value = input_field.val().trim();
  25482. }
  25483. parent_node.find('.span_value_variable').text(global_var.value);
  25484. }
  25485. } else {
  25486. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  25487. parent_node.find('.span_value_variable').text(global_var.value.toFixed(1));
  25488. } else {
  25489. parent_node.find('.span_value_variable').text(global_var.value);
  25490. }
  25491. }
  25492. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].TEXT) {
  25493. global_var.value = input_field.val();
  25494. parent_node.find('.span_value_variable').text(global_var.value);
  25495. }
  25496. input_field.off();
  25497. input_field.remove(); /// update elements:
  25498. opened_name_value_global_var = false;
  25499. opened_input_value_global_ar = false;
  25500. });
  25501. input_field.on('keydown', function (e) {
  25502. var code = e.keyCode || e.which;
  25503. if (code == 13) {
  25504. if (input_field.val().trim()) {
  25505. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  25506. global_var.value = parseFloat(input_field.val().trim());
  25507. parent_node.find('.span_value_variable').text(global_var.value.toFixed(1));
  25508. } else {
  25509. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].INTEGER) {
  25510. global_var.value = parseInt(input_field.val().trim());
  25511. } else {
  25512. global_var.value = input_field.val().trim();
  25513. }
  25514. parent_node.find('.span_value_variable').text(global_var.value);
  25515. }
  25516. } else {
  25517. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  25518. parent_node.find('.span_value_variable').text(global_var.value.toFixed(1));
  25519. } else {
  25520. parent_node.find('.span_value_variable').text(global_var.value);
  25521. }
  25522. }
  25523. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].TEXT) {
  25524. global_var.value = input_field.val();
  25525. parent_node.find('.span_value_variable').text(global_var.value);
  25526. }
  25527. input_field.off();
  25528. input_field.remove(); /// update elements:
  25529. opened_name_value_global_var = false;
  25530. opened_input_value_global_ar = false;
  25531. }
  25532. if (code == 27) {
  25533. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  25534. parent_node.find('.span_value_variable').text(global_var.value.toFixed(1));
  25535. } else {
  25536. parent_node.find('.span_value_variable').text(global_var.value);
  25537. }
  25538. input_field.off();
  25539. input_field.remove(); /// update elements:
  25540. opened_name_value_global_var = false;
  25541. opened_input_value_global_ar = false;
  25542. }
  25543. });
  25544. input_field.select();
  25545. }
  25546. var opened_name_global = false;
  25547. var opened_input_global = null;
  25548. function enableNameUpdate(global_container) {
  25549. var global_var = global_container.data('associatedOject');
  25550. if (opened_name_global) {
  25551. opened_input_global.focus();
  25552. return;
  25553. }
  25554. opened_name_global = true;
  25555. global_container.find('.span_name_variable').text('');
  25556. var input_name = jquery__WEBPACK_IMPORTED_MODULE_0___default()("<input type='text' class='width-dynamic input_name_function' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' value='" + global_var.name + "' />");
  25557. input_name.insertBefore(global_container.find('.span_name_variable'));
  25558. input_name.on('input', function () {
  25559. var inputWidth = input_name.textWidth() + 10;
  25560. opened_input_global = input_name;
  25561. opened_input_global.focus();
  25562. opened_input_global.css({
  25563. width: inputWidth
  25564. });
  25565. }).trigger('input');
  25566. input_name.focusout(function () {
  25567. /// update array:
  25568. if (input_name.val().trim().length > 0) {
  25569. updateName(global_var, input_name.val().trim(), global_container);
  25570. global_container.find('.span_name_variable').text(global_var.name);
  25571. } else {
  25572. global_container.find('.span_name_variable').text(global_var.name);
  25573. }
  25574. input_name.off();
  25575. input_name.remove(); /// update elements:
  25576. opened_name_global = false;
  25577. opened_input_global = false;
  25578. });
  25579. input_name.on('keydown', function (e) {
  25580. var code = e.keyCode || e.which;
  25581. if (code == 13) {
  25582. if (input_name.val().trim()) {
  25583. updateName(global_var, input_name.val().trim(), global_container);
  25584. global_container.find('.span_name_variable').text(global_var.name);
  25585. } else {
  25586. global_container.find('.span_name_variable').text(global_var.name);
  25587. }
  25588. input_name.off();
  25589. input_name.remove(); /// update elements:
  25590. opened_name_global = false;
  25591. opened_input_global = false;
  25592. }
  25593. if (code == 27) {
  25594. global_container.find('.span_name_variable').text(global_var.name);
  25595. input_name.off();
  25596. input_name.remove(); /// update elements:
  25597. opened_name_global = false;
  25598. opened_input_global = false;
  25599. }
  25600. });
  25601. input_name.select();
  25602. }
  25603. var opened_name_value_vector_global_ = false;
  25604. var opened_input_value_vector_global_ = null;
  25605. function enableGlobalVectorValueUpdate(global_var, index, parent_node) {
  25606. if (opened_name_value_vector_global_) {
  25607. opened_input_value_vector_global_.focus();
  25608. return;
  25609. }
  25610. parent_node = jquery__WEBPACK_IMPORTED_MODULE_0___default()(parent_node);
  25611. opened_name_value_vector_global_ = true;
  25612. parent_node.find('.span_value_variable').text('');
  25613. var input_field;
  25614. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  25615. input_field = jquery__WEBPACK_IMPORTED_MODULE_0___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) + "' />");
  25616. input_field.insertBefore(parent_node.find('.span_value_variable'));
  25617. } else {
  25618. input_field = jquery__WEBPACK_IMPORTED_MODULE_0___default()("<input type='text' class='width-dynamic input_name_function' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' value='" + global_var.value[index] + "' />");
  25619. input_field.insertBefore(parent_node.find('.span_value_variable'));
  25620. }
  25621. input_field.on('input', function () {
  25622. var inputWidth = input_field.textWidth() + 10;
  25623. opened_input_value_vector_global_ = input_field;
  25624. input_field.focus();
  25625. var tmpStr = input_field.val();
  25626. input_field.val('');
  25627. input_field.val(tmpStr);
  25628. input_field.css({
  25629. width: inputWidth
  25630. });
  25631. }).trigger('input');
  25632. input_field.focusout(function () {
  25633. /// update array:
  25634. if (input_field.val().trim()) {
  25635. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  25636. global_var.value[index] = parseFloat(input_field.val().trim());
  25637. parent_node.find('.span_value_variable').text(global_var.value[index].toFixed(1));
  25638. } else {
  25639. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].INTEGER) {
  25640. global_var.value[index] = parseInt(input_field.val().trim());
  25641. } else {
  25642. global_var.value[index] = input_field.val().trim();
  25643. }
  25644. parent_node.find('.span_value_variable').text(global_var.value[index]);
  25645. }
  25646. } else {
  25647. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  25648. parent_node.find('.span_value_variable').text(global_var.value[index].toFixed(1));
  25649. } else {
  25650. parent_node.find('.span_value_variable').text(global_var.value[index]);
  25651. }
  25652. }
  25653. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].TEXT) {
  25654. global_var.value[index] = input_field.val();
  25655. parent_node.find('.span_value_variable').text(global_var.value[index]);
  25656. }
  25657. input_field.off();
  25658. input_field.remove(); /// update elements:
  25659. opened_name_value_vector_global_ = false;
  25660. opened_input_value_vector_global_ = false;
  25661. });
  25662. input_field.on('keydown', function (e) {
  25663. var code = e.keyCode || e.which;
  25664. if (code == 13) {
  25665. if (input_field.val().trim()) {
  25666. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  25667. global_var.value[index] = parseFloat(input_field.val().trim());
  25668. parent_node.find('.span_value_variable').text(global_var.value[index].toFixed(1));
  25669. } else {
  25670. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].INTEGER) {
  25671. global_var.value[index] = parseInt(input_field.val().trim());
  25672. } else {
  25673. global_var.value[index] = input_field.val().trim();
  25674. }
  25675. parent_node.find('.span_value_variable').text(global_var.value[index]);
  25676. }
  25677. } else {
  25678. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  25679. parent_node.find('.span_value_variable').text(global_var.value[index].toFixed(1));
  25680. } else {
  25681. parent_node.find('.span_value_variable').text(global_var.value[index]);
  25682. }
  25683. }
  25684. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].TEXT) {
  25685. global_var.value[index] = input_field.val();
  25686. parent_node.find('.span_value_variable').text(global_var.value[index]);
  25687. }
  25688. input_field.off();
  25689. input_field.remove(); /// update elements:
  25690. opened_name_value_vector_global_ = false;
  25691. opened_input_value_vector_global_ = false;
  25692. }
  25693. if (code == 27) {
  25694. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  25695. parent_node.find('.span_value_variable').text(global_var.value[index].toFixed(1));
  25696. } else {
  25697. parent_node.find('.span_value_variable').text(global_var.value[index]);
  25698. }
  25699. input_field.off();
  25700. input_field.remove(); /// update elements:
  25701. opened_name_value_vector_global_ = false;
  25702. opened_input_value_vector_global_ = false;
  25703. }
  25704. });
  25705. input_field.select();
  25706. }
  25707. jquery__WEBPACK_IMPORTED_MODULE_0___default.a.fn.textWidth = function (text, font) {
  25708. if (!jquery__WEBPACK_IMPORTED_MODULE_0___default.a.fn.textWidth.fakeEl) jquery__WEBPACK_IMPORTED_MODULE_0___default.a.fn.textWidth.fakeEl = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<span>').hide().appendTo(document.body);
  25709. jquery__WEBPACK_IMPORTED_MODULE_0___default.a.fn.textWidth.fakeEl.text(text || this.val() || this.text() || this.attr('placeholder')).css('font', font || this.css('font'));
  25710. return jquery__WEBPACK_IMPORTED_MODULE_0___default.a.fn.textWidth.fakeEl.width();
  25711. };
  25712. /***/ }),
  25713. /***/ "./js/visualUI/ivprog_elements.js":
  25714. /*!****************************************!*\
  25715. !*** ./js/visualUI/ivprog_elements.js ***!
  25716. \****************************************/
  25717. /*! exports provided: COMMAND_TYPES, ARITHMETIC_TYPES, EXPRESSION_ELEMENTS, EXPRESSION_TYPES, ARITHMETIC_COMPARISON, LOGIC_COMPARISON, SYSTEM_FUNCTIONS_CATEGORIES, Variable, Function, SystemFunction, Comment, Break, Reader, Writer, Attribution, ExpressionElement, ConditionalExpression, LogicExpression, ArithmeticExpression, IfTrue, RepeatNTimes, WhileTrue, DoWhileTrue, Switch, Return, SwitchCase, FunctionCall, VariableValueMenu, FunctionCallMenu, Program */
  25718. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  25719. "use strict";
  25720. __webpack_require__.r(__webpack_exports__);
  25721. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "COMMAND_TYPES", function() { return COMMAND_TYPES; });
  25722. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ARITHMETIC_TYPES", function() { return ARITHMETIC_TYPES; });
  25723. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "EXPRESSION_ELEMENTS", function() { return EXPRESSION_ELEMENTS; });
  25724. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "EXPRESSION_TYPES", function() { return EXPRESSION_TYPES; });
  25725. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ARITHMETIC_COMPARISON", function() { return ARITHMETIC_COMPARISON; });
  25726. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "LOGIC_COMPARISON", function() { return LOGIC_COMPARISON; });
  25727. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SYSTEM_FUNCTIONS_CATEGORIES", function() { return SYSTEM_FUNCTIONS_CATEGORIES; });
  25728. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Variable", function() { return Variable; });
  25729. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Function", function() { return Function; });
  25730. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SystemFunction", function() { return SystemFunction; });
  25731. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Comment", function() { return Comment; });
  25732. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Break", function() { return Break; });
  25733. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Reader", function() { return Reader; });
  25734. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Writer", function() { return Writer; });
  25735. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Attribution", function() { return Attribution; });
  25736. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ExpressionElement", function() { return ExpressionElement; });
  25737. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ConditionalExpression", function() { return ConditionalExpression; });
  25738. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "LogicExpression", function() { return LogicExpression; });
  25739. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ArithmeticExpression", function() { return ArithmeticExpression; });
  25740. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "IfTrue", function() { return IfTrue; });
  25741. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "RepeatNTimes", function() { return RepeatNTimes; });
  25742. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "WhileTrue", function() { return WhileTrue; });
  25743. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DoWhileTrue", function() { return DoWhileTrue; });
  25744. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Switch", function() { return Switch; });
  25745. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Return", function() { return Return; });
  25746. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SwitchCase", function() { return SwitchCase; });
  25747. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "FunctionCall", function() { return FunctionCall; });
  25748. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "VariableValueMenu", function() { return VariableValueMenu; });
  25749. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "FunctionCallMenu", function() { return FunctionCallMenu; });
  25750. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Program", function() { return Program; });
  25751. /* harmony import */ var _commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./commands/variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  25752. /* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./types */ "./js/visualUI/types.js");
  25753. /* harmony import */ var melanke_watchjs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! melanke-watchjs */ "./node_modules/melanke-watchjs/src/watch.js");
  25754. /* harmony import */ var melanke_watchjs__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(melanke_watchjs__WEBPACK_IMPORTED_MODULE_2__);
  25755. /* harmony import */ var _algorithm__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./algorithm */ "./js/visualUI/algorithm.js");
  25756. 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); } }
  25757. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  25758. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  25759. var COMMAND_TYPES = Object.freeze({
  25760. function: "function",
  25761. comment: "comment",
  25762. reader: "reader",
  25763. writer: "writer",
  25764. attribution: "attribution",
  25765. iftrue: "iftrue",
  25766. repeatNtimes: "repeatNtimes",
  25767. whiletrue: "whiletrue",
  25768. dowhiletrue: "dowhiletrue",
  25769. switch: "switch",
  25770. switchcase: "switchcase",
  25771. functioncall: "functioncall",
  25772. break: "break",
  25773. return: "return"
  25774. });
  25775. var ARITHMETIC_TYPES = Object.freeze({
  25776. plus: "plus",
  25777. minus: "minus",
  25778. multiplication: "multiplication",
  25779. division: "division",
  25780. module: "module",
  25781. none: "none"
  25782. });
  25783. var EXPRESSION_ELEMENTS = Object.freeze({
  25784. exp_op_exp: "exp_op_exp",
  25785. op_exp: "op_exp",
  25786. par_exp_par: "par_exp_par",
  25787. start_point: "start_point"
  25788. });
  25789. var EXPRESSION_TYPES = Object.freeze({
  25790. exp_conditional: "exp_conditional",
  25791. exp_logic: "exp_logic",
  25792. exp_arithmetic: "exp_arithmetic"
  25793. });
  25794. var ARITHMETIC_COMPARISON = Object.freeze({
  25795. greater_than: "greater_than",
  25796. less_than: "less_than",
  25797. equals_to: "equals_to",
  25798. not_equals_to: "not_equals_to",
  25799. greater_than_or_equals_to: "greater_than_or_equals_to",
  25800. less_than_or_equals_to: "less_than_or_equals_to"
  25801. });
  25802. var LOGIC_COMPARISON = Object.freeze({
  25803. equals_to: "equals_to",
  25804. not_equals_to: "not_equals_to",
  25805. and: "and",
  25806. or: "or"
  25807. });
  25808. var SYSTEM_FUNCTIONS_CATEGORIES = Object.freeze({
  25809. math: "math",
  25810. text: "text_t",
  25811. arrangement: "arrangement",
  25812. conversion: "conversion"
  25813. });
  25814. var Variable = function Variable(type, name, value) {
  25815. var dimensions = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
  25816. var is_constant = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
  25817. var rows = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 0;
  25818. var columns = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : 0;
  25819. _classCallCheck(this, Variable);
  25820. this.type = type;
  25821. this.name = name;
  25822. this.value = value;
  25823. this.dimensions = dimensions;
  25824. this.is_constant = is_constant;
  25825. this.rows = rows;
  25826. this.columns = columns;
  25827. };
  25828. var Function = function Function(name) {
  25829. var return_type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _types__WEBPACK_IMPORTED_MODULE_1__["Types"].VOID;
  25830. var return_dimensions = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
  25831. var parameters_list = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : [];
  25832. var is_main = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
  25833. var is_hidden = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : false;
  25834. var variables_list = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : [];
  25835. var function_comment = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : null;
  25836. var commands = arguments.length > 8 && arguments[8] !== undefined ? arguments[8] : [];
  25837. _classCallCheck(this, Function);
  25838. this.type = COMMAND_TYPES.function;
  25839. this.name = name;
  25840. this.return_type = return_type;
  25841. this.return_dimensions = return_dimensions;
  25842. this.parameters_list = parameters_list;
  25843. this.is_main = is_main;
  25844. this.is_hidden = is_hidden;
  25845. this.variables_list = variables_list;
  25846. this.function_comment = function_comment;
  25847. this.commands = commands;
  25848. };
  25849. var SystemFunction = function SystemFunction(identifier, return_type, return_dimensions, parameters_list) {
  25850. var function_comment = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : null;
  25851. var category = arguments.length > 5 ? arguments[5] : undefined;
  25852. _classCallCheck(this, SystemFunction);
  25853. this.type = COMMAND_TYPES.function;
  25854. this.identifier = identifier;
  25855. this.return_type = return_type;
  25856. this.return_dimensions = return_dimensions;
  25857. this.parameters_list = parameters_list;
  25858. this.function_comment = function_comment;
  25859. this.category = category;
  25860. };
  25861. var Comment = function Comment(comment_text) {
  25862. _classCallCheck(this, Comment);
  25863. this.type = COMMAND_TYPES.comment;
  25864. this.comment_text = comment_text;
  25865. };
  25866. var Break = function Break() {
  25867. _classCallCheck(this, Break);
  25868. this.type = COMMAND_TYPES.break;
  25869. };
  25870. var Reader = function Reader() {
  25871. var variable_value_menu = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : new VariableValueMenu();
  25872. _classCallCheck(this, Reader);
  25873. this.type = COMMAND_TYPES.reader;
  25874. this.variable_value_menu = variable_value_menu;
  25875. };
  25876. var Writer = function Writer(content) {
  25877. _classCallCheck(this, Writer);
  25878. this.type = COMMAND_TYPES.writer;
  25879. this.content = content;
  25880. };
  25881. var Attribution = function Attribution(variable) {
  25882. var expression = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
  25883. _classCallCheck(this, Attribution);
  25884. this.type = COMMAND_TYPES.attribution;
  25885. this.variable = variable;
  25886. this.expression = expression;
  25887. };
  25888. var ExpressionElement = function ExpressionElement(type_exp) {
  25889. var itens = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
  25890. _classCallCheck(this, ExpressionElement);
  25891. this.type_exp = type_exp;
  25892. this.itens = itens;
  25893. };
  25894. var ConditionalExpression = function ConditionalExpression(expression) {
  25895. _classCallCheck(this, ConditionalExpression);
  25896. this.type = EXPRESSION_TYPES.exp_conditional;
  25897. this.expression = expression;
  25898. };
  25899. var LogicExpression = function LogicExpression(has_neg, first_operand, second_operand, operator) {
  25900. _classCallCheck(this, LogicExpression);
  25901. this.type = EXPRESSION_TYPES.exp_logic;
  25902. this.has_neg = has_neg;
  25903. this.first_operand = first_operand;
  25904. this.second_operand = second_operand;
  25905. this.operator = operator;
  25906. };
  25907. var ArithmeticExpression = function ArithmeticExpression(first_operand, second_operand, operator) {
  25908. _classCallCheck(this, ArithmeticExpression);
  25909. this.type = EXPRESSION_TYPES.exp_arithmetic;
  25910. this.first_operand = first_operand;
  25911. this.second_operand = second_operand;
  25912. this.operator = operator;
  25913. };
  25914. var IfTrue = function IfTrue(expression, commands_block, commands_else) {
  25915. _classCallCheck(this, IfTrue);
  25916. this.type = COMMAND_TYPES.iftrue;
  25917. this.expression = expression;
  25918. this.commands_block = commands_block;
  25919. this.commands_else = commands_else;
  25920. };
  25921. var RepeatNTimes = function RepeatNTimes(var_attribution, var_incrementation, expression1, expression2, expression3, commands_block) {
  25922. _classCallCheck(this, RepeatNTimes);
  25923. this.type = COMMAND_TYPES.repeatNtimes;
  25924. this.var_attribution = var_attribution;
  25925. this.var_incrementation = var_incrementation;
  25926. this.expression1 = expression1;
  25927. this.expression2 = expression2;
  25928. this.expression3 = expression3;
  25929. this.commands_block = commands_block;
  25930. };
  25931. var WhileTrue = function WhileTrue(expression, commands_block) {
  25932. _classCallCheck(this, WhileTrue);
  25933. this.type = COMMAND_TYPES.whiletrue;
  25934. this.expression = expression;
  25935. this.commands_block = commands_block;
  25936. };
  25937. var DoWhileTrue = function DoWhileTrue(expression, commands_block) {
  25938. _classCallCheck(this, DoWhileTrue);
  25939. this.type = COMMAND_TYPES.dowhiletrue;
  25940. this.expression = expression;
  25941. this.commands_block = commands_block;
  25942. };
  25943. var Switch = function Switch(variable) {
  25944. var cases = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
  25945. _classCallCheck(this, Switch);
  25946. this.type = COMMAND_TYPES.switch;
  25947. this.variable = variable;
  25948. this.cases = cases;
  25949. };
  25950. var Return = function Return(variable_value_menu) {
  25951. _classCallCheck(this, Return);
  25952. this.type = COMMAND_TYPES.return;
  25953. this.variable_value_menu = variable_value_menu;
  25954. };
  25955. var SwitchCase = function SwitchCase(variable_value_menu) {
  25956. var commands_block = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
  25957. _classCallCheck(this, SwitchCase);
  25958. this.type = COMMAND_TYPES.switchcase;
  25959. this.variable_value_menu = variable_value_menu;
  25960. this.commands_block = commands_block;
  25961. };
  25962. var FunctionCall = function FunctionCall(function_called, parameters_list) {
  25963. _classCallCheck(this, FunctionCall);
  25964. this.type = COMMAND_TYPES.functioncall;
  25965. this.function_called = function_called;
  25966. this.parameters_list = parameters_list;
  25967. };
  25968. var VariableValueMenu = function VariableValueMenu() {
  25969. var variable_and_value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 7;
  25970. var content = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
  25971. var row = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
  25972. var column = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
  25973. var include_constant = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : true;
  25974. var dimensions = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 0;
  25975. _classCallCheck(this, VariableValueMenu);
  25976. this.type = "var_value";
  25977. this.variable_and_value = variable_and_value;
  25978. this.content = content;
  25979. this.row = row;
  25980. this.column = column;
  25981. this.include_constant = include_constant;
  25982. this.dimensions = dimensions;
  25983. };
  25984. var FunctionCallMenu = function FunctionCallMenu() {
  25985. var function_called = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
  25986. var parameters_list = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
  25987. _classCallCheck(this, FunctionCallMenu);
  25988. this.type = "function_call";
  25989. this.function_called = function_called;
  25990. this.parameters_list = parameters_list;
  25991. };
  25992. var Program =
  25993. /*#__PURE__*/
  25994. function () {
  25995. function Program() {
  25996. _classCallCheck(this, Program);
  25997. this.functions = [];
  25998. this.globals = [];
  25999. }
  26000. _createClass(Program, [{
  26001. key: "addFunction",
  26002. value: function addFunction(function_to_add) {
  26003. melanke_watchjs__WEBPACK_IMPORTED_MODULE_2___default.a.watch(function_to_add.parameters_list, function () {
  26004. if (window.insertContext) {
  26005. setTimeout(function () {
  26006. _algorithm__WEBPACK_IMPORTED_MODULE_3__["renderAlgorithm"]();
  26007. }, 300);
  26008. window.insertContext = false;
  26009. } else {
  26010. _algorithm__WEBPACK_IMPORTED_MODULE_3__["renderAlgorithm"]();
  26011. }
  26012. }, 1);
  26013. melanke_watchjs__WEBPACK_IMPORTED_MODULE_2___default.a.watch(function_to_add.variables_list, function () {
  26014. if (window.insertContext) {
  26015. setTimeout(function () {
  26016. _algorithm__WEBPACK_IMPORTED_MODULE_3__["renderAlgorithm"]();
  26017. }, 300);
  26018. window.insertContext = false;
  26019. } else {
  26020. _algorithm__WEBPACK_IMPORTED_MODULE_3__["renderAlgorithm"]();
  26021. }
  26022. }, 1);
  26023. this.functions.push(function_to_add);
  26024. }
  26025. }, {
  26026. key: "addVariable",
  26027. value: function addVariable(function_to_receive, variable) {
  26028. if (this.functions[function_to_receive].variable === null) {
  26029. this.functions[function_to_receive].variables_list = [];
  26030. }
  26031. this.functions[function_to_receive].variables_list.push(variable);
  26032. }
  26033. }, {
  26034. key: "addGlobal",
  26035. value: function addGlobal(variable) {
  26036. this.globals.push(variable);
  26037. }
  26038. }]);
  26039. return Program;
  26040. }();
  26041. /***/ }),
  26042. /***/ "./js/visualUI/types.js":
  26043. /*!******************************!*\
  26044. !*** ./js/visualUI/types.js ***!
  26045. \******************************/
  26046. /*! exports provided: Types */
  26047. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  26048. "use strict";
  26049. __webpack_require__.r(__webpack_exports__);
  26050. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Types", function() { return Types; });
  26051. var Types = Object.freeze({
  26052. INTEGER: "integer",
  26053. REAL: "real",
  26054. TEXT: "text",
  26055. BOOLEAN: "boolean",
  26056. VOID: "void"
  26057. });
  26058. /***/ }),
  26059. /***/ "./js/visualUI/utils.js":
  26060. /*!******************************!*\
  26061. !*** ./js/visualUI/utils.js ***!
  26062. \******************************/
  26063. /*! exports provided: renderErrorMessage */
  26064. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  26065. "use strict";
  26066. __webpack_require__.r(__webpack_exports__);
  26067. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "renderErrorMessage", function() { return renderErrorMessage; });
  26068. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  26069. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_0__);
  26070. function renderErrorMessage(dom_obj_target, message_text) {
  26071. dom_obj_target.popup({
  26072. html: '<i class="ui icon inverted exclamation triangle yellow"></i>' + message_text,
  26073. transition: "fade up",
  26074. on: 'click',
  26075. closable: true,
  26076. movePopup: true,
  26077. boundary: window,
  26078. preserve: false,
  26079. target: false,
  26080. className: {
  26081. popup: 'ui popup invalid-identifier'
  26082. },
  26083. onHidden: function onHidden($module) {
  26084. dom_obj_target.popup('destroy');
  26085. }
  26086. }).popup('toggle');
  26087. }
  26088. /***/ }),
  26089. /***/ "./js/visualUI/variables.js":
  26090. /*!**********************************!*\
  26091. !*** ./js/visualUI/variables.js ***!
  26092. \**********************************/
  26093. /*! exports provided: addVariable, renderVariable */
  26094. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  26095. "use strict";
  26096. __webpack_require__.r(__webpack_exports__);
  26097. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "addVariable", function() { return addVariable; });
  26098. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "renderVariable", function() { return renderVariable; });
  26099. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  26100. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_0__);
  26101. /* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./types */ "./js/visualUI/types.js");
  26102. /* harmony import */ var _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  26103. /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  26104. /* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./utils */ "./js/visualUI/utils.js");
  26105. /* harmony import */ var _semantic_semantic_min_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../semantic/semantic.min.js */ "./js/semantic/semantic.min.js");
  26106. /* harmony import */ var _semantic_semantic_min_js__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_semantic_semantic_min_js__WEBPACK_IMPORTED_MODULE_5__);
  26107. window.jQuery = jquery__WEBPACK_IMPORTED_MODULE_0___default.a;
  26108. var counter_new_variables = 0;
  26109. function addVariable(function_obj, function_container) {
  26110. var is_in_click = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  26111. var new_var = new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["Variable"](_types__WEBPACK_IMPORTED_MODULE_1__["Types"].INTEGER, _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('new_variable') + '_' + counter_new_variables, 1);
  26112. if (function_obj.variables_list == null) {
  26113. function_obj.variables_list = [];
  26114. }
  26115. function_obj.variables_list.push(new_var);
  26116. counter_new_variables++;
  26117. var newe = renderVariable(function_container, new_var, function_obj);
  26118. if (is_in_click) {
  26119. newe.css('display', 'none');
  26120. newe.fadeIn();
  26121. }
  26122. }
  26123. function updateName(variable_obj, new_name, variable_obj_dom, function_obj) {
  26124. if (variable_obj.name == new_name) {
  26125. return;
  26126. }
  26127. if (isValidIdentifier(new_name)) {
  26128. if (variableNameAlreadyExists(new_name, function_obj)) {
  26129. _utils__WEBPACK_IMPORTED_MODULE_4__["renderErrorMessage"](variable_obj_dom.find('.editing_name_var'), _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('inform_valid_variable_duplicated'));
  26130. } else {
  26131. variable_obj.name = new_name;
  26132. }
  26133. } else {
  26134. _utils__WEBPACK_IMPORTED_MODULE_4__["renderErrorMessage"](variable_obj_dom.find('.editing_name_var'), _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('inform_valid_name'));
  26135. }
  26136. }
  26137. function variableNameAlreadyExists(name_var, function_obj) {
  26138. if (function_obj.parameters_list) {
  26139. for (var i = 0; i < function_obj.parameters_list.length; i++) {
  26140. if (function_obj.parameters_list[i].name == name_var) {
  26141. return true;
  26142. }
  26143. }
  26144. }
  26145. if (function_obj.variables_list) {
  26146. for (var i = 0; i < function_obj.variables_list.length; i++) {
  26147. if (function_obj.variables_list[i].name == name_var) {
  26148. return true;
  26149. }
  26150. }
  26151. }
  26152. return false;
  26153. }
  26154. function isValidIdentifier(identifier_str) {
  26155. return /^[a-zA-Z_][a-zA-Z0-9_]*$/.test(identifier_str);
  26156. }
  26157. function removeVariable(variable_obj, variable_container) {
  26158. var function_associated = variable_container.data('associatedFunction');
  26159. var index = function_associated.variables_list.indexOf(variable_obj);
  26160. if (index > -1) {
  26161. window.insertContext = true;
  26162. delete function_associated.variables_list[index];
  26163. function_associated.variables_list.splice(index, 1);
  26164. }
  26165. variable_container.children().off();
  26166. variable_container.off();
  26167. variable_container.fadeOut();
  26168. }
  26169. function updateType(variable_obj, new_type) {
  26170. var new_dimensions = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
  26171. variable_obj.type = new_type;
  26172. variable_obj.dimensions = new_dimensions;
  26173. if (new_dimensions > 0) {
  26174. variable_obj.rows = new_dimensions;
  26175. variable_obj.columns = 2;
  26176. }
  26177. updateInitialValues(variable_obj);
  26178. }
  26179. function addHandlers(variable_obj, variable_container, function_obj) {
  26180. // Manage variable name:
  26181. variable_container.find(".enable_edit_name_variable").on('click', function (e) {
  26182. enableNameUpdate(variable_obj, variable_container, function_obj);
  26183. }); // Menu to change type:
  26184. variable_container.find('.ui.dropdown.variable_type').dropdown({
  26185. onChange: function onChange(value, text, $selectedItem) {
  26186. if ($selectedItem.data('dimensions')) {
  26187. updateType(variable_obj, _types__WEBPACK_IMPORTED_MODULE_1__["Types"][$selectedItem.data('type')], $selectedItem.data('dimensions'));
  26188. } else {
  26189. updateType(variable_obj, _types__WEBPACK_IMPORTED_MODULE_1__["Types"][$selectedItem.data('type')]);
  26190. }
  26191. renderValues(variable_obj, variable_container);
  26192. },
  26193. selectOnKeydown: false
  26194. }); // Remove variable:
  26195. variable_container.find(".remove_variable").on('click', function (e) {
  26196. removeVariable(variable_obj, variable_container);
  26197. });
  26198. }
  26199. function renderVariable(function_container, new_var, function_obj) {
  26200. var element = '<div class="ui label variable_container pink"><i class="ui icon ellipsis vertical inverted"></i>';
  26201. element += '<div class="ui dropdown variable_type">';
  26202. if (new_var.dimensions > 0) {
  26203. element += '<div class="text">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('vector') + ':' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI(new_var.type.toLowerCase());
  26204. for (var i = 0; i < new_var.dimensions; i++) {
  26205. element += ' [ ] ';
  26206. }
  26207. element += '</div>';
  26208. } else {
  26209. element += '<div class="text">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI(new_var.type.toLowerCase()) + '</div>';
  26210. }
  26211. element += '<div class="menu">';
  26212. for (var tm in _types__WEBPACK_IMPORTED_MODULE_1__["Types"]) {
  26213. if (tm == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].VOID.toUpperCase()) {
  26214. continue;
  26215. }
  26216. element += '<div class="item ' + (new_var.type == tm.toLowerCase() ? ' selected ' : '') + '" data-type="' + tm + '" >' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI(tm.toLowerCase()) + '</div>';
  26217. }
  26218. for (var tm in _types__WEBPACK_IMPORTED_MODULE_1__["Types"]) {
  26219. if (tm == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].VOID.toUpperCase()) {
  26220. continue;
  26221. }
  26222. element += '<div class="item">' + '<i class="dropdown icon"></i>' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('vector') + ':' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI(tm.toLowerCase()) + '<div class="menu">' + '<div class="item" data-text="' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('vector') + ':' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI(tm.toLowerCase()) + ' [ ] " data-type="' + tm + '" data-dimensions="1">[ ]</div>' + '<div class="item" data-text="' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('vector') + ':' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI(tm.toLowerCase()) + ' [ ] [ ] " data-type="' + tm + '" data-dimensions="2">[ ] [ ] </div>' + '</div>' + '</div>';
  26223. }
  26224. element += '</div></div> ';
  26225. element += '<div class="editing_name_var"><span class="span_name_variable enable_edit_name_variable">' + new_var.name + '</span> </div>';
  26226. element += ' <span class="character_equals"> = </span> <div class="ui div_valor_var">' + new_var.value + '</div>';
  26227. element += ' <i class="yellow inverted icon times remove_variable"></i></div>';
  26228. element = jquery__WEBPACK_IMPORTED_MODULE_0___default()(element);
  26229. element.data('associatedFunction', function_obj);
  26230. function_container.find('.variables_list_div').append(element);
  26231. addHandlers(new_var, element, function_obj);
  26232. renderValues(new_var, element);
  26233. return element;
  26234. }
  26235. function updateColumnsAndRowsText(variable_container, variable_var) {
  26236. var prev = variable_container.find('.text').text().split('[');
  26237. if (prev.length == 2) {
  26238. var ff = prev[0] + '[ ' + variable_var.columns + ' ] ';
  26239. variable_container.find('.text').empty();
  26240. variable_container.find('.text').text(ff);
  26241. }
  26242. if (prev.length == 3) {
  26243. var ff = prev[0] + '[ ' + variable_var.columns + ' ] [ ' + variable_var.rows + ' ] ';
  26244. variable_container.find('.text').empty();
  26245. variable_container.find('.text').text(ff);
  26246. }
  26247. }
  26248. function renderValues(new_var, variable_container) {
  26249. var ret = "";
  26250. var j = 0;
  26251. if (new_var.dimensions == 0) {
  26252. if (new_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  26253. ret += '<div class="created_div_valor_var"><span class="span_value_variable simple_var">' + new_var.value.toFixed(1) + '</span> </div> ';
  26254. } else {
  26255. if (new_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].BOOLEAN) {
  26256. ret += '<div class="created_div_valor_var"><span class="span_value_variable boolean_simple_type">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI(new_var.value) + '</span> </div> ';
  26257. } else {
  26258. ret += '<div class="created_div_valor_var"><span class="span_value_variable simple_var">' + new_var.value + '</span> </div> ';
  26259. }
  26260. }
  26261. } else {
  26262. ret += '<table class="tabela_var">';
  26263. if (new_var.dimensions == 1) {
  26264. ret += '<tr>';
  26265. if (new_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  26266. for (var k = 0; k < new_var.columns; k++) {
  26267. ret += '<td><span class="span_value_variable vector_var" data-index="' + k + '">' + new_var.value[k].toFixed(1) + '</span></td>';
  26268. }
  26269. } else {
  26270. for (var k = 0; k < new_var.columns; k++) {
  26271. if (new_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].BOOLEAN) {
  26272. ret += '<td><span class="span_value_variable boolean_vector_var" data-index="' + k + '">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI(new_var.value[k]) + '</span></td>';
  26273. } else {
  26274. ret += '<td><span class="span_value_variable vector_var" data-index="' + k + '">' + new_var.value[k] + '</span>' + '</td>';
  26275. }
  26276. }
  26277. }
  26278. ret += '</tr>';
  26279. ret += '</table>';
  26280. 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>';
  26281. }
  26282. if (new_var.dimensions == 2) {
  26283. if (new_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  26284. for (var l = 0; l < new_var.rows; l++) {
  26285. ret += '<tr>';
  26286. for (var k = 0; k < new_var.columns; k++) {
  26287. ret += '<td><span class="span_value_variable matrix_var" data-index="' + k + '" data-row="' + l + '">' + new_var.value[l][k].toFixed(1) + '</span>' + '</td>';
  26288. }
  26289. ret += '</tr>';
  26290. }
  26291. } else {
  26292. for (var l = 0; l < new_var.rows; l++) {
  26293. ret += '<tr>';
  26294. for (var k = 0; k < new_var.columns; k++) {
  26295. if (new_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].BOOLEAN) {
  26296. ret += '<td><span class="span_value_variable boolean_matrix_var" data-index="' + k + '" data-row="' + l + '">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI(new_var.value[l][k]) + '</span></td>';
  26297. } else {
  26298. ret += '<td><span class="span_value_variable matrix_var" data-index="' + k + '" data-row="' + l + '">' + new_var.value[l][k] + '</span></td>';
  26299. }
  26300. }
  26301. ret += '</tr>';
  26302. }
  26303. }
  26304. if (new_var.rows == 0) {
  26305. ret += '<tr><td></td></tr>';
  26306. }
  26307. 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>';
  26308. ret += '</table>';
  26309. 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>';
  26310. }
  26311. }
  26312. jquery__WEBPACK_IMPORTED_MODULE_0___default()(variable_container).find(".div_valor_var").html('');
  26313. ret = jquery__WEBPACK_IMPORTED_MODULE_0___default()(ret);
  26314. jquery__WEBPACK_IMPORTED_MODULE_0___default()(ret).find('.span_value_variable').data('associatedOject', new_var);
  26315. jquery__WEBPACK_IMPORTED_MODULE_0___default()(ret).find(".boolean_simple_type").on('click', function (e) {
  26316. alternateBooleanValue(new_var, this.parentNode);
  26317. });
  26318. jquery__WEBPACK_IMPORTED_MODULE_0___default()(ret).find(".simple_var").on('click', function (e) {
  26319. enableValueUpdate(new_var, this.parentNode);
  26320. });
  26321. jquery__WEBPACK_IMPORTED_MODULE_0___default()(ret).find(".boolean_vector_var").on('click', function (e) {
  26322. alternateBooleanVectorValue(new_var, jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).data('index'), this.parentNode);
  26323. });
  26324. jquery__WEBPACK_IMPORTED_MODULE_0___default()(ret).find(".vector_var").on('click', function (e) {
  26325. enableVectorValueUpdate(new_var, jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).data('index'), this.parentNode);
  26326. });
  26327. jquery__WEBPACK_IMPORTED_MODULE_0___default()(ret).find(".remove_global_vector_column").on('click', function (e) {
  26328. removeColumnVector(new_var);
  26329. jquery__WEBPACK_IMPORTED_MODULE_0___default()(variable_container).find(".div_valor_var").html('');
  26330. renderValues(new_var, variable_container);
  26331. });
  26332. jquery__WEBPACK_IMPORTED_MODULE_0___default()(ret).find(".add_global_vector_column").on('click', function (e) {
  26333. addColumnVector(new_var);
  26334. jquery__WEBPACK_IMPORTED_MODULE_0___default()(variable_container).find(".div_valor_var").html('');
  26335. renderValues(new_var, variable_container);
  26336. });
  26337. jquery__WEBPACK_IMPORTED_MODULE_0___default()(ret).find(".remove_global_matrix_column").on('click', function (e) {
  26338. removeColumnMatrix(new_var);
  26339. jquery__WEBPACK_IMPORTED_MODULE_0___default()(variable_container).find(".div_valor_var").html('');
  26340. renderValues(new_var, variable_container);
  26341. });
  26342. jquery__WEBPACK_IMPORTED_MODULE_0___default()(ret).find(".add_global_matrix_column").on('click', function (e) {
  26343. addColumnMatrix(new_var);
  26344. jquery__WEBPACK_IMPORTED_MODULE_0___default()(variable_container).find(".div_valor_var").html('');
  26345. renderValues(new_var, variable_container);
  26346. });
  26347. jquery__WEBPACK_IMPORTED_MODULE_0___default()(ret).find(".remove_global_matrix_line").on('click', function (e) {
  26348. removeLineMatrix(new_var);
  26349. jquery__WEBPACK_IMPORTED_MODULE_0___default()(variable_container).find(".div_valor_var").html('');
  26350. renderValues(new_var, variable_container);
  26351. });
  26352. jquery__WEBPACK_IMPORTED_MODULE_0___default()(ret).find(".add_global_matrix_line").on('click', function (e) {
  26353. addLineMatrix(new_var);
  26354. jquery__WEBPACK_IMPORTED_MODULE_0___default()(variable_container).find(".div_valor_var").html('');
  26355. renderValues(new_var, variable_container);
  26356. });
  26357. jquery__WEBPACK_IMPORTED_MODULE_0___default()(ret).find(".boolean_matrix_var").on('click', function (e) {
  26358. alternateBooleanMatrixValue(new_var, jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).data('row'), jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).data('index'), this.parentNode);
  26359. });
  26360. jquery__WEBPACK_IMPORTED_MODULE_0___default()(ret).find(".matrix_var").on('click', function (e) {
  26361. enableMatrixValueUpdate(new_var, jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).data('row'), jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).data('index'), this.parentNode);
  26362. });
  26363. jquery__WEBPACK_IMPORTED_MODULE_0___default()(variable_container).find(".div_valor_var").append(ret);
  26364. updateColumnsAndRowsText(variable_container, new_var);
  26365. }
  26366. function alternateBooleanMatrixValue(var_obj, row, index, value_container) {
  26367. var_obj.value[row][index] = !var_obj.value[row][index];
  26368. jquery__WEBPACK_IMPORTED_MODULE_0___default()(value_container).find('.span_value_variable').text(_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI(var_obj.value[row][index]));
  26369. }
  26370. function addLineMatrix(var_obj) {
  26371. var_obj.rows++;
  26372. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].INTEGER) {
  26373. var n_l = [];
  26374. for (var i = 0; i < var_obj.columns; i++) {
  26375. n_l.push(1);
  26376. }
  26377. var_obj.value.push(n_l);
  26378. }
  26379. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  26380. var n_l = [];
  26381. for (i = 0; i < var_obj.columns; i++) {
  26382. n_l.push(1.0);
  26383. }
  26384. var_obj.value.push(n_l);
  26385. }
  26386. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].TEXT) {
  26387. var n_l = [];
  26388. for (i = 0; i < var_obj.columns; i++) {
  26389. n_l.push(_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_start'));
  26390. }
  26391. var_obj.value.push(n_l);
  26392. }
  26393. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].BOOLEAN) {
  26394. var n_l = [];
  26395. for (i = 0; i < var_obj.columns; i++) {
  26396. n_l.push(true);
  26397. }
  26398. var_obj.value.push(n_l);
  26399. }
  26400. }
  26401. function removeLineMatrix(var_obj) {
  26402. if (var_obj.rows == 0) {
  26403. return;
  26404. }
  26405. var_obj.rows--;
  26406. var_obj.value.splice(var_obj.value.length - 1, 1);
  26407. }
  26408. function addColumnMatrix(var_obj) {
  26409. var_obj.columns++;
  26410. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].INTEGER) {
  26411. for (var i = 0; i < var_obj.rows; i++) {
  26412. var_obj.value[i].push(1);
  26413. }
  26414. }
  26415. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  26416. for (var i = 0; i < var_obj.rows; i++) {
  26417. var_obj.value[i].push(1.0);
  26418. }
  26419. }
  26420. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].TEXT) {
  26421. for (var i = 0; i < var_obj.rows; i++) {
  26422. var_obj.value[i].push(_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_start'));
  26423. }
  26424. }
  26425. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].BOOLEAN) {
  26426. for (var i = 0; i < var_obj.rows; i++) {
  26427. var_obj.value[i].push(true);
  26428. }
  26429. }
  26430. }
  26431. function removeColumnMatrix(var_obj) {
  26432. if (var_obj.columns == 0) {
  26433. return;
  26434. }
  26435. var_obj.columns--;
  26436. for (var i = 0; i < var_obj.rows; i++) {
  26437. var_obj.value[i].splice(var_obj.value[i].length - 1, 1);
  26438. }
  26439. }
  26440. function addColumnVector(var_obj) {
  26441. var_obj.columns++;
  26442. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].INTEGER) {
  26443. var_obj.value.push(1);
  26444. }
  26445. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  26446. var_obj.value.push(1.0);
  26447. }
  26448. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].TEXT) {
  26449. var_obj.value.push(_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_start'));
  26450. }
  26451. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].BOOLEAN) {
  26452. var_obj.value.push(true);
  26453. }
  26454. }
  26455. function removeColumnVector(var_obj) {
  26456. if (var_obj.columns == 0) {
  26457. return;
  26458. }
  26459. var_obj.columns--;
  26460. var_obj.value.splice(var_obj.value.length - 1, 1);
  26461. }
  26462. function alternateBooleanValue(var_obj, value_container) {
  26463. var_obj.value = !var_obj.value;
  26464. jquery__WEBPACK_IMPORTED_MODULE_0___default()(value_container).find('.span_value_variable').text(_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI(var_obj.value));
  26465. }
  26466. function alternateBooleanVectorValue(var_obj, index, value_container) {
  26467. var_obj.value[index] = !var_obj.value[index];
  26468. jquery__WEBPACK_IMPORTED_MODULE_0___default()(value_container).find('.span_value_variable').text(_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI(var_obj.value[index]));
  26469. }
  26470. function updateInitialValues(variable_obj) {
  26471. if (variable_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].INTEGER) {
  26472. if (variable_obj.dimensions == 0) {
  26473. variable_obj.value = 1;
  26474. }
  26475. if (variable_obj.dimensions == 1) {
  26476. variable_obj.value = [1, 1];
  26477. }
  26478. if (variable_obj.dimensions == 2) {
  26479. variable_obj.value = [[1, 1], [1, 1]];
  26480. }
  26481. }
  26482. if (variable_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  26483. if (variable_obj.dimensions == 0) {
  26484. variable_obj.value = 1.0;
  26485. }
  26486. if (variable_obj.dimensions == 1) {
  26487. variable_obj.value = [1.0, 1.0];
  26488. }
  26489. if (variable_obj.dimensions == 2) {
  26490. variable_obj.value = [[1.0, 1.0], [1.0, 1.0]];
  26491. }
  26492. }
  26493. if (variable_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].TEXT) {
  26494. if (variable_obj.dimensions == 0) {
  26495. variable_obj.value = _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_start');
  26496. }
  26497. if (variable_obj.dimensions == 1) {
  26498. variable_obj.value = [_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_start'), _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_start')];
  26499. }
  26500. if (variable_obj.dimensions == 2) {
  26501. variable_obj.value = [[_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_start'), _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_start')], [_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_start'), _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_start')]];
  26502. }
  26503. }
  26504. if (variable_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].BOOLEAN) {
  26505. if (variable_obj.dimensions == 0) {
  26506. variable_obj.value = true;
  26507. }
  26508. if (variable_obj.dimensions == 1) {
  26509. variable_obj.value = [true, true];
  26510. }
  26511. if (variable_obj.dimensions == 2) {
  26512. variable_obj.value = [[true, true], [true, true]];
  26513. }
  26514. }
  26515. }
  26516. var opened_name_value_vector_global_ = false;
  26517. var opened_input_value_vector_global_ = null;
  26518. function enableVectorValueUpdate(var_obj, index, parent_node) {
  26519. if (opened_name_value_vector_global_) {
  26520. opened_input_value_vector_global_.focus();
  26521. return;
  26522. }
  26523. parent_node = jquery__WEBPACK_IMPORTED_MODULE_0___default()(parent_node);
  26524. opened_name_value_vector_global_ = true;
  26525. parent_node.find('.span_value_variable').text('');
  26526. var input_field;
  26527. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  26528. input_field = jquery__WEBPACK_IMPORTED_MODULE_0___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) + "' />");
  26529. input_field.insertBefore(parent_node.find('.span_value_variable'));
  26530. } else {
  26531. input_field = jquery__WEBPACK_IMPORTED_MODULE_0___default()("<input type='text' class='width-dynamic input_name_function' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' value='" + var_obj.value[index] + "' />");
  26532. input_field.insertBefore(parent_node.find('.span_value_variable'));
  26533. }
  26534. input_field.on('input', function () {
  26535. var inputWidth = input_field.textWidth() + 10;
  26536. opened_input_value_vector_global_ = input_field;
  26537. input_field.focus();
  26538. var tmpStr = input_field.val();
  26539. input_field.val('');
  26540. input_field.val(tmpStr);
  26541. input_field.css({
  26542. width: inputWidth
  26543. });
  26544. }).trigger('input');
  26545. input_field.focusout(function () {
  26546. /// update array:
  26547. if (input_field.val().trim()) {
  26548. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  26549. var_obj.value[index] = parseFloat(input_field.val().trim());
  26550. parent_node.find('.span_value_variable').text(var_obj.value[index].toFixed(1));
  26551. } else {
  26552. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].INTEGER) {
  26553. var_obj.value[index] = parseInt(input_field.val().trim());
  26554. } else {
  26555. var_obj.value[index] = input_field.val().trim();
  26556. }
  26557. parent_node.find('.span_value_variable').text(var_obj.value[index]);
  26558. }
  26559. } else {
  26560. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  26561. parent_node.find('.span_value_variable').text(var_obj.value[index].toFixed(1));
  26562. } else {
  26563. parent_node.find('.span_value_variable').text(var_obj.value[index]);
  26564. }
  26565. }
  26566. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].TEXT) {
  26567. var_obj.value[index] = input_field.val();
  26568. parent_node.find('.span_value_variable').text(var_obj.value[index]);
  26569. }
  26570. input_field.off();
  26571. input_field.remove(); /// update elements:
  26572. opened_name_value_vector_global_ = false;
  26573. opened_input_value_vector_global_ = false;
  26574. });
  26575. input_field.on('keydown', function (e) {
  26576. var code = e.keyCode || e.which;
  26577. if (code == 13) {
  26578. if (input_field.val().trim()) {
  26579. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  26580. var_obj.value[index] = parseFloat(input_field.val().trim());
  26581. parent_node.find('.span_value_variable').text(var_obj.value[index].toFixed(1));
  26582. } else {
  26583. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].INTEGER) {
  26584. var_obj.value[index] = parseInt(input_field.val().trim());
  26585. } else {
  26586. var_obj.value[index] = input_field.val().trim();
  26587. }
  26588. parent_node.find('.span_value_variable').text(var_obj.value[index]);
  26589. }
  26590. } else {
  26591. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  26592. parent_node.find('.span_value_variable').text(var_obj.value[index].toFixed(1));
  26593. } else {
  26594. parent_node.find('.span_value_variable').text(var_obj.value[index]);
  26595. }
  26596. }
  26597. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].TEXT) {
  26598. var_obj.value[index] = input_field.val();
  26599. parent_node.find('.span_value_variable').text(var_obj.value[index]);
  26600. }
  26601. input_field.off();
  26602. input_field.remove(); /// update elements:
  26603. opened_name_value_vector_global_ = false;
  26604. opened_input_value_vector_global_ = false;
  26605. }
  26606. if (code == 27) {
  26607. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  26608. parent_node.find('.span_value_variable').text(var_obj.value[index].toFixed(1));
  26609. } else {
  26610. parent_node.find('.span_value_variable').text(var_obj.value[index]);
  26611. }
  26612. input_field.off();
  26613. input_field.remove(); /// update elements:
  26614. opened_name_value_vector_global_ = false;
  26615. opened_input_value_vector_global_ = false;
  26616. }
  26617. });
  26618. input_field.select();
  26619. }
  26620. var opened_name_value_global_var = false;
  26621. var opened_input_value_global_ar = null;
  26622. function enableValueUpdate(var_obj, parent_node) {
  26623. if (opened_name_value_global_var) {
  26624. opened_input_value_global_ar.focus();
  26625. return;
  26626. }
  26627. parent_node = jquery__WEBPACK_IMPORTED_MODULE_0___default()(parent_node);
  26628. opened_name_value_global_var = true;
  26629. var input_field;
  26630. parent_node.find('.span_value_variable').text('');
  26631. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  26632. input_field = jquery__WEBPACK_IMPORTED_MODULE_0___default()("<input type='text' class='width-dynamic input_name_function' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' value='" + var_obj.value.toFixed(1) + "' />");
  26633. input_field.insertBefore(parent_node.find('.span_value_variable'));
  26634. } else {
  26635. input_field = jquery__WEBPACK_IMPORTED_MODULE_0___default()("<input type='text' class='width-dynamic input_name_function' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' value='" + var_obj.value + "' />");
  26636. input_field.insertBefore(parent_node.find('.span_value_variable'));
  26637. }
  26638. input_field.on('input', function () {
  26639. var inputWidth = input_field.textWidth() + 10;
  26640. opened_input_value_global_ar = input_field;
  26641. input_field.focus();
  26642. var tmpStr = input_field.val();
  26643. input_field.val('');
  26644. input_field.val(tmpStr);
  26645. input_field.css({
  26646. width: inputWidth
  26647. });
  26648. }).trigger('input');
  26649. input_field.focusout(function () {
  26650. /// update array:
  26651. if (input_field.val().trim()) {
  26652. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  26653. var_obj.value = parseFloat(input_field.val().trim());
  26654. parent_node.find('.span_value_variable').text(var_obj.value.toFixed(1));
  26655. } else {
  26656. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].INTEGER) {
  26657. var_obj.value = parseInt(input_field.val().trim());
  26658. } else {
  26659. var_obj.value = input_field.val().trim();
  26660. }
  26661. parent_node.find('.span_value_variable').text(var_obj.value);
  26662. }
  26663. } else {
  26664. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  26665. parent_node.find('.span_value_variable').text(var_obj.value.toFixed(1));
  26666. } else {
  26667. parent_node.find('.span_value_variable').text(var_obj.value);
  26668. }
  26669. }
  26670. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].TEXT) {
  26671. var_obj.value = input_field.val();
  26672. parent_node.find('.span_value_variable').text(var_obj.value);
  26673. }
  26674. input_field.off();
  26675. input_field.remove(); /// update elements:
  26676. opened_name_value_global_var = false;
  26677. opened_input_value_global_ar = false;
  26678. });
  26679. input_field.on('keydown', function (e) {
  26680. var code = e.keyCode || e.which;
  26681. if (code == 13) {
  26682. if (input_field.val().trim()) {
  26683. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  26684. var_obj.value = parseFloat(input_field.val().trim());
  26685. parent_node.find('.span_value_variable').text(var_obj.value.toFixed(1));
  26686. } else {
  26687. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].INTEGER) {
  26688. var_obj.value = parseInt(input_field.val().trim());
  26689. } else {
  26690. var_obj.value = input_field.val().trim();
  26691. }
  26692. parent_node.find('.span_value_variable').text(var_obj.value);
  26693. }
  26694. } else {
  26695. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  26696. parent_node.find('.span_value_variable').text(var_obj.value.toFixed(1));
  26697. } else {
  26698. parent_node.find('.span_value_variable').text(var_obj.value);
  26699. }
  26700. }
  26701. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].TEXT) {
  26702. var_obj.value = input_field.val();
  26703. parent_node.find('.span_value_variable').text(var_obj.value);
  26704. }
  26705. input_field.off();
  26706. input_field.remove(); /// update elements:
  26707. opened_name_value_global_var = false;
  26708. opened_input_value_global_ar = false;
  26709. }
  26710. if (code == 27) {
  26711. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  26712. parent_node.find('.span_value_variable').text(var_obj.value.toFixed(1));
  26713. } else {
  26714. parent_node.find('.span_value_variable').text(var_obj.value);
  26715. }
  26716. input_field.off();
  26717. input_field.remove(); /// update elements:
  26718. opened_name_value_global_var = false;
  26719. opened_input_value_global_ar = false;
  26720. }
  26721. });
  26722. input_field.select();
  26723. }
  26724. var opened_name_global = false;
  26725. var opened_input_global = null;
  26726. function enableNameUpdate(variable_obj, variable_container, function_obj) {
  26727. if (opened_name_global) {
  26728. opened_input_global.focus();
  26729. return;
  26730. }
  26731. opened_name_global = true;
  26732. variable_container.find('.span_name_variable').text('');
  26733. var input_name;
  26734. input_name = jquery__WEBPACK_IMPORTED_MODULE_0___default()("<input type='text' class='width-dynamic input_name_function' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' value='" + variable_obj.name + "' />");
  26735. input_name.insertBefore(variable_container.find('.span_name_variable'));
  26736. input_name.on('input', function () {
  26737. var inputWidth = input_name.textWidth() + 10;
  26738. opened_input_global = input_name;
  26739. input_name.focus();
  26740. var tmpStr = input_name.val();
  26741. input_name.val('');
  26742. input_name.val(tmpStr);
  26743. input_name.css({
  26744. width: inputWidth
  26745. });
  26746. }).trigger('input');
  26747. input_name.focusout(function () {
  26748. /// update array:
  26749. if (input_name.val().trim().length > 0) {
  26750. updateName(variable_obj, input_name.val().trim(), variable_container, function_obj);
  26751. variable_container.find('.span_name_variable').text(variable_obj.name);
  26752. } else {
  26753. variable_container.find('.span_name_variable').text(variable_obj.name);
  26754. }
  26755. input_name.off();
  26756. input_name.remove(); /// update elements:
  26757. opened_name_global = false;
  26758. opened_input_global = false;
  26759. });
  26760. input_name.on('keydown', function (e) {
  26761. var code = e.keyCode || e.which;
  26762. if (code == 13) {
  26763. if (input_name.val().trim().length > 0) {
  26764. updateName(variable_obj, input_name.val().trim(), variable_container, function_obj);
  26765. variable_container.find('.span_name_variable').text(variable_obj.name);
  26766. } else {
  26767. variable_container.find('.span_name_variable').text(variable_obj.name);
  26768. }
  26769. input_name.off();
  26770. input_name.remove(); /// update elements:
  26771. opened_name_global = false;
  26772. opened_input_global = false;
  26773. }
  26774. if (code == 27) {
  26775. variable_container.find('.span_name_variable').text(variable_obj.name);
  26776. input_name.off();
  26777. input_name.remove(); /// update elements:
  26778. opened_name_global = false;
  26779. opened_input_global = false;
  26780. }
  26781. });
  26782. input_name.select();
  26783. }
  26784. var opened_name_value_matrix_global_v = false;
  26785. var opened_input_value_matrix_global_v = null;
  26786. function enableMatrixValueUpdate(var_obj, row, index, parent_node) {
  26787. if (opened_name_value_matrix_global_v) {
  26788. opened_input_value_matrix_global_v.focus();
  26789. return;
  26790. }
  26791. parent_node = jquery__WEBPACK_IMPORTED_MODULE_0___default()(parent_node);
  26792. opened_name_value_matrix_global_v = true;
  26793. parent_node.find('.span_value_variable').text('');
  26794. var input_field;
  26795. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  26796. input_field = jquery__WEBPACK_IMPORTED_MODULE_0___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) + "' />");
  26797. input_field.insertBefore(parent_node.find('.span_value_variable'));
  26798. } else {
  26799. input_field = jquery__WEBPACK_IMPORTED_MODULE_0___default()("<input type='text' class='width-dynamic input_name_function' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' value='" + var_obj.value[row][index] + "' />");
  26800. input_field.insertBefore(parent_node.find('.span_value_variable'));
  26801. }
  26802. input_field.on('input', function () {
  26803. var inputWidth = input_field.textWidth() + 10;
  26804. opened_input_value_matrix_global_v = input_field;
  26805. input_field.focus();
  26806. var tmpStr = input_field.val();
  26807. input_field.val('');
  26808. input_field.val(tmpStr);
  26809. input_field.css({
  26810. width: inputWidth
  26811. });
  26812. }).trigger('input');
  26813. input_field.focusout(function () {
  26814. /// update array:
  26815. if (input_field.val().trim()) {
  26816. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  26817. var_obj.value[row][index] = parseFloat(input_field.val().trim());
  26818. parent_node.find('.span_value_variable').text(var_obj.value[row][index].toFixed(1));
  26819. } else {
  26820. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].INTEGER) {
  26821. var_obj.value[row][index] = parseInt(input_field.val().trim());
  26822. } else {
  26823. var_obj.value[row][index] = input_field.val().trim();
  26824. }
  26825. parent_node.find('.span_value_variable').text(var_obj.value[row][index]);
  26826. }
  26827. } else {
  26828. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  26829. parent_node.find('.span_value_variable').text(var_obj.value[row][index].toFixed(1));
  26830. } else {
  26831. parent_node.find('.span_value_variable').text(var_obj.value[row][index]);
  26832. }
  26833. }
  26834. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].TEXT) {
  26835. var_obj.value[row][index] = input_field.val();
  26836. parent_node.find('.span_value_variable').text(var_obj.value[row][index]);
  26837. }
  26838. input_field.off();
  26839. input_field.remove(); /// update elements:
  26840. opened_name_value_matrix_global_v = false;
  26841. opened_input_value_matrix_global_v = false;
  26842. });
  26843. input_field.on('keydown', function (e) {
  26844. var code = e.keyCode || e.which;
  26845. if (code == 13) {
  26846. if (input_field.val().trim()) {
  26847. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  26848. var_obj.value[row][index] = parseFloat(input_field.val().trim());
  26849. parent_node.find('.span_value_variable').text(var_obj.value[row][index].toFixed(1));
  26850. } else {
  26851. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].INTEGER) {
  26852. var_obj.value[row][index] = parseInt(input_field.val().trim());
  26853. } else {
  26854. var_obj.value[row][index] = input_field.val().trim();
  26855. }
  26856. parent_node.find('.span_value_variable').text(var_obj.value[row][index]);
  26857. }
  26858. } else {
  26859. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  26860. parent_node.find('.span_value_variable').text(var_obj.value[row][index].toFixed(1));
  26861. } else {
  26862. parent_node.find('.span_value_variable').text(var_obj.value[row][index]);
  26863. }
  26864. }
  26865. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].TEXT) {
  26866. var_obj.value[row][index] = input_field.val();
  26867. parent_node.find('.span_value_variable').text(var_obj.value[row][index]);
  26868. }
  26869. input_field.off();
  26870. input_field.remove(); /// update elements:
  26871. opened_name_value_matrix_global_v = false;
  26872. opened_input_value_matrix_global_v = false;
  26873. }
  26874. if (code == 27) {
  26875. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  26876. parent_node.find('.span_value_variable').text(var_obj.value[row][index].toFixed(1));
  26877. } else {
  26878. parent_node.find('.span_value_variable').text(var_obj.value[row][index]);
  26879. }
  26880. input_field.off();
  26881. input_field.remove(); /// update elements:
  26882. opened_name_value_matrix_global_v = false;
  26883. opened_input_value_matrix_global_v = false;
  26884. }
  26885. });
  26886. input_field.select();
  26887. }
  26888. /***/ }),
  26889. /***/ "./node_modules/antlr4/BufferedTokenStream.js":
  26890. /*!****************************************************!*\
  26891. !*** ./node_modules/antlr4/BufferedTokenStream.js ***!
  26892. \****************************************************/
  26893. /*! no static exports found */
  26894. /***/ (function(module, exports, __webpack_require__) {
  26895. //
  26896. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  26897. * Use of this file is governed by the BSD 3-clause license that
  26898. * can be found in the LICENSE.txt file in the project root.
  26899. */
  26900. // This implementation of {@link TokenStream} loads tokens from a
  26901. // {@link TokenSource} on-demand, and places the tokens in a buffer to provide
  26902. // access to any previous token by index.
  26903. //
  26904. // <p>
  26905. // This token stream ignores the value of {@link Token//getChannel}. If your
  26906. // parser requires the token stream filter tokens to only those on a particular
  26907. // channel, such as {@link Token//DEFAULT_CHANNEL} or
  26908. // {@link Token//HIDDEN_CHANNEL}, use a filtering token stream such a
  26909. // {@link CommonTokenStream}.</p>
  26910. var Token = __webpack_require__(/*! ./Token */ "./node_modules/antlr4/Token.js").Token;
  26911. var Lexer = __webpack_require__(/*! ./Lexer */ "./node_modules/antlr4/Lexer.js").Lexer;
  26912. var Interval = __webpack_require__(/*! ./IntervalSet */ "./node_modules/antlr4/IntervalSet.js").Interval;
  26913. // this is just to keep meaningful parameter types to Parser
  26914. function TokenStream() {
  26915. return this;
  26916. }
  26917. function BufferedTokenStream(tokenSource) {
  26918. TokenStream.call(this);
  26919. // The {@link TokenSource} from which tokens for this stream are fetched.
  26920. this.tokenSource = tokenSource;
  26921. // A collection of all tokens fetched from the token source. The list is
  26922. // considered a complete view of the input once {@link //fetchedEOF} is set
  26923. // to {@code true}.
  26924. this.tokens = [];
  26925. // The index into {@link //tokens} of the current token (next token to
  26926. // {@link //consume}). {@link //tokens}{@code [}{@link //p}{@code ]} should
  26927. // be
  26928. // {@link //LT LT(1)}.
  26929. //
  26930. // <p>This field is set to -1 when the stream is first constructed or when
  26931. // {@link //setTokenSource} is called, indicating that the first token has
  26932. // not yet been fetched from the token source. For additional information,
  26933. // see the documentation of {@link IntStream} for a description of
  26934. // Initializing Methods.</p>
  26935. this.index = -1;
  26936. // Indicates whether the {@link Token//EOF} token has been fetched from
  26937. // {@link //tokenSource} and added to {@link //tokens}. This field improves
  26938. // performance for the following cases:
  26939. //
  26940. // <ul>
  26941. // <li>{@link //consume}: The lookahead check in {@link //consume} to
  26942. // prevent
  26943. // consuming the EOF symbol is optimized by checking the values of
  26944. // {@link //fetchedEOF} and {@link //p} instead of calling {@link
  26945. // //LA}.</li>
  26946. // <li>{@link //fetch}: The check to prevent adding multiple EOF symbols
  26947. // into
  26948. // {@link //tokens} is trivial with this field.</li>
  26949. // <ul>
  26950. this.fetchedEOF = false;
  26951. return this;
  26952. }
  26953. BufferedTokenStream.prototype = Object.create(TokenStream.prototype);
  26954. BufferedTokenStream.prototype.constructor = BufferedTokenStream;
  26955. BufferedTokenStream.prototype.mark = function() {
  26956. return 0;
  26957. };
  26958. BufferedTokenStream.prototype.release = function(marker) {
  26959. // no resources to release
  26960. };
  26961. BufferedTokenStream.prototype.reset = function() {
  26962. this.seek(0);
  26963. };
  26964. BufferedTokenStream.prototype.seek = function(index) {
  26965. this.lazyInit();
  26966. this.index = this.adjustSeekIndex(index);
  26967. };
  26968. BufferedTokenStream.prototype.get = function(index) {
  26969. this.lazyInit();
  26970. return this.tokens[index];
  26971. };
  26972. BufferedTokenStream.prototype.consume = function() {
  26973. var skipEofCheck = false;
  26974. if (this.index >= 0) {
  26975. if (this.fetchedEOF) {
  26976. // the last token in tokens is EOF. skip check if p indexes any
  26977. // fetched token except the last.
  26978. skipEofCheck = this.index < this.tokens.length - 1;
  26979. } else {
  26980. // no EOF token in tokens. skip check if p indexes a fetched token.
  26981. skipEofCheck = this.index < this.tokens.length;
  26982. }
  26983. } else {
  26984. // not yet initialized
  26985. skipEofCheck = false;
  26986. }
  26987. if (!skipEofCheck && this.LA(1) === Token.EOF) {
  26988. throw "cannot consume EOF";
  26989. }
  26990. if (this.sync(this.index + 1)) {
  26991. this.index = this.adjustSeekIndex(this.index + 1);
  26992. }
  26993. };
  26994. // Make sure index {@code i} in tokens has a token.
  26995. //
  26996. // @return {@code true} if a token is located at index {@code i}, otherwise
  26997. // {@code false}.
  26998. // @see //get(int i)
  26999. // /
  27000. BufferedTokenStream.prototype.sync = function(i) {
  27001. var n = i - this.tokens.length + 1; // how many more elements we need?
  27002. if (n > 0) {
  27003. var fetched = this.fetch(n);
  27004. return fetched >= n;
  27005. }
  27006. return true;
  27007. };
  27008. // Add {@code n} elements to buffer.
  27009. //
  27010. // @return The actual number of elements added to the buffer.
  27011. // /
  27012. BufferedTokenStream.prototype.fetch = function(n) {
  27013. if (this.fetchedEOF) {
  27014. return 0;
  27015. }
  27016. for (var i = 0; i < n; i++) {
  27017. var t = this.tokenSource.nextToken();
  27018. t.tokenIndex = this.tokens.length;
  27019. this.tokens.push(t);
  27020. if (t.type === Token.EOF) {
  27021. this.fetchedEOF = true;
  27022. return i + 1;
  27023. }
  27024. }
  27025. return n;
  27026. };
  27027. // Get all tokens from start..stop inclusively///
  27028. BufferedTokenStream.prototype.getTokens = function(start, stop, types) {
  27029. if (types === undefined) {
  27030. types = null;
  27031. }
  27032. if (start < 0 || stop < 0) {
  27033. return null;
  27034. }
  27035. this.lazyInit();
  27036. var subset = [];
  27037. if (stop >= this.tokens.length) {
  27038. stop = this.tokens.length - 1;
  27039. }
  27040. for (var i = start; i < stop; i++) {
  27041. var t = this.tokens[i];
  27042. if (t.type === Token.EOF) {
  27043. break;
  27044. }
  27045. if (types === null || types.contains(t.type)) {
  27046. subset.push(t);
  27047. }
  27048. }
  27049. return subset;
  27050. };
  27051. BufferedTokenStream.prototype.LA = function(i) {
  27052. return this.LT(i).type;
  27053. };
  27054. BufferedTokenStream.prototype.LB = function(k) {
  27055. if (this.index - k < 0) {
  27056. return null;
  27057. }
  27058. return this.tokens[this.index - k];
  27059. };
  27060. BufferedTokenStream.prototype.LT = function(k) {
  27061. this.lazyInit();
  27062. if (k === 0) {
  27063. return null;
  27064. }
  27065. if (k < 0) {
  27066. return this.LB(-k);
  27067. }
  27068. var i = this.index + k - 1;
  27069. this.sync(i);
  27070. if (i >= this.tokens.length) { // return EOF token
  27071. // EOF must be last token
  27072. return this.tokens[this.tokens.length - 1];
  27073. }
  27074. return this.tokens[i];
  27075. };
  27076. // Allowed derived classes to modify the behavior of operations which change
  27077. // the current stream position by adjusting the target token index of a seek
  27078. // operation. The default implementation simply returns {@code i}. If an
  27079. // exception is thrown in this method, the current stream index should not be
  27080. // changed.
  27081. //
  27082. // <p>For example, {@link CommonTokenStream} overrides this method to ensure
  27083. // that
  27084. // the seek target is always an on-channel token.</p>
  27085. //
  27086. // @param i The target token index.
  27087. // @return The adjusted target token index.
  27088. BufferedTokenStream.prototype.adjustSeekIndex = function(i) {
  27089. return i;
  27090. };
  27091. BufferedTokenStream.prototype.lazyInit = function() {
  27092. if (this.index === -1) {
  27093. this.setup();
  27094. }
  27095. };
  27096. BufferedTokenStream.prototype.setup = function() {
  27097. this.sync(0);
  27098. this.index = this.adjustSeekIndex(0);
  27099. };
  27100. // Reset this token stream by setting its token source.///
  27101. BufferedTokenStream.prototype.setTokenSource = function(tokenSource) {
  27102. this.tokenSource = tokenSource;
  27103. this.tokens = [];
  27104. this.index = -1;
  27105. this.fetchedEOF = false;
  27106. };
  27107. // Given a starting index, return the index of the next token on channel.
  27108. // Return i if tokens[i] is on channel. Return -1 if there are no tokens
  27109. // on channel between i and EOF.
  27110. // /
  27111. BufferedTokenStream.prototype.nextTokenOnChannel = function(i, channel) {
  27112. this.sync(i);
  27113. if (i >= this.tokens.length) {
  27114. return -1;
  27115. }
  27116. var token = this.tokens[i];
  27117. while (token.channel !== this.channel) {
  27118. if (token.type === Token.EOF) {
  27119. return -1;
  27120. }
  27121. i += 1;
  27122. this.sync(i);
  27123. token = this.tokens[i];
  27124. }
  27125. return i;
  27126. };
  27127. // Given a starting index, return the index of the previous token on channel.
  27128. // Return i if tokens[i] is on channel. Return -1 if there are no tokens
  27129. // on channel between i and 0.
  27130. BufferedTokenStream.prototype.previousTokenOnChannel = function(i, channel) {
  27131. while (i >= 0 && this.tokens[i].channel !== channel) {
  27132. i -= 1;
  27133. }
  27134. return i;
  27135. };
  27136. // Collect all tokens on specified channel to the right of
  27137. // the current token up until we see a token on DEFAULT_TOKEN_CHANNEL or
  27138. // EOF. If channel is -1, find any non default channel token.
  27139. BufferedTokenStream.prototype.getHiddenTokensToRight = function(tokenIndex,
  27140. channel) {
  27141. if (channel === undefined) {
  27142. channel = -1;
  27143. }
  27144. this.lazyInit();
  27145. if (tokenIndex < 0 || tokenIndex >= this.tokens.length) {
  27146. throw "" + tokenIndex + " not in 0.." + this.tokens.length - 1;
  27147. }
  27148. var nextOnChannel = this.nextTokenOnChannel(tokenIndex + 1, Lexer.DEFAULT_TOKEN_CHANNEL);
  27149. var from_ = tokenIndex + 1;
  27150. // if none onchannel to right, nextOnChannel=-1 so set to = last token
  27151. var to = nextOnChannel === -1 ? this.tokens.length - 1 : nextOnChannel;
  27152. return this.filterForChannel(from_, to, channel);
  27153. };
  27154. // Collect all tokens on specified channel to the left of
  27155. // the current token up until we see a token on DEFAULT_TOKEN_CHANNEL.
  27156. // If channel is -1, find any non default channel token.
  27157. BufferedTokenStream.prototype.getHiddenTokensToLeft = function(tokenIndex,
  27158. channel) {
  27159. if (channel === undefined) {
  27160. channel = -1;
  27161. }
  27162. this.lazyInit();
  27163. if (tokenIndex < 0 || tokenIndex >= this.tokens.length) {
  27164. throw "" + tokenIndex + " not in 0.." + this.tokens.length - 1;
  27165. }
  27166. var prevOnChannel = this.previousTokenOnChannel(tokenIndex - 1, Lexer.DEFAULT_TOKEN_CHANNEL);
  27167. if (prevOnChannel === tokenIndex - 1) {
  27168. return null;
  27169. }
  27170. // if none on channel to left, prevOnChannel=-1 then from=0
  27171. var from_ = prevOnChannel + 1;
  27172. var to = tokenIndex - 1;
  27173. return this.filterForChannel(from_, to, channel);
  27174. };
  27175. BufferedTokenStream.prototype.filterForChannel = function(left, right, channel) {
  27176. var hidden = [];
  27177. for (var i = left; i < right + 1; i++) {
  27178. var t = this.tokens[i];
  27179. if (channel === -1) {
  27180. if (t.channel !== Lexer.DEFAULT_TOKEN_CHANNEL) {
  27181. hidden.push(t);
  27182. }
  27183. } else if (t.channel === channel) {
  27184. hidden.push(t);
  27185. }
  27186. }
  27187. if (hidden.length === 0) {
  27188. return null;
  27189. }
  27190. return hidden;
  27191. };
  27192. BufferedTokenStream.prototype.getSourceName = function() {
  27193. return this.tokenSource.getSourceName();
  27194. };
  27195. // Get the text of all tokens in this buffer.///
  27196. BufferedTokenStream.prototype.getText = function(interval) {
  27197. this.lazyInit();
  27198. this.fill();
  27199. if (interval === undefined || interval === null) {
  27200. interval = new Interval(0, this.tokens.length - 1);
  27201. }
  27202. var start = interval.start;
  27203. if (start instanceof Token) {
  27204. start = start.tokenIndex;
  27205. }
  27206. var stop = interval.stop;
  27207. if (stop instanceof Token) {
  27208. stop = stop.tokenIndex;
  27209. }
  27210. if (start === null || stop === null || start < 0 || stop < 0) {
  27211. return "";
  27212. }
  27213. if (stop >= this.tokens.length) {
  27214. stop = this.tokens.length - 1;
  27215. }
  27216. var s = "";
  27217. for (var i = start; i < stop + 1; i++) {
  27218. var t = this.tokens[i];
  27219. if (t.type === Token.EOF) {
  27220. break;
  27221. }
  27222. s = s + t.text;
  27223. }
  27224. return s;
  27225. };
  27226. // Get all tokens from lexer until EOF///
  27227. BufferedTokenStream.prototype.fill = function() {
  27228. this.lazyInit();
  27229. while (this.fetch(1000) === 1000) {
  27230. continue;
  27231. }
  27232. };
  27233. exports.BufferedTokenStream = BufferedTokenStream;
  27234. /***/ }),
  27235. /***/ "./node_modules/antlr4/CharStreams.js":
  27236. /*!********************************************!*\
  27237. !*** ./node_modules/antlr4/CharStreams.js ***!
  27238. \********************************************/
  27239. /*! no static exports found */
  27240. /***/ (function(module, exports, __webpack_require__) {
  27241. //
  27242. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  27243. * Use of this file is governed by the BSD 3-clause license that
  27244. * can be found in the LICENSE.txt file in the project root.
  27245. */
  27246. //
  27247. var InputStream = __webpack_require__(/*! ./InputStream */ "./node_modules/antlr4/InputStream.js").InputStream;
  27248. var isNodeJs = typeof window === 'undefined' && typeof importScripts === 'undefined';
  27249. var fs = isNodeJs ? __webpack_require__(/*! fs */ "./node_modules/node-libs-browser/mock/empty.js") : null;
  27250. // Utility functions to create InputStreams from various sources.
  27251. //
  27252. // All returned InputStreams support the full range of Unicode
  27253. // up to U+10FFFF (the default behavior of InputStream only supports
  27254. // code points up to U+FFFF).
  27255. var CharStreams = {
  27256. // Creates an InputStream from a string.
  27257. fromString: function(str) {
  27258. return new InputStream(str, true);
  27259. },
  27260. // Asynchronously creates an InputStream from a blob given the
  27261. // encoding of the bytes in that blob (defaults to 'utf8' if
  27262. // encoding is null).
  27263. //
  27264. // Invokes onLoad(result) on success, onError(error) on
  27265. // failure.
  27266. fromBlob: function(blob, encoding, onLoad, onError) {
  27267. var reader = FileReader();
  27268. reader.onload = function(e) {
  27269. var is = new InputStream(e.target.result, true);
  27270. onLoad(is);
  27271. };
  27272. reader.onerror = onError;
  27273. reader.readAsText(blob, encoding);
  27274. },
  27275. // Creates an InputStream from a Buffer given the
  27276. // encoding of the bytes in that buffer (defaults to 'utf8' if
  27277. // encoding is null).
  27278. fromBuffer: function(buffer, encoding) {
  27279. return new InputStream(buffer.toString(encoding), true);
  27280. },
  27281. // Asynchronously creates an InputStream from a file on disk given
  27282. // the encoding of the bytes in that file (defaults to 'utf8' if
  27283. // encoding is null).
  27284. //
  27285. // Invokes callback(error, result) on completion.
  27286. fromPath: function(path, encoding, callback) {
  27287. fs.readFile(path, encoding, function(err, data) {
  27288. var is = null;
  27289. if (data !== null) {
  27290. is = new InputStream(data, true);
  27291. }
  27292. callback(err, is);
  27293. });
  27294. },
  27295. // Synchronously creates an InputStream given a path to a file
  27296. // on disk and the encoding of the bytes in that file (defaults to
  27297. // 'utf8' if encoding is null).
  27298. fromPathSync: function(path, encoding) {
  27299. var data = fs.readFileSync(path, encoding);
  27300. return new InputStream(data, true);
  27301. }
  27302. };
  27303. exports.CharStreams = CharStreams;
  27304. /***/ }),
  27305. /***/ "./node_modules/antlr4/CommonTokenFactory.js":
  27306. /*!***************************************************!*\
  27307. !*** ./node_modules/antlr4/CommonTokenFactory.js ***!
  27308. \***************************************************/
  27309. /*! no static exports found */
  27310. /***/ (function(module, exports, __webpack_require__) {
  27311. //
  27312. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  27313. * Use of this file is governed by the BSD 3-clause license that
  27314. * can be found in the LICENSE.txt file in the project root.
  27315. */
  27316. //
  27317. //
  27318. // This default implementation of {@link TokenFactory} creates
  27319. // {@link CommonToken} objects.
  27320. //
  27321. var CommonToken = __webpack_require__(/*! ./Token */ "./node_modules/antlr4/Token.js").CommonToken;
  27322. function TokenFactory() {
  27323. return this;
  27324. }
  27325. function CommonTokenFactory(copyText) {
  27326. TokenFactory.call(this);
  27327. // Indicates whether {@link CommonToken//setText} should be called after
  27328. // constructing tokens to explicitly set the text. This is useful for cases
  27329. // where the input stream might not be able to provide arbitrary substrings
  27330. // of text from the input after the lexer creates a token (e.g. the
  27331. // implementation of {@link CharStream//getText} in
  27332. // {@link UnbufferedCharStream} throws an
  27333. // {@link UnsupportedOperationException}). Explicitly setting the token text
  27334. // allows {@link Token//getText} to be called at any time regardless of the
  27335. // input stream implementation.
  27336. //
  27337. // <p>
  27338. // The default value is {@code false} to avoid the performance and memory
  27339. // overhead of copying text for every token unless explicitly requested.</p>
  27340. //
  27341. this.copyText = copyText===undefined ? false : copyText;
  27342. return this;
  27343. }
  27344. CommonTokenFactory.prototype = Object.create(TokenFactory.prototype);
  27345. CommonTokenFactory.prototype.constructor = CommonTokenFactory;
  27346. //
  27347. // The default {@link CommonTokenFactory} instance.
  27348. //
  27349. // <p>
  27350. // This token factory does not explicitly copy token text when constructing
  27351. // tokens.</p>
  27352. //
  27353. CommonTokenFactory.DEFAULT = new CommonTokenFactory();
  27354. CommonTokenFactory.prototype.create = function(source, type, text, channel, start, stop, line, column) {
  27355. var t = new CommonToken(source, type, channel, start, stop);
  27356. t.line = line;
  27357. t.column = column;
  27358. if (text !==null) {
  27359. t.text = text;
  27360. } else if (this.copyText && source[1] !==null) {
  27361. t.text = source[1].getText(start,stop);
  27362. }
  27363. return t;
  27364. };
  27365. CommonTokenFactory.prototype.createThin = function(type, text) {
  27366. var t = new CommonToken(null, type);
  27367. t.text = text;
  27368. return t;
  27369. };
  27370. exports.CommonTokenFactory = CommonTokenFactory;
  27371. /***/ }),
  27372. /***/ "./node_modules/antlr4/CommonTokenStream.js":
  27373. /*!**************************************************!*\
  27374. !*** ./node_modules/antlr4/CommonTokenStream.js ***!
  27375. \**************************************************/
  27376. /*! no static exports found */
  27377. /***/ (function(module, exports, __webpack_require__) {
  27378. //
  27379. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  27380. * Use of this file is governed by the BSD 3-clause license that
  27381. * can be found in the LICENSE.txt file in the project root.
  27382. */
  27383. ///
  27384. //
  27385. // This class extends {@link BufferedTokenStream} with functionality to filter
  27386. // token streams to tokens on a particular channel (tokens where
  27387. // {@link Token//getChannel} returns a particular value).
  27388. //
  27389. // <p>
  27390. // This token stream provides access to all tokens by index or when calling
  27391. // methods like {@link //getText}. The channel filtering is only used for code
  27392. // accessing tokens via the lookahead methods {@link //LA}, {@link //LT}, and
  27393. // {@link //LB}.</p>
  27394. //
  27395. // <p>
  27396. // By default, tokens are placed on the default channel
  27397. // ({@link Token//DEFAULT_CHANNEL}), but may be reassigned by using the
  27398. // {@code ->channel(HIDDEN)} lexer command, or by using an embedded action to
  27399. // call {@link Lexer//setChannel}.
  27400. // </p>
  27401. //
  27402. // <p>
  27403. // Note: lexer rules which use the {@code ->skip} lexer command or call
  27404. // {@link Lexer//skip} do not produce tokens at all, so input text matched by
  27405. // such a rule will not be available as part of the token stream, regardless of
  27406. // channel.</p>
  27407. ///
  27408. var Token = __webpack_require__(/*! ./Token */ "./node_modules/antlr4/Token.js").Token;
  27409. var BufferedTokenStream = __webpack_require__(/*! ./BufferedTokenStream */ "./node_modules/antlr4/BufferedTokenStream.js").BufferedTokenStream;
  27410. function CommonTokenStream(lexer, channel) {
  27411. BufferedTokenStream.call(this, lexer);
  27412. this.channel = channel===undefined ? Token.DEFAULT_CHANNEL : channel;
  27413. return this;
  27414. }
  27415. CommonTokenStream.prototype = Object.create(BufferedTokenStream.prototype);
  27416. CommonTokenStream.prototype.constructor = CommonTokenStream;
  27417. CommonTokenStream.prototype.adjustSeekIndex = function(i) {
  27418. return this.nextTokenOnChannel(i, this.channel);
  27419. };
  27420. CommonTokenStream.prototype.LB = function(k) {
  27421. if (k===0 || this.index-k<0) {
  27422. return null;
  27423. }
  27424. var i = this.index;
  27425. var n = 1;
  27426. // find k good tokens looking backwards
  27427. while (n <= k) {
  27428. // skip off-channel tokens
  27429. i = this.previousTokenOnChannel(i - 1, this.channel);
  27430. n += 1;
  27431. }
  27432. if (i < 0) {
  27433. return null;
  27434. }
  27435. return this.tokens[i];
  27436. };
  27437. CommonTokenStream.prototype.LT = function(k) {
  27438. this.lazyInit();
  27439. if (k === 0) {
  27440. return null;
  27441. }
  27442. if (k < 0) {
  27443. return this.LB(-k);
  27444. }
  27445. var i = this.index;
  27446. var n = 1; // we know tokens[pos] is a good one
  27447. // find k good tokens
  27448. while (n < k) {
  27449. // skip off-channel tokens, but make sure to not look past EOF
  27450. if (this.sync(i + 1)) {
  27451. i = this.nextTokenOnChannel(i + 1, this.channel);
  27452. }
  27453. n += 1;
  27454. }
  27455. return this.tokens[i];
  27456. };
  27457. // Count EOF just once.///
  27458. CommonTokenStream.prototype.getNumberOfOnChannelTokens = function() {
  27459. var n = 0;
  27460. this.fill();
  27461. for (var i =0; i< this.tokens.length;i++) {
  27462. var t = this.tokens[i];
  27463. if( t.channel===this.channel) {
  27464. n += 1;
  27465. }
  27466. if( t.type===Token.EOF) {
  27467. break;
  27468. }
  27469. }
  27470. return n;
  27471. };
  27472. exports.CommonTokenStream = CommonTokenStream;
  27473. /***/ }),
  27474. /***/ "./node_modules/antlr4/FileStream.js":
  27475. /*!*******************************************!*\
  27476. !*** ./node_modules/antlr4/FileStream.js ***!
  27477. \*******************************************/
  27478. /*! no static exports found */
  27479. /***/ (function(module, exports, __webpack_require__) {
  27480. //
  27481. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  27482. * Use of this file is governed by the BSD 3-clause license that
  27483. * can be found in the LICENSE.txt file in the project root.
  27484. */
  27485. //
  27486. //
  27487. // This is an InputStream that is loaded from a file all at once
  27488. // when you construct the object.
  27489. //
  27490. var InputStream = __webpack_require__(/*! ./InputStream */ "./node_modules/antlr4/InputStream.js").InputStream;
  27491. var isNodeJs = typeof window === 'undefined' && typeof importScripts === 'undefined';
  27492. var fs = isNodeJs ? __webpack_require__(/*! fs */ "./node_modules/node-libs-browser/mock/empty.js") : null;
  27493. function FileStream(fileName, decodeToUnicodeCodePoints) {
  27494. var data = fs.readFileSync(fileName, "utf8");
  27495. InputStream.call(this, data, decodeToUnicodeCodePoints);
  27496. this.fileName = fileName;
  27497. return this;
  27498. }
  27499. FileStream.prototype = Object.create(InputStream.prototype);
  27500. FileStream.prototype.constructor = FileStream;
  27501. exports.FileStream = FileStream;
  27502. /***/ }),
  27503. /***/ "./node_modules/antlr4/InputStream.js":
  27504. /*!********************************************!*\
  27505. !*** ./node_modules/antlr4/InputStream.js ***!
  27506. \********************************************/
  27507. /*! no static exports found */
  27508. /***/ (function(module, exports, __webpack_require__) {
  27509. //
  27510. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  27511. * Use of this file is governed by the BSD 3-clause license that
  27512. * can be found in the LICENSE.txt file in the project root.
  27513. */
  27514. //
  27515. var Token = __webpack_require__(/*! ./Token */ "./node_modules/antlr4/Token.js").Token;
  27516. __webpack_require__(/*! ./polyfills/codepointat */ "./node_modules/antlr4/polyfills/codepointat.js");
  27517. __webpack_require__(/*! ./polyfills/fromcodepoint */ "./node_modules/antlr4/polyfills/fromcodepoint.js");
  27518. // Vacuum all input from a string and then treat it like a buffer.
  27519. function _loadString(stream, decodeToUnicodeCodePoints) {
  27520. stream._index = 0;
  27521. stream.data = [];
  27522. if (stream.decodeToUnicodeCodePoints) {
  27523. for (var i = 0; i < stream.strdata.length; ) {
  27524. var codePoint = stream.strdata.codePointAt(i);
  27525. stream.data.push(codePoint);
  27526. i += codePoint <= 0xFFFF ? 1 : 2;
  27527. }
  27528. } else {
  27529. for (var i = 0; i < stream.strdata.length; i++) {
  27530. var codeUnit = stream.strdata.charCodeAt(i);
  27531. stream.data.push(codeUnit);
  27532. }
  27533. }
  27534. stream._size = stream.data.length;
  27535. }
  27536. // If decodeToUnicodeCodePoints is true, the input is treated
  27537. // as a series of Unicode code points.
  27538. //
  27539. // Otherwise, the input is treated as a series of 16-bit UTF-16 code
  27540. // units.
  27541. function InputStream(data, decodeToUnicodeCodePoints) {
  27542. this.name = "<empty>";
  27543. this.strdata = data;
  27544. this.decodeToUnicodeCodePoints = decodeToUnicodeCodePoints || false;
  27545. _loadString(this);
  27546. return this;
  27547. }
  27548. Object.defineProperty(InputStream.prototype, "index", {
  27549. get : function() {
  27550. return this._index;
  27551. }
  27552. });
  27553. Object.defineProperty(InputStream.prototype, "size", {
  27554. get : function() {
  27555. return this._size;
  27556. }
  27557. });
  27558. // Reset the stream so that it's in the same state it was
  27559. // when the object was created *except* the data array is not
  27560. // touched.
  27561. //
  27562. InputStream.prototype.reset = function() {
  27563. this._index = 0;
  27564. };
  27565. InputStream.prototype.consume = function() {
  27566. if (this._index >= this._size) {
  27567. // assert this.LA(1) == Token.EOF
  27568. throw ("cannot consume EOF");
  27569. }
  27570. this._index += 1;
  27571. };
  27572. InputStream.prototype.LA = function(offset) {
  27573. if (offset === 0) {
  27574. return 0; // undefined
  27575. }
  27576. if (offset < 0) {
  27577. offset += 1; // e.g., translate LA(-1) to use offset=0
  27578. }
  27579. var pos = this._index + offset - 1;
  27580. if (pos < 0 || pos >= this._size) { // invalid
  27581. return Token.EOF;
  27582. }
  27583. return this.data[pos];
  27584. };
  27585. InputStream.prototype.LT = function(offset) {
  27586. return this.LA(offset);
  27587. };
  27588. // mark/release do nothing; we have entire buffer
  27589. InputStream.prototype.mark = function() {
  27590. return -1;
  27591. };
  27592. InputStream.prototype.release = function(marker) {
  27593. };
  27594. // consume() ahead until p==_index; can't just set p=_index as we must
  27595. // update line and column. If we seek backwards, just set p
  27596. //
  27597. InputStream.prototype.seek = function(_index) {
  27598. if (_index <= this._index) {
  27599. this._index = _index; // just jump; don't update stream state (line,
  27600. // ...)
  27601. return;
  27602. }
  27603. // seek forward
  27604. this._index = Math.min(_index, this._size);
  27605. };
  27606. InputStream.prototype.getText = function(start, stop) {
  27607. if (stop >= this._size) {
  27608. stop = this._size - 1;
  27609. }
  27610. if (start >= this._size) {
  27611. return "";
  27612. } else {
  27613. if (this.decodeToUnicodeCodePoints) {
  27614. var result = "";
  27615. for (var i = start; i <= stop; i++) {
  27616. result += String.fromCodePoint(this.data[i]);
  27617. }
  27618. return result;
  27619. } else {
  27620. return this.strdata.slice(start, stop + 1);
  27621. }
  27622. }
  27623. };
  27624. InputStream.prototype.toString = function() {
  27625. return this.strdata;
  27626. };
  27627. exports.InputStream = InputStream;
  27628. /***/ }),
  27629. /***/ "./node_modules/antlr4/IntervalSet.js":
  27630. /*!********************************************!*\
  27631. !*** ./node_modules/antlr4/IntervalSet.js ***!
  27632. \********************************************/
  27633. /*! no static exports found */
  27634. /***/ (function(module, exports, __webpack_require__) {
  27635. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  27636. * Use of this file is governed by the BSD 3-clause license that
  27637. * can be found in the LICENSE.txt file in the project root.
  27638. */
  27639. /*jslint smarttabs:true */
  27640. var Token = __webpack_require__(/*! ./Token */ "./node_modules/antlr4/Token.js").Token;
  27641. /* stop is not included! */
  27642. function Interval(start, stop) {
  27643. this.start = start;
  27644. this.stop = stop;
  27645. return this;
  27646. }
  27647. Interval.prototype.contains = function(item) {
  27648. return item >= this.start && item < this.stop;
  27649. };
  27650. Interval.prototype.toString = function() {
  27651. if(this.start===this.stop-1) {
  27652. return this.start.toString();
  27653. } else {
  27654. return this.start.toString() + ".." + (this.stop-1).toString();
  27655. }
  27656. };
  27657. Object.defineProperty(Interval.prototype, "length", {
  27658. get : function() {
  27659. return this.stop - this.start;
  27660. }
  27661. });
  27662. function IntervalSet() {
  27663. this.intervals = null;
  27664. this.readOnly = false;
  27665. }
  27666. IntervalSet.prototype.first = function(v) {
  27667. if (this.intervals === null || this.intervals.length===0) {
  27668. return Token.INVALID_TYPE;
  27669. } else {
  27670. return this.intervals[0].start;
  27671. }
  27672. };
  27673. IntervalSet.prototype.addOne = function(v) {
  27674. this.addInterval(new Interval(v, v + 1));
  27675. };
  27676. IntervalSet.prototype.addRange = function(l, h) {
  27677. this.addInterval(new Interval(l, h + 1));
  27678. };
  27679. IntervalSet.prototype.addInterval = function(v) {
  27680. if (this.intervals === null) {
  27681. this.intervals = [];
  27682. this.intervals.push(v);
  27683. } else {
  27684. // find insert pos
  27685. for (var k = 0; k < this.intervals.length; k++) {
  27686. var i = this.intervals[k];
  27687. // distinct range -> insert
  27688. if (v.stop < i.start) {
  27689. this.intervals.splice(k, 0, v);
  27690. return;
  27691. }
  27692. // contiguous range -> adjust
  27693. else if (v.stop === i.start) {
  27694. this.intervals[k].start = v.start;
  27695. return;
  27696. }
  27697. // overlapping range -> adjust and reduce
  27698. else if (v.start <= i.stop) {
  27699. this.intervals[k] = new Interval(Math.min(i.start, v.start), Math.max(i.stop, v.stop));
  27700. this.reduce(k);
  27701. return;
  27702. }
  27703. }
  27704. // greater than any existing
  27705. this.intervals.push(v);
  27706. }
  27707. };
  27708. IntervalSet.prototype.addSet = function(other) {
  27709. if (other.intervals !== null) {
  27710. for (var k = 0; k < other.intervals.length; k++) {
  27711. var i = other.intervals[k];
  27712. this.addInterval(new Interval(i.start, i.stop));
  27713. }
  27714. }
  27715. return this;
  27716. };
  27717. IntervalSet.prototype.reduce = function(k) {
  27718. // only need to reduce if k is not the last
  27719. if (k < this.intervalslength - 1) {
  27720. var l = this.intervals[k];
  27721. var r = this.intervals[k + 1];
  27722. // if r contained in l
  27723. if (l.stop >= r.stop) {
  27724. this.intervals.pop(k + 1);
  27725. this.reduce(k);
  27726. } else if (l.stop >= r.start) {
  27727. this.intervals[k] = new Interval(l.start, r.stop);
  27728. this.intervals.pop(k + 1);
  27729. }
  27730. }
  27731. };
  27732. IntervalSet.prototype.complement = function(start, stop) {
  27733. var result = new IntervalSet();
  27734. result.addInterval(new Interval(start,stop+1));
  27735. for(var i=0; i<this.intervals.length; i++) {
  27736. result.removeRange(this.intervals[i]);
  27737. }
  27738. return result;
  27739. };
  27740. IntervalSet.prototype.contains = function(item) {
  27741. if (this.intervals === null) {
  27742. return false;
  27743. } else {
  27744. for (var k = 0; k < this.intervals.length; k++) {
  27745. if(this.intervals[k].contains(item)) {
  27746. return true;
  27747. }
  27748. }
  27749. return false;
  27750. }
  27751. };
  27752. Object.defineProperty(IntervalSet.prototype, "length", {
  27753. get : function() {
  27754. var len = 0;
  27755. this.intervals.map(function(i) {len += i.length;});
  27756. return len;
  27757. }
  27758. });
  27759. IntervalSet.prototype.removeRange = function(v) {
  27760. if(v.start===v.stop-1) {
  27761. this.removeOne(v.start);
  27762. } else if (this.intervals!==null) {
  27763. var k = 0;
  27764. for(var n=0; n<this.intervals.length; n++) {
  27765. var i = this.intervals[k];
  27766. // intervals are ordered
  27767. if (v.stop<=i.start) {
  27768. return;
  27769. }
  27770. // check for including range, split it
  27771. else if(v.start>i.start && v.stop<i.stop) {
  27772. this.intervals[k] = new Interval(i.start, v.start);
  27773. var x = new Interval(v.stop, i.stop);
  27774. this.intervals.splice(k, 0, x);
  27775. return;
  27776. }
  27777. // check for included range, remove it
  27778. else if(v.start<=i.start && v.stop>=i.stop) {
  27779. this.intervals.splice(k, 1);
  27780. k = k - 1; // need another pass
  27781. }
  27782. // check for lower boundary
  27783. else if(v.start<i.stop) {
  27784. this.intervals[k] = new Interval(i.start, v.start);
  27785. }
  27786. // check for upper boundary
  27787. else if(v.stop<i.stop) {
  27788. this.intervals[k] = new Interval(v.stop, i.stop);
  27789. }
  27790. k += 1;
  27791. }
  27792. }
  27793. };
  27794. IntervalSet.prototype.removeOne = function(v) {
  27795. if (this.intervals !== null) {
  27796. for (var k = 0; k < this.intervals.length; k++) {
  27797. var i = this.intervals[k];
  27798. // intervals is ordered
  27799. if (v < i.start) {
  27800. return;
  27801. }
  27802. // check for single value range
  27803. else if (v === i.start && v === i.stop - 1) {
  27804. this.intervals.splice(k, 1);
  27805. return;
  27806. }
  27807. // check for lower boundary
  27808. else if (v === i.start) {
  27809. this.intervals[k] = new Interval(i.start + 1, i.stop);
  27810. return;
  27811. }
  27812. // check for upper boundary
  27813. else if (v === i.stop - 1) {
  27814. this.intervals[k] = new Interval(i.start, i.stop - 1);
  27815. return;
  27816. }
  27817. // split existing range
  27818. else if (v < i.stop - 1) {
  27819. var x = new Interval(i.start, v);
  27820. i.start = v + 1;
  27821. this.intervals.splice(k, 0, x);
  27822. return;
  27823. }
  27824. }
  27825. }
  27826. };
  27827. IntervalSet.prototype.toString = function(literalNames, symbolicNames, elemsAreChar) {
  27828. literalNames = literalNames || null;
  27829. symbolicNames = symbolicNames || null;
  27830. elemsAreChar = elemsAreChar || false;
  27831. if (this.intervals === null) {
  27832. return "{}";
  27833. } else if(literalNames!==null || symbolicNames!==null) {
  27834. return this.toTokenString(literalNames, symbolicNames);
  27835. } else if(elemsAreChar) {
  27836. return this.toCharString();
  27837. } else {
  27838. return this.toIndexString();
  27839. }
  27840. };
  27841. IntervalSet.prototype.toCharString = function() {
  27842. var names = [];
  27843. for (var i = 0; i < this.intervals.length; i++) {
  27844. var v = this.intervals[i];
  27845. if(v.stop===v.start+1) {
  27846. if ( v.start===Token.EOF ) {
  27847. names.push("<EOF>");
  27848. } else {
  27849. names.push("'" + String.fromCharCode(v.start) + "'");
  27850. }
  27851. } else {
  27852. names.push("'" + String.fromCharCode(v.start) + "'..'" + String.fromCharCode(v.stop-1) + "'");
  27853. }
  27854. }
  27855. if (names.length > 1) {
  27856. return "{" + names.join(", ") + "}";
  27857. } else {
  27858. return names[0];
  27859. }
  27860. };
  27861. IntervalSet.prototype.toIndexString = function() {
  27862. var names = [];
  27863. for (var i = 0; i < this.intervals.length; i++) {
  27864. var v = this.intervals[i];
  27865. if(v.stop===v.start+1) {
  27866. if ( v.start===Token.EOF ) {
  27867. names.push("<EOF>");
  27868. } else {
  27869. names.push(v.start.toString());
  27870. }
  27871. } else {
  27872. names.push(v.start.toString() + ".." + (v.stop-1).toString());
  27873. }
  27874. }
  27875. if (names.length > 1) {
  27876. return "{" + names.join(", ") + "}";
  27877. } else {
  27878. return names[0];
  27879. }
  27880. };
  27881. IntervalSet.prototype.toTokenString = function(literalNames, symbolicNames) {
  27882. var names = [];
  27883. for (var i = 0; i < this.intervals.length; i++) {
  27884. var v = this.intervals[i];
  27885. for (var j = v.start; j < v.stop; j++) {
  27886. names.push(this.elementName(literalNames, symbolicNames, j));
  27887. }
  27888. }
  27889. if (names.length > 1) {
  27890. return "{" + names.join(", ") + "}";
  27891. } else {
  27892. return names[0];
  27893. }
  27894. };
  27895. IntervalSet.prototype.elementName = function(literalNames, symbolicNames, a) {
  27896. if (a === Token.EOF) {
  27897. return "<EOF>";
  27898. } else if (a === Token.EPSILON) {
  27899. return "<EPSILON>";
  27900. } else {
  27901. return literalNames[a] || symbolicNames[a];
  27902. }
  27903. };
  27904. exports.Interval = Interval;
  27905. exports.IntervalSet = IntervalSet;
  27906. /***/ }),
  27907. /***/ "./node_modules/antlr4/LL1Analyzer.js":
  27908. /*!********************************************!*\
  27909. !*** ./node_modules/antlr4/LL1Analyzer.js ***!
  27910. \********************************************/
  27911. /*! no static exports found */
  27912. /***/ (function(module, exports, __webpack_require__) {
  27913. //
  27914. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  27915. * Use of this file is governed by the BSD 3-clause license that
  27916. * can be found in the LICENSE.txt file in the project root.
  27917. */
  27918. ///
  27919. var Set = __webpack_require__(/*! ./Utils */ "./node_modules/antlr4/Utils.js").Set;
  27920. var BitSet = __webpack_require__(/*! ./Utils */ "./node_modules/antlr4/Utils.js").BitSet;
  27921. var Token = __webpack_require__(/*! ./Token */ "./node_modules/antlr4/Token.js").Token;
  27922. var ATNConfig = __webpack_require__(/*! ./atn/ATNConfig */ "./node_modules/antlr4/atn/ATNConfig.js").ATNConfig;
  27923. var Interval = __webpack_require__(/*! ./IntervalSet */ "./node_modules/antlr4/IntervalSet.js").Interval;
  27924. var IntervalSet = __webpack_require__(/*! ./IntervalSet */ "./node_modules/antlr4/IntervalSet.js").IntervalSet;
  27925. var RuleStopState = __webpack_require__(/*! ./atn/ATNState */ "./node_modules/antlr4/atn/ATNState.js").RuleStopState;
  27926. var RuleTransition = __webpack_require__(/*! ./atn/Transition */ "./node_modules/antlr4/atn/Transition.js").RuleTransition;
  27927. var NotSetTransition = __webpack_require__(/*! ./atn/Transition */ "./node_modules/antlr4/atn/Transition.js").NotSetTransition;
  27928. var WildcardTransition = __webpack_require__(/*! ./atn/Transition */ "./node_modules/antlr4/atn/Transition.js").WildcardTransition;
  27929. var AbstractPredicateTransition = __webpack_require__(/*! ./atn/Transition */ "./node_modules/antlr4/atn/Transition.js").AbstractPredicateTransition;
  27930. var pc = __webpack_require__(/*! ./PredictionContext */ "./node_modules/antlr4/PredictionContext.js");
  27931. var predictionContextFromRuleContext = pc.predictionContextFromRuleContext;
  27932. var PredictionContext = pc.PredictionContext;
  27933. var SingletonPredictionContext = pc.SingletonPredictionContext;
  27934. function LL1Analyzer (atn) {
  27935. this.atn = atn;
  27936. }
  27937. //* Special value added to the lookahead sets to indicate that we hit
  27938. // a predicate during analysis if {@code seeThruPreds==false}.
  27939. ///
  27940. LL1Analyzer.HIT_PRED = Token.INVALID_TYPE;
  27941. //*
  27942. // Calculates the SLL(1) expected lookahead set for each outgoing transition
  27943. // of an {@link ATNState}. The returned array has one element for each
  27944. // outgoing transition in {@code s}. If the closure from transition
  27945. // <em>i</em> leads to a semantic predicate before matching a symbol, the
  27946. // element at index <em>i</em> of the result will be {@code null}.
  27947. //
  27948. // @param s the ATN state
  27949. // @return the expected symbols for each outgoing transition of {@code s}.
  27950. ///
  27951. LL1Analyzer.prototype.getDecisionLookahead = function(s) {
  27952. if (s === null) {
  27953. return null;
  27954. }
  27955. var count = s.transitions.length;
  27956. var look = [];
  27957. for(var alt=0; alt< count; alt++) {
  27958. look[alt] = new IntervalSet();
  27959. var lookBusy = new Set();
  27960. var seeThruPreds = false; // fail to get lookahead upon pred
  27961. this._LOOK(s.transition(alt).target, null, PredictionContext.EMPTY,
  27962. look[alt], lookBusy, new BitSet(), seeThruPreds, false);
  27963. // Wipe out lookahead for this alternative if we found nothing
  27964. // or we had a predicate when we !seeThruPreds
  27965. if (look[alt].length===0 || look[alt].contains(LL1Analyzer.HIT_PRED)) {
  27966. look[alt] = null;
  27967. }
  27968. }
  27969. return look;
  27970. };
  27971. //*
  27972. // Compute set of tokens that can follow {@code s} in the ATN in the
  27973. // specified {@code ctx}.
  27974. //
  27975. // <p>If {@code ctx} is {@code null} and the end of the rule containing
  27976. // {@code s} is reached, {@link Token//EPSILON} is added to the result set.
  27977. // If {@code ctx} is not {@code null} and the end of the outermost rule is
  27978. // reached, {@link Token//EOF} is added to the result set.</p>
  27979. //
  27980. // @param s the ATN state
  27981. // @param stopState the ATN state to stop at. This can be a
  27982. // {@link BlockEndState} to detect epsilon paths through a closure.
  27983. // @param ctx the complete parser context, or {@code null} if the context
  27984. // should be ignored
  27985. //
  27986. // @return The set of tokens that can follow {@code s} in the ATN in the
  27987. // specified {@code ctx}.
  27988. ///
  27989. LL1Analyzer.prototype.LOOK = function(s, stopState, ctx) {
  27990. var r = new IntervalSet();
  27991. var seeThruPreds = true; // ignore preds; get all lookahead
  27992. ctx = ctx || null;
  27993. var lookContext = ctx!==null ? predictionContextFromRuleContext(s.atn, ctx) : null;
  27994. this._LOOK(s, stopState, lookContext, r, new Set(), new BitSet(), seeThruPreds, true);
  27995. return r;
  27996. };
  27997. //*
  27998. // Compute set of tokens that can follow {@code s} in the ATN in the
  27999. // specified {@code ctx}.
  28000. //
  28001. // <p>If {@code ctx} is {@code null} and {@code stopState} or the end of the
  28002. // rule containing {@code s} is reached, {@link Token//EPSILON} is added to
  28003. // the result set. If {@code ctx} is not {@code null} and {@code addEOF} is
  28004. // {@code true} and {@code stopState} or the end of the outermost rule is
  28005. // reached, {@link Token//EOF} is added to the result set.</p>
  28006. //
  28007. // @param s the ATN state.
  28008. // @param stopState the ATN state to stop at. This can be a
  28009. // {@link BlockEndState} to detect epsilon paths through a closure.
  28010. // @param ctx The outer context, or {@code null} if the outer context should
  28011. // not be used.
  28012. // @param look The result lookahead set.
  28013. // @param lookBusy A set used for preventing epsilon closures in the ATN
  28014. // from causing a stack overflow. Outside code should pass
  28015. // {@code new Set<ATNConfig>} for this argument.
  28016. // @param calledRuleStack A set used for preventing left recursion in the
  28017. // ATN from causing a stack overflow. Outside code should pass
  28018. // {@code new BitSet()} for this argument.
  28019. // @param seeThruPreds {@code true} to true semantic predicates as
  28020. // implicitly {@code true} and "see through them", otherwise {@code false}
  28021. // to treat semantic predicates as opaque and add {@link //HIT_PRED} to the
  28022. // result if one is encountered.
  28023. // @param addEOF Add {@link Token//EOF} to the result if the end of the
  28024. // outermost context is reached. This parameter has no effect if {@code ctx}
  28025. // is {@code null}.
  28026. ///
  28027. LL1Analyzer.prototype._LOOK = function(s, stopState , ctx, look, lookBusy, calledRuleStack, seeThruPreds, addEOF) {
  28028. var c = new ATNConfig({state:s, alt:0, context: ctx}, null);
  28029. if (lookBusy.contains(c)) {
  28030. return;
  28031. }
  28032. lookBusy.add(c);
  28033. if (s === stopState) {
  28034. if (ctx ===null) {
  28035. look.addOne(Token.EPSILON);
  28036. return;
  28037. } else if (ctx.isEmpty() && addEOF) {
  28038. look.addOne(Token.EOF);
  28039. return;
  28040. }
  28041. }
  28042. if (s instanceof RuleStopState ) {
  28043. if (ctx ===null) {
  28044. look.addOne(Token.EPSILON);
  28045. return;
  28046. } else if (ctx.isEmpty() && addEOF) {
  28047. look.addOne(Token.EOF);
  28048. return;
  28049. }
  28050. if (ctx !== PredictionContext.EMPTY) {
  28051. // run thru all possible stack tops in ctx
  28052. for(var i=0; i<ctx.length; i++) {
  28053. var returnState = this.atn.states[ctx.getReturnState(i)];
  28054. var removed = calledRuleStack.contains(returnState.ruleIndex);
  28055. try {
  28056. calledRuleStack.remove(returnState.ruleIndex);
  28057. this._LOOK(returnState, stopState, ctx.getParent(i), look, lookBusy, calledRuleStack, seeThruPreds, addEOF);
  28058. } finally {
  28059. if (removed) {
  28060. calledRuleStack.add(returnState.ruleIndex);
  28061. }
  28062. }
  28063. }
  28064. return;
  28065. }
  28066. }
  28067. for(var j=0; j<s.transitions.length; j++) {
  28068. var t = s.transitions[j];
  28069. if (t.constructor === RuleTransition) {
  28070. if (calledRuleStack.contains(t.target.ruleIndex)) {
  28071. continue;
  28072. }
  28073. var newContext = SingletonPredictionContext.create(ctx, t.followState.stateNumber);
  28074. try {
  28075. calledRuleStack.add(t.target.ruleIndex);
  28076. this._LOOK(t.target, stopState, newContext, look, lookBusy, calledRuleStack, seeThruPreds, addEOF);
  28077. } finally {
  28078. calledRuleStack.remove(t.target.ruleIndex);
  28079. }
  28080. } else if (t instanceof AbstractPredicateTransition ) {
  28081. if (seeThruPreds) {
  28082. this._LOOK(t.target, stopState, ctx, look, lookBusy, calledRuleStack, seeThruPreds, addEOF);
  28083. } else {
  28084. look.addOne(LL1Analyzer.HIT_PRED);
  28085. }
  28086. } else if( t.isEpsilon) {
  28087. this._LOOK(t.target, stopState, ctx, look, lookBusy, calledRuleStack, seeThruPreds, addEOF);
  28088. } else if (t.constructor === WildcardTransition) {
  28089. look.addRange( Token.MIN_USER_TOKEN_TYPE, this.atn.maxTokenType );
  28090. } else {
  28091. var set = t.label;
  28092. if (set !== null) {
  28093. if (t instanceof NotSetTransition) {
  28094. set = set.complement(Token.MIN_USER_TOKEN_TYPE, this.atn.maxTokenType);
  28095. }
  28096. look.addSet(set);
  28097. }
  28098. }
  28099. }
  28100. };
  28101. exports.LL1Analyzer = LL1Analyzer;
  28102. /***/ }),
  28103. /***/ "./node_modules/antlr4/Lexer.js":
  28104. /*!**************************************!*\
  28105. !*** ./node_modules/antlr4/Lexer.js ***!
  28106. \**************************************/
  28107. /*! no static exports found */
  28108. /***/ (function(module, exports, __webpack_require__) {
  28109. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  28110. * Use of this file is governed by the BSD 3-clause license that
  28111. * can be found in the LICENSE.txt file in the project root.
  28112. */
  28113. ///
  28114. // A lexer is recognizer that draws input symbols from a character stream.
  28115. // lexer grammars result in a subclass of this object. A Lexer object
  28116. // uses simplified match() and error recovery mechanisms in the interest of speed.
  28117. var Token = __webpack_require__(/*! ./Token */ "./node_modules/antlr4/Token.js").Token;
  28118. var Recognizer = __webpack_require__(/*! ./Recognizer */ "./node_modules/antlr4/Recognizer.js").Recognizer;
  28119. var CommonTokenFactory = __webpack_require__(/*! ./CommonTokenFactory */ "./node_modules/antlr4/CommonTokenFactory.js").CommonTokenFactory;
  28120. var RecognitionException = __webpack_require__(/*! ./error/Errors */ "./node_modules/antlr4/error/Errors.js").RecognitionException;
  28121. var LexerNoViableAltException = __webpack_require__(/*! ./error/Errors */ "./node_modules/antlr4/error/Errors.js").LexerNoViableAltException;
  28122. function TokenSource() {
  28123. return this;
  28124. }
  28125. function Lexer(input) {
  28126. Recognizer.call(this);
  28127. this._input = input;
  28128. this._factory = CommonTokenFactory.DEFAULT;
  28129. this._tokenFactorySourcePair = [ this, input ];
  28130. this._interp = null; // child classes must populate this
  28131. // The goal of all lexer rules/methods is to create a token object.
  28132. // this is an instance variable as multiple rules may collaborate to
  28133. // create a single token. nextToken will return this object after
  28134. // matching lexer rule(s). If you subclass to allow multiple token
  28135. // emissions, then set this to the last token to be matched or
  28136. // something nonnull so that the auto token emit mechanism will not
  28137. // emit another token.
  28138. this._token = null;
  28139. // What character index in the stream did the current token start at?
  28140. // Needed, for example, to get the text for current token. Set at
  28141. // the start of nextToken.
  28142. this._tokenStartCharIndex = -1;
  28143. // The line on which the first character of the token resides///
  28144. this._tokenStartLine = -1;
  28145. // The character position of first character within the line///
  28146. this._tokenStartColumn = -1;
  28147. // Once we see EOF on char stream, next token will be EOF.
  28148. // If you have DONE : EOF ; then you see DONE EOF.
  28149. this._hitEOF = false;
  28150. // The channel number for the current token///
  28151. this._channel = Token.DEFAULT_CHANNEL;
  28152. // The token type for the current token///
  28153. this._type = Token.INVALID_TYPE;
  28154. this._modeStack = [];
  28155. this._mode = Lexer.DEFAULT_MODE;
  28156. // You can set the text for the current token to override what is in
  28157. // the input char buffer. Use setText() or can set this instance var.
  28158. // /
  28159. this._text = null;
  28160. return this;
  28161. }
  28162. Lexer.prototype = Object.create(Recognizer.prototype);
  28163. Lexer.prototype.constructor = Lexer;
  28164. Lexer.DEFAULT_MODE = 0;
  28165. Lexer.MORE = -2;
  28166. Lexer.SKIP = -3;
  28167. Lexer.DEFAULT_TOKEN_CHANNEL = Token.DEFAULT_CHANNEL;
  28168. Lexer.HIDDEN = Token.HIDDEN_CHANNEL;
  28169. Lexer.MIN_CHAR_VALUE = 0x0000;
  28170. Lexer.MAX_CHAR_VALUE = 0x10FFFF;
  28171. Lexer.prototype.reset = function() {
  28172. // wack Lexer state variables
  28173. if (this._input !== null) {
  28174. this._input.seek(0); // rewind the input
  28175. }
  28176. this._token = null;
  28177. this._type = Token.INVALID_TYPE;
  28178. this._channel = Token.DEFAULT_CHANNEL;
  28179. this._tokenStartCharIndex = -1;
  28180. this._tokenStartColumn = -1;
  28181. this._tokenStartLine = -1;
  28182. this._text = null;
  28183. this._hitEOF = false;
  28184. this._mode = Lexer.DEFAULT_MODE;
  28185. this._modeStack = [];
  28186. this._interp.reset();
  28187. };
  28188. // Return a token from this source; i.e., match a token on the char stream.
  28189. Lexer.prototype.nextToken = function() {
  28190. if (this._input === null) {
  28191. throw "nextToken requires a non-null input stream.";
  28192. }
  28193. // Mark start location in char stream so unbuffered streams are
  28194. // guaranteed at least have text of current token
  28195. var tokenStartMarker = this._input.mark();
  28196. try {
  28197. while (true) {
  28198. if (this._hitEOF) {
  28199. this.emitEOF();
  28200. return this._token;
  28201. }
  28202. this._token = null;
  28203. this._channel = Token.DEFAULT_CHANNEL;
  28204. this._tokenStartCharIndex = this._input.index;
  28205. this._tokenStartColumn = this._interp.column;
  28206. this._tokenStartLine = this._interp.line;
  28207. this._text = null;
  28208. var continueOuter = false;
  28209. while (true) {
  28210. this._type = Token.INVALID_TYPE;
  28211. var ttype = Lexer.SKIP;
  28212. try {
  28213. ttype = this._interp.match(this._input, this._mode);
  28214. } catch (e) {
  28215. if(e instanceof RecognitionException) {
  28216. this.notifyListeners(e); // report error
  28217. this.recover(e);
  28218. } else {
  28219. console.log(e.stack);
  28220. throw e;
  28221. }
  28222. }
  28223. if (this._input.LA(1) === Token.EOF) {
  28224. this._hitEOF = true;
  28225. }
  28226. if (this._type === Token.INVALID_TYPE) {
  28227. this._type = ttype;
  28228. }
  28229. if (this._type === Lexer.SKIP) {
  28230. continueOuter = true;
  28231. break;
  28232. }
  28233. if (this._type !== Lexer.MORE) {
  28234. break;
  28235. }
  28236. }
  28237. if (continueOuter) {
  28238. continue;
  28239. }
  28240. if (this._token === null) {
  28241. this.emit();
  28242. }
  28243. return this._token;
  28244. }
  28245. } finally {
  28246. // make sure we release marker after match or
  28247. // unbuffered char stream will keep buffering
  28248. this._input.release(tokenStartMarker);
  28249. }
  28250. };
  28251. // Instruct the lexer to skip creating a token for current lexer rule
  28252. // and look for another token. nextToken() knows to keep looking when
  28253. // a lexer rule finishes with token set to SKIP_TOKEN. Recall that
  28254. // if token==null at end of any token rule, it creates one for you
  28255. // and emits it.
  28256. // /
  28257. Lexer.prototype.skip = function() {
  28258. this._type = Lexer.SKIP;
  28259. };
  28260. Lexer.prototype.more = function() {
  28261. this._type = Lexer.MORE;
  28262. };
  28263. Lexer.prototype.mode = function(m) {
  28264. this._mode = m;
  28265. };
  28266. Lexer.prototype.pushMode = function(m) {
  28267. if (this._interp.debug) {
  28268. console.log("pushMode " + m);
  28269. }
  28270. this._modeStack.push(this._mode);
  28271. this.mode(m);
  28272. };
  28273. Lexer.prototype.popMode = function() {
  28274. if (this._modeStack.length === 0) {
  28275. throw "Empty Stack";
  28276. }
  28277. if (this._interp.debug) {
  28278. console.log("popMode back to " + this._modeStack.slice(0, -1));
  28279. }
  28280. this.mode(this._modeStack.pop());
  28281. return this._mode;
  28282. };
  28283. // Set the char stream and reset the lexer
  28284. Object.defineProperty(Lexer.prototype, "inputStream", {
  28285. get : function() {
  28286. return this._input;
  28287. },
  28288. set : function(input) {
  28289. this._input = null;
  28290. this._tokenFactorySourcePair = [ this, this._input ];
  28291. this.reset();
  28292. this._input = input;
  28293. this._tokenFactorySourcePair = [ this, this._input ];
  28294. }
  28295. });
  28296. Object.defineProperty(Lexer.prototype, "sourceName", {
  28297. get : function sourceName() {
  28298. return this._input.sourceName;
  28299. }
  28300. });
  28301. // By default does not support multiple emits per nextToken invocation
  28302. // for efficiency reasons. Subclass and override this method, nextToken,
  28303. // and getToken (to push tokens into a list and pull from that list
  28304. // rather than a single variable as this implementation does).
  28305. // /
  28306. Lexer.prototype.emitToken = function(token) {
  28307. this._token = token;
  28308. };
  28309. // The standard method called to automatically emit a token at the
  28310. // outermost lexical rule. The token object should point into the
  28311. // char buffer start..stop. If there is a text override in 'text',
  28312. // use that to set the token's text. Override this method to emit
  28313. // custom Token objects or provide a new factory.
  28314. // /
  28315. Lexer.prototype.emit = function() {
  28316. var t = this._factory.create(this._tokenFactorySourcePair, this._type,
  28317. this._text, this._channel, this._tokenStartCharIndex, this
  28318. .getCharIndex() - 1, this._tokenStartLine,
  28319. this._tokenStartColumn);
  28320. this.emitToken(t);
  28321. return t;
  28322. };
  28323. Lexer.prototype.emitEOF = function() {
  28324. var cpos = this.column;
  28325. var lpos = this.line;
  28326. var eof = this._factory.create(this._tokenFactorySourcePair, Token.EOF,
  28327. null, Token.DEFAULT_CHANNEL, this._input.index,
  28328. this._input.index - 1, lpos, cpos);
  28329. this.emitToken(eof);
  28330. return eof;
  28331. };
  28332. Object.defineProperty(Lexer.prototype, "type", {
  28333. get : function() {
  28334. return this.type;
  28335. },
  28336. set : function(type) {
  28337. this._type = type;
  28338. }
  28339. });
  28340. Object.defineProperty(Lexer.prototype, "line", {
  28341. get : function() {
  28342. return this._interp.line;
  28343. },
  28344. set : function(line) {
  28345. this._interp.line = line;
  28346. }
  28347. });
  28348. Object.defineProperty(Lexer.prototype, "column", {
  28349. get : function() {
  28350. return this._interp.column;
  28351. },
  28352. set : function(column) {
  28353. this._interp.column = column;
  28354. }
  28355. });
  28356. // What is the index of the current character of lookahead?///
  28357. Lexer.prototype.getCharIndex = function() {
  28358. return this._input.index;
  28359. };
  28360. // Return the text matched so far for the current token or any text override.
  28361. //Set the complete text of this token; it wipes any previous changes to the text.
  28362. Object.defineProperty(Lexer.prototype, "text", {
  28363. get : function() {
  28364. if (this._text !== null) {
  28365. return this._text;
  28366. } else {
  28367. return this._interp.getText(this._input);
  28368. }
  28369. },
  28370. set : function(text) {
  28371. this._text = text;
  28372. }
  28373. });
  28374. // Return a list of all Token objects in input char stream.
  28375. // Forces load of all tokens. Does not include EOF token.
  28376. // /
  28377. Lexer.prototype.getAllTokens = function() {
  28378. var tokens = [];
  28379. var t = this.nextToken();
  28380. while (t.type !== Token.EOF) {
  28381. tokens.push(t);
  28382. t = this.nextToken();
  28383. }
  28384. return tokens;
  28385. };
  28386. Lexer.prototype.notifyListeners = function(e) {
  28387. var start = this._tokenStartCharIndex;
  28388. var stop = this._input.index;
  28389. var text = this._input.getText(start, stop);
  28390. var msg = "token recognition error at: '" + this.getErrorDisplay(text) + "'";
  28391. var listener = this.getErrorListenerDispatch();
  28392. listener.syntaxError(this, null, this._tokenStartLine,
  28393. this._tokenStartColumn, msg, e);
  28394. };
  28395. Lexer.prototype.getErrorDisplay = function(s) {
  28396. var d = [];
  28397. for (var i = 0; i < s.length; i++) {
  28398. d.push(s[i]);
  28399. }
  28400. return d.join('');
  28401. };
  28402. Lexer.prototype.getErrorDisplayForChar = function(c) {
  28403. if (c.charCodeAt(0) === Token.EOF) {
  28404. return "<EOF>";
  28405. } else if (c === '\n') {
  28406. return "\\n";
  28407. } else if (c === '\t') {
  28408. return "\\t";
  28409. } else if (c === '\r') {
  28410. return "\\r";
  28411. } else {
  28412. return c;
  28413. }
  28414. };
  28415. Lexer.prototype.getCharErrorDisplay = function(c) {
  28416. return "'" + this.getErrorDisplayForChar(c) + "'";
  28417. };
  28418. // Lexers can normally match any char in it's vocabulary after matching
  28419. // a token, so do the easy thing and just kill a character and hope
  28420. // it all works out. You can instead use the rule invocation stack
  28421. // to do sophisticated error recovery if you are in a fragment rule.
  28422. // /
  28423. Lexer.prototype.recover = function(re) {
  28424. if (this._input.LA(1) !== Token.EOF) {
  28425. if (re instanceof LexerNoViableAltException) {
  28426. // skip a char and try again
  28427. this._interp.consume(this._input);
  28428. } else {
  28429. // TODO: Do we lose character or line position information?
  28430. this._input.consume();
  28431. }
  28432. }
  28433. };
  28434. exports.Lexer = Lexer;
  28435. /***/ }),
  28436. /***/ "./node_modules/antlr4/Parser.js":
  28437. /*!***************************************!*\
  28438. !*** ./node_modules/antlr4/Parser.js ***!
  28439. \***************************************/
  28440. /*! no static exports found */
  28441. /***/ (function(module, exports, __webpack_require__) {
  28442. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  28443. * Use of this file is governed by the BSD 3-clause license that
  28444. * can be found in the LICENSE.txt file in the project root.
  28445. */
  28446. var Token = __webpack_require__(/*! ./Token */ "./node_modules/antlr4/Token.js").Token;
  28447. var ParseTreeListener = __webpack_require__(/*! ./tree/Tree */ "./node_modules/antlr4/tree/Tree.js").ParseTreeListener;
  28448. var Recognizer = __webpack_require__(/*! ./Recognizer */ "./node_modules/antlr4/Recognizer.js").Recognizer;
  28449. var DefaultErrorStrategy = __webpack_require__(/*! ./error/ErrorStrategy */ "./node_modules/antlr4/error/ErrorStrategy.js").DefaultErrorStrategy;
  28450. var ATNDeserializer = __webpack_require__(/*! ./atn/ATNDeserializer */ "./node_modules/antlr4/atn/ATNDeserializer.js").ATNDeserializer;
  28451. var ATNDeserializationOptions = __webpack_require__(/*! ./atn/ATNDeserializationOptions */ "./node_modules/antlr4/atn/ATNDeserializationOptions.js").ATNDeserializationOptions;
  28452. var TerminalNode = __webpack_require__(/*! ./tree/Tree */ "./node_modules/antlr4/tree/Tree.js").TerminalNode;
  28453. var ErrorNode = __webpack_require__(/*! ./tree/Tree */ "./node_modules/antlr4/tree/Tree.js").ErrorNode;
  28454. function TraceListener(parser) {
  28455. ParseTreeListener.call(this);
  28456. this.parser = parser;
  28457. return this;
  28458. }
  28459. TraceListener.prototype = Object.create(ParseTreeListener.prototype);
  28460. TraceListener.prototype.constructor = TraceListener;
  28461. TraceListener.prototype.enterEveryRule = function(ctx) {
  28462. console.log("enter " + this.parser.ruleNames[ctx.ruleIndex] + ", LT(1)=" + this.parser._input.LT(1).text);
  28463. };
  28464. TraceListener.prototype.visitTerminal = function( node) {
  28465. console.log("consume " + node.symbol + " rule " + this.parser.ruleNames[this.parser._ctx.ruleIndex]);
  28466. };
  28467. TraceListener.prototype.exitEveryRule = function(ctx) {
  28468. console.log("exit " + this.parser.ruleNames[ctx.ruleIndex] + ", LT(1)=" + this.parser._input.LT(1).text);
  28469. };
  28470. // this is all the parsing support code essentially; most of it is error
  28471. // recovery stuff.//
  28472. function Parser(input) {
  28473. Recognizer.call(this);
  28474. // The input stream.
  28475. this._input = null;
  28476. // The error handling strategy for the parser. The default value is a new
  28477. // instance of {@link DefaultErrorStrategy}.
  28478. this._errHandler = new DefaultErrorStrategy();
  28479. this._precedenceStack = [];
  28480. this._precedenceStack.push(0);
  28481. // The {@link ParserRuleContext} object for the currently executing rule.
  28482. // this is always non-null during the parsing process.
  28483. this._ctx = null;
  28484. // Specifies whether or not the parser should construct a parse tree during
  28485. // the parsing process. The default value is {@code true}.
  28486. this.buildParseTrees = true;
  28487. // When {@link //setTrace}{@code (true)} is called, a reference to the
  28488. // {@link TraceListener} is stored here so it can be easily removed in a
  28489. // later call to {@link //setTrace}{@code (false)}. The listener itself is
  28490. // implemented as a parser listener so this field is not directly used by
  28491. // other parser methods.
  28492. this._tracer = null;
  28493. // The list of {@link ParseTreeListener} listeners registered to receive
  28494. // events during the parse.
  28495. this._parseListeners = null;
  28496. // The number of syntax errors reported during parsing. this value is
  28497. // incremented each time {@link //notifyErrorListeners} is called.
  28498. this._syntaxErrors = 0;
  28499. this.setInputStream(input);
  28500. return this;
  28501. }
  28502. Parser.prototype = Object.create(Recognizer.prototype);
  28503. Parser.prototype.contructor = Parser;
  28504. // this field maps from the serialized ATN string to the deserialized {@link
  28505. // ATN} with
  28506. // bypass alternatives.
  28507. //
  28508. // @see ATNDeserializationOptions//isGenerateRuleBypassTransitions()
  28509. //
  28510. Parser.bypassAltsAtnCache = {};
  28511. // reset the parser's state//
  28512. Parser.prototype.reset = function() {
  28513. if (this._input !== null) {
  28514. this._input.seek(0);
  28515. }
  28516. this._errHandler.reset(this);
  28517. this._ctx = null;
  28518. this._syntaxErrors = 0;
  28519. this.setTrace(false);
  28520. this._precedenceStack = [];
  28521. this._precedenceStack.push(0);
  28522. if (this._interp !== null) {
  28523. this._interp.reset();
  28524. }
  28525. };
  28526. // Match current input symbol against {@code ttype}. If the symbol type
  28527. // matches, {@link ANTLRErrorStrategy//reportMatch} and {@link //consume} are
  28528. // called to complete the match process.
  28529. //
  28530. // <p>If the symbol type does not match,
  28531. // {@link ANTLRErrorStrategy//recoverInline} is called on the current error
  28532. // strategy to attempt recovery. If {@link //getBuildParseTree} is
  28533. // {@code true} and the token index of the symbol returned by
  28534. // {@link ANTLRErrorStrategy//recoverInline} is -1, the symbol is added to
  28535. // the parse tree by calling {@link ParserRuleContext//addErrorNode}.</p>
  28536. //
  28537. // @param ttype the token type to match
  28538. // @return the matched symbol
  28539. // @throws RecognitionException if the current input symbol did not match
  28540. // {@code ttype} and the error strategy could not recover from the
  28541. // mismatched symbol
  28542. Parser.prototype.match = function(ttype) {
  28543. var t = this.getCurrentToken();
  28544. if (t.type === ttype) {
  28545. this._errHandler.reportMatch(this);
  28546. this.consume();
  28547. } else {
  28548. t = this._errHandler.recoverInline(this);
  28549. if (this.buildParseTrees && t.tokenIndex === -1) {
  28550. // we must have conjured up a new token during single token
  28551. // insertion
  28552. // if it's not the current symbol
  28553. this._ctx.addErrorNode(t);
  28554. }
  28555. }
  28556. return t;
  28557. };
  28558. // Match current input symbol as a wildcard. If the symbol type matches
  28559. // (i.e. has a value greater than 0), {@link ANTLRErrorStrategy//reportMatch}
  28560. // and {@link //consume} are called to complete the match process.
  28561. //
  28562. // <p>If the symbol type does not match,
  28563. // {@link ANTLRErrorStrategy//recoverInline} is called on the current error
  28564. // strategy to attempt recovery. If {@link //getBuildParseTree} is
  28565. // {@code true} and the token index of the symbol returned by
  28566. // {@link ANTLRErrorStrategy//recoverInline} is -1, the symbol is added to
  28567. // the parse tree by calling {@link ParserRuleContext//addErrorNode}.</p>
  28568. //
  28569. // @return the matched symbol
  28570. // @throws RecognitionException if the current input symbol did not match
  28571. // a wildcard and the error strategy could not recover from the mismatched
  28572. // symbol
  28573. Parser.prototype.matchWildcard = function() {
  28574. var t = this.getCurrentToken();
  28575. if (t.type > 0) {
  28576. this._errHandler.reportMatch(this);
  28577. this.consume();
  28578. } else {
  28579. t = this._errHandler.recoverInline(this);
  28580. if (this._buildParseTrees && t.tokenIndex === -1) {
  28581. // we must have conjured up a new token during single token
  28582. // insertion
  28583. // if it's not the current symbol
  28584. this._ctx.addErrorNode(t);
  28585. }
  28586. }
  28587. return t;
  28588. };
  28589. Parser.prototype.getParseListeners = function() {
  28590. return this._parseListeners || [];
  28591. };
  28592. // Registers {@code listener} to receive events during the parsing process.
  28593. //
  28594. // <p>To support output-preserving grammar transformations (including but not
  28595. // limited to left-recursion removal, automated left-factoring, and
  28596. // optimized code generation), calls to listener methods during the parse
  28597. // may differ substantially from calls made by
  28598. // {@link ParseTreeWalker//DEFAULT} used after the parse is complete. In
  28599. // particular, rule entry and exit events may occur in a different order
  28600. // during the parse than after the parser. In addition, calls to certain
  28601. // rule entry methods may be omitted.</p>
  28602. //
  28603. // <p>With the following specific exceptions, calls to listener events are
  28604. // <em>deterministic</em>, i.e. for identical input the calls to listener
  28605. // methods will be the same.</p>
  28606. //
  28607. // <ul>
  28608. // <li>Alterations to the grammar used to generate code may change the
  28609. // behavior of the listener calls.</li>
  28610. // <li>Alterations to the command line options passed to ANTLR 4 when
  28611. // generating the parser may change the behavior of the listener calls.</li>
  28612. // <li>Changing the version of the ANTLR Tool used to generate the parser
  28613. // may change the behavior of the listener calls.</li>
  28614. // </ul>
  28615. //
  28616. // @param listener the listener to add
  28617. //
  28618. // @throws NullPointerException if {@code} listener is {@code null}
  28619. //
  28620. Parser.prototype.addParseListener = function(listener) {
  28621. if (listener === null) {
  28622. throw "listener";
  28623. }
  28624. if (this._parseListeners === null) {
  28625. this._parseListeners = [];
  28626. }
  28627. this._parseListeners.push(listener);
  28628. };
  28629. //
  28630. // Remove {@code listener} from the list of parse listeners.
  28631. //
  28632. // <p>If {@code listener} is {@code null} or has not been added as a parse
  28633. // listener, this method does nothing.</p>
  28634. // @param listener the listener to remove
  28635. //
  28636. Parser.prototype.removeParseListener = function(listener) {
  28637. if (this._parseListeners !== null) {
  28638. var idx = this._parseListeners.indexOf(listener);
  28639. if (idx >= 0) {
  28640. this._parseListeners.splice(idx, 1);
  28641. }
  28642. if (this._parseListeners.length === 0) {
  28643. this._parseListeners = null;
  28644. }
  28645. }
  28646. };
  28647. // Remove all parse listeners.
  28648. Parser.prototype.removeParseListeners = function() {
  28649. this._parseListeners = null;
  28650. };
  28651. // Notify any parse listeners of an enter rule event.
  28652. Parser.prototype.triggerEnterRuleEvent = function() {
  28653. if (this._parseListeners !== null) {
  28654. var ctx = this._ctx;
  28655. this._parseListeners.map(function(listener) {
  28656. listener.enterEveryRule(ctx);
  28657. ctx.enterRule(listener);
  28658. });
  28659. }
  28660. };
  28661. //
  28662. // Notify any parse listeners of an exit rule event.
  28663. //
  28664. // @see //addParseListener
  28665. //
  28666. Parser.prototype.triggerExitRuleEvent = function() {
  28667. if (this._parseListeners !== null) {
  28668. // reverse order walk of listeners
  28669. var ctx = this._ctx;
  28670. this._parseListeners.slice(0).reverse().map(function(listener) {
  28671. ctx.exitRule(listener);
  28672. listener.exitEveryRule(ctx);
  28673. });
  28674. }
  28675. };
  28676. Parser.prototype.getTokenFactory = function() {
  28677. return this._input.tokenSource._factory;
  28678. };
  28679. // Tell our token source and error strategy about a new way to create tokens.//
  28680. Parser.prototype.setTokenFactory = function(factory) {
  28681. this._input.tokenSource._factory = factory;
  28682. };
  28683. // The ATN with bypass alternatives is expensive to create so we create it
  28684. // lazily.
  28685. //
  28686. // @throws UnsupportedOperationException if the current parser does not
  28687. // implement the {@link //getSerializedATN()} method.
  28688. //
  28689. Parser.prototype.getATNWithBypassAlts = function() {
  28690. var serializedAtn = this.getSerializedATN();
  28691. if (serializedAtn === null) {
  28692. throw "The current parser does not support an ATN with bypass alternatives.";
  28693. }
  28694. var result = this.bypassAltsAtnCache[serializedAtn];
  28695. if (result === null) {
  28696. var deserializationOptions = new ATNDeserializationOptions();
  28697. deserializationOptions.generateRuleBypassTransitions = true;
  28698. result = new ATNDeserializer(deserializationOptions)
  28699. .deserialize(serializedAtn);
  28700. this.bypassAltsAtnCache[serializedAtn] = result;
  28701. }
  28702. return result;
  28703. };
  28704. // The preferred method of getting a tree pattern. For example, here's a
  28705. // sample use:
  28706. //
  28707. // <pre>
  28708. // ParseTree t = parser.expr();
  28709. // ParseTreePattern p = parser.compileParseTreePattern("&lt;ID&gt;+0",
  28710. // MyParser.RULE_expr);
  28711. // ParseTreeMatch m = p.match(t);
  28712. // String id = m.get("ID");
  28713. // </pre>
  28714. var Lexer = __webpack_require__(/*! ./Lexer */ "./node_modules/antlr4/Lexer.js").Lexer;
  28715. Parser.prototype.compileParseTreePattern = function(pattern, patternRuleIndex, lexer) {
  28716. lexer = lexer || null;
  28717. if (lexer === null) {
  28718. if (this.getTokenStream() !== null) {
  28719. var tokenSource = this.getTokenStream().tokenSource;
  28720. if (tokenSource instanceof Lexer) {
  28721. lexer = tokenSource;
  28722. }
  28723. }
  28724. }
  28725. if (lexer === null) {
  28726. throw "Parser can't discover a lexer to use";
  28727. }
  28728. var m = new ParseTreePatternMatcher(lexer, this);
  28729. return m.compile(pattern, patternRuleIndex);
  28730. };
  28731. Parser.prototype.getInputStream = function() {
  28732. return this.getTokenStream();
  28733. };
  28734. Parser.prototype.setInputStream = function(input) {
  28735. this.setTokenStream(input);
  28736. };
  28737. Parser.prototype.getTokenStream = function() {
  28738. return this._input;
  28739. };
  28740. // Set the token stream and reset the parser.//
  28741. Parser.prototype.setTokenStream = function(input) {
  28742. this._input = null;
  28743. this.reset();
  28744. this._input = input;
  28745. };
  28746. // Match needs to return the current input symbol, which gets put
  28747. // into the label for the associated token ref; e.g., x=ID.
  28748. //
  28749. Parser.prototype.getCurrentToken = function() {
  28750. return this._input.LT(1);
  28751. };
  28752. Parser.prototype.notifyErrorListeners = function(msg, offendingToken, err) {
  28753. offendingToken = offendingToken || null;
  28754. err = err || null;
  28755. if (offendingToken === null) {
  28756. offendingToken = this.getCurrentToken();
  28757. }
  28758. this._syntaxErrors += 1;
  28759. var line = offendingToken.line;
  28760. var column = offendingToken.column;
  28761. var listener = this.getErrorListenerDispatch();
  28762. listener.syntaxError(this, offendingToken, line, column, msg, err);
  28763. };
  28764. //
  28765. // Consume and return the {@linkplain //getCurrentToken current symbol}.
  28766. //
  28767. // <p>E.g., given the following input with {@code A} being the current
  28768. // lookahead symbol, this function moves the cursor to {@code B} and returns
  28769. // {@code A}.</p>
  28770. //
  28771. // <pre>
  28772. // A B
  28773. // ^
  28774. // </pre>
  28775. //
  28776. // If the parser is not in error recovery mode, the consumed symbol is added
  28777. // to the parse tree using {@link ParserRuleContext//addChild(Token)}, and
  28778. // {@link ParseTreeListener//visitTerminal} is called on any parse listeners.
  28779. // If the parser <em>is</em> in error recovery mode, the consumed symbol is
  28780. // added to the parse tree using
  28781. // {@link ParserRuleContext//addErrorNode(Token)}, and
  28782. // {@link ParseTreeListener//visitErrorNode} is called on any parse
  28783. // listeners.
  28784. //
  28785. Parser.prototype.consume = function() {
  28786. var o = this.getCurrentToken();
  28787. if (o.type !== Token.EOF) {
  28788. this.getInputStream().consume();
  28789. }
  28790. var hasListener = this._parseListeners !== null && this._parseListeners.length > 0;
  28791. if (this.buildParseTrees || hasListener) {
  28792. var node;
  28793. if (this._errHandler.inErrorRecoveryMode(this)) {
  28794. node = this._ctx.addErrorNode(o);
  28795. } else {
  28796. node = this._ctx.addTokenNode(o);
  28797. }
  28798. node.invokingState = this.state;
  28799. if (hasListener) {
  28800. this._parseListeners.map(function(listener) {
  28801. if (node instanceof ErrorNode || (node.isErrorNode !== undefined && node.isErrorNode())) {
  28802. listener.visitErrorNode(node);
  28803. } else if (node instanceof TerminalNode) {
  28804. listener.visitTerminal(node);
  28805. }
  28806. });
  28807. }
  28808. }
  28809. return o;
  28810. };
  28811. Parser.prototype.addContextToParseTree = function() {
  28812. // add current context to parent if we have a parent
  28813. if (this._ctx.parentCtx !== null) {
  28814. this._ctx.parentCtx.addChild(this._ctx);
  28815. }
  28816. };
  28817. // Always called by generated parsers upon entry to a rule. Access field
  28818. // {@link //_ctx} get the current context.
  28819. Parser.prototype.enterRule = function(localctx, state, ruleIndex) {
  28820. this.state = state;
  28821. this._ctx = localctx;
  28822. this._ctx.start = this._input.LT(1);
  28823. if (this.buildParseTrees) {
  28824. this.addContextToParseTree();
  28825. }
  28826. if (this._parseListeners !== null) {
  28827. this.triggerEnterRuleEvent();
  28828. }
  28829. };
  28830. Parser.prototype.exitRule = function() {
  28831. this._ctx.stop = this._input.LT(-1);
  28832. // trigger event on _ctx, before it reverts to parent
  28833. if (this._parseListeners !== null) {
  28834. this.triggerExitRuleEvent();
  28835. }
  28836. this.state = this._ctx.invokingState;
  28837. this._ctx = this._ctx.parentCtx;
  28838. };
  28839. Parser.prototype.enterOuterAlt = function(localctx, altNum) {
  28840. localctx.setAltNumber(altNum);
  28841. // if we have new localctx, make sure we replace existing ctx
  28842. // that is previous child of parse tree
  28843. if (this.buildParseTrees && this._ctx !== localctx) {
  28844. if (this._ctx.parentCtx !== null) {
  28845. this._ctx.parentCtx.removeLastChild();
  28846. this._ctx.parentCtx.addChild(localctx);
  28847. }
  28848. }
  28849. this._ctx = localctx;
  28850. };
  28851. // Get the precedence level for the top-most precedence rule.
  28852. //
  28853. // @return The precedence level for the top-most precedence rule, or -1 if
  28854. // the parser context is not nested within a precedence rule.
  28855. Parser.prototype.getPrecedence = function() {
  28856. if (this._precedenceStack.length === 0) {
  28857. return -1;
  28858. } else {
  28859. return this._precedenceStack[this._precedenceStack.length-1];
  28860. }
  28861. };
  28862. Parser.prototype.enterRecursionRule = function(localctx, state, ruleIndex,
  28863. precedence) {
  28864. this.state = state;
  28865. this._precedenceStack.push(precedence);
  28866. this._ctx = localctx;
  28867. this._ctx.start = this._input.LT(1);
  28868. if (this._parseListeners !== null) {
  28869. this.triggerEnterRuleEvent(); // simulates rule entry for
  28870. // left-recursive rules
  28871. }
  28872. };
  28873. //
  28874. // Like {@link //enterRule} but for recursive rules.
  28875. Parser.prototype.pushNewRecursionContext = function(localctx, state, ruleIndex) {
  28876. var previous = this._ctx;
  28877. previous.parentCtx = localctx;
  28878. previous.invokingState = state;
  28879. previous.stop = this._input.LT(-1);
  28880. this._ctx = localctx;
  28881. this._ctx.start = previous.start;
  28882. if (this.buildParseTrees) {
  28883. this._ctx.addChild(previous);
  28884. }
  28885. if (this._parseListeners !== null) {
  28886. this.triggerEnterRuleEvent(); // simulates rule entry for
  28887. // left-recursive rules
  28888. }
  28889. };
  28890. Parser.prototype.unrollRecursionContexts = function(parentCtx) {
  28891. this._precedenceStack.pop();
  28892. this._ctx.stop = this._input.LT(-1);
  28893. var retCtx = this._ctx; // save current ctx (return value)
  28894. // unroll so _ctx is as it was before call to recursive method
  28895. if (this._parseListeners !== null) {
  28896. while (this._ctx !== parentCtx) {
  28897. this.triggerExitRuleEvent();
  28898. this._ctx = this._ctx.parentCtx;
  28899. }
  28900. } else {
  28901. this._ctx = parentCtx;
  28902. }
  28903. // hook into tree
  28904. retCtx.parentCtx = parentCtx;
  28905. if (this.buildParseTrees && parentCtx !== null) {
  28906. // add return ctx into invoking rule's tree
  28907. parentCtx.addChild(retCtx);
  28908. }
  28909. };
  28910. Parser.prototype.getInvokingContext = function(ruleIndex) {
  28911. var ctx = this._ctx;
  28912. while (ctx !== null) {
  28913. if (ctx.ruleIndex === ruleIndex) {
  28914. return ctx;
  28915. }
  28916. ctx = ctx.parentCtx;
  28917. }
  28918. return null;
  28919. };
  28920. Parser.prototype.precpred = function(localctx, precedence) {
  28921. return precedence >= this._precedenceStack[this._precedenceStack.length-1];
  28922. };
  28923. Parser.prototype.inContext = function(context) {
  28924. // TODO: useful in parser?
  28925. return false;
  28926. };
  28927. //
  28928. // Checks whether or not {@code symbol} can follow the current state in the
  28929. // ATN. The behavior of this method is equivalent to the following, but is
  28930. // implemented such that the complete context-sensitive follow set does not
  28931. // need to be explicitly constructed.
  28932. //
  28933. // <pre>
  28934. // return getExpectedTokens().contains(symbol);
  28935. // </pre>
  28936. //
  28937. // @param symbol the symbol type to check
  28938. // @return {@code true} if {@code symbol} can follow the current state in
  28939. // the ATN, otherwise {@code false}.
  28940. Parser.prototype.isExpectedToken = function(symbol) {
  28941. var atn = this._interp.atn;
  28942. var ctx = this._ctx;
  28943. var s = atn.states[this.state];
  28944. var following = atn.nextTokens(s);
  28945. if (following.contains(symbol)) {
  28946. return true;
  28947. }
  28948. if (!following.contains(Token.EPSILON)) {
  28949. return false;
  28950. }
  28951. while (ctx !== null && ctx.invokingState >= 0 && following.contains(Token.EPSILON)) {
  28952. var invokingState = atn.states[ctx.invokingState];
  28953. var rt = invokingState.transitions[0];
  28954. following = atn.nextTokens(rt.followState);
  28955. if (following.contains(symbol)) {
  28956. return true;
  28957. }
  28958. ctx = ctx.parentCtx;
  28959. }
  28960. if (following.contains(Token.EPSILON) && symbol === Token.EOF) {
  28961. return true;
  28962. } else {
  28963. return false;
  28964. }
  28965. };
  28966. // Computes the set of input symbols which could follow the current parser
  28967. // state and context, as given by {@link //getState} and {@link //getContext},
  28968. // respectively.
  28969. //
  28970. // @see ATN//getExpectedTokens(int, RuleContext)
  28971. //
  28972. Parser.prototype.getExpectedTokens = function() {
  28973. return this._interp.atn.getExpectedTokens(this.state, this._ctx);
  28974. };
  28975. Parser.prototype.getExpectedTokensWithinCurrentRule = function() {
  28976. var atn = this._interp.atn;
  28977. var s = atn.states[this.state];
  28978. return atn.nextTokens(s);
  28979. };
  28980. // Get a rule's index (i.e., {@code RULE_ruleName} field) or -1 if not found.//
  28981. Parser.prototype.getRuleIndex = function(ruleName) {
  28982. var ruleIndex = this.getRuleIndexMap()[ruleName];
  28983. if (ruleIndex !== null) {
  28984. return ruleIndex;
  28985. } else {
  28986. return -1;
  28987. }
  28988. };
  28989. // Return List&lt;String&gt; of the rule names in your parser instance
  28990. // leading up to a call to the current rule. You could override if
  28991. // you want more details such as the file/line info of where
  28992. // in the ATN a rule is invoked.
  28993. //
  28994. // this is very useful for error messages.
  28995. //
  28996. Parser.prototype.getRuleInvocationStack = function(p) {
  28997. p = p || null;
  28998. if (p === null) {
  28999. p = this._ctx;
  29000. }
  29001. var stack = [];
  29002. while (p !== null) {
  29003. // compute what follows who invoked us
  29004. var ruleIndex = p.ruleIndex;
  29005. if (ruleIndex < 0) {
  29006. stack.push("n/a");
  29007. } else {
  29008. stack.push(this.ruleNames[ruleIndex]);
  29009. }
  29010. p = p.parentCtx;
  29011. }
  29012. return stack;
  29013. };
  29014. // For debugging and other purposes.//
  29015. Parser.prototype.getDFAStrings = function() {
  29016. return this._interp.decisionToDFA.toString();
  29017. };
  29018. // For debugging and other purposes.//
  29019. Parser.prototype.dumpDFA = function() {
  29020. var seenOne = false;
  29021. for (var i = 0; i < this._interp.decisionToDFA.length; i++) {
  29022. var dfa = this._interp.decisionToDFA[i];
  29023. if (dfa.states.length > 0) {
  29024. if (seenOne) {
  29025. console.log();
  29026. }
  29027. this.printer.println("Decision " + dfa.decision + ":");
  29028. this.printer.print(dfa.toString(this.literalNames, this.symbolicNames));
  29029. seenOne = true;
  29030. }
  29031. }
  29032. };
  29033. /*
  29034. " printer = function() {\r\n" +
  29035. " this.println = function(s) { document.getElementById('output') += s + '\\n'; }\r\n" +
  29036. " this.print = function(s) { document.getElementById('output') += s; }\r\n" +
  29037. " };\r\n" +
  29038. */
  29039. Parser.prototype.getSourceName = function() {
  29040. return this._input.sourceName;
  29041. };
  29042. // During a parse is sometimes useful to listen in on the rule entry and exit
  29043. // events as well as token matches. this is for quick and dirty debugging.
  29044. //
  29045. Parser.prototype.setTrace = function(trace) {
  29046. if (!trace) {
  29047. this.removeParseListener(this._tracer);
  29048. this._tracer = null;
  29049. } else {
  29050. if (this._tracer !== null) {
  29051. this.removeParseListener(this._tracer);
  29052. }
  29053. this._tracer = new TraceListener(this);
  29054. this.addParseListener(this._tracer);
  29055. }
  29056. };
  29057. exports.Parser = Parser;
  29058. /***/ }),
  29059. /***/ "./node_modules/antlr4/ParserRuleContext.js":
  29060. /*!**************************************************!*\
  29061. !*** ./node_modules/antlr4/ParserRuleContext.js ***!
  29062. \**************************************************/
  29063. /*! no static exports found */
  29064. /***/ (function(module, exports, __webpack_require__) {
  29065. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  29066. * Use of this file is governed by the BSD 3-clause license that
  29067. * can be found in the LICENSE.txt file in the project root.
  29068. */
  29069. //* A rule invocation record for parsing.
  29070. //
  29071. // Contains all of the information about the current rule not stored in the
  29072. // RuleContext. It handles parse tree children list, Any ATN state
  29073. // tracing, and the default values available for rule indications:
  29074. // start, stop, rule index, current alt number, current
  29075. // ATN state.
  29076. //
  29077. // Subclasses made for each rule and grammar track the parameters,
  29078. // return values, locals, and labels specific to that rule. These
  29079. // are the objects that are returned from rules.
  29080. //
  29081. // Note text is not an actual field of a rule return value; it is computed
  29082. // from start and stop using the input stream's toString() method. I
  29083. // could add a ctor to this so that we can pass in and store the input
  29084. // stream, but I'm not sure we want to do that. It would seem to be undefined
  29085. // to get the .text property anyway if the rule matches tokens from multiple
  29086. // input streams.
  29087. //
  29088. // I do not use getters for fields of objects that are used simply to
  29089. // group values such as this aggregate. The getters/setters are there to
  29090. // satisfy the superclass interface.
  29091. var RuleContext = __webpack_require__(/*! ./RuleContext */ "./node_modules/antlr4/RuleContext.js").RuleContext;
  29092. var Tree = __webpack_require__(/*! ./tree/Tree */ "./node_modules/antlr4/tree/Tree.js");
  29093. var INVALID_INTERVAL = Tree.INVALID_INTERVAL;
  29094. var TerminalNode = Tree.TerminalNode;
  29095. var TerminalNodeImpl = Tree.TerminalNodeImpl;
  29096. var ErrorNodeImpl = Tree.ErrorNodeImpl;
  29097. var Interval = __webpack_require__(/*! ./IntervalSet */ "./node_modules/antlr4/IntervalSet.js").Interval;
  29098. function ParserRuleContext(parent, invokingStateNumber) {
  29099. parent = parent || null;
  29100. invokingStateNumber = invokingStateNumber || null;
  29101. RuleContext.call(this, parent, invokingStateNumber);
  29102. this.ruleIndex = -1;
  29103. // * If we are debugging or building a parse tree for a visitor,
  29104. // we need to track all of the tokens and rule invocations associated
  29105. // with this rule's context. This is empty for parsing w/o tree constr.
  29106. // operation because we don't the need to track the details about
  29107. // how we parse this rule.
  29108. // /
  29109. this.children = null;
  29110. this.start = null;
  29111. this.stop = null;
  29112. // The exception that forced this rule to return. If the rule successfully
  29113. // completed, this is {@code null}.
  29114. this.exception = null;
  29115. }
  29116. ParserRuleContext.prototype = Object.create(RuleContext.prototype);
  29117. ParserRuleContext.prototype.constructor = ParserRuleContext;
  29118. // * COPY a ctx (I'm deliberately not using copy constructor)///
  29119. ParserRuleContext.prototype.copyFrom = function(ctx) {
  29120. // from RuleContext
  29121. this.parentCtx = ctx.parentCtx;
  29122. this.invokingState = ctx.invokingState;
  29123. this.children = null;
  29124. this.start = ctx.start;
  29125. this.stop = ctx.stop;
  29126. // copy any error nodes to alt label node
  29127. if(ctx.children) {
  29128. this.children = [];
  29129. // reset parent pointer for any error nodes
  29130. ctx.children.map(function(child) {
  29131. if (child instanceof ErrorNodeImpl) {
  29132. this.children.push(child);
  29133. child.parentCtx = this;
  29134. }
  29135. }, this);
  29136. }
  29137. };
  29138. // Double dispatch methods for listeners
  29139. ParserRuleContext.prototype.enterRule = function(listener) {
  29140. };
  29141. ParserRuleContext.prototype.exitRule = function(listener) {
  29142. };
  29143. // * Does not set parent link; other add methods do that///
  29144. ParserRuleContext.prototype.addChild = function(child) {
  29145. if (this.children === null) {
  29146. this.children = [];
  29147. }
  29148. this.children.push(child);
  29149. return child;
  29150. };
  29151. // * Used by enterOuterAlt to toss out a RuleContext previously added as
  29152. // we entered a rule. If we have // label, we will need to remove
  29153. // generic ruleContext object.
  29154. // /
  29155. ParserRuleContext.prototype.removeLastChild = function() {
  29156. if (this.children !== null) {
  29157. this.children.pop();
  29158. }
  29159. };
  29160. ParserRuleContext.prototype.addTokenNode = function(token) {
  29161. var node = new TerminalNodeImpl(token);
  29162. this.addChild(node);
  29163. node.parentCtx = this;
  29164. return node;
  29165. };
  29166. ParserRuleContext.prototype.addErrorNode = function(badToken) {
  29167. var node = new ErrorNodeImpl(badToken);
  29168. this.addChild(node);
  29169. node.parentCtx = this;
  29170. return node;
  29171. };
  29172. ParserRuleContext.prototype.getChild = function(i, type) {
  29173. type = type || null;
  29174. if (this.children === null || i < 0 || i >= this.children.length) {
  29175. return null;
  29176. }
  29177. if (type === null) {
  29178. return this.children[i];
  29179. } else {
  29180. for(var j=0; j<this.children.length; j++) {
  29181. var child = this.children[j];
  29182. if(child instanceof type) {
  29183. if(i===0) {
  29184. return child;
  29185. } else {
  29186. i -= 1;
  29187. }
  29188. }
  29189. }
  29190. return null;
  29191. }
  29192. };
  29193. ParserRuleContext.prototype.getToken = function(ttype, i) {
  29194. if (this.children === null || i < 0 || i >= this.children.length) {
  29195. return null;
  29196. }
  29197. for(var j=0; j<this.children.length; j++) {
  29198. var child = this.children[j];
  29199. if (child instanceof TerminalNode) {
  29200. if (child.symbol.type === ttype) {
  29201. if(i===0) {
  29202. return child;
  29203. } else {
  29204. i -= 1;
  29205. }
  29206. }
  29207. }
  29208. }
  29209. return null;
  29210. };
  29211. ParserRuleContext.prototype.getTokens = function(ttype ) {
  29212. if (this.children=== null) {
  29213. return [];
  29214. } else {
  29215. var tokens = [];
  29216. for(var j=0; j<this.children.length; j++) {
  29217. var child = this.children[j];
  29218. if (child instanceof TerminalNode) {
  29219. if (child.symbol.type === ttype) {
  29220. tokens.push(child);
  29221. }
  29222. }
  29223. }
  29224. return tokens;
  29225. }
  29226. };
  29227. ParserRuleContext.prototype.getTypedRuleContext = function(ctxType, i) {
  29228. return this.getChild(i, ctxType);
  29229. };
  29230. ParserRuleContext.prototype.getTypedRuleContexts = function(ctxType) {
  29231. if (this.children=== null) {
  29232. return [];
  29233. } else {
  29234. var contexts = [];
  29235. for(var j=0; j<this.children.length; j++) {
  29236. var child = this.children[j];
  29237. if (child instanceof ctxType) {
  29238. contexts.push(child);
  29239. }
  29240. }
  29241. return contexts;
  29242. }
  29243. };
  29244. ParserRuleContext.prototype.getChildCount = function() {
  29245. if (this.children=== null) {
  29246. return 0;
  29247. } else {
  29248. return this.children.length;
  29249. }
  29250. };
  29251. ParserRuleContext.prototype.getSourceInterval = function() {
  29252. if( this.start === null || this.stop === null) {
  29253. return INVALID_INTERVAL;
  29254. } else {
  29255. return new Interval(this.start.tokenIndex, this.stop.tokenIndex);
  29256. }
  29257. };
  29258. RuleContext.EMPTY = new ParserRuleContext();
  29259. function InterpreterRuleContext(parent, invokingStateNumber, ruleIndex) {
  29260. ParserRuleContext.call(parent, invokingStateNumber);
  29261. this.ruleIndex = ruleIndex;
  29262. return this;
  29263. }
  29264. InterpreterRuleContext.prototype = Object.create(ParserRuleContext.prototype);
  29265. InterpreterRuleContext.prototype.constructor = InterpreterRuleContext;
  29266. exports.ParserRuleContext = ParserRuleContext;
  29267. /***/ }),
  29268. /***/ "./node_modules/antlr4/PredictionContext.js":
  29269. /*!**************************************************!*\
  29270. !*** ./node_modules/antlr4/PredictionContext.js ***!
  29271. \**************************************************/
  29272. /*! no static exports found */
  29273. /***/ (function(module, exports, __webpack_require__) {
  29274. //
  29275. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  29276. * Use of this file is governed by the BSD 3-clause license that
  29277. * can be found in the LICENSE.txt file in the project root.
  29278. */
  29279. ///
  29280. var RuleContext = __webpack_require__(/*! ./RuleContext */ "./node_modules/antlr4/RuleContext.js").RuleContext;
  29281. var Hash = __webpack_require__(/*! ./Utils */ "./node_modules/antlr4/Utils.js").Hash;
  29282. function PredictionContext(cachedHashCode) {
  29283. this.cachedHashCode = cachedHashCode;
  29284. }
  29285. // Represents {@code $} in local context prediction, which means wildcard.
  29286. // {@code//+x =//}.
  29287. // /
  29288. PredictionContext.EMPTY = null;
  29289. // Represents {@code $} in an array in full context mode, when {@code $}
  29290. // doesn't mean wildcard: {@code $ + x = [$,x]}. Here,
  29291. // {@code $} = {@link //EMPTY_RETURN_STATE}.
  29292. // /
  29293. PredictionContext.EMPTY_RETURN_STATE = 0x7FFFFFFF;
  29294. PredictionContext.globalNodeCount = 1;
  29295. PredictionContext.id = PredictionContext.globalNodeCount;
  29296. // Stores the computed hash code of this {@link PredictionContext}. The hash
  29297. // code is computed in parts to match the following reference algorithm.
  29298. //
  29299. // <pre>
  29300. // private int referenceHashCode() {
  29301. // int hash = {@link MurmurHash//initialize MurmurHash.initialize}({@link
  29302. // //INITIAL_HASH});
  29303. //
  29304. // for (int i = 0; i &lt; {@link //size()}; i++) {
  29305. // hash = {@link MurmurHash//update MurmurHash.update}(hash, {@link //getParent
  29306. // getParent}(i));
  29307. // }
  29308. //
  29309. // for (int i = 0; i &lt; {@link //size()}; i++) {
  29310. // hash = {@link MurmurHash//update MurmurHash.update}(hash, {@link
  29311. // //getReturnState getReturnState}(i));
  29312. // }
  29313. //
  29314. // hash = {@link MurmurHash//finish MurmurHash.finish}(hash, 2// {@link
  29315. // //size()});
  29316. // return hash;
  29317. // }
  29318. // </pre>
  29319. // /
  29320. // This means only the {@link //EMPTY} context is in set.
  29321. PredictionContext.prototype.isEmpty = function() {
  29322. return this === PredictionContext.EMPTY;
  29323. };
  29324. PredictionContext.prototype.hasEmptyPath = function() {
  29325. return this.getReturnState(this.length - 1) === PredictionContext.EMPTY_RETURN_STATE;
  29326. };
  29327. PredictionContext.prototype.hashCode = function() {
  29328. return this.cachedHashCode;
  29329. };
  29330. PredictionContext.prototype.updateHashCode = function(hash) {
  29331. hash.update(this.cachedHashCode);
  29332. };
  29333. /*
  29334. function calculateHashString(parent, returnState) {
  29335. return "" + parent + returnState;
  29336. }
  29337. */
  29338. // Used to cache {@link PredictionContext} objects. Its used for the shared
  29339. // context cash associated with contexts in DFA states. This cache
  29340. // can be used for both lexers and parsers.
  29341. function PredictionContextCache() {
  29342. this.cache = {};
  29343. return this;
  29344. }
  29345. // Add a context to the cache and return it. If the context already exists,
  29346. // return that one instead and do not add a new context to the cache.
  29347. // Protect shared cache from unsafe thread access.
  29348. //
  29349. PredictionContextCache.prototype.add = function(ctx) {
  29350. if (ctx === PredictionContext.EMPTY) {
  29351. return PredictionContext.EMPTY;
  29352. }
  29353. var existing = this.cache[ctx] || null;
  29354. if (existing !== null) {
  29355. return existing;
  29356. }
  29357. this.cache[ctx] = ctx;
  29358. return ctx;
  29359. };
  29360. PredictionContextCache.prototype.get = function(ctx) {
  29361. return this.cache[ctx] || null;
  29362. };
  29363. Object.defineProperty(PredictionContextCache.prototype, "length", {
  29364. get : function() {
  29365. return this.cache.length;
  29366. }
  29367. });
  29368. function SingletonPredictionContext(parent, returnState) {
  29369. var hashCode = 0;
  29370. if(parent !== null) {
  29371. var hash = new Hash();
  29372. hash.update(parent, returnState);
  29373. hashCode = hash.finish();
  29374. }
  29375. PredictionContext.call(this, hashCode);
  29376. this.parentCtx = parent;
  29377. this.returnState = returnState;
  29378. }
  29379. SingletonPredictionContext.prototype = Object.create(PredictionContext.prototype);
  29380. SingletonPredictionContext.prototype.contructor = SingletonPredictionContext;
  29381. SingletonPredictionContext.create = function(parent, returnState) {
  29382. if (returnState === PredictionContext.EMPTY_RETURN_STATE && parent === null) {
  29383. // someone can pass in the bits of an array ctx that mean $
  29384. return PredictionContext.EMPTY;
  29385. } else {
  29386. return new SingletonPredictionContext(parent, returnState);
  29387. }
  29388. };
  29389. Object.defineProperty(SingletonPredictionContext.prototype, "length", {
  29390. get : function() {
  29391. return 1;
  29392. }
  29393. });
  29394. SingletonPredictionContext.prototype.getParent = function(index) {
  29395. return this.parentCtx;
  29396. };
  29397. SingletonPredictionContext.prototype.getReturnState = function(index) {
  29398. return this.returnState;
  29399. };
  29400. SingletonPredictionContext.prototype.equals = function(other) {
  29401. if (this === other) {
  29402. return true;
  29403. } else if (!(other instanceof SingletonPredictionContext)) {
  29404. return false;
  29405. } else if (this.hashCode() !== other.hashCode()) {
  29406. return false; // can't be same if hash is different
  29407. } else {
  29408. if(this.returnState !== other.returnState)
  29409. return false;
  29410. else if(this.parentCtx==null)
  29411. return other.parentCtx==null
  29412. else
  29413. return this.parentCtx.equals(other.parentCtx);
  29414. }
  29415. };
  29416. SingletonPredictionContext.prototype.toString = function() {
  29417. var up = this.parentCtx === null ? "" : this.parentCtx.toString();
  29418. if (up.length === 0) {
  29419. if (this.returnState === PredictionContext.EMPTY_RETURN_STATE) {
  29420. return "$";
  29421. } else {
  29422. return "" + this.returnState;
  29423. }
  29424. } else {
  29425. return "" + this.returnState + " " + up;
  29426. }
  29427. };
  29428. function EmptyPredictionContext() {
  29429. SingletonPredictionContext.call(this, null, PredictionContext.EMPTY_RETURN_STATE);
  29430. return this;
  29431. }
  29432. EmptyPredictionContext.prototype = Object.create(SingletonPredictionContext.prototype);
  29433. EmptyPredictionContext.prototype.constructor = EmptyPredictionContext;
  29434. EmptyPredictionContext.prototype.isEmpty = function() {
  29435. return true;
  29436. };
  29437. EmptyPredictionContext.prototype.getParent = function(index) {
  29438. return null;
  29439. };
  29440. EmptyPredictionContext.prototype.getReturnState = function(index) {
  29441. return this.returnState;
  29442. };
  29443. EmptyPredictionContext.prototype.equals = function(other) {
  29444. return this === other;
  29445. };
  29446. EmptyPredictionContext.prototype.toString = function() {
  29447. return "$";
  29448. };
  29449. PredictionContext.EMPTY = new EmptyPredictionContext();
  29450. function ArrayPredictionContext(parents, returnStates) {
  29451. // Parent can be null only if full ctx mode and we make an array
  29452. // from {@link //EMPTY} and non-empty. We merge {@link //EMPTY} by using
  29453. // null parent and
  29454. // returnState == {@link //EMPTY_RETURN_STATE}.
  29455. var h = new Hash();
  29456. h.update(parents, returnStates);
  29457. var hashCode = h.finish();
  29458. PredictionContext.call(this, hashCode);
  29459. this.parents = parents;
  29460. this.returnStates = returnStates;
  29461. return this;
  29462. }
  29463. ArrayPredictionContext.prototype = Object.create(PredictionContext.prototype);
  29464. ArrayPredictionContext.prototype.constructor = ArrayPredictionContext;
  29465. ArrayPredictionContext.prototype.isEmpty = function() {
  29466. // since EMPTY_RETURN_STATE can only appear in the last position, we
  29467. // don't need to verify that size==1
  29468. return this.returnStates[0] === PredictionContext.EMPTY_RETURN_STATE;
  29469. };
  29470. Object.defineProperty(ArrayPredictionContext.prototype, "length", {
  29471. get : function() {
  29472. return this.returnStates.length;
  29473. }
  29474. });
  29475. ArrayPredictionContext.prototype.getParent = function(index) {
  29476. return this.parents[index];
  29477. };
  29478. ArrayPredictionContext.prototype.getReturnState = function(index) {
  29479. return this.returnStates[index];
  29480. };
  29481. ArrayPredictionContext.prototype.equals = function(other) {
  29482. if (this === other) {
  29483. return true;
  29484. } else if (!(other instanceof ArrayPredictionContext)) {
  29485. return false;
  29486. } else if (this.hashCode() !== other.hashCode()) {
  29487. return false; // can't be same if hash is different
  29488. } else {
  29489. return this.returnStates === other.returnStates &&
  29490. this.parents === other.parents;
  29491. }
  29492. };
  29493. ArrayPredictionContext.prototype.toString = function() {
  29494. if (this.isEmpty()) {
  29495. return "[]";
  29496. } else {
  29497. var s = "[";
  29498. for (var i = 0; i < this.returnStates.length; i++) {
  29499. if (i > 0) {
  29500. s = s + ", ";
  29501. }
  29502. if (this.returnStates[i] === PredictionContext.EMPTY_RETURN_STATE) {
  29503. s = s + "$";
  29504. continue;
  29505. }
  29506. s = s + this.returnStates[i];
  29507. if (this.parents[i] !== null) {
  29508. s = s + " " + this.parents[i];
  29509. } else {
  29510. s = s + "null";
  29511. }
  29512. }
  29513. return s + "]";
  29514. }
  29515. };
  29516. // Convert a {@link RuleContext} tree to a {@link PredictionContext} graph.
  29517. // Return {@link //EMPTY} if {@code outerContext} is empty or null.
  29518. // /
  29519. function predictionContextFromRuleContext(atn, outerContext) {
  29520. if (outerContext === undefined || outerContext === null) {
  29521. outerContext = RuleContext.EMPTY;
  29522. }
  29523. // if we are in RuleContext of start rule, s, then PredictionContext
  29524. // is EMPTY. Nobody called us. (if we are empty, return empty)
  29525. if (outerContext.parentCtx === null || outerContext === RuleContext.EMPTY) {
  29526. return PredictionContext.EMPTY;
  29527. }
  29528. // If we have a parent, convert it to a PredictionContext graph
  29529. var parent = predictionContextFromRuleContext(atn, outerContext.parentCtx);
  29530. var state = atn.states[outerContext.invokingState];
  29531. var transition = state.transitions[0];
  29532. return SingletonPredictionContext.create(parent, transition.followState.stateNumber);
  29533. }
  29534. /*
  29535. function calculateListsHashString(parents, returnStates) {
  29536. var s = "";
  29537. parents.map(function(p) {
  29538. s = s + p;
  29539. });
  29540. returnStates.map(function(r) {
  29541. s = s + r;
  29542. });
  29543. return s;
  29544. }
  29545. */
  29546. function merge(a, b, rootIsWildcard, mergeCache) {
  29547. // share same graph if both same
  29548. if (a === b) {
  29549. return a;
  29550. }
  29551. if (a instanceof SingletonPredictionContext && b instanceof SingletonPredictionContext) {
  29552. return mergeSingletons(a, b, rootIsWildcard, mergeCache);
  29553. }
  29554. // At least one of a or b is array
  29555. // If one is $ and rootIsWildcard, return $ as// wildcard
  29556. if (rootIsWildcard) {
  29557. if (a instanceof EmptyPredictionContext) {
  29558. return a;
  29559. }
  29560. if (b instanceof EmptyPredictionContext) {
  29561. return b;
  29562. }
  29563. }
  29564. // convert singleton so both are arrays to normalize
  29565. if (a instanceof SingletonPredictionContext) {
  29566. a = new ArrayPredictionContext([a.getParent()], [a.returnState]);
  29567. }
  29568. if (b instanceof SingletonPredictionContext) {
  29569. b = new ArrayPredictionContext([b.getParent()], [b.returnState]);
  29570. }
  29571. return mergeArrays(a, b, rootIsWildcard, mergeCache);
  29572. }
  29573. //
  29574. // Merge two {@link SingletonPredictionContext} instances.
  29575. //
  29576. // <p>Stack tops equal, parents merge is same; return left graph.<br>
  29577. // <embed src="images/SingletonMerge_SameRootSamePar.svg"
  29578. // type="image/svg+xml"/></p>
  29579. //
  29580. // <p>Same stack top, parents differ; merge parents giving array node, then
  29581. // remainders of those graphs. A new root node is created to point to the
  29582. // merged parents.<br>
  29583. // <embed src="images/SingletonMerge_SameRootDiffPar.svg"
  29584. // type="image/svg+xml"/></p>
  29585. //
  29586. // <p>Different stack tops pointing to same parent. Make array node for the
  29587. // root where both element in the root point to the same (original)
  29588. // parent.<br>
  29589. // <embed src="images/SingletonMerge_DiffRootSamePar.svg"
  29590. // type="image/svg+xml"/></p>
  29591. //
  29592. // <p>Different stack tops pointing to different parents. Make array node for
  29593. // the root where each element points to the corresponding original
  29594. // parent.<br>
  29595. // <embed src="images/SingletonMerge_DiffRootDiffPar.svg"
  29596. // type="image/svg+xml"/></p>
  29597. //
  29598. // @param a the first {@link SingletonPredictionContext}
  29599. // @param b the second {@link SingletonPredictionContext}
  29600. // @param rootIsWildcard {@code true} if this is a local-context merge,
  29601. // otherwise false to indicate a full-context merge
  29602. // @param mergeCache
  29603. // /
  29604. function mergeSingletons(a, b, rootIsWildcard, mergeCache) {
  29605. if (mergeCache !== null) {
  29606. var previous = mergeCache.get(a, b);
  29607. if (previous !== null) {
  29608. return previous;
  29609. }
  29610. previous = mergeCache.get(b, a);
  29611. if (previous !== null) {
  29612. return previous;
  29613. }
  29614. }
  29615. var rootMerge = mergeRoot(a, b, rootIsWildcard);
  29616. if (rootMerge !== null) {
  29617. if (mergeCache !== null) {
  29618. mergeCache.set(a, b, rootMerge);
  29619. }
  29620. return rootMerge;
  29621. }
  29622. if (a.returnState === b.returnState) {
  29623. var parent = merge(a.parentCtx, b.parentCtx, rootIsWildcard, mergeCache);
  29624. // if parent is same as existing a or b parent or reduced to a parent,
  29625. // return it
  29626. if (parent === a.parentCtx) {
  29627. return a; // ax + bx = ax, if a=b
  29628. }
  29629. if (parent === b.parentCtx) {
  29630. return b; // ax + bx = bx, if a=b
  29631. }
  29632. // else: ax + ay = a'[x,y]
  29633. // merge parents x and y, giving array node with x,y then remainders
  29634. // of those graphs. dup a, a' points at merged array
  29635. // new joined parent so create new singleton pointing to it, a'
  29636. var spc = SingletonPredictionContext.create(parent, a.returnState);
  29637. if (mergeCache !== null) {
  29638. mergeCache.set(a, b, spc);
  29639. }
  29640. return spc;
  29641. } else { // a != b payloads differ
  29642. // see if we can collapse parents due to $+x parents if local ctx
  29643. var singleParent = null;
  29644. if (a === b || (a.parentCtx !== null && a.parentCtx === b.parentCtx)) { // ax +
  29645. // bx =
  29646. // [a,b]x
  29647. singleParent = a.parentCtx;
  29648. }
  29649. if (singleParent !== null) { // parents are same
  29650. // sort payloads and use same parent
  29651. var payloads = [ a.returnState, b.returnState ];
  29652. if (a.returnState > b.returnState) {
  29653. payloads[0] = b.returnState;
  29654. payloads[1] = a.returnState;
  29655. }
  29656. var parents = [ singleParent, singleParent ];
  29657. var apc = new ArrayPredictionContext(parents, payloads);
  29658. if (mergeCache !== null) {
  29659. mergeCache.set(a, b, apc);
  29660. }
  29661. return apc;
  29662. }
  29663. // parents differ and can't merge them. Just pack together
  29664. // into array; can't merge.
  29665. // ax + by = [ax,by]
  29666. var payloads = [ a.returnState, b.returnState ];
  29667. var parents = [ a.parentCtx, b.parentCtx ];
  29668. if (a.returnState > b.returnState) { // sort by payload
  29669. payloads[0] = b.returnState;
  29670. payloads[1] = a.returnState;
  29671. parents = [ b.parentCtx, a.parentCtx ];
  29672. }
  29673. var a_ = new ArrayPredictionContext(parents, payloads);
  29674. if (mergeCache !== null) {
  29675. mergeCache.set(a, b, a_);
  29676. }
  29677. return a_;
  29678. }
  29679. }
  29680. //
  29681. // Handle case where at least one of {@code a} or {@code b} is
  29682. // {@link //EMPTY}. In the following diagrams, the symbol {@code $} is used
  29683. // to represent {@link //EMPTY}.
  29684. //
  29685. // <h2>Local-Context Merges</h2>
  29686. //
  29687. // <p>These local-context merge operations are used when {@code rootIsWildcard}
  29688. // is true.</p>
  29689. //
  29690. // <p>{@link //EMPTY} is superset of any graph; return {@link //EMPTY}.<br>
  29691. // <embed src="images/LocalMerge_EmptyRoot.svg" type="image/svg+xml"/></p>
  29692. //
  29693. // <p>{@link //EMPTY} and anything is {@code //EMPTY}, so merged parent is
  29694. // {@code //EMPTY}; return left graph.<br>
  29695. // <embed src="images/LocalMerge_EmptyParent.svg" type="image/svg+xml"/></p>
  29696. //
  29697. // <p>Special case of last merge if local context.<br>
  29698. // <embed src="images/LocalMerge_DiffRoots.svg" type="image/svg+xml"/></p>
  29699. //
  29700. // <h2>Full-Context Merges</h2>
  29701. //
  29702. // <p>These full-context merge operations are used when {@code rootIsWildcard}
  29703. // is false.</p>
  29704. //
  29705. // <p><embed src="images/FullMerge_EmptyRoots.svg" type="image/svg+xml"/></p>
  29706. //
  29707. // <p>Must keep all contexts; {@link //EMPTY} in array is a special value (and
  29708. // null parent).<br>
  29709. // <embed src="images/FullMerge_EmptyRoot.svg" type="image/svg+xml"/></p>
  29710. //
  29711. // <p><embed src="images/FullMerge_SameRoot.svg" type="image/svg+xml"/></p>
  29712. //
  29713. // @param a the first {@link SingletonPredictionContext}
  29714. // @param b the second {@link SingletonPredictionContext}
  29715. // @param rootIsWildcard {@code true} if this is a local-context merge,
  29716. // otherwise false to indicate a full-context merge
  29717. // /
  29718. function mergeRoot(a, b, rootIsWildcard) {
  29719. if (rootIsWildcard) {
  29720. if (a === PredictionContext.EMPTY) {
  29721. return PredictionContext.EMPTY; // // + b =//
  29722. }
  29723. if (b === PredictionContext.EMPTY) {
  29724. return PredictionContext.EMPTY; // a +// =//
  29725. }
  29726. } else {
  29727. if (a === PredictionContext.EMPTY && b === PredictionContext.EMPTY) {
  29728. return PredictionContext.EMPTY; // $ + $ = $
  29729. } else if (a === PredictionContext.EMPTY) { // $ + x = [$,x]
  29730. var payloads = [ b.returnState,
  29731. PredictionContext.EMPTY_RETURN_STATE ];
  29732. var parents = [ b.parentCtx, null ];
  29733. return new ArrayPredictionContext(parents, payloads);
  29734. } else if (b === PredictionContext.EMPTY) { // x + $ = [$,x] ($ is always first if present)
  29735. var payloads = [ a.returnState, PredictionContext.EMPTY_RETURN_STATE ];
  29736. var parents = [ a.parentCtx, null ];
  29737. return new ArrayPredictionContext(parents, payloads);
  29738. }
  29739. }
  29740. return null;
  29741. }
  29742. //
  29743. // Merge two {@link ArrayPredictionContext} instances.
  29744. //
  29745. // <p>Different tops, different parents.<br>
  29746. // <embed src="images/ArrayMerge_DiffTopDiffPar.svg" type="image/svg+xml"/></p>
  29747. //
  29748. // <p>Shared top, same parents.<br>
  29749. // <embed src="images/ArrayMerge_ShareTopSamePar.svg" type="image/svg+xml"/></p>
  29750. //
  29751. // <p>Shared top, different parents.<br>
  29752. // <embed src="images/ArrayMerge_ShareTopDiffPar.svg" type="image/svg+xml"/></p>
  29753. //
  29754. // <p>Shared top, all shared parents.<br>
  29755. // <embed src="images/ArrayMerge_ShareTopSharePar.svg"
  29756. // type="image/svg+xml"/></p>
  29757. //
  29758. // <p>Equal tops, merge parents and reduce top to
  29759. // {@link SingletonPredictionContext}.<br>
  29760. // <embed src="images/ArrayMerge_EqualTop.svg" type="image/svg+xml"/></p>
  29761. // /
  29762. function mergeArrays(a, b, rootIsWildcard, mergeCache) {
  29763. if (mergeCache !== null) {
  29764. var previous = mergeCache.get(a, b);
  29765. if (previous !== null) {
  29766. return previous;
  29767. }
  29768. previous = mergeCache.get(b, a);
  29769. if (previous !== null) {
  29770. return previous;
  29771. }
  29772. }
  29773. // merge sorted payloads a + b => M
  29774. var i = 0; // walks a
  29775. var j = 0; // walks b
  29776. var k = 0; // walks target M array
  29777. var mergedReturnStates = [];
  29778. var mergedParents = [];
  29779. // walk and merge to yield mergedParents, mergedReturnStates
  29780. while (i < a.returnStates.length && j < b.returnStates.length) {
  29781. var a_parent = a.parents[i];
  29782. var b_parent = b.parents[j];
  29783. if (a.returnStates[i] === b.returnStates[j]) {
  29784. // same payload (stack tops are equal), must yield merged singleton
  29785. var payload = a.returnStates[i];
  29786. // $+$ = $
  29787. var bothDollars = payload === PredictionContext.EMPTY_RETURN_STATE &&
  29788. a_parent === null && b_parent === null;
  29789. var ax_ax = (a_parent !== null && b_parent !== null && a_parent === b_parent); // ax+ax
  29790. // ->
  29791. // ax
  29792. if (bothDollars || ax_ax) {
  29793. mergedParents[k] = a_parent; // choose left
  29794. mergedReturnStates[k] = payload;
  29795. } else { // ax+ay -> a'[x,y]
  29796. var mergedParent = merge(a_parent, b_parent, rootIsWildcard, mergeCache);
  29797. mergedParents[k] = mergedParent;
  29798. mergedReturnStates[k] = payload;
  29799. }
  29800. i += 1; // hop over left one as usual
  29801. j += 1; // but also skip one in right side since we merge
  29802. } else if (a.returnStates[i] < b.returnStates[j]) { // copy a[i] to M
  29803. mergedParents[k] = a_parent;
  29804. mergedReturnStates[k] = a.returnStates[i];
  29805. i += 1;
  29806. } else { // b > a, copy b[j] to M
  29807. mergedParents[k] = b_parent;
  29808. mergedReturnStates[k] = b.returnStates[j];
  29809. j += 1;
  29810. }
  29811. k += 1;
  29812. }
  29813. // copy over any payloads remaining in either array
  29814. if (i < a.returnStates.length) {
  29815. for (var p = i; p < a.returnStates.length; p++) {
  29816. mergedParents[k] = a.parents[p];
  29817. mergedReturnStates[k] = a.returnStates[p];
  29818. k += 1;
  29819. }
  29820. } else {
  29821. for (var p = j; p < b.returnStates.length; p++) {
  29822. mergedParents[k] = b.parents[p];
  29823. mergedReturnStates[k] = b.returnStates[p];
  29824. k += 1;
  29825. }
  29826. }
  29827. // trim merged if we combined a few that had same stack tops
  29828. if (k < mergedParents.length) { // write index < last position; trim
  29829. if (k === 1) { // for just one merged element, return singleton top
  29830. var a_ = SingletonPredictionContext.create(mergedParents[0],
  29831. mergedReturnStates[0]);
  29832. if (mergeCache !== null) {
  29833. mergeCache.set(a, b, a_);
  29834. }
  29835. return a_;
  29836. }
  29837. mergedParents = mergedParents.slice(0, k);
  29838. mergedReturnStates = mergedReturnStates.slice(0, k);
  29839. }
  29840. var M = new ArrayPredictionContext(mergedParents, mergedReturnStates);
  29841. // if we created same array as a or b, return that instead
  29842. // TODO: track whether this is possible above during merge sort for speed
  29843. if (M === a) {
  29844. if (mergeCache !== null) {
  29845. mergeCache.set(a, b, a);
  29846. }
  29847. return a;
  29848. }
  29849. if (M === b) {
  29850. if (mergeCache !== null) {
  29851. mergeCache.set(a, b, b);
  29852. }
  29853. return b;
  29854. }
  29855. combineCommonParents(mergedParents);
  29856. if (mergeCache !== null) {
  29857. mergeCache.set(a, b, M);
  29858. }
  29859. return M;
  29860. }
  29861. //
  29862. // Make pass over all <em>M</em> {@code parents}; merge any {@code equals()}
  29863. // ones.
  29864. // /
  29865. function combineCommonParents(parents) {
  29866. var uniqueParents = {};
  29867. for (var p = 0; p < parents.length; p++) {
  29868. var parent = parents[p];
  29869. if (!(parent in uniqueParents)) {
  29870. uniqueParents[parent] = parent;
  29871. }
  29872. }
  29873. for (var q = 0; q < parents.length; q++) {
  29874. parents[q] = uniqueParents[parents[q]];
  29875. }
  29876. }
  29877. function getCachedPredictionContext(context, contextCache, visited) {
  29878. if (context.isEmpty()) {
  29879. return context;
  29880. }
  29881. var existing = visited[context] || null;
  29882. if (existing !== null) {
  29883. return existing;
  29884. }
  29885. existing = contextCache.get(context);
  29886. if (existing !== null) {
  29887. visited[context] = existing;
  29888. return existing;
  29889. }
  29890. var changed = false;
  29891. var parents = [];
  29892. for (var i = 0; i < parents.length; i++) {
  29893. var parent = getCachedPredictionContext(context.getParent(i), contextCache, visited);
  29894. if (changed || parent !== context.getParent(i)) {
  29895. if (!changed) {
  29896. parents = [];
  29897. for (var j = 0; j < context.length; j++) {
  29898. parents[j] = context.getParent(j);
  29899. }
  29900. changed = true;
  29901. }
  29902. parents[i] = parent;
  29903. }
  29904. }
  29905. if (!changed) {
  29906. contextCache.add(context);
  29907. visited[context] = context;
  29908. return context;
  29909. }
  29910. var updated = null;
  29911. if (parents.length === 0) {
  29912. updated = PredictionContext.EMPTY;
  29913. } else if (parents.length === 1) {
  29914. updated = SingletonPredictionContext.create(parents[0], context
  29915. .getReturnState(0));
  29916. } else {
  29917. updated = new ArrayPredictionContext(parents, context.returnStates);
  29918. }
  29919. contextCache.add(updated);
  29920. visited[updated] = updated;
  29921. visited[context] = updated;
  29922. return updated;
  29923. }
  29924. // ter's recursive version of Sam's getAllNodes()
  29925. function getAllContextNodes(context, nodes, visited) {
  29926. if (nodes === null) {
  29927. nodes = [];
  29928. return getAllContextNodes(context, nodes, visited);
  29929. } else if (visited === null) {
  29930. visited = {};
  29931. return getAllContextNodes(context, nodes, visited);
  29932. } else {
  29933. if (context === null || visited[context] !== null) {
  29934. return nodes;
  29935. }
  29936. visited[context] = context;
  29937. nodes.push(context);
  29938. for (var i = 0; i < context.length; i++) {
  29939. getAllContextNodes(context.getParent(i), nodes, visited);
  29940. }
  29941. return nodes;
  29942. }
  29943. }
  29944. exports.merge = merge;
  29945. exports.PredictionContext = PredictionContext;
  29946. exports.PredictionContextCache = PredictionContextCache;
  29947. exports.SingletonPredictionContext = SingletonPredictionContext;
  29948. exports.predictionContextFromRuleContext = predictionContextFromRuleContext;
  29949. exports.getCachedPredictionContext = getCachedPredictionContext;
  29950. /***/ }),
  29951. /***/ "./node_modules/antlr4/Recognizer.js":
  29952. /*!*******************************************!*\
  29953. !*** ./node_modules/antlr4/Recognizer.js ***!
  29954. \*******************************************/
  29955. /*! no static exports found */
  29956. /***/ (function(module, exports, __webpack_require__) {
  29957. //
  29958. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  29959. * Use of this file is governed by the BSD 3-clause license that
  29960. * can be found in the LICENSE.txt file in the project root.
  29961. */
  29962. //
  29963. var Token = __webpack_require__(/*! ./Token */ "./node_modules/antlr4/Token.js").Token;
  29964. var ConsoleErrorListener = __webpack_require__(/*! ./error/ErrorListener */ "./node_modules/antlr4/error/ErrorListener.js").ConsoleErrorListener;
  29965. var ProxyErrorListener = __webpack_require__(/*! ./error/ErrorListener */ "./node_modules/antlr4/error/ErrorListener.js").ProxyErrorListener;
  29966. function Recognizer() {
  29967. this._listeners = [ ConsoleErrorListener.INSTANCE ];
  29968. this._interp = null;
  29969. this._stateNumber = -1;
  29970. return this;
  29971. }
  29972. Recognizer.tokenTypeMapCache = {};
  29973. Recognizer.ruleIndexMapCache = {};
  29974. Recognizer.prototype.checkVersion = function(toolVersion) {
  29975. var runtimeVersion = "4.7.1";
  29976. if (runtimeVersion!==toolVersion) {
  29977. console.log("ANTLR runtime and generated code versions disagree: "+runtimeVersion+"!="+toolVersion);
  29978. }
  29979. };
  29980. Recognizer.prototype.addErrorListener = function(listener) {
  29981. this._listeners.push(listener);
  29982. };
  29983. Recognizer.prototype.removeErrorListeners = function() {
  29984. this._listeners = [];
  29985. };
  29986. Recognizer.prototype.getTokenTypeMap = function() {
  29987. var tokenNames = this.getTokenNames();
  29988. if (tokenNames===null) {
  29989. throw("The current recognizer does not provide a list of token names.");
  29990. }
  29991. var result = this.tokenTypeMapCache[tokenNames];
  29992. if(result===undefined) {
  29993. result = tokenNames.reduce(function(o, k, i) { o[k] = i; });
  29994. result.EOF = Token.EOF;
  29995. this.tokenTypeMapCache[tokenNames] = result;
  29996. }
  29997. return result;
  29998. };
  29999. // Get a map from rule names to rule indexes.
  30000. //
  30001. // <p>Used for XPath and tree pattern compilation.</p>
  30002. //
  30003. Recognizer.prototype.getRuleIndexMap = function() {
  30004. var ruleNames = this.ruleNames;
  30005. if (ruleNames===null) {
  30006. throw("The current recognizer does not provide a list of rule names.");
  30007. }
  30008. var result = this.ruleIndexMapCache[ruleNames];
  30009. if(result===undefined) {
  30010. result = ruleNames.reduce(function(o, k, i) { o[k] = i; });
  30011. this.ruleIndexMapCache[ruleNames] = result;
  30012. }
  30013. return result;
  30014. };
  30015. Recognizer.prototype.getTokenType = function(tokenName) {
  30016. var ttype = this.getTokenTypeMap()[tokenName];
  30017. if (ttype !==undefined) {
  30018. return ttype;
  30019. } else {
  30020. return Token.INVALID_TYPE;
  30021. }
  30022. };
  30023. // What is the error header, normally line/character position information?//
  30024. Recognizer.prototype.getErrorHeader = function(e) {
  30025. var line = e.getOffendingToken().line;
  30026. var column = e.getOffendingToken().column;
  30027. return "line " + line + ":" + column;
  30028. };
  30029. // How should a token be displayed in an error message? The default
  30030. // is to display just the text, but during development you might
  30031. // want to have a lot of information spit out. Override in that case
  30032. // to use t.toString() (which, for CommonToken, dumps everything about
  30033. // the token). This is better than forcing you to override a method in
  30034. // your token objects because you don't have to go modify your lexer
  30035. // so that it creates a new Java type.
  30036. //
  30037. // @deprecated This method is not called by the ANTLR 4 Runtime. Specific
  30038. // implementations of {@link ANTLRErrorStrategy} may provide a similar
  30039. // feature when necessary. For example, see
  30040. // {@link DefaultErrorStrategy//getTokenErrorDisplay}.
  30041. //
  30042. Recognizer.prototype.getTokenErrorDisplay = function(t) {
  30043. if (t===null) {
  30044. return "<no token>";
  30045. }
  30046. var s = t.text;
  30047. if (s===null) {
  30048. if (t.type===Token.EOF) {
  30049. s = "<EOF>";
  30050. } else {
  30051. s = "<" + t.type + ">";
  30052. }
  30053. }
  30054. s = s.replace("\n","\\n").replace("\r","\\r").replace("\t","\\t");
  30055. return "'" + s + "'";
  30056. };
  30057. Recognizer.prototype.getErrorListenerDispatch = function() {
  30058. return new ProxyErrorListener(this._listeners);
  30059. };
  30060. // subclass needs to override these if there are sempreds or actions
  30061. // that the ATN interp needs to execute
  30062. Recognizer.prototype.sempred = function(localctx, ruleIndex, actionIndex) {
  30063. return true;
  30064. };
  30065. Recognizer.prototype.precpred = function(localctx , precedence) {
  30066. return true;
  30067. };
  30068. //Indicate that the recognizer has changed internal state that is
  30069. //consistent with the ATN state passed in. This way we always know
  30070. //where we are in the ATN as the parser goes along. The rule
  30071. //context objects form a stack that lets us see the stack of
  30072. //invoking rules. Combine this and we have complete ATN
  30073. //configuration information.
  30074. Object.defineProperty(Recognizer.prototype, "state", {
  30075. get : function() {
  30076. return this._stateNumber;
  30077. },
  30078. set : function(state) {
  30079. this._stateNumber = state;
  30080. }
  30081. });
  30082. exports.Recognizer = Recognizer;
  30083. /***/ }),
  30084. /***/ "./node_modules/antlr4/RuleContext.js":
  30085. /*!********************************************!*\
  30086. !*** ./node_modules/antlr4/RuleContext.js ***!
  30087. \********************************************/
  30088. /*! no static exports found */
  30089. /***/ (function(module, exports, __webpack_require__) {
  30090. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  30091. * Use of this file is governed by the BSD 3-clause license that
  30092. * can be found in the LICENSE.txt file in the project root.
  30093. */
  30094. ///
  30095. // A rule context is a record of a single rule invocation. It knows
  30096. // which context invoked it, if any. If there is no parent context, then
  30097. // naturally the invoking state is not valid. The parent link
  30098. // provides a chain upwards from the current rule invocation to the root
  30099. // of the invocation tree, forming a stack. We actually carry no
  30100. // information about the rule associated with this context (except
  30101. // when parsing). We keep only the state number of the invoking state from
  30102. // the ATN submachine that invoked this. Contrast this with the s
  30103. // pointer inside ParserRuleContext that tracks the current state
  30104. // being "executed" for the current rule.
  30105. //
  30106. // The parent contexts are useful for computing lookahead sets and
  30107. // getting error information.
  30108. //
  30109. // These objects are used during parsing and prediction.
  30110. // For the special case of parsers, we use the subclass
  30111. // ParserRuleContext.
  30112. //
  30113. // @see ParserRuleContext
  30114. ///
  30115. var RuleNode = __webpack_require__(/*! ./tree/Tree */ "./node_modules/antlr4/tree/Tree.js").RuleNode;
  30116. var INVALID_INTERVAL = __webpack_require__(/*! ./tree/Tree */ "./node_modules/antlr4/tree/Tree.js").INVALID_INTERVAL;
  30117. var INVALID_ALT_NUMBER = __webpack_require__(/*! ./atn/ATN */ "./node_modules/antlr4/atn/ATN.js").INVALID_ALT_NUMBER;
  30118. function RuleContext(parent, invokingState) {
  30119. RuleNode.call(this);
  30120. // What context invoked this rule?
  30121. this.parentCtx = parent || null;
  30122. // What state invoked the rule associated with this context?
  30123. // The "return address" is the followState of invokingState
  30124. // If parent is null, this should be -1.
  30125. this.invokingState = invokingState || -1;
  30126. return this;
  30127. }
  30128. RuleContext.prototype = Object.create(RuleNode.prototype);
  30129. RuleContext.prototype.constructor = RuleContext;
  30130. RuleContext.prototype.depth = function() {
  30131. var n = 0;
  30132. var p = this;
  30133. while (p !== null) {
  30134. p = p.parentCtx;
  30135. n += 1;
  30136. }
  30137. return n;
  30138. };
  30139. // A context is empty if there is no invoking state; meaning nobody call
  30140. // current context.
  30141. RuleContext.prototype.isEmpty = function() {
  30142. return this.invokingState === -1;
  30143. };
  30144. // satisfy the ParseTree / SyntaxTree interface
  30145. RuleContext.prototype.getSourceInterval = function() {
  30146. return INVALID_INTERVAL;
  30147. };
  30148. RuleContext.prototype.getRuleContext = function() {
  30149. return this;
  30150. };
  30151. RuleContext.prototype.getPayload = function() {
  30152. return this;
  30153. };
  30154. // Return the combined text of all child nodes. This method only considers
  30155. // tokens which have been added to the parse tree.
  30156. // <p>
  30157. // Since tokens on hidden channels (e.g. whitespace or comments) are not
  30158. // added to the parse trees, they will not appear in the output of this
  30159. // method.
  30160. // /
  30161. RuleContext.prototype.getText = function() {
  30162. if (this.getChildCount() === 0) {
  30163. return "";
  30164. } else {
  30165. return this.children.map(function(child) {
  30166. return child.getText();
  30167. }).join("");
  30168. }
  30169. };
  30170. // For rule associated with this parse tree internal node, return
  30171. // the outer alternative number used to match the input. Default
  30172. // implementation does not compute nor store this alt num. Create
  30173. // a subclass of ParserRuleContext with backing field and set
  30174. // option contextSuperClass.
  30175. // to set it.
  30176. RuleContext.prototype.getAltNumber = function() { return INVALID_ALT_NUMBER; }
  30177. // Set the outer alternative number for this context node. Default
  30178. // implementation does nothing to avoid backing field overhead for
  30179. // trees that don't need it. Create
  30180. // a subclass of ParserRuleContext with backing field and set
  30181. // option contextSuperClass.
  30182. RuleContext.prototype.setAltNumber = function(altNumber) { }
  30183. RuleContext.prototype.getChild = function(i) {
  30184. return null;
  30185. };
  30186. RuleContext.prototype.getChildCount = function() {
  30187. return 0;
  30188. };
  30189. RuleContext.prototype.accept = function(visitor) {
  30190. return visitor.visitChildren(this);
  30191. };
  30192. //need to manage circular dependencies, so export now
  30193. exports.RuleContext = RuleContext;
  30194. var Trees = __webpack_require__(/*! ./tree/Trees */ "./node_modules/antlr4/tree/Trees.js").Trees;
  30195. // Print out a whole tree, not just a node, in LISP format
  30196. // (root child1 .. childN). Print just a node if this is a leaf.
  30197. //
  30198. RuleContext.prototype.toStringTree = function(ruleNames, recog) {
  30199. return Trees.toStringTree(this, ruleNames, recog);
  30200. };
  30201. RuleContext.prototype.toString = function(ruleNames, stop) {
  30202. ruleNames = ruleNames || null;
  30203. stop = stop || null;
  30204. var p = this;
  30205. var s = "[";
  30206. while (p !== null && p !== stop) {
  30207. if (ruleNames === null) {
  30208. if (!p.isEmpty()) {
  30209. s += p.invokingState;
  30210. }
  30211. } else {
  30212. var ri = p.ruleIndex;
  30213. var ruleName = (ri >= 0 && ri < ruleNames.length) ? ruleNames[ri]
  30214. : "" + ri;
  30215. s += ruleName;
  30216. }
  30217. if (p.parentCtx !== null && (ruleNames !== null || !p.parentCtx.isEmpty())) {
  30218. s += " ";
  30219. }
  30220. p = p.parentCtx;
  30221. }
  30222. s += "]";
  30223. return s;
  30224. };
  30225. /***/ }),
  30226. /***/ "./node_modules/antlr4/Token.js":
  30227. /*!**************************************!*\
  30228. !*** ./node_modules/antlr4/Token.js ***!
  30229. \**************************************/
  30230. /*! no static exports found */
  30231. /***/ (function(module, exports) {
  30232. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  30233. * Use of this file is governed by the BSD 3-clause license that
  30234. * can be found in the LICENSE.txt file in the project root.
  30235. */
  30236. //
  30237. // A token has properties: text, type, line, character position in the line
  30238. // (so we can ignore tabs), token channel, index, and source from which
  30239. // we obtained this token.
  30240. function Token() {
  30241. this.source = null;
  30242. this.type = null; // token type of the token
  30243. this.channel = null; // The parser ignores everything not on DEFAULT_CHANNEL
  30244. this.start = null; // optional; return -1 if not implemented.
  30245. this.stop = null; // optional; return -1 if not implemented.
  30246. this.tokenIndex = null; // from 0..n-1 of the token object in the input stream
  30247. this.line = null; // line=1..n of the 1st character
  30248. this.column = null; // beginning of the line at which it occurs, 0..n-1
  30249. this._text = null; // text of the token.
  30250. return this;
  30251. }
  30252. Token.INVALID_TYPE = 0;
  30253. // During lookahead operations, this "token" signifies we hit rule end ATN state
  30254. // and did not follow it despite needing to.
  30255. Token.EPSILON = -2;
  30256. Token.MIN_USER_TOKEN_TYPE = 1;
  30257. Token.EOF = -1;
  30258. // All tokens go to the parser (unless skip() is called in that rule)
  30259. // on a particular "channel". The parser tunes to a particular channel
  30260. // so that whitespace etc... can go to the parser on a "hidden" channel.
  30261. Token.DEFAULT_CHANNEL = 0;
  30262. // Anything on different channel than DEFAULT_CHANNEL is not parsed
  30263. // by parser.
  30264. Token.HIDDEN_CHANNEL = 1;
  30265. // Explicitly set the text for this token. If {code text} is not
  30266. // {@code null}, then {@link //getText} will return this value rather than
  30267. // extracting the text from the input.
  30268. //
  30269. // @param text The explicit text of the token, or {@code null} if the text
  30270. // should be obtained from the input along with the start and stop indexes
  30271. // of the token.
  30272. Object.defineProperty(Token.prototype, "text", {
  30273. get : function() {
  30274. return this._text;
  30275. },
  30276. set : function(text) {
  30277. this._text = text;
  30278. }
  30279. });
  30280. Token.prototype.getTokenSource = function() {
  30281. return this.source[0];
  30282. };
  30283. Token.prototype.getInputStream = function() {
  30284. return this.source[1];
  30285. };
  30286. function CommonToken(source, type, channel, start, stop) {
  30287. Token.call(this);
  30288. this.source = source !== undefined ? source : CommonToken.EMPTY_SOURCE;
  30289. this.type = type !== undefined ? type : null;
  30290. this.channel = channel !== undefined ? channel : Token.DEFAULT_CHANNEL;
  30291. this.start = start !== undefined ? start : -1;
  30292. this.stop = stop !== undefined ? stop : -1;
  30293. this.tokenIndex = -1;
  30294. if (this.source[0] !== null) {
  30295. this.line = source[0].line;
  30296. this.column = source[0].column;
  30297. } else {
  30298. this.column = -1;
  30299. }
  30300. return this;
  30301. }
  30302. CommonToken.prototype = Object.create(Token.prototype);
  30303. CommonToken.prototype.constructor = CommonToken;
  30304. // An empty {@link Pair} which is used as the default value of
  30305. // {@link //source} for tokens that do not have a source.
  30306. CommonToken.EMPTY_SOURCE = [ null, null ];
  30307. // Constructs a new {@link CommonToken} as a copy of another {@link Token}.
  30308. //
  30309. // <p>
  30310. // If {@code oldToken} is also a {@link CommonToken} instance, the newly
  30311. // constructed token will share a reference to the {@link //text} field and
  30312. // the {@link Pair} stored in {@link //source}. Otherwise, {@link //text} will
  30313. // be assigned the result of calling {@link //getText}, and {@link //source}
  30314. // will be constructed from the result of {@link Token//getTokenSource} and
  30315. // {@link Token//getInputStream}.</p>
  30316. //
  30317. // @param oldToken The token to copy.
  30318. //
  30319. CommonToken.prototype.clone = function() {
  30320. var t = new CommonToken(this.source, this.type, this.channel, this.start,
  30321. this.stop);
  30322. t.tokenIndex = this.tokenIndex;
  30323. t.line = this.line;
  30324. t.column = this.column;
  30325. t.text = this.text;
  30326. return t;
  30327. };
  30328. Object.defineProperty(CommonToken.prototype, "text", {
  30329. get : function() {
  30330. if (this._text !== null) {
  30331. return this._text;
  30332. }
  30333. var input = this.getInputStream();
  30334. if (input === null) {
  30335. return null;
  30336. }
  30337. var n = input.size;
  30338. if (this.start < n && this.stop < n) {
  30339. return input.getText(this.start, this.stop);
  30340. } else {
  30341. return "<EOF>";
  30342. }
  30343. },
  30344. set : function(text) {
  30345. this._text = text;
  30346. }
  30347. });
  30348. CommonToken.prototype.toString = function() {
  30349. var txt = this.text;
  30350. if (txt !== null) {
  30351. txt = txt.replace(/\n/g, "\\n").replace(/\r/g, "\\r").replace(/\t/g, "\\t");
  30352. } else {
  30353. txt = "<no text>";
  30354. }
  30355. return "[@" + this.tokenIndex + "," + this.start + ":" + this.stop + "='" +
  30356. txt + "',<" + this.type + ">" +
  30357. (this.channel > 0 ? ",channel=" + this.channel : "") + "," +
  30358. this.line + ":" + this.column + "]";
  30359. };
  30360. exports.Token = Token;
  30361. exports.CommonToken = CommonToken;
  30362. /***/ }),
  30363. /***/ "./node_modules/antlr4/Utils.js":
  30364. /*!**************************************!*\
  30365. !*** ./node_modules/antlr4/Utils.js ***!
  30366. \**************************************/
  30367. /*! no static exports found */
  30368. /***/ (function(module, exports) {
  30369. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  30370. * Use of this file is governed by the BSD 3-clause license that
  30371. * can be found in the LICENSE.txt file in the project root.
  30372. */
  30373. function arrayToString(a) {
  30374. return "[" + a.join(", ") + "]";
  30375. }
  30376. String.prototype.seed = String.prototype.seed || Math.round(Math.random() * Math.pow(2, 32));
  30377. String.prototype.hashCode = function () {
  30378. var remainder, bytes, h1, h1b, c1, c1b, c2, c2b, k1, i,
  30379. key = this.toString();
  30380. remainder = key.length & 3; // key.length % 4
  30381. bytes = key.length - remainder;
  30382. h1 = String.prototype.seed;
  30383. c1 = 0xcc9e2d51;
  30384. c2 = 0x1b873593;
  30385. i = 0;
  30386. while (i < bytes) {
  30387. k1 =
  30388. ((key.charCodeAt(i) & 0xff)) |
  30389. ((key.charCodeAt(++i) & 0xff) << 8) |
  30390. ((key.charCodeAt(++i) & 0xff) << 16) |
  30391. ((key.charCodeAt(++i) & 0xff) << 24);
  30392. ++i;
  30393. k1 = ((((k1 & 0xffff) * c1) + ((((k1 >>> 16) * c1) & 0xffff) << 16))) & 0xffffffff;
  30394. k1 = (k1 << 15) | (k1 >>> 17);
  30395. k1 = ((((k1 & 0xffff) * c2) + ((((k1 >>> 16) * c2) & 0xffff) << 16))) & 0xffffffff;
  30396. h1 ^= k1;
  30397. h1 = (h1 << 13) | (h1 >>> 19);
  30398. h1b = ((((h1 & 0xffff) * 5) + ((((h1 >>> 16) * 5) & 0xffff) << 16))) & 0xffffffff;
  30399. h1 = (((h1b & 0xffff) + 0x6b64) + ((((h1b >>> 16) + 0xe654) & 0xffff) << 16));
  30400. }
  30401. k1 = 0;
  30402. switch (remainder) {
  30403. case 3:
  30404. k1 ^= (key.charCodeAt(i + 2) & 0xff) << 16;
  30405. case 2:
  30406. k1 ^= (key.charCodeAt(i + 1) & 0xff) << 8;
  30407. case 1:
  30408. k1 ^= (key.charCodeAt(i) & 0xff);
  30409. k1 = (((k1 & 0xffff) * c1) + ((((k1 >>> 16) * c1) & 0xffff) << 16)) & 0xffffffff;
  30410. k1 = (k1 << 15) | (k1 >>> 17);
  30411. k1 = (((k1 & 0xffff) * c2) + ((((k1 >>> 16) * c2) & 0xffff) << 16)) & 0xffffffff;
  30412. h1 ^= k1;
  30413. }
  30414. h1 ^= key.length;
  30415. h1 ^= h1 >>> 16;
  30416. h1 = (((h1 & 0xffff) * 0x85ebca6b) + ((((h1 >>> 16) * 0x85ebca6b) & 0xffff) << 16)) & 0xffffffff;
  30417. h1 ^= h1 >>> 13;
  30418. h1 = ((((h1 & 0xffff) * 0xc2b2ae35) + ((((h1 >>> 16) * 0xc2b2ae35) & 0xffff) << 16))) & 0xffffffff;
  30419. h1 ^= h1 >>> 16;
  30420. return h1 >>> 0;
  30421. };
  30422. function standardEqualsFunction(a, b) {
  30423. return a.equals(b);
  30424. }
  30425. function standardHashCodeFunction(a) {
  30426. return a.hashCode();
  30427. }
  30428. function Set(hashFunction, equalsFunction) {
  30429. this.data = {};
  30430. this.hashFunction = hashFunction || standardHashCodeFunction;
  30431. this.equalsFunction = equalsFunction || standardEqualsFunction;
  30432. return this;
  30433. }
  30434. Object.defineProperty(Set.prototype, "length", {
  30435. get: function () {
  30436. var l = 0;
  30437. for (var key in this.data) {
  30438. if (key.indexOf("hash_") === 0) {
  30439. l = l + this.data[key].length;
  30440. }
  30441. }
  30442. return l;
  30443. }
  30444. });
  30445. Set.prototype.add = function (value) {
  30446. var hash = this.hashFunction(value);
  30447. var key = "hash_" + hash;
  30448. if (key in this.data) {
  30449. var values = this.data[key];
  30450. for (var i = 0; i < values.length; i++) {
  30451. if (this.equalsFunction(value, values[i])) {
  30452. return values[i];
  30453. }
  30454. }
  30455. values.push(value);
  30456. return value;
  30457. } else {
  30458. this.data[key] = [value];
  30459. return value;
  30460. }
  30461. };
  30462. Set.prototype.contains = function (value) {
  30463. return this.get(value) != null;
  30464. };
  30465. Set.prototype.get = function (value) {
  30466. var hash = this.hashFunction(value);
  30467. var key = "hash_" + hash;
  30468. if (key in this.data) {
  30469. var values = this.data[key];
  30470. for (var i = 0; i < values.length; i++) {
  30471. if (this.equalsFunction(value, values[i])) {
  30472. return values[i];
  30473. }
  30474. }
  30475. }
  30476. return null;
  30477. };
  30478. Set.prototype.values = function () {
  30479. var l = [];
  30480. for (var key in this.data) {
  30481. if (key.indexOf("hash_") === 0) {
  30482. l = l.concat(this.data[key]);
  30483. }
  30484. }
  30485. return l;
  30486. };
  30487. Set.prototype.toString = function () {
  30488. return arrayToString(this.values());
  30489. };
  30490. function BitSet() {
  30491. this.data = [];
  30492. return this;
  30493. }
  30494. BitSet.prototype.add = function (value) {
  30495. this.data[value] = true;
  30496. };
  30497. BitSet.prototype.or = function (set) {
  30498. var bits = this;
  30499. Object.keys(set.data).map(function (alt) {
  30500. bits.add(alt);
  30501. });
  30502. };
  30503. BitSet.prototype.remove = function (value) {
  30504. delete this.data[value];
  30505. };
  30506. BitSet.prototype.contains = function (value) {
  30507. return this.data[value] === true;
  30508. };
  30509. BitSet.prototype.values = function () {
  30510. return Object.keys(this.data);
  30511. };
  30512. BitSet.prototype.minValue = function () {
  30513. return Math.min.apply(null, this.values());
  30514. };
  30515. BitSet.prototype.hashCode = function () {
  30516. var hash = new Hash();
  30517. hash.update(this.values());
  30518. return hash.finish();
  30519. };
  30520. BitSet.prototype.equals = function (other) {
  30521. if (!(other instanceof BitSet)) {
  30522. return false;
  30523. }
  30524. return this.hashCode() === other.hashCode();
  30525. };
  30526. Object.defineProperty(BitSet.prototype, "length", {
  30527. get: function () {
  30528. return this.values().length;
  30529. }
  30530. });
  30531. BitSet.prototype.toString = function () {
  30532. return "{" + this.values().join(", ") + "}";
  30533. };
  30534. function Map(hashFunction, equalsFunction) {
  30535. this.data = {};
  30536. this.hashFunction = hashFunction || standardHashCodeFunction;
  30537. this.equalsFunction = equalsFunction || standardEqualsFunction;
  30538. return this;
  30539. }
  30540. Object.defineProperty(Map.prototype, "length", {
  30541. get: function () {
  30542. var l = 0;
  30543. for (var hashKey in this.data) {
  30544. if (hashKey.indexOf("hash_") === 0) {
  30545. l = l + this.data[hashKey].length;
  30546. }
  30547. }
  30548. return l;
  30549. }
  30550. });
  30551. Map.prototype.put = function (key, value) {
  30552. var hashKey = "hash_" + this.hashFunction(key);
  30553. if (hashKey in this.data) {
  30554. var entries = this.data[hashKey];
  30555. for (var i = 0; i < entries.length; i++) {
  30556. var entry = entries[i];
  30557. if (this.equalsFunction(key, entry.key)) {
  30558. var oldValue = entry.value;
  30559. entry.value = value;
  30560. return oldValue;
  30561. }
  30562. }
  30563. entries.push({key:key, value:value});
  30564. return value;
  30565. } else {
  30566. this.data[hashKey] = [{key:key, value:value}];
  30567. return value;
  30568. }
  30569. };
  30570. Map.prototype.containsKey = function (key) {
  30571. var hashKey = "hash_" + this.hashFunction(key);
  30572. if(hashKey in this.data) {
  30573. var entries = this.data[hashKey];
  30574. for (var i = 0; i < entries.length; i++) {
  30575. var entry = entries[i];
  30576. if (this.equalsFunction(key, entry.key))
  30577. return true;
  30578. }
  30579. }
  30580. return false;
  30581. };
  30582. Map.prototype.get = function (key) {
  30583. var hashKey = "hash_" + this.hashFunction(key);
  30584. if(hashKey in this.data) {
  30585. var entries = this.data[hashKey];
  30586. for (var i = 0; i < entries.length; i++) {
  30587. var entry = entries[i];
  30588. if (this.equalsFunction(key, entry.key))
  30589. return entry.value;
  30590. }
  30591. }
  30592. return null;
  30593. };
  30594. Map.prototype.entries = function () {
  30595. var l = [];
  30596. for (var key in this.data) {
  30597. if (key.indexOf("hash_") === 0) {
  30598. l = l.concat(this.data[key]);
  30599. }
  30600. }
  30601. return l;
  30602. };
  30603. Map.prototype.getKeys = function () {
  30604. return this.entries().map(function(e) {
  30605. return e.key;
  30606. });
  30607. };
  30608. Map.prototype.getValues = function () {
  30609. return this.entries().map(function(e) {
  30610. return e.value;
  30611. });
  30612. };
  30613. Map.prototype.toString = function () {
  30614. var ss = this.entries().map(function(entry) {
  30615. return '{' + entry.key + ':' + entry.value + '}';
  30616. });
  30617. return '[' + ss.join(", ") + ']';
  30618. };
  30619. function AltDict() {
  30620. this.data = {};
  30621. return this;
  30622. }
  30623. AltDict.prototype.get = function (key) {
  30624. key = "k-" + key;
  30625. if (key in this.data) {
  30626. return this.data[key];
  30627. } else {
  30628. return null;
  30629. }
  30630. };
  30631. AltDict.prototype.put = function (key, value) {
  30632. key = "k-" + key;
  30633. this.data[key] = value;
  30634. };
  30635. AltDict.prototype.values = function () {
  30636. var data = this.data;
  30637. var keys = Object.keys(this.data);
  30638. return keys.map(function (key) {
  30639. return data[key];
  30640. });
  30641. };
  30642. function DoubleDict() {
  30643. return this;
  30644. }
  30645. function Hash() {
  30646. this.count = 0;
  30647. this.hash = 0;
  30648. return this;
  30649. }
  30650. Hash.prototype.update = function () {
  30651. for(var i=0;i<arguments.length;i++) {
  30652. var value = arguments[i];
  30653. if (value == null)
  30654. continue;
  30655. if(Array.isArray(value))
  30656. this.update.apply(value);
  30657. else {
  30658. var k = 0;
  30659. switch (typeof(value)) {
  30660. case 'undefined':
  30661. case 'function':
  30662. continue;
  30663. case 'number':
  30664. case 'boolean':
  30665. k = value;
  30666. break;
  30667. case 'string':
  30668. k = value.hashCode();
  30669. break;
  30670. default:
  30671. value.updateHashCode(this);
  30672. continue;
  30673. }
  30674. k = k * 0xCC9E2D51;
  30675. k = (k << 15) | (k >>> (32 - 15));
  30676. k = k * 0x1B873593;
  30677. this.count = this.count + 1;
  30678. var hash = this.hash ^ k;
  30679. hash = (hash << 13) | (hash >>> (32 - 13));
  30680. hash = hash * 5 + 0xE6546B64;
  30681. this.hash = hash;
  30682. }
  30683. }
  30684. }
  30685. Hash.prototype.finish = function () {
  30686. var hash = this.hash ^ (this.count * 4);
  30687. hash = hash ^ (hash >>> 16);
  30688. hash = hash * 0x85EBCA6B;
  30689. hash = hash ^ (hash >>> 13);
  30690. hash = hash * 0xC2B2AE35;
  30691. hash = hash ^ (hash >>> 16);
  30692. return hash;
  30693. }
  30694. function hashStuff() {
  30695. var hash = new Hash();
  30696. hash.update.apply(arguments);
  30697. return hash.finish();
  30698. }
  30699. DoubleDict.prototype.get = function (a, b) {
  30700. var d = this[a] || null;
  30701. return d === null ? null : (d[b] || null);
  30702. };
  30703. DoubleDict.prototype.set = function (a, b, o) {
  30704. var d = this[a] || null;
  30705. if (d === null) {
  30706. d = {};
  30707. this[a] = d;
  30708. }
  30709. d[b] = o;
  30710. };
  30711. function escapeWhitespace(s, escapeSpaces) {
  30712. s = s.replace(/\t/g, "\\t")
  30713. .replace(/\n/g, "\\n")
  30714. .replace(/\r/g, "\\r");
  30715. if (escapeSpaces) {
  30716. s = s.replace(/ /g, "\u00B7");
  30717. }
  30718. return s;
  30719. }
  30720. function titleCase(str) {
  30721. return str.replace(/\w\S*/g, function (txt) {
  30722. return txt.charAt(0).toUpperCase() + txt.substr(1);
  30723. });
  30724. };
  30725. function equalArrays(a, b)
  30726. {
  30727. if (!Array.isArray(a) || !Array.isArray(b))
  30728. return false;
  30729. if (a == b)
  30730. return true;
  30731. if (a.length != b.length)
  30732. return false;
  30733. for (var i = 0; i < a.length; i++) {
  30734. if (a[i] == b[i])
  30735. continue;
  30736. if (!a[i].equals(b[i]))
  30737. return false;
  30738. }
  30739. return true;
  30740. };
  30741. exports.Hash = Hash;
  30742. exports.Set = Set;
  30743. exports.Map = Map;
  30744. exports.BitSet = BitSet;
  30745. exports.AltDict = AltDict;
  30746. exports.DoubleDict = DoubleDict;
  30747. exports.hashStuff = hashStuff;
  30748. exports.escapeWhitespace = escapeWhitespace;
  30749. exports.arrayToString = arrayToString;
  30750. exports.titleCase = titleCase;
  30751. exports.equalArrays = equalArrays;
  30752. /***/ }),
  30753. /***/ "./node_modules/antlr4/atn/ATN.js":
  30754. /*!****************************************!*\
  30755. !*** ./node_modules/antlr4/atn/ATN.js ***!
  30756. \****************************************/
  30757. /*! no static exports found */
  30758. /***/ (function(module, exports, __webpack_require__) {
  30759. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  30760. * Use of this file is governed by the BSD 3-clause license that
  30761. * can be found in the LICENSE.txt file in the project root.
  30762. */
  30763. var LL1Analyzer = __webpack_require__(/*! ./../LL1Analyzer */ "./node_modules/antlr4/LL1Analyzer.js").LL1Analyzer;
  30764. var IntervalSet = __webpack_require__(/*! ./../IntervalSet */ "./node_modules/antlr4/IntervalSet.js").IntervalSet;
  30765. function ATN(grammarType , maxTokenType) {
  30766. // Used for runtime deserialization of ATNs from strings///
  30767. // The type of the ATN.
  30768. this.grammarType = grammarType;
  30769. // The maximum value for any symbol recognized by a transition in the ATN.
  30770. this.maxTokenType = maxTokenType;
  30771. this.states = [];
  30772. // Each subrule/rule is a decision point and we must track them so we
  30773. // can go back later and build DFA predictors for them. This includes
  30774. // all the rules, subrules, optional blocks, ()+, ()* etc...
  30775. this.decisionToState = [];
  30776. // Maps from rule index to starting state number.
  30777. this.ruleToStartState = [];
  30778. // Maps from rule index to stop state number.
  30779. this.ruleToStopState = null;
  30780. this.modeNameToStartState = {};
  30781. // For lexer ATNs, this maps the rule index to the resulting token type.
  30782. // For parser ATNs, this maps the rule index to the generated bypass token
  30783. // type if the
  30784. // {@link ATNDeserializationOptions//isGenerateRuleBypassTransitions}
  30785. // deserialization option was specified; otherwise, this is {@code null}.
  30786. this.ruleToTokenType = null;
  30787. // For lexer ATNs, this is an array of {@link LexerAction} objects which may
  30788. // be referenced by action transitions in the ATN.
  30789. this.lexerActions = null;
  30790. this.modeToStartState = [];
  30791. return this;
  30792. }
  30793. // Compute the set of valid tokens that can occur starting in state {@code s}.
  30794. // If {@code ctx} is null, the set of tokens will not include what can follow
  30795. // the rule surrounding {@code s}. In other words, the set will be
  30796. // restricted to tokens reachable staying within {@code s}'s rule.
  30797. ATN.prototype.nextTokensInContext = function(s, ctx) {
  30798. var anal = new LL1Analyzer(this);
  30799. return anal.LOOK(s, null, ctx);
  30800. };
  30801. // Compute the set of valid tokens that can occur starting in {@code s} and
  30802. // staying in same rule. {@link Token//EPSILON} is in set if we reach end of
  30803. // rule.
  30804. ATN.prototype.nextTokensNoContext = function(s) {
  30805. if (s.nextTokenWithinRule !== null ) {
  30806. return s.nextTokenWithinRule;
  30807. }
  30808. s.nextTokenWithinRule = this.nextTokensInContext(s, null);
  30809. s.nextTokenWithinRule.readOnly = true;
  30810. return s.nextTokenWithinRule;
  30811. };
  30812. ATN.prototype.nextTokens = function(s, ctx) {
  30813. if ( ctx===undefined ) {
  30814. return this.nextTokensNoContext(s);
  30815. } else {
  30816. return this.nextTokensInContext(s, ctx);
  30817. }
  30818. };
  30819. ATN.prototype.addState = function( state) {
  30820. if ( state !== null ) {
  30821. state.atn = this;
  30822. state.stateNumber = this.states.length;
  30823. }
  30824. this.states.push(state);
  30825. };
  30826. ATN.prototype.removeState = function( state) {
  30827. this.states[state.stateNumber] = null; // just free mem, don't shift states in list
  30828. };
  30829. ATN.prototype.defineDecisionState = function( s) {
  30830. this.decisionToState.push(s);
  30831. s.decision = this.decisionToState.length-1;
  30832. return s.decision;
  30833. };
  30834. ATN.prototype.getDecisionState = function( decision) {
  30835. if (this.decisionToState.length===0) {
  30836. return null;
  30837. } else {
  30838. return this.decisionToState[decision];
  30839. }
  30840. };
  30841. // Computes the set of input symbols which could follow ATN state number
  30842. // {@code stateNumber} in the specified full {@code context}. This method
  30843. // considers the complete parser context, but does not evaluate semantic
  30844. // predicates (i.e. all predicates encountered during the calculation are
  30845. // assumed true). If a path in the ATN exists from the starting state to the
  30846. // {@link RuleStopState} of the outermost context without matching any
  30847. // symbols, {@link Token//EOF} is added to the returned set.
  30848. //
  30849. // <p>If {@code context} is {@code null}, it is treated as
  30850. // {@link ParserRuleContext//EMPTY}.</p>
  30851. //
  30852. // @param stateNumber the ATN state number
  30853. // @param context the full parse context
  30854. // @return The set of potentially valid input symbols which could follow the
  30855. // specified state in the specified context.
  30856. // @throws IllegalArgumentException if the ATN does not contain a state with
  30857. // number {@code stateNumber}
  30858. var Token = __webpack_require__(/*! ./../Token */ "./node_modules/antlr4/Token.js").Token;
  30859. ATN.prototype.getExpectedTokens = function( stateNumber, ctx ) {
  30860. if ( stateNumber < 0 || stateNumber >= this.states.length ) {
  30861. throw("Invalid state number.");
  30862. }
  30863. var s = this.states[stateNumber];
  30864. var following = this.nextTokens(s);
  30865. if (!following.contains(Token.EPSILON)) {
  30866. return following;
  30867. }
  30868. var expected = new IntervalSet();
  30869. expected.addSet(following);
  30870. expected.removeOne(Token.EPSILON);
  30871. while (ctx !== null && ctx.invokingState >= 0 && following.contains(Token.EPSILON)) {
  30872. var invokingState = this.states[ctx.invokingState];
  30873. var rt = invokingState.transitions[0];
  30874. following = this.nextTokens(rt.followState);
  30875. expected.addSet(following);
  30876. expected.removeOne(Token.EPSILON);
  30877. ctx = ctx.parentCtx;
  30878. }
  30879. if (following.contains(Token.EPSILON)) {
  30880. expected.addOne(Token.EOF);
  30881. }
  30882. return expected;
  30883. };
  30884. ATN.INVALID_ALT_NUMBER = 0;
  30885. exports.ATN = ATN;
  30886. /***/ }),
  30887. /***/ "./node_modules/antlr4/atn/ATNConfig.js":
  30888. /*!**********************************************!*\
  30889. !*** ./node_modules/antlr4/atn/ATNConfig.js ***!
  30890. \**********************************************/
  30891. /*! no static exports found */
  30892. /***/ (function(module, exports, __webpack_require__) {
  30893. //
  30894. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  30895. * Use of this file is governed by the BSD 3-clause license that
  30896. * can be found in the LICENSE.txt file in the project root.
  30897. */
  30898. ///
  30899. // A tuple: (ATN state, predicted alt, syntactic, semantic context).
  30900. // The syntactic context is a graph-structured stack node whose
  30901. // path(s) to the root is the rule invocation(s)
  30902. // chain used to arrive at the state. The semantic context is
  30903. // the tree of semantic predicates encountered before reaching
  30904. // an ATN state.
  30905. ///
  30906. var DecisionState = __webpack_require__(/*! ./ATNState */ "./node_modules/antlr4/atn/ATNState.js").DecisionState;
  30907. var SemanticContext = __webpack_require__(/*! ./SemanticContext */ "./node_modules/antlr4/atn/SemanticContext.js").SemanticContext;
  30908. var Hash = __webpack_require__(/*! ../Utils */ "./node_modules/antlr4/Utils.js").Hash;
  30909. function checkParams(params, isCfg) {
  30910. if(params===null) {
  30911. var result = { state:null, alt:null, context:null, semanticContext:null };
  30912. if(isCfg) {
  30913. result.reachesIntoOuterContext = 0;
  30914. }
  30915. return result;
  30916. } else {
  30917. var props = {};
  30918. props.state = params.state || null;
  30919. props.alt = (params.alt === undefined) ? null : params.alt;
  30920. props.context = params.context || null;
  30921. props.semanticContext = params.semanticContext || null;
  30922. if(isCfg) {
  30923. props.reachesIntoOuterContext = params.reachesIntoOuterContext || 0;
  30924. props.precedenceFilterSuppressed = params.precedenceFilterSuppressed || false;
  30925. }
  30926. return props;
  30927. }
  30928. }
  30929. function ATNConfig(params, config) {
  30930. this.checkContext(params, config);
  30931. params = checkParams(params);
  30932. config = checkParams(config, true);
  30933. // The ATN state associated with this configuration///
  30934. this.state = params.state!==null ? params.state : config.state;
  30935. // What alt (or lexer rule) is predicted by this configuration///
  30936. this.alt = params.alt!==null ? params.alt : config.alt;
  30937. // The stack of invoking states leading to the rule/states associated
  30938. // with this config. We track only those contexts pushed during
  30939. // execution of the ATN simulator.
  30940. this.context = params.context!==null ? params.context : config.context;
  30941. this.semanticContext = params.semanticContext!==null ? params.semanticContext :
  30942. (config.semanticContext!==null ? config.semanticContext : SemanticContext.NONE);
  30943. // We cannot execute predicates dependent upon local context unless
  30944. // we know for sure we are in the correct context. Because there is
  30945. // no way to do this efficiently, we simply cannot evaluate
  30946. // dependent predicates unless we are in the rule that initially
  30947. // invokes the ATN simulator.
  30948. //
  30949. // closure() tracks the depth of how far we dip into the
  30950. // outer context: depth &gt; 0. Note that it may not be totally
  30951. // accurate depth since I don't ever decrement. TODO: make it a boolean then
  30952. this.reachesIntoOuterContext = config.reachesIntoOuterContext;
  30953. this.precedenceFilterSuppressed = config.precedenceFilterSuppressed;
  30954. return this;
  30955. }
  30956. ATNConfig.prototype.checkContext = function(params, config) {
  30957. if((params.context===null || params.context===undefined) &&
  30958. (config===null || config.context===null || config.context===undefined)) {
  30959. this.context = null;
  30960. }
  30961. };
  30962. ATNConfig.prototype.hashCode = function() {
  30963. var hash = new Hash();
  30964. this.updateHashCode(hash);
  30965. return hash.finish();
  30966. };
  30967. ATNConfig.prototype.updateHashCode = function(hash) {
  30968. hash.update(this.state.stateNumber, this.alt, this.context, this.semanticContext);
  30969. };
  30970. // An ATN configuration is equal to another if both have
  30971. // the same state, they predict the same alternative, and
  30972. // syntactic/semantic contexts are the same.
  30973. ATNConfig.prototype.equals = function(other) {
  30974. if (this === other) {
  30975. return true;
  30976. } else if (! (other instanceof ATNConfig)) {
  30977. return false;
  30978. } else {
  30979. return this.state.stateNumber===other.state.stateNumber &&
  30980. this.alt===other.alt &&
  30981. (this.context===null ? other.context===null : this.context.equals(other.context)) &&
  30982. this.semanticContext.equals(other.semanticContext) &&
  30983. this.precedenceFilterSuppressed===other.precedenceFilterSuppressed;
  30984. }
  30985. };
  30986. ATNConfig.prototype.hashCodeForConfigSet = function() {
  30987. var hash = new Hash();
  30988. hash.update(this.state.stateNumber, this.alt, this.semanticContext);
  30989. return hash.finish();
  30990. };
  30991. ATNConfig.prototype.equalsForConfigSet = function(other) {
  30992. if (this === other) {
  30993. return true;
  30994. } else if (! (other instanceof ATNConfig)) {
  30995. return false;
  30996. } else {
  30997. return this.state.stateNumber===other.state.stateNumber &&
  30998. this.alt===other.alt &&
  30999. this.semanticContext.equals(other.semanticContext);
  31000. }
  31001. };
  31002. ATNConfig.prototype.toString = function() {
  31003. return "(" + this.state + "," + this.alt +
  31004. (this.context!==null ? ",[" + this.context.toString() + "]" : "") +
  31005. (this.semanticContext !== SemanticContext.NONE ?
  31006. ("," + this.semanticContext.toString())
  31007. : "") +
  31008. (this.reachesIntoOuterContext>0 ?
  31009. (",up=" + this.reachesIntoOuterContext)
  31010. : "") + ")";
  31011. };
  31012. function LexerATNConfig(params, config) {
  31013. ATNConfig.call(this, params, config);
  31014. // This is the backing field for {@link //getLexerActionExecutor}.
  31015. var lexerActionExecutor = params.lexerActionExecutor || null;
  31016. this.lexerActionExecutor = lexerActionExecutor || (config!==null ? config.lexerActionExecutor : null);
  31017. this.passedThroughNonGreedyDecision = config!==null ? this.checkNonGreedyDecision(config, this.state) : false;
  31018. return this;
  31019. }
  31020. LexerATNConfig.prototype = Object.create(ATNConfig.prototype);
  31021. LexerATNConfig.prototype.constructor = LexerATNConfig;
  31022. LexerATNConfig.prototype.updateHashCode = function(hash) {
  31023. hash.update(this.state.stateNumber, this.alt, this.context, this.semanticContext, this.passedThroughNonGreedyDecision, this.lexerActionExecutor);
  31024. };
  31025. LexerATNConfig.prototype.equals = function(other) {
  31026. return this === other ||
  31027. (other instanceof LexerATNConfig &&
  31028. this.passedThroughNonGreedyDecision == other.passedThroughNonGreedyDecision &&
  31029. (this.lexerActionExecutor ? this.lexerActionExecutor.equals(other.lexerActionExecutor) : !other.lexerActionExecutor) &&
  31030. ATNConfig.prototype.equals.call(this, other));
  31031. };
  31032. LexerATNConfig.prototype.hashCodeForConfigSet = LexerATNConfig.prototype.hashCode;
  31033. LexerATNConfig.prototype.equalsForConfigSet = LexerATNConfig.prototype.equals;
  31034. LexerATNConfig.prototype.checkNonGreedyDecision = function(source, target) {
  31035. return source.passedThroughNonGreedyDecision ||
  31036. (target instanceof DecisionState) && target.nonGreedy;
  31037. };
  31038. exports.ATNConfig = ATNConfig;
  31039. exports.LexerATNConfig = LexerATNConfig;
  31040. /***/ }),
  31041. /***/ "./node_modules/antlr4/atn/ATNConfigSet.js":
  31042. /*!*************************************************!*\
  31043. !*** ./node_modules/antlr4/atn/ATNConfigSet.js ***!
  31044. \*************************************************/
  31045. /*! no static exports found */
  31046. /***/ (function(module, exports, __webpack_require__) {
  31047. //
  31048. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  31049. * Use of this file is governed by the BSD 3-clause license that
  31050. * can be found in the LICENSE.txt file in the project root.
  31051. */
  31052. //
  31053. // Specialized {@link Set}{@code <}{@link ATNConfig}{@code >} that can track
  31054. // info about the set, with support for combining similar configurations using a
  31055. // graph-structured stack.
  31056. ///
  31057. var ATN = __webpack_require__(/*! ./ATN */ "./node_modules/antlr4/atn/ATN.js").ATN;
  31058. var Utils = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js");
  31059. var Hash = Utils.Hash;
  31060. var Set = Utils.Set;
  31061. var SemanticContext = __webpack_require__(/*! ./SemanticContext */ "./node_modules/antlr4/atn/SemanticContext.js").SemanticContext;
  31062. var merge = __webpack_require__(/*! ./../PredictionContext */ "./node_modules/antlr4/PredictionContext.js").merge;
  31063. function hashATNConfig(c) {
  31064. return c.hashCodeForConfigSet();
  31065. }
  31066. function equalATNConfigs(a, b) {
  31067. if ( a===b ) {
  31068. return true;
  31069. } else if ( a===null || b===null ) {
  31070. return false;
  31071. } else
  31072. return a.equalsForConfigSet(b);
  31073. }
  31074. function ATNConfigSet(fullCtx) {
  31075. //
  31076. // The reason that we need this is because we don't want the hash map to use
  31077. // the standard hash code and equals. We need all configurations with the
  31078. // same
  31079. // {@code (s,i,_,semctx)} to be equal. Unfortunately, this key effectively
  31080. // doubles
  31081. // the number of objects associated with ATNConfigs. The other solution is
  31082. // to
  31083. // use a hash table that lets us specify the equals/hashcode operation.
  31084. // All configs but hashed by (s, i, _, pi) not including context. Wiped out
  31085. // when we go readonly as this set becomes a DFA state.
  31086. this.configLookup = new Set(hashATNConfig, equalATNConfigs);
  31087. // Indicates that this configuration set is part of a full context
  31088. // LL prediction. It will be used to determine how to merge $. With SLL
  31089. // it's a wildcard whereas it is not for LL context merge.
  31090. this.fullCtx = fullCtx === undefined ? true : fullCtx;
  31091. // Indicates that the set of configurations is read-only. Do not
  31092. // allow any code to manipulate the set; DFA states will point at
  31093. // the sets and they must not change. This does not protect the other
  31094. // fields; in particular, conflictingAlts is set after
  31095. // we've made this readonly.
  31096. this.readOnly = false;
  31097. // Track the elements as they are added to the set; supports get(i)///
  31098. this.configs = [];
  31099. // TODO: these fields make me pretty uncomfortable but nice to pack up info
  31100. // together, saves recomputation
  31101. // TODO: can we track conflicts as they are added to save scanning configs
  31102. // later?
  31103. this.uniqueAlt = 0;
  31104. this.conflictingAlts = null;
  31105. // Used in parser and lexer. In lexer, it indicates we hit a pred
  31106. // while computing a closure operation. Don't make a DFA state from this.
  31107. this.hasSemanticContext = false;
  31108. this.dipsIntoOuterContext = false;
  31109. this.cachedHashCode = -1;
  31110. return this;
  31111. }
  31112. // Adding a new config means merging contexts with existing configs for
  31113. // {@code (s, i, pi, _)}, where {@code s} is the
  31114. // {@link ATNConfig//state}, {@code i} is the {@link ATNConfig//alt}, and
  31115. // {@code pi} is the {@link ATNConfig//semanticContext}. We use
  31116. // {@code (s,i,pi)} as key.
  31117. //
  31118. // <p>This method updates {@link //dipsIntoOuterContext} and
  31119. // {@link //hasSemanticContext} when necessary.</p>
  31120. // /
  31121. ATNConfigSet.prototype.add = function(config, mergeCache) {
  31122. if (mergeCache === undefined) {
  31123. mergeCache = null;
  31124. }
  31125. if (this.readOnly) {
  31126. throw "This set is readonly";
  31127. }
  31128. if (config.semanticContext !== SemanticContext.NONE) {
  31129. this.hasSemanticContext = true;
  31130. }
  31131. if (config.reachesIntoOuterContext > 0) {
  31132. this.dipsIntoOuterContext = true;
  31133. }
  31134. var existing = this.configLookup.add(config);
  31135. if (existing === config) {
  31136. this.cachedHashCode = -1;
  31137. this.configs.push(config); // track order here
  31138. return true;
  31139. }
  31140. // a previous (s,i,pi,_), merge with it and save result
  31141. var rootIsWildcard = !this.fullCtx;
  31142. var merged = merge(existing.context, config.context, rootIsWildcard, mergeCache);
  31143. // no need to check for existing.context, config.context in cache
  31144. // since only way to create new graphs is "call rule" and here. We
  31145. // cache at both places.
  31146. existing.reachesIntoOuterContext = Math.max( existing.reachesIntoOuterContext, config.reachesIntoOuterContext);
  31147. // make sure to preserve the precedence filter suppression during the merge
  31148. if (config.precedenceFilterSuppressed) {
  31149. existing.precedenceFilterSuppressed = true;
  31150. }
  31151. existing.context = merged; // replace context; no need to alt mapping
  31152. return true;
  31153. };
  31154. ATNConfigSet.prototype.getStates = function() {
  31155. var states = new Set();
  31156. for (var i = 0; i < this.configs.length; i++) {
  31157. states.add(this.configs[i].state);
  31158. }
  31159. return states;
  31160. };
  31161. ATNConfigSet.prototype.getPredicates = function() {
  31162. var preds = [];
  31163. for (var i = 0; i < this.configs.length; i++) {
  31164. var c = this.configs[i].semanticContext;
  31165. if (c !== SemanticContext.NONE) {
  31166. preds.push(c.semanticContext);
  31167. }
  31168. }
  31169. return preds;
  31170. };
  31171. Object.defineProperty(ATNConfigSet.prototype, "items", {
  31172. get : function() {
  31173. return this.configs;
  31174. }
  31175. });
  31176. ATNConfigSet.prototype.optimizeConfigs = function(interpreter) {
  31177. if (this.readOnly) {
  31178. throw "This set is readonly";
  31179. }
  31180. if (this.configLookup.length === 0) {
  31181. return;
  31182. }
  31183. for (var i = 0; i < this.configs.length; i++) {
  31184. var config = this.configs[i];
  31185. config.context = interpreter.getCachedContext(config.context);
  31186. }
  31187. };
  31188. ATNConfigSet.prototype.addAll = function(coll) {
  31189. for (var i = 0; i < coll.length; i++) {
  31190. this.add(coll[i]);
  31191. }
  31192. return false;
  31193. };
  31194. ATNConfigSet.prototype.equals = function(other) {
  31195. return this === other ||
  31196. (other instanceof ATNConfigSet &&
  31197. Utils.equalArrays(this.configs, other.configs) &&
  31198. this.fullCtx === other.fullCtx &&
  31199. this.uniqueAlt === other.uniqueAlt &&
  31200. this.conflictingAlts === other.conflictingAlts &&
  31201. this.hasSemanticContext === other.hasSemanticContext &&
  31202. this.dipsIntoOuterContext === other.dipsIntoOuterContext);
  31203. };
  31204. ATNConfigSet.prototype.hashCode = function() {
  31205. var hash = new Hash();
  31206. this.updateHashCode(hash);
  31207. return hash.finish();
  31208. };
  31209. ATNConfigSet.prototype.updateHashCode = function(hash) {
  31210. if (this.readOnly) {
  31211. if (this.cachedHashCode === -1) {
  31212. var hash = new Hash();
  31213. hash.update(this.configs);
  31214. this.cachedHashCode = hash.finish();
  31215. }
  31216. hash.update(this.cachedHashCode);
  31217. } else {
  31218. hash.update(this.configs);
  31219. }
  31220. };
  31221. Object.defineProperty(ATNConfigSet.prototype, "length", {
  31222. get : function() {
  31223. return this.configs.length;
  31224. }
  31225. });
  31226. ATNConfigSet.prototype.isEmpty = function() {
  31227. return this.configs.length === 0;
  31228. };
  31229. ATNConfigSet.prototype.contains = function(item) {
  31230. if (this.configLookup === null) {
  31231. throw "This method is not implemented for readonly sets.";
  31232. }
  31233. return this.configLookup.contains(item);
  31234. };
  31235. ATNConfigSet.prototype.containsFast = function(item) {
  31236. if (this.configLookup === null) {
  31237. throw "This method is not implemented for readonly sets.";
  31238. }
  31239. return this.configLookup.containsFast(item);
  31240. };
  31241. ATNConfigSet.prototype.clear = function() {
  31242. if (this.readOnly) {
  31243. throw "This set is readonly";
  31244. }
  31245. this.configs = [];
  31246. this.cachedHashCode = -1;
  31247. this.configLookup = new Set();
  31248. };
  31249. ATNConfigSet.prototype.setReadonly = function(readOnly) {
  31250. this.readOnly = readOnly;
  31251. if (readOnly) {
  31252. this.configLookup = null; // can't mod, no need for lookup cache
  31253. }
  31254. };
  31255. ATNConfigSet.prototype.toString = function() {
  31256. return Utils.arrayToString(this.configs) +
  31257. (this.hasSemanticContext ? ",hasSemanticContext=" + this.hasSemanticContext : "") +
  31258. (this.uniqueAlt !== ATN.INVALID_ALT_NUMBER ? ",uniqueAlt=" + this.uniqueAlt : "") +
  31259. (this.conflictingAlts !== null ? ",conflictingAlts=" + this.conflictingAlts : "") +
  31260. (this.dipsIntoOuterContext ? ",dipsIntoOuterContext" : "");
  31261. };
  31262. function OrderedATNConfigSet() {
  31263. ATNConfigSet.call(this);
  31264. this.configLookup = new Set();
  31265. return this;
  31266. }
  31267. OrderedATNConfigSet.prototype = Object.create(ATNConfigSet.prototype);
  31268. OrderedATNConfigSet.prototype.constructor = OrderedATNConfigSet;
  31269. exports.ATNConfigSet = ATNConfigSet;
  31270. exports.OrderedATNConfigSet = OrderedATNConfigSet;
  31271. /***/ }),
  31272. /***/ "./node_modules/antlr4/atn/ATNDeserializationOptions.js":
  31273. /*!**************************************************************!*\
  31274. !*** ./node_modules/antlr4/atn/ATNDeserializationOptions.js ***!
  31275. \**************************************************************/
  31276. /*! no static exports found */
  31277. /***/ (function(module, exports) {
  31278. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  31279. * Use of this file is governed by the BSD 3-clause license that
  31280. * can be found in the LICENSE.txt file in the project root.
  31281. */
  31282. function ATNDeserializationOptions(copyFrom) {
  31283. if(copyFrom===undefined) {
  31284. copyFrom = null;
  31285. }
  31286. this.readOnly = false;
  31287. this.verifyATN = copyFrom===null ? true : copyFrom.verifyATN;
  31288. this.generateRuleBypassTransitions = copyFrom===null ? false : copyFrom.generateRuleBypassTransitions;
  31289. return this;
  31290. }
  31291. ATNDeserializationOptions.defaultOptions = new ATNDeserializationOptions();
  31292. ATNDeserializationOptions.defaultOptions.readOnly = true;
  31293. // def __setattr__(self, key, value):
  31294. // if key!="readOnly" and self.readOnly:
  31295. // raise Exception("The object is read only.")
  31296. // super(type(self), self).__setattr__(key,value)
  31297. exports.ATNDeserializationOptions = ATNDeserializationOptions;
  31298. /***/ }),
  31299. /***/ "./node_modules/antlr4/atn/ATNDeserializer.js":
  31300. /*!****************************************************!*\
  31301. !*** ./node_modules/antlr4/atn/ATNDeserializer.js ***!
  31302. \****************************************************/
  31303. /*! no static exports found */
  31304. /***/ (function(module, exports, __webpack_require__) {
  31305. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  31306. * Use of this file is governed by the BSD 3-clause license that
  31307. * can be found in the LICENSE.txt file in the project root.
  31308. */
  31309. var Token = __webpack_require__(/*! ./../Token */ "./node_modules/antlr4/Token.js").Token;
  31310. var ATN = __webpack_require__(/*! ./ATN */ "./node_modules/antlr4/atn/ATN.js").ATN;
  31311. var ATNType = __webpack_require__(/*! ./ATNType */ "./node_modules/antlr4/atn/ATNType.js").ATNType;
  31312. var ATNStates = __webpack_require__(/*! ./ATNState */ "./node_modules/antlr4/atn/ATNState.js");
  31313. var ATNState = ATNStates.ATNState;
  31314. var BasicState = ATNStates.BasicState;
  31315. var DecisionState = ATNStates.DecisionState;
  31316. var BlockStartState = ATNStates.BlockStartState;
  31317. var BlockEndState = ATNStates.BlockEndState;
  31318. var LoopEndState = ATNStates.LoopEndState;
  31319. var RuleStartState = ATNStates.RuleStartState;
  31320. var RuleStopState = ATNStates.RuleStopState;
  31321. var TokensStartState = ATNStates.TokensStartState;
  31322. var PlusLoopbackState = ATNStates.PlusLoopbackState;
  31323. var StarLoopbackState = ATNStates.StarLoopbackState;
  31324. var StarLoopEntryState = ATNStates.StarLoopEntryState;
  31325. var PlusBlockStartState = ATNStates.PlusBlockStartState;
  31326. var StarBlockStartState = ATNStates.StarBlockStartState;
  31327. var BasicBlockStartState = ATNStates.BasicBlockStartState;
  31328. var Transitions = __webpack_require__(/*! ./Transition */ "./node_modules/antlr4/atn/Transition.js");
  31329. var Transition = Transitions.Transition;
  31330. var AtomTransition = Transitions.AtomTransition;
  31331. var SetTransition = Transitions.SetTransition;
  31332. var NotSetTransition = Transitions.NotSetTransition;
  31333. var RuleTransition = Transitions.RuleTransition;
  31334. var RangeTransition = Transitions.RangeTransition;
  31335. var ActionTransition = Transitions.ActionTransition;
  31336. var EpsilonTransition = Transitions.EpsilonTransition;
  31337. var WildcardTransition = Transitions.WildcardTransition;
  31338. var PredicateTransition = Transitions.PredicateTransition;
  31339. var PrecedencePredicateTransition = Transitions.PrecedencePredicateTransition;
  31340. var IntervalSet = __webpack_require__(/*! ./../IntervalSet */ "./node_modules/antlr4/IntervalSet.js").IntervalSet;
  31341. var Interval = __webpack_require__(/*! ./../IntervalSet */ "./node_modules/antlr4/IntervalSet.js").Interval;
  31342. var ATNDeserializationOptions = __webpack_require__(/*! ./ATNDeserializationOptions */ "./node_modules/antlr4/atn/ATNDeserializationOptions.js").ATNDeserializationOptions;
  31343. var LexerActions = __webpack_require__(/*! ./LexerAction */ "./node_modules/antlr4/atn/LexerAction.js");
  31344. var LexerActionType = LexerActions.LexerActionType;
  31345. var LexerSkipAction = LexerActions.LexerSkipAction;
  31346. var LexerChannelAction = LexerActions.LexerChannelAction;
  31347. var LexerCustomAction = LexerActions.LexerCustomAction;
  31348. var LexerMoreAction = LexerActions.LexerMoreAction;
  31349. var LexerTypeAction = LexerActions.LexerTypeAction;
  31350. var LexerPushModeAction = LexerActions.LexerPushModeAction;
  31351. var LexerPopModeAction = LexerActions.LexerPopModeAction;
  31352. var LexerModeAction = LexerActions.LexerModeAction;
  31353. // This is the earliest supported serialized UUID.
  31354. // stick to serialized version for now, we don't need a UUID instance
  31355. var BASE_SERIALIZED_UUID = "AADB8D7E-AEEF-4415-AD2B-8204D6CF042E";
  31356. //
  31357. // This UUID indicates the serialized ATN contains two sets of
  31358. // IntervalSets, where the second set's values are encoded as
  31359. // 32-bit integers to support the full Unicode SMP range up to U+10FFFF.
  31360. //
  31361. var ADDED_UNICODE_SMP = "59627784-3BE5-417A-B9EB-8131A7286089";
  31362. // This list contains all of the currently supported UUIDs, ordered by when
  31363. // the feature first appeared in this branch.
  31364. var SUPPORTED_UUIDS = [ BASE_SERIALIZED_UUID, ADDED_UNICODE_SMP ];
  31365. var SERIALIZED_VERSION = 3;
  31366. // This is the current serialized UUID.
  31367. var SERIALIZED_UUID = ADDED_UNICODE_SMP;
  31368. function initArray( length, value) {
  31369. var tmp = [];
  31370. tmp[length-1] = value;
  31371. return tmp.map(function(i) {return value;});
  31372. }
  31373. function ATNDeserializer (options) {
  31374. if ( options=== undefined || options === null ) {
  31375. options = ATNDeserializationOptions.defaultOptions;
  31376. }
  31377. this.deserializationOptions = options;
  31378. this.stateFactories = null;
  31379. this.actionFactories = null;
  31380. return this;
  31381. }
  31382. // Determines if a particular serialized representation of an ATN supports
  31383. // a particular feature, identified by the {@link UUID} used for serializing
  31384. // the ATN at the time the feature was first introduced.
  31385. //
  31386. // @param feature The {@link UUID} marking the first time the feature was
  31387. // supported in the serialized ATN.
  31388. // @param actualUuid The {@link UUID} of the actual serialized ATN which is
  31389. // currently being deserialized.
  31390. // @return {@code true} if the {@code actualUuid} value represents a
  31391. // serialized ATN at or after the feature identified by {@code feature} was
  31392. // introduced; otherwise, {@code false}.
  31393. ATNDeserializer.prototype.isFeatureSupported = function(feature, actualUuid) {
  31394. var idx1 = SUPPORTED_UUIDS.indexOf(feature);
  31395. if (idx1<0) {
  31396. return false;
  31397. }
  31398. var idx2 = SUPPORTED_UUIDS.indexOf(actualUuid);
  31399. return idx2 >= idx1;
  31400. };
  31401. ATNDeserializer.prototype.deserialize = function(data) {
  31402. this.reset(data);
  31403. this.checkVersion();
  31404. this.checkUUID();
  31405. var atn = this.readATN();
  31406. this.readStates(atn);
  31407. this.readRules(atn);
  31408. this.readModes(atn);
  31409. var sets = [];
  31410. // First, deserialize sets with 16-bit arguments <= U+FFFF.
  31411. this.readSets(atn, sets, this.readInt.bind(this));
  31412. // Next, if the ATN was serialized with the Unicode SMP feature,
  31413. // deserialize sets with 32-bit arguments <= U+10FFFF.
  31414. if (this.isFeatureSupported(ADDED_UNICODE_SMP, this.uuid)) {
  31415. this.readSets(atn, sets, this.readInt32.bind(this));
  31416. }
  31417. this.readEdges(atn, sets);
  31418. this.readDecisions(atn);
  31419. this.readLexerActions(atn);
  31420. this.markPrecedenceDecisions(atn);
  31421. this.verifyATN(atn);
  31422. if (this.deserializationOptions.generateRuleBypassTransitions && atn.grammarType === ATNType.PARSER ) {
  31423. this.generateRuleBypassTransitions(atn);
  31424. // re-verify after modification
  31425. this.verifyATN(atn);
  31426. }
  31427. return atn;
  31428. };
  31429. ATNDeserializer.prototype.reset = function(data) {
  31430. var adjust = function(c) {
  31431. var v = c.charCodeAt(0);
  31432. return v>1 ? v-2 : v + 65533;
  31433. };
  31434. var temp = data.split("").map(adjust);
  31435. // don't adjust the first value since that's the version number
  31436. temp[0] = data.charCodeAt(0);
  31437. this.data = temp;
  31438. this.pos = 0;
  31439. };
  31440. ATNDeserializer.prototype.checkVersion = function() {
  31441. var version = this.readInt();
  31442. if ( version !== SERIALIZED_VERSION ) {
  31443. throw ("Could not deserialize ATN with version " + version + " (expected " + SERIALIZED_VERSION + ").");
  31444. }
  31445. };
  31446. ATNDeserializer.prototype.checkUUID = function() {
  31447. var uuid = this.readUUID();
  31448. if (SUPPORTED_UUIDS.indexOf(uuid)<0) {
  31449. throw ("Could not deserialize ATN with UUID: " + uuid +
  31450. " (expected " + SERIALIZED_UUID + " or a legacy UUID).", uuid, SERIALIZED_UUID);
  31451. }
  31452. this.uuid = uuid;
  31453. };
  31454. ATNDeserializer.prototype.readATN = function() {
  31455. var grammarType = this.readInt();
  31456. var maxTokenType = this.readInt();
  31457. return new ATN(grammarType, maxTokenType);
  31458. };
  31459. ATNDeserializer.prototype.readStates = function(atn) {
  31460. var j, pair, stateNumber;
  31461. var loopBackStateNumbers = [];
  31462. var endStateNumbers = [];
  31463. var nstates = this.readInt();
  31464. for(var i=0; i<nstates; i++) {
  31465. var stype = this.readInt();
  31466. // ignore bad type of states
  31467. if (stype===ATNState.INVALID_TYPE) {
  31468. atn.addState(null);
  31469. continue;
  31470. }
  31471. var ruleIndex = this.readInt();
  31472. if (ruleIndex === 0xFFFF) {
  31473. ruleIndex = -1;
  31474. }
  31475. var s = this.stateFactory(stype, ruleIndex);
  31476. if (stype === ATNState.LOOP_END) { // special case
  31477. var loopBackStateNumber = this.readInt();
  31478. loopBackStateNumbers.push([s, loopBackStateNumber]);
  31479. } else if(s instanceof BlockStartState) {
  31480. var endStateNumber = this.readInt();
  31481. endStateNumbers.push([s, endStateNumber]);
  31482. }
  31483. atn.addState(s);
  31484. }
  31485. // delay the assignment of loop back and end states until we know all the
  31486. // state instances have been initialized
  31487. for (j=0; j<loopBackStateNumbers.length; j++) {
  31488. pair = loopBackStateNumbers[j];
  31489. pair[0].loopBackState = atn.states[pair[1]];
  31490. }
  31491. for (j=0; j<endStateNumbers.length; j++) {
  31492. pair = endStateNumbers[j];
  31493. pair[0].endState = atn.states[pair[1]];
  31494. }
  31495. var numNonGreedyStates = this.readInt();
  31496. for (j=0; j<numNonGreedyStates; j++) {
  31497. stateNumber = this.readInt();
  31498. atn.states[stateNumber].nonGreedy = true;
  31499. }
  31500. var numPrecedenceStates = this.readInt();
  31501. for (j=0; j<numPrecedenceStates; j++) {
  31502. stateNumber = this.readInt();
  31503. atn.states[stateNumber].isPrecedenceRule = true;
  31504. }
  31505. };
  31506. ATNDeserializer.prototype.readRules = function(atn) {
  31507. var i;
  31508. var nrules = this.readInt();
  31509. if (atn.grammarType === ATNType.LEXER ) {
  31510. atn.ruleToTokenType = initArray(nrules, 0);
  31511. }
  31512. atn.ruleToStartState = initArray(nrules, 0);
  31513. for (i=0; i<nrules; i++) {
  31514. var s = this.readInt();
  31515. var startState = atn.states[s];
  31516. atn.ruleToStartState[i] = startState;
  31517. if ( atn.grammarType === ATNType.LEXER ) {
  31518. var tokenType = this.readInt();
  31519. if (tokenType === 0xFFFF) {
  31520. tokenType = Token.EOF;
  31521. }
  31522. atn.ruleToTokenType[i] = tokenType;
  31523. }
  31524. }
  31525. atn.ruleToStopState = initArray(nrules, 0);
  31526. for (i=0; i<atn.states.length; i++) {
  31527. var state = atn.states[i];
  31528. if (!(state instanceof RuleStopState)) {
  31529. continue;
  31530. }
  31531. atn.ruleToStopState[state.ruleIndex] = state;
  31532. atn.ruleToStartState[state.ruleIndex].stopState = state;
  31533. }
  31534. };
  31535. ATNDeserializer.prototype.readModes = function(atn) {
  31536. var nmodes = this.readInt();
  31537. for (var i=0; i<nmodes; i++) {
  31538. var s = this.readInt();
  31539. atn.modeToStartState.push(atn.states[s]);
  31540. }
  31541. };
  31542. ATNDeserializer.prototype.readSets = function(atn, sets, readUnicode) {
  31543. var m = this.readInt();
  31544. for (var i=0; i<m; i++) {
  31545. var iset = new IntervalSet();
  31546. sets.push(iset);
  31547. var n = this.readInt();
  31548. var containsEof = this.readInt();
  31549. if (containsEof!==0) {
  31550. iset.addOne(-1);
  31551. }
  31552. for (var j=0; j<n; j++) {
  31553. var i1 = readUnicode();
  31554. var i2 = readUnicode();
  31555. iset.addRange(i1, i2);
  31556. }
  31557. }
  31558. };
  31559. ATNDeserializer.prototype.readEdges = function(atn, sets) {
  31560. var i, j, state, trans, target;
  31561. var nedges = this.readInt();
  31562. for (i=0; i<nedges; i++) {
  31563. var src = this.readInt();
  31564. var trg = this.readInt();
  31565. var ttype = this.readInt();
  31566. var arg1 = this.readInt();
  31567. var arg2 = this.readInt();
  31568. var arg3 = this.readInt();
  31569. trans = this.edgeFactory(atn, ttype, src, trg, arg1, arg2, arg3, sets);
  31570. var srcState = atn.states[src];
  31571. srcState.addTransition(trans);
  31572. }
  31573. // edges for rule stop states can be derived, so they aren't serialized
  31574. for (i=0; i<atn.states.length; i++) {
  31575. state = atn.states[i];
  31576. for (j=0; j<state.transitions.length; j++) {
  31577. var t = state.transitions[j];
  31578. if (!(t instanceof RuleTransition)) {
  31579. continue;
  31580. }
  31581. var outermostPrecedenceReturn = -1;
  31582. if (atn.ruleToStartState[t.target.ruleIndex].isPrecedenceRule) {
  31583. if (t.precedence === 0) {
  31584. outermostPrecedenceReturn = t.target.ruleIndex;
  31585. }
  31586. }
  31587. trans = new EpsilonTransition(t.followState, outermostPrecedenceReturn);
  31588. atn.ruleToStopState[t.target.ruleIndex].addTransition(trans);
  31589. }
  31590. }
  31591. for (i=0; i<atn.states.length; i++) {
  31592. state = atn.states[i];
  31593. if (state instanceof BlockStartState) {
  31594. // we need to know the end state to set its start state
  31595. if (state.endState === null) {
  31596. throw ("IllegalState");
  31597. }
  31598. // block end states can only be associated to a single block start
  31599. // state
  31600. if ( state.endState.startState !== null) {
  31601. throw ("IllegalState");
  31602. }
  31603. state.endState.startState = state;
  31604. }
  31605. if (state instanceof PlusLoopbackState) {
  31606. for (j=0; j<state.transitions.length; j++) {
  31607. target = state.transitions[j].target;
  31608. if (target instanceof PlusBlockStartState) {
  31609. target.loopBackState = state;
  31610. }
  31611. }
  31612. } else if (state instanceof StarLoopbackState) {
  31613. for (j=0; j<state.transitions.length; j++) {
  31614. target = state.transitions[j].target;
  31615. if (target instanceof StarLoopEntryState) {
  31616. target.loopBackState = state;
  31617. }
  31618. }
  31619. }
  31620. }
  31621. };
  31622. ATNDeserializer.prototype.readDecisions = function(atn) {
  31623. var ndecisions = this.readInt();
  31624. for (var i=0; i<ndecisions; i++) {
  31625. var s = this.readInt();
  31626. var decState = atn.states[s];
  31627. atn.decisionToState.push(decState);
  31628. decState.decision = i;
  31629. }
  31630. };
  31631. ATNDeserializer.prototype.readLexerActions = function(atn) {
  31632. if (atn.grammarType === ATNType.LEXER) {
  31633. var count = this.readInt();
  31634. atn.lexerActions = initArray(count, null);
  31635. for (var i=0; i<count; i++) {
  31636. var actionType = this.readInt();
  31637. var data1 = this.readInt();
  31638. if (data1 === 0xFFFF) {
  31639. data1 = -1;
  31640. }
  31641. var data2 = this.readInt();
  31642. if (data2 === 0xFFFF) {
  31643. data2 = -1;
  31644. }
  31645. var lexerAction = this.lexerActionFactory(actionType, data1, data2);
  31646. atn.lexerActions[i] = lexerAction;
  31647. }
  31648. }
  31649. };
  31650. ATNDeserializer.prototype.generateRuleBypassTransitions = function(atn) {
  31651. var i;
  31652. var count = atn.ruleToStartState.length;
  31653. for(i=0; i<count; i++) {
  31654. atn.ruleToTokenType[i] = atn.maxTokenType + i + 1;
  31655. }
  31656. for(i=0; i<count; i++) {
  31657. this.generateRuleBypassTransition(atn, i);
  31658. }
  31659. };
  31660. ATNDeserializer.prototype.generateRuleBypassTransition = function(atn, idx) {
  31661. var i, state;
  31662. var bypassStart = new BasicBlockStartState();
  31663. bypassStart.ruleIndex = idx;
  31664. atn.addState(bypassStart);
  31665. var bypassStop = new BlockEndState();
  31666. bypassStop.ruleIndex = idx;
  31667. atn.addState(bypassStop);
  31668. bypassStart.endState = bypassStop;
  31669. atn.defineDecisionState(bypassStart);
  31670. bypassStop.startState = bypassStart;
  31671. var excludeTransition = null;
  31672. var endState = null;
  31673. if (atn.ruleToStartState[idx].isPrecedenceRule) {
  31674. // wrap from the beginning of the rule to the StarLoopEntryState
  31675. endState = null;
  31676. for(i=0; i<atn.states.length; i++) {
  31677. state = atn.states[i];
  31678. if (this.stateIsEndStateFor(state, idx)) {
  31679. endState = state;
  31680. excludeTransition = state.loopBackState.transitions[0];
  31681. break;
  31682. }
  31683. }
  31684. if (excludeTransition === null) {
  31685. throw ("Couldn't identify final state of the precedence rule prefix section.");
  31686. }
  31687. } else {
  31688. endState = atn.ruleToStopState[idx];
  31689. }
  31690. // all non-excluded transitions that currently target end state need to
  31691. // target blockEnd instead
  31692. for(i=0; i<atn.states.length; i++) {
  31693. state = atn.states[i];
  31694. for(var j=0; j<state.transitions.length; j++) {
  31695. var transition = state.transitions[j];
  31696. if (transition === excludeTransition) {
  31697. continue;
  31698. }
  31699. if (transition.target === endState) {
  31700. transition.target = bypassStop;
  31701. }
  31702. }
  31703. }
  31704. // all transitions leaving the rule start state need to leave blockStart
  31705. // instead
  31706. var ruleToStartState = atn.ruleToStartState[idx];
  31707. var count = ruleToStartState.transitions.length;
  31708. while ( count > 0) {
  31709. bypassStart.addTransition(ruleToStartState.transitions[count-1]);
  31710. ruleToStartState.transitions = ruleToStartState.transitions.slice(-1);
  31711. }
  31712. // link the new states
  31713. atn.ruleToStartState[idx].addTransition(new EpsilonTransition(bypassStart));
  31714. bypassStop.addTransition(new EpsilonTransition(endState));
  31715. var matchState = new BasicState();
  31716. atn.addState(matchState);
  31717. matchState.addTransition(new AtomTransition(bypassStop, atn.ruleToTokenType[idx]));
  31718. bypassStart.addTransition(new EpsilonTransition(matchState));
  31719. };
  31720. ATNDeserializer.prototype.stateIsEndStateFor = function(state, idx) {
  31721. if ( state.ruleIndex !== idx) {
  31722. return null;
  31723. }
  31724. if (!( state instanceof StarLoopEntryState)) {
  31725. return null;
  31726. }
  31727. var maybeLoopEndState = state.transitions[state.transitions.length - 1].target;
  31728. if (!( maybeLoopEndState instanceof LoopEndState)) {
  31729. return null;
  31730. }
  31731. if (maybeLoopEndState.epsilonOnlyTransitions &&
  31732. (maybeLoopEndState.transitions[0].target instanceof RuleStopState)) {
  31733. return state;
  31734. } else {
  31735. return null;
  31736. }
  31737. };
  31738. //
  31739. // Analyze the {@link StarLoopEntryState} states in the specified ATN to set
  31740. // the {@link StarLoopEntryState//isPrecedenceDecision} field to the
  31741. // correct value.
  31742. //
  31743. // @param atn The ATN.
  31744. //
  31745. ATNDeserializer.prototype.markPrecedenceDecisions = function(atn) {
  31746. for(var i=0; i<atn.states.length; i++) {
  31747. var state = atn.states[i];
  31748. if (!( state instanceof StarLoopEntryState)) {
  31749. continue;
  31750. }
  31751. // We analyze the ATN to determine if this ATN decision state is the
  31752. // decision for the closure block that determines whether a
  31753. // precedence rule should continue or complete.
  31754. //
  31755. if ( atn.ruleToStartState[state.ruleIndex].isPrecedenceRule) {
  31756. var maybeLoopEndState = state.transitions[state.transitions.length - 1].target;
  31757. if (maybeLoopEndState instanceof LoopEndState) {
  31758. if ( maybeLoopEndState.epsilonOnlyTransitions &&
  31759. (maybeLoopEndState.transitions[0].target instanceof RuleStopState)) {
  31760. state.isPrecedenceDecision = true;
  31761. }
  31762. }
  31763. }
  31764. }
  31765. };
  31766. ATNDeserializer.prototype.verifyATN = function(atn) {
  31767. if (!this.deserializationOptions.verifyATN) {
  31768. return;
  31769. }
  31770. // verify assumptions
  31771. for(var i=0; i<atn.states.length; i++) {
  31772. var state = atn.states[i];
  31773. if (state === null) {
  31774. continue;
  31775. }
  31776. this.checkCondition(state.epsilonOnlyTransitions || state.transitions.length <= 1);
  31777. if (state instanceof PlusBlockStartState) {
  31778. this.checkCondition(state.loopBackState !== null);
  31779. } else if (state instanceof StarLoopEntryState) {
  31780. this.checkCondition(state.loopBackState !== null);
  31781. this.checkCondition(state.transitions.length === 2);
  31782. if (state.transitions[0].target instanceof StarBlockStartState) {
  31783. this.checkCondition(state.transitions[1].target instanceof LoopEndState);
  31784. this.checkCondition(!state.nonGreedy);
  31785. } else if (state.transitions[0].target instanceof LoopEndState) {
  31786. this.checkCondition(state.transitions[1].target instanceof StarBlockStartState);
  31787. this.checkCondition(state.nonGreedy);
  31788. } else {
  31789. throw("IllegalState");
  31790. }
  31791. } else if (state instanceof StarLoopbackState) {
  31792. this.checkCondition(state.transitions.length === 1);
  31793. this.checkCondition(state.transitions[0].target instanceof StarLoopEntryState);
  31794. } else if (state instanceof LoopEndState) {
  31795. this.checkCondition(state.loopBackState !== null);
  31796. } else if (state instanceof RuleStartState) {
  31797. this.checkCondition(state.stopState !== null);
  31798. } else if (state instanceof BlockStartState) {
  31799. this.checkCondition(state.endState !== null);
  31800. } else if (state instanceof BlockEndState) {
  31801. this.checkCondition(state.startState !== null);
  31802. } else if (state instanceof DecisionState) {
  31803. this.checkCondition(state.transitions.length <= 1 || state.decision >= 0);
  31804. } else {
  31805. this.checkCondition(state.transitions.length <= 1 || (state instanceof RuleStopState));
  31806. }
  31807. }
  31808. };
  31809. ATNDeserializer.prototype.checkCondition = function(condition, message) {
  31810. if (!condition) {
  31811. if (message === undefined || message===null) {
  31812. message = "IllegalState";
  31813. }
  31814. throw (message);
  31815. }
  31816. };
  31817. ATNDeserializer.prototype.readInt = function() {
  31818. return this.data[this.pos++];
  31819. };
  31820. ATNDeserializer.prototype.readInt32 = function() {
  31821. var low = this.readInt();
  31822. var high = this.readInt();
  31823. return low | (high << 16);
  31824. };
  31825. ATNDeserializer.prototype.readLong = function() {
  31826. var low = this.readInt32();
  31827. var high = this.readInt32();
  31828. return (low & 0x00000000FFFFFFFF) | (high << 32);
  31829. };
  31830. function createByteToHex() {
  31831. var bth = [];
  31832. for (var i = 0; i < 256; i++) {
  31833. bth[i] = (i + 0x100).toString(16).substr(1).toUpperCase();
  31834. }
  31835. return bth;
  31836. }
  31837. var byteToHex = createByteToHex();
  31838. ATNDeserializer.prototype.readUUID = function() {
  31839. var bb = [];
  31840. for(var i=7;i>=0;i--) {
  31841. var int = this.readInt();
  31842. /* jshint bitwise: false */
  31843. bb[(2*i)+1] = int & 0xFF;
  31844. bb[2*i] = (int >> 8) & 0xFF;
  31845. }
  31846. return byteToHex[bb[0]] + byteToHex[bb[1]] +
  31847. byteToHex[bb[2]] + byteToHex[bb[3]] + '-' +
  31848. byteToHex[bb[4]] + byteToHex[bb[5]] + '-' +
  31849. byteToHex[bb[6]] + byteToHex[bb[7]] + '-' +
  31850. byteToHex[bb[8]] + byteToHex[bb[9]] + '-' +
  31851. byteToHex[bb[10]] + byteToHex[bb[11]] +
  31852. byteToHex[bb[12]] + byteToHex[bb[13]] +
  31853. byteToHex[bb[14]] + byteToHex[bb[15]];
  31854. };
  31855. ATNDeserializer.prototype.edgeFactory = function(atn, type, src, trg, arg1, arg2, arg3, sets) {
  31856. var target = atn.states[trg];
  31857. switch(type) {
  31858. case Transition.EPSILON:
  31859. return new EpsilonTransition(target);
  31860. case Transition.RANGE:
  31861. return arg3 !== 0 ? new RangeTransition(target, Token.EOF, arg2) : new RangeTransition(target, arg1, arg2);
  31862. case Transition.RULE:
  31863. return new RuleTransition(atn.states[arg1], arg2, arg3, target);
  31864. case Transition.PREDICATE:
  31865. return new PredicateTransition(target, arg1, arg2, arg3 !== 0);
  31866. case Transition.PRECEDENCE:
  31867. return new PrecedencePredicateTransition(target, arg1);
  31868. case Transition.ATOM:
  31869. return arg3 !== 0 ? new AtomTransition(target, Token.EOF) : new AtomTransition(target, arg1);
  31870. case Transition.ACTION:
  31871. return new ActionTransition(target, arg1, arg2, arg3 !== 0);
  31872. case Transition.SET:
  31873. return new SetTransition(target, sets[arg1]);
  31874. case Transition.NOT_SET:
  31875. return new NotSetTransition(target, sets[arg1]);
  31876. case Transition.WILDCARD:
  31877. return new WildcardTransition(target);
  31878. default:
  31879. throw "The specified transition type: " + type + " is not valid.";
  31880. }
  31881. };
  31882. ATNDeserializer.prototype.stateFactory = function(type, ruleIndex) {
  31883. if (this.stateFactories === null) {
  31884. var sf = [];
  31885. sf[ATNState.INVALID_TYPE] = null;
  31886. sf[ATNState.BASIC] = function() { return new BasicState(); };
  31887. sf[ATNState.RULE_START] = function() { return new RuleStartState(); };
  31888. sf[ATNState.BLOCK_START] = function() { return new BasicBlockStartState(); };
  31889. sf[ATNState.PLUS_BLOCK_START] = function() { return new PlusBlockStartState(); };
  31890. sf[ATNState.STAR_BLOCK_START] = function() { return new StarBlockStartState(); };
  31891. sf[ATNState.TOKEN_START] = function() { return new TokensStartState(); };
  31892. sf[ATNState.RULE_STOP] = function() { return new RuleStopState(); };
  31893. sf[ATNState.BLOCK_END] = function() { return new BlockEndState(); };
  31894. sf[ATNState.STAR_LOOP_BACK] = function() { return new StarLoopbackState(); };
  31895. sf[ATNState.STAR_LOOP_ENTRY] = function() { return new StarLoopEntryState(); };
  31896. sf[ATNState.PLUS_LOOP_BACK] = function() { return new PlusLoopbackState(); };
  31897. sf[ATNState.LOOP_END] = function() { return new LoopEndState(); };
  31898. this.stateFactories = sf;
  31899. }
  31900. if (type>this.stateFactories.length || this.stateFactories[type] === null) {
  31901. throw("The specified state type " + type + " is not valid.");
  31902. } else {
  31903. var s = this.stateFactories[type]();
  31904. if (s!==null) {
  31905. s.ruleIndex = ruleIndex;
  31906. return s;
  31907. }
  31908. }
  31909. };
  31910. ATNDeserializer.prototype.lexerActionFactory = function(type, data1, data2) {
  31911. if (this.actionFactories === null) {
  31912. var af = [];
  31913. af[LexerActionType.CHANNEL] = function(data1, data2) { return new LexerChannelAction(data1); };
  31914. af[LexerActionType.CUSTOM] = function(data1, data2) { return new LexerCustomAction(data1, data2); };
  31915. af[LexerActionType.MODE] = function(data1, data2) { return new LexerModeAction(data1); };
  31916. af[LexerActionType.MORE] = function(data1, data2) { return LexerMoreAction.INSTANCE; };
  31917. af[LexerActionType.POP_MODE] = function(data1, data2) { return LexerPopModeAction.INSTANCE; };
  31918. af[LexerActionType.PUSH_MODE] = function(data1, data2) { return new LexerPushModeAction(data1); };
  31919. af[LexerActionType.SKIP] = function(data1, data2) { return LexerSkipAction.INSTANCE; };
  31920. af[LexerActionType.TYPE] = function(data1, data2) { return new LexerTypeAction(data1); };
  31921. this.actionFactories = af;
  31922. }
  31923. if (type>this.actionFactories.length || this.actionFactories[type] === null) {
  31924. throw("The specified lexer action type " + type + " is not valid.");
  31925. } else {
  31926. return this.actionFactories[type](data1, data2);
  31927. }
  31928. };
  31929. exports.ATNDeserializer = ATNDeserializer;
  31930. /***/ }),
  31931. /***/ "./node_modules/antlr4/atn/ATNSimulator.js":
  31932. /*!*************************************************!*\
  31933. !*** ./node_modules/antlr4/atn/ATNSimulator.js ***!
  31934. \*************************************************/
  31935. /*! no static exports found */
  31936. /***/ (function(module, exports, __webpack_require__) {
  31937. //
  31938. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  31939. * Use of this file is governed by the BSD 3-clause license that
  31940. * can be found in the LICENSE.txt file in the project root.
  31941. */
  31942. ///
  31943. var DFAState = __webpack_require__(/*! ./../dfa/DFAState */ "./node_modules/antlr4/dfa/DFAState.js").DFAState;
  31944. var ATNConfigSet = __webpack_require__(/*! ./ATNConfigSet */ "./node_modules/antlr4/atn/ATNConfigSet.js").ATNConfigSet;
  31945. var getCachedPredictionContext = __webpack_require__(/*! ./../PredictionContext */ "./node_modules/antlr4/PredictionContext.js").getCachedPredictionContext;
  31946. function ATNSimulator(atn, sharedContextCache) {
  31947. // The context cache maps all PredictionContext objects that are ==
  31948. // to a single cached copy. This cache is shared across all contexts
  31949. // in all ATNConfigs in all DFA states. We rebuild each ATNConfigSet
  31950. // to use only cached nodes/graphs in addDFAState(). We don't want to
  31951. // fill this during closure() since there are lots of contexts that
  31952. // pop up but are not used ever again. It also greatly slows down closure().
  31953. //
  31954. // <p>This cache makes a huge difference in memory and a little bit in speed.
  31955. // For the Java grammar on java.*, it dropped the memory requirements
  31956. // at the end from 25M to 16M. We don't store any of the full context
  31957. // graphs in the DFA because they are limited to local context only,
  31958. // but apparently there's a lot of repetition there as well. We optimize
  31959. // the config contexts before storing the config set in the DFA states
  31960. // by literally rebuilding them with cached subgraphs only.</p>
  31961. //
  31962. // <p>I tried a cache for use during closure operations, that was
  31963. // whacked after each adaptivePredict(). It cost a little bit
  31964. // more time I think and doesn't save on the overall footprint
  31965. // so it's not worth the complexity.</p>
  31966. ///
  31967. this.atn = atn;
  31968. this.sharedContextCache = sharedContextCache;
  31969. return this;
  31970. }
  31971. // Must distinguish between missing edge and edge we know leads nowhere///
  31972. ATNSimulator.ERROR = new DFAState(0x7FFFFFFF, new ATNConfigSet());
  31973. ATNSimulator.prototype.getCachedContext = function(context) {
  31974. if (this.sharedContextCache ===null) {
  31975. return context;
  31976. }
  31977. var visited = {};
  31978. return getCachedPredictionContext(context, this.sharedContextCache, visited);
  31979. };
  31980. exports.ATNSimulator = ATNSimulator;
  31981. /***/ }),
  31982. /***/ "./node_modules/antlr4/atn/ATNState.js":
  31983. /*!*********************************************!*\
  31984. !*** ./node_modules/antlr4/atn/ATNState.js ***!
  31985. \*********************************************/
  31986. /*! no static exports found */
  31987. /***/ (function(module, exports) {
  31988. //
  31989. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  31990. * Use of this file is governed by the BSD 3-clause license that
  31991. * can be found in the LICENSE.txt file in the project root.
  31992. */
  31993. //
  31994. // The following images show the relation of states and
  31995. // {@link ATNState//transitions} for various grammar constructs.
  31996. //
  31997. // <ul>
  31998. //
  31999. // <li>Solid edges marked with an &//0949; indicate a required
  32000. // {@link EpsilonTransition}.</li>
  32001. //
  32002. // <li>Dashed edges indicate locations where any transition derived from
  32003. // {@link Transition} might appear.</li>
  32004. //
  32005. // <li>Dashed nodes are place holders for either a sequence of linked
  32006. // {@link BasicState} states or the inclusion of a block representing a nested
  32007. // construct in one of the forms below.</li>
  32008. //
  32009. // <li>Nodes showing multiple outgoing alternatives with a {@code ...} support
  32010. // any number of alternatives (one or more). Nodes without the {@code ...} only
  32011. // support the exact number of alternatives shown in the diagram.</li>
  32012. //
  32013. // </ul>
  32014. //
  32015. // <h2>Basic Blocks</h2>
  32016. //
  32017. // <h3>Rule</h3>
  32018. //
  32019. // <embed src="images/Rule.svg" type="image/svg+xml"/>
  32020. //
  32021. // <h3>Block of 1 or more alternatives</h3>
  32022. //
  32023. // <embed src="images/Block.svg" type="image/svg+xml"/>
  32024. //
  32025. // <h2>Greedy Loops</h2>
  32026. //
  32027. // <h3>Greedy Closure: {@code (...)*}</h3>
  32028. //
  32029. // <embed src="images/ClosureGreedy.svg" type="image/svg+xml"/>
  32030. //
  32031. // <h3>Greedy Positive Closure: {@code (...)+}</h3>
  32032. //
  32033. // <embed src="images/PositiveClosureGreedy.svg" type="image/svg+xml"/>
  32034. //
  32035. // <h3>Greedy Optional: {@code (...)?}</h3>
  32036. //
  32037. // <embed src="images/OptionalGreedy.svg" type="image/svg+xml"/>
  32038. //
  32039. // <h2>Non-Greedy Loops</h2>
  32040. //
  32041. // <h3>Non-Greedy Closure: {@code (...)*?}</h3>
  32042. //
  32043. // <embed src="images/ClosureNonGreedy.svg" type="image/svg+xml"/>
  32044. //
  32045. // <h3>Non-Greedy Positive Closure: {@code (...)+?}</h3>
  32046. //
  32047. // <embed src="images/PositiveClosureNonGreedy.svg" type="image/svg+xml"/>
  32048. //
  32049. // <h3>Non-Greedy Optional: {@code (...)??}</h3>
  32050. //
  32051. // <embed src="images/OptionalNonGreedy.svg" type="image/svg+xml"/>
  32052. //
  32053. var INITIAL_NUM_TRANSITIONS = 4;
  32054. function ATNState() {
  32055. // Which ATN are we in?
  32056. this.atn = null;
  32057. this.stateNumber = ATNState.INVALID_STATE_NUMBER;
  32058. this.stateType = null;
  32059. this.ruleIndex = 0; // at runtime, we don't have Rule objects
  32060. this.epsilonOnlyTransitions = false;
  32061. // Track the transitions emanating from this ATN state.
  32062. this.transitions = [];
  32063. // Used to cache lookahead during parsing, not used during construction
  32064. this.nextTokenWithinRule = null;
  32065. return this;
  32066. }
  32067. // constants for serialization
  32068. ATNState.INVALID_TYPE = 0;
  32069. ATNState.BASIC = 1;
  32070. ATNState.RULE_START = 2;
  32071. ATNState.BLOCK_START = 3;
  32072. ATNState.PLUS_BLOCK_START = 4;
  32073. ATNState.STAR_BLOCK_START = 5;
  32074. ATNState.TOKEN_START = 6;
  32075. ATNState.RULE_STOP = 7;
  32076. ATNState.BLOCK_END = 8;
  32077. ATNState.STAR_LOOP_BACK = 9;
  32078. ATNState.STAR_LOOP_ENTRY = 10;
  32079. ATNState.PLUS_LOOP_BACK = 11;
  32080. ATNState.LOOP_END = 12;
  32081. ATNState.serializationNames = [
  32082. "INVALID",
  32083. "BASIC",
  32084. "RULE_START",
  32085. "BLOCK_START",
  32086. "PLUS_BLOCK_START",
  32087. "STAR_BLOCK_START",
  32088. "TOKEN_START",
  32089. "RULE_STOP",
  32090. "BLOCK_END",
  32091. "STAR_LOOP_BACK",
  32092. "STAR_LOOP_ENTRY",
  32093. "PLUS_LOOP_BACK",
  32094. "LOOP_END" ];
  32095. ATNState.INVALID_STATE_NUMBER = -1;
  32096. ATNState.prototype.toString = function() {
  32097. return this.stateNumber;
  32098. };
  32099. ATNState.prototype.equals = function(other) {
  32100. if (other instanceof ATNState) {
  32101. return this.stateNumber===other.stateNumber;
  32102. } else {
  32103. return false;
  32104. }
  32105. };
  32106. ATNState.prototype.isNonGreedyExitState = function() {
  32107. return false;
  32108. };
  32109. ATNState.prototype.addTransition = function(trans, index) {
  32110. if(index===undefined) {
  32111. index = -1;
  32112. }
  32113. if (this.transitions.length===0) {
  32114. this.epsilonOnlyTransitions = trans.isEpsilon;
  32115. } else if(this.epsilonOnlyTransitions !== trans.isEpsilon) {
  32116. this.epsilonOnlyTransitions = false;
  32117. }
  32118. if (index===-1) {
  32119. this.transitions.push(trans);
  32120. } else {
  32121. this.transitions.splice(index, 1, trans);
  32122. }
  32123. };
  32124. function BasicState() {
  32125. ATNState.call(this);
  32126. this.stateType = ATNState.BASIC;
  32127. return this;
  32128. }
  32129. BasicState.prototype = Object.create(ATNState.prototype);
  32130. BasicState.prototype.constructor = BasicState;
  32131. function DecisionState() {
  32132. ATNState.call(this);
  32133. this.decision = -1;
  32134. this.nonGreedy = false;
  32135. return this;
  32136. }
  32137. DecisionState.prototype = Object.create(ATNState.prototype);
  32138. DecisionState.prototype.constructor = DecisionState;
  32139. // The start of a regular {@code (...)} block.
  32140. function BlockStartState() {
  32141. DecisionState.call(this);
  32142. this.endState = null;
  32143. return this;
  32144. }
  32145. BlockStartState.prototype = Object.create(DecisionState.prototype);
  32146. BlockStartState.prototype.constructor = BlockStartState;
  32147. function BasicBlockStartState() {
  32148. BlockStartState.call(this);
  32149. this.stateType = ATNState.BLOCK_START;
  32150. return this;
  32151. }
  32152. BasicBlockStartState.prototype = Object.create(BlockStartState.prototype);
  32153. BasicBlockStartState.prototype.constructor = BasicBlockStartState;
  32154. // Terminal node of a simple {@code (a|b|c)} block.
  32155. function BlockEndState() {
  32156. ATNState.call(this);
  32157. this.stateType = ATNState.BLOCK_END;
  32158. this.startState = null;
  32159. return this;
  32160. }
  32161. BlockEndState.prototype = Object.create(ATNState.prototype);
  32162. BlockEndState.prototype.constructor = BlockEndState;
  32163. // The last node in the ATN for a rule, unless that rule is the start symbol.
  32164. // In that case, there is one transition to EOF. Later, we might encode
  32165. // references to all calls to this rule to compute FOLLOW sets for
  32166. // error handling.
  32167. //
  32168. function RuleStopState() {
  32169. ATNState.call(this);
  32170. this.stateType = ATNState.RULE_STOP;
  32171. return this;
  32172. }
  32173. RuleStopState.prototype = Object.create(ATNState.prototype);
  32174. RuleStopState.prototype.constructor = RuleStopState;
  32175. function RuleStartState() {
  32176. ATNState.call(this);
  32177. this.stateType = ATNState.RULE_START;
  32178. this.stopState = null;
  32179. this.isPrecedenceRule = false;
  32180. return this;
  32181. }
  32182. RuleStartState.prototype = Object.create(ATNState.prototype);
  32183. RuleStartState.prototype.constructor = RuleStartState;
  32184. // Decision state for {@code A+} and {@code (A|B)+}. It has two transitions:
  32185. // one to the loop back to start of the block and one to exit.
  32186. //
  32187. function PlusLoopbackState() {
  32188. DecisionState.call(this);
  32189. this.stateType = ATNState.PLUS_LOOP_BACK;
  32190. return this;
  32191. }
  32192. PlusLoopbackState.prototype = Object.create(DecisionState.prototype);
  32193. PlusLoopbackState.prototype.constructor = PlusLoopbackState;
  32194. // Start of {@code (A|B|...)+} loop. Technically a decision state, but
  32195. // we don't use for code generation; somebody might need it, so I'm defining
  32196. // it for completeness. In reality, the {@link PlusLoopbackState} node is the
  32197. // real decision-making note for {@code A+}.
  32198. //
  32199. function PlusBlockStartState() {
  32200. BlockStartState.call(this);
  32201. this.stateType = ATNState.PLUS_BLOCK_START;
  32202. this.loopBackState = null;
  32203. return this;
  32204. }
  32205. PlusBlockStartState.prototype = Object.create(BlockStartState.prototype);
  32206. PlusBlockStartState.prototype.constructor = PlusBlockStartState;
  32207. // The block that begins a closure loop.
  32208. function StarBlockStartState() {
  32209. BlockStartState.call(this);
  32210. this.stateType = ATNState.STAR_BLOCK_START;
  32211. return this;
  32212. }
  32213. StarBlockStartState.prototype = Object.create(BlockStartState.prototype);
  32214. StarBlockStartState.prototype.constructor = StarBlockStartState;
  32215. function StarLoopbackState() {
  32216. ATNState.call(this);
  32217. this.stateType = ATNState.STAR_LOOP_BACK;
  32218. return this;
  32219. }
  32220. StarLoopbackState.prototype = Object.create(ATNState.prototype);
  32221. StarLoopbackState.prototype.constructor = StarLoopbackState;
  32222. function StarLoopEntryState() {
  32223. DecisionState.call(this);
  32224. this.stateType = ATNState.STAR_LOOP_ENTRY;
  32225. this.loopBackState = null;
  32226. // Indicates whether this state can benefit from a precedence DFA during SLL decision making.
  32227. this.isPrecedenceDecision = null;
  32228. return this;
  32229. }
  32230. StarLoopEntryState.prototype = Object.create(DecisionState.prototype);
  32231. StarLoopEntryState.prototype.constructor = StarLoopEntryState;
  32232. // Mark the end of a * or + loop.
  32233. function LoopEndState() {
  32234. ATNState.call(this);
  32235. this.stateType = ATNState.LOOP_END;
  32236. this.loopBackState = null;
  32237. return this;
  32238. }
  32239. LoopEndState.prototype = Object.create(ATNState.prototype);
  32240. LoopEndState.prototype.constructor = LoopEndState;
  32241. // The Tokens rule start state linking to each lexer rule start state */
  32242. function TokensStartState() {
  32243. DecisionState.call(this);
  32244. this.stateType = ATNState.TOKEN_START;
  32245. return this;
  32246. }
  32247. TokensStartState.prototype = Object.create(DecisionState.prototype);
  32248. TokensStartState.prototype.constructor = TokensStartState;
  32249. exports.ATNState = ATNState;
  32250. exports.BasicState = BasicState;
  32251. exports.DecisionState = DecisionState;
  32252. exports.BlockStartState = BlockStartState;
  32253. exports.BlockEndState = BlockEndState;
  32254. exports.LoopEndState = LoopEndState;
  32255. exports.RuleStartState = RuleStartState;
  32256. exports.RuleStopState = RuleStopState;
  32257. exports.TokensStartState = TokensStartState;
  32258. exports.PlusLoopbackState = PlusLoopbackState;
  32259. exports.StarLoopbackState = StarLoopbackState;
  32260. exports.StarLoopEntryState = StarLoopEntryState;
  32261. exports.PlusBlockStartState = PlusBlockStartState;
  32262. exports.StarBlockStartState = StarBlockStartState;
  32263. exports.BasicBlockStartState = BasicBlockStartState;
  32264. /***/ }),
  32265. /***/ "./node_modules/antlr4/atn/ATNType.js":
  32266. /*!********************************************!*\
  32267. !*** ./node_modules/antlr4/atn/ATNType.js ***!
  32268. \********************************************/
  32269. /*! no static exports found */
  32270. /***/ (function(module, exports) {
  32271. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  32272. * Use of this file is governed by the BSD 3-clause license that
  32273. * can be found in the LICENSE.txt file in the project root.
  32274. */
  32275. ///
  32276. // Represents the type of recognizer an ATN applies to.
  32277. function ATNType() {
  32278. }
  32279. ATNType.LEXER = 0;
  32280. ATNType.PARSER = 1;
  32281. exports.ATNType = ATNType;
  32282. /***/ }),
  32283. /***/ "./node_modules/antlr4/atn/LexerATNSimulator.js":
  32284. /*!******************************************************!*\
  32285. !*** ./node_modules/antlr4/atn/LexerATNSimulator.js ***!
  32286. \******************************************************/
  32287. /*! no static exports found */
  32288. /***/ (function(module, exports, __webpack_require__) {
  32289. //
  32290. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  32291. * Use of this file is governed by the BSD 3-clause license that
  32292. * can be found in the LICENSE.txt file in the project root.
  32293. */
  32294. ///
  32295. // When we hit an accept state in either the DFA or the ATN, we
  32296. // have to notify the character stream to start buffering characters
  32297. // via {@link IntStream//mark} and record the current state. The current sim state
  32298. // includes the current index into the input, the current line,
  32299. // and current character position in that line. Note that the Lexer is
  32300. // tracking the starting line and characterization of the token. These
  32301. // variables track the "state" of the simulator when it hits an accept state.
  32302. //
  32303. // <p>We track these variables separately for the DFA and ATN simulation
  32304. // because the DFA simulation often has to fail over to the ATN
  32305. // simulation. If the ATN simulation fails, we need the DFA to fall
  32306. // back to its previously accepted state, if any. If the ATN succeeds,
  32307. // then the ATN does the accept and the DFA simulator that invoked it
  32308. // can simply return the predicted token type.</p>
  32309. ///
  32310. var Token = __webpack_require__(/*! ./../Token */ "./node_modules/antlr4/Token.js").Token;
  32311. var Lexer = __webpack_require__(/*! ./../Lexer */ "./node_modules/antlr4/Lexer.js").Lexer;
  32312. var ATN = __webpack_require__(/*! ./ATN */ "./node_modules/antlr4/atn/ATN.js").ATN;
  32313. var ATNSimulator = __webpack_require__(/*! ./ATNSimulator */ "./node_modules/antlr4/atn/ATNSimulator.js").ATNSimulator;
  32314. var DFAState = __webpack_require__(/*! ./../dfa/DFAState */ "./node_modules/antlr4/dfa/DFAState.js").DFAState;
  32315. var ATNConfigSet = __webpack_require__(/*! ./ATNConfigSet */ "./node_modules/antlr4/atn/ATNConfigSet.js").ATNConfigSet;
  32316. var OrderedATNConfigSet = __webpack_require__(/*! ./ATNConfigSet */ "./node_modules/antlr4/atn/ATNConfigSet.js").OrderedATNConfigSet;
  32317. var PredictionContext = __webpack_require__(/*! ./../PredictionContext */ "./node_modules/antlr4/PredictionContext.js").PredictionContext;
  32318. var SingletonPredictionContext = __webpack_require__(/*! ./../PredictionContext */ "./node_modules/antlr4/PredictionContext.js").SingletonPredictionContext;
  32319. var RuleStopState = __webpack_require__(/*! ./ATNState */ "./node_modules/antlr4/atn/ATNState.js").RuleStopState;
  32320. var LexerATNConfig = __webpack_require__(/*! ./ATNConfig */ "./node_modules/antlr4/atn/ATNConfig.js").LexerATNConfig;
  32321. var Transition = __webpack_require__(/*! ./Transition */ "./node_modules/antlr4/atn/Transition.js").Transition;
  32322. var LexerActionExecutor = __webpack_require__(/*! ./LexerActionExecutor */ "./node_modules/antlr4/atn/LexerActionExecutor.js").LexerActionExecutor;
  32323. var LexerNoViableAltException = __webpack_require__(/*! ./../error/Errors */ "./node_modules/antlr4/error/Errors.js").LexerNoViableAltException;
  32324. function resetSimState(sim) {
  32325. sim.index = -1;
  32326. sim.line = 0;
  32327. sim.column = -1;
  32328. sim.dfaState = null;
  32329. }
  32330. function SimState() {
  32331. resetSimState(this);
  32332. return this;
  32333. }
  32334. SimState.prototype.reset = function() {
  32335. resetSimState(this);
  32336. };
  32337. function LexerATNSimulator(recog, atn, decisionToDFA, sharedContextCache) {
  32338. ATNSimulator.call(this, atn, sharedContextCache);
  32339. this.decisionToDFA = decisionToDFA;
  32340. this.recog = recog;
  32341. // The current token's starting index into the character stream.
  32342. // Shared across DFA to ATN simulation in case the ATN fails and the
  32343. // DFA did not have a previous accept state. In this case, we use the
  32344. // ATN-generated exception object.
  32345. this.startIndex = -1;
  32346. // line number 1..n within the input///
  32347. this.line = 1;
  32348. // The index of the character relative to the beginning of the line
  32349. // 0..n-1///
  32350. this.column = 0;
  32351. this.mode = Lexer.DEFAULT_MODE;
  32352. // Used during DFA/ATN exec to record the most recent accept configuration
  32353. // info
  32354. this.prevAccept = new SimState();
  32355. // done
  32356. return this;
  32357. }
  32358. LexerATNSimulator.prototype = Object.create(ATNSimulator.prototype);
  32359. LexerATNSimulator.prototype.constructor = LexerATNSimulator;
  32360. LexerATNSimulator.debug = false;
  32361. LexerATNSimulator.dfa_debug = false;
  32362. LexerATNSimulator.MIN_DFA_EDGE = 0;
  32363. LexerATNSimulator.MAX_DFA_EDGE = 127; // forces unicode to stay in ATN
  32364. LexerATNSimulator.match_calls = 0;
  32365. LexerATNSimulator.prototype.copyState = function(simulator) {
  32366. this.column = simulator.column;
  32367. this.line = simulator.line;
  32368. this.mode = simulator.mode;
  32369. this.startIndex = simulator.startIndex;
  32370. };
  32371. LexerATNSimulator.prototype.match = function(input, mode) {
  32372. this.match_calls += 1;
  32373. this.mode = mode;
  32374. var mark = input.mark();
  32375. try {
  32376. this.startIndex = input.index;
  32377. this.prevAccept.reset();
  32378. var dfa = this.decisionToDFA[mode];
  32379. if (dfa.s0 === null) {
  32380. return this.matchATN(input);
  32381. } else {
  32382. return this.execATN(input, dfa.s0);
  32383. }
  32384. } finally {
  32385. input.release(mark);
  32386. }
  32387. };
  32388. LexerATNSimulator.prototype.reset = function() {
  32389. this.prevAccept.reset();
  32390. this.startIndex = -1;
  32391. this.line = 1;
  32392. this.column = 0;
  32393. this.mode = Lexer.DEFAULT_MODE;
  32394. };
  32395. LexerATNSimulator.prototype.matchATN = function(input) {
  32396. var startState = this.atn.modeToStartState[this.mode];
  32397. if (LexerATNSimulator.debug) {
  32398. console.log("matchATN mode " + this.mode + " start: " + startState);
  32399. }
  32400. var old_mode = this.mode;
  32401. var s0_closure = this.computeStartState(input, startState);
  32402. var suppressEdge = s0_closure.hasSemanticContext;
  32403. s0_closure.hasSemanticContext = false;
  32404. var next = this.addDFAState(s0_closure);
  32405. if (!suppressEdge) {
  32406. this.decisionToDFA[this.mode].s0 = next;
  32407. }
  32408. var predict = this.execATN(input, next);
  32409. if (LexerATNSimulator.debug) {
  32410. console.log("DFA after matchATN: " + this.decisionToDFA[old_mode].toLexerString());
  32411. }
  32412. return predict;
  32413. };
  32414. LexerATNSimulator.prototype.execATN = function(input, ds0) {
  32415. if (LexerATNSimulator.debug) {
  32416. console.log("start state closure=" + ds0.configs);
  32417. }
  32418. if (ds0.isAcceptState) {
  32419. // allow zero-length tokens
  32420. this.captureSimState(this.prevAccept, input, ds0);
  32421. }
  32422. var t = input.LA(1);
  32423. var s = ds0; // s is current/from DFA state
  32424. while (true) { // while more work
  32425. if (LexerATNSimulator.debug) {
  32426. console.log("execATN loop starting closure: " + s.configs);
  32427. }
  32428. // As we move src->trg, src->trg, we keep track of the previous trg to
  32429. // avoid looking up the DFA state again, which is expensive.
  32430. // If the previous target was already part of the DFA, we might
  32431. // be able to avoid doing a reach operation upon t. If s!=null,
  32432. // it means that semantic predicates didn't prevent us from
  32433. // creating a DFA state. Once we know s!=null, we check to see if
  32434. // the DFA state has an edge already for t. If so, we can just reuse
  32435. // it's configuration set; there's no point in re-computing it.
  32436. // This is kind of like doing DFA simulation within the ATN
  32437. // simulation because DFA simulation is really just a way to avoid
  32438. // computing reach/closure sets. Technically, once we know that
  32439. // we have a previously added DFA state, we could jump over to
  32440. // the DFA simulator. But, that would mean popping back and forth
  32441. // a lot and making things more complicated algorithmically.
  32442. // This optimization makes a lot of sense for loops within DFA.
  32443. // A character will take us back to an existing DFA state
  32444. // that already has lots of edges out of it. e.g., .* in comments.
  32445. // print("Target for:" + str(s) + " and:" + str(t))
  32446. var target = this.getExistingTargetState(s, t);
  32447. // print("Existing:" + str(target))
  32448. if (target === null) {
  32449. target = this.computeTargetState(input, s, t);
  32450. // print("Computed:" + str(target))
  32451. }
  32452. if (target === ATNSimulator.ERROR) {
  32453. break;
  32454. }
  32455. // If this is a consumable input element, make sure to consume before
  32456. // capturing the accept state so the input index, line, and char
  32457. // position accurately reflect the state of the interpreter at the
  32458. // end of the token.
  32459. if (t !== Token.EOF) {
  32460. this.consume(input);
  32461. }
  32462. if (target.isAcceptState) {
  32463. this.captureSimState(this.prevAccept, input, target);
  32464. if (t === Token.EOF) {
  32465. break;
  32466. }
  32467. }
  32468. t = input.LA(1);
  32469. s = target; // flip; current DFA target becomes new src/from state
  32470. }
  32471. return this.failOrAccept(this.prevAccept, input, s.configs, t);
  32472. };
  32473. // Get an existing target state for an edge in the DFA. If the target state
  32474. // for the edge has not yet been computed or is otherwise not available,
  32475. // this method returns {@code null}.
  32476. //
  32477. // @param s The current DFA state
  32478. // @param t The next input symbol
  32479. // @return The existing target DFA state for the given input symbol
  32480. // {@code t}, or {@code null} if the target state for this edge is not
  32481. // already cached
  32482. LexerATNSimulator.prototype.getExistingTargetState = function(s, t) {
  32483. if (s.edges === null || t < LexerATNSimulator.MIN_DFA_EDGE || t > LexerATNSimulator.MAX_DFA_EDGE) {
  32484. return null;
  32485. }
  32486. var target = s.edges[t - LexerATNSimulator.MIN_DFA_EDGE];
  32487. if(target===undefined) {
  32488. target = null;
  32489. }
  32490. if (LexerATNSimulator.debug && target !== null) {
  32491. console.log("reuse state " + s.stateNumber + " edge to " + target.stateNumber);
  32492. }
  32493. return target;
  32494. };
  32495. // Compute a target state for an edge in the DFA, and attempt to add the
  32496. // computed state and corresponding edge to the DFA.
  32497. //
  32498. // @param input The input stream
  32499. // @param s The current DFA state
  32500. // @param t The next input symbol
  32501. //
  32502. // @return The computed target DFA state for the given input symbol
  32503. // {@code t}. If {@code t} does not lead to a valid DFA state, this method
  32504. // returns {@link //ERROR}.
  32505. LexerATNSimulator.prototype.computeTargetState = function(input, s, t) {
  32506. var reach = new OrderedATNConfigSet();
  32507. // if we don't find an existing DFA state
  32508. // Fill reach starting from closure, following t transitions
  32509. this.getReachableConfigSet(input, s.configs, reach, t);
  32510. if (reach.items.length === 0) { // we got nowhere on t from s
  32511. if (!reach.hasSemanticContext) {
  32512. // we got nowhere on t, don't throw out this knowledge; it'd
  32513. // cause a failover from DFA later.
  32514. this.addDFAEdge(s, t, ATNSimulator.ERROR);
  32515. }
  32516. // stop when we can't match any more char
  32517. return ATNSimulator.ERROR;
  32518. }
  32519. // Add an edge from s to target DFA found/created for reach
  32520. return this.addDFAEdge(s, t, null, reach);
  32521. };
  32522. LexerATNSimulator.prototype.failOrAccept = function(prevAccept, input, reach, t) {
  32523. if (this.prevAccept.dfaState !== null) {
  32524. var lexerActionExecutor = prevAccept.dfaState.lexerActionExecutor;
  32525. this.accept(input, lexerActionExecutor, this.startIndex,
  32526. prevAccept.index, prevAccept.line, prevAccept.column);
  32527. return prevAccept.dfaState.prediction;
  32528. } else {
  32529. // if no accept and EOF is first char, return EOF
  32530. if (t === Token.EOF && input.index === this.startIndex) {
  32531. return Token.EOF;
  32532. }
  32533. throw new LexerNoViableAltException(this.recog, input, this.startIndex, reach);
  32534. }
  32535. };
  32536. // Given a starting configuration set, figure out all ATN configurations
  32537. // we can reach upon input {@code t}. Parameter {@code reach} is a return
  32538. // parameter.
  32539. LexerATNSimulator.prototype.getReachableConfigSet = function(input, closure,
  32540. reach, t) {
  32541. // this is used to skip processing for configs which have a lower priority
  32542. // than a config that already reached an accept state for the same rule
  32543. var skipAlt = ATN.INVALID_ALT_NUMBER;
  32544. for (var i = 0; i < closure.items.length; i++) {
  32545. var cfg = closure.items[i];
  32546. var currentAltReachedAcceptState = (cfg.alt === skipAlt);
  32547. if (currentAltReachedAcceptState && cfg.passedThroughNonGreedyDecision) {
  32548. continue;
  32549. }
  32550. if (LexerATNSimulator.debug) {
  32551. console.log("testing %s at %s\n", this.getTokenName(t), cfg
  32552. .toString(this.recog, true));
  32553. }
  32554. for (var j = 0; j < cfg.state.transitions.length; j++) {
  32555. var trans = cfg.state.transitions[j]; // for each transition
  32556. var target = this.getReachableTarget(trans, t);
  32557. if (target !== null) {
  32558. var lexerActionExecutor = cfg.lexerActionExecutor;
  32559. if (lexerActionExecutor !== null) {
  32560. lexerActionExecutor = lexerActionExecutor.fixOffsetBeforeMatch(input.index - this.startIndex);
  32561. }
  32562. var treatEofAsEpsilon = (t === Token.EOF);
  32563. var config = new LexerATNConfig({state:target, lexerActionExecutor:lexerActionExecutor}, cfg);
  32564. if (this.closure(input, config, reach,
  32565. currentAltReachedAcceptState, true, treatEofAsEpsilon)) {
  32566. // any remaining configs for this alt have a lower priority
  32567. // than the one that just reached an accept state.
  32568. skipAlt = cfg.alt;
  32569. }
  32570. }
  32571. }
  32572. }
  32573. };
  32574. LexerATNSimulator.prototype.accept = function(input, lexerActionExecutor,
  32575. startIndex, index, line, charPos) {
  32576. if (LexerATNSimulator.debug) {
  32577. console.log("ACTION %s\n", lexerActionExecutor);
  32578. }
  32579. // seek to after last char in token
  32580. input.seek(index);
  32581. this.line = line;
  32582. this.column = charPos;
  32583. if (lexerActionExecutor !== null && this.recog !== null) {
  32584. lexerActionExecutor.execute(this.recog, input, startIndex);
  32585. }
  32586. };
  32587. LexerATNSimulator.prototype.getReachableTarget = function(trans, t) {
  32588. if (trans.matches(t, 0, Lexer.MAX_CHAR_VALUE)) {
  32589. return trans.target;
  32590. } else {
  32591. return null;
  32592. }
  32593. };
  32594. LexerATNSimulator.prototype.computeStartState = function(input, p) {
  32595. var initialContext = PredictionContext.EMPTY;
  32596. var configs = new OrderedATNConfigSet();
  32597. for (var i = 0; i < p.transitions.length; i++) {
  32598. var target = p.transitions[i].target;
  32599. var cfg = new LexerATNConfig({state:target, alt:i+1, context:initialContext}, null);
  32600. this.closure(input, cfg, configs, false, false, false);
  32601. }
  32602. return configs;
  32603. };
  32604. // Since the alternatives within any lexer decision are ordered by
  32605. // preference, this method stops pursuing the closure as soon as an accept
  32606. // state is reached. After the first accept state is reached by depth-first
  32607. // search from {@code config}, all other (potentially reachable) states for
  32608. // this rule would have a lower priority.
  32609. //
  32610. // @return {@code true} if an accept state is reached, otherwise
  32611. // {@code false}.
  32612. LexerATNSimulator.prototype.closure = function(input, config, configs,
  32613. currentAltReachedAcceptState, speculative, treatEofAsEpsilon) {
  32614. var cfg = null;
  32615. if (LexerATNSimulator.debug) {
  32616. console.log("closure(" + config.toString(this.recog, true) + ")");
  32617. }
  32618. if (config.state instanceof RuleStopState) {
  32619. if (LexerATNSimulator.debug) {
  32620. if (this.recog !== null) {
  32621. console.log("closure at %s rule stop %s\n", this.recog.ruleNames[config.state.ruleIndex], config);
  32622. } else {
  32623. console.log("closure at rule stop %s\n", config);
  32624. }
  32625. }
  32626. if (config.context === null || config.context.hasEmptyPath()) {
  32627. if (config.context === null || config.context.isEmpty()) {
  32628. configs.add(config);
  32629. return true;
  32630. } else {
  32631. configs.add(new LexerATNConfig({ state:config.state, context:PredictionContext.EMPTY}, config));
  32632. currentAltReachedAcceptState = true;
  32633. }
  32634. }
  32635. if (config.context !== null && !config.context.isEmpty()) {
  32636. for (var i = 0; i < config.context.length; i++) {
  32637. if (config.context.getReturnState(i) !== PredictionContext.EMPTY_RETURN_STATE) {
  32638. var newContext = config.context.getParent(i); // "pop" return state
  32639. var returnState = this.atn.states[config.context.getReturnState(i)];
  32640. cfg = new LexerATNConfig({ state:returnState, context:newContext }, config);
  32641. currentAltReachedAcceptState = this.closure(input, cfg,
  32642. configs, currentAltReachedAcceptState, speculative,
  32643. treatEofAsEpsilon);
  32644. }
  32645. }
  32646. }
  32647. return currentAltReachedAcceptState;
  32648. }
  32649. // optimization
  32650. if (!config.state.epsilonOnlyTransitions) {
  32651. if (!currentAltReachedAcceptState || !config.passedThroughNonGreedyDecision) {
  32652. configs.add(config);
  32653. }
  32654. }
  32655. for (var j = 0; j < config.state.transitions.length; j++) {
  32656. var trans = config.state.transitions[j];
  32657. cfg = this.getEpsilonTarget(input, config, trans, configs, speculative, treatEofAsEpsilon);
  32658. if (cfg !== null) {
  32659. currentAltReachedAcceptState = this.closure(input, cfg, configs,
  32660. currentAltReachedAcceptState, speculative, treatEofAsEpsilon);
  32661. }
  32662. }
  32663. return currentAltReachedAcceptState;
  32664. };
  32665. // side-effect: can alter configs.hasSemanticContext
  32666. LexerATNSimulator.prototype.getEpsilonTarget = function(input, config, trans,
  32667. configs, speculative, treatEofAsEpsilon) {
  32668. var cfg = null;
  32669. if (trans.serializationType === Transition.RULE) {
  32670. var newContext = SingletonPredictionContext.create(config.context, trans.followState.stateNumber);
  32671. cfg = new LexerATNConfig( { state:trans.target, context:newContext}, config);
  32672. } else if (trans.serializationType === Transition.PRECEDENCE) {
  32673. throw "Precedence predicates are not supported in lexers.";
  32674. } else if (trans.serializationType === Transition.PREDICATE) {
  32675. // Track traversing semantic predicates. If we traverse,
  32676. // we cannot add a DFA state for this "reach" computation
  32677. // because the DFA would not test the predicate again in the
  32678. // future. Rather than creating collections of semantic predicates
  32679. // like v3 and testing them on prediction, v4 will test them on the
  32680. // fly all the time using the ATN not the DFA. This is slower but
  32681. // semantically it's not used that often. One of the key elements to
  32682. // this predicate mechanism is not adding DFA states that see
  32683. // predicates immediately afterwards in the ATN. For example,
  32684. // a : ID {p1}? | ID {p2}? ;
  32685. // should create the start state for rule 'a' (to save start state
  32686. // competition), but should not create target of ID state. The
  32687. // collection of ATN states the following ID references includes
  32688. // states reached by traversing predicates. Since this is when we
  32689. // test them, we cannot cash the DFA state target of ID.
  32690. if (LexerATNSimulator.debug) {
  32691. console.log("EVAL rule " + trans.ruleIndex + ":" + trans.predIndex);
  32692. }
  32693. configs.hasSemanticContext = true;
  32694. if (this.evaluatePredicate(input, trans.ruleIndex, trans.predIndex, speculative)) {
  32695. cfg = new LexerATNConfig({ state:trans.target}, config);
  32696. }
  32697. } else if (trans.serializationType === Transition.ACTION) {
  32698. if (config.context === null || config.context.hasEmptyPath()) {
  32699. // execute actions anywhere in the start rule for a token.
  32700. //
  32701. // TODO: if the entry rule is invoked recursively, some
  32702. // actions may be executed during the recursive call. The
  32703. // problem can appear when hasEmptyPath() is true but
  32704. // isEmpty() is false. In this case, the config needs to be
  32705. // split into two contexts - one with just the empty path
  32706. // and another with everything but the empty path.
  32707. // Unfortunately, the current algorithm does not allow
  32708. // getEpsilonTarget to return two configurations, so
  32709. // additional modifications are needed before we can support
  32710. // the split operation.
  32711. var lexerActionExecutor = LexerActionExecutor.append(config.lexerActionExecutor,
  32712. this.atn.lexerActions[trans.actionIndex]);
  32713. cfg = new LexerATNConfig({ state:trans.target, lexerActionExecutor:lexerActionExecutor }, config);
  32714. } else {
  32715. // ignore actions in referenced rules
  32716. cfg = new LexerATNConfig( { state:trans.target}, config);
  32717. }
  32718. } else if (trans.serializationType === Transition.EPSILON) {
  32719. cfg = new LexerATNConfig({ state:trans.target}, config);
  32720. } else if (trans.serializationType === Transition.ATOM ||
  32721. trans.serializationType === Transition.RANGE ||
  32722. trans.serializationType === Transition.SET) {
  32723. if (treatEofAsEpsilon) {
  32724. if (trans.matches(Token.EOF, 0, Lexer.MAX_CHAR_VALUE)) {
  32725. cfg = new LexerATNConfig( { state:trans.target }, config);
  32726. }
  32727. }
  32728. }
  32729. return cfg;
  32730. };
  32731. // Evaluate a predicate specified in the lexer.
  32732. //
  32733. // <p>If {@code speculative} is {@code true}, this method was called before
  32734. // {@link //consume} for the matched character. This method should call
  32735. // {@link //consume} before evaluating the predicate to ensure position
  32736. // sensitive values, including {@link Lexer//getText}, {@link Lexer//getLine},
  32737. // and {@link Lexer//getcolumn}, properly reflect the current
  32738. // lexer state. This method should restore {@code input} and the simulator
  32739. // to the original state before returning (i.e. undo the actions made by the
  32740. // call to {@link //consume}.</p>
  32741. //
  32742. // @param input The input stream.
  32743. // @param ruleIndex The rule containing the predicate.
  32744. // @param predIndex The index of the predicate within the rule.
  32745. // @param speculative {@code true} if the current index in {@code input} is
  32746. // one character before the predicate's location.
  32747. //
  32748. // @return {@code true} if the specified predicate evaluates to
  32749. // {@code true}.
  32750. // /
  32751. LexerATNSimulator.prototype.evaluatePredicate = function(input, ruleIndex,
  32752. predIndex, speculative) {
  32753. // assume true if no recognizer was provided
  32754. if (this.recog === null) {
  32755. return true;
  32756. }
  32757. if (!speculative) {
  32758. return this.recog.sempred(null, ruleIndex, predIndex);
  32759. }
  32760. var savedcolumn = this.column;
  32761. var savedLine = this.line;
  32762. var index = input.index;
  32763. var marker = input.mark();
  32764. try {
  32765. this.consume(input);
  32766. return this.recog.sempred(null, ruleIndex, predIndex);
  32767. } finally {
  32768. this.column = savedcolumn;
  32769. this.line = savedLine;
  32770. input.seek(index);
  32771. input.release(marker);
  32772. }
  32773. };
  32774. LexerATNSimulator.prototype.captureSimState = function(settings, input, dfaState) {
  32775. settings.index = input.index;
  32776. settings.line = this.line;
  32777. settings.column = this.column;
  32778. settings.dfaState = dfaState;
  32779. };
  32780. LexerATNSimulator.prototype.addDFAEdge = function(from_, tk, to, cfgs) {
  32781. if (to === undefined) {
  32782. to = null;
  32783. }
  32784. if (cfgs === undefined) {
  32785. cfgs = null;
  32786. }
  32787. if (to === null && cfgs !== null) {
  32788. // leading to this call, ATNConfigSet.hasSemanticContext is used as a
  32789. // marker indicating dynamic predicate evaluation makes this edge
  32790. // dependent on the specific input sequence, so the static edge in the
  32791. // DFA should be omitted. The target DFAState is still created since
  32792. // execATN has the ability to resynchronize with the DFA state cache
  32793. // following the predicate evaluation step.
  32794. //
  32795. // TJP notes: next time through the DFA, we see a pred again and eval.
  32796. // If that gets us to a previously created (but dangling) DFA
  32797. // state, we can continue in pure DFA mode from there.
  32798. // /
  32799. var suppressEdge = cfgs.hasSemanticContext;
  32800. cfgs.hasSemanticContext = false;
  32801. to = this.addDFAState(cfgs);
  32802. if (suppressEdge) {
  32803. return to;
  32804. }
  32805. }
  32806. // add the edge
  32807. if (tk < LexerATNSimulator.MIN_DFA_EDGE || tk > LexerATNSimulator.MAX_DFA_EDGE) {
  32808. // Only track edges within the DFA bounds
  32809. return to;
  32810. }
  32811. if (LexerATNSimulator.debug) {
  32812. console.log("EDGE " + from_ + " -> " + to + " upon " + tk);
  32813. }
  32814. if (from_.edges === null) {
  32815. // make room for tokens 1..n and -1 masquerading as index 0
  32816. from_.edges = [];
  32817. }
  32818. from_.edges[tk - LexerATNSimulator.MIN_DFA_EDGE] = to; // connect
  32819. return to;
  32820. };
  32821. // Add a new DFA state if there isn't one with this set of
  32822. // configurations already. This method also detects the first
  32823. // configuration containing an ATN rule stop state. Later, when
  32824. // traversing the DFA, we will know which rule to accept.
  32825. LexerATNSimulator.prototype.addDFAState = function(configs) {
  32826. var proposed = new DFAState(null, configs);
  32827. var firstConfigWithRuleStopState = null;
  32828. for (var i = 0; i < configs.items.length; i++) {
  32829. var cfg = configs.items[i];
  32830. if (cfg.state instanceof RuleStopState) {
  32831. firstConfigWithRuleStopState = cfg;
  32832. break;
  32833. }
  32834. }
  32835. if (firstConfigWithRuleStopState !== null) {
  32836. proposed.isAcceptState = true;
  32837. proposed.lexerActionExecutor = firstConfigWithRuleStopState.lexerActionExecutor;
  32838. proposed.prediction = this.atn.ruleToTokenType[firstConfigWithRuleStopState.state.ruleIndex];
  32839. }
  32840. var dfa = this.decisionToDFA[this.mode];
  32841. var existing = dfa.states.get(proposed);
  32842. if (existing!==null) {
  32843. return existing;
  32844. }
  32845. var newState = proposed;
  32846. newState.stateNumber = dfa.states.length;
  32847. configs.setReadonly(true);
  32848. newState.configs = configs;
  32849. dfa.states.add(newState);
  32850. return newState;
  32851. };
  32852. LexerATNSimulator.prototype.getDFA = function(mode) {
  32853. return this.decisionToDFA[mode];
  32854. };
  32855. // Get the text matched so far for the current token.
  32856. LexerATNSimulator.prototype.getText = function(input) {
  32857. // index is first lookahead char, don't include.
  32858. return input.getText(this.startIndex, input.index - 1);
  32859. };
  32860. LexerATNSimulator.prototype.consume = function(input) {
  32861. var curChar = input.LA(1);
  32862. if (curChar === "\n".charCodeAt(0)) {
  32863. this.line += 1;
  32864. this.column = 0;
  32865. } else {
  32866. this.column += 1;
  32867. }
  32868. input.consume();
  32869. };
  32870. LexerATNSimulator.prototype.getTokenName = function(tt) {
  32871. if (tt === -1) {
  32872. return "EOF";
  32873. } else {
  32874. return "'" + String.fromCharCode(tt) + "'";
  32875. }
  32876. };
  32877. exports.LexerATNSimulator = LexerATNSimulator;
  32878. /***/ }),
  32879. /***/ "./node_modules/antlr4/atn/LexerAction.js":
  32880. /*!************************************************!*\
  32881. !*** ./node_modules/antlr4/atn/LexerAction.js ***!
  32882. \************************************************/
  32883. /*! no static exports found */
  32884. /***/ (function(module, exports) {
  32885. //
  32886. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  32887. * Use of this file is governed by the BSD 3-clause license that
  32888. * can be found in the LICENSE.txt file in the project root.
  32889. */
  32890. //
  32891. function LexerActionType() {
  32892. }
  32893. LexerActionType.CHANNEL = 0; //The type of a {@link LexerChannelAction} action.
  32894. LexerActionType.CUSTOM = 1; //The type of a {@link LexerCustomAction} action.
  32895. LexerActionType.MODE = 2; //The type of a {@link LexerModeAction} action.
  32896. LexerActionType.MORE = 3; //The type of a {@link LexerMoreAction} action.
  32897. LexerActionType.POP_MODE = 4; //The type of a {@link LexerPopModeAction} action.
  32898. LexerActionType.PUSH_MODE = 5; //The type of a {@link LexerPushModeAction} action.
  32899. LexerActionType.SKIP = 6; //The type of a {@link LexerSkipAction} action.
  32900. LexerActionType.TYPE = 7; //The type of a {@link LexerTypeAction} action.
  32901. function LexerAction(action) {
  32902. this.actionType = action;
  32903. this.isPositionDependent = false;
  32904. return this;
  32905. }
  32906. LexerAction.prototype.hashCode = function() {
  32907. var hash = new Hash();
  32908. this.updateHashCode(hash);
  32909. return hash.finish()
  32910. };
  32911. LexerAction.prototype.updateHashCode = function(hash) {
  32912. hash.update(this.actionType);
  32913. };
  32914. LexerAction.prototype.equals = function(other) {
  32915. return this === other;
  32916. };
  32917. //
  32918. // Implements the {@code skip} lexer action by calling {@link Lexer//skip}.
  32919. //
  32920. // <p>The {@code skip} command does not have any parameters, so this action is
  32921. // implemented as a singleton instance exposed by {@link //INSTANCE}.</p>
  32922. function LexerSkipAction() {
  32923. LexerAction.call(this, LexerActionType.SKIP);
  32924. return this;
  32925. }
  32926. LexerSkipAction.prototype = Object.create(LexerAction.prototype);
  32927. LexerSkipAction.prototype.constructor = LexerSkipAction;
  32928. // Provides a singleton instance of this parameterless lexer action.
  32929. LexerSkipAction.INSTANCE = new LexerSkipAction();
  32930. LexerSkipAction.prototype.execute = function(lexer) {
  32931. lexer.skip();
  32932. };
  32933. LexerSkipAction.prototype.toString = function() {
  32934. return "skip";
  32935. };
  32936. // Implements the {@code type} lexer action by calling {@link Lexer//setType}
  32937. // with the assigned type.
  32938. function LexerTypeAction(type) {
  32939. LexerAction.call(this, LexerActionType.TYPE);
  32940. this.type = type;
  32941. return this;
  32942. }
  32943. LexerTypeAction.prototype = Object.create(LexerAction.prototype);
  32944. LexerTypeAction.prototype.constructor = LexerTypeAction;
  32945. LexerTypeAction.prototype.execute = function(lexer) {
  32946. lexer.type = this.type;
  32947. };
  32948. LexerTypeAction.prototype.updateHashCode = function(hash) {
  32949. hash.update(this.actionType, this.type);
  32950. };
  32951. LexerTypeAction.prototype.equals = function(other) {
  32952. if(this === other) {
  32953. return true;
  32954. } else if (! (other instanceof LexerTypeAction)) {
  32955. return false;
  32956. } else {
  32957. return this.type === other.type;
  32958. }
  32959. };
  32960. LexerTypeAction.prototype.toString = function() {
  32961. return "type(" + this.type + ")";
  32962. };
  32963. // Implements the {@code pushMode} lexer action by calling
  32964. // {@link Lexer//pushMode} with the assigned mode.
  32965. function LexerPushModeAction(mode) {
  32966. LexerAction.call(this, LexerActionType.PUSH_MODE);
  32967. this.mode = mode;
  32968. return this;
  32969. }
  32970. LexerPushModeAction.prototype = Object.create(LexerAction.prototype);
  32971. LexerPushModeAction.prototype.constructor = LexerPushModeAction;
  32972. // <p>This action is implemented by calling {@link Lexer//pushMode} with the
  32973. // value provided by {@link //getMode}.</p>
  32974. LexerPushModeAction.prototype.execute = function(lexer) {
  32975. lexer.pushMode(this.mode);
  32976. };
  32977. LexerPushModeAction.prototype.updateHashCode = function(hash) {
  32978. hash.update(this.actionType, this.mode);
  32979. };
  32980. LexerPushModeAction.prototype.equals = function(other) {
  32981. if (this === other) {
  32982. return true;
  32983. } else if (! (other instanceof LexerPushModeAction)) {
  32984. return false;
  32985. } else {
  32986. return this.mode === other.mode;
  32987. }
  32988. };
  32989. LexerPushModeAction.prototype.toString = function() {
  32990. return "pushMode(" + this.mode + ")";
  32991. };
  32992. // Implements the {@code popMode} lexer action by calling {@link Lexer//popMode}.
  32993. //
  32994. // <p>The {@code popMode} command does not have any parameters, so this action is
  32995. // implemented as a singleton instance exposed by {@link //INSTANCE}.</p>
  32996. function LexerPopModeAction() {
  32997. LexerAction.call(this,LexerActionType.POP_MODE);
  32998. return this;
  32999. }
  33000. LexerPopModeAction.prototype = Object.create(LexerAction.prototype);
  33001. LexerPopModeAction.prototype.constructor = LexerPopModeAction;
  33002. LexerPopModeAction.INSTANCE = new LexerPopModeAction();
  33003. // <p>This action is implemented by calling {@link Lexer//popMode}.</p>
  33004. LexerPopModeAction.prototype.execute = function(lexer) {
  33005. lexer.popMode();
  33006. };
  33007. LexerPopModeAction.prototype.toString = function() {
  33008. return "popMode";
  33009. };
  33010. // Implements the {@code more} lexer action by calling {@link Lexer//more}.
  33011. //
  33012. // <p>The {@code more} command does not have any parameters, so this action is
  33013. // implemented as a singleton instance exposed by {@link //INSTANCE}.</p>
  33014. function LexerMoreAction() {
  33015. LexerAction.call(this, LexerActionType.MORE);
  33016. return this;
  33017. }
  33018. LexerMoreAction.prototype = Object.create(LexerAction.prototype);
  33019. LexerMoreAction.prototype.constructor = LexerMoreAction;
  33020. LexerMoreAction.INSTANCE = new LexerMoreAction();
  33021. // <p>This action is implemented by calling {@link Lexer//popMode}.</p>
  33022. LexerMoreAction.prototype.execute = function(lexer) {
  33023. lexer.more();
  33024. };
  33025. LexerMoreAction.prototype.toString = function() {
  33026. return "more";
  33027. };
  33028. // Implements the {@code mode} lexer action by calling {@link Lexer//mode} with
  33029. // the assigned mode.
  33030. function LexerModeAction(mode) {
  33031. LexerAction.call(this, LexerActionType.MODE);
  33032. this.mode = mode;
  33033. return this;
  33034. }
  33035. LexerModeAction.prototype = Object.create(LexerAction.prototype);
  33036. LexerModeAction.prototype.constructor = LexerModeAction;
  33037. // <p>This action is implemented by calling {@link Lexer//mode} with the
  33038. // value provided by {@link //getMode}.</p>
  33039. LexerModeAction.prototype.execute = function(lexer) {
  33040. lexer.mode(this.mode);
  33041. };
  33042. LexerModeAction.prototype.updateHashCode = function(hash) {
  33043. hash.update(this.actionType, this.mode);
  33044. };
  33045. LexerModeAction.prototype.equals = function(other) {
  33046. if (this === other) {
  33047. return true;
  33048. } else if (! (other instanceof LexerModeAction)) {
  33049. return false;
  33050. } else {
  33051. return this.mode === other.mode;
  33052. }
  33053. };
  33054. LexerModeAction.prototype.toString = function() {
  33055. return "mode(" + this.mode + ")";
  33056. };
  33057. // Executes a custom lexer action by calling {@link Recognizer//action} with the
  33058. // rule and action indexes assigned to the custom action. The implementation of
  33059. // a custom action is added to the generated code for the lexer in an override
  33060. // of {@link Recognizer//action} when the grammar is compiled.
  33061. //
  33062. // <p>This class may represent embedded actions created with the <code>{...}</code>
  33063. // syntax in ANTLR 4, as well as actions created for lexer commands where the
  33064. // command argument could not be evaluated when the grammar was compiled.</p>
  33065. // Constructs a custom lexer action with the specified rule and action
  33066. // indexes.
  33067. //
  33068. // @param ruleIndex The rule index to use for calls to
  33069. // {@link Recognizer//action}.
  33070. // @param actionIndex The action index to use for calls to
  33071. // {@link Recognizer//action}.
  33072. function LexerCustomAction(ruleIndex, actionIndex) {
  33073. LexerAction.call(this, LexerActionType.CUSTOM);
  33074. this.ruleIndex = ruleIndex;
  33075. this.actionIndex = actionIndex;
  33076. this.isPositionDependent = true;
  33077. return this;
  33078. }
  33079. LexerCustomAction.prototype = Object.create(LexerAction.prototype);
  33080. LexerCustomAction.prototype.constructor = LexerCustomAction;
  33081. // <p>Custom actions are implemented by calling {@link Lexer//action} with the
  33082. // appropriate rule and action indexes.</p>
  33083. LexerCustomAction.prototype.execute = function(lexer) {
  33084. lexer.action(null, this.ruleIndex, this.actionIndex);
  33085. };
  33086. LexerCustomAction.prototype.updateHashCode = function(hash) {
  33087. hash.update(this.actionType, this.ruleIndex, this.actionIndex);
  33088. };
  33089. LexerCustomAction.prototype.equals = function(other) {
  33090. if (this === other) {
  33091. return true;
  33092. } else if (! (other instanceof LexerCustomAction)) {
  33093. return false;
  33094. } else {
  33095. return this.ruleIndex === other.ruleIndex && this.actionIndex === other.actionIndex;
  33096. }
  33097. };
  33098. // Implements the {@code channel} lexer action by calling
  33099. // {@link Lexer//setChannel} with the assigned channel.
  33100. // Constructs a new {@code channel} action with the specified channel value.
  33101. // @param channel The channel value to pass to {@link Lexer//setChannel}.
  33102. function LexerChannelAction(channel) {
  33103. LexerAction.call(this, LexerActionType.CHANNEL);
  33104. this.channel = channel;
  33105. return this;
  33106. }
  33107. LexerChannelAction.prototype = Object.create(LexerAction.prototype);
  33108. LexerChannelAction.prototype.constructor = LexerChannelAction;
  33109. // <p>This action is implemented by calling {@link Lexer//setChannel} with the
  33110. // value provided by {@link //getChannel}.</p>
  33111. LexerChannelAction.prototype.execute = function(lexer) {
  33112. lexer._channel = this.channel;
  33113. };
  33114. LexerChannelAction.prototype.updateHashCode = function(hash) {
  33115. hash.update(this.actionType, this.channel);
  33116. };
  33117. LexerChannelAction.prototype.equals = function(other) {
  33118. if (this === other) {
  33119. return true;
  33120. } else if (! (other instanceof LexerChannelAction)) {
  33121. return false;
  33122. } else {
  33123. return this.channel === other.channel;
  33124. }
  33125. };
  33126. LexerChannelAction.prototype.toString = function() {
  33127. return "channel(" + this.channel + ")";
  33128. };
  33129. // This implementation of {@link LexerAction} is used for tracking input offsets
  33130. // for position-dependent actions within a {@link LexerActionExecutor}.
  33131. //
  33132. // <p>This action is not serialized as part of the ATN, and is only required for
  33133. // position-dependent lexer actions which appear at a location other than the
  33134. // end of a rule. For more information about DFA optimizations employed for
  33135. // lexer actions, see {@link LexerActionExecutor//append} and
  33136. // {@link LexerActionExecutor//fixOffsetBeforeMatch}.</p>
  33137. // Constructs a new indexed custom action by associating a character offset
  33138. // with a {@link LexerAction}.
  33139. //
  33140. // <p>Note: This class is only required for lexer actions for which
  33141. // {@link LexerAction//isPositionDependent} returns {@code true}.</p>
  33142. //
  33143. // @param offset The offset into the input {@link CharStream}, relative to
  33144. // the token start index, at which the specified lexer action should be
  33145. // executed.
  33146. // @param action The lexer action to execute at a particular offset in the
  33147. // input {@link CharStream}.
  33148. function LexerIndexedCustomAction(offset, action) {
  33149. LexerAction.call(this, action.actionType);
  33150. this.offset = offset;
  33151. this.action = action;
  33152. this.isPositionDependent = true;
  33153. return this;
  33154. }
  33155. LexerIndexedCustomAction.prototype = Object.create(LexerAction.prototype);
  33156. LexerIndexedCustomAction.prototype.constructor = LexerIndexedCustomAction;
  33157. // <p>This method calls {@link //execute} on the result of {@link //getAction}
  33158. // using the provided {@code lexer}.</p>
  33159. LexerIndexedCustomAction.prototype.execute = function(lexer) {
  33160. // assume the input stream position was properly set by the calling code
  33161. this.action.execute(lexer);
  33162. };
  33163. LexerIndexedCustomAction.prototype.updateHashCode = function(hash) {
  33164. hash.update(this.actionType, this.offset, this.action);
  33165. };
  33166. LexerIndexedCustomAction.prototype.equals = function(other) {
  33167. if (this === other) {
  33168. return true;
  33169. } else if (! (other instanceof LexerIndexedCustomAction)) {
  33170. return false;
  33171. } else {
  33172. return this.offset === other.offset && this.action === other.action;
  33173. }
  33174. };
  33175. exports.LexerActionType = LexerActionType;
  33176. exports.LexerSkipAction = LexerSkipAction;
  33177. exports.LexerChannelAction = LexerChannelAction;
  33178. exports.LexerCustomAction = LexerCustomAction;
  33179. exports.LexerIndexedCustomAction = LexerIndexedCustomAction;
  33180. exports.LexerMoreAction = LexerMoreAction;
  33181. exports.LexerTypeAction = LexerTypeAction;
  33182. exports.LexerPushModeAction = LexerPushModeAction;
  33183. exports.LexerPopModeAction = LexerPopModeAction;
  33184. exports.LexerModeAction = LexerModeAction;
  33185. /***/ }),
  33186. /***/ "./node_modules/antlr4/atn/LexerActionExecutor.js":
  33187. /*!********************************************************!*\
  33188. !*** ./node_modules/antlr4/atn/LexerActionExecutor.js ***!
  33189. \********************************************************/
  33190. /*! no static exports found */
  33191. /***/ (function(module, exports, __webpack_require__) {
  33192. //
  33193. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  33194. * Use of this file is governed by the BSD 3-clause license that
  33195. * can be found in the LICENSE.txt file in the project root.
  33196. */
  33197. ///
  33198. // Represents an executor for a sequence of lexer actions which traversed during
  33199. // the matching operation of a lexer rule (token).
  33200. //
  33201. // <p>The executor tracks position information for position-dependent lexer actions
  33202. // efficiently, ensuring that actions appearing only at the end of the rule do
  33203. // not cause bloating of the {@link DFA} created for the lexer.</p>
  33204. var hashStuff = __webpack_require__(/*! ../Utils */ "./node_modules/antlr4/Utils.js").hashStuff;
  33205. var LexerIndexedCustomAction = __webpack_require__(/*! ./LexerAction */ "./node_modules/antlr4/atn/LexerAction.js").LexerIndexedCustomAction;
  33206. function LexerActionExecutor(lexerActions) {
  33207. this.lexerActions = lexerActions === null ? [] : lexerActions;
  33208. // Caches the result of {@link //hashCode} since the hash code is an element
  33209. // of the performance-critical {@link LexerATNConfig//hashCode} operation.
  33210. this.cachedHashCode = hashStuff(lexerActions); // "".join([str(la) for la in
  33211. // lexerActions]))
  33212. return this;
  33213. }
  33214. // Creates a {@link LexerActionExecutor} which executes the actions for
  33215. // the input {@code lexerActionExecutor} followed by a specified
  33216. // {@code lexerAction}.
  33217. //
  33218. // @param lexerActionExecutor The executor for actions already traversed by
  33219. // the lexer while matching a token within a particular
  33220. // {@link LexerATNConfig}. If this is {@code null}, the method behaves as
  33221. // though it were an empty executor.
  33222. // @param lexerAction The lexer action to execute after the actions
  33223. // specified in {@code lexerActionExecutor}.
  33224. //
  33225. // @return A {@link LexerActionExecutor} for executing the combine actions
  33226. // of {@code lexerActionExecutor} and {@code lexerAction}.
  33227. LexerActionExecutor.append = function(lexerActionExecutor, lexerAction) {
  33228. if (lexerActionExecutor === null) {
  33229. return new LexerActionExecutor([ lexerAction ]);
  33230. }
  33231. var lexerActions = lexerActionExecutor.lexerActions.concat([ lexerAction ]);
  33232. return new LexerActionExecutor(lexerActions);
  33233. };
  33234. // Creates a {@link LexerActionExecutor} which encodes the current offset
  33235. // for position-dependent lexer actions.
  33236. //
  33237. // <p>Normally, when the executor encounters lexer actions where
  33238. // {@link LexerAction//isPositionDependent} returns {@code true}, it calls
  33239. // {@link IntStream//seek} on the input {@link CharStream} to set the input
  33240. // position to the <em>end</em> of the current token. This behavior provides
  33241. // for efficient DFA representation of lexer actions which appear at the end
  33242. // of a lexer rule, even when the lexer rule matches a variable number of
  33243. // characters.</p>
  33244. //
  33245. // <p>Prior to traversing a match transition in the ATN, the current offset
  33246. // from the token start index is assigned to all position-dependent lexer
  33247. // actions which have not already been assigned a fixed offset. By storing
  33248. // the offsets relative to the token start index, the DFA representation of
  33249. // lexer actions which appear in the middle of tokens remains efficient due
  33250. // to sharing among tokens of the same length, regardless of their absolute
  33251. // position in the input stream.</p>
  33252. //
  33253. // <p>If the current executor already has offsets assigned to all
  33254. // position-dependent lexer actions, the method returns {@code this}.</p>
  33255. //
  33256. // @param offset The current offset to assign to all position-dependent
  33257. // lexer actions which do not already have offsets assigned.
  33258. //
  33259. // @return A {@link LexerActionExecutor} which stores input stream offsets
  33260. // for all position-dependent lexer actions.
  33261. // /
  33262. LexerActionExecutor.prototype.fixOffsetBeforeMatch = function(offset) {
  33263. var updatedLexerActions = null;
  33264. for (var i = 0; i < this.lexerActions.length; i++) {
  33265. if (this.lexerActions[i].isPositionDependent &&
  33266. !(this.lexerActions[i] instanceof LexerIndexedCustomAction)) {
  33267. if (updatedLexerActions === null) {
  33268. updatedLexerActions = this.lexerActions.concat([]);
  33269. }
  33270. updatedLexerActions[i] = new LexerIndexedCustomAction(offset,
  33271. this.lexerActions[i]);
  33272. }
  33273. }
  33274. if (updatedLexerActions === null) {
  33275. return this;
  33276. } else {
  33277. return new LexerActionExecutor(updatedLexerActions);
  33278. }
  33279. };
  33280. // Execute the actions encapsulated by this executor within the context of a
  33281. // particular {@link Lexer}.
  33282. //
  33283. // <p>This method calls {@link IntStream//seek} to set the position of the
  33284. // {@code input} {@link CharStream} prior to calling
  33285. // {@link LexerAction//execute} on a position-dependent action. Before the
  33286. // method returns, the input position will be restored to the same position
  33287. // it was in when the method was invoked.</p>
  33288. //
  33289. // @param lexer The lexer instance.
  33290. // @param input The input stream which is the source for the current token.
  33291. // When this method is called, the current {@link IntStream//index} for
  33292. // {@code input} should be the start of the following token, i.e. 1
  33293. // character past the end of the current token.
  33294. // @param startIndex The token start index. This value may be passed to
  33295. // {@link IntStream//seek} to set the {@code input} position to the beginning
  33296. // of the token.
  33297. // /
  33298. LexerActionExecutor.prototype.execute = function(lexer, input, startIndex) {
  33299. var requiresSeek = false;
  33300. var stopIndex = input.index;
  33301. try {
  33302. for (var i = 0; i < this.lexerActions.length; i++) {
  33303. var lexerAction = this.lexerActions[i];
  33304. if (lexerAction instanceof LexerIndexedCustomAction) {
  33305. var offset = lexerAction.offset;
  33306. input.seek(startIndex + offset);
  33307. lexerAction = lexerAction.action;
  33308. requiresSeek = (startIndex + offset) !== stopIndex;
  33309. } else if (lexerAction.isPositionDependent) {
  33310. input.seek(stopIndex);
  33311. requiresSeek = false;
  33312. }
  33313. lexerAction.execute(lexer);
  33314. }
  33315. } finally {
  33316. if (requiresSeek) {
  33317. input.seek(stopIndex);
  33318. }
  33319. }
  33320. };
  33321. LexerActionExecutor.prototype.hashCode = function() {
  33322. return this.cachedHashCode;
  33323. };
  33324. LexerActionExecutor.prototype.updateHashCode = function(hash) {
  33325. hash.update(this.cachedHashCode);
  33326. };
  33327. LexerActionExecutor.prototype.equals = function(other) {
  33328. if (this === other) {
  33329. return true;
  33330. } else if (!(other instanceof LexerActionExecutor)) {
  33331. return false;
  33332. } else if (this.cachedHashCode != other.cachedHashCode) {
  33333. return false;
  33334. } else if (this.lexerActions.length != other.lexerActions.length) {
  33335. return false;
  33336. } else {
  33337. var numActions = this.lexerActions.length
  33338. for (var idx = 0; idx < numActions; ++idx) {
  33339. if (!this.lexerActions[idx].equals(other.lexerActions[idx])) {
  33340. return false;
  33341. }
  33342. }
  33343. return true;
  33344. }
  33345. };
  33346. exports.LexerActionExecutor = LexerActionExecutor;
  33347. /***/ }),
  33348. /***/ "./node_modules/antlr4/atn/ParserATNSimulator.js":
  33349. /*!*******************************************************!*\
  33350. !*** ./node_modules/antlr4/atn/ParserATNSimulator.js ***!
  33351. \*******************************************************/
  33352. /*! no static exports found */
  33353. /***/ (function(module, exports, __webpack_require__) {
  33354. //
  33355. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  33356. * Use of this file is governed by the BSD 3-clause license that
  33357. * can be found in the LICENSE.txt file in the project root.
  33358. */
  33359. //
  33360. //
  33361. // The embodiment of the adaptive LL(*), ALL(*), parsing strategy.
  33362. //
  33363. // <p>
  33364. // The basic complexity of the adaptive strategy makes it harder to understand.
  33365. // We begin with ATN simulation to build paths in a DFA. Subsequent prediction
  33366. // requests go through the DFA first. If they reach a state without an edge for
  33367. // the current symbol, the algorithm fails over to the ATN simulation to
  33368. // complete the DFA path for the current input (until it finds a conflict state
  33369. // or uniquely predicting state).</p>
  33370. //
  33371. // <p>
  33372. // All of that is done without using the outer context because we want to create
  33373. // a DFA that is not dependent upon the rule invocation stack when we do a
  33374. // prediction. One DFA works in all contexts. We avoid using context not
  33375. // necessarily because it's slower, although it can be, but because of the DFA
  33376. // caching problem. The closure routine only considers the rule invocation stack
  33377. // created during prediction beginning in the decision rule. For example, if
  33378. // prediction occurs without invoking another rule's ATN, there are no context
  33379. // stacks in the configurations. When lack of context leads to a conflict, we
  33380. // don't know if it's an ambiguity or a weakness in the strong LL(*) parsing
  33381. // strategy (versus full LL(*)).</p>
  33382. //
  33383. // <p>
  33384. // When SLL yields a configuration set with conflict, we rewind the input and
  33385. // retry the ATN simulation, this time using full outer context without adding
  33386. // to the DFA. Configuration context stacks will be the full invocation stacks
  33387. // from the start rule. If we get a conflict using full context, then we can
  33388. // definitively say we have a true ambiguity for that input sequence. If we
  33389. // don't get a conflict, it implies that the decision is sensitive to the outer
  33390. // context. (It is not context-sensitive in the sense of context-sensitive
  33391. // grammars.)</p>
  33392. //
  33393. // <p>
  33394. // The next time we reach this DFA state with an SLL conflict, through DFA
  33395. // simulation, we will again retry the ATN simulation using full context mode.
  33396. // This is slow because we can't save the results and have to "interpret" the
  33397. // ATN each time we get that input.</p>
  33398. //
  33399. // <p>
  33400. // <strong>CACHING FULL CONTEXT PREDICTIONS</strong></p>
  33401. //
  33402. // <p>
  33403. // We could cache results from full context to predicted alternative easily and
  33404. // that saves a lot of time but doesn't work in presence of predicates. The set
  33405. // of visible predicates from the ATN start state changes depending on the
  33406. // context, because closure can fall off the end of a rule. I tried to cache
  33407. // tuples (stack context, semantic context, predicted alt) but it was slower
  33408. // than interpreting and much more complicated. Also required a huge amount of
  33409. // memory. The goal is not to create the world's fastest parser anyway. I'd like
  33410. // to keep this algorithm simple. By launching multiple threads, we can improve
  33411. // the speed of parsing across a large number of files.</p>
  33412. //
  33413. // <p>
  33414. // There is no strict ordering between the amount of input used by SLL vs LL,
  33415. // which makes it really hard to build a cache for full context. Let's say that
  33416. // we have input A B C that leads to an SLL conflict with full context X. That
  33417. // implies that using X we might only use A B but we could also use A B C D to
  33418. // resolve conflict. Input A B C D could predict alternative 1 in one position
  33419. // in the input and A B C E could predict alternative 2 in another position in
  33420. // input. The conflicting SLL configurations could still be non-unique in the
  33421. // full context prediction, which would lead us to requiring more input than the
  33422. // original A B C. To make a prediction cache work, we have to track the exact
  33423. // input used during the previous prediction. That amounts to a cache that maps
  33424. // X to a specific DFA for that context.</p>
  33425. //
  33426. // <p>
  33427. // Something should be done for left-recursive expression predictions. They are
  33428. // likely LL(1) + pred eval. Easier to do the whole SLL unless error and retry
  33429. // with full LL thing Sam does.</p>
  33430. //
  33431. // <p>
  33432. // <strong>AVOIDING FULL CONTEXT PREDICTION</strong></p>
  33433. //
  33434. // <p>
  33435. // We avoid doing full context retry when the outer context is empty, we did not
  33436. // dip into the outer context by falling off the end of the decision state rule,
  33437. // or when we force SLL mode.</p>
  33438. //
  33439. // <p>
  33440. // As an example of the not dip into outer context case, consider as super
  33441. // constructor calls versus function calls. One grammar might look like
  33442. // this:</p>
  33443. //
  33444. // <pre>
  33445. // ctorBody
  33446. // : '{' superCall? stat* '}'
  33447. // ;
  33448. // </pre>
  33449. //
  33450. // <p>
  33451. // Or, you might see something like</p>
  33452. //
  33453. // <pre>
  33454. // stat
  33455. // : superCall ';'
  33456. // | expression ';'
  33457. // | ...
  33458. // ;
  33459. // </pre>
  33460. //
  33461. // <p>
  33462. // In both cases I believe that no closure operations will dip into the outer
  33463. // context. In the first case ctorBody in the worst case will stop at the '}'.
  33464. // In the 2nd case it should stop at the ';'. Both cases should stay within the
  33465. // entry rule and not dip into the outer context.</p>
  33466. //
  33467. // <p>
  33468. // <strong>PREDICATES</strong></p>
  33469. //
  33470. // <p>
  33471. // Predicates are always evaluated if present in either SLL or LL both. SLL and
  33472. // LL simulation deals with predicates differently. SLL collects predicates as
  33473. // it performs closure operations like ANTLR v3 did. It delays predicate
  33474. // evaluation until it reaches and accept state. This allows us to cache the SLL
  33475. // ATN simulation whereas, if we had evaluated predicates on-the-fly during
  33476. // closure, the DFA state configuration sets would be different and we couldn't
  33477. // build up a suitable DFA.</p>
  33478. //
  33479. // <p>
  33480. // When building a DFA accept state during ATN simulation, we evaluate any
  33481. // predicates and return the sole semantically valid alternative. If there is
  33482. // more than 1 alternative, we report an ambiguity. If there are 0 alternatives,
  33483. // we throw an exception. Alternatives without predicates act like they have
  33484. // true predicates. The simple way to think about it is to strip away all
  33485. // alternatives with false predicates and choose the minimum alternative that
  33486. // remains.</p>
  33487. //
  33488. // <p>
  33489. // When we start in the DFA and reach an accept state that's predicated, we test
  33490. // those and return the minimum semantically viable alternative. If no
  33491. // alternatives are viable, we throw an exception.</p>
  33492. //
  33493. // <p>
  33494. // During full LL ATN simulation, closure always evaluates predicates and
  33495. // on-the-fly. This is crucial to reducing the configuration set size during
  33496. // closure. It hits a landmine when parsing with the Java grammar, for example,
  33497. // without this on-the-fly evaluation.</p>
  33498. //
  33499. // <p>
  33500. // <strong>SHARING DFA</strong></p>
  33501. //
  33502. // <p>
  33503. // All instances of the same parser share the same decision DFAs through a
  33504. // static field. Each instance gets its own ATN simulator but they share the
  33505. // same {@link //decisionToDFA} field. They also share a
  33506. // {@link PredictionContextCache} object that makes sure that all
  33507. // {@link PredictionContext} objects are shared among the DFA states. This makes
  33508. // a big size difference.</p>
  33509. //
  33510. // <p>
  33511. // <strong>THREAD SAFETY</strong></p>
  33512. //
  33513. // <p>
  33514. // The {@link ParserATNSimulator} locks on the {@link //decisionToDFA} field when
  33515. // it adds a new DFA object to that array. {@link //addDFAEdge}
  33516. // locks on the DFA for the current decision when setting the
  33517. // {@link DFAState//edges} field. {@link //addDFAState} locks on
  33518. // the DFA for the current decision when looking up a DFA state to see if it
  33519. // already exists. We must make sure that all requests to add DFA states that
  33520. // are equivalent result in the same shared DFA object. This is because lots of
  33521. // threads will be trying to update the DFA at once. The
  33522. // {@link //addDFAState} method also locks inside the DFA lock
  33523. // but this time on the shared context cache when it rebuilds the
  33524. // configurations' {@link PredictionContext} objects using cached
  33525. // subgraphs/nodes. No other locking occurs, even during DFA simulation. This is
  33526. // safe as long as we can guarantee that all threads referencing
  33527. // {@code s.edge[t]} get the same physical target {@link DFAState}, or
  33528. // {@code null}. Once into the DFA, the DFA simulation does not reference the
  33529. // {@link DFA//states} map. It follows the {@link DFAState//edges} field to new
  33530. // targets. The DFA simulator will either find {@link DFAState//edges} to be
  33531. // {@code null}, to be non-{@code null} and {@code dfa.edges[t]} null, or
  33532. // {@code dfa.edges[t]} to be non-null. The
  33533. // {@link //addDFAEdge} method could be racing to set the field
  33534. // but in either case the DFA simulator works; if {@code null}, and requests ATN
  33535. // simulation. It could also race trying to get {@code dfa.edges[t]}, but either
  33536. // way it will work because it's not doing a test and set operation.</p>
  33537. //
  33538. // <p>
  33539. // <strong>Starting with SLL then failing to combined SLL/LL (Two-Stage
  33540. // Parsing)</strong></p>
  33541. //
  33542. // <p>
  33543. // Sam pointed out that if SLL does not give a syntax error, then there is no
  33544. // point in doing full LL, which is slower. We only have to try LL if we get a
  33545. // syntax error. For maximum speed, Sam starts the parser set to pure SLL
  33546. // mode with the {@link BailErrorStrategy}:</p>
  33547. //
  33548. // <pre>
  33549. // parser.{@link Parser//getInterpreter() getInterpreter()}.{@link //setPredictionMode setPredictionMode}{@code (}{@link PredictionMode//SLL}{@code )};
  33550. // parser.{@link Parser//setErrorHandler setErrorHandler}(new {@link BailErrorStrategy}());
  33551. // </pre>
  33552. //
  33553. // <p>
  33554. // If it does not get a syntax error, then we're done. If it does get a syntax
  33555. // error, we need to retry with the combined SLL/LL strategy.</p>
  33556. //
  33557. // <p>
  33558. // The reason this works is as follows. If there are no SLL conflicts, then the
  33559. // grammar is SLL (at least for that input set). If there is an SLL conflict,
  33560. // the full LL analysis must yield a set of viable alternatives which is a
  33561. // subset of the alternatives reported by SLL. If the LL set is a singleton,
  33562. // then the grammar is LL but not SLL. If the LL set is the same size as the SLL
  33563. // set, the decision is SLL. If the LL set has size &gt; 1, then that decision
  33564. // is truly ambiguous on the current input. If the LL set is smaller, then the
  33565. // SLL conflict resolution might choose an alternative that the full LL would
  33566. // rule out as a possibility based upon better context information. If that's
  33567. // the case, then the SLL parse will definitely get an error because the full LL
  33568. // analysis says it's not viable. If SLL conflict resolution chooses an
  33569. // alternative within the LL set, them both SLL and LL would choose the same
  33570. // alternative because they both choose the minimum of multiple conflicting
  33571. // alternatives.</p>
  33572. //
  33573. // <p>
  33574. // Let's say we have a set of SLL conflicting alternatives {@code {1, 2, 3}} and
  33575. // a smaller LL set called <em>s</em>. If <em>s</em> is {@code {2, 3}}, then SLL
  33576. // parsing will get an error because SLL will pursue alternative 1. If
  33577. // <em>s</em> is {@code {1, 2}} or {@code {1, 3}} then both SLL and LL will
  33578. // choose the same alternative because alternative one is the minimum of either
  33579. // set. If <em>s</em> is {@code {2}} or {@code {3}} then SLL will get a syntax
  33580. // error. If <em>s</em> is {@code {1}} then SLL will succeed.</p>
  33581. //
  33582. // <p>
  33583. // Of course, if the input is invalid, then we will get an error for sure in
  33584. // both SLL and LL parsing. Erroneous input will therefore require 2 passes over
  33585. // the input.</p>
  33586. //
  33587. var Utils = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js");
  33588. var Set = Utils.Set;
  33589. var BitSet = Utils.BitSet;
  33590. var DoubleDict = Utils.DoubleDict;
  33591. var ATN = __webpack_require__(/*! ./ATN */ "./node_modules/antlr4/atn/ATN.js").ATN;
  33592. var ATNState = __webpack_require__(/*! ./ATNState */ "./node_modules/antlr4/atn/ATNState.js").ATNState;
  33593. var ATNConfig = __webpack_require__(/*! ./ATNConfig */ "./node_modules/antlr4/atn/ATNConfig.js").ATNConfig;
  33594. var ATNConfigSet = __webpack_require__(/*! ./ATNConfigSet */ "./node_modules/antlr4/atn/ATNConfigSet.js").ATNConfigSet;
  33595. var Token = __webpack_require__(/*! ./../Token */ "./node_modules/antlr4/Token.js").Token;
  33596. var DFAState = __webpack_require__(/*! ./../dfa/DFAState */ "./node_modules/antlr4/dfa/DFAState.js").DFAState;
  33597. var PredPrediction = __webpack_require__(/*! ./../dfa/DFAState */ "./node_modules/antlr4/dfa/DFAState.js").PredPrediction;
  33598. var ATNSimulator = __webpack_require__(/*! ./ATNSimulator */ "./node_modules/antlr4/atn/ATNSimulator.js").ATNSimulator;
  33599. var PredictionMode = __webpack_require__(/*! ./PredictionMode */ "./node_modules/antlr4/atn/PredictionMode.js").PredictionMode;
  33600. var RuleContext = __webpack_require__(/*! ./../RuleContext */ "./node_modules/antlr4/RuleContext.js").RuleContext;
  33601. var ParserRuleContext = __webpack_require__(/*! ./../ParserRuleContext */ "./node_modules/antlr4/ParserRuleContext.js").ParserRuleContext;
  33602. var SemanticContext = __webpack_require__(/*! ./SemanticContext */ "./node_modules/antlr4/atn/SemanticContext.js").SemanticContext;
  33603. var StarLoopEntryState = __webpack_require__(/*! ./ATNState */ "./node_modules/antlr4/atn/ATNState.js").StarLoopEntryState;
  33604. var RuleStopState = __webpack_require__(/*! ./ATNState */ "./node_modules/antlr4/atn/ATNState.js").RuleStopState;
  33605. var PredictionContext = __webpack_require__(/*! ./../PredictionContext */ "./node_modules/antlr4/PredictionContext.js").PredictionContext;
  33606. var Interval = __webpack_require__(/*! ./../IntervalSet */ "./node_modules/antlr4/IntervalSet.js").Interval;
  33607. var Transitions = __webpack_require__(/*! ./Transition */ "./node_modules/antlr4/atn/Transition.js");
  33608. var Transition = Transitions.Transition;
  33609. var SetTransition = Transitions.SetTransition;
  33610. var NotSetTransition = Transitions.NotSetTransition;
  33611. var RuleTransition = Transitions.RuleTransition;
  33612. var ActionTransition = Transitions.ActionTransition;
  33613. var NoViableAltException = __webpack_require__(/*! ./../error/Errors */ "./node_modules/antlr4/error/Errors.js").NoViableAltException;
  33614. var SingletonPredictionContext = __webpack_require__(/*! ./../PredictionContext */ "./node_modules/antlr4/PredictionContext.js").SingletonPredictionContext;
  33615. var predictionContextFromRuleContext = __webpack_require__(/*! ./../PredictionContext */ "./node_modules/antlr4/PredictionContext.js").predictionContextFromRuleContext;
  33616. function ParserATNSimulator(parser, atn, decisionToDFA, sharedContextCache) {
  33617. ATNSimulator.call(this, atn, sharedContextCache);
  33618. this.parser = parser;
  33619. this.decisionToDFA = decisionToDFA;
  33620. // SLL, LL, or LL + exact ambig detection?//
  33621. this.predictionMode = PredictionMode.LL;
  33622. // LAME globals to avoid parameters!!!!! I need these down deep in predTransition
  33623. this._input = null;
  33624. this._startIndex = 0;
  33625. this._outerContext = null;
  33626. this._dfa = null;
  33627. // Each prediction operation uses a cache for merge of prediction contexts.
  33628. // Don't keep around as it wastes huge amounts of memory. DoubleKeyMap
  33629. // isn't synchronized but we're ok since two threads shouldn't reuse same
  33630. // parser/atnsim object because it can only handle one input at a time.
  33631. // This maps graphs a and b to merged result c. (a,b)&rarr;c. We can avoid
  33632. // the merge if we ever see a and b again. Note that (b,a)&rarr;c should
  33633. // also be examined during cache lookup.
  33634. //
  33635. this.mergeCache = null;
  33636. return this;
  33637. }
  33638. ParserATNSimulator.prototype = Object.create(ATNSimulator.prototype);
  33639. ParserATNSimulator.prototype.constructor = ParserATNSimulator;
  33640. ParserATNSimulator.prototype.debug = false;
  33641. ParserATNSimulator.prototype.debug_closure = false;
  33642. ParserATNSimulator.prototype.debug_add = false;
  33643. ParserATNSimulator.prototype.debug_list_atn_decisions = false;
  33644. ParserATNSimulator.prototype.dfa_debug = false;
  33645. ParserATNSimulator.prototype.retry_debug = false;
  33646. ParserATNSimulator.prototype.reset = function() {
  33647. };
  33648. ParserATNSimulator.prototype.adaptivePredict = function(input, decision, outerContext) {
  33649. if (this.debug || this.debug_list_atn_decisions) {
  33650. console.log("adaptivePredict decision " + decision +
  33651. " exec LA(1)==" + this.getLookaheadName(input) +
  33652. " line " + input.LT(1).line + ":" +
  33653. input.LT(1).column);
  33654. }
  33655. this._input = input;
  33656. this._startIndex = input.index;
  33657. this._outerContext = outerContext;
  33658. var dfa = this.decisionToDFA[decision];
  33659. this._dfa = dfa;
  33660. var m = input.mark();
  33661. var index = input.index;
  33662. // Now we are certain to have a specific decision's DFA
  33663. // But, do we still need an initial state?
  33664. try {
  33665. var s0;
  33666. if (dfa.precedenceDfa) {
  33667. // the start state for a precedence DFA depends on the current
  33668. // parser precedence, and is provided by a DFA method.
  33669. s0 = dfa.getPrecedenceStartState(this.parser.getPrecedence());
  33670. } else {
  33671. // the start state for a "regular" DFA is just s0
  33672. s0 = dfa.s0;
  33673. }
  33674. if (s0===null) {
  33675. if (outerContext===null) {
  33676. outerContext = RuleContext.EMPTY;
  33677. }
  33678. if (this.debug || this.debug_list_atn_decisions) {
  33679. console.log("predictATN decision " + dfa.decision +
  33680. " exec LA(1)==" + this.getLookaheadName(input) +
  33681. ", outerContext=" + outerContext.toString(this.parser.ruleNames));
  33682. }
  33683. var fullCtx = false;
  33684. var s0_closure = this.computeStartState(dfa.atnStartState, RuleContext.EMPTY, fullCtx);
  33685. if( dfa.precedenceDfa) {
  33686. // If this is a precedence DFA, we use applyPrecedenceFilter
  33687. // to convert the computed start state to a precedence start
  33688. // state. We then use DFA.setPrecedenceStartState to set the
  33689. // appropriate start state for the precedence level rather
  33690. // than simply setting DFA.s0.
  33691. //
  33692. dfa.s0.configs = s0_closure; // not used for prediction but useful to know start configs anyway
  33693. s0_closure = this.applyPrecedenceFilter(s0_closure);
  33694. s0 = this.addDFAState(dfa, new DFAState(null, s0_closure));
  33695. dfa.setPrecedenceStartState(this.parser.getPrecedence(), s0);
  33696. } else {
  33697. s0 = this.addDFAState(dfa, new DFAState(null, s0_closure));
  33698. dfa.s0 = s0;
  33699. }
  33700. }
  33701. var alt = this.execATN(dfa, s0, input, index, outerContext);
  33702. if (this.debug) {
  33703. console.log("DFA after predictATN: " + dfa.toString(this.parser.literalNames));
  33704. }
  33705. return alt;
  33706. } finally {
  33707. this._dfa = null;
  33708. this.mergeCache = null; // wack cache after each prediction
  33709. input.seek(index);
  33710. input.release(m);
  33711. }
  33712. };
  33713. // Performs ATN simulation to compute a predicted alternative based
  33714. // upon the remaining input, but also updates the DFA cache to avoid
  33715. // having to traverse the ATN again for the same input sequence.
  33716. // There are some key conditions we're looking for after computing a new
  33717. // set of ATN configs (proposed DFA state):
  33718. // if the set is empty, there is no viable alternative for current symbol
  33719. // does the state uniquely predict an alternative?
  33720. // does the state have a conflict that would prevent us from
  33721. // putting it on the work list?
  33722. // We also have some key operations to do:
  33723. // add an edge from previous DFA state to potentially new DFA state, D,
  33724. // upon current symbol but only if adding to work list, which means in all
  33725. // cases except no viable alternative (and possibly non-greedy decisions?)
  33726. // collecting predicates and adding semantic context to DFA accept states
  33727. // adding rule context to context-sensitive DFA accept states
  33728. // consuming an input symbol
  33729. // reporting a conflict
  33730. // reporting an ambiguity
  33731. // reporting a context sensitivity
  33732. // reporting insufficient predicates
  33733. // cover these cases:
  33734. // dead end
  33735. // single alt
  33736. // single alt + preds
  33737. // conflict
  33738. // conflict + preds
  33739. //
  33740. ParserATNSimulator.prototype.execATN = function(dfa, s0, input, startIndex, outerContext ) {
  33741. if (this.debug || this.debug_list_atn_decisions) {
  33742. console.log("execATN decision " + dfa.decision +
  33743. " exec LA(1)==" + this.getLookaheadName(input) +
  33744. " line " + input.LT(1).line + ":" + input.LT(1).column);
  33745. }
  33746. var alt;
  33747. var previousD = s0;
  33748. if (this.debug) {
  33749. console.log("s0 = " + s0);
  33750. }
  33751. var t = input.LA(1);
  33752. while(true) { // while more work
  33753. var D = this.getExistingTargetState(previousD, t);
  33754. if(D===null) {
  33755. D = this.computeTargetState(dfa, previousD, t);
  33756. }
  33757. if(D===ATNSimulator.ERROR) {
  33758. // if any configs in previous dipped into outer context, that
  33759. // means that input up to t actually finished entry rule
  33760. // at least for SLL decision. Full LL doesn't dip into outer
  33761. // so don't need special case.
  33762. // We will get an error no matter what so delay until after
  33763. // decision; better error message. Also, no reachable target
  33764. // ATN states in SLL implies LL will also get nowhere.
  33765. // If conflict in states that dip out, choose min since we
  33766. // will get error no matter what.
  33767. var e = this.noViableAlt(input, outerContext, previousD.configs, startIndex);
  33768. input.seek(startIndex);
  33769. alt = this.getSynValidOrSemInvalidAltThatFinishedDecisionEntryRule(previousD.configs, outerContext);
  33770. if(alt!==ATN.INVALID_ALT_NUMBER) {
  33771. return alt;
  33772. } else {
  33773. throw e;
  33774. }
  33775. }
  33776. if(D.requiresFullContext && this.predictionMode !== PredictionMode.SLL) {
  33777. // IF PREDS, MIGHT RESOLVE TO SINGLE ALT => SLL (or syntax error)
  33778. var conflictingAlts = null;
  33779. if (D.predicates!==null) {
  33780. if (this.debug) {
  33781. console.log("DFA state has preds in DFA sim LL failover");
  33782. }
  33783. var conflictIndex = input.index;
  33784. if(conflictIndex !== startIndex) {
  33785. input.seek(startIndex);
  33786. }
  33787. conflictingAlts = this.evalSemanticContext(D.predicates, outerContext, true);
  33788. if (conflictingAlts.length===1) {
  33789. if(this.debug) {
  33790. console.log("Full LL avoided");
  33791. }
  33792. return conflictingAlts.minValue();
  33793. }
  33794. if (conflictIndex !== startIndex) {
  33795. // restore the index so reporting the fallback to full
  33796. // context occurs with the index at the correct spot
  33797. input.seek(conflictIndex);
  33798. }
  33799. }
  33800. if (this.dfa_debug) {
  33801. console.log("ctx sensitive state " + outerContext +" in " + D);
  33802. }
  33803. var fullCtx = true;
  33804. var s0_closure = this.computeStartState(dfa.atnStartState, outerContext, fullCtx);
  33805. this.reportAttemptingFullContext(dfa, conflictingAlts, D.configs, startIndex, input.index);
  33806. alt = this.execATNWithFullContext(dfa, D, s0_closure, input, startIndex, outerContext);
  33807. return alt;
  33808. }
  33809. if (D.isAcceptState) {
  33810. if (D.predicates===null) {
  33811. return D.prediction;
  33812. }
  33813. var stopIndex = input.index;
  33814. input.seek(startIndex);
  33815. var alts = this.evalSemanticContext(D.predicates, outerContext, true);
  33816. if (alts.length===0) {
  33817. throw this.noViableAlt(input, outerContext, D.configs, startIndex);
  33818. } else if (alts.length===1) {
  33819. return alts.minValue();
  33820. } else {
  33821. // report ambiguity after predicate evaluation to make sure the correct set of ambig alts is reported.
  33822. this.reportAmbiguity(dfa, D, startIndex, stopIndex, false, alts, D.configs);
  33823. return alts.minValue();
  33824. }
  33825. }
  33826. previousD = D;
  33827. if (t !== Token.EOF) {
  33828. input.consume();
  33829. t = input.LA(1);
  33830. }
  33831. }
  33832. };
  33833. //
  33834. // Get an existing target state for an edge in the DFA. If the target state
  33835. // for the edge has not yet been computed or is otherwise not available,
  33836. // this method returns {@code null}.
  33837. //
  33838. // @param previousD The current DFA state
  33839. // @param t The next input symbol
  33840. // @return The existing target DFA state for the given input symbol
  33841. // {@code t}, or {@code null} if the target state for this edge is not
  33842. // already cached
  33843. //
  33844. ParserATNSimulator.prototype.getExistingTargetState = function(previousD, t) {
  33845. var edges = previousD.edges;
  33846. if (edges===null) {
  33847. return null;
  33848. } else {
  33849. return edges[t + 1] || null;
  33850. }
  33851. };
  33852. //
  33853. // Compute a target state for an edge in the DFA, and attempt to add the
  33854. // computed state and corresponding edge to the DFA.
  33855. //
  33856. // @param dfa The DFA
  33857. // @param previousD The current DFA state
  33858. // @param t The next input symbol
  33859. //
  33860. // @return The computed target DFA state for the given input symbol
  33861. // {@code t}. If {@code t} does not lead to a valid DFA state, this method
  33862. // returns {@link //ERROR}.
  33863. //
  33864. ParserATNSimulator.prototype.computeTargetState = function(dfa, previousD, t) {
  33865. var reach = this.computeReachSet(previousD.configs, t, false);
  33866. if(reach===null) {
  33867. this.addDFAEdge(dfa, previousD, t, ATNSimulator.ERROR);
  33868. return ATNSimulator.ERROR;
  33869. }
  33870. // create new target state; we'll add to DFA after it's complete
  33871. var D = new DFAState(null, reach);
  33872. var predictedAlt = this.getUniqueAlt(reach);
  33873. if (this.debug) {
  33874. var altSubSets = PredictionMode.getConflictingAltSubsets(reach);
  33875. console.log("SLL altSubSets=" + Utils.arrayToString(altSubSets) +
  33876. ", previous=" + previousD.configs +
  33877. ", configs=" + reach +
  33878. ", predict=" + predictedAlt +
  33879. ", allSubsetsConflict=" +
  33880. PredictionMode.allSubsetsConflict(altSubSets) + ", conflictingAlts=" +
  33881. this.getConflictingAlts(reach));
  33882. }
  33883. if (predictedAlt!==ATN.INVALID_ALT_NUMBER) {
  33884. // NO CONFLICT, UNIQUELY PREDICTED ALT
  33885. D.isAcceptState = true;
  33886. D.configs.uniqueAlt = predictedAlt;
  33887. D.prediction = predictedAlt;
  33888. } else if (PredictionMode.hasSLLConflictTerminatingPrediction(this.predictionMode, reach)) {
  33889. // MORE THAN ONE VIABLE ALTERNATIVE
  33890. D.configs.conflictingAlts = this.getConflictingAlts(reach);
  33891. D.requiresFullContext = true;
  33892. // in SLL-only mode, we will stop at this state and return the minimum alt
  33893. D.isAcceptState = true;
  33894. D.prediction = D.configs.conflictingAlts.minValue();
  33895. }
  33896. if (D.isAcceptState && D.configs.hasSemanticContext) {
  33897. this.predicateDFAState(D, this.atn.getDecisionState(dfa.decision));
  33898. if( D.predicates!==null) {
  33899. D.prediction = ATN.INVALID_ALT_NUMBER;
  33900. }
  33901. }
  33902. // all adds to dfa are done after we've created full D state
  33903. D = this.addDFAEdge(dfa, previousD, t, D);
  33904. return D;
  33905. };
  33906. ParserATNSimulator.prototype.predicateDFAState = function(dfaState, decisionState) {
  33907. // We need to test all predicates, even in DFA states that
  33908. // uniquely predict alternative.
  33909. var nalts = decisionState.transitions.length;
  33910. // Update DFA so reach becomes accept state with (predicate,alt)
  33911. // pairs if preds found for conflicting alts
  33912. var altsToCollectPredsFrom = this.getConflictingAltsOrUniqueAlt(dfaState.configs);
  33913. var altToPred = this.getPredsForAmbigAlts(altsToCollectPredsFrom, dfaState.configs, nalts);
  33914. if (altToPred!==null) {
  33915. dfaState.predicates = this.getPredicatePredictions(altsToCollectPredsFrom, altToPred);
  33916. dfaState.prediction = ATN.INVALID_ALT_NUMBER; // make sure we use preds
  33917. } else {
  33918. // There are preds in configs but they might go away
  33919. // when OR'd together like {p}? || NONE == NONE. If neither
  33920. // alt has preds, resolve to min alt
  33921. dfaState.prediction = altsToCollectPredsFrom.minValue();
  33922. }
  33923. };
  33924. // comes back with reach.uniqueAlt set to a valid alt
  33925. ParserATNSimulator.prototype.execATNWithFullContext = function(dfa, D, // how far we got before failing over
  33926. s0,
  33927. input,
  33928. startIndex,
  33929. outerContext) {
  33930. if (this.debug || this.debug_list_atn_decisions) {
  33931. console.log("execATNWithFullContext "+s0);
  33932. }
  33933. var fullCtx = true;
  33934. var foundExactAmbig = false;
  33935. var reach = null;
  33936. var previous = s0;
  33937. input.seek(startIndex);
  33938. var t = input.LA(1);
  33939. var predictedAlt = -1;
  33940. while (true) { // while more work
  33941. reach = this.computeReachSet(previous, t, fullCtx);
  33942. if (reach===null) {
  33943. // if any configs in previous dipped into outer context, that
  33944. // means that input up to t actually finished entry rule
  33945. // at least for LL decision. Full LL doesn't dip into outer
  33946. // so don't need special case.
  33947. // We will get an error no matter what so delay until after
  33948. // decision; better error message. Also, no reachable target
  33949. // ATN states in SLL implies LL will also get nowhere.
  33950. // If conflict in states that dip out, choose min since we
  33951. // will get error no matter what.
  33952. var e = this.noViableAlt(input, outerContext, previous, startIndex);
  33953. input.seek(startIndex);
  33954. var alt = this.getSynValidOrSemInvalidAltThatFinishedDecisionEntryRule(previous, outerContext);
  33955. if(alt!==ATN.INVALID_ALT_NUMBER) {
  33956. return alt;
  33957. } else {
  33958. throw e;
  33959. }
  33960. }
  33961. var altSubSets = PredictionMode.getConflictingAltSubsets(reach);
  33962. if(this.debug) {
  33963. console.log("LL altSubSets=" + altSubSets + ", predict=" +
  33964. PredictionMode.getUniqueAlt(altSubSets) + ", resolvesToJustOneViableAlt=" +
  33965. PredictionMode.resolvesToJustOneViableAlt(altSubSets));
  33966. }
  33967. reach.uniqueAlt = this.getUniqueAlt(reach);
  33968. // unique prediction?
  33969. if(reach.uniqueAlt!==ATN.INVALID_ALT_NUMBER) {
  33970. predictedAlt = reach.uniqueAlt;
  33971. break;
  33972. } else if (this.predictionMode !== PredictionMode.LL_EXACT_AMBIG_DETECTION) {
  33973. predictedAlt = PredictionMode.resolvesToJustOneViableAlt(altSubSets);
  33974. if(predictedAlt !== ATN.INVALID_ALT_NUMBER) {
  33975. break;
  33976. }
  33977. } else {
  33978. // In exact ambiguity mode, we never try to terminate early.
  33979. // Just keeps scarfing until we know what the conflict is
  33980. if (PredictionMode.allSubsetsConflict(altSubSets) && PredictionMode.allSubsetsEqual(altSubSets)) {
  33981. foundExactAmbig = true;
  33982. predictedAlt = PredictionMode.getSingleViableAlt(altSubSets);
  33983. break;
  33984. }
  33985. // else there are multiple non-conflicting subsets or
  33986. // we're not sure what the ambiguity is yet.
  33987. // So, keep going.
  33988. }
  33989. previous = reach;
  33990. if( t !== Token.EOF) {
  33991. input.consume();
  33992. t = input.LA(1);
  33993. }
  33994. }
  33995. // If the configuration set uniquely predicts an alternative,
  33996. // without conflict, then we know that it's a full LL decision
  33997. // not SLL.
  33998. if (reach.uniqueAlt !== ATN.INVALID_ALT_NUMBER ) {
  33999. this.reportContextSensitivity(dfa, predictedAlt, reach, startIndex, input.index);
  34000. return predictedAlt;
  34001. }
  34002. // We do not check predicates here because we have checked them
  34003. // on-the-fly when doing full context prediction.
  34004. //
  34005. // In non-exact ambiguity detection mode, we might actually be able to
  34006. // detect an exact ambiguity, but I'm not going to spend the cycles
  34007. // needed to check. We only emit ambiguity warnings in exact ambiguity
  34008. // mode.
  34009. //
  34010. // For example, we might know that we have conflicting configurations.
  34011. // But, that does not mean that there is no way forward without a
  34012. // conflict. It's possible to have nonconflicting alt subsets as in:
  34013. // altSubSets=[{1, 2}, {1, 2}, {1}, {1, 2}]
  34014. // from
  34015. //
  34016. // [(17,1,[5 $]), (13,1,[5 10 $]), (21,1,[5 10 $]), (11,1,[$]),
  34017. // (13,2,[5 10 $]), (21,2,[5 10 $]), (11,2,[$])]
  34018. //
  34019. // In this case, (17,1,[5 $]) indicates there is some next sequence that
  34020. // would resolve this without conflict to alternative 1. Any other viable
  34021. // next sequence, however, is associated with a conflict. We stop
  34022. // looking for input because no amount of further lookahead will alter
  34023. // the fact that we should predict alternative 1. We just can't say for
  34024. // sure that there is an ambiguity without looking further.
  34025. this.reportAmbiguity(dfa, D, startIndex, input.index, foundExactAmbig, null, reach);
  34026. return predictedAlt;
  34027. };
  34028. ParserATNSimulator.prototype.computeReachSet = function(closure, t, fullCtx) {
  34029. if (this.debug) {
  34030. console.log("in computeReachSet, starting closure: " + closure);
  34031. }
  34032. if( this.mergeCache===null) {
  34033. this.mergeCache = new DoubleDict();
  34034. }
  34035. var intermediate = new ATNConfigSet(fullCtx);
  34036. // Configurations already in a rule stop state indicate reaching the end
  34037. // of the decision rule (local context) or end of the start rule (full
  34038. // context). Once reached, these configurations are never updated by a
  34039. // closure operation, so they are handled separately for the performance
  34040. // advantage of having a smaller intermediate set when calling closure.
  34041. //
  34042. // For full-context reach operations, separate handling is required to
  34043. // ensure that the alternative matching the longest overall sequence is
  34044. // chosen when multiple such configurations can match the input.
  34045. var skippedStopStates = null;
  34046. // First figure out where we can reach on input t
  34047. for (var i=0; i<closure.items.length;i++) {
  34048. var c = closure.items[i];
  34049. if(this.debug_add) {
  34050. console.log("testing " + this.getTokenName(t) + " at " + c);
  34051. }
  34052. if (c.state instanceof RuleStopState) {
  34053. if (fullCtx || t === Token.EOF) {
  34054. if (skippedStopStates===null) {
  34055. skippedStopStates = [];
  34056. }
  34057. skippedStopStates.push(c);
  34058. if(this.debug_add) {
  34059. console.log("added " + c + " to skippedStopStates");
  34060. }
  34061. }
  34062. continue;
  34063. }
  34064. for(var j=0;j<c.state.transitions.length;j++) {
  34065. var trans = c.state.transitions[j];
  34066. var target = this.getReachableTarget(trans, t);
  34067. if (target!==null) {
  34068. var cfg = new ATNConfig({state:target}, c);
  34069. intermediate.add(cfg, this.mergeCache);
  34070. if(this.debug_add) {
  34071. console.log("added " + cfg + " to intermediate");
  34072. }
  34073. }
  34074. }
  34075. }
  34076. // Now figure out where the reach operation can take us...
  34077. var reach = null;
  34078. // This block optimizes the reach operation for intermediate sets which
  34079. // trivially indicate a termination state for the overall
  34080. // adaptivePredict operation.
  34081. //
  34082. // The conditions assume that intermediate
  34083. // contains all configurations relevant to the reach set, but this
  34084. // condition is not true when one or more configurations have been
  34085. // withheld in skippedStopStates, or when the current symbol is EOF.
  34086. //
  34087. if (skippedStopStates===null && t!==Token.EOF) {
  34088. if (intermediate.items.length===1) {
  34089. // Don't pursue the closure if there is just one state.
  34090. // It can only have one alternative; just add to result
  34091. // Also don't pursue the closure if there is unique alternative
  34092. // among the configurations.
  34093. reach = intermediate;
  34094. } else if (this.getUniqueAlt(intermediate)!==ATN.INVALID_ALT_NUMBER) {
  34095. // Also don't pursue the closure if there is unique alternative
  34096. // among the configurations.
  34097. reach = intermediate;
  34098. }
  34099. }
  34100. // If the reach set could not be trivially determined, perform a closure
  34101. // operation on the intermediate set to compute its initial value.
  34102. //
  34103. if (reach===null) {
  34104. reach = new ATNConfigSet(fullCtx);
  34105. var closureBusy = new Set();
  34106. var treatEofAsEpsilon = t === Token.EOF;
  34107. for (var k=0; k<intermediate.items.length;k++) {
  34108. this.closure(intermediate.items[k], reach, closureBusy, false, fullCtx, treatEofAsEpsilon);
  34109. }
  34110. }
  34111. if (t === Token.EOF) {
  34112. // After consuming EOF no additional input is possible, so we are
  34113. // only interested in configurations which reached the end of the
  34114. // decision rule (local context) or end of the start rule (full
  34115. // context). Update reach to contain only these configurations. This
  34116. // handles both explicit EOF transitions in the grammar and implicit
  34117. // EOF transitions following the end of the decision or start rule.
  34118. //
  34119. // When reach==intermediate, no closure operation was performed. In
  34120. // this case, removeAllConfigsNotInRuleStopState needs to check for
  34121. // reachable rule stop states as well as configurations already in
  34122. // a rule stop state.
  34123. //
  34124. // This is handled before the configurations in skippedStopStates,
  34125. // because any configurations potentially added from that list are
  34126. // already guaranteed to meet this condition whether or not it's
  34127. // required.
  34128. //
  34129. reach = this.removeAllConfigsNotInRuleStopState(reach, reach === intermediate);
  34130. }
  34131. // If skippedStopStates!==null, then it contains at least one
  34132. // configuration. For full-context reach operations, these
  34133. // configurations reached the end of the start rule, in which case we
  34134. // only add them back to reach if no configuration during the current
  34135. // closure operation reached such a state. This ensures adaptivePredict
  34136. // chooses an alternative matching the longest overall sequence when
  34137. // multiple alternatives are viable.
  34138. //
  34139. if (skippedStopStates!==null && ( (! fullCtx) || (! PredictionMode.hasConfigInRuleStopState(reach)))) {
  34140. for (var l=0; l<skippedStopStates.length;l++) {
  34141. reach.add(skippedStopStates[l], this.mergeCache);
  34142. }
  34143. }
  34144. if (reach.items.length===0) {
  34145. return null;
  34146. } else {
  34147. return reach;
  34148. }
  34149. };
  34150. //
  34151. // Return a configuration set containing only the configurations from
  34152. // {@code configs} which are in a {@link RuleStopState}. If all
  34153. // configurations in {@code configs} are already in a rule stop state, this
  34154. // method simply returns {@code configs}.
  34155. //
  34156. // <p>When {@code lookToEndOfRule} is true, this method uses
  34157. // {@link ATN//nextTokens} for each configuration in {@code configs} which is
  34158. // not already in a rule stop state to see if a rule stop state is reachable
  34159. // from the configuration via epsilon-only transitions.</p>
  34160. //
  34161. // @param configs the configuration set to update
  34162. // @param lookToEndOfRule when true, this method checks for rule stop states
  34163. // reachable by epsilon-only transitions from each configuration in
  34164. // {@code configs}.
  34165. //
  34166. // @return {@code configs} if all configurations in {@code configs} are in a
  34167. // rule stop state, otherwise return a new configuration set containing only
  34168. // the configurations from {@code configs} which are in a rule stop state
  34169. //
  34170. ParserATNSimulator.prototype.removeAllConfigsNotInRuleStopState = function(configs, lookToEndOfRule) {
  34171. if (PredictionMode.allConfigsInRuleStopStates(configs)) {
  34172. return configs;
  34173. }
  34174. var result = new ATNConfigSet(configs.fullCtx);
  34175. for(var i=0; i<configs.items.length;i++) {
  34176. var config = configs.items[i];
  34177. if (config.state instanceof RuleStopState) {
  34178. result.add(config, this.mergeCache);
  34179. continue;
  34180. }
  34181. if (lookToEndOfRule && config.state.epsilonOnlyTransitions) {
  34182. var nextTokens = this.atn.nextTokens(config.state);
  34183. if (nextTokens.contains(Token.EPSILON)) {
  34184. var endOfRuleState = this.atn.ruleToStopState[config.state.ruleIndex];
  34185. result.add(new ATNConfig({state:endOfRuleState}, config), this.mergeCache);
  34186. }
  34187. }
  34188. }
  34189. return result;
  34190. };
  34191. ParserATNSimulator.prototype.computeStartState = function(p, ctx, fullCtx) {
  34192. // always at least the implicit call to start rule
  34193. var initialContext = predictionContextFromRuleContext(this.atn, ctx);
  34194. var configs = new ATNConfigSet(fullCtx);
  34195. for(var i=0;i<p.transitions.length;i++) {
  34196. var target = p.transitions[i].target;
  34197. var c = new ATNConfig({ state:target, alt:i+1, context:initialContext }, null);
  34198. var closureBusy = new Set();
  34199. this.closure(c, configs, closureBusy, true, fullCtx, false);
  34200. }
  34201. return configs;
  34202. };
  34203. //
  34204. // This method transforms the start state computed by
  34205. // {@link //computeStartState} to the special start state used by a
  34206. // precedence DFA for a particular precedence value. The transformation
  34207. // process applies the following changes to the start state's configuration
  34208. // set.
  34209. //
  34210. // <ol>
  34211. // <li>Evaluate the precedence predicates for each configuration using
  34212. // {@link SemanticContext//evalPrecedence}.</li>
  34213. // <li>Remove all configurations which predict an alternative greater than
  34214. // 1, for which another configuration that predicts alternative 1 is in the
  34215. // same ATN state with the same prediction context. This transformation is
  34216. // valid for the following reasons:
  34217. // <ul>
  34218. // <li>The closure block cannot contain any epsilon transitions which bypass
  34219. // the body of the closure, so all states reachable via alternative 1 are
  34220. // part of the precedence alternatives of the transformed left-recursive
  34221. // rule.</li>
  34222. // <li>The "primary" portion of a left recursive rule cannot contain an
  34223. // epsilon transition, so the only way an alternative other than 1 can exist
  34224. // in a state that is also reachable via alternative 1 is by nesting calls
  34225. // to the left-recursive rule, with the outer calls not being at the
  34226. // preferred precedence level.</li>
  34227. // </ul>
  34228. // </li>
  34229. // </ol>
  34230. //
  34231. // <p>
  34232. // The prediction context must be considered by this filter to address
  34233. // situations like the following.
  34234. // </p>
  34235. // <code>
  34236. // <pre>
  34237. // grammar TA;
  34238. // prog: statement* EOF;
  34239. // statement: letterA | statement letterA 'b' ;
  34240. // letterA: 'a';
  34241. // </pre>
  34242. // </code>
  34243. // <p>
  34244. // If the above grammar, the ATN state immediately before the token
  34245. // reference {@code 'a'} in {@code letterA} is reachable from the left edge
  34246. // of both the primary and closure blocks of the left-recursive rule
  34247. // {@code statement}. The prediction context associated with each of these
  34248. // configurations distinguishes between them, and prevents the alternative
  34249. // which stepped out to {@code prog} (and then back in to {@code statement}
  34250. // from being eliminated by the filter.
  34251. // </p>
  34252. //
  34253. // @param configs The configuration set computed by
  34254. // {@link //computeStartState} as the start state for the DFA.
  34255. // @return The transformed configuration set representing the start state
  34256. // for a precedence DFA at a particular precedence level (determined by
  34257. // calling {@link Parser//getPrecedence}).
  34258. //
  34259. ParserATNSimulator.prototype.applyPrecedenceFilter = function(configs) {
  34260. var config;
  34261. var statesFromAlt1 = [];
  34262. var configSet = new ATNConfigSet(configs.fullCtx);
  34263. for(var i=0; i<configs.items.length; i++) {
  34264. config = configs.items[i];
  34265. // handle alt 1 first
  34266. if (config.alt !== 1) {
  34267. continue;
  34268. }
  34269. var updatedContext = config.semanticContext.evalPrecedence(this.parser, this._outerContext);
  34270. if (updatedContext===null) {
  34271. // the configuration was eliminated
  34272. continue;
  34273. }
  34274. statesFromAlt1[config.state.stateNumber] = config.context;
  34275. if (updatedContext !== config.semanticContext) {
  34276. configSet.add(new ATNConfig({semanticContext:updatedContext}, config), this.mergeCache);
  34277. } else {
  34278. configSet.add(config, this.mergeCache);
  34279. }
  34280. }
  34281. for(i=0; i<configs.items.length; i++) {
  34282. config = configs.items[i];
  34283. if (config.alt === 1) {
  34284. // already handled
  34285. continue;
  34286. }
  34287. // In the future, this elimination step could be updated to also
  34288. // filter the prediction context for alternatives predicting alt>1
  34289. // (basically a graph subtraction algorithm).
  34290. if (!config.precedenceFilterSuppressed) {
  34291. var context = statesFromAlt1[config.state.stateNumber] || null;
  34292. if (context!==null && context.equals(config.context)) {
  34293. // eliminated
  34294. continue;
  34295. }
  34296. }
  34297. configSet.add(config, this.mergeCache);
  34298. }
  34299. return configSet;
  34300. };
  34301. ParserATNSimulator.prototype.getReachableTarget = function(trans, ttype) {
  34302. if (trans.matches(ttype, 0, this.atn.maxTokenType)) {
  34303. return trans.target;
  34304. } else {
  34305. return null;
  34306. }
  34307. };
  34308. ParserATNSimulator.prototype.getPredsForAmbigAlts = function(ambigAlts, configs, nalts) {
  34309. // REACH=[1|1|[]|0:0, 1|2|[]|0:1]
  34310. // altToPred starts as an array of all null contexts. The entry at index i
  34311. // corresponds to alternative i. altToPred[i] may have one of three values:
  34312. // 1. null: no ATNConfig c is found such that c.alt==i
  34313. // 2. SemanticContext.NONE: At least one ATNConfig c exists such that
  34314. // c.alt==i and c.semanticContext==SemanticContext.NONE. In other words,
  34315. // alt i has at least one unpredicated config.
  34316. // 3. Non-NONE Semantic Context: There exists at least one, and for all
  34317. // ATNConfig c such that c.alt==i, c.semanticContext!=SemanticContext.NONE.
  34318. //
  34319. // From this, it is clear that NONE||anything==NONE.
  34320. //
  34321. var altToPred = [];
  34322. for(var i=0;i<configs.items.length;i++) {
  34323. var c = configs.items[i];
  34324. if(ambigAlts.contains( c.alt )) {
  34325. altToPred[c.alt] = SemanticContext.orContext(altToPred[c.alt] || null, c.semanticContext);
  34326. }
  34327. }
  34328. var nPredAlts = 0;
  34329. for (i =1;i< nalts+1;i++) {
  34330. var pred = altToPred[i] || null;
  34331. if (pred===null) {
  34332. altToPred[i] = SemanticContext.NONE;
  34333. } else if (pred !== SemanticContext.NONE) {
  34334. nPredAlts += 1;
  34335. }
  34336. }
  34337. // nonambig alts are null in altToPred
  34338. if (nPredAlts===0) {
  34339. altToPred = null;
  34340. }
  34341. if (this.debug) {
  34342. console.log("getPredsForAmbigAlts result " + Utils.arrayToString(altToPred));
  34343. }
  34344. return altToPred;
  34345. };
  34346. ParserATNSimulator.prototype.getPredicatePredictions = function(ambigAlts, altToPred) {
  34347. var pairs = [];
  34348. var containsPredicate = false;
  34349. for (var i=1; i<altToPred.length;i++) {
  34350. var pred = altToPred[i];
  34351. // unpredicated is indicated by SemanticContext.NONE
  34352. if( ambigAlts!==null && ambigAlts.contains( i )) {
  34353. pairs.push(new PredPrediction(pred, i));
  34354. }
  34355. if (pred !== SemanticContext.NONE) {
  34356. containsPredicate = true;
  34357. }
  34358. }
  34359. if (! containsPredicate) {
  34360. return null;
  34361. }
  34362. return pairs;
  34363. };
  34364. //
  34365. // This method is used to improve the localization of error messages by
  34366. // choosing an alternative rather than throwing a
  34367. // {@link NoViableAltException} in particular prediction scenarios where the
  34368. // {@link //ERROR} state was reached during ATN simulation.
  34369. //
  34370. // <p>
  34371. // The default implementation of this method uses the following
  34372. // algorithm to identify an ATN configuration which successfully parsed the
  34373. // decision entry rule. Choosing such an alternative ensures that the
  34374. // {@link ParserRuleContext} returned by the calling rule will be complete
  34375. // and valid, and the syntax error will be reported later at a more
  34376. // localized location.</p>
  34377. //
  34378. // <ul>
  34379. // <li>If a syntactically valid path or paths reach the end of the decision rule and
  34380. // they are semantically valid if predicated, return the min associated alt.</li>
  34381. // <li>Else, if a semantically invalid but syntactically valid path exist
  34382. // or paths exist, return the minimum associated alt.
  34383. // </li>
  34384. // <li>Otherwise, return {@link ATN//INVALID_ALT_NUMBER}.</li>
  34385. // </ul>
  34386. //
  34387. // <p>
  34388. // In some scenarios, the algorithm described above could predict an
  34389. // alternative which will result in a {@link FailedPredicateException} in
  34390. // the parser. Specifically, this could occur if the <em>only</em> configuration
  34391. // capable of successfully parsing to the end of the decision rule is
  34392. // blocked by a semantic predicate. By choosing this alternative within
  34393. // {@link //adaptivePredict} instead of throwing a
  34394. // {@link NoViableAltException}, the resulting
  34395. // {@link FailedPredicateException} in the parser will identify the specific
  34396. // predicate which is preventing the parser from successfully parsing the
  34397. // decision rule, which helps developers identify and correct logic errors
  34398. // in semantic predicates.
  34399. // </p>
  34400. //
  34401. // @param configs The ATN configurations which were valid immediately before
  34402. // the {@link //ERROR} state was reached
  34403. // @param outerContext The is the \gamma_0 initial parser context from the paper
  34404. // or the parser stack at the instant before prediction commences.
  34405. //
  34406. // @return The value to return from {@link //adaptivePredict}, or
  34407. // {@link ATN//INVALID_ALT_NUMBER} if a suitable alternative was not
  34408. // identified and {@link //adaptivePredict} should report an error instead.
  34409. //
  34410. ParserATNSimulator.prototype.getSynValidOrSemInvalidAltThatFinishedDecisionEntryRule = function(configs, outerContext) {
  34411. var cfgs = this.splitAccordingToSemanticValidity(configs, outerContext);
  34412. var semValidConfigs = cfgs[0];
  34413. var semInvalidConfigs = cfgs[1];
  34414. var alt = this.getAltThatFinishedDecisionEntryRule(semValidConfigs);
  34415. if (alt!==ATN.INVALID_ALT_NUMBER) { // semantically/syntactically viable path exists
  34416. return alt;
  34417. }
  34418. // Is there a syntactically valid path with a failed pred?
  34419. if (semInvalidConfigs.items.length>0) {
  34420. alt = this.getAltThatFinishedDecisionEntryRule(semInvalidConfigs);
  34421. if (alt!==ATN.INVALID_ALT_NUMBER) { // syntactically viable path exists
  34422. return alt;
  34423. }
  34424. }
  34425. return ATN.INVALID_ALT_NUMBER;
  34426. };
  34427. ParserATNSimulator.prototype.getAltThatFinishedDecisionEntryRule = function(configs) {
  34428. var alts = [];
  34429. for(var i=0;i<configs.items.length; i++) {
  34430. var c = configs.items[i];
  34431. if (c.reachesIntoOuterContext>0 || ((c.state instanceof RuleStopState) && c.context.hasEmptyPath())) {
  34432. if(alts.indexOf(c.alt)<0) {
  34433. alts.push(c.alt);
  34434. }
  34435. }
  34436. }
  34437. if (alts.length===0) {
  34438. return ATN.INVALID_ALT_NUMBER;
  34439. } else {
  34440. return Math.min.apply(null, alts);
  34441. }
  34442. };
  34443. // Walk the list of configurations and split them according to
  34444. // those that have preds evaluating to true/false. If no pred, assume
  34445. // true pred and include in succeeded set. Returns Pair of sets.
  34446. //
  34447. // Create a new set so as not to alter the incoming parameter.
  34448. //
  34449. // Assumption: the input stream has been restored to the starting point
  34450. // prediction, which is where predicates need to evaluate.
  34451. //
  34452. ParserATNSimulator.prototype.splitAccordingToSemanticValidity = function( configs, outerContext) {
  34453. var succeeded = new ATNConfigSet(configs.fullCtx);
  34454. var failed = new ATNConfigSet(configs.fullCtx);
  34455. for(var i=0;i<configs.items.length; i++) {
  34456. var c = configs.items[i];
  34457. if (c.semanticContext !== SemanticContext.NONE) {
  34458. var predicateEvaluationResult = c.semanticContext.evaluate(this.parser, outerContext);
  34459. if (predicateEvaluationResult) {
  34460. succeeded.add(c);
  34461. } else {
  34462. failed.add(c);
  34463. }
  34464. } else {
  34465. succeeded.add(c);
  34466. }
  34467. }
  34468. return [succeeded, failed];
  34469. };
  34470. // Look through a list of predicate/alt pairs, returning alts for the
  34471. // pairs that win. A {@code NONE} predicate indicates an alt containing an
  34472. // unpredicated config which behaves as "always true." If !complete
  34473. // then we stop at the first predicate that evaluates to true. This
  34474. // includes pairs with null predicates.
  34475. //
  34476. ParserATNSimulator.prototype.evalSemanticContext = function(predPredictions, outerContext, complete) {
  34477. var predictions = new BitSet();
  34478. for(var i=0;i<predPredictions.length;i++) {
  34479. var pair = predPredictions[i];
  34480. if (pair.pred === SemanticContext.NONE) {
  34481. predictions.add(pair.alt);
  34482. if (! complete) {
  34483. break;
  34484. }
  34485. continue;
  34486. }
  34487. var predicateEvaluationResult = pair.pred.evaluate(this.parser, outerContext);
  34488. if (this.debug || this.dfa_debug) {
  34489. console.log("eval pred " + pair + "=" + predicateEvaluationResult);
  34490. }
  34491. if (predicateEvaluationResult) {
  34492. if (this.debug || this.dfa_debug) {
  34493. console.log("PREDICT " + pair.alt);
  34494. }
  34495. predictions.add(pair.alt);
  34496. if (! complete) {
  34497. break;
  34498. }
  34499. }
  34500. }
  34501. return predictions;
  34502. };
  34503. // TODO: If we are doing predicates, there is no point in pursuing
  34504. // closure operations if we reach a DFA state that uniquely predicts
  34505. // alternative. We will not be caching that DFA state and it is a
  34506. // waste to pursue the closure. Might have to advance when we do
  34507. // ambig detection thought :(
  34508. //
  34509. ParserATNSimulator.prototype.closure = function(config, configs, closureBusy, collectPredicates, fullCtx, treatEofAsEpsilon) {
  34510. var initialDepth = 0;
  34511. this.closureCheckingStopState(config, configs, closureBusy, collectPredicates,
  34512. fullCtx, initialDepth, treatEofAsEpsilon);
  34513. };
  34514. ParserATNSimulator.prototype.closureCheckingStopState = function(config, configs, closureBusy, collectPredicates, fullCtx, depth, treatEofAsEpsilon) {
  34515. if (this.debug || this.debug_closure) {
  34516. console.log("closure(" + config.toString(this.parser,true) + ")");
  34517. // console.log("configs(" + configs.toString() + ")");
  34518. if(config.reachesIntoOuterContext>50) {
  34519. throw "problem";
  34520. }
  34521. }
  34522. if (config.state instanceof RuleStopState) {
  34523. // We hit rule end. If we have context info, use it
  34524. // run thru all possible stack tops in ctx
  34525. if (! config.context.isEmpty()) {
  34526. for ( var i =0; i<config.context.length; i++) {
  34527. if (config.context.getReturnState(i) === PredictionContext.EMPTY_RETURN_STATE) {
  34528. if (fullCtx) {
  34529. configs.add(new ATNConfig({state:config.state, context:PredictionContext.EMPTY}, config), this.mergeCache);
  34530. continue;
  34531. } else {
  34532. // we have no context info, just chase follow links (if greedy)
  34533. if (this.debug) {
  34534. console.log("FALLING off rule " + this.getRuleName(config.state.ruleIndex));
  34535. }
  34536. this.closure_(config, configs, closureBusy, collectPredicates,
  34537. fullCtx, depth, treatEofAsEpsilon);
  34538. }
  34539. continue;
  34540. }
  34541. var returnState = this.atn.states[config.context.getReturnState(i)];
  34542. var newContext = config.context.getParent(i); // "pop" return state
  34543. var parms = {state:returnState, alt:config.alt, context:newContext, semanticContext:config.semanticContext};
  34544. var c = new ATNConfig(parms, null);
  34545. // While we have context to pop back from, we may have
  34546. // gotten that context AFTER having falling off a rule.
  34547. // Make sure we track that we are now out of context.
  34548. c.reachesIntoOuterContext = config.reachesIntoOuterContext;
  34549. this.closureCheckingStopState(c, configs, closureBusy, collectPredicates, fullCtx, depth - 1, treatEofAsEpsilon);
  34550. }
  34551. return;
  34552. } else if( fullCtx) {
  34553. // reached end of start rule
  34554. configs.add(config, this.mergeCache);
  34555. return;
  34556. } else {
  34557. // else if we have no context info, just chase follow links (if greedy)
  34558. if (this.debug) {
  34559. console.log("FALLING off rule " + this.getRuleName(config.state.ruleIndex));
  34560. }
  34561. }
  34562. }
  34563. this.closure_(config, configs, closureBusy, collectPredicates, fullCtx, depth, treatEofAsEpsilon);
  34564. };
  34565. // Do the actual work of walking epsilon edges//
  34566. ParserATNSimulator.prototype.closure_ = function(config, configs, closureBusy, collectPredicates, fullCtx, depth, treatEofAsEpsilon) {
  34567. var p = config.state;
  34568. // optimization
  34569. if (! p.epsilonOnlyTransitions) {
  34570. configs.add(config, this.mergeCache);
  34571. // make sure to not return here, because EOF transitions can act as
  34572. // both epsilon transitions and non-epsilon transitions.
  34573. }
  34574. for(var i = 0;i<p.transitions.length; i++) {
  34575. if(i==0 && this.canDropLoopEntryEdgeInLeftRecursiveRule(config))
  34576. continue;
  34577. var t = p.transitions[i];
  34578. var continueCollecting = collectPredicates && !(t instanceof ActionTransition);
  34579. var c = this.getEpsilonTarget(config, t, continueCollecting, depth === 0, fullCtx, treatEofAsEpsilon);
  34580. if (c!==null) {
  34581. if (!t.isEpsilon && closureBusy.add(c)!==c){
  34582. // avoid infinite recursion for EOF* and EOF+
  34583. continue;
  34584. }
  34585. var newDepth = depth;
  34586. if ( config.state instanceof RuleStopState) {
  34587. // target fell off end of rule; mark resulting c as having dipped into outer context
  34588. // We can't get here if incoming config was rule stop and we had context
  34589. // track how far we dip into outer context. Might
  34590. // come in handy and we avoid evaluating context dependent
  34591. // preds if this is > 0.
  34592. if (closureBusy.add(c)!==c) {
  34593. // avoid infinite recursion for right-recursive rules
  34594. continue;
  34595. }
  34596. if (this._dfa !== null && this._dfa.precedenceDfa) {
  34597. if (t.outermostPrecedenceReturn === this._dfa.atnStartState.ruleIndex) {
  34598. c.precedenceFilterSuppressed = true;
  34599. }
  34600. }
  34601. c.reachesIntoOuterContext += 1;
  34602. configs.dipsIntoOuterContext = true; // TODO: can remove? only care when we add to set per middle of this method
  34603. newDepth -= 1;
  34604. if (this.debug) {
  34605. console.log("dips into outer ctx: " + c);
  34606. }
  34607. } else if (t instanceof RuleTransition) {
  34608. // latch when newDepth goes negative - once we step out of the entry context we can't return
  34609. if (newDepth >= 0) {
  34610. newDepth += 1;
  34611. }
  34612. }
  34613. this.closureCheckingStopState(c, configs, closureBusy, continueCollecting, fullCtx, newDepth, treatEofAsEpsilon);
  34614. }
  34615. }
  34616. };
  34617. ParserATNSimulator.prototype.canDropLoopEntryEdgeInLeftRecursiveRule = function(config) {
  34618. // return False
  34619. var p = config.state;
  34620. // First check to see if we are in StarLoopEntryState generated during
  34621. // left-recursion elimination. For efficiency, also check if
  34622. // the context has an empty stack case. If so, it would mean
  34623. // global FOLLOW so we can't perform optimization
  34624. // Are we the special loop entry/exit state? or SLL wildcard
  34625. if(p.stateType != ATNState.STAR_LOOP_ENTRY)
  34626. return false;
  34627. if(p.stateType != ATNState.STAR_LOOP_ENTRY || !p.isPrecedenceDecision ||
  34628. config.context.isEmpty() || config.context.hasEmptyPath())
  34629. return false;
  34630. // Require all return states to return back to the same rule that p is in.
  34631. var numCtxs = config.context.length;
  34632. for(var i=0; i<numCtxs; i++) { // for each stack context
  34633. var returnState = this.atn.states[config.context.getReturnState(i)];
  34634. if (returnState.ruleIndex != p.ruleIndex)
  34635. return false;
  34636. }
  34637. var decisionStartState = p.transitions[0].target;
  34638. var blockEndStateNum = decisionStartState.endState.stateNumber;
  34639. var blockEndState = this.atn.states[blockEndStateNum];
  34640. // Verify that the top of each stack context leads to loop entry/exit
  34641. // state through epsilon edges and w/o leaving rule.
  34642. for(var i=0; i<numCtxs; i++) { // for each stack context
  34643. var returnStateNumber = config.context.getReturnState(i);
  34644. var returnState = this.atn.states[returnStateNumber];
  34645. // all states must have single outgoing epsilon edge
  34646. if (returnState.transitions.length != 1 || !returnState.transitions[0].isEpsilon)
  34647. return false;
  34648. // Look for prefix op case like 'not expr', (' type ')' expr
  34649. var returnStateTarget = returnState.transitions[0].target;
  34650. if ( returnState.stateType == ATNState.BLOCK_END && returnStateTarget == p )
  34651. continue;
  34652. // Look for 'expr op expr' or case where expr's return state is block end
  34653. // of (...)* internal block; the block end points to loop back
  34654. // which points to p but we don't need to check that
  34655. if ( returnState == blockEndState )
  34656. continue;
  34657. // Look for ternary expr ? expr : expr. The return state points at block end,
  34658. // which points at loop entry state
  34659. if ( returnStateTarget == blockEndState )
  34660. continue;
  34661. // Look for complex prefix 'between expr and expr' case where 2nd expr's
  34662. // return state points at block end state of (...)* internal block
  34663. if (returnStateTarget.stateType == ATNState.BLOCK_END && returnStateTarget.transitions.length == 1
  34664. && returnStateTarget.transitions[0].isEpsilon && returnStateTarget.transitions[0].target == p)
  34665. continue;
  34666. // anything else ain't conforming
  34667. return false;
  34668. }
  34669. return true;
  34670. };
  34671. ParserATNSimulator.prototype.getRuleName = function( index) {
  34672. if (this.parser!==null && index>=0) {
  34673. return this.parser.ruleNames[index];
  34674. } else {
  34675. return "<rule " + index + ">";
  34676. }
  34677. };
  34678. ParserATNSimulator.prototype.getEpsilonTarget = function(config, t, collectPredicates, inContext, fullCtx, treatEofAsEpsilon) {
  34679. switch(t.serializationType) {
  34680. case Transition.RULE:
  34681. return this.ruleTransition(config, t);
  34682. case Transition.PRECEDENCE:
  34683. return this.precedenceTransition(config, t, collectPredicates, inContext, fullCtx);
  34684. case Transition.PREDICATE:
  34685. return this.predTransition(config, t, collectPredicates, inContext, fullCtx);
  34686. case Transition.ACTION:
  34687. return this.actionTransition(config, t);
  34688. case Transition.EPSILON:
  34689. return new ATNConfig({state:t.target}, config);
  34690. case Transition.ATOM:
  34691. case Transition.RANGE:
  34692. case Transition.SET:
  34693. // EOF transitions act like epsilon transitions after the first EOF
  34694. // transition is traversed
  34695. if (treatEofAsEpsilon) {
  34696. if (t.matches(Token.EOF, 0, 1)) {
  34697. return new ATNConfig({state: t.target}, config);
  34698. }
  34699. }
  34700. return null;
  34701. default:
  34702. return null;
  34703. }
  34704. };
  34705. ParserATNSimulator.prototype.actionTransition = function(config, t) {
  34706. if (this.debug) {
  34707. var index = t.actionIndex==-1 ? 65535 : t.actionIndex;
  34708. console.log("ACTION edge " + t.ruleIndex + ":" + index);
  34709. }
  34710. return new ATNConfig({state:t.target}, config);
  34711. };
  34712. ParserATNSimulator.prototype.precedenceTransition = function(config, pt, collectPredicates, inContext, fullCtx) {
  34713. if (this.debug) {
  34714. console.log("PRED (collectPredicates=" + collectPredicates + ") " +
  34715. pt.precedence + ">=_p, ctx dependent=true");
  34716. if (this.parser!==null) {
  34717. console.log("context surrounding pred is " + Utils.arrayToString(this.parser.getRuleInvocationStack()));
  34718. }
  34719. }
  34720. var c = null;
  34721. if (collectPredicates && inContext) {
  34722. if (fullCtx) {
  34723. // In full context mode, we can evaluate predicates on-the-fly
  34724. // during closure, which dramatically reduces the size of
  34725. // the config sets. It also obviates the need to test predicates
  34726. // later during conflict resolution.
  34727. var currentPosition = this._input.index;
  34728. this._input.seek(this._startIndex);
  34729. var predSucceeds = pt.getPredicate().evaluate(this.parser, this._outerContext);
  34730. this._input.seek(currentPosition);
  34731. if (predSucceeds) {
  34732. c = new ATNConfig({state:pt.target}, config); // no pred context
  34733. }
  34734. } else {
  34735. var newSemCtx = SemanticContext.andContext(config.semanticContext, pt.getPredicate());
  34736. c = new ATNConfig({state:pt.target, semanticContext:newSemCtx}, config);
  34737. }
  34738. } else {
  34739. c = new ATNConfig({state:pt.target}, config);
  34740. }
  34741. if (this.debug) {
  34742. console.log("config from pred transition=" + c);
  34743. }
  34744. return c;
  34745. };
  34746. ParserATNSimulator.prototype.predTransition = function(config, pt, collectPredicates, inContext, fullCtx) {
  34747. if (this.debug) {
  34748. console.log("PRED (collectPredicates=" + collectPredicates + ") " + pt.ruleIndex +
  34749. ":" + pt.predIndex + ", ctx dependent=" + pt.isCtxDependent);
  34750. if (this.parser!==null) {
  34751. console.log("context surrounding pred is " + Utils.arrayToString(this.parser.getRuleInvocationStack()));
  34752. }
  34753. }
  34754. var c = null;
  34755. if (collectPredicates && ((pt.isCtxDependent && inContext) || ! pt.isCtxDependent)) {
  34756. if (fullCtx) {
  34757. // In full context mode, we can evaluate predicates on-the-fly
  34758. // during closure, which dramatically reduces the size of
  34759. // the config sets. It also obviates the need to test predicates
  34760. // later during conflict resolution.
  34761. var currentPosition = this._input.index;
  34762. this._input.seek(this._startIndex);
  34763. var predSucceeds = pt.getPredicate().evaluate(this.parser, this._outerContext);
  34764. this._input.seek(currentPosition);
  34765. if (predSucceeds) {
  34766. c = new ATNConfig({state:pt.target}, config); // no pred context
  34767. }
  34768. } else {
  34769. var newSemCtx = SemanticContext.andContext(config.semanticContext, pt.getPredicate());
  34770. c = new ATNConfig({state:pt.target, semanticContext:newSemCtx}, config);
  34771. }
  34772. } else {
  34773. c = new ATNConfig({state:pt.target}, config);
  34774. }
  34775. if (this.debug) {
  34776. console.log("config from pred transition=" + c);
  34777. }
  34778. return c;
  34779. };
  34780. ParserATNSimulator.prototype.ruleTransition = function(config, t) {
  34781. if (this.debug) {
  34782. console.log("CALL rule " + this.getRuleName(t.target.ruleIndex) + ", ctx=" + config.context);
  34783. }
  34784. var returnState = t.followState;
  34785. var newContext = SingletonPredictionContext.create(config.context, returnState.stateNumber);
  34786. return new ATNConfig({state:t.target, context:newContext}, config );
  34787. };
  34788. ParserATNSimulator.prototype.getConflictingAlts = function(configs) {
  34789. var altsets = PredictionMode.getConflictingAltSubsets(configs);
  34790. return PredictionMode.getAlts(altsets);
  34791. };
  34792. // Sam pointed out a problem with the previous definition, v3, of
  34793. // ambiguous states. If we have another state associated with conflicting
  34794. // alternatives, we should keep going. For example, the following grammar
  34795. //
  34796. // s : (ID | ID ID?) ';' ;
  34797. //
  34798. // When the ATN simulation reaches the state before ';', it has a DFA
  34799. // state that looks like: [12|1|[], 6|2|[], 12|2|[]]. Naturally
  34800. // 12|1|[] and 12|2|[] conflict, but we cannot stop processing this node
  34801. // because alternative to has another way to continue, via [6|2|[]].
  34802. // The key is that we have a single state that has config's only associated
  34803. // with a single alternative, 2, and crucially the state transitions
  34804. // among the configurations are all non-epsilon transitions. That means
  34805. // we don't consider any conflicts that include alternative 2. So, we
  34806. // ignore the conflict between alts 1 and 2. We ignore a set of
  34807. // conflicting alts when there is an intersection with an alternative
  34808. // associated with a single alt state in the state&rarr;config-list map.
  34809. //
  34810. // It's also the case that we might have two conflicting configurations but
  34811. // also a 3rd nonconflicting configuration for a different alternative:
  34812. // [1|1|[], 1|2|[], 8|3|[]]. This can come about from grammar:
  34813. //
  34814. // a : A | A | A B ;
  34815. //
  34816. // After matching input A, we reach the stop state for rule A, state 1.
  34817. // State 8 is the state right before B. Clearly alternatives 1 and 2
  34818. // conflict and no amount of further lookahead will separate the two.
  34819. // However, alternative 3 will be able to continue and so we do not
  34820. // stop working on this state. In the previous example, we're concerned
  34821. // with states associated with the conflicting alternatives. Here alt
  34822. // 3 is not associated with the conflicting configs, but since we can continue
  34823. // looking for input reasonably, I don't declare the state done. We
  34824. // ignore a set of conflicting alts when we have an alternative
  34825. // that we still need to pursue.
  34826. //
  34827. ParserATNSimulator.prototype.getConflictingAltsOrUniqueAlt = function(configs) {
  34828. var conflictingAlts = null;
  34829. if (configs.uniqueAlt!== ATN.INVALID_ALT_NUMBER) {
  34830. conflictingAlts = new BitSet();
  34831. conflictingAlts.add(configs.uniqueAlt);
  34832. } else {
  34833. conflictingAlts = configs.conflictingAlts;
  34834. }
  34835. return conflictingAlts;
  34836. };
  34837. ParserATNSimulator.prototype.getTokenName = function( t) {
  34838. if (t===Token.EOF) {
  34839. return "EOF";
  34840. }
  34841. if( this.parser!==null && this.parser.literalNames!==null) {
  34842. if (t >= this.parser.literalNames.length && t >= this.parser.symbolicNames.length) {
  34843. console.log("" + t + " ttype out of range: " + this.parser.literalNames);
  34844. console.log("" + this.parser.getInputStream().getTokens());
  34845. } else {
  34846. var name = this.parser.literalNames[t] || this.parser.symbolicNames[t];
  34847. return name + "<" + t + ">";
  34848. }
  34849. }
  34850. return "" + t;
  34851. };
  34852. ParserATNSimulator.prototype.getLookaheadName = function(input) {
  34853. return this.getTokenName(input.LA(1));
  34854. };
  34855. // Used for debugging in adaptivePredict around execATN but I cut
  34856. // it out for clarity now that alg. works well. We can leave this
  34857. // "dead" code for a bit.
  34858. //
  34859. ParserATNSimulator.prototype.dumpDeadEndConfigs = function(nvae) {
  34860. console.log("dead end configs: ");
  34861. var decs = nvae.getDeadEndConfigs();
  34862. for(var i=0; i<decs.length; i++) {
  34863. var c = decs[i];
  34864. var trans = "no edges";
  34865. if (c.state.transitions.length>0) {
  34866. var t = c.state.transitions[0];
  34867. if (t instanceof AtomTransition) {
  34868. trans = "Atom "+ this.getTokenName(t.label);
  34869. } else if (t instanceof SetTransition) {
  34870. var neg = (t instanceof NotSetTransition);
  34871. trans = (neg ? "~" : "") + "Set " + t.set;
  34872. }
  34873. }
  34874. console.error(c.toString(this.parser, true) + ":" + trans);
  34875. }
  34876. };
  34877. ParserATNSimulator.prototype.noViableAlt = function(input, outerContext, configs, startIndex) {
  34878. return new NoViableAltException(this.parser, input, input.get(startIndex), input.LT(1), configs, outerContext);
  34879. };
  34880. ParserATNSimulator.prototype.getUniqueAlt = function(configs) {
  34881. var alt = ATN.INVALID_ALT_NUMBER;
  34882. for(var i=0;i<configs.items.length;i++) {
  34883. var c = configs.items[i];
  34884. if (alt === ATN.INVALID_ALT_NUMBER) {
  34885. alt = c.alt // found first alt
  34886. } else if( c.alt!==alt) {
  34887. return ATN.INVALID_ALT_NUMBER;
  34888. }
  34889. }
  34890. return alt;
  34891. };
  34892. //
  34893. // Add an edge to the DFA, if possible. This method calls
  34894. // {@link //addDFAState} to ensure the {@code to} state is present in the
  34895. // DFA. If {@code from} is {@code null}, or if {@code t} is outside the
  34896. // range of edges that can be represented in the DFA tables, this method
  34897. // returns without adding the edge to the DFA.
  34898. //
  34899. // <p>If {@code to} is {@code null}, this method returns {@code null}.
  34900. // Otherwise, this method returns the {@link DFAState} returned by calling
  34901. // {@link //addDFAState} for the {@code to} state.</p>
  34902. //
  34903. // @param dfa The DFA
  34904. // @param from The source state for the edge
  34905. // @param t The input symbol
  34906. // @param to The target state for the edge
  34907. //
  34908. // @return If {@code to} is {@code null}, this method returns {@code null};
  34909. // otherwise this method returns the result of calling {@link //addDFAState}
  34910. // on {@code to}
  34911. //
  34912. ParserATNSimulator.prototype.addDFAEdge = function(dfa, from_, t, to) {
  34913. if( this.debug) {
  34914. console.log("EDGE " + from_ + " -> " + to + " upon " + this.getTokenName(t));
  34915. }
  34916. if (to===null) {
  34917. return null;
  34918. }
  34919. to = this.addDFAState(dfa, to); // used existing if possible not incoming
  34920. if (from_===null || t < -1 || t > this.atn.maxTokenType) {
  34921. return to;
  34922. }
  34923. if (from_.edges===null) {
  34924. from_.edges = [];
  34925. }
  34926. from_.edges[t+1] = to; // connect
  34927. if (this.debug) {
  34928. var literalNames = this.parser===null ? null : this.parser.literalNames;
  34929. var symbolicNames = this.parser===null ? null : this.parser.symbolicNames;
  34930. console.log("DFA=\n" + dfa.toString(literalNames, symbolicNames));
  34931. }
  34932. return to;
  34933. };
  34934. //
  34935. // Add state {@code D} to the DFA if it is not already present, and return
  34936. // the actual instance stored in the DFA. If a state equivalent to {@code D}
  34937. // is already in the DFA, the existing state is returned. Otherwise this
  34938. // method returns {@code D} after adding it to the DFA.
  34939. //
  34940. // <p>If {@code D} is {@link //ERROR}, this method returns {@link //ERROR} and
  34941. // does not change the DFA.</p>
  34942. //
  34943. // @param dfa The dfa
  34944. // @param D The DFA state to add
  34945. // @return The state stored in the DFA. This will be either the existing
  34946. // state if {@code D} is already in the DFA, or {@code D} itself if the
  34947. // state was not already present.
  34948. //
  34949. ParserATNSimulator.prototype.addDFAState = function(dfa, D) {
  34950. if (D == ATNSimulator.ERROR) {
  34951. return D;
  34952. }
  34953. var existing = dfa.states.get(D);
  34954. if(existing!==null) {
  34955. return existing;
  34956. }
  34957. D.stateNumber = dfa.states.length;
  34958. if (! D.configs.readOnly) {
  34959. D.configs.optimizeConfigs(this);
  34960. D.configs.setReadonly(true);
  34961. }
  34962. dfa.states.add(D);
  34963. if (this.debug) {
  34964. console.log("adding new DFA state: " + D);
  34965. }
  34966. return D;
  34967. };
  34968. ParserATNSimulator.prototype.reportAttemptingFullContext = function(dfa, conflictingAlts, configs, startIndex, stopIndex) {
  34969. if (this.debug || this.retry_debug) {
  34970. var interval = new Interval(startIndex, stopIndex + 1);
  34971. console.log("reportAttemptingFullContext decision=" + dfa.decision + ":" + configs +
  34972. ", input=" + this.parser.getTokenStream().getText(interval));
  34973. }
  34974. if (this.parser!==null) {
  34975. this.parser.getErrorListenerDispatch().reportAttemptingFullContext(this.parser, dfa, startIndex, stopIndex, conflictingAlts, configs);
  34976. }
  34977. };
  34978. ParserATNSimulator.prototype.reportContextSensitivity = function(dfa, prediction, configs, startIndex, stopIndex) {
  34979. if (this.debug || this.retry_debug) {
  34980. var interval = new Interval(startIndex, stopIndex + 1);
  34981. console.log("reportContextSensitivity decision=" + dfa.decision + ":" + configs +
  34982. ", input=" + this.parser.getTokenStream().getText(interval));
  34983. }
  34984. if (this.parser!==null) {
  34985. this.parser.getErrorListenerDispatch().reportContextSensitivity(this.parser, dfa, startIndex, stopIndex, prediction, configs);
  34986. }
  34987. };
  34988. // If context sensitive parsing, we know it's ambiguity not conflict//
  34989. ParserATNSimulator.prototype.reportAmbiguity = function(dfa, D, startIndex, stopIndex,
  34990. exact, ambigAlts, configs ) {
  34991. if (this.debug || this.retry_debug) {
  34992. var interval = new Interval(startIndex, stopIndex + 1);
  34993. console.log("reportAmbiguity " + ambigAlts + ":" + configs +
  34994. ", input=" + this.parser.getTokenStream().getText(interval));
  34995. }
  34996. if (this.parser!==null) {
  34997. this.parser.getErrorListenerDispatch().reportAmbiguity(this.parser, dfa, startIndex, stopIndex, exact, ambigAlts, configs);
  34998. }
  34999. };
  35000. exports.ParserATNSimulator = ParserATNSimulator;
  35001. /***/ }),
  35002. /***/ "./node_modules/antlr4/atn/PredictionMode.js":
  35003. /*!***************************************************!*\
  35004. !*** ./node_modules/antlr4/atn/PredictionMode.js ***!
  35005. \***************************************************/
  35006. /*! no static exports found */
  35007. /***/ (function(module, exports, __webpack_require__) {
  35008. //
  35009. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  35010. * Use of this file is governed by the BSD 3-clause license that
  35011. * can be found in the LICENSE.txt file in the project root.
  35012. */
  35013. //
  35014. //
  35015. // This enumeration defines the prediction modes available in ANTLR 4 along with
  35016. // utility methods for analyzing configuration sets for conflicts and/or
  35017. // ambiguities.
  35018. var Set = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js").Set;
  35019. var Map = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js").Map;
  35020. var BitSet = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js").BitSet;
  35021. var AltDict = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js").AltDict;
  35022. var ATN = __webpack_require__(/*! ./ATN */ "./node_modules/antlr4/atn/ATN.js").ATN;
  35023. var RuleStopState = __webpack_require__(/*! ./ATNState */ "./node_modules/antlr4/atn/ATNState.js").RuleStopState;
  35024. var ATNConfigSet = __webpack_require__(/*! ./ATNConfigSet */ "./node_modules/antlr4/atn/ATNConfigSet.js").ATNConfigSet;
  35025. var ATNConfig = __webpack_require__(/*! ./ATNConfig */ "./node_modules/antlr4/atn/ATNConfig.js").ATNConfig;
  35026. var SemanticContext = __webpack_require__(/*! ./SemanticContext */ "./node_modules/antlr4/atn/SemanticContext.js").SemanticContext;
  35027. var Hash = __webpack_require__(/*! ../Utils */ "./node_modules/antlr4/Utils.js").Hash;
  35028. var hashStuff = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js").hashStuff;
  35029. var equalArrays = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js").equalArrays;
  35030. function PredictionMode() {
  35031. return this;
  35032. }
  35033. //
  35034. // The SLL(*) prediction mode. This prediction mode ignores the current
  35035. // parser context when making predictions. This is the fastest prediction
  35036. // mode, and provides correct results for many grammars. This prediction
  35037. // mode is more powerful than the prediction mode provided by ANTLR 3, but
  35038. // may result in syntax errors for grammar and input combinations which are
  35039. // not SLL.
  35040. //
  35041. // <p>
  35042. // When using this prediction mode, the parser will either return a correct
  35043. // parse tree (i.e. the same parse tree that would be returned with the
  35044. // {@link //LL} prediction mode), or it will report a syntax error. If a
  35045. // syntax error is encountered when using the {@link //SLL} prediction mode,
  35046. // it may be due to either an actual syntax error in the input or indicate
  35047. // that the particular combination of grammar and input requires the more
  35048. // powerful {@link //LL} prediction abilities to complete successfully.</p>
  35049. //
  35050. // <p>
  35051. // This prediction mode does not provide any guarantees for prediction
  35052. // behavior for syntactically-incorrect inputs.</p>
  35053. //
  35054. PredictionMode.SLL = 0;
  35055. //
  35056. // The LL(*) prediction mode. This prediction mode allows the current parser
  35057. // context to be used for resolving SLL conflicts that occur during
  35058. // prediction. This is the fastest prediction mode that guarantees correct
  35059. // parse results for all combinations of grammars with syntactically correct
  35060. // inputs.
  35061. //
  35062. // <p>
  35063. // When using this prediction mode, the parser will make correct decisions
  35064. // for all syntactically-correct grammar and input combinations. However, in
  35065. // cases where the grammar is truly ambiguous this prediction mode might not
  35066. // report a precise answer for <em>exactly which</em> alternatives are
  35067. // ambiguous.</p>
  35068. //
  35069. // <p>
  35070. // This prediction mode does not provide any guarantees for prediction
  35071. // behavior for syntactically-incorrect inputs.</p>
  35072. //
  35073. PredictionMode.LL = 1;
  35074. //
  35075. // The LL(*) prediction mode with exact ambiguity detection. In addition to
  35076. // the correctness guarantees provided by the {@link //LL} prediction mode,
  35077. // this prediction mode instructs the prediction algorithm to determine the
  35078. // complete and exact set of ambiguous alternatives for every ambiguous
  35079. // decision encountered while parsing.
  35080. //
  35081. // <p>
  35082. // This prediction mode may be used for diagnosing ambiguities during
  35083. // grammar development. Due to the performance overhead of calculating sets
  35084. // of ambiguous alternatives, this prediction mode should be avoided when
  35085. // the exact results are not necessary.</p>
  35086. //
  35087. // <p>
  35088. // This prediction mode does not provide any guarantees for prediction
  35089. // behavior for syntactically-incorrect inputs.</p>
  35090. //
  35091. PredictionMode.LL_EXACT_AMBIG_DETECTION = 2;
  35092. //
  35093. // Computes the SLL prediction termination condition.
  35094. //
  35095. // <p>
  35096. // This method computes the SLL prediction termination condition for both of
  35097. // the following cases.</p>
  35098. //
  35099. // <ul>
  35100. // <li>The usual SLL+LL fallback upon SLL conflict</li>
  35101. // <li>Pure SLL without LL fallback</li>
  35102. // </ul>
  35103. //
  35104. // <p><strong>COMBINED SLL+LL PARSING</strong></p>
  35105. //
  35106. // <p>When LL-fallback is enabled upon SLL conflict, correct predictions are
  35107. // ensured regardless of how the termination condition is computed by this
  35108. // method. Due to the substantially higher cost of LL prediction, the
  35109. // prediction should only fall back to LL when the additional lookahead
  35110. // cannot lead to a unique SLL prediction.</p>
  35111. //
  35112. // <p>Assuming combined SLL+LL parsing, an SLL configuration set with only
  35113. // conflicting subsets should fall back to full LL, even if the
  35114. // configuration sets don't resolve to the same alternative (e.g.
  35115. // {@code {1,2}} and {@code {3,4}}. If there is at least one non-conflicting
  35116. // configuration, SLL could continue with the hopes that more lookahead will
  35117. // resolve via one of those non-conflicting configurations.</p>
  35118. //
  35119. // <p>Here's the prediction termination rule them: SLL (for SLL+LL parsing)
  35120. // stops when it sees only conflicting configuration subsets. In contrast,
  35121. // full LL keeps going when there is uncertainty.</p>
  35122. //
  35123. // <p><strong>HEURISTIC</strong></p>
  35124. //
  35125. // <p>As a heuristic, we stop prediction when we see any conflicting subset
  35126. // unless we see a state that only has one alternative associated with it.
  35127. // The single-alt-state thing lets prediction continue upon rules like
  35128. // (otherwise, it would admit defeat too soon):</p>
  35129. //
  35130. // <p>{@code [12|1|[], 6|2|[], 12|2|[]]. s : (ID | ID ID?) ';' ;}</p>
  35131. //
  35132. // <p>When the ATN simulation reaches the state before {@code ';'}, it has a
  35133. // DFA state that looks like: {@code [12|1|[], 6|2|[], 12|2|[]]}. Naturally
  35134. // {@code 12|1|[]} and {@code 12|2|[]} conflict, but we cannot stop
  35135. // processing this node because alternative to has another way to continue,
  35136. // via {@code [6|2|[]]}.</p>
  35137. //
  35138. // <p>It also let's us continue for this rule:</p>
  35139. //
  35140. // <p>{@code [1|1|[], 1|2|[], 8|3|[]] a : A | A | A B ;}</p>
  35141. //
  35142. // <p>After matching input A, we reach the stop state for rule A, state 1.
  35143. // State 8 is the state right before B. Clearly alternatives 1 and 2
  35144. // conflict and no amount of further lookahead will separate the two.
  35145. // However, alternative 3 will be able to continue and so we do not stop
  35146. // working on this state. In the previous example, we're concerned with
  35147. // states associated with the conflicting alternatives. Here alt 3 is not
  35148. // associated with the conflicting configs, but since we can continue
  35149. // looking for input reasonably, don't declare the state done.</p>
  35150. //
  35151. // <p><strong>PURE SLL PARSING</strong></p>
  35152. //
  35153. // <p>To handle pure SLL parsing, all we have to do is make sure that we
  35154. // combine stack contexts for configurations that differ only by semantic
  35155. // predicate. From there, we can do the usual SLL termination heuristic.</p>
  35156. //
  35157. // <p><strong>PREDICATES IN SLL+LL PARSING</strong></p>
  35158. //
  35159. // <p>SLL decisions don't evaluate predicates until after they reach DFA stop
  35160. // states because they need to create the DFA cache that works in all
  35161. // semantic situations. In contrast, full LL evaluates predicates collected
  35162. // during start state computation so it can ignore predicates thereafter.
  35163. // This means that SLL termination detection can totally ignore semantic
  35164. // predicates.</p>
  35165. //
  35166. // <p>Implementation-wise, {@link ATNConfigSet} combines stack contexts but not
  35167. // semantic predicate contexts so we might see two configurations like the
  35168. // following.</p>
  35169. //
  35170. // <p>{@code (s, 1, x, {}), (s, 1, x', {p})}</p>
  35171. //
  35172. // <p>Before testing these configurations against others, we have to merge
  35173. // {@code x} and {@code x'} (without modifying the existing configurations).
  35174. // For example, we test {@code (x+x')==x''} when looking for conflicts in
  35175. // the following configurations.</p>
  35176. //
  35177. // <p>{@code (s, 1, x, {}), (s, 1, x', {p}), (s, 2, x'', {})}</p>
  35178. //
  35179. // <p>If the configuration set has predicates (as indicated by
  35180. // {@link ATNConfigSet//hasSemanticContext}), this algorithm makes a copy of
  35181. // the configurations to strip out all of the predicates so that a standard
  35182. // {@link ATNConfigSet} will merge everything ignoring predicates.</p>
  35183. //
  35184. PredictionMode.hasSLLConflictTerminatingPrediction = function( mode, configs) {
  35185. // Configs in rule stop states indicate reaching the end of the decision
  35186. // rule (local context) or end of start rule (full context). If all
  35187. // configs meet this condition, then none of the configurations is able
  35188. // to match additional input so we terminate prediction.
  35189. //
  35190. if (PredictionMode.allConfigsInRuleStopStates(configs)) {
  35191. return true;
  35192. }
  35193. // pure SLL mode parsing
  35194. if (mode === PredictionMode.SLL) {
  35195. // Don't bother with combining configs from different semantic
  35196. // contexts if we can fail over to full LL; costs more time
  35197. // since we'll often fail over anyway.
  35198. if (configs.hasSemanticContext) {
  35199. // dup configs, tossing out semantic predicates
  35200. var dup = new ATNConfigSet();
  35201. for(var i=0;i<configs.items.length;i++) {
  35202. var c = configs.items[i];
  35203. c = new ATNConfig({semanticContext:SemanticContext.NONE}, c);
  35204. dup.add(c);
  35205. }
  35206. configs = dup;
  35207. }
  35208. // now we have combined contexts for configs with dissimilar preds
  35209. }
  35210. // pure SLL or combined SLL+LL mode parsing
  35211. var altsets = PredictionMode.getConflictingAltSubsets(configs);
  35212. return PredictionMode.hasConflictingAltSet(altsets) && !PredictionMode.hasStateAssociatedWithOneAlt(configs);
  35213. };
  35214. // Checks if any configuration in {@code configs} is in a
  35215. // {@link RuleStopState}. Configurations meeting this condition have reached
  35216. // the end of the decision rule (local context) or end of start rule (full
  35217. // context).
  35218. //
  35219. // @param configs the configuration set to test
  35220. // @return {@code true} if any configuration in {@code configs} is in a
  35221. // {@link RuleStopState}, otherwise {@code false}
  35222. PredictionMode.hasConfigInRuleStopState = function(configs) {
  35223. for(var i=0;i<configs.items.length;i++) {
  35224. var c = configs.items[i];
  35225. if (c.state instanceof RuleStopState) {
  35226. return true;
  35227. }
  35228. }
  35229. return false;
  35230. };
  35231. // Checks if all configurations in {@code configs} are in a
  35232. // {@link RuleStopState}. Configurations meeting this condition have reached
  35233. // the end of the decision rule (local context) or end of start rule (full
  35234. // context).
  35235. //
  35236. // @param configs the configuration set to test
  35237. // @return {@code true} if all configurations in {@code configs} are in a
  35238. // {@link RuleStopState}, otherwise {@code false}
  35239. PredictionMode.allConfigsInRuleStopStates = function(configs) {
  35240. for(var i=0;i<configs.items.length;i++) {
  35241. var c = configs.items[i];
  35242. if (!(c.state instanceof RuleStopState)) {
  35243. return false;
  35244. }
  35245. }
  35246. return true;
  35247. };
  35248. //
  35249. // Full LL prediction termination.
  35250. //
  35251. // <p>Can we stop looking ahead during ATN simulation or is there some
  35252. // uncertainty as to which alternative we will ultimately pick, after
  35253. // consuming more input? Even if there are partial conflicts, we might know
  35254. // that everything is going to resolve to the same minimum alternative. That
  35255. // means we can stop since no more lookahead will change that fact. On the
  35256. // other hand, there might be multiple conflicts that resolve to different
  35257. // minimums. That means we need more look ahead to decide which of those
  35258. // alternatives we should predict.</p>
  35259. //
  35260. // <p>The basic idea is to split the set of configurations {@code C}, into
  35261. // conflicting subsets {@code (s, _, ctx, _)} and singleton subsets with
  35262. // non-conflicting configurations. Two configurations conflict if they have
  35263. // identical {@link ATNConfig//state} and {@link ATNConfig//context} values
  35264. // but different {@link ATNConfig//alt} value, e.g. {@code (s, i, ctx, _)}
  35265. // and {@code (s, j, ctx, _)} for {@code i!=j}.</p>
  35266. //
  35267. // <p>Reduce these configuration subsets to the set of possible alternatives.
  35268. // You can compute the alternative subsets in one pass as follows:</p>
  35269. //
  35270. // <p>{@code A_s,ctx = {i | (s, i, ctx, _)}} for each configuration in
  35271. // {@code C} holding {@code s} and {@code ctx} fixed.</p>
  35272. //
  35273. // <p>Or in pseudo-code, for each configuration {@code c} in {@code C}:</p>
  35274. //
  35275. // <pre>
  35276. // map[c] U= c.{@link ATNConfig//alt alt} // map hash/equals uses s and x, not
  35277. // alt and not pred
  35278. // </pre>
  35279. //
  35280. // <p>The values in {@code map} are the set of {@code A_s,ctx} sets.</p>
  35281. //
  35282. // <p>If {@code |A_s,ctx|=1} then there is no conflict associated with
  35283. // {@code s} and {@code ctx}.</p>
  35284. //
  35285. // <p>Reduce the subsets to singletons by choosing a minimum of each subset. If
  35286. // the union of these alternative subsets is a singleton, then no amount of
  35287. // more lookahead will help us. We will always pick that alternative. If,
  35288. // however, there is more than one alternative, then we are uncertain which
  35289. // alternative to predict and must continue looking for resolution. We may
  35290. // or may not discover an ambiguity in the future, even if there are no
  35291. // conflicting subsets this round.</p>
  35292. //
  35293. // <p>The biggest sin is to terminate early because it means we've made a
  35294. // decision but were uncertain as to the eventual outcome. We haven't used
  35295. // enough lookahead. On the other hand, announcing a conflict too late is no
  35296. // big deal; you will still have the conflict. It's just inefficient. It
  35297. // might even look until the end of file.</p>
  35298. //
  35299. // <p>No special consideration for semantic predicates is required because
  35300. // predicates are evaluated on-the-fly for full LL prediction, ensuring that
  35301. // no configuration contains a semantic context during the termination
  35302. // check.</p>
  35303. //
  35304. // <p><strong>CONFLICTING CONFIGS</strong></p>
  35305. //
  35306. // <p>Two configurations {@code (s, i, x)} and {@code (s, j, x')}, conflict
  35307. // when {@code i!=j} but {@code x=x'}. Because we merge all
  35308. // {@code (s, i, _)} configurations together, that means that there are at
  35309. // most {@code n} configurations associated with state {@code s} for
  35310. // {@code n} possible alternatives in the decision. The merged stacks
  35311. // complicate the comparison of configuration contexts {@code x} and
  35312. // {@code x'}. Sam checks to see if one is a subset of the other by calling
  35313. // merge and checking to see if the merged result is either {@code x} or
  35314. // {@code x'}. If the {@code x} associated with lowest alternative {@code i}
  35315. // is the superset, then {@code i} is the only possible prediction since the
  35316. // others resolve to {@code min(i)} as well. However, if {@code x} is
  35317. // associated with {@code j>i} then at least one stack configuration for
  35318. // {@code j} is not in conflict with alternative {@code i}. The algorithm
  35319. // should keep going, looking for more lookahead due to the uncertainty.</p>
  35320. //
  35321. // <p>For simplicity, I'm doing a equality check between {@code x} and
  35322. // {@code x'} that lets the algorithm continue to consume lookahead longer
  35323. // than necessary. The reason I like the equality is of course the
  35324. // simplicity but also because that is the test you need to detect the
  35325. // alternatives that are actually in conflict.</p>
  35326. //
  35327. // <p><strong>CONTINUE/STOP RULE</strong></p>
  35328. //
  35329. // <p>Continue if union of resolved alternative sets from non-conflicting and
  35330. // conflicting alternative subsets has more than one alternative. We are
  35331. // uncertain about which alternative to predict.</p>
  35332. //
  35333. // <p>The complete set of alternatives, {@code [i for (_,i,_)]}, tells us which
  35334. // alternatives are still in the running for the amount of input we've
  35335. // consumed at this point. The conflicting sets let us to strip away
  35336. // configurations that won't lead to more states because we resolve
  35337. // conflicts to the configuration with a minimum alternate for the
  35338. // conflicting set.</p>
  35339. //
  35340. // <p><strong>CASES</strong></p>
  35341. //
  35342. // <ul>
  35343. //
  35344. // <li>no conflicts and more than 1 alternative in set =&gt; continue</li>
  35345. //
  35346. // <li> {@code (s, 1, x)}, {@code (s, 2, x)}, {@code (s, 3, z)},
  35347. // {@code (s', 1, y)}, {@code (s', 2, y)} yields non-conflicting set
  35348. // {@code {3}} U conflicting sets {@code min({1,2})} U {@code min({1,2})} =
  35349. // {@code {1,3}} =&gt; continue
  35350. // </li>
  35351. //
  35352. // <li>{@code (s, 1, x)}, {@code (s, 2, x)}, {@code (s', 1, y)},
  35353. // {@code (s', 2, y)}, {@code (s'', 1, z)} yields non-conflicting set
  35354. // {@code {1}} U conflicting sets {@code min({1,2})} U {@code min({1,2})} =
  35355. // {@code {1}} =&gt; stop and predict 1</li>
  35356. //
  35357. // <li>{@code (s, 1, x)}, {@code (s, 2, x)}, {@code (s', 1, y)},
  35358. // {@code (s', 2, y)} yields conflicting, reduced sets {@code {1}} U
  35359. // {@code {1}} = {@code {1}} =&gt; stop and predict 1, can announce
  35360. // ambiguity {@code {1,2}}</li>
  35361. //
  35362. // <li>{@code (s, 1, x)}, {@code (s, 2, x)}, {@code (s', 2, y)},
  35363. // {@code (s', 3, y)} yields conflicting, reduced sets {@code {1}} U
  35364. // {@code {2}} = {@code {1,2}} =&gt; continue</li>
  35365. //
  35366. // <li>{@code (s, 1, x)}, {@code (s, 2, x)}, {@code (s', 3, y)},
  35367. // {@code (s', 4, y)} yields conflicting, reduced sets {@code {1}} U
  35368. // {@code {3}} = {@code {1,3}} =&gt; continue</li>
  35369. //
  35370. // </ul>
  35371. //
  35372. // <p><strong>EXACT AMBIGUITY DETECTION</strong></p>
  35373. //
  35374. // <p>If all states report the same conflicting set of alternatives, then we
  35375. // know we have the exact ambiguity set.</p>
  35376. //
  35377. // <p><code>|A_<em>i</em>|&gt;1</code> and
  35378. // <code>A_<em>i</em> = A_<em>j</em></code> for all <em>i</em>, <em>j</em>.</p>
  35379. //
  35380. // <p>In other words, we continue examining lookahead until all {@code A_i}
  35381. // have more than one alternative and all {@code A_i} are the same. If
  35382. // {@code A={{1,2}, {1,3}}}, then regular LL prediction would terminate
  35383. // because the resolved set is {@code {1}}. To determine what the real
  35384. // ambiguity is, we have to know whether the ambiguity is between one and
  35385. // two or one and three so we keep going. We can only stop prediction when
  35386. // we need exact ambiguity detection when the sets look like
  35387. // {@code A={{1,2}}} or {@code {{1,2},{1,2}}}, etc...</p>
  35388. //
  35389. PredictionMode.resolvesToJustOneViableAlt = function(altsets) {
  35390. return PredictionMode.getSingleViableAlt(altsets);
  35391. };
  35392. //
  35393. // Determines if every alternative subset in {@code altsets} contains more
  35394. // than one alternative.
  35395. //
  35396. // @param altsets a collection of alternative subsets
  35397. // @return {@code true} if every {@link BitSet} in {@code altsets} has
  35398. // {@link BitSet//cardinality cardinality} &gt; 1, otherwise {@code false}
  35399. //
  35400. PredictionMode.allSubsetsConflict = function(altsets) {
  35401. return ! PredictionMode.hasNonConflictingAltSet(altsets);
  35402. };
  35403. //
  35404. // Determines if any single alternative subset in {@code altsets} contains
  35405. // exactly one alternative.
  35406. //
  35407. // @param altsets a collection of alternative subsets
  35408. // @return {@code true} if {@code altsets} contains a {@link BitSet} with
  35409. // {@link BitSet//cardinality cardinality} 1, otherwise {@code false}
  35410. //
  35411. PredictionMode.hasNonConflictingAltSet = function(altsets) {
  35412. for(var i=0;i<altsets.length;i++) {
  35413. var alts = altsets[i];
  35414. if (alts.length===1) {
  35415. return true;
  35416. }
  35417. }
  35418. return false;
  35419. };
  35420. //
  35421. // Determines if any single alternative subset in {@code altsets} contains
  35422. // more than one alternative.
  35423. //
  35424. // @param altsets a collection of alternative subsets
  35425. // @return {@code true} if {@code altsets} contains a {@link BitSet} with
  35426. // {@link BitSet//cardinality cardinality} &gt; 1, otherwise {@code false}
  35427. //
  35428. PredictionMode.hasConflictingAltSet = function(altsets) {
  35429. for(var i=0;i<altsets.length;i++) {
  35430. var alts = altsets[i];
  35431. if (alts.length>1) {
  35432. return true;
  35433. }
  35434. }
  35435. return false;
  35436. };
  35437. //
  35438. // Determines if every alternative subset in {@code altsets} is equivalent.
  35439. //
  35440. // @param altsets a collection of alternative subsets
  35441. // @return {@code true} if every member of {@code altsets} is equal to the
  35442. // others, otherwise {@code false}
  35443. //
  35444. PredictionMode.allSubsetsEqual = function(altsets) {
  35445. var first = null;
  35446. for(var i=0;i<altsets.length;i++) {
  35447. var alts = altsets[i];
  35448. if (first === null) {
  35449. first = alts;
  35450. } else if (alts!==first) {
  35451. return false;
  35452. }
  35453. }
  35454. return true;
  35455. };
  35456. //
  35457. // Returns the unique alternative predicted by all alternative subsets in
  35458. // {@code altsets}. If no such alternative exists, this method returns
  35459. // {@link ATN//INVALID_ALT_NUMBER}.
  35460. //
  35461. // @param altsets a collection of alternative subsets
  35462. //
  35463. PredictionMode.getUniqueAlt = function(altsets) {
  35464. var all = PredictionMode.getAlts(altsets);
  35465. if (all.length===1) {
  35466. return all.minValue();
  35467. } else {
  35468. return ATN.INVALID_ALT_NUMBER;
  35469. }
  35470. };
  35471. // Gets the complete set of represented alternatives for a collection of
  35472. // alternative subsets. This method returns the union of each {@link BitSet}
  35473. // in {@code altsets}.
  35474. //
  35475. // @param altsets a collection of alternative subsets
  35476. // @return the set of represented alternatives in {@code altsets}
  35477. //
  35478. PredictionMode.getAlts = function(altsets) {
  35479. var all = new BitSet();
  35480. altsets.map( function(alts) { all.or(alts); });
  35481. return all;
  35482. };
  35483. //
  35484. // This function gets the conflicting alt subsets from a configuration set.
  35485. // For each configuration {@code c} in {@code configs}:
  35486. //
  35487. // <pre>
  35488. // map[c] U= c.{@link ATNConfig//alt alt} // map hash/equals uses s and x, not
  35489. // alt and not pred
  35490. // </pre>
  35491. PredictionMode.getConflictingAltSubsets = function(configs) {
  35492. var configToAlts = new Map();
  35493. configToAlts.hashFunction = function(cfg) { hashStuff(cfg.state.stateNumber, cfg.context); };
  35494. configToAlts.equalsFunction = function(c1, c2) { return c1.state.stateNumber==c2.state.stateNumber && c1.context.equals(c2.context);}
  35495. configs.items.map(function(cfg) {
  35496. var alts = configToAlts.get(cfg);
  35497. if (alts === null) {
  35498. alts = new BitSet();
  35499. configToAlts.put(cfg, alts);
  35500. }
  35501. alts.add(cfg.alt);
  35502. });
  35503. return configToAlts.getValues();
  35504. };
  35505. //
  35506. // Get a map from state to alt subset from a configuration set. For each
  35507. // configuration {@code c} in {@code configs}:
  35508. //
  35509. // <pre>
  35510. // map[c.{@link ATNConfig//state state}] U= c.{@link ATNConfig//alt alt}
  35511. // </pre>
  35512. //
  35513. PredictionMode.getStateToAltMap = function(configs) {
  35514. var m = new AltDict();
  35515. configs.items.map(function(c) {
  35516. var alts = m.get(c.state);
  35517. if (alts === null) {
  35518. alts = new BitSet();
  35519. m.put(c.state, alts);
  35520. }
  35521. alts.add(c.alt);
  35522. });
  35523. return m;
  35524. };
  35525. PredictionMode.hasStateAssociatedWithOneAlt = function(configs) {
  35526. var values = PredictionMode.getStateToAltMap(configs).values();
  35527. for(var i=0;i<values.length;i++) {
  35528. if (values[i].length===1) {
  35529. return true;
  35530. }
  35531. }
  35532. return false;
  35533. };
  35534. PredictionMode.getSingleViableAlt = function(altsets) {
  35535. var result = null;
  35536. for(var i=0;i<altsets.length;i++) {
  35537. var alts = altsets[i];
  35538. var minAlt = alts.minValue();
  35539. if(result===null) {
  35540. result = minAlt;
  35541. } else if(result!==minAlt) { // more than 1 viable alt
  35542. return ATN.INVALID_ALT_NUMBER;
  35543. }
  35544. }
  35545. return result;
  35546. };
  35547. exports.PredictionMode = PredictionMode;
  35548. /***/ }),
  35549. /***/ "./node_modules/antlr4/atn/SemanticContext.js":
  35550. /*!****************************************************!*\
  35551. !*** ./node_modules/antlr4/atn/SemanticContext.js ***!
  35552. \****************************************************/
  35553. /*! no static exports found */
  35554. /***/ (function(module, exports, __webpack_require__) {
  35555. //
  35556. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  35557. * Use of this file is governed by the BSD 3-clause license that
  35558. * can be found in the LICENSE.txt file in the project root.
  35559. */
  35560. //
  35561. // A tree structure used to record the semantic context in which
  35562. // an ATN configuration is valid. It's either a single predicate,
  35563. // a conjunction {@code p1&&p2}, or a sum of products {@code p1||p2}.
  35564. //
  35565. // <p>I have scoped the {@link AND}, {@link OR}, and {@link Predicate} subclasses of
  35566. // {@link SemanticContext} within the scope of this outer class.</p>
  35567. //
  35568. var Set = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js").Set;
  35569. var Hash = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js").Hash;
  35570. function SemanticContext() {
  35571. return this;
  35572. }
  35573. SemanticContext.prototype.hashCode = function() {
  35574. var hash = new Hash();
  35575. this.updateHashCode(hash);
  35576. return hash.finish();
  35577. };
  35578. // For context independent predicates, we evaluate them without a local
  35579. // context (i.e., null context). That way, we can evaluate them without
  35580. // having to create proper rule-specific context during prediction (as
  35581. // opposed to the parser, which creates them naturally). In a practical
  35582. // sense, this avoids a cast exception from RuleContext to myruleContext.
  35583. //
  35584. // <p>For context dependent predicates, we must pass in a local context so that
  35585. // references such as $arg evaluate properly as _localctx.arg. We only
  35586. // capture context dependent predicates in the context in which we begin
  35587. // prediction, so we passed in the outer context here in case of context
  35588. // dependent predicate evaluation.</p>
  35589. //
  35590. SemanticContext.prototype.evaluate = function(parser, outerContext) {
  35591. };
  35592. //
  35593. // Evaluate the precedence predicates for the context and reduce the result.
  35594. //
  35595. // @param parser The parser instance.
  35596. // @param outerContext The current parser context object.
  35597. // @return The simplified semantic context after precedence predicates are
  35598. // evaluated, which will be one of the following values.
  35599. // <ul>
  35600. // <li>{@link //NONE}: if the predicate simplifies to {@code true} after
  35601. // precedence predicates are evaluated.</li>
  35602. // <li>{@code null}: if the predicate simplifies to {@code false} after
  35603. // precedence predicates are evaluated.</li>
  35604. // <li>{@code this}: if the semantic context is not changed as a result of
  35605. // precedence predicate evaluation.</li>
  35606. // <li>A non-{@code null} {@link SemanticContext}: the new simplified
  35607. // semantic context after precedence predicates are evaluated.</li>
  35608. // </ul>
  35609. //
  35610. SemanticContext.prototype.evalPrecedence = function(parser, outerContext) {
  35611. return this;
  35612. };
  35613. SemanticContext.andContext = function(a, b) {
  35614. if (a === null || a === SemanticContext.NONE) {
  35615. return b;
  35616. }
  35617. if (b === null || b === SemanticContext.NONE) {
  35618. return a;
  35619. }
  35620. var result = new AND(a, b);
  35621. if (result.opnds.length === 1) {
  35622. return result.opnds[0];
  35623. } else {
  35624. return result;
  35625. }
  35626. };
  35627. SemanticContext.orContext = function(a, b) {
  35628. if (a === null) {
  35629. return b;
  35630. }
  35631. if (b === null) {
  35632. return a;
  35633. }
  35634. if (a === SemanticContext.NONE || b === SemanticContext.NONE) {
  35635. return SemanticContext.NONE;
  35636. }
  35637. var result = new OR(a, b);
  35638. if (result.opnds.length === 1) {
  35639. return result.opnds[0];
  35640. } else {
  35641. return result;
  35642. }
  35643. };
  35644. function Predicate(ruleIndex, predIndex, isCtxDependent) {
  35645. SemanticContext.call(this);
  35646. this.ruleIndex = ruleIndex === undefined ? -1 : ruleIndex;
  35647. this.predIndex = predIndex === undefined ? -1 : predIndex;
  35648. this.isCtxDependent = isCtxDependent === undefined ? false : isCtxDependent; // e.g., $i ref in pred
  35649. return this;
  35650. }
  35651. Predicate.prototype = Object.create(SemanticContext.prototype);
  35652. Predicate.prototype.constructor = Predicate;
  35653. //The default {@link SemanticContext}, which is semantically equivalent to
  35654. //a predicate of the form {@code {true}?}.
  35655. //
  35656. SemanticContext.NONE = new Predicate();
  35657. Predicate.prototype.evaluate = function(parser, outerContext) {
  35658. var localctx = this.isCtxDependent ? outerContext : null;
  35659. return parser.sempred(localctx, this.ruleIndex, this.predIndex);
  35660. };
  35661. Predicate.prototype.updateHashCode = function(hash) {
  35662. hash.update(this.ruleIndex, this.predIndex, this.isCtxDependent);
  35663. };
  35664. Predicate.prototype.equals = function(other) {
  35665. if (this === other) {
  35666. return true;
  35667. } else if (!(other instanceof Predicate)) {
  35668. return false;
  35669. } else {
  35670. return this.ruleIndex === other.ruleIndex &&
  35671. this.predIndex === other.predIndex &&
  35672. this.isCtxDependent === other.isCtxDependent;
  35673. }
  35674. };
  35675. Predicate.prototype.toString = function() {
  35676. return "{" + this.ruleIndex + ":" + this.predIndex + "}?";
  35677. };
  35678. function PrecedencePredicate(precedence) {
  35679. SemanticContext.call(this);
  35680. this.precedence = precedence === undefined ? 0 : precedence;
  35681. }
  35682. PrecedencePredicate.prototype = Object.create(SemanticContext.prototype);
  35683. PrecedencePredicate.prototype.constructor = PrecedencePredicate;
  35684. PrecedencePredicate.prototype.evaluate = function(parser, outerContext) {
  35685. return parser.precpred(outerContext, this.precedence);
  35686. };
  35687. PrecedencePredicate.prototype.evalPrecedence = function(parser, outerContext) {
  35688. if (parser.precpred(outerContext, this.precedence)) {
  35689. return SemanticContext.NONE;
  35690. } else {
  35691. return null;
  35692. }
  35693. };
  35694. PrecedencePredicate.prototype.compareTo = function(other) {
  35695. return this.precedence - other.precedence;
  35696. };
  35697. PrecedencePredicate.prototype.updateHashCode = function(hash) {
  35698. hash.update(31);
  35699. };
  35700. PrecedencePredicate.prototype.equals = function(other) {
  35701. if (this === other) {
  35702. return true;
  35703. } else if (!(other instanceof PrecedencePredicate)) {
  35704. return false;
  35705. } else {
  35706. return this.precedence === other.precedence;
  35707. }
  35708. };
  35709. PrecedencePredicate.prototype.toString = function() {
  35710. return "{"+this.precedence+">=prec}?";
  35711. };
  35712. PrecedencePredicate.filterPrecedencePredicates = function(set) {
  35713. var result = [];
  35714. set.values().map( function(context) {
  35715. if (context instanceof PrecedencePredicate) {
  35716. result.push(context);
  35717. }
  35718. });
  35719. return result;
  35720. };
  35721. // A semantic context which is true whenever none of the contained contexts
  35722. // is false.
  35723. //
  35724. function AND(a, b) {
  35725. SemanticContext.call(this);
  35726. var operands = new Set();
  35727. if (a instanceof AND) {
  35728. a.opnds.map(function(o) {
  35729. operands.add(o);
  35730. });
  35731. } else {
  35732. operands.add(a);
  35733. }
  35734. if (b instanceof AND) {
  35735. b.opnds.map(function(o) {
  35736. operands.add(o);
  35737. });
  35738. } else {
  35739. operands.add(b);
  35740. }
  35741. var precedencePredicates = PrecedencePredicate.filterPrecedencePredicates(operands);
  35742. if (precedencePredicates.length > 0) {
  35743. // interested in the transition with the lowest precedence
  35744. var reduced = null;
  35745. precedencePredicates.map( function(p) {
  35746. if(reduced===null || p.precedence<reduced.precedence) {
  35747. reduced = p;
  35748. }
  35749. });
  35750. operands.add(reduced);
  35751. }
  35752. this.opnds = operands.values();
  35753. return this;
  35754. }
  35755. AND.prototype = Object.create(SemanticContext.prototype);
  35756. AND.prototype.constructor = AND;
  35757. AND.prototype.equals = function(other) {
  35758. if (this === other) {
  35759. return true;
  35760. } else if (!(other instanceof AND)) {
  35761. return false;
  35762. } else {
  35763. return this.opnds === other.opnds;
  35764. }
  35765. };
  35766. AND.prototype.updateHashCode = function(hash) {
  35767. hash.update(this.opnds, "AND");
  35768. };
  35769. //
  35770. // {@inheritDoc}
  35771. //
  35772. // <p>
  35773. // The evaluation of predicates by this context is short-circuiting, but
  35774. // unordered.</p>
  35775. //
  35776. AND.prototype.evaluate = function(parser, outerContext) {
  35777. for (var i = 0; i < this.opnds.length; i++) {
  35778. if (!this.opnds[i].evaluate(parser, outerContext)) {
  35779. return false;
  35780. }
  35781. }
  35782. return true;
  35783. };
  35784. AND.prototype.evalPrecedence = function(parser, outerContext) {
  35785. var differs = false;
  35786. var operands = [];
  35787. for (var i = 0; i < this.opnds.length; i++) {
  35788. var context = this.opnds[i];
  35789. var evaluated = context.evalPrecedence(parser, outerContext);
  35790. differs |= (evaluated !== context);
  35791. if (evaluated === null) {
  35792. // The AND context is false if any element is false
  35793. return null;
  35794. } else if (evaluated !== SemanticContext.NONE) {
  35795. // Reduce the result by skipping true elements
  35796. operands.push(evaluated);
  35797. }
  35798. }
  35799. if (!differs) {
  35800. return this;
  35801. }
  35802. if (operands.length === 0) {
  35803. // all elements were true, so the AND context is true
  35804. return SemanticContext.NONE;
  35805. }
  35806. var result = null;
  35807. operands.map(function(o) {
  35808. result = result === null ? o : SemanticContext.andContext(result, o);
  35809. });
  35810. return result;
  35811. };
  35812. AND.prototype.toString = function() {
  35813. var s = "";
  35814. this.opnds.map(function(o) {
  35815. s += "&& " + o.toString();
  35816. });
  35817. return s.length > 3 ? s.slice(3) : s;
  35818. };
  35819. //
  35820. // A semantic context which is true whenever at least one of the contained
  35821. // contexts is true.
  35822. //
  35823. function OR(a, b) {
  35824. SemanticContext.call(this);
  35825. var operands = new Set();
  35826. if (a instanceof OR) {
  35827. a.opnds.map(function(o) {
  35828. operands.add(o);
  35829. });
  35830. } else {
  35831. operands.add(a);
  35832. }
  35833. if (b instanceof OR) {
  35834. b.opnds.map(function(o) {
  35835. operands.add(o);
  35836. });
  35837. } else {
  35838. operands.add(b);
  35839. }
  35840. var precedencePredicates = PrecedencePredicate.filterPrecedencePredicates(operands);
  35841. if (precedencePredicates.length > 0) {
  35842. // interested in the transition with the highest precedence
  35843. var s = precedencePredicates.sort(function(a, b) {
  35844. return a.compareTo(b);
  35845. });
  35846. var reduced = s[s.length-1];
  35847. operands.add(reduced);
  35848. }
  35849. this.opnds = operands.values();
  35850. return this;
  35851. }
  35852. OR.prototype = Object.create(SemanticContext.prototype);
  35853. OR.prototype.constructor = OR;
  35854. OR.prototype.constructor = function(other) {
  35855. if (this === other) {
  35856. return true;
  35857. } else if (!(other instanceof OR)) {
  35858. return false;
  35859. } else {
  35860. return this.opnds === other.opnds;
  35861. }
  35862. };
  35863. OR.prototype.updateHashCode = function(hash) {
  35864. hash.update(this.opnds, "OR");
  35865. };
  35866. // <p>
  35867. // The evaluation of predicates by this context is short-circuiting, but
  35868. // unordered.</p>
  35869. //
  35870. OR.prototype.evaluate = function(parser, outerContext) {
  35871. for (var i = 0; i < this.opnds.length; i++) {
  35872. if (this.opnds[i].evaluate(parser, outerContext)) {
  35873. return true;
  35874. }
  35875. }
  35876. return false;
  35877. };
  35878. OR.prototype.evalPrecedence = function(parser, outerContext) {
  35879. var differs = false;
  35880. var operands = [];
  35881. for (var i = 0; i < this.opnds.length; i++) {
  35882. var context = this.opnds[i];
  35883. var evaluated = context.evalPrecedence(parser, outerContext);
  35884. differs |= (evaluated !== context);
  35885. if (evaluated === SemanticContext.NONE) {
  35886. // The OR context is true if any element is true
  35887. return SemanticContext.NONE;
  35888. } else if (evaluated !== null) {
  35889. // Reduce the result by skipping false elements
  35890. operands.push(evaluated);
  35891. }
  35892. }
  35893. if (!differs) {
  35894. return this;
  35895. }
  35896. if (operands.length === 0) {
  35897. // all elements were false, so the OR context is false
  35898. return null;
  35899. }
  35900. var result = null;
  35901. operands.map(function(o) {
  35902. return result === null ? o : SemanticContext.orContext(result, o);
  35903. });
  35904. return result;
  35905. };
  35906. OR.prototype.toString = function() {
  35907. var s = "";
  35908. this.opnds.map(function(o) {
  35909. s += "|| " + o.toString();
  35910. });
  35911. return s.length > 3 ? s.slice(3) : s;
  35912. };
  35913. exports.SemanticContext = SemanticContext;
  35914. exports.PrecedencePredicate = PrecedencePredicate;
  35915. exports.Predicate = Predicate;
  35916. /***/ }),
  35917. /***/ "./node_modules/antlr4/atn/Transition.js":
  35918. /*!***********************************************!*\
  35919. !*** ./node_modules/antlr4/atn/Transition.js ***!
  35920. \***********************************************/
  35921. /*! no static exports found */
  35922. /***/ (function(module, exports, __webpack_require__) {
  35923. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  35924. * Use of this file is governed by the BSD 3-clause license that
  35925. * can be found in the LICENSE.txt file in the project root.
  35926. */
  35927. //
  35928. // An ATN transition between any two ATN states. Subclasses define
  35929. // atom, set, epsilon, action, predicate, rule transitions.
  35930. //
  35931. // <p>This is a one way link. It emanates from a state (usually via a list of
  35932. // transitions) and has a target state.</p>
  35933. //
  35934. // <p>Since we never have to change the ATN transitions once we construct it,
  35935. // we can fix these transitions as specific classes. The DFA transitions
  35936. // on the other hand need to update the labels as it adds transitions to
  35937. // the states. We'll use the term Edge for the DFA to distinguish them from
  35938. // ATN transitions.</p>
  35939. var Token = __webpack_require__(/*! ./../Token */ "./node_modules/antlr4/Token.js").Token;
  35940. var Interval = __webpack_require__(/*! ./../IntervalSet */ "./node_modules/antlr4/IntervalSet.js").Interval;
  35941. var IntervalSet = __webpack_require__(/*! ./../IntervalSet */ "./node_modules/antlr4/IntervalSet.js").IntervalSet;
  35942. var Predicate = __webpack_require__(/*! ./SemanticContext */ "./node_modules/antlr4/atn/SemanticContext.js").Predicate;
  35943. var PrecedencePredicate = __webpack_require__(/*! ./SemanticContext */ "./node_modules/antlr4/atn/SemanticContext.js").PrecedencePredicate;
  35944. function Transition (target) {
  35945. // The target of this transition.
  35946. if (target===undefined || target===null) {
  35947. throw "target cannot be null.";
  35948. }
  35949. this.target = target;
  35950. // Are we epsilon, action, sempred?
  35951. this.isEpsilon = false;
  35952. this.label = null;
  35953. return this;
  35954. }
  35955. // constants for serialization
  35956. Transition.EPSILON = 1;
  35957. Transition.RANGE = 2;
  35958. Transition.RULE = 3;
  35959. Transition.PREDICATE = 4; // e.g., {isType(input.LT(1))}?
  35960. Transition.ATOM = 5;
  35961. Transition.ACTION = 6;
  35962. Transition.SET = 7; // ~(A|B) or ~atom, wildcard, which convert to next 2
  35963. Transition.NOT_SET = 8;
  35964. Transition.WILDCARD = 9;
  35965. Transition.PRECEDENCE = 10;
  35966. Transition.serializationNames = [
  35967. "INVALID",
  35968. "EPSILON",
  35969. "RANGE",
  35970. "RULE",
  35971. "PREDICATE",
  35972. "ATOM",
  35973. "ACTION",
  35974. "SET",
  35975. "NOT_SET",
  35976. "WILDCARD",
  35977. "PRECEDENCE"
  35978. ];
  35979. Transition.serializationTypes = {
  35980. EpsilonTransition: Transition.EPSILON,
  35981. RangeTransition: Transition.RANGE,
  35982. RuleTransition: Transition.RULE,
  35983. PredicateTransition: Transition.PREDICATE,
  35984. AtomTransition: Transition.ATOM,
  35985. ActionTransition: Transition.ACTION,
  35986. SetTransition: Transition.SET,
  35987. NotSetTransition: Transition.NOT_SET,
  35988. WildcardTransition: Transition.WILDCARD,
  35989. PrecedencePredicateTransition: Transition.PRECEDENCE
  35990. };
  35991. // TODO: make all transitions sets? no, should remove set edges
  35992. function AtomTransition(target, label) {
  35993. Transition.call(this, target);
  35994. this.label_ = label; // The token type or character value; or, signifies special label.
  35995. this.label = this.makeLabel();
  35996. this.serializationType = Transition.ATOM;
  35997. return this;
  35998. }
  35999. AtomTransition.prototype = Object.create(Transition.prototype);
  36000. AtomTransition.prototype.constructor = AtomTransition;
  36001. AtomTransition.prototype.makeLabel = function() {
  36002. var s = new IntervalSet();
  36003. s.addOne(this.label_);
  36004. return s;
  36005. };
  36006. AtomTransition.prototype.matches = function( symbol, minVocabSymbol, maxVocabSymbol) {
  36007. return this.label_ === symbol;
  36008. };
  36009. AtomTransition.prototype.toString = function() {
  36010. return this.label_;
  36011. };
  36012. function RuleTransition(ruleStart, ruleIndex, precedence, followState) {
  36013. Transition.call(this, ruleStart);
  36014. this.ruleIndex = ruleIndex; // ptr to the rule definition object for this rule ref
  36015. this.precedence = precedence;
  36016. this.followState = followState; // what node to begin computations following ref to rule
  36017. this.serializationType = Transition.RULE;
  36018. this.isEpsilon = true;
  36019. return this;
  36020. }
  36021. RuleTransition.prototype = Object.create(Transition.prototype);
  36022. RuleTransition.prototype.constructor = RuleTransition;
  36023. RuleTransition.prototype.matches = function(symbol, minVocabSymbol, maxVocabSymbol) {
  36024. return false;
  36025. };
  36026. function EpsilonTransition(target, outermostPrecedenceReturn) {
  36027. Transition.call(this, target);
  36028. this.serializationType = Transition.EPSILON;
  36029. this.isEpsilon = true;
  36030. this.outermostPrecedenceReturn = outermostPrecedenceReturn;
  36031. return this;
  36032. }
  36033. EpsilonTransition.prototype = Object.create(Transition.prototype);
  36034. EpsilonTransition.prototype.constructor = EpsilonTransition;
  36035. EpsilonTransition.prototype.matches = function( symbol, minVocabSymbol, maxVocabSymbol) {
  36036. return false;
  36037. };
  36038. EpsilonTransition.prototype.toString = function() {
  36039. return "epsilon";
  36040. };
  36041. function RangeTransition(target, start, stop) {
  36042. Transition.call(this, target);
  36043. this.serializationType = Transition.RANGE;
  36044. this.start = start;
  36045. this.stop = stop;
  36046. this.label = this.makeLabel();
  36047. return this;
  36048. }
  36049. RangeTransition.prototype = Object.create(Transition.prototype);
  36050. RangeTransition.prototype.constructor = RangeTransition;
  36051. RangeTransition.prototype.makeLabel = function() {
  36052. var s = new IntervalSet();
  36053. s.addRange(this.start, this.stop);
  36054. return s;
  36055. };
  36056. RangeTransition.prototype.matches = function(symbol, minVocabSymbol, maxVocabSymbol) {
  36057. return symbol >= this.start && symbol <= this.stop;
  36058. };
  36059. RangeTransition.prototype.toString = function() {
  36060. return "'" + String.fromCharCode(this.start) + "'..'" + String.fromCharCode(this.stop) + "'";
  36061. };
  36062. function AbstractPredicateTransition(target) {
  36063. Transition.call(this, target);
  36064. return this;
  36065. }
  36066. AbstractPredicateTransition.prototype = Object.create(Transition.prototype);
  36067. AbstractPredicateTransition.prototype.constructor = AbstractPredicateTransition;
  36068. function PredicateTransition(target, ruleIndex, predIndex, isCtxDependent) {
  36069. AbstractPredicateTransition.call(this, target);
  36070. this.serializationType = Transition.PREDICATE;
  36071. this.ruleIndex = ruleIndex;
  36072. this.predIndex = predIndex;
  36073. this.isCtxDependent = isCtxDependent; // e.g., $i ref in pred
  36074. this.isEpsilon = true;
  36075. return this;
  36076. }
  36077. PredicateTransition.prototype = Object.create(AbstractPredicateTransition.prototype);
  36078. PredicateTransition.prototype.constructor = PredicateTransition;
  36079. PredicateTransition.prototype.matches = function(symbol, minVocabSymbol, maxVocabSymbol) {
  36080. return false;
  36081. };
  36082. PredicateTransition.prototype.getPredicate = function() {
  36083. return new Predicate(this.ruleIndex, this.predIndex, this.isCtxDependent);
  36084. };
  36085. PredicateTransition.prototype.toString = function() {
  36086. return "pred_" + this.ruleIndex + ":" + this.predIndex;
  36087. };
  36088. function ActionTransition(target, ruleIndex, actionIndex, isCtxDependent) {
  36089. Transition.call(this, target);
  36090. this.serializationType = Transition.ACTION;
  36091. this.ruleIndex = ruleIndex;
  36092. this.actionIndex = actionIndex===undefined ? -1 : actionIndex;
  36093. this.isCtxDependent = isCtxDependent===undefined ? false : isCtxDependent; // e.g., $i ref in pred
  36094. this.isEpsilon = true;
  36095. return this;
  36096. }
  36097. ActionTransition.prototype = Object.create(Transition.prototype);
  36098. ActionTransition.prototype.constructor = ActionTransition;
  36099. ActionTransition.prototype.matches = function(symbol, minVocabSymbol, maxVocabSymbol) {
  36100. return false;
  36101. };
  36102. ActionTransition.prototype.toString = function() {
  36103. return "action_" + this.ruleIndex + ":" + this.actionIndex;
  36104. };
  36105. // A transition containing a set of values.
  36106. function SetTransition(target, set) {
  36107. Transition.call(this, target);
  36108. this.serializationType = Transition.SET;
  36109. if (set !==undefined && set !==null) {
  36110. this.label = set;
  36111. } else {
  36112. this.label = new IntervalSet();
  36113. this.label.addOne(Token.INVALID_TYPE);
  36114. }
  36115. return this;
  36116. }
  36117. SetTransition.prototype = Object.create(Transition.prototype);
  36118. SetTransition.prototype.constructor = SetTransition;
  36119. SetTransition.prototype.matches = function(symbol, minVocabSymbol, maxVocabSymbol) {
  36120. return this.label.contains(symbol);
  36121. };
  36122. SetTransition.prototype.toString = function() {
  36123. return this.label.toString();
  36124. };
  36125. function NotSetTransition(target, set) {
  36126. SetTransition.call(this, target, set);
  36127. this.serializationType = Transition.NOT_SET;
  36128. return this;
  36129. }
  36130. NotSetTransition.prototype = Object.create(SetTransition.prototype);
  36131. NotSetTransition.prototype.constructor = NotSetTransition;
  36132. NotSetTransition.prototype.matches = function(symbol, minVocabSymbol, maxVocabSymbol) {
  36133. return symbol >= minVocabSymbol && symbol <= maxVocabSymbol &&
  36134. !SetTransition.prototype.matches.call(this, symbol, minVocabSymbol, maxVocabSymbol);
  36135. };
  36136. NotSetTransition.prototype.toString = function() {
  36137. return '~' + SetTransition.prototype.toString.call(this);
  36138. };
  36139. function WildcardTransition(target) {
  36140. Transition.call(this, target);
  36141. this.serializationType = Transition.WILDCARD;
  36142. return this;
  36143. }
  36144. WildcardTransition.prototype = Object.create(Transition.prototype);
  36145. WildcardTransition.prototype.constructor = WildcardTransition;
  36146. WildcardTransition.prototype.matches = function(symbol, minVocabSymbol, maxVocabSymbol) {
  36147. return symbol >= minVocabSymbol && symbol <= maxVocabSymbol;
  36148. };
  36149. WildcardTransition.prototype.toString = function() {
  36150. return ".";
  36151. };
  36152. function PrecedencePredicateTransition(target, precedence) {
  36153. AbstractPredicateTransition.call(this, target);
  36154. this.serializationType = Transition.PRECEDENCE;
  36155. this.precedence = precedence;
  36156. this.isEpsilon = true;
  36157. return this;
  36158. }
  36159. PrecedencePredicateTransition.prototype = Object.create(AbstractPredicateTransition.prototype);
  36160. PrecedencePredicateTransition.prototype.constructor = PrecedencePredicateTransition;
  36161. PrecedencePredicateTransition.prototype.matches = function(symbol, minVocabSymbol, maxVocabSymbol) {
  36162. return false;
  36163. };
  36164. PrecedencePredicateTransition.prototype.getPredicate = function() {
  36165. return new PrecedencePredicate(this.precedence);
  36166. };
  36167. PrecedencePredicateTransition.prototype.toString = function() {
  36168. return this.precedence + " >= _p";
  36169. };
  36170. exports.Transition = Transition;
  36171. exports.AtomTransition = AtomTransition;
  36172. exports.SetTransition = SetTransition;
  36173. exports.NotSetTransition = NotSetTransition;
  36174. exports.RuleTransition = RuleTransition;
  36175. exports.ActionTransition = ActionTransition;
  36176. exports.EpsilonTransition = EpsilonTransition;
  36177. exports.RangeTransition = RangeTransition;
  36178. exports.WildcardTransition = WildcardTransition;
  36179. exports.PredicateTransition = PredicateTransition;
  36180. exports.PrecedencePredicateTransition = PrecedencePredicateTransition;
  36181. exports.AbstractPredicateTransition = AbstractPredicateTransition;
  36182. /***/ }),
  36183. /***/ "./node_modules/antlr4/atn/index.js":
  36184. /*!******************************************!*\
  36185. !*** ./node_modules/antlr4/atn/index.js ***!
  36186. \******************************************/
  36187. /*! no static exports found */
  36188. /***/ (function(module, exports, __webpack_require__) {
  36189. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  36190. * Use of this file is governed by the BSD 3-clause license that
  36191. * can be found in the LICENSE.txt file in the project root.
  36192. */
  36193. exports.ATN = __webpack_require__(/*! ./ATN */ "./node_modules/antlr4/atn/ATN.js").ATN;
  36194. exports.ATNDeserializer = __webpack_require__(/*! ./ATNDeserializer */ "./node_modules/antlr4/atn/ATNDeserializer.js").ATNDeserializer;
  36195. exports.LexerATNSimulator = __webpack_require__(/*! ./LexerATNSimulator */ "./node_modules/antlr4/atn/LexerATNSimulator.js").LexerATNSimulator;
  36196. exports.ParserATNSimulator = __webpack_require__(/*! ./ParserATNSimulator */ "./node_modules/antlr4/atn/ParserATNSimulator.js").ParserATNSimulator;
  36197. exports.PredictionMode = __webpack_require__(/*! ./PredictionMode */ "./node_modules/antlr4/atn/PredictionMode.js").PredictionMode;
  36198. /***/ }),
  36199. /***/ "./node_modules/antlr4/dfa/DFA.js":
  36200. /*!****************************************!*\
  36201. !*** ./node_modules/antlr4/dfa/DFA.js ***!
  36202. \****************************************/
  36203. /*! no static exports found */
  36204. /***/ (function(module, exports, __webpack_require__) {
  36205. //
  36206. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  36207. * Use of this file is governed by the BSD 3-clause license that
  36208. * can be found in the LICENSE.txt file in the project root.
  36209. */
  36210. var Set = __webpack_require__(/*! ../Utils */ "./node_modules/antlr4/Utils.js").Set;
  36211. var DFAState = __webpack_require__(/*! ./DFAState */ "./node_modules/antlr4/dfa/DFAState.js").DFAState;
  36212. var StarLoopEntryState = __webpack_require__(/*! ../atn/ATNState */ "./node_modules/antlr4/atn/ATNState.js").StarLoopEntryState;
  36213. var ATNConfigSet = __webpack_require__(/*! ./../atn/ATNConfigSet */ "./node_modules/antlr4/atn/ATNConfigSet.js").ATNConfigSet;
  36214. var DFASerializer = __webpack_require__(/*! ./DFASerializer */ "./node_modules/antlr4/dfa/DFASerializer.js").DFASerializer;
  36215. var LexerDFASerializer = __webpack_require__(/*! ./DFASerializer */ "./node_modules/antlr4/dfa/DFASerializer.js").LexerDFASerializer;
  36216. function DFA(atnStartState, decision) {
  36217. if (decision === undefined) {
  36218. decision = 0;
  36219. }
  36220. // From which ATN state did we create this DFA?
  36221. this.atnStartState = atnStartState;
  36222. this.decision = decision;
  36223. // A set of all DFA states. Use {@link Map} so we can get old state back
  36224. // ({@link Set} only allows you to see if it's there).
  36225. this._states = new Set();
  36226. this.s0 = null;
  36227. // {@code true} if this DFA is for a precedence decision; otherwise,
  36228. // {@code false}. This is the backing field for {@link //isPrecedenceDfa},
  36229. // {@link //setPrecedenceDfa}.
  36230. this.precedenceDfa = false;
  36231. if (atnStartState instanceof StarLoopEntryState)
  36232. {
  36233. if (atnStartState.isPrecedenceDecision) {
  36234. this.precedenceDfa = true;
  36235. var precedenceState = new DFAState(null, new ATNConfigSet());
  36236. precedenceState.edges = [];
  36237. precedenceState.isAcceptState = false;
  36238. precedenceState.requiresFullContext = false;
  36239. this.s0 = precedenceState;
  36240. }
  36241. }
  36242. return this;
  36243. }
  36244. // Get the start state for a specific precedence value.
  36245. //
  36246. // @param precedence The current precedence.
  36247. // @return The start state corresponding to the specified precedence, or
  36248. // {@code null} if no start state exists for the specified precedence.
  36249. //
  36250. // @throws IllegalStateException if this is not a precedence DFA.
  36251. // @see //isPrecedenceDfa()
  36252. DFA.prototype.getPrecedenceStartState = function(precedence) {
  36253. if (!(this.precedenceDfa)) {
  36254. throw ("Only precedence DFAs may contain a precedence start state.");
  36255. }
  36256. // s0.edges is never null for a precedence DFA
  36257. if (precedence < 0 || precedence >= this.s0.edges.length) {
  36258. return null;
  36259. }
  36260. return this.s0.edges[precedence] || null;
  36261. };
  36262. // Set the start state for a specific precedence value.
  36263. //
  36264. // @param precedence The current precedence.
  36265. // @param startState The start state corresponding to the specified
  36266. // precedence.
  36267. //
  36268. // @throws IllegalStateException if this is not a precedence DFA.
  36269. // @see //isPrecedenceDfa()
  36270. //
  36271. DFA.prototype.setPrecedenceStartState = function(precedence, startState) {
  36272. if (!(this.precedenceDfa)) {
  36273. throw ("Only precedence DFAs may contain a precedence start state.");
  36274. }
  36275. if (precedence < 0) {
  36276. return;
  36277. }
  36278. // synchronization on s0 here is ok. when the DFA is turned into a
  36279. // precedence DFA, s0 will be initialized once and not updated again
  36280. // s0.edges is never null for a precedence DFA
  36281. this.s0.edges[precedence] = startState;
  36282. };
  36283. //
  36284. // Sets whether this is a precedence DFA. If the specified value differs
  36285. // from the current DFA configuration, the following actions are taken;
  36286. // otherwise no changes are made to the current DFA.
  36287. //
  36288. // <ul>
  36289. // <li>The {@link //states} map is cleared</li>
  36290. // <li>If {@code precedenceDfa} is {@code false}, the initial state
  36291. // {@link //s0} is set to {@code null}; otherwise, it is initialized to a new
  36292. // {@link DFAState} with an empty outgoing {@link DFAState//edges} array to
  36293. // store the start states for individual precedence values.</li>
  36294. // <li>The {@link //precedenceDfa} field is updated</li>
  36295. // </ul>
  36296. //
  36297. // @param precedenceDfa {@code true} if this is a precedence DFA; otherwise,
  36298. // {@code false}
  36299. DFA.prototype.setPrecedenceDfa = function(precedenceDfa) {
  36300. if (this.precedenceDfa!==precedenceDfa) {
  36301. this._states = new DFAStatesSet();
  36302. if (precedenceDfa) {
  36303. var precedenceState = new DFAState(null, new ATNConfigSet());
  36304. precedenceState.edges = [];
  36305. precedenceState.isAcceptState = false;
  36306. precedenceState.requiresFullContext = false;
  36307. this.s0 = precedenceState;
  36308. } else {
  36309. this.s0 = null;
  36310. }
  36311. this.precedenceDfa = precedenceDfa;
  36312. }
  36313. };
  36314. Object.defineProperty(DFA.prototype, "states", {
  36315. get : function() {
  36316. return this._states;
  36317. }
  36318. });
  36319. // Return a list of all states in this DFA, ordered by state number.
  36320. DFA.prototype.sortedStates = function() {
  36321. var list = this._states.values();
  36322. return list.sort(function(a, b) {
  36323. return a.stateNumber - b.stateNumber;
  36324. });
  36325. };
  36326. DFA.prototype.toString = function(literalNames, symbolicNames) {
  36327. literalNames = literalNames || null;
  36328. symbolicNames = symbolicNames || null;
  36329. if (this.s0 === null) {
  36330. return "";
  36331. }
  36332. var serializer = new DFASerializer(this, literalNames, symbolicNames);
  36333. return serializer.toString();
  36334. };
  36335. DFA.prototype.toLexerString = function() {
  36336. if (this.s0 === null) {
  36337. return "";
  36338. }
  36339. var serializer = new LexerDFASerializer(this);
  36340. return serializer.toString();
  36341. };
  36342. exports.DFA = DFA;
  36343. /***/ }),
  36344. /***/ "./node_modules/antlr4/dfa/DFASerializer.js":
  36345. /*!**************************************************!*\
  36346. !*** ./node_modules/antlr4/dfa/DFASerializer.js ***!
  36347. \**************************************************/
  36348. /*! no static exports found */
  36349. /***/ (function(module, exports) {
  36350. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  36351. * Use of this file is governed by the BSD 3-clause license that
  36352. * can be found in the LICENSE.txt file in the project root.
  36353. */
  36354. // A DFA walker that knows how to dump them to serialized strings.#/
  36355. function DFASerializer(dfa, literalNames, symbolicNames) {
  36356. this.dfa = dfa;
  36357. this.literalNames = literalNames || [];
  36358. this.symbolicNames = symbolicNames || [];
  36359. return this;
  36360. }
  36361. DFASerializer.prototype.toString = function() {
  36362. if(this.dfa.s0 === null) {
  36363. return null;
  36364. }
  36365. var buf = "";
  36366. var states = this.dfa.sortedStates();
  36367. for(var i=0;i<states.length;i++) {
  36368. var s = states[i];
  36369. if(s.edges!==null) {
  36370. var n = s.edges.length;
  36371. for(var j=0;j<n;j++) {
  36372. var t = s.edges[j] || null;
  36373. if(t!==null && t.stateNumber !== 0x7FFFFFFF) {
  36374. buf = buf.concat(this.getStateString(s));
  36375. buf = buf.concat("-");
  36376. buf = buf.concat(this.getEdgeLabel(j));
  36377. buf = buf.concat("->");
  36378. buf = buf.concat(this.getStateString(t));
  36379. buf = buf.concat('\n');
  36380. }
  36381. }
  36382. }
  36383. }
  36384. return buf.length===0 ? null : buf;
  36385. };
  36386. DFASerializer.prototype.getEdgeLabel = function(i) {
  36387. if (i===0) {
  36388. return "EOF";
  36389. } else if(this.literalNames !==null || this.symbolicNames!==null) {
  36390. return this.literalNames[i-1] || this.symbolicNames[i-1];
  36391. } else {
  36392. return String.fromCharCode(i-1);
  36393. }
  36394. };
  36395. DFASerializer.prototype.getStateString = function(s) {
  36396. var baseStateStr = ( s.isAcceptState ? ":" : "") + "s" + s.stateNumber + ( s.requiresFullContext ? "^" : "");
  36397. if(s.isAcceptState) {
  36398. if (s.predicates !== null) {
  36399. return baseStateStr + "=>" + s.predicates.toString();
  36400. } else {
  36401. return baseStateStr + "=>" + s.prediction.toString();
  36402. }
  36403. } else {
  36404. return baseStateStr;
  36405. }
  36406. };
  36407. function LexerDFASerializer(dfa) {
  36408. DFASerializer.call(this, dfa, null);
  36409. return this;
  36410. }
  36411. LexerDFASerializer.prototype = Object.create(DFASerializer.prototype);
  36412. LexerDFASerializer.prototype.constructor = LexerDFASerializer;
  36413. LexerDFASerializer.prototype.getEdgeLabel = function(i) {
  36414. return "'" + String.fromCharCode(i) + "'";
  36415. };
  36416. exports.DFASerializer = DFASerializer;
  36417. exports.LexerDFASerializer = LexerDFASerializer;
  36418. /***/ }),
  36419. /***/ "./node_modules/antlr4/dfa/DFAState.js":
  36420. /*!*********************************************!*\
  36421. !*** ./node_modules/antlr4/dfa/DFAState.js ***!
  36422. \*********************************************/
  36423. /*! no static exports found */
  36424. /***/ (function(module, exports, __webpack_require__) {
  36425. //
  36426. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  36427. * Use of this file is governed by the BSD 3-clause license that
  36428. * can be found in the LICENSE.txt file in the project root.
  36429. */
  36430. ///
  36431. var ATNConfigSet = __webpack_require__(/*! ./../atn/ATNConfigSet */ "./node_modules/antlr4/atn/ATNConfigSet.js").ATNConfigSet;
  36432. var Utils = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js");
  36433. var Hash = Utils.Hash;
  36434. var Set = Utils.Set;
  36435. // Map a predicate to a predicted alternative.///
  36436. function PredPrediction(pred, alt) {
  36437. this.alt = alt;
  36438. this.pred = pred;
  36439. return this;
  36440. }
  36441. PredPrediction.prototype.toString = function() {
  36442. return "(" + this.pred + ", " + this.alt + ")";
  36443. };
  36444. // A DFA state represents a set of possible ATN configurations.
  36445. // As Aho, Sethi, Ullman p. 117 says "The DFA uses its state
  36446. // to keep track of all possible states the ATN can be in after
  36447. // reading each input symbol. That is to say, after reading
  36448. // input a1a2..an, the DFA is in a state that represents the
  36449. // subset T of the states of the ATN that are reachable from the
  36450. // ATN's start state along some path labeled a1a2..an."
  36451. // In conventional NFA&rarr;DFA conversion, therefore, the subset T
  36452. // would be a bitset representing the set of states the
  36453. // ATN could be in. We need to track the alt predicted by each
  36454. // state as well, however. More importantly, we need to maintain
  36455. // a stack of states, tracking the closure operations as they
  36456. // jump from rule to rule, emulating rule invocations (method calls).
  36457. // I have to add a stack to simulate the proper lookahead sequences for
  36458. // the underlying LL grammar from which the ATN was derived.
  36459. //
  36460. // <p>I use a set of ATNConfig objects not simple states. An ATNConfig
  36461. // is both a state (ala normal conversion) and a RuleContext describing
  36462. // the chain of rules (if any) followed to arrive at that state.</p>
  36463. //
  36464. // <p>A DFA state may have multiple references to a particular state,
  36465. // but with different ATN contexts (with same or different alts)
  36466. // meaning that state was reached via a different set of rule invocations.</p>
  36467. // /
  36468. function DFAState(stateNumber, configs) {
  36469. if (stateNumber === null) {
  36470. stateNumber = -1;
  36471. }
  36472. if (configs === null) {
  36473. configs = new ATNConfigSet();
  36474. }
  36475. this.stateNumber = stateNumber;
  36476. this.configs = configs;
  36477. // {@code edges[symbol]} points to target of symbol. Shift up by 1 so (-1)
  36478. // {@link Token//EOF} maps to {@code edges[0]}.
  36479. this.edges = null;
  36480. this.isAcceptState = false;
  36481. // if accept state, what ttype do we match or alt do we predict?
  36482. // This is set to {@link ATN//INVALID_ALT_NUMBER} when {@link
  36483. // //predicates}{@code !=null} or
  36484. // {@link //requiresFullContext}.
  36485. this.prediction = 0;
  36486. this.lexerActionExecutor = null;
  36487. // Indicates that this state was created during SLL prediction that
  36488. // discovered a conflict between the configurations in the state. Future
  36489. // {@link ParserATNSimulator//execATN} invocations immediately jumped doing
  36490. // full context prediction if this field is true.
  36491. this.requiresFullContext = false;
  36492. // During SLL parsing, this is a list of predicates associated with the
  36493. // ATN configurations of the DFA state. When we have predicates,
  36494. // {@link //requiresFullContext} is {@code false} since full context
  36495. // prediction evaluates predicates
  36496. // on-the-fly. If this is not null, then {@link //prediction} is
  36497. // {@link ATN//INVALID_ALT_NUMBER}.
  36498. //
  36499. // <p>We only use these for non-{@link //requiresFullContext} but
  36500. // conflicting states. That
  36501. // means we know from the context (it's $ or we don't dip into outer
  36502. // context) that it's an ambiguity not a conflict.</p>
  36503. //
  36504. // <p>This list is computed by {@link
  36505. // ParserATNSimulator//predicateDFAState}.</p>
  36506. this.predicates = null;
  36507. return this;
  36508. }
  36509. // Get the set of all alts mentioned by all ATN configurations in this
  36510. // DFA state.
  36511. DFAState.prototype.getAltSet = function() {
  36512. var alts = new Set();
  36513. if (this.configs !== null) {
  36514. for (var i = 0; i < this.configs.length; i++) {
  36515. var c = this.configs[i];
  36516. alts.add(c.alt);
  36517. }
  36518. }
  36519. if (alts.length === 0) {
  36520. return null;
  36521. } else {
  36522. return alts;
  36523. }
  36524. };
  36525. // Two {@link DFAState} instances are equal if their ATN configuration sets
  36526. // are the same. This method is used to see if a state already exists.
  36527. //
  36528. // <p>Because the number of alternatives and number of ATN configurations are
  36529. // finite, there is a finite number of DFA states that can be processed.
  36530. // This is necessary to show that the algorithm terminates.</p>
  36531. //
  36532. // <p>Cannot test the DFA state numbers here because in
  36533. // {@link ParserATNSimulator//addDFAState} we need to know if any other state
  36534. // exists that has this exact set of ATN configurations. The
  36535. // {@link //stateNumber} is irrelevant.</p>
  36536. DFAState.prototype.equals = function(other) {
  36537. // compare set of ATN configurations in this set with other
  36538. return this === other ||
  36539. (other instanceof DFAState &&
  36540. this.configs.equals(other.configs));
  36541. };
  36542. DFAState.prototype.toString = function() {
  36543. var s = "" + this.stateNumber + ":" + this.configs;
  36544. if(this.isAcceptState) {
  36545. s = s + "=>";
  36546. if (this.predicates !== null)
  36547. s = s + this.predicates;
  36548. else
  36549. s = s + this.prediction;
  36550. }
  36551. return s;
  36552. };
  36553. DFAState.prototype.hashCode = function() {
  36554. var hash = new Hash();
  36555. hash.update(this.configs);
  36556. if(this.isAcceptState) {
  36557. if (this.predicates !== null)
  36558. hash.update(this.predicates);
  36559. else
  36560. hash.update(this.prediction);
  36561. }
  36562. return hash.finish();
  36563. };
  36564. exports.DFAState = DFAState;
  36565. exports.PredPrediction = PredPrediction;
  36566. /***/ }),
  36567. /***/ "./node_modules/antlr4/dfa/index.js":
  36568. /*!******************************************!*\
  36569. !*** ./node_modules/antlr4/dfa/index.js ***!
  36570. \******************************************/
  36571. /*! no static exports found */
  36572. /***/ (function(module, exports, __webpack_require__) {
  36573. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  36574. * Use of this file is governed by the BSD 3-clause license that
  36575. * can be found in the LICENSE.txt file in the project root.
  36576. */
  36577. exports.DFA = __webpack_require__(/*! ./DFA */ "./node_modules/antlr4/dfa/DFA.js").DFA;
  36578. exports.DFASerializer = __webpack_require__(/*! ./DFASerializer */ "./node_modules/antlr4/dfa/DFASerializer.js").DFASerializer;
  36579. exports.LexerDFASerializer = __webpack_require__(/*! ./DFASerializer */ "./node_modules/antlr4/dfa/DFASerializer.js").LexerDFASerializer;
  36580. exports.PredPrediction = __webpack_require__(/*! ./DFAState */ "./node_modules/antlr4/dfa/DFAState.js").PredPrediction;
  36581. /***/ }),
  36582. /***/ "./node_modules/antlr4/error/DiagnosticErrorListener.js":
  36583. /*!**************************************************************!*\
  36584. !*** ./node_modules/antlr4/error/DiagnosticErrorListener.js ***!
  36585. \**************************************************************/
  36586. /*! no static exports found */
  36587. /***/ (function(module, exports, __webpack_require__) {
  36588. //
  36589. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  36590. * Use of this file is governed by the BSD 3-clause license that
  36591. * can be found in the LICENSE.txt file in the project root.
  36592. */
  36593. //
  36594. //
  36595. // This implementation of {@link ANTLRErrorListener} can be used to identify
  36596. // certain potential correctness and performance problems in grammars. "Reports"
  36597. // are made by calling {@link Parser//notifyErrorListeners} with the appropriate
  36598. // message.
  36599. //
  36600. // <ul>
  36601. // <li><b>Ambiguities</b>: These are cases where more than one path through the
  36602. // grammar can match the input.</li>
  36603. // <li><b>Weak context sensitivity</b>: These are cases where full-context
  36604. // prediction resolved an SLL conflict to a unique alternative which equaled the
  36605. // minimum alternative of the SLL conflict.</li>
  36606. // <li><b>Strong (forced) context sensitivity</b>: These are cases where the
  36607. // full-context prediction resolved an SLL conflict to a unique alternative,
  36608. // <em>and</em> the minimum alternative of the SLL conflict was found to not be
  36609. // a truly viable alternative. Two-stage parsing cannot be used for inputs where
  36610. // this situation occurs.</li>
  36611. // </ul>
  36612. var BitSet = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js").BitSet;
  36613. var ErrorListener = __webpack_require__(/*! ./ErrorListener */ "./node_modules/antlr4/error/ErrorListener.js").ErrorListener;
  36614. var Interval = __webpack_require__(/*! ./../IntervalSet */ "./node_modules/antlr4/IntervalSet.js").Interval;
  36615. function DiagnosticErrorListener(exactOnly) {
  36616. ErrorListener.call(this);
  36617. exactOnly = exactOnly || true;
  36618. // whether all ambiguities or only exact ambiguities are reported.
  36619. this.exactOnly = exactOnly;
  36620. return this;
  36621. }
  36622. DiagnosticErrorListener.prototype = Object.create(ErrorListener.prototype);
  36623. DiagnosticErrorListener.prototype.constructor = DiagnosticErrorListener;
  36624. DiagnosticErrorListener.prototype.reportAmbiguity = function(recognizer, dfa,
  36625. startIndex, stopIndex, exact, ambigAlts, configs) {
  36626. if (this.exactOnly && !exact) {
  36627. return;
  36628. }
  36629. var msg = "reportAmbiguity d=" +
  36630. this.getDecisionDescription(recognizer, dfa) +
  36631. ": ambigAlts=" +
  36632. this.getConflictingAlts(ambigAlts, configs) +
  36633. ", input='" +
  36634. recognizer.getTokenStream().getText(new Interval(startIndex, stopIndex)) + "'";
  36635. recognizer.notifyErrorListeners(msg);
  36636. };
  36637. DiagnosticErrorListener.prototype.reportAttemptingFullContext = function(
  36638. recognizer, dfa, startIndex, stopIndex, conflictingAlts, configs) {
  36639. var msg = "reportAttemptingFullContext d=" +
  36640. this.getDecisionDescription(recognizer, dfa) +
  36641. ", input='" +
  36642. recognizer.getTokenStream().getText(new Interval(startIndex, stopIndex)) + "'";
  36643. recognizer.notifyErrorListeners(msg);
  36644. };
  36645. DiagnosticErrorListener.prototype.reportContextSensitivity = function(
  36646. recognizer, dfa, startIndex, stopIndex, prediction, configs) {
  36647. var msg = "reportContextSensitivity d=" +
  36648. this.getDecisionDescription(recognizer, dfa) +
  36649. ", input='" +
  36650. recognizer.getTokenStream().getText(new Interval(startIndex, stopIndex)) + "'";
  36651. recognizer.notifyErrorListeners(msg);
  36652. };
  36653. DiagnosticErrorListener.prototype.getDecisionDescription = function(recognizer, dfa) {
  36654. var decision = dfa.decision;
  36655. var ruleIndex = dfa.atnStartState.ruleIndex;
  36656. var ruleNames = recognizer.ruleNames;
  36657. if (ruleIndex < 0 || ruleIndex >= ruleNames.length) {
  36658. return "" + decision;
  36659. }
  36660. var ruleName = ruleNames[ruleIndex] || null;
  36661. if (ruleName === null || ruleName.length === 0) {
  36662. return "" + decision;
  36663. }
  36664. return "" + decision + " (" + ruleName + ")";
  36665. };
  36666. //
  36667. // Computes the set of conflicting or ambiguous alternatives from a
  36668. // configuration set, if that information was not already provided by the
  36669. // parser.
  36670. //
  36671. // @param reportedAlts The set of conflicting or ambiguous alternatives, as
  36672. // reported by the parser.
  36673. // @param configs The conflicting or ambiguous configuration set.
  36674. // @return Returns {@code reportedAlts} if it is not {@code null}, otherwise
  36675. // returns the set of alternatives represented in {@code configs}.
  36676. //
  36677. DiagnosticErrorListener.prototype.getConflictingAlts = function(reportedAlts, configs) {
  36678. if (reportedAlts !== null) {
  36679. return reportedAlts;
  36680. }
  36681. var result = new BitSet();
  36682. for (var i = 0; i < configs.items.length; i++) {
  36683. result.add(configs.items[i].alt);
  36684. }
  36685. return "{" + result.values().join(", ") + "}";
  36686. };
  36687. exports.DiagnosticErrorListener = DiagnosticErrorListener;
  36688. /***/ }),
  36689. /***/ "./node_modules/antlr4/error/ErrorListener.js":
  36690. /*!****************************************************!*\
  36691. !*** ./node_modules/antlr4/error/ErrorListener.js ***!
  36692. \****************************************************/
  36693. /*! no static exports found */
  36694. /***/ (function(module, exports) {
  36695. //
  36696. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  36697. * Use of this file is governed by the BSD 3-clause license that
  36698. * can be found in the LICENSE.txt file in the project root.
  36699. */
  36700. // Provides an empty default implementation of {@link ANTLRErrorListener}. The
  36701. // default implementation of each method does nothing, but can be overridden as
  36702. // necessary.
  36703. function ErrorListener() {
  36704. return this;
  36705. }
  36706. ErrorListener.prototype.syntaxError = function(recognizer, offendingSymbol, line, column, msg, e) {
  36707. };
  36708. ErrorListener.prototype.reportAmbiguity = function(recognizer, dfa, startIndex, stopIndex, exact, ambigAlts, configs) {
  36709. };
  36710. ErrorListener.prototype.reportAttemptingFullContext = function(recognizer, dfa, startIndex, stopIndex, conflictingAlts, configs) {
  36711. };
  36712. ErrorListener.prototype.reportContextSensitivity = function(recognizer, dfa, startIndex, stopIndex, prediction, configs) {
  36713. };
  36714. function ConsoleErrorListener() {
  36715. ErrorListener.call(this);
  36716. return this;
  36717. }
  36718. ConsoleErrorListener.prototype = Object.create(ErrorListener.prototype);
  36719. ConsoleErrorListener.prototype.constructor = ConsoleErrorListener;
  36720. //
  36721. // Provides a default instance of {@link ConsoleErrorListener}.
  36722. //
  36723. ConsoleErrorListener.INSTANCE = new ConsoleErrorListener();
  36724. //
  36725. // {@inheritDoc}
  36726. //
  36727. // <p>
  36728. // This implementation prints messages to {@link System//err} containing the
  36729. // values of {@code line}, {@code charPositionInLine}, and {@code msg} using
  36730. // the following format.</p>
  36731. //
  36732. // <pre>
  36733. // line <em>line</em>:<em>charPositionInLine</em> <em>msg</em>
  36734. // </pre>
  36735. //
  36736. ConsoleErrorListener.prototype.syntaxError = function(recognizer, offendingSymbol, line, column, msg, e) {
  36737. console.error("line " + line + ":" + column + " " + msg);
  36738. };
  36739. function ProxyErrorListener(delegates) {
  36740. ErrorListener.call(this);
  36741. if (delegates===null) {
  36742. throw "delegates";
  36743. }
  36744. this.delegates = delegates;
  36745. return this;
  36746. }
  36747. ProxyErrorListener.prototype = Object.create(ErrorListener.prototype);
  36748. ProxyErrorListener.prototype.constructor = ProxyErrorListener;
  36749. ProxyErrorListener.prototype.syntaxError = function(recognizer, offendingSymbol, line, column, msg, e) {
  36750. this.delegates.map(function(d) { d.syntaxError(recognizer, offendingSymbol, line, column, msg, e); });
  36751. };
  36752. ProxyErrorListener.prototype.reportAmbiguity = function(recognizer, dfa, startIndex, stopIndex, exact, ambigAlts, configs) {
  36753. this.delegates.map(function(d) { d.reportAmbiguity(recognizer, dfa, startIndex, stopIndex, exact, ambigAlts, configs); });
  36754. };
  36755. ProxyErrorListener.prototype.reportAttemptingFullContext = function(recognizer, dfa, startIndex, stopIndex, conflictingAlts, configs) {
  36756. this.delegates.map(function(d) { d.reportAttemptingFullContext(recognizer, dfa, startIndex, stopIndex, conflictingAlts, configs); });
  36757. };
  36758. ProxyErrorListener.prototype.reportContextSensitivity = function(recognizer, dfa, startIndex, stopIndex, prediction, configs) {
  36759. this.delegates.map(function(d) { d.reportContextSensitivity(recognizer, dfa, startIndex, stopIndex, prediction, configs); });
  36760. };
  36761. exports.ErrorListener = ErrorListener;
  36762. exports.ConsoleErrorListener = ConsoleErrorListener;
  36763. exports.ProxyErrorListener = ProxyErrorListener;
  36764. /***/ }),
  36765. /***/ "./node_modules/antlr4/error/ErrorStrategy.js":
  36766. /*!****************************************************!*\
  36767. !*** ./node_modules/antlr4/error/ErrorStrategy.js ***!
  36768. \****************************************************/
  36769. /*! no static exports found */
  36770. /***/ (function(module, exports, __webpack_require__) {
  36771. //
  36772. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  36773. * Use of this file is governed by the BSD 3-clause license that
  36774. * can be found in the LICENSE.txt file in the project root.
  36775. */
  36776. //
  36777. var Token = __webpack_require__(/*! ./../Token */ "./node_modules/antlr4/Token.js").Token;
  36778. var Errors = __webpack_require__(/*! ./Errors */ "./node_modules/antlr4/error/Errors.js");
  36779. var NoViableAltException = Errors.NoViableAltException;
  36780. var InputMismatchException = Errors.InputMismatchException;
  36781. var FailedPredicateException = Errors.FailedPredicateException;
  36782. var ParseCancellationException = Errors.ParseCancellationException;
  36783. var ATNState = __webpack_require__(/*! ./../atn/ATNState */ "./node_modules/antlr4/atn/ATNState.js").ATNState;
  36784. var Interval = __webpack_require__(/*! ./../IntervalSet */ "./node_modules/antlr4/IntervalSet.js").Interval;
  36785. var IntervalSet = __webpack_require__(/*! ./../IntervalSet */ "./node_modules/antlr4/IntervalSet.js").IntervalSet;
  36786. function ErrorStrategy() {
  36787. }
  36788. ErrorStrategy.prototype.reset = function(recognizer){
  36789. };
  36790. ErrorStrategy.prototype.recoverInline = function(recognizer){
  36791. };
  36792. ErrorStrategy.prototype.recover = function(recognizer, e){
  36793. };
  36794. ErrorStrategy.prototype.sync = function(recognizer){
  36795. };
  36796. ErrorStrategy.prototype.inErrorRecoveryMode = function(recognizer){
  36797. };
  36798. ErrorStrategy.prototype.reportError = function(recognizer){
  36799. };
  36800. // This is the default implementation of {@link ANTLRErrorStrategy} used for
  36801. // error reporting and recovery in ANTLR parsers.
  36802. //
  36803. function DefaultErrorStrategy() {
  36804. ErrorStrategy.call(this);
  36805. // Indicates whether the error strategy is currently "recovering from an
  36806. // error". This is used to suppress reporting multiple error messages while
  36807. // attempting to recover from a detected syntax error.
  36808. //
  36809. // @see //inErrorRecoveryMode
  36810. //
  36811. this.errorRecoveryMode = false;
  36812. // The index into the input stream where the last error occurred.
  36813. // This is used to prevent infinite loops where an error is found
  36814. // but no token is consumed during recovery...another error is found,
  36815. // ad nauseum. This is a failsafe mechanism to guarantee that at least
  36816. // one token/tree node is consumed for two errors.
  36817. //
  36818. this.lastErrorIndex = -1;
  36819. this.lastErrorStates = null;
  36820. return this;
  36821. }
  36822. DefaultErrorStrategy.prototype = Object.create(ErrorStrategy.prototype);
  36823. DefaultErrorStrategy.prototype.constructor = DefaultErrorStrategy;
  36824. // <p>The default implementation simply calls {@link //endErrorCondition} to
  36825. // ensure that the handler is not in error recovery mode.</p>
  36826. DefaultErrorStrategy.prototype.reset = function(recognizer) {
  36827. this.endErrorCondition(recognizer);
  36828. };
  36829. //
  36830. // This method is called to enter error recovery mode when a recognition
  36831. // exception is reported.
  36832. //
  36833. // @param recognizer the parser instance
  36834. //
  36835. DefaultErrorStrategy.prototype.beginErrorCondition = function(recognizer) {
  36836. this.errorRecoveryMode = true;
  36837. };
  36838. DefaultErrorStrategy.prototype.inErrorRecoveryMode = function(recognizer) {
  36839. return this.errorRecoveryMode;
  36840. };
  36841. //
  36842. // This method is called to leave error recovery mode after recovering from
  36843. // a recognition exception.
  36844. //
  36845. // @param recognizer
  36846. //
  36847. DefaultErrorStrategy.prototype.endErrorCondition = function(recognizer) {
  36848. this.errorRecoveryMode = false;
  36849. this.lastErrorStates = null;
  36850. this.lastErrorIndex = -1;
  36851. };
  36852. //
  36853. // {@inheritDoc}
  36854. //
  36855. // <p>The default implementation simply calls {@link //endErrorCondition}.</p>
  36856. //
  36857. DefaultErrorStrategy.prototype.reportMatch = function(recognizer) {
  36858. this.endErrorCondition(recognizer);
  36859. };
  36860. //
  36861. // {@inheritDoc}
  36862. //
  36863. // <p>The default implementation returns immediately if the handler is already
  36864. // in error recovery mode. Otherwise, it calls {@link //beginErrorCondition}
  36865. // and dispatches the reporting task based on the runtime type of {@code e}
  36866. // according to the following table.</p>
  36867. //
  36868. // <ul>
  36869. // <li>{@link NoViableAltException}: Dispatches the call to
  36870. // {@link //reportNoViableAlternative}</li>
  36871. // <li>{@link InputMismatchException}: Dispatches the call to
  36872. // {@link //reportInputMismatch}</li>
  36873. // <li>{@link FailedPredicateException}: Dispatches the call to
  36874. // {@link //reportFailedPredicate}</li>
  36875. // <li>All other types: calls {@link Parser//notifyErrorListeners} to report
  36876. // the exception</li>
  36877. // </ul>
  36878. //
  36879. DefaultErrorStrategy.prototype.reportError = function(recognizer, e) {
  36880. // if we've already reported an error and have not matched a token
  36881. // yet successfully, don't report any errors.
  36882. if(this.inErrorRecoveryMode(recognizer)) {
  36883. return; // don't report spurious errors
  36884. }
  36885. this.beginErrorCondition(recognizer);
  36886. if ( e instanceof NoViableAltException ) {
  36887. this.reportNoViableAlternative(recognizer, e);
  36888. } else if ( e instanceof InputMismatchException ) {
  36889. this.reportInputMismatch(recognizer, e);
  36890. } else if ( e instanceof FailedPredicateException ) {
  36891. this.reportFailedPredicate(recognizer, e);
  36892. } else {
  36893. console.log("unknown recognition error type: " + e.constructor.name);
  36894. console.log(e.stack);
  36895. recognizer.notifyErrorListeners(e.getOffendingToken(), e.getMessage(), e);
  36896. }
  36897. };
  36898. //
  36899. // {@inheritDoc}
  36900. //
  36901. // <p>The default implementation resynchronizes the parser by consuming tokens
  36902. // until we find one in the resynchronization set--loosely the set of tokens
  36903. // that can follow the current rule.</p>
  36904. //
  36905. DefaultErrorStrategy.prototype.recover = function(recognizer, e) {
  36906. if (this.lastErrorIndex===recognizer.getInputStream().index &&
  36907. this.lastErrorStates !== null && this.lastErrorStates.indexOf(recognizer.state)>=0) {
  36908. // uh oh, another error at same token index and previously-visited
  36909. // state in ATN; must be a case where LT(1) is in the recovery
  36910. // token set so nothing got consumed. Consume a single token
  36911. // at least to prevent an infinite loop; this is a failsafe.
  36912. recognizer.consume();
  36913. }
  36914. this.lastErrorIndex = recognizer._input.index;
  36915. if (this.lastErrorStates === null) {
  36916. this.lastErrorStates = [];
  36917. }
  36918. this.lastErrorStates.push(recognizer.state);
  36919. var followSet = this.getErrorRecoverySet(recognizer);
  36920. this.consumeUntil(recognizer, followSet);
  36921. };
  36922. // The default implementation of {@link ANTLRErrorStrategy//sync} makes sure
  36923. // that the current lookahead symbol is consistent with what were expecting
  36924. // at this point in the ATN. You can call this anytime but ANTLR only
  36925. // generates code to check before subrules/loops and each iteration.
  36926. //
  36927. // <p>Implements Jim Idle's magic sync mechanism in closures and optional
  36928. // subrules. E.g.,</p>
  36929. //
  36930. // <pre>
  36931. // a : sync ( stuff sync )* ;
  36932. // sync : {consume to what can follow sync} ;
  36933. // </pre>
  36934. //
  36935. // At the start of a sub rule upon error, {@link //sync} performs single
  36936. // token deletion, if possible. If it can't do that, it bails on the current
  36937. // rule and uses the default error recovery, which consumes until the
  36938. // resynchronization set of the current rule.
  36939. //
  36940. // <p>If the sub rule is optional ({@code (...)?}, {@code (...)*}, or block
  36941. // with an empty alternative), then the expected set includes what follows
  36942. // the subrule.</p>
  36943. //
  36944. // <p>During loop iteration, it consumes until it sees a token that can start a
  36945. // sub rule or what follows loop. Yes, that is pretty aggressive. We opt to
  36946. // stay in the loop as long as possible.</p>
  36947. //
  36948. // <p><strong>ORIGINS</strong></p>
  36949. //
  36950. // <p>Previous versions of ANTLR did a poor job of their recovery within loops.
  36951. // A single mismatch token or missing token would force the parser to bail
  36952. // out of the entire rules surrounding the loop. So, for rule</p>
  36953. //
  36954. // <pre>
  36955. // classDef : 'class' ID '{' member* '}'
  36956. // </pre>
  36957. //
  36958. // input with an extra token between members would force the parser to
  36959. // consume until it found the next class definition rather than the next
  36960. // member definition of the current class.
  36961. //
  36962. // <p>This functionality cost a little bit of effort because the parser has to
  36963. // compare token set at the start of the loop and at each iteration. If for
  36964. // some reason speed is suffering for you, you can turn off this
  36965. // functionality by simply overriding this method as a blank { }.</p>
  36966. //
  36967. DefaultErrorStrategy.prototype.sync = function(recognizer) {
  36968. // If already recovering, don't try to sync
  36969. if (this.inErrorRecoveryMode(recognizer)) {
  36970. return;
  36971. }
  36972. var s = recognizer._interp.atn.states[recognizer.state];
  36973. var la = recognizer.getTokenStream().LA(1);
  36974. // try cheaper subset first; might get lucky. seems to shave a wee bit off
  36975. var nextTokens = recognizer.atn.nextTokens(s);
  36976. if (nextTokens.contains(Token.EPSILON) || nextTokens.contains(la)) {
  36977. return;
  36978. }
  36979. switch (s.stateType) {
  36980. case ATNState.BLOCK_START:
  36981. case ATNState.STAR_BLOCK_START:
  36982. case ATNState.PLUS_BLOCK_START:
  36983. case ATNState.STAR_LOOP_ENTRY:
  36984. // report error and recover if possible
  36985. if( this.singleTokenDeletion(recognizer) !== null) {
  36986. return;
  36987. } else {
  36988. throw new InputMismatchException(recognizer);
  36989. }
  36990. break;
  36991. case ATNState.PLUS_LOOP_BACK:
  36992. case ATNState.STAR_LOOP_BACK:
  36993. this.reportUnwantedToken(recognizer);
  36994. var expecting = new IntervalSet();
  36995. expecting.addSet(recognizer.getExpectedTokens());
  36996. var whatFollowsLoopIterationOrRule = expecting.addSet(this.getErrorRecoverySet(recognizer));
  36997. this.consumeUntil(recognizer, whatFollowsLoopIterationOrRule);
  36998. break;
  36999. default:
  37000. // do nothing if we can't identify the exact kind of ATN state
  37001. }
  37002. };
  37003. // This is called by {@link //reportError} when the exception is a
  37004. // {@link NoViableAltException}.
  37005. //
  37006. // @see //reportError
  37007. //
  37008. // @param recognizer the parser instance
  37009. // @param e the recognition exception
  37010. //
  37011. DefaultErrorStrategy.prototype.reportNoViableAlternative = function(recognizer, e) {
  37012. var tokens = recognizer.getTokenStream();
  37013. var input;
  37014. if(tokens !== null) {
  37015. if (e.startToken.type===Token.EOF) {
  37016. input = "<EOF>";
  37017. } else {
  37018. input = tokens.getText(new Interval(e.startToken.tokenIndex, e.offendingToken.tokenIndex));
  37019. }
  37020. } else {
  37021. input = "<unknown input>";
  37022. }
  37023. var msg = "no viable alternative at input " + this.escapeWSAndQuote(input);
  37024. recognizer.notifyErrorListeners(msg, e.offendingToken, e);
  37025. };
  37026. //
  37027. // This is called by {@link //reportError} when the exception is an
  37028. // {@link InputMismatchException}.
  37029. //
  37030. // @see //reportError
  37031. //
  37032. // @param recognizer the parser instance
  37033. // @param e the recognition exception
  37034. //
  37035. DefaultErrorStrategy.prototype.reportInputMismatch = function(recognizer, e) {
  37036. var msg = "mismatched input " + this.getTokenErrorDisplay(e.offendingToken) +
  37037. " expecting " + e.getExpectedTokens().toString(recognizer.literalNames, recognizer.symbolicNames);
  37038. recognizer.notifyErrorListeners(msg, e.offendingToken, e);
  37039. };
  37040. //
  37041. // This is called by {@link //reportError} when the exception is a
  37042. // {@link FailedPredicateException}.
  37043. //
  37044. // @see //reportError
  37045. //
  37046. // @param recognizer the parser instance
  37047. // @param e the recognition exception
  37048. //
  37049. DefaultErrorStrategy.prototype.reportFailedPredicate = function(recognizer, e) {
  37050. var ruleName = recognizer.ruleNames[recognizer._ctx.ruleIndex];
  37051. var msg = "rule " + ruleName + " " + e.message;
  37052. recognizer.notifyErrorListeners(msg, e.offendingToken, e);
  37053. };
  37054. // This method is called to report a syntax error which requires the removal
  37055. // of a token from the input stream. At the time this method is called, the
  37056. // erroneous symbol is current {@code LT(1)} symbol and has not yet been
  37057. // removed from the input stream. When this method returns,
  37058. // {@code recognizer} is in error recovery mode.
  37059. //
  37060. // <p>This method is called when {@link //singleTokenDeletion} identifies
  37061. // single-token deletion as a viable recovery strategy for a mismatched
  37062. // input error.</p>
  37063. //
  37064. // <p>The default implementation simply returns if the handler is already in
  37065. // error recovery mode. Otherwise, it calls {@link //beginErrorCondition} to
  37066. // enter error recovery mode, followed by calling
  37067. // {@link Parser//notifyErrorListeners}.</p>
  37068. //
  37069. // @param recognizer the parser instance
  37070. //
  37071. DefaultErrorStrategy.prototype.reportUnwantedToken = function(recognizer) {
  37072. if (this.inErrorRecoveryMode(recognizer)) {
  37073. return;
  37074. }
  37075. this.beginErrorCondition(recognizer);
  37076. var t = recognizer.getCurrentToken();
  37077. var tokenName = this.getTokenErrorDisplay(t);
  37078. var expecting = this.getExpectedTokens(recognizer);
  37079. var msg = "extraneous input " + tokenName + " expecting " +
  37080. expecting.toString(recognizer.literalNames, recognizer.symbolicNames);
  37081. recognizer.notifyErrorListeners(msg, t, null);
  37082. };
  37083. // This method is called to report a syntax error which requires the
  37084. // insertion of a missing token into the input stream. At the time this
  37085. // method is called, the missing token has not yet been inserted. When this
  37086. // method returns, {@code recognizer} is in error recovery mode.
  37087. //
  37088. // <p>This method is called when {@link //singleTokenInsertion} identifies
  37089. // single-token insertion as a viable recovery strategy for a mismatched
  37090. // input error.</p>
  37091. //
  37092. // <p>The default implementation simply returns if the handler is already in
  37093. // error recovery mode. Otherwise, it calls {@link //beginErrorCondition} to
  37094. // enter error recovery mode, followed by calling
  37095. // {@link Parser//notifyErrorListeners}.</p>
  37096. //
  37097. // @param recognizer the parser instance
  37098. //
  37099. DefaultErrorStrategy.prototype.reportMissingToken = function(recognizer) {
  37100. if ( this.inErrorRecoveryMode(recognizer)) {
  37101. return;
  37102. }
  37103. this.beginErrorCondition(recognizer);
  37104. var t = recognizer.getCurrentToken();
  37105. var expecting = this.getExpectedTokens(recognizer);
  37106. var msg = "missing " + expecting.toString(recognizer.literalNames, recognizer.symbolicNames) +
  37107. " at " + this.getTokenErrorDisplay(t);
  37108. recognizer.notifyErrorListeners(msg, t, null);
  37109. };
  37110. // <p>The default implementation attempts to recover from the mismatched input
  37111. // by using single token insertion and deletion as described below. If the
  37112. // recovery attempt fails, this method throws an
  37113. // {@link InputMismatchException}.</p>
  37114. //
  37115. // <p><strong>EXTRA TOKEN</strong> (single token deletion)</p>
  37116. //
  37117. // <p>{@code LA(1)} is not what we are looking for. If {@code LA(2)} has the
  37118. // right token, however, then assume {@code LA(1)} is some extra spurious
  37119. // token and delete it. Then consume and return the next token (which was
  37120. // the {@code LA(2)} token) as the successful result of the match operation.</p>
  37121. //
  37122. // <p>This recovery strategy is implemented by {@link
  37123. // //singleTokenDeletion}.</p>
  37124. //
  37125. // <p><strong>MISSING TOKEN</strong> (single token insertion)</p>
  37126. //
  37127. // <p>If current token (at {@code LA(1)}) is consistent with what could come
  37128. // after the expected {@code LA(1)} token, then assume the token is missing
  37129. // and use the parser's {@link TokenFactory} to create it on the fly. The
  37130. // "insertion" is performed by returning the created token as the successful
  37131. // result of the match operation.</p>
  37132. //
  37133. // <p>This recovery strategy is implemented by {@link
  37134. // //singleTokenInsertion}.</p>
  37135. //
  37136. // <p><strong>EXAMPLE</strong></p>
  37137. //
  37138. // <p>For example, Input {@code i=(3;} is clearly missing the {@code ')'}. When
  37139. // the parser returns from the nested call to {@code expr}, it will have
  37140. // call chain:</p>
  37141. //
  37142. // <pre>
  37143. // stat &rarr; expr &rarr; atom
  37144. // </pre>
  37145. //
  37146. // and it will be trying to match the {@code ')'} at this point in the
  37147. // derivation:
  37148. //
  37149. // <pre>
  37150. // =&gt; ID '=' '(' INT ')' ('+' atom)* ';'
  37151. // ^
  37152. // </pre>
  37153. //
  37154. // The attempt to match {@code ')'} will fail when it sees {@code ';'} and
  37155. // call {@link //recoverInline}. To recover, it sees that {@code LA(1)==';'}
  37156. // is in the set of tokens that can follow the {@code ')'} token reference
  37157. // in rule {@code atom}. It can assume that you forgot the {@code ')'}.
  37158. //
  37159. DefaultErrorStrategy.prototype.recoverInline = function(recognizer) {
  37160. // SINGLE TOKEN DELETION
  37161. var matchedSymbol = this.singleTokenDeletion(recognizer);
  37162. if (matchedSymbol !== null) {
  37163. // we have deleted the extra token.
  37164. // now, move past ttype token as if all were ok
  37165. recognizer.consume();
  37166. return matchedSymbol;
  37167. }
  37168. // SINGLE TOKEN INSERTION
  37169. if (this.singleTokenInsertion(recognizer)) {
  37170. return this.getMissingSymbol(recognizer);
  37171. }
  37172. // even that didn't work; must throw the exception
  37173. throw new InputMismatchException(recognizer);
  37174. };
  37175. //
  37176. // This method implements the single-token insertion inline error recovery
  37177. // strategy. It is called by {@link //recoverInline} if the single-token
  37178. // deletion strategy fails to recover from the mismatched input. If this
  37179. // method returns {@code true}, {@code recognizer} will be in error recovery
  37180. // mode.
  37181. //
  37182. // <p>This method determines whether or not single-token insertion is viable by
  37183. // checking if the {@code LA(1)} input symbol could be successfully matched
  37184. // if it were instead the {@code LA(2)} symbol. If this method returns
  37185. // {@code true}, the caller is responsible for creating and inserting a
  37186. // token with the correct type to produce this behavior.</p>
  37187. //
  37188. // @param recognizer the parser instance
  37189. // @return {@code true} if single-token insertion is a viable recovery
  37190. // strategy for the current mismatched input, otherwise {@code false}
  37191. //
  37192. DefaultErrorStrategy.prototype.singleTokenInsertion = function(recognizer) {
  37193. var currentSymbolType = recognizer.getTokenStream().LA(1);
  37194. // if current token is consistent with what could come after current
  37195. // ATN state, then we know we're missing a token; error recovery
  37196. // is free to conjure up and insert the missing token
  37197. var atn = recognizer._interp.atn;
  37198. var currentState = atn.states[recognizer.state];
  37199. var next = currentState.transitions[0].target;
  37200. var expectingAtLL2 = atn.nextTokens(next, recognizer._ctx);
  37201. if (expectingAtLL2.contains(currentSymbolType) ){
  37202. this.reportMissingToken(recognizer);
  37203. return true;
  37204. } else {
  37205. return false;
  37206. }
  37207. };
  37208. // This method implements the single-token deletion inline error recovery
  37209. // strategy. It is called by {@link //recoverInline} to attempt to recover
  37210. // from mismatched input. If this method returns null, the parser and error
  37211. // handler state will not have changed. If this method returns non-null,
  37212. // {@code recognizer} will <em>not</em> be in error recovery mode since the
  37213. // returned token was a successful match.
  37214. //
  37215. // <p>If the single-token deletion is successful, this method calls
  37216. // {@link //reportUnwantedToken} to report the error, followed by
  37217. // {@link Parser//consume} to actually "delete" the extraneous token. Then,
  37218. // before returning {@link //reportMatch} is called to signal a successful
  37219. // match.</p>
  37220. //
  37221. // @param recognizer the parser instance
  37222. // @return the successfully matched {@link Token} instance if single-token
  37223. // deletion successfully recovers from the mismatched input, otherwise
  37224. // {@code null}
  37225. //
  37226. DefaultErrorStrategy.prototype.singleTokenDeletion = function(recognizer) {
  37227. var nextTokenType = recognizer.getTokenStream().LA(2);
  37228. var expecting = this.getExpectedTokens(recognizer);
  37229. if (expecting.contains(nextTokenType)) {
  37230. this.reportUnwantedToken(recognizer);
  37231. // print("recoverFromMismatchedToken deleting " \
  37232. // + str(recognizer.getTokenStream().LT(1)) \
  37233. // + " since " + str(recognizer.getTokenStream().LT(2)) \
  37234. // + " is what we want", file=sys.stderr)
  37235. recognizer.consume(); // simply delete extra token
  37236. // we want to return the token we're actually matching
  37237. var matchedSymbol = recognizer.getCurrentToken();
  37238. this.reportMatch(recognizer); // we know current token is correct
  37239. return matchedSymbol;
  37240. } else {
  37241. return null;
  37242. }
  37243. };
  37244. // Conjure up a missing token during error recovery.
  37245. //
  37246. // The recognizer attempts to recover from single missing
  37247. // symbols. But, actions might refer to that missing symbol.
  37248. // For example, x=ID {f($x);}. The action clearly assumes
  37249. // that there has been an identifier matched previously and that
  37250. // $x points at that token. If that token is missing, but
  37251. // the next token in the stream is what we want we assume that
  37252. // this token is missing and we keep going. Because we
  37253. // have to return some token to replace the missing token,
  37254. // we have to conjure one up. This method gives the user control
  37255. // over the tokens returned for missing tokens. Mostly,
  37256. // you will want to create something special for identifier
  37257. // tokens. For literals such as '{' and ',', the default
  37258. // action in the parser or tree parser works. It simply creates
  37259. // a CommonToken of the appropriate type. The text will be the token.
  37260. // If you change what tokens must be created by the lexer,
  37261. // override this method to create the appropriate tokens.
  37262. //
  37263. DefaultErrorStrategy.prototype.getMissingSymbol = function(recognizer) {
  37264. var currentSymbol = recognizer.getCurrentToken();
  37265. var expecting = this.getExpectedTokens(recognizer);
  37266. var expectedTokenType = expecting.first(); // get any element
  37267. var tokenText;
  37268. if (expectedTokenType===Token.EOF) {
  37269. tokenText = "<missing EOF>";
  37270. } else {
  37271. tokenText = "<missing " + recognizer.literalNames[expectedTokenType] + ">";
  37272. }
  37273. var current = currentSymbol;
  37274. var lookback = recognizer.getTokenStream().LT(-1);
  37275. if (current.type===Token.EOF && lookback !== null) {
  37276. current = lookback;
  37277. }
  37278. return recognizer.getTokenFactory().create(current.source,
  37279. expectedTokenType, tokenText, Token.DEFAULT_CHANNEL,
  37280. -1, -1, current.line, current.column);
  37281. };
  37282. DefaultErrorStrategy.prototype.getExpectedTokens = function(recognizer) {
  37283. return recognizer.getExpectedTokens();
  37284. };
  37285. // How should a token be displayed in an error message? The default
  37286. // is to display just the text, but during development you might
  37287. // want to have a lot of information spit out. Override in that case
  37288. // to use t.toString() (which, for CommonToken, dumps everything about
  37289. // the token). This is better than forcing you to override a method in
  37290. // your token objects because you don't have to go modify your lexer
  37291. // so that it creates a new Java type.
  37292. //
  37293. DefaultErrorStrategy.prototype.getTokenErrorDisplay = function(t) {
  37294. if (t === null) {
  37295. return "<no token>";
  37296. }
  37297. var s = t.text;
  37298. if (s === null) {
  37299. if (t.type===Token.EOF) {
  37300. s = "<EOF>";
  37301. } else {
  37302. s = "<" + t.type + ">";
  37303. }
  37304. }
  37305. return this.escapeWSAndQuote(s);
  37306. };
  37307. DefaultErrorStrategy.prototype.escapeWSAndQuote = function(s) {
  37308. s = s.replace(/\n/g,"\\n");
  37309. s = s.replace(/\r/g,"\\r");
  37310. s = s.replace(/\t/g,"\\t");
  37311. return "'" + s + "'";
  37312. };
  37313. // Compute the error recovery set for the current rule. During
  37314. // rule invocation, the parser pushes the set of tokens that can
  37315. // follow that rule reference on the stack; this amounts to
  37316. // computing FIRST of what follows the rule reference in the
  37317. // enclosing rule. See LinearApproximator.FIRST().
  37318. // This local follow set only includes tokens
  37319. // from within the rule; i.e., the FIRST computation done by
  37320. // ANTLR stops at the end of a rule.
  37321. //
  37322. // EXAMPLE
  37323. //
  37324. // When you find a "no viable alt exception", the input is not
  37325. // consistent with any of the alternatives for rule r. The best
  37326. // thing to do is to consume tokens until you see something that
  37327. // can legally follow a call to r//or* any rule that called r.
  37328. // You don't want the exact set of viable next tokens because the
  37329. // input might just be missing a token--you might consume the
  37330. // rest of the input looking for one of the missing tokens.
  37331. //
  37332. // Consider grammar:
  37333. //
  37334. // a : '[' b ']'
  37335. // | '(' b ')'
  37336. // ;
  37337. // b : c '^' INT ;
  37338. // c : ID
  37339. // | INT
  37340. // ;
  37341. //
  37342. // At each rule invocation, the set of tokens that could follow
  37343. // that rule is pushed on a stack. Here are the various
  37344. // context-sensitive follow sets:
  37345. //
  37346. // FOLLOW(b1_in_a) = FIRST(']') = ']'
  37347. // FOLLOW(b2_in_a) = FIRST(')') = ')'
  37348. // FOLLOW(c_in_b) = FIRST('^') = '^'
  37349. //
  37350. // Upon erroneous input "[]", the call chain is
  37351. //
  37352. // a -> b -> c
  37353. //
  37354. // and, hence, the follow context stack is:
  37355. //
  37356. // depth follow set start of rule execution
  37357. // 0 <EOF> a (from main())
  37358. // 1 ']' b
  37359. // 2 '^' c
  37360. //
  37361. // Notice that ')' is not included, because b would have to have
  37362. // been called from a different context in rule a for ')' to be
  37363. // included.
  37364. //
  37365. // For error recovery, we cannot consider FOLLOW(c)
  37366. // (context-sensitive or otherwise). We need the combined set of
  37367. // all context-sensitive FOLLOW sets--the set of all tokens that
  37368. // could follow any reference in the call chain. We need to
  37369. // resync to one of those tokens. Note that FOLLOW(c)='^' and if
  37370. // we resync'd to that token, we'd consume until EOF. We need to
  37371. // sync to context-sensitive FOLLOWs for a, b, and c: {']','^'}.
  37372. // In this case, for input "[]", LA(1) is ']' and in the set, so we would
  37373. // not consume anything. After printing an error, rule c would
  37374. // return normally. Rule b would not find the required '^' though.
  37375. // At this point, it gets a mismatched token error and throws an
  37376. // exception (since LA(1) is not in the viable following token
  37377. // set). The rule exception handler tries to recover, but finds
  37378. // the same recovery set and doesn't consume anything. Rule b
  37379. // exits normally returning to rule a. Now it finds the ']' (and
  37380. // with the successful match exits errorRecovery mode).
  37381. //
  37382. // So, you can see that the parser walks up the call chain looking
  37383. // for the token that was a member of the recovery set.
  37384. //
  37385. // Errors are not generated in errorRecovery mode.
  37386. //
  37387. // ANTLR's error recovery mechanism is based upon original ideas:
  37388. //
  37389. // "Algorithms + Data Structures = Programs" by Niklaus Wirth
  37390. //
  37391. // and
  37392. //
  37393. // "A note on error recovery in recursive descent parsers":
  37394. // http://portal.acm.org/citation.cfm?id=947902.947905
  37395. //
  37396. // Later, Josef Grosch had some good ideas:
  37397. //
  37398. // "Efficient and Comfortable Error Recovery in Recursive Descent
  37399. // Parsers":
  37400. // ftp://www.cocolab.com/products/cocktail/doca4.ps/ell.ps.zip
  37401. //
  37402. // Like Grosch I implement context-sensitive FOLLOW sets that are combined
  37403. // at run-time upon error to avoid overhead during parsing.
  37404. //
  37405. DefaultErrorStrategy.prototype.getErrorRecoverySet = function(recognizer) {
  37406. var atn = recognizer._interp.atn;
  37407. var ctx = recognizer._ctx;
  37408. var recoverSet = new IntervalSet();
  37409. while (ctx !== null && ctx.invokingState>=0) {
  37410. // compute what follows who invoked us
  37411. var invokingState = atn.states[ctx.invokingState];
  37412. var rt = invokingState.transitions[0];
  37413. var follow = atn.nextTokens(rt.followState);
  37414. recoverSet.addSet(follow);
  37415. ctx = ctx.parentCtx;
  37416. }
  37417. recoverSet.removeOne(Token.EPSILON);
  37418. return recoverSet;
  37419. };
  37420. // Consume tokens until one matches the given token set.//
  37421. DefaultErrorStrategy.prototype.consumeUntil = function(recognizer, set) {
  37422. var ttype = recognizer.getTokenStream().LA(1);
  37423. while( ttype !== Token.EOF && !set.contains(ttype)) {
  37424. recognizer.consume();
  37425. ttype = recognizer.getTokenStream().LA(1);
  37426. }
  37427. };
  37428. //
  37429. // This implementation of {@link ANTLRErrorStrategy} responds to syntax errors
  37430. // by immediately canceling the parse operation with a
  37431. // {@link ParseCancellationException}. The implementation ensures that the
  37432. // {@link ParserRuleContext//exception} field is set for all parse tree nodes
  37433. // that were not completed prior to encountering the error.
  37434. //
  37435. // <p>
  37436. // This error strategy is useful in the following scenarios.</p>
  37437. //
  37438. // <ul>
  37439. // <li><strong>Two-stage parsing:</strong> This error strategy allows the first
  37440. // stage of two-stage parsing to immediately terminate if an error is
  37441. // encountered, and immediately fall back to the second stage. In addition to
  37442. // avoiding wasted work by attempting to recover from errors here, the empty
  37443. // implementation of {@link BailErrorStrategy//sync} improves the performance of
  37444. // the first stage.</li>
  37445. // <li><strong>Silent validation:</strong> When syntax errors are not being
  37446. // reported or logged, and the parse result is simply ignored if errors occur,
  37447. // the {@link BailErrorStrategy} avoids wasting work on recovering from errors
  37448. // when the result will be ignored either way.</li>
  37449. // </ul>
  37450. //
  37451. // <p>
  37452. // {@code myparser.setErrorHandler(new BailErrorStrategy());}</p>
  37453. //
  37454. // @see Parser//setErrorHandler(ANTLRErrorStrategy)
  37455. //
  37456. function BailErrorStrategy() {
  37457. DefaultErrorStrategy.call(this);
  37458. return this;
  37459. }
  37460. BailErrorStrategy.prototype = Object.create(DefaultErrorStrategy.prototype);
  37461. BailErrorStrategy.prototype.constructor = BailErrorStrategy;
  37462. // Instead of recovering from exception {@code e}, re-throw it wrapped
  37463. // in a {@link ParseCancellationException} so it is not caught by the
  37464. // rule function catches. Use {@link Exception//getCause()} to get the
  37465. // original {@link RecognitionException}.
  37466. //
  37467. BailErrorStrategy.prototype.recover = function(recognizer, e) {
  37468. var context = recognizer._ctx;
  37469. while (context !== null) {
  37470. context.exception = e;
  37471. context = context.parentCtx;
  37472. }
  37473. throw new ParseCancellationException(e);
  37474. };
  37475. // Make sure we don't attempt to recover inline; if the parser
  37476. // successfully recovers, it won't throw an exception.
  37477. //
  37478. BailErrorStrategy.prototype.recoverInline = function(recognizer) {
  37479. this.recover(recognizer, new InputMismatchException(recognizer));
  37480. };
  37481. // Make sure we don't attempt to recover from problems in subrules.//
  37482. BailErrorStrategy.prototype.sync = function(recognizer) {
  37483. // pass
  37484. };
  37485. exports.BailErrorStrategy = BailErrorStrategy;
  37486. exports.DefaultErrorStrategy = DefaultErrorStrategy;
  37487. /***/ }),
  37488. /***/ "./node_modules/antlr4/error/Errors.js":
  37489. /*!*********************************************!*\
  37490. !*** ./node_modules/antlr4/error/Errors.js ***!
  37491. \*********************************************/
  37492. /*! no static exports found */
  37493. /***/ (function(module, exports, __webpack_require__) {
  37494. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  37495. * Use of this file is governed by the BSD 3-clause license that
  37496. * can be found in the LICENSE.txt file in the project root.
  37497. */
  37498. // The root of the ANTLR exception hierarchy. In general, ANTLR tracks just
  37499. // 3 kinds of errors: prediction errors, failed predicate errors, and
  37500. // mismatched input errors. In each case, the parser knows where it is
  37501. // in the input, where it is in the ATN, the rule invocation stack,
  37502. // and what kind of problem occurred.
  37503. var PredicateTransition = __webpack_require__(/*! ./../atn/Transition */ "./node_modules/antlr4/atn/Transition.js").PredicateTransition;
  37504. function RecognitionException(params) {
  37505. Error.call(this);
  37506. if (!!Error.captureStackTrace) {
  37507. Error.captureStackTrace(this, RecognitionException);
  37508. } else {
  37509. var stack = new Error().stack;
  37510. }
  37511. this.message = params.message;
  37512. this.recognizer = params.recognizer;
  37513. this.input = params.input;
  37514. this.ctx = params.ctx;
  37515. // The current {@link Token} when an error occurred. Since not all streams
  37516. // support accessing symbols by index, we have to track the {@link Token}
  37517. // instance itself.
  37518. this.offendingToken = null;
  37519. // Get the ATN state number the parser was in at the time the error
  37520. // occurred. For {@link NoViableAltException} and
  37521. // {@link LexerNoViableAltException} exceptions, this is the
  37522. // {@link DecisionState} number. For others, it is the state whose outgoing
  37523. // edge we couldn't match.
  37524. this.offendingState = -1;
  37525. if (this.recognizer!==null) {
  37526. this.offendingState = this.recognizer.state;
  37527. }
  37528. return this;
  37529. }
  37530. RecognitionException.prototype = Object.create(Error.prototype);
  37531. RecognitionException.prototype.constructor = RecognitionException;
  37532. // <p>If the state number is not known, this method returns -1.</p>
  37533. //
  37534. // Gets the set of input symbols which could potentially follow the
  37535. // previously matched symbol at the time this exception was thrown.
  37536. //
  37537. // <p>If the set of expected tokens is not known and could not be computed,
  37538. // this method returns {@code null}.</p>
  37539. //
  37540. // @return The set of token types that could potentially follow the current
  37541. // state in the ATN, or {@code null} if the information is not available.
  37542. // /
  37543. RecognitionException.prototype.getExpectedTokens = function() {
  37544. if (this.recognizer!==null) {
  37545. return this.recognizer.atn.getExpectedTokens(this.offendingState, this.ctx);
  37546. } else {
  37547. return null;
  37548. }
  37549. };
  37550. RecognitionException.prototype.toString = function() {
  37551. return this.message;
  37552. };
  37553. function LexerNoViableAltException(lexer, input, startIndex, deadEndConfigs) {
  37554. RecognitionException.call(this, {message:"", recognizer:lexer, input:input, ctx:null});
  37555. this.startIndex = startIndex;
  37556. this.deadEndConfigs = deadEndConfigs;
  37557. return this;
  37558. }
  37559. LexerNoViableAltException.prototype = Object.create(RecognitionException.prototype);
  37560. LexerNoViableAltException.prototype.constructor = LexerNoViableAltException;
  37561. LexerNoViableAltException.prototype.toString = function() {
  37562. var symbol = "";
  37563. if (this.startIndex >= 0 && this.startIndex < this.input.size) {
  37564. symbol = this.input.getText((this.startIndex,this.startIndex));
  37565. }
  37566. return "LexerNoViableAltException" + symbol;
  37567. };
  37568. // Indicates that the parser could not decide which of two or more paths
  37569. // to take based upon the remaining input. It tracks the starting token
  37570. // of the offending input and also knows where the parser was
  37571. // in the various paths when the error. Reported by reportNoViableAlternative()
  37572. //
  37573. function NoViableAltException(recognizer, input, startToken, offendingToken, deadEndConfigs, ctx) {
  37574. ctx = ctx || recognizer._ctx;
  37575. offendingToken = offendingToken || recognizer.getCurrentToken();
  37576. startToken = startToken || recognizer.getCurrentToken();
  37577. input = input || recognizer.getInputStream();
  37578. RecognitionException.call(this, {message:"", recognizer:recognizer, input:input, ctx:ctx});
  37579. // Which configurations did we try at input.index() that couldn't match
  37580. // input.LT(1)?//
  37581. this.deadEndConfigs = deadEndConfigs;
  37582. // The token object at the start index; the input stream might
  37583. // not be buffering tokens so get a reference to it. (At the
  37584. // time the error occurred, of course the stream needs to keep a
  37585. // buffer all of the tokens but later we might not have access to those.)
  37586. this.startToken = startToken;
  37587. this.offendingToken = offendingToken;
  37588. }
  37589. NoViableAltException.prototype = Object.create(RecognitionException.prototype);
  37590. NoViableAltException.prototype.constructor = NoViableAltException;
  37591. // This signifies any kind of mismatched input exceptions such as
  37592. // when the current input does not match the expected token.
  37593. //
  37594. function InputMismatchException(recognizer) {
  37595. RecognitionException.call(this, {message:"", recognizer:recognizer, input:recognizer.getInputStream(), ctx:recognizer._ctx});
  37596. this.offendingToken = recognizer.getCurrentToken();
  37597. }
  37598. InputMismatchException.prototype = Object.create(RecognitionException.prototype);
  37599. InputMismatchException.prototype.constructor = InputMismatchException;
  37600. // A semantic predicate failed during validation. Validation of predicates
  37601. // occurs when normally parsing the alternative just like matching a token.
  37602. // Disambiguating predicate evaluation occurs when we test a predicate during
  37603. // prediction.
  37604. function FailedPredicateException(recognizer, predicate, message) {
  37605. RecognitionException.call(this, {message:this.formatMessage(predicate,message || null), recognizer:recognizer,
  37606. input:recognizer.getInputStream(), ctx:recognizer._ctx});
  37607. var s = recognizer._interp.atn.states[recognizer.state];
  37608. var trans = s.transitions[0];
  37609. if (trans instanceof PredicateTransition) {
  37610. this.ruleIndex = trans.ruleIndex;
  37611. this.predicateIndex = trans.predIndex;
  37612. } else {
  37613. this.ruleIndex = 0;
  37614. this.predicateIndex = 0;
  37615. }
  37616. this.predicate = predicate;
  37617. this.offendingToken = recognizer.getCurrentToken();
  37618. return this;
  37619. }
  37620. FailedPredicateException.prototype = Object.create(RecognitionException.prototype);
  37621. FailedPredicateException.prototype.constructor = FailedPredicateException;
  37622. FailedPredicateException.prototype.formatMessage = function(predicate, message) {
  37623. if (message !==null) {
  37624. return message;
  37625. } else {
  37626. return "failed predicate: {" + predicate + "}?";
  37627. }
  37628. };
  37629. function ParseCancellationException() {
  37630. Error.call(this);
  37631. Error.captureStackTrace(this, ParseCancellationException);
  37632. return this;
  37633. }
  37634. ParseCancellationException.prototype = Object.create(Error.prototype);
  37635. ParseCancellationException.prototype.constructor = ParseCancellationException;
  37636. exports.RecognitionException = RecognitionException;
  37637. exports.NoViableAltException = NoViableAltException;
  37638. exports.LexerNoViableAltException = LexerNoViableAltException;
  37639. exports.InputMismatchException = InputMismatchException;
  37640. exports.FailedPredicateException = FailedPredicateException;
  37641. exports.ParseCancellationException = ParseCancellationException;
  37642. /***/ }),
  37643. /***/ "./node_modules/antlr4/error/index.js":
  37644. /*!********************************************!*\
  37645. !*** ./node_modules/antlr4/error/index.js ***!
  37646. \********************************************/
  37647. /*! no static exports found */
  37648. /***/ (function(module, exports, __webpack_require__) {
  37649. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  37650. * Use of this file is governed by the BSD 3-clause license that
  37651. * can be found in the LICENSE.txt file in the project root.
  37652. */
  37653. exports.RecognitionException = __webpack_require__(/*! ./Errors */ "./node_modules/antlr4/error/Errors.js").RecognitionException;
  37654. exports.NoViableAltException = __webpack_require__(/*! ./Errors */ "./node_modules/antlr4/error/Errors.js").NoViableAltException;
  37655. exports.LexerNoViableAltException = __webpack_require__(/*! ./Errors */ "./node_modules/antlr4/error/Errors.js").LexerNoViableAltException;
  37656. exports.InputMismatchException = __webpack_require__(/*! ./Errors */ "./node_modules/antlr4/error/Errors.js").InputMismatchException;
  37657. exports.FailedPredicateException = __webpack_require__(/*! ./Errors */ "./node_modules/antlr4/error/Errors.js").FailedPredicateException;
  37658. exports.DiagnosticErrorListener = __webpack_require__(/*! ./DiagnosticErrorListener */ "./node_modules/antlr4/error/DiagnosticErrorListener.js").DiagnosticErrorListener;
  37659. exports.BailErrorStrategy = __webpack_require__(/*! ./ErrorStrategy */ "./node_modules/antlr4/error/ErrorStrategy.js").BailErrorStrategy;
  37660. exports.ErrorListener = __webpack_require__(/*! ./ErrorListener */ "./node_modules/antlr4/error/ErrorListener.js").ErrorListener;
  37661. /***/ }),
  37662. /***/ "./node_modules/antlr4/index.js":
  37663. /*!**************************************!*\
  37664. !*** ./node_modules/antlr4/index.js ***!
  37665. \**************************************/
  37666. /*! no static exports found */
  37667. /***/ (function(module, exports, __webpack_require__) {
  37668. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  37669. * Use of this file is governed by the BSD 3-clause license that
  37670. * can be found in the LICENSE.txt file in the project root.
  37671. */
  37672. exports.atn = __webpack_require__(/*! ./atn/index */ "./node_modules/antlr4/atn/index.js");
  37673. exports.codepointat = __webpack_require__(/*! ./polyfills/codepointat */ "./node_modules/antlr4/polyfills/codepointat.js");
  37674. exports.dfa = __webpack_require__(/*! ./dfa/index */ "./node_modules/antlr4/dfa/index.js");
  37675. exports.fromcodepoint = __webpack_require__(/*! ./polyfills/fromcodepoint */ "./node_modules/antlr4/polyfills/fromcodepoint.js");
  37676. exports.tree = __webpack_require__(/*! ./tree/index */ "./node_modules/antlr4/tree/index.js");
  37677. exports.error = __webpack_require__(/*! ./error/index */ "./node_modules/antlr4/error/index.js");
  37678. exports.Token = __webpack_require__(/*! ./Token */ "./node_modules/antlr4/Token.js").Token;
  37679. exports.CharStreams = __webpack_require__(/*! ./CharStreams */ "./node_modules/antlr4/CharStreams.js").CharStreams;
  37680. exports.CommonToken = __webpack_require__(/*! ./Token */ "./node_modules/antlr4/Token.js").CommonToken;
  37681. exports.InputStream = __webpack_require__(/*! ./InputStream */ "./node_modules/antlr4/InputStream.js").InputStream;
  37682. exports.FileStream = __webpack_require__(/*! ./FileStream */ "./node_modules/antlr4/FileStream.js").FileStream;
  37683. exports.CommonTokenStream = __webpack_require__(/*! ./CommonTokenStream */ "./node_modules/antlr4/CommonTokenStream.js").CommonTokenStream;
  37684. exports.Lexer = __webpack_require__(/*! ./Lexer */ "./node_modules/antlr4/Lexer.js").Lexer;
  37685. exports.Parser = __webpack_require__(/*! ./Parser */ "./node_modules/antlr4/Parser.js").Parser;
  37686. var pc = __webpack_require__(/*! ./PredictionContext */ "./node_modules/antlr4/PredictionContext.js");
  37687. exports.PredictionContextCache = pc.PredictionContextCache;
  37688. exports.ParserRuleContext = __webpack_require__(/*! ./ParserRuleContext */ "./node_modules/antlr4/ParserRuleContext.js").ParserRuleContext;
  37689. exports.Interval = __webpack_require__(/*! ./IntervalSet */ "./node_modules/antlr4/IntervalSet.js").Interval;
  37690. exports.Utils = __webpack_require__(/*! ./Utils */ "./node_modules/antlr4/Utils.js");
  37691. /***/ }),
  37692. /***/ "./node_modules/antlr4/polyfills/codepointat.js":
  37693. /*!******************************************************!*\
  37694. !*** ./node_modules/antlr4/polyfills/codepointat.js ***!
  37695. \******************************************************/
  37696. /*! no static exports found */
  37697. /***/ (function(module, exports) {
  37698. /*! https://mths.be/codepointat v0.2.0 by @mathias */
  37699. if (!String.prototype.codePointAt) {
  37700. (function() {
  37701. 'use strict'; // needed to support `apply`/`call` with `undefined`/`null`
  37702. var defineProperty = (function() {
  37703. // IE 8 only supports `Object.defineProperty` on DOM elements
  37704. try {
  37705. var object = {};
  37706. var $defineProperty = Object.defineProperty;
  37707. var result = $defineProperty(object, object, object) && $defineProperty;
  37708. } catch(error) {}
  37709. return result;
  37710. }());
  37711. var codePointAt = function(position) {
  37712. if (this == null) {
  37713. throw TypeError();
  37714. }
  37715. var string = String(this);
  37716. var size = string.length;
  37717. // `ToInteger`
  37718. var index = position ? Number(position) : 0;
  37719. if (index != index) { // better `isNaN`
  37720. index = 0;
  37721. }
  37722. // Account for out-of-bounds indices:
  37723. if (index < 0 || index >= size) {
  37724. return undefined;
  37725. }
  37726. // Get the first code unit
  37727. var first = string.charCodeAt(index);
  37728. var second;
  37729. if ( // check if it’s the start of a surrogate pair
  37730. first >= 0xD800 && first <= 0xDBFF && // high surrogate
  37731. size > index + 1 // there is a next code unit
  37732. ) {
  37733. second = string.charCodeAt(index + 1);
  37734. if (second >= 0xDC00 && second <= 0xDFFF) { // low surrogate
  37735. // https://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae
  37736. return (first - 0xD800) * 0x400 + second - 0xDC00 + 0x10000;
  37737. }
  37738. }
  37739. return first;
  37740. };
  37741. if (defineProperty) {
  37742. defineProperty(String.prototype, 'codePointAt', {
  37743. 'value': codePointAt,
  37744. 'configurable': true,
  37745. 'writable': true
  37746. });
  37747. } else {
  37748. String.prototype.codePointAt = codePointAt;
  37749. }
  37750. }());
  37751. }
  37752. /***/ }),
  37753. /***/ "./node_modules/antlr4/polyfills/fromcodepoint.js":
  37754. /*!********************************************************!*\
  37755. !*** ./node_modules/antlr4/polyfills/fromcodepoint.js ***!
  37756. \********************************************************/
  37757. /*! no static exports found */
  37758. /***/ (function(module, exports) {
  37759. /*! https://mths.be/fromcodepoint v0.2.1 by @mathias */
  37760. if (!String.fromCodePoint) {
  37761. (function() {
  37762. var defineProperty = (function() {
  37763. // IE 8 only supports `Object.defineProperty` on DOM elements
  37764. try {
  37765. var object = {};
  37766. var $defineProperty = Object.defineProperty;
  37767. var result = $defineProperty(object, object, object) && $defineProperty;
  37768. } catch(error) {}
  37769. return result;
  37770. }());
  37771. var stringFromCharCode = String.fromCharCode;
  37772. var floor = Math.floor;
  37773. var fromCodePoint = function(_) {
  37774. var MAX_SIZE = 0x4000;
  37775. var codeUnits = [];
  37776. var highSurrogate;
  37777. var lowSurrogate;
  37778. var index = -1;
  37779. var length = arguments.length;
  37780. if (!length) {
  37781. return '';
  37782. }
  37783. var result = '';
  37784. while (++index < length) {
  37785. var codePoint = Number(arguments[index]);
  37786. if (
  37787. !isFinite(codePoint) || // `NaN`, `+Infinity`, or `-Infinity`
  37788. codePoint < 0 || // not a valid Unicode code point
  37789. codePoint > 0x10FFFF || // not a valid Unicode code point
  37790. floor(codePoint) != codePoint // not an integer
  37791. ) {
  37792. throw RangeError('Invalid code point: ' + codePoint);
  37793. }
  37794. if (codePoint <= 0xFFFF) { // BMP code point
  37795. codeUnits.push(codePoint);
  37796. } else { // Astral code point; split in surrogate halves
  37797. // https://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae
  37798. codePoint -= 0x10000;
  37799. highSurrogate = (codePoint >> 10) + 0xD800;
  37800. lowSurrogate = (codePoint % 0x400) + 0xDC00;
  37801. codeUnits.push(highSurrogate, lowSurrogate);
  37802. }
  37803. if (index + 1 == length || codeUnits.length > MAX_SIZE) {
  37804. result += stringFromCharCode.apply(null, codeUnits);
  37805. codeUnits.length = 0;
  37806. }
  37807. }
  37808. return result;
  37809. };
  37810. if (defineProperty) {
  37811. defineProperty(String, 'fromCodePoint', {
  37812. 'value': fromCodePoint,
  37813. 'configurable': true,
  37814. 'writable': true
  37815. });
  37816. } else {
  37817. String.fromCodePoint = fromCodePoint;
  37818. }
  37819. }());
  37820. }
  37821. /***/ }),
  37822. /***/ "./node_modules/antlr4/tree/Tree.js":
  37823. /*!******************************************!*\
  37824. !*** ./node_modules/antlr4/tree/Tree.js ***!
  37825. \******************************************/
  37826. /*! no static exports found */
  37827. /***/ (function(module, exports, __webpack_require__) {
  37828. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  37829. * Use of this file is governed by the BSD 3-clause license that
  37830. * can be found in the LICENSE.txt file in the project root.
  37831. */
  37832. ///
  37833. // The basic notion of a tree has a parent, a payload, and a list of children.
  37834. // It is the most abstract interface for all the trees used by ANTLR.
  37835. ///
  37836. var Token = __webpack_require__(/*! ./../Token */ "./node_modules/antlr4/Token.js").Token;
  37837. var Interval = __webpack_require__(/*! ./../IntervalSet */ "./node_modules/antlr4/IntervalSet.js").Interval;
  37838. var INVALID_INTERVAL = new Interval(-1, -2);
  37839. var Utils = __webpack_require__(/*! ../Utils.js */ "./node_modules/antlr4/Utils.js");
  37840. function Tree() {
  37841. return this;
  37842. }
  37843. function SyntaxTree() {
  37844. Tree.call(this);
  37845. return this;
  37846. }
  37847. SyntaxTree.prototype = Object.create(Tree.prototype);
  37848. SyntaxTree.prototype.constructor = SyntaxTree;
  37849. function ParseTree() {
  37850. SyntaxTree.call(this);
  37851. return this;
  37852. }
  37853. ParseTree.prototype = Object.create(SyntaxTree.prototype);
  37854. ParseTree.prototype.constructor = ParseTree;
  37855. function RuleNode() {
  37856. ParseTree.call(this);
  37857. return this;
  37858. }
  37859. RuleNode.prototype = Object.create(ParseTree.prototype);
  37860. RuleNode.prototype.constructor = RuleNode;
  37861. function TerminalNode() {
  37862. ParseTree.call(this);
  37863. return this;
  37864. }
  37865. TerminalNode.prototype = Object.create(ParseTree.prototype);
  37866. TerminalNode.prototype.constructor = TerminalNode;
  37867. function ErrorNode() {
  37868. TerminalNode.call(this);
  37869. return this;
  37870. }
  37871. ErrorNode.prototype = Object.create(TerminalNode.prototype);
  37872. ErrorNode.prototype.constructor = ErrorNode;
  37873. function ParseTreeVisitor() {
  37874. return this;
  37875. }
  37876. ParseTreeVisitor.prototype.visit = function(ctx) {
  37877. if (Array.isArray(ctx)) {
  37878. return ctx.map(function(child) {
  37879. return child.accept(this);
  37880. }, this);
  37881. } else {
  37882. return ctx.accept(this);
  37883. }
  37884. };
  37885. ParseTreeVisitor.prototype.visitChildren = function(ctx) {
  37886. return this.visit(ctx.children);
  37887. }
  37888. ParseTreeVisitor.prototype.visitTerminal = function(node) {
  37889. };
  37890. ParseTreeVisitor.prototype.visitErrorNode = function(node) {
  37891. };
  37892. function ParseTreeListener() {
  37893. return this;
  37894. }
  37895. ParseTreeListener.prototype.visitTerminal = function(node) {
  37896. };
  37897. ParseTreeListener.prototype.visitErrorNode = function(node) {
  37898. };
  37899. ParseTreeListener.prototype.enterEveryRule = function(node) {
  37900. };
  37901. ParseTreeListener.prototype.exitEveryRule = function(node) {
  37902. };
  37903. function TerminalNodeImpl(symbol) {
  37904. TerminalNode.call(this);
  37905. this.parentCtx = null;
  37906. this.symbol = symbol;
  37907. return this;
  37908. }
  37909. TerminalNodeImpl.prototype = Object.create(TerminalNode.prototype);
  37910. TerminalNodeImpl.prototype.constructor = TerminalNodeImpl;
  37911. TerminalNodeImpl.prototype.getChild = function(i) {
  37912. return null;
  37913. };
  37914. TerminalNodeImpl.prototype.getSymbol = function() {
  37915. return this.symbol;
  37916. };
  37917. TerminalNodeImpl.prototype.getParent = function() {
  37918. return this.parentCtx;
  37919. };
  37920. TerminalNodeImpl.prototype.getPayload = function() {
  37921. return this.symbol;
  37922. };
  37923. TerminalNodeImpl.prototype.getSourceInterval = function() {
  37924. if (this.symbol === null) {
  37925. return INVALID_INTERVAL;
  37926. }
  37927. var tokenIndex = this.symbol.tokenIndex;
  37928. return new Interval(tokenIndex, tokenIndex);
  37929. };
  37930. TerminalNodeImpl.prototype.getChildCount = function() {
  37931. return 0;
  37932. };
  37933. TerminalNodeImpl.prototype.accept = function(visitor) {
  37934. return visitor.visitTerminal(this);
  37935. };
  37936. TerminalNodeImpl.prototype.getText = function() {
  37937. return this.symbol.text;
  37938. };
  37939. TerminalNodeImpl.prototype.toString = function() {
  37940. if (this.symbol.type === Token.EOF) {
  37941. return "<EOF>";
  37942. } else {
  37943. return this.symbol.text;
  37944. }
  37945. };
  37946. // Represents a token that was consumed during resynchronization
  37947. // rather than during a valid match operation. For example,
  37948. // we will create this kind of a node during single token insertion
  37949. // and deletion as well as during "consume until error recovery set"
  37950. // upon no viable alternative exceptions.
  37951. function ErrorNodeImpl(token) {
  37952. TerminalNodeImpl.call(this, token);
  37953. return this;
  37954. }
  37955. ErrorNodeImpl.prototype = Object.create(TerminalNodeImpl.prototype);
  37956. ErrorNodeImpl.prototype.constructor = ErrorNodeImpl;
  37957. ErrorNodeImpl.prototype.isErrorNode = function() {
  37958. return true;
  37959. };
  37960. ErrorNodeImpl.prototype.accept = function(visitor) {
  37961. return visitor.visitErrorNode(this);
  37962. };
  37963. function ParseTreeWalker() {
  37964. return this;
  37965. }
  37966. ParseTreeWalker.prototype.walk = function(listener, t) {
  37967. var errorNode = t instanceof ErrorNode ||
  37968. (t.isErrorNode !== undefined && t.isErrorNode());
  37969. if (errorNode) {
  37970. listener.visitErrorNode(t);
  37971. } else if (t instanceof TerminalNode) {
  37972. listener.visitTerminal(t);
  37973. } else {
  37974. this.enterRule(listener, t);
  37975. for (var i = 0; i < t.getChildCount(); i++) {
  37976. var child = t.getChild(i);
  37977. this.walk(listener, child);
  37978. }
  37979. this.exitRule(listener, t);
  37980. }
  37981. };
  37982. //
  37983. // The discovery of a rule node, involves sending two events: the generic
  37984. // {@link ParseTreeListener//enterEveryRule} and a
  37985. // {@link RuleContext}-specific event. First we trigger the generic and then
  37986. // the rule specific. We to them in reverse order upon finishing the node.
  37987. //
  37988. ParseTreeWalker.prototype.enterRule = function(listener, r) {
  37989. var ctx = r.getRuleContext();
  37990. listener.enterEveryRule(ctx);
  37991. ctx.enterRule(listener);
  37992. };
  37993. ParseTreeWalker.prototype.exitRule = function(listener, r) {
  37994. var ctx = r.getRuleContext();
  37995. ctx.exitRule(listener);
  37996. listener.exitEveryRule(ctx);
  37997. };
  37998. ParseTreeWalker.DEFAULT = new ParseTreeWalker();
  37999. exports.RuleNode = RuleNode;
  38000. exports.ErrorNode = ErrorNode;
  38001. exports.TerminalNode = TerminalNode;
  38002. exports.ErrorNodeImpl = ErrorNodeImpl;
  38003. exports.TerminalNodeImpl = TerminalNodeImpl;
  38004. exports.ParseTreeListener = ParseTreeListener;
  38005. exports.ParseTreeVisitor = ParseTreeVisitor;
  38006. exports.ParseTreeWalker = ParseTreeWalker;
  38007. exports.INVALID_INTERVAL = INVALID_INTERVAL;
  38008. /***/ }),
  38009. /***/ "./node_modules/antlr4/tree/Trees.js":
  38010. /*!*******************************************!*\
  38011. !*** ./node_modules/antlr4/tree/Trees.js ***!
  38012. \*******************************************/
  38013. /*! no static exports found */
  38014. /***/ (function(module, exports, __webpack_require__) {
  38015. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  38016. * Use of this file is governed by the BSD 3-clause license that
  38017. * can be found in the LICENSE.txt file in the project root.
  38018. */
  38019. var Utils = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js");
  38020. var Token = __webpack_require__(/*! ./../Token */ "./node_modules/antlr4/Token.js").Token;
  38021. var RuleNode = __webpack_require__(/*! ./Tree */ "./node_modules/antlr4/tree/Tree.js").RuleNode;
  38022. var ErrorNode = __webpack_require__(/*! ./Tree */ "./node_modules/antlr4/tree/Tree.js").ErrorNode;
  38023. var TerminalNode = __webpack_require__(/*! ./Tree */ "./node_modules/antlr4/tree/Tree.js").TerminalNode;
  38024. var ParserRuleContext = __webpack_require__(/*! ./../ParserRuleContext */ "./node_modules/antlr4/ParserRuleContext.js").ParserRuleContext;
  38025. var RuleContext = __webpack_require__(/*! ./../RuleContext */ "./node_modules/antlr4/RuleContext.js").RuleContext;
  38026. var INVALID_ALT_NUMBER = __webpack_require__(/*! ./../atn/ATN */ "./node_modules/antlr4/atn/ATN.js").INVALID_ALT_NUMBER;
  38027. /** A set of utility routines useful for all kinds of ANTLR trees. */
  38028. function Trees() {
  38029. }
  38030. // Print out a whole tree in LISP form. {@link //getNodeText} is used on the
  38031. // node payloads to get the text for the nodes. Detect
  38032. // parse trees and extract data appropriately.
  38033. Trees.toStringTree = function(tree, ruleNames, recog) {
  38034. ruleNames = ruleNames || null;
  38035. recog = recog || null;
  38036. if(recog!==null) {
  38037. ruleNames = recog.ruleNames;
  38038. }
  38039. var s = Trees.getNodeText(tree, ruleNames);
  38040. s = Utils.escapeWhitespace(s, false);
  38041. var c = tree.getChildCount();
  38042. if(c===0) {
  38043. return s;
  38044. }
  38045. var res = "(" + s + ' ';
  38046. if(c>0) {
  38047. s = Trees.toStringTree(tree.getChild(0), ruleNames);
  38048. res = res.concat(s);
  38049. }
  38050. for(var i=1;i<c;i++) {
  38051. s = Trees.toStringTree(tree.getChild(i), ruleNames);
  38052. res = res.concat(' ' + s);
  38053. }
  38054. res = res.concat(")");
  38055. return res;
  38056. };
  38057. Trees.getNodeText = function(t, ruleNames, recog) {
  38058. ruleNames = ruleNames || null;
  38059. recog = recog || null;
  38060. if(recog!==null) {
  38061. ruleNames = recog.ruleNames;
  38062. }
  38063. if(ruleNames!==null) {
  38064. if (t instanceof RuleContext) {
  38065. var altNumber = t.getAltNumber();
  38066. if ( altNumber!=INVALID_ALT_NUMBER ) {
  38067. return ruleNames[t.ruleIndex]+":"+altNumber;
  38068. }
  38069. return ruleNames[t.ruleIndex];
  38070. } else if ( t instanceof ErrorNode) {
  38071. return t.toString();
  38072. } else if(t instanceof TerminalNode) {
  38073. if(t.symbol!==null) {
  38074. return t.symbol.text;
  38075. }
  38076. }
  38077. }
  38078. // no recog for rule names
  38079. var payload = t.getPayload();
  38080. if (payload instanceof Token ) {
  38081. return payload.text;
  38082. }
  38083. return t.getPayload().toString();
  38084. };
  38085. // Return ordered list of all children of this node
  38086. Trees.getChildren = function(t) {
  38087. var list = [];
  38088. for(var i=0;i<t.getChildCount();i++) {
  38089. list.push(t.getChild(i));
  38090. }
  38091. return list;
  38092. };
  38093. // Return a list of all ancestors of this node. The first node of
  38094. // list is the root and the last is the parent of this node.
  38095. //
  38096. Trees.getAncestors = function(t) {
  38097. var ancestors = [];
  38098. t = t.getParent();
  38099. while(t!==null) {
  38100. ancestors = [t].concat(ancestors);
  38101. t = t.getParent();
  38102. }
  38103. return ancestors;
  38104. };
  38105. Trees.findAllTokenNodes = function(t, ttype) {
  38106. return Trees.findAllNodes(t, ttype, true);
  38107. };
  38108. Trees.findAllRuleNodes = function(t, ruleIndex) {
  38109. return Trees.findAllNodes(t, ruleIndex, false);
  38110. };
  38111. Trees.findAllNodes = function(t, index, findTokens) {
  38112. var nodes = [];
  38113. Trees._findAllNodes(t, index, findTokens, nodes);
  38114. return nodes;
  38115. };
  38116. Trees._findAllNodes = function(t, index, findTokens, nodes) {
  38117. // check this node (the root) first
  38118. if(findTokens && (t instanceof TerminalNode)) {
  38119. if(t.symbol.type===index) {
  38120. nodes.push(t);
  38121. }
  38122. } else if(!findTokens && (t instanceof ParserRuleContext)) {
  38123. if(t.ruleIndex===index) {
  38124. nodes.push(t);
  38125. }
  38126. }
  38127. // check children
  38128. for(var i=0;i<t.getChildCount();i++) {
  38129. Trees._findAllNodes(t.getChild(i), index, findTokens, nodes);
  38130. }
  38131. };
  38132. Trees.descendants = function(t) {
  38133. var nodes = [t];
  38134. for(var i=0;i<t.getChildCount();i++) {
  38135. nodes = nodes.concat(Trees.descendants(t.getChild(i)));
  38136. }
  38137. return nodes;
  38138. };
  38139. exports.Trees = Trees;
  38140. /***/ }),
  38141. /***/ "./node_modules/antlr4/tree/index.js":
  38142. /*!*******************************************!*\
  38143. !*** ./node_modules/antlr4/tree/index.js ***!
  38144. \*******************************************/
  38145. /*! no static exports found */
  38146. /***/ (function(module, exports, __webpack_require__) {
  38147. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  38148. * Use of this file is governed by the BSD 3-clause license that
  38149. * can be found in the LICENSE.txt file in the project root.
  38150. */
  38151. var Tree = __webpack_require__(/*! ./Tree */ "./node_modules/antlr4/tree/Tree.js");
  38152. exports.Trees = __webpack_require__(/*! ./Trees */ "./node_modules/antlr4/tree/Trees.js").Trees;
  38153. exports.RuleNode = Tree.RuleNode;
  38154. exports.ParseTreeListener = Tree.ParseTreeListener;
  38155. exports.ParseTreeVisitor = Tree.ParseTreeVisitor;
  38156. exports.ParseTreeWalker = Tree.ParseTreeWalker;
  38157. /***/ }),
  38158. /***/ "./node_modules/decimal.js/decimal.js":
  38159. /*!********************************************!*\
  38160. !*** ./node_modules/decimal.js/decimal.js ***!
  38161. \********************************************/
  38162. /*! no static exports found */
  38163. /***/ (function(module, exports, __webpack_require__) {
  38164. var __WEBPACK_AMD_DEFINE_RESULT__;/*! decimal.js v10.0.1 https://github.com/MikeMcl/decimal.js/LICENCE */
  38165. ;(function (globalScope) {
  38166. 'use strict';
  38167. /*
  38168. * decimal.js v10.0.1
  38169. * An arbitrary-precision Decimal type for JavaScript.
  38170. * https://github.com/MikeMcl/decimal.js
  38171. * Copyright (c) 2017 Michael Mclaughlin <M8ch88l@gmail.com>
  38172. * MIT Licence
  38173. */
  38174. // ----------------------------------- EDITABLE DEFAULTS ------------------------------------ //
  38175. // The maximum exponent magnitude.
  38176. // The limit on the value of `toExpNeg`, `toExpPos`, `minE` and `maxE`.
  38177. var EXP_LIMIT = 9e15, // 0 to 9e15
  38178. // The limit on the value of `precision`, and on the value of the first argument to
  38179. // `toDecimalPlaces`, `toExponential`, `toFixed`, `toPrecision` and `toSignificantDigits`.
  38180. MAX_DIGITS = 1e9, // 0 to 1e9
  38181. // Base conversion alphabet.
  38182. NUMERALS = '0123456789abcdef',
  38183. // The natural logarithm of 10 (1025 digits).
  38184. LN10 = '2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058',
  38185. // Pi (1025 digits).
  38186. PI = '3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789',
  38187. // The initial configuration properties of the Decimal constructor.
  38188. DEFAULTS = {
  38189. // These values must be integers within the stated ranges (inclusive).
  38190. // Most of these values can be changed at run-time using the `Decimal.config` method.
  38191. // The maximum number of significant digits of the result of a calculation or base conversion.
  38192. // E.g. `Decimal.config({ precision: 20 });`
  38193. precision: 20, // 1 to MAX_DIGITS
  38194. // The rounding mode used when rounding to `precision`.
  38195. //
  38196. // ROUND_UP 0 Away from zero.
  38197. // ROUND_DOWN 1 Towards zero.
  38198. // ROUND_CEIL 2 Towards +Infinity.
  38199. // ROUND_FLOOR 3 Towards -Infinity.
  38200. // ROUND_HALF_UP 4 Towards nearest neighbour. If equidistant, up.
  38201. // ROUND_HALF_DOWN 5 Towards nearest neighbour. If equidistant, down.
  38202. // ROUND_HALF_EVEN 6 Towards nearest neighbour. If equidistant, towards even neighbour.
  38203. // ROUND_HALF_CEIL 7 Towards nearest neighbour. If equidistant, towards +Infinity.
  38204. // ROUND_HALF_FLOOR 8 Towards nearest neighbour. If equidistant, towards -Infinity.
  38205. //
  38206. // E.g.
  38207. // `Decimal.rounding = 4;`
  38208. // `Decimal.rounding = Decimal.ROUND_HALF_UP;`
  38209. rounding: 4, // 0 to 8
  38210. // The modulo mode used when calculating the modulus: a mod n.
  38211. // The quotient (q = a / n) is calculated according to the corresponding rounding mode.
  38212. // The remainder (r) is calculated as: r = a - n * q.
  38213. //
  38214. // UP 0 The remainder is positive if the dividend is negative, else is negative.
  38215. // DOWN 1 The remainder has the same sign as the dividend (JavaScript %).
  38216. // FLOOR 3 The remainder has the same sign as the divisor (Python %).
  38217. // HALF_EVEN 6 The IEEE 754 remainder function.
  38218. // EUCLID 9 Euclidian division. q = sign(n) * floor(a / abs(n)). Always positive.
  38219. //
  38220. // Truncated division (1), floored division (3), the IEEE 754 remainder (6), and Euclidian
  38221. // division (9) are commonly used for the modulus operation. The other rounding modes can also
  38222. // be used, but they may not give useful results.
  38223. modulo: 1, // 0 to 9
  38224. // The exponent value at and beneath which `toString` returns exponential notation.
  38225. // JavaScript numbers: -7
  38226. toExpNeg: -7, // 0 to -EXP_LIMIT
  38227. // The exponent value at and above which `toString` returns exponential notation.
  38228. // JavaScript numbers: 21
  38229. toExpPos: 21, // 0 to EXP_LIMIT
  38230. // The minimum exponent value, beneath which underflow to zero occurs.
  38231. // JavaScript numbers: -324 (5e-324)
  38232. minE: -EXP_LIMIT, // -1 to -EXP_LIMIT
  38233. // The maximum exponent value, above which overflow to Infinity occurs.
  38234. // JavaScript numbers: 308 (1.7976931348623157e+308)
  38235. maxE: EXP_LIMIT, // 1 to EXP_LIMIT
  38236. // Whether to use cryptographically-secure random number generation, if available.
  38237. crypto: false // true/false
  38238. },
  38239. // ----------------------------------- END OF EDITABLE DEFAULTS ------------------------------- //
  38240. Decimal, inexact, noConflict, quadrant,
  38241. external = true,
  38242. decimalError = '[DecimalError] ',
  38243. invalidArgument = decimalError + 'Invalid argument: ',
  38244. precisionLimitExceeded = decimalError + 'Precision limit exceeded',
  38245. cryptoUnavailable = decimalError + 'crypto unavailable',
  38246. mathfloor = Math.floor,
  38247. mathpow = Math.pow,
  38248. isBinary = /^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i,
  38249. isHex = /^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i,
  38250. isOctal = /^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i,
  38251. isDecimal = /^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,
  38252. BASE = 1e7,
  38253. LOG_BASE = 7,
  38254. MAX_SAFE_INTEGER = 9007199254740991,
  38255. LN10_PRECISION = LN10.length - 1,
  38256. PI_PRECISION = PI.length - 1,
  38257. // Decimal.prototype object
  38258. P = { name: '[object Decimal]' };
  38259. // Decimal prototype methods
  38260. /*
  38261. * absoluteValue abs
  38262. * ceil
  38263. * comparedTo cmp
  38264. * cosine cos
  38265. * cubeRoot cbrt
  38266. * decimalPlaces dp
  38267. * dividedBy div
  38268. * dividedToIntegerBy divToInt
  38269. * equals eq
  38270. * floor
  38271. * greaterThan gt
  38272. * greaterThanOrEqualTo gte
  38273. * hyperbolicCosine cosh
  38274. * hyperbolicSine sinh
  38275. * hyperbolicTangent tanh
  38276. * inverseCosine acos
  38277. * inverseHyperbolicCosine acosh
  38278. * inverseHyperbolicSine asinh
  38279. * inverseHyperbolicTangent atanh
  38280. * inverseSine asin
  38281. * inverseTangent atan
  38282. * isFinite
  38283. * isInteger isInt
  38284. * isNaN
  38285. * isNegative isNeg
  38286. * isPositive isPos
  38287. * isZero
  38288. * lessThan lt
  38289. * lessThanOrEqualTo lte
  38290. * logarithm log
  38291. * [maximum] [max]
  38292. * [minimum] [min]
  38293. * minus sub
  38294. * modulo mod
  38295. * naturalExponential exp
  38296. * naturalLogarithm ln
  38297. * negated neg
  38298. * plus add
  38299. * precision sd
  38300. * round
  38301. * sine sin
  38302. * squareRoot sqrt
  38303. * tangent tan
  38304. * times mul
  38305. * toBinary
  38306. * toDecimalPlaces toDP
  38307. * toExponential
  38308. * toFixed
  38309. * toFraction
  38310. * toHexadecimal toHex
  38311. * toNearest
  38312. * toNumber
  38313. * toOctal
  38314. * toPower pow
  38315. * toPrecision
  38316. * toSignificantDigits toSD
  38317. * toString
  38318. * truncated trunc
  38319. * valueOf toJSON
  38320. */
  38321. /*
  38322. * Return a new Decimal whose value is the absolute value of this Decimal.
  38323. *
  38324. */
  38325. P.absoluteValue = P.abs = function () {
  38326. var x = new this.constructor(this);
  38327. if (x.s < 0) x.s = 1;
  38328. return finalise(x);
  38329. };
  38330. /*
  38331. * Return a new Decimal whose value is the value of this Decimal rounded to a whole number in the
  38332. * direction of positive Infinity.
  38333. *
  38334. */
  38335. P.ceil = function () {
  38336. return finalise(new this.constructor(this), this.e + 1, 2);
  38337. };
  38338. /*
  38339. * Return
  38340. * 1 if the value of this Decimal is greater than the value of `y`,
  38341. * -1 if the value of this Decimal is less than the value of `y`,
  38342. * 0 if they have the same value,
  38343. * NaN if the value of either Decimal is NaN.
  38344. *
  38345. */
  38346. P.comparedTo = P.cmp = function (y) {
  38347. var i, j, xdL, ydL,
  38348. x = this,
  38349. xd = x.d,
  38350. yd = (y = new x.constructor(y)).d,
  38351. xs = x.s,
  38352. ys = y.s;
  38353. // Either NaN or ±Infinity?
  38354. if (!xd || !yd) {
  38355. return !xs || !ys ? NaN : xs !== ys ? xs : xd === yd ? 0 : !xd ^ xs < 0 ? 1 : -1;
  38356. }
  38357. // Either zero?
  38358. if (!xd[0] || !yd[0]) return xd[0] ? xs : yd[0] ? -ys : 0;
  38359. // Signs differ?
  38360. if (xs !== ys) return xs;
  38361. // Compare exponents.
  38362. if (x.e !== y.e) return x.e > y.e ^ xs < 0 ? 1 : -1;
  38363. xdL = xd.length;
  38364. ydL = yd.length;
  38365. // Compare digit by digit.
  38366. for (i = 0, j = xdL < ydL ? xdL : ydL; i < j; ++i) {
  38367. if (xd[i] !== yd[i]) return xd[i] > yd[i] ^ xs < 0 ? 1 : -1;
  38368. }
  38369. // Compare lengths.
  38370. return xdL === ydL ? 0 : xdL > ydL ^ xs < 0 ? 1 : -1;
  38371. };
  38372. /*
  38373. * Return a new Decimal whose value is the cosine of the value in radians of this Decimal.
  38374. *
  38375. * Domain: [-Infinity, Infinity]
  38376. * Range: [-1, 1]
  38377. *
  38378. * cos(0) = 1
  38379. * cos(-0) = 1
  38380. * cos(Infinity) = NaN
  38381. * cos(-Infinity) = NaN
  38382. * cos(NaN) = NaN
  38383. *
  38384. */
  38385. P.cosine = P.cos = function () {
  38386. var pr, rm,
  38387. x = this,
  38388. Ctor = x.constructor;
  38389. if (!x.d) return new Ctor(NaN);
  38390. // cos(0) = cos(-0) = 1
  38391. if (!x.d[0]) return new Ctor(1);
  38392. pr = Ctor.precision;
  38393. rm = Ctor.rounding;
  38394. Ctor.precision = pr + Math.max(x.e, x.sd()) + LOG_BASE;
  38395. Ctor.rounding = 1;
  38396. x = cosine(Ctor, toLessThanHalfPi(Ctor, x));
  38397. Ctor.precision = pr;
  38398. Ctor.rounding = rm;
  38399. return finalise(quadrant == 2 || quadrant == 3 ? x.neg() : x, pr, rm, true);
  38400. };
  38401. /*
  38402. *
  38403. * Return a new Decimal whose value is the cube root of the value of this Decimal, rounded to
  38404. * `precision` significant digits using rounding mode `rounding`.
  38405. *
  38406. * cbrt(0) = 0
  38407. * cbrt(-0) = -0
  38408. * cbrt(1) = 1
  38409. * cbrt(-1) = -1
  38410. * cbrt(N) = N
  38411. * cbrt(-I) = -I
  38412. * cbrt(I) = I
  38413. *
  38414. * Math.cbrt(x) = (x < 0 ? -Math.pow(-x, 1/3) : Math.pow(x, 1/3))
  38415. *
  38416. */
  38417. P.cubeRoot = P.cbrt = function () {
  38418. var e, m, n, r, rep, s, sd, t, t3, t3plusx,
  38419. x = this,
  38420. Ctor = x.constructor;
  38421. if (!x.isFinite() || x.isZero()) return new Ctor(x);
  38422. external = false;
  38423. // Initial estimate.
  38424. s = x.s * Math.pow(x.s * x, 1 / 3);
  38425. // Math.cbrt underflow/overflow?
  38426. // Pass x to Math.pow as integer, then adjust the exponent of the result.
  38427. if (!s || Math.abs(s) == 1 / 0) {
  38428. n = digitsToString(x.d);
  38429. e = x.e;
  38430. // Adjust n exponent so it is a multiple of 3 away from x exponent.
  38431. if (s = (e - n.length + 1) % 3) n += (s == 1 || s == -2 ? '0' : '00');
  38432. s = Math.pow(n, 1 / 3);
  38433. // Rarely, e may be one less than the result exponent value.
  38434. e = mathfloor((e + 1) / 3) - (e % 3 == (e < 0 ? -1 : 2));
  38435. if (s == 1 / 0) {
  38436. n = '5e' + e;
  38437. } else {
  38438. n = s.toExponential();
  38439. n = n.slice(0, n.indexOf('e') + 1) + e;
  38440. }
  38441. r = new Ctor(n);
  38442. r.s = x.s;
  38443. } else {
  38444. r = new Ctor(s.toString());
  38445. }
  38446. sd = (e = Ctor.precision) + 3;
  38447. // Halley's method.
  38448. // TODO? Compare Newton's method.
  38449. for (;;) {
  38450. t = r;
  38451. t3 = t.times(t).times(t);
  38452. t3plusx = t3.plus(x);
  38453. r = divide(t3plusx.plus(x).times(t), t3plusx.plus(t3), sd + 2, 1);
  38454. // TODO? Replace with for-loop and checkRoundingDigits.
  38455. if (digitsToString(t.d).slice(0, sd) === (n = digitsToString(r.d)).slice(0, sd)) {
  38456. n = n.slice(sd - 3, sd + 1);
  38457. // The 4th rounding digit may be in error by -1 so if the 4 rounding digits are 9999 or 4999
  38458. // , i.e. approaching a rounding boundary, continue the iteration.
  38459. if (n == '9999' || !rep && n == '4999') {
  38460. // On the first iteration only, check to see if rounding up gives the exact result as the
  38461. // nines may infinitely repeat.
  38462. if (!rep) {
  38463. finalise(t, e + 1, 0);
  38464. if (t.times(t).times(t).eq(x)) {
  38465. r = t;
  38466. break;
  38467. }
  38468. }
  38469. sd += 4;
  38470. rep = 1;
  38471. } else {
  38472. // If the rounding digits are null, 0{0,4} or 50{0,3}, check for an exact result.
  38473. // If not, then there are further digits and m will be truthy.
  38474. if (!+n || !+n.slice(1) && n.charAt(0) == '5') {
  38475. // Truncate to the first rounding digit.
  38476. finalise(r, e + 1, 1);
  38477. m = !r.times(r).times(r).eq(x);
  38478. }
  38479. break;
  38480. }
  38481. }
  38482. }
  38483. external = true;
  38484. return finalise(r, e, Ctor.rounding, m);
  38485. };
  38486. /*
  38487. * Return the number of decimal places of the value of this Decimal.
  38488. *
  38489. */
  38490. P.decimalPlaces = P.dp = function () {
  38491. var w,
  38492. d = this.d,
  38493. n = NaN;
  38494. if (d) {
  38495. w = d.length - 1;
  38496. n = (w - mathfloor(this.e / LOG_BASE)) * LOG_BASE;
  38497. // Subtract the number of trailing zeros of the last word.
  38498. w = d[w];
  38499. if (w) for (; w % 10 == 0; w /= 10) n--;
  38500. if (n < 0) n = 0;
  38501. }
  38502. return n;
  38503. };
  38504. /*
  38505. * n / 0 = I
  38506. * n / N = N
  38507. * n / I = 0
  38508. * 0 / n = 0
  38509. * 0 / 0 = N
  38510. * 0 / N = N
  38511. * 0 / I = 0
  38512. * N / n = N
  38513. * N / 0 = N
  38514. * N / N = N
  38515. * N / I = N
  38516. * I / n = I
  38517. * I / 0 = I
  38518. * I / N = N
  38519. * I / I = N
  38520. *
  38521. * Return a new Decimal whose value is the value of this Decimal divided by `y`, rounded to
  38522. * `precision` significant digits using rounding mode `rounding`.
  38523. *
  38524. */
  38525. P.dividedBy = P.div = function (y) {
  38526. return divide(this, new this.constructor(y));
  38527. };
  38528. /*
  38529. * Return a new Decimal whose value is the integer part of dividing the value of this Decimal
  38530. * by the value of `y`, rounded to `precision` significant digits using rounding mode `rounding`.
  38531. *
  38532. */
  38533. P.dividedToIntegerBy = P.divToInt = function (y) {
  38534. var x = this,
  38535. Ctor = x.constructor;
  38536. return finalise(divide(x, new Ctor(y), 0, 1, 1), Ctor.precision, Ctor.rounding);
  38537. };
  38538. /*
  38539. * Return true if the value of this Decimal is equal to the value of `y`, otherwise return false.
  38540. *
  38541. */
  38542. P.equals = P.eq = function (y) {
  38543. return this.cmp(y) === 0;
  38544. };
  38545. /*
  38546. * Return a new Decimal whose value is the value of this Decimal rounded to a whole number in the
  38547. * direction of negative Infinity.
  38548. *
  38549. */
  38550. P.floor = function () {
  38551. return finalise(new this.constructor(this), this.e + 1, 3);
  38552. };
  38553. /*
  38554. * Return true if the value of this Decimal is greater than the value of `y`, otherwise return
  38555. * false.
  38556. *
  38557. */
  38558. P.greaterThan = P.gt = function (y) {
  38559. return this.cmp(y) > 0;
  38560. };
  38561. /*
  38562. * Return true if the value of this Decimal is greater than or equal to the value of `y`,
  38563. * otherwise return false.
  38564. *
  38565. */
  38566. P.greaterThanOrEqualTo = P.gte = function (y) {
  38567. var k = this.cmp(y);
  38568. return k == 1 || k === 0;
  38569. };
  38570. /*
  38571. * Return a new Decimal whose value is the hyperbolic cosine of the value in radians of this
  38572. * Decimal.
  38573. *
  38574. * Domain: [-Infinity, Infinity]
  38575. * Range: [1, Infinity]
  38576. *
  38577. * cosh(x) = 1 + x^2/2! + x^4/4! + x^6/6! + ...
  38578. *
  38579. * cosh(0) = 1
  38580. * cosh(-0) = 1
  38581. * cosh(Infinity) = Infinity
  38582. * cosh(-Infinity) = Infinity
  38583. * cosh(NaN) = NaN
  38584. *
  38585. * x time taken (ms) result
  38586. * 1000 9 9.8503555700852349694e+433
  38587. * 10000 25 4.4034091128314607936e+4342
  38588. * 100000 171 1.4033316802130615897e+43429
  38589. * 1000000 3817 1.5166076984010437725e+434294
  38590. * 10000000 abandoned after 2 minute wait
  38591. *
  38592. * TODO? Compare performance of cosh(x) = 0.5 * (exp(x) + exp(-x))
  38593. *
  38594. */
  38595. P.hyperbolicCosine = P.cosh = function () {
  38596. var k, n, pr, rm, len,
  38597. x = this,
  38598. Ctor = x.constructor,
  38599. one = new Ctor(1);
  38600. if (!x.isFinite()) return new Ctor(x.s ? 1 / 0 : NaN);
  38601. if (x.isZero()) return one;
  38602. pr = Ctor.precision;
  38603. rm = Ctor.rounding;
  38604. Ctor.precision = pr + Math.max(x.e, x.sd()) + 4;
  38605. Ctor.rounding = 1;
  38606. len = x.d.length;
  38607. // Argument reduction: cos(4x) = 1 - 8cos^2(x) + 8cos^4(x) + 1
  38608. // i.e. cos(x) = 1 - cos^2(x/4)(8 - 8cos^2(x/4))
  38609. // Estimate the optimum number of times to use the argument reduction.
  38610. // TODO? Estimation reused from cosine() and may not be optimal here.
  38611. if (len < 32) {
  38612. k = Math.ceil(len / 3);
  38613. n = Math.pow(4, -k).toString();
  38614. } else {
  38615. k = 16;
  38616. n = '2.3283064365386962890625e-10';
  38617. }
  38618. x = taylorSeries(Ctor, 1, x.times(n), new Ctor(1), true);
  38619. // Reverse argument reduction
  38620. var cosh2_x,
  38621. i = k,
  38622. d8 = new Ctor(8);
  38623. for (; i--;) {
  38624. cosh2_x = x.times(x);
  38625. x = one.minus(cosh2_x.times(d8.minus(cosh2_x.times(d8))));
  38626. }
  38627. return finalise(x, Ctor.precision = pr, Ctor.rounding = rm, true);
  38628. };
  38629. /*
  38630. * Return a new Decimal whose value is the hyperbolic sine of the value in radians of this
  38631. * Decimal.
  38632. *
  38633. * Domain: [-Infinity, Infinity]
  38634. * Range: [-Infinity, Infinity]
  38635. *
  38636. * sinh(x) = x + x^3/3! + x^5/5! + x^7/7! + ...
  38637. *
  38638. * sinh(0) = 0
  38639. * sinh(-0) = -0
  38640. * sinh(Infinity) = Infinity
  38641. * sinh(-Infinity) = -Infinity
  38642. * sinh(NaN) = NaN
  38643. *
  38644. * x time taken (ms)
  38645. * 10 2 ms
  38646. * 100 5 ms
  38647. * 1000 14 ms
  38648. * 10000 82 ms
  38649. * 100000 886 ms 1.4033316802130615897e+43429
  38650. * 200000 2613 ms
  38651. * 300000 5407 ms
  38652. * 400000 8824 ms
  38653. * 500000 13026 ms 8.7080643612718084129e+217146
  38654. * 1000000 48543 ms
  38655. *
  38656. * TODO? Compare performance of sinh(x) = 0.5 * (exp(x) - exp(-x))
  38657. *
  38658. */
  38659. P.hyperbolicSine = P.sinh = function () {
  38660. var k, pr, rm, len,
  38661. x = this,
  38662. Ctor = x.constructor;
  38663. if (!x.isFinite() || x.isZero()) return new Ctor(x);
  38664. pr = Ctor.precision;
  38665. rm = Ctor.rounding;
  38666. Ctor.precision = pr + Math.max(x.e, x.sd()) + 4;
  38667. Ctor.rounding = 1;
  38668. len = x.d.length;
  38669. if (len < 3) {
  38670. x = taylorSeries(Ctor, 2, x, x, true);
  38671. } else {
  38672. // Alternative argument reduction: sinh(3x) = sinh(x)(3 + 4sinh^2(x))
  38673. // i.e. sinh(x) = sinh(x/3)(3 + 4sinh^2(x/3))
  38674. // 3 multiplications and 1 addition
  38675. // Argument reduction: sinh(5x) = sinh(x)(5 + sinh^2(x)(20 + 16sinh^2(x)))
  38676. // i.e. sinh(x) = sinh(x/5)(5 + sinh^2(x/5)(20 + 16sinh^2(x/5)))
  38677. // 4 multiplications and 2 additions
  38678. // Estimate the optimum number of times to use the argument reduction.
  38679. k = 1.4 * Math.sqrt(len);
  38680. k = k > 16 ? 16 : k | 0;
  38681. x = x.times(Math.pow(5, -k));
  38682. x = taylorSeries(Ctor, 2, x, x, true);
  38683. // Reverse argument reduction
  38684. var sinh2_x,
  38685. d5 = new Ctor(5),
  38686. d16 = new Ctor(16),
  38687. d20 = new Ctor(20);
  38688. for (; k--;) {
  38689. sinh2_x = x.times(x);
  38690. x = x.times(d5.plus(sinh2_x.times(d16.times(sinh2_x).plus(d20))));
  38691. }
  38692. }
  38693. Ctor.precision = pr;
  38694. Ctor.rounding = rm;
  38695. return finalise(x, pr, rm, true);
  38696. };
  38697. /*
  38698. * Return a new Decimal whose value is the hyperbolic tangent of the value in radians of this
  38699. * Decimal.
  38700. *
  38701. * Domain: [-Infinity, Infinity]
  38702. * Range: [-1, 1]
  38703. *
  38704. * tanh(x) = sinh(x) / cosh(x)
  38705. *
  38706. * tanh(0) = 0
  38707. * tanh(-0) = -0
  38708. * tanh(Infinity) = 1
  38709. * tanh(-Infinity) = -1
  38710. * tanh(NaN) = NaN
  38711. *
  38712. */
  38713. P.hyperbolicTangent = P.tanh = function () {
  38714. var pr, rm,
  38715. x = this,
  38716. Ctor = x.constructor;
  38717. if (!x.isFinite()) return new Ctor(x.s);
  38718. if (x.isZero()) return new Ctor(x);
  38719. pr = Ctor.precision;
  38720. rm = Ctor.rounding;
  38721. Ctor.precision = pr + 7;
  38722. Ctor.rounding = 1;
  38723. return divide(x.sinh(), x.cosh(), Ctor.precision = pr, Ctor.rounding = rm);
  38724. };
  38725. /*
  38726. * Return a new Decimal whose value is the arccosine (inverse cosine) in radians of the value of
  38727. * this Decimal.
  38728. *
  38729. * Domain: [-1, 1]
  38730. * Range: [0, pi]
  38731. *
  38732. * acos(x) = pi/2 - asin(x)
  38733. *
  38734. * acos(0) = pi/2
  38735. * acos(-0) = pi/2
  38736. * acos(1) = 0
  38737. * acos(-1) = pi
  38738. * acos(1/2) = pi/3
  38739. * acos(-1/2) = 2*pi/3
  38740. * acos(|x| > 1) = NaN
  38741. * acos(NaN) = NaN
  38742. *
  38743. */
  38744. P.inverseCosine = P.acos = function () {
  38745. var halfPi,
  38746. x = this,
  38747. Ctor = x.constructor,
  38748. k = x.abs().cmp(1),
  38749. pr = Ctor.precision,
  38750. rm = Ctor.rounding;
  38751. if (k !== -1) {
  38752. return k === 0
  38753. // |x| is 1
  38754. ? x.isNeg() ? getPi(Ctor, pr, rm) : new Ctor(0)
  38755. // |x| > 1 or x is NaN
  38756. : new Ctor(NaN);
  38757. }
  38758. if (x.isZero()) return getPi(Ctor, pr + 4, rm).times(0.5);
  38759. // TODO? Special case acos(0.5) = pi/3 and acos(-0.5) = 2*pi/3
  38760. Ctor.precision = pr + 6;
  38761. Ctor.rounding = 1;
  38762. x = x.asin();
  38763. halfPi = getPi(Ctor, pr + 4, rm).times(0.5);
  38764. Ctor.precision = pr;
  38765. Ctor.rounding = rm;
  38766. return halfPi.minus(x);
  38767. };
  38768. /*
  38769. * Return a new Decimal whose value is the inverse of the hyperbolic cosine in radians of the
  38770. * value of this Decimal.
  38771. *
  38772. * Domain: [1, Infinity]
  38773. * Range: [0, Infinity]
  38774. *
  38775. * acosh(x) = ln(x + sqrt(x^2 - 1))
  38776. *
  38777. * acosh(x < 1) = NaN
  38778. * acosh(NaN) = NaN
  38779. * acosh(Infinity) = Infinity
  38780. * acosh(-Infinity) = NaN
  38781. * acosh(0) = NaN
  38782. * acosh(-0) = NaN
  38783. * acosh(1) = 0
  38784. * acosh(-1) = NaN
  38785. *
  38786. */
  38787. P.inverseHyperbolicCosine = P.acosh = function () {
  38788. var pr, rm,
  38789. x = this,
  38790. Ctor = x.constructor;
  38791. if (x.lte(1)) return new Ctor(x.eq(1) ? 0 : NaN);
  38792. if (!x.isFinite()) return new Ctor(x);
  38793. pr = Ctor.precision;
  38794. rm = Ctor.rounding;
  38795. Ctor.precision = pr + Math.max(Math.abs(x.e), x.sd()) + 4;
  38796. Ctor.rounding = 1;
  38797. external = false;
  38798. x = x.times(x).minus(1).sqrt().plus(x);
  38799. external = true;
  38800. Ctor.precision = pr;
  38801. Ctor.rounding = rm;
  38802. return x.ln();
  38803. };
  38804. /*
  38805. * Return a new Decimal whose value is the inverse of the hyperbolic sine in radians of the value
  38806. * of this Decimal.
  38807. *
  38808. * Domain: [-Infinity, Infinity]
  38809. * Range: [-Infinity, Infinity]
  38810. *
  38811. * asinh(x) = ln(x + sqrt(x^2 + 1))
  38812. *
  38813. * asinh(NaN) = NaN
  38814. * asinh(Infinity) = Infinity
  38815. * asinh(-Infinity) = -Infinity
  38816. * asinh(0) = 0
  38817. * asinh(-0) = -0
  38818. *
  38819. */
  38820. P.inverseHyperbolicSine = P.asinh = function () {
  38821. var pr, rm,
  38822. x = this,
  38823. Ctor = x.constructor;
  38824. if (!x.isFinite() || x.isZero()) return new Ctor(x);
  38825. pr = Ctor.precision;
  38826. rm = Ctor.rounding;
  38827. Ctor.precision = pr + 2 * Math.max(Math.abs(x.e), x.sd()) + 6;
  38828. Ctor.rounding = 1;
  38829. external = false;
  38830. x = x.times(x).plus(1).sqrt().plus(x);
  38831. external = true;
  38832. Ctor.precision = pr;
  38833. Ctor.rounding = rm;
  38834. return x.ln();
  38835. };
  38836. /*
  38837. * Return a new Decimal whose value is the inverse of the hyperbolic tangent in radians of the
  38838. * value of this Decimal.
  38839. *
  38840. * Domain: [-1, 1]
  38841. * Range: [-Infinity, Infinity]
  38842. *
  38843. * atanh(x) = 0.5 * ln((1 + x) / (1 - x))
  38844. *
  38845. * atanh(|x| > 1) = NaN
  38846. * atanh(NaN) = NaN
  38847. * atanh(Infinity) = NaN
  38848. * atanh(-Infinity) = NaN
  38849. * atanh(0) = 0
  38850. * atanh(-0) = -0
  38851. * atanh(1) = Infinity
  38852. * atanh(-1) = -Infinity
  38853. *
  38854. */
  38855. P.inverseHyperbolicTangent = P.atanh = function () {
  38856. var pr, rm, wpr, xsd,
  38857. x = this,
  38858. Ctor = x.constructor;
  38859. if (!x.isFinite()) return new Ctor(NaN);
  38860. if (x.e >= 0) return new Ctor(x.abs().eq(1) ? x.s / 0 : x.isZero() ? x : NaN);
  38861. pr = Ctor.precision;
  38862. rm = Ctor.rounding;
  38863. xsd = x.sd();
  38864. if (Math.max(xsd, pr) < 2 * -x.e - 1) return finalise(new Ctor(x), pr, rm, true);
  38865. Ctor.precision = wpr = xsd - x.e;
  38866. x = divide(x.plus(1), new Ctor(1).minus(x), wpr + pr, 1);
  38867. Ctor.precision = pr + 4;
  38868. Ctor.rounding = 1;
  38869. x = x.ln();
  38870. Ctor.precision = pr;
  38871. Ctor.rounding = rm;
  38872. return x.times(0.5);
  38873. };
  38874. /*
  38875. * Return a new Decimal whose value is the arcsine (inverse sine) in radians of the value of this
  38876. * Decimal.
  38877. *
  38878. * Domain: [-Infinity, Infinity]
  38879. * Range: [-pi/2, pi/2]
  38880. *
  38881. * asin(x) = 2*atan(x/(1 + sqrt(1 - x^2)))
  38882. *
  38883. * asin(0) = 0
  38884. * asin(-0) = -0
  38885. * asin(1/2) = pi/6
  38886. * asin(-1/2) = -pi/6
  38887. * asin(1) = pi/2
  38888. * asin(-1) = -pi/2
  38889. * asin(|x| > 1) = NaN
  38890. * asin(NaN) = NaN
  38891. *
  38892. * TODO? Compare performance of Taylor series.
  38893. *
  38894. */
  38895. P.inverseSine = P.asin = function () {
  38896. var halfPi, k,
  38897. pr, rm,
  38898. x = this,
  38899. Ctor = x.constructor;
  38900. if (x.isZero()) return new Ctor(x);
  38901. k = x.abs().cmp(1);
  38902. pr = Ctor.precision;
  38903. rm = Ctor.rounding;
  38904. if (k !== -1) {
  38905. // |x| is 1
  38906. if (k === 0) {
  38907. halfPi = getPi(Ctor, pr + 4, rm).times(0.5);
  38908. halfPi.s = x.s;
  38909. return halfPi;
  38910. }
  38911. // |x| > 1 or x is NaN
  38912. return new Ctor(NaN);
  38913. }
  38914. // TODO? Special case asin(1/2) = pi/6 and asin(-1/2) = -pi/6
  38915. Ctor.precision = pr + 6;
  38916. Ctor.rounding = 1;
  38917. x = x.div(new Ctor(1).minus(x.times(x)).sqrt().plus(1)).atan();
  38918. Ctor.precision = pr;
  38919. Ctor.rounding = rm;
  38920. return x.times(2);
  38921. };
  38922. /*
  38923. * Return a new Decimal whose value is the arctangent (inverse tangent) in radians of the value
  38924. * of this Decimal.
  38925. *
  38926. * Domain: [-Infinity, Infinity]
  38927. * Range: [-pi/2, pi/2]
  38928. *
  38929. * atan(x) = x - x^3/3 + x^5/5 - x^7/7 + ...
  38930. *
  38931. * atan(0) = 0
  38932. * atan(-0) = -0
  38933. * atan(1) = pi/4
  38934. * atan(-1) = -pi/4
  38935. * atan(Infinity) = pi/2
  38936. * atan(-Infinity) = -pi/2
  38937. * atan(NaN) = NaN
  38938. *
  38939. */
  38940. P.inverseTangent = P.atan = function () {
  38941. var i, j, k, n, px, t, r, wpr, x2,
  38942. x = this,
  38943. Ctor = x.constructor,
  38944. pr = Ctor.precision,
  38945. rm = Ctor.rounding;
  38946. if (!x.isFinite()) {
  38947. if (!x.s) return new Ctor(NaN);
  38948. if (pr + 4 <= PI_PRECISION) {
  38949. r = getPi(Ctor, pr + 4, rm).times(0.5);
  38950. r.s = x.s;
  38951. return r;
  38952. }
  38953. } else if (x.isZero()) {
  38954. return new Ctor(x);
  38955. } else if (x.abs().eq(1) && pr + 4 <= PI_PRECISION) {
  38956. r = getPi(Ctor, pr + 4, rm).times(0.25);
  38957. r.s = x.s;
  38958. return r;
  38959. }
  38960. Ctor.precision = wpr = pr + 10;
  38961. Ctor.rounding = 1;
  38962. // TODO? if (x >= 1 && pr <= PI_PRECISION) atan(x) = halfPi * x.s - atan(1 / x);
  38963. // Argument reduction
  38964. // Ensure |x| < 0.42
  38965. // atan(x) = 2 * atan(x / (1 + sqrt(1 + x^2)))
  38966. k = Math.min(28, wpr / LOG_BASE + 2 | 0);
  38967. for (i = k; i; --i) x = x.div(x.times(x).plus(1).sqrt().plus(1));
  38968. external = false;
  38969. j = Math.ceil(wpr / LOG_BASE);
  38970. n = 1;
  38971. x2 = x.times(x);
  38972. r = new Ctor(x);
  38973. px = x;
  38974. // atan(x) = x - x^3/3 + x^5/5 - x^7/7 + ...
  38975. for (; i !== -1;) {
  38976. px = px.times(x2);
  38977. t = r.minus(px.div(n += 2));
  38978. px = px.times(x2);
  38979. r = t.plus(px.div(n += 2));
  38980. if (r.d[j] !== void 0) for (i = j; r.d[i] === t.d[i] && i--;);
  38981. }
  38982. if (k) r = r.times(2 << (k - 1));
  38983. external = true;
  38984. return finalise(r, Ctor.precision = pr, Ctor.rounding = rm, true);
  38985. };
  38986. /*
  38987. * Return true if the value of this Decimal is a finite number, otherwise return false.
  38988. *
  38989. */
  38990. P.isFinite = function () {
  38991. return !!this.d;
  38992. };
  38993. /*
  38994. * Return true if the value of this Decimal is an integer, otherwise return false.
  38995. *
  38996. */
  38997. P.isInteger = P.isInt = function () {
  38998. return !!this.d && mathfloor(this.e / LOG_BASE) > this.d.length - 2;
  38999. };
  39000. /*
  39001. * Return true if the value of this Decimal is NaN, otherwise return false.
  39002. *
  39003. */
  39004. P.isNaN = function () {
  39005. return !this.s;
  39006. };
  39007. /*
  39008. * Return true if the value of this Decimal is negative, otherwise return false.
  39009. *
  39010. */
  39011. P.isNegative = P.isNeg = function () {
  39012. return this.s < 0;
  39013. };
  39014. /*
  39015. * Return true if the value of this Decimal is positive, otherwise return false.
  39016. *
  39017. */
  39018. P.isPositive = P.isPos = function () {
  39019. return this.s > 0;
  39020. };
  39021. /*
  39022. * Return true if the value of this Decimal is 0 or -0, otherwise return false.
  39023. *
  39024. */
  39025. P.isZero = function () {
  39026. return !!this.d && this.d[0] === 0;
  39027. };
  39028. /*
  39029. * Return true if the value of this Decimal is less than `y`, otherwise return false.
  39030. *
  39031. */
  39032. P.lessThan = P.lt = function (y) {
  39033. return this.cmp(y) < 0;
  39034. };
  39035. /*
  39036. * Return true if the value of this Decimal is less than or equal to `y`, otherwise return false.
  39037. *
  39038. */
  39039. P.lessThanOrEqualTo = P.lte = function (y) {
  39040. return this.cmp(y) < 1;
  39041. };
  39042. /*
  39043. * Return the logarithm of the value of this Decimal to the specified base, rounded to `precision`
  39044. * significant digits using rounding mode `rounding`.
  39045. *
  39046. * If no base is specified, return log[10](arg).
  39047. *
  39048. * log[base](arg) = ln(arg) / ln(base)
  39049. *
  39050. * The result will always be correctly rounded if the base of the log is 10, and 'almost always'
  39051. * otherwise:
  39052. *
  39053. * Depending on the rounding mode, the result may be incorrectly rounded if the first fifteen
  39054. * rounding digits are [49]99999999999999 or [50]00000000000000. In that case, the maximum error
  39055. * between the result and the correctly rounded result will be one ulp (unit in the last place).
  39056. *
  39057. * log[-b](a) = NaN
  39058. * log[0](a) = NaN
  39059. * log[1](a) = NaN
  39060. * log[NaN](a) = NaN
  39061. * log[Infinity](a) = NaN
  39062. * log[b](0) = -Infinity
  39063. * log[b](-0) = -Infinity
  39064. * log[b](-a) = NaN
  39065. * log[b](1) = 0
  39066. * log[b](Infinity) = Infinity
  39067. * log[b](NaN) = NaN
  39068. *
  39069. * [base] {number|string|Decimal} The base of the logarithm.
  39070. *
  39071. */
  39072. P.logarithm = P.log = function (base) {
  39073. var isBase10, d, denominator, k, inf, num, sd, r,
  39074. arg = this,
  39075. Ctor = arg.constructor,
  39076. pr = Ctor.precision,
  39077. rm = Ctor.rounding,
  39078. guard = 5;
  39079. // Default base is 10.
  39080. if (base == null) {
  39081. base = new Ctor(10);
  39082. isBase10 = true;
  39083. } else {
  39084. base = new Ctor(base);
  39085. d = base.d;
  39086. // Return NaN if base is negative, or non-finite, or is 0 or 1.
  39087. if (base.s < 0 || !d || !d[0] || base.eq(1)) return new Ctor(NaN);
  39088. isBase10 = base.eq(10);
  39089. }
  39090. d = arg.d;
  39091. // Is arg negative, non-finite, 0 or 1?
  39092. if (arg.s < 0 || !d || !d[0] || arg.eq(1)) {
  39093. return new Ctor(d && !d[0] ? -1 / 0 : arg.s != 1 ? NaN : d ? 0 : 1 / 0);
  39094. }
  39095. // The result will have a non-terminating decimal expansion if base is 10 and arg is not an
  39096. // integer power of 10.
  39097. if (isBase10) {
  39098. if (d.length > 1) {
  39099. inf = true;
  39100. } else {
  39101. for (k = d[0]; k % 10 === 0;) k /= 10;
  39102. inf = k !== 1;
  39103. }
  39104. }
  39105. external = false;
  39106. sd = pr + guard;
  39107. num = naturalLogarithm(arg, sd);
  39108. denominator = isBase10 ? getLn10(Ctor, sd + 10) : naturalLogarithm(base, sd);
  39109. // The result will have 5 rounding digits.
  39110. r = divide(num, denominator, sd, 1);
  39111. // If at a rounding boundary, i.e. the result's rounding digits are [49]9999 or [50]0000,
  39112. // calculate 10 further digits.
  39113. //
  39114. // If the result is known to have an infinite decimal expansion, repeat this until it is clear
  39115. // that the result is above or below the boundary. Otherwise, if after calculating the 10
  39116. // further digits, the last 14 are nines, round up and assume the result is exact.
  39117. // Also assume the result is exact if the last 14 are zero.
  39118. //
  39119. // Example of a result that will be incorrectly rounded:
  39120. // log[1048576](4503599627370502) = 2.60000000000000009610279511444746...
  39121. // The above result correctly rounded using ROUND_CEIL to 1 decimal place should be 2.7, but it
  39122. // will be given as 2.6 as there are 15 zeros immediately after the requested decimal place, so
  39123. // the exact result would be assumed to be 2.6, which rounded using ROUND_CEIL to 1 decimal
  39124. // place is still 2.6.
  39125. if (checkRoundingDigits(r.d, k = pr, rm)) {
  39126. do {
  39127. sd += 10;
  39128. num = naturalLogarithm(arg, sd);
  39129. denominator = isBase10 ? getLn10(Ctor, sd + 10) : naturalLogarithm(base, sd);
  39130. r = divide(num, denominator, sd, 1);
  39131. if (!inf) {
  39132. // Check for 14 nines from the 2nd rounding digit, as the first may be 4.
  39133. if (+digitsToString(r.d).slice(k + 1, k + 15) + 1 == 1e14) {
  39134. r = finalise(r, pr + 1, 0);
  39135. }
  39136. break;
  39137. }
  39138. } while (checkRoundingDigits(r.d, k += 10, rm));
  39139. }
  39140. external = true;
  39141. return finalise(r, pr, rm);
  39142. };
  39143. /*
  39144. * Return a new Decimal whose value is the maximum of the arguments and the value of this Decimal.
  39145. *
  39146. * arguments {number|string|Decimal}
  39147. *
  39148. P.max = function () {
  39149. Array.prototype.push.call(arguments, this);
  39150. return maxOrMin(this.constructor, arguments, 'lt');
  39151. };
  39152. */
  39153. /*
  39154. * Return a new Decimal whose value is the minimum of the arguments and the value of this Decimal.
  39155. *
  39156. * arguments {number|string|Decimal}
  39157. *
  39158. P.min = function () {
  39159. Array.prototype.push.call(arguments, this);
  39160. return maxOrMin(this.constructor, arguments, 'gt');
  39161. };
  39162. */
  39163. /*
  39164. * n - 0 = n
  39165. * n - N = N
  39166. * n - I = -I
  39167. * 0 - n = -n
  39168. * 0 - 0 = 0
  39169. * 0 - N = N
  39170. * 0 - I = -I
  39171. * N - n = N
  39172. * N - 0 = N
  39173. * N - N = N
  39174. * N - I = N
  39175. * I - n = I
  39176. * I - 0 = I
  39177. * I - N = N
  39178. * I - I = N
  39179. *
  39180. * Return a new Decimal whose value is the value of this Decimal minus `y`, rounded to `precision`
  39181. * significant digits using rounding mode `rounding`.
  39182. *
  39183. */
  39184. P.minus = P.sub = function (y) {
  39185. var d, e, i, j, k, len, pr, rm, xd, xe, xLTy, yd,
  39186. x = this,
  39187. Ctor = x.constructor;
  39188. y = new Ctor(y);
  39189. // If either is not finite...
  39190. if (!x.d || !y.d) {
  39191. // Return NaN if either is NaN.
  39192. if (!x.s || !y.s) y = new Ctor(NaN);
  39193. // Return y negated if x is finite and y is ±Infinity.
  39194. else if (x.d) y.s = -y.s;
  39195. // Return x if y is finite and x is ±Infinity.
  39196. // Return x if both are ±Infinity with different signs.
  39197. // Return NaN if both are ±Infinity with the same sign.
  39198. else y = new Ctor(y.d || x.s !== y.s ? x : NaN);
  39199. return y;
  39200. }
  39201. // If signs differ...
  39202. if (x.s != y.s) {
  39203. y.s = -y.s;
  39204. return x.plus(y);
  39205. }
  39206. xd = x.d;
  39207. yd = y.d;
  39208. pr = Ctor.precision;
  39209. rm = Ctor.rounding;
  39210. // If either is zero...
  39211. if (!xd[0] || !yd[0]) {
  39212. // Return y negated if x is zero and y is non-zero.
  39213. if (yd[0]) y.s = -y.s;
  39214. // Return x if y is zero and x is non-zero.
  39215. else if (xd[0]) y = new Ctor(x);
  39216. // Return zero if both are zero.
  39217. // From IEEE 754 (2008) 6.3: 0 - 0 = -0 - -0 = -0 when rounding to -Infinity.
  39218. else return new Ctor(rm === 3 ? -0 : 0);
  39219. return external ? finalise(y, pr, rm) : y;
  39220. }
  39221. // x and y are finite, non-zero numbers with the same sign.
  39222. // Calculate base 1e7 exponents.
  39223. e = mathfloor(y.e / LOG_BASE);
  39224. xe = mathfloor(x.e / LOG_BASE);
  39225. xd = xd.slice();
  39226. k = xe - e;
  39227. // If base 1e7 exponents differ...
  39228. if (k) {
  39229. xLTy = k < 0;
  39230. if (xLTy) {
  39231. d = xd;
  39232. k = -k;
  39233. len = yd.length;
  39234. } else {
  39235. d = yd;
  39236. e = xe;
  39237. len = xd.length;
  39238. }
  39239. // Numbers with massively different exponents would result in a very high number of
  39240. // zeros needing to be prepended, but this can be avoided while still ensuring correct
  39241. // rounding by limiting the number of zeros to `Math.ceil(pr / LOG_BASE) + 2`.
  39242. i = Math.max(Math.ceil(pr / LOG_BASE), len) + 2;
  39243. if (k > i) {
  39244. k = i;
  39245. d.length = 1;
  39246. }
  39247. // Prepend zeros to equalise exponents.
  39248. d.reverse();
  39249. for (i = k; i--;) d.push(0);
  39250. d.reverse();
  39251. // Base 1e7 exponents equal.
  39252. } else {
  39253. // Check digits to determine which is the bigger number.
  39254. i = xd.length;
  39255. len = yd.length;
  39256. xLTy = i < len;
  39257. if (xLTy) len = i;
  39258. for (i = 0; i < len; i++) {
  39259. if (xd[i] != yd[i]) {
  39260. xLTy = xd[i] < yd[i];
  39261. break;
  39262. }
  39263. }
  39264. k = 0;
  39265. }
  39266. if (xLTy) {
  39267. d = xd;
  39268. xd = yd;
  39269. yd = d;
  39270. y.s = -y.s;
  39271. }
  39272. len = xd.length;
  39273. // Append zeros to `xd` if shorter.
  39274. // Don't add zeros to `yd` if shorter as subtraction only needs to start at `yd` length.
  39275. for (i = yd.length - len; i > 0; --i) xd[len++] = 0;
  39276. // Subtract yd from xd.
  39277. for (i = yd.length; i > k;) {
  39278. if (xd[--i] < yd[i]) {
  39279. for (j = i; j && xd[--j] === 0;) xd[j] = BASE - 1;
  39280. --xd[j];
  39281. xd[i] += BASE;
  39282. }
  39283. xd[i] -= yd[i];
  39284. }
  39285. // Remove trailing zeros.
  39286. for (; xd[--len] === 0;) xd.pop();
  39287. // Remove leading zeros and adjust exponent accordingly.
  39288. for (; xd[0] === 0; xd.shift()) --e;
  39289. // Zero?
  39290. if (!xd[0]) return new Ctor(rm === 3 ? -0 : 0);
  39291. y.d = xd;
  39292. y.e = getBase10Exponent(xd, e);
  39293. return external ? finalise(y, pr, rm) : y;
  39294. };
  39295. /*
  39296. * n % 0 = N
  39297. * n % N = N
  39298. * n % I = n
  39299. * 0 % n = 0
  39300. * -0 % n = -0
  39301. * 0 % 0 = N
  39302. * 0 % N = N
  39303. * 0 % I = 0
  39304. * N % n = N
  39305. * N % 0 = N
  39306. * N % N = N
  39307. * N % I = N
  39308. * I % n = N
  39309. * I % 0 = N
  39310. * I % N = N
  39311. * I % I = N
  39312. *
  39313. * Return a new Decimal whose value is the value of this Decimal modulo `y`, rounded to
  39314. * `precision` significant digits using rounding mode `rounding`.
  39315. *
  39316. * The result depends on the modulo mode.
  39317. *
  39318. */
  39319. P.modulo = P.mod = function (y) {
  39320. var q,
  39321. x = this,
  39322. Ctor = x.constructor;
  39323. y = new Ctor(y);
  39324. // Return NaN if x is ±Infinity or NaN, or y is NaN or ±0.
  39325. if (!x.d || !y.s || y.d && !y.d[0]) return new Ctor(NaN);
  39326. // Return x if y is ±Infinity or x is ±0.
  39327. if (!y.d || x.d && !x.d[0]) {
  39328. return finalise(new Ctor(x), Ctor.precision, Ctor.rounding);
  39329. }
  39330. // Prevent rounding of intermediate calculations.
  39331. external = false;
  39332. if (Ctor.modulo == 9) {
  39333. // Euclidian division: q = sign(y) * floor(x / abs(y))
  39334. // result = x - q * y where 0 <= result < abs(y)
  39335. q = divide(x, y.abs(), 0, 3, 1);
  39336. q.s *= y.s;
  39337. } else {
  39338. q = divide(x, y, 0, Ctor.modulo, 1);
  39339. }
  39340. q = q.times(y);
  39341. external = true;
  39342. return x.minus(q);
  39343. };
  39344. /*
  39345. * Return a new Decimal whose value is the natural exponential of the value of this Decimal,
  39346. * i.e. the base e raised to the power the value of this Decimal, rounded to `precision`
  39347. * significant digits using rounding mode `rounding`.
  39348. *
  39349. */
  39350. P.naturalExponential = P.exp = function () {
  39351. return naturalExponential(this);
  39352. };
  39353. /*
  39354. * Return a new Decimal whose value is the natural logarithm of the value of this Decimal,
  39355. * rounded to `precision` significant digits using rounding mode `rounding`.
  39356. *
  39357. */
  39358. P.naturalLogarithm = P.ln = function () {
  39359. return naturalLogarithm(this);
  39360. };
  39361. /*
  39362. * Return a new Decimal whose value is the value of this Decimal negated, i.e. as if multiplied by
  39363. * -1.
  39364. *
  39365. */
  39366. P.negated = P.neg = function () {
  39367. var x = new this.constructor(this);
  39368. x.s = -x.s;
  39369. return finalise(x);
  39370. };
  39371. /*
  39372. * n + 0 = n
  39373. * n + N = N
  39374. * n + I = I
  39375. * 0 + n = n
  39376. * 0 + 0 = 0
  39377. * 0 + N = N
  39378. * 0 + I = I
  39379. * N + n = N
  39380. * N + 0 = N
  39381. * N + N = N
  39382. * N + I = N
  39383. * I + n = I
  39384. * I + 0 = I
  39385. * I + N = N
  39386. * I + I = I
  39387. *
  39388. * Return a new Decimal whose value is the value of this Decimal plus `y`, rounded to `precision`
  39389. * significant digits using rounding mode `rounding`.
  39390. *
  39391. */
  39392. P.plus = P.add = function (y) {
  39393. var carry, d, e, i, k, len, pr, rm, xd, yd,
  39394. x = this,
  39395. Ctor = x.constructor;
  39396. y = new Ctor(y);
  39397. // If either is not finite...
  39398. if (!x.d || !y.d) {
  39399. // Return NaN if either is NaN.
  39400. if (!x.s || !y.s) y = new Ctor(NaN);
  39401. // Return x if y is finite and x is ±Infinity.
  39402. // Return x if both are ±Infinity with the same sign.
  39403. // Return NaN if both are ±Infinity with different signs.
  39404. // Return y if x is finite and y is ±Infinity.
  39405. else if (!x.d) y = new Ctor(y.d || x.s === y.s ? x : NaN);
  39406. return y;
  39407. }
  39408. // If signs differ...
  39409. if (x.s != y.s) {
  39410. y.s = -y.s;
  39411. return x.minus(y);
  39412. }
  39413. xd = x.d;
  39414. yd = y.d;
  39415. pr = Ctor.precision;
  39416. rm = Ctor.rounding;
  39417. // If either is zero...
  39418. if (!xd[0] || !yd[0]) {
  39419. // Return x if y is zero.
  39420. // Return y if y is non-zero.
  39421. if (!yd[0]) y = new Ctor(x);
  39422. return external ? finalise(y, pr, rm) : y;
  39423. }
  39424. // x and y are finite, non-zero numbers with the same sign.
  39425. // Calculate base 1e7 exponents.
  39426. k = mathfloor(x.e / LOG_BASE);
  39427. e = mathfloor(y.e / LOG_BASE);
  39428. xd = xd.slice();
  39429. i = k - e;
  39430. // If base 1e7 exponents differ...
  39431. if (i) {
  39432. if (i < 0) {
  39433. d = xd;
  39434. i = -i;
  39435. len = yd.length;
  39436. } else {
  39437. d = yd;
  39438. e = k;
  39439. len = xd.length;
  39440. }
  39441. // Limit number of zeros prepended to max(ceil(pr / LOG_BASE), len) + 1.
  39442. k = Math.ceil(pr / LOG_BASE);
  39443. len = k > len ? k + 1 : len + 1;
  39444. if (i > len) {
  39445. i = len;
  39446. d.length = 1;
  39447. }
  39448. // Prepend zeros to equalise exponents. Note: Faster to use reverse then do unshifts.
  39449. d.reverse();
  39450. for (; i--;) d.push(0);
  39451. d.reverse();
  39452. }
  39453. len = xd.length;
  39454. i = yd.length;
  39455. // If yd is longer than xd, swap xd and yd so xd points to the longer array.
  39456. if (len - i < 0) {
  39457. i = len;
  39458. d = yd;
  39459. yd = xd;
  39460. xd = d;
  39461. }
  39462. // Only start adding at yd.length - 1 as the further digits of xd can be left as they are.
  39463. for (carry = 0; i;) {
  39464. carry = (xd[--i] = xd[i] + yd[i] + carry) / BASE | 0;
  39465. xd[i] %= BASE;
  39466. }
  39467. if (carry) {
  39468. xd.unshift(carry);
  39469. ++e;
  39470. }
  39471. // Remove trailing zeros.
  39472. // No need to check for zero, as +x + +y != 0 && -x + -y != 0
  39473. for (len = xd.length; xd[--len] == 0;) xd.pop();
  39474. y.d = xd;
  39475. y.e = getBase10Exponent(xd, e);
  39476. return external ? finalise(y, pr, rm) : y;
  39477. };
  39478. /*
  39479. * Return the number of significant digits of the value of this Decimal.
  39480. *
  39481. * [z] {boolean|number} Whether to count integer-part trailing zeros: true, false, 1 or 0.
  39482. *
  39483. */
  39484. P.precision = P.sd = function (z) {
  39485. var k,
  39486. x = this;
  39487. if (z !== void 0 && z !== !!z && z !== 1 && z !== 0) throw Error(invalidArgument + z);
  39488. if (x.d) {
  39489. k = getPrecision(x.d);
  39490. if (z && x.e + 1 > k) k = x.e + 1;
  39491. } else {
  39492. k = NaN;
  39493. }
  39494. return k;
  39495. };
  39496. /*
  39497. * Return a new Decimal whose value is the value of this Decimal rounded to a whole number using
  39498. * rounding mode `rounding`.
  39499. *
  39500. */
  39501. P.round = function () {
  39502. var x = this,
  39503. Ctor = x.constructor;
  39504. return finalise(new Ctor(x), x.e + 1, Ctor.rounding);
  39505. };
  39506. /*
  39507. * Return a new Decimal whose value is the sine of the value in radians of this Decimal.
  39508. *
  39509. * Domain: [-Infinity, Infinity]
  39510. * Range: [-1, 1]
  39511. *
  39512. * sin(x) = x - x^3/3! + x^5/5! - ...
  39513. *
  39514. * sin(0) = 0
  39515. * sin(-0) = -0
  39516. * sin(Infinity) = NaN
  39517. * sin(-Infinity) = NaN
  39518. * sin(NaN) = NaN
  39519. *
  39520. */
  39521. P.sine = P.sin = function () {
  39522. var pr, rm,
  39523. x = this,
  39524. Ctor = x.constructor;
  39525. if (!x.isFinite()) return new Ctor(NaN);
  39526. if (x.isZero()) return new Ctor(x);
  39527. pr = Ctor.precision;
  39528. rm = Ctor.rounding;
  39529. Ctor.precision = pr + Math.max(x.e, x.sd()) + LOG_BASE;
  39530. Ctor.rounding = 1;
  39531. x = sine(Ctor, toLessThanHalfPi(Ctor, x));
  39532. Ctor.precision = pr;
  39533. Ctor.rounding = rm;
  39534. return finalise(quadrant > 2 ? x.neg() : x, pr, rm, true);
  39535. };
  39536. /*
  39537. * Return a new Decimal whose value is the square root of this Decimal, rounded to `precision`
  39538. * significant digits using rounding mode `rounding`.
  39539. *
  39540. * sqrt(-n) = N
  39541. * sqrt(N) = N
  39542. * sqrt(-I) = N
  39543. * sqrt(I) = I
  39544. * sqrt(0) = 0
  39545. * sqrt(-0) = -0
  39546. *
  39547. */
  39548. P.squareRoot = P.sqrt = function () {
  39549. var m, n, sd, r, rep, t,
  39550. x = this,
  39551. d = x.d,
  39552. e = x.e,
  39553. s = x.s,
  39554. Ctor = x.constructor;
  39555. // Negative/NaN/Infinity/zero?
  39556. if (s !== 1 || !d || !d[0]) {
  39557. return new Ctor(!s || s < 0 && (!d || d[0]) ? NaN : d ? x : 1 / 0);
  39558. }
  39559. external = false;
  39560. // Initial estimate.
  39561. s = Math.sqrt(+x);
  39562. // Math.sqrt underflow/overflow?
  39563. // Pass x to Math.sqrt as integer, then adjust the exponent of the result.
  39564. if (s == 0 || s == 1 / 0) {
  39565. n = digitsToString(d);
  39566. if ((n.length + e) % 2 == 0) n += '0';
  39567. s = Math.sqrt(n);
  39568. e = mathfloor((e + 1) / 2) - (e < 0 || e % 2);
  39569. if (s == 1 / 0) {
  39570. n = '1e' + e;
  39571. } else {
  39572. n = s.toExponential();
  39573. n = n.slice(0, n.indexOf('e') + 1) + e;
  39574. }
  39575. r = new Ctor(n);
  39576. } else {
  39577. r = new Ctor(s.toString());
  39578. }
  39579. sd = (e = Ctor.precision) + 3;
  39580. // Newton-Raphson iteration.
  39581. for (;;) {
  39582. t = r;
  39583. r = t.plus(divide(x, t, sd + 2, 1)).times(0.5);
  39584. // TODO? Replace with for-loop and checkRoundingDigits.
  39585. if (digitsToString(t.d).slice(0, sd) === (n = digitsToString(r.d)).slice(0, sd)) {
  39586. n = n.slice(sd - 3, sd + 1);
  39587. // The 4th rounding digit may be in error by -1 so if the 4 rounding digits are 9999 or
  39588. // 4999, i.e. approaching a rounding boundary, continue the iteration.
  39589. if (n == '9999' || !rep && n == '4999') {
  39590. // On the first iteration only, check to see if rounding up gives the exact result as the
  39591. // nines may infinitely repeat.
  39592. if (!rep) {
  39593. finalise(t, e + 1, 0);
  39594. if (t.times(t).eq(x)) {
  39595. r = t;
  39596. break;
  39597. }
  39598. }
  39599. sd += 4;
  39600. rep = 1;
  39601. } else {
  39602. // If the rounding digits are null, 0{0,4} or 50{0,3}, check for an exact result.
  39603. // If not, then there are further digits and m will be truthy.
  39604. if (!+n || !+n.slice(1) && n.charAt(0) == '5') {
  39605. // Truncate to the first rounding digit.
  39606. finalise(r, e + 1, 1);
  39607. m = !r.times(r).eq(x);
  39608. }
  39609. break;
  39610. }
  39611. }
  39612. }
  39613. external = true;
  39614. return finalise(r, e, Ctor.rounding, m);
  39615. };
  39616. /*
  39617. * Return a new Decimal whose value is the tangent of the value in radians of this Decimal.
  39618. *
  39619. * Domain: [-Infinity, Infinity]
  39620. * Range: [-Infinity, Infinity]
  39621. *
  39622. * tan(0) = 0
  39623. * tan(-0) = -0
  39624. * tan(Infinity) = NaN
  39625. * tan(-Infinity) = NaN
  39626. * tan(NaN) = NaN
  39627. *
  39628. */
  39629. P.tangent = P.tan = function () {
  39630. var pr, rm,
  39631. x = this,
  39632. Ctor = x.constructor;
  39633. if (!x.isFinite()) return new Ctor(NaN);
  39634. if (x.isZero()) return new Ctor(x);
  39635. pr = Ctor.precision;
  39636. rm = Ctor.rounding;
  39637. Ctor.precision = pr + 10;
  39638. Ctor.rounding = 1;
  39639. x = x.sin();
  39640. x.s = 1;
  39641. x = divide(x, new Ctor(1).minus(x.times(x)).sqrt(), pr + 10, 0);
  39642. Ctor.precision = pr;
  39643. Ctor.rounding = rm;
  39644. return finalise(quadrant == 2 || quadrant == 4 ? x.neg() : x, pr, rm, true);
  39645. };
  39646. /*
  39647. * n * 0 = 0
  39648. * n * N = N
  39649. * n * I = I
  39650. * 0 * n = 0
  39651. * 0 * 0 = 0
  39652. * 0 * N = N
  39653. * 0 * I = N
  39654. * N * n = N
  39655. * N * 0 = N
  39656. * N * N = N
  39657. * N * I = N
  39658. * I * n = I
  39659. * I * 0 = N
  39660. * I * N = N
  39661. * I * I = I
  39662. *
  39663. * Return a new Decimal whose value is this Decimal times `y`, rounded to `precision` significant
  39664. * digits using rounding mode `rounding`.
  39665. *
  39666. */
  39667. P.times = P.mul = function (y) {
  39668. var carry, e, i, k, r, rL, t, xdL, ydL,
  39669. x = this,
  39670. Ctor = x.constructor,
  39671. xd = x.d,
  39672. yd = (y = new Ctor(y)).d;
  39673. y.s *= x.s;
  39674. // If either is NaN, ±Infinity or ±0...
  39675. if (!xd || !xd[0] || !yd || !yd[0]) {
  39676. return new Ctor(!y.s || xd && !xd[0] && !yd || yd && !yd[0] && !xd
  39677. // Return NaN if either is NaN.
  39678. // Return NaN if x is ±0 and y is ±Infinity, or y is ±0 and x is ±Infinity.
  39679. ? NaN
  39680. // Return ±Infinity if either is ±Infinity.
  39681. // Return ±0 if either is ±0.
  39682. : !xd || !yd ? y.s / 0 : y.s * 0);
  39683. }
  39684. e = mathfloor(x.e / LOG_BASE) + mathfloor(y.e / LOG_BASE);
  39685. xdL = xd.length;
  39686. ydL = yd.length;
  39687. // Ensure xd points to the longer array.
  39688. if (xdL < ydL) {
  39689. r = xd;
  39690. xd = yd;
  39691. yd = r;
  39692. rL = xdL;
  39693. xdL = ydL;
  39694. ydL = rL;
  39695. }
  39696. // Initialise the result array with zeros.
  39697. r = [];
  39698. rL = xdL + ydL;
  39699. for (i = rL; i--;) r.push(0);
  39700. // Multiply!
  39701. for (i = ydL; --i >= 0;) {
  39702. carry = 0;
  39703. for (k = xdL + i; k > i;) {
  39704. t = r[k] + yd[i] * xd[k - i - 1] + carry;
  39705. r[k--] = t % BASE | 0;
  39706. carry = t / BASE | 0;
  39707. }
  39708. r[k] = (r[k] + carry) % BASE | 0;
  39709. }
  39710. // Remove trailing zeros.
  39711. for (; !r[--rL];) r.pop();
  39712. if (carry) ++e;
  39713. else r.shift();
  39714. y.d = r;
  39715. y.e = getBase10Exponent(r, e);
  39716. return external ? finalise(y, Ctor.precision, Ctor.rounding) : y;
  39717. };
  39718. /*
  39719. * Return a string representing the value of this Decimal in base 2, round to `sd` significant
  39720. * digits using rounding mode `rm`.
  39721. *
  39722. * If the optional `sd` argument is present then return binary exponential notation.
  39723. *
  39724. * [sd] {number} Significant digits. Integer, 1 to MAX_DIGITS inclusive.
  39725. * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.
  39726. *
  39727. */
  39728. P.toBinary = function (sd, rm) {
  39729. return toStringBinary(this, 2, sd, rm);
  39730. };
  39731. /*
  39732. * Return a new Decimal whose value is the value of this Decimal rounded to a maximum of `dp`
  39733. * decimal places using rounding mode `rm` or `rounding` if `rm` is omitted.
  39734. *
  39735. * If `dp` is omitted, return a new Decimal whose value is the value of this Decimal.
  39736. *
  39737. * [dp] {number} Decimal places. Integer, 0 to MAX_DIGITS inclusive.
  39738. * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.
  39739. *
  39740. */
  39741. P.toDecimalPlaces = P.toDP = function (dp, rm) {
  39742. var x = this,
  39743. Ctor = x.constructor;
  39744. x = new Ctor(x);
  39745. if (dp === void 0) return x;
  39746. checkInt32(dp, 0, MAX_DIGITS);
  39747. if (rm === void 0) rm = Ctor.rounding;
  39748. else checkInt32(rm, 0, 8);
  39749. return finalise(x, dp + x.e + 1, rm);
  39750. };
  39751. /*
  39752. * Return a string representing the value of this Decimal in exponential notation rounded to
  39753. * `dp` fixed decimal places using rounding mode `rounding`.
  39754. *
  39755. * [dp] {number} Decimal places. Integer, 0 to MAX_DIGITS inclusive.
  39756. * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.
  39757. *
  39758. */
  39759. P.toExponential = function (dp, rm) {
  39760. var str,
  39761. x = this,
  39762. Ctor = x.constructor;
  39763. if (dp === void 0) {
  39764. str = finiteToString(x, true);
  39765. } else {
  39766. checkInt32(dp, 0, MAX_DIGITS);
  39767. if (rm === void 0) rm = Ctor.rounding;
  39768. else checkInt32(rm, 0, 8);
  39769. x = finalise(new Ctor(x), dp + 1, rm);
  39770. str = finiteToString(x, true, dp + 1);
  39771. }
  39772. return x.isNeg() && !x.isZero() ? '-' + str : str;
  39773. };
  39774. /*
  39775. * Return a string representing the value of this Decimal in normal (fixed-point) notation to
  39776. * `dp` fixed decimal places and rounded using rounding mode `rm` or `rounding` if `rm` is
  39777. * omitted.
  39778. *
  39779. * As with JavaScript numbers, (-0).toFixed(0) is '0', but e.g. (-0.00001).toFixed(0) is '-0'.
  39780. *
  39781. * [dp] {number} Decimal places. Integer, 0 to MAX_DIGITS inclusive.
  39782. * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.
  39783. *
  39784. * (-0).toFixed(0) is '0', but (-0.1).toFixed(0) is '-0'.
  39785. * (-0).toFixed(1) is '0.0', but (-0.01).toFixed(1) is '-0.0'.
  39786. * (-0).toFixed(3) is '0.000'.
  39787. * (-0.5).toFixed(0) is '-0'.
  39788. *
  39789. */
  39790. P.toFixed = function (dp, rm) {
  39791. var str, y,
  39792. x = this,
  39793. Ctor = x.constructor;
  39794. if (dp === void 0) {
  39795. str = finiteToString(x);
  39796. } else {
  39797. checkInt32(dp, 0, MAX_DIGITS);
  39798. if (rm === void 0) rm = Ctor.rounding;
  39799. else checkInt32(rm, 0, 8);
  39800. y = finalise(new Ctor(x), dp + x.e + 1, rm);
  39801. str = finiteToString(y, false, dp + y.e + 1);
  39802. }
  39803. // To determine whether to add the minus sign look at the value before it was rounded,
  39804. // i.e. look at `x` rather than `y`.
  39805. return x.isNeg() && !x.isZero() ? '-' + str : str;
  39806. };
  39807. /*
  39808. * Return an array representing the value of this Decimal as a simple fraction with an integer
  39809. * numerator and an integer denominator.
  39810. *
  39811. * The denominator will be a positive non-zero value less than or equal to the specified maximum
  39812. * denominator. If a maximum denominator is not specified, the denominator will be the lowest
  39813. * value necessary to represent the number exactly.
  39814. *
  39815. * [maxD] {number|string|Decimal} Maximum denominator. Integer >= 1 and < Infinity.
  39816. *
  39817. */
  39818. P.toFraction = function (maxD) {
  39819. var d, d0, d1, d2, e, k, n, n0, n1, pr, q, r,
  39820. x = this,
  39821. xd = x.d,
  39822. Ctor = x.constructor;
  39823. if (!xd) return new Ctor(x);
  39824. n1 = d0 = new Ctor(1);
  39825. d1 = n0 = new Ctor(0);
  39826. d = new Ctor(d1);
  39827. e = d.e = getPrecision(xd) - x.e - 1;
  39828. k = e % LOG_BASE;
  39829. d.d[0] = mathpow(10, k < 0 ? LOG_BASE + k : k);
  39830. if (maxD == null) {
  39831. // d is 10**e, the minimum max-denominator needed.
  39832. maxD = e > 0 ? d : n1;
  39833. } else {
  39834. n = new Ctor(maxD);
  39835. if (!n.isInt() || n.lt(n1)) throw Error(invalidArgument + n);
  39836. maxD = n.gt(d) ? (e > 0 ? d : n1) : n;
  39837. }
  39838. external = false;
  39839. n = new Ctor(digitsToString(xd));
  39840. pr = Ctor.precision;
  39841. Ctor.precision = e = xd.length * LOG_BASE * 2;
  39842. for (;;) {
  39843. q = divide(n, d, 0, 1, 1);
  39844. d2 = d0.plus(q.times(d1));
  39845. if (d2.cmp(maxD) == 1) break;
  39846. d0 = d1;
  39847. d1 = d2;
  39848. d2 = n1;
  39849. n1 = n0.plus(q.times(d2));
  39850. n0 = d2;
  39851. d2 = d;
  39852. d = n.minus(q.times(d2));
  39853. n = d2;
  39854. }
  39855. d2 = divide(maxD.minus(d0), d1, 0, 1, 1);
  39856. n0 = n0.plus(d2.times(n1));
  39857. d0 = d0.plus(d2.times(d1));
  39858. n0.s = n1.s = x.s;
  39859. // Determine which fraction is closer to x, n0/d0 or n1/d1?
  39860. r = divide(n1, d1, e, 1).minus(x).abs().cmp(divide(n0, d0, e, 1).minus(x).abs()) < 1
  39861. ? [n1, d1] : [n0, d0];
  39862. Ctor.precision = pr;
  39863. external = true;
  39864. return r;
  39865. };
  39866. /*
  39867. * Return a string representing the value of this Decimal in base 16, round to `sd` significant
  39868. * digits using rounding mode `rm`.
  39869. *
  39870. * If the optional `sd` argument is present then return binary exponential notation.
  39871. *
  39872. * [sd] {number} Significant digits. Integer, 1 to MAX_DIGITS inclusive.
  39873. * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.
  39874. *
  39875. */
  39876. P.toHexadecimal = P.toHex = function (sd, rm) {
  39877. return toStringBinary(this, 16, sd, rm);
  39878. };
  39879. /*
  39880. * Returns a new Decimal whose value is the nearest multiple of `y` in the direction of rounding
  39881. * mode `rm`, or `Decimal.rounding` if `rm` is omitted, to the value of this Decimal.
  39882. *
  39883. * The return value will always have the same sign as this Decimal, unless either this Decimal
  39884. * or `y` is NaN, in which case the return value will be also be NaN.
  39885. *
  39886. * The return value is not affected by the value of `precision`.
  39887. *
  39888. * y {number|string|Decimal} The magnitude to round to a multiple of.
  39889. * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.
  39890. *
  39891. * 'toNearest() rounding mode not an integer: {rm}'
  39892. * 'toNearest() rounding mode out of range: {rm}'
  39893. *
  39894. */
  39895. P.toNearest = function (y, rm) {
  39896. var x = this,
  39897. Ctor = x.constructor;
  39898. x = new Ctor(x);
  39899. if (y == null) {
  39900. // If x is not finite, return x.
  39901. if (!x.d) return x;
  39902. y = new Ctor(1);
  39903. rm = Ctor.rounding;
  39904. } else {
  39905. y = new Ctor(y);
  39906. if (rm === void 0) {
  39907. rm = Ctor.rounding;
  39908. } else {
  39909. checkInt32(rm, 0, 8);
  39910. }
  39911. // If x is not finite, return x if y is not NaN, else NaN.
  39912. if (!x.d) return y.s ? x : y;
  39913. // If y is not finite, return Infinity with the sign of x if y is Infinity, else NaN.
  39914. if (!y.d) {
  39915. if (y.s) y.s = x.s;
  39916. return y;
  39917. }
  39918. }
  39919. // If y is not zero, calculate the nearest multiple of y to x.
  39920. if (y.d[0]) {
  39921. external = false;
  39922. x = divide(x, y, 0, rm, 1).times(y);
  39923. external = true;
  39924. finalise(x);
  39925. // If y is zero, return zero with the sign of x.
  39926. } else {
  39927. y.s = x.s;
  39928. x = y;
  39929. }
  39930. return x;
  39931. };
  39932. /*
  39933. * Return the value of this Decimal converted to a number primitive.
  39934. * Zero keeps its sign.
  39935. *
  39936. */
  39937. P.toNumber = function () {
  39938. return +this;
  39939. };
  39940. /*
  39941. * Return a string representing the value of this Decimal in base 8, round to `sd` significant
  39942. * digits using rounding mode `rm`.
  39943. *
  39944. * If the optional `sd` argument is present then return binary exponential notation.
  39945. *
  39946. * [sd] {number} Significant digits. Integer, 1 to MAX_DIGITS inclusive.
  39947. * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.
  39948. *
  39949. */
  39950. P.toOctal = function (sd, rm) {
  39951. return toStringBinary(this, 8, sd, rm);
  39952. };
  39953. /*
  39954. * Return a new Decimal whose value is the value of this Decimal raised to the power `y`, rounded
  39955. * to `precision` significant digits using rounding mode `rounding`.
  39956. *
  39957. * ECMAScript compliant.
  39958. *
  39959. * pow(x, NaN) = NaN
  39960. * pow(x, ±0) = 1
  39961. * pow(NaN, non-zero) = NaN
  39962. * pow(abs(x) > 1, +Infinity) = +Infinity
  39963. * pow(abs(x) > 1, -Infinity) = +0
  39964. * pow(abs(x) == 1, ±Infinity) = NaN
  39965. * pow(abs(x) < 1, +Infinity) = +0
  39966. * pow(abs(x) < 1, -Infinity) = +Infinity
  39967. * pow(+Infinity, y > 0) = +Infinity
  39968. * pow(+Infinity, y < 0) = +0
  39969. * pow(-Infinity, odd integer > 0) = -Infinity
  39970. * pow(-Infinity, even integer > 0) = +Infinity
  39971. * pow(-Infinity, odd integer < 0) = -0
  39972. * pow(-Infinity, even integer < 0) = +0
  39973. * pow(+0, y > 0) = +0
  39974. * pow(+0, y < 0) = +Infinity
  39975. * pow(-0, odd integer > 0) = -0
  39976. * pow(-0, even integer > 0) = +0
  39977. * pow(-0, odd integer < 0) = -Infinity
  39978. * pow(-0, even integer < 0) = +Infinity
  39979. * pow(finite x < 0, finite non-integer) = NaN
  39980. *
  39981. * For non-integer or very large exponents pow(x, y) is calculated using
  39982. *
  39983. * x^y = exp(y*ln(x))
  39984. *
  39985. * Assuming the first 15 rounding digits are each equally likely to be any digit 0-9, the
  39986. * probability of an incorrectly rounded result
  39987. * P([49]9{14} | [50]0{14}) = 2 * 0.2 * 10^-14 = 4e-15 = 1/2.5e+14
  39988. * i.e. 1 in 250,000,000,000,000
  39989. *
  39990. * If a result is incorrectly rounded the maximum error will be 1 ulp (unit in last place).
  39991. *
  39992. * y {number|string|Decimal} The power to which to raise this Decimal.
  39993. *
  39994. */
  39995. P.toPower = P.pow = function (y) {
  39996. var e, k, pr, r, rm, s,
  39997. x = this,
  39998. Ctor = x.constructor,
  39999. yn = +(y = new Ctor(y));
  40000. // Either ±Infinity, NaN or ±0?
  40001. if (!x.d || !y.d || !x.d[0] || !y.d[0]) return new Ctor(mathpow(+x, yn));
  40002. x = new Ctor(x);
  40003. if (x.eq(1)) return x;
  40004. pr = Ctor.precision;
  40005. rm = Ctor.rounding;
  40006. if (y.eq(1)) return finalise(x, pr, rm);
  40007. // y exponent
  40008. e = mathfloor(y.e / LOG_BASE);
  40009. // If y is a small integer use the 'exponentiation by squaring' algorithm.
  40010. if (e >= y.d.length - 1 && (k = yn < 0 ? -yn : yn) <= MAX_SAFE_INTEGER) {
  40011. r = intPow(Ctor, x, k, pr);
  40012. return y.s < 0 ? new Ctor(1).div(r) : finalise(r, pr, rm);
  40013. }
  40014. s = x.s;
  40015. // if x is negative
  40016. if (s < 0) {
  40017. // if y is not an integer
  40018. if (e < y.d.length - 1) return new Ctor(NaN);
  40019. // Result is positive if x is negative and the last digit of integer y is even.
  40020. if ((y.d[e] & 1) == 0) s = 1;
  40021. // if x.eq(-1)
  40022. if (x.e == 0 && x.d[0] == 1 && x.d.length == 1) {
  40023. x.s = s;
  40024. return x;
  40025. }
  40026. }
  40027. // Estimate result exponent.
  40028. // x^y = 10^e, where e = y * log10(x)
  40029. // log10(x) = log10(x_significand) + x_exponent
  40030. // log10(x_significand) = ln(x_significand) / ln(10)
  40031. k = mathpow(+x, yn);
  40032. e = k == 0 || !isFinite(k)
  40033. ? mathfloor(yn * (Math.log('0.' + digitsToString(x.d)) / Math.LN10 + x.e + 1))
  40034. : new Ctor(k + '').e;
  40035. // Exponent estimate may be incorrect e.g. x: 0.999999999999999999, y: 2.29, e: 0, r.e: -1.
  40036. // Overflow/underflow?
  40037. if (e > Ctor.maxE + 1 || e < Ctor.minE - 1) return new Ctor(e > 0 ? s / 0 : 0);
  40038. external = false;
  40039. Ctor.rounding = x.s = 1;
  40040. // Estimate the extra guard digits needed to ensure five correct rounding digits from
  40041. // naturalLogarithm(x). Example of failure without these extra digits (precision: 10):
  40042. // new Decimal(2.32456).pow('2087987436534566.46411')
  40043. // should be 1.162377823e+764914905173815, but is 1.162355823e+764914905173815
  40044. k = Math.min(12, (e + '').length);
  40045. // r = x^y = exp(y*ln(x))
  40046. r = naturalExponential(y.times(naturalLogarithm(x, pr + k)), pr);
  40047. // r may be Infinity, e.g. (0.9999999999999999).pow(-1e+40)
  40048. if (r.d) {
  40049. // Truncate to the required precision plus five rounding digits.
  40050. r = finalise(r, pr + 5, 1);
  40051. // If the rounding digits are [49]9999 or [50]0000 increase the precision by 10 and recalculate
  40052. // the result.
  40053. if (checkRoundingDigits(r.d, pr, rm)) {
  40054. e = pr + 10;
  40055. // Truncate to the increased precision plus five rounding digits.
  40056. r = finalise(naturalExponential(y.times(naturalLogarithm(x, e + k)), e), e + 5, 1);
  40057. // Check for 14 nines from the 2nd rounding digit (the first rounding digit may be 4 or 9).
  40058. if (+digitsToString(r.d).slice(pr + 1, pr + 15) + 1 == 1e14) {
  40059. r = finalise(r, pr + 1, 0);
  40060. }
  40061. }
  40062. }
  40063. r.s = s;
  40064. external = true;
  40065. Ctor.rounding = rm;
  40066. return finalise(r, pr, rm);
  40067. };
  40068. /*
  40069. * Return a string representing the value of this Decimal rounded to `sd` significant digits
  40070. * using rounding mode `rounding`.
  40071. *
  40072. * Return exponential notation if `sd` is less than the number of digits necessary to represent
  40073. * the integer part of the value in normal notation.
  40074. *
  40075. * [sd] {number} Significant digits. Integer, 1 to MAX_DIGITS inclusive.
  40076. * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.
  40077. *
  40078. */
  40079. P.toPrecision = function (sd, rm) {
  40080. var str,
  40081. x = this,
  40082. Ctor = x.constructor;
  40083. if (sd === void 0) {
  40084. str = finiteToString(x, x.e <= Ctor.toExpNeg || x.e >= Ctor.toExpPos);
  40085. } else {
  40086. checkInt32(sd, 1, MAX_DIGITS);
  40087. if (rm === void 0) rm = Ctor.rounding;
  40088. else checkInt32(rm, 0, 8);
  40089. x = finalise(new Ctor(x), sd, rm);
  40090. str = finiteToString(x, sd <= x.e || x.e <= Ctor.toExpNeg, sd);
  40091. }
  40092. return x.isNeg() && !x.isZero() ? '-' + str : str;
  40093. };
  40094. /*
  40095. * Return a new Decimal whose value is the value of this Decimal rounded to a maximum of `sd`
  40096. * significant digits using rounding mode `rm`, or to `precision` and `rounding` respectively if
  40097. * omitted.
  40098. *
  40099. * [sd] {number} Significant digits. Integer, 1 to MAX_DIGITS inclusive.
  40100. * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.
  40101. *
  40102. * 'toSD() digits out of range: {sd}'
  40103. * 'toSD() digits not an integer: {sd}'
  40104. * 'toSD() rounding mode not an integer: {rm}'
  40105. * 'toSD() rounding mode out of range: {rm}'
  40106. *
  40107. */
  40108. P.toSignificantDigits = P.toSD = function (sd, rm) {
  40109. var x = this,
  40110. Ctor = x.constructor;
  40111. if (sd === void 0) {
  40112. sd = Ctor.precision;
  40113. rm = Ctor.rounding;
  40114. } else {
  40115. checkInt32(sd, 1, MAX_DIGITS);
  40116. if (rm === void 0) rm = Ctor.rounding;
  40117. else checkInt32(rm, 0, 8);
  40118. }
  40119. return finalise(new Ctor(x), sd, rm);
  40120. };
  40121. /*
  40122. * Return a string representing the value of this Decimal.
  40123. *
  40124. * Return exponential notation if this Decimal has a positive exponent equal to or greater than
  40125. * `toExpPos`, or a negative exponent equal to or less than `toExpNeg`.
  40126. *
  40127. */
  40128. P.toString = function () {
  40129. var x = this,
  40130. Ctor = x.constructor,
  40131. str = finiteToString(x, x.e <= Ctor.toExpNeg || x.e >= Ctor.toExpPos);
  40132. return x.isNeg() && !x.isZero() ? '-' + str : str;
  40133. };
  40134. /*
  40135. * Return a new Decimal whose value is the value of this Decimal truncated to a whole number.
  40136. *
  40137. */
  40138. P.truncated = P.trunc = function () {
  40139. return finalise(new this.constructor(this), this.e + 1, 1);
  40140. };
  40141. /*
  40142. * Return a string representing the value of this Decimal.
  40143. * Unlike `toString`, negative zero will include the minus sign.
  40144. *
  40145. */
  40146. P.valueOf = P.toJSON = function () {
  40147. var x = this,
  40148. Ctor = x.constructor,
  40149. str = finiteToString(x, x.e <= Ctor.toExpNeg || x.e >= Ctor.toExpPos);
  40150. return x.isNeg() ? '-' + str : str;
  40151. };
  40152. /*
  40153. // Add aliases to match BigDecimal method names.
  40154. // P.add = P.plus;
  40155. P.subtract = P.minus;
  40156. P.multiply = P.times;
  40157. P.divide = P.div;
  40158. P.remainder = P.mod;
  40159. P.compareTo = P.cmp;
  40160. P.negate = P.neg;
  40161. */
  40162. // Helper functions for Decimal.prototype (P) and/or Decimal methods, and their callers.
  40163. /*
  40164. * digitsToString P.cubeRoot, P.logarithm, P.squareRoot, P.toFraction, P.toPower,
  40165. * finiteToString, naturalExponential, naturalLogarithm
  40166. * checkInt32 P.toDecimalPlaces, P.toExponential, P.toFixed, P.toNearest,
  40167. * P.toPrecision, P.toSignificantDigits, toStringBinary, random
  40168. * checkRoundingDigits P.logarithm, P.toPower, naturalExponential, naturalLogarithm
  40169. * convertBase toStringBinary, parseOther
  40170. * cos P.cos
  40171. * divide P.atanh, P.cubeRoot, P.dividedBy, P.dividedToIntegerBy,
  40172. * P.logarithm, P.modulo, P.squareRoot, P.tan, P.tanh, P.toFraction,
  40173. * P.toNearest, toStringBinary, naturalExponential, naturalLogarithm,
  40174. * taylorSeries, atan2, parseOther
  40175. * finalise P.absoluteValue, P.atan, P.atanh, P.ceil, P.cos, P.cosh,
  40176. * P.cubeRoot, P.dividedToIntegerBy, P.floor, P.logarithm, P.minus,
  40177. * P.modulo, P.negated, P.plus, P.round, P.sin, P.sinh, P.squareRoot,
  40178. * P.tan, P.times, P.toDecimalPlaces, P.toExponential, P.toFixed,
  40179. * P.toNearest, P.toPower, P.toPrecision, P.toSignificantDigits,
  40180. * P.truncated, divide, getLn10, getPi, naturalExponential,
  40181. * naturalLogarithm, ceil, floor, round, trunc
  40182. * finiteToString P.toExponential, P.toFixed, P.toPrecision, P.toString, P.valueOf,
  40183. * toStringBinary
  40184. * getBase10Exponent P.minus, P.plus, P.times, parseOther
  40185. * getLn10 P.logarithm, naturalLogarithm
  40186. * getPi P.acos, P.asin, P.atan, toLessThanHalfPi, atan2
  40187. * getPrecision P.precision, P.toFraction
  40188. * getZeroString digitsToString, finiteToString
  40189. * intPow P.toPower, parseOther
  40190. * isOdd toLessThanHalfPi
  40191. * maxOrMin max, min
  40192. * naturalExponential P.naturalExponential, P.toPower
  40193. * naturalLogarithm P.acosh, P.asinh, P.atanh, P.logarithm, P.naturalLogarithm,
  40194. * P.toPower, naturalExponential
  40195. * nonFiniteToString finiteToString, toStringBinary
  40196. * parseDecimal Decimal
  40197. * parseOther Decimal
  40198. * sin P.sin
  40199. * taylorSeries P.cosh, P.sinh, cos, sin
  40200. * toLessThanHalfPi P.cos, P.sin
  40201. * toStringBinary P.toBinary, P.toHexadecimal, P.toOctal
  40202. * truncate intPow
  40203. *
  40204. * Throws: P.logarithm, P.precision, P.toFraction, checkInt32, getLn10, getPi,
  40205. * naturalLogarithm, config, parseOther, random, Decimal
  40206. */
  40207. function digitsToString(d) {
  40208. var i, k, ws,
  40209. indexOfLastWord = d.length - 1,
  40210. str = '',
  40211. w = d[0];
  40212. if (indexOfLastWord > 0) {
  40213. str += w;
  40214. for (i = 1; i < indexOfLastWord; i++) {
  40215. ws = d[i] + '';
  40216. k = LOG_BASE - ws.length;
  40217. if (k) str += getZeroString(k);
  40218. str += ws;
  40219. }
  40220. w = d[i];
  40221. ws = w + '';
  40222. k = LOG_BASE - ws.length;
  40223. if (k) str += getZeroString(k);
  40224. } else if (w === 0) {
  40225. return '0';
  40226. }
  40227. // Remove trailing zeros of last w.
  40228. for (; w % 10 === 0;) w /= 10;
  40229. return str + w;
  40230. }
  40231. function checkInt32(i, min, max) {
  40232. if (i !== ~~i || i < min || i > max) {
  40233. throw Error(invalidArgument + i);
  40234. }
  40235. }
  40236. /*
  40237. * Check 5 rounding digits if `repeating` is null, 4 otherwise.
  40238. * `repeating == null` if caller is `log` or `pow`,
  40239. * `repeating != null` if caller is `naturalLogarithm` or `naturalExponential`.
  40240. */
  40241. function checkRoundingDigits(d, i, rm, repeating) {
  40242. var di, k, r, rd;
  40243. // Get the length of the first word of the array d.
  40244. for (k = d[0]; k >= 10; k /= 10) --i;
  40245. // Is the rounding digit in the first word of d?
  40246. if (--i < 0) {
  40247. i += LOG_BASE;
  40248. di = 0;
  40249. } else {
  40250. di = Math.ceil((i + 1) / LOG_BASE);
  40251. i %= LOG_BASE;
  40252. }
  40253. // i is the index (0 - 6) of the rounding digit.
  40254. // E.g. if within the word 3487563 the first rounding digit is 5,
  40255. // then i = 4, k = 1000, rd = 3487563 % 1000 = 563
  40256. k = mathpow(10, LOG_BASE - i);
  40257. rd = d[di] % k | 0;
  40258. if (repeating == null) {
  40259. if (i < 3) {
  40260. if (i == 0) rd = rd / 100 | 0;
  40261. else if (i == 1) rd = rd / 10 | 0;
  40262. r = rm < 4 && rd == 99999 || rm > 3 && rd == 49999 || rd == 50000 || rd == 0;
  40263. } else {
  40264. r = (rm < 4 && rd + 1 == k || rm > 3 && rd + 1 == k / 2) &&
  40265. (d[di + 1] / k / 100 | 0) == mathpow(10, i - 2) - 1 ||
  40266. (rd == k / 2 || rd == 0) && (d[di + 1] / k / 100 | 0) == 0;
  40267. }
  40268. } else {
  40269. if (i < 4) {
  40270. if (i == 0) rd = rd / 1000 | 0;
  40271. else if (i == 1) rd = rd / 100 | 0;
  40272. else if (i == 2) rd = rd / 10 | 0;
  40273. r = (repeating || rm < 4) && rd == 9999 || !repeating && rm > 3 && rd == 4999;
  40274. } else {
  40275. r = ((repeating || rm < 4) && rd + 1 == k ||
  40276. (!repeating && rm > 3) && rd + 1 == k / 2) &&
  40277. (d[di + 1] / k / 1000 | 0) == mathpow(10, i - 3) - 1;
  40278. }
  40279. }
  40280. return r;
  40281. }
  40282. // Convert string of `baseIn` to an array of numbers of `baseOut`.
  40283. // Eg. convertBase('255', 10, 16) returns [15, 15].
  40284. // Eg. convertBase('ff', 16, 10) returns [2, 5, 5].
  40285. function convertBase(str, baseIn, baseOut) {
  40286. var j,
  40287. arr = [0],
  40288. arrL,
  40289. i = 0,
  40290. strL = str.length;
  40291. for (; i < strL;) {
  40292. for (arrL = arr.length; arrL--;) arr[arrL] *= baseIn;
  40293. arr[0] += NUMERALS.indexOf(str.charAt(i++));
  40294. for (j = 0; j < arr.length; j++) {
  40295. if (arr[j] > baseOut - 1) {
  40296. if (arr[j + 1] === void 0) arr[j + 1] = 0;
  40297. arr[j + 1] += arr[j] / baseOut | 0;
  40298. arr[j] %= baseOut;
  40299. }
  40300. }
  40301. }
  40302. return arr.reverse();
  40303. }
  40304. /*
  40305. * cos(x) = 1 - x^2/2! + x^4/4! - ...
  40306. * |x| < pi/2
  40307. *
  40308. */
  40309. function cosine(Ctor, x) {
  40310. var k, y,
  40311. len = x.d.length;
  40312. // Argument reduction: cos(4x) = 8*(cos^4(x) - cos^2(x)) + 1
  40313. // i.e. cos(x) = 8*(cos^4(x/4) - cos^2(x/4)) + 1
  40314. // Estimate the optimum number of times to use the argument reduction.
  40315. if (len < 32) {
  40316. k = Math.ceil(len / 3);
  40317. y = Math.pow(4, -k).toString();
  40318. } else {
  40319. k = 16;
  40320. y = '2.3283064365386962890625e-10';
  40321. }
  40322. Ctor.precision += k;
  40323. x = taylorSeries(Ctor, 1, x.times(y), new Ctor(1));
  40324. // Reverse argument reduction
  40325. for (var i = k; i--;) {
  40326. var cos2x = x.times(x);
  40327. x = cos2x.times(cos2x).minus(cos2x).times(8).plus(1);
  40328. }
  40329. Ctor.precision -= k;
  40330. return x;
  40331. }
  40332. /*
  40333. * Perform division in the specified base.
  40334. */
  40335. var divide = (function () {
  40336. // Assumes non-zero x and k, and hence non-zero result.
  40337. function multiplyInteger(x, k, base) {
  40338. var temp,
  40339. carry = 0,
  40340. i = x.length;
  40341. for (x = x.slice(); i--;) {
  40342. temp = x[i] * k + carry;
  40343. x[i] = temp % base | 0;
  40344. carry = temp / base | 0;
  40345. }
  40346. if (carry) x.unshift(carry);
  40347. return x;
  40348. }
  40349. function compare(a, b, aL, bL) {
  40350. var i, r;
  40351. if (aL != bL) {
  40352. r = aL > bL ? 1 : -1;
  40353. } else {
  40354. for (i = r = 0; i < aL; i++) {
  40355. if (a[i] != b[i]) {
  40356. r = a[i] > b[i] ? 1 : -1;
  40357. break;
  40358. }
  40359. }
  40360. }
  40361. return r;
  40362. }
  40363. function subtract(a, b, aL, base) {
  40364. var i = 0;
  40365. // Subtract b from a.
  40366. for (; aL--;) {
  40367. a[aL] -= i;
  40368. i = a[aL] < b[aL] ? 1 : 0;
  40369. a[aL] = i * base + a[aL] - b[aL];
  40370. }
  40371. // Remove leading zeros.
  40372. for (; !a[0] && a.length > 1;) a.shift();
  40373. }
  40374. return function (x, y, pr, rm, dp, base) {
  40375. var cmp, e, i, k, logBase, more, prod, prodL, q, qd, rem, remL, rem0, sd, t, xi, xL, yd0,
  40376. yL, yz,
  40377. Ctor = x.constructor,
  40378. sign = x.s == y.s ? 1 : -1,
  40379. xd = x.d,
  40380. yd = y.d;
  40381. // Either NaN, Infinity or 0?
  40382. if (!xd || !xd[0] || !yd || !yd[0]) {
  40383. return new Ctor(// Return NaN if either NaN, or both Infinity or 0.
  40384. !x.s || !y.s || (xd ? yd && xd[0] == yd[0] : !yd) ? NaN :
  40385. // Return ±0 if x is 0 or y is ±Infinity, or return ±Infinity as y is 0.
  40386. xd && xd[0] == 0 || !yd ? sign * 0 : sign / 0);
  40387. }
  40388. if (base) {
  40389. logBase = 1;
  40390. e = x.e - y.e;
  40391. } else {
  40392. base = BASE;
  40393. logBase = LOG_BASE;
  40394. e = mathfloor(x.e / logBase) - mathfloor(y.e / logBase);
  40395. }
  40396. yL = yd.length;
  40397. xL = xd.length;
  40398. q = new Ctor(sign);
  40399. qd = q.d = [];
  40400. // Result exponent may be one less than e.
  40401. // The digit array of a Decimal from toStringBinary may have trailing zeros.
  40402. for (i = 0; yd[i] == (xd[i] || 0); i++);
  40403. if (yd[i] > (xd[i] || 0)) e--;
  40404. if (pr == null) {
  40405. sd = pr = Ctor.precision;
  40406. rm = Ctor.rounding;
  40407. } else if (dp) {
  40408. sd = pr + (x.e - y.e) + 1;
  40409. } else {
  40410. sd = pr;
  40411. }
  40412. if (sd < 0) {
  40413. qd.push(1);
  40414. more = true;
  40415. } else {
  40416. // Convert precision in number of base 10 digits to base 1e7 digits.
  40417. sd = sd / logBase + 2 | 0;
  40418. i = 0;
  40419. // divisor < 1e7
  40420. if (yL == 1) {
  40421. k = 0;
  40422. yd = yd[0];
  40423. sd++;
  40424. // k is the carry.
  40425. for (; (i < xL || k) && sd--; i++) {
  40426. t = k * base + (xd[i] || 0);
  40427. qd[i] = t / yd | 0;
  40428. k = t % yd | 0;
  40429. }
  40430. more = k || i < xL;
  40431. // divisor >= 1e7
  40432. } else {
  40433. // Normalise xd and yd so highest order digit of yd is >= base/2
  40434. k = base / (yd[0] + 1) | 0;
  40435. if (k > 1) {
  40436. yd = multiplyInteger(yd, k, base);
  40437. xd = multiplyInteger(xd, k, base);
  40438. yL = yd.length;
  40439. xL = xd.length;
  40440. }
  40441. xi = yL;
  40442. rem = xd.slice(0, yL);
  40443. remL = rem.length;
  40444. // Add zeros to make remainder as long as divisor.
  40445. for (; remL < yL;) rem[remL++] = 0;
  40446. yz = yd.slice();
  40447. yz.unshift(0);
  40448. yd0 = yd[0];
  40449. if (yd[1] >= base / 2) ++yd0;
  40450. do {
  40451. k = 0;
  40452. // Compare divisor and remainder.
  40453. cmp = compare(yd, rem, yL, remL);
  40454. // If divisor < remainder.
  40455. if (cmp < 0) {
  40456. // Calculate trial digit, k.
  40457. rem0 = rem[0];
  40458. if (yL != remL) rem0 = rem0 * base + (rem[1] || 0);
  40459. // k will be how many times the divisor goes into the current remainder.
  40460. k = rem0 / yd0 | 0;
  40461. // Algorithm:
  40462. // 1. product = divisor * trial digit (k)
  40463. // 2. if product > remainder: product -= divisor, k--
  40464. // 3. remainder -= product
  40465. // 4. if product was < remainder at 2:
  40466. // 5. compare new remainder and divisor
  40467. // 6. If remainder > divisor: remainder -= divisor, k++
  40468. if (k > 1) {
  40469. if (k >= base) k = base - 1;
  40470. // product = divisor * trial digit.
  40471. prod = multiplyInteger(yd, k, base);
  40472. prodL = prod.length;
  40473. remL = rem.length;
  40474. // Compare product and remainder.
  40475. cmp = compare(prod, rem, prodL, remL);
  40476. // product > remainder.
  40477. if (cmp == 1) {
  40478. k--;
  40479. // Subtract divisor from product.
  40480. subtract(prod, yL < prodL ? yz : yd, prodL, base);
  40481. }
  40482. } else {
  40483. // cmp is -1.
  40484. // If k is 0, there is no need to compare yd and rem again below, so change cmp to 1
  40485. // to avoid it. If k is 1 there is a need to compare yd and rem again below.
  40486. if (k == 0) cmp = k = 1;
  40487. prod = yd.slice();
  40488. }
  40489. prodL = prod.length;
  40490. if (prodL < remL) prod.unshift(0);
  40491. // Subtract product from remainder.
  40492. subtract(rem, prod, remL, base);
  40493. // If product was < previous remainder.
  40494. if (cmp == -1) {
  40495. remL = rem.length;
  40496. // Compare divisor and new remainder.
  40497. cmp = compare(yd, rem, yL, remL);
  40498. // If divisor < new remainder, subtract divisor from remainder.
  40499. if (cmp < 1) {
  40500. k++;
  40501. // Subtract divisor from remainder.
  40502. subtract(rem, yL < remL ? yz : yd, remL, base);
  40503. }
  40504. }
  40505. remL = rem.length;
  40506. } else if (cmp === 0) {
  40507. k++;
  40508. rem = [0];
  40509. } // if cmp === 1, k will be 0
  40510. // Add the next digit, k, to the result array.
  40511. qd[i++] = k;
  40512. // Update the remainder.
  40513. if (cmp && rem[0]) {
  40514. rem[remL++] = xd[xi] || 0;
  40515. } else {
  40516. rem = [xd[xi]];
  40517. remL = 1;
  40518. }
  40519. } while ((xi++ < xL || rem[0] !== void 0) && sd--);
  40520. more = rem[0] !== void 0;
  40521. }
  40522. // Leading zero?
  40523. if (!qd[0]) qd.shift();
  40524. }
  40525. // logBase is 1 when divide is being used for base conversion.
  40526. if (logBase == 1) {
  40527. q.e = e;
  40528. inexact = more;
  40529. } else {
  40530. // To calculate q.e, first get the number of digits of qd[0].
  40531. for (i = 1, k = qd[0]; k >= 10; k /= 10) i++;
  40532. q.e = i + e * logBase - 1;
  40533. finalise(q, dp ? pr + q.e + 1 : pr, rm, more);
  40534. }
  40535. return q;
  40536. };
  40537. })();
  40538. /*
  40539. * Round `x` to `sd` significant digits using rounding mode `rm`.
  40540. * Check for over/under-flow.
  40541. */
  40542. function finalise(x, sd, rm, isTruncated) {
  40543. var digits, i, j, k, rd, roundUp, w, xd, xdi,
  40544. Ctor = x.constructor;
  40545. // Don't round if sd is null or undefined.
  40546. out: if (sd != null) {
  40547. xd = x.d;
  40548. // Infinity/NaN.
  40549. if (!xd) return x;
  40550. // rd: the rounding digit, i.e. the digit after the digit that may be rounded up.
  40551. // w: the word of xd containing rd, a base 1e7 number.
  40552. // xdi: the index of w within xd.
  40553. // digits: the number of digits of w.
  40554. // i: what would be the index of rd within w if all the numbers were 7 digits long (i.e. if
  40555. // they had leading zeros)
  40556. // j: if > 0, the actual index of rd within w (if < 0, rd is a leading zero).
  40557. // Get the length of the first word of the digits array xd.
  40558. for (digits = 1, k = xd[0]; k >= 10; k /= 10) digits++;
  40559. i = sd - digits;
  40560. // Is the rounding digit in the first word of xd?
  40561. if (i < 0) {
  40562. i += LOG_BASE;
  40563. j = sd;
  40564. w = xd[xdi = 0];
  40565. // Get the rounding digit at index j of w.
  40566. rd = w / mathpow(10, digits - j - 1) % 10 | 0;
  40567. } else {
  40568. xdi = Math.ceil((i + 1) / LOG_BASE);
  40569. k = xd.length;
  40570. if (xdi >= k) {
  40571. if (isTruncated) {
  40572. // Needed by `naturalExponential`, `naturalLogarithm` and `squareRoot`.
  40573. for (; k++ <= xdi;) xd.push(0);
  40574. w = rd = 0;
  40575. digits = 1;
  40576. i %= LOG_BASE;
  40577. j = i - LOG_BASE + 1;
  40578. } else {
  40579. break out;
  40580. }
  40581. } else {
  40582. w = k = xd[xdi];
  40583. // Get the number of digits of w.
  40584. for (digits = 1; k >= 10; k /= 10) digits++;
  40585. // Get the index of rd within w.
  40586. i %= LOG_BASE;
  40587. // Get the index of rd within w, adjusted for leading zeros.
  40588. // The number of leading zeros of w is given by LOG_BASE - digits.
  40589. j = i - LOG_BASE + digits;
  40590. // Get the rounding digit at index j of w.
  40591. rd = j < 0 ? 0 : w / mathpow(10, digits - j - 1) % 10 | 0;
  40592. }
  40593. }
  40594. // Are there any non-zero digits after the rounding digit?
  40595. isTruncated = isTruncated || sd < 0 ||
  40596. xd[xdi + 1] !== void 0 || (j < 0 ? w : w % mathpow(10, digits - j - 1));
  40597. // The expression `w % mathpow(10, digits - j - 1)` returns all the digits of w to the right
  40598. // of the digit at (left-to-right) index j, e.g. if w is 908714 and j is 2, the expression
  40599. // will give 714.
  40600. roundUp = rm < 4
  40601. ? (rd || isTruncated) && (rm == 0 || rm == (x.s < 0 ? 3 : 2))
  40602. : rd > 5 || rd == 5 && (rm == 4 || isTruncated || rm == 6 &&
  40603. // Check whether the digit to the left of the rounding digit is odd.
  40604. ((i > 0 ? j > 0 ? w / mathpow(10, digits - j) : 0 : xd[xdi - 1]) % 10) & 1 ||
  40605. rm == (x.s < 0 ? 8 : 7));
  40606. if (sd < 1 || !xd[0]) {
  40607. xd.length = 0;
  40608. if (roundUp) {
  40609. // Convert sd to decimal places.
  40610. sd -= x.e + 1;
  40611. // 1, 0.1, 0.01, 0.001, 0.0001 etc.
  40612. xd[0] = mathpow(10, (LOG_BASE - sd % LOG_BASE) % LOG_BASE);
  40613. x.e = -sd || 0;
  40614. } else {
  40615. // Zero.
  40616. xd[0] = x.e = 0;
  40617. }
  40618. return x;
  40619. }
  40620. // Remove excess digits.
  40621. if (i == 0) {
  40622. xd.length = xdi;
  40623. k = 1;
  40624. xdi--;
  40625. } else {
  40626. xd.length = xdi + 1;
  40627. k = mathpow(10, LOG_BASE - i);
  40628. // E.g. 56700 becomes 56000 if 7 is the rounding digit.
  40629. // j > 0 means i > number of leading zeros of w.
  40630. xd[xdi] = j > 0 ? (w / mathpow(10, digits - j) % mathpow(10, j) | 0) * k : 0;
  40631. }
  40632. if (roundUp) {
  40633. for (;;) {
  40634. // Is the digit to be rounded up in the first word of xd?
  40635. if (xdi == 0) {
  40636. // i will be the length of xd[0] before k is added.
  40637. for (i = 1, j = xd[0]; j >= 10; j /= 10) i++;
  40638. j = xd[0] += k;
  40639. for (k = 1; j >= 10; j /= 10) k++;
  40640. // if i != k the length has increased.
  40641. if (i != k) {
  40642. x.e++;
  40643. if (xd[0] == BASE) xd[0] = 1;
  40644. }
  40645. break;
  40646. } else {
  40647. xd[xdi] += k;
  40648. if (xd[xdi] != BASE) break;
  40649. xd[xdi--] = 0;
  40650. k = 1;
  40651. }
  40652. }
  40653. }
  40654. // Remove trailing zeros.
  40655. for (i = xd.length; xd[--i] === 0;) xd.pop();
  40656. }
  40657. if (external) {
  40658. // Overflow?
  40659. if (x.e > Ctor.maxE) {
  40660. // Infinity.
  40661. x.d = null;
  40662. x.e = NaN;
  40663. // Underflow?
  40664. } else if (x.e < Ctor.minE) {
  40665. // Zero.
  40666. x.e = 0;
  40667. x.d = [0];
  40668. // Ctor.underflow = true;
  40669. } // else Ctor.underflow = false;
  40670. }
  40671. return x;
  40672. }
  40673. function finiteToString(x, isExp, sd) {
  40674. if (!x.isFinite()) return nonFiniteToString(x);
  40675. var k,
  40676. e = x.e,
  40677. str = digitsToString(x.d),
  40678. len = str.length;
  40679. if (isExp) {
  40680. if (sd && (k = sd - len) > 0) {
  40681. str = str.charAt(0) + '.' + str.slice(1) + getZeroString(k);
  40682. } else if (len > 1) {
  40683. str = str.charAt(0) + '.' + str.slice(1);
  40684. }
  40685. str = str + (x.e < 0 ? 'e' : 'e+') + x.e;
  40686. } else if (e < 0) {
  40687. str = '0.' + getZeroString(-e - 1) + str;
  40688. if (sd && (k = sd - len) > 0) str += getZeroString(k);
  40689. } else if (e >= len) {
  40690. str += getZeroString(e + 1 - len);
  40691. if (sd && (k = sd - e - 1) > 0) str = str + '.' + getZeroString(k);
  40692. } else {
  40693. if ((k = e + 1) < len) str = str.slice(0, k) + '.' + str.slice(k);
  40694. if (sd && (k = sd - len) > 0) {
  40695. if (e + 1 === len) str += '.';
  40696. str += getZeroString(k);
  40697. }
  40698. }
  40699. return str;
  40700. }
  40701. // Calculate the base 10 exponent from the base 1e7 exponent.
  40702. function getBase10Exponent(digits, e) {
  40703. var w = digits[0];
  40704. // Add the number of digits of the first word of the digits array.
  40705. for ( e *= LOG_BASE; w >= 10; w /= 10) e++;
  40706. return e;
  40707. }
  40708. function getLn10(Ctor, sd, pr) {
  40709. if (sd > LN10_PRECISION) {
  40710. // Reset global state in case the exception is caught.
  40711. external = true;
  40712. if (pr) Ctor.precision = pr;
  40713. throw Error(precisionLimitExceeded);
  40714. }
  40715. return finalise(new Ctor(LN10), sd, 1, true);
  40716. }
  40717. function getPi(Ctor, sd, rm) {
  40718. if (sd > PI_PRECISION) throw Error(precisionLimitExceeded);
  40719. return finalise(new Ctor(PI), sd, rm, true);
  40720. }
  40721. function getPrecision(digits) {
  40722. var w = digits.length - 1,
  40723. len = w * LOG_BASE + 1;
  40724. w = digits[w];
  40725. // If non-zero...
  40726. if (w) {
  40727. // Subtract the number of trailing zeros of the last word.
  40728. for (; w % 10 == 0; w /= 10) len--;
  40729. // Add the number of digits of the first word.
  40730. for (w = digits[0]; w >= 10; w /= 10) len++;
  40731. }
  40732. return len;
  40733. }
  40734. function getZeroString(k) {
  40735. var zs = '';
  40736. for (; k--;) zs += '0';
  40737. return zs;
  40738. }
  40739. /*
  40740. * Return a new Decimal whose value is the value of Decimal `x` to the power `n`, where `n` is an
  40741. * integer of type number.
  40742. *
  40743. * Implements 'exponentiation by squaring'. Called by `pow` and `parseOther`.
  40744. *
  40745. */
  40746. function intPow(Ctor, x, n, pr) {
  40747. var isTruncated,
  40748. r = new Ctor(1),
  40749. // Max n of 9007199254740991 takes 53 loop iterations.
  40750. // Maximum digits array length; leaves [28, 34] guard digits.
  40751. k = Math.ceil(pr / LOG_BASE + 4);
  40752. external = false;
  40753. for (;;) {
  40754. if (n % 2) {
  40755. r = r.times(x);
  40756. if (truncate(r.d, k)) isTruncated = true;
  40757. }
  40758. n = mathfloor(n / 2);
  40759. if (n === 0) {
  40760. // To ensure correct rounding when r.d is truncated, increment the last word if it is zero.
  40761. n = r.d.length - 1;
  40762. if (isTruncated && r.d[n] === 0) ++r.d[n];
  40763. break;
  40764. }
  40765. x = x.times(x);
  40766. truncate(x.d, k);
  40767. }
  40768. external = true;
  40769. return r;
  40770. }
  40771. function isOdd(n) {
  40772. return n.d[n.d.length - 1] & 1;
  40773. }
  40774. /*
  40775. * Handle `max` and `min`. `ltgt` is 'lt' or 'gt'.
  40776. */
  40777. function maxOrMin(Ctor, args, ltgt) {
  40778. var y,
  40779. x = new Ctor(args[0]),
  40780. i = 0;
  40781. for (; ++i < args.length;) {
  40782. y = new Ctor(args[i]);
  40783. if (!y.s) {
  40784. x = y;
  40785. break;
  40786. } else if (x[ltgt](y)) {
  40787. x = y;
  40788. }
  40789. }
  40790. return x;
  40791. }
  40792. /*
  40793. * Return a new Decimal whose value is the natural exponential of `x` rounded to `sd` significant
  40794. * digits.
  40795. *
  40796. * Taylor/Maclaurin series.
  40797. *
  40798. * exp(x) = x^0/0! + x^1/1! + x^2/2! + x^3/3! + ...
  40799. *
  40800. * Argument reduction:
  40801. * Repeat x = x / 32, k += 5, until |x| < 0.1
  40802. * exp(x) = exp(x / 2^k)^(2^k)
  40803. *
  40804. * Previously, the argument was initially reduced by
  40805. * exp(x) = exp(r) * 10^k where r = x - k * ln10, k = floor(x / ln10)
  40806. * to first put r in the range [0, ln10], before dividing by 32 until |x| < 0.1, but this was
  40807. * found to be slower than just dividing repeatedly by 32 as above.
  40808. *
  40809. * Max integer argument: exp('20723265836946413') = 6.3e+9000000000000000
  40810. * Min integer argument: exp('-20723265836946411') = 1.2e-9000000000000000
  40811. * (Math object integer min/max: Math.exp(709) = 8.2e+307, Math.exp(-745) = 5e-324)
  40812. *
  40813. * exp(Infinity) = Infinity
  40814. * exp(-Infinity) = 0
  40815. * exp(NaN) = NaN
  40816. * exp(±0) = 1
  40817. *
  40818. * exp(x) is non-terminating for any finite, non-zero x.
  40819. *
  40820. * The result will always be correctly rounded.
  40821. *
  40822. */
  40823. function naturalExponential(x, sd) {
  40824. var denominator, guard, j, pow, sum, t, wpr,
  40825. rep = 0,
  40826. i = 0,
  40827. k = 0,
  40828. Ctor = x.constructor,
  40829. rm = Ctor.rounding,
  40830. pr = Ctor.precision;
  40831. // 0/NaN/Infinity?
  40832. if (!x.d || !x.d[0] || x.e > 17) {
  40833. return new Ctor(x.d
  40834. ? !x.d[0] ? 1 : x.s < 0 ? 0 : 1 / 0
  40835. : x.s ? x.s < 0 ? 0 : x : 0 / 0);
  40836. }
  40837. if (sd == null) {
  40838. external = false;
  40839. wpr = pr;
  40840. } else {
  40841. wpr = sd;
  40842. }
  40843. t = new Ctor(0.03125);
  40844. // while abs(x) >= 0.1
  40845. while (x.e > -2) {
  40846. // x = x / 2^5
  40847. x = x.times(t);
  40848. k += 5;
  40849. }
  40850. // Use 2 * log10(2^k) + 5 (empirically derived) to estimate the increase in precision
  40851. // necessary to ensure the first 4 rounding digits are correct.
  40852. guard = Math.log(mathpow(2, k)) / Math.LN10 * 2 + 5 | 0;
  40853. wpr += guard;
  40854. denominator = pow = sum = new Ctor(1);
  40855. Ctor.precision = wpr;
  40856. for (;;) {
  40857. pow = finalise(pow.times(x), wpr, 1);
  40858. denominator = denominator.times(++i);
  40859. t = sum.plus(divide(pow, denominator, wpr, 1));
  40860. if (digitsToString(t.d).slice(0, wpr) === digitsToString(sum.d).slice(0, wpr)) {
  40861. j = k;
  40862. while (j--) sum = finalise(sum.times(sum), wpr, 1);
  40863. // Check to see if the first 4 rounding digits are [49]999.
  40864. // If so, repeat the summation with a higher precision, otherwise
  40865. // e.g. with precision: 18, rounding: 1
  40866. // exp(18.404272462595034083567793919843761) = 98372560.1229999999 (should be 98372560.123)
  40867. // `wpr - guard` is the index of first rounding digit.
  40868. if (sd == null) {
  40869. if (rep < 3 && checkRoundingDigits(sum.d, wpr - guard, rm, rep)) {
  40870. Ctor.precision = wpr += 10;
  40871. denominator = pow = t = new Ctor(1);
  40872. i = 0;
  40873. rep++;
  40874. } else {
  40875. return finalise(sum, Ctor.precision = pr, rm, external = true);
  40876. }
  40877. } else {
  40878. Ctor.precision = pr;
  40879. return sum;
  40880. }
  40881. }
  40882. sum = t;
  40883. }
  40884. }
  40885. /*
  40886. * Return a new Decimal whose value is the natural logarithm of `x` rounded to `sd` significant
  40887. * digits.
  40888. *
  40889. * ln(-n) = NaN
  40890. * ln(0) = -Infinity
  40891. * ln(-0) = -Infinity
  40892. * ln(1) = 0
  40893. * ln(Infinity) = Infinity
  40894. * ln(-Infinity) = NaN
  40895. * ln(NaN) = NaN
  40896. *
  40897. * ln(n) (n != 1) is non-terminating.
  40898. *
  40899. */
  40900. function naturalLogarithm(y, sd) {
  40901. var c, c0, denominator, e, numerator, rep, sum, t, wpr, x1, x2,
  40902. n = 1,
  40903. guard = 10,
  40904. x = y,
  40905. xd = x.d,
  40906. Ctor = x.constructor,
  40907. rm = Ctor.rounding,
  40908. pr = Ctor.precision;
  40909. // Is x negative or Infinity, NaN, 0 or 1?
  40910. if (x.s < 0 || !xd || !xd[0] || !x.e && xd[0] == 1 && xd.length == 1) {
  40911. return new Ctor(xd && !xd[0] ? -1 / 0 : x.s != 1 ? NaN : xd ? 0 : x);
  40912. }
  40913. if (sd == null) {
  40914. external = false;
  40915. wpr = pr;
  40916. } else {
  40917. wpr = sd;
  40918. }
  40919. Ctor.precision = wpr += guard;
  40920. c = digitsToString(xd);
  40921. c0 = c.charAt(0);
  40922. if (Math.abs(e = x.e) < 1.5e15) {
  40923. // Argument reduction.
  40924. // The series converges faster the closer the argument is to 1, so using
  40925. // ln(a^b) = b * ln(a), ln(a) = ln(a^b) / b
  40926. // multiply the argument by itself until the leading digits of the significand are 7, 8, 9,
  40927. // 10, 11, 12 or 13, recording the number of multiplications so the sum of the series can
  40928. // later be divided by this number, then separate out the power of 10 using
  40929. // ln(a*10^b) = ln(a) + b*ln(10).
  40930. // max n is 21 (gives 0.9, 1.0 or 1.1) (9e15 / 21 = 4.2e14).
  40931. //while (c0 < 9 && c0 != 1 || c0 == 1 && c.charAt(1) > 1) {
  40932. // max n is 6 (gives 0.7 - 1.3)
  40933. while (c0 < 7 && c0 != 1 || c0 == 1 && c.charAt(1) > 3) {
  40934. x = x.times(y);
  40935. c = digitsToString(x.d);
  40936. c0 = c.charAt(0);
  40937. n++;
  40938. }
  40939. e = x.e;
  40940. if (c0 > 1) {
  40941. x = new Ctor('0.' + c);
  40942. e++;
  40943. } else {
  40944. x = new Ctor(c0 + '.' + c.slice(1));
  40945. }
  40946. } else {
  40947. // The argument reduction method above may result in overflow if the argument y is a massive
  40948. // number with exponent >= 1500000000000000 (9e15 / 6 = 1.5e15), so instead recall this
  40949. // function using ln(x*10^e) = ln(x) + e*ln(10).
  40950. t = getLn10(Ctor, wpr + 2, pr).times(e + '');
  40951. x = naturalLogarithm(new Ctor(c0 + '.' + c.slice(1)), wpr - guard).plus(t);
  40952. Ctor.precision = pr;
  40953. return sd == null ? finalise(x, pr, rm, external = true) : x;
  40954. }
  40955. // x1 is x reduced to a value near 1.
  40956. x1 = x;
  40957. // Taylor series.
  40958. // ln(y) = ln((1 + x)/(1 - x)) = 2(x + x^3/3 + x^5/5 + x^7/7 + ...)
  40959. // where x = (y - 1)/(y + 1) (|x| < 1)
  40960. sum = numerator = x = divide(x.minus(1), x.plus(1), wpr, 1);
  40961. x2 = finalise(x.times(x), wpr, 1);
  40962. denominator = 3;
  40963. for (;;) {
  40964. numerator = finalise(numerator.times(x2), wpr, 1);
  40965. t = sum.plus(divide(numerator, new Ctor(denominator), wpr, 1));
  40966. if (digitsToString(t.d).slice(0, wpr) === digitsToString(sum.d).slice(0, wpr)) {
  40967. sum = sum.times(2);
  40968. // Reverse the argument reduction. Check that e is not 0 because, besides preventing an
  40969. // unnecessary calculation, -0 + 0 = +0 and to ensure correct rounding -0 needs to stay -0.
  40970. if (e !== 0) sum = sum.plus(getLn10(Ctor, wpr + 2, pr).times(e + ''));
  40971. sum = divide(sum, new Ctor(n), wpr, 1);
  40972. // Is rm > 3 and the first 4 rounding digits 4999, or rm < 4 (or the summation has
  40973. // been repeated previously) and the first 4 rounding digits 9999?
  40974. // If so, restart the summation with a higher precision, otherwise
  40975. // e.g. with precision: 12, rounding: 1
  40976. // ln(135520028.6126091714265381533) = 18.7246299999 when it should be 18.72463.
  40977. // `wpr - guard` is the index of first rounding digit.
  40978. if (sd == null) {
  40979. if (checkRoundingDigits(sum.d, wpr - guard, rm, rep)) {
  40980. Ctor.precision = wpr += guard;
  40981. t = numerator = x = divide(x1.minus(1), x1.plus(1), wpr, 1);
  40982. x2 = finalise(x.times(x), wpr, 1);
  40983. denominator = rep = 1;
  40984. } else {
  40985. return finalise(sum, Ctor.precision = pr, rm, external = true);
  40986. }
  40987. } else {
  40988. Ctor.precision = pr;
  40989. return sum;
  40990. }
  40991. }
  40992. sum = t;
  40993. denominator += 2;
  40994. }
  40995. }
  40996. // ±Infinity, NaN.
  40997. function nonFiniteToString(x) {
  40998. // Unsigned.
  40999. return String(x.s * x.s / 0);
  41000. }
  41001. /*
  41002. * Parse the value of a new Decimal `x` from string `str`.
  41003. */
  41004. function parseDecimal(x, str) {
  41005. var e, i, len;
  41006. // Decimal point?
  41007. if ((e = str.indexOf('.')) > -1) str = str.replace('.', '');
  41008. // Exponential form?
  41009. if ((i = str.search(/e/i)) > 0) {
  41010. // Determine exponent.
  41011. if (e < 0) e = i;
  41012. e += +str.slice(i + 1);
  41013. str = str.substring(0, i);
  41014. } else if (e < 0) {
  41015. // Integer.
  41016. e = str.length;
  41017. }
  41018. // Determine leading zeros.
  41019. for (i = 0; str.charCodeAt(i) === 48; i++);
  41020. // Determine trailing zeros.
  41021. for (len = str.length; str.charCodeAt(len - 1) === 48; --len);
  41022. str = str.slice(i, len);
  41023. if (str) {
  41024. len -= i;
  41025. x.e = e = e - i - 1;
  41026. x.d = [];
  41027. // Transform base
  41028. // e is the base 10 exponent.
  41029. // i is where to slice str to get the first word of the digits array.
  41030. i = (e + 1) % LOG_BASE;
  41031. if (e < 0) i += LOG_BASE;
  41032. if (i < len) {
  41033. if (i) x.d.push(+str.slice(0, i));
  41034. for (len -= LOG_BASE; i < len;) x.d.push(+str.slice(i, i += LOG_BASE));
  41035. str = str.slice(i);
  41036. i = LOG_BASE - str.length;
  41037. } else {
  41038. i -= len;
  41039. }
  41040. for (; i--;) str += '0';
  41041. x.d.push(+str);
  41042. if (external) {
  41043. // Overflow?
  41044. if (x.e > x.constructor.maxE) {
  41045. // Infinity.
  41046. x.d = null;
  41047. x.e = NaN;
  41048. // Underflow?
  41049. } else if (x.e < x.constructor.minE) {
  41050. // Zero.
  41051. x.e = 0;
  41052. x.d = [0];
  41053. // x.constructor.underflow = true;
  41054. } // else x.constructor.underflow = false;
  41055. }
  41056. } else {
  41057. // Zero.
  41058. x.e = 0;
  41059. x.d = [0];
  41060. }
  41061. return x;
  41062. }
  41063. /*
  41064. * Parse the value of a new Decimal `x` from a string `str`, which is not a decimal value.
  41065. */
  41066. function parseOther(x, str) {
  41067. var base, Ctor, divisor, i, isFloat, len, p, xd, xe;
  41068. if (str === 'Infinity' || str === 'NaN') {
  41069. if (!+str) x.s = NaN;
  41070. x.e = NaN;
  41071. x.d = null;
  41072. return x;
  41073. }
  41074. if (isHex.test(str)) {
  41075. base = 16;
  41076. str = str.toLowerCase();
  41077. } else if (isBinary.test(str)) {
  41078. base = 2;
  41079. } else if (isOctal.test(str)) {
  41080. base = 8;
  41081. } else {
  41082. throw Error(invalidArgument + str);
  41083. }
  41084. // Is there a binary exponent part?
  41085. i = str.search(/p/i);
  41086. if (i > 0) {
  41087. p = +str.slice(i + 1);
  41088. str = str.substring(2, i);
  41089. } else {
  41090. str = str.slice(2);
  41091. }
  41092. // Convert `str` as an integer then divide the result by `base` raised to a power such that the
  41093. // fraction part will be restored.
  41094. i = str.indexOf('.');
  41095. isFloat = i >= 0;
  41096. Ctor = x.constructor;
  41097. if (isFloat) {
  41098. str = str.replace('.', '');
  41099. len = str.length;
  41100. i = len - i;
  41101. // log[10](16) = 1.2041... , log[10](88) = 1.9444....
  41102. divisor = intPow(Ctor, new Ctor(base), i, i * 2);
  41103. }
  41104. xd = convertBase(str, base, BASE);
  41105. xe = xd.length - 1;
  41106. // Remove trailing zeros.
  41107. for (i = xe; xd[i] === 0; --i) xd.pop();
  41108. if (i < 0) return new Ctor(x.s * 0);
  41109. x.e = getBase10Exponent(xd, xe);
  41110. x.d = xd;
  41111. external = false;
  41112. // At what precision to perform the division to ensure exact conversion?
  41113. // maxDecimalIntegerPartDigitCount = ceil(log[10](b) * otherBaseIntegerPartDigitCount)
  41114. // log[10](2) = 0.30103, log[10](8) = 0.90309, log[10](16) = 1.20412
  41115. // E.g. ceil(1.2 * 3) = 4, so up to 4 decimal digits are needed to represent 3 hex int digits.
  41116. // maxDecimalFractionPartDigitCount = {Hex:4|Oct:3|Bin:1} * otherBaseFractionPartDigitCount
  41117. // Therefore using 4 * the number of digits of str will always be enough.
  41118. if (isFloat) x = divide(x, divisor, len * 4);
  41119. // Multiply by the binary exponent part if present.
  41120. if (p) x = x.times(Math.abs(p) < 54 ? Math.pow(2, p) : Decimal.pow(2, p));
  41121. external = true;
  41122. return x;
  41123. }
  41124. /*
  41125. * sin(x) = x - x^3/3! + x^5/5! - ...
  41126. * |x| < pi/2
  41127. *
  41128. */
  41129. function sine(Ctor, x) {
  41130. var k,
  41131. len = x.d.length;
  41132. if (len < 3) return taylorSeries(Ctor, 2, x, x);
  41133. // Argument reduction: sin(5x) = 16*sin^5(x) - 20*sin^3(x) + 5*sin(x)
  41134. // i.e. sin(x) = 16*sin^5(x/5) - 20*sin^3(x/5) + 5*sin(x/5)
  41135. // and sin(x) = sin(x/5)(5 + sin^2(x/5)(16sin^2(x/5) - 20))
  41136. // Estimate the optimum number of times to use the argument reduction.
  41137. k = 1.4 * Math.sqrt(len);
  41138. k = k > 16 ? 16 : k | 0;
  41139. // Max k before Math.pow precision loss is 22
  41140. x = x.times(Math.pow(5, -k));
  41141. x = taylorSeries(Ctor, 2, x, x);
  41142. // Reverse argument reduction
  41143. var sin2_x,
  41144. d5 = new Ctor(5),
  41145. d16 = new Ctor(16),
  41146. d20 = new Ctor(20);
  41147. for (; k--;) {
  41148. sin2_x = x.times(x);
  41149. x = x.times(d5.plus(sin2_x.times(d16.times(sin2_x).minus(d20))));
  41150. }
  41151. return x;
  41152. }
  41153. // Calculate Taylor series for `cos`, `cosh`, `sin` and `sinh`.
  41154. function taylorSeries(Ctor, n, x, y, isHyperbolic) {
  41155. var j, t, u, x2,
  41156. i = 1,
  41157. pr = Ctor.precision,
  41158. k = Math.ceil(pr / LOG_BASE);
  41159. external = false;
  41160. x2 = x.times(x);
  41161. u = new Ctor(y);
  41162. for (;;) {
  41163. t = divide(u.times(x2), new Ctor(n++ * n++), pr, 1);
  41164. u = isHyperbolic ? y.plus(t) : y.minus(t);
  41165. y = divide(t.times(x2), new Ctor(n++ * n++), pr, 1);
  41166. t = u.plus(y);
  41167. if (t.d[k] !== void 0) {
  41168. for (j = k; t.d[j] === u.d[j] && j--;);
  41169. if (j == -1) break;
  41170. }
  41171. j = u;
  41172. u = y;
  41173. y = t;
  41174. t = j;
  41175. i++;
  41176. }
  41177. external = true;
  41178. t.d.length = k + 1;
  41179. return t;
  41180. }
  41181. // Return the absolute value of `x` reduced to less than or equal to half pi.
  41182. function toLessThanHalfPi(Ctor, x) {
  41183. var t,
  41184. isNeg = x.s < 0,
  41185. pi = getPi(Ctor, Ctor.precision, 1),
  41186. halfPi = pi.times(0.5);
  41187. x = x.abs();
  41188. if (x.lte(halfPi)) {
  41189. quadrant = isNeg ? 4 : 1;
  41190. return x;
  41191. }
  41192. t = x.divToInt(pi);
  41193. if (t.isZero()) {
  41194. quadrant = isNeg ? 3 : 2;
  41195. } else {
  41196. x = x.minus(t.times(pi));
  41197. // 0 <= x < pi
  41198. if (x.lte(halfPi)) {
  41199. quadrant = isOdd(t) ? (isNeg ? 2 : 3) : (isNeg ? 4 : 1);
  41200. return x;
  41201. }
  41202. quadrant = isOdd(t) ? (isNeg ? 1 : 4) : (isNeg ? 3 : 2);
  41203. }
  41204. return x.minus(pi).abs();
  41205. }
  41206. /*
  41207. * Return the value of Decimal `x` as a string in base `baseOut`.
  41208. *
  41209. * If the optional `sd` argument is present include a binary exponent suffix.
  41210. */
  41211. function toStringBinary(x, baseOut, sd, rm) {
  41212. var base, e, i, k, len, roundUp, str, xd, y,
  41213. Ctor = x.constructor,
  41214. isExp = sd !== void 0;
  41215. if (isExp) {
  41216. checkInt32(sd, 1, MAX_DIGITS);
  41217. if (rm === void 0) rm = Ctor.rounding;
  41218. else checkInt32(rm, 0, 8);
  41219. } else {
  41220. sd = Ctor.precision;
  41221. rm = Ctor.rounding;
  41222. }
  41223. if (!x.isFinite()) {
  41224. str = nonFiniteToString(x);
  41225. } else {
  41226. str = finiteToString(x);
  41227. i = str.indexOf('.');
  41228. // Use exponential notation according to `toExpPos` and `toExpNeg`? No, but if required:
  41229. // maxBinaryExponent = floor((decimalExponent + 1) * log[2](10))
  41230. // minBinaryExponent = floor(decimalExponent * log[2](10))
  41231. // log[2](10) = 3.321928094887362347870319429489390175864
  41232. if (isExp) {
  41233. base = 2;
  41234. if (baseOut == 16) {
  41235. sd = sd * 4 - 3;
  41236. } else if (baseOut == 8) {
  41237. sd = sd * 3 - 2;
  41238. }
  41239. } else {
  41240. base = baseOut;
  41241. }
  41242. // Convert the number as an integer then divide the result by its base raised to a power such
  41243. // that the fraction part will be restored.
  41244. // Non-integer.
  41245. if (i >= 0) {
  41246. str = str.replace('.', '');
  41247. y = new Ctor(1);
  41248. y.e = str.length - i;
  41249. y.d = convertBase(finiteToString(y), 10, base);
  41250. y.e = y.d.length;
  41251. }
  41252. xd = convertBase(str, 10, base);
  41253. e = len = xd.length;
  41254. // Remove trailing zeros.
  41255. for (; xd[--len] == 0;) xd.pop();
  41256. if (!xd[0]) {
  41257. str = isExp ? '0p+0' : '0';
  41258. } else {
  41259. if (i < 0) {
  41260. e--;
  41261. } else {
  41262. x = new Ctor(x);
  41263. x.d = xd;
  41264. x.e = e;
  41265. x = divide(x, y, sd, rm, 0, base);
  41266. xd = x.d;
  41267. e = x.e;
  41268. roundUp = inexact;
  41269. }
  41270. // The rounding digit, i.e. the digit after the digit that may be rounded up.
  41271. i = xd[sd];
  41272. k = base / 2;
  41273. roundUp = roundUp || xd[sd + 1] !== void 0;
  41274. roundUp = rm < 4
  41275. ? (i !== void 0 || roundUp) && (rm === 0 || rm === (x.s < 0 ? 3 : 2))
  41276. : i > k || i === k && (rm === 4 || roundUp || rm === 6 && xd[sd - 1] & 1 ||
  41277. rm === (x.s < 0 ? 8 : 7));
  41278. xd.length = sd;
  41279. if (roundUp) {
  41280. // Rounding up may mean the previous digit has to be rounded up and so on.
  41281. for (; ++xd[--sd] > base - 1;) {
  41282. xd[sd] = 0;
  41283. if (!sd) {
  41284. ++e;
  41285. xd.unshift(1);
  41286. }
  41287. }
  41288. }
  41289. // Determine trailing zeros.
  41290. for (len = xd.length; !xd[len - 1]; --len);
  41291. // E.g. [4, 11, 15] becomes 4bf.
  41292. for (i = 0, str = ''; i < len; i++) str += NUMERALS.charAt(xd[i]);
  41293. // Add binary exponent suffix?
  41294. if (isExp) {
  41295. if (len > 1) {
  41296. if (baseOut == 16 || baseOut == 8) {
  41297. i = baseOut == 16 ? 4 : 3;
  41298. for (--len; len % i; len++) str += '0';
  41299. xd = convertBase(str, base, baseOut);
  41300. for (len = xd.length; !xd[len - 1]; --len);
  41301. // xd[0] will always be be 1
  41302. for (i = 1, str = '1.'; i < len; i++) str += NUMERALS.charAt(xd[i]);
  41303. } else {
  41304. str = str.charAt(0) + '.' + str.slice(1);
  41305. }
  41306. }
  41307. str = str + (e < 0 ? 'p' : 'p+') + e;
  41308. } else if (e < 0) {
  41309. for (; ++e;) str = '0' + str;
  41310. str = '0.' + str;
  41311. } else {
  41312. if (++e > len) for (e -= len; e-- ;) str += '0';
  41313. else if (e < len) str = str.slice(0, e) + '.' + str.slice(e);
  41314. }
  41315. }
  41316. str = (baseOut == 16 ? '0x' : baseOut == 2 ? '0b' : baseOut == 8 ? '0o' : '') + str;
  41317. }
  41318. return x.s < 0 ? '-' + str : str;
  41319. }
  41320. // Does not strip trailing zeros.
  41321. function truncate(arr, len) {
  41322. if (arr.length > len) {
  41323. arr.length = len;
  41324. return true;
  41325. }
  41326. }
  41327. // Decimal methods
  41328. /*
  41329. * abs
  41330. * acos
  41331. * acosh
  41332. * add
  41333. * asin
  41334. * asinh
  41335. * atan
  41336. * atanh
  41337. * atan2
  41338. * cbrt
  41339. * ceil
  41340. * clone
  41341. * config
  41342. * cos
  41343. * cosh
  41344. * div
  41345. * exp
  41346. * floor
  41347. * hypot
  41348. * ln
  41349. * log
  41350. * log2
  41351. * log10
  41352. * max
  41353. * min
  41354. * mod
  41355. * mul
  41356. * pow
  41357. * random
  41358. * round
  41359. * set
  41360. * sign
  41361. * sin
  41362. * sinh
  41363. * sqrt
  41364. * sub
  41365. * tan
  41366. * tanh
  41367. * trunc
  41368. */
  41369. /*
  41370. * Return a new Decimal whose value is the absolute value of `x`.
  41371. *
  41372. * x {number|string|Decimal}
  41373. *
  41374. */
  41375. function abs(x) {
  41376. return new this(x).abs();
  41377. }
  41378. /*
  41379. * Return a new Decimal whose value is the arccosine in radians of `x`.
  41380. *
  41381. * x {number|string|Decimal}
  41382. *
  41383. */
  41384. function acos(x) {
  41385. return new this(x).acos();
  41386. }
  41387. /*
  41388. * Return a new Decimal whose value is the inverse of the hyperbolic cosine of `x`, rounded to
  41389. * `precision` significant digits using rounding mode `rounding`.
  41390. *
  41391. * x {number|string|Decimal} A value in radians.
  41392. *
  41393. */
  41394. function acosh(x) {
  41395. return new this(x).acosh();
  41396. }
  41397. /*
  41398. * Return a new Decimal whose value is the sum of `x` and `y`, rounded to `precision` significant
  41399. * digits using rounding mode `rounding`.
  41400. *
  41401. * x {number|string|Decimal}
  41402. * y {number|string|Decimal}
  41403. *
  41404. */
  41405. function add(x, y) {
  41406. return new this(x).plus(y);
  41407. }
  41408. /*
  41409. * Return a new Decimal whose value is the arcsine in radians of `x`, rounded to `precision`
  41410. * significant digits using rounding mode `rounding`.
  41411. *
  41412. * x {number|string|Decimal}
  41413. *
  41414. */
  41415. function asin(x) {
  41416. return new this(x).asin();
  41417. }
  41418. /*
  41419. * Return a new Decimal whose value is the inverse of the hyperbolic sine of `x`, rounded to
  41420. * `precision` significant digits using rounding mode `rounding`.
  41421. *
  41422. * x {number|string|Decimal} A value in radians.
  41423. *
  41424. */
  41425. function asinh(x) {
  41426. return new this(x).asinh();
  41427. }
  41428. /*
  41429. * Return a new Decimal whose value is the arctangent in radians of `x`, rounded to `precision`
  41430. * significant digits using rounding mode `rounding`.
  41431. *
  41432. * x {number|string|Decimal}
  41433. *
  41434. */
  41435. function atan(x) {
  41436. return new this(x).atan();
  41437. }
  41438. /*
  41439. * Return a new Decimal whose value is the inverse of the hyperbolic tangent of `x`, rounded to
  41440. * `precision` significant digits using rounding mode `rounding`.
  41441. *
  41442. * x {number|string|Decimal} A value in radians.
  41443. *
  41444. */
  41445. function atanh(x) {
  41446. return new this(x).atanh();
  41447. }
  41448. /*
  41449. * Return a new Decimal whose value is the arctangent in radians of `y/x` in the range -pi to pi
  41450. * (inclusive), rounded to `precision` significant digits using rounding mode `rounding`.
  41451. *
  41452. * Domain: [-Infinity, Infinity]
  41453. * Range: [-pi, pi]
  41454. *
  41455. * y {number|string|Decimal} The y-coordinate.
  41456. * x {number|string|Decimal} The x-coordinate.
  41457. *
  41458. * atan2(±0, -0) = ±pi
  41459. * atan2(±0, +0) = ±0
  41460. * atan2(±0, -x) = ±pi for x > 0
  41461. * atan2(±0, x) = ±0 for x > 0
  41462. * atan2(-y, ±0) = -pi/2 for y > 0
  41463. * atan2(y, ±0) = pi/2 for y > 0
  41464. * atan2(±y, -Infinity) = ±pi for finite y > 0
  41465. * atan2(±y, +Infinity) = ±0 for finite y > 0
  41466. * atan2(±Infinity, x) = ±pi/2 for finite x
  41467. * atan2(±Infinity, -Infinity) = ±3*pi/4
  41468. * atan2(±Infinity, +Infinity) = ±pi/4
  41469. * atan2(NaN, x) = NaN
  41470. * atan2(y, NaN) = NaN
  41471. *
  41472. */
  41473. function atan2(y, x) {
  41474. y = new this(y);
  41475. x = new this(x);
  41476. var r,
  41477. pr = this.precision,
  41478. rm = this.rounding,
  41479. wpr = pr + 4;
  41480. // Either NaN
  41481. if (!y.s || !x.s) {
  41482. r = new this(NaN);
  41483. // Both ±Infinity
  41484. } else if (!y.d && !x.d) {
  41485. r = getPi(this, wpr, 1).times(x.s > 0 ? 0.25 : 0.75);
  41486. r.s = y.s;
  41487. // x is ±Infinity or y is ±0
  41488. } else if (!x.d || y.isZero()) {
  41489. r = x.s < 0 ? getPi(this, pr, rm) : new this(0);
  41490. r.s = y.s;
  41491. // y is ±Infinity or x is ±0
  41492. } else if (!y.d || x.isZero()) {
  41493. r = getPi(this, wpr, 1).times(0.5);
  41494. r.s = y.s;
  41495. // Both non-zero and finite
  41496. } else if (x.s < 0) {
  41497. this.precision = wpr;
  41498. this.rounding = 1;
  41499. r = this.atan(divide(y, x, wpr, 1));
  41500. x = getPi(this, wpr, 1);
  41501. this.precision = pr;
  41502. this.rounding = rm;
  41503. r = y.s < 0 ? r.minus(x) : r.plus(x);
  41504. } else {
  41505. r = this.atan(divide(y, x, wpr, 1));
  41506. }
  41507. return r;
  41508. }
  41509. /*
  41510. * Return a new Decimal whose value is the cube root of `x`, rounded to `precision` significant
  41511. * digits using rounding mode `rounding`.
  41512. *
  41513. * x {number|string|Decimal}
  41514. *
  41515. */
  41516. function cbrt(x) {
  41517. return new this(x).cbrt();
  41518. }
  41519. /*
  41520. * Return a new Decimal whose value is `x` rounded to an integer using `ROUND_CEIL`.
  41521. *
  41522. * x {number|string|Decimal}
  41523. *
  41524. */
  41525. function ceil(x) {
  41526. return finalise(x = new this(x), x.e + 1, 2);
  41527. }
  41528. /*
  41529. * Configure global settings for a Decimal constructor.
  41530. *
  41531. * `obj` is an object with one or more of the following properties,
  41532. *
  41533. * precision {number}
  41534. * rounding {number}
  41535. * toExpNeg {number}
  41536. * toExpPos {number}
  41537. * maxE {number}
  41538. * minE {number}
  41539. * modulo {number}
  41540. * crypto {boolean|number}
  41541. * defaults {true}
  41542. *
  41543. * E.g. Decimal.config({ precision: 20, rounding: 4 })
  41544. *
  41545. */
  41546. function config(obj) {
  41547. if (!obj || typeof obj !== 'object') throw Error(decimalError + 'Object expected');
  41548. var i, p, v,
  41549. useDefaults = obj.defaults === true,
  41550. ps = [
  41551. 'precision', 1, MAX_DIGITS,
  41552. 'rounding', 0, 8,
  41553. 'toExpNeg', -EXP_LIMIT, 0,
  41554. 'toExpPos', 0, EXP_LIMIT,
  41555. 'maxE', 0, EXP_LIMIT,
  41556. 'minE', -EXP_LIMIT, 0,
  41557. 'modulo', 0, 9
  41558. ];
  41559. for (i = 0; i < ps.length; i += 3) {
  41560. if (p = ps[i], useDefaults) this[p] = DEFAULTS[p];
  41561. if ((v = obj[p]) !== void 0) {
  41562. if (mathfloor(v) === v && v >= ps[i + 1] && v <= ps[i + 2]) this[p] = v;
  41563. else throw Error(invalidArgument + p + ': ' + v);
  41564. }
  41565. }
  41566. if (p = 'crypto', useDefaults) this[p] = DEFAULTS[p];
  41567. if ((v = obj[p]) !== void 0) {
  41568. if (v === true || v === false || v === 0 || v === 1) {
  41569. if (v) {
  41570. if (typeof crypto != 'undefined' && crypto &&
  41571. (crypto.getRandomValues || crypto.randomBytes)) {
  41572. this[p] = true;
  41573. } else {
  41574. throw Error(cryptoUnavailable);
  41575. }
  41576. } else {
  41577. this[p] = false;
  41578. }
  41579. } else {
  41580. throw Error(invalidArgument + p + ': ' + v);
  41581. }
  41582. }
  41583. return this;
  41584. }
  41585. /*
  41586. * Return a new Decimal whose value is the cosine of `x`, rounded to `precision` significant
  41587. * digits using rounding mode `rounding`.
  41588. *
  41589. * x {number|string|Decimal} A value in radians.
  41590. *
  41591. */
  41592. function cos(x) {
  41593. return new this(x).cos();
  41594. }
  41595. /*
  41596. * Return a new Decimal whose value is the hyperbolic cosine of `x`, rounded to precision
  41597. * significant digits using rounding mode `rounding`.
  41598. *
  41599. * x {number|string|Decimal} A value in radians.
  41600. *
  41601. */
  41602. function cosh(x) {
  41603. return new this(x).cosh();
  41604. }
  41605. /*
  41606. * Create and return a Decimal constructor with the same configuration properties as this Decimal
  41607. * constructor.
  41608. *
  41609. */
  41610. function clone(obj) {
  41611. var i, p, ps;
  41612. /*
  41613. * The Decimal constructor and exported function.
  41614. * Return a new Decimal instance.
  41615. *
  41616. * v {number|string|Decimal} A numeric value.
  41617. *
  41618. */
  41619. function Decimal(v) {
  41620. var e, i, t,
  41621. x = this;
  41622. // Decimal called without new.
  41623. if (!(x instanceof Decimal)) return new Decimal(v);
  41624. // Retain a reference to this Decimal constructor, and shadow Decimal.prototype.constructor
  41625. // which points to Object.
  41626. x.constructor = Decimal;
  41627. // Duplicate.
  41628. if (v instanceof Decimal) {
  41629. x.s = v.s;
  41630. x.e = v.e;
  41631. x.d = (v = v.d) ? v.slice() : v;
  41632. return;
  41633. }
  41634. t = typeof v;
  41635. if (t === 'number') {
  41636. if (v === 0) {
  41637. x.s = 1 / v < 0 ? -1 : 1;
  41638. x.e = 0;
  41639. x.d = [0];
  41640. return;
  41641. }
  41642. if (v < 0) {
  41643. v = -v;
  41644. x.s = -1;
  41645. } else {
  41646. x.s = 1;
  41647. }
  41648. // Fast path for small integers.
  41649. if (v === ~~v && v < 1e7) {
  41650. for (e = 0, i = v; i >= 10; i /= 10) e++;
  41651. x.e = e;
  41652. x.d = [v];
  41653. return;
  41654. // Infinity, NaN.
  41655. } else if (v * 0 !== 0) {
  41656. if (!v) x.s = NaN;
  41657. x.e = NaN;
  41658. x.d = null;
  41659. return;
  41660. }
  41661. return parseDecimal(x, v.toString());
  41662. } else if (t !== 'string') {
  41663. throw Error(invalidArgument + v);
  41664. }
  41665. // Minus sign?
  41666. if (v.charCodeAt(0) === 45) {
  41667. v = v.slice(1);
  41668. x.s = -1;
  41669. } else {
  41670. x.s = 1;
  41671. }
  41672. return isDecimal.test(v) ? parseDecimal(x, v) : parseOther(x, v);
  41673. }
  41674. Decimal.prototype = P;
  41675. Decimal.ROUND_UP = 0;
  41676. Decimal.ROUND_DOWN = 1;
  41677. Decimal.ROUND_CEIL = 2;
  41678. Decimal.ROUND_FLOOR = 3;
  41679. Decimal.ROUND_HALF_UP = 4;
  41680. Decimal.ROUND_HALF_DOWN = 5;
  41681. Decimal.ROUND_HALF_EVEN = 6;
  41682. Decimal.ROUND_HALF_CEIL = 7;
  41683. Decimal.ROUND_HALF_FLOOR = 8;
  41684. Decimal.EUCLID = 9;
  41685. Decimal.config = Decimal.set = config;
  41686. Decimal.clone = clone;
  41687. Decimal.isDecimal = isDecimalInstance;
  41688. Decimal.abs = abs;
  41689. Decimal.acos = acos;
  41690. Decimal.acosh = acosh; // ES6
  41691. Decimal.add = add;
  41692. Decimal.asin = asin;
  41693. Decimal.asinh = asinh; // ES6
  41694. Decimal.atan = atan;
  41695. Decimal.atanh = atanh; // ES6
  41696. Decimal.atan2 = atan2;
  41697. Decimal.cbrt = cbrt; // ES6
  41698. Decimal.ceil = ceil;
  41699. Decimal.cos = cos;
  41700. Decimal.cosh = cosh; // ES6
  41701. Decimal.div = div;
  41702. Decimal.exp = exp;
  41703. Decimal.floor = floor;
  41704. Decimal.hypot = hypot; // ES6
  41705. Decimal.ln = ln;
  41706. Decimal.log = log;
  41707. Decimal.log10 = log10; // ES6
  41708. Decimal.log2 = log2; // ES6
  41709. Decimal.max = max;
  41710. Decimal.min = min;
  41711. Decimal.mod = mod;
  41712. Decimal.mul = mul;
  41713. Decimal.pow = pow;
  41714. Decimal.random = random;
  41715. Decimal.round = round;
  41716. Decimal.sign = sign; // ES6
  41717. Decimal.sin = sin;
  41718. Decimal.sinh = sinh; // ES6
  41719. Decimal.sqrt = sqrt;
  41720. Decimal.sub = sub;
  41721. Decimal.tan = tan;
  41722. Decimal.tanh = tanh; // ES6
  41723. Decimal.trunc = trunc; // ES6
  41724. if (obj === void 0) obj = {};
  41725. if (obj) {
  41726. if (obj.defaults !== true) {
  41727. ps = ['precision', 'rounding', 'toExpNeg', 'toExpPos', 'maxE', 'minE', 'modulo', 'crypto'];
  41728. for (i = 0; i < ps.length;) if (!obj.hasOwnProperty(p = ps[i++])) obj[p] = this[p];
  41729. }
  41730. }
  41731. Decimal.config(obj);
  41732. return Decimal;
  41733. }
  41734. /*
  41735. * Return a new Decimal whose value is `x` divided by `y`, rounded to `precision` significant
  41736. * digits using rounding mode `rounding`.
  41737. *
  41738. * x {number|string|Decimal}
  41739. * y {number|string|Decimal}
  41740. *
  41741. */
  41742. function div(x, y) {
  41743. return new this(x).div(y);
  41744. }
  41745. /*
  41746. * Return a new Decimal whose value is the natural exponential of `x`, rounded to `precision`
  41747. * significant digits using rounding mode `rounding`.
  41748. *
  41749. * x {number|string|Decimal} The power to which to raise the base of the natural log.
  41750. *
  41751. */
  41752. function exp(x) {
  41753. return new this(x).exp();
  41754. }
  41755. /*
  41756. * Return a new Decimal whose value is `x` round to an integer using `ROUND_FLOOR`.
  41757. *
  41758. * x {number|string|Decimal}
  41759. *
  41760. */
  41761. function floor(x) {
  41762. return finalise(x = new this(x), x.e + 1, 3);
  41763. }
  41764. /*
  41765. * Return a new Decimal whose value is the square root of the sum of the squares of the arguments,
  41766. * rounded to `precision` significant digits using rounding mode `rounding`.
  41767. *
  41768. * hypot(a, b, ...) = sqrt(a^2 + b^2 + ...)
  41769. *
  41770. */
  41771. function hypot() {
  41772. var i, n,
  41773. t = new this(0);
  41774. external = false;
  41775. for (i = 0; i < arguments.length;) {
  41776. n = new this(arguments[i++]);
  41777. if (!n.d) {
  41778. if (n.s) {
  41779. external = true;
  41780. return new this(1 / 0);
  41781. }
  41782. t = n;
  41783. } else if (t.d) {
  41784. t = t.plus(n.times(n));
  41785. }
  41786. }
  41787. external = true;
  41788. return t.sqrt();
  41789. }
  41790. /*
  41791. * Return true if object is a Decimal instance (where Decimal is any Decimal constructor),
  41792. * otherwise return false.
  41793. *
  41794. */
  41795. function isDecimalInstance(obj) {
  41796. return obj instanceof Decimal || obj && obj.name === '[object Decimal]' || false;
  41797. }
  41798. /*
  41799. * Return a new Decimal whose value is the natural logarithm of `x`, rounded to `precision`
  41800. * significant digits using rounding mode `rounding`.
  41801. *
  41802. * x {number|string|Decimal}
  41803. *
  41804. */
  41805. function ln(x) {
  41806. return new this(x).ln();
  41807. }
  41808. /*
  41809. * Return a new Decimal whose value is the log of `x` to the base `y`, or to base 10 if no base
  41810. * is specified, rounded to `precision` significant digits using rounding mode `rounding`.
  41811. *
  41812. * log[y](x)
  41813. *
  41814. * x {number|string|Decimal} The argument of the logarithm.
  41815. * y {number|string|Decimal} The base of the logarithm.
  41816. *
  41817. */
  41818. function log(x, y) {
  41819. return new this(x).log(y);
  41820. }
  41821. /*
  41822. * Return a new Decimal whose value is the base 2 logarithm of `x`, rounded to `precision`
  41823. * significant digits using rounding mode `rounding`.
  41824. *
  41825. * x {number|string|Decimal}
  41826. *
  41827. */
  41828. function log2(x) {
  41829. return new this(x).log(2);
  41830. }
  41831. /*
  41832. * Return a new Decimal whose value is the base 10 logarithm of `x`, rounded to `precision`
  41833. * significant digits using rounding mode `rounding`.
  41834. *
  41835. * x {number|string|Decimal}
  41836. *
  41837. */
  41838. function log10(x) {
  41839. return new this(x).log(10);
  41840. }
  41841. /*
  41842. * Return a new Decimal whose value is the maximum of the arguments.
  41843. *
  41844. * arguments {number|string|Decimal}
  41845. *
  41846. */
  41847. function max() {
  41848. return maxOrMin(this, arguments, 'lt');
  41849. }
  41850. /*
  41851. * Return a new Decimal whose value is the minimum of the arguments.
  41852. *
  41853. * arguments {number|string|Decimal}
  41854. *
  41855. */
  41856. function min() {
  41857. return maxOrMin(this, arguments, 'gt');
  41858. }
  41859. /*
  41860. * Return a new Decimal whose value is `x` modulo `y`, rounded to `precision` significant digits
  41861. * using rounding mode `rounding`.
  41862. *
  41863. * x {number|string|Decimal}
  41864. * y {number|string|Decimal}
  41865. *
  41866. */
  41867. function mod(x, y) {
  41868. return new this(x).mod(y);
  41869. }
  41870. /*
  41871. * Return a new Decimal whose value is `x` multiplied by `y`, rounded to `precision` significant
  41872. * digits using rounding mode `rounding`.
  41873. *
  41874. * x {number|string|Decimal}
  41875. * y {number|string|Decimal}
  41876. *
  41877. */
  41878. function mul(x, y) {
  41879. return new this(x).mul(y);
  41880. }
  41881. /*
  41882. * Return a new Decimal whose value is `x` raised to the power `y`, rounded to precision
  41883. * significant digits using rounding mode `rounding`.
  41884. *
  41885. * x {number|string|Decimal} The base.
  41886. * y {number|string|Decimal} The exponent.
  41887. *
  41888. */
  41889. function pow(x, y) {
  41890. return new this(x).pow(y);
  41891. }
  41892. /*
  41893. * Returns a new Decimal with a random value equal to or greater than 0 and less than 1, and with
  41894. * `sd`, or `Decimal.precision` if `sd` is omitted, significant digits (or less if trailing zeros
  41895. * are produced).
  41896. *
  41897. * [sd] {number} Significant digits. Integer, 0 to MAX_DIGITS inclusive.
  41898. *
  41899. */
  41900. function random(sd) {
  41901. var d, e, k, n,
  41902. i = 0,
  41903. r = new this(1),
  41904. rd = [];
  41905. if (sd === void 0) sd = this.precision;
  41906. else checkInt32(sd, 1, MAX_DIGITS);
  41907. k = Math.ceil(sd / LOG_BASE);
  41908. if (!this.crypto) {
  41909. for (; i < k;) rd[i++] = Math.random() * 1e7 | 0;
  41910. // Browsers supporting crypto.getRandomValues.
  41911. } else if (crypto.getRandomValues) {
  41912. d = crypto.getRandomValues(new Uint32Array(k));
  41913. for (; i < k;) {
  41914. n = d[i];
  41915. // 0 <= n < 4294967296
  41916. // Probability n >= 4.29e9, is 4967296 / 4294967296 = 0.00116 (1 in 865).
  41917. if (n >= 4.29e9) {
  41918. d[i] = crypto.getRandomValues(new Uint32Array(1))[0];
  41919. } else {
  41920. // 0 <= n <= 4289999999
  41921. // 0 <= (n % 1e7) <= 9999999
  41922. rd[i++] = n % 1e7;
  41923. }
  41924. }
  41925. // Node.js supporting crypto.randomBytes.
  41926. } else if (crypto.randomBytes) {
  41927. // buffer
  41928. d = crypto.randomBytes(k *= 4);
  41929. for (; i < k;) {
  41930. // 0 <= n < 2147483648
  41931. n = d[i] + (d[i + 1] << 8) + (d[i + 2] << 16) + ((d[i + 3] & 0x7f) << 24);
  41932. // Probability n >= 2.14e9, is 7483648 / 2147483648 = 0.0035 (1 in 286).
  41933. if (n >= 2.14e9) {
  41934. crypto.randomBytes(4).copy(d, i);
  41935. } else {
  41936. // 0 <= n <= 2139999999
  41937. // 0 <= (n % 1e7) <= 9999999
  41938. rd.push(n % 1e7);
  41939. i += 4;
  41940. }
  41941. }
  41942. i = k / 4;
  41943. } else {
  41944. throw Error(cryptoUnavailable);
  41945. }
  41946. k = rd[--i];
  41947. sd %= LOG_BASE;
  41948. // Convert trailing digits to zeros according to sd.
  41949. if (k && sd) {
  41950. n = mathpow(10, LOG_BASE - sd);
  41951. rd[i] = (k / n | 0) * n;
  41952. }
  41953. // Remove trailing words which are zero.
  41954. for (; rd[i] === 0; i--) rd.pop();
  41955. // Zero?
  41956. if (i < 0) {
  41957. e = 0;
  41958. rd = [0];
  41959. } else {
  41960. e = -1;
  41961. // Remove leading words which are zero and adjust exponent accordingly.
  41962. for (; rd[0] === 0; e -= LOG_BASE) rd.shift();
  41963. // Count the digits of the first word of rd to determine leading zeros.
  41964. for (k = 1, n = rd[0]; n >= 10; n /= 10) k++;
  41965. // Adjust the exponent for leading zeros of the first word of rd.
  41966. if (k < LOG_BASE) e -= LOG_BASE - k;
  41967. }
  41968. r.e = e;
  41969. r.d = rd;
  41970. return r;
  41971. }
  41972. /*
  41973. * Return a new Decimal whose value is `x` rounded to an integer using rounding mode `rounding`.
  41974. *
  41975. * To emulate `Math.round`, set rounding to 7 (ROUND_HALF_CEIL).
  41976. *
  41977. * x {number|string|Decimal}
  41978. *
  41979. */
  41980. function round(x) {
  41981. return finalise(x = new this(x), x.e + 1, this.rounding);
  41982. }
  41983. /*
  41984. * Return
  41985. * 1 if x > 0,
  41986. * -1 if x < 0,
  41987. * 0 if x is 0,
  41988. * -0 if x is -0,
  41989. * NaN otherwise
  41990. *
  41991. */
  41992. function sign(x) {
  41993. x = new this(x);
  41994. return x.d ? (x.d[0] ? x.s : 0 * x.s) : x.s || NaN;
  41995. }
  41996. /*
  41997. * Return a new Decimal whose value is the sine of `x`, rounded to `precision` significant digits
  41998. * using rounding mode `rounding`.
  41999. *
  42000. * x {number|string|Decimal} A value in radians.
  42001. *
  42002. */
  42003. function sin(x) {
  42004. return new this(x).sin();
  42005. }
  42006. /*
  42007. * Return a new Decimal whose value is the hyperbolic sine of `x`, rounded to `precision`
  42008. * significant digits using rounding mode `rounding`.
  42009. *
  42010. * x {number|string|Decimal} A value in radians.
  42011. *
  42012. */
  42013. function sinh(x) {
  42014. return new this(x).sinh();
  42015. }
  42016. /*
  42017. * Return a new Decimal whose value is the square root of `x`, rounded to `precision` significant
  42018. * digits using rounding mode `rounding`.
  42019. *
  42020. * x {number|string|Decimal}
  42021. *
  42022. */
  42023. function sqrt(x) {
  42024. return new this(x).sqrt();
  42025. }
  42026. /*
  42027. * Return a new Decimal whose value is `x` minus `y`, rounded to `precision` significant digits
  42028. * using rounding mode `rounding`.
  42029. *
  42030. * x {number|string|Decimal}
  42031. * y {number|string|Decimal}
  42032. *
  42033. */
  42034. function sub(x, y) {
  42035. return new this(x).sub(y);
  42036. }
  42037. /*
  42038. * Return a new Decimal whose value is the tangent of `x`, rounded to `precision` significant
  42039. * digits using rounding mode `rounding`.
  42040. *
  42041. * x {number|string|Decimal} A value in radians.
  42042. *
  42043. */
  42044. function tan(x) {
  42045. return new this(x).tan();
  42046. }
  42047. /*
  42048. * Return a new Decimal whose value is the hyperbolic tangent of `x`, rounded to `precision`
  42049. * significant digits using rounding mode `rounding`.
  42050. *
  42051. * x {number|string|Decimal} A value in radians.
  42052. *
  42053. */
  42054. function tanh(x) {
  42055. return new this(x).tanh();
  42056. }
  42057. /*
  42058. * Return a new Decimal whose value is `x` truncated to an integer.
  42059. *
  42060. * x {number|string|Decimal}
  42061. *
  42062. */
  42063. function trunc(x) {
  42064. return finalise(x = new this(x), x.e + 1, 1);
  42065. }
  42066. // Create and configure initial Decimal constructor.
  42067. Decimal = clone(DEFAULTS);
  42068. Decimal['default'] = Decimal.Decimal = Decimal;
  42069. // Create the internal constants from their string values.
  42070. LN10 = new Decimal(LN10);
  42071. PI = new Decimal(PI);
  42072. // Export.
  42073. // AMD.
  42074. if (true) {
  42075. !(__WEBPACK_AMD_DEFINE_RESULT__ = (function () {
  42076. return Decimal;
  42077. }).call(exports, __webpack_require__, exports, module),
  42078. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  42079. // Node and other environments that support module.exports.
  42080. } else {}
  42081. })(this);
  42082. /***/ }),
  42083. /***/ "./node_modules/jquery/dist/jquery.js":
  42084. /*!********************************************!*\
  42085. !*** ./node_modules/jquery/dist/jquery.js ***!
  42086. \********************************************/
  42087. /*! no static exports found */
  42088. /***/ (function(module, exports, __webpack_require__) {
  42089. var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
  42090. * jQuery JavaScript Library v3.3.1
  42091. * https://jquery.com/
  42092. *
  42093. * Includes Sizzle.js
  42094. * https://sizzlejs.com/
  42095. *
  42096. * Copyright JS Foundation and other contributors
  42097. * Released under the MIT license
  42098. * https://jquery.org/license
  42099. *
  42100. * Date: 2018-01-20T17:24Z
  42101. */
  42102. ( function( global, factory ) {
  42103. "use strict";
  42104. if ( true && typeof module.exports === "object" ) {
  42105. // For CommonJS and CommonJS-like environments where a proper `window`
  42106. // is present, execute the factory and get jQuery.
  42107. // For environments that do not have a `window` with a `document`
  42108. // (such as Node.js), expose a factory as module.exports.
  42109. // This accentuates the need for the creation of a real `window`.
  42110. // e.g. var jQuery = require("jquery")(window);
  42111. // See ticket #14549 for more info.
  42112. module.exports = global.document ?
  42113. factory( global, true ) :
  42114. function( w ) {
  42115. if ( !w.document ) {
  42116. throw new Error( "jQuery requires a window with a document" );
  42117. }
  42118. return factory( w );
  42119. };
  42120. } else {
  42121. factory( global );
  42122. }
  42123. // Pass this if window is not defined yet
  42124. } )( typeof window !== "undefined" ? window : this, function( window, noGlobal ) {
  42125. // Edge <= 12 - 13+, Firefox <=18 - 45+, IE 10 - 11, Safari 5.1 - 9+, iOS 6 - 9.1
  42126. // throw exceptions when non-strict code (e.g., ASP.NET 4.5) accesses strict mode
  42127. // arguments.callee.caller (trac-13335). But as of jQuery 3.0 (2016), strict mode should be common
  42128. // enough that all such attempts are guarded in a try block.
  42129. "use strict";
  42130. var arr = [];
  42131. var document = window.document;
  42132. var getProto = Object.getPrototypeOf;
  42133. var slice = arr.slice;
  42134. var concat = arr.concat;
  42135. var push = arr.push;
  42136. var indexOf = arr.indexOf;
  42137. var class2type = {};
  42138. var toString = class2type.toString;
  42139. var hasOwn = class2type.hasOwnProperty;
  42140. var fnToString = hasOwn.toString;
  42141. var ObjectFunctionString = fnToString.call( Object );
  42142. var support = {};
  42143. var isFunction = function isFunction( obj ) {
  42144. // Support: Chrome <=57, Firefox <=52
  42145. // In some browsers, typeof returns "function" for HTML <object> elements
  42146. // (i.e., `typeof document.createElement( "object" ) === "function"`).
  42147. // We don't want to classify *any* DOM node as a function.
  42148. return typeof obj === "function" && typeof obj.nodeType !== "number";
  42149. };
  42150. var isWindow = function isWindow( obj ) {
  42151. return obj != null && obj === obj.window;
  42152. };
  42153. var preservedScriptAttributes = {
  42154. type: true,
  42155. src: true,
  42156. noModule: true
  42157. };
  42158. function DOMEval( code, doc, node ) {
  42159. doc = doc || document;
  42160. var i,
  42161. script = doc.createElement( "script" );
  42162. script.text = code;
  42163. if ( node ) {
  42164. for ( i in preservedScriptAttributes ) {
  42165. if ( node[ i ] ) {
  42166. script[ i ] = node[ i ];
  42167. }
  42168. }
  42169. }
  42170. doc.head.appendChild( script ).parentNode.removeChild( script );
  42171. }
  42172. function toType( obj ) {
  42173. if ( obj == null ) {
  42174. return obj + "";
  42175. }
  42176. // Support: Android <=2.3 only (functionish RegExp)
  42177. return typeof obj === "object" || typeof obj === "function" ?
  42178. class2type[ toString.call( obj ) ] || "object" :
  42179. typeof obj;
  42180. }
  42181. /* global Symbol */
  42182. // Defining this global in .eslintrc.json would create a danger of using the global
  42183. // unguarded in another place, it seems safer to define global only for this module
  42184. var
  42185. version = "3.3.1",
  42186. // Define a local copy of jQuery
  42187. jQuery = function( selector, context ) {
  42188. // The jQuery object is actually just the init constructor 'enhanced'
  42189. // Need init if jQuery is called (just allow error to be thrown if not included)
  42190. return new jQuery.fn.init( selector, context );
  42191. },
  42192. // Support: Android <=4.0 only
  42193. // Make sure we trim BOM and NBSP
  42194. rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;
  42195. jQuery.fn = jQuery.prototype = {
  42196. // The current version of jQuery being used
  42197. jquery: version,
  42198. constructor: jQuery,
  42199. // The default length of a jQuery object is 0
  42200. length: 0,
  42201. toArray: function() {
  42202. return slice.call( this );
  42203. },
  42204. // Get the Nth element in the matched element set OR
  42205. // Get the whole matched element set as a clean array
  42206. get: function( num ) {
  42207. // Return all the elements in a clean array
  42208. if ( num == null ) {
  42209. return slice.call( this );
  42210. }
  42211. // Return just the one element from the set
  42212. return num < 0 ? this[ num + this.length ] : this[ num ];
  42213. },
  42214. // Take an array of elements and push it onto the stack
  42215. // (returning the new matched element set)
  42216. pushStack: function( elems ) {
  42217. // Build a new jQuery matched element set
  42218. var ret = jQuery.merge( this.constructor(), elems );
  42219. // Add the old object onto the stack (as a reference)
  42220. ret.prevObject = this;
  42221. // Return the newly-formed element set
  42222. return ret;
  42223. },
  42224. // Execute a callback for every element in the matched set.
  42225. each: function( callback ) {
  42226. return jQuery.each( this, callback );
  42227. },
  42228. map: function( callback ) {
  42229. return this.pushStack( jQuery.map( this, function( elem, i ) {
  42230. return callback.call( elem, i, elem );
  42231. } ) );
  42232. },
  42233. slice: function() {
  42234. return this.pushStack( slice.apply( this, arguments ) );
  42235. },
  42236. first: function() {
  42237. return this.eq( 0 );
  42238. },
  42239. last: function() {
  42240. return this.eq( -1 );
  42241. },
  42242. eq: function( i ) {
  42243. var len = this.length,
  42244. j = +i + ( i < 0 ? len : 0 );
  42245. return this.pushStack( j >= 0 && j < len ? [ this[ j ] ] : [] );
  42246. },
  42247. end: function() {
  42248. return this.prevObject || this.constructor();
  42249. },
  42250. // For internal use only.
  42251. // Behaves like an Array's method, not like a jQuery method.
  42252. push: push,
  42253. sort: arr.sort,
  42254. splice: arr.splice
  42255. };
  42256. jQuery.extend = jQuery.fn.extend = function() {
  42257. var options, name, src, copy, copyIsArray, clone,
  42258. target = arguments[ 0 ] || {},
  42259. i = 1,
  42260. length = arguments.length,
  42261. deep = false;
  42262. // Handle a deep copy situation
  42263. if ( typeof target === "boolean" ) {
  42264. deep = target;
  42265. // Skip the boolean and the target
  42266. target = arguments[ i ] || {};
  42267. i++;
  42268. }
  42269. // Handle case when target is a string or something (possible in deep copy)
  42270. if ( typeof target !== "object" && !isFunction( target ) ) {
  42271. target = {};
  42272. }
  42273. // Extend jQuery itself if only one argument is passed
  42274. if ( i === length ) {
  42275. target = this;
  42276. i--;
  42277. }
  42278. for ( ; i < length; i++ ) {
  42279. // Only deal with non-null/undefined values
  42280. if ( ( options = arguments[ i ] ) != null ) {
  42281. // Extend the base object
  42282. for ( name in options ) {
  42283. src = target[ name ];
  42284. copy = options[ name ];
  42285. // Prevent never-ending loop
  42286. if ( target === copy ) {
  42287. continue;
  42288. }
  42289. // Recurse if we're merging plain objects or arrays
  42290. if ( deep && copy && ( jQuery.isPlainObject( copy ) ||
  42291. ( copyIsArray = Array.isArray( copy ) ) ) ) {
  42292. if ( copyIsArray ) {
  42293. copyIsArray = false;
  42294. clone = src && Array.isArray( src ) ? src : [];
  42295. } else {
  42296. clone = src && jQuery.isPlainObject( src ) ? src : {};
  42297. }
  42298. // Never move original objects, clone them
  42299. target[ name ] = jQuery.extend( deep, clone, copy );
  42300. // Don't bring in undefined values
  42301. } else if ( copy !== undefined ) {
  42302. target[ name ] = copy;
  42303. }
  42304. }
  42305. }
  42306. }
  42307. // Return the modified object
  42308. return target;
  42309. };
  42310. jQuery.extend( {
  42311. // Unique for each copy of jQuery on the page
  42312. expando: "jQuery" + ( version + Math.random() ).replace( /\D/g, "" ),
  42313. // Assume jQuery is ready without the ready module
  42314. isReady: true,
  42315. error: function( msg ) {
  42316. throw new Error( msg );
  42317. },
  42318. noop: function() {},
  42319. isPlainObject: function( obj ) {
  42320. var proto, Ctor;
  42321. // Detect obvious negatives
  42322. // Use toString instead of jQuery.type to catch host objects
  42323. if ( !obj || toString.call( obj ) !== "[object Object]" ) {
  42324. return false;
  42325. }
  42326. proto = getProto( obj );
  42327. // Objects with no prototype (e.g., `Object.create( null )`) are plain
  42328. if ( !proto ) {
  42329. return true;
  42330. }
  42331. // Objects with prototype are plain iff they were constructed by a global Object function
  42332. Ctor = hasOwn.call( proto, "constructor" ) && proto.constructor;
  42333. return typeof Ctor === "function" && fnToString.call( Ctor ) === ObjectFunctionString;
  42334. },
  42335. isEmptyObject: function( obj ) {
  42336. /* eslint-disable no-unused-vars */
  42337. // See https://github.com/eslint/eslint/issues/6125
  42338. var name;
  42339. for ( name in obj ) {
  42340. return false;
  42341. }
  42342. return true;
  42343. },
  42344. // Evaluates a script in a global context
  42345. globalEval: function( code ) {
  42346. DOMEval( code );
  42347. },
  42348. each: function( obj, callback ) {
  42349. var length, i = 0;
  42350. if ( isArrayLike( obj ) ) {
  42351. length = obj.length;
  42352. for ( ; i < length; i++ ) {
  42353. if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
  42354. break;
  42355. }
  42356. }
  42357. } else {
  42358. for ( i in obj ) {
  42359. if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
  42360. break;
  42361. }
  42362. }
  42363. }
  42364. return obj;
  42365. },
  42366. // Support: Android <=4.0 only
  42367. trim: function( text ) {
  42368. return text == null ?
  42369. "" :
  42370. ( text + "" ).replace( rtrim, "" );
  42371. },
  42372. // results is for internal usage only
  42373. makeArray: function( arr, results ) {
  42374. var ret = results || [];
  42375. if ( arr != null ) {
  42376. if ( isArrayLike( Object( arr ) ) ) {
  42377. jQuery.merge( ret,
  42378. typeof arr === "string" ?
  42379. [ arr ] : arr
  42380. );
  42381. } else {
  42382. push.call( ret, arr );
  42383. }
  42384. }
  42385. return ret;
  42386. },
  42387. inArray: function( elem, arr, i ) {
  42388. return arr == null ? -1 : indexOf.call( arr, elem, i );
  42389. },
  42390. // Support: Android <=4.0 only, PhantomJS 1 only
  42391. // push.apply(_, arraylike) throws on ancient WebKit
  42392. merge: function( first, second ) {
  42393. var len = +second.length,
  42394. j = 0,
  42395. i = first.length;
  42396. for ( ; j < len; j++ ) {
  42397. first[ i++ ] = second[ j ];
  42398. }
  42399. first.length = i;
  42400. return first;
  42401. },
  42402. grep: function( elems, callback, invert ) {
  42403. var callbackInverse,
  42404. matches = [],
  42405. i = 0,
  42406. length = elems.length,
  42407. callbackExpect = !invert;
  42408. // Go through the array, only saving the items
  42409. // that pass the validator function
  42410. for ( ; i < length; i++ ) {
  42411. callbackInverse = !callback( elems[ i ], i );
  42412. if ( callbackInverse !== callbackExpect ) {
  42413. matches.push( elems[ i ] );
  42414. }
  42415. }
  42416. return matches;
  42417. },
  42418. // arg is for internal usage only
  42419. map: function( elems, callback, arg ) {
  42420. var length, value,
  42421. i = 0,
  42422. ret = [];
  42423. // Go through the array, translating each of the items to their new values
  42424. if ( isArrayLike( elems ) ) {
  42425. length = elems.length;
  42426. for ( ; i < length; i++ ) {
  42427. value = callback( elems[ i ], i, arg );
  42428. if ( value != null ) {
  42429. ret.push( value );
  42430. }
  42431. }
  42432. // Go through every key on the object,
  42433. } else {
  42434. for ( i in elems ) {
  42435. value = callback( elems[ i ], i, arg );
  42436. if ( value != null ) {
  42437. ret.push( value );
  42438. }
  42439. }
  42440. }
  42441. // Flatten any nested arrays
  42442. return concat.apply( [], ret );
  42443. },
  42444. // A global GUID counter for objects
  42445. guid: 1,
  42446. // jQuery.support is not used in Core but other projects attach their
  42447. // properties to it so it needs to exist.
  42448. support: support
  42449. } );
  42450. if ( typeof Symbol === "function" ) {
  42451. jQuery.fn[ Symbol.iterator ] = arr[ Symbol.iterator ];
  42452. }
  42453. // Populate the class2type map
  42454. jQuery.each( "Boolean Number String Function Array Date RegExp Object Error Symbol".split( " " ),
  42455. function( i, name ) {
  42456. class2type[ "[object " + name + "]" ] = name.toLowerCase();
  42457. } );
  42458. function isArrayLike( obj ) {
  42459. // Support: real iOS 8.2 only (not reproducible in simulator)
  42460. // `in` check used to prevent JIT error (gh-2145)
  42461. // hasOwn isn't used here due to false negatives
  42462. // regarding Nodelist length in IE
  42463. var length = !!obj && "length" in obj && obj.length,
  42464. type = toType( obj );
  42465. if ( isFunction( obj ) || isWindow( obj ) ) {
  42466. return false;
  42467. }
  42468. return type === "array" || length === 0 ||
  42469. typeof length === "number" && length > 0 && ( length - 1 ) in obj;
  42470. }
  42471. var Sizzle =
  42472. /*!
  42473. * Sizzle CSS Selector Engine v2.3.3
  42474. * https://sizzlejs.com/
  42475. *
  42476. * Copyright jQuery Foundation and other contributors
  42477. * Released under the MIT license
  42478. * http://jquery.org/license
  42479. *
  42480. * Date: 2016-08-08
  42481. */
  42482. (function( window ) {
  42483. var i,
  42484. support,
  42485. Expr,
  42486. getText,
  42487. isXML,
  42488. tokenize,
  42489. compile,
  42490. select,
  42491. outermostContext,
  42492. sortInput,
  42493. hasDuplicate,
  42494. // Local document vars
  42495. setDocument,
  42496. document,
  42497. docElem,
  42498. documentIsHTML,
  42499. rbuggyQSA,
  42500. rbuggyMatches,
  42501. matches,
  42502. contains,
  42503. // Instance-specific data
  42504. expando = "sizzle" + 1 * new Date(),
  42505. preferredDoc = window.document,
  42506. dirruns = 0,
  42507. done = 0,
  42508. classCache = createCache(),
  42509. tokenCache = createCache(),
  42510. compilerCache = createCache(),
  42511. sortOrder = function( a, b ) {
  42512. if ( a === b ) {
  42513. hasDuplicate = true;
  42514. }
  42515. return 0;
  42516. },
  42517. // Instance methods
  42518. hasOwn = ({}).hasOwnProperty,
  42519. arr = [],
  42520. pop = arr.pop,
  42521. push_native = arr.push,
  42522. push = arr.push,
  42523. slice = arr.slice,
  42524. // Use a stripped-down indexOf as it's faster than native
  42525. // https://jsperf.com/thor-indexof-vs-for/5
  42526. indexOf = function( list, elem ) {
  42527. var i = 0,
  42528. len = list.length;
  42529. for ( ; i < len; i++ ) {
  42530. if ( list[i] === elem ) {
  42531. return i;
  42532. }
  42533. }
  42534. return -1;
  42535. },
  42536. booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",
  42537. // Regular expressions
  42538. // http://www.w3.org/TR/css3-selectors/#whitespace
  42539. whitespace = "[\\x20\\t\\r\\n\\f]",
  42540. // http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier
  42541. identifier = "(?:\\\\.|[\\w-]|[^\0-\\xa0])+",
  42542. // Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors
  42543. attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace +
  42544. // Operator (capture 2)
  42545. "*([*^$|!~]?=)" + whitespace +
  42546. // "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]"
  42547. "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + whitespace +
  42548. "*\\]",
  42549. pseudos = ":(" + identifier + ")(?:\\((" +
  42550. // To reduce the number of selectors needing tokenize in the preFilter, prefer arguments:
  42551. // 1. quoted (capture 3; capture 4 or capture 5)
  42552. "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" +
  42553. // 2. simple (capture 6)
  42554. "((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" +
  42555. // 3. anything else (capture 2)
  42556. ".*" +
  42557. ")\\)|)",
  42558. // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter
  42559. rwhitespace = new RegExp( whitespace + "+", "g" ),
  42560. rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ),
  42561. rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ),
  42562. rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*" ),
  42563. rattributeQuotes = new RegExp( "=" + whitespace + "*([^\\]'\"]*?)" + whitespace + "*\\]", "g" ),
  42564. rpseudo = new RegExp( pseudos ),
  42565. ridentifier = new RegExp( "^" + identifier + "$" ),
  42566. matchExpr = {
  42567. "ID": new RegExp( "^#(" + identifier + ")" ),
  42568. "CLASS": new RegExp( "^\\.(" + identifier + ")" ),
  42569. "TAG": new RegExp( "^(" + identifier + "|[*])" ),
  42570. "ATTR": new RegExp( "^" + attributes ),
  42571. "PSEUDO": new RegExp( "^" + pseudos ),
  42572. "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace +
  42573. "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace +
  42574. "*(\\d+)|))" + whitespace + "*\\)|)", "i" ),
  42575. "bool": new RegExp( "^(?:" + booleans + ")$", "i" ),
  42576. // For use in libraries implementing .is()
  42577. // We use this for POS matching in `select`
  42578. "needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" +
  42579. whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" )
  42580. },
  42581. rinputs = /^(?:input|select|textarea|button)$/i,
  42582. rheader = /^h\d$/i,
  42583. rnative = /^[^{]+\{\s*\[native \w/,
  42584. // Easily-parseable/retrievable ID or TAG or CLASS selectors
  42585. rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,
  42586. rsibling = /[+~]/,
  42587. // CSS escapes
  42588. // http://www.w3.org/TR/CSS21/syndata.html#escaped-characters
  42589. runescape = new RegExp( "\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig" ),
  42590. funescape = function( _, escaped, escapedWhitespace ) {
  42591. var high = "0x" + escaped - 0x10000;
  42592. // NaN means non-codepoint
  42593. // Support: Firefox<24
  42594. // Workaround erroneous numeric interpretation of +"0x"
  42595. return high !== high || escapedWhitespace ?
  42596. escaped :
  42597. high < 0 ?
  42598. // BMP codepoint
  42599. String.fromCharCode( high + 0x10000 ) :
  42600. // Supplemental Plane codepoint (surrogate pair)
  42601. String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 );
  42602. },
  42603. // CSS string/identifier serialization
  42604. // https://drafts.csswg.org/cssom/#common-serializing-idioms
  42605. rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,
  42606. fcssescape = function( ch, asCodePoint ) {
  42607. if ( asCodePoint ) {
  42608. // U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER
  42609. if ( ch === "\0" ) {
  42610. return "\uFFFD";
  42611. }
  42612. // Control characters and (dependent upon position) numbers get escaped as code points
  42613. return ch.slice( 0, -1 ) + "\\" + ch.charCodeAt( ch.length - 1 ).toString( 16 ) + " ";
  42614. }
  42615. // Other potentially-special ASCII characters get backslash-escaped
  42616. return "\\" + ch;
  42617. },
  42618. // Used for iframes
  42619. // See setDocument()
  42620. // Removing the function wrapper causes a "Permission Denied"
  42621. // error in IE
  42622. unloadHandler = function() {
  42623. setDocument();
  42624. },
  42625. disabledAncestor = addCombinator(
  42626. function( elem ) {
  42627. return elem.disabled === true && ("form" in elem || "label" in elem);
  42628. },
  42629. { dir: "parentNode", next: "legend" }
  42630. );
  42631. // Optimize for push.apply( _, NodeList )
  42632. try {
  42633. push.apply(
  42634. (arr = slice.call( preferredDoc.childNodes )),
  42635. preferredDoc.childNodes
  42636. );
  42637. // Support: Android<4.0
  42638. // Detect silently failing push.apply
  42639. arr[ preferredDoc.childNodes.length ].nodeType;
  42640. } catch ( e ) {
  42641. push = { apply: arr.length ?
  42642. // Leverage slice if possible
  42643. function( target, els ) {
  42644. push_native.apply( target, slice.call(els) );
  42645. } :
  42646. // Support: IE<9
  42647. // Otherwise append directly
  42648. function( target, els ) {
  42649. var j = target.length,
  42650. i = 0;
  42651. // Can't trust NodeList.length
  42652. while ( (target[j++] = els[i++]) ) {}
  42653. target.length = j - 1;
  42654. }
  42655. };
  42656. }
  42657. function Sizzle( selector, context, results, seed ) {
  42658. var m, i, elem, nid, match, groups, newSelector,
  42659. newContext = context && context.ownerDocument,
  42660. // nodeType defaults to 9, since context defaults to document
  42661. nodeType = context ? context.nodeType : 9;
  42662. results = results || [];
  42663. // Return early from calls with invalid selector or context
  42664. if ( typeof selector !== "string" || !selector ||
  42665. nodeType !== 1 && nodeType !== 9 && nodeType !== 11 ) {
  42666. return results;
  42667. }
  42668. // Try to shortcut find operations (as opposed to filters) in HTML documents
  42669. if ( !seed ) {
  42670. if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) {
  42671. setDocument( context );
  42672. }
  42673. context = context || document;
  42674. if ( documentIsHTML ) {
  42675. // If the selector is sufficiently simple, try using a "get*By*" DOM method
  42676. // (excepting DocumentFragment context, where the methods don't exist)
  42677. if ( nodeType !== 11 && (match = rquickExpr.exec( selector )) ) {
  42678. // ID selector
  42679. if ( (m = match[1]) ) {
  42680. // Document context
  42681. if ( nodeType === 9 ) {
  42682. if ( (elem = context.getElementById( m )) ) {
  42683. // Support: IE, Opera, Webkit
  42684. // TODO: identify versions
  42685. // getElementById can match elements by name instead of ID
  42686. if ( elem.id === m ) {
  42687. results.push( elem );
  42688. return results;
  42689. }
  42690. } else {
  42691. return results;
  42692. }
  42693. // Element context
  42694. } else {
  42695. // Support: IE, Opera, Webkit
  42696. // TODO: identify versions
  42697. // getElementById can match elements by name instead of ID
  42698. if ( newContext && (elem = newContext.getElementById( m )) &&
  42699. contains( context, elem ) &&
  42700. elem.id === m ) {
  42701. results.push( elem );
  42702. return results;
  42703. }
  42704. }
  42705. // Type selector
  42706. } else if ( match[2] ) {
  42707. push.apply( results, context.getElementsByTagName( selector ) );
  42708. return results;
  42709. // Class selector
  42710. } else if ( (m = match[3]) && support.getElementsByClassName &&
  42711. context.getElementsByClassName ) {
  42712. push.apply( results, context.getElementsByClassName( m ) );
  42713. return results;
  42714. }
  42715. }
  42716. // Take advantage of querySelectorAll
  42717. if ( support.qsa &&
  42718. !compilerCache[ selector + " " ] &&
  42719. (!rbuggyQSA || !rbuggyQSA.test( selector )) ) {
  42720. if ( nodeType !== 1 ) {
  42721. newContext = context;
  42722. newSelector = selector;
  42723. // qSA looks outside Element context, which is not what we want
  42724. // Thanks to Andrew Dupont for this workaround technique
  42725. // Support: IE <=8
  42726. // Exclude object elements
  42727. } else if ( context.nodeName.toLowerCase() !== "object" ) {
  42728. // Capture the context ID, setting it first if necessary
  42729. if ( (nid = context.getAttribute( "id" )) ) {
  42730. nid = nid.replace( rcssescape, fcssescape );
  42731. } else {
  42732. context.setAttribute( "id", (nid = expando) );
  42733. }
  42734. // Prefix every selector in the list
  42735. groups = tokenize( selector );
  42736. i = groups.length;
  42737. while ( i-- ) {
  42738. groups[i] = "#" + nid + " " + toSelector( groups[i] );
  42739. }
  42740. newSelector = groups.join( "," );
  42741. // Expand context for sibling selectors
  42742. newContext = rsibling.test( selector ) && testContext( context.parentNode ) ||
  42743. context;
  42744. }
  42745. if ( newSelector ) {
  42746. try {
  42747. push.apply( results,
  42748. newContext.querySelectorAll( newSelector )
  42749. );
  42750. return results;
  42751. } catch ( qsaError ) {
  42752. } finally {
  42753. if ( nid === expando ) {
  42754. context.removeAttribute( "id" );
  42755. }
  42756. }
  42757. }
  42758. }
  42759. }
  42760. }
  42761. // All others
  42762. return select( selector.replace( rtrim, "$1" ), context, results, seed );
  42763. }
  42764. /**
  42765. * Create key-value caches of limited size
  42766. * @returns {function(string, object)} Returns the Object data after storing it on itself with
  42767. * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength)
  42768. * deleting the oldest entry
  42769. */
  42770. function createCache() {
  42771. var keys = [];
  42772. function cache( key, value ) {
  42773. // Use (key + " ") to avoid collision with native prototype properties (see Issue #157)
  42774. if ( keys.push( key + " " ) > Expr.cacheLength ) {
  42775. // Only keep the most recent entries
  42776. delete cache[ keys.shift() ];
  42777. }
  42778. return (cache[ key + " " ] = value);
  42779. }
  42780. return cache;
  42781. }
  42782. /**
  42783. * Mark a function for special use by Sizzle
  42784. * @param {Function} fn The function to mark
  42785. */
  42786. function markFunction( fn ) {
  42787. fn[ expando ] = true;
  42788. return fn;
  42789. }
  42790. /**
  42791. * Support testing using an element
  42792. * @param {Function} fn Passed the created element and returns a boolean result
  42793. */
  42794. function assert( fn ) {
  42795. var el = document.createElement("fieldset");
  42796. try {
  42797. return !!fn( el );
  42798. } catch (e) {
  42799. return false;
  42800. } finally {
  42801. // Remove from its parent by default
  42802. if ( el.parentNode ) {
  42803. el.parentNode.removeChild( el );
  42804. }
  42805. // release memory in IE
  42806. el = null;
  42807. }
  42808. }
  42809. /**
  42810. * Adds the same handler for all of the specified attrs
  42811. * @param {String} attrs Pipe-separated list of attributes
  42812. * @param {Function} handler The method that will be applied
  42813. */
  42814. function addHandle( attrs, handler ) {
  42815. var arr = attrs.split("|"),
  42816. i = arr.length;
  42817. while ( i-- ) {
  42818. Expr.attrHandle[ arr[i] ] = handler;
  42819. }
  42820. }
  42821. /**
  42822. * Checks document order of two siblings
  42823. * @param {Element} a
  42824. * @param {Element} b
  42825. * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b
  42826. */
  42827. function siblingCheck( a, b ) {
  42828. var cur = b && a,
  42829. diff = cur && a.nodeType === 1 && b.nodeType === 1 &&
  42830. a.sourceIndex - b.sourceIndex;
  42831. // Use IE sourceIndex if available on both nodes
  42832. if ( diff ) {
  42833. return diff;
  42834. }
  42835. // Check if b follows a
  42836. if ( cur ) {
  42837. while ( (cur = cur.nextSibling) ) {
  42838. if ( cur === b ) {
  42839. return -1;
  42840. }
  42841. }
  42842. }
  42843. return a ? 1 : -1;
  42844. }
  42845. /**
  42846. * Returns a function to use in pseudos for input types
  42847. * @param {String} type
  42848. */
  42849. function createInputPseudo( type ) {
  42850. return function( elem ) {
  42851. var name = elem.nodeName.toLowerCase();
  42852. return name === "input" && elem.type === type;
  42853. };
  42854. }
  42855. /**
  42856. * Returns a function to use in pseudos for buttons
  42857. * @param {String} type
  42858. */
  42859. function createButtonPseudo( type ) {
  42860. return function( elem ) {
  42861. var name = elem.nodeName.toLowerCase();
  42862. return (name === "input" || name === "button") && elem.type === type;
  42863. };
  42864. }
  42865. /**
  42866. * Returns a function to use in pseudos for :enabled/:disabled
  42867. * @param {Boolean} disabled true for :disabled; false for :enabled
  42868. */
  42869. function createDisabledPseudo( disabled ) {
  42870. // Known :disabled false positives: fieldset[disabled] > legend:nth-of-type(n+2) :can-disable
  42871. return function( elem ) {
  42872. // Only certain elements can match :enabled or :disabled
  42873. // https://html.spec.whatwg.org/multipage/scripting.html#selector-enabled
  42874. // https://html.spec.whatwg.org/multipage/scripting.html#selector-disabled
  42875. if ( "form" in elem ) {
  42876. // Check for inherited disabledness on relevant non-disabled elements:
  42877. // * listed form-associated elements in a disabled fieldset
  42878. // https://html.spec.whatwg.org/multipage/forms.html#category-listed
  42879. // https://html.spec.whatwg.org/multipage/forms.html#concept-fe-disabled
  42880. // * option elements in a disabled optgroup
  42881. // https://html.spec.whatwg.org/multipage/forms.html#concept-option-disabled
  42882. // All such elements have a "form" property.
  42883. if ( elem.parentNode && elem.disabled === false ) {
  42884. // Option elements defer to a parent optgroup if present
  42885. if ( "label" in elem ) {
  42886. if ( "label" in elem.parentNode ) {
  42887. return elem.parentNode.disabled === disabled;
  42888. } else {
  42889. return elem.disabled === disabled;
  42890. }
  42891. }
  42892. // Support: IE 6 - 11
  42893. // Use the isDisabled shortcut property to check for disabled fieldset ancestors
  42894. return elem.isDisabled === disabled ||
  42895. // Where there is no isDisabled, check manually
  42896. /* jshint -W018 */
  42897. elem.isDisabled !== !disabled &&
  42898. disabledAncestor( elem ) === disabled;
  42899. }
  42900. return elem.disabled === disabled;
  42901. // Try to winnow out elements that can't be disabled before trusting the disabled property.
  42902. // Some victims get caught in our net (label, legend, menu, track), but it shouldn't
  42903. // even exist on them, let alone have a boolean value.
  42904. } else if ( "label" in elem ) {
  42905. return elem.disabled === disabled;
  42906. }
  42907. // Remaining elements are neither :enabled nor :disabled
  42908. return false;
  42909. };
  42910. }
  42911. /**
  42912. * Returns a function to use in pseudos for positionals
  42913. * @param {Function} fn
  42914. */
  42915. function createPositionalPseudo( fn ) {
  42916. return markFunction(function( argument ) {
  42917. argument = +argument;
  42918. return markFunction(function( seed, matches ) {
  42919. var j,
  42920. matchIndexes = fn( [], seed.length, argument ),
  42921. i = matchIndexes.length;
  42922. // Match elements found at the specified indexes
  42923. while ( i-- ) {
  42924. if ( seed[ (j = matchIndexes[i]) ] ) {
  42925. seed[j] = !(matches[j] = seed[j]);
  42926. }
  42927. }
  42928. });
  42929. });
  42930. }
  42931. /**
  42932. * Checks a node for validity as a Sizzle context
  42933. * @param {Element|Object=} context
  42934. * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value
  42935. */
  42936. function testContext( context ) {
  42937. return context && typeof context.getElementsByTagName !== "undefined" && context;
  42938. }
  42939. // Expose support vars for convenience
  42940. support = Sizzle.support = {};
  42941. /**
  42942. * Detects XML nodes
  42943. * @param {Element|Object} elem An element or a document
  42944. * @returns {Boolean} True iff elem is a non-HTML XML node
  42945. */
  42946. isXML = Sizzle.isXML = function( elem ) {
  42947. // documentElement is verified for cases where it doesn't yet exist
  42948. // (such as loading iframes in IE - #4833)
  42949. var documentElement = elem && (elem.ownerDocument || elem).documentElement;
  42950. return documentElement ? documentElement.nodeName !== "HTML" : false;
  42951. };
  42952. /**
  42953. * Sets document-related variables once based on the current document
  42954. * @param {Element|Object} [doc] An element or document object to use to set the document
  42955. * @returns {Object} Returns the current document
  42956. */
  42957. setDocument = Sizzle.setDocument = function( node ) {
  42958. var hasCompare, subWindow,
  42959. doc = node ? node.ownerDocument || node : preferredDoc;
  42960. // Return early if doc is invalid or already selected
  42961. if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) {
  42962. return document;
  42963. }
  42964. // Update global variables
  42965. document = doc;
  42966. docElem = document.documentElement;
  42967. documentIsHTML = !isXML( document );
  42968. // Support: IE 9-11, Edge
  42969. // Accessing iframe documents after unload throws "permission denied" errors (jQuery #13936)
  42970. if ( preferredDoc !== document &&
  42971. (subWindow = document.defaultView) && subWindow.top !== subWindow ) {
  42972. // Support: IE 11, Edge
  42973. if ( subWindow.addEventListener ) {
  42974. subWindow.addEventListener( "unload", unloadHandler, false );
  42975. // Support: IE 9 - 10 only
  42976. } else if ( subWindow.attachEvent ) {
  42977. subWindow.attachEvent( "onunload", unloadHandler );
  42978. }
  42979. }
  42980. /* Attributes
  42981. ---------------------------------------------------------------------- */
  42982. // Support: IE<8
  42983. // Verify that getAttribute really returns attributes and not properties
  42984. // (excepting IE8 booleans)
  42985. support.attributes = assert(function( el ) {
  42986. el.className = "i";
  42987. return !el.getAttribute("className");
  42988. });
  42989. /* getElement(s)By*
  42990. ---------------------------------------------------------------------- */
  42991. // Check if getElementsByTagName("*") returns only elements
  42992. support.getElementsByTagName = assert(function( el ) {
  42993. el.appendChild( document.createComment("") );
  42994. return !el.getElementsByTagName("*").length;
  42995. });
  42996. // Support: IE<9
  42997. support.getElementsByClassName = rnative.test( document.getElementsByClassName );
  42998. // Support: IE<10
  42999. // Check if getElementById returns elements by name
  43000. // The broken getElementById methods don't pick up programmatically-set names,
  43001. // so use a roundabout getElementsByName test
  43002. support.getById = assert(function( el ) {
  43003. docElem.appendChild( el ).id = expando;
  43004. return !document.getElementsByName || !document.getElementsByName( expando ).length;
  43005. });
  43006. // ID filter and find
  43007. if ( support.getById ) {
  43008. Expr.filter["ID"] = function( id ) {
  43009. var attrId = id.replace( runescape, funescape );
  43010. return function( elem ) {
  43011. return elem.getAttribute("id") === attrId;
  43012. };
  43013. };
  43014. Expr.find["ID"] = function( id, context ) {
  43015. if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
  43016. var elem = context.getElementById( id );
  43017. return elem ? [ elem ] : [];
  43018. }
  43019. };
  43020. } else {
  43021. Expr.filter["ID"] = function( id ) {
  43022. var attrId = id.replace( runescape, funescape );
  43023. return function( elem ) {
  43024. var node = typeof elem.getAttributeNode !== "undefined" &&
  43025. elem.getAttributeNode("id");
  43026. return node && node.value === attrId;
  43027. };
  43028. };
  43029. // Support: IE 6 - 7 only
  43030. // getElementById is not reliable as a find shortcut
  43031. Expr.find["ID"] = function( id, context ) {
  43032. if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
  43033. var node, i, elems,
  43034. elem = context.getElementById( id );
  43035. if ( elem ) {
  43036. // Verify the id attribute
  43037. node = elem.getAttributeNode("id");
  43038. if ( node && node.value === id ) {
  43039. return [ elem ];
  43040. }
  43041. // Fall back on getElementsByName
  43042. elems = context.getElementsByName( id );
  43043. i = 0;
  43044. while ( (elem = elems[i++]) ) {
  43045. node = elem.getAttributeNode("id");
  43046. if ( node && node.value === id ) {
  43047. return [ elem ];
  43048. }
  43049. }
  43050. }
  43051. return [];
  43052. }
  43053. };
  43054. }
  43055. // Tag
  43056. Expr.find["TAG"] = support.getElementsByTagName ?
  43057. function( tag, context ) {
  43058. if ( typeof context.getElementsByTagName !== "undefined" ) {
  43059. return context.getElementsByTagName( tag );
  43060. // DocumentFragment nodes don't have gEBTN
  43061. } else if ( support.qsa ) {
  43062. return context.querySelectorAll( tag );
  43063. }
  43064. } :
  43065. function( tag, context ) {
  43066. var elem,
  43067. tmp = [],
  43068. i = 0,
  43069. // By happy coincidence, a (broken) gEBTN appears on DocumentFragment nodes too
  43070. results = context.getElementsByTagName( tag );
  43071. // Filter out possible comments
  43072. if ( tag === "*" ) {
  43073. while ( (elem = results[i++]) ) {
  43074. if ( elem.nodeType === 1 ) {
  43075. tmp.push( elem );
  43076. }
  43077. }
  43078. return tmp;
  43079. }
  43080. return results;
  43081. };
  43082. // Class
  43083. Expr.find["CLASS"] = support.getElementsByClassName && function( className, context ) {
  43084. if ( typeof context.getElementsByClassName !== "undefined" && documentIsHTML ) {
  43085. return context.getElementsByClassName( className );
  43086. }
  43087. };
  43088. /* QSA/matchesSelector
  43089. ---------------------------------------------------------------------- */
  43090. // QSA and matchesSelector support
  43091. // matchesSelector(:active) reports false when true (IE9/Opera 11.5)
  43092. rbuggyMatches = [];
  43093. // qSa(:focus) reports false when true (Chrome 21)
  43094. // We allow this because of a bug in IE8/9 that throws an error
  43095. // whenever `document.activeElement` is accessed on an iframe
  43096. // So, we allow :focus to pass through QSA all the time to avoid the IE error
  43097. // See https://bugs.jquery.com/ticket/13378
  43098. rbuggyQSA = [];
  43099. if ( (support.qsa = rnative.test( document.querySelectorAll )) ) {
  43100. // Build QSA regex
  43101. // Regex strategy adopted from Diego Perini
  43102. assert(function( el ) {
  43103. // Select is set to empty string on purpose
  43104. // This is to test IE's treatment of not explicitly
  43105. // setting a boolean content attribute,
  43106. // since its presence should be enough
  43107. // https://bugs.jquery.com/ticket/12359
  43108. docElem.appendChild( el ).innerHTML = "<a id='" + expando + "'></a>" +
  43109. "<select id='" + expando + "-\r\\' msallowcapture=''>" +
  43110. "<option selected=''></option></select>";
  43111. // Support: IE8, Opera 11-12.16
  43112. // Nothing should be selected when empty strings follow ^= or $= or *=
  43113. // The test attribute must be unknown in Opera but "safe" for WinRT
  43114. // https://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section
  43115. if ( el.querySelectorAll("[msallowcapture^='']").length ) {
  43116. rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" );
  43117. }
  43118. // Support: IE8
  43119. // Boolean attributes and "value" are not treated correctly
  43120. if ( !el.querySelectorAll("[selected]").length ) {
  43121. rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" );
  43122. }
  43123. // Support: Chrome<29, Android<4.4, Safari<7.0+, iOS<7.0+, PhantomJS<1.9.8+
  43124. if ( !el.querySelectorAll( "[id~=" + expando + "-]" ).length ) {
  43125. rbuggyQSA.push("~=");
  43126. }
  43127. // Webkit/Opera - :checked should return selected option elements
  43128. // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
  43129. // IE8 throws error here and will not see later tests
  43130. if ( !el.querySelectorAll(":checked").length ) {
  43131. rbuggyQSA.push(":checked");
  43132. }
  43133. // Support: Safari 8+, iOS 8+
  43134. // https://bugs.webkit.org/show_bug.cgi?id=136851
  43135. // In-page `selector#id sibling-combinator selector` fails
  43136. if ( !el.querySelectorAll( "a#" + expando + "+*" ).length ) {
  43137. rbuggyQSA.push(".#.+[+~]");
  43138. }
  43139. });
  43140. assert(function( el ) {
  43141. el.innerHTML = "<a href='' disabled='disabled'></a>" +
  43142. "<select disabled='disabled'><option/></select>";
  43143. // Support: Windows 8 Native Apps
  43144. // The type and name attributes are restricted during .innerHTML assignment
  43145. var input = document.createElement("input");
  43146. input.setAttribute( "type", "hidden" );
  43147. el.appendChild( input ).setAttribute( "name", "D" );
  43148. // Support: IE8
  43149. // Enforce case-sensitivity of name attribute
  43150. if ( el.querySelectorAll("[name=d]").length ) {
  43151. rbuggyQSA.push( "name" + whitespace + "*[*^$|!~]?=" );
  43152. }
  43153. // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled)
  43154. // IE8 throws error here and will not see later tests
  43155. if ( el.querySelectorAll(":enabled").length !== 2 ) {
  43156. rbuggyQSA.push( ":enabled", ":disabled" );
  43157. }
  43158. // Support: IE9-11+
  43159. // IE's :disabled selector does not pick up the children of disabled fieldsets
  43160. docElem.appendChild( el ).disabled = true;
  43161. if ( el.querySelectorAll(":disabled").length !== 2 ) {
  43162. rbuggyQSA.push( ":enabled", ":disabled" );
  43163. }
  43164. // Opera 10-11 does not throw on post-comma invalid pseudos
  43165. el.querySelectorAll("*,:x");
  43166. rbuggyQSA.push(",.*:");
  43167. });
  43168. }
  43169. if ( (support.matchesSelector = rnative.test( (matches = docElem.matches ||
  43170. docElem.webkitMatchesSelector ||
  43171. docElem.mozMatchesSelector ||
  43172. docElem.oMatchesSelector ||
  43173. docElem.msMatchesSelector) )) ) {
  43174. assert(function( el ) {
  43175. // Check to see if it's possible to do matchesSelector
  43176. // on a disconnected node (IE 9)
  43177. support.disconnectedMatch = matches.call( el, "*" );
  43178. // This should fail with an exception
  43179. // Gecko does not error, returns false instead
  43180. matches.call( el, "[s!='']:x" );
  43181. rbuggyMatches.push( "!=", pseudos );
  43182. });
  43183. }
  43184. rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join("|") );
  43185. rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join("|") );
  43186. /* Contains
  43187. ---------------------------------------------------------------------- */
  43188. hasCompare = rnative.test( docElem.compareDocumentPosition );
  43189. // Element contains another
  43190. // Purposefully self-exclusive
  43191. // As in, an element does not contain itself
  43192. contains = hasCompare || rnative.test( docElem.contains ) ?
  43193. function( a, b ) {
  43194. var adown = a.nodeType === 9 ? a.documentElement : a,
  43195. bup = b && b.parentNode;
  43196. return a === bup || !!( bup && bup.nodeType === 1 && (
  43197. adown.contains ?
  43198. adown.contains( bup ) :
  43199. a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16
  43200. ));
  43201. } :
  43202. function( a, b ) {
  43203. if ( b ) {
  43204. while ( (b = b.parentNode) ) {
  43205. if ( b === a ) {
  43206. return true;
  43207. }
  43208. }
  43209. }
  43210. return false;
  43211. };
  43212. /* Sorting
  43213. ---------------------------------------------------------------------- */
  43214. // Document order sorting
  43215. sortOrder = hasCompare ?
  43216. function( a, b ) {
  43217. // Flag for duplicate removal
  43218. if ( a === b ) {
  43219. hasDuplicate = true;
  43220. return 0;
  43221. }
  43222. // Sort on method existence if only one input has compareDocumentPosition
  43223. var compare = !a.compareDocumentPosition - !b.compareDocumentPosition;
  43224. if ( compare ) {
  43225. return compare;
  43226. }
  43227. // Calculate position if both inputs belong to the same document
  43228. compare = ( a.ownerDocument || a ) === ( b.ownerDocument || b ) ?
  43229. a.compareDocumentPosition( b ) :
  43230. // Otherwise we know they are disconnected
  43231. 1;
  43232. // Disconnected nodes
  43233. if ( compare & 1 ||
  43234. (!support.sortDetached && b.compareDocumentPosition( a ) === compare) ) {
  43235. // Choose the first element that is related to our preferred document
  43236. if ( a === document || a.ownerDocument === preferredDoc && contains(preferredDoc, a) ) {
  43237. return -1;
  43238. }
  43239. if ( b === document || b.ownerDocument === preferredDoc && contains(preferredDoc, b) ) {
  43240. return 1;
  43241. }
  43242. // Maintain original order
  43243. return sortInput ?
  43244. ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
  43245. 0;
  43246. }
  43247. return compare & 4 ? -1 : 1;
  43248. } :
  43249. function( a, b ) {
  43250. // Exit early if the nodes are identical
  43251. if ( a === b ) {
  43252. hasDuplicate = true;
  43253. return 0;
  43254. }
  43255. var cur,
  43256. i = 0,
  43257. aup = a.parentNode,
  43258. bup = b.parentNode,
  43259. ap = [ a ],
  43260. bp = [ b ];
  43261. // Parentless nodes are either documents or disconnected
  43262. if ( !aup || !bup ) {
  43263. return a === document ? -1 :
  43264. b === document ? 1 :
  43265. aup ? -1 :
  43266. bup ? 1 :
  43267. sortInput ?
  43268. ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
  43269. 0;
  43270. // If the nodes are siblings, we can do a quick check
  43271. } else if ( aup === bup ) {
  43272. return siblingCheck( a, b );
  43273. }
  43274. // Otherwise we need full lists of their ancestors for comparison
  43275. cur = a;
  43276. while ( (cur = cur.parentNode) ) {
  43277. ap.unshift( cur );
  43278. }
  43279. cur = b;
  43280. while ( (cur = cur.parentNode) ) {
  43281. bp.unshift( cur );
  43282. }
  43283. // Walk down the tree looking for a discrepancy
  43284. while ( ap[i] === bp[i] ) {
  43285. i++;
  43286. }
  43287. return i ?
  43288. // Do a sibling check if the nodes have a common ancestor
  43289. siblingCheck( ap[i], bp[i] ) :
  43290. // Otherwise nodes in our document sort first
  43291. ap[i] === preferredDoc ? -1 :
  43292. bp[i] === preferredDoc ? 1 :
  43293. 0;
  43294. };
  43295. return document;
  43296. };
  43297. Sizzle.matches = function( expr, elements ) {
  43298. return Sizzle( expr, null, null, elements );
  43299. };
  43300. Sizzle.matchesSelector = function( elem, expr ) {
  43301. // Set document vars if needed
  43302. if ( ( elem.ownerDocument || elem ) !== document ) {
  43303. setDocument( elem );
  43304. }
  43305. // Make sure that attribute selectors are quoted
  43306. expr = expr.replace( rattributeQuotes, "='$1']" );
  43307. if ( support.matchesSelector && documentIsHTML &&
  43308. !compilerCache[ expr + " " ] &&
  43309. ( !rbuggyMatches || !rbuggyMatches.test( expr ) ) &&
  43310. ( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) {
  43311. try {
  43312. var ret = matches.call( elem, expr );
  43313. // IE 9's matchesSelector returns false on disconnected nodes
  43314. if ( ret || support.disconnectedMatch ||
  43315. // As well, disconnected nodes are said to be in a document
  43316. // fragment in IE 9
  43317. elem.document && elem.document.nodeType !== 11 ) {
  43318. return ret;
  43319. }
  43320. } catch (e) {}
  43321. }
  43322. return Sizzle( expr, document, null, [ elem ] ).length > 0;
  43323. };
  43324. Sizzle.contains = function( context, elem ) {
  43325. // Set document vars if needed
  43326. if ( ( context.ownerDocument || context ) !== document ) {
  43327. setDocument( context );
  43328. }
  43329. return contains( context, elem );
  43330. };
  43331. Sizzle.attr = function( elem, name ) {
  43332. // Set document vars if needed
  43333. if ( ( elem.ownerDocument || elem ) !== document ) {
  43334. setDocument( elem );
  43335. }
  43336. var fn = Expr.attrHandle[ name.toLowerCase() ],
  43337. // Don't get fooled by Object.prototype properties (jQuery #13807)
  43338. val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ?
  43339. fn( elem, name, !documentIsHTML ) :
  43340. undefined;
  43341. return val !== undefined ?
  43342. val :
  43343. support.attributes || !documentIsHTML ?
  43344. elem.getAttribute( name ) :
  43345. (val = elem.getAttributeNode(name)) && val.specified ?
  43346. val.value :
  43347. null;
  43348. };
  43349. Sizzle.escape = function( sel ) {
  43350. return (sel + "").replace( rcssescape, fcssescape );
  43351. };
  43352. Sizzle.error = function( msg ) {
  43353. throw new Error( "Syntax error, unrecognized expression: " + msg );
  43354. };
  43355. /**
  43356. * Document sorting and removing duplicates
  43357. * @param {ArrayLike} results
  43358. */
  43359. Sizzle.uniqueSort = function( results ) {
  43360. var elem,
  43361. duplicates = [],
  43362. j = 0,
  43363. i = 0;
  43364. // Unless we *know* we can detect duplicates, assume their presence
  43365. hasDuplicate = !support.detectDuplicates;
  43366. sortInput = !support.sortStable && results.slice( 0 );
  43367. results.sort( sortOrder );
  43368. if ( hasDuplicate ) {
  43369. while ( (elem = results[i++]) ) {
  43370. if ( elem === results[ i ] ) {
  43371. j = duplicates.push( i );
  43372. }
  43373. }
  43374. while ( j-- ) {
  43375. results.splice( duplicates[ j ], 1 );
  43376. }
  43377. }
  43378. // Clear input after sorting to release objects
  43379. // See https://github.com/jquery/sizzle/pull/225
  43380. sortInput = null;
  43381. return results;
  43382. };
  43383. /**
  43384. * Utility function for retrieving the text value of an array of DOM nodes
  43385. * @param {Array|Element} elem
  43386. */
  43387. getText = Sizzle.getText = function( elem ) {
  43388. var node,
  43389. ret = "",
  43390. i = 0,
  43391. nodeType = elem.nodeType;
  43392. if ( !nodeType ) {
  43393. // If no nodeType, this is expected to be an array
  43394. while ( (node = elem[i++]) ) {
  43395. // Do not traverse comment nodes
  43396. ret += getText( node );
  43397. }
  43398. } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) {
  43399. // Use textContent for elements
  43400. // innerText usage removed for consistency of new lines (jQuery #11153)
  43401. if ( typeof elem.textContent === "string" ) {
  43402. return elem.textContent;
  43403. } else {
  43404. // Traverse its children
  43405. for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
  43406. ret += getText( elem );
  43407. }
  43408. }
  43409. } else if ( nodeType === 3 || nodeType === 4 ) {
  43410. return elem.nodeValue;
  43411. }
  43412. // Do not include comment or processing instruction nodes
  43413. return ret;
  43414. };
  43415. Expr = Sizzle.selectors = {
  43416. // Can be adjusted by the user
  43417. cacheLength: 50,
  43418. createPseudo: markFunction,
  43419. match: matchExpr,
  43420. attrHandle: {},
  43421. find: {},
  43422. relative: {
  43423. ">": { dir: "parentNode", first: true },
  43424. " ": { dir: "parentNode" },
  43425. "+": { dir: "previousSibling", first: true },
  43426. "~": { dir: "previousSibling" }
  43427. },
  43428. preFilter: {
  43429. "ATTR": function( match ) {
  43430. match[1] = match[1].replace( runescape, funescape );
  43431. // Move the given value to match[3] whether quoted or unquoted
  43432. match[3] = ( match[3] || match[4] || match[5] || "" ).replace( runescape, funescape );
  43433. if ( match[2] === "~=" ) {
  43434. match[3] = " " + match[3] + " ";
  43435. }
  43436. return match.slice( 0, 4 );
  43437. },
  43438. "CHILD": function( match ) {
  43439. /* matches from matchExpr["CHILD"]
  43440. 1 type (only|nth|...)
  43441. 2 what (child|of-type)
  43442. 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...)
  43443. 4 xn-component of xn+y argument ([+-]?\d*n|)
  43444. 5 sign of xn-component
  43445. 6 x of xn-component
  43446. 7 sign of y-component
  43447. 8 y of y-component
  43448. */
  43449. match[1] = match[1].toLowerCase();
  43450. if ( match[1].slice( 0, 3 ) === "nth" ) {
  43451. // nth-* requires argument
  43452. if ( !match[3] ) {
  43453. Sizzle.error( match[0] );
  43454. }
  43455. // numeric x and y parameters for Expr.filter.CHILD
  43456. // remember that false/true cast respectively to 0/1
  43457. match[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === "even" || match[3] === "odd" ) );
  43458. match[5] = +( ( match[7] + match[8] ) || match[3] === "odd" );
  43459. // other types prohibit arguments
  43460. } else if ( match[3] ) {
  43461. Sizzle.error( match[0] );
  43462. }
  43463. return match;
  43464. },
  43465. "PSEUDO": function( match ) {
  43466. var excess,
  43467. unquoted = !match[6] && match[2];
  43468. if ( matchExpr["CHILD"].test( match[0] ) ) {
  43469. return null;
  43470. }
  43471. // Accept quoted arguments as-is
  43472. if ( match[3] ) {
  43473. match[2] = match[4] || match[5] || "";
  43474. // Strip excess characters from unquoted arguments
  43475. } else if ( unquoted && rpseudo.test( unquoted ) &&
  43476. // Get excess from tokenize (recursively)
  43477. (excess = tokenize( unquoted, true )) &&
  43478. // advance to the next closing parenthesis
  43479. (excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) {
  43480. // excess is a negative index
  43481. match[0] = match[0].slice( 0, excess );
  43482. match[2] = unquoted.slice( 0, excess );
  43483. }
  43484. // Return only captures needed by the pseudo filter method (type and argument)
  43485. return match.slice( 0, 3 );
  43486. }
  43487. },
  43488. filter: {
  43489. "TAG": function( nodeNameSelector ) {
  43490. var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase();
  43491. return nodeNameSelector === "*" ?
  43492. function() { return true; } :
  43493. function( elem ) {
  43494. return elem.nodeName && elem.nodeName.toLowerCase() === nodeName;
  43495. };
  43496. },
  43497. "CLASS": function( className ) {
  43498. var pattern = classCache[ className + " " ];
  43499. return pattern ||
  43500. (pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) &&
  43501. classCache( className, function( elem ) {
  43502. return pattern.test( typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== "undefined" && elem.getAttribute("class") || "" );
  43503. });
  43504. },
  43505. "ATTR": function( name, operator, check ) {
  43506. return function( elem ) {
  43507. var result = Sizzle.attr( elem, name );
  43508. if ( result == null ) {
  43509. return operator === "!=";
  43510. }
  43511. if ( !operator ) {
  43512. return true;
  43513. }
  43514. result += "";
  43515. return operator === "=" ? result === check :
  43516. operator === "!=" ? result !== check :
  43517. operator === "^=" ? check && result.indexOf( check ) === 0 :
  43518. operator === "*=" ? check && result.indexOf( check ) > -1 :
  43519. operator === "$=" ? check && result.slice( -check.length ) === check :
  43520. operator === "~=" ? ( " " + result.replace( rwhitespace, " " ) + " " ).indexOf( check ) > -1 :
  43521. operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" :
  43522. false;
  43523. };
  43524. },
  43525. "CHILD": function( type, what, argument, first, last ) {
  43526. var simple = type.slice( 0, 3 ) !== "nth",
  43527. forward = type.slice( -4 ) !== "last",
  43528. ofType = what === "of-type";
  43529. return first === 1 && last === 0 ?
  43530. // Shortcut for :nth-*(n)
  43531. function( elem ) {
  43532. return !!elem.parentNode;
  43533. } :
  43534. function( elem, context, xml ) {
  43535. var cache, uniqueCache, outerCache, node, nodeIndex, start,
  43536. dir = simple !== forward ? "nextSibling" : "previousSibling",
  43537. parent = elem.parentNode,
  43538. name = ofType && elem.nodeName.toLowerCase(),
  43539. useCache = !xml && !ofType,
  43540. diff = false;
  43541. if ( parent ) {
  43542. // :(first|last|only)-(child|of-type)
  43543. if ( simple ) {
  43544. while ( dir ) {
  43545. node = elem;
  43546. while ( (node = node[ dir ]) ) {
  43547. if ( ofType ?
  43548. node.nodeName.toLowerCase() === name :
  43549. node.nodeType === 1 ) {
  43550. return false;
  43551. }
  43552. }
  43553. // Reverse direction for :only-* (if we haven't yet done so)
  43554. start = dir = type === "only" && !start && "nextSibling";
  43555. }
  43556. return true;
  43557. }
  43558. start = [ forward ? parent.firstChild : parent.lastChild ];
  43559. // non-xml :nth-child(...) stores cache data on `parent`
  43560. if ( forward && useCache ) {
  43561. // Seek `elem` from a previously-cached index
  43562. // ...in a gzip-friendly way
  43563. node = parent;
  43564. outerCache = node[ expando ] || (node[ expando ] = {});
  43565. // Support: IE <9 only
  43566. // Defend against cloned attroperties (jQuery gh-1709)
  43567. uniqueCache = outerCache[ node.uniqueID ] ||
  43568. (outerCache[ node.uniqueID ] = {});
  43569. cache = uniqueCache[ type ] || [];
  43570. nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
  43571. diff = nodeIndex && cache[ 2 ];
  43572. node = nodeIndex && parent.childNodes[ nodeIndex ];
  43573. while ( (node = ++nodeIndex && node && node[ dir ] ||
  43574. // Fallback to seeking `elem` from the start
  43575. (diff = nodeIndex = 0) || start.pop()) ) {
  43576. // When found, cache indexes on `parent` and break
  43577. if ( node.nodeType === 1 && ++diff && node === elem ) {
  43578. uniqueCache[ type ] = [ dirruns, nodeIndex, diff ];
  43579. break;
  43580. }
  43581. }
  43582. } else {
  43583. // Use previously-cached element index if available
  43584. if ( useCache ) {
  43585. // ...in a gzip-friendly way
  43586. node = elem;
  43587. outerCache = node[ expando ] || (node[ expando ] = {});
  43588. // Support: IE <9 only
  43589. // Defend against cloned attroperties (jQuery gh-1709)
  43590. uniqueCache = outerCache[ node.uniqueID ] ||
  43591. (outerCache[ node.uniqueID ] = {});
  43592. cache = uniqueCache[ type ] || [];
  43593. nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
  43594. diff = nodeIndex;
  43595. }
  43596. // xml :nth-child(...)
  43597. // or :nth-last-child(...) or :nth(-last)?-of-type(...)
  43598. if ( diff === false ) {
  43599. // Use the same loop as above to seek `elem` from the start
  43600. while ( (node = ++nodeIndex && node && node[ dir ] ||
  43601. (diff = nodeIndex = 0) || start.pop()) ) {
  43602. if ( ( ofType ?
  43603. node.nodeName.toLowerCase() === name :
  43604. node.nodeType === 1 ) &&
  43605. ++diff ) {
  43606. // Cache the index of each encountered element
  43607. if ( useCache ) {
  43608. outerCache = node[ expando ] || (node[ expando ] = {});
  43609. // Support: IE <9 only
  43610. // Defend against cloned attroperties (jQuery gh-1709)
  43611. uniqueCache = outerCache[ node.uniqueID ] ||
  43612. (outerCache[ node.uniqueID ] = {});
  43613. uniqueCache[ type ] = [ dirruns, diff ];
  43614. }
  43615. if ( node === elem ) {
  43616. break;
  43617. }
  43618. }
  43619. }
  43620. }
  43621. }
  43622. // Incorporate the offset, then check against cycle size
  43623. diff -= last;
  43624. return diff === first || ( diff % first === 0 && diff / first >= 0 );
  43625. }
  43626. };
  43627. },
  43628. "PSEUDO": function( pseudo, argument ) {
  43629. // pseudo-class names are case-insensitive
  43630. // http://www.w3.org/TR/selectors/#pseudo-classes
  43631. // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters
  43632. // Remember that setFilters inherits from pseudos
  43633. var args,
  43634. fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] ||
  43635. Sizzle.error( "unsupported pseudo: " + pseudo );
  43636. // The user may use createPseudo to indicate that
  43637. // arguments are needed to create the filter function
  43638. // just as Sizzle does
  43639. if ( fn[ expando ] ) {
  43640. return fn( argument );
  43641. }
  43642. // But maintain support for old signatures
  43643. if ( fn.length > 1 ) {
  43644. args = [ pseudo, pseudo, "", argument ];
  43645. return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ?
  43646. markFunction(function( seed, matches ) {
  43647. var idx,
  43648. matched = fn( seed, argument ),
  43649. i = matched.length;
  43650. while ( i-- ) {
  43651. idx = indexOf( seed, matched[i] );
  43652. seed[ idx ] = !( matches[ idx ] = matched[i] );
  43653. }
  43654. }) :
  43655. function( elem ) {
  43656. return fn( elem, 0, args );
  43657. };
  43658. }
  43659. return fn;
  43660. }
  43661. },
  43662. pseudos: {
  43663. // Potentially complex pseudos
  43664. "not": markFunction(function( selector ) {
  43665. // Trim the selector passed to compile
  43666. // to avoid treating leading and trailing
  43667. // spaces as combinators
  43668. var input = [],
  43669. results = [],
  43670. matcher = compile( selector.replace( rtrim, "$1" ) );
  43671. return matcher[ expando ] ?
  43672. markFunction(function( seed, matches, context, xml ) {
  43673. var elem,
  43674. unmatched = matcher( seed, null, xml, [] ),
  43675. i = seed.length;
  43676. // Match elements unmatched by `matcher`
  43677. while ( i-- ) {
  43678. if ( (elem = unmatched[i]) ) {
  43679. seed[i] = !(matches[i] = elem);
  43680. }
  43681. }
  43682. }) :
  43683. function( elem, context, xml ) {
  43684. input[0] = elem;
  43685. matcher( input, null, xml, results );
  43686. // Don't keep the element (issue #299)
  43687. input[0] = null;
  43688. return !results.pop();
  43689. };
  43690. }),
  43691. "has": markFunction(function( selector ) {
  43692. return function( elem ) {
  43693. return Sizzle( selector, elem ).length > 0;
  43694. };
  43695. }),
  43696. "contains": markFunction(function( text ) {
  43697. text = text.replace( runescape, funescape );
  43698. return function( elem ) {
  43699. return ( elem.textContent || elem.innerText || getText( elem ) ).indexOf( text ) > -1;
  43700. };
  43701. }),
  43702. // "Whether an element is represented by a :lang() selector
  43703. // is based solely on the element's language value
  43704. // being equal to the identifier C,
  43705. // or beginning with the identifier C immediately followed by "-".
  43706. // The matching of C against the element's language value is performed case-insensitively.
  43707. // The identifier C does not have to be a valid language name."
  43708. // http://www.w3.org/TR/selectors/#lang-pseudo
  43709. "lang": markFunction( function( lang ) {
  43710. // lang value must be a valid identifier
  43711. if ( !ridentifier.test(lang || "") ) {
  43712. Sizzle.error( "unsupported lang: " + lang );
  43713. }
  43714. lang = lang.replace( runescape, funescape ).toLowerCase();
  43715. return function( elem ) {
  43716. var elemLang;
  43717. do {
  43718. if ( (elemLang = documentIsHTML ?
  43719. elem.lang :
  43720. elem.getAttribute("xml:lang") || elem.getAttribute("lang")) ) {
  43721. elemLang = elemLang.toLowerCase();
  43722. return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0;
  43723. }
  43724. } while ( (elem = elem.parentNode) && elem.nodeType === 1 );
  43725. return false;
  43726. };
  43727. }),
  43728. // Miscellaneous
  43729. "target": function( elem ) {
  43730. var hash = window.location && window.location.hash;
  43731. return hash && hash.slice( 1 ) === elem.id;
  43732. },
  43733. "root": function( elem ) {
  43734. return elem === docElem;
  43735. },
  43736. "focus": function( elem ) {
  43737. return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex);
  43738. },
  43739. // Boolean properties
  43740. "enabled": createDisabledPseudo( false ),
  43741. "disabled": createDisabledPseudo( true ),
  43742. "checked": function( elem ) {
  43743. // In CSS3, :checked should return both checked and selected elements
  43744. // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
  43745. var nodeName = elem.nodeName.toLowerCase();
  43746. return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected);
  43747. },
  43748. "selected": function( elem ) {
  43749. // Accessing this property makes selected-by-default
  43750. // options in Safari work properly
  43751. if ( elem.parentNode ) {
  43752. elem.parentNode.selectedIndex;
  43753. }
  43754. return elem.selected === true;
  43755. },
  43756. // Contents
  43757. "empty": function( elem ) {
  43758. // http://www.w3.org/TR/selectors/#empty-pseudo
  43759. // :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5),
  43760. // but not by others (comment: 8; processing instruction: 7; etc.)
  43761. // nodeType < 6 works because attributes (2) do not appear as children
  43762. for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
  43763. if ( elem.nodeType < 6 ) {
  43764. return false;
  43765. }
  43766. }
  43767. return true;
  43768. },
  43769. "parent": function( elem ) {
  43770. return !Expr.pseudos["empty"]( elem );
  43771. },
  43772. // Element/input types
  43773. "header": function( elem ) {
  43774. return rheader.test( elem.nodeName );
  43775. },
  43776. "input": function( elem ) {
  43777. return rinputs.test( elem.nodeName );
  43778. },
  43779. "button": function( elem ) {
  43780. var name = elem.nodeName.toLowerCase();
  43781. return name === "input" && elem.type === "button" || name === "button";
  43782. },
  43783. "text": function( elem ) {
  43784. var attr;
  43785. return elem.nodeName.toLowerCase() === "input" &&
  43786. elem.type === "text" &&
  43787. // Support: IE<8
  43788. // New HTML5 attribute values (e.g., "search") appear with elem.type === "text"
  43789. ( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === "text" );
  43790. },
  43791. // Position-in-collection
  43792. "first": createPositionalPseudo(function() {
  43793. return [ 0 ];
  43794. }),
  43795. "last": createPositionalPseudo(function( matchIndexes, length ) {
  43796. return [ length - 1 ];
  43797. }),
  43798. "eq": createPositionalPseudo(function( matchIndexes, length, argument ) {
  43799. return [ argument < 0 ? argument + length : argument ];
  43800. }),
  43801. "even": createPositionalPseudo(function( matchIndexes, length ) {
  43802. var i = 0;
  43803. for ( ; i < length; i += 2 ) {
  43804. matchIndexes.push( i );
  43805. }
  43806. return matchIndexes;
  43807. }),
  43808. "odd": createPositionalPseudo(function( matchIndexes, length ) {
  43809. var i = 1;
  43810. for ( ; i < length; i += 2 ) {
  43811. matchIndexes.push( i );
  43812. }
  43813. return matchIndexes;
  43814. }),
  43815. "lt": createPositionalPseudo(function( matchIndexes, length, argument ) {
  43816. var i = argument < 0 ? argument + length : argument;
  43817. for ( ; --i >= 0; ) {
  43818. matchIndexes.push( i );
  43819. }
  43820. return matchIndexes;
  43821. }),
  43822. "gt": createPositionalPseudo(function( matchIndexes, length, argument ) {
  43823. var i = argument < 0 ? argument + length : argument;
  43824. for ( ; ++i < length; ) {
  43825. matchIndexes.push( i );
  43826. }
  43827. return matchIndexes;
  43828. })
  43829. }
  43830. };
  43831. Expr.pseudos["nth"] = Expr.pseudos["eq"];
  43832. // Add button/input type pseudos
  43833. for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) {
  43834. Expr.pseudos[ i ] = createInputPseudo( i );
  43835. }
  43836. for ( i in { submit: true, reset: true } ) {
  43837. Expr.pseudos[ i ] = createButtonPseudo( i );
  43838. }
  43839. // Easy API for creating new setFilters
  43840. function setFilters() {}
  43841. setFilters.prototype = Expr.filters = Expr.pseudos;
  43842. Expr.setFilters = new setFilters();
  43843. tokenize = Sizzle.tokenize = function( selector, parseOnly ) {
  43844. var matched, match, tokens, type,
  43845. soFar, groups, preFilters,
  43846. cached = tokenCache[ selector + " " ];
  43847. if ( cached ) {
  43848. return parseOnly ? 0 : cached.slice( 0 );
  43849. }
  43850. soFar = selector;
  43851. groups = [];
  43852. preFilters = Expr.preFilter;
  43853. while ( soFar ) {
  43854. // Comma and first run
  43855. if ( !matched || (match = rcomma.exec( soFar )) ) {
  43856. if ( match ) {
  43857. // Don't consume trailing commas as valid
  43858. soFar = soFar.slice( match[0].length ) || soFar;
  43859. }
  43860. groups.push( (tokens = []) );
  43861. }
  43862. matched = false;
  43863. // Combinators
  43864. if ( (match = rcombinators.exec( soFar )) ) {
  43865. matched = match.shift();
  43866. tokens.push({
  43867. value: matched,
  43868. // Cast descendant combinators to space
  43869. type: match[0].replace( rtrim, " " )
  43870. });
  43871. soFar = soFar.slice( matched.length );
  43872. }
  43873. // Filters
  43874. for ( type in Expr.filter ) {
  43875. if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] ||
  43876. (match = preFilters[ type ]( match ))) ) {
  43877. matched = match.shift();
  43878. tokens.push({
  43879. value: matched,
  43880. type: type,
  43881. matches: match
  43882. });
  43883. soFar = soFar.slice( matched.length );
  43884. }
  43885. }
  43886. if ( !matched ) {
  43887. break;
  43888. }
  43889. }
  43890. // Return the length of the invalid excess
  43891. // if we're just parsing
  43892. // Otherwise, throw an error or return tokens
  43893. return parseOnly ?
  43894. soFar.length :
  43895. soFar ?
  43896. Sizzle.error( selector ) :
  43897. // Cache the tokens
  43898. tokenCache( selector, groups ).slice( 0 );
  43899. };
  43900. function toSelector( tokens ) {
  43901. var i = 0,
  43902. len = tokens.length,
  43903. selector = "";
  43904. for ( ; i < len; i++ ) {
  43905. selector += tokens[i].value;
  43906. }
  43907. return selector;
  43908. }
  43909. function addCombinator( matcher, combinator, base ) {
  43910. var dir = combinator.dir,
  43911. skip = combinator.next,
  43912. key = skip || dir,
  43913. checkNonElements = base && key === "parentNode",
  43914. doneName = done++;
  43915. return combinator.first ?
  43916. // Check against closest ancestor/preceding element
  43917. function( elem, context, xml ) {
  43918. while ( (elem = elem[ dir ]) ) {
  43919. if ( elem.nodeType === 1 || checkNonElements ) {
  43920. return matcher( elem, context, xml );
  43921. }
  43922. }
  43923. return false;
  43924. } :
  43925. // Check against all ancestor/preceding elements
  43926. function( elem, context, xml ) {
  43927. var oldCache, uniqueCache, outerCache,
  43928. newCache = [ dirruns, doneName ];
  43929. // We can't set arbitrary data on XML nodes, so they don't benefit from combinator caching
  43930. if ( xml ) {
  43931. while ( (elem = elem[ dir ]) ) {
  43932. if ( elem.nodeType === 1 || checkNonElements ) {
  43933. if ( matcher( elem, context, xml ) ) {
  43934. return true;
  43935. }
  43936. }
  43937. }
  43938. } else {
  43939. while ( (elem = elem[ dir ]) ) {
  43940. if ( elem.nodeType === 1 || checkNonElements ) {
  43941. outerCache = elem[ expando ] || (elem[ expando ] = {});
  43942. // Support: IE <9 only
  43943. // Defend against cloned attroperties (jQuery gh-1709)
  43944. uniqueCache = outerCache[ elem.uniqueID ] || (outerCache[ elem.uniqueID ] = {});
  43945. if ( skip && skip === elem.nodeName.toLowerCase() ) {
  43946. elem = elem[ dir ] || elem;
  43947. } else if ( (oldCache = uniqueCache[ key ]) &&
  43948. oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) {
  43949. // Assign to newCache so results back-propagate to previous elements
  43950. return (newCache[ 2 ] = oldCache[ 2 ]);
  43951. } else {
  43952. // Reuse newcache so results back-propagate to previous elements
  43953. uniqueCache[ key ] = newCache;
  43954. // A match means we're done; a fail means we have to keep checking
  43955. if ( (newCache[ 2 ] = matcher( elem, context, xml )) ) {
  43956. return true;
  43957. }
  43958. }
  43959. }
  43960. }
  43961. }
  43962. return false;
  43963. };
  43964. }
  43965. function elementMatcher( matchers ) {
  43966. return matchers.length > 1 ?
  43967. function( elem, context, xml ) {
  43968. var i = matchers.length;
  43969. while ( i-- ) {
  43970. if ( !matchers[i]( elem, context, xml ) ) {
  43971. return false;
  43972. }
  43973. }
  43974. return true;
  43975. } :
  43976. matchers[0];
  43977. }
  43978. function multipleContexts( selector, contexts, results ) {
  43979. var i = 0,
  43980. len = contexts.length;
  43981. for ( ; i < len; i++ ) {
  43982. Sizzle( selector, contexts[i], results );
  43983. }
  43984. return results;
  43985. }
  43986. function condense( unmatched, map, filter, context, xml ) {
  43987. var elem,
  43988. newUnmatched = [],
  43989. i = 0,
  43990. len = unmatched.length,
  43991. mapped = map != null;
  43992. for ( ; i < len; i++ ) {
  43993. if ( (elem = unmatched[i]) ) {
  43994. if ( !filter || filter( elem, context, xml ) ) {
  43995. newUnmatched.push( elem );
  43996. if ( mapped ) {
  43997. map.push( i );
  43998. }
  43999. }
  44000. }
  44001. }
  44002. return newUnmatched;
  44003. }
  44004. function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) {
  44005. if ( postFilter && !postFilter[ expando ] ) {
  44006. postFilter = setMatcher( postFilter );
  44007. }
  44008. if ( postFinder && !postFinder[ expando ] ) {
  44009. postFinder = setMatcher( postFinder, postSelector );
  44010. }
  44011. return markFunction(function( seed, results, context, xml ) {
  44012. var temp, i, elem,
  44013. preMap = [],
  44014. postMap = [],
  44015. preexisting = results.length,
  44016. // Get initial elements from seed or context
  44017. elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ),
  44018. // Prefilter to get matcher input, preserving a map for seed-results synchronization
  44019. matcherIn = preFilter && ( seed || !selector ) ?
  44020. condense( elems, preMap, preFilter, context, xml ) :
  44021. elems,
  44022. matcherOut = matcher ?
  44023. // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results,
  44024. postFinder || ( seed ? preFilter : preexisting || postFilter ) ?
  44025. // ...intermediate processing is necessary
  44026. [] :
  44027. // ...otherwise use results directly
  44028. results :
  44029. matcherIn;
  44030. // Find primary matches
  44031. if ( matcher ) {
  44032. matcher( matcherIn, matcherOut, context, xml );
  44033. }
  44034. // Apply postFilter
  44035. if ( postFilter ) {
  44036. temp = condense( matcherOut, postMap );
  44037. postFilter( temp, [], context, xml );
  44038. // Un-match failing elements by moving them back to matcherIn
  44039. i = temp.length;
  44040. while ( i-- ) {
  44041. if ( (elem = temp[i]) ) {
  44042. matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem);
  44043. }
  44044. }
  44045. }
  44046. if ( seed ) {
  44047. if ( postFinder || preFilter ) {
  44048. if ( postFinder ) {
  44049. // Get the final matcherOut by condensing this intermediate into postFinder contexts
  44050. temp = [];
  44051. i = matcherOut.length;
  44052. while ( i-- ) {
  44053. if ( (elem = matcherOut[i]) ) {
  44054. // Restore matcherIn since elem is not yet a final match
  44055. temp.push( (matcherIn[i] = elem) );
  44056. }
  44057. }
  44058. postFinder( null, (matcherOut = []), temp, xml );
  44059. }
  44060. // Move matched elements from seed to results to keep them synchronized
  44061. i = matcherOut.length;
  44062. while ( i-- ) {
  44063. if ( (elem = matcherOut[i]) &&
  44064. (temp = postFinder ? indexOf( seed, elem ) : preMap[i]) > -1 ) {
  44065. seed[temp] = !(results[temp] = elem);
  44066. }
  44067. }
  44068. }
  44069. // Add elements to results, through postFinder if defined
  44070. } else {
  44071. matcherOut = condense(
  44072. matcherOut === results ?
  44073. matcherOut.splice( preexisting, matcherOut.length ) :
  44074. matcherOut
  44075. );
  44076. if ( postFinder ) {
  44077. postFinder( null, results, matcherOut, xml );
  44078. } else {
  44079. push.apply( results, matcherOut );
  44080. }
  44081. }
  44082. });
  44083. }
  44084. function matcherFromTokens( tokens ) {
  44085. var checkContext, matcher, j,
  44086. len = tokens.length,
  44087. leadingRelative = Expr.relative[ tokens[0].type ],
  44088. implicitRelative = leadingRelative || Expr.relative[" "],
  44089. i = leadingRelative ? 1 : 0,
  44090. // The foundational matcher ensures that elements are reachable from top-level context(s)
  44091. matchContext = addCombinator( function( elem ) {
  44092. return elem === checkContext;
  44093. }, implicitRelative, true ),
  44094. matchAnyContext = addCombinator( function( elem ) {
  44095. return indexOf( checkContext, elem ) > -1;
  44096. }, implicitRelative, true ),
  44097. matchers = [ function( elem, context, xml ) {
  44098. var ret = ( !leadingRelative && ( xml || context !== outermostContext ) ) || (
  44099. (checkContext = context).nodeType ?
  44100. matchContext( elem, context, xml ) :
  44101. matchAnyContext( elem, context, xml ) );
  44102. // Avoid hanging onto element (issue #299)
  44103. checkContext = null;
  44104. return ret;
  44105. } ];
  44106. for ( ; i < len; i++ ) {
  44107. if ( (matcher = Expr.relative[ tokens[i].type ]) ) {
  44108. matchers = [ addCombinator(elementMatcher( matchers ), matcher) ];
  44109. } else {
  44110. matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches );
  44111. // Return special upon seeing a positional matcher
  44112. if ( matcher[ expando ] ) {
  44113. // Find the next relative operator (if any) for proper handling
  44114. j = ++i;
  44115. for ( ; j < len; j++ ) {
  44116. if ( Expr.relative[ tokens[j].type ] ) {
  44117. break;
  44118. }
  44119. }
  44120. return setMatcher(
  44121. i > 1 && elementMatcher( matchers ),
  44122. i > 1 && toSelector(
  44123. // If the preceding token was a descendant combinator, insert an implicit any-element `*`
  44124. tokens.slice( 0, i - 1 ).concat({ value: tokens[ i - 2 ].type === " " ? "*" : "" })
  44125. ).replace( rtrim, "$1" ),
  44126. matcher,
  44127. i < j && matcherFromTokens( tokens.slice( i, j ) ),
  44128. j < len && matcherFromTokens( (tokens = tokens.slice( j )) ),
  44129. j < len && toSelector( tokens )
  44130. );
  44131. }
  44132. matchers.push( matcher );
  44133. }
  44134. }
  44135. return elementMatcher( matchers );
  44136. }
  44137. function matcherFromGroupMatchers( elementMatchers, setMatchers ) {
  44138. var bySet = setMatchers.length > 0,
  44139. byElement = elementMatchers.length > 0,
  44140. superMatcher = function( seed, context, xml, results, outermost ) {
  44141. var elem, j, matcher,
  44142. matchedCount = 0,
  44143. i = "0",
  44144. unmatched = seed && [],
  44145. setMatched = [],
  44146. contextBackup = outermostContext,
  44147. // We must always have either seed elements or outermost context
  44148. elems = seed || byElement && Expr.find["TAG"]( "*", outermost ),
  44149. // Use integer dirruns iff this is the outermost matcher
  44150. dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1),
  44151. len = elems.length;
  44152. if ( outermost ) {
  44153. outermostContext = context === document || context || outermost;
  44154. }
  44155. // Add elements passing elementMatchers directly to results
  44156. // Support: IE<9, Safari
  44157. // Tolerate NodeList properties (IE: "length"; Safari: <number>) matching elements by id
  44158. for ( ; i !== len && (elem = elems[i]) != null; i++ ) {
  44159. if ( byElement && elem ) {
  44160. j = 0;
  44161. if ( !context && elem.ownerDocument !== document ) {
  44162. setDocument( elem );
  44163. xml = !documentIsHTML;
  44164. }
  44165. while ( (matcher = elementMatchers[j++]) ) {
  44166. if ( matcher( elem, context || document, xml) ) {
  44167. results.push( elem );
  44168. break;
  44169. }
  44170. }
  44171. if ( outermost ) {
  44172. dirruns = dirrunsUnique;
  44173. }
  44174. }
  44175. // Track unmatched elements for set filters
  44176. if ( bySet ) {
  44177. // They will have gone through all possible matchers
  44178. if ( (elem = !matcher && elem) ) {
  44179. matchedCount--;
  44180. }
  44181. // Lengthen the array for every element, matched or not
  44182. if ( seed ) {
  44183. unmatched.push( elem );
  44184. }
  44185. }
  44186. }
  44187. // `i` is now the count of elements visited above, and adding it to `matchedCount`
  44188. // makes the latter nonnegative.
  44189. matchedCount += i;
  44190. // Apply set filters to unmatched elements
  44191. // NOTE: This can be skipped if there are no unmatched elements (i.e., `matchedCount`
  44192. // equals `i`), unless we didn't visit _any_ elements in the above loop because we have
  44193. // no element matchers and no seed.
  44194. // Incrementing an initially-string "0" `i` allows `i` to remain a string only in that
  44195. // case, which will result in a "00" `matchedCount` that differs from `i` but is also
  44196. // numerically zero.
  44197. if ( bySet && i !== matchedCount ) {
  44198. j = 0;
  44199. while ( (matcher = setMatchers[j++]) ) {
  44200. matcher( unmatched, setMatched, context, xml );
  44201. }
  44202. if ( seed ) {
  44203. // Reintegrate element matches to eliminate the need for sorting
  44204. if ( matchedCount > 0 ) {
  44205. while ( i-- ) {
  44206. if ( !(unmatched[i] || setMatched[i]) ) {
  44207. setMatched[i] = pop.call( results );
  44208. }
  44209. }
  44210. }
  44211. // Discard index placeholder values to get only actual matches
  44212. setMatched = condense( setMatched );
  44213. }
  44214. // Add matches to results
  44215. push.apply( results, setMatched );
  44216. // Seedless set matches succeeding multiple successful matchers stipulate sorting
  44217. if ( outermost && !seed && setMatched.length > 0 &&
  44218. ( matchedCount + setMatchers.length ) > 1 ) {
  44219. Sizzle.uniqueSort( results );
  44220. }
  44221. }
  44222. // Override manipulation of globals by nested matchers
  44223. if ( outermost ) {
  44224. dirruns = dirrunsUnique;
  44225. outermostContext = contextBackup;
  44226. }
  44227. return unmatched;
  44228. };
  44229. return bySet ?
  44230. markFunction( superMatcher ) :
  44231. superMatcher;
  44232. }
  44233. compile = Sizzle.compile = function( selector, match /* Internal Use Only */ ) {
  44234. var i,
  44235. setMatchers = [],
  44236. elementMatchers = [],
  44237. cached = compilerCache[ selector + " " ];
  44238. if ( !cached ) {
  44239. // Generate a function of recursive functions that can be used to check each element
  44240. if ( !match ) {
  44241. match = tokenize( selector );
  44242. }
  44243. i = match.length;
  44244. while ( i-- ) {
  44245. cached = matcherFromTokens( match[i] );
  44246. if ( cached[ expando ] ) {
  44247. setMatchers.push( cached );
  44248. } else {
  44249. elementMatchers.push( cached );
  44250. }
  44251. }
  44252. // Cache the compiled function
  44253. cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) );
  44254. // Save selector and tokenization
  44255. cached.selector = selector;
  44256. }
  44257. return cached;
  44258. };
  44259. /**
  44260. * A low-level selection function that works with Sizzle's compiled
  44261. * selector functions
  44262. * @param {String|Function} selector A selector or a pre-compiled
  44263. * selector function built with Sizzle.compile
  44264. * @param {Element} context
  44265. * @param {Array} [results]
  44266. * @param {Array} [seed] A set of elements to match against
  44267. */
  44268. select = Sizzle.select = function( selector, context, results, seed ) {
  44269. var i, tokens, token, type, find,
  44270. compiled = typeof selector === "function" && selector,
  44271. match = !seed && tokenize( (selector = compiled.selector || selector) );
  44272. results = results || [];
  44273. // Try to minimize operations if there is only one selector in the list and no seed
  44274. // (the latter of which guarantees us context)
  44275. if ( match.length === 1 ) {
  44276. // Reduce context if the leading compound selector is an ID
  44277. tokens = match[0] = match[0].slice( 0 );
  44278. if ( tokens.length > 2 && (token = tokens[0]).type === "ID" &&
  44279. context.nodeType === 9 && documentIsHTML && Expr.relative[ tokens[1].type ] ) {
  44280. context = ( Expr.find["ID"]( token.matches[0].replace(runescape, funescape), context ) || [] )[0];
  44281. if ( !context ) {
  44282. return results;
  44283. // Precompiled matchers will still verify ancestry, so step up a level
  44284. } else if ( compiled ) {
  44285. context = context.parentNode;
  44286. }
  44287. selector = selector.slice( tokens.shift().value.length );
  44288. }
  44289. // Fetch a seed set for right-to-left matching
  44290. i = matchExpr["needsContext"].test( selector ) ? 0 : tokens.length;
  44291. while ( i-- ) {
  44292. token = tokens[i];
  44293. // Abort if we hit a combinator
  44294. if ( Expr.relative[ (type = token.type) ] ) {
  44295. break;
  44296. }
  44297. if ( (find = Expr.find[ type ]) ) {
  44298. // Search, expanding context for leading sibling combinators
  44299. if ( (seed = find(
  44300. token.matches[0].replace( runescape, funescape ),
  44301. rsibling.test( tokens[0].type ) && testContext( context.parentNode ) || context
  44302. )) ) {
  44303. // If seed is empty or no tokens remain, we can return early
  44304. tokens.splice( i, 1 );
  44305. selector = seed.length && toSelector( tokens );
  44306. if ( !selector ) {
  44307. push.apply( results, seed );
  44308. return results;
  44309. }
  44310. break;
  44311. }
  44312. }
  44313. }
  44314. }
  44315. // Compile and execute a filtering function if one is not provided
  44316. // Provide `match` to avoid retokenization if we modified the selector above
  44317. ( compiled || compile( selector, match ) )(
  44318. seed,
  44319. context,
  44320. !documentIsHTML,
  44321. results,
  44322. !context || rsibling.test( selector ) && testContext( context.parentNode ) || context
  44323. );
  44324. return results;
  44325. };
  44326. // One-time assignments
  44327. // Sort stability
  44328. support.sortStable = expando.split("").sort( sortOrder ).join("") === expando;
  44329. // Support: Chrome 14-35+
  44330. // Always assume duplicates if they aren't passed to the comparison function
  44331. support.detectDuplicates = !!hasDuplicate;
  44332. // Initialize against the default document
  44333. setDocument();
  44334. // Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27)
  44335. // Detached nodes confoundingly follow *each other*
  44336. support.sortDetached = assert(function( el ) {
  44337. // Should return 1, but returns 4 (following)
  44338. return el.compareDocumentPosition( document.createElement("fieldset") ) & 1;
  44339. });
  44340. // Support: IE<8
  44341. // Prevent attribute/property "interpolation"
  44342. // https://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx
  44343. if ( !assert(function( el ) {
  44344. el.innerHTML = "<a href='#'></a>";
  44345. return el.firstChild.getAttribute("href") === "#" ;
  44346. }) ) {
  44347. addHandle( "type|href|height|width", function( elem, name, isXML ) {
  44348. if ( !isXML ) {
  44349. return elem.getAttribute( name, name.toLowerCase() === "type" ? 1 : 2 );
  44350. }
  44351. });
  44352. }
  44353. // Support: IE<9
  44354. // Use defaultValue in place of getAttribute("value")
  44355. if ( !support.attributes || !assert(function( el ) {
  44356. el.innerHTML = "<input/>";
  44357. el.firstChild.setAttribute( "value", "" );
  44358. return el.firstChild.getAttribute( "value" ) === "";
  44359. }) ) {
  44360. addHandle( "value", function( elem, name, isXML ) {
  44361. if ( !isXML && elem.nodeName.toLowerCase() === "input" ) {
  44362. return elem.defaultValue;
  44363. }
  44364. });
  44365. }
  44366. // Support: IE<9
  44367. // Use getAttributeNode to fetch booleans when getAttribute lies
  44368. if ( !assert(function( el ) {
  44369. return el.getAttribute("disabled") == null;
  44370. }) ) {
  44371. addHandle( booleans, function( elem, name, isXML ) {
  44372. var val;
  44373. if ( !isXML ) {
  44374. return elem[ name ] === true ? name.toLowerCase() :
  44375. (val = elem.getAttributeNode( name )) && val.specified ?
  44376. val.value :
  44377. null;
  44378. }
  44379. });
  44380. }
  44381. return Sizzle;
  44382. })( window );
  44383. jQuery.find = Sizzle;
  44384. jQuery.expr = Sizzle.selectors;
  44385. // Deprecated
  44386. jQuery.expr[ ":" ] = jQuery.expr.pseudos;
  44387. jQuery.uniqueSort = jQuery.unique = Sizzle.uniqueSort;
  44388. jQuery.text = Sizzle.getText;
  44389. jQuery.isXMLDoc = Sizzle.isXML;
  44390. jQuery.contains = Sizzle.contains;
  44391. jQuery.escapeSelector = Sizzle.escape;
  44392. var dir = function( elem, dir, until ) {
  44393. var matched = [],
  44394. truncate = until !== undefined;
  44395. while ( ( elem = elem[ dir ] ) && elem.nodeType !== 9 ) {
  44396. if ( elem.nodeType === 1 ) {
  44397. if ( truncate && jQuery( elem ).is( until ) ) {
  44398. break;
  44399. }
  44400. matched.push( elem );
  44401. }
  44402. }
  44403. return matched;
  44404. };
  44405. var siblings = function( n, elem ) {
  44406. var matched = [];
  44407. for ( ; n; n = n.nextSibling ) {
  44408. if ( n.nodeType === 1 && n !== elem ) {
  44409. matched.push( n );
  44410. }
  44411. }
  44412. return matched;
  44413. };
  44414. var rneedsContext = jQuery.expr.match.needsContext;
  44415. function nodeName( elem, name ) {
  44416. return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
  44417. };
  44418. var rsingleTag = ( /^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i );
  44419. // Implement the identical functionality for filter and not
  44420. function winnow( elements, qualifier, not ) {
  44421. if ( isFunction( qualifier ) ) {
  44422. return jQuery.grep( elements, function( elem, i ) {
  44423. return !!qualifier.call( elem, i, elem ) !== not;
  44424. } );
  44425. }
  44426. // Single element
  44427. if ( qualifier.nodeType ) {
  44428. return jQuery.grep( elements, function( elem ) {
  44429. return ( elem === qualifier ) !== not;
  44430. } );
  44431. }
  44432. // Arraylike of elements (jQuery, arguments, Array)
  44433. if ( typeof qualifier !== "string" ) {
  44434. return jQuery.grep( elements, function( elem ) {
  44435. return ( indexOf.call( qualifier, elem ) > -1 ) !== not;
  44436. } );
  44437. }
  44438. // Filtered directly for both simple and complex selectors
  44439. return jQuery.filter( qualifier, elements, not );
  44440. }
  44441. jQuery.filter = function( expr, elems, not ) {
  44442. var elem = elems[ 0 ];
  44443. if ( not ) {
  44444. expr = ":not(" + expr + ")";
  44445. }
  44446. if ( elems.length === 1 && elem.nodeType === 1 ) {
  44447. return jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : [];
  44448. }
  44449. return jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) {
  44450. return elem.nodeType === 1;
  44451. } ) );
  44452. };
  44453. jQuery.fn.extend( {
  44454. find: function( selector ) {
  44455. var i, ret,
  44456. len = this.length,
  44457. self = this;
  44458. if ( typeof selector !== "string" ) {
  44459. return this.pushStack( jQuery( selector ).filter( function() {
  44460. for ( i = 0; i < len; i++ ) {
  44461. if ( jQuery.contains( self[ i ], this ) ) {
  44462. return true;
  44463. }
  44464. }
  44465. } ) );
  44466. }
  44467. ret = this.pushStack( [] );
  44468. for ( i = 0; i < len; i++ ) {
  44469. jQuery.find( selector, self[ i ], ret );
  44470. }
  44471. return len > 1 ? jQuery.uniqueSort( ret ) : ret;
  44472. },
  44473. filter: function( selector ) {
  44474. return this.pushStack( winnow( this, selector || [], false ) );
  44475. },
  44476. not: function( selector ) {
  44477. return this.pushStack( winnow( this, selector || [], true ) );
  44478. },
  44479. is: function( selector ) {
  44480. return !!winnow(
  44481. this,
  44482. // If this is a positional/relative selector, check membership in the returned set
  44483. // so $("p:first").is("p:last") won't return true for a doc with two "p".
  44484. typeof selector === "string" && rneedsContext.test( selector ) ?
  44485. jQuery( selector ) :
  44486. selector || [],
  44487. false
  44488. ).length;
  44489. }
  44490. } );
  44491. // Initialize a jQuery object
  44492. // A central reference to the root jQuery(document)
  44493. var rootjQuery,
  44494. // A simple way to check for HTML strings
  44495. // Prioritize #id over <tag> to avoid XSS via location.hash (#9521)
  44496. // Strict HTML recognition (#11290: must start with <)
  44497. // Shortcut simple #id case for speed
  44498. rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/,
  44499. init = jQuery.fn.init = function( selector, context, root ) {
  44500. var match, elem;
  44501. // HANDLE: $(""), $(null), $(undefined), $(false)
  44502. if ( !selector ) {
  44503. return this;
  44504. }
  44505. // Method init() accepts an alternate rootjQuery
  44506. // so migrate can support jQuery.sub (gh-2101)
  44507. root = root || rootjQuery;
  44508. // Handle HTML strings
  44509. if ( typeof selector === "string" ) {
  44510. if ( selector[ 0 ] === "<" &&
  44511. selector[ selector.length - 1 ] === ">" &&
  44512. selector.length >= 3 ) {
  44513. // Assume that strings that start and end with <> are HTML and skip the regex check
  44514. match = [ null, selector, null ];
  44515. } else {
  44516. match = rquickExpr.exec( selector );
  44517. }
  44518. // Match html or make sure no context is specified for #id
  44519. if ( match && ( match[ 1 ] || !context ) ) {
  44520. // HANDLE: $(html) -> $(array)
  44521. if ( match[ 1 ] ) {
  44522. context = context instanceof jQuery ? context[ 0 ] : context;
  44523. // Option to run scripts is true for back-compat
  44524. // Intentionally let the error be thrown if parseHTML is not present
  44525. jQuery.merge( this, jQuery.parseHTML(
  44526. match[ 1 ],
  44527. context && context.nodeType ? context.ownerDocument || context : document,
  44528. true
  44529. ) );
  44530. // HANDLE: $(html, props)
  44531. if ( rsingleTag.test( match[ 1 ] ) && jQuery.isPlainObject( context ) ) {
  44532. for ( match in context ) {
  44533. // Properties of context are called as methods if possible
  44534. if ( isFunction( this[ match ] ) ) {
  44535. this[ match ]( context[ match ] );
  44536. // ...and otherwise set as attributes
  44537. } else {
  44538. this.attr( match, context[ match ] );
  44539. }
  44540. }
  44541. }
  44542. return this;
  44543. // HANDLE: $(#id)
  44544. } else {
  44545. elem = document.getElementById( match[ 2 ] );
  44546. if ( elem ) {
  44547. // Inject the element directly into the jQuery object
  44548. this[ 0 ] = elem;
  44549. this.length = 1;
  44550. }
  44551. return this;
  44552. }
  44553. // HANDLE: $(expr, $(...))
  44554. } else if ( !context || context.jquery ) {
  44555. return ( context || root ).find( selector );
  44556. // HANDLE: $(expr, context)
  44557. // (which is just equivalent to: $(context).find(expr)
  44558. } else {
  44559. return this.constructor( context ).find( selector );
  44560. }
  44561. // HANDLE: $(DOMElement)
  44562. } else if ( selector.nodeType ) {
  44563. this[ 0 ] = selector;
  44564. this.length = 1;
  44565. return this;
  44566. // HANDLE: $(function)
  44567. // Shortcut for document ready
  44568. } else if ( isFunction( selector ) ) {
  44569. return root.ready !== undefined ?
  44570. root.ready( selector ) :
  44571. // Execute immediately if ready is not present
  44572. selector( jQuery );
  44573. }
  44574. return jQuery.makeArray( selector, this );
  44575. };
  44576. // Give the init function the jQuery prototype for later instantiation
  44577. init.prototype = jQuery.fn;
  44578. // Initialize central reference
  44579. rootjQuery = jQuery( document );
  44580. var rparentsprev = /^(?:parents|prev(?:Until|All))/,
  44581. // Methods guaranteed to produce a unique set when starting from a unique set
  44582. guaranteedUnique = {
  44583. children: true,
  44584. contents: true,
  44585. next: true,
  44586. prev: true
  44587. };
  44588. jQuery.fn.extend( {
  44589. has: function( target ) {
  44590. var targets = jQuery( target, this ),
  44591. l = targets.length;
  44592. return this.filter( function() {
  44593. var i = 0;
  44594. for ( ; i < l; i++ ) {
  44595. if ( jQuery.contains( this, targets[ i ] ) ) {
  44596. return true;
  44597. }
  44598. }
  44599. } );
  44600. },
  44601. closest: function( selectors, context ) {
  44602. var cur,
  44603. i = 0,
  44604. l = this.length,
  44605. matched = [],
  44606. targets = typeof selectors !== "string" && jQuery( selectors );
  44607. // Positional selectors never match, since there's no _selection_ context
  44608. if ( !rneedsContext.test( selectors ) ) {
  44609. for ( ; i < l; i++ ) {
  44610. for ( cur = this[ i ]; cur && cur !== context; cur = cur.parentNode ) {
  44611. // Always skip document fragments
  44612. if ( cur.nodeType < 11 && ( targets ?
  44613. targets.index( cur ) > -1 :
  44614. // Don't pass non-elements to Sizzle
  44615. cur.nodeType === 1 &&
  44616. jQuery.find.matchesSelector( cur, selectors ) ) ) {
  44617. matched.push( cur );
  44618. break;
  44619. }
  44620. }
  44621. }
  44622. }
  44623. return this.pushStack( matched.length > 1 ? jQuery.uniqueSort( matched ) : matched );
  44624. },
  44625. // Determine the position of an element within the set
  44626. index: function( elem ) {
  44627. // No argument, return index in parent
  44628. if ( !elem ) {
  44629. return ( this[ 0 ] && this[ 0 ].parentNode ) ? this.first().prevAll().length : -1;
  44630. }
  44631. // Index in selector
  44632. if ( typeof elem === "string" ) {
  44633. return indexOf.call( jQuery( elem ), this[ 0 ] );
  44634. }
  44635. // Locate the position of the desired element
  44636. return indexOf.call( this,
  44637. // If it receives a jQuery object, the first element is used
  44638. elem.jquery ? elem[ 0 ] : elem
  44639. );
  44640. },
  44641. add: function( selector, context ) {
  44642. return this.pushStack(
  44643. jQuery.uniqueSort(
  44644. jQuery.merge( this.get(), jQuery( selector, context ) )
  44645. )
  44646. );
  44647. },
  44648. addBack: function( selector ) {
  44649. return this.add( selector == null ?
  44650. this.prevObject : this.prevObject.filter( selector )
  44651. );
  44652. }
  44653. } );
  44654. function sibling( cur, dir ) {
  44655. while ( ( cur = cur[ dir ] ) && cur.nodeType !== 1 ) {}
  44656. return cur;
  44657. }
  44658. jQuery.each( {
  44659. parent: function( elem ) {
  44660. var parent = elem.parentNode;
  44661. return parent && parent.nodeType !== 11 ? parent : null;
  44662. },
  44663. parents: function( elem ) {
  44664. return dir( elem, "parentNode" );
  44665. },
  44666. parentsUntil: function( elem, i, until ) {
  44667. return dir( elem, "parentNode", until );
  44668. },
  44669. next: function( elem ) {
  44670. return sibling( elem, "nextSibling" );
  44671. },
  44672. prev: function( elem ) {
  44673. return sibling( elem, "previousSibling" );
  44674. },
  44675. nextAll: function( elem ) {
  44676. return dir( elem, "nextSibling" );
  44677. },
  44678. prevAll: function( elem ) {
  44679. return dir( elem, "previousSibling" );
  44680. },
  44681. nextUntil: function( elem, i, until ) {
  44682. return dir( elem, "nextSibling", until );
  44683. },
  44684. prevUntil: function( elem, i, until ) {
  44685. return dir( elem, "previousSibling", until );
  44686. },
  44687. siblings: function( elem ) {
  44688. return siblings( ( elem.parentNode || {} ).firstChild, elem );
  44689. },
  44690. children: function( elem ) {
  44691. return siblings( elem.firstChild );
  44692. },
  44693. contents: function( elem ) {
  44694. if ( nodeName( elem, "iframe" ) ) {
  44695. return elem.contentDocument;
  44696. }
  44697. // Support: IE 9 - 11 only, iOS 7 only, Android Browser <=4.3 only
  44698. // Treat the template element as a regular one in browsers that
  44699. // don't support it.
  44700. if ( nodeName( elem, "template" ) ) {
  44701. elem = elem.content || elem;
  44702. }
  44703. return jQuery.merge( [], elem.childNodes );
  44704. }
  44705. }, function( name, fn ) {
  44706. jQuery.fn[ name ] = function( until, selector ) {
  44707. var matched = jQuery.map( this, fn, until );
  44708. if ( name.slice( -5 ) !== "Until" ) {
  44709. selector = until;
  44710. }
  44711. if ( selector && typeof selector === "string" ) {
  44712. matched = jQuery.filter( selector, matched );
  44713. }
  44714. if ( this.length > 1 ) {
  44715. // Remove duplicates
  44716. if ( !guaranteedUnique[ name ] ) {
  44717. jQuery.uniqueSort( matched );
  44718. }
  44719. // Reverse order for parents* and prev-derivatives
  44720. if ( rparentsprev.test( name ) ) {
  44721. matched.reverse();
  44722. }
  44723. }
  44724. return this.pushStack( matched );
  44725. };
  44726. } );
  44727. var rnothtmlwhite = ( /[^\x20\t\r\n\f]+/g );
  44728. // Convert String-formatted options into Object-formatted ones
  44729. function createOptions( options ) {
  44730. var object = {};
  44731. jQuery.each( options.match( rnothtmlwhite ) || [], function( _, flag ) {
  44732. object[ flag ] = true;
  44733. } );
  44734. return object;
  44735. }
  44736. /*
  44737. * Create a callback list using the following parameters:
  44738. *
  44739. * options: an optional list of space-separated options that will change how
  44740. * the callback list behaves or a more traditional option object
  44741. *
  44742. * By default a callback list will act like an event callback list and can be
  44743. * "fired" multiple times.
  44744. *
  44745. * Possible options:
  44746. *
  44747. * once: will ensure the callback list can only be fired once (like a Deferred)
  44748. *
  44749. * memory: will keep track of previous values and will call any callback added
  44750. * after the list has been fired right away with the latest "memorized"
  44751. * values (like a Deferred)
  44752. *
  44753. * unique: will ensure a callback can only be added once (no duplicate in the list)
  44754. *
  44755. * stopOnFalse: interrupt callings when a callback returns false
  44756. *
  44757. */
  44758. jQuery.Callbacks = function( options ) {
  44759. // Convert options from String-formatted to Object-formatted if needed
  44760. // (we check in cache first)
  44761. options = typeof options === "string" ?
  44762. createOptions( options ) :
  44763. jQuery.extend( {}, options );
  44764. var // Flag to know if list is currently firing
  44765. firing,
  44766. // Last fire value for non-forgettable lists
  44767. memory,
  44768. // Flag to know if list was already fired
  44769. fired,
  44770. // Flag to prevent firing
  44771. locked,
  44772. // Actual callback list
  44773. list = [],
  44774. // Queue of execution data for repeatable lists
  44775. queue = [],
  44776. // Index of currently firing callback (modified by add/remove as needed)
  44777. firingIndex = -1,
  44778. // Fire callbacks
  44779. fire = function() {
  44780. // Enforce single-firing
  44781. locked = locked || options.once;
  44782. // Execute callbacks for all pending executions,
  44783. // respecting firingIndex overrides and runtime changes
  44784. fired = firing = true;
  44785. for ( ; queue.length; firingIndex = -1 ) {
  44786. memory = queue.shift();
  44787. while ( ++firingIndex < list.length ) {
  44788. // Run callback and check for early termination
  44789. if ( list[ firingIndex ].apply( memory[ 0 ], memory[ 1 ] ) === false &&
  44790. options.stopOnFalse ) {
  44791. // Jump to end and forget the data so .add doesn't re-fire
  44792. firingIndex = list.length;
  44793. memory = false;
  44794. }
  44795. }
  44796. }
  44797. // Forget the data if we're done with it
  44798. if ( !options.memory ) {
  44799. memory = false;
  44800. }
  44801. firing = false;
  44802. // Clean up if we're done firing for good
  44803. if ( locked ) {
  44804. // Keep an empty list if we have data for future add calls
  44805. if ( memory ) {
  44806. list = [];
  44807. // Otherwise, this object is spent
  44808. } else {
  44809. list = "";
  44810. }
  44811. }
  44812. },
  44813. // Actual Callbacks object
  44814. self = {
  44815. // Add a callback or a collection of callbacks to the list
  44816. add: function() {
  44817. if ( list ) {
  44818. // If we have memory from a past run, we should fire after adding
  44819. if ( memory && !firing ) {
  44820. firingIndex = list.length - 1;
  44821. queue.push( memory );
  44822. }
  44823. ( function add( args ) {
  44824. jQuery.each( args, function( _, arg ) {
  44825. if ( isFunction( arg ) ) {
  44826. if ( !options.unique || !self.has( arg ) ) {
  44827. list.push( arg );
  44828. }
  44829. } else if ( arg && arg.length && toType( arg ) !== "string" ) {
  44830. // Inspect recursively
  44831. add( arg );
  44832. }
  44833. } );
  44834. } )( arguments );
  44835. if ( memory && !firing ) {
  44836. fire();
  44837. }
  44838. }
  44839. return this;
  44840. },
  44841. // Remove a callback from the list
  44842. remove: function() {
  44843. jQuery.each( arguments, function( _, arg ) {
  44844. var index;
  44845. while ( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) {
  44846. list.splice( index, 1 );
  44847. // Handle firing indexes
  44848. if ( index <= firingIndex ) {
  44849. firingIndex--;
  44850. }
  44851. }
  44852. } );
  44853. return this;
  44854. },
  44855. // Check if a given callback is in the list.
  44856. // If no argument is given, return whether or not list has callbacks attached.
  44857. has: function( fn ) {
  44858. return fn ?
  44859. jQuery.inArray( fn, list ) > -1 :
  44860. list.length > 0;
  44861. },
  44862. // Remove all callbacks from the list
  44863. empty: function() {
  44864. if ( list ) {
  44865. list = [];
  44866. }
  44867. return this;
  44868. },
  44869. // Disable .fire and .add
  44870. // Abort any current/pending executions
  44871. // Clear all callbacks and values
  44872. disable: function() {
  44873. locked = queue = [];
  44874. list = memory = "";
  44875. return this;
  44876. },
  44877. disabled: function() {
  44878. return !list;
  44879. },
  44880. // Disable .fire
  44881. // Also disable .add unless we have memory (since it would have no effect)
  44882. // Abort any pending executions
  44883. lock: function() {
  44884. locked = queue = [];
  44885. if ( !memory && !firing ) {
  44886. list = memory = "";
  44887. }
  44888. return this;
  44889. },
  44890. locked: function() {
  44891. return !!locked;
  44892. },
  44893. // Call all callbacks with the given context and arguments
  44894. fireWith: function( context, args ) {
  44895. if ( !locked ) {
  44896. args = args || [];
  44897. args = [ context, args.slice ? args.slice() : args ];
  44898. queue.push( args );
  44899. if ( !firing ) {
  44900. fire();
  44901. }
  44902. }
  44903. return this;
  44904. },
  44905. // Call all the callbacks with the given arguments
  44906. fire: function() {
  44907. self.fireWith( this, arguments );
  44908. return this;
  44909. },
  44910. // To know if the callbacks have already been called at least once
  44911. fired: function() {
  44912. return !!fired;
  44913. }
  44914. };
  44915. return self;
  44916. };
  44917. function Identity( v ) {
  44918. return v;
  44919. }
  44920. function Thrower( ex ) {
  44921. throw ex;
  44922. }
  44923. function adoptValue( value, resolve, reject, noValue ) {
  44924. var method;
  44925. try {
  44926. // Check for promise aspect first to privilege synchronous behavior
  44927. if ( value && isFunction( ( method = value.promise ) ) ) {
  44928. method.call( value ).done( resolve ).fail( reject );
  44929. // Other thenables
  44930. } else if ( value && isFunction( ( method = value.then ) ) ) {
  44931. method.call( value, resolve, reject );
  44932. // Other non-thenables
  44933. } else {
  44934. // Control `resolve` arguments by letting Array#slice cast boolean `noValue` to integer:
  44935. // * false: [ value ].slice( 0 ) => resolve( value )
  44936. // * true: [ value ].slice( 1 ) => resolve()
  44937. resolve.apply( undefined, [ value ].slice( noValue ) );
  44938. }
  44939. // For Promises/A+, convert exceptions into rejections
  44940. // Since jQuery.when doesn't unwrap thenables, we can skip the extra checks appearing in
  44941. // Deferred#then to conditionally suppress rejection.
  44942. } catch ( value ) {
  44943. // Support: Android 4.0 only
  44944. // Strict mode functions invoked without .call/.apply get global-object context
  44945. reject.apply( undefined, [ value ] );
  44946. }
  44947. }
  44948. jQuery.extend( {
  44949. Deferred: function( func ) {
  44950. var tuples = [
  44951. // action, add listener, callbacks,
  44952. // ... .then handlers, argument index, [final state]
  44953. [ "notify", "progress", jQuery.Callbacks( "memory" ),
  44954. jQuery.Callbacks( "memory" ), 2 ],
  44955. [ "resolve", "done", jQuery.Callbacks( "once memory" ),
  44956. jQuery.Callbacks( "once memory" ), 0, "resolved" ],
  44957. [ "reject", "fail", jQuery.Callbacks( "once memory" ),
  44958. jQuery.Callbacks( "once memory" ), 1, "rejected" ]
  44959. ],
  44960. state = "pending",
  44961. promise = {
  44962. state: function() {
  44963. return state;
  44964. },
  44965. always: function() {
  44966. deferred.done( arguments ).fail( arguments );
  44967. return this;
  44968. },
  44969. "catch": function( fn ) {
  44970. return promise.then( null, fn );
  44971. },
  44972. // Keep pipe for back-compat
  44973. pipe: function( /* fnDone, fnFail, fnProgress */ ) {
  44974. var fns = arguments;
  44975. return jQuery.Deferred( function( newDefer ) {
  44976. jQuery.each( tuples, function( i, tuple ) {
  44977. // Map tuples (progress, done, fail) to arguments (done, fail, progress)
  44978. var fn = isFunction( fns[ tuple[ 4 ] ] ) && fns[ tuple[ 4 ] ];
  44979. // deferred.progress(function() { bind to newDefer or newDefer.notify })
  44980. // deferred.done(function() { bind to newDefer or newDefer.resolve })
  44981. // deferred.fail(function() { bind to newDefer or newDefer.reject })
  44982. deferred[ tuple[ 1 ] ]( function() {
  44983. var returned = fn && fn.apply( this, arguments );
  44984. if ( returned && isFunction( returned.promise ) ) {
  44985. returned.promise()
  44986. .progress( newDefer.notify )
  44987. .done( newDefer.resolve )
  44988. .fail( newDefer.reject );
  44989. } else {
  44990. newDefer[ tuple[ 0 ] + "With" ](
  44991. this,
  44992. fn ? [ returned ] : arguments
  44993. );
  44994. }
  44995. } );
  44996. } );
  44997. fns = null;
  44998. } ).promise();
  44999. },
  45000. then: function( onFulfilled, onRejected, onProgress ) {
  45001. var maxDepth = 0;
  45002. function resolve( depth, deferred, handler, special ) {
  45003. return function() {
  45004. var that = this,
  45005. args = arguments,
  45006. mightThrow = function() {
  45007. var returned, then;
  45008. // Support: Promises/A+ section 2.3.3.3.3
  45009. // https://promisesaplus.com/#point-59
  45010. // Ignore double-resolution attempts
  45011. if ( depth < maxDepth ) {
  45012. return;
  45013. }
  45014. returned = handler.apply( that, args );
  45015. // Support: Promises/A+ section 2.3.1
  45016. // https://promisesaplus.com/#point-48
  45017. if ( returned === deferred.promise() ) {
  45018. throw new TypeError( "Thenable self-resolution" );
  45019. }
  45020. // Support: Promises/A+ sections 2.3.3.1, 3.5
  45021. // https://promisesaplus.com/#point-54
  45022. // https://promisesaplus.com/#point-75
  45023. // Retrieve `then` only once
  45024. then = returned &&
  45025. // Support: Promises/A+ section 2.3.4
  45026. // https://promisesaplus.com/#point-64
  45027. // Only check objects and functions for thenability
  45028. ( typeof returned === "object" ||
  45029. typeof returned === "function" ) &&
  45030. returned.then;
  45031. // Handle a returned thenable
  45032. if ( isFunction( then ) ) {
  45033. // Special processors (notify) just wait for resolution
  45034. if ( special ) {
  45035. then.call(
  45036. returned,
  45037. resolve( maxDepth, deferred, Identity, special ),
  45038. resolve( maxDepth, deferred, Thrower, special )
  45039. );
  45040. // Normal processors (resolve) also hook into progress
  45041. } else {
  45042. // ...and disregard older resolution values
  45043. maxDepth++;
  45044. then.call(
  45045. returned,
  45046. resolve( maxDepth, deferred, Identity, special ),
  45047. resolve( maxDepth, deferred, Thrower, special ),
  45048. resolve( maxDepth, deferred, Identity,
  45049. deferred.notifyWith )
  45050. );
  45051. }
  45052. // Handle all other returned values
  45053. } else {
  45054. // Only substitute handlers pass on context
  45055. // and multiple values (non-spec behavior)
  45056. if ( handler !== Identity ) {
  45057. that = undefined;
  45058. args = [ returned ];
  45059. }
  45060. // Process the value(s)
  45061. // Default process is resolve
  45062. ( special || deferred.resolveWith )( that, args );
  45063. }
  45064. },
  45065. // Only normal processors (resolve) catch and reject exceptions
  45066. process = special ?
  45067. mightThrow :
  45068. function() {
  45069. try {
  45070. mightThrow();
  45071. } catch ( e ) {
  45072. if ( jQuery.Deferred.exceptionHook ) {
  45073. jQuery.Deferred.exceptionHook( e,
  45074. process.stackTrace );
  45075. }
  45076. // Support: Promises/A+ section 2.3.3.3.4.1
  45077. // https://promisesaplus.com/#point-61
  45078. // Ignore post-resolution exceptions
  45079. if ( depth + 1 >= maxDepth ) {
  45080. // Only substitute handlers pass on context
  45081. // and multiple values (non-spec behavior)
  45082. if ( handler !== Thrower ) {
  45083. that = undefined;
  45084. args = [ e ];
  45085. }
  45086. deferred.rejectWith( that, args );
  45087. }
  45088. }
  45089. };
  45090. // Support: Promises/A+ section 2.3.3.3.1
  45091. // https://promisesaplus.com/#point-57
  45092. // Re-resolve promises immediately to dodge false rejection from
  45093. // subsequent errors
  45094. if ( depth ) {
  45095. process();
  45096. } else {
  45097. // Call an optional hook to record the stack, in case of exception
  45098. // since it's otherwise lost when execution goes async
  45099. if ( jQuery.Deferred.getStackHook ) {
  45100. process.stackTrace = jQuery.Deferred.getStackHook();
  45101. }
  45102. window.setTimeout( process );
  45103. }
  45104. };
  45105. }
  45106. return jQuery.Deferred( function( newDefer ) {
  45107. // progress_handlers.add( ... )
  45108. tuples[ 0 ][ 3 ].add(
  45109. resolve(
  45110. 0,
  45111. newDefer,
  45112. isFunction( onProgress ) ?
  45113. onProgress :
  45114. Identity,
  45115. newDefer.notifyWith
  45116. )
  45117. );
  45118. // fulfilled_handlers.add( ... )
  45119. tuples[ 1 ][ 3 ].add(
  45120. resolve(
  45121. 0,
  45122. newDefer,
  45123. isFunction( onFulfilled ) ?
  45124. onFulfilled :
  45125. Identity
  45126. )
  45127. );
  45128. // rejected_handlers.add( ... )
  45129. tuples[ 2 ][ 3 ].add(
  45130. resolve(
  45131. 0,
  45132. newDefer,
  45133. isFunction( onRejected ) ?
  45134. onRejected :
  45135. Thrower
  45136. )
  45137. );
  45138. } ).promise();
  45139. },
  45140. // Get a promise for this deferred
  45141. // If obj is provided, the promise aspect is added to the object
  45142. promise: function( obj ) {
  45143. return obj != null ? jQuery.extend( obj, promise ) : promise;
  45144. }
  45145. },
  45146. deferred = {};
  45147. // Add list-specific methods
  45148. jQuery.each( tuples, function( i, tuple ) {
  45149. var list = tuple[ 2 ],
  45150. stateString = tuple[ 5 ];
  45151. // promise.progress = list.add
  45152. // promise.done = list.add
  45153. // promise.fail = list.add
  45154. promise[ tuple[ 1 ] ] = list.add;
  45155. // Handle state
  45156. if ( stateString ) {
  45157. list.add(
  45158. function() {
  45159. // state = "resolved" (i.e., fulfilled)
  45160. // state = "rejected"
  45161. state = stateString;
  45162. },
  45163. // rejected_callbacks.disable
  45164. // fulfilled_callbacks.disable
  45165. tuples[ 3 - i ][ 2 ].disable,
  45166. // rejected_handlers.disable
  45167. // fulfilled_handlers.disable
  45168. tuples[ 3 - i ][ 3 ].disable,
  45169. // progress_callbacks.lock
  45170. tuples[ 0 ][ 2 ].lock,
  45171. // progress_handlers.lock
  45172. tuples[ 0 ][ 3 ].lock
  45173. );
  45174. }
  45175. // progress_handlers.fire
  45176. // fulfilled_handlers.fire
  45177. // rejected_handlers.fire
  45178. list.add( tuple[ 3 ].fire );
  45179. // deferred.notify = function() { deferred.notifyWith(...) }
  45180. // deferred.resolve = function() { deferred.resolveWith(...) }
  45181. // deferred.reject = function() { deferred.rejectWith(...) }
  45182. deferred[ tuple[ 0 ] ] = function() {
  45183. deferred[ tuple[ 0 ] + "With" ]( this === deferred ? undefined : this, arguments );
  45184. return this;
  45185. };
  45186. // deferred.notifyWith = list.fireWith
  45187. // deferred.resolveWith = list.fireWith
  45188. // deferred.rejectWith = list.fireWith
  45189. deferred[ tuple[ 0 ] + "With" ] = list.fireWith;
  45190. } );
  45191. // Make the deferred a promise
  45192. promise.promise( deferred );
  45193. // Call given func if any
  45194. if ( func ) {
  45195. func.call( deferred, deferred );
  45196. }
  45197. // All done!
  45198. return deferred;
  45199. },
  45200. // Deferred helper
  45201. when: function( singleValue ) {
  45202. var
  45203. // count of uncompleted subordinates
  45204. remaining = arguments.length,
  45205. // count of unprocessed arguments
  45206. i = remaining,
  45207. // subordinate fulfillment data
  45208. resolveContexts = Array( i ),
  45209. resolveValues = slice.call( arguments ),
  45210. // the master Deferred
  45211. master = jQuery.Deferred(),
  45212. // subordinate callback factory
  45213. updateFunc = function( i ) {
  45214. return function( value ) {
  45215. resolveContexts[ i ] = this;
  45216. resolveValues[ i ] = arguments.length > 1 ? slice.call( arguments ) : value;
  45217. if ( !( --remaining ) ) {
  45218. master.resolveWith( resolveContexts, resolveValues );
  45219. }
  45220. };
  45221. };
  45222. // Single- and empty arguments are adopted like Promise.resolve
  45223. if ( remaining <= 1 ) {
  45224. adoptValue( singleValue, master.done( updateFunc( i ) ).resolve, master.reject,
  45225. !remaining );
  45226. // Use .then() to unwrap secondary thenables (cf. gh-3000)
  45227. if ( master.state() === "pending" ||
  45228. isFunction( resolveValues[ i ] && resolveValues[ i ].then ) ) {
  45229. return master.then();
  45230. }
  45231. }
  45232. // Multiple arguments are aggregated like Promise.all array elements
  45233. while ( i-- ) {
  45234. adoptValue( resolveValues[ i ], updateFunc( i ), master.reject );
  45235. }
  45236. return master.promise();
  45237. }
  45238. } );
  45239. // These usually indicate a programmer mistake during development,
  45240. // warn about them ASAP rather than swallowing them by default.
  45241. var rerrorNames = /^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;
  45242. jQuery.Deferred.exceptionHook = function( error, stack ) {
  45243. // Support: IE 8 - 9 only
  45244. // Console exists when dev tools are open, which can happen at any time
  45245. if ( window.console && window.console.warn && error && rerrorNames.test( error.name ) ) {
  45246. window.console.warn( "jQuery.Deferred exception: " + error.message, error.stack, stack );
  45247. }
  45248. };
  45249. jQuery.readyException = function( error ) {
  45250. window.setTimeout( function() {
  45251. throw error;
  45252. } );
  45253. };
  45254. // The deferred used on DOM ready
  45255. var readyList = jQuery.Deferred();
  45256. jQuery.fn.ready = function( fn ) {
  45257. readyList
  45258. .then( fn )
  45259. // Wrap jQuery.readyException in a function so that the lookup
  45260. // happens at the time of error handling instead of callback
  45261. // registration.
  45262. .catch( function( error ) {
  45263. jQuery.readyException( error );
  45264. } );
  45265. return this;
  45266. };
  45267. jQuery.extend( {
  45268. // Is the DOM ready to be used? Set to true once it occurs.
  45269. isReady: false,
  45270. // A counter to track how many items to wait for before
  45271. // the ready event fires. See #6781
  45272. readyWait: 1,
  45273. // Handle when the DOM is ready
  45274. ready: function( wait ) {
  45275. // Abort if there are pending holds or we're already ready
  45276. if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) {
  45277. return;
  45278. }
  45279. // Remember that the DOM is ready
  45280. jQuery.isReady = true;
  45281. // If a normal DOM Ready event fired, decrement, and wait if need be
  45282. if ( wait !== true && --jQuery.readyWait > 0 ) {
  45283. return;
  45284. }
  45285. // If there are functions bound, to execute
  45286. readyList.resolveWith( document, [ jQuery ] );
  45287. }
  45288. } );
  45289. jQuery.ready.then = readyList.then;
  45290. // The ready event handler and self cleanup method
  45291. function completed() {
  45292. document.removeEventListener( "DOMContentLoaded", completed );
  45293. window.removeEventListener( "load", completed );
  45294. jQuery.ready();
  45295. }
  45296. // Catch cases where $(document).ready() is called
  45297. // after the browser event has already occurred.
  45298. // Support: IE <=9 - 10 only
  45299. // Older IE sometimes signals "interactive" too soon
  45300. if ( document.readyState === "complete" ||
  45301. ( document.readyState !== "loading" && !document.documentElement.doScroll ) ) {
  45302. // Handle it asynchronously to allow scripts the opportunity to delay ready
  45303. window.setTimeout( jQuery.ready );
  45304. } else {
  45305. // Use the handy event callback
  45306. document.addEventListener( "DOMContentLoaded", completed );
  45307. // A fallback to window.onload, that will always work
  45308. window.addEventListener( "load", completed );
  45309. }
  45310. // Multifunctional method to get and set values of a collection
  45311. // The value/s can optionally be executed if it's a function
  45312. var access = function( elems, fn, key, value, chainable, emptyGet, raw ) {
  45313. var i = 0,
  45314. len = elems.length,
  45315. bulk = key == null;
  45316. // Sets many values
  45317. if ( toType( key ) === "object" ) {
  45318. chainable = true;
  45319. for ( i in key ) {
  45320. access( elems, fn, i, key[ i ], true, emptyGet, raw );
  45321. }
  45322. // Sets one value
  45323. } else if ( value !== undefined ) {
  45324. chainable = true;
  45325. if ( !isFunction( value ) ) {
  45326. raw = true;
  45327. }
  45328. if ( bulk ) {
  45329. // Bulk operations run against the entire set
  45330. if ( raw ) {
  45331. fn.call( elems, value );
  45332. fn = null;
  45333. // ...except when executing function values
  45334. } else {
  45335. bulk = fn;
  45336. fn = function( elem, key, value ) {
  45337. return bulk.call( jQuery( elem ), value );
  45338. };
  45339. }
  45340. }
  45341. if ( fn ) {
  45342. for ( ; i < len; i++ ) {
  45343. fn(
  45344. elems[ i ], key, raw ?
  45345. value :
  45346. value.call( elems[ i ], i, fn( elems[ i ], key ) )
  45347. );
  45348. }
  45349. }
  45350. }
  45351. if ( chainable ) {
  45352. return elems;
  45353. }
  45354. // Gets
  45355. if ( bulk ) {
  45356. return fn.call( elems );
  45357. }
  45358. return len ? fn( elems[ 0 ], key ) : emptyGet;
  45359. };
  45360. // Matches dashed string for camelizing
  45361. var rmsPrefix = /^-ms-/,
  45362. rdashAlpha = /-([a-z])/g;
  45363. // Used by camelCase as callback to replace()
  45364. function fcamelCase( all, letter ) {
  45365. return letter.toUpperCase();
  45366. }
  45367. // Convert dashed to camelCase; used by the css and data modules
  45368. // Support: IE <=9 - 11, Edge 12 - 15
  45369. // Microsoft forgot to hump their vendor prefix (#9572)
  45370. function camelCase( string ) {
  45371. return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase );
  45372. }
  45373. var acceptData = function( owner ) {
  45374. // Accepts only:
  45375. // - Node
  45376. // - Node.ELEMENT_NODE
  45377. // - Node.DOCUMENT_NODE
  45378. // - Object
  45379. // - Any
  45380. return owner.nodeType === 1 || owner.nodeType === 9 || !( +owner.nodeType );
  45381. };
  45382. function Data() {
  45383. this.expando = jQuery.expando + Data.uid++;
  45384. }
  45385. Data.uid = 1;
  45386. Data.prototype = {
  45387. cache: function( owner ) {
  45388. // Check if the owner object already has a cache
  45389. var value = owner[ this.expando ];
  45390. // If not, create one
  45391. if ( !value ) {
  45392. value = {};
  45393. // We can accept data for non-element nodes in modern browsers,
  45394. // but we should not, see #8335.
  45395. // Always return an empty object.
  45396. if ( acceptData( owner ) ) {
  45397. // If it is a node unlikely to be stringify-ed or looped over
  45398. // use plain assignment
  45399. if ( owner.nodeType ) {
  45400. owner[ this.expando ] = value;
  45401. // Otherwise secure it in a non-enumerable property
  45402. // configurable must be true to allow the property to be
  45403. // deleted when data is removed
  45404. } else {
  45405. Object.defineProperty( owner, this.expando, {
  45406. value: value,
  45407. configurable: true
  45408. } );
  45409. }
  45410. }
  45411. }
  45412. return value;
  45413. },
  45414. set: function( owner, data, value ) {
  45415. var prop,
  45416. cache = this.cache( owner );
  45417. // Handle: [ owner, key, value ] args
  45418. // Always use camelCase key (gh-2257)
  45419. if ( typeof data === "string" ) {
  45420. cache[ camelCase( data ) ] = value;
  45421. // Handle: [ owner, { properties } ] args
  45422. } else {
  45423. // Copy the properties one-by-one to the cache object
  45424. for ( prop in data ) {
  45425. cache[ camelCase( prop ) ] = data[ prop ];
  45426. }
  45427. }
  45428. return cache;
  45429. },
  45430. get: function( owner, key ) {
  45431. return key === undefined ?
  45432. this.cache( owner ) :
  45433. // Always use camelCase key (gh-2257)
  45434. owner[ this.expando ] && owner[ this.expando ][ camelCase( key ) ];
  45435. },
  45436. access: function( owner, key, value ) {
  45437. // In cases where either:
  45438. //
  45439. // 1. No key was specified
  45440. // 2. A string key was specified, but no value provided
  45441. //
  45442. // Take the "read" path and allow the get method to determine
  45443. // which value to return, respectively either:
  45444. //
  45445. // 1. The entire cache object
  45446. // 2. The data stored at the key
  45447. //
  45448. if ( key === undefined ||
  45449. ( ( key && typeof key === "string" ) && value === undefined ) ) {
  45450. return this.get( owner, key );
  45451. }
  45452. // When the key is not a string, or both a key and value
  45453. // are specified, set or extend (existing objects) with either:
  45454. //
  45455. // 1. An object of properties
  45456. // 2. A key and value
  45457. //
  45458. this.set( owner, key, value );
  45459. // Since the "set" path can have two possible entry points
  45460. // return the expected data based on which path was taken[*]
  45461. return value !== undefined ? value : key;
  45462. },
  45463. remove: function( owner, key ) {
  45464. var i,
  45465. cache = owner[ this.expando ];
  45466. if ( cache === undefined ) {
  45467. return;
  45468. }
  45469. if ( key !== undefined ) {
  45470. // Support array or space separated string of keys
  45471. if ( Array.isArray( key ) ) {
  45472. // If key is an array of keys...
  45473. // We always set camelCase keys, so remove that.
  45474. key = key.map( camelCase );
  45475. } else {
  45476. key = camelCase( key );
  45477. // If a key with the spaces exists, use it.
  45478. // Otherwise, create an array by matching non-whitespace
  45479. key = key in cache ?
  45480. [ key ] :
  45481. ( key.match( rnothtmlwhite ) || [] );
  45482. }
  45483. i = key.length;
  45484. while ( i-- ) {
  45485. delete cache[ key[ i ] ];
  45486. }
  45487. }
  45488. // Remove the expando if there's no more data
  45489. if ( key === undefined || jQuery.isEmptyObject( cache ) ) {
  45490. // Support: Chrome <=35 - 45
  45491. // Webkit & Blink performance suffers when deleting properties
  45492. // from DOM nodes, so set to undefined instead
  45493. // https://bugs.chromium.org/p/chromium/issues/detail?id=378607 (bug restricted)
  45494. if ( owner.nodeType ) {
  45495. owner[ this.expando ] = undefined;
  45496. } else {
  45497. delete owner[ this.expando ];
  45498. }
  45499. }
  45500. },
  45501. hasData: function( owner ) {
  45502. var cache = owner[ this.expando ];
  45503. return cache !== undefined && !jQuery.isEmptyObject( cache );
  45504. }
  45505. };
  45506. var dataPriv = new Data();
  45507. var dataUser = new Data();
  45508. // Implementation Summary
  45509. //
  45510. // 1. Enforce API surface and semantic compatibility with 1.9.x branch
  45511. // 2. Improve the module's maintainability by reducing the storage
  45512. // paths to a single mechanism.
  45513. // 3. Use the same single mechanism to support "private" and "user" data.
  45514. // 4. _Never_ expose "private" data to user code (TODO: Drop _data, _removeData)
  45515. // 5. Avoid exposing implementation details on user objects (eg. expando properties)
  45516. // 6. Provide a clear path for implementation upgrade to WeakMap in 2014
  45517. var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,
  45518. rmultiDash = /[A-Z]/g;
  45519. function getData( data ) {
  45520. if ( data === "true" ) {
  45521. return true;
  45522. }
  45523. if ( data === "false" ) {
  45524. return false;
  45525. }
  45526. if ( data === "null" ) {
  45527. return null;
  45528. }
  45529. // Only convert to a number if it doesn't change the string
  45530. if ( data === +data + "" ) {
  45531. return +data;
  45532. }
  45533. if ( rbrace.test( data ) ) {
  45534. return JSON.parse( data );
  45535. }
  45536. return data;
  45537. }
  45538. function dataAttr( elem, key, data ) {
  45539. var name;
  45540. // If nothing was found internally, try to fetch any
  45541. // data from the HTML5 data-* attribute
  45542. if ( data === undefined && elem.nodeType === 1 ) {
  45543. name = "data-" + key.replace( rmultiDash, "-$&" ).toLowerCase();
  45544. data = elem.getAttribute( name );
  45545. if ( typeof data === "string" ) {
  45546. try {
  45547. data = getData( data );
  45548. } catch ( e ) {}
  45549. // Make sure we set the data so it isn't changed later
  45550. dataUser.set( elem, key, data );
  45551. } else {
  45552. data = undefined;
  45553. }
  45554. }
  45555. return data;
  45556. }
  45557. jQuery.extend( {
  45558. hasData: function( elem ) {
  45559. return dataUser.hasData( elem ) || dataPriv.hasData( elem );
  45560. },
  45561. data: function( elem, name, data ) {
  45562. return dataUser.access( elem, name, data );
  45563. },
  45564. removeData: function( elem, name ) {
  45565. dataUser.remove( elem, name );
  45566. },
  45567. // TODO: Now that all calls to _data and _removeData have been replaced
  45568. // with direct calls to dataPriv methods, these can be deprecated.
  45569. _data: function( elem, name, data ) {
  45570. return dataPriv.access( elem, name, data );
  45571. },
  45572. _removeData: function( elem, name ) {
  45573. dataPriv.remove( elem, name );
  45574. }
  45575. } );
  45576. jQuery.fn.extend( {
  45577. data: function( key, value ) {
  45578. var i, name, data,
  45579. elem = this[ 0 ],
  45580. attrs = elem && elem.attributes;
  45581. // Gets all values
  45582. if ( key === undefined ) {
  45583. if ( this.length ) {
  45584. data = dataUser.get( elem );
  45585. if ( elem.nodeType === 1 && !dataPriv.get( elem, "hasDataAttrs" ) ) {
  45586. i = attrs.length;
  45587. while ( i-- ) {
  45588. // Support: IE 11 only
  45589. // The attrs elements can be null (#14894)
  45590. if ( attrs[ i ] ) {
  45591. name = attrs[ i ].name;
  45592. if ( name.indexOf( "data-" ) === 0 ) {
  45593. name = camelCase( name.slice( 5 ) );
  45594. dataAttr( elem, name, data[ name ] );
  45595. }
  45596. }
  45597. }
  45598. dataPriv.set( elem, "hasDataAttrs", true );
  45599. }
  45600. }
  45601. return data;
  45602. }
  45603. // Sets multiple values
  45604. if ( typeof key === "object" ) {
  45605. return this.each( function() {
  45606. dataUser.set( this, key );
  45607. } );
  45608. }
  45609. return access( this, function( value ) {
  45610. var data;
  45611. // The calling jQuery object (element matches) is not empty
  45612. // (and therefore has an element appears at this[ 0 ]) and the
  45613. // `value` parameter was not undefined. An empty jQuery object
  45614. // will result in `undefined` for elem = this[ 0 ] which will
  45615. // throw an exception if an attempt to read a data cache is made.
  45616. if ( elem && value === undefined ) {
  45617. // Attempt to get data from the cache
  45618. // The key will always be camelCased in Data
  45619. data = dataUser.get( elem, key );
  45620. if ( data !== undefined ) {
  45621. return data;
  45622. }
  45623. // Attempt to "discover" the data in
  45624. // HTML5 custom data-* attrs
  45625. data = dataAttr( elem, key );
  45626. if ( data !== undefined ) {
  45627. return data;
  45628. }
  45629. // We tried really hard, but the data doesn't exist.
  45630. return;
  45631. }
  45632. // Set the data...
  45633. this.each( function() {
  45634. // We always store the camelCased key
  45635. dataUser.set( this, key, value );
  45636. } );
  45637. }, null, value, arguments.length > 1, null, true );
  45638. },
  45639. removeData: function( key ) {
  45640. return this.each( function() {
  45641. dataUser.remove( this, key );
  45642. } );
  45643. }
  45644. } );
  45645. jQuery.extend( {
  45646. queue: function( elem, type, data ) {
  45647. var queue;
  45648. if ( elem ) {
  45649. type = ( type || "fx" ) + "queue";
  45650. queue = dataPriv.get( elem, type );
  45651. // Speed up dequeue by getting out quickly if this is just a lookup
  45652. if ( data ) {
  45653. if ( !queue || Array.isArray( data ) ) {
  45654. queue = dataPriv.access( elem, type, jQuery.makeArray( data ) );
  45655. } else {
  45656. queue.push( data );
  45657. }
  45658. }
  45659. return queue || [];
  45660. }
  45661. },
  45662. dequeue: function( elem, type ) {
  45663. type = type || "fx";
  45664. var queue = jQuery.queue( elem, type ),
  45665. startLength = queue.length,
  45666. fn = queue.shift(),
  45667. hooks = jQuery._queueHooks( elem, type ),
  45668. next = function() {
  45669. jQuery.dequeue( elem, type );
  45670. };
  45671. // If the fx queue is dequeued, always remove the progress sentinel
  45672. if ( fn === "inprogress" ) {
  45673. fn = queue.shift();
  45674. startLength--;
  45675. }
  45676. if ( fn ) {
  45677. // Add a progress sentinel to prevent the fx queue from being
  45678. // automatically dequeued
  45679. if ( type === "fx" ) {
  45680. queue.unshift( "inprogress" );
  45681. }
  45682. // Clear up the last queue stop function
  45683. delete hooks.stop;
  45684. fn.call( elem, next, hooks );
  45685. }
  45686. if ( !startLength && hooks ) {
  45687. hooks.empty.fire();
  45688. }
  45689. },
  45690. // Not public - generate a queueHooks object, or return the current one
  45691. _queueHooks: function( elem, type ) {
  45692. var key = type + "queueHooks";
  45693. return dataPriv.get( elem, key ) || dataPriv.access( elem, key, {
  45694. empty: jQuery.Callbacks( "once memory" ).add( function() {
  45695. dataPriv.remove( elem, [ type + "queue", key ] );
  45696. } )
  45697. } );
  45698. }
  45699. } );
  45700. jQuery.fn.extend( {
  45701. queue: function( type, data ) {
  45702. var setter = 2;
  45703. if ( typeof type !== "string" ) {
  45704. data = type;
  45705. type = "fx";
  45706. setter--;
  45707. }
  45708. if ( arguments.length < setter ) {
  45709. return jQuery.queue( this[ 0 ], type );
  45710. }
  45711. return data === undefined ?
  45712. this :
  45713. this.each( function() {
  45714. var queue = jQuery.queue( this, type, data );
  45715. // Ensure a hooks for this queue
  45716. jQuery._queueHooks( this, type );
  45717. if ( type === "fx" && queue[ 0 ] !== "inprogress" ) {
  45718. jQuery.dequeue( this, type );
  45719. }
  45720. } );
  45721. },
  45722. dequeue: function( type ) {
  45723. return this.each( function() {
  45724. jQuery.dequeue( this, type );
  45725. } );
  45726. },
  45727. clearQueue: function( type ) {
  45728. return this.queue( type || "fx", [] );
  45729. },
  45730. // Get a promise resolved when queues of a certain type
  45731. // are emptied (fx is the type by default)
  45732. promise: function( type, obj ) {
  45733. var tmp,
  45734. count = 1,
  45735. defer = jQuery.Deferred(),
  45736. elements = this,
  45737. i = this.length,
  45738. resolve = function() {
  45739. if ( !( --count ) ) {
  45740. defer.resolveWith( elements, [ elements ] );
  45741. }
  45742. };
  45743. if ( typeof type !== "string" ) {
  45744. obj = type;
  45745. type = undefined;
  45746. }
  45747. type = type || "fx";
  45748. while ( i-- ) {
  45749. tmp = dataPriv.get( elements[ i ], type + "queueHooks" );
  45750. if ( tmp && tmp.empty ) {
  45751. count++;
  45752. tmp.empty.add( resolve );
  45753. }
  45754. }
  45755. resolve();
  45756. return defer.promise( obj );
  45757. }
  45758. } );
  45759. var pnum = ( /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/ ).source;
  45760. var rcssNum = new RegExp( "^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i" );
  45761. var cssExpand = [ "Top", "Right", "Bottom", "Left" ];
  45762. var isHiddenWithinTree = function( elem, el ) {
  45763. // isHiddenWithinTree might be called from jQuery#filter function;
  45764. // in that case, element will be second argument
  45765. elem = el || elem;
  45766. // Inline style trumps all
  45767. return elem.style.display === "none" ||
  45768. elem.style.display === "" &&
  45769. // Otherwise, check computed style
  45770. // Support: Firefox <=43 - 45
  45771. // Disconnected elements can have computed display: none, so first confirm that elem is
  45772. // in the document.
  45773. jQuery.contains( elem.ownerDocument, elem ) &&
  45774. jQuery.css( elem, "display" ) === "none";
  45775. };
  45776. var swap = function( elem, options, callback, args ) {
  45777. var ret, name,
  45778. old = {};
  45779. // Remember the old values, and insert the new ones
  45780. for ( name in options ) {
  45781. old[ name ] = elem.style[ name ];
  45782. elem.style[ name ] = options[ name ];
  45783. }
  45784. ret = callback.apply( elem, args || [] );
  45785. // Revert the old values
  45786. for ( name in options ) {
  45787. elem.style[ name ] = old[ name ];
  45788. }
  45789. return ret;
  45790. };
  45791. function adjustCSS( elem, prop, valueParts, tween ) {
  45792. var adjusted, scale,
  45793. maxIterations = 20,
  45794. currentValue = tween ?
  45795. function() {
  45796. return tween.cur();
  45797. } :
  45798. function() {
  45799. return jQuery.css( elem, prop, "" );
  45800. },
  45801. initial = currentValue(),
  45802. unit = valueParts && valueParts[ 3 ] || ( jQuery.cssNumber[ prop ] ? "" : "px" ),
  45803. // Starting value computation is required for potential unit mismatches
  45804. initialInUnit = ( jQuery.cssNumber[ prop ] || unit !== "px" && +initial ) &&
  45805. rcssNum.exec( jQuery.css( elem, prop ) );
  45806. if ( initialInUnit && initialInUnit[ 3 ] !== unit ) {
  45807. // Support: Firefox <=54
  45808. // Halve the iteration target value to prevent interference from CSS upper bounds (gh-2144)
  45809. initial = initial / 2;
  45810. // Trust units reported by jQuery.css
  45811. unit = unit || initialInUnit[ 3 ];
  45812. // Iteratively approximate from a nonzero starting point
  45813. initialInUnit = +initial || 1;
  45814. while ( maxIterations-- ) {
  45815. // Evaluate and update our best guess (doubling guesses that zero out).
  45816. // Finish if the scale equals or crosses 1 (making the old*new product non-positive).
  45817. jQuery.style( elem, prop, initialInUnit + unit );
  45818. if ( ( 1 - scale ) * ( 1 - ( scale = currentValue() / initial || 0.5 ) ) <= 0 ) {
  45819. maxIterations = 0;
  45820. }
  45821. initialInUnit = initialInUnit / scale;
  45822. }
  45823. initialInUnit = initialInUnit * 2;
  45824. jQuery.style( elem, prop, initialInUnit + unit );
  45825. // Make sure we update the tween properties later on
  45826. valueParts = valueParts || [];
  45827. }
  45828. if ( valueParts ) {
  45829. initialInUnit = +initialInUnit || +initial || 0;
  45830. // Apply relative offset (+=/-=) if specified
  45831. adjusted = valueParts[ 1 ] ?
  45832. initialInUnit + ( valueParts[ 1 ] + 1 ) * valueParts[ 2 ] :
  45833. +valueParts[ 2 ];
  45834. if ( tween ) {
  45835. tween.unit = unit;
  45836. tween.start = initialInUnit;
  45837. tween.end = adjusted;
  45838. }
  45839. }
  45840. return adjusted;
  45841. }
  45842. var defaultDisplayMap = {};
  45843. function getDefaultDisplay( elem ) {
  45844. var temp,
  45845. doc = elem.ownerDocument,
  45846. nodeName = elem.nodeName,
  45847. display = defaultDisplayMap[ nodeName ];
  45848. if ( display ) {
  45849. return display;
  45850. }
  45851. temp = doc.body.appendChild( doc.createElement( nodeName ) );
  45852. display = jQuery.css( temp, "display" );
  45853. temp.parentNode.removeChild( temp );
  45854. if ( display === "none" ) {
  45855. display = "block";
  45856. }
  45857. defaultDisplayMap[ nodeName ] = display;
  45858. return display;
  45859. }
  45860. function showHide( elements, show ) {
  45861. var display, elem,
  45862. values = [],
  45863. index = 0,
  45864. length = elements.length;
  45865. // Determine new display value for elements that need to change
  45866. for ( ; index < length; index++ ) {
  45867. elem = elements[ index ];
  45868. if ( !elem.style ) {
  45869. continue;
  45870. }
  45871. display = elem.style.display;
  45872. if ( show ) {
  45873. // Since we force visibility upon cascade-hidden elements, an immediate (and slow)
  45874. // check is required in this first loop unless we have a nonempty display value (either
  45875. // inline or about-to-be-restored)
  45876. if ( display === "none" ) {
  45877. values[ index ] = dataPriv.get( elem, "display" ) || null;
  45878. if ( !values[ index ] ) {
  45879. elem.style.display = "";
  45880. }
  45881. }
  45882. if ( elem.style.display === "" && isHiddenWithinTree( elem ) ) {
  45883. values[ index ] = getDefaultDisplay( elem );
  45884. }
  45885. } else {
  45886. if ( display !== "none" ) {
  45887. values[ index ] = "none";
  45888. // Remember what we're overwriting
  45889. dataPriv.set( elem, "display", display );
  45890. }
  45891. }
  45892. }
  45893. // Set the display of the elements in a second loop to avoid constant reflow
  45894. for ( index = 0; index < length; index++ ) {
  45895. if ( values[ index ] != null ) {
  45896. elements[ index ].style.display = values[ index ];
  45897. }
  45898. }
  45899. return elements;
  45900. }
  45901. jQuery.fn.extend( {
  45902. show: function() {
  45903. return showHide( this, true );
  45904. },
  45905. hide: function() {
  45906. return showHide( this );
  45907. },
  45908. toggle: function( state ) {
  45909. if ( typeof state === "boolean" ) {
  45910. return state ? this.show() : this.hide();
  45911. }
  45912. return this.each( function() {
  45913. if ( isHiddenWithinTree( this ) ) {
  45914. jQuery( this ).show();
  45915. } else {
  45916. jQuery( this ).hide();
  45917. }
  45918. } );
  45919. }
  45920. } );
  45921. var rcheckableType = ( /^(?:checkbox|radio)$/i );
  45922. var rtagName = ( /<([a-z][^\/\0>\x20\t\r\n\f]+)/i );
  45923. var rscriptType = ( /^$|^module$|\/(?:java|ecma)script/i );
  45924. // We have to close these tags to support XHTML (#13200)
  45925. var wrapMap = {
  45926. // Support: IE <=9 only
  45927. option: [ 1, "<select multiple='multiple'>", "</select>" ],
  45928. // XHTML parsers do not magically insert elements in the
  45929. // same way that tag soup parsers do. So we cannot shorten
  45930. // this by omitting <tbody> or other required elements.
  45931. thead: [ 1, "<table>", "</table>" ],
  45932. col: [ 2, "<table><colgroup>", "</colgroup></table>" ],
  45933. tr: [ 2, "<table><tbody>", "</tbody></table>" ],
  45934. td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ],
  45935. _default: [ 0, "", "" ]
  45936. };
  45937. // Support: IE <=9 only
  45938. wrapMap.optgroup = wrapMap.option;
  45939. wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
  45940. wrapMap.th = wrapMap.td;
  45941. function getAll( context, tag ) {
  45942. // Support: IE <=9 - 11 only
  45943. // Use typeof to avoid zero-argument method invocation on host objects (#15151)
  45944. var ret;
  45945. if ( typeof context.getElementsByTagName !== "undefined" ) {
  45946. ret = context.getElementsByTagName( tag || "*" );
  45947. } else if ( typeof context.querySelectorAll !== "undefined" ) {
  45948. ret = context.querySelectorAll( tag || "*" );
  45949. } else {
  45950. ret = [];
  45951. }
  45952. if ( tag === undefined || tag && nodeName( context, tag ) ) {
  45953. return jQuery.merge( [ context ], ret );
  45954. }
  45955. return ret;
  45956. }
  45957. // Mark scripts as having already been evaluated
  45958. function setGlobalEval( elems, refElements ) {
  45959. var i = 0,
  45960. l = elems.length;
  45961. for ( ; i < l; i++ ) {
  45962. dataPriv.set(
  45963. elems[ i ],
  45964. "globalEval",
  45965. !refElements || dataPriv.get( refElements[ i ], "globalEval" )
  45966. );
  45967. }
  45968. }
  45969. var rhtml = /<|&#?\w+;/;
  45970. function buildFragment( elems, context, scripts, selection, ignored ) {
  45971. var elem, tmp, tag, wrap, contains, j,
  45972. fragment = context.createDocumentFragment(),
  45973. nodes = [],
  45974. i = 0,
  45975. l = elems.length;
  45976. for ( ; i < l; i++ ) {
  45977. elem = elems[ i ];
  45978. if ( elem || elem === 0 ) {
  45979. // Add nodes directly
  45980. if ( toType( elem ) === "object" ) {
  45981. // Support: Android <=4.0 only, PhantomJS 1 only
  45982. // push.apply(_, arraylike) throws on ancient WebKit
  45983. jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem );
  45984. // Convert non-html into a text node
  45985. } else if ( !rhtml.test( elem ) ) {
  45986. nodes.push( context.createTextNode( elem ) );
  45987. // Convert html into DOM nodes
  45988. } else {
  45989. tmp = tmp || fragment.appendChild( context.createElement( "div" ) );
  45990. // Deserialize a standard representation
  45991. tag = ( rtagName.exec( elem ) || [ "", "" ] )[ 1 ].toLowerCase();
  45992. wrap = wrapMap[ tag ] || wrapMap._default;
  45993. tmp.innerHTML = wrap[ 1 ] + jQuery.htmlPrefilter( elem ) + wrap[ 2 ];
  45994. // Descend through wrappers to the right content
  45995. j = wrap[ 0 ];
  45996. while ( j-- ) {
  45997. tmp = tmp.lastChild;
  45998. }
  45999. // Support: Android <=4.0 only, PhantomJS 1 only
  46000. // push.apply(_, arraylike) throws on ancient WebKit
  46001. jQuery.merge( nodes, tmp.childNodes );
  46002. // Remember the top-level container
  46003. tmp = fragment.firstChild;
  46004. // Ensure the created nodes are orphaned (#12392)
  46005. tmp.textContent = "";
  46006. }
  46007. }
  46008. }
  46009. // Remove wrapper from fragment
  46010. fragment.textContent = "";
  46011. i = 0;
  46012. while ( ( elem = nodes[ i++ ] ) ) {
  46013. // Skip elements already in the context collection (trac-4087)
  46014. if ( selection && jQuery.inArray( elem, selection ) > -1 ) {
  46015. if ( ignored ) {
  46016. ignored.push( elem );
  46017. }
  46018. continue;
  46019. }
  46020. contains = jQuery.contains( elem.ownerDocument, elem );
  46021. // Append to fragment
  46022. tmp = getAll( fragment.appendChild( elem ), "script" );
  46023. // Preserve script evaluation history
  46024. if ( contains ) {
  46025. setGlobalEval( tmp );
  46026. }
  46027. // Capture executables
  46028. if ( scripts ) {
  46029. j = 0;
  46030. while ( ( elem = tmp[ j++ ] ) ) {
  46031. if ( rscriptType.test( elem.type || "" ) ) {
  46032. scripts.push( elem );
  46033. }
  46034. }
  46035. }
  46036. }
  46037. return fragment;
  46038. }
  46039. ( function() {
  46040. var fragment = document.createDocumentFragment(),
  46041. div = fragment.appendChild( document.createElement( "div" ) ),
  46042. input = document.createElement( "input" );
  46043. // Support: Android 4.0 - 4.3 only
  46044. // Check state lost if the name is set (#11217)
  46045. // Support: Windows Web Apps (WWA)
  46046. // `name` and `type` must use .setAttribute for WWA (#14901)
  46047. input.setAttribute( "type", "radio" );
  46048. input.setAttribute( "checked", "checked" );
  46049. input.setAttribute( "name", "t" );
  46050. div.appendChild( input );
  46051. // Support: Android <=4.1 only
  46052. // Older WebKit doesn't clone checked state correctly in fragments
  46053. support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked;
  46054. // Support: IE <=11 only
  46055. // Make sure textarea (and checkbox) defaultValue is properly cloned
  46056. div.innerHTML = "<textarea>x</textarea>";
  46057. support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue;
  46058. } )();
  46059. var documentElement = document.documentElement;
  46060. var
  46061. rkeyEvent = /^key/,
  46062. rmouseEvent = /^(?:mouse|pointer|contextmenu|drag|drop)|click/,
  46063. rtypenamespace = /^([^.]*)(?:\.(.+)|)/;
  46064. function returnTrue() {
  46065. return true;
  46066. }
  46067. function returnFalse() {
  46068. return false;
  46069. }
  46070. // Support: IE <=9 only
  46071. // See #13393 for more info
  46072. function safeActiveElement() {
  46073. try {
  46074. return document.activeElement;
  46075. } catch ( err ) { }
  46076. }
  46077. function on( elem, types, selector, data, fn, one ) {
  46078. var origFn, type;
  46079. // Types can be a map of types/handlers
  46080. if ( typeof types === "object" ) {
  46081. // ( types-Object, selector, data )
  46082. if ( typeof selector !== "string" ) {
  46083. // ( types-Object, data )
  46084. data = data || selector;
  46085. selector = undefined;
  46086. }
  46087. for ( type in types ) {
  46088. on( elem, type, selector, data, types[ type ], one );
  46089. }
  46090. return elem;
  46091. }
  46092. if ( data == null && fn == null ) {
  46093. // ( types, fn )
  46094. fn = selector;
  46095. data = selector = undefined;
  46096. } else if ( fn == null ) {
  46097. if ( typeof selector === "string" ) {
  46098. // ( types, selector, fn )
  46099. fn = data;
  46100. data = undefined;
  46101. } else {
  46102. // ( types, data, fn )
  46103. fn = data;
  46104. data = selector;
  46105. selector = undefined;
  46106. }
  46107. }
  46108. if ( fn === false ) {
  46109. fn = returnFalse;
  46110. } else if ( !fn ) {
  46111. return elem;
  46112. }
  46113. if ( one === 1 ) {
  46114. origFn = fn;
  46115. fn = function( event ) {
  46116. // Can use an empty set, since event contains the info
  46117. jQuery().off( event );
  46118. return origFn.apply( this, arguments );
  46119. };
  46120. // Use same guid so caller can remove using origFn
  46121. fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ );
  46122. }
  46123. return elem.each( function() {
  46124. jQuery.event.add( this, types, fn, data, selector );
  46125. } );
  46126. }
  46127. /*
  46128. * Helper functions for managing events -- not part of the public interface.
  46129. * Props to Dean Edwards' addEvent library for many of the ideas.
  46130. */
  46131. jQuery.event = {
  46132. global: {},
  46133. add: function( elem, types, handler, data, selector ) {
  46134. var handleObjIn, eventHandle, tmp,
  46135. events, t, handleObj,
  46136. special, handlers, type, namespaces, origType,
  46137. elemData = dataPriv.get( elem );
  46138. // Don't attach events to noData or text/comment nodes (but allow plain objects)
  46139. if ( !elemData ) {
  46140. return;
  46141. }
  46142. // Caller can pass in an object of custom data in lieu of the handler
  46143. if ( handler.handler ) {
  46144. handleObjIn = handler;
  46145. handler = handleObjIn.handler;
  46146. selector = handleObjIn.selector;
  46147. }
  46148. // Ensure that invalid selectors throw exceptions at attach time
  46149. // Evaluate against documentElement in case elem is a non-element node (e.g., document)
  46150. if ( selector ) {
  46151. jQuery.find.matchesSelector( documentElement, selector );
  46152. }
  46153. // Make sure that the handler has a unique ID, used to find/remove it later
  46154. if ( !handler.guid ) {
  46155. handler.guid = jQuery.guid++;
  46156. }
  46157. // Init the element's event structure and main handler, if this is the first
  46158. if ( !( events = elemData.events ) ) {
  46159. events = elemData.events = {};
  46160. }
  46161. if ( !( eventHandle = elemData.handle ) ) {
  46162. eventHandle = elemData.handle = function( e ) {
  46163. // Discard the second event of a jQuery.event.trigger() and
  46164. // when an event is called after a page has unloaded
  46165. return typeof jQuery !== "undefined" && jQuery.event.triggered !== e.type ?
  46166. jQuery.event.dispatch.apply( elem, arguments ) : undefined;
  46167. };
  46168. }
  46169. // Handle multiple events separated by a space
  46170. types = ( types || "" ).match( rnothtmlwhite ) || [ "" ];
  46171. t = types.length;
  46172. while ( t-- ) {
  46173. tmp = rtypenamespace.exec( types[ t ] ) || [];
  46174. type = origType = tmp[ 1 ];
  46175. namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort();
  46176. // There *must* be a type, no attaching namespace-only handlers
  46177. if ( !type ) {
  46178. continue;
  46179. }
  46180. // If event changes its type, use the special event handlers for the changed type
  46181. special = jQuery.event.special[ type ] || {};
  46182. // If selector defined, determine special event api type, otherwise given type
  46183. type = ( selector ? special.delegateType : special.bindType ) || type;
  46184. // Update special based on newly reset type
  46185. special = jQuery.event.special[ type ] || {};
  46186. // handleObj is passed to all event handlers
  46187. handleObj = jQuery.extend( {
  46188. type: type,
  46189. origType: origType,
  46190. data: data,
  46191. handler: handler,
  46192. guid: handler.guid,
  46193. selector: selector,
  46194. needsContext: selector && jQuery.expr.match.needsContext.test( selector ),
  46195. namespace: namespaces.join( "." )
  46196. }, handleObjIn );
  46197. // Init the event handler queue if we're the first
  46198. if ( !( handlers = events[ type ] ) ) {
  46199. handlers = events[ type ] = [];
  46200. handlers.delegateCount = 0;
  46201. // Only use addEventListener if the special events handler returns false
  46202. if ( !special.setup ||
  46203. special.setup.call( elem, data, namespaces, eventHandle ) === false ) {
  46204. if ( elem.addEventListener ) {
  46205. elem.addEventListener( type, eventHandle );
  46206. }
  46207. }
  46208. }
  46209. if ( special.add ) {
  46210. special.add.call( elem, handleObj );
  46211. if ( !handleObj.handler.guid ) {
  46212. handleObj.handler.guid = handler.guid;
  46213. }
  46214. }
  46215. // Add to the element's handler list, delegates in front
  46216. if ( selector ) {
  46217. handlers.splice( handlers.delegateCount++, 0, handleObj );
  46218. } else {
  46219. handlers.push( handleObj );
  46220. }
  46221. // Keep track of which events have ever been used, for event optimization
  46222. jQuery.event.global[ type ] = true;
  46223. }
  46224. },
  46225. // Detach an event or set of events from an element
  46226. remove: function( elem, types, handler, selector, mappedTypes ) {
  46227. var j, origCount, tmp,
  46228. events, t, handleObj,
  46229. special, handlers, type, namespaces, origType,
  46230. elemData = dataPriv.hasData( elem ) && dataPriv.get( elem );
  46231. if ( !elemData || !( events = elemData.events ) ) {
  46232. return;
  46233. }
  46234. // Once for each type.namespace in types; type may be omitted
  46235. types = ( types || "" ).match( rnothtmlwhite ) || [ "" ];
  46236. t = types.length;
  46237. while ( t-- ) {
  46238. tmp = rtypenamespace.exec( types[ t ] ) || [];
  46239. type = origType = tmp[ 1 ];
  46240. namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort();
  46241. // Unbind all events (on this namespace, if provided) for the element
  46242. if ( !type ) {
  46243. for ( type in events ) {
  46244. jQuery.event.remove( elem, type + types[ t ], handler, selector, true );
  46245. }
  46246. continue;
  46247. }
  46248. special = jQuery.event.special[ type ] || {};
  46249. type = ( selector ? special.delegateType : special.bindType ) || type;
  46250. handlers = events[ type ] || [];
  46251. tmp = tmp[ 2 ] &&
  46252. new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" );
  46253. // Remove matching events
  46254. origCount = j = handlers.length;
  46255. while ( j-- ) {
  46256. handleObj = handlers[ j ];
  46257. if ( ( mappedTypes || origType === handleObj.origType ) &&
  46258. ( !handler || handler.guid === handleObj.guid ) &&
  46259. ( !tmp || tmp.test( handleObj.namespace ) ) &&
  46260. ( !selector || selector === handleObj.selector ||
  46261. selector === "**" && handleObj.selector ) ) {
  46262. handlers.splice( j, 1 );
  46263. if ( handleObj.selector ) {
  46264. handlers.delegateCount--;
  46265. }
  46266. if ( special.remove ) {
  46267. special.remove.call( elem, handleObj );
  46268. }
  46269. }
  46270. }
  46271. // Remove generic event handler if we removed something and no more handlers exist
  46272. // (avoids potential for endless recursion during removal of special event handlers)
  46273. if ( origCount && !handlers.length ) {
  46274. if ( !special.teardown ||
  46275. special.teardown.call( elem, namespaces, elemData.handle ) === false ) {
  46276. jQuery.removeEvent( elem, type, elemData.handle );
  46277. }
  46278. delete events[ type ];
  46279. }
  46280. }
  46281. // Remove data and the expando if it's no longer used
  46282. if ( jQuery.isEmptyObject( events ) ) {
  46283. dataPriv.remove( elem, "handle events" );
  46284. }
  46285. },
  46286. dispatch: function( nativeEvent ) {
  46287. // Make a writable jQuery.Event from the native event object
  46288. var event = jQuery.event.fix( nativeEvent );
  46289. var i, j, ret, matched, handleObj, handlerQueue,
  46290. args = new Array( arguments.length ),
  46291. handlers = ( dataPriv.get( this, "events" ) || {} )[ event.type ] || [],
  46292. special = jQuery.event.special[ event.type ] || {};
  46293. // Use the fix-ed jQuery.Event rather than the (read-only) native event
  46294. args[ 0 ] = event;
  46295. for ( i = 1; i < arguments.length; i++ ) {
  46296. args[ i ] = arguments[ i ];
  46297. }
  46298. event.delegateTarget = this;
  46299. // Call the preDispatch hook for the mapped type, and let it bail if desired
  46300. if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) {
  46301. return;
  46302. }
  46303. // Determine handlers
  46304. handlerQueue = jQuery.event.handlers.call( this, event, handlers );
  46305. // Run delegates first; they may want to stop propagation beneath us
  46306. i = 0;
  46307. while ( ( matched = handlerQueue[ i++ ] ) && !event.isPropagationStopped() ) {
  46308. event.currentTarget = matched.elem;
  46309. j = 0;
  46310. while ( ( handleObj = matched.handlers[ j++ ] ) &&
  46311. !event.isImmediatePropagationStopped() ) {
  46312. // Triggered event must either 1) have no namespace, or 2) have namespace(s)
  46313. // a subset or equal to those in the bound event (both can have no namespace).
  46314. if ( !event.rnamespace || event.rnamespace.test( handleObj.namespace ) ) {
  46315. event.handleObj = handleObj;
  46316. event.data = handleObj.data;
  46317. ret = ( ( jQuery.event.special[ handleObj.origType ] || {} ).handle ||
  46318. handleObj.handler ).apply( matched.elem, args );
  46319. if ( ret !== undefined ) {
  46320. if ( ( event.result = ret ) === false ) {
  46321. event.preventDefault();
  46322. event.stopPropagation();
  46323. }
  46324. }
  46325. }
  46326. }
  46327. }
  46328. // Call the postDispatch hook for the mapped type
  46329. if ( special.postDispatch ) {
  46330. special.postDispatch.call( this, event );
  46331. }
  46332. return event.result;
  46333. },
  46334. handlers: function( event, handlers ) {
  46335. var i, handleObj, sel, matchedHandlers, matchedSelectors,
  46336. handlerQueue = [],
  46337. delegateCount = handlers.delegateCount,
  46338. cur = event.target;
  46339. // Find delegate handlers
  46340. if ( delegateCount &&
  46341. // Support: IE <=9
  46342. // Black-hole SVG <use> instance trees (trac-13180)
  46343. cur.nodeType &&
  46344. // Support: Firefox <=42
  46345. // Suppress spec-violating clicks indicating a non-primary pointer button (trac-3861)
  46346. // https://www.w3.org/TR/DOM-Level-3-Events/#event-type-click
  46347. // Support: IE 11 only
  46348. // ...but not arrow key "clicks" of radio inputs, which can have `button` -1 (gh-2343)
  46349. !( event.type === "click" && event.button >= 1 ) ) {
  46350. for ( ; cur !== this; cur = cur.parentNode || this ) {
  46351. // Don't check non-elements (#13208)
  46352. // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764)
  46353. if ( cur.nodeType === 1 && !( event.type === "click" && cur.disabled === true ) ) {
  46354. matchedHandlers = [];
  46355. matchedSelectors = {};
  46356. for ( i = 0; i < delegateCount; i++ ) {
  46357. handleObj = handlers[ i ];
  46358. // Don't conflict with Object.prototype properties (#13203)
  46359. sel = handleObj.selector + " ";
  46360. if ( matchedSelectors[ sel ] === undefined ) {
  46361. matchedSelectors[ sel ] = handleObj.needsContext ?
  46362. jQuery( sel, this ).index( cur ) > -1 :
  46363. jQuery.find( sel, this, null, [ cur ] ).length;
  46364. }
  46365. if ( matchedSelectors[ sel ] ) {
  46366. matchedHandlers.push( handleObj );
  46367. }
  46368. }
  46369. if ( matchedHandlers.length ) {
  46370. handlerQueue.push( { elem: cur, handlers: matchedHandlers } );
  46371. }
  46372. }
  46373. }
  46374. }
  46375. // Add the remaining (directly-bound) handlers
  46376. cur = this;
  46377. if ( delegateCount < handlers.length ) {
  46378. handlerQueue.push( { elem: cur, handlers: handlers.slice( delegateCount ) } );
  46379. }
  46380. return handlerQueue;
  46381. },
  46382. addProp: function( name, hook ) {
  46383. Object.defineProperty( jQuery.Event.prototype, name, {
  46384. enumerable: true,
  46385. configurable: true,
  46386. get: isFunction( hook ) ?
  46387. function() {
  46388. if ( this.originalEvent ) {
  46389. return hook( this.originalEvent );
  46390. }
  46391. } :
  46392. function() {
  46393. if ( this.originalEvent ) {
  46394. return this.originalEvent[ name ];
  46395. }
  46396. },
  46397. set: function( value ) {
  46398. Object.defineProperty( this, name, {
  46399. enumerable: true,
  46400. configurable: true,
  46401. writable: true,
  46402. value: value
  46403. } );
  46404. }
  46405. } );
  46406. },
  46407. fix: function( originalEvent ) {
  46408. return originalEvent[ jQuery.expando ] ?
  46409. originalEvent :
  46410. new jQuery.Event( originalEvent );
  46411. },
  46412. special: {
  46413. load: {
  46414. // Prevent triggered image.load events from bubbling to window.load
  46415. noBubble: true
  46416. },
  46417. focus: {
  46418. // Fire native event if possible so blur/focus sequence is correct
  46419. trigger: function() {
  46420. if ( this !== safeActiveElement() && this.focus ) {
  46421. this.focus();
  46422. return false;
  46423. }
  46424. },
  46425. delegateType: "focusin"
  46426. },
  46427. blur: {
  46428. trigger: function() {
  46429. if ( this === safeActiveElement() && this.blur ) {
  46430. this.blur();
  46431. return false;
  46432. }
  46433. },
  46434. delegateType: "focusout"
  46435. },
  46436. click: {
  46437. // For checkbox, fire native event so checked state will be right
  46438. trigger: function() {
  46439. if ( this.type === "checkbox" && this.click && nodeName( this, "input" ) ) {
  46440. this.click();
  46441. return false;
  46442. }
  46443. },
  46444. // For cross-browser consistency, don't fire native .click() on links
  46445. _default: function( event ) {
  46446. return nodeName( event.target, "a" );
  46447. }
  46448. },
  46449. beforeunload: {
  46450. postDispatch: function( event ) {
  46451. // Support: Firefox 20+
  46452. // Firefox doesn't alert if the returnValue field is not set.
  46453. if ( event.result !== undefined && event.originalEvent ) {
  46454. event.originalEvent.returnValue = event.result;
  46455. }
  46456. }
  46457. }
  46458. }
  46459. };
  46460. jQuery.removeEvent = function( elem, type, handle ) {
  46461. // This "if" is needed for plain objects
  46462. if ( elem.removeEventListener ) {
  46463. elem.removeEventListener( type, handle );
  46464. }
  46465. };
  46466. jQuery.Event = function( src, props ) {
  46467. // Allow instantiation without the 'new' keyword
  46468. if ( !( this instanceof jQuery.Event ) ) {
  46469. return new jQuery.Event( src, props );
  46470. }
  46471. // Event object
  46472. if ( src && src.type ) {
  46473. this.originalEvent = src;
  46474. this.type = src.type;
  46475. // Events bubbling up the document may have been marked as prevented
  46476. // by a handler lower down the tree; reflect the correct value.
  46477. this.isDefaultPrevented = src.defaultPrevented ||
  46478. src.defaultPrevented === undefined &&
  46479. // Support: Android <=2.3 only
  46480. src.returnValue === false ?
  46481. returnTrue :
  46482. returnFalse;
  46483. // Create target properties
  46484. // Support: Safari <=6 - 7 only
  46485. // Target should not be a text node (#504, #13143)
  46486. this.target = ( src.target && src.target.nodeType === 3 ) ?
  46487. src.target.parentNode :
  46488. src.target;
  46489. this.currentTarget = src.currentTarget;
  46490. this.relatedTarget = src.relatedTarget;
  46491. // Event type
  46492. } else {
  46493. this.type = src;
  46494. }
  46495. // Put explicitly provided properties onto the event object
  46496. if ( props ) {
  46497. jQuery.extend( this, props );
  46498. }
  46499. // Create a timestamp if incoming event doesn't have one
  46500. this.timeStamp = src && src.timeStamp || Date.now();
  46501. // Mark it as fixed
  46502. this[ jQuery.expando ] = true;
  46503. };
  46504. // jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
  46505. // https://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
  46506. jQuery.Event.prototype = {
  46507. constructor: jQuery.Event,
  46508. isDefaultPrevented: returnFalse,
  46509. isPropagationStopped: returnFalse,
  46510. isImmediatePropagationStopped: returnFalse,
  46511. isSimulated: false,
  46512. preventDefault: function() {
  46513. var e = this.originalEvent;
  46514. this.isDefaultPrevented = returnTrue;
  46515. if ( e && !this.isSimulated ) {
  46516. e.preventDefault();
  46517. }
  46518. },
  46519. stopPropagation: function() {
  46520. var e = this.originalEvent;
  46521. this.isPropagationStopped = returnTrue;
  46522. if ( e && !this.isSimulated ) {
  46523. e.stopPropagation();
  46524. }
  46525. },
  46526. stopImmediatePropagation: function() {
  46527. var e = this.originalEvent;
  46528. this.isImmediatePropagationStopped = returnTrue;
  46529. if ( e && !this.isSimulated ) {
  46530. e.stopImmediatePropagation();
  46531. }
  46532. this.stopPropagation();
  46533. }
  46534. };
  46535. // Includes all common event props including KeyEvent and MouseEvent specific props
  46536. jQuery.each( {
  46537. altKey: true,
  46538. bubbles: true,
  46539. cancelable: true,
  46540. changedTouches: true,
  46541. ctrlKey: true,
  46542. detail: true,
  46543. eventPhase: true,
  46544. metaKey: true,
  46545. pageX: true,
  46546. pageY: true,
  46547. shiftKey: true,
  46548. view: true,
  46549. "char": true,
  46550. charCode: true,
  46551. key: true,
  46552. keyCode: true,
  46553. button: true,
  46554. buttons: true,
  46555. clientX: true,
  46556. clientY: true,
  46557. offsetX: true,
  46558. offsetY: true,
  46559. pointerId: true,
  46560. pointerType: true,
  46561. screenX: true,
  46562. screenY: true,
  46563. targetTouches: true,
  46564. toElement: true,
  46565. touches: true,
  46566. which: function( event ) {
  46567. var button = event.button;
  46568. // Add which for key events
  46569. if ( event.which == null && rkeyEvent.test( event.type ) ) {
  46570. return event.charCode != null ? event.charCode : event.keyCode;
  46571. }
  46572. // Add which for click: 1 === left; 2 === middle; 3 === right
  46573. if ( !event.which && button !== undefined && rmouseEvent.test( event.type ) ) {
  46574. if ( button & 1 ) {
  46575. return 1;
  46576. }
  46577. if ( button & 2 ) {
  46578. return 3;
  46579. }
  46580. if ( button & 4 ) {
  46581. return 2;
  46582. }
  46583. return 0;
  46584. }
  46585. return event.which;
  46586. }
  46587. }, jQuery.event.addProp );
  46588. // Create mouseenter/leave events using mouseover/out and event-time checks
  46589. // so that event delegation works in jQuery.
  46590. // Do the same for pointerenter/pointerleave and pointerover/pointerout
  46591. //
  46592. // Support: Safari 7 only
  46593. // Safari sends mouseenter too often; see:
  46594. // https://bugs.chromium.org/p/chromium/issues/detail?id=470258
  46595. // for the description of the bug (it existed in older Chrome versions as well).
  46596. jQuery.each( {
  46597. mouseenter: "mouseover",
  46598. mouseleave: "mouseout",
  46599. pointerenter: "pointerover",
  46600. pointerleave: "pointerout"
  46601. }, function( orig, fix ) {
  46602. jQuery.event.special[ orig ] = {
  46603. delegateType: fix,
  46604. bindType: fix,
  46605. handle: function( event ) {
  46606. var ret,
  46607. target = this,
  46608. related = event.relatedTarget,
  46609. handleObj = event.handleObj;
  46610. // For mouseenter/leave call the handler if related is outside the target.
  46611. // NB: No relatedTarget if the mouse left/entered the browser window
  46612. if ( !related || ( related !== target && !jQuery.contains( target, related ) ) ) {
  46613. event.type = handleObj.origType;
  46614. ret = handleObj.handler.apply( this, arguments );
  46615. event.type = fix;
  46616. }
  46617. return ret;
  46618. }
  46619. };
  46620. } );
  46621. jQuery.fn.extend( {
  46622. on: function( types, selector, data, fn ) {
  46623. return on( this, types, selector, data, fn );
  46624. },
  46625. one: function( types, selector, data, fn ) {
  46626. return on( this, types, selector, data, fn, 1 );
  46627. },
  46628. off: function( types, selector, fn ) {
  46629. var handleObj, type;
  46630. if ( types && types.preventDefault && types.handleObj ) {
  46631. // ( event ) dispatched jQuery.Event
  46632. handleObj = types.handleObj;
  46633. jQuery( types.delegateTarget ).off(
  46634. handleObj.namespace ?
  46635. handleObj.origType + "." + handleObj.namespace :
  46636. handleObj.origType,
  46637. handleObj.selector,
  46638. handleObj.handler
  46639. );
  46640. return this;
  46641. }
  46642. if ( typeof types === "object" ) {
  46643. // ( types-object [, selector] )
  46644. for ( type in types ) {
  46645. this.off( type, selector, types[ type ] );
  46646. }
  46647. return this;
  46648. }
  46649. if ( selector === false || typeof selector === "function" ) {
  46650. // ( types [, fn] )
  46651. fn = selector;
  46652. selector = undefined;
  46653. }
  46654. if ( fn === false ) {
  46655. fn = returnFalse;
  46656. }
  46657. return this.each( function() {
  46658. jQuery.event.remove( this, types, fn, selector );
  46659. } );
  46660. }
  46661. } );
  46662. var
  46663. /* eslint-disable max-len */
  46664. // See https://github.com/eslint/eslint/issues/3229
  46665. rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([a-z][^\/\0>\x20\t\r\n\f]*)[^>]*)\/>/gi,
  46666. /* eslint-enable */
  46667. // Support: IE <=10 - 11, Edge 12 - 13 only
  46668. // In IE/Edge using regex groups here causes severe slowdowns.
  46669. // See https://connect.microsoft.com/IE/feedback/details/1736512/
  46670. rnoInnerhtml = /<script|<style|<link/i,
  46671. // checked="checked" or checked
  46672. rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
  46673. rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g;
  46674. // Prefer a tbody over its parent table for containing new rows
  46675. function manipulationTarget( elem, content ) {
  46676. if ( nodeName( elem, "table" ) &&
  46677. nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ) {
  46678. return jQuery( elem ).children( "tbody" )[ 0 ] || elem;
  46679. }
  46680. return elem;
  46681. }
  46682. // Replace/restore the type attribute of script elements for safe DOM manipulation
  46683. function disableScript( elem ) {
  46684. elem.type = ( elem.getAttribute( "type" ) !== null ) + "/" + elem.type;
  46685. return elem;
  46686. }
  46687. function restoreScript( elem ) {
  46688. if ( ( elem.type || "" ).slice( 0, 5 ) === "true/" ) {
  46689. elem.type = elem.type.slice( 5 );
  46690. } else {
  46691. elem.removeAttribute( "type" );
  46692. }
  46693. return elem;
  46694. }
  46695. function cloneCopyEvent( src, dest ) {
  46696. var i, l, type, pdataOld, pdataCur, udataOld, udataCur, events;
  46697. if ( dest.nodeType !== 1 ) {
  46698. return;
  46699. }
  46700. // 1. Copy private data: events, handlers, etc.
  46701. if ( dataPriv.hasData( src ) ) {
  46702. pdataOld = dataPriv.access( src );
  46703. pdataCur = dataPriv.set( dest, pdataOld );
  46704. events = pdataOld.events;
  46705. if ( events ) {
  46706. delete pdataCur.handle;
  46707. pdataCur.events = {};
  46708. for ( type in events ) {
  46709. for ( i = 0, l = events[ type ].length; i < l; i++ ) {
  46710. jQuery.event.add( dest, type, events[ type ][ i ] );
  46711. }
  46712. }
  46713. }
  46714. }
  46715. // 2. Copy user data
  46716. if ( dataUser.hasData( src ) ) {
  46717. udataOld = dataUser.access( src );
  46718. udataCur = jQuery.extend( {}, udataOld );
  46719. dataUser.set( dest, udataCur );
  46720. }
  46721. }
  46722. // Fix IE bugs, see support tests
  46723. function fixInput( src, dest ) {
  46724. var nodeName = dest.nodeName.toLowerCase();
  46725. // Fails to persist the checked state of a cloned checkbox or radio button.
  46726. if ( nodeName === "input" && rcheckableType.test( src.type ) ) {
  46727. dest.checked = src.checked;
  46728. // Fails to return the selected option to the default selected state when cloning options
  46729. } else if ( nodeName === "input" || nodeName === "textarea" ) {
  46730. dest.defaultValue = src.defaultValue;
  46731. }
  46732. }
  46733. function domManip( collection, args, callback, ignored ) {
  46734. // Flatten any nested arrays
  46735. args = concat.apply( [], args );
  46736. var fragment, first, scripts, hasScripts, node, doc,
  46737. i = 0,
  46738. l = collection.length,
  46739. iNoClone = l - 1,
  46740. value = args[ 0 ],
  46741. valueIsFunction = isFunction( value );
  46742. // We can't cloneNode fragments that contain checked, in WebKit
  46743. if ( valueIsFunction ||
  46744. ( l > 1 && typeof value === "string" &&
  46745. !support.checkClone && rchecked.test( value ) ) ) {
  46746. return collection.each( function( index ) {
  46747. var self = collection.eq( index );
  46748. if ( valueIsFunction ) {
  46749. args[ 0 ] = value.call( this, index, self.html() );
  46750. }
  46751. domManip( self, args, callback, ignored );
  46752. } );
  46753. }
  46754. if ( l ) {
  46755. fragment = buildFragment( args, collection[ 0 ].ownerDocument, false, collection, ignored );
  46756. first = fragment.firstChild;
  46757. if ( fragment.childNodes.length === 1 ) {
  46758. fragment = first;
  46759. }
  46760. // Require either new content or an interest in ignored elements to invoke the callback
  46761. if ( first || ignored ) {
  46762. scripts = jQuery.map( getAll( fragment, "script" ), disableScript );
  46763. hasScripts = scripts.length;
  46764. // Use the original fragment for the last item
  46765. // instead of the first because it can end up
  46766. // being emptied incorrectly in certain situations (#8070).
  46767. for ( ; i < l; i++ ) {
  46768. node = fragment;
  46769. if ( i !== iNoClone ) {
  46770. node = jQuery.clone( node, true, true );
  46771. // Keep references to cloned scripts for later restoration
  46772. if ( hasScripts ) {
  46773. // Support: Android <=4.0 only, PhantomJS 1 only
  46774. // push.apply(_, arraylike) throws on ancient WebKit
  46775. jQuery.merge( scripts, getAll( node, "script" ) );
  46776. }
  46777. }
  46778. callback.call( collection[ i ], node, i );
  46779. }
  46780. if ( hasScripts ) {
  46781. doc = scripts[ scripts.length - 1 ].ownerDocument;
  46782. // Reenable scripts
  46783. jQuery.map( scripts, restoreScript );
  46784. // Evaluate executable scripts on first document insertion
  46785. for ( i = 0; i < hasScripts; i++ ) {
  46786. node = scripts[ i ];
  46787. if ( rscriptType.test( node.type || "" ) &&
  46788. !dataPriv.access( node, "globalEval" ) &&
  46789. jQuery.contains( doc, node ) ) {
  46790. if ( node.src && ( node.type || "" ).toLowerCase() !== "module" ) {
  46791. // Optional AJAX dependency, but won't run scripts if not present
  46792. if ( jQuery._evalUrl ) {
  46793. jQuery._evalUrl( node.src );
  46794. }
  46795. } else {
  46796. DOMEval( node.textContent.replace( rcleanScript, "" ), doc, node );
  46797. }
  46798. }
  46799. }
  46800. }
  46801. }
  46802. }
  46803. return collection;
  46804. }
  46805. function remove( elem, selector, keepData ) {
  46806. var node,
  46807. nodes = selector ? jQuery.filter( selector, elem ) : elem,
  46808. i = 0;
  46809. for ( ; ( node = nodes[ i ] ) != null; i++ ) {
  46810. if ( !keepData && node.nodeType === 1 ) {
  46811. jQuery.cleanData( getAll( node ) );
  46812. }
  46813. if ( node.parentNode ) {
  46814. if ( keepData && jQuery.contains( node.ownerDocument, node ) ) {
  46815. setGlobalEval( getAll( node, "script" ) );
  46816. }
  46817. node.parentNode.removeChild( node );
  46818. }
  46819. }
  46820. return elem;
  46821. }
  46822. jQuery.extend( {
  46823. htmlPrefilter: function( html ) {
  46824. return html.replace( rxhtmlTag, "<$1></$2>" );
  46825. },
  46826. clone: function( elem, dataAndEvents, deepDataAndEvents ) {
  46827. var i, l, srcElements, destElements,
  46828. clone = elem.cloneNode( true ),
  46829. inPage = jQuery.contains( elem.ownerDocument, elem );
  46830. // Fix IE cloning issues
  46831. if ( !support.noCloneChecked && ( elem.nodeType === 1 || elem.nodeType === 11 ) &&
  46832. !jQuery.isXMLDoc( elem ) ) {
  46833. // We eschew Sizzle here for performance reasons: https://jsperf.com/getall-vs-sizzle/2
  46834. destElements = getAll( clone );
  46835. srcElements = getAll( elem );
  46836. for ( i = 0, l = srcElements.length; i < l; i++ ) {
  46837. fixInput( srcElements[ i ], destElements[ i ] );
  46838. }
  46839. }
  46840. // Copy the events from the original to the clone
  46841. if ( dataAndEvents ) {
  46842. if ( deepDataAndEvents ) {
  46843. srcElements = srcElements || getAll( elem );
  46844. destElements = destElements || getAll( clone );
  46845. for ( i = 0, l = srcElements.length; i < l; i++ ) {
  46846. cloneCopyEvent( srcElements[ i ], destElements[ i ] );
  46847. }
  46848. } else {
  46849. cloneCopyEvent( elem, clone );
  46850. }
  46851. }
  46852. // Preserve script evaluation history
  46853. destElements = getAll( clone, "script" );
  46854. if ( destElements.length > 0 ) {
  46855. setGlobalEval( destElements, !inPage && getAll( elem, "script" ) );
  46856. }
  46857. // Return the cloned set
  46858. return clone;
  46859. },
  46860. cleanData: function( elems ) {
  46861. var data, elem, type,
  46862. special = jQuery.event.special,
  46863. i = 0;
  46864. for ( ; ( elem = elems[ i ] ) !== undefined; i++ ) {
  46865. if ( acceptData( elem ) ) {
  46866. if ( ( data = elem[ dataPriv.expando ] ) ) {
  46867. if ( data.events ) {
  46868. for ( type in data.events ) {
  46869. if ( special[ type ] ) {
  46870. jQuery.event.remove( elem, type );
  46871. // This is a shortcut to avoid jQuery.event.remove's overhead
  46872. } else {
  46873. jQuery.removeEvent( elem, type, data.handle );
  46874. }
  46875. }
  46876. }
  46877. // Support: Chrome <=35 - 45+
  46878. // Assign undefined instead of using delete, see Data#remove
  46879. elem[ dataPriv.expando ] = undefined;
  46880. }
  46881. if ( elem[ dataUser.expando ] ) {
  46882. // Support: Chrome <=35 - 45+
  46883. // Assign undefined instead of using delete, see Data#remove
  46884. elem[ dataUser.expando ] = undefined;
  46885. }
  46886. }
  46887. }
  46888. }
  46889. } );
  46890. jQuery.fn.extend( {
  46891. detach: function( selector ) {
  46892. return remove( this, selector, true );
  46893. },
  46894. remove: function( selector ) {
  46895. return remove( this, selector );
  46896. },
  46897. text: function( value ) {
  46898. return access( this, function( value ) {
  46899. return value === undefined ?
  46900. jQuery.text( this ) :
  46901. this.empty().each( function() {
  46902. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  46903. this.textContent = value;
  46904. }
  46905. } );
  46906. }, null, value, arguments.length );
  46907. },
  46908. append: function() {
  46909. return domManip( this, arguments, function( elem ) {
  46910. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  46911. var target = manipulationTarget( this, elem );
  46912. target.appendChild( elem );
  46913. }
  46914. } );
  46915. },
  46916. prepend: function() {
  46917. return domManip( this, arguments, function( elem ) {
  46918. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  46919. var target = manipulationTarget( this, elem );
  46920. target.insertBefore( elem, target.firstChild );
  46921. }
  46922. } );
  46923. },
  46924. before: function() {
  46925. return domManip( this, arguments, function( elem ) {
  46926. if ( this.parentNode ) {
  46927. this.parentNode.insertBefore( elem, this );
  46928. }
  46929. } );
  46930. },
  46931. after: function() {
  46932. return domManip( this, arguments, function( elem ) {
  46933. if ( this.parentNode ) {
  46934. this.parentNode.insertBefore( elem, this.nextSibling );
  46935. }
  46936. } );
  46937. },
  46938. empty: function() {
  46939. var elem,
  46940. i = 0;
  46941. for ( ; ( elem = this[ i ] ) != null; i++ ) {
  46942. if ( elem.nodeType === 1 ) {
  46943. // Prevent memory leaks
  46944. jQuery.cleanData( getAll( elem, false ) );
  46945. // Remove any remaining nodes
  46946. elem.textContent = "";
  46947. }
  46948. }
  46949. return this;
  46950. },
  46951. clone: function( dataAndEvents, deepDataAndEvents ) {
  46952. dataAndEvents = dataAndEvents == null ? false : dataAndEvents;
  46953. deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;
  46954. return this.map( function() {
  46955. return jQuery.clone( this, dataAndEvents, deepDataAndEvents );
  46956. } );
  46957. },
  46958. html: function( value ) {
  46959. return access( this, function( value ) {
  46960. var elem = this[ 0 ] || {},
  46961. i = 0,
  46962. l = this.length;
  46963. if ( value === undefined && elem.nodeType === 1 ) {
  46964. return elem.innerHTML;
  46965. }
  46966. // See if we can take a shortcut and just use innerHTML
  46967. if ( typeof value === "string" && !rnoInnerhtml.test( value ) &&
  46968. !wrapMap[ ( rtagName.exec( value ) || [ "", "" ] )[ 1 ].toLowerCase() ] ) {
  46969. value = jQuery.htmlPrefilter( value );
  46970. try {
  46971. for ( ; i < l; i++ ) {
  46972. elem = this[ i ] || {};
  46973. // Remove element nodes and prevent memory leaks
  46974. if ( elem.nodeType === 1 ) {
  46975. jQuery.cleanData( getAll( elem, false ) );
  46976. elem.innerHTML = value;
  46977. }
  46978. }
  46979. elem = 0;
  46980. // If using innerHTML throws an exception, use the fallback method
  46981. } catch ( e ) {}
  46982. }
  46983. if ( elem ) {
  46984. this.empty().append( value );
  46985. }
  46986. }, null, value, arguments.length );
  46987. },
  46988. replaceWith: function() {
  46989. var ignored = [];
  46990. // Make the changes, replacing each non-ignored context element with the new content
  46991. return domManip( this, arguments, function( elem ) {
  46992. var parent = this.parentNode;
  46993. if ( jQuery.inArray( this, ignored ) < 0 ) {
  46994. jQuery.cleanData( getAll( this ) );
  46995. if ( parent ) {
  46996. parent.replaceChild( elem, this );
  46997. }
  46998. }
  46999. // Force callback invocation
  47000. }, ignored );
  47001. }
  47002. } );
  47003. jQuery.each( {
  47004. appendTo: "append",
  47005. prependTo: "prepend",
  47006. insertBefore: "before",
  47007. insertAfter: "after",
  47008. replaceAll: "replaceWith"
  47009. }, function( name, original ) {
  47010. jQuery.fn[ name ] = function( selector ) {
  47011. var elems,
  47012. ret = [],
  47013. insert = jQuery( selector ),
  47014. last = insert.length - 1,
  47015. i = 0;
  47016. for ( ; i <= last; i++ ) {
  47017. elems = i === last ? this : this.clone( true );
  47018. jQuery( insert[ i ] )[ original ]( elems );
  47019. // Support: Android <=4.0 only, PhantomJS 1 only
  47020. // .get() because push.apply(_, arraylike) throws on ancient WebKit
  47021. push.apply( ret, elems.get() );
  47022. }
  47023. return this.pushStack( ret );
  47024. };
  47025. } );
  47026. var rnumnonpx = new RegExp( "^(" + pnum + ")(?!px)[a-z%]+$", "i" );
  47027. var getStyles = function( elem ) {
  47028. // Support: IE <=11 only, Firefox <=30 (#15098, #14150)
  47029. // IE throws on elements created in popups
  47030. // FF meanwhile throws on frame elements through "defaultView.getComputedStyle"
  47031. var view = elem.ownerDocument.defaultView;
  47032. if ( !view || !view.opener ) {
  47033. view = window;
  47034. }
  47035. return view.getComputedStyle( elem );
  47036. };
  47037. var rboxStyle = new RegExp( cssExpand.join( "|" ), "i" );
  47038. ( function() {
  47039. // Executing both pixelPosition & boxSizingReliable tests require only one layout
  47040. // so they're executed at the same time to save the second computation.
  47041. function computeStyleTests() {
  47042. // This is a singleton, we need to execute it only once
  47043. if ( !div ) {
  47044. return;
  47045. }
  47046. container.style.cssText = "position:absolute;left:-11111px;width:60px;" +
  47047. "margin-top:1px;padding:0;border:0";
  47048. div.style.cssText =
  47049. "position:relative;display:block;box-sizing:border-box;overflow:scroll;" +
  47050. "margin:auto;border:1px;padding:1px;" +
  47051. "width:60%;top:1%";
  47052. documentElement.appendChild( container ).appendChild( div );
  47053. var divStyle = window.getComputedStyle( div );
  47054. pixelPositionVal = divStyle.top !== "1%";
  47055. // Support: Android 4.0 - 4.3 only, Firefox <=3 - 44
  47056. reliableMarginLeftVal = roundPixelMeasures( divStyle.marginLeft ) === 12;
  47057. // Support: Android 4.0 - 4.3 only, Safari <=9.1 - 10.1, iOS <=7.0 - 9.3
  47058. // Some styles come back with percentage values, even though they shouldn't
  47059. div.style.right = "60%";
  47060. pixelBoxStylesVal = roundPixelMeasures( divStyle.right ) === 36;
  47061. // Support: IE 9 - 11 only
  47062. // Detect misreporting of content dimensions for box-sizing:border-box elements
  47063. boxSizingReliableVal = roundPixelMeasures( divStyle.width ) === 36;
  47064. // Support: IE 9 only
  47065. // Detect overflow:scroll screwiness (gh-3699)
  47066. div.style.position = "absolute";
  47067. scrollboxSizeVal = div.offsetWidth === 36 || "absolute";
  47068. documentElement.removeChild( container );
  47069. // Nullify the div so it wouldn't be stored in the memory and
  47070. // it will also be a sign that checks already performed
  47071. div = null;
  47072. }
  47073. function roundPixelMeasures( measure ) {
  47074. return Math.round( parseFloat( measure ) );
  47075. }
  47076. var pixelPositionVal, boxSizingReliableVal, scrollboxSizeVal, pixelBoxStylesVal,
  47077. reliableMarginLeftVal,
  47078. container = document.createElement( "div" ),
  47079. div = document.createElement( "div" );
  47080. // Finish early in limited (non-browser) environments
  47081. if ( !div.style ) {
  47082. return;
  47083. }
  47084. // Support: IE <=9 - 11 only
  47085. // Style of cloned element affects source element cloned (#8908)
  47086. div.style.backgroundClip = "content-box";
  47087. div.cloneNode( true ).style.backgroundClip = "";
  47088. support.clearCloneStyle = div.style.backgroundClip === "content-box";
  47089. jQuery.extend( support, {
  47090. boxSizingReliable: function() {
  47091. computeStyleTests();
  47092. return boxSizingReliableVal;
  47093. },
  47094. pixelBoxStyles: function() {
  47095. computeStyleTests();
  47096. return pixelBoxStylesVal;
  47097. },
  47098. pixelPosition: function() {
  47099. computeStyleTests();
  47100. return pixelPositionVal;
  47101. },
  47102. reliableMarginLeft: function() {
  47103. computeStyleTests();
  47104. return reliableMarginLeftVal;
  47105. },
  47106. scrollboxSize: function() {
  47107. computeStyleTests();
  47108. return scrollboxSizeVal;
  47109. }
  47110. } );
  47111. } )();
  47112. function curCSS( elem, name, computed ) {
  47113. var width, minWidth, maxWidth, ret,
  47114. // Support: Firefox 51+
  47115. // Retrieving style before computed somehow
  47116. // fixes an issue with getting wrong values
  47117. // on detached elements
  47118. style = elem.style;
  47119. computed = computed || getStyles( elem );
  47120. // getPropertyValue is needed for:
  47121. // .css('filter') (IE 9 only, #12537)
  47122. // .css('--customProperty) (#3144)
  47123. if ( computed ) {
  47124. ret = computed.getPropertyValue( name ) || computed[ name ];
  47125. if ( ret === "" && !jQuery.contains( elem.ownerDocument, elem ) ) {
  47126. ret = jQuery.style( elem, name );
  47127. }
  47128. // A tribute to the "awesome hack by Dean Edwards"
  47129. // Android Browser returns percentage for some values,
  47130. // but width seems to be reliably pixels.
  47131. // This is against the CSSOM draft spec:
  47132. // https://drafts.csswg.org/cssom/#resolved-values
  47133. if ( !support.pixelBoxStyles() && rnumnonpx.test( ret ) && rboxStyle.test( name ) ) {
  47134. // Remember the original values
  47135. width = style.width;
  47136. minWidth = style.minWidth;
  47137. maxWidth = style.maxWidth;
  47138. // Put in the new values to get a computed value out
  47139. style.minWidth = style.maxWidth = style.width = ret;
  47140. ret = computed.width;
  47141. // Revert the changed values
  47142. style.width = width;
  47143. style.minWidth = minWidth;
  47144. style.maxWidth = maxWidth;
  47145. }
  47146. }
  47147. return ret !== undefined ?
  47148. // Support: IE <=9 - 11 only
  47149. // IE returns zIndex value as an integer.
  47150. ret + "" :
  47151. ret;
  47152. }
  47153. function addGetHookIf( conditionFn, hookFn ) {
  47154. // Define the hook, we'll check on the first run if it's really needed.
  47155. return {
  47156. get: function() {
  47157. if ( conditionFn() ) {
  47158. // Hook not needed (or it's not possible to use it due
  47159. // to missing dependency), remove it.
  47160. delete this.get;
  47161. return;
  47162. }
  47163. // Hook needed; redefine it so that the support test is not executed again.
  47164. return ( this.get = hookFn ).apply( this, arguments );
  47165. }
  47166. };
  47167. }
  47168. var
  47169. // Swappable if display is none or starts with table
  47170. // except "table", "table-cell", or "table-caption"
  47171. // See here for display values: https://developer.mozilla.org/en-US/docs/CSS/display
  47172. rdisplayswap = /^(none|table(?!-c[ea]).+)/,
  47173. rcustomProp = /^--/,
  47174. cssShow = { position: "absolute", visibility: "hidden", display: "block" },
  47175. cssNormalTransform = {
  47176. letterSpacing: "0",
  47177. fontWeight: "400"
  47178. },
  47179. cssPrefixes = [ "Webkit", "Moz", "ms" ],
  47180. emptyStyle = document.createElement( "div" ).style;
  47181. // Return a css property mapped to a potentially vendor prefixed property
  47182. function vendorPropName( name ) {
  47183. // Shortcut for names that are not vendor prefixed
  47184. if ( name in emptyStyle ) {
  47185. return name;
  47186. }
  47187. // Check for vendor prefixed names
  47188. var capName = name[ 0 ].toUpperCase() + name.slice( 1 ),
  47189. i = cssPrefixes.length;
  47190. while ( i-- ) {
  47191. name = cssPrefixes[ i ] + capName;
  47192. if ( name in emptyStyle ) {
  47193. return name;
  47194. }
  47195. }
  47196. }
  47197. // Return a property mapped along what jQuery.cssProps suggests or to
  47198. // a vendor prefixed property.
  47199. function finalPropName( name ) {
  47200. var ret = jQuery.cssProps[ name ];
  47201. if ( !ret ) {
  47202. ret = jQuery.cssProps[ name ] = vendorPropName( name ) || name;
  47203. }
  47204. return ret;
  47205. }
  47206. function setPositiveNumber( elem, value, subtract ) {
  47207. // Any relative (+/-) values have already been
  47208. // normalized at this point
  47209. var matches = rcssNum.exec( value );
  47210. return matches ?
  47211. // Guard against undefined "subtract", e.g., when used as in cssHooks
  47212. Math.max( 0, matches[ 2 ] - ( subtract || 0 ) ) + ( matches[ 3 ] || "px" ) :
  47213. value;
  47214. }
  47215. function boxModelAdjustment( elem, dimension, box, isBorderBox, styles, computedVal ) {
  47216. var i = dimension === "width" ? 1 : 0,
  47217. extra = 0,
  47218. delta = 0;
  47219. // Adjustment may not be necessary
  47220. if ( box === ( isBorderBox ? "border" : "content" ) ) {
  47221. return 0;
  47222. }
  47223. for ( ; i < 4; i += 2 ) {
  47224. // Both box models exclude margin
  47225. if ( box === "margin" ) {
  47226. delta += jQuery.css( elem, box + cssExpand[ i ], true, styles );
  47227. }
  47228. // If we get here with a content-box, we're seeking "padding" or "border" or "margin"
  47229. if ( !isBorderBox ) {
  47230. // Add padding
  47231. delta += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
  47232. // For "border" or "margin", add border
  47233. if ( box !== "padding" ) {
  47234. delta += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  47235. // But still keep track of it otherwise
  47236. } else {
  47237. extra += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  47238. }
  47239. // If we get here with a border-box (content + padding + border), we're seeking "content" or
  47240. // "padding" or "margin"
  47241. } else {
  47242. // For "content", subtract padding
  47243. if ( box === "content" ) {
  47244. delta -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
  47245. }
  47246. // For "content" or "padding", subtract border
  47247. if ( box !== "margin" ) {
  47248. delta -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  47249. }
  47250. }
  47251. }
  47252. // Account for positive content-box scroll gutter when requested by providing computedVal
  47253. if ( !isBorderBox && computedVal >= 0 ) {
  47254. // offsetWidth/offsetHeight is a rounded sum of content, padding, scroll gutter, and border
  47255. // Assuming integer scroll gutter, subtract the rest and round down
  47256. delta += Math.max( 0, Math.ceil(
  47257. elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] -
  47258. computedVal -
  47259. delta -
  47260. extra -
  47261. 0.5
  47262. ) );
  47263. }
  47264. return delta;
  47265. }
  47266. function getWidthOrHeight( elem, dimension, extra ) {
  47267. // Start with computed style
  47268. var styles = getStyles( elem ),
  47269. val = curCSS( elem, dimension, styles ),
  47270. isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
  47271. valueIsBorderBox = isBorderBox;
  47272. // Support: Firefox <=54
  47273. // Return a confounding non-pixel value or feign ignorance, as appropriate.
  47274. if ( rnumnonpx.test( val ) ) {
  47275. if ( !extra ) {
  47276. return val;
  47277. }
  47278. val = "auto";
  47279. }
  47280. // Check for style in case a browser which returns unreliable values
  47281. // for getComputedStyle silently falls back to the reliable elem.style
  47282. valueIsBorderBox = valueIsBorderBox &&
  47283. ( support.boxSizingReliable() || val === elem.style[ dimension ] );
  47284. // Fall back to offsetWidth/offsetHeight when value is "auto"
  47285. // This happens for inline elements with no explicit setting (gh-3571)
  47286. // Support: Android <=4.1 - 4.3 only
  47287. // Also use offsetWidth/offsetHeight for misreported inline dimensions (gh-3602)
  47288. if ( val === "auto" ||
  47289. !parseFloat( val ) && jQuery.css( elem, "display", false, styles ) === "inline" ) {
  47290. val = elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ];
  47291. // offsetWidth/offsetHeight provide border-box values
  47292. valueIsBorderBox = true;
  47293. }
  47294. // Normalize "" and auto
  47295. val = parseFloat( val ) || 0;
  47296. // Adjust for the element's box model
  47297. return ( val +
  47298. boxModelAdjustment(
  47299. elem,
  47300. dimension,
  47301. extra || ( isBorderBox ? "border" : "content" ),
  47302. valueIsBorderBox,
  47303. styles,
  47304. // Provide the current computed size to request scroll gutter calculation (gh-3589)
  47305. val
  47306. )
  47307. ) + "px";
  47308. }
  47309. jQuery.extend( {
  47310. // Add in style property hooks for overriding the default
  47311. // behavior of getting and setting a style property
  47312. cssHooks: {
  47313. opacity: {
  47314. get: function( elem, computed ) {
  47315. if ( computed ) {
  47316. // We should always get a number back from opacity
  47317. var ret = curCSS( elem, "opacity" );
  47318. return ret === "" ? "1" : ret;
  47319. }
  47320. }
  47321. }
  47322. },
  47323. // Don't automatically add "px" to these possibly-unitless properties
  47324. cssNumber: {
  47325. "animationIterationCount": true,
  47326. "columnCount": true,
  47327. "fillOpacity": true,
  47328. "flexGrow": true,
  47329. "flexShrink": true,
  47330. "fontWeight": true,
  47331. "lineHeight": true,
  47332. "opacity": true,
  47333. "order": true,
  47334. "orphans": true,
  47335. "widows": true,
  47336. "zIndex": true,
  47337. "zoom": true
  47338. },
  47339. // Add in properties whose names you wish to fix before
  47340. // setting or getting the value
  47341. cssProps: {},
  47342. // Get and set the style property on a DOM Node
  47343. style: function( elem, name, value, extra ) {
  47344. // Don't set styles on text and comment nodes
  47345. if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) {
  47346. return;
  47347. }
  47348. // Make sure that we're working with the right name
  47349. var ret, type, hooks,
  47350. origName = camelCase( name ),
  47351. isCustomProp = rcustomProp.test( name ),
  47352. style = elem.style;
  47353. // Make sure that we're working with the right name. We don't
  47354. // want to query the value if it is a CSS custom property
  47355. // since they are user-defined.
  47356. if ( !isCustomProp ) {
  47357. name = finalPropName( origName );
  47358. }
  47359. // Gets hook for the prefixed version, then unprefixed version
  47360. hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
  47361. // Check if we're setting a value
  47362. if ( value !== undefined ) {
  47363. type = typeof value;
  47364. // Convert "+=" or "-=" to relative numbers (#7345)
  47365. if ( type === "string" && ( ret = rcssNum.exec( value ) ) && ret[ 1 ] ) {
  47366. value = adjustCSS( elem, name, ret );
  47367. // Fixes bug #9237
  47368. type = "number";
  47369. }
  47370. // Make sure that null and NaN values aren't set (#7116)
  47371. if ( value == null || value !== value ) {
  47372. return;
  47373. }
  47374. // If a number was passed in, add the unit (except for certain CSS properties)
  47375. if ( type === "number" ) {
  47376. value += ret && ret[ 3 ] || ( jQuery.cssNumber[ origName ] ? "" : "px" );
  47377. }
  47378. // background-* props affect original clone's values
  47379. if ( !support.clearCloneStyle && value === "" && name.indexOf( "background" ) === 0 ) {
  47380. style[ name ] = "inherit";
  47381. }
  47382. // If a hook was provided, use that value, otherwise just set the specified value
  47383. if ( !hooks || !( "set" in hooks ) ||
  47384. ( value = hooks.set( elem, value, extra ) ) !== undefined ) {
  47385. if ( isCustomProp ) {
  47386. style.setProperty( name, value );
  47387. } else {
  47388. style[ name ] = value;
  47389. }
  47390. }
  47391. } else {
  47392. // If a hook was provided get the non-computed value from there
  47393. if ( hooks && "get" in hooks &&
  47394. ( ret = hooks.get( elem, false, extra ) ) !== undefined ) {
  47395. return ret;
  47396. }
  47397. // Otherwise just get the value from the style object
  47398. return style[ name ];
  47399. }
  47400. },
  47401. css: function( elem, name, extra, styles ) {
  47402. var val, num, hooks,
  47403. origName = camelCase( name ),
  47404. isCustomProp = rcustomProp.test( name );
  47405. // Make sure that we're working with the right name. We don't
  47406. // want to modify the value if it is a CSS custom property
  47407. // since they are user-defined.
  47408. if ( !isCustomProp ) {
  47409. name = finalPropName( origName );
  47410. }
  47411. // Try prefixed name followed by the unprefixed name
  47412. hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
  47413. // If a hook was provided get the computed value from there
  47414. if ( hooks && "get" in hooks ) {
  47415. val = hooks.get( elem, true, extra );
  47416. }
  47417. // Otherwise, if a way to get the computed value exists, use that
  47418. if ( val === undefined ) {
  47419. val = curCSS( elem, name, styles );
  47420. }
  47421. // Convert "normal" to computed value
  47422. if ( val === "normal" && name in cssNormalTransform ) {
  47423. val = cssNormalTransform[ name ];
  47424. }
  47425. // Make numeric if forced or a qualifier was provided and val looks numeric
  47426. if ( extra === "" || extra ) {
  47427. num = parseFloat( val );
  47428. return extra === true || isFinite( num ) ? num || 0 : val;
  47429. }
  47430. return val;
  47431. }
  47432. } );
  47433. jQuery.each( [ "height", "width" ], function( i, dimension ) {
  47434. jQuery.cssHooks[ dimension ] = {
  47435. get: function( elem, computed, extra ) {
  47436. if ( computed ) {
  47437. // Certain elements can have dimension info if we invisibly show them
  47438. // but it must have a current display style that would benefit
  47439. return rdisplayswap.test( jQuery.css( elem, "display" ) ) &&
  47440. // Support: Safari 8+
  47441. // Table columns in Safari have non-zero offsetWidth & zero
  47442. // getBoundingClientRect().width unless display is changed.
  47443. // Support: IE <=11 only
  47444. // Running getBoundingClientRect on a disconnected node
  47445. // in IE throws an error.
  47446. ( !elem.getClientRects().length || !elem.getBoundingClientRect().width ) ?
  47447. swap( elem, cssShow, function() {
  47448. return getWidthOrHeight( elem, dimension, extra );
  47449. } ) :
  47450. getWidthOrHeight( elem, dimension, extra );
  47451. }
  47452. },
  47453. set: function( elem, value, extra ) {
  47454. var matches,
  47455. styles = getStyles( elem ),
  47456. isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
  47457. subtract = extra && boxModelAdjustment(
  47458. elem,
  47459. dimension,
  47460. extra,
  47461. isBorderBox,
  47462. styles
  47463. );
  47464. // Account for unreliable border-box dimensions by comparing offset* to computed and
  47465. // faking a content-box to get border and padding (gh-3699)
  47466. if ( isBorderBox && support.scrollboxSize() === styles.position ) {
  47467. subtract -= Math.ceil(
  47468. elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] -
  47469. parseFloat( styles[ dimension ] ) -
  47470. boxModelAdjustment( elem, dimension, "border", false, styles ) -
  47471. 0.5
  47472. );
  47473. }
  47474. // Convert to pixels if value adjustment is needed
  47475. if ( subtract && ( matches = rcssNum.exec( value ) ) &&
  47476. ( matches[ 3 ] || "px" ) !== "px" ) {
  47477. elem.style[ dimension ] = value;
  47478. value = jQuery.css( elem, dimension );
  47479. }
  47480. return setPositiveNumber( elem, value, subtract );
  47481. }
  47482. };
  47483. } );
  47484. jQuery.cssHooks.marginLeft = addGetHookIf( support.reliableMarginLeft,
  47485. function( elem, computed ) {
  47486. if ( computed ) {
  47487. return ( parseFloat( curCSS( elem, "marginLeft" ) ) ||
  47488. elem.getBoundingClientRect().left -
  47489. swap( elem, { marginLeft: 0 }, function() {
  47490. return elem.getBoundingClientRect().left;
  47491. } )
  47492. ) + "px";
  47493. }
  47494. }
  47495. );
  47496. // These hooks are used by animate to expand properties
  47497. jQuery.each( {
  47498. margin: "",
  47499. padding: "",
  47500. border: "Width"
  47501. }, function( prefix, suffix ) {
  47502. jQuery.cssHooks[ prefix + suffix ] = {
  47503. expand: function( value ) {
  47504. var i = 0,
  47505. expanded = {},
  47506. // Assumes a single number if not a string
  47507. parts = typeof value === "string" ? value.split( " " ) : [ value ];
  47508. for ( ; i < 4; i++ ) {
  47509. expanded[ prefix + cssExpand[ i ] + suffix ] =
  47510. parts[ i ] || parts[ i - 2 ] || parts[ 0 ];
  47511. }
  47512. return expanded;
  47513. }
  47514. };
  47515. if ( prefix !== "margin" ) {
  47516. jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber;
  47517. }
  47518. } );
  47519. jQuery.fn.extend( {
  47520. css: function( name, value ) {
  47521. return access( this, function( elem, name, value ) {
  47522. var styles, len,
  47523. map = {},
  47524. i = 0;
  47525. if ( Array.isArray( name ) ) {
  47526. styles = getStyles( elem );
  47527. len = name.length;
  47528. for ( ; i < len; i++ ) {
  47529. map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles );
  47530. }
  47531. return map;
  47532. }
  47533. return value !== undefined ?
  47534. jQuery.style( elem, name, value ) :
  47535. jQuery.css( elem, name );
  47536. }, name, value, arguments.length > 1 );
  47537. }
  47538. } );
  47539. function Tween( elem, options, prop, end, easing ) {
  47540. return new Tween.prototype.init( elem, options, prop, end, easing );
  47541. }
  47542. jQuery.Tween = Tween;
  47543. Tween.prototype = {
  47544. constructor: Tween,
  47545. init: function( elem, options, prop, end, easing, unit ) {
  47546. this.elem = elem;
  47547. this.prop = prop;
  47548. this.easing = easing || jQuery.easing._default;
  47549. this.options = options;
  47550. this.start = this.now = this.cur();
  47551. this.end = end;
  47552. this.unit = unit || ( jQuery.cssNumber[ prop ] ? "" : "px" );
  47553. },
  47554. cur: function() {
  47555. var hooks = Tween.propHooks[ this.prop ];
  47556. return hooks && hooks.get ?
  47557. hooks.get( this ) :
  47558. Tween.propHooks._default.get( this );
  47559. },
  47560. run: function( percent ) {
  47561. var eased,
  47562. hooks = Tween.propHooks[ this.prop ];
  47563. if ( this.options.duration ) {
  47564. this.pos = eased = jQuery.easing[ this.easing ](
  47565. percent, this.options.duration * percent, 0, 1, this.options.duration
  47566. );
  47567. } else {
  47568. this.pos = eased = percent;
  47569. }
  47570. this.now = ( this.end - this.start ) * eased + this.start;
  47571. if ( this.options.step ) {
  47572. this.options.step.call( this.elem, this.now, this );
  47573. }
  47574. if ( hooks && hooks.set ) {
  47575. hooks.set( this );
  47576. } else {
  47577. Tween.propHooks._default.set( this );
  47578. }
  47579. return this;
  47580. }
  47581. };
  47582. Tween.prototype.init.prototype = Tween.prototype;
  47583. Tween.propHooks = {
  47584. _default: {
  47585. get: function( tween ) {
  47586. var result;
  47587. // Use a property on the element directly when it is not a DOM element,
  47588. // or when there is no matching style property that exists.
  47589. if ( tween.elem.nodeType !== 1 ||
  47590. tween.elem[ tween.prop ] != null && tween.elem.style[ tween.prop ] == null ) {
  47591. return tween.elem[ tween.prop ];
  47592. }
  47593. // Passing an empty string as a 3rd parameter to .css will automatically
  47594. // attempt a parseFloat and fallback to a string if the parse fails.
  47595. // Simple values such as "10px" are parsed to Float;
  47596. // complex values such as "rotate(1rad)" are returned as-is.
  47597. result = jQuery.css( tween.elem, tween.prop, "" );
  47598. // Empty strings, null, undefined and "auto" are converted to 0.
  47599. return !result || result === "auto" ? 0 : result;
  47600. },
  47601. set: function( tween ) {
  47602. // Use step hook for back compat.
  47603. // Use cssHook if its there.
  47604. // Use .style if available and use plain properties where available.
  47605. if ( jQuery.fx.step[ tween.prop ] ) {
  47606. jQuery.fx.step[ tween.prop ]( tween );
  47607. } else if ( tween.elem.nodeType === 1 &&
  47608. ( tween.elem.style[ jQuery.cssProps[ tween.prop ] ] != null ||
  47609. jQuery.cssHooks[ tween.prop ] ) ) {
  47610. jQuery.style( tween.elem, tween.prop, tween.now + tween.unit );
  47611. } else {
  47612. tween.elem[ tween.prop ] = tween.now;
  47613. }
  47614. }
  47615. }
  47616. };
  47617. // Support: IE <=9 only
  47618. // Panic based approach to setting things on disconnected nodes
  47619. Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = {
  47620. set: function( tween ) {
  47621. if ( tween.elem.nodeType && tween.elem.parentNode ) {
  47622. tween.elem[ tween.prop ] = tween.now;
  47623. }
  47624. }
  47625. };
  47626. jQuery.easing = {
  47627. linear: function( p ) {
  47628. return p;
  47629. },
  47630. swing: function( p ) {
  47631. return 0.5 - Math.cos( p * Math.PI ) / 2;
  47632. },
  47633. _default: "swing"
  47634. };
  47635. jQuery.fx = Tween.prototype.init;
  47636. // Back compat <1.8 extension point
  47637. jQuery.fx.step = {};
  47638. var
  47639. fxNow, inProgress,
  47640. rfxtypes = /^(?:toggle|show|hide)$/,
  47641. rrun = /queueHooks$/;
  47642. function schedule() {
  47643. if ( inProgress ) {
  47644. if ( document.hidden === false && window.requestAnimationFrame ) {
  47645. window.requestAnimationFrame( schedule );
  47646. } else {
  47647. window.setTimeout( schedule, jQuery.fx.interval );
  47648. }
  47649. jQuery.fx.tick();
  47650. }
  47651. }
  47652. // Animations created synchronously will run synchronously
  47653. function createFxNow() {
  47654. window.setTimeout( function() {
  47655. fxNow = undefined;
  47656. } );
  47657. return ( fxNow = Date.now() );
  47658. }
  47659. // Generate parameters to create a standard animation
  47660. function genFx( type, includeWidth ) {
  47661. var which,
  47662. i = 0,
  47663. attrs = { height: type };
  47664. // If we include width, step value is 1 to do all cssExpand values,
  47665. // otherwise step value is 2 to skip over Left and Right
  47666. includeWidth = includeWidth ? 1 : 0;
  47667. for ( ; i < 4; i += 2 - includeWidth ) {
  47668. which = cssExpand[ i ];
  47669. attrs[ "margin" + which ] = attrs[ "padding" + which ] = type;
  47670. }
  47671. if ( includeWidth ) {
  47672. attrs.opacity = attrs.width = type;
  47673. }
  47674. return attrs;
  47675. }
  47676. function createTween( value, prop, animation ) {
  47677. var tween,
  47678. collection = ( Animation.tweeners[ prop ] || [] ).concat( Animation.tweeners[ "*" ] ),
  47679. index = 0,
  47680. length = collection.length;
  47681. for ( ; index < length; index++ ) {
  47682. if ( ( tween = collection[ index ].call( animation, prop, value ) ) ) {
  47683. // We're done with this property
  47684. return tween;
  47685. }
  47686. }
  47687. }
  47688. function defaultPrefilter( elem, props, opts ) {
  47689. var prop, value, toggle, hooks, oldfire, propTween, restoreDisplay, display,
  47690. isBox = "width" in props || "height" in props,
  47691. anim = this,
  47692. orig = {},
  47693. style = elem.style,
  47694. hidden = elem.nodeType && isHiddenWithinTree( elem ),
  47695. dataShow = dataPriv.get( elem, "fxshow" );
  47696. // Queue-skipping animations hijack the fx hooks
  47697. if ( !opts.queue ) {
  47698. hooks = jQuery._queueHooks( elem, "fx" );
  47699. if ( hooks.unqueued == null ) {
  47700. hooks.unqueued = 0;
  47701. oldfire = hooks.empty.fire;
  47702. hooks.empty.fire = function() {
  47703. if ( !hooks.unqueued ) {
  47704. oldfire();
  47705. }
  47706. };
  47707. }
  47708. hooks.unqueued++;
  47709. anim.always( function() {
  47710. // Ensure the complete handler is called before this completes
  47711. anim.always( function() {
  47712. hooks.unqueued--;
  47713. if ( !jQuery.queue( elem, "fx" ).length ) {
  47714. hooks.empty.fire();
  47715. }
  47716. } );
  47717. } );
  47718. }
  47719. // Detect show/hide animations
  47720. for ( prop in props ) {
  47721. value = props[ prop ];
  47722. if ( rfxtypes.test( value ) ) {
  47723. delete props[ prop ];
  47724. toggle = toggle || value === "toggle";
  47725. if ( value === ( hidden ? "hide" : "show" ) ) {
  47726. // Pretend to be hidden if this is a "show" and
  47727. // there is still data from a stopped show/hide
  47728. if ( value === "show" && dataShow && dataShow[ prop ] !== undefined ) {
  47729. hidden = true;
  47730. // Ignore all other no-op show/hide data
  47731. } else {
  47732. continue;
  47733. }
  47734. }
  47735. orig[ prop ] = dataShow && dataShow[ prop ] || jQuery.style( elem, prop );
  47736. }
  47737. }
  47738. // Bail out if this is a no-op like .hide().hide()
  47739. propTween = !jQuery.isEmptyObject( props );
  47740. if ( !propTween && jQuery.isEmptyObject( orig ) ) {
  47741. return;
  47742. }
  47743. // Restrict "overflow" and "display" styles during box animations
  47744. if ( isBox && elem.nodeType === 1 ) {
  47745. // Support: IE <=9 - 11, Edge 12 - 15
  47746. // Record all 3 overflow attributes because IE does not infer the shorthand
  47747. // from identically-valued overflowX and overflowY and Edge just mirrors
  47748. // the overflowX value there.
  47749. opts.overflow = [ style.overflow, style.overflowX, style.overflowY ];
  47750. // Identify a display type, preferring old show/hide data over the CSS cascade
  47751. restoreDisplay = dataShow && dataShow.display;
  47752. if ( restoreDisplay == null ) {
  47753. restoreDisplay = dataPriv.get( elem, "display" );
  47754. }
  47755. display = jQuery.css( elem, "display" );
  47756. if ( display === "none" ) {
  47757. if ( restoreDisplay ) {
  47758. display = restoreDisplay;
  47759. } else {
  47760. // Get nonempty value(s) by temporarily forcing visibility
  47761. showHide( [ elem ], true );
  47762. restoreDisplay = elem.style.display || restoreDisplay;
  47763. display = jQuery.css( elem, "display" );
  47764. showHide( [ elem ] );
  47765. }
  47766. }
  47767. // Animate inline elements as inline-block
  47768. if ( display === "inline" || display === "inline-block" && restoreDisplay != null ) {
  47769. if ( jQuery.css( elem, "float" ) === "none" ) {
  47770. // Restore the original display value at the end of pure show/hide animations
  47771. if ( !propTween ) {
  47772. anim.done( function() {
  47773. style.display = restoreDisplay;
  47774. } );
  47775. if ( restoreDisplay == null ) {
  47776. display = style.display;
  47777. restoreDisplay = display === "none" ? "" : display;
  47778. }
  47779. }
  47780. style.display = "inline-block";
  47781. }
  47782. }
  47783. }
  47784. if ( opts.overflow ) {
  47785. style.overflow = "hidden";
  47786. anim.always( function() {
  47787. style.overflow = opts.overflow[ 0 ];
  47788. style.overflowX = opts.overflow[ 1 ];
  47789. style.overflowY = opts.overflow[ 2 ];
  47790. } );
  47791. }
  47792. // Implement show/hide animations
  47793. propTween = false;
  47794. for ( prop in orig ) {
  47795. // General show/hide setup for this element animation
  47796. if ( !propTween ) {
  47797. if ( dataShow ) {
  47798. if ( "hidden" in dataShow ) {
  47799. hidden = dataShow.hidden;
  47800. }
  47801. } else {
  47802. dataShow = dataPriv.access( elem, "fxshow", { display: restoreDisplay } );
  47803. }
  47804. // Store hidden/visible for toggle so `.stop().toggle()` "reverses"
  47805. if ( toggle ) {
  47806. dataShow.hidden = !hidden;
  47807. }
  47808. // Show elements before animating them
  47809. if ( hidden ) {
  47810. showHide( [ elem ], true );
  47811. }
  47812. /* eslint-disable no-loop-func */
  47813. anim.done( function() {
  47814. /* eslint-enable no-loop-func */
  47815. // The final step of a "hide" animation is actually hiding the element
  47816. if ( !hidden ) {
  47817. showHide( [ elem ] );
  47818. }
  47819. dataPriv.remove( elem, "fxshow" );
  47820. for ( prop in orig ) {
  47821. jQuery.style( elem, prop, orig[ prop ] );
  47822. }
  47823. } );
  47824. }
  47825. // Per-property setup
  47826. propTween = createTween( hidden ? dataShow[ prop ] : 0, prop, anim );
  47827. if ( !( prop in dataShow ) ) {
  47828. dataShow[ prop ] = propTween.start;
  47829. if ( hidden ) {
  47830. propTween.end = propTween.start;
  47831. propTween.start = 0;
  47832. }
  47833. }
  47834. }
  47835. }
  47836. function propFilter( props, specialEasing ) {
  47837. var index, name, easing, value, hooks;
  47838. // camelCase, specialEasing and expand cssHook pass
  47839. for ( index in props ) {
  47840. name = camelCase( index );
  47841. easing = specialEasing[ name ];
  47842. value = props[ index ];
  47843. if ( Array.isArray( value ) ) {
  47844. easing = value[ 1 ];
  47845. value = props[ index ] = value[ 0 ];
  47846. }
  47847. if ( index !== name ) {
  47848. props[ name ] = value;
  47849. delete props[ index ];
  47850. }
  47851. hooks = jQuery.cssHooks[ name ];
  47852. if ( hooks && "expand" in hooks ) {
  47853. value = hooks.expand( value );
  47854. delete props[ name ];
  47855. // Not quite $.extend, this won't overwrite existing keys.
  47856. // Reusing 'index' because we have the correct "name"
  47857. for ( index in value ) {
  47858. if ( !( index in props ) ) {
  47859. props[ index ] = value[ index ];
  47860. specialEasing[ index ] = easing;
  47861. }
  47862. }
  47863. } else {
  47864. specialEasing[ name ] = easing;
  47865. }
  47866. }
  47867. }
  47868. function Animation( elem, properties, options ) {
  47869. var result,
  47870. stopped,
  47871. index = 0,
  47872. length = Animation.prefilters.length,
  47873. deferred = jQuery.Deferred().always( function() {
  47874. // Don't match elem in the :animated selector
  47875. delete tick.elem;
  47876. } ),
  47877. tick = function() {
  47878. if ( stopped ) {
  47879. return false;
  47880. }
  47881. var currentTime = fxNow || createFxNow(),
  47882. remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ),
  47883. // Support: Android 2.3 only
  47884. // Archaic crash bug won't allow us to use `1 - ( 0.5 || 0 )` (#12497)
  47885. temp = remaining / animation.duration || 0,
  47886. percent = 1 - temp,
  47887. index = 0,
  47888. length = animation.tweens.length;
  47889. for ( ; index < length; index++ ) {
  47890. animation.tweens[ index ].run( percent );
  47891. }
  47892. deferred.notifyWith( elem, [ animation, percent, remaining ] );
  47893. // If there's more to do, yield
  47894. if ( percent < 1 && length ) {
  47895. return remaining;
  47896. }
  47897. // If this was an empty animation, synthesize a final progress notification
  47898. if ( !length ) {
  47899. deferred.notifyWith( elem, [ animation, 1, 0 ] );
  47900. }
  47901. // Resolve the animation and report its conclusion
  47902. deferred.resolveWith( elem, [ animation ] );
  47903. return false;
  47904. },
  47905. animation = deferred.promise( {
  47906. elem: elem,
  47907. props: jQuery.extend( {}, properties ),
  47908. opts: jQuery.extend( true, {
  47909. specialEasing: {},
  47910. easing: jQuery.easing._default
  47911. }, options ),
  47912. originalProperties: properties,
  47913. originalOptions: options,
  47914. startTime: fxNow || createFxNow(),
  47915. duration: options.duration,
  47916. tweens: [],
  47917. createTween: function( prop, end ) {
  47918. var tween = jQuery.Tween( elem, animation.opts, prop, end,
  47919. animation.opts.specialEasing[ prop ] || animation.opts.easing );
  47920. animation.tweens.push( tween );
  47921. return tween;
  47922. },
  47923. stop: function( gotoEnd ) {
  47924. var index = 0,
  47925. // If we are going to the end, we want to run all the tweens
  47926. // otherwise we skip this part
  47927. length = gotoEnd ? animation.tweens.length : 0;
  47928. if ( stopped ) {
  47929. return this;
  47930. }
  47931. stopped = true;
  47932. for ( ; index < length; index++ ) {
  47933. animation.tweens[ index ].run( 1 );
  47934. }
  47935. // Resolve when we played the last frame; otherwise, reject
  47936. if ( gotoEnd ) {
  47937. deferred.notifyWith( elem, [ animation, 1, 0 ] );
  47938. deferred.resolveWith( elem, [ animation, gotoEnd ] );
  47939. } else {
  47940. deferred.rejectWith( elem, [ animation, gotoEnd ] );
  47941. }
  47942. return this;
  47943. }
  47944. } ),
  47945. props = animation.props;
  47946. propFilter( props, animation.opts.specialEasing );
  47947. for ( ; index < length; index++ ) {
  47948. result = Animation.prefilters[ index ].call( animation, elem, props, animation.opts );
  47949. if ( result ) {
  47950. if ( isFunction( result.stop ) ) {
  47951. jQuery._queueHooks( animation.elem, animation.opts.queue ).stop =
  47952. result.stop.bind( result );
  47953. }
  47954. return result;
  47955. }
  47956. }
  47957. jQuery.map( props, createTween, animation );
  47958. if ( isFunction( animation.opts.start ) ) {
  47959. animation.opts.start.call( elem, animation );
  47960. }
  47961. // Attach callbacks from options
  47962. animation
  47963. .progress( animation.opts.progress )
  47964. .done( animation.opts.done, animation.opts.complete )
  47965. .fail( animation.opts.fail )
  47966. .always( animation.opts.always );
  47967. jQuery.fx.timer(
  47968. jQuery.extend( tick, {
  47969. elem: elem,
  47970. anim: animation,
  47971. queue: animation.opts.queue
  47972. } )
  47973. );
  47974. return animation;
  47975. }
  47976. jQuery.Animation = jQuery.extend( Animation, {
  47977. tweeners: {
  47978. "*": [ function( prop, value ) {
  47979. var tween = this.createTween( prop, value );
  47980. adjustCSS( tween.elem, prop, rcssNum.exec( value ), tween );
  47981. return tween;
  47982. } ]
  47983. },
  47984. tweener: function( props, callback ) {
  47985. if ( isFunction( props ) ) {
  47986. callback = props;
  47987. props = [ "*" ];
  47988. } else {
  47989. props = props.match( rnothtmlwhite );
  47990. }
  47991. var prop,
  47992. index = 0,
  47993. length = props.length;
  47994. for ( ; index < length; index++ ) {
  47995. prop = props[ index ];
  47996. Animation.tweeners[ prop ] = Animation.tweeners[ prop ] || [];
  47997. Animation.tweeners[ prop ].unshift( callback );
  47998. }
  47999. },
  48000. prefilters: [ defaultPrefilter ],
  48001. prefilter: function( callback, prepend ) {
  48002. if ( prepend ) {
  48003. Animation.prefilters.unshift( callback );
  48004. } else {
  48005. Animation.prefilters.push( callback );
  48006. }
  48007. }
  48008. } );
  48009. jQuery.speed = function( speed, easing, fn ) {
  48010. var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : {
  48011. complete: fn || !fn && easing ||
  48012. isFunction( speed ) && speed,
  48013. duration: speed,
  48014. easing: fn && easing || easing && !isFunction( easing ) && easing
  48015. };
  48016. // Go to the end state if fx are off
  48017. if ( jQuery.fx.off ) {
  48018. opt.duration = 0;
  48019. } else {
  48020. if ( typeof opt.duration !== "number" ) {
  48021. if ( opt.duration in jQuery.fx.speeds ) {
  48022. opt.duration = jQuery.fx.speeds[ opt.duration ];
  48023. } else {
  48024. opt.duration = jQuery.fx.speeds._default;
  48025. }
  48026. }
  48027. }
  48028. // Normalize opt.queue - true/undefined/null -> "fx"
  48029. if ( opt.queue == null || opt.queue === true ) {
  48030. opt.queue = "fx";
  48031. }
  48032. // Queueing
  48033. opt.old = opt.complete;
  48034. opt.complete = function() {
  48035. if ( isFunction( opt.old ) ) {
  48036. opt.old.call( this );
  48037. }
  48038. if ( opt.queue ) {
  48039. jQuery.dequeue( this, opt.queue );
  48040. }
  48041. };
  48042. return opt;
  48043. };
  48044. jQuery.fn.extend( {
  48045. fadeTo: function( speed, to, easing, callback ) {
  48046. // Show any hidden elements after setting opacity to 0
  48047. return this.filter( isHiddenWithinTree ).css( "opacity", 0 ).show()
  48048. // Animate to the value specified
  48049. .end().animate( { opacity: to }, speed, easing, callback );
  48050. },
  48051. animate: function( prop, speed, easing, callback ) {
  48052. var empty = jQuery.isEmptyObject( prop ),
  48053. optall = jQuery.speed( speed, easing, callback ),
  48054. doAnimation = function() {
  48055. // Operate on a copy of prop so per-property easing won't be lost
  48056. var anim = Animation( this, jQuery.extend( {}, prop ), optall );
  48057. // Empty animations, or finishing resolves immediately
  48058. if ( empty || dataPriv.get( this, "finish" ) ) {
  48059. anim.stop( true );
  48060. }
  48061. };
  48062. doAnimation.finish = doAnimation;
  48063. return empty || optall.queue === false ?
  48064. this.each( doAnimation ) :
  48065. this.queue( optall.queue, doAnimation );
  48066. },
  48067. stop: function( type, clearQueue, gotoEnd ) {
  48068. var stopQueue = function( hooks ) {
  48069. var stop = hooks.stop;
  48070. delete hooks.stop;
  48071. stop( gotoEnd );
  48072. };
  48073. if ( typeof type !== "string" ) {
  48074. gotoEnd = clearQueue;
  48075. clearQueue = type;
  48076. type = undefined;
  48077. }
  48078. if ( clearQueue && type !== false ) {
  48079. this.queue( type || "fx", [] );
  48080. }
  48081. return this.each( function() {
  48082. var dequeue = true,
  48083. index = type != null && type + "queueHooks",
  48084. timers = jQuery.timers,
  48085. data = dataPriv.get( this );
  48086. if ( index ) {
  48087. if ( data[ index ] && data[ index ].stop ) {
  48088. stopQueue( data[ index ] );
  48089. }
  48090. } else {
  48091. for ( index in data ) {
  48092. if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) {
  48093. stopQueue( data[ index ] );
  48094. }
  48095. }
  48096. }
  48097. for ( index = timers.length; index--; ) {
  48098. if ( timers[ index ].elem === this &&
  48099. ( type == null || timers[ index ].queue === type ) ) {
  48100. timers[ index ].anim.stop( gotoEnd );
  48101. dequeue = false;
  48102. timers.splice( index, 1 );
  48103. }
  48104. }
  48105. // Start the next in the queue if the last step wasn't forced.
  48106. // Timers currently will call their complete callbacks, which
  48107. // will dequeue but only if they were gotoEnd.
  48108. if ( dequeue || !gotoEnd ) {
  48109. jQuery.dequeue( this, type );
  48110. }
  48111. } );
  48112. },
  48113. finish: function( type ) {
  48114. if ( type !== false ) {
  48115. type = type || "fx";
  48116. }
  48117. return this.each( function() {
  48118. var index,
  48119. data = dataPriv.get( this ),
  48120. queue = data[ type + "queue" ],
  48121. hooks = data[ type + "queueHooks" ],
  48122. timers = jQuery.timers,
  48123. length = queue ? queue.length : 0;
  48124. // Enable finishing flag on private data
  48125. data.finish = true;
  48126. // Empty the queue first
  48127. jQuery.queue( this, type, [] );
  48128. if ( hooks && hooks.stop ) {
  48129. hooks.stop.call( this, true );
  48130. }
  48131. // Look for any active animations, and finish them
  48132. for ( index = timers.length; index--; ) {
  48133. if ( timers[ index ].elem === this && timers[ index ].queue === type ) {
  48134. timers[ index ].anim.stop( true );
  48135. timers.splice( index, 1 );
  48136. }
  48137. }
  48138. // Look for any animations in the old queue and finish them
  48139. for ( index = 0; index < length; index++ ) {
  48140. if ( queue[ index ] && queue[ index ].finish ) {
  48141. queue[ index ].finish.call( this );
  48142. }
  48143. }
  48144. // Turn off finishing flag
  48145. delete data.finish;
  48146. } );
  48147. }
  48148. } );
  48149. jQuery.each( [ "toggle", "show", "hide" ], function( i, name ) {
  48150. var cssFn = jQuery.fn[ name ];
  48151. jQuery.fn[ name ] = function( speed, easing, callback ) {
  48152. return speed == null || typeof speed === "boolean" ?
  48153. cssFn.apply( this, arguments ) :
  48154. this.animate( genFx( name, true ), speed, easing, callback );
  48155. };
  48156. } );
  48157. // Generate shortcuts for custom animations
  48158. jQuery.each( {
  48159. slideDown: genFx( "show" ),
  48160. slideUp: genFx( "hide" ),
  48161. slideToggle: genFx( "toggle" ),
  48162. fadeIn: { opacity: "show" },
  48163. fadeOut: { opacity: "hide" },
  48164. fadeToggle: { opacity: "toggle" }
  48165. }, function( name, props ) {
  48166. jQuery.fn[ name ] = function( speed, easing, callback ) {
  48167. return this.animate( props, speed, easing, callback );
  48168. };
  48169. } );
  48170. jQuery.timers = [];
  48171. jQuery.fx.tick = function() {
  48172. var timer,
  48173. i = 0,
  48174. timers = jQuery.timers;
  48175. fxNow = Date.now();
  48176. for ( ; i < timers.length; i++ ) {
  48177. timer = timers[ i ];
  48178. // Run the timer and safely remove it when done (allowing for external removal)
  48179. if ( !timer() && timers[ i ] === timer ) {
  48180. timers.splice( i--, 1 );
  48181. }
  48182. }
  48183. if ( !timers.length ) {
  48184. jQuery.fx.stop();
  48185. }
  48186. fxNow = undefined;
  48187. };
  48188. jQuery.fx.timer = function( timer ) {
  48189. jQuery.timers.push( timer );
  48190. jQuery.fx.start();
  48191. };
  48192. jQuery.fx.interval = 13;
  48193. jQuery.fx.start = function() {
  48194. if ( inProgress ) {
  48195. return;
  48196. }
  48197. inProgress = true;
  48198. schedule();
  48199. };
  48200. jQuery.fx.stop = function() {
  48201. inProgress = null;
  48202. };
  48203. jQuery.fx.speeds = {
  48204. slow: 600,
  48205. fast: 200,
  48206. // Default speed
  48207. _default: 400
  48208. };
  48209. // Based off of the plugin by Clint Helfers, with permission.
  48210. // https://web.archive.org/web/20100324014747/http://blindsignals.com/index.php/2009/07/jquery-delay/
  48211. jQuery.fn.delay = function( time, type ) {
  48212. time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time;
  48213. type = type || "fx";
  48214. return this.queue( type, function( next, hooks ) {
  48215. var timeout = window.setTimeout( next, time );
  48216. hooks.stop = function() {
  48217. window.clearTimeout( timeout );
  48218. };
  48219. } );
  48220. };
  48221. ( function() {
  48222. var input = document.createElement( "input" ),
  48223. select = document.createElement( "select" ),
  48224. opt = select.appendChild( document.createElement( "option" ) );
  48225. input.type = "checkbox";
  48226. // Support: Android <=4.3 only
  48227. // Default value for a checkbox should be "on"
  48228. support.checkOn = input.value !== "";
  48229. // Support: IE <=11 only
  48230. // Must access selectedIndex to make default options select
  48231. support.optSelected = opt.selected;
  48232. // Support: IE <=11 only
  48233. // An input loses its value after becoming a radio
  48234. input = document.createElement( "input" );
  48235. input.value = "t";
  48236. input.type = "radio";
  48237. support.radioValue = input.value === "t";
  48238. } )();
  48239. var boolHook,
  48240. attrHandle = jQuery.expr.attrHandle;
  48241. jQuery.fn.extend( {
  48242. attr: function( name, value ) {
  48243. return access( this, jQuery.attr, name, value, arguments.length > 1 );
  48244. },
  48245. removeAttr: function( name ) {
  48246. return this.each( function() {
  48247. jQuery.removeAttr( this, name );
  48248. } );
  48249. }
  48250. } );
  48251. jQuery.extend( {
  48252. attr: function( elem, name, value ) {
  48253. var ret, hooks,
  48254. nType = elem.nodeType;
  48255. // Don't get/set attributes on text, comment and attribute nodes
  48256. if ( nType === 3 || nType === 8 || nType === 2 ) {
  48257. return;
  48258. }
  48259. // Fallback to prop when attributes are not supported
  48260. if ( typeof elem.getAttribute === "undefined" ) {
  48261. return jQuery.prop( elem, name, value );
  48262. }
  48263. // Attribute hooks are determined by the lowercase version
  48264. // Grab necessary hook if one is defined
  48265. if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
  48266. hooks = jQuery.attrHooks[ name.toLowerCase() ] ||
  48267. ( jQuery.expr.match.bool.test( name ) ? boolHook : undefined );
  48268. }
  48269. if ( value !== undefined ) {
  48270. if ( value === null ) {
  48271. jQuery.removeAttr( elem, name );
  48272. return;
  48273. }
  48274. if ( hooks && "set" in hooks &&
  48275. ( ret = hooks.set( elem, value, name ) ) !== undefined ) {
  48276. return ret;
  48277. }
  48278. elem.setAttribute( name, value + "" );
  48279. return value;
  48280. }
  48281. if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {
  48282. return ret;
  48283. }
  48284. ret = jQuery.find.attr( elem, name );
  48285. // Non-existent attributes return null, we normalize to undefined
  48286. return ret == null ? undefined : ret;
  48287. },
  48288. attrHooks: {
  48289. type: {
  48290. set: function( elem, value ) {
  48291. if ( !support.radioValue && value === "radio" &&
  48292. nodeName( elem, "input" ) ) {
  48293. var val = elem.value;
  48294. elem.setAttribute( "type", value );
  48295. if ( val ) {
  48296. elem.value = val;
  48297. }
  48298. return value;
  48299. }
  48300. }
  48301. }
  48302. },
  48303. removeAttr: function( elem, value ) {
  48304. var name,
  48305. i = 0,
  48306. // Attribute names can contain non-HTML whitespace characters
  48307. // https://html.spec.whatwg.org/multipage/syntax.html#attributes-2
  48308. attrNames = value && value.match( rnothtmlwhite );
  48309. if ( attrNames && elem.nodeType === 1 ) {
  48310. while ( ( name = attrNames[ i++ ] ) ) {
  48311. elem.removeAttribute( name );
  48312. }
  48313. }
  48314. }
  48315. } );
  48316. // Hooks for boolean attributes
  48317. boolHook = {
  48318. set: function( elem, value, name ) {
  48319. if ( value === false ) {
  48320. // Remove boolean attributes when set to false
  48321. jQuery.removeAttr( elem, name );
  48322. } else {
  48323. elem.setAttribute( name, name );
  48324. }
  48325. return name;
  48326. }
  48327. };
  48328. jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( i, name ) {
  48329. var getter = attrHandle[ name ] || jQuery.find.attr;
  48330. attrHandle[ name ] = function( elem, name, isXML ) {
  48331. var ret, handle,
  48332. lowercaseName = name.toLowerCase();
  48333. if ( !isXML ) {
  48334. // Avoid an infinite loop by temporarily removing this function from the getter
  48335. handle = attrHandle[ lowercaseName ];
  48336. attrHandle[ lowercaseName ] = ret;
  48337. ret = getter( elem, name, isXML ) != null ?
  48338. lowercaseName :
  48339. null;
  48340. attrHandle[ lowercaseName ] = handle;
  48341. }
  48342. return ret;
  48343. };
  48344. } );
  48345. var rfocusable = /^(?:input|select|textarea|button)$/i,
  48346. rclickable = /^(?:a|area)$/i;
  48347. jQuery.fn.extend( {
  48348. prop: function( name, value ) {
  48349. return access( this, jQuery.prop, name, value, arguments.length > 1 );
  48350. },
  48351. removeProp: function( name ) {
  48352. return this.each( function() {
  48353. delete this[ jQuery.propFix[ name ] || name ];
  48354. } );
  48355. }
  48356. } );
  48357. jQuery.extend( {
  48358. prop: function( elem, name, value ) {
  48359. var ret, hooks,
  48360. nType = elem.nodeType;
  48361. // Don't get/set properties on text, comment and attribute nodes
  48362. if ( nType === 3 || nType === 8 || nType === 2 ) {
  48363. return;
  48364. }
  48365. if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
  48366. // Fix name and attach hooks
  48367. name = jQuery.propFix[ name ] || name;
  48368. hooks = jQuery.propHooks[ name ];
  48369. }
  48370. if ( value !== undefined ) {
  48371. if ( hooks && "set" in hooks &&
  48372. ( ret = hooks.set( elem, value, name ) ) !== undefined ) {
  48373. return ret;
  48374. }
  48375. return ( elem[ name ] = value );
  48376. }
  48377. if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {
  48378. return ret;
  48379. }
  48380. return elem[ name ];
  48381. },
  48382. propHooks: {
  48383. tabIndex: {
  48384. get: function( elem ) {
  48385. // Support: IE <=9 - 11 only
  48386. // elem.tabIndex doesn't always return the
  48387. // correct value when it hasn't been explicitly set
  48388. // https://web.archive.org/web/20141116233347/http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
  48389. // Use proper attribute retrieval(#12072)
  48390. var tabindex = jQuery.find.attr( elem, "tabindex" );
  48391. if ( tabindex ) {
  48392. return parseInt( tabindex, 10 );
  48393. }
  48394. if (
  48395. rfocusable.test( elem.nodeName ) ||
  48396. rclickable.test( elem.nodeName ) &&
  48397. elem.href
  48398. ) {
  48399. return 0;
  48400. }
  48401. return -1;
  48402. }
  48403. }
  48404. },
  48405. propFix: {
  48406. "for": "htmlFor",
  48407. "class": "className"
  48408. }
  48409. } );
  48410. // Support: IE <=11 only
  48411. // Accessing the selectedIndex property
  48412. // forces the browser to respect setting selected
  48413. // on the option
  48414. // The getter ensures a default option is selected
  48415. // when in an optgroup
  48416. // eslint rule "no-unused-expressions" is disabled for this code
  48417. // since it considers such accessions noop
  48418. if ( !support.optSelected ) {
  48419. jQuery.propHooks.selected = {
  48420. get: function( elem ) {
  48421. /* eslint no-unused-expressions: "off" */
  48422. var parent = elem.parentNode;
  48423. if ( parent && parent.parentNode ) {
  48424. parent.parentNode.selectedIndex;
  48425. }
  48426. return null;
  48427. },
  48428. set: function( elem ) {
  48429. /* eslint no-unused-expressions: "off" */
  48430. var parent = elem.parentNode;
  48431. if ( parent ) {
  48432. parent.selectedIndex;
  48433. if ( parent.parentNode ) {
  48434. parent.parentNode.selectedIndex;
  48435. }
  48436. }
  48437. }
  48438. };
  48439. }
  48440. jQuery.each( [
  48441. "tabIndex",
  48442. "readOnly",
  48443. "maxLength",
  48444. "cellSpacing",
  48445. "cellPadding",
  48446. "rowSpan",
  48447. "colSpan",
  48448. "useMap",
  48449. "frameBorder",
  48450. "contentEditable"
  48451. ], function() {
  48452. jQuery.propFix[ this.toLowerCase() ] = this;
  48453. } );
  48454. // Strip and collapse whitespace according to HTML spec
  48455. // https://infra.spec.whatwg.org/#strip-and-collapse-ascii-whitespace
  48456. function stripAndCollapse( value ) {
  48457. var tokens = value.match( rnothtmlwhite ) || [];
  48458. return tokens.join( " " );
  48459. }
  48460. function getClass( elem ) {
  48461. return elem.getAttribute && elem.getAttribute( "class" ) || "";
  48462. }
  48463. function classesToArray( value ) {
  48464. if ( Array.isArray( value ) ) {
  48465. return value;
  48466. }
  48467. if ( typeof value === "string" ) {
  48468. return value.match( rnothtmlwhite ) || [];
  48469. }
  48470. return [];
  48471. }
  48472. jQuery.fn.extend( {
  48473. addClass: function( value ) {
  48474. var classes, elem, cur, curValue, clazz, j, finalValue,
  48475. i = 0;
  48476. if ( isFunction( value ) ) {
  48477. return this.each( function( j ) {
  48478. jQuery( this ).addClass( value.call( this, j, getClass( this ) ) );
  48479. } );
  48480. }
  48481. classes = classesToArray( value );
  48482. if ( classes.length ) {
  48483. while ( ( elem = this[ i++ ] ) ) {
  48484. curValue = getClass( elem );
  48485. cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " );
  48486. if ( cur ) {
  48487. j = 0;
  48488. while ( ( clazz = classes[ j++ ] ) ) {
  48489. if ( cur.indexOf( " " + clazz + " " ) < 0 ) {
  48490. cur += clazz + " ";
  48491. }
  48492. }
  48493. // Only assign if different to avoid unneeded rendering.
  48494. finalValue = stripAndCollapse( cur );
  48495. if ( curValue !== finalValue ) {
  48496. elem.setAttribute( "class", finalValue );
  48497. }
  48498. }
  48499. }
  48500. }
  48501. return this;
  48502. },
  48503. removeClass: function( value ) {
  48504. var classes, elem, cur, curValue, clazz, j, finalValue,
  48505. i = 0;
  48506. if ( isFunction( value ) ) {
  48507. return this.each( function( j ) {
  48508. jQuery( this ).removeClass( value.call( this, j, getClass( this ) ) );
  48509. } );
  48510. }
  48511. if ( !arguments.length ) {
  48512. return this.attr( "class", "" );
  48513. }
  48514. classes = classesToArray( value );
  48515. if ( classes.length ) {
  48516. while ( ( elem = this[ i++ ] ) ) {
  48517. curValue = getClass( elem );
  48518. // This expression is here for better compressibility (see addClass)
  48519. cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " );
  48520. if ( cur ) {
  48521. j = 0;
  48522. while ( ( clazz = classes[ j++ ] ) ) {
  48523. // Remove *all* instances
  48524. while ( cur.indexOf( " " + clazz + " " ) > -1 ) {
  48525. cur = cur.replace( " " + clazz + " ", " " );
  48526. }
  48527. }
  48528. // Only assign if different to avoid unneeded rendering.
  48529. finalValue = stripAndCollapse( cur );
  48530. if ( curValue !== finalValue ) {
  48531. elem.setAttribute( "class", finalValue );
  48532. }
  48533. }
  48534. }
  48535. }
  48536. return this;
  48537. },
  48538. toggleClass: function( value, stateVal ) {
  48539. var type = typeof value,
  48540. isValidValue = type === "string" || Array.isArray( value );
  48541. if ( typeof stateVal === "boolean" && isValidValue ) {
  48542. return stateVal ? this.addClass( value ) : this.removeClass( value );
  48543. }
  48544. if ( isFunction( value ) ) {
  48545. return this.each( function( i ) {
  48546. jQuery( this ).toggleClass(
  48547. value.call( this, i, getClass( this ), stateVal ),
  48548. stateVal
  48549. );
  48550. } );
  48551. }
  48552. return this.each( function() {
  48553. var className, i, self, classNames;
  48554. if ( isValidValue ) {
  48555. // Toggle individual class names
  48556. i = 0;
  48557. self = jQuery( this );
  48558. classNames = classesToArray( value );
  48559. while ( ( className = classNames[ i++ ] ) ) {
  48560. // Check each className given, space separated list
  48561. if ( self.hasClass( className ) ) {
  48562. self.removeClass( className );
  48563. } else {
  48564. self.addClass( className );
  48565. }
  48566. }
  48567. // Toggle whole class name
  48568. } else if ( value === undefined || type === "boolean" ) {
  48569. className = getClass( this );
  48570. if ( className ) {
  48571. // Store className if set
  48572. dataPriv.set( this, "__className__", className );
  48573. }
  48574. // If the element has a class name or if we're passed `false`,
  48575. // then remove the whole classname (if there was one, the above saved it).
  48576. // Otherwise bring back whatever was previously saved (if anything),
  48577. // falling back to the empty string if nothing was stored.
  48578. if ( this.setAttribute ) {
  48579. this.setAttribute( "class",
  48580. className || value === false ?
  48581. "" :
  48582. dataPriv.get( this, "__className__" ) || ""
  48583. );
  48584. }
  48585. }
  48586. } );
  48587. },
  48588. hasClass: function( selector ) {
  48589. var className, elem,
  48590. i = 0;
  48591. className = " " + selector + " ";
  48592. while ( ( elem = this[ i++ ] ) ) {
  48593. if ( elem.nodeType === 1 &&
  48594. ( " " + stripAndCollapse( getClass( elem ) ) + " " ).indexOf( className ) > -1 ) {
  48595. return true;
  48596. }
  48597. }
  48598. return false;
  48599. }
  48600. } );
  48601. var rreturn = /\r/g;
  48602. jQuery.fn.extend( {
  48603. val: function( value ) {
  48604. var hooks, ret, valueIsFunction,
  48605. elem = this[ 0 ];
  48606. if ( !arguments.length ) {
  48607. if ( elem ) {
  48608. hooks = jQuery.valHooks[ elem.type ] ||
  48609. jQuery.valHooks[ elem.nodeName.toLowerCase() ];
  48610. if ( hooks &&
  48611. "get" in hooks &&
  48612. ( ret = hooks.get( elem, "value" ) ) !== undefined
  48613. ) {
  48614. return ret;
  48615. }
  48616. ret = elem.value;
  48617. // Handle most common string cases
  48618. if ( typeof ret === "string" ) {
  48619. return ret.replace( rreturn, "" );
  48620. }
  48621. // Handle cases where value is null/undef or number
  48622. return ret == null ? "" : ret;
  48623. }
  48624. return;
  48625. }
  48626. valueIsFunction = isFunction( value );
  48627. return this.each( function( i ) {
  48628. var val;
  48629. if ( this.nodeType !== 1 ) {
  48630. return;
  48631. }
  48632. if ( valueIsFunction ) {
  48633. val = value.call( this, i, jQuery( this ).val() );
  48634. } else {
  48635. val = value;
  48636. }
  48637. // Treat null/undefined as ""; convert numbers to string
  48638. if ( val == null ) {
  48639. val = "";
  48640. } else if ( typeof val === "number" ) {
  48641. val += "";
  48642. } else if ( Array.isArray( val ) ) {
  48643. val = jQuery.map( val, function( value ) {
  48644. return value == null ? "" : value + "";
  48645. } );
  48646. }
  48647. hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ];
  48648. // If set returns undefined, fall back to normal setting
  48649. if ( !hooks || !( "set" in hooks ) || hooks.set( this, val, "value" ) === undefined ) {
  48650. this.value = val;
  48651. }
  48652. } );
  48653. }
  48654. } );
  48655. jQuery.extend( {
  48656. valHooks: {
  48657. option: {
  48658. get: function( elem ) {
  48659. var val = jQuery.find.attr( elem, "value" );
  48660. return val != null ?
  48661. val :
  48662. // Support: IE <=10 - 11 only
  48663. // option.text throws exceptions (#14686, #14858)
  48664. // Strip and collapse whitespace
  48665. // https://html.spec.whatwg.org/#strip-and-collapse-whitespace
  48666. stripAndCollapse( jQuery.text( elem ) );
  48667. }
  48668. },
  48669. select: {
  48670. get: function( elem ) {
  48671. var value, option, i,
  48672. options = elem.options,
  48673. index = elem.selectedIndex,
  48674. one = elem.type === "select-one",
  48675. values = one ? null : [],
  48676. max = one ? index + 1 : options.length;
  48677. if ( index < 0 ) {
  48678. i = max;
  48679. } else {
  48680. i = one ? index : 0;
  48681. }
  48682. // Loop through all the selected options
  48683. for ( ; i < max; i++ ) {
  48684. option = options[ i ];
  48685. // Support: IE <=9 only
  48686. // IE8-9 doesn't update selected after form reset (#2551)
  48687. if ( ( option.selected || i === index ) &&
  48688. // Don't return options that are disabled or in a disabled optgroup
  48689. !option.disabled &&
  48690. ( !option.parentNode.disabled ||
  48691. !nodeName( option.parentNode, "optgroup" ) ) ) {
  48692. // Get the specific value for the option
  48693. value = jQuery( option ).val();
  48694. // We don't need an array for one selects
  48695. if ( one ) {
  48696. return value;
  48697. }
  48698. // Multi-Selects return an array
  48699. values.push( value );
  48700. }
  48701. }
  48702. return values;
  48703. },
  48704. set: function( elem, value ) {
  48705. var optionSet, option,
  48706. options = elem.options,
  48707. values = jQuery.makeArray( value ),
  48708. i = options.length;
  48709. while ( i-- ) {
  48710. option = options[ i ];
  48711. /* eslint-disable no-cond-assign */
  48712. if ( option.selected =
  48713. jQuery.inArray( jQuery.valHooks.option.get( option ), values ) > -1
  48714. ) {
  48715. optionSet = true;
  48716. }
  48717. /* eslint-enable no-cond-assign */
  48718. }
  48719. // Force browsers to behave consistently when non-matching value is set
  48720. if ( !optionSet ) {
  48721. elem.selectedIndex = -1;
  48722. }
  48723. return values;
  48724. }
  48725. }
  48726. }
  48727. } );
  48728. // Radios and checkboxes getter/setter
  48729. jQuery.each( [ "radio", "checkbox" ], function() {
  48730. jQuery.valHooks[ this ] = {
  48731. set: function( elem, value ) {
  48732. if ( Array.isArray( value ) ) {
  48733. return ( elem.checked = jQuery.inArray( jQuery( elem ).val(), value ) > -1 );
  48734. }
  48735. }
  48736. };
  48737. if ( !support.checkOn ) {
  48738. jQuery.valHooks[ this ].get = function( elem ) {
  48739. return elem.getAttribute( "value" ) === null ? "on" : elem.value;
  48740. };
  48741. }
  48742. } );
  48743. // Return jQuery for attributes-only inclusion
  48744. support.focusin = "onfocusin" in window;
  48745. var rfocusMorph = /^(?:focusinfocus|focusoutblur)$/,
  48746. stopPropagationCallback = function( e ) {
  48747. e.stopPropagation();
  48748. };
  48749. jQuery.extend( jQuery.event, {
  48750. trigger: function( event, data, elem, onlyHandlers ) {
  48751. var i, cur, tmp, bubbleType, ontype, handle, special, lastElement,
  48752. eventPath = [ elem || document ],
  48753. type = hasOwn.call( event, "type" ) ? event.type : event,
  48754. namespaces = hasOwn.call( event, "namespace" ) ? event.namespace.split( "." ) : [];
  48755. cur = lastElement = tmp = elem = elem || document;
  48756. // Don't do events on text and comment nodes
  48757. if ( elem.nodeType === 3 || elem.nodeType === 8 ) {
  48758. return;
  48759. }
  48760. // focus/blur morphs to focusin/out; ensure we're not firing them right now
  48761. if ( rfocusMorph.test( type + jQuery.event.triggered ) ) {
  48762. return;
  48763. }
  48764. if ( type.indexOf( "." ) > -1 ) {
  48765. // Namespaced trigger; create a regexp to match event type in handle()
  48766. namespaces = type.split( "." );
  48767. type = namespaces.shift();
  48768. namespaces.sort();
  48769. }
  48770. ontype = type.indexOf( ":" ) < 0 && "on" + type;
  48771. // Caller can pass in a jQuery.Event object, Object, or just an event type string
  48772. event = event[ jQuery.expando ] ?
  48773. event :
  48774. new jQuery.Event( type, typeof event === "object" && event );
  48775. // Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true)
  48776. event.isTrigger = onlyHandlers ? 2 : 3;
  48777. event.namespace = namespaces.join( "." );
  48778. event.rnamespace = event.namespace ?
  48779. new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" ) :
  48780. null;
  48781. // Clean up the event in case it is being reused
  48782. event.result = undefined;
  48783. if ( !event.target ) {
  48784. event.target = elem;
  48785. }
  48786. // Clone any incoming data and prepend the event, creating the handler arg list
  48787. data = data == null ?
  48788. [ event ] :
  48789. jQuery.makeArray( data, [ event ] );
  48790. // Allow special events to draw outside the lines
  48791. special = jQuery.event.special[ type ] || {};
  48792. if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) {
  48793. return;
  48794. }
  48795. // Determine event propagation path in advance, per W3C events spec (#9951)
  48796. // Bubble up to document, then to window; watch for a global ownerDocument var (#9724)
  48797. if ( !onlyHandlers && !special.noBubble && !isWindow( elem ) ) {
  48798. bubbleType = special.delegateType || type;
  48799. if ( !rfocusMorph.test( bubbleType + type ) ) {
  48800. cur = cur.parentNode;
  48801. }
  48802. for ( ; cur; cur = cur.parentNode ) {
  48803. eventPath.push( cur );
  48804. tmp = cur;
  48805. }
  48806. // Only add window if we got to document (e.g., not plain obj or detached DOM)
  48807. if ( tmp === ( elem.ownerDocument || document ) ) {
  48808. eventPath.push( tmp.defaultView || tmp.parentWindow || window );
  48809. }
  48810. }
  48811. // Fire handlers on the event path
  48812. i = 0;
  48813. while ( ( cur = eventPath[ i++ ] ) && !event.isPropagationStopped() ) {
  48814. lastElement = cur;
  48815. event.type = i > 1 ?
  48816. bubbleType :
  48817. special.bindType || type;
  48818. // jQuery handler
  48819. handle = ( dataPriv.get( cur, "events" ) || {} )[ event.type ] &&
  48820. dataPriv.get( cur, "handle" );
  48821. if ( handle ) {
  48822. handle.apply( cur, data );
  48823. }
  48824. // Native handler
  48825. handle = ontype && cur[ ontype ];
  48826. if ( handle && handle.apply && acceptData( cur ) ) {
  48827. event.result = handle.apply( cur, data );
  48828. if ( event.result === false ) {
  48829. event.preventDefault();
  48830. }
  48831. }
  48832. }
  48833. event.type = type;
  48834. // If nobody prevented the default action, do it now
  48835. if ( !onlyHandlers && !event.isDefaultPrevented() ) {
  48836. if ( ( !special._default ||
  48837. special._default.apply( eventPath.pop(), data ) === false ) &&
  48838. acceptData( elem ) ) {
  48839. // Call a native DOM method on the target with the same name as the event.
  48840. // Don't do default actions on window, that's where global variables be (#6170)
  48841. if ( ontype && isFunction( elem[ type ] ) && !isWindow( elem ) ) {
  48842. // Don't re-trigger an onFOO event when we call its FOO() method
  48843. tmp = elem[ ontype ];
  48844. if ( tmp ) {
  48845. elem[ ontype ] = null;
  48846. }
  48847. // Prevent re-triggering of the same event, since we already bubbled it above
  48848. jQuery.event.triggered = type;
  48849. if ( event.isPropagationStopped() ) {
  48850. lastElement.addEventListener( type, stopPropagationCallback );
  48851. }
  48852. elem[ type ]();
  48853. if ( event.isPropagationStopped() ) {
  48854. lastElement.removeEventListener( type, stopPropagationCallback );
  48855. }
  48856. jQuery.event.triggered = undefined;
  48857. if ( tmp ) {
  48858. elem[ ontype ] = tmp;
  48859. }
  48860. }
  48861. }
  48862. }
  48863. return event.result;
  48864. },
  48865. // Piggyback on a donor event to simulate a different one
  48866. // Used only for `focus(in | out)` events
  48867. simulate: function( type, elem, event ) {
  48868. var e = jQuery.extend(
  48869. new jQuery.Event(),
  48870. event,
  48871. {
  48872. type: type,
  48873. isSimulated: true
  48874. }
  48875. );
  48876. jQuery.event.trigger( e, null, elem );
  48877. }
  48878. } );
  48879. jQuery.fn.extend( {
  48880. trigger: function( type, data ) {
  48881. return this.each( function() {
  48882. jQuery.event.trigger( type, data, this );
  48883. } );
  48884. },
  48885. triggerHandler: function( type, data ) {
  48886. var elem = this[ 0 ];
  48887. if ( elem ) {
  48888. return jQuery.event.trigger( type, data, elem, true );
  48889. }
  48890. }
  48891. } );
  48892. // Support: Firefox <=44
  48893. // Firefox doesn't have focus(in | out) events
  48894. // Related ticket - https://bugzilla.mozilla.org/show_bug.cgi?id=687787
  48895. //
  48896. // Support: Chrome <=48 - 49, Safari <=9.0 - 9.1
  48897. // focus(in | out) events fire after focus & blur events,
  48898. // which is spec violation - http://www.w3.org/TR/DOM-Level-3-Events/#events-focusevent-event-order
  48899. // Related ticket - https://bugs.chromium.org/p/chromium/issues/detail?id=449857
  48900. if ( !support.focusin ) {
  48901. jQuery.each( { focus: "focusin", blur: "focusout" }, function( orig, fix ) {
  48902. // Attach a single capturing handler on the document while someone wants focusin/focusout
  48903. var handler = function( event ) {
  48904. jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ) );
  48905. };
  48906. jQuery.event.special[ fix ] = {
  48907. setup: function() {
  48908. var doc = this.ownerDocument || this,
  48909. attaches = dataPriv.access( doc, fix );
  48910. if ( !attaches ) {
  48911. doc.addEventListener( orig, handler, true );
  48912. }
  48913. dataPriv.access( doc, fix, ( attaches || 0 ) + 1 );
  48914. },
  48915. teardown: function() {
  48916. var doc = this.ownerDocument || this,
  48917. attaches = dataPriv.access( doc, fix ) - 1;
  48918. if ( !attaches ) {
  48919. doc.removeEventListener( orig, handler, true );
  48920. dataPriv.remove( doc, fix );
  48921. } else {
  48922. dataPriv.access( doc, fix, attaches );
  48923. }
  48924. }
  48925. };
  48926. } );
  48927. }
  48928. var location = window.location;
  48929. var nonce = Date.now();
  48930. var rquery = ( /\?/ );
  48931. // Cross-browser xml parsing
  48932. jQuery.parseXML = function( data ) {
  48933. var xml;
  48934. if ( !data || typeof data !== "string" ) {
  48935. return null;
  48936. }
  48937. // Support: IE 9 - 11 only
  48938. // IE throws on parseFromString with invalid input.
  48939. try {
  48940. xml = ( new window.DOMParser() ).parseFromString( data, "text/xml" );
  48941. } catch ( e ) {
  48942. xml = undefined;
  48943. }
  48944. if ( !xml || xml.getElementsByTagName( "parsererror" ).length ) {
  48945. jQuery.error( "Invalid XML: " + data );
  48946. }
  48947. return xml;
  48948. };
  48949. var
  48950. rbracket = /\[\]$/,
  48951. rCRLF = /\r?\n/g,
  48952. rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i,
  48953. rsubmittable = /^(?:input|select|textarea|keygen)/i;
  48954. function buildParams( prefix, obj, traditional, add ) {
  48955. var name;
  48956. if ( Array.isArray( obj ) ) {
  48957. // Serialize array item.
  48958. jQuery.each( obj, function( i, v ) {
  48959. if ( traditional || rbracket.test( prefix ) ) {
  48960. // Treat each array item as a scalar.
  48961. add( prefix, v );
  48962. } else {
  48963. // Item is non-scalar (array or object), encode its numeric index.
  48964. buildParams(
  48965. prefix + "[" + ( typeof v === "object" && v != null ? i : "" ) + "]",
  48966. v,
  48967. traditional,
  48968. add
  48969. );
  48970. }
  48971. } );
  48972. } else if ( !traditional && toType( obj ) === "object" ) {
  48973. // Serialize object item.
  48974. for ( name in obj ) {
  48975. buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add );
  48976. }
  48977. } else {
  48978. // Serialize scalar item.
  48979. add( prefix, obj );
  48980. }
  48981. }
  48982. // Serialize an array of form elements or a set of
  48983. // key/values into a query string
  48984. jQuery.param = function( a, traditional ) {
  48985. var prefix,
  48986. s = [],
  48987. add = function( key, valueOrFunction ) {
  48988. // If value is a function, invoke it and use its return value
  48989. var value = isFunction( valueOrFunction ) ?
  48990. valueOrFunction() :
  48991. valueOrFunction;
  48992. s[ s.length ] = encodeURIComponent( key ) + "=" +
  48993. encodeURIComponent( value == null ? "" : value );
  48994. };
  48995. // If an array was passed in, assume that it is an array of form elements.
  48996. if ( Array.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) {
  48997. // Serialize the form elements
  48998. jQuery.each( a, function() {
  48999. add( this.name, this.value );
  49000. } );
  49001. } else {
  49002. // If traditional, encode the "old" way (the way 1.3.2 or older
  49003. // did it), otherwise encode params recursively.
  49004. for ( prefix in a ) {
  49005. buildParams( prefix, a[ prefix ], traditional, add );
  49006. }
  49007. }
  49008. // Return the resulting serialization
  49009. return s.join( "&" );
  49010. };
  49011. jQuery.fn.extend( {
  49012. serialize: function() {
  49013. return jQuery.param( this.serializeArray() );
  49014. },
  49015. serializeArray: function() {
  49016. return this.map( function() {
  49017. // Can add propHook for "elements" to filter or add form elements
  49018. var elements = jQuery.prop( this, "elements" );
  49019. return elements ? jQuery.makeArray( elements ) : this;
  49020. } )
  49021. .filter( function() {
  49022. var type = this.type;
  49023. // Use .is( ":disabled" ) so that fieldset[disabled] works
  49024. return this.name && !jQuery( this ).is( ":disabled" ) &&
  49025. rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) &&
  49026. ( this.checked || !rcheckableType.test( type ) );
  49027. } )
  49028. .map( function( i, elem ) {
  49029. var val = jQuery( this ).val();
  49030. if ( val == null ) {
  49031. return null;
  49032. }
  49033. if ( Array.isArray( val ) ) {
  49034. return jQuery.map( val, function( val ) {
  49035. return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
  49036. } );
  49037. }
  49038. return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
  49039. } ).get();
  49040. }
  49041. } );
  49042. var
  49043. r20 = /%20/g,
  49044. rhash = /#.*$/,
  49045. rantiCache = /([?&])_=[^&]*/,
  49046. rheaders = /^(.*?):[ \t]*([^\r\n]*)$/mg,
  49047. // #7653, #8125, #8152: local protocol detection
  49048. rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/,
  49049. rnoContent = /^(?:GET|HEAD)$/,
  49050. rprotocol = /^\/\//,
  49051. /* Prefilters
  49052. * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example)
  49053. * 2) These are called:
  49054. * - BEFORE asking for a transport
  49055. * - AFTER param serialization (s.data is a string if s.processData is true)
  49056. * 3) key is the dataType
  49057. * 4) the catchall symbol "*" can be used
  49058. * 5) execution will start with transport dataType and THEN continue down to "*" if needed
  49059. */
  49060. prefilters = {},
  49061. /* Transports bindings
  49062. * 1) key is the dataType
  49063. * 2) the catchall symbol "*" can be used
  49064. * 3) selection will start with transport dataType and THEN go to "*" if needed
  49065. */
  49066. transports = {},
  49067. // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression
  49068. allTypes = "*/".concat( "*" ),
  49069. // Anchor tag for parsing the document origin
  49070. originAnchor = document.createElement( "a" );
  49071. originAnchor.href = location.href;
  49072. // Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport
  49073. function addToPrefiltersOrTransports( structure ) {
  49074. // dataTypeExpression is optional and defaults to "*"
  49075. return function( dataTypeExpression, func ) {
  49076. if ( typeof dataTypeExpression !== "string" ) {
  49077. func = dataTypeExpression;
  49078. dataTypeExpression = "*";
  49079. }
  49080. var dataType,
  49081. i = 0,
  49082. dataTypes = dataTypeExpression.toLowerCase().match( rnothtmlwhite ) || [];
  49083. if ( isFunction( func ) ) {
  49084. // For each dataType in the dataTypeExpression
  49085. while ( ( dataType = dataTypes[ i++ ] ) ) {
  49086. // Prepend if requested
  49087. if ( dataType[ 0 ] === "+" ) {
  49088. dataType = dataType.slice( 1 ) || "*";
  49089. ( structure[ dataType ] = structure[ dataType ] || [] ).unshift( func );
  49090. // Otherwise append
  49091. } else {
  49092. ( structure[ dataType ] = structure[ dataType ] || [] ).push( func );
  49093. }
  49094. }
  49095. }
  49096. };
  49097. }
  49098. // Base inspection function for prefilters and transports
  49099. function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) {
  49100. var inspected = {},
  49101. seekingTransport = ( structure === transports );
  49102. function inspect( dataType ) {
  49103. var selected;
  49104. inspected[ dataType ] = true;
  49105. jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) {
  49106. var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR );
  49107. if ( typeof dataTypeOrTransport === "string" &&
  49108. !seekingTransport && !inspected[ dataTypeOrTransport ] ) {
  49109. options.dataTypes.unshift( dataTypeOrTransport );
  49110. inspect( dataTypeOrTransport );
  49111. return false;
  49112. } else if ( seekingTransport ) {
  49113. return !( selected = dataTypeOrTransport );
  49114. }
  49115. } );
  49116. return selected;
  49117. }
  49118. return inspect( options.dataTypes[ 0 ] ) || !inspected[ "*" ] && inspect( "*" );
  49119. }
  49120. // A special extend for ajax options
  49121. // that takes "flat" options (not to be deep extended)
  49122. // Fixes #9887
  49123. function ajaxExtend( target, src ) {
  49124. var key, deep,
  49125. flatOptions = jQuery.ajaxSettings.flatOptions || {};
  49126. for ( key in src ) {
  49127. if ( src[ key ] !== undefined ) {
  49128. ( flatOptions[ key ] ? target : ( deep || ( deep = {} ) ) )[ key ] = src[ key ];
  49129. }
  49130. }
  49131. if ( deep ) {
  49132. jQuery.extend( true, target, deep );
  49133. }
  49134. return target;
  49135. }
  49136. /* Handles responses to an ajax request:
  49137. * - finds the right dataType (mediates between content-type and expected dataType)
  49138. * - returns the corresponding response
  49139. */
  49140. function ajaxHandleResponses( s, jqXHR, responses ) {
  49141. var ct, type, finalDataType, firstDataType,
  49142. contents = s.contents,
  49143. dataTypes = s.dataTypes;
  49144. // Remove auto dataType and get content-type in the process
  49145. while ( dataTypes[ 0 ] === "*" ) {
  49146. dataTypes.shift();
  49147. if ( ct === undefined ) {
  49148. ct = s.mimeType || jqXHR.getResponseHeader( "Content-Type" );
  49149. }
  49150. }
  49151. // Check if we're dealing with a known content-type
  49152. if ( ct ) {
  49153. for ( type in contents ) {
  49154. if ( contents[ type ] && contents[ type ].test( ct ) ) {
  49155. dataTypes.unshift( type );
  49156. break;
  49157. }
  49158. }
  49159. }
  49160. // Check to see if we have a response for the expected dataType
  49161. if ( dataTypes[ 0 ] in responses ) {
  49162. finalDataType = dataTypes[ 0 ];
  49163. } else {
  49164. // Try convertible dataTypes
  49165. for ( type in responses ) {
  49166. if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[ 0 ] ] ) {
  49167. finalDataType = type;
  49168. break;
  49169. }
  49170. if ( !firstDataType ) {
  49171. firstDataType = type;
  49172. }
  49173. }
  49174. // Or just use first one
  49175. finalDataType = finalDataType || firstDataType;
  49176. }
  49177. // If we found a dataType
  49178. // We add the dataType to the list if needed
  49179. // and return the corresponding response
  49180. if ( finalDataType ) {
  49181. if ( finalDataType !== dataTypes[ 0 ] ) {
  49182. dataTypes.unshift( finalDataType );
  49183. }
  49184. return responses[ finalDataType ];
  49185. }
  49186. }
  49187. /* Chain conversions given the request and the original response
  49188. * Also sets the responseXXX fields on the jqXHR instance
  49189. */
  49190. function ajaxConvert( s, response, jqXHR, isSuccess ) {
  49191. var conv2, current, conv, tmp, prev,
  49192. converters = {},
  49193. // Work with a copy of dataTypes in case we need to modify it for conversion
  49194. dataTypes = s.dataTypes.slice();
  49195. // Create converters map with lowercased keys
  49196. if ( dataTypes[ 1 ] ) {
  49197. for ( conv in s.converters ) {
  49198. converters[ conv.toLowerCase() ] = s.converters[ conv ];
  49199. }
  49200. }
  49201. current = dataTypes.shift();
  49202. // Convert to each sequential dataType
  49203. while ( current ) {
  49204. if ( s.responseFields[ current ] ) {
  49205. jqXHR[ s.responseFields[ current ] ] = response;
  49206. }
  49207. // Apply the dataFilter if provided
  49208. if ( !prev && isSuccess && s.dataFilter ) {
  49209. response = s.dataFilter( response, s.dataType );
  49210. }
  49211. prev = current;
  49212. current = dataTypes.shift();
  49213. if ( current ) {
  49214. // There's only work to do if current dataType is non-auto
  49215. if ( current === "*" ) {
  49216. current = prev;
  49217. // Convert response if prev dataType is non-auto and differs from current
  49218. } else if ( prev !== "*" && prev !== current ) {
  49219. // Seek a direct converter
  49220. conv = converters[ prev + " " + current ] || converters[ "* " + current ];
  49221. // If none found, seek a pair
  49222. if ( !conv ) {
  49223. for ( conv2 in converters ) {
  49224. // If conv2 outputs current
  49225. tmp = conv2.split( " " );
  49226. if ( tmp[ 1 ] === current ) {
  49227. // If prev can be converted to accepted input
  49228. conv = converters[ prev + " " + tmp[ 0 ] ] ||
  49229. converters[ "* " + tmp[ 0 ] ];
  49230. if ( conv ) {
  49231. // Condense equivalence converters
  49232. if ( conv === true ) {
  49233. conv = converters[ conv2 ];
  49234. // Otherwise, insert the intermediate dataType
  49235. } else if ( converters[ conv2 ] !== true ) {
  49236. current = tmp[ 0 ];
  49237. dataTypes.unshift( tmp[ 1 ] );
  49238. }
  49239. break;
  49240. }
  49241. }
  49242. }
  49243. }
  49244. // Apply converter (if not an equivalence)
  49245. if ( conv !== true ) {
  49246. // Unless errors are allowed to bubble, catch and return them
  49247. if ( conv && s.throws ) {
  49248. response = conv( response );
  49249. } else {
  49250. try {
  49251. response = conv( response );
  49252. } catch ( e ) {
  49253. return {
  49254. state: "parsererror",
  49255. error: conv ? e : "No conversion from " + prev + " to " + current
  49256. };
  49257. }
  49258. }
  49259. }
  49260. }
  49261. }
  49262. }
  49263. return { state: "success", data: response };
  49264. }
  49265. jQuery.extend( {
  49266. // Counter for holding the number of active queries
  49267. active: 0,
  49268. // Last-Modified header cache for next request
  49269. lastModified: {},
  49270. etag: {},
  49271. ajaxSettings: {
  49272. url: location.href,
  49273. type: "GET",
  49274. isLocal: rlocalProtocol.test( location.protocol ),
  49275. global: true,
  49276. processData: true,
  49277. async: true,
  49278. contentType: "application/x-www-form-urlencoded; charset=UTF-8",
  49279. /*
  49280. timeout: 0,
  49281. data: null,
  49282. dataType: null,
  49283. username: null,
  49284. password: null,
  49285. cache: null,
  49286. throws: false,
  49287. traditional: false,
  49288. headers: {},
  49289. */
  49290. accepts: {
  49291. "*": allTypes,
  49292. text: "text/plain",
  49293. html: "text/html",
  49294. xml: "application/xml, text/xml",
  49295. json: "application/json, text/javascript"
  49296. },
  49297. contents: {
  49298. xml: /\bxml\b/,
  49299. html: /\bhtml/,
  49300. json: /\bjson\b/
  49301. },
  49302. responseFields: {
  49303. xml: "responseXML",
  49304. text: "responseText",
  49305. json: "responseJSON"
  49306. },
  49307. // Data converters
  49308. // Keys separate source (or catchall "*") and destination types with a single space
  49309. converters: {
  49310. // Convert anything to text
  49311. "* text": String,
  49312. // Text to html (true = no transformation)
  49313. "text html": true,
  49314. // Evaluate text as a json expression
  49315. "text json": JSON.parse,
  49316. // Parse text as xml
  49317. "text xml": jQuery.parseXML
  49318. },
  49319. // For options that shouldn't be deep extended:
  49320. // you can add your own custom options here if
  49321. // and when you create one that shouldn't be
  49322. // deep extended (see ajaxExtend)
  49323. flatOptions: {
  49324. url: true,
  49325. context: true
  49326. }
  49327. },
  49328. // Creates a full fledged settings object into target
  49329. // with both ajaxSettings and settings fields.
  49330. // If target is omitted, writes into ajaxSettings.
  49331. ajaxSetup: function( target, settings ) {
  49332. return settings ?
  49333. // Building a settings object
  49334. ajaxExtend( ajaxExtend( target, jQuery.ajaxSettings ), settings ) :
  49335. // Extending ajaxSettings
  49336. ajaxExtend( jQuery.ajaxSettings, target );
  49337. },
  49338. ajaxPrefilter: addToPrefiltersOrTransports( prefilters ),
  49339. ajaxTransport: addToPrefiltersOrTransports( transports ),
  49340. // Main method
  49341. ajax: function( url, options ) {
  49342. // If url is an object, simulate pre-1.5 signature
  49343. if ( typeof url === "object" ) {
  49344. options = url;
  49345. url = undefined;
  49346. }
  49347. // Force options to be an object
  49348. options = options || {};
  49349. var transport,
  49350. // URL without anti-cache param
  49351. cacheURL,
  49352. // Response headers
  49353. responseHeadersString,
  49354. responseHeaders,
  49355. // timeout handle
  49356. timeoutTimer,
  49357. // Url cleanup var
  49358. urlAnchor,
  49359. // Request state (becomes false upon send and true upon completion)
  49360. completed,
  49361. // To know if global events are to be dispatched
  49362. fireGlobals,
  49363. // Loop variable
  49364. i,
  49365. // uncached part of the url
  49366. uncached,
  49367. // Create the final options object
  49368. s = jQuery.ajaxSetup( {}, options ),
  49369. // Callbacks context
  49370. callbackContext = s.context || s,
  49371. // Context for global events is callbackContext if it is a DOM node or jQuery collection
  49372. globalEventContext = s.context &&
  49373. ( callbackContext.nodeType || callbackContext.jquery ) ?
  49374. jQuery( callbackContext ) :
  49375. jQuery.event,
  49376. // Deferreds
  49377. deferred = jQuery.Deferred(),
  49378. completeDeferred = jQuery.Callbacks( "once memory" ),
  49379. // Status-dependent callbacks
  49380. statusCode = s.statusCode || {},
  49381. // Headers (they are sent all at once)
  49382. requestHeaders = {},
  49383. requestHeadersNames = {},
  49384. // Default abort message
  49385. strAbort = "canceled",
  49386. // Fake xhr
  49387. jqXHR = {
  49388. readyState: 0,
  49389. // Builds headers hashtable if needed
  49390. getResponseHeader: function( key ) {
  49391. var match;
  49392. if ( completed ) {
  49393. if ( !responseHeaders ) {
  49394. responseHeaders = {};
  49395. while ( ( match = rheaders.exec( responseHeadersString ) ) ) {
  49396. responseHeaders[ match[ 1 ].toLowerCase() ] = match[ 2 ];
  49397. }
  49398. }
  49399. match = responseHeaders[ key.toLowerCase() ];
  49400. }
  49401. return match == null ? null : match;
  49402. },
  49403. // Raw string
  49404. getAllResponseHeaders: function() {
  49405. return completed ? responseHeadersString : null;
  49406. },
  49407. // Caches the header
  49408. setRequestHeader: function( name, value ) {
  49409. if ( completed == null ) {
  49410. name = requestHeadersNames[ name.toLowerCase() ] =
  49411. requestHeadersNames[ name.toLowerCase() ] || name;
  49412. requestHeaders[ name ] = value;
  49413. }
  49414. return this;
  49415. },
  49416. // Overrides response content-type header
  49417. overrideMimeType: function( type ) {
  49418. if ( completed == null ) {
  49419. s.mimeType = type;
  49420. }
  49421. return this;
  49422. },
  49423. // Status-dependent callbacks
  49424. statusCode: function( map ) {
  49425. var code;
  49426. if ( map ) {
  49427. if ( completed ) {
  49428. // Execute the appropriate callbacks
  49429. jqXHR.always( map[ jqXHR.status ] );
  49430. } else {
  49431. // Lazy-add the new callbacks in a way that preserves old ones
  49432. for ( code in map ) {
  49433. statusCode[ code ] = [ statusCode[ code ], map[ code ] ];
  49434. }
  49435. }
  49436. }
  49437. return this;
  49438. },
  49439. // Cancel the request
  49440. abort: function( statusText ) {
  49441. var finalText = statusText || strAbort;
  49442. if ( transport ) {
  49443. transport.abort( finalText );
  49444. }
  49445. done( 0, finalText );
  49446. return this;
  49447. }
  49448. };
  49449. // Attach deferreds
  49450. deferred.promise( jqXHR );
  49451. // Add protocol if not provided (prefilters might expect it)
  49452. // Handle falsy url in the settings object (#10093: consistency with old signature)
  49453. // We also use the url parameter if available
  49454. s.url = ( ( url || s.url || location.href ) + "" )
  49455. .replace( rprotocol, location.protocol + "//" );
  49456. // Alias method option to type as per ticket #12004
  49457. s.type = options.method || options.type || s.method || s.type;
  49458. // Extract dataTypes list
  49459. s.dataTypes = ( s.dataType || "*" ).toLowerCase().match( rnothtmlwhite ) || [ "" ];
  49460. // A cross-domain request is in order when the origin doesn't match the current origin.
  49461. if ( s.crossDomain == null ) {
  49462. urlAnchor = document.createElement( "a" );
  49463. // Support: IE <=8 - 11, Edge 12 - 15
  49464. // IE throws exception on accessing the href property if url is malformed,
  49465. // e.g. http://example.com:80x/
  49466. try {
  49467. urlAnchor.href = s.url;
  49468. // Support: IE <=8 - 11 only
  49469. // Anchor's host property isn't correctly set when s.url is relative
  49470. urlAnchor.href = urlAnchor.href;
  49471. s.crossDomain = originAnchor.protocol + "//" + originAnchor.host !==
  49472. urlAnchor.protocol + "//" + urlAnchor.host;
  49473. } catch ( e ) {
  49474. // If there is an error parsing the URL, assume it is crossDomain,
  49475. // it can be rejected by the transport if it is invalid
  49476. s.crossDomain = true;
  49477. }
  49478. }
  49479. // Convert data if not already a string
  49480. if ( s.data && s.processData && typeof s.data !== "string" ) {
  49481. s.data = jQuery.param( s.data, s.traditional );
  49482. }
  49483. // Apply prefilters
  49484. inspectPrefiltersOrTransports( prefilters, s, options, jqXHR );
  49485. // If request was aborted inside a prefilter, stop there
  49486. if ( completed ) {
  49487. return jqXHR;
  49488. }
  49489. // We can fire global events as of now if asked to
  49490. // Don't fire events if jQuery.event is undefined in an AMD-usage scenario (#15118)
  49491. fireGlobals = jQuery.event && s.global;
  49492. // Watch for a new set of requests
  49493. if ( fireGlobals && jQuery.active++ === 0 ) {
  49494. jQuery.event.trigger( "ajaxStart" );
  49495. }
  49496. // Uppercase the type
  49497. s.type = s.type.toUpperCase();
  49498. // Determine if request has content
  49499. s.hasContent = !rnoContent.test( s.type );
  49500. // Save the URL in case we're toying with the If-Modified-Since
  49501. // and/or If-None-Match header later on
  49502. // Remove hash to simplify url manipulation
  49503. cacheURL = s.url.replace( rhash, "" );
  49504. // More options handling for requests with no content
  49505. if ( !s.hasContent ) {
  49506. // Remember the hash so we can put it back
  49507. uncached = s.url.slice( cacheURL.length );
  49508. // If data is available and should be processed, append data to url
  49509. if ( s.data && ( s.processData || typeof s.data === "string" ) ) {
  49510. cacheURL += ( rquery.test( cacheURL ) ? "&" : "?" ) + s.data;
  49511. // #9682: remove data so that it's not used in an eventual retry
  49512. delete s.data;
  49513. }
  49514. // Add or update anti-cache param if needed
  49515. if ( s.cache === false ) {
  49516. cacheURL = cacheURL.replace( rantiCache, "$1" );
  49517. uncached = ( rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + ( nonce++ ) + uncached;
  49518. }
  49519. // Put hash and anti-cache on the URL that will be requested (gh-1732)
  49520. s.url = cacheURL + uncached;
  49521. // Change '%20' to '+' if this is encoded form body content (gh-2658)
  49522. } else if ( s.data && s.processData &&
  49523. ( s.contentType || "" ).indexOf( "application/x-www-form-urlencoded" ) === 0 ) {
  49524. s.data = s.data.replace( r20, "+" );
  49525. }
  49526. // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
  49527. if ( s.ifModified ) {
  49528. if ( jQuery.lastModified[ cacheURL ] ) {
  49529. jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ cacheURL ] );
  49530. }
  49531. if ( jQuery.etag[ cacheURL ] ) {
  49532. jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ cacheURL ] );
  49533. }
  49534. }
  49535. // Set the correct header, if data is being sent
  49536. if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) {
  49537. jqXHR.setRequestHeader( "Content-Type", s.contentType );
  49538. }
  49539. // Set the Accepts header for the server, depending on the dataType
  49540. jqXHR.setRequestHeader(
  49541. "Accept",
  49542. s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[ 0 ] ] ?
  49543. s.accepts[ s.dataTypes[ 0 ] ] +
  49544. ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) :
  49545. s.accepts[ "*" ]
  49546. );
  49547. // Check for headers option
  49548. for ( i in s.headers ) {
  49549. jqXHR.setRequestHeader( i, s.headers[ i ] );
  49550. }
  49551. // Allow custom headers/mimetypes and early abort
  49552. if ( s.beforeSend &&
  49553. ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || completed ) ) {
  49554. // Abort if not done already and return
  49555. return jqXHR.abort();
  49556. }
  49557. // Aborting is no longer a cancellation
  49558. strAbort = "abort";
  49559. // Install callbacks on deferreds
  49560. completeDeferred.add( s.complete );
  49561. jqXHR.done( s.success );
  49562. jqXHR.fail( s.error );
  49563. // Get transport
  49564. transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR );
  49565. // If no transport, we auto-abort
  49566. if ( !transport ) {
  49567. done( -1, "No Transport" );
  49568. } else {
  49569. jqXHR.readyState = 1;
  49570. // Send global event
  49571. if ( fireGlobals ) {
  49572. globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] );
  49573. }
  49574. // If request was aborted inside ajaxSend, stop there
  49575. if ( completed ) {
  49576. return jqXHR;
  49577. }
  49578. // Timeout
  49579. if ( s.async && s.timeout > 0 ) {
  49580. timeoutTimer = window.setTimeout( function() {
  49581. jqXHR.abort( "timeout" );
  49582. }, s.timeout );
  49583. }
  49584. try {
  49585. completed = false;
  49586. transport.send( requestHeaders, done );
  49587. } catch ( e ) {
  49588. // Rethrow post-completion exceptions
  49589. if ( completed ) {
  49590. throw e;
  49591. }
  49592. // Propagate others as results
  49593. done( -1, e );
  49594. }
  49595. }
  49596. // Callback for when everything is done
  49597. function done( status, nativeStatusText, responses, headers ) {
  49598. var isSuccess, success, error, response, modified,
  49599. statusText = nativeStatusText;
  49600. // Ignore repeat invocations
  49601. if ( completed ) {
  49602. return;
  49603. }
  49604. completed = true;
  49605. // Clear timeout if it exists
  49606. if ( timeoutTimer ) {
  49607. window.clearTimeout( timeoutTimer );
  49608. }
  49609. // Dereference transport for early garbage collection
  49610. // (no matter how long the jqXHR object will be used)
  49611. transport = undefined;
  49612. // Cache response headers
  49613. responseHeadersString = headers || "";
  49614. // Set readyState
  49615. jqXHR.readyState = status > 0 ? 4 : 0;
  49616. // Determine if successful
  49617. isSuccess = status >= 200 && status < 300 || status === 304;
  49618. // Get response data
  49619. if ( responses ) {
  49620. response = ajaxHandleResponses( s, jqXHR, responses );
  49621. }
  49622. // Convert no matter what (that way responseXXX fields are always set)
  49623. response = ajaxConvert( s, response, jqXHR, isSuccess );
  49624. // If successful, handle type chaining
  49625. if ( isSuccess ) {
  49626. // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
  49627. if ( s.ifModified ) {
  49628. modified = jqXHR.getResponseHeader( "Last-Modified" );
  49629. if ( modified ) {
  49630. jQuery.lastModified[ cacheURL ] = modified;
  49631. }
  49632. modified = jqXHR.getResponseHeader( "etag" );
  49633. if ( modified ) {
  49634. jQuery.etag[ cacheURL ] = modified;
  49635. }
  49636. }
  49637. // if no content
  49638. if ( status === 204 || s.type === "HEAD" ) {
  49639. statusText = "nocontent";
  49640. // if not modified
  49641. } else if ( status === 304 ) {
  49642. statusText = "notmodified";
  49643. // If we have data, let's convert it
  49644. } else {
  49645. statusText = response.state;
  49646. success = response.data;
  49647. error = response.error;
  49648. isSuccess = !error;
  49649. }
  49650. } else {
  49651. // Extract error from statusText and normalize for non-aborts
  49652. error = statusText;
  49653. if ( status || !statusText ) {
  49654. statusText = "error";
  49655. if ( status < 0 ) {
  49656. status = 0;
  49657. }
  49658. }
  49659. }
  49660. // Set data for the fake xhr object
  49661. jqXHR.status = status;
  49662. jqXHR.statusText = ( nativeStatusText || statusText ) + "";
  49663. // Success/Error
  49664. if ( isSuccess ) {
  49665. deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] );
  49666. } else {
  49667. deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] );
  49668. }
  49669. // Status-dependent callbacks
  49670. jqXHR.statusCode( statusCode );
  49671. statusCode = undefined;
  49672. if ( fireGlobals ) {
  49673. globalEventContext.trigger( isSuccess ? "ajaxSuccess" : "ajaxError",
  49674. [ jqXHR, s, isSuccess ? success : error ] );
  49675. }
  49676. // Complete
  49677. completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] );
  49678. if ( fireGlobals ) {
  49679. globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] );
  49680. // Handle the global AJAX counter
  49681. if ( !( --jQuery.active ) ) {
  49682. jQuery.event.trigger( "ajaxStop" );
  49683. }
  49684. }
  49685. }
  49686. return jqXHR;
  49687. },
  49688. getJSON: function( url, data, callback ) {
  49689. return jQuery.get( url, data, callback, "json" );
  49690. },
  49691. getScript: function( url, callback ) {
  49692. return jQuery.get( url, undefined, callback, "script" );
  49693. }
  49694. } );
  49695. jQuery.each( [ "get", "post" ], function( i, method ) {
  49696. jQuery[ method ] = function( url, data, callback, type ) {
  49697. // Shift arguments if data argument was omitted
  49698. if ( isFunction( data ) ) {
  49699. type = type || callback;
  49700. callback = data;
  49701. data = undefined;
  49702. }
  49703. // The url can be an options object (which then must have .url)
  49704. return jQuery.ajax( jQuery.extend( {
  49705. url: url,
  49706. type: method,
  49707. dataType: type,
  49708. data: data,
  49709. success: callback
  49710. }, jQuery.isPlainObject( url ) && url ) );
  49711. };
  49712. } );
  49713. jQuery._evalUrl = function( url ) {
  49714. return jQuery.ajax( {
  49715. url: url,
  49716. // Make this explicit, since user can override this through ajaxSetup (#11264)
  49717. type: "GET",
  49718. dataType: "script",
  49719. cache: true,
  49720. async: false,
  49721. global: false,
  49722. "throws": true
  49723. } );
  49724. };
  49725. jQuery.fn.extend( {
  49726. wrapAll: function( html ) {
  49727. var wrap;
  49728. if ( this[ 0 ] ) {
  49729. if ( isFunction( html ) ) {
  49730. html = html.call( this[ 0 ] );
  49731. }
  49732. // The elements to wrap the target around
  49733. wrap = jQuery( html, this[ 0 ].ownerDocument ).eq( 0 ).clone( true );
  49734. if ( this[ 0 ].parentNode ) {
  49735. wrap.insertBefore( this[ 0 ] );
  49736. }
  49737. wrap.map( function() {
  49738. var elem = this;
  49739. while ( elem.firstElementChild ) {
  49740. elem = elem.firstElementChild;
  49741. }
  49742. return elem;
  49743. } ).append( this );
  49744. }
  49745. return this;
  49746. },
  49747. wrapInner: function( html ) {
  49748. if ( isFunction( html ) ) {
  49749. return this.each( function( i ) {
  49750. jQuery( this ).wrapInner( html.call( this, i ) );
  49751. } );
  49752. }
  49753. return this.each( function() {
  49754. var self = jQuery( this ),
  49755. contents = self.contents();
  49756. if ( contents.length ) {
  49757. contents.wrapAll( html );
  49758. } else {
  49759. self.append( html );
  49760. }
  49761. } );
  49762. },
  49763. wrap: function( html ) {
  49764. var htmlIsFunction = isFunction( html );
  49765. return this.each( function( i ) {
  49766. jQuery( this ).wrapAll( htmlIsFunction ? html.call( this, i ) : html );
  49767. } );
  49768. },
  49769. unwrap: function( selector ) {
  49770. this.parent( selector ).not( "body" ).each( function() {
  49771. jQuery( this ).replaceWith( this.childNodes );
  49772. } );
  49773. return this;
  49774. }
  49775. } );
  49776. jQuery.expr.pseudos.hidden = function( elem ) {
  49777. return !jQuery.expr.pseudos.visible( elem );
  49778. };
  49779. jQuery.expr.pseudos.visible = function( elem ) {
  49780. return !!( elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length );
  49781. };
  49782. jQuery.ajaxSettings.xhr = function() {
  49783. try {
  49784. return new window.XMLHttpRequest();
  49785. } catch ( e ) {}
  49786. };
  49787. var xhrSuccessStatus = {
  49788. // File protocol always yields status code 0, assume 200
  49789. 0: 200,
  49790. // Support: IE <=9 only
  49791. // #1450: sometimes IE returns 1223 when it should be 204
  49792. 1223: 204
  49793. },
  49794. xhrSupported = jQuery.ajaxSettings.xhr();
  49795. support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported );
  49796. support.ajax = xhrSupported = !!xhrSupported;
  49797. jQuery.ajaxTransport( function( options ) {
  49798. var callback, errorCallback;
  49799. // Cross domain only allowed if supported through XMLHttpRequest
  49800. if ( support.cors || xhrSupported && !options.crossDomain ) {
  49801. return {
  49802. send: function( headers, complete ) {
  49803. var i,
  49804. xhr = options.xhr();
  49805. xhr.open(
  49806. options.type,
  49807. options.url,
  49808. options.async,
  49809. options.username,
  49810. options.password
  49811. );
  49812. // Apply custom fields if provided
  49813. if ( options.xhrFields ) {
  49814. for ( i in options.xhrFields ) {
  49815. xhr[ i ] = options.xhrFields[ i ];
  49816. }
  49817. }
  49818. // Override mime type if needed
  49819. if ( options.mimeType && xhr.overrideMimeType ) {
  49820. xhr.overrideMimeType( options.mimeType );
  49821. }
  49822. // X-Requested-With header
  49823. // For cross-domain requests, seeing as conditions for a preflight are
  49824. // akin to a jigsaw puzzle, we simply never set it to be sure.
  49825. // (it can always be set on a per-request basis or even using ajaxSetup)
  49826. // For same-domain requests, won't change header if already provided.
  49827. if ( !options.crossDomain && !headers[ "X-Requested-With" ] ) {
  49828. headers[ "X-Requested-With" ] = "XMLHttpRequest";
  49829. }
  49830. // Set headers
  49831. for ( i in headers ) {
  49832. xhr.setRequestHeader( i, headers[ i ] );
  49833. }
  49834. // Callback
  49835. callback = function( type ) {
  49836. return function() {
  49837. if ( callback ) {
  49838. callback = errorCallback = xhr.onload =
  49839. xhr.onerror = xhr.onabort = xhr.ontimeout =
  49840. xhr.onreadystatechange = null;
  49841. if ( type === "abort" ) {
  49842. xhr.abort();
  49843. } else if ( type === "error" ) {
  49844. // Support: IE <=9 only
  49845. // On a manual native abort, IE9 throws
  49846. // errors on any property access that is not readyState
  49847. if ( typeof xhr.status !== "number" ) {
  49848. complete( 0, "error" );
  49849. } else {
  49850. complete(
  49851. // File: protocol always yields status 0; see #8605, #14207
  49852. xhr.status,
  49853. xhr.statusText
  49854. );
  49855. }
  49856. } else {
  49857. complete(
  49858. xhrSuccessStatus[ xhr.status ] || xhr.status,
  49859. xhr.statusText,
  49860. // Support: IE <=9 only
  49861. // IE9 has no XHR2 but throws on binary (trac-11426)
  49862. // For XHR2 non-text, let the caller handle it (gh-2498)
  49863. ( xhr.responseType || "text" ) !== "text" ||
  49864. typeof xhr.responseText !== "string" ?
  49865. { binary: xhr.response } :
  49866. { text: xhr.responseText },
  49867. xhr.getAllResponseHeaders()
  49868. );
  49869. }
  49870. }
  49871. };
  49872. };
  49873. // Listen to events
  49874. xhr.onload = callback();
  49875. errorCallback = xhr.onerror = xhr.ontimeout = callback( "error" );
  49876. // Support: IE 9 only
  49877. // Use onreadystatechange to replace onabort
  49878. // to handle uncaught aborts
  49879. if ( xhr.onabort !== undefined ) {
  49880. xhr.onabort = errorCallback;
  49881. } else {
  49882. xhr.onreadystatechange = function() {
  49883. // Check readyState before timeout as it changes
  49884. if ( xhr.readyState === 4 ) {
  49885. // Allow onerror to be called first,
  49886. // but that will not handle a native abort
  49887. // Also, save errorCallback to a variable
  49888. // as xhr.onerror cannot be accessed
  49889. window.setTimeout( function() {
  49890. if ( callback ) {
  49891. errorCallback();
  49892. }
  49893. } );
  49894. }
  49895. };
  49896. }
  49897. // Create the abort callback
  49898. callback = callback( "abort" );
  49899. try {
  49900. // Do send the request (this may raise an exception)
  49901. xhr.send( options.hasContent && options.data || null );
  49902. } catch ( e ) {
  49903. // #14683: Only rethrow if this hasn't been notified as an error yet
  49904. if ( callback ) {
  49905. throw e;
  49906. }
  49907. }
  49908. },
  49909. abort: function() {
  49910. if ( callback ) {
  49911. callback();
  49912. }
  49913. }
  49914. };
  49915. }
  49916. } );
  49917. // Prevent auto-execution of scripts when no explicit dataType was provided (See gh-2432)
  49918. jQuery.ajaxPrefilter( function( s ) {
  49919. if ( s.crossDomain ) {
  49920. s.contents.script = false;
  49921. }
  49922. } );
  49923. // Install script dataType
  49924. jQuery.ajaxSetup( {
  49925. accepts: {
  49926. script: "text/javascript, application/javascript, " +
  49927. "application/ecmascript, application/x-ecmascript"
  49928. },
  49929. contents: {
  49930. script: /\b(?:java|ecma)script\b/
  49931. },
  49932. converters: {
  49933. "text script": function( text ) {
  49934. jQuery.globalEval( text );
  49935. return text;
  49936. }
  49937. }
  49938. } );
  49939. // Handle cache's special case and crossDomain
  49940. jQuery.ajaxPrefilter( "script", function( s ) {
  49941. if ( s.cache === undefined ) {
  49942. s.cache = false;
  49943. }
  49944. if ( s.crossDomain ) {
  49945. s.type = "GET";
  49946. }
  49947. } );
  49948. // Bind script tag hack transport
  49949. jQuery.ajaxTransport( "script", function( s ) {
  49950. // This transport only deals with cross domain requests
  49951. if ( s.crossDomain ) {
  49952. var script, callback;
  49953. return {
  49954. send: function( _, complete ) {
  49955. script = jQuery( "<script>" ).prop( {
  49956. charset: s.scriptCharset,
  49957. src: s.url
  49958. } ).on(
  49959. "load error",
  49960. callback = function( evt ) {
  49961. script.remove();
  49962. callback = null;
  49963. if ( evt ) {
  49964. complete( evt.type === "error" ? 404 : 200, evt.type );
  49965. }
  49966. }
  49967. );
  49968. // Use native DOM manipulation to avoid our domManip AJAX trickery
  49969. document.head.appendChild( script[ 0 ] );
  49970. },
  49971. abort: function() {
  49972. if ( callback ) {
  49973. callback();
  49974. }
  49975. }
  49976. };
  49977. }
  49978. } );
  49979. var oldCallbacks = [],
  49980. rjsonp = /(=)\?(?=&|$)|\?\?/;
  49981. // Default jsonp settings
  49982. jQuery.ajaxSetup( {
  49983. jsonp: "callback",
  49984. jsonpCallback: function() {
  49985. var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( nonce++ ) );
  49986. this[ callback ] = true;
  49987. return callback;
  49988. }
  49989. } );
  49990. // Detect, normalize options and install callbacks for jsonp requests
  49991. jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) {
  49992. var callbackName, overwritten, responseContainer,
  49993. jsonProp = s.jsonp !== false && ( rjsonp.test( s.url ) ?
  49994. "url" :
  49995. typeof s.data === "string" &&
  49996. ( s.contentType || "" )
  49997. .indexOf( "application/x-www-form-urlencoded" ) === 0 &&
  49998. rjsonp.test( s.data ) && "data"
  49999. );
  50000. // Handle iff the expected data type is "jsonp" or we have a parameter to set
  50001. if ( jsonProp || s.dataTypes[ 0 ] === "jsonp" ) {
  50002. // Get callback name, remembering preexisting value associated with it
  50003. callbackName = s.jsonpCallback = isFunction( s.jsonpCallback ) ?
  50004. s.jsonpCallback() :
  50005. s.jsonpCallback;
  50006. // Insert callback into url or form data
  50007. if ( jsonProp ) {
  50008. s[ jsonProp ] = s[ jsonProp ].replace( rjsonp, "$1" + callbackName );
  50009. } else if ( s.jsonp !== false ) {
  50010. s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.jsonp + "=" + callbackName;
  50011. }
  50012. // Use data converter to retrieve json after script execution
  50013. s.converters[ "script json" ] = function() {
  50014. if ( !responseContainer ) {
  50015. jQuery.error( callbackName + " was not called" );
  50016. }
  50017. return responseContainer[ 0 ];
  50018. };
  50019. // Force json dataType
  50020. s.dataTypes[ 0 ] = "json";
  50021. // Install callback
  50022. overwritten = window[ callbackName ];
  50023. window[ callbackName ] = function() {
  50024. responseContainer = arguments;
  50025. };
  50026. // Clean-up function (fires after converters)
  50027. jqXHR.always( function() {
  50028. // If previous value didn't exist - remove it
  50029. if ( overwritten === undefined ) {
  50030. jQuery( window ).removeProp( callbackName );
  50031. // Otherwise restore preexisting value
  50032. } else {
  50033. window[ callbackName ] = overwritten;
  50034. }
  50035. // Save back as free
  50036. if ( s[ callbackName ] ) {
  50037. // Make sure that re-using the options doesn't screw things around
  50038. s.jsonpCallback = originalSettings.jsonpCallback;
  50039. // Save the callback name for future use
  50040. oldCallbacks.push( callbackName );
  50041. }
  50042. // Call if it was a function and we have a response
  50043. if ( responseContainer && isFunction( overwritten ) ) {
  50044. overwritten( responseContainer[ 0 ] );
  50045. }
  50046. responseContainer = overwritten = undefined;
  50047. } );
  50048. // Delegate to script
  50049. return "script";
  50050. }
  50051. } );
  50052. // Support: Safari 8 only
  50053. // In Safari 8 documents created via document.implementation.createHTMLDocument
  50054. // collapse sibling forms: the second one becomes a child of the first one.
  50055. // Because of that, this security measure has to be disabled in Safari 8.
  50056. // https://bugs.webkit.org/show_bug.cgi?id=137337
  50057. support.createHTMLDocument = ( function() {
  50058. var body = document.implementation.createHTMLDocument( "" ).body;
  50059. body.innerHTML = "<form></form><form></form>";
  50060. return body.childNodes.length === 2;
  50061. } )();
  50062. // Argument "data" should be string of html
  50063. // context (optional): If specified, the fragment will be created in this context,
  50064. // defaults to document
  50065. // keepScripts (optional): If true, will include scripts passed in the html string
  50066. jQuery.parseHTML = function( data, context, keepScripts ) {
  50067. if ( typeof data !== "string" ) {
  50068. return [];
  50069. }
  50070. if ( typeof context === "boolean" ) {
  50071. keepScripts = context;
  50072. context = false;
  50073. }
  50074. var base, parsed, scripts;
  50075. if ( !context ) {
  50076. // Stop scripts or inline event handlers from being executed immediately
  50077. // by using document.implementation
  50078. if ( support.createHTMLDocument ) {
  50079. context = document.implementation.createHTMLDocument( "" );
  50080. // Set the base href for the created document
  50081. // so any parsed elements with URLs
  50082. // are based on the document's URL (gh-2965)
  50083. base = context.createElement( "base" );
  50084. base.href = document.location.href;
  50085. context.head.appendChild( base );
  50086. } else {
  50087. context = document;
  50088. }
  50089. }
  50090. parsed = rsingleTag.exec( data );
  50091. scripts = !keepScripts && [];
  50092. // Single tag
  50093. if ( parsed ) {
  50094. return [ context.createElement( parsed[ 1 ] ) ];
  50095. }
  50096. parsed = buildFragment( [ data ], context, scripts );
  50097. if ( scripts && scripts.length ) {
  50098. jQuery( scripts ).remove();
  50099. }
  50100. return jQuery.merge( [], parsed.childNodes );
  50101. };
  50102. /**
  50103. * Load a url into a page
  50104. */
  50105. jQuery.fn.load = function( url, params, callback ) {
  50106. var selector, type, response,
  50107. self = this,
  50108. off = url.indexOf( " " );
  50109. if ( off > -1 ) {
  50110. selector = stripAndCollapse( url.slice( off ) );
  50111. url = url.slice( 0, off );
  50112. }
  50113. // If it's a function
  50114. if ( isFunction( params ) ) {
  50115. // We assume that it's the callback
  50116. callback = params;
  50117. params = undefined;
  50118. // Otherwise, build a param string
  50119. } else if ( params && typeof params === "object" ) {
  50120. type = "POST";
  50121. }
  50122. // If we have elements to modify, make the request
  50123. if ( self.length > 0 ) {
  50124. jQuery.ajax( {
  50125. url: url,
  50126. // If "type" variable is undefined, then "GET" method will be used.
  50127. // Make value of this field explicit since
  50128. // user can override it through ajaxSetup method
  50129. type: type || "GET",
  50130. dataType: "html",
  50131. data: params
  50132. } ).done( function( responseText ) {
  50133. // Save response for use in complete callback
  50134. response = arguments;
  50135. self.html( selector ?
  50136. // If a selector was specified, locate the right elements in a dummy div
  50137. // Exclude scripts to avoid IE 'Permission Denied' errors
  50138. jQuery( "<div>" ).append( jQuery.parseHTML( responseText ) ).find( selector ) :
  50139. // Otherwise use the full result
  50140. responseText );
  50141. // If the request succeeds, this function gets "data", "status", "jqXHR"
  50142. // but they are ignored because response was set above.
  50143. // If it fails, this function gets "jqXHR", "status", "error"
  50144. } ).always( callback && function( jqXHR, status ) {
  50145. self.each( function() {
  50146. callback.apply( this, response || [ jqXHR.responseText, status, jqXHR ] );
  50147. } );
  50148. } );
  50149. }
  50150. return this;
  50151. };
  50152. // Attach a bunch of functions for handling common AJAX events
  50153. jQuery.each( [
  50154. "ajaxStart",
  50155. "ajaxStop",
  50156. "ajaxComplete",
  50157. "ajaxError",
  50158. "ajaxSuccess",
  50159. "ajaxSend"
  50160. ], function( i, type ) {
  50161. jQuery.fn[ type ] = function( fn ) {
  50162. return this.on( type, fn );
  50163. };
  50164. } );
  50165. jQuery.expr.pseudos.animated = function( elem ) {
  50166. return jQuery.grep( jQuery.timers, function( fn ) {
  50167. return elem === fn.elem;
  50168. } ).length;
  50169. };
  50170. jQuery.offset = {
  50171. setOffset: function( elem, options, i ) {
  50172. var curPosition, curLeft, curCSSTop, curTop, curOffset, curCSSLeft, calculatePosition,
  50173. position = jQuery.css( elem, "position" ),
  50174. curElem = jQuery( elem ),
  50175. props = {};
  50176. // Set position first, in-case top/left are set even on static elem
  50177. if ( position === "static" ) {
  50178. elem.style.position = "relative";
  50179. }
  50180. curOffset = curElem.offset();
  50181. curCSSTop = jQuery.css( elem, "top" );
  50182. curCSSLeft = jQuery.css( elem, "left" );
  50183. calculatePosition = ( position === "absolute" || position === "fixed" ) &&
  50184. ( curCSSTop + curCSSLeft ).indexOf( "auto" ) > -1;
  50185. // Need to be able to calculate position if either
  50186. // top or left is auto and position is either absolute or fixed
  50187. if ( calculatePosition ) {
  50188. curPosition = curElem.position();
  50189. curTop = curPosition.top;
  50190. curLeft = curPosition.left;
  50191. } else {
  50192. curTop = parseFloat( curCSSTop ) || 0;
  50193. curLeft = parseFloat( curCSSLeft ) || 0;
  50194. }
  50195. if ( isFunction( options ) ) {
  50196. // Use jQuery.extend here to allow modification of coordinates argument (gh-1848)
  50197. options = options.call( elem, i, jQuery.extend( {}, curOffset ) );
  50198. }
  50199. if ( options.top != null ) {
  50200. props.top = ( options.top - curOffset.top ) + curTop;
  50201. }
  50202. if ( options.left != null ) {
  50203. props.left = ( options.left - curOffset.left ) + curLeft;
  50204. }
  50205. if ( "using" in options ) {
  50206. options.using.call( elem, props );
  50207. } else {
  50208. curElem.css( props );
  50209. }
  50210. }
  50211. };
  50212. jQuery.fn.extend( {
  50213. // offset() relates an element's border box to the document origin
  50214. offset: function( options ) {
  50215. // Preserve chaining for setter
  50216. if ( arguments.length ) {
  50217. return options === undefined ?
  50218. this :
  50219. this.each( function( i ) {
  50220. jQuery.offset.setOffset( this, options, i );
  50221. } );
  50222. }
  50223. var rect, win,
  50224. elem = this[ 0 ];
  50225. if ( !elem ) {
  50226. return;
  50227. }
  50228. // Return zeros for disconnected and hidden (display: none) elements (gh-2310)
  50229. // Support: IE <=11 only
  50230. // Running getBoundingClientRect on a
  50231. // disconnected node in IE throws an error
  50232. if ( !elem.getClientRects().length ) {
  50233. return { top: 0, left: 0 };
  50234. }
  50235. // Get document-relative position by adding viewport scroll to viewport-relative gBCR
  50236. rect = elem.getBoundingClientRect();
  50237. win = elem.ownerDocument.defaultView;
  50238. return {
  50239. top: rect.top + win.pageYOffset,
  50240. left: rect.left + win.pageXOffset
  50241. };
  50242. },
  50243. // position() relates an element's margin box to its offset parent's padding box
  50244. // This corresponds to the behavior of CSS absolute positioning
  50245. position: function() {
  50246. if ( !this[ 0 ] ) {
  50247. return;
  50248. }
  50249. var offsetParent, offset, doc,
  50250. elem = this[ 0 ],
  50251. parentOffset = { top: 0, left: 0 };
  50252. // position:fixed elements are offset from the viewport, which itself always has zero offset
  50253. if ( jQuery.css( elem, "position" ) === "fixed" ) {
  50254. // Assume position:fixed implies availability of getBoundingClientRect
  50255. offset = elem.getBoundingClientRect();
  50256. } else {
  50257. offset = this.offset();
  50258. // Account for the *real* offset parent, which can be the document or its root element
  50259. // when a statically positioned element is identified
  50260. doc = elem.ownerDocument;
  50261. offsetParent = elem.offsetParent || doc.documentElement;
  50262. while ( offsetParent &&
  50263. ( offsetParent === doc.body || offsetParent === doc.documentElement ) &&
  50264. jQuery.css( offsetParent, "position" ) === "static" ) {
  50265. offsetParent = offsetParent.parentNode;
  50266. }
  50267. if ( offsetParent && offsetParent !== elem && offsetParent.nodeType === 1 ) {
  50268. // Incorporate borders into its offset, since they are outside its content origin
  50269. parentOffset = jQuery( offsetParent ).offset();
  50270. parentOffset.top += jQuery.css( offsetParent, "borderTopWidth", true );
  50271. parentOffset.left += jQuery.css( offsetParent, "borderLeftWidth", true );
  50272. }
  50273. }
  50274. // Subtract parent offsets and element margins
  50275. return {
  50276. top: offset.top - parentOffset.top - jQuery.css( elem, "marginTop", true ),
  50277. left: offset.left - parentOffset.left - jQuery.css( elem, "marginLeft", true )
  50278. };
  50279. },
  50280. // This method will return documentElement in the following cases:
  50281. // 1) For the element inside the iframe without offsetParent, this method will return
  50282. // documentElement of the parent window
  50283. // 2) For the hidden or detached element
  50284. // 3) For body or html element, i.e. in case of the html node - it will return itself
  50285. //
  50286. // but those exceptions were never presented as a real life use-cases
  50287. // and might be considered as more preferable results.
  50288. //
  50289. // This logic, however, is not guaranteed and can change at any point in the future
  50290. offsetParent: function() {
  50291. return this.map( function() {
  50292. var offsetParent = this.offsetParent;
  50293. while ( offsetParent && jQuery.css( offsetParent, "position" ) === "static" ) {
  50294. offsetParent = offsetParent.offsetParent;
  50295. }
  50296. return offsetParent || documentElement;
  50297. } );
  50298. }
  50299. } );
  50300. // Create scrollLeft and scrollTop methods
  50301. jQuery.each( { scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, function( method, prop ) {
  50302. var top = "pageYOffset" === prop;
  50303. jQuery.fn[ method ] = function( val ) {
  50304. return access( this, function( elem, method, val ) {
  50305. // Coalesce documents and windows
  50306. var win;
  50307. if ( isWindow( elem ) ) {
  50308. win = elem;
  50309. } else if ( elem.nodeType === 9 ) {
  50310. win = elem.defaultView;
  50311. }
  50312. if ( val === undefined ) {
  50313. return win ? win[ prop ] : elem[ method ];
  50314. }
  50315. if ( win ) {
  50316. win.scrollTo(
  50317. !top ? val : win.pageXOffset,
  50318. top ? val : win.pageYOffset
  50319. );
  50320. } else {
  50321. elem[ method ] = val;
  50322. }
  50323. }, method, val, arguments.length );
  50324. };
  50325. } );
  50326. // Support: Safari <=7 - 9.1, Chrome <=37 - 49
  50327. // Add the top/left cssHooks using jQuery.fn.position
  50328. // Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084
  50329. // Blink bug: https://bugs.chromium.org/p/chromium/issues/detail?id=589347
  50330. // getComputedStyle returns percent when specified for top/left/bottom/right;
  50331. // rather than make the css module depend on the offset module, just check for it here
  50332. jQuery.each( [ "top", "left" ], function( i, prop ) {
  50333. jQuery.cssHooks[ prop ] = addGetHookIf( support.pixelPosition,
  50334. function( elem, computed ) {
  50335. if ( computed ) {
  50336. computed = curCSS( elem, prop );
  50337. // If curCSS returns percentage, fallback to offset
  50338. return rnumnonpx.test( computed ) ?
  50339. jQuery( elem ).position()[ prop ] + "px" :
  50340. computed;
  50341. }
  50342. }
  50343. );
  50344. } );
  50345. // Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods
  50346. jQuery.each( { Height: "height", Width: "width" }, function( name, type ) {
  50347. jQuery.each( { padding: "inner" + name, content: type, "": "outer" + name },
  50348. function( defaultExtra, funcName ) {
  50349. // Margin is only for outerHeight, outerWidth
  50350. jQuery.fn[ funcName ] = function( margin, value ) {
  50351. var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ),
  50352. extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" );
  50353. return access( this, function( elem, type, value ) {
  50354. var doc;
  50355. if ( isWindow( elem ) ) {
  50356. // $( window ).outerWidth/Height return w/h including scrollbars (gh-1729)
  50357. return funcName.indexOf( "outer" ) === 0 ?
  50358. elem[ "inner" + name ] :
  50359. elem.document.documentElement[ "client" + name ];
  50360. }
  50361. // Get document width or height
  50362. if ( elem.nodeType === 9 ) {
  50363. doc = elem.documentElement;
  50364. // Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height],
  50365. // whichever is greatest
  50366. return Math.max(
  50367. elem.body[ "scroll" + name ], doc[ "scroll" + name ],
  50368. elem.body[ "offset" + name ], doc[ "offset" + name ],
  50369. doc[ "client" + name ]
  50370. );
  50371. }
  50372. return value === undefined ?
  50373. // Get width or height on the element, requesting but not forcing parseFloat
  50374. jQuery.css( elem, type, extra ) :
  50375. // Set width or height on the element
  50376. jQuery.style( elem, type, value, extra );
  50377. }, type, chainable ? margin : undefined, chainable );
  50378. };
  50379. } );
  50380. } );
  50381. jQuery.each( ( "blur focus focusin focusout resize scroll click dblclick " +
  50382. "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
  50383. "change select submit keydown keypress keyup contextmenu" ).split( " " ),
  50384. function( i, name ) {
  50385. // Handle event binding
  50386. jQuery.fn[ name ] = function( data, fn ) {
  50387. return arguments.length > 0 ?
  50388. this.on( name, null, data, fn ) :
  50389. this.trigger( name );
  50390. };
  50391. } );
  50392. jQuery.fn.extend( {
  50393. hover: function( fnOver, fnOut ) {
  50394. return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );
  50395. }
  50396. } );
  50397. jQuery.fn.extend( {
  50398. bind: function( types, data, fn ) {
  50399. return this.on( types, null, data, fn );
  50400. },
  50401. unbind: function( types, fn ) {
  50402. return this.off( types, null, fn );
  50403. },
  50404. delegate: function( selector, types, data, fn ) {
  50405. return this.on( types, selector, data, fn );
  50406. },
  50407. undelegate: function( selector, types, fn ) {
  50408. // ( namespace ) or ( selector, types [, fn] )
  50409. return arguments.length === 1 ?
  50410. this.off( selector, "**" ) :
  50411. this.off( types, selector || "**", fn );
  50412. }
  50413. } );
  50414. // Bind a function to a context, optionally partially applying any
  50415. // arguments.
  50416. // jQuery.proxy is deprecated to promote standards (specifically Function#bind)
  50417. // However, it is not slated for removal any time soon
  50418. jQuery.proxy = function( fn, context ) {
  50419. var tmp, args, proxy;
  50420. if ( typeof context === "string" ) {
  50421. tmp = fn[ context ];
  50422. context = fn;
  50423. fn = tmp;
  50424. }
  50425. // Quick check to determine if target is callable, in the spec
  50426. // this throws a TypeError, but we will just return undefined.
  50427. if ( !isFunction( fn ) ) {
  50428. return undefined;
  50429. }
  50430. // Simulated bind
  50431. args = slice.call( arguments, 2 );
  50432. proxy = function() {
  50433. return fn.apply( context || this, args.concat( slice.call( arguments ) ) );
  50434. };
  50435. // Set the guid of unique handler to the same of original handler, so it can be removed
  50436. proxy.guid = fn.guid = fn.guid || jQuery.guid++;
  50437. return proxy;
  50438. };
  50439. jQuery.holdReady = function( hold ) {
  50440. if ( hold ) {
  50441. jQuery.readyWait++;
  50442. } else {
  50443. jQuery.ready( true );
  50444. }
  50445. };
  50446. jQuery.isArray = Array.isArray;
  50447. jQuery.parseJSON = JSON.parse;
  50448. jQuery.nodeName = nodeName;
  50449. jQuery.isFunction = isFunction;
  50450. jQuery.isWindow = isWindow;
  50451. jQuery.camelCase = camelCase;
  50452. jQuery.type = toType;
  50453. jQuery.now = Date.now;
  50454. jQuery.isNumeric = function( obj ) {
  50455. // As of jQuery 3.0, isNumeric is limited to
  50456. // strings and numbers (primitives or objects)
  50457. // that can be coerced to finite numbers (gh-2662)
  50458. var type = jQuery.type( obj );
  50459. return ( type === "number" || type === "string" ) &&
  50460. // parseFloat NaNs numeric-cast false positives ("")
  50461. // ...but misinterprets leading-number strings, particularly hex literals ("0x...")
  50462. // subtraction forces infinities to NaN
  50463. !isNaN( obj - parseFloat( obj ) );
  50464. };
  50465. // Register as a named AMD module, since jQuery can be concatenated with other
  50466. // files that may use define, but not via a proper concatenation script that
  50467. // understands anonymous AMD modules. A named AMD is safest and most robust
  50468. // way to register. Lowercase jquery is used because AMD module names are
  50469. // derived from file names, and jQuery is normally delivered in a lowercase
  50470. // file name. Do this after creating the global so that if an AMD module wants
  50471. // to call noConflict to hide this version of jQuery, it will work.
  50472. // Note that for maximum portability, libraries that are not jQuery should
  50473. // declare themselves as anonymous modules, and avoid setting a global if an
  50474. // AMD loader is present. jQuery is a special case. For more information, see
  50475. // https://github.com/jrburke/requirejs/wiki/Updating-existing-libraries#wiki-anon
  50476. if ( true ) {
  50477. !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = (function() {
  50478. return jQuery;
  50479. }).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
  50480. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  50481. }
  50482. var
  50483. // Map over jQuery in case of overwrite
  50484. _jQuery = window.jQuery,
  50485. // Map over the $ in case of overwrite
  50486. _$ = window.$;
  50487. jQuery.noConflict = function( deep ) {
  50488. if ( window.$ === jQuery ) {
  50489. window.$ = _$;
  50490. }
  50491. if ( deep && window.jQuery === jQuery ) {
  50492. window.jQuery = _jQuery;
  50493. }
  50494. return jQuery;
  50495. };
  50496. // Expose jQuery and $ identifiers, even in AMD
  50497. // (#7102#comment:10, https://github.com/jquery/jquery/pull/557)
  50498. // and CommonJS for browser emulators (#13566)
  50499. if ( !noGlobal ) {
  50500. window.jQuery = window.$ = jQuery;
  50501. }
  50502. return jQuery;
  50503. } );
  50504. /***/ }),
  50505. /***/ "./node_modules/line-i18n/dist/LanguageService.js":
  50506. /*!********************************************************!*\
  50507. !*** ./node_modules/line-i18n/dist/LanguageService.js ***!
  50508. \********************************************************/
  50509. /*! exports provided: LanguageService */
  50510. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  50511. "use strict";
  50512. __webpack_require__.r(__webpack_exports__);
  50513. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "LanguageService", function() { return LanguageService; });
  50514. var LanguageService = /** @class */ (function () {
  50515. function LanguageService(lsKey, defaultLang) {
  50516. if (defaultLang === void 0) { defaultLang = 'pt'; }
  50517. this.lsKey = lsKey;
  50518. this.defaultLang = defaultLang;
  50519. this.listeners = [];
  50520. this.document = document;
  50521. this.setupListener();
  50522. }
  50523. LanguageService.prototype.setupListener = function () {
  50524. var _this = this;
  50525. if (this.document !== null) {
  50526. this.document.addEventListener("storage", (function (event) {
  50527. var e = event;
  50528. if (e.key === _this.lsKey) {
  50529. _this.listeners.forEach(function (l) { return l(); });
  50530. }
  50531. }));
  50532. }
  50533. };
  50534. LanguageService.prototype.getLang = function () {
  50535. var lang = localStorage.getItem(this.lsKey);
  50536. if (lang === null || lang === undefined) {
  50537. console.warn("Internal Error: User language information has not been set. Returning default...");
  50538. return this.getDefaultLang();
  50539. }
  50540. return lang;
  50541. };
  50542. LanguageService.prototype.getDefaultLang = function () {
  50543. return this.defaultLang;
  50544. };
  50545. LanguageService.prototype.registerLanguageChangeListener = function (listener) {
  50546. this.listeners.push(listener);
  50547. };
  50548. return LanguageService;
  50549. }());
  50550. /***/ }),
  50551. /***/ "./node_modules/line-i18n/dist/LanguageServiceNoLS.js":
  50552. /*!************************************************************!*\
  50553. !*** ./node_modules/line-i18n/dist/LanguageServiceNoLS.js ***!
  50554. \************************************************************/
  50555. /*! exports provided: LanguageServiceNoLS */
  50556. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  50557. "use strict";
  50558. __webpack_require__.r(__webpack_exports__);
  50559. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "LanguageServiceNoLS", function() { return LanguageServiceNoLS; });
  50560. var LanguageServiceNoLS = /** @class */ (function () {
  50561. function LanguageServiceNoLS(lang) {
  50562. this.lang = lang;
  50563. this.listeners = [];
  50564. }
  50565. LanguageServiceNoLS.prototype.setupListener = function () { };
  50566. LanguageServiceNoLS.prototype.notifyChange = function () {
  50567. this.listeners.forEach(function (l) { return l(); });
  50568. };
  50569. LanguageServiceNoLS.prototype.setLang = function (lang) {
  50570. this.lang = lang;
  50571. this.notifyChange();
  50572. };
  50573. LanguageServiceNoLS.prototype.getLang = function () {
  50574. return this.lang;
  50575. };
  50576. LanguageServiceNoLS.prototype.getDefaultLang = function () {
  50577. return this.lang;
  50578. };
  50579. LanguageServiceNoLS.prototype.registerLanguageChangeListener = function (listener) {
  50580. this.listeners.push(listener);
  50581. };
  50582. return LanguageServiceNoLS;
  50583. }());
  50584. /***/ }),
  50585. /***/ "./node_modules/line-i18n/dist/LocalizedStrings.js":
  50586. /*!*********************************************************!*\
  50587. !*** ./node_modules/line-i18n/dist/LocalizedStrings.js ***!
  50588. \*********************************************************/
  50589. /*! exports provided: LocalizedStrings */
  50590. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  50591. "use strict";
  50592. __webpack_require__.r(__webpack_exports__);
  50593. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "LocalizedStrings", function() { return LocalizedStrings; });
  50594. /* harmony import */ var _StringTypes__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./StringTypes */ "./node_modules/line-i18n/dist/StringTypes.js");
  50595. var LocalizedStrings = /** @class */ (function () {
  50596. function LocalizedStrings(service, i18nData, listenToChange) {
  50597. if (listenToChange === void 0) { listenToChange = false; }
  50598. var _this = this;
  50599. this.service = service;
  50600. this.i18nData = i18nData;
  50601. this.listenToChange = listenToChange;
  50602. this.document = document;
  50603. if (this.listenToChange) {
  50604. service.registerLanguageChangeListener(function () {
  50605. _this.updateTagText();
  50606. });
  50607. }
  50608. }
  50609. LocalizedStrings.prototype.getString = function (id, type) {
  50610. var i18nObj = this.i18nData[this.service.getLang()];
  50611. if (!!!i18nObj) {
  50612. console.warn("Internal Error. The language set at ivprog.lang is not valid: " + this.service.getLang());
  50613. i18nObj = this.i18nData[this.service.getDefaultLang()];
  50614. }
  50615. if (!!!i18nObj[type]) {
  50616. return "{MISSING_I18N_TYPE_IDENTIFIER}";
  50617. }
  50618. else if (!!!i18nObj[type][id]) {
  50619. return "{MISSING_I18N_IDENTIFIER}";
  50620. }
  50621. else {
  50622. return i18nObj[type][id];
  50623. }
  50624. };
  50625. LocalizedStrings.prototype.getOR = function () {
  50626. return this.getUI('join_or');
  50627. };
  50628. LocalizedStrings.prototype.getError = function (id, context) {
  50629. if (context === void 0) { context = []; }
  50630. var text = this.getString(id, _StringTypes__WEBPACK_IMPORTED_MODULE_0__["StringTypes"].ERROR);
  50631. return this.processString(text, context);
  50632. };
  50633. LocalizedStrings.prototype.getMessage = function (id, context) {
  50634. if (context === void 0) { context = []; }
  50635. var text = this.getString(id, _StringTypes__WEBPACK_IMPORTED_MODULE_0__["StringTypes"].MESSAGE);
  50636. return this.processString(text, context);
  50637. };
  50638. LocalizedStrings.prototype.getUI = function (id, context) {
  50639. if (context === void 0) { context = []; }
  50640. var text = this.getString(id, _StringTypes__WEBPACK_IMPORTED_MODULE_0__["StringTypes"].UI);
  50641. return this.processString(text, context);
  50642. };
  50643. LocalizedStrings.prototype.processString = function (text, context) {
  50644. for (var i = 0; i < context.length; i++) {
  50645. var v = context[i];
  50646. text = text.replace('\$' + i, v);
  50647. }
  50648. return text;
  50649. };
  50650. LocalizedStrings.prototype.updateTagText = function (func) {
  50651. var _this = this;
  50652. if (func === void 0) { func = null; }
  50653. if (this.document !== null) {
  50654. var list = this.document.querySelectorAll("data.i18n");
  50655. list.forEach(function (node) {
  50656. if (func === null) {
  50657. node.innerHTML = _this.processTagTex(node.getAttribute("value"));
  50658. }
  50659. else {
  50660. node.innerHTML = func(node.getAttribute("value"));
  50661. }
  50662. });
  50663. }
  50664. };
  50665. LocalizedStrings.prototype.processTagTex = function (text) {
  50666. if (text === null) {
  50667. return "<Invalid i18n identifier>";
  50668. }
  50669. var opts = text.split(':');
  50670. var type = opts[0].toLowerCase();
  50671. var id = opts[1];
  50672. if (_StringTypes__WEBPACK_IMPORTED_MODULE_0__["StringTypes"].ERROR === type) {
  50673. return this.getError(id);
  50674. }
  50675. else if (_StringTypes__WEBPACK_IMPORTED_MODULE_0__["StringTypes"].MESSAGE === type) {
  50676. return this.getMessage(id);
  50677. }
  50678. else if (_StringTypes__WEBPACK_IMPORTED_MODULE_0__["StringTypes"].UI === type) {
  50679. return this.getUI(id);
  50680. }
  50681. else {
  50682. console.warn(" A string has been passed to the i18n helper function that was not in the form type:id -> " + text);
  50683. return this.getString(id, type);
  50684. }
  50685. };
  50686. return LocalizedStrings;
  50687. }());
  50688. /***/ }),
  50689. /***/ "./node_modules/line-i18n/dist/StringTypes.js":
  50690. /*!****************************************************!*\
  50691. !*** ./node_modules/line-i18n/dist/StringTypes.js ***!
  50692. \****************************************************/
  50693. /*! exports provided: StringTypes */
  50694. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  50695. "use strict";
  50696. __webpack_require__.r(__webpack_exports__);
  50697. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "StringTypes", function() { return StringTypes; });
  50698. var StringTypes;
  50699. (function (StringTypes) {
  50700. StringTypes["ERROR"] = "error";
  50701. StringTypes["MESSAGE"] = "message";
  50702. StringTypes["UI"] = "ui";
  50703. })(StringTypes || (StringTypes = {}));
  50704. /***/ }),
  50705. /***/ "./node_modules/line-i18n/dist/index.js":
  50706. /*!**********************************************!*\
  50707. !*** ./node_modules/line-i18n/dist/index.js ***!
  50708. \**********************************************/
  50709. /*! exports provided: default */
  50710. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  50711. "use strict";
  50712. __webpack_require__.r(__webpack_exports__);
  50713. /* harmony import */ var _LanguageService__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./LanguageService */ "./node_modules/line-i18n/dist/LanguageService.js");
  50714. /* harmony import */ var _LocalizedStrings__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./LocalizedStrings */ "./node_modules/line-i18n/dist/LocalizedStrings.js");
  50715. /* harmony import */ var _StringTypes__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./StringTypes */ "./node_modules/line-i18n/dist/StringTypes.js");
  50716. /* harmony import */ var _LanguageServiceNoLS__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./LanguageServiceNoLS */ "./node_modules/line-i18n/dist/LanguageServiceNoLS.js");
  50717. /* harmony default export */ __webpack_exports__["default"] = ({
  50718. LanguageService: _LanguageService__WEBPACK_IMPORTED_MODULE_0__["LanguageService"],
  50719. LanguageServiceNoLS: _LanguageServiceNoLS__WEBPACK_IMPORTED_MODULE_3__["LanguageServiceNoLS"],
  50720. LocalizedStrings: _LocalizedStrings__WEBPACK_IMPORTED_MODULE_1__["LocalizedStrings"],
  50721. StringTypes: _StringTypes__WEBPACK_IMPORTED_MODULE_2__["StringTypes"]
  50722. });
  50723. /***/ }),
  50724. /***/ "./node_modules/melanke-watchjs/src/watch.js":
  50725. /*!***************************************************!*\
  50726. !*** ./node_modules/melanke-watchjs/src/watch.js ***!
  50727. \***************************************************/
  50728. /*! no static exports found */
  50729. /***/ (function(module, exports, __webpack_require__) {
  50730. "use strict";
  50731. /**
  50732. * DEVELOPED BY
  50733. * GIL LOPES BUENO
  50734. * gilbueno.mail@gmail.com
  50735. *
  50736. * WORKS WITH:
  50737. * IE8*, IE 9+, FF 4+, SF 5+, WebKit, CH 7+, OP 12+, BESEN, Rhino 1.7+
  50738. * For IE8 (and other legacy browsers) WatchJS will use dirty checking
  50739. *
  50740. * FORK:
  50741. * https://github.com/melanke/Watch.JS
  50742. *
  50743. * LICENSE: MIT
  50744. */
  50745. (function (factory) {
  50746. if (true) {
  50747. // Node. Does not work with strict CommonJS, but
  50748. // only CommonJS-like enviroments that support module.exports,
  50749. // like Node.
  50750. module.exports = factory();
  50751. } else {}
  50752. }(function () {
  50753. var WatchJS = {
  50754. noMore: false, // use WatchJS.suspend(obj) instead
  50755. useDirtyCheck: false, // use only dirty checking to track changes.
  50756. preserveExistingSetters: false
  50757. },
  50758. lengthsubjects = [];
  50759. var dirtyChecklist = [];
  50760. var pendingChanges = []; // used coalesce changes from defineProperty and __defineSetter__
  50761. var supportDefineProperty = false;
  50762. try {
  50763. supportDefineProperty = Object.defineProperty && Object.defineProperty({},'x', {});
  50764. } catch(ex) { /* not supported */ }
  50765. var isFunction = function (functionToCheck) {
  50766. var getType = {};
  50767. return functionToCheck && getType.toString.call(functionToCheck) == '[object Function]';
  50768. };
  50769. var isInt = function (x) {
  50770. return x % 1 === 0;
  50771. };
  50772. var isArray = function(obj) {
  50773. return Object.prototype.toString.call(obj) === '[object Array]';
  50774. };
  50775. var isObject = function(obj) {
  50776. return {}.toString.apply(obj) === '[object Object]';
  50777. };
  50778. var getObjDiff = function(a, b){
  50779. var aplus = [],
  50780. bplus = [];
  50781. if(!(typeof a == "string") && !(typeof b == "string")){
  50782. if (isArray(a) && b) {
  50783. for (var i=0; i<a.length; i++) {
  50784. if (b[i] === undefined) aplus.push(i);
  50785. }
  50786. } else {
  50787. for(var i in a){
  50788. if (a.hasOwnProperty(i)) {
  50789. if(b && !b.hasOwnProperty(i)) {
  50790. aplus.push(i);
  50791. }
  50792. }
  50793. }
  50794. }
  50795. if (isArray(b) && a) {
  50796. for (var j=0; j<b.length; j++) {
  50797. if (a[j] === undefined) bplus.push(j);
  50798. }
  50799. } else {
  50800. for(var j in b){
  50801. if (b.hasOwnProperty(j)) {
  50802. if(a && !a.hasOwnProperty(j)) {
  50803. bplus.push(j);
  50804. }
  50805. }
  50806. }
  50807. }
  50808. }
  50809. return {
  50810. added: aplus,
  50811. removed: bplus
  50812. }
  50813. };
  50814. var clone = function(obj){
  50815. if (null == obj || "object" != typeof obj) {
  50816. return obj;
  50817. }
  50818. var copy = obj.constructor();
  50819. for (var attr in obj) {
  50820. copy[attr] = obj[attr];
  50821. }
  50822. return copy;
  50823. }
  50824. var getExistingSetter = function (obj, propName) {
  50825. if (WatchJS.preserveExistingSetters) {
  50826. var existing = Object.getOwnPropertyDescriptor(obj, propName);
  50827. return existing.set;
  50828. }
  50829. return undefined;
  50830. }
  50831. var defineGetAndSet = function (obj, propName, getter, setter) {
  50832. try {
  50833. var existingSetter = getExistingSetter(obj, propName);
  50834. Object.defineProperty(obj, propName, {
  50835. get: getter,
  50836. set: function(value) {
  50837. setter.call(this, value, true); // coalesce changes
  50838. if (existingSetter) {
  50839. existingSetter(value);
  50840. }
  50841. },
  50842. enumerable: true,
  50843. configurable: true
  50844. });
  50845. }
  50846. catch(e1) {
  50847. try{
  50848. Object.prototype.__defineGetter__.call(obj, propName, getter);
  50849. Object.prototype.__defineSetter__.call(obj, propName, function(value) {
  50850. setter.call(this,value,true); // coalesce changes
  50851. });
  50852. }
  50853. catch(e2) {
  50854. observeDirtyChanges(obj,propName,setter);
  50855. //throw new Error("watchJS error: browser not supported :/")
  50856. }
  50857. }
  50858. };
  50859. var defineProp = function (obj, propName, value) {
  50860. try {
  50861. Object.defineProperty(obj, propName, {
  50862. enumerable: false,
  50863. configurable: true,
  50864. writable: false,
  50865. value: value
  50866. });
  50867. } catch(error) {
  50868. obj[propName] = value;
  50869. }
  50870. };
  50871. var observeDirtyChanges = function(obj,propName,setter) {
  50872. dirtyChecklist[dirtyChecklist.length] = {
  50873. prop: propName,
  50874. object: obj,
  50875. orig: clone(obj[propName]),
  50876. callback: setter
  50877. }
  50878. }
  50879. var watch = function () {
  50880. if (isFunction(arguments[1])) {
  50881. watchAll.apply(this, arguments);
  50882. } else if (isArray(arguments[1])) {
  50883. watchMany.apply(this, arguments);
  50884. } else {
  50885. watchOne.apply(this, arguments);
  50886. }
  50887. };
  50888. var watchAll = function (obj, watcher, level, addNRemove) {
  50889. if ((typeof obj == "string") || (!(obj instanceof Object) && !isArray(obj))) { //accepts only objects and array (not string)
  50890. return;
  50891. }
  50892. if(isArray(obj)) {
  50893. defineWatcher(obj, "__watchall__", watcher, level); // watch all changes on the array
  50894. if (level===undefined||level > 0) {
  50895. for (var prop = 0; prop < obj.length; prop++) { // watch objects in array
  50896. watchAll(obj[prop],watcher,level, addNRemove);
  50897. }
  50898. }
  50899. }
  50900. else {
  50901. var prop,props = [];
  50902. for (prop in obj) { //for each attribute if obj is an object
  50903. if (prop == "$val" || (!supportDefineProperty && prop === 'watchers')) {
  50904. continue;
  50905. }
  50906. if (Object.prototype.hasOwnProperty.call(obj, prop)) {
  50907. props.push(prop); //put in the props
  50908. }
  50909. }
  50910. watchMany(obj, props, watcher, level, addNRemove); //watch all items of the props
  50911. }
  50912. if (addNRemove) {
  50913. pushToLengthSubjects(obj, "$$watchlengthsubjectroot", watcher, level);
  50914. }
  50915. };
  50916. var watchMany = function (obj, props, watcher, level, addNRemove) {
  50917. if ((typeof obj == "string") || (!(obj instanceof Object) && !isArray(obj))) { //accepts only objects and array (not string)
  50918. return;
  50919. }
  50920. for (var i=0; i<props.length; i++) { //watch each property
  50921. var prop = props[i];
  50922. watchOne(obj, prop, watcher, level, addNRemove);
  50923. }
  50924. };
  50925. var watchOne = function (obj, prop, watcher, level, addNRemove) {
  50926. if ((typeof obj == "string") || (!(obj instanceof Object) && !isArray(obj))) { //accepts only objects and array (not string)
  50927. return;
  50928. }
  50929. if(isFunction(obj[prop])) { //dont watch if it is a function
  50930. return;
  50931. }
  50932. if(obj[prop] != null && (level === undefined || level > 0)){
  50933. watchAll(obj[prop], watcher, level!==undefined? level-1 : level); //recursively watch all attributes of this
  50934. }
  50935. defineWatcher(obj, prop, watcher, level);
  50936. if(addNRemove && (level === undefined || level > 0)){
  50937. pushToLengthSubjects(obj, prop, watcher, level);
  50938. }
  50939. };
  50940. var unwatch = function () {
  50941. if (isFunction(arguments[1])) {
  50942. unwatchAll.apply(this, arguments);
  50943. } else if (isArray(arguments[1])) {
  50944. unwatchMany.apply(this, arguments);
  50945. } else {
  50946. unwatchOne.apply(this, arguments);
  50947. }
  50948. };
  50949. var unwatchAll = function (obj, watcher) {
  50950. if (obj instanceof String || (!(obj instanceof Object) && !isArray(obj))) { //accepts only objects and array (not string)
  50951. return;
  50952. }
  50953. if (isArray(obj)) {
  50954. var props = ['__watchall__'];
  50955. for (var prop = 0; prop < obj.length; prop++) { //for each item if obj is an array
  50956. props.push(prop); //put in the props
  50957. }
  50958. unwatchMany(obj, props, watcher); //watch all itens of the props
  50959. } else {
  50960. var unwatchPropsInObject = function (obj2) {
  50961. var props = [];
  50962. for (var prop2 in obj2) { //for each attribute if obj is an object
  50963. if (obj2.hasOwnProperty(prop2)) {
  50964. if (obj2[prop2] instanceof Object) {
  50965. unwatchPropsInObject(obj2[prop2]); //recurs into object props
  50966. } else {
  50967. props.push(prop2); //put in the props
  50968. }
  50969. }
  50970. }
  50971. unwatchMany(obj2, props, watcher); //unwatch all of the props
  50972. };
  50973. unwatchPropsInObject(obj);
  50974. }
  50975. };
  50976. var unwatchMany = function (obj, props, watcher) {
  50977. for (var prop2 in props) { //watch each attribute of "props" if is an object
  50978. if (props.hasOwnProperty(prop2)) {
  50979. unwatchOne(obj, props[prop2], watcher);
  50980. }
  50981. }
  50982. };
  50983. var timeouts = [],
  50984. timerID = null;
  50985. function clearTimerID() {
  50986. timerID = null;
  50987. for(var i=0; i< timeouts.length; i++) {
  50988. timeouts[i]();
  50989. }
  50990. timeouts.length = 0;
  50991. }
  50992. var getTimerID= function () {
  50993. if (!timerID) {
  50994. timerID = setTimeout(clearTimerID);
  50995. }
  50996. return timerID;
  50997. }
  50998. var registerTimeout = function(fn) { // register function to be called on timeout
  50999. if (timerID==null) getTimerID();
  51000. timeouts[timeouts.length] = fn;
  51001. }
  51002. // Track changes made to an array, object or an object's property
  51003. // and invoke callback with a single change object containing type, value, oldvalue and array splices
  51004. // Syntax:
  51005. // trackChange(obj, callback, recursive, addNRemove)
  51006. // trackChange(obj, prop, callback, recursive, addNRemove)
  51007. var trackChange = function() {
  51008. var fn = (isFunction(arguments[2])) ? trackProperty : trackObject ;
  51009. fn.apply(this,arguments);
  51010. }
  51011. // track changes made to an object and invoke callback with a single change object containing type, value and array splices
  51012. var trackObject= function(obj, callback, recursive, addNRemove) {
  51013. var change = null,lastTimerID = -1;
  51014. var isArr = isArray(obj);
  51015. var level,fn = function(prop, action, newValue, oldValue) {
  51016. var timerID = getTimerID();
  51017. if (lastTimerID!==timerID) { // check if timer has changed since last update
  51018. lastTimerID = timerID;
  51019. change = {
  51020. type: 'update'
  51021. }
  51022. change['value'] = obj;
  51023. change['splices'] = null;
  51024. registerTimeout(function() {
  51025. callback.call(this,change);
  51026. change = null;
  51027. });
  51028. }
  51029. // create splices for array changes
  51030. if (isArr && obj === this && change !== null) {
  51031. if (action==='pop'||action==='shift') {
  51032. newValue = [];
  51033. oldValue = [oldValue];
  51034. }
  51035. else if (action==='push'||action==='unshift') {
  51036. newValue = [newValue];
  51037. oldValue = [];
  51038. }
  51039. else if (action!=='splice') {
  51040. return; // return here - for reverse and sort operations we don't need to return splices. a simple update will do
  51041. }
  51042. if (!change.splices) change.splices = [];
  51043. change.splices[change.splices.length] = {
  51044. index: prop,
  51045. deleteCount: oldValue ? oldValue.length : 0,
  51046. addedCount: newValue ? newValue.length : 0,
  51047. added: newValue,
  51048. deleted: oldValue
  51049. };
  51050. }
  51051. }
  51052. level = (recursive==true) ? undefined : 0;
  51053. watchAll(obj,fn, level, addNRemove);
  51054. }
  51055. // track changes made to the property of an object and invoke callback with a single change object containing type, value, oldvalue and splices
  51056. var trackProperty = function(obj,prop,callback,recursive, addNRemove) {
  51057. if (obj && prop) {
  51058. watchOne(obj,prop,function(prop, action, newvalue, oldvalue) {
  51059. var change = {
  51060. type: 'update'
  51061. }
  51062. change['value'] = newvalue;
  51063. change['oldvalue'] = oldvalue;
  51064. if (recursive && isObject(newvalue)||isArray(newvalue)) {
  51065. trackObject(newvalue,callback,recursive, addNRemove);
  51066. }
  51067. callback.call(this,change);
  51068. },0)
  51069. if (recursive && isObject(obj[prop])||isArray(obj[prop])) {
  51070. trackObject(obj[prop],callback,recursive, addNRemove);
  51071. }
  51072. }
  51073. }
  51074. var defineWatcher = function (obj, prop, watcher, level) {
  51075. var newWatcher = false;
  51076. var isArr = isArray(obj);
  51077. if (!obj.watchers) {
  51078. defineProp(obj, "watchers", {});
  51079. if (isArr) {
  51080. // watch array functions
  51081. watchFunctions(obj, function(index,action,newValue, oldValue) {
  51082. addPendingChange(obj, index, action,newValue, oldValue);
  51083. if (level !== 0 && newValue && (isObject(newValue) || isArray(newValue))) {
  51084. var i,n, ln, wAll, watchList = obj.watchers[prop];
  51085. if ((wAll = obj.watchers['__watchall__'])) {
  51086. watchList = watchList ? watchList.concat(wAll) : wAll;
  51087. }
  51088. ln = watchList ? watchList.length : 0;
  51089. for (i = 0; i<ln; i++) {
  51090. if (action!=='splice') {
  51091. watchAll(newValue, watchList[i], (level===undefined)?level:level-1);
  51092. }
  51093. else {
  51094. // watch spliced values
  51095. for(n=0; n < newValue.length; n++) {
  51096. watchAll(newValue[n], watchList[i], (level===undefined)?level:level-1);
  51097. }
  51098. }
  51099. }
  51100. }
  51101. });
  51102. }
  51103. }
  51104. if (!obj.watchers[prop]) {
  51105. obj.watchers[prop] = [];
  51106. if (!isArr) newWatcher = true;
  51107. }
  51108. for (var i=0; i<obj.watchers[prop].length; i++) {
  51109. if(obj.watchers[prop][i] === watcher){
  51110. return;
  51111. }
  51112. }
  51113. obj.watchers[prop].push(watcher); //add the new watcher to the watchers array
  51114. if (newWatcher) {
  51115. var val = obj[prop];
  51116. var getter = function () {
  51117. return val;
  51118. };
  51119. var setter = function (newval, delayWatcher) {
  51120. var oldval = val;
  51121. val = newval;
  51122. if (level !== 0
  51123. && obj[prop] && (isObject(obj[prop]) || isArray(obj[prop]))
  51124. && !obj[prop].watchers) {
  51125. // watch sub properties
  51126. var i,ln = obj.watchers[prop].length;
  51127. for(i=0; i<ln; i++) {
  51128. watchAll(obj[prop], obj.watchers[prop][i], (level===undefined)?level:level-1);
  51129. }
  51130. }
  51131. //watchFunctions(obj, prop);
  51132. if (isSuspended(obj, prop)) {
  51133. resume(obj, prop);
  51134. return;
  51135. }
  51136. if (!WatchJS.noMore){ // this does not work with Object.observe
  51137. //if (JSON.stringify(oldval) !== JSON.stringify(newval)) {
  51138. if (oldval !== newval) {
  51139. if (!delayWatcher) {
  51140. callWatchers(obj, prop, "set", newval, oldval);
  51141. }
  51142. else {
  51143. addPendingChange(obj, prop, "set", newval, oldval);
  51144. }
  51145. WatchJS.noMore = false;
  51146. }
  51147. }
  51148. };
  51149. if (WatchJS.useDirtyCheck) {
  51150. observeDirtyChanges(obj,prop,setter);
  51151. }
  51152. else {
  51153. defineGetAndSet(obj, prop, getter, setter);
  51154. }
  51155. }
  51156. };
  51157. var callWatchers = function (obj, prop, action, newval, oldval) {
  51158. if (prop !== undefined) {
  51159. var ln, wl, watchList = obj.watchers[prop];
  51160. if ((wl = obj.watchers['__watchall__'])) {
  51161. watchList = watchList ? watchList.concat(wl) : wl;
  51162. }
  51163. ln = watchList ? watchList.length : 0;
  51164. for (var wr=0; wr< ln; wr++) {
  51165. watchList[wr].call(obj, prop, action, newval, oldval);
  51166. }
  51167. } else {
  51168. for (var prop in obj) {//call all
  51169. if (obj.hasOwnProperty(prop)) {
  51170. callWatchers(obj, prop, action, newval, oldval);
  51171. }
  51172. }
  51173. }
  51174. };
  51175. var methodNames = ['pop', 'push', 'reverse', 'shift', 'sort', 'slice', 'unshift', 'splice'];
  51176. var defineArrayMethodWatcher = function (obj, original, methodName, callback) {
  51177. defineProp(obj, methodName, function () {
  51178. var index = 0;
  51179. var i,newValue, oldValue, response;
  51180. // get values before splicing array
  51181. if (methodName === 'splice') {
  51182. var start = arguments[0];
  51183. var end = start + arguments[1];
  51184. oldValue = obj.slice(start,end);
  51185. newValue = [];
  51186. for(i=2;i<arguments.length;i++) {
  51187. newValue[i-2] = arguments[i];
  51188. }
  51189. index = start;
  51190. }
  51191. else {
  51192. newValue = arguments.length > 0 ? arguments[0] : undefined;
  51193. }
  51194. response = original.apply(obj, arguments);
  51195. if (methodName !== 'slice') {
  51196. if (methodName === 'pop') {
  51197. oldValue = response;
  51198. index = obj.length;
  51199. }
  51200. else if (methodName === 'push') {
  51201. index = obj.length-1;
  51202. }
  51203. else if (methodName === 'shift') {
  51204. oldValue = response;
  51205. }
  51206. else if (methodName !== 'unshift' && newValue===undefined) {
  51207. newValue = response;
  51208. }
  51209. callback.call(obj, index, methodName,newValue, oldValue)
  51210. }
  51211. return response;
  51212. });
  51213. };
  51214. var watchFunctions = function(obj, callback) {
  51215. if (!isFunction(callback) || !obj || (obj instanceof String) || (!isArray(obj))) {
  51216. return;
  51217. }
  51218. for (var i = methodNames.length, methodName; i--;) {
  51219. methodName = methodNames[i];
  51220. defineArrayMethodWatcher(obj, obj[methodName], methodName, callback);
  51221. }
  51222. };
  51223. var unwatchOne = function (obj, prop, watcher) {
  51224. if (prop) {
  51225. if (obj.watchers && obj.watchers[prop]) {
  51226. if (watcher === undefined) {
  51227. delete obj.watchers[prop]; // remove all property watchers
  51228. }
  51229. else {
  51230. for (var i = 0; i < obj.watchers[prop].length; i++) {
  51231. var w = obj.watchers[prop][i];
  51232. if (w == watcher) {
  51233. obj.watchers[prop].splice(i, 1);
  51234. }
  51235. }
  51236. }
  51237. }
  51238. } else {
  51239. delete obj.watchers;
  51240. }
  51241. removeFromLengthSubjects(obj, prop, watcher);
  51242. removeFromDirtyChecklist(obj, prop);
  51243. };
  51244. // suspend watchers until next update cycle
  51245. var suspend = function(obj, prop) {
  51246. if (obj.watchers) {
  51247. var name = '__wjs_suspend__'+(prop!==undefined ? prop : '');
  51248. obj.watchers[name] = true;
  51249. }
  51250. }
  51251. var isSuspended = function(obj, prop) {
  51252. return obj.watchers
  51253. && (obj.watchers['__wjs_suspend__'] ||
  51254. obj.watchers['__wjs_suspend__'+prop]);
  51255. }
  51256. // resumes preivously suspended watchers
  51257. var resume = function(obj, prop) {
  51258. registerTimeout(function() {
  51259. delete obj.watchers['__wjs_suspend__'];
  51260. delete obj.watchers['__wjs_suspend__'+prop];
  51261. })
  51262. }
  51263. var pendingTimerID = null;
  51264. var addPendingChange = function(obj,prop, mode, newval, oldval) {
  51265. pendingChanges[pendingChanges.length] = {
  51266. obj:obj,
  51267. prop: prop,
  51268. mode: mode,
  51269. newval: newval,
  51270. oldval: oldval
  51271. };
  51272. if (pendingTimerID===null) {
  51273. pendingTimerID = setTimeout(applyPendingChanges);
  51274. }
  51275. };
  51276. var applyPendingChanges = function() {
  51277. // apply pending changes
  51278. var change = null;
  51279. pendingTimerID = null;
  51280. for(var i=0;i < pendingChanges.length;i++) {
  51281. change = pendingChanges[i];
  51282. callWatchers(change.obj, change.prop, change.mode, change.newval, change.oldval);
  51283. }
  51284. if (change) {
  51285. pendingChanges = [];
  51286. change = null;
  51287. }
  51288. }
  51289. var loop = function(){
  51290. // check for new or deleted props
  51291. for(var i=0; i<lengthsubjects.length; i++) {
  51292. var subj = lengthsubjects[i];
  51293. if (subj.prop === "$$watchlengthsubjectroot") {
  51294. var difference = getObjDiff(subj.obj, subj.actual);
  51295. if(difference.added.length || difference.removed.length){
  51296. if(difference.added.length){
  51297. watchMany(subj.obj, difference.added, subj.watcher, subj.level - 1, true);
  51298. }
  51299. subj.watcher.call(subj.obj, "root", "differentattr", difference, subj.actual);
  51300. }
  51301. subj.actual = clone(subj.obj);
  51302. } else {
  51303. var difference = getObjDiff(subj.obj[subj.prop], subj.actual);
  51304. if(difference.added.length || difference.removed.length){
  51305. if(difference.added.length){
  51306. for (var j=0; j<subj.obj.watchers[subj.prop].length; j++) {
  51307. watchMany(subj.obj[subj.prop], difference.added, subj.obj.watchers[subj.prop][j], subj.level - 1, true);
  51308. }
  51309. }
  51310. callWatchers(subj.obj, subj.prop, "differentattr", difference, subj.actual);
  51311. }
  51312. subj.actual = clone(subj.obj[subj.prop]);
  51313. }
  51314. }
  51315. // start dirty check
  51316. var n, value;
  51317. if (dirtyChecklist.length > 0) {
  51318. for (var i = 0; i < dirtyChecklist.length; i++) {
  51319. n = dirtyChecklist[i];
  51320. value = n.object[n.prop];
  51321. if (!compareValues(n.orig, value)) {
  51322. n.orig = clone(value);
  51323. n.callback(value);
  51324. }
  51325. }
  51326. }
  51327. };
  51328. var compareValues = function(a,b) {
  51329. var i, state = true;
  51330. if (a!==b) {
  51331. if (isObject(a)) {
  51332. for(i in a) {
  51333. if (!supportDefineProperty && i==='watchers') continue;
  51334. if (a[i]!==b[i]) {
  51335. state = false;
  51336. break;
  51337. };
  51338. }
  51339. }
  51340. else {
  51341. state = false;
  51342. }
  51343. }
  51344. return state;
  51345. }
  51346. var pushToLengthSubjects = function(obj, prop, watcher, level){
  51347. var actual;
  51348. if (prop === "$$watchlengthsubjectroot") {
  51349. actual = clone(obj);
  51350. } else {
  51351. actual = clone(obj[prop]);
  51352. }
  51353. lengthsubjects.push({
  51354. obj: obj,
  51355. prop: prop,
  51356. actual: actual,
  51357. watcher: watcher,
  51358. level: level
  51359. });
  51360. };
  51361. var removeFromLengthSubjects = function(obj, prop, watcher){
  51362. for (var i=0; i<lengthsubjects.length; i++) {
  51363. var subj = lengthsubjects[i];
  51364. if (subj.obj == obj) {
  51365. if (!prop || subj.prop == prop) {
  51366. if (!watcher || subj.watcher == watcher) {
  51367. // if we splice off one item at position i
  51368. // we need to decrement i as the array is one item shorter
  51369. // so when we increment i in the loop statement we
  51370. // will land at the correct index.
  51371. // if it's not decremented, you won't delete all length subjects
  51372. lengthsubjects.splice(i--, 1);
  51373. }
  51374. }
  51375. }
  51376. }
  51377. };
  51378. var removeFromDirtyChecklist = function(obj, prop){
  51379. var notInUse;
  51380. for (var i=0; i<dirtyChecklist.length; i++) {
  51381. var n = dirtyChecklist[i];
  51382. var watchers = n.object.watchers;
  51383. notInUse = (
  51384. n.object == obj
  51385. && (!prop || n.prop == prop)
  51386. && watchers
  51387. && (!prop || !watchers[prop] || watchers[prop].length == 0 )
  51388. );
  51389. if (notInUse) {
  51390. // we use the same syntax as in removeFromLengthSubjects
  51391. dirtyChecklist.splice(i--, 1);
  51392. }
  51393. }
  51394. };
  51395. setInterval(loop, 50);
  51396. WatchJS.watch = watch;
  51397. WatchJS.unwatch = unwatch;
  51398. WatchJS.callWatchers = callWatchers;
  51399. WatchJS.suspend = suspend; // suspend watchers
  51400. WatchJS.onChange = trackChange; // track changes made to object or it's property and return a single change object
  51401. return WatchJS;
  51402. }));
  51403. /***/ }),
  51404. /***/ "./node_modules/node-libs-browser/mock/empty.js":
  51405. /*!******************************************************!*\
  51406. !*** ./node_modules/node-libs-browser/mock/empty.js ***!
  51407. \******************************************************/
  51408. /*! no static exports found */
  51409. /***/ (function(module, exports) {
  51410. /***/ })
  51411. /******/ });
  51412. });
  51413. //# sourceMappingURL=ivprog.bundle.js.map