ivprog.bundle.js 2.3 MB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086130871308813089130901309113092130931309413095130961309713098130991310013101131021310313104131051310613107131081310913110131111311213113131141311513116131171311813119131201312113122131231312413125131261312713128131291313013131131321313313134131351313613137131381313913140131411314213143131441314513146131471314813149131501315113152131531315413155131561315713158131591316013161131621316313164131651316613167131681316913170131711317213173131741317513176131771317813179131801318113182131831318413185131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206132071320813209132101321113212132131321413215132161321713218132191322013221132221322313224132251322613227132281322913230132311323213233132341323513236132371323813239132401324113242132431324413245132461324713248132491325013251132521325313254132551325613257132581325913260132611326213263132641326513266132671326813269132701327113272132731327413275132761327713278132791328013281132821328313284132851328613287132881328913290132911329213293132941329513296132971329813299133001330113302133031330413305133061330713308133091331013311133121331313314133151331613317133181331913320133211332213323133241332513326133271332813329133301333113332133331333413335133361333713338133391334013341133421334313344133451334613347133481334913350133511335213353133541335513356133571335813359133601336113362133631336413365133661336713368133691337013371133721337313374133751337613377133781337913380133811338213383133841338513386133871338813389133901339113392133931339413395133961339713398133991340013401134021340313404134051340613407134081340913410134111341213413134141341513416134171341813419134201342113422134231342413425134261342713428134291343013431134321343313434134351343613437134381343913440134411344213443134441344513446134471344813449134501345113452134531345413455134561345713458134591346013461134621346313464134651346613467134681346913470134711347213473134741347513476134771347813479134801348113482134831348413485134861348713488134891349013491134921349313494134951349613497134981349913500135011350213503135041350513506135071350813509135101351113512135131351413515135161351713518135191352013521135221352313524135251352613527135281352913530135311353213533135341353513536135371353813539135401354113542135431354413545135461354713548135491355013551135521355313554135551355613557135581355913560135611356213563135641356513566135671356813569135701357113572135731357413575135761357713578135791358013581135821358313584135851358613587135881358913590135911359213593135941359513596135971359813599136001360113602136031360413605136061360713608136091361013611136121361313614136151361613617136181361913620136211362213623136241362513626136271362813629136301363113632136331363413635136361363713638136391364013641136421364313644136451364613647136481364913650136511365213653136541365513656136571365813659136601366113662136631366413665136661366713668136691367013671136721367313674136751367613677136781367913680136811368213683136841368513686136871368813689136901369113692136931369413695136961369713698136991370013701137021370313704137051370613707137081370913710137111371213713137141371513716137171371813719137201372113722137231372413725137261372713728137291373013731137321373313734137351373613737137381373913740137411374213743137441374513746137471374813749137501375113752137531375413755137561375713758137591376013761137621376313764137651376613767137681376913770137711377213773137741377513776137771377813779137801378113782137831378413785137861378713788137891379013791137921379313794137951379613797137981379913800138011380213803138041380513806138071380813809138101381113812138131381413815138161381713818138191382013821138221382313824138251382613827138281382913830138311383213833138341383513836138371383813839138401384113842138431384413845138461384713848138491385013851138521385313854138551385613857138581385913860138611386213863138641386513866138671386813869138701387113872138731387413875138761387713878138791388013881138821388313884138851388613887138881388913890138911389213893138941389513896138971389813899139001390113902139031390413905139061390713908139091391013911139121391313914139151391613917139181391913920139211392213923139241392513926139271392813929139301393113932139331393413935139361393713938139391394013941139421394313944139451394613947139481394913950139511395213953139541395513956139571395813959139601396113962139631396413965139661396713968139691397013971139721397313974139751397613977139781397913980139811398213983139841398513986139871398813989139901399113992139931399413995139961399713998139991400014001140021400314004140051400614007140081400914010140111401214013140141401514016140171401814019140201402114022140231402414025140261402714028140291403014031140321403314034140351403614037140381403914040140411404214043140441404514046140471404814049140501405114052140531405414055140561405714058140591406014061140621406314064140651406614067140681406914070140711407214073140741407514076140771407814079140801408114082140831408414085140861408714088140891409014091140921409314094140951409614097140981409914100141011410214103141041410514106141071410814109141101411114112141131411414115141161411714118141191412014121141221412314124141251412614127141281412914130141311413214133141341413514136141371413814139141401414114142141431414414145141461414714148141491415014151141521415314154141551415614157141581415914160141611416214163141641416514166141671416814169141701417114172141731417414175141761417714178141791418014181141821418314184141851418614187141881418914190141911419214193141941419514196141971419814199142001420114202142031420414205142061420714208142091421014211142121421314214142151421614217142181421914220142211422214223142241422514226142271422814229142301423114232142331423414235142361423714238142391424014241142421424314244142451424614247142481424914250142511425214253142541425514256142571425814259142601426114262142631426414265142661426714268142691427014271142721427314274142751427614277142781427914280142811428214283142841428514286142871428814289142901429114292142931429414295142961429714298142991430014301143021430314304143051430614307143081430914310143111431214313143141431514316143171431814319143201432114322143231432414325143261432714328143291433014331143321433314334143351433614337143381433914340143411434214343143441434514346143471434814349143501435114352143531435414355143561435714358143591436014361143621436314364143651436614367143681436914370143711437214373143741437514376143771437814379143801438114382143831438414385143861438714388143891439014391143921439314394143951439614397143981439914400144011440214403144041440514406144071440814409144101441114412144131441414415144161441714418144191442014421144221442314424144251442614427144281442914430144311443214433144341443514436144371443814439144401444114442144431444414445144461444714448144491445014451144521445314454144551445614457144581445914460144611446214463144641446514466144671446814469144701447114472144731447414475144761447714478144791448014481144821448314484144851448614487144881448914490144911449214493144941449514496144971449814499145001450114502145031450414505145061450714508145091451014511145121451314514145151451614517145181451914520145211452214523145241452514526145271452814529145301453114532145331453414535145361453714538145391454014541145421454314544145451454614547145481454914550145511455214553145541455514556145571455814559145601456114562145631456414565145661456714568145691457014571145721457314574145751457614577145781457914580145811458214583145841458514586145871458814589145901459114592145931459414595145961459714598145991460014601146021460314604146051460614607146081460914610146111461214613146141461514616146171461814619146201462114622146231462414625146261462714628146291463014631146321463314634146351463614637146381463914640146411464214643146441464514646146471464814649146501465114652146531465414655146561465714658146591466014661146621466314664146651466614667146681466914670146711467214673146741467514676146771467814679146801468114682146831468414685146861468714688146891469014691146921469314694146951469614697146981469914700147011470214703147041470514706147071470814709147101471114712147131471414715147161471714718147191472014721147221472314724147251472614727147281472914730147311473214733147341473514736147371473814739147401474114742147431474414745147461474714748147491475014751147521475314754147551475614757147581475914760147611476214763147641476514766147671476814769147701477114772147731477414775147761477714778147791478014781147821478314784147851478614787147881478914790147911479214793147941479514796147971479814799148001480114802148031480414805148061480714808148091481014811148121481314814148151481614817148181481914820148211482214823148241482514826148271482814829148301483114832148331483414835148361483714838148391484014841148421484314844148451484614847148481484914850148511485214853148541485514856148571485814859148601486114862148631486414865148661486714868148691487014871148721487314874148751487614877148781487914880148811488214883148841488514886148871488814889148901489114892148931489414895148961489714898148991490014901149021490314904149051490614907149081490914910149111491214913149141491514916149171491814919149201492114922149231492414925149261492714928149291493014931149321493314934149351493614937149381493914940149411494214943149441494514946149471494814949149501495114952149531495414955149561495714958149591496014961149621496314964149651496614967149681496914970149711497214973149741497514976149771497814979149801498114982149831498414985149861498714988149891499014991149921499314994149951499614997149981499915000150011500215003150041500515006150071500815009150101501115012150131501415015150161501715018150191502015021150221502315024150251502615027150281502915030150311503215033150341503515036150371503815039150401504115042150431504415045150461504715048150491505015051150521505315054150551505615057150581505915060150611506215063150641506515066150671506815069150701507115072150731507415075150761507715078150791508015081150821508315084150851508615087150881508915090150911509215093150941509515096150971509815099151001510115102151031510415105151061510715108151091511015111151121511315114151151511615117151181511915120151211512215123151241512515126151271512815129151301513115132151331513415135151361513715138151391514015141151421514315144151451514615147151481514915150151511515215153151541515515156151571515815159151601516115162151631516415165151661516715168151691517015171151721517315174151751517615177151781517915180151811518215183151841518515186151871518815189151901519115192151931519415195151961519715198151991520015201152021520315204152051520615207152081520915210152111521215213152141521515216152171521815219152201522115222152231522415225152261522715228152291523015231152321523315234152351523615237152381523915240152411524215243152441524515246152471524815249152501525115252152531525415255152561525715258152591526015261152621526315264152651526615267152681526915270152711527215273152741527515276152771527815279152801528115282152831528415285152861528715288152891529015291152921529315294152951529615297152981529915300153011530215303153041530515306153071530815309153101531115312153131531415315153161531715318153191532015321153221532315324153251532615327153281532915330153311533215333153341533515336153371533815339153401534115342153431534415345153461534715348153491535015351153521535315354153551535615357153581535915360153611536215363153641536515366153671536815369153701537115372153731537415375153761537715378153791538015381153821538315384153851538615387153881538915390153911539215393153941539515396153971539815399154001540115402154031540415405154061540715408154091541015411154121541315414154151541615417154181541915420154211542215423154241542515426154271542815429154301543115432154331543415435154361543715438154391544015441154421544315444154451544615447154481544915450154511545215453154541545515456154571545815459154601546115462154631546415465154661546715468154691547015471154721547315474154751547615477154781547915480154811548215483154841548515486154871548815489154901549115492154931549415495154961549715498154991550015501155021550315504155051550615507155081550915510155111551215513155141551515516155171551815519155201552115522155231552415525155261552715528155291553015531155321553315534155351553615537155381553915540155411554215543155441554515546155471554815549155501555115552155531555415555155561555715558155591556015561155621556315564155651556615567155681556915570155711557215573155741557515576155771557815579155801558115582155831558415585155861558715588155891559015591155921559315594155951559615597155981559915600156011560215603156041560515606156071560815609156101561115612156131561415615156161561715618156191562015621156221562315624156251562615627156281562915630156311563215633156341563515636156371563815639156401564115642156431564415645156461564715648156491565015651156521565315654156551565615657156581565915660156611566215663156641566515666156671566815669156701567115672156731567415675156761567715678156791568015681156821568315684156851568615687156881568915690156911569215693156941569515696156971569815699157001570115702157031570415705157061570715708157091571015711157121571315714157151571615717157181571915720157211572215723157241572515726157271572815729157301573115732157331573415735157361573715738157391574015741157421574315744157451574615747157481574915750157511575215753157541575515756157571575815759157601576115762157631576415765157661576715768157691577015771157721577315774157751577615777157781577915780157811578215783157841578515786157871578815789157901579115792157931579415795157961579715798157991580015801158021580315804158051580615807158081580915810158111581215813158141581515816158171581815819158201582115822158231582415825158261582715828158291583015831158321583315834158351583615837158381583915840158411584215843158441584515846158471584815849158501585115852158531585415855158561585715858158591586015861158621586315864158651586615867158681586915870158711587215873158741587515876158771587815879158801588115882158831588415885158861588715888158891589015891158921589315894158951589615897158981589915900159011590215903159041590515906159071590815909159101591115912159131591415915159161591715918159191592015921159221592315924159251592615927159281592915930159311593215933159341593515936159371593815939159401594115942159431594415945159461594715948159491595015951159521595315954159551595615957159581595915960159611596215963159641596515966159671596815969159701597115972159731597415975159761597715978159791598015981159821598315984159851598615987159881598915990159911599215993159941599515996159971599815999160001600116002160031600416005160061600716008160091601016011160121601316014160151601616017160181601916020160211602216023160241602516026160271602816029160301603116032160331603416035160361603716038160391604016041160421604316044160451604616047160481604916050160511605216053160541605516056160571605816059160601606116062160631606416065160661606716068160691607016071160721607316074160751607616077160781607916080160811608216083160841608516086160871608816089160901609116092160931609416095160961609716098160991610016101161021610316104161051610616107161081610916110161111611216113161141611516116161171611816119161201612116122161231612416125161261612716128161291613016131161321613316134161351613616137161381613916140161411614216143161441614516146161471614816149161501615116152161531615416155161561615716158161591616016161161621616316164161651616616167161681616916170161711617216173161741617516176161771617816179161801618116182161831618416185161861618716188161891619016191161921619316194161951619616197161981619916200162011620216203162041620516206162071620816209162101621116212162131621416215162161621716218162191622016221162221622316224162251622616227162281622916230162311623216233162341623516236162371623816239162401624116242162431624416245162461624716248162491625016251162521625316254162551625616257162581625916260162611626216263162641626516266162671626816269162701627116272162731627416275162761627716278162791628016281162821628316284162851628616287162881628916290162911629216293162941629516296162971629816299163001630116302163031630416305163061630716308163091631016311163121631316314163151631616317163181631916320163211632216323163241632516326163271632816329163301633116332163331633416335163361633716338163391634016341163421634316344163451634616347163481634916350163511635216353163541635516356163571635816359163601636116362163631636416365163661636716368163691637016371163721637316374163751637616377163781637916380163811638216383163841638516386163871638816389163901639116392163931639416395163961639716398163991640016401164021640316404164051640616407164081640916410164111641216413164141641516416164171641816419164201642116422164231642416425164261642716428164291643016431164321643316434164351643616437164381643916440164411644216443164441644516446164471644816449164501645116452164531645416455164561645716458164591646016461164621646316464164651646616467164681646916470164711647216473164741647516476164771647816479164801648116482164831648416485164861648716488164891649016491164921649316494164951649616497164981649916500165011650216503165041650516506165071650816509165101651116512165131651416515165161651716518165191652016521165221652316524165251652616527165281652916530165311653216533165341653516536165371653816539165401654116542165431654416545165461654716548165491655016551165521655316554165551655616557165581655916560165611656216563165641656516566165671656816569165701657116572165731657416575165761657716578165791658016581165821658316584165851658616587165881658916590165911659216593165941659516596165971659816599166001660116602166031660416605166061660716608166091661016611166121661316614166151661616617166181661916620166211662216623166241662516626166271662816629166301663116632166331663416635166361663716638166391664016641166421664316644166451664616647166481664916650166511665216653166541665516656166571665816659166601666116662166631666416665166661666716668166691667016671166721667316674166751667616677166781667916680166811668216683166841668516686166871668816689166901669116692166931669416695166961669716698166991670016701167021670316704167051670616707167081670916710167111671216713167141671516716167171671816719167201672116722167231672416725167261672716728167291673016731167321673316734167351673616737167381673916740167411674216743167441674516746167471674816749167501675116752167531675416755167561675716758167591676016761167621676316764167651676616767167681676916770167711677216773167741677516776167771677816779167801678116782167831678416785167861678716788167891679016791167921679316794167951679616797167981679916800168011680216803168041680516806168071680816809168101681116812168131681416815168161681716818168191682016821168221682316824168251682616827168281682916830168311683216833168341683516836168371683816839168401684116842168431684416845168461684716848168491685016851168521685316854168551685616857168581685916860168611686216863168641686516866168671686816869168701687116872168731687416875168761687716878168791688016881168821688316884168851688616887168881688916890168911689216893168941689516896168971689816899169001690116902169031690416905169061690716908169091691016911169121691316914169151691616917169181691916920169211692216923169241692516926169271692816929169301693116932169331693416935169361693716938169391694016941169421694316944169451694616947169481694916950169511695216953169541695516956169571695816959169601696116962169631696416965169661696716968169691697016971169721697316974169751697616977169781697916980169811698216983169841698516986169871698816989169901699116992169931699416995169961699716998169991700017001170021700317004170051700617007170081700917010170111701217013170141701517016170171701817019170201702117022170231702417025170261702717028170291703017031170321703317034170351703617037170381703917040170411704217043170441704517046170471704817049170501705117052170531705417055170561705717058170591706017061170621706317064170651706617067170681706917070170711707217073170741707517076170771707817079170801708117082170831708417085170861708717088170891709017091170921709317094170951709617097170981709917100171011710217103171041710517106171071710817109171101711117112171131711417115171161711717118171191712017121171221712317124171251712617127171281712917130171311713217133171341713517136171371713817139171401714117142171431714417145171461714717148171491715017151171521715317154171551715617157171581715917160171611716217163171641716517166171671716817169171701717117172171731717417175171761717717178171791718017181171821718317184171851718617187171881718917190171911719217193171941719517196171971719817199172001720117202172031720417205172061720717208172091721017211172121721317214172151721617217172181721917220172211722217223172241722517226172271722817229172301723117232172331723417235172361723717238172391724017241172421724317244172451724617247172481724917250172511725217253172541725517256172571725817259172601726117262172631726417265172661726717268172691727017271172721727317274172751727617277172781727917280172811728217283172841728517286172871728817289172901729117292172931729417295172961729717298172991730017301173021730317304173051730617307173081730917310173111731217313173141731517316173171731817319173201732117322173231732417325173261732717328173291733017331173321733317334173351733617337173381733917340173411734217343173441734517346173471734817349173501735117352173531735417355173561735717358173591736017361173621736317364173651736617367173681736917370173711737217373173741737517376173771737817379173801738117382173831738417385173861738717388173891739017391173921739317394173951739617397173981739917400174011740217403174041740517406174071740817409174101741117412174131741417415174161741717418174191742017421174221742317424174251742617427174281742917430174311743217433174341743517436174371743817439174401744117442174431744417445174461744717448174491745017451174521745317454174551745617457174581745917460174611746217463174641746517466174671746817469174701747117472174731747417475174761747717478174791748017481174821748317484174851748617487174881748917490174911749217493174941749517496174971749817499175001750117502175031750417505175061750717508175091751017511175121751317514175151751617517175181751917520175211752217523175241752517526175271752817529175301753117532175331753417535175361753717538175391754017541175421754317544175451754617547175481754917550175511755217553175541755517556175571755817559175601756117562175631756417565175661756717568175691757017571175721757317574175751757617577175781757917580175811758217583175841758517586175871758817589175901759117592175931759417595175961759717598175991760017601176021760317604176051760617607176081760917610176111761217613176141761517616176171761817619176201762117622176231762417625176261762717628176291763017631176321763317634176351763617637176381763917640176411764217643176441764517646176471764817649176501765117652176531765417655176561765717658176591766017661176621766317664176651766617667176681766917670176711767217673176741767517676176771767817679176801768117682176831768417685176861768717688176891769017691176921769317694176951769617697176981769917700177011770217703177041770517706177071770817709177101771117712177131771417715177161771717718177191772017721177221772317724177251772617727177281772917730177311773217733177341773517736177371773817739177401774117742177431774417745177461774717748177491775017751177521775317754177551775617757177581775917760177611776217763177641776517766177671776817769177701777117772177731777417775177761777717778177791778017781177821778317784177851778617787177881778917790177911779217793177941779517796177971779817799178001780117802178031780417805178061780717808178091781017811178121781317814178151781617817178181781917820178211782217823178241782517826178271782817829178301783117832178331783417835178361783717838178391784017841178421784317844178451784617847178481784917850178511785217853178541785517856178571785817859178601786117862178631786417865178661786717868178691787017871178721787317874178751787617877178781787917880178811788217883178841788517886178871788817889178901789117892178931789417895178961789717898178991790017901179021790317904179051790617907179081790917910179111791217913179141791517916179171791817919179201792117922179231792417925179261792717928179291793017931179321793317934179351793617937179381793917940179411794217943179441794517946179471794817949179501795117952179531795417955179561795717958179591796017961179621796317964179651796617967179681796917970179711797217973179741797517976179771797817979179801798117982179831798417985179861798717988179891799017991179921799317994179951799617997179981799918000180011800218003180041800518006180071800818009180101801118012180131801418015180161801718018180191802018021180221802318024180251802618027180281802918030180311803218033180341803518036180371803818039180401804118042180431804418045180461804718048180491805018051180521805318054180551805618057180581805918060180611806218063180641806518066180671806818069180701807118072180731807418075180761807718078180791808018081180821808318084180851808618087180881808918090180911809218093180941809518096180971809818099181001810118102181031810418105181061810718108181091811018111181121811318114181151811618117181181811918120181211812218123181241812518126181271812818129181301813118132181331813418135181361813718138181391814018141181421814318144181451814618147181481814918150181511815218153181541815518156181571815818159181601816118162181631816418165181661816718168181691817018171181721817318174181751817618177181781817918180181811818218183181841818518186181871818818189181901819118192181931819418195181961819718198181991820018201182021820318204182051820618207182081820918210182111821218213182141821518216182171821818219182201822118222182231822418225182261822718228182291823018231182321823318234182351823618237182381823918240182411824218243182441824518246182471824818249182501825118252182531825418255182561825718258182591826018261182621826318264182651826618267182681826918270182711827218273182741827518276182771827818279182801828118282182831828418285182861828718288182891829018291182921829318294182951829618297182981829918300183011830218303183041830518306183071830818309183101831118312183131831418315183161831718318183191832018321183221832318324183251832618327183281832918330183311833218333183341833518336183371833818339183401834118342183431834418345183461834718348183491835018351183521835318354183551835618357183581835918360183611836218363183641836518366183671836818369183701837118372183731837418375183761837718378183791838018381183821838318384183851838618387183881838918390183911839218393183941839518396183971839818399184001840118402184031840418405184061840718408184091841018411184121841318414184151841618417184181841918420184211842218423184241842518426184271842818429184301843118432184331843418435184361843718438184391844018441184421844318444184451844618447184481844918450184511845218453184541845518456184571845818459184601846118462184631846418465184661846718468184691847018471184721847318474184751847618477184781847918480184811848218483184841848518486184871848818489184901849118492184931849418495184961849718498184991850018501185021850318504185051850618507185081850918510185111851218513185141851518516185171851818519185201852118522185231852418525185261852718528185291853018531185321853318534185351853618537185381853918540185411854218543185441854518546185471854818549185501855118552185531855418555185561855718558185591856018561185621856318564185651856618567185681856918570185711857218573185741857518576185771857818579185801858118582185831858418585185861858718588185891859018591185921859318594185951859618597185981859918600186011860218603186041860518606186071860818609186101861118612186131861418615186161861718618186191862018621186221862318624186251862618627186281862918630186311863218633186341863518636186371863818639186401864118642186431864418645186461864718648186491865018651186521865318654186551865618657186581865918660186611866218663186641866518666186671866818669186701867118672186731867418675186761867718678186791868018681186821868318684186851868618687186881868918690186911869218693186941869518696186971869818699187001870118702187031870418705187061870718708187091871018711187121871318714187151871618717187181871918720187211872218723187241872518726187271872818729187301873118732187331873418735187361873718738187391874018741187421874318744187451874618747187481874918750187511875218753187541875518756187571875818759187601876118762187631876418765187661876718768187691877018771187721877318774187751877618777187781877918780187811878218783187841878518786187871878818789187901879118792187931879418795187961879718798187991880018801188021880318804188051880618807188081880918810188111881218813188141881518816188171881818819188201882118822188231882418825188261882718828188291883018831188321883318834188351883618837188381883918840188411884218843188441884518846188471884818849188501885118852188531885418855188561885718858188591886018861188621886318864188651886618867188681886918870188711887218873188741887518876188771887818879188801888118882188831888418885188861888718888188891889018891188921889318894188951889618897188981889918900189011890218903189041890518906189071890818909189101891118912189131891418915189161891718918189191892018921189221892318924189251892618927189281892918930189311893218933189341893518936189371893818939189401894118942189431894418945189461894718948189491895018951189521895318954189551895618957189581895918960189611896218963189641896518966189671896818969189701897118972189731897418975189761897718978189791898018981189821898318984189851898618987189881898918990189911899218993189941899518996189971899818999190001900119002190031900419005190061900719008190091901019011190121901319014190151901619017190181901919020190211902219023190241902519026190271902819029190301903119032190331903419035190361903719038190391904019041190421904319044190451904619047190481904919050190511905219053190541905519056190571905819059190601906119062190631906419065190661906719068190691907019071190721907319074190751907619077190781907919080190811908219083190841908519086190871908819089190901909119092190931909419095190961909719098190991910019101191021910319104191051910619107191081910919110191111911219113191141911519116191171911819119191201912119122191231912419125191261912719128191291913019131191321913319134191351913619137191381913919140191411914219143191441914519146191471914819149191501915119152191531915419155191561915719158191591916019161191621916319164191651916619167191681916919170191711917219173191741917519176191771917819179191801918119182191831918419185191861918719188191891919019191191921919319194191951919619197191981919919200192011920219203192041920519206192071920819209192101921119212192131921419215192161921719218192191922019221192221922319224192251922619227192281922919230192311923219233192341923519236192371923819239192401924119242192431924419245192461924719248192491925019251192521925319254192551925619257192581925919260192611926219263192641926519266192671926819269192701927119272192731927419275192761927719278192791928019281192821928319284192851928619287192881928919290192911929219293192941929519296192971929819299193001930119302193031930419305193061930719308193091931019311193121931319314193151931619317193181931919320193211932219323193241932519326193271932819329193301933119332193331933419335193361933719338193391934019341193421934319344193451934619347193481934919350193511935219353193541935519356193571935819359193601936119362193631936419365193661936719368193691937019371193721937319374193751937619377193781937919380193811938219383193841938519386193871938819389193901939119392193931939419395193961939719398193991940019401194021940319404194051940619407194081940919410194111941219413194141941519416194171941819419194201942119422194231942419425194261942719428194291943019431194321943319434194351943619437194381943919440194411944219443194441944519446194471944819449194501945119452194531945419455194561945719458194591946019461194621946319464194651946619467194681946919470194711947219473194741947519476194771947819479194801948119482194831948419485194861948719488194891949019491194921949319494194951949619497194981949919500195011950219503195041950519506195071950819509195101951119512195131951419515195161951719518195191952019521195221952319524195251952619527195281952919530195311953219533195341953519536195371953819539195401954119542195431954419545195461954719548195491955019551195521955319554195551955619557195581955919560195611956219563195641956519566195671956819569195701957119572195731957419575195761957719578195791958019581195821958319584195851958619587195881958919590195911959219593195941959519596195971959819599196001960119602196031960419605196061960719608196091961019611196121961319614196151961619617196181961919620196211962219623196241962519626196271962819629196301963119632196331963419635196361963719638196391964019641196421964319644196451964619647196481964919650196511965219653196541965519656196571965819659196601966119662196631966419665196661966719668196691967019671196721967319674196751967619677196781967919680196811968219683196841968519686196871968819689196901969119692196931969419695196961969719698196991970019701197021970319704197051970619707197081970919710197111971219713197141971519716197171971819719197201972119722197231972419725197261972719728197291973019731197321973319734197351973619737197381973919740197411974219743197441974519746197471974819749197501975119752197531975419755197561975719758197591976019761197621976319764197651976619767197681976919770197711977219773197741977519776197771977819779197801978119782197831978419785197861978719788197891979019791197921979319794197951979619797197981979919800198011980219803198041980519806198071980819809198101981119812198131981419815198161981719818198191982019821198221982319824198251982619827198281982919830198311983219833198341983519836198371983819839198401984119842198431984419845198461984719848198491985019851198521985319854198551985619857198581985919860198611986219863198641986519866198671986819869198701987119872198731987419875198761987719878198791988019881198821988319884198851988619887198881988919890198911989219893198941989519896198971989819899199001990119902199031990419905199061990719908199091991019911199121991319914199151991619917199181991919920199211992219923199241992519926199271992819929199301993119932199331993419935199361993719938199391994019941199421994319944199451994619947199481994919950199511995219953199541995519956199571995819959199601996119962199631996419965199661996719968199691997019971199721997319974199751997619977199781997919980199811998219983199841998519986199871998819989199901999119992199931999419995199961999719998199992000020001200022000320004200052000620007200082000920010200112001220013200142001520016200172001820019200202002120022200232002420025200262002720028200292003020031200322003320034200352003620037200382003920040200412004220043200442004520046200472004820049200502005120052200532005420055200562005720058200592006020061200622006320064200652006620067200682006920070200712007220073200742007520076200772007820079200802008120082200832008420085200862008720088200892009020091200922009320094200952009620097200982009920100201012010220103201042010520106201072010820109201102011120112201132011420115201162011720118201192012020121201222012320124201252012620127201282012920130201312013220133201342013520136201372013820139201402014120142201432014420145201462014720148201492015020151201522015320154201552015620157201582015920160201612016220163201642016520166201672016820169201702017120172201732017420175201762017720178201792018020181201822018320184201852018620187201882018920190201912019220193201942019520196201972019820199202002020120202202032020420205202062020720208202092021020211202122021320214202152021620217202182021920220202212022220223202242022520226202272022820229202302023120232202332023420235202362023720238202392024020241202422024320244202452024620247202482024920250202512025220253202542025520256202572025820259202602026120262202632026420265202662026720268202692027020271202722027320274202752027620277202782027920280202812028220283202842028520286202872028820289202902029120292202932029420295202962029720298202992030020301203022030320304203052030620307203082030920310203112031220313203142031520316203172031820319203202032120322203232032420325203262032720328203292033020331203322033320334203352033620337203382033920340203412034220343203442034520346203472034820349203502035120352203532035420355203562035720358203592036020361203622036320364203652036620367203682036920370203712037220373203742037520376203772037820379203802038120382203832038420385203862038720388203892039020391203922039320394203952039620397203982039920400204012040220403204042040520406204072040820409204102041120412204132041420415204162041720418204192042020421204222042320424204252042620427204282042920430204312043220433204342043520436204372043820439204402044120442204432044420445204462044720448204492045020451204522045320454204552045620457204582045920460204612046220463204642046520466204672046820469204702047120472204732047420475204762047720478204792048020481204822048320484204852048620487204882048920490204912049220493204942049520496204972049820499205002050120502205032050420505205062050720508205092051020511205122051320514205152051620517205182051920520205212052220523205242052520526205272052820529205302053120532205332053420535205362053720538205392054020541205422054320544205452054620547205482054920550205512055220553205542055520556205572055820559205602056120562205632056420565205662056720568205692057020571205722057320574205752057620577205782057920580205812058220583205842058520586205872058820589205902059120592205932059420595205962059720598205992060020601206022060320604206052060620607206082060920610206112061220613206142061520616206172061820619206202062120622206232062420625206262062720628206292063020631206322063320634206352063620637206382063920640206412064220643206442064520646206472064820649206502065120652206532065420655206562065720658206592066020661206622066320664206652066620667206682066920670206712067220673206742067520676206772067820679206802068120682206832068420685206862068720688206892069020691206922069320694206952069620697206982069920700207012070220703207042070520706207072070820709207102071120712207132071420715207162071720718207192072020721207222072320724207252072620727207282072920730207312073220733207342073520736207372073820739207402074120742207432074420745207462074720748207492075020751207522075320754207552075620757207582075920760207612076220763207642076520766207672076820769207702077120772207732077420775207762077720778207792078020781207822078320784207852078620787207882078920790207912079220793207942079520796207972079820799208002080120802208032080420805208062080720808208092081020811208122081320814208152081620817208182081920820208212082220823208242082520826208272082820829208302083120832208332083420835208362083720838208392084020841208422084320844208452084620847208482084920850208512085220853208542085520856208572085820859208602086120862208632086420865208662086720868208692087020871208722087320874208752087620877208782087920880208812088220883208842088520886208872088820889208902089120892208932089420895208962089720898208992090020901209022090320904209052090620907209082090920910209112091220913209142091520916209172091820919209202092120922209232092420925209262092720928209292093020931209322093320934209352093620937209382093920940209412094220943209442094520946209472094820949209502095120952209532095420955209562095720958209592096020961209622096320964209652096620967209682096920970209712097220973209742097520976209772097820979209802098120982209832098420985209862098720988209892099020991209922099320994209952099620997209982099921000210012100221003210042100521006210072100821009210102101121012210132101421015210162101721018210192102021021210222102321024210252102621027210282102921030210312103221033210342103521036210372103821039210402104121042210432104421045210462104721048210492105021051210522105321054210552105621057210582105921060210612106221063210642106521066210672106821069210702107121072210732107421075210762107721078210792108021081210822108321084210852108621087210882108921090210912109221093210942109521096210972109821099211002110121102211032110421105211062110721108211092111021111211122111321114211152111621117211182111921120211212112221123211242112521126211272112821129211302113121132211332113421135211362113721138211392114021141211422114321144211452114621147211482114921150211512115221153211542115521156211572115821159211602116121162211632116421165211662116721168211692117021171211722117321174211752117621177211782117921180211812118221183211842118521186211872118821189211902119121192211932119421195211962119721198211992120021201212022120321204212052120621207212082120921210212112121221213212142121521216212172121821219212202122121222212232122421225212262122721228212292123021231212322123321234212352123621237212382123921240212412124221243212442124521246212472124821249212502125121252212532125421255212562125721258212592126021261212622126321264212652126621267212682126921270212712127221273212742127521276212772127821279212802128121282212832128421285212862128721288212892129021291212922129321294212952129621297212982129921300213012130221303213042130521306213072130821309213102131121312213132131421315213162131721318213192132021321213222132321324213252132621327213282132921330213312133221333213342133521336213372133821339213402134121342213432134421345213462134721348213492135021351213522135321354213552135621357213582135921360213612136221363213642136521366213672136821369213702137121372213732137421375213762137721378213792138021381213822138321384213852138621387213882138921390213912139221393213942139521396213972139821399214002140121402214032140421405214062140721408214092141021411214122141321414214152141621417214182141921420214212142221423214242142521426214272142821429214302143121432214332143421435214362143721438214392144021441214422144321444214452144621447214482144921450214512145221453214542145521456214572145821459214602146121462214632146421465214662146721468214692147021471214722147321474214752147621477214782147921480214812148221483214842148521486214872148821489214902149121492214932149421495214962149721498214992150021501215022150321504215052150621507215082150921510215112151221513215142151521516215172151821519215202152121522215232152421525215262152721528215292153021531215322153321534215352153621537215382153921540215412154221543215442154521546215472154821549215502155121552215532155421555215562155721558215592156021561215622156321564215652156621567215682156921570215712157221573215742157521576215772157821579215802158121582215832158421585215862158721588215892159021591215922159321594215952159621597215982159921600216012160221603216042160521606216072160821609216102161121612216132161421615216162161721618216192162021621216222162321624216252162621627216282162921630216312163221633216342163521636216372163821639216402164121642216432164421645216462164721648216492165021651216522165321654216552165621657216582165921660216612166221663216642166521666216672166821669216702167121672216732167421675216762167721678216792168021681216822168321684216852168621687216882168921690216912169221693216942169521696216972169821699217002170121702217032170421705217062170721708217092171021711217122171321714217152171621717217182171921720217212172221723217242172521726217272172821729217302173121732217332173421735217362173721738217392174021741217422174321744217452174621747217482174921750217512175221753217542175521756217572175821759217602176121762217632176421765217662176721768217692177021771217722177321774217752177621777217782177921780217812178221783217842178521786217872178821789217902179121792217932179421795217962179721798217992180021801218022180321804218052180621807218082180921810218112181221813218142181521816218172181821819218202182121822218232182421825218262182721828218292183021831218322183321834218352183621837218382183921840218412184221843218442184521846218472184821849218502185121852218532185421855218562185721858218592186021861218622186321864218652186621867218682186921870218712187221873218742187521876218772187821879218802188121882218832188421885218862188721888218892189021891218922189321894218952189621897218982189921900219012190221903219042190521906219072190821909219102191121912219132191421915219162191721918219192192021921219222192321924219252192621927219282192921930219312193221933219342193521936219372193821939219402194121942219432194421945219462194721948219492195021951219522195321954219552195621957219582195921960219612196221963219642196521966219672196821969219702197121972219732197421975219762197721978219792198021981219822198321984219852198621987219882198921990219912199221993219942199521996219972199821999220002200122002220032200422005220062200722008220092201022011220122201322014220152201622017220182201922020220212202222023220242202522026220272202822029220302203122032220332203422035220362203722038220392204022041220422204322044220452204622047220482204922050220512205222053220542205522056220572205822059220602206122062220632206422065220662206722068220692207022071220722207322074220752207622077220782207922080220812208222083220842208522086220872208822089220902209122092220932209422095220962209722098220992210022101221022210322104221052210622107221082210922110221112211222113221142211522116221172211822119221202212122122221232212422125221262212722128221292213022131221322213322134221352213622137221382213922140221412214222143221442214522146221472214822149221502215122152221532215422155221562215722158221592216022161221622216322164221652216622167221682216922170221712217222173221742217522176221772217822179221802218122182221832218422185221862218722188221892219022191221922219322194221952219622197221982219922200222012220222203222042220522206222072220822209222102221122212222132221422215222162221722218222192222022221222222222322224222252222622227222282222922230222312223222233222342223522236222372223822239222402224122242222432224422245222462224722248222492225022251222522225322254222552225622257222582225922260222612226222263222642226522266222672226822269222702227122272222732227422275222762227722278222792228022281222822228322284222852228622287222882228922290222912229222293222942229522296222972229822299223002230122302223032230422305223062230722308223092231022311223122231322314223152231622317223182231922320223212232222323223242232522326223272232822329223302233122332223332233422335223362233722338223392234022341223422234322344223452234622347223482234922350223512235222353223542235522356223572235822359223602236122362223632236422365223662236722368223692237022371223722237322374223752237622377223782237922380223812238222383223842238522386223872238822389223902239122392223932239422395223962239722398223992240022401224022240322404224052240622407224082240922410224112241222413224142241522416224172241822419224202242122422224232242422425224262242722428224292243022431224322243322434224352243622437224382243922440224412244222443224442244522446224472244822449224502245122452224532245422455224562245722458224592246022461224622246322464224652246622467224682246922470224712247222473224742247522476224772247822479224802248122482224832248422485224862248722488224892249022491224922249322494224952249622497224982249922500225012250222503225042250522506225072250822509225102251122512225132251422515225162251722518225192252022521225222252322524225252252622527225282252922530225312253222533225342253522536225372253822539225402254122542225432254422545225462254722548225492255022551225522255322554225552255622557225582255922560225612256222563225642256522566225672256822569225702257122572225732257422575225762257722578225792258022581225822258322584225852258622587225882258922590225912259222593225942259522596225972259822599226002260122602226032260422605226062260722608226092261022611226122261322614226152261622617226182261922620226212262222623226242262522626226272262822629226302263122632226332263422635226362263722638226392264022641226422264322644226452264622647226482264922650226512265222653226542265522656226572265822659226602266122662226632266422665226662266722668226692267022671226722267322674226752267622677226782267922680226812268222683226842268522686226872268822689226902269122692226932269422695226962269722698226992270022701227022270322704227052270622707227082270922710227112271222713227142271522716227172271822719227202272122722227232272422725227262272722728227292273022731227322273322734227352273622737227382273922740227412274222743227442274522746227472274822749227502275122752227532275422755227562275722758227592276022761227622276322764227652276622767227682276922770227712277222773227742277522776227772277822779227802278122782227832278422785227862278722788227892279022791227922279322794227952279622797227982279922800228012280222803228042280522806228072280822809228102281122812228132281422815228162281722818228192282022821228222282322824228252282622827228282282922830228312283222833228342283522836228372283822839228402284122842228432284422845228462284722848228492285022851228522285322854228552285622857228582285922860228612286222863228642286522866228672286822869228702287122872228732287422875228762287722878228792288022881228822288322884228852288622887228882288922890228912289222893228942289522896228972289822899229002290122902229032290422905229062290722908229092291022911229122291322914229152291622917229182291922920229212292222923229242292522926229272292822929229302293122932229332293422935229362293722938229392294022941229422294322944229452294622947229482294922950229512295222953229542295522956229572295822959229602296122962229632296422965229662296722968229692297022971229722297322974229752297622977229782297922980229812298222983229842298522986229872298822989229902299122992229932299422995229962299722998229992300023001230022300323004230052300623007230082300923010230112301223013230142301523016230172301823019230202302123022230232302423025230262302723028230292303023031230322303323034230352303623037230382303923040230412304223043230442304523046230472304823049230502305123052230532305423055230562305723058230592306023061230622306323064230652306623067230682306923070230712307223073230742307523076230772307823079230802308123082230832308423085230862308723088230892309023091230922309323094230952309623097230982309923100231012310223103231042310523106231072310823109231102311123112231132311423115231162311723118231192312023121231222312323124231252312623127231282312923130231312313223133231342313523136231372313823139231402314123142231432314423145231462314723148231492315023151231522315323154231552315623157231582315923160231612316223163231642316523166231672316823169231702317123172231732317423175231762317723178231792318023181231822318323184231852318623187231882318923190231912319223193231942319523196231972319823199232002320123202232032320423205232062320723208232092321023211232122321323214232152321623217232182321923220232212322223223232242322523226232272322823229232302323123232232332323423235232362323723238232392324023241232422324323244232452324623247232482324923250232512325223253232542325523256232572325823259232602326123262232632326423265232662326723268232692327023271232722327323274232752327623277232782327923280232812328223283232842328523286232872328823289232902329123292232932329423295232962329723298232992330023301233022330323304233052330623307233082330923310233112331223313233142331523316233172331823319233202332123322233232332423325233262332723328233292333023331233322333323334233352333623337233382333923340233412334223343233442334523346233472334823349233502335123352233532335423355233562335723358233592336023361233622336323364233652336623367233682336923370233712337223373233742337523376233772337823379233802338123382233832338423385233862338723388233892339023391233922339323394233952339623397233982339923400234012340223403234042340523406234072340823409234102341123412234132341423415234162341723418234192342023421234222342323424234252342623427234282342923430234312343223433234342343523436234372343823439234402344123442234432344423445234462344723448234492345023451234522345323454234552345623457234582345923460234612346223463234642346523466234672346823469234702347123472234732347423475234762347723478234792348023481234822348323484234852348623487234882348923490234912349223493234942349523496234972349823499235002350123502235032350423505235062350723508235092351023511235122351323514235152351623517235182351923520235212352223523235242352523526235272352823529235302353123532235332353423535235362353723538235392354023541235422354323544235452354623547235482354923550235512355223553235542355523556235572355823559235602356123562235632356423565235662356723568235692357023571235722357323574235752357623577235782357923580235812358223583235842358523586235872358823589235902359123592235932359423595235962359723598235992360023601236022360323604236052360623607236082360923610236112361223613236142361523616236172361823619236202362123622236232362423625236262362723628236292363023631236322363323634236352363623637236382363923640236412364223643236442364523646236472364823649236502365123652236532365423655236562365723658236592366023661236622366323664236652366623667236682366923670236712367223673236742367523676236772367823679236802368123682236832368423685236862368723688236892369023691236922369323694236952369623697236982369923700237012370223703237042370523706237072370823709237102371123712237132371423715237162371723718237192372023721237222372323724237252372623727237282372923730237312373223733237342373523736237372373823739237402374123742237432374423745237462374723748237492375023751237522375323754237552375623757237582375923760237612376223763237642376523766237672376823769237702377123772237732377423775237762377723778237792378023781237822378323784237852378623787237882378923790237912379223793237942379523796237972379823799238002380123802238032380423805238062380723808238092381023811238122381323814238152381623817238182381923820238212382223823238242382523826238272382823829238302383123832238332383423835238362383723838238392384023841238422384323844238452384623847238482384923850238512385223853238542385523856238572385823859238602386123862238632386423865238662386723868238692387023871238722387323874238752387623877238782387923880238812388223883238842388523886238872388823889238902389123892238932389423895238962389723898238992390023901239022390323904239052390623907239082390923910239112391223913239142391523916239172391823919239202392123922239232392423925239262392723928239292393023931239322393323934239352393623937239382393923940239412394223943239442394523946239472394823949239502395123952239532395423955239562395723958239592396023961239622396323964239652396623967239682396923970239712397223973239742397523976239772397823979239802398123982239832398423985239862398723988239892399023991239922399323994239952399623997239982399924000240012400224003240042400524006240072400824009240102401124012240132401424015240162401724018240192402024021240222402324024240252402624027240282402924030240312403224033240342403524036240372403824039240402404124042240432404424045240462404724048240492405024051240522405324054240552405624057240582405924060240612406224063240642406524066240672406824069240702407124072240732407424075240762407724078240792408024081240822408324084240852408624087240882408924090240912409224093240942409524096240972409824099241002410124102241032410424105241062410724108241092411024111241122411324114241152411624117241182411924120241212412224123241242412524126241272412824129241302413124132241332413424135241362413724138241392414024141241422414324144241452414624147241482414924150241512415224153241542415524156241572415824159241602416124162241632416424165241662416724168241692417024171241722417324174241752417624177241782417924180241812418224183241842418524186241872418824189241902419124192241932419424195241962419724198241992420024201242022420324204242052420624207242082420924210242112421224213242142421524216242172421824219242202422124222242232422424225242262422724228242292423024231242322423324234242352423624237242382423924240242412424224243242442424524246242472424824249242502425124252242532425424255242562425724258242592426024261242622426324264242652426624267242682426924270242712427224273242742427524276242772427824279242802428124282242832428424285242862428724288242892429024291242922429324294242952429624297242982429924300243012430224303243042430524306243072430824309243102431124312243132431424315243162431724318243192432024321243222432324324243252432624327243282432924330243312433224333243342433524336243372433824339243402434124342243432434424345243462434724348243492435024351243522435324354243552435624357243582435924360243612436224363243642436524366243672436824369243702437124372243732437424375243762437724378243792438024381243822438324384243852438624387243882438924390243912439224393243942439524396243972439824399244002440124402244032440424405244062440724408244092441024411244122441324414244152441624417244182441924420244212442224423244242442524426244272442824429244302443124432244332443424435244362443724438244392444024441244422444324444244452444624447244482444924450244512445224453244542445524456244572445824459244602446124462244632446424465244662446724468244692447024471244722447324474244752447624477244782447924480244812448224483244842448524486244872448824489244902449124492244932449424495244962449724498244992450024501245022450324504245052450624507245082450924510245112451224513245142451524516245172451824519245202452124522245232452424525245262452724528245292453024531245322453324534245352453624537245382453924540245412454224543245442454524546245472454824549245502455124552245532455424555245562455724558245592456024561245622456324564245652456624567245682456924570245712457224573245742457524576245772457824579245802458124582245832458424585245862458724588245892459024591245922459324594245952459624597245982459924600246012460224603246042460524606246072460824609246102461124612246132461424615246162461724618246192462024621246222462324624246252462624627246282462924630246312463224633246342463524636246372463824639246402464124642246432464424645246462464724648246492465024651246522465324654246552465624657246582465924660246612466224663246642466524666246672466824669246702467124672246732467424675246762467724678246792468024681246822468324684246852468624687246882468924690246912469224693246942469524696246972469824699247002470124702247032470424705247062470724708247092471024711247122471324714247152471624717247182471924720247212472224723247242472524726247272472824729247302473124732247332473424735247362473724738247392474024741247422474324744247452474624747247482474924750247512475224753247542475524756247572475824759247602476124762247632476424765247662476724768247692477024771247722477324774247752477624777247782477924780247812478224783247842478524786247872478824789247902479124792247932479424795247962479724798247992480024801248022480324804248052480624807248082480924810248112481224813248142481524816248172481824819248202482124822248232482424825248262482724828248292483024831248322483324834248352483624837248382483924840248412484224843248442484524846248472484824849248502485124852248532485424855248562485724858248592486024861248622486324864248652486624867248682486924870248712487224873248742487524876248772487824879248802488124882248832488424885248862488724888248892489024891248922489324894248952489624897248982489924900249012490224903249042490524906249072490824909249102491124912249132491424915249162491724918249192492024921249222492324924249252492624927249282492924930249312493224933249342493524936249372493824939249402494124942249432494424945249462494724948249492495024951249522495324954249552495624957249582495924960249612496224963249642496524966249672496824969249702497124972249732497424975249762497724978249792498024981249822498324984249852498624987249882498924990249912499224993249942499524996249972499824999250002500125002250032500425005250062500725008250092501025011250122501325014250152501625017250182501925020250212502225023250242502525026250272502825029250302503125032250332503425035250362503725038250392504025041250422504325044250452504625047250482504925050250512505225053250542505525056250572505825059250602506125062250632506425065250662506725068250692507025071250722507325074250752507625077250782507925080250812508225083250842508525086250872508825089250902509125092250932509425095250962509725098250992510025101251022510325104251052510625107251082510925110251112511225113251142511525116251172511825119251202512125122251232512425125251262512725128251292513025131251322513325134251352513625137251382513925140251412514225143251442514525146251472514825149251502515125152251532515425155251562515725158251592516025161251622516325164251652516625167251682516925170251712517225173251742517525176251772517825179251802518125182251832518425185251862518725188251892519025191251922519325194251952519625197251982519925200252012520225203252042520525206252072520825209252102521125212252132521425215252162521725218252192522025221252222522325224252252522625227252282522925230252312523225233252342523525236252372523825239252402524125242252432524425245252462524725248252492525025251252522525325254252552525625257252582525925260252612526225263252642526525266252672526825269252702527125272252732527425275252762527725278252792528025281252822528325284252852528625287252882528925290252912529225293252942529525296252972529825299253002530125302253032530425305253062530725308253092531025311253122531325314253152531625317253182531925320253212532225323253242532525326253272532825329253302533125332253332533425335253362533725338253392534025341253422534325344253452534625347253482534925350253512535225353253542535525356253572535825359253602536125362253632536425365253662536725368253692537025371253722537325374253752537625377253782537925380253812538225383253842538525386253872538825389253902539125392253932539425395253962539725398253992540025401254022540325404254052540625407254082540925410254112541225413254142541525416254172541825419254202542125422254232542425425254262542725428254292543025431254322543325434254352543625437254382543925440254412544225443254442544525446254472544825449254502545125452254532545425455254562545725458254592546025461254622546325464254652546625467254682546925470254712547225473254742547525476254772547825479254802548125482254832548425485254862548725488254892549025491254922549325494254952549625497254982549925500255012550225503255042550525506255072550825509255102551125512255132551425515255162551725518255192552025521255222552325524255252552625527255282552925530255312553225533255342553525536255372553825539255402554125542255432554425545255462554725548255492555025551255522555325554255552555625557255582555925560255612556225563255642556525566255672556825569255702557125572255732557425575255762557725578255792558025581255822558325584255852558625587255882558925590255912559225593255942559525596255972559825599256002560125602256032560425605256062560725608256092561025611256122561325614256152561625617256182561925620256212562225623256242562525626256272562825629256302563125632256332563425635256362563725638256392564025641256422564325644256452564625647256482564925650256512565225653256542565525656256572565825659256602566125662256632566425665256662566725668256692567025671256722567325674256752567625677256782567925680256812568225683256842568525686256872568825689256902569125692256932569425695256962569725698256992570025701257022570325704257052570625707257082570925710257112571225713257142571525716257172571825719257202572125722257232572425725257262572725728257292573025731257322573325734257352573625737257382573925740257412574225743257442574525746257472574825749257502575125752257532575425755257562575725758257592576025761257622576325764257652576625767257682576925770257712577225773257742577525776257772577825779257802578125782257832578425785257862578725788257892579025791257922579325794257952579625797257982579925800258012580225803258042580525806258072580825809258102581125812258132581425815258162581725818258192582025821258222582325824258252582625827258282582925830258312583225833258342583525836258372583825839258402584125842258432584425845258462584725848258492585025851258522585325854258552585625857258582585925860258612586225863258642586525866258672586825869258702587125872258732587425875258762587725878258792588025881258822588325884258852588625887258882588925890258912589225893258942589525896258972589825899259002590125902259032590425905259062590725908259092591025911259122591325914259152591625917259182591925920259212592225923259242592525926259272592825929259302593125932259332593425935259362593725938259392594025941259422594325944259452594625947259482594925950259512595225953259542595525956259572595825959259602596125962259632596425965259662596725968259692597025971259722597325974259752597625977259782597925980259812598225983259842598525986259872598825989259902599125992259932599425995259962599725998259992600026001260022600326004260052600626007260082600926010260112601226013260142601526016260172601826019260202602126022260232602426025260262602726028260292603026031260322603326034260352603626037260382603926040260412604226043260442604526046260472604826049260502605126052260532605426055260562605726058260592606026061260622606326064260652606626067260682606926070260712607226073260742607526076260772607826079260802608126082260832608426085260862608726088260892609026091260922609326094260952609626097260982609926100261012610226103261042610526106261072610826109261102611126112261132611426115261162611726118261192612026121261222612326124261252612626127261282612926130261312613226133261342613526136261372613826139261402614126142261432614426145261462614726148261492615026151261522615326154261552615626157261582615926160261612616226163261642616526166261672616826169261702617126172261732617426175261762617726178261792618026181261822618326184261852618626187261882618926190261912619226193261942619526196261972619826199262002620126202262032620426205262062620726208262092621026211262122621326214262152621626217262182621926220262212622226223262242622526226262272622826229262302623126232262332623426235262362623726238262392624026241262422624326244262452624626247262482624926250262512625226253262542625526256262572625826259262602626126262262632626426265262662626726268262692627026271262722627326274262752627626277262782627926280262812628226283262842628526286262872628826289262902629126292262932629426295262962629726298262992630026301263022630326304263052630626307263082630926310263112631226313263142631526316263172631826319263202632126322263232632426325263262632726328263292633026331263322633326334263352633626337263382633926340263412634226343263442634526346263472634826349263502635126352263532635426355263562635726358263592636026361263622636326364263652636626367263682636926370263712637226373263742637526376263772637826379263802638126382263832638426385263862638726388263892639026391263922639326394263952639626397263982639926400264012640226403264042640526406264072640826409264102641126412264132641426415264162641726418264192642026421264222642326424264252642626427264282642926430264312643226433264342643526436264372643826439264402644126442264432644426445264462644726448264492645026451264522645326454264552645626457264582645926460264612646226463264642646526466264672646826469264702647126472264732647426475264762647726478264792648026481264822648326484264852648626487264882648926490264912649226493264942649526496264972649826499265002650126502265032650426505265062650726508265092651026511265122651326514265152651626517265182651926520265212652226523265242652526526265272652826529265302653126532265332653426535265362653726538265392654026541265422654326544265452654626547265482654926550265512655226553265542655526556265572655826559265602656126562265632656426565265662656726568265692657026571265722657326574265752657626577265782657926580265812658226583265842658526586265872658826589265902659126592265932659426595265962659726598265992660026601266022660326604266052660626607266082660926610266112661226613266142661526616266172661826619266202662126622266232662426625266262662726628266292663026631266322663326634266352663626637266382663926640266412664226643266442664526646266472664826649266502665126652266532665426655266562665726658266592666026661266622666326664266652666626667266682666926670266712667226673266742667526676266772667826679266802668126682266832668426685266862668726688266892669026691266922669326694266952669626697266982669926700267012670226703267042670526706267072670826709267102671126712267132671426715267162671726718267192672026721267222672326724267252672626727267282672926730267312673226733267342673526736267372673826739267402674126742267432674426745267462674726748267492675026751267522675326754267552675626757267582675926760267612676226763267642676526766267672676826769267702677126772267732677426775267762677726778267792678026781267822678326784267852678626787267882678926790267912679226793267942679526796267972679826799268002680126802268032680426805268062680726808268092681026811268122681326814268152681626817268182681926820268212682226823268242682526826268272682826829268302683126832268332683426835268362683726838268392684026841268422684326844268452684626847268482684926850268512685226853268542685526856268572685826859268602686126862268632686426865268662686726868268692687026871268722687326874268752687626877268782687926880268812688226883268842688526886268872688826889268902689126892268932689426895268962689726898268992690026901269022690326904269052690626907269082690926910269112691226913269142691526916269172691826919269202692126922269232692426925269262692726928269292693026931269322693326934269352693626937269382693926940269412694226943269442694526946269472694826949269502695126952269532695426955269562695726958269592696026961269622696326964269652696626967269682696926970269712697226973269742697526976269772697826979269802698126982269832698426985269862698726988269892699026991269922699326994269952699626997269982699927000270012700227003270042700527006270072700827009270102701127012270132701427015270162701727018270192702027021270222702327024270252702627027270282702927030270312703227033270342703527036270372703827039270402704127042270432704427045270462704727048270492705027051270522705327054270552705627057270582705927060270612706227063270642706527066270672706827069270702707127072270732707427075270762707727078270792708027081270822708327084270852708627087270882708927090270912709227093270942709527096270972709827099271002710127102271032710427105271062710727108271092711027111271122711327114271152711627117271182711927120271212712227123271242712527126271272712827129271302713127132271332713427135271362713727138271392714027141271422714327144271452714627147271482714927150271512715227153271542715527156271572715827159271602716127162271632716427165271662716727168271692717027171271722717327174271752717627177271782717927180271812718227183271842718527186271872718827189271902719127192271932719427195271962719727198271992720027201272022720327204272052720627207272082720927210272112721227213272142721527216272172721827219272202722127222272232722427225272262722727228272292723027231272322723327234272352723627237272382723927240272412724227243272442724527246272472724827249272502725127252272532725427255272562725727258272592726027261272622726327264272652726627267272682726927270272712727227273272742727527276272772727827279272802728127282272832728427285272862728727288272892729027291272922729327294272952729627297272982729927300273012730227303273042730527306273072730827309273102731127312273132731427315273162731727318273192732027321273222732327324273252732627327273282732927330273312733227333273342733527336273372733827339273402734127342273432734427345273462734727348273492735027351273522735327354273552735627357273582735927360273612736227363273642736527366273672736827369273702737127372273732737427375273762737727378273792738027381273822738327384273852738627387273882738927390273912739227393273942739527396273972739827399274002740127402274032740427405274062740727408274092741027411274122741327414274152741627417274182741927420274212742227423274242742527426274272742827429274302743127432274332743427435274362743727438274392744027441274422744327444274452744627447274482744927450274512745227453274542745527456274572745827459274602746127462274632746427465274662746727468274692747027471274722747327474274752747627477274782747927480274812748227483274842748527486274872748827489274902749127492274932749427495274962749727498274992750027501275022750327504275052750627507275082750927510275112751227513275142751527516275172751827519275202752127522275232752427525275262752727528275292753027531275322753327534275352753627537275382753927540275412754227543275442754527546275472754827549275502755127552275532755427555275562755727558275592756027561275622756327564275652756627567275682756927570275712757227573275742757527576275772757827579275802758127582275832758427585275862758727588275892759027591275922759327594275952759627597275982759927600276012760227603276042760527606276072760827609276102761127612276132761427615276162761727618276192762027621276222762327624276252762627627276282762927630276312763227633276342763527636276372763827639276402764127642276432764427645276462764727648276492765027651276522765327654276552765627657276582765927660276612766227663276642766527666276672766827669276702767127672276732767427675276762767727678276792768027681276822768327684276852768627687276882768927690276912769227693276942769527696276972769827699277002770127702277032770427705277062770727708277092771027711277122771327714277152771627717277182771927720277212772227723277242772527726277272772827729277302773127732277332773427735277362773727738277392774027741277422774327744277452774627747277482774927750277512775227753277542775527756277572775827759277602776127762277632776427765277662776727768277692777027771277722777327774277752777627777277782777927780277812778227783277842778527786277872778827789277902779127792277932779427795277962779727798277992780027801278022780327804278052780627807278082780927810278112781227813278142781527816278172781827819278202782127822278232782427825278262782727828278292783027831278322783327834278352783627837278382783927840278412784227843278442784527846278472784827849278502785127852278532785427855278562785727858278592786027861278622786327864278652786627867278682786927870278712787227873278742787527876278772787827879278802788127882278832788427885278862788727888278892789027891278922789327894278952789627897278982789927900279012790227903279042790527906279072790827909279102791127912279132791427915279162791727918279192792027921279222792327924279252792627927279282792927930279312793227933279342793527936279372793827939279402794127942279432794427945279462794727948279492795027951279522795327954279552795627957279582795927960279612796227963279642796527966279672796827969279702797127972279732797427975279762797727978279792798027981279822798327984279852798627987279882798927990279912799227993279942799527996279972799827999280002800128002280032800428005280062800728008280092801028011280122801328014280152801628017280182801928020280212802228023280242802528026280272802828029280302803128032280332803428035280362803728038280392804028041280422804328044280452804628047280482804928050280512805228053280542805528056280572805828059280602806128062280632806428065280662806728068280692807028071280722807328074280752807628077280782807928080280812808228083280842808528086280872808828089280902809128092280932809428095280962809728098280992810028101281022810328104281052810628107281082810928110281112811228113281142811528116281172811828119281202812128122281232812428125281262812728128281292813028131281322813328134281352813628137281382813928140281412814228143281442814528146281472814828149281502815128152281532815428155281562815728158281592816028161281622816328164281652816628167281682816928170281712817228173281742817528176281772817828179281802818128182281832818428185281862818728188281892819028191281922819328194281952819628197281982819928200282012820228203282042820528206282072820828209282102821128212282132821428215282162821728218282192822028221282222822328224282252822628227282282822928230282312823228233282342823528236282372823828239282402824128242282432824428245282462824728248282492825028251282522825328254282552825628257282582825928260282612826228263282642826528266282672826828269282702827128272282732827428275282762827728278282792828028281282822828328284282852828628287282882828928290282912829228293282942829528296282972829828299283002830128302283032830428305283062830728308283092831028311283122831328314283152831628317283182831928320283212832228323283242832528326283272832828329283302833128332283332833428335283362833728338283392834028341283422834328344283452834628347283482834928350283512835228353283542835528356283572835828359283602836128362283632836428365283662836728368283692837028371283722837328374283752837628377283782837928380283812838228383283842838528386283872838828389283902839128392283932839428395283962839728398283992840028401284022840328404284052840628407284082840928410284112841228413284142841528416284172841828419284202842128422284232842428425284262842728428284292843028431284322843328434284352843628437284382843928440284412844228443284442844528446284472844828449284502845128452284532845428455284562845728458284592846028461284622846328464284652846628467284682846928470284712847228473284742847528476284772847828479284802848128482284832848428485284862848728488284892849028491284922849328494284952849628497284982849928500285012850228503285042850528506285072850828509285102851128512285132851428515285162851728518285192852028521285222852328524285252852628527285282852928530285312853228533285342853528536285372853828539285402854128542285432854428545285462854728548285492855028551285522855328554285552855628557285582855928560285612856228563285642856528566285672856828569285702857128572285732857428575285762857728578285792858028581285822858328584285852858628587285882858928590285912859228593285942859528596285972859828599286002860128602286032860428605286062860728608286092861028611286122861328614286152861628617286182861928620286212862228623286242862528626286272862828629286302863128632286332863428635286362863728638286392864028641286422864328644286452864628647286482864928650286512865228653286542865528656286572865828659286602866128662286632866428665286662866728668286692867028671286722867328674286752867628677286782867928680286812868228683286842868528686286872868828689286902869128692286932869428695286962869728698286992870028701287022870328704287052870628707287082870928710287112871228713287142871528716287172871828719287202872128722287232872428725287262872728728287292873028731287322873328734287352873628737287382873928740287412874228743287442874528746287472874828749287502875128752287532875428755287562875728758287592876028761287622876328764287652876628767287682876928770287712877228773287742877528776287772877828779287802878128782287832878428785287862878728788287892879028791287922879328794287952879628797287982879928800288012880228803288042880528806288072880828809288102881128812288132881428815288162881728818288192882028821288222882328824288252882628827288282882928830288312883228833288342883528836288372883828839288402884128842288432884428845288462884728848288492885028851288522885328854288552885628857288582885928860288612886228863288642886528866288672886828869288702887128872288732887428875288762887728878288792888028881288822888328884288852888628887288882888928890288912889228893288942889528896288972889828899289002890128902289032890428905289062890728908289092891028911289122891328914289152891628917289182891928920289212892228923289242892528926289272892828929289302893128932289332893428935289362893728938289392894028941289422894328944289452894628947289482894928950289512895228953289542895528956289572895828959289602896128962289632896428965289662896728968289692897028971289722897328974289752897628977289782897928980289812898228983289842898528986289872898828989289902899128992289932899428995289962899728998289992900029001290022900329004290052900629007290082900929010290112901229013290142901529016290172901829019290202902129022290232902429025290262902729028290292903029031290322903329034290352903629037290382903929040290412904229043290442904529046290472904829049290502905129052290532905429055290562905729058290592906029061290622906329064290652906629067290682906929070290712907229073290742907529076290772907829079290802908129082290832908429085290862908729088290892909029091290922909329094290952909629097290982909929100291012910229103291042910529106291072910829109291102911129112291132911429115291162911729118291192912029121291222912329124291252912629127291282912929130291312913229133291342913529136291372913829139291402914129142291432914429145291462914729148291492915029151291522915329154291552915629157291582915929160291612916229163291642916529166291672916829169291702917129172291732917429175291762917729178291792918029181291822918329184291852918629187291882918929190291912919229193291942919529196291972919829199292002920129202292032920429205292062920729208292092921029211292122921329214292152921629217292182921929220292212922229223292242922529226292272922829229292302923129232292332923429235292362923729238292392924029241292422924329244292452924629247292482924929250292512925229253292542925529256292572925829259292602926129262292632926429265292662926729268292692927029271292722927329274292752927629277292782927929280292812928229283292842928529286292872928829289292902929129292292932929429295292962929729298292992930029301293022930329304293052930629307293082930929310293112931229313293142931529316293172931829319293202932129322293232932429325293262932729328293292933029331293322933329334293352933629337293382933929340293412934229343293442934529346293472934829349293502935129352293532935429355293562935729358293592936029361293622936329364293652936629367293682936929370293712937229373293742937529376293772937829379293802938129382293832938429385293862938729388293892939029391293922939329394293952939629397293982939929400294012940229403294042940529406294072940829409294102941129412294132941429415294162941729418294192942029421294222942329424294252942629427294282942929430294312943229433294342943529436294372943829439294402944129442294432944429445294462944729448294492945029451294522945329454294552945629457294582945929460294612946229463294642946529466294672946829469294702947129472294732947429475294762947729478294792948029481294822948329484294852948629487294882948929490294912949229493294942949529496294972949829499295002950129502295032950429505295062950729508295092951029511295122951329514295152951629517295182951929520295212952229523295242952529526295272952829529295302953129532295332953429535295362953729538295392954029541295422954329544295452954629547295482954929550295512955229553295542955529556295572955829559295602956129562295632956429565295662956729568295692957029571295722957329574295752957629577295782957929580295812958229583295842958529586295872958829589295902959129592295932959429595295962959729598295992960029601296022960329604296052960629607296082960929610296112961229613296142961529616296172961829619296202962129622296232962429625296262962729628296292963029631296322963329634296352963629637296382963929640296412964229643296442964529646296472964829649296502965129652296532965429655296562965729658296592966029661296622966329664296652966629667296682966929670296712967229673296742967529676296772967829679296802968129682296832968429685296862968729688296892969029691296922969329694296952969629697296982969929700297012970229703297042970529706297072970829709297102971129712297132971429715297162971729718297192972029721297222972329724297252972629727297282972929730297312973229733297342973529736297372973829739297402974129742297432974429745297462974729748297492975029751297522975329754297552975629757297582975929760297612976229763297642976529766297672976829769297702977129772297732977429775297762977729778297792978029781297822978329784297852978629787297882978929790297912979229793297942979529796297972979829799298002980129802298032980429805298062980729808298092981029811298122981329814298152981629817298182981929820298212982229823298242982529826298272982829829298302983129832298332983429835298362983729838298392984029841298422984329844298452984629847298482984929850298512985229853298542985529856298572985829859298602986129862298632986429865298662986729868298692987029871298722987329874298752987629877298782987929880298812988229883298842988529886298872988829889298902989129892298932989429895298962989729898298992990029901299022990329904299052990629907299082990929910299112991229913299142991529916299172991829919299202992129922299232992429925299262992729928299292993029931299322993329934299352993629937299382993929940299412994229943299442994529946299472994829949299502995129952299532995429955299562995729958299592996029961299622996329964299652996629967299682996929970299712997229973299742997529976299772997829979299802998129982299832998429985299862998729988299892999029991299922999329994299952999629997299982999930000300013000230003300043000530006300073000830009300103001130012300133001430015300163001730018300193002030021300223002330024300253002630027300283002930030300313003230033300343003530036300373003830039300403004130042300433004430045300463004730048300493005030051300523005330054300553005630057300583005930060300613006230063300643006530066300673006830069300703007130072300733007430075300763007730078300793008030081300823008330084300853008630087300883008930090300913009230093300943009530096300973009830099301003010130102301033010430105301063010730108301093011030111301123011330114301153011630117301183011930120301213012230123301243012530126301273012830129301303013130132301333013430135301363013730138301393014030141301423014330144301453014630147301483014930150301513015230153301543015530156301573015830159301603016130162301633016430165301663016730168301693017030171301723017330174301753017630177301783017930180301813018230183301843018530186301873018830189301903019130192301933019430195301963019730198301993020030201302023020330204302053020630207302083020930210302113021230213302143021530216302173021830219302203022130222302233022430225302263022730228302293023030231302323023330234302353023630237302383023930240302413024230243302443024530246302473024830249302503025130252302533025430255302563025730258302593026030261302623026330264302653026630267302683026930270302713027230273302743027530276302773027830279302803028130282302833028430285302863028730288302893029030291302923029330294302953029630297302983029930300303013030230303303043030530306303073030830309303103031130312303133031430315303163031730318303193032030321303223032330324303253032630327303283032930330303313033230333303343033530336303373033830339303403034130342303433034430345303463034730348303493035030351303523035330354303553035630357303583035930360303613036230363303643036530366303673036830369303703037130372303733037430375303763037730378303793038030381303823038330384303853038630387303883038930390303913039230393303943039530396303973039830399304003040130402304033040430405304063040730408304093041030411304123041330414304153041630417304183041930420304213042230423304243042530426304273042830429304303043130432304333043430435304363043730438304393044030441304423044330444304453044630447304483044930450304513045230453304543045530456304573045830459304603046130462304633046430465304663046730468304693047030471304723047330474304753047630477304783047930480304813048230483304843048530486304873048830489304903049130492304933049430495304963049730498304993050030501305023050330504305053050630507305083050930510305113051230513305143051530516305173051830519305203052130522305233052430525305263052730528305293053030531305323053330534305353053630537305383053930540305413054230543305443054530546305473054830549305503055130552305533055430555305563055730558305593056030561305623056330564305653056630567305683056930570305713057230573305743057530576305773057830579305803058130582305833058430585305863058730588305893059030591305923059330594305953059630597305983059930600306013060230603306043060530606306073060830609306103061130612306133061430615306163061730618306193062030621306223062330624306253062630627306283062930630306313063230633306343063530636306373063830639306403064130642306433064430645306463064730648306493065030651306523065330654306553065630657306583065930660306613066230663306643066530666306673066830669306703067130672306733067430675306763067730678306793068030681306823068330684306853068630687306883068930690306913069230693306943069530696306973069830699307003070130702307033070430705307063070730708307093071030711307123071330714307153071630717307183071930720307213072230723307243072530726307273072830729307303073130732307333073430735307363073730738307393074030741307423074330744307453074630747307483074930750307513075230753307543075530756307573075830759307603076130762307633076430765307663076730768307693077030771307723077330774307753077630777307783077930780307813078230783307843078530786307873078830789307903079130792307933079430795307963079730798307993080030801308023080330804308053080630807308083080930810308113081230813308143081530816308173081830819308203082130822308233082430825308263082730828308293083030831308323083330834308353083630837308383083930840308413084230843308443084530846308473084830849308503085130852308533085430855308563085730858308593086030861308623086330864308653086630867308683086930870308713087230873308743087530876308773087830879308803088130882308833088430885308863088730888308893089030891308923089330894308953089630897308983089930900309013090230903309043090530906309073090830909309103091130912309133091430915309163091730918309193092030921309223092330924309253092630927309283092930930309313093230933309343093530936309373093830939309403094130942309433094430945309463094730948309493095030951309523095330954309553095630957309583095930960309613096230963309643096530966309673096830969309703097130972309733097430975309763097730978309793098030981309823098330984309853098630987309883098930990309913099230993309943099530996309973099830999310003100131002310033100431005310063100731008310093101031011310123101331014310153101631017310183101931020310213102231023310243102531026310273102831029310303103131032310333103431035310363103731038310393104031041310423104331044310453104631047310483104931050310513105231053310543105531056310573105831059310603106131062310633106431065310663106731068310693107031071310723107331074310753107631077310783107931080310813108231083310843108531086310873108831089310903109131092310933109431095310963109731098310993110031101311023110331104311053110631107311083110931110311113111231113311143111531116311173111831119311203112131122311233112431125311263112731128311293113031131311323113331134311353113631137311383113931140311413114231143311443114531146311473114831149311503115131152311533115431155311563115731158311593116031161311623116331164311653116631167311683116931170311713117231173311743117531176311773117831179311803118131182311833118431185311863118731188311893119031191311923119331194311953119631197311983119931200312013120231203312043120531206312073120831209312103121131212312133121431215312163121731218312193122031221312223122331224312253122631227312283122931230312313123231233312343123531236312373123831239312403124131242312433124431245312463124731248312493125031251312523125331254312553125631257312583125931260312613126231263312643126531266312673126831269312703127131272312733127431275312763127731278312793128031281312823128331284312853128631287312883128931290312913129231293312943129531296312973129831299313003130131302313033130431305313063130731308313093131031311313123131331314313153131631317313183131931320313213132231323313243132531326313273132831329313303133131332313333133431335313363133731338313393134031341313423134331344313453134631347313483134931350313513135231353313543135531356313573135831359313603136131362313633136431365313663136731368313693137031371313723137331374313753137631377313783137931380313813138231383313843138531386313873138831389313903139131392313933139431395313963139731398313993140031401314023140331404314053140631407314083140931410314113141231413314143141531416314173141831419314203142131422314233142431425314263142731428314293143031431314323143331434314353143631437314383143931440314413144231443314443144531446314473144831449314503145131452314533145431455314563145731458314593146031461314623146331464314653146631467314683146931470314713147231473314743147531476314773147831479314803148131482314833148431485314863148731488314893149031491314923149331494314953149631497314983149931500315013150231503315043150531506315073150831509315103151131512315133151431515315163151731518315193152031521315223152331524315253152631527315283152931530315313153231533315343153531536315373153831539315403154131542315433154431545315463154731548315493155031551315523155331554315553155631557315583155931560315613156231563315643156531566315673156831569315703157131572315733157431575315763157731578315793158031581315823158331584315853158631587315883158931590315913159231593315943159531596315973159831599316003160131602316033160431605316063160731608316093161031611316123161331614316153161631617316183161931620316213162231623316243162531626316273162831629316303163131632316333163431635316363163731638316393164031641316423164331644316453164631647316483164931650316513165231653316543165531656316573165831659316603166131662316633166431665316663166731668316693167031671316723167331674316753167631677316783167931680316813168231683316843168531686316873168831689316903169131692316933169431695316963169731698316993170031701317023170331704317053170631707317083170931710317113171231713317143171531716317173171831719317203172131722317233172431725317263172731728317293173031731317323173331734317353173631737317383173931740317413174231743317443174531746317473174831749317503175131752317533175431755317563175731758317593176031761317623176331764317653176631767317683176931770317713177231773317743177531776317773177831779317803178131782317833178431785317863178731788317893179031791317923179331794317953179631797317983179931800318013180231803318043180531806318073180831809318103181131812318133181431815318163181731818318193182031821318223182331824318253182631827318283182931830318313183231833318343183531836318373183831839318403184131842318433184431845318463184731848318493185031851318523185331854318553185631857318583185931860318613186231863318643186531866318673186831869318703187131872318733187431875318763187731878318793188031881318823188331884318853188631887318883188931890318913189231893318943189531896318973189831899319003190131902319033190431905319063190731908319093191031911319123191331914319153191631917319183191931920319213192231923319243192531926319273192831929319303193131932319333193431935319363193731938319393194031941319423194331944319453194631947319483194931950319513195231953319543195531956319573195831959319603196131962319633196431965319663196731968319693197031971319723197331974319753197631977319783197931980319813198231983319843198531986319873198831989319903199131992319933199431995319963199731998319993200032001320023200332004320053200632007320083200932010320113201232013320143201532016320173201832019320203202132022320233202432025320263202732028320293203032031320323203332034320353203632037320383203932040320413204232043320443204532046320473204832049320503205132052320533205432055320563205732058320593206032061320623206332064320653206632067320683206932070320713207232073320743207532076320773207832079320803208132082320833208432085320863208732088320893209032091320923209332094320953209632097320983209932100321013210232103321043210532106321073210832109321103211132112321133211432115321163211732118321193212032121321223212332124321253212632127321283212932130321313213232133321343213532136321373213832139321403214132142321433214432145321463214732148321493215032151321523215332154321553215632157321583215932160321613216232163321643216532166321673216832169321703217132172321733217432175321763217732178321793218032181321823218332184321853218632187321883218932190321913219232193321943219532196321973219832199322003220132202322033220432205322063220732208322093221032211322123221332214322153221632217322183221932220322213222232223322243222532226322273222832229322303223132232322333223432235322363223732238322393224032241322423224332244322453224632247322483224932250322513225232253322543225532256322573225832259322603226132262322633226432265322663226732268322693227032271322723227332274322753227632277322783227932280322813228232283322843228532286322873228832289322903229132292322933229432295322963229732298322993230032301323023230332304323053230632307323083230932310323113231232313323143231532316323173231832319323203232132322323233232432325323263232732328323293233032331323323233332334323353233632337323383233932340323413234232343323443234532346323473234832349323503235132352323533235432355323563235732358323593236032361323623236332364323653236632367323683236932370323713237232373323743237532376323773237832379323803238132382323833238432385323863238732388323893239032391323923239332394323953239632397323983239932400324013240232403324043240532406324073240832409324103241132412324133241432415324163241732418324193242032421324223242332424324253242632427324283242932430324313243232433324343243532436324373243832439324403244132442324433244432445324463244732448324493245032451324523245332454324553245632457324583245932460324613246232463324643246532466324673246832469324703247132472324733247432475324763247732478324793248032481324823248332484324853248632487324883248932490324913249232493324943249532496324973249832499325003250132502325033250432505325063250732508325093251032511325123251332514325153251632517325183251932520325213252232523325243252532526325273252832529325303253132532325333253432535325363253732538325393254032541325423254332544325453254632547325483254932550325513255232553325543255532556325573255832559325603256132562325633256432565325663256732568325693257032571325723257332574325753257632577325783257932580325813258232583325843258532586325873258832589325903259132592325933259432595325963259732598325993260032601326023260332604326053260632607326083260932610326113261232613326143261532616326173261832619326203262132622326233262432625326263262732628326293263032631326323263332634326353263632637326383263932640326413264232643326443264532646326473264832649326503265132652326533265432655326563265732658326593266032661326623266332664326653266632667326683266932670326713267232673326743267532676326773267832679326803268132682326833268432685326863268732688326893269032691326923269332694326953269632697326983269932700327013270232703327043270532706327073270832709327103271132712327133271432715327163271732718327193272032721327223272332724327253272632727327283272932730327313273232733327343273532736327373273832739327403274132742327433274432745327463274732748327493275032751327523275332754327553275632757327583275932760327613276232763327643276532766327673276832769327703277132772327733277432775327763277732778327793278032781327823278332784327853278632787327883278932790327913279232793327943279532796327973279832799328003280132802328033280432805328063280732808328093281032811328123281332814328153281632817328183281932820328213282232823328243282532826328273282832829328303283132832328333283432835328363283732838328393284032841328423284332844328453284632847328483284932850328513285232853328543285532856328573285832859328603286132862328633286432865328663286732868328693287032871328723287332874328753287632877328783287932880328813288232883328843288532886328873288832889328903289132892328933289432895328963289732898328993290032901329023290332904329053290632907329083290932910329113291232913329143291532916329173291832919329203292132922329233292432925329263292732928329293293032931329323293332934329353293632937329383293932940329413294232943329443294532946329473294832949329503295132952329533295432955329563295732958329593296032961329623296332964329653296632967329683296932970329713297232973329743297532976329773297832979329803298132982329833298432985329863298732988329893299032991329923299332994329953299632997329983299933000330013300233003330043300533006330073300833009330103301133012330133301433015330163301733018330193302033021330223302333024330253302633027330283302933030330313303233033330343303533036330373303833039330403304133042330433304433045330463304733048330493305033051330523305333054330553305633057330583305933060330613306233063330643306533066330673306833069330703307133072330733307433075330763307733078330793308033081330823308333084330853308633087330883308933090330913309233093330943309533096330973309833099331003310133102331033310433105331063310733108331093311033111331123311333114331153311633117331183311933120331213312233123331243312533126331273312833129331303313133132331333313433135331363313733138331393314033141331423314333144331453314633147331483314933150331513315233153331543315533156331573315833159331603316133162331633316433165331663316733168331693317033171331723317333174331753317633177331783317933180331813318233183331843318533186331873318833189331903319133192331933319433195331963319733198331993320033201332023320333204332053320633207332083320933210332113321233213332143321533216332173321833219332203322133222332233322433225332263322733228332293323033231332323323333234332353323633237332383323933240332413324233243332443324533246332473324833249332503325133252332533325433255332563325733258332593326033261332623326333264332653326633267332683326933270332713327233273332743327533276332773327833279332803328133282332833328433285332863328733288332893329033291332923329333294332953329633297332983329933300333013330233303333043330533306333073330833309333103331133312333133331433315333163331733318333193332033321333223332333324333253332633327333283332933330333313333233333333343333533336333373333833339333403334133342333433334433345333463334733348333493335033351333523335333354333553335633357333583335933360333613336233363333643336533366333673336833369333703337133372333733337433375333763337733378333793338033381333823338333384333853338633387333883338933390333913339233393333943339533396333973339833399334003340133402334033340433405334063340733408334093341033411334123341333414334153341633417334183341933420334213342233423334243342533426334273342833429334303343133432334333343433435334363343733438334393344033441334423344333444334453344633447334483344933450334513345233453334543345533456334573345833459334603346133462334633346433465334663346733468334693347033471334723347333474334753347633477334783347933480334813348233483334843348533486334873348833489334903349133492334933349433495334963349733498334993350033501335023350333504335053350633507335083350933510335113351233513335143351533516335173351833519335203352133522335233352433525335263352733528335293353033531335323353333534335353353633537335383353933540335413354233543335443354533546335473354833549335503355133552335533355433555335563355733558335593356033561335623356333564335653356633567335683356933570335713357233573335743357533576335773357833579335803358133582335833358433585335863358733588335893359033591335923359333594335953359633597335983359933600336013360233603336043360533606336073360833609336103361133612336133361433615336163361733618336193362033621336223362333624336253362633627336283362933630336313363233633336343363533636336373363833639336403364133642336433364433645336463364733648336493365033651336523365333654336553365633657336583365933660336613366233663336643366533666336673366833669336703367133672336733367433675336763367733678336793368033681336823368333684336853368633687336883368933690336913369233693336943369533696336973369833699337003370133702337033370433705337063370733708337093371033711337123371333714337153371633717337183371933720337213372233723337243372533726337273372833729337303373133732337333373433735337363373733738337393374033741337423374333744337453374633747337483374933750337513375233753337543375533756337573375833759337603376133762337633376433765337663376733768337693377033771337723377333774337753377633777337783377933780337813378233783337843378533786337873378833789337903379133792337933379433795337963379733798337993380033801338023380333804338053380633807338083380933810338113381233813338143381533816338173381833819338203382133822338233382433825338263382733828338293383033831338323383333834338353383633837338383383933840338413384233843338443384533846338473384833849338503385133852338533385433855338563385733858338593386033861338623386333864338653386633867338683386933870338713387233873338743387533876338773387833879338803388133882338833388433885338863388733888338893389033891338923389333894338953389633897338983389933900339013390233903339043390533906339073390833909339103391133912339133391433915339163391733918339193392033921339223392333924339253392633927339283392933930339313393233933339343393533936339373393833939339403394133942339433394433945339463394733948339493395033951339523395333954339553395633957339583395933960339613396233963339643396533966339673396833969339703397133972339733397433975339763397733978339793398033981339823398333984339853398633987339883398933990339913399233993339943399533996339973399833999340003400134002340033400434005340063400734008340093401034011340123401334014340153401634017340183401934020340213402234023340243402534026340273402834029340303403134032340333403434035340363403734038340393404034041340423404334044340453404634047340483404934050340513405234053340543405534056340573405834059340603406134062340633406434065340663406734068340693407034071340723407334074340753407634077340783407934080340813408234083340843408534086340873408834089340903409134092340933409434095340963409734098340993410034101341023410334104341053410634107341083410934110341113411234113341143411534116341173411834119341203412134122341233412434125341263412734128341293413034131341323413334134341353413634137341383413934140341413414234143341443414534146341473414834149341503415134152341533415434155341563415734158341593416034161341623416334164341653416634167341683416934170341713417234173341743417534176341773417834179341803418134182341833418434185341863418734188341893419034191341923419334194341953419634197341983419934200342013420234203342043420534206342073420834209342103421134212342133421434215342163421734218342193422034221342223422334224342253422634227342283422934230342313423234233342343423534236342373423834239342403424134242342433424434245342463424734248342493425034251342523425334254342553425634257342583425934260342613426234263342643426534266342673426834269342703427134272342733427434275342763427734278342793428034281342823428334284342853428634287342883428934290342913429234293342943429534296342973429834299343003430134302343033430434305343063430734308343093431034311343123431334314343153431634317343183431934320343213432234323343243432534326343273432834329343303433134332343333433434335343363433734338343393434034341343423434334344343453434634347343483434934350343513435234353343543435534356343573435834359343603436134362343633436434365343663436734368343693437034371343723437334374343753437634377343783437934380343813438234383343843438534386343873438834389343903439134392343933439434395343963439734398343993440034401344023440334404344053440634407344083440934410344113441234413344143441534416344173441834419344203442134422344233442434425344263442734428344293443034431344323443334434344353443634437344383443934440344413444234443344443444534446344473444834449344503445134452344533445434455344563445734458344593446034461344623446334464344653446634467344683446934470344713447234473344743447534476344773447834479344803448134482344833448434485344863448734488344893449034491344923449334494344953449634497344983449934500345013450234503345043450534506345073450834509345103451134512345133451434515345163451734518345193452034521345223452334524345253452634527345283452934530345313453234533345343453534536345373453834539345403454134542345433454434545345463454734548345493455034551345523455334554345553455634557345583455934560345613456234563345643456534566345673456834569345703457134572345733457434575345763457734578345793458034581345823458334584345853458634587345883458934590345913459234593345943459534596345973459834599346003460134602346033460434605346063460734608346093461034611346123461334614346153461634617346183461934620346213462234623346243462534626346273462834629346303463134632346333463434635346363463734638346393464034641346423464334644346453464634647346483464934650346513465234653346543465534656346573465834659346603466134662346633466434665346663466734668346693467034671346723467334674346753467634677346783467934680346813468234683346843468534686346873468834689346903469134692346933469434695346963469734698346993470034701347023470334704347053470634707347083470934710347113471234713347143471534716347173471834719347203472134722347233472434725347263472734728347293473034731347323473334734347353473634737347383473934740347413474234743347443474534746347473474834749347503475134752347533475434755347563475734758347593476034761347623476334764347653476634767347683476934770347713477234773347743477534776347773477834779347803478134782347833478434785347863478734788347893479034791347923479334794347953479634797347983479934800348013480234803348043480534806348073480834809348103481134812348133481434815348163481734818348193482034821348223482334824348253482634827348283482934830348313483234833348343483534836348373483834839348403484134842348433484434845348463484734848348493485034851348523485334854348553485634857348583485934860348613486234863348643486534866348673486834869348703487134872348733487434875348763487734878348793488034881348823488334884348853488634887348883488934890348913489234893348943489534896348973489834899349003490134902349033490434905349063490734908349093491034911349123491334914349153491634917349183491934920349213492234923349243492534926349273492834929349303493134932349333493434935349363493734938349393494034941349423494334944349453494634947349483494934950349513495234953349543495534956349573495834959349603496134962349633496434965349663496734968349693497034971349723497334974349753497634977349783497934980349813498234983349843498534986349873498834989349903499134992349933499434995349963499734998349993500035001350023500335004350053500635007350083500935010350113501235013350143501535016350173501835019350203502135022350233502435025350263502735028350293503035031350323503335034350353503635037350383503935040350413504235043350443504535046350473504835049350503505135052350533505435055350563505735058350593506035061350623506335064350653506635067350683506935070350713507235073350743507535076350773507835079350803508135082350833508435085350863508735088350893509035091350923509335094350953509635097350983509935100351013510235103351043510535106351073510835109351103511135112351133511435115351163511735118351193512035121351223512335124351253512635127351283512935130351313513235133351343513535136351373513835139351403514135142351433514435145351463514735148351493515035151351523515335154351553515635157351583515935160351613516235163351643516535166351673516835169351703517135172351733517435175351763517735178351793518035181351823518335184351853518635187351883518935190351913519235193351943519535196351973519835199352003520135202352033520435205352063520735208352093521035211352123521335214352153521635217352183521935220352213522235223352243522535226352273522835229352303523135232352333523435235352363523735238352393524035241352423524335244352453524635247352483524935250352513525235253352543525535256352573525835259352603526135262352633526435265352663526735268352693527035271352723527335274352753527635277352783527935280352813528235283352843528535286352873528835289352903529135292352933529435295352963529735298352993530035301353023530335304353053530635307353083530935310353113531235313353143531535316353173531835319353203532135322353233532435325353263532735328353293533035331353323533335334353353533635337353383533935340353413534235343353443534535346353473534835349353503535135352353533535435355353563535735358353593536035361353623536335364353653536635367353683536935370353713537235373353743537535376353773537835379353803538135382353833538435385353863538735388353893539035391353923539335394353953539635397353983539935400354013540235403354043540535406354073540835409354103541135412354133541435415354163541735418354193542035421354223542335424354253542635427354283542935430354313543235433354343543535436354373543835439354403544135442354433544435445354463544735448354493545035451354523545335454354553545635457354583545935460354613546235463354643546535466354673546835469354703547135472354733547435475354763547735478354793548035481354823548335484354853548635487354883548935490354913549235493354943549535496354973549835499355003550135502355033550435505355063550735508355093551035511355123551335514355153551635517355183551935520355213552235523355243552535526355273552835529355303553135532355333553435535355363553735538355393554035541355423554335544355453554635547355483554935550355513555235553355543555535556355573555835559355603556135562355633556435565355663556735568355693557035571355723557335574355753557635577355783557935580355813558235583355843558535586355873558835589355903559135592355933559435595355963559735598355993560035601356023560335604356053560635607356083560935610356113561235613356143561535616356173561835619356203562135622356233562435625356263562735628356293563035631356323563335634356353563635637356383563935640356413564235643356443564535646356473564835649356503565135652356533565435655356563565735658356593566035661356623566335664356653566635667356683566935670356713567235673356743567535676356773567835679356803568135682356833568435685356863568735688356893569035691356923569335694356953569635697356983569935700357013570235703357043570535706357073570835709357103571135712357133571435715357163571735718357193572035721357223572335724357253572635727357283572935730357313573235733357343573535736357373573835739357403574135742357433574435745357463574735748357493575035751357523575335754357553575635757357583575935760357613576235763357643576535766357673576835769357703577135772357733577435775357763577735778357793578035781357823578335784357853578635787357883578935790357913579235793357943579535796357973579835799358003580135802358033580435805358063580735808358093581035811358123581335814358153581635817358183581935820358213582235823358243582535826358273582835829358303583135832358333583435835358363583735838358393584035841358423584335844358453584635847358483584935850358513585235853358543585535856358573585835859358603586135862358633586435865358663586735868358693587035871358723587335874358753587635877358783587935880358813588235883358843588535886358873588835889358903589135892358933589435895358963589735898358993590035901359023590335904359053590635907359083590935910359113591235913359143591535916359173591835919359203592135922359233592435925359263592735928359293593035931359323593335934359353593635937359383593935940359413594235943359443594535946359473594835949359503595135952359533595435955359563595735958359593596035961359623596335964359653596635967359683596935970359713597235973359743597535976359773597835979359803598135982359833598435985359863598735988359893599035991359923599335994359953599635997359983599936000360013600236003360043600536006360073600836009360103601136012360133601436015360163601736018360193602036021360223602336024360253602636027360283602936030360313603236033360343603536036360373603836039360403604136042360433604436045360463604736048360493605036051360523605336054360553605636057360583605936060360613606236063360643606536066360673606836069360703607136072360733607436075360763607736078360793608036081360823608336084360853608636087360883608936090360913609236093360943609536096360973609836099361003610136102361033610436105361063610736108361093611036111361123611336114361153611636117361183611936120361213612236123361243612536126361273612836129361303613136132361333613436135361363613736138361393614036141361423614336144361453614636147361483614936150361513615236153361543615536156361573615836159361603616136162361633616436165361663616736168361693617036171361723617336174361753617636177361783617936180361813618236183361843618536186361873618836189361903619136192361933619436195361963619736198361993620036201362023620336204362053620636207362083620936210362113621236213362143621536216362173621836219362203622136222362233622436225362263622736228362293623036231362323623336234362353623636237362383623936240362413624236243362443624536246362473624836249362503625136252362533625436255362563625736258362593626036261362623626336264362653626636267362683626936270362713627236273362743627536276362773627836279362803628136282362833628436285362863628736288362893629036291362923629336294362953629636297362983629936300363013630236303363043630536306363073630836309363103631136312363133631436315363163631736318363193632036321363223632336324363253632636327363283632936330363313633236333363343633536336363373633836339363403634136342363433634436345363463634736348363493635036351363523635336354363553635636357363583635936360363613636236363363643636536366363673636836369363703637136372363733637436375363763637736378363793638036381363823638336384363853638636387363883638936390363913639236393363943639536396363973639836399364003640136402364033640436405364063640736408364093641036411364123641336414364153641636417364183641936420364213642236423364243642536426364273642836429364303643136432364333643436435364363643736438364393644036441364423644336444364453644636447364483644936450364513645236453364543645536456364573645836459364603646136462364633646436465364663646736468364693647036471364723647336474364753647636477364783647936480364813648236483364843648536486364873648836489364903649136492364933649436495364963649736498364993650036501365023650336504365053650636507365083650936510365113651236513365143651536516365173651836519365203652136522365233652436525365263652736528365293653036531365323653336534365353653636537365383653936540365413654236543365443654536546365473654836549365503655136552365533655436555365563655736558365593656036561365623656336564365653656636567365683656936570365713657236573365743657536576365773657836579365803658136582365833658436585365863658736588365893659036591365923659336594365953659636597365983659936600366013660236603366043660536606366073660836609366103661136612366133661436615366163661736618366193662036621366223662336624366253662636627366283662936630366313663236633366343663536636366373663836639366403664136642366433664436645366463664736648366493665036651366523665336654366553665636657366583665936660366613666236663366643666536666366673666836669366703667136672366733667436675366763667736678366793668036681366823668336684366853668636687366883668936690366913669236693366943669536696366973669836699367003670136702367033670436705367063670736708367093671036711367123671336714367153671636717367183671936720367213672236723367243672536726367273672836729367303673136732367333673436735367363673736738367393674036741367423674336744367453674636747367483674936750367513675236753367543675536756367573675836759367603676136762367633676436765367663676736768367693677036771367723677336774367753677636777367783677936780367813678236783367843678536786367873678836789367903679136792367933679436795367963679736798367993680036801368023680336804368053680636807368083680936810368113681236813368143681536816368173681836819368203682136822368233682436825368263682736828368293683036831368323683336834368353683636837368383683936840368413684236843368443684536846368473684836849368503685136852368533685436855368563685736858368593686036861368623686336864368653686636867368683686936870368713687236873368743687536876368773687836879368803688136882368833688436885368863688736888368893689036891368923689336894368953689636897368983689936900369013690236903369043690536906369073690836909369103691136912369133691436915369163691736918369193692036921369223692336924369253692636927369283692936930369313693236933369343693536936369373693836939369403694136942369433694436945369463694736948369493695036951369523695336954369553695636957369583695936960369613696236963369643696536966369673696836969369703697136972369733697436975369763697736978369793698036981369823698336984369853698636987369883698936990369913699236993369943699536996369973699836999370003700137002370033700437005370063700737008370093701037011370123701337014370153701637017370183701937020370213702237023370243702537026370273702837029370303703137032370333703437035370363703737038370393704037041370423704337044370453704637047370483704937050370513705237053370543705537056370573705837059370603706137062370633706437065370663706737068370693707037071370723707337074370753707637077370783707937080370813708237083370843708537086370873708837089370903709137092370933709437095370963709737098370993710037101371023710337104371053710637107371083710937110371113711237113371143711537116371173711837119371203712137122371233712437125371263712737128371293713037131371323713337134371353713637137371383713937140371413714237143371443714537146371473714837149371503715137152371533715437155371563715737158371593716037161371623716337164371653716637167371683716937170371713717237173371743717537176371773717837179371803718137182371833718437185371863718737188371893719037191371923719337194371953719637197371983719937200372013720237203372043720537206372073720837209372103721137212372133721437215372163721737218372193722037221372223722337224372253722637227372283722937230372313723237233372343723537236372373723837239372403724137242372433724437245372463724737248372493725037251372523725337254372553725637257372583725937260372613726237263372643726537266372673726837269372703727137272372733727437275372763727737278372793728037281372823728337284372853728637287372883728937290372913729237293372943729537296372973729837299373003730137302373033730437305373063730737308373093731037311373123731337314373153731637317373183731937320373213732237323373243732537326373273732837329373303733137332373333733437335373363733737338373393734037341373423734337344373453734637347373483734937350373513735237353373543735537356373573735837359373603736137362373633736437365373663736737368373693737037371373723737337374373753737637377373783737937380373813738237383373843738537386373873738837389373903739137392373933739437395373963739737398373993740037401374023740337404374053740637407374083740937410374113741237413374143741537416374173741837419374203742137422374233742437425374263742737428374293743037431374323743337434374353743637437374383743937440374413744237443374443744537446374473744837449374503745137452374533745437455374563745737458374593746037461374623746337464374653746637467374683746937470374713747237473374743747537476374773747837479374803748137482374833748437485374863748737488374893749037491374923749337494374953749637497374983749937500375013750237503375043750537506375073750837509375103751137512375133751437515375163751737518375193752037521375223752337524375253752637527375283752937530375313753237533375343753537536375373753837539375403754137542375433754437545375463754737548375493755037551375523755337554375553755637557375583755937560375613756237563375643756537566375673756837569375703757137572375733757437575375763757737578375793758037581375823758337584375853758637587375883758937590375913759237593375943759537596375973759837599376003760137602376033760437605376063760737608376093761037611376123761337614376153761637617376183761937620376213762237623376243762537626376273762837629376303763137632376333763437635376363763737638376393764037641376423764337644376453764637647376483764937650376513765237653376543765537656376573765837659376603766137662376633766437665376663766737668376693767037671376723767337674376753767637677376783767937680376813768237683376843768537686376873768837689376903769137692376933769437695376963769737698376993770037701377023770337704377053770637707377083770937710377113771237713377143771537716377173771837719377203772137722377233772437725377263772737728377293773037731377323773337734377353773637737377383773937740377413774237743377443774537746377473774837749377503775137752377533775437755377563775737758377593776037761377623776337764377653776637767377683776937770377713777237773377743777537776377773777837779377803778137782377833778437785377863778737788377893779037791377923779337794377953779637797377983779937800378013780237803378043780537806378073780837809378103781137812378133781437815378163781737818378193782037821378223782337824378253782637827378283782937830378313783237833378343783537836378373783837839378403784137842378433784437845378463784737848378493785037851378523785337854378553785637857378583785937860378613786237863378643786537866378673786837869378703787137872378733787437875378763787737878378793788037881378823788337884378853788637887378883788937890378913789237893378943789537896378973789837899379003790137902379033790437905379063790737908379093791037911379123791337914379153791637917379183791937920379213792237923379243792537926379273792837929379303793137932379333793437935379363793737938379393794037941379423794337944379453794637947379483794937950379513795237953379543795537956379573795837959379603796137962379633796437965379663796737968379693797037971379723797337974379753797637977379783797937980379813798237983379843798537986379873798837989379903799137992379933799437995379963799737998379993800038001380023800338004380053800638007380083800938010380113801238013380143801538016380173801838019380203802138022380233802438025380263802738028380293803038031380323803338034380353803638037380383803938040380413804238043380443804538046380473804838049380503805138052380533805438055380563805738058380593806038061380623806338064380653806638067380683806938070380713807238073380743807538076380773807838079380803808138082380833808438085380863808738088380893809038091380923809338094380953809638097380983809938100381013810238103381043810538106381073810838109381103811138112381133811438115381163811738118381193812038121381223812338124381253812638127381283812938130381313813238133381343813538136381373813838139381403814138142381433814438145381463814738148381493815038151381523815338154381553815638157381583815938160381613816238163381643816538166381673816838169381703817138172381733817438175381763817738178381793818038181381823818338184381853818638187381883818938190381913819238193381943819538196381973819838199382003820138202382033820438205382063820738208382093821038211382123821338214382153821638217382183821938220382213822238223382243822538226382273822838229382303823138232382333823438235382363823738238382393824038241382423824338244382453824638247382483824938250382513825238253382543825538256382573825838259382603826138262382633826438265382663826738268382693827038271382723827338274382753827638277382783827938280382813828238283382843828538286382873828838289382903829138292382933829438295382963829738298382993830038301383023830338304383053830638307383083830938310383113831238313383143831538316383173831838319383203832138322383233832438325383263832738328383293833038331383323833338334383353833638337383383833938340383413834238343383443834538346383473834838349383503835138352383533835438355383563835738358383593836038361383623836338364383653836638367383683836938370383713837238373383743837538376383773837838379383803838138382383833838438385383863838738388383893839038391383923839338394383953839638397383983839938400384013840238403384043840538406384073840838409384103841138412384133841438415384163841738418384193842038421384223842338424384253842638427384283842938430384313843238433384343843538436384373843838439384403844138442384433844438445384463844738448384493845038451384523845338454384553845638457384583845938460384613846238463384643846538466384673846838469384703847138472384733847438475384763847738478384793848038481384823848338484384853848638487384883848938490384913849238493384943849538496384973849838499385003850138502385033850438505385063850738508385093851038511385123851338514385153851638517385183851938520385213852238523385243852538526385273852838529385303853138532385333853438535385363853738538385393854038541385423854338544385453854638547385483854938550385513855238553385543855538556385573855838559385603856138562385633856438565385663856738568385693857038571385723857338574385753857638577385783857938580385813858238583385843858538586385873858838589385903859138592385933859438595385963859738598385993860038601386023860338604386053860638607386083860938610386113861238613386143861538616386173861838619386203862138622386233862438625386263862738628386293863038631386323863338634386353863638637386383863938640386413864238643386443864538646386473864838649386503865138652386533865438655386563865738658386593866038661386623866338664386653866638667386683866938670386713867238673386743867538676386773867838679386803868138682386833868438685386863868738688386893869038691386923869338694386953869638697386983869938700387013870238703387043870538706387073870838709387103871138712387133871438715387163871738718387193872038721387223872338724387253872638727387283872938730387313873238733387343873538736387373873838739387403874138742387433874438745387463874738748387493875038751387523875338754387553875638757387583875938760387613876238763387643876538766387673876838769387703877138772387733877438775387763877738778387793878038781387823878338784387853878638787387883878938790387913879238793387943879538796387973879838799388003880138802388033880438805388063880738808388093881038811388123881338814388153881638817388183881938820388213882238823388243882538826388273882838829388303883138832388333883438835388363883738838388393884038841388423884338844388453884638847388483884938850388513885238853388543885538856388573885838859388603886138862388633886438865388663886738868388693887038871388723887338874388753887638877388783887938880388813888238883388843888538886388873888838889388903889138892388933889438895388963889738898388993890038901389023890338904389053890638907389083890938910389113891238913389143891538916389173891838919389203892138922389233892438925389263892738928389293893038931389323893338934389353893638937389383893938940389413894238943389443894538946389473894838949389503895138952389533895438955389563895738958389593896038961389623896338964389653896638967389683896938970389713897238973389743897538976389773897838979389803898138982389833898438985389863898738988389893899038991389923899338994389953899638997389983899939000390013900239003390043900539006390073900839009390103901139012390133901439015390163901739018390193902039021390223902339024390253902639027390283902939030390313903239033390343903539036390373903839039390403904139042390433904439045390463904739048390493905039051390523905339054390553905639057390583905939060390613906239063390643906539066390673906839069390703907139072390733907439075390763907739078390793908039081390823908339084390853908639087390883908939090390913909239093390943909539096390973909839099391003910139102391033910439105391063910739108391093911039111391123911339114391153911639117391183911939120391213912239123391243912539126391273912839129391303913139132391333913439135391363913739138391393914039141391423914339144391453914639147391483914939150391513915239153391543915539156391573915839159391603916139162391633916439165391663916739168391693917039171391723917339174391753917639177391783917939180391813918239183391843918539186391873918839189391903919139192391933919439195391963919739198391993920039201392023920339204392053920639207392083920939210392113921239213392143921539216392173921839219392203922139222392233922439225392263922739228392293923039231392323923339234392353923639237392383923939240392413924239243392443924539246392473924839249392503925139252392533925439255392563925739258392593926039261392623926339264392653926639267392683926939270392713927239273392743927539276392773927839279392803928139282392833928439285392863928739288392893929039291392923929339294392953929639297392983929939300393013930239303393043930539306393073930839309393103931139312393133931439315393163931739318393193932039321393223932339324393253932639327393283932939330393313933239333393343933539336393373933839339393403934139342393433934439345393463934739348393493935039351393523935339354393553935639357393583935939360393613936239363393643936539366393673936839369393703937139372393733937439375393763937739378393793938039381393823938339384393853938639387393883938939390393913939239393393943939539396393973939839399394003940139402394033940439405394063940739408394093941039411394123941339414394153941639417394183941939420394213942239423394243942539426394273942839429394303943139432394333943439435394363943739438394393944039441394423944339444394453944639447394483944939450394513945239453394543945539456394573945839459394603946139462394633946439465394663946739468394693947039471394723947339474394753947639477394783947939480394813948239483394843948539486394873948839489394903949139492394933949439495394963949739498394993950039501395023950339504395053950639507395083950939510395113951239513395143951539516395173951839519395203952139522395233952439525395263952739528395293953039531395323953339534395353953639537395383953939540395413954239543395443954539546395473954839549395503955139552395533955439555395563955739558395593956039561395623956339564395653956639567395683956939570395713957239573395743957539576395773957839579395803958139582395833958439585395863958739588395893959039591395923959339594395953959639597395983959939600396013960239603396043960539606396073960839609396103961139612396133961439615396163961739618396193962039621396223962339624396253962639627396283962939630396313963239633396343963539636396373963839639396403964139642396433964439645396463964739648396493965039651396523965339654396553965639657396583965939660396613966239663396643966539666396673966839669396703967139672396733967439675396763967739678396793968039681396823968339684396853968639687396883968939690396913969239693396943969539696396973969839699397003970139702397033970439705397063970739708397093971039711397123971339714397153971639717397183971939720397213972239723397243972539726397273972839729397303973139732397333973439735397363973739738397393974039741397423974339744397453974639747397483974939750397513975239753397543975539756397573975839759397603976139762397633976439765397663976739768397693977039771397723977339774397753977639777397783977939780397813978239783397843978539786397873978839789397903979139792397933979439795397963979739798397993980039801398023980339804398053980639807398083980939810398113981239813398143981539816398173981839819398203982139822398233982439825398263982739828398293983039831398323983339834398353983639837398383983939840398413984239843398443984539846398473984839849398503985139852398533985439855398563985739858398593986039861398623986339864398653986639867398683986939870398713987239873398743987539876398773987839879398803988139882398833988439885398863988739888398893989039891398923989339894398953989639897398983989939900399013990239903399043990539906399073990839909399103991139912399133991439915399163991739918399193992039921399223992339924399253992639927399283992939930399313993239933399343993539936399373993839939399403994139942399433994439945399463994739948399493995039951399523995339954399553995639957399583995939960399613996239963399643996539966399673996839969399703997139972399733997439975399763997739978399793998039981399823998339984399853998639987399883998939990399913999239993399943999539996399973999839999400004000140002400034000440005400064000740008400094001040011400124001340014400154001640017400184001940020400214002240023400244002540026400274002840029400304003140032400334003440035400364003740038400394004040041400424004340044400454004640047400484004940050400514005240053400544005540056400574005840059400604006140062400634006440065400664006740068400694007040071400724007340074400754007640077400784007940080400814008240083400844008540086400874008840089400904009140092400934009440095400964009740098400994010040101401024010340104401054010640107401084010940110401114011240113401144011540116401174011840119401204012140122401234012440125401264012740128401294013040131401324013340134401354013640137401384013940140401414014240143401444014540146401474014840149401504015140152401534015440155401564015740158401594016040161401624016340164401654016640167401684016940170401714017240173401744017540176401774017840179401804018140182401834018440185401864018740188401894019040191401924019340194401954019640197401984019940200402014020240203402044020540206402074020840209402104021140212402134021440215402164021740218402194022040221402224022340224402254022640227402284022940230402314023240233402344023540236402374023840239402404024140242402434024440245402464024740248402494025040251402524025340254402554025640257402584025940260402614026240263402644026540266402674026840269402704027140272402734027440275402764027740278402794028040281402824028340284402854028640287402884028940290402914029240293402944029540296402974029840299403004030140302403034030440305403064030740308403094031040311403124031340314403154031640317403184031940320403214032240323403244032540326403274032840329403304033140332403334033440335403364033740338403394034040341403424034340344403454034640347403484034940350403514035240353403544035540356403574035840359403604036140362403634036440365403664036740368403694037040371403724037340374403754037640377403784037940380403814038240383403844038540386403874038840389403904039140392403934039440395403964039740398403994040040401404024040340404404054040640407404084040940410404114041240413404144041540416404174041840419404204042140422404234042440425404264042740428404294043040431404324043340434404354043640437404384043940440404414044240443404444044540446404474044840449404504045140452404534045440455404564045740458404594046040461404624046340464404654046640467404684046940470404714047240473404744047540476404774047840479404804048140482404834048440485404864048740488404894049040491404924049340494404954049640497404984049940500405014050240503405044050540506405074050840509405104051140512405134051440515405164051740518405194052040521405224052340524405254052640527405284052940530405314053240533405344053540536405374053840539405404054140542405434054440545405464054740548405494055040551405524055340554405554055640557405584055940560405614056240563405644056540566405674056840569405704057140572405734057440575405764057740578405794058040581405824058340584405854058640587405884058940590405914059240593405944059540596405974059840599406004060140602406034060440605406064060740608406094061040611406124061340614406154061640617406184061940620406214062240623406244062540626406274062840629406304063140632406334063440635406364063740638406394064040641406424064340644406454064640647406484064940650406514065240653406544065540656406574065840659406604066140662406634066440665406664066740668406694067040671406724067340674406754067640677406784067940680406814068240683406844068540686406874068840689406904069140692406934069440695406964069740698406994070040701407024070340704407054070640707407084070940710407114071240713407144071540716407174071840719407204072140722407234072440725407264072740728407294073040731407324073340734407354073640737407384073940740407414074240743407444074540746407474074840749407504075140752407534075440755407564075740758407594076040761407624076340764407654076640767407684076940770407714077240773407744077540776407774077840779407804078140782407834078440785407864078740788407894079040791407924079340794407954079640797407984079940800408014080240803408044080540806408074080840809408104081140812408134081440815408164081740818408194082040821408224082340824408254082640827408284082940830408314083240833408344083540836408374083840839408404084140842408434084440845408464084740848408494085040851408524085340854408554085640857408584085940860408614086240863408644086540866408674086840869408704087140872408734087440875408764087740878408794088040881408824088340884408854088640887408884088940890408914089240893408944089540896408974089840899409004090140902409034090440905409064090740908409094091040911409124091340914409154091640917409184091940920409214092240923409244092540926409274092840929409304093140932409334093440935409364093740938409394094040941409424094340944409454094640947409484094940950409514095240953409544095540956409574095840959409604096140962409634096440965409664096740968409694097040971409724097340974409754097640977409784097940980409814098240983409844098540986409874098840989409904099140992409934099440995409964099740998409994100041001410024100341004410054100641007410084100941010410114101241013410144101541016410174101841019410204102141022410234102441025410264102741028410294103041031410324103341034410354103641037410384103941040410414104241043410444104541046410474104841049410504105141052410534105441055410564105741058410594106041061410624106341064410654106641067410684106941070410714107241073410744107541076410774107841079410804108141082410834108441085410864108741088410894109041091410924109341094410954109641097410984109941100411014110241103411044110541106411074110841109411104111141112411134111441115411164111741118411194112041121411224112341124411254112641127411284112941130411314113241133411344113541136411374113841139411404114141142411434114441145411464114741148411494115041151411524115341154411554115641157411584115941160411614116241163411644116541166411674116841169411704117141172411734117441175411764117741178411794118041181411824118341184411854118641187411884118941190411914119241193411944119541196411974119841199412004120141202412034120441205412064120741208412094121041211412124121341214412154121641217412184121941220412214122241223412244122541226412274122841229412304123141232412334123441235412364123741238412394124041241412424124341244412454124641247412484124941250412514125241253412544125541256412574125841259412604126141262412634126441265412664126741268412694127041271412724127341274412754127641277412784127941280412814128241283412844128541286412874128841289412904129141292412934129441295412964129741298412994130041301413024130341304413054130641307413084130941310413114131241313413144131541316413174131841319413204132141322413234132441325413264132741328413294133041331413324133341334413354133641337413384133941340413414134241343413444134541346413474134841349413504135141352413534135441355413564135741358413594136041361413624136341364413654136641367413684136941370413714137241373413744137541376413774137841379413804138141382413834138441385413864138741388413894139041391413924139341394413954139641397413984139941400414014140241403414044140541406414074140841409414104141141412414134141441415414164141741418414194142041421414224142341424414254142641427414284142941430414314143241433414344143541436414374143841439414404144141442414434144441445414464144741448414494145041451414524145341454414554145641457414584145941460414614146241463414644146541466414674146841469414704147141472414734147441475414764147741478414794148041481414824148341484414854148641487414884148941490414914149241493414944149541496414974149841499415004150141502415034150441505415064150741508415094151041511415124151341514415154151641517415184151941520415214152241523415244152541526415274152841529415304153141532415334153441535415364153741538415394154041541415424154341544415454154641547415484154941550415514155241553415544155541556415574155841559415604156141562415634156441565415664156741568415694157041571415724157341574415754157641577415784157941580415814158241583415844158541586415874158841589415904159141592415934159441595415964159741598415994160041601416024160341604416054160641607416084160941610416114161241613416144161541616416174161841619416204162141622416234162441625416264162741628416294163041631416324163341634416354163641637416384163941640416414164241643416444164541646416474164841649416504165141652416534165441655416564165741658416594166041661416624166341664416654166641667416684166941670416714167241673416744167541676416774167841679416804168141682416834168441685416864168741688416894169041691416924169341694416954169641697416984169941700417014170241703417044170541706417074170841709417104171141712417134171441715417164171741718417194172041721417224172341724417254172641727417284172941730417314173241733417344173541736417374173841739417404174141742417434174441745417464174741748417494175041751417524175341754417554175641757417584175941760417614176241763417644176541766417674176841769417704177141772417734177441775417764177741778417794178041781417824178341784417854178641787417884178941790417914179241793417944179541796417974179841799418004180141802418034180441805418064180741808418094181041811418124181341814418154181641817418184181941820418214182241823418244182541826418274182841829418304183141832418334183441835418364183741838418394184041841418424184341844418454184641847418484184941850418514185241853418544185541856418574185841859418604186141862418634186441865418664186741868418694187041871418724187341874418754187641877418784187941880418814188241883418844188541886418874188841889418904189141892418934189441895418964189741898418994190041901419024190341904419054190641907419084190941910419114191241913419144191541916419174191841919419204192141922419234192441925419264192741928419294193041931419324193341934419354193641937419384193941940419414194241943419444194541946419474194841949419504195141952419534195441955419564195741958419594196041961419624196341964419654196641967419684196941970419714197241973419744197541976419774197841979419804198141982419834198441985419864198741988419894199041991419924199341994419954199641997419984199942000420014200242003420044200542006420074200842009420104201142012420134201442015420164201742018420194202042021420224202342024420254202642027420284202942030420314203242033420344203542036420374203842039420404204142042420434204442045420464204742048420494205042051420524205342054420554205642057420584205942060420614206242063420644206542066420674206842069420704207142072420734207442075420764207742078420794208042081420824208342084420854208642087420884208942090420914209242093420944209542096420974209842099421004210142102421034210442105421064210742108421094211042111421124211342114421154211642117421184211942120421214212242123421244212542126421274212842129421304213142132421334213442135421364213742138421394214042141421424214342144421454214642147421484214942150421514215242153421544215542156421574215842159421604216142162421634216442165421664216742168421694217042171421724217342174421754217642177421784217942180421814218242183421844218542186421874218842189421904219142192421934219442195421964219742198421994220042201422024220342204422054220642207422084220942210422114221242213422144221542216422174221842219422204222142222422234222442225422264222742228422294223042231422324223342234422354223642237422384223942240422414224242243422444224542246422474224842249422504225142252422534225442255422564225742258422594226042261422624226342264422654226642267422684226942270422714227242273422744227542276422774227842279422804228142282422834228442285422864228742288422894229042291422924229342294422954229642297422984229942300423014230242303423044230542306423074230842309423104231142312423134231442315423164231742318423194232042321423224232342324423254232642327423284232942330423314233242333423344233542336423374233842339423404234142342423434234442345423464234742348423494235042351423524235342354423554235642357423584235942360423614236242363423644236542366423674236842369423704237142372423734237442375423764237742378423794238042381423824238342384423854238642387423884238942390423914239242393423944239542396423974239842399424004240142402424034240442405424064240742408424094241042411424124241342414424154241642417424184241942420424214242242423424244242542426424274242842429424304243142432424334243442435424364243742438424394244042441424424244342444424454244642447424484244942450424514245242453424544245542456424574245842459424604246142462424634246442465424664246742468424694247042471424724247342474424754247642477424784247942480424814248242483424844248542486424874248842489424904249142492424934249442495424964249742498424994250042501425024250342504425054250642507425084250942510425114251242513425144251542516425174251842519425204252142522425234252442525425264252742528425294253042531425324253342534425354253642537425384253942540425414254242543425444254542546425474254842549425504255142552425534255442555425564255742558425594256042561425624256342564425654256642567425684256942570425714257242573425744257542576425774257842579425804258142582425834258442585425864258742588425894259042591425924259342594425954259642597425984259942600426014260242603426044260542606426074260842609426104261142612426134261442615426164261742618426194262042621426224262342624426254262642627426284262942630426314263242633426344263542636426374263842639426404264142642426434264442645426464264742648426494265042651426524265342654426554265642657426584265942660426614266242663426644266542666426674266842669426704267142672426734267442675426764267742678426794268042681426824268342684426854268642687426884268942690426914269242693426944269542696426974269842699427004270142702427034270442705427064270742708427094271042711427124271342714427154271642717427184271942720427214272242723427244272542726427274272842729427304273142732427334273442735427364273742738427394274042741427424274342744427454274642747427484274942750427514275242753427544275542756427574275842759427604276142762427634276442765427664276742768427694277042771427724277342774427754277642777427784277942780427814278242783427844278542786427874278842789427904279142792427934279442795427964279742798427994280042801428024280342804428054280642807428084280942810428114281242813428144281542816428174281842819428204282142822428234282442825428264282742828428294283042831428324283342834428354283642837428384283942840428414284242843428444284542846428474284842849428504285142852428534285442855428564285742858428594286042861428624286342864428654286642867428684286942870428714287242873428744287542876428774287842879428804288142882428834288442885428864288742888428894289042891428924289342894428954289642897428984289942900429014290242903429044290542906429074290842909429104291142912429134291442915429164291742918429194292042921429224292342924429254292642927429284292942930429314293242933429344293542936429374293842939429404294142942429434294442945429464294742948429494295042951429524295342954429554295642957429584295942960429614296242963429644296542966429674296842969429704297142972429734297442975429764297742978429794298042981429824298342984429854298642987429884298942990429914299242993429944299542996429974299842999430004300143002430034300443005430064300743008430094301043011430124301343014430154301643017430184301943020430214302243023430244302543026430274302843029430304303143032430334303443035430364303743038430394304043041430424304343044430454304643047430484304943050430514305243053430544305543056430574305843059430604306143062430634306443065430664306743068430694307043071430724307343074430754307643077430784307943080430814308243083430844308543086430874308843089430904309143092430934309443095430964309743098430994310043101431024310343104431054310643107431084310943110431114311243113431144311543116431174311843119431204312143122431234312443125431264312743128431294313043131431324313343134431354313643137431384313943140431414314243143431444314543146431474314843149431504315143152431534315443155431564315743158431594316043161431624316343164431654316643167431684316943170431714317243173431744317543176431774317843179431804318143182431834318443185431864318743188431894319043191431924319343194431954319643197431984319943200432014320243203432044320543206432074320843209432104321143212432134321443215432164321743218432194322043221432224322343224432254322643227432284322943230432314323243233432344323543236432374323843239432404324143242432434324443245432464324743248432494325043251432524325343254432554325643257432584325943260432614326243263432644326543266432674326843269432704327143272432734327443275432764327743278432794328043281432824328343284432854328643287432884328943290432914329243293432944329543296432974329843299433004330143302433034330443305433064330743308433094331043311433124331343314433154331643317433184331943320433214332243323433244332543326433274332843329433304333143332433334333443335433364333743338433394334043341433424334343344433454334643347433484334943350433514335243353433544335543356433574335843359433604336143362433634336443365433664336743368433694337043371433724337343374433754337643377433784337943380433814338243383433844338543386433874338843389433904339143392433934339443395433964339743398433994340043401434024340343404434054340643407434084340943410434114341243413434144341543416434174341843419434204342143422434234342443425434264342743428434294343043431434324343343434434354343643437434384343943440434414344243443434444344543446434474344843449434504345143452434534345443455434564345743458434594346043461434624346343464434654346643467434684346943470434714347243473434744347543476434774347843479434804348143482434834348443485434864348743488434894349043491434924349343494434954349643497434984349943500435014350243503435044350543506435074350843509435104351143512435134351443515435164351743518435194352043521435224352343524435254352643527435284352943530435314353243533435344353543536435374353843539435404354143542435434354443545435464354743548435494355043551435524355343554435554355643557435584355943560435614356243563435644356543566435674356843569435704357143572435734357443575435764357743578435794358043581435824358343584435854358643587435884358943590435914359243593435944359543596435974359843599436004360143602436034360443605436064360743608436094361043611436124361343614436154361643617436184361943620436214362243623436244362543626436274362843629436304363143632436334363443635436364363743638436394364043641436424364343644436454364643647436484364943650436514365243653436544365543656436574365843659436604366143662436634366443665436664366743668436694367043671436724367343674436754367643677436784367943680436814368243683436844368543686436874368843689436904369143692436934369443695436964369743698436994370043701437024370343704437054370643707437084370943710437114371243713437144371543716437174371843719437204372143722437234372443725437264372743728437294373043731437324373343734437354373643737437384373943740437414374243743437444374543746437474374843749437504375143752437534375443755437564375743758437594376043761437624376343764437654376643767437684376943770437714377243773437744377543776437774377843779437804378143782437834378443785437864378743788437894379043791437924379343794437954379643797437984379943800438014380243803438044380543806438074380843809438104381143812438134381443815438164381743818438194382043821438224382343824438254382643827438284382943830438314383243833438344383543836438374383843839438404384143842438434384443845438464384743848438494385043851438524385343854438554385643857438584385943860438614386243863438644386543866438674386843869438704387143872438734387443875438764387743878438794388043881438824388343884438854388643887438884388943890438914389243893438944389543896438974389843899439004390143902439034390443905439064390743908439094391043911439124391343914439154391643917439184391943920439214392243923439244392543926439274392843929439304393143932439334393443935439364393743938439394394043941439424394343944439454394643947439484394943950439514395243953439544395543956439574395843959439604396143962439634396443965439664396743968439694397043971439724397343974439754397643977439784397943980439814398243983439844398543986439874398843989439904399143992439934399443995439964399743998439994400044001440024400344004440054400644007440084400944010440114401244013440144401544016440174401844019440204402144022440234402444025440264402744028440294403044031440324403344034440354403644037440384403944040440414404244043440444404544046440474404844049440504405144052440534405444055440564405744058440594406044061440624406344064440654406644067440684406944070440714407244073440744407544076440774407844079440804408144082440834408444085440864408744088440894409044091440924409344094440954409644097440984409944100441014410244103441044410544106441074410844109441104411144112441134411444115441164411744118441194412044121441224412344124441254412644127441284412944130441314413244133441344413544136441374413844139441404414144142441434414444145441464414744148441494415044151441524415344154441554415644157441584415944160441614416244163441644416544166441674416844169441704417144172441734417444175441764417744178441794418044181441824418344184441854418644187441884418944190441914419244193441944419544196441974419844199442004420144202442034420444205442064420744208442094421044211442124421344214442154421644217442184421944220442214422244223442244422544226442274422844229442304423144232442334423444235442364423744238442394424044241442424424344244442454424644247442484424944250442514425244253442544425544256442574425844259442604426144262442634426444265442664426744268442694427044271442724427344274442754427644277442784427944280442814428244283442844428544286442874428844289442904429144292442934429444295442964429744298442994430044301443024430344304443054430644307443084430944310443114431244313443144431544316443174431844319443204432144322443234432444325443264432744328443294433044331443324433344334443354433644337443384433944340443414434244343443444434544346443474434844349443504435144352443534435444355443564435744358443594436044361443624436344364443654436644367443684436944370443714437244373443744437544376443774437844379443804438144382443834438444385443864438744388443894439044391443924439344394443954439644397443984439944400444014440244403444044440544406444074440844409444104441144412444134441444415444164441744418444194442044421444224442344424444254442644427444284442944430444314443244433444344443544436444374443844439444404444144442444434444444445444464444744448444494445044451444524445344454444554445644457444584445944460444614446244463444644446544466444674446844469444704447144472444734447444475444764447744478444794448044481444824448344484444854448644487444884448944490444914449244493444944449544496444974449844499445004450144502445034450444505445064450744508445094451044511445124451344514445154451644517445184451944520445214452244523445244452544526445274452844529445304453144532445334453444535445364453744538445394454044541445424454344544445454454644547445484454944550445514455244553445544455544556445574455844559445604456144562445634456444565445664456744568445694457044571445724457344574445754457644577445784457944580445814458244583445844458544586445874458844589445904459144592445934459444595445964459744598445994460044601446024460344604446054460644607446084460944610446114461244613446144461544616446174461844619446204462144622446234462444625446264462744628446294463044631446324463344634446354463644637446384463944640446414464244643446444464544646446474464844649446504465144652446534465444655446564465744658446594466044661446624466344664446654466644667446684466944670446714467244673446744467544676446774467844679446804468144682446834468444685446864468744688446894469044691446924469344694446954469644697446984469944700447014470244703447044470544706447074470844709447104471144712447134471444715447164471744718447194472044721447224472344724447254472644727447284472944730447314473244733447344473544736447374473844739447404474144742447434474444745447464474744748447494475044751447524475344754447554475644757447584475944760447614476244763447644476544766447674476844769447704477144772447734477444775447764477744778447794478044781447824478344784447854478644787447884478944790447914479244793447944479544796447974479844799448004480144802448034480444805448064480744808448094481044811448124481344814448154481644817448184481944820448214482244823448244482544826448274482844829448304483144832448334483444835448364483744838448394484044841448424484344844448454484644847448484484944850448514485244853448544485544856448574485844859448604486144862448634486444865448664486744868448694487044871448724487344874448754487644877448784487944880448814488244883448844488544886448874488844889448904489144892448934489444895448964489744898448994490044901449024490344904449054490644907449084490944910449114491244913449144491544916449174491844919449204492144922449234492444925449264492744928449294493044931449324493344934449354493644937449384493944940449414494244943449444494544946449474494844949449504495144952449534495444955449564495744958449594496044961449624496344964449654496644967449684496944970449714497244973449744497544976449774497844979449804498144982449834498444985449864498744988449894499044991449924499344994449954499644997449984499945000450014500245003450044500545006450074500845009450104501145012450134501445015450164501745018450194502045021450224502345024450254502645027450284502945030450314503245033450344503545036450374503845039450404504145042450434504445045450464504745048450494505045051450524505345054450554505645057450584505945060450614506245063450644506545066450674506845069450704507145072450734507445075450764507745078450794508045081450824508345084450854508645087450884508945090450914509245093450944509545096450974509845099451004510145102451034510445105451064510745108451094511045111451124511345114451154511645117451184511945120451214512245123451244512545126451274512845129451304513145132451334513445135451364513745138451394514045141451424514345144451454514645147451484514945150451514515245153451544515545156451574515845159451604516145162451634516445165451664516745168451694517045171451724517345174451754517645177451784517945180451814518245183451844518545186451874518845189451904519145192451934519445195451964519745198451994520045201452024520345204452054520645207452084520945210452114521245213452144521545216452174521845219452204522145222452234522445225452264522745228452294523045231452324523345234452354523645237452384523945240452414524245243452444524545246452474524845249452504525145252452534525445255452564525745258452594526045261452624526345264452654526645267452684526945270452714527245273452744527545276452774527845279452804528145282452834528445285452864528745288452894529045291452924529345294452954529645297452984529945300453014530245303453044530545306453074530845309453104531145312453134531445315453164531745318453194532045321453224532345324453254532645327453284532945330453314533245333453344533545336453374533845339453404534145342453434534445345453464534745348453494535045351453524535345354453554535645357453584535945360453614536245363453644536545366453674536845369453704537145372453734537445375453764537745378453794538045381453824538345384453854538645387453884538945390453914539245393453944539545396453974539845399454004540145402454034540445405454064540745408454094541045411454124541345414454154541645417454184541945420454214542245423454244542545426454274542845429454304543145432454334543445435454364543745438454394544045441454424544345444454454544645447454484544945450454514545245453454544545545456454574545845459454604546145462454634546445465454664546745468454694547045471454724547345474454754547645477454784547945480454814548245483454844548545486454874548845489454904549145492454934549445495454964549745498454994550045501455024550345504455054550645507455084550945510455114551245513455144551545516455174551845519455204552145522455234552445525455264552745528455294553045531455324553345534455354553645537455384553945540455414554245543455444554545546455474554845549455504555145552455534555445555455564555745558455594556045561455624556345564455654556645567455684556945570455714557245573455744557545576455774557845579455804558145582455834558445585455864558745588455894559045591455924559345594455954559645597455984559945600456014560245603456044560545606456074560845609456104561145612456134561445615456164561745618456194562045621456224562345624456254562645627456284562945630456314563245633456344563545636456374563845639456404564145642456434564445645456464564745648456494565045651456524565345654456554565645657456584565945660456614566245663456644566545666456674566845669456704567145672456734567445675456764567745678456794568045681456824568345684456854568645687456884568945690456914569245693456944569545696456974569845699457004570145702457034570445705457064570745708457094571045711457124571345714457154571645717457184571945720457214572245723457244572545726457274572845729457304573145732457334573445735457364573745738457394574045741457424574345744457454574645747457484574945750457514575245753457544575545756457574575845759457604576145762457634576445765457664576745768457694577045771457724577345774457754577645777457784577945780457814578245783457844578545786457874578845789457904579145792457934579445795457964579745798457994580045801458024580345804458054580645807458084580945810458114581245813458144581545816458174581845819458204582145822458234582445825458264582745828458294583045831458324583345834458354583645837458384583945840458414584245843458444584545846458474584845849458504585145852458534585445855458564585745858458594586045861458624586345864458654586645867458684586945870458714587245873458744587545876458774587845879458804588145882458834588445885458864588745888458894589045891458924589345894458954589645897458984589945900459014590245903459044590545906459074590845909459104591145912459134591445915459164591745918459194592045921459224592345924459254592645927459284592945930459314593245933459344593545936459374593845939459404594145942459434594445945459464594745948459494595045951459524595345954459554595645957459584595945960459614596245963459644596545966459674596845969459704597145972459734597445975459764597745978459794598045981459824598345984459854598645987459884598945990459914599245993459944599545996459974599845999460004600146002460034600446005460064600746008460094601046011460124601346014460154601646017460184601946020460214602246023460244602546026460274602846029460304603146032460334603446035460364603746038460394604046041460424604346044460454604646047460484604946050460514605246053460544605546056460574605846059460604606146062460634606446065460664606746068460694607046071460724607346074460754607646077460784607946080460814608246083460844608546086460874608846089460904609146092460934609446095460964609746098460994610046101461024610346104461054610646107461084610946110461114611246113461144611546116461174611846119461204612146122461234612446125461264612746128461294613046131461324613346134461354613646137461384613946140461414614246143461444614546146461474614846149461504615146152461534615446155461564615746158461594616046161461624616346164461654616646167461684616946170461714617246173461744617546176461774617846179461804618146182461834618446185461864618746188461894619046191461924619346194461954619646197461984619946200462014620246203462044620546206462074620846209462104621146212462134621446215462164621746218462194622046221462224622346224462254622646227462284622946230462314623246233462344623546236462374623846239462404624146242462434624446245462464624746248462494625046251462524625346254462554625646257462584625946260462614626246263462644626546266462674626846269462704627146272462734627446275462764627746278462794628046281462824628346284462854628646287462884628946290462914629246293462944629546296462974629846299463004630146302463034630446305463064630746308463094631046311463124631346314463154631646317463184631946320463214632246323463244632546326463274632846329463304633146332463334633446335463364633746338463394634046341463424634346344463454634646347463484634946350463514635246353463544635546356463574635846359463604636146362463634636446365463664636746368463694637046371463724637346374463754637646377463784637946380463814638246383463844638546386463874638846389463904639146392463934639446395463964639746398463994640046401464024640346404464054640646407464084640946410464114641246413464144641546416464174641846419464204642146422464234642446425464264642746428464294643046431464324643346434464354643646437464384643946440464414644246443464444644546446464474644846449464504645146452464534645446455464564645746458464594646046461464624646346464464654646646467464684646946470464714647246473464744647546476464774647846479464804648146482464834648446485464864648746488464894649046491464924649346494464954649646497464984649946500465014650246503465044650546506465074650846509465104651146512465134651446515465164651746518465194652046521465224652346524465254652646527465284652946530465314653246533465344653546536465374653846539465404654146542465434654446545465464654746548465494655046551465524655346554465554655646557465584655946560465614656246563465644656546566465674656846569465704657146572465734657446575465764657746578465794658046581465824658346584465854658646587465884658946590465914659246593465944659546596465974659846599466004660146602466034660446605466064660746608466094661046611466124661346614466154661646617466184661946620466214662246623466244662546626466274662846629466304663146632466334663446635466364663746638466394664046641466424664346644466454664646647466484664946650466514665246653466544665546656466574665846659466604666146662466634666446665466664666746668466694667046671466724667346674466754667646677466784667946680466814668246683466844668546686466874668846689466904669146692466934669446695466964669746698466994670046701467024670346704467054670646707467084670946710467114671246713467144671546716467174671846719467204672146722467234672446725467264672746728467294673046731467324673346734467354673646737467384673946740467414674246743467444674546746467474674846749467504675146752467534675446755467564675746758467594676046761467624676346764467654676646767467684676946770467714677246773467744677546776467774677846779467804678146782467834678446785467864678746788467894679046791467924679346794467954679646797467984679946800468014680246803468044680546806468074680846809468104681146812468134681446815468164681746818468194682046821468224682346824468254682646827468284682946830468314683246833468344683546836468374683846839468404684146842468434684446845468464684746848468494685046851468524685346854468554685646857468584685946860468614686246863468644686546866468674686846869468704687146872468734687446875468764687746878468794688046881468824688346884468854688646887468884688946890468914689246893468944689546896468974689846899469004690146902469034690446905469064690746908469094691046911469124691346914469154691646917469184691946920469214692246923469244692546926469274692846929469304693146932469334693446935469364693746938469394694046941469424694346944469454694646947469484694946950469514695246953469544695546956469574695846959469604696146962469634696446965469664696746968469694697046971469724697346974469754697646977469784697946980469814698246983469844698546986469874698846989469904699146992469934699446995469964699746998469994700047001470024700347004470054700647007470084700947010470114701247013470144701547016470174701847019470204702147022470234702447025470264702747028470294703047031470324703347034470354703647037470384703947040470414704247043470444704547046470474704847049470504705147052470534705447055470564705747058470594706047061470624706347064470654706647067470684706947070470714707247073470744707547076470774707847079470804708147082470834708447085470864708747088470894709047091470924709347094470954709647097470984709947100471014710247103471044710547106471074710847109471104711147112471134711447115471164711747118471194712047121471224712347124471254712647127471284712947130471314713247133471344713547136471374713847139471404714147142471434714447145471464714747148471494715047151471524715347154471554715647157471584715947160471614716247163471644716547166471674716847169471704717147172471734717447175471764717747178471794718047181471824718347184471854718647187471884718947190471914719247193471944719547196471974719847199472004720147202472034720447205472064720747208472094721047211472124721347214472154721647217472184721947220472214722247223472244722547226472274722847229472304723147232472334723447235472364723747238472394724047241472424724347244472454724647247472484724947250472514725247253472544725547256472574725847259472604726147262472634726447265472664726747268472694727047271472724727347274472754727647277472784727947280472814728247283472844728547286472874728847289472904729147292472934729447295472964729747298472994730047301473024730347304473054730647307473084730947310473114731247313473144731547316473174731847319473204732147322473234732447325473264732747328473294733047331473324733347334473354733647337473384733947340473414734247343473444734547346473474734847349473504735147352473534735447355473564735747358473594736047361473624736347364473654736647367473684736947370473714737247373473744737547376473774737847379473804738147382473834738447385473864738747388473894739047391473924739347394473954739647397473984739947400474014740247403474044740547406474074740847409474104741147412474134741447415474164741747418474194742047421474224742347424474254742647427474284742947430474314743247433474344743547436474374743847439474404744147442474434744447445474464744747448474494745047451474524745347454474554745647457474584745947460474614746247463474644746547466474674746847469474704747147472474734747447475474764747747478474794748047481474824748347484474854748647487474884748947490474914749247493474944749547496474974749847499475004750147502475034750447505475064750747508475094751047511475124751347514475154751647517475184751947520475214752247523475244752547526475274752847529475304753147532475334753447535475364753747538475394754047541475424754347544475454754647547475484754947550475514755247553475544755547556475574755847559475604756147562475634756447565475664756747568475694757047571475724757347574475754757647577475784757947580475814758247583475844758547586475874758847589475904759147592475934759447595475964759747598475994760047601476024760347604476054760647607476084760947610476114761247613476144761547616476174761847619476204762147622476234762447625476264762747628476294763047631476324763347634476354763647637476384763947640476414764247643476444764547646476474764847649476504765147652476534765447655476564765747658476594766047661476624766347664476654766647667476684766947670476714767247673476744767547676476774767847679476804768147682476834768447685476864768747688476894769047691476924769347694476954769647697476984769947700477014770247703477044770547706477074770847709477104771147712477134771447715477164771747718477194772047721477224772347724477254772647727477284772947730477314773247733477344773547736477374773847739477404774147742477434774447745477464774747748477494775047751477524775347754477554775647757477584775947760477614776247763477644776547766477674776847769477704777147772477734777447775477764777747778477794778047781477824778347784477854778647787477884778947790477914779247793477944779547796477974779847799478004780147802478034780447805478064780747808478094781047811478124781347814478154781647817478184781947820478214782247823478244782547826478274782847829478304783147832478334783447835478364783747838478394784047841478424784347844478454784647847478484784947850478514785247853478544785547856478574785847859478604786147862478634786447865478664786747868478694787047871478724787347874478754787647877478784787947880478814788247883478844788547886478874788847889478904789147892478934789447895478964789747898478994790047901479024790347904479054790647907479084790947910479114791247913479144791547916479174791847919479204792147922479234792447925479264792747928479294793047931479324793347934479354793647937479384793947940479414794247943479444794547946479474794847949479504795147952479534795447955479564795747958479594796047961479624796347964479654796647967479684796947970479714797247973479744797547976479774797847979479804798147982479834798447985479864798747988479894799047991479924799347994479954799647997479984799948000480014800248003480044800548006480074800848009480104801148012480134801448015480164801748018480194802048021480224802348024480254802648027480284802948030480314803248033480344803548036480374803848039480404804148042480434804448045480464804748048480494805048051480524805348054480554805648057480584805948060480614806248063480644806548066480674806848069480704807148072480734807448075480764807748078480794808048081480824808348084480854808648087480884808948090480914809248093480944809548096480974809848099481004810148102481034810448105481064810748108481094811048111481124811348114481154811648117481184811948120481214812248123481244812548126481274812848129481304813148132481334813448135481364813748138481394814048141481424814348144481454814648147481484814948150481514815248153481544815548156481574815848159481604816148162481634816448165481664816748168481694817048171481724817348174481754817648177481784817948180481814818248183481844818548186481874818848189481904819148192481934819448195481964819748198481994820048201482024820348204482054820648207482084820948210482114821248213482144821548216482174821848219482204822148222482234822448225482264822748228482294823048231482324823348234482354823648237482384823948240482414824248243482444824548246482474824848249482504825148252482534825448255482564825748258482594826048261482624826348264482654826648267482684826948270482714827248273482744827548276482774827848279482804828148282482834828448285482864828748288482894829048291482924829348294482954829648297482984829948300483014830248303483044830548306483074830848309483104831148312483134831448315483164831748318483194832048321483224832348324483254832648327483284832948330483314833248333483344833548336483374833848339483404834148342483434834448345483464834748348483494835048351483524835348354483554835648357483584835948360483614836248363483644836548366483674836848369483704837148372483734837448375483764837748378483794838048381483824838348384483854838648387483884838948390483914839248393483944839548396483974839848399484004840148402484034840448405484064840748408484094841048411484124841348414484154841648417484184841948420484214842248423484244842548426484274842848429484304843148432484334843448435484364843748438484394844048441484424844348444484454844648447484484844948450484514845248453484544845548456484574845848459484604846148462484634846448465484664846748468484694847048471484724847348474484754847648477484784847948480484814848248483484844848548486484874848848489484904849148492484934849448495484964849748498484994850048501485024850348504485054850648507485084850948510485114851248513485144851548516485174851848519485204852148522485234852448525485264852748528485294853048531485324853348534485354853648537485384853948540485414854248543485444854548546485474854848549485504855148552485534855448555485564855748558485594856048561485624856348564485654856648567485684856948570485714857248573485744857548576485774857848579485804858148582485834858448585485864858748588485894859048591485924859348594485954859648597485984859948600486014860248603486044860548606486074860848609486104861148612486134861448615486164861748618486194862048621486224862348624486254862648627486284862948630486314863248633486344863548636486374863848639486404864148642486434864448645486464864748648486494865048651486524865348654486554865648657486584865948660486614866248663486644866548666486674866848669486704867148672486734867448675486764867748678486794868048681486824868348684486854868648687486884868948690486914869248693486944869548696486974869848699487004870148702487034870448705487064870748708487094871048711487124871348714487154871648717487184871948720487214872248723487244872548726487274872848729487304873148732487334873448735487364873748738487394874048741487424874348744487454874648747487484874948750487514875248753487544875548756487574875848759487604876148762487634876448765487664876748768487694877048771487724877348774487754877648777487784877948780487814878248783487844878548786487874878848789487904879148792487934879448795487964879748798487994880048801488024880348804488054880648807488084880948810488114881248813488144881548816488174881848819488204882148822488234882448825488264882748828488294883048831488324883348834488354883648837488384883948840488414884248843488444884548846488474884848849488504885148852488534885448855488564885748858488594886048861488624886348864488654886648867488684886948870488714887248873488744887548876488774887848879488804888148882488834888448885488864888748888488894889048891488924889348894488954889648897488984889948900489014890248903489044890548906489074890848909489104891148912489134891448915489164891748918489194892048921489224892348924489254892648927489284892948930489314893248933489344893548936489374893848939489404894148942489434894448945489464894748948489494895048951489524895348954489554895648957489584895948960489614896248963489644896548966489674896848969489704897148972489734897448975489764897748978489794898048981489824898348984489854898648987489884898948990489914899248993489944899548996489974899848999490004900149002490034900449005490064900749008490094901049011490124901349014490154901649017490184901949020490214902249023490244902549026490274902849029490304903149032490334903449035490364903749038490394904049041490424904349044490454904649047490484904949050490514905249053490544905549056490574905849059490604906149062490634906449065490664906749068490694907049071490724907349074490754907649077490784907949080490814908249083490844908549086490874908849089490904909149092490934909449095490964909749098490994910049101491024910349104491054910649107491084910949110491114911249113491144911549116491174911849119491204912149122491234912449125491264912749128491294913049131491324913349134491354913649137491384913949140491414914249143491444914549146491474914849149491504915149152491534915449155491564915749158491594916049161491624916349164491654916649167491684916949170491714917249173491744917549176491774917849179491804918149182491834918449185491864918749188491894919049191491924919349194491954919649197491984919949200492014920249203492044920549206492074920849209492104921149212492134921449215492164921749218492194922049221492224922349224492254922649227492284922949230492314923249233492344923549236492374923849239492404924149242492434924449245492464924749248492494925049251492524925349254492554925649257492584925949260492614926249263492644926549266492674926849269492704927149272492734927449275492764927749278492794928049281492824928349284492854928649287492884928949290492914929249293492944929549296492974929849299493004930149302493034930449305493064930749308493094931049311493124931349314493154931649317493184931949320493214932249323493244932549326493274932849329493304933149332493334933449335493364933749338493394934049341493424934349344493454934649347493484934949350493514935249353493544935549356493574935849359493604936149362493634936449365493664936749368493694937049371493724937349374493754937649377493784937949380493814938249383493844938549386493874938849389493904939149392493934939449395493964939749398493994940049401494024940349404494054940649407494084940949410494114941249413494144941549416494174941849419494204942149422494234942449425494264942749428494294943049431494324943349434494354943649437494384943949440494414944249443494444944549446494474944849449494504945149452494534945449455494564945749458494594946049461494624946349464494654946649467494684946949470494714947249473494744947549476494774947849479494804948149482494834948449485494864948749488494894949049491494924949349494494954949649497494984949949500495014950249503495044950549506495074950849509495104951149512495134951449515495164951749518495194952049521495224952349524495254952649527495284952949530495314953249533495344953549536495374953849539495404954149542495434954449545495464954749548495494955049551495524955349554495554955649557495584955949560495614956249563495644956549566495674956849569495704957149572495734957449575495764957749578495794958049581495824958349584495854958649587495884958949590495914959249593495944959549596495974959849599496004960149602496034960449605496064960749608496094961049611496124961349614496154961649617496184961949620496214962249623496244962549626496274962849629496304963149632496334963449635496364963749638496394964049641496424964349644496454964649647496484964949650496514965249653496544965549656496574965849659496604966149662496634966449665496664966749668496694967049671496724967349674496754967649677496784967949680496814968249683496844968549686496874968849689496904969149692496934969449695496964969749698496994970049701497024970349704497054970649707497084970949710497114971249713497144971549716497174971849719497204972149722497234972449725497264972749728497294973049731497324973349734497354973649737497384973949740497414974249743497444974549746497474974849749497504975149752497534975449755497564975749758497594976049761497624976349764497654976649767497684976949770497714977249773497744977549776497774977849779497804978149782497834978449785497864978749788497894979049791497924979349794497954979649797497984979949800498014980249803498044980549806498074980849809498104981149812498134981449815498164981749818498194982049821498224982349824498254982649827498284982949830498314983249833498344983549836498374983849839498404984149842498434984449845498464984749848498494985049851498524985349854498554985649857498584985949860498614986249863498644986549866498674986849869498704987149872498734987449875498764987749878498794988049881498824988349884498854988649887498884988949890498914989249893498944989549896498974989849899499004990149902499034990449905499064990749908499094991049911499124991349914499154991649917499184991949920499214992249923499244992549926499274992849929499304993149932499334993449935499364993749938499394994049941499424994349944499454994649947499484994949950499514995249953499544995549956499574995849959499604996149962499634996449965499664996749968499694997049971499724997349974499754997649977499784997949980499814998249983499844998549986499874998849989499904999149992499934999449995499964999749998499995000050001500025000350004500055000650007500085000950010500115001250013500145001550016500175001850019500205002150022500235002450025500265002750028500295003050031500325003350034500355003650037500385003950040500415004250043500445004550046500475004850049500505005150052500535005450055500565005750058500595006050061500625006350064500655006650067500685006950070500715007250073500745007550076500775007850079500805008150082500835008450085500865008750088500895009050091500925009350094500955009650097500985009950100501015010250103501045010550106501075010850109501105011150112501135011450115501165011750118501195012050121501225012350124501255012650127501285012950130501315013250133501345013550136501375013850139501405014150142501435014450145501465014750148501495015050151501525015350154501555015650157501585015950160501615016250163501645016550166501675016850169501705017150172501735017450175501765017750178501795018050181501825018350184501855018650187501885018950190501915019250193501945019550196501975019850199502005020150202502035020450205502065020750208502095021050211502125021350214502155021650217502185021950220502215022250223502245022550226502275022850229502305023150232502335023450235502365023750238502395024050241502425024350244502455024650247502485024950250502515025250253502545025550256502575025850259502605026150262502635026450265502665026750268502695027050271502725027350274502755027650277502785027950280502815028250283502845028550286502875028850289502905029150292502935029450295502965029750298502995030050301503025030350304503055030650307503085030950310503115031250313503145031550316503175031850319503205032150322503235032450325503265032750328503295033050331503325033350334503355033650337503385033950340503415034250343503445034550346503475034850349503505035150352503535035450355503565035750358503595036050361503625036350364503655036650367503685036950370503715037250373503745037550376503775037850379503805038150382503835038450385503865038750388503895039050391503925039350394503955039650397503985039950400504015040250403504045040550406504075040850409504105041150412504135041450415504165041750418504195042050421504225042350424504255042650427504285042950430504315043250433504345043550436504375043850439504405044150442504435044450445504465044750448504495045050451504525045350454504555045650457504585045950460504615046250463504645046550466504675046850469504705047150472504735047450475504765047750478504795048050481504825048350484504855048650487504885048950490504915049250493504945049550496504975049850499505005050150502505035050450505505065050750508505095051050511505125051350514505155051650517505185051950520505215052250523505245052550526505275052850529505305053150532505335053450535505365053750538505395054050541505425054350544505455054650547505485054950550505515055250553505545055550556505575055850559505605056150562505635056450565505665056750568505695057050571505725057350574505755057650577505785057950580505815058250583505845058550586505875058850589505905059150592505935059450595505965059750598505995060050601506025060350604506055060650607506085060950610506115061250613506145061550616506175061850619506205062150622506235062450625506265062750628506295063050631506325063350634506355063650637506385063950640506415064250643506445064550646506475064850649506505065150652506535065450655506565065750658506595066050661506625066350664506655066650667506685066950670506715067250673506745067550676506775067850679506805068150682506835068450685506865068750688506895069050691506925069350694506955069650697506985069950700507015070250703507045070550706507075070850709507105071150712507135071450715507165071750718507195072050721507225072350724507255072650727507285072950730507315073250733507345073550736507375073850739507405074150742507435074450745507465074750748507495075050751507525075350754507555075650757507585075950760507615076250763507645076550766507675076850769507705077150772507735077450775507765077750778507795078050781507825078350784507855078650787507885078950790507915079250793507945079550796507975079850799508005080150802508035080450805508065080750808508095081050811508125081350814508155081650817508185081950820508215082250823508245082550826508275082850829508305083150832508335083450835508365083750838508395084050841508425084350844508455084650847508485084950850508515085250853508545085550856508575085850859508605086150862508635086450865508665086750868508695087050871508725087350874508755087650877508785087950880508815088250883508845088550886508875088850889508905089150892508935089450895508965089750898508995090050901509025090350904509055090650907509085090950910509115091250913509145091550916509175091850919509205092150922509235092450925509265092750928509295093050931509325093350934509355093650937509385093950940509415094250943509445094550946509475094850949509505095150952509535095450955509565095750958509595096050961509625096350964509655096650967509685096950970509715097250973509745097550976509775097850979509805098150982509835098450985509865098750988509895099050991509925099350994509955099650997509985099951000510015100251003510045100551006510075100851009510105101151012510135101451015510165101751018510195102051021510225102351024510255102651027510285102951030510315103251033510345103551036510375103851039510405104151042510435104451045510465104751048510495105051051510525105351054510555105651057510585105951060510615106251063510645106551066510675106851069510705107151072510735107451075510765107751078510795108051081510825108351084510855108651087510885108951090510915109251093510945109551096510975109851099511005110151102511035110451105511065110751108511095111051111511125111351114511155111651117511185111951120511215112251123511245112551126511275112851129511305113151132511335113451135511365113751138511395114051141511425114351144511455114651147511485114951150511515115251153511545115551156511575115851159511605116151162511635116451165511665116751168511695117051171511725117351174511755117651177511785117951180511815118251183511845118551186511875118851189511905119151192511935119451195511965119751198511995120051201512025120351204512055120651207512085120951210512115121251213512145121551216512175121851219512205122151222512235122451225512265122751228512295123051231512325123351234512355123651237512385123951240512415124251243512445124551246512475124851249512505125151252512535125451255512565125751258512595126051261512625126351264512655126651267512685126951270512715127251273512745127551276512775127851279512805128151282512835128451285512865128751288512895129051291512925129351294512955129651297512985129951300513015130251303513045130551306513075130851309513105131151312513135131451315513165131751318513195132051321513225132351324513255132651327513285132951330513315133251333513345133551336513375133851339513405134151342513435134451345513465134751348513495135051351513525135351354513555135651357513585135951360513615136251363513645136551366513675136851369513705137151372513735137451375513765137751378513795138051381513825138351384513855138651387513885138951390513915139251393513945139551396513975139851399514005140151402514035140451405514065140751408514095141051411514125141351414514155141651417514185141951420514215142251423514245142551426514275142851429514305143151432514335143451435514365143751438514395144051441514425144351444514455144651447514485144951450514515145251453514545145551456514575145851459514605146151462514635146451465514665146751468514695147051471514725147351474514755147651477514785147951480514815148251483514845148551486514875148851489514905149151492514935149451495514965149751498514995150051501515025150351504515055150651507515085150951510515115151251513515145151551516515175151851519515205152151522515235152451525515265152751528515295153051531515325153351534515355153651537515385153951540515415154251543515445154551546515475154851549515505155151552515535155451555515565155751558515595156051561515625156351564515655156651567515685156951570515715157251573515745157551576515775157851579515805158151582515835158451585515865158751588515895159051591515925159351594515955159651597515985159951600516015160251603516045160551606516075160851609516105161151612516135161451615516165161751618516195162051621516225162351624516255162651627516285162951630516315163251633516345163551636516375163851639516405164151642516435164451645516465164751648516495165051651516525165351654516555165651657516585165951660516615166251663516645166551666516675166851669516705167151672516735167451675516765167751678516795168051681516825168351684516855168651687516885168951690516915169251693516945169551696516975169851699517005170151702517035170451705517065170751708517095171051711517125171351714517155171651717517185171951720517215172251723517245172551726517275172851729517305173151732517335173451735517365173751738517395174051741517425174351744517455174651747517485174951750517515175251753517545175551756517575175851759517605176151762517635176451765517665176751768517695177051771517725177351774517755177651777517785177951780517815178251783517845178551786517875178851789517905179151792517935179451795517965179751798517995180051801518025180351804518055180651807518085180951810518115181251813518145181551816518175181851819518205182151822518235182451825518265182751828518295183051831518325183351834518355183651837518385183951840518415184251843518445184551846518475184851849518505185151852518535185451855518565185751858518595186051861518625186351864518655186651867518685186951870518715187251873518745187551876518775187851879518805188151882518835188451885518865188751888518895189051891518925189351894518955189651897518985189951900519015190251903519045190551906519075190851909519105191151912519135191451915519165191751918519195192051921519225192351924519255192651927519285192951930519315193251933519345193551936519375193851939519405194151942519435194451945519465194751948519495195051951519525195351954519555195651957519585195951960519615196251963519645196551966519675196851969519705197151972519735197451975519765197751978519795198051981519825198351984519855198651987519885198951990519915199251993519945199551996519975199851999520005200152002520035200452005520065200752008520095201052011520125201352014520155201652017520185201952020520215202252023520245202552026520275202852029520305203152032520335203452035520365203752038520395204052041520425204352044520455204652047520485204952050520515205252053520545205552056520575205852059520605206152062520635206452065520665206752068520695207052071520725207352074520755207652077520785207952080520815208252083520845208552086520875208852089520905209152092520935209452095520965209752098520995210052101521025210352104521055210652107521085210952110521115211252113521145211552116521175211852119521205212152122521235212452125521265212752128521295213052131521325213352134521355213652137521385213952140521415214252143521445214552146521475214852149521505215152152521535215452155521565215752158521595216052161521625216352164521655216652167521685216952170521715217252173521745217552176521775217852179521805218152182521835218452185521865218752188521895219052191521925219352194521955219652197521985219952200522015220252203522045220552206522075220852209522105221152212522135221452215522165221752218522195222052221522225222352224522255222652227522285222952230522315223252233522345223552236522375223852239522405224152242522435224452245522465224752248522495225052251522525225352254522555225652257522585225952260522615226252263522645226552266522675226852269522705227152272522735227452275522765227752278522795228052281522825228352284522855228652287522885228952290522915229252293522945229552296522975229852299523005230152302523035230452305523065230752308523095231052311523125231352314523155231652317523185231952320523215232252323523245232552326523275232852329523305233152332523335233452335523365233752338523395234052341523425234352344523455234652347523485234952350523515235252353523545235552356523575235852359523605236152362523635236452365523665236752368523695237052371523725237352374523755237652377523785237952380523815238252383523845238552386523875238852389523905239152392523935239452395523965239752398523995240052401524025240352404524055240652407524085240952410524115241252413524145241552416524175241852419524205242152422524235242452425524265242752428524295243052431524325243352434524355243652437524385243952440524415244252443524445244552446524475244852449524505245152452524535245452455524565245752458524595246052461524625246352464524655246652467524685246952470524715247252473524745247552476524775247852479524805248152482524835248452485524865248752488524895249052491524925249352494524955249652497524985249952500525015250252503525045250552506525075250852509525105251152512525135251452515525165251752518525195252052521525225252352524525255252652527525285252952530525315253252533525345253552536525375253852539525405254152542525435254452545525465254752548525495255052551525525255352554525555255652557525585255952560525615256252563525645256552566525675256852569525705257152572525735257452575525765257752578525795258052581525825258352584525855258652587525885258952590525915259252593525945259552596525975259852599526005260152602526035260452605526065260752608526095261052611526125261352614526155261652617526185261952620526215262252623526245262552626526275262852629526305263152632526335263452635526365263752638526395264052641526425264352644526455264652647526485264952650526515265252653526545265552656526575265852659526605266152662526635266452665526665266752668526695267052671526725267352674526755267652677526785267952680526815268252683526845268552686526875268852689526905269152692526935269452695526965269752698526995270052701527025270352704527055270652707527085270952710527115271252713527145271552716527175271852719527205272152722527235272452725527265272752728527295273052731527325273352734527355273652737527385273952740527415274252743527445274552746527475274852749527505275152752527535275452755527565275752758527595276052761527625276352764527655276652767527685276952770527715277252773527745277552776527775277852779527805278152782527835278452785527865278752788527895279052791527925279352794527955279652797527985279952800528015280252803528045280552806528075280852809528105281152812528135281452815528165281752818528195282052821528225282352824528255282652827528285282952830528315283252833528345283552836528375283852839528405284152842528435284452845528465284752848528495285052851528525285352854528555285652857528585285952860528615286252863528645286552866528675286852869528705287152872528735287452875528765287752878528795288052881528825288352884528855288652887528885288952890528915289252893528945289552896528975289852899529005290152902529035290452905529065290752908529095291052911529125291352914529155291652917529185291952920529215292252923529245292552926529275292852929529305293152932529335293452935529365293752938529395294052941529425294352944529455294652947529485294952950529515295252953529545295552956529575295852959529605296152962529635296452965529665296752968529695297052971529725297352974529755297652977529785297952980529815298252983529845298552986529875298852989529905299152992529935299452995529965299752998529995300053001530025300353004530055300653007530085300953010530115301253013530145301553016530175301853019530205302153022530235302453025530265302753028530295303053031530325303353034530355303653037530385303953040530415304253043530445304553046530475304853049530505305153052530535305453055530565305753058530595306053061530625306353064530655306653067530685306953070530715307253073530745307553076530775307853079530805308153082530835308453085530865308753088530895309053091530925309353094530955309653097530985309953100531015310253103531045310553106531075310853109531105311153112531135311453115531165311753118531195312053121531225312353124531255312653127531285312953130531315313253133531345313553136531375313853139531405314153142531435314453145531465314753148531495315053151531525315353154531555315653157531585315953160531615316253163531645316553166531675316853169531705317153172531735317453175531765317753178531795318053181531825318353184531855318653187531885318953190531915319253193531945319553196531975319853199532005320153202532035320453205532065320753208532095321053211532125321353214532155321653217532185321953220532215322253223532245322553226532275322853229532305323153232532335323453235532365323753238532395324053241532425324353244532455324653247532485324953250532515325253253532545325553256532575325853259532605326153262532635326453265532665326753268532695327053271532725327353274532755327653277532785327953280532815328253283532845328553286532875328853289532905329153292532935329453295532965329753298532995330053301533025330353304533055330653307533085330953310533115331253313533145331553316533175331853319533205332153322533235332453325533265332753328533295333053331533325333353334533355333653337533385333953340533415334253343533445334553346533475334853349533505335153352533535335453355533565335753358533595336053361533625336353364533655336653367533685336953370533715337253373533745337553376533775337853379533805338153382533835338453385533865338753388533895339053391533925339353394533955339653397533985339953400534015340253403534045340553406534075340853409534105341153412534135341453415534165341753418534195342053421534225342353424534255342653427534285342953430534315343253433534345343553436534375343853439534405344153442534435344453445534465344753448534495345053451534525345353454534555345653457534585345953460534615346253463534645346553466534675346853469534705347153472534735347453475534765347753478534795348053481534825348353484534855348653487534885348953490534915349253493534945349553496534975349853499535005350153502535035350453505535065350753508535095351053511535125351353514535155351653517535185351953520535215352253523535245352553526535275352853529535305353153532535335353453535535365353753538535395354053541535425354353544535455354653547535485354953550535515355253553535545355553556535575355853559535605356153562535635356453565535665356753568535695357053571535725357353574535755357653577535785357953580535815358253583535845358553586535875358853589535905359153592535935359453595535965359753598535995360053601536025360353604536055360653607536085360953610536115361253613536145361553616536175361853619536205362153622536235362453625536265362753628536295363053631536325363353634536355363653637536385363953640536415364253643536445364553646536475364853649536505365153652536535365453655536565365753658536595366053661536625366353664536655366653667536685366953670536715367253673536745367553676536775367853679536805368153682536835368453685536865368753688536895369053691536925369353694536955369653697536985369953700537015370253703537045370553706537075370853709537105371153712537135371453715537165371753718537195372053721537225372353724537255372653727537285372953730537315373253733537345373553736537375373853739537405374153742537435374453745537465374753748537495375053751537525375353754537555375653757537585375953760537615376253763537645376553766537675376853769537705377153772537735377453775537765377753778537795378053781537825378353784537855378653787537885378953790537915379253793537945379553796537975379853799538005380153802538035380453805538065380753808538095381053811538125381353814538155381653817538185381953820538215382253823538245382553826538275382853829538305383153832538335383453835538365383753838538395384053841538425384353844538455384653847538485384953850538515385253853538545385553856538575385853859538605386153862538635386453865538665386753868538695387053871538725387353874538755387653877538785387953880538815388253883538845388553886538875388853889538905389153892538935389453895538965389753898538995390053901539025390353904539055390653907539085390953910539115391253913539145391553916539175391853919539205392153922539235392453925539265392753928539295393053931539325393353934539355393653937539385393953940539415394253943539445394553946539475394853949539505395153952539535395453955539565395753958539595396053961539625396353964539655396653967539685396953970539715397253973539745397553976539775397853979539805398153982539835398453985539865398753988539895399053991539925399353994539955399653997539985399954000540015400254003540045400554006540075400854009540105401154012540135401454015540165401754018540195402054021540225402354024540255402654027540285402954030540315403254033540345403554036540375403854039540405404154042540435404454045540465404754048540495405054051540525405354054540555405654057540585405954060540615406254063540645406554066540675406854069540705407154072540735407454075540765407754078540795408054081540825408354084540855408654087540885408954090540915409254093540945409554096540975409854099541005410154102541035410454105541065410754108541095411054111541125411354114541155411654117541185411954120541215412254123541245412554126541275412854129541305413154132541335413454135541365413754138541395414054141541425414354144541455414654147541485414954150541515415254153541545415554156541575415854159541605416154162541635416454165541665416754168541695417054171541725417354174541755417654177541785417954180541815418254183541845418554186541875418854189541905419154192541935419454195541965419754198541995420054201542025420354204542055420654207542085420954210542115421254213542145421554216542175421854219542205422154222542235422454225542265422754228542295423054231542325423354234542355423654237542385423954240542415424254243542445424554246542475424854249542505425154252542535425454255542565425754258542595426054261542625426354264542655426654267542685426954270542715427254273542745427554276542775427854279542805428154282542835428454285542865428754288542895429054291542925429354294542955429654297542985429954300543015430254303543045430554306543075430854309543105431154312543135431454315543165431754318543195432054321543225432354324543255432654327543285432954330543315433254333543345433554336543375433854339543405434154342543435434454345543465434754348543495435054351543525435354354543555435654357543585435954360543615436254363543645436554366543675436854369543705437154372543735437454375543765437754378543795438054381543825438354384543855438654387543885438954390543915439254393543945439554396543975439854399544005440154402544035440454405544065440754408544095441054411544125441354414544155441654417544185441954420544215442254423544245442554426544275442854429544305443154432544335443454435544365443754438544395444054441544425444354444544455444654447544485444954450544515445254453544545445554456544575445854459544605446154462544635446454465544665446754468544695447054471544725447354474544755447654477544785447954480544815448254483544845448554486544875448854489544905449154492544935449454495544965449754498544995450054501545025450354504545055450654507545085450954510545115451254513545145451554516545175451854519545205452154522545235452454525545265452754528545295453054531545325453354534545355453654537545385453954540545415454254543545445454554546545475454854549545505455154552545535455454555545565455754558545595456054561545625456354564545655456654567545685456954570545715457254573545745457554576545775457854579545805458154582545835458454585545865458754588545895459054591545925459354594545955459654597545985459954600546015460254603546045460554606546075460854609546105461154612546135461454615546165461754618546195462054621546225462354624546255462654627546285462954630546315463254633546345463554636546375463854639546405464154642546435464454645546465464754648546495465054651546525465354654546555465654657546585465954660546615466254663546645466554666546675466854669546705467154672546735467454675546765467754678546795468054681546825468354684546855468654687546885468954690546915469254693546945469554696546975469854699547005470154702547035470454705547065470754708547095471054711547125471354714547155471654717547185471954720547215472254723547245472554726547275472854729547305473154732547335473454735547365473754738547395474054741547425474354744547455474654747547485474954750547515475254753547545475554756547575475854759547605476154762547635476454765547665476754768547695477054771547725477354774547755477654777547785477954780547815478254783547845478554786547875478854789547905479154792547935479454795547965479754798547995480054801548025480354804548055480654807548085480954810548115481254813548145481554816548175481854819548205482154822548235482454825548265482754828548295483054831548325483354834548355483654837548385483954840548415484254843548445484554846548475484854849548505485154852548535485454855548565485754858548595486054861548625486354864548655486654867548685486954870548715487254873548745487554876548775487854879548805488154882548835488454885548865488754888548895489054891548925489354894548955489654897548985489954900549015490254903549045490554906549075490854909549105491154912549135491454915549165491754918549195492054921549225492354924549255492654927549285492954930549315493254933549345493554936549375493854939549405494154942549435494454945549465494754948549495495054951549525495354954549555495654957549585495954960549615496254963549645496554966549675496854969549705497154972549735497454975549765497754978549795498054981549825498354984549855498654987549885498954990549915499254993549945499554996549975499854999550005500155002550035500455005550065500755008550095501055011550125501355014550155501655017550185501955020550215502255023550245502555026550275502855029550305503155032550335503455035550365503755038550395504055041550425504355044550455504655047550485504955050550515505255053550545505555056550575505855059550605506155062550635506455065550665506755068550695507055071550725507355074550755507655077550785507955080550815508255083550845508555086550875508855089550905509155092550935509455095550965509755098550995510055101551025510355104551055510655107551085510955110551115511255113551145511555116551175511855119551205512155122551235512455125551265512755128551295513055131551325513355134551355513655137551385513955140551415514255143551445514555146551475514855149551505515155152551535515455155551565515755158551595516055161551625516355164551655516655167551685516955170551715517255173551745517555176551775517855179551805518155182551835518455185551865518755188551895519055191551925519355194551955519655197551985519955200552015520255203552045520555206552075520855209552105521155212552135521455215552165521755218552195522055221552225522355224552255522655227552285522955230552315523255233552345523555236552375523855239552405524155242552435524455245552465524755248552495525055251552525525355254552555525655257552585525955260552615526255263552645526555266552675526855269552705527155272552735527455275552765527755278552795528055281552825528355284552855528655287552885528955290552915529255293552945529555296552975529855299553005530155302553035530455305553065530755308553095531055311553125531355314553155531655317553185531955320553215532255323553245532555326553275532855329553305533155332553335533455335553365533755338553395534055341553425534355344553455534655347553485534955350553515535255353553545535555356553575535855359553605536155362553635536455365553665536755368553695537055371553725537355374553755537655377553785537955380553815538255383553845538555386553875538855389553905539155392553935539455395553965539755398553995540055401554025540355404554055540655407554085540955410554115541255413554145541555416554175541855419554205542155422554235542455425554265542755428554295543055431554325543355434554355543655437554385543955440554415544255443554445544555446554475544855449554505545155452554535545455455554565545755458554595546055461554625546355464554655546655467554685546955470554715547255473554745547555476554775547855479554805548155482554835548455485554865548755488554895549055491554925549355494554955549655497554985549955500555015550255503555045550555506555075550855509555105551155512555135551455515555165551755518555195552055521555225552355524555255552655527555285552955530555315553255533555345553555536555375553855539555405554155542555435554455545555465554755548555495555055551555525555355554555555555655557555585555955560555615556255563555645556555566555675556855569555705557155572555735557455575555765557755578555795558055581555825558355584555855558655587555885558955590555915559255593555945559555596555975559855599556005560155602556035560455605556065560755608556095561055611556125561355614556155561655617556185561955620556215562255623556245562555626556275562855629556305563155632556335563455635556365563755638556395564055641556425564355644556455564655647556485564955650556515565255653556545565555656556575565855659556605566155662556635566455665556665566755668556695567055671556725567355674556755567655677556785567955680556815568255683556845568555686556875568855689556905569155692556935569455695556965569755698556995570055701557025570355704557055570655707557085570955710557115571255713557145571555716557175571855719557205572155722557235572455725557265572755728557295573055731557325573355734557355573655737557385573955740557415574255743557445574555746557475574855749557505575155752557535575455755557565575755758557595576055761557625576355764557655576655767557685576955770557715577255773557745577555776557775577855779557805578155782557835578455785557865578755788557895579055791557925579355794557955579655797557985579955800558015580255803558045580555806558075580855809558105581155812558135581455815558165581755818558195582055821558225582355824558255582655827558285582955830558315583255833558345583555836558375583855839558405584155842558435584455845558465584755848558495585055851558525585355854558555585655857558585585955860558615586255863558645586555866558675586855869558705587155872558735587455875558765587755878558795588055881558825588355884558855588655887558885588955890558915589255893558945589555896558975589855899559005590155902559035590455905559065590755908559095591055911559125591355914559155591655917559185591955920559215592255923559245592555926559275592855929559305593155932559335593455935559365593755938559395594055941559425594355944559455594655947559485594955950559515595255953559545595555956559575595855959559605596155962559635596455965559665596755968559695597055971559725597355974559755597655977559785597955980559815598255983559845598555986559875598855989559905599155992559935599455995559965599755998559995600056001560025600356004560055600656007560085600956010560115601256013560145601556016560175601856019560205602156022560235602456025560265602756028560295603056031560325603356034560355603656037560385603956040560415604256043560445604556046560475604856049560505605156052560535605456055560565605756058560595606056061560625606356064560655606656067560685606956070560715607256073560745607556076560775607856079560805608156082560835608456085560865608756088560895609056091560925609356094560955609656097560985609956100561015610256103561045610556106561075610856109561105611156112561135611456115561165611756118561195612056121561225612356124561255612656127561285612956130561315613256133561345613556136561375613856139561405614156142561435614456145561465614756148561495615056151561525615356154561555615656157561585615956160561615616256163561645616556166561675616856169561705617156172561735617456175561765617756178561795618056181561825618356184561855618656187561885618956190561915619256193561945619556196561975619856199562005620156202562035620456205562065620756208562095621056211562125621356214562155621656217562185621956220562215622256223562245622556226562275622856229562305623156232562335623456235562365623756238562395624056241562425624356244562455624656247562485624956250562515625256253562545625556256562575625856259562605626156262562635626456265562665626756268562695627056271562725627356274562755627656277562785627956280562815628256283562845628556286562875628856289562905629156292562935629456295562965629756298562995630056301563025630356304563055630656307563085630956310563115631256313563145631556316563175631856319563205632156322563235632456325563265632756328563295633056331563325633356334563355633656337563385633956340563415634256343563445634556346563475634856349563505635156352563535635456355563565635756358563595636056361563625636356364563655636656367563685636956370563715637256373563745637556376563775637856379563805638156382563835638456385563865638756388563895639056391563925639356394563955639656397563985639956400564015640256403564045640556406564075640856409564105641156412564135641456415564165641756418564195642056421564225642356424564255642656427564285642956430564315643256433564345643556436564375643856439564405644156442564435644456445564465644756448564495645056451564525645356454564555645656457564585645956460564615646256463564645646556466564675646856469564705647156472564735647456475564765647756478564795648056481564825648356484564855648656487564885648956490564915649256493564945649556496564975649856499565005650156502565035650456505565065650756508565095651056511565125651356514565155651656517565185651956520565215652256523565245652556526565275652856529565305653156532565335653456535565365653756538565395654056541565425654356544565455654656547565485654956550565515655256553565545655556556565575655856559565605656156562565635656456565565665656756568565695657056571565725657356574565755657656577565785657956580565815658256583565845658556586565875658856589565905659156592565935659456595565965659756598565995660056601566025660356604566055660656607566085660956610566115661256613566145661556616566175661856619566205662156622566235662456625566265662756628566295663056631566325663356634566355663656637566385663956640566415664256643566445664556646566475664856649566505665156652566535665456655566565665756658566595666056661566625666356664566655666656667566685666956670566715667256673566745667556676566775667856679566805668156682566835668456685566865668756688566895669056691566925669356694566955669656697566985669956700567015670256703567045670556706567075670856709567105671156712567135671456715567165671756718567195672056721567225672356724567255672656727567285672956730567315673256733567345673556736567375673856739567405674156742567435674456745567465674756748567495675056751567525675356754567555675656757567585675956760567615676256763567645676556766567675676856769567705677156772567735677456775567765677756778567795678056781567825678356784567855678656787567885678956790567915679256793567945679556796567975679856799568005680156802568035680456805568065680756808568095681056811568125681356814568155681656817568185681956820568215682256823568245682556826568275682856829568305683156832568335683456835568365683756838568395684056841568425684356844568455684656847568485684956850568515685256853568545685556856568575685856859568605686156862568635686456865568665686756868568695687056871568725687356874568755687656877568785687956880568815688256883568845688556886568875688856889568905689156892568935689456895568965689756898568995690056901569025690356904569055690656907569085690956910569115691256913569145691556916569175691856919569205692156922569235692456925569265692756928569295693056931569325693356934569355693656937569385693956940569415694256943569445694556946569475694856949569505695156952569535695456955569565695756958569595696056961569625696356964569655696656967569685696956970569715697256973569745697556976569775697856979569805698156982569835698456985569865698756988569895699056991569925699356994569955699656997569985699957000570015700257003570045700557006570075700857009570105701157012570135701457015570165701757018570195702057021570225702357024570255702657027570285702957030570315703257033570345703557036570375703857039570405704157042570435704457045570465704757048570495705057051570525705357054570555705657057570585705957060570615706257063570645706557066570675706857069570705707157072570735707457075570765707757078570795708057081570825708357084570855708657087570885708957090570915709257093570945709557096570975709857099571005710157102571035710457105571065710757108571095711057111571125711357114571155711657117571185711957120571215712257123571245712557126571275712857129571305713157132571335713457135571365713757138571395714057141571425714357144571455714657147571485714957150571515715257153571545715557156571575715857159571605716157162571635716457165571665716757168571695717057171571725717357174571755717657177571785717957180571815718257183571845718557186571875718857189571905719157192571935719457195571965719757198571995720057201572025720357204572055720657207572085720957210572115721257213572145721557216572175721857219572205722157222572235722457225572265722757228572295723057231572325723357234572355723657237572385723957240572415724257243572445724557246572475724857249572505725157252572535725457255572565725757258572595726057261572625726357264572655726657267572685726957270572715727257273572745727557276572775727857279572805728157282572835728457285572865728757288572895729057291572925729357294572955729657297572985729957300573015730257303573045730557306573075730857309573105731157312573135731457315573165731757318573195732057321573225732357324573255732657327573285732957330573315733257333573345733557336573375733857339573405734157342573435734457345573465734757348573495735057351573525735357354573555735657357573585735957360573615736257363573645736557366573675736857369573705737157372573735737457375573765737757378573795738057381573825738357384573855738657387573885738957390573915739257393573945739557396573975739857399574005740157402574035740457405574065740757408574095741057411574125741357414574155741657417574185741957420574215742257423574245742557426574275742857429574305743157432574335743457435574365743757438574395744057441574425744357444574455744657447574485744957450574515745257453574545745557456574575745857459574605746157462574635746457465574665746757468574695747057471574725747357474574755747657477574785747957480574815748257483574845748557486574875748857489574905749157492574935749457495574965749757498574995750057501575025750357504575055750657507575085750957510575115751257513575145751557516575175751857519575205752157522575235752457525575265752757528575295753057531575325753357534575355753657537575385753957540575415754257543575445754557546575475754857549575505755157552575535755457555575565755757558575595756057561575625756357564575655756657567575685756957570575715757257573575745757557576575775757857579575805758157582575835758457585575865758757588575895759057591575925759357594575955759657597575985759957600576015760257603576045760557606576075760857609576105761157612576135761457615576165761757618576195762057621576225762357624576255762657627576285762957630576315763257633576345763557636576375763857639576405764157642576435764457645576465764757648576495765057651576525765357654576555765657657576585765957660576615766257663576645766557666576675766857669576705767157672576735767457675576765767757678576795768057681576825768357684576855768657687576885768957690576915769257693576945769557696576975769857699577005770157702577035770457705577065770757708577095771057711577125771357714577155771657717577185771957720577215772257723577245772557726577275772857729577305773157732577335773457735577365773757738577395774057741577425774357744577455774657747577485774957750577515775257753577545775557756577575775857759577605776157762577635776457765577665776757768577695777057771577725777357774577755777657777577785777957780577815778257783577845778557786577875778857789577905779157792577935779457795577965779757798577995780057801578025780357804578055780657807578085780957810578115781257813578145781557816578175781857819578205782157822578235782457825578265782757828578295783057831578325783357834578355783657837578385783957840578415784257843578445784557846578475784857849578505785157852578535785457855578565785757858578595786057861578625786357864578655786657867578685786957870578715787257873578745787557876578775787857879578805788157882578835788457885578865788757888578895789057891578925789357894578955789657897578985789957900579015790257903579045790557906579075790857909579105791157912579135791457915579165791757918579195792057921579225792357924579255792657927579285792957930579315793257933579345793557936579375793857939579405794157942579435794457945579465794757948579495795057951579525795357954579555795657957579585795957960579615796257963579645796557966579675796857969579705797157972579735797457975579765797757978579795798057981579825798357984579855798657987579885798957990579915799257993579945799557996579975799857999580005800158002580035800458005580065800758008580095801058011580125801358014580155801658017580185801958020580215802258023580245802558026580275802858029580305803158032580335803458035580365803758038580395804058041580425804358044580455804658047580485804958050580515805258053580545805558056580575805858059580605806158062580635806458065580665806758068580695807058071580725807358074580755807658077580785807958080580815808258083580845808558086580875808858089580905809158092580935809458095580965809758098580995810058101581025810358104581055810658107581085810958110581115811258113581145811558116581175811858119581205812158122581235812458125581265812758128581295813058131581325813358134581355813658137581385813958140581415814258143581445814558146581475814858149581505815158152581535815458155581565815758158581595816058161581625816358164581655816658167581685816958170581715817258173581745817558176581775817858179581805818158182581835818458185581865818758188581895819058191581925819358194581955819658197581985819958200582015820258203582045820558206582075820858209582105821158212582135821458215582165821758218582195822058221582225822358224582255822658227582285822958230582315823258233582345823558236582375823858239582405824158242582435824458245582465824758248582495825058251582525825358254582555825658257582585825958260582615826258263582645826558266582675826858269582705827158272582735827458275582765827758278582795828058281582825828358284582855828658287582885828958290582915829258293582945829558296582975829858299583005830158302583035830458305583065830758308583095831058311583125831358314583155831658317583185831958320583215832258323583245832558326583275832858329583305833158332583335833458335583365833758338583395834058341583425834358344583455834658347583485834958350583515835258353583545835558356583575835858359583605836158362583635836458365583665836758368583695837058371583725837358374583755837658377583785837958380583815838258383583845838558386583875838858389583905839158392583935839458395583965839758398583995840058401584025840358404584055840658407584085840958410584115841258413584145841558416584175841858419584205842158422584235842458425584265842758428584295843058431584325843358434584355843658437584385843958440584415844258443584445844558446584475844858449584505845158452584535845458455584565845758458584595846058461584625846358464584655846658467584685846958470584715847258473584745847558476584775847858479584805848158482584835848458485584865848758488584895849058491584925849358494584955849658497584985849958500585015850258503585045850558506585075850858509585105851158512585135851458515585165851758518585195852058521585225852358524585255852658527585285852958530585315853258533585345853558536585375853858539585405854158542585435854458545585465854758548585495855058551585525855358554585555855658557585585855958560585615856258563585645856558566585675856858569585705857158572585735857458575585765857758578585795858058581585825858358584585855858658587585885858958590585915859258593585945859558596585975859858599586005860158602586035860458605586065860758608586095861058611586125861358614586155861658617586185861958620586215862258623586245862558626586275862858629586305863158632586335863458635586365863758638586395864058641586425864358644586455864658647586485864958650586515865258653586545865558656586575865858659586605866158662586635866458665586665866758668586695867058671586725867358674586755867658677586785867958680586815868258683586845868558686586875868858689586905869158692586935869458695586965869758698586995870058701587025870358704587055870658707587085870958710587115871258713587145871558716587175871858719587205872158722587235872458725587265872758728587295873058731587325873358734587355873658737587385873958740587415874258743587445874558746587475874858749587505875158752587535875458755587565875758758587595876058761587625876358764587655876658767587685876958770587715877258773587745877558776587775877858779587805878158782587835878458785587865878758788587895879058791587925879358794587955879658797587985879958800588015880258803588045880558806588075880858809588105881158812588135881458815588165881758818588195882058821588225882358824588255882658827588285882958830588315883258833588345883558836588375883858839588405884158842588435884458845588465884758848588495885058851588525885358854588555885658857588585885958860588615886258863588645886558866588675886858869588705887158872588735887458875588765887758878588795888058881588825888358884588855888658887588885888958890588915889258893588945889558896588975889858899589005890158902589035890458905589065890758908589095891058911589125891358914589155891658917589185891958920589215892258923589245892558926589275892858929589305893158932589335893458935589365893758938589395894058941589425894358944589455894658947589485894958950589515895258953589545895558956589575895858959589605896158962589635896458965589665896758968589695897058971589725897358974589755897658977589785897958980589815898258983589845898558986589875898858989589905899158992589935899458995589965899758998589995900059001590025900359004590055900659007590085900959010590115901259013590145901559016590175901859019590205902159022590235902459025590265902759028590295903059031590325903359034590355903659037590385903959040590415904259043590445904559046590475904859049590505905159052590535905459055590565905759058590595906059061590625906359064590655906659067590685906959070590715907259073590745907559076590775907859079590805908159082590835908459085590865908759088590895909059091590925909359094590955909659097590985909959100591015910259103591045910559106591075910859109591105911159112591135911459115591165911759118591195912059121591225912359124591255912659127591285912959130591315913259133591345913559136591375913859139591405914159142591435914459145591465914759148591495915059151591525915359154591555915659157591585915959160591615916259163591645916559166591675916859169591705917159172591735917459175591765917759178591795918059181591825918359184591855918659187591885918959190591915919259193591945919559196591975919859199592005920159202592035920459205592065920759208592095921059211592125921359214592155921659217592185921959220592215922259223592245922559226592275922859229592305923159232592335923459235592365923759238592395924059241592425924359244592455924659247592485924959250592515925259253592545925559256592575925859259592605926159262592635926459265592665926759268592695927059271592725927359274592755927659277592785927959280592815928259283592845928559286592875928859289592905929159292592935929459295592965929759298592995930059301593025930359304593055930659307593085930959310593115931259313593145931559316593175931859319593205932159322593235932459325593265932759328593295933059331593325933359334593355933659337593385933959340593415934259343593445934559346593475934859349593505935159352593535935459355593565935759358593595936059361593625936359364593655936659367593685936959370593715937259373593745937559376593775937859379593805938159382593835938459385593865938759388593895939059391593925939359394593955939659397593985939959400594015940259403594045940559406594075940859409594105941159412594135941459415594165941759418594195942059421594225942359424594255942659427594285942959430594315943259433594345943559436594375943859439594405944159442594435944459445594465944759448594495945059451594525945359454594555945659457594585945959460594615946259463594645946559466594675946859469594705947159472594735947459475594765947759478594795948059481594825948359484594855948659487594885948959490594915949259493594945949559496594975949859499595005950159502595035950459505595065950759508595095951059511595125951359514595155951659517595185951959520595215952259523595245952559526595275952859529595305953159532595335953459535595365953759538595395954059541595425954359544595455954659547595485954959550595515955259553595545955559556595575955859559595605956159562595635956459565595665956759568595695957059571595725957359574595755957659577595785957959580595815958259583595845958559586595875958859589595905959159592595935959459595595965959759598595995960059601596025960359604596055960659607596085960959610596115961259613596145961559616596175961859619596205962159622596235962459625596265962759628596295963059631596325963359634596355963659637596385963959640596415964259643596445964559646596475964859649596505965159652596535965459655596565965759658596595966059661596625966359664596655966659667596685966959670596715967259673596745967559676596775967859679596805968159682596835968459685596865968759688596895969059691596925969359694596955969659697596985969959700597015970259703597045970559706597075970859709597105971159712597135971459715597165971759718597195972059721597225972359724597255972659727597285972959730597315973259733597345973559736597375973859739597405974159742597435974459745597465974759748597495975059751597525975359754597555975659757597585975959760597615976259763597645976559766597675976859769597705977159772597735977459775597765977759778597795978059781597825978359784597855978659787597885978959790597915979259793597945979559796597975979859799598005980159802598035980459805598065980759808598095981059811598125981359814598155981659817598185981959820598215982259823598245982559826598275982859829598305983159832598335983459835598365983759838598395984059841598425984359844598455984659847598485984959850598515985259853598545985559856598575985859859598605986159862598635986459865598665986759868598695987059871598725987359874598755987659877598785987959880598815988259883598845988559886598875988859889598905989159892598935989459895598965989759898598995990059901599025990359904599055990659907599085990959910599115991259913599145991559916599175991859919599205992159922599235992459925599265992759928599295993059931599325993359934599355993659937599385993959940599415994259943599445994559946599475994859949599505995159952599535995459955599565995759958599595996059961599625996359964599655996659967599685996959970599715997259973599745997559976599775997859979599805998159982599835998459985599865998759988599895999059991599925999359994599955999659997599985999960000600016000260003600046000560006600076000860009600106001160012600136001460015600166001760018600196002060021600226002360024600256002660027600286002960030600316003260033600346003560036600376003860039600406004160042600436004460045600466004760048600496005060051600526005360054600556005660057600586005960060600616006260063600646006560066600676006860069600706007160072600736007460075600766007760078600796008060081600826008360084600856008660087600886008960090600916009260093600946009560096600976009860099601006010160102601036010460105601066010760108601096011060111601126011360114601156011660117601186011960120601216012260123601246012560126601276012860129601306013160132601336013460135601366013760138601396014060141601426014360144601456014660147601486014960150601516015260153601546015560156601576015860159601606016160162601636016460165601666016760168601696017060171601726017360174601756017660177601786017960180601816018260183601846018560186601876018860189601906019160192601936019460195601966019760198601996020060201602026020360204602056020660207602086020960210602116021260213602146021560216602176021860219602206022160222602236022460225602266022760228602296023060231602326023360234602356023660237602386023960240602416024260243602446024560246602476024860249602506025160252602536025460255602566025760258602596026060261602626026360264602656026660267602686026960270602716027260273602746027560276602776027860279602806028160282602836028460285602866028760288602896029060291602926029360294602956029660297602986029960300603016030260303603046030560306603076030860309
  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_04_29 09_57"};
  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-8955ezAWNeCZqSsf/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-8955jN02K9nWoTjp/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-89559j3WqZYf2bRf/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 = $('body').find('.command_container');
  19813. for (var i = 0; i < todos.length; i++) {
  19814. if ($(todos[i]).data('command') == function_obj.commands[j]) {
  19815. $( 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. ret += elementExpressionCode(command_obj.expression);
  20155. return ret;
  20156. }
  20157. function elementExpressionCode(expression_obj) {
  20158. var ret = '';
  20159. for (var i = 0; i < expression_obj.length; i++) {
  20160. if (expression_obj[i].type) {
  20161. ret += variableValueMenuCode(expression_obj[i]);
  20162. } else if (expression_obj[i].type_op) {
  20163. switch (expression_obj[i].item) {
  20164. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].plus:
  20165. ret += ' + ';
  20166. break;
  20167. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].minus:
  20168. ret += ' - ';
  20169. break;
  20170. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].multiplication:
  20171. ret += ' * ';
  20172. break;
  20173. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].division:
  20174. ret += ' / ';
  20175. break;
  20176. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].module:
  20177. ret += ' % ';
  20178. break;
  20179. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["LOGIC_COMPARISON"].equals_to:
  20180. ret += ' == ';
  20181. break;
  20182. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["LOGIC_COMPARISON"].not_equals_to:
  20183. ret += ' != ';
  20184. break;
  20185. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["LOGIC_COMPARISON"].and:
  20186. ret += ' ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('and') + ' ';
  20187. break;
  20188. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["LOGIC_COMPARISON"].or:
  20189. ret += ' ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('or') + ' ';
  20190. break;
  20191. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["LOGIC_COMPARISON"].not:
  20192. ret += ' ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('not') + ' ';
  20193. break;
  20194. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_COMPARISON"].greater_than:
  20195. ret += ' > ';
  20196. break;
  20197. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_COMPARISON"].less_than:
  20198. ret += ' < ';
  20199. break;
  20200. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_COMPARISON"].greater_than_or_equals_to:
  20201. ret += ' >= ';
  20202. break;
  20203. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_COMPARISON"].less_than_or_equals_to:
  20204. ret += ' <= ';
  20205. break;
  20206. }
  20207. } else {
  20208. ret += ' ' + expression_obj[i] + ' ';
  20209. }
  20210. }
  20211. return ret;
  20212. }
  20213. function functioncallsCode(command_obj, indentation) {
  20214. var ret = '\n';
  20215. for (var i = 0; i < indentation; i++) {
  20216. ret += '\t';
  20217. }
  20218. ret += variableValueMenuCode(command_obj.function_called);
  20219. return ret;
  20220. }
  20221. function readersCode(command_obj, indentation) {
  20222. var ret = '\n';
  20223. for (var i = 0; i < indentation; i++) {
  20224. ret += '\t';
  20225. }
  20226. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_command_read') + ' ( ';
  20227. ret += variableValueMenuCode(command_obj.variable_value_menu);
  20228. ret += ' ) ';
  20229. return ret;
  20230. }
  20231. function variableValueMenuCode(variable_obj) {
  20232. var is_return = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  20233. var ret = '';
  20234. try {
  20235. if (variable_obj.function_called) {
  20236. if (variable_obj.function_called.name) {
  20237. ret += variable_obj.function_called.name + ' ( ';
  20238. } else {
  20239. 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) + ' ( ';
  20240. }
  20241. if (variable_obj.parameters_list) {
  20242. for (var i = 0; i < variable_obj.parameters_list.length; i++) {
  20243. ret += variableValueMenuCode(variable_obj.parameters_list[i]);
  20244. if (i + 1 < variable_obj.parameters_list.length) {
  20245. ret += ', ';
  20246. }
  20247. }
  20248. }
  20249. ret += ' )';
  20250. } else if (variable_obj.content.type) {
  20251. ret += variable_obj.content.name;
  20252. if (variable_obj.content.dimensions == 1 && variable_obj.dimensions != 1) {
  20253. ret += ' [ ' + variableValueMenuCode(variable_obj.column) + ' ] ';
  20254. }
  20255. if (variable_obj.content.dimensions == 2 && variable_obj.dimensions != 2) {
  20256. ret += ' [ ' + variableValueMenuCode(variable_obj.row) + ' ] ';
  20257. ret += ' [ ' + variableValueMenuCode(variable_obj.column) + ' ] ';
  20258. }
  20259. } else {
  20260. if (isNaN(variable_obj.content)) {
  20261. ret += '"' + variable_obj.content + '"';
  20262. } else {
  20263. ret += variable_obj.content;
  20264. }
  20265. }
  20266. } catch (err) {
  20267. if (!is_return) {
  20268. _utils__WEBPACK_IMPORTED_MODULE_7__["renderErrorMessage"](variable_obj.dom_object, _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('inform_valid_content'));
  20269. throw err;
  20270. }
  20271. }
  20272. return ret;
  20273. }
  20274. function writersCode(command_obj, indentation) {
  20275. var ret = '\n';
  20276. for (var i = 0; i < indentation; i++) {
  20277. ret += '\t';
  20278. }
  20279. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_command_write') + ' ( ';
  20280. for (var i = 0; i < command_obj.content.length; i++) {
  20281. ret += variableValueMenuCode(command_obj.content[i]);
  20282. if (i + 1 < command_obj.content.length) {
  20283. ret += ' + ';
  20284. }
  20285. }
  20286. ret += ' ) ';
  20287. return ret;
  20288. }
  20289. function commentsCode(command_obj, indentation) {
  20290. var ret = '\n';
  20291. for (var i = 0; i < indentation; i++) {
  20292. ret += '\t';
  20293. }
  20294. ret += '// ';
  20295. ret += command_obj.comment_text.content;
  20296. return ret;
  20297. }
  20298. function parametersCode(parameter_obj) {
  20299. var ret = '';
  20300. switch (parameter_obj.type) {
  20301. case _types__WEBPACK_IMPORTED_MODULE_1__["Types"].INTEGER:
  20302. ret += ' ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('integer') + ' ';
  20303. break;
  20304. case _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL:
  20305. ret += ' ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('real') + ' ';
  20306. break;
  20307. case _types__WEBPACK_IMPORTED_MODULE_1__["Types"].TEXT:
  20308. ret += ' ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text') + ' ';
  20309. break;
  20310. case _types__WEBPACK_IMPORTED_MODULE_1__["Types"].BOOLEAN:
  20311. ret += ' ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('boolean') + ' ';
  20312. break;
  20313. }
  20314. ret += parameter_obj.name + '';
  20315. if (parameter_obj.dimensions == 1) {
  20316. ret += ' []';
  20317. } else if (parameter_obj.dimensions == 2) {
  20318. ret += ' [][]';
  20319. }
  20320. return ret;
  20321. }
  20322. function variablesCode(variable_obj) {
  20323. var ret = '';
  20324. var temp = variable_obj;
  20325. ret += '\n\t\t';
  20326. if (temp.is_constant) {
  20327. ret += 'const ';
  20328. }
  20329. switch (temp.type) {
  20330. case _types__WEBPACK_IMPORTED_MODULE_1__["Types"].INTEGER:
  20331. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('integer') + ' ';
  20332. break;
  20333. case _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL:
  20334. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('real') + ' ';
  20335. break;
  20336. case _types__WEBPACK_IMPORTED_MODULE_1__["Types"].TEXT:
  20337. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text') + ' ';
  20338. break;
  20339. case _types__WEBPACK_IMPORTED_MODULE_1__["Types"].BOOLEAN:
  20340. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('boolean') + ' ';
  20341. break;
  20342. }
  20343. ret += temp.name + ' ';
  20344. if (temp.dimensions == 1) {
  20345. ret += '[' + temp.columns + '] ';
  20346. switch (temp.type) {
  20347. case _types__WEBPACK_IMPORTED_MODULE_1__["Types"].INTEGER:
  20348. ret += '= {' + temp.value + '}';
  20349. break;
  20350. case _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL:
  20351. ret += '= {' + temp.value.toFixed(2) + '}';
  20352. break;
  20353. case _types__WEBPACK_IMPORTED_MODULE_1__["Types"].TEXT:
  20354. ret += '= {';
  20355. for (var j = 0; j < temp.value.length; j++) {
  20356. ret += '"' + temp.value[j] + '"';
  20357. if (j + 1 < temp.value.length) {
  20358. ret += ',';
  20359. }
  20360. }
  20361. ret += '}';
  20362. break;
  20363. case _types__WEBPACK_IMPORTED_MODULE_1__["Types"].BOOLEAN:
  20364. ret += '= {';
  20365. for (var j = 0; j < temp.value.length; j++) {
  20366. if (temp.value[j]) {
  20367. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI("true");
  20368. } else {
  20369. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI("false");
  20370. }
  20371. if (j + 1 < temp.value.length) {
  20372. ret += ',';
  20373. }
  20374. }
  20375. ret += '}';
  20376. break;
  20377. }
  20378. } else if (temp.dimensions == 2) {
  20379. ret += '[' + temp.rows + '][' + temp.columns + '] ';
  20380. switch (temp.type) {
  20381. case _types__WEBPACK_IMPORTED_MODULE_1__["Types"].INTEGER:
  20382. ret += '= {';
  20383. for (var j = 0; j < temp.rows; j++) {
  20384. ret += '{' + temp.value[j] + '}';
  20385. if (j + 1 < temp.rows) {
  20386. ret += ',';
  20387. }
  20388. }
  20389. ret += '}';
  20390. break;
  20391. case _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL:
  20392. ret += '= {';
  20393. for (var j = 0; j < temp.rows; j++) {
  20394. ret += '{' + temp.value[j].toFixed(2) + '}';
  20395. if (j + 1 < temp.rows) {
  20396. ret += ',';
  20397. }
  20398. }
  20399. ret += '}';
  20400. break;
  20401. case _types__WEBPACK_IMPORTED_MODULE_1__["Types"].TEXT:
  20402. ret += '= {';
  20403. for (var j = 0; j < temp.rows; j++) {
  20404. ret += '{';
  20405. for (var k = 0; k < temp.columns; k++) {
  20406. ret += '"' + temp.value[j][k] + '"';
  20407. if (k + 1 < temp.columns) {
  20408. ret += ',';
  20409. }
  20410. }
  20411. ret += '}';
  20412. if (j + 1 < temp.rows) {
  20413. ret += ',';
  20414. }
  20415. }
  20416. ret += '}';
  20417. break;
  20418. case _types__WEBPACK_IMPORTED_MODULE_1__["Types"].BOOLEAN:
  20419. ret += '= {';
  20420. for (var j = 0; j < temp.rows; j++) {
  20421. ret += '{';
  20422. for (var k = 0; k < temp.columns; k++) {
  20423. if (temp.value[j][k]) {
  20424. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI("true");
  20425. } else {
  20426. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI("false");
  20427. }
  20428. if (k + 1 < temp.columns) {
  20429. ret += ',';
  20430. }
  20431. }
  20432. ret += '}';
  20433. if (j + 1 < temp.rows) {
  20434. ret += ',';
  20435. }
  20436. }
  20437. ret += '}';
  20438. break;
  20439. }
  20440. } else {
  20441. switch (temp.type) {
  20442. case _types__WEBPACK_IMPORTED_MODULE_1__["Types"].INTEGER:
  20443. ret += '= ' + temp.value;
  20444. break;
  20445. case _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL:
  20446. ret += '= ' + temp.value.toFixed(2);
  20447. break;
  20448. case _types__WEBPACK_IMPORTED_MODULE_1__["Types"].TEXT:
  20449. ret += '= "' + temp.value + '"';
  20450. break;
  20451. case _types__WEBPACK_IMPORTED_MODULE_1__["Types"].BOOLEAN:
  20452. ret += '= ';
  20453. if (temp.value) {
  20454. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI("true");
  20455. } else {
  20456. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI("false");
  20457. }
  20458. break;
  20459. }
  20460. }
  20461. return ret;
  20462. }
  20463. function globalsCode() {
  20464. var ret = '';
  20465. if (window.program_obj.globals) {
  20466. for (var i = 0; i < window.program_obj.globals.length; i++) {
  20467. var temp = window.program_obj.globals[i];
  20468. ret += '\n\t';
  20469. if (temp.is_constant) {
  20470. ret += 'const ';
  20471. }
  20472. switch (temp.type) {
  20473. case _types__WEBPACK_IMPORTED_MODULE_1__["Types"].INTEGER:
  20474. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('integer');
  20475. break;
  20476. case _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL:
  20477. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('real');
  20478. break;
  20479. case _types__WEBPACK_IMPORTED_MODULE_1__["Types"].TEXT:
  20480. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text');
  20481. break;
  20482. case _types__WEBPACK_IMPORTED_MODULE_1__["Types"].BOOLEAN:
  20483. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('boolean');
  20484. break;
  20485. }
  20486. ret += ' ' + temp.name + ' ';
  20487. if (temp.dimensions == 1) {
  20488. ret += '[' + temp.columns + '] ';
  20489. switch (temp.type) {
  20490. case _types__WEBPACK_IMPORTED_MODULE_1__["Types"].INTEGER:
  20491. ret += '= {' + temp.value + '}';
  20492. break;
  20493. case _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL:
  20494. ret += '= {';
  20495. for (var j = 0; j < temp.value.length; j++) {
  20496. ret += temp.value[j].toFixed(2);
  20497. if (j + 1 < temp.value.length) {
  20498. ret += ',';
  20499. }
  20500. }
  20501. ret += '}';
  20502. break;
  20503. case _types__WEBPACK_IMPORTED_MODULE_1__["Types"].TEXT:
  20504. ret += '= {';
  20505. for (var j = 0; j < temp.value.length; j++) {
  20506. ret += '"' + temp.value[j] + '"';
  20507. if (j + 1 < temp.value.length) {
  20508. ret += ',';
  20509. }
  20510. }
  20511. ret += '}';
  20512. break;
  20513. case _types__WEBPACK_IMPORTED_MODULE_1__["Types"].BOOLEAN:
  20514. ret += '= {';
  20515. for (var j = 0; j < temp.value.length; j++) {
  20516. if (temp.value[j]) {
  20517. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI("true");
  20518. } else {
  20519. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI("false");
  20520. }
  20521. if (j + 1 < temp.value.length) {
  20522. ret += ',';
  20523. }
  20524. }
  20525. ret += '}';
  20526. break;
  20527. }
  20528. } else if (temp.dimensions == 2) {
  20529. ret += '[' + temp.rows + '][' + temp.columns + '] ';
  20530. switch (temp.type) {
  20531. case _types__WEBPACK_IMPORTED_MODULE_1__["Types"].INTEGER:
  20532. ret += '= {';
  20533. for (var j = 0; j < temp.rows; j++) {
  20534. ret += '{' + temp.value[j] + '}';
  20535. if (j + 1 < temp.rows) {
  20536. ret += ',';
  20537. }
  20538. }
  20539. ret += '}';
  20540. break;
  20541. case _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL:
  20542. ret += '= {';
  20543. for (var j = 0; j < temp.rows; j++) {
  20544. ret += '{';
  20545. for (var k = 0; k < temp.columns; k++) {
  20546. ret += temp.value[j][k].toFixed(2);
  20547. if (k + 1 < temp.columns) {
  20548. ret += ',';
  20549. }
  20550. }
  20551. ret += '}';
  20552. if (j + 1 < temp.rows) {
  20553. ret += ',';
  20554. }
  20555. }
  20556. ret += '}';
  20557. break;
  20558. case _types__WEBPACK_IMPORTED_MODULE_1__["Types"].TEXT:
  20559. ret += '= {';
  20560. for (var j = 0; j < temp.rows; j++) {
  20561. ret += '{';
  20562. for (var k = 0; k < temp.columns; k++) {
  20563. ret += '"' + temp.value[j][k] + '"';
  20564. if (k + 1 < temp.columns) {
  20565. ret += ',';
  20566. }
  20567. }
  20568. ret += '}';
  20569. if (j + 1 < temp.rows) {
  20570. ret += ',';
  20571. }
  20572. }
  20573. ret += '}';
  20574. break;
  20575. case _types__WEBPACK_IMPORTED_MODULE_1__["Types"].BOOLEAN:
  20576. ret += '= {';
  20577. for (var j = 0; j < temp.rows; j++) {
  20578. ret += '{';
  20579. for (var k = 0; k < temp.columns; k++) {
  20580. if (temp.value[j][k]) {
  20581. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI("true");
  20582. } else {
  20583. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI("false");
  20584. }
  20585. if (k + 1 < temp.columns) {
  20586. ret += ',';
  20587. }
  20588. }
  20589. ret += '}';
  20590. if (j + 1 < temp.rows) {
  20591. ret += ',';
  20592. }
  20593. }
  20594. ret += '}';
  20595. break;
  20596. }
  20597. } else {
  20598. switch (temp.type) {
  20599. case _types__WEBPACK_IMPORTED_MODULE_1__["Types"].INTEGER:
  20600. ret += '= ' + temp.value;
  20601. break;
  20602. case _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL:
  20603. ret += '= ' + temp.value.toFixed(2);
  20604. break;
  20605. case _types__WEBPACK_IMPORTED_MODULE_1__["Types"].TEXT:
  20606. ret += '= "' + temp.value + '"';
  20607. break;
  20608. case _types__WEBPACK_IMPORTED_MODULE_1__["Types"].BOOLEAN:
  20609. ret += '= ';
  20610. if (temp.value) {
  20611. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI("true");
  20612. ;
  20613. } else {
  20614. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI("false");
  20615. ;
  20616. }
  20617. break;
  20618. }
  20619. }
  20620. }
  20621. }
  20622. return ret;
  20623. }
  20624. /***/ }),
  20625. /***/ "./js/visualUI/commands.js":
  20626. /*!*********************************!*\
  20627. !*** ./js/visualUI/commands.js ***!
  20628. \*********************************/
  20629. /*! exports provided: removeCommand, createFloatingCommand, renderCommand, genericCreateCommand */
  20630. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  20631. "use strict";
  20632. __webpack_require__.r(__webpack_exports__);
  20633. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "removeCommand", function() { return removeCommand; });
  20634. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createFloatingCommand", function() { return createFloatingCommand; });
  20635. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "renderCommand", function() { return renderCommand; });
  20636. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "genericCreateCommand", function() { return genericCreateCommand; });
  20637. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  20638. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_0__);
  20639. /* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./types */ "./js/visualUI/types.js");
  20640. /* harmony import */ var _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  20641. /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  20642. /* harmony import */ var _globals__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./globals */ "./js/visualUI/globals.js");
  20643. /* harmony import */ var _variables__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./variables */ "./js/visualUI/variables.js");
  20644. /* harmony import */ var _commands_comment__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./commands/comment */ "./js/visualUI/commands/comment.js");
  20645. /* harmony import */ var _commands_reader__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./commands/reader */ "./js/visualUI/commands/reader.js");
  20646. /* harmony import */ var _commands_writer__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./commands/writer */ "./js/visualUI/commands/writer.js");
  20647. /* harmony import */ var _commands_attribution__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./commands/attribution */ "./js/visualUI/commands/attribution.js");
  20648. /* harmony import */ var _commands_iftrue__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./commands/iftrue */ "./js/visualUI/commands/iftrue.js");
  20649. /* harmony import */ var _commands_repeatNtimes__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./commands/repeatNtimes */ "./js/visualUI/commands/repeatNtimes.js");
  20650. /* harmony import */ var _commands_whiletrue__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./commands/whiletrue */ "./js/visualUI/commands/whiletrue.js");
  20651. /* harmony import */ var _commands_dowhiletrue__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./commands/dowhiletrue */ "./js/visualUI/commands/dowhiletrue.js");
  20652. /* harmony import */ var _commands_switch__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./commands/switch */ "./js/visualUI/commands/switch.js");
  20653. /* harmony import */ var _commands_functioncall__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./commands/functioncall */ "./js/visualUI/commands/functioncall.js");
  20654. /* harmony import */ var _commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./commands/variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  20655. /* harmony import */ var _commands_break__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ./commands/break */ "./js/visualUI/commands/break.js");
  20656. /* harmony import */ var _commands_return__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ./commands/return */ "./js/visualUI/commands/return.js");
  20657. var has_element_created_draged = false;
  20658. var which_element_is_draged = null;
  20659. function removeCommand(command, function_obj, dom_obj) {
  20660. if (function_obj.commands.indexOf(command) > -1) {
  20661. function_obj.commands.splice(function_obj.commands.indexOf(command), 1);
  20662. return true;
  20663. } // Utilize dois parantNode, pois o primeiro é o div de comandos
  20664. try {
  20665. if (dom_obj.parent().parent().data('command').commands_block.indexOf(command) > -1) {
  20666. dom_obj.parent().parent().data('command').commands_block.splice(dom_obj.parent().parent().data('command').commands_block.indexOf(command), 1);
  20667. return true;
  20668. }
  20669. } catch (err) {}
  20670. try {
  20671. if (dom_obj.parent().parent().data('command').type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].iftrue) {
  20672. if (dom_obj.parent().parent().data('command').commands_else.indexOf(command) > -1) {
  20673. dom_obj.parent().parent().data('command').commands_else.splice(dom_obj.parent().parent().data('command').commands_else.indexOf(command), 1);
  20674. return true;
  20675. }
  20676. }
  20677. } catch (err) {}
  20678. if (dom_obj.parent().data('switchcase')) {
  20679. console.log("o que encontrei: ");
  20680. console.log(dom_obj.parent().data('switchcase'));
  20681. dom_obj.parent().data('switchcase').commands_block.splice(dom_obj.parent().data('switchcase').commands_block.indexOf(command), 1);
  20682. return true;
  20683. }
  20684. return false;
  20685. }
  20686. window.function_container_active = null;
  20687. function createFloatingCommand(function_obj, function_container, command_type, mouse_event) {
  20688. var floatingObject;
  20689. switch (command_type) {
  20690. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].break:
  20691. floatingObject = _commands_break__WEBPACK_IMPORTED_MODULE_17__["createFloatingCommand"]();
  20692. break;
  20693. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].comment:
  20694. floatingObject = _commands_comment__WEBPACK_IMPORTED_MODULE_6__["createFloatingCommand"]();
  20695. break;
  20696. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].reader:
  20697. floatingObject = _commands_reader__WEBPACK_IMPORTED_MODULE_7__["createFloatingCommand"]();
  20698. break;
  20699. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].writer:
  20700. floatingObject = _commands_writer__WEBPACK_IMPORTED_MODULE_8__["createFloatingCommand"]();
  20701. break;
  20702. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].attribution:
  20703. floatingObject = _commands_attribution__WEBPACK_IMPORTED_MODULE_9__["createFloatingCommand"]();
  20704. break;
  20705. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].iftrue:
  20706. floatingObject = _commands_iftrue__WEBPACK_IMPORTED_MODULE_10__["createFloatingCommand"]();
  20707. break;
  20708. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].repeatNtimes:
  20709. floatingObject = _commands_repeatNtimes__WEBPACK_IMPORTED_MODULE_11__["createFloatingCommand"]();
  20710. break;
  20711. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].whiletrue:
  20712. floatingObject = _commands_whiletrue__WEBPACK_IMPORTED_MODULE_12__["createFloatingCommand"]();
  20713. break;
  20714. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].dowhiletrue:
  20715. floatingObject = _commands_dowhiletrue__WEBPACK_IMPORTED_MODULE_13__["createFloatingCommand"]();
  20716. break;
  20717. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].switch:
  20718. floatingObject = _commands_switch__WEBPACK_IMPORTED_MODULE_14__["createFloatingCommand"]();
  20719. break;
  20720. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].functioncall:
  20721. floatingObject = _commands_functioncall__WEBPACK_IMPORTED_MODULE_15__["createFloatingCommand"]();
  20722. break;
  20723. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].return:
  20724. floatingObject = _commands_return__WEBPACK_IMPORTED_MODULE_18__["createFloatingCommand"]();
  20725. break;
  20726. }
  20727. floatingObject.draggable().appendTo("body");
  20728. jquery__WEBPACK_IMPORTED_MODULE_0___default()('body').mouseup(function (evt) {
  20729. manageCommand(function_obj, function_container, evt, command_type);
  20730. jquery__WEBPACK_IMPORTED_MODULE_0___default()('body').off('mouseup');
  20731. jquery__WEBPACK_IMPORTED_MODULE_0___default()('body').off('mouseover');
  20732. });
  20733. if (!function_container.hasClass('function_div') || function_container.length < 1) {
  20734. window.mouse_event = mouse_event;
  20735. function_container = jquery__WEBPACK_IMPORTED_MODULE_0___default()(mouse_event.originalEvent.srcElement.closest('.function_div'));
  20736. }
  20737. console.log('function_container', function_container);
  20738. function_container_active = function_container;
  20739. function_container.find('.commands_list_div').on('mousemove', function (evt) {
  20740. addGhostDiv(evt);
  20741. });
  20742. function_container.find('.commands_list_div').find("*").on('mousemove', function (evt) {
  20743. addGhostDiv(evt);
  20744. });
  20745. function_container.on('mouseout', function (event) {
  20746. var el = jquery__WEBPACK_IMPORTED_MODULE_0___default()(document.elementFromPoint(event.clientX, event.clientY));
  20747. if (el.closest('.commands_list_div').length < 1) {
  20748. window.ghostDiv.remove();
  20749. }
  20750. });
  20751. floatingObject.css("position", "absolute");
  20752. mouse_event.type = "mousedown.draggable";
  20753. mouse_event.target = floatingObject[0];
  20754. floatingObject.css("left", mouse_event.pageX - window.divx);
  20755. floatingObject.css("top", mouse_event.pageY);
  20756. floatingObject.trigger(mouse_event);
  20757. }
  20758. window.divx = 100;
  20759. window.ghostDiv = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="ghost_div">');
  20760. window.active_container = null;
  20761. function addGhostToEmptyBlock(element, evt) {
  20762. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.ghost_div').remove();
  20763. var container = element.closest('.command_container');
  20764. if (container.hasClass('switch')) {
  20765. container = jquery__WEBPACK_IMPORTED_MODULE_0___default()(evt.target).closest('.case_div');
  20766. }
  20767. if (!container.hasClass('dowhiletrue') && !container.hasClass('iftrue') && !container.hasClass('repeatNtimes') && !container.hasClass('case_div') && !container.hasClass('whiletrue')) {
  20768. addGhostToNotEmptyBlock(element, evt);
  20769. return;
  20770. }
  20771. if (window.active_container != null) {
  20772. if (window.active_container.is(container)) {
  20773. console.log('é o mesmo, não mudou!');
  20774. } else {
  20775. if (container.length < 1) {
  20776. container = element.closest('.commands_list_div');
  20777. if (window.active_container.is(container)) {
  20778. console.log('é o mesmo command list');
  20779. } else {
  20780. console.log('mudou para um command list');
  20781. window.active_container = container;
  20782. }
  20783. } else {
  20784. console.log('mudou para um outro container?');
  20785. }
  20786. }
  20787. }
  20788. window.active_container = container;
  20789. if (container.hasClass('iftrue')) {
  20790. var containerIf = container.find('.commands_if').get(0);
  20791. var containerElse = container.find('.commands_else').get(0);
  20792. var topIfDistance = Math.abs(evt.clientY - containerIf.getBoundingClientRect().top);
  20793. var bottomIfDistance = Math.abs(containerIf.getBoundingClientRect().top + containerIf.getBoundingClientRect().height - evt.clientY);
  20794. var topElseDistance = Math.abs(evt.clientY - containerElse.getBoundingClientRect().top);
  20795. var bottomElseDistance = Math.abs(containerElse.getBoundingClientRect().top + containerElse.getBoundingClientRect().height - evt.clientY);
  20796. if (topIfDistance < topElseDistance && topIfDistance < bottomElseDistance) {
  20797. jquery__WEBPACK_IMPORTED_MODULE_0___default()(containerIf).append(window.ghostDiv);
  20798. } else {
  20799. jquery__WEBPACK_IMPORTED_MODULE_0___default()(containerElse).append(window.ghostDiv);
  20800. }
  20801. } else if (container.hasClass('case_div')) {
  20802. container.find('.case_commands_block').append(window.ghostDiv);
  20803. } else {
  20804. container.find('.block_commands').append(window.ghostDiv);
  20805. }
  20806. }
  20807. function addGhostToNotEmptyBlock(element, evt) {
  20808. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.ghost_div').remove();
  20809. var container = element.closest('.dowhiletrue, .iftrue, .repeatNtimes, .case_div, .whiletrue'); //console.log("\n\nNOT EMPTY: ", container);
  20810. //if (window.active_container != null) {
  20811. //}
  20812. if (container.length < 1) {
  20813. container = element.closest('.commands_list_div');
  20814. window.active_container = container;
  20815. addGhostToFunctionArea(element, evt);
  20816. } else {//console.log('mudou para um outro container?');
  20817. }
  20818. window.active_container = container; // quem está mais próximo? // Essa regra se aplica somente quando o over está sobre um comando
  20819. var allfilhos;
  20820. console.log('olha o container: ', container);
  20821. if (container.hasClass('iftrue')) {
  20822. if (jquery__WEBPACK_IMPORTED_MODULE_0___default()(evt.target).closest('.data_block_if').length > 0) {
  20823. allfilhos = container.find('.commands_if').children('.command_container');
  20824. } else if (jquery__WEBPACK_IMPORTED_MODULE_0___default()(evt.target).closest('.data_block_else').length > 0) {
  20825. allfilhos = container.find('.commands_else').children('.command_container');
  20826. } else {
  20827. var containerIf = container.find('.commands_if').get(0);
  20828. var containerElse = container.find('.commands_else').get(0);
  20829. var topIfDistance = Math.abs(evt.clientY - containerIf.getBoundingClientRect().top);
  20830. var bottomIfDistance = Math.abs(containerIf.getBoundingClientRect().top + containerIf.getBoundingClientRect().height - evt.clientY);
  20831. var topElseDistance = Math.abs(evt.clientY - containerElse.getBoundingClientRect().top);
  20832. var bottomElseDistance = Math.abs(containerElse.getBoundingClientRect().top + containerElse.getBoundingClientRect().height - evt.clientY);
  20833. if (topIfDistance < topElseDistance && topIfDistance < bottomElseDistance) {
  20834. allfilhos = jquery__WEBPACK_IMPORTED_MODULE_0___default()(containerIf).children('.command_container');
  20835. } else {
  20836. allfilhos = jquery__WEBPACK_IMPORTED_MODULE_0___default()(containerElse).children('.command_container');
  20837. }
  20838. }
  20839. } else if (container.hasClass('case_div')) {
  20840. allfilhos = container.children('.case_commands_block').children('.command_container');
  20841. } else if (container.hasClass('commands_list_div')) {
  20842. allfilhos = container.children('.command_container');
  20843. } else {
  20844. allfilhos = container.children('.block_commands').children('.command_container');
  20845. }
  20846. var topDistances = [];
  20847. var bottomDistances = [];
  20848. for (var i = 0; i < allfilhos.length; i++) {
  20849. var topD = Math.abs(evt.clientY - allfilhos.get(i).getBoundingClientRect().top);
  20850. topDistances.push(topD);
  20851. var botD = Math.abs(allfilhos.get(i).getBoundingClientRect().top + allfilhos.get(i).getBoundingClientRect().height - evt.clientY);
  20852. bottomDistances.push(botD);
  20853. }
  20854. console.log('topDistances\n', topDistances, '\nbottomDistances\n', bottomDistances);
  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. console.log('distancias: menorTop ', menorTop, ' menorBot ', menorBot);
  20865. }
  20866. function addGhostToFunctionArea(undermouse, evt) {
  20867. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.ghost_div').remove();
  20868. var allfilhos = undermouse.closest('.commands_list_div').children('.command_container');
  20869. var topDistances = [];
  20870. var bottomDistances = [];
  20871. for (var i = 0; i < allfilhos.length; i++) {
  20872. var topD = Math.abs(evt.clientY - allfilhos.get(i).getBoundingClientRect().top);
  20873. topDistances.push(topD);
  20874. var botD = Math.abs(allfilhos.get(i).getBoundingClientRect().top + allfilhos.get(i).getBoundingClientRect().height - evt.clientY);
  20875. bottomDistances.push(botD);
  20876. }
  20877. var menorTop = Math.min.apply(null, topDistances);
  20878. var indiceTop = topDistances.indexOf(menorTop);
  20879. var menorBot = Math.min.apply(null, bottomDistances);
  20880. var indiceBot = bottomDistances.indexOf(menorBot);
  20881. if (menorTop < menorBot) {
  20882. window.ghostDiv.insertBefore(jquery__WEBPACK_IMPORTED_MODULE_0___default()(allfilhos.get(indiceTop)));
  20883. } else {
  20884. window.ghostDiv.insertAfter(jquery__WEBPACK_IMPORTED_MODULE_0___default()(allfilhos.get(indiceBot)));
  20885. }
  20886. }
  20887. function addGhostDiv(evt) {
  20888. console.log('a');
  20889. var undermouse = jquery__WEBPACK_IMPORTED_MODULE_0___default()(evt.target);
  20890. console.log('undermouse', undermouse);
  20891. if (undermouse.hasClass('ghost_div')) {
  20892. return;
  20893. } else if (undermouse.hasClass('commands_list_div')) {
  20894. addGhostToFunctionArea(undermouse, evt);
  20895. return;
  20896. } else if (undermouse.hasClass('block_commands')) {
  20897. if (undermouse.find('.command_container').length > 0) {
  20898. addGhostToNotEmptyBlock(undermouse, evt);
  20899. } else {
  20900. addGhostToEmptyBlock(undermouse, evt);
  20901. }
  20902. } else if (undermouse.hasClass('case_div')) {
  20903. if (undermouse.find('.case_commands_block').find('.command_container').length > 0) {
  20904. addGhostToNotEmptyBlock(undermouse, evt);
  20905. } else {
  20906. addGhostToEmptyBlock(undermouse, evt);
  20907. }
  20908. } else {
  20909. addGhostToNotEmptyBlock(undermouse, evt);
  20910. }
  20911. }
  20912. function borderMouseDragCommand(function_obj, function_container, evt) {
  20913. function_container.find('.over_command_drag').each(function (index) {
  20914. jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).removeClass('over_command_drag');
  20915. });
  20916. var prev = null;
  20917. function_container.find('.commands_list_div').each(function (index) {
  20918. prev = jquery__WEBPACK_IMPORTED_MODULE_0___default()(this);
  20919. if (prev) {
  20920. var objLeft = prev.offset().left;
  20921. var objTop = prev.offset().top;
  20922. var objRight = objLeft + prev.width();
  20923. var objBottom = objTop + prev.height();
  20924. if (evt.pageX > objLeft && evt.pageX < objRight && evt.pageY > objTop && evt.pageY < objBottom) {
  20925. prev.addClass("over_command_drag");
  20926. }
  20927. }
  20928. });
  20929. function_container.find('.command_container').each(function (index) {
  20930. var obj = jquery__WEBPACK_IMPORTED_MODULE_0___default()(this);
  20931. var objLeft = obj.offset().left;
  20932. var objTop = obj.offset().top;
  20933. var objRight = objLeft + obj.width();
  20934. var objBottom = objTop + obj.height();
  20935. if (evt.pageX > objLeft && evt.pageX < objRight && evt.pageY > objTop && evt.pageY < objBottom) {
  20936. if (prev) {
  20937. prev.removeClass('over_command_drag');
  20938. }
  20939. obj.addClass("over_command_drag");
  20940. return;
  20941. }
  20942. });
  20943. } // before_after_inside: 1 -> before, 2 -> after, 3 -> inside
  20944. function renderCommand(command, element_reference, before_after_inside, function_obj) {
  20945. var createdElement;
  20946. switch (command.type) {
  20947. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].comment:
  20948. createdElement = _commands_comment__WEBPACK_IMPORTED_MODULE_6__["renderCommand"](command, function_obj);
  20949. break;
  20950. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].break:
  20951. createdElement = _commands_break__WEBPACK_IMPORTED_MODULE_17__["renderCommand"](command, function_obj);
  20952. break;
  20953. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].reader:
  20954. createdElement = _commands_reader__WEBPACK_IMPORTED_MODULE_7__["renderCommand"](command, function_obj);
  20955. break;
  20956. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].writer:
  20957. createdElement = _commands_writer__WEBPACK_IMPORTED_MODULE_8__["renderCommand"](command, function_obj);
  20958. break;
  20959. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].attribution:
  20960. createdElement = _commands_attribution__WEBPACK_IMPORTED_MODULE_9__["renderCommand"](command, function_obj);
  20961. break;
  20962. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].functioncall:
  20963. createdElement = _commands_functioncall__WEBPACK_IMPORTED_MODULE_15__["renderCommand"](command, function_obj);
  20964. break;
  20965. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].iftrue:
  20966. createdElement = _commands_iftrue__WEBPACK_IMPORTED_MODULE_10__["renderCommand"](command, function_obj);
  20967. break;
  20968. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].repeatNtimes:
  20969. createdElement = _commands_repeatNtimes__WEBPACK_IMPORTED_MODULE_11__["renderCommand"](command, function_obj);
  20970. break;
  20971. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].whiletrue:
  20972. createdElement = _commands_whiletrue__WEBPACK_IMPORTED_MODULE_12__["renderCommand"](command, function_obj);
  20973. break;
  20974. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].dowhiletrue:
  20975. createdElement = _commands_dowhiletrue__WEBPACK_IMPORTED_MODULE_13__["renderCommand"](command, function_obj);
  20976. break;
  20977. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].switch:
  20978. createdElement = _commands_switch__WEBPACK_IMPORTED_MODULE_14__["renderCommand"](command, function_obj);
  20979. break;
  20980. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].return:
  20981. createdElement = _commands_return__WEBPACK_IMPORTED_MODULE_18__["renderCommand"](command, function_obj);
  20982. break;
  20983. }
  20984. switch (before_after_inside) {
  20985. case 1:
  20986. createdElement.insertBefore(element_reference);
  20987. break;
  20988. case 2:
  20989. createdElement.insertAfter(element_reference);
  20990. break;
  20991. case 3:
  20992. element_reference.append(createdElement);
  20993. break;
  20994. }
  20995. }
  20996. function genericCreateCommand(command_type) {
  20997. switch (command_type) {
  20998. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].break:
  20999. return new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["Break"]();
  21000. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].comment:
  21001. 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));
  21002. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].reader:
  21003. 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));
  21004. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].writer:
  21005. 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)]);
  21006. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].attribution:
  21007. 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), []);
  21008. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].functioncall:
  21009. 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);
  21010. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].iftrue:
  21011. return new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["IfTrue"](new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ConditionalExpression"](null), null, null);
  21012. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].repeatNtimes:
  21013. 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);
  21014. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].whiletrue:
  21015. return new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["WhileTrue"](new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ConditionalExpression"](null), null);
  21016. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].dowhiletrue:
  21017. return new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["DoWhileTrue"](new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ConditionalExpression"](null), null);
  21018. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].switch:
  21019. 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))];
  21020. 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);
  21021. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].return:
  21022. 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));
  21023. }
  21024. }
  21025. function dragTrash(event) {
  21026. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.ghost_div').remove();
  21027. var trash = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<i class="ui icon trash alternate outline"></i>');
  21028. jquery__WEBPACK_IMPORTED_MODULE_0___default()('body').append(trash);
  21029. trash.css('position', 'absolute');
  21030. trash.css('top', event.clientY);
  21031. trash.css('left', event.clientX - 20);
  21032. trash.css('font-size', '3em');
  21033. trash.css('display', 'none');
  21034. function_container_active.find('.commands_list_div').off('mousemove');
  21035. function_container_active.find('.commands_list_div').find("*").off('mousemove');
  21036. trash.fadeIn(200, function () {
  21037. trash.fadeOut(200, function () {
  21038. trash.remove();
  21039. });
  21040. });
  21041. }
  21042. function manageCommand(function_obj, function_container, event, command_type) {
  21043. jquery__WEBPACK_IMPORTED_MODULE_0___default()(".created_element").each(function (index) {
  21044. jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).remove();
  21045. });
  21046. var el = jquery__WEBPACK_IMPORTED_MODULE_0___default()(document.elementFromPoint(event.clientX, event.clientY));
  21047. if (el.hasClass('ghost_div')) {
  21048. if (el.closest('.command_container').length < 1) {
  21049. console.log('\n\nvou tentar!!!!');
  21050. console.log(el.closest('.commands_list_div'), '\n\n');
  21051. el.closest('.commands_list_div').css('height', el.closest('.commands_list_div').css('height') + 30); //$('.ghost_div').remove();
  21052. el = el.closest('.commands_list_div');
  21053. }
  21054. }
  21055. console.log('soltou no: ');
  21056. console.log(el);
  21057. console.log(el.data('fun')); // Primeiro verificar se ele soltou no espaço da função correta:
  21058. var hier = el.parentsUntil(".all_functions");
  21059. var esta_correto = false;
  21060. var esta_na_div_correta = false;
  21061. if (el.hasClass("commands_list_div")) {
  21062. esta_na_div_correta = true;
  21063. }
  21064. for (var i = 0; i < hier.length; i++) {
  21065. var temp = jquery__WEBPACK_IMPORTED_MODULE_0___default()(hier[i]);
  21066. if (temp.hasClass("commands_list_div")) {
  21067. esta_na_div_correta = true;
  21068. }
  21069. if (temp.data('fun') == function_obj) {
  21070. esta_correto = true;
  21071. break;
  21072. }
  21073. }
  21074. if (!esta_correto) {
  21075. has_element_created_draged = false;
  21076. which_element_is_draged = null;
  21077. dragTrash(event);
  21078. return;
  21079. } else {
  21080. if (!esta_na_div_correta) {
  21081. has_element_created_draged = false;
  21082. which_element_is_draged = null;
  21083. dragTrash(event);
  21084. return;
  21085. }
  21086. } // Agora é descobrir qual o escopo para adicionar o comando:
  21087. // Se o elemento clicado possuir o atributo "fun", então, é direto na div dos comandos:
  21088. if (typeof el.data('fun') !== 'undefined') {
  21089. // Se a lista de comandos estiver vazia, então é o primeiro.
  21090. // Portanto, ele deve soltar o elemento obrigatoriamente no objeto vazio
  21091. if (el.data('fun').commands == null || el.data('fun').commands.length == 0) {
  21092. // pode adicionar
  21093. el.data('fun').commands = [];
  21094. var new_cmd = genericCreateCommand(command_type);
  21095. el.data('fun').commands.push(new_cmd);
  21096. renderCommand(new_cmd, jquery__WEBPACK_IMPORTED_MODULE_0___default()(function_container).find('.commands_list_div'), 3, function_obj);
  21097. } else {
  21098. // Entra nesse else, caso já existam outros comandos no bloco:
  21099. findNearbyCommandToAddInFunctionScope(el, event, jquery__WEBPACK_IMPORTED_MODULE_0___default()(function_container).find('.commands_list_div'), function_obj, command_type);
  21100. }
  21101. } else {
  21102. console.log("soltou em um comando"); // descobrir em qual comando ele soltou:
  21103. var hier_find = el.parentsUntil(".commands_list_div");
  21104. var hierarquia_bottom_up = [];
  21105. if (typeof el.data('command') !== 'undefined') {
  21106. hierarquia_bottom_up.push(el.data('command'));
  21107. }
  21108. for (var i = 0; i < hier_find.length; i++) {
  21109. if (typeof jquery__WEBPACK_IMPORTED_MODULE_0___default()(hier_find[i]).data('command') !== 'undefined') {
  21110. hierarquia_bottom_up.push(jquery__WEBPACK_IMPORTED_MODULE_0___default()(hier_find[i]).data('command'));
  21111. }
  21112. }
  21113. console.log("comando em que soltou: ");
  21114. console.log(hierarquia_bottom_up[0]);
  21115. console.log("hierarquia de baixo para cima na árvore, de onde ele soltou: ");
  21116. for (var i = 0; i < hierarquia_bottom_up.length; i++) {
  21117. console.log(hierarquia_bottom_up[i]);
  21118. } // Se for do tipo break, verificar se está no contexto correto:
  21119. // Caso não esteja no contexto, apenas retorna sem dar continuidade:
  21120. var is_correct_context = false;
  21121. if (command_type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].break) {
  21122. for (var i = 0; i < hierarquia_bottom_up.length; i++) {
  21123. 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) {
  21124. is_correct_context = true;
  21125. break;
  21126. }
  21127. }
  21128. if (!is_correct_context) {
  21129. console.error("Context not allowed to insert BREAK COMMAND!");
  21130. return;
  21131. }
  21132. } // se a hierarquia possuir apenas um elemento, então está na raiz dos comandos:
  21133. if (hierarquia_bottom_up.length == 1) {
  21134. console.log('QQ1');
  21135. var sub_elemento = false;
  21136. for (var i = 0; i < hier_find.length; i++) {
  21137. if (typeof jquery__WEBPACK_IMPORTED_MODULE_0___default()(hier_find[i]).data('command') !== 'undefined') {
  21138. console.log('QQ2');
  21139. findBeforeOrAfterCommandToAdd(hier_find[i], event, function_obj, command_type);
  21140. sub_elemento = true;
  21141. break;
  21142. }
  21143. }
  21144. if (!sub_elemento) {
  21145. console.log('QQ3');
  21146. findBeforeOrAfterCommandToAdd(el[0], event, function_obj, command_type);
  21147. }
  21148. } else {
  21149. console.log('QQ4'); // caso exista mais de um elemento na hierarquia:
  21150. if (typeof jquery__WEBPACK_IMPORTED_MODULE_0___default()(el).data('command') !== 'undefined') {
  21151. console.log('QQ5');
  21152. console.log("PPP1");
  21153. insertCommandInBlockHierar(el[0], event, function_obj, command_type, hier_find, hierarquia_bottom_up);
  21154. } else {
  21155. console.log('QQ6');
  21156. var sub_elemento = false;
  21157. for (var i = 0; i < hier_find.length; i++) {
  21158. if (typeof jquery__WEBPACK_IMPORTED_MODULE_0___default()(hier_find[i]).data('command') !== 'undefined') {
  21159. console.log('QQ7');
  21160. insertCommandInBlockHierar(hier_find[i], event, function_obj, command_type, hier_find, hierarquia_bottom_up);
  21161. sub_elemento = true;
  21162. break;
  21163. }
  21164. }
  21165. }
  21166. }
  21167. }
  21168. has_element_created_draged = false;
  21169. which_element_is_draged = null;
  21170. renderAlgorithm();
  21171. }
  21172. function insertCommandInBlockHierar(el, event, function_obj, command_type, hier_dom, hier_obj) {
  21173. var el_jq = jquery__WEBPACK_IMPORTED_MODULE_0___default()(el);
  21174. var command_parent = el_jq.data('command');
  21175. 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) {
  21176. console.log('QQ17');
  21177. 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) {
  21178. console.log('QQ18'); // Se não tiver outro comando ainda no bloco, só adiciona:
  21179. if (command_parent.commands_block == null || command_parent.commands_block.length == 0) {
  21180. command_parent.commands_block = [];
  21181. var recentComand = genericCreateCommand(command_type);
  21182. command_parent.commands_block.push(recentComand);
  21183. renderCommand(recentComand, el_jq.find('.block_commands'), 3, function_obj);
  21184. } else {
  21185. // Se já tem algum comando no bloco:
  21186. findNearbyCommandToAddInBlockScope(el, event, el, function_obj, command_type, command_parent);
  21187. }
  21188. } else {
  21189. // QUANDO FOR BLOCO DO TIPO IF OU SWITCH/CASE:
  21190. addCommandToSwitchCase(event, function_obj, command_type);
  21191. }
  21192. } else {
  21193. console.log('QQ19'); // entra neste bloco, se soltou o comando sobre outro comando dentro de um subbloco:
  21194. findBeforeOrAfterCommandToAddInsertBlock(el, event, function_obj, command_type);
  21195. }
  21196. }
  21197. function findNearbyCommandToAddInBlockScope(el, event, node_list_commands, function_obj, command_type, command_parent) {
  21198. var all_sub = jquery__WEBPACK_IMPORTED_MODULE_0___default()(node_list_commands).find('div.command_container');
  21199. var menor_distancia = 999999999;
  21200. var elemento_menor_distancia = null;
  21201. var antes = true;
  21202. var t_bot;
  21203. var t_top; // Descobrindo o elemento mais próximo:
  21204. for (var i = 0; i < all_sub.length; i++) {
  21205. t_top = all_sub[i].getBoundingClientRect().top;
  21206. t_bot = all_sub[i].getBoundingClientRect().top + all_sub[i].getBoundingClientRect().height;
  21207. if (t_top - event.clientY < menor_distancia) {
  21208. menor_distancia = event.clientY - t_top;
  21209. elemento_menor_distancia = all_sub[i];
  21210. }
  21211. }
  21212. 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:
  21213. if (borda_inferior - event.clientY < menor_distancia) {
  21214. var recentComand = genericCreateCommand(command_type);
  21215. command_parent.commands_block.push(recentComand); //
  21216. renderCommand(recentComand, node_list_commands, 3, function_obj);
  21217. } else {
  21218. var recentComand = genericCreateCommand(command_type);
  21219. var index = command_parent.commands_block.indexOf(jquery__WEBPACK_IMPORTED_MODULE_0___default()(elemento_menor_distancia).data('command'));
  21220. if (index > -1) {
  21221. command_parent.commands_block.splice(index, 0, recentComand);
  21222. }
  21223. renderCommand(recentComand, elemento_menor_distancia, 1, function_obj);
  21224. }
  21225. }
  21226. function findBeforeOrAfterCommandToAddInsertBlock(el, event, function_obj, command_type) {
  21227. var el_jq = jquery__WEBPACK_IMPORTED_MODULE_0___default()(el);
  21228. var command_parent = jquery__WEBPACK_IMPORTED_MODULE_0___default()(el.parentNode.parentNode).data('command');
  21229. var command_target = el_jq.data('command');
  21230. var temp_parent = jquery__WEBPACK_IMPORTED_MODULE_0___default()(el.parentNode.parentNode);
  21231. var is_in_else = false;
  21232. if (!command_parent) {
  21233. command_parent = el_jq.data('command');
  21234. temp_parent = el_jq;
  21235. var hier = el_jq.parentsUntil(".command_container");
  21236. for (var i = 0; i < hier.length; i++) {
  21237. var temp = jquery__WEBPACK_IMPORTED_MODULE_0___default()(hier[i]);
  21238. if (typeof temp.data('else') != 'undefined') {
  21239. is_in_else = true;
  21240. }
  21241. if (typeof temp.data('command') != 'undefined') {
  21242. command_parent = temp.data('command');
  21243. temp_parent = temp;
  21244. }
  21245. }
  21246. }
  21247. var hier = el_jq.parentsUntil(".command_container");
  21248. for (var i = 0; i < hier.length; i++) {
  21249. var temp = jquery__WEBPACK_IMPORTED_MODULE_0___default()(hier[i]);
  21250. if (typeof temp.data('else') != 'undefined') {
  21251. is_in_else = true;
  21252. }
  21253. }
  21254. if (command_parent == command_target) {
  21255. var hier = el_jq.parentsUntil(".command_container");
  21256. for (var i = 0; i < hier.length; i++) {
  21257. var temp = jquery__WEBPACK_IMPORTED_MODULE_0___default()(hier[i]);
  21258. if (typeof temp.data('else') !== 'undefined') {
  21259. is_in_else = true;
  21260. break;
  21261. }
  21262. }
  21263. }
  21264. 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) {
  21265. var hier = temp_parent.parentsUntil(".all_cases_div");
  21266. console.log("vou procurar!!");
  21267. for (var i = 0; i < hier.length; i++) {
  21268. console.log("estou vasculhando...");
  21269. var temp = jquery__WEBPACK_IMPORTED_MODULE_0___default()(hier[i]);
  21270. if (typeof temp.data('switchcase') !== 'undefined') {
  21271. console.log("encontrei");
  21272. command_parent = temp.data('switchcase');
  21273. is_in_else = false;
  21274. break;
  21275. }
  21276. }
  21277. }
  21278. console.log('debugging:');
  21279. console.log('el_jq');
  21280. console.log(el_jq);
  21281. console.log('command_parent');
  21282. console.log(command_parent);
  21283. console.log('command_target');
  21284. console.log(command_target);
  21285. var menor_distancia = 999999999;
  21286. var antes = true;
  21287. var t_bot;
  21288. var t_top;
  21289. t_top = el.getBoundingClientRect().top;
  21290. t_bot = el.getBoundingClientRect().top + el.getBoundingClientRect().height;
  21291. var d_top = event.clientY - t_top; // distancia topo
  21292. var d_bot = t_bot - event.clientY; // distancia baixo
  21293. // Está mais próximo da borda de baixo, ou seja.. inserir por último:
  21294. if (d_top < d_bot) {
  21295. var recentComand = genericCreateCommand(command_type);
  21296. console.log('MMM1');
  21297. if (is_in_else) {
  21298. console.log('MMM2');
  21299. if (command_parent == command_target) {
  21300. console.log('MMM3');
  21301. if (command_parent.commands_else == null || command_parent.commands_else.length == 0) {
  21302. command_parent.commands_else = [];
  21303. var recentComand = genericCreateCommand(command_type);
  21304. command_parent.commands_else.push(recentComand);
  21305. renderCommand(recentComand, el_jq, 3, function_obj);
  21306. } else {
  21307. // Se já tem algum comando no bloco:
  21308. findInBlockCorrectPlace(el_jq, event, function_obj, command_type, true);
  21309. }
  21310. return;
  21311. }
  21312. console.log('MMM7');
  21313. var index = command_parent.commands_else.indexOf(command_target);
  21314. if (index > -1) {
  21315. command_parent.commands_else.splice(index, 0, recentComand);
  21316. }
  21317. renderCommand(recentComand, el, 1, function_obj);
  21318. } else {
  21319. console.log('MMM4');
  21320. if (command_parent == command_target) {
  21321. console.log('Nxxxx5');
  21322. if (command_parent.commands_block == null || command_parent.commands_block.length == 0) {
  21323. command_parent.commands_block = [];
  21324. console.log('SSS4');
  21325. var recentComand = genericCreateCommand(command_type);
  21326. command_parent.commands_block.push(recentComand);
  21327. renderCommand(recentComand, el_jq, 3, function_obj);
  21328. } else {
  21329. console.log('SSS5');
  21330. findInBlockCorrectPlace(el_jq, event, function_obj, command_type);
  21331. }
  21332. return;
  21333. }
  21334. console.log('MMM6');
  21335. var index = command_parent.commands_block.indexOf(command_target);
  21336. if (index > -1) {
  21337. command_parent.commands_block.splice(index, 0, recentComand);
  21338. }
  21339. renderCommand(recentComand, el, 1, function_obj);
  21340. }
  21341. } else {
  21342. console.log('XXX1');
  21343. var recentComand = genericCreateCommand(command_type);
  21344. if (is_in_else) {
  21345. if (command_parent == command_target) {
  21346. console.log('MMM3');
  21347. if (command_parent.commands_else == null || command_parent.commands_else.length == 0) {
  21348. command_parent.commands_else = [];
  21349. console.log('SSS1');
  21350. var recentComand = genericCreateCommand(command_type);
  21351. command_parent.commands_else.push(recentComand);
  21352. renderCommand(recentComand, el_jq, 3, function_obj);
  21353. } else {
  21354. // Se já tem algum comando no bloco:
  21355. console.log('SSS2');
  21356. findInBlockCorrectPlace(el_jq, event, function_obj, command_type, true);
  21357. }
  21358. return;
  21359. }
  21360. console.log('XXX2');
  21361. var index = command_parent.commands_else.indexOf(command_target);
  21362. if (index > -1) {
  21363. command_parent.commands_else.splice(index + 1, 0, recentComand);
  21364. }
  21365. renderCommand(recentComand, el, 2, function_obj);
  21366. } else {
  21367. if (command_parent == command_target) {
  21368. console.log('Nxxxx78');
  21369. if (command_parent.commands_block == null || command_parent.commands_block.length == 0) {
  21370. command_parent.commands_block = [];
  21371. var recentComand = genericCreateCommand(command_type);
  21372. command_parent.commands_block.push(recentComand);
  21373. console.log('SSS6');
  21374. renderCommand(recentComand, el_jq, 3, function_obj);
  21375. } else {
  21376. console.log('SSS7');
  21377. findInBlockCorrectPlace(el_jq, event, function_obj, command_type);
  21378. }
  21379. return;
  21380. }
  21381. console.log('XXX3');
  21382. var index = command_parent.commands_block.indexOf(command_target);
  21383. if (index > -1) {
  21384. command_parent.commands_block.splice(index + 1, 0, recentComand);
  21385. }
  21386. renderCommand(recentComand, el, 2, function_obj);
  21387. }
  21388. }
  21389. }
  21390. function insertCommandInBlock(el, event, function_obj, command_type) {
  21391. var el_jq = jquery__WEBPACK_IMPORTED_MODULE_0___default()(el);
  21392. var command_parent = el_jq.data('command');
  21393. 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) {
  21394. // Se não tiver outro comando ainda no bloco, só adiciona:
  21395. if (command_parent.commands_block == null || command_parent.commands_block.length == 0) {
  21396. command_parent.commands_block = [];
  21397. var recentComand = genericCreateCommand(command_type);
  21398. command_parent.commands_block.push(recentComand);
  21399. renderCommand(recentComand, el_jq.find('.block_commands'), 3, function_obj);
  21400. } else {
  21401. // Se já tem algum comando no bloco:
  21402. findInBlockCorrectPlace(el, event, function_obj, command_type);
  21403. }
  21404. } else if (el_jq.data('command').type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].iftrue) {
  21405. console.log('QQ9'); // no if ou no else?
  21406. var correct_div = jquery__WEBPACK_IMPORTED_MODULE_0___default()(document.elementFromPoint(event.pageX, event.pageY));
  21407. var is_in_if = true;
  21408. if (correct_div.data('if')) {
  21409. is_in_if = true;
  21410. } else if (correct_div.data('else')) {
  21411. is_in_if = false;
  21412. } else {
  21413. var hier = correct_div.parentsUntil(".command_container");
  21414. for (var i = 0; i < hier.length; i++) {
  21415. var temp = jquery__WEBPACK_IMPORTED_MODULE_0___default()(hier[i]);
  21416. if (typeof temp.data('if') !== 'undefined') {
  21417. is_in_if = true;
  21418. break;
  21419. }
  21420. if (typeof temp.data('else') !== 'undefined') {
  21421. is_in_if = false;
  21422. break;
  21423. }
  21424. }
  21425. }
  21426. if (is_in_if) {
  21427. if (command_parent.commands_block == null || command_parent.commands_block.length == 0) {
  21428. command_parent.commands_block = [];
  21429. var recentComand = genericCreateCommand(command_type);
  21430. command_parent.commands_block.push(recentComand);
  21431. renderCommand(recentComand, el_jq.find('.commands_if'), 3, function_obj);
  21432. } else {
  21433. // Se já tem algum comando no bloco:
  21434. findInBlockCorrectPlace(el_jq.find('.commands_if'), event, function_obj, command_type);
  21435. }
  21436. } else {
  21437. if (command_parent.commands_else == null || command_parent.commands_else.length == 0) {
  21438. command_parent.commands_else = [];
  21439. var recentComand = genericCreateCommand(command_type);
  21440. command_parent.commands_else.push(recentComand);
  21441. renderCommand(recentComand, el_jq.find('.commands_else'), 3, function_obj);
  21442. } else {
  21443. // Se já tem algum comando no bloco:
  21444. findInBlockCorrectPlace(el_jq.find('.commands_else'), event, function_obj, command_type, true);
  21445. }
  21446. }
  21447. } else {
  21448. // é do tipo switch
  21449. console.log("está tentando inserir em um switch que está na raiz!");
  21450. addCommandToSwitchCase(event, function_obj, command_type);
  21451. }
  21452. }
  21453. function addCommandToSwitchCase(event, function_obj, command_type) {
  21454. var el = jquery__WEBPACK_IMPORTED_MODULE_0___default()(document.elementFromPoint(event.clientX, event.clientY));
  21455. var which_case = el.data('switchcase');
  21456. var case_div = el;
  21457. if (!which_case) {
  21458. var hier_find = el.parentsUntil(".all_cases_div");
  21459. for (var i = 0; i < hier_find.length; i++) {
  21460. if (typeof jquery__WEBPACK_IMPORTED_MODULE_0___default()(hier_find[i]).data('switchcase') !== 'undefined') {
  21461. which_case = jquery__WEBPACK_IMPORTED_MODULE_0___default()(hier_find[i]).data('switchcase');
  21462. case_div = jquery__WEBPACK_IMPORTED_MODULE_0___default()(hier_find[i]);
  21463. break;
  21464. }
  21465. }
  21466. }
  21467. if (which_case.commands_block == null || which_case.commands_block.length < 1) {
  21468. which_case.commands_block = [];
  21469. var recentComand = genericCreateCommand(command_type);
  21470. which_case.commands_block.push(recentComand);
  21471. renderCommand(recentComand, case_div.find('.case_commands_block'), 3, function_obj);
  21472. } else {
  21473. findInBlockCorrectPlaceInSwitchCase(which_case, case_div, event, function_obj, command_type);
  21474. }
  21475. }
  21476. function findInBlockCorrectPlaceInSwitchCase(which_case, case_div, event, function_obj, command_type) {
  21477. var all_sub = case_div.find('div.command_container');
  21478. var menor_distancia = 999999999;
  21479. var elemento_menor_distancia = null;
  21480. var antes = true;
  21481. var t_bot;
  21482. var t_top; // Descobrindo o elemento mais próximo:
  21483. for (var i = 0; i < all_sub.length; i++) {
  21484. t_top = all_sub[i].getBoundingClientRect().top;
  21485. t_bot = all_sub[i].getBoundingClientRect().top + all_sub[i].getBoundingClientRect().height;
  21486. if (t_top - event.clientY < menor_distancia) {
  21487. menor_distancia = event.clientY - t_top;
  21488. elemento_menor_distancia = all_sub[i];
  21489. }
  21490. }
  21491. 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:
  21492. if (borda_inferior - event.clientY < menor_distancia) {
  21493. var recentComand = genericCreateCommand(command_type);
  21494. which_case.commands_block.push(recentComand);
  21495. renderCommand(recentComand, jquery__WEBPACK_IMPORTED_MODULE_0___default()(case_div.find('.case_commands_block')[0]), 3, function_obj);
  21496. } else {
  21497. var recentComand = genericCreateCommand(command_type);
  21498. var index = which_case.commands_block.indexOf(jquery__WEBPACK_IMPORTED_MODULE_0___default()(elemento_menor_distancia).data('command'));
  21499. if (index > -1) {
  21500. which_case.commands_block.splice(index, 0, recentComand);
  21501. renderCommand(recentComand, elemento_menor_distancia, 1, function_obj);
  21502. }
  21503. }
  21504. }
  21505. function findInBlockCorrectPlace(el, event, function_obj, command_type) {
  21506. var is_in_else = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
  21507. var el_jq = jquery__WEBPACK_IMPORTED_MODULE_0___default()(el);
  21508. var all_sub = el_jq.find('div.command_container');
  21509. var menor_distancia = 999999999;
  21510. var elemento_menor_distancia = null;
  21511. var antes = true;
  21512. var t_bot;
  21513. var t_top; // Descobrindo o elemento mais próximo:
  21514. for (var i = 0; i < all_sub.length; i++) {
  21515. t_top = all_sub[i].getBoundingClientRect().top;
  21516. t_bot = all_sub[i].getBoundingClientRect().top + all_sub[i].getBoundingClientRect().height;
  21517. if (t_top - event.clientY < menor_distancia) {
  21518. menor_distancia = event.clientY - t_top;
  21519. elemento_menor_distancia = all_sub[i];
  21520. }
  21521. }
  21522. var borda_inferior = elemento_menor_distancia.parentNode.getBoundingClientRect().top + elemento_menor_distancia.parentNode.getBoundingClientRect().height;
  21523. console.log("menor_distancia: ");
  21524. console.log(elemento_menor_distancia); // Está mais próximo da borda de baixo, ou seja.. inserir por último:
  21525. if (borda_inferior - event.clientY < menor_distancia) {
  21526. console.log('QQ11');
  21527. var recentComand = genericCreateCommand(command_type);
  21528. var command_parent = el_jq.data('command');
  21529. if (is_in_else) {
  21530. console.log('QQ15');
  21531. command_parent.commands_else.push(recentComand);
  21532. console.log('el_jq');
  21533. console.log(el_jq);
  21534. console.log("$(el_jq.find('.commands_else')[0]):: ");
  21535. console.log(jquery__WEBPACK_IMPORTED_MODULE_0___default()(el_jq.find('.commands_else')[0]));
  21536. renderCommand(recentComand, el_jq, 3, function_obj);
  21537. } else {
  21538. console.log('QQ16');
  21539. command_parent.commands_block.push(recentComand);
  21540. renderCommand(recentComand, jquery__WEBPACK_IMPORTED_MODULE_0___default()(el_jq.find('.block_commands')[0]), 3, function_obj);
  21541. }
  21542. } else {
  21543. console.log('QQ12');
  21544. var recentComand = genericCreateCommand(command_type);
  21545. var command_parent = el_jq.data('command');
  21546. if (is_in_else) {
  21547. var index = command_parent.commands_else.indexOf(jquery__WEBPACK_IMPORTED_MODULE_0___default()(elemento_menor_distancia).data('command'));
  21548. if (index > -1) {
  21549. command_parent.commands_else.splice(index, 0, recentComand);
  21550. renderCommand(recentComand, elemento_menor_distancia, 1, function_obj);
  21551. }
  21552. } else {
  21553. var index = command_parent.commands_block.indexOf(jquery__WEBPACK_IMPORTED_MODULE_0___default()(elemento_menor_distancia).data('command'));
  21554. if (index > -1) {
  21555. command_parent.commands_block.splice(index, 0, recentComand);
  21556. renderCommand(recentComand, elemento_menor_distancia, 1, function_obj);
  21557. }
  21558. }
  21559. }
  21560. }
  21561. function findBeforeOrAfterCommandToAdd(el, event, function_obj, command_type) {
  21562. switch (jquery__WEBPACK_IMPORTED_MODULE_0___default()(el).data('command').type) {
  21563. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].iftrue:
  21564. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].switch:
  21565. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].repeatNtimes:
  21566. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].whiletrue:
  21567. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].dowhiletrue:
  21568. insertCommandInBlock(el, event, function_obj, command_type);
  21569. return;
  21570. }
  21571. var menor_distancia = 999999999;
  21572. var antes = true;
  21573. var t_bot;
  21574. var t_top;
  21575. t_top = el.getBoundingClientRect().top;
  21576. t_bot = el.getBoundingClientRect().top + el.getBoundingClientRect().height;
  21577. var d_top = event.clientY - t_top; // distancia topo
  21578. var d_bot = t_bot - event.clientY; // distancia baixo
  21579. // Está mais próximo da borda de baixo, ou seja.. inserir por último:
  21580. if (d_top < d_bot) {
  21581. var recentComand = genericCreateCommand(command_type);
  21582. var index = function_obj.commands.indexOf(jquery__WEBPACK_IMPORTED_MODULE_0___default()(el).data('command'));
  21583. if (index > -1) {
  21584. function_obj.commands.splice(index, 0, recentComand);
  21585. }
  21586. renderCommand(recentComand, el, 1, function_obj);
  21587. } else {
  21588. var recentComand = genericCreateCommand(command_type);
  21589. var index = function_obj.commands.indexOf(jquery__WEBPACK_IMPORTED_MODULE_0___default()(el).data('command'));
  21590. if (index > -1) {
  21591. function_obj.commands.splice(index + 1, 0, recentComand);
  21592. }
  21593. renderCommand(recentComand, el, 2, function_obj);
  21594. }
  21595. }
  21596. function findNearbyCommandToAddInFunctionScope(el, event, node_list_commands, function_obj, command_type) {
  21597. var all_sub = jquery__WEBPACK_IMPORTED_MODULE_0___default()(node_list_commands).find('div.command_container');
  21598. var menor_distancia = 999999999;
  21599. var elemento_menor_distancia = null;
  21600. var antes = true;
  21601. var t_bot;
  21602. var t_top; // Descobrindo o elemento mais próximo:
  21603. for (var i = 0; i < all_sub.length; i++) {
  21604. t_top = all_sub[i].getBoundingClientRect().top;
  21605. t_bot = all_sub[i].getBoundingClientRect().top + all_sub[i].getBoundingClientRect().height;
  21606. if (t_top - event.clientY < menor_distancia) {
  21607. menor_distancia = event.clientY - t_top;
  21608. elemento_menor_distancia = all_sub[i];
  21609. }
  21610. }
  21611. 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:
  21612. if (borda_inferior - event.clientY < menor_distancia) {
  21613. var recentComand = genericCreateCommand(command_type);
  21614. function_obj.commands.push(recentComand); //
  21615. renderCommand(recentComand, node_list_commands, 3, function_obj);
  21616. } else {
  21617. var recentComand = genericCreateCommand(command_type);
  21618. var index = function_obj.commands.indexOf(jquery__WEBPACK_IMPORTED_MODULE_0___default()(elemento_menor_distancia).data('command'));
  21619. if (index > -1) {
  21620. function_obj.commands.splice(index, 0, recentComand);
  21621. }
  21622. renderCommand(recentComand, elemento_menor_distancia, 1, function_obj);
  21623. }
  21624. }
  21625. /***/ }),
  21626. /***/ "./js/visualUI/commands/attribution.js":
  21627. /*!*********************************************!*\
  21628. !*** ./js/visualUI/commands/attribution.js ***!
  21629. \*********************************************/
  21630. /*! exports provided: createFloatingCommand, renderCommand, manageExpressionElements, renderMenuOperations */
  21631. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  21632. "use strict";
  21633. __webpack_require__.r(__webpack_exports__);
  21634. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createFloatingCommand", function() { return createFloatingCommand; });
  21635. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "renderCommand", function() { return renderCommand; });
  21636. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "manageExpressionElements", function() { return manageExpressionElements; });
  21637. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "renderMenuOperations", function() { return renderMenuOperations; });
  21638. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  21639. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_0__);
  21640. /* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  21641. /* harmony import */ var _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  21642. /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  21643. /* harmony import */ var _globals__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../globals */ "./js/visualUI/globals.js");
  21644. /* harmony import */ var _variables__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../variables */ "./js/visualUI/variables.js");
  21645. /* harmony import */ var _variable_value_menu__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  21646. /* harmony import */ var _commands__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  21647. /* harmony import */ var _generic_expression__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./generic_expression */ "./js/visualUI/commands/generic_expression.js");
  21648. function createFloatingCommand() {
  21649. 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>');
  21650. }
  21651. function renderCommand(command, function_obj) {
  21652. 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>');
  21653. el.data('command', command);
  21654. _variable_value_menu__WEBPACK_IMPORTED_MODULE_6__["renderMenu"](command, command.variable, el.find('.var_attributed'), function_obj);
  21655. if (!command.expression || command.expression.length < 1) {
  21656. var 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);
  21657. command.expression.push(exp);
  21658. }
  21659. addHandlers(command, function_obj, el);
  21660. _generic_expression__WEBPACK_IMPORTED_MODULE_8__["renderExpression"](command, function_obj, el.find('.expression_elements'), command.expression); //renderExpressionElements(command, function_obj, el);
  21661. return el;
  21662. }
  21663. function manageExpressionElements(command, ref_object, dom_object, menu_var_or_value, function_obj, selectedItem, expression_element) {
  21664. var index_to_move = expression_element.itens.indexOf(ref_object);
  21665. switch (selectedItem.data('exp')) {
  21666. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_ELEMENTS"].exp_op_exp:
  21667. 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)]);
  21668. expression_element.itens[index_to_move] = exp;
  21669. break;
  21670. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_ELEMENTS"].op_exp:
  21671. 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]]);
  21672. expression_element.itens[index_to_move] = exp;
  21673. break;
  21674. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_ELEMENTS"].par_exp_par:
  21675. 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]]);
  21676. expression_element.itens[index_to_move] = exp;
  21677. break;
  21678. }
  21679. renderExpressionElements(command, function_obj, dom_object);
  21680. }
  21681. function renderExpressionElements(command, function_obj, el) {
  21682. var expression_div = el.find('.expression_elements');
  21683. var command_container;
  21684. if (el.hasClass("command_container") == false) {
  21685. var hier = el.parentsUntil(".command_container");
  21686. for (var i = 0; i < hier.length; i++) {
  21687. if (jquery__WEBPACK_IMPORTED_MODULE_0___default()(hier[i]).hasClass("command_container")) {
  21688. command_container = jquery__WEBPACK_IMPORTED_MODULE_0___default()(hier[i]);
  21689. break;
  21690. }
  21691. if (jquery__WEBPACK_IMPORTED_MODULE_0___default()(hier[i]).hasClass("expression_elements")) {
  21692. expression_div = jquery__WEBPACK_IMPORTED_MODULE_0___default()(hier[i]);
  21693. break;
  21694. }
  21695. }
  21696. }
  21697. if (command_container) {
  21698. expression_div = command_container.find('.expression_elements');
  21699. }
  21700. expression_div.text('');
  21701. for (var i = 0; i < command.expression.length; i++) {
  21702. var temp = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="expression_element"></div>');
  21703. temp.data('ref_element', command.expression[i]);
  21704. temp.data('ref_index', i);
  21705. expression_div.append(temp);
  21706. renderElement(command, function_obj, temp, command.expression[i]);
  21707. }
  21708. }
  21709. function renderOperator(command, function_obj, temp_op, expression_element, index_op) {
  21710. var context_menu = '<div class="ui dropdown"><div class="text">';
  21711. switch (expression_element.itens[index_op]) {
  21712. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].plus:
  21713. context_menu += '+';
  21714. break;
  21715. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].minus:
  21716. context_menu += '-';
  21717. break;
  21718. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].multiplication:
  21719. context_menu += '*';
  21720. break;
  21721. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].division:
  21722. context_menu += '/';
  21723. break;
  21724. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].module:
  21725. context_menu += '%';
  21726. break;
  21727. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].none:
  21728. context_menu += '...';
  21729. break;
  21730. }
  21731. context_menu += '</div><div class="menu">';
  21732. context_menu += '<div class="item" data-value="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].plus + '">+</div>';
  21733. context_menu += '<div class="item" data-value="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].minus + '">-</div>';
  21734. context_menu += '<div class="item" data-value="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].multiplication + '">*</div>';
  21735. context_menu += '<div class="item" data-value="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].division + '">/</div>';
  21736. context_menu += '<div class="item" data-value="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].module + '">%</div>';
  21737. context_menu += '<div class="item" data-value="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].none + '" data-text="...">Nenhum</div>';
  21738. context_menu += '</div></div>';
  21739. context_menu = jquery__WEBPACK_IMPORTED_MODULE_0___default()(context_menu);
  21740. temp_op.append(context_menu);
  21741. context_menu.dropdown({
  21742. onChange: function onChange(value, text, $selectedItem) {
  21743. expression_element.itens[index_op] = value;
  21744. }
  21745. });
  21746. }
  21747. function renderMenuAddExpression(command, function_obj, el, dom_append_menu, expression_append_new_expression) {
  21748. if (el.hasClass("command_container") == false) {
  21749. var hier = el.parentsUntil(".commands_list_div");
  21750. for (var i = 0; i < hier.length; i++) {
  21751. if (jquery__WEBPACK_IMPORTED_MODULE_0___default()(hier[i]).hasClass("command_container")) {
  21752. el = jquery__WEBPACK_IMPORTED_MODULE_0___default()(hier[i]);
  21753. break;
  21754. }
  21755. }
  21756. }
  21757. if (dom_append_menu.hasClass("expression_elements") == false) {
  21758. var hier = el.parentsUntil(".commands_list_div");
  21759. for (var i = 0; i < hier.length; i++) {
  21760. if (jquery__WEBPACK_IMPORTED_MODULE_0___default()(hier[i]).hasClass("expression_elements")) {
  21761. dom_append_menu = jquery__WEBPACK_IMPORTED_MODULE_0___default()(hier[i]);
  21762. break;
  21763. }
  21764. }
  21765. }
  21766. var context_menu = '<div class="ui dropdown"><div class="text"></div><i class="ui icon arrow alternate circle right outline"></i><div class="menu">';
  21767. context_menu += '<div class="item" data-value="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_ELEMENTS"].exp_op_exp + '">EXP OP EXP</div>';
  21768. context_menu += '<div class="item" data-value="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_ELEMENTS"].op_exp + '">OP EXP</div>';
  21769. context_menu += '<div class="item" data-value="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_ELEMENTS"].par_exp_par + '">( EXP )</div>';
  21770. context_menu += '</div></div>';
  21771. context_menu = jquery__WEBPACK_IMPORTED_MODULE_0___default()(context_menu);
  21772. dom_append_menu.append(context_menu);
  21773. context_menu.dropdown({
  21774. onChange: function onChange(value, text, $selectedItem) {
  21775. switch (value) {
  21776. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_ELEMENTS"].exp_op_exp:
  21777. 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)]);
  21778. expression_append_new_expression.push(exp);
  21779. break;
  21780. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_ELEMENTS"].op_exp:
  21781. 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)]);
  21782. expression_append_new_expression.push(exp);
  21783. break;
  21784. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_ELEMENTS"].par_exp_par:
  21785. 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)]);
  21786. expression_append_new_expression.push(exp);
  21787. break;
  21788. }
  21789. renderExpressionElements(command, function_obj, el);
  21790. }
  21791. });
  21792. }
  21793. function renderElement(command, function_obj, el, expression_element) {
  21794. switch (expression_element.type_exp) {
  21795. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_ELEMENTS"].exp_op_exp:
  21796. var temp_op = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="component_element"></div>');
  21797. var temp_exp_1 = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="component_element"></div>');
  21798. var temp_exp_2 = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="component_element"></div>');
  21799. el.append(temp_exp_1);
  21800. el.append(temp_op);
  21801. el.append(temp_exp_2);
  21802. if (expression_element.itens[0].type) {
  21803. _variable_value_menu__WEBPACK_IMPORTED_MODULE_6__["renderMenu"](command, expression_element.itens[0], temp_exp_1, function_obj, 2, expression_element);
  21804. } else {
  21805. renderElement(command, function_obj, temp_exp_1, expression_element.itens[0]);
  21806. }
  21807. renderOperator(command, function_obj, temp_op, expression_element, 1);
  21808. if (expression_element.itens[2].type) {
  21809. _variable_value_menu__WEBPACK_IMPORTED_MODULE_6__["renderMenu"](command, expression_element.itens[2], temp_exp_2, function_obj, 2, expression_element);
  21810. } else {
  21811. renderElement(command, function_obj, temp_exp_2, expression_element.itens[2]);
  21812. }
  21813. break;
  21814. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_ELEMENTS"].op_exp:
  21815. var temp_op = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="component_element"></div>');
  21816. var temp_exp = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="component_element"></div>');
  21817. el.append(temp_op);
  21818. el.append(temp_exp);
  21819. renderOperator(command, function_obj, temp_op, expression_element, 0);
  21820. if (expression_element.itens[1].type) {
  21821. _variable_value_menu__WEBPACK_IMPORTED_MODULE_6__["renderMenu"](command, expression_element.itens[1], temp_exp, function_obj, 2, expression_element);
  21822. } else {
  21823. renderElement(command, function_obj, temp_exp, expression_element.itens[1]);
  21824. }
  21825. break;
  21826. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_ELEMENTS"].par_exp_par:
  21827. var temp_par_1 = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="component_element"> ( </div>');
  21828. var temp_exp = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="component_element"></div>');
  21829. var temp_par_2 = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="component_element"> ) </div>');
  21830. el.append(temp_par_1);
  21831. el.append(temp_exp);
  21832. for (var j = 0; j < expression_element.itens.length; j++) {
  21833. if (expression_element.itens[j].type) {
  21834. _variable_value_menu__WEBPACK_IMPORTED_MODULE_6__["renderMenu"](command, expression_element.itens[j], temp_exp, function_obj, 2, expression_element);
  21835. } else {
  21836. renderElement(command, function_obj, temp_exp, expression_element.itens[j]);
  21837. }
  21838. } //renderMenuAddExpression(command, function_obj, el, el, expression_element.itens);
  21839. el.append(temp_par_2);
  21840. break;
  21841. }
  21842. }
  21843. function renderExpression(command, function_obj, el) {
  21844. var expression_div = el.find('.expression_elements');
  21845. expression_div.text('');
  21846. var menu_add_item = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="menu_add_item"></div>');
  21847. menu_add_item.data('index_add', 0);
  21848. expression_div.append(menu_add_item);
  21849. for (var i = 0; i < command.expression.length; i++) {
  21850. if (command.expression[i].type) {
  21851. var temp = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="expression_element"></div>');
  21852. temp.data('ref_element', command.expression[i]);
  21853. temp.data('ref_index', i);
  21854. expression_div.append(temp);
  21855. _variable_value_menu__WEBPACK_IMPORTED_MODULE_6__["renderMenu"](command, command.expression[i], temp, function_obj);
  21856. } else if (command.expression[i] == "(" || command.expression[i] == ")") {
  21857. var temp = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="expression_element">' + command.expression[i] + '</div>');
  21858. temp.data('ref_element', command.expression[i]);
  21859. temp.data('ref_index', i);
  21860. expression_div.append(temp);
  21861. } else {
  21862. var temp = '<div class="expression_element">';
  21863. switch (command.expression[i]) {
  21864. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].plus:
  21865. temp += '+';
  21866. break;
  21867. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].minus:
  21868. temp += '-';
  21869. break;
  21870. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].multiplication:
  21871. temp += '*';
  21872. break;
  21873. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].division:
  21874. temp += '/';
  21875. break;
  21876. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].module:
  21877. temp += '%';
  21878. break;
  21879. }
  21880. temp += '</div>';
  21881. temp = jquery__WEBPACK_IMPORTED_MODULE_0___default()(temp);
  21882. temp.data('ref_element', command.expression[i]);
  21883. temp.data('ref_index', i);
  21884. expression_div.append(temp);
  21885. }
  21886. var menu_add_item_seq = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="menu_add_item"></div>');
  21887. var index_temp = i + 1;
  21888. menu_add_item_seq.data('index_add', index_temp);
  21889. expression_div.append(menu_add_item_seq);
  21890. }
  21891. addMenuItens(command, function_obj, el);
  21892. }
  21893. function addMenuItens(command, function_obj, expression_div) {
  21894. var divs_expression = expression_div.find('.menu_add_item');
  21895. for (var i = 0; i < divs_expression.length; i++) {
  21896. var temp = jquery__WEBPACK_IMPORTED_MODULE_0___default()(divs_expression[i]).data('index_add');
  21897. var context_menu = '<div class="ui dropdown context_menu_clear"><i class="ui icon plus square outline"></i><div class="menu">';
  21898. context_menu += '<div class="item" data-option="value" data-index="' + temp + '">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_value') + '</div>';
  21899. context_menu += '<div class="item" data-option="operator" data-index="' + temp + '">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_operator') + '</div>';
  21900. context_menu += '<div class="item" data-option="parentheses" data-index="' + temp + '">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_parentheses') + '</div>';
  21901. context_menu += '</div></div>';
  21902. context_menu = jquery__WEBPACK_IMPORTED_MODULE_0___default()(context_menu);
  21903. jquery__WEBPACK_IMPORTED_MODULE_0___default()(divs_expression[i]).append(context_menu);
  21904. context_menu.dropdown({
  21905. on: 'hover',
  21906. onChange: function onChange(value, text, $selectedItem) {
  21907. switch ($selectedItem.data('option')) {
  21908. case "value":
  21909. 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));
  21910. renderExpression(command, function_obj, expression_div);
  21911. break;
  21912. case "operator":
  21913. command.expression.splice($selectedItem.data('index'), 0, _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].plus);
  21914. renderExpression(command, function_obj, expression_div);
  21915. break;
  21916. case "parentheses":
  21917. command.expression.splice($selectedItem.data('index'), 0, "(");
  21918. 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));
  21919. command.expression.splice($selectedItem.data('index') + 2, 0, ")");
  21920. renderExpression(command, function_obj, expression_div);
  21921. break;
  21922. }
  21923. }
  21924. });
  21925. }
  21926. }
  21927. function addHandlers(command, function_obj, attribution_dom) {
  21928. attribution_dom.find('.button_remove_command').on('click', function () {
  21929. if (_commands__WEBPACK_IMPORTED_MODULE_7__["removeCommand"](command, function_obj, attribution_dom)) {
  21930. attribution_dom.fadeOut(400, function () {
  21931. attribution_dom.remove();
  21932. });
  21933. }
  21934. });
  21935. attribution_dom.find('.button_refresh_attribution').on('click', function () {
  21936. renderExpressionElements(command, function_obj, attribution_dom);
  21937. });
  21938. }
  21939. function renderMenuOperations(command, ref_object, dom_object, menu_var_or_value, function_obj, variable_selected) {
  21940. /*console.log("recebido o seguinte DOM: ");
  21941. console.log(dom_object);
  21942. if (dom_object.hasClass('var_attributed')) {
  21943. return;
  21944. } else {
  21945. var hier = dom_object.parentsUntil(".command_container");
  21946. for (var i = 0; i < hier.length; i++) {
  21947. if ($(hier[i]).hasClass('var_attributed') || $(hier[i]).hasClass('parameters_function_called')) {
  21948. return;
  21949. }
  21950. }
  21951. }
  21952. dom_object.find('.context_menu_clear').remove();
  21953. var menu_operations = '<div class="ui dropdown menu_operations"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
  21954. for (var tm in Models.ARITHMETIC_TYPES) {
  21955. menu_operations += '<div class="item" data-option="'+tm+'">'+LocalizedStrings.getUI('btn_arithmetic_' + tm)+'</div>';
  21956. }
  21957. menu_operations += '<div class="item" data-option="clear">'+LocalizedStrings.getUI('btn_clear')+'</div>';
  21958. menu_operations += '</div></div>';
  21959. menu_operations = $(menu_operations);
  21960. dom_object.append(menu_operations);
  21961. menu_operations.dropdown({
  21962. onChange: function(value, text, $selectedItem) {
  21963. switch ($($selectedItem).data('option')) {
  21964. case "clear":
  21965. $(dom_object).text('');
  21966. VariableValueMenu.renderMenu(command, ref_object, dom_object, function_obj);
  21967. break;
  21968. default:
  21969. createExpressionAround(command, ref_object, dom_object, function_obj);
  21970. menu_operations.find('.text').text('');
  21971. }
  21972. }
  21973. });*/
  21974. }
  21975. function createExpressionAround(command, ref_object, dom_object, function_obj) {
  21976. jquery__WEBPACK_IMPORTED_MODULE_0___default()('<span> ( </span>').insertBefore(dom_object);
  21977. jquery__WEBPACK_IMPORTED_MODULE_0___default()('<span> ) </span>').insertAfter(dom_object);
  21978. _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);
  21979. }
  21980. /***/ }),
  21981. /***/ "./js/visualUI/commands/break.js":
  21982. /*!***************************************!*\
  21983. !*** ./js/visualUI/commands/break.js ***!
  21984. \***************************************/
  21985. /*! exports provided: createFloatingCommand, renderCommand */
  21986. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  21987. "use strict";
  21988. __webpack_require__.r(__webpack_exports__);
  21989. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createFloatingCommand", function() { return createFloatingCommand; });
  21990. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "renderCommand", function() { return renderCommand; });
  21991. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  21992. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_0__);
  21993. /* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  21994. /* harmony import */ var _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  21995. /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  21996. /* harmony import */ var _commands__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  21997. function createFloatingCommand() {
  21998. 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>');
  21999. }
  22000. function renderCommand(command, function_obj) {
  22001. 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>');
  22002. el.data('command', command);
  22003. addHandlers(command, function_obj, el);
  22004. return el;
  22005. }
  22006. function addHandlers(command, function_obj, break_dom) {
  22007. break_dom.find('.button_remove_command').on('click', function () {
  22008. if (_commands__WEBPACK_IMPORTED_MODULE_4__["removeCommand"](command, function_obj, break_dom)) {
  22009. break_dom.fadeOut(400, function () {
  22010. break_dom.remove();
  22011. });
  22012. }
  22013. });
  22014. }
  22015. /***/ }),
  22016. /***/ "./js/visualUI/commands/comment.js":
  22017. /*!*****************************************!*\
  22018. !*** ./js/visualUI/commands/comment.js ***!
  22019. \*****************************************/
  22020. /*! exports provided: createFloatingCommand, renderCommand */
  22021. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  22022. "use strict";
  22023. __webpack_require__.r(__webpack_exports__);
  22024. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createFloatingCommand", function() { return createFloatingCommand; });
  22025. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "renderCommand", function() { return renderCommand; });
  22026. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  22027. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_0__);
  22028. /* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  22029. /* harmony import */ var _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  22030. /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  22031. /* harmony import */ var _globals__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../globals */ "./js/visualUI/globals.js");
  22032. /* harmony import */ var _variables__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../variables */ "./js/visualUI/variables.js");
  22033. /* harmony import */ var _variable_value_menu__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  22034. /* harmony import */ var _commands__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  22035. function createFloatingCommand() {
  22036. 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>');
  22037. }
  22038. function renderCommand(command, function_obj) {
  22039. 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>');
  22040. el.data('command', command);
  22041. addHandlers(command, function_obj, el);
  22042. renderTextComment(command, function_obj, el);
  22043. return el;
  22044. }
  22045. function renderTextComment(command, function_obj, el) {
  22046. _variable_value_menu__WEBPACK_IMPORTED_MODULE_6__["renderMenu"](command, command.comment_text, el.find('.var_value_menu_div'), function_obj, 20);
  22047. }
  22048. function addHandlers(command, function_obj, comment_dom) {
  22049. comment_dom.find('.button_remove_command').on('click', function () {
  22050. if (_commands__WEBPACK_IMPORTED_MODULE_7__["removeCommand"](command, function_obj, comment_dom)) {
  22051. comment_dom.fadeOut(400, function () {
  22052. comment_dom.remove();
  22053. });
  22054. }
  22055. });
  22056. }
  22057. /***/ }),
  22058. /***/ "./js/visualUI/commands/conditional_expression.js":
  22059. /*!********************************************************!*\
  22060. !*** ./js/visualUI/commands/conditional_expression.js ***!
  22061. \********************************************************/
  22062. /*! exports provided: renderExpression */
  22063. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  22064. "use strict";
  22065. __webpack_require__.r(__webpack_exports__);
  22066. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "renderExpression", function() { return renderExpression; });
  22067. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  22068. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_0__);
  22069. /* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  22070. /* harmony import */ var _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  22071. /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  22072. /* harmony import */ var _globals__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../globals */ "./js/visualUI/globals.js");
  22073. /* harmony import */ var _variables__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../variables */ "./js/visualUI/variables.js");
  22074. /* harmony import */ var _variable_value_menu__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  22075. function renderExpression(command, expression, function_obj, initial_el_to_render) {
  22076. expression.dom_object = initial_el_to_render;
  22077. if (expression.expression == null || expression.expression.length < 1) {
  22078. renderStartMenu(command, expression, function_obj, initial_el_to_render);
  22079. } else {
  22080. var main_div = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="expression_elements"></div>');
  22081. switch (expression.expression.type) {
  22082. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_logic:
  22083. renderLogicExpression(command, expression, expression.expression, function_obj, main_div, initial_el_to_render);
  22084. break;
  22085. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_arithmetic:
  22086. renderArithmeticExpression(command, expression, expression.expression, function_obj, main_div);
  22087. break;
  22088. }
  22089. initial_el_to_render.append(main_div);
  22090. var restartMenu = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="ui restart_expression"><i class="ui icon undo"></i></div>');
  22091. initial_el_to_render.append(restartMenu);
  22092. restartMenu.on('click', function (e) {
  22093. expression.expression = null;
  22094. initial_el_to_render.empty();
  22095. renderExpression(command, expression, function_obj, initial_el_to_render);
  22096. });
  22097. }
  22098. }
  22099. function renderArithmeticOperator(command, all_expression, expression_arithmetic, arithmetic_operator, function_obj, element_to_append) {
  22100. var menu_operator = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="ui dropdown"><div class="text"></div><i class="dropdown icon"></i></div>');
  22101. menu_operator.dropdown({
  22102. values: [{
  22103. name: '>',
  22104. value: _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_COMPARISON"].greater_than,
  22105. selected: arithmetic_operator == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_COMPARISON"].greater_than
  22106. }, {
  22107. name: '<',
  22108. value: _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_COMPARISON"].less_than,
  22109. selected: arithmetic_operator == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_COMPARISON"].less_than
  22110. }, {
  22111. name: '==',
  22112. value: _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_COMPARISON"].equals_to,
  22113. selected: arithmetic_operator == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_COMPARISON"].equals_to
  22114. }, {
  22115. name: '!=',
  22116. value: _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_COMPARISON"].not_equals_to,
  22117. selected: arithmetic_operator == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_COMPARISON"].not_equals_to
  22118. }, {
  22119. name: '>=',
  22120. value: _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_COMPARISON"].greater_than_or_equals_to,
  22121. selected: arithmetic_operator == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_COMPARISON"].greater_than_or_equals_to
  22122. }, {
  22123. name: '<=',
  22124. value: _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_COMPARISON"].less_than_or_equals_to,
  22125. selected: arithmetic_operator == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_COMPARISON"].less_than_or_equals_to
  22126. }],
  22127. onChange: function onChange(value, text, $selectedItem) {
  22128. expression_arithmetic.operator = value;
  22129. }
  22130. });
  22131. element_to_append.append(menu_operator);
  22132. }
  22133. function renderLogicOperator(command, all_expression, expression_logic, logic_operator, function_obj, element_to_append, initial_el_to_render) {
  22134. var menu_operator = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="ui dropdown"><div class="text"></div><i class="dropdown icon"></i></div>');
  22135. menu_operator.dropdown({
  22136. values: [{
  22137. name: '==',
  22138. value: _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["LOGIC_COMPARISON"].equals_to,
  22139. selected: logic_operator == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["LOGIC_COMPARISON"].equals_to
  22140. }, {
  22141. name: '!=',
  22142. value: _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["LOGIC_COMPARISON"].not_equals_to,
  22143. selected: logic_operator == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["LOGIC_COMPARISON"].not_equals_to
  22144. }, {
  22145. name: '&&',
  22146. value: _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["LOGIC_COMPARISON"].and,
  22147. selected: logic_operator == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["LOGIC_COMPARISON"].and
  22148. }, {
  22149. name: '||',
  22150. value: _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["LOGIC_COMPARISON"].or,
  22151. selected: logic_operator == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["LOGIC_COMPARISON"].or
  22152. }],
  22153. onChange: function onChange(value, text, $selectedItem) {
  22154. if ($selectedItem) {
  22155. expression_logic.operator = value;
  22156. if (expression_logic.second_operand == null) {
  22157. 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);
  22158. initial_el_to_render.empty();
  22159. renderExpression(command, all_expression, function_obj, initial_el_to_render);
  22160. }
  22161. }
  22162. }
  22163. });
  22164. element_to_append.append(menu_operator);
  22165. }
  22166. function renderLogicExpression(command, all_expression, expression_logic, function_obj, element_to_append, initial_el_to_render) {
  22167. var exp_el_par_1 = jquery__WEBPACK_IMPORTED_MODULE_0___default()(' <span class="span_command_spec"> </span> ');
  22168. var exp_el_expr_el_1 = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="expression_element"></div>');
  22169. var exp_el_expr_operand = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="expression_element"></div>');
  22170. var exp_el_expr_el_2 = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="expression_element"></div>');
  22171. var exp_el_par_2 = jquery__WEBPACK_IMPORTED_MODULE_0___default()(' <span class="span_command_spec"> </span> ');
  22172. if (expression_logic.first_operand.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_logic) {
  22173. renderLogicExpression(command, all_expression, expression_logic.first_operand, function_obj, exp_el_expr_el_1);
  22174. } else if (expression_logic.first_operand.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_arithmetic) {
  22175. renderArithmeticExpression(command, all_expression, expression_logic.first_operand, function_obj, exp_el_expr_el_1);
  22176. } else {
  22177. _variable_value_menu__WEBPACK_IMPORTED_MODULE_6__["renderMenu"](command, expression_logic.first_operand, exp_el_expr_el_1, function_obj);
  22178. }
  22179. element_to_append.append(exp_el_par_1);
  22180. element_to_append.append(exp_el_expr_el_1);
  22181. renderLogicOperator(command, all_expression, expression_logic, expression_logic.operator, function_obj, exp_el_expr_operand, initial_el_to_render);
  22182. element_to_append.append(exp_el_expr_operand);
  22183. if (expression_logic.second_operand) {
  22184. if (expression_logic.second_operand.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_logic) {
  22185. renderLogicExpression(command, all_expression, expression_logic.second_operand, function_obj, exp_el_expr_el_2);
  22186. } else if (expression_logic.second_operand.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_arithmetic) {
  22187. renderArithmeticExpression(command, all_expression, expression_logic.second_operand, function_obj, exp_el_expr_el_2);
  22188. } else {
  22189. _variable_value_menu__WEBPACK_IMPORTED_MODULE_6__["renderMenu"](command, expression_logic.second_operand, exp_el_expr_el_2, function_obj);
  22190. }
  22191. element_to_append.append(exp_el_expr_el_2);
  22192. }
  22193. element_to_append.append(exp_el_par_2);
  22194. }
  22195. function renderArithmeticExpression(command, all_expression, expression_arithmetic, function_obj, element_to_append) {
  22196. var exp_el_par_1 = jquery__WEBPACK_IMPORTED_MODULE_0___default()(' <span class="span_command_spec"> </span> ');
  22197. var exp_el_expr_el_1 = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="expression_element"></div>');
  22198. var exp_el_expr_operand = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="expression_element"></div>');
  22199. var exp_el_expr_el_2 = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="expression_element"></div>');
  22200. var exp_el_par_2 = jquery__WEBPACK_IMPORTED_MODULE_0___default()(' <span class="span_command_spec"> </span> ');
  22201. if (expression_arithmetic.first_operand.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_logic) {
  22202. renderLogicExpression(command, all_expression, expression_arithmetic.first_operand, function_obj, exp_el_expr_el_1);
  22203. } else if (expression_arithmetic.first_operand.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_arithmetic) {
  22204. renderArithmeticExpression(command, all_expression, expression_arithmetic.first_operand, function_obj, exp_el_expr_el_1);
  22205. } else {
  22206. _variable_value_menu__WEBPACK_IMPORTED_MODULE_6__["renderMenu"](command, expression_arithmetic.first_operand, exp_el_expr_el_1, function_obj);
  22207. }
  22208. if (expression_arithmetic.second_operand.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_logic) {
  22209. renderLogicExpression(command, all_expression, expression_arithmetic.second_operand, function_obj, exp_el_expr_el_2);
  22210. } else if (expression_arithmetic.second_operand.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_arithmetic) {
  22211. renderArithmeticExpression(command, all_expression, expression_arithmetic.second_operand, function_obj, exp_el_expr_el_2);
  22212. } else {
  22213. _variable_value_menu__WEBPACK_IMPORTED_MODULE_6__["renderMenu"](command, expression_arithmetic.second_operand, exp_el_expr_el_2, function_obj);
  22214. }
  22215. renderArithmeticOperator(command, all_expression, expression_arithmetic, expression_arithmetic.operator, function_obj, exp_el_expr_operand);
  22216. element_to_append.append(exp_el_par_1);
  22217. element_to_append.append(exp_el_expr_el_1);
  22218. element_to_append.append(exp_el_expr_operand);
  22219. element_to_append.append(exp_el_expr_el_2);
  22220. element_to_append.append(exp_el_par_2);
  22221. }
  22222. function renderStartMenu(command, expression, function_obj, initial_el_to_render) {
  22223. var start_menu = '';
  22224. 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">';
  22225. 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>';
  22226. 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>';
  22227. start_menu += '</div></div>';
  22228. start_menu = jquery__WEBPACK_IMPORTED_MODULE_0___default()(start_menu);
  22229. start_menu.dropdown({
  22230. onChange: function onChange(value, text, $selectedItem) {
  22231. switch ($selectedItem.data('exp')) {
  22232. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_logic:
  22233. 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));
  22234. break;
  22235. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_arithmetic:
  22236. 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);
  22237. break;
  22238. }
  22239. initial_el_to_render.html('');
  22240. renderExpression(command, expression, function_obj, initial_el_to_render);
  22241. },
  22242. selectOnKeydown: false
  22243. });
  22244. initial_el_to_render.append(' <span class="span_command_spec"> </span> ');
  22245. initial_el_to_render.append(start_menu);
  22246. initial_el_to_render.append(' <span class="span_command_spec"> </span> ');
  22247. }
  22248. /***/ }),
  22249. /***/ "./js/visualUI/commands/contextualized_menu.js":
  22250. /*!*****************************************************!*\
  22251. !*** ./js/visualUI/commands/contextualized_menu.js ***!
  22252. \*****************************************************/
  22253. /*! exports provided: renderMenu */
  22254. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  22255. "use strict";
  22256. __webpack_require__.r(__webpack_exports__);
  22257. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "renderMenu", function() { return renderMenu; });
  22258. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  22259. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_0__);
  22260. /* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  22261. /* harmony import */ var _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  22262. /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  22263. /* harmony import */ var _commands__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  22264. /* harmony import */ var _variable_value_menu__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  22265. /* harmony import */ var _switch__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./switch */ "./js/visualUI/commands/switch.js");
  22266. /* harmony import */ var _repeatNtimes__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./repeatNtimes */ "./js/visualUI/commands/repeatNtimes.js");
  22267. function renderMenu(command, dom_where_render, function_obj, dom_command) {
  22268. var menu_div = '<div class="ui dropdown menu_commands" ><i class="icon code"></i> <div class="menu"> ';
  22269. 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) {
  22270. 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>';
  22271. } else {
  22272. 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>';
  22273. 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>';
  22274. }
  22275. menu_div += '</div></div>';
  22276. menu_div = jquery__WEBPACK_IMPORTED_MODULE_0___default()(menu_div);
  22277. dom_where_render.append(menu_div);
  22278. addHandlers(command, dom_where_render, function_obj, dom_command);
  22279. }
  22280. function addHandlers(command, dom_where_render, function_obj, dom_command) {
  22281. dom_where_render.find('.menu_commands').dropdown({
  22282. on: 'hover'
  22283. });
  22284. dom_where_render.find('.menu_commands a').on('click', function (evt) {
  22285. 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) {
  22286. if (command.commands_block == null || command.commands_block.length == 0) {
  22287. command.commands_block = [];
  22288. var new_cmd = _commands__WEBPACK_IMPORTED_MODULE_4__["genericCreateCommand"](jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).data('command'));
  22289. command.commands_block.push(new_cmd);
  22290. _commands__WEBPACK_IMPORTED_MODULE_4__["renderCommand"](new_cmd, dom_command.find('.block_commands'), 3, function_obj);
  22291. } else {
  22292. _commands__WEBPACK_IMPORTED_MODULE_4__["createFloatingCommand"](function_obj, dom_command.find('.block_commands'), jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).data('command'), evt);
  22293. }
  22294. } else {
  22295. switch (jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).data('command')) {
  22296. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].break:
  22297. _commands__WEBPACK_IMPORTED_MODULE_4__["createFloatingCommand"](function_obj, dom_command.find('.block_commands'), jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).data('command'), evt);
  22298. break;
  22299. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].switchcase:
  22300. addCaseToSwitch(command, dom_where_render, function_obj, dom_command);
  22301. break;
  22302. }
  22303. }
  22304. });
  22305. }
  22306. function addCaseToSwitch(command, dom_where_render, function_obj, dom_command) {
  22307. if (command.cases == null) {
  22308. command.cases = [];
  22309. }
  22310. 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));
  22311. command.cases.push(sc);
  22312. _switch__WEBPACK_IMPORTED_MODULE_6__["renderCase"](sc, command, function_obj, dom_command.find('.all_cases_div'));
  22313. }
  22314. /***/ }),
  22315. /***/ "./js/visualUI/commands/dowhiletrue.js":
  22316. /*!*********************************************!*\
  22317. !*** ./js/visualUI/commands/dowhiletrue.js ***!
  22318. \*********************************************/
  22319. /*! exports provided: createFloatingCommand, renderCommand */
  22320. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  22321. "use strict";
  22322. __webpack_require__.r(__webpack_exports__);
  22323. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createFloatingCommand", function() { return createFloatingCommand; });
  22324. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "renderCommand", function() { return renderCommand; });
  22325. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  22326. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_0__);
  22327. /* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  22328. /* harmony import */ var _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  22329. /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  22330. /* harmony import */ var _globals__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../globals */ "./js/visualUI/globals.js");
  22331. /* harmony import */ var _variables__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../variables */ "./js/visualUI/variables.js");
  22332. /* harmony import */ var _commands__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  22333. /* harmony import */ var _conditional_expression__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./conditional_expression */ "./js/visualUI/commands/conditional_expression.js");
  22334. /* harmony import */ var _contextualized_menu__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./contextualized_menu */ "./js/visualUI/commands/contextualized_menu.js");
  22335. function createFloatingCommand() {
  22336. 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>');
  22337. }
  22338. function renderCommand(command, function_obj) {
  22339. var ret = '';
  22340. 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>';
  22341. ret += '<div class="ui block_commands" data-subblock="" data-idcommand="">';
  22342. ret += '</div>';
  22343. 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>';
  22344. ret += '</div>';
  22345. var el = jquery__WEBPACK_IMPORTED_MODULE_0___default()(ret);
  22346. el.data('command', command);
  22347. el.find('.block_commands').data('command', command);
  22348. addHandlers(command, function_obj, el);
  22349. _contextualized_menu__WEBPACK_IMPORTED_MODULE_8__["renderMenu"](command, el.find('.context_menu'), function_obj, el);
  22350. _conditional_expression__WEBPACK_IMPORTED_MODULE_7__["renderExpression"](command, command.expression, function_obj, el.find('.conditional_expression'));
  22351. if (command.commands_block) {
  22352. for (var j = 0; j < command.commands_block.length; j++) {
  22353. _commands__WEBPACK_IMPORTED_MODULE_6__["renderCommand"](command.commands_block[j], jquery__WEBPACK_IMPORTED_MODULE_0___default()(el.find('.block_commands')[0]), 3, function_obj);
  22354. }
  22355. }
  22356. return el;
  22357. }
  22358. function addHandlers(command, function_obj, dowhiletrue_dom) {
  22359. dowhiletrue_dom.find('.button_remove_command').on('click', function () {
  22360. if (_commands__WEBPACK_IMPORTED_MODULE_6__["removeCommand"](command, function_obj, dowhiletrue_dom)) {
  22361. dowhiletrue_dom.fadeOut(400, function () {
  22362. dowhiletrue_dom.remove();
  22363. });
  22364. }
  22365. });
  22366. }
  22367. /***/ }),
  22368. /***/ "./js/visualUI/commands/functioncall.js":
  22369. /*!**********************************************!*\
  22370. !*** ./js/visualUI/commands/functioncall.js ***!
  22371. \**********************************************/
  22372. /*! exports provided: createFloatingCommand, renderCommand */
  22373. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  22374. "use strict";
  22375. __webpack_require__.r(__webpack_exports__);
  22376. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createFloatingCommand", function() { return createFloatingCommand; });
  22377. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "renderCommand", function() { return renderCommand; });
  22378. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  22379. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_0__);
  22380. /* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  22381. /* harmony import */ var _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  22382. /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  22383. /* harmony import */ var _globals__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../globals */ "./js/visualUI/globals.js");
  22384. /* harmony import */ var _variables__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../variables */ "./js/visualUI/variables.js");
  22385. /* harmony import */ var _variable_value_menu__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  22386. /* harmony import */ var _commands__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  22387. function createFloatingCommand() {
  22388. return jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="ui functioncall created_element"> <i class="hand point right icon"></i> <span> funcao() </span></div>');
  22389. }
  22390. function renderCommand(command, function_obj) {
  22391. 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>');
  22392. el.data('command', command);
  22393. _variable_value_menu__WEBPACK_IMPORTED_MODULE_6__["renderMenu"](command, command.function_called, el.find('.var_value_menu_div'), function_obj);
  22394. addHandlers(command, function_obj, el);
  22395. return el;
  22396. }
  22397. function addHandlers(command, function_obj, functioncall_dom) {
  22398. functioncall_dom.find('.button_remove_command').on('click', function () {
  22399. if (_commands__WEBPACK_IMPORTED_MODULE_7__["removeCommand"](command, function_obj, functioncall_dom)) {
  22400. functioncall_dom.fadeOut(400, function () {
  22401. functioncall_dom.remove();
  22402. });
  22403. }
  22404. });
  22405. }
  22406. /***/ }),
  22407. /***/ "./js/visualUI/commands/generic_expression.js":
  22408. /*!****************************************************!*\
  22409. !*** ./js/visualUI/commands/generic_expression.js ***!
  22410. \****************************************************/
  22411. /*! exports provided: renderExpression */
  22412. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  22413. "use strict";
  22414. __webpack_require__.r(__webpack_exports__);
  22415. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "renderExpression", function() { return renderExpression; });
  22416. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  22417. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_0__);
  22418. /* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  22419. /* harmony import */ var _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  22420. /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  22421. /* harmony import */ var _globals__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../globals */ "./js/visualUI/globals.js");
  22422. /* harmony import */ var _variables__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../variables */ "./js/visualUI/variables.js");
  22423. /* harmony import */ var _variable_value_menu__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  22424. /* harmony import */ var melanke_watchjs__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! melanke-watchjs */ "./node_modules/melanke-watchjs/src/watch.js");
  22425. /* harmony import */ var melanke_watchjs__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(melanke_watchjs__WEBPACK_IMPORTED_MODULE_7__);
  22426. function renderExpression(command, function_obj, div_to_render, expression_array) {
  22427. div_to_render.empty();
  22428. if (command.type === _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].attribution) {
  22429. melanke_watchjs__WEBPACK_IMPORTED_MODULE_7___default.a.unwatch(command.variable);
  22430. melanke_watchjs__WEBPACK_IMPORTED_MODULE_7___default.a.watch(command.variable, function () {
  22431. renderExpression(command, function_obj, div_to_render, expression_array);
  22432. }, 0);
  22433. if (command.variable.content) {
  22434. var types_included = [];
  22435. if (command.variable.content.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].INTEGER || command.variable.content.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  22436. types_included.push(_ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_arithmetic);
  22437. } else if (command.variable.content.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].BOOLEAN) {
  22438. types_included.push(_ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_conditional);
  22439. types_included.push(_ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_logic);
  22440. types_included.push(_ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_arithmetic);
  22441. } else if (command.variable.content.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].TEXT) {
  22442. types_included.push(_ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_conditional);
  22443. types_included.push(_ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_logic);
  22444. types_included.push(_ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_arithmetic);
  22445. } else {
  22446. console.log('NÃO RECONHECI! VEJA: ', command.variable.content.type);
  22447. }
  22448. renderElements(command, function_obj, div_to_render, expression_array, types_included);
  22449. } else {
  22450. div_to_render.text(_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('var_menu_select_var').toLowerCase());
  22451. }
  22452. }
  22453. div_to_render.children('.mouse_distance').addClass('mouse_distance_hidden');
  22454. div_to_render.children('.higher_element').on('mousemove', function (evt) {
  22455. if (!window.open_or_close) {
  22456. jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).css('position', 'relative', '!important');
  22457. jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).children('.mouse_distance').css('opacity', '1');
  22458. }
  22459. });
  22460. div_to_render.children('.higher_element').on('mouseout', function (evt) {
  22461. if (!window.open_or_close) {
  22462. jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).css('position', 'absolute', '!important');
  22463. jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).children('.mouse_distance').css('opacity', '0');
  22464. }
  22465. });
  22466. /*var allfilhos = div_to_render.children('.mouse_distance');
  22467. console.log(allfilhos);
  22468. var boudings = [];
  22469. for (var i = 0; i < allfilhos.length; i++) {
  22470. boudings.push(allfilhos.get(i).getBoundingClientRect());
  22471. }
  22472. div_to_render.children('.mouse_distance').addClass('mouse_distance_hidden');
  22473. div_to_render.on('mousemove mouseenter', function(evt) {
  22474. if (!window.open_or_close && command.variable.content) {
  22475. var leftDistances = [];
  22476. var rightDistances = [];
  22477. for (var i = 0; i < allfilhos.length; i++) {
  22478. var leftD = Math.abs(boudings[i].left - evt.clientX);
  22479. leftDistances.push(leftD);
  22480. var rightD = Math.abs(boudings[i].right - evt.clientX);
  22481. rightDistances.push(rightD);
  22482. }
  22483. div_to_render.children('.mouse_distance').removeClass('mouse_distance_except');
  22484. div_to_render.children('.mouse_distance').addClass('mouse_distance_hidden');
  22485. var menorLeft = Math.min.apply(null, leftDistances);
  22486. var indiceLeft = leftDistances.indexOf(menorLeft);
  22487. var menorRight = Math.min.apply(null, rightDistances);
  22488. var indiceRight = rightDistances.indexOf(menorRight);
  22489. if (menorRight < menorLeft) {
  22490. $(allfilhos.get(indiceRight)).removeClass('mouse_distance_hidden');
  22491. $(allfilhos.get(indiceRight)).addClass('mouse_distance_except');
  22492. } else {
  22493. $(allfilhos.get(indiceLeft)).removeClass('mouse_distance_hidden');
  22494. $(allfilhos.get(indiceLeft)).addClass('mouse_distance_except');
  22495. }
  22496. }
  22497. });*/
  22498. }
  22499. function renderElements(command, function_obj, div_to_render, expression_array, types_included) {
  22500. /*if (expression_array.length > 0) {
  22501. if (!expression_array[0].type_op) {
  22502. renderStartAddOperator(div_to_render, types_included, expression_array, command, function_obj, 0);
  22503. }
  22504. }*/
  22505. var i = 0;
  22506. for (i = 0; i < expression_array.length; i++) {
  22507. if (expression_array[i].type == "var_value") {
  22508. var div_temp = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="single_element_expression" data-index="' + i + '"></div>');
  22509. if (i == 0) {
  22510. if (expression_array.length > 0 && !expression_array[0].type_op) {
  22511. renderStartAddOperator(div_to_render, types_included, expression_array, command, function_obj, 0);
  22512. }
  22513. }
  22514. _variable_value_menu__WEBPACK_IMPORTED_MODULE_6__["renderMenu"](command, expression_array[i], div_temp, function_obj);
  22515. div_to_render.append(div_temp);
  22516. } else if (expression_array[i] == '(' || expression_array[i] == ')') {
  22517. if (expression_array[i] == ')') {
  22518. renderFinalAddElements(div_to_render, types_included, expression_array, command, function_obj, i);
  22519. renderParenthesis(div_to_render, expression_array[i], command, function_obj, i, expression_array);
  22520. } else if (expression_array[i] == '(' && !expression_array[i + 1].type_op) {
  22521. renderParenthesis(div_to_render, expression_array[i], command, function_obj, i, expression_array);
  22522. renderStartAddOperator(div_to_render, types_included, expression_array, command, function_obj, i + 1);
  22523. } else {
  22524. renderParenthesis(div_to_render, expression_array[i], command, function_obj, i, expression_array);
  22525. }
  22526. } else {
  22527. renderOperatorMenu(command, function_obj, div_to_render, expression_array[i], types_included, i, expression_array);
  22528. }
  22529. }
  22530. renderFinalAddElements(div_to_render, types_included, expression_array, command, function_obj, i);
  22531. renderAddParenthesis(command, function_obj, div_to_render, expression_array, types_included);
  22532. }
  22533. window.parentheses_activate = false;
  22534. window.open_or_close = null;
  22535. function renderAddParenthesis(command, function_obj, div_to_render, expression_array, types_included) {
  22536. var addParentheses = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="single_element_expression add_parentheses"><i class="icons"><b style="font-style: normal;">( )</b><i class="corner add icon blue" style="font-size: .6em;right: -3px;bottom: -2px;"></i></i></div>');
  22537. div_to_render.append(addParentheses);
  22538. addParentheses.popup({
  22539. content: "Adicionar parênteses",
  22540. delay: {
  22541. show: 750,
  22542. hide: 0
  22543. }
  22544. });
  22545. addParentheses.on('click', function (mouse_event) {
  22546. // verificar se já está ativado
  22547. if (window.parentheses_activate) {
  22548. return;
  22549. }
  22550. div_to_render.find('.usepointer').off('click');
  22551. window.parentheses_activate = true;
  22552. window.open_or_close = "open";
  22553. div_to_render.find('.dropdown').addClass('disabled');
  22554. div_to_render.find('.ghost_element').addClass('temp_class');
  22555. div_to_render.find('.ghost_element').removeClass('ghost_element');
  22556. var floatingObject = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="floating_parenthesis"> ( </div>');
  22557. floatingObject.draggable().appendTo("body");
  22558. floatingObject.css("position", "absolute");
  22559. mouse_event.type = "mousedown.draggable";
  22560. mouse_event.target = floatingObject[0];
  22561. floatingObject.css("left", mouse_event.pageX + 10);
  22562. floatingObject.css("top", mouse_event.pageY + 10);
  22563. floatingObject.trigger(mouse_event);
  22564. div_to_render.on('mousemove', function (evt) {
  22565. var actual_target = null;
  22566. if (jquery__WEBPACK_IMPORTED_MODULE_0___default()(evt.target).hasClass('single_element_expression')) {
  22567. actual_target = jquery__WEBPACK_IMPORTED_MODULE_0___default()(evt.target);
  22568. } else {
  22569. actual_target = jquery__WEBPACK_IMPORTED_MODULE_0___default()(evt.target).closest('.single_element_expression');
  22570. }
  22571. if (jquery__WEBPACK_IMPORTED_MODULE_0___default()(evt.target).hasClass('temp_class') || actual_target.length < 1 || actual_target.hasClass('add_parentheses') || actual_target.hasClass('rendered_parentheses') || jquery__WEBPACK_IMPORTED_MODULE_0___default()(evt.target).hasClass('expression_elements')) {
  22572. return;
  22573. }
  22574. renderGhostParentheses(actual_target, command, function_obj, div_to_render, expression_array);
  22575. });
  22576. div_to_render.on('mouseleave', function (evt) {
  22577. /*window.open_parentheses.remove();
  22578. window.close_parentheses.remove();*/
  22579. });
  22580. var floating;
  22581. jquery__WEBPACK_IMPORTED_MODULE_0___default()('body').on('mouseup', function (evt) {
  22582. if (window.open_or_close == "open") {
  22583. window.open_or_close = "close";
  22584. floatingObject.remove();
  22585. var comando_que_esta = jquery__WEBPACK_IMPORTED_MODULE_0___default()(evt.target).closest('.command_container');
  22586. var comando_certo = div_to_render.closest('.command_container');
  22587. if (!comando_que_esta.is(comando_certo)) {
  22588. window.parentheses_activate = false;
  22589. div_to_render.find('.temp_class').addClass('ghost_element');
  22590. div_to_render.find('.temp_class').removeClass('temp_class');
  22591. div_to_render.off('mousemove');
  22592. div_to_render.off('mouseleave');
  22593. jquery__WEBPACK_IMPORTED_MODULE_0___default()('body').off('mouseup');
  22594. window.open_parentheses.remove();
  22595. window.close_parentheses.remove();
  22596. window.inserir_open = -1;
  22597. window.inserir_close = -1;
  22598. window.open_or_close = null;
  22599. renderExpression(command, function_obj, div_to_render, expression_array);
  22600. return;
  22601. }
  22602. floating = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="floating_parenthesis"> ) </div>');
  22603. floating.draggable().appendTo("body");
  22604. floating.css("position", "absolute");
  22605. floating.css("left", evt.pageX + 10);
  22606. floating.css("top", evt.pageY + 10);
  22607. jquery__WEBPACK_IMPORTED_MODULE_0___default()('body').on('mousemove', function (evts) {
  22608. floating.css("left", evts.pageX + 10);
  22609. floating.css("top", evts.pageY + 10);
  22610. });
  22611. } else {
  22612. floating.remove();
  22613. div_to_render.off('mousemove');
  22614. div_to_render.off('mouseleave');
  22615. jquery__WEBPACK_IMPORTED_MODULE_0___default()('body').off('mouseup');
  22616. setTimeout(function () {
  22617. window.parentheses_activate = false;
  22618. }, 50);
  22619. var comando_que_esta = jquery__WEBPACK_IMPORTED_MODULE_0___default()(evt.target).closest('.command_container');
  22620. var comando_certo = div_to_render.closest('.command_container');
  22621. var is_correct = false;
  22622. if (comando_que_esta.is(comando_certo)) {
  22623. is_correct = true;
  22624. }
  22625. if (is_correct) {
  22626. expression_array.splice(window.inserir_open, 0, '(');
  22627. expression_array.splice(window.inserir_close, 0, ')');
  22628. }
  22629. window.inserir_open = -1;
  22630. window.inserir_close = -1;
  22631. window.open_or_close = null;
  22632. renderExpression(command, function_obj, div_to_render, expression_array);
  22633. }
  22634. });
  22635. });
  22636. }
  22637. window.open_parentheses = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="parentheses_ghost">(</div>');
  22638. window.close_parentheses = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="parentheses_ghost">)</div>');
  22639. window.inserir_open = -1;
  22640. window.inserir_close = -1;
  22641. function renderGhostParentheses(actual_target, command, function_obj, div_to_render, expression_array) {
  22642. /*window.open_parentheses.remove();
  22643. window.close_parentheses.remove();*/
  22644. var index_in_array = actual_target.data('index');
  22645. if (expression_array[index_in_array] == '(' || expression_array[index_in_array] == ')') {
  22646. return;
  22647. }
  22648. if (window.open_or_close == "close") {
  22649. if (index_in_array < window.inserir_open) {
  22650. return;
  22651. }
  22652. } // Tratando a situação quando é na primeira posição:
  22653. if (index_in_array == 0) {
  22654. if (expression_array[index_in_array].type == "var_value") {
  22655. if (window.open_or_close == "open") {
  22656. window.open_parentheses.insertBefore(actual_target);
  22657. window.inserir_open = index_in_array;
  22658. }
  22659. /*if (expression_array.length == 1) {
  22660. if (window.open_or_close == "close") {
  22661. window.close_parentheses.insertAfter(actual_target);
  22662. window.inserir_close = index_in_array + 2;
  22663. }*/
  22664. //} else {
  22665. var count_opened = 0;
  22666. var count_closed = 0;
  22667. for (var i = 0; i < expression_array.length; i++) {
  22668. if (expression_array[i] == '(') {
  22669. count_opened++;
  22670. }
  22671. if (expression_array[i] == ')') {
  22672. count_closed++;
  22673. }
  22674. if (count_opened != count_closed) {} else {
  22675. if (count_opened > 0) {
  22676. if (window.open_or_close == "close") {
  22677. window.close_parentheses.insertAfter(div_to_render.find('.single_element_expression[data-index="' + i + '"]'));
  22678. window.inserir_close = i + 2;
  22679. }
  22680. break;
  22681. } else {
  22682. if (expression_array[i].type == "var_value") {
  22683. if (window.open_or_close == "close") {
  22684. window.close_parentheses.insertAfter(div_to_render.find('.single_element_expression[data-index="' + i + '"]'));
  22685. window.inserir_close = i + 2;
  22686. }
  22687. break;
  22688. }
  22689. }
  22690. }
  22691. } //}
  22692. } else if (expression_array[index_in_array].type_op) {
  22693. if (window.open_or_close == "open") {
  22694. window.open_parentheses.insertBefore(actual_target);
  22695. window.inserir_open = index_in_array;
  22696. }
  22697. var count_opened = 0;
  22698. var count_closed = 0;
  22699. for (var i = 1; i < expression_array.length; i++) {
  22700. // $('.slide-link[data-slide="0"]')
  22701. if (expression_array[i] == '(') {
  22702. count_opened++;
  22703. }
  22704. if (expression_array[i] == ')') {
  22705. count_closed++;
  22706. }
  22707. if (count_opened != count_closed) {} else {
  22708. if (count_opened > 0) {
  22709. if (expression_array[i].type == "var_value") {
  22710. window.close_parentheses.insertAfter(div_to_render.find('.single_element_expression[data-index="' + i + '"]'));
  22711. window.inserir_close = i + 2;
  22712. }
  22713. break;
  22714. } else {
  22715. if (expression_array[i].type == "var_value") {
  22716. if (expression_array[i].type == "var_value") {
  22717. window.close_parentheses.insertAfter(div_to_render.find('.single_element_expression[data-index="' + i + '"]'));
  22718. window.inserir_close = i + 2;
  22719. }
  22720. break;
  22721. }
  22722. }
  22723. }
  22724. }
  22725. }
  22726. return;
  22727. } // Tratando quando não é no índice 0:
  22728. if (expression_array[index_in_array].type == "var_value") {
  22729. if (window.open_or_close == "open") {
  22730. window.open_parentheses.insertBefore(actual_target);
  22731. window.inserir_open = index_in_array;
  22732. }
  22733. if (window.open_or_close == "close") {
  22734. window.close_parentheses.insertAfter(actual_target);
  22735. window.inserir_close = index_in_array + 2;
  22736. }
  22737. return;
  22738. }
  22739. if (expression_array[index_in_array].type_op) {
  22740. // buscar para a esquerda primeiro:
  22741. if (expression_array[index_in_array - 1] == '(') {
  22742. if (window.open_or_close == "open") {
  22743. window.open_parentheses.insertBefore(actual_target);
  22744. window.inserir_open = index_in_array;
  22745. }
  22746. } else if (expression_array[index_in_array - 1] == ')') {
  22747. // buscar a abertura
  22748. var count_opened = 0;
  22749. var count_closed = 0;
  22750. for (var j = index_in_array - 1; j >= 0; j--) {
  22751. if (expression_array[j] == '(') {
  22752. count_opened++;
  22753. }
  22754. if (expression_array[j] == ')') {
  22755. count_closed++;
  22756. }
  22757. if (count_opened != count_closed) {} else {
  22758. if (count_closed > 0) {
  22759. if (window.open_or_close == "open") {
  22760. window.open_parentheses.insertBefore(div_to_render.find('.single_element_expression[data-index="' + j + '"]'));
  22761. window.inserir_open = j;
  22762. }
  22763. break;
  22764. }
  22765. }
  22766. }
  22767. } else if (expression_array[index_in_array - 1].type == "var_value") {
  22768. if (window.open_or_close == "open") {
  22769. window.open_parentheses.insertBefore(div_to_render.find('.single_element_expression[data-index="' + (index_in_array - 1) + '"]'));
  22770. window.inserir_open = index_in_array - 1;
  22771. }
  22772. } // buscar para a direita agora:
  22773. if (expression_array[index_in_array + 1] == '(') {
  22774. // buscar o fechamento:
  22775. var count_opened = 0;
  22776. var count_closed = 0;
  22777. for (var j = index_in_array + 1; j < expression_array.length; j++) {
  22778. if (expression_array[j] == '(') {
  22779. count_opened++;
  22780. }
  22781. if (expression_array[j] == ')') {
  22782. count_closed++;
  22783. }
  22784. if (count_opened != count_closed) {} else {
  22785. if (count_opened > 0) {
  22786. if (window.open_or_close == "close") {
  22787. window.close_parentheses.insertAfter(div_to_render.find('.single_element_expression[data-index="' + j + '"]'));
  22788. window.inserir_close = j + 2;
  22789. }
  22790. break;
  22791. }
  22792. }
  22793. }
  22794. } else if (expression_array[index_in_array + 1].type == "var_value") {
  22795. if (window.open_or_close == "close") {
  22796. window.close_parentheses.insertAfter(div_to_render.find('.single_element_expression[data-index="' + (index_in_array + 1) + '"]'));
  22797. window.inserir_close = index_in_array + 3;
  22798. }
  22799. }
  22800. }
  22801. }
  22802. function renderParenthesis(div_to_render, expression_content, command, function_obj, position, expression_array) {
  22803. var ghost_parenthesis = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="single_element_expression" data-index="' + position + '">' + expression_content + '</div>');
  22804. div_to_render.append(ghost_parenthesis);
  22805. }
  22806. function renderStartAddOperator(div_to_render, types_included, expression_array, command, function_obj, position) {
  22807. var menu_final = '<div class="ui dropdown disabled usepointer"><div class="text"> + </div><i class="dropdown icon"></i><div class="menu">';
  22808. if (types_included.indexOf(_ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_arithmetic) >= 0) {
  22809. if (types_included.length > 1) {
  22810. menu_final += '<div class="item"><i class="dropdown icon"></i>Aritméticos<div class="menu">';
  22811. menu_final += getArithmeticOperators();
  22812. menu_final += '</div></div>';
  22813. } else {
  22814. menu_final += getArithmeticOperators();
  22815. }
  22816. }
  22817. if (types_included.indexOf(_ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_logic) >= 0) {
  22818. if (types_included.length > 1) {
  22819. menu_final += '<div class="item"><i class="dropdown icon"></i>Lógicos<div class="menu">';
  22820. menu_final += getLogicOperators();
  22821. menu_final += '</div></div>';
  22822. } else {
  22823. menu_final += getLogicOperators();
  22824. }
  22825. }
  22826. if (types_included.indexOf(_ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_conditional) >= 0) {
  22827. if (types_included.length > 1) {
  22828. menu_final += '<div class="item"><i class="dropdown icon"></i>Relacionais<div class="menu">';
  22829. menu_final += getRelationalOperators();
  22830. menu_final += '</div></div>';
  22831. } else {
  22832. menu_final += getRelationalOperators();
  22833. }
  22834. }
  22835. menu_final += '</div></div>';
  22836. menu_final = jquery__WEBPACK_IMPORTED_MODULE_0___default()(menu_final);
  22837. var div_temp = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="single_element_expression ghost_element mouse_distance"></div>');
  22838. div_temp.append(menu_final);
  22839. var div_higher = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="higher_element"></div>');
  22840. div_higher.append(div_temp);
  22841. div_to_render.append(div_higher);
  22842. menu_final.dropdown('set selected', _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].minus);
  22843. div_temp.on('click', function () {
  22844. var sera = position;
  22845. if (types_included.indexOf(_ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_arithmetic) >= 0) {
  22846. console.log('p1');
  22847. expression_array.splice(sera, 0, new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ExpressionOperator"](_ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_arithmetic, _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].minus));
  22848. } else if (types_included.indexOf(_ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_logic) >= 0) {
  22849. console.log('p2');
  22850. expression_array.splice(sera, 0, new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ExpressionOperator"](_ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_logic, _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["LOGIC_COMPARISON"].equals_to));
  22851. } else if (types_included.indexOf(_ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_conditional) >= 0) {
  22852. console.log('p3');
  22853. expression_array.splice(sera, 0, new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ExpressionOperator"](_ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_conditional, _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_COMPARISON"].greater_than));
  22854. }
  22855. renderExpression(command, function_obj, div_to_render, expression_array);
  22856. });
  22857. }
  22858. function renderFinalAddElements(div_to_render, types_included, expression_array, command, function_obj, position) {
  22859. var menu_final = '<div class="ui dropdown disabled usepointer"><div class="text"> + </div><i class="dropdown icon"></i><div class="menu">';
  22860. if (types_included.indexOf(_ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_arithmetic) >= 0) {
  22861. if (types_included.length > 1) {
  22862. menu_final += '<div class="item"><i class="dropdown icon"></i>Aritméticos<div class="menu">';
  22863. menu_final += getArithmeticOperators();
  22864. menu_final += '</div></div>';
  22865. } else {
  22866. menu_final += getArithmeticOperators();
  22867. }
  22868. }
  22869. if (types_included.indexOf(_ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_logic) >= 0) {
  22870. if (types_included.length > 1) {
  22871. menu_final += '<div class="item"><i class="dropdown icon"></i>Lógicos<div class="menu">';
  22872. menu_final += getLogicOperators();
  22873. menu_final += '</div></div>';
  22874. } else {
  22875. menu_final += getLogicOperators();
  22876. }
  22877. }
  22878. if (types_included.indexOf(_ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_conditional) >= 0) {
  22879. if (types_included.length > 1) {
  22880. menu_final += '<div class="item"><i class="dropdown icon"></i>Relacionais<div class="menu">';
  22881. menu_final += getRelationalOperators();
  22882. menu_final += '</div></div>';
  22883. } else {
  22884. menu_final += getRelationalOperators();
  22885. }
  22886. }
  22887. menu_final += '</div></div>';
  22888. menu_final = jquery__WEBPACK_IMPORTED_MODULE_0___default()(menu_final);
  22889. var div_temp = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="single_element_expression ghost_element mouse_distance"></div>');
  22890. var div_higher = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="higher_element"></div>');
  22891. div_higher.append(div_temp);
  22892. div_to_render.append(div_higher);
  22893. div_temp.append(menu_final); //div_to_render.append(div_temp);
  22894. menu_final.dropdown('set selected', _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].plus);
  22895. div_temp.on('click', function () {
  22896. var sera = position;
  22897. if (types_included.indexOf(_ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_arithmetic) >= 0) {
  22898. expression_array.splice(sera, 0, new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ExpressionOperator"](_ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_arithmetic, _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].plus));
  22899. } else if (types_included.indexOf(_ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_logic) >= 0) {
  22900. expression_array.splice(sera, 0, new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ExpressionOperator"](_ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_logic, _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["LOGIC_COMPARISON"].equals_to));
  22901. } else if (types_included.indexOf(_ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_conditional) >= 0) {
  22902. expression_array.splice(sera, 0, new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ExpressionOperator"](_ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_conditional, _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_COMPARISON"].greater_than));
  22903. }
  22904. expression_array.splice(sera + 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));
  22905. renderExpression(command, function_obj, div_to_render, expression_array);
  22906. });
  22907. }
  22908. function renderOperatorMenu(command, function_obj, div_to_render, expression_element, types_included, position, expression_array) {
  22909. var menu_final = '<div class="ui dropdown"><div class="text"> + </div><i class="dropdown icon"></i><div class="menu">';
  22910. if (types_included.indexOf(_ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_arithmetic) >= 0) {
  22911. if (types_included.length > 1) {
  22912. menu_final += '<div class="item"><i class="dropdown icon"></i>Aritméticos<div class="menu">';
  22913. menu_final += getArithmeticOperators();
  22914. menu_final += '</div></div>';
  22915. } else {
  22916. menu_final += getArithmeticOperators();
  22917. }
  22918. }
  22919. if (types_included.indexOf(_ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_logic) >= 0) {
  22920. if (types_included.length > 1) {
  22921. menu_final += '<div class="item"><i class="dropdown icon"></i>Lógicos<div class="menu">';
  22922. menu_final += getLogicOperators();
  22923. menu_final += '</div></div>';
  22924. } else {
  22925. menu_final += getLogicOperators();
  22926. }
  22927. }
  22928. if (types_included.indexOf(_ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_conditional) >= 0) {
  22929. if (types_included.length > 1) {
  22930. menu_final += '<div class="item"><i class="dropdown icon"></i>Relacionais<div class="menu">';
  22931. menu_final += getRelationalOperators();
  22932. menu_final += '</div></div>';
  22933. } else {
  22934. menu_final += getRelationalOperators();
  22935. }
  22936. }
  22937. menu_final += '</div></div>';
  22938. menu_final = jquery__WEBPACK_IMPORTED_MODULE_0___default()(menu_final);
  22939. var div_temp = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="single_element_expression" data-index="' + position + '"></div>');
  22940. div_temp.append(menu_final);
  22941. div_to_render.append(div_temp);
  22942. menu_final.dropdown({
  22943. onChange: function onChange(value, text, $selectedItem) {
  22944. expression_element.item = $selectedItem.data('value');
  22945. expression_element.type_op = $selectedItem.data('type');
  22946. }
  22947. });
  22948. menu_final.dropdown('set selected', expression_element.item);
  22949. }
  22950. function getArithmeticOperators() {
  22951. var arithmetic_operators;
  22952. arithmetic_operators = '<div class="item" data-type="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_arithmetic + '" data-value="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].plus + '">+</div>';
  22953. arithmetic_operators += '<div class="item" data-type="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_arithmetic + '" data-value="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].minus + '">-</div>';
  22954. arithmetic_operators += '<div class="item" data-type="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_arithmetic + '" data-value="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].multiplication + '">*</div>';
  22955. arithmetic_operators += '<div class="item" data-type="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_arithmetic + '" data-value="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].division + '">/</div>';
  22956. arithmetic_operators += '<div class="item" data-type="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_arithmetic + '" data-value="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].module + '">%</div>';
  22957. return arithmetic_operators;
  22958. }
  22959. function getLogicOperators() {
  22960. var logic_operators;
  22961. logic_operators = '<div class="item" data-type="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_logic + '" data-value="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["LOGIC_COMPARISON"].equals_to + '">==</div>';
  22962. logic_operators += '<div class="item" data-type="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_logic + '" data-value="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["LOGIC_COMPARISON"].not_equals_to + '">!=</div>';
  22963. logic_operators += '<div class="item" data-type="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_logic + '" data-value="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["LOGIC_COMPARISON"].and + '">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('and') + '</div>';
  22964. logic_operators += '<div class="item" data-type="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_logic + '" data-value="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["LOGIC_COMPARISON"].or + '">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('or') + '</div>';
  22965. logic_operators += '<div class="item" data-type="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_logic + '" data-value="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["LOGIC_COMPARISON"].not + '">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('not') + '</div>';
  22966. return logic_operators;
  22967. }
  22968. function getRelationalOperators() {
  22969. var relational_operators;
  22970. relational_operators = '<div class="item" data-type="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_conditional + '" data-value="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_COMPARISON"].greater_than + '">></div>';
  22971. relational_operators += '<div class="item" data-type="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_conditional + '" data-value="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_COMPARISON"].less_than + '"><</div>';
  22972. relational_operators += '<div class="item" data-type="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_conditional + '" data-value="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_COMPARISON"].equals_to + '">==</div>';
  22973. relational_operators += '<div class="item" data-type="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_conditional + '" data-value="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_COMPARISON"].not_equals_to + '">!=</div>';
  22974. relational_operators += '<div class="item" data-type="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_conditional + '" data-value="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_COMPARISON"].greater_than_or_equals_to + '">>=</div>';
  22975. relational_operators += '<div class="item" data-type="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_conditional + '" data-value="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_COMPARISON"].less_than_or_equals_to + '"><=</div>';
  22976. return relational_operators;
  22977. }
  22978. /***/ }),
  22979. /***/ "./js/visualUI/commands/iftrue.js":
  22980. /*!****************************************!*\
  22981. !*** ./js/visualUI/commands/iftrue.js ***!
  22982. \****************************************/
  22983. /*! exports provided: createFloatingCommand, renderCommand */
  22984. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  22985. "use strict";
  22986. __webpack_require__.r(__webpack_exports__);
  22987. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createFloatingCommand", function() { return createFloatingCommand; });
  22988. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "renderCommand", function() { return renderCommand; });
  22989. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  22990. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_0__);
  22991. /* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  22992. /* harmony import */ var _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  22993. /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  22994. /* harmony import */ var _globals__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../globals */ "./js/visualUI/globals.js");
  22995. /* harmony import */ var _variables__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../variables */ "./js/visualUI/variables.js");
  22996. /* harmony import */ var _commands__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  22997. /* harmony import */ var _conditional_expression__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./conditional_expression */ "./js/visualUI/commands/conditional_expression.js");
  22998. function createFloatingCommand() {
  22999. 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>');
  23000. }
  23001. function renderCommand(command, function_obj) {
  23002. var ret = '';
  23003. 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>';
  23004. ret += '<span class="span_command_spec"> ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_if') + '</span>';
  23005. ret += ' <span class="span_command_spec"> ( </span> <div class="conditional_expression"></div> <span class="span_command_spec"> ) </span>';
  23006. ret += '<span> </span> ';
  23007. ret += '<div class="ui block_commands commands_if conditional_comands_block" data-if="true">';
  23008. ret += '</div></div>';
  23009. 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>';
  23010. ret += '<div class="ui block_commands commands_else conditional_comands_block" data-else="true">';
  23011. ret += '</div>';
  23012. ret += '<span></span></div>';
  23013. ret += '</div>';
  23014. var el = jquery__WEBPACK_IMPORTED_MODULE_0___default()(ret);
  23015. el.data('command', command);
  23016. el.find('.block_commands').data('command', command);
  23017. el.find('.data_block_if').data('command', command);
  23018. el.find('.data_block_else').data('command', command);
  23019. el.find('.commands_if').data('command', command);
  23020. addHandlers(command, function_obj, el);
  23021. _conditional_expression__WEBPACK_IMPORTED_MODULE_7__["renderExpression"](command, command.expression, function_obj, el.find('.conditional_expression'));
  23022. if (command.commands_block) {
  23023. for (var j = 0; j < command.commands_block.length; j++) {
  23024. _commands__WEBPACK_IMPORTED_MODULE_6__["renderCommand"](command.commands_block[j], jquery__WEBPACK_IMPORTED_MODULE_0___default()(el.find('.commands_if')[0]), 3, function_obj);
  23025. }
  23026. }
  23027. if (command.commands_else) {
  23028. for (var j = 0; j < command.commands_else.length; j++) {
  23029. _commands__WEBPACK_IMPORTED_MODULE_6__["renderCommand"](command.commands_else[j], jquery__WEBPACK_IMPORTED_MODULE_0___default()(el.find('.commands_else')[0]), 3, function_obj);
  23030. }
  23031. }
  23032. return el;
  23033. }
  23034. function addHandlers(command, function_obj, iftrue_dom) {
  23035. iftrue_dom.find('.button_remove_command').on('click', function () {
  23036. if (_commands__WEBPACK_IMPORTED_MODULE_6__["removeCommand"](command, function_obj, iftrue_dom)) {
  23037. iftrue_dom.fadeOut(400, function () {
  23038. iftrue_dom.remove();
  23039. });
  23040. }
  23041. });
  23042. }
  23043. /***/ }),
  23044. /***/ "./js/visualUI/commands/reader.js":
  23045. /*!****************************************!*\
  23046. !*** ./js/visualUI/commands/reader.js ***!
  23047. \****************************************/
  23048. /*! exports provided: createFloatingCommand, renderCommand */
  23049. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  23050. "use strict";
  23051. __webpack_require__.r(__webpack_exports__);
  23052. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createFloatingCommand", function() { return createFloatingCommand; });
  23053. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "renderCommand", function() { return renderCommand; });
  23054. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  23055. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_0__);
  23056. /* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  23057. /* harmony import */ var _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  23058. /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  23059. /* harmony import */ var _globals__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../globals */ "./js/visualUI/globals.js");
  23060. /* harmony import */ var _variables__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../variables */ "./js/visualUI/variables.js");
  23061. /* harmony import */ var _variable_value_menu__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  23062. /* harmony import */ var _commands__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  23063. function createFloatingCommand() {
  23064. 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>');
  23065. }
  23066. function renderCommand(command, function_obj) {
  23067. 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>';
  23068. el = jquery__WEBPACK_IMPORTED_MODULE_0___default()(el);
  23069. el.data('command', command);
  23070. _variable_value_menu__WEBPACK_IMPORTED_MODULE_6__["renderMenu"](command, command.variable_value_menu, el.find('.var_value_menu_div'), function_obj);
  23071. addHandlers(command, function_obj, el);
  23072. return el;
  23073. }
  23074. function addHandlers(command, function_obj, reader_dom) {
  23075. reader_dom.find('.button_remove_command').on('click', function () {
  23076. if (_commands__WEBPACK_IMPORTED_MODULE_7__["removeCommand"](command, function_obj, reader_dom)) {
  23077. reader_dom.fadeOut(400, function () {
  23078. reader_dom.remove();
  23079. });
  23080. }
  23081. });
  23082. }
  23083. /***/ }),
  23084. /***/ "./js/visualUI/commands/repeatNtimes.js":
  23085. /*!**********************************************!*\
  23086. !*** ./js/visualUI/commands/repeatNtimes.js ***!
  23087. \**********************************************/
  23088. /*! exports provided: createFloatingCommand, renderCommand, manageExpressionElements, manageClearExpressionElements */
  23089. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  23090. "use strict";
  23091. __webpack_require__.r(__webpack_exports__);
  23092. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createFloatingCommand", function() { return createFloatingCommand; });
  23093. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "renderCommand", function() { return renderCommand; });
  23094. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "manageExpressionElements", function() { return manageExpressionElements; });
  23095. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "manageClearExpressionElements", function() { return manageClearExpressionElements; });
  23096. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  23097. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_0__);
  23098. /* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  23099. /* harmony import */ var _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  23100. /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  23101. /* harmony import */ var _globals__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../globals */ "./js/visualUI/globals.js");
  23102. /* harmony import */ var _variables__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../variables */ "./js/visualUI/variables.js");
  23103. /* harmony import */ var _commands__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  23104. /* harmony import */ var _conditional_expression__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./conditional_expression */ "./js/visualUI/commands/conditional_expression.js");
  23105. /* harmony import */ var _variable_value_menu__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  23106. /* harmony import */ var _contextualized_menu__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./contextualized_menu */ "./js/visualUI/commands/contextualized_menu.js");
  23107. function createFloatingCommand() {
  23108. 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>');
  23109. }
  23110. function renderCommand(command, function_obj) {
  23111. 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>';
  23112. ret += '<div class="ui block_commands">';
  23113. ret += '</div>';
  23114. ret += '<span> </span>';
  23115. ret += '</div>';
  23116. var el = jquery__WEBPACK_IMPORTED_MODULE_0___default()(ret);
  23117. el.data('command', command);
  23118. el.find('.block_commands').data('command', command);
  23119. addHandlers(command, function_obj, el);
  23120. _contextualized_menu__WEBPACK_IMPORTED_MODULE_9__["renderMenu"](command, el.find('.context_menu'), function_obj, el);
  23121. _variable_value_menu__WEBPACK_IMPORTED_MODULE_8__["renderMenu"](command, command.var_attribution, el.find('.variable_attribution'), function_obj);
  23122. _conditional_expression__WEBPACK_IMPORTED_MODULE_7__["renderExpression"](command, command.expression2, function_obj, el.find('.conditional_expression'));
  23123. _variable_value_menu__WEBPACK_IMPORTED_MODULE_8__["renderMenu"](command, command.var_incrementation, el.find('.incrementation_variable'), function_obj);
  23124. if (command.expression1) {
  23125. el.find('.text_receives').text(_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_receives'));
  23126. _variable_value_menu__WEBPACK_IMPORTED_MODULE_8__["renderMenu"](command, command.expression1, el.find('.var_value_expression'), function_obj);
  23127. }
  23128. if (command.expression3) {
  23129. el.find('.text_inc_receives').text(_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_receives'));
  23130. _variable_value_menu__WEBPACK_IMPORTED_MODULE_8__["renderMenu"](command, command.expression3.itens[0], el.find('.first_operand'), function_obj);
  23131. renderOperator(command, function_obj, el.find('.operator'), command.expression3, 1);
  23132. _variable_value_menu__WEBPACK_IMPORTED_MODULE_8__["renderMenu"](command, command.expression3.itens[2], el.find('.second_operand'), function_obj);
  23133. }
  23134. if (command.commands_block) {
  23135. for (var j = 0; j < command.commands_block.length; j++) {
  23136. _commands__WEBPACK_IMPORTED_MODULE_6__["renderCommand"](command.commands_block[j], jquery__WEBPACK_IMPORTED_MODULE_0___default()(el.find('.block_commands')[0]), 3, function_obj);
  23137. }
  23138. }
  23139. return el;
  23140. }
  23141. function manageExpressionElements(command, ref_object, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element) {
  23142. if (dom_object.hasClass('variable_attribution')) {
  23143. if (!command.expression3) {
  23144. 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)]);
  23145. command.expression3 = exp;
  23146. command.var_incrementation = command.var_attribution;
  23147. 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);
  23148. command.expression2.expression = cond_exp;
  23149. }
  23150. dom_object.parent().find('.text_receives').text(_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_receives'));
  23151. 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);
  23152. dom_object.parent().find('.var_value_expression').empty();
  23153. _variable_value_menu__WEBPACK_IMPORTED_MODULE_8__["renderMenu"](command, command.expression1, dom_object.parent().find('.var_value_expression'), function_obj);
  23154. renderAlgorithm();
  23155. }
  23156. if (dom_object.hasClass('incrementation_variable')) {
  23157. dom_object.parent().find('.text_inc_receives').text(_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_receives'));
  23158. 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)]);
  23159. command.expression3 = exp;
  23160. _variable_value_menu__WEBPACK_IMPORTED_MODULE_8__["renderMenu"](command, command.expression3.itens[0], dom_object.parent().find('.first_operand'), function_obj);
  23161. renderOperator(command, function_obj, dom_object.parent().find('.operator'), command.expression3, 1);
  23162. _variable_value_menu__WEBPACK_IMPORTED_MODULE_8__["renderMenu"](command, command.expression3.itens[2], dom_object.parent().find('.second_operand'), function_obj);
  23163. }
  23164. }
  23165. function manageClearExpressionElements(command, ref_object, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element) {
  23166. if (dom_object.hasClass('variable_attribution')) {
  23167. jquery__WEBPACK_IMPORTED_MODULE_0___default()(dom_object).parent().find('.text_receives').text('');
  23168. command.expression1 = null;
  23169. jquery__WEBPACK_IMPORTED_MODULE_0___default()(dom_object).parent().find('.var_value_expression').empty();
  23170. }
  23171. if (dom_object.hasClass('incrementation_variable')) {
  23172. jquery__WEBPACK_IMPORTED_MODULE_0___default()(dom_object).parent().find('.text_inc_receives').text('');
  23173. command.expression3 = null;
  23174. jquery__WEBPACK_IMPORTED_MODULE_0___default()(dom_object).parent().find('.first_operand').empty();
  23175. jquery__WEBPACK_IMPORTED_MODULE_0___default()(dom_object).parent().find('.operator').empty();
  23176. jquery__WEBPACK_IMPORTED_MODULE_0___default()(dom_object).parent().find('.second_operand').empty();
  23177. }
  23178. }
  23179. function addHandlers(command, function_obj, repeatNtimes_dom) {
  23180. repeatNtimes_dom.find('.button_remove_command').on('click', function () {
  23181. if (_commands__WEBPACK_IMPORTED_MODULE_6__["removeCommand"](command, function_obj, repeatNtimes_dom)) {
  23182. repeatNtimes_dom.fadeOut(400, function () {
  23183. repeatNtimes_dom.remove();
  23184. });
  23185. }
  23186. });
  23187. }
  23188. function renderOperator(command, function_obj, temp_op, expression_element, index_op) {
  23189. var menu_operator = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="ui dropdown"><div class="text"></div></div>');
  23190. menu_operator.dropdown({
  23191. values: [{
  23192. name: '+',
  23193. value: _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].plus,
  23194. selected: expression_element.itens[index_op] == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].plus
  23195. }, {
  23196. name: '-',
  23197. value: _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].minus,
  23198. selected: expression_element.itens[index_op] == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].minus
  23199. }, {
  23200. name: '*',
  23201. value: _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].multiplication,
  23202. selected: expression_element.itens[index_op] == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].multiplication
  23203. }, {
  23204. name: '/',
  23205. value: _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].division,
  23206. selected: expression_element.itens[index_op] == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].division
  23207. }, {
  23208. name: '%',
  23209. value: _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].module,
  23210. selected: expression_element.itens[index_op] == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].module
  23211. }],
  23212. onChange: function onChange(value, text, $selectedItem) {
  23213. expression_element.itens[index_op] = value;
  23214. }
  23215. });
  23216. temp_op.append(menu_operator);
  23217. }
  23218. /***/ }),
  23219. /***/ "./js/visualUI/commands/return.js":
  23220. /*!****************************************!*\
  23221. !*** ./js/visualUI/commands/return.js ***!
  23222. \****************************************/
  23223. /*! exports provided: createFloatingCommand, renderCommand */
  23224. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  23225. "use strict";
  23226. __webpack_require__.r(__webpack_exports__);
  23227. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createFloatingCommand", function() { return createFloatingCommand; });
  23228. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "renderCommand", function() { return renderCommand; });
  23229. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  23230. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_0__);
  23231. /* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  23232. /* harmony import */ var _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  23233. /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  23234. /* harmony import */ var _globals__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../globals */ "./js/visualUI/globals.js");
  23235. /* harmony import */ var _variables__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../variables */ "./js/visualUI/variables.js");
  23236. /* harmony import */ var _variable_value_menu__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  23237. /* harmony import */ var _commands__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  23238. function createFloatingCommand() {
  23239. 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>');
  23240. }
  23241. function renderCommand(command, function_obj) {
  23242. 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>');
  23243. el.data('command', command);
  23244. addHandlers(command, function_obj, el);
  23245. if (function_obj.return_type != _types__WEBPACK_IMPORTED_MODULE_1__["Types"].VOID) {
  23246. _variable_value_menu__WEBPACK_IMPORTED_MODULE_6__["renderMenu"](command, command.variable_value_menu, el.find('.var_value_menu_div'), function_obj);
  23247. } else {
  23248. el.find('.var_value_menu_div').remove();
  23249. command.variable_value_menu = null;
  23250. }
  23251. return el;
  23252. }
  23253. function addHandlers(command, function_obj, return_dom) {
  23254. return_dom.find('.button_remove_command').on('click', function () {
  23255. if (_commands__WEBPACK_IMPORTED_MODULE_7__["removeCommand"](command, function_obj, return_dom)) {
  23256. return_dom.fadeOut(400, function () {
  23257. return_dom.remove();
  23258. });
  23259. }
  23260. });
  23261. }
  23262. /***/ }),
  23263. /***/ "./js/visualUI/commands/switch.js":
  23264. /*!****************************************!*\
  23265. !*** ./js/visualUI/commands/switch.js ***!
  23266. \****************************************/
  23267. /*! exports provided: createFloatingCommand, renderCommand, renderCase */
  23268. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  23269. "use strict";
  23270. __webpack_require__.r(__webpack_exports__);
  23271. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createFloatingCommand", function() { return createFloatingCommand; });
  23272. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "renderCommand", function() { return renderCommand; });
  23273. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "renderCase", function() { return renderCase; });
  23274. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  23275. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_0__);
  23276. /* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  23277. /* harmony import */ var _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  23278. /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  23279. /* harmony import */ var _globals__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../globals */ "./js/visualUI/globals.js");
  23280. /* harmony import */ var _variables__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../variables */ "./js/visualUI/variables.js");
  23281. /* harmony import */ var _commands__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  23282. /* harmony import */ var _variable_value_menu__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  23283. /* harmony import */ var _contextualized_menu__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./contextualized_menu */ "./js/visualUI/commands/contextualized_menu.js");
  23284. function createFloatingCommand() {
  23285. 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>');
  23286. }
  23287. function renderCommand(command, function_obj) {
  23288. var ret = '';
  23289. 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>';
  23290. ret += '</div>';
  23291. var el = jquery__WEBPACK_IMPORTED_MODULE_0___default()(ret);
  23292. el.data('command', command);
  23293. addHandlers(command, function_obj, el);
  23294. _contextualized_menu__WEBPACK_IMPORTED_MODULE_8__["renderMenu"](command, el.find('.context_menu'), function_obj, el);
  23295. _variable_value_menu__WEBPACK_IMPORTED_MODULE_7__["renderMenu"](command, command.variable, el.find('.variable_to_switch'), function_obj);
  23296. if (command.cases) {
  23297. for (var i = 0; i < command.cases.length; i++) {
  23298. renderCase(command.cases[i], command, function_obj, el.find('.all_cases_div'));
  23299. }
  23300. }
  23301. return el;
  23302. }
  23303. function renderCase(switchcase, command, function_obj, el) {
  23304. 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>');
  23305. _variable_value_menu__WEBPACK_IMPORTED_MODULE_7__["renderMenu"](command, switchcase.variable_value_menu, casediv.find('.variable_case'), function_obj);
  23306. casediv.data('switchcase', switchcase);
  23307. casediv.find('.case_commands_block').data('switchcase', switchcase);
  23308. el.append(casediv);
  23309. if (switchcase.commands_block) {
  23310. for (var j = 0; j < switchcase.commands_block.length; j++) {
  23311. _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);
  23312. }
  23313. }
  23314. casediv.find('.button_remove_command').on('click', function () {
  23315. for (var i = 0; i < command.cases.length; i++) {
  23316. if (switchcase == command.cases[i]) {
  23317. delete command.cases[i];
  23318. command.cases.splice(i, 1);
  23319. casediv.remove();
  23320. break;
  23321. }
  23322. }
  23323. });
  23324. }
  23325. function addHandlers(command, function_obj, switch_dom) {
  23326. switch_dom.find('.button_remove_command').on('click', function () {
  23327. if (_commands__WEBPACK_IMPORTED_MODULE_6__["removeCommand"](command, function_obj, switch_dom)) {
  23328. switch_dom.fadeOut(400, function () {
  23329. switch_dom.remove();
  23330. });
  23331. }
  23332. });
  23333. }
  23334. /***/ }),
  23335. /***/ "./js/visualUI/commands/variable_value_menu.js":
  23336. /*!*****************************************************!*\
  23337. !*** ./js/visualUI/commands/variable_value_menu.js ***!
  23338. \*****************************************************/
  23339. /*! exports provided: VAR_OR_VALUE_TYPES, renderMenu */
  23340. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  23341. "use strict";
  23342. __webpack_require__.r(__webpack_exports__);
  23343. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "VAR_OR_VALUE_TYPES", function() { return VAR_OR_VALUE_TYPES; });
  23344. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "renderMenu", function() { return renderMenu; });
  23345. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  23346. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_0__);
  23347. /* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  23348. /* harmony import */ var _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  23349. /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  23350. /* harmony import */ var _globals__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../globals */ "./js/visualUI/globals.js");
  23351. /* harmony import */ var _variables__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../variables */ "./js/visualUI/variables.js");
  23352. /* harmony import */ var _attribution__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./attribution */ "./js/visualUI/commands/attribution.js");
  23353. /* harmony import */ var _writer__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./writer */ "./js/visualUI/commands/writer.js");
  23354. /* harmony import */ var _repeatNtimes__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./repeatNtimes */ "./js/visualUI/commands/repeatNtimes.js");
  23355. var VAR_OR_VALUE_TYPES = Object.freeze({
  23356. only_variable: 1,
  23357. only_value: 2,
  23358. only_function: 3,
  23359. variable_and_function: 4,
  23360. variable_and_value_opt: 5,
  23361. value_and_function: 6,
  23362. all: 7
  23363. });
  23364. function renderMenu(command, ref_object, dom_object, function_obj) {
  23365. var size_field = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 2;
  23366. var expression_element = arguments.length > 5 ? arguments[5] : undefined;
  23367. // Verificar se o objeto atual trata-se de uma chamada de função e conferir se possui a quantidade correta de parâmetros
  23368. // Caso não possua, tem que adicionar as variáveis que servirão de parâmetros:
  23369. if (ref_object.function_called) {
  23370. if (ref_object.function_called.parameters_list) {
  23371. while (ref_object.function_called.parameters_list.length != ref_object.parameters_list.length) {
  23372. if (ref_object.parameters_list.length > ref_object.function_called.parameters_list.length) {
  23373. ref_object.parameters_list.pop();
  23374. } else {
  23375. ref_object.parameters_list.push(new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](VAR_OR_VALUE_TYPES.all, null, null, null, true));
  23376. }
  23377. }
  23378. }
  23379. }
  23380. 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">';
  23381. if (ref_object.variable_and_value == VAR_OR_VALUE_TYPES.only_variable) {
  23382. 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">';
  23383. menu_var_or_value += '</div>';
  23384. }
  23385. 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) {
  23386. 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');
  23387. menu_var_or_value += '<div class="menu menu_only_vars">';
  23388. menu_var_or_value += '</div></div>';
  23389. }
  23390. if (ref_object.variable_and_value == VAR_OR_VALUE_TYPES.only_value) {
  23391. menu_var_or_value = '<input type="text" class="width-dynamic" size="' + size_field + '" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" />';
  23392. }
  23393. 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) {
  23394. 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>';
  23395. }
  23396. if (ref_object.variable_and_value == VAR_OR_VALUE_TYPES.only_function) {
  23397. 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">';
  23398. menu_var_or_value += '</div>';
  23399. }
  23400. 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) {
  23401. 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');
  23402. menu_var_or_value += '<div class="menu menu_only_functions">';
  23403. menu_var_or_value += '</div></div>';
  23404. /* if (command.type == Models.COMMAND_TYPES.attribution) {
  23405. menu_var_or_value += '<div class="item"><i class="dropdown icon"></i>' + LocalizedStrings.getUI('text_change');
  23406. menu_var_or_value += '<div class="menu">';
  23407. menu_var_or_value += '<div class="item" data-exp="'+Models.EXPRESSION_ELEMENTS.exp_op_exp+'">EXP OP EXP</div>';
  23408. menu_var_or_value += '<div class="item" data-exp="'+Models.EXPRESSION_ELEMENTS.op_exp+'">OP EXP</div>';
  23409. menu_var_or_value += '<div class="item" data-exp="'+Models.EXPRESSION_ELEMENTS.par_exp_par+'">( EXP )</div>';
  23410. menu_var_or_value += '</div></div>';
  23411. }*/
  23412. }
  23413. menu_var_or_value += '</div></div>';
  23414. menu_var_or_value = jquery__WEBPACK_IMPORTED_MODULE_0___default()(menu_var_or_value);
  23415. dom_object.append(menu_var_or_value);
  23416. ref_object.dom_object = menu_var_or_value;
  23417. addHandlers(command, ref_object, dom_object, menu_var_or_value, function_obj, expression_element);
  23418. addVariablesToMenu(function_obj, menu_var_or_value, ref_object, expression_element);
  23419. addFunctionsToMenu(function_obj, menu_var_or_value, ref_object, expression_element);
  23420. addIVProgFunctionsToMenu(function_obj, menu_var_or_value, ref_object, expression_element);
  23421. if (ref_object.content || ref_object.function_called) {
  23422. if (ref_object.content) {
  23423. // Verificar se a variável ainda existe:
  23424. var variable_fun = isVarInProgram(ref_object.content, function_obj);
  23425. if (variable_fun) {
  23426. ref_object.content = variable_fun;
  23427. renderPreviousContent(function_obj, menu_var_or_value, ref_object, dom_object, command, expression_element);
  23428. } else {
  23429. if (ref_object.content && ref_object.content.type) {
  23430. ref_object.content = null;
  23431. appendSelectText(ref_object, menu_var_or_value);
  23432. } else {
  23433. renderPreviousContent(function_obj, menu_var_or_value, ref_object, dom_object, command, expression_element);
  23434. }
  23435. }
  23436. } else if (ref_object.function_called) {
  23437. // Verificar se a função ainda existe:
  23438. var ret_function = isFunctionInProgram(ref_object.function_called);
  23439. if (ret_function) {
  23440. ref_object.function_called = ret_function;
  23441. renderPreviousContent(function_obj, menu_var_or_value, ref_object, dom_object, command, expression_element);
  23442. } else {
  23443. ref_object.content = null;
  23444. ref_object.row = null;
  23445. ref_object.column = null;
  23446. delete ref_object.function_called;
  23447. delete ref_object.parameters_list;
  23448. appendSelectText(ref_object, menu_var_or_value);
  23449. }
  23450. }
  23451. } else {
  23452. appendSelectText(ref_object, menu_var_or_value);
  23453. }
  23454. }
  23455. function appendSelectText(ref_object, menu_var_or_value) {
  23456. switch (ref_object.variable_and_value) {
  23457. case VAR_OR_VALUE_TYPES.only_variable:
  23458. menu_var_or_value.find('.text').append('<i>' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('var_menu_select_var') + '</i>');
  23459. break;
  23460. case VAR_OR_VALUE_TYPES.all:
  23461. menu_var_or_value.find('.text').append('<i>' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('var_menu_select_all') + '</i>');
  23462. break;
  23463. case VAR_OR_VALUE_TYPES.variable_and_function:
  23464. menu_var_or_value.find('.text').append('<i>' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('var_menu_select_all') + '</i>');
  23465. break;
  23466. case VAR_OR_VALUE_TYPES.only_function:
  23467. menu_var_or_value.find('.text').append('<i>' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('var_menu_select_function') + '</i>');
  23468. break;
  23469. }
  23470. }
  23471. function isFunctionInProgram(function_called_obj) {
  23472. if (function_called_obj.name) {
  23473. if (window.program_obj.functions) {
  23474. for (var i = 0; i < window.program_obj.functions.length; i++) {
  23475. if (window.program_obj.functions[i] == function_called_obj) {
  23476. return window.program_obj.functions[i];
  23477. }
  23478. }
  23479. for (var i = 0; i < window.program_obj.functions.length; i++) {
  23480. if (window.program_obj.functions[i].name == function_called_obj.name) {
  23481. return window.program_obj.functions[i];
  23482. }
  23483. }
  23484. }
  23485. } else if (function_called_obj.identifier) {
  23486. for (var i = 0; i < window.system_functions.length; i++) {
  23487. if (window.system_functions[i].identifier == function_called_obj.identifier) {
  23488. return window.system_functions[i];
  23489. }
  23490. }
  23491. }
  23492. return null;
  23493. }
  23494. function isVarInProgram(var_obj, function_obj) {
  23495. // Verify in locals:
  23496. if (function_obj.variables_list) {
  23497. for (var i = 0; i < function_obj.variables_list.length; i++) {
  23498. if (function_obj.variables_list[i] == var_obj) {
  23499. return function_obj.variables_list[i];
  23500. }
  23501. }
  23502. } // Verify in parameters:
  23503. if (function_obj.parameters_list) {
  23504. for (var i = 0; i < function_obj.parameters_list.length; i++) {
  23505. if (function_obj.parameters_list[i] == var_obj) {
  23506. return function_obj.parameters_list[i];
  23507. }
  23508. }
  23509. } // Verify in globals:
  23510. if (window.program_obj.globals) {
  23511. for (var i = 0; i < window.program_obj.globals.length; i++) {
  23512. if (window.program_obj.globals[i] == var_obj) {
  23513. return window.program_obj.globals[i];
  23514. }
  23515. }
  23516. } // If not found, verify if the reference was lost
  23517. if (var_obj) {
  23518. if (function_obj.variables_list) {
  23519. for (var i = 0; i < function_obj.variables_list.length; i++) {
  23520. if (function_obj.variables_list[i].name == var_obj.name) {
  23521. return function_obj.variables_list[i];
  23522. }
  23523. }
  23524. }
  23525. if (function_obj.parameters_list) {
  23526. for (var i = 0; i < function_obj.parameters_list.length; i++) {
  23527. if (function_obj.parameters_list[i].name == var_obj.name) {
  23528. return function_obj.parameters_list[i];
  23529. }
  23530. }
  23531. }
  23532. if (window.program_obj.globals) {
  23533. for (var i = 0; i < window.program_obj.globals.length; i++) {
  23534. if (window.program_obj.globals[i].name == var_obj.name) {
  23535. return window.program_obj.globals[i];
  23536. }
  23537. }
  23538. }
  23539. }
  23540. return null;
  23541. }
  23542. function renderPreviousContent(function_obj, menu_var_or_value, ref_object, dom_object, command, expression_element) {
  23543. if (ref_object.function_called) {
  23544. menu_var_or_value.remove();
  23545. variableValueMenuCode(command, ref_object, dom_object, function_obj, menu_var_or_value, expression_element);
  23546. } else if (ref_object.content.type) {
  23547. menu_var_or_value.remove();
  23548. variableValueMenuCode(command, ref_object, dom_object, function_obj, menu_var_or_value, expression_element);
  23549. } else {
  23550. menu_var_or_value.remove();
  23551. variableValueMenuCode(command, ref_object, dom_object, function_obj, menu_var_or_value, expression_element);
  23552. }
  23553. }
  23554. function variableValueMenuCode(command, variable_obj, dom_object, function_obj, menu_var_or_value, expression_element) {
  23555. if (variable_obj.content || variable_obj.function_called) {
  23556. // Verificar se a variável ainda existe:
  23557. var var_fun = isVarInProgram(variable_obj.content, function_obj);
  23558. if (var_fun) {
  23559. variable_obj.content = var_fun;
  23560. } else {
  23561. if (variable_obj.content && variable_obj.content.type) {
  23562. variable_obj.content = null;
  23563. appendSelectText(variable_obj, menu_var_or_value);
  23564. }
  23565. }
  23566. } else {
  23567. appendSelectText(variable_obj, menu_var_or_value);
  23568. }
  23569. if (variable_obj.content == null && variable_obj.function_called == null) {
  23570. renderMenu(command, variable_obj, dom_object, function_obj, 2, expression_element);
  23571. return;
  23572. }
  23573. var ret = '';
  23574. if (variable_obj.function_called) {
  23575. if (variable_obj.function_called.parameters_list == null || variable_obj.function_called.length == 0) {
  23576. menu_var_or_value.find('.text').text(' ');
  23577. dom_object.find('.menu_var_or_value_dom').remove();
  23578. var parameters_menu;
  23579. if (variable_obj.function_called.name) {
  23580. parameters_menu = '<div class="parameters_function_called"> ' + variable_obj.function_called.name + ' <span> ( </span>';
  23581. } else {
  23582. 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>';
  23583. }
  23584. parameters_menu += '<span> ) </span></div>';
  23585. parameters_menu = jquery__WEBPACK_IMPORTED_MODULE_0___default()(parameters_menu);
  23586. dom_object.append(parameters_menu);
  23587. var context_menu = '<div class="ui dropdown context_menu_clear"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
  23588. context_menu += '<div class="item" data-clear="true">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('btn_clear') + '</div>';
  23589. /*if (command.type == Models.COMMAND_TYPES.attribution) {
  23590. context_menu += '<div class="item"><i class="dropdown icon"></i>' + LocalizedStrings.getUI('text_change');
  23591. context_menu += '<div class="menu">';
  23592. context_menu += '<div class="item" data-exp="'+Models.EXPRESSION_ELEMENTS.exp_op_exp+'">EXP OP EXP</div>';
  23593. context_menu += '<div class="item" data-exp="'+Models.EXPRESSION_ELEMENTS.op_exp+'">OP EXP</div>';
  23594. context_menu += '<div class="item" data-exp="'+Models.EXPRESSION_ELEMENTS.par_exp_par+'">( EXP )</div>';
  23595. context_menu += '</div></div>';
  23596. }*/
  23597. context_menu += '</div></div>';
  23598. context_menu = jquery__WEBPACK_IMPORTED_MODULE_0___default()(context_menu);
  23599. context_menu.insertAfter(dom_object.find('.parameters_function_called'));
  23600. context_menu.dropdown({
  23601. onChange: function onChange(value, text, $selectedItem) {
  23602. console.log('S1');
  23603. if ($selectedItem.data('clear')) {
  23604. console.log('PP1');
  23605. dom_object.text('');
  23606. variable_obj.content = null;
  23607. variable_obj.row = null;
  23608. variable_obj.column = null;
  23609. delete variable_obj.function_called;
  23610. delete variable_obj.parameters_list;
  23611. renderMenu(command, variable_obj, dom_object, function_obj, 2, expression_element);
  23612. }
  23613. if ($selectedItem.data('exp')) {
  23614. _attribution__WEBPACK_IMPORTED_MODULE_6__["manageExpressionElements"](command, variable_obj, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  23615. }
  23616. },
  23617. selectOnKeydown: false
  23618. });
  23619. } else {
  23620. menu_var_or_value.find('.text').text(' ');
  23621. dom_object.find('.menu_var_or_value_dom').remove();
  23622. var parameters_menu;
  23623. if (variable_obj.function_called.name) {
  23624. parameters_menu = '<div class="parameters_function_called"> ' + variable_obj.function_called.name + ' <span> ( </span>';
  23625. } else {
  23626. 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>';
  23627. }
  23628. for (var j = 0; j < variable_obj.function_called.parameters_list.length; j++) {
  23629. parameters_menu += '<div class="render_style_param parameter_' + j + '"></div>';
  23630. if (j + 1 != variable_obj.function_called.parameters_list.length) {
  23631. parameters_menu += ' , ';
  23632. }
  23633. }
  23634. parameters_menu += '<span> ) </span></div>';
  23635. parameters_menu = jquery__WEBPACK_IMPORTED_MODULE_0___default()(parameters_menu);
  23636. dom_object.append(parameters_menu);
  23637. for (var j = 0; j < variable_obj.function_called.parameters_list.length; j++) {
  23638. renderMenu(command, variable_obj.parameters_list[j], parameters_menu.find('.parameter_' + j), function_obj, 2, expression_element);
  23639. }
  23640. var context_menu = '<div class="ui dropdown context_menu_clear"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
  23641. context_menu += '<div class="item" data-clear="true">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('btn_clear') + '</div>';
  23642. /*if (command.type == Models.COMMAND_TYPES.attribution) {
  23643. context_menu += '<div class="item"><i class="dropdown icon"></i>' + LocalizedStrings.getUI('text_change');
  23644. context_menu += '<div class="menu">';
  23645. context_menu += '<div class="item" data-exp="'+Models.EXPRESSION_ELEMENTS.exp_op_exp+'">EXP OP EXP</div>';
  23646. context_menu += '<div class="item" data-exp="'+Models.EXPRESSION_ELEMENTS.op_exp+'">OP EXP</div>';
  23647. context_menu += '<div class="item" data-exp="'+Models.EXPRESSION_ELEMENTS.par_exp_par+'">( EXP )</div>';
  23648. context_menu += '</div></div>';
  23649. }*/
  23650. context_menu += '</div></div>';
  23651. context_menu = jquery__WEBPACK_IMPORTED_MODULE_0___default()(context_menu);
  23652. context_menu.insertAfter(parameters_menu);
  23653. context_menu.dropdown({
  23654. onChange: function onChange(value, text, $selectedItem) {
  23655. console.log('S2');
  23656. if ($selectedItem.data('clear')) {
  23657. console.log('PP2');
  23658. dom_object.text('');
  23659. variable_obj.content = null;
  23660. variable_obj.row = null;
  23661. variable_obj.column = null;
  23662. delete variable_obj.function_called;
  23663. delete variable_obj.parameters_list;
  23664. renderMenu(command, variable_obj, dom_object, function_obj, 2, expression_element);
  23665. }
  23666. if ($selectedItem.data('exp')) {
  23667. _attribution__WEBPACK_IMPORTED_MODULE_6__["manageExpressionElements"](command, variable_obj, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  23668. }
  23669. },
  23670. selectOnKeydown: false
  23671. });
  23672. }
  23673. } else if (variable_obj.content.type) {
  23674. var variable_render = "";
  23675. if (variable_obj.content.dimensions == 1 && variable_obj.dimensions != 1) {
  23676. variable_render = '<div class="variable_rendered"> <span class="var_name">' + variable_obj.content.name + '</span>';
  23677. variable_render += ' <span>[ </span> <div class="column_container"></div> <span> ]</span>';
  23678. variable_render += '</div>';
  23679. variable_render = jquery__WEBPACK_IMPORTED_MODULE_0___default()(variable_render);
  23680. dom_object.append(variable_render);
  23681. var context_menu = '<div class="ui dropdown context_menu_clear"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
  23682. context_menu += '<div class="item" data-clear="true">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('btn_clear') + '</div>';
  23683. /*if (command.type == Models.COMMAND_TYPES.attribution) {
  23684. context_menu += '<div class="item"><i class="dropdown icon"></i>' + LocalizedStrings.getUI('text_change');
  23685. context_menu += '<div class="menu">';
  23686. context_menu += '<div class="item" data-exp="'+Models.EXPRESSION_ELEMENTS.exp_op_exp+'">EXP OP EXP</div>';
  23687. context_menu += '<div class="item" data-exp="'+Models.EXPRESSION_ELEMENTS.op_exp+'">OP EXP</div>';
  23688. context_menu += '<div class="item" data-exp="'+Models.EXPRESSION_ELEMENTS.par_exp_par+'">( EXP )</div>';
  23689. context_menu += '</div></div>';
  23690. }*/
  23691. context_menu += '</div></div>';
  23692. context_menu = jquery__WEBPACK_IMPORTED_MODULE_0___default()(context_menu);
  23693. variable_render.append(context_menu);
  23694. context_menu.dropdown({
  23695. onChange: function onChange(value, text, $selectedItem) {
  23696. console.log('S3');
  23697. if ($selectedItem.data('clear')) {
  23698. console.log('PP3');
  23699. dom_object.text('');
  23700. variable_obj.content = null;
  23701. variable_obj.row = null;
  23702. variable_obj.column = null;
  23703. delete variable_obj.function_called;
  23704. delete variable_obj.parameters_list;
  23705. renderMenu(command, variable_obj, dom_object, function_obj, 2, expression_element);
  23706. }
  23707. if ($selectedItem.data('exp')) {
  23708. _attribution__WEBPACK_IMPORTED_MODULE_6__["manageExpressionElements"](command, variable_obj, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  23709. }
  23710. },
  23711. selectOnKeydown: false
  23712. });
  23713. if (!variable_obj.column) {
  23714. variable_obj.column = new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](VAR_OR_VALUE_TYPES.all, null, null, null, true);
  23715. }
  23716. variableValueMenuCode(command, variable_obj.column, jquery__WEBPACK_IMPORTED_MODULE_0___default()(variable_render.find('.column_container')), function_obj, menu_var_or_value, expression_element);
  23717. } else if (variable_obj.content.dimensions == 2 && variable_obj.dimensions != 2) {
  23718. variable_render = '<div class="variable_rendered"> <span class="var_name">' + variable_obj.content.name + '</span>';
  23719. variable_render += ' <span>[ </span> <div class="row_container"></div> <span> ]</span>';
  23720. variable_render += ' <span>[ </span> <div class="column_container"></div> <span> ] </span>';
  23721. variable_render += '</div>';
  23722. variable_render = jquery__WEBPACK_IMPORTED_MODULE_0___default()(variable_render);
  23723. dom_object.append(variable_render);
  23724. var context_menu = '<div class="ui dropdown context_menu_clear"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
  23725. context_menu += '<div class="item" data-clear="true">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('btn_clear') + '</div>';
  23726. /*if (command.type == Models.COMMAND_TYPES.attribution) {
  23727. context_menu += '<div class="item"><i class="dropdown icon"></i>' + LocalizedStrings.getUI('text_change');
  23728. context_menu += '<div class="menu">';
  23729. context_menu += '<div class="item" data-exp="'+Models.EXPRESSION_ELEMENTS.exp_op_exp+'">EXP OP EXP</div>';
  23730. context_menu += '<div class="item" data-exp="'+Models.EXPRESSION_ELEMENTS.op_exp+'">OP EXP</div>';
  23731. context_menu += '<div class="item" data-exp="'+Models.EXPRESSION_ELEMENTS.par_exp_par+'">( EXP )</div>';
  23732. context_menu += '</div></div>';
  23733. }*/
  23734. context_menu += '</div></div>';
  23735. context_menu = jquery__WEBPACK_IMPORTED_MODULE_0___default()(context_menu);
  23736. variable_render.append(context_menu);
  23737. context_menu.dropdown({
  23738. onChange: function onChange(value, text, $selectedItem) {
  23739. console.log('S4');
  23740. if ($selectedItem.data('clear')) {
  23741. console.log('PP4');
  23742. dom_object.text('');
  23743. variable_obj.content = null;
  23744. variable_obj.row = null;
  23745. variable_obj.column = null;
  23746. delete variable_obj.function_called;
  23747. delete variable_obj.parameters_list;
  23748. renderMenu(command, variable_obj, dom_object, function_obj, 2, expression_element);
  23749. }
  23750. if ($selectedItem.data('exp')) {
  23751. _attribution__WEBPACK_IMPORTED_MODULE_6__["manageExpressionElements"](command, variable_obj, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  23752. }
  23753. },
  23754. selectOnKeydown: false
  23755. });
  23756. if (!variable_obj.column) {
  23757. variable_obj.column = new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](VAR_OR_VALUE_TYPES.all, null, null, null, true);
  23758. }
  23759. if (!variable_obj.row) {
  23760. variable_obj.row = new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](VAR_OR_VALUE_TYPES.all, null, null, null, true);
  23761. }
  23762. variableValueMenuCode(command, variable_obj.row, jquery__WEBPACK_IMPORTED_MODULE_0___default()(variable_render.find('.row_container')), function_obj, menu_var_or_value, expression_element);
  23763. variableValueMenuCode(command, variable_obj.column, jquery__WEBPACK_IMPORTED_MODULE_0___default()(variable_render.find('.column_container')), function_obj, menu_var_or_value, expression_element);
  23764. } else {
  23765. variable_render = '<div class="variable_rendered"> <span class="var_name">' + variable_obj.content.name + '</span>';
  23766. variable_render += '</div>';
  23767. variable_render = jquery__WEBPACK_IMPORTED_MODULE_0___default()(variable_render);
  23768. dom_object.append(variable_render);
  23769. var context_menu = '<div class="ui dropdown context_menu_clear"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
  23770. context_menu += '<div class="item" data-clear="true">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('btn_clear') + '</div>';
  23771. /*if (command.type == Models.COMMAND_TYPES.attribution && !dom_object.hasClass('var_attributed')) {
  23772. console.log('dom_object6');
  23773. console.log(dom_object);
  23774. context_menu += '<div class="item"><i class="dropdown icon"></i>' + LocalizedStrings.getUI('text_change');
  23775. context_menu += '<div class="menu">';
  23776. context_menu += '<div class="item" data-exp="'+Models.EXPRESSION_ELEMENTS.exp_op_exp+'">EXP OP EXP</div>';
  23777. context_menu += '<div class="item" data-exp="'+Models.EXPRESSION_ELEMENTS.op_exp+'">OP EXP</div>';
  23778. context_menu += '<div class="item" data-exp="'+Models.EXPRESSION_ELEMENTS.par_exp_par+'">( EXP )</div>';
  23779. context_menu += '</div></div>';
  23780. }*/
  23781. context_menu += '</div></div>';
  23782. context_menu = jquery__WEBPACK_IMPORTED_MODULE_0___default()(context_menu);
  23783. variable_render.append(context_menu);
  23784. context_menu.dropdown({
  23785. onChange: function onChange(value, text, $selectedItem) {
  23786. console.log('S5');
  23787. if ($selectedItem.data('clear')) {
  23788. console.log('PP5');
  23789. dom_object.text('');
  23790. variable_obj.content = null;
  23791. variable_obj.row = null;
  23792. variable_obj.column = null;
  23793. delete variable_obj.function_called;
  23794. delete variable_obj.parameters_list;
  23795. renderMenu(command, variable_obj, dom_object, function_obj, 2, expression_element);
  23796. }
  23797. if ($selectedItem.data('exp')) {
  23798. _attribution__WEBPACK_IMPORTED_MODULE_6__["manageExpressionElements"](command, variable_obj, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  23799. }
  23800. },
  23801. selectOnKeydown: false
  23802. });
  23803. }
  23804. } else {
  23805. var variable_render = '<div class="variable_rendered"> <span class="var_name">' + variable_obj.content + '</span>';
  23806. variable_render += '</div>';
  23807. variable_render = jquery__WEBPACK_IMPORTED_MODULE_0___default()(variable_render);
  23808. dom_object.append(variable_render);
  23809. var context_menu = '<div class="ui dropdown context_menu_clear"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
  23810. context_menu += '<div class="item" data-clear="true">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('btn_clear') + '</div>';
  23811. /*if (command.type == Models.COMMAND_TYPES.attribution) {
  23812. context_menu += '<div class="item"><i class="dropdown icon"></i>' + LocalizedStrings.getUI('text_change');
  23813. context_menu += '<div class="menu">';
  23814. context_menu += '<div class="item" data-exp="'+Models.EXPRESSION_ELEMENTS.exp_op_exp+'">EXP OP EXP</div>';
  23815. context_menu += '<div class="item" data-exp="'+Models.EXPRESSION_ELEMENTS.op_exp+'">OP EXP</div>';
  23816. context_menu += '<div class="item" data-exp="'+Models.EXPRESSION_ELEMENTS.par_exp_par+'">( EXP )</div>';
  23817. context_menu += '</div></div>';
  23818. }*/
  23819. context_menu += '</div></div>';
  23820. context_menu = jquery__WEBPACK_IMPORTED_MODULE_0___default()(context_menu);
  23821. if (variable_obj.variable_and_value != VAR_OR_VALUE_TYPES.only_value) {
  23822. context_menu.insertAfter(variable_render);
  23823. }
  23824. context_menu.dropdown({
  23825. onChange: function onChange(value, text, $selectedItem) {
  23826. console.log('S6');
  23827. if ($selectedItem.data('clear')) {
  23828. console.log('PP6');
  23829. dom_object.text('');
  23830. variable_obj.content = null;
  23831. variable_obj.row = null;
  23832. variable_obj.column = null;
  23833. delete variable_obj.function_called;
  23834. delete variable_obj.parameters_list;
  23835. dom_object.find('.value_rendered').remove();
  23836. dom_object.find('.context_menu_clear').remove();
  23837. dom_object.find('.width-dynamic-minus').remove();
  23838. renderMenu(command, variable_obj, dom_object, function_obj, 2, expression_element);
  23839. }
  23840. if ($selectedItem.data('exp')) {
  23841. _attribution__WEBPACK_IMPORTED_MODULE_6__["manageExpressionElements"](command, variable_obj, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  23842. }
  23843. },
  23844. selectOnKeydown: false
  23845. });
  23846. variable_render.on('click', function (e) {
  23847. variable_render.remove();
  23848. variable_render.empty();
  23849. variable_render.remove();
  23850. dom_object.empty();
  23851. dom_object.append('<span class="menu_var_or_value_dom"> </span>');
  23852. openInputToValue(command, variable_obj, dom_object, menu_var_or_value, function_obj, expression_element);
  23853. });
  23854. }
  23855. }
  23856. function addIVProgFunctionsToMenu(function_obj, menu_var_or_value, ref_object, expression_element) {
  23857. var sub_menu = menu_var_or_value.find('.menu_only_functions');
  23858. sub_menu.append('<div class="divider"></div><div class="header">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_header_ivprog_functions') + '</div>');
  23859. 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>');
  23860. 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>');
  23861. 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>');
  23862. 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:
  23863. for (var i = 0; i < window.system_functions.length; i++) {
  23864. var t = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="item"></div>');
  23865. t.data('function_reference', window.system_functions[i]);
  23866. t.data('option', VAR_OR_VALUE_TYPES.only_function);
  23867. t.text(_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI(window.system_functions[i].identifier));
  23868. switch (window.system_functions[i].category) {
  23869. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SYSTEM_FUNCTIONS_CATEGORIES"].math:
  23870. sub_menu.find('.menu_math_functions').append(t);
  23871. break;
  23872. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SYSTEM_FUNCTIONS_CATEGORIES"].text:
  23873. sub_menu.find('.menu_text_functions').append(t);
  23874. break;
  23875. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SYSTEM_FUNCTIONS_CATEGORIES"].arrangement:
  23876. sub_menu.find('.menu_arrangement_functions').append(t);
  23877. break;
  23878. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SYSTEM_FUNCTIONS_CATEGORIES"].conversion:
  23879. sub_menu.find('.menu_conversion_functions').append(t);
  23880. break;
  23881. }
  23882. }
  23883. }
  23884. function addFunctionsToMenu(function_obj, menu_var_or_value, ref_object, expression_element) {
  23885. var sub_menu = menu_var_or_value.find('.menu_only_functions');
  23886. sub_menu.text('');
  23887. for (var i = 0; i < window.program_obj.functions.length; i++) {
  23888. 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>');
  23889. temp.data('function_reference', window.program_obj.functions[i]);
  23890. sub_menu.append(temp);
  23891. }
  23892. }
  23893. function addVariablesToMenu(function_obj, menu_var_or_value, ref_object, expression_element) {
  23894. var sub_menu = menu_var_or_value.find('.menu_only_vars');
  23895. sub_menu.text('');
  23896. var is_there = false;
  23897. if (window.program_obj.globals) {
  23898. if (ref_object.include_constant) {
  23899. for (var i = 0; i < window.program_obj.globals.length; i++) {
  23900. 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>');
  23901. temp.data('variable_reference', window.program_obj.globals[i]);
  23902. sub_menu.append(temp);
  23903. is_there = true;
  23904. }
  23905. } else {
  23906. for (var i = 0; i < window.program_obj.globals.length; i++) {
  23907. if (!window.program_obj.globals[i].is_constant) {
  23908. 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>');
  23909. temp.data('variable_reference', window.program_obj.globals[i]);
  23910. sub_menu.append(temp);
  23911. is_there = true;
  23912. }
  23913. }
  23914. }
  23915. }
  23916. if (function_obj.parameters_list) {
  23917. for (var i = 0; i < function_obj.parameters_list.length; i++) {
  23918. 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>');
  23919. temp.data('variable_reference', function_obj.parameters_list[i]);
  23920. sub_menu.append(temp);
  23921. is_there = true;
  23922. }
  23923. }
  23924. if (function_obj.variables_list) {
  23925. for (var i = 0; i < function_obj.variables_list.length; i++) {
  23926. 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>');
  23927. temp.data('variable_reference', function_obj.variables_list[i]);
  23928. sub_menu.append(temp);
  23929. is_there = true;
  23930. }
  23931. }
  23932. if (!is_there) {
  23933. sub_menu.append(jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="header">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_none_variable') + '</div>'));
  23934. 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>'));
  23935. }
  23936. }
  23937. function addHandlers(command, ref_object, dom_object, menu_var_or_value, function_obj, expression_element) {
  23938. if (ref_object.variable_and_value != VAR_OR_VALUE_TYPES.only_value) {
  23939. menu_var_or_value.dropdown({
  23940. onChange: function onChange(value, text, $selectedItem) {
  23941. console.log('S7');
  23942. dom_object.find('.var_name').remove();
  23943. switch ($selectedItem.data('option')) {
  23944. case VAR_OR_VALUE_TYPES.only_function:
  23945. openInputToFunction(command, ref_object, dom_object, menu_var_or_value, function_obj, jquery__WEBPACK_IMPORTED_MODULE_0___default()($selectedItem).data('function_reference'), expression_element);
  23946. break;
  23947. case VAR_OR_VALUE_TYPES.only_value:
  23948. openInputToValue(command, ref_object, dom_object, menu_var_or_value, function_obj, expression_element);
  23949. break;
  23950. case VAR_OR_VALUE_TYPES.only_variable:
  23951. openInputToVariable(command, ref_object, dom_object, menu_var_or_value, function_obj, jquery__WEBPACK_IMPORTED_MODULE_0___default()($selectedItem).data('variable_reference'), expression_element);
  23952. break;
  23953. }
  23954. if ($selectedItem.data('exp')) {
  23955. _attribution__WEBPACK_IMPORTED_MODULE_6__["manageExpressionElements"](command, ref_object, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  23956. }
  23957. if (command.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].repeatNtimes) {
  23958. _repeatNtimes__WEBPACK_IMPORTED_MODULE_8__["manageExpressionElements"](command, ref_object, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  23959. }
  23960. },
  23961. selectOnKeydown: false
  23962. });
  23963. }
  23964. dom_object.find('.width-dynamic').on('input', function () {
  23965. var inputWidth = jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).textWidth() + 10;
  23966. jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).focus();
  23967. var tmpStr = jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).val();
  23968. jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).val('');
  23969. jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).val(tmpStr);
  23970. jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).css({
  23971. width: inputWidth
  23972. });
  23973. }).trigger('input');
  23974. if (command.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].comment) {
  23975. dom_object.parent().on('click', function (e) {
  23976. dom_object.find('.value_rendered').remove();
  23977. dom_object.find('.value_rendered').empty();
  23978. dom_object.find('.value_rendered').remove();
  23979. dom_object.empty();
  23980. dom_object.append('<span class="menu_var_or_value_dom"> </span>');
  23981. openInputToValue(command, ref_object, dom_object, menu_var_or_value, function_obj, expression_element);
  23982. });
  23983. }
  23984. }
  23985. function openInputToFunction(command, ref_object, dom_object, menu_var_or_value, function_obj, function_selected, expression_element) {
  23986. ref_object.function_called = function_selected;
  23987. ref_object.parameters_list = [];
  23988. if (function_selected.parameters_list != null && function_selected.parameters_list.length > 0) {
  23989. menu_var_or_value.find('.text').text(' ');
  23990. dom_object.find('.menu_var_or_value_dom').remove();
  23991. var parameters_menu;
  23992. if (function_selected.name) {
  23993. parameters_menu = '<div class="parameters_function_called"> ' + function_selected.name + ' <span> ( </span>';
  23994. } else {
  23995. 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>';
  23996. }
  23997. for (var j = 0; j < function_selected.parameters_list.length; j++) {
  23998. parameters_menu += '<div class="render_style_param parameter_' + j + '"></div>';
  23999. if (j + 1 != function_selected.parameters_list.length) {
  24000. parameters_menu += ' , ';
  24001. }
  24002. }
  24003. parameters_menu += '<span> ) </span></div>';
  24004. parameters_menu = jquery__WEBPACK_IMPORTED_MODULE_0___default()(parameters_menu);
  24005. dom_object.append(parameters_menu);
  24006. for (var j = 0; j < function_selected.parameters_list.length; j++) {
  24007. var temp;
  24008. if (function_selected.parameters_list[j].dimensions > 0) {
  24009. 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);
  24010. } else {
  24011. temp = new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](VAR_OR_VALUE_TYPES.all, null, null, null, true);
  24012. }
  24013. ref_object.parameters_list.push(temp);
  24014. renderMenu(command, temp, parameters_menu.find('.parameter_' + j), function_obj, 2, expression_element);
  24015. }
  24016. var context_menu = '<div class="ui dropdown context_menu_clear"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
  24017. context_menu += '<div class="item" data-clear="true">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('btn_clear') + '</div>';
  24018. /*if (command.type == Models.COMMAND_TYPES.attribution) {
  24019. context_menu += '<div class="item"><i class="dropdown icon"></i>' + LocalizedStrings.getUI('text_change');
  24020. context_menu += '<div class="menu">';
  24021. context_menu += '<div class="item" data-exp="'+Models.EXPRESSION_ELEMENTS.exp_op_exp+'">EXP OP EXP</div>';
  24022. context_menu += '<div class="item" data-exp="'+Models.EXPRESSION_ELEMENTS.op_exp+'">OP EXP</div>';
  24023. context_menu += '<div class="item" data-exp="'+Models.EXPRESSION_ELEMENTS.par_exp_par+'">( EXP )</div>';
  24024. context_menu += '</div></div>';
  24025. }*/
  24026. context_menu += '</div></div>';
  24027. context_menu = jquery__WEBPACK_IMPORTED_MODULE_0___default()(context_menu);
  24028. context_menu.insertAfter(dom_object.find('.parameters_function_called'));
  24029. context_menu.dropdown({
  24030. onChange: function onChange(value, text, $selectedItem) {
  24031. console.log('S8');
  24032. if ($selectedItem.data('clear')) {
  24033. console.log('PP7');
  24034. dom_object.text('');
  24035. ref_object.content = null;
  24036. ref_object.row = null;
  24037. ref_object.column = null;
  24038. delete ref_object.function_called;
  24039. delete ref_object.parameters_list;
  24040. renderMenu(command, ref_object, dom_object, function_obj, 2, expression_element);
  24041. }
  24042. if ($selectedItem.data('exp')) {
  24043. _attribution__WEBPACK_IMPORTED_MODULE_6__["manageExpressionElements"](command, ref_object, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  24044. }
  24045. },
  24046. selectOnKeydown: false
  24047. });
  24048. } else {
  24049. menu_var_or_value.find('.text').text(' ');
  24050. dom_object.find('.menu_var_or_value_dom').remove();
  24051. var parameters_menu;
  24052. if (function_selected.name) {
  24053. parameters_menu = '<div class="parameters_function_called"> ' + function_selected.name + ' <span> ( </span>';
  24054. } else {
  24055. 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>';
  24056. }
  24057. parameters_menu += '<span> ) </span></div>';
  24058. parameters_menu = jquery__WEBPACK_IMPORTED_MODULE_0___default()(parameters_menu);
  24059. dom_object.append(parameters_menu);
  24060. var context_menu = '<div class="ui dropdown context_menu_clear"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
  24061. context_menu += '<div class="item" data-clear="true">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('btn_clear') + '</div>';
  24062. /*if (command.type == Models.COMMAND_TYPES.attribution) {
  24063. context_menu += '<div class="item"><i class="dropdown icon"></i>' + LocalizedStrings.getUI('text_change');
  24064. context_menu += '<div class="menu">';
  24065. context_menu += '<div class="item" data-exp="'+Models.EXPRESSION_ELEMENTS.exp_op_exp+'">EXP OP EXP</div>';
  24066. context_menu += '<div class="item" data-exp="'+Models.EXPRESSION_ELEMENTS.op_exp+'">OP EXP</div>';
  24067. context_menu += '<div class="item" data-exp="'+Models.EXPRESSION_ELEMENTS.par_exp_par+'">( EXP )</div>';
  24068. context_menu += '</div></div>';
  24069. }*/
  24070. context_menu += '</div></div>';
  24071. context_menu = jquery__WEBPACK_IMPORTED_MODULE_0___default()(context_menu);
  24072. context_menu.insertAfter(dom_object.find('.parameters_function_called'));
  24073. context_menu.dropdown({
  24074. onChange: function onChange(value, text, $selectedItem) {
  24075. console.log('S9');
  24076. if ($selectedItem.data('clear')) {
  24077. console.log('PP8');
  24078. dom_object.text('');
  24079. ref_object.content = null;
  24080. ref_object.row = null;
  24081. ref_object.column = null;
  24082. delete ref_object.function_called;
  24083. delete ref_object.parameters_list;
  24084. renderMenu(command, ref_object, dom_object, function_obj, 2, expression_element);
  24085. }
  24086. if ($selectedItem.data('exp')) {
  24087. _attribution__WEBPACK_IMPORTED_MODULE_6__["manageExpressionElements"](command, ref_object, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  24088. }
  24089. },
  24090. selectOnKeydown: false
  24091. });
  24092. }
  24093. /*if (command.type == Models.COMMAND_TYPES.attribution) {
  24094. AttribuitionsManagement.renderMenuOperations(command, ref_object, dom_object, menu_var_or_value, function_obj);
  24095. }*/
  24096. }
  24097. function openInputToVariable(command, ref_object, dom_object, menu_var_or_value, function_obj, variable_selected, expression_element) {
  24098. ref_object.content = variable_selected;
  24099. menu_var_or_value.find('.text').text(' ');
  24100. dom_object.find('.menu_var_or_value_dom').remove();
  24101. var variable_render = '<div class="variable_rendered"> <span class="var_name">' + variable_selected.name + '</span>';
  24102. if (variable_selected.dimensions == 1 && ref_object.dimensions != 1) {
  24103. variable_render += ' <span>[ </span> <div class="column_container"></div> <span> ]</span>';
  24104. }
  24105. if (variable_selected.dimensions == 2 && ref_object.dimensions != 2) {
  24106. variable_render += ' <span>[ </span> <div class="row_container"></div> <span> ]</span> ';
  24107. variable_render += ' <span>[ </span> <div class="column_container"></div> <span> ]</span>';
  24108. }
  24109. variable_render += '</div>';
  24110. variable_render = jquery__WEBPACK_IMPORTED_MODULE_0___default()(variable_render);
  24111. dom_object.append(variable_render);
  24112. if (variable_selected.dimensions == 1 && ref_object.dimensions != 1) {
  24113. ref_object.column = new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](VAR_OR_VALUE_TYPES.all, null, null, null, true);
  24114. renderMenu(command, ref_object.column, variable_render.find('.column_container'), function_obj, 2, expression_element);
  24115. }
  24116. if (variable_selected.dimensions == 2 && ref_object.dimensions != 2) {
  24117. ref_object.row = new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](VAR_OR_VALUE_TYPES.all, null, null, null, true);
  24118. renderMenu(command, ref_object.row, variable_render.find('.row_container'), function_obj, 2, expression_element);
  24119. ref_object.column = new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](VAR_OR_VALUE_TYPES.all, null, null, null, true);
  24120. renderMenu(command, ref_object.column, variable_render.find('.column_container'), function_obj, 2, expression_element);
  24121. }
  24122. var context_menu = '<div class="ui dropdown context_menu_clear"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
  24123. context_menu += '<div class="item" data-clear="true">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('btn_clear') + '</div>';
  24124. /*if (command.type == Models.COMMAND_TYPES.attribution && !dom_object.hasClass('var_attributed')) {
  24125. console.log("dom_object 10: ");
  24126. console.log(dom_object);
  24127. context_menu += '<div class="item"><i class="dropdown icon"></i>' + LocalizedStrings.getUI('text_change');
  24128. context_menu += '<div class="menu">';
  24129. context_menu += '<div class="item" data-exp="'+Models.EXPRESSION_ELEMENTS.exp_op_exp+'">EXP OP EXP</div>';
  24130. context_menu += '<div class="item" data-exp="'+Models.EXPRESSION_ELEMENTS.op_exp+'">OP EXP</div>';
  24131. context_menu += '<div class="item" data-exp="'+Models.EXPRESSION_ELEMENTS.par_exp_par+'">( EXP )</div>';
  24132. context_menu += '</div></div>';
  24133. }*/
  24134. context_menu += '</div></div>';
  24135. context_menu = jquery__WEBPACK_IMPORTED_MODULE_0___default()(context_menu);
  24136. context_menu.insertAfter(dom_object.find('.variable_rendered'));
  24137. context_menu.dropdown({
  24138. onChange: function onChange(value, text, $selectedItem) {
  24139. console.log('S10');
  24140. if ($selectedItem.data('clear')) {
  24141. console.log('PP9');
  24142. dom_object.text('');
  24143. ref_object.content = null;
  24144. ref_object.row = null;
  24145. ref_object.column = null;
  24146. delete ref_object.function_called;
  24147. delete ref_object.parameters_list;
  24148. renderMenu(command, ref_object, dom_object, function_obj, 2, expression_element);
  24149. }
  24150. if ($selectedItem.data('exp')) {
  24151. _attribution__WEBPACK_IMPORTED_MODULE_6__["manageExpressionElements"](command, ref_object, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  24152. }
  24153. if (command.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].repeatNtimes) {
  24154. _repeatNtimes__WEBPACK_IMPORTED_MODULE_8__["manageClearExpressionElements"](command, ref_object, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  24155. }
  24156. },
  24157. selectOnKeydown: false
  24158. });
  24159. /*if (command.type == Models.COMMAND_TYPES.attribution) {
  24160. AttribuitionsManagement.renderMenuOperations(command, ref_object, dom_object, menu_var_or_value, function_obj, variable_selected);
  24161. }*/
  24162. }
  24163. function openInputToValue(command, ref_object, dom_object, menu_var_or_value, function_obj, expression_element) {
  24164. if (ref_object.content == null) {
  24165. ref_object.content = "";
  24166. }
  24167. menu_var_or_value.find('.text').text(' ');
  24168. 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" />');
  24169. field.insertBefore(dom_object.find('.menu_var_or_value_dom'));
  24170. var rendered = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="value_rendered"></div>');
  24171. rendered.insertBefore(field);
  24172. field.focus();
  24173. field.val(ref_object.content);
  24174. var context_menu = '<div class="ui dropdown context_menu_clear"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
  24175. context_menu += '<div class="item" data-clear="true">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('btn_clear') + '</div>';
  24176. /*if (command.type == Models.COMMAND_TYPES.attribution) {
  24177. context_menu += '<div class="item"><i class="dropdown icon"></i>' + LocalizedStrings.getUI('text_change');
  24178. context_menu += '<div class="menu">';
  24179. context_menu += '<div class="item" data-exp="'+Models.EXPRESSION_ELEMENTS.exp_op_exp+'">EXP OP EXP</div>';
  24180. context_menu += '<div class="item" data-exp="'+Models.EXPRESSION_ELEMENTS.op_exp+'">OP EXP</div>';
  24181. context_menu += '<div class="item" data-exp="'+Models.EXPRESSION_ELEMENTS.par_exp_par+'">( EXP )</div>';
  24182. context_menu += '</div></div>';
  24183. }*/
  24184. context_menu += '</div></div>';
  24185. context_menu = jquery__WEBPACK_IMPORTED_MODULE_0___default()(context_menu);
  24186. dom_object.find('.menu_var_or_value_dom').remove();
  24187. if (ref_object.variable_and_value != VAR_OR_VALUE_TYPES.only_value) {
  24188. context_menu.insertAfter(field);
  24189. }
  24190. context_menu.dropdown({
  24191. onChange: function onChange(value, text, $selectedItem) {
  24192. console.log('S11');
  24193. if ($selectedItem.data('clear')) {
  24194. console.log('PP10');
  24195. dom_object.text('');
  24196. dom_object.find('.value_rendered').remove();
  24197. dom_object.find('.context_menu_clear').remove();
  24198. dom_object.find('.width-dynamic-minus').remove();
  24199. ref_object.content = null;
  24200. ref_object.row = null;
  24201. ref_object.column = null;
  24202. delete ref_object.function_called;
  24203. delete ref_object.parameters_list;
  24204. renderMenu(command, ref_object, dom_object, function_obj, 2, expression_element);
  24205. }
  24206. if ($selectedItem.data('exp')) {
  24207. _attribution__WEBPACK_IMPORTED_MODULE_6__["manageExpressionElements"](command, ref_object, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  24208. }
  24209. },
  24210. selectOnKeydown: false
  24211. });
  24212. dom_object.find('.width-dynamic-minus').focusout(function () {
  24213. if (jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).val().trim()) {
  24214. ref_object.content = jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).val().trim();
  24215. }
  24216. rendered.text(ref_object.content);
  24217. jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).remove();
  24218. });
  24219. dom_object.find('.width-dynamic-minus').on('keydown', function (e) {
  24220. var code = e.keyCode || e.which;
  24221. if (code == 13) {
  24222. if (jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).val().trim()) {
  24223. ref_object.content = jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).val().trim();
  24224. }
  24225. rendered.text(ref_object.content);
  24226. jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).remove();
  24227. }
  24228. if (code == 27) {
  24229. rendered.text(ref_object.content);
  24230. jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).remove();
  24231. }
  24232. });
  24233. if (command.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].comment) {
  24234. /*rendered.parent().on('click', function(e) {
  24235. rendered.parent().off();
  24236. console.log("TTT14");
  24237. rendered.remove();
  24238. rendered.empty();
  24239. rendered.remove();
  24240. dom_object.empty();
  24241. dom_object.append('<span class="menu_var_or_value_dom"> </span>');
  24242. openInputToValue(command, ref_object, dom_object, menu_var_or_value, function_obj, expression_element)
  24243. });*/
  24244. }
  24245. rendered.on('click', function (e) {
  24246. console.log("TTT2");
  24247. rendered.remove();
  24248. rendered.empty();
  24249. rendered.remove();
  24250. dom_object.empty();
  24251. dom_object.append('<span class="menu_var_or_value_dom"> </span>');
  24252. openInputToValue(command, ref_object, dom_object, menu_var_or_value, function_obj, expression_element);
  24253. });
  24254. /*if (command.type == Models.COMMAND_TYPES.attribution) {
  24255. AttribuitionsManagement.renderMenuOperations(command, ref_object, dom_object, menu_var_or_value, function_obj);
  24256. }*/
  24257. }
  24258. jquery__WEBPACK_IMPORTED_MODULE_0___default.a.fn.textWidth = function (text, font) {
  24259. 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);
  24260. 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'));
  24261. return jquery__WEBPACK_IMPORTED_MODULE_0___default.a.fn.textWidth.fakeEl.width();
  24262. };
  24263. /***/ }),
  24264. /***/ "./js/visualUI/commands/whiletrue.js":
  24265. /*!*******************************************!*\
  24266. !*** ./js/visualUI/commands/whiletrue.js ***!
  24267. \*******************************************/
  24268. /*! exports provided: createFloatingCommand, renderCommand */
  24269. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  24270. "use strict";
  24271. __webpack_require__.r(__webpack_exports__);
  24272. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createFloatingCommand", function() { return createFloatingCommand; });
  24273. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "renderCommand", function() { return renderCommand; });
  24274. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  24275. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_0__);
  24276. /* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  24277. /* harmony import */ var _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  24278. /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  24279. /* harmony import */ var _globals__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../globals */ "./js/visualUI/globals.js");
  24280. /* harmony import */ var _variables__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../variables */ "./js/visualUI/variables.js");
  24281. /* harmony import */ var _commands__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  24282. /* harmony import */ var _conditional_expression__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./conditional_expression */ "./js/visualUI/commands/conditional_expression.js");
  24283. /* harmony import */ var _contextualized_menu__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./contextualized_menu */ "./js/visualUI/commands/contextualized_menu.js");
  24284. function createFloatingCommand() {
  24285. 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>');
  24286. }
  24287. function renderCommand(command, function_obj) {
  24288. var ret = '';
  24289. 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>';
  24290. ret += '<span class="span_command_spec"> ( </span> <div class="conditional_expression"></div> <span class="span_command_spec"> ) </span>';
  24291. ret += ' </span>';
  24292. ret += '<div class="ui block_commands">';
  24293. ret += '</div>';
  24294. ret += '<span> </span>';
  24295. ret += '</div>';
  24296. var el = jquery__WEBPACK_IMPORTED_MODULE_0___default()(ret);
  24297. el.data('command', command);
  24298. el.find('.block_commands').data('command', command);
  24299. addHandlers(command, function_obj, el);
  24300. _contextualized_menu__WEBPACK_IMPORTED_MODULE_8__["renderMenu"](command, el.find('.context_menu'), function_obj, el);
  24301. _conditional_expression__WEBPACK_IMPORTED_MODULE_7__["renderExpression"](command, command.expression, function_obj, el.find('.conditional_expression'));
  24302. if (command.commands_block) {
  24303. for (var j = 0; j < command.commands_block.length; j++) {
  24304. _commands__WEBPACK_IMPORTED_MODULE_6__["renderCommand"](command.commands_block[j], jquery__WEBPACK_IMPORTED_MODULE_0___default()(el.find('.block_commands')[0]), 3, function_obj);
  24305. }
  24306. }
  24307. return el;
  24308. }
  24309. function addHandlers(command, function_obj, whiletrue_dom) {
  24310. whiletrue_dom.find('.button_remove_command').on('click', function () {
  24311. if (_commands__WEBPACK_IMPORTED_MODULE_6__["removeCommand"](command, function_obj, whiletrue_dom)) {
  24312. whiletrue_dom.fadeOut(400, function () {
  24313. whiletrue_dom.remove();
  24314. });
  24315. }
  24316. });
  24317. }
  24318. /***/ }),
  24319. /***/ "./js/visualUI/commands/writer.js":
  24320. /*!****************************************!*\
  24321. !*** ./js/visualUI/commands/writer.js ***!
  24322. \****************************************/
  24323. /*! exports provided: createFloatingCommand, renderCommand, addContent */
  24324. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  24325. "use strict";
  24326. __webpack_require__.r(__webpack_exports__);
  24327. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createFloatingCommand", function() { return createFloatingCommand; });
  24328. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "renderCommand", function() { return renderCommand; });
  24329. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "addContent", function() { return addContent; });
  24330. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  24331. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_0__);
  24332. /* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  24333. /* harmony import */ var _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  24334. /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  24335. /* harmony import */ var _globals__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../globals */ "./js/visualUI/globals.js");
  24336. /* harmony import */ var _variables__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../variables */ "./js/visualUI/variables.js");
  24337. /* harmony import */ var _variable_value_menu__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  24338. /* harmony import */ var _commands__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  24339. /* harmony import */ var _Sortable_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../../Sortable.js */ "./js/Sortable.js");
  24340. /* harmony import */ var _Sortable_js__WEBPACK_IMPORTED_MODULE_8___default = /*#__PURE__*/__webpack_require__.n(_Sortable_js__WEBPACK_IMPORTED_MODULE_8__);
  24341. function createFloatingCommand() {
  24342. 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>');
  24343. }
  24344. function renderCommand(command, function_obj) {
  24345. var ret = '';
  24346. 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>';
  24347. var el = jquery__WEBPACK_IMPORTED_MODULE_0___default()(ret);
  24348. el.data('command', command);
  24349. for (var i = 0; i < command.content.length; i++) {
  24350. var new_div_item = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="var_value_menu_div"></div>');
  24351. var div_parent_with_handler = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="div_parent_handler"></div>');
  24352. div_parent_with_handler.append(jquery__WEBPACK_IMPORTED_MODULE_0___default()('<i class="ui icon ellipsis vertical inverted handler"></i>'));
  24353. div_parent_with_handler.append(new_div_item);
  24354. div_parent_with_handler.append(jquery__WEBPACK_IMPORTED_MODULE_0___default()('<i class="white inverted icon times handler"></i>'));
  24355. el.find('.all_elements_write').append(div_parent_with_handler);
  24356. _variable_value_menu__WEBPACK_IMPORTED_MODULE_6__["renderMenu"](command, command.content[i], new_div_item, function_obj);
  24357. addHandlerIconAdd(el.find('.all_elements_write'), command, function_obj);
  24358. addHandlersManager(command, function_obj, el, div_parent_with_handler, command.content[i]);
  24359. }
  24360. if (command.content.length == 0) {
  24361. addHandlerIconAdd(el.find('.all_elements_write'), command, function_obj);
  24362. }
  24363. addHandlers(command, function_obj, el);
  24364. return el;
  24365. }
  24366. function addHandlersManager(command, function_obj, writer_dom, item_div, content_element) {
  24367. item_div.find('.times').on('click', function () {
  24368. for (var i = 0; i < command.content.length; i++) {
  24369. if (command.content[i] == content_element) {
  24370. delete command.content[i];
  24371. command.content.splice(i, 1);
  24372. item_div.children().off();
  24373. item_div.off();
  24374. item_div.fadeOut();
  24375. if (command.content.length > 0) {
  24376. item_div.next('.icon_add_item_to_writer').fadeOut();
  24377. }
  24378. break;
  24379. }
  24380. }
  24381. });
  24382. }
  24383. function addHandlers(command, function_obj, writer_dom) {
  24384. writer_dom.find('.button_remove_command').on('click', function () {
  24385. if (_commands__WEBPACK_IMPORTED_MODULE_7__["removeCommand"](command, function_obj, writer_dom)) {
  24386. writer_dom.fadeOut(400, function () {
  24387. writer_dom.remove();
  24388. });
  24389. }
  24390. });
  24391. Sortable.create(writer_dom.find(".all_elements_write")[0], {
  24392. handle: '.ellipsis',
  24393. animation: 100,
  24394. ghostClass: 'ghost',
  24395. group: 'writer_' + Math.floor(Math.random() * 10000000),
  24396. draggable: '.div_parent_handler',
  24397. onEnd: function onEnd(evt) {
  24398. command.content.splice(evt.newIndex, 0, command.content.splice(evt.oldIndex, 1)[0]);
  24399. writer_dom.empty();
  24400. writer_dom.replaceWith(renderCommand(command, function_obj));
  24401. }
  24402. });
  24403. }
  24404. function addHandlerIconAdd(dom_object, command, function_obj) {
  24405. var insert_after = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
  24406. var after_which = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : null;
  24407. var icon_add_item = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<i class="ui icon plus square outline icon_add_item_to_writer"></i> ');
  24408. if (!insert_after) {
  24409. dom_object.append(icon_add_item);
  24410. } else {
  24411. icon_add_item.insertAfter(after_which);
  24412. }
  24413. icon_add_item.on('click', function (e) {
  24414. var div_parent_with_handler = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="div_parent_handler" style="display:none;"></div>');
  24415. var new_div_item = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="var_value_menu_div"></div>');
  24416. div_parent_with_handler.append(jquery__WEBPACK_IMPORTED_MODULE_0___default()('<i class="ui icon ellipsis vertical inverted handler"></i>'));
  24417. div_parent_with_handler.append(new_div_item);
  24418. div_parent_with_handler.append(jquery__WEBPACK_IMPORTED_MODULE_0___default()('<i class="white inverted icon times handler"></i>'));
  24419. div_parent_with_handler.insertAfter(icon_add_item);
  24420. 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);
  24421. _variable_value_menu__WEBPACK_IMPORTED_MODULE_6__["renderMenu"](command, new_related_menu, new_div_item, function_obj);
  24422. addHandlerIconAdd(dom_object, command, function_obj, true, div_parent_with_handler);
  24423. addHandlersManager(command, function_obj, dom_object, div_parent_with_handler, new_related_menu);
  24424. var pos = 1;
  24425. dom_object.find('.icon_add_item_to_writer').each(function () {
  24426. if (jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).get(0) === icon_add_item.get(0)) {
  24427. command.content.splice(pos, 0, new_related_menu);
  24428. } else {
  24429. pos++;
  24430. }
  24431. });
  24432. if (command.content.length == 1) {
  24433. icon_add_item.remove();
  24434. }
  24435. div_parent_with_handler.fadeIn();
  24436. });
  24437. }
  24438. function addContent(command, ref_object, dom_object, menu_var_or_value, function_obj, ref_object_content) {
  24439. if (dom_object.hasClass('var_value_menu_div')) {
  24440. var icon_add_item = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<i class="ui icon plus square outline icon_add_item_to_writer"></i> ');
  24441. icon_add_item.insertAfter(dom_object);
  24442. icon_add_item.on('click', function (e) {
  24443. var div_parent_with_handler = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="div_parent_handler"></div>');
  24444. div_parent_with_handler.append(jquery__WEBPACK_IMPORTED_MODULE_0___default()('<i class="ui icon ellipsis vertical inverted handler"></i>'));
  24445. div_parent_with_handler.append(new_div_item);
  24446. div_parent_with_handler.append(jquery__WEBPACK_IMPORTED_MODULE_0___default()('<i class="white inverted icon times handler"></i>'));
  24447. div_parent_with_handler.insertAfter(icon_add_item);
  24448. 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);
  24449. _variable_value_menu__WEBPACK_IMPORTED_MODULE_6__["renderMenu"](command, new_related_menu, new_div_item, function_obj);
  24450. addHandlersManager(command, function_obj, dom_object, div_parent_with_handler, new_related_menu);
  24451. command.content.push(new_related_menu);
  24452. if (command.content.length == 1) {
  24453. icon_add_item.remove();
  24454. }
  24455. });
  24456. }
  24457. }
  24458. /***/ }),
  24459. /***/ "./js/visualUI/functions.js":
  24460. /*!**********************************!*\
  24461. !*** ./js/visualUI/functions.js ***!
  24462. \**********************************/
  24463. /*! exports provided: renderFunction, initVisualUI, addFunctionChangeListener, addGlobalChangeListener, removeGlobalListener, removeFunctionListener */
  24464. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  24465. "use strict";
  24466. __webpack_require__.r(__webpack_exports__);
  24467. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "renderFunction", function() { return renderFunction; });
  24468. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "initVisualUI", function() { return initVisualUI; });
  24469. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "addFunctionChangeListener", function() { return addFunctionChangeListener; });
  24470. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "addGlobalChangeListener", function() { return addGlobalChangeListener; });
  24471. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "removeGlobalListener", function() { return removeGlobalListener; });
  24472. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "removeFunctionListener", function() { return removeFunctionListener; });
  24473. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  24474. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_0__);
  24475. /* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./types */ "./js/visualUI/types.js");
  24476. /* harmony import */ var _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  24477. /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  24478. /* harmony import */ var _globals__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./globals */ "./js/visualUI/globals.js");
  24479. /* harmony import */ var _variables__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./variables */ "./js/visualUI/variables.js");
  24480. /* harmony import */ var _commands__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./commands */ "./js/visualUI/commands.js");
  24481. /* harmony import */ var _code_generator__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./code_generator */ "./js/visualUI/code_generator.js");
  24482. /* harmony import */ var _commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./commands/variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  24483. /* harmony import */ var _io_domConsole__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./../io/domConsole */ "./js/io/domConsole.js");
  24484. /* harmony import */ var _ast_ivprogParser__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./../ast/ivprogParser */ "./js/ast/ivprogParser.js");
  24485. /* harmony import */ var _processor_ivprogProcessor__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./../processor/ivprogProcessor */ "./js/processor/ivprogProcessor.js");
  24486. /* harmony import */ var melanke_watchjs__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! melanke-watchjs */ "./node_modules/melanke-watchjs/src/watch.js");
  24487. /* harmony import */ var melanke_watchjs__WEBPACK_IMPORTED_MODULE_12___default = /*#__PURE__*/__webpack_require__.n(melanke_watchjs__WEBPACK_IMPORTED_MODULE_12__);
  24488. /* harmony import */ var _processor_semantic_semanticAnalyser__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ../processor/semantic/semanticAnalyser */ "./js/processor/semantic/semanticAnalyser.js");
  24489. /* harmony import */ var _assessment_ivprogAssessment__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ../assessment/ivprogAssessment */ "./js/assessment/ivprogAssessment.js");
  24490. /* harmony import */ var _algorithm__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./algorithm */ "./js/visualUI/algorithm.js");
  24491. /* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./utils */ "./js/visualUI/utils.js");
  24492. /* harmony import */ var _ima_version_json__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ./../../.ima_version.json */ "./.ima_version.json");
  24493. var _ima_version_json__WEBPACK_IMPORTED_MODULE_17___namespace = /*#__PURE__*/__webpack_require__.t(/*! ./../../.ima_version.json */ "./.ima_version.json", 1);
  24494. /* harmony import */ var _Sortable_js__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ../Sortable.js */ "./js/Sortable.js");
  24495. /* harmony import */ var _Sortable_js__WEBPACK_IMPORTED_MODULE_18___default = /*#__PURE__*/__webpack_require__.n(_Sortable_js__WEBPACK_IMPORTED_MODULE_18__);
  24496. var counter_new_functions = 0;
  24497. var counter_new_parameters = 0;
  24498. var ivprog_version = _ima_version_json__WEBPACK_IMPORTED_MODULE_17__.version;
  24499. var globalChangeListeners = [];
  24500. var functionsChangeListeners = [];
  24501. var domConsole = null;
  24502. window.studentGrade = null;
  24503. window.LocalizedStrings = _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"];
  24504. var program = new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["Program"]();
  24505. window.system_functions = []; // Adding math functions:
  24506. 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));
  24507. 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));
  24508. 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));
  24509. 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));
  24510. 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));
  24511. 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));
  24512. 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));
  24513. 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));
  24514. 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));
  24515. 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));
  24516. 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:
  24517. 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));
  24518. 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));
  24519. 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));
  24520. 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));
  24521. 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:
  24522. 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));
  24523. 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));
  24524. 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:
  24525. 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));
  24526. 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));
  24527. 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));
  24528. 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));
  24529. 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));
  24530. 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));
  24531. 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));
  24532. 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');
  24533. 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);
  24534. mainFunction.function_comment = new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["Comment"](_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_comment_main'));
  24535. program.addFunction(mainFunction);
  24536. window.program_obj = program;
  24537. window.generator = _code_generator__WEBPACK_IMPORTED_MODULE_7__["generate"];
  24538. window.runCodeAssessment = runCodeAssessment;
  24539. window.renderAlgorithm = _algorithm__WEBPACK_IMPORTED_MODULE_15__["renderAlgorithm"];
  24540. window.insertContext = false;
  24541. window.watchW = melanke_watchjs__WEBPACK_IMPORTED_MODULE_12___default.a;
  24542. melanke_watchjs__WEBPACK_IMPORTED_MODULE_12___default.a.watch(window.program_obj.globals, function () {
  24543. if (window.insertContext) {
  24544. setTimeout(function () {
  24545. _algorithm__WEBPACK_IMPORTED_MODULE_15__["renderAlgorithm"]();
  24546. globalChangeListeners.forEach(function (x) {
  24547. return x();
  24548. });
  24549. }, 300);
  24550. window.insertContext = false;
  24551. } else {
  24552. _algorithm__WEBPACK_IMPORTED_MODULE_15__["renderAlgorithm"]();
  24553. globalChangeListeners.forEach(function (x) {
  24554. return x();
  24555. });
  24556. }
  24557. }, 1);
  24558. melanke_watchjs__WEBPACK_IMPORTED_MODULE_12___default.a.watch(window.program_obj.functions, function () {
  24559. if (window.insertContext) {
  24560. setTimeout(function () {
  24561. _algorithm__WEBPACK_IMPORTED_MODULE_15__["renderAlgorithm"]();
  24562. functionsChangeListeners.forEach(function (x) {
  24563. return x();
  24564. });
  24565. }, 300);
  24566. window.insertContext = false;
  24567. } else {
  24568. _algorithm__WEBPACK_IMPORTED_MODULE_15__["renderAlgorithm"]();
  24569. functionsChangeListeners.forEach(function (x) {
  24570. return x();
  24571. });
  24572. }
  24573. }, 1);
  24574. function addFunctionHandler() {
  24575. 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')));
  24576. program.addFunction(new_function);
  24577. counter_new_functions++;
  24578. window.insertContext = true;
  24579. var newe = renderFunction(new_function);
  24580. /*newe.css('display', 'none');
  24581. newe.fadeIn();*/
  24582. }
  24583. function addParameter(function_obj, function_container) {
  24584. var is_from_click = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  24585. if (function_obj.parameters_list == null) {
  24586. function_obj.parameters_list = [];
  24587. }
  24588. 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);
  24589. function_obj.parameters_list.push(new_parameter);
  24590. counter_new_parameters++;
  24591. var newe = renderParameter(function_obj, new_parameter, function_container);
  24592. if (is_from_click) {
  24593. /*newe.css('display', 'none');
  24594. newe.fadeIn();*/
  24595. }
  24596. }
  24597. function updateReturnType(function_obj, new_type) {
  24598. var new_dimensions = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
  24599. function_obj.return_type = new_type;
  24600. function_obj.return_dimensions = new_dimensions;
  24601. }
  24602. function removeFunction(function_obj) {
  24603. var index = program.functions.indexOf(function_obj);
  24604. if (index > -1) {
  24605. program.functions.splice(index, 1);
  24606. }
  24607. }
  24608. function minimizeFunction(function_obj) {
  24609. function_obj.is_hidden = !function_obj.is_hidden;
  24610. }
  24611. function addHandlers(function_obj, function_container) {
  24612. function_container.find('.ui.dropdown.function_return').dropdown({
  24613. onChange: function onChange(value, text, $selectedItem) {
  24614. if ($selectedItem.data('dimensions')) {
  24615. updateReturnType(function_obj, _types__WEBPACK_IMPORTED_MODULE_1__["Types"][$selectedItem.data('type')], $selectedItem.data('dimensions'));
  24616. } else {
  24617. updateReturnType(function_obj, _types__WEBPACK_IMPORTED_MODULE_1__["Types"][$selectedItem.data('type')]);
  24618. }
  24619. },
  24620. selectOnKeydown: false
  24621. });
  24622. function_container.find(".name_function_updated").on('click', function (e) {
  24623. enableNameFunctionUpdate(function_obj, function_container);
  24624. });
  24625. function_container.find(".add_parameter_button").on('click', function (e) {
  24626. window.insertContext = true;
  24627. addParameter(function_obj, function_container, true);
  24628. });
  24629. function_container.find('.menu_commands').dropdown({
  24630. on: 'hover'
  24631. });
  24632. function_container.find('.menu_commands a').on('click', function (evt) {
  24633. if (function_obj.commands == null || function_obj.commands.length == 0) {
  24634. function_obj.commands = [];
  24635. var new_cmd = _commands__WEBPACK_IMPORTED_MODULE_6__["genericCreateCommand"](jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).data('command'));
  24636. function_obj.commands.push(new_cmd);
  24637. _commands__WEBPACK_IMPORTED_MODULE_6__["renderCommand"](new_cmd, function_container.find('.commands_list_div'), 3, function_obj);
  24638. } else {
  24639. _commands__WEBPACK_IMPORTED_MODULE_6__["createFloatingCommand"](function_obj, function_container, jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).data('command'), evt);
  24640. }
  24641. });
  24642. function_container.find('.add_var_button_function').on('click', function (e) {
  24643. window.insertContext = true;
  24644. _variables__WEBPACK_IMPORTED_MODULE_5__["addVariable"](function_obj, function_container, true);
  24645. });
  24646. function_container.find('.remove_function_button').on('click', function (e) {
  24647. removeFunction(function_obj);
  24648. function_container.fadeOut();
  24649. });
  24650. function_container.find('.minimize_function_button').on('click', function (e) {
  24651. minimizeFunction(function_obj);
  24652. if (function_obj.is_hidden) {
  24653. function_container.find(".add_var_button_function").toggle();
  24654. function_container.find(".inline_add_command").toggle();
  24655. function_container.find(".function_area").slideToggle();
  24656. } else {
  24657. function_container.find(".function_area").slideToggle(function () {
  24658. function_container.find(".add_var_button_function").toggle();
  24659. function_container.find(".inline_add_command").toggle();
  24660. });
  24661. }
  24662. });
  24663. } // Essa função imprime o tipo de retorno da função e cria o menu do tipo 'select' para alteração
  24664. function renderFunctionReturn(function_obj, function_element) {
  24665. var ret = '<div class="ui dropdown function_return">';
  24666. if (function_obj.return_dimensions > 0) {
  24667. 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);
  24668. if (function_obj.return_dimensions == 1) {
  24669. ret += ' [ ] ';
  24670. } else {
  24671. ret += ' [ ] [ ] ';
  24672. }
  24673. ret += '</div>';
  24674. } else {
  24675. ret += '<div class="text">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI(function_obj.return_type) + '</div>';
  24676. }
  24677. ret += '<div class="menu">';
  24678. for (var tm in _types__WEBPACK_IMPORTED_MODULE_1__["Types"]) {
  24679. 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>';
  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 ' + (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>';
  24686. }
  24687. ret += '</div></div>';
  24688. ret = jquery__WEBPACK_IMPORTED_MODULE_0___default()(ret);
  24689. function_element.find('.function_return').append(ret);
  24690. }
  24691. var cont = 0;
  24692. function renderFunction(function_obj) {
  24693. var appender = '<div class="ui secondary segment function_div list-group-item function_cont_' + cont + '">';
  24694. if (function_obj.function_comment) {//appender += renderComment(function_obj.function_comment, sequence, true, -1);
  24695. }
  24696. appender += '<span class="glyphicon glyphicon-move move_function" aria-hidden="true"><i class="icon sort alternate vertical"></i></span>';
  24697. 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>';
  24698. appender += '<div class="function_signature_div">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI("function") + ' ';
  24699. if (function_obj.is_main) {
  24700. 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">';
  24701. } else {
  24702. appender += '<div class="ui function_return"></div>';
  24703. 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">';
  24704. }
  24705. appender += '</div> <span class="parethesis_function"> ) </span> </div>' + (function_obj.is_hidden ? ' <div class="function_area" style="display: none;"> ' : ' <div class="function_area"> ');
  24706. 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>';
  24707. appender += '<div class="ui top attached segment variables_list_div"></div>';
  24708. 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;">';
  24709. 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"> ';
  24710. 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>';
  24711. appender += '</div></div>' + '</div>';
  24712. appender += '</div></div>';
  24713. appender = jquery__WEBPACK_IMPORTED_MODULE_0___default()(appender);
  24714. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.all_functions').append(appender);
  24715. appender.data('fun', function_obj);
  24716. appender.find('.commands_list_div').data('fun', function_obj);
  24717. renderFunctionReturn(function_obj, appender);
  24718. addHandlers(function_obj, appender); // Rendering parameters:
  24719. for (var j = 0; j < function_obj.parameters_list.length; j++) {
  24720. renderParameter(function_obj, function_obj.parameters_list[j], appender);
  24721. } // Rendering variables:
  24722. for (var j = 0; j < function_obj.variables_list.length; j++) {
  24723. _variables__WEBPACK_IMPORTED_MODULE_5__["renderVariable"](appender, function_obj.variables_list[j], function_obj);
  24724. } // Rendering commands:
  24725. for (var j = 0; j < function_obj.commands.length; j++) {
  24726. _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);
  24727. }
  24728. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.minimize_function_button').popup({
  24729. content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI("tooltip_minimize"),
  24730. delay: {
  24731. show: 750,
  24732. hide: 0
  24733. }
  24734. });
  24735. var function_index = program.functions.indexOf(function_obj);
  24736. Sortable.create(appender.find(".variables_list_div")[0], {
  24737. handle: '.ellipsis',
  24738. animation: 100,
  24739. ghostClass: 'ghost',
  24740. group: 'local_vars_drag_' + function_index,
  24741. onEnd: function onEnd(evt) {
  24742. updateSequenceLocals(evt.oldIndex, evt.newIndex, function_obj);
  24743. }
  24744. });
  24745. addSortableHandler(appender.find(".commands_list_div")[0], function_index);
  24746. if (!function_obj.is_main) {
  24747. Sortable.create(appender.find(".container_parameters_list")[0], {
  24748. handle: '.ellipsis',
  24749. animation: 100,
  24750. ghostClass: 'ghost',
  24751. group: 'parameters_drag_' + program.functions.indexOf(function_obj),
  24752. onEnd: function onEnd(evt) {
  24753. updateSequenceParameters(evt.oldIndex, evt.newIndex, function_obj);
  24754. }
  24755. });
  24756. }
  24757. if (function_obj.commands.length > 0) {
  24758. var teste = '.ui.sticky.sticky_cont_' + cont;
  24759. jquery__WEBPACK_IMPORTED_MODULE_0___default()(teste).sticky({
  24760. context: '.ui.bottom.attached.segment.commands_list_div.commands_cont_' + cont,
  24761. scrollContext: '.ivprog_visual_panel',
  24762. observeChanges: true,
  24763. offset: 40,
  24764. onStick: function onStick(evt) {
  24765. jquery__WEBPACK_IMPORTED_MODULE_0___default()(teste).css('top', '20px', 'important');
  24766. },
  24767. onBottom: function onBottom(evt) {
  24768. jquery__WEBPACK_IMPORTED_MODULE_0___default()(teste).css('top', '20px', 'important');
  24769. },
  24770. onUnstick: function onUnstick(evt) {
  24771. jquery__WEBPACK_IMPORTED_MODULE_0___default()(teste).css('top', '20px', 'important');
  24772. },
  24773. onReposition: function onReposition(evt) {
  24774. jquery__WEBPACK_IMPORTED_MODULE_0___default()(teste).css('top', '20px', 'important');
  24775. },
  24776. onScroll: function onScroll(evt) {
  24777. jquery__WEBPACK_IMPORTED_MODULE_0___default()(teste).css('top', '20px', 'important');
  24778. if (!isVisible(jquery__WEBPACK_IMPORTED_MODULE_0___default()(teste), jquery__WEBPACK_IMPORTED_MODULE_0___default()(teste).parent())) {
  24779. jquery__WEBPACK_IMPORTED_MODULE_0___default()(teste).removeClass('fixed');
  24780. }
  24781. },
  24782. onTop: function onTop(evt) {
  24783. jquery__WEBPACK_IMPORTED_MODULE_0___default()(teste).css('top', '20px', 'important');
  24784. }
  24785. });
  24786. }
  24787. cont++;
  24788. return appender;
  24789. }
  24790. function isVisible(element, container) {
  24791. var elementTop = jquery__WEBPACK_IMPORTED_MODULE_0___default()(element).offset().top,
  24792. elementHeight = jquery__WEBPACK_IMPORTED_MODULE_0___default()(element).height(),
  24793. containerTop = jquery__WEBPACK_IMPORTED_MODULE_0___default()(container).offset().top,
  24794. containerHeight = jquery__WEBPACK_IMPORTED_MODULE_0___default()(container).height() - 30;
  24795. return elementTop - containerTop + elementHeight > 0 && elementTop - containerTop < containerHeight;
  24796. }
  24797. window.evento_drag;
  24798. function updateProgramObjDrag() {
  24799. var nodes = Array.prototype.slice.call(jquery__WEBPACK_IMPORTED_MODULE_0___default()('.all_functions').children());
  24800. var function_index;
  24801. var start_index;
  24802. var function_obj;
  24803. jquery__WEBPACK_IMPORTED_MODULE_0___default()(evento_drag.item).parentsUntil(".all_functions").each(function (index) {
  24804. if (jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).hasClass('function_div')) {
  24805. function_index = nodes.indexOf(this);
  24806. start_index = index;
  24807. function_obj = jquery__WEBPACK_IMPORTED_MODULE_0___default()(this);
  24808. }
  24809. });
  24810. console.log(function_index);
  24811. var path_target = [];
  24812. jquery__WEBPACK_IMPORTED_MODULE_0___default()(evento_drag.item).parentsUntil(".all_functions").each(function (index) {
  24813. if (jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).hasClass('command_container')) {
  24814. path_target.push(this);
  24815. }
  24816. });
  24817. if (path_target.length == 0) {//console.log('soltou na raiz, na posição: ' + evento_drag.newIndex + ' mas ainda não sei de onde saiu ');
  24818. } else {//console.log('soltou dentro de algum bloco, sequência vem logo abaixo (de baixo pra cima): ');
  24819. //console.log(path_target);
  24820. }
  24821. var index_each = [];
  24822. var path_relative = [];
  24823. for (var i = path_target.length - 1; i >= 0; i--) {
  24824. console.log('da vez', jquery__WEBPACK_IMPORTED_MODULE_0___default()(path_target[i + 1]));
  24825. if (i == path_target.length - 1) {
  24826. // está na raiz
  24827. var indice_na_raiz = function_obj.find('.command_container').index(path_target[i]);
  24828. console.log('índice na raiz: ', indice_na_raiz);
  24829. } else {
  24830. if (jquery__WEBPACK_IMPORTED_MODULE_0___default()(path_target[i + 1]).hasClass('iftrue')) {
  24831. if (jquery__WEBPACK_IMPORTED_MODULE_0___default()(path_target[i]).parent().hasClass('commands_if')) {
  24832. path_relative.push('if');
  24833. index_each.push(jquery__WEBPACK_IMPORTED_MODULE_0___default()(path_target[i]).parent().find('.command_container').index(path_target[i]));
  24834. } else {
  24835. path_relative.push('else');
  24836. index_each.push(jquery__WEBPACK_IMPORTED_MODULE_0___default()(path_target[i]).parent().find('.command_container').index(path_target[i]));
  24837. }
  24838. } else if (jquery__WEBPACK_IMPORTED_MODULE_0___default()(path_target[i + 1]).hasClass('dowhiletrue')) {
  24839. path_relative.push('dowhiletrue');
  24840. index_each.push(jquery__WEBPACK_IMPORTED_MODULE_0___default()(path_target[i + 1]).find('.command_container').index(path_target[i]));
  24841. } else if (jquery__WEBPACK_IMPORTED_MODULE_0___default()(path_target[i + 1]).hasClass('repeatNtimes')) {
  24842. path_relative.push('repeatNtimes');
  24843. index_each.push(jquery__WEBPACK_IMPORTED_MODULE_0___default()(path_target[i + 1]).find('.command_container').index(path_target[i]));
  24844. } else if (jquery__WEBPACK_IMPORTED_MODULE_0___default()(path_target[i + 1]).hasClass('whiletrue')) {
  24845. path_relative.push('whiletrue');
  24846. index_each.push(jquery__WEBPACK_IMPORTED_MODULE_0___default()(path_target[i + 1]).find('.command_container').index(path_target[i]));
  24847. } else if (jquery__WEBPACK_IMPORTED_MODULE_0___default()(path_target[i + 1]).hasClass('switch')) {
  24848. path_relative.push('switch'); //index_each.push($(path_target[i + 1]).find('.command_container').index(path_target[i]));
  24849. }
  24850. }
  24851. }
  24852. var index_in_block = -1;
  24853. var is_in_else = jquery__WEBPACK_IMPORTED_MODULE_0___default()(evento_drag.item).parent().hasClass('commands_else');
  24854. index_in_block = jquery__WEBPACK_IMPORTED_MODULE_0___default()(evento_drag.item).parent().find('.command_container').index(evento_drag.item);
  24855. var is_in_case_switch = jquery__WEBPACK_IMPORTED_MODULE_0___default()(evento_drag.item).parent().hasClass('case_commands_block');
  24856. var index_case_of_switch = -1;
  24857. if (is_in_case_switch) {
  24858. 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());
  24859. }
  24860. /*console.log('path_relative:');
  24861. console.log(path_relative);
  24862. console.log('index_each:');
  24863. console.log(index_each);
  24864. console.log('index_in_block:');
  24865. console.log(index_in_block);
  24866. console.log('ele está em algum bloco de senão? ');
  24867. console.log(is_in_else);
  24868. console.log('ele está dentro de um case de switch?');
  24869. console.log(is_in_case_switch);
  24870. console.log('qual é o índice do case: ');
  24871. console.log(index_case_of_switch);*/
  24872. // encontrar o elemento na árvore:
  24873. var command_start_point = window.program_obj.functions[function_index].commands[indice_na_raiz];
  24874. var block_to_insert = command_start_point;
  24875. for (var i = 0; i < index_each.length; i++) {
  24876. if (path_relative[i] == "else") {
  24877. block_to_insert = block_to_insert.commands_else[index_each[i]];
  24878. } else if (path_relative[i] == "switch") {} else {
  24879. block_to_insert = block_to_insert.commands_block[index_each[i]];
  24880. }
  24881. } //console.log('command_start_point', command_start_point);
  24882. //console.log('block_to_insert', block_to_insert);
  24883. // agora tem que alocar o comando na árvore, mas considerar as quatro situações:
  24884. // (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.
  24885. if (path_target.length == 0) {
  24886. // soltou na raiz:
  24887. window.program_obj.functions[function_index].commands.splice(evento_drag.newIndex, 0, command_in_drag);
  24888. } else if (is_in_else) {
  24889. if (block_to_insert.commands_else) {
  24890. block_to_insert.commands_else.splice(evento_drag.newIndex, 0, command_in_drag);
  24891. } else {
  24892. block_to_insert.commands_else = [];
  24893. block_to_insert.commands_else.push(command_in_drag);
  24894. }
  24895. } else if (is_in_case_switch) {} else {
  24896. // verificar se tem alguma coisa no bloco:
  24897. if (block_to_insert.commands_block) {
  24898. block_to_insert.commands_block.splice(evento_drag.newIndex, 0, command_in_drag);
  24899. } else {
  24900. block_to_insert.commands_block = [];
  24901. block_to_insert.commands_block.push(command_in_drag);
  24902. }
  24903. }
  24904. window.draging = false;
  24905. renderAlgorithm();
  24906. }
  24907. function prepareDragHandler(evt) {
  24908. window.draging = true;
  24909. var nodes = Array.prototype.slice.call(jquery__WEBPACK_IMPORTED_MODULE_0___default()('.all_functions').children());
  24910. var function_index;
  24911. var function_obj;
  24912. jquery__WEBPACK_IMPORTED_MODULE_0___default()(evt.item).parentsUntil(".all_functions").each(function (index) {
  24913. if (jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).hasClass('function_div')) {
  24914. function_index = nodes.indexOf(this);
  24915. function_obj = window.program_obj.functions[function_index];
  24916. }
  24917. });
  24918. command_in_drag = jquery__WEBPACK_IMPORTED_MODULE_0___default()(evt.item).data("command"); //console.log('$(evt.item).parent(): ');
  24919. //console.log($(evt.item).parent());
  24920. // descobrir qual das quatro situações:
  24921. if (jquery__WEBPACK_IMPORTED_MODULE_0___default()(evt.item).parent().hasClass('commands_list_div')) {
  24922. // está na raiz:
  24923. if (function_obj.commands.indexOf(command_in_drag) > -1) {
  24924. function_obj.commands.splice(function_obj.commands.indexOf(command_in_drag), 1);
  24925. }
  24926. } else if (jquery__WEBPACK_IMPORTED_MODULE_0___default()(evt.item).parent().hasClass('commands_else')) {
  24927. // está no else:
  24928. if (jquery__WEBPACK_IMPORTED_MODULE_0___default()(evt.item).parent().data('command').commands_else.indexOf(command_in_drag) > -1) {
  24929. 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);
  24930. }
  24931. } else if (jquery__WEBPACK_IMPORTED_MODULE_0___default()(evt.item).parent().hasClass('case_commands_block')) {// está em um switch:
  24932. } else {
  24933. // caso padrão:
  24934. if (jquery__WEBPACK_IMPORTED_MODULE_0___default()(evt.item).parent().data('command').commands_block.indexOf(command_in_drag) > -1) {
  24935. 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);
  24936. }
  24937. }
  24938. }
  24939. var command_in_drag;
  24940. function addSortableHandler(element, id_function) {
  24941. var n_group = 'commands_drag_' + id_function;
  24942. Sortable.create(element, {
  24943. handle: '.command_drag',
  24944. ghostClass: 'ghost',
  24945. animation: 300,
  24946. group: {
  24947. name: n_group
  24948. },
  24949. onEnd: function onEnd(evt) {
  24950. //updateSequenceLocals(evt.oldIndex, evt.newIndex, function_obj);
  24951. var itemEl = evt.item; // dragged HTMLElement
  24952. evt.to; // target list
  24953. evt.from; // previous list
  24954. evt.oldIndex; // element's old index within old parent
  24955. evt.newIndex; // element's new index within new parent
  24956. //console.log('::EVT::');
  24957. //console.log(evt);
  24958. window.evento_drag = evt;
  24959. try {
  24960. updateProgramObjDrag();
  24961. } catch (e) {
  24962. window.draging = false;
  24963. }
  24964. },
  24965. onStart: function onStart(evt) {
  24966. //console.log("START::EVT::");
  24967. //console.log(evt);
  24968. //console.log("\n\ncommand_in_drag");
  24969. try {
  24970. prepareDragHandler(evt);
  24971. } catch (e) {
  24972. window.draging = false;
  24973. }
  24974. }
  24975. });
  24976. element = jquery__WEBPACK_IMPORTED_MODULE_0___default()(element);
  24977. element.find(".iftrue").each(function (index) {
  24978. addSortableHandler(jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).find(".block_commands")[0], id_function);
  24979. addSortableHandler(jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).find(".block_commands")[1], id_function);
  24980. });
  24981. element.find(".repeatNtimes").each(function (index) {
  24982. addSortableHandler(jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).find(".block_commands")[0], id_function);
  24983. });
  24984. element.find(".dowhiletrue").each(function (index) {
  24985. addSortableHandler(jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).find(".block_commands")[0], id_function);
  24986. });
  24987. element.find(".whiletrue").each(function (index) {
  24988. addSortableHandler(jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).find(".block_commands")[0], id_function);
  24989. });
  24990. element.find(".switch").each(function (index) {
  24991. jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).find(".case_div").each(function (index) {
  24992. addSortableHandler(jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).find(".case_commands_block")[0], id_function);
  24993. });
  24994. });
  24995. }
  24996. function initVisualUI() {
  24997. // MUST USE CONST, LET, OR VAR !!!!!!
  24998. var mainDiv = jquery__WEBPACK_IMPORTED_MODULE_0___default()('#visual-main-div'); // fill mainDiv with functions and globals...
  24999. // renderAlgorithm()...
  25000. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.add_function_button').on('click', function () {
  25001. addFunctionHandler();
  25002. });
  25003. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.add_global_button').on('click', function () {
  25004. window.insertContext = true;
  25005. _globals__WEBPACK_IMPORTED_MODULE_4__["addGlobal"](program, true);
  25006. });
  25007. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.run_button').on('click', function () {
  25008. runCode();
  25009. });
  25010. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.visual_coding_button').on('click', function () {
  25011. toggleVisualCoding();
  25012. });
  25013. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.textual_coding_button').on('click', function () {
  25014. toggleTextualCoding();
  25015. });
  25016. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.assessment').on('click', function () {
  25017. runCodeAssessment();
  25018. is_iassign = true;
  25019. });
  25020. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.div_toggle_console').on('click', function () {
  25021. toggleConsole();
  25022. });
  25023. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.expand_button').on('click', function () {
  25024. full_screen();
  25025. });
  25026. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.help_button').on('click', function () {
  25027. window.open('https://www.usp.br/line/ivprog/', '_blank');
  25028. });
  25029. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.main_title h2').prop('title', _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_ivprog_description'));
  25030. }
  25031. var is_iassign = false;
  25032. jquery__WEBPACK_IMPORTED_MODULE_0___default()(document).ready(function () {
  25033. var time_show = 750;
  25034. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.visual_coding_button').popup({
  25035. content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI("tooltip_visual"),
  25036. delay: {
  25037. show: time_show,
  25038. hide: 0
  25039. }
  25040. });
  25041. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.textual_coding_button').popup({
  25042. content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI("tooltip_textual"),
  25043. delay: {
  25044. show: time_show,
  25045. hide: 0
  25046. }
  25047. });
  25048. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.upload_file_button').popup({
  25049. content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI("tooltip_upload"),
  25050. delay: {
  25051. show: time_show,
  25052. hide: 0
  25053. }
  25054. });
  25055. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.download_file_button').popup({
  25056. content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI("tooltip_download"),
  25057. delay: {
  25058. show: time_show,
  25059. hide: 0
  25060. }
  25061. });
  25062. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.undo_button').popup({
  25063. content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI("tooltip_undo"),
  25064. delay: {
  25065. show: time_show,
  25066. hide: 0
  25067. }
  25068. });
  25069. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.redo_button').popup({
  25070. content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI("tooltip_redo"),
  25071. delay: {
  25072. show: time_show,
  25073. hide: 0
  25074. }
  25075. });
  25076. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.run_button').popup({
  25077. content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI("tooltip_run"),
  25078. delay: {
  25079. show: time_show,
  25080. hide: 0
  25081. }
  25082. });
  25083. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.assessment_button').popup({
  25084. content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI("tooltip_evaluate"),
  25085. delay: {
  25086. show: time_show,
  25087. hide: 0
  25088. }
  25089. });
  25090. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.help_button').popup({
  25091. content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI("tooltip_help") + ' - ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI("text_ivprog_version") + ' ' + ivprog_version,
  25092. delay: {
  25093. show: time_show,
  25094. hide: 0
  25095. }
  25096. });
  25097. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.add_global_button').popup({
  25098. content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI("tooltip_add_global"),
  25099. delay: {
  25100. show: time_show,
  25101. hide: 0
  25102. }
  25103. });
  25104. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.div_toggle_console').popup({
  25105. content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI("tooltip_console"),
  25106. delay: {
  25107. show: time_show,
  25108. hide: 0
  25109. }
  25110. });
  25111. Sortable.create(listWithHandle, {
  25112. handle: '.glyphicon-move',
  25113. animation: 100,
  25114. ghostClass: 'ghost',
  25115. group: 'functions_divs_drag',
  25116. onEnd: function onEnd(evt) {
  25117. updateSequenceFunction(evt.oldIndex, evt.newIndex);
  25118. }
  25119. });
  25120. var listGlobalsHandle = document.getElementById("listGlobalsHandle");
  25121. Sortable.create(listGlobalsHandle, {
  25122. handle: '.ellipsis',
  25123. animation: 100,
  25124. ghostClass: 'ghost',
  25125. group: 'globals_divs_drag',
  25126. onEnd: function onEnd(evt) {
  25127. updateSequenceGlobals(evt.oldIndex, evt.newIndex);
  25128. }
  25129. });
  25130. });
  25131. function updateSequenceParameters(oldIndex, newIndex, function_obj) {
  25132. function_obj.parameters_list.splice(newIndex, 0, function_obj.parameters_list.splice(oldIndex, 1)[0]);
  25133. }
  25134. function updateSequenceLocals(oldIndex, newIndex, function_obj) {
  25135. function_obj.variables_list.splice(newIndex, 0, function_obj.variables_list.splice(oldIndex, 1)[0]);
  25136. }
  25137. function updateSequenceGlobals(oldIndex, newIndex) {
  25138. program_obj.globals.splice(newIndex, 0, program_obj.globals.splice(oldIndex, 1)[0]);
  25139. }
  25140. function updateSequenceFunction(oldIndex, newIndex) {
  25141. program_obj.functions.splice(newIndex, 0, program_obj.functions.splice(oldIndex, 1)[0]);
  25142. }
  25143. function runCodeAssessment() {
  25144. window.studentGrade = null;
  25145. var strCode = _code_generator__WEBPACK_IMPORTED_MODULE_7__["generate"]();
  25146. if (strCode == null) {
  25147. return;
  25148. }
  25149. toggleConsole(true);
  25150. if (domConsole == null) domConsole = new _io_domConsole__WEBPACK_IMPORTED_MODULE_9__["DOMConsole"]("#ivprog-term");
  25151. jquery__WEBPACK_IMPORTED_MODULE_0___default()("#ivprog-term").slideDown(500);
  25152. var runner = new _assessment_ivprogAssessment__WEBPACK_IMPORTED_MODULE_14__["IVProgAssessment"](strCode, testCases, domConsole);
  25153. runner.runTest().then(function (grade) {
  25154. if (!is_iassign) {
  25155. parent.getEvaluationCallback(grade);
  25156. } else {
  25157. is_iassign = false;
  25158. }
  25159. }).catch(function (err) {
  25160. return console.log(err);
  25161. });
  25162. }
  25163. function runCode() {
  25164. var strCode = _code_generator__WEBPACK_IMPORTED_MODULE_7__["generate"]();
  25165. if (strCode == null) {
  25166. return;
  25167. }
  25168. toggleConsole(true);
  25169. if (domConsole == null) domConsole = new _io_domConsole__WEBPACK_IMPORTED_MODULE_9__["DOMConsole"]("#ivprog-term");
  25170. jquery__WEBPACK_IMPORTED_MODULE_0___default()("#ivprog-term").slideDown(500);
  25171. try {
  25172. var parser = _ast_ivprogParser__WEBPACK_IMPORTED_MODULE_10__["IVProgParser"].createParser(strCode);
  25173. var analyser = new _processor_semantic_semanticAnalyser__WEBPACK_IMPORTED_MODULE_13__["SemanticAnalyser"](parser.parseTree());
  25174. var data = analyser.analyseTree();
  25175. var proc = new _processor_ivprogProcessor__WEBPACK_IMPORTED_MODULE_11__["IVProgProcessor"](data);
  25176. proc.registerInput(domConsole);
  25177. proc.registerOutput(domConsole);
  25178. jquery__WEBPACK_IMPORTED_MODULE_0___default()("#ivprog-term").addClass('ivprog-term-active');
  25179. proc.interpretAST().then(function (_) {
  25180. domConsole.info("Programa executado com sucesso!");
  25181. jquery__WEBPACK_IMPORTED_MODULE_0___default()("#ivprog-term").removeClass('ivprog-term-active');
  25182. }).catch(function (err) {
  25183. domConsole.err(err.message);
  25184. jquery__WEBPACK_IMPORTED_MODULE_0___default()("#ivprog-term").removeClass('ivprog-term-active');
  25185. });
  25186. } catch (error) {
  25187. domConsole.err(error.message);
  25188. console.log(error);
  25189. }
  25190. }
  25191. function toggleConsole(is_running) {
  25192. if (is_running) {
  25193. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.ivprog-term-div').css('display', 'block');
  25194. jquery__WEBPACK_IMPORTED_MODULE_0___default()('#ivprog-term').css('min-height', '160px');
  25195. jquery__WEBPACK_IMPORTED_MODULE_0___default()('#ivprog-term').css('margin-top', '-170px');
  25196. return;
  25197. }
  25198. if (jquery__WEBPACK_IMPORTED_MODULE_0___default()('#ivprog-term').css('min-height') == '160px') {
  25199. // esconder
  25200. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.ivprog-term-div').css('display', 'none');
  25201. jquery__WEBPACK_IMPORTED_MODULE_0___default()('#ivprog-term').css('min-height', '0');
  25202. jquery__WEBPACK_IMPORTED_MODULE_0___default()('#ivprog-term').css('margin-top', '-30px');
  25203. jquery__WEBPACK_IMPORTED_MODULE_0___default()('#ivprog-term').css('padding', '5px');
  25204. } else {
  25205. // mostrar
  25206. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.ivprog-term-div').css('display', 'block');
  25207. jquery__WEBPACK_IMPORTED_MODULE_0___default()('#ivprog-term').css('min-height', '160px');
  25208. jquery__WEBPACK_IMPORTED_MODULE_0___default()('#ivprog-term').css('margin-top', '-170px');
  25209. }
  25210. }
  25211. function waitToCloseConsole() {
  25212. domConsole.info("Aperte qualquer tecla para fechar...");
  25213. var p = new Promise(function (resolve, _) {
  25214. domConsole.requestInput(resolve, true);
  25215. });
  25216. p.then(function (_) {
  25217. domConsole.dispose();
  25218. domConsole = null;
  25219. jquery__WEBPACK_IMPORTED_MODULE_0___default()("#ivprog-term").hide();
  25220. });
  25221. }
  25222. function toggleTextualCoding() {
  25223. var code = _code_generator__WEBPACK_IMPORTED_MODULE_7__["generate"]();
  25224. if (code == null) {
  25225. return;
  25226. }
  25227. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.ivprog_visual_panel').css('display', 'none');
  25228. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.ivprog_textual_panel').css('display', 'block');
  25229. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.ivprog_textual_panel').removeClass('loading');
  25230. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.ivprog_textual_code').text(code);
  25231. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.visual_coding_button').removeClass('active');
  25232. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.textual_coding_button').addClass('active');
  25233. }
  25234. function toggleVisualCoding() {
  25235. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.ivprog_textual_panel').addClass('loading');
  25236. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.ivprog_textual_panel').css('display', 'none');
  25237. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.ivprog_visual_panel').css('display', 'block');
  25238. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.textual_coding_button').removeClass('active');
  25239. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.visual_coding_button').addClass('active');
  25240. }
  25241. function removeParameter(function_obj, parameter_obj, parameter_container) {
  25242. var index = function_obj.parameters_list.indexOf(parameter_obj);
  25243. if (index > -1) {
  25244. window.insertContext = true;
  25245. function_obj.parameters_list.splice(index, 1);
  25246. }
  25247. jquery__WEBPACK_IMPORTED_MODULE_0___default()(parameter_container).fadeOut();
  25248. }
  25249. function updateParameterType(parameter_obj, new_type) {
  25250. var new_dimensions = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
  25251. parameter_obj.type = new_type;
  25252. parameter_obj.dimensions = new_dimensions;
  25253. if (new_dimensions > 0) {
  25254. parameter_obj.rows = new_dimensions;
  25255. parameter_obj.columns = 2;
  25256. }
  25257. }
  25258. function renderParameter(function_obj, parameter_obj, function_container) {
  25259. var ret = "";
  25260. ret += '<div class="ui label function_name_parameter pink"><i class="ui icon ellipsis vertical inverted"></i>';
  25261. ret += '<div class="ui dropdown parameter_type">';
  25262. if (parameter_obj.dimensions > 0) {
  25263. ret += '<div class="text">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('vector') + ':' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI(parameter_obj.type);
  25264. if (parameter_obj.dimensions == 1) {
  25265. ret += ' [ ] ';
  25266. } else {
  25267. ret += ' [ ] [ ] ';
  25268. }
  25269. ret += '</div>';
  25270. } else {
  25271. ret += '<div class="text">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI(parameter_obj.type) + '</div>';
  25272. }
  25273. ret += '<div class="menu">';
  25274. for (var tm in _types__WEBPACK_IMPORTED_MODULE_1__["Types"]) {
  25275. if (tm == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].VOID.toUpperCase()) {
  25276. continue;
  25277. }
  25278. ret += '<div class="item ' + (parameter_obj.type == tm.toLowerCase() ? ' selected ' : '') + '" data-type="' + tm + '" >' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI(tm.toLowerCase()) + '</div>';
  25279. }
  25280. for (var tm in _types__WEBPACK_IMPORTED_MODULE_1__["Types"]) {
  25281. if (tm == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].VOID.toUpperCase()) {
  25282. continue;
  25283. }
  25284. 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>';
  25285. }
  25286. ret += '</div></div>';
  25287. ret += '<div class="parameter_div_edit"><span class="span_name_parameter label_enable_name_parameter">' + parameter_obj.name + '</span></div> ';
  25288. ret += ' <i class="yellow inverted icon times remove_parameter"></i></div>';
  25289. ret = jquery__WEBPACK_IMPORTED_MODULE_0___default()(ret);
  25290. function_container.find('.container_parameters_list').append(ret);
  25291. ret.find('.remove_parameter').on('click', function (e) {
  25292. removeParameter(function_obj, parameter_obj, ret);
  25293. });
  25294. ret.find('.ui.dropdown.parameter_type').dropdown({
  25295. onChange: function onChange(value, text, $selectedItem) {
  25296. if ($selectedItem.data('dimensions')) {
  25297. updateParameterType(parameter_obj, _types__WEBPACK_IMPORTED_MODULE_1__["Types"][$selectedItem.data('type')], $selectedItem.data('dimensions'));
  25298. } else {
  25299. updateParameterType(parameter_obj, _types__WEBPACK_IMPORTED_MODULE_1__["Types"][$selectedItem.data('type')]);
  25300. }
  25301. },
  25302. selectOnKeydown: false
  25303. });
  25304. ret.find('.label_enable_name_parameter').on('click', function (e) {
  25305. enableNameParameterUpdate(parameter_obj, ret, function_obj);
  25306. });
  25307. return ret;
  25308. }
  25309. function updateParameterName(parameter_var, new_name, parameter_obj_dom, function_obj) {
  25310. if (parameter_var.name == new_name) {
  25311. return;
  25312. }
  25313. if (isValidIdentifier(new_name)) {
  25314. if (variableNameAlreadyExists(new_name, function_obj)) {
  25315. _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'));
  25316. } else {
  25317. parameter_var.name = new_name;
  25318. }
  25319. } else {
  25320. _utils__WEBPACK_IMPORTED_MODULE_16__["renderErrorMessage"](parameter_obj_dom.find('.parameter_div_edit'), _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('inform_valid_name'));
  25321. }
  25322. }
  25323. function variableNameAlreadyExists(name_var, function_obj) {
  25324. if (function_obj.parameters_list) {
  25325. for (var i = 0; i < function_obj.parameters_list.length; i++) {
  25326. if (function_obj.parameters_list[i].name == name_var) {
  25327. return true;
  25328. }
  25329. }
  25330. }
  25331. if (function_obj.variables_list) {
  25332. for (var i = 0; i < function_obj.variables_list.length; i++) {
  25333. if (function_obj.variables_list[i].name == name_var) {
  25334. return true;
  25335. }
  25336. }
  25337. }
  25338. return false;
  25339. }
  25340. function updateFunctionName(function_var, new_name, function_obj_dom) {
  25341. if (function_var.name == new_name) {
  25342. return;
  25343. }
  25344. if (isValidIdentifier(new_name)) {
  25345. if (functionNameAlreadyExists(new_name)) {
  25346. _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'));
  25347. } else {
  25348. function_var.name = new_name;
  25349. }
  25350. } else {
  25351. _utils__WEBPACK_IMPORTED_MODULE_16__["renderErrorMessage"](function_obj_dom.find('.function_name_div'), _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('inform_valid_name'));
  25352. }
  25353. }
  25354. function functionNameAlreadyExists(function_name) {
  25355. for (var i = 0; i < window.program_obj.functions.length; i++) {
  25356. if (window.program_obj.functions[i].name == function_name) {
  25357. return true;
  25358. }
  25359. }
  25360. return false;
  25361. }
  25362. function isValidIdentifier(identifier_str) {
  25363. return /^[a-zA-Z_][a-zA-Z0-9_]*$/.test(identifier_str);
  25364. }
  25365. var opened_name_parameter = false;
  25366. var opened_input_parameter = null;
  25367. function enableNameParameterUpdate(parameter_obj, parent_node, function_obj) {
  25368. if (opened_name_parameter) {
  25369. opened_input_parameter.focus();
  25370. return;
  25371. }
  25372. opened_name_parameter = true;
  25373. parent_node = jquery__WEBPACK_IMPORTED_MODULE_0___default()(parent_node);
  25374. var input_field;
  25375. parent_node.find('.span_name_parameter').text('');
  25376. 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 + "' />");
  25377. input_field.insertBefore(parent_node.find('.span_name_parameter'));
  25378. input_field.on('input', function () {
  25379. var inputWidth = input_field.textWidth() + 10;
  25380. opened_input_parameter = input_field;
  25381. input_field.focus();
  25382. var tmpStr = input_field.val();
  25383. input_field.val('');
  25384. input_field.val(tmpStr);
  25385. input_field.css({
  25386. width: inputWidth
  25387. });
  25388. }).trigger('input');
  25389. input_field.focusout(function () {
  25390. /// update array:
  25391. if (input_field.val().trim()) {
  25392. updateParameterName(parameter_obj, input_field.val().trim(), parent_node, function_obj);
  25393. parent_node.find('.span_name_parameter').text(parameter_obj.name);
  25394. }
  25395. input_field.off();
  25396. input_field.remove(); /// update elements:
  25397. opened_name_parameter = false;
  25398. opened_input_parameter = false;
  25399. });
  25400. input_field.on('keydown', function (e) {
  25401. var code = e.keyCode || e.which;
  25402. if (code == 13) {
  25403. if (input_field.val().trim()) {
  25404. updateParameterName(parameter_obj, input_field.val().trim(), parent_node, function_obj);
  25405. parent_node.find('.span_name_parameter').text(parameter_obj.name);
  25406. }
  25407. input_field.off();
  25408. input_field.remove(); /// update elements:
  25409. opened_name_parameter = false;
  25410. opened_input_parameter = false;
  25411. }
  25412. if (code == 27) {
  25413. parent_node.find('.span_name_parameter').text(parameter_obj.name);
  25414. input_field.off();
  25415. input_field.remove(); /// update elements:
  25416. opened_name_parameter = false;
  25417. opened_input_parameter = false;
  25418. }
  25419. });
  25420. input_field.select();
  25421. }
  25422. var opened_name_function = false;
  25423. var opened_input = null;
  25424. var previousPadding = null;
  25425. function enableNameFunctionUpdate(function_obj, parent_node) {
  25426. if (opened_name_function) {
  25427. opened_input.focus();
  25428. return;
  25429. }
  25430. parent_node = jquery__WEBPACK_IMPORTED_MODULE_0___default()(parent_node);
  25431. parent_node.find('.span_name_function').text('');
  25432. var input_field;
  25433. if (!previousPadding) {
  25434. previousPadding = parent_node.find('.span_name_function').css('padding-left');
  25435. }
  25436. parent_node.find('.span_name_function').css('padding-left', '0');
  25437. parent_node.find('.span_name_function').css('padding-right', '0');
  25438. 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 + "' />");
  25439. input_field.insertBefore(parent_node.find('.span_name_function'));
  25440. input_field.on('input', function () {
  25441. var inputWidth = input_field.textWidth() + 10;
  25442. opened_input = input_field;
  25443. input_field.focus();
  25444. var tmpStr = input_field.val();
  25445. input_field.val('');
  25446. input_field.val(tmpStr);
  25447. input_field.css({
  25448. width: inputWidth
  25449. });
  25450. }).trigger('input');
  25451. input_field.focusout(function () {
  25452. /// update array:
  25453. if (input_field.val().trim()) {
  25454. updateFunctionName(function_obj, input_field.val().trim(), parent_node);
  25455. }
  25456. input_field.off();
  25457. input_field.remove();
  25458. parent_node.find('.span_name_function').css('padding-left', previousPadding);
  25459. parent_node.find('.span_name_function').css('padding-right', previousPadding);
  25460. parent_node.find('.span_name_function').text(function_obj.name); /// update elements:
  25461. opened_name_function = false;
  25462. opened_input = false;
  25463. });
  25464. input_field.on('keydown', function (e) {
  25465. var code = e.keyCode || e.which;
  25466. if (code == 13) {
  25467. if (input_field.val().trim()) {
  25468. updateFunctionName(function_obj, input_field.val().trim(), parent_node);
  25469. }
  25470. input_field.off();
  25471. input_field.remove();
  25472. parent_node.find('.span_name_function').css('padding-left', previousPadding);
  25473. parent_node.find('.span_name_function').css('padding-right', previousPadding);
  25474. parent_node.find('.span_name_function').text(function_obj.name); /// update elements:
  25475. opened_name_function = false;
  25476. opened_input = false;
  25477. }
  25478. if (code == 27) {
  25479. input_field.off();
  25480. input_field.remove();
  25481. parent_node.find('.span_name_function').css('padding-left', previousPadding);
  25482. parent_node.find('.span_name_function').css('padding-right', previousPadding);
  25483. parent_node.find('.span_name_function').text(function_obj.name); /// update elements:
  25484. opened_name_function = false;
  25485. opened_input = false;
  25486. }
  25487. });
  25488. input_field.select();
  25489. }
  25490. function addFunctionChangeListener(callback) {
  25491. functionsChangeListeners.push(callback);
  25492. return functionsChangeListeners.length - 1;
  25493. }
  25494. function addGlobalChangeListener(callback) {
  25495. globalChangeListeners.push(callback);
  25496. return globalChangeListeners.length - 1;
  25497. }
  25498. function removeGlobalListener(index) {
  25499. globalChangeListeners.splice(index, 1);
  25500. }
  25501. function removeFunctionListener(index) {
  25502. functionsChangeListeners.splice(index);
  25503. }
  25504. /***/ }),
  25505. /***/ "./js/visualUI/globals.js":
  25506. /*!********************************!*\
  25507. !*** ./js/visualUI/globals.js ***!
  25508. \********************************/
  25509. /*! exports provided: addGlobal, renderGlobal */
  25510. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  25511. "use strict";
  25512. __webpack_require__.r(__webpack_exports__);
  25513. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "addGlobal", function() { return addGlobal; });
  25514. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "renderGlobal", function() { return renderGlobal; });
  25515. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  25516. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_0__);
  25517. /* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./types */ "./js/visualUI/types.js");
  25518. /* harmony import */ var _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  25519. /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  25520. /* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./utils */ "./js/visualUI/utils.js");
  25521. /* harmony import */ var _semantic_semantic_min_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../semantic/semantic.min.js */ "./js/semantic/semantic.min.js");
  25522. /* harmony import */ var _semantic_semantic_min_js__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_semantic_semantic_min_js__WEBPACK_IMPORTED_MODULE_5__);
  25523. window.jQuery = jquery__WEBPACK_IMPORTED_MODULE_0___default.a;
  25524. var counter_new_globals = 0;
  25525. function addGlobal(program) {
  25526. var is_from_click = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  25527. 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);
  25528. counter_new_globals++;
  25529. program.addGlobal(new_global);
  25530. var newe = renderGlobal(new_global);
  25531. if (is_from_click) {
  25532. newe.css('display', 'none');
  25533. newe.fadeIn();
  25534. }
  25535. }
  25536. function toggleConstant(global_var) {
  25537. global_var.is_constant = !global_var.is_constant;
  25538. }
  25539. function updateName(global_var, new_name, global_obj_dom) {
  25540. if (global_var.name == new_name) {
  25541. return;
  25542. }
  25543. if (isValidIdentifier(new_name)) {
  25544. if (globalNameAlreadyExists(new_name)) {
  25545. _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'));
  25546. } else {
  25547. global_var.name = new_name;
  25548. }
  25549. } else {
  25550. _utils__WEBPACK_IMPORTED_MODULE_4__["renderErrorMessage"](global_obj_dom.find('.editing_name_var'), _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('inform_valid_name'));
  25551. }
  25552. }
  25553. function globalNameAlreadyExists(global_name) {
  25554. for (var i = 0; i < window.program_obj.globals.length; i++) {
  25555. if (window.program_obj.globals[i].name == global_name) {
  25556. return true;
  25557. }
  25558. }
  25559. return false;
  25560. }
  25561. function isValidIdentifier(identifier_str) {
  25562. return /^[a-zA-Z_][a-zA-Z0-9_]*$/.test(identifier_str);
  25563. }
  25564. function updateType(global_var, new_type) {
  25565. var new_dimensions = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
  25566. global_var.type = new_type;
  25567. global_var.dimensions = new_dimensions;
  25568. if (new_dimensions > 0) {
  25569. global_var.rows = new_dimensions;
  25570. global_var.columns = 2;
  25571. }
  25572. updateInitialValues(global_var);
  25573. }
  25574. function removeGlobal(global_var, global_container) {
  25575. var index = window.program_obj.globals.indexOf(global_var);
  25576. if (index > -1) {
  25577. window.insertContext = true;
  25578. window.program_obj.globals.splice(index, 1);
  25579. }
  25580. global_container.children().off();
  25581. global_container.off();
  25582. global_container.fadeOut();
  25583. }
  25584. function updateInitialValues(global_var) {
  25585. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].INTEGER) {
  25586. if (global_var.dimensions == 0) {
  25587. global_var.value = 1;
  25588. }
  25589. if (global_var.dimensions == 1) {
  25590. global_var.value = [1, 1];
  25591. }
  25592. if (global_var.dimensions == 2) {
  25593. global_var.value = [[1, 1], [1, 1]];
  25594. }
  25595. }
  25596. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  25597. if (global_var.dimensions == 0) {
  25598. global_var.value = 1.0;
  25599. }
  25600. if (global_var.dimensions == 1) {
  25601. global_var.value = [1.0, 1.0];
  25602. }
  25603. if (global_var.dimensions == 2) {
  25604. global_var.value = [[1.0, 1.0], [1.0, 1.0]];
  25605. }
  25606. }
  25607. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].TEXT) {
  25608. if (global_var.dimensions == 0) {
  25609. global_var.value = _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_start');
  25610. }
  25611. if (global_var.dimensions == 1) {
  25612. global_var.value = [_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_start'), _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_start')];
  25613. }
  25614. if (global_var.dimensions == 2) {
  25615. 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')]];
  25616. }
  25617. }
  25618. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].BOOLEAN) {
  25619. if (global_var.dimensions == 0) {
  25620. global_var.value = true;
  25621. }
  25622. if (global_var.dimensions == 1) {
  25623. global_var.value = [true, true];
  25624. }
  25625. if (global_var.dimensions == 2) {
  25626. global_var.value = [[true, true], [true, true]];
  25627. }
  25628. }
  25629. }
  25630. function alternateBooleanGlobalValue(global_var, value_container) {
  25631. global_var.value = !global_var.value;
  25632. jquery__WEBPACK_IMPORTED_MODULE_0___default()(value_container).find('.span_value_variable').text(_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI(global_var.value));
  25633. }
  25634. function alternateBooleanGlobalVectorValue(global_var, index, value_container) {
  25635. global_var.value[index] = !global_var.value[index];
  25636. 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]));
  25637. }
  25638. function removeGlobalColumnVector(global_var) {
  25639. if (global_var.columns == 0) {
  25640. return;
  25641. }
  25642. global_var.columns--;
  25643. global_var.value.splice(global_var.value.length - 1, 1);
  25644. }
  25645. function addGlobalColumnVector(global_var) {
  25646. global_var.columns++;
  25647. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].INTEGER) {
  25648. global_var.value.push(1);
  25649. }
  25650. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  25651. global_var.value.push(1.0);
  25652. }
  25653. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].TEXT) {
  25654. global_var.value.push(_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_start'));
  25655. }
  25656. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].BOOLEAN) {
  25657. global_var.value.push(true);
  25658. }
  25659. }
  25660. function removeColumnGlobalMatrix(global_var) {
  25661. if (global_var.columns == 0) {
  25662. return;
  25663. }
  25664. global_var.columns--;
  25665. for (var i = 0; i < global_var.rows; i++) {
  25666. global_var.value[i].splice(global_var.value[i].length - 1, 1);
  25667. }
  25668. }
  25669. function addColumnGlobalMatrix(global_var) {
  25670. global_var.columns++;
  25671. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].INTEGER) {
  25672. for (var i = 0; i < global_var.rows; i++) {
  25673. global_var.value[i].push(1);
  25674. }
  25675. }
  25676. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  25677. for (var i = 0; i < global_var.rows; i++) {
  25678. global_var.value[i].push(1.0);
  25679. }
  25680. }
  25681. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].TEXT) {
  25682. for (var i = 0; i < global_var.rows; i++) {
  25683. global_var.value[i].push(_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_start'));
  25684. }
  25685. }
  25686. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].BOOLEAN) {
  25687. for (var i = 0; i < global_var.rows; i++) {
  25688. global_var.value[i].push(true);
  25689. }
  25690. }
  25691. }
  25692. function removeLineGlobalMatrix(global_var) {
  25693. if (global_var.rows == 0) {
  25694. return;
  25695. }
  25696. global_var.rows--;
  25697. global_var.value.splice(global_var.value.length - 1, 1);
  25698. }
  25699. function addLineGlobalMatrix(global_var) {
  25700. global_var.rows++;
  25701. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].INTEGER) {
  25702. var n_l = [];
  25703. for (var i = 0; i < global_var.columns; i++) {
  25704. n_l.push(1);
  25705. }
  25706. global_var.value.push(n_l);
  25707. }
  25708. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  25709. var n_l = [];
  25710. for (i = 0; i < global_var.columns; i++) {
  25711. n_l.push(1.0);
  25712. }
  25713. global_var.value.push(n_l);
  25714. }
  25715. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].TEXT) {
  25716. var n_l = [];
  25717. for (i = 0; i < global_var.columns; i++) {
  25718. n_l.push(_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_start'));
  25719. }
  25720. global_var.value.push(n_l);
  25721. }
  25722. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].BOOLEAN) {
  25723. var n_l = [];
  25724. for (i = 0; i < global_var.columns; i++) {
  25725. n_l.push(true);
  25726. }
  25727. global_var.value.push(n_l);
  25728. }
  25729. }
  25730. function alternateBooleanGlobalMatrixValue(global_var, row, index, value_container) {
  25731. global_var.value[row][index] = !global_var.value[row][index];
  25732. 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]));
  25733. }
  25734. function renderValues(global_var, global_container) {
  25735. var ret = "";
  25736. var j = 0;
  25737. if (global_var.dimensions == 0) {
  25738. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  25739. ret += '<div class="created_div_valor_var"><span class="span_value_variable simple_var">' + global_var.value.toFixed(1) + '</span> </div> ';
  25740. } else {
  25741. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].BOOLEAN) {
  25742. 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> ';
  25743. } else {
  25744. ret += '<div class="created_div_valor_var"><span class="span_value_variable simple_var">' + global_var.value + '</span> </div> ';
  25745. }
  25746. }
  25747. } else {
  25748. ret += '<table class="tabela_var">';
  25749. if (global_var.dimensions == 1) {
  25750. ret += '<tr>';
  25751. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  25752. for (var k = 0; k < global_var.columns; k++) {
  25753. ret += '<td><span class="span_value_variable vector_var" data-index="' + k + '">' + global_var.value[k].toFixed(1) + '</span></td>';
  25754. }
  25755. } else {
  25756. for (var k = 0; k < global_var.columns; k++) {
  25757. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].BOOLEAN) {
  25758. 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>';
  25759. } else {
  25760. ret += '<td><span class="span_value_variable vector_var" data-index="' + k + '">' + global_var.value[k] + '</span>' + '</td>';
  25761. }
  25762. }
  25763. }
  25764. ret += '</tr>';
  25765. ret += '</table>';
  25766. 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>';
  25767. }
  25768. if (global_var.dimensions == 2) {
  25769. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  25770. for (var l = 0; l < global_var.rows; l++) {
  25771. ret += '<tr>';
  25772. for (var k = 0; k < global_var.columns; k++) {
  25773. ret += '<td><span class="span_value_variable matrix_var" data-index="' + k + '" data-row="' + l + '">' + global_var.value[l][k].toFixed(1) + '</span>' + '</td>';
  25774. }
  25775. ret += '</tr>';
  25776. }
  25777. } else {
  25778. for (var l = 0; l < global_var.rows; l++) {
  25779. ret += '<tr>';
  25780. for (var k = 0; k < global_var.columns; k++) {
  25781. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].BOOLEAN) {
  25782. 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>';
  25783. } else {
  25784. ret += '<td><span class="span_value_variable matrix_var" data-index="' + k + '" data-row="' + l + '">' + global_var.value[l][k] + '</span></td>';
  25785. }
  25786. }
  25787. ret += '</tr>';
  25788. }
  25789. }
  25790. if (global_var.rows == 0) {
  25791. ret += '<tr><td></td></tr>';
  25792. }
  25793. 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>';
  25794. ret += '</table>';
  25795. 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>';
  25796. }
  25797. }
  25798. global_container.find(".div_valor_var").html('');
  25799. ret = jquery__WEBPACK_IMPORTED_MODULE_0___default()(ret);
  25800. ret.find('.span_value_variable').data('associatedOject', global_var);
  25801. ret.find(".boolean_simple_type").on('click', function (e) {
  25802. alternateBooleanGlobalValue(global_var, this.parentNode);
  25803. });
  25804. ret.find(".simple_var").on('click', function (e) {
  25805. enableGlobalValueUpdate(global_var, this.parentNode);
  25806. });
  25807. ret.find(".boolean_vector_var").on('click', function (e) {
  25808. alternateBooleanGlobalVectorValue(global_var, jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).data('index'), this.parentNode);
  25809. });
  25810. ret.find(".vector_var").on('click', function (e) {
  25811. enableGlobalVectorValueUpdate(global_var, jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).data('index'), this.parentNode);
  25812. });
  25813. ret.find(".remove_global_vector_column").on('click', function (e) {
  25814. removeGlobalColumnVector(global_var);
  25815. global_container.find(".div_valor_var").html('');
  25816. renderValues(global_var, global_container);
  25817. });
  25818. ret.find(".add_global_vector_column").on('click', function (e) {
  25819. addGlobalColumnVector(global_var);
  25820. global_container.find(".div_valor_var").html('');
  25821. renderValues(global_var, global_container);
  25822. });
  25823. ret.find(".remove_global_matrix_column").on('click', function (e) {
  25824. removeColumnGlobalMatrix(global_var);
  25825. global_container.find(".div_valor_var").html('');
  25826. renderValues(global_var, global_container);
  25827. });
  25828. ret.find(".add_global_matrix_column").on('click', function (e) {
  25829. addColumnGlobalMatrix(global_var);
  25830. global_container.find(".div_valor_var").html('');
  25831. renderValues(global_var, global_container);
  25832. });
  25833. ret.find(".remove_global_matrix_line").on('click', function (e) {
  25834. removeLineGlobalMatrix(global_var);
  25835. global_container.find(".div_valor_var").html('');
  25836. renderValues(global_var, global_container);
  25837. });
  25838. ret.find(".add_global_matrix_line").on('click', function (e) {
  25839. addLineGlobalMatrix(global_var);
  25840. global_container.find(".div_valor_var").html('');
  25841. renderValues(global_var, global_container);
  25842. });
  25843. ret.find(".boolean_matrix_var").on('click', function (e) {
  25844. alternateBooleanGlobalMatrixValue(global_var, jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).data('row'), jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).data('index'), this.parentNode);
  25845. });
  25846. ret.find(".matrix_var").on('click', function (e) {
  25847. enableGlobalMatrixValueUpdate(global_var, jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).data('row'), jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).data('index'), this.parentNode);
  25848. });
  25849. global_container.find(".div_valor_var").append(ret);
  25850. updateColumnsAndRowsText(global_container, global_var);
  25851. }
  25852. function addHandlers(global_container) {
  25853. var global_var = global_container.data('associatedOject'); // Manage constant option:
  25854. global_container.find(".alternate_constant").on('click', function (e) {
  25855. toggleConstant(global_var);
  25856. jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).removeClass("on off");
  25857. if (global_var.is_constant) {
  25858. jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).addClass("on");
  25859. } else {
  25860. jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).addClass("off");
  25861. }
  25862. }); // Manage global name:
  25863. global_container.find(".enable_edit_name_parameter").on('click', function (e) {
  25864. enableNameUpdate(global_container);
  25865. }); // Menu to change type:
  25866. global_container.find('.ui.dropdown.global_type').dropdown({
  25867. onChange: function onChange(value, text, $selectedItem) {
  25868. if ($selectedItem.data('dimensions')) {
  25869. updateType(global_var, _types__WEBPACK_IMPORTED_MODULE_1__["Types"][$selectedItem.data('type')], $selectedItem.data('dimensions'));
  25870. } else {
  25871. updateType(global_var, _types__WEBPACK_IMPORTED_MODULE_1__["Types"][$selectedItem.data('type')]);
  25872. }
  25873. renderValues(global_var, global_container);
  25874. },
  25875. selectOnKeydown: false
  25876. }); // Remove global:
  25877. global_container.find(".remove_global").on('click', function (e) {
  25878. removeGlobal(global_var, global_container);
  25879. });
  25880. }
  25881. function updateColumnsAndRowsText(global_container, global_var) {
  25882. var prev = global_container.find('.text').text().split('[');
  25883. if (prev.length == 2) {
  25884. var ff = prev[0] + '[ ' + global_var.columns + ' ] ';
  25885. global_container.find('.text').empty();
  25886. global_container.find('.text').text(ff);
  25887. }
  25888. if (prev.length == 3) {
  25889. var ff = prev[0] + '[ ' + global_var.columns + ' ] [ ' + global_var.rows + ' ] ';
  25890. global_container.find('.text').empty();
  25891. global_container.find('.text').text(ff);
  25892. }
  25893. }
  25894. function renderGlobal(global_var) {
  25895. var element = '<div class="ui label global_container pink"><i class="ui icon ellipsis vertical inverted"></i><div class="global_const">const: ';
  25896. element += '<i class="ui icon toggle ' + (global_var.is_constant ? "on" : "off") + ' alternate_constant"></i></div>';
  25897. element += '<div class="ui dropdown global_type">';
  25898. if (global_var.dimensions > 0) {
  25899. element += '<div class="text">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('vector') + ':' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI(global_var.type);
  25900. for (var i = 0; i < global_var.dimensions; i++) {
  25901. element += ' [ <span class="dimensions_' + i + '"></span> ] ';
  25902. }
  25903. element += '</div>';
  25904. } else {
  25905. element += '<div class="text">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI(global_var.type.toLowerCase()) + '</div>';
  25906. }
  25907. element += '<div class="menu">';
  25908. for (var tm in _types__WEBPACK_IMPORTED_MODULE_1__["Types"]) {
  25909. if (tm == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].VOID.toUpperCase()) {
  25910. continue;
  25911. }
  25912. element += '<div class="item ' + (global_var.type == tm.toLowerCase() ? ' selected ' : '') + '" data-type="' + tm + '" >' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI(tm.toLowerCase()) + '</div>';
  25913. }
  25914. for (var tm in _types__WEBPACK_IMPORTED_MODULE_1__["Types"]) {
  25915. if (tm == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].VOID.toUpperCase()) {
  25916. continue;
  25917. }
  25918. 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>';
  25919. }
  25920. 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> ';
  25921. element += '<div class="ui div_valor_var">' + global_var.value + '</div>';
  25922. element += ' <i class="yellow inverted icon times remove_global"></i></div>';
  25923. var complete_element = jquery__WEBPACK_IMPORTED_MODULE_0___default()(element);
  25924. complete_element.data('associatedOject', global_var);
  25925. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.list_globals').append(complete_element);
  25926. addHandlers(complete_element);
  25927. renderValues(global_var, complete_element);
  25928. if (global_var.dimensions == 1) {
  25929. complete_element.find('.dimensions_0').text(global_var.columns);
  25930. }
  25931. if (global_var.dimensions == 2) {
  25932. complete_element.find('.dimensions_0').text(global_var.columns);
  25933. complete_element.find('.dimensions_1').text(global_var.rows);
  25934. }
  25935. return complete_element;
  25936. }
  25937. var opened_name_value_matrix_global_v = false;
  25938. var opened_input_value_matrix_global_v = null;
  25939. function enableGlobalMatrixValueUpdate(global_var, row, index, parent_node) {
  25940. if (opened_name_value_matrix_global_v) {
  25941. opened_input_value_matrix_global_v.focus();
  25942. return;
  25943. }
  25944. parent_node = jquery__WEBPACK_IMPORTED_MODULE_0___default()(parent_node);
  25945. opened_name_value_matrix_global_v = true;
  25946. parent_node.find('.span_value_variable').text('');
  25947. var input_field;
  25948. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  25949. 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) + "' />");
  25950. input_field.insertBefore(parent_node.find('.span_value_variable'));
  25951. } else {
  25952. 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] + "' />");
  25953. input_field.insertBefore(parent_node.find('.span_value_variable'));
  25954. }
  25955. input_field.on('input', function () {
  25956. var inputWidth = input_field.textWidth() + 10;
  25957. opened_input_value_matrix_global_v = input_field;
  25958. input_field.focus();
  25959. var tmpStr = input_field.val();
  25960. input_field.val('');
  25961. input_field.val(tmpStr);
  25962. input_field.css({
  25963. width: inputWidth
  25964. });
  25965. }).trigger('input');
  25966. input_field.focusout(function () {
  25967. /// update array:
  25968. if (input_field.val().trim()) {
  25969. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  25970. global_var.value[row][index] = parseFloat(input_field.val().trim());
  25971. parent_node.find('.span_value_variable').text(global_var.value[row][index].toFixed(1));
  25972. } else {
  25973. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].INTEGER) {
  25974. global_var.value[row][index] = parseInt(input_field.val().trim());
  25975. } else {
  25976. global_var.value[row][index] = input_field.val().trim();
  25977. }
  25978. parent_node.find('.span_value_variable').text(global_var.value[row][index]);
  25979. }
  25980. } else {
  25981. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  25982. parent_node.find('.span_value_variable').text(global_var.value[row][index].toFixed(1));
  25983. } else {
  25984. parent_node.find('.span_value_variable').text(global_var.value[row][index]);
  25985. }
  25986. }
  25987. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].TEXT) {
  25988. global_var.value[row][index] = input_field.val();
  25989. parent_node.find('.span_value_variable').text(global_var.value[row][index]);
  25990. }
  25991. input_field.off();
  25992. input_field.remove(); /// update elements:
  25993. opened_name_value_matrix_global_v = false;
  25994. opened_input_value_matrix_global_v = false;
  25995. });
  25996. input_field.on('keydown', function (e) {
  25997. var code = e.keyCode || e.which;
  25998. if (code == 13) {
  25999. if (input_field.val().trim()) {
  26000. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  26001. global_var.value[row][index] = parseFloat(input_field.val().trim());
  26002. parent_node.find('.span_value_variable').text(global_var.value[row][index].toFixed(1));
  26003. } else {
  26004. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].INTEGER) {
  26005. global_var.value[row][index] = parseInt(input_field.val().trim());
  26006. } else {
  26007. global_var.value[row][index] = input_field.val().trim();
  26008. }
  26009. parent_node.find('.span_value_variable').text(global_var.value[row][index]);
  26010. }
  26011. } else {
  26012. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  26013. parent_node.find('.span_value_variable').text(global_var.value[row][index].toFixed(1));
  26014. } else {
  26015. parent_node.find('.span_value_variable').text(global_var.value[row][index]);
  26016. }
  26017. }
  26018. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].TEXT) {
  26019. global_var.value[row][index] = input_field.val();
  26020. parent_node.find('.span_value_variable').text(global_var.value[row][index]);
  26021. }
  26022. input_field.off();
  26023. input_field.remove(); /// update elements:
  26024. opened_name_value_matrix_global_v = false;
  26025. opened_input_value_matrix_global_v = false;
  26026. }
  26027. if (code == 27) {
  26028. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  26029. parent_node.find('.span_value_variable').text(global_var.value[row][index].toFixed(1));
  26030. } else {
  26031. parent_node.find('.span_value_variable').text(global_var.value[row][index]);
  26032. }
  26033. input_field.off();
  26034. input_field.remove(); /// update elements:
  26035. opened_name_value_matrix_global_v = false;
  26036. opened_input_value_matrix_global_v = false;
  26037. }
  26038. });
  26039. input_field.select();
  26040. }
  26041. var opened_name_value_global_var = false;
  26042. var opened_input_value_global_ar = null;
  26043. function enableGlobalValueUpdate(global_var, parent_node) {
  26044. if (opened_name_value_global_var) {
  26045. opened_input_value_global_ar.focus();
  26046. return;
  26047. }
  26048. parent_node = jquery__WEBPACK_IMPORTED_MODULE_0___default()(parent_node);
  26049. opened_name_value_global_var = true;
  26050. parent_node.find('.span_value_variable').text('');
  26051. var input_field;
  26052. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  26053. 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) + "' />");
  26054. input_field.insertBefore(parent_node.find('.span_value_variable'));
  26055. } else {
  26056. 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 + "' />");
  26057. input_field.insertBefore(parent_node.find('.span_value_variable'));
  26058. }
  26059. input_field.on('input', function () {
  26060. var inputWidth = input_field.textWidth() + 10;
  26061. opened_input_value_global_ar = input_field;
  26062. input_field.focus();
  26063. var tmpStr = input_field.val();
  26064. input_field.val('');
  26065. input_field.val(tmpStr);
  26066. input_field.css({
  26067. width: inputWidth
  26068. });
  26069. }).trigger('input');
  26070. input_field.focusout(function () {
  26071. /// update array:
  26072. if (input_field.val().trim()) {
  26073. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  26074. global_var.value = parseFloat(input_field.val().trim());
  26075. parent_node.find('.span_value_variable').text(global_var.value.toFixed(1));
  26076. } else {
  26077. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].INTEGER) {
  26078. global_var.value = parseInt(input_field.val().trim());
  26079. } else {
  26080. global_var.value = input_field.val().trim();
  26081. }
  26082. parent_node.find('.span_value_variable').text(global_var.value);
  26083. }
  26084. } else {
  26085. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  26086. parent_node.find('.span_value_variable').text(global_var.value.toFixed(1));
  26087. } else {
  26088. parent_node.find('.span_value_variable').text(global_var.value);
  26089. }
  26090. }
  26091. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].TEXT) {
  26092. global_var.value = input_field.val();
  26093. parent_node.find('.span_value_variable').text(global_var.value);
  26094. }
  26095. input_field.off();
  26096. input_field.remove(); /// update elements:
  26097. opened_name_value_global_var = false;
  26098. opened_input_value_global_ar = false;
  26099. });
  26100. input_field.on('keydown', function (e) {
  26101. var code = e.keyCode || e.which;
  26102. if (code == 13) {
  26103. if (input_field.val().trim()) {
  26104. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  26105. global_var.value = parseFloat(input_field.val().trim());
  26106. parent_node.find('.span_value_variable').text(global_var.value.toFixed(1));
  26107. } else {
  26108. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].INTEGER) {
  26109. global_var.value = parseInt(input_field.val().trim());
  26110. } else {
  26111. global_var.value = input_field.val().trim();
  26112. }
  26113. parent_node.find('.span_value_variable').text(global_var.value);
  26114. }
  26115. } else {
  26116. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  26117. parent_node.find('.span_value_variable').text(global_var.value.toFixed(1));
  26118. } else {
  26119. parent_node.find('.span_value_variable').text(global_var.value);
  26120. }
  26121. }
  26122. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].TEXT) {
  26123. global_var.value = input_field.val();
  26124. parent_node.find('.span_value_variable').text(global_var.value);
  26125. }
  26126. input_field.off();
  26127. input_field.remove(); /// update elements:
  26128. opened_name_value_global_var = false;
  26129. opened_input_value_global_ar = false;
  26130. }
  26131. if (code == 27) {
  26132. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  26133. parent_node.find('.span_value_variable').text(global_var.value.toFixed(1));
  26134. } else {
  26135. parent_node.find('.span_value_variable').text(global_var.value);
  26136. }
  26137. input_field.off();
  26138. input_field.remove(); /// update elements:
  26139. opened_name_value_global_var = false;
  26140. opened_input_value_global_ar = false;
  26141. }
  26142. });
  26143. input_field.select();
  26144. }
  26145. var opened_name_global = false;
  26146. var opened_input_global = null;
  26147. function enableNameUpdate(global_container) {
  26148. var global_var = global_container.data('associatedOject');
  26149. if (opened_name_global) {
  26150. opened_input_global.focus();
  26151. return;
  26152. }
  26153. opened_name_global = true;
  26154. global_container.find('.span_name_variable').text('');
  26155. 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 + "' />");
  26156. input_name.insertBefore(global_container.find('.span_name_variable'));
  26157. input_name.on('input', function () {
  26158. var inputWidth = input_name.textWidth() + 10;
  26159. opened_input_global = input_name;
  26160. opened_input_global.focus();
  26161. opened_input_global.css({
  26162. width: inputWidth
  26163. });
  26164. }).trigger('input');
  26165. input_name.focusout(function () {
  26166. /// update array:
  26167. if (input_name.val().trim().length > 0) {
  26168. updateName(global_var, input_name.val().trim(), global_container);
  26169. global_container.find('.span_name_variable').text(global_var.name);
  26170. } else {
  26171. global_container.find('.span_name_variable').text(global_var.name);
  26172. }
  26173. input_name.off();
  26174. input_name.remove(); /// update elements:
  26175. opened_name_global = false;
  26176. opened_input_global = false;
  26177. });
  26178. input_name.on('keydown', function (e) {
  26179. var code = e.keyCode || e.which;
  26180. if (code == 13) {
  26181. if (input_name.val().trim()) {
  26182. updateName(global_var, input_name.val().trim(), global_container);
  26183. global_container.find('.span_name_variable').text(global_var.name);
  26184. } else {
  26185. global_container.find('.span_name_variable').text(global_var.name);
  26186. }
  26187. input_name.off();
  26188. input_name.remove(); /// update elements:
  26189. opened_name_global = false;
  26190. opened_input_global = false;
  26191. }
  26192. if (code == 27) {
  26193. global_container.find('.span_name_variable').text(global_var.name);
  26194. input_name.off();
  26195. input_name.remove(); /// update elements:
  26196. opened_name_global = false;
  26197. opened_input_global = false;
  26198. }
  26199. });
  26200. input_name.select();
  26201. }
  26202. var opened_name_value_vector_global_ = false;
  26203. var opened_input_value_vector_global_ = null;
  26204. function enableGlobalVectorValueUpdate(global_var, index, parent_node) {
  26205. if (opened_name_value_vector_global_) {
  26206. opened_input_value_vector_global_.focus();
  26207. return;
  26208. }
  26209. parent_node = jquery__WEBPACK_IMPORTED_MODULE_0___default()(parent_node);
  26210. opened_name_value_vector_global_ = true;
  26211. parent_node.find('.span_value_variable').text('');
  26212. var input_field;
  26213. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  26214. 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) + "' />");
  26215. input_field.insertBefore(parent_node.find('.span_value_variable'));
  26216. } else {
  26217. 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] + "' />");
  26218. input_field.insertBefore(parent_node.find('.span_value_variable'));
  26219. }
  26220. input_field.on('input', function () {
  26221. var inputWidth = input_field.textWidth() + 10;
  26222. opened_input_value_vector_global_ = input_field;
  26223. input_field.focus();
  26224. var tmpStr = input_field.val();
  26225. input_field.val('');
  26226. input_field.val(tmpStr);
  26227. input_field.css({
  26228. width: inputWidth
  26229. });
  26230. }).trigger('input');
  26231. input_field.focusout(function () {
  26232. /// update array:
  26233. if (input_field.val().trim()) {
  26234. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  26235. global_var.value[index] = parseFloat(input_field.val().trim());
  26236. parent_node.find('.span_value_variable').text(global_var.value[index].toFixed(1));
  26237. } else {
  26238. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].INTEGER) {
  26239. global_var.value[index] = parseInt(input_field.val().trim());
  26240. } else {
  26241. global_var.value[index] = input_field.val().trim();
  26242. }
  26243. parent_node.find('.span_value_variable').text(global_var.value[index]);
  26244. }
  26245. } else {
  26246. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  26247. parent_node.find('.span_value_variable').text(global_var.value[index].toFixed(1));
  26248. } else {
  26249. parent_node.find('.span_value_variable').text(global_var.value[index]);
  26250. }
  26251. }
  26252. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].TEXT) {
  26253. global_var.value[index] = input_field.val();
  26254. parent_node.find('.span_value_variable').text(global_var.value[index]);
  26255. }
  26256. input_field.off();
  26257. input_field.remove(); /// update elements:
  26258. opened_name_value_vector_global_ = false;
  26259. opened_input_value_vector_global_ = false;
  26260. });
  26261. input_field.on('keydown', function (e) {
  26262. var code = e.keyCode || e.which;
  26263. if (code == 13) {
  26264. if (input_field.val().trim()) {
  26265. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  26266. global_var.value[index] = parseFloat(input_field.val().trim());
  26267. parent_node.find('.span_value_variable').text(global_var.value[index].toFixed(1));
  26268. } else {
  26269. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].INTEGER) {
  26270. global_var.value[index] = parseInt(input_field.val().trim());
  26271. } else {
  26272. global_var.value[index] = input_field.val().trim();
  26273. }
  26274. parent_node.find('.span_value_variable').text(global_var.value[index]);
  26275. }
  26276. } else {
  26277. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  26278. parent_node.find('.span_value_variable').text(global_var.value[index].toFixed(1));
  26279. } else {
  26280. parent_node.find('.span_value_variable').text(global_var.value[index]);
  26281. }
  26282. }
  26283. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].TEXT) {
  26284. global_var.value[index] = input_field.val();
  26285. parent_node.find('.span_value_variable').text(global_var.value[index]);
  26286. }
  26287. input_field.off();
  26288. input_field.remove(); /// update elements:
  26289. opened_name_value_vector_global_ = false;
  26290. opened_input_value_vector_global_ = false;
  26291. }
  26292. if (code == 27) {
  26293. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  26294. parent_node.find('.span_value_variable').text(global_var.value[index].toFixed(1));
  26295. } else {
  26296. parent_node.find('.span_value_variable').text(global_var.value[index]);
  26297. }
  26298. input_field.off();
  26299. input_field.remove(); /// update elements:
  26300. opened_name_value_vector_global_ = false;
  26301. opened_input_value_vector_global_ = false;
  26302. }
  26303. });
  26304. input_field.select();
  26305. }
  26306. jquery__WEBPACK_IMPORTED_MODULE_0___default.a.fn.textWidth = function (text, font) {
  26307. 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);
  26308. 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'));
  26309. return jquery__WEBPACK_IMPORTED_MODULE_0___default.a.fn.textWidth.fakeEl.width();
  26310. };
  26311. /***/ }),
  26312. /***/ "./js/visualUI/ivprog_elements.js":
  26313. /*!****************************************!*\
  26314. !*** ./js/visualUI/ivprog_elements.js ***!
  26315. \****************************************/
  26316. /*! 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, ExpressionOperator, ExpressionElement, ConditionalExpression, LogicExpression, ArithmeticExpression, IfTrue, RepeatNTimes, WhileTrue, DoWhileTrue, Switch, Return, SwitchCase, FunctionCall, VariableValueMenu, FunctionCallMenu, Program */
  26317. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  26318. "use strict";
  26319. __webpack_require__.r(__webpack_exports__);
  26320. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "COMMAND_TYPES", function() { return COMMAND_TYPES; });
  26321. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ARITHMETIC_TYPES", function() { return ARITHMETIC_TYPES; });
  26322. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "EXPRESSION_ELEMENTS", function() { return EXPRESSION_ELEMENTS; });
  26323. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "EXPRESSION_TYPES", function() { return EXPRESSION_TYPES; });
  26324. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ARITHMETIC_COMPARISON", function() { return ARITHMETIC_COMPARISON; });
  26325. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "LOGIC_COMPARISON", function() { return LOGIC_COMPARISON; });
  26326. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SYSTEM_FUNCTIONS_CATEGORIES", function() { return SYSTEM_FUNCTIONS_CATEGORIES; });
  26327. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Variable", function() { return Variable; });
  26328. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Function", function() { return Function; });
  26329. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SystemFunction", function() { return SystemFunction; });
  26330. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Comment", function() { return Comment; });
  26331. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Break", function() { return Break; });
  26332. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Reader", function() { return Reader; });
  26333. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Writer", function() { return Writer; });
  26334. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Attribution", function() { return Attribution; });
  26335. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ExpressionOperator", function() { return ExpressionOperator; });
  26336. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ExpressionElement", function() { return ExpressionElement; });
  26337. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ConditionalExpression", function() { return ConditionalExpression; });
  26338. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "LogicExpression", function() { return LogicExpression; });
  26339. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ArithmeticExpression", function() { return ArithmeticExpression; });
  26340. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "IfTrue", function() { return IfTrue; });
  26341. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "RepeatNTimes", function() { return RepeatNTimes; });
  26342. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "WhileTrue", function() { return WhileTrue; });
  26343. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DoWhileTrue", function() { return DoWhileTrue; });
  26344. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Switch", function() { return Switch; });
  26345. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Return", function() { return Return; });
  26346. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SwitchCase", function() { return SwitchCase; });
  26347. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "FunctionCall", function() { return FunctionCall; });
  26348. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "VariableValueMenu", function() { return VariableValueMenu; });
  26349. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "FunctionCallMenu", function() { return FunctionCallMenu; });
  26350. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Program", function() { return Program; });
  26351. /* harmony import */ var _commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./commands/variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  26352. /* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./types */ "./js/visualUI/types.js");
  26353. /* harmony import */ var melanke_watchjs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! melanke-watchjs */ "./node_modules/melanke-watchjs/src/watch.js");
  26354. /* harmony import */ var melanke_watchjs__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(melanke_watchjs__WEBPACK_IMPORTED_MODULE_2__);
  26355. /* harmony import */ var _algorithm__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./algorithm */ "./js/visualUI/algorithm.js");
  26356. 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); } }
  26357. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  26358. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  26359. var COMMAND_TYPES = Object.freeze({
  26360. function: "function",
  26361. comment: "comment",
  26362. reader: "reader",
  26363. writer: "writer",
  26364. attribution: "attribution",
  26365. iftrue: "iftrue",
  26366. repeatNtimes: "repeatNtimes",
  26367. whiletrue: "whiletrue",
  26368. dowhiletrue: "dowhiletrue",
  26369. switch: "switch",
  26370. switchcase: "switchcase",
  26371. functioncall: "functioncall",
  26372. break: "break",
  26373. return: "return"
  26374. });
  26375. var ARITHMETIC_TYPES = Object.freeze({
  26376. plus: "plus",
  26377. minus: "minus",
  26378. multiplication: "multiplication",
  26379. division: "division",
  26380. module: "module",
  26381. none: "none"
  26382. });
  26383. var EXPRESSION_ELEMENTS = Object.freeze({
  26384. exp_op_exp: "exp_op_exp",
  26385. op_exp: "op_exp",
  26386. par_exp_par: "par_exp_par",
  26387. start_point: "start_point"
  26388. });
  26389. var EXPRESSION_TYPES = Object.freeze({
  26390. exp_conditional: "exp_conditional",
  26391. exp_logic: "exp_logic",
  26392. exp_arithmetic: "exp_arithmetic"
  26393. });
  26394. var ARITHMETIC_COMPARISON = Object.freeze({
  26395. greater_than: "greater_than",
  26396. less_than: "less_than",
  26397. equals_to: "equals_to",
  26398. not_equals_to: "not_equals_to",
  26399. greater_than_or_equals_to: "greater_than_or_equals_to",
  26400. less_than_or_equals_to: "less_than_or_equals_to"
  26401. });
  26402. var LOGIC_COMPARISON = Object.freeze({
  26403. equals_to: "equals_to",
  26404. not_equals_to: "not_equals_to",
  26405. and: "and",
  26406. or: "or",
  26407. not: "not"
  26408. });
  26409. var SYSTEM_FUNCTIONS_CATEGORIES = Object.freeze({
  26410. math: "math",
  26411. text: "text_t",
  26412. arrangement: "arrangement",
  26413. conversion: "conversion"
  26414. });
  26415. var Variable = function Variable(type, name, value) {
  26416. var dimensions = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
  26417. var is_constant = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
  26418. var rows = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 0;
  26419. var columns = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : 0;
  26420. _classCallCheck(this, Variable);
  26421. this.type = type;
  26422. this.name = name;
  26423. this.value = value;
  26424. this.dimensions = dimensions;
  26425. this.is_constant = is_constant;
  26426. this.rows = rows;
  26427. this.columns = columns;
  26428. };
  26429. var Function = function Function(name) {
  26430. var return_type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _types__WEBPACK_IMPORTED_MODULE_1__["Types"].VOID;
  26431. var return_dimensions = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
  26432. var parameters_list = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : [];
  26433. var is_main = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
  26434. var is_hidden = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : false;
  26435. var variables_list = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : [];
  26436. var function_comment = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : null;
  26437. var commands = arguments.length > 8 && arguments[8] !== undefined ? arguments[8] : [];
  26438. _classCallCheck(this, Function);
  26439. this.type = COMMAND_TYPES.function;
  26440. this.name = name;
  26441. this.return_type = return_type;
  26442. this.return_dimensions = return_dimensions;
  26443. this.parameters_list = parameters_list;
  26444. this.is_main = is_main;
  26445. this.is_hidden = is_hidden;
  26446. this.variables_list = variables_list;
  26447. this.function_comment = function_comment;
  26448. this.commands = commands;
  26449. };
  26450. var SystemFunction = function SystemFunction(identifier, return_type, return_dimensions, parameters_list) {
  26451. var function_comment = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : null;
  26452. var category = arguments.length > 5 ? arguments[5] : undefined;
  26453. _classCallCheck(this, SystemFunction);
  26454. this.type = COMMAND_TYPES.function;
  26455. this.identifier = identifier;
  26456. this.return_type = return_type;
  26457. this.return_dimensions = return_dimensions;
  26458. this.parameters_list = parameters_list;
  26459. this.function_comment = function_comment;
  26460. this.category = category;
  26461. };
  26462. var Comment = function Comment(comment_text) {
  26463. _classCallCheck(this, Comment);
  26464. this.type = COMMAND_TYPES.comment;
  26465. this.comment_text = comment_text;
  26466. };
  26467. var Break = function Break() {
  26468. _classCallCheck(this, Break);
  26469. this.type = COMMAND_TYPES.break;
  26470. };
  26471. var Reader = function Reader() {
  26472. var variable_value_menu = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : new VariableValueMenu();
  26473. _classCallCheck(this, Reader);
  26474. this.type = COMMAND_TYPES.reader;
  26475. this.variable_value_menu = variable_value_menu;
  26476. };
  26477. var Writer = function Writer(content) {
  26478. _classCallCheck(this, Writer);
  26479. this.type = COMMAND_TYPES.writer;
  26480. this.content = content;
  26481. };
  26482. var Attribution = function Attribution(variable) {
  26483. var expression = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
  26484. _classCallCheck(this, Attribution);
  26485. this.type = COMMAND_TYPES.attribution;
  26486. this.variable = variable;
  26487. this.expression = expression;
  26488. };
  26489. var ExpressionOperator = function ExpressionOperator(type_op, item) {
  26490. _classCallCheck(this, ExpressionOperator);
  26491. this.type_op = type_op; // Logic, Arithmetic OR Relational
  26492. this.item = item;
  26493. };
  26494. var ExpressionElement = function ExpressionElement(type_exp) {
  26495. var itens = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
  26496. _classCallCheck(this, ExpressionElement);
  26497. this.type_exp = type_exp;
  26498. this.itens = itens;
  26499. };
  26500. var ConditionalExpression = function ConditionalExpression(expression) {
  26501. _classCallCheck(this, ConditionalExpression);
  26502. this.type = EXPRESSION_TYPES.exp_conditional;
  26503. this.expression = expression;
  26504. };
  26505. var LogicExpression = function LogicExpression(has_neg, first_operand, second_operand, operator) {
  26506. _classCallCheck(this, LogicExpression);
  26507. this.type = EXPRESSION_TYPES.exp_logic;
  26508. this.has_neg = has_neg;
  26509. this.first_operand = first_operand;
  26510. this.second_operand = second_operand;
  26511. this.operator = operator;
  26512. };
  26513. var ArithmeticExpression = function ArithmeticExpression(first_operand, second_operand, operator) {
  26514. _classCallCheck(this, ArithmeticExpression);
  26515. this.type = EXPRESSION_TYPES.exp_arithmetic;
  26516. this.first_operand = first_operand;
  26517. this.second_operand = second_operand;
  26518. this.operator = operator;
  26519. };
  26520. var IfTrue = function IfTrue(expression, commands_block, commands_else) {
  26521. _classCallCheck(this, IfTrue);
  26522. this.type = COMMAND_TYPES.iftrue;
  26523. this.expression = expression;
  26524. this.commands_block = commands_block;
  26525. this.commands_else = commands_else;
  26526. };
  26527. var RepeatNTimes = function RepeatNTimes(var_attribution, var_incrementation, expression1, expression2, expression3, commands_block) {
  26528. _classCallCheck(this, RepeatNTimes);
  26529. this.type = COMMAND_TYPES.repeatNtimes;
  26530. this.var_attribution = var_attribution;
  26531. this.var_incrementation = var_incrementation;
  26532. this.expression1 = expression1;
  26533. this.expression2 = expression2;
  26534. this.expression3 = expression3;
  26535. this.commands_block = commands_block;
  26536. };
  26537. var WhileTrue = function WhileTrue(expression, commands_block) {
  26538. _classCallCheck(this, WhileTrue);
  26539. this.type = COMMAND_TYPES.whiletrue;
  26540. this.expression = expression;
  26541. this.commands_block = commands_block;
  26542. };
  26543. var DoWhileTrue = function DoWhileTrue(expression, commands_block) {
  26544. _classCallCheck(this, DoWhileTrue);
  26545. this.type = COMMAND_TYPES.dowhiletrue;
  26546. this.expression = expression;
  26547. this.commands_block = commands_block;
  26548. };
  26549. var Switch = function Switch(variable) {
  26550. var cases = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
  26551. _classCallCheck(this, Switch);
  26552. this.type = COMMAND_TYPES.switch;
  26553. this.variable = variable;
  26554. this.cases = cases;
  26555. };
  26556. var Return = function Return(variable_value_menu) {
  26557. _classCallCheck(this, Return);
  26558. this.type = COMMAND_TYPES.return;
  26559. this.variable_value_menu = variable_value_menu;
  26560. };
  26561. var SwitchCase = function SwitchCase(variable_value_menu) {
  26562. var commands_block = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
  26563. _classCallCheck(this, SwitchCase);
  26564. this.type = COMMAND_TYPES.switchcase;
  26565. this.variable_value_menu = variable_value_menu;
  26566. this.commands_block = commands_block;
  26567. };
  26568. var FunctionCall = function FunctionCall(function_called, parameters_list) {
  26569. _classCallCheck(this, FunctionCall);
  26570. this.type = COMMAND_TYPES.functioncall;
  26571. this.function_called = function_called;
  26572. this.parameters_list = parameters_list;
  26573. };
  26574. var VariableValueMenu = function VariableValueMenu() {
  26575. var variable_and_value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 7;
  26576. var content = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
  26577. var row = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
  26578. var column = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
  26579. var include_constant = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : true;
  26580. var dimensions = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 0;
  26581. _classCallCheck(this, VariableValueMenu);
  26582. this.type = "var_value";
  26583. this.variable_and_value = variable_and_value;
  26584. this.content = content;
  26585. this.row = row;
  26586. this.column = column;
  26587. this.include_constant = include_constant;
  26588. this.dimensions = dimensions;
  26589. };
  26590. var FunctionCallMenu = function FunctionCallMenu() {
  26591. var function_called = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
  26592. var parameters_list = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
  26593. _classCallCheck(this, FunctionCallMenu);
  26594. this.type = "function_call";
  26595. this.function_called = function_called;
  26596. this.parameters_list = parameters_list;
  26597. };
  26598. var Program =
  26599. /*#__PURE__*/
  26600. function () {
  26601. function Program() {
  26602. _classCallCheck(this, Program);
  26603. this.functions = [];
  26604. this.globals = [];
  26605. }
  26606. _createClass(Program, [{
  26607. key: "addFunction",
  26608. value: function addFunction(function_to_add) {
  26609. melanke_watchjs__WEBPACK_IMPORTED_MODULE_2___default.a.watch(function_to_add.parameters_list, function () {
  26610. if (window.insertContext) {
  26611. setTimeout(function () {
  26612. _algorithm__WEBPACK_IMPORTED_MODULE_3__["renderAlgorithm"]();
  26613. }, 300);
  26614. window.insertContext = false;
  26615. } else {
  26616. _algorithm__WEBPACK_IMPORTED_MODULE_3__["renderAlgorithm"]();
  26617. }
  26618. }, 1);
  26619. melanke_watchjs__WEBPACK_IMPORTED_MODULE_2___default.a.watch(function_to_add.variables_list, function () {
  26620. if (window.insertContext) {
  26621. setTimeout(function () {
  26622. _algorithm__WEBPACK_IMPORTED_MODULE_3__["renderAlgorithm"]();
  26623. }, 300);
  26624. window.insertContext = false;
  26625. } else {
  26626. _algorithm__WEBPACK_IMPORTED_MODULE_3__["renderAlgorithm"]();
  26627. }
  26628. }, 1);
  26629. this.functions.push(function_to_add);
  26630. }
  26631. }, {
  26632. key: "addVariable",
  26633. value: function addVariable(function_to_receive, variable) {
  26634. if (this.functions[function_to_receive].variable === null) {
  26635. this.functions[function_to_receive].variables_list = [];
  26636. }
  26637. this.functions[function_to_receive].variables_list.push(variable);
  26638. }
  26639. }, {
  26640. key: "addGlobal",
  26641. value: function addGlobal(variable) {
  26642. this.globals.push(variable);
  26643. }
  26644. }]);
  26645. return Program;
  26646. }();
  26647. /***/ }),
  26648. /***/ "./js/visualUI/types.js":
  26649. /*!******************************!*\
  26650. !*** ./js/visualUI/types.js ***!
  26651. \******************************/
  26652. /*! exports provided: Types */
  26653. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  26654. "use strict";
  26655. __webpack_require__.r(__webpack_exports__);
  26656. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Types", function() { return Types; });
  26657. var Types = Object.freeze({
  26658. INTEGER: "integer",
  26659. REAL: "real",
  26660. TEXT: "text",
  26661. BOOLEAN: "boolean",
  26662. VOID: "void"
  26663. });
  26664. /***/ }),
  26665. /***/ "./js/visualUI/utils.js":
  26666. /*!******************************!*\
  26667. !*** ./js/visualUI/utils.js ***!
  26668. \******************************/
  26669. /*! exports provided: renderErrorMessage */
  26670. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  26671. "use strict";
  26672. __webpack_require__.r(__webpack_exports__);
  26673. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "renderErrorMessage", function() { return renderErrorMessage; });
  26674. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  26675. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_0__);
  26676. function renderErrorMessage(dom_obj_target, message_text) {
  26677. dom_obj_target.popup({
  26678. html: '<i class="ui icon inverted exclamation triangle yellow"></i>' + message_text,
  26679. transition: "fade up",
  26680. on: 'click',
  26681. closable: true,
  26682. movePopup: true,
  26683. boundary: window,
  26684. preserve: false,
  26685. target: false,
  26686. className: {
  26687. popup: 'ui popup invalid-identifier'
  26688. },
  26689. onHidden: function onHidden($module) {
  26690. dom_obj_target.popup('destroy');
  26691. }
  26692. }).popup('toggle');
  26693. }
  26694. /***/ }),
  26695. /***/ "./js/visualUI/variables.js":
  26696. /*!**********************************!*\
  26697. !*** ./js/visualUI/variables.js ***!
  26698. \**********************************/
  26699. /*! exports provided: addVariable, renderVariable */
  26700. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  26701. "use strict";
  26702. __webpack_require__.r(__webpack_exports__);
  26703. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "addVariable", function() { return addVariable; });
  26704. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "renderVariable", function() { return renderVariable; });
  26705. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  26706. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_0__);
  26707. /* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./types */ "./js/visualUI/types.js");
  26708. /* harmony import */ var _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  26709. /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  26710. /* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./utils */ "./js/visualUI/utils.js");
  26711. /* harmony import */ var _semantic_semantic_min_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../semantic/semantic.min.js */ "./js/semantic/semantic.min.js");
  26712. /* harmony import */ var _semantic_semantic_min_js__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_semantic_semantic_min_js__WEBPACK_IMPORTED_MODULE_5__);
  26713. window.jQuery = jquery__WEBPACK_IMPORTED_MODULE_0___default.a;
  26714. var counter_new_variables = 0;
  26715. function addVariable(function_obj, function_container) {
  26716. var is_in_click = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  26717. 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);
  26718. if (function_obj.variables_list == null) {
  26719. function_obj.variables_list = [];
  26720. }
  26721. function_obj.variables_list.push(new_var);
  26722. counter_new_variables++;
  26723. var newe = renderVariable(function_container, new_var, function_obj);
  26724. if (is_in_click) {
  26725. newe.css('display', 'none');
  26726. newe.fadeIn();
  26727. }
  26728. }
  26729. function updateName(variable_obj, new_name, variable_obj_dom, function_obj) {
  26730. if (variable_obj.name == new_name) {
  26731. return;
  26732. }
  26733. if (isValidIdentifier(new_name)) {
  26734. if (variableNameAlreadyExists(new_name, function_obj)) {
  26735. _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'));
  26736. } else {
  26737. variable_obj.name = new_name;
  26738. }
  26739. } else {
  26740. _utils__WEBPACK_IMPORTED_MODULE_4__["renderErrorMessage"](variable_obj_dom.find('.editing_name_var'), _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('inform_valid_name'));
  26741. }
  26742. }
  26743. function variableNameAlreadyExists(name_var, function_obj) {
  26744. if (function_obj.parameters_list) {
  26745. for (var i = 0; i < function_obj.parameters_list.length; i++) {
  26746. if (function_obj.parameters_list[i].name == name_var) {
  26747. return true;
  26748. }
  26749. }
  26750. }
  26751. if (function_obj.variables_list) {
  26752. for (var i = 0; i < function_obj.variables_list.length; i++) {
  26753. if (function_obj.variables_list[i].name == name_var) {
  26754. return true;
  26755. }
  26756. }
  26757. }
  26758. return false;
  26759. }
  26760. function isValidIdentifier(identifier_str) {
  26761. return /^[a-zA-Z_][a-zA-Z0-9_]*$/.test(identifier_str);
  26762. }
  26763. function removeVariable(variable_obj, variable_container) {
  26764. var function_associated = variable_container.data('associatedFunction');
  26765. var index = function_associated.variables_list.indexOf(variable_obj);
  26766. if (index > -1) {
  26767. window.insertContext = true;
  26768. delete function_associated.variables_list[index];
  26769. function_associated.variables_list.splice(index, 1);
  26770. }
  26771. variable_container.children().off();
  26772. variable_container.off();
  26773. variable_container.fadeOut();
  26774. }
  26775. function updateType(variable_obj, new_type) {
  26776. var new_dimensions = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
  26777. variable_obj.type = new_type;
  26778. variable_obj.dimensions = new_dimensions;
  26779. if (new_dimensions > 0) {
  26780. variable_obj.rows = new_dimensions;
  26781. variable_obj.columns = 2;
  26782. }
  26783. updateInitialValues(variable_obj);
  26784. }
  26785. function addHandlers(variable_obj, variable_container, function_obj) {
  26786. // Manage variable name:
  26787. variable_container.find(".enable_edit_name_variable").on('click', function (e) {
  26788. enableNameUpdate(variable_obj, variable_container, function_obj);
  26789. }); // Menu to change type:
  26790. variable_container.find('.ui.dropdown.variable_type').dropdown({
  26791. onChange: function onChange(value, text, $selectedItem) {
  26792. if ($selectedItem.data('dimensions')) {
  26793. updateType(variable_obj, _types__WEBPACK_IMPORTED_MODULE_1__["Types"][$selectedItem.data('type')], $selectedItem.data('dimensions'));
  26794. } else {
  26795. updateType(variable_obj, _types__WEBPACK_IMPORTED_MODULE_1__["Types"][$selectedItem.data('type')]);
  26796. }
  26797. renderValues(variable_obj, variable_container);
  26798. },
  26799. selectOnKeydown: false
  26800. }); // Remove variable:
  26801. variable_container.find(".remove_variable").on('click', function (e) {
  26802. removeVariable(variable_obj, variable_container);
  26803. });
  26804. }
  26805. function renderVariable(function_container, new_var, function_obj) {
  26806. var element = '<div class="ui label variable_container pink"><i class="ui icon ellipsis vertical inverted"></i>';
  26807. element += '<div class="ui dropdown variable_type">';
  26808. if (new_var.dimensions > 0) {
  26809. 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());
  26810. for (var i = 0; i < new_var.dimensions; i++) {
  26811. element += ' [ ] ';
  26812. }
  26813. element += '</div>';
  26814. } else {
  26815. element += '<div class="text">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI(new_var.type.toLowerCase()) + '</div>';
  26816. }
  26817. element += '<div class="menu">';
  26818. for (var tm in _types__WEBPACK_IMPORTED_MODULE_1__["Types"]) {
  26819. if (tm == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].VOID.toUpperCase()) {
  26820. continue;
  26821. }
  26822. element += '<div class="item ' + (new_var.type == tm.toLowerCase() ? ' selected ' : '') + '" data-type="' + tm + '" >' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI(tm.toLowerCase()) + '</div>';
  26823. }
  26824. for (var tm in _types__WEBPACK_IMPORTED_MODULE_1__["Types"]) {
  26825. if (tm == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].VOID.toUpperCase()) {
  26826. continue;
  26827. }
  26828. 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>';
  26829. }
  26830. element += '</div></div> ';
  26831. element += '<div class="editing_name_var"><span class="span_name_variable enable_edit_name_variable">' + new_var.name + '</span> </div>';
  26832. element += ' <span class="character_equals"> = </span> <div class="ui div_valor_var">' + new_var.value + '</div>';
  26833. element += ' <i class="yellow inverted icon times remove_variable"></i></div>';
  26834. element = jquery__WEBPACK_IMPORTED_MODULE_0___default()(element);
  26835. element.data('associatedFunction', function_obj);
  26836. function_container.find('.variables_list_div').append(element);
  26837. addHandlers(new_var, element, function_obj);
  26838. renderValues(new_var, element);
  26839. return element;
  26840. }
  26841. function updateColumnsAndRowsText(variable_container, variable_var) {
  26842. var prev = variable_container.find('.text').text().split('[');
  26843. if (prev.length == 2) {
  26844. var ff = prev[0] + '[ ' + variable_var.columns + ' ] ';
  26845. variable_container.find('.text').empty();
  26846. variable_container.find('.text').text(ff);
  26847. }
  26848. if (prev.length == 3) {
  26849. var ff = prev[0] + '[ ' + variable_var.columns + ' ] [ ' + variable_var.rows + ' ] ';
  26850. variable_container.find('.text').empty();
  26851. variable_container.find('.text').text(ff);
  26852. }
  26853. }
  26854. function renderValues(new_var, variable_container) {
  26855. var ret = "";
  26856. var j = 0;
  26857. if (new_var.dimensions == 0) {
  26858. if (new_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  26859. ret += '<div class="created_div_valor_var"><span class="span_value_variable simple_var">' + new_var.value.toFixed(1) + '</span> </div> ';
  26860. } else {
  26861. if (new_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].BOOLEAN) {
  26862. 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> ';
  26863. } else {
  26864. ret += '<div class="created_div_valor_var"><span class="span_value_variable simple_var">' + new_var.value + '</span> </div> ';
  26865. }
  26866. }
  26867. } else {
  26868. ret += '<table class="tabela_var">';
  26869. if (new_var.dimensions == 1) {
  26870. ret += '<tr>';
  26871. if (new_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  26872. for (var k = 0; k < new_var.columns; k++) {
  26873. ret += '<td><span class="span_value_variable vector_var" data-index="' + k + '">' + new_var.value[k].toFixed(1) + '</span></td>';
  26874. }
  26875. } else {
  26876. for (var k = 0; k < new_var.columns; k++) {
  26877. if (new_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].BOOLEAN) {
  26878. 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>';
  26879. } else {
  26880. ret += '<td><span class="span_value_variable vector_var" data-index="' + k + '">' + new_var.value[k] + '</span>' + '</td>';
  26881. }
  26882. }
  26883. }
  26884. ret += '</tr>';
  26885. ret += '</table>';
  26886. 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>';
  26887. }
  26888. if (new_var.dimensions == 2) {
  26889. if (new_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  26890. for (var l = 0; l < new_var.rows; l++) {
  26891. ret += '<tr>';
  26892. for (var k = 0; k < new_var.columns; k++) {
  26893. ret += '<td><span class="span_value_variable matrix_var" data-index="' + k + '" data-row="' + l + '">' + new_var.value[l][k].toFixed(1) + '</span>' + '</td>';
  26894. }
  26895. ret += '</tr>';
  26896. }
  26897. } else {
  26898. for (var l = 0; l < new_var.rows; l++) {
  26899. ret += '<tr>';
  26900. for (var k = 0; k < new_var.columns; k++) {
  26901. if (new_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].BOOLEAN) {
  26902. 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>';
  26903. } else {
  26904. ret += '<td><span class="span_value_variable matrix_var" data-index="' + k + '" data-row="' + l + '">' + new_var.value[l][k] + '</span></td>';
  26905. }
  26906. }
  26907. ret += '</tr>';
  26908. }
  26909. }
  26910. if (new_var.rows == 0) {
  26911. ret += '<tr><td></td></tr>';
  26912. }
  26913. 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>';
  26914. ret += '</table>';
  26915. 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>';
  26916. }
  26917. }
  26918. jquery__WEBPACK_IMPORTED_MODULE_0___default()(variable_container).find(".div_valor_var").html('');
  26919. ret = jquery__WEBPACK_IMPORTED_MODULE_0___default()(ret);
  26920. jquery__WEBPACK_IMPORTED_MODULE_0___default()(ret).find('.span_value_variable').data('associatedOject', new_var);
  26921. jquery__WEBPACK_IMPORTED_MODULE_0___default()(ret).find(".boolean_simple_type").on('click', function (e) {
  26922. alternateBooleanValue(new_var, this.parentNode);
  26923. });
  26924. jquery__WEBPACK_IMPORTED_MODULE_0___default()(ret).find(".simple_var").on('click', function (e) {
  26925. enableValueUpdate(new_var, this.parentNode);
  26926. });
  26927. jquery__WEBPACK_IMPORTED_MODULE_0___default()(ret).find(".boolean_vector_var").on('click', function (e) {
  26928. alternateBooleanVectorValue(new_var, jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).data('index'), this.parentNode);
  26929. });
  26930. jquery__WEBPACK_IMPORTED_MODULE_0___default()(ret).find(".vector_var").on('click', function (e) {
  26931. enableVectorValueUpdate(new_var, jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).data('index'), this.parentNode);
  26932. });
  26933. jquery__WEBPACK_IMPORTED_MODULE_0___default()(ret).find(".remove_global_vector_column").on('click', function (e) {
  26934. removeColumnVector(new_var);
  26935. jquery__WEBPACK_IMPORTED_MODULE_0___default()(variable_container).find(".div_valor_var").html('');
  26936. renderValues(new_var, variable_container);
  26937. });
  26938. jquery__WEBPACK_IMPORTED_MODULE_0___default()(ret).find(".add_global_vector_column").on('click', function (e) {
  26939. addColumnVector(new_var);
  26940. jquery__WEBPACK_IMPORTED_MODULE_0___default()(variable_container).find(".div_valor_var").html('');
  26941. renderValues(new_var, variable_container);
  26942. });
  26943. jquery__WEBPACK_IMPORTED_MODULE_0___default()(ret).find(".remove_global_matrix_column").on('click', function (e) {
  26944. removeColumnMatrix(new_var);
  26945. jquery__WEBPACK_IMPORTED_MODULE_0___default()(variable_container).find(".div_valor_var").html('');
  26946. renderValues(new_var, variable_container);
  26947. });
  26948. jquery__WEBPACK_IMPORTED_MODULE_0___default()(ret).find(".add_global_matrix_column").on('click', function (e) {
  26949. addColumnMatrix(new_var);
  26950. jquery__WEBPACK_IMPORTED_MODULE_0___default()(variable_container).find(".div_valor_var").html('');
  26951. renderValues(new_var, variable_container);
  26952. });
  26953. jquery__WEBPACK_IMPORTED_MODULE_0___default()(ret).find(".remove_global_matrix_line").on('click', function (e) {
  26954. removeLineMatrix(new_var);
  26955. jquery__WEBPACK_IMPORTED_MODULE_0___default()(variable_container).find(".div_valor_var").html('');
  26956. renderValues(new_var, variable_container);
  26957. });
  26958. jquery__WEBPACK_IMPORTED_MODULE_0___default()(ret).find(".add_global_matrix_line").on('click', function (e) {
  26959. addLineMatrix(new_var);
  26960. jquery__WEBPACK_IMPORTED_MODULE_0___default()(variable_container).find(".div_valor_var").html('');
  26961. renderValues(new_var, variable_container);
  26962. });
  26963. jquery__WEBPACK_IMPORTED_MODULE_0___default()(ret).find(".boolean_matrix_var").on('click', function (e) {
  26964. alternateBooleanMatrixValue(new_var, jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).data('row'), jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).data('index'), this.parentNode);
  26965. });
  26966. jquery__WEBPACK_IMPORTED_MODULE_0___default()(ret).find(".matrix_var").on('click', function (e) {
  26967. enableMatrixValueUpdate(new_var, jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).data('row'), jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).data('index'), this.parentNode);
  26968. });
  26969. jquery__WEBPACK_IMPORTED_MODULE_0___default()(variable_container).find(".div_valor_var").append(ret);
  26970. updateColumnsAndRowsText(variable_container, new_var);
  26971. }
  26972. function alternateBooleanMatrixValue(var_obj, row, index, value_container) {
  26973. var_obj.value[row][index] = !var_obj.value[row][index];
  26974. 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]));
  26975. }
  26976. function addLineMatrix(var_obj) {
  26977. var_obj.rows++;
  26978. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].INTEGER) {
  26979. var n_l = [];
  26980. for (var i = 0; i < var_obj.columns; i++) {
  26981. n_l.push(1);
  26982. }
  26983. var_obj.value.push(n_l);
  26984. }
  26985. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  26986. var n_l = [];
  26987. for (i = 0; i < var_obj.columns; i++) {
  26988. n_l.push(1.0);
  26989. }
  26990. var_obj.value.push(n_l);
  26991. }
  26992. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].TEXT) {
  26993. var n_l = [];
  26994. for (i = 0; i < var_obj.columns; i++) {
  26995. n_l.push(_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_start'));
  26996. }
  26997. var_obj.value.push(n_l);
  26998. }
  26999. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].BOOLEAN) {
  27000. var n_l = [];
  27001. for (i = 0; i < var_obj.columns; i++) {
  27002. n_l.push(true);
  27003. }
  27004. var_obj.value.push(n_l);
  27005. }
  27006. }
  27007. function removeLineMatrix(var_obj) {
  27008. if (var_obj.rows == 0) {
  27009. return;
  27010. }
  27011. var_obj.rows--;
  27012. var_obj.value.splice(var_obj.value.length - 1, 1);
  27013. }
  27014. function addColumnMatrix(var_obj) {
  27015. var_obj.columns++;
  27016. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].INTEGER) {
  27017. for (var i = 0; i < var_obj.rows; i++) {
  27018. var_obj.value[i].push(1);
  27019. }
  27020. }
  27021. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  27022. for (var i = 0; i < var_obj.rows; i++) {
  27023. var_obj.value[i].push(1.0);
  27024. }
  27025. }
  27026. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].TEXT) {
  27027. for (var i = 0; i < var_obj.rows; i++) {
  27028. var_obj.value[i].push(_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_start'));
  27029. }
  27030. }
  27031. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].BOOLEAN) {
  27032. for (var i = 0; i < var_obj.rows; i++) {
  27033. var_obj.value[i].push(true);
  27034. }
  27035. }
  27036. }
  27037. function removeColumnMatrix(var_obj) {
  27038. if (var_obj.columns == 0) {
  27039. return;
  27040. }
  27041. var_obj.columns--;
  27042. for (var i = 0; i < var_obj.rows; i++) {
  27043. var_obj.value[i].splice(var_obj.value[i].length - 1, 1);
  27044. }
  27045. }
  27046. function addColumnVector(var_obj) {
  27047. var_obj.columns++;
  27048. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].INTEGER) {
  27049. var_obj.value.push(1);
  27050. }
  27051. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  27052. var_obj.value.push(1.0);
  27053. }
  27054. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].TEXT) {
  27055. var_obj.value.push(_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_start'));
  27056. }
  27057. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].BOOLEAN) {
  27058. var_obj.value.push(true);
  27059. }
  27060. }
  27061. function removeColumnVector(var_obj) {
  27062. if (var_obj.columns == 0) {
  27063. return;
  27064. }
  27065. var_obj.columns--;
  27066. var_obj.value.splice(var_obj.value.length - 1, 1);
  27067. }
  27068. function alternateBooleanValue(var_obj, value_container) {
  27069. var_obj.value = !var_obj.value;
  27070. jquery__WEBPACK_IMPORTED_MODULE_0___default()(value_container).find('.span_value_variable').text(_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI(var_obj.value));
  27071. }
  27072. function alternateBooleanVectorValue(var_obj, index, value_container) {
  27073. var_obj.value[index] = !var_obj.value[index];
  27074. 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]));
  27075. }
  27076. function updateInitialValues(variable_obj) {
  27077. if (variable_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].INTEGER) {
  27078. if (variable_obj.dimensions == 0) {
  27079. variable_obj.value = 1;
  27080. }
  27081. if (variable_obj.dimensions == 1) {
  27082. variable_obj.value = [1, 1];
  27083. }
  27084. if (variable_obj.dimensions == 2) {
  27085. variable_obj.value = [[1, 1], [1, 1]];
  27086. }
  27087. }
  27088. if (variable_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  27089. if (variable_obj.dimensions == 0) {
  27090. variable_obj.value = 1.0;
  27091. }
  27092. if (variable_obj.dimensions == 1) {
  27093. variable_obj.value = [1.0, 1.0];
  27094. }
  27095. if (variable_obj.dimensions == 2) {
  27096. variable_obj.value = [[1.0, 1.0], [1.0, 1.0]];
  27097. }
  27098. }
  27099. if (variable_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].TEXT) {
  27100. if (variable_obj.dimensions == 0) {
  27101. variable_obj.value = _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_start');
  27102. }
  27103. if (variable_obj.dimensions == 1) {
  27104. variable_obj.value = [_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_start'), _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_start')];
  27105. }
  27106. if (variable_obj.dimensions == 2) {
  27107. 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')]];
  27108. }
  27109. }
  27110. if (variable_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].BOOLEAN) {
  27111. if (variable_obj.dimensions == 0) {
  27112. variable_obj.value = true;
  27113. }
  27114. if (variable_obj.dimensions == 1) {
  27115. variable_obj.value = [true, true];
  27116. }
  27117. if (variable_obj.dimensions == 2) {
  27118. variable_obj.value = [[true, true], [true, true]];
  27119. }
  27120. }
  27121. }
  27122. var opened_name_value_vector_global_ = false;
  27123. var opened_input_value_vector_global_ = null;
  27124. function enableVectorValueUpdate(var_obj, index, parent_node) {
  27125. if (opened_name_value_vector_global_) {
  27126. opened_input_value_vector_global_.focus();
  27127. return;
  27128. }
  27129. parent_node = jquery__WEBPACK_IMPORTED_MODULE_0___default()(parent_node);
  27130. opened_name_value_vector_global_ = true;
  27131. parent_node.find('.span_value_variable').text('');
  27132. var input_field;
  27133. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  27134. 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) + "' />");
  27135. input_field.insertBefore(parent_node.find('.span_value_variable'));
  27136. } else {
  27137. 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] + "' />");
  27138. input_field.insertBefore(parent_node.find('.span_value_variable'));
  27139. }
  27140. input_field.on('input', function () {
  27141. var inputWidth = input_field.textWidth() + 10;
  27142. opened_input_value_vector_global_ = input_field;
  27143. input_field.focus();
  27144. var tmpStr = input_field.val();
  27145. input_field.val('');
  27146. input_field.val(tmpStr);
  27147. input_field.css({
  27148. width: inputWidth
  27149. });
  27150. }).trigger('input');
  27151. input_field.focusout(function () {
  27152. /// update array:
  27153. if (input_field.val().trim()) {
  27154. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  27155. var_obj.value[index] = parseFloat(input_field.val().trim());
  27156. parent_node.find('.span_value_variable').text(var_obj.value[index].toFixed(1));
  27157. } else {
  27158. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].INTEGER) {
  27159. var_obj.value[index] = parseInt(input_field.val().trim());
  27160. } else {
  27161. var_obj.value[index] = input_field.val().trim();
  27162. }
  27163. parent_node.find('.span_value_variable').text(var_obj.value[index]);
  27164. }
  27165. } else {
  27166. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  27167. parent_node.find('.span_value_variable').text(var_obj.value[index].toFixed(1));
  27168. } else {
  27169. parent_node.find('.span_value_variable').text(var_obj.value[index]);
  27170. }
  27171. }
  27172. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].TEXT) {
  27173. var_obj.value[index] = input_field.val();
  27174. parent_node.find('.span_value_variable').text(var_obj.value[index]);
  27175. }
  27176. input_field.off();
  27177. input_field.remove(); /// update elements:
  27178. opened_name_value_vector_global_ = false;
  27179. opened_input_value_vector_global_ = false;
  27180. });
  27181. input_field.on('keydown', function (e) {
  27182. var code = e.keyCode || e.which;
  27183. if (code == 13) {
  27184. if (input_field.val().trim()) {
  27185. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  27186. var_obj.value[index] = parseFloat(input_field.val().trim());
  27187. parent_node.find('.span_value_variable').text(var_obj.value[index].toFixed(1));
  27188. } else {
  27189. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].INTEGER) {
  27190. var_obj.value[index] = parseInt(input_field.val().trim());
  27191. } else {
  27192. var_obj.value[index] = input_field.val().trim();
  27193. }
  27194. parent_node.find('.span_value_variable').text(var_obj.value[index]);
  27195. }
  27196. } else {
  27197. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  27198. parent_node.find('.span_value_variable').text(var_obj.value[index].toFixed(1));
  27199. } else {
  27200. parent_node.find('.span_value_variable').text(var_obj.value[index]);
  27201. }
  27202. }
  27203. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].TEXT) {
  27204. var_obj.value[index] = input_field.val();
  27205. parent_node.find('.span_value_variable').text(var_obj.value[index]);
  27206. }
  27207. input_field.off();
  27208. input_field.remove(); /// update elements:
  27209. opened_name_value_vector_global_ = false;
  27210. opened_input_value_vector_global_ = false;
  27211. }
  27212. if (code == 27) {
  27213. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  27214. parent_node.find('.span_value_variable').text(var_obj.value[index].toFixed(1));
  27215. } else {
  27216. parent_node.find('.span_value_variable').text(var_obj.value[index]);
  27217. }
  27218. input_field.off();
  27219. input_field.remove(); /// update elements:
  27220. opened_name_value_vector_global_ = false;
  27221. opened_input_value_vector_global_ = false;
  27222. }
  27223. });
  27224. input_field.select();
  27225. }
  27226. var opened_name_value_global_var = false;
  27227. var opened_input_value_global_ar = null;
  27228. function enableValueUpdate(var_obj, parent_node) {
  27229. if (opened_name_value_global_var) {
  27230. opened_input_value_global_ar.focus();
  27231. return;
  27232. }
  27233. parent_node = jquery__WEBPACK_IMPORTED_MODULE_0___default()(parent_node);
  27234. opened_name_value_global_var = true;
  27235. var input_field;
  27236. parent_node.find('.span_value_variable').text('');
  27237. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  27238. 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) + "' />");
  27239. input_field.insertBefore(parent_node.find('.span_value_variable'));
  27240. } else {
  27241. 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 + "' />");
  27242. input_field.insertBefore(parent_node.find('.span_value_variable'));
  27243. }
  27244. input_field.on('input', function () {
  27245. var inputWidth = input_field.textWidth() + 10;
  27246. opened_input_value_global_ar = input_field;
  27247. input_field.focus();
  27248. var tmpStr = input_field.val();
  27249. input_field.val('');
  27250. input_field.val(tmpStr);
  27251. input_field.css({
  27252. width: inputWidth
  27253. });
  27254. }).trigger('input');
  27255. input_field.focusout(function () {
  27256. /// update array:
  27257. if (input_field.val().trim()) {
  27258. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  27259. var_obj.value = parseFloat(input_field.val().trim());
  27260. parent_node.find('.span_value_variable').text(var_obj.value.toFixed(1));
  27261. } else {
  27262. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].INTEGER) {
  27263. var_obj.value = parseInt(input_field.val().trim());
  27264. } else {
  27265. var_obj.value = input_field.val().trim();
  27266. }
  27267. parent_node.find('.span_value_variable').text(var_obj.value);
  27268. }
  27269. } else {
  27270. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  27271. parent_node.find('.span_value_variable').text(var_obj.value.toFixed(1));
  27272. } else {
  27273. parent_node.find('.span_value_variable').text(var_obj.value);
  27274. }
  27275. }
  27276. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].TEXT) {
  27277. var_obj.value = input_field.val();
  27278. parent_node.find('.span_value_variable').text(var_obj.value);
  27279. }
  27280. input_field.off();
  27281. input_field.remove(); /// update elements:
  27282. opened_name_value_global_var = false;
  27283. opened_input_value_global_ar = false;
  27284. });
  27285. input_field.on('keydown', function (e) {
  27286. var code = e.keyCode || e.which;
  27287. if (code == 13) {
  27288. if (input_field.val().trim()) {
  27289. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  27290. var_obj.value = parseFloat(input_field.val().trim());
  27291. parent_node.find('.span_value_variable').text(var_obj.value.toFixed(1));
  27292. } else {
  27293. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].INTEGER) {
  27294. var_obj.value = parseInt(input_field.val().trim());
  27295. } else {
  27296. var_obj.value = input_field.val().trim();
  27297. }
  27298. parent_node.find('.span_value_variable').text(var_obj.value);
  27299. }
  27300. } else {
  27301. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  27302. parent_node.find('.span_value_variable').text(var_obj.value.toFixed(1));
  27303. } else {
  27304. parent_node.find('.span_value_variable').text(var_obj.value);
  27305. }
  27306. }
  27307. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].TEXT) {
  27308. var_obj.value = input_field.val();
  27309. parent_node.find('.span_value_variable').text(var_obj.value);
  27310. }
  27311. input_field.off();
  27312. input_field.remove(); /// update elements:
  27313. opened_name_value_global_var = false;
  27314. opened_input_value_global_ar = false;
  27315. }
  27316. if (code == 27) {
  27317. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  27318. parent_node.find('.span_value_variable').text(var_obj.value.toFixed(1));
  27319. } else {
  27320. parent_node.find('.span_value_variable').text(var_obj.value);
  27321. }
  27322. input_field.off();
  27323. input_field.remove(); /// update elements:
  27324. opened_name_value_global_var = false;
  27325. opened_input_value_global_ar = false;
  27326. }
  27327. });
  27328. input_field.select();
  27329. }
  27330. var opened_name_global = false;
  27331. var opened_input_global = null;
  27332. function enableNameUpdate(variable_obj, variable_container, function_obj) {
  27333. if (opened_name_global) {
  27334. opened_input_global.focus();
  27335. return;
  27336. }
  27337. opened_name_global = true;
  27338. variable_container.find('.span_name_variable').text('');
  27339. var input_name;
  27340. 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 + "' />");
  27341. input_name.insertBefore(variable_container.find('.span_name_variable'));
  27342. input_name.on('input', function () {
  27343. var inputWidth = input_name.textWidth() + 10;
  27344. opened_input_global = input_name;
  27345. input_name.focus();
  27346. var tmpStr = input_name.val();
  27347. input_name.val('');
  27348. input_name.val(tmpStr);
  27349. input_name.css({
  27350. width: inputWidth
  27351. });
  27352. }).trigger('input');
  27353. input_name.focusout(function () {
  27354. /// update array:
  27355. if (input_name.val().trim().length > 0) {
  27356. updateName(variable_obj, input_name.val().trim(), variable_container, function_obj);
  27357. variable_container.find('.span_name_variable').text(variable_obj.name);
  27358. } else {
  27359. variable_container.find('.span_name_variable').text(variable_obj.name);
  27360. }
  27361. input_name.off();
  27362. input_name.remove(); /// update elements:
  27363. opened_name_global = false;
  27364. opened_input_global = false;
  27365. });
  27366. input_name.on('keydown', function (e) {
  27367. var code = e.keyCode || e.which;
  27368. if (code == 13) {
  27369. if (input_name.val().trim().length > 0) {
  27370. updateName(variable_obj, input_name.val().trim(), variable_container, function_obj);
  27371. variable_container.find('.span_name_variable').text(variable_obj.name);
  27372. } else {
  27373. variable_container.find('.span_name_variable').text(variable_obj.name);
  27374. }
  27375. input_name.off();
  27376. input_name.remove(); /// update elements:
  27377. opened_name_global = false;
  27378. opened_input_global = false;
  27379. }
  27380. if (code == 27) {
  27381. variable_container.find('.span_name_variable').text(variable_obj.name);
  27382. input_name.off();
  27383. input_name.remove(); /// update elements:
  27384. opened_name_global = false;
  27385. opened_input_global = false;
  27386. }
  27387. });
  27388. input_name.select();
  27389. }
  27390. var opened_name_value_matrix_global_v = false;
  27391. var opened_input_value_matrix_global_v = null;
  27392. function enableMatrixValueUpdate(var_obj, row, index, parent_node) {
  27393. if (opened_name_value_matrix_global_v) {
  27394. opened_input_value_matrix_global_v.focus();
  27395. return;
  27396. }
  27397. parent_node = jquery__WEBPACK_IMPORTED_MODULE_0___default()(parent_node);
  27398. opened_name_value_matrix_global_v = true;
  27399. parent_node.find('.span_value_variable').text('');
  27400. var input_field;
  27401. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  27402. 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) + "' />");
  27403. input_field.insertBefore(parent_node.find('.span_value_variable'));
  27404. } else {
  27405. 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] + "' />");
  27406. input_field.insertBefore(parent_node.find('.span_value_variable'));
  27407. }
  27408. input_field.on('input', function () {
  27409. var inputWidth = input_field.textWidth() + 10;
  27410. opened_input_value_matrix_global_v = input_field;
  27411. input_field.focus();
  27412. var tmpStr = input_field.val();
  27413. input_field.val('');
  27414. input_field.val(tmpStr);
  27415. input_field.css({
  27416. width: inputWidth
  27417. });
  27418. }).trigger('input');
  27419. input_field.focusout(function () {
  27420. /// update array:
  27421. if (input_field.val().trim()) {
  27422. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  27423. var_obj.value[row][index] = parseFloat(input_field.val().trim());
  27424. parent_node.find('.span_value_variable').text(var_obj.value[row][index].toFixed(1));
  27425. } else {
  27426. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].INTEGER) {
  27427. var_obj.value[row][index] = parseInt(input_field.val().trim());
  27428. } else {
  27429. var_obj.value[row][index] = input_field.val().trim();
  27430. }
  27431. parent_node.find('.span_value_variable').text(var_obj.value[row][index]);
  27432. }
  27433. } else {
  27434. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  27435. parent_node.find('.span_value_variable').text(var_obj.value[row][index].toFixed(1));
  27436. } else {
  27437. parent_node.find('.span_value_variable').text(var_obj.value[row][index]);
  27438. }
  27439. }
  27440. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].TEXT) {
  27441. var_obj.value[row][index] = input_field.val();
  27442. parent_node.find('.span_value_variable').text(var_obj.value[row][index]);
  27443. }
  27444. input_field.off();
  27445. input_field.remove(); /// update elements:
  27446. opened_name_value_matrix_global_v = false;
  27447. opened_input_value_matrix_global_v = false;
  27448. });
  27449. input_field.on('keydown', function (e) {
  27450. var code = e.keyCode || e.which;
  27451. if (code == 13) {
  27452. if (input_field.val().trim()) {
  27453. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  27454. var_obj.value[row][index] = parseFloat(input_field.val().trim());
  27455. parent_node.find('.span_value_variable').text(var_obj.value[row][index].toFixed(1));
  27456. } else {
  27457. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].INTEGER) {
  27458. var_obj.value[row][index] = parseInt(input_field.val().trim());
  27459. } else {
  27460. var_obj.value[row][index] = input_field.val().trim();
  27461. }
  27462. parent_node.find('.span_value_variable').text(var_obj.value[row][index]);
  27463. }
  27464. } else {
  27465. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  27466. parent_node.find('.span_value_variable').text(var_obj.value[row][index].toFixed(1));
  27467. } else {
  27468. parent_node.find('.span_value_variable').text(var_obj.value[row][index]);
  27469. }
  27470. }
  27471. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].TEXT) {
  27472. var_obj.value[row][index] = input_field.val();
  27473. parent_node.find('.span_value_variable').text(var_obj.value[row][index]);
  27474. }
  27475. input_field.off();
  27476. input_field.remove(); /// update elements:
  27477. opened_name_value_matrix_global_v = false;
  27478. opened_input_value_matrix_global_v = false;
  27479. }
  27480. if (code == 27) {
  27481. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  27482. parent_node.find('.span_value_variable').text(var_obj.value[row][index].toFixed(1));
  27483. } else {
  27484. parent_node.find('.span_value_variable').text(var_obj.value[row][index]);
  27485. }
  27486. input_field.off();
  27487. input_field.remove(); /// update elements:
  27488. opened_name_value_matrix_global_v = false;
  27489. opened_input_value_matrix_global_v = false;
  27490. }
  27491. });
  27492. input_field.select();
  27493. }
  27494. /***/ }),
  27495. /***/ "./node_modules/antlr4/BufferedTokenStream.js":
  27496. /*!****************************************************!*\
  27497. !*** ./node_modules/antlr4/BufferedTokenStream.js ***!
  27498. \****************************************************/
  27499. /*! no static exports found */
  27500. /***/ (function(module, exports, __webpack_require__) {
  27501. //
  27502. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  27503. * Use of this file is governed by the BSD 3-clause license that
  27504. * can be found in the LICENSE.txt file in the project root.
  27505. */
  27506. // This implementation of {@link TokenStream} loads tokens from a
  27507. // {@link TokenSource} on-demand, and places the tokens in a buffer to provide
  27508. // access to any previous token by index.
  27509. //
  27510. // <p>
  27511. // This token stream ignores the value of {@link Token//getChannel}. If your
  27512. // parser requires the token stream filter tokens to only those on a particular
  27513. // channel, such as {@link Token//DEFAULT_CHANNEL} or
  27514. // {@link Token//HIDDEN_CHANNEL}, use a filtering token stream such a
  27515. // {@link CommonTokenStream}.</p>
  27516. var Token = __webpack_require__(/*! ./Token */ "./node_modules/antlr4/Token.js").Token;
  27517. var Lexer = __webpack_require__(/*! ./Lexer */ "./node_modules/antlr4/Lexer.js").Lexer;
  27518. var Interval = __webpack_require__(/*! ./IntervalSet */ "./node_modules/antlr4/IntervalSet.js").Interval;
  27519. // this is just to keep meaningful parameter types to Parser
  27520. function TokenStream() {
  27521. return this;
  27522. }
  27523. function BufferedTokenStream(tokenSource) {
  27524. TokenStream.call(this);
  27525. // The {@link TokenSource} from which tokens for this stream are fetched.
  27526. this.tokenSource = tokenSource;
  27527. // A collection of all tokens fetched from the token source. The list is
  27528. // considered a complete view of the input once {@link //fetchedEOF} is set
  27529. // to {@code true}.
  27530. this.tokens = [];
  27531. // The index into {@link //tokens} of the current token (next token to
  27532. // {@link //consume}). {@link //tokens}{@code [}{@link //p}{@code ]} should
  27533. // be
  27534. // {@link //LT LT(1)}.
  27535. //
  27536. // <p>This field is set to -1 when the stream is first constructed or when
  27537. // {@link //setTokenSource} is called, indicating that the first token has
  27538. // not yet been fetched from the token source. For additional information,
  27539. // see the documentation of {@link IntStream} for a description of
  27540. // Initializing Methods.</p>
  27541. this.index = -1;
  27542. // Indicates whether the {@link Token//EOF} token has been fetched from
  27543. // {@link //tokenSource} and added to {@link //tokens}. This field improves
  27544. // performance for the following cases:
  27545. //
  27546. // <ul>
  27547. // <li>{@link //consume}: The lookahead check in {@link //consume} to
  27548. // prevent
  27549. // consuming the EOF symbol is optimized by checking the values of
  27550. // {@link //fetchedEOF} and {@link //p} instead of calling {@link
  27551. // //LA}.</li>
  27552. // <li>{@link //fetch}: The check to prevent adding multiple EOF symbols
  27553. // into
  27554. // {@link //tokens} is trivial with this field.</li>
  27555. // <ul>
  27556. this.fetchedEOF = false;
  27557. return this;
  27558. }
  27559. BufferedTokenStream.prototype = Object.create(TokenStream.prototype);
  27560. BufferedTokenStream.prototype.constructor = BufferedTokenStream;
  27561. BufferedTokenStream.prototype.mark = function() {
  27562. return 0;
  27563. };
  27564. BufferedTokenStream.prototype.release = function(marker) {
  27565. // no resources to release
  27566. };
  27567. BufferedTokenStream.prototype.reset = function() {
  27568. this.seek(0);
  27569. };
  27570. BufferedTokenStream.prototype.seek = function(index) {
  27571. this.lazyInit();
  27572. this.index = this.adjustSeekIndex(index);
  27573. };
  27574. BufferedTokenStream.prototype.get = function(index) {
  27575. this.lazyInit();
  27576. return this.tokens[index];
  27577. };
  27578. BufferedTokenStream.prototype.consume = function() {
  27579. var skipEofCheck = false;
  27580. if (this.index >= 0) {
  27581. if (this.fetchedEOF) {
  27582. // the last token in tokens is EOF. skip check if p indexes any
  27583. // fetched token except the last.
  27584. skipEofCheck = this.index < this.tokens.length - 1;
  27585. } else {
  27586. // no EOF token in tokens. skip check if p indexes a fetched token.
  27587. skipEofCheck = this.index < this.tokens.length;
  27588. }
  27589. } else {
  27590. // not yet initialized
  27591. skipEofCheck = false;
  27592. }
  27593. if (!skipEofCheck && this.LA(1) === Token.EOF) {
  27594. throw "cannot consume EOF";
  27595. }
  27596. if (this.sync(this.index + 1)) {
  27597. this.index = this.adjustSeekIndex(this.index + 1);
  27598. }
  27599. };
  27600. // Make sure index {@code i} in tokens has a token.
  27601. //
  27602. // @return {@code true} if a token is located at index {@code i}, otherwise
  27603. // {@code false}.
  27604. // @see //get(int i)
  27605. // /
  27606. BufferedTokenStream.prototype.sync = function(i) {
  27607. var n = i - this.tokens.length + 1; // how many more elements we need?
  27608. if (n > 0) {
  27609. var fetched = this.fetch(n);
  27610. return fetched >= n;
  27611. }
  27612. return true;
  27613. };
  27614. // Add {@code n} elements to buffer.
  27615. //
  27616. // @return The actual number of elements added to the buffer.
  27617. // /
  27618. BufferedTokenStream.prototype.fetch = function(n) {
  27619. if (this.fetchedEOF) {
  27620. return 0;
  27621. }
  27622. for (var i = 0; i < n; i++) {
  27623. var t = this.tokenSource.nextToken();
  27624. t.tokenIndex = this.tokens.length;
  27625. this.tokens.push(t);
  27626. if (t.type === Token.EOF) {
  27627. this.fetchedEOF = true;
  27628. return i + 1;
  27629. }
  27630. }
  27631. return n;
  27632. };
  27633. // Get all tokens from start..stop inclusively///
  27634. BufferedTokenStream.prototype.getTokens = function(start, stop, types) {
  27635. if (types === undefined) {
  27636. types = null;
  27637. }
  27638. if (start < 0 || stop < 0) {
  27639. return null;
  27640. }
  27641. this.lazyInit();
  27642. var subset = [];
  27643. if (stop >= this.tokens.length) {
  27644. stop = this.tokens.length - 1;
  27645. }
  27646. for (var i = start; i < stop; i++) {
  27647. var t = this.tokens[i];
  27648. if (t.type === Token.EOF) {
  27649. break;
  27650. }
  27651. if (types === null || types.contains(t.type)) {
  27652. subset.push(t);
  27653. }
  27654. }
  27655. return subset;
  27656. };
  27657. BufferedTokenStream.prototype.LA = function(i) {
  27658. return this.LT(i).type;
  27659. };
  27660. BufferedTokenStream.prototype.LB = function(k) {
  27661. if (this.index - k < 0) {
  27662. return null;
  27663. }
  27664. return this.tokens[this.index - k];
  27665. };
  27666. BufferedTokenStream.prototype.LT = function(k) {
  27667. this.lazyInit();
  27668. if (k === 0) {
  27669. return null;
  27670. }
  27671. if (k < 0) {
  27672. return this.LB(-k);
  27673. }
  27674. var i = this.index + k - 1;
  27675. this.sync(i);
  27676. if (i >= this.tokens.length) { // return EOF token
  27677. // EOF must be last token
  27678. return this.tokens[this.tokens.length - 1];
  27679. }
  27680. return this.tokens[i];
  27681. };
  27682. // Allowed derived classes to modify the behavior of operations which change
  27683. // the current stream position by adjusting the target token index of a seek
  27684. // operation. The default implementation simply returns {@code i}. If an
  27685. // exception is thrown in this method, the current stream index should not be
  27686. // changed.
  27687. //
  27688. // <p>For example, {@link CommonTokenStream} overrides this method to ensure
  27689. // that
  27690. // the seek target is always an on-channel token.</p>
  27691. //
  27692. // @param i The target token index.
  27693. // @return The adjusted target token index.
  27694. BufferedTokenStream.prototype.adjustSeekIndex = function(i) {
  27695. return i;
  27696. };
  27697. BufferedTokenStream.prototype.lazyInit = function() {
  27698. if (this.index === -1) {
  27699. this.setup();
  27700. }
  27701. };
  27702. BufferedTokenStream.prototype.setup = function() {
  27703. this.sync(0);
  27704. this.index = this.adjustSeekIndex(0);
  27705. };
  27706. // Reset this token stream by setting its token source.///
  27707. BufferedTokenStream.prototype.setTokenSource = function(tokenSource) {
  27708. this.tokenSource = tokenSource;
  27709. this.tokens = [];
  27710. this.index = -1;
  27711. this.fetchedEOF = false;
  27712. };
  27713. // Given a starting index, return the index of the next token on channel.
  27714. // Return i if tokens[i] is on channel. Return -1 if there are no tokens
  27715. // on channel between i and EOF.
  27716. // /
  27717. BufferedTokenStream.prototype.nextTokenOnChannel = function(i, channel) {
  27718. this.sync(i);
  27719. if (i >= this.tokens.length) {
  27720. return -1;
  27721. }
  27722. var token = this.tokens[i];
  27723. while (token.channel !== this.channel) {
  27724. if (token.type === Token.EOF) {
  27725. return -1;
  27726. }
  27727. i += 1;
  27728. this.sync(i);
  27729. token = this.tokens[i];
  27730. }
  27731. return i;
  27732. };
  27733. // Given a starting index, return the index of the previous token on channel.
  27734. // Return i if tokens[i] is on channel. Return -1 if there are no tokens
  27735. // on channel between i and 0.
  27736. BufferedTokenStream.prototype.previousTokenOnChannel = function(i, channel) {
  27737. while (i >= 0 && this.tokens[i].channel !== channel) {
  27738. i -= 1;
  27739. }
  27740. return i;
  27741. };
  27742. // Collect all tokens on specified channel to the right of
  27743. // the current token up until we see a token on DEFAULT_TOKEN_CHANNEL or
  27744. // EOF. If channel is -1, find any non default channel token.
  27745. BufferedTokenStream.prototype.getHiddenTokensToRight = function(tokenIndex,
  27746. channel) {
  27747. if (channel === undefined) {
  27748. channel = -1;
  27749. }
  27750. this.lazyInit();
  27751. if (tokenIndex < 0 || tokenIndex >= this.tokens.length) {
  27752. throw "" + tokenIndex + " not in 0.." + this.tokens.length - 1;
  27753. }
  27754. var nextOnChannel = this.nextTokenOnChannel(tokenIndex + 1, Lexer.DEFAULT_TOKEN_CHANNEL);
  27755. var from_ = tokenIndex + 1;
  27756. // if none onchannel to right, nextOnChannel=-1 so set to = last token
  27757. var to = nextOnChannel === -1 ? this.tokens.length - 1 : nextOnChannel;
  27758. return this.filterForChannel(from_, to, channel);
  27759. };
  27760. // Collect all tokens on specified channel to the left of
  27761. // the current token up until we see a token on DEFAULT_TOKEN_CHANNEL.
  27762. // If channel is -1, find any non default channel token.
  27763. BufferedTokenStream.prototype.getHiddenTokensToLeft = function(tokenIndex,
  27764. channel) {
  27765. if (channel === undefined) {
  27766. channel = -1;
  27767. }
  27768. this.lazyInit();
  27769. if (tokenIndex < 0 || tokenIndex >= this.tokens.length) {
  27770. throw "" + tokenIndex + " not in 0.." + this.tokens.length - 1;
  27771. }
  27772. var prevOnChannel = this.previousTokenOnChannel(tokenIndex - 1, Lexer.DEFAULT_TOKEN_CHANNEL);
  27773. if (prevOnChannel === tokenIndex - 1) {
  27774. return null;
  27775. }
  27776. // if none on channel to left, prevOnChannel=-1 then from=0
  27777. var from_ = prevOnChannel + 1;
  27778. var to = tokenIndex - 1;
  27779. return this.filterForChannel(from_, to, channel);
  27780. };
  27781. BufferedTokenStream.prototype.filterForChannel = function(left, right, channel) {
  27782. var hidden = [];
  27783. for (var i = left; i < right + 1; i++) {
  27784. var t = this.tokens[i];
  27785. if (channel === -1) {
  27786. if (t.channel !== Lexer.DEFAULT_TOKEN_CHANNEL) {
  27787. hidden.push(t);
  27788. }
  27789. } else if (t.channel === channel) {
  27790. hidden.push(t);
  27791. }
  27792. }
  27793. if (hidden.length === 0) {
  27794. return null;
  27795. }
  27796. return hidden;
  27797. };
  27798. BufferedTokenStream.prototype.getSourceName = function() {
  27799. return this.tokenSource.getSourceName();
  27800. };
  27801. // Get the text of all tokens in this buffer.///
  27802. BufferedTokenStream.prototype.getText = function(interval) {
  27803. this.lazyInit();
  27804. this.fill();
  27805. if (interval === undefined || interval === null) {
  27806. interval = new Interval(0, this.tokens.length - 1);
  27807. }
  27808. var start = interval.start;
  27809. if (start instanceof Token) {
  27810. start = start.tokenIndex;
  27811. }
  27812. var stop = interval.stop;
  27813. if (stop instanceof Token) {
  27814. stop = stop.tokenIndex;
  27815. }
  27816. if (start === null || stop === null || start < 0 || stop < 0) {
  27817. return "";
  27818. }
  27819. if (stop >= this.tokens.length) {
  27820. stop = this.tokens.length - 1;
  27821. }
  27822. var s = "";
  27823. for (var i = start; i < stop + 1; i++) {
  27824. var t = this.tokens[i];
  27825. if (t.type === Token.EOF) {
  27826. break;
  27827. }
  27828. s = s + t.text;
  27829. }
  27830. return s;
  27831. };
  27832. // Get all tokens from lexer until EOF///
  27833. BufferedTokenStream.prototype.fill = function() {
  27834. this.lazyInit();
  27835. while (this.fetch(1000) === 1000) {
  27836. continue;
  27837. }
  27838. };
  27839. exports.BufferedTokenStream = BufferedTokenStream;
  27840. /***/ }),
  27841. /***/ "./node_modules/antlr4/CharStreams.js":
  27842. /*!********************************************!*\
  27843. !*** ./node_modules/antlr4/CharStreams.js ***!
  27844. \********************************************/
  27845. /*! no static exports found */
  27846. /***/ (function(module, exports, __webpack_require__) {
  27847. //
  27848. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  27849. * Use of this file is governed by the BSD 3-clause license that
  27850. * can be found in the LICENSE.txt file in the project root.
  27851. */
  27852. //
  27853. var InputStream = __webpack_require__(/*! ./InputStream */ "./node_modules/antlr4/InputStream.js").InputStream;
  27854. var isNodeJs = typeof window === 'undefined' && typeof importScripts === 'undefined';
  27855. var fs = isNodeJs ? __webpack_require__(/*! fs */ "./node_modules/node-libs-browser/mock/empty.js") : null;
  27856. // Utility functions to create InputStreams from various sources.
  27857. //
  27858. // All returned InputStreams support the full range of Unicode
  27859. // up to U+10FFFF (the default behavior of InputStream only supports
  27860. // code points up to U+FFFF).
  27861. var CharStreams = {
  27862. // Creates an InputStream from a string.
  27863. fromString: function(str) {
  27864. return new InputStream(str, true);
  27865. },
  27866. // Asynchronously creates an InputStream from a blob given the
  27867. // encoding of the bytes in that blob (defaults to 'utf8' if
  27868. // encoding is null).
  27869. //
  27870. // Invokes onLoad(result) on success, onError(error) on
  27871. // failure.
  27872. fromBlob: function(blob, encoding, onLoad, onError) {
  27873. var reader = FileReader();
  27874. reader.onload = function(e) {
  27875. var is = new InputStream(e.target.result, true);
  27876. onLoad(is);
  27877. };
  27878. reader.onerror = onError;
  27879. reader.readAsText(blob, encoding);
  27880. },
  27881. // Creates an InputStream from a Buffer given the
  27882. // encoding of the bytes in that buffer (defaults to 'utf8' if
  27883. // encoding is null).
  27884. fromBuffer: function(buffer, encoding) {
  27885. return new InputStream(buffer.toString(encoding), true);
  27886. },
  27887. // Asynchronously creates an InputStream from a file on disk given
  27888. // the encoding of the bytes in that file (defaults to 'utf8' if
  27889. // encoding is null).
  27890. //
  27891. // Invokes callback(error, result) on completion.
  27892. fromPath: function(path, encoding, callback) {
  27893. fs.readFile(path, encoding, function(err, data) {
  27894. var is = null;
  27895. if (data !== null) {
  27896. is = new InputStream(data, true);
  27897. }
  27898. callback(err, is);
  27899. });
  27900. },
  27901. // Synchronously creates an InputStream given a path to a file
  27902. // on disk and the encoding of the bytes in that file (defaults to
  27903. // 'utf8' if encoding is null).
  27904. fromPathSync: function(path, encoding) {
  27905. var data = fs.readFileSync(path, encoding);
  27906. return new InputStream(data, true);
  27907. }
  27908. };
  27909. exports.CharStreams = CharStreams;
  27910. /***/ }),
  27911. /***/ "./node_modules/antlr4/CommonTokenFactory.js":
  27912. /*!***************************************************!*\
  27913. !*** ./node_modules/antlr4/CommonTokenFactory.js ***!
  27914. \***************************************************/
  27915. /*! no static exports found */
  27916. /***/ (function(module, exports, __webpack_require__) {
  27917. //
  27918. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  27919. * Use of this file is governed by the BSD 3-clause license that
  27920. * can be found in the LICENSE.txt file in the project root.
  27921. */
  27922. //
  27923. //
  27924. // This default implementation of {@link TokenFactory} creates
  27925. // {@link CommonToken} objects.
  27926. //
  27927. var CommonToken = __webpack_require__(/*! ./Token */ "./node_modules/antlr4/Token.js").CommonToken;
  27928. function TokenFactory() {
  27929. return this;
  27930. }
  27931. function CommonTokenFactory(copyText) {
  27932. TokenFactory.call(this);
  27933. // Indicates whether {@link CommonToken//setText} should be called after
  27934. // constructing tokens to explicitly set the text. This is useful for cases
  27935. // where the input stream might not be able to provide arbitrary substrings
  27936. // of text from the input after the lexer creates a token (e.g. the
  27937. // implementation of {@link CharStream//getText} in
  27938. // {@link UnbufferedCharStream} throws an
  27939. // {@link UnsupportedOperationException}). Explicitly setting the token text
  27940. // allows {@link Token//getText} to be called at any time regardless of the
  27941. // input stream implementation.
  27942. //
  27943. // <p>
  27944. // The default value is {@code false} to avoid the performance and memory
  27945. // overhead of copying text for every token unless explicitly requested.</p>
  27946. //
  27947. this.copyText = copyText===undefined ? false : copyText;
  27948. return this;
  27949. }
  27950. CommonTokenFactory.prototype = Object.create(TokenFactory.prototype);
  27951. CommonTokenFactory.prototype.constructor = CommonTokenFactory;
  27952. //
  27953. // The default {@link CommonTokenFactory} instance.
  27954. //
  27955. // <p>
  27956. // This token factory does not explicitly copy token text when constructing
  27957. // tokens.</p>
  27958. //
  27959. CommonTokenFactory.DEFAULT = new CommonTokenFactory();
  27960. CommonTokenFactory.prototype.create = function(source, type, text, channel, start, stop, line, column) {
  27961. var t = new CommonToken(source, type, channel, start, stop);
  27962. t.line = line;
  27963. t.column = column;
  27964. if (text !==null) {
  27965. t.text = text;
  27966. } else if (this.copyText && source[1] !==null) {
  27967. t.text = source[1].getText(start,stop);
  27968. }
  27969. return t;
  27970. };
  27971. CommonTokenFactory.prototype.createThin = function(type, text) {
  27972. var t = new CommonToken(null, type);
  27973. t.text = text;
  27974. return t;
  27975. };
  27976. exports.CommonTokenFactory = CommonTokenFactory;
  27977. /***/ }),
  27978. /***/ "./node_modules/antlr4/CommonTokenStream.js":
  27979. /*!**************************************************!*\
  27980. !*** ./node_modules/antlr4/CommonTokenStream.js ***!
  27981. \**************************************************/
  27982. /*! no static exports found */
  27983. /***/ (function(module, exports, __webpack_require__) {
  27984. //
  27985. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  27986. * Use of this file is governed by the BSD 3-clause license that
  27987. * can be found in the LICENSE.txt file in the project root.
  27988. */
  27989. ///
  27990. //
  27991. // This class extends {@link BufferedTokenStream} with functionality to filter
  27992. // token streams to tokens on a particular channel (tokens where
  27993. // {@link Token//getChannel} returns a particular value).
  27994. //
  27995. // <p>
  27996. // This token stream provides access to all tokens by index or when calling
  27997. // methods like {@link //getText}. The channel filtering is only used for code
  27998. // accessing tokens via the lookahead methods {@link //LA}, {@link //LT}, and
  27999. // {@link //LB}.</p>
  28000. //
  28001. // <p>
  28002. // By default, tokens are placed on the default channel
  28003. // ({@link Token//DEFAULT_CHANNEL}), but may be reassigned by using the
  28004. // {@code ->channel(HIDDEN)} lexer command, or by using an embedded action to
  28005. // call {@link Lexer//setChannel}.
  28006. // </p>
  28007. //
  28008. // <p>
  28009. // Note: lexer rules which use the {@code ->skip} lexer command or call
  28010. // {@link Lexer//skip} do not produce tokens at all, so input text matched by
  28011. // such a rule will not be available as part of the token stream, regardless of
  28012. // channel.</p>
  28013. ///
  28014. var Token = __webpack_require__(/*! ./Token */ "./node_modules/antlr4/Token.js").Token;
  28015. var BufferedTokenStream = __webpack_require__(/*! ./BufferedTokenStream */ "./node_modules/antlr4/BufferedTokenStream.js").BufferedTokenStream;
  28016. function CommonTokenStream(lexer, channel) {
  28017. BufferedTokenStream.call(this, lexer);
  28018. this.channel = channel===undefined ? Token.DEFAULT_CHANNEL : channel;
  28019. return this;
  28020. }
  28021. CommonTokenStream.prototype = Object.create(BufferedTokenStream.prototype);
  28022. CommonTokenStream.prototype.constructor = CommonTokenStream;
  28023. CommonTokenStream.prototype.adjustSeekIndex = function(i) {
  28024. return this.nextTokenOnChannel(i, this.channel);
  28025. };
  28026. CommonTokenStream.prototype.LB = function(k) {
  28027. if (k===0 || this.index-k<0) {
  28028. return null;
  28029. }
  28030. var i = this.index;
  28031. var n = 1;
  28032. // find k good tokens looking backwards
  28033. while (n <= k) {
  28034. // skip off-channel tokens
  28035. i = this.previousTokenOnChannel(i - 1, this.channel);
  28036. n += 1;
  28037. }
  28038. if (i < 0) {
  28039. return null;
  28040. }
  28041. return this.tokens[i];
  28042. };
  28043. CommonTokenStream.prototype.LT = function(k) {
  28044. this.lazyInit();
  28045. if (k === 0) {
  28046. return null;
  28047. }
  28048. if (k < 0) {
  28049. return this.LB(-k);
  28050. }
  28051. var i = this.index;
  28052. var n = 1; // we know tokens[pos] is a good one
  28053. // find k good tokens
  28054. while (n < k) {
  28055. // skip off-channel tokens, but make sure to not look past EOF
  28056. if (this.sync(i + 1)) {
  28057. i = this.nextTokenOnChannel(i + 1, this.channel);
  28058. }
  28059. n += 1;
  28060. }
  28061. return this.tokens[i];
  28062. };
  28063. // Count EOF just once.///
  28064. CommonTokenStream.prototype.getNumberOfOnChannelTokens = function() {
  28065. var n = 0;
  28066. this.fill();
  28067. for (var i =0; i< this.tokens.length;i++) {
  28068. var t = this.tokens[i];
  28069. if( t.channel===this.channel) {
  28070. n += 1;
  28071. }
  28072. if( t.type===Token.EOF) {
  28073. break;
  28074. }
  28075. }
  28076. return n;
  28077. };
  28078. exports.CommonTokenStream = CommonTokenStream;
  28079. /***/ }),
  28080. /***/ "./node_modules/antlr4/FileStream.js":
  28081. /*!*******************************************!*\
  28082. !*** ./node_modules/antlr4/FileStream.js ***!
  28083. \*******************************************/
  28084. /*! no static exports found */
  28085. /***/ (function(module, exports, __webpack_require__) {
  28086. //
  28087. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  28088. * Use of this file is governed by the BSD 3-clause license that
  28089. * can be found in the LICENSE.txt file in the project root.
  28090. */
  28091. //
  28092. //
  28093. // This is an InputStream that is loaded from a file all at once
  28094. // when you construct the object.
  28095. //
  28096. var InputStream = __webpack_require__(/*! ./InputStream */ "./node_modules/antlr4/InputStream.js").InputStream;
  28097. var isNodeJs = typeof window === 'undefined' && typeof importScripts === 'undefined';
  28098. var fs = isNodeJs ? __webpack_require__(/*! fs */ "./node_modules/node-libs-browser/mock/empty.js") : null;
  28099. function FileStream(fileName, decodeToUnicodeCodePoints) {
  28100. var data = fs.readFileSync(fileName, "utf8");
  28101. InputStream.call(this, data, decodeToUnicodeCodePoints);
  28102. this.fileName = fileName;
  28103. return this;
  28104. }
  28105. FileStream.prototype = Object.create(InputStream.prototype);
  28106. FileStream.prototype.constructor = FileStream;
  28107. exports.FileStream = FileStream;
  28108. /***/ }),
  28109. /***/ "./node_modules/antlr4/InputStream.js":
  28110. /*!********************************************!*\
  28111. !*** ./node_modules/antlr4/InputStream.js ***!
  28112. \********************************************/
  28113. /*! no static exports found */
  28114. /***/ (function(module, exports, __webpack_require__) {
  28115. //
  28116. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  28117. * Use of this file is governed by the BSD 3-clause license that
  28118. * can be found in the LICENSE.txt file in the project root.
  28119. */
  28120. //
  28121. var Token = __webpack_require__(/*! ./Token */ "./node_modules/antlr4/Token.js").Token;
  28122. __webpack_require__(/*! ./polyfills/codepointat */ "./node_modules/antlr4/polyfills/codepointat.js");
  28123. __webpack_require__(/*! ./polyfills/fromcodepoint */ "./node_modules/antlr4/polyfills/fromcodepoint.js");
  28124. // Vacuum all input from a string and then treat it like a buffer.
  28125. function _loadString(stream) {
  28126. stream._index = 0;
  28127. stream.data = [];
  28128. if (stream.decodeToUnicodeCodePoints) {
  28129. for (var i = 0; i < stream.strdata.length; ) {
  28130. var codePoint = stream.strdata.codePointAt(i);
  28131. stream.data.push(codePoint);
  28132. i += codePoint <= 0xFFFF ? 1 : 2;
  28133. }
  28134. } else {
  28135. for (var i = 0; i < stream.strdata.length; i++) {
  28136. var codeUnit = stream.strdata.charCodeAt(i);
  28137. stream.data.push(codeUnit);
  28138. }
  28139. }
  28140. stream._size = stream.data.length;
  28141. }
  28142. // If decodeToUnicodeCodePoints is true, the input is treated
  28143. // as a series of Unicode code points.
  28144. //
  28145. // Otherwise, the input is treated as a series of 16-bit UTF-16 code
  28146. // units.
  28147. function InputStream(data, decodeToUnicodeCodePoints) {
  28148. this.name = "<empty>";
  28149. this.strdata = data;
  28150. this.decodeToUnicodeCodePoints = decodeToUnicodeCodePoints || false;
  28151. _loadString(this);
  28152. return this;
  28153. }
  28154. Object.defineProperty(InputStream.prototype, "index", {
  28155. get : function() {
  28156. return this._index;
  28157. }
  28158. });
  28159. Object.defineProperty(InputStream.prototype, "size", {
  28160. get : function() {
  28161. return this._size;
  28162. }
  28163. });
  28164. // Reset the stream so that it's in the same state it was
  28165. // when the object was created *except* the data array is not
  28166. // touched.
  28167. //
  28168. InputStream.prototype.reset = function() {
  28169. this._index = 0;
  28170. };
  28171. InputStream.prototype.consume = function() {
  28172. if (this._index >= this._size) {
  28173. // assert this.LA(1) == Token.EOF
  28174. throw ("cannot consume EOF");
  28175. }
  28176. this._index += 1;
  28177. };
  28178. InputStream.prototype.LA = function(offset) {
  28179. if (offset === 0) {
  28180. return 0; // undefined
  28181. }
  28182. if (offset < 0) {
  28183. offset += 1; // e.g., translate LA(-1) to use offset=0
  28184. }
  28185. var pos = this._index + offset - 1;
  28186. if (pos < 0 || pos >= this._size) { // invalid
  28187. return Token.EOF;
  28188. }
  28189. return this.data[pos];
  28190. };
  28191. InputStream.prototype.LT = function(offset) {
  28192. return this.LA(offset);
  28193. };
  28194. // mark/release do nothing; we have entire buffer
  28195. InputStream.prototype.mark = function() {
  28196. return -1;
  28197. };
  28198. InputStream.prototype.release = function(marker) {
  28199. };
  28200. // consume() ahead until p==_index; can't just set p=_index as we must
  28201. // update line and column. If we seek backwards, just set p
  28202. //
  28203. InputStream.prototype.seek = function(_index) {
  28204. if (_index <= this._index) {
  28205. this._index = _index; // just jump; don't update stream state (line,
  28206. // ...)
  28207. return;
  28208. }
  28209. // seek forward
  28210. this._index = Math.min(_index, this._size);
  28211. };
  28212. InputStream.prototype.getText = function(start, stop) {
  28213. if (stop >= this._size) {
  28214. stop = this._size - 1;
  28215. }
  28216. if (start >= this._size) {
  28217. return "";
  28218. } else {
  28219. if (this.decodeToUnicodeCodePoints) {
  28220. var result = "";
  28221. for (var i = start; i <= stop; i++) {
  28222. result += String.fromCodePoint(this.data[i]);
  28223. }
  28224. return result;
  28225. } else {
  28226. return this.strdata.slice(start, stop + 1);
  28227. }
  28228. }
  28229. };
  28230. InputStream.prototype.toString = function() {
  28231. return this.strdata;
  28232. };
  28233. exports.InputStream = InputStream;
  28234. /***/ }),
  28235. /***/ "./node_modules/antlr4/IntervalSet.js":
  28236. /*!********************************************!*\
  28237. !*** ./node_modules/antlr4/IntervalSet.js ***!
  28238. \********************************************/
  28239. /*! no static exports found */
  28240. /***/ (function(module, exports, __webpack_require__) {
  28241. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  28242. * Use of this file is governed by the BSD 3-clause license that
  28243. * can be found in the LICENSE.txt file in the project root.
  28244. */
  28245. /*jslint smarttabs:true */
  28246. var Token = __webpack_require__(/*! ./Token */ "./node_modules/antlr4/Token.js").Token;
  28247. /* stop is not included! */
  28248. function Interval(start, stop) {
  28249. this.start = start;
  28250. this.stop = stop;
  28251. return this;
  28252. }
  28253. Interval.prototype.contains = function(item) {
  28254. return item >= this.start && item < this.stop;
  28255. };
  28256. Interval.prototype.toString = function() {
  28257. if(this.start===this.stop-1) {
  28258. return this.start.toString();
  28259. } else {
  28260. return this.start.toString() + ".." + (this.stop-1).toString();
  28261. }
  28262. };
  28263. Object.defineProperty(Interval.prototype, "length", {
  28264. get : function() {
  28265. return this.stop - this.start;
  28266. }
  28267. });
  28268. function IntervalSet() {
  28269. this.intervals = null;
  28270. this.readOnly = false;
  28271. }
  28272. IntervalSet.prototype.first = function(v) {
  28273. if (this.intervals === null || this.intervals.length===0) {
  28274. return Token.INVALID_TYPE;
  28275. } else {
  28276. return this.intervals[0].start;
  28277. }
  28278. };
  28279. IntervalSet.prototype.addOne = function(v) {
  28280. this.addInterval(new Interval(v, v + 1));
  28281. };
  28282. IntervalSet.prototype.addRange = function(l, h) {
  28283. this.addInterval(new Interval(l, h + 1));
  28284. };
  28285. IntervalSet.prototype.addInterval = function(v) {
  28286. if (this.intervals === null) {
  28287. this.intervals = [];
  28288. this.intervals.push(v);
  28289. } else {
  28290. // find insert pos
  28291. for (var k = 0; k < this.intervals.length; k++) {
  28292. var i = this.intervals[k];
  28293. // distinct range -> insert
  28294. if (v.stop < i.start) {
  28295. this.intervals.splice(k, 0, v);
  28296. return;
  28297. }
  28298. // contiguous range -> adjust
  28299. else if (v.stop === i.start) {
  28300. this.intervals[k].start = v.start;
  28301. return;
  28302. }
  28303. // overlapping range -> adjust and reduce
  28304. else if (v.start <= i.stop) {
  28305. this.intervals[k] = new Interval(Math.min(i.start, v.start), Math.max(i.stop, v.stop));
  28306. this.reduce(k);
  28307. return;
  28308. }
  28309. }
  28310. // greater than any existing
  28311. this.intervals.push(v);
  28312. }
  28313. };
  28314. IntervalSet.prototype.addSet = function(other) {
  28315. if (other.intervals !== null) {
  28316. for (var k = 0; k < other.intervals.length; k++) {
  28317. var i = other.intervals[k];
  28318. this.addInterval(new Interval(i.start, i.stop));
  28319. }
  28320. }
  28321. return this;
  28322. };
  28323. IntervalSet.prototype.reduce = function(k) {
  28324. // only need to reduce if k is not the last
  28325. if (k < this.intervalslength - 1) {
  28326. var l = this.intervals[k];
  28327. var r = this.intervals[k + 1];
  28328. // if r contained in l
  28329. if (l.stop >= r.stop) {
  28330. this.intervals.pop(k + 1);
  28331. this.reduce(k);
  28332. } else if (l.stop >= r.start) {
  28333. this.intervals[k] = new Interval(l.start, r.stop);
  28334. this.intervals.pop(k + 1);
  28335. }
  28336. }
  28337. };
  28338. IntervalSet.prototype.complement = function(start, stop) {
  28339. var result = new IntervalSet();
  28340. result.addInterval(new Interval(start,stop+1));
  28341. for(var i=0; i<this.intervals.length; i++) {
  28342. result.removeRange(this.intervals[i]);
  28343. }
  28344. return result;
  28345. };
  28346. IntervalSet.prototype.contains = function(item) {
  28347. if (this.intervals === null) {
  28348. return false;
  28349. } else {
  28350. for (var k = 0; k < this.intervals.length; k++) {
  28351. if(this.intervals[k].contains(item)) {
  28352. return true;
  28353. }
  28354. }
  28355. return false;
  28356. }
  28357. };
  28358. Object.defineProperty(IntervalSet.prototype, "length", {
  28359. get : function() {
  28360. var len = 0;
  28361. this.intervals.map(function(i) {len += i.length;});
  28362. return len;
  28363. }
  28364. });
  28365. IntervalSet.prototype.removeRange = function(v) {
  28366. if(v.start===v.stop-1) {
  28367. this.removeOne(v.start);
  28368. } else if (this.intervals!==null) {
  28369. var k = 0;
  28370. for(var n=0; n<this.intervals.length; n++) {
  28371. var i = this.intervals[k];
  28372. // intervals are ordered
  28373. if (v.stop<=i.start) {
  28374. return;
  28375. }
  28376. // check for including range, split it
  28377. else if(v.start>i.start && v.stop<i.stop) {
  28378. this.intervals[k] = new Interval(i.start, v.start);
  28379. var x = new Interval(v.stop, i.stop);
  28380. this.intervals.splice(k, 0, x);
  28381. return;
  28382. }
  28383. // check for included range, remove it
  28384. else if(v.start<=i.start && v.stop>=i.stop) {
  28385. this.intervals.splice(k, 1);
  28386. k = k - 1; // need another pass
  28387. }
  28388. // check for lower boundary
  28389. else if(v.start<i.stop) {
  28390. this.intervals[k] = new Interval(i.start, v.start);
  28391. }
  28392. // check for upper boundary
  28393. else if(v.stop<i.stop) {
  28394. this.intervals[k] = new Interval(v.stop, i.stop);
  28395. }
  28396. k += 1;
  28397. }
  28398. }
  28399. };
  28400. IntervalSet.prototype.removeOne = function(v) {
  28401. if (this.intervals !== null) {
  28402. for (var k = 0; k < this.intervals.length; k++) {
  28403. var i = this.intervals[k];
  28404. // intervals is ordered
  28405. if (v < i.start) {
  28406. return;
  28407. }
  28408. // check for single value range
  28409. else if (v === i.start && v === i.stop - 1) {
  28410. this.intervals.splice(k, 1);
  28411. return;
  28412. }
  28413. // check for lower boundary
  28414. else if (v === i.start) {
  28415. this.intervals[k] = new Interval(i.start + 1, i.stop);
  28416. return;
  28417. }
  28418. // check for upper boundary
  28419. else if (v === i.stop - 1) {
  28420. this.intervals[k] = new Interval(i.start, i.stop - 1);
  28421. return;
  28422. }
  28423. // split existing range
  28424. else if (v < i.stop - 1) {
  28425. var x = new Interval(i.start, v);
  28426. i.start = v + 1;
  28427. this.intervals.splice(k, 0, x);
  28428. return;
  28429. }
  28430. }
  28431. }
  28432. };
  28433. IntervalSet.prototype.toString = function(literalNames, symbolicNames, elemsAreChar) {
  28434. literalNames = literalNames || null;
  28435. symbolicNames = symbolicNames || null;
  28436. elemsAreChar = elemsAreChar || false;
  28437. if (this.intervals === null) {
  28438. return "{}";
  28439. } else if(literalNames!==null || symbolicNames!==null) {
  28440. return this.toTokenString(literalNames, symbolicNames);
  28441. } else if(elemsAreChar) {
  28442. return this.toCharString();
  28443. } else {
  28444. return this.toIndexString();
  28445. }
  28446. };
  28447. IntervalSet.prototype.toCharString = function() {
  28448. var names = [];
  28449. for (var i = 0; i < this.intervals.length; i++) {
  28450. var v = this.intervals[i];
  28451. if(v.stop===v.start+1) {
  28452. if ( v.start===Token.EOF ) {
  28453. names.push("<EOF>");
  28454. } else {
  28455. names.push("'" + String.fromCharCode(v.start) + "'");
  28456. }
  28457. } else {
  28458. names.push("'" + String.fromCharCode(v.start) + "'..'" + String.fromCharCode(v.stop-1) + "'");
  28459. }
  28460. }
  28461. if (names.length > 1) {
  28462. return "{" + names.join(", ") + "}";
  28463. } else {
  28464. return names[0];
  28465. }
  28466. };
  28467. IntervalSet.prototype.toIndexString = function() {
  28468. var names = [];
  28469. for (var i = 0; i < this.intervals.length; i++) {
  28470. var v = this.intervals[i];
  28471. if(v.stop===v.start+1) {
  28472. if ( v.start===Token.EOF ) {
  28473. names.push("<EOF>");
  28474. } else {
  28475. names.push(v.start.toString());
  28476. }
  28477. } else {
  28478. names.push(v.start.toString() + ".." + (v.stop-1).toString());
  28479. }
  28480. }
  28481. if (names.length > 1) {
  28482. return "{" + names.join(", ") + "}";
  28483. } else {
  28484. return names[0];
  28485. }
  28486. };
  28487. IntervalSet.prototype.toTokenString = function(literalNames, symbolicNames) {
  28488. var names = [];
  28489. for (var i = 0; i < this.intervals.length; i++) {
  28490. var v = this.intervals[i];
  28491. for (var j = v.start; j < v.stop; j++) {
  28492. names.push(this.elementName(literalNames, symbolicNames, j));
  28493. }
  28494. }
  28495. if (names.length > 1) {
  28496. return "{" + names.join(", ") + "}";
  28497. } else {
  28498. return names[0];
  28499. }
  28500. };
  28501. IntervalSet.prototype.elementName = function(literalNames, symbolicNames, a) {
  28502. if (a === Token.EOF) {
  28503. return "<EOF>";
  28504. } else if (a === Token.EPSILON) {
  28505. return "<EPSILON>";
  28506. } else {
  28507. return literalNames[a] || symbolicNames[a];
  28508. }
  28509. };
  28510. exports.Interval = Interval;
  28511. exports.IntervalSet = IntervalSet;
  28512. /***/ }),
  28513. /***/ "./node_modules/antlr4/LL1Analyzer.js":
  28514. /*!********************************************!*\
  28515. !*** ./node_modules/antlr4/LL1Analyzer.js ***!
  28516. \********************************************/
  28517. /*! no static exports found */
  28518. /***/ (function(module, exports, __webpack_require__) {
  28519. //
  28520. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  28521. * Use of this file is governed by the BSD 3-clause license that
  28522. * can be found in the LICENSE.txt file in the project root.
  28523. */
  28524. ///
  28525. var Set = __webpack_require__(/*! ./Utils */ "./node_modules/antlr4/Utils.js").Set;
  28526. var BitSet = __webpack_require__(/*! ./Utils */ "./node_modules/antlr4/Utils.js").BitSet;
  28527. var Token = __webpack_require__(/*! ./Token */ "./node_modules/antlr4/Token.js").Token;
  28528. var ATNConfig = __webpack_require__(/*! ./atn/ATNConfig */ "./node_modules/antlr4/atn/ATNConfig.js").ATNConfig;
  28529. var Interval = __webpack_require__(/*! ./IntervalSet */ "./node_modules/antlr4/IntervalSet.js").Interval;
  28530. var IntervalSet = __webpack_require__(/*! ./IntervalSet */ "./node_modules/antlr4/IntervalSet.js").IntervalSet;
  28531. var RuleStopState = __webpack_require__(/*! ./atn/ATNState */ "./node_modules/antlr4/atn/ATNState.js").RuleStopState;
  28532. var RuleTransition = __webpack_require__(/*! ./atn/Transition */ "./node_modules/antlr4/atn/Transition.js").RuleTransition;
  28533. var NotSetTransition = __webpack_require__(/*! ./atn/Transition */ "./node_modules/antlr4/atn/Transition.js").NotSetTransition;
  28534. var WildcardTransition = __webpack_require__(/*! ./atn/Transition */ "./node_modules/antlr4/atn/Transition.js").WildcardTransition;
  28535. var AbstractPredicateTransition = __webpack_require__(/*! ./atn/Transition */ "./node_modules/antlr4/atn/Transition.js").AbstractPredicateTransition;
  28536. var pc = __webpack_require__(/*! ./PredictionContext */ "./node_modules/antlr4/PredictionContext.js");
  28537. var predictionContextFromRuleContext = pc.predictionContextFromRuleContext;
  28538. var PredictionContext = pc.PredictionContext;
  28539. var SingletonPredictionContext = pc.SingletonPredictionContext;
  28540. function LL1Analyzer (atn) {
  28541. this.atn = atn;
  28542. }
  28543. //* Special value added to the lookahead sets to indicate that we hit
  28544. // a predicate during analysis if {@code seeThruPreds==false}.
  28545. ///
  28546. LL1Analyzer.HIT_PRED = Token.INVALID_TYPE;
  28547. //*
  28548. // Calculates the SLL(1) expected lookahead set for each outgoing transition
  28549. // of an {@link ATNState}. The returned array has one element for each
  28550. // outgoing transition in {@code s}. If the closure from transition
  28551. // <em>i</em> leads to a semantic predicate before matching a symbol, the
  28552. // element at index <em>i</em> of the result will be {@code null}.
  28553. //
  28554. // @param s the ATN state
  28555. // @return the expected symbols for each outgoing transition of {@code s}.
  28556. ///
  28557. LL1Analyzer.prototype.getDecisionLookahead = function(s) {
  28558. if (s === null) {
  28559. return null;
  28560. }
  28561. var count = s.transitions.length;
  28562. var look = [];
  28563. for(var alt=0; alt< count; alt++) {
  28564. look[alt] = new IntervalSet();
  28565. var lookBusy = new Set();
  28566. var seeThruPreds = false; // fail to get lookahead upon pred
  28567. this._LOOK(s.transition(alt).target, null, PredictionContext.EMPTY,
  28568. look[alt], lookBusy, new BitSet(), seeThruPreds, false);
  28569. // Wipe out lookahead for this alternative if we found nothing
  28570. // or we had a predicate when we !seeThruPreds
  28571. if (look[alt].length===0 || look[alt].contains(LL1Analyzer.HIT_PRED)) {
  28572. look[alt] = null;
  28573. }
  28574. }
  28575. return look;
  28576. };
  28577. //*
  28578. // Compute set of tokens that can follow {@code s} in the ATN in the
  28579. // specified {@code ctx}.
  28580. //
  28581. // <p>If {@code ctx} is {@code null} and the end of the rule containing
  28582. // {@code s} is reached, {@link Token//EPSILON} is added to the result set.
  28583. // If {@code ctx} is not {@code null} and the end of the outermost rule is
  28584. // reached, {@link Token//EOF} is added to the result set.</p>
  28585. //
  28586. // @param s the ATN state
  28587. // @param stopState the ATN state to stop at. This can be a
  28588. // {@link BlockEndState} to detect epsilon paths through a closure.
  28589. // @param ctx the complete parser context, or {@code null} if the context
  28590. // should be ignored
  28591. //
  28592. // @return The set of tokens that can follow {@code s} in the ATN in the
  28593. // specified {@code ctx}.
  28594. ///
  28595. LL1Analyzer.prototype.LOOK = function(s, stopState, ctx) {
  28596. var r = new IntervalSet();
  28597. var seeThruPreds = true; // ignore preds; get all lookahead
  28598. ctx = ctx || null;
  28599. var lookContext = ctx!==null ? predictionContextFromRuleContext(s.atn, ctx) : null;
  28600. this._LOOK(s, stopState, lookContext, r, new Set(), new BitSet(), seeThruPreds, true);
  28601. return r;
  28602. };
  28603. //*
  28604. // Compute set of tokens that can follow {@code s} in the ATN in the
  28605. // specified {@code ctx}.
  28606. //
  28607. // <p>If {@code ctx} is {@code null} and {@code stopState} or the end of the
  28608. // rule containing {@code s} is reached, {@link Token//EPSILON} is added to
  28609. // the result set. If {@code ctx} is not {@code null} and {@code addEOF} is
  28610. // {@code true} and {@code stopState} or the end of the outermost rule is
  28611. // reached, {@link Token//EOF} is added to the result set.</p>
  28612. //
  28613. // @param s the ATN state.
  28614. // @param stopState the ATN state to stop at. This can be a
  28615. // {@link BlockEndState} to detect epsilon paths through a closure.
  28616. // @param ctx The outer context, or {@code null} if the outer context should
  28617. // not be used.
  28618. // @param look The result lookahead set.
  28619. // @param lookBusy A set used for preventing epsilon closures in the ATN
  28620. // from causing a stack overflow. Outside code should pass
  28621. // {@code new Set<ATNConfig>} for this argument.
  28622. // @param calledRuleStack A set used for preventing left recursion in the
  28623. // ATN from causing a stack overflow. Outside code should pass
  28624. // {@code new BitSet()} for this argument.
  28625. // @param seeThruPreds {@code true} to true semantic predicates as
  28626. // implicitly {@code true} and "see through them", otherwise {@code false}
  28627. // to treat semantic predicates as opaque and add {@link //HIT_PRED} to the
  28628. // result if one is encountered.
  28629. // @param addEOF Add {@link Token//EOF} to the result if the end of the
  28630. // outermost context is reached. This parameter has no effect if {@code ctx}
  28631. // is {@code null}.
  28632. ///
  28633. LL1Analyzer.prototype._LOOK = function(s, stopState , ctx, look, lookBusy, calledRuleStack, seeThruPreds, addEOF) {
  28634. var c = new ATNConfig({state:s, alt:0, context: ctx}, null);
  28635. if (lookBusy.contains(c)) {
  28636. return;
  28637. }
  28638. lookBusy.add(c);
  28639. if (s === stopState) {
  28640. if (ctx ===null) {
  28641. look.addOne(Token.EPSILON);
  28642. return;
  28643. } else if (ctx.isEmpty() && addEOF) {
  28644. look.addOne(Token.EOF);
  28645. return;
  28646. }
  28647. }
  28648. if (s instanceof RuleStopState ) {
  28649. if (ctx ===null) {
  28650. look.addOne(Token.EPSILON);
  28651. return;
  28652. } else if (ctx.isEmpty() && addEOF) {
  28653. look.addOne(Token.EOF);
  28654. return;
  28655. }
  28656. if (ctx !== PredictionContext.EMPTY) {
  28657. // run thru all possible stack tops in ctx
  28658. for(var i=0; i<ctx.length; i++) {
  28659. var returnState = this.atn.states[ctx.getReturnState(i)];
  28660. var removed = calledRuleStack.contains(returnState.ruleIndex);
  28661. try {
  28662. calledRuleStack.remove(returnState.ruleIndex);
  28663. this._LOOK(returnState, stopState, ctx.getParent(i), look, lookBusy, calledRuleStack, seeThruPreds, addEOF);
  28664. } finally {
  28665. if (removed) {
  28666. calledRuleStack.add(returnState.ruleIndex);
  28667. }
  28668. }
  28669. }
  28670. return;
  28671. }
  28672. }
  28673. for(var j=0; j<s.transitions.length; j++) {
  28674. var t = s.transitions[j];
  28675. if (t.constructor === RuleTransition) {
  28676. if (calledRuleStack.contains(t.target.ruleIndex)) {
  28677. continue;
  28678. }
  28679. var newContext = SingletonPredictionContext.create(ctx, t.followState.stateNumber);
  28680. try {
  28681. calledRuleStack.add(t.target.ruleIndex);
  28682. this._LOOK(t.target, stopState, newContext, look, lookBusy, calledRuleStack, seeThruPreds, addEOF);
  28683. } finally {
  28684. calledRuleStack.remove(t.target.ruleIndex);
  28685. }
  28686. } else if (t instanceof AbstractPredicateTransition ) {
  28687. if (seeThruPreds) {
  28688. this._LOOK(t.target, stopState, ctx, look, lookBusy, calledRuleStack, seeThruPreds, addEOF);
  28689. } else {
  28690. look.addOne(LL1Analyzer.HIT_PRED);
  28691. }
  28692. } else if( t.isEpsilon) {
  28693. this._LOOK(t.target, stopState, ctx, look, lookBusy, calledRuleStack, seeThruPreds, addEOF);
  28694. } else if (t.constructor === WildcardTransition) {
  28695. look.addRange( Token.MIN_USER_TOKEN_TYPE, this.atn.maxTokenType );
  28696. } else {
  28697. var set = t.label;
  28698. if (set !== null) {
  28699. if (t instanceof NotSetTransition) {
  28700. set = set.complement(Token.MIN_USER_TOKEN_TYPE, this.atn.maxTokenType);
  28701. }
  28702. look.addSet(set);
  28703. }
  28704. }
  28705. }
  28706. };
  28707. exports.LL1Analyzer = LL1Analyzer;
  28708. /***/ }),
  28709. /***/ "./node_modules/antlr4/Lexer.js":
  28710. /*!**************************************!*\
  28711. !*** ./node_modules/antlr4/Lexer.js ***!
  28712. \**************************************/
  28713. /*! no static exports found */
  28714. /***/ (function(module, exports, __webpack_require__) {
  28715. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  28716. * Use of this file is governed by the BSD 3-clause license that
  28717. * can be found in the LICENSE.txt file in the project root.
  28718. */
  28719. ///
  28720. // A lexer is recognizer that draws input symbols from a character stream.
  28721. // lexer grammars result in a subclass of this object. A Lexer object
  28722. // uses simplified match() and error recovery mechanisms in the interest of speed.
  28723. var Token = __webpack_require__(/*! ./Token */ "./node_modules/antlr4/Token.js").Token;
  28724. var Recognizer = __webpack_require__(/*! ./Recognizer */ "./node_modules/antlr4/Recognizer.js").Recognizer;
  28725. var CommonTokenFactory = __webpack_require__(/*! ./CommonTokenFactory */ "./node_modules/antlr4/CommonTokenFactory.js").CommonTokenFactory;
  28726. var RecognitionException = __webpack_require__(/*! ./error/Errors */ "./node_modules/antlr4/error/Errors.js").RecognitionException;
  28727. var LexerNoViableAltException = __webpack_require__(/*! ./error/Errors */ "./node_modules/antlr4/error/Errors.js").LexerNoViableAltException;
  28728. function TokenSource() {
  28729. return this;
  28730. }
  28731. function Lexer(input) {
  28732. Recognizer.call(this);
  28733. this._input = input;
  28734. this._factory = CommonTokenFactory.DEFAULT;
  28735. this._tokenFactorySourcePair = [ this, input ];
  28736. this._interp = null; // child classes must populate this
  28737. // The goal of all lexer rules/methods is to create a token object.
  28738. // this is an instance variable as multiple rules may collaborate to
  28739. // create a single token. nextToken will return this object after
  28740. // matching lexer rule(s). If you subclass to allow multiple token
  28741. // emissions, then set this to the last token to be matched or
  28742. // something nonnull so that the auto token emit mechanism will not
  28743. // emit another token.
  28744. this._token = null;
  28745. // What character index in the stream did the current token start at?
  28746. // Needed, for example, to get the text for current token. Set at
  28747. // the start of nextToken.
  28748. this._tokenStartCharIndex = -1;
  28749. // The line on which the first character of the token resides///
  28750. this._tokenStartLine = -1;
  28751. // The character position of first character within the line///
  28752. this._tokenStartColumn = -1;
  28753. // Once we see EOF on char stream, next token will be EOF.
  28754. // If you have DONE : EOF ; then you see DONE EOF.
  28755. this._hitEOF = false;
  28756. // The channel number for the current token///
  28757. this._channel = Token.DEFAULT_CHANNEL;
  28758. // The token type for the current token///
  28759. this._type = Token.INVALID_TYPE;
  28760. this._modeStack = [];
  28761. this._mode = Lexer.DEFAULT_MODE;
  28762. // You can set the text for the current token to override what is in
  28763. // the input char buffer. Use setText() or can set this instance var.
  28764. // /
  28765. this._text = null;
  28766. return this;
  28767. }
  28768. Lexer.prototype = Object.create(Recognizer.prototype);
  28769. Lexer.prototype.constructor = Lexer;
  28770. Lexer.DEFAULT_MODE = 0;
  28771. Lexer.MORE = -2;
  28772. Lexer.SKIP = -3;
  28773. Lexer.DEFAULT_TOKEN_CHANNEL = Token.DEFAULT_CHANNEL;
  28774. Lexer.HIDDEN = Token.HIDDEN_CHANNEL;
  28775. Lexer.MIN_CHAR_VALUE = 0x0000;
  28776. Lexer.MAX_CHAR_VALUE = 0x10FFFF;
  28777. Lexer.prototype.reset = function() {
  28778. // wack Lexer state variables
  28779. if (this._input !== null) {
  28780. this._input.seek(0); // rewind the input
  28781. }
  28782. this._token = null;
  28783. this._type = Token.INVALID_TYPE;
  28784. this._channel = Token.DEFAULT_CHANNEL;
  28785. this._tokenStartCharIndex = -1;
  28786. this._tokenStartColumn = -1;
  28787. this._tokenStartLine = -1;
  28788. this._text = null;
  28789. this._hitEOF = false;
  28790. this._mode = Lexer.DEFAULT_MODE;
  28791. this._modeStack = [];
  28792. this._interp.reset();
  28793. };
  28794. // Return a token from this source; i.e., match a token on the char stream.
  28795. Lexer.prototype.nextToken = function() {
  28796. if (this._input === null) {
  28797. throw "nextToken requires a non-null input stream.";
  28798. }
  28799. // Mark start location in char stream so unbuffered streams are
  28800. // guaranteed at least have text of current token
  28801. var tokenStartMarker = this._input.mark();
  28802. try {
  28803. while (true) {
  28804. if (this._hitEOF) {
  28805. this.emitEOF();
  28806. return this._token;
  28807. }
  28808. this._token = null;
  28809. this._channel = Token.DEFAULT_CHANNEL;
  28810. this._tokenStartCharIndex = this._input.index;
  28811. this._tokenStartColumn = this._interp.column;
  28812. this._tokenStartLine = this._interp.line;
  28813. this._text = null;
  28814. var continueOuter = false;
  28815. while (true) {
  28816. this._type = Token.INVALID_TYPE;
  28817. var ttype = Lexer.SKIP;
  28818. try {
  28819. ttype = this._interp.match(this._input, this._mode);
  28820. } catch (e) {
  28821. if(e instanceof RecognitionException) {
  28822. this.notifyListeners(e); // report error
  28823. this.recover(e);
  28824. } else {
  28825. console.log(e.stack);
  28826. throw e;
  28827. }
  28828. }
  28829. if (this._input.LA(1) === Token.EOF) {
  28830. this._hitEOF = true;
  28831. }
  28832. if (this._type === Token.INVALID_TYPE) {
  28833. this._type = ttype;
  28834. }
  28835. if (this._type === Lexer.SKIP) {
  28836. continueOuter = true;
  28837. break;
  28838. }
  28839. if (this._type !== Lexer.MORE) {
  28840. break;
  28841. }
  28842. }
  28843. if (continueOuter) {
  28844. continue;
  28845. }
  28846. if (this._token === null) {
  28847. this.emit();
  28848. }
  28849. return this._token;
  28850. }
  28851. } finally {
  28852. // make sure we release marker after match or
  28853. // unbuffered char stream will keep buffering
  28854. this._input.release(tokenStartMarker);
  28855. }
  28856. };
  28857. // Instruct the lexer to skip creating a token for current lexer rule
  28858. // and look for another token. nextToken() knows to keep looking when
  28859. // a lexer rule finishes with token set to SKIP_TOKEN. Recall that
  28860. // if token==null at end of any token rule, it creates one for you
  28861. // and emits it.
  28862. // /
  28863. Lexer.prototype.skip = function() {
  28864. this._type = Lexer.SKIP;
  28865. };
  28866. Lexer.prototype.more = function() {
  28867. this._type = Lexer.MORE;
  28868. };
  28869. Lexer.prototype.mode = function(m) {
  28870. this._mode = m;
  28871. };
  28872. Lexer.prototype.pushMode = function(m) {
  28873. if (this._interp.debug) {
  28874. console.log("pushMode " + m);
  28875. }
  28876. this._modeStack.push(this._mode);
  28877. this.mode(m);
  28878. };
  28879. Lexer.prototype.popMode = function() {
  28880. if (this._modeStack.length === 0) {
  28881. throw "Empty Stack";
  28882. }
  28883. if (this._interp.debug) {
  28884. console.log("popMode back to " + this._modeStack.slice(0, -1));
  28885. }
  28886. this.mode(this._modeStack.pop());
  28887. return this._mode;
  28888. };
  28889. // Set the char stream and reset the lexer
  28890. Object.defineProperty(Lexer.prototype, "inputStream", {
  28891. get : function() {
  28892. return this._input;
  28893. },
  28894. set : function(input) {
  28895. this._input = null;
  28896. this._tokenFactorySourcePair = [ this, this._input ];
  28897. this.reset();
  28898. this._input = input;
  28899. this._tokenFactorySourcePair = [ this, this._input ];
  28900. }
  28901. });
  28902. Object.defineProperty(Lexer.prototype, "sourceName", {
  28903. get : function sourceName() {
  28904. return this._input.sourceName;
  28905. }
  28906. });
  28907. // By default does not support multiple emits per nextToken invocation
  28908. // for efficiency reasons. Subclass and override this method, nextToken,
  28909. // and getToken (to push tokens into a list and pull from that list
  28910. // rather than a single variable as this implementation does).
  28911. // /
  28912. Lexer.prototype.emitToken = function(token) {
  28913. this._token = token;
  28914. };
  28915. // The standard method called to automatically emit a token at the
  28916. // outermost lexical rule. The token object should point into the
  28917. // char buffer start..stop. If there is a text override in 'text',
  28918. // use that to set the token's text. Override this method to emit
  28919. // custom Token objects or provide a new factory.
  28920. // /
  28921. Lexer.prototype.emit = function() {
  28922. var t = this._factory.create(this._tokenFactorySourcePair, this._type,
  28923. this._text, this._channel, this._tokenStartCharIndex, this
  28924. .getCharIndex() - 1, this._tokenStartLine,
  28925. this._tokenStartColumn);
  28926. this.emitToken(t);
  28927. return t;
  28928. };
  28929. Lexer.prototype.emitEOF = function() {
  28930. var cpos = this.column;
  28931. var lpos = this.line;
  28932. var eof = this._factory.create(this._tokenFactorySourcePair, Token.EOF,
  28933. null, Token.DEFAULT_CHANNEL, this._input.index,
  28934. this._input.index - 1, lpos, cpos);
  28935. this.emitToken(eof);
  28936. return eof;
  28937. };
  28938. Object.defineProperty(Lexer.prototype, "type", {
  28939. get : function() {
  28940. return this.type;
  28941. },
  28942. set : function(type) {
  28943. this._type = type;
  28944. }
  28945. });
  28946. Object.defineProperty(Lexer.prototype, "line", {
  28947. get : function() {
  28948. return this._interp.line;
  28949. },
  28950. set : function(line) {
  28951. this._interp.line = line;
  28952. }
  28953. });
  28954. Object.defineProperty(Lexer.prototype, "column", {
  28955. get : function() {
  28956. return this._interp.column;
  28957. },
  28958. set : function(column) {
  28959. this._interp.column = column;
  28960. }
  28961. });
  28962. // What is the index of the current character of lookahead?///
  28963. Lexer.prototype.getCharIndex = function() {
  28964. return this._input.index;
  28965. };
  28966. // Return the text matched so far for the current token or any text override.
  28967. //Set the complete text of this token; it wipes any previous changes to the text.
  28968. Object.defineProperty(Lexer.prototype, "text", {
  28969. get : function() {
  28970. if (this._text !== null) {
  28971. return this._text;
  28972. } else {
  28973. return this._interp.getText(this._input);
  28974. }
  28975. },
  28976. set : function(text) {
  28977. this._text = text;
  28978. }
  28979. });
  28980. // Return a list of all Token objects in input char stream.
  28981. // Forces load of all tokens. Does not include EOF token.
  28982. // /
  28983. Lexer.prototype.getAllTokens = function() {
  28984. var tokens = [];
  28985. var t = this.nextToken();
  28986. while (t.type !== Token.EOF) {
  28987. tokens.push(t);
  28988. t = this.nextToken();
  28989. }
  28990. return tokens;
  28991. };
  28992. Lexer.prototype.notifyListeners = function(e) {
  28993. var start = this._tokenStartCharIndex;
  28994. var stop = this._input.index;
  28995. var text = this._input.getText(start, stop);
  28996. var msg = "token recognition error at: '" + this.getErrorDisplay(text) + "'";
  28997. var listener = this.getErrorListenerDispatch();
  28998. listener.syntaxError(this, null, this._tokenStartLine,
  28999. this._tokenStartColumn, msg, e);
  29000. };
  29001. Lexer.prototype.getErrorDisplay = function(s) {
  29002. var d = [];
  29003. for (var i = 0; i < s.length; i++) {
  29004. d.push(s[i]);
  29005. }
  29006. return d.join('');
  29007. };
  29008. Lexer.prototype.getErrorDisplayForChar = function(c) {
  29009. if (c.charCodeAt(0) === Token.EOF) {
  29010. return "<EOF>";
  29011. } else if (c === '\n') {
  29012. return "\\n";
  29013. } else if (c === '\t') {
  29014. return "\\t";
  29015. } else if (c === '\r') {
  29016. return "\\r";
  29017. } else {
  29018. return c;
  29019. }
  29020. };
  29021. Lexer.prototype.getCharErrorDisplay = function(c) {
  29022. return "'" + this.getErrorDisplayForChar(c) + "'";
  29023. };
  29024. // Lexers can normally match any char in it's vocabulary after matching
  29025. // a token, so do the easy thing and just kill a character and hope
  29026. // it all works out. You can instead use the rule invocation stack
  29027. // to do sophisticated error recovery if you are in a fragment rule.
  29028. // /
  29029. Lexer.prototype.recover = function(re) {
  29030. if (this._input.LA(1) !== Token.EOF) {
  29031. if (re instanceof LexerNoViableAltException) {
  29032. // skip a char and try again
  29033. this._interp.consume(this._input);
  29034. } else {
  29035. // TODO: Do we lose character or line position information?
  29036. this._input.consume();
  29037. }
  29038. }
  29039. };
  29040. exports.Lexer = Lexer;
  29041. /***/ }),
  29042. /***/ "./node_modules/antlr4/Parser.js":
  29043. /*!***************************************!*\
  29044. !*** ./node_modules/antlr4/Parser.js ***!
  29045. \***************************************/
  29046. /*! no static exports found */
  29047. /***/ (function(module, exports, __webpack_require__) {
  29048. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  29049. * Use of this file is governed by the BSD 3-clause license that
  29050. * can be found in the LICENSE.txt file in the project root.
  29051. */
  29052. var Token = __webpack_require__(/*! ./Token */ "./node_modules/antlr4/Token.js").Token;
  29053. var ParseTreeListener = __webpack_require__(/*! ./tree/Tree */ "./node_modules/antlr4/tree/Tree.js").ParseTreeListener;
  29054. var Recognizer = __webpack_require__(/*! ./Recognizer */ "./node_modules/antlr4/Recognizer.js").Recognizer;
  29055. var DefaultErrorStrategy = __webpack_require__(/*! ./error/ErrorStrategy */ "./node_modules/antlr4/error/ErrorStrategy.js").DefaultErrorStrategy;
  29056. var ATNDeserializer = __webpack_require__(/*! ./atn/ATNDeserializer */ "./node_modules/antlr4/atn/ATNDeserializer.js").ATNDeserializer;
  29057. var ATNDeserializationOptions = __webpack_require__(/*! ./atn/ATNDeserializationOptions */ "./node_modules/antlr4/atn/ATNDeserializationOptions.js").ATNDeserializationOptions;
  29058. var TerminalNode = __webpack_require__(/*! ./tree/Tree */ "./node_modules/antlr4/tree/Tree.js").TerminalNode;
  29059. var ErrorNode = __webpack_require__(/*! ./tree/Tree */ "./node_modules/antlr4/tree/Tree.js").ErrorNode;
  29060. function TraceListener(parser) {
  29061. ParseTreeListener.call(this);
  29062. this.parser = parser;
  29063. return this;
  29064. }
  29065. TraceListener.prototype = Object.create(ParseTreeListener.prototype);
  29066. TraceListener.prototype.constructor = TraceListener;
  29067. TraceListener.prototype.enterEveryRule = function(ctx) {
  29068. console.log("enter " + this.parser.ruleNames[ctx.ruleIndex] + ", LT(1)=" + this.parser._input.LT(1).text);
  29069. };
  29070. TraceListener.prototype.visitTerminal = function( node) {
  29071. console.log("consume " + node.symbol + " rule " + this.parser.ruleNames[this.parser._ctx.ruleIndex]);
  29072. };
  29073. TraceListener.prototype.exitEveryRule = function(ctx) {
  29074. console.log("exit " + this.parser.ruleNames[ctx.ruleIndex] + ", LT(1)=" + this.parser._input.LT(1).text);
  29075. };
  29076. // this is all the parsing support code essentially; most of it is error
  29077. // recovery stuff.//
  29078. function Parser(input) {
  29079. Recognizer.call(this);
  29080. // The input stream.
  29081. this._input = null;
  29082. // The error handling strategy for the parser. The default value is a new
  29083. // instance of {@link DefaultErrorStrategy}.
  29084. this._errHandler = new DefaultErrorStrategy();
  29085. this._precedenceStack = [];
  29086. this._precedenceStack.push(0);
  29087. // The {@link ParserRuleContext} object for the currently executing rule.
  29088. // this is always non-null during the parsing process.
  29089. this._ctx = null;
  29090. // Specifies whether or not the parser should construct a parse tree during
  29091. // the parsing process. The default value is {@code true}.
  29092. this.buildParseTrees = true;
  29093. // When {@link //setTrace}{@code (true)} is called, a reference to the
  29094. // {@link TraceListener} is stored here so it can be easily removed in a
  29095. // later call to {@link //setTrace}{@code (false)}. The listener itself is
  29096. // implemented as a parser listener so this field is not directly used by
  29097. // other parser methods.
  29098. this._tracer = null;
  29099. // The list of {@link ParseTreeListener} listeners registered to receive
  29100. // events during the parse.
  29101. this._parseListeners = null;
  29102. // The number of syntax errors reported during parsing. this value is
  29103. // incremented each time {@link //notifyErrorListeners} is called.
  29104. this._syntaxErrors = 0;
  29105. this.setInputStream(input);
  29106. return this;
  29107. }
  29108. Parser.prototype = Object.create(Recognizer.prototype);
  29109. Parser.prototype.contructor = Parser;
  29110. // this field maps from the serialized ATN string to the deserialized {@link
  29111. // ATN} with
  29112. // bypass alternatives.
  29113. //
  29114. // @see ATNDeserializationOptions//isGenerateRuleBypassTransitions()
  29115. //
  29116. Parser.bypassAltsAtnCache = {};
  29117. // reset the parser's state//
  29118. Parser.prototype.reset = function() {
  29119. if (this._input !== null) {
  29120. this._input.seek(0);
  29121. }
  29122. this._errHandler.reset(this);
  29123. this._ctx = null;
  29124. this._syntaxErrors = 0;
  29125. this.setTrace(false);
  29126. this._precedenceStack = [];
  29127. this._precedenceStack.push(0);
  29128. if (this._interp !== null) {
  29129. this._interp.reset();
  29130. }
  29131. };
  29132. // Match current input symbol against {@code ttype}. If the symbol type
  29133. // matches, {@link ANTLRErrorStrategy//reportMatch} and {@link //consume} are
  29134. // called to complete the match process.
  29135. //
  29136. // <p>If the symbol type does not match,
  29137. // {@link ANTLRErrorStrategy//recoverInline} is called on the current error
  29138. // strategy to attempt recovery. If {@link //getBuildParseTree} is
  29139. // {@code true} and the token index of the symbol returned by
  29140. // {@link ANTLRErrorStrategy//recoverInline} is -1, the symbol is added to
  29141. // the parse tree by calling {@link ParserRuleContext//addErrorNode}.</p>
  29142. //
  29143. // @param ttype the token type to match
  29144. // @return the matched symbol
  29145. // @throws RecognitionException if the current input symbol did not match
  29146. // {@code ttype} and the error strategy could not recover from the
  29147. // mismatched symbol
  29148. Parser.prototype.match = function(ttype) {
  29149. var t = this.getCurrentToken();
  29150. if (t.type === ttype) {
  29151. this._errHandler.reportMatch(this);
  29152. this.consume();
  29153. } else {
  29154. t = this._errHandler.recoverInline(this);
  29155. if (this.buildParseTrees && t.tokenIndex === -1) {
  29156. // we must have conjured up a new token during single token
  29157. // insertion
  29158. // if it's not the current symbol
  29159. this._ctx.addErrorNode(t);
  29160. }
  29161. }
  29162. return t;
  29163. };
  29164. // Match current input symbol as a wildcard. If the symbol type matches
  29165. // (i.e. has a value greater than 0), {@link ANTLRErrorStrategy//reportMatch}
  29166. // and {@link //consume} are called to complete the match process.
  29167. //
  29168. // <p>If the symbol type does not match,
  29169. // {@link ANTLRErrorStrategy//recoverInline} is called on the current error
  29170. // strategy to attempt recovery. If {@link //getBuildParseTree} is
  29171. // {@code true} and the token index of the symbol returned by
  29172. // {@link ANTLRErrorStrategy//recoverInline} is -1, the symbol is added to
  29173. // the parse tree by calling {@link ParserRuleContext//addErrorNode}.</p>
  29174. //
  29175. // @return the matched symbol
  29176. // @throws RecognitionException if the current input symbol did not match
  29177. // a wildcard and the error strategy could not recover from the mismatched
  29178. // symbol
  29179. Parser.prototype.matchWildcard = function() {
  29180. var t = this.getCurrentToken();
  29181. if (t.type > 0) {
  29182. this._errHandler.reportMatch(this);
  29183. this.consume();
  29184. } else {
  29185. t = this._errHandler.recoverInline(this);
  29186. if (this._buildParseTrees && t.tokenIndex === -1) {
  29187. // we must have conjured up a new token during single token
  29188. // insertion
  29189. // if it's not the current symbol
  29190. this._ctx.addErrorNode(t);
  29191. }
  29192. }
  29193. return t;
  29194. };
  29195. Parser.prototype.getParseListeners = function() {
  29196. return this._parseListeners || [];
  29197. };
  29198. // Registers {@code listener} to receive events during the parsing process.
  29199. //
  29200. // <p>To support output-preserving grammar transformations (including but not
  29201. // limited to left-recursion removal, automated left-factoring, and
  29202. // optimized code generation), calls to listener methods during the parse
  29203. // may differ substantially from calls made by
  29204. // {@link ParseTreeWalker//DEFAULT} used after the parse is complete. In
  29205. // particular, rule entry and exit events may occur in a different order
  29206. // during the parse than after the parser. In addition, calls to certain
  29207. // rule entry methods may be omitted.</p>
  29208. //
  29209. // <p>With the following specific exceptions, calls to listener events are
  29210. // <em>deterministic</em>, i.e. for identical input the calls to listener
  29211. // methods will be the same.</p>
  29212. //
  29213. // <ul>
  29214. // <li>Alterations to the grammar used to generate code may change the
  29215. // behavior of the listener calls.</li>
  29216. // <li>Alterations to the command line options passed to ANTLR 4 when
  29217. // generating the parser may change the behavior of the listener calls.</li>
  29218. // <li>Changing the version of the ANTLR Tool used to generate the parser
  29219. // may change the behavior of the listener calls.</li>
  29220. // </ul>
  29221. //
  29222. // @param listener the listener to add
  29223. //
  29224. // @throws NullPointerException if {@code} listener is {@code null}
  29225. //
  29226. Parser.prototype.addParseListener = function(listener) {
  29227. if (listener === null) {
  29228. throw "listener";
  29229. }
  29230. if (this._parseListeners === null) {
  29231. this._parseListeners = [];
  29232. }
  29233. this._parseListeners.push(listener);
  29234. };
  29235. //
  29236. // Remove {@code listener} from the list of parse listeners.
  29237. //
  29238. // <p>If {@code listener} is {@code null} or has not been added as a parse
  29239. // listener, this method does nothing.</p>
  29240. // @param listener the listener to remove
  29241. //
  29242. Parser.prototype.removeParseListener = function(listener) {
  29243. if (this._parseListeners !== null) {
  29244. var idx = this._parseListeners.indexOf(listener);
  29245. if (idx >= 0) {
  29246. this._parseListeners.splice(idx, 1);
  29247. }
  29248. if (this._parseListeners.length === 0) {
  29249. this._parseListeners = null;
  29250. }
  29251. }
  29252. };
  29253. // Remove all parse listeners.
  29254. Parser.prototype.removeParseListeners = function() {
  29255. this._parseListeners = null;
  29256. };
  29257. // Notify any parse listeners of an enter rule event.
  29258. Parser.prototype.triggerEnterRuleEvent = function() {
  29259. if (this._parseListeners !== null) {
  29260. var ctx = this._ctx;
  29261. this._parseListeners.map(function(listener) {
  29262. listener.enterEveryRule(ctx);
  29263. ctx.enterRule(listener);
  29264. });
  29265. }
  29266. };
  29267. //
  29268. // Notify any parse listeners of an exit rule event.
  29269. //
  29270. // @see //addParseListener
  29271. //
  29272. Parser.prototype.triggerExitRuleEvent = function() {
  29273. if (this._parseListeners !== null) {
  29274. // reverse order walk of listeners
  29275. var ctx = this._ctx;
  29276. this._parseListeners.slice(0).reverse().map(function(listener) {
  29277. ctx.exitRule(listener);
  29278. listener.exitEveryRule(ctx);
  29279. });
  29280. }
  29281. };
  29282. Parser.prototype.getTokenFactory = function() {
  29283. return this._input.tokenSource._factory;
  29284. };
  29285. // Tell our token source and error strategy about a new way to create tokens.//
  29286. Parser.prototype.setTokenFactory = function(factory) {
  29287. this._input.tokenSource._factory = factory;
  29288. };
  29289. // The ATN with bypass alternatives is expensive to create so we create it
  29290. // lazily.
  29291. //
  29292. // @throws UnsupportedOperationException if the current parser does not
  29293. // implement the {@link //getSerializedATN()} method.
  29294. //
  29295. Parser.prototype.getATNWithBypassAlts = function() {
  29296. var serializedAtn = this.getSerializedATN();
  29297. if (serializedAtn === null) {
  29298. throw "The current parser does not support an ATN with bypass alternatives.";
  29299. }
  29300. var result = this.bypassAltsAtnCache[serializedAtn];
  29301. if (result === null) {
  29302. var deserializationOptions = new ATNDeserializationOptions();
  29303. deserializationOptions.generateRuleBypassTransitions = true;
  29304. result = new ATNDeserializer(deserializationOptions)
  29305. .deserialize(serializedAtn);
  29306. this.bypassAltsAtnCache[serializedAtn] = result;
  29307. }
  29308. return result;
  29309. };
  29310. // The preferred method of getting a tree pattern. For example, here's a
  29311. // sample use:
  29312. //
  29313. // <pre>
  29314. // ParseTree t = parser.expr();
  29315. // ParseTreePattern p = parser.compileParseTreePattern("&lt;ID&gt;+0",
  29316. // MyParser.RULE_expr);
  29317. // ParseTreeMatch m = p.match(t);
  29318. // String id = m.get("ID");
  29319. // </pre>
  29320. var Lexer = __webpack_require__(/*! ./Lexer */ "./node_modules/antlr4/Lexer.js").Lexer;
  29321. Parser.prototype.compileParseTreePattern = function(pattern, patternRuleIndex, lexer) {
  29322. lexer = lexer || null;
  29323. if (lexer === null) {
  29324. if (this.getTokenStream() !== null) {
  29325. var tokenSource = this.getTokenStream().tokenSource;
  29326. if (tokenSource instanceof Lexer) {
  29327. lexer = tokenSource;
  29328. }
  29329. }
  29330. }
  29331. if (lexer === null) {
  29332. throw "Parser can't discover a lexer to use";
  29333. }
  29334. var m = new ParseTreePatternMatcher(lexer, this);
  29335. return m.compile(pattern, patternRuleIndex);
  29336. };
  29337. Parser.prototype.getInputStream = function() {
  29338. return this.getTokenStream();
  29339. };
  29340. Parser.prototype.setInputStream = function(input) {
  29341. this.setTokenStream(input);
  29342. };
  29343. Parser.prototype.getTokenStream = function() {
  29344. return this._input;
  29345. };
  29346. // Set the token stream and reset the parser.//
  29347. Parser.prototype.setTokenStream = function(input) {
  29348. this._input = null;
  29349. this.reset();
  29350. this._input = input;
  29351. };
  29352. // Match needs to return the current input symbol, which gets put
  29353. // into the label for the associated token ref; e.g., x=ID.
  29354. //
  29355. Parser.prototype.getCurrentToken = function() {
  29356. return this._input.LT(1);
  29357. };
  29358. Parser.prototype.notifyErrorListeners = function(msg, offendingToken, err) {
  29359. offendingToken = offendingToken || null;
  29360. err = err || null;
  29361. if (offendingToken === null) {
  29362. offendingToken = this.getCurrentToken();
  29363. }
  29364. this._syntaxErrors += 1;
  29365. var line = offendingToken.line;
  29366. var column = offendingToken.column;
  29367. var listener = this.getErrorListenerDispatch();
  29368. listener.syntaxError(this, offendingToken, line, column, msg, err);
  29369. };
  29370. //
  29371. // Consume and return the {@linkplain //getCurrentToken current symbol}.
  29372. //
  29373. // <p>E.g., given the following input with {@code A} being the current
  29374. // lookahead symbol, this function moves the cursor to {@code B} and returns
  29375. // {@code A}.</p>
  29376. //
  29377. // <pre>
  29378. // A B
  29379. // ^
  29380. // </pre>
  29381. //
  29382. // If the parser is not in error recovery mode, the consumed symbol is added
  29383. // to the parse tree using {@link ParserRuleContext//addChild(Token)}, and
  29384. // {@link ParseTreeListener//visitTerminal} is called on any parse listeners.
  29385. // If the parser <em>is</em> in error recovery mode, the consumed symbol is
  29386. // added to the parse tree using
  29387. // {@link ParserRuleContext//addErrorNode(Token)}, and
  29388. // {@link ParseTreeListener//visitErrorNode} is called on any parse
  29389. // listeners.
  29390. //
  29391. Parser.prototype.consume = function() {
  29392. var o = this.getCurrentToken();
  29393. if (o.type !== Token.EOF) {
  29394. this.getInputStream().consume();
  29395. }
  29396. var hasListener = this._parseListeners !== null && this._parseListeners.length > 0;
  29397. if (this.buildParseTrees || hasListener) {
  29398. var node;
  29399. if (this._errHandler.inErrorRecoveryMode(this)) {
  29400. node = this._ctx.addErrorNode(o);
  29401. } else {
  29402. node = this._ctx.addTokenNode(o);
  29403. }
  29404. node.invokingState = this.state;
  29405. if (hasListener) {
  29406. this._parseListeners.map(function(listener) {
  29407. if (node instanceof ErrorNode || (node.isErrorNode !== undefined && node.isErrorNode())) {
  29408. listener.visitErrorNode(node);
  29409. } else if (node instanceof TerminalNode) {
  29410. listener.visitTerminal(node);
  29411. }
  29412. });
  29413. }
  29414. }
  29415. return o;
  29416. };
  29417. Parser.prototype.addContextToParseTree = function() {
  29418. // add current context to parent if we have a parent
  29419. if (this._ctx.parentCtx !== null) {
  29420. this._ctx.parentCtx.addChild(this._ctx);
  29421. }
  29422. };
  29423. // Always called by generated parsers upon entry to a rule. Access field
  29424. // {@link //_ctx} get the current context.
  29425. Parser.prototype.enterRule = function(localctx, state, ruleIndex) {
  29426. this.state = state;
  29427. this._ctx = localctx;
  29428. this._ctx.start = this._input.LT(1);
  29429. if (this.buildParseTrees) {
  29430. this.addContextToParseTree();
  29431. }
  29432. if (this._parseListeners !== null) {
  29433. this.triggerEnterRuleEvent();
  29434. }
  29435. };
  29436. Parser.prototype.exitRule = function() {
  29437. this._ctx.stop = this._input.LT(-1);
  29438. // trigger event on _ctx, before it reverts to parent
  29439. if (this._parseListeners !== null) {
  29440. this.triggerExitRuleEvent();
  29441. }
  29442. this.state = this._ctx.invokingState;
  29443. this._ctx = this._ctx.parentCtx;
  29444. };
  29445. Parser.prototype.enterOuterAlt = function(localctx, altNum) {
  29446. localctx.setAltNumber(altNum);
  29447. // if we have new localctx, make sure we replace existing ctx
  29448. // that is previous child of parse tree
  29449. if (this.buildParseTrees && this._ctx !== localctx) {
  29450. if (this._ctx.parentCtx !== null) {
  29451. this._ctx.parentCtx.removeLastChild();
  29452. this._ctx.parentCtx.addChild(localctx);
  29453. }
  29454. }
  29455. this._ctx = localctx;
  29456. };
  29457. // Get the precedence level for the top-most precedence rule.
  29458. //
  29459. // @return The precedence level for the top-most precedence rule, or -1 if
  29460. // the parser context is not nested within a precedence rule.
  29461. Parser.prototype.getPrecedence = function() {
  29462. if (this._precedenceStack.length === 0) {
  29463. return -1;
  29464. } else {
  29465. return this._precedenceStack[this._precedenceStack.length-1];
  29466. }
  29467. };
  29468. Parser.prototype.enterRecursionRule = function(localctx, state, ruleIndex,
  29469. precedence) {
  29470. this.state = state;
  29471. this._precedenceStack.push(precedence);
  29472. this._ctx = localctx;
  29473. this._ctx.start = this._input.LT(1);
  29474. if (this._parseListeners !== null) {
  29475. this.triggerEnterRuleEvent(); // simulates rule entry for
  29476. // left-recursive rules
  29477. }
  29478. };
  29479. //
  29480. // Like {@link //enterRule} but for recursive rules.
  29481. Parser.prototype.pushNewRecursionContext = function(localctx, state, ruleIndex) {
  29482. var previous = this._ctx;
  29483. previous.parentCtx = localctx;
  29484. previous.invokingState = state;
  29485. previous.stop = this._input.LT(-1);
  29486. this._ctx = localctx;
  29487. this._ctx.start = previous.start;
  29488. if (this.buildParseTrees) {
  29489. this._ctx.addChild(previous);
  29490. }
  29491. if (this._parseListeners !== null) {
  29492. this.triggerEnterRuleEvent(); // simulates rule entry for
  29493. // left-recursive rules
  29494. }
  29495. };
  29496. Parser.prototype.unrollRecursionContexts = function(parentCtx) {
  29497. this._precedenceStack.pop();
  29498. this._ctx.stop = this._input.LT(-1);
  29499. var retCtx = this._ctx; // save current ctx (return value)
  29500. // unroll so _ctx is as it was before call to recursive method
  29501. if (this._parseListeners !== null) {
  29502. while (this._ctx !== parentCtx) {
  29503. this.triggerExitRuleEvent();
  29504. this._ctx = this._ctx.parentCtx;
  29505. }
  29506. } else {
  29507. this._ctx = parentCtx;
  29508. }
  29509. // hook into tree
  29510. retCtx.parentCtx = parentCtx;
  29511. if (this.buildParseTrees && parentCtx !== null) {
  29512. // add return ctx into invoking rule's tree
  29513. parentCtx.addChild(retCtx);
  29514. }
  29515. };
  29516. Parser.prototype.getInvokingContext = function(ruleIndex) {
  29517. var ctx = this._ctx;
  29518. while (ctx !== null) {
  29519. if (ctx.ruleIndex === ruleIndex) {
  29520. return ctx;
  29521. }
  29522. ctx = ctx.parentCtx;
  29523. }
  29524. return null;
  29525. };
  29526. Parser.prototype.precpred = function(localctx, precedence) {
  29527. return precedence >= this._precedenceStack[this._precedenceStack.length-1];
  29528. };
  29529. Parser.prototype.inContext = function(context) {
  29530. // TODO: useful in parser?
  29531. return false;
  29532. };
  29533. //
  29534. // Checks whether or not {@code symbol} can follow the current state in the
  29535. // ATN. The behavior of this method is equivalent to the following, but is
  29536. // implemented such that the complete context-sensitive follow set does not
  29537. // need to be explicitly constructed.
  29538. //
  29539. // <pre>
  29540. // return getExpectedTokens().contains(symbol);
  29541. // </pre>
  29542. //
  29543. // @param symbol the symbol type to check
  29544. // @return {@code true} if {@code symbol} can follow the current state in
  29545. // the ATN, otherwise {@code false}.
  29546. Parser.prototype.isExpectedToken = function(symbol) {
  29547. var atn = this._interp.atn;
  29548. var ctx = this._ctx;
  29549. var s = atn.states[this.state];
  29550. var following = atn.nextTokens(s);
  29551. if (following.contains(symbol)) {
  29552. return true;
  29553. }
  29554. if (!following.contains(Token.EPSILON)) {
  29555. return false;
  29556. }
  29557. while (ctx !== null && ctx.invokingState >= 0 && following.contains(Token.EPSILON)) {
  29558. var invokingState = atn.states[ctx.invokingState];
  29559. var rt = invokingState.transitions[0];
  29560. following = atn.nextTokens(rt.followState);
  29561. if (following.contains(symbol)) {
  29562. return true;
  29563. }
  29564. ctx = ctx.parentCtx;
  29565. }
  29566. if (following.contains(Token.EPSILON) && symbol === Token.EOF) {
  29567. return true;
  29568. } else {
  29569. return false;
  29570. }
  29571. };
  29572. // Computes the set of input symbols which could follow the current parser
  29573. // state and context, as given by {@link //getState} and {@link //getContext},
  29574. // respectively.
  29575. //
  29576. // @see ATN//getExpectedTokens(int, RuleContext)
  29577. //
  29578. Parser.prototype.getExpectedTokens = function() {
  29579. return this._interp.atn.getExpectedTokens(this.state, this._ctx);
  29580. };
  29581. Parser.prototype.getExpectedTokensWithinCurrentRule = function() {
  29582. var atn = this._interp.atn;
  29583. var s = atn.states[this.state];
  29584. return atn.nextTokens(s);
  29585. };
  29586. // Get a rule's index (i.e., {@code RULE_ruleName} field) or -1 if not found.//
  29587. Parser.prototype.getRuleIndex = function(ruleName) {
  29588. var ruleIndex = this.getRuleIndexMap()[ruleName];
  29589. if (ruleIndex !== null) {
  29590. return ruleIndex;
  29591. } else {
  29592. return -1;
  29593. }
  29594. };
  29595. // Return List&lt;String&gt; of the rule names in your parser instance
  29596. // leading up to a call to the current rule. You could override if
  29597. // you want more details such as the file/line info of where
  29598. // in the ATN a rule is invoked.
  29599. //
  29600. // this is very useful for error messages.
  29601. //
  29602. Parser.prototype.getRuleInvocationStack = function(p) {
  29603. p = p || null;
  29604. if (p === null) {
  29605. p = this._ctx;
  29606. }
  29607. var stack = [];
  29608. while (p !== null) {
  29609. // compute what follows who invoked us
  29610. var ruleIndex = p.ruleIndex;
  29611. if (ruleIndex < 0) {
  29612. stack.push("n/a");
  29613. } else {
  29614. stack.push(this.ruleNames[ruleIndex]);
  29615. }
  29616. p = p.parentCtx;
  29617. }
  29618. return stack;
  29619. };
  29620. // For debugging and other purposes.//
  29621. Parser.prototype.getDFAStrings = function() {
  29622. return this._interp.decisionToDFA.toString();
  29623. };
  29624. // For debugging and other purposes.//
  29625. Parser.prototype.dumpDFA = function() {
  29626. var seenOne = false;
  29627. for (var i = 0; i < this._interp.decisionToDFA.length; i++) {
  29628. var dfa = this._interp.decisionToDFA[i];
  29629. if (dfa.states.length > 0) {
  29630. if (seenOne) {
  29631. console.log();
  29632. }
  29633. this.printer.println("Decision " + dfa.decision + ":");
  29634. this.printer.print(dfa.toString(this.literalNames, this.symbolicNames));
  29635. seenOne = true;
  29636. }
  29637. }
  29638. };
  29639. /*
  29640. " printer = function() {\r\n" +
  29641. " this.println = function(s) { document.getElementById('output') += s + '\\n'; }\r\n" +
  29642. " this.print = function(s) { document.getElementById('output') += s; }\r\n" +
  29643. " };\r\n" +
  29644. */
  29645. Parser.prototype.getSourceName = function() {
  29646. return this._input.sourceName;
  29647. };
  29648. // During a parse is sometimes useful to listen in on the rule entry and exit
  29649. // events as well as token matches. this is for quick and dirty debugging.
  29650. //
  29651. Parser.prototype.setTrace = function(trace) {
  29652. if (!trace) {
  29653. this.removeParseListener(this._tracer);
  29654. this._tracer = null;
  29655. } else {
  29656. if (this._tracer !== null) {
  29657. this.removeParseListener(this._tracer);
  29658. }
  29659. this._tracer = new TraceListener(this);
  29660. this.addParseListener(this._tracer);
  29661. }
  29662. };
  29663. exports.Parser = Parser;
  29664. /***/ }),
  29665. /***/ "./node_modules/antlr4/ParserRuleContext.js":
  29666. /*!**************************************************!*\
  29667. !*** ./node_modules/antlr4/ParserRuleContext.js ***!
  29668. \**************************************************/
  29669. /*! no static exports found */
  29670. /***/ (function(module, exports, __webpack_require__) {
  29671. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  29672. * Use of this file is governed by the BSD 3-clause license that
  29673. * can be found in the LICENSE.txt file in the project root.
  29674. */
  29675. //* A rule invocation record for parsing.
  29676. //
  29677. // Contains all of the information about the current rule not stored in the
  29678. // RuleContext. It handles parse tree children list, Any ATN state
  29679. // tracing, and the default values available for rule indications:
  29680. // start, stop, rule index, current alt number, current
  29681. // ATN state.
  29682. //
  29683. // Subclasses made for each rule and grammar track the parameters,
  29684. // return values, locals, and labels specific to that rule. These
  29685. // are the objects that are returned from rules.
  29686. //
  29687. // Note text is not an actual field of a rule return value; it is computed
  29688. // from start and stop using the input stream's toString() method. I
  29689. // could add a ctor to this so that we can pass in and store the input
  29690. // stream, but I'm not sure we want to do that. It would seem to be undefined
  29691. // to get the .text property anyway if the rule matches tokens from multiple
  29692. // input streams.
  29693. //
  29694. // I do not use getters for fields of objects that are used simply to
  29695. // group values such as this aggregate. The getters/setters are there to
  29696. // satisfy the superclass interface.
  29697. var RuleContext = __webpack_require__(/*! ./RuleContext */ "./node_modules/antlr4/RuleContext.js").RuleContext;
  29698. var Tree = __webpack_require__(/*! ./tree/Tree */ "./node_modules/antlr4/tree/Tree.js");
  29699. var INVALID_INTERVAL = Tree.INVALID_INTERVAL;
  29700. var TerminalNode = Tree.TerminalNode;
  29701. var TerminalNodeImpl = Tree.TerminalNodeImpl;
  29702. var ErrorNodeImpl = Tree.ErrorNodeImpl;
  29703. var Interval = __webpack_require__(/*! ./IntervalSet */ "./node_modules/antlr4/IntervalSet.js").Interval;
  29704. function ParserRuleContext(parent, invokingStateNumber) {
  29705. parent = parent || null;
  29706. invokingStateNumber = invokingStateNumber || null;
  29707. RuleContext.call(this, parent, invokingStateNumber);
  29708. this.ruleIndex = -1;
  29709. // * If we are debugging or building a parse tree for a visitor,
  29710. // we need to track all of the tokens and rule invocations associated
  29711. // with this rule's context. This is empty for parsing w/o tree constr.
  29712. // operation because we don't the need to track the details about
  29713. // how we parse this rule.
  29714. // /
  29715. this.children = null;
  29716. this.start = null;
  29717. this.stop = null;
  29718. // The exception that forced this rule to return. If the rule successfully
  29719. // completed, this is {@code null}.
  29720. this.exception = null;
  29721. }
  29722. ParserRuleContext.prototype = Object.create(RuleContext.prototype);
  29723. ParserRuleContext.prototype.constructor = ParserRuleContext;
  29724. // * COPY a ctx (I'm deliberately not using copy constructor)///
  29725. ParserRuleContext.prototype.copyFrom = function(ctx) {
  29726. // from RuleContext
  29727. this.parentCtx = ctx.parentCtx;
  29728. this.invokingState = ctx.invokingState;
  29729. this.children = null;
  29730. this.start = ctx.start;
  29731. this.stop = ctx.stop;
  29732. // copy any error nodes to alt label node
  29733. if(ctx.children) {
  29734. this.children = [];
  29735. // reset parent pointer for any error nodes
  29736. ctx.children.map(function(child) {
  29737. if (child instanceof ErrorNodeImpl) {
  29738. this.children.push(child);
  29739. child.parentCtx = this;
  29740. }
  29741. }, this);
  29742. }
  29743. };
  29744. // Double dispatch methods for listeners
  29745. ParserRuleContext.prototype.enterRule = function(listener) {
  29746. };
  29747. ParserRuleContext.prototype.exitRule = function(listener) {
  29748. };
  29749. // * Does not set parent link; other add methods do that///
  29750. ParserRuleContext.prototype.addChild = function(child) {
  29751. if (this.children === null) {
  29752. this.children = [];
  29753. }
  29754. this.children.push(child);
  29755. return child;
  29756. };
  29757. // * Used by enterOuterAlt to toss out a RuleContext previously added as
  29758. // we entered a rule. If we have // label, we will need to remove
  29759. // generic ruleContext object.
  29760. // /
  29761. ParserRuleContext.prototype.removeLastChild = function() {
  29762. if (this.children !== null) {
  29763. this.children.pop();
  29764. }
  29765. };
  29766. ParserRuleContext.prototype.addTokenNode = function(token) {
  29767. var node = new TerminalNodeImpl(token);
  29768. this.addChild(node);
  29769. node.parentCtx = this;
  29770. return node;
  29771. };
  29772. ParserRuleContext.prototype.addErrorNode = function(badToken) {
  29773. var node = new ErrorNodeImpl(badToken);
  29774. this.addChild(node);
  29775. node.parentCtx = this;
  29776. return node;
  29777. };
  29778. ParserRuleContext.prototype.getChild = function(i, type) {
  29779. type = type || null;
  29780. if (this.children === null || i < 0 || i >= this.children.length) {
  29781. return null;
  29782. }
  29783. if (type === null) {
  29784. return this.children[i];
  29785. } else {
  29786. for(var j=0; j<this.children.length; j++) {
  29787. var child = this.children[j];
  29788. if(child instanceof type) {
  29789. if(i===0) {
  29790. return child;
  29791. } else {
  29792. i -= 1;
  29793. }
  29794. }
  29795. }
  29796. return null;
  29797. }
  29798. };
  29799. ParserRuleContext.prototype.getToken = function(ttype, i) {
  29800. if (this.children === null || i < 0 || i >= this.children.length) {
  29801. return null;
  29802. }
  29803. for(var j=0; j<this.children.length; j++) {
  29804. var child = this.children[j];
  29805. if (child instanceof TerminalNode) {
  29806. if (child.symbol.type === ttype) {
  29807. if(i===0) {
  29808. return child;
  29809. } else {
  29810. i -= 1;
  29811. }
  29812. }
  29813. }
  29814. }
  29815. return null;
  29816. };
  29817. ParserRuleContext.prototype.getTokens = function(ttype ) {
  29818. if (this.children=== null) {
  29819. return [];
  29820. } else {
  29821. var tokens = [];
  29822. for(var j=0; j<this.children.length; j++) {
  29823. var child = this.children[j];
  29824. if (child instanceof TerminalNode) {
  29825. if (child.symbol.type === ttype) {
  29826. tokens.push(child);
  29827. }
  29828. }
  29829. }
  29830. return tokens;
  29831. }
  29832. };
  29833. ParserRuleContext.prototype.getTypedRuleContext = function(ctxType, i) {
  29834. return this.getChild(i, ctxType);
  29835. };
  29836. ParserRuleContext.prototype.getTypedRuleContexts = function(ctxType) {
  29837. if (this.children=== null) {
  29838. return [];
  29839. } else {
  29840. var contexts = [];
  29841. for(var j=0; j<this.children.length; j++) {
  29842. var child = this.children[j];
  29843. if (child instanceof ctxType) {
  29844. contexts.push(child);
  29845. }
  29846. }
  29847. return contexts;
  29848. }
  29849. };
  29850. ParserRuleContext.prototype.getChildCount = function() {
  29851. if (this.children=== null) {
  29852. return 0;
  29853. } else {
  29854. return this.children.length;
  29855. }
  29856. };
  29857. ParserRuleContext.prototype.getSourceInterval = function() {
  29858. if( this.start === null || this.stop === null) {
  29859. return INVALID_INTERVAL;
  29860. } else {
  29861. return new Interval(this.start.tokenIndex, this.stop.tokenIndex);
  29862. }
  29863. };
  29864. RuleContext.EMPTY = new ParserRuleContext();
  29865. function InterpreterRuleContext(parent, invokingStateNumber, ruleIndex) {
  29866. ParserRuleContext.call(parent, invokingStateNumber);
  29867. this.ruleIndex = ruleIndex;
  29868. return this;
  29869. }
  29870. InterpreterRuleContext.prototype = Object.create(ParserRuleContext.prototype);
  29871. InterpreterRuleContext.prototype.constructor = InterpreterRuleContext;
  29872. exports.ParserRuleContext = ParserRuleContext;
  29873. /***/ }),
  29874. /***/ "./node_modules/antlr4/PredictionContext.js":
  29875. /*!**************************************************!*\
  29876. !*** ./node_modules/antlr4/PredictionContext.js ***!
  29877. \**************************************************/
  29878. /*! no static exports found */
  29879. /***/ (function(module, exports, __webpack_require__) {
  29880. //
  29881. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  29882. * Use of this file is governed by the BSD 3-clause license that
  29883. * can be found in the LICENSE.txt file in the project root.
  29884. */
  29885. ///
  29886. var RuleContext = __webpack_require__(/*! ./RuleContext */ "./node_modules/antlr4/RuleContext.js").RuleContext;
  29887. var Hash = __webpack_require__(/*! ./Utils */ "./node_modules/antlr4/Utils.js").Hash;
  29888. function PredictionContext(cachedHashCode) {
  29889. this.cachedHashCode = cachedHashCode;
  29890. }
  29891. // Represents {@code $} in local context prediction, which means wildcard.
  29892. // {@code//+x =//}.
  29893. // /
  29894. PredictionContext.EMPTY = null;
  29895. // Represents {@code $} in an array in full context mode, when {@code $}
  29896. // doesn't mean wildcard: {@code $ + x = [$,x]}. Here,
  29897. // {@code $} = {@link //EMPTY_RETURN_STATE}.
  29898. // /
  29899. PredictionContext.EMPTY_RETURN_STATE = 0x7FFFFFFF;
  29900. PredictionContext.globalNodeCount = 1;
  29901. PredictionContext.id = PredictionContext.globalNodeCount;
  29902. // Stores the computed hash code of this {@link PredictionContext}. The hash
  29903. // code is computed in parts to match the following reference algorithm.
  29904. //
  29905. // <pre>
  29906. // private int referenceHashCode() {
  29907. // int hash = {@link MurmurHash//initialize MurmurHash.initialize}({@link
  29908. // //INITIAL_HASH});
  29909. //
  29910. // for (int i = 0; i &lt; {@link //size()}; i++) {
  29911. // hash = {@link MurmurHash//update MurmurHash.update}(hash, {@link //getParent
  29912. // getParent}(i));
  29913. // }
  29914. //
  29915. // for (int i = 0; i &lt; {@link //size()}; i++) {
  29916. // hash = {@link MurmurHash//update MurmurHash.update}(hash, {@link
  29917. // //getReturnState getReturnState}(i));
  29918. // }
  29919. //
  29920. // hash = {@link MurmurHash//finish MurmurHash.finish}(hash, 2// {@link
  29921. // //size()});
  29922. // return hash;
  29923. // }
  29924. // </pre>
  29925. // /
  29926. // This means only the {@link //EMPTY} context is in set.
  29927. PredictionContext.prototype.isEmpty = function() {
  29928. return this === PredictionContext.EMPTY;
  29929. };
  29930. PredictionContext.prototype.hasEmptyPath = function() {
  29931. return this.getReturnState(this.length - 1) === PredictionContext.EMPTY_RETURN_STATE;
  29932. };
  29933. PredictionContext.prototype.hashCode = function() {
  29934. return this.cachedHashCode;
  29935. };
  29936. PredictionContext.prototype.updateHashCode = function(hash) {
  29937. hash.update(this.cachedHashCode);
  29938. };
  29939. /*
  29940. function calculateHashString(parent, returnState) {
  29941. return "" + parent + returnState;
  29942. }
  29943. */
  29944. // Used to cache {@link PredictionContext} objects. Its used for the shared
  29945. // context cash associated with contexts in DFA states. This cache
  29946. // can be used for both lexers and parsers.
  29947. function PredictionContextCache() {
  29948. this.cache = {};
  29949. return this;
  29950. }
  29951. // Add a context to the cache and return it. If the context already exists,
  29952. // return that one instead and do not add a new context to the cache.
  29953. // Protect shared cache from unsafe thread access.
  29954. //
  29955. PredictionContextCache.prototype.add = function(ctx) {
  29956. if (ctx === PredictionContext.EMPTY) {
  29957. return PredictionContext.EMPTY;
  29958. }
  29959. var existing = this.cache[ctx] || null;
  29960. if (existing !== null) {
  29961. return existing;
  29962. }
  29963. this.cache[ctx] = ctx;
  29964. return ctx;
  29965. };
  29966. PredictionContextCache.prototype.get = function(ctx) {
  29967. return this.cache[ctx] || null;
  29968. };
  29969. Object.defineProperty(PredictionContextCache.prototype, "length", {
  29970. get : function() {
  29971. return this.cache.length;
  29972. }
  29973. });
  29974. function SingletonPredictionContext(parent, returnState) {
  29975. var hashCode = 0;
  29976. if(parent !== null) {
  29977. var hash = new Hash();
  29978. hash.update(parent, returnState);
  29979. hashCode = hash.finish();
  29980. }
  29981. PredictionContext.call(this, hashCode);
  29982. this.parentCtx = parent;
  29983. this.returnState = returnState;
  29984. }
  29985. SingletonPredictionContext.prototype = Object.create(PredictionContext.prototype);
  29986. SingletonPredictionContext.prototype.contructor = SingletonPredictionContext;
  29987. SingletonPredictionContext.create = function(parent, returnState) {
  29988. if (returnState === PredictionContext.EMPTY_RETURN_STATE && parent === null) {
  29989. // someone can pass in the bits of an array ctx that mean $
  29990. return PredictionContext.EMPTY;
  29991. } else {
  29992. return new SingletonPredictionContext(parent, returnState);
  29993. }
  29994. };
  29995. Object.defineProperty(SingletonPredictionContext.prototype, "length", {
  29996. get : function() {
  29997. return 1;
  29998. }
  29999. });
  30000. SingletonPredictionContext.prototype.getParent = function(index) {
  30001. return this.parentCtx;
  30002. };
  30003. SingletonPredictionContext.prototype.getReturnState = function(index) {
  30004. return this.returnState;
  30005. };
  30006. SingletonPredictionContext.prototype.equals = function(other) {
  30007. if (this === other) {
  30008. return true;
  30009. } else if (!(other instanceof SingletonPredictionContext)) {
  30010. return false;
  30011. } else if (this.hashCode() !== other.hashCode()) {
  30012. return false; // can't be same if hash is different
  30013. } else {
  30014. if(this.returnState !== other.returnState)
  30015. return false;
  30016. else if(this.parentCtx==null)
  30017. return other.parentCtx==null
  30018. else
  30019. return this.parentCtx.equals(other.parentCtx);
  30020. }
  30021. };
  30022. SingletonPredictionContext.prototype.toString = function() {
  30023. var up = this.parentCtx === null ? "" : this.parentCtx.toString();
  30024. if (up.length === 0) {
  30025. if (this.returnState === PredictionContext.EMPTY_RETURN_STATE) {
  30026. return "$";
  30027. } else {
  30028. return "" + this.returnState;
  30029. }
  30030. } else {
  30031. return "" + this.returnState + " " + up;
  30032. }
  30033. };
  30034. function EmptyPredictionContext() {
  30035. SingletonPredictionContext.call(this, null, PredictionContext.EMPTY_RETURN_STATE);
  30036. return this;
  30037. }
  30038. EmptyPredictionContext.prototype = Object.create(SingletonPredictionContext.prototype);
  30039. EmptyPredictionContext.prototype.constructor = EmptyPredictionContext;
  30040. EmptyPredictionContext.prototype.isEmpty = function() {
  30041. return true;
  30042. };
  30043. EmptyPredictionContext.prototype.getParent = function(index) {
  30044. return null;
  30045. };
  30046. EmptyPredictionContext.prototype.getReturnState = function(index) {
  30047. return this.returnState;
  30048. };
  30049. EmptyPredictionContext.prototype.equals = function(other) {
  30050. return this === other;
  30051. };
  30052. EmptyPredictionContext.prototype.toString = function() {
  30053. return "$";
  30054. };
  30055. PredictionContext.EMPTY = new EmptyPredictionContext();
  30056. function ArrayPredictionContext(parents, returnStates) {
  30057. // Parent can be null only if full ctx mode and we make an array
  30058. // from {@link //EMPTY} and non-empty. We merge {@link //EMPTY} by using
  30059. // null parent and
  30060. // returnState == {@link //EMPTY_RETURN_STATE}.
  30061. var h = new Hash();
  30062. h.update(parents, returnStates);
  30063. var hashCode = h.finish();
  30064. PredictionContext.call(this, hashCode);
  30065. this.parents = parents;
  30066. this.returnStates = returnStates;
  30067. return this;
  30068. }
  30069. ArrayPredictionContext.prototype = Object.create(PredictionContext.prototype);
  30070. ArrayPredictionContext.prototype.constructor = ArrayPredictionContext;
  30071. ArrayPredictionContext.prototype.isEmpty = function() {
  30072. // since EMPTY_RETURN_STATE can only appear in the last position, we
  30073. // don't need to verify that size==1
  30074. return this.returnStates[0] === PredictionContext.EMPTY_RETURN_STATE;
  30075. };
  30076. Object.defineProperty(ArrayPredictionContext.prototype, "length", {
  30077. get : function() {
  30078. return this.returnStates.length;
  30079. }
  30080. });
  30081. ArrayPredictionContext.prototype.getParent = function(index) {
  30082. return this.parents[index];
  30083. };
  30084. ArrayPredictionContext.prototype.getReturnState = function(index) {
  30085. return this.returnStates[index];
  30086. };
  30087. ArrayPredictionContext.prototype.equals = function(other) {
  30088. if (this === other) {
  30089. return true;
  30090. } else if (!(other instanceof ArrayPredictionContext)) {
  30091. return false;
  30092. } else if (this.hashCode() !== other.hashCode()) {
  30093. return false; // can't be same if hash is different
  30094. } else {
  30095. return this.returnStates === other.returnStates &&
  30096. this.parents === other.parents;
  30097. }
  30098. };
  30099. ArrayPredictionContext.prototype.toString = function() {
  30100. if (this.isEmpty()) {
  30101. return "[]";
  30102. } else {
  30103. var s = "[";
  30104. for (var i = 0; i < this.returnStates.length; i++) {
  30105. if (i > 0) {
  30106. s = s + ", ";
  30107. }
  30108. if (this.returnStates[i] === PredictionContext.EMPTY_RETURN_STATE) {
  30109. s = s + "$";
  30110. continue;
  30111. }
  30112. s = s + this.returnStates[i];
  30113. if (this.parents[i] !== null) {
  30114. s = s + " " + this.parents[i];
  30115. } else {
  30116. s = s + "null";
  30117. }
  30118. }
  30119. return s + "]";
  30120. }
  30121. };
  30122. // Convert a {@link RuleContext} tree to a {@link PredictionContext} graph.
  30123. // Return {@link //EMPTY} if {@code outerContext} is empty or null.
  30124. // /
  30125. function predictionContextFromRuleContext(atn, outerContext) {
  30126. if (outerContext === undefined || outerContext === null) {
  30127. outerContext = RuleContext.EMPTY;
  30128. }
  30129. // if we are in RuleContext of start rule, s, then PredictionContext
  30130. // is EMPTY. Nobody called us. (if we are empty, return empty)
  30131. if (outerContext.parentCtx === null || outerContext === RuleContext.EMPTY) {
  30132. return PredictionContext.EMPTY;
  30133. }
  30134. // If we have a parent, convert it to a PredictionContext graph
  30135. var parent = predictionContextFromRuleContext(atn, outerContext.parentCtx);
  30136. var state = atn.states[outerContext.invokingState];
  30137. var transition = state.transitions[0];
  30138. return SingletonPredictionContext.create(parent, transition.followState.stateNumber);
  30139. }
  30140. /*
  30141. function calculateListsHashString(parents, returnStates) {
  30142. var s = "";
  30143. parents.map(function(p) {
  30144. s = s + p;
  30145. });
  30146. returnStates.map(function(r) {
  30147. s = s + r;
  30148. });
  30149. return s;
  30150. }
  30151. */
  30152. function merge(a, b, rootIsWildcard, mergeCache) {
  30153. // share same graph if both same
  30154. if (a === b) {
  30155. return a;
  30156. }
  30157. if (a instanceof SingletonPredictionContext && b instanceof SingletonPredictionContext) {
  30158. return mergeSingletons(a, b, rootIsWildcard, mergeCache);
  30159. }
  30160. // At least one of a or b is array
  30161. // If one is $ and rootIsWildcard, return $ as// wildcard
  30162. if (rootIsWildcard) {
  30163. if (a instanceof EmptyPredictionContext) {
  30164. return a;
  30165. }
  30166. if (b instanceof EmptyPredictionContext) {
  30167. return b;
  30168. }
  30169. }
  30170. // convert singleton so both are arrays to normalize
  30171. if (a instanceof SingletonPredictionContext) {
  30172. a = new ArrayPredictionContext([a.getParent()], [a.returnState]);
  30173. }
  30174. if (b instanceof SingletonPredictionContext) {
  30175. b = new ArrayPredictionContext([b.getParent()], [b.returnState]);
  30176. }
  30177. return mergeArrays(a, b, rootIsWildcard, mergeCache);
  30178. }
  30179. //
  30180. // Merge two {@link SingletonPredictionContext} instances.
  30181. //
  30182. // <p>Stack tops equal, parents merge is same; return left graph.<br>
  30183. // <embed src="images/SingletonMerge_SameRootSamePar.svg"
  30184. // type="image/svg+xml"/></p>
  30185. //
  30186. // <p>Same stack top, parents differ; merge parents giving array node, then
  30187. // remainders of those graphs. A new root node is created to point to the
  30188. // merged parents.<br>
  30189. // <embed src="images/SingletonMerge_SameRootDiffPar.svg"
  30190. // type="image/svg+xml"/></p>
  30191. //
  30192. // <p>Different stack tops pointing to same parent. Make array node for the
  30193. // root where both element in the root point to the same (original)
  30194. // parent.<br>
  30195. // <embed src="images/SingletonMerge_DiffRootSamePar.svg"
  30196. // type="image/svg+xml"/></p>
  30197. //
  30198. // <p>Different stack tops pointing to different parents. Make array node for
  30199. // the root where each element points to the corresponding original
  30200. // parent.<br>
  30201. // <embed src="images/SingletonMerge_DiffRootDiffPar.svg"
  30202. // type="image/svg+xml"/></p>
  30203. //
  30204. // @param a the first {@link SingletonPredictionContext}
  30205. // @param b the second {@link SingletonPredictionContext}
  30206. // @param rootIsWildcard {@code true} if this is a local-context merge,
  30207. // otherwise false to indicate a full-context merge
  30208. // @param mergeCache
  30209. // /
  30210. function mergeSingletons(a, b, rootIsWildcard, mergeCache) {
  30211. if (mergeCache !== null) {
  30212. var previous = mergeCache.get(a, b);
  30213. if (previous !== null) {
  30214. return previous;
  30215. }
  30216. previous = mergeCache.get(b, a);
  30217. if (previous !== null) {
  30218. return previous;
  30219. }
  30220. }
  30221. var rootMerge = mergeRoot(a, b, rootIsWildcard);
  30222. if (rootMerge !== null) {
  30223. if (mergeCache !== null) {
  30224. mergeCache.set(a, b, rootMerge);
  30225. }
  30226. return rootMerge;
  30227. }
  30228. if (a.returnState === b.returnState) {
  30229. var parent = merge(a.parentCtx, b.parentCtx, rootIsWildcard, mergeCache);
  30230. // if parent is same as existing a or b parent or reduced to a parent,
  30231. // return it
  30232. if (parent === a.parentCtx) {
  30233. return a; // ax + bx = ax, if a=b
  30234. }
  30235. if (parent === b.parentCtx) {
  30236. return b; // ax + bx = bx, if a=b
  30237. }
  30238. // else: ax + ay = a'[x,y]
  30239. // merge parents x and y, giving array node with x,y then remainders
  30240. // of those graphs. dup a, a' points at merged array
  30241. // new joined parent so create new singleton pointing to it, a'
  30242. var spc = SingletonPredictionContext.create(parent, a.returnState);
  30243. if (mergeCache !== null) {
  30244. mergeCache.set(a, b, spc);
  30245. }
  30246. return spc;
  30247. } else { // a != b payloads differ
  30248. // see if we can collapse parents due to $+x parents if local ctx
  30249. var singleParent = null;
  30250. if (a === b || (a.parentCtx !== null && a.parentCtx === b.parentCtx)) { // ax +
  30251. // bx =
  30252. // [a,b]x
  30253. singleParent = a.parentCtx;
  30254. }
  30255. if (singleParent !== null) { // parents are same
  30256. // sort payloads and use same parent
  30257. var payloads = [ a.returnState, b.returnState ];
  30258. if (a.returnState > b.returnState) {
  30259. payloads[0] = b.returnState;
  30260. payloads[1] = a.returnState;
  30261. }
  30262. var parents = [ singleParent, singleParent ];
  30263. var apc = new ArrayPredictionContext(parents, payloads);
  30264. if (mergeCache !== null) {
  30265. mergeCache.set(a, b, apc);
  30266. }
  30267. return apc;
  30268. }
  30269. // parents differ and can't merge them. Just pack together
  30270. // into array; can't merge.
  30271. // ax + by = [ax,by]
  30272. var payloads = [ a.returnState, b.returnState ];
  30273. var parents = [ a.parentCtx, b.parentCtx ];
  30274. if (a.returnState > b.returnState) { // sort by payload
  30275. payloads[0] = b.returnState;
  30276. payloads[1] = a.returnState;
  30277. parents = [ b.parentCtx, a.parentCtx ];
  30278. }
  30279. var a_ = new ArrayPredictionContext(parents, payloads);
  30280. if (mergeCache !== null) {
  30281. mergeCache.set(a, b, a_);
  30282. }
  30283. return a_;
  30284. }
  30285. }
  30286. //
  30287. // Handle case where at least one of {@code a} or {@code b} is
  30288. // {@link //EMPTY}. In the following diagrams, the symbol {@code $} is used
  30289. // to represent {@link //EMPTY}.
  30290. //
  30291. // <h2>Local-Context Merges</h2>
  30292. //
  30293. // <p>These local-context merge operations are used when {@code rootIsWildcard}
  30294. // is true.</p>
  30295. //
  30296. // <p>{@link //EMPTY} is superset of any graph; return {@link //EMPTY}.<br>
  30297. // <embed src="images/LocalMerge_EmptyRoot.svg" type="image/svg+xml"/></p>
  30298. //
  30299. // <p>{@link //EMPTY} and anything is {@code //EMPTY}, so merged parent is
  30300. // {@code //EMPTY}; return left graph.<br>
  30301. // <embed src="images/LocalMerge_EmptyParent.svg" type="image/svg+xml"/></p>
  30302. //
  30303. // <p>Special case of last merge if local context.<br>
  30304. // <embed src="images/LocalMerge_DiffRoots.svg" type="image/svg+xml"/></p>
  30305. //
  30306. // <h2>Full-Context Merges</h2>
  30307. //
  30308. // <p>These full-context merge operations are used when {@code rootIsWildcard}
  30309. // is false.</p>
  30310. //
  30311. // <p><embed src="images/FullMerge_EmptyRoots.svg" type="image/svg+xml"/></p>
  30312. //
  30313. // <p>Must keep all contexts; {@link //EMPTY} in array is a special value (and
  30314. // null parent).<br>
  30315. // <embed src="images/FullMerge_EmptyRoot.svg" type="image/svg+xml"/></p>
  30316. //
  30317. // <p><embed src="images/FullMerge_SameRoot.svg" type="image/svg+xml"/></p>
  30318. //
  30319. // @param a the first {@link SingletonPredictionContext}
  30320. // @param b the second {@link SingletonPredictionContext}
  30321. // @param rootIsWildcard {@code true} if this is a local-context merge,
  30322. // otherwise false to indicate a full-context merge
  30323. // /
  30324. function mergeRoot(a, b, rootIsWildcard) {
  30325. if (rootIsWildcard) {
  30326. if (a === PredictionContext.EMPTY) {
  30327. return PredictionContext.EMPTY; // // + b =//
  30328. }
  30329. if (b === PredictionContext.EMPTY) {
  30330. return PredictionContext.EMPTY; // a +// =//
  30331. }
  30332. } else {
  30333. if (a === PredictionContext.EMPTY && b === PredictionContext.EMPTY) {
  30334. return PredictionContext.EMPTY; // $ + $ = $
  30335. } else if (a === PredictionContext.EMPTY) { // $ + x = [$,x]
  30336. var payloads = [ b.returnState,
  30337. PredictionContext.EMPTY_RETURN_STATE ];
  30338. var parents = [ b.parentCtx, null ];
  30339. return new ArrayPredictionContext(parents, payloads);
  30340. } else if (b === PredictionContext.EMPTY) { // x + $ = [$,x] ($ is always first if present)
  30341. var payloads = [ a.returnState, PredictionContext.EMPTY_RETURN_STATE ];
  30342. var parents = [ a.parentCtx, null ];
  30343. return new ArrayPredictionContext(parents, payloads);
  30344. }
  30345. }
  30346. return null;
  30347. }
  30348. //
  30349. // Merge two {@link ArrayPredictionContext} instances.
  30350. //
  30351. // <p>Different tops, different parents.<br>
  30352. // <embed src="images/ArrayMerge_DiffTopDiffPar.svg" type="image/svg+xml"/></p>
  30353. //
  30354. // <p>Shared top, same parents.<br>
  30355. // <embed src="images/ArrayMerge_ShareTopSamePar.svg" type="image/svg+xml"/></p>
  30356. //
  30357. // <p>Shared top, different parents.<br>
  30358. // <embed src="images/ArrayMerge_ShareTopDiffPar.svg" type="image/svg+xml"/></p>
  30359. //
  30360. // <p>Shared top, all shared parents.<br>
  30361. // <embed src="images/ArrayMerge_ShareTopSharePar.svg"
  30362. // type="image/svg+xml"/></p>
  30363. //
  30364. // <p>Equal tops, merge parents and reduce top to
  30365. // {@link SingletonPredictionContext}.<br>
  30366. // <embed src="images/ArrayMerge_EqualTop.svg" type="image/svg+xml"/></p>
  30367. // /
  30368. function mergeArrays(a, b, rootIsWildcard, mergeCache) {
  30369. if (mergeCache !== null) {
  30370. var previous = mergeCache.get(a, b);
  30371. if (previous !== null) {
  30372. return previous;
  30373. }
  30374. previous = mergeCache.get(b, a);
  30375. if (previous !== null) {
  30376. return previous;
  30377. }
  30378. }
  30379. // merge sorted payloads a + b => M
  30380. var i = 0; // walks a
  30381. var j = 0; // walks b
  30382. var k = 0; // walks target M array
  30383. var mergedReturnStates = [];
  30384. var mergedParents = [];
  30385. // walk and merge to yield mergedParents, mergedReturnStates
  30386. while (i < a.returnStates.length && j < b.returnStates.length) {
  30387. var a_parent = a.parents[i];
  30388. var b_parent = b.parents[j];
  30389. if (a.returnStates[i] === b.returnStates[j]) {
  30390. // same payload (stack tops are equal), must yield merged singleton
  30391. var payload = a.returnStates[i];
  30392. // $+$ = $
  30393. var bothDollars = payload === PredictionContext.EMPTY_RETURN_STATE &&
  30394. a_parent === null && b_parent === null;
  30395. var ax_ax = (a_parent !== null && b_parent !== null && a_parent === b_parent); // ax+ax
  30396. // ->
  30397. // ax
  30398. if (bothDollars || ax_ax) {
  30399. mergedParents[k] = a_parent; // choose left
  30400. mergedReturnStates[k] = payload;
  30401. } else { // ax+ay -> a'[x,y]
  30402. var mergedParent = merge(a_parent, b_parent, rootIsWildcard, mergeCache);
  30403. mergedParents[k] = mergedParent;
  30404. mergedReturnStates[k] = payload;
  30405. }
  30406. i += 1; // hop over left one as usual
  30407. j += 1; // but also skip one in right side since we merge
  30408. } else if (a.returnStates[i] < b.returnStates[j]) { // copy a[i] to M
  30409. mergedParents[k] = a_parent;
  30410. mergedReturnStates[k] = a.returnStates[i];
  30411. i += 1;
  30412. } else { // b > a, copy b[j] to M
  30413. mergedParents[k] = b_parent;
  30414. mergedReturnStates[k] = b.returnStates[j];
  30415. j += 1;
  30416. }
  30417. k += 1;
  30418. }
  30419. // copy over any payloads remaining in either array
  30420. if (i < a.returnStates.length) {
  30421. for (var p = i; p < a.returnStates.length; p++) {
  30422. mergedParents[k] = a.parents[p];
  30423. mergedReturnStates[k] = a.returnStates[p];
  30424. k += 1;
  30425. }
  30426. } else {
  30427. for (var p = j; p < b.returnStates.length; p++) {
  30428. mergedParents[k] = b.parents[p];
  30429. mergedReturnStates[k] = b.returnStates[p];
  30430. k += 1;
  30431. }
  30432. }
  30433. // trim merged if we combined a few that had same stack tops
  30434. if (k < mergedParents.length) { // write index < last position; trim
  30435. if (k === 1) { // for just one merged element, return singleton top
  30436. var a_ = SingletonPredictionContext.create(mergedParents[0],
  30437. mergedReturnStates[0]);
  30438. if (mergeCache !== null) {
  30439. mergeCache.set(a, b, a_);
  30440. }
  30441. return a_;
  30442. }
  30443. mergedParents = mergedParents.slice(0, k);
  30444. mergedReturnStates = mergedReturnStates.slice(0, k);
  30445. }
  30446. var M = new ArrayPredictionContext(mergedParents, mergedReturnStates);
  30447. // if we created same array as a or b, return that instead
  30448. // TODO: track whether this is possible above during merge sort for speed
  30449. if (M === a) {
  30450. if (mergeCache !== null) {
  30451. mergeCache.set(a, b, a);
  30452. }
  30453. return a;
  30454. }
  30455. if (M === b) {
  30456. if (mergeCache !== null) {
  30457. mergeCache.set(a, b, b);
  30458. }
  30459. return b;
  30460. }
  30461. combineCommonParents(mergedParents);
  30462. if (mergeCache !== null) {
  30463. mergeCache.set(a, b, M);
  30464. }
  30465. return M;
  30466. }
  30467. //
  30468. // Make pass over all <em>M</em> {@code parents}; merge any {@code equals()}
  30469. // ones.
  30470. // /
  30471. function combineCommonParents(parents) {
  30472. var uniqueParents = {};
  30473. for (var p = 0; p < parents.length; p++) {
  30474. var parent = parents[p];
  30475. if (!(parent in uniqueParents)) {
  30476. uniqueParents[parent] = parent;
  30477. }
  30478. }
  30479. for (var q = 0; q < parents.length; q++) {
  30480. parents[q] = uniqueParents[parents[q]];
  30481. }
  30482. }
  30483. function getCachedPredictionContext(context, contextCache, visited) {
  30484. if (context.isEmpty()) {
  30485. return context;
  30486. }
  30487. var existing = visited[context] || null;
  30488. if (existing !== null) {
  30489. return existing;
  30490. }
  30491. existing = contextCache.get(context);
  30492. if (existing !== null) {
  30493. visited[context] = existing;
  30494. return existing;
  30495. }
  30496. var changed = false;
  30497. var parents = [];
  30498. for (var i = 0; i < parents.length; i++) {
  30499. var parent = getCachedPredictionContext(context.getParent(i), contextCache, visited);
  30500. if (changed || parent !== context.getParent(i)) {
  30501. if (!changed) {
  30502. parents = [];
  30503. for (var j = 0; j < context.length; j++) {
  30504. parents[j] = context.getParent(j);
  30505. }
  30506. changed = true;
  30507. }
  30508. parents[i] = parent;
  30509. }
  30510. }
  30511. if (!changed) {
  30512. contextCache.add(context);
  30513. visited[context] = context;
  30514. return context;
  30515. }
  30516. var updated = null;
  30517. if (parents.length === 0) {
  30518. updated = PredictionContext.EMPTY;
  30519. } else if (parents.length === 1) {
  30520. updated = SingletonPredictionContext.create(parents[0], context
  30521. .getReturnState(0));
  30522. } else {
  30523. updated = new ArrayPredictionContext(parents, context.returnStates);
  30524. }
  30525. contextCache.add(updated);
  30526. visited[updated] = updated;
  30527. visited[context] = updated;
  30528. return updated;
  30529. }
  30530. // ter's recursive version of Sam's getAllNodes()
  30531. function getAllContextNodes(context, nodes, visited) {
  30532. if (nodes === null) {
  30533. nodes = [];
  30534. return getAllContextNodes(context, nodes, visited);
  30535. } else if (visited === null) {
  30536. visited = {};
  30537. return getAllContextNodes(context, nodes, visited);
  30538. } else {
  30539. if (context === null || visited[context] !== null) {
  30540. return nodes;
  30541. }
  30542. visited[context] = context;
  30543. nodes.push(context);
  30544. for (var i = 0; i < context.length; i++) {
  30545. getAllContextNodes(context.getParent(i), nodes, visited);
  30546. }
  30547. return nodes;
  30548. }
  30549. }
  30550. exports.merge = merge;
  30551. exports.PredictionContext = PredictionContext;
  30552. exports.PredictionContextCache = PredictionContextCache;
  30553. exports.SingletonPredictionContext = SingletonPredictionContext;
  30554. exports.predictionContextFromRuleContext = predictionContextFromRuleContext;
  30555. exports.getCachedPredictionContext = getCachedPredictionContext;
  30556. /***/ }),
  30557. /***/ "./node_modules/antlr4/Recognizer.js":
  30558. /*!*******************************************!*\
  30559. !*** ./node_modules/antlr4/Recognizer.js ***!
  30560. \*******************************************/
  30561. /*! no static exports found */
  30562. /***/ (function(module, exports, __webpack_require__) {
  30563. //
  30564. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  30565. * Use of this file is governed by the BSD 3-clause license that
  30566. * can be found in the LICENSE.txt file in the project root.
  30567. */
  30568. //
  30569. var Token = __webpack_require__(/*! ./Token */ "./node_modules/antlr4/Token.js").Token;
  30570. var ConsoleErrorListener = __webpack_require__(/*! ./error/ErrorListener */ "./node_modules/antlr4/error/ErrorListener.js").ConsoleErrorListener;
  30571. var ProxyErrorListener = __webpack_require__(/*! ./error/ErrorListener */ "./node_modules/antlr4/error/ErrorListener.js").ProxyErrorListener;
  30572. function Recognizer() {
  30573. this._listeners = [ ConsoleErrorListener.INSTANCE ];
  30574. this._interp = null;
  30575. this._stateNumber = -1;
  30576. return this;
  30577. }
  30578. Recognizer.tokenTypeMapCache = {};
  30579. Recognizer.ruleIndexMapCache = {};
  30580. Recognizer.prototype.checkVersion = function(toolVersion) {
  30581. var runtimeVersion = "4.7.2";
  30582. if (runtimeVersion!==toolVersion) {
  30583. console.log("ANTLR runtime and generated code versions disagree: "+runtimeVersion+"!="+toolVersion);
  30584. }
  30585. };
  30586. Recognizer.prototype.addErrorListener = function(listener) {
  30587. this._listeners.push(listener);
  30588. };
  30589. Recognizer.prototype.removeErrorListeners = function() {
  30590. this._listeners = [];
  30591. };
  30592. Recognizer.prototype.getTokenTypeMap = function() {
  30593. var tokenNames = this.getTokenNames();
  30594. if (tokenNames===null) {
  30595. throw("The current recognizer does not provide a list of token names.");
  30596. }
  30597. var result = this.tokenTypeMapCache[tokenNames];
  30598. if(result===undefined) {
  30599. result = tokenNames.reduce(function(o, k, i) { o[k] = i; });
  30600. result.EOF = Token.EOF;
  30601. this.tokenTypeMapCache[tokenNames] = result;
  30602. }
  30603. return result;
  30604. };
  30605. // Get a map from rule names to rule indexes.
  30606. //
  30607. // <p>Used for XPath and tree pattern compilation.</p>
  30608. //
  30609. Recognizer.prototype.getRuleIndexMap = function() {
  30610. var ruleNames = this.ruleNames;
  30611. if (ruleNames===null) {
  30612. throw("The current recognizer does not provide a list of rule names.");
  30613. }
  30614. var result = this.ruleIndexMapCache[ruleNames];
  30615. if(result===undefined) {
  30616. result = ruleNames.reduce(function(o, k, i) { o[k] = i; });
  30617. this.ruleIndexMapCache[ruleNames] = result;
  30618. }
  30619. return result;
  30620. };
  30621. Recognizer.prototype.getTokenType = function(tokenName) {
  30622. var ttype = this.getTokenTypeMap()[tokenName];
  30623. if (ttype !==undefined) {
  30624. return ttype;
  30625. } else {
  30626. return Token.INVALID_TYPE;
  30627. }
  30628. };
  30629. // What is the error header, normally line/character position information?//
  30630. Recognizer.prototype.getErrorHeader = function(e) {
  30631. var line = e.getOffendingToken().line;
  30632. var column = e.getOffendingToken().column;
  30633. return "line " + line + ":" + column;
  30634. };
  30635. // How should a token be displayed in an error message? The default
  30636. // is to display just the text, but during development you might
  30637. // want to have a lot of information spit out. Override in that case
  30638. // to use t.toString() (which, for CommonToken, dumps everything about
  30639. // the token). This is better than forcing you to override a method in
  30640. // your token objects because you don't have to go modify your lexer
  30641. // so that it creates a new Java type.
  30642. //
  30643. // @deprecated This method is not called by the ANTLR 4 Runtime. Specific
  30644. // implementations of {@link ANTLRErrorStrategy} may provide a similar
  30645. // feature when necessary. For example, see
  30646. // {@link DefaultErrorStrategy//getTokenErrorDisplay}.
  30647. //
  30648. Recognizer.prototype.getTokenErrorDisplay = function(t) {
  30649. if (t===null) {
  30650. return "<no token>";
  30651. }
  30652. var s = t.text;
  30653. if (s===null) {
  30654. if (t.type===Token.EOF) {
  30655. s = "<EOF>";
  30656. } else {
  30657. s = "<" + t.type + ">";
  30658. }
  30659. }
  30660. s = s.replace("\n","\\n").replace("\r","\\r").replace("\t","\\t");
  30661. return "'" + s + "'";
  30662. };
  30663. Recognizer.prototype.getErrorListenerDispatch = function() {
  30664. return new ProxyErrorListener(this._listeners);
  30665. };
  30666. // subclass needs to override these if there are sempreds or actions
  30667. // that the ATN interp needs to execute
  30668. Recognizer.prototype.sempred = function(localctx, ruleIndex, actionIndex) {
  30669. return true;
  30670. };
  30671. Recognizer.prototype.precpred = function(localctx , precedence) {
  30672. return true;
  30673. };
  30674. //Indicate that the recognizer has changed internal state that is
  30675. //consistent with the ATN state passed in. This way we always know
  30676. //where we are in the ATN as the parser goes along. The rule
  30677. //context objects form a stack that lets us see the stack of
  30678. //invoking rules. Combine this and we have complete ATN
  30679. //configuration information.
  30680. Object.defineProperty(Recognizer.prototype, "state", {
  30681. get : function() {
  30682. return this._stateNumber;
  30683. },
  30684. set : function(state) {
  30685. this._stateNumber = state;
  30686. }
  30687. });
  30688. exports.Recognizer = Recognizer;
  30689. /***/ }),
  30690. /***/ "./node_modules/antlr4/RuleContext.js":
  30691. /*!********************************************!*\
  30692. !*** ./node_modules/antlr4/RuleContext.js ***!
  30693. \********************************************/
  30694. /*! no static exports found */
  30695. /***/ (function(module, exports, __webpack_require__) {
  30696. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  30697. * Use of this file is governed by the BSD 3-clause license that
  30698. * can be found in the LICENSE.txt file in the project root.
  30699. */
  30700. ///
  30701. // A rule context is a record of a single rule invocation. It knows
  30702. // which context invoked it, if any. If there is no parent context, then
  30703. // naturally the invoking state is not valid. The parent link
  30704. // provides a chain upwards from the current rule invocation to the root
  30705. // of the invocation tree, forming a stack. We actually carry no
  30706. // information about the rule associated with this context (except
  30707. // when parsing). We keep only the state number of the invoking state from
  30708. // the ATN submachine that invoked this. Contrast this with the s
  30709. // pointer inside ParserRuleContext that tracks the current state
  30710. // being "executed" for the current rule.
  30711. //
  30712. // The parent contexts are useful for computing lookahead sets and
  30713. // getting error information.
  30714. //
  30715. // These objects are used during parsing and prediction.
  30716. // For the special case of parsers, we use the subclass
  30717. // ParserRuleContext.
  30718. //
  30719. // @see ParserRuleContext
  30720. ///
  30721. var RuleNode = __webpack_require__(/*! ./tree/Tree */ "./node_modules/antlr4/tree/Tree.js").RuleNode;
  30722. var INVALID_INTERVAL = __webpack_require__(/*! ./tree/Tree */ "./node_modules/antlr4/tree/Tree.js").INVALID_INTERVAL;
  30723. var INVALID_ALT_NUMBER = __webpack_require__(/*! ./atn/ATN */ "./node_modules/antlr4/atn/ATN.js").INVALID_ALT_NUMBER;
  30724. function RuleContext(parent, invokingState) {
  30725. RuleNode.call(this);
  30726. // What context invoked this rule?
  30727. this.parentCtx = parent || null;
  30728. // What state invoked the rule associated with this context?
  30729. // The "return address" is the followState of invokingState
  30730. // If parent is null, this should be -1.
  30731. this.invokingState = invokingState || -1;
  30732. return this;
  30733. }
  30734. RuleContext.prototype = Object.create(RuleNode.prototype);
  30735. RuleContext.prototype.constructor = RuleContext;
  30736. RuleContext.prototype.depth = function() {
  30737. var n = 0;
  30738. var p = this;
  30739. while (p !== null) {
  30740. p = p.parentCtx;
  30741. n += 1;
  30742. }
  30743. return n;
  30744. };
  30745. // A context is empty if there is no invoking state; meaning nobody call
  30746. // current context.
  30747. RuleContext.prototype.isEmpty = function() {
  30748. return this.invokingState === -1;
  30749. };
  30750. // satisfy the ParseTree / SyntaxTree interface
  30751. RuleContext.prototype.getSourceInterval = function() {
  30752. return INVALID_INTERVAL;
  30753. };
  30754. RuleContext.prototype.getRuleContext = function() {
  30755. return this;
  30756. };
  30757. RuleContext.prototype.getPayload = function() {
  30758. return this;
  30759. };
  30760. // Return the combined text of all child nodes. This method only considers
  30761. // tokens which have been added to the parse tree.
  30762. // <p>
  30763. // Since tokens on hidden channels (e.g. whitespace or comments) are not
  30764. // added to the parse trees, they will not appear in the output of this
  30765. // method.
  30766. // /
  30767. RuleContext.prototype.getText = function() {
  30768. if (this.getChildCount() === 0) {
  30769. return "";
  30770. } else {
  30771. return this.children.map(function(child) {
  30772. return child.getText();
  30773. }).join("");
  30774. }
  30775. };
  30776. // For rule associated with this parse tree internal node, return
  30777. // the outer alternative number used to match the input. Default
  30778. // implementation does not compute nor store this alt num. Create
  30779. // a subclass of ParserRuleContext with backing field and set
  30780. // option contextSuperClass.
  30781. // to set it.
  30782. RuleContext.prototype.getAltNumber = function() { return INVALID_ALT_NUMBER; }
  30783. // Set the outer alternative number for this context node. Default
  30784. // implementation does nothing to avoid backing field overhead for
  30785. // trees that don't need it. Create
  30786. // a subclass of ParserRuleContext with backing field and set
  30787. // option contextSuperClass.
  30788. RuleContext.prototype.setAltNumber = function(altNumber) { }
  30789. RuleContext.prototype.getChild = function(i) {
  30790. return null;
  30791. };
  30792. RuleContext.prototype.getChildCount = function() {
  30793. return 0;
  30794. };
  30795. RuleContext.prototype.accept = function(visitor) {
  30796. return visitor.visitChildren(this);
  30797. };
  30798. //need to manage circular dependencies, so export now
  30799. exports.RuleContext = RuleContext;
  30800. var Trees = __webpack_require__(/*! ./tree/Trees */ "./node_modules/antlr4/tree/Trees.js").Trees;
  30801. // Print out a whole tree, not just a node, in LISP format
  30802. // (root child1 .. childN). Print just a node if this is a leaf.
  30803. //
  30804. RuleContext.prototype.toStringTree = function(ruleNames, recog) {
  30805. return Trees.toStringTree(this, ruleNames, recog);
  30806. };
  30807. RuleContext.prototype.toString = function(ruleNames, stop) {
  30808. ruleNames = ruleNames || null;
  30809. stop = stop || null;
  30810. var p = this;
  30811. var s = "[";
  30812. while (p !== null && p !== stop) {
  30813. if (ruleNames === null) {
  30814. if (!p.isEmpty()) {
  30815. s += p.invokingState;
  30816. }
  30817. } else {
  30818. var ri = p.ruleIndex;
  30819. var ruleName = (ri >= 0 && ri < ruleNames.length) ? ruleNames[ri]
  30820. : "" + ri;
  30821. s += ruleName;
  30822. }
  30823. if (p.parentCtx !== null && (ruleNames !== null || !p.parentCtx.isEmpty())) {
  30824. s += " ";
  30825. }
  30826. p = p.parentCtx;
  30827. }
  30828. s += "]";
  30829. return s;
  30830. };
  30831. /***/ }),
  30832. /***/ "./node_modules/antlr4/Token.js":
  30833. /*!**************************************!*\
  30834. !*** ./node_modules/antlr4/Token.js ***!
  30835. \**************************************/
  30836. /*! no static exports found */
  30837. /***/ (function(module, exports) {
  30838. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  30839. * Use of this file is governed by the BSD 3-clause license that
  30840. * can be found in the LICENSE.txt file in the project root.
  30841. */
  30842. //
  30843. // A token has properties: text, type, line, character position in the line
  30844. // (so we can ignore tabs), token channel, index, and source from which
  30845. // we obtained this token.
  30846. function Token() {
  30847. this.source = null;
  30848. this.type = null; // token type of the token
  30849. this.channel = null; // The parser ignores everything not on DEFAULT_CHANNEL
  30850. this.start = null; // optional; return -1 if not implemented.
  30851. this.stop = null; // optional; return -1 if not implemented.
  30852. this.tokenIndex = null; // from 0..n-1 of the token object in the input stream
  30853. this.line = null; // line=1..n of the 1st character
  30854. this.column = null; // beginning of the line at which it occurs, 0..n-1
  30855. this._text = null; // text of the token.
  30856. return this;
  30857. }
  30858. Token.INVALID_TYPE = 0;
  30859. // During lookahead operations, this "token" signifies we hit rule end ATN state
  30860. // and did not follow it despite needing to.
  30861. Token.EPSILON = -2;
  30862. Token.MIN_USER_TOKEN_TYPE = 1;
  30863. Token.EOF = -1;
  30864. // All tokens go to the parser (unless skip() is called in that rule)
  30865. // on a particular "channel". The parser tunes to a particular channel
  30866. // so that whitespace etc... can go to the parser on a "hidden" channel.
  30867. Token.DEFAULT_CHANNEL = 0;
  30868. // Anything on different channel than DEFAULT_CHANNEL is not parsed
  30869. // by parser.
  30870. Token.HIDDEN_CHANNEL = 1;
  30871. // Explicitly set the text for this token. If {code text} is not
  30872. // {@code null}, then {@link //getText} will return this value rather than
  30873. // extracting the text from the input.
  30874. //
  30875. // @param text The explicit text of the token, or {@code null} if the text
  30876. // should be obtained from the input along with the start and stop indexes
  30877. // of the token.
  30878. Object.defineProperty(Token.prototype, "text", {
  30879. get : function() {
  30880. return this._text;
  30881. },
  30882. set : function(text) {
  30883. this._text = text;
  30884. }
  30885. });
  30886. Token.prototype.getTokenSource = function() {
  30887. return this.source[0];
  30888. };
  30889. Token.prototype.getInputStream = function() {
  30890. return this.source[1];
  30891. };
  30892. function CommonToken(source, type, channel, start, stop) {
  30893. Token.call(this);
  30894. this.source = source !== undefined ? source : CommonToken.EMPTY_SOURCE;
  30895. this.type = type !== undefined ? type : null;
  30896. this.channel = channel !== undefined ? channel : Token.DEFAULT_CHANNEL;
  30897. this.start = start !== undefined ? start : -1;
  30898. this.stop = stop !== undefined ? stop : -1;
  30899. this.tokenIndex = -1;
  30900. if (this.source[0] !== null) {
  30901. this.line = source[0].line;
  30902. this.column = source[0].column;
  30903. } else {
  30904. this.column = -1;
  30905. }
  30906. return this;
  30907. }
  30908. CommonToken.prototype = Object.create(Token.prototype);
  30909. CommonToken.prototype.constructor = CommonToken;
  30910. // An empty {@link Pair} which is used as the default value of
  30911. // {@link //source} for tokens that do not have a source.
  30912. CommonToken.EMPTY_SOURCE = [ null, null ];
  30913. // Constructs a new {@link CommonToken} as a copy of another {@link Token}.
  30914. //
  30915. // <p>
  30916. // If {@code oldToken} is also a {@link CommonToken} instance, the newly
  30917. // constructed token will share a reference to the {@link //text} field and
  30918. // the {@link Pair} stored in {@link //source}. Otherwise, {@link //text} will
  30919. // be assigned the result of calling {@link //getText}, and {@link //source}
  30920. // will be constructed from the result of {@link Token//getTokenSource} and
  30921. // {@link Token//getInputStream}.</p>
  30922. //
  30923. // @param oldToken The token to copy.
  30924. //
  30925. CommonToken.prototype.clone = function() {
  30926. var t = new CommonToken(this.source, this.type, this.channel, this.start,
  30927. this.stop);
  30928. t.tokenIndex = this.tokenIndex;
  30929. t.line = this.line;
  30930. t.column = this.column;
  30931. t.text = this.text;
  30932. return t;
  30933. };
  30934. Object.defineProperty(CommonToken.prototype, "text", {
  30935. get : function() {
  30936. if (this._text !== null) {
  30937. return this._text;
  30938. }
  30939. var input = this.getInputStream();
  30940. if (input === null) {
  30941. return null;
  30942. }
  30943. var n = input.size;
  30944. if (this.start < n && this.stop < n) {
  30945. return input.getText(this.start, this.stop);
  30946. } else {
  30947. return "<EOF>";
  30948. }
  30949. },
  30950. set : function(text) {
  30951. this._text = text;
  30952. }
  30953. });
  30954. CommonToken.prototype.toString = function() {
  30955. var txt = this.text;
  30956. if (txt !== null) {
  30957. txt = txt.replace(/\n/g, "\\n").replace(/\r/g, "\\r").replace(/\t/g, "\\t");
  30958. } else {
  30959. txt = "<no text>";
  30960. }
  30961. return "[@" + this.tokenIndex + "," + this.start + ":" + this.stop + "='" +
  30962. txt + "',<" + this.type + ">" +
  30963. (this.channel > 0 ? ",channel=" + this.channel : "") + "," +
  30964. this.line + ":" + this.column + "]";
  30965. };
  30966. exports.Token = Token;
  30967. exports.CommonToken = CommonToken;
  30968. /***/ }),
  30969. /***/ "./node_modules/antlr4/Utils.js":
  30970. /*!**************************************!*\
  30971. !*** ./node_modules/antlr4/Utils.js ***!
  30972. \**************************************/
  30973. /*! no static exports found */
  30974. /***/ (function(module, exports) {
  30975. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  30976. * Use of this file is governed by the BSD 3-clause license that
  30977. * can be found in the LICENSE.txt file in the project root.
  30978. */
  30979. function arrayToString(a) {
  30980. return "[" + a.join(", ") + "]";
  30981. }
  30982. String.prototype.seed = String.prototype.seed || Math.round(Math.random() * Math.pow(2, 32));
  30983. String.prototype.hashCode = function () {
  30984. var remainder, bytes, h1, h1b, c1, c1b, c2, c2b, k1, i,
  30985. key = this.toString();
  30986. remainder = key.length & 3; // key.length % 4
  30987. bytes = key.length - remainder;
  30988. h1 = String.prototype.seed;
  30989. c1 = 0xcc9e2d51;
  30990. c2 = 0x1b873593;
  30991. i = 0;
  30992. while (i < bytes) {
  30993. k1 =
  30994. ((key.charCodeAt(i) & 0xff)) |
  30995. ((key.charCodeAt(++i) & 0xff) << 8) |
  30996. ((key.charCodeAt(++i) & 0xff) << 16) |
  30997. ((key.charCodeAt(++i) & 0xff) << 24);
  30998. ++i;
  30999. k1 = ((((k1 & 0xffff) * c1) + ((((k1 >>> 16) * c1) & 0xffff) << 16))) & 0xffffffff;
  31000. k1 = (k1 << 15) | (k1 >>> 17);
  31001. k1 = ((((k1 & 0xffff) * c2) + ((((k1 >>> 16) * c2) & 0xffff) << 16))) & 0xffffffff;
  31002. h1 ^= k1;
  31003. h1 = (h1 << 13) | (h1 >>> 19);
  31004. h1b = ((((h1 & 0xffff) * 5) + ((((h1 >>> 16) * 5) & 0xffff) << 16))) & 0xffffffff;
  31005. h1 = (((h1b & 0xffff) + 0x6b64) + ((((h1b >>> 16) + 0xe654) & 0xffff) << 16));
  31006. }
  31007. k1 = 0;
  31008. switch (remainder) {
  31009. case 3:
  31010. k1 ^= (key.charCodeAt(i + 2) & 0xff) << 16;
  31011. case 2:
  31012. k1 ^= (key.charCodeAt(i + 1) & 0xff) << 8;
  31013. case 1:
  31014. k1 ^= (key.charCodeAt(i) & 0xff);
  31015. k1 = (((k1 & 0xffff) * c1) + ((((k1 >>> 16) * c1) & 0xffff) << 16)) & 0xffffffff;
  31016. k1 = (k1 << 15) | (k1 >>> 17);
  31017. k1 = (((k1 & 0xffff) * c2) + ((((k1 >>> 16) * c2) & 0xffff) << 16)) & 0xffffffff;
  31018. h1 ^= k1;
  31019. }
  31020. h1 ^= key.length;
  31021. h1 ^= h1 >>> 16;
  31022. h1 = (((h1 & 0xffff) * 0x85ebca6b) + ((((h1 >>> 16) * 0x85ebca6b) & 0xffff) << 16)) & 0xffffffff;
  31023. h1 ^= h1 >>> 13;
  31024. h1 = ((((h1 & 0xffff) * 0xc2b2ae35) + ((((h1 >>> 16) * 0xc2b2ae35) & 0xffff) << 16))) & 0xffffffff;
  31025. h1 ^= h1 >>> 16;
  31026. return h1 >>> 0;
  31027. };
  31028. function standardEqualsFunction(a, b) {
  31029. return a.equals(b);
  31030. }
  31031. function standardHashCodeFunction(a) {
  31032. return a.hashCode();
  31033. }
  31034. function Set(hashFunction, equalsFunction) {
  31035. this.data = {};
  31036. this.hashFunction = hashFunction || standardHashCodeFunction;
  31037. this.equalsFunction = equalsFunction || standardEqualsFunction;
  31038. return this;
  31039. }
  31040. Object.defineProperty(Set.prototype, "length", {
  31041. get: function () {
  31042. var l = 0;
  31043. for (var key in this.data) {
  31044. if (key.indexOf("hash_") === 0) {
  31045. l = l + this.data[key].length;
  31046. }
  31047. }
  31048. return l;
  31049. }
  31050. });
  31051. Set.prototype.add = function (value) {
  31052. var hash = this.hashFunction(value);
  31053. var key = "hash_" + hash;
  31054. if (key in this.data) {
  31055. var values = this.data[key];
  31056. for (var i = 0; i < values.length; i++) {
  31057. if (this.equalsFunction(value, values[i])) {
  31058. return values[i];
  31059. }
  31060. }
  31061. values.push(value);
  31062. return value;
  31063. } else {
  31064. this.data[key] = [value];
  31065. return value;
  31066. }
  31067. };
  31068. Set.prototype.contains = function (value) {
  31069. return this.get(value) != null;
  31070. };
  31071. Set.prototype.get = function (value) {
  31072. var hash = this.hashFunction(value);
  31073. var key = "hash_" + hash;
  31074. if (key in this.data) {
  31075. var values = this.data[key];
  31076. for (var i = 0; i < values.length; i++) {
  31077. if (this.equalsFunction(value, values[i])) {
  31078. return values[i];
  31079. }
  31080. }
  31081. }
  31082. return null;
  31083. };
  31084. Set.prototype.values = function () {
  31085. var l = [];
  31086. for (var key in this.data) {
  31087. if (key.indexOf("hash_") === 0) {
  31088. l = l.concat(this.data[key]);
  31089. }
  31090. }
  31091. return l;
  31092. };
  31093. Set.prototype.toString = function () {
  31094. return arrayToString(this.values());
  31095. };
  31096. function BitSet() {
  31097. this.data = [];
  31098. return this;
  31099. }
  31100. BitSet.prototype.add = function (value) {
  31101. this.data[value] = true;
  31102. };
  31103. BitSet.prototype.or = function (set) {
  31104. var bits = this;
  31105. Object.keys(set.data).map(function (alt) {
  31106. bits.add(alt);
  31107. });
  31108. };
  31109. BitSet.prototype.remove = function (value) {
  31110. delete this.data[value];
  31111. };
  31112. BitSet.prototype.contains = function (value) {
  31113. return this.data[value] === true;
  31114. };
  31115. BitSet.prototype.values = function () {
  31116. return Object.keys(this.data);
  31117. };
  31118. BitSet.prototype.minValue = function () {
  31119. return Math.min.apply(null, this.values());
  31120. };
  31121. BitSet.prototype.hashCode = function () {
  31122. var hash = new Hash();
  31123. hash.update(this.values());
  31124. return hash.finish();
  31125. };
  31126. BitSet.prototype.equals = function (other) {
  31127. if (!(other instanceof BitSet)) {
  31128. return false;
  31129. }
  31130. return this.hashCode() === other.hashCode();
  31131. };
  31132. Object.defineProperty(BitSet.prototype, "length", {
  31133. get: function () {
  31134. return this.values().length;
  31135. }
  31136. });
  31137. BitSet.prototype.toString = function () {
  31138. return "{" + this.values().join(", ") + "}";
  31139. };
  31140. function Map(hashFunction, equalsFunction) {
  31141. this.data = {};
  31142. this.hashFunction = hashFunction || standardHashCodeFunction;
  31143. this.equalsFunction = equalsFunction || standardEqualsFunction;
  31144. return this;
  31145. }
  31146. Object.defineProperty(Map.prototype, "length", {
  31147. get: function () {
  31148. var l = 0;
  31149. for (var hashKey in this.data) {
  31150. if (hashKey.indexOf("hash_") === 0) {
  31151. l = l + this.data[hashKey].length;
  31152. }
  31153. }
  31154. return l;
  31155. }
  31156. });
  31157. Map.prototype.put = function (key, value) {
  31158. var hashKey = "hash_" + this.hashFunction(key);
  31159. if (hashKey in this.data) {
  31160. var entries = this.data[hashKey];
  31161. for (var i = 0; i < entries.length; i++) {
  31162. var entry = entries[i];
  31163. if (this.equalsFunction(key, entry.key)) {
  31164. var oldValue = entry.value;
  31165. entry.value = value;
  31166. return oldValue;
  31167. }
  31168. }
  31169. entries.push({key:key, value:value});
  31170. return value;
  31171. } else {
  31172. this.data[hashKey] = [{key:key, value:value}];
  31173. return value;
  31174. }
  31175. };
  31176. Map.prototype.containsKey = function (key) {
  31177. var hashKey = "hash_" + this.hashFunction(key);
  31178. if(hashKey in this.data) {
  31179. var entries = this.data[hashKey];
  31180. for (var i = 0; i < entries.length; i++) {
  31181. var entry = entries[i];
  31182. if (this.equalsFunction(key, entry.key))
  31183. return true;
  31184. }
  31185. }
  31186. return false;
  31187. };
  31188. Map.prototype.get = function (key) {
  31189. var hashKey = "hash_" + this.hashFunction(key);
  31190. if(hashKey in this.data) {
  31191. var entries = this.data[hashKey];
  31192. for (var i = 0; i < entries.length; i++) {
  31193. var entry = entries[i];
  31194. if (this.equalsFunction(key, entry.key))
  31195. return entry.value;
  31196. }
  31197. }
  31198. return null;
  31199. };
  31200. Map.prototype.entries = function () {
  31201. var l = [];
  31202. for (var key in this.data) {
  31203. if (key.indexOf("hash_") === 0) {
  31204. l = l.concat(this.data[key]);
  31205. }
  31206. }
  31207. return l;
  31208. };
  31209. Map.prototype.getKeys = function () {
  31210. return this.entries().map(function(e) {
  31211. return e.key;
  31212. });
  31213. };
  31214. Map.prototype.getValues = function () {
  31215. return this.entries().map(function(e) {
  31216. return e.value;
  31217. });
  31218. };
  31219. Map.prototype.toString = function () {
  31220. var ss = this.entries().map(function(entry) {
  31221. return '{' + entry.key + ':' + entry.value + '}';
  31222. });
  31223. return '[' + ss.join(", ") + ']';
  31224. };
  31225. function AltDict() {
  31226. this.data = {};
  31227. return this;
  31228. }
  31229. AltDict.prototype.get = function (key) {
  31230. key = "k-" + key;
  31231. if (key in this.data) {
  31232. return this.data[key];
  31233. } else {
  31234. return null;
  31235. }
  31236. };
  31237. AltDict.prototype.put = function (key, value) {
  31238. key = "k-" + key;
  31239. this.data[key] = value;
  31240. };
  31241. AltDict.prototype.values = function () {
  31242. var data = this.data;
  31243. var keys = Object.keys(this.data);
  31244. return keys.map(function (key) {
  31245. return data[key];
  31246. });
  31247. };
  31248. function DoubleDict() {
  31249. return this;
  31250. }
  31251. function Hash() {
  31252. this.count = 0;
  31253. this.hash = 0;
  31254. return this;
  31255. }
  31256. Hash.prototype.update = function () {
  31257. for(var i=0;i<arguments.length;i++) {
  31258. var value = arguments[i];
  31259. if (value == null)
  31260. continue;
  31261. if(Array.isArray(value))
  31262. this.update.apply(value);
  31263. else {
  31264. var k = 0;
  31265. switch (typeof(value)) {
  31266. case 'undefined':
  31267. case 'function':
  31268. continue;
  31269. case 'number':
  31270. case 'boolean':
  31271. k = value;
  31272. break;
  31273. case 'string':
  31274. k = value.hashCode();
  31275. break;
  31276. default:
  31277. value.updateHashCode(this);
  31278. continue;
  31279. }
  31280. k = k * 0xCC9E2D51;
  31281. k = (k << 15) | (k >>> (32 - 15));
  31282. k = k * 0x1B873593;
  31283. this.count = this.count + 1;
  31284. var hash = this.hash ^ k;
  31285. hash = (hash << 13) | (hash >>> (32 - 13));
  31286. hash = hash * 5 + 0xE6546B64;
  31287. this.hash = hash;
  31288. }
  31289. }
  31290. }
  31291. Hash.prototype.finish = function () {
  31292. var hash = this.hash ^ (this.count * 4);
  31293. hash = hash ^ (hash >>> 16);
  31294. hash = hash * 0x85EBCA6B;
  31295. hash = hash ^ (hash >>> 13);
  31296. hash = hash * 0xC2B2AE35;
  31297. hash = hash ^ (hash >>> 16);
  31298. return hash;
  31299. }
  31300. function hashStuff() {
  31301. var hash = new Hash();
  31302. hash.update.apply(arguments);
  31303. return hash.finish();
  31304. }
  31305. DoubleDict.prototype.get = function (a, b) {
  31306. var d = this[a] || null;
  31307. return d === null ? null : (d[b] || null);
  31308. };
  31309. DoubleDict.prototype.set = function (a, b, o) {
  31310. var d = this[a] || null;
  31311. if (d === null) {
  31312. d = {};
  31313. this[a] = d;
  31314. }
  31315. d[b] = o;
  31316. };
  31317. function escapeWhitespace(s, escapeSpaces) {
  31318. s = s.replace(/\t/g, "\\t")
  31319. .replace(/\n/g, "\\n")
  31320. .replace(/\r/g, "\\r");
  31321. if (escapeSpaces) {
  31322. s = s.replace(/ /g, "\u00B7");
  31323. }
  31324. return s;
  31325. }
  31326. function titleCase(str) {
  31327. return str.replace(/\w\S*/g, function (txt) {
  31328. return txt.charAt(0).toUpperCase() + txt.substr(1);
  31329. });
  31330. };
  31331. function equalArrays(a, b)
  31332. {
  31333. if (!Array.isArray(a) || !Array.isArray(b))
  31334. return false;
  31335. if (a == b)
  31336. return true;
  31337. if (a.length != b.length)
  31338. return false;
  31339. for (var i = 0; i < a.length; i++) {
  31340. if (a[i] == b[i])
  31341. continue;
  31342. if (!a[i].equals(b[i]))
  31343. return false;
  31344. }
  31345. return true;
  31346. };
  31347. exports.Hash = Hash;
  31348. exports.Set = Set;
  31349. exports.Map = Map;
  31350. exports.BitSet = BitSet;
  31351. exports.AltDict = AltDict;
  31352. exports.DoubleDict = DoubleDict;
  31353. exports.hashStuff = hashStuff;
  31354. exports.escapeWhitespace = escapeWhitespace;
  31355. exports.arrayToString = arrayToString;
  31356. exports.titleCase = titleCase;
  31357. exports.equalArrays = equalArrays;
  31358. /***/ }),
  31359. /***/ "./node_modules/antlr4/atn/ATN.js":
  31360. /*!****************************************!*\
  31361. !*** ./node_modules/antlr4/atn/ATN.js ***!
  31362. \****************************************/
  31363. /*! no static exports found */
  31364. /***/ (function(module, exports, __webpack_require__) {
  31365. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  31366. * Use of this file is governed by the BSD 3-clause license that
  31367. * can be found in the LICENSE.txt file in the project root.
  31368. */
  31369. var LL1Analyzer = __webpack_require__(/*! ./../LL1Analyzer */ "./node_modules/antlr4/LL1Analyzer.js").LL1Analyzer;
  31370. var IntervalSet = __webpack_require__(/*! ./../IntervalSet */ "./node_modules/antlr4/IntervalSet.js").IntervalSet;
  31371. function ATN(grammarType , maxTokenType) {
  31372. // Used for runtime deserialization of ATNs from strings///
  31373. // The type of the ATN.
  31374. this.grammarType = grammarType;
  31375. // The maximum value for any symbol recognized by a transition in the ATN.
  31376. this.maxTokenType = maxTokenType;
  31377. this.states = [];
  31378. // Each subrule/rule is a decision point and we must track them so we
  31379. // can go back later and build DFA predictors for them. This includes
  31380. // all the rules, subrules, optional blocks, ()+, ()* etc...
  31381. this.decisionToState = [];
  31382. // Maps from rule index to starting state number.
  31383. this.ruleToStartState = [];
  31384. // Maps from rule index to stop state number.
  31385. this.ruleToStopState = null;
  31386. this.modeNameToStartState = {};
  31387. // For lexer ATNs, this maps the rule index to the resulting token type.
  31388. // For parser ATNs, this maps the rule index to the generated bypass token
  31389. // type if the
  31390. // {@link ATNDeserializationOptions//isGenerateRuleBypassTransitions}
  31391. // deserialization option was specified; otherwise, this is {@code null}.
  31392. this.ruleToTokenType = null;
  31393. // For lexer ATNs, this is an array of {@link LexerAction} objects which may
  31394. // be referenced by action transitions in the ATN.
  31395. this.lexerActions = null;
  31396. this.modeToStartState = [];
  31397. return this;
  31398. }
  31399. // Compute the set of valid tokens that can occur starting in state {@code s}.
  31400. // If {@code ctx} is null, the set of tokens will not include what can follow
  31401. // the rule surrounding {@code s}. In other words, the set will be
  31402. // restricted to tokens reachable staying within {@code s}'s rule.
  31403. ATN.prototype.nextTokensInContext = function(s, ctx) {
  31404. var anal = new LL1Analyzer(this);
  31405. return anal.LOOK(s, null, ctx);
  31406. };
  31407. // Compute the set of valid tokens that can occur starting in {@code s} and
  31408. // staying in same rule. {@link Token//EPSILON} is in set if we reach end of
  31409. // rule.
  31410. ATN.prototype.nextTokensNoContext = function(s) {
  31411. if (s.nextTokenWithinRule !== null ) {
  31412. return s.nextTokenWithinRule;
  31413. }
  31414. s.nextTokenWithinRule = this.nextTokensInContext(s, null);
  31415. s.nextTokenWithinRule.readOnly = true;
  31416. return s.nextTokenWithinRule;
  31417. };
  31418. ATN.prototype.nextTokens = function(s, ctx) {
  31419. if ( ctx===undefined ) {
  31420. return this.nextTokensNoContext(s);
  31421. } else {
  31422. return this.nextTokensInContext(s, ctx);
  31423. }
  31424. };
  31425. ATN.prototype.addState = function( state) {
  31426. if ( state !== null ) {
  31427. state.atn = this;
  31428. state.stateNumber = this.states.length;
  31429. }
  31430. this.states.push(state);
  31431. };
  31432. ATN.prototype.removeState = function( state) {
  31433. this.states[state.stateNumber] = null; // just free mem, don't shift states in list
  31434. };
  31435. ATN.prototype.defineDecisionState = function( s) {
  31436. this.decisionToState.push(s);
  31437. s.decision = this.decisionToState.length-1;
  31438. return s.decision;
  31439. };
  31440. ATN.prototype.getDecisionState = function( decision) {
  31441. if (this.decisionToState.length===0) {
  31442. return null;
  31443. } else {
  31444. return this.decisionToState[decision];
  31445. }
  31446. };
  31447. // Computes the set of input symbols which could follow ATN state number
  31448. // {@code stateNumber} in the specified full {@code context}. This method
  31449. // considers the complete parser context, but does not evaluate semantic
  31450. // predicates (i.e. all predicates encountered during the calculation are
  31451. // assumed true). If a path in the ATN exists from the starting state to the
  31452. // {@link RuleStopState} of the outermost context without matching any
  31453. // symbols, {@link Token//EOF} is added to the returned set.
  31454. //
  31455. // <p>If {@code context} is {@code null}, it is treated as
  31456. // {@link ParserRuleContext//EMPTY}.</p>
  31457. //
  31458. // @param stateNumber the ATN state number
  31459. // @param context the full parse context
  31460. // @return The set of potentially valid input symbols which could follow the
  31461. // specified state in the specified context.
  31462. // @throws IllegalArgumentException if the ATN does not contain a state with
  31463. // number {@code stateNumber}
  31464. var Token = __webpack_require__(/*! ./../Token */ "./node_modules/antlr4/Token.js").Token;
  31465. ATN.prototype.getExpectedTokens = function( stateNumber, ctx ) {
  31466. if ( stateNumber < 0 || stateNumber >= this.states.length ) {
  31467. throw("Invalid state number.");
  31468. }
  31469. var s = this.states[stateNumber];
  31470. var following = this.nextTokens(s);
  31471. if (!following.contains(Token.EPSILON)) {
  31472. return following;
  31473. }
  31474. var expected = new IntervalSet();
  31475. expected.addSet(following);
  31476. expected.removeOne(Token.EPSILON);
  31477. while (ctx !== null && ctx.invokingState >= 0 && following.contains(Token.EPSILON)) {
  31478. var invokingState = this.states[ctx.invokingState];
  31479. var rt = invokingState.transitions[0];
  31480. following = this.nextTokens(rt.followState);
  31481. expected.addSet(following);
  31482. expected.removeOne(Token.EPSILON);
  31483. ctx = ctx.parentCtx;
  31484. }
  31485. if (following.contains(Token.EPSILON)) {
  31486. expected.addOne(Token.EOF);
  31487. }
  31488. return expected;
  31489. };
  31490. ATN.INVALID_ALT_NUMBER = 0;
  31491. exports.ATN = ATN;
  31492. /***/ }),
  31493. /***/ "./node_modules/antlr4/atn/ATNConfig.js":
  31494. /*!**********************************************!*\
  31495. !*** ./node_modules/antlr4/atn/ATNConfig.js ***!
  31496. \**********************************************/
  31497. /*! no static exports found */
  31498. /***/ (function(module, exports, __webpack_require__) {
  31499. //
  31500. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  31501. * Use of this file is governed by the BSD 3-clause license that
  31502. * can be found in the LICENSE.txt file in the project root.
  31503. */
  31504. ///
  31505. // A tuple: (ATN state, predicted alt, syntactic, semantic context).
  31506. // The syntactic context is a graph-structured stack node whose
  31507. // path(s) to the root is the rule invocation(s)
  31508. // chain used to arrive at the state. The semantic context is
  31509. // the tree of semantic predicates encountered before reaching
  31510. // an ATN state.
  31511. ///
  31512. var DecisionState = __webpack_require__(/*! ./ATNState */ "./node_modules/antlr4/atn/ATNState.js").DecisionState;
  31513. var SemanticContext = __webpack_require__(/*! ./SemanticContext */ "./node_modules/antlr4/atn/SemanticContext.js").SemanticContext;
  31514. var Hash = __webpack_require__(/*! ../Utils */ "./node_modules/antlr4/Utils.js").Hash;
  31515. function checkParams(params, isCfg) {
  31516. if(params===null) {
  31517. var result = { state:null, alt:null, context:null, semanticContext:null };
  31518. if(isCfg) {
  31519. result.reachesIntoOuterContext = 0;
  31520. }
  31521. return result;
  31522. } else {
  31523. var props = {};
  31524. props.state = params.state || null;
  31525. props.alt = (params.alt === undefined) ? null : params.alt;
  31526. props.context = params.context || null;
  31527. props.semanticContext = params.semanticContext || null;
  31528. if(isCfg) {
  31529. props.reachesIntoOuterContext = params.reachesIntoOuterContext || 0;
  31530. props.precedenceFilterSuppressed = params.precedenceFilterSuppressed || false;
  31531. }
  31532. return props;
  31533. }
  31534. }
  31535. function ATNConfig(params, config) {
  31536. this.checkContext(params, config);
  31537. params = checkParams(params);
  31538. config = checkParams(config, true);
  31539. // The ATN state associated with this configuration///
  31540. this.state = params.state!==null ? params.state : config.state;
  31541. // What alt (or lexer rule) is predicted by this configuration///
  31542. this.alt = params.alt!==null ? params.alt : config.alt;
  31543. // The stack of invoking states leading to the rule/states associated
  31544. // with this config. We track only those contexts pushed during
  31545. // execution of the ATN simulator.
  31546. this.context = params.context!==null ? params.context : config.context;
  31547. this.semanticContext = params.semanticContext!==null ? params.semanticContext :
  31548. (config.semanticContext!==null ? config.semanticContext : SemanticContext.NONE);
  31549. // We cannot execute predicates dependent upon local context unless
  31550. // we know for sure we are in the correct context. Because there is
  31551. // no way to do this efficiently, we simply cannot evaluate
  31552. // dependent predicates unless we are in the rule that initially
  31553. // invokes the ATN simulator.
  31554. //
  31555. // closure() tracks the depth of how far we dip into the
  31556. // outer context: depth &gt; 0. Note that it may not be totally
  31557. // accurate depth since I don't ever decrement. TODO: make it a boolean then
  31558. this.reachesIntoOuterContext = config.reachesIntoOuterContext;
  31559. this.precedenceFilterSuppressed = config.precedenceFilterSuppressed;
  31560. return this;
  31561. }
  31562. ATNConfig.prototype.checkContext = function(params, config) {
  31563. if((params.context===null || params.context===undefined) &&
  31564. (config===null || config.context===null || config.context===undefined)) {
  31565. this.context = null;
  31566. }
  31567. };
  31568. ATNConfig.prototype.hashCode = function() {
  31569. var hash = new Hash();
  31570. this.updateHashCode(hash);
  31571. return hash.finish();
  31572. };
  31573. ATNConfig.prototype.updateHashCode = function(hash) {
  31574. hash.update(this.state.stateNumber, this.alt, this.context, this.semanticContext);
  31575. };
  31576. // An ATN configuration is equal to another if both have
  31577. // the same state, they predict the same alternative, and
  31578. // syntactic/semantic contexts are the same.
  31579. ATNConfig.prototype.equals = function(other) {
  31580. if (this === other) {
  31581. return true;
  31582. } else if (! (other instanceof ATNConfig)) {
  31583. return false;
  31584. } else {
  31585. return this.state.stateNumber===other.state.stateNumber &&
  31586. this.alt===other.alt &&
  31587. (this.context===null ? other.context===null : this.context.equals(other.context)) &&
  31588. this.semanticContext.equals(other.semanticContext) &&
  31589. this.precedenceFilterSuppressed===other.precedenceFilterSuppressed;
  31590. }
  31591. };
  31592. ATNConfig.prototype.hashCodeForConfigSet = function() {
  31593. var hash = new Hash();
  31594. hash.update(this.state.stateNumber, this.alt, this.semanticContext);
  31595. return hash.finish();
  31596. };
  31597. ATNConfig.prototype.equalsForConfigSet = function(other) {
  31598. if (this === other) {
  31599. return true;
  31600. } else if (! (other instanceof ATNConfig)) {
  31601. return false;
  31602. } else {
  31603. return this.state.stateNumber===other.state.stateNumber &&
  31604. this.alt===other.alt &&
  31605. this.semanticContext.equals(other.semanticContext);
  31606. }
  31607. };
  31608. ATNConfig.prototype.toString = function() {
  31609. return "(" + this.state + "," + this.alt +
  31610. (this.context!==null ? ",[" + this.context.toString() + "]" : "") +
  31611. (this.semanticContext !== SemanticContext.NONE ?
  31612. ("," + this.semanticContext.toString())
  31613. : "") +
  31614. (this.reachesIntoOuterContext>0 ?
  31615. (",up=" + this.reachesIntoOuterContext)
  31616. : "") + ")";
  31617. };
  31618. function LexerATNConfig(params, config) {
  31619. ATNConfig.call(this, params, config);
  31620. // This is the backing field for {@link //getLexerActionExecutor}.
  31621. var lexerActionExecutor = params.lexerActionExecutor || null;
  31622. this.lexerActionExecutor = lexerActionExecutor || (config!==null ? config.lexerActionExecutor : null);
  31623. this.passedThroughNonGreedyDecision = config!==null ? this.checkNonGreedyDecision(config, this.state) : false;
  31624. return this;
  31625. }
  31626. LexerATNConfig.prototype = Object.create(ATNConfig.prototype);
  31627. LexerATNConfig.prototype.constructor = LexerATNConfig;
  31628. LexerATNConfig.prototype.updateHashCode = function(hash) {
  31629. hash.update(this.state.stateNumber, this.alt, this.context, this.semanticContext, this.passedThroughNonGreedyDecision, this.lexerActionExecutor);
  31630. };
  31631. LexerATNConfig.prototype.equals = function(other) {
  31632. return this === other ||
  31633. (other instanceof LexerATNConfig &&
  31634. this.passedThroughNonGreedyDecision == other.passedThroughNonGreedyDecision &&
  31635. (this.lexerActionExecutor ? this.lexerActionExecutor.equals(other.lexerActionExecutor) : !other.lexerActionExecutor) &&
  31636. ATNConfig.prototype.equals.call(this, other));
  31637. };
  31638. LexerATNConfig.prototype.hashCodeForConfigSet = LexerATNConfig.prototype.hashCode;
  31639. LexerATNConfig.prototype.equalsForConfigSet = LexerATNConfig.prototype.equals;
  31640. LexerATNConfig.prototype.checkNonGreedyDecision = function(source, target) {
  31641. return source.passedThroughNonGreedyDecision ||
  31642. (target instanceof DecisionState) && target.nonGreedy;
  31643. };
  31644. exports.ATNConfig = ATNConfig;
  31645. exports.LexerATNConfig = LexerATNConfig;
  31646. /***/ }),
  31647. /***/ "./node_modules/antlr4/atn/ATNConfigSet.js":
  31648. /*!*************************************************!*\
  31649. !*** ./node_modules/antlr4/atn/ATNConfigSet.js ***!
  31650. \*************************************************/
  31651. /*! no static exports found */
  31652. /***/ (function(module, exports, __webpack_require__) {
  31653. //
  31654. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  31655. * Use of this file is governed by the BSD 3-clause license that
  31656. * can be found in the LICENSE.txt file in the project root.
  31657. */
  31658. //
  31659. // Specialized {@link Set}{@code <}{@link ATNConfig}{@code >} that can track
  31660. // info about the set, with support for combining similar configurations using a
  31661. // graph-structured stack.
  31662. ///
  31663. var ATN = __webpack_require__(/*! ./ATN */ "./node_modules/antlr4/atn/ATN.js").ATN;
  31664. var Utils = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js");
  31665. var Hash = Utils.Hash;
  31666. var Set = Utils.Set;
  31667. var SemanticContext = __webpack_require__(/*! ./SemanticContext */ "./node_modules/antlr4/atn/SemanticContext.js").SemanticContext;
  31668. var merge = __webpack_require__(/*! ./../PredictionContext */ "./node_modules/antlr4/PredictionContext.js").merge;
  31669. function hashATNConfig(c) {
  31670. return c.hashCodeForConfigSet();
  31671. }
  31672. function equalATNConfigs(a, b) {
  31673. if ( a===b ) {
  31674. return true;
  31675. } else if ( a===null || b===null ) {
  31676. return false;
  31677. } else
  31678. return a.equalsForConfigSet(b);
  31679. }
  31680. function ATNConfigSet(fullCtx) {
  31681. //
  31682. // The reason that we need this is because we don't want the hash map to use
  31683. // the standard hash code and equals. We need all configurations with the
  31684. // same
  31685. // {@code (s,i,_,semctx)} to be equal. Unfortunately, this key effectively
  31686. // doubles
  31687. // the number of objects associated with ATNConfigs. The other solution is
  31688. // to
  31689. // use a hash table that lets us specify the equals/hashcode operation.
  31690. // All configs but hashed by (s, i, _, pi) not including context. Wiped out
  31691. // when we go readonly as this set becomes a DFA state.
  31692. this.configLookup = new Set(hashATNConfig, equalATNConfigs);
  31693. // Indicates that this configuration set is part of a full context
  31694. // LL prediction. It will be used to determine how to merge $. With SLL
  31695. // it's a wildcard whereas it is not for LL context merge.
  31696. this.fullCtx = fullCtx === undefined ? true : fullCtx;
  31697. // Indicates that the set of configurations is read-only. Do not
  31698. // allow any code to manipulate the set; DFA states will point at
  31699. // the sets and they must not change. This does not protect the other
  31700. // fields; in particular, conflictingAlts is set after
  31701. // we've made this readonly.
  31702. this.readOnly = false;
  31703. // Track the elements as they are added to the set; supports get(i)///
  31704. this.configs = [];
  31705. // TODO: these fields make me pretty uncomfortable but nice to pack up info
  31706. // together, saves recomputation
  31707. // TODO: can we track conflicts as they are added to save scanning configs
  31708. // later?
  31709. this.uniqueAlt = 0;
  31710. this.conflictingAlts = null;
  31711. // Used in parser and lexer. In lexer, it indicates we hit a pred
  31712. // while computing a closure operation. Don't make a DFA state from this.
  31713. this.hasSemanticContext = false;
  31714. this.dipsIntoOuterContext = false;
  31715. this.cachedHashCode = -1;
  31716. return this;
  31717. }
  31718. // Adding a new config means merging contexts with existing configs for
  31719. // {@code (s, i, pi, _)}, where {@code s} is the
  31720. // {@link ATNConfig//state}, {@code i} is the {@link ATNConfig//alt}, and
  31721. // {@code pi} is the {@link ATNConfig//semanticContext}. We use
  31722. // {@code (s,i,pi)} as key.
  31723. //
  31724. // <p>This method updates {@link //dipsIntoOuterContext} and
  31725. // {@link //hasSemanticContext} when necessary.</p>
  31726. // /
  31727. ATNConfigSet.prototype.add = function(config, mergeCache) {
  31728. if (mergeCache === undefined) {
  31729. mergeCache = null;
  31730. }
  31731. if (this.readOnly) {
  31732. throw "This set is readonly";
  31733. }
  31734. if (config.semanticContext !== SemanticContext.NONE) {
  31735. this.hasSemanticContext = true;
  31736. }
  31737. if (config.reachesIntoOuterContext > 0) {
  31738. this.dipsIntoOuterContext = true;
  31739. }
  31740. var existing = this.configLookup.add(config);
  31741. if (existing === config) {
  31742. this.cachedHashCode = -1;
  31743. this.configs.push(config); // track order here
  31744. return true;
  31745. }
  31746. // a previous (s,i,pi,_), merge with it and save result
  31747. var rootIsWildcard = !this.fullCtx;
  31748. var merged = merge(existing.context, config.context, rootIsWildcard, mergeCache);
  31749. // no need to check for existing.context, config.context in cache
  31750. // since only way to create new graphs is "call rule" and here. We
  31751. // cache at both places.
  31752. existing.reachesIntoOuterContext = Math.max( existing.reachesIntoOuterContext, config.reachesIntoOuterContext);
  31753. // make sure to preserve the precedence filter suppression during the merge
  31754. if (config.precedenceFilterSuppressed) {
  31755. existing.precedenceFilterSuppressed = true;
  31756. }
  31757. existing.context = merged; // replace context; no need to alt mapping
  31758. return true;
  31759. };
  31760. ATNConfigSet.prototype.getStates = function() {
  31761. var states = new Set();
  31762. for (var i = 0; i < this.configs.length; i++) {
  31763. states.add(this.configs[i].state);
  31764. }
  31765. return states;
  31766. };
  31767. ATNConfigSet.prototype.getPredicates = function() {
  31768. var preds = [];
  31769. for (var i = 0; i < this.configs.length; i++) {
  31770. var c = this.configs[i].semanticContext;
  31771. if (c !== SemanticContext.NONE) {
  31772. preds.push(c.semanticContext);
  31773. }
  31774. }
  31775. return preds;
  31776. };
  31777. Object.defineProperty(ATNConfigSet.prototype, "items", {
  31778. get : function() {
  31779. return this.configs;
  31780. }
  31781. });
  31782. ATNConfigSet.prototype.optimizeConfigs = function(interpreter) {
  31783. if (this.readOnly) {
  31784. throw "This set is readonly";
  31785. }
  31786. if (this.configLookup.length === 0) {
  31787. return;
  31788. }
  31789. for (var i = 0; i < this.configs.length; i++) {
  31790. var config = this.configs[i];
  31791. config.context = interpreter.getCachedContext(config.context);
  31792. }
  31793. };
  31794. ATNConfigSet.prototype.addAll = function(coll) {
  31795. for (var i = 0; i < coll.length; i++) {
  31796. this.add(coll[i]);
  31797. }
  31798. return false;
  31799. };
  31800. ATNConfigSet.prototype.equals = function(other) {
  31801. return this === other ||
  31802. (other instanceof ATNConfigSet &&
  31803. Utils.equalArrays(this.configs, other.configs) &&
  31804. this.fullCtx === other.fullCtx &&
  31805. this.uniqueAlt === other.uniqueAlt &&
  31806. this.conflictingAlts === other.conflictingAlts &&
  31807. this.hasSemanticContext === other.hasSemanticContext &&
  31808. this.dipsIntoOuterContext === other.dipsIntoOuterContext);
  31809. };
  31810. ATNConfigSet.prototype.hashCode = function() {
  31811. var hash = new Hash();
  31812. this.updateHashCode(hash);
  31813. return hash.finish();
  31814. };
  31815. ATNConfigSet.prototype.updateHashCode = function(hash) {
  31816. if (this.readOnly) {
  31817. if (this.cachedHashCode === -1) {
  31818. var hash = new Hash();
  31819. hash.update(this.configs);
  31820. this.cachedHashCode = hash.finish();
  31821. }
  31822. hash.update(this.cachedHashCode);
  31823. } else {
  31824. hash.update(this.configs);
  31825. }
  31826. };
  31827. Object.defineProperty(ATNConfigSet.prototype, "length", {
  31828. get : function() {
  31829. return this.configs.length;
  31830. }
  31831. });
  31832. ATNConfigSet.prototype.isEmpty = function() {
  31833. return this.configs.length === 0;
  31834. };
  31835. ATNConfigSet.prototype.contains = function(item) {
  31836. if (this.configLookup === null) {
  31837. throw "This method is not implemented for readonly sets.";
  31838. }
  31839. return this.configLookup.contains(item);
  31840. };
  31841. ATNConfigSet.prototype.containsFast = function(item) {
  31842. if (this.configLookup === null) {
  31843. throw "This method is not implemented for readonly sets.";
  31844. }
  31845. return this.configLookup.containsFast(item);
  31846. };
  31847. ATNConfigSet.prototype.clear = function() {
  31848. if (this.readOnly) {
  31849. throw "This set is readonly";
  31850. }
  31851. this.configs = [];
  31852. this.cachedHashCode = -1;
  31853. this.configLookup = new Set();
  31854. };
  31855. ATNConfigSet.prototype.setReadonly = function(readOnly) {
  31856. this.readOnly = readOnly;
  31857. if (readOnly) {
  31858. this.configLookup = null; // can't mod, no need for lookup cache
  31859. }
  31860. };
  31861. ATNConfigSet.prototype.toString = function() {
  31862. return Utils.arrayToString(this.configs) +
  31863. (this.hasSemanticContext ? ",hasSemanticContext=" + this.hasSemanticContext : "") +
  31864. (this.uniqueAlt !== ATN.INVALID_ALT_NUMBER ? ",uniqueAlt=" + this.uniqueAlt : "") +
  31865. (this.conflictingAlts !== null ? ",conflictingAlts=" + this.conflictingAlts : "") +
  31866. (this.dipsIntoOuterContext ? ",dipsIntoOuterContext" : "");
  31867. };
  31868. function OrderedATNConfigSet() {
  31869. ATNConfigSet.call(this);
  31870. this.configLookup = new Set();
  31871. return this;
  31872. }
  31873. OrderedATNConfigSet.prototype = Object.create(ATNConfigSet.prototype);
  31874. OrderedATNConfigSet.prototype.constructor = OrderedATNConfigSet;
  31875. exports.ATNConfigSet = ATNConfigSet;
  31876. exports.OrderedATNConfigSet = OrderedATNConfigSet;
  31877. /***/ }),
  31878. /***/ "./node_modules/antlr4/atn/ATNDeserializationOptions.js":
  31879. /*!**************************************************************!*\
  31880. !*** ./node_modules/antlr4/atn/ATNDeserializationOptions.js ***!
  31881. \**************************************************************/
  31882. /*! no static exports found */
  31883. /***/ (function(module, exports) {
  31884. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  31885. * Use of this file is governed by the BSD 3-clause license that
  31886. * can be found in the LICENSE.txt file in the project root.
  31887. */
  31888. function ATNDeserializationOptions(copyFrom) {
  31889. if(copyFrom===undefined) {
  31890. copyFrom = null;
  31891. }
  31892. this.readOnly = false;
  31893. this.verifyATN = copyFrom===null ? true : copyFrom.verifyATN;
  31894. this.generateRuleBypassTransitions = copyFrom===null ? false : copyFrom.generateRuleBypassTransitions;
  31895. return this;
  31896. }
  31897. ATNDeserializationOptions.defaultOptions = new ATNDeserializationOptions();
  31898. ATNDeserializationOptions.defaultOptions.readOnly = true;
  31899. // def __setattr__(self, key, value):
  31900. // if key!="readOnly" and self.readOnly:
  31901. // raise Exception("The object is read only.")
  31902. // super(type(self), self).__setattr__(key,value)
  31903. exports.ATNDeserializationOptions = ATNDeserializationOptions;
  31904. /***/ }),
  31905. /***/ "./node_modules/antlr4/atn/ATNDeserializer.js":
  31906. /*!****************************************************!*\
  31907. !*** ./node_modules/antlr4/atn/ATNDeserializer.js ***!
  31908. \****************************************************/
  31909. /*! no static exports found */
  31910. /***/ (function(module, exports, __webpack_require__) {
  31911. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  31912. * Use of this file is governed by the BSD 3-clause license that
  31913. * can be found in the LICENSE.txt file in the project root.
  31914. */
  31915. var Token = __webpack_require__(/*! ./../Token */ "./node_modules/antlr4/Token.js").Token;
  31916. var ATN = __webpack_require__(/*! ./ATN */ "./node_modules/antlr4/atn/ATN.js").ATN;
  31917. var ATNType = __webpack_require__(/*! ./ATNType */ "./node_modules/antlr4/atn/ATNType.js").ATNType;
  31918. var ATNStates = __webpack_require__(/*! ./ATNState */ "./node_modules/antlr4/atn/ATNState.js");
  31919. var ATNState = ATNStates.ATNState;
  31920. var BasicState = ATNStates.BasicState;
  31921. var DecisionState = ATNStates.DecisionState;
  31922. var BlockStartState = ATNStates.BlockStartState;
  31923. var BlockEndState = ATNStates.BlockEndState;
  31924. var LoopEndState = ATNStates.LoopEndState;
  31925. var RuleStartState = ATNStates.RuleStartState;
  31926. var RuleStopState = ATNStates.RuleStopState;
  31927. var TokensStartState = ATNStates.TokensStartState;
  31928. var PlusLoopbackState = ATNStates.PlusLoopbackState;
  31929. var StarLoopbackState = ATNStates.StarLoopbackState;
  31930. var StarLoopEntryState = ATNStates.StarLoopEntryState;
  31931. var PlusBlockStartState = ATNStates.PlusBlockStartState;
  31932. var StarBlockStartState = ATNStates.StarBlockStartState;
  31933. var BasicBlockStartState = ATNStates.BasicBlockStartState;
  31934. var Transitions = __webpack_require__(/*! ./Transition */ "./node_modules/antlr4/atn/Transition.js");
  31935. var Transition = Transitions.Transition;
  31936. var AtomTransition = Transitions.AtomTransition;
  31937. var SetTransition = Transitions.SetTransition;
  31938. var NotSetTransition = Transitions.NotSetTransition;
  31939. var RuleTransition = Transitions.RuleTransition;
  31940. var RangeTransition = Transitions.RangeTransition;
  31941. var ActionTransition = Transitions.ActionTransition;
  31942. var EpsilonTransition = Transitions.EpsilonTransition;
  31943. var WildcardTransition = Transitions.WildcardTransition;
  31944. var PredicateTransition = Transitions.PredicateTransition;
  31945. var PrecedencePredicateTransition = Transitions.PrecedencePredicateTransition;
  31946. var IntervalSet = __webpack_require__(/*! ./../IntervalSet */ "./node_modules/antlr4/IntervalSet.js").IntervalSet;
  31947. var Interval = __webpack_require__(/*! ./../IntervalSet */ "./node_modules/antlr4/IntervalSet.js").Interval;
  31948. var ATNDeserializationOptions = __webpack_require__(/*! ./ATNDeserializationOptions */ "./node_modules/antlr4/atn/ATNDeserializationOptions.js").ATNDeserializationOptions;
  31949. var LexerActions = __webpack_require__(/*! ./LexerAction */ "./node_modules/antlr4/atn/LexerAction.js");
  31950. var LexerActionType = LexerActions.LexerActionType;
  31951. var LexerSkipAction = LexerActions.LexerSkipAction;
  31952. var LexerChannelAction = LexerActions.LexerChannelAction;
  31953. var LexerCustomAction = LexerActions.LexerCustomAction;
  31954. var LexerMoreAction = LexerActions.LexerMoreAction;
  31955. var LexerTypeAction = LexerActions.LexerTypeAction;
  31956. var LexerPushModeAction = LexerActions.LexerPushModeAction;
  31957. var LexerPopModeAction = LexerActions.LexerPopModeAction;
  31958. var LexerModeAction = LexerActions.LexerModeAction;
  31959. // This is the earliest supported serialized UUID.
  31960. // stick to serialized version for now, we don't need a UUID instance
  31961. var BASE_SERIALIZED_UUID = "AADB8D7E-AEEF-4415-AD2B-8204D6CF042E";
  31962. //
  31963. // This UUID indicates the serialized ATN contains two sets of
  31964. // IntervalSets, where the second set's values are encoded as
  31965. // 32-bit integers to support the full Unicode SMP range up to U+10FFFF.
  31966. //
  31967. var ADDED_UNICODE_SMP = "59627784-3BE5-417A-B9EB-8131A7286089";
  31968. // This list contains all of the currently supported UUIDs, ordered by when
  31969. // the feature first appeared in this branch.
  31970. var SUPPORTED_UUIDS = [ BASE_SERIALIZED_UUID, ADDED_UNICODE_SMP ];
  31971. var SERIALIZED_VERSION = 3;
  31972. // This is the current serialized UUID.
  31973. var SERIALIZED_UUID = ADDED_UNICODE_SMP;
  31974. function initArray( length, value) {
  31975. var tmp = [];
  31976. tmp[length-1] = value;
  31977. return tmp.map(function(i) {return value;});
  31978. }
  31979. function ATNDeserializer (options) {
  31980. if ( options=== undefined || options === null ) {
  31981. options = ATNDeserializationOptions.defaultOptions;
  31982. }
  31983. this.deserializationOptions = options;
  31984. this.stateFactories = null;
  31985. this.actionFactories = null;
  31986. return this;
  31987. }
  31988. // Determines if a particular serialized representation of an ATN supports
  31989. // a particular feature, identified by the {@link UUID} used for serializing
  31990. // the ATN at the time the feature was first introduced.
  31991. //
  31992. // @param feature The {@link UUID} marking the first time the feature was
  31993. // supported in the serialized ATN.
  31994. // @param actualUuid The {@link UUID} of the actual serialized ATN which is
  31995. // currently being deserialized.
  31996. // @return {@code true} if the {@code actualUuid} value represents a
  31997. // serialized ATN at or after the feature identified by {@code feature} was
  31998. // introduced; otherwise, {@code false}.
  31999. ATNDeserializer.prototype.isFeatureSupported = function(feature, actualUuid) {
  32000. var idx1 = SUPPORTED_UUIDS.indexOf(feature);
  32001. if (idx1<0) {
  32002. return false;
  32003. }
  32004. var idx2 = SUPPORTED_UUIDS.indexOf(actualUuid);
  32005. return idx2 >= idx1;
  32006. };
  32007. ATNDeserializer.prototype.deserialize = function(data) {
  32008. this.reset(data);
  32009. this.checkVersion();
  32010. this.checkUUID();
  32011. var atn = this.readATN();
  32012. this.readStates(atn);
  32013. this.readRules(atn);
  32014. this.readModes(atn);
  32015. var sets = [];
  32016. // First, deserialize sets with 16-bit arguments <= U+FFFF.
  32017. this.readSets(atn, sets, this.readInt.bind(this));
  32018. // Next, if the ATN was serialized with the Unicode SMP feature,
  32019. // deserialize sets with 32-bit arguments <= U+10FFFF.
  32020. if (this.isFeatureSupported(ADDED_UNICODE_SMP, this.uuid)) {
  32021. this.readSets(atn, sets, this.readInt32.bind(this));
  32022. }
  32023. this.readEdges(atn, sets);
  32024. this.readDecisions(atn);
  32025. this.readLexerActions(atn);
  32026. this.markPrecedenceDecisions(atn);
  32027. this.verifyATN(atn);
  32028. if (this.deserializationOptions.generateRuleBypassTransitions && atn.grammarType === ATNType.PARSER ) {
  32029. this.generateRuleBypassTransitions(atn);
  32030. // re-verify after modification
  32031. this.verifyATN(atn);
  32032. }
  32033. return atn;
  32034. };
  32035. ATNDeserializer.prototype.reset = function(data) {
  32036. var adjust = function(c) {
  32037. var v = c.charCodeAt(0);
  32038. return v>1 ? v-2 : v + 65533;
  32039. };
  32040. var temp = data.split("").map(adjust);
  32041. // don't adjust the first value since that's the version number
  32042. temp[0] = data.charCodeAt(0);
  32043. this.data = temp;
  32044. this.pos = 0;
  32045. };
  32046. ATNDeserializer.prototype.checkVersion = function() {
  32047. var version = this.readInt();
  32048. if ( version !== SERIALIZED_VERSION ) {
  32049. throw ("Could not deserialize ATN with version " + version + " (expected " + SERIALIZED_VERSION + ").");
  32050. }
  32051. };
  32052. ATNDeserializer.prototype.checkUUID = function() {
  32053. var uuid = this.readUUID();
  32054. if (SUPPORTED_UUIDS.indexOf(uuid)<0) {
  32055. throw ("Could not deserialize ATN with UUID: " + uuid +
  32056. " (expected " + SERIALIZED_UUID + " or a legacy UUID).", uuid, SERIALIZED_UUID);
  32057. }
  32058. this.uuid = uuid;
  32059. };
  32060. ATNDeserializer.prototype.readATN = function() {
  32061. var grammarType = this.readInt();
  32062. var maxTokenType = this.readInt();
  32063. return new ATN(grammarType, maxTokenType);
  32064. };
  32065. ATNDeserializer.prototype.readStates = function(atn) {
  32066. var j, pair, stateNumber;
  32067. var loopBackStateNumbers = [];
  32068. var endStateNumbers = [];
  32069. var nstates = this.readInt();
  32070. for(var i=0; i<nstates; i++) {
  32071. var stype = this.readInt();
  32072. // ignore bad type of states
  32073. if (stype===ATNState.INVALID_TYPE) {
  32074. atn.addState(null);
  32075. continue;
  32076. }
  32077. var ruleIndex = this.readInt();
  32078. if (ruleIndex === 0xFFFF) {
  32079. ruleIndex = -1;
  32080. }
  32081. var s = this.stateFactory(stype, ruleIndex);
  32082. if (stype === ATNState.LOOP_END) { // special case
  32083. var loopBackStateNumber = this.readInt();
  32084. loopBackStateNumbers.push([s, loopBackStateNumber]);
  32085. } else if(s instanceof BlockStartState) {
  32086. var endStateNumber = this.readInt();
  32087. endStateNumbers.push([s, endStateNumber]);
  32088. }
  32089. atn.addState(s);
  32090. }
  32091. // delay the assignment of loop back and end states until we know all the
  32092. // state instances have been initialized
  32093. for (j=0; j<loopBackStateNumbers.length; j++) {
  32094. pair = loopBackStateNumbers[j];
  32095. pair[0].loopBackState = atn.states[pair[1]];
  32096. }
  32097. for (j=0; j<endStateNumbers.length; j++) {
  32098. pair = endStateNumbers[j];
  32099. pair[0].endState = atn.states[pair[1]];
  32100. }
  32101. var numNonGreedyStates = this.readInt();
  32102. for (j=0; j<numNonGreedyStates; j++) {
  32103. stateNumber = this.readInt();
  32104. atn.states[stateNumber].nonGreedy = true;
  32105. }
  32106. var numPrecedenceStates = this.readInt();
  32107. for (j=0; j<numPrecedenceStates; j++) {
  32108. stateNumber = this.readInt();
  32109. atn.states[stateNumber].isPrecedenceRule = true;
  32110. }
  32111. };
  32112. ATNDeserializer.prototype.readRules = function(atn) {
  32113. var i;
  32114. var nrules = this.readInt();
  32115. if (atn.grammarType === ATNType.LEXER ) {
  32116. atn.ruleToTokenType = initArray(nrules, 0);
  32117. }
  32118. atn.ruleToStartState = initArray(nrules, 0);
  32119. for (i=0; i<nrules; i++) {
  32120. var s = this.readInt();
  32121. var startState = atn.states[s];
  32122. atn.ruleToStartState[i] = startState;
  32123. if ( atn.grammarType === ATNType.LEXER ) {
  32124. var tokenType = this.readInt();
  32125. if (tokenType === 0xFFFF) {
  32126. tokenType = Token.EOF;
  32127. }
  32128. atn.ruleToTokenType[i] = tokenType;
  32129. }
  32130. }
  32131. atn.ruleToStopState = initArray(nrules, 0);
  32132. for (i=0; i<atn.states.length; i++) {
  32133. var state = atn.states[i];
  32134. if (!(state instanceof RuleStopState)) {
  32135. continue;
  32136. }
  32137. atn.ruleToStopState[state.ruleIndex] = state;
  32138. atn.ruleToStartState[state.ruleIndex].stopState = state;
  32139. }
  32140. };
  32141. ATNDeserializer.prototype.readModes = function(atn) {
  32142. var nmodes = this.readInt();
  32143. for (var i=0; i<nmodes; i++) {
  32144. var s = this.readInt();
  32145. atn.modeToStartState.push(atn.states[s]);
  32146. }
  32147. };
  32148. ATNDeserializer.prototype.readSets = function(atn, sets, readUnicode) {
  32149. var m = this.readInt();
  32150. for (var i=0; i<m; i++) {
  32151. var iset = new IntervalSet();
  32152. sets.push(iset);
  32153. var n = this.readInt();
  32154. var containsEof = this.readInt();
  32155. if (containsEof!==0) {
  32156. iset.addOne(-1);
  32157. }
  32158. for (var j=0; j<n; j++) {
  32159. var i1 = readUnicode();
  32160. var i2 = readUnicode();
  32161. iset.addRange(i1, i2);
  32162. }
  32163. }
  32164. };
  32165. ATNDeserializer.prototype.readEdges = function(atn, sets) {
  32166. var i, j, state, trans, target;
  32167. var nedges = this.readInt();
  32168. for (i=0; i<nedges; i++) {
  32169. var src = this.readInt();
  32170. var trg = this.readInt();
  32171. var ttype = this.readInt();
  32172. var arg1 = this.readInt();
  32173. var arg2 = this.readInt();
  32174. var arg3 = this.readInt();
  32175. trans = this.edgeFactory(atn, ttype, src, trg, arg1, arg2, arg3, sets);
  32176. var srcState = atn.states[src];
  32177. srcState.addTransition(trans);
  32178. }
  32179. // edges for rule stop states can be derived, so they aren't serialized
  32180. for (i=0; i<atn.states.length; i++) {
  32181. state = atn.states[i];
  32182. for (j=0; j<state.transitions.length; j++) {
  32183. var t = state.transitions[j];
  32184. if (!(t instanceof RuleTransition)) {
  32185. continue;
  32186. }
  32187. var outermostPrecedenceReturn = -1;
  32188. if (atn.ruleToStartState[t.target.ruleIndex].isPrecedenceRule) {
  32189. if (t.precedence === 0) {
  32190. outermostPrecedenceReturn = t.target.ruleIndex;
  32191. }
  32192. }
  32193. trans = new EpsilonTransition(t.followState, outermostPrecedenceReturn);
  32194. atn.ruleToStopState[t.target.ruleIndex].addTransition(trans);
  32195. }
  32196. }
  32197. for (i=0; i<atn.states.length; i++) {
  32198. state = atn.states[i];
  32199. if (state instanceof BlockStartState) {
  32200. // we need to know the end state to set its start state
  32201. if (state.endState === null) {
  32202. throw ("IllegalState");
  32203. }
  32204. // block end states can only be associated to a single block start
  32205. // state
  32206. if ( state.endState.startState !== null) {
  32207. throw ("IllegalState");
  32208. }
  32209. state.endState.startState = state;
  32210. }
  32211. if (state instanceof PlusLoopbackState) {
  32212. for (j=0; j<state.transitions.length; j++) {
  32213. target = state.transitions[j].target;
  32214. if (target instanceof PlusBlockStartState) {
  32215. target.loopBackState = state;
  32216. }
  32217. }
  32218. } else if (state instanceof StarLoopbackState) {
  32219. for (j=0; j<state.transitions.length; j++) {
  32220. target = state.transitions[j].target;
  32221. if (target instanceof StarLoopEntryState) {
  32222. target.loopBackState = state;
  32223. }
  32224. }
  32225. }
  32226. }
  32227. };
  32228. ATNDeserializer.prototype.readDecisions = function(atn) {
  32229. var ndecisions = this.readInt();
  32230. for (var i=0; i<ndecisions; i++) {
  32231. var s = this.readInt();
  32232. var decState = atn.states[s];
  32233. atn.decisionToState.push(decState);
  32234. decState.decision = i;
  32235. }
  32236. };
  32237. ATNDeserializer.prototype.readLexerActions = function(atn) {
  32238. if (atn.grammarType === ATNType.LEXER) {
  32239. var count = this.readInt();
  32240. atn.lexerActions = initArray(count, null);
  32241. for (var i=0; i<count; i++) {
  32242. var actionType = this.readInt();
  32243. var data1 = this.readInt();
  32244. if (data1 === 0xFFFF) {
  32245. data1 = -1;
  32246. }
  32247. var data2 = this.readInt();
  32248. if (data2 === 0xFFFF) {
  32249. data2 = -1;
  32250. }
  32251. var lexerAction = this.lexerActionFactory(actionType, data1, data2);
  32252. atn.lexerActions[i] = lexerAction;
  32253. }
  32254. }
  32255. };
  32256. ATNDeserializer.prototype.generateRuleBypassTransitions = function(atn) {
  32257. var i;
  32258. var count = atn.ruleToStartState.length;
  32259. for(i=0; i<count; i++) {
  32260. atn.ruleToTokenType[i] = atn.maxTokenType + i + 1;
  32261. }
  32262. for(i=0; i<count; i++) {
  32263. this.generateRuleBypassTransition(atn, i);
  32264. }
  32265. };
  32266. ATNDeserializer.prototype.generateRuleBypassTransition = function(atn, idx) {
  32267. var i, state;
  32268. var bypassStart = new BasicBlockStartState();
  32269. bypassStart.ruleIndex = idx;
  32270. atn.addState(bypassStart);
  32271. var bypassStop = new BlockEndState();
  32272. bypassStop.ruleIndex = idx;
  32273. atn.addState(bypassStop);
  32274. bypassStart.endState = bypassStop;
  32275. atn.defineDecisionState(bypassStart);
  32276. bypassStop.startState = bypassStart;
  32277. var excludeTransition = null;
  32278. var endState = null;
  32279. if (atn.ruleToStartState[idx].isPrecedenceRule) {
  32280. // wrap from the beginning of the rule to the StarLoopEntryState
  32281. endState = null;
  32282. for(i=0; i<atn.states.length; i++) {
  32283. state = atn.states[i];
  32284. if (this.stateIsEndStateFor(state, idx)) {
  32285. endState = state;
  32286. excludeTransition = state.loopBackState.transitions[0];
  32287. break;
  32288. }
  32289. }
  32290. if (excludeTransition === null) {
  32291. throw ("Couldn't identify final state of the precedence rule prefix section.");
  32292. }
  32293. } else {
  32294. endState = atn.ruleToStopState[idx];
  32295. }
  32296. // all non-excluded transitions that currently target end state need to
  32297. // target blockEnd instead
  32298. for(i=0; i<atn.states.length; i++) {
  32299. state = atn.states[i];
  32300. for(var j=0; j<state.transitions.length; j++) {
  32301. var transition = state.transitions[j];
  32302. if (transition === excludeTransition) {
  32303. continue;
  32304. }
  32305. if (transition.target === endState) {
  32306. transition.target = bypassStop;
  32307. }
  32308. }
  32309. }
  32310. // all transitions leaving the rule start state need to leave blockStart
  32311. // instead
  32312. var ruleToStartState = atn.ruleToStartState[idx];
  32313. var count = ruleToStartState.transitions.length;
  32314. while ( count > 0) {
  32315. bypassStart.addTransition(ruleToStartState.transitions[count-1]);
  32316. ruleToStartState.transitions = ruleToStartState.transitions.slice(-1);
  32317. }
  32318. // link the new states
  32319. atn.ruleToStartState[idx].addTransition(new EpsilonTransition(bypassStart));
  32320. bypassStop.addTransition(new EpsilonTransition(endState));
  32321. var matchState = new BasicState();
  32322. atn.addState(matchState);
  32323. matchState.addTransition(new AtomTransition(bypassStop, atn.ruleToTokenType[idx]));
  32324. bypassStart.addTransition(new EpsilonTransition(matchState));
  32325. };
  32326. ATNDeserializer.prototype.stateIsEndStateFor = function(state, idx) {
  32327. if ( state.ruleIndex !== idx) {
  32328. return null;
  32329. }
  32330. if (!( state instanceof StarLoopEntryState)) {
  32331. return null;
  32332. }
  32333. var maybeLoopEndState = state.transitions[state.transitions.length - 1].target;
  32334. if (!( maybeLoopEndState instanceof LoopEndState)) {
  32335. return null;
  32336. }
  32337. if (maybeLoopEndState.epsilonOnlyTransitions &&
  32338. (maybeLoopEndState.transitions[0].target instanceof RuleStopState)) {
  32339. return state;
  32340. } else {
  32341. return null;
  32342. }
  32343. };
  32344. //
  32345. // Analyze the {@link StarLoopEntryState} states in the specified ATN to set
  32346. // the {@link StarLoopEntryState//isPrecedenceDecision} field to the
  32347. // correct value.
  32348. //
  32349. // @param atn The ATN.
  32350. //
  32351. ATNDeserializer.prototype.markPrecedenceDecisions = function(atn) {
  32352. for(var i=0; i<atn.states.length; i++) {
  32353. var state = atn.states[i];
  32354. if (!( state instanceof StarLoopEntryState)) {
  32355. continue;
  32356. }
  32357. // We analyze the ATN to determine if this ATN decision state is the
  32358. // decision for the closure block that determines whether a
  32359. // precedence rule should continue or complete.
  32360. //
  32361. if ( atn.ruleToStartState[state.ruleIndex].isPrecedenceRule) {
  32362. var maybeLoopEndState = state.transitions[state.transitions.length - 1].target;
  32363. if (maybeLoopEndState instanceof LoopEndState) {
  32364. if ( maybeLoopEndState.epsilonOnlyTransitions &&
  32365. (maybeLoopEndState.transitions[0].target instanceof RuleStopState)) {
  32366. state.isPrecedenceDecision = true;
  32367. }
  32368. }
  32369. }
  32370. }
  32371. };
  32372. ATNDeserializer.prototype.verifyATN = function(atn) {
  32373. if (!this.deserializationOptions.verifyATN) {
  32374. return;
  32375. }
  32376. // verify assumptions
  32377. for(var i=0; i<atn.states.length; i++) {
  32378. var state = atn.states[i];
  32379. if (state === null) {
  32380. continue;
  32381. }
  32382. this.checkCondition(state.epsilonOnlyTransitions || state.transitions.length <= 1);
  32383. if (state instanceof PlusBlockStartState) {
  32384. this.checkCondition(state.loopBackState !== null);
  32385. } else if (state instanceof StarLoopEntryState) {
  32386. this.checkCondition(state.loopBackState !== null);
  32387. this.checkCondition(state.transitions.length === 2);
  32388. if (state.transitions[0].target instanceof StarBlockStartState) {
  32389. this.checkCondition(state.transitions[1].target instanceof LoopEndState);
  32390. this.checkCondition(!state.nonGreedy);
  32391. } else if (state.transitions[0].target instanceof LoopEndState) {
  32392. this.checkCondition(state.transitions[1].target instanceof StarBlockStartState);
  32393. this.checkCondition(state.nonGreedy);
  32394. } else {
  32395. throw("IllegalState");
  32396. }
  32397. } else if (state instanceof StarLoopbackState) {
  32398. this.checkCondition(state.transitions.length === 1);
  32399. this.checkCondition(state.transitions[0].target instanceof StarLoopEntryState);
  32400. } else if (state instanceof LoopEndState) {
  32401. this.checkCondition(state.loopBackState !== null);
  32402. } else if (state instanceof RuleStartState) {
  32403. this.checkCondition(state.stopState !== null);
  32404. } else if (state instanceof BlockStartState) {
  32405. this.checkCondition(state.endState !== null);
  32406. } else if (state instanceof BlockEndState) {
  32407. this.checkCondition(state.startState !== null);
  32408. } else if (state instanceof DecisionState) {
  32409. this.checkCondition(state.transitions.length <= 1 || state.decision >= 0);
  32410. } else {
  32411. this.checkCondition(state.transitions.length <= 1 || (state instanceof RuleStopState));
  32412. }
  32413. }
  32414. };
  32415. ATNDeserializer.prototype.checkCondition = function(condition, message) {
  32416. if (!condition) {
  32417. if (message === undefined || message===null) {
  32418. message = "IllegalState";
  32419. }
  32420. throw (message);
  32421. }
  32422. };
  32423. ATNDeserializer.prototype.readInt = function() {
  32424. return this.data[this.pos++];
  32425. };
  32426. ATNDeserializer.prototype.readInt32 = function() {
  32427. var low = this.readInt();
  32428. var high = this.readInt();
  32429. return low | (high << 16);
  32430. };
  32431. ATNDeserializer.prototype.readLong = function() {
  32432. var low = this.readInt32();
  32433. var high = this.readInt32();
  32434. return (low & 0x00000000FFFFFFFF) | (high << 32);
  32435. };
  32436. function createByteToHex() {
  32437. var bth = [];
  32438. for (var i = 0; i < 256; i++) {
  32439. bth[i] = (i + 0x100).toString(16).substr(1).toUpperCase();
  32440. }
  32441. return bth;
  32442. }
  32443. var byteToHex = createByteToHex();
  32444. ATNDeserializer.prototype.readUUID = function() {
  32445. var bb = [];
  32446. for(var i=7;i>=0;i--) {
  32447. var int = this.readInt();
  32448. /* jshint bitwise: false */
  32449. bb[(2*i)+1] = int & 0xFF;
  32450. bb[2*i] = (int >> 8) & 0xFF;
  32451. }
  32452. return byteToHex[bb[0]] + byteToHex[bb[1]] +
  32453. byteToHex[bb[2]] + byteToHex[bb[3]] + '-' +
  32454. byteToHex[bb[4]] + byteToHex[bb[5]] + '-' +
  32455. byteToHex[bb[6]] + byteToHex[bb[7]] + '-' +
  32456. byteToHex[bb[8]] + byteToHex[bb[9]] + '-' +
  32457. byteToHex[bb[10]] + byteToHex[bb[11]] +
  32458. byteToHex[bb[12]] + byteToHex[bb[13]] +
  32459. byteToHex[bb[14]] + byteToHex[bb[15]];
  32460. };
  32461. ATNDeserializer.prototype.edgeFactory = function(atn, type, src, trg, arg1, arg2, arg3, sets) {
  32462. var target = atn.states[trg];
  32463. switch(type) {
  32464. case Transition.EPSILON:
  32465. return new EpsilonTransition(target);
  32466. case Transition.RANGE:
  32467. return arg3 !== 0 ? new RangeTransition(target, Token.EOF, arg2) : new RangeTransition(target, arg1, arg2);
  32468. case Transition.RULE:
  32469. return new RuleTransition(atn.states[arg1], arg2, arg3, target);
  32470. case Transition.PREDICATE:
  32471. return new PredicateTransition(target, arg1, arg2, arg3 !== 0);
  32472. case Transition.PRECEDENCE:
  32473. return new PrecedencePredicateTransition(target, arg1);
  32474. case Transition.ATOM:
  32475. return arg3 !== 0 ? new AtomTransition(target, Token.EOF) : new AtomTransition(target, arg1);
  32476. case Transition.ACTION:
  32477. return new ActionTransition(target, arg1, arg2, arg3 !== 0);
  32478. case Transition.SET:
  32479. return new SetTransition(target, sets[arg1]);
  32480. case Transition.NOT_SET:
  32481. return new NotSetTransition(target, sets[arg1]);
  32482. case Transition.WILDCARD:
  32483. return new WildcardTransition(target);
  32484. default:
  32485. throw "The specified transition type: " + type + " is not valid.";
  32486. }
  32487. };
  32488. ATNDeserializer.prototype.stateFactory = function(type, ruleIndex) {
  32489. if (this.stateFactories === null) {
  32490. var sf = [];
  32491. sf[ATNState.INVALID_TYPE] = null;
  32492. sf[ATNState.BASIC] = function() { return new BasicState(); };
  32493. sf[ATNState.RULE_START] = function() { return new RuleStartState(); };
  32494. sf[ATNState.BLOCK_START] = function() { return new BasicBlockStartState(); };
  32495. sf[ATNState.PLUS_BLOCK_START] = function() { return new PlusBlockStartState(); };
  32496. sf[ATNState.STAR_BLOCK_START] = function() { return new StarBlockStartState(); };
  32497. sf[ATNState.TOKEN_START] = function() { return new TokensStartState(); };
  32498. sf[ATNState.RULE_STOP] = function() { return new RuleStopState(); };
  32499. sf[ATNState.BLOCK_END] = function() { return new BlockEndState(); };
  32500. sf[ATNState.STAR_LOOP_BACK] = function() { return new StarLoopbackState(); };
  32501. sf[ATNState.STAR_LOOP_ENTRY] = function() { return new StarLoopEntryState(); };
  32502. sf[ATNState.PLUS_LOOP_BACK] = function() { return new PlusLoopbackState(); };
  32503. sf[ATNState.LOOP_END] = function() { return new LoopEndState(); };
  32504. this.stateFactories = sf;
  32505. }
  32506. if (type>this.stateFactories.length || this.stateFactories[type] === null) {
  32507. throw("The specified state type " + type + " is not valid.");
  32508. } else {
  32509. var s = this.stateFactories[type]();
  32510. if (s!==null) {
  32511. s.ruleIndex = ruleIndex;
  32512. return s;
  32513. }
  32514. }
  32515. };
  32516. ATNDeserializer.prototype.lexerActionFactory = function(type, data1, data2) {
  32517. if (this.actionFactories === null) {
  32518. var af = [];
  32519. af[LexerActionType.CHANNEL] = function(data1, data2) { return new LexerChannelAction(data1); };
  32520. af[LexerActionType.CUSTOM] = function(data1, data2) { return new LexerCustomAction(data1, data2); };
  32521. af[LexerActionType.MODE] = function(data1, data2) { return new LexerModeAction(data1); };
  32522. af[LexerActionType.MORE] = function(data1, data2) { return LexerMoreAction.INSTANCE; };
  32523. af[LexerActionType.POP_MODE] = function(data1, data2) { return LexerPopModeAction.INSTANCE; };
  32524. af[LexerActionType.PUSH_MODE] = function(data1, data2) { return new LexerPushModeAction(data1); };
  32525. af[LexerActionType.SKIP] = function(data1, data2) { return LexerSkipAction.INSTANCE; };
  32526. af[LexerActionType.TYPE] = function(data1, data2) { return new LexerTypeAction(data1); };
  32527. this.actionFactories = af;
  32528. }
  32529. if (type>this.actionFactories.length || this.actionFactories[type] === null) {
  32530. throw("The specified lexer action type " + type + " is not valid.");
  32531. } else {
  32532. return this.actionFactories[type](data1, data2);
  32533. }
  32534. };
  32535. exports.ATNDeserializer = ATNDeserializer;
  32536. /***/ }),
  32537. /***/ "./node_modules/antlr4/atn/ATNSimulator.js":
  32538. /*!*************************************************!*\
  32539. !*** ./node_modules/antlr4/atn/ATNSimulator.js ***!
  32540. \*************************************************/
  32541. /*! no static exports found */
  32542. /***/ (function(module, exports, __webpack_require__) {
  32543. //
  32544. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  32545. * Use of this file is governed by the BSD 3-clause license that
  32546. * can be found in the LICENSE.txt file in the project root.
  32547. */
  32548. ///
  32549. var DFAState = __webpack_require__(/*! ./../dfa/DFAState */ "./node_modules/antlr4/dfa/DFAState.js").DFAState;
  32550. var ATNConfigSet = __webpack_require__(/*! ./ATNConfigSet */ "./node_modules/antlr4/atn/ATNConfigSet.js").ATNConfigSet;
  32551. var getCachedPredictionContext = __webpack_require__(/*! ./../PredictionContext */ "./node_modules/antlr4/PredictionContext.js").getCachedPredictionContext;
  32552. function ATNSimulator(atn, sharedContextCache) {
  32553. // The context cache maps all PredictionContext objects that are ==
  32554. // to a single cached copy. This cache is shared across all contexts
  32555. // in all ATNConfigs in all DFA states. We rebuild each ATNConfigSet
  32556. // to use only cached nodes/graphs in addDFAState(). We don't want to
  32557. // fill this during closure() since there are lots of contexts that
  32558. // pop up but are not used ever again. It also greatly slows down closure().
  32559. //
  32560. // <p>This cache makes a huge difference in memory and a little bit in speed.
  32561. // For the Java grammar on java.*, it dropped the memory requirements
  32562. // at the end from 25M to 16M. We don't store any of the full context
  32563. // graphs in the DFA because they are limited to local context only,
  32564. // but apparently there's a lot of repetition there as well. We optimize
  32565. // the config contexts before storing the config set in the DFA states
  32566. // by literally rebuilding them with cached subgraphs only.</p>
  32567. //
  32568. // <p>I tried a cache for use during closure operations, that was
  32569. // whacked after each adaptivePredict(). It cost a little bit
  32570. // more time I think and doesn't save on the overall footprint
  32571. // so it's not worth the complexity.</p>
  32572. ///
  32573. this.atn = atn;
  32574. this.sharedContextCache = sharedContextCache;
  32575. return this;
  32576. }
  32577. // Must distinguish between missing edge and edge we know leads nowhere///
  32578. ATNSimulator.ERROR = new DFAState(0x7FFFFFFF, new ATNConfigSet());
  32579. ATNSimulator.prototype.getCachedContext = function(context) {
  32580. if (this.sharedContextCache ===null) {
  32581. return context;
  32582. }
  32583. var visited = {};
  32584. return getCachedPredictionContext(context, this.sharedContextCache, visited);
  32585. };
  32586. exports.ATNSimulator = ATNSimulator;
  32587. /***/ }),
  32588. /***/ "./node_modules/antlr4/atn/ATNState.js":
  32589. /*!*********************************************!*\
  32590. !*** ./node_modules/antlr4/atn/ATNState.js ***!
  32591. \*********************************************/
  32592. /*! no static exports found */
  32593. /***/ (function(module, exports) {
  32594. //
  32595. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  32596. * Use of this file is governed by the BSD 3-clause license that
  32597. * can be found in the LICENSE.txt file in the project root.
  32598. */
  32599. //
  32600. // The following images show the relation of states and
  32601. // {@link ATNState//transitions} for various grammar constructs.
  32602. //
  32603. // <ul>
  32604. //
  32605. // <li>Solid edges marked with an &//0949; indicate a required
  32606. // {@link EpsilonTransition}.</li>
  32607. //
  32608. // <li>Dashed edges indicate locations where any transition derived from
  32609. // {@link Transition} might appear.</li>
  32610. //
  32611. // <li>Dashed nodes are place holders for either a sequence of linked
  32612. // {@link BasicState} states or the inclusion of a block representing a nested
  32613. // construct in one of the forms below.</li>
  32614. //
  32615. // <li>Nodes showing multiple outgoing alternatives with a {@code ...} support
  32616. // any number of alternatives (one or more). Nodes without the {@code ...} only
  32617. // support the exact number of alternatives shown in the diagram.</li>
  32618. //
  32619. // </ul>
  32620. //
  32621. // <h2>Basic Blocks</h2>
  32622. //
  32623. // <h3>Rule</h3>
  32624. //
  32625. // <embed src="images/Rule.svg" type="image/svg+xml"/>
  32626. //
  32627. // <h3>Block of 1 or more alternatives</h3>
  32628. //
  32629. // <embed src="images/Block.svg" type="image/svg+xml"/>
  32630. //
  32631. // <h2>Greedy Loops</h2>
  32632. //
  32633. // <h3>Greedy Closure: {@code (...)*}</h3>
  32634. //
  32635. // <embed src="images/ClosureGreedy.svg" type="image/svg+xml"/>
  32636. //
  32637. // <h3>Greedy Positive Closure: {@code (...)+}</h3>
  32638. //
  32639. // <embed src="images/PositiveClosureGreedy.svg" type="image/svg+xml"/>
  32640. //
  32641. // <h3>Greedy Optional: {@code (...)?}</h3>
  32642. //
  32643. // <embed src="images/OptionalGreedy.svg" type="image/svg+xml"/>
  32644. //
  32645. // <h2>Non-Greedy Loops</h2>
  32646. //
  32647. // <h3>Non-Greedy Closure: {@code (...)*?}</h3>
  32648. //
  32649. // <embed src="images/ClosureNonGreedy.svg" type="image/svg+xml"/>
  32650. //
  32651. // <h3>Non-Greedy Positive Closure: {@code (...)+?}</h3>
  32652. //
  32653. // <embed src="images/PositiveClosureNonGreedy.svg" type="image/svg+xml"/>
  32654. //
  32655. // <h3>Non-Greedy Optional: {@code (...)??}</h3>
  32656. //
  32657. // <embed src="images/OptionalNonGreedy.svg" type="image/svg+xml"/>
  32658. //
  32659. var INITIAL_NUM_TRANSITIONS = 4;
  32660. function ATNState() {
  32661. // Which ATN are we in?
  32662. this.atn = null;
  32663. this.stateNumber = ATNState.INVALID_STATE_NUMBER;
  32664. this.stateType = null;
  32665. this.ruleIndex = 0; // at runtime, we don't have Rule objects
  32666. this.epsilonOnlyTransitions = false;
  32667. // Track the transitions emanating from this ATN state.
  32668. this.transitions = [];
  32669. // Used to cache lookahead during parsing, not used during construction
  32670. this.nextTokenWithinRule = null;
  32671. return this;
  32672. }
  32673. // constants for serialization
  32674. ATNState.INVALID_TYPE = 0;
  32675. ATNState.BASIC = 1;
  32676. ATNState.RULE_START = 2;
  32677. ATNState.BLOCK_START = 3;
  32678. ATNState.PLUS_BLOCK_START = 4;
  32679. ATNState.STAR_BLOCK_START = 5;
  32680. ATNState.TOKEN_START = 6;
  32681. ATNState.RULE_STOP = 7;
  32682. ATNState.BLOCK_END = 8;
  32683. ATNState.STAR_LOOP_BACK = 9;
  32684. ATNState.STAR_LOOP_ENTRY = 10;
  32685. ATNState.PLUS_LOOP_BACK = 11;
  32686. ATNState.LOOP_END = 12;
  32687. ATNState.serializationNames = [
  32688. "INVALID",
  32689. "BASIC",
  32690. "RULE_START",
  32691. "BLOCK_START",
  32692. "PLUS_BLOCK_START",
  32693. "STAR_BLOCK_START",
  32694. "TOKEN_START",
  32695. "RULE_STOP",
  32696. "BLOCK_END",
  32697. "STAR_LOOP_BACK",
  32698. "STAR_LOOP_ENTRY",
  32699. "PLUS_LOOP_BACK",
  32700. "LOOP_END" ];
  32701. ATNState.INVALID_STATE_NUMBER = -1;
  32702. ATNState.prototype.toString = function() {
  32703. return this.stateNumber;
  32704. };
  32705. ATNState.prototype.equals = function(other) {
  32706. if (other instanceof ATNState) {
  32707. return this.stateNumber===other.stateNumber;
  32708. } else {
  32709. return false;
  32710. }
  32711. };
  32712. ATNState.prototype.isNonGreedyExitState = function() {
  32713. return false;
  32714. };
  32715. ATNState.prototype.addTransition = function(trans, index) {
  32716. if(index===undefined) {
  32717. index = -1;
  32718. }
  32719. if (this.transitions.length===0) {
  32720. this.epsilonOnlyTransitions = trans.isEpsilon;
  32721. } else if(this.epsilonOnlyTransitions !== trans.isEpsilon) {
  32722. this.epsilonOnlyTransitions = false;
  32723. }
  32724. if (index===-1) {
  32725. this.transitions.push(trans);
  32726. } else {
  32727. this.transitions.splice(index, 1, trans);
  32728. }
  32729. };
  32730. function BasicState() {
  32731. ATNState.call(this);
  32732. this.stateType = ATNState.BASIC;
  32733. return this;
  32734. }
  32735. BasicState.prototype = Object.create(ATNState.prototype);
  32736. BasicState.prototype.constructor = BasicState;
  32737. function DecisionState() {
  32738. ATNState.call(this);
  32739. this.decision = -1;
  32740. this.nonGreedy = false;
  32741. return this;
  32742. }
  32743. DecisionState.prototype = Object.create(ATNState.prototype);
  32744. DecisionState.prototype.constructor = DecisionState;
  32745. // The start of a regular {@code (...)} block.
  32746. function BlockStartState() {
  32747. DecisionState.call(this);
  32748. this.endState = null;
  32749. return this;
  32750. }
  32751. BlockStartState.prototype = Object.create(DecisionState.prototype);
  32752. BlockStartState.prototype.constructor = BlockStartState;
  32753. function BasicBlockStartState() {
  32754. BlockStartState.call(this);
  32755. this.stateType = ATNState.BLOCK_START;
  32756. return this;
  32757. }
  32758. BasicBlockStartState.prototype = Object.create(BlockStartState.prototype);
  32759. BasicBlockStartState.prototype.constructor = BasicBlockStartState;
  32760. // Terminal node of a simple {@code (a|b|c)} block.
  32761. function BlockEndState() {
  32762. ATNState.call(this);
  32763. this.stateType = ATNState.BLOCK_END;
  32764. this.startState = null;
  32765. return this;
  32766. }
  32767. BlockEndState.prototype = Object.create(ATNState.prototype);
  32768. BlockEndState.prototype.constructor = BlockEndState;
  32769. // The last node in the ATN for a rule, unless that rule is the start symbol.
  32770. // In that case, there is one transition to EOF. Later, we might encode
  32771. // references to all calls to this rule to compute FOLLOW sets for
  32772. // error handling.
  32773. //
  32774. function RuleStopState() {
  32775. ATNState.call(this);
  32776. this.stateType = ATNState.RULE_STOP;
  32777. return this;
  32778. }
  32779. RuleStopState.prototype = Object.create(ATNState.prototype);
  32780. RuleStopState.prototype.constructor = RuleStopState;
  32781. function RuleStartState() {
  32782. ATNState.call(this);
  32783. this.stateType = ATNState.RULE_START;
  32784. this.stopState = null;
  32785. this.isPrecedenceRule = false;
  32786. return this;
  32787. }
  32788. RuleStartState.prototype = Object.create(ATNState.prototype);
  32789. RuleStartState.prototype.constructor = RuleStartState;
  32790. // Decision state for {@code A+} and {@code (A|B)+}. It has two transitions:
  32791. // one to the loop back to start of the block and one to exit.
  32792. //
  32793. function PlusLoopbackState() {
  32794. DecisionState.call(this);
  32795. this.stateType = ATNState.PLUS_LOOP_BACK;
  32796. return this;
  32797. }
  32798. PlusLoopbackState.prototype = Object.create(DecisionState.prototype);
  32799. PlusLoopbackState.prototype.constructor = PlusLoopbackState;
  32800. // Start of {@code (A|B|...)+} loop. Technically a decision state, but
  32801. // we don't use for code generation; somebody might need it, so I'm defining
  32802. // it for completeness. In reality, the {@link PlusLoopbackState} node is the
  32803. // real decision-making note for {@code A+}.
  32804. //
  32805. function PlusBlockStartState() {
  32806. BlockStartState.call(this);
  32807. this.stateType = ATNState.PLUS_BLOCK_START;
  32808. this.loopBackState = null;
  32809. return this;
  32810. }
  32811. PlusBlockStartState.prototype = Object.create(BlockStartState.prototype);
  32812. PlusBlockStartState.prototype.constructor = PlusBlockStartState;
  32813. // The block that begins a closure loop.
  32814. function StarBlockStartState() {
  32815. BlockStartState.call(this);
  32816. this.stateType = ATNState.STAR_BLOCK_START;
  32817. return this;
  32818. }
  32819. StarBlockStartState.prototype = Object.create(BlockStartState.prototype);
  32820. StarBlockStartState.prototype.constructor = StarBlockStartState;
  32821. function StarLoopbackState() {
  32822. ATNState.call(this);
  32823. this.stateType = ATNState.STAR_LOOP_BACK;
  32824. return this;
  32825. }
  32826. StarLoopbackState.prototype = Object.create(ATNState.prototype);
  32827. StarLoopbackState.prototype.constructor = StarLoopbackState;
  32828. function StarLoopEntryState() {
  32829. DecisionState.call(this);
  32830. this.stateType = ATNState.STAR_LOOP_ENTRY;
  32831. this.loopBackState = null;
  32832. // Indicates whether this state can benefit from a precedence DFA during SLL decision making.
  32833. this.isPrecedenceDecision = null;
  32834. return this;
  32835. }
  32836. StarLoopEntryState.prototype = Object.create(DecisionState.prototype);
  32837. StarLoopEntryState.prototype.constructor = StarLoopEntryState;
  32838. // Mark the end of a * or + loop.
  32839. function LoopEndState() {
  32840. ATNState.call(this);
  32841. this.stateType = ATNState.LOOP_END;
  32842. this.loopBackState = null;
  32843. return this;
  32844. }
  32845. LoopEndState.prototype = Object.create(ATNState.prototype);
  32846. LoopEndState.prototype.constructor = LoopEndState;
  32847. // The Tokens rule start state linking to each lexer rule start state */
  32848. function TokensStartState() {
  32849. DecisionState.call(this);
  32850. this.stateType = ATNState.TOKEN_START;
  32851. return this;
  32852. }
  32853. TokensStartState.prototype = Object.create(DecisionState.prototype);
  32854. TokensStartState.prototype.constructor = TokensStartState;
  32855. exports.ATNState = ATNState;
  32856. exports.BasicState = BasicState;
  32857. exports.DecisionState = DecisionState;
  32858. exports.BlockStartState = BlockStartState;
  32859. exports.BlockEndState = BlockEndState;
  32860. exports.LoopEndState = LoopEndState;
  32861. exports.RuleStartState = RuleStartState;
  32862. exports.RuleStopState = RuleStopState;
  32863. exports.TokensStartState = TokensStartState;
  32864. exports.PlusLoopbackState = PlusLoopbackState;
  32865. exports.StarLoopbackState = StarLoopbackState;
  32866. exports.StarLoopEntryState = StarLoopEntryState;
  32867. exports.PlusBlockStartState = PlusBlockStartState;
  32868. exports.StarBlockStartState = StarBlockStartState;
  32869. exports.BasicBlockStartState = BasicBlockStartState;
  32870. /***/ }),
  32871. /***/ "./node_modules/antlr4/atn/ATNType.js":
  32872. /*!********************************************!*\
  32873. !*** ./node_modules/antlr4/atn/ATNType.js ***!
  32874. \********************************************/
  32875. /*! no static exports found */
  32876. /***/ (function(module, exports) {
  32877. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  32878. * Use of this file is governed by the BSD 3-clause license that
  32879. * can be found in the LICENSE.txt file in the project root.
  32880. */
  32881. ///
  32882. // Represents the type of recognizer an ATN applies to.
  32883. function ATNType() {
  32884. }
  32885. ATNType.LEXER = 0;
  32886. ATNType.PARSER = 1;
  32887. exports.ATNType = ATNType;
  32888. /***/ }),
  32889. /***/ "./node_modules/antlr4/atn/LexerATNSimulator.js":
  32890. /*!******************************************************!*\
  32891. !*** ./node_modules/antlr4/atn/LexerATNSimulator.js ***!
  32892. \******************************************************/
  32893. /*! no static exports found */
  32894. /***/ (function(module, exports, __webpack_require__) {
  32895. //
  32896. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  32897. * Use of this file is governed by the BSD 3-clause license that
  32898. * can be found in the LICENSE.txt file in the project root.
  32899. */
  32900. ///
  32901. // When we hit an accept state in either the DFA or the ATN, we
  32902. // have to notify the character stream to start buffering characters
  32903. // via {@link IntStream//mark} and record the current state. The current sim state
  32904. // includes the current index into the input, the current line,
  32905. // and current character position in that line. Note that the Lexer is
  32906. // tracking the starting line and characterization of the token. These
  32907. // variables track the "state" of the simulator when it hits an accept state.
  32908. //
  32909. // <p>We track these variables separately for the DFA and ATN simulation
  32910. // because the DFA simulation often has to fail over to the ATN
  32911. // simulation. If the ATN simulation fails, we need the DFA to fall
  32912. // back to its previously accepted state, if any. If the ATN succeeds,
  32913. // then the ATN does the accept and the DFA simulator that invoked it
  32914. // can simply return the predicted token type.</p>
  32915. ///
  32916. var Token = __webpack_require__(/*! ./../Token */ "./node_modules/antlr4/Token.js").Token;
  32917. var Lexer = __webpack_require__(/*! ./../Lexer */ "./node_modules/antlr4/Lexer.js").Lexer;
  32918. var ATN = __webpack_require__(/*! ./ATN */ "./node_modules/antlr4/atn/ATN.js").ATN;
  32919. var ATNSimulator = __webpack_require__(/*! ./ATNSimulator */ "./node_modules/antlr4/atn/ATNSimulator.js").ATNSimulator;
  32920. var DFAState = __webpack_require__(/*! ./../dfa/DFAState */ "./node_modules/antlr4/dfa/DFAState.js").DFAState;
  32921. var ATNConfigSet = __webpack_require__(/*! ./ATNConfigSet */ "./node_modules/antlr4/atn/ATNConfigSet.js").ATNConfigSet;
  32922. var OrderedATNConfigSet = __webpack_require__(/*! ./ATNConfigSet */ "./node_modules/antlr4/atn/ATNConfigSet.js").OrderedATNConfigSet;
  32923. var PredictionContext = __webpack_require__(/*! ./../PredictionContext */ "./node_modules/antlr4/PredictionContext.js").PredictionContext;
  32924. var SingletonPredictionContext = __webpack_require__(/*! ./../PredictionContext */ "./node_modules/antlr4/PredictionContext.js").SingletonPredictionContext;
  32925. var RuleStopState = __webpack_require__(/*! ./ATNState */ "./node_modules/antlr4/atn/ATNState.js").RuleStopState;
  32926. var LexerATNConfig = __webpack_require__(/*! ./ATNConfig */ "./node_modules/antlr4/atn/ATNConfig.js").LexerATNConfig;
  32927. var Transition = __webpack_require__(/*! ./Transition */ "./node_modules/antlr4/atn/Transition.js").Transition;
  32928. var LexerActionExecutor = __webpack_require__(/*! ./LexerActionExecutor */ "./node_modules/antlr4/atn/LexerActionExecutor.js").LexerActionExecutor;
  32929. var LexerNoViableAltException = __webpack_require__(/*! ./../error/Errors */ "./node_modules/antlr4/error/Errors.js").LexerNoViableAltException;
  32930. function resetSimState(sim) {
  32931. sim.index = -1;
  32932. sim.line = 0;
  32933. sim.column = -1;
  32934. sim.dfaState = null;
  32935. }
  32936. function SimState() {
  32937. resetSimState(this);
  32938. return this;
  32939. }
  32940. SimState.prototype.reset = function() {
  32941. resetSimState(this);
  32942. };
  32943. function LexerATNSimulator(recog, atn, decisionToDFA, sharedContextCache) {
  32944. ATNSimulator.call(this, atn, sharedContextCache);
  32945. this.decisionToDFA = decisionToDFA;
  32946. this.recog = recog;
  32947. // The current token's starting index into the character stream.
  32948. // Shared across DFA to ATN simulation in case the ATN fails and the
  32949. // DFA did not have a previous accept state. In this case, we use the
  32950. // ATN-generated exception object.
  32951. this.startIndex = -1;
  32952. // line number 1..n within the input///
  32953. this.line = 1;
  32954. // The index of the character relative to the beginning of the line
  32955. // 0..n-1///
  32956. this.column = 0;
  32957. this.mode = Lexer.DEFAULT_MODE;
  32958. // Used during DFA/ATN exec to record the most recent accept configuration
  32959. // info
  32960. this.prevAccept = new SimState();
  32961. // done
  32962. return this;
  32963. }
  32964. LexerATNSimulator.prototype = Object.create(ATNSimulator.prototype);
  32965. LexerATNSimulator.prototype.constructor = LexerATNSimulator;
  32966. LexerATNSimulator.debug = false;
  32967. LexerATNSimulator.dfa_debug = false;
  32968. LexerATNSimulator.MIN_DFA_EDGE = 0;
  32969. LexerATNSimulator.MAX_DFA_EDGE = 127; // forces unicode to stay in ATN
  32970. LexerATNSimulator.match_calls = 0;
  32971. LexerATNSimulator.prototype.copyState = function(simulator) {
  32972. this.column = simulator.column;
  32973. this.line = simulator.line;
  32974. this.mode = simulator.mode;
  32975. this.startIndex = simulator.startIndex;
  32976. };
  32977. LexerATNSimulator.prototype.match = function(input, mode) {
  32978. this.match_calls += 1;
  32979. this.mode = mode;
  32980. var mark = input.mark();
  32981. try {
  32982. this.startIndex = input.index;
  32983. this.prevAccept.reset();
  32984. var dfa = this.decisionToDFA[mode];
  32985. if (dfa.s0 === null) {
  32986. return this.matchATN(input);
  32987. } else {
  32988. return this.execATN(input, dfa.s0);
  32989. }
  32990. } finally {
  32991. input.release(mark);
  32992. }
  32993. };
  32994. LexerATNSimulator.prototype.reset = function() {
  32995. this.prevAccept.reset();
  32996. this.startIndex = -1;
  32997. this.line = 1;
  32998. this.column = 0;
  32999. this.mode = Lexer.DEFAULT_MODE;
  33000. };
  33001. LexerATNSimulator.prototype.matchATN = function(input) {
  33002. var startState = this.atn.modeToStartState[this.mode];
  33003. if (LexerATNSimulator.debug) {
  33004. console.log("matchATN mode " + this.mode + " start: " + startState);
  33005. }
  33006. var old_mode = this.mode;
  33007. var s0_closure = this.computeStartState(input, startState);
  33008. var suppressEdge = s0_closure.hasSemanticContext;
  33009. s0_closure.hasSemanticContext = false;
  33010. var next = this.addDFAState(s0_closure);
  33011. if (!suppressEdge) {
  33012. this.decisionToDFA[this.mode].s0 = next;
  33013. }
  33014. var predict = this.execATN(input, next);
  33015. if (LexerATNSimulator.debug) {
  33016. console.log("DFA after matchATN: " + this.decisionToDFA[old_mode].toLexerString());
  33017. }
  33018. return predict;
  33019. };
  33020. LexerATNSimulator.prototype.execATN = function(input, ds0) {
  33021. if (LexerATNSimulator.debug) {
  33022. console.log("start state closure=" + ds0.configs);
  33023. }
  33024. if (ds0.isAcceptState) {
  33025. // allow zero-length tokens
  33026. this.captureSimState(this.prevAccept, input, ds0);
  33027. }
  33028. var t = input.LA(1);
  33029. var s = ds0; // s is current/from DFA state
  33030. while (true) { // while more work
  33031. if (LexerATNSimulator.debug) {
  33032. console.log("execATN loop starting closure: " + s.configs);
  33033. }
  33034. // As we move src->trg, src->trg, we keep track of the previous trg to
  33035. // avoid looking up the DFA state again, which is expensive.
  33036. // If the previous target was already part of the DFA, we might
  33037. // be able to avoid doing a reach operation upon t. If s!=null,
  33038. // it means that semantic predicates didn't prevent us from
  33039. // creating a DFA state. Once we know s!=null, we check to see if
  33040. // the DFA state has an edge already for t. If so, we can just reuse
  33041. // it's configuration set; there's no point in re-computing it.
  33042. // This is kind of like doing DFA simulation within the ATN
  33043. // simulation because DFA simulation is really just a way to avoid
  33044. // computing reach/closure sets. Technically, once we know that
  33045. // we have a previously added DFA state, we could jump over to
  33046. // the DFA simulator. But, that would mean popping back and forth
  33047. // a lot and making things more complicated algorithmically.
  33048. // This optimization makes a lot of sense for loops within DFA.
  33049. // A character will take us back to an existing DFA state
  33050. // that already has lots of edges out of it. e.g., .* in comments.
  33051. // print("Target for:" + str(s) + " and:" + str(t))
  33052. var target = this.getExistingTargetState(s, t);
  33053. // print("Existing:" + str(target))
  33054. if (target === null) {
  33055. target = this.computeTargetState(input, s, t);
  33056. // print("Computed:" + str(target))
  33057. }
  33058. if (target === ATNSimulator.ERROR) {
  33059. break;
  33060. }
  33061. // If this is a consumable input element, make sure to consume before
  33062. // capturing the accept state so the input index, line, and char
  33063. // position accurately reflect the state of the interpreter at the
  33064. // end of the token.
  33065. if (t !== Token.EOF) {
  33066. this.consume(input);
  33067. }
  33068. if (target.isAcceptState) {
  33069. this.captureSimState(this.prevAccept, input, target);
  33070. if (t === Token.EOF) {
  33071. break;
  33072. }
  33073. }
  33074. t = input.LA(1);
  33075. s = target; // flip; current DFA target becomes new src/from state
  33076. }
  33077. return this.failOrAccept(this.prevAccept, input, s.configs, t);
  33078. };
  33079. // Get an existing target state for an edge in the DFA. If the target state
  33080. // for the edge has not yet been computed or is otherwise not available,
  33081. // this method returns {@code null}.
  33082. //
  33083. // @param s The current DFA state
  33084. // @param t The next input symbol
  33085. // @return The existing target DFA state for the given input symbol
  33086. // {@code t}, or {@code null} if the target state for this edge is not
  33087. // already cached
  33088. LexerATNSimulator.prototype.getExistingTargetState = function(s, t) {
  33089. if (s.edges === null || t < LexerATNSimulator.MIN_DFA_EDGE || t > LexerATNSimulator.MAX_DFA_EDGE) {
  33090. return null;
  33091. }
  33092. var target = s.edges[t - LexerATNSimulator.MIN_DFA_EDGE];
  33093. if(target===undefined) {
  33094. target = null;
  33095. }
  33096. if (LexerATNSimulator.debug && target !== null) {
  33097. console.log("reuse state " + s.stateNumber + " edge to " + target.stateNumber);
  33098. }
  33099. return target;
  33100. };
  33101. // Compute a target state for an edge in the DFA, and attempt to add the
  33102. // computed state and corresponding edge to the DFA.
  33103. //
  33104. // @param input The input stream
  33105. // @param s The current DFA state
  33106. // @param t The next input symbol
  33107. //
  33108. // @return The computed target DFA state for the given input symbol
  33109. // {@code t}. If {@code t} does not lead to a valid DFA state, this method
  33110. // returns {@link //ERROR}.
  33111. LexerATNSimulator.prototype.computeTargetState = function(input, s, t) {
  33112. var reach = new OrderedATNConfigSet();
  33113. // if we don't find an existing DFA state
  33114. // Fill reach starting from closure, following t transitions
  33115. this.getReachableConfigSet(input, s.configs, reach, t);
  33116. if (reach.items.length === 0) { // we got nowhere on t from s
  33117. if (!reach.hasSemanticContext) {
  33118. // we got nowhere on t, don't throw out this knowledge; it'd
  33119. // cause a failover from DFA later.
  33120. this.addDFAEdge(s, t, ATNSimulator.ERROR);
  33121. }
  33122. // stop when we can't match any more char
  33123. return ATNSimulator.ERROR;
  33124. }
  33125. // Add an edge from s to target DFA found/created for reach
  33126. return this.addDFAEdge(s, t, null, reach);
  33127. };
  33128. LexerATNSimulator.prototype.failOrAccept = function(prevAccept, input, reach, t) {
  33129. if (this.prevAccept.dfaState !== null) {
  33130. var lexerActionExecutor = prevAccept.dfaState.lexerActionExecutor;
  33131. this.accept(input, lexerActionExecutor, this.startIndex,
  33132. prevAccept.index, prevAccept.line, prevAccept.column);
  33133. return prevAccept.dfaState.prediction;
  33134. } else {
  33135. // if no accept and EOF is first char, return EOF
  33136. if (t === Token.EOF && input.index === this.startIndex) {
  33137. return Token.EOF;
  33138. }
  33139. throw new LexerNoViableAltException(this.recog, input, this.startIndex, reach);
  33140. }
  33141. };
  33142. // Given a starting configuration set, figure out all ATN configurations
  33143. // we can reach upon input {@code t}. Parameter {@code reach} is a return
  33144. // parameter.
  33145. LexerATNSimulator.prototype.getReachableConfigSet = function(input, closure,
  33146. reach, t) {
  33147. // this is used to skip processing for configs which have a lower priority
  33148. // than a config that already reached an accept state for the same rule
  33149. var skipAlt = ATN.INVALID_ALT_NUMBER;
  33150. for (var i = 0; i < closure.items.length; i++) {
  33151. var cfg = closure.items[i];
  33152. var currentAltReachedAcceptState = (cfg.alt === skipAlt);
  33153. if (currentAltReachedAcceptState && cfg.passedThroughNonGreedyDecision) {
  33154. continue;
  33155. }
  33156. if (LexerATNSimulator.debug) {
  33157. console.log("testing %s at %s\n", this.getTokenName(t), cfg
  33158. .toString(this.recog, true));
  33159. }
  33160. for (var j = 0; j < cfg.state.transitions.length; j++) {
  33161. var trans = cfg.state.transitions[j]; // for each transition
  33162. var target = this.getReachableTarget(trans, t);
  33163. if (target !== null) {
  33164. var lexerActionExecutor = cfg.lexerActionExecutor;
  33165. if (lexerActionExecutor !== null) {
  33166. lexerActionExecutor = lexerActionExecutor.fixOffsetBeforeMatch(input.index - this.startIndex);
  33167. }
  33168. var treatEofAsEpsilon = (t === Token.EOF);
  33169. var config = new LexerATNConfig({state:target, lexerActionExecutor:lexerActionExecutor}, cfg);
  33170. if (this.closure(input, config, reach,
  33171. currentAltReachedAcceptState, true, treatEofAsEpsilon)) {
  33172. // any remaining configs for this alt have a lower priority
  33173. // than the one that just reached an accept state.
  33174. skipAlt = cfg.alt;
  33175. }
  33176. }
  33177. }
  33178. }
  33179. };
  33180. LexerATNSimulator.prototype.accept = function(input, lexerActionExecutor,
  33181. startIndex, index, line, charPos) {
  33182. if (LexerATNSimulator.debug) {
  33183. console.log("ACTION %s\n", lexerActionExecutor);
  33184. }
  33185. // seek to after last char in token
  33186. input.seek(index);
  33187. this.line = line;
  33188. this.column = charPos;
  33189. if (lexerActionExecutor !== null && this.recog !== null) {
  33190. lexerActionExecutor.execute(this.recog, input, startIndex);
  33191. }
  33192. };
  33193. LexerATNSimulator.prototype.getReachableTarget = function(trans, t) {
  33194. if (trans.matches(t, 0, Lexer.MAX_CHAR_VALUE)) {
  33195. return trans.target;
  33196. } else {
  33197. return null;
  33198. }
  33199. };
  33200. LexerATNSimulator.prototype.computeStartState = function(input, p) {
  33201. var initialContext = PredictionContext.EMPTY;
  33202. var configs = new OrderedATNConfigSet();
  33203. for (var i = 0; i < p.transitions.length; i++) {
  33204. var target = p.transitions[i].target;
  33205. var cfg = new LexerATNConfig({state:target, alt:i+1, context:initialContext}, null);
  33206. this.closure(input, cfg, configs, false, false, false);
  33207. }
  33208. return configs;
  33209. };
  33210. // Since the alternatives within any lexer decision are ordered by
  33211. // preference, this method stops pursuing the closure as soon as an accept
  33212. // state is reached. After the first accept state is reached by depth-first
  33213. // search from {@code config}, all other (potentially reachable) states for
  33214. // this rule would have a lower priority.
  33215. //
  33216. // @return {@code true} if an accept state is reached, otherwise
  33217. // {@code false}.
  33218. LexerATNSimulator.prototype.closure = function(input, config, configs,
  33219. currentAltReachedAcceptState, speculative, treatEofAsEpsilon) {
  33220. var cfg = null;
  33221. if (LexerATNSimulator.debug) {
  33222. console.log("closure(" + config.toString(this.recog, true) + ")");
  33223. }
  33224. if (config.state instanceof RuleStopState) {
  33225. if (LexerATNSimulator.debug) {
  33226. if (this.recog !== null) {
  33227. console.log("closure at %s rule stop %s\n", this.recog.ruleNames[config.state.ruleIndex], config);
  33228. } else {
  33229. console.log("closure at rule stop %s\n", config);
  33230. }
  33231. }
  33232. if (config.context === null || config.context.hasEmptyPath()) {
  33233. if (config.context === null || config.context.isEmpty()) {
  33234. configs.add(config);
  33235. return true;
  33236. } else {
  33237. configs.add(new LexerATNConfig({ state:config.state, context:PredictionContext.EMPTY}, config));
  33238. currentAltReachedAcceptState = true;
  33239. }
  33240. }
  33241. if (config.context !== null && !config.context.isEmpty()) {
  33242. for (var i = 0; i < config.context.length; i++) {
  33243. if (config.context.getReturnState(i) !== PredictionContext.EMPTY_RETURN_STATE) {
  33244. var newContext = config.context.getParent(i); // "pop" return state
  33245. var returnState = this.atn.states[config.context.getReturnState(i)];
  33246. cfg = new LexerATNConfig({ state:returnState, context:newContext }, config);
  33247. currentAltReachedAcceptState = this.closure(input, cfg,
  33248. configs, currentAltReachedAcceptState, speculative,
  33249. treatEofAsEpsilon);
  33250. }
  33251. }
  33252. }
  33253. return currentAltReachedAcceptState;
  33254. }
  33255. // optimization
  33256. if (!config.state.epsilonOnlyTransitions) {
  33257. if (!currentAltReachedAcceptState || !config.passedThroughNonGreedyDecision) {
  33258. configs.add(config);
  33259. }
  33260. }
  33261. for (var j = 0; j < config.state.transitions.length; j++) {
  33262. var trans = config.state.transitions[j];
  33263. cfg = this.getEpsilonTarget(input, config, trans, configs, speculative, treatEofAsEpsilon);
  33264. if (cfg !== null) {
  33265. currentAltReachedAcceptState = this.closure(input, cfg, configs,
  33266. currentAltReachedAcceptState, speculative, treatEofAsEpsilon);
  33267. }
  33268. }
  33269. return currentAltReachedAcceptState;
  33270. };
  33271. // side-effect: can alter configs.hasSemanticContext
  33272. LexerATNSimulator.prototype.getEpsilonTarget = function(input, config, trans,
  33273. configs, speculative, treatEofAsEpsilon) {
  33274. var cfg = null;
  33275. if (trans.serializationType === Transition.RULE) {
  33276. var newContext = SingletonPredictionContext.create(config.context, trans.followState.stateNumber);
  33277. cfg = new LexerATNConfig( { state:trans.target, context:newContext}, config);
  33278. } else if (trans.serializationType === Transition.PRECEDENCE) {
  33279. throw "Precedence predicates are not supported in lexers.";
  33280. } else if (trans.serializationType === Transition.PREDICATE) {
  33281. // Track traversing semantic predicates. If we traverse,
  33282. // we cannot add a DFA state for this "reach" computation
  33283. // because the DFA would not test the predicate again in the
  33284. // future. Rather than creating collections of semantic predicates
  33285. // like v3 and testing them on prediction, v4 will test them on the
  33286. // fly all the time using the ATN not the DFA. This is slower but
  33287. // semantically it's not used that often. One of the key elements to
  33288. // this predicate mechanism is not adding DFA states that see
  33289. // predicates immediately afterwards in the ATN. For example,
  33290. // a : ID {p1}? | ID {p2}? ;
  33291. // should create the start state for rule 'a' (to save start state
  33292. // competition), but should not create target of ID state. The
  33293. // collection of ATN states the following ID references includes
  33294. // states reached by traversing predicates. Since this is when we
  33295. // test them, we cannot cash the DFA state target of ID.
  33296. if (LexerATNSimulator.debug) {
  33297. console.log("EVAL rule " + trans.ruleIndex + ":" + trans.predIndex);
  33298. }
  33299. configs.hasSemanticContext = true;
  33300. if (this.evaluatePredicate(input, trans.ruleIndex, trans.predIndex, speculative)) {
  33301. cfg = new LexerATNConfig({ state:trans.target}, config);
  33302. }
  33303. } else if (trans.serializationType === Transition.ACTION) {
  33304. if (config.context === null || config.context.hasEmptyPath()) {
  33305. // execute actions anywhere in the start rule for a token.
  33306. //
  33307. // TODO: if the entry rule is invoked recursively, some
  33308. // actions may be executed during the recursive call. The
  33309. // problem can appear when hasEmptyPath() is true but
  33310. // isEmpty() is false. In this case, the config needs to be
  33311. // split into two contexts - one with just the empty path
  33312. // and another with everything but the empty path.
  33313. // Unfortunately, the current algorithm does not allow
  33314. // getEpsilonTarget to return two configurations, so
  33315. // additional modifications are needed before we can support
  33316. // the split operation.
  33317. var lexerActionExecutor = LexerActionExecutor.append(config.lexerActionExecutor,
  33318. this.atn.lexerActions[trans.actionIndex]);
  33319. cfg = new LexerATNConfig({ state:trans.target, lexerActionExecutor:lexerActionExecutor }, config);
  33320. } else {
  33321. // ignore actions in referenced rules
  33322. cfg = new LexerATNConfig( { state:trans.target}, config);
  33323. }
  33324. } else if (trans.serializationType === Transition.EPSILON) {
  33325. cfg = new LexerATNConfig({ state:trans.target}, config);
  33326. } else if (trans.serializationType === Transition.ATOM ||
  33327. trans.serializationType === Transition.RANGE ||
  33328. trans.serializationType === Transition.SET) {
  33329. if (treatEofAsEpsilon) {
  33330. if (trans.matches(Token.EOF, 0, Lexer.MAX_CHAR_VALUE)) {
  33331. cfg = new LexerATNConfig( { state:trans.target }, config);
  33332. }
  33333. }
  33334. }
  33335. return cfg;
  33336. };
  33337. // Evaluate a predicate specified in the lexer.
  33338. //
  33339. // <p>If {@code speculative} is {@code true}, this method was called before
  33340. // {@link //consume} for the matched character. This method should call
  33341. // {@link //consume} before evaluating the predicate to ensure position
  33342. // sensitive values, including {@link Lexer//getText}, {@link Lexer//getLine},
  33343. // and {@link Lexer//getcolumn}, properly reflect the current
  33344. // lexer state. This method should restore {@code input} and the simulator
  33345. // to the original state before returning (i.e. undo the actions made by the
  33346. // call to {@link //consume}.</p>
  33347. //
  33348. // @param input The input stream.
  33349. // @param ruleIndex The rule containing the predicate.
  33350. // @param predIndex The index of the predicate within the rule.
  33351. // @param speculative {@code true} if the current index in {@code input} is
  33352. // one character before the predicate's location.
  33353. //
  33354. // @return {@code true} if the specified predicate evaluates to
  33355. // {@code true}.
  33356. // /
  33357. LexerATNSimulator.prototype.evaluatePredicate = function(input, ruleIndex,
  33358. predIndex, speculative) {
  33359. // assume true if no recognizer was provided
  33360. if (this.recog === null) {
  33361. return true;
  33362. }
  33363. if (!speculative) {
  33364. return this.recog.sempred(null, ruleIndex, predIndex);
  33365. }
  33366. var savedcolumn = this.column;
  33367. var savedLine = this.line;
  33368. var index = input.index;
  33369. var marker = input.mark();
  33370. try {
  33371. this.consume(input);
  33372. return this.recog.sempred(null, ruleIndex, predIndex);
  33373. } finally {
  33374. this.column = savedcolumn;
  33375. this.line = savedLine;
  33376. input.seek(index);
  33377. input.release(marker);
  33378. }
  33379. };
  33380. LexerATNSimulator.prototype.captureSimState = function(settings, input, dfaState) {
  33381. settings.index = input.index;
  33382. settings.line = this.line;
  33383. settings.column = this.column;
  33384. settings.dfaState = dfaState;
  33385. };
  33386. LexerATNSimulator.prototype.addDFAEdge = function(from_, tk, to, cfgs) {
  33387. if (to === undefined) {
  33388. to = null;
  33389. }
  33390. if (cfgs === undefined) {
  33391. cfgs = null;
  33392. }
  33393. if (to === null && cfgs !== null) {
  33394. // leading to this call, ATNConfigSet.hasSemanticContext is used as a
  33395. // marker indicating dynamic predicate evaluation makes this edge
  33396. // dependent on the specific input sequence, so the static edge in the
  33397. // DFA should be omitted. The target DFAState is still created since
  33398. // execATN has the ability to resynchronize with the DFA state cache
  33399. // following the predicate evaluation step.
  33400. //
  33401. // TJP notes: next time through the DFA, we see a pred again and eval.
  33402. // If that gets us to a previously created (but dangling) DFA
  33403. // state, we can continue in pure DFA mode from there.
  33404. // /
  33405. var suppressEdge = cfgs.hasSemanticContext;
  33406. cfgs.hasSemanticContext = false;
  33407. to = this.addDFAState(cfgs);
  33408. if (suppressEdge) {
  33409. return to;
  33410. }
  33411. }
  33412. // add the edge
  33413. if (tk < LexerATNSimulator.MIN_DFA_EDGE || tk > LexerATNSimulator.MAX_DFA_EDGE) {
  33414. // Only track edges within the DFA bounds
  33415. return to;
  33416. }
  33417. if (LexerATNSimulator.debug) {
  33418. console.log("EDGE " + from_ + " -> " + to + " upon " + tk);
  33419. }
  33420. if (from_.edges === null) {
  33421. // make room for tokens 1..n and -1 masquerading as index 0
  33422. from_.edges = [];
  33423. }
  33424. from_.edges[tk - LexerATNSimulator.MIN_DFA_EDGE] = to; // connect
  33425. return to;
  33426. };
  33427. // Add a new DFA state if there isn't one with this set of
  33428. // configurations already. This method also detects the first
  33429. // configuration containing an ATN rule stop state. Later, when
  33430. // traversing the DFA, we will know which rule to accept.
  33431. LexerATNSimulator.prototype.addDFAState = function(configs) {
  33432. var proposed = new DFAState(null, configs);
  33433. var firstConfigWithRuleStopState = null;
  33434. for (var i = 0; i < configs.items.length; i++) {
  33435. var cfg = configs.items[i];
  33436. if (cfg.state instanceof RuleStopState) {
  33437. firstConfigWithRuleStopState = cfg;
  33438. break;
  33439. }
  33440. }
  33441. if (firstConfigWithRuleStopState !== null) {
  33442. proposed.isAcceptState = true;
  33443. proposed.lexerActionExecutor = firstConfigWithRuleStopState.lexerActionExecutor;
  33444. proposed.prediction = this.atn.ruleToTokenType[firstConfigWithRuleStopState.state.ruleIndex];
  33445. }
  33446. var dfa = this.decisionToDFA[this.mode];
  33447. var existing = dfa.states.get(proposed);
  33448. if (existing!==null) {
  33449. return existing;
  33450. }
  33451. var newState = proposed;
  33452. newState.stateNumber = dfa.states.length;
  33453. configs.setReadonly(true);
  33454. newState.configs = configs;
  33455. dfa.states.add(newState);
  33456. return newState;
  33457. };
  33458. LexerATNSimulator.prototype.getDFA = function(mode) {
  33459. return this.decisionToDFA[mode];
  33460. };
  33461. // Get the text matched so far for the current token.
  33462. LexerATNSimulator.prototype.getText = function(input) {
  33463. // index is first lookahead char, don't include.
  33464. return input.getText(this.startIndex, input.index - 1);
  33465. };
  33466. LexerATNSimulator.prototype.consume = function(input) {
  33467. var curChar = input.LA(1);
  33468. if (curChar === "\n".charCodeAt(0)) {
  33469. this.line += 1;
  33470. this.column = 0;
  33471. } else {
  33472. this.column += 1;
  33473. }
  33474. input.consume();
  33475. };
  33476. LexerATNSimulator.prototype.getTokenName = function(tt) {
  33477. if (tt === -1) {
  33478. return "EOF";
  33479. } else {
  33480. return "'" + String.fromCharCode(tt) + "'";
  33481. }
  33482. };
  33483. exports.LexerATNSimulator = LexerATNSimulator;
  33484. /***/ }),
  33485. /***/ "./node_modules/antlr4/atn/LexerAction.js":
  33486. /*!************************************************!*\
  33487. !*** ./node_modules/antlr4/atn/LexerAction.js ***!
  33488. \************************************************/
  33489. /*! no static exports found */
  33490. /***/ (function(module, exports) {
  33491. //
  33492. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  33493. * Use of this file is governed by the BSD 3-clause license that
  33494. * can be found in the LICENSE.txt file in the project root.
  33495. */
  33496. //
  33497. function LexerActionType() {
  33498. }
  33499. LexerActionType.CHANNEL = 0; //The type of a {@link LexerChannelAction} action.
  33500. LexerActionType.CUSTOM = 1; //The type of a {@link LexerCustomAction} action.
  33501. LexerActionType.MODE = 2; //The type of a {@link LexerModeAction} action.
  33502. LexerActionType.MORE = 3; //The type of a {@link LexerMoreAction} action.
  33503. LexerActionType.POP_MODE = 4; //The type of a {@link LexerPopModeAction} action.
  33504. LexerActionType.PUSH_MODE = 5; //The type of a {@link LexerPushModeAction} action.
  33505. LexerActionType.SKIP = 6; //The type of a {@link LexerSkipAction} action.
  33506. LexerActionType.TYPE = 7; //The type of a {@link LexerTypeAction} action.
  33507. function LexerAction(action) {
  33508. this.actionType = action;
  33509. this.isPositionDependent = false;
  33510. return this;
  33511. }
  33512. LexerAction.prototype.hashCode = function() {
  33513. var hash = new Hash();
  33514. this.updateHashCode(hash);
  33515. return hash.finish()
  33516. };
  33517. LexerAction.prototype.updateHashCode = function(hash) {
  33518. hash.update(this.actionType);
  33519. };
  33520. LexerAction.prototype.equals = function(other) {
  33521. return this === other;
  33522. };
  33523. //
  33524. // Implements the {@code skip} lexer action by calling {@link Lexer//skip}.
  33525. //
  33526. // <p>The {@code skip} command does not have any parameters, so this action is
  33527. // implemented as a singleton instance exposed by {@link //INSTANCE}.</p>
  33528. function LexerSkipAction() {
  33529. LexerAction.call(this, LexerActionType.SKIP);
  33530. return this;
  33531. }
  33532. LexerSkipAction.prototype = Object.create(LexerAction.prototype);
  33533. LexerSkipAction.prototype.constructor = LexerSkipAction;
  33534. // Provides a singleton instance of this parameterless lexer action.
  33535. LexerSkipAction.INSTANCE = new LexerSkipAction();
  33536. LexerSkipAction.prototype.execute = function(lexer) {
  33537. lexer.skip();
  33538. };
  33539. LexerSkipAction.prototype.toString = function() {
  33540. return "skip";
  33541. };
  33542. // Implements the {@code type} lexer action by calling {@link Lexer//setType}
  33543. // with the assigned type.
  33544. function LexerTypeAction(type) {
  33545. LexerAction.call(this, LexerActionType.TYPE);
  33546. this.type = type;
  33547. return this;
  33548. }
  33549. LexerTypeAction.prototype = Object.create(LexerAction.prototype);
  33550. LexerTypeAction.prototype.constructor = LexerTypeAction;
  33551. LexerTypeAction.prototype.execute = function(lexer) {
  33552. lexer.type = this.type;
  33553. };
  33554. LexerTypeAction.prototype.updateHashCode = function(hash) {
  33555. hash.update(this.actionType, this.type);
  33556. };
  33557. LexerTypeAction.prototype.equals = function(other) {
  33558. if(this === other) {
  33559. return true;
  33560. } else if (! (other instanceof LexerTypeAction)) {
  33561. return false;
  33562. } else {
  33563. return this.type === other.type;
  33564. }
  33565. };
  33566. LexerTypeAction.prototype.toString = function() {
  33567. return "type(" + this.type + ")";
  33568. };
  33569. // Implements the {@code pushMode} lexer action by calling
  33570. // {@link Lexer//pushMode} with the assigned mode.
  33571. function LexerPushModeAction(mode) {
  33572. LexerAction.call(this, LexerActionType.PUSH_MODE);
  33573. this.mode = mode;
  33574. return this;
  33575. }
  33576. LexerPushModeAction.prototype = Object.create(LexerAction.prototype);
  33577. LexerPushModeAction.prototype.constructor = LexerPushModeAction;
  33578. // <p>This action is implemented by calling {@link Lexer//pushMode} with the
  33579. // value provided by {@link //getMode}.</p>
  33580. LexerPushModeAction.prototype.execute = function(lexer) {
  33581. lexer.pushMode(this.mode);
  33582. };
  33583. LexerPushModeAction.prototype.updateHashCode = function(hash) {
  33584. hash.update(this.actionType, this.mode);
  33585. };
  33586. LexerPushModeAction.prototype.equals = function(other) {
  33587. if (this === other) {
  33588. return true;
  33589. } else if (! (other instanceof LexerPushModeAction)) {
  33590. return false;
  33591. } else {
  33592. return this.mode === other.mode;
  33593. }
  33594. };
  33595. LexerPushModeAction.prototype.toString = function() {
  33596. return "pushMode(" + this.mode + ")";
  33597. };
  33598. // Implements the {@code popMode} lexer action by calling {@link Lexer//popMode}.
  33599. //
  33600. // <p>The {@code popMode} command does not have any parameters, so this action is
  33601. // implemented as a singleton instance exposed by {@link //INSTANCE}.</p>
  33602. function LexerPopModeAction() {
  33603. LexerAction.call(this,LexerActionType.POP_MODE);
  33604. return this;
  33605. }
  33606. LexerPopModeAction.prototype = Object.create(LexerAction.prototype);
  33607. LexerPopModeAction.prototype.constructor = LexerPopModeAction;
  33608. LexerPopModeAction.INSTANCE = new LexerPopModeAction();
  33609. // <p>This action is implemented by calling {@link Lexer//popMode}.</p>
  33610. LexerPopModeAction.prototype.execute = function(lexer) {
  33611. lexer.popMode();
  33612. };
  33613. LexerPopModeAction.prototype.toString = function() {
  33614. return "popMode";
  33615. };
  33616. // Implements the {@code more} lexer action by calling {@link Lexer//more}.
  33617. //
  33618. // <p>The {@code more} command does not have any parameters, so this action is
  33619. // implemented as a singleton instance exposed by {@link //INSTANCE}.</p>
  33620. function LexerMoreAction() {
  33621. LexerAction.call(this, LexerActionType.MORE);
  33622. return this;
  33623. }
  33624. LexerMoreAction.prototype = Object.create(LexerAction.prototype);
  33625. LexerMoreAction.prototype.constructor = LexerMoreAction;
  33626. LexerMoreAction.INSTANCE = new LexerMoreAction();
  33627. // <p>This action is implemented by calling {@link Lexer//popMode}.</p>
  33628. LexerMoreAction.prototype.execute = function(lexer) {
  33629. lexer.more();
  33630. };
  33631. LexerMoreAction.prototype.toString = function() {
  33632. return "more";
  33633. };
  33634. // Implements the {@code mode} lexer action by calling {@link Lexer//mode} with
  33635. // the assigned mode.
  33636. function LexerModeAction(mode) {
  33637. LexerAction.call(this, LexerActionType.MODE);
  33638. this.mode = mode;
  33639. return this;
  33640. }
  33641. LexerModeAction.prototype = Object.create(LexerAction.prototype);
  33642. LexerModeAction.prototype.constructor = LexerModeAction;
  33643. // <p>This action is implemented by calling {@link Lexer//mode} with the
  33644. // value provided by {@link //getMode}.</p>
  33645. LexerModeAction.prototype.execute = function(lexer) {
  33646. lexer.mode(this.mode);
  33647. };
  33648. LexerModeAction.prototype.updateHashCode = function(hash) {
  33649. hash.update(this.actionType, this.mode);
  33650. };
  33651. LexerModeAction.prototype.equals = function(other) {
  33652. if (this === other) {
  33653. return true;
  33654. } else if (! (other instanceof LexerModeAction)) {
  33655. return false;
  33656. } else {
  33657. return this.mode === other.mode;
  33658. }
  33659. };
  33660. LexerModeAction.prototype.toString = function() {
  33661. return "mode(" + this.mode + ")";
  33662. };
  33663. // Executes a custom lexer action by calling {@link Recognizer//action} with the
  33664. // rule and action indexes assigned to the custom action. The implementation of
  33665. // a custom action is added to the generated code for the lexer in an override
  33666. // of {@link Recognizer//action} when the grammar is compiled.
  33667. //
  33668. // <p>This class may represent embedded actions created with the <code>{...}</code>
  33669. // syntax in ANTLR 4, as well as actions created for lexer commands where the
  33670. // command argument could not be evaluated when the grammar was compiled.</p>
  33671. // Constructs a custom lexer action with the specified rule and action
  33672. // indexes.
  33673. //
  33674. // @param ruleIndex The rule index to use for calls to
  33675. // {@link Recognizer//action}.
  33676. // @param actionIndex The action index to use for calls to
  33677. // {@link Recognizer//action}.
  33678. function LexerCustomAction(ruleIndex, actionIndex) {
  33679. LexerAction.call(this, LexerActionType.CUSTOM);
  33680. this.ruleIndex = ruleIndex;
  33681. this.actionIndex = actionIndex;
  33682. this.isPositionDependent = true;
  33683. return this;
  33684. }
  33685. LexerCustomAction.prototype = Object.create(LexerAction.prototype);
  33686. LexerCustomAction.prototype.constructor = LexerCustomAction;
  33687. // <p>Custom actions are implemented by calling {@link Lexer//action} with the
  33688. // appropriate rule and action indexes.</p>
  33689. LexerCustomAction.prototype.execute = function(lexer) {
  33690. lexer.action(null, this.ruleIndex, this.actionIndex);
  33691. };
  33692. LexerCustomAction.prototype.updateHashCode = function(hash) {
  33693. hash.update(this.actionType, this.ruleIndex, this.actionIndex);
  33694. };
  33695. LexerCustomAction.prototype.equals = function(other) {
  33696. if (this === other) {
  33697. return true;
  33698. } else if (! (other instanceof LexerCustomAction)) {
  33699. return false;
  33700. } else {
  33701. return this.ruleIndex === other.ruleIndex && this.actionIndex === other.actionIndex;
  33702. }
  33703. };
  33704. // Implements the {@code channel} lexer action by calling
  33705. // {@link Lexer//setChannel} with the assigned channel.
  33706. // Constructs a new {@code channel} action with the specified channel value.
  33707. // @param channel The channel value to pass to {@link Lexer//setChannel}.
  33708. function LexerChannelAction(channel) {
  33709. LexerAction.call(this, LexerActionType.CHANNEL);
  33710. this.channel = channel;
  33711. return this;
  33712. }
  33713. LexerChannelAction.prototype = Object.create(LexerAction.prototype);
  33714. LexerChannelAction.prototype.constructor = LexerChannelAction;
  33715. // <p>This action is implemented by calling {@link Lexer//setChannel} with the
  33716. // value provided by {@link //getChannel}.</p>
  33717. LexerChannelAction.prototype.execute = function(lexer) {
  33718. lexer._channel = this.channel;
  33719. };
  33720. LexerChannelAction.prototype.updateHashCode = function(hash) {
  33721. hash.update(this.actionType, this.channel);
  33722. };
  33723. LexerChannelAction.prototype.equals = function(other) {
  33724. if (this === other) {
  33725. return true;
  33726. } else if (! (other instanceof LexerChannelAction)) {
  33727. return false;
  33728. } else {
  33729. return this.channel === other.channel;
  33730. }
  33731. };
  33732. LexerChannelAction.prototype.toString = function() {
  33733. return "channel(" + this.channel + ")";
  33734. };
  33735. // This implementation of {@link LexerAction} is used for tracking input offsets
  33736. // for position-dependent actions within a {@link LexerActionExecutor}.
  33737. //
  33738. // <p>This action is not serialized as part of the ATN, and is only required for
  33739. // position-dependent lexer actions which appear at a location other than the
  33740. // end of a rule. For more information about DFA optimizations employed for
  33741. // lexer actions, see {@link LexerActionExecutor//append} and
  33742. // {@link LexerActionExecutor//fixOffsetBeforeMatch}.</p>
  33743. // Constructs a new indexed custom action by associating a character offset
  33744. // with a {@link LexerAction}.
  33745. //
  33746. // <p>Note: This class is only required for lexer actions for which
  33747. // {@link LexerAction//isPositionDependent} returns {@code true}.</p>
  33748. //
  33749. // @param offset The offset into the input {@link CharStream}, relative to
  33750. // the token start index, at which the specified lexer action should be
  33751. // executed.
  33752. // @param action The lexer action to execute at a particular offset in the
  33753. // input {@link CharStream}.
  33754. function LexerIndexedCustomAction(offset, action) {
  33755. LexerAction.call(this, action.actionType);
  33756. this.offset = offset;
  33757. this.action = action;
  33758. this.isPositionDependent = true;
  33759. return this;
  33760. }
  33761. LexerIndexedCustomAction.prototype = Object.create(LexerAction.prototype);
  33762. LexerIndexedCustomAction.prototype.constructor = LexerIndexedCustomAction;
  33763. // <p>This method calls {@link //execute} on the result of {@link //getAction}
  33764. // using the provided {@code lexer}.</p>
  33765. LexerIndexedCustomAction.prototype.execute = function(lexer) {
  33766. // assume the input stream position was properly set by the calling code
  33767. this.action.execute(lexer);
  33768. };
  33769. LexerIndexedCustomAction.prototype.updateHashCode = function(hash) {
  33770. hash.update(this.actionType, this.offset, this.action);
  33771. };
  33772. LexerIndexedCustomAction.prototype.equals = function(other) {
  33773. if (this === other) {
  33774. return true;
  33775. } else if (! (other instanceof LexerIndexedCustomAction)) {
  33776. return false;
  33777. } else {
  33778. return this.offset === other.offset && this.action === other.action;
  33779. }
  33780. };
  33781. exports.LexerActionType = LexerActionType;
  33782. exports.LexerSkipAction = LexerSkipAction;
  33783. exports.LexerChannelAction = LexerChannelAction;
  33784. exports.LexerCustomAction = LexerCustomAction;
  33785. exports.LexerIndexedCustomAction = LexerIndexedCustomAction;
  33786. exports.LexerMoreAction = LexerMoreAction;
  33787. exports.LexerTypeAction = LexerTypeAction;
  33788. exports.LexerPushModeAction = LexerPushModeAction;
  33789. exports.LexerPopModeAction = LexerPopModeAction;
  33790. exports.LexerModeAction = LexerModeAction;
  33791. /***/ }),
  33792. /***/ "./node_modules/antlr4/atn/LexerActionExecutor.js":
  33793. /*!********************************************************!*\
  33794. !*** ./node_modules/antlr4/atn/LexerActionExecutor.js ***!
  33795. \********************************************************/
  33796. /*! no static exports found */
  33797. /***/ (function(module, exports, __webpack_require__) {
  33798. //
  33799. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  33800. * Use of this file is governed by the BSD 3-clause license that
  33801. * can be found in the LICENSE.txt file in the project root.
  33802. */
  33803. ///
  33804. // Represents an executor for a sequence of lexer actions which traversed during
  33805. // the matching operation of a lexer rule (token).
  33806. //
  33807. // <p>The executor tracks position information for position-dependent lexer actions
  33808. // efficiently, ensuring that actions appearing only at the end of the rule do
  33809. // not cause bloating of the {@link DFA} created for the lexer.</p>
  33810. var hashStuff = __webpack_require__(/*! ../Utils */ "./node_modules/antlr4/Utils.js").hashStuff;
  33811. var LexerIndexedCustomAction = __webpack_require__(/*! ./LexerAction */ "./node_modules/antlr4/atn/LexerAction.js").LexerIndexedCustomAction;
  33812. function LexerActionExecutor(lexerActions) {
  33813. this.lexerActions = lexerActions === null ? [] : lexerActions;
  33814. // Caches the result of {@link //hashCode} since the hash code is an element
  33815. // of the performance-critical {@link LexerATNConfig//hashCode} operation.
  33816. this.cachedHashCode = hashStuff(lexerActions); // "".join([str(la) for la in
  33817. // lexerActions]))
  33818. return this;
  33819. }
  33820. // Creates a {@link LexerActionExecutor} which executes the actions for
  33821. // the input {@code lexerActionExecutor} followed by a specified
  33822. // {@code lexerAction}.
  33823. //
  33824. // @param lexerActionExecutor The executor for actions already traversed by
  33825. // the lexer while matching a token within a particular
  33826. // {@link LexerATNConfig}. If this is {@code null}, the method behaves as
  33827. // though it were an empty executor.
  33828. // @param lexerAction The lexer action to execute after the actions
  33829. // specified in {@code lexerActionExecutor}.
  33830. //
  33831. // @return A {@link LexerActionExecutor} for executing the combine actions
  33832. // of {@code lexerActionExecutor} and {@code lexerAction}.
  33833. LexerActionExecutor.append = function(lexerActionExecutor, lexerAction) {
  33834. if (lexerActionExecutor === null) {
  33835. return new LexerActionExecutor([ lexerAction ]);
  33836. }
  33837. var lexerActions = lexerActionExecutor.lexerActions.concat([ lexerAction ]);
  33838. return new LexerActionExecutor(lexerActions);
  33839. };
  33840. // Creates a {@link LexerActionExecutor} which encodes the current offset
  33841. // for position-dependent lexer actions.
  33842. //
  33843. // <p>Normally, when the executor encounters lexer actions where
  33844. // {@link LexerAction//isPositionDependent} returns {@code true}, it calls
  33845. // {@link IntStream//seek} on the input {@link CharStream} to set the input
  33846. // position to the <em>end</em> of the current token. This behavior provides
  33847. // for efficient DFA representation of lexer actions which appear at the end
  33848. // of a lexer rule, even when the lexer rule matches a variable number of
  33849. // characters.</p>
  33850. //
  33851. // <p>Prior to traversing a match transition in the ATN, the current offset
  33852. // from the token start index is assigned to all position-dependent lexer
  33853. // actions which have not already been assigned a fixed offset. By storing
  33854. // the offsets relative to the token start index, the DFA representation of
  33855. // lexer actions which appear in the middle of tokens remains efficient due
  33856. // to sharing among tokens of the same length, regardless of their absolute
  33857. // position in the input stream.</p>
  33858. //
  33859. // <p>If the current executor already has offsets assigned to all
  33860. // position-dependent lexer actions, the method returns {@code this}.</p>
  33861. //
  33862. // @param offset The current offset to assign to all position-dependent
  33863. // lexer actions which do not already have offsets assigned.
  33864. //
  33865. // @return A {@link LexerActionExecutor} which stores input stream offsets
  33866. // for all position-dependent lexer actions.
  33867. // /
  33868. LexerActionExecutor.prototype.fixOffsetBeforeMatch = function(offset) {
  33869. var updatedLexerActions = null;
  33870. for (var i = 0; i < this.lexerActions.length; i++) {
  33871. if (this.lexerActions[i].isPositionDependent &&
  33872. !(this.lexerActions[i] instanceof LexerIndexedCustomAction)) {
  33873. if (updatedLexerActions === null) {
  33874. updatedLexerActions = this.lexerActions.concat([]);
  33875. }
  33876. updatedLexerActions[i] = new LexerIndexedCustomAction(offset,
  33877. this.lexerActions[i]);
  33878. }
  33879. }
  33880. if (updatedLexerActions === null) {
  33881. return this;
  33882. } else {
  33883. return new LexerActionExecutor(updatedLexerActions);
  33884. }
  33885. };
  33886. // Execute the actions encapsulated by this executor within the context of a
  33887. // particular {@link Lexer}.
  33888. //
  33889. // <p>This method calls {@link IntStream//seek} to set the position of the
  33890. // {@code input} {@link CharStream} prior to calling
  33891. // {@link LexerAction//execute} on a position-dependent action. Before the
  33892. // method returns, the input position will be restored to the same position
  33893. // it was in when the method was invoked.</p>
  33894. //
  33895. // @param lexer The lexer instance.
  33896. // @param input The input stream which is the source for the current token.
  33897. // When this method is called, the current {@link IntStream//index} for
  33898. // {@code input} should be the start of the following token, i.e. 1
  33899. // character past the end of the current token.
  33900. // @param startIndex The token start index. This value may be passed to
  33901. // {@link IntStream//seek} to set the {@code input} position to the beginning
  33902. // of the token.
  33903. // /
  33904. LexerActionExecutor.prototype.execute = function(lexer, input, startIndex) {
  33905. var requiresSeek = false;
  33906. var stopIndex = input.index;
  33907. try {
  33908. for (var i = 0; i < this.lexerActions.length; i++) {
  33909. var lexerAction = this.lexerActions[i];
  33910. if (lexerAction instanceof LexerIndexedCustomAction) {
  33911. var offset = lexerAction.offset;
  33912. input.seek(startIndex + offset);
  33913. lexerAction = lexerAction.action;
  33914. requiresSeek = (startIndex + offset) !== stopIndex;
  33915. } else if (lexerAction.isPositionDependent) {
  33916. input.seek(stopIndex);
  33917. requiresSeek = false;
  33918. }
  33919. lexerAction.execute(lexer);
  33920. }
  33921. } finally {
  33922. if (requiresSeek) {
  33923. input.seek(stopIndex);
  33924. }
  33925. }
  33926. };
  33927. LexerActionExecutor.prototype.hashCode = function() {
  33928. return this.cachedHashCode;
  33929. };
  33930. LexerActionExecutor.prototype.updateHashCode = function(hash) {
  33931. hash.update(this.cachedHashCode);
  33932. };
  33933. LexerActionExecutor.prototype.equals = function(other) {
  33934. if (this === other) {
  33935. return true;
  33936. } else if (!(other instanceof LexerActionExecutor)) {
  33937. return false;
  33938. } else if (this.cachedHashCode != other.cachedHashCode) {
  33939. return false;
  33940. } else if (this.lexerActions.length != other.lexerActions.length) {
  33941. return false;
  33942. } else {
  33943. var numActions = this.lexerActions.length
  33944. for (var idx = 0; idx < numActions; ++idx) {
  33945. if (!this.lexerActions[idx].equals(other.lexerActions[idx])) {
  33946. return false;
  33947. }
  33948. }
  33949. return true;
  33950. }
  33951. };
  33952. exports.LexerActionExecutor = LexerActionExecutor;
  33953. /***/ }),
  33954. /***/ "./node_modules/antlr4/atn/ParserATNSimulator.js":
  33955. /*!*******************************************************!*\
  33956. !*** ./node_modules/antlr4/atn/ParserATNSimulator.js ***!
  33957. \*******************************************************/
  33958. /*! no static exports found */
  33959. /***/ (function(module, exports, __webpack_require__) {
  33960. //
  33961. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  33962. * Use of this file is governed by the BSD 3-clause license that
  33963. * can be found in the LICENSE.txt file in the project root.
  33964. */
  33965. //
  33966. //
  33967. // The embodiment of the adaptive LL(*), ALL(*), parsing strategy.
  33968. //
  33969. // <p>
  33970. // The basic complexity of the adaptive strategy makes it harder to understand.
  33971. // We begin with ATN simulation to build paths in a DFA. Subsequent prediction
  33972. // requests go through the DFA first. If they reach a state without an edge for
  33973. // the current symbol, the algorithm fails over to the ATN simulation to
  33974. // complete the DFA path for the current input (until it finds a conflict state
  33975. // or uniquely predicting state).</p>
  33976. //
  33977. // <p>
  33978. // All of that is done without using the outer context because we want to create
  33979. // a DFA that is not dependent upon the rule invocation stack when we do a
  33980. // prediction. One DFA works in all contexts. We avoid using context not
  33981. // necessarily because it's slower, although it can be, but because of the DFA
  33982. // caching problem. The closure routine only considers the rule invocation stack
  33983. // created during prediction beginning in the decision rule. For example, if
  33984. // prediction occurs without invoking another rule's ATN, there are no context
  33985. // stacks in the configurations. When lack of context leads to a conflict, we
  33986. // don't know if it's an ambiguity or a weakness in the strong LL(*) parsing
  33987. // strategy (versus full LL(*)).</p>
  33988. //
  33989. // <p>
  33990. // When SLL yields a configuration set with conflict, we rewind the input and
  33991. // retry the ATN simulation, this time using full outer context without adding
  33992. // to the DFA. Configuration context stacks will be the full invocation stacks
  33993. // from the start rule. If we get a conflict using full context, then we can
  33994. // definitively say we have a true ambiguity for that input sequence. If we
  33995. // don't get a conflict, it implies that the decision is sensitive to the outer
  33996. // context. (It is not context-sensitive in the sense of context-sensitive
  33997. // grammars.)</p>
  33998. //
  33999. // <p>
  34000. // The next time we reach this DFA state with an SLL conflict, through DFA
  34001. // simulation, we will again retry the ATN simulation using full context mode.
  34002. // This is slow because we can't save the results and have to "interpret" the
  34003. // ATN each time we get that input.</p>
  34004. //
  34005. // <p>
  34006. // <strong>CACHING FULL CONTEXT PREDICTIONS</strong></p>
  34007. //
  34008. // <p>
  34009. // We could cache results from full context to predicted alternative easily and
  34010. // that saves a lot of time but doesn't work in presence of predicates. The set
  34011. // of visible predicates from the ATN start state changes depending on the
  34012. // context, because closure can fall off the end of a rule. I tried to cache
  34013. // tuples (stack context, semantic context, predicted alt) but it was slower
  34014. // than interpreting and much more complicated. Also required a huge amount of
  34015. // memory. The goal is not to create the world's fastest parser anyway. I'd like
  34016. // to keep this algorithm simple. By launching multiple threads, we can improve
  34017. // the speed of parsing across a large number of files.</p>
  34018. //
  34019. // <p>
  34020. // There is no strict ordering between the amount of input used by SLL vs LL,
  34021. // which makes it really hard to build a cache for full context. Let's say that
  34022. // we have input A B C that leads to an SLL conflict with full context X. That
  34023. // implies that using X we might only use A B but we could also use A B C D to
  34024. // resolve conflict. Input A B C D could predict alternative 1 in one position
  34025. // in the input and A B C E could predict alternative 2 in another position in
  34026. // input. The conflicting SLL configurations could still be non-unique in the
  34027. // full context prediction, which would lead us to requiring more input than the
  34028. // original A B C. To make a prediction cache work, we have to track the exact
  34029. // input used during the previous prediction. That amounts to a cache that maps
  34030. // X to a specific DFA for that context.</p>
  34031. //
  34032. // <p>
  34033. // Something should be done for left-recursive expression predictions. They are
  34034. // likely LL(1) + pred eval. Easier to do the whole SLL unless error and retry
  34035. // with full LL thing Sam does.</p>
  34036. //
  34037. // <p>
  34038. // <strong>AVOIDING FULL CONTEXT PREDICTION</strong></p>
  34039. //
  34040. // <p>
  34041. // We avoid doing full context retry when the outer context is empty, we did not
  34042. // dip into the outer context by falling off the end of the decision state rule,
  34043. // or when we force SLL mode.</p>
  34044. //
  34045. // <p>
  34046. // As an example of the not dip into outer context case, consider as super
  34047. // constructor calls versus function calls. One grammar might look like
  34048. // this:</p>
  34049. //
  34050. // <pre>
  34051. // ctorBody
  34052. // : '{' superCall? stat* '}'
  34053. // ;
  34054. // </pre>
  34055. //
  34056. // <p>
  34057. // Or, you might see something like</p>
  34058. //
  34059. // <pre>
  34060. // stat
  34061. // : superCall ';'
  34062. // | expression ';'
  34063. // | ...
  34064. // ;
  34065. // </pre>
  34066. //
  34067. // <p>
  34068. // In both cases I believe that no closure operations will dip into the outer
  34069. // context. In the first case ctorBody in the worst case will stop at the '}'.
  34070. // In the 2nd case it should stop at the ';'. Both cases should stay within the
  34071. // entry rule and not dip into the outer context.</p>
  34072. //
  34073. // <p>
  34074. // <strong>PREDICATES</strong></p>
  34075. //
  34076. // <p>
  34077. // Predicates are always evaluated if present in either SLL or LL both. SLL and
  34078. // LL simulation deals with predicates differently. SLL collects predicates as
  34079. // it performs closure operations like ANTLR v3 did. It delays predicate
  34080. // evaluation until it reaches and accept state. This allows us to cache the SLL
  34081. // ATN simulation whereas, if we had evaluated predicates on-the-fly during
  34082. // closure, the DFA state configuration sets would be different and we couldn't
  34083. // build up a suitable DFA.</p>
  34084. //
  34085. // <p>
  34086. // When building a DFA accept state during ATN simulation, we evaluate any
  34087. // predicates and return the sole semantically valid alternative. If there is
  34088. // more than 1 alternative, we report an ambiguity. If there are 0 alternatives,
  34089. // we throw an exception. Alternatives without predicates act like they have
  34090. // true predicates. The simple way to think about it is to strip away all
  34091. // alternatives with false predicates and choose the minimum alternative that
  34092. // remains.</p>
  34093. //
  34094. // <p>
  34095. // When we start in the DFA and reach an accept state that's predicated, we test
  34096. // those and return the minimum semantically viable alternative. If no
  34097. // alternatives are viable, we throw an exception.</p>
  34098. //
  34099. // <p>
  34100. // During full LL ATN simulation, closure always evaluates predicates and
  34101. // on-the-fly. This is crucial to reducing the configuration set size during
  34102. // closure. It hits a landmine when parsing with the Java grammar, for example,
  34103. // without this on-the-fly evaluation.</p>
  34104. //
  34105. // <p>
  34106. // <strong>SHARING DFA</strong></p>
  34107. //
  34108. // <p>
  34109. // All instances of the same parser share the same decision DFAs through a
  34110. // static field. Each instance gets its own ATN simulator but they share the
  34111. // same {@link //decisionToDFA} field. They also share a
  34112. // {@link PredictionContextCache} object that makes sure that all
  34113. // {@link PredictionContext} objects are shared among the DFA states. This makes
  34114. // a big size difference.</p>
  34115. //
  34116. // <p>
  34117. // <strong>THREAD SAFETY</strong></p>
  34118. //
  34119. // <p>
  34120. // The {@link ParserATNSimulator} locks on the {@link //decisionToDFA} field when
  34121. // it adds a new DFA object to that array. {@link //addDFAEdge}
  34122. // locks on the DFA for the current decision when setting the
  34123. // {@link DFAState//edges} field. {@link //addDFAState} locks on
  34124. // the DFA for the current decision when looking up a DFA state to see if it
  34125. // already exists. We must make sure that all requests to add DFA states that
  34126. // are equivalent result in the same shared DFA object. This is because lots of
  34127. // threads will be trying to update the DFA at once. The
  34128. // {@link //addDFAState} method also locks inside the DFA lock
  34129. // but this time on the shared context cache when it rebuilds the
  34130. // configurations' {@link PredictionContext} objects using cached
  34131. // subgraphs/nodes. No other locking occurs, even during DFA simulation. This is
  34132. // safe as long as we can guarantee that all threads referencing
  34133. // {@code s.edge[t]} get the same physical target {@link DFAState}, or
  34134. // {@code null}. Once into the DFA, the DFA simulation does not reference the
  34135. // {@link DFA//states} map. It follows the {@link DFAState//edges} field to new
  34136. // targets. The DFA simulator will either find {@link DFAState//edges} to be
  34137. // {@code null}, to be non-{@code null} and {@code dfa.edges[t]} null, or
  34138. // {@code dfa.edges[t]} to be non-null. The
  34139. // {@link //addDFAEdge} method could be racing to set the field
  34140. // but in either case the DFA simulator works; if {@code null}, and requests ATN
  34141. // simulation. It could also race trying to get {@code dfa.edges[t]}, but either
  34142. // way it will work because it's not doing a test and set operation.</p>
  34143. //
  34144. // <p>
  34145. // <strong>Starting with SLL then failing to combined SLL/LL (Two-Stage
  34146. // Parsing)</strong></p>
  34147. //
  34148. // <p>
  34149. // Sam pointed out that if SLL does not give a syntax error, then there is no
  34150. // point in doing full LL, which is slower. We only have to try LL if we get a
  34151. // syntax error. For maximum speed, Sam starts the parser set to pure SLL
  34152. // mode with the {@link BailErrorStrategy}:</p>
  34153. //
  34154. // <pre>
  34155. // parser.{@link Parser//getInterpreter() getInterpreter()}.{@link //setPredictionMode setPredictionMode}{@code (}{@link PredictionMode//SLL}{@code )};
  34156. // parser.{@link Parser//setErrorHandler setErrorHandler}(new {@link BailErrorStrategy}());
  34157. // </pre>
  34158. //
  34159. // <p>
  34160. // If it does not get a syntax error, then we're done. If it does get a syntax
  34161. // error, we need to retry with the combined SLL/LL strategy.</p>
  34162. //
  34163. // <p>
  34164. // The reason this works is as follows. If there are no SLL conflicts, then the
  34165. // grammar is SLL (at least for that input set). If there is an SLL conflict,
  34166. // the full LL analysis must yield a set of viable alternatives which is a
  34167. // subset of the alternatives reported by SLL. If the LL set is a singleton,
  34168. // then the grammar is LL but not SLL. If the LL set is the same size as the SLL
  34169. // set, the decision is SLL. If the LL set has size &gt; 1, then that decision
  34170. // is truly ambiguous on the current input. If the LL set is smaller, then the
  34171. // SLL conflict resolution might choose an alternative that the full LL would
  34172. // rule out as a possibility based upon better context information. If that's
  34173. // the case, then the SLL parse will definitely get an error because the full LL
  34174. // analysis says it's not viable. If SLL conflict resolution chooses an
  34175. // alternative within the LL set, them both SLL and LL would choose the same
  34176. // alternative because they both choose the minimum of multiple conflicting
  34177. // alternatives.</p>
  34178. //
  34179. // <p>
  34180. // Let's say we have a set of SLL conflicting alternatives {@code {1, 2, 3}} and
  34181. // a smaller LL set called <em>s</em>. If <em>s</em> is {@code {2, 3}}, then SLL
  34182. // parsing will get an error because SLL will pursue alternative 1. If
  34183. // <em>s</em> is {@code {1, 2}} or {@code {1, 3}} then both SLL and LL will
  34184. // choose the same alternative because alternative one is the minimum of either
  34185. // set. If <em>s</em> is {@code {2}} or {@code {3}} then SLL will get a syntax
  34186. // error. If <em>s</em> is {@code {1}} then SLL will succeed.</p>
  34187. //
  34188. // <p>
  34189. // Of course, if the input is invalid, then we will get an error for sure in
  34190. // both SLL and LL parsing. Erroneous input will therefore require 2 passes over
  34191. // the input.</p>
  34192. //
  34193. var Utils = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js");
  34194. var Set = Utils.Set;
  34195. var BitSet = Utils.BitSet;
  34196. var DoubleDict = Utils.DoubleDict;
  34197. var ATN = __webpack_require__(/*! ./ATN */ "./node_modules/antlr4/atn/ATN.js").ATN;
  34198. var ATNState = __webpack_require__(/*! ./ATNState */ "./node_modules/antlr4/atn/ATNState.js").ATNState;
  34199. var ATNConfig = __webpack_require__(/*! ./ATNConfig */ "./node_modules/antlr4/atn/ATNConfig.js").ATNConfig;
  34200. var ATNConfigSet = __webpack_require__(/*! ./ATNConfigSet */ "./node_modules/antlr4/atn/ATNConfigSet.js").ATNConfigSet;
  34201. var Token = __webpack_require__(/*! ./../Token */ "./node_modules/antlr4/Token.js").Token;
  34202. var DFAState = __webpack_require__(/*! ./../dfa/DFAState */ "./node_modules/antlr4/dfa/DFAState.js").DFAState;
  34203. var PredPrediction = __webpack_require__(/*! ./../dfa/DFAState */ "./node_modules/antlr4/dfa/DFAState.js").PredPrediction;
  34204. var ATNSimulator = __webpack_require__(/*! ./ATNSimulator */ "./node_modules/antlr4/atn/ATNSimulator.js").ATNSimulator;
  34205. var PredictionMode = __webpack_require__(/*! ./PredictionMode */ "./node_modules/antlr4/atn/PredictionMode.js").PredictionMode;
  34206. var RuleContext = __webpack_require__(/*! ./../RuleContext */ "./node_modules/antlr4/RuleContext.js").RuleContext;
  34207. var ParserRuleContext = __webpack_require__(/*! ./../ParserRuleContext */ "./node_modules/antlr4/ParserRuleContext.js").ParserRuleContext;
  34208. var SemanticContext = __webpack_require__(/*! ./SemanticContext */ "./node_modules/antlr4/atn/SemanticContext.js").SemanticContext;
  34209. var StarLoopEntryState = __webpack_require__(/*! ./ATNState */ "./node_modules/antlr4/atn/ATNState.js").StarLoopEntryState;
  34210. var RuleStopState = __webpack_require__(/*! ./ATNState */ "./node_modules/antlr4/atn/ATNState.js").RuleStopState;
  34211. var PredictionContext = __webpack_require__(/*! ./../PredictionContext */ "./node_modules/antlr4/PredictionContext.js").PredictionContext;
  34212. var Interval = __webpack_require__(/*! ./../IntervalSet */ "./node_modules/antlr4/IntervalSet.js").Interval;
  34213. var Transitions = __webpack_require__(/*! ./Transition */ "./node_modules/antlr4/atn/Transition.js");
  34214. var Transition = Transitions.Transition;
  34215. var SetTransition = Transitions.SetTransition;
  34216. var NotSetTransition = Transitions.NotSetTransition;
  34217. var RuleTransition = Transitions.RuleTransition;
  34218. var ActionTransition = Transitions.ActionTransition;
  34219. var NoViableAltException = __webpack_require__(/*! ./../error/Errors */ "./node_modules/antlr4/error/Errors.js").NoViableAltException;
  34220. var SingletonPredictionContext = __webpack_require__(/*! ./../PredictionContext */ "./node_modules/antlr4/PredictionContext.js").SingletonPredictionContext;
  34221. var predictionContextFromRuleContext = __webpack_require__(/*! ./../PredictionContext */ "./node_modules/antlr4/PredictionContext.js").predictionContextFromRuleContext;
  34222. function ParserATNSimulator(parser, atn, decisionToDFA, sharedContextCache) {
  34223. ATNSimulator.call(this, atn, sharedContextCache);
  34224. this.parser = parser;
  34225. this.decisionToDFA = decisionToDFA;
  34226. // SLL, LL, or LL + exact ambig detection?//
  34227. this.predictionMode = PredictionMode.LL;
  34228. // LAME globals to avoid parameters!!!!! I need these down deep in predTransition
  34229. this._input = null;
  34230. this._startIndex = 0;
  34231. this._outerContext = null;
  34232. this._dfa = null;
  34233. // Each prediction operation uses a cache for merge of prediction contexts.
  34234. // Don't keep around as it wastes huge amounts of memory. DoubleKeyMap
  34235. // isn't synchronized but we're ok since two threads shouldn't reuse same
  34236. // parser/atnsim object because it can only handle one input at a time.
  34237. // This maps graphs a and b to merged result c. (a,b)&rarr;c. We can avoid
  34238. // the merge if we ever see a and b again. Note that (b,a)&rarr;c should
  34239. // also be examined during cache lookup.
  34240. //
  34241. this.mergeCache = null;
  34242. return this;
  34243. }
  34244. ParserATNSimulator.prototype = Object.create(ATNSimulator.prototype);
  34245. ParserATNSimulator.prototype.constructor = ParserATNSimulator;
  34246. ParserATNSimulator.prototype.debug = false;
  34247. ParserATNSimulator.prototype.debug_closure = false;
  34248. ParserATNSimulator.prototype.debug_add = false;
  34249. ParserATNSimulator.prototype.debug_list_atn_decisions = false;
  34250. ParserATNSimulator.prototype.dfa_debug = false;
  34251. ParserATNSimulator.prototype.retry_debug = false;
  34252. ParserATNSimulator.prototype.reset = function() {
  34253. };
  34254. ParserATNSimulator.prototype.adaptivePredict = function(input, decision, outerContext) {
  34255. if (this.debug || this.debug_list_atn_decisions) {
  34256. console.log("adaptivePredict decision " + decision +
  34257. " exec LA(1)==" + this.getLookaheadName(input) +
  34258. " line " + input.LT(1).line + ":" +
  34259. input.LT(1).column);
  34260. }
  34261. this._input = input;
  34262. this._startIndex = input.index;
  34263. this._outerContext = outerContext;
  34264. var dfa = this.decisionToDFA[decision];
  34265. this._dfa = dfa;
  34266. var m = input.mark();
  34267. var index = input.index;
  34268. // Now we are certain to have a specific decision's DFA
  34269. // But, do we still need an initial state?
  34270. try {
  34271. var s0;
  34272. if (dfa.precedenceDfa) {
  34273. // the start state for a precedence DFA depends on the current
  34274. // parser precedence, and is provided by a DFA method.
  34275. s0 = dfa.getPrecedenceStartState(this.parser.getPrecedence());
  34276. } else {
  34277. // the start state for a "regular" DFA is just s0
  34278. s0 = dfa.s0;
  34279. }
  34280. if (s0===null) {
  34281. if (outerContext===null) {
  34282. outerContext = RuleContext.EMPTY;
  34283. }
  34284. if (this.debug || this.debug_list_atn_decisions) {
  34285. console.log("predictATN decision " + dfa.decision +
  34286. " exec LA(1)==" + this.getLookaheadName(input) +
  34287. ", outerContext=" + outerContext.toString(this.parser.ruleNames));
  34288. }
  34289. var fullCtx = false;
  34290. var s0_closure = this.computeStartState(dfa.atnStartState, RuleContext.EMPTY, fullCtx);
  34291. if( dfa.precedenceDfa) {
  34292. // If this is a precedence DFA, we use applyPrecedenceFilter
  34293. // to convert the computed start state to a precedence start
  34294. // state. We then use DFA.setPrecedenceStartState to set the
  34295. // appropriate start state for the precedence level rather
  34296. // than simply setting DFA.s0.
  34297. //
  34298. dfa.s0.configs = s0_closure; // not used for prediction but useful to know start configs anyway
  34299. s0_closure = this.applyPrecedenceFilter(s0_closure);
  34300. s0 = this.addDFAState(dfa, new DFAState(null, s0_closure));
  34301. dfa.setPrecedenceStartState(this.parser.getPrecedence(), s0);
  34302. } else {
  34303. s0 = this.addDFAState(dfa, new DFAState(null, s0_closure));
  34304. dfa.s0 = s0;
  34305. }
  34306. }
  34307. var alt = this.execATN(dfa, s0, input, index, outerContext);
  34308. if (this.debug) {
  34309. console.log("DFA after predictATN: " + dfa.toString(this.parser.literalNames));
  34310. }
  34311. return alt;
  34312. } finally {
  34313. this._dfa = null;
  34314. this.mergeCache = null; // wack cache after each prediction
  34315. input.seek(index);
  34316. input.release(m);
  34317. }
  34318. };
  34319. // Performs ATN simulation to compute a predicted alternative based
  34320. // upon the remaining input, but also updates the DFA cache to avoid
  34321. // having to traverse the ATN again for the same input sequence.
  34322. // There are some key conditions we're looking for after computing a new
  34323. // set of ATN configs (proposed DFA state):
  34324. // if the set is empty, there is no viable alternative for current symbol
  34325. // does the state uniquely predict an alternative?
  34326. // does the state have a conflict that would prevent us from
  34327. // putting it on the work list?
  34328. // We also have some key operations to do:
  34329. // add an edge from previous DFA state to potentially new DFA state, D,
  34330. // upon current symbol but only if adding to work list, which means in all
  34331. // cases except no viable alternative (and possibly non-greedy decisions?)
  34332. // collecting predicates and adding semantic context to DFA accept states
  34333. // adding rule context to context-sensitive DFA accept states
  34334. // consuming an input symbol
  34335. // reporting a conflict
  34336. // reporting an ambiguity
  34337. // reporting a context sensitivity
  34338. // reporting insufficient predicates
  34339. // cover these cases:
  34340. // dead end
  34341. // single alt
  34342. // single alt + preds
  34343. // conflict
  34344. // conflict + preds
  34345. //
  34346. ParserATNSimulator.prototype.execATN = function(dfa, s0, input, startIndex, outerContext ) {
  34347. if (this.debug || this.debug_list_atn_decisions) {
  34348. console.log("execATN decision " + dfa.decision +
  34349. " exec LA(1)==" + this.getLookaheadName(input) +
  34350. " line " + input.LT(1).line + ":" + input.LT(1).column);
  34351. }
  34352. var alt;
  34353. var previousD = s0;
  34354. if (this.debug) {
  34355. console.log("s0 = " + s0);
  34356. }
  34357. var t = input.LA(1);
  34358. while(true) { // while more work
  34359. var D = this.getExistingTargetState(previousD, t);
  34360. if(D===null) {
  34361. D = this.computeTargetState(dfa, previousD, t);
  34362. }
  34363. if(D===ATNSimulator.ERROR) {
  34364. // if any configs in previous dipped into outer context, that
  34365. // means that input up to t actually finished entry rule
  34366. // at least for SLL decision. Full LL doesn't dip into outer
  34367. // so don't need special case.
  34368. // We will get an error no matter what so delay until after
  34369. // decision; better error message. Also, no reachable target
  34370. // ATN states in SLL implies LL will also get nowhere.
  34371. // If conflict in states that dip out, choose min since we
  34372. // will get error no matter what.
  34373. var e = this.noViableAlt(input, outerContext, previousD.configs, startIndex);
  34374. input.seek(startIndex);
  34375. alt = this.getSynValidOrSemInvalidAltThatFinishedDecisionEntryRule(previousD.configs, outerContext);
  34376. if(alt!==ATN.INVALID_ALT_NUMBER) {
  34377. return alt;
  34378. } else {
  34379. throw e;
  34380. }
  34381. }
  34382. if(D.requiresFullContext && this.predictionMode !== PredictionMode.SLL) {
  34383. // IF PREDS, MIGHT RESOLVE TO SINGLE ALT => SLL (or syntax error)
  34384. var conflictingAlts = null;
  34385. if (D.predicates!==null) {
  34386. if (this.debug) {
  34387. console.log("DFA state has preds in DFA sim LL failover");
  34388. }
  34389. var conflictIndex = input.index;
  34390. if(conflictIndex !== startIndex) {
  34391. input.seek(startIndex);
  34392. }
  34393. conflictingAlts = this.evalSemanticContext(D.predicates, outerContext, true);
  34394. if (conflictingAlts.length===1) {
  34395. if(this.debug) {
  34396. console.log("Full LL avoided");
  34397. }
  34398. return conflictingAlts.minValue();
  34399. }
  34400. if (conflictIndex !== startIndex) {
  34401. // restore the index so reporting the fallback to full
  34402. // context occurs with the index at the correct spot
  34403. input.seek(conflictIndex);
  34404. }
  34405. }
  34406. if (this.dfa_debug) {
  34407. console.log("ctx sensitive state " + outerContext +" in " + D);
  34408. }
  34409. var fullCtx = true;
  34410. var s0_closure = this.computeStartState(dfa.atnStartState, outerContext, fullCtx);
  34411. this.reportAttemptingFullContext(dfa, conflictingAlts, D.configs, startIndex, input.index);
  34412. alt = this.execATNWithFullContext(dfa, D, s0_closure, input, startIndex, outerContext);
  34413. return alt;
  34414. }
  34415. if (D.isAcceptState) {
  34416. if (D.predicates===null) {
  34417. return D.prediction;
  34418. }
  34419. var stopIndex = input.index;
  34420. input.seek(startIndex);
  34421. var alts = this.evalSemanticContext(D.predicates, outerContext, true);
  34422. if (alts.length===0) {
  34423. throw this.noViableAlt(input, outerContext, D.configs, startIndex);
  34424. } else if (alts.length===1) {
  34425. return alts.minValue();
  34426. } else {
  34427. // report ambiguity after predicate evaluation to make sure the correct set of ambig alts is reported.
  34428. this.reportAmbiguity(dfa, D, startIndex, stopIndex, false, alts, D.configs);
  34429. return alts.minValue();
  34430. }
  34431. }
  34432. previousD = D;
  34433. if (t !== Token.EOF) {
  34434. input.consume();
  34435. t = input.LA(1);
  34436. }
  34437. }
  34438. };
  34439. //
  34440. // Get an existing target state for an edge in the DFA. If the target state
  34441. // for the edge has not yet been computed or is otherwise not available,
  34442. // this method returns {@code null}.
  34443. //
  34444. // @param previousD The current DFA state
  34445. // @param t The next input symbol
  34446. // @return The existing target DFA state for the given input symbol
  34447. // {@code t}, or {@code null} if the target state for this edge is not
  34448. // already cached
  34449. //
  34450. ParserATNSimulator.prototype.getExistingTargetState = function(previousD, t) {
  34451. var edges = previousD.edges;
  34452. if (edges===null) {
  34453. return null;
  34454. } else {
  34455. return edges[t + 1] || null;
  34456. }
  34457. };
  34458. //
  34459. // Compute a target state for an edge in the DFA, and attempt to add the
  34460. // computed state and corresponding edge to the DFA.
  34461. //
  34462. // @param dfa The DFA
  34463. // @param previousD The current DFA state
  34464. // @param t The next input symbol
  34465. //
  34466. // @return The computed target DFA state for the given input symbol
  34467. // {@code t}. If {@code t} does not lead to a valid DFA state, this method
  34468. // returns {@link //ERROR}.
  34469. //
  34470. ParserATNSimulator.prototype.computeTargetState = function(dfa, previousD, t) {
  34471. var reach = this.computeReachSet(previousD.configs, t, false);
  34472. if(reach===null) {
  34473. this.addDFAEdge(dfa, previousD, t, ATNSimulator.ERROR);
  34474. return ATNSimulator.ERROR;
  34475. }
  34476. // create new target state; we'll add to DFA after it's complete
  34477. var D = new DFAState(null, reach);
  34478. var predictedAlt = this.getUniqueAlt(reach);
  34479. if (this.debug) {
  34480. var altSubSets = PredictionMode.getConflictingAltSubsets(reach);
  34481. console.log("SLL altSubSets=" + Utils.arrayToString(altSubSets) +
  34482. ", previous=" + previousD.configs +
  34483. ", configs=" + reach +
  34484. ", predict=" + predictedAlt +
  34485. ", allSubsetsConflict=" +
  34486. PredictionMode.allSubsetsConflict(altSubSets) + ", conflictingAlts=" +
  34487. this.getConflictingAlts(reach));
  34488. }
  34489. if (predictedAlt!==ATN.INVALID_ALT_NUMBER) {
  34490. // NO CONFLICT, UNIQUELY PREDICTED ALT
  34491. D.isAcceptState = true;
  34492. D.configs.uniqueAlt = predictedAlt;
  34493. D.prediction = predictedAlt;
  34494. } else if (PredictionMode.hasSLLConflictTerminatingPrediction(this.predictionMode, reach)) {
  34495. // MORE THAN ONE VIABLE ALTERNATIVE
  34496. D.configs.conflictingAlts = this.getConflictingAlts(reach);
  34497. D.requiresFullContext = true;
  34498. // in SLL-only mode, we will stop at this state and return the minimum alt
  34499. D.isAcceptState = true;
  34500. D.prediction = D.configs.conflictingAlts.minValue();
  34501. }
  34502. if (D.isAcceptState && D.configs.hasSemanticContext) {
  34503. this.predicateDFAState(D, this.atn.getDecisionState(dfa.decision));
  34504. if( D.predicates!==null) {
  34505. D.prediction = ATN.INVALID_ALT_NUMBER;
  34506. }
  34507. }
  34508. // all adds to dfa are done after we've created full D state
  34509. D = this.addDFAEdge(dfa, previousD, t, D);
  34510. return D;
  34511. };
  34512. ParserATNSimulator.prototype.predicateDFAState = function(dfaState, decisionState) {
  34513. // We need to test all predicates, even in DFA states that
  34514. // uniquely predict alternative.
  34515. var nalts = decisionState.transitions.length;
  34516. // Update DFA so reach becomes accept state with (predicate,alt)
  34517. // pairs if preds found for conflicting alts
  34518. var altsToCollectPredsFrom = this.getConflictingAltsOrUniqueAlt(dfaState.configs);
  34519. var altToPred = this.getPredsForAmbigAlts(altsToCollectPredsFrom, dfaState.configs, nalts);
  34520. if (altToPred!==null) {
  34521. dfaState.predicates = this.getPredicatePredictions(altsToCollectPredsFrom, altToPred);
  34522. dfaState.prediction = ATN.INVALID_ALT_NUMBER; // make sure we use preds
  34523. } else {
  34524. // There are preds in configs but they might go away
  34525. // when OR'd together like {p}? || NONE == NONE. If neither
  34526. // alt has preds, resolve to min alt
  34527. dfaState.prediction = altsToCollectPredsFrom.minValue();
  34528. }
  34529. };
  34530. // comes back with reach.uniqueAlt set to a valid alt
  34531. ParserATNSimulator.prototype.execATNWithFullContext = function(dfa, D, // how far we got before failing over
  34532. s0,
  34533. input,
  34534. startIndex,
  34535. outerContext) {
  34536. if (this.debug || this.debug_list_atn_decisions) {
  34537. console.log("execATNWithFullContext "+s0);
  34538. }
  34539. var fullCtx = true;
  34540. var foundExactAmbig = false;
  34541. var reach = null;
  34542. var previous = s0;
  34543. input.seek(startIndex);
  34544. var t = input.LA(1);
  34545. var predictedAlt = -1;
  34546. while (true) { // while more work
  34547. reach = this.computeReachSet(previous, t, fullCtx);
  34548. if (reach===null) {
  34549. // if any configs in previous dipped into outer context, that
  34550. // means that input up to t actually finished entry rule
  34551. // at least for LL decision. Full LL doesn't dip into outer
  34552. // so don't need special case.
  34553. // We will get an error no matter what so delay until after
  34554. // decision; better error message. Also, no reachable target
  34555. // ATN states in SLL implies LL will also get nowhere.
  34556. // If conflict in states that dip out, choose min since we
  34557. // will get error no matter what.
  34558. var e = this.noViableAlt(input, outerContext, previous, startIndex);
  34559. input.seek(startIndex);
  34560. var alt = this.getSynValidOrSemInvalidAltThatFinishedDecisionEntryRule(previous, outerContext);
  34561. if(alt!==ATN.INVALID_ALT_NUMBER) {
  34562. return alt;
  34563. } else {
  34564. throw e;
  34565. }
  34566. }
  34567. var altSubSets = PredictionMode.getConflictingAltSubsets(reach);
  34568. if(this.debug) {
  34569. console.log("LL altSubSets=" + altSubSets + ", predict=" +
  34570. PredictionMode.getUniqueAlt(altSubSets) + ", resolvesToJustOneViableAlt=" +
  34571. PredictionMode.resolvesToJustOneViableAlt(altSubSets));
  34572. }
  34573. reach.uniqueAlt = this.getUniqueAlt(reach);
  34574. // unique prediction?
  34575. if(reach.uniqueAlt!==ATN.INVALID_ALT_NUMBER) {
  34576. predictedAlt = reach.uniqueAlt;
  34577. break;
  34578. } else if (this.predictionMode !== PredictionMode.LL_EXACT_AMBIG_DETECTION) {
  34579. predictedAlt = PredictionMode.resolvesToJustOneViableAlt(altSubSets);
  34580. if(predictedAlt !== ATN.INVALID_ALT_NUMBER) {
  34581. break;
  34582. }
  34583. } else {
  34584. // In exact ambiguity mode, we never try to terminate early.
  34585. // Just keeps scarfing until we know what the conflict is
  34586. if (PredictionMode.allSubsetsConflict(altSubSets) && PredictionMode.allSubsetsEqual(altSubSets)) {
  34587. foundExactAmbig = true;
  34588. predictedAlt = PredictionMode.getSingleViableAlt(altSubSets);
  34589. break;
  34590. }
  34591. // else there are multiple non-conflicting subsets or
  34592. // we're not sure what the ambiguity is yet.
  34593. // So, keep going.
  34594. }
  34595. previous = reach;
  34596. if( t !== Token.EOF) {
  34597. input.consume();
  34598. t = input.LA(1);
  34599. }
  34600. }
  34601. // If the configuration set uniquely predicts an alternative,
  34602. // without conflict, then we know that it's a full LL decision
  34603. // not SLL.
  34604. if (reach.uniqueAlt !== ATN.INVALID_ALT_NUMBER ) {
  34605. this.reportContextSensitivity(dfa, predictedAlt, reach, startIndex, input.index);
  34606. return predictedAlt;
  34607. }
  34608. // We do not check predicates here because we have checked them
  34609. // on-the-fly when doing full context prediction.
  34610. //
  34611. // In non-exact ambiguity detection mode, we might actually be able to
  34612. // detect an exact ambiguity, but I'm not going to spend the cycles
  34613. // needed to check. We only emit ambiguity warnings in exact ambiguity
  34614. // mode.
  34615. //
  34616. // For example, we might know that we have conflicting configurations.
  34617. // But, that does not mean that there is no way forward without a
  34618. // conflict. It's possible to have nonconflicting alt subsets as in:
  34619. // altSubSets=[{1, 2}, {1, 2}, {1}, {1, 2}]
  34620. // from
  34621. //
  34622. // [(17,1,[5 $]), (13,1,[5 10 $]), (21,1,[5 10 $]), (11,1,[$]),
  34623. // (13,2,[5 10 $]), (21,2,[5 10 $]), (11,2,[$])]
  34624. //
  34625. // In this case, (17,1,[5 $]) indicates there is some next sequence that
  34626. // would resolve this without conflict to alternative 1. Any other viable
  34627. // next sequence, however, is associated with a conflict. We stop
  34628. // looking for input because no amount of further lookahead will alter
  34629. // the fact that we should predict alternative 1. We just can't say for
  34630. // sure that there is an ambiguity without looking further.
  34631. this.reportAmbiguity(dfa, D, startIndex, input.index, foundExactAmbig, null, reach);
  34632. return predictedAlt;
  34633. };
  34634. ParserATNSimulator.prototype.computeReachSet = function(closure, t, fullCtx) {
  34635. if (this.debug) {
  34636. console.log("in computeReachSet, starting closure: " + closure);
  34637. }
  34638. if( this.mergeCache===null) {
  34639. this.mergeCache = new DoubleDict();
  34640. }
  34641. var intermediate = new ATNConfigSet(fullCtx);
  34642. // Configurations already in a rule stop state indicate reaching the end
  34643. // of the decision rule (local context) or end of the start rule (full
  34644. // context). Once reached, these configurations are never updated by a
  34645. // closure operation, so they are handled separately for the performance
  34646. // advantage of having a smaller intermediate set when calling closure.
  34647. //
  34648. // For full-context reach operations, separate handling is required to
  34649. // ensure that the alternative matching the longest overall sequence is
  34650. // chosen when multiple such configurations can match the input.
  34651. var skippedStopStates = null;
  34652. // First figure out where we can reach on input t
  34653. for (var i=0; i<closure.items.length;i++) {
  34654. var c = closure.items[i];
  34655. if(this.debug_add) {
  34656. console.log("testing " + this.getTokenName(t) + " at " + c);
  34657. }
  34658. if (c.state instanceof RuleStopState) {
  34659. if (fullCtx || t === Token.EOF) {
  34660. if (skippedStopStates===null) {
  34661. skippedStopStates = [];
  34662. }
  34663. skippedStopStates.push(c);
  34664. if(this.debug_add) {
  34665. console.log("added " + c + " to skippedStopStates");
  34666. }
  34667. }
  34668. continue;
  34669. }
  34670. for(var j=0;j<c.state.transitions.length;j++) {
  34671. var trans = c.state.transitions[j];
  34672. var target = this.getReachableTarget(trans, t);
  34673. if (target!==null) {
  34674. var cfg = new ATNConfig({state:target}, c);
  34675. intermediate.add(cfg, this.mergeCache);
  34676. if(this.debug_add) {
  34677. console.log("added " + cfg + " to intermediate");
  34678. }
  34679. }
  34680. }
  34681. }
  34682. // Now figure out where the reach operation can take us...
  34683. var reach = null;
  34684. // This block optimizes the reach operation for intermediate sets which
  34685. // trivially indicate a termination state for the overall
  34686. // adaptivePredict operation.
  34687. //
  34688. // The conditions assume that intermediate
  34689. // contains all configurations relevant to the reach set, but this
  34690. // condition is not true when one or more configurations have been
  34691. // withheld in skippedStopStates, or when the current symbol is EOF.
  34692. //
  34693. if (skippedStopStates===null && t!==Token.EOF) {
  34694. if (intermediate.items.length===1) {
  34695. // Don't pursue the closure if there is just one state.
  34696. // It can only have one alternative; just add to result
  34697. // Also don't pursue the closure if there is unique alternative
  34698. // among the configurations.
  34699. reach = intermediate;
  34700. } else if (this.getUniqueAlt(intermediate)!==ATN.INVALID_ALT_NUMBER) {
  34701. // Also don't pursue the closure if there is unique alternative
  34702. // among the configurations.
  34703. reach = intermediate;
  34704. }
  34705. }
  34706. // If the reach set could not be trivially determined, perform a closure
  34707. // operation on the intermediate set to compute its initial value.
  34708. //
  34709. if (reach===null) {
  34710. reach = new ATNConfigSet(fullCtx);
  34711. var closureBusy = new Set();
  34712. var treatEofAsEpsilon = t === Token.EOF;
  34713. for (var k=0; k<intermediate.items.length;k++) {
  34714. this.closure(intermediate.items[k], reach, closureBusy, false, fullCtx, treatEofAsEpsilon);
  34715. }
  34716. }
  34717. if (t === Token.EOF) {
  34718. // After consuming EOF no additional input is possible, so we are
  34719. // only interested in configurations which reached the end of the
  34720. // decision rule (local context) or end of the start rule (full
  34721. // context). Update reach to contain only these configurations. This
  34722. // handles both explicit EOF transitions in the grammar and implicit
  34723. // EOF transitions following the end of the decision or start rule.
  34724. //
  34725. // When reach==intermediate, no closure operation was performed. In
  34726. // this case, removeAllConfigsNotInRuleStopState needs to check for
  34727. // reachable rule stop states as well as configurations already in
  34728. // a rule stop state.
  34729. //
  34730. // This is handled before the configurations in skippedStopStates,
  34731. // because any configurations potentially added from that list are
  34732. // already guaranteed to meet this condition whether or not it's
  34733. // required.
  34734. //
  34735. reach = this.removeAllConfigsNotInRuleStopState(reach, reach === intermediate);
  34736. }
  34737. // If skippedStopStates!==null, then it contains at least one
  34738. // configuration. For full-context reach operations, these
  34739. // configurations reached the end of the start rule, in which case we
  34740. // only add them back to reach if no configuration during the current
  34741. // closure operation reached such a state. This ensures adaptivePredict
  34742. // chooses an alternative matching the longest overall sequence when
  34743. // multiple alternatives are viable.
  34744. //
  34745. if (skippedStopStates!==null && ( (! fullCtx) || (! PredictionMode.hasConfigInRuleStopState(reach)))) {
  34746. for (var l=0; l<skippedStopStates.length;l++) {
  34747. reach.add(skippedStopStates[l], this.mergeCache);
  34748. }
  34749. }
  34750. if (reach.items.length===0) {
  34751. return null;
  34752. } else {
  34753. return reach;
  34754. }
  34755. };
  34756. //
  34757. // Return a configuration set containing only the configurations from
  34758. // {@code configs} which are in a {@link RuleStopState}. If all
  34759. // configurations in {@code configs} are already in a rule stop state, this
  34760. // method simply returns {@code configs}.
  34761. //
  34762. // <p>When {@code lookToEndOfRule} is true, this method uses
  34763. // {@link ATN//nextTokens} for each configuration in {@code configs} which is
  34764. // not already in a rule stop state to see if a rule stop state is reachable
  34765. // from the configuration via epsilon-only transitions.</p>
  34766. //
  34767. // @param configs the configuration set to update
  34768. // @param lookToEndOfRule when true, this method checks for rule stop states
  34769. // reachable by epsilon-only transitions from each configuration in
  34770. // {@code configs}.
  34771. //
  34772. // @return {@code configs} if all configurations in {@code configs} are in a
  34773. // rule stop state, otherwise return a new configuration set containing only
  34774. // the configurations from {@code configs} which are in a rule stop state
  34775. //
  34776. ParserATNSimulator.prototype.removeAllConfigsNotInRuleStopState = function(configs, lookToEndOfRule) {
  34777. if (PredictionMode.allConfigsInRuleStopStates(configs)) {
  34778. return configs;
  34779. }
  34780. var result = new ATNConfigSet(configs.fullCtx);
  34781. for(var i=0; i<configs.items.length;i++) {
  34782. var config = configs.items[i];
  34783. if (config.state instanceof RuleStopState) {
  34784. result.add(config, this.mergeCache);
  34785. continue;
  34786. }
  34787. if (lookToEndOfRule && config.state.epsilonOnlyTransitions) {
  34788. var nextTokens = this.atn.nextTokens(config.state);
  34789. if (nextTokens.contains(Token.EPSILON)) {
  34790. var endOfRuleState = this.atn.ruleToStopState[config.state.ruleIndex];
  34791. result.add(new ATNConfig({state:endOfRuleState}, config), this.mergeCache);
  34792. }
  34793. }
  34794. }
  34795. return result;
  34796. };
  34797. ParserATNSimulator.prototype.computeStartState = function(p, ctx, fullCtx) {
  34798. // always at least the implicit call to start rule
  34799. var initialContext = predictionContextFromRuleContext(this.atn, ctx);
  34800. var configs = new ATNConfigSet(fullCtx);
  34801. for(var i=0;i<p.transitions.length;i++) {
  34802. var target = p.transitions[i].target;
  34803. var c = new ATNConfig({ state:target, alt:i+1, context:initialContext }, null);
  34804. var closureBusy = new Set();
  34805. this.closure(c, configs, closureBusy, true, fullCtx, false);
  34806. }
  34807. return configs;
  34808. };
  34809. //
  34810. // This method transforms the start state computed by
  34811. // {@link //computeStartState} to the special start state used by a
  34812. // precedence DFA for a particular precedence value. The transformation
  34813. // process applies the following changes to the start state's configuration
  34814. // set.
  34815. //
  34816. // <ol>
  34817. // <li>Evaluate the precedence predicates for each configuration using
  34818. // {@link SemanticContext//evalPrecedence}.</li>
  34819. // <li>Remove all configurations which predict an alternative greater than
  34820. // 1, for which another configuration that predicts alternative 1 is in the
  34821. // same ATN state with the same prediction context. This transformation is
  34822. // valid for the following reasons:
  34823. // <ul>
  34824. // <li>The closure block cannot contain any epsilon transitions which bypass
  34825. // the body of the closure, so all states reachable via alternative 1 are
  34826. // part of the precedence alternatives of the transformed left-recursive
  34827. // rule.</li>
  34828. // <li>The "primary" portion of a left recursive rule cannot contain an
  34829. // epsilon transition, so the only way an alternative other than 1 can exist
  34830. // in a state that is also reachable via alternative 1 is by nesting calls
  34831. // to the left-recursive rule, with the outer calls not being at the
  34832. // preferred precedence level.</li>
  34833. // </ul>
  34834. // </li>
  34835. // </ol>
  34836. //
  34837. // <p>
  34838. // The prediction context must be considered by this filter to address
  34839. // situations like the following.
  34840. // </p>
  34841. // <code>
  34842. // <pre>
  34843. // grammar TA;
  34844. // prog: statement* EOF;
  34845. // statement: letterA | statement letterA 'b' ;
  34846. // letterA: 'a';
  34847. // </pre>
  34848. // </code>
  34849. // <p>
  34850. // If the above grammar, the ATN state immediately before the token
  34851. // reference {@code 'a'} in {@code letterA} is reachable from the left edge
  34852. // of both the primary and closure blocks of the left-recursive rule
  34853. // {@code statement}. The prediction context associated with each of these
  34854. // configurations distinguishes between them, and prevents the alternative
  34855. // which stepped out to {@code prog} (and then back in to {@code statement}
  34856. // from being eliminated by the filter.
  34857. // </p>
  34858. //
  34859. // @param configs The configuration set computed by
  34860. // {@link //computeStartState} as the start state for the DFA.
  34861. // @return The transformed configuration set representing the start state
  34862. // for a precedence DFA at a particular precedence level (determined by
  34863. // calling {@link Parser//getPrecedence}).
  34864. //
  34865. ParserATNSimulator.prototype.applyPrecedenceFilter = function(configs) {
  34866. var config;
  34867. var statesFromAlt1 = [];
  34868. var configSet = new ATNConfigSet(configs.fullCtx);
  34869. for(var i=0; i<configs.items.length; i++) {
  34870. config = configs.items[i];
  34871. // handle alt 1 first
  34872. if (config.alt !== 1) {
  34873. continue;
  34874. }
  34875. var updatedContext = config.semanticContext.evalPrecedence(this.parser, this._outerContext);
  34876. if (updatedContext===null) {
  34877. // the configuration was eliminated
  34878. continue;
  34879. }
  34880. statesFromAlt1[config.state.stateNumber] = config.context;
  34881. if (updatedContext !== config.semanticContext) {
  34882. configSet.add(new ATNConfig({semanticContext:updatedContext}, config), this.mergeCache);
  34883. } else {
  34884. configSet.add(config, this.mergeCache);
  34885. }
  34886. }
  34887. for(i=0; i<configs.items.length; i++) {
  34888. config = configs.items[i];
  34889. if (config.alt === 1) {
  34890. // already handled
  34891. continue;
  34892. }
  34893. // In the future, this elimination step could be updated to also
  34894. // filter the prediction context for alternatives predicting alt>1
  34895. // (basically a graph subtraction algorithm).
  34896. if (!config.precedenceFilterSuppressed) {
  34897. var context = statesFromAlt1[config.state.stateNumber] || null;
  34898. if (context!==null && context.equals(config.context)) {
  34899. // eliminated
  34900. continue;
  34901. }
  34902. }
  34903. configSet.add(config, this.mergeCache);
  34904. }
  34905. return configSet;
  34906. };
  34907. ParserATNSimulator.prototype.getReachableTarget = function(trans, ttype) {
  34908. if (trans.matches(ttype, 0, this.atn.maxTokenType)) {
  34909. return trans.target;
  34910. } else {
  34911. return null;
  34912. }
  34913. };
  34914. ParserATNSimulator.prototype.getPredsForAmbigAlts = function(ambigAlts, configs, nalts) {
  34915. // REACH=[1|1|[]|0:0, 1|2|[]|0:1]
  34916. // altToPred starts as an array of all null contexts. The entry at index i
  34917. // corresponds to alternative i. altToPred[i] may have one of three values:
  34918. // 1. null: no ATNConfig c is found such that c.alt==i
  34919. // 2. SemanticContext.NONE: At least one ATNConfig c exists such that
  34920. // c.alt==i and c.semanticContext==SemanticContext.NONE. In other words,
  34921. // alt i has at least one unpredicated config.
  34922. // 3. Non-NONE Semantic Context: There exists at least one, and for all
  34923. // ATNConfig c such that c.alt==i, c.semanticContext!=SemanticContext.NONE.
  34924. //
  34925. // From this, it is clear that NONE||anything==NONE.
  34926. //
  34927. var altToPred = [];
  34928. for(var i=0;i<configs.items.length;i++) {
  34929. var c = configs.items[i];
  34930. if(ambigAlts.contains( c.alt )) {
  34931. altToPred[c.alt] = SemanticContext.orContext(altToPred[c.alt] || null, c.semanticContext);
  34932. }
  34933. }
  34934. var nPredAlts = 0;
  34935. for (i =1;i< nalts+1;i++) {
  34936. var pred = altToPred[i] || null;
  34937. if (pred===null) {
  34938. altToPred[i] = SemanticContext.NONE;
  34939. } else if (pred !== SemanticContext.NONE) {
  34940. nPredAlts += 1;
  34941. }
  34942. }
  34943. // nonambig alts are null in altToPred
  34944. if (nPredAlts===0) {
  34945. altToPred = null;
  34946. }
  34947. if (this.debug) {
  34948. console.log("getPredsForAmbigAlts result " + Utils.arrayToString(altToPred));
  34949. }
  34950. return altToPred;
  34951. };
  34952. ParserATNSimulator.prototype.getPredicatePredictions = function(ambigAlts, altToPred) {
  34953. var pairs = [];
  34954. var containsPredicate = false;
  34955. for (var i=1; i<altToPred.length;i++) {
  34956. var pred = altToPred[i];
  34957. // unpredicated is indicated by SemanticContext.NONE
  34958. if( ambigAlts!==null && ambigAlts.contains( i )) {
  34959. pairs.push(new PredPrediction(pred, i));
  34960. }
  34961. if (pred !== SemanticContext.NONE) {
  34962. containsPredicate = true;
  34963. }
  34964. }
  34965. if (! containsPredicate) {
  34966. return null;
  34967. }
  34968. return pairs;
  34969. };
  34970. //
  34971. // This method is used to improve the localization of error messages by
  34972. // choosing an alternative rather than throwing a
  34973. // {@link NoViableAltException} in particular prediction scenarios where the
  34974. // {@link //ERROR} state was reached during ATN simulation.
  34975. //
  34976. // <p>
  34977. // The default implementation of this method uses the following
  34978. // algorithm to identify an ATN configuration which successfully parsed the
  34979. // decision entry rule. Choosing such an alternative ensures that the
  34980. // {@link ParserRuleContext} returned by the calling rule will be complete
  34981. // and valid, and the syntax error will be reported later at a more
  34982. // localized location.</p>
  34983. //
  34984. // <ul>
  34985. // <li>If a syntactically valid path or paths reach the end of the decision rule and
  34986. // they are semantically valid if predicated, return the min associated alt.</li>
  34987. // <li>Else, if a semantically invalid but syntactically valid path exist
  34988. // or paths exist, return the minimum associated alt.
  34989. // </li>
  34990. // <li>Otherwise, return {@link ATN//INVALID_ALT_NUMBER}.</li>
  34991. // </ul>
  34992. //
  34993. // <p>
  34994. // In some scenarios, the algorithm described above could predict an
  34995. // alternative which will result in a {@link FailedPredicateException} in
  34996. // the parser. Specifically, this could occur if the <em>only</em> configuration
  34997. // capable of successfully parsing to the end of the decision rule is
  34998. // blocked by a semantic predicate. By choosing this alternative within
  34999. // {@link //adaptivePredict} instead of throwing a
  35000. // {@link NoViableAltException}, the resulting
  35001. // {@link FailedPredicateException} in the parser will identify the specific
  35002. // predicate which is preventing the parser from successfully parsing the
  35003. // decision rule, which helps developers identify and correct logic errors
  35004. // in semantic predicates.
  35005. // </p>
  35006. //
  35007. // @param configs The ATN configurations which were valid immediately before
  35008. // the {@link //ERROR} state was reached
  35009. // @param outerContext The is the \gamma_0 initial parser context from the paper
  35010. // or the parser stack at the instant before prediction commences.
  35011. //
  35012. // @return The value to return from {@link //adaptivePredict}, or
  35013. // {@link ATN//INVALID_ALT_NUMBER} if a suitable alternative was not
  35014. // identified and {@link //adaptivePredict} should report an error instead.
  35015. //
  35016. ParserATNSimulator.prototype.getSynValidOrSemInvalidAltThatFinishedDecisionEntryRule = function(configs, outerContext) {
  35017. var cfgs = this.splitAccordingToSemanticValidity(configs, outerContext);
  35018. var semValidConfigs = cfgs[0];
  35019. var semInvalidConfigs = cfgs[1];
  35020. var alt = this.getAltThatFinishedDecisionEntryRule(semValidConfigs);
  35021. if (alt!==ATN.INVALID_ALT_NUMBER) { // semantically/syntactically viable path exists
  35022. return alt;
  35023. }
  35024. // Is there a syntactically valid path with a failed pred?
  35025. if (semInvalidConfigs.items.length>0) {
  35026. alt = this.getAltThatFinishedDecisionEntryRule(semInvalidConfigs);
  35027. if (alt!==ATN.INVALID_ALT_NUMBER) { // syntactically viable path exists
  35028. return alt;
  35029. }
  35030. }
  35031. return ATN.INVALID_ALT_NUMBER;
  35032. };
  35033. ParserATNSimulator.prototype.getAltThatFinishedDecisionEntryRule = function(configs) {
  35034. var alts = [];
  35035. for(var i=0;i<configs.items.length; i++) {
  35036. var c = configs.items[i];
  35037. if (c.reachesIntoOuterContext>0 || ((c.state instanceof RuleStopState) && c.context.hasEmptyPath())) {
  35038. if(alts.indexOf(c.alt)<0) {
  35039. alts.push(c.alt);
  35040. }
  35041. }
  35042. }
  35043. if (alts.length===0) {
  35044. return ATN.INVALID_ALT_NUMBER;
  35045. } else {
  35046. return Math.min.apply(null, alts);
  35047. }
  35048. };
  35049. // Walk the list of configurations and split them according to
  35050. // those that have preds evaluating to true/false. If no pred, assume
  35051. // true pred and include in succeeded set. Returns Pair of sets.
  35052. //
  35053. // Create a new set so as not to alter the incoming parameter.
  35054. //
  35055. // Assumption: the input stream has been restored to the starting point
  35056. // prediction, which is where predicates need to evaluate.
  35057. //
  35058. ParserATNSimulator.prototype.splitAccordingToSemanticValidity = function( configs, outerContext) {
  35059. var succeeded = new ATNConfigSet(configs.fullCtx);
  35060. var failed = new ATNConfigSet(configs.fullCtx);
  35061. for(var i=0;i<configs.items.length; i++) {
  35062. var c = configs.items[i];
  35063. if (c.semanticContext !== SemanticContext.NONE) {
  35064. var predicateEvaluationResult = c.semanticContext.evaluate(this.parser, outerContext);
  35065. if (predicateEvaluationResult) {
  35066. succeeded.add(c);
  35067. } else {
  35068. failed.add(c);
  35069. }
  35070. } else {
  35071. succeeded.add(c);
  35072. }
  35073. }
  35074. return [succeeded, failed];
  35075. };
  35076. // Look through a list of predicate/alt pairs, returning alts for the
  35077. // pairs that win. A {@code NONE} predicate indicates an alt containing an
  35078. // unpredicated config which behaves as "always true." If !complete
  35079. // then we stop at the first predicate that evaluates to true. This
  35080. // includes pairs with null predicates.
  35081. //
  35082. ParserATNSimulator.prototype.evalSemanticContext = function(predPredictions, outerContext, complete) {
  35083. var predictions = new BitSet();
  35084. for(var i=0;i<predPredictions.length;i++) {
  35085. var pair = predPredictions[i];
  35086. if (pair.pred === SemanticContext.NONE) {
  35087. predictions.add(pair.alt);
  35088. if (! complete) {
  35089. break;
  35090. }
  35091. continue;
  35092. }
  35093. var predicateEvaluationResult = pair.pred.evaluate(this.parser, outerContext);
  35094. if (this.debug || this.dfa_debug) {
  35095. console.log("eval pred " + pair + "=" + predicateEvaluationResult);
  35096. }
  35097. if (predicateEvaluationResult) {
  35098. if (this.debug || this.dfa_debug) {
  35099. console.log("PREDICT " + pair.alt);
  35100. }
  35101. predictions.add(pair.alt);
  35102. if (! complete) {
  35103. break;
  35104. }
  35105. }
  35106. }
  35107. return predictions;
  35108. };
  35109. // TODO: If we are doing predicates, there is no point in pursuing
  35110. // closure operations if we reach a DFA state that uniquely predicts
  35111. // alternative. We will not be caching that DFA state and it is a
  35112. // waste to pursue the closure. Might have to advance when we do
  35113. // ambig detection thought :(
  35114. //
  35115. ParserATNSimulator.prototype.closure = function(config, configs, closureBusy, collectPredicates, fullCtx, treatEofAsEpsilon) {
  35116. var initialDepth = 0;
  35117. this.closureCheckingStopState(config, configs, closureBusy, collectPredicates,
  35118. fullCtx, initialDepth, treatEofAsEpsilon);
  35119. };
  35120. ParserATNSimulator.prototype.closureCheckingStopState = function(config, configs, closureBusy, collectPredicates, fullCtx, depth, treatEofAsEpsilon) {
  35121. if (this.debug || this.debug_closure) {
  35122. console.log("closure(" + config.toString(this.parser,true) + ")");
  35123. // console.log("configs(" + configs.toString() + ")");
  35124. if(config.reachesIntoOuterContext>50) {
  35125. throw "problem";
  35126. }
  35127. }
  35128. if (config.state instanceof RuleStopState) {
  35129. // We hit rule end. If we have context info, use it
  35130. // run thru all possible stack tops in ctx
  35131. if (! config.context.isEmpty()) {
  35132. for ( var i =0; i<config.context.length; i++) {
  35133. if (config.context.getReturnState(i) === PredictionContext.EMPTY_RETURN_STATE) {
  35134. if (fullCtx) {
  35135. configs.add(new ATNConfig({state:config.state, context:PredictionContext.EMPTY}, config), this.mergeCache);
  35136. continue;
  35137. } else {
  35138. // we have no context info, just chase follow links (if greedy)
  35139. if (this.debug) {
  35140. console.log("FALLING off rule " + this.getRuleName(config.state.ruleIndex));
  35141. }
  35142. this.closure_(config, configs, closureBusy, collectPredicates,
  35143. fullCtx, depth, treatEofAsEpsilon);
  35144. }
  35145. continue;
  35146. }
  35147. var returnState = this.atn.states[config.context.getReturnState(i)];
  35148. var newContext = config.context.getParent(i); // "pop" return state
  35149. var parms = {state:returnState, alt:config.alt, context:newContext, semanticContext:config.semanticContext};
  35150. var c = new ATNConfig(parms, null);
  35151. // While we have context to pop back from, we may have
  35152. // gotten that context AFTER having falling off a rule.
  35153. // Make sure we track that we are now out of context.
  35154. c.reachesIntoOuterContext = config.reachesIntoOuterContext;
  35155. this.closureCheckingStopState(c, configs, closureBusy, collectPredicates, fullCtx, depth - 1, treatEofAsEpsilon);
  35156. }
  35157. return;
  35158. } else if( fullCtx) {
  35159. // reached end of start rule
  35160. configs.add(config, this.mergeCache);
  35161. return;
  35162. } else {
  35163. // else if we have no context info, just chase follow links (if greedy)
  35164. if (this.debug) {
  35165. console.log("FALLING off rule " + this.getRuleName(config.state.ruleIndex));
  35166. }
  35167. }
  35168. }
  35169. this.closure_(config, configs, closureBusy, collectPredicates, fullCtx, depth, treatEofAsEpsilon);
  35170. };
  35171. // Do the actual work of walking epsilon edges//
  35172. ParserATNSimulator.prototype.closure_ = function(config, configs, closureBusy, collectPredicates, fullCtx, depth, treatEofAsEpsilon) {
  35173. var p = config.state;
  35174. // optimization
  35175. if (! p.epsilonOnlyTransitions) {
  35176. configs.add(config, this.mergeCache);
  35177. // make sure to not return here, because EOF transitions can act as
  35178. // both epsilon transitions and non-epsilon transitions.
  35179. }
  35180. for(var i = 0;i<p.transitions.length; i++) {
  35181. if(i==0 && this.canDropLoopEntryEdgeInLeftRecursiveRule(config))
  35182. continue;
  35183. var t = p.transitions[i];
  35184. var continueCollecting = collectPredicates && !(t instanceof ActionTransition);
  35185. var c = this.getEpsilonTarget(config, t, continueCollecting, depth === 0, fullCtx, treatEofAsEpsilon);
  35186. if (c!==null) {
  35187. var newDepth = depth;
  35188. if ( config.state instanceof RuleStopState) {
  35189. // target fell off end of rule; mark resulting c as having dipped into outer context
  35190. // We can't get here if incoming config was rule stop and we had context
  35191. // track how far we dip into outer context. Might
  35192. // come in handy and we avoid evaluating context dependent
  35193. // preds if this is > 0.
  35194. if (this._dfa !== null && this._dfa.precedenceDfa) {
  35195. if (t.outermostPrecedenceReturn === this._dfa.atnStartState.ruleIndex) {
  35196. c.precedenceFilterSuppressed = true;
  35197. }
  35198. }
  35199. c.reachesIntoOuterContext += 1;
  35200. if (closureBusy.add(c)!==c) {
  35201. // avoid infinite recursion for right-recursive rules
  35202. continue;
  35203. }
  35204. configs.dipsIntoOuterContext = true; // TODO: can remove? only care when we add to set per middle of this method
  35205. newDepth -= 1;
  35206. if (this.debug) {
  35207. console.log("dips into outer ctx: " + c);
  35208. }
  35209. } else {
  35210. if (!t.isEpsilon && closureBusy.add(c)!==c){
  35211. // avoid infinite recursion for EOF* and EOF+
  35212. continue;
  35213. }
  35214. if (t instanceof RuleTransition) {
  35215. // latch when newDepth goes negative - once we step out of the entry context we can't return
  35216. if (newDepth >= 0) {
  35217. newDepth += 1;
  35218. }
  35219. }
  35220. }
  35221. this.closureCheckingStopState(c, configs, closureBusy, continueCollecting, fullCtx, newDepth, treatEofAsEpsilon);
  35222. }
  35223. }
  35224. };
  35225. ParserATNSimulator.prototype.canDropLoopEntryEdgeInLeftRecursiveRule = function(config) {
  35226. // return False
  35227. var p = config.state;
  35228. // First check to see if we are in StarLoopEntryState generated during
  35229. // left-recursion elimination. For efficiency, also check if
  35230. // the context has an empty stack case. If so, it would mean
  35231. // global FOLLOW so we can't perform optimization
  35232. // Are we the special loop entry/exit state? or SLL wildcard
  35233. if(p.stateType != ATNState.STAR_LOOP_ENTRY)
  35234. return false;
  35235. if(p.stateType != ATNState.STAR_LOOP_ENTRY || !p.isPrecedenceDecision ||
  35236. config.context.isEmpty() || config.context.hasEmptyPath())
  35237. return false;
  35238. // Require all return states to return back to the same rule that p is in.
  35239. var numCtxs = config.context.length;
  35240. for(var i=0; i<numCtxs; i++) { // for each stack context
  35241. var returnState = this.atn.states[config.context.getReturnState(i)];
  35242. if (returnState.ruleIndex != p.ruleIndex)
  35243. return false;
  35244. }
  35245. var decisionStartState = p.transitions[0].target;
  35246. var blockEndStateNum = decisionStartState.endState.stateNumber;
  35247. var blockEndState = this.atn.states[blockEndStateNum];
  35248. // Verify that the top of each stack context leads to loop entry/exit
  35249. // state through epsilon edges and w/o leaving rule.
  35250. for(var i=0; i<numCtxs; i++) { // for each stack context
  35251. var returnStateNumber = config.context.getReturnState(i);
  35252. var returnState = this.atn.states[returnStateNumber];
  35253. // all states must have single outgoing epsilon edge
  35254. if (returnState.transitions.length != 1 || !returnState.transitions[0].isEpsilon)
  35255. return false;
  35256. // Look for prefix op case like 'not expr', (' type ')' expr
  35257. var returnStateTarget = returnState.transitions[0].target;
  35258. if ( returnState.stateType == ATNState.BLOCK_END && returnStateTarget == p )
  35259. continue;
  35260. // Look for 'expr op expr' or case where expr's return state is block end
  35261. // of (...)* internal block; the block end points to loop back
  35262. // which points to p but we don't need to check that
  35263. if ( returnState == blockEndState )
  35264. continue;
  35265. // Look for ternary expr ? expr : expr. The return state points at block end,
  35266. // which points at loop entry state
  35267. if ( returnStateTarget == blockEndState )
  35268. continue;
  35269. // Look for complex prefix 'between expr and expr' case where 2nd expr's
  35270. // return state points at block end state of (...)* internal block
  35271. if (returnStateTarget.stateType == ATNState.BLOCK_END && returnStateTarget.transitions.length == 1
  35272. && returnStateTarget.transitions[0].isEpsilon && returnStateTarget.transitions[0].target == p)
  35273. continue;
  35274. // anything else ain't conforming
  35275. return false;
  35276. }
  35277. return true;
  35278. };
  35279. ParserATNSimulator.prototype.getRuleName = function( index) {
  35280. if (this.parser!==null && index>=0) {
  35281. return this.parser.ruleNames[index];
  35282. } else {
  35283. return "<rule " + index + ">";
  35284. }
  35285. };
  35286. ParserATNSimulator.prototype.getEpsilonTarget = function(config, t, collectPredicates, inContext, fullCtx, treatEofAsEpsilon) {
  35287. switch(t.serializationType) {
  35288. case Transition.RULE:
  35289. return this.ruleTransition(config, t);
  35290. case Transition.PRECEDENCE:
  35291. return this.precedenceTransition(config, t, collectPredicates, inContext, fullCtx);
  35292. case Transition.PREDICATE:
  35293. return this.predTransition(config, t, collectPredicates, inContext, fullCtx);
  35294. case Transition.ACTION:
  35295. return this.actionTransition(config, t);
  35296. case Transition.EPSILON:
  35297. return new ATNConfig({state:t.target}, config);
  35298. case Transition.ATOM:
  35299. case Transition.RANGE:
  35300. case Transition.SET:
  35301. // EOF transitions act like epsilon transitions after the first EOF
  35302. // transition is traversed
  35303. if (treatEofAsEpsilon) {
  35304. if (t.matches(Token.EOF, 0, 1)) {
  35305. return new ATNConfig({state: t.target}, config);
  35306. }
  35307. }
  35308. return null;
  35309. default:
  35310. return null;
  35311. }
  35312. };
  35313. ParserATNSimulator.prototype.actionTransition = function(config, t) {
  35314. if (this.debug) {
  35315. var index = t.actionIndex==-1 ? 65535 : t.actionIndex;
  35316. console.log("ACTION edge " + t.ruleIndex + ":" + index);
  35317. }
  35318. return new ATNConfig({state:t.target}, config);
  35319. };
  35320. ParserATNSimulator.prototype.precedenceTransition = function(config, pt, collectPredicates, inContext, fullCtx) {
  35321. if (this.debug) {
  35322. console.log("PRED (collectPredicates=" + collectPredicates + ") " +
  35323. pt.precedence + ">=_p, ctx dependent=true");
  35324. if (this.parser!==null) {
  35325. console.log("context surrounding pred is " + Utils.arrayToString(this.parser.getRuleInvocationStack()));
  35326. }
  35327. }
  35328. var c = null;
  35329. if (collectPredicates && inContext) {
  35330. if (fullCtx) {
  35331. // In full context mode, we can evaluate predicates on-the-fly
  35332. // during closure, which dramatically reduces the size of
  35333. // the config sets. It also obviates the need to test predicates
  35334. // later during conflict resolution.
  35335. var currentPosition = this._input.index;
  35336. this._input.seek(this._startIndex);
  35337. var predSucceeds = pt.getPredicate().evaluate(this.parser, this._outerContext);
  35338. this._input.seek(currentPosition);
  35339. if (predSucceeds) {
  35340. c = new ATNConfig({state:pt.target}, config); // no pred context
  35341. }
  35342. } else {
  35343. var newSemCtx = SemanticContext.andContext(config.semanticContext, pt.getPredicate());
  35344. c = new ATNConfig({state:pt.target, semanticContext:newSemCtx}, config);
  35345. }
  35346. } else {
  35347. c = new ATNConfig({state:pt.target}, config);
  35348. }
  35349. if (this.debug) {
  35350. console.log("config from pred transition=" + c);
  35351. }
  35352. return c;
  35353. };
  35354. ParserATNSimulator.prototype.predTransition = function(config, pt, collectPredicates, inContext, fullCtx) {
  35355. if (this.debug) {
  35356. console.log("PRED (collectPredicates=" + collectPredicates + ") " + pt.ruleIndex +
  35357. ":" + pt.predIndex + ", ctx dependent=" + pt.isCtxDependent);
  35358. if (this.parser!==null) {
  35359. console.log("context surrounding pred is " + Utils.arrayToString(this.parser.getRuleInvocationStack()));
  35360. }
  35361. }
  35362. var c = null;
  35363. if (collectPredicates && ((pt.isCtxDependent && inContext) || ! pt.isCtxDependent)) {
  35364. if (fullCtx) {
  35365. // In full context mode, we can evaluate predicates on-the-fly
  35366. // during closure, which dramatically reduces the size of
  35367. // the config sets. It also obviates the need to test predicates
  35368. // later during conflict resolution.
  35369. var currentPosition = this._input.index;
  35370. this._input.seek(this._startIndex);
  35371. var predSucceeds = pt.getPredicate().evaluate(this.parser, this._outerContext);
  35372. this._input.seek(currentPosition);
  35373. if (predSucceeds) {
  35374. c = new ATNConfig({state:pt.target}, config); // no pred context
  35375. }
  35376. } else {
  35377. var newSemCtx = SemanticContext.andContext(config.semanticContext, pt.getPredicate());
  35378. c = new ATNConfig({state:pt.target, semanticContext:newSemCtx}, config);
  35379. }
  35380. } else {
  35381. c = new ATNConfig({state:pt.target}, config);
  35382. }
  35383. if (this.debug) {
  35384. console.log("config from pred transition=" + c);
  35385. }
  35386. return c;
  35387. };
  35388. ParserATNSimulator.prototype.ruleTransition = function(config, t) {
  35389. if (this.debug) {
  35390. console.log("CALL rule " + this.getRuleName(t.target.ruleIndex) + ", ctx=" + config.context);
  35391. }
  35392. var returnState = t.followState;
  35393. var newContext = SingletonPredictionContext.create(config.context, returnState.stateNumber);
  35394. return new ATNConfig({state:t.target, context:newContext}, config );
  35395. };
  35396. ParserATNSimulator.prototype.getConflictingAlts = function(configs) {
  35397. var altsets = PredictionMode.getConflictingAltSubsets(configs);
  35398. return PredictionMode.getAlts(altsets);
  35399. };
  35400. // Sam pointed out a problem with the previous definition, v3, of
  35401. // ambiguous states. If we have another state associated with conflicting
  35402. // alternatives, we should keep going. For example, the following grammar
  35403. //
  35404. // s : (ID | ID ID?) ';' ;
  35405. //
  35406. // When the ATN simulation reaches the state before ';', it has a DFA
  35407. // state that looks like: [12|1|[], 6|2|[], 12|2|[]]. Naturally
  35408. // 12|1|[] and 12|2|[] conflict, but we cannot stop processing this node
  35409. // because alternative to has another way to continue, via [6|2|[]].
  35410. // The key is that we have a single state that has config's only associated
  35411. // with a single alternative, 2, and crucially the state transitions
  35412. // among the configurations are all non-epsilon transitions. That means
  35413. // we don't consider any conflicts that include alternative 2. So, we
  35414. // ignore the conflict between alts 1 and 2. We ignore a set of
  35415. // conflicting alts when there is an intersection with an alternative
  35416. // associated with a single alt state in the state&rarr;config-list map.
  35417. //
  35418. // It's also the case that we might have two conflicting configurations but
  35419. // also a 3rd nonconflicting configuration for a different alternative:
  35420. // [1|1|[], 1|2|[], 8|3|[]]. This can come about from grammar:
  35421. //
  35422. // a : A | A | A B ;
  35423. //
  35424. // After matching input A, we reach the stop state for rule A, state 1.
  35425. // State 8 is the state right before B. Clearly alternatives 1 and 2
  35426. // conflict and no amount of further lookahead will separate the two.
  35427. // However, alternative 3 will be able to continue and so we do not
  35428. // stop working on this state. In the previous example, we're concerned
  35429. // with states associated with the conflicting alternatives. Here alt
  35430. // 3 is not associated with the conflicting configs, but since we can continue
  35431. // looking for input reasonably, I don't declare the state done. We
  35432. // ignore a set of conflicting alts when we have an alternative
  35433. // that we still need to pursue.
  35434. //
  35435. ParserATNSimulator.prototype.getConflictingAltsOrUniqueAlt = function(configs) {
  35436. var conflictingAlts = null;
  35437. if (configs.uniqueAlt!== ATN.INVALID_ALT_NUMBER) {
  35438. conflictingAlts = new BitSet();
  35439. conflictingAlts.add(configs.uniqueAlt);
  35440. } else {
  35441. conflictingAlts = configs.conflictingAlts;
  35442. }
  35443. return conflictingAlts;
  35444. };
  35445. ParserATNSimulator.prototype.getTokenName = function( t) {
  35446. if (t===Token.EOF) {
  35447. return "EOF";
  35448. }
  35449. if( this.parser!==null && this.parser.literalNames!==null) {
  35450. if (t >= this.parser.literalNames.length && t >= this.parser.symbolicNames.length) {
  35451. console.log("" + t + " ttype out of range: " + this.parser.literalNames);
  35452. console.log("" + this.parser.getInputStream().getTokens());
  35453. } else {
  35454. var name = this.parser.literalNames[t] || this.parser.symbolicNames[t];
  35455. return name + "<" + t + ">";
  35456. }
  35457. }
  35458. return "" + t;
  35459. };
  35460. ParserATNSimulator.prototype.getLookaheadName = function(input) {
  35461. return this.getTokenName(input.LA(1));
  35462. };
  35463. // Used for debugging in adaptivePredict around execATN but I cut
  35464. // it out for clarity now that alg. works well. We can leave this
  35465. // "dead" code for a bit.
  35466. //
  35467. ParserATNSimulator.prototype.dumpDeadEndConfigs = function(nvae) {
  35468. console.log("dead end configs: ");
  35469. var decs = nvae.getDeadEndConfigs();
  35470. for(var i=0; i<decs.length; i++) {
  35471. var c = decs[i];
  35472. var trans = "no edges";
  35473. if (c.state.transitions.length>0) {
  35474. var t = c.state.transitions[0];
  35475. if (t instanceof AtomTransition) {
  35476. trans = "Atom "+ this.getTokenName(t.label);
  35477. } else if (t instanceof SetTransition) {
  35478. var neg = (t instanceof NotSetTransition);
  35479. trans = (neg ? "~" : "") + "Set " + t.set;
  35480. }
  35481. }
  35482. console.error(c.toString(this.parser, true) + ":" + trans);
  35483. }
  35484. };
  35485. ParserATNSimulator.prototype.noViableAlt = function(input, outerContext, configs, startIndex) {
  35486. return new NoViableAltException(this.parser, input, input.get(startIndex), input.LT(1), configs, outerContext);
  35487. };
  35488. ParserATNSimulator.prototype.getUniqueAlt = function(configs) {
  35489. var alt = ATN.INVALID_ALT_NUMBER;
  35490. for(var i=0;i<configs.items.length;i++) {
  35491. var c = configs.items[i];
  35492. if (alt === ATN.INVALID_ALT_NUMBER) {
  35493. alt = c.alt // found first alt
  35494. } else if( c.alt!==alt) {
  35495. return ATN.INVALID_ALT_NUMBER;
  35496. }
  35497. }
  35498. return alt;
  35499. };
  35500. //
  35501. // Add an edge to the DFA, if possible. This method calls
  35502. // {@link //addDFAState} to ensure the {@code to} state is present in the
  35503. // DFA. If {@code from} is {@code null}, or if {@code t} is outside the
  35504. // range of edges that can be represented in the DFA tables, this method
  35505. // returns without adding the edge to the DFA.
  35506. //
  35507. // <p>If {@code to} is {@code null}, this method returns {@code null}.
  35508. // Otherwise, this method returns the {@link DFAState} returned by calling
  35509. // {@link //addDFAState} for the {@code to} state.</p>
  35510. //
  35511. // @param dfa The DFA
  35512. // @param from The source state for the edge
  35513. // @param t The input symbol
  35514. // @param to The target state for the edge
  35515. //
  35516. // @return If {@code to} is {@code null}, this method returns {@code null};
  35517. // otherwise this method returns the result of calling {@link //addDFAState}
  35518. // on {@code to}
  35519. //
  35520. ParserATNSimulator.prototype.addDFAEdge = function(dfa, from_, t, to) {
  35521. if( this.debug) {
  35522. console.log("EDGE " + from_ + " -> " + to + " upon " + this.getTokenName(t));
  35523. }
  35524. if (to===null) {
  35525. return null;
  35526. }
  35527. to = this.addDFAState(dfa, to); // used existing if possible not incoming
  35528. if (from_===null || t < -1 || t > this.atn.maxTokenType) {
  35529. return to;
  35530. }
  35531. if (from_.edges===null) {
  35532. from_.edges = [];
  35533. }
  35534. from_.edges[t+1] = to; // connect
  35535. if (this.debug) {
  35536. var literalNames = this.parser===null ? null : this.parser.literalNames;
  35537. var symbolicNames = this.parser===null ? null : this.parser.symbolicNames;
  35538. console.log("DFA=\n" + dfa.toString(literalNames, symbolicNames));
  35539. }
  35540. return to;
  35541. };
  35542. //
  35543. // Add state {@code D} to the DFA if it is not already present, and return
  35544. // the actual instance stored in the DFA. If a state equivalent to {@code D}
  35545. // is already in the DFA, the existing state is returned. Otherwise this
  35546. // method returns {@code D} after adding it to the DFA.
  35547. //
  35548. // <p>If {@code D} is {@link //ERROR}, this method returns {@link //ERROR} and
  35549. // does not change the DFA.</p>
  35550. //
  35551. // @param dfa The dfa
  35552. // @param D The DFA state to add
  35553. // @return The state stored in the DFA. This will be either the existing
  35554. // state if {@code D} is already in the DFA, or {@code D} itself if the
  35555. // state was not already present.
  35556. //
  35557. ParserATNSimulator.prototype.addDFAState = function(dfa, D) {
  35558. if (D == ATNSimulator.ERROR) {
  35559. return D;
  35560. }
  35561. var existing = dfa.states.get(D);
  35562. if(existing!==null) {
  35563. return existing;
  35564. }
  35565. D.stateNumber = dfa.states.length;
  35566. if (! D.configs.readOnly) {
  35567. D.configs.optimizeConfigs(this);
  35568. D.configs.setReadonly(true);
  35569. }
  35570. dfa.states.add(D);
  35571. if (this.debug) {
  35572. console.log("adding new DFA state: " + D);
  35573. }
  35574. return D;
  35575. };
  35576. ParserATNSimulator.prototype.reportAttemptingFullContext = function(dfa, conflictingAlts, configs, startIndex, stopIndex) {
  35577. if (this.debug || this.retry_debug) {
  35578. var interval = new Interval(startIndex, stopIndex + 1);
  35579. console.log("reportAttemptingFullContext decision=" + dfa.decision + ":" + configs +
  35580. ", input=" + this.parser.getTokenStream().getText(interval));
  35581. }
  35582. if (this.parser!==null) {
  35583. this.parser.getErrorListenerDispatch().reportAttemptingFullContext(this.parser, dfa, startIndex, stopIndex, conflictingAlts, configs);
  35584. }
  35585. };
  35586. ParserATNSimulator.prototype.reportContextSensitivity = function(dfa, prediction, configs, startIndex, stopIndex) {
  35587. if (this.debug || this.retry_debug) {
  35588. var interval = new Interval(startIndex, stopIndex + 1);
  35589. console.log("reportContextSensitivity decision=" + dfa.decision + ":" + configs +
  35590. ", input=" + this.parser.getTokenStream().getText(interval));
  35591. }
  35592. if (this.parser!==null) {
  35593. this.parser.getErrorListenerDispatch().reportContextSensitivity(this.parser, dfa, startIndex, stopIndex, prediction, configs);
  35594. }
  35595. };
  35596. // If context sensitive parsing, we know it's ambiguity not conflict//
  35597. ParserATNSimulator.prototype.reportAmbiguity = function(dfa, D, startIndex, stopIndex,
  35598. exact, ambigAlts, configs ) {
  35599. if (this.debug || this.retry_debug) {
  35600. var interval = new Interval(startIndex, stopIndex + 1);
  35601. console.log("reportAmbiguity " + ambigAlts + ":" + configs +
  35602. ", input=" + this.parser.getTokenStream().getText(interval));
  35603. }
  35604. if (this.parser!==null) {
  35605. this.parser.getErrorListenerDispatch().reportAmbiguity(this.parser, dfa, startIndex, stopIndex, exact, ambigAlts, configs);
  35606. }
  35607. };
  35608. exports.ParserATNSimulator = ParserATNSimulator;
  35609. /***/ }),
  35610. /***/ "./node_modules/antlr4/atn/PredictionMode.js":
  35611. /*!***************************************************!*\
  35612. !*** ./node_modules/antlr4/atn/PredictionMode.js ***!
  35613. \***************************************************/
  35614. /*! no static exports found */
  35615. /***/ (function(module, exports, __webpack_require__) {
  35616. //
  35617. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  35618. * Use of this file is governed by the BSD 3-clause license that
  35619. * can be found in the LICENSE.txt file in the project root.
  35620. */
  35621. //
  35622. //
  35623. // This enumeration defines the prediction modes available in ANTLR 4 along with
  35624. // utility methods for analyzing configuration sets for conflicts and/or
  35625. // ambiguities.
  35626. var Set = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js").Set;
  35627. var Map = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js").Map;
  35628. var BitSet = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js").BitSet;
  35629. var AltDict = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js").AltDict;
  35630. var ATN = __webpack_require__(/*! ./ATN */ "./node_modules/antlr4/atn/ATN.js").ATN;
  35631. var RuleStopState = __webpack_require__(/*! ./ATNState */ "./node_modules/antlr4/atn/ATNState.js").RuleStopState;
  35632. var ATNConfigSet = __webpack_require__(/*! ./ATNConfigSet */ "./node_modules/antlr4/atn/ATNConfigSet.js").ATNConfigSet;
  35633. var ATNConfig = __webpack_require__(/*! ./ATNConfig */ "./node_modules/antlr4/atn/ATNConfig.js").ATNConfig;
  35634. var SemanticContext = __webpack_require__(/*! ./SemanticContext */ "./node_modules/antlr4/atn/SemanticContext.js").SemanticContext;
  35635. var Hash = __webpack_require__(/*! ../Utils */ "./node_modules/antlr4/Utils.js").Hash;
  35636. var hashStuff = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js").hashStuff;
  35637. var equalArrays = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js").equalArrays;
  35638. function PredictionMode() {
  35639. return this;
  35640. }
  35641. //
  35642. // The SLL(*) prediction mode. This prediction mode ignores the current
  35643. // parser context when making predictions. This is the fastest prediction
  35644. // mode, and provides correct results for many grammars. This prediction
  35645. // mode is more powerful than the prediction mode provided by ANTLR 3, but
  35646. // may result in syntax errors for grammar and input combinations which are
  35647. // not SLL.
  35648. //
  35649. // <p>
  35650. // When using this prediction mode, the parser will either return a correct
  35651. // parse tree (i.e. the same parse tree that would be returned with the
  35652. // {@link //LL} prediction mode), or it will report a syntax error. If a
  35653. // syntax error is encountered when using the {@link //SLL} prediction mode,
  35654. // it may be due to either an actual syntax error in the input or indicate
  35655. // that the particular combination of grammar and input requires the more
  35656. // powerful {@link //LL} prediction abilities to complete successfully.</p>
  35657. //
  35658. // <p>
  35659. // This prediction mode does not provide any guarantees for prediction
  35660. // behavior for syntactically-incorrect inputs.</p>
  35661. //
  35662. PredictionMode.SLL = 0;
  35663. //
  35664. // The LL(*) prediction mode. This prediction mode allows the current parser
  35665. // context to be used for resolving SLL conflicts that occur during
  35666. // prediction. This is the fastest prediction mode that guarantees correct
  35667. // parse results for all combinations of grammars with syntactically correct
  35668. // inputs.
  35669. //
  35670. // <p>
  35671. // When using this prediction mode, the parser will make correct decisions
  35672. // for all syntactically-correct grammar and input combinations. However, in
  35673. // cases where the grammar is truly ambiguous this prediction mode might not
  35674. // report a precise answer for <em>exactly which</em> alternatives are
  35675. // ambiguous.</p>
  35676. //
  35677. // <p>
  35678. // This prediction mode does not provide any guarantees for prediction
  35679. // behavior for syntactically-incorrect inputs.</p>
  35680. //
  35681. PredictionMode.LL = 1;
  35682. //
  35683. // The LL(*) prediction mode with exact ambiguity detection. In addition to
  35684. // the correctness guarantees provided by the {@link //LL} prediction mode,
  35685. // this prediction mode instructs the prediction algorithm to determine the
  35686. // complete and exact set of ambiguous alternatives for every ambiguous
  35687. // decision encountered while parsing.
  35688. //
  35689. // <p>
  35690. // This prediction mode may be used for diagnosing ambiguities during
  35691. // grammar development. Due to the performance overhead of calculating sets
  35692. // of ambiguous alternatives, this prediction mode should be avoided when
  35693. // the exact results are not necessary.</p>
  35694. //
  35695. // <p>
  35696. // This prediction mode does not provide any guarantees for prediction
  35697. // behavior for syntactically-incorrect inputs.</p>
  35698. //
  35699. PredictionMode.LL_EXACT_AMBIG_DETECTION = 2;
  35700. //
  35701. // Computes the SLL prediction termination condition.
  35702. //
  35703. // <p>
  35704. // This method computes the SLL prediction termination condition for both of
  35705. // the following cases.</p>
  35706. //
  35707. // <ul>
  35708. // <li>The usual SLL+LL fallback upon SLL conflict</li>
  35709. // <li>Pure SLL without LL fallback</li>
  35710. // </ul>
  35711. //
  35712. // <p><strong>COMBINED SLL+LL PARSING</strong></p>
  35713. //
  35714. // <p>When LL-fallback is enabled upon SLL conflict, correct predictions are
  35715. // ensured regardless of how the termination condition is computed by this
  35716. // method. Due to the substantially higher cost of LL prediction, the
  35717. // prediction should only fall back to LL when the additional lookahead
  35718. // cannot lead to a unique SLL prediction.</p>
  35719. //
  35720. // <p>Assuming combined SLL+LL parsing, an SLL configuration set with only
  35721. // conflicting subsets should fall back to full LL, even if the
  35722. // configuration sets don't resolve to the same alternative (e.g.
  35723. // {@code {1,2}} and {@code {3,4}}. If there is at least one non-conflicting
  35724. // configuration, SLL could continue with the hopes that more lookahead will
  35725. // resolve via one of those non-conflicting configurations.</p>
  35726. //
  35727. // <p>Here's the prediction termination rule them: SLL (for SLL+LL parsing)
  35728. // stops when it sees only conflicting configuration subsets. In contrast,
  35729. // full LL keeps going when there is uncertainty.</p>
  35730. //
  35731. // <p><strong>HEURISTIC</strong></p>
  35732. //
  35733. // <p>As a heuristic, we stop prediction when we see any conflicting subset
  35734. // unless we see a state that only has one alternative associated with it.
  35735. // The single-alt-state thing lets prediction continue upon rules like
  35736. // (otherwise, it would admit defeat too soon):</p>
  35737. //
  35738. // <p>{@code [12|1|[], 6|2|[], 12|2|[]]. s : (ID | ID ID?) ';' ;}</p>
  35739. //
  35740. // <p>When the ATN simulation reaches the state before {@code ';'}, it has a
  35741. // DFA state that looks like: {@code [12|1|[], 6|2|[], 12|2|[]]}. Naturally
  35742. // {@code 12|1|[]} and {@code 12|2|[]} conflict, but we cannot stop
  35743. // processing this node because alternative to has another way to continue,
  35744. // via {@code [6|2|[]]}.</p>
  35745. //
  35746. // <p>It also let's us continue for this rule:</p>
  35747. //
  35748. // <p>{@code [1|1|[], 1|2|[], 8|3|[]] a : A | A | A B ;}</p>
  35749. //
  35750. // <p>After matching input A, we reach the stop state for rule A, state 1.
  35751. // State 8 is the state right before B. Clearly alternatives 1 and 2
  35752. // conflict and no amount of further lookahead will separate the two.
  35753. // However, alternative 3 will be able to continue and so we do not stop
  35754. // working on this state. In the previous example, we're concerned with
  35755. // states associated with the conflicting alternatives. Here alt 3 is not
  35756. // associated with the conflicting configs, but since we can continue
  35757. // looking for input reasonably, don't declare the state done.</p>
  35758. //
  35759. // <p><strong>PURE SLL PARSING</strong></p>
  35760. //
  35761. // <p>To handle pure SLL parsing, all we have to do is make sure that we
  35762. // combine stack contexts for configurations that differ only by semantic
  35763. // predicate. From there, we can do the usual SLL termination heuristic.</p>
  35764. //
  35765. // <p><strong>PREDICATES IN SLL+LL PARSING</strong></p>
  35766. //
  35767. // <p>SLL decisions don't evaluate predicates until after they reach DFA stop
  35768. // states because they need to create the DFA cache that works in all
  35769. // semantic situations. In contrast, full LL evaluates predicates collected
  35770. // during start state computation so it can ignore predicates thereafter.
  35771. // This means that SLL termination detection can totally ignore semantic
  35772. // predicates.</p>
  35773. //
  35774. // <p>Implementation-wise, {@link ATNConfigSet} combines stack contexts but not
  35775. // semantic predicate contexts so we might see two configurations like the
  35776. // following.</p>
  35777. //
  35778. // <p>{@code (s, 1, x, {}), (s, 1, x', {p})}</p>
  35779. //
  35780. // <p>Before testing these configurations against others, we have to merge
  35781. // {@code x} and {@code x'} (without modifying the existing configurations).
  35782. // For example, we test {@code (x+x')==x''} when looking for conflicts in
  35783. // the following configurations.</p>
  35784. //
  35785. // <p>{@code (s, 1, x, {}), (s, 1, x', {p}), (s, 2, x'', {})}</p>
  35786. //
  35787. // <p>If the configuration set has predicates (as indicated by
  35788. // {@link ATNConfigSet//hasSemanticContext}), this algorithm makes a copy of
  35789. // the configurations to strip out all of the predicates so that a standard
  35790. // {@link ATNConfigSet} will merge everything ignoring predicates.</p>
  35791. //
  35792. PredictionMode.hasSLLConflictTerminatingPrediction = function( mode, configs) {
  35793. // Configs in rule stop states indicate reaching the end of the decision
  35794. // rule (local context) or end of start rule (full context). If all
  35795. // configs meet this condition, then none of the configurations is able
  35796. // to match additional input so we terminate prediction.
  35797. //
  35798. if (PredictionMode.allConfigsInRuleStopStates(configs)) {
  35799. return true;
  35800. }
  35801. // pure SLL mode parsing
  35802. if (mode === PredictionMode.SLL) {
  35803. // Don't bother with combining configs from different semantic
  35804. // contexts if we can fail over to full LL; costs more time
  35805. // since we'll often fail over anyway.
  35806. if (configs.hasSemanticContext) {
  35807. // dup configs, tossing out semantic predicates
  35808. var dup = new ATNConfigSet();
  35809. for(var i=0;i<configs.items.length;i++) {
  35810. var c = configs.items[i];
  35811. c = new ATNConfig({semanticContext:SemanticContext.NONE}, c);
  35812. dup.add(c);
  35813. }
  35814. configs = dup;
  35815. }
  35816. // now we have combined contexts for configs with dissimilar preds
  35817. }
  35818. // pure SLL or combined SLL+LL mode parsing
  35819. var altsets = PredictionMode.getConflictingAltSubsets(configs);
  35820. return PredictionMode.hasConflictingAltSet(altsets) && !PredictionMode.hasStateAssociatedWithOneAlt(configs);
  35821. };
  35822. // Checks if any configuration in {@code configs} is in a
  35823. // {@link RuleStopState}. Configurations meeting this condition have reached
  35824. // the end of the decision rule (local context) or end of start rule (full
  35825. // context).
  35826. //
  35827. // @param configs the configuration set to test
  35828. // @return {@code true} if any configuration in {@code configs} is in a
  35829. // {@link RuleStopState}, otherwise {@code false}
  35830. PredictionMode.hasConfigInRuleStopState = function(configs) {
  35831. for(var i=0;i<configs.items.length;i++) {
  35832. var c = configs.items[i];
  35833. if (c.state instanceof RuleStopState) {
  35834. return true;
  35835. }
  35836. }
  35837. return false;
  35838. };
  35839. // Checks if all configurations in {@code configs} are in a
  35840. // {@link RuleStopState}. Configurations meeting this condition have reached
  35841. // the end of the decision rule (local context) or end of start rule (full
  35842. // context).
  35843. //
  35844. // @param configs the configuration set to test
  35845. // @return {@code true} if all configurations in {@code configs} are in a
  35846. // {@link RuleStopState}, otherwise {@code false}
  35847. PredictionMode.allConfigsInRuleStopStates = function(configs) {
  35848. for(var i=0;i<configs.items.length;i++) {
  35849. var c = configs.items[i];
  35850. if (!(c.state instanceof RuleStopState)) {
  35851. return false;
  35852. }
  35853. }
  35854. return true;
  35855. };
  35856. //
  35857. // Full LL prediction termination.
  35858. //
  35859. // <p>Can we stop looking ahead during ATN simulation or is there some
  35860. // uncertainty as to which alternative we will ultimately pick, after
  35861. // consuming more input? Even if there are partial conflicts, we might know
  35862. // that everything is going to resolve to the same minimum alternative. That
  35863. // means we can stop since no more lookahead will change that fact. On the
  35864. // other hand, there might be multiple conflicts that resolve to different
  35865. // minimums. That means we need more look ahead to decide which of those
  35866. // alternatives we should predict.</p>
  35867. //
  35868. // <p>The basic idea is to split the set of configurations {@code C}, into
  35869. // conflicting subsets {@code (s, _, ctx, _)} and singleton subsets with
  35870. // non-conflicting configurations. Two configurations conflict if they have
  35871. // identical {@link ATNConfig//state} and {@link ATNConfig//context} values
  35872. // but different {@link ATNConfig//alt} value, e.g. {@code (s, i, ctx, _)}
  35873. // and {@code (s, j, ctx, _)} for {@code i!=j}.</p>
  35874. //
  35875. // <p>Reduce these configuration subsets to the set of possible alternatives.
  35876. // You can compute the alternative subsets in one pass as follows:</p>
  35877. //
  35878. // <p>{@code A_s,ctx = {i | (s, i, ctx, _)}} for each configuration in
  35879. // {@code C} holding {@code s} and {@code ctx} fixed.</p>
  35880. //
  35881. // <p>Or in pseudo-code, for each configuration {@code c} in {@code C}:</p>
  35882. //
  35883. // <pre>
  35884. // map[c] U= c.{@link ATNConfig//alt alt} // map hash/equals uses s and x, not
  35885. // alt and not pred
  35886. // </pre>
  35887. //
  35888. // <p>The values in {@code map} are the set of {@code A_s,ctx} sets.</p>
  35889. //
  35890. // <p>If {@code |A_s,ctx|=1} then there is no conflict associated with
  35891. // {@code s} and {@code ctx}.</p>
  35892. //
  35893. // <p>Reduce the subsets to singletons by choosing a minimum of each subset. If
  35894. // the union of these alternative subsets is a singleton, then no amount of
  35895. // more lookahead will help us. We will always pick that alternative. If,
  35896. // however, there is more than one alternative, then we are uncertain which
  35897. // alternative to predict and must continue looking for resolution. We may
  35898. // or may not discover an ambiguity in the future, even if there are no
  35899. // conflicting subsets this round.</p>
  35900. //
  35901. // <p>The biggest sin is to terminate early because it means we've made a
  35902. // decision but were uncertain as to the eventual outcome. We haven't used
  35903. // enough lookahead. On the other hand, announcing a conflict too late is no
  35904. // big deal; you will still have the conflict. It's just inefficient. It
  35905. // might even look until the end of file.</p>
  35906. //
  35907. // <p>No special consideration for semantic predicates is required because
  35908. // predicates are evaluated on-the-fly for full LL prediction, ensuring that
  35909. // no configuration contains a semantic context during the termination
  35910. // check.</p>
  35911. //
  35912. // <p><strong>CONFLICTING CONFIGS</strong></p>
  35913. //
  35914. // <p>Two configurations {@code (s, i, x)} and {@code (s, j, x')}, conflict
  35915. // when {@code i!=j} but {@code x=x'}. Because we merge all
  35916. // {@code (s, i, _)} configurations together, that means that there are at
  35917. // most {@code n} configurations associated with state {@code s} for
  35918. // {@code n} possible alternatives in the decision. The merged stacks
  35919. // complicate the comparison of configuration contexts {@code x} and
  35920. // {@code x'}. Sam checks to see if one is a subset of the other by calling
  35921. // merge and checking to see if the merged result is either {@code x} or
  35922. // {@code x'}. If the {@code x} associated with lowest alternative {@code i}
  35923. // is the superset, then {@code i} is the only possible prediction since the
  35924. // others resolve to {@code min(i)} as well. However, if {@code x} is
  35925. // associated with {@code j>i} then at least one stack configuration for
  35926. // {@code j} is not in conflict with alternative {@code i}. The algorithm
  35927. // should keep going, looking for more lookahead due to the uncertainty.</p>
  35928. //
  35929. // <p>For simplicity, I'm doing a equality check between {@code x} and
  35930. // {@code x'} that lets the algorithm continue to consume lookahead longer
  35931. // than necessary. The reason I like the equality is of course the
  35932. // simplicity but also because that is the test you need to detect the
  35933. // alternatives that are actually in conflict.</p>
  35934. //
  35935. // <p><strong>CONTINUE/STOP RULE</strong></p>
  35936. //
  35937. // <p>Continue if union of resolved alternative sets from non-conflicting and
  35938. // conflicting alternative subsets has more than one alternative. We are
  35939. // uncertain about which alternative to predict.</p>
  35940. //
  35941. // <p>The complete set of alternatives, {@code [i for (_,i,_)]}, tells us which
  35942. // alternatives are still in the running for the amount of input we've
  35943. // consumed at this point. The conflicting sets let us to strip away
  35944. // configurations that won't lead to more states because we resolve
  35945. // conflicts to the configuration with a minimum alternate for the
  35946. // conflicting set.</p>
  35947. //
  35948. // <p><strong>CASES</strong></p>
  35949. //
  35950. // <ul>
  35951. //
  35952. // <li>no conflicts and more than 1 alternative in set =&gt; continue</li>
  35953. //
  35954. // <li> {@code (s, 1, x)}, {@code (s, 2, x)}, {@code (s, 3, z)},
  35955. // {@code (s', 1, y)}, {@code (s', 2, y)} yields non-conflicting set
  35956. // {@code {3}} U conflicting sets {@code min({1,2})} U {@code min({1,2})} =
  35957. // {@code {1,3}} =&gt; continue
  35958. // </li>
  35959. //
  35960. // <li>{@code (s, 1, x)}, {@code (s, 2, x)}, {@code (s', 1, y)},
  35961. // {@code (s', 2, y)}, {@code (s'', 1, z)} yields non-conflicting set
  35962. // {@code {1}} U conflicting sets {@code min({1,2})} U {@code min({1,2})} =
  35963. // {@code {1}} =&gt; stop and predict 1</li>
  35964. //
  35965. // <li>{@code (s, 1, x)}, {@code (s, 2, x)}, {@code (s', 1, y)},
  35966. // {@code (s', 2, y)} yields conflicting, reduced sets {@code {1}} U
  35967. // {@code {1}} = {@code {1}} =&gt; stop and predict 1, can announce
  35968. // ambiguity {@code {1,2}}</li>
  35969. //
  35970. // <li>{@code (s, 1, x)}, {@code (s, 2, x)}, {@code (s', 2, y)},
  35971. // {@code (s', 3, y)} yields conflicting, reduced sets {@code {1}} U
  35972. // {@code {2}} = {@code {1,2}} =&gt; continue</li>
  35973. //
  35974. // <li>{@code (s, 1, x)}, {@code (s, 2, x)}, {@code (s', 3, y)},
  35975. // {@code (s', 4, y)} yields conflicting, reduced sets {@code {1}} U
  35976. // {@code {3}} = {@code {1,3}} =&gt; continue</li>
  35977. //
  35978. // </ul>
  35979. //
  35980. // <p><strong>EXACT AMBIGUITY DETECTION</strong></p>
  35981. //
  35982. // <p>If all states report the same conflicting set of alternatives, then we
  35983. // know we have the exact ambiguity set.</p>
  35984. //
  35985. // <p><code>|A_<em>i</em>|&gt;1</code> and
  35986. // <code>A_<em>i</em> = A_<em>j</em></code> for all <em>i</em>, <em>j</em>.</p>
  35987. //
  35988. // <p>In other words, we continue examining lookahead until all {@code A_i}
  35989. // have more than one alternative and all {@code A_i} are the same. If
  35990. // {@code A={{1,2}, {1,3}}}, then regular LL prediction would terminate
  35991. // because the resolved set is {@code {1}}. To determine what the real
  35992. // ambiguity is, we have to know whether the ambiguity is between one and
  35993. // two or one and three so we keep going. We can only stop prediction when
  35994. // we need exact ambiguity detection when the sets look like
  35995. // {@code A={{1,2}}} or {@code {{1,2},{1,2}}}, etc...</p>
  35996. //
  35997. PredictionMode.resolvesToJustOneViableAlt = function(altsets) {
  35998. return PredictionMode.getSingleViableAlt(altsets);
  35999. };
  36000. //
  36001. // Determines if every alternative subset in {@code altsets} contains more
  36002. // than one alternative.
  36003. //
  36004. // @param altsets a collection of alternative subsets
  36005. // @return {@code true} if every {@link BitSet} in {@code altsets} has
  36006. // {@link BitSet//cardinality cardinality} &gt; 1, otherwise {@code false}
  36007. //
  36008. PredictionMode.allSubsetsConflict = function(altsets) {
  36009. return ! PredictionMode.hasNonConflictingAltSet(altsets);
  36010. };
  36011. //
  36012. // Determines if any single alternative subset in {@code altsets} contains
  36013. // exactly one alternative.
  36014. //
  36015. // @param altsets a collection of alternative subsets
  36016. // @return {@code true} if {@code altsets} contains a {@link BitSet} with
  36017. // {@link BitSet//cardinality cardinality} 1, otherwise {@code false}
  36018. //
  36019. PredictionMode.hasNonConflictingAltSet = function(altsets) {
  36020. for(var i=0;i<altsets.length;i++) {
  36021. var alts = altsets[i];
  36022. if (alts.length===1) {
  36023. return true;
  36024. }
  36025. }
  36026. return false;
  36027. };
  36028. //
  36029. // Determines if any single alternative subset in {@code altsets} contains
  36030. // more than one alternative.
  36031. //
  36032. // @param altsets a collection of alternative subsets
  36033. // @return {@code true} if {@code altsets} contains a {@link BitSet} with
  36034. // {@link BitSet//cardinality cardinality} &gt; 1, otherwise {@code false}
  36035. //
  36036. PredictionMode.hasConflictingAltSet = function(altsets) {
  36037. for(var i=0;i<altsets.length;i++) {
  36038. var alts = altsets[i];
  36039. if (alts.length>1) {
  36040. return true;
  36041. }
  36042. }
  36043. return false;
  36044. };
  36045. //
  36046. // Determines if every alternative subset in {@code altsets} is equivalent.
  36047. //
  36048. // @param altsets a collection of alternative subsets
  36049. // @return {@code true} if every member of {@code altsets} is equal to the
  36050. // others, otherwise {@code false}
  36051. //
  36052. PredictionMode.allSubsetsEqual = function(altsets) {
  36053. var first = null;
  36054. for(var i=0;i<altsets.length;i++) {
  36055. var alts = altsets[i];
  36056. if (first === null) {
  36057. first = alts;
  36058. } else if (alts!==first) {
  36059. return false;
  36060. }
  36061. }
  36062. return true;
  36063. };
  36064. //
  36065. // Returns the unique alternative predicted by all alternative subsets in
  36066. // {@code altsets}. If no such alternative exists, this method returns
  36067. // {@link ATN//INVALID_ALT_NUMBER}.
  36068. //
  36069. // @param altsets a collection of alternative subsets
  36070. //
  36071. PredictionMode.getUniqueAlt = function(altsets) {
  36072. var all = PredictionMode.getAlts(altsets);
  36073. if (all.length===1) {
  36074. return all.minValue();
  36075. } else {
  36076. return ATN.INVALID_ALT_NUMBER;
  36077. }
  36078. };
  36079. // Gets the complete set of represented alternatives for a collection of
  36080. // alternative subsets. This method returns the union of each {@link BitSet}
  36081. // in {@code altsets}.
  36082. //
  36083. // @param altsets a collection of alternative subsets
  36084. // @return the set of represented alternatives in {@code altsets}
  36085. //
  36086. PredictionMode.getAlts = function(altsets) {
  36087. var all = new BitSet();
  36088. altsets.map( function(alts) { all.or(alts); });
  36089. return all;
  36090. };
  36091. //
  36092. // This function gets the conflicting alt subsets from a configuration set.
  36093. // For each configuration {@code c} in {@code configs}:
  36094. //
  36095. // <pre>
  36096. // map[c] U= c.{@link ATNConfig//alt alt} // map hash/equals uses s and x, not
  36097. // alt and not pred
  36098. // </pre>
  36099. PredictionMode.getConflictingAltSubsets = function(configs) {
  36100. var configToAlts = new Map();
  36101. configToAlts.hashFunction = function(cfg) { hashStuff(cfg.state.stateNumber, cfg.context); };
  36102. configToAlts.equalsFunction = function(c1, c2) { return c1.state.stateNumber==c2.state.stateNumber && c1.context.equals(c2.context);}
  36103. configs.items.map(function(cfg) {
  36104. var alts = configToAlts.get(cfg);
  36105. if (alts === null) {
  36106. alts = new BitSet();
  36107. configToAlts.put(cfg, alts);
  36108. }
  36109. alts.add(cfg.alt);
  36110. });
  36111. return configToAlts.getValues();
  36112. };
  36113. //
  36114. // Get a map from state to alt subset from a configuration set. For each
  36115. // configuration {@code c} in {@code configs}:
  36116. //
  36117. // <pre>
  36118. // map[c.{@link ATNConfig//state state}] U= c.{@link ATNConfig//alt alt}
  36119. // </pre>
  36120. //
  36121. PredictionMode.getStateToAltMap = function(configs) {
  36122. var m = new AltDict();
  36123. configs.items.map(function(c) {
  36124. var alts = m.get(c.state);
  36125. if (alts === null) {
  36126. alts = new BitSet();
  36127. m.put(c.state, alts);
  36128. }
  36129. alts.add(c.alt);
  36130. });
  36131. return m;
  36132. };
  36133. PredictionMode.hasStateAssociatedWithOneAlt = function(configs) {
  36134. var values = PredictionMode.getStateToAltMap(configs).values();
  36135. for(var i=0;i<values.length;i++) {
  36136. if (values[i].length===1) {
  36137. return true;
  36138. }
  36139. }
  36140. return false;
  36141. };
  36142. PredictionMode.getSingleViableAlt = function(altsets) {
  36143. var result = null;
  36144. for(var i=0;i<altsets.length;i++) {
  36145. var alts = altsets[i];
  36146. var minAlt = alts.minValue();
  36147. if(result===null) {
  36148. result = minAlt;
  36149. } else if(result!==minAlt) { // more than 1 viable alt
  36150. return ATN.INVALID_ALT_NUMBER;
  36151. }
  36152. }
  36153. return result;
  36154. };
  36155. exports.PredictionMode = PredictionMode;
  36156. /***/ }),
  36157. /***/ "./node_modules/antlr4/atn/SemanticContext.js":
  36158. /*!****************************************************!*\
  36159. !*** ./node_modules/antlr4/atn/SemanticContext.js ***!
  36160. \****************************************************/
  36161. /*! no static exports found */
  36162. /***/ (function(module, exports, __webpack_require__) {
  36163. //
  36164. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  36165. * Use of this file is governed by the BSD 3-clause license that
  36166. * can be found in the LICENSE.txt file in the project root.
  36167. */
  36168. //
  36169. // A tree structure used to record the semantic context in which
  36170. // an ATN configuration is valid. It's either a single predicate,
  36171. // a conjunction {@code p1&&p2}, or a sum of products {@code p1||p2}.
  36172. //
  36173. // <p>I have scoped the {@link AND}, {@link OR}, and {@link Predicate} subclasses of
  36174. // {@link SemanticContext} within the scope of this outer class.</p>
  36175. //
  36176. var Set = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js").Set;
  36177. var Hash = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js").Hash;
  36178. function SemanticContext() {
  36179. return this;
  36180. }
  36181. SemanticContext.prototype.hashCode = function() {
  36182. var hash = new Hash();
  36183. this.updateHashCode(hash);
  36184. return hash.finish();
  36185. };
  36186. // For context independent predicates, we evaluate them without a local
  36187. // context (i.e., null context). That way, we can evaluate them without
  36188. // having to create proper rule-specific context during prediction (as
  36189. // opposed to the parser, which creates them naturally). In a practical
  36190. // sense, this avoids a cast exception from RuleContext to myruleContext.
  36191. //
  36192. // <p>For context dependent predicates, we must pass in a local context so that
  36193. // references such as $arg evaluate properly as _localctx.arg. We only
  36194. // capture context dependent predicates in the context in which we begin
  36195. // prediction, so we passed in the outer context here in case of context
  36196. // dependent predicate evaluation.</p>
  36197. //
  36198. SemanticContext.prototype.evaluate = function(parser, outerContext) {
  36199. };
  36200. //
  36201. // Evaluate the precedence predicates for the context and reduce the result.
  36202. //
  36203. // @param parser The parser instance.
  36204. // @param outerContext The current parser context object.
  36205. // @return The simplified semantic context after precedence predicates are
  36206. // evaluated, which will be one of the following values.
  36207. // <ul>
  36208. // <li>{@link //NONE}: if the predicate simplifies to {@code true} after
  36209. // precedence predicates are evaluated.</li>
  36210. // <li>{@code null}: if the predicate simplifies to {@code false} after
  36211. // precedence predicates are evaluated.</li>
  36212. // <li>{@code this}: if the semantic context is not changed as a result of
  36213. // precedence predicate evaluation.</li>
  36214. // <li>A non-{@code null} {@link SemanticContext}: the new simplified
  36215. // semantic context after precedence predicates are evaluated.</li>
  36216. // </ul>
  36217. //
  36218. SemanticContext.prototype.evalPrecedence = function(parser, outerContext) {
  36219. return this;
  36220. };
  36221. SemanticContext.andContext = function(a, b) {
  36222. if (a === null || a === SemanticContext.NONE) {
  36223. return b;
  36224. }
  36225. if (b === null || b === SemanticContext.NONE) {
  36226. return a;
  36227. }
  36228. var result = new AND(a, b);
  36229. if (result.opnds.length === 1) {
  36230. return result.opnds[0];
  36231. } else {
  36232. return result;
  36233. }
  36234. };
  36235. SemanticContext.orContext = function(a, b) {
  36236. if (a === null) {
  36237. return b;
  36238. }
  36239. if (b === null) {
  36240. return a;
  36241. }
  36242. if (a === SemanticContext.NONE || b === SemanticContext.NONE) {
  36243. return SemanticContext.NONE;
  36244. }
  36245. var result = new OR(a, b);
  36246. if (result.opnds.length === 1) {
  36247. return result.opnds[0];
  36248. } else {
  36249. return result;
  36250. }
  36251. };
  36252. function Predicate(ruleIndex, predIndex, isCtxDependent) {
  36253. SemanticContext.call(this);
  36254. this.ruleIndex = ruleIndex === undefined ? -1 : ruleIndex;
  36255. this.predIndex = predIndex === undefined ? -1 : predIndex;
  36256. this.isCtxDependent = isCtxDependent === undefined ? false : isCtxDependent; // e.g., $i ref in pred
  36257. return this;
  36258. }
  36259. Predicate.prototype = Object.create(SemanticContext.prototype);
  36260. Predicate.prototype.constructor = Predicate;
  36261. //The default {@link SemanticContext}, which is semantically equivalent to
  36262. //a predicate of the form {@code {true}?}.
  36263. //
  36264. SemanticContext.NONE = new Predicate();
  36265. Predicate.prototype.evaluate = function(parser, outerContext) {
  36266. var localctx = this.isCtxDependent ? outerContext : null;
  36267. return parser.sempred(localctx, this.ruleIndex, this.predIndex);
  36268. };
  36269. Predicate.prototype.updateHashCode = function(hash) {
  36270. hash.update(this.ruleIndex, this.predIndex, this.isCtxDependent);
  36271. };
  36272. Predicate.prototype.equals = function(other) {
  36273. if (this === other) {
  36274. return true;
  36275. } else if (!(other instanceof Predicate)) {
  36276. return false;
  36277. } else {
  36278. return this.ruleIndex === other.ruleIndex &&
  36279. this.predIndex === other.predIndex &&
  36280. this.isCtxDependent === other.isCtxDependent;
  36281. }
  36282. };
  36283. Predicate.prototype.toString = function() {
  36284. return "{" + this.ruleIndex + ":" + this.predIndex + "}?";
  36285. };
  36286. function PrecedencePredicate(precedence) {
  36287. SemanticContext.call(this);
  36288. this.precedence = precedence === undefined ? 0 : precedence;
  36289. }
  36290. PrecedencePredicate.prototype = Object.create(SemanticContext.prototype);
  36291. PrecedencePredicate.prototype.constructor = PrecedencePredicate;
  36292. PrecedencePredicate.prototype.evaluate = function(parser, outerContext) {
  36293. return parser.precpred(outerContext, this.precedence);
  36294. };
  36295. PrecedencePredicate.prototype.evalPrecedence = function(parser, outerContext) {
  36296. if (parser.precpred(outerContext, this.precedence)) {
  36297. return SemanticContext.NONE;
  36298. } else {
  36299. return null;
  36300. }
  36301. };
  36302. PrecedencePredicate.prototype.compareTo = function(other) {
  36303. return this.precedence - other.precedence;
  36304. };
  36305. PrecedencePredicate.prototype.updateHashCode = function(hash) {
  36306. hash.update(31);
  36307. };
  36308. PrecedencePredicate.prototype.equals = function(other) {
  36309. if (this === other) {
  36310. return true;
  36311. } else if (!(other instanceof PrecedencePredicate)) {
  36312. return false;
  36313. } else {
  36314. return this.precedence === other.precedence;
  36315. }
  36316. };
  36317. PrecedencePredicate.prototype.toString = function() {
  36318. return "{"+this.precedence+">=prec}?";
  36319. };
  36320. PrecedencePredicate.filterPrecedencePredicates = function(set) {
  36321. var result = [];
  36322. set.values().map( function(context) {
  36323. if (context instanceof PrecedencePredicate) {
  36324. result.push(context);
  36325. }
  36326. });
  36327. return result;
  36328. };
  36329. // A semantic context which is true whenever none of the contained contexts
  36330. // is false.
  36331. //
  36332. function AND(a, b) {
  36333. SemanticContext.call(this);
  36334. var operands = new Set();
  36335. if (a instanceof AND) {
  36336. a.opnds.map(function(o) {
  36337. operands.add(o);
  36338. });
  36339. } else {
  36340. operands.add(a);
  36341. }
  36342. if (b instanceof AND) {
  36343. b.opnds.map(function(o) {
  36344. operands.add(o);
  36345. });
  36346. } else {
  36347. operands.add(b);
  36348. }
  36349. var precedencePredicates = PrecedencePredicate.filterPrecedencePredicates(operands);
  36350. if (precedencePredicates.length > 0) {
  36351. // interested in the transition with the lowest precedence
  36352. var reduced = null;
  36353. precedencePredicates.map( function(p) {
  36354. if(reduced===null || p.precedence<reduced.precedence) {
  36355. reduced = p;
  36356. }
  36357. });
  36358. operands.add(reduced);
  36359. }
  36360. this.opnds = operands.values();
  36361. return this;
  36362. }
  36363. AND.prototype = Object.create(SemanticContext.prototype);
  36364. AND.prototype.constructor = AND;
  36365. AND.prototype.equals = function(other) {
  36366. if (this === other) {
  36367. return true;
  36368. } else if (!(other instanceof AND)) {
  36369. return false;
  36370. } else {
  36371. return this.opnds === other.opnds;
  36372. }
  36373. };
  36374. AND.prototype.updateHashCode = function(hash) {
  36375. hash.update(this.opnds, "AND");
  36376. };
  36377. //
  36378. // {@inheritDoc}
  36379. //
  36380. // <p>
  36381. // The evaluation of predicates by this context is short-circuiting, but
  36382. // unordered.</p>
  36383. //
  36384. AND.prototype.evaluate = function(parser, outerContext) {
  36385. for (var i = 0; i < this.opnds.length; i++) {
  36386. if (!this.opnds[i].evaluate(parser, outerContext)) {
  36387. return false;
  36388. }
  36389. }
  36390. return true;
  36391. };
  36392. AND.prototype.evalPrecedence = function(parser, outerContext) {
  36393. var differs = false;
  36394. var operands = [];
  36395. for (var i = 0; i < this.opnds.length; i++) {
  36396. var context = this.opnds[i];
  36397. var evaluated = context.evalPrecedence(parser, outerContext);
  36398. differs |= (evaluated !== context);
  36399. if (evaluated === null) {
  36400. // The AND context is false if any element is false
  36401. return null;
  36402. } else if (evaluated !== SemanticContext.NONE) {
  36403. // Reduce the result by skipping true elements
  36404. operands.push(evaluated);
  36405. }
  36406. }
  36407. if (!differs) {
  36408. return this;
  36409. }
  36410. if (operands.length === 0) {
  36411. // all elements were true, so the AND context is true
  36412. return SemanticContext.NONE;
  36413. }
  36414. var result = null;
  36415. operands.map(function(o) {
  36416. result = result === null ? o : SemanticContext.andContext(result, o);
  36417. });
  36418. return result;
  36419. };
  36420. AND.prototype.toString = function() {
  36421. var s = "";
  36422. this.opnds.map(function(o) {
  36423. s += "&& " + o.toString();
  36424. });
  36425. return s.length > 3 ? s.slice(3) : s;
  36426. };
  36427. //
  36428. // A semantic context which is true whenever at least one of the contained
  36429. // contexts is true.
  36430. //
  36431. function OR(a, b) {
  36432. SemanticContext.call(this);
  36433. var operands = new Set();
  36434. if (a instanceof OR) {
  36435. a.opnds.map(function(o) {
  36436. operands.add(o);
  36437. });
  36438. } else {
  36439. operands.add(a);
  36440. }
  36441. if (b instanceof OR) {
  36442. b.opnds.map(function(o) {
  36443. operands.add(o);
  36444. });
  36445. } else {
  36446. operands.add(b);
  36447. }
  36448. var precedencePredicates = PrecedencePredicate.filterPrecedencePredicates(operands);
  36449. if (precedencePredicates.length > 0) {
  36450. // interested in the transition with the highest precedence
  36451. var s = precedencePredicates.sort(function(a, b) {
  36452. return a.compareTo(b);
  36453. });
  36454. var reduced = s[s.length-1];
  36455. operands.add(reduced);
  36456. }
  36457. this.opnds = operands.values();
  36458. return this;
  36459. }
  36460. OR.prototype = Object.create(SemanticContext.prototype);
  36461. OR.prototype.constructor = OR;
  36462. OR.prototype.constructor = function(other) {
  36463. if (this === other) {
  36464. return true;
  36465. } else if (!(other instanceof OR)) {
  36466. return false;
  36467. } else {
  36468. return this.opnds === other.opnds;
  36469. }
  36470. };
  36471. OR.prototype.updateHashCode = function(hash) {
  36472. hash.update(this.opnds, "OR");
  36473. };
  36474. // <p>
  36475. // The evaluation of predicates by this context is short-circuiting, but
  36476. // unordered.</p>
  36477. //
  36478. OR.prototype.evaluate = function(parser, outerContext) {
  36479. for (var i = 0; i < this.opnds.length; i++) {
  36480. if (this.opnds[i].evaluate(parser, outerContext)) {
  36481. return true;
  36482. }
  36483. }
  36484. return false;
  36485. };
  36486. OR.prototype.evalPrecedence = function(parser, outerContext) {
  36487. var differs = false;
  36488. var operands = [];
  36489. for (var i = 0; i < this.opnds.length; i++) {
  36490. var context = this.opnds[i];
  36491. var evaluated = context.evalPrecedence(parser, outerContext);
  36492. differs |= (evaluated !== context);
  36493. if (evaluated === SemanticContext.NONE) {
  36494. // The OR context is true if any element is true
  36495. return SemanticContext.NONE;
  36496. } else if (evaluated !== null) {
  36497. // Reduce the result by skipping false elements
  36498. operands.push(evaluated);
  36499. }
  36500. }
  36501. if (!differs) {
  36502. return this;
  36503. }
  36504. if (operands.length === 0) {
  36505. // all elements were false, so the OR context is false
  36506. return null;
  36507. }
  36508. var result = null;
  36509. operands.map(function(o) {
  36510. return result === null ? o : SemanticContext.orContext(result, o);
  36511. });
  36512. return result;
  36513. };
  36514. OR.prototype.toString = function() {
  36515. var s = "";
  36516. this.opnds.map(function(o) {
  36517. s += "|| " + o.toString();
  36518. });
  36519. return s.length > 3 ? s.slice(3) : s;
  36520. };
  36521. exports.SemanticContext = SemanticContext;
  36522. exports.PrecedencePredicate = PrecedencePredicate;
  36523. exports.Predicate = Predicate;
  36524. /***/ }),
  36525. /***/ "./node_modules/antlr4/atn/Transition.js":
  36526. /*!***********************************************!*\
  36527. !*** ./node_modules/antlr4/atn/Transition.js ***!
  36528. \***********************************************/
  36529. /*! no static exports found */
  36530. /***/ (function(module, exports, __webpack_require__) {
  36531. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  36532. * Use of this file is governed by the BSD 3-clause license that
  36533. * can be found in the LICENSE.txt file in the project root.
  36534. */
  36535. //
  36536. // An ATN transition between any two ATN states. Subclasses define
  36537. // atom, set, epsilon, action, predicate, rule transitions.
  36538. //
  36539. // <p>This is a one way link. It emanates from a state (usually via a list of
  36540. // transitions) and has a target state.</p>
  36541. //
  36542. // <p>Since we never have to change the ATN transitions once we construct it,
  36543. // we can fix these transitions as specific classes. The DFA transitions
  36544. // on the other hand need to update the labels as it adds transitions to
  36545. // the states. We'll use the term Edge for the DFA to distinguish them from
  36546. // ATN transitions.</p>
  36547. var Token = __webpack_require__(/*! ./../Token */ "./node_modules/antlr4/Token.js").Token;
  36548. var Interval = __webpack_require__(/*! ./../IntervalSet */ "./node_modules/antlr4/IntervalSet.js").Interval;
  36549. var IntervalSet = __webpack_require__(/*! ./../IntervalSet */ "./node_modules/antlr4/IntervalSet.js").IntervalSet;
  36550. var Predicate = __webpack_require__(/*! ./SemanticContext */ "./node_modules/antlr4/atn/SemanticContext.js").Predicate;
  36551. var PrecedencePredicate = __webpack_require__(/*! ./SemanticContext */ "./node_modules/antlr4/atn/SemanticContext.js").PrecedencePredicate;
  36552. function Transition (target) {
  36553. // The target of this transition.
  36554. if (target===undefined || target===null) {
  36555. throw "target cannot be null.";
  36556. }
  36557. this.target = target;
  36558. // Are we epsilon, action, sempred?
  36559. this.isEpsilon = false;
  36560. this.label = null;
  36561. return this;
  36562. }
  36563. // constants for serialization
  36564. Transition.EPSILON = 1;
  36565. Transition.RANGE = 2;
  36566. Transition.RULE = 3;
  36567. Transition.PREDICATE = 4; // e.g., {isType(input.LT(1))}?
  36568. Transition.ATOM = 5;
  36569. Transition.ACTION = 6;
  36570. Transition.SET = 7; // ~(A|B) or ~atom, wildcard, which convert to next 2
  36571. Transition.NOT_SET = 8;
  36572. Transition.WILDCARD = 9;
  36573. Transition.PRECEDENCE = 10;
  36574. Transition.serializationNames = [
  36575. "INVALID",
  36576. "EPSILON",
  36577. "RANGE",
  36578. "RULE",
  36579. "PREDICATE",
  36580. "ATOM",
  36581. "ACTION",
  36582. "SET",
  36583. "NOT_SET",
  36584. "WILDCARD",
  36585. "PRECEDENCE"
  36586. ];
  36587. Transition.serializationTypes = {
  36588. EpsilonTransition: Transition.EPSILON,
  36589. RangeTransition: Transition.RANGE,
  36590. RuleTransition: Transition.RULE,
  36591. PredicateTransition: Transition.PREDICATE,
  36592. AtomTransition: Transition.ATOM,
  36593. ActionTransition: Transition.ACTION,
  36594. SetTransition: Transition.SET,
  36595. NotSetTransition: Transition.NOT_SET,
  36596. WildcardTransition: Transition.WILDCARD,
  36597. PrecedencePredicateTransition: Transition.PRECEDENCE
  36598. };
  36599. // TODO: make all transitions sets? no, should remove set edges
  36600. function AtomTransition(target, label) {
  36601. Transition.call(this, target);
  36602. this.label_ = label; // The token type or character value; or, signifies special label.
  36603. this.label = this.makeLabel();
  36604. this.serializationType = Transition.ATOM;
  36605. return this;
  36606. }
  36607. AtomTransition.prototype = Object.create(Transition.prototype);
  36608. AtomTransition.prototype.constructor = AtomTransition;
  36609. AtomTransition.prototype.makeLabel = function() {
  36610. var s = new IntervalSet();
  36611. s.addOne(this.label_);
  36612. return s;
  36613. };
  36614. AtomTransition.prototype.matches = function( symbol, minVocabSymbol, maxVocabSymbol) {
  36615. return this.label_ === symbol;
  36616. };
  36617. AtomTransition.prototype.toString = function() {
  36618. return this.label_;
  36619. };
  36620. function RuleTransition(ruleStart, ruleIndex, precedence, followState) {
  36621. Transition.call(this, ruleStart);
  36622. this.ruleIndex = ruleIndex; // ptr to the rule definition object for this rule ref
  36623. this.precedence = precedence;
  36624. this.followState = followState; // what node to begin computations following ref to rule
  36625. this.serializationType = Transition.RULE;
  36626. this.isEpsilon = true;
  36627. return this;
  36628. }
  36629. RuleTransition.prototype = Object.create(Transition.prototype);
  36630. RuleTransition.prototype.constructor = RuleTransition;
  36631. RuleTransition.prototype.matches = function(symbol, minVocabSymbol, maxVocabSymbol) {
  36632. return false;
  36633. };
  36634. function EpsilonTransition(target, outermostPrecedenceReturn) {
  36635. Transition.call(this, target);
  36636. this.serializationType = Transition.EPSILON;
  36637. this.isEpsilon = true;
  36638. this.outermostPrecedenceReturn = outermostPrecedenceReturn;
  36639. return this;
  36640. }
  36641. EpsilonTransition.prototype = Object.create(Transition.prototype);
  36642. EpsilonTransition.prototype.constructor = EpsilonTransition;
  36643. EpsilonTransition.prototype.matches = function( symbol, minVocabSymbol, maxVocabSymbol) {
  36644. return false;
  36645. };
  36646. EpsilonTransition.prototype.toString = function() {
  36647. return "epsilon";
  36648. };
  36649. function RangeTransition(target, start, stop) {
  36650. Transition.call(this, target);
  36651. this.serializationType = Transition.RANGE;
  36652. this.start = start;
  36653. this.stop = stop;
  36654. this.label = this.makeLabel();
  36655. return this;
  36656. }
  36657. RangeTransition.prototype = Object.create(Transition.prototype);
  36658. RangeTransition.prototype.constructor = RangeTransition;
  36659. RangeTransition.prototype.makeLabel = function() {
  36660. var s = new IntervalSet();
  36661. s.addRange(this.start, this.stop);
  36662. return s;
  36663. };
  36664. RangeTransition.prototype.matches = function(symbol, minVocabSymbol, maxVocabSymbol) {
  36665. return symbol >= this.start && symbol <= this.stop;
  36666. };
  36667. RangeTransition.prototype.toString = function() {
  36668. return "'" + String.fromCharCode(this.start) + "'..'" + String.fromCharCode(this.stop) + "'";
  36669. };
  36670. function AbstractPredicateTransition(target) {
  36671. Transition.call(this, target);
  36672. return this;
  36673. }
  36674. AbstractPredicateTransition.prototype = Object.create(Transition.prototype);
  36675. AbstractPredicateTransition.prototype.constructor = AbstractPredicateTransition;
  36676. function PredicateTransition(target, ruleIndex, predIndex, isCtxDependent) {
  36677. AbstractPredicateTransition.call(this, target);
  36678. this.serializationType = Transition.PREDICATE;
  36679. this.ruleIndex = ruleIndex;
  36680. this.predIndex = predIndex;
  36681. this.isCtxDependent = isCtxDependent; // e.g., $i ref in pred
  36682. this.isEpsilon = true;
  36683. return this;
  36684. }
  36685. PredicateTransition.prototype = Object.create(AbstractPredicateTransition.prototype);
  36686. PredicateTransition.prototype.constructor = PredicateTransition;
  36687. PredicateTransition.prototype.matches = function(symbol, minVocabSymbol, maxVocabSymbol) {
  36688. return false;
  36689. };
  36690. PredicateTransition.prototype.getPredicate = function() {
  36691. return new Predicate(this.ruleIndex, this.predIndex, this.isCtxDependent);
  36692. };
  36693. PredicateTransition.prototype.toString = function() {
  36694. return "pred_" + this.ruleIndex + ":" + this.predIndex;
  36695. };
  36696. function ActionTransition(target, ruleIndex, actionIndex, isCtxDependent) {
  36697. Transition.call(this, target);
  36698. this.serializationType = Transition.ACTION;
  36699. this.ruleIndex = ruleIndex;
  36700. this.actionIndex = actionIndex===undefined ? -1 : actionIndex;
  36701. this.isCtxDependent = isCtxDependent===undefined ? false : isCtxDependent; // e.g., $i ref in pred
  36702. this.isEpsilon = true;
  36703. return this;
  36704. }
  36705. ActionTransition.prototype = Object.create(Transition.prototype);
  36706. ActionTransition.prototype.constructor = ActionTransition;
  36707. ActionTransition.prototype.matches = function(symbol, minVocabSymbol, maxVocabSymbol) {
  36708. return false;
  36709. };
  36710. ActionTransition.prototype.toString = function() {
  36711. return "action_" + this.ruleIndex + ":" + this.actionIndex;
  36712. };
  36713. // A transition containing a set of values.
  36714. function SetTransition(target, set) {
  36715. Transition.call(this, target);
  36716. this.serializationType = Transition.SET;
  36717. if (set !==undefined && set !==null) {
  36718. this.label = set;
  36719. } else {
  36720. this.label = new IntervalSet();
  36721. this.label.addOne(Token.INVALID_TYPE);
  36722. }
  36723. return this;
  36724. }
  36725. SetTransition.prototype = Object.create(Transition.prototype);
  36726. SetTransition.prototype.constructor = SetTransition;
  36727. SetTransition.prototype.matches = function(symbol, minVocabSymbol, maxVocabSymbol) {
  36728. return this.label.contains(symbol);
  36729. };
  36730. SetTransition.prototype.toString = function() {
  36731. return this.label.toString();
  36732. };
  36733. function NotSetTransition(target, set) {
  36734. SetTransition.call(this, target, set);
  36735. this.serializationType = Transition.NOT_SET;
  36736. return this;
  36737. }
  36738. NotSetTransition.prototype = Object.create(SetTransition.prototype);
  36739. NotSetTransition.prototype.constructor = NotSetTransition;
  36740. NotSetTransition.prototype.matches = function(symbol, minVocabSymbol, maxVocabSymbol) {
  36741. return symbol >= minVocabSymbol && symbol <= maxVocabSymbol &&
  36742. !SetTransition.prototype.matches.call(this, symbol, minVocabSymbol, maxVocabSymbol);
  36743. };
  36744. NotSetTransition.prototype.toString = function() {
  36745. return '~' + SetTransition.prototype.toString.call(this);
  36746. };
  36747. function WildcardTransition(target) {
  36748. Transition.call(this, target);
  36749. this.serializationType = Transition.WILDCARD;
  36750. return this;
  36751. }
  36752. WildcardTransition.prototype = Object.create(Transition.prototype);
  36753. WildcardTransition.prototype.constructor = WildcardTransition;
  36754. WildcardTransition.prototype.matches = function(symbol, minVocabSymbol, maxVocabSymbol) {
  36755. return symbol >= minVocabSymbol && symbol <= maxVocabSymbol;
  36756. };
  36757. WildcardTransition.prototype.toString = function() {
  36758. return ".";
  36759. };
  36760. function PrecedencePredicateTransition(target, precedence) {
  36761. AbstractPredicateTransition.call(this, target);
  36762. this.serializationType = Transition.PRECEDENCE;
  36763. this.precedence = precedence;
  36764. this.isEpsilon = true;
  36765. return this;
  36766. }
  36767. PrecedencePredicateTransition.prototype = Object.create(AbstractPredicateTransition.prototype);
  36768. PrecedencePredicateTransition.prototype.constructor = PrecedencePredicateTransition;
  36769. PrecedencePredicateTransition.prototype.matches = function(symbol, minVocabSymbol, maxVocabSymbol) {
  36770. return false;
  36771. };
  36772. PrecedencePredicateTransition.prototype.getPredicate = function() {
  36773. return new PrecedencePredicate(this.precedence);
  36774. };
  36775. PrecedencePredicateTransition.prototype.toString = function() {
  36776. return this.precedence + " >= _p";
  36777. };
  36778. exports.Transition = Transition;
  36779. exports.AtomTransition = AtomTransition;
  36780. exports.SetTransition = SetTransition;
  36781. exports.NotSetTransition = NotSetTransition;
  36782. exports.RuleTransition = RuleTransition;
  36783. exports.ActionTransition = ActionTransition;
  36784. exports.EpsilonTransition = EpsilonTransition;
  36785. exports.RangeTransition = RangeTransition;
  36786. exports.WildcardTransition = WildcardTransition;
  36787. exports.PredicateTransition = PredicateTransition;
  36788. exports.PrecedencePredicateTransition = PrecedencePredicateTransition;
  36789. exports.AbstractPredicateTransition = AbstractPredicateTransition;
  36790. /***/ }),
  36791. /***/ "./node_modules/antlr4/atn/index.js":
  36792. /*!******************************************!*\
  36793. !*** ./node_modules/antlr4/atn/index.js ***!
  36794. \******************************************/
  36795. /*! no static exports found */
  36796. /***/ (function(module, exports, __webpack_require__) {
  36797. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  36798. * Use of this file is governed by the BSD 3-clause license that
  36799. * can be found in the LICENSE.txt file in the project root.
  36800. */
  36801. exports.ATN = __webpack_require__(/*! ./ATN */ "./node_modules/antlr4/atn/ATN.js").ATN;
  36802. exports.ATNDeserializer = __webpack_require__(/*! ./ATNDeserializer */ "./node_modules/antlr4/atn/ATNDeserializer.js").ATNDeserializer;
  36803. exports.LexerATNSimulator = __webpack_require__(/*! ./LexerATNSimulator */ "./node_modules/antlr4/atn/LexerATNSimulator.js").LexerATNSimulator;
  36804. exports.ParserATNSimulator = __webpack_require__(/*! ./ParserATNSimulator */ "./node_modules/antlr4/atn/ParserATNSimulator.js").ParserATNSimulator;
  36805. exports.PredictionMode = __webpack_require__(/*! ./PredictionMode */ "./node_modules/antlr4/atn/PredictionMode.js").PredictionMode;
  36806. /***/ }),
  36807. /***/ "./node_modules/antlr4/dfa/DFA.js":
  36808. /*!****************************************!*\
  36809. !*** ./node_modules/antlr4/dfa/DFA.js ***!
  36810. \****************************************/
  36811. /*! no static exports found */
  36812. /***/ (function(module, exports, __webpack_require__) {
  36813. //
  36814. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  36815. * Use of this file is governed by the BSD 3-clause license that
  36816. * can be found in the LICENSE.txt file in the project root.
  36817. */
  36818. var Set = __webpack_require__(/*! ../Utils */ "./node_modules/antlr4/Utils.js").Set;
  36819. var DFAState = __webpack_require__(/*! ./DFAState */ "./node_modules/antlr4/dfa/DFAState.js").DFAState;
  36820. var StarLoopEntryState = __webpack_require__(/*! ../atn/ATNState */ "./node_modules/antlr4/atn/ATNState.js").StarLoopEntryState;
  36821. var ATNConfigSet = __webpack_require__(/*! ./../atn/ATNConfigSet */ "./node_modules/antlr4/atn/ATNConfigSet.js").ATNConfigSet;
  36822. var DFASerializer = __webpack_require__(/*! ./DFASerializer */ "./node_modules/antlr4/dfa/DFASerializer.js").DFASerializer;
  36823. var LexerDFASerializer = __webpack_require__(/*! ./DFASerializer */ "./node_modules/antlr4/dfa/DFASerializer.js").LexerDFASerializer;
  36824. function DFA(atnStartState, decision) {
  36825. if (decision === undefined) {
  36826. decision = 0;
  36827. }
  36828. // From which ATN state did we create this DFA?
  36829. this.atnStartState = atnStartState;
  36830. this.decision = decision;
  36831. // A set of all DFA states. Use {@link Map} so we can get old state back
  36832. // ({@link Set} only allows you to see if it's there).
  36833. this._states = new Set();
  36834. this.s0 = null;
  36835. // {@code true} if this DFA is for a precedence decision; otherwise,
  36836. // {@code false}. This is the backing field for {@link //isPrecedenceDfa},
  36837. // {@link //setPrecedenceDfa}.
  36838. this.precedenceDfa = false;
  36839. if (atnStartState instanceof StarLoopEntryState)
  36840. {
  36841. if (atnStartState.isPrecedenceDecision) {
  36842. this.precedenceDfa = true;
  36843. var precedenceState = new DFAState(null, new ATNConfigSet());
  36844. precedenceState.edges = [];
  36845. precedenceState.isAcceptState = false;
  36846. precedenceState.requiresFullContext = false;
  36847. this.s0 = precedenceState;
  36848. }
  36849. }
  36850. return this;
  36851. }
  36852. // Get the start state for a specific precedence value.
  36853. //
  36854. // @param precedence The current precedence.
  36855. // @return The start state corresponding to the specified precedence, or
  36856. // {@code null} if no start state exists for the specified precedence.
  36857. //
  36858. // @throws IllegalStateException if this is not a precedence DFA.
  36859. // @see //isPrecedenceDfa()
  36860. DFA.prototype.getPrecedenceStartState = function(precedence) {
  36861. if (!(this.precedenceDfa)) {
  36862. throw ("Only precedence DFAs may contain a precedence start state.");
  36863. }
  36864. // s0.edges is never null for a precedence DFA
  36865. if (precedence < 0 || precedence >= this.s0.edges.length) {
  36866. return null;
  36867. }
  36868. return this.s0.edges[precedence] || null;
  36869. };
  36870. // Set the start state for a specific precedence value.
  36871. //
  36872. // @param precedence The current precedence.
  36873. // @param startState The start state corresponding to the specified
  36874. // precedence.
  36875. //
  36876. // @throws IllegalStateException if this is not a precedence DFA.
  36877. // @see //isPrecedenceDfa()
  36878. //
  36879. DFA.prototype.setPrecedenceStartState = function(precedence, startState) {
  36880. if (!(this.precedenceDfa)) {
  36881. throw ("Only precedence DFAs may contain a precedence start state.");
  36882. }
  36883. if (precedence < 0) {
  36884. return;
  36885. }
  36886. // synchronization on s0 here is ok. when the DFA is turned into a
  36887. // precedence DFA, s0 will be initialized once and not updated again
  36888. // s0.edges is never null for a precedence DFA
  36889. this.s0.edges[precedence] = startState;
  36890. };
  36891. //
  36892. // Sets whether this is a precedence DFA. If the specified value differs
  36893. // from the current DFA configuration, the following actions are taken;
  36894. // otherwise no changes are made to the current DFA.
  36895. //
  36896. // <ul>
  36897. // <li>The {@link //states} map is cleared</li>
  36898. // <li>If {@code precedenceDfa} is {@code false}, the initial state
  36899. // {@link //s0} is set to {@code null}; otherwise, it is initialized to a new
  36900. // {@link DFAState} with an empty outgoing {@link DFAState//edges} array to
  36901. // store the start states for individual precedence values.</li>
  36902. // <li>The {@link //precedenceDfa} field is updated</li>
  36903. // </ul>
  36904. //
  36905. // @param precedenceDfa {@code true} if this is a precedence DFA; otherwise,
  36906. // {@code false}
  36907. DFA.prototype.setPrecedenceDfa = function(precedenceDfa) {
  36908. if (this.precedenceDfa!==precedenceDfa) {
  36909. this._states = new DFAStatesSet();
  36910. if (precedenceDfa) {
  36911. var precedenceState = new DFAState(null, new ATNConfigSet());
  36912. precedenceState.edges = [];
  36913. precedenceState.isAcceptState = false;
  36914. precedenceState.requiresFullContext = false;
  36915. this.s0 = precedenceState;
  36916. } else {
  36917. this.s0 = null;
  36918. }
  36919. this.precedenceDfa = precedenceDfa;
  36920. }
  36921. };
  36922. Object.defineProperty(DFA.prototype, "states", {
  36923. get : function() {
  36924. return this._states;
  36925. }
  36926. });
  36927. // Return a list of all states in this DFA, ordered by state number.
  36928. DFA.prototype.sortedStates = function() {
  36929. var list = this._states.values();
  36930. return list.sort(function(a, b) {
  36931. return a.stateNumber - b.stateNumber;
  36932. });
  36933. };
  36934. DFA.prototype.toString = function(literalNames, symbolicNames) {
  36935. literalNames = literalNames || null;
  36936. symbolicNames = symbolicNames || null;
  36937. if (this.s0 === null) {
  36938. return "";
  36939. }
  36940. var serializer = new DFASerializer(this, literalNames, symbolicNames);
  36941. return serializer.toString();
  36942. };
  36943. DFA.prototype.toLexerString = function() {
  36944. if (this.s0 === null) {
  36945. return "";
  36946. }
  36947. var serializer = new LexerDFASerializer(this);
  36948. return serializer.toString();
  36949. };
  36950. exports.DFA = DFA;
  36951. /***/ }),
  36952. /***/ "./node_modules/antlr4/dfa/DFASerializer.js":
  36953. /*!**************************************************!*\
  36954. !*** ./node_modules/antlr4/dfa/DFASerializer.js ***!
  36955. \**************************************************/
  36956. /*! no static exports found */
  36957. /***/ (function(module, exports) {
  36958. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  36959. * Use of this file is governed by the BSD 3-clause license that
  36960. * can be found in the LICENSE.txt file in the project root.
  36961. */
  36962. // A DFA walker that knows how to dump them to serialized strings.#/
  36963. function DFASerializer(dfa, literalNames, symbolicNames) {
  36964. this.dfa = dfa;
  36965. this.literalNames = literalNames || [];
  36966. this.symbolicNames = symbolicNames || [];
  36967. return this;
  36968. }
  36969. DFASerializer.prototype.toString = function() {
  36970. if(this.dfa.s0 === null) {
  36971. return null;
  36972. }
  36973. var buf = "";
  36974. var states = this.dfa.sortedStates();
  36975. for(var i=0;i<states.length;i++) {
  36976. var s = states[i];
  36977. if(s.edges!==null) {
  36978. var n = s.edges.length;
  36979. for(var j=0;j<n;j++) {
  36980. var t = s.edges[j] || null;
  36981. if(t!==null && t.stateNumber !== 0x7FFFFFFF) {
  36982. buf = buf.concat(this.getStateString(s));
  36983. buf = buf.concat("-");
  36984. buf = buf.concat(this.getEdgeLabel(j));
  36985. buf = buf.concat("->");
  36986. buf = buf.concat(this.getStateString(t));
  36987. buf = buf.concat('\n');
  36988. }
  36989. }
  36990. }
  36991. }
  36992. return buf.length===0 ? null : buf;
  36993. };
  36994. DFASerializer.prototype.getEdgeLabel = function(i) {
  36995. if (i===0) {
  36996. return "EOF";
  36997. } else if(this.literalNames !==null || this.symbolicNames!==null) {
  36998. return this.literalNames[i-1] || this.symbolicNames[i-1];
  36999. } else {
  37000. return String.fromCharCode(i-1);
  37001. }
  37002. };
  37003. DFASerializer.prototype.getStateString = function(s) {
  37004. var baseStateStr = ( s.isAcceptState ? ":" : "") + "s" + s.stateNumber + ( s.requiresFullContext ? "^" : "");
  37005. if(s.isAcceptState) {
  37006. if (s.predicates !== null) {
  37007. return baseStateStr + "=>" + s.predicates.toString();
  37008. } else {
  37009. return baseStateStr + "=>" + s.prediction.toString();
  37010. }
  37011. } else {
  37012. return baseStateStr;
  37013. }
  37014. };
  37015. function LexerDFASerializer(dfa) {
  37016. DFASerializer.call(this, dfa, null);
  37017. return this;
  37018. }
  37019. LexerDFASerializer.prototype = Object.create(DFASerializer.prototype);
  37020. LexerDFASerializer.prototype.constructor = LexerDFASerializer;
  37021. LexerDFASerializer.prototype.getEdgeLabel = function(i) {
  37022. return "'" + String.fromCharCode(i) + "'";
  37023. };
  37024. exports.DFASerializer = DFASerializer;
  37025. exports.LexerDFASerializer = LexerDFASerializer;
  37026. /***/ }),
  37027. /***/ "./node_modules/antlr4/dfa/DFAState.js":
  37028. /*!*********************************************!*\
  37029. !*** ./node_modules/antlr4/dfa/DFAState.js ***!
  37030. \*********************************************/
  37031. /*! no static exports found */
  37032. /***/ (function(module, exports, __webpack_require__) {
  37033. //
  37034. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  37035. * Use of this file is governed by the BSD 3-clause license that
  37036. * can be found in the LICENSE.txt file in the project root.
  37037. */
  37038. ///
  37039. var ATNConfigSet = __webpack_require__(/*! ./../atn/ATNConfigSet */ "./node_modules/antlr4/atn/ATNConfigSet.js").ATNConfigSet;
  37040. var Utils = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js");
  37041. var Hash = Utils.Hash;
  37042. var Set = Utils.Set;
  37043. // Map a predicate to a predicted alternative.///
  37044. function PredPrediction(pred, alt) {
  37045. this.alt = alt;
  37046. this.pred = pred;
  37047. return this;
  37048. }
  37049. PredPrediction.prototype.toString = function() {
  37050. return "(" + this.pred + ", " + this.alt + ")";
  37051. };
  37052. // A DFA state represents a set of possible ATN configurations.
  37053. // As Aho, Sethi, Ullman p. 117 says "The DFA uses its state
  37054. // to keep track of all possible states the ATN can be in after
  37055. // reading each input symbol. That is to say, after reading
  37056. // input a1a2..an, the DFA is in a state that represents the
  37057. // subset T of the states of the ATN that are reachable from the
  37058. // ATN's start state along some path labeled a1a2..an."
  37059. // In conventional NFA&rarr;DFA conversion, therefore, the subset T
  37060. // would be a bitset representing the set of states the
  37061. // ATN could be in. We need to track the alt predicted by each
  37062. // state as well, however. More importantly, we need to maintain
  37063. // a stack of states, tracking the closure operations as they
  37064. // jump from rule to rule, emulating rule invocations (method calls).
  37065. // I have to add a stack to simulate the proper lookahead sequences for
  37066. // the underlying LL grammar from which the ATN was derived.
  37067. //
  37068. // <p>I use a set of ATNConfig objects not simple states. An ATNConfig
  37069. // is both a state (ala normal conversion) and a RuleContext describing
  37070. // the chain of rules (if any) followed to arrive at that state.</p>
  37071. //
  37072. // <p>A DFA state may have multiple references to a particular state,
  37073. // but with different ATN contexts (with same or different alts)
  37074. // meaning that state was reached via a different set of rule invocations.</p>
  37075. // /
  37076. function DFAState(stateNumber, configs) {
  37077. if (stateNumber === null) {
  37078. stateNumber = -1;
  37079. }
  37080. if (configs === null) {
  37081. configs = new ATNConfigSet();
  37082. }
  37083. this.stateNumber = stateNumber;
  37084. this.configs = configs;
  37085. // {@code edges[symbol]} points to target of symbol. Shift up by 1 so (-1)
  37086. // {@link Token//EOF} maps to {@code edges[0]}.
  37087. this.edges = null;
  37088. this.isAcceptState = false;
  37089. // if accept state, what ttype do we match or alt do we predict?
  37090. // This is set to {@link ATN//INVALID_ALT_NUMBER} when {@link
  37091. // //predicates}{@code !=null} or
  37092. // {@link //requiresFullContext}.
  37093. this.prediction = 0;
  37094. this.lexerActionExecutor = null;
  37095. // Indicates that this state was created during SLL prediction that
  37096. // discovered a conflict between the configurations in the state. Future
  37097. // {@link ParserATNSimulator//execATN} invocations immediately jumped doing
  37098. // full context prediction if this field is true.
  37099. this.requiresFullContext = false;
  37100. // During SLL parsing, this is a list of predicates associated with the
  37101. // ATN configurations of the DFA state. When we have predicates,
  37102. // {@link //requiresFullContext} is {@code false} since full context
  37103. // prediction evaluates predicates
  37104. // on-the-fly. If this is not null, then {@link //prediction} is
  37105. // {@link ATN//INVALID_ALT_NUMBER}.
  37106. //
  37107. // <p>We only use these for non-{@link //requiresFullContext} but
  37108. // conflicting states. That
  37109. // means we know from the context (it's $ or we don't dip into outer
  37110. // context) that it's an ambiguity not a conflict.</p>
  37111. //
  37112. // <p>This list is computed by {@link
  37113. // ParserATNSimulator//predicateDFAState}.</p>
  37114. this.predicates = null;
  37115. return this;
  37116. }
  37117. // Get the set of all alts mentioned by all ATN configurations in this
  37118. // DFA state.
  37119. DFAState.prototype.getAltSet = function() {
  37120. var alts = new Set();
  37121. if (this.configs !== null) {
  37122. for (var i = 0; i < this.configs.length; i++) {
  37123. var c = this.configs[i];
  37124. alts.add(c.alt);
  37125. }
  37126. }
  37127. if (alts.length === 0) {
  37128. return null;
  37129. } else {
  37130. return alts;
  37131. }
  37132. };
  37133. // Two {@link DFAState} instances are equal if their ATN configuration sets
  37134. // are the same. This method is used to see if a state already exists.
  37135. //
  37136. // <p>Because the number of alternatives and number of ATN configurations are
  37137. // finite, there is a finite number of DFA states that can be processed.
  37138. // This is necessary to show that the algorithm terminates.</p>
  37139. //
  37140. // <p>Cannot test the DFA state numbers here because in
  37141. // {@link ParserATNSimulator//addDFAState} we need to know if any other state
  37142. // exists that has this exact set of ATN configurations. The
  37143. // {@link //stateNumber} is irrelevant.</p>
  37144. DFAState.prototype.equals = function(other) {
  37145. // compare set of ATN configurations in this set with other
  37146. return this === other ||
  37147. (other instanceof DFAState &&
  37148. this.configs.equals(other.configs));
  37149. };
  37150. DFAState.prototype.toString = function() {
  37151. var s = "" + this.stateNumber + ":" + this.configs;
  37152. if(this.isAcceptState) {
  37153. s = s + "=>";
  37154. if (this.predicates !== null)
  37155. s = s + this.predicates;
  37156. else
  37157. s = s + this.prediction;
  37158. }
  37159. return s;
  37160. };
  37161. DFAState.prototype.hashCode = function() {
  37162. var hash = new Hash();
  37163. hash.update(this.configs);
  37164. if(this.isAcceptState) {
  37165. if (this.predicates !== null)
  37166. hash.update(this.predicates);
  37167. else
  37168. hash.update(this.prediction);
  37169. }
  37170. return hash.finish();
  37171. };
  37172. exports.DFAState = DFAState;
  37173. exports.PredPrediction = PredPrediction;
  37174. /***/ }),
  37175. /***/ "./node_modules/antlr4/dfa/index.js":
  37176. /*!******************************************!*\
  37177. !*** ./node_modules/antlr4/dfa/index.js ***!
  37178. \******************************************/
  37179. /*! no static exports found */
  37180. /***/ (function(module, exports, __webpack_require__) {
  37181. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  37182. * Use of this file is governed by the BSD 3-clause license that
  37183. * can be found in the LICENSE.txt file in the project root.
  37184. */
  37185. exports.DFA = __webpack_require__(/*! ./DFA */ "./node_modules/antlr4/dfa/DFA.js").DFA;
  37186. exports.DFASerializer = __webpack_require__(/*! ./DFASerializer */ "./node_modules/antlr4/dfa/DFASerializer.js").DFASerializer;
  37187. exports.LexerDFASerializer = __webpack_require__(/*! ./DFASerializer */ "./node_modules/antlr4/dfa/DFASerializer.js").LexerDFASerializer;
  37188. exports.PredPrediction = __webpack_require__(/*! ./DFAState */ "./node_modules/antlr4/dfa/DFAState.js").PredPrediction;
  37189. /***/ }),
  37190. /***/ "./node_modules/antlr4/error/DiagnosticErrorListener.js":
  37191. /*!**************************************************************!*\
  37192. !*** ./node_modules/antlr4/error/DiagnosticErrorListener.js ***!
  37193. \**************************************************************/
  37194. /*! no static exports found */
  37195. /***/ (function(module, exports, __webpack_require__) {
  37196. //
  37197. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  37198. * Use of this file is governed by the BSD 3-clause license that
  37199. * can be found in the LICENSE.txt file in the project root.
  37200. */
  37201. //
  37202. //
  37203. // This implementation of {@link ANTLRErrorListener} can be used to identify
  37204. // certain potential correctness and performance problems in grammars. "Reports"
  37205. // are made by calling {@link Parser//notifyErrorListeners} with the appropriate
  37206. // message.
  37207. //
  37208. // <ul>
  37209. // <li><b>Ambiguities</b>: These are cases where more than one path through the
  37210. // grammar can match the input.</li>
  37211. // <li><b>Weak context sensitivity</b>: These are cases where full-context
  37212. // prediction resolved an SLL conflict to a unique alternative which equaled the
  37213. // minimum alternative of the SLL conflict.</li>
  37214. // <li><b>Strong (forced) context sensitivity</b>: These are cases where the
  37215. // full-context prediction resolved an SLL conflict to a unique alternative,
  37216. // <em>and</em> the minimum alternative of the SLL conflict was found to not be
  37217. // a truly viable alternative. Two-stage parsing cannot be used for inputs where
  37218. // this situation occurs.</li>
  37219. // </ul>
  37220. var BitSet = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js").BitSet;
  37221. var ErrorListener = __webpack_require__(/*! ./ErrorListener */ "./node_modules/antlr4/error/ErrorListener.js").ErrorListener;
  37222. var Interval = __webpack_require__(/*! ./../IntervalSet */ "./node_modules/antlr4/IntervalSet.js").Interval;
  37223. function DiagnosticErrorListener(exactOnly) {
  37224. ErrorListener.call(this);
  37225. exactOnly = exactOnly || true;
  37226. // whether all ambiguities or only exact ambiguities are reported.
  37227. this.exactOnly = exactOnly;
  37228. return this;
  37229. }
  37230. DiagnosticErrorListener.prototype = Object.create(ErrorListener.prototype);
  37231. DiagnosticErrorListener.prototype.constructor = DiagnosticErrorListener;
  37232. DiagnosticErrorListener.prototype.reportAmbiguity = function(recognizer, dfa,
  37233. startIndex, stopIndex, exact, ambigAlts, configs) {
  37234. if (this.exactOnly && !exact) {
  37235. return;
  37236. }
  37237. var msg = "reportAmbiguity d=" +
  37238. this.getDecisionDescription(recognizer, dfa) +
  37239. ": ambigAlts=" +
  37240. this.getConflictingAlts(ambigAlts, configs) +
  37241. ", input='" +
  37242. recognizer.getTokenStream().getText(new Interval(startIndex, stopIndex)) + "'";
  37243. recognizer.notifyErrorListeners(msg);
  37244. };
  37245. DiagnosticErrorListener.prototype.reportAttemptingFullContext = function(
  37246. recognizer, dfa, startIndex, stopIndex, conflictingAlts, configs) {
  37247. var msg = "reportAttemptingFullContext d=" +
  37248. this.getDecisionDescription(recognizer, dfa) +
  37249. ", input='" +
  37250. recognizer.getTokenStream().getText(new Interval(startIndex, stopIndex)) + "'";
  37251. recognizer.notifyErrorListeners(msg);
  37252. };
  37253. DiagnosticErrorListener.prototype.reportContextSensitivity = function(
  37254. recognizer, dfa, startIndex, stopIndex, prediction, configs) {
  37255. var msg = "reportContextSensitivity d=" +
  37256. this.getDecisionDescription(recognizer, dfa) +
  37257. ", input='" +
  37258. recognizer.getTokenStream().getText(new Interval(startIndex, stopIndex)) + "'";
  37259. recognizer.notifyErrorListeners(msg);
  37260. };
  37261. DiagnosticErrorListener.prototype.getDecisionDescription = function(recognizer, dfa) {
  37262. var decision = dfa.decision;
  37263. var ruleIndex = dfa.atnStartState.ruleIndex;
  37264. var ruleNames = recognizer.ruleNames;
  37265. if (ruleIndex < 0 || ruleIndex >= ruleNames.length) {
  37266. return "" + decision;
  37267. }
  37268. var ruleName = ruleNames[ruleIndex] || null;
  37269. if (ruleName === null || ruleName.length === 0) {
  37270. return "" + decision;
  37271. }
  37272. return "" + decision + " (" + ruleName + ")";
  37273. };
  37274. //
  37275. // Computes the set of conflicting or ambiguous alternatives from a
  37276. // configuration set, if that information was not already provided by the
  37277. // parser.
  37278. //
  37279. // @param reportedAlts The set of conflicting or ambiguous alternatives, as
  37280. // reported by the parser.
  37281. // @param configs The conflicting or ambiguous configuration set.
  37282. // @return Returns {@code reportedAlts} if it is not {@code null}, otherwise
  37283. // returns the set of alternatives represented in {@code configs}.
  37284. //
  37285. DiagnosticErrorListener.prototype.getConflictingAlts = function(reportedAlts, configs) {
  37286. if (reportedAlts !== null) {
  37287. return reportedAlts;
  37288. }
  37289. var result = new BitSet();
  37290. for (var i = 0; i < configs.items.length; i++) {
  37291. result.add(configs.items[i].alt);
  37292. }
  37293. return "{" + result.values().join(", ") + "}";
  37294. };
  37295. exports.DiagnosticErrorListener = DiagnosticErrorListener;
  37296. /***/ }),
  37297. /***/ "./node_modules/antlr4/error/ErrorListener.js":
  37298. /*!****************************************************!*\
  37299. !*** ./node_modules/antlr4/error/ErrorListener.js ***!
  37300. \****************************************************/
  37301. /*! no static exports found */
  37302. /***/ (function(module, exports) {
  37303. //
  37304. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  37305. * Use of this file is governed by the BSD 3-clause license that
  37306. * can be found in the LICENSE.txt file in the project root.
  37307. */
  37308. // Provides an empty default implementation of {@link ANTLRErrorListener}. The
  37309. // default implementation of each method does nothing, but can be overridden as
  37310. // necessary.
  37311. function ErrorListener() {
  37312. return this;
  37313. }
  37314. ErrorListener.prototype.syntaxError = function(recognizer, offendingSymbol, line, column, msg, e) {
  37315. };
  37316. ErrorListener.prototype.reportAmbiguity = function(recognizer, dfa, startIndex, stopIndex, exact, ambigAlts, configs) {
  37317. };
  37318. ErrorListener.prototype.reportAttemptingFullContext = function(recognizer, dfa, startIndex, stopIndex, conflictingAlts, configs) {
  37319. };
  37320. ErrorListener.prototype.reportContextSensitivity = function(recognizer, dfa, startIndex, stopIndex, prediction, configs) {
  37321. };
  37322. function ConsoleErrorListener() {
  37323. ErrorListener.call(this);
  37324. return this;
  37325. }
  37326. ConsoleErrorListener.prototype = Object.create(ErrorListener.prototype);
  37327. ConsoleErrorListener.prototype.constructor = ConsoleErrorListener;
  37328. //
  37329. // Provides a default instance of {@link ConsoleErrorListener}.
  37330. //
  37331. ConsoleErrorListener.INSTANCE = new ConsoleErrorListener();
  37332. //
  37333. // {@inheritDoc}
  37334. //
  37335. // <p>
  37336. // This implementation prints messages to {@link System//err} containing the
  37337. // values of {@code line}, {@code charPositionInLine}, and {@code msg} using
  37338. // the following format.</p>
  37339. //
  37340. // <pre>
  37341. // line <em>line</em>:<em>charPositionInLine</em> <em>msg</em>
  37342. // </pre>
  37343. //
  37344. ConsoleErrorListener.prototype.syntaxError = function(recognizer, offendingSymbol, line, column, msg, e) {
  37345. console.error("line " + line + ":" + column + " " + msg);
  37346. };
  37347. function ProxyErrorListener(delegates) {
  37348. ErrorListener.call(this);
  37349. if (delegates===null) {
  37350. throw "delegates";
  37351. }
  37352. this.delegates = delegates;
  37353. return this;
  37354. }
  37355. ProxyErrorListener.prototype = Object.create(ErrorListener.prototype);
  37356. ProxyErrorListener.prototype.constructor = ProxyErrorListener;
  37357. ProxyErrorListener.prototype.syntaxError = function(recognizer, offendingSymbol, line, column, msg, e) {
  37358. this.delegates.map(function(d) { d.syntaxError(recognizer, offendingSymbol, line, column, msg, e); });
  37359. };
  37360. ProxyErrorListener.prototype.reportAmbiguity = function(recognizer, dfa, startIndex, stopIndex, exact, ambigAlts, configs) {
  37361. this.delegates.map(function(d) { d.reportAmbiguity(recognizer, dfa, startIndex, stopIndex, exact, ambigAlts, configs); });
  37362. };
  37363. ProxyErrorListener.prototype.reportAttemptingFullContext = function(recognizer, dfa, startIndex, stopIndex, conflictingAlts, configs) {
  37364. this.delegates.map(function(d) { d.reportAttemptingFullContext(recognizer, dfa, startIndex, stopIndex, conflictingAlts, configs); });
  37365. };
  37366. ProxyErrorListener.prototype.reportContextSensitivity = function(recognizer, dfa, startIndex, stopIndex, prediction, configs) {
  37367. this.delegates.map(function(d) { d.reportContextSensitivity(recognizer, dfa, startIndex, stopIndex, prediction, configs); });
  37368. };
  37369. exports.ErrorListener = ErrorListener;
  37370. exports.ConsoleErrorListener = ConsoleErrorListener;
  37371. exports.ProxyErrorListener = ProxyErrorListener;
  37372. /***/ }),
  37373. /***/ "./node_modules/antlr4/error/ErrorStrategy.js":
  37374. /*!****************************************************!*\
  37375. !*** ./node_modules/antlr4/error/ErrorStrategy.js ***!
  37376. \****************************************************/
  37377. /*! no static exports found */
  37378. /***/ (function(module, exports, __webpack_require__) {
  37379. //
  37380. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  37381. * Use of this file is governed by the BSD 3-clause license that
  37382. * can be found in the LICENSE.txt file in the project root.
  37383. */
  37384. //
  37385. var Token = __webpack_require__(/*! ./../Token */ "./node_modules/antlr4/Token.js").Token;
  37386. var Errors = __webpack_require__(/*! ./Errors */ "./node_modules/antlr4/error/Errors.js");
  37387. var NoViableAltException = Errors.NoViableAltException;
  37388. var InputMismatchException = Errors.InputMismatchException;
  37389. var FailedPredicateException = Errors.FailedPredicateException;
  37390. var ParseCancellationException = Errors.ParseCancellationException;
  37391. var ATNState = __webpack_require__(/*! ./../atn/ATNState */ "./node_modules/antlr4/atn/ATNState.js").ATNState;
  37392. var Interval = __webpack_require__(/*! ./../IntervalSet */ "./node_modules/antlr4/IntervalSet.js").Interval;
  37393. var IntervalSet = __webpack_require__(/*! ./../IntervalSet */ "./node_modules/antlr4/IntervalSet.js").IntervalSet;
  37394. function ErrorStrategy() {
  37395. }
  37396. ErrorStrategy.prototype.reset = function(recognizer){
  37397. };
  37398. ErrorStrategy.prototype.recoverInline = function(recognizer){
  37399. };
  37400. ErrorStrategy.prototype.recover = function(recognizer, e){
  37401. };
  37402. ErrorStrategy.prototype.sync = function(recognizer){
  37403. };
  37404. ErrorStrategy.prototype.inErrorRecoveryMode = function(recognizer){
  37405. };
  37406. ErrorStrategy.prototype.reportError = function(recognizer){
  37407. };
  37408. // This is the default implementation of {@link ANTLRErrorStrategy} used for
  37409. // error reporting and recovery in ANTLR parsers.
  37410. //
  37411. function DefaultErrorStrategy() {
  37412. ErrorStrategy.call(this);
  37413. // Indicates whether the error strategy is currently "recovering from an
  37414. // error". This is used to suppress reporting multiple error messages while
  37415. // attempting to recover from a detected syntax error.
  37416. //
  37417. // @see //inErrorRecoveryMode
  37418. //
  37419. this.errorRecoveryMode = false;
  37420. // The index into the input stream where the last error occurred.
  37421. // This is used to prevent infinite loops where an error is found
  37422. // but no token is consumed during recovery...another error is found,
  37423. // ad nauseum. This is a failsafe mechanism to guarantee that at least
  37424. // one token/tree node is consumed for two errors.
  37425. //
  37426. this.lastErrorIndex = -1;
  37427. this.lastErrorStates = null;
  37428. return this;
  37429. }
  37430. DefaultErrorStrategy.prototype = Object.create(ErrorStrategy.prototype);
  37431. DefaultErrorStrategy.prototype.constructor = DefaultErrorStrategy;
  37432. // <p>The default implementation simply calls {@link //endErrorCondition} to
  37433. // ensure that the handler is not in error recovery mode.</p>
  37434. DefaultErrorStrategy.prototype.reset = function(recognizer) {
  37435. this.endErrorCondition(recognizer);
  37436. };
  37437. //
  37438. // This method is called to enter error recovery mode when a recognition
  37439. // exception is reported.
  37440. //
  37441. // @param recognizer the parser instance
  37442. //
  37443. DefaultErrorStrategy.prototype.beginErrorCondition = function(recognizer) {
  37444. this.errorRecoveryMode = true;
  37445. };
  37446. DefaultErrorStrategy.prototype.inErrorRecoveryMode = function(recognizer) {
  37447. return this.errorRecoveryMode;
  37448. };
  37449. //
  37450. // This method is called to leave error recovery mode after recovering from
  37451. // a recognition exception.
  37452. //
  37453. // @param recognizer
  37454. //
  37455. DefaultErrorStrategy.prototype.endErrorCondition = function(recognizer) {
  37456. this.errorRecoveryMode = false;
  37457. this.lastErrorStates = null;
  37458. this.lastErrorIndex = -1;
  37459. };
  37460. //
  37461. // {@inheritDoc}
  37462. //
  37463. // <p>The default implementation simply calls {@link //endErrorCondition}.</p>
  37464. //
  37465. DefaultErrorStrategy.prototype.reportMatch = function(recognizer) {
  37466. this.endErrorCondition(recognizer);
  37467. };
  37468. //
  37469. // {@inheritDoc}
  37470. //
  37471. // <p>The default implementation returns immediately if the handler is already
  37472. // in error recovery mode. Otherwise, it calls {@link //beginErrorCondition}
  37473. // and dispatches the reporting task based on the runtime type of {@code e}
  37474. // according to the following table.</p>
  37475. //
  37476. // <ul>
  37477. // <li>{@link NoViableAltException}: Dispatches the call to
  37478. // {@link //reportNoViableAlternative}</li>
  37479. // <li>{@link InputMismatchException}: Dispatches the call to
  37480. // {@link //reportInputMismatch}</li>
  37481. // <li>{@link FailedPredicateException}: Dispatches the call to
  37482. // {@link //reportFailedPredicate}</li>
  37483. // <li>All other types: calls {@link Parser//notifyErrorListeners} to report
  37484. // the exception</li>
  37485. // </ul>
  37486. //
  37487. DefaultErrorStrategy.prototype.reportError = function(recognizer, e) {
  37488. // if we've already reported an error and have not matched a token
  37489. // yet successfully, don't report any errors.
  37490. if(this.inErrorRecoveryMode(recognizer)) {
  37491. return; // don't report spurious errors
  37492. }
  37493. this.beginErrorCondition(recognizer);
  37494. if ( e instanceof NoViableAltException ) {
  37495. this.reportNoViableAlternative(recognizer, e);
  37496. } else if ( e instanceof InputMismatchException ) {
  37497. this.reportInputMismatch(recognizer, e);
  37498. } else if ( e instanceof FailedPredicateException ) {
  37499. this.reportFailedPredicate(recognizer, e);
  37500. } else {
  37501. console.log("unknown recognition error type: " + e.constructor.name);
  37502. console.log(e.stack);
  37503. recognizer.notifyErrorListeners(e.getOffendingToken(), e.getMessage(), e);
  37504. }
  37505. };
  37506. //
  37507. // {@inheritDoc}
  37508. //
  37509. // <p>The default implementation resynchronizes the parser by consuming tokens
  37510. // until we find one in the resynchronization set--loosely the set of tokens
  37511. // that can follow the current rule.</p>
  37512. //
  37513. DefaultErrorStrategy.prototype.recover = function(recognizer, e) {
  37514. if (this.lastErrorIndex===recognizer.getInputStream().index &&
  37515. this.lastErrorStates !== null && this.lastErrorStates.indexOf(recognizer.state)>=0) {
  37516. // uh oh, another error at same token index and previously-visited
  37517. // state in ATN; must be a case where LT(1) is in the recovery
  37518. // token set so nothing got consumed. Consume a single token
  37519. // at least to prevent an infinite loop; this is a failsafe.
  37520. recognizer.consume();
  37521. }
  37522. this.lastErrorIndex = recognizer._input.index;
  37523. if (this.lastErrorStates === null) {
  37524. this.lastErrorStates = [];
  37525. }
  37526. this.lastErrorStates.push(recognizer.state);
  37527. var followSet = this.getErrorRecoverySet(recognizer);
  37528. this.consumeUntil(recognizer, followSet);
  37529. };
  37530. // The default implementation of {@link ANTLRErrorStrategy//sync} makes sure
  37531. // that the current lookahead symbol is consistent with what were expecting
  37532. // at this point in the ATN. You can call this anytime but ANTLR only
  37533. // generates code to check before subrules/loops and each iteration.
  37534. //
  37535. // <p>Implements Jim Idle's magic sync mechanism in closures and optional
  37536. // subrules. E.g.,</p>
  37537. //
  37538. // <pre>
  37539. // a : sync ( stuff sync )* ;
  37540. // sync : {consume to what can follow sync} ;
  37541. // </pre>
  37542. //
  37543. // At the start of a sub rule upon error, {@link //sync} performs single
  37544. // token deletion, if possible. If it can't do that, it bails on the current
  37545. // rule and uses the default error recovery, which consumes until the
  37546. // resynchronization set of the current rule.
  37547. //
  37548. // <p>If the sub rule is optional ({@code (...)?}, {@code (...)*}, or block
  37549. // with an empty alternative), then the expected set includes what follows
  37550. // the subrule.</p>
  37551. //
  37552. // <p>During loop iteration, it consumes until it sees a token that can start a
  37553. // sub rule or what follows loop. Yes, that is pretty aggressive. We opt to
  37554. // stay in the loop as long as possible.</p>
  37555. //
  37556. // <p><strong>ORIGINS</strong></p>
  37557. //
  37558. // <p>Previous versions of ANTLR did a poor job of their recovery within loops.
  37559. // A single mismatch token or missing token would force the parser to bail
  37560. // out of the entire rules surrounding the loop. So, for rule</p>
  37561. //
  37562. // <pre>
  37563. // classDef : 'class' ID '{' member* '}'
  37564. // </pre>
  37565. //
  37566. // input with an extra token between members would force the parser to
  37567. // consume until it found the next class definition rather than the next
  37568. // member definition of the current class.
  37569. //
  37570. // <p>This functionality cost a little bit of effort because the parser has to
  37571. // compare token set at the start of the loop and at each iteration. If for
  37572. // some reason speed is suffering for you, you can turn off this
  37573. // functionality by simply overriding this method as a blank { }.</p>
  37574. //
  37575. DefaultErrorStrategy.prototype.sync = function(recognizer) {
  37576. // If already recovering, don't try to sync
  37577. if (this.inErrorRecoveryMode(recognizer)) {
  37578. return;
  37579. }
  37580. var s = recognizer._interp.atn.states[recognizer.state];
  37581. var la = recognizer.getTokenStream().LA(1);
  37582. // try cheaper subset first; might get lucky. seems to shave a wee bit off
  37583. var nextTokens = recognizer.atn.nextTokens(s);
  37584. if (nextTokens.contains(Token.EPSILON) || nextTokens.contains(la)) {
  37585. return;
  37586. }
  37587. switch (s.stateType) {
  37588. case ATNState.BLOCK_START:
  37589. case ATNState.STAR_BLOCK_START:
  37590. case ATNState.PLUS_BLOCK_START:
  37591. case ATNState.STAR_LOOP_ENTRY:
  37592. // report error and recover if possible
  37593. if( this.singleTokenDeletion(recognizer) !== null) {
  37594. return;
  37595. } else {
  37596. throw new InputMismatchException(recognizer);
  37597. }
  37598. break;
  37599. case ATNState.PLUS_LOOP_BACK:
  37600. case ATNState.STAR_LOOP_BACK:
  37601. this.reportUnwantedToken(recognizer);
  37602. var expecting = new IntervalSet();
  37603. expecting.addSet(recognizer.getExpectedTokens());
  37604. var whatFollowsLoopIterationOrRule = expecting.addSet(this.getErrorRecoverySet(recognizer));
  37605. this.consumeUntil(recognizer, whatFollowsLoopIterationOrRule);
  37606. break;
  37607. default:
  37608. // do nothing if we can't identify the exact kind of ATN state
  37609. }
  37610. };
  37611. // This is called by {@link //reportError} when the exception is a
  37612. // {@link NoViableAltException}.
  37613. //
  37614. // @see //reportError
  37615. //
  37616. // @param recognizer the parser instance
  37617. // @param e the recognition exception
  37618. //
  37619. DefaultErrorStrategy.prototype.reportNoViableAlternative = function(recognizer, e) {
  37620. var tokens = recognizer.getTokenStream();
  37621. var input;
  37622. if(tokens !== null) {
  37623. if (e.startToken.type===Token.EOF) {
  37624. input = "<EOF>";
  37625. } else {
  37626. input = tokens.getText(new Interval(e.startToken.tokenIndex, e.offendingToken.tokenIndex));
  37627. }
  37628. } else {
  37629. input = "<unknown input>";
  37630. }
  37631. var msg = "no viable alternative at input " + this.escapeWSAndQuote(input);
  37632. recognizer.notifyErrorListeners(msg, e.offendingToken, e);
  37633. };
  37634. //
  37635. // This is called by {@link //reportError} when the exception is an
  37636. // {@link InputMismatchException}.
  37637. //
  37638. // @see //reportError
  37639. //
  37640. // @param recognizer the parser instance
  37641. // @param e the recognition exception
  37642. //
  37643. DefaultErrorStrategy.prototype.reportInputMismatch = function(recognizer, e) {
  37644. var msg = "mismatched input " + this.getTokenErrorDisplay(e.offendingToken) +
  37645. " expecting " + e.getExpectedTokens().toString(recognizer.literalNames, recognizer.symbolicNames);
  37646. recognizer.notifyErrorListeners(msg, e.offendingToken, e);
  37647. };
  37648. //
  37649. // This is called by {@link //reportError} when the exception is a
  37650. // {@link FailedPredicateException}.
  37651. //
  37652. // @see //reportError
  37653. //
  37654. // @param recognizer the parser instance
  37655. // @param e the recognition exception
  37656. //
  37657. DefaultErrorStrategy.prototype.reportFailedPredicate = function(recognizer, e) {
  37658. var ruleName = recognizer.ruleNames[recognizer._ctx.ruleIndex];
  37659. var msg = "rule " + ruleName + " " + e.message;
  37660. recognizer.notifyErrorListeners(msg, e.offendingToken, e);
  37661. };
  37662. // This method is called to report a syntax error which requires the removal
  37663. // of a token from the input stream. At the time this method is called, the
  37664. // erroneous symbol is current {@code LT(1)} symbol and has not yet been
  37665. // removed from the input stream. When this method returns,
  37666. // {@code recognizer} is in error recovery mode.
  37667. //
  37668. // <p>This method is called when {@link //singleTokenDeletion} identifies
  37669. // single-token deletion as a viable recovery strategy for a mismatched
  37670. // input error.</p>
  37671. //
  37672. // <p>The default implementation simply returns if the handler is already in
  37673. // error recovery mode. Otherwise, it calls {@link //beginErrorCondition} to
  37674. // enter error recovery mode, followed by calling
  37675. // {@link Parser//notifyErrorListeners}.</p>
  37676. //
  37677. // @param recognizer the parser instance
  37678. //
  37679. DefaultErrorStrategy.prototype.reportUnwantedToken = function(recognizer) {
  37680. if (this.inErrorRecoveryMode(recognizer)) {
  37681. return;
  37682. }
  37683. this.beginErrorCondition(recognizer);
  37684. var t = recognizer.getCurrentToken();
  37685. var tokenName = this.getTokenErrorDisplay(t);
  37686. var expecting = this.getExpectedTokens(recognizer);
  37687. var msg = "extraneous input " + tokenName + " expecting " +
  37688. expecting.toString(recognizer.literalNames, recognizer.symbolicNames);
  37689. recognizer.notifyErrorListeners(msg, t, null);
  37690. };
  37691. // This method is called to report a syntax error which requires the
  37692. // insertion of a missing token into the input stream. At the time this
  37693. // method is called, the missing token has not yet been inserted. When this
  37694. // method returns, {@code recognizer} is in error recovery mode.
  37695. //
  37696. // <p>This method is called when {@link //singleTokenInsertion} identifies
  37697. // single-token insertion as a viable recovery strategy for a mismatched
  37698. // input error.</p>
  37699. //
  37700. // <p>The default implementation simply returns if the handler is already in
  37701. // error recovery mode. Otherwise, it calls {@link //beginErrorCondition} to
  37702. // enter error recovery mode, followed by calling
  37703. // {@link Parser//notifyErrorListeners}.</p>
  37704. //
  37705. // @param recognizer the parser instance
  37706. //
  37707. DefaultErrorStrategy.prototype.reportMissingToken = function(recognizer) {
  37708. if ( this.inErrorRecoveryMode(recognizer)) {
  37709. return;
  37710. }
  37711. this.beginErrorCondition(recognizer);
  37712. var t = recognizer.getCurrentToken();
  37713. var expecting = this.getExpectedTokens(recognizer);
  37714. var msg = "missing " + expecting.toString(recognizer.literalNames, recognizer.symbolicNames) +
  37715. " at " + this.getTokenErrorDisplay(t);
  37716. recognizer.notifyErrorListeners(msg, t, null);
  37717. };
  37718. // <p>The default implementation attempts to recover from the mismatched input
  37719. // by using single token insertion and deletion as described below. If the
  37720. // recovery attempt fails, this method throws an
  37721. // {@link InputMismatchException}.</p>
  37722. //
  37723. // <p><strong>EXTRA TOKEN</strong> (single token deletion)</p>
  37724. //
  37725. // <p>{@code LA(1)} is not what we are looking for. If {@code LA(2)} has the
  37726. // right token, however, then assume {@code LA(1)} is some extra spurious
  37727. // token and delete it. Then consume and return the next token (which was
  37728. // the {@code LA(2)} token) as the successful result of the match operation.</p>
  37729. //
  37730. // <p>This recovery strategy is implemented by {@link
  37731. // //singleTokenDeletion}.</p>
  37732. //
  37733. // <p><strong>MISSING TOKEN</strong> (single token insertion)</p>
  37734. //
  37735. // <p>If current token (at {@code LA(1)}) is consistent with what could come
  37736. // after the expected {@code LA(1)} token, then assume the token is missing
  37737. // and use the parser's {@link TokenFactory} to create it on the fly. The
  37738. // "insertion" is performed by returning the created token as the successful
  37739. // result of the match operation.</p>
  37740. //
  37741. // <p>This recovery strategy is implemented by {@link
  37742. // //singleTokenInsertion}.</p>
  37743. //
  37744. // <p><strong>EXAMPLE</strong></p>
  37745. //
  37746. // <p>For example, Input {@code i=(3;} is clearly missing the {@code ')'}. When
  37747. // the parser returns from the nested call to {@code expr}, it will have
  37748. // call chain:</p>
  37749. //
  37750. // <pre>
  37751. // stat &rarr; expr &rarr; atom
  37752. // </pre>
  37753. //
  37754. // and it will be trying to match the {@code ')'} at this point in the
  37755. // derivation:
  37756. //
  37757. // <pre>
  37758. // =&gt; ID '=' '(' INT ')' ('+' atom)* ';'
  37759. // ^
  37760. // </pre>
  37761. //
  37762. // The attempt to match {@code ')'} will fail when it sees {@code ';'} and
  37763. // call {@link //recoverInline}. To recover, it sees that {@code LA(1)==';'}
  37764. // is in the set of tokens that can follow the {@code ')'} token reference
  37765. // in rule {@code atom}. It can assume that you forgot the {@code ')'}.
  37766. //
  37767. DefaultErrorStrategy.prototype.recoverInline = function(recognizer) {
  37768. // SINGLE TOKEN DELETION
  37769. var matchedSymbol = this.singleTokenDeletion(recognizer);
  37770. if (matchedSymbol !== null) {
  37771. // we have deleted the extra token.
  37772. // now, move past ttype token as if all were ok
  37773. recognizer.consume();
  37774. return matchedSymbol;
  37775. }
  37776. // SINGLE TOKEN INSERTION
  37777. if (this.singleTokenInsertion(recognizer)) {
  37778. return this.getMissingSymbol(recognizer);
  37779. }
  37780. // even that didn't work; must throw the exception
  37781. throw new InputMismatchException(recognizer);
  37782. };
  37783. //
  37784. // This method implements the single-token insertion inline error recovery
  37785. // strategy. It is called by {@link //recoverInline} if the single-token
  37786. // deletion strategy fails to recover from the mismatched input. If this
  37787. // method returns {@code true}, {@code recognizer} will be in error recovery
  37788. // mode.
  37789. //
  37790. // <p>This method determines whether or not single-token insertion is viable by
  37791. // checking if the {@code LA(1)} input symbol could be successfully matched
  37792. // if it were instead the {@code LA(2)} symbol. If this method returns
  37793. // {@code true}, the caller is responsible for creating and inserting a
  37794. // token with the correct type to produce this behavior.</p>
  37795. //
  37796. // @param recognizer the parser instance
  37797. // @return {@code true} if single-token insertion is a viable recovery
  37798. // strategy for the current mismatched input, otherwise {@code false}
  37799. //
  37800. DefaultErrorStrategy.prototype.singleTokenInsertion = function(recognizer) {
  37801. var currentSymbolType = recognizer.getTokenStream().LA(1);
  37802. // if current token is consistent with what could come after current
  37803. // ATN state, then we know we're missing a token; error recovery
  37804. // is free to conjure up and insert the missing token
  37805. var atn = recognizer._interp.atn;
  37806. var currentState = atn.states[recognizer.state];
  37807. var next = currentState.transitions[0].target;
  37808. var expectingAtLL2 = atn.nextTokens(next, recognizer._ctx);
  37809. if (expectingAtLL2.contains(currentSymbolType) ){
  37810. this.reportMissingToken(recognizer);
  37811. return true;
  37812. } else {
  37813. return false;
  37814. }
  37815. };
  37816. // This method implements the single-token deletion inline error recovery
  37817. // strategy. It is called by {@link //recoverInline} to attempt to recover
  37818. // from mismatched input. If this method returns null, the parser and error
  37819. // handler state will not have changed. If this method returns non-null,
  37820. // {@code recognizer} will <em>not</em> be in error recovery mode since the
  37821. // returned token was a successful match.
  37822. //
  37823. // <p>If the single-token deletion is successful, this method calls
  37824. // {@link //reportUnwantedToken} to report the error, followed by
  37825. // {@link Parser//consume} to actually "delete" the extraneous token. Then,
  37826. // before returning {@link //reportMatch} is called to signal a successful
  37827. // match.</p>
  37828. //
  37829. // @param recognizer the parser instance
  37830. // @return the successfully matched {@link Token} instance if single-token
  37831. // deletion successfully recovers from the mismatched input, otherwise
  37832. // {@code null}
  37833. //
  37834. DefaultErrorStrategy.prototype.singleTokenDeletion = function(recognizer) {
  37835. var nextTokenType = recognizer.getTokenStream().LA(2);
  37836. var expecting = this.getExpectedTokens(recognizer);
  37837. if (expecting.contains(nextTokenType)) {
  37838. this.reportUnwantedToken(recognizer);
  37839. // print("recoverFromMismatchedToken deleting " \
  37840. // + str(recognizer.getTokenStream().LT(1)) \
  37841. // + " since " + str(recognizer.getTokenStream().LT(2)) \
  37842. // + " is what we want", file=sys.stderr)
  37843. recognizer.consume(); // simply delete extra token
  37844. // we want to return the token we're actually matching
  37845. var matchedSymbol = recognizer.getCurrentToken();
  37846. this.reportMatch(recognizer); // we know current token is correct
  37847. return matchedSymbol;
  37848. } else {
  37849. return null;
  37850. }
  37851. };
  37852. // Conjure up a missing token during error recovery.
  37853. //
  37854. // The recognizer attempts to recover from single missing
  37855. // symbols. But, actions might refer to that missing symbol.
  37856. // For example, x=ID {f($x);}. The action clearly assumes
  37857. // that there has been an identifier matched previously and that
  37858. // $x points at that token. If that token is missing, but
  37859. // the next token in the stream is what we want we assume that
  37860. // this token is missing and we keep going. Because we
  37861. // have to return some token to replace the missing token,
  37862. // we have to conjure one up. This method gives the user control
  37863. // over the tokens returned for missing tokens. Mostly,
  37864. // you will want to create something special for identifier
  37865. // tokens. For literals such as '{' and ',', the default
  37866. // action in the parser or tree parser works. It simply creates
  37867. // a CommonToken of the appropriate type. The text will be the token.
  37868. // If you change what tokens must be created by the lexer,
  37869. // override this method to create the appropriate tokens.
  37870. //
  37871. DefaultErrorStrategy.prototype.getMissingSymbol = function(recognizer) {
  37872. var currentSymbol = recognizer.getCurrentToken();
  37873. var expecting = this.getExpectedTokens(recognizer);
  37874. var expectedTokenType = expecting.first(); // get any element
  37875. var tokenText;
  37876. if (expectedTokenType===Token.EOF) {
  37877. tokenText = "<missing EOF>";
  37878. } else {
  37879. tokenText = "<missing " + recognizer.literalNames[expectedTokenType] + ">";
  37880. }
  37881. var current = currentSymbol;
  37882. var lookback = recognizer.getTokenStream().LT(-1);
  37883. if (current.type===Token.EOF && lookback !== null) {
  37884. current = lookback;
  37885. }
  37886. return recognizer.getTokenFactory().create(current.source,
  37887. expectedTokenType, tokenText, Token.DEFAULT_CHANNEL,
  37888. -1, -1, current.line, current.column);
  37889. };
  37890. DefaultErrorStrategy.prototype.getExpectedTokens = function(recognizer) {
  37891. return recognizer.getExpectedTokens();
  37892. };
  37893. // How should a token be displayed in an error message? The default
  37894. // is to display just the text, but during development you might
  37895. // want to have a lot of information spit out. Override in that case
  37896. // to use t.toString() (which, for CommonToken, dumps everything about
  37897. // the token). This is better than forcing you to override a method in
  37898. // your token objects because you don't have to go modify your lexer
  37899. // so that it creates a new Java type.
  37900. //
  37901. DefaultErrorStrategy.prototype.getTokenErrorDisplay = function(t) {
  37902. if (t === null) {
  37903. return "<no token>";
  37904. }
  37905. var s = t.text;
  37906. if (s === null) {
  37907. if (t.type===Token.EOF) {
  37908. s = "<EOF>";
  37909. } else {
  37910. s = "<" + t.type + ">";
  37911. }
  37912. }
  37913. return this.escapeWSAndQuote(s);
  37914. };
  37915. DefaultErrorStrategy.prototype.escapeWSAndQuote = function(s) {
  37916. s = s.replace(/\n/g,"\\n");
  37917. s = s.replace(/\r/g,"\\r");
  37918. s = s.replace(/\t/g,"\\t");
  37919. return "'" + s + "'";
  37920. };
  37921. // Compute the error recovery set for the current rule. During
  37922. // rule invocation, the parser pushes the set of tokens that can
  37923. // follow that rule reference on the stack; this amounts to
  37924. // computing FIRST of what follows the rule reference in the
  37925. // enclosing rule. See LinearApproximator.FIRST().
  37926. // This local follow set only includes tokens
  37927. // from within the rule; i.e., the FIRST computation done by
  37928. // ANTLR stops at the end of a rule.
  37929. //
  37930. // EXAMPLE
  37931. //
  37932. // When you find a "no viable alt exception", the input is not
  37933. // consistent with any of the alternatives for rule r. The best
  37934. // thing to do is to consume tokens until you see something that
  37935. // can legally follow a call to r//or* any rule that called r.
  37936. // You don't want the exact set of viable next tokens because the
  37937. // input might just be missing a token--you might consume the
  37938. // rest of the input looking for one of the missing tokens.
  37939. //
  37940. // Consider grammar:
  37941. //
  37942. // a : '[' b ']'
  37943. // | '(' b ')'
  37944. // ;
  37945. // b : c '^' INT ;
  37946. // c : ID
  37947. // | INT
  37948. // ;
  37949. //
  37950. // At each rule invocation, the set of tokens that could follow
  37951. // that rule is pushed on a stack. Here are the various
  37952. // context-sensitive follow sets:
  37953. //
  37954. // FOLLOW(b1_in_a) = FIRST(']') = ']'
  37955. // FOLLOW(b2_in_a) = FIRST(')') = ')'
  37956. // FOLLOW(c_in_b) = FIRST('^') = '^'
  37957. //
  37958. // Upon erroneous input "[]", the call chain is
  37959. //
  37960. // a -> b -> c
  37961. //
  37962. // and, hence, the follow context stack is:
  37963. //
  37964. // depth follow set start of rule execution
  37965. // 0 <EOF> a (from main())
  37966. // 1 ']' b
  37967. // 2 '^' c
  37968. //
  37969. // Notice that ')' is not included, because b would have to have
  37970. // been called from a different context in rule a for ')' to be
  37971. // included.
  37972. //
  37973. // For error recovery, we cannot consider FOLLOW(c)
  37974. // (context-sensitive or otherwise). We need the combined set of
  37975. // all context-sensitive FOLLOW sets--the set of all tokens that
  37976. // could follow any reference in the call chain. We need to
  37977. // resync to one of those tokens. Note that FOLLOW(c)='^' and if
  37978. // we resync'd to that token, we'd consume until EOF. We need to
  37979. // sync to context-sensitive FOLLOWs for a, b, and c: {']','^'}.
  37980. // In this case, for input "[]", LA(1) is ']' and in the set, so we would
  37981. // not consume anything. After printing an error, rule c would
  37982. // return normally. Rule b would not find the required '^' though.
  37983. // At this point, it gets a mismatched token error and throws an
  37984. // exception (since LA(1) is not in the viable following token
  37985. // set). The rule exception handler tries to recover, but finds
  37986. // the same recovery set and doesn't consume anything. Rule b
  37987. // exits normally returning to rule a. Now it finds the ']' (and
  37988. // with the successful match exits errorRecovery mode).
  37989. //
  37990. // So, you can see that the parser walks up the call chain looking
  37991. // for the token that was a member of the recovery set.
  37992. //
  37993. // Errors are not generated in errorRecovery mode.
  37994. //
  37995. // ANTLR's error recovery mechanism is based upon original ideas:
  37996. //
  37997. // "Algorithms + Data Structures = Programs" by Niklaus Wirth
  37998. //
  37999. // and
  38000. //
  38001. // "A note on error recovery in recursive descent parsers":
  38002. // http://portal.acm.org/citation.cfm?id=947902.947905
  38003. //
  38004. // Later, Josef Grosch had some good ideas:
  38005. //
  38006. // "Efficient and Comfortable Error Recovery in Recursive Descent
  38007. // Parsers":
  38008. // ftp://www.cocolab.com/products/cocktail/doca4.ps/ell.ps.zip
  38009. //
  38010. // Like Grosch I implement context-sensitive FOLLOW sets that are combined
  38011. // at run-time upon error to avoid overhead during parsing.
  38012. //
  38013. DefaultErrorStrategy.prototype.getErrorRecoverySet = function(recognizer) {
  38014. var atn = recognizer._interp.atn;
  38015. var ctx = recognizer._ctx;
  38016. var recoverSet = new IntervalSet();
  38017. while (ctx !== null && ctx.invokingState>=0) {
  38018. // compute what follows who invoked us
  38019. var invokingState = atn.states[ctx.invokingState];
  38020. var rt = invokingState.transitions[0];
  38021. var follow = atn.nextTokens(rt.followState);
  38022. recoverSet.addSet(follow);
  38023. ctx = ctx.parentCtx;
  38024. }
  38025. recoverSet.removeOne(Token.EPSILON);
  38026. return recoverSet;
  38027. };
  38028. // Consume tokens until one matches the given token set.//
  38029. DefaultErrorStrategy.prototype.consumeUntil = function(recognizer, set) {
  38030. var ttype = recognizer.getTokenStream().LA(1);
  38031. while( ttype !== Token.EOF && !set.contains(ttype)) {
  38032. recognizer.consume();
  38033. ttype = recognizer.getTokenStream().LA(1);
  38034. }
  38035. };
  38036. //
  38037. // This implementation of {@link ANTLRErrorStrategy} responds to syntax errors
  38038. // by immediately canceling the parse operation with a
  38039. // {@link ParseCancellationException}. The implementation ensures that the
  38040. // {@link ParserRuleContext//exception} field is set for all parse tree nodes
  38041. // that were not completed prior to encountering the error.
  38042. //
  38043. // <p>
  38044. // This error strategy is useful in the following scenarios.</p>
  38045. //
  38046. // <ul>
  38047. // <li><strong>Two-stage parsing:</strong> This error strategy allows the first
  38048. // stage of two-stage parsing to immediately terminate if an error is
  38049. // encountered, and immediately fall back to the second stage. In addition to
  38050. // avoiding wasted work by attempting to recover from errors here, the empty
  38051. // implementation of {@link BailErrorStrategy//sync} improves the performance of
  38052. // the first stage.</li>
  38053. // <li><strong>Silent validation:</strong> When syntax errors are not being
  38054. // reported or logged, and the parse result is simply ignored if errors occur,
  38055. // the {@link BailErrorStrategy} avoids wasting work on recovering from errors
  38056. // when the result will be ignored either way.</li>
  38057. // </ul>
  38058. //
  38059. // <p>
  38060. // {@code myparser.setErrorHandler(new BailErrorStrategy());}</p>
  38061. //
  38062. // @see Parser//setErrorHandler(ANTLRErrorStrategy)
  38063. //
  38064. function BailErrorStrategy() {
  38065. DefaultErrorStrategy.call(this);
  38066. return this;
  38067. }
  38068. BailErrorStrategy.prototype = Object.create(DefaultErrorStrategy.prototype);
  38069. BailErrorStrategy.prototype.constructor = BailErrorStrategy;
  38070. // Instead of recovering from exception {@code e}, re-throw it wrapped
  38071. // in a {@link ParseCancellationException} so it is not caught by the
  38072. // rule function catches. Use {@link Exception//getCause()} to get the
  38073. // original {@link RecognitionException}.
  38074. //
  38075. BailErrorStrategy.prototype.recover = function(recognizer, e) {
  38076. var context = recognizer._ctx;
  38077. while (context !== null) {
  38078. context.exception = e;
  38079. context = context.parentCtx;
  38080. }
  38081. throw new ParseCancellationException(e);
  38082. };
  38083. // Make sure we don't attempt to recover inline; if the parser
  38084. // successfully recovers, it won't throw an exception.
  38085. //
  38086. BailErrorStrategy.prototype.recoverInline = function(recognizer) {
  38087. this.recover(recognizer, new InputMismatchException(recognizer));
  38088. };
  38089. // Make sure we don't attempt to recover from problems in subrules.//
  38090. BailErrorStrategy.prototype.sync = function(recognizer) {
  38091. // pass
  38092. };
  38093. exports.BailErrorStrategy = BailErrorStrategy;
  38094. exports.DefaultErrorStrategy = DefaultErrorStrategy;
  38095. /***/ }),
  38096. /***/ "./node_modules/antlr4/error/Errors.js":
  38097. /*!*********************************************!*\
  38098. !*** ./node_modules/antlr4/error/Errors.js ***!
  38099. \*********************************************/
  38100. /*! no static exports found */
  38101. /***/ (function(module, exports, __webpack_require__) {
  38102. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  38103. * Use of this file is governed by the BSD 3-clause license that
  38104. * can be found in the LICENSE.txt file in the project root.
  38105. */
  38106. // The root of the ANTLR exception hierarchy. In general, ANTLR tracks just
  38107. // 3 kinds of errors: prediction errors, failed predicate errors, and
  38108. // mismatched input errors. In each case, the parser knows where it is
  38109. // in the input, where it is in the ATN, the rule invocation stack,
  38110. // and what kind of problem occurred.
  38111. var PredicateTransition = __webpack_require__(/*! ./../atn/Transition */ "./node_modules/antlr4/atn/Transition.js").PredicateTransition;
  38112. function RecognitionException(params) {
  38113. Error.call(this);
  38114. if (!!Error.captureStackTrace) {
  38115. Error.captureStackTrace(this, RecognitionException);
  38116. } else {
  38117. var stack = new Error().stack;
  38118. }
  38119. this.message = params.message;
  38120. this.recognizer = params.recognizer;
  38121. this.input = params.input;
  38122. this.ctx = params.ctx;
  38123. // The current {@link Token} when an error occurred. Since not all streams
  38124. // support accessing symbols by index, we have to track the {@link Token}
  38125. // instance itself.
  38126. this.offendingToken = null;
  38127. // Get the ATN state number the parser was in at the time the error
  38128. // occurred. For {@link NoViableAltException} and
  38129. // {@link LexerNoViableAltException} exceptions, this is the
  38130. // {@link DecisionState} number. For others, it is the state whose outgoing
  38131. // edge we couldn't match.
  38132. this.offendingState = -1;
  38133. if (this.recognizer!==null) {
  38134. this.offendingState = this.recognizer.state;
  38135. }
  38136. return this;
  38137. }
  38138. RecognitionException.prototype = Object.create(Error.prototype);
  38139. RecognitionException.prototype.constructor = RecognitionException;
  38140. // <p>If the state number is not known, this method returns -1.</p>
  38141. //
  38142. // Gets the set of input symbols which could potentially follow the
  38143. // previously matched symbol at the time this exception was thrown.
  38144. //
  38145. // <p>If the set of expected tokens is not known and could not be computed,
  38146. // this method returns {@code null}.</p>
  38147. //
  38148. // @return The set of token types that could potentially follow the current
  38149. // state in the ATN, or {@code null} if the information is not available.
  38150. // /
  38151. RecognitionException.prototype.getExpectedTokens = function() {
  38152. if (this.recognizer!==null) {
  38153. return this.recognizer.atn.getExpectedTokens(this.offendingState, this.ctx);
  38154. } else {
  38155. return null;
  38156. }
  38157. };
  38158. RecognitionException.prototype.toString = function() {
  38159. return this.message;
  38160. };
  38161. function LexerNoViableAltException(lexer, input, startIndex, deadEndConfigs) {
  38162. RecognitionException.call(this, {message:"", recognizer:lexer, input:input, ctx:null});
  38163. this.startIndex = startIndex;
  38164. this.deadEndConfigs = deadEndConfigs;
  38165. return this;
  38166. }
  38167. LexerNoViableAltException.prototype = Object.create(RecognitionException.prototype);
  38168. LexerNoViableAltException.prototype.constructor = LexerNoViableAltException;
  38169. LexerNoViableAltException.prototype.toString = function() {
  38170. var symbol = "";
  38171. if (this.startIndex >= 0 && this.startIndex < this.input.size) {
  38172. symbol = this.input.getText((this.startIndex,this.startIndex));
  38173. }
  38174. return "LexerNoViableAltException" + symbol;
  38175. };
  38176. // Indicates that the parser could not decide which of two or more paths
  38177. // to take based upon the remaining input. It tracks the starting token
  38178. // of the offending input and also knows where the parser was
  38179. // in the various paths when the error. Reported by reportNoViableAlternative()
  38180. //
  38181. function NoViableAltException(recognizer, input, startToken, offendingToken, deadEndConfigs, ctx) {
  38182. ctx = ctx || recognizer._ctx;
  38183. offendingToken = offendingToken || recognizer.getCurrentToken();
  38184. startToken = startToken || recognizer.getCurrentToken();
  38185. input = input || recognizer.getInputStream();
  38186. RecognitionException.call(this, {message:"", recognizer:recognizer, input:input, ctx:ctx});
  38187. // Which configurations did we try at input.index() that couldn't match
  38188. // input.LT(1)?//
  38189. this.deadEndConfigs = deadEndConfigs;
  38190. // The token object at the start index; the input stream might
  38191. // not be buffering tokens so get a reference to it. (At the
  38192. // time the error occurred, of course the stream needs to keep a
  38193. // buffer all of the tokens but later we might not have access to those.)
  38194. this.startToken = startToken;
  38195. this.offendingToken = offendingToken;
  38196. }
  38197. NoViableAltException.prototype = Object.create(RecognitionException.prototype);
  38198. NoViableAltException.prototype.constructor = NoViableAltException;
  38199. // This signifies any kind of mismatched input exceptions such as
  38200. // when the current input does not match the expected token.
  38201. //
  38202. function InputMismatchException(recognizer) {
  38203. RecognitionException.call(this, {message:"", recognizer:recognizer, input:recognizer.getInputStream(), ctx:recognizer._ctx});
  38204. this.offendingToken = recognizer.getCurrentToken();
  38205. }
  38206. InputMismatchException.prototype = Object.create(RecognitionException.prototype);
  38207. InputMismatchException.prototype.constructor = InputMismatchException;
  38208. // A semantic predicate failed during validation. Validation of predicates
  38209. // occurs when normally parsing the alternative just like matching a token.
  38210. // Disambiguating predicate evaluation occurs when we test a predicate during
  38211. // prediction.
  38212. function FailedPredicateException(recognizer, predicate, message) {
  38213. RecognitionException.call(this, {message:this.formatMessage(predicate,message || null), recognizer:recognizer,
  38214. input:recognizer.getInputStream(), ctx:recognizer._ctx});
  38215. var s = recognizer._interp.atn.states[recognizer.state];
  38216. var trans = s.transitions[0];
  38217. if (trans instanceof PredicateTransition) {
  38218. this.ruleIndex = trans.ruleIndex;
  38219. this.predicateIndex = trans.predIndex;
  38220. } else {
  38221. this.ruleIndex = 0;
  38222. this.predicateIndex = 0;
  38223. }
  38224. this.predicate = predicate;
  38225. this.offendingToken = recognizer.getCurrentToken();
  38226. return this;
  38227. }
  38228. FailedPredicateException.prototype = Object.create(RecognitionException.prototype);
  38229. FailedPredicateException.prototype.constructor = FailedPredicateException;
  38230. FailedPredicateException.prototype.formatMessage = function(predicate, message) {
  38231. if (message !==null) {
  38232. return message;
  38233. } else {
  38234. return "failed predicate: {" + predicate + "}?";
  38235. }
  38236. };
  38237. function ParseCancellationException() {
  38238. Error.call(this);
  38239. Error.captureStackTrace(this, ParseCancellationException);
  38240. return this;
  38241. }
  38242. ParseCancellationException.prototype = Object.create(Error.prototype);
  38243. ParseCancellationException.prototype.constructor = ParseCancellationException;
  38244. exports.RecognitionException = RecognitionException;
  38245. exports.NoViableAltException = NoViableAltException;
  38246. exports.LexerNoViableAltException = LexerNoViableAltException;
  38247. exports.InputMismatchException = InputMismatchException;
  38248. exports.FailedPredicateException = FailedPredicateException;
  38249. exports.ParseCancellationException = ParseCancellationException;
  38250. /***/ }),
  38251. /***/ "./node_modules/antlr4/error/index.js":
  38252. /*!********************************************!*\
  38253. !*** ./node_modules/antlr4/error/index.js ***!
  38254. \********************************************/
  38255. /*! no static exports found */
  38256. /***/ (function(module, exports, __webpack_require__) {
  38257. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  38258. * Use of this file is governed by the BSD 3-clause license that
  38259. * can be found in the LICENSE.txt file in the project root.
  38260. */
  38261. exports.RecognitionException = __webpack_require__(/*! ./Errors */ "./node_modules/antlr4/error/Errors.js").RecognitionException;
  38262. exports.NoViableAltException = __webpack_require__(/*! ./Errors */ "./node_modules/antlr4/error/Errors.js").NoViableAltException;
  38263. exports.LexerNoViableAltException = __webpack_require__(/*! ./Errors */ "./node_modules/antlr4/error/Errors.js").LexerNoViableAltException;
  38264. exports.InputMismatchException = __webpack_require__(/*! ./Errors */ "./node_modules/antlr4/error/Errors.js").InputMismatchException;
  38265. exports.FailedPredicateException = __webpack_require__(/*! ./Errors */ "./node_modules/antlr4/error/Errors.js").FailedPredicateException;
  38266. exports.DiagnosticErrorListener = __webpack_require__(/*! ./DiagnosticErrorListener */ "./node_modules/antlr4/error/DiagnosticErrorListener.js").DiagnosticErrorListener;
  38267. exports.BailErrorStrategy = __webpack_require__(/*! ./ErrorStrategy */ "./node_modules/antlr4/error/ErrorStrategy.js").BailErrorStrategy;
  38268. exports.ErrorListener = __webpack_require__(/*! ./ErrorListener */ "./node_modules/antlr4/error/ErrorListener.js").ErrorListener;
  38269. /***/ }),
  38270. /***/ "./node_modules/antlr4/index.js":
  38271. /*!**************************************!*\
  38272. !*** ./node_modules/antlr4/index.js ***!
  38273. \**************************************/
  38274. /*! no static exports found */
  38275. /***/ (function(module, exports, __webpack_require__) {
  38276. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  38277. * Use of this file is governed by the BSD 3-clause license that
  38278. * can be found in the LICENSE.txt file in the project root.
  38279. */
  38280. exports.atn = __webpack_require__(/*! ./atn/index */ "./node_modules/antlr4/atn/index.js");
  38281. exports.codepointat = __webpack_require__(/*! ./polyfills/codepointat */ "./node_modules/antlr4/polyfills/codepointat.js");
  38282. exports.dfa = __webpack_require__(/*! ./dfa/index */ "./node_modules/antlr4/dfa/index.js");
  38283. exports.fromcodepoint = __webpack_require__(/*! ./polyfills/fromcodepoint */ "./node_modules/antlr4/polyfills/fromcodepoint.js");
  38284. exports.tree = __webpack_require__(/*! ./tree/index */ "./node_modules/antlr4/tree/index.js");
  38285. exports.error = __webpack_require__(/*! ./error/index */ "./node_modules/antlr4/error/index.js");
  38286. exports.Token = __webpack_require__(/*! ./Token */ "./node_modules/antlr4/Token.js").Token;
  38287. exports.CharStreams = __webpack_require__(/*! ./CharStreams */ "./node_modules/antlr4/CharStreams.js").CharStreams;
  38288. exports.CommonToken = __webpack_require__(/*! ./Token */ "./node_modules/antlr4/Token.js").CommonToken;
  38289. exports.InputStream = __webpack_require__(/*! ./InputStream */ "./node_modules/antlr4/InputStream.js").InputStream;
  38290. exports.FileStream = __webpack_require__(/*! ./FileStream */ "./node_modules/antlr4/FileStream.js").FileStream;
  38291. exports.CommonTokenStream = __webpack_require__(/*! ./CommonTokenStream */ "./node_modules/antlr4/CommonTokenStream.js").CommonTokenStream;
  38292. exports.Lexer = __webpack_require__(/*! ./Lexer */ "./node_modules/antlr4/Lexer.js").Lexer;
  38293. exports.Parser = __webpack_require__(/*! ./Parser */ "./node_modules/antlr4/Parser.js").Parser;
  38294. var pc = __webpack_require__(/*! ./PredictionContext */ "./node_modules/antlr4/PredictionContext.js");
  38295. exports.PredictionContextCache = pc.PredictionContextCache;
  38296. exports.ParserRuleContext = __webpack_require__(/*! ./ParserRuleContext */ "./node_modules/antlr4/ParserRuleContext.js").ParserRuleContext;
  38297. exports.Interval = __webpack_require__(/*! ./IntervalSet */ "./node_modules/antlr4/IntervalSet.js").Interval;
  38298. exports.Utils = __webpack_require__(/*! ./Utils */ "./node_modules/antlr4/Utils.js");
  38299. /***/ }),
  38300. /***/ "./node_modules/antlr4/polyfills/codepointat.js":
  38301. /*!******************************************************!*\
  38302. !*** ./node_modules/antlr4/polyfills/codepointat.js ***!
  38303. \******************************************************/
  38304. /*! no static exports found */
  38305. /***/ (function(module, exports) {
  38306. /*! https://mths.be/codepointat v0.2.0 by @mathias */
  38307. if (!String.prototype.codePointAt) {
  38308. (function() {
  38309. 'use strict'; // needed to support `apply`/`call` with `undefined`/`null`
  38310. var defineProperty = (function() {
  38311. // IE 8 only supports `Object.defineProperty` on DOM elements
  38312. try {
  38313. var object = {};
  38314. var $defineProperty = Object.defineProperty;
  38315. var result = $defineProperty(object, object, object) && $defineProperty;
  38316. } catch(error) {}
  38317. return result;
  38318. }());
  38319. var codePointAt = function(position) {
  38320. if (this == null) {
  38321. throw TypeError();
  38322. }
  38323. var string = String(this);
  38324. var size = string.length;
  38325. // `ToInteger`
  38326. var index = position ? Number(position) : 0;
  38327. if (index != index) { // better `isNaN`
  38328. index = 0;
  38329. }
  38330. // Account for out-of-bounds indices:
  38331. if (index < 0 || index >= size) {
  38332. return undefined;
  38333. }
  38334. // Get the first code unit
  38335. var first = string.charCodeAt(index);
  38336. var second;
  38337. if ( // check if it’s the start of a surrogate pair
  38338. first >= 0xD800 && first <= 0xDBFF && // high surrogate
  38339. size > index + 1 // there is a next code unit
  38340. ) {
  38341. second = string.charCodeAt(index + 1);
  38342. if (second >= 0xDC00 && second <= 0xDFFF) { // low surrogate
  38343. // https://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae
  38344. return (first - 0xD800) * 0x400 + second - 0xDC00 + 0x10000;
  38345. }
  38346. }
  38347. return first;
  38348. };
  38349. if (defineProperty) {
  38350. defineProperty(String.prototype, 'codePointAt', {
  38351. 'value': codePointAt,
  38352. 'configurable': true,
  38353. 'writable': true
  38354. });
  38355. } else {
  38356. String.prototype.codePointAt = codePointAt;
  38357. }
  38358. }());
  38359. }
  38360. /***/ }),
  38361. /***/ "./node_modules/antlr4/polyfills/fromcodepoint.js":
  38362. /*!********************************************************!*\
  38363. !*** ./node_modules/antlr4/polyfills/fromcodepoint.js ***!
  38364. \********************************************************/
  38365. /*! no static exports found */
  38366. /***/ (function(module, exports) {
  38367. /*! https://mths.be/fromcodepoint v0.2.1 by @mathias */
  38368. if (!String.fromCodePoint) {
  38369. (function() {
  38370. var defineProperty = (function() {
  38371. // IE 8 only supports `Object.defineProperty` on DOM elements
  38372. try {
  38373. var object = {};
  38374. var $defineProperty = Object.defineProperty;
  38375. var result = $defineProperty(object, object, object) && $defineProperty;
  38376. } catch(error) {}
  38377. return result;
  38378. }());
  38379. var stringFromCharCode = String.fromCharCode;
  38380. var floor = Math.floor;
  38381. var fromCodePoint = function(_) {
  38382. var MAX_SIZE = 0x4000;
  38383. var codeUnits = [];
  38384. var highSurrogate;
  38385. var lowSurrogate;
  38386. var index = -1;
  38387. var length = arguments.length;
  38388. if (!length) {
  38389. return '';
  38390. }
  38391. var result = '';
  38392. while (++index < length) {
  38393. var codePoint = Number(arguments[index]);
  38394. if (
  38395. !isFinite(codePoint) || // `NaN`, `+Infinity`, or `-Infinity`
  38396. codePoint < 0 || // not a valid Unicode code point
  38397. codePoint > 0x10FFFF || // not a valid Unicode code point
  38398. floor(codePoint) != codePoint // not an integer
  38399. ) {
  38400. throw RangeError('Invalid code point: ' + codePoint);
  38401. }
  38402. if (codePoint <= 0xFFFF) { // BMP code point
  38403. codeUnits.push(codePoint);
  38404. } else { // Astral code point; split in surrogate halves
  38405. // https://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae
  38406. codePoint -= 0x10000;
  38407. highSurrogate = (codePoint >> 10) + 0xD800;
  38408. lowSurrogate = (codePoint % 0x400) + 0xDC00;
  38409. codeUnits.push(highSurrogate, lowSurrogate);
  38410. }
  38411. if (index + 1 == length || codeUnits.length > MAX_SIZE) {
  38412. result += stringFromCharCode.apply(null, codeUnits);
  38413. codeUnits.length = 0;
  38414. }
  38415. }
  38416. return result;
  38417. };
  38418. if (defineProperty) {
  38419. defineProperty(String, 'fromCodePoint', {
  38420. 'value': fromCodePoint,
  38421. 'configurable': true,
  38422. 'writable': true
  38423. });
  38424. } else {
  38425. String.fromCodePoint = fromCodePoint;
  38426. }
  38427. }());
  38428. }
  38429. /***/ }),
  38430. /***/ "./node_modules/antlr4/tree/Tree.js":
  38431. /*!******************************************!*\
  38432. !*** ./node_modules/antlr4/tree/Tree.js ***!
  38433. \******************************************/
  38434. /*! no static exports found */
  38435. /***/ (function(module, exports, __webpack_require__) {
  38436. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  38437. * Use of this file is governed by the BSD 3-clause license that
  38438. * can be found in the LICENSE.txt file in the project root.
  38439. */
  38440. ///
  38441. // The basic notion of a tree has a parent, a payload, and a list of children.
  38442. // It is the most abstract interface for all the trees used by ANTLR.
  38443. ///
  38444. var Token = __webpack_require__(/*! ./../Token */ "./node_modules/antlr4/Token.js").Token;
  38445. var Interval = __webpack_require__(/*! ./../IntervalSet */ "./node_modules/antlr4/IntervalSet.js").Interval;
  38446. var INVALID_INTERVAL = new Interval(-1, -2);
  38447. var Utils = __webpack_require__(/*! ../Utils.js */ "./node_modules/antlr4/Utils.js");
  38448. function Tree() {
  38449. return this;
  38450. }
  38451. function SyntaxTree() {
  38452. Tree.call(this);
  38453. return this;
  38454. }
  38455. SyntaxTree.prototype = Object.create(Tree.prototype);
  38456. SyntaxTree.prototype.constructor = SyntaxTree;
  38457. function ParseTree() {
  38458. SyntaxTree.call(this);
  38459. return this;
  38460. }
  38461. ParseTree.prototype = Object.create(SyntaxTree.prototype);
  38462. ParseTree.prototype.constructor = ParseTree;
  38463. function RuleNode() {
  38464. ParseTree.call(this);
  38465. return this;
  38466. }
  38467. RuleNode.prototype = Object.create(ParseTree.prototype);
  38468. RuleNode.prototype.constructor = RuleNode;
  38469. function TerminalNode() {
  38470. ParseTree.call(this);
  38471. return this;
  38472. }
  38473. TerminalNode.prototype = Object.create(ParseTree.prototype);
  38474. TerminalNode.prototype.constructor = TerminalNode;
  38475. function ErrorNode() {
  38476. TerminalNode.call(this);
  38477. return this;
  38478. }
  38479. ErrorNode.prototype = Object.create(TerminalNode.prototype);
  38480. ErrorNode.prototype.constructor = ErrorNode;
  38481. function ParseTreeVisitor() {
  38482. return this;
  38483. }
  38484. ParseTreeVisitor.prototype.visit = function(ctx) {
  38485. if (Array.isArray(ctx)) {
  38486. return ctx.map(function(child) {
  38487. return child.accept(this);
  38488. }, this);
  38489. } else {
  38490. return ctx.accept(this);
  38491. }
  38492. };
  38493. ParseTreeVisitor.prototype.visitChildren = function(ctx) {
  38494. if (ctx.children) {
  38495. return this.visit(ctx.children);
  38496. } else {
  38497. return null;
  38498. }
  38499. }
  38500. ParseTreeVisitor.prototype.visitTerminal = function(node) {
  38501. };
  38502. ParseTreeVisitor.prototype.visitErrorNode = function(node) {
  38503. };
  38504. function ParseTreeListener() {
  38505. return this;
  38506. }
  38507. ParseTreeListener.prototype.visitTerminal = function(node) {
  38508. };
  38509. ParseTreeListener.prototype.visitErrorNode = function(node) {
  38510. };
  38511. ParseTreeListener.prototype.enterEveryRule = function(node) {
  38512. };
  38513. ParseTreeListener.prototype.exitEveryRule = function(node) {
  38514. };
  38515. function TerminalNodeImpl(symbol) {
  38516. TerminalNode.call(this);
  38517. this.parentCtx = null;
  38518. this.symbol = symbol;
  38519. return this;
  38520. }
  38521. TerminalNodeImpl.prototype = Object.create(TerminalNode.prototype);
  38522. TerminalNodeImpl.prototype.constructor = TerminalNodeImpl;
  38523. TerminalNodeImpl.prototype.getChild = function(i) {
  38524. return null;
  38525. };
  38526. TerminalNodeImpl.prototype.getSymbol = function() {
  38527. return this.symbol;
  38528. };
  38529. TerminalNodeImpl.prototype.getParent = function() {
  38530. return this.parentCtx;
  38531. };
  38532. TerminalNodeImpl.prototype.getPayload = function() {
  38533. return this.symbol;
  38534. };
  38535. TerminalNodeImpl.prototype.getSourceInterval = function() {
  38536. if (this.symbol === null) {
  38537. return INVALID_INTERVAL;
  38538. }
  38539. var tokenIndex = this.symbol.tokenIndex;
  38540. return new Interval(tokenIndex, tokenIndex);
  38541. };
  38542. TerminalNodeImpl.prototype.getChildCount = function() {
  38543. return 0;
  38544. };
  38545. TerminalNodeImpl.prototype.accept = function(visitor) {
  38546. return visitor.visitTerminal(this);
  38547. };
  38548. TerminalNodeImpl.prototype.getText = function() {
  38549. return this.symbol.text;
  38550. };
  38551. TerminalNodeImpl.prototype.toString = function() {
  38552. if (this.symbol.type === Token.EOF) {
  38553. return "<EOF>";
  38554. } else {
  38555. return this.symbol.text;
  38556. }
  38557. };
  38558. // Represents a token that was consumed during resynchronization
  38559. // rather than during a valid match operation. For example,
  38560. // we will create this kind of a node during single token insertion
  38561. // and deletion as well as during "consume until error recovery set"
  38562. // upon no viable alternative exceptions.
  38563. function ErrorNodeImpl(token) {
  38564. TerminalNodeImpl.call(this, token);
  38565. return this;
  38566. }
  38567. ErrorNodeImpl.prototype = Object.create(TerminalNodeImpl.prototype);
  38568. ErrorNodeImpl.prototype.constructor = ErrorNodeImpl;
  38569. ErrorNodeImpl.prototype.isErrorNode = function() {
  38570. return true;
  38571. };
  38572. ErrorNodeImpl.prototype.accept = function(visitor) {
  38573. return visitor.visitErrorNode(this);
  38574. };
  38575. function ParseTreeWalker() {
  38576. return this;
  38577. }
  38578. ParseTreeWalker.prototype.walk = function(listener, t) {
  38579. var errorNode = t instanceof ErrorNode ||
  38580. (t.isErrorNode !== undefined && t.isErrorNode());
  38581. if (errorNode) {
  38582. listener.visitErrorNode(t);
  38583. } else if (t instanceof TerminalNode) {
  38584. listener.visitTerminal(t);
  38585. } else {
  38586. this.enterRule(listener, t);
  38587. for (var i = 0; i < t.getChildCount(); i++) {
  38588. var child = t.getChild(i);
  38589. this.walk(listener, child);
  38590. }
  38591. this.exitRule(listener, t);
  38592. }
  38593. };
  38594. //
  38595. // The discovery of a rule node, involves sending two events: the generic
  38596. // {@link ParseTreeListener//enterEveryRule} and a
  38597. // {@link RuleContext}-specific event. First we trigger the generic and then
  38598. // the rule specific. We to them in reverse order upon finishing the node.
  38599. //
  38600. ParseTreeWalker.prototype.enterRule = function(listener, r) {
  38601. var ctx = r.getRuleContext();
  38602. listener.enterEveryRule(ctx);
  38603. ctx.enterRule(listener);
  38604. };
  38605. ParseTreeWalker.prototype.exitRule = function(listener, r) {
  38606. var ctx = r.getRuleContext();
  38607. ctx.exitRule(listener);
  38608. listener.exitEveryRule(ctx);
  38609. };
  38610. ParseTreeWalker.DEFAULT = new ParseTreeWalker();
  38611. exports.RuleNode = RuleNode;
  38612. exports.ErrorNode = ErrorNode;
  38613. exports.TerminalNode = TerminalNode;
  38614. exports.ErrorNodeImpl = ErrorNodeImpl;
  38615. exports.TerminalNodeImpl = TerminalNodeImpl;
  38616. exports.ParseTreeListener = ParseTreeListener;
  38617. exports.ParseTreeVisitor = ParseTreeVisitor;
  38618. exports.ParseTreeWalker = ParseTreeWalker;
  38619. exports.INVALID_INTERVAL = INVALID_INTERVAL;
  38620. /***/ }),
  38621. /***/ "./node_modules/antlr4/tree/Trees.js":
  38622. /*!*******************************************!*\
  38623. !*** ./node_modules/antlr4/tree/Trees.js ***!
  38624. \*******************************************/
  38625. /*! no static exports found */
  38626. /***/ (function(module, exports, __webpack_require__) {
  38627. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  38628. * Use of this file is governed by the BSD 3-clause license that
  38629. * can be found in the LICENSE.txt file in the project root.
  38630. */
  38631. var Utils = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js");
  38632. var Token = __webpack_require__(/*! ./../Token */ "./node_modules/antlr4/Token.js").Token;
  38633. var RuleNode = __webpack_require__(/*! ./Tree */ "./node_modules/antlr4/tree/Tree.js").RuleNode;
  38634. var ErrorNode = __webpack_require__(/*! ./Tree */ "./node_modules/antlr4/tree/Tree.js").ErrorNode;
  38635. var TerminalNode = __webpack_require__(/*! ./Tree */ "./node_modules/antlr4/tree/Tree.js").TerminalNode;
  38636. var ParserRuleContext = __webpack_require__(/*! ./../ParserRuleContext */ "./node_modules/antlr4/ParserRuleContext.js").ParserRuleContext;
  38637. var RuleContext = __webpack_require__(/*! ./../RuleContext */ "./node_modules/antlr4/RuleContext.js").RuleContext;
  38638. var INVALID_ALT_NUMBER = __webpack_require__(/*! ./../atn/ATN */ "./node_modules/antlr4/atn/ATN.js").INVALID_ALT_NUMBER;
  38639. /** A set of utility routines useful for all kinds of ANTLR trees. */
  38640. function Trees() {
  38641. }
  38642. // Print out a whole tree in LISP form. {@link //getNodeText} is used on the
  38643. // node payloads to get the text for the nodes. Detect
  38644. // parse trees and extract data appropriately.
  38645. Trees.toStringTree = function(tree, ruleNames, recog) {
  38646. ruleNames = ruleNames || null;
  38647. recog = recog || null;
  38648. if(recog!==null) {
  38649. ruleNames = recog.ruleNames;
  38650. }
  38651. var s = Trees.getNodeText(tree, ruleNames);
  38652. s = Utils.escapeWhitespace(s, false);
  38653. var c = tree.getChildCount();
  38654. if(c===0) {
  38655. return s;
  38656. }
  38657. var res = "(" + s + ' ';
  38658. if(c>0) {
  38659. s = Trees.toStringTree(tree.getChild(0), ruleNames);
  38660. res = res.concat(s);
  38661. }
  38662. for(var i=1;i<c;i++) {
  38663. s = Trees.toStringTree(tree.getChild(i), ruleNames);
  38664. res = res.concat(' ' + s);
  38665. }
  38666. res = res.concat(")");
  38667. return res;
  38668. };
  38669. Trees.getNodeText = function(t, ruleNames, recog) {
  38670. ruleNames = ruleNames || null;
  38671. recog = recog || null;
  38672. if(recog!==null) {
  38673. ruleNames = recog.ruleNames;
  38674. }
  38675. if(ruleNames!==null) {
  38676. if (t instanceof RuleContext) {
  38677. var altNumber = t.getAltNumber();
  38678. if ( altNumber!=INVALID_ALT_NUMBER ) {
  38679. return ruleNames[t.ruleIndex]+":"+altNumber;
  38680. }
  38681. return ruleNames[t.ruleIndex];
  38682. } else if ( t instanceof ErrorNode) {
  38683. return t.toString();
  38684. } else if(t instanceof TerminalNode) {
  38685. if(t.symbol!==null) {
  38686. return t.symbol.text;
  38687. }
  38688. }
  38689. }
  38690. // no recog for rule names
  38691. var payload = t.getPayload();
  38692. if (payload instanceof Token ) {
  38693. return payload.text;
  38694. }
  38695. return t.getPayload().toString();
  38696. };
  38697. // Return ordered list of all children of this node
  38698. Trees.getChildren = function(t) {
  38699. var list = [];
  38700. for(var i=0;i<t.getChildCount();i++) {
  38701. list.push(t.getChild(i));
  38702. }
  38703. return list;
  38704. };
  38705. // Return a list of all ancestors of this node. The first node of
  38706. // list is the root and the last is the parent of this node.
  38707. //
  38708. Trees.getAncestors = function(t) {
  38709. var ancestors = [];
  38710. t = t.getParent();
  38711. while(t!==null) {
  38712. ancestors = [t].concat(ancestors);
  38713. t = t.getParent();
  38714. }
  38715. return ancestors;
  38716. };
  38717. Trees.findAllTokenNodes = function(t, ttype) {
  38718. return Trees.findAllNodes(t, ttype, true);
  38719. };
  38720. Trees.findAllRuleNodes = function(t, ruleIndex) {
  38721. return Trees.findAllNodes(t, ruleIndex, false);
  38722. };
  38723. Trees.findAllNodes = function(t, index, findTokens) {
  38724. var nodes = [];
  38725. Trees._findAllNodes(t, index, findTokens, nodes);
  38726. return nodes;
  38727. };
  38728. Trees._findAllNodes = function(t, index, findTokens, nodes) {
  38729. // check this node (the root) first
  38730. if(findTokens && (t instanceof TerminalNode)) {
  38731. if(t.symbol.type===index) {
  38732. nodes.push(t);
  38733. }
  38734. } else if(!findTokens && (t instanceof ParserRuleContext)) {
  38735. if(t.ruleIndex===index) {
  38736. nodes.push(t);
  38737. }
  38738. }
  38739. // check children
  38740. for(var i=0;i<t.getChildCount();i++) {
  38741. Trees._findAllNodes(t.getChild(i), index, findTokens, nodes);
  38742. }
  38743. };
  38744. Trees.descendants = function(t) {
  38745. var nodes = [t];
  38746. for(var i=0;i<t.getChildCount();i++) {
  38747. nodes = nodes.concat(Trees.descendants(t.getChild(i)));
  38748. }
  38749. return nodes;
  38750. };
  38751. exports.Trees = Trees;
  38752. /***/ }),
  38753. /***/ "./node_modules/antlr4/tree/index.js":
  38754. /*!*******************************************!*\
  38755. !*** ./node_modules/antlr4/tree/index.js ***!
  38756. \*******************************************/
  38757. /*! no static exports found */
  38758. /***/ (function(module, exports, __webpack_require__) {
  38759. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  38760. * Use of this file is governed by the BSD 3-clause license that
  38761. * can be found in the LICENSE.txt file in the project root.
  38762. */
  38763. var Tree = __webpack_require__(/*! ./Tree */ "./node_modules/antlr4/tree/Tree.js");
  38764. exports.Trees = __webpack_require__(/*! ./Trees */ "./node_modules/antlr4/tree/Trees.js").Trees;
  38765. exports.RuleNode = Tree.RuleNode;
  38766. exports.ParseTreeListener = Tree.ParseTreeListener;
  38767. exports.ParseTreeVisitor = Tree.ParseTreeVisitor;
  38768. exports.ParseTreeWalker = Tree.ParseTreeWalker;
  38769. /***/ }),
  38770. /***/ "./node_modules/decimal.js/decimal.js":
  38771. /*!********************************************!*\
  38772. !*** ./node_modules/decimal.js/decimal.js ***!
  38773. \********************************************/
  38774. /*! no static exports found */
  38775. /***/ (function(module, exports, __webpack_require__) {
  38776. var __WEBPACK_AMD_DEFINE_RESULT__;;(function (globalScope) {
  38777. 'use strict';
  38778. /*
  38779. * decimal.js v10.1.1
  38780. * An arbitrary-precision Decimal type for JavaScript.
  38781. * https://github.com/MikeMcl/decimal.js
  38782. * Copyright (c) 2019 Michael Mclaughlin <M8ch88l@gmail.com>
  38783. * MIT Licence
  38784. */
  38785. // ----------------------------------- EDITABLE DEFAULTS ------------------------------------ //
  38786. // The maximum exponent magnitude.
  38787. // The limit on the value of `toExpNeg`, `toExpPos`, `minE` and `maxE`.
  38788. var EXP_LIMIT = 9e15, // 0 to 9e15
  38789. // The limit on the value of `precision`, and on the value of the first argument to
  38790. // `toDecimalPlaces`, `toExponential`, `toFixed`, `toPrecision` and `toSignificantDigits`.
  38791. MAX_DIGITS = 1e9, // 0 to 1e9
  38792. // Base conversion alphabet.
  38793. NUMERALS = '0123456789abcdef',
  38794. // The natural logarithm of 10 (1025 digits).
  38795. LN10 = '2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058',
  38796. // Pi (1025 digits).
  38797. PI = '3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789',
  38798. // The initial configuration properties of the Decimal constructor.
  38799. DEFAULTS = {
  38800. // These values must be integers within the stated ranges (inclusive).
  38801. // Most of these values can be changed at run-time using the `Decimal.config` method.
  38802. // The maximum number of significant digits of the result of a calculation or base conversion.
  38803. // E.g. `Decimal.config({ precision: 20 });`
  38804. precision: 20, // 1 to MAX_DIGITS
  38805. // The rounding mode used when rounding to `precision`.
  38806. //
  38807. // ROUND_UP 0 Away from zero.
  38808. // ROUND_DOWN 1 Towards zero.
  38809. // ROUND_CEIL 2 Towards +Infinity.
  38810. // ROUND_FLOOR 3 Towards -Infinity.
  38811. // ROUND_HALF_UP 4 Towards nearest neighbour. If equidistant, up.
  38812. // ROUND_HALF_DOWN 5 Towards nearest neighbour. If equidistant, down.
  38813. // ROUND_HALF_EVEN 6 Towards nearest neighbour. If equidistant, towards even neighbour.
  38814. // ROUND_HALF_CEIL 7 Towards nearest neighbour. If equidistant, towards +Infinity.
  38815. // ROUND_HALF_FLOOR 8 Towards nearest neighbour. If equidistant, towards -Infinity.
  38816. //
  38817. // E.g.
  38818. // `Decimal.rounding = 4;`
  38819. // `Decimal.rounding = Decimal.ROUND_HALF_UP;`
  38820. rounding: 4, // 0 to 8
  38821. // The modulo mode used when calculating the modulus: a mod n.
  38822. // The quotient (q = a / n) is calculated according to the corresponding rounding mode.
  38823. // The remainder (r) is calculated as: r = a - n * q.
  38824. //
  38825. // UP 0 The remainder is positive if the dividend is negative, else is negative.
  38826. // DOWN 1 The remainder has the same sign as the dividend (JavaScript %).
  38827. // FLOOR 3 The remainder has the same sign as the divisor (Python %).
  38828. // HALF_EVEN 6 The IEEE 754 remainder function.
  38829. // EUCLID 9 Euclidian division. q = sign(n) * floor(a / abs(n)). Always positive.
  38830. //
  38831. // Truncated division (1), floored division (3), the IEEE 754 remainder (6), and Euclidian
  38832. // division (9) are commonly used for the modulus operation. The other rounding modes can also
  38833. // be used, but they may not give useful results.
  38834. modulo: 1, // 0 to 9
  38835. // The exponent value at and beneath which `toString` returns exponential notation.
  38836. // JavaScript numbers: -7
  38837. toExpNeg: -7, // 0 to -EXP_LIMIT
  38838. // The exponent value at and above which `toString` returns exponential notation.
  38839. // JavaScript numbers: 21
  38840. toExpPos: 21, // 0 to EXP_LIMIT
  38841. // The minimum exponent value, beneath which underflow to zero occurs.
  38842. // JavaScript numbers: -324 (5e-324)
  38843. minE: -EXP_LIMIT, // -1 to -EXP_LIMIT
  38844. // The maximum exponent value, above which overflow to Infinity occurs.
  38845. // JavaScript numbers: 308 (1.7976931348623157e+308)
  38846. maxE: EXP_LIMIT, // 1 to EXP_LIMIT
  38847. // Whether to use cryptographically-secure random number generation, if available.
  38848. crypto: false // true/false
  38849. },
  38850. // ----------------------------------- END OF EDITABLE DEFAULTS ------------------------------- //
  38851. Decimal, inexact, noConflict, quadrant,
  38852. external = true,
  38853. decimalError = '[DecimalError] ',
  38854. invalidArgument = decimalError + 'Invalid argument: ',
  38855. precisionLimitExceeded = decimalError + 'Precision limit exceeded',
  38856. cryptoUnavailable = decimalError + 'crypto unavailable',
  38857. mathfloor = Math.floor,
  38858. mathpow = Math.pow,
  38859. isBinary = /^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i,
  38860. isHex = /^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i,
  38861. isOctal = /^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i,
  38862. isDecimal = /^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,
  38863. BASE = 1e7,
  38864. LOG_BASE = 7,
  38865. MAX_SAFE_INTEGER = 9007199254740991,
  38866. LN10_PRECISION = LN10.length - 1,
  38867. PI_PRECISION = PI.length - 1,
  38868. // Decimal.prototype object
  38869. P = { name: '[object Decimal]' };
  38870. // Decimal prototype methods
  38871. /*
  38872. * absoluteValue abs
  38873. * ceil
  38874. * comparedTo cmp
  38875. * cosine cos
  38876. * cubeRoot cbrt
  38877. * decimalPlaces dp
  38878. * dividedBy div
  38879. * dividedToIntegerBy divToInt
  38880. * equals eq
  38881. * floor
  38882. * greaterThan gt
  38883. * greaterThanOrEqualTo gte
  38884. * hyperbolicCosine cosh
  38885. * hyperbolicSine sinh
  38886. * hyperbolicTangent tanh
  38887. * inverseCosine acos
  38888. * inverseHyperbolicCosine acosh
  38889. * inverseHyperbolicSine asinh
  38890. * inverseHyperbolicTangent atanh
  38891. * inverseSine asin
  38892. * inverseTangent atan
  38893. * isFinite
  38894. * isInteger isInt
  38895. * isNaN
  38896. * isNegative isNeg
  38897. * isPositive isPos
  38898. * isZero
  38899. * lessThan lt
  38900. * lessThanOrEqualTo lte
  38901. * logarithm log
  38902. * [maximum] [max]
  38903. * [minimum] [min]
  38904. * minus sub
  38905. * modulo mod
  38906. * naturalExponential exp
  38907. * naturalLogarithm ln
  38908. * negated neg
  38909. * plus add
  38910. * precision sd
  38911. * round
  38912. * sine sin
  38913. * squareRoot sqrt
  38914. * tangent tan
  38915. * times mul
  38916. * toBinary
  38917. * toDecimalPlaces toDP
  38918. * toExponential
  38919. * toFixed
  38920. * toFraction
  38921. * toHexadecimal toHex
  38922. * toNearest
  38923. * toNumber
  38924. * toOctal
  38925. * toPower pow
  38926. * toPrecision
  38927. * toSignificantDigits toSD
  38928. * toString
  38929. * truncated trunc
  38930. * valueOf toJSON
  38931. */
  38932. /*
  38933. * Return a new Decimal whose value is the absolute value of this Decimal.
  38934. *
  38935. */
  38936. P.absoluteValue = P.abs = function () {
  38937. var x = new this.constructor(this);
  38938. if (x.s < 0) x.s = 1;
  38939. return finalise(x);
  38940. };
  38941. /*
  38942. * Return a new Decimal whose value is the value of this Decimal rounded to a whole number in the
  38943. * direction of positive Infinity.
  38944. *
  38945. */
  38946. P.ceil = function () {
  38947. return finalise(new this.constructor(this), this.e + 1, 2);
  38948. };
  38949. /*
  38950. * Return
  38951. * 1 if the value of this Decimal is greater than the value of `y`,
  38952. * -1 if the value of this Decimal is less than the value of `y`,
  38953. * 0 if they have the same value,
  38954. * NaN if the value of either Decimal is NaN.
  38955. *
  38956. */
  38957. P.comparedTo = P.cmp = function (y) {
  38958. var i, j, xdL, ydL,
  38959. x = this,
  38960. xd = x.d,
  38961. yd = (y = new x.constructor(y)).d,
  38962. xs = x.s,
  38963. ys = y.s;
  38964. // Either NaN or ±Infinity?
  38965. if (!xd || !yd) {
  38966. return !xs || !ys ? NaN : xs !== ys ? xs : xd === yd ? 0 : !xd ^ xs < 0 ? 1 : -1;
  38967. }
  38968. // Either zero?
  38969. if (!xd[0] || !yd[0]) return xd[0] ? xs : yd[0] ? -ys : 0;
  38970. // Signs differ?
  38971. if (xs !== ys) return xs;
  38972. // Compare exponents.
  38973. if (x.e !== y.e) return x.e > y.e ^ xs < 0 ? 1 : -1;
  38974. xdL = xd.length;
  38975. ydL = yd.length;
  38976. // Compare digit by digit.
  38977. for (i = 0, j = xdL < ydL ? xdL : ydL; i < j; ++i) {
  38978. if (xd[i] !== yd[i]) return xd[i] > yd[i] ^ xs < 0 ? 1 : -1;
  38979. }
  38980. // Compare lengths.
  38981. return xdL === ydL ? 0 : xdL > ydL ^ xs < 0 ? 1 : -1;
  38982. };
  38983. /*
  38984. * Return a new Decimal whose value is the cosine of the value in radians of this Decimal.
  38985. *
  38986. * Domain: [-Infinity, Infinity]
  38987. * Range: [-1, 1]
  38988. *
  38989. * cos(0) = 1
  38990. * cos(-0) = 1
  38991. * cos(Infinity) = NaN
  38992. * cos(-Infinity) = NaN
  38993. * cos(NaN) = NaN
  38994. *
  38995. */
  38996. P.cosine = P.cos = function () {
  38997. var pr, rm,
  38998. x = this,
  38999. Ctor = x.constructor;
  39000. if (!x.d) return new Ctor(NaN);
  39001. // cos(0) = cos(-0) = 1
  39002. if (!x.d[0]) return new Ctor(1);
  39003. pr = Ctor.precision;
  39004. rm = Ctor.rounding;
  39005. Ctor.precision = pr + Math.max(x.e, x.sd()) + LOG_BASE;
  39006. Ctor.rounding = 1;
  39007. x = cosine(Ctor, toLessThanHalfPi(Ctor, x));
  39008. Ctor.precision = pr;
  39009. Ctor.rounding = rm;
  39010. return finalise(quadrant == 2 || quadrant == 3 ? x.neg() : x, pr, rm, true);
  39011. };
  39012. /*
  39013. *
  39014. * Return a new Decimal whose value is the cube root of the value of this Decimal, rounded to
  39015. * `precision` significant digits using rounding mode `rounding`.
  39016. *
  39017. * cbrt(0) = 0
  39018. * cbrt(-0) = -0
  39019. * cbrt(1) = 1
  39020. * cbrt(-1) = -1
  39021. * cbrt(N) = N
  39022. * cbrt(-I) = -I
  39023. * cbrt(I) = I
  39024. *
  39025. * Math.cbrt(x) = (x < 0 ? -Math.pow(-x, 1/3) : Math.pow(x, 1/3))
  39026. *
  39027. */
  39028. P.cubeRoot = P.cbrt = function () {
  39029. var e, m, n, r, rep, s, sd, t, t3, t3plusx,
  39030. x = this,
  39031. Ctor = x.constructor;
  39032. if (!x.isFinite() || x.isZero()) return new Ctor(x);
  39033. external = false;
  39034. // Initial estimate.
  39035. s = x.s * Math.pow(x.s * x, 1 / 3);
  39036. // Math.cbrt underflow/overflow?
  39037. // Pass x to Math.pow as integer, then adjust the exponent of the result.
  39038. if (!s || Math.abs(s) == 1 / 0) {
  39039. n = digitsToString(x.d);
  39040. e = x.e;
  39041. // Adjust n exponent so it is a multiple of 3 away from x exponent.
  39042. if (s = (e - n.length + 1) % 3) n += (s == 1 || s == -2 ? '0' : '00');
  39043. s = Math.pow(n, 1 / 3);
  39044. // Rarely, e may be one less than the result exponent value.
  39045. e = mathfloor((e + 1) / 3) - (e % 3 == (e < 0 ? -1 : 2));
  39046. if (s == 1 / 0) {
  39047. n = '5e' + e;
  39048. } else {
  39049. n = s.toExponential();
  39050. n = n.slice(0, n.indexOf('e') + 1) + e;
  39051. }
  39052. r = new Ctor(n);
  39053. r.s = x.s;
  39054. } else {
  39055. r = new Ctor(s.toString());
  39056. }
  39057. sd = (e = Ctor.precision) + 3;
  39058. // Halley's method.
  39059. // TODO? Compare Newton's method.
  39060. for (;;) {
  39061. t = r;
  39062. t3 = t.times(t).times(t);
  39063. t3plusx = t3.plus(x);
  39064. r = divide(t3plusx.plus(x).times(t), t3plusx.plus(t3), sd + 2, 1);
  39065. // TODO? Replace with for-loop and checkRoundingDigits.
  39066. if (digitsToString(t.d).slice(0, sd) === (n = digitsToString(r.d)).slice(0, sd)) {
  39067. n = n.slice(sd - 3, sd + 1);
  39068. // The 4th rounding digit may be in error by -1 so if the 4 rounding digits are 9999 or 4999
  39069. // , i.e. approaching a rounding boundary, continue the iteration.
  39070. if (n == '9999' || !rep && n == '4999') {
  39071. // On the first iteration only, check to see if rounding up gives the exact result as the
  39072. // nines may infinitely repeat.
  39073. if (!rep) {
  39074. finalise(t, e + 1, 0);
  39075. if (t.times(t).times(t).eq(x)) {
  39076. r = t;
  39077. break;
  39078. }
  39079. }
  39080. sd += 4;
  39081. rep = 1;
  39082. } else {
  39083. // If the rounding digits are null, 0{0,4} or 50{0,3}, check for an exact result.
  39084. // If not, then there are further digits and m will be truthy.
  39085. if (!+n || !+n.slice(1) && n.charAt(0) == '5') {
  39086. // Truncate to the first rounding digit.
  39087. finalise(r, e + 1, 1);
  39088. m = !r.times(r).times(r).eq(x);
  39089. }
  39090. break;
  39091. }
  39092. }
  39093. }
  39094. external = true;
  39095. return finalise(r, e, Ctor.rounding, m);
  39096. };
  39097. /*
  39098. * Return the number of decimal places of the value of this Decimal.
  39099. *
  39100. */
  39101. P.decimalPlaces = P.dp = function () {
  39102. var w,
  39103. d = this.d,
  39104. n = NaN;
  39105. if (d) {
  39106. w = d.length - 1;
  39107. n = (w - mathfloor(this.e / LOG_BASE)) * LOG_BASE;
  39108. // Subtract the number of trailing zeros of the last word.
  39109. w = d[w];
  39110. if (w) for (; w % 10 == 0; w /= 10) n--;
  39111. if (n < 0) n = 0;
  39112. }
  39113. return n;
  39114. };
  39115. /*
  39116. * n / 0 = I
  39117. * n / N = N
  39118. * n / I = 0
  39119. * 0 / n = 0
  39120. * 0 / 0 = N
  39121. * 0 / N = N
  39122. * 0 / I = 0
  39123. * N / n = N
  39124. * N / 0 = N
  39125. * N / N = N
  39126. * N / I = N
  39127. * I / n = I
  39128. * I / 0 = I
  39129. * I / N = N
  39130. * I / I = N
  39131. *
  39132. * Return a new Decimal whose value is the value of this Decimal divided by `y`, rounded to
  39133. * `precision` significant digits using rounding mode `rounding`.
  39134. *
  39135. */
  39136. P.dividedBy = P.div = function (y) {
  39137. return divide(this, new this.constructor(y));
  39138. };
  39139. /*
  39140. * Return a new Decimal whose value is the integer part of dividing the value of this Decimal
  39141. * by the value of `y`, rounded to `precision` significant digits using rounding mode `rounding`.
  39142. *
  39143. */
  39144. P.dividedToIntegerBy = P.divToInt = function (y) {
  39145. var x = this,
  39146. Ctor = x.constructor;
  39147. return finalise(divide(x, new Ctor(y), 0, 1, 1), Ctor.precision, Ctor.rounding);
  39148. };
  39149. /*
  39150. * Return true if the value of this Decimal is equal to the value of `y`, otherwise return false.
  39151. *
  39152. */
  39153. P.equals = P.eq = function (y) {
  39154. return this.cmp(y) === 0;
  39155. };
  39156. /*
  39157. * Return a new Decimal whose value is the value of this Decimal rounded to a whole number in the
  39158. * direction of negative Infinity.
  39159. *
  39160. */
  39161. P.floor = function () {
  39162. return finalise(new this.constructor(this), this.e + 1, 3);
  39163. };
  39164. /*
  39165. * Return true if the value of this Decimal is greater than the value of `y`, otherwise return
  39166. * false.
  39167. *
  39168. */
  39169. P.greaterThan = P.gt = function (y) {
  39170. return this.cmp(y) > 0;
  39171. };
  39172. /*
  39173. * Return true if the value of this Decimal is greater than or equal to the value of `y`,
  39174. * otherwise return false.
  39175. *
  39176. */
  39177. P.greaterThanOrEqualTo = P.gte = function (y) {
  39178. var k = this.cmp(y);
  39179. return k == 1 || k === 0;
  39180. };
  39181. /*
  39182. * Return a new Decimal whose value is the hyperbolic cosine of the value in radians of this
  39183. * Decimal.
  39184. *
  39185. * Domain: [-Infinity, Infinity]
  39186. * Range: [1, Infinity]
  39187. *
  39188. * cosh(x) = 1 + x^2/2! + x^4/4! + x^6/6! + ...
  39189. *
  39190. * cosh(0) = 1
  39191. * cosh(-0) = 1
  39192. * cosh(Infinity) = Infinity
  39193. * cosh(-Infinity) = Infinity
  39194. * cosh(NaN) = NaN
  39195. *
  39196. * x time taken (ms) result
  39197. * 1000 9 9.8503555700852349694e+433
  39198. * 10000 25 4.4034091128314607936e+4342
  39199. * 100000 171 1.4033316802130615897e+43429
  39200. * 1000000 3817 1.5166076984010437725e+434294
  39201. * 10000000 abandoned after 2 minute wait
  39202. *
  39203. * TODO? Compare performance of cosh(x) = 0.5 * (exp(x) + exp(-x))
  39204. *
  39205. */
  39206. P.hyperbolicCosine = P.cosh = function () {
  39207. var k, n, pr, rm, len,
  39208. x = this,
  39209. Ctor = x.constructor,
  39210. one = new Ctor(1);
  39211. if (!x.isFinite()) return new Ctor(x.s ? 1 / 0 : NaN);
  39212. if (x.isZero()) return one;
  39213. pr = Ctor.precision;
  39214. rm = Ctor.rounding;
  39215. Ctor.precision = pr + Math.max(x.e, x.sd()) + 4;
  39216. Ctor.rounding = 1;
  39217. len = x.d.length;
  39218. // Argument reduction: cos(4x) = 1 - 8cos^2(x) + 8cos^4(x) + 1
  39219. // i.e. cos(x) = 1 - cos^2(x/4)(8 - 8cos^2(x/4))
  39220. // Estimate the optimum number of times to use the argument reduction.
  39221. // TODO? Estimation reused from cosine() and may not be optimal here.
  39222. if (len < 32) {
  39223. k = Math.ceil(len / 3);
  39224. n = Math.pow(4, -k).toString();
  39225. } else {
  39226. k = 16;
  39227. n = '2.3283064365386962890625e-10';
  39228. }
  39229. x = taylorSeries(Ctor, 1, x.times(n), new Ctor(1), true);
  39230. // Reverse argument reduction
  39231. var cosh2_x,
  39232. i = k,
  39233. d8 = new Ctor(8);
  39234. for (; i--;) {
  39235. cosh2_x = x.times(x);
  39236. x = one.minus(cosh2_x.times(d8.minus(cosh2_x.times(d8))));
  39237. }
  39238. return finalise(x, Ctor.precision = pr, Ctor.rounding = rm, true);
  39239. };
  39240. /*
  39241. * Return a new Decimal whose value is the hyperbolic sine of the value in radians of this
  39242. * Decimal.
  39243. *
  39244. * Domain: [-Infinity, Infinity]
  39245. * Range: [-Infinity, Infinity]
  39246. *
  39247. * sinh(x) = x + x^3/3! + x^5/5! + x^7/7! + ...
  39248. *
  39249. * sinh(0) = 0
  39250. * sinh(-0) = -0
  39251. * sinh(Infinity) = Infinity
  39252. * sinh(-Infinity) = -Infinity
  39253. * sinh(NaN) = NaN
  39254. *
  39255. * x time taken (ms)
  39256. * 10 2 ms
  39257. * 100 5 ms
  39258. * 1000 14 ms
  39259. * 10000 82 ms
  39260. * 100000 886 ms 1.4033316802130615897e+43429
  39261. * 200000 2613 ms
  39262. * 300000 5407 ms
  39263. * 400000 8824 ms
  39264. * 500000 13026 ms 8.7080643612718084129e+217146
  39265. * 1000000 48543 ms
  39266. *
  39267. * TODO? Compare performance of sinh(x) = 0.5 * (exp(x) - exp(-x))
  39268. *
  39269. */
  39270. P.hyperbolicSine = P.sinh = function () {
  39271. var k, pr, rm, len,
  39272. x = this,
  39273. Ctor = x.constructor;
  39274. if (!x.isFinite() || x.isZero()) return new Ctor(x);
  39275. pr = Ctor.precision;
  39276. rm = Ctor.rounding;
  39277. Ctor.precision = pr + Math.max(x.e, x.sd()) + 4;
  39278. Ctor.rounding = 1;
  39279. len = x.d.length;
  39280. if (len < 3) {
  39281. x = taylorSeries(Ctor, 2, x, x, true);
  39282. } else {
  39283. // Alternative argument reduction: sinh(3x) = sinh(x)(3 + 4sinh^2(x))
  39284. // i.e. sinh(x) = sinh(x/3)(3 + 4sinh^2(x/3))
  39285. // 3 multiplications and 1 addition
  39286. // Argument reduction: sinh(5x) = sinh(x)(5 + sinh^2(x)(20 + 16sinh^2(x)))
  39287. // i.e. sinh(x) = sinh(x/5)(5 + sinh^2(x/5)(20 + 16sinh^2(x/5)))
  39288. // 4 multiplications and 2 additions
  39289. // Estimate the optimum number of times to use the argument reduction.
  39290. k = 1.4 * Math.sqrt(len);
  39291. k = k > 16 ? 16 : k | 0;
  39292. x = x.times(Math.pow(5, -k));
  39293. x = taylorSeries(Ctor, 2, x, x, true);
  39294. // Reverse argument reduction
  39295. var sinh2_x,
  39296. d5 = new Ctor(5),
  39297. d16 = new Ctor(16),
  39298. d20 = new Ctor(20);
  39299. for (; k--;) {
  39300. sinh2_x = x.times(x);
  39301. x = x.times(d5.plus(sinh2_x.times(d16.times(sinh2_x).plus(d20))));
  39302. }
  39303. }
  39304. Ctor.precision = pr;
  39305. Ctor.rounding = rm;
  39306. return finalise(x, pr, rm, true);
  39307. };
  39308. /*
  39309. * Return a new Decimal whose value is the hyperbolic tangent of the value in radians of this
  39310. * Decimal.
  39311. *
  39312. * Domain: [-Infinity, Infinity]
  39313. * Range: [-1, 1]
  39314. *
  39315. * tanh(x) = sinh(x) / cosh(x)
  39316. *
  39317. * tanh(0) = 0
  39318. * tanh(-0) = -0
  39319. * tanh(Infinity) = 1
  39320. * tanh(-Infinity) = -1
  39321. * tanh(NaN) = NaN
  39322. *
  39323. */
  39324. P.hyperbolicTangent = P.tanh = function () {
  39325. var pr, rm,
  39326. x = this,
  39327. Ctor = x.constructor;
  39328. if (!x.isFinite()) return new Ctor(x.s);
  39329. if (x.isZero()) return new Ctor(x);
  39330. pr = Ctor.precision;
  39331. rm = Ctor.rounding;
  39332. Ctor.precision = pr + 7;
  39333. Ctor.rounding = 1;
  39334. return divide(x.sinh(), x.cosh(), Ctor.precision = pr, Ctor.rounding = rm);
  39335. };
  39336. /*
  39337. * Return a new Decimal whose value is the arccosine (inverse cosine) in radians of the value of
  39338. * this Decimal.
  39339. *
  39340. * Domain: [-1, 1]
  39341. * Range: [0, pi]
  39342. *
  39343. * acos(x) = pi/2 - asin(x)
  39344. *
  39345. * acos(0) = pi/2
  39346. * acos(-0) = pi/2
  39347. * acos(1) = 0
  39348. * acos(-1) = pi
  39349. * acos(1/2) = pi/3
  39350. * acos(-1/2) = 2*pi/3
  39351. * acos(|x| > 1) = NaN
  39352. * acos(NaN) = NaN
  39353. *
  39354. */
  39355. P.inverseCosine = P.acos = function () {
  39356. var halfPi,
  39357. x = this,
  39358. Ctor = x.constructor,
  39359. k = x.abs().cmp(1),
  39360. pr = Ctor.precision,
  39361. rm = Ctor.rounding;
  39362. if (k !== -1) {
  39363. return k === 0
  39364. // |x| is 1
  39365. ? x.isNeg() ? getPi(Ctor, pr, rm) : new Ctor(0)
  39366. // |x| > 1 or x is NaN
  39367. : new Ctor(NaN);
  39368. }
  39369. if (x.isZero()) return getPi(Ctor, pr + 4, rm).times(0.5);
  39370. // TODO? Special case acos(0.5) = pi/3 and acos(-0.5) = 2*pi/3
  39371. Ctor.precision = pr + 6;
  39372. Ctor.rounding = 1;
  39373. x = x.asin();
  39374. halfPi = getPi(Ctor, pr + 4, rm).times(0.5);
  39375. Ctor.precision = pr;
  39376. Ctor.rounding = rm;
  39377. return halfPi.minus(x);
  39378. };
  39379. /*
  39380. * Return a new Decimal whose value is the inverse of the hyperbolic cosine in radians of the
  39381. * value of this Decimal.
  39382. *
  39383. * Domain: [1, Infinity]
  39384. * Range: [0, Infinity]
  39385. *
  39386. * acosh(x) = ln(x + sqrt(x^2 - 1))
  39387. *
  39388. * acosh(x < 1) = NaN
  39389. * acosh(NaN) = NaN
  39390. * acosh(Infinity) = Infinity
  39391. * acosh(-Infinity) = NaN
  39392. * acosh(0) = NaN
  39393. * acosh(-0) = NaN
  39394. * acosh(1) = 0
  39395. * acosh(-1) = NaN
  39396. *
  39397. */
  39398. P.inverseHyperbolicCosine = P.acosh = function () {
  39399. var pr, rm,
  39400. x = this,
  39401. Ctor = x.constructor;
  39402. if (x.lte(1)) return new Ctor(x.eq(1) ? 0 : NaN);
  39403. if (!x.isFinite()) return new Ctor(x);
  39404. pr = Ctor.precision;
  39405. rm = Ctor.rounding;
  39406. Ctor.precision = pr + Math.max(Math.abs(x.e), x.sd()) + 4;
  39407. Ctor.rounding = 1;
  39408. external = false;
  39409. x = x.times(x).minus(1).sqrt().plus(x);
  39410. external = true;
  39411. Ctor.precision = pr;
  39412. Ctor.rounding = rm;
  39413. return x.ln();
  39414. };
  39415. /*
  39416. * Return a new Decimal whose value is the inverse of the hyperbolic sine in radians of the value
  39417. * of this Decimal.
  39418. *
  39419. * Domain: [-Infinity, Infinity]
  39420. * Range: [-Infinity, Infinity]
  39421. *
  39422. * asinh(x) = ln(x + sqrt(x^2 + 1))
  39423. *
  39424. * asinh(NaN) = NaN
  39425. * asinh(Infinity) = Infinity
  39426. * asinh(-Infinity) = -Infinity
  39427. * asinh(0) = 0
  39428. * asinh(-0) = -0
  39429. *
  39430. */
  39431. P.inverseHyperbolicSine = P.asinh = function () {
  39432. var pr, rm,
  39433. x = this,
  39434. Ctor = x.constructor;
  39435. if (!x.isFinite() || x.isZero()) return new Ctor(x);
  39436. pr = Ctor.precision;
  39437. rm = Ctor.rounding;
  39438. Ctor.precision = pr + 2 * Math.max(Math.abs(x.e), x.sd()) + 6;
  39439. Ctor.rounding = 1;
  39440. external = false;
  39441. x = x.times(x).plus(1).sqrt().plus(x);
  39442. external = true;
  39443. Ctor.precision = pr;
  39444. Ctor.rounding = rm;
  39445. return x.ln();
  39446. };
  39447. /*
  39448. * Return a new Decimal whose value is the inverse of the hyperbolic tangent in radians of the
  39449. * value of this Decimal.
  39450. *
  39451. * Domain: [-1, 1]
  39452. * Range: [-Infinity, Infinity]
  39453. *
  39454. * atanh(x) = 0.5 * ln((1 + x) / (1 - x))
  39455. *
  39456. * atanh(|x| > 1) = NaN
  39457. * atanh(NaN) = NaN
  39458. * atanh(Infinity) = NaN
  39459. * atanh(-Infinity) = NaN
  39460. * atanh(0) = 0
  39461. * atanh(-0) = -0
  39462. * atanh(1) = Infinity
  39463. * atanh(-1) = -Infinity
  39464. *
  39465. */
  39466. P.inverseHyperbolicTangent = P.atanh = function () {
  39467. var pr, rm, wpr, xsd,
  39468. x = this,
  39469. Ctor = x.constructor;
  39470. if (!x.isFinite()) return new Ctor(NaN);
  39471. if (x.e >= 0) return new Ctor(x.abs().eq(1) ? x.s / 0 : x.isZero() ? x : NaN);
  39472. pr = Ctor.precision;
  39473. rm = Ctor.rounding;
  39474. xsd = x.sd();
  39475. if (Math.max(xsd, pr) < 2 * -x.e - 1) return finalise(new Ctor(x), pr, rm, true);
  39476. Ctor.precision = wpr = xsd - x.e;
  39477. x = divide(x.plus(1), new Ctor(1).minus(x), wpr + pr, 1);
  39478. Ctor.precision = pr + 4;
  39479. Ctor.rounding = 1;
  39480. x = x.ln();
  39481. Ctor.precision = pr;
  39482. Ctor.rounding = rm;
  39483. return x.times(0.5);
  39484. };
  39485. /*
  39486. * Return a new Decimal whose value is the arcsine (inverse sine) in radians of the value of this
  39487. * Decimal.
  39488. *
  39489. * Domain: [-Infinity, Infinity]
  39490. * Range: [-pi/2, pi/2]
  39491. *
  39492. * asin(x) = 2*atan(x/(1 + sqrt(1 - x^2)))
  39493. *
  39494. * asin(0) = 0
  39495. * asin(-0) = -0
  39496. * asin(1/2) = pi/6
  39497. * asin(-1/2) = -pi/6
  39498. * asin(1) = pi/2
  39499. * asin(-1) = -pi/2
  39500. * asin(|x| > 1) = NaN
  39501. * asin(NaN) = NaN
  39502. *
  39503. * TODO? Compare performance of Taylor series.
  39504. *
  39505. */
  39506. P.inverseSine = P.asin = function () {
  39507. var halfPi, k,
  39508. pr, rm,
  39509. x = this,
  39510. Ctor = x.constructor;
  39511. if (x.isZero()) return new Ctor(x);
  39512. k = x.abs().cmp(1);
  39513. pr = Ctor.precision;
  39514. rm = Ctor.rounding;
  39515. if (k !== -1) {
  39516. // |x| is 1
  39517. if (k === 0) {
  39518. halfPi = getPi(Ctor, pr + 4, rm).times(0.5);
  39519. halfPi.s = x.s;
  39520. return halfPi;
  39521. }
  39522. // |x| > 1 or x is NaN
  39523. return new Ctor(NaN);
  39524. }
  39525. // TODO? Special case asin(1/2) = pi/6 and asin(-1/2) = -pi/6
  39526. Ctor.precision = pr + 6;
  39527. Ctor.rounding = 1;
  39528. x = x.div(new Ctor(1).minus(x.times(x)).sqrt().plus(1)).atan();
  39529. Ctor.precision = pr;
  39530. Ctor.rounding = rm;
  39531. return x.times(2);
  39532. };
  39533. /*
  39534. * Return a new Decimal whose value is the arctangent (inverse tangent) in radians of the value
  39535. * of this Decimal.
  39536. *
  39537. * Domain: [-Infinity, Infinity]
  39538. * Range: [-pi/2, pi/2]
  39539. *
  39540. * atan(x) = x - x^3/3 + x^5/5 - x^7/7 + ...
  39541. *
  39542. * atan(0) = 0
  39543. * atan(-0) = -0
  39544. * atan(1) = pi/4
  39545. * atan(-1) = -pi/4
  39546. * atan(Infinity) = pi/2
  39547. * atan(-Infinity) = -pi/2
  39548. * atan(NaN) = NaN
  39549. *
  39550. */
  39551. P.inverseTangent = P.atan = function () {
  39552. var i, j, k, n, px, t, r, wpr, x2,
  39553. x = this,
  39554. Ctor = x.constructor,
  39555. pr = Ctor.precision,
  39556. rm = Ctor.rounding;
  39557. if (!x.isFinite()) {
  39558. if (!x.s) return new Ctor(NaN);
  39559. if (pr + 4 <= PI_PRECISION) {
  39560. r = getPi(Ctor, pr + 4, rm).times(0.5);
  39561. r.s = x.s;
  39562. return r;
  39563. }
  39564. } else if (x.isZero()) {
  39565. return new Ctor(x);
  39566. } else if (x.abs().eq(1) && pr + 4 <= PI_PRECISION) {
  39567. r = getPi(Ctor, pr + 4, rm).times(0.25);
  39568. r.s = x.s;
  39569. return r;
  39570. }
  39571. Ctor.precision = wpr = pr + 10;
  39572. Ctor.rounding = 1;
  39573. // TODO? if (x >= 1 && pr <= PI_PRECISION) atan(x) = halfPi * x.s - atan(1 / x);
  39574. // Argument reduction
  39575. // Ensure |x| < 0.42
  39576. // atan(x) = 2 * atan(x / (1 + sqrt(1 + x^2)))
  39577. k = Math.min(28, wpr / LOG_BASE + 2 | 0);
  39578. for (i = k; i; --i) x = x.div(x.times(x).plus(1).sqrt().plus(1));
  39579. external = false;
  39580. j = Math.ceil(wpr / LOG_BASE);
  39581. n = 1;
  39582. x2 = x.times(x);
  39583. r = new Ctor(x);
  39584. px = x;
  39585. // atan(x) = x - x^3/3 + x^5/5 - x^7/7 + ...
  39586. for (; i !== -1;) {
  39587. px = px.times(x2);
  39588. t = r.minus(px.div(n += 2));
  39589. px = px.times(x2);
  39590. r = t.plus(px.div(n += 2));
  39591. if (r.d[j] !== void 0) for (i = j; r.d[i] === t.d[i] && i--;);
  39592. }
  39593. if (k) r = r.times(2 << (k - 1));
  39594. external = true;
  39595. return finalise(r, Ctor.precision = pr, Ctor.rounding = rm, true);
  39596. };
  39597. /*
  39598. * Return true if the value of this Decimal is a finite number, otherwise return false.
  39599. *
  39600. */
  39601. P.isFinite = function () {
  39602. return !!this.d;
  39603. };
  39604. /*
  39605. * Return true if the value of this Decimal is an integer, otherwise return false.
  39606. *
  39607. */
  39608. P.isInteger = P.isInt = function () {
  39609. return !!this.d && mathfloor(this.e / LOG_BASE) > this.d.length - 2;
  39610. };
  39611. /*
  39612. * Return true if the value of this Decimal is NaN, otherwise return false.
  39613. *
  39614. */
  39615. P.isNaN = function () {
  39616. return !this.s;
  39617. };
  39618. /*
  39619. * Return true if the value of this Decimal is negative, otherwise return false.
  39620. *
  39621. */
  39622. P.isNegative = P.isNeg = function () {
  39623. return this.s < 0;
  39624. };
  39625. /*
  39626. * Return true if the value of this Decimal is positive, otherwise return false.
  39627. *
  39628. */
  39629. P.isPositive = P.isPos = function () {
  39630. return this.s > 0;
  39631. };
  39632. /*
  39633. * Return true if the value of this Decimal is 0 or -0, otherwise return false.
  39634. *
  39635. */
  39636. P.isZero = function () {
  39637. return !!this.d && this.d[0] === 0;
  39638. };
  39639. /*
  39640. * Return true if the value of this Decimal is less than `y`, otherwise return false.
  39641. *
  39642. */
  39643. P.lessThan = P.lt = function (y) {
  39644. return this.cmp(y) < 0;
  39645. };
  39646. /*
  39647. * Return true if the value of this Decimal is less than or equal to `y`, otherwise return false.
  39648. *
  39649. */
  39650. P.lessThanOrEqualTo = P.lte = function (y) {
  39651. return this.cmp(y) < 1;
  39652. };
  39653. /*
  39654. * Return the logarithm of the value of this Decimal to the specified base, rounded to `precision`
  39655. * significant digits using rounding mode `rounding`.
  39656. *
  39657. * If no base is specified, return log[10](arg).
  39658. *
  39659. * log[base](arg) = ln(arg) / ln(base)
  39660. *
  39661. * The result will always be correctly rounded if the base of the log is 10, and 'almost always'
  39662. * otherwise:
  39663. *
  39664. * Depending on the rounding mode, the result may be incorrectly rounded if the first fifteen
  39665. * rounding digits are [49]99999999999999 or [50]00000000000000. In that case, the maximum error
  39666. * between the result and the correctly rounded result will be one ulp (unit in the last place).
  39667. *
  39668. * log[-b](a) = NaN
  39669. * log[0](a) = NaN
  39670. * log[1](a) = NaN
  39671. * log[NaN](a) = NaN
  39672. * log[Infinity](a) = NaN
  39673. * log[b](0) = -Infinity
  39674. * log[b](-0) = -Infinity
  39675. * log[b](-a) = NaN
  39676. * log[b](1) = 0
  39677. * log[b](Infinity) = Infinity
  39678. * log[b](NaN) = NaN
  39679. *
  39680. * [base] {number|string|Decimal} The base of the logarithm.
  39681. *
  39682. */
  39683. P.logarithm = P.log = function (base) {
  39684. var isBase10, d, denominator, k, inf, num, sd, r,
  39685. arg = this,
  39686. Ctor = arg.constructor,
  39687. pr = Ctor.precision,
  39688. rm = Ctor.rounding,
  39689. guard = 5;
  39690. // Default base is 10.
  39691. if (base == null) {
  39692. base = new Ctor(10);
  39693. isBase10 = true;
  39694. } else {
  39695. base = new Ctor(base);
  39696. d = base.d;
  39697. // Return NaN if base is negative, or non-finite, or is 0 or 1.
  39698. if (base.s < 0 || !d || !d[0] || base.eq(1)) return new Ctor(NaN);
  39699. isBase10 = base.eq(10);
  39700. }
  39701. d = arg.d;
  39702. // Is arg negative, non-finite, 0 or 1?
  39703. if (arg.s < 0 || !d || !d[0] || arg.eq(1)) {
  39704. return new Ctor(d && !d[0] ? -1 / 0 : arg.s != 1 ? NaN : d ? 0 : 1 / 0);
  39705. }
  39706. // The result will have a non-terminating decimal expansion if base is 10 and arg is not an
  39707. // integer power of 10.
  39708. if (isBase10) {
  39709. if (d.length > 1) {
  39710. inf = true;
  39711. } else {
  39712. for (k = d[0]; k % 10 === 0;) k /= 10;
  39713. inf = k !== 1;
  39714. }
  39715. }
  39716. external = false;
  39717. sd = pr + guard;
  39718. num = naturalLogarithm(arg, sd);
  39719. denominator = isBase10 ? getLn10(Ctor, sd + 10) : naturalLogarithm(base, sd);
  39720. // The result will have 5 rounding digits.
  39721. r = divide(num, denominator, sd, 1);
  39722. // If at a rounding boundary, i.e. the result's rounding digits are [49]9999 or [50]0000,
  39723. // calculate 10 further digits.
  39724. //
  39725. // If the result is known to have an infinite decimal expansion, repeat this until it is clear
  39726. // that the result is above or below the boundary. Otherwise, if after calculating the 10
  39727. // further digits, the last 14 are nines, round up and assume the result is exact.
  39728. // Also assume the result is exact if the last 14 are zero.
  39729. //
  39730. // Example of a result that will be incorrectly rounded:
  39731. // log[1048576](4503599627370502) = 2.60000000000000009610279511444746...
  39732. // The above result correctly rounded using ROUND_CEIL to 1 decimal place should be 2.7, but it
  39733. // will be given as 2.6 as there are 15 zeros immediately after the requested decimal place, so
  39734. // the exact result would be assumed to be 2.6, which rounded using ROUND_CEIL to 1 decimal
  39735. // place is still 2.6.
  39736. if (checkRoundingDigits(r.d, k = pr, rm)) {
  39737. do {
  39738. sd += 10;
  39739. num = naturalLogarithm(arg, sd);
  39740. denominator = isBase10 ? getLn10(Ctor, sd + 10) : naturalLogarithm(base, sd);
  39741. r = divide(num, denominator, sd, 1);
  39742. if (!inf) {
  39743. // Check for 14 nines from the 2nd rounding digit, as the first may be 4.
  39744. if (+digitsToString(r.d).slice(k + 1, k + 15) + 1 == 1e14) {
  39745. r = finalise(r, pr + 1, 0);
  39746. }
  39747. break;
  39748. }
  39749. } while (checkRoundingDigits(r.d, k += 10, rm));
  39750. }
  39751. external = true;
  39752. return finalise(r, pr, rm);
  39753. };
  39754. /*
  39755. * Return a new Decimal whose value is the maximum of the arguments and the value of this Decimal.
  39756. *
  39757. * arguments {number|string|Decimal}
  39758. *
  39759. P.max = function () {
  39760. Array.prototype.push.call(arguments, this);
  39761. return maxOrMin(this.constructor, arguments, 'lt');
  39762. };
  39763. */
  39764. /*
  39765. * Return a new Decimal whose value is the minimum of the arguments and the value of this Decimal.
  39766. *
  39767. * arguments {number|string|Decimal}
  39768. *
  39769. P.min = function () {
  39770. Array.prototype.push.call(arguments, this);
  39771. return maxOrMin(this.constructor, arguments, 'gt');
  39772. };
  39773. */
  39774. /*
  39775. * n - 0 = n
  39776. * n - N = N
  39777. * n - I = -I
  39778. * 0 - n = -n
  39779. * 0 - 0 = 0
  39780. * 0 - N = N
  39781. * 0 - I = -I
  39782. * N - n = N
  39783. * N - 0 = N
  39784. * N - N = N
  39785. * N - I = N
  39786. * I - n = I
  39787. * I - 0 = I
  39788. * I - N = N
  39789. * I - I = N
  39790. *
  39791. * Return a new Decimal whose value is the value of this Decimal minus `y`, rounded to `precision`
  39792. * significant digits using rounding mode `rounding`.
  39793. *
  39794. */
  39795. P.minus = P.sub = function (y) {
  39796. var d, e, i, j, k, len, pr, rm, xd, xe, xLTy, yd,
  39797. x = this,
  39798. Ctor = x.constructor;
  39799. y = new Ctor(y);
  39800. // If either is not finite...
  39801. if (!x.d || !y.d) {
  39802. // Return NaN if either is NaN.
  39803. if (!x.s || !y.s) y = new Ctor(NaN);
  39804. // Return y negated if x is finite and y is ±Infinity.
  39805. else if (x.d) y.s = -y.s;
  39806. // Return x if y is finite and x is ±Infinity.
  39807. // Return x if both are ±Infinity with different signs.
  39808. // Return NaN if both are ±Infinity with the same sign.
  39809. else y = new Ctor(y.d || x.s !== y.s ? x : NaN);
  39810. return y;
  39811. }
  39812. // If signs differ...
  39813. if (x.s != y.s) {
  39814. y.s = -y.s;
  39815. return x.plus(y);
  39816. }
  39817. xd = x.d;
  39818. yd = y.d;
  39819. pr = Ctor.precision;
  39820. rm = Ctor.rounding;
  39821. // If either is zero...
  39822. if (!xd[0] || !yd[0]) {
  39823. // Return y negated if x is zero and y is non-zero.
  39824. if (yd[0]) y.s = -y.s;
  39825. // Return x if y is zero and x is non-zero.
  39826. else if (xd[0]) y = new Ctor(x);
  39827. // Return zero if both are zero.
  39828. // From IEEE 754 (2008) 6.3: 0 - 0 = -0 - -0 = -0 when rounding to -Infinity.
  39829. else return new Ctor(rm === 3 ? -0 : 0);
  39830. return external ? finalise(y, pr, rm) : y;
  39831. }
  39832. // x and y are finite, non-zero numbers with the same sign.
  39833. // Calculate base 1e7 exponents.
  39834. e = mathfloor(y.e / LOG_BASE);
  39835. xe = mathfloor(x.e / LOG_BASE);
  39836. xd = xd.slice();
  39837. k = xe - e;
  39838. // If base 1e7 exponents differ...
  39839. if (k) {
  39840. xLTy = k < 0;
  39841. if (xLTy) {
  39842. d = xd;
  39843. k = -k;
  39844. len = yd.length;
  39845. } else {
  39846. d = yd;
  39847. e = xe;
  39848. len = xd.length;
  39849. }
  39850. // Numbers with massively different exponents would result in a very high number of
  39851. // zeros needing to be prepended, but this can be avoided while still ensuring correct
  39852. // rounding by limiting the number of zeros to `Math.ceil(pr / LOG_BASE) + 2`.
  39853. i = Math.max(Math.ceil(pr / LOG_BASE), len) + 2;
  39854. if (k > i) {
  39855. k = i;
  39856. d.length = 1;
  39857. }
  39858. // Prepend zeros to equalise exponents.
  39859. d.reverse();
  39860. for (i = k; i--;) d.push(0);
  39861. d.reverse();
  39862. // Base 1e7 exponents equal.
  39863. } else {
  39864. // Check digits to determine which is the bigger number.
  39865. i = xd.length;
  39866. len = yd.length;
  39867. xLTy = i < len;
  39868. if (xLTy) len = i;
  39869. for (i = 0; i < len; i++) {
  39870. if (xd[i] != yd[i]) {
  39871. xLTy = xd[i] < yd[i];
  39872. break;
  39873. }
  39874. }
  39875. k = 0;
  39876. }
  39877. if (xLTy) {
  39878. d = xd;
  39879. xd = yd;
  39880. yd = d;
  39881. y.s = -y.s;
  39882. }
  39883. len = xd.length;
  39884. // Append zeros to `xd` if shorter.
  39885. // Don't add zeros to `yd` if shorter as subtraction only needs to start at `yd` length.
  39886. for (i = yd.length - len; i > 0; --i) xd[len++] = 0;
  39887. // Subtract yd from xd.
  39888. for (i = yd.length; i > k;) {
  39889. if (xd[--i] < yd[i]) {
  39890. for (j = i; j && xd[--j] === 0;) xd[j] = BASE - 1;
  39891. --xd[j];
  39892. xd[i] += BASE;
  39893. }
  39894. xd[i] -= yd[i];
  39895. }
  39896. // Remove trailing zeros.
  39897. for (; xd[--len] === 0;) xd.pop();
  39898. // Remove leading zeros and adjust exponent accordingly.
  39899. for (; xd[0] === 0; xd.shift()) --e;
  39900. // Zero?
  39901. if (!xd[0]) return new Ctor(rm === 3 ? -0 : 0);
  39902. y.d = xd;
  39903. y.e = getBase10Exponent(xd, e);
  39904. return external ? finalise(y, pr, rm) : y;
  39905. };
  39906. /*
  39907. * n % 0 = N
  39908. * n % N = N
  39909. * n % I = n
  39910. * 0 % n = 0
  39911. * -0 % n = -0
  39912. * 0 % 0 = N
  39913. * 0 % N = N
  39914. * 0 % I = 0
  39915. * N % n = N
  39916. * N % 0 = N
  39917. * N % N = N
  39918. * N % I = N
  39919. * I % n = N
  39920. * I % 0 = N
  39921. * I % N = N
  39922. * I % I = N
  39923. *
  39924. * Return a new Decimal whose value is the value of this Decimal modulo `y`, rounded to
  39925. * `precision` significant digits using rounding mode `rounding`.
  39926. *
  39927. * The result depends on the modulo mode.
  39928. *
  39929. */
  39930. P.modulo = P.mod = function (y) {
  39931. var q,
  39932. x = this,
  39933. Ctor = x.constructor;
  39934. y = new Ctor(y);
  39935. // Return NaN if x is ±Infinity or NaN, or y is NaN or ±0.
  39936. if (!x.d || !y.s || y.d && !y.d[0]) return new Ctor(NaN);
  39937. // Return x if y is ±Infinity or x is ±0.
  39938. if (!y.d || x.d && !x.d[0]) {
  39939. return finalise(new Ctor(x), Ctor.precision, Ctor.rounding);
  39940. }
  39941. // Prevent rounding of intermediate calculations.
  39942. external = false;
  39943. if (Ctor.modulo == 9) {
  39944. // Euclidian division: q = sign(y) * floor(x / abs(y))
  39945. // result = x - q * y where 0 <= result < abs(y)
  39946. q = divide(x, y.abs(), 0, 3, 1);
  39947. q.s *= y.s;
  39948. } else {
  39949. q = divide(x, y, 0, Ctor.modulo, 1);
  39950. }
  39951. q = q.times(y);
  39952. external = true;
  39953. return x.minus(q);
  39954. };
  39955. /*
  39956. * Return a new Decimal whose value is the natural exponential of the value of this Decimal,
  39957. * i.e. the base e raised to the power the value of this Decimal, rounded to `precision`
  39958. * significant digits using rounding mode `rounding`.
  39959. *
  39960. */
  39961. P.naturalExponential = P.exp = function () {
  39962. return naturalExponential(this);
  39963. };
  39964. /*
  39965. * Return a new Decimal whose value is the natural logarithm of the value of this Decimal,
  39966. * rounded to `precision` significant digits using rounding mode `rounding`.
  39967. *
  39968. */
  39969. P.naturalLogarithm = P.ln = function () {
  39970. return naturalLogarithm(this);
  39971. };
  39972. /*
  39973. * Return a new Decimal whose value is the value of this Decimal negated, i.e. as if multiplied by
  39974. * -1.
  39975. *
  39976. */
  39977. P.negated = P.neg = function () {
  39978. var x = new this.constructor(this);
  39979. x.s = -x.s;
  39980. return finalise(x);
  39981. };
  39982. /*
  39983. * n + 0 = n
  39984. * n + N = N
  39985. * n + I = I
  39986. * 0 + n = n
  39987. * 0 + 0 = 0
  39988. * 0 + N = N
  39989. * 0 + I = I
  39990. * N + n = N
  39991. * N + 0 = N
  39992. * N + N = N
  39993. * N + I = N
  39994. * I + n = I
  39995. * I + 0 = I
  39996. * I + N = N
  39997. * I + I = I
  39998. *
  39999. * Return a new Decimal whose value is the value of this Decimal plus `y`, rounded to `precision`
  40000. * significant digits using rounding mode `rounding`.
  40001. *
  40002. */
  40003. P.plus = P.add = function (y) {
  40004. var carry, d, e, i, k, len, pr, rm, xd, yd,
  40005. x = this,
  40006. Ctor = x.constructor;
  40007. y = new Ctor(y);
  40008. // If either is not finite...
  40009. if (!x.d || !y.d) {
  40010. // Return NaN if either is NaN.
  40011. if (!x.s || !y.s) y = new Ctor(NaN);
  40012. // Return x if y is finite and x is ±Infinity.
  40013. // Return x if both are ±Infinity with the same sign.
  40014. // Return NaN if both are ±Infinity with different signs.
  40015. // Return y if x is finite and y is ±Infinity.
  40016. else if (!x.d) y = new Ctor(y.d || x.s === y.s ? x : NaN);
  40017. return y;
  40018. }
  40019. // If signs differ...
  40020. if (x.s != y.s) {
  40021. y.s = -y.s;
  40022. return x.minus(y);
  40023. }
  40024. xd = x.d;
  40025. yd = y.d;
  40026. pr = Ctor.precision;
  40027. rm = Ctor.rounding;
  40028. // If either is zero...
  40029. if (!xd[0] || !yd[0]) {
  40030. // Return x if y is zero.
  40031. // Return y if y is non-zero.
  40032. if (!yd[0]) y = new Ctor(x);
  40033. return external ? finalise(y, pr, rm) : y;
  40034. }
  40035. // x and y are finite, non-zero numbers with the same sign.
  40036. // Calculate base 1e7 exponents.
  40037. k = mathfloor(x.e / LOG_BASE);
  40038. e = mathfloor(y.e / LOG_BASE);
  40039. xd = xd.slice();
  40040. i = k - e;
  40041. // If base 1e7 exponents differ...
  40042. if (i) {
  40043. if (i < 0) {
  40044. d = xd;
  40045. i = -i;
  40046. len = yd.length;
  40047. } else {
  40048. d = yd;
  40049. e = k;
  40050. len = xd.length;
  40051. }
  40052. // Limit number of zeros prepended to max(ceil(pr / LOG_BASE), len) + 1.
  40053. k = Math.ceil(pr / LOG_BASE);
  40054. len = k > len ? k + 1 : len + 1;
  40055. if (i > len) {
  40056. i = len;
  40057. d.length = 1;
  40058. }
  40059. // Prepend zeros to equalise exponents. Note: Faster to use reverse then do unshifts.
  40060. d.reverse();
  40061. for (; i--;) d.push(0);
  40062. d.reverse();
  40063. }
  40064. len = xd.length;
  40065. i = yd.length;
  40066. // If yd is longer than xd, swap xd and yd so xd points to the longer array.
  40067. if (len - i < 0) {
  40068. i = len;
  40069. d = yd;
  40070. yd = xd;
  40071. xd = d;
  40072. }
  40073. // Only start adding at yd.length - 1 as the further digits of xd can be left as they are.
  40074. for (carry = 0; i;) {
  40075. carry = (xd[--i] = xd[i] + yd[i] + carry) / BASE | 0;
  40076. xd[i] %= BASE;
  40077. }
  40078. if (carry) {
  40079. xd.unshift(carry);
  40080. ++e;
  40081. }
  40082. // Remove trailing zeros.
  40083. // No need to check for zero, as +x + +y != 0 && -x + -y != 0
  40084. for (len = xd.length; xd[--len] == 0;) xd.pop();
  40085. y.d = xd;
  40086. y.e = getBase10Exponent(xd, e);
  40087. return external ? finalise(y, pr, rm) : y;
  40088. };
  40089. /*
  40090. * Return the number of significant digits of the value of this Decimal.
  40091. *
  40092. * [z] {boolean|number} Whether to count integer-part trailing zeros: true, false, 1 or 0.
  40093. *
  40094. */
  40095. P.precision = P.sd = function (z) {
  40096. var k,
  40097. x = this;
  40098. if (z !== void 0 && z !== !!z && z !== 1 && z !== 0) throw Error(invalidArgument + z);
  40099. if (x.d) {
  40100. k = getPrecision(x.d);
  40101. if (z && x.e + 1 > k) k = x.e + 1;
  40102. } else {
  40103. k = NaN;
  40104. }
  40105. return k;
  40106. };
  40107. /*
  40108. * Return a new Decimal whose value is the value of this Decimal rounded to a whole number using
  40109. * rounding mode `rounding`.
  40110. *
  40111. */
  40112. P.round = function () {
  40113. var x = this,
  40114. Ctor = x.constructor;
  40115. return finalise(new Ctor(x), x.e + 1, Ctor.rounding);
  40116. };
  40117. /*
  40118. * Return a new Decimal whose value is the sine of the value in radians of this Decimal.
  40119. *
  40120. * Domain: [-Infinity, Infinity]
  40121. * Range: [-1, 1]
  40122. *
  40123. * sin(x) = x - x^3/3! + x^5/5! - ...
  40124. *
  40125. * sin(0) = 0
  40126. * sin(-0) = -0
  40127. * sin(Infinity) = NaN
  40128. * sin(-Infinity) = NaN
  40129. * sin(NaN) = NaN
  40130. *
  40131. */
  40132. P.sine = P.sin = function () {
  40133. var pr, rm,
  40134. x = this,
  40135. Ctor = x.constructor;
  40136. if (!x.isFinite()) return new Ctor(NaN);
  40137. if (x.isZero()) return new Ctor(x);
  40138. pr = Ctor.precision;
  40139. rm = Ctor.rounding;
  40140. Ctor.precision = pr + Math.max(x.e, x.sd()) + LOG_BASE;
  40141. Ctor.rounding = 1;
  40142. x = sine(Ctor, toLessThanHalfPi(Ctor, x));
  40143. Ctor.precision = pr;
  40144. Ctor.rounding = rm;
  40145. return finalise(quadrant > 2 ? x.neg() : x, pr, rm, true);
  40146. };
  40147. /*
  40148. * Return a new Decimal whose value is the square root of this Decimal, rounded to `precision`
  40149. * significant digits using rounding mode `rounding`.
  40150. *
  40151. * sqrt(-n) = N
  40152. * sqrt(N) = N
  40153. * sqrt(-I) = N
  40154. * sqrt(I) = I
  40155. * sqrt(0) = 0
  40156. * sqrt(-0) = -0
  40157. *
  40158. */
  40159. P.squareRoot = P.sqrt = function () {
  40160. var m, n, sd, r, rep, t,
  40161. x = this,
  40162. d = x.d,
  40163. e = x.e,
  40164. s = x.s,
  40165. Ctor = x.constructor;
  40166. // Negative/NaN/Infinity/zero?
  40167. if (s !== 1 || !d || !d[0]) {
  40168. return new Ctor(!s || s < 0 && (!d || d[0]) ? NaN : d ? x : 1 / 0);
  40169. }
  40170. external = false;
  40171. // Initial estimate.
  40172. s = Math.sqrt(+x);
  40173. // Math.sqrt underflow/overflow?
  40174. // Pass x to Math.sqrt as integer, then adjust the exponent of the result.
  40175. if (s == 0 || s == 1 / 0) {
  40176. n = digitsToString(d);
  40177. if ((n.length + e) % 2 == 0) n += '0';
  40178. s = Math.sqrt(n);
  40179. e = mathfloor((e + 1) / 2) - (e < 0 || e % 2);
  40180. if (s == 1 / 0) {
  40181. n = '1e' + e;
  40182. } else {
  40183. n = s.toExponential();
  40184. n = n.slice(0, n.indexOf('e') + 1) + e;
  40185. }
  40186. r = new Ctor(n);
  40187. } else {
  40188. r = new Ctor(s.toString());
  40189. }
  40190. sd = (e = Ctor.precision) + 3;
  40191. // Newton-Raphson iteration.
  40192. for (;;) {
  40193. t = r;
  40194. r = t.plus(divide(x, t, sd + 2, 1)).times(0.5);
  40195. // TODO? Replace with for-loop and checkRoundingDigits.
  40196. if (digitsToString(t.d).slice(0, sd) === (n = digitsToString(r.d)).slice(0, sd)) {
  40197. n = n.slice(sd - 3, sd + 1);
  40198. // The 4th rounding digit may be in error by -1 so if the 4 rounding digits are 9999 or
  40199. // 4999, i.e. approaching a rounding boundary, continue the iteration.
  40200. if (n == '9999' || !rep && n == '4999') {
  40201. // On the first iteration only, check to see if rounding up gives the exact result as the
  40202. // nines may infinitely repeat.
  40203. if (!rep) {
  40204. finalise(t, e + 1, 0);
  40205. if (t.times(t).eq(x)) {
  40206. r = t;
  40207. break;
  40208. }
  40209. }
  40210. sd += 4;
  40211. rep = 1;
  40212. } else {
  40213. // If the rounding digits are null, 0{0,4} or 50{0,3}, check for an exact result.
  40214. // If not, then there are further digits and m will be truthy.
  40215. if (!+n || !+n.slice(1) && n.charAt(0) == '5') {
  40216. // Truncate to the first rounding digit.
  40217. finalise(r, e + 1, 1);
  40218. m = !r.times(r).eq(x);
  40219. }
  40220. break;
  40221. }
  40222. }
  40223. }
  40224. external = true;
  40225. return finalise(r, e, Ctor.rounding, m);
  40226. };
  40227. /*
  40228. * Return a new Decimal whose value is the tangent of the value in radians of this Decimal.
  40229. *
  40230. * Domain: [-Infinity, Infinity]
  40231. * Range: [-Infinity, Infinity]
  40232. *
  40233. * tan(0) = 0
  40234. * tan(-0) = -0
  40235. * tan(Infinity) = NaN
  40236. * tan(-Infinity) = NaN
  40237. * tan(NaN) = NaN
  40238. *
  40239. */
  40240. P.tangent = P.tan = function () {
  40241. var pr, rm,
  40242. x = this,
  40243. Ctor = x.constructor;
  40244. if (!x.isFinite()) return new Ctor(NaN);
  40245. if (x.isZero()) return new Ctor(x);
  40246. pr = Ctor.precision;
  40247. rm = Ctor.rounding;
  40248. Ctor.precision = pr + 10;
  40249. Ctor.rounding = 1;
  40250. x = x.sin();
  40251. x.s = 1;
  40252. x = divide(x, new Ctor(1).minus(x.times(x)).sqrt(), pr + 10, 0);
  40253. Ctor.precision = pr;
  40254. Ctor.rounding = rm;
  40255. return finalise(quadrant == 2 || quadrant == 4 ? x.neg() : x, pr, rm, true);
  40256. };
  40257. /*
  40258. * n * 0 = 0
  40259. * n * N = N
  40260. * n * I = I
  40261. * 0 * n = 0
  40262. * 0 * 0 = 0
  40263. * 0 * N = N
  40264. * 0 * I = N
  40265. * N * n = N
  40266. * N * 0 = N
  40267. * N * N = N
  40268. * N * I = N
  40269. * I * n = I
  40270. * I * 0 = N
  40271. * I * N = N
  40272. * I * I = I
  40273. *
  40274. * Return a new Decimal whose value is this Decimal times `y`, rounded to `precision` significant
  40275. * digits using rounding mode `rounding`.
  40276. *
  40277. */
  40278. P.times = P.mul = function (y) {
  40279. var carry, e, i, k, r, rL, t, xdL, ydL,
  40280. x = this,
  40281. Ctor = x.constructor,
  40282. xd = x.d,
  40283. yd = (y = new Ctor(y)).d;
  40284. y.s *= x.s;
  40285. // If either is NaN, ±Infinity or ±0...
  40286. if (!xd || !xd[0] || !yd || !yd[0]) {
  40287. return new Ctor(!y.s || xd && !xd[0] && !yd || yd && !yd[0] && !xd
  40288. // Return NaN if either is NaN.
  40289. // Return NaN if x is ±0 and y is ±Infinity, or y is ±0 and x is ±Infinity.
  40290. ? NaN
  40291. // Return ±Infinity if either is ±Infinity.
  40292. // Return ±0 if either is ±0.
  40293. : !xd || !yd ? y.s / 0 : y.s * 0);
  40294. }
  40295. e = mathfloor(x.e / LOG_BASE) + mathfloor(y.e / LOG_BASE);
  40296. xdL = xd.length;
  40297. ydL = yd.length;
  40298. // Ensure xd points to the longer array.
  40299. if (xdL < ydL) {
  40300. r = xd;
  40301. xd = yd;
  40302. yd = r;
  40303. rL = xdL;
  40304. xdL = ydL;
  40305. ydL = rL;
  40306. }
  40307. // Initialise the result array with zeros.
  40308. r = [];
  40309. rL = xdL + ydL;
  40310. for (i = rL; i--;) r.push(0);
  40311. // Multiply!
  40312. for (i = ydL; --i >= 0;) {
  40313. carry = 0;
  40314. for (k = xdL + i; k > i;) {
  40315. t = r[k] + yd[i] * xd[k - i - 1] + carry;
  40316. r[k--] = t % BASE | 0;
  40317. carry = t / BASE | 0;
  40318. }
  40319. r[k] = (r[k] + carry) % BASE | 0;
  40320. }
  40321. // Remove trailing zeros.
  40322. for (; !r[--rL];) r.pop();
  40323. if (carry) ++e;
  40324. else r.shift();
  40325. y.d = r;
  40326. y.e = getBase10Exponent(r, e);
  40327. return external ? finalise(y, Ctor.precision, Ctor.rounding) : y;
  40328. };
  40329. /*
  40330. * Return a string representing the value of this Decimal in base 2, round to `sd` significant
  40331. * digits using rounding mode `rm`.
  40332. *
  40333. * If the optional `sd` argument is present then return binary exponential notation.
  40334. *
  40335. * [sd] {number} Significant digits. Integer, 1 to MAX_DIGITS inclusive.
  40336. * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.
  40337. *
  40338. */
  40339. P.toBinary = function (sd, rm) {
  40340. return toStringBinary(this, 2, sd, rm);
  40341. };
  40342. /*
  40343. * Return a new Decimal whose value is the value of this Decimal rounded to a maximum of `dp`
  40344. * decimal places using rounding mode `rm` or `rounding` if `rm` is omitted.
  40345. *
  40346. * If `dp` is omitted, return a new Decimal whose value is the value of this Decimal.
  40347. *
  40348. * [dp] {number} Decimal places. Integer, 0 to MAX_DIGITS inclusive.
  40349. * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.
  40350. *
  40351. */
  40352. P.toDecimalPlaces = P.toDP = function (dp, rm) {
  40353. var x = this,
  40354. Ctor = x.constructor;
  40355. x = new Ctor(x);
  40356. if (dp === void 0) return x;
  40357. checkInt32(dp, 0, MAX_DIGITS);
  40358. if (rm === void 0) rm = Ctor.rounding;
  40359. else checkInt32(rm, 0, 8);
  40360. return finalise(x, dp + x.e + 1, rm);
  40361. };
  40362. /*
  40363. * Return a string representing the value of this Decimal in exponential notation rounded to
  40364. * `dp` fixed decimal places using rounding mode `rounding`.
  40365. *
  40366. * [dp] {number} Decimal places. Integer, 0 to MAX_DIGITS inclusive.
  40367. * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.
  40368. *
  40369. */
  40370. P.toExponential = function (dp, rm) {
  40371. var str,
  40372. x = this,
  40373. Ctor = x.constructor;
  40374. if (dp === void 0) {
  40375. str = finiteToString(x, true);
  40376. } else {
  40377. checkInt32(dp, 0, MAX_DIGITS);
  40378. if (rm === void 0) rm = Ctor.rounding;
  40379. else checkInt32(rm, 0, 8);
  40380. x = finalise(new Ctor(x), dp + 1, rm);
  40381. str = finiteToString(x, true, dp + 1);
  40382. }
  40383. return x.isNeg() && !x.isZero() ? '-' + str : str;
  40384. };
  40385. /*
  40386. * Return a string representing the value of this Decimal in normal (fixed-point) notation to
  40387. * `dp` fixed decimal places and rounded using rounding mode `rm` or `rounding` if `rm` is
  40388. * omitted.
  40389. *
  40390. * As with JavaScript numbers, (-0).toFixed(0) is '0', but e.g. (-0.00001).toFixed(0) is '-0'.
  40391. *
  40392. * [dp] {number} Decimal places. Integer, 0 to MAX_DIGITS inclusive.
  40393. * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.
  40394. *
  40395. * (-0).toFixed(0) is '0', but (-0.1).toFixed(0) is '-0'.
  40396. * (-0).toFixed(1) is '0.0', but (-0.01).toFixed(1) is '-0.0'.
  40397. * (-0).toFixed(3) is '0.000'.
  40398. * (-0.5).toFixed(0) is '-0'.
  40399. *
  40400. */
  40401. P.toFixed = function (dp, rm) {
  40402. var str, y,
  40403. x = this,
  40404. Ctor = x.constructor;
  40405. if (dp === void 0) {
  40406. str = finiteToString(x);
  40407. } else {
  40408. checkInt32(dp, 0, MAX_DIGITS);
  40409. if (rm === void 0) rm = Ctor.rounding;
  40410. else checkInt32(rm, 0, 8);
  40411. y = finalise(new Ctor(x), dp + x.e + 1, rm);
  40412. str = finiteToString(y, false, dp + y.e + 1);
  40413. }
  40414. // To determine whether to add the minus sign look at the value before it was rounded,
  40415. // i.e. look at `x` rather than `y`.
  40416. return x.isNeg() && !x.isZero() ? '-' + str : str;
  40417. };
  40418. /*
  40419. * Return an array representing the value of this Decimal as a simple fraction with an integer
  40420. * numerator and an integer denominator.
  40421. *
  40422. * The denominator will be a positive non-zero value less than or equal to the specified maximum
  40423. * denominator. If a maximum denominator is not specified, the denominator will be the lowest
  40424. * value necessary to represent the number exactly.
  40425. *
  40426. * [maxD] {number|string|Decimal} Maximum denominator. Integer >= 1 and < Infinity.
  40427. *
  40428. */
  40429. P.toFraction = function (maxD) {
  40430. var d, d0, d1, d2, e, k, n, n0, n1, pr, q, r,
  40431. x = this,
  40432. xd = x.d,
  40433. Ctor = x.constructor;
  40434. if (!xd) return new Ctor(x);
  40435. n1 = d0 = new Ctor(1);
  40436. d1 = n0 = new Ctor(0);
  40437. d = new Ctor(d1);
  40438. e = d.e = getPrecision(xd) - x.e - 1;
  40439. k = e % LOG_BASE;
  40440. d.d[0] = mathpow(10, k < 0 ? LOG_BASE + k : k);
  40441. if (maxD == null) {
  40442. // d is 10**e, the minimum max-denominator needed.
  40443. maxD = e > 0 ? d : n1;
  40444. } else {
  40445. n = new Ctor(maxD);
  40446. if (!n.isInt() || n.lt(n1)) throw Error(invalidArgument + n);
  40447. maxD = n.gt(d) ? (e > 0 ? d : n1) : n;
  40448. }
  40449. external = false;
  40450. n = new Ctor(digitsToString(xd));
  40451. pr = Ctor.precision;
  40452. Ctor.precision = e = xd.length * LOG_BASE * 2;
  40453. for (;;) {
  40454. q = divide(n, d, 0, 1, 1);
  40455. d2 = d0.plus(q.times(d1));
  40456. if (d2.cmp(maxD) == 1) break;
  40457. d0 = d1;
  40458. d1 = d2;
  40459. d2 = n1;
  40460. n1 = n0.plus(q.times(d2));
  40461. n0 = d2;
  40462. d2 = d;
  40463. d = n.minus(q.times(d2));
  40464. n = d2;
  40465. }
  40466. d2 = divide(maxD.minus(d0), d1, 0, 1, 1);
  40467. n0 = n0.plus(d2.times(n1));
  40468. d0 = d0.plus(d2.times(d1));
  40469. n0.s = n1.s = x.s;
  40470. // Determine which fraction is closer to x, n0/d0 or n1/d1?
  40471. r = divide(n1, d1, e, 1).minus(x).abs().cmp(divide(n0, d0, e, 1).minus(x).abs()) < 1
  40472. ? [n1, d1] : [n0, d0];
  40473. Ctor.precision = pr;
  40474. external = true;
  40475. return r;
  40476. };
  40477. /*
  40478. * Return a string representing the value of this Decimal in base 16, round to `sd` significant
  40479. * digits using rounding mode `rm`.
  40480. *
  40481. * If the optional `sd` argument is present then return binary exponential notation.
  40482. *
  40483. * [sd] {number} Significant digits. Integer, 1 to MAX_DIGITS inclusive.
  40484. * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.
  40485. *
  40486. */
  40487. P.toHexadecimal = P.toHex = function (sd, rm) {
  40488. return toStringBinary(this, 16, sd, rm);
  40489. };
  40490. /*
  40491. * Returns a new Decimal whose value is the nearest multiple of `y` in the direction of rounding
  40492. * mode `rm`, or `Decimal.rounding` if `rm` is omitted, to the value of this Decimal.
  40493. *
  40494. * The return value will always have the same sign as this Decimal, unless either this Decimal
  40495. * or `y` is NaN, in which case the return value will be also be NaN.
  40496. *
  40497. * The return value is not affected by the value of `precision`.
  40498. *
  40499. * y {number|string|Decimal} The magnitude to round to a multiple of.
  40500. * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.
  40501. *
  40502. * 'toNearest() rounding mode not an integer: {rm}'
  40503. * 'toNearest() rounding mode out of range: {rm}'
  40504. *
  40505. */
  40506. P.toNearest = function (y, rm) {
  40507. var x = this,
  40508. Ctor = x.constructor;
  40509. x = new Ctor(x);
  40510. if (y == null) {
  40511. // If x is not finite, return x.
  40512. if (!x.d) return x;
  40513. y = new Ctor(1);
  40514. rm = Ctor.rounding;
  40515. } else {
  40516. y = new Ctor(y);
  40517. if (rm === void 0) {
  40518. rm = Ctor.rounding;
  40519. } else {
  40520. checkInt32(rm, 0, 8);
  40521. }
  40522. // If x is not finite, return x if y is not NaN, else NaN.
  40523. if (!x.d) return y.s ? x : y;
  40524. // If y is not finite, return Infinity with the sign of x if y is Infinity, else NaN.
  40525. if (!y.d) {
  40526. if (y.s) y.s = x.s;
  40527. return y;
  40528. }
  40529. }
  40530. // If y is not zero, calculate the nearest multiple of y to x.
  40531. if (y.d[0]) {
  40532. external = false;
  40533. x = divide(x, y, 0, rm, 1).times(y);
  40534. external = true;
  40535. finalise(x);
  40536. // If y is zero, return zero with the sign of x.
  40537. } else {
  40538. y.s = x.s;
  40539. x = y;
  40540. }
  40541. return x;
  40542. };
  40543. /*
  40544. * Return the value of this Decimal converted to a number primitive.
  40545. * Zero keeps its sign.
  40546. *
  40547. */
  40548. P.toNumber = function () {
  40549. return +this;
  40550. };
  40551. /*
  40552. * Return a string representing the value of this Decimal in base 8, round to `sd` significant
  40553. * digits using rounding mode `rm`.
  40554. *
  40555. * If the optional `sd` argument is present then return binary exponential notation.
  40556. *
  40557. * [sd] {number} Significant digits. Integer, 1 to MAX_DIGITS inclusive.
  40558. * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.
  40559. *
  40560. */
  40561. P.toOctal = function (sd, rm) {
  40562. return toStringBinary(this, 8, sd, rm);
  40563. };
  40564. /*
  40565. * Return a new Decimal whose value is the value of this Decimal raised to the power `y`, rounded
  40566. * to `precision` significant digits using rounding mode `rounding`.
  40567. *
  40568. * ECMAScript compliant.
  40569. *
  40570. * pow(x, NaN) = NaN
  40571. * pow(x, ±0) = 1
  40572. * pow(NaN, non-zero) = NaN
  40573. * pow(abs(x) > 1, +Infinity) = +Infinity
  40574. * pow(abs(x) > 1, -Infinity) = +0
  40575. * pow(abs(x) == 1, ±Infinity) = NaN
  40576. * pow(abs(x) < 1, +Infinity) = +0
  40577. * pow(abs(x) < 1, -Infinity) = +Infinity
  40578. * pow(+Infinity, y > 0) = +Infinity
  40579. * pow(+Infinity, y < 0) = +0
  40580. * pow(-Infinity, odd integer > 0) = -Infinity
  40581. * pow(-Infinity, even integer > 0) = +Infinity
  40582. * pow(-Infinity, odd integer < 0) = -0
  40583. * pow(-Infinity, even integer < 0) = +0
  40584. * pow(+0, y > 0) = +0
  40585. * pow(+0, y < 0) = +Infinity
  40586. * pow(-0, odd integer > 0) = -0
  40587. * pow(-0, even integer > 0) = +0
  40588. * pow(-0, odd integer < 0) = -Infinity
  40589. * pow(-0, even integer < 0) = +Infinity
  40590. * pow(finite x < 0, finite non-integer) = NaN
  40591. *
  40592. * For non-integer or very large exponents pow(x, y) is calculated using
  40593. *
  40594. * x^y = exp(y*ln(x))
  40595. *
  40596. * Assuming the first 15 rounding digits are each equally likely to be any digit 0-9, the
  40597. * probability of an incorrectly rounded result
  40598. * P([49]9{14} | [50]0{14}) = 2 * 0.2 * 10^-14 = 4e-15 = 1/2.5e+14
  40599. * i.e. 1 in 250,000,000,000,000
  40600. *
  40601. * If a result is incorrectly rounded the maximum error will be 1 ulp (unit in last place).
  40602. *
  40603. * y {number|string|Decimal} The power to which to raise this Decimal.
  40604. *
  40605. */
  40606. P.toPower = P.pow = function (y) {
  40607. var e, k, pr, r, rm, s,
  40608. x = this,
  40609. Ctor = x.constructor,
  40610. yn = +(y = new Ctor(y));
  40611. // Either ±Infinity, NaN or ±0?
  40612. if (!x.d || !y.d || !x.d[0] || !y.d[0]) return new Ctor(mathpow(+x, yn));
  40613. x = new Ctor(x);
  40614. if (x.eq(1)) return x;
  40615. pr = Ctor.precision;
  40616. rm = Ctor.rounding;
  40617. if (y.eq(1)) return finalise(x, pr, rm);
  40618. // y exponent
  40619. e = mathfloor(y.e / LOG_BASE);
  40620. // If y is a small integer use the 'exponentiation by squaring' algorithm.
  40621. if (e >= y.d.length - 1 && (k = yn < 0 ? -yn : yn) <= MAX_SAFE_INTEGER) {
  40622. r = intPow(Ctor, x, k, pr);
  40623. return y.s < 0 ? new Ctor(1).div(r) : finalise(r, pr, rm);
  40624. }
  40625. s = x.s;
  40626. // if x is negative
  40627. if (s < 0) {
  40628. // if y is not an integer
  40629. if (e < y.d.length - 1) return new Ctor(NaN);
  40630. // Result is positive if x is negative and the last digit of integer y is even.
  40631. if ((y.d[e] & 1) == 0) s = 1;
  40632. // if x.eq(-1)
  40633. if (x.e == 0 && x.d[0] == 1 && x.d.length == 1) {
  40634. x.s = s;
  40635. return x;
  40636. }
  40637. }
  40638. // Estimate result exponent.
  40639. // x^y = 10^e, where e = y * log10(x)
  40640. // log10(x) = log10(x_significand) + x_exponent
  40641. // log10(x_significand) = ln(x_significand) / ln(10)
  40642. k = mathpow(+x, yn);
  40643. e = k == 0 || !isFinite(k)
  40644. ? mathfloor(yn * (Math.log('0.' + digitsToString(x.d)) / Math.LN10 + x.e + 1))
  40645. : new Ctor(k + '').e;
  40646. // Exponent estimate may be incorrect e.g. x: 0.999999999999999999, y: 2.29, e: 0, r.e: -1.
  40647. // Overflow/underflow?
  40648. if (e > Ctor.maxE + 1 || e < Ctor.minE - 1) return new Ctor(e > 0 ? s / 0 : 0);
  40649. external = false;
  40650. Ctor.rounding = x.s = 1;
  40651. // Estimate the extra guard digits needed to ensure five correct rounding digits from
  40652. // naturalLogarithm(x). Example of failure without these extra digits (precision: 10):
  40653. // new Decimal(2.32456).pow('2087987436534566.46411')
  40654. // should be 1.162377823e+764914905173815, but is 1.162355823e+764914905173815
  40655. k = Math.min(12, (e + '').length);
  40656. // r = x^y = exp(y*ln(x))
  40657. r = naturalExponential(y.times(naturalLogarithm(x, pr + k)), pr);
  40658. // r may be Infinity, e.g. (0.9999999999999999).pow(-1e+40)
  40659. if (r.d) {
  40660. // Truncate to the required precision plus five rounding digits.
  40661. r = finalise(r, pr + 5, 1);
  40662. // If the rounding digits are [49]9999 or [50]0000 increase the precision by 10 and recalculate
  40663. // the result.
  40664. if (checkRoundingDigits(r.d, pr, rm)) {
  40665. e = pr + 10;
  40666. // Truncate to the increased precision plus five rounding digits.
  40667. r = finalise(naturalExponential(y.times(naturalLogarithm(x, e + k)), e), e + 5, 1);
  40668. // Check for 14 nines from the 2nd rounding digit (the first rounding digit may be 4 or 9).
  40669. if (+digitsToString(r.d).slice(pr + 1, pr + 15) + 1 == 1e14) {
  40670. r = finalise(r, pr + 1, 0);
  40671. }
  40672. }
  40673. }
  40674. r.s = s;
  40675. external = true;
  40676. Ctor.rounding = rm;
  40677. return finalise(r, pr, rm);
  40678. };
  40679. /*
  40680. * Return a string representing the value of this Decimal rounded to `sd` significant digits
  40681. * using rounding mode `rounding`.
  40682. *
  40683. * Return exponential notation if `sd` is less than the number of digits necessary to represent
  40684. * the integer part of the value in normal notation.
  40685. *
  40686. * [sd] {number} Significant digits. Integer, 1 to MAX_DIGITS inclusive.
  40687. * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.
  40688. *
  40689. */
  40690. P.toPrecision = function (sd, rm) {
  40691. var str,
  40692. x = this,
  40693. Ctor = x.constructor;
  40694. if (sd === void 0) {
  40695. str = finiteToString(x, x.e <= Ctor.toExpNeg || x.e >= Ctor.toExpPos);
  40696. } else {
  40697. checkInt32(sd, 1, MAX_DIGITS);
  40698. if (rm === void 0) rm = Ctor.rounding;
  40699. else checkInt32(rm, 0, 8);
  40700. x = finalise(new Ctor(x), sd, rm);
  40701. str = finiteToString(x, sd <= x.e || x.e <= Ctor.toExpNeg, sd);
  40702. }
  40703. return x.isNeg() && !x.isZero() ? '-' + str : str;
  40704. };
  40705. /*
  40706. * Return a new Decimal whose value is the value of this Decimal rounded to a maximum of `sd`
  40707. * significant digits using rounding mode `rm`, or to `precision` and `rounding` respectively if
  40708. * omitted.
  40709. *
  40710. * [sd] {number} Significant digits. Integer, 1 to MAX_DIGITS inclusive.
  40711. * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.
  40712. *
  40713. * 'toSD() digits out of range: {sd}'
  40714. * 'toSD() digits not an integer: {sd}'
  40715. * 'toSD() rounding mode not an integer: {rm}'
  40716. * 'toSD() rounding mode out of range: {rm}'
  40717. *
  40718. */
  40719. P.toSignificantDigits = P.toSD = function (sd, rm) {
  40720. var x = this,
  40721. Ctor = x.constructor;
  40722. if (sd === void 0) {
  40723. sd = Ctor.precision;
  40724. rm = Ctor.rounding;
  40725. } else {
  40726. checkInt32(sd, 1, MAX_DIGITS);
  40727. if (rm === void 0) rm = Ctor.rounding;
  40728. else checkInt32(rm, 0, 8);
  40729. }
  40730. return finalise(new Ctor(x), sd, rm);
  40731. };
  40732. /*
  40733. * Return a string representing the value of this Decimal.
  40734. *
  40735. * Return exponential notation if this Decimal has a positive exponent equal to or greater than
  40736. * `toExpPos`, or a negative exponent equal to or less than `toExpNeg`.
  40737. *
  40738. */
  40739. P.toString = function () {
  40740. var x = this,
  40741. Ctor = x.constructor,
  40742. str = finiteToString(x, x.e <= Ctor.toExpNeg || x.e >= Ctor.toExpPos);
  40743. return x.isNeg() && !x.isZero() ? '-' + str : str;
  40744. };
  40745. /*
  40746. * Return a new Decimal whose value is the value of this Decimal truncated to a whole number.
  40747. *
  40748. */
  40749. P.truncated = P.trunc = function () {
  40750. return finalise(new this.constructor(this), this.e + 1, 1);
  40751. };
  40752. /*
  40753. * Return a string representing the value of this Decimal.
  40754. * Unlike `toString`, negative zero will include the minus sign.
  40755. *
  40756. */
  40757. P.valueOf = P.toJSON = function () {
  40758. var x = this,
  40759. Ctor = x.constructor,
  40760. str = finiteToString(x, x.e <= Ctor.toExpNeg || x.e >= Ctor.toExpPos);
  40761. return x.isNeg() ? '-' + str : str;
  40762. };
  40763. /*
  40764. // Add aliases to match BigDecimal method names.
  40765. // P.add = P.plus;
  40766. P.subtract = P.minus;
  40767. P.multiply = P.times;
  40768. P.divide = P.div;
  40769. P.remainder = P.mod;
  40770. P.compareTo = P.cmp;
  40771. P.negate = P.neg;
  40772. */
  40773. // Helper functions for Decimal.prototype (P) and/or Decimal methods, and their callers.
  40774. /*
  40775. * digitsToString P.cubeRoot, P.logarithm, P.squareRoot, P.toFraction, P.toPower,
  40776. * finiteToString, naturalExponential, naturalLogarithm
  40777. * checkInt32 P.toDecimalPlaces, P.toExponential, P.toFixed, P.toNearest,
  40778. * P.toPrecision, P.toSignificantDigits, toStringBinary, random
  40779. * checkRoundingDigits P.logarithm, P.toPower, naturalExponential, naturalLogarithm
  40780. * convertBase toStringBinary, parseOther
  40781. * cos P.cos
  40782. * divide P.atanh, P.cubeRoot, P.dividedBy, P.dividedToIntegerBy,
  40783. * P.logarithm, P.modulo, P.squareRoot, P.tan, P.tanh, P.toFraction,
  40784. * P.toNearest, toStringBinary, naturalExponential, naturalLogarithm,
  40785. * taylorSeries, atan2, parseOther
  40786. * finalise P.absoluteValue, P.atan, P.atanh, P.ceil, P.cos, P.cosh,
  40787. * P.cubeRoot, P.dividedToIntegerBy, P.floor, P.logarithm, P.minus,
  40788. * P.modulo, P.negated, P.plus, P.round, P.sin, P.sinh, P.squareRoot,
  40789. * P.tan, P.times, P.toDecimalPlaces, P.toExponential, P.toFixed,
  40790. * P.toNearest, P.toPower, P.toPrecision, P.toSignificantDigits,
  40791. * P.truncated, divide, getLn10, getPi, naturalExponential,
  40792. * naturalLogarithm, ceil, floor, round, trunc
  40793. * finiteToString P.toExponential, P.toFixed, P.toPrecision, P.toString, P.valueOf,
  40794. * toStringBinary
  40795. * getBase10Exponent P.minus, P.plus, P.times, parseOther
  40796. * getLn10 P.logarithm, naturalLogarithm
  40797. * getPi P.acos, P.asin, P.atan, toLessThanHalfPi, atan2
  40798. * getPrecision P.precision, P.toFraction
  40799. * getZeroString digitsToString, finiteToString
  40800. * intPow P.toPower, parseOther
  40801. * isOdd toLessThanHalfPi
  40802. * maxOrMin max, min
  40803. * naturalExponential P.naturalExponential, P.toPower
  40804. * naturalLogarithm P.acosh, P.asinh, P.atanh, P.logarithm, P.naturalLogarithm,
  40805. * P.toPower, naturalExponential
  40806. * nonFiniteToString finiteToString, toStringBinary
  40807. * parseDecimal Decimal
  40808. * parseOther Decimal
  40809. * sin P.sin
  40810. * taylorSeries P.cosh, P.sinh, cos, sin
  40811. * toLessThanHalfPi P.cos, P.sin
  40812. * toStringBinary P.toBinary, P.toHexadecimal, P.toOctal
  40813. * truncate intPow
  40814. *
  40815. * Throws: P.logarithm, P.precision, P.toFraction, checkInt32, getLn10, getPi,
  40816. * naturalLogarithm, config, parseOther, random, Decimal
  40817. */
  40818. function digitsToString(d) {
  40819. var i, k, ws,
  40820. indexOfLastWord = d.length - 1,
  40821. str = '',
  40822. w = d[0];
  40823. if (indexOfLastWord > 0) {
  40824. str += w;
  40825. for (i = 1; i < indexOfLastWord; i++) {
  40826. ws = d[i] + '';
  40827. k = LOG_BASE - ws.length;
  40828. if (k) str += getZeroString(k);
  40829. str += ws;
  40830. }
  40831. w = d[i];
  40832. ws = w + '';
  40833. k = LOG_BASE - ws.length;
  40834. if (k) str += getZeroString(k);
  40835. } else if (w === 0) {
  40836. return '0';
  40837. }
  40838. // Remove trailing zeros of last w.
  40839. for (; w % 10 === 0;) w /= 10;
  40840. return str + w;
  40841. }
  40842. function checkInt32(i, min, max) {
  40843. if (i !== ~~i || i < min || i > max) {
  40844. throw Error(invalidArgument + i);
  40845. }
  40846. }
  40847. /*
  40848. * Check 5 rounding digits if `repeating` is null, 4 otherwise.
  40849. * `repeating == null` if caller is `log` or `pow`,
  40850. * `repeating != null` if caller is `naturalLogarithm` or `naturalExponential`.
  40851. */
  40852. function checkRoundingDigits(d, i, rm, repeating) {
  40853. var di, k, r, rd;
  40854. // Get the length of the first word of the array d.
  40855. for (k = d[0]; k >= 10; k /= 10) --i;
  40856. // Is the rounding digit in the first word of d?
  40857. if (--i < 0) {
  40858. i += LOG_BASE;
  40859. di = 0;
  40860. } else {
  40861. di = Math.ceil((i + 1) / LOG_BASE);
  40862. i %= LOG_BASE;
  40863. }
  40864. // i is the index (0 - 6) of the rounding digit.
  40865. // E.g. if within the word 3487563 the first rounding digit is 5,
  40866. // then i = 4, k = 1000, rd = 3487563 % 1000 = 563
  40867. k = mathpow(10, LOG_BASE - i);
  40868. rd = d[di] % k | 0;
  40869. if (repeating == null) {
  40870. if (i < 3) {
  40871. if (i == 0) rd = rd / 100 | 0;
  40872. else if (i == 1) rd = rd / 10 | 0;
  40873. r = rm < 4 && rd == 99999 || rm > 3 && rd == 49999 || rd == 50000 || rd == 0;
  40874. } else {
  40875. r = (rm < 4 && rd + 1 == k || rm > 3 && rd + 1 == k / 2) &&
  40876. (d[di + 1] / k / 100 | 0) == mathpow(10, i - 2) - 1 ||
  40877. (rd == k / 2 || rd == 0) && (d[di + 1] / k / 100 | 0) == 0;
  40878. }
  40879. } else {
  40880. if (i < 4) {
  40881. if (i == 0) rd = rd / 1000 | 0;
  40882. else if (i == 1) rd = rd / 100 | 0;
  40883. else if (i == 2) rd = rd / 10 | 0;
  40884. r = (repeating || rm < 4) && rd == 9999 || !repeating && rm > 3 && rd == 4999;
  40885. } else {
  40886. r = ((repeating || rm < 4) && rd + 1 == k ||
  40887. (!repeating && rm > 3) && rd + 1 == k / 2) &&
  40888. (d[di + 1] / k / 1000 | 0) == mathpow(10, i - 3) - 1;
  40889. }
  40890. }
  40891. return r;
  40892. }
  40893. // Convert string of `baseIn` to an array of numbers of `baseOut`.
  40894. // Eg. convertBase('255', 10, 16) returns [15, 15].
  40895. // Eg. convertBase('ff', 16, 10) returns [2, 5, 5].
  40896. function convertBase(str, baseIn, baseOut) {
  40897. var j,
  40898. arr = [0],
  40899. arrL,
  40900. i = 0,
  40901. strL = str.length;
  40902. for (; i < strL;) {
  40903. for (arrL = arr.length; arrL--;) arr[arrL] *= baseIn;
  40904. arr[0] += NUMERALS.indexOf(str.charAt(i++));
  40905. for (j = 0; j < arr.length; j++) {
  40906. if (arr[j] > baseOut - 1) {
  40907. if (arr[j + 1] === void 0) arr[j + 1] = 0;
  40908. arr[j + 1] += arr[j] / baseOut | 0;
  40909. arr[j] %= baseOut;
  40910. }
  40911. }
  40912. }
  40913. return arr.reverse();
  40914. }
  40915. /*
  40916. * cos(x) = 1 - x^2/2! + x^4/4! - ...
  40917. * |x| < pi/2
  40918. *
  40919. */
  40920. function cosine(Ctor, x) {
  40921. var k, y,
  40922. len = x.d.length;
  40923. // Argument reduction: cos(4x) = 8*(cos^4(x) - cos^2(x)) + 1
  40924. // i.e. cos(x) = 8*(cos^4(x/4) - cos^2(x/4)) + 1
  40925. // Estimate the optimum number of times to use the argument reduction.
  40926. if (len < 32) {
  40927. k = Math.ceil(len / 3);
  40928. y = Math.pow(4, -k).toString();
  40929. } else {
  40930. k = 16;
  40931. y = '2.3283064365386962890625e-10';
  40932. }
  40933. Ctor.precision += k;
  40934. x = taylorSeries(Ctor, 1, x.times(y), new Ctor(1));
  40935. // Reverse argument reduction
  40936. for (var i = k; i--;) {
  40937. var cos2x = x.times(x);
  40938. x = cos2x.times(cos2x).minus(cos2x).times(8).plus(1);
  40939. }
  40940. Ctor.precision -= k;
  40941. return x;
  40942. }
  40943. /*
  40944. * Perform division in the specified base.
  40945. */
  40946. var divide = (function () {
  40947. // Assumes non-zero x and k, and hence non-zero result.
  40948. function multiplyInteger(x, k, base) {
  40949. var temp,
  40950. carry = 0,
  40951. i = x.length;
  40952. for (x = x.slice(); i--;) {
  40953. temp = x[i] * k + carry;
  40954. x[i] = temp % base | 0;
  40955. carry = temp / base | 0;
  40956. }
  40957. if (carry) x.unshift(carry);
  40958. return x;
  40959. }
  40960. function compare(a, b, aL, bL) {
  40961. var i, r;
  40962. if (aL != bL) {
  40963. r = aL > bL ? 1 : -1;
  40964. } else {
  40965. for (i = r = 0; i < aL; i++) {
  40966. if (a[i] != b[i]) {
  40967. r = a[i] > b[i] ? 1 : -1;
  40968. break;
  40969. }
  40970. }
  40971. }
  40972. return r;
  40973. }
  40974. function subtract(a, b, aL, base) {
  40975. var i = 0;
  40976. // Subtract b from a.
  40977. for (; aL--;) {
  40978. a[aL] -= i;
  40979. i = a[aL] < b[aL] ? 1 : 0;
  40980. a[aL] = i * base + a[aL] - b[aL];
  40981. }
  40982. // Remove leading zeros.
  40983. for (; !a[0] && a.length > 1;) a.shift();
  40984. }
  40985. return function (x, y, pr, rm, dp, base) {
  40986. var cmp, e, i, k, logBase, more, prod, prodL, q, qd, rem, remL, rem0, sd, t, xi, xL, yd0,
  40987. yL, yz,
  40988. Ctor = x.constructor,
  40989. sign = x.s == y.s ? 1 : -1,
  40990. xd = x.d,
  40991. yd = y.d;
  40992. // Either NaN, Infinity or 0?
  40993. if (!xd || !xd[0] || !yd || !yd[0]) {
  40994. return new Ctor(// Return NaN if either NaN, or both Infinity or 0.
  40995. !x.s || !y.s || (xd ? yd && xd[0] == yd[0] : !yd) ? NaN :
  40996. // Return ±0 if x is 0 or y is ±Infinity, or return ±Infinity as y is 0.
  40997. xd && xd[0] == 0 || !yd ? sign * 0 : sign / 0);
  40998. }
  40999. if (base) {
  41000. logBase = 1;
  41001. e = x.e - y.e;
  41002. } else {
  41003. base = BASE;
  41004. logBase = LOG_BASE;
  41005. e = mathfloor(x.e / logBase) - mathfloor(y.e / logBase);
  41006. }
  41007. yL = yd.length;
  41008. xL = xd.length;
  41009. q = new Ctor(sign);
  41010. qd = q.d = [];
  41011. // Result exponent may be one less than e.
  41012. // The digit array of a Decimal from toStringBinary may have trailing zeros.
  41013. for (i = 0; yd[i] == (xd[i] || 0); i++);
  41014. if (yd[i] > (xd[i] || 0)) e--;
  41015. if (pr == null) {
  41016. sd = pr = Ctor.precision;
  41017. rm = Ctor.rounding;
  41018. } else if (dp) {
  41019. sd = pr + (x.e - y.e) + 1;
  41020. } else {
  41021. sd = pr;
  41022. }
  41023. if (sd < 0) {
  41024. qd.push(1);
  41025. more = true;
  41026. } else {
  41027. // Convert precision in number of base 10 digits to base 1e7 digits.
  41028. sd = sd / logBase + 2 | 0;
  41029. i = 0;
  41030. // divisor < 1e7
  41031. if (yL == 1) {
  41032. k = 0;
  41033. yd = yd[0];
  41034. sd++;
  41035. // k is the carry.
  41036. for (; (i < xL || k) && sd--; i++) {
  41037. t = k * base + (xd[i] || 0);
  41038. qd[i] = t / yd | 0;
  41039. k = t % yd | 0;
  41040. }
  41041. more = k || i < xL;
  41042. // divisor >= 1e7
  41043. } else {
  41044. // Normalise xd and yd so highest order digit of yd is >= base/2
  41045. k = base / (yd[0] + 1) | 0;
  41046. if (k > 1) {
  41047. yd = multiplyInteger(yd, k, base);
  41048. xd = multiplyInteger(xd, k, base);
  41049. yL = yd.length;
  41050. xL = xd.length;
  41051. }
  41052. xi = yL;
  41053. rem = xd.slice(0, yL);
  41054. remL = rem.length;
  41055. // Add zeros to make remainder as long as divisor.
  41056. for (; remL < yL;) rem[remL++] = 0;
  41057. yz = yd.slice();
  41058. yz.unshift(0);
  41059. yd0 = yd[0];
  41060. if (yd[1] >= base / 2) ++yd0;
  41061. do {
  41062. k = 0;
  41063. // Compare divisor and remainder.
  41064. cmp = compare(yd, rem, yL, remL);
  41065. // If divisor < remainder.
  41066. if (cmp < 0) {
  41067. // Calculate trial digit, k.
  41068. rem0 = rem[0];
  41069. if (yL != remL) rem0 = rem0 * base + (rem[1] || 0);
  41070. // k will be how many times the divisor goes into the current remainder.
  41071. k = rem0 / yd0 | 0;
  41072. // Algorithm:
  41073. // 1. product = divisor * trial digit (k)
  41074. // 2. if product > remainder: product -= divisor, k--
  41075. // 3. remainder -= product
  41076. // 4. if product was < remainder at 2:
  41077. // 5. compare new remainder and divisor
  41078. // 6. If remainder > divisor: remainder -= divisor, k++
  41079. if (k > 1) {
  41080. if (k >= base) k = base - 1;
  41081. // product = divisor * trial digit.
  41082. prod = multiplyInteger(yd, k, base);
  41083. prodL = prod.length;
  41084. remL = rem.length;
  41085. // Compare product and remainder.
  41086. cmp = compare(prod, rem, prodL, remL);
  41087. // product > remainder.
  41088. if (cmp == 1) {
  41089. k--;
  41090. // Subtract divisor from product.
  41091. subtract(prod, yL < prodL ? yz : yd, prodL, base);
  41092. }
  41093. } else {
  41094. // cmp is -1.
  41095. // If k is 0, there is no need to compare yd and rem again below, so change cmp to 1
  41096. // to avoid it. If k is 1 there is a need to compare yd and rem again below.
  41097. if (k == 0) cmp = k = 1;
  41098. prod = yd.slice();
  41099. }
  41100. prodL = prod.length;
  41101. if (prodL < remL) prod.unshift(0);
  41102. // Subtract product from remainder.
  41103. subtract(rem, prod, remL, base);
  41104. // If product was < previous remainder.
  41105. if (cmp == -1) {
  41106. remL = rem.length;
  41107. // Compare divisor and new remainder.
  41108. cmp = compare(yd, rem, yL, remL);
  41109. // If divisor < new remainder, subtract divisor from remainder.
  41110. if (cmp < 1) {
  41111. k++;
  41112. // Subtract divisor from remainder.
  41113. subtract(rem, yL < remL ? yz : yd, remL, base);
  41114. }
  41115. }
  41116. remL = rem.length;
  41117. } else if (cmp === 0) {
  41118. k++;
  41119. rem = [0];
  41120. } // if cmp === 1, k will be 0
  41121. // Add the next digit, k, to the result array.
  41122. qd[i++] = k;
  41123. // Update the remainder.
  41124. if (cmp && rem[0]) {
  41125. rem[remL++] = xd[xi] || 0;
  41126. } else {
  41127. rem = [xd[xi]];
  41128. remL = 1;
  41129. }
  41130. } while ((xi++ < xL || rem[0] !== void 0) && sd--);
  41131. more = rem[0] !== void 0;
  41132. }
  41133. // Leading zero?
  41134. if (!qd[0]) qd.shift();
  41135. }
  41136. // logBase is 1 when divide is being used for base conversion.
  41137. if (logBase == 1) {
  41138. q.e = e;
  41139. inexact = more;
  41140. } else {
  41141. // To calculate q.e, first get the number of digits of qd[0].
  41142. for (i = 1, k = qd[0]; k >= 10; k /= 10) i++;
  41143. q.e = i + e * logBase - 1;
  41144. finalise(q, dp ? pr + q.e + 1 : pr, rm, more);
  41145. }
  41146. return q;
  41147. };
  41148. })();
  41149. /*
  41150. * Round `x` to `sd` significant digits using rounding mode `rm`.
  41151. * Check for over/under-flow.
  41152. */
  41153. function finalise(x, sd, rm, isTruncated) {
  41154. var digits, i, j, k, rd, roundUp, w, xd, xdi,
  41155. Ctor = x.constructor;
  41156. // Don't round if sd is null or undefined.
  41157. out: if (sd != null) {
  41158. xd = x.d;
  41159. // Infinity/NaN.
  41160. if (!xd) return x;
  41161. // rd: the rounding digit, i.e. the digit after the digit that may be rounded up.
  41162. // w: the word of xd containing rd, a base 1e7 number.
  41163. // xdi: the index of w within xd.
  41164. // digits: the number of digits of w.
  41165. // i: what would be the index of rd within w if all the numbers were 7 digits long (i.e. if
  41166. // they had leading zeros)
  41167. // j: if > 0, the actual index of rd within w (if < 0, rd is a leading zero).
  41168. // Get the length of the first word of the digits array xd.
  41169. for (digits = 1, k = xd[0]; k >= 10; k /= 10) digits++;
  41170. i = sd - digits;
  41171. // Is the rounding digit in the first word of xd?
  41172. if (i < 0) {
  41173. i += LOG_BASE;
  41174. j = sd;
  41175. w = xd[xdi = 0];
  41176. // Get the rounding digit at index j of w.
  41177. rd = w / mathpow(10, digits - j - 1) % 10 | 0;
  41178. } else {
  41179. xdi = Math.ceil((i + 1) / LOG_BASE);
  41180. k = xd.length;
  41181. if (xdi >= k) {
  41182. if (isTruncated) {
  41183. // Needed by `naturalExponential`, `naturalLogarithm` and `squareRoot`.
  41184. for (; k++ <= xdi;) xd.push(0);
  41185. w = rd = 0;
  41186. digits = 1;
  41187. i %= LOG_BASE;
  41188. j = i - LOG_BASE + 1;
  41189. } else {
  41190. break out;
  41191. }
  41192. } else {
  41193. w = k = xd[xdi];
  41194. // Get the number of digits of w.
  41195. for (digits = 1; k >= 10; k /= 10) digits++;
  41196. // Get the index of rd within w.
  41197. i %= LOG_BASE;
  41198. // Get the index of rd within w, adjusted for leading zeros.
  41199. // The number of leading zeros of w is given by LOG_BASE - digits.
  41200. j = i - LOG_BASE + digits;
  41201. // Get the rounding digit at index j of w.
  41202. rd = j < 0 ? 0 : w / mathpow(10, digits - j - 1) % 10 | 0;
  41203. }
  41204. }
  41205. // Are there any non-zero digits after the rounding digit?
  41206. isTruncated = isTruncated || sd < 0 ||
  41207. xd[xdi + 1] !== void 0 || (j < 0 ? w : w % mathpow(10, digits - j - 1));
  41208. // The expression `w % mathpow(10, digits - j - 1)` returns all the digits of w to the right
  41209. // of the digit at (left-to-right) index j, e.g. if w is 908714 and j is 2, the expression
  41210. // will give 714.
  41211. roundUp = rm < 4
  41212. ? (rd || isTruncated) && (rm == 0 || rm == (x.s < 0 ? 3 : 2))
  41213. : rd > 5 || rd == 5 && (rm == 4 || isTruncated || rm == 6 &&
  41214. // Check whether the digit to the left of the rounding digit is odd.
  41215. ((i > 0 ? j > 0 ? w / mathpow(10, digits - j) : 0 : xd[xdi - 1]) % 10) & 1 ||
  41216. rm == (x.s < 0 ? 8 : 7));
  41217. if (sd < 1 || !xd[0]) {
  41218. xd.length = 0;
  41219. if (roundUp) {
  41220. // Convert sd to decimal places.
  41221. sd -= x.e + 1;
  41222. // 1, 0.1, 0.01, 0.001, 0.0001 etc.
  41223. xd[0] = mathpow(10, (LOG_BASE - sd % LOG_BASE) % LOG_BASE);
  41224. x.e = -sd || 0;
  41225. } else {
  41226. // Zero.
  41227. xd[0] = x.e = 0;
  41228. }
  41229. return x;
  41230. }
  41231. // Remove excess digits.
  41232. if (i == 0) {
  41233. xd.length = xdi;
  41234. k = 1;
  41235. xdi--;
  41236. } else {
  41237. xd.length = xdi + 1;
  41238. k = mathpow(10, LOG_BASE - i);
  41239. // E.g. 56700 becomes 56000 if 7 is the rounding digit.
  41240. // j > 0 means i > number of leading zeros of w.
  41241. xd[xdi] = j > 0 ? (w / mathpow(10, digits - j) % mathpow(10, j) | 0) * k : 0;
  41242. }
  41243. if (roundUp) {
  41244. for (;;) {
  41245. // Is the digit to be rounded up in the first word of xd?
  41246. if (xdi == 0) {
  41247. // i will be the length of xd[0] before k is added.
  41248. for (i = 1, j = xd[0]; j >= 10; j /= 10) i++;
  41249. j = xd[0] += k;
  41250. for (k = 1; j >= 10; j /= 10) k++;
  41251. // if i != k the length has increased.
  41252. if (i != k) {
  41253. x.e++;
  41254. if (xd[0] == BASE) xd[0] = 1;
  41255. }
  41256. break;
  41257. } else {
  41258. xd[xdi] += k;
  41259. if (xd[xdi] != BASE) break;
  41260. xd[xdi--] = 0;
  41261. k = 1;
  41262. }
  41263. }
  41264. }
  41265. // Remove trailing zeros.
  41266. for (i = xd.length; xd[--i] === 0;) xd.pop();
  41267. }
  41268. if (external) {
  41269. // Overflow?
  41270. if (x.e > Ctor.maxE) {
  41271. // Infinity.
  41272. x.d = null;
  41273. x.e = NaN;
  41274. // Underflow?
  41275. } else if (x.e < Ctor.minE) {
  41276. // Zero.
  41277. x.e = 0;
  41278. x.d = [0];
  41279. // Ctor.underflow = true;
  41280. } // else Ctor.underflow = false;
  41281. }
  41282. return x;
  41283. }
  41284. function finiteToString(x, isExp, sd) {
  41285. if (!x.isFinite()) return nonFiniteToString(x);
  41286. var k,
  41287. e = x.e,
  41288. str = digitsToString(x.d),
  41289. len = str.length;
  41290. if (isExp) {
  41291. if (sd && (k = sd - len) > 0) {
  41292. str = str.charAt(0) + '.' + str.slice(1) + getZeroString(k);
  41293. } else if (len > 1) {
  41294. str = str.charAt(0) + '.' + str.slice(1);
  41295. }
  41296. str = str + (x.e < 0 ? 'e' : 'e+') + x.e;
  41297. } else if (e < 0) {
  41298. str = '0.' + getZeroString(-e - 1) + str;
  41299. if (sd && (k = sd - len) > 0) str += getZeroString(k);
  41300. } else if (e >= len) {
  41301. str += getZeroString(e + 1 - len);
  41302. if (sd && (k = sd - e - 1) > 0) str = str + '.' + getZeroString(k);
  41303. } else {
  41304. if ((k = e + 1) < len) str = str.slice(0, k) + '.' + str.slice(k);
  41305. if (sd && (k = sd - len) > 0) {
  41306. if (e + 1 === len) str += '.';
  41307. str += getZeroString(k);
  41308. }
  41309. }
  41310. return str;
  41311. }
  41312. // Calculate the base 10 exponent from the base 1e7 exponent.
  41313. function getBase10Exponent(digits, e) {
  41314. var w = digits[0];
  41315. // Add the number of digits of the first word of the digits array.
  41316. for ( e *= LOG_BASE; w >= 10; w /= 10) e++;
  41317. return e;
  41318. }
  41319. function getLn10(Ctor, sd, pr) {
  41320. if (sd > LN10_PRECISION) {
  41321. // Reset global state in case the exception is caught.
  41322. external = true;
  41323. if (pr) Ctor.precision = pr;
  41324. throw Error(precisionLimitExceeded);
  41325. }
  41326. return finalise(new Ctor(LN10), sd, 1, true);
  41327. }
  41328. function getPi(Ctor, sd, rm) {
  41329. if (sd > PI_PRECISION) throw Error(precisionLimitExceeded);
  41330. return finalise(new Ctor(PI), sd, rm, true);
  41331. }
  41332. function getPrecision(digits) {
  41333. var w = digits.length - 1,
  41334. len = w * LOG_BASE + 1;
  41335. w = digits[w];
  41336. // If non-zero...
  41337. if (w) {
  41338. // Subtract the number of trailing zeros of the last word.
  41339. for (; w % 10 == 0; w /= 10) len--;
  41340. // Add the number of digits of the first word.
  41341. for (w = digits[0]; w >= 10; w /= 10) len++;
  41342. }
  41343. return len;
  41344. }
  41345. function getZeroString(k) {
  41346. var zs = '';
  41347. for (; k--;) zs += '0';
  41348. return zs;
  41349. }
  41350. /*
  41351. * Return a new Decimal whose value is the value of Decimal `x` to the power `n`, where `n` is an
  41352. * integer of type number.
  41353. *
  41354. * Implements 'exponentiation by squaring'. Called by `pow` and `parseOther`.
  41355. *
  41356. */
  41357. function intPow(Ctor, x, n, pr) {
  41358. var isTruncated,
  41359. r = new Ctor(1),
  41360. // Max n of 9007199254740991 takes 53 loop iterations.
  41361. // Maximum digits array length; leaves [28, 34] guard digits.
  41362. k = Math.ceil(pr / LOG_BASE + 4);
  41363. external = false;
  41364. for (;;) {
  41365. if (n % 2) {
  41366. r = r.times(x);
  41367. if (truncate(r.d, k)) isTruncated = true;
  41368. }
  41369. n = mathfloor(n / 2);
  41370. if (n === 0) {
  41371. // To ensure correct rounding when r.d is truncated, increment the last word if it is zero.
  41372. n = r.d.length - 1;
  41373. if (isTruncated && r.d[n] === 0) ++r.d[n];
  41374. break;
  41375. }
  41376. x = x.times(x);
  41377. truncate(x.d, k);
  41378. }
  41379. external = true;
  41380. return r;
  41381. }
  41382. function isOdd(n) {
  41383. return n.d[n.d.length - 1] & 1;
  41384. }
  41385. /*
  41386. * Handle `max` and `min`. `ltgt` is 'lt' or 'gt'.
  41387. */
  41388. function maxOrMin(Ctor, args, ltgt) {
  41389. var y,
  41390. x = new Ctor(args[0]),
  41391. i = 0;
  41392. for (; ++i < args.length;) {
  41393. y = new Ctor(args[i]);
  41394. if (!y.s) {
  41395. x = y;
  41396. break;
  41397. } else if (x[ltgt](y)) {
  41398. x = y;
  41399. }
  41400. }
  41401. return x;
  41402. }
  41403. /*
  41404. * Return a new Decimal whose value is the natural exponential of `x` rounded to `sd` significant
  41405. * digits.
  41406. *
  41407. * Taylor/Maclaurin series.
  41408. *
  41409. * exp(x) = x^0/0! + x^1/1! + x^2/2! + x^3/3! + ...
  41410. *
  41411. * Argument reduction:
  41412. * Repeat x = x / 32, k += 5, until |x| < 0.1
  41413. * exp(x) = exp(x / 2^k)^(2^k)
  41414. *
  41415. * Previously, the argument was initially reduced by
  41416. * exp(x) = exp(r) * 10^k where r = x - k * ln10, k = floor(x / ln10)
  41417. * to first put r in the range [0, ln10], before dividing by 32 until |x| < 0.1, but this was
  41418. * found to be slower than just dividing repeatedly by 32 as above.
  41419. *
  41420. * Max integer argument: exp('20723265836946413') = 6.3e+9000000000000000
  41421. * Min integer argument: exp('-20723265836946411') = 1.2e-9000000000000000
  41422. * (Math object integer min/max: Math.exp(709) = 8.2e+307, Math.exp(-745) = 5e-324)
  41423. *
  41424. * exp(Infinity) = Infinity
  41425. * exp(-Infinity) = 0
  41426. * exp(NaN) = NaN
  41427. * exp(±0) = 1
  41428. *
  41429. * exp(x) is non-terminating for any finite, non-zero x.
  41430. *
  41431. * The result will always be correctly rounded.
  41432. *
  41433. */
  41434. function naturalExponential(x, sd) {
  41435. var denominator, guard, j, pow, sum, t, wpr,
  41436. rep = 0,
  41437. i = 0,
  41438. k = 0,
  41439. Ctor = x.constructor,
  41440. rm = Ctor.rounding,
  41441. pr = Ctor.precision;
  41442. // 0/NaN/Infinity?
  41443. if (!x.d || !x.d[0] || x.e > 17) {
  41444. return new Ctor(x.d
  41445. ? !x.d[0] ? 1 : x.s < 0 ? 0 : 1 / 0
  41446. : x.s ? x.s < 0 ? 0 : x : 0 / 0);
  41447. }
  41448. if (sd == null) {
  41449. external = false;
  41450. wpr = pr;
  41451. } else {
  41452. wpr = sd;
  41453. }
  41454. t = new Ctor(0.03125);
  41455. // while abs(x) >= 0.1
  41456. while (x.e > -2) {
  41457. // x = x / 2^5
  41458. x = x.times(t);
  41459. k += 5;
  41460. }
  41461. // Use 2 * log10(2^k) + 5 (empirically derived) to estimate the increase in precision
  41462. // necessary to ensure the first 4 rounding digits are correct.
  41463. guard = Math.log(mathpow(2, k)) / Math.LN10 * 2 + 5 | 0;
  41464. wpr += guard;
  41465. denominator = pow = sum = new Ctor(1);
  41466. Ctor.precision = wpr;
  41467. for (;;) {
  41468. pow = finalise(pow.times(x), wpr, 1);
  41469. denominator = denominator.times(++i);
  41470. t = sum.plus(divide(pow, denominator, wpr, 1));
  41471. if (digitsToString(t.d).slice(0, wpr) === digitsToString(sum.d).slice(0, wpr)) {
  41472. j = k;
  41473. while (j--) sum = finalise(sum.times(sum), wpr, 1);
  41474. // Check to see if the first 4 rounding digits are [49]999.
  41475. // If so, repeat the summation with a higher precision, otherwise
  41476. // e.g. with precision: 18, rounding: 1
  41477. // exp(18.404272462595034083567793919843761) = 98372560.1229999999 (should be 98372560.123)
  41478. // `wpr - guard` is the index of first rounding digit.
  41479. if (sd == null) {
  41480. if (rep < 3 && checkRoundingDigits(sum.d, wpr - guard, rm, rep)) {
  41481. Ctor.precision = wpr += 10;
  41482. denominator = pow = t = new Ctor(1);
  41483. i = 0;
  41484. rep++;
  41485. } else {
  41486. return finalise(sum, Ctor.precision = pr, rm, external = true);
  41487. }
  41488. } else {
  41489. Ctor.precision = pr;
  41490. return sum;
  41491. }
  41492. }
  41493. sum = t;
  41494. }
  41495. }
  41496. /*
  41497. * Return a new Decimal whose value is the natural logarithm of `x` rounded to `sd` significant
  41498. * digits.
  41499. *
  41500. * ln(-n) = NaN
  41501. * ln(0) = -Infinity
  41502. * ln(-0) = -Infinity
  41503. * ln(1) = 0
  41504. * ln(Infinity) = Infinity
  41505. * ln(-Infinity) = NaN
  41506. * ln(NaN) = NaN
  41507. *
  41508. * ln(n) (n != 1) is non-terminating.
  41509. *
  41510. */
  41511. function naturalLogarithm(y, sd) {
  41512. var c, c0, denominator, e, numerator, rep, sum, t, wpr, x1, x2,
  41513. n = 1,
  41514. guard = 10,
  41515. x = y,
  41516. xd = x.d,
  41517. Ctor = x.constructor,
  41518. rm = Ctor.rounding,
  41519. pr = Ctor.precision;
  41520. // Is x negative or Infinity, NaN, 0 or 1?
  41521. if (x.s < 0 || !xd || !xd[0] || !x.e && xd[0] == 1 && xd.length == 1) {
  41522. return new Ctor(xd && !xd[0] ? -1 / 0 : x.s != 1 ? NaN : xd ? 0 : x);
  41523. }
  41524. if (sd == null) {
  41525. external = false;
  41526. wpr = pr;
  41527. } else {
  41528. wpr = sd;
  41529. }
  41530. Ctor.precision = wpr += guard;
  41531. c = digitsToString(xd);
  41532. c0 = c.charAt(0);
  41533. if (Math.abs(e = x.e) < 1.5e15) {
  41534. // Argument reduction.
  41535. // The series converges faster the closer the argument is to 1, so using
  41536. // ln(a^b) = b * ln(a), ln(a) = ln(a^b) / b
  41537. // multiply the argument by itself until the leading digits of the significand are 7, 8, 9,
  41538. // 10, 11, 12 or 13, recording the number of multiplications so the sum of the series can
  41539. // later be divided by this number, then separate out the power of 10 using
  41540. // ln(a*10^b) = ln(a) + b*ln(10).
  41541. // max n is 21 (gives 0.9, 1.0 or 1.1) (9e15 / 21 = 4.2e14).
  41542. //while (c0 < 9 && c0 != 1 || c0 == 1 && c.charAt(1) > 1) {
  41543. // max n is 6 (gives 0.7 - 1.3)
  41544. while (c0 < 7 && c0 != 1 || c0 == 1 && c.charAt(1) > 3) {
  41545. x = x.times(y);
  41546. c = digitsToString(x.d);
  41547. c0 = c.charAt(0);
  41548. n++;
  41549. }
  41550. e = x.e;
  41551. if (c0 > 1) {
  41552. x = new Ctor('0.' + c);
  41553. e++;
  41554. } else {
  41555. x = new Ctor(c0 + '.' + c.slice(1));
  41556. }
  41557. } else {
  41558. // The argument reduction method above may result in overflow if the argument y is a massive
  41559. // number with exponent >= 1500000000000000 (9e15 / 6 = 1.5e15), so instead recall this
  41560. // function using ln(x*10^e) = ln(x) + e*ln(10).
  41561. t = getLn10(Ctor, wpr + 2, pr).times(e + '');
  41562. x = naturalLogarithm(new Ctor(c0 + '.' + c.slice(1)), wpr - guard).plus(t);
  41563. Ctor.precision = pr;
  41564. return sd == null ? finalise(x, pr, rm, external = true) : x;
  41565. }
  41566. // x1 is x reduced to a value near 1.
  41567. x1 = x;
  41568. // Taylor series.
  41569. // ln(y) = ln((1 + x)/(1 - x)) = 2(x + x^3/3 + x^5/5 + x^7/7 + ...)
  41570. // where x = (y - 1)/(y + 1) (|x| < 1)
  41571. sum = numerator = x = divide(x.minus(1), x.plus(1), wpr, 1);
  41572. x2 = finalise(x.times(x), wpr, 1);
  41573. denominator = 3;
  41574. for (;;) {
  41575. numerator = finalise(numerator.times(x2), wpr, 1);
  41576. t = sum.plus(divide(numerator, new Ctor(denominator), wpr, 1));
  41577. if (digitsToString(t.d).slice(0, wpr) === digitsToString(sum.d).slice(0, wpr)) {
  41578. sum = sum.times(2);
  41579. // Reverse the argument reduction. Check that e is not 0 because, besides preventing an
  41580. // unnecessary calculation, -0 + 0 = +0 and to ensure correct rounding -0 needs to stay -0.
  41581. if (e !== 0) sum = sum.plus(getLn10(Ctor, wpr + 2, pr).times(e + ''));
  41582. sum = divide(sum, new Ctor(n), wpr, 1);
  41583. // Is rm > 3 and the first 4 rounding digits 4999, or rm < 4 (or the summation has
  41584. // been repeated previously) and the first 4 rounding digits 9999?
  41585. // If so, restart the summation with a higher precision, otherwise
  41586. // e.g. with precision: 12, rounding: 1
  41587. // ln(135520028.6126091714265381533) = 18.7246299999 when it should be 18.72463.
  41588. // `wpr - guard` is the index of first rounding digit.
  41589. if (sd == null) {
  41590. if (checkRoundingDigits(sum.d, wpr - guard, rm, rep)) {
  41591. Ctor.precision = wpr += guard;
  41592. t = numerator = x = divide(x1.minus(1), x1.plus(1), wpr, 1);
  41593. x2 = finalise(x.times(x), wpr, 1);
  41594. denominator = rep = 1;
  41595. } else {
  41596. return finalise(sum, Ctor.precision = pr, rm, external = true);
  41597. }
  41598. } else {
  41599. Ctor.precision = pr;
  41600. return sum;
  41601. }
  41602. }
  41603. sum = t;
  41604. denominator += 2;
  41605. }
  41606. }
  41607. // ±Infinity, NaN.
  41608. function nonFiniteToString(x) {
  41609. // Unsigned.
  41610. return String(x.s * x.s / 0);
  41611. }
  41612. /*
  41613. * Parse the value of a new Decimal `x` from string `str`.
  41614. */
  41615. function parseDecimal(x, str) {
  41616. var e, i, len;
  41617. // Decimal point?
  41618. if ((e = str.indexOf('.')) > -1) str = str.replace('.', '');
  41619. // Exponential form?
  41620. if ((i = str.search(/e/i)) > 0) {
  41621. // Determine exponent.
  41622. if (e < 0) e = i;
  41623. e += +str.slice(i + 1);
  41624. str = str.substring(0, i);
  41625. } else if (e < 0) {
  41626. // Integer.
  41627. e = str.length;
  41628. }
  41629. // Determine leading zeros.
  41630. for (i = 0; str.charCodeAt(i) === 48; i++);
  41631. // Determine trailing zeros.
  41632. for (len = str.length; str.charCodeAt(len - 1) === 48; --len);
  41633. str = str.slice(i, len);
  41634. if (str) {
  41635. len -= i;
  41636. x.e = e = e - i - 1;
  41637. x.d = [];
  41638. // Transform base
  41639. // e is the base 10 exponent.
  41640. // i is where to slice str to get the first word of the digits array.
  41641. i = (e + 1) % LOG_BASE;
  41642. if (e < 0) i += LOG_BASE;
  41643. if (i < len) {
  41644. if (i) x.d.push(+str.slice(0, i));
  41645. for (len -= LOG_BASE; i < len;) x.d.push(+str.slice(i, i += LOG_BASE));
  41646. str = str.slice(i);
  41647. i = LOG_BASE - str.length;
  41648. } else {
  41649. i -= len;
  41650. }
  41651. for (; i--;) str += '0';
  41652. x.d.push(+str);
  41653. if (external) {
  41654. // Overflow?
  41655. if (x.e > x.constructor.maxE) {
  41656. // Infinity.
  41657. x.d = null;
  41658. x.e = NaN;
  41659. // Underflow?
  41660. } else if (x.e < x.constructor.minE) {
  41661. // Zero.
  41662. x.e = 0;
  41663. x.d = [0];
  41664. // x.constructor.underflow = true;
  41665. } // else x.constructor.underflow = false;
  41666. }
  41667. } else {
  41668. // Zero.
  41669. x.e = 0;
  41670. x.d = [0];
  41671. }
  41672. return x;
  41673. }
  41674. /*
  41675. * Parse the value of a new Decimal `x` from a string `str`, which is not a decimal value.
  41676. */
  41677. function parseOther(x, str) {
  41678. var base, Ctor, divisor, i, isFloat, len, p, xd, xe;
  41679. if (str === 'Infinity' || str === 'NaN') {
  41680. if (!+str) x.s = NaN;
  41681. x.e = NaN;
  41682. x.d = null;
  41683. return x;
  41684. }
  41685. if (isHex.test(str)) {
  41686. base = 16;
  41687. str = str.toLowerCase();
  41688. } else if (isBinary.test(str)) {
  41689. base = 2;
  41690. } else if (isOctal.test(str)) {
  41691. base = 8;
  41692. } else {
  41693. throw Error(invalidArgument + str);
  41694. }
  41695. // Is there a binary exponent part?
  41696. i = str.search(/p/i);
  41697. if (i > 0) {
  41698. p = +str.slice(i + 1);
  41699. str = str.substring(2, i);
  41700. } else {
  41701. str = str.slice(2);
  41702. }
  41703. // Convert `str` as an integer then divide the result by `base` raised to a power such that the
  41704. // fraction part will be restored.
  41705. i = str.indexOf('.');
  41706. isFloat = i >= 0;
  41707. Ctor = x.constructor;
  41708. if (isFloat) {
  41709. str = str.replace('.', '');
  41710. len = str.length;
  41711. i = len - i;
  41712. // log[10](16) = 1.2041... , log[10](88) = 1.9444....
  41713. divisor = intPow(Ctor, new Ctor(base), i, i * 2);
  41714. }
  41715. xd = convertBase(str, base, BASE);
  41716. xe = xd.length - 1;
  41717. // Remove trailing zeros.
  41718. for (i = xe; xd[i] === 0; --i) xd.pop();
  41719. if (i < 0) return new Ctor(x.s * 0);
  41720. x.e = getBase10Exponent(xd, xe);
  41721. x.d = xd;
  41722. external = false;
  41723. // At what precision to perform the division to ensure exact conversion?
  41724. // maxDecimalIntegerPartDigitCount = ceil(log[10](b) * otherBaseIntegerPartDigitCount)
  41725. // log[10](2) = 0.30103, log[10](8) = 0.90309, log[10](16) = 1.20412
  41726. // E.g. ceil(1.2 * 3) = 4, so up to 4 decimal digits are needed to represent 3 hex int digits.
  41727. // maxDecimalFractionPartDigitCount = {Hex:4|Oct:3|Bin:1} * otherBaseFractionPartDigitCount
  41728. // Therefore using 4 * the number of digits of str will always be enough.
  41729. if (isFloat) x = divide(x, divisor, len * 4);
  41730. // Multiply by the binary exponent part if present.
  41731. if (p) x = x.times(Math.abs(p) < 54 ? Math.pow(2, p) : Decimal.pow(2, p));
  41732. external = true;
  41733. return x;
  41734. }
  41735. /*
  41736. * sin(x) = x - x^3/3! + x^5/5! - ...
  41737. * |x| < pi/2
  41738. *
  41739. */
  41740. function sine(Ctor, x) {
  41741. var k,
  41742. len = x.d.length;
  41743. if (len < 3) return taylorSeries(Ctor, 2, x, x);
  41744. // Argument reduction: sin(5x) = 16*sin^5(x) - 20*sin^3(x) + 5*sin(x)
  41745. // i.e. sin(x) = 16*sin^5(x/5) - 20*sin^3(x/5) + 5*sin(x/5)
  41746. // and sin(x) = sin(x/5)(5 + sin^2(x/5)(16sin^2(x/5) - 20))
  41747. // Estimate the optimum number of times to use the argument reduction.
  41748. k = 1.4 * Math.sqrt(len);
  41749. k = k > 16 ? 16 : k | 0;
  41750. // Max k before Math.pow precision loss is 22
  41751. x = x.times(Math.pow(5, -k));
  41752. x = taylorSeries(Ctor, 2, x, x);
  41753. // Reverse argument reduction
  41754. var sin2_x,
  41755. d5 = new Ctor(5),
  41756. d16 = new Ctor(16),
  41757. d20 = new Ctor(20);
  41758. for (; k--;) {
  41759. sin2_x = x.times(x);
  41760. x = x.times(d5.plus(sin2_x.times(d16.times(sin2_x).minus(d20))));
  41761. }
  41762. return x;
  41763. }
  41764. // Calculate Taylor series for `cos`, `cosh`, `sin` and `sinh`.
  41765. function taylorSeries(Ctor, n, x, y, isHyperbolic) {
  41766. var j, t, u, x2,
  41767. i = 1,
  41768. pr = Ctor.precision,
  41769. k = Math.ceil(pr / LOG_BASE);
  41770. external = false;
  41771. x2 = x.times(x);
  41772. u = new Ctor(y);
  41773. for (;;) {
  41774. t = divide(u.times(x2), new Ctor(n++ * n++), pr, 1);
  41775. u = isHyperbolic ? y.plus(t) : y.minus(t);
  41776. y = divide(t.times(x2), new Ctor(n++ * n++), pr, 1);
  41777. t = u.plus(y);
  41778. if (t.d[k] !== void 0) {
  41779. for (j = k; t.d[j] === u.d[j] && j--;);
  41780. if (j == -1) break;
  41781. }
  41782. j = u;
  41783. u = y;
  41784. y = t;
  41785. t = j;
  41786. i++;
  41787. }
  41788. external = true;
  41789. t.d.length = k + 1;
  41790. return t;
  41791. }
  41792. // Return the absolute value of `x` reduced to less than or equal to half pi.
  41793. function toLessThanHalfPi(Ctor, x) {
  41794. var t,
  41795. isNeg = x.s < 0,
  41796. pi = getPi(Ctor, Ctor.precision, 1),
  41797. halfPi = pi.times(0.5);
  41798. x = x.abs();
  41799. if (x.lte(halfPi)) {
  41800. quadrant = isNeg ? 4 : 1;
  41801. return x;
  41802. }
  41803. t = x.divToInt(pi);
  41804. if (t.isZero()) {
  41805. quadrant = isNeg ? 3 : 2;
  41806. } else {
  41807. x = x.minus(t.times(pi));
  41808. // 0 <= x < pi
  41809. if (x.lte(halfPi)) {
  41810. quadrant = isOdd(t) ? (isNeg ? 2 : 3) : (isNeg ? 4 : 1);
  41811. return x;
  41812. }
  41813. quadrant = isOdd(t) ? (isNeg ? 1 : 4) : (isNeg ? 3 : 2);
  41814. }
  41815. return x.minus(pi).abs();
  41816. }
  41817. /*
  41818. * Return the value of Decimal `x` as a string in base `baseOut`.
  41819. *
  41820. * If the optional `sd` argument is present include a binary exponent suffix.
  41821. */
  41822. function toStringBinary(x, baseOut, sd, rm) {
  41823. var base, e, i, k, len, roundUp, str, xd, y,
  41824. Ctor = x.constructor,
  41825. isExp = sd !== void 0;
  41826. if (isExp) {
  41827. checkInt32(sd, 1, MAX_DIGITS);
  41828. if (rm === void 0) rm = Ctor.rounding;
  41829. else checkInt32(rm, 0, 8);
  41830. } else {
  41831. sd = Ctor.precision;
  41832. rm = Ctor.rounding;
  41833. }
  41834. if (!x.isFinite()) {
  41835. str = nonFiniteToString(x);
  41836. } else {
  41837. str = finiteToString(x);
  41838. i = str.indexOf('.');
  41839. // Use exponential notation according to `toExpPos` and `toExpNeg`? No, but if required:
  41840. // maxBinaryExponent = floor((decimalExponent + 1) * log[2](10))
  41841. // minBinaryExponent = floor(decimalExponent * log[2](10))
  41842. // log[2](10) = 3.321928094887362347870319429489390175864
  41843. if (isExp) {
  41844. base = 2;
  41845. if (baseOut == 16) {
  41846. sd = sd * 4 - 3;
  41847. } else if (baseOut == 8) {
  41848. sd = sd * 3 - 2;
  41849. }
  41850. } else {
  41851. base = baseOut;
  41852. }
  41853. // Convert the number as an integer then divide the result by its base raised to a power such
  41854. // that the fraction part will be restored.
  41855. // Non-integer.
  41856. if (i >= 0) {
  41857. str = str.replace('.', '');
  41858. y = new Ctor(1);
  41859. y.e = str.length - i;
  41860. y.d = convertBase(finiteToString(y), 10, base);
  41861. y.e = y.d.length;
  41862. }
  41863. xd = convertBase(str, 10, base);
  41864. e = len = xd.length;
  41865. // Remove trailing zeros.
  41866. for (; xd[--len] == 0;) xd.pop();
  41867. if (!xd[0]) {
  41868. str = isExp ? '0p+0' : '0';
  41869. } else {
  41870. if (i < 0) {
  41871. e--;
  41872. } else {
  41873. x = new Ctor(x);
  41874. x.d = xd;
  41875. x.e = e;
  41876. x = divide(x, y, sd, rm, 0, base);
  41877. xd = x.d;
  41878. e = x.e;
  41879. roundUp = inexact;
  41880. }
  41881. // The rounding digit, i.e. the digit after the digit that may be rounded up.
  41882. i = xd[sd];
  41883. k = base / 2;
  41884. roundUp = roundUp || xd[sd + 1] !== void 0;
  41885. roundUp = rm < 4
  41886. ? (i !== void 0 || roundUp) && (rm === 0 || rm === (x.s < 0 ? 3 : 2))
  41887. : i > k || i === k && (rm === 4 || roundUp || rm === 6 && xd[sd - 1] & 1 ||
  41888. rm === (x.s < 0 ? 8 : 7));
  41889. xd.length = sd;
  41890. if (roundUp) {
  41891. // Rounding up may mean the previous digit has to be rounded up and so on.
  41892. for (; ++xd[--sd] > base - 1;) {
  41893. xd[sd] = 0;
  41894. if (!sd) {
  41895. ++e;
  41896. xd.unshift(1);
  41897. }
  41898. }
  41899. }
  41900. // Determine trailing zeros.
  41901. for (len = xd.length; !xd[len - 1]; --len);
  41902. // E.g. [4, 11, 15] becomes 4bf.
  41903. for (i = 0, str = ''; i < len; i++) str += NUMERALS.charAt(xd[i]);
  41904. // Add binary exponent suffix?
  41905. if (isExp) {
  41906. if (len > 1) {
  41907. if (baseOut == 16 || baseOut == 8) {
  41908. i = baseOut == 16 ? 4 : 3;
  41909. for (--len; len % i; len++) str += '0';
  41910. xd = convertBase(str, base, baseOut);
  41911. for (len = xd.length; !xd[len - 1]; --len);
  41912. // xd[0] will always be be 1
  41913. for (i = 1, str = '1.'; i < len; i++) str += NUMERALS.charAt(xd[i]);
  41914. } else {
  41915. str = str.charAt(0) + '.' + str.slice(1);
  41916. }
  41917. }
  41918. str = str + (e < 0 ? 'p' : 'p+') + e;
  41919. } else if (e < 0) {
  41920. for (; ++e;) str = '0' + str;
  41921. str = '0.' + str;
  41922. } else {
  41923. if (++e > len) for (e -= len; e-- ;) str += '0';
  41924. else if (e < len) str = str.slice(0, e) + '.' + str.slice(e);
  41925. }
  41926. }
  41927. str = (baseOut == 16 ? '0x' : baseOut == 2 ? '0b' : baseOut == 8 ? '0o' : '') + str;
  41928. }
  41929. return x.s < 0 ? '-' + str : str;
  41930. }
  41931. // Does not strip trailing zeros.
  41932. function truncate(arr, len) {
  41933. if (arr.length > len) {
  41934. arr.length = len;
  41935. return true;
  41936. }
  41937. }
  41938. // Decimal methods
  41939. /*
  41940. * abs
  41941. * acos
  41942. * acosh
  41943. * add
  41944. * asin
  41945. * asinh
  41946. * atan
  41947. * atanh
  41948. * atan2
  41949. * cbrt
  41950. * ceil
  41951. * clone
  41952. * config
  41953. * cos
  41954. * cosh
  41955. * div
  41956. * exp
  41957. * floor
  41958. * hypot
  41959. * ln
  41960. * log
  41961. * log2
  41962. * log10
  41963. * max
  41964. * min
  41965. * mod
  41966. * mul
  41967. * pow
  41968. * random
  41969. * round
  41970. * set
  41971. * sign
  41972. * sin
  41973. * sinh
  41974. * sqrt
  41975. * sub
  41976. * tan
  41977. * tanh
  41978. * trunc
  41979. */
  41980. /*
  41981. * Return a new Decimal whose value is the absolute value of `x`.
  41982. *
  41983. * x {number|string|Decimal}
  41984. *
  41985. */
  41986. function abs(x) {
  41987. return new this(x).abs();
  41988. }
  41989. /*
  41990. * Return a new Decimal whose value is the arccosine in radians of `x`.
  41991. *
  41992. * x {number|string|Decimal}
  41993. *
  41994. */
  41995. function acos(x) {
  41996. return new this(x).acos();
  41997. }
  41998. /*
  41999. * Return a new Decimal whose value is the inverse of the hyperbolic cosine of `x`, rounded to
  42000. * `precision` significant digits using rounding mode `rounding`.
  42001. *
  42002. * x {number|string|Decimal} A value in radians.
  42003. *
  42004. */
  42005. function acosh(x) {
  42006. return new this(x).acosh();
  42007. }
  42008. /*
  42009. * Return a new Decimal whose value is the sum of `x` and `y`, rounded to `precision` significant
  42010. * digits using rounding mode `rounding`.
  42011. *
  42012. * x {number|string|Decimal}
  42013. * y {number|string|Decimal}
  42014. *
  42015. */
  42016. function add(x, y) {
  42017. return new this(x).plus(y);
  42018. }
  42019. /*
  42020. * Return a new Decimal whose value is the arcsine in radians of `x`, rounded to `precision`
  42021. * significant digits using rounding mode `rounding`.
  42022. *
  42023. * x {number|string|Decimal}
  42024. *
  42025. */
  42026. function asin(x) {
  42027. return new this(x).asin();
  42028. }
  42029. /*
  42030. * Return a new Decimal whose value is the inverse of the hyperbolic sine of `x`, rounded to
  42031. * `precision` significant digits using rounding mode `rounding`.
  42032. *
  42033. * x {number|string|Decimal} A value in radians.
  42034. *
  42035. */
  42036. function asinh(x) {
  42037. return new this(x).asinh();
  42038. }
  42039. /*
  42040. * Return a new Decimal whose value is the arctangent in radians of `x`, rounded to `precision`
  42041. * significant digits using rounding mode `rounding`.
  42042. *
  42043. * x {number|string|Decimal}
  42044. *
  42045. */
  42046. function atan(x) {
  42047. return new this(x).atan();
  42048. }
  42049. /*
  42050. * Return a new Decimal whose value is the inverse of the hyperbolic tangent of `x`, rounded to
  42051. * `precision` significant digits using rounding mode `rounding`.
  42052. *
  42053. * x {number|string|Decimal} A value in radians.
  42054. *
  42055. */
  42056. function atanh(x) {
  42057. return new this(x).atanh();
  42058. }
  42059. /*
  42060. * Return a new Decimal whose value is the arctangent in radians of `y/x` in the range -pi to pi
  42061. * (inclusive), rounded to `precision` significant digits using rounding mode `rounding`.
  42062. *
  42063. * Domain: [-Infinity, Infinity]
  42064. * Range: [-pi, pi]
  42065. *
  42066. * y {number|string|Decimal} The y-coordinate.
  42067. * x {number|string|Decimal} The x-coordinate.
  42068. *
  42069. * atan2(±0, -0) = ±pi
  42070. * atan2(±0, +0) = ±0
  42071. * atan2(±0, -x) = ±pi for x > 0
  42072. * atan2(±0, x) = ±0 for x > 0
  42073. * atan2(-y, ±0) = -pi/2 for y > 0
  42074. * atan2(y, ±0) = pi/2 for y > 0
  42075. * atan2(±y, -Infinity) = ±pi for finite y > 0
  42076. * atan2(±y, +Infinity) = ±0 for finite y > 0
  42077. * atan2(±Infinity, x) = ±pi/2 for finite x
  42078. * atan2(±Infinity, -Infinity) = ±3*pi/4
  42079. * atan2(±Infinity, +Infinity) = ±pi/4
  42080. * atan2(NaN, x) = NaN
  42081. * atan2(y, NaN) = NaN
  42082. *
  42083. */
  42084. function atan2(y, x) {
  42085. y = new this(y);
  42086. x = new this(x);
  42087. var r,
  42088. pr = this.precision,
  42089. rm = this.rounding,
  42090. wpr = pr + 4;
  42091. // Either NaN
  42092. if (!y.s || !x.s) {
  42093. r = new this(NaN);
  42094. // Both ±Infinity
  42095. } else if (!y.d && !x.d) {
  42096. r = getPi(this, wpr, 1).times(x.s > 0 ? 0.25 : 0.75);
  42097. r.s = y.s;
  42098. // x is ±Infinity or y is ±0
  42099. } else if (!x.d || y.isZero()) {
  42100. r = x.s < 0 ? getPi(this, pr, rm) : new this(0);
  42101. r.s = y.s;
  42102. // y is ±Infinity or x is ±0
  42103. } else if (!y.d || x.isZero()) {
  42104. r = getPi(this, wpr, 1).times(0.5);
  42105. r.s = y.s;
  42106. // Both non-zero and finite
  42107. } else if (x.s < 0) {
  42108. this.precision = wpr;
  42109. this.rounding = 1;
  42110. r = this.atan(divide(y, x, wpr, 1));
  42111. x = getPi(this, wpr, 1);
  42112. this.precision = pr;
  42113. this.rounding = rm;
  42114. r = y.s < 0 ? r.minus(x) : r.plus(x);
  42115. } else {
  42116. r = this.atan(divide(y, x, wpr, 1));
  42117. }
  42118. return r;
  42119. }
  42120. /*
  42121. * Return a new Decimal whose value is the cube root of `x`, rounded to `precision` significant
  42122. * digits using rounding mode `rounding`.
  42123. *
  42124. * x {number|string|Decimal}
  42125. *
  42126. */
  42127. function cbrt(x) {
  42128. return new this(x).cbrt();
  42129. }
  42130. /*
  42131. * Return a new Decimal whose value is `x` rounded to an integer using `ROUND_CEIL`.
  42132. *
  42133. * x {number|string|Decimal}
  42134. *
  42135. */
  42136. function ceil(x) {
  42137. return finalise(x = new this(x), x.e + 1, 2);
  42138. }
  42139. /*
  42140. * Configure global settings for a Decimal constructor.
  42141. *
  42142. * `obj` is an object with one or more of the following properties,
  42143. *
  42144. * precision {number}
  42145. * rounding {number}
  42146. * toExpNeg {number}
  42147. * toExpPos {number}
  42148. * maxE {number}
  42149. * minE {number}
  42150. * modulo {number}
  42151. * crypto {boolean|number}
  42152. * defaults {true}
  42153. *
  42154. * E.g. Decimal.config({ precision: 20, rounding: 4 })
  42155. *
  42156. */
  42157. function config(obj) {
  42158. if (!obj || typeof obj !== 'object') throw Error(decimalError + 'Object expected');
  42159. var i, p, v,
  42160. useDefaults = obj.defaults === true,
  42161. ps = [
  42162. 'precision', 1, MAX_DIGITS,
  42163. 'rounding', 0, 8,
  42164. 'toExpNeg', -EXP_LIMIT, 0,
  42165. 'toExpPos', 0, EXP_LIMIT,
  42166. 'maxE', 0, EXP_LIMIT,
  42167. 'minE', -EXP_LIMIT, 0,
  42168. 'modulo', 0, 9
  42169. ];
  42170. for (i = 0; i < ps.length; i += 3) {
  42171. if (p = ps[i], useDefaults) this[p] = DEFAULTS[p];
  42172. if ((v = obj[p]) !== void 0) {
  42173. if (mathfloor(v) === v && v >= ps[i + 1] && v <= ps[i + 2]) this[p] = v;
  42174. else throw Error(invalidArgument + p + ': ' + v);
  42175. }
  42176. }
  42177. if (p = 'crypto', useDefaults) this[p] = DEFAULTS[p];
  42178. if ((v = obj[p]) !== void 0) {
  42179. if (v === true || v === false || v === 0 || v === 1) {
  42180. if (v) {
  42181. if (typeof crypto != 'undefined' && crypto &&
  42182. (crypto.getRandomValues || crypto.randomBytes)) {
  42183. this[p] = true;
  42184. } else {
  42185. throw Error(cryptoUnavailable);
  42186. }
  42187. } else {
  42188. this[p] = false;
  42189. }
  42190. } else {
  42191. throw Error(invalidArgument + p + ': ' + v);
  42192. }
  42193. }
  42194. return this;
  42195. }
  42196. /*
  42197. * Return a new Decimal whose value is the cosine of `x`, rounded to `precision` significant
  42198. * digits using rounding mode `rounding`.
  42199. *
  42200. * x {number|string|Decimal} A value in radians.
  42201. *
  42202. */
  42203. function cos(x) {
  42204. return new this(x).cos();
  42205. }
  42206. /*
  42207. * Return a new Decimal whose value is the hyperbolic cosine of `x`, rounded to precision
  42208. * significant digits using rounding mode `rounding`.
  42209. *
  42210. * x {number|string|Decimal} A value in radians.
  42211. *
  42212. */
  42213. function cosh(x) {
  42214. return new this(x).cosh();
  42215. }
  42216. /*
  42217. * Create and return a Decimal constructor with the same configuration properties as this Decimal
  42218. * constructor.
  42219. *
  42220. */
  42221. function clone(obj) {
  42222. var i, p, ps;
  42223. /*
  42224. * The Decimal constructor and exported function.
  42225. * Return a new Decimal instance.
  42226. *
  42227. * v {number|string|Decimal} A numeric value.
  42228. *
  42229. */
  42230. function Decimal(v) {
  42231. var e, i, t,
  42232. x = this;
  42233. // Decimal called without new.
  42234. if (!(x instanceof Decimal)) return new Decimal(v);
  42235. // Retain a reference to this Decimal constructor, and shadow Decimal.prototype.constructor
  42236. // which points to Object.
  42237. x.constructor = Decimal;
  42238. // Duplicate.
  42239. if (v instanceof Decimal) {
  42240. x.s = v.s;
  42241. if (external) {
  42242. if (!v.d || v.e > Decimal.maxE) {
  42243. // Infinity.
  42244. x.e = NaN;
  42245. x.d = null;
  42246. } else if (v.e < Decimal.minE) {
  42247. // Zero.
  42248. x.e = 0;
  42249. x.d = [0];
  42250. } else {
  42251. x.e = v.e;
  42252. x.d = v.d.slice();
  42253. }
  42254. } else {
  42255. x.e = v.e;
  42256. x.d = v.d ? v.d.slice() : v.d;
  42257. }
  42258. return;
  42259. }
  42260. t = typeof v;
  42261. if (t === 'number') {
  42262. if (v === 0) {
  42263. x.s = 1 / v < 0 ? -1 : 1;
  42264. x.e = 0;
  42265. x.d = [0];
  42266. return;
  42267. }
  42268. if (v < 0) {
  42269. v = -v;
  42270. x.s = -1;
  42271. } else {
  42272. x.s = 1;
  42273. }
  42274. // Fast path for small integers.
  42275. if (v === ~~v && v < 1e7) {
  42276. for (e = 0, i = v; i >= 10; i /= 10) e++;
  42277. if (external) {
  42278. if (e > Decimal.maxE) {
  42279. x.e = NaN;
  42280. x.d = null;
  42281. } else if (e < Decimal.minE) {
  42282. x.e = 0;
  42283. x.d = [0];
  42284. } else {
  42285. x.e = e;
  42286. x.d = [v];
  42287. }
  42288. } else {
  42289. x.e = e;
  42290. x.d = [v];
  42291. }
  42292. return;
  42293. // Infinity, NaN.
  42294. } else if (v * 0 !== 0) {
  42295. if (!v) x.s = NaN;
  42296. x.e = NaN;
  42297. x.d = null;
  42298. return;
  42299. }
  42300. return parseDecimal(x, v.toString());
  42301. } else if (t !== 'string') {
  42302. throw Error(invalidArgument + v);
  42303. }
  42304. // Minus sign?
  42305. if (v.charCodeAt(0) === 45) {
  42306. v = v.slice(1);
  42307. x.s = -1;
  42308. } else {
  42309. x.s = 1;
  42310. }
  42311. return isDecimal.test(v) ? parseDecimal(x, v) : parseOther(x, v);
  42312. }
  42313. Decimal.prototype = P;
  42314. Decimal.ROUND_UP = 0;
  42315. Decimal.ROUND_DOWN = 1;
  42316. Decimal.ROUND_CEIL = 2;
  42317. Decimal.ROUND_FLOOR = 3;
  42318. Decimal.ROUND_HALF_UP = 4;
  42319. Decimal.ROUND_HALF_DOWN = 5;
  42320. Decimal.ROUND_HALF_EVEN = 6;
  42321. Decimal.ROUND_HALF_CEIL = 7;
  42322. Decimal.ROUND_HALF_FLOOR = 8;
  42323. Decimal.EUCLID = 9;
  42324. Decimal.config = Decimal.set = config;
  42325. Decimal.clone = clone;
  42326. Decimal.isDecimal = isDecimalInstance;
  42327. Decimal.abs = abs;
  42328. Decimal.acos = acos;
  42329. Decimal.acosh = acosh; // ES6
  42330. Decimal.add = add;
  42331. Decimal.asin = asin;
  42332. Decimal.asinh = asinh; // ES6
  42333. Decimal.atan = atan;
  42334. Decimal.atanh = atanh; // ES6
  42335. Decimal.atan2 = atan2;
  42336. Decimal.cbrt = cbrt; // ES6
  42337. Decimal.ceil = ceil;
  42338. Decimal.cos = cos;
  42339. Decimal.cosh = cosh; // ES6
  42340. Decimal.div = div;
  42341. Decimal.exp = exp;
  42342. Decimal.floor = floor;
  42343. Decimal.hypot = hypot; // ES6
  42344. Decimal.ln = ln;
  42345. Decimal.log = log;
  42346. Decimal.log10 = log10; // ES6
  42347. Decimal.log2 = log2; // ES6
  42348. Decimal.max = max;
  42349. Decimal.min = min;
  42350. Decimal.mod = mod;
  42351. Decimal.mul = mul;
  42352. Decimal.pow = pow;
  42353. Decimal.random = random;
  42354. Decimal.round = round;
  42355. Decimal.sign = sign; // ES6
  42356. Decimal.sin = sin;
  42357. Decimal.sinh = sinh; // ES6
  42358. Decimal.sqrt = sqrt;
  42359. Decimal.sub = sub;
  42360. Decimal.tan = tan;
  42361. Decimal.tanh = tanh; // ES6
  42362. Decimal.trunc = trunc; // ES6
  42363. if (obj === void 0) obj = {};
  42364. if (obj) {
  42365. if (obj.defaults !== true) {
  42366. ps = ['precision', 'rounding', 'toExpNeg', 'toExpPos', 'maxE', 'minE', 'modulo', 'crypto'];
  42367. for (i = 0; i < ps.length;) if (!obj.hasOwnProperty(p = ps[i++])) obj[p] = this[p];
  42368. }
  42369. }
  42370. Decimal.config(obj);
  42371. return Decimal;
  42372. }
  42373. /*
  42374. * Return a new Decimal whose value is `x` divided by `y`, rounded to `precision` significant
  42375. * digits using rounding mode `rounding`.
  42376. *
  42377. * x {number|string|Decimal}
  42378. * y {number|string|Decimal}
  42379. *
  42380. */
  42381. function div(x, y) {
  42382. return new this(x).div(y);
  42383. }
  42384. /*
  42385. * Return a new Decimal whose value is the natural exponential of `x`, rounded to `precision`
  42386. * significant digits using rounding mode `rounding`.
  42387. *
  42388. * x {number|string|Decimal} The power to which to raise the base of the natural log.
  42389. *
  42390. */
  42391. function exp(x) {
  42392. return new this(x).exp();
  42393. }
  42394. /*
  42395. * Return a new Decimal whose value is `x` round to an integer using `ROUND_FLOOR`.
  42396. *
  42397. * x {number|string|Decimal}
  42398. *
  42399. */
  42400. function floor(x) {
  42401. return finalise(x = new this(x), x.e + 1, 3);
  42402. }
  42403. /*
  42404. * Return a new Decimal whose value is the square root of the sum of the squares of the arguments,
  42405. * rounded to `precision` significant digits using rounding mode `rounding`.
  42406. *
  42407. * hypot(a, b, ...) = sqrt(a^2 + b^2 + ...)
  42408. *
  42409. */
  42410. function hypot() {
  42411. var i, n,
  42412. t = new this(0);
  42413. external = false;
  42414. for (i = 0; i < arguments.length;) {
  42415. n = new this(arguments[i++]);
  42416. if (!n.d) {
  42417. if (n.s) {
  42418. external = true;
  42419. return new this(1 / 0);
  42420. }
  42421. t = n;
  42422. } else if (t.d) {
  42423. t = t.plus(n.times(n));
  42424. }
  42425. }
  42426. external = true;
  42427. return t.sqrt();
  42428. }
  42429. /*
  42430. * Return true if object is a Decimal instance (where Decimal is any Decimal constructor),
  42431. * otherwise return false.
  42432. *
  42433. */
  42434. function isDecimalInstance(obj) {
  42435. return obj instanceof Decimal || obj && obj.name === '[object Decimal]' || false;
  42436. }
  42437. /*
  42438. * Return a new Decimal whose value is the natural logarithm of `x`, rounded to `precision`
  42439. * significant digits using rounding mode `rounding`.
  42440. *
  42441. * x {number|string|Decimal}
  42442. *
  42443. */
  42444. function ln(x) {
  42445. return new this(x).ln();
  42446. }
  42447. /*
  42448. * Return a new Decimal whose value is the log of `x` to the base `y`, or to base 10 if no base
  42449. * is specified, rounded to `precision` significant digits using rounding mode `rounding`.
  42450. *
  42451. * log[y](x)
  42452. *
  42453. * x {number|string|Decimal} The argument of the logarithm.
  42454. * y {number|string|Decimal} The base of the logarithm.
  42455. *
  42456. */
  42457. function log(x, y) {
  42458. return new this(x).log(y);
  42459. }
  42460. /*
  42461. * Return a new Decimal whose value is the base 2 logarithm of `x`, rounded to `precision`
  42462. * significant digits using rounding mode `rounding`.
  42463. *
  42464. * x {number|string|Decimal}
  42465. *
  42466. */
  42467. function log2(x) {
  42468. return new this(x).log(2);
  42469. }
  42470. /*
  42471. * Return a new Decimal whose value is the base 10 logarithm of `x`, rounded to `precision`
  42472. * significant digits using rounding mode `rounding`.
  42473. *
  42474. * x {number|string|Decimal}
  42475. *
  42476. */
  42477. function log10(x) {
  42478. return new this(x).log(10);
  42479. }
  42480. /*
  42481. * Return a new Decimal whose value is the maximum of the arguments.
  42482. *
  42483. * arguments {number|string|Decimal}
  42484. *
  42485. */
  42486. function max() {
  42487. return maxOrMin(this, arguments, 'lt');
  42488. }
  42489. /*
  42490. * Return a new Decimal whose value is the minimum of the arguments.
  42491. *
  42492. * arguments {number|string|Decimal}
  42493. *
  42494. */
  42495. function min() {
  42496. return maxOrMin(this, arguments, 'gt');
  42497. }
  42498. /*
  42499. * Return a new Decimal whose value is `x` modulo `y`, rounded to `precision` significant digits
  42500. * using rounding mode `rounding`.
  42501. *
  42502. * x {number|string|Decimal}
  42503. * y {number|string|Decimal}
  42504. *
  42505. */
  42506. function mod(x, y) {
  42507. return new this(x).mod(y);
  42508. }
  42509. /*
  42510. * Return a new Decimal whose value is `x` multiplied by `y`, rounded to `precision` significant
  42511. * digits using rounding mode `rounding`.
  42512. *
  42513. * x {number|string|Decimal}
  42514. * y {number|string|Decimal}
  42515. *
  42516. */
  42517. function mul(x, y) {
  42518. return new this(x).mul(y);
  42519. }
  42520. /*
  42521. * Return a new Decimal whose value is `x` raised to the power `y`, rounded to precision
  42522. * significant digits using rounding mode `rounding`.
  42523. *
  42524. * x {number|string|Decimal} The base.
  42525. * y {number|string|Decimal} The exponent.
  42526. *
  42527. */
  42528. function pow(x, y) {
  42529. return new this(x).pow(y);
  42530. }
  42531. /*
  42532. * Returns a new Decimal with a random value equal to or greater than 0 and less than 1, and with
  42533. * `sd`, or `Decimal.precision` if `sd` is omitted, significant digits (or less if trailing zeros
  42534. * are produced).
  42535. *
  42536. * [sd] {number} Significant digits. Integer, 0 to MAX_DIGITS inclusive.
  42537. *
  42538. */
  42539. function random(sd) {
  42540. var d, e, k, n,
  42541. i = 0,
  42542. r = new this(1),
  42543. rd = [];
  42544. if (sd === void 0) sd = this.precision;
  42545. else checkInt32(sd, 1, MAX_DIGITS);
  42546. k = Math.ceil(sd / LOG_BASE);
  42547. if (!this.crypto) {
  42548. for (; i < k;) rd[i++] = Math.random() * 1e7 | 0;
  42549. // Browsers supporting crypto.getRandomValues.
  42550. } else if (crypto.getRandomValues) {
  42551. d = crypto.getRandomValues(new Uint32Array(k));
  42552. for (; i < k;) {
  42553. n = d[i];
  42554. // 0 <= n < 4294967296
  42555. // Probability n >= 4.29e9, is 4967296 / 4294967296 = 0.00116 (1 in 865).
  42556. if (n >= 4.29e9) {
  42557. d[i] = crypto.getRandomValues(new Uint32Array(1))[0];
  42558. } else {
  42559. // 0 <= n <= 4289999999
  42560. // 0 <= (n % 1e7) <= 9999999
  42561. rd[i++] = n % 1e7;
  42562. }
  42563. }
  42564. // Node.js supporting crypto.randomBytes.
  42565. } else if (crypto.randomBytes) {
  42566. // buffer
  42567. d = crypto.randomBytes(k *= 4);
  42568. for (; i < k;) {
  42569. // 0 <= n < 2147483648
  42570. n = d[i] + (d[i + 1] << 8) + (d[i + 2] << 16) + ((d[i + 3] & 0x7f) << 24);
  42571. // Probability n >= 2.14e9, is 7483648 / 2147483648 = 0.0035 (1 in 286).
  42572. if (n >= 2.14e9) {
  42573. crypto.randomBytes(4).copy(d, i);
  42574. } else {
  42575. // 0 <= n <= 2139999999
  42576. // 0 <= (n % 1e7) <= 9999999
  42577. rd.push(n % 1e7);
  42578. i += 4;
  42579. }
  42580. }
  42581. i = k / 4;
  42582. } else {
  42583. throw Error(cryptoUnavailable);
  42584. }
  42585. k = rd[--i];
  42586. sd %= LOG_BASE;
  42587. // Convert trailing digits to zeros according to sd.
  42588. if (k && sd) {
  42589. n = mathpow(10, LOG_BASE - sd);
  42590. rd[i] = (k / n | 0) * n;
  42591. }
  42592. // Remove trailing words which are zero.
  42593. for (; rd[i] === 0; i--) rd.pop();
  42594. // Zero?
  42595. if (i < 0) {
  42596. e = 0;
  42597. rd = [0];
  42598. } else {
  42599. e = -1;
  42600. // Remove leading words which are zero and adjust exponent accordingly.
  42601. for (; rd[0] === 0; e -= LOG_BASE) rd.shift();
  42602. // Count the digits of the first word of rd to determine leading zeros.
  42603. for (k = 1, n = rd[0]; n >= 10; n /= 10) k++;
  42604. // Adjust the exponent for leading zeros of the first word of rd.
  42605. if (k < LOG_BASE) e -= LOG_BASE - k;
  42606. }
  42607. r.e = e;
  42608. r.d = rd;
  42609. return r;
  42610. }
  42611. /*
  42612. * Return a new Decimal whose value is `x` rounded to an integer using rounding mode `rounding`.
  42613. *
  42614. * To emulate `Math.round`, set rounding to 7 (ROUND_HALF_CEIL).
  42615. *
  42616. * x {number|string|Decimal}
  42617. *
  42618. */
  42619. function round(x) {
  42620. return finalise(x = new this(x), x.e + 1, this.rounding);
  42621. }
  42622. /*
  42623. * Return
  42624. * 1 if x > 0,
  42625. * -1 if x < 0,
  42626. * 0 if x is 0,
  42627. * -0 if x is -0,
  42628. * NaN otherwise
  42629. *
  42630. */
  42631. function sign(x) {
  42632. x = new this(x);
  42633. return x.d ? (x.d[0] ? x.s : 0 * x.s) : x.s || NaN;
  42634. }
  42635. /*
  42636. * Return a new Decimal whose value is the sine of `x`, rounded to `precision` significant digits
  42637. * using rounding mode `rounding`.
  42638. *
  42639. * x {number|string|Decimal} A value in radians.
  42640. *
  42641. */
  42642. function sin(x) {
  42643. return new this(x).sin();
  42644. }
  42645. /*
  42646. * Return a new Decimal whose value is the hyperbolic sine of `x`, rounded to `precision`
  42647. * significant digits using rounding mode `rounding`.
  42648. *
  42649. * x {number|string|Decimal} A value in radians.
  42650. *
  42651. */
  42652. function sinh(x) {
  42653. return new this(x).sinh();
  42654. }
  42655. /*
  42656. * Return a new Decimal whose value is the square root of `x`, rounded to `precision` significant
  42657. * digits using rounding mode `rounding`.
  42658. *
  42659. * x {number|string|Decimal}
  42660. *
  42661. */
  42662. function sqrt(x) {
  42663. return new this(x).sqrt();
  42664. }
  42665. /*
  42666. * Return a new Decimal whose value is `x` minus `y`, rounded to `precision` significant digits
  42667. * using rounding mode `rounding`.
  42668. *
  42669. * x {number|string|Decimal}
  42670. * y {number|string|Decimal}
  42671. *
  42672. */
  42673. function sub(x, y) {
  42674. return new this(x).sub(y);
  42675. }
  42676. /*
  42677. * Return a new Decimal whose value is the tangent of `x`, rounded to `precision` significant
  42678. * digits using rounding mode `rounding`.
  42679. *
  42680. * x {number|string|Decimal} A value in radians.
  42681. *
  42682. */
  42683. function tan(x) {
  42684. return new this(x).tan();
  42685. }
  42686. /*
  42687. * Return a new Decimal whose value is the hyperbolic tangent of `x`, rounded to `precision`
  42688. * significant digits using rounding mode `rounding`.
  42689. *
  42690. * x {number|string|Decimal} A value in radians.
  42691. *
  42692. */
  42693. function tanh(x) {
  42694. return new this(x).tanh();
  42695. }
  42696. /*
  42697. * Return a new Decimal whose value is `x` truncated to an integer.
  42698. *
  42699. * x {number|string|Decimal}
  42700. *
  42701. */
  42702. function trunc(x) {
  42703. return finalise(x = new this(x), x.e + 1, 1);
  42704. }
  42705. // Create and configure initial Decimal constructor.
  42706. Decimal = clone(DEFAULTS);
  42707. Decimal['default'] = Decimal.Decimal = Decimal;
  42708. // Create the internal constants from their string values.
  42709. LN10 = new Decimal(LN10);
  42710. PI = new Decimal(PI);
  42711. // Export.
  42712. // AMD.
  42713. if (true) {
  42714. !(__WEBPACK_AMD_DEFINE_RESULT__ = (function () {
  42715. return Decimal;
  42716. }).call(exports, __webpack_require__, exports, module),
  42717. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  42718. // Node and other environments that support module.exports.
  42719. } else {}
  42720. })(this);
  42721. /***/ }),
  42722. /***/ "./node_modules/jquery/dist/jquery.js":
  42723. /*!********************************************!*\
  42724. !*** ./node_modules/jquery/dist/jquery.js ***!
  42725. \********************************************/
  42726. /*! no static exports found */
  42727. /***/ (function(module, exports, __webpack_require__) {
  42728. var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
  42729. * jQuery JavaScript Library v3.3.1
  42730. * https://jquery.com/
  42731. *
  42732. * Includes Sizzle.js
  42733. * https://sizzlejs.com/
  42734. *
  42735. * Copyright JS Foundation and other contributors
  42736. * Released under the MIT license
  42737. * https://jquery.org/license
  42738. *
  42739. * Date: 2018-01-20T17:24Z
  42740. */
  42741. ( function( global, factory ) {
  42742. "use strict";
  42743. if ( true && typeof module.exports === "object" ) {
  42744. // For CommonJS and CommonJS-like environments where a proper `window`
  42745. // is present, execute the factory and get jQuery.
  42746. // For environments that do not have a `window` with a `document`
  42747. // (such as Node.js), expose a factory as module.exports.
  42748. // This accentuates the need for the creation of a real `window`.
  42749. // e.g. var jQuery = require("jquery")(window);
  42750. // See ticket #14549 for more info.
  42751. module.exports = global.document ?
  42752. factory( global, true ) :
  42753. function( w ) {
  42754. if ( !w.document ) {
  42755. throw new Error( "jQuery requires a window with a document" );
  42756. }
  42757. return factory( w );
  42758. };
  42759. } else {
  42760. factory( global );
  42761. }
  42762. // Pass this if window is not defined yet
  42763. } )( typeof window !== "undefined" ? window : this, function( window, noGlobal ) {
  42764. // Edge <= 12 - 13+, Firefox <=18 - 45+, IE 10 - 11, Safari 5.1 - 9+, iOS 6 - 9.1
  42765. // throw exceptions when non-strict code (e.g., ASP.NET 4.5) accesses strict mode
  42766. // arguments.callee.caller (trac-13335). But as of jQuery 3.0 (2016), strict mode should be common
  42767. // enough that all such attempts are guarded in a try block.
  42768. "use strict";
  42769. var arr = [];
  42770. var document = window.document;
  42771. var getProto = Object.getPrototypeOf;
  42772. var slice = arr.slice;
  42773. var concat = arr.concat;
  42774. var push = arr.push;
  42775. var indexOf = arr.indexOf;
  42776. var class2type = {};
  42777. var toString = class2type.toString;
  42778. var hasOwn = class2type.hasOwnProperty;
  42779. var fnToString = hasOwn.toString;
  42780. var ObjectFunctionString = fnToString.call( Object );
  42781. var support = {};
  42782. var isFunction = function isFunction( obj ) {
  42783. // Support: Chrome <=57, Firefox <=52
  42784. // In some browsers, typeof returns "function" for HTML <object> elements
  42785. // (i.e., `typeof document.createElement( "object" ) === "function"`).
  42786. // We don't want to classify *any* DOM node as a function.
  42787. return typeof obj === "function" && typeof obj.nodeType !== "number";
  42788. };
  42789. var isWindow = function isWindow( obj ) {
  42790. return obj != null && obj === obj.window;
  42791. };
  42792. var preservedScriptAttributes = {
  42793. type: true,
  42794. src: true,
  42795. noModule: true
  42796. };
  42797. function DOMEval( code, doc, node ) {
  42798. doc = doc || document;
  42799. var i,
  42800. script = doc.createElement( "script" );
  42801. script.text = code;
  42802. if ( node ) {
  42803. for ( i in preservedScriptAttributes ) {
  42804. if ( node[ i ] ) {
  42805. script[ i ] = node[ i ];
  42806. }
  42807. }
  42808. }
  42809. doc.head.appendChild( script ).parentNode.removeChild( script );
  42810. }
  42811. function toType( obj ) {
  42812. if ( obj == null ) {
  42813. return obj + "";
  42814. }
  42815. // Support: Android <=2.3 only (functionish RegExp)
  42816. return typeof obj === "object" || typeof obj === "function" ?
  42817. class2type[ toString.call( obj ) ] || "object" :
  42818. typeof obj;
  42819. }
  42820. /* global Symbol */
  42821. // Defining this global in .eslintrc.json would create a danger of using the global
  42822. // unguarded in another place, it seems safer to define global only for this module
  42823. var
  42824. version = "3.3.1",
  42825. // Define a local copy of jQuery
  42826. jQuery = function( selector, context ) {
  42827. // The jQuery object is actually just the init constructor 'enhanced'
  42828. // Need init if jQuery is called (just allow error to be thrown if not included)
  42829. return new jQuery.fn.init( selector, context );
  42830. },
  42831. // Support: Android <=4.0 only
  42832. // Make sure we trim BOM and NBSP
  42833. rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;
  42834. jQuery.fn = jQuery.prototype = {
  42835. // The current version of jQuery being used
  42836. jquery: version,
  42837. constructor: jQuery,
  42838. // The default length of a jQuery object is 0
  42839. length: 0,
  42840. toArray: function() {
  42841. return slice.call( this );
  42842. },
  42843. // Get the Nth element in the matched element set OR
  42844. // Get the whole matched element set as a clean array
  42845. get: function( num ) {
  42846. // Return all the elements in a clean array
  42847. if ( num == null ) {
  42848. return slice.call( this );
  42849. }
  42850. // Return just the one element from the set
  42851. return num < 0 ? this[ num + this.length ] : this[ num ];
  42852. },
  42853. // Take an array of elements and push it onto the stack
  42854. // (returning the new matched element set)
  42855. pushStack: function( elems ) {
  42856. // Build a new jQuery matched element set
  42857. var ret = jQuery.merge( this.constructor(), elems );
  42858. // Add the old object onto the stack (as a reference)
  42859. ret.prevObject = this;
  42860. // Return the newly-formed element set
  42861. return ret;
  42862. },
  42863. // Execute a callback for every element in the matched set.
  42864. each: function( callback ) {
  42865. return jQuery.each( this, callback );
  42866. },
  42867. map: function( callback ) {
  42868. return this.pushStack( jQuery.map( this, function( elem, i ) {
  42869. return callback.call( elem, i, elem );
  42870. } ) );
  42871. },
  42872. slice: function() {
  42873. return this.pushStack( slice.apply( this, arguments ) );
  42874. },
  42875. first: function() {
  42876. return this.eq( 0 );
  42877. },
  42878. last: function() {
  42879. return this.eq( -1 );
  42880. },
  42881. eq: function( i ) {
  42882. var len = this.length,
  42883. j = +i + ( i < 0 ? len : 0 );
  42884. return this.pushStack( j >= 0 && j < len ? [ this[ j ] ] : [] );
  42885. },
  42886. end: function() {
  42887. return this.prevObject || this.constructor();
  42888. },
  42889. // For internal use only.
  42890. // Behaves like an Array's method, not like a jQuery method.
  42891. push: push,
  42892. sort: arr.sort,
  42893. splice: arr.splice
  42894. };
  42895. jQuery.extend = jQuery.fn.extend = function() {
  42896. var options, name, src, copy, copyIsArray, clone,
  42897. target = arguments[ 0 ] || {},
  42898. i = 1,
  42899. length = arguments.length,
  42900. deep = false;
  42901. // Handle a deep copy situation
  42902. if ( typeof target === "boolean" ) {
  42903. deep = target;
  42904. // Skip the boolean and the target
  42905. target = arguments[ i ] || {};
  42906. i++;
  42907. }
  42908. // Handle case when target is a string or something (possible in deep copy)
  42909. if ( typeof target !== "object" && !isFunction( target ) ) {
  42910. target = {};
  42911. }
  42912. // Extend jQuery itself if only one argument is passed
  42913. if ( i === length ) {
  42914. target = this;
  42915. i--;
  42916. }
  42917. for ( ; i < length; i++ ) {
  42918. // Only deal with non-null/undefined values
  42919. if ( ( options = arguments[ i ] ) != null ) {
  42920. // Extend the base object
  42921. for ( name in options ) {
  42922. src = target[ name ];
  42923. copy = options[ name ];
  42924. // Prevent never-ending loop
  42925. if ( target === copy ) {
  42926. continue;
  42927. }
  42928. // Recurse if we're merging plain objects or arrays
  42929. if ( deep && copy && ( jQuery.isPlainObject( copy ) ||
  42930. ( copyIsArray = Array.isArray( copy ) ) ) ) {
  42931. if ( copyIsArray ) {
  42932. copyIsArray = false;
  42933. clone = src && Array.isArray( src ) ? src : [];
  42934. } else {
  42935. clone = src && jQuery.isPlainObject( src ) ? src : {};
  42936. }
  42937. // Never move original objects, clone them
  42938. target[ name ] = jQuery.extend( deep, clone, copy );
  42939. // Don't bring in undefined values
  42940. } else if ( copy !== undefined ) {
  42941. target[ name ] = copy;
  42942. }
  42943. }
  42944. }
  42945. }
  42946. // Return the modified object
  42947. return target;
  42948. };
  42949. jQuery.extend( {
  42950. // Unique for each copy of jQuery on the page
  42951. expando: "jQuery" + ( version + Math.random() ).replace( /\D/g, "" ),
  42952. // Assume jQuery is ready without the ready module
  42953. isReady: true,
  42954. error: function( msg ) {
  42955. throw new Error( msg );
  42956. },
  42957. noop: function() {},
  42958. isPlainObject: function( obj ) {
  42959. var proto, Ctor;
  42960. // Detect obvious negatives
  42961. // Use toString instead of jQuery.type to catch host objects
  42962. if ( !obj || toString.call( obj ) !== "[object Object]" ) {
  42963. return false;
  42964. }
  42965. proto = getProto( obj );
  42966. // Objects with no prototype (e.g., `Object.create( null )`) are plain
  42967. if ( !proto ) {
  42968. return true;
  42969. }
  42970. // Objects with prototype are plain iff they were constructed by a global Object function
  42971. Ctor = hasOwn.call( proto, "constructor" ) && proto.constructor;
  42972. return typeof Ctor === "function" && fnToString.call( Ctor ) === ObjectFunctionString;
  42973. },
  42974. isEmptyObject: function( obj ) {
  42975. /* eslint-disable no-unused-vars */
  42976. // See https://github.com/eslint/eslint/issues/6125
  42977. var name;
  42978. for ( name in obj ) {
  42979. return false;
  42980. }
  42981. return true;
  42982. },
  42983. // Evaluates a script in a global context
  42984. globalEval: function( code ) {
  42985. DOMEval( code );
  42986. },
  42987. each: function( obj, callback ) {
  42988. var length, i = 0;
  42989. if ( isArrayLike( obj ) ) {
  42990. length = obj.length;
  42991. for ( ; i < length; i++ ) {
  42992. if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
  42993. break;
  42994. }
  42995. }
  42996. } else {
  42997. for ( i in obj ) {
  42998. if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
  42999. break;
  43000. }
  43001. }
  43002. }
  43003. return obj;
  43004. },
  43005. // Support: Android <=4.0 only
  43006. trim: function( text ) {
  43007. return text == null ?
  43008. "" :
  43009. ( text + "" ).replace( rtrim, "" );
  43010. },
  43011. // results is for internal usage only
  43012. makeArray: function( arr, results ) {
  43013. var ret = results || [];
  43014. if ( arr != null ) {
  43015. if ( isArrayLike( Object( arr ) ) ) {
  43016. jQuery.merge( ret,
  43017. typeof arr === "string" ?
  43018. [ arr ] : arr
  43019. );
  43020. } else {
  43021. push.call( ret, arr );
  43022. }
  43023. }
  43024. return ret;
  43025. },
  43026. inArray: function( elem, arr, i ) {
  43027. return arr == null ? -1 : indexOf.call( arr, elem, i );
  43028. },
  43029. // Support: Android <=4.0 only, PhantomJS 1 only
  43030. // push.apply(_, arraylike) throws on ancient WebKit
  43031. merge: function( first, second ) {
  43032. var len = +second.length,
  43033. j = 0,
  43034. i = first.length;
  43035. for ( ; j < len; j++ ) {
  43036. first[ i++ ] = second[ j ];
  43037. }
  43038. first.length = i;
  43039. return first;
  43040. },
  43041. grep: function( elems, callback, invert ) {
  43042. var callbackInverse,
  43043. matches = [],
  43044. i = 0,
  43045. length = elems.length,
  43046. callbackExpect = !invert;
  43047. // Go through the array, only saving the items
  43048. // that pass the validator function
  43049. for ( ; i < length; i++ ) {
  43050. callbackInverse = !callback( elems[ i ], i );
  43051. if ( callbackInverse !== callbackExpect ) {
  43052. matches.push( elems[ i ] );
  43053. }
  43054. }
  43055. return matches;
  43056. },
  43057. // arg is for internal usage only
  43058. map: function( elems, callback, arg ) {
  43059. var length, value,
  43060. i = 0,
  43061. ret = [];
  43062. // Go through the array, translating each of the items to their new values
  43063. if ( isArrayLike( elems ) ) {
  43064. length = elems.length;
  43065. for ( ; i < length; i++ ) {
  43066. value = callback( elems[ i ], i, arg );
  43067. if ( value != null ) {
  43068. ret.push( value );
  43069. }
  43070. }
  43071. // Go through every key on the object,
  43072. } else {
  43073. for ( i in elems ) {
  43074. value = callback( elems[ i ], i, arg );
  43075. if ( value != null ) {
  43076. ret.push( value );
  43077. }
  43078. }
  43079. }
  43080. // Flatten any nested arrays
  43081. return concat.apply( [], ret );
  43082. },
  43083. // A global GUID counter for objects
  43084. guid: 1,
  43085. // jQuery.support is not used in Core but other projects attach their
  43086. // properties to it so it needs to exist.
  43087. support: support
  43088. } );
  43089. if ( typeof Symbol === "function" ) {
  43090. jQuery.fn[ Symbol.iterator ] = arr[ Symbol.iterator ];
  43091. }
  43092. // Populate the class2type map
  43093. jQuery.each( "Boolean Number String Function Array Date RegExp Object Error Symbol".split( " " ),
  43094. function( i, name ) {
  43095. class2type[ "[object " + name + "]" ] = name.toLowerCase();
  43096. } );
  43097. function isArrayLike( obj ) {
  43098. // Support: real iOS 8.2 only (not reproducible in simulator)
  43099. // `in` check used to prevent JIT error (gh-2145)
  43100. // hasOwn isn't used here due to false negatives
  43101. // regarding Nodelist length in IE
  43102. var length = !!obj && "length" in obj && obj.length,
  43103. type = toType( obj );
  43104. if ( isFunction( obj ) || isWindow( obj ) ) {
  43105. return false;
  43106. }
  43107. return type === "array" || length === 0 ||
  43108. typeof length === "number" && length > 0 && ( length - 1 ) in obj;
  43109. }
  43110. var Sizzle =
  43111. /*!
  43112. * Sizzle CSS Selector Engine v2.3.3
  43113. * https://sizzlejs.com/
  43114. *
  43115. * Copyright jQuery Foundation and other contributors
  43116. * Released under the MIT license
  43117. * http://jquery.org/license
  43118. *
  43119. * Date: 2016-08-08
  43120. */
  43121. (function( window ) {
  43122. var i,
  43123. support,
  43124. Expr,
  43125. getText,
  43126. isXML,
  43127. tokenize,
  43128. compile,
  43129. select,
  43130. outermostContext,
  43131. sortInput,
  43132. hasDuplicate,
  43133. // Local document vars
  43134. setDocument,
  43135. document,
  43136. docElem,
  43137. documentIsHTML,
  43138. rbuggyQSA,
  43139. rbuggyMatches,
  43140. matches,
  43141. contains,
  43142. // Instance-specific data
  43143. expando = "sizzle" + 1 * new Date(),
  43144. preferredDoc = window.document,
  43145. dirruns = 0,
  43146. done = 0,
  43147. classCache = createCache(),
  43148. tokenCache = createCache(),
  43149. compilerCache = createCache(),
  43150. sortOrder = function( a, b ) {
  43151. if ( a === b ) {
  43152. hasDuplicate = true;
  43153. }
  43154. return 0;
  43155. },
  43156. // Instance methods
  43157. hasOwn = ({}).hasOwnProperty,
  43158. arr = [],
  43159. pop = arr.pop,
  43160. push_native = arr.push,
  43161. push = arr.push,
  43162. slice = arr.slice,
  43163. // Use a stripped-down indexOf as it's faster than native
  43164. // https://jsperf.com/thor-indexof-vs-for/5
  43165. indexOf = function( list, elem ) {
  43166. var i = 0,
  43167. len = list.length;
  43168. for ( ; i < len; i++ ) {
  43169. if ( list[i] === elem ) {
  43170. return i;
  43171. }
  43172. }
  43173. return -1;
  43174. },
  43175. booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",
  43176. // Regular expressions
  43177. // http://www.w3.org/TR/css3-selectors/#whitespace
  43178. whitespace = "[\\x20\\t\\r\\n\\f]",
  43179. // http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier
  43180. identifier = "(?:\\\\.|[\\w-]|[^\0-\\xa0])+",
  43181. // Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors
  43182. attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace +
  43183. // Operator (capture 2)
  43184. "*([*^$|!~]?=)" + whitespace +
  43185. // "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]"
  43186. "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + whitespace +
  43187. "*\\]",
  43188. pseudos = ":(" + identifier + ")(?:\\((" +
  43189. // To reduce the number of selectors needing tokenize in the preFilter, prefer arguments:
  43190. // 1. quoted (capture 3; capture 4 or capture 5)
  43191. "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" +
  43192. // 2. simple (capture 6)
  43193. "((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" +
  43194. // 3. anything else (capture 2)
  43195. ".*" +
  43196. ")\\)|)",
  43197. // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter
  43198. rwhitespace = new RegExp( whitespace + "+", "g" ),
  43199. rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ),
  43200. rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ),
  43201. rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*" ),
  43202. rattributeQuotes = new RegExp( "=" + whitespace + "*([^\\]'\"]*?)" + whitespace + "*\\]", "g" ),
  43203. rpseudo = new RegExp( pseudos ),
  43204. ridentifier = new RegExp( "^" + identifier + "$" ),
  43205. matchExpr = {
  43206. "ID": new RegExp( "^#(" + identifier + ")" ),
  43207. "CLASS": new RegExp( "^\\.(" + identifier + ")" ),
  43208. "TAG": new RegExp( "^(" + identifier + "|[*])" ),
  43209. "ATTR": new RegExp( "^" + attributes ),
  43210. "PSEUDO": new RegExp( "^" + pseudos ),
  43211. "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace +
  43212. "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace +
  43213. "*(\\d+)|))" + whitespace + "*\\)|)", "i" ),
  43214. "bool": new RegExp( "^(?:" + booleans + ")$", "i" ),
  43215. // For use in libraries implementing .is()
  43216. // We use this for POS matching in `select`
  43217. "needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" +
  43218. whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" )
  43219. },
  43220. rinputs = /^(?:input|select|textarea|button)$/i,
  43221. rheader = /^h\d$/i,
  43222. rnative = /^[^{]+\{\s*\[native \w/,
  43223. // Easily-parseable/retrievable ID or TAG or CLASS selectors
  43224. rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,
  43225. rsibling = /[+~]/,
  43226. // CSS escapes
  43227. // http://www.w3.org/TR/CSS21/syndata.html#escaped-characters
  43228. runescape = new RegExp( "\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig" ),
  43229. funescape = function( _, escaped, escapedWhitespace ) {
  43230. var high = "0x" + escaped - 0x10000;
  43231. // NaN means non-codepoint
  43232. // Support: Firefox<24
  43233. // Workaround erroneous numeric interpretation of +"0x"
  43234. return high !== high || escapedWhitespace ?
  43235. escaped :
  43236. high < 0 ?
  43237. // BMP codepoint
  43238. String.fromCharCode( high + 0x10000 ) :
  43239. // Supplemental Plane codepoint (surrogate pair)
  43240. String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 );
  43241. },
  43242. // CSS string/identifier serialization
  43243. // https://drafts.csswg.org/cssom/#common-serializing-idioms
  43244. rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,
  43245. fcssescape = function( ch, asCodePoint ) {
  43246. if ( asCodePoint ) {
  43247. // U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER
  43248. if ( ch === "\0" ) {
  43249. return "\uFFFD";
  43250. }
  43251. // Control characters and (dependent upon position) numbers get escaped as code points
  43252. return ch.slice( 0, -1 ) + "\\" + ch.charCodeAt( ch.length - 1 ).toString( 16 ) + " ";
  43253. }
  43254. // Other potentially-special ASCII characters get backslash-escaped
  43255. return "\\" + ch;
  43256. },
  43257. // Used for iframes
  43258. // See setDocument()
  43259. // Removing the function wrapper causes a "Permission Denied"
  43260. // error in IE
  43261. unloadHandler = function() {
  43262. setDocument();
  43263. },
  43264. disabledAncestor = addCombinator(
  43265. function( elem ) {
  43266. return elem.disabled === true && ("form" in elem || "label" in elem);
  43267. },
  43268. { dir: "parentNode", next: "legend" }
  43269. );
  43270. // Optimize for push.apply( _, NodeList )
  43271. try {
  43272. push.apply(
  43273. (arr = slice.call( preferredDoc.childNodes )),
  43274. preferredDoc.childNodes
  43275. );
  43276. // Support: Android<4.0
  43277. // Detect silently failing push.apply
  43278. arr[ preferredDoc.childNodes.length ].nodeType;
  43279. } catch ( e ) {
  43280. push = { apply: arr.length ?
  43281. // Leverage slice if possible
  43282. function( target, els ) {
  43283. push_native.apply( target, slice.call(els) );
  43284. } :
  43285. // Support: IE<9
  43286. // Otherwise append directly
  43287. function( target, els ) {
  43288. var j = target.length,
  43289. i = 0;
  43290. // Can't trust NodeList.length
  43291. while ( (target[j++] = els[i++]) ) {}
  43292. target.length = j - 1;
  43293. }
  43294. };
  43295. }
  43296. function Sizzle( selector, context, results, seed ) {
  43297. var m, i, elem, nid, match, groups, newSelector,
  43298. newContext = context && context.ownerDocument,
  43299. // nodeType defaults to 9, since context defaults to document
  43300. nodeType = context ? context.nodeType : 9;
  43301. results = results || [];
  43302. // Return early from calls with invalid selector or context
  43303. if ( typeof selector !== "string" || !selector ||
  43304. nodeType !== 1 && nodeType !== 9 && nodeType !== 11 ) {
  43305. return results;
  43306. }
  43307. // Try to shortcut find operations (as opposed to filters) in HTML documents
  43308. if ( !seed ) {
  43309. if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) {
  43310. setDocument( context );
  43311. }
  43312. context = context || document;
  43313. if ( documentIsHTML ) {
  43314. // If the selector is sufficiently simple, try using a "get*By*" DOM method
  43315. // (excepting DocumentFragment context, where the methods don't exist)
  43316. if ( nodeType !== 11 && (match = rquickExpr.exec( selector )) ) {
  43317. // ID selector
  43318. if ( (m = match[1]) ) {
  43319. // Document context
  43320. if ( nodeType === 9 ) {
  43321. if ( (elem = context.getElementById( m )) ) {
  43322. // Support: IE, Opera, Webkit
  43323. // TODO: identify versions
  43324. // getElementById can match elements by name instead of ID
  43325. if ( elem.id === m ) {
  43326. results.push( elem );
  43327. return results;
  43328. }
  43329. } else {
  43330. return results;
  43331. }
  43332. // Element context
  43333. } else {
  43334. // Support: IE, Opera, Webkit
  43335. // TODO: identify versions
  43336. // getElementById can match elements by name instead of ID
  43337. if ( newContext && (elem = newContext.getElementById( m )) &&
  43338. contains( context, elem ) &&
  43339. elem.id === m ) {
  43340. results.push( elem );
  43341. return results;
  43342. }
  43343. }
  43344. // Type selector
  43345. } else if ( match[2] ) {
  43346. push.apply( results, context.getElementsByTagName( selector ) );
  43347. return results;
  43348. // Class selector
  43349. } else if ( (m = match[3]) && support.getElementsByClassName &&
  43350. context.getElementsByClassName ) {
  43351. push.apply( results, context.getElementsByClassName( m ) );
  43352. return results;
  43353. }
  43354. }
  43355. // Take advantage of querySelectorAll
  43356. if ( support.qsa &&
  43357. !compilerCache[ selector + " " ] &&
  43358. (!rbuggyQSA || !rbuggyQSA.test( selector )) ) {
  43359. if ( nodeType !== 1 ) {
  43360. newContext = context;
  43361. newSelector = selector;
  43362. // qSA looks outside Element context, which is not what we want
  43363. // Thanks to Andrew Dupont for this workaround technique
  43364. // Support: IE <=8
  43365. // Exclude object elements
  43366. } else if ( context.nodeName.toLowerCase() !== "object" ) {
  43367. // Capture the context ID, setting it first if necessary
  43368. if ( (nid = context.getAttribute( "id" )) ) {
  43369. nid = nid.replace( rcssescape, fcssescape );
  43370. } else {
  43371. context.setAttribute( "id", (nid = expando) );
  43372. }
  43373. // Prefix every selector in the list
  43374. groups = tokenize( selector );
  43375. i = groups.length;
  43376. while ( i-- ) {
  43377. groups[i] = "#" + nid + " " + toSelector( groups[i] );
  43378. }
  43379. newSelector = groups.join( "," );
  43380. // Expand context for sibling selectors
  43381. newContext = rsibling.test( selector ) && testContext( context.parentNode ) ||
  43382. context;
  43383. }
  43384. if ( newSelector ) {
  43385. try {
  43386. push.apply( results,
  43387. newContext.querySelectorAll( newSelector )
  43388. );
  43389. return results;
  43390. } catch ( qsaError ) {
  43391. } finally {
  43392. if ( nid === expando ) {
  43393. context.removeAttribute( "id" );
  43394. }
  43395. }
  43396. }
  43397. }
  43398. }
  43399. }
  43400. // All others
  43401. return select( selector.replace( rtrim, "$1" ), context, results, seed );
  43402. }
  43403. /**
  43404. * Create key-value caches of limited size
  43405. * @returns {function(string, object)} Returns the Object data after storing it on itself with
  43406. * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength)
  43407. * deleting the oldest entry
  43408. */
  43409. function createCache() {
  43410. var keys = [];
  43411. function cache( key, value ) {
  43412. // Use (key + " ") to avoid collision with native prototype properties (see Issue #157)
  43413. if ( keys.push( key + " " ) > Expr.cacheLength ) {
  43414. // Only keep the most recent entries
  43415. delete cache[ keys.shift() ];
  43416. }
  43417. return (cache[ key + " " ] = value);
  43418. }
  43419. return cache;
  43420. }
  43421. /**
  43422. * Mark a function for special use by Sizzle
  43423. * @param {Function} fn The function to mark
  43424. */
  43425. function markFunction( fn ) {
  43426. fn[ expando ] = true;
  43427. return fn;
  43428. }
  43429. /**
  43430. * Support testing using an element
  43431. * @param {Function} fn Passed the created element and returns a boolean result
  43432. */
  43433. function assert( fn ) {
  43434. var el = document.createElement("fieldset");
  43435. try {
  43436. return !!fn( el );
  43437. } catch (e) {
  43438. return false;
  43439. } finally {
  43440. // Remove from its parent by default
  43441. if ( el.parentNode ) {
  43442. el.parentNode.removeChild( el );
  43443. }
  43444. // release memory in IE
  43445. el = null;
  43446. }
  43447. }
  43448. /**
  43449. * Adds the same handler for all of the specified attrs
  43450. * @param {String} attrs Pipe-separated list of attributes
  43451. * @param {Function} handler The method that will be applied
  43452. */
  43453. function addHandle( attrs, handler ) {
  43454. var arr = attrs.split("|"),
  43455. i = arr.length;
  43456. while ( i-- ) {
  43457. Expr.attrHandle[ arr[i] ] = handler;
  43458. }
  43459. }
  43460. /**
  43461. * Checks document order of two siblings
  43462. * @param {Element} a
  43463. * @param {Element} b
  43464. * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b
  43465. */
  43466. function siblingCheck( a, b ) {
  43467. var cur = b && a,
  43468. diff = cur && a.nodeType === 1 && b.nodeType === 1 &&
  43469. a.sourceIndex - b.sourceIndex;
  43470. // Use IE sourceIndex if available on both nodes
  43471. if ( diff ) {
  43472. return diff;
  43473. }
  43474. // Check if b follows a
  43475. if ( cur ) {
  43476. while ( (cur = cur.nextSibling) ) {
  43477. if ( cur === b ) {
  43478. return -1;
  43479. }
  43480. }
  43481. }
  43482. return a ? 1 : -1;
  43483. }
  43484. /**
  43485. * Returns a function to use in pseudos for input types
  43486. * @param {String} type
  43487. */
  43488. function createInputPseudo( type ) {
  43489. return function( elem ) {
  43490. var name = elem.nodeName.toLowerCase();
  43491. return name === "input" && elem.type === type;
  43492. };
  43493. }
  43494. /**
  43495. * Returns a function to use in pseudos for buttons
  43496. * @param {String} type
  43497. */
  43498. function createButtonPseudo( type ) {
  43499. return function( elem ) {
  43500. var name = elem.nodeName.toLowerCase();
  43501. return (name === "input" || name === "button") && elem.type === type;
  43502. };
  43503. }
  43504. /**
  43505. * Returns a function to use in pseudos for :enabled/:disabled
  43506. * @param {Boolean} disabled true for :disabled; false for :enabled
  43507. */
  43508. function createDisabledPseudo( disabled ) {
  43509. // Known :disabled false positives: fieldset[disabled] > legend:nth-of-type(n+2) :can-disable
  43510. return function( elem ) {
  43511. // Only certain elements can match :enabled or :disabled
  43512. // https://html.spec.whatwg.org/multipage/scripting.html#selector-enabled
  43513. // https://html.spec.whatwg.org/multipage/scripting.html#selector-disabled
  43514. if ( "form" in elem ) {
  43515. // Check for inherited disabledness on relevant non-disabled elements:
  43516. // * listed form-associated elements in a disabled fieldset
  43517. // https://html.spec.whatwg.org/multipage/forms.html#category-listed
  43518. // https://html.spec.whatwg.org/multipage/forms.html#concept-fe-disabled
  43519. // * option elements in a disabled optgroup
  43520. // https://html.spec.whatwg.org/multipage/forms.html#concept-option-disabled
  43521. // All such elements have a "form" property.
  43522. if ( elem.parentNode && elem.disabled === false ) {
  43523. // Option elements defer to a parent optgroup if present
  43524. if ( "label" in elem ) {
  43525. if ( "label" in elem.parentNode ) {
  43526. return elem.parentNode.disabled === disabled;
  43527. } else {
  43528. return elem.disabled === disabled;
  43529. }
  43530. }
  43531. // Support: IE 6 - 11
  43532. // Use the isDisabled shortcut property to check for disabled fieldset ancestors
  43533. return elem.isDisabled === disabled ||
  43534. // Where there is no isDisabled, check manually
  43535. /* jshint -W018 */
  43536. elem.isDisabled !== !disabled &&
  43537. disabledAncestor( elem ) === disabled;
  43538. }
  43539. return elem.disabled === disabled;
  43540. // Try to winnow out elements that can't be disabled before trusting the disabled property.
  43541. // Some victims get caught in our net (label, legend, menu, track), but it shouldn't
  43542. // even exist on them, let alone have a boolean value.
  43543. } else if ( "label" in elem ) {
  43544. return elem.disabled === disabled;
  43545. }
  43546. // Remaining elements are neither :enabled nor :disabled
  43547. return false;
  43548. };
  43549. }
  43550. /**
  43551. * Returns a function to use in pseudos for positionals
  43552. * @param {Function} fn
  43553. */
  43554. function createPositionalPseudo( fn ) {
  43555. return markFunction(function( argument ) {
  43556. argument = +argument;
  43557. return markFunction(function( seed, matches ) {
  43558. var j,
  43559. matchIndexes = fn( [], seed.length, argument ),
  43560. i = matchIndexes.length;
  43561. // Match elements found at the specified indexes
  43562. while ( i-- ) {
  43563. if ( seed[ (j = matchIndexes[i]) ] ) {
  43564. seed[j] = !(matches[j] = seed[j]);
  43565. }
  43566. }
  43567. });
  43568. });
  43569. }
  43570. /**
  43571. * Checks a node for validity as a Sizzle context
  43572. * @param {Element|Object=} context
  43573. * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value
  43574. */
  43575. function testContext( context ) {
  43576. return context && typeof context.getElementsByTagName !== "undefined" && context;
  43577. }
  43578. // Expose support vars for convenience
  43579. support = Sizzle.support = {};
  43580. /**
  43581. * Detects XML nodes
  43582. * @param {Element|Object} elem An element or a document
  43583. * @returns {Boolean} True iff elem is a non-HTML XML node
  43584. */
  43585. isXML = Sizzle.isXML = function( elem ) {
  43586. // documentElement is verified for cases where it doesn't yet exist
  43587. // (such as loading iframes in IE - #4833)
  43588. var documentElement = elem && (elem.ownerDocument || elem).documentElement;
  43589. return documentElement ? documentElement.nodeName !== "HTML" : false;
  43590. };
  43591. /**
  43592. * Sets document-related variables once based on the current document
  43593. * @param {Element|Object} [doc] An element or document object to use to set the document
  43594. * @returns {Object} Returns the current document
  43595. */
  43596. setDocument = Sizzle.setDocument = function( node ) {
  43597. var hasCompare, subWindow,
  43598. doc = node ? node.ownerDocument || node : preferredDoc;
  43599. // Return early if doc is invalid or already selected
  43600. if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) {
  43601. return document;
  43602. }
  43603. // Update global variables
  43604. document = doc;
  43605. docElem = document.documentElement;
  43606. documentIsHTML = !isXML( document );
  43607. // Support: IE 9-11, Edge
  43608. // Accessing iframe documents after unload throws "permission denied" errors (jQuery #13936)
  43609. if ( preferredDoc !== document &&
  43610. (subWindow = document.defaultView) && subWindow.top !== subWindow ) {
  43611. // Support: IE 11, Edge
  43612. if ( subWindow.addEventListener ) {
  43613. subWindow.addEventListener( "unload", unloadHandler, false );
  43614. // Support: IE 9 - 10 only
  43615. } else if ( subWindow.attachEvent ) {
  43616. subWindow.attachEvent( "onunload", unloadHandler );
  43617. }
  43618. }
  43619. /* Attributes
  43620. ---------------------------------------------------------------------- */
  43621. // Support: IE<8
  43622. // Verify that getAttribute really returns attributes and not properties
  43623. // (excepting IE8 booleans)
  43624. support.attributes = assert(function( el ) {
  43625. el.className = "i";
  43626. return !el.getAttribute("className");
  43627. });
  43628. /* getElement(s)By*
  43629. ---------------------------------------------------------------------- */
  43630. // Check if getElementsByTagName("*") returns only elements
  43631. support.getElementsByTagName = assert(function( el ) {
  43632. el.appendChild( document.createComment("") );
  43633. return !el.getElementsByTagName("*").length;
  43634. });
  43635. // Support: IE<9
  43636. support.getElementsByClassName = rnative.test( document.getElementsByClassName );
  43637. // Support: IE<10
  43638. // Check if getElementById returns elements by name
  43639. // The broken getElementById methods don't pick up programmatically-set names,
  43640. // so use a roundabout getElementsByName test
  43641. support.getById = assert(function( el ) {
  43642. docElem.appendChild( el ).id = expando;
  43643. return !document.getElementsByName || !document.getElementsByName( expando ).length;
  43644. });
  43645. // ID filter and find
  43646. if ( support.getById ) {
  43647. Expr.filter["ID"] = function( id ) {
  43648. var attrId = id.replace( runescape, funescape );
  43649. return function( elem ) {
  43650. return elem.getAttribute("id") === attrId;
  43651. };
  43652. };
  43653. Expr.find["ID"] = function( id, context ) {
  43654. if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
  43655. var elem = context.getElementById( id );
  43656. return elem ? [ elem ] : [];
  43657. }
  43658. };
  43659. } else {
  43660. Expr.filter["ID"] = function( id ) {
  43661. var attrId = id.replace( runescape, funescape );
  43662. return function( elem ) {
  43663. var node = typeof elem.getAttributeNode !== "undefined" &&
  43664. elem.getAttributeNode("id");
  43665. return node && node.value === attrId;
  43666. };
  43667. };
  43668. // Support: IE 6 - 7 only
  43669. // getElementById is not reliable as a find shortcut
  43670. Expr.find["ID"] = function( id, context ) {
  43671. if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
  43672. var node, i, elems,
  43673. elem = context.getElementById( id );
  43674. if ( elem ) {
  43675. // Verify the id attribute
  43676. node = elem.getAttributeNode("id");
  43677. if ( node && node.value === id ) {
  43678. return [ elem ];
  43679. }
  43680. // Fall back on getElementsByName
  43681. elems = context.getElementsByName( id );
  43682. i = 0;
  43683. while ( (elem = elems[i++]) ) {
  43684. node = elem.getAttributeNode("id");
  43685. if ( node && node.value === id ) {
  43686. return [ elem ];
  43687. }
  43688. }
  43689. }
  43690. return [];
  43691. }
  43692. };
  43693. }
  43694. // Tag
  43695. Expr.find["TAG"] = support.getElementsByTagName ?
  43696. function( tag, context ) {
  43697. if ( typeof context.getElementsByTagName !== "undefined" ) {
  43698. return context.getElementsByTagName( tag );
  43699. // DocumentFragment nodes don't have gEBTN
  43700. } else if ( support.qsa ) {
  43701. return context.querySelectorAll( tag );
  43702. }
  43703. } :
  43704. function( tag, context ) {
  43705. var elem,
  43706. tmp = [],
  43707. i = 0,
  43708. // By happy coincidence, a (broken) gEBTN appears on DocumentFragment nodes too
  43709. results = context.getElementsByTagName( tag );
  43710. // Filter out possible comments
  43711. if ( tag === "*" ) {
  43712. while ( (elem = results[i++]) ) {
  43713. if ( elem.nodeType === 1 ) {
  43714. tmp.push( elem );
  43715. }
  43716. }
  43717. return tmp;
  43718. }
  43719. return results;
  43720. };
  43721. // Class
  43722. Expr.find["CLASS"] = support.getElementsByClassName && function( className, context ) {
  43723. if ( typeof context.getElementsByClassName !== "undefined" && documentIsHTML ) {
  43724. return context.getElementsByClassName( className );
  43725. }
  43726. };
  43727. /* QSA/matchesSelector
  43728. ---------------------------------------------------------------------- */
  43729. // QSA and matchesSelector support
  43730. // matchesSelector(:active) reports false when true (IE9/Opera 11.5)
  43731. rbuggyMatches = [];
  43732. // qSa(:focus) reports false when true (Chrome 21)
  43733. // We allow this because of a bug in IE8/9 that throws an error
  43734. // whenever `document.activeElement` is accessed on an iframe
  43735. // So, we allow :focus to pass through QSA all the time to avoid the IE error
  43736. // See https://bugs.jquery.com/ticket/13378
  43737. rbuggyQSA = [];
  43738. if ( (support.qsa = rnative.test( document.querySelectorAll )) ) {
  43739. // Build QSA regex
  43740. // Regex strategy adopted from Diego Perini
  43741. assert(function( el ) {
  43742. // Select is set to empty string on purpose
  43743. // This is to test IE's treatment of not explicitly
  43744. // setting a boolean content attribute,
  43745. // since its presence should be enough
  43746. // https://bugs.jquery.com/ticket/12359
  43747. docElem.appendChild( el ).innerHTML = "<a id='" + expando + "'></a>" +
  43748. "<select id='" + expando + "-\r\\' msallowcapture=''>" +
  43749. "<option selected=''></option></select>";
  43750. // Support: IE8, Opera 11-12.16
  43751. // Nothing should be selected when empty strings follow ^= or $= or *=
  43752. // The test attribute must be unknown in Opera but "safe" for WinRT
  43753. // https://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section
  43754. if ( el.querySelectorAll("[msallowcapture^='']").length ) {
  43755. rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" );
  43756. }
  43757. // Support: IE8
  43758. // Boolean attributes and "value" are not treated correctly
  43759. if ( !el.querySelectorAll("[selected]").length ) {
  43760. rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" );
  43761. }
  43762. // Support: Chrome<29, Android<4.4, Safari<7.0+, iOS<7.0+, PhantomJS<1.9.8+
  43763. if ( !el.querySelectorAll( "[id~=" + expando + "-]" ).length ) {
  43764. rbuggyQSA.push("~=");
  43765. }
  43766. // Webkit/Opera - :checked should return selected option elements
  43767. // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
  43768. // IE8 throws error here and will not see later tests
  43769. if ( !el.querySelectorAll(":checked").length ) {
  43770. rbuggyQSA.push(":checked");
  43771. }
  43772. // Support: Safari 8+, iOS 8+
  43773. // https://bugs.webkit.org/show_bug.cgi?id=136851
  43774. // In-page `selector#id sibling-combinator selector` fails
  43775. if ( !el.querySelectorAll( "a#" + expando + "+*" ).length ) {
  43776. rbuggyQSA.push(".#.+[+~]");
  43777. }
  43778. });
  43779. assert(function( el ) {
  43780. el.innerHTML = "<a href='' disabled='disabled'></a>" +
  43781. "<select disabled='disabled'><option/></select>";
  43782. // Support: Windows 8 Native Apps
  43783. // The type and name attributes are restricted during .innerHTML assignment
  43784. var input = document.createElement("input");
  43785. input.setAttribute( "type", "hidden" );
  43786. el.appendChild( input ).setAttribute( "name", "D" );
  43787. // Support: IE8
  43788. // Enforce case-sensitivity of name attribute
  43789. if ( el.querySelectorAll("[name=d]").length ) {
  43790. rbuggyQSA.push( "name" + whitespace + "*[*^$|!~]?=" );
  43791. }
  43792. // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled)
  43793. // IE8 throws error here and will not see later tests
  43794. if ( el.querySelectorAll(":enabled").length !== 2 ) {
  43795. rbuggyQSA.push( ":enabled", ":disabled" );
  43796. }
  43797. // Support: IE9-11+
  43798. // IE's :disabled selector does not pick up the children of disabled fieldsets
  43799. docElem.appendChild( el ).disabled = true;
  43800. if ( el.querySelectorAll(":disabled").length !== 2 ) {
  43801. rbuggyQSA.push( ":enabled", ":disabled" );
  43802. }
  43803. // Opera 10-11 does not throw on post-comma invalid pseudos
  43804. el.querySelectorAll("*,:x");
  43805. rbuggyQSA.push(",.*:");
  43806. });
  43807. }
  43808. if ( (support.matchesSelector = rnative.test( (matches = docElem.matches ||
  43809. docElem.webkitMatchesSelector ||
  43810. docElem.mozMatchesSelector ||
  43811. docElem.oMatchesSelector ||
  43812. docElem.msMatchesSelector) )) ) {
  43813. assert(function( el ) {
  43814. // Check to see if it's possible to do matchesSelector
  43815. // on a disconnected node (IE 9)
  43816. support.disconnectedMatch = matches.call( el, "*" );
  43817. // This should fail with an exception
  43818. // Gecko does not error, returns false instead
  43819. matches.call( el, "[s!='']:x" );
  43820. rbuggyMatches.push( "!=", pseudos );
  43821. });
  43822. }
  43823. rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join("|") );
  43824. rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join("|") );
  43825. /* Contains
  43826. ---------------------------------------------------------------------- */
  43827. hasCompare = rnative.test( docElem.compareDocumentPosition );
  43828. // Element contains another
  43829. // Purposefully self-exclusive
  43830. // As in, an element does not contain itself
  43831. contains = hasCompare || rnative.test( docElem.contains ) ?
  43832. function( a, b ) {
  43833. var adown = a.nodeType === 9 ? a.documentElement : a,
  43834. bup = b && b.parentNode;
  43835. return a === bup || !!( bup && bup.nodeType === 1 && (
  43836. adown.contains ?
  43837. adown.contains( bup ) :
  43838. a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16
  43839. ));
  43840. } :
  43841. function( a, b ) {
  43842. if ( b ) {
  43843. while ( (b = b.parentNode) ) {
  43844. if ( b === a ) {
  43845. return true;
  43846. }
  43847. }
  43848. }
  43849. return false;
  43850. };
  43851. /* Sorting
  43852. ---------------------------------------------------------------------- */
  43853. // Document order sorting
  43854. sortOrder = hasCompare ?
  43855. function( a, b ) {
  43856. // Flag for duplicate removal
  43857. if ( a === b ) {
  43858. hasDuplicate = true;
  43859. return 0;
  43860. }
  43861. // Sort on method existence if only one input has compareDocumentPosition
  43862. var compare = !a.compareDocumentPosition - !b.compareDocumentPosition;
  43863. if ( compare ) {
  43864. return compare;
  43865. }
  43866. // Calculate position if both inputs belong to the same document
  43867. compare = ( a.ownerDocument || a ) === ( b.ownerDocument || b ) ?
  43868. a.compareDocumentPosition( b ) :
  43869. // Otherwise we know they are disconnected
  43870. 1;
  43871. // Disconnected nodes
  43872. if ( compare & 1 ||
  43873. (!support.sortDetached && b.compareDocumentPosition( a ) === compare) ) {
  43874. // Choose the first element that is related to our preferred document
  43875. if ( a === document || a.ownerDocument === preferredDoc && contains(preferredDoc, a) ) {
  43876. return -1;
  43877. }
  43878. if ( b === document || b.ownerDocument === preferredDoc && contains(preferredDoc, b) ) {
  43879. return 1;
  43880. }
  43881. // Maintain original order
  43882. return sortInput ?
  43883. ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
  43884. 0;
  43885. }
  43886. return compare & 4 ? -1 : 1;
  43887. } :
  43888. function( a, b ) {
  43889. // Exit early if the nodes are identical
  43890. if ( a === b ) {
  43891. hasDuplicate = true;
  43892. return 0;
  43893. }
  43894. var cur,
  43895. i = 0,
  43896. aup = a.parentNode,
  43897. bup = b.parentNode,
  43898. ap = [ a ],
  43899. bp = [ b ];
  43900. // Parentless nodes are either documents or disconnected
  43901. if ( !aup || !bup ) {
  43902. return a === document ? -1 :
  43903. b === document ? 1 :
  43904. aup ? -1 :
  43905. bup ? 1 :
  43906. sortInput ?
  43907. ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
  43908. 0;
  43909. // If the nodes are siblings, we can do a quick check
  43910. } else if ( aup === bup ) {
  43911. return siblingCheck( a, b );
  43912. }
  43913. // Otherwise we need full lists of their ancestors for comparison
  43914. cur = a;
  43915. while ( (cur = cur.parentNode) ) {
  43916. ap.unshift( cur );
  43917. }
  43918. cur = b;
  43919. while ( (cur = cur.parentNode) ) {
  43920. bp.unshift( cur );
  43921. }
  43922. // Walk down the tree looking for a discrepancy
  43923. while ( ap[i] === bp[i] ) {
  43924. i++;
  43925. }
  43926. return i ?
  43927. // Do a sibling check if the nodes have a common ancestor
  43928. siblingCheck( ap[i], bp[i] ) :
  43929. // Otherwise nodes in our document sort first
  43930. ap[i] === preferredDoc ? -1 :
  43931. bp[i] === preferredDoc ? 1 :
  43932. 0;
  43933. };
  43934. return document;
  43935. };
  43936. Sizzle.matches = function( expr, elements ) {
  43937. return Sizzle( expr, null, null, elements );
  43938. };
  43939. Sizzle.matchesSelector = function( elem, expr ) {
  43940. // Set document vars if needed
  43941. if ( ( elem.ownerDocument || elem ) !== document ) {
  43942. setDocument( elem );
  43943. }
  43944. // Make sure that attribute selectors are quoted
  43945. expr = expr.replace( rattributeQuotes, "='$1']" );
  43946. if ( support.matchesSelector && documentIsHTML &&
  43947. !compilerCache[ expr + " " ] &&
  43948. ( !rbuggyMatches || !rbuggyMatches.test( expr ) ) &&
  43949. ( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) {
  43950. try {
  43951. var ret = matches.call( elem, expr );
  43952. // IE 9's matchesSelector returns false on disconnected nodes
  43953. if ( ret || support.disconnectedMatch ||
  43954. // As well, disconnected nodes are said to be in a document
  43955. // fragment in IE 9
  43956. elem.document && elem.document.nodeType !== 11 ) {
  43957. return ret;
  43958. }
  43959. } catch (e) {}
  43960. }
  43961. return Sizzle( expr, document, null, [ elem ] ).length > 0;
  43962. };
  43963. Sizzle.contains = function( context, elem ) {
  43964. // Set document vars if needed
  43965. if ( ( context.ownerDocument || context ) !== document ) {
  43966. setDocument( context );
  43967. }
  43968. return contains( context, elem );
  43969. };
  43970. Sizzle.attr = function( elem, name ) {
  43971. // Set document vars if needed
  43972. if ( ( elem.ownerDocument || elem ) !== document ) {
  43973. setDocument( elem );
  43974. }
  43975. var fn = Expr.attrHandle[ name.toLowerCase() ],
  43976. // Don't get fooled by Object.prototype properties (jQuery #13807)
  43977. val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ?
  43978. fn( elem, name, !documentIsHTML ) :
  43979. undefined;
  43980. return val !== undefined ?
  43981. val :
  43982. support.attributes || !documentIsHTML ?
  43983. elem.getAttribute( name ) :
  43984. (val = elem.getAttributeNode(name)) && val.specified ?
  43985. val.value :
  43986. null;
  43987. };
  43988. Sizzle.escape = function( sel ) {
  43989. return (sel + "").replace( rcssescape, fcssescape );
  43990. };
  43991. Sizzle.error = function( msg ) {
  43992. throw new Error( "Syntax error, unrecognized expression: " + msg );
  43993. };
  43994. /**
  43995. * Document sorting and removing duplicates
  43996. * @param {ArrayLike} results
  43997. */
  43998. Sizzle.uniqueSort = function( results ) {
  43999. var elem,
  44000. duplicates = [],
  44001. j = 0,
  44002. i = 0;
  44003. // Unless we *know* we can detect duplicates, assume their presence
  44004. hasDuplicate = !support.detectDuplicates;
  44005. sortInput = !support.sortStable && results.slice( 0 );
  44006. results.sort( sortOrder );
  44007. if ( hasDuplicate ) {
  44008. while ( (elem = results[i++]) ) {
  44009. if ( elem === results[ i ] ) {
  44010. j = duplicates.push( i );
  44011. }
  44012. }
  44013. while ( j-- ) {
  44014. results.splice( duplicates[ j ], 1 );
  44015. }
  44016. }
  44017. // Clear input after sorting to release objects
  44018. // See https://github.com/jquery/sizzle/pull/225
  44019. sortInput = null;
  44020. return results;
  44021. };
  44022. /**
  44023. * Utility function for retrieving the text value of an array of DOM nodes
  44024. * @param {Array|Element} elem
  44025. */
  44026. getText = Sizzle.getText = function( elem ) {
  44027. var node,
  44028. ret = "",
  44029. i = 0,
  44030. nodeType = elem.nodeType;
  44031. if ( !nodeType ) {
  44032. // If no nodeType, this is expected to be an array
  44033. while ( (node = elem[i++]) ) {
  44034. // Do not traverse comment nodes
  44035. ret += getText( node );
  44036. }
  44037. } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) {
  44038. // Use textContent for elements
  44039. // innerText usage removed for consistency of new lines (jQuery #11153)
  44040. if ( typeof elem.textContent === "string" ) {
  44041. return elem.textContent;
  44042. } else {
  44043. // Traverse its children
  44044. for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
  44045. ret += getText( elem );
  44046. }
  44047. }
  44048. } else if ( nodeType === 3 || nodeType === 4 ) {
  44049. return elem.nodeValue;
  44050. }
  44051. // Do not include comment or processing instruction nodes
  44052. return ret;
  44053. };
  44054. Expr = Sizzle.selectors = {
  44055. // Can be adjusted by the user
  44056. cacheLength: 50,
  44057. createPseudo: markFunction,
  44058. match: matchExpr,
  44059. attrHandle: {},
  44060. find: {},
  44061. relative: {
  44062. ">": { dir: "parentNode", first: true },
  44063. " ": { dir: "parentNode" },
  44064. "+": { dir: "previousSibling", first: true },
  44065. "~": { dir: "previousSibling" }
  44066. },
  44067. preFilter: {
  44068. "ATTR": function( match ) {
  44069. match[1] = match[1].replace( runescape, funescape );
  44070. // Move the given value to match[3] whether quoted or unquoted
  44071. match[3] = ( match[3] || match[4] || match[5] || "" ).replace( runescape, funescape );
  44072. if ( match[2] === "~=" ) {
  44073. match[3] = " " + match[3] + " ";
  44074. }
  44075. return match.slice( 0, 4 );
  44076. },
  44077. "CHILD": function( match ) {
  44078. /* matches from matchExpr["CHILD"]
  44079. 1 type (only|nth|...)
  44080. 2 what (child|of-type)
  44081. 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...)
  44082. 4 xn-component of xn+y argument ([+-]?\d*n|)
  44083. 5 sign of xn-component
  44084. 6 x of xn-component
  44085. 7 sign of y-component
  44086. 8 y of y-component
  44087. */
  44088. match[1] = match[1].toLowerCase();
  44089. if ( match[1].slice( 0, 3 ) === "nth" ) {
  44090. // nth-* requires argument
  44091. if ( !match[3] ) {
  44092. Sizzle.error( match[0] );
  44093. }
  44094. // numeric x and y parameters for Expr.filter.CHILD
  44095. // remember that false/true cast respectively to 0/1
  44096. match[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === "even" || match[3] === "odd" ) );
  44097. match[5] = +( ( match[7] + match[8] ) || match[3] === "odd" );
  44098. // other types prohibit arguments
  44099. } else if ( match[3] ) {
  44100. Sizzle.error( match[0] );
  44101. }
  44102. return match;
  44103. },
  44104. "PSEUDO": function( match ) {
  44105. var excess,
  44106. unquoted = !match[6] && match[2];
  44107. if ( matchExpr["CHILD"].test( match[0] ) ) {
  44108. return null;
  44109. }
  44110. // Accept quoted arguments as-is
  44111. if ( match[3] ) {
  44112. match[2] = match[4] || match[5] || "";
  44113. // Strip excess characters from unquoted arguments
  44114. } else if ( unquoted && rpseudo.test( unquoted ) &&
  44115. // Get excess from tokenize (recursively)
  44116. (excess = tokenize( unquoted, true )) &&
  44117. // advance to the next closing parenthesis
  44118. (excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) {
  44119. // excess is a negative index
  44120. match[0] = match[0].slice( 0, excess );
  44121. match[2] = unquoted.slice( 0, excess );
  44122. }
  44123. // Return only captures needed by the pseudo filter method (type and argument)
  44124. return match.slice( 0, 3 );
  44125. }
  44126. },
  44127. filter: {
  44128. "TAG": function( nodeNameSelector ) {
  44129. var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase();
  44130. return nodeNameSelector === "*" ?
  44131. function() { return true; } :
  44132. function( elem ) {
  44133. return elem.nodeName && elem.nodeName.toLowerCase() === nodeName;
  44134. };
  44135. },
  44136. "CLASS": function( className ) {
  44137. var pattern = classCache[ className + " " ];
  44138. return pattern ||
  44139. (pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) &&
  44140. classCache( className, function( elem ) {
  44141. return pattern.test( typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== "undefined" && elem.getAttribute("class") || "" );
  44142. });
  44143. },
  44144. "ATTR": function( name, operator, check ) {
  44145. return function( elem ) {
  44146. var result = Sizzle.attr( elem, name );
  44147. if ( result == null ) {
  44148. return operator === "!=";
  44149. }
  44150. if ( !operator ) {
  44151. return true;
  44152. }
  44153. result += "";
  44154. return operator === "=" ? result === check :
  44155. operator === "!=" ? result !== check :
  44156. operator === "^=" ? check && result.indexOf( check ) === 0 :
  44157. operator === "*=" ? check && result.indexOf( check ) > -1 :
  44158. operator === "$=" ? check && result.slice( -check.length ) === check :
  44159. operator === "~=" ? ( " " + result.replace( rwhitespace, " " ) + " " ).indexOf( check ) > -1 :
  44160. operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" :
  44161. false;
  44162. };
  44163. },
  44164. "CHILD": function( type, what, argument, first, last ) {
  44165. var simple = type.slice( 0, 3 ) !== "nth",
  44166. forward = type.slice( -4 ) !== "last",
  44167. ofType = what === "of-type";
  44168. return first === 1 && last === 0 ?
  44169. // Shortcut for :nth-*(n)
  44170. function( elem ) {
  44171. return !!elem.parentNode;
  44172. } :
  44173. function( elem, context, xml ) {
  44174. var cache, uniqueCache, outerCache, node, nodeIndex, start,
  44175. dir = simple !== forward ? "nextSibling" : "previousSibling",
  44176. parent = elem.parentNode,
  44177. name = ofType && elem.nodeName.toLowerCase(),
  44178. useCache = !xml && !ofType,
  44179. diff = false;
  44180. if ( parent ) {
  44181. // :(first|last|only)-(child|of-type)
  44182. if ( simple ) {
  44183. while ( dir ) {
  44184. node = elem;
  44185. while ( (node = node[ dir ]) ) {
  44186. if ( ofType ?
  44187. node.nodeName.toLowerCase() === name :
  44188. node.nodeType === 1 ) {
  44189. return false;
  44190. }
  44191. }
  44192. // Reverse direction for :only-* (if we haven't yet done so)
  44193. start = dir = type === "only" && !start && "nextSibling";
  44194. }
  44195. return true;
  44196. }
  44197. start = [ forward ? parent.firstChild : parent.lastChild ];
  44198. // non-xml :nth-child(...) stores cache data on `parent`
  44199. if ( forward && useCache ) {
  44200. // Seek `elem` from a previously-cached index
  44201. // ...in a gzip-friendly way
  44202. node = parent;
  44203. outerCache = node[ expando ] || (node[ expando ] = {});
  44204. // Support: IE <9 only
  44205. // Defend against cloned attroperties (jQuery gh-1709)
  44206. uniqueCache = outerCache[ node.uniqueID ] ||
  44207. (outerCache[ node.uniqueID ] = {});
  44208. cache = uniqueCache[ type ] || [];
  44209. nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
  44210. diff = nodeIndex && cache[ 2 ];
  44211. node = nodeIndex && parent.childNodes[ nodeIndex ];
  44212. while ( (node = ++nodeIndex && node && node[ dir ] ||
  44213. // Fallback to seeking `elem` from the start
  44214. (diff = nodeIndex = 0) || start.pop()) ) {
  44215. // When found, cache indexes on `parent` and break
  44216. if ( node.nodeType === 1 && ++diff && node === elem ) {
  44217. uniqueCache[ type ] = [ dirruns, nodeIndex, diff ];
  44218. break;
  44219. }
  44220. }
  44221. } else {
  44222. // Use previously-cached element index if available
  44223. if ( useCache ) {
  44224. // ...in a gzip-friendly way
  44225. node = elem;
  44226. outerCache = node[ expando ] || (node[ expando ] = {});
  44227. // Support: IE <9 only
  44228. // Defend against cloned attroperties (jQuery gh-1709)
  44229. uniqueCache = outerCache[ node.uniqueID ] ||
  44230. (outerCache[ node.uniqueID ] = {});
  44231. cache = uniqueCache[ type ] || [];
  44232. nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
  44233. diff = nodeIndex;
  44234. }
  44235. // xml :nth-child(...)
  44236. // or :nth-last-child(...) or :nth(-last)?-of-type(...)
  44237. if ( diff === false ) {
  44238. // Use the same loop as above to seek `elem` from the start
  44239. while ( (node = ++nodeIndex && node && node[ dir ] ||
  44240. (diff = nodeIndex = 0) || start.pop()) ) {
  44241. if ( ( ofType ?
  44242. node.nodeName.toLowerCase() === name :
  44243. node.nodeType === 1 ) &&
  44244. ++diff ) {
  44245. // Cache the index of each encountered element
  44246. if ( useCache ) {
  44247. outerCache = node[ expando ] || (node[ expando ] = {});
  44248. // Support: IE <9 only
  44249. // Defend against cloned attroperties (jQuery gh-1709)
  44250. uniqueCache = outerCache[ node.uniqueID ] ||
  44251. (outerCache[ node.uniqueID ] = {});
  44252. uniqueCache[ type ] = [ dirruns, diff ];
  44253. }
  44254. if ( node === elem ) {
  44255. break;
  44256. }
  44257. }
  44258. }
  44259. }
  44260. }
  44261. // Incorporate the offset, then check against cycle size
  44262. diff -= last;
  44263. return diff === first || ( diff % first === 0 && diff / first >= 0 );
  44264. }
  44265. };
  44266. },
  44267. "PSEUDO": function( pseudo, argument ) {
  44268. // pseudo-class names are case-insensitive
  44269. // http://www.w3.org/TR/selectors/#pseudo-classes
  44270. // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters
  44271. // Remember that setFilters inherits from pseudos
  44272. var args,
  44273. fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] ||
  44274. Sizzle.error( "unsupported pseudo: " + pseudo );
  44275. // The user may use createPseudo to indicate that
  44276. // arguments are needed to create the filter function
  44277. // just as Sizzle does
  44278. if ( fn[ expando ] ) {
  44279. return fn( argument );
  44280. }
  44281. // But maintain support for old signatures
  44282. if ( fn.length > 1 ) {
  44283. args = [ pseudo, pseudo, "", argument ];
  44284. return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ?
  44285. markFunction(function( seed, matches ) {
  44286. var idx,
  44287. matched = fn( seed, argument ),
  44288. i = matched.length;
  44289. while ( i-- ) {
  44290. idx = indexOf( seed, matched[i] );
  44291. seed[ idx ] = !( matches[ idx ] = matched[i] );
  44292. }
  44293. }) :
  44294. function( elem ) {
  44295. return fn( elem, 0, args );
  44296. };
  44297. }
  44298. return fn;
  44299. }
  44300. },
  44301. pseudos: {
  44302. // Potentially complex pseudos
  44303. "not": markFunction(function( selector ) {
  44304. // Trim the selector passed to compile
  44305. // to avoid treating leading and trailing
  44306. // spaces as combinators
  44307. var input = [],
  44308. results = [],
  44309. matcher = compile( selector.replace( rtrim, "$1" ) );
  44310. return matcher[ expando ] ?
  44311. markFunction(function( seed, matches, context, xml ) {
  44312. var elem,
  44313. unmatched = matcher( seed, null, xml, [] ),
  44314. i = seed.length;
  44315. // Match elements unmatched by `matcher`
  44316. while ( i-- ) {
  44317. if ( (elem = unmatched[i]) ) {
  44318. seed[i] = !(matches[i] = elem);
  44319. }
  44320. }
  44321. }) :
  44322. function( elem, context, xml ) {
  44323. input[0] = elem;
  44324. matcher( input, null, xml, results );
  44325. // Don't keep the element (issue #299)
  44326. input[0] = null;
  44327. return !results.pop();
  44328. };
  44329. }),
  44330. "has": markFunction(function( selector ) {
  44331. return function( elem ) {
  44332. return Sizzle( selector, elem ).length > 0;
  44333. };
  44334. }),
  44335. "contains": markFunction(function( text ) {
  44336. text = text.replace( runescape, funescape );
  44337. return function( elem ) {
  44338. return ( elem.textContent || elem.innerText || getText( elem ) ).indexOf( text ) > -1;
  44339. };
  44340. }),
  44341. // "Whether an element is represented by a :lang() selector
  44342. // is based solely on the element's language value
  44343. // being equal to the identifier C,
  44344. // or beginning with the identifier C immediately followed by "-".
  44345. // The matching of C against the element's language value is performed case-insensitively.
  44346. // The identifier C does not have to be a valid language name."
  44347. // http://www.w3.org/TR/selectors/#lang-pseudo
  44348. "lang": markFunction( function( lang ) {
  44349. // lang value must be a valid identifier
  44350. if ( !ridentifier.test(lang || "") ) {
  44351. Sizzle.error( "unsupported lang: " + lang );
  44352. }
  44353. lang = lang.replace( runescape, funescape ).toLowerCase();
  44354. return function( elem ) {
  44355. var elemLang;
  44356. do {
  44357. if ( (elemLang = documentIsHTML ?
  44358. elem.lang :
  44359. elem.getAttribute("xml:lang") || elem.getAttribute("lang")) ) {
  44360. elemLang = elemLang.toLowerCase();
  44361. return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0;
  44362. }
  44363. } while ( (elem = elem.parentNode) && elem.nodeType === 1 );
  44364. return false;
  44365. };
  44366. }),
  44367. // Miscellaneous
  44368. "target": function( elem ) {
  44369. var hash = window.location && window.location.hash;
  44370. return hash && hash.slice( 1 ) === elem.id;
  44371. },
  44372. "root": function( elem ) {
  44373. return elem === docElem;
  44374. },
  44375. "focus": function( elem ) {
  44376. return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex);
  44377. },
  44378. // Boolean properties
  44379. "enabled": createDisabledPseudo( false ),
  44380. "disabled": createDisabledPseudo( true ),
  44381. "checked": function( elem ) {
  44382. // In CSS3, :checked should return both checked and selected elements
  44383. // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
  44384. var nodeName = elem.nodeName.toLowerCase();
  44385. return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected);
  44386. },
  44387. "selected": function( elem ) {
  44388. // Accessing this property makes selected-by-default
  44389. // options in Safari work properly
  44390. if ( elem.parentNode ) {
  44391. elem.parentNode.selectedIndex;
  44392. }
  44393. return elem.selected === true;
  44394. },
  44395. // Contents
  44396. "empty": function( elem ) {
  44397. // http://www.w3.org/TR/selectors/#empty-pseudo
  44398. // :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5),
  44399. // but not by others (comment: 8; processing instruction: 7; etc.)
  44400. // nodeType < 6 works because attributes (2) do not appear as children
  44401. for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
  44402. if ( elem.nodeType < 6 ) {
  44403. return false;
  44404. }
  44405. }
  44406. return true;
  44407. },
  44408. "parent": function( elem ) {
  44409. return !Expr.pseudos["empty"]( elem );
  44410. },
  44411. // Element/input types
  44412. "header": function( elem ) {
  44413. return rheader.test( elem.nodeName );
  44414. },
  44415. "input": function( elem ) {
  44416. return rinputs.test( elem.nodeName );
  44417. },
  44418. "button": function( elem ) {
  44419. var name = elem.nodeName.toLowerCase();
  44420. return name === "input" && elem.type === "button" || name === "button";
  44421. },
  44422. "text": function( elem ) {
  44423. var attr;
  44424. return elem.nodeName.toLowerCase() === "input" &&
  44425. elem.type === "text" &&
  44426. // Support: IE<8
  44427. // New HTML5 attribute values (e.g., "search") appear with elem.type === "text"
  44428. ( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === "text" );
  44429. },
  44430. // Position-in-collection
  44431. "first": createPositionalPseudo(function() {
  44432. return [ 0 ];
  44433. }),
  44434. "last": createPositionalPseudo(function( matchIndexes, length ) {
  44435. return [ length - 1 ];
  44436. }),
  44437. "eq": createPositionalPseudo(function( matchIndexes, length, argument ) {
  44438. return [ argument < 0 ? argument + length : argument ];
  44439. }),
  44440. "even": createPositionalPseudo(function( matchIndexes, length ) {
  44441. var i = 0;
  44442. for ( ; i < length; i += 2 ) {
  44443. matchIndexes.push( i );
  44444. }
  44445. return matchIndexes;
  44446. }),
  44447. "odd": createPositionalPseudo(function( matchIndexes, length ) {
  44448. var i = 1;
  44449. for ( ; i < length; i += 2 ) {
  44450. matchIndexes.push( i );
  44451. }
  44452. return matchIndexes;
  44453. }),
  44454. "lt": createPositionalPseudo(function( matchIndexes, length, argument ) {
  44455. var i = argument < 0 ? argument + length : argument;
  44456. for ( ; --i >= 0; ) {
  44457. matchIndexes.push( i );
  44458. }
  44459. return matchIndexes;
  44460. }),
  44461. "gt": createPositionalPseudo(function( matchIndexes, length, argument ) {
  44462. var i = argument < 0 ? argument + length : argument;
  44463. for ( ; ++i < length; ) {
  44464. matchIndexes.push( i );
  44465. }
  44466. return matchIndexes;
  44467. })
  44468. }
  44469. };
  44470. Expr.pseudos["nth"] = Expr.pseudos["eq"];
  44471. // Add button/input type pseudos
  44472. for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) {
  44473. Expr.pseudos[ i ] = createInputPseudo( i );
  44474. }
  44475. for ( i in { submit: true, reset: true } ) {
  44476. Expr.pseudos[ i ] = createButtonPseudo( i );
  44477. }
  44478. // Easy API for creating new setFilters
  44479. function setFilters() {}
  44480. setFilters.prototype = Expr.filters = Expr.pseudos;
  44481. Expr.setFilters = new setFilters();
  44482. tokenize = Sizzle.tokenize = function( selector, parseOnly ) {
  44483. var matched, match, tokens, type,
  44484. soFar, groups, preFilters,
  44485. cached = tokenCache[ selector + " " ];
  44486. if ( cached ) {
  44487. return parseOnly ? 0 : cached.slice( 0 );
  44488. }
  44489. soFar = selector;
  44490. groups = [];
  44491. preFilters = Expr.preFilter;
  44492. while ( soFar ) {
  44493. // Comma and first run
  44494. if ( !matched || (match = rcomma.exec( soFar )) ) {
  44495. if ( match ) {
  44496. // Don't consume trailing commas as valid
  44497. soFar = soFar.slice( match[0].length ) || soFar;
  44498. }
  44499. groups.push( (tokens = []) );
  44500. }
  44501. matched = false;
  44502. // Combinators
  44503. if ( (match = rcombinators.exec( soFar )) ) {
  44504. matched = match.shift();
  44505. tokens.push({
  44506. value: matched,
  44507. // Cast descendant combinators to space
  44508. type: match[0].replace( rtrim, " " )
  44509. });
  44510. soFar = soFar.slice( matched.length );
  44511. }
  44512. // Filters
  44513. for ( type in Expr.filter ) {
  44514. if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] ||
  44515. (match = preFilters[ type ]( match ))) ) {
  44516. matched = match.shift();
  44517. tokens.push({
  44518. value: matched,
  44519. type: type,
  44520. matches: match
  44521. });
  44522. soFar = soFar.slice( matched.length );
  44523. }
  44524. }
  44525. if ( !matched ) {
  44526. break;
  44527. }
  44528. }
  44529. // Return the length of the invalid excess
  44530. // if we're just parsing
  44531. // Otherwise, throw an error or return tokens
  44532. return parseOnly ?
  44533. soFar.length :
  44534. soFar ?
  44535. Sizzle.error( selector ) :
  44536. // Cache the tokens
  44537. tokenCache( selector, groups ).slice( 0 );
  44538. };
  44539. function toSelector( tokens ) {
  44540. var i = 0,
  44541. len = tokens.length,
  44542. selector = "";
  44543. for ( ; i < len; i++ ) {
  44544. selector += tokens[i].value;
  44545. }
  44546. return selector;
  44547. }
  44548. function addCombinator( matcher, combinator, base ) {
  44549. var dir = combinator.dir,
  44550. skip = combinator.next,
  44551. key = skip || dir,
  44552. checkNonElements = base && key === "parentNode",
  44553. doneName = done++;
  44554. return combinator.first ?
  44555. // Check against closest ancestor/preceding element
  44556. function( elem, context, xml ) {
  44557. while ( (elem = elem[ dir ]) ) {
  44558. if ( elem.nodeType === 1 || checkNonElements ) {
  44559. return matcher( elem, context, xml );
  44560. }
  44561. }
  44562. return false;
  44563. } :
  44564. // Check against all ancestor/preceding elements
  44565. function( elem, context, xml ) {
  44566. var oldCache, uniqueCache, outerCache,
  44567. newCache = [ dirruns, doneName ];
  44568. // We can't set arbitrary data on XML nodes, so they don't benefit from combinator caching
  44569. if ( xml ) {
  44570. while ( (elem = elem[ dir ]) ) {
  44571. if ( elem.nodeType === 1 || checkNonElements ) {
  44572. if ( matcher( elem, context, xml ) ) {
  44573. return true;
  44574. }
  44575. }
  44576. }
  44577. } else {
  44578. while ( (elem = elem[ dir ]) ) {
  44579. if ( elem.nodeType === 1 || checkNonElements ) {
  44580. outerCache = elem[ expando ] || (elem[ expando ] = {});
  44581. // Support: IE <9 only
  44582. // Defend against cloned attroperties (jQuery gh-1709)
  44583. uniqueCache = outerCache[ elem.uniqueID ] || (outerCache[ elem.uniqueID ] = {});
  44584. if ( skip && skip === elem.nodeName.toLowerCase() ) {
  44585. elem = elem[ dir ] || elem;
  44586. } else if ( (oldCache = uniqueCache[ key ]) &&
  44587. oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) {
  44588. // Assign to newCache so results back-propagate to previous elements
  44589. return (newCache[ 2 ] = oldCache[ 2 ]);
  44590. } else {
  44591. // Reuse newcache so results back-propagate to previous elements
  44592. uniqueCache[ key ] = newCache;
  44593. // A match means we're done; a fail means we have to keep checking
  44594. if ( (newCache[ 2 ] = matcher( elem, context, xml )) ) {
  44595. return true;
  44596. }
  44597. }
  44598. }
  44599. }
  44600. }
  44601. return false;
  44602. };
  44603. }
  44604. function elementMatcher( matchers ) {
  44605. return matchers.length > 1 ?
  44606. function( elem, context, xml ) {
  44607. var i = matchers.length;
  44608. while ( i-- ) {
  44609. if ( !matchers[i]( elem, context, xml ) ) {
  44610. return false;
  44611. }
  44612. }
  44613. return true;
  44614. } :
  44615. matchers[0];
  44616. }
  44617. function multipleContexts( selector, contexts, results ) {
  44618. var i = 0,
  44619. len = contexts.length;
  44620. for ( ; i < len; i++ ) {
  44621. Sizzle( selector, contexts[i], results );
  44622. }
  44623. return results;
  44624. }
  44625. function condense( unmatched, map, filter, context, xml ) {
  44626. var elem,
  44627. newUnmatched = [],
  44628. i = 0,
  44629. len = unmatched.length,
  44630. mapped = map != null;
  44631. for ( ; i < len; i++ ) {
  44632. if ( (elem = unmatched[i]) ) {
  44633. if ( !filter || filter( elem, context, xml ) ) {
  44634. newUnmatched.push( elem );
  44635. if ( mapped ) {
  44636. map.push( i );
  44637. }
  44638. }
  44639. }
  44640. }
  44641. return newUnmatched;
  44642. }
  44643. function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) {
  44644. if ( postFilter && !postFilter[ expando ] ) {
  44645. postFilter = setMatcher( postFilter );
  44646. }
  44647. if ( postFinder && !postFinder[ expando ] ) {
  44648. postFinder = setMatcher( postFinder, postSelector );
  44649. }
  44650. return markFunction(function( seed, results, context, xml ) {
  44651. var temp, i, elem,
  44652. preMap = [],
  44653. postMap = [],
  44654. preexisting = results.length,
  44655. // Get initial elements from seed or context
  44656. elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ),
  44657. // Prefilter to get matcher input, preserving a map for seed-results synchronization
  44658. matcherIn = preFilter && ( seed || !selector ) ?
  44659. condense( elems, preMap, preFilter, context, xml ) :
  44660. elems,
  44661. matcherOut = matcher ?
  44662. // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results,
  44663. postFinder || ( seed ? preFilter : preexisting || postFilter ) ?
  44664. // ...intermediate processing is necessary
  44665. [] :
  44666. // ...otherwise use results directly
  44667. results :
  44668. matcherIn;
  44669. // Find primary matches
  44670. if ( matcher ) {
  44671. matcher( matcherIn, matcherOut, context, xml );
  44672. }
  44673. // Apply postFilter
  44674. if ( postFilter ) {
  44675. temp = condense( matcherOut, postMap );
  44676. postFilter( temp, [], context, xml );
  44677. // Un-match failing elements by moving them back to matcherIn
  44678. i = temp.length;
  44679. while ( i-- ) {
  44680. if ( (elem = temp[i]) ) {
  44681. matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem);
  44682. }
  44683. }
  44684. }
  44685. if ( seed ) {
  44686. if ( postFinder || preFilter ) {
  44687. if ( postFinder ) {
  44688. // Get the final matcherOut by condensing this intermediate into postFinder contexts
  44689. temp = [];
  44690. i = matcherOut.length;
  44691. while ( i-- ) {
  44692. if ( (elem = matcherOut[i]) ) {
  44693. // Restore matcherIn since elem is not yet a final match
  44694. temp.push( (matcherIn[i] = elem) );
  44695. }
  44696. }
  44697. postFinder( null, (matcherOut = []), temp, xml );
  44698. }
  44699. // Move matched elements from seed to results to keep them synchronized
  44700. i = matcherOut.length;
  44701. while ( i-- ) {
  44702. if ( (elem = matcherOut[i]) &&
  44703. (temp = postFinder ? indexOf( seed, elem ) : preMap[i]) > -1 ) {
  44704. seed[temp] = !(results[temp] = elem);
  44705. }
  44706. }
  44707. }
  44708. // Add elements to results, through postFinder if defined
  44709. } else {
  44710. matcherOut = condense(
  44711. matcherOut === results ?
  44712. matcherOut.splice( preexisting, matcherOut.length ) :
  44713. matcherOut
  44714. );
  44715. if ( postFinder ) {
  44716. postFinder( null, results, matcherOut, xml );
  44717. } else {
  44718. push.apply( results, matcherOut );
  44719. }
  44720. }
  44721. });
  44722. }
  44723. function matcherFromTokens( tokens ) {
  44724. var checkContext, matcher, j,
  44725. len = tokens.length,
  44726. leadingRelative = Expr.relative[ tokens[0].type ],
  44727. implicitRelative = leadingRelative || Expr.relative[" "],
  44728. i = leadingRelative ? 1 : 0,
  44729. // The foundational matcher ensures that elements are reachable from top-level context(s)
  44730. matchContext = addCombinator( function( elem ) {
  44731. return elem === checkContext;
  44732. }, implicitRelative, true ),
  44733. matchAnyContext = addCombinator( function( elem ) {
  44734. return indexOf( checkContext, elem ) > -1;
  44735. }, implicitRelative, true ),
  44736. matchers = [ function( elem, context, xml ) {
  44737. var ret = ( !leadingRelative && ( xml || context !== outermostContext ) ) || (
  44738. (checkContext = context).nodeType ?
  44739. matchContext( elem, context, xml ) :
  44740. matchAnyContext( elem, context, xml ) );
  44741. // Avoid hanging onto element (issue #299)
  44742. checkContext = null;
  44743. return ret;
  44744. } ];
  44745. for ( ; i < len; i++ ) {
  44746. if ( (matcher = Expr.relative[ tokens[i].type ]) ) {
  44747. matchers = [ addCombinator(elementMatcher( matchers ), matcher) ];
  44748. } else {
  44749. matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches );
  44750. // Return special upon seeing a positional matcher
  44751. if ( matcher[ expando ] ) {
  44752. // Find the next relative operator (if any) for proper handling
  44753. j = ++i;
  44754. for ( ; j < len; j++ ) {
  44755. if ( Expr.relative[ tokens[j].type ] ) {
  44756. break;
  44757. }
  44758. }
  44759. return setMatcher(
  44760. i > 1 && elementMatcher( matchers ),
  44761. i > 1 && toSelector(
  44762. // If the preceding token was a descendant combinator, insert an implicit any-element `*`
  44763. tokens.slice( 0, i - 1 ).concat({ value: tokens[ i - 2 ].type === " " ? "*" : "" })
  44764. ).replace( rtrim, "$1" ),
  44765. matcher,
  44766. i < j && matcherFromTokens( tokens.slice( i, j ) ),
  44767. j < len && matcherFromTokens( (tokens = tokens.slice( j )) ),
  44768. j < len && toSelector( tokens )
  44769. );
  44770. }
  44771. matchers.push( matcher );
  44772. }
  44773. }
  44774. return elementMatcher( matchers );
  44775. }
  44776. function matcherFromGroupMatchers( elementMatchers, setMatchers ) {
  44777. var bySet = setMatchers.length > 0,
  44778. byElement = elementMatchers.length > 0,
  44779. superMatcher = function( seed, context, xml, results, outermost ) {
  44780. var elem, j, matcher,
  44781. matchedCount = 0,
  44782. i = "0",
  44783. unmatched = seed && [],
  44784. setMatched = [],
  44785. contextBackup = outermostContext,
  44786. // We must always have either seed elements or outermost context
  44787. elems = seed || byElement && Expr.find["TAG"]( "*", outermost ),
  44788. // Use integer dirruns iff this is the outermost matcher
  44789. dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1),
  44790. len = elems.length;
  44791. if ( outermost ) {
  44792. outermostContext = context === document || context || outermost;
  44793. }
  44794. // Add elements passing elementMatchers directly to results
  44795. // Support: IE<9, Safari
  44796. // Tolerate NodeList properties (IE: "length"; Safari: <number>) matching elements by id
  44797. for ( ; i !== len && (elem = elems[i]) != null; i++ ) {
  44798. if ( byElement && elem ) {
  44799. j = 0;
  44800. if ( !context && elem.ownerDocument !== document ) {
  44801. setDocument( elem );
  44802. xml = !documentIsHTML;
  44803. }
  44804. while ( (matcher = elementMatchers[j++]) ) {
  44805. if ( matcher( elem, context || document, xml) ) {
  44806. results.push( elem );
  44807. break;
  44808. }
  44809. }
  44810. if ( outermost ) {
  44811. dirruns = dirrunsUnique;
  44812. }
  44813. }
  44814. // Track unmatched elements for set filters
  44815. if ( bySet ) {
  44816. // They will have gone through all possible matchers
  44817. if ( (elem = !matcher && elem) ) {
  44818. matchedCount--;
  44819. }
  44820. // Lengthen the array for every element, matched or not
  44821. if ( seed ) {
  44822. unmatched.push( elem );
  44823. }
  44824. }
  44825. }
  44826. // `i` is now the count of elements visited above, and adding it to `matchedCount`
  44827. // makes the latter nonnegative.
  44828. matchedCount += i;
  44829. // Apply set filters to unmatched elements
  44830. // NOTE: This can be skipped if there are no unmatched elements (i.e., `matchedCount`
  44831. // equals `i`), unless we didn't visit _any_ elements in the above loop because we have
  44832. // no element matchers and no seed.
  44833. // Incrementing an initially-string "0" `i` allows `i` to remain a string only in that
  44834. // case, which will result in a "00" `matchedCount` that differs from `i` but is also
  44835. // numerically zero.
  44836. if ( bySet && i !== matchedCount ) {
  44837. j = 0;
  44838. while ( (matcher = setMatchers[j++]) ) {
  44839. matcher( unmatched, setMatched, context, xml );
  44840. }
  44841. if ( seed ) {
  44842. // Reintegrate element matches to eliminate the need for sorting
  44843. if ( matchedCount > 0 ) {
  44844. while ( i-- ) {
  44845. if ( !(unmatched[i] || setMatched[i]) ) {
  44846. setMatched[i] = pop.call( results );
  44847. }
  44848. }
  44849. }
  44850. // Discard index placeholder values to get only actual matches
  44851. setMatched = condense( setMatched );
  44852. }
  44853. // Add matches to results
  44854. push.apply( results, setMatched );
  44855. // Seedless set matches succeeding multiple successful matchers stipulate sorting
  44856. if ( outermost && !seed && setMatched.length > 0 &&
  44857. ( matchedCount + setMatchers.length ) > 1 ) {
  44858. Sizzle.uniqueSort( results );
  44859. }
  44860. }
  44861. // Override manipulation of globals by nested matchers
  44862. if ( outermost ) {
  44863. dirruns = dirrunsUnique;
  44864. outermostContext = contextBackup;
  44865. }
  44866. return unmatched;
  44867. };
  44868. return bySet ?
  44869. markFunction( superMatcher ) :
  44870. superMatcher;
  44871. }
  44872. compile = Sizzle.compile = function( selector, match /* Internal Use Only */ ) {
  44873. var i,
  44874. setMatchers = [],
  44875. elementMatchers = [],
  44876. cached = compilerCache[ selector + " " ];
  44877. if ( !cached ) {
  44878. // Generate a function of recursive functions that can be used to check each element
  44879. if ( !match ) {
  44880. match = tokenize( selector );
  44881. }
  44882. i = match.length;
  44883. while ( i-- ) {
  44884. cached = matcherFromTokens( match[i] );
  44885. if ( cached[ expando ] ) {
  44886. setMatchers.push( cached );
  44887. } else {
  44888. elementMatchers.push( cached );
  44889. }
  44890. }
  44891. // Cache the compiled function
  44892. cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) );
  44893. // Save selector and tokenization
  44894. cached.selector = selector;
  44895. }
  44896. return cached;
  44897. };
  44898. /**
  44899. * A low-level selection function that works with Sizzle's compiled
  44900. * selector functions
  44901. * @param {String|Function} selector A selector or a pre-compiled
  44902. * selector function built with Sizzle.compile
  44903. * @param {Element} context
  44904. * @param {Array} [results]
  44905. * @param {Array} [seed] A set of elements to match against
  44906. */
  44907. select = Sizzle.select = function( selector, context, results, seed ) {
  44908. var i, tokens, token, type, find,
  44909. compiled = typeof selector === "function" && selector,
  44910. match = !seed && tokenize( (selector = compiled.selector || selector) );
  44911. results = results || [];
  44912. // Try to minimize operations if there is only one selector in the list and no seed
  44913. // (the latter of which guarantees us context)
  44914. if ( match.length === 1 ) {
  44915. // Reduce context if the leading compound selector is an ID
  44916. tokens = match[0] = match[0].slice( 0 );
  44917. if ( tokens.length > 2 && (token = tokens[0]).type === "ID" &&
  44918. context.nodeType === 9 && documentIsHTML && Expr.relative[ tokens[1].type ] ) {
  44919. context = ( Expr.find["ID"]( token.matches[0].replace(runescape, funescape), context ) || [] )[0];
  44920. if ( !context ) {
  44921. return results;
  44922. // Precompiled matchers will still verify ancestry, so step up a level
  44923. } else if ( compiled ) {
  44924. context = context.parentNode;
  44925. }
  44926. selector = selector.slice( tokens.shift().value.length );
  44927. }
  44928. // Fetch a seed set for right-to-left matching
  44929. i = matchExpr["needsContext"].test( selector ) ? 0 : tokens.length;
  44930. while ( i-- ) {
  44931. token = tokens[i];
  44932. // Abort if we hit a combinator
  44933. if ( Expr.relative[ (type = token.type) ] ) {
  44934. break;
  44935. }
  44936. if ( (find = Expr.find[ type ]) ) {
  44937. // Search, expanding context for leading sibling combinators
  44938. if ( (seed = find(
  44939. token.matches[0].replace( runescape, funescape ),
  44940. rsibling.test( tokens[0].type ) && testContext( context.parentNode ) || context
  44941. )) ) {
  44942. // If seed is empty or no tokens remain, we can return early
  44943. tokens.splice( i, 1 );
  44944. selector = seed.length && toSelector( tokens );
  44945. if ( !selector ) {
  44946. push.apply( results, seed );
  44947. return results;
  44948. }
  44949. break;
  44950. }
  44951. }
  44952. }
  44953. }
  44954. // Compile and execute a filtering function if one is not provided
  44955. // Provide `match` to avoid retokenization if we modified the selector above
  44956. ( compiled || compile( selector, match ) )(
  44957. seed,
  44958. context,
  44959. !documentIsHTML,
  44960. results,
  44961. !context || rsibling.test( selector ) && testContext( context.parentNode ) || context
  44962. );
  44963. return results;
  44964. };
  44965. // One-time assignments
  44966. // Sort stability
  44967. support.sortStable = expando.split("").sort( sortOrder ).join("") === expando;
  44968. // Support: Chrome 14-35+
  44969. // Always assume duplicates if they aren't passed to the comparison function
  44970. support.detectDuplicates = !!hasDuplicate;
  44971. // Initialize against the default document
  44972. setDocument();
  44973. // Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27)
  44974. // Detached nodes confoundingly follow *each other*
  44975. support.sortDetached = assert(function( el ) {
  44976. // Should return 1, but returns 4 (following)
  44977. return el.compareDocumentPosition( document.createElement("fieldset") ) & 1;
  44978. });
  44979. // Support: IE<8
  44980. // Prevent attribute/property "interpolation"
  44981. // https://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx
  44982. if ( !assert(function( el ) {
  44983. el.innerHTML = "<a href='#'></a>";
  44984. return el.firstChild.getAttribute("href") === "#" ;
  44985. }) ) {
  44986. addHandle( "type|href|height|width", function( elem, name, isXML ) {
  44987. if ( !isXML ) {
  44988. return elem.getAttribute( name, name.toLowerCase() === "type" ? 1 : 2 );
  44989. }
  44990. });
  44991. }
  44992. // Support: IE<9
  44993. // Use defaultValue in place of getAttribute("value")
  44994. if ( !support.attributes || !assert(function( el ) {
  44995. el.innerHTML = "<input/>";
  44996. el.firstChild.setAttribute( "value", "" );
  44997. return el.firstChild.getAttribute( "value" ) === "";
  44998. }) ) {
  44999. addHandle( "value", function( elem, name, isXML ) {
  45000. if ( !isXML && elem.nodeName.toLowerCase() === "input" ) {
  45001. return elem.defaultValue;
  45002. }
  45003. });
  45004. }
  45005. // Support: IE<9
  45006. // Use getAttributeNode to fetch booleans when getAttribute lies
  45007. if ( !assert(function( el ) {
  45008. return el.getAttribute("disabled") == null;
  45009. }) ) {
  45010. addHandle( booleans, function( elem, name, isXML ) {
  45011. var val;
  45012. if ( !isXML ) {
  45013. return elem[ name ] === true ? name.toLowerCase() :
  45014. (val = elem.getAttributeNode( name )) && val.specified ?
  45015. val.value :
  45016. null;
  45017. }
  45018. });
  45019. }
  45020. return Sizzle;
  45021. })( window );
  45022. jQuery.find = Sizzle;
  45023. jQuery.expr = Sizzle.selectors;
  45024. // Deprecated
  45025. jQuery.expr[ ":" ] = jQuery.expr.pseudos;
  45026. jQuery.uniqueSort = jQuery.unique = Sizzle.uniqueSort;
  45027. jQuery.text = Sizzle.getText;
  45028. jQuery.isXMLDoc = Sizzle.isXML;
  45029. jQuery.contains = Sizzle.contains;
  45030. jQuery.escapeSelector = Sizzle.escape;
  45031. var dir = function( elem, dir, until ) {
  45032. var matched = [],
  45033. truncate = until !== undefined;
  45034. while ( ( elem = elem[ dir ] ) && elem.nodeType !== 9 ) {
  45035. if ( elem.nodeType === 1 ) {
  45036. if ( truncate && jQuery( elem ).is( until ) ) {
  45037. break;
  45038. }
  45039. matched.push( elem );
  45040. }
  45041. }
  45042. return matched;
  45043. };
  45044. var siblings = function( n, elem ) {
  45045. var matched = [];
  45046. for ( ; n; n = n.nextSibling ) {
  45047. if ( n.nodeType === 1 && n !== elem ) {
  45048. matched.push( n );
  45049. }
  45050. }
  45051. return matched;
  45052. };
  45053. var rneedsContext = jQuery.expr.match.needsContext;
  45054. function nodeName( elem, name ) {
  45055. return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
  45056. };
  45057. var rsingleTag = ( /^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i );
  45058. // Implement the identical functionality for filter and not
  45059. function winnow( elements, qualifier, not ) {
  45060. if ( isFunction( qualifier ) ) {
  45061. return jQuery.grep( elements, function( elem, i ) {
  45062. return !!qualifier.call( elem, i, elem ) !== not;
  45063. } );
  45064. }
  45065. // Single element
  45066. if ( qualifier.nodeType ) {
  45067. return jQuery.grep( elements, function( elem ) {
  45068. return ( elem === qualifier ) !== not;
  45069. } );
  45070. }
  45071. // Arraylike of elements (jQuery, arguments, Array)
  45072. if ( typeof qualifier !== "string" ) {
  45073. return jQuery.grep( elements, function( elem ) {
  45074. return ( indexOf.call( qualifier, elem ) > -1 ) !== not;
  45075. } );
  45076. }
  45077. // Filtered directly for both simple and complex selectors
  45078. return jQuery.filter( qualifier, elements, not );
  45079. }
  45080. jQuery.filter = function( expr, elems, not ) {
  45081. var elem = elems[ 0 ];
  45082. if ( not ) {
  45083. expr = ":not(" + expr + ")";
  45084. }
  45085. if ( elems.length === 1 && elem.nodeType === 1 ) {
  45086. return jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : [];
  45087. }
  45088. return jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) {
  45089. return elem.nodeType === 1;
  45090. } ) );
  45091. };
  45092. jQuery.fn.extend( {
  45093. find: function( selector ) {
  45094. var i, ret,
  45095. len = this.length,
  45096. self = this;
  45097. if ( typeof selector !== "string" ) {
  45098. return this.pushStack( jQuery( selector ).filter( function() {
  45099. for ( i = 0; i < len; i++ ) {
  45100. if ( jQuery.contains( self[ i ], this ) ) {
  45101. return true;
  45102. }
  45103. }
  45104. } ) );
  45105. }
  45106. ret = this.pushStack( [] );
  45107. for ( i = 0; i < len; i++ ) {
  45108. jQuery.find( selector, self[ i ], ret );
  45109. }
  45110. return len > 1 ? jQuery.uniqueSort( ret ) : ret;
  45111. },
  45112. filter: function( selector ) {
  45113. return this.pushStack( winnow( this, selector || [], false ) );
  45114. },
  45115. not: function( selector ) {
  45116. return this.pushStack( winnow( this, selector || [], true ) );
  45117. },
  45118. is: function( selector ) {
  45119. return !!winnow(
  45120. this,
  45121. // If this is a positional/relative selector, check membership in the returned set
  45122. // so $("p:first").is("p:last") won't return true for a doc with two "p".
  45123. typeof selector === "string" && rneedsContext.test( selector ) ?
  45124. jQuery( selector ) :
  45125. selector || [],
  45126. false
  45127. ).length;
  45128. }
  45129. } );
  45130. // Initialize a jQuery object
  45131. // A central reference to the root jQuery(document)
  45132. var rootjQuery,
  45133. // A simple way to check for HTML strings
  45134. // Prioritize #id over <tag> to avoid XSS via location.hash (#9521)
  45135. // Strict HTML recognition (#11290: must start with <)
  45136. // Shortcut simple #id case for speed
  45137. rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/,
  45138. init = jQuery.fn.init = function( selector, context, root ) {
  45139. var match, elem;
  45140. // HANDLE: $(""), $(null), $(undefined), $(false)
  45141. if ( !selector ) {
  45142. return this;
  45143. }
  45144. // Method init() accepts an alternate rootjQuery
  45145. // so migrate can support jQuery.sub (gh-2101)
  45146. root = root || rootjQuery;
  45147. // Handle HTML strings
  45148. if ( typeof selector === "string" ) {
  45149. if ( selector[ 0 ] === "<" &&
  45150. selector[ selector.length - 1 ] === ">" &&
  45151. selector.length >= 3 ) {
  45152. // Assume that strings that start and end with <> are HTML and skip the regex check
  45153. match = [ null, selector, null ];
  45154. } else {
  45155. match = rquickExpr.exec( selector );
  45156. }
  45157. // Match html or make sure no context is specified for #id
  45158. if ( match && ( match[ 1 ] || !context ) ) {
  45159. // HANDLE: $(html) -> $(array)
  45160. if ( match[ 1 ] ) {
  45161. context = context instanceof jQuery ? context[ 0 ] : context;
  45162. // Option to run scripts is true for back-compat
  45163. // Intentionally let the error be thrown if parseHTML is not present
  45164. jQuery.merge( this, jQuery.parseHTML(
  45165. match[ 1 ],
  45166. context && context.nodeType ? context.ownerDocument || context : document,
  45167. true
  45168. ) );
  45169. // HANDLE: $(html, props)
  45170. if ( rsingleTag.test( match[ 1 ] ) && jQuery.isPlainObject( context ) ) {
  45171. for ( match in context ) {
  45172. // Properties of context are called as methods if possible
  45173. if ( isFunction( this[ match ] ) ) {
  45174. this[ match ]( context[ match ] );
  45175. // ...and otherwise set as attributes
  45176. } else {
  45177. this.attr( match, context[ match ] );
  45178. }
  45179. }
  45180. }
  45181. return this;
  45182. // HANDLE: $(#id)
  45183. } else {
  45184. elem = document.getElementById( match[ 2 ] );
  45185. if ( elem ) {
  45186. // Inject the element directly into the jQuery object
  45187. this[ 0 ] = elem;
  45188. this.length = 1;
  45189. }
  45190. return this;
  45191. }
  45192. // HANDLE: $(expr, $(...))
  45193. } else if ( !context || context.jquery ) {
  45194. return ( context || root ).find( selector );
  45195. // HANDLE: $(expr, context)
  45196. // (which is just equivalent to: $(context).find(expr)
  45197. } else {
  45198. return this.constructor( context ).find( selector );
  45199. }
  45200. // HANDLE: $(DOMElement)
  45201. } else if ( selector.nodeType ) {
  45202. this[ 0 ] = selector;
  45203. this.length = 1;
  45204. return this;
  45205. // HANDLE: $(function)
  45206. // Shortcut for document ready
  45207. } else if ( isFunction( selector ) ) {
  45208. return root.ready !== undefined ?
  45209. root.ready( selector ) :
  45210. // Execute immediately if ready is not present
  45211. selector( jQuery );
  45212. }
  45213. return jQuery.makeArray( selector, this );
  45214. };
  45215. // Give the init function the jQuery prototype for later instantiation
  45216. init.prototype = jQuery.fn;
  45217. // Initialize central reference
  45218. rootjQuery = jQuery( document );
  45219. var rparentsprev = /^(?:parents|prev(?:Until|All))/,
  45220. // Methods guaranteed to produce a unique set when starting from a unique set
  45221. guaranteedUnique = {
  45222. children: true,
  45223. contents: true,
  45224. next: true,
  45225. prev: true
  45226. };
  45227. jQuery.fn.extend( {
  45228. has: function( target ) {
  45229. var targets = jQuery( target, this ),
  45230. l = targets.length;
  45231. return this.filter( function() {
  45232. var i = 0;
  45233. for ( ; i < l; i++ ) {
  45234. if ( jQuery.contains( this, targets[ i ] ) ) {
  45235. return true;
  45236. }
  45237. }
  45238. } );
  45239. },
  45240. closest: function( selectors, context ) {
  45241. var cur,
  45242. i = 0,
  45243. l = this.length,
  45244. matched = [],
  45245. targets = typeof selectors !== "string" && jQuery( selectors );
  45246. // Positional selectors never match, since there's no _selection_ context
  45247. if ( !rneedsContext.test( selectors ) ) {
  45248. for ( ; i < l; i++ ) {
  45249. for ( cur = this[ i ]; cur && cur !== context; cur = cur.parentNode ) {
  45250. // Always skip document fragments
  45251. if ( cur.nodeType < 11 && ( targets ?
  45252. targets.index( cur ) > -1 :
  45253. // Don't pass non-elements to Sizzle
  45254. cur.nodeType === 1 &&
  45255. jQuery.find.matchesSelector( cur, selectors ) ) ) {
  45256. matched.push( cur );
  45257. break;
  45258. }
  45259. }
  45260. }
  45261. }
  45262. return this.pushStack( matched.length > 1 ? jQuery.uniqueSort( matched ) : matched );
  45263. },
  45264. // Determine the position of an element within the set
  45265. index: function( elem ) {
  45266. // No argument, return index in parent
  45267. if ( !elem ) {
  45268. return ( this[ 0 ] && this[ 0 ].parentNode ) ? this.first().prevAll().length : -1;
  45269. }
  45270. // Index in selector
  45271. if ( typeof elem === "string" ) {
  45272. return indexOf.call( jQuery( elem ), this[ 0 ] );
  45273. }
  45274. // Locate the position of the desired element
  45275. return indexOf.call( this,
  45276. // If it receives a jQuery object, the first element is used
  45277. elem.jquery ? elem[ 0 ] : elem
  45278. );
  45279. },
  45280. add: function( selector, context ) {
  45281. return this.pushStack(
  45282. jQuery.uniqueSort(
  45283. jQuery.merge( this.get(), jQuery( selector, context ) )
  45284. )
  45285. );
  45286. },
  45287. addBack: function( selector ) {
  45288. return this.add( selector == null ?
  45289. this.prevObject : this.prevObject.filter( selector )
  45290. );
  45291. }
  45292. } );
  45293. function sibling( cur, dir ) {
  45294. while ( ( cur = cur[ dir ] ) && cur.nodeType !== 1 ) {}
  45295. return cur;
  45296. }
  45297. jQuery.each( {
  45298. parent: function( elem ) {
  45299. var parent = elem.parentNode;
  45300. return parent && parent.nodeType !== 11 ? parent : null;
  45301. },
  45302. parents: function( elem ) {
  45303. return dir( elem, "parentNode" );
  45304. },
  45305. parentsUntil: function( elem, i, until ) {
  45306. return dir( elem, "parentNode", until );
  45307. },
  45308. next: function( elem ) {
  45309. return sibling( elem, "nextSibling" );
  45310. },
  45311. prev: function( elem ) {
  45312. return sibling( elem, "previousSibling" );
  45313. },
  45314. nextAll: function( elem ) {
  45315. return dir( elem, "nextSibling" );
  45316. },
  45317. prevAll: function( elem ) {
  45318. return dir( elem, "previousSibling" );
  45319. },
  45320. nextUntil: function( elem, i, until ) {
  45321. return dir( elem, "nextSibling", until );
  45322. },
  45323. prevUntil: function( elem, i, until ) {
  45324. return dir( elem, "previousSibling", until );
  45325. },
  45326. siblings: function( elem ) {
  45327. return siblings( ( elem.parentNode || {} ).firstChild, elem );
  45328. },
  45329. children: function( elem ) {
  45330. return siblings( elem.firstChild );
  45331. },
  45332. contents: function( elem ) {
  45333. if ( nodeName( elem, "iframe" ) ) {
  45334. return elem.contentDocument;
  45335. }
  45336. // Support: IE 9 - 11 only, iOS 7 only, Android Browser <=4.3 only
  45337. // Treat the template element as a regular one in browsers that
  45338. // don't support it.
  45339. if ( nodeName( elem, "template" ) ) {
  45340. elem = elem.content || elem;
  45341. }
  45342. return jQuery.merge( [], elem.childNodes );
  45343. }
  45344. }, function( name, fn ) {
  45345. jQuery.fn[ name ] = function( until, selector ) {
  45346. var matched = jQuery.map( this, fn, until );
  45347. if ( name.slice( -5 ) !== "Until" ) {
  45348. selector = until;
  45349. }
  45350. if ( selector && typeof selector === "string" ) {
  45351. matched = jQuery.filter( selector, matched );
  45352. }
  45353. if ( this.length > 1 ) {
  45354. // Remove duplicates
  45355. if ( !guaranteedUnique[ name ] ) {
  45356. jQuery.uniqueSort( matched );
  45357. }
  45358. // Reverse order for parents* and prev-derivatives
  45359. if ( rparentsprev.test( name ) ) {
  45360. matched.reverse();
  45361. }
  45362. }
  45363. return this.pushStack( matched );
  45364. };
  45365. } );
  45366. var rnothtmlwhite = ( /[^\x20\t\r\n\f]+/g );
  45367. // Convert String-formatted options into Object-formatted ones
  45368. function createOptions( options ) {
  45369. var object = {};
  45370. jQuery.each( options.match( rnothtmlwhite ) || [], function( _, flag ) {
  45371. object[ flag ] = true;
  45372. } );
  45373. return object;
  45374. }
  45375. /*
  45376. * Create a callback list using the following parameters:
  45377. *
  45378. * options: an optional list of space-separated options that will change how
  45379. * the callback list behaves or a more traditional option object
  45380. *
  45381. * By default a callback list will act like an event callback list and can be
  45382. * "fired" multiple times.
  45383. *
  45384. * Possible options:
  45385. *
  45386. * once: will ensure the callback list can only be fired once (like a Deferred)
  45387. *
  45388. * memory: will keep track of previous values and will call any callback added
  45389. * after the list has been fired right away with the latest "memorized"
  45390. * values (like a Deferred)
  45391. *
  45392. * unique: will ensure a callback can only be added once (no duplicate in the list)
  45393. *
  45394. * stopOnFalse: interrupt callings when a callback returns false
  45395. *
  45396. */
  45397. jQuery.Callbacks = function( options ) {
  45398. // Convert options from String-formatted to Object-formatted if needed
  45399. // (we check in cache first)
  45400. options = typeof options === "string" ?
  45401. createOptions( options ) :
  45402. jQuery.extend( {}, options );
  45403. var // Flag to know if list is currently firing
  45404. firing,
  45405. // Last fire value for non-forgettable lists
  45406. memory,
  45407. // Flag to know if list was already fired
  45408. fired,
  45409. // Flag to prevent firing
  45410. locked,
  45411. // Actual callback list
  45412. list = [],
  45413. // Queue of execution data for repeatable lists
  45414. queue = [],
  45415. // Index of currently firing callback (modified by add/remove as needed)
  45416. firingIndex = -1,
  45417. // Fire callbacks
  45418. fire = function() {
  45419. // Enforce single-firing
  45420. locked = locked || options.once;
  45421. // Execute callbacks for all pending executions,
  45422. // respecting firingIndex overrides and runtime changes
  45423. fired = firing = true;
  45424. for ( ; queue.length; firingIndex = -1 ) {
  45425. memory = queue.shift();
  45426. while ( ++firingIndex < list.length ) {
  45427. // Run callback and check for early termination
  45428. if ( list[ firingIndex ].apply( memory[ 0 ], memory[ 1 ] ) === false &&
  45429. options.stopOnFalse ) {
  45430. // Jump to end and forget the data so .add doesn't re-fire
  45431. firingIndex = list.length;
  45432. memory = false;
  45433. }
  45434. }
  45435. }
  45436. // Forget the data if we're done with it
  45437. if ( !options.memory ) {
  45438. memory = false;
  45439. }
  45440. firing = false;
  45441. // Clean up if we're done firing for good
  45442. if ( locked ) {
  45443. // Keep an empty list if we have data for future add calls
  45444. if ( memory ) {
  45445. list = [];
  45446. // Otherwise, this object is spent
  45447. } else {
  45448. list = "";
  45449. }
  45450. }
  45451. },
  45452. // Actual Callbacks object
  45453. self = {
  45454. // Add a callback or a collection of callbacks to the list
  45455. add: function() {
  45456. if ( list ) {
  45457. // If we have memory from a past run, we should fire after adding
  45458. if ( memory && !firing ) {
  45459. firingIndex = list.length - 1;
  45460. queue.push( memory );
  45461. }
  45462. ( function add( args ) {
  45463. jQuery.each( args, function( _, arg ) {
  45464. if ( isFunction( arg ) ) {
  45465. if ( !options.unique || !self.has( arg ) ) {
  45466. list.push( arg );
  45467. }
  45468. } else if ( arg && arg.length && toType( arg ) !== "string" ) {
  45469. // Inspect recursively
  45470. add( arg );
  45471. }
  45472. } );
  45473. } )( arguments );
  45474. if ( memory && !firing ) {
  45475. fire();
  45476. }
  45477. }
  45478. return this;
  45479. },
  45480. // Remove a callback from the list
  45481. remove: function() {
  45482. jQuery.each( arguments, function( _, arg ) {
  45483. var index;
  45484. while ( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) {
  45485. list.splice( index, 1 );
  45486. // Handle firing indexes
  45487. if ( index <= firingIndex ) {
  45488. firingIndex--;
  45489. }
  45490. }
  45491. } );
  45492. return this;
  45493. },
  45494. // Check if a given callback is in the list.
  45495. // If no argument is given, return whether or not list has callbacks attached.
  45496. has: function( fn ) {
  45497. return fn ?
  45498. jQuery.inArray( fn, list ) > -1 :
  45499. list.length > 0;
  45500. },
  45501. // Remove all callbacks from the list
  45502. empty: function() {
  45503. if ( list ) {
  45504. list = [];
  45505. }
  45506. return this;
  45507. },
  45508. // Disable .fire and .add
  45509. // Abort any current/pending executions
  45510. // Clear all callbacks and values
  45511. disable: function() {
  45512. locked = queue = [];
  45513. list = memory = "";
  45514. return this;
  45515. },
  45516. disabled: function() {
  45517. return !list;
  45518. },
  45519. // Disable .fire
  45520. // Also disable .add unless we have memory (since it would have no effect)
  45521. // Abort any pending executions
  45522. lock: function() {
  45523. locked = queue = [];
  45524. if ( !memory && !firing ) {
  45525. list = memory = "";
  45526. }
  45527. return this;
  45528. },
  45529. locked: function() {
  45530. return !!locked;
  45531. },
  45532. // Call all callbacks with the given context and arguments
  45533. fireWith: function( context, args ) {
  45534. if ( !locked ) {
  45535. args = args || [];
  45536. args = [ context, args.slice ? args.slice() : args ];
  45537. queue.push( args );
  45538. if ( !firing ) {
  45539. fire();
  45540. }
  45541. }
  45542. return this;
  45543. },
  45544. // Call all the callbacks with the given arguments
  45545. fire: function() {
  45546. self.fireWith( this, arguments );
  45547. return this;
  45548. },
  45549. // To know if the callbacks have already been called at least once
  45550. fired: function() {
  45551. return !!fired;
  45552. }
  45553. };
  45554. return self;
  45555. };
  45556. function Identity( v ) {
  45557. return v;
  45558. }
  45559. function Thrower( ex ) {
  45560. throw ex;
  45561. }
  45562. function adoptValue( value, resolve, reject, noValue ) {
  45563. var method;
  45564. try {
  45565. // Check for promise aspect first to privilege synchronous behavior
  45566. if ( value && isFunction( ( method = value.promise ) ) ) {
  45567. method.call( value ).done( resolve ).fail( reject );
  45568. // Other thenables
  45569. } else if ( value && isFunction( ( method = value.then ) ) ) {
  45570. method.call( value, resolve, reject );
  45571. // Other non-thenables
  45572. } else {
  45573. // Control `resolve` arguments by letting Array#slice cast boolean `noValue` to integer:
  45574. // * false: [ value ].slice( 0 ) => resolve( value )
  45575. // * true: [ value ].slice( 1 ) => resolve()
  45576. resolve.apply( undefined, [ value ].slice( noValue ) );
  45577. }
  45578. // For Promises/A+, convert exceptions into rejections
  45579. // Since jQuery.when doesn't unwrap thenables, we can skip the extra checks appearing in
  45580. // Deferred#then to conditionally suppress rejection.
  45581. } catch ( value ) {
  45582. // Support: Android 4.0 only
  45583. // Strict mode functions invoked without .call/.apply get global-object context
  45584. reject.apply( undefined, [ value ] );
  45585. }
  45586. }
  45587. jQuery.extend( {
  45588. Deferred: function( func ) {
  45589. var tuples = [
  45590. // action, add listener, callbacks,
  45591. // ... .then handlers, argument index, [final state]
  45592. [ "notify", "progress", jQuery.Callbacks( "memory" ),
  45593. jQuery.Callbacks( "memory" ), 2 ],
  45594. [ "resolve", "done", jQuery.Callbacks( "once memory" ),
  45595. jQuery.Callbacks( "once memory" ), 0, "resolved" ],
  45596. [ "reject", "fail", jQuery.Callbacks( "once memory" ),
  45597. jQuery.Callbacks( "once memory" ), 1, "rejected" ]
  45598. ],
  45599. state = "pending",
  45600. promise = {
  45601. state: function() {
  45602. return state;
  45603. },
  45604. always: function() {
  45605. deferred.done( arguments ).fail( arguments );
  45606. return this;
  45607. },
  45608. "catch": function( fn ) {
  45609. return promise.then( null, fn );
  45610. },
  45611. // Keep pipe for back-compat
  45612. pipe: function( /* fnDone, fnFail, fnProgress */ ) {
  45613. var fns = arguments;
  45614. return jQuery.Deferred( function( newDefer ) {
  45615. jQuery.each( tuples, function( i, tuple ) {
  45616. // Map tuples (progress, done, fail) to arguments (done, fail, progress)
  45617. var fn = isFunction( fns[ tuple[ 4 ] ] ) && fns[ tuple[ 4 ] ];
  45618. // deferred.progress(function() { bind to newDefer or newDefer.notify })
  45619. // deferred.done(function() { bind to newDefer or newDefer.resolve })
  45620. // deferred.fail(function() { bind to newDefer or newDefer.reject })
  45621. deferred[ tuple[ 1 ] ]( function() {
  45622. var returned = fn && fn.apply( this, arguments );
  45623. if ( returned && isFunction( returned.promise ) ) {
  45624. returned.promise()
  45625. .progress( newDefer.notify )
  45626. .done( newDefer.resolve )
  45627. .fail( newDefer.reject );
  45628. } else {
  45629. newDefer[ tuple[ 0 ] + "With" ](
  45630. this,
  45631. fn ? [ returned ] : arguments
  45632. );
  45633. }
  45634. } );
  45635. } );
  45636. fns = null;
  45637. } ).promise();
  45638. },
  45639. then: function( onFulfilled, onRejected, onProgress ) {
  45640. var maxDepth = 0;
  45641. function resolve( depth, deferred, handler, special ) {
  45642. return function() {
  45643. var that = this,
  45644. args = arguments,
  45645. mightThrow = function() {
  45646. var returned, then;
  45647. // Support: Promises/A+ section 2.3.3.3.3
  45648. // https://promisesaplus.com/#point-59
  45649. // Ignore double-resolution attempts
  45650. if ( depth < maxDepth ) {
  45651. return;
  45652. }
  45653. returned = handler.apply( that, args );
  45654. // Support: Promises/A+ section 2.3.1
  45655. // https://promisesaplus.com/#point-48
  45656. if ( returned === deferred.promise() ) {
  45657. throw new TypeError( "Thenable self-resolution" );
  45658. }
  45659. // Support: Promises/A+ sections 2.3.3.1, 3.5
  45660. // https://promisesaplus.com/#point-54
  45661. // https://promisesaplus.com/#point-75
  45662. // Retrieve `then` only once
  45663. then = returned &&
  45664. // Support: Promises/A+ section 2.3.4
  45665. // https://promisesaplus.com/#point-64
  45666. // Only check objects and functions for thenability
  45667. ( typeof returned === "object" ||
  45668. typeof returned === "function" ) &&
  45669. returned.then;
  45670. // Handle a returned thenable
  45671. if ( isFunction( then ) ) {
  45672. // Special processors (notify) just wait for resolution
  45673. if ( special ) {
  45674. then.call(
  45675. returned,
  45676. resolve( maxDepth, deferred, Identity, special ),
  45677. resolve( maxDepth, deferred, Thrower, special )
  45678. );
  45679. // Normal processors (resolve) also hook into progress
  45680. } else {
  45681. // ...and disregard older resolution values
  45682. maxDepth++;
  45683. then.call(
  45684. returned,
  45685. resolve( maxDepth, deferred, Identity, special ),
  45686. resolve( maxDepth, deferred, Thrower, special ),
  45687. resolve( maxDepth, deferred, Identity,
  45688. deferred.notifyWith )
  45689. );
  45690. }
  45691. // Handle all other returned values
  45692. } else {
  45693. // Only substitute handlers pass on context
  45694. // and multiple values (non-spec behavior)
  45695. if ( handler !== Identity ) {
  45696. that = undefined;
  45697. args = [ returned ];
  45698. }
  45699. // Process the value(s)
  45700. // Default process is resolve
  45701. ( special || deferred.resolveWith )( that, args );
  45702. }
  45703. },
  45704. // Only normal processors (resolve) catch and reject exceptions
  45705. process = special ?
  45706. mightThrow :
  45707. function() {
  45708. try {
  45709. mightThrow();
  45710. } catch ( e ) {
  45711. if ( jQuery.Deferred.exceptionHook ) {
  45712. jQuery.Deferred.exceptionHook( e,
  45713. process.stackTrace );
  45714. }
  45715. // Support: Promises/A+ section 2.3.3.3.4.1
  45716. // https://promisesaplus.com/#point-61
  45717. // Ignore post-resolution exceptions
  45718. if ( depth + 1 >= maxDepth ) {
  45719. // Only substitute handlers pass on context
  45720. // and multiple values (non-spec behavior)
  45721. if ( handler !== Thrower ) {
  45722. that = undefined;
  45723. args = [ e ];
  45724. }
  45725. deferred.rejectWith( that, args );
  45726. }
  45727. }
  45728. };
  45729. // Support: Promises/A+ section 2.3.3.3.1
  45730. // https://promisesaplus.com/#point-57
  45731. // Re-resolve promises immediately to dodge false rejection from
  45732. // subsequent errors
  45733. if ( depth ) {
  45734. process();
  45735. } else {
  45736. // Call an optional hook to record the stack, in case of exception
  45737. // since it's otherwise lost when execution goes async
  45738. if ( jQuery.Deferred.getStackHook ) {
  45739. process.stackTrace = jQuery.Deferred.getStackHook();
  45740. }
  45741. window.setTimeout( process );
  45742. }
  45743. };
  45744. }
  45745. return jQuery.Deferred( function( newDefer ) {
  45746. // progress_handlers.add( ... )
  45747. tuples[ 0 ][ 3 ].add(
  45748. resolve(
  45749. 0,
  45750. newDefer,
  45751. isFunction( onProgress ) ?
  45752. onProgress :
  45753. Identity,
  45754. newDefer.notifyWith
  45755. )
  45756. );
  45757. // fulfilled_handlers.add( ... )
  45758. tuples[ 1 ][ 3 ].add(
  45759. resolve(
  45760. 0,
  45761. newDefer,
  45762. isFunction( onFulfilled ) ?
  45763. onFulfilled :
  45764. Identity
  45765. )
  45766. );
  45767. // rejected_handlers.add( ... )
  45768. tuples[ 2 ][ 3 ].add(
  45769. resolve(
  45770. 0,
  45771. newDefer,
  45772. isFunction( onRejected ) ?
  45773. onRejected :
  45774. Thrower
  45775. )
  45776. );
  45777. } ).promise();
  45778. },
  45779. // Get a promise for this deferred
  45780. // If obj is provided, the promise aspect is added to the object
  45781. promise: function( obj ) {
  45782. return obj != null ? jQuery.extend( obj, promise ) : promise;
  45783. }
  45784. },
  45785. deferred = {};
  45786. // Add list-specific methods
  45787. jQuery.each( tuples, function( i, tuple ) {
  45788. var list = tuple[ 2 ],
  45789. stateString = tuple[ 5 ];
  45790. // promise.progress = list.add
  45791. // promise.done = list.add
  45792. // promise.fail = list.add
  45793. promise[ tuple[ 1 ] ] = list.add;
  45794. // Handle state
  45795. if ( stateString ) {
  45796. list.add(
  45797. function() {
  45798. // state = "resolved" (i.e., fulfilled)
  45799. // state = "rejected"
  45800. state = stateString;
  45801. },
  45802. // rejected_callbacks.disable
  45803. // fulfilled_callbacks.disable
  45804. tuples[ 3 - i ][ 2 ].disable,
  45805. // rejected_handlers.disable
  45806. // fulfilled_handlers.disable
  45807. tuples[ 3 - i ][ 3 ].disable,
  45808. // progress_callbacks.lock
  45809. tuples[ 0 ][ 2 ].lock,
  45810. // progress_handlers.lock
  45811. tuples[ 0 ][ 3 ].lock
  45812. );
  45813. }
  45814. // progress_handlers.fire
  45815. // fulfilled_handlers.fire
  45816. // rejected_handlers.fire
  45817. list.add( tuple[ 3 ].fire );
  45818. // deferred.notify = function() { deferred.notifyWith(...) }
  45819. // deferred.resolve = function() { deferred.resolveWith(...) }
  45820. // deferred.reject = function() { deferred.rejectWith(...) }
  45821. deferred[ tuple[ 0 ] ] = function() {
  45822. deferred[ tuple[ 0 ] + "With" ]( this === deferred ? undefined : this, arguments );
  45823. return this;
  45824. };
  45825. // deferred.notifyWith = list.fireWith
  45826. // deferred.resolveWith = list.fireWith
  45827. // deferred.rejectWith = list.fireWith
  45828. deferred[ tuple[ 0 ] + "With" ] = list.fireWith;
  45829. } );
  45830. // Make the deferred a promise
  45831. promise.promise( deferred );
  45832. // Call given func if any
  45833. if ( func ) {
  45834. func.call( deferred, deferred );
  45835. }
  45836. // All done!
  45837. return deferred;
  45838. },
  45839. // Deferred helper
  45840. when: function( singleValue ) {
  45841. var
  45842. // count of uncompleted subordinates
  45843. remaining = arguments.length,
  45844. // count of unprocessed arguments
  45845. i = remaining,
  45846. // subordinate fulfillment data
  45847. resolveContexts = Array( i ),
  45848. resolveValues = slice.call( arguments ),
  45849. // the master Deferred
  45850. master = jQuery.Deferred(),
  45851. // subordinate callback factory
  45852. updateFunc = function( i ) {
  45853. return function( value ) {
  45854. resolveContexts[ i ] = this;
  45855. resolveValues[ i ] = arguments.length > 1 ? slice.call( arguments ) : value;
  45856. if ( !( --remaining ) ) {
  45857. master.resolveWith( resolveContexts, resolveValues );
  45858. }
  45859. };
  45860. };
  45861. // Single- and empty arguments are adopted like Promise.resolve
  45862. if ( remaining <= 1 ) {
  45863. adoptValue( singleValue, master.done( updateFunc( i ) ).resolve, master.reject,
  45864. !remaining );
  45865. // Use .then() to unwrap secondary thenables (cf. gh-3000)
  45866. if ( master.state() === "pending" ||
  45867. isFunction( resolveValues[ i ] && resolveValues[ i ].then ) ) {
  45868. return master.then();
  45869. }
  45870. }
  45871. // Multiple arguments are aggregated like Promise.all array elements
  45872. while ( i-- ) {
  45873. adoptValue( resolveValues[ i ], updateFunc( i ), master.reject );
  45874. }
  45875. return master.promise();
  45876. }
  45877. } );
  45878. // These usually indicate a programmer mistake during development,
  45879. // warn about them ASAP rather than swallowing them by default.
  45880. var rerrorNames = /^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;
  45881. jQuery.Deferred.exceptionHook = function( error, stack ) {
  45882. // Support: IE 8 - 9 only
  45883. // Console exists when dev tools are open, which can happen at any time
  45884. if ( window.console && window.console.warn && error && rerrorNames.test( error.name ) ) {
  45885. window.console.warn( "jQuery.Deferred exception: " + error.message, error.stack, stack );
  45886. }
  45887. };
  45888. jQuery.readyException = function( error ) {
  45889. window.setTimeout( function() {
  45890. throw error;
  45891. } );
  45892. };
  45893. // The deferred used on DOM ready
  45894. var readyList = jQuery.Deferred();
  45895. jQuery.fn.ready = function( fn ) {
  45896. readyList
  45897. .then( fn )
  45898. // Wrap jQuery.readyException in a function so that the lookup
  45899. // happens at the time of error handling instead of callback
  45900. // registration.
  45901. .catch( function( error ) {
  45902. jQuery.readyException( error );
  45903. } );
  45904. return this;
  45905. };
  45906. jQuery.extend( {
  45907. // Is the DOM ready to be used? Set to true once it occurs.
  45908. isReady: false,
  45909. // A counter to track how many items to wait for before
  45910. // the ready event fires. See #6781
  45911. readyWait: 1,
  45912. // Handle when the DOM is ready
  45913. ready: function( wait ) {
  45914. // Abort if there are pending holds or we're already ready
  45915. if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) {
  45916. return;
  45917. }
  45918. // Remember that the DOM is ready
  45919. jQuery.isReady = true;
  45920. // If a normal DOM Ready event fired, decrement, and wait if need be
  45921. if ( wait !== true && --jQuery.readyWait > 0 ) {
  45922. return;
  45923. }
  45924. // If there are functions bound, to execute
  45925. readyList.resolveWith( document, [ jQuery ] );
  45926. }
  45927. } );
  45928. jQuery.ready.then = readyList.then;
  45929. // The ready event handler and self cleanup method
  45930. function completed() {
  45931. document.removeEventListener( "DOMContentLoaded", completed );
  45932. window.removeEventListener( "load", completed );
  45933. jQuery.ready();
  45934. }
  45935. // Catch cases where $(document).ready() is called
  45936. // after the browser event has already occurred.
  45937. // Support: IE <=9 - 10 only
  45938. // Older IE sometimes signals "interactive" too soon
  45939. if ( document.readyState === "complete" ||
  45940. ( document.readyState !== "loading" && !document.documentElement.doScroll ) ) {
  45941. // Handle it asynchronously to allow scripts the opportunity to delay ready
  45942. window.setTimeout( jQuery.ready );
  45943. } else {
  45944. // Use the handy event callback
  45945. document.addEventListener( "DOMContentLoaded", completed );
  45946. // A fallback to window.onload, that will always work
  45947. window.addEventListener( "load", completed );
  45948. }
  45949. // Multifunctional method to get and set values of a collection
  45950. // The value/s can optionally be executed if it's a function
  45951. var access = function( elems, fn, key, value, chainable, emptyGet, raw ) {
  45952. var i = 0,
  45953. len = elems.length,
  45954. bulk = key == null;
  45955. // Sets many values
  45956. if ( toType( key ) === "object" ) {
  45957. chainable = true;
  45958. for ( i in key ) {
  45959. access( elems, fn, i, key[ i ], true, emptyGet, raw );
  45960. }
  45961. // Sets one value
  45962. } else if ( value !== undefined ) {
  45963. chainable = true;
  45964. if ( !isFunction( value ) ) {
  45965. raw = true;
  45966. }
  45967. if ( bulk ) {
  45968. // Bulk operations run against the entire set
  45969. if ( raw ) {
  45970. fn.call( elems, value );
  45971. fn = null;
  45972. // ...except when executing function values
  45973. } else {
  45974. bulk = fn;
  45975. fn = function( elem, key, value ) {
  45976. return bulk.call( jQuery( elem ), value );
  45977. };
  45978. }
  45979. }
  45980. if ( fn ) {
  45981. for ( ; i < len; i++ ) {
  45982. fn(
  45983. elems[ i ], key, raw ?
  45984. value :
  45985. value.call( elems[ i ], i, fn( elems[ i ], key ) )
  45986. );
  45987. }
  45988. }
  45989. }
  45990. if ( chainable ) {
  45991. return elems;
  45992. }
  45993. // Gets
  45994. if ( bulk ) {
  45995. return fn.call( elems );
  45996. }
  45997. return len ? fn( elems[ 0 ], key ) : emptyGet;
  45998. };
  45999. // Matches dashed string for camelizing
  46000. var rmsPrefix = /^-ms-/,
  46001. rdashAlpha = /-([a-z])/g;
  46002. // Used by camelCase as callback to replace()
  46003. function fcamelCase( all, letter ) {
  46004. return letter.toUpperCase();
  46005. }
  46006. // Convert dashed to camelCase; used by the css and data modules
  46007. // Support: IE <=9 - 11, Edge 12 - 15
  46008. // Microsoft forgot to hump their vendor prefix (#9572)
  46009. function camelCase( string ) {
  46010. return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase );
  46011. }
  46012. var acceptData = function( owner ) {
  46013. // Accepts only:
  46014. // - Node
  46015. // - Node.ELEMENT_NODE
  46016. // - Node.DOCUMENT_NODE
  46017. // - Object
  46018. // - Any
  46019. return owner.nodeType === 1 || owner.nodeType === 9 || !( +owner.nodeType );
  46020. };
  46021. function Data() {
  46022. this.expando = jQuery.expando + Data.uid++;
  46023. }
  46024. Data.uid = 1;
  46025. Data.prototype = {
  46026. cache: function( owner ) {
  46027. // Check if the owner object already has a cache
  46028. var value = owner[ this.expando ];
  46029. // If not, create one
  46030. if ( !value ) {
  46031. value = {};
  46032. // We can accept data for non-element nodes in modern browsers,
  46033. // but we should not, see #8335.
  46034. // Always return an empty object.
  46035. if ( acceptData( owner ) ) {
  46036. // If it is a node unlikely to be stringify-ed or looped over
  46037. // use plain assignment
  46038. if ( owner.nodeType ) {
  46039. owner[ this.expando ] = value;
  46040. // Otherwise secure it in a non-enumerable property
  46041. // configurable must be true to allow the property to be
  46042. // deleted when data is removed
  46043. } else {
  46044. Object.defineProperty( owner, this.expando, {
  46045. value: value,
  46046. configurable: true
  46047. } );
  46048. }
  46049. }
  46050. }
  46051. return value;
  46052. },
  46053. set: function( owner, data, value ) {
  46054. var prop,
  46055. cache = this.cache( owner );
  46056. // Handle: [ owner, key, value ] args
  46057. // Always use camelCase key (gh-2257)
  46058. if ( typeof data === "string" ) {
  46059. cache[ camelCase( data ) ] = value;
  46060. // Handle: [ owner, { properties } ] args
  46061. } else {
  46062. // Copy the properties one-by-one to the cache object
  46063. for ( prop in data ) {
  46064. cache[ camelCase( prop ) ] = data[ prop ];
  46065. }
  46066. }
  46067. return cache;
  46068. },
  46069. get: function( owner, key ) {
  46070. return key === undefined ?
  46071. this.cache( owner ) :
  46072. // Always use camelCase key (gh-2257)
  46073. owner[ this.expando ] && owner[ this.expando ][ camelCase( key ) ];
  46074. },
  46075. access: function( owner, key, value ) {
  46076. // In cases where either:
  46077. //
  46078. // 1. No key was specified
  46079. // 2. A string key was specified, but no value provided
  46080. //
  46081. // Take the "read" path and allow the get method to determine
  46082. // which value to return, respectively either:
  46083. //
  46084. // 1. The entire cache object
  46085. // 2. The data stored at the key
  46086. //
  46087. if ( key === undefined ||
  46088. ( ( key && typeof key === "string" ) && value === undefined ) ) {
  46089. return this.get( owner, key );
  46090. }
  46091. // When the key is not a string, or both a key and value
  46092. // are specified, set or extend (existing objects) with either:
  46093. //
  46094. // 1. An object of properties
  46095. // 2. A key and value
  46096. //
  46097. this.set( owner, key, value );
  46098. // Since the "set" path can have two possible entry points
  46099. // return the expected data based on which path was taken[*]
  46100. return value !== undefined ? value : key;
  46101. },
  46102. remove: function( owner, key ) {
  46103. var i,
  46104. cache = owner[ this.expando ];
  46105. if ( cache === undefined ) {
  46106. return;
  46107. }
  46108. if ( key !== undefined ) {
  46109. // Support array or space separated string of keys
  46110. if ( Array.isArray( key ) ) {
  46111. // If key is an array of keys...
  46112. // We always set camelCase keys, so remove that.
  46113. key = key.map( camelCase );
  46114. } else {
  46115. key = camelCase( key );
  46116. // If a key with the spaces exists, use it.
  46117. // Otherwise, create an array by matching non-whitespace
  46118. key = key in cache ?
  46119. [ key ] :
  46120. ( key.match( rnothtmlwhite ) || [] );
  46121. }
  46122. i = key.length;
  46123. while ( i-- ) {
  46124. delete cache[ key[ i ] ];
  46125. }
  46126. }
  46127. // Remove the expando if there's no more data
  46128. if ( key === undefined || jQuery.isEmptyObject( cache ) ) {
  46129. // Support: Chrome <=35 - 45
  46130. // Webkit & Blink performance suffers when deleting properties
  46131. // from DOM nodes, so set to undefined instead
  46132. // https://bugs.chromium.org/p/chromium/issues/detail?id=378607 (bug restricted)
  46133. if ( owner.nodeType ) {
  46134. owner[ this.expando ] = undefined;
  46135. } else {
  46136. delete owner[ this.expando ];
  46137. }
  46138. }
  46139. },
  46140. hasData: function( owner ) {
  46141. var cache = owner[ this.expando ];
  46142. return cache !== undefined && !jQuery.isEmptyObject( cache );
  46143. }
  46144. };
  46145. var dataPriv = new Data();
  46146. var dataUser = new Data();
  46147. // Implementation Summary
  46148. //
  46149. // 1. Enforce API surface and semantic compatibility with 1.9.x branch
  46150. // 2. Improve the module's maintainability by reducing the storage
  46151. // paths to a single mechanism.
  46152. // 3. Use the same single mechanism to support "private" and "user" data.
  46153. // 4. _Never_ expose "private" data to user code (TODO: Drop _data, _removeData)
  46154. // 5. Avoid exposing implementation details on user objects (eg. expando properties)
  46155. // 6. Provide a clear path for implementation upgrade to WeakMap in 2014
  46156. var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,
  46157. rmultiDash = /[A-Z]/g;
  46158. function getData( data ) {
  46159. if ( data === "true" ) {
  46160. return true;
  46161. }
  46162. if ( data === "false" ) {
  46163. return false;
  46164. }
  46165. if ( data === "null" ) {
  46166. return null;
  46167. }
  46168. // Only convert to a number if it doesn't change the string
  46169. if ( data === +data + "" ) {
  46170. return +data;
  46171. }
  46172. if ( rbrace.test( data ) ) {
  46173. return JSON.parse( data );
  46174. }
  46175. return data;
  46176. }
  46177. function dataAttr( elem, key, data ) {
  46178. var name;
  46179. // If nothing was found internally, try to fetch any
  46180. // data from the HTML5 data-* attribute
  46181. if ( data === undefined && elem.nodeType === 1 ) {
  46182. name = "data-" + key.replace( rmultiDash, "-$&" ).toLowerCase();
  46183. data = elem.getAttribute( name );
  46184. if ( typeof data === "string" ) {
  46185. try {
  46186. data = getData( data );
  46187. } catch ( e ) {}
  46188. // Make sure we set the data so it isn't changed later
  46189. dataUser.set( elem, key, data );
  46190. } else {
  46191. data = undefined;
  46192. }
  46193. }
  46194. return data;
  46195. }
  46196. jQuery.extend( {
  46197. hasData: function( elem ) {
  46198. return dataUser.hasData( elem ) || dataPriv.hasData( elem );
  46199. },
  46200. data: function( elem, name, data ) {
  46201. return dataUser.access( elem, name, data );
  46202. },
  46203. removeData: function( elem, name ) {
  46204. dataUser.remove( elem, name );
  46205. },
  46206. // TODO: Now that all calls to _data and _removeData have been replaced
  46207. // with direct calls to dataPriv methods, these can be deprecated.
  46208. _data: function( elem, name, data ) {
  46209. return dataPriv.access( elem, name, data );
  46210. },
  46211. _removeData: function( elem, name ) {
  46212. dataPriv.remove( elem, name );
  46213. }
  46214. } );
  46215. jQuery.fn.extend( {
  46216. data: function( key, value ) {
  46217. var i, name, data,
  46218. elem = this[ 0 ],
  46219. attrs = elem && elem.attributes;
  46220. // Gets all values
  46221. if ( key === undefined ) {
  46222. if ( this.length ) {
  46223. data = dataUser.get( elem );
  46224. if ( elem.nodeType === 1 && !dataPriv.get( elem, "hasDataAttrs" ) ) {
  46225. i = attrs.length;
  46226. while ( i-- ) {
  46227. // Support: IE 11 only
  46228. // The attrs elements can be null (#14894)
  46229. if ( attrs[ i ] ) {
  46230. name = attrs[ i ].name;
  46231. if ( name.indexOf( "data-" ) === 0 ) {
  46232. name = camelCase( name.slice( 5 ) );
  46233. dataAttr( elem, name, data[ name ] );
  46234. }
  46235. }
  46236. }
  46237. dataPriv.set( elem, "hasDataAttrs", true );
  46238. }
  46239. }
  46240. return data;
  46241. }
  46242. // Sets multiple values
  46243. if ( typeof key === "object" ) {
  46244. return this.each( function() {
  46245. dataUser.set( this, key );
  46246. } );
  46247. }
  46248. return access( this, function( value ) {
  46249. var data;
  46250. // The calling jQuery object (element matches) is not empty
  46251. // (and therefore has an element appears at this[ 0 ]) and the
  46252. // `value` parameter was not undefined. An empty jQuery object
  46253. // will result in `undefined` for elem = this[ 0 ] which will
  46254. // throw an exception if an attempt to read a data cache is made.
  46255. if ( elem && value === undefined ) {
  46256. // Attempt to get data from the cache
  46257. // The key will always be camelCased in Data
  46258. data = dataUser.get( elem, key );
  46259. if ( data !== undefined ) {
  46260. return data;
  46261. }
  46262. // Attempt to "discover" the data in
  46263. // HTML5 custom data-* attrs
  46264. data = dataAttr( elem, key );
  46265. if ( data !== undefined ) {
  46266. return data;
  46267. }
  46268. // We tried really hard, but the data doesn't exist.
  46269. return;
  46270. }
  46271. // Set the data...
  46272. this.each( function() {
  46273. // We always store the camelCased key
  46274. dataUser.set( this, key, value );
  46275. } );
  46276. }, null, value, arguments.length > 1, null, true );
  46277. },
  46278. removeData: function( key ) {
  46279. return this.each( function() {
  46280. dataUser.remove( this, key );
  46281. } );
  46282. }
  46283. } );
  46284. jQuery.extend( {
  46285. queue: function( elem, type, data ) {
  46286. var queue;
  46287. if ( elem ) {
  46288. type = ( type || "fx" ) + "queue";
  46289. queue = dataPriv.get( elem, type );
  46290. // Speed up dequeue by getting out quickly if this is just a lookup
  46291. if ( data ) {
  46292. if ( !queue || Array.isArray( data ) ) {
  46293. queue = dataPriv.access( elem, type, jQuery.makeArray( data ) );
  46294. } else {
  46295. queue.push( data );
  46296. }
  46297. }
  46298. return queue || [];
  46299. }
  46300. },
  46301. dequeue: function( elem, type ) {
  46302. type = type || "fx";
  46303. var queue = jQuery.queue( elem, type ),
  46304. startLength = queue.length,
  46305. fn = queue.shift(),
  46306. hooks = jQuery._queueHooks( elem, type ),
  46307. next = function() {
  46308. jQuery.dequeue( elem, type );
  46309. };
  46310. // If the fx queue is dequeued, always remove the progress sentinel
  46311. if ( fn === "inprogress" ) {
  46312. fn = queue.shift();
  46313. startLength--;
  46314. }
  46315. if ( fn ) {
  46316. // Add a progress sentinel to prevent the fx queue from being
  46317. // automatically dequeued
  46318. if ( type === "fx" ) {
  46319. queue.unshift( "inprogress" );
  46320. }
  46321. // Clear up the last queue stop function
  46322. delete hooks.stop;
  46323. fn.call( elem, next, hooks );
  46324. }
  46325. if ( !startLength && hooks ) {
  46326. hooks.empty.fire();
  46327. }
  46328. },
  46329. // Not public - generate a queueHooks object, or return the current one
  46330. _queueHooks: function( elem, type ) {
  46331. var key = type + "queueHooks";
  46332. return dataPriv.get( elem, key ) || dataPriv.access( elem, key, {
  46333. empty: jQuery.Callbacks( "once memory" ).add( function() {
  46334. dataPriv.remove( elem, [ type + "queue", key ] );
  46335. } )
  46336. } );
  46337. }
  46338. } );
  46339. jQuery.fn.extend( {
  46340. queue: function( type, data ) {
  46341. var setter = 2;
  46342. if ( typeof type !== "string" ) {
  46343. data = type;
  46344. type = "fx";
  46345. setter--;
  46346. }
  46347. if ( arguments.length < setter ) {
  46348. return jQuery.queue( this[ 0 ], type );
  46349. }
  46350. return data === undefined ?
  46351. this :
  46352. this.each( function() {
  46353. var queue = jQuery.queue( this, type, data );
  46354. // Ensure a hooks for this queue
  46355. jQuery._queueHooks( this, type );
  46356. if ( type === "fx" && queue[ 0 ] !== "inprogress" ) {
  46357. jQuery.dequeue( this, type );
  46358. }
  46359. } );
  46360. },
  46361. dequeue: function( type ) {
  46362. return this.each( function() {
  46363. jQuery.dequeue( this, type );
  46364. } );
  46365. },
  46366. clearQueue: function( type ) {
  46367. return this.queue( type || "fx", [] );
  46368. },
  46369. // Get a promise resolved when queues of a certain type
  46370. // are emptied (fx is the type by default)
  46371. promise: function( type, obj ) {
  46372. var tmp,
  46373. count = 1,
  46374. defer = jQuery.Deferred(),
  46375. elements = this,
  46376. i = this.length,
  46377. resolve = function() {
  46378. if ( !( --count ) ) {
  46379. defer.resolveWith( elements, [ elements ] );
  46380. }
  46381. };
  46382. if ( typeof type !== "string" ) {
  46383. obj = type;
  46384. type = undefined;
  46385. }
  46386. type = type || "fx";
  46387. while ( i-- ) {
  46388. tmp = dataPriv.get( elements[ i ], type + "queueHooks" );
  46389. if ( tmp && tmp.empty ) {
  46390. count++;
  46391. tmp.empty.add( resolve );
  46392. }
  46393. }
  46394. resolve();
  46395. return defer.promise( obj );
  46396. }
  46397. } );
  46398. var pnum = ( /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/ ).source;
  46399. var rcssNum = new RegExp( "^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i" );
  46400. var cssExpand = [ "Top", "Right", "Bottom", "Left" ];
  46401. var isHiddenWithinTree = function( elem, el ) {
  46402. // isHiddenWithinTree might be called from jQuery#filter function;
  46403. // in that case, element will be second argument
  46404. elem = el || elem;
  46405. // Inline style trumps all
  46406. return elem.style.display === "none" ||
  46407. elem.style.display === "" &&
  46408. // Otherwise, check computed style
  46409. // Support: Firefox <=43 - 45
  46410. // Disconnected elements can have computed display: none, so first confirm that elem is
  46411. // in the document.
  46412. jQuery.contains( elem.ownerDocument, elem ) &&
  46413. jQuery.css( elem, "display" ) === "none";
  46414. };
  46415. var swap = function( elem, options, callback, args ) {
  46416. var ret, name,
  46417. old = {};
  46418. // Remember the old values, and insert the new ones
  46419. for ( name in options ) {
  46420. old[ name ] = elem.style[ name ];
  46421. elem.style[ name ] = options[ name ];
  46422. }
  46423. ret = callback.apply( elem, args || [] );
  46424. // Revert the old values
  46425. for ( name in options ) {
  46426. elem.style[ name ] = old[ name ];
  46427. }
  46428. return ret;
  46429. };
  46430. function adjustCSS( elem, prop, valueParts, tween ) {
  46431. var adjusted, scale,
  46432. maxIterations = 20,
  46433. currentValue = tween ?
  46434. function() {
  46435. return tween.cur();
  46436. } :
  46437. function() {
  46438. return jQuery.css( elem, prop, "" );
  46439. },
  46440. initial = currentValue(),
  46441. unit = valueParts && valueParts[ 3 ] || ( jQuery.cssNumber[ prop ] ? "" : "px" ),
  46442. // Starting value computation is required for potential unit mismatches
  46443. initialInUnit = ( jQuery.cssNumber[ prop ] || unit !== "px" && +initial ) &&
  46444. rcssNum.exec( jQuery.css( elem, prop ) );
  46445. if ( initialInUnit && initialInUnit[ 3 ] !== unit ) {
  46446. // Support: Firefox <=54
  46447. // Halve the iteration target value to prevent interference from CSS upper bounds (gh-2144)
  46448. initial = initial / 2;
  46449. // Trust units reported by jQuery.css
  46450. unit = unit || initialInUnit[ 3 ];
  46451. // Iteratively approximate from a nonzero starting point
  46452. initialInUnit = +initial || 1;
  46453. while ( maxIterations-- ) {
  46454. // Evaluate and update our best guess (doubling guesses that zero out).
  46455. // Finish if the scale equals or crosses 1 (making the old*new product non-positive).
  46456. jQuery.style( elem, prop, initialInUnit + unit );
  46457. if ( ( 1 - scale ) * ( 1 - ( scale = currentValue() / initial || 0.5 ) ) <= 0 ) {
  46458. maxIterations = 0;
  46459. }
  46460. initialInUnit = initialInUnit / scale;
  46461. }
  46462. initialInUnit = initialInUnit * 2;
  46463. jQuery.style( elem, prop, initialInUnit + unit );
  46464. // Make sure we update the tween properties later on
  46465. valueParts = valueParts || [];
  46466. }
  46467. if ( valueParts ) {
  46468. initialInUnit = +initialInUnit || +initial || 0;
  46469. // Apply relative offset (+=/-=) if specified
  46470. adjusted = valueParts[ 1 ] ?
  46471. initialInUnit + ( valueParts[ 1 ] + 1 ) * valueParts[ 2 ] :
  46472. +valueParts[ 2 ];
  46473. if ( tween ) {
  46474. tween.unit = unit;
  46475. tween.start = initialInUnit;
  46476. tween.end = adjusted;
  46477. }
  46478. }
  46479. return adjusted;
  46480. }
  46481. var defaultDisplayMap = {};
  46482. function getDefaultDisplay( elem ) {
  46483. var temp,
  46484. doc = elem.ownerDocument,
  46485. nodeName = elem.nodeName,
  46486. display = defaultDisplayMap[ nodeName ];
  46487. if ( display ) {
  46488. return display;
  46489. }
  46490. temp = doc.body.appendChild( doc.createElement( nodeName ) );
  46491. display = jQuery.css( temp, "display" );
  46492. temp.parentNode.removeChild( temp );
  46493. if ( display === "none" ) {
  46494. display = "block";
  46495. }
  46496. defaultDisplayMap[ nodeName ] = display;
  46497. return display;
  46498. }
  46499. function showHide( elements, show ) {
  46500. var display, elem,
  46501. values = [],
  46502. index = 0,
  46503. length = elements.length;
  46504. // Determine new display value for elements that need to change
  46505. for ( ; index < length; index++ ) {
  46506. elem = elements[ index ];
  46507. if ( !elem.style ) {
  46508. continue;
  46509. }
  46510. display = elem.style.display;
  46511. if ( show ) {
  46512. // Since we force visibility upon cascade-hidden elements, an immediate (and slow)
  46513. // check is required in this first loop unless we have a nonempty display value (either
  46514. // inline or about-to-be-restored)
  46515. if ( display === "none" ) {
  46516. values[ index ] = dataPriv.get( elem, "display" ) || null;
  46517. if ( !values[ index ] ) {
  46518. elem.style.display = "";
  46519. }
  46520. }
  46521. if ( elem.style.display === "" && isHiddenWithinTree( elem ) ) {
  46522. values[ index ] = getDefaultDisplay( elem );
  46523. }
  46524. } else {
  46525. if ( display !== "none" ) {
  46526. values[ index ] = "none";
  46527. // Remember what we're overwriting
  46528. dataPriv.set( elem, "display", display );
  46529. }
  46530. }
  46531. }
  46532. // Set the display of the elements in a second loop to avoid constant reflow
  46533. for ( index = 0; index < length; index++ ) {
  46534. if ( values[ index ] != null ) {
  46535. elements[ index ].style.display = values[ index ];
  46536. }
  46537. }
  46538. return elements;
  46539. }
  46540. jQuery.fn.extend( {
  46541. show: function() {
  46542. return showHide( this, true );
  46543. },
  46544. hide: function() {
  46545. return showHide( this );
  46546. },
  46547. toggle: function( state ) {
  46548. if ( typeof state === "boolean" ) {
  46549. return state ? this.show() : this.hide();
  46550. }
  46551. return this.each( function() {
  46552. if ( isHiddenWithinTree( this ) ) {
  46553. jQuery( this ).show();
  46554. } else {
  46555. jQuery( this ).hide();
  46556. }
  46557. } );
  46558. }
  46559. } );
  46560. var rcheckableType = ( /^(?:checkbox|radio)$/i );
  46561. var rtagName = ( /<([a-z][^\/\0>\x20\t\r\n\f]+)/i );
  46562. var rscriptType = ( /^$|^module$|\/(?:java|ecma)script/i );
  46563. // We have to close these tags to support XHTML (#13200)
  46564. var wrapMap = {
  46565. // Support: IE <=9 only
  46566. option: [ 1, "<select multiple='multiple'>", "</select>" ],
  46567. // XHTML parsers do not magically insert elements in the
  46568. // same way that tag soup parsers do. So we cannot shorten
  46569. // this by omitting <tbody> or other required elements.
  46570. thead: [ 1, "<table>", "</table>" ],
  46571. col: [ 2, "<table><colgroup>", "</colgroup></table>" ],
  46572. tr: [ 2, "<table><tbody>", "</tbody></table>" ],
  46573. td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ],
  46574. _default: [ 0, "", "" ]
  46575. };
  46576. // Support: IE <=9 only
  46577. wrapMap.optgroup = wrapMap.option;
  46578. wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
  46579. wrapMap.th = wrapMap.td;
  46580. function getAll( context, tag ) {
  46581. // Support: IE <=9 - 11 only
  46582. // Use typeof to avoid zero-argument method invocation on host objects (#15151)
  46583. var ret;
  46584. if ( typeof context.getElementsByTagName !== "undefined" ) {
  46585. ret = context.getElementsByTagName( tag || "*" );
  46586. } else if ( typeof context.querySelectorAll !== "undefined" ) {
  46587. ret = context.querySelectorAll( tag || "*" );
  46588. } else {
  46589. ret = [];
  46590. }
  46591. if ( tag === undefined || tag && nodeName( context, tag ) ) {
  46592. return jQuery.merge( [ context ], ret );
  46593. }
  46594. return ret;
  46595. }
  46596. // Mark scripts as having already been evaluated
  46597. function setGlobalEval( elems, refElements ) {
  46598. var i = 0,
  46599. l = elems.length;
  46600. for ( ; i < l; i++ ) {
  46601. dataPriv.set(
  46602. elems[ i ],
  46603. "globalEval",
  46604. !refElements || dataPriv.get( refElements[ i ], "globalEval" )
  46605. );
  46606. }
  46607. }
  46608. var rhtml = /<|&#?\w+;/;
  46609. function buildFragment( elems, context, scripts, selection, ignored ) {
  46610. var elem, tmp, tag, wrap, contains, j,
  46611. fragment = context.createDocumentFragment(),
  46612. nodes = [],
  46613. i = 0,
  46614. l = elems.length;
  46615. for ( ; i < l; i++ ) {
  46616. elem = elems[ i ];
  46617. if ( elem || elem === 0 ) {
  46618. // Add nodes directly
  46619. if ( toType( elem ) === "object" ) {
  46620. // Support: Android <=4.0 only, PhantomJS 1 only
  46621. // push.apply(_, arraylike) throws on ancient WebKit
  46622. jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem );
  46623. // Convert non-html into a text node
  46624. } else if ( !rhtml.test( elem ) ) {
  46625. nodes.push( context.createTextNode( elem ) );
  46626. // Convert html into DOM nodes
  46627. } else {
  46628. tmp = tmp || fragment.appendChild( context.createElement( "div" ) );
  46629. // Deserialize a standard representation
  46630. tag = ( rtagName.exec( elem ) || [ "", "" ] )[ 1 ].toLowerCase();
  46631. wrap = wrapMap[ tag ] || wrapMap._default;
  46632. tmp.innerHTML = wrap[ 1 ] + jQuery.htmlPrefilter( elem ) + wrap[ 2 ];
  46633. // Descend through wrappers to the right content
  46634. j = wrap[ 0 ];
  46635. while ( j-- ) {
  46636. tmp = tmp.lastChild;
  46637. }
  46638. // Support: Android <=4.0 only, PhantomJS 1 only
  46639. // push.apply(_, arraylike) throws on ancient WebKit
  46640. jQuery.merge( nodes, tmp.childNodes );
  46641. // Remember the top-level container
  46642. tmp = fragment.firstChild;
  46643. // Ensure the created nodes are orphaned (#12392)
  46644. tmp.textContent = "";
  46645. }
  46646. }
  46647. }
  46648. // Remove wrapper from fragment
  46649. fragment.textContent = "";
  46650. i = 0;
  46651. while ( ( elem = nodes[ i++ ] ) ) {
  46652. // Skip elements already in the context collection (trac-4087)
  46653. if ( selection && jQuery.inArray( elem, selection ) > -1 ) {
  46654. if ( ignored ) {
  46655. ignored.push( elem );
  46656. }
  46657. continue;
  46658. }
  46659. contains = jQuery.contains( elem.ownerDocument, elem );
  46660. // Append to fragment
  46661. tmp = getAll( fragment.appendChild( elem ), "script" );
  46662. // Preserve script evaluation history
  46663. if ( contains ) {
  46664. setGlobalEval( tmp );
  46665. }
  46666. // Capture executables
  46667. if ( scripts ) {
  46668. j = 0;
  46669. while ( ( elem = tmp[ j++ ] ) ) {
  46670. if ( rscriptType.test( elem.type || "" ) ) {
  46671. scripts.push( elem );
  46672. }
  46673. }
  46674. }
  46675. }
  46676. return fragment;
  46677. }
  46678. ( function() {
  46679. var fragment = document.createDocumentFragment(),
  46680. div = fragment.appendChild( document.createElement( "div" ) ),
  46681. input = document.createElement( "input" );
  46682. // Support: Android 4.0 - 4.3 only
  46683. // Check state lost if the name is set (#11217)
  46684. // Support: Windows Web Apps (WWA)
  46685. // `name` and `type` must use .setAttribute for WWA (#14901)
  46686. input.setAttribute( "type", "radio" );
  46687. input.setAttribute( "checked", "checked" );
  46688. input.setAttribute( "name", "t" );
  46689. div.appendChild( input );
  46690. // Support: Android <=4.1 only
  46691. // Older WebKit doesn't clone checked state correctly in fragments
  46692. support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked;
  46693. // Support: IE <=11 only
  46694. // Make sure textarea (and checkbox) defaultValue is properly cloned
  46695. div.innerHTML = "<textarea>x</textarea>";
  46696. support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue;
  46697. } )();
  46698. var documentElement = document.documentElement;
  46699. var
  46700. rkeyEvent = /^key/,
  46701. rmouseEvent = /^(?:mouse|pointer|contextmenu|drag|drop)|click/,
  46702. rtypenamespace = /^([^.]*)(?:\.(.+)|)/;
  46703. function returnTrue() {
  46704. return true;
  46705. }
  46706. function returnFalse() {
  46707. return false;
  46708. }
  46709. // Support: IE <=9 only
  46710. // See #13393 for more info
  46711. function safeActiveElement() {
  46712. try {
  46713. return document.activeElement;
  46714. } catch ( err ) { }
  46715. }
  46716. function on( elem, types, selector, data, fn, one ) {
  46717. var origFn, type;
  46718. // Types can be a map of types/handlers
  46719. if ( typeof types === "object" ) {
  46720. // ( types-Object, selector, data )
  46721. if ( typeof selector !== "string" ) {
  46722. // ( types-Object, data )
  46723. data = data || selector;
  46724. selector = undefined;
  46725. }
  46726. for ( type in types ) {
  46727. on( elem, type, selector, data, types[ type ], one );
  46728. }
  46729. return elem;
  46730. }
  46731. if ( data == null && fn == null ) {
  46732. // ( types, fn )
  46733. fn = selector;
  46734. data = selector = undefined;
  46735. } else if ( fn == null ) {
  46736. if ( typeof selector === "string" ) {
  46737. // ( types, selector, fn )
  46738. fn = data;
  46739. data = undefined;
  46740. } else {
  46741. // ( types, data, fn )
  46742. fn = data;
  46743. data = selector;
  46744. selector = undefined;
  46745. }
  46746. }
  46747. if ( fn === false ) {
  46748. fn = returnFalse;
  46749. } else if ( !fn ) {
  46750. return elem;
  46751. }
  46752. if ( one === 1 ) {
  46753. origFn = fn;
  46754. fn = function( event ) {
  46755. // Can use an empty set, since event contains the info
  46756. jQuery().off( event );
  46757. return origFn.apply( this, arguments );
  46758. };
  46759. // Use same guid so caller can remove using origFn
  46760. fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ );
  46761. }
  46762. return elem.each( function() {
  46763. jQuery.event.add( this, types, fn, data, selector );
  46764. } );
  46765. }
  46766. /*
  46767. * Helper functions for managing events -- not part of the public interface.
  46768. * Props to Dean Edwards' addEvent library for many of the ideas.
  46769. */
  46770. jQuery.event = {
  46771. global: {},
  46772. add: function( elem, types, handler, data, selector ) {
  46773. var handleObjIn, eventHandle, tmp,
  46774. events, t, handleObj,
  46775. special, handlers, type, namespaces, origType,
  46776. elemData = dataPriv.get( elem );
  46777. // Don't attach events to noData or text/comment nodes (but allow plain objects)
  46778. if ( !elemData ) {
  46779. return;
  46780. }
  46781. // Caller can pass in an object of custom data in lieu of the handler
  46782. if ( handler.handler ) {
  46783. handleObjIn = handler;
  46784. handler = handleObjIn.handler;
  46785. selector = handleObjIn.selector;
  46786. }
  46787. // Ensure that invalid selectors throw exceptions at attach time
  46788. // Evaluate against documentElement in case elem is a non-element node (e.g., document)
  46789. if ( selector ) {
  46790. jQuery.find.matchesSelector( documentElement, selector );
  46791. }
  46792. // Make sure that the handler has a unique ID, used to find/remove it later
  46793. if ( !handler.guid ) {
  46794. handler.guid = jQuery.guid++;
  46795. }
  46796. // Init the element's event structure and main handler, if this is the first
  46797. if ( !( events = elemData.events ) ) {
  46798. events = elemData.events = {};
  46799. }
  46800. if ( !( eventHandle = elemData.handle ) ) {
  46801. eventHandle = elemData.handle = function( e ) {
  46802. // Discard the second event of a jQuery.event.trigger() and
  46803. // when an event is called after a page has unloaded
  46804. return typeof jQuery !== "undefined" && jQuery.event.triggered !== e.type ?
  46805. jQuery.event.dispatch.apply( elem, arguments ) : undefined;
  46806. };
  46807. }
  46808. // Handle multiple events separated by a space
  46809. types = ( types || "" ).match( rnothtmlwhite ) || [ "" ];
  46810. t = types.length;
  46811. while ( t-- ) {
  46812. tmp = rtypenamespace.exec( types[ t ] ) || [];
  46813. type = origType = tmp[ 1 ];
  46814. namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort();
  46815. // There *must* be a type, no attaching namespace-only handlers
  46816. if ( !type ) {
  46817. continue;
  46818. }
  46819. // If event changes its type, use the special event handlers for the changed type
  46820. special = jQuery.event.special[ type ] || {};
  46821. // If selector defined, determine special event api type, otherwise given type
  46822. type = ( selector ? special.delegateType : special.bindType ) || type;
  46823. // Update special based on newly reset type
  46824. special = jQuery.event.special[ type ] || {};
  46825. // handleObj is passed to all event handlers
  46826. handleObj = jQuery.extend( {
  46827. type: type,
  46828. origType: origType,
  46829. data: data,
  46830. handler: handler,
  46831. guid: handler.guid,
  46832. selector: selector,
  46833. needsContext: selector && jQuery.expr.match.needsContext.test( selector ),
  46834. namespace: namespaces.join( "." )
  46835. }, handleObjIn );
  46836. // Init the event handler queue if we're the first
  46837. if ( !( handlers = events[ type ] ) ) {
  46838. handlers = events[ type ] = [];
  46839. handlers.delegateCount = 0;
  46840. // Only use addEventListener if the special events handler returns false
  46841. if ( !special.setup ||
  46842. special.setup.call( elem, data, namespaces, eventHandle ) === false ) {
  46843. if ( elem.addEventListener ) {
  46844. elem.addEventListener( type, eventHandle );
  46845. }
  46846. }
  46847. }
  46848. if ( special.add ) {
  46849. special.add.call( elem, handleObj );
  46850. if ( !handleObj.handler.guid ) {
  46851. handleObj.handler.guid = handler.guid;
  46852. }
  46853. }
  46854. // Add to the element's handler list, delegates in front
  46855. if ( selector ) {
  46856. handlers.splice( handlers.delegateCount++, 0, handleObj );
  46857. } else {
  46858. handlers.push( handleObj );
  46859. }
  46860. // Keep track of which events have ever been used, for event optimization
  46861. jQuery.event.global[ type ] = true;
  46862. }
  46863. },
  46864. // Detach an event or set of events from an element
  46865. remove: function( elem, types, handler, selector, mappedTypes ) {
  46866. var j, origCount, tmp,
  46867. events, t, handleObj,
  46868. special, handlers, type, namespaces, origType,
  46869. elemData = dataPriv.hasData( elem ) && dataPriv.get( elem );
  46870. if ( !elemData || !( events = elemData.events ) ) {
  46871. return;
  46872. }
  46873. // Once for each type.namespace in types; type may be omitted
  46874. types = ( types || "" ).match( rnothtmlwhite ) || [ "" ];
  46875. t = types.length;
  46876. while ( t-- ) {
  46877. tmp = rtypenamespace.exec( types[ t ] ) || [];
  46878. type = origType = tmp[ 1 ];
  46879. namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort();
  46880. // Unbind all events (on this namespace, if provided) for the element
  46881. if ( !type ) {
  46882. for ( type in events ) {
  46883. jQuery.event.remove( elem, type + types[ t ], handler, selector, true );
  46884. }
  46885. continue;
  46886. }
  46887. special = jQuery.event.special[ type ] || {};
  46888. type = ( selector ? special.delegateType : special.bindType ) || type;
  46889. handlers = events[ type ] || [];
  46890. tmp = tmp[ 2 ] &&
  46891. new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" );
  46892. // Remove matching events
  46893. origCount = j = handlers.length;
  46894. while ( j-- ) {
  46895. handleObj = handlers[ j ];
  46896. if ( ( mappedTypes || origType === handleObj.origType ) &&
  46897. ( !handler || handler.guid === handleObj.guid ) &&
  46898. ( !tmp || tmp.test( handleObj.namespace ) ) &&
  46899. ( !selector || selector === handleObj.selector ||
  46900. selector === "**" && handleObj.selector ) ) {
  46901. handlers.splice( j, 1 );
  46902. if ( handleObj.selector ) {
  46903. handlers.delegateCount--;
  46904. }
  46905. if ( special.remove ) {
  46906. special.remove.call( elem, handleObj );
  46907. }
  46908. }
  46909. }
  46910. // Remove generic event handler if we removed something and no more handlers exist
  46911. // (avoids potential for endless recursion during removal of special event handlers)
  46912. if ( origCount && !handlers.length ) {
  46913. if ( !special.teardown ||
  46914. special.teardown.call( elem, namespaces, elemData.handle ) === false ) {
  46915. jQuery.removeEvent( elem, type, elemData.handle );
  46916. }
  46917. delete events[ type ];
  46918. }
  46919. }
  46920. // Remove data and the expando if it's no longer used
  46921. if ( jQuery.isEmptyObject( events ) ) {
  46922. dataPriv.remove( elem, "handle events" );
  46923. }
  46924. },
  46925. dispatch: function( nativeEvent ) {
  46926. // Make a writable jQuery.Event from the native event object
  46927. var event = jQuery.event.fix( nativeEvent );
  46928. var i, j, ret, matched, handleObj, handlerQueue,
  46929. args = new Array( arguments.length ),
  46930. handlers = ( dataPriv.get( this, "events" ) || {} )[ event.type ] || [],
  46931. special = jQuery.event.special[ event.type ] || {};
  46932. // Use the fix-ed jQuery.Event rather than the (read-only) native event
  46933. args[ 0 ] = event;
  46934. for ( i = 1; i < arguments.length; i++ ) {
  46935. args[ i ] = arguments[ i ];
  46936. }
  46937. event.delegateTarget = this;
  46938. // Call the preDispatch hook for the mapped type, and let it bail if desired
  46939. if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) {
  46940. return;
  46941. }
  46942. // Determine handlers
  46943. handlerQueue = jQuery.event.handlers.call( this, event, handlers );
  46944. // Run delegates first; they may want to stop propagation beneath us
  46945. i = 0;
  46946. while ( ( matched = handlerQueue[ i++ ] ) && !event.isPropagationStopped() ) {
  46947. event.currentTarget = matched.elem;
  46948. j = 0;
  46949. while ( ( handleObj = matched.handlers[ j++ ] ) &&
  46950. !event.isImmediatePropagationStopped() ) {
  46951. // Triggered event must either 1) have no namespace, or 2) have namespace(s)
  46952. // a subset or equal to those in the bound event (both can have no namespace).
  46953. if ( !event.rnamespace || event.rnamespace.test( handleObj.namespace ) ) {
  46954. event.handleObj = handleObj;
  46955. event.data = handleObj.data;
  46956. ret = ( ( jQuery.event.special[ handleObj.origType ] || {} ).handle ||
  46957. handleObj.handler ).apply( matched.elem, args );
  46958. if ( ret !== undefined ) {
  46959. if ( ( event.result = ret ) === false ) {
  46960. event.preventDefault();
  46961. event.stopPropagation();
  46962. }
  46963. }
  46964. }
  46965. }
  46966. }
  46967. // Call the postDispatch hook for the mapped type
  46968. if ( special.postDispatch ) {
  46969. special.postDispatch.call( this, event );
  46970. }
  46971. return event.result;
  46972. },
  46973. handlers: function( event, handlers ) {
  46974. var i, handleObj, sel, matchedHandlers, matchedSelectors,
  46975. handlerQueue = [],
  46976. delegateCount = handlers.delegateCount,
  46977. cur = event.target;
  46978. // Find delegate handlers
  46979. if ( delegateCount &&
  46980. // Support: IE <=9
  46981. // Black-hole SVG <use> instance trees (trac-13180)
  46982. cur.nodeType &&
  46983. // Support: Firefox <=42
  46984. // Suppress spec-violating clicks indicating a non-primary pointer button (trac-3861)
  46985. // https://www.w3.org/TR/DOM-Level-3-Events/#event-type-click
  46986. // Support: IE 11 only
  46987. // ...but not arrow key "clicks" of radio inputs, which can have `button` -1 (gh-2343)
  46988. !( event.type === "click" && event.button >= 1 ) ) {
  46989. for ( ; cur !== this; cur = cur.parentNode || this ) {
  46990. // Don't check non-elements (#13208)
  46991. // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764)
  46992. if ( cur.nodeType === 1 && !( event.type === "click" && cur.disabled === true ) ) {
  46993. matchedHandlers = [];
  46994. matchedSelectors = {};
  46995. for ( i = 0; i < delegateCount; i++ ) {
  46996. handleObj = handlers[ i ];
  46997. // Don't conflict with Object.prototype properties (#13203)
  46998. sel = handleObj.selector + " ";
  46999. if ( matchedSelectors[ sel ] === undefined ) {
  47000. matchedSelectors[ sel ] = handleObj.needsContext ?
  47001. jQuery( sel, this ).index( cur ) > -1 :
  47002. jQuery.find( sel, this, null, [ cur ] ).length;
  47003. }
  47004. if ( matchedSelectors[ sel ] ) {
  47005. matchedHandlers.push( handleObj );
  47006. }
  47007. }
  47008. if ( matchedHandlers.length ) {
  47009. handlerQueue.push( { elem: cur, handlers: matchedHandlers } );
  47010. }
  47011. }
  47012. }
  47013. }
  47014. // Add the remaining (directly-bound) handlers
  47015. cur = this;
  47016. if ( delegateCount < handlers.length ) {
  47017. handlerQueue.push( { elem: cur, handlers: handlers.slice( delegateCount ) } );
  47018. }
  47019. return handlerQueue;
  47020. },
  47021. addProp: function( name, hook ) {
  47022. Object.defineProperty( jQuery.Event.prototype, name, {
  47023. enumerable: true,
  47024. configurable: true,
  47025. get: isFunction( hook ) ?
  47026. function() {
  47027. if ( this.originalEvent ) {
  47028. return hook( this.originalEvent );
  47029. }
  47030. } :
  47031. function() {
  47032. if ( this.originalEvent ) {
  47033. return this.originalEvent[ name ];
  47034. }
  47035. },
  47036. set: function( value ) {
  47037. Object.defineProperty( this, name, {
  47038. enumerable: true,
  47039. configurable: true,
  47040. writable: true,
  47041. value: value
  47042. } );
  47043. }
  47044. } );
  47045. },
  47046. fix: function( originalEvent ) {
  47047. return originalEvent[ jQuery.expando ] ?
  47048. originalEvent :
  47049. new jQuery.Event( originalEvent );
  47050. },
  47051. special: {
  47052. load: {
  47053. // Prevent triggered image.load events from bubbling to window.load
  47054. noBubble: true
  47055. },
  47056. focus: {
  47057. // Fire native event if possible so blur/focus sequence is correct
  47058. trigger: function() {
  47059. if ( this !== safeActiveElement() && this.focus ) {
  47060. this.focus();
  47061. return false;
  47062. }
  47063. },
  47064. delegateType: "focusin"
  47065. },
  47066. blur: {
  47067. trigger: function() {
  47068. if ( this === safeActiveElement() && this.blur ) {
  47069. this.blur();
  47070. return false;
  47071. }
  47072. },
  47073. delegateType: "focusout"
  47074. },
  47075. click: {
  47076. // For checkbox, fire native event so checked state will be right
  47077. trigger: function() {
  47078. if ( this.type === "checkbox" && this.click && nodeName( this, "input" ) ) {
  47079. this.click();
  47080. return false;
  47081. }
  47082. },
  47083. // For cross-browser consistency, don't fire native .click() on links
  47084. _default: function( event ) {
  47085. return nodeName( event.target, "a" );
  47086. }
  47087. },
  47088. beforeunload: {
  47089. postDispatch: function( event ) {
  47090. // Support: Firefox 20+
  47091. // Firefox doesn't alert if the returnValue field is not set.
  47092. if ( event.result !== undefined && event.originalEvent ) {
  47093. event.originalEvent.returnValue = event.result;
  47094. }
  47095. }
  47096. }
  47097. }
  47098. };
  47099. jQuery.removeEvent = function( elem, type, handle ) {
  47100. // This "if" is needed for plain objects
  47101. if ( elem.removeEventListener ) {
  47102. elem.removeEventListener( type, handle );
  47103. }
  47104. };
  47105. jQuery.Event = function( src, props ) {
  47106. // Allow instantiation without the 'new' keyword
  47107. if ( !( this instanceof jQuery.Event ) ) {
  47108. return new jQuery.Event( src, props );
  47109. }
  47110. // Event object
  47111. if ( src && src.type ) {
  47112. this.originalEvent = src;
  47113. this.type = src.type;
  47114. // Events bubbling up the document may have been marked as prevented
  47115. // by a handler lower down the tree; reflect the correct value.
  47116. this.isDefaultPrevented = src.defaultPrevented ||
  47117. src.defaultPrevented === undefined &&
  47118. // Support: Android <=2.3 only
  47119. src.returnValue === false ?
  47120. returnTrue :
  47121. returnFalse;
  47122. // Create target properties
  47123. // Support: Safari <=6 - 7 only
  47124. // Target should not be a text node (#504, #13143)
  47125. this.target = ( src.target && src.target.nodeType === 3 ) ?
  47126. src.target.parentNode :
  47127. src.target;
  47128. this.currentTarget = src.currentTarget;
  47129. this.relatedTarget = src.relatedTarget;
  47130. // Event type
  47131. } else {
  47132. this.type = src;
  47133. }
  47134. // Put explicitly provided properties onto the event object
  47135. if ( props ) {
  47136. jQuery.extend( this, props );
  47137. }
  47138. // Create a timestamp if incoming event doesn't have one
  47139. this.timeStamp = src && src.timeStamp || Date.now();
  47140. // Mark it as fixed
  47141. this[ jQuery.expando ] = true;
  47142. };
  47143. // jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
  47144. // https://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
  47145. jQuery.Event.prototype = {
  47146. constructor: jQuery.Event,
  47147. isDefaultPrevented: returnFalse,
  47148. isPropagationStopped: returnFalse,
  47149. isImmediatePropagationStopped: returnFalse,
  47150. isSimulated: false,
  47151. preventDefault: function() {
  47152. var e = this.originalEvent;
  47153. this.isDefaultPrevented = returnTrue;
  47154. if ( e && !this.isSimulated ) {
  47155. e.preventDefault();
  47156. }
  47157. },
  47158. stopPropagation: function() {
  47159. var e = this.originalEvent;
  47160. this.isPropagationStopped = returnTrue;
  47161. if ( e && !this.isSimulated ) {
  47162. e.stopPropagation();
  47163. }
  47164. },
  47165. stopImmediatePropagation: function() {
  47166. var e = this.originalEvent;
  47167. this.isImmediatePropagationStopped = returnTrue;
  47168. if ( e && !this.isSimulated ) {
  47169. e.stopImmediatePropagation();
  47170. }
  47171. this.stopPropagation();
  47172. }
  47173. };
  47174. // Includes all common event props including KeyEvent and MouseEvent specific props
  47175. jQuery.each( {
  47176. altKey: true,
  47177. bubbles: true,
  47178. cancelable: true,
  47179. changedTouches: true,
  47180. ctrlKey: true,
  47181. detail: true,
  47182. eventPhase: true,
  47183. metaKey: true,
  47184. pageX: true,
  47185. pageY: true,
  47186. shiftKey: true,
  47187. view: true,
  47188. "char": true,
  47189. charCode: true,
  47190. key: true,
  47191. keyCode: true,
  47192. button: true,
  47193. buttons: true,
  47194. clientX: true,
  47195. clientY: true,
  47196. offsetX: true,
  47197. offsetY: true,
  47198. pointerId: true,
  47199. pointerType: true,
  47200. screenX: true,
  47201. screenY: true,
  47202. targetTouches: true,
  47203. toElement: true,
  47204. touches: true,
  47205. which: function( event ) {
  47206. var button = event.button;
  47207. // Add which for key events
  47208. if ( event.which == null && rkeyEvent.test( event.type ) ) {
  47209. return event.charCode != null ? event.charCode : event.keyCode;
  47210. }
  47211. // Add which for click: 1 === left; 2 === middle; 3 === right
  47212. if ( !event.which && button !== undefined && rmouseEvent.test( event.type ) ) {
  47213. if ( button & 1 ) {
  47214. return 1;
  47215. }
  47216. if ( button & 2 ) {
  47217. return 3;
  47218. }
  47219. if ( button & 4 ) {
  47220. return 2;
  47221. }
  47222. return 0;
  47223. }
  47224. return event.which;
  47225. }
  47226. }, jQuery.event.addProp );
  47227. // Create mouseenter/leave events using mouseover/out and event-time checks
  47228. // so that event delegation works in jQuery.
  47229. // Do the same for pointerenter/pointerleave and pointerover/pointerout
  47230. //
  47231. // Support: Safari 7 only
  47232. // Safari sends mouseenter too often; see:
  47233. // https://bugs.chromium.org/p/chromium/issues/detail?id=470258
  47234. // for the description of the bug (it existed in older Chrome versions as well).
  47235. jQuery.each( {
  47236. mouseenter: "mouseover",
  47237. mouseleave: "mouseout",
  47238. pointerenter: "pointerover",
  47239. pointerleave: "pointerout"
  47240. }, function( orig, fix ) {
  47241. jQuery.event.special[ orig ] = {
  47242. delegateType: fix,
  47243. bindType: fix,
  47244. handle: function( event ) {
  47245. var ret,
  47246. target = this,
  47247. related = event.relatedTarget,
  47248. handleObj = event.handleObj;
  47249. // For mouseenter/leave call the handler if related is outside the target.
  47250. // NB: No relatedTarget if the mouse left/entered the browser window
  47251. if ( !related || ( related !== target && !jQuery.contains( target, related ) ) ) {
  47252. event.type = handleObj.origType;
  47253. ret = handleObj.handler.apply( this, arguments );
  47254. event.type = fix;
  47255. }
  47256. return ret;
  47257. }
  47258. };
  47259. } );
  47260. jQuery.fn.extend( {
  47261. on: function( types, selector, data, fn ) {
  47262. return on( this, types, selector, data, fn );
  47263. },
  47264. one: function( types, selector, data, fn ) {
  47265. return on( this, types, selector, data, fn, 1 );
  47266. },
  47267. off: function( types, selector, fn ) {
  47268. var handleObj, type;
  47269. if ( types && types.preventDefault && types.handleObj ) {
  47270. // ( event ) dispatched jQuery.Event
  47271. handleObj = types.handleObj;
  47272. jQuery( types.delegateTarget ).off(
  47273. handleObj.namespace ?
  47274. handleObj.origType + "." + handleObj.namespace :
  47275. handleObj.origType,
  47276. handleObj.selector,
  47277. handleObj.handler
  47278. );
  47279. return this;
  47280. }
  47281. if ( typeof types === "object" ) {
  47282. // ( types-object [, selector] )
  47283. for ( type in types ) {
  47284. this.off( type, selector, types[ type ] );
  47285. }
  47286. return this;
  47287. }
  47288. if ( selector === false || typeof selector === "function" ) {
  47289. // ( types [, fn] )
  47290. fn = selector;
  47291. selector = undefined;
  47292. }
  47293. if ( fn === false ) {
  47294. fn = returnFalse;
  47295. }
  47296. return this.each( function() {
  47297. jQuery.event.remove( this, types, fn, selector );
  47298. } );
  47299. }
  47300. } );
  47301. var
  47302. /* eslint-disable max-len */
  47303. // See https://github.com/eslint/eslint/issues/3229
  47304. rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([a-z][^\/\0>\x20\t\r\n\f]*)[^>]*)\/>/gi,
  47305. /* eslint-enable */
  47306. // Support: IE <=10 - 11, Edge 12 - 13 only
  47307. // In IE/Edge using regex groups here causes severe slowdowns.
  47308. // See https://connect.microsoft.com/IE/feedback/details/1736512/
  47309. rnoInnerhtml = /<script|<style|<link/i,
  47310. // checked="checked" or checked
  47311. rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
  47312. rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g;
  47313. // Prefer a tbody over its parent table for containing new rows
  47314. function manipulationTarget( elem, content ) {
  47315. if ( nodeName( elem, "table" ) &&
  47316. nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ) {
  47317. return jQuery( elem ).children( "tbody" )[ 0 ] || elem;
  47318. }
  47319. return elem;
  47320. }
  47321. // Replace/restore the type attribute of script elements for safe DOM manipulation
  47322. function disableScript( elem ) {
  47323. elem.type = ( elem.getAttribute( "type" ) !== null ) + "/" + elem.type;
  47324. return elem;
  47325. }
  47326. function restoreScript( elem ) {
  47327. if ( ( elem.type || "" ).slice( 0, 5 ) === "true/" ) {
  47328. elem.type = elem.type.slice( 5 );
  47329. } else {
  47330. elem.removeAttribute( "type" );
  47331. }
  47332. return elem;
  47333. }
  47334. function cloneCopyEvent( src, dest ) {
  47335. var i, l, type, pdataOld, pdataCur, udataOld, udataCur, events;
  47336. if ( dest.nodeType !== 1 ) {
  47337. return;
  47338. }
  47339. // 1. Copy private data: events, handlers, etc.
  47340. if ( dataPriv.hasData( src ) ) {
  47341. pdataOld = dataPriv.access( src );
  47342. pdataCur = dataPriv.set( dest, pdataOld );
  47343. events = pdataOld.events;
  47344. if ( events ) {
  47345. delete pdataCur.handle;
  47346. pdataCur.events = {};
  47347. for ( type in events ) {
  47348. for ( i = 0, l = events[ type ].length; i < l; i++ ) {
  47349. jQuery.event.add( dest, type, events[ type ][ i ] );
  47350. }
  47351. }
  47352. }
  47353. }
  47354. // 2. Copy user data
  47355. if ( dataUser.hasData( src ) ) {
  47356. udataOld = dataUser.access( src );
  47357. udataCur = jQuery.extend( {}, udataOld );
  47358. dataUser.set( dest, udataCur );
  47359. }
  47360. }
  47361. // Fix IE bugs, see support tests
  47362. function fixInput( src, dest ) {
  47363. var nodeName = dest.nodeName.toLowerCase();
  47364. // Fails to persist the checked state of a cloned checkbox or radio button.
  47365. if ( nodeName === "input" && rcheckableType.test( src.type ) ) {
  47366. dest.checked = src.checked;
  47367. // Fails to return the selected option to the default selected state when cloning options
  47368. } else if ( nodeName === "input" || nodeName === "textarea" ) {
  47369. dest.defaultValue = src.defaultValue;
  47370. }
  47371. }
  47372. function domManip( collection, args, callback, ignored ) {
  47373. // Flatten any nested arrays
  47374. args = concat.apply( [], args );
  47375. var fragment, first, scripts, hasScripts, node, doc,
  47376. i = 0,
  47377. l = collection.length,
  47378. iNoClone = l - 1,
  47379. value = args[ 0 ],
  47380. valueIsFunction = isFunction( value );
  47381. // We can't cloneNode fragments that contain checked, in WebKit
  47382. if ( valueIsFunction ||
  47383. ( l > 1 && typeof value === "string" &&
  47384. !support.checkClone && rchecked.test( value ) ) ) {
  47385. return collection.each( function( index ) {
  47386. var self = collection.eq( index );
  47387. if ( valueIsFunction ) {
  47388. args[ 0 ] = value.call( this, index, self.html() );
  47389. }
  47390. domManip( self, args, callback, ignored );
  47391. } );
  47392. }
  47393. if ( l ) {
  47394. fragment = buildFragment( args, collection[ 0 ].ownerDocument, false, collection, ignored );
  47395. first = fragment.firstChild;
  47396. if ( fragment.childNodes.length === 1 ) {
  47397. fragment = first;
  47398. }
  47399. // Require either new content or an interest in ignored elements to invoke the callback
  47400. if ( first || ignored ) {
  47401. scripts = jQuery.map( getAll( fragment, "script" ), disableScript );
  47402. hasScripts = scripts.length;
  47403. // Use the original fragment for the last item
  47404. // instead of the first because it can end up
  47405. // being emptied incorrectly in certain situations (#8070).
  47406. for ( ; i < l; i++ ) {
  47407. node = fragment;
  47408. if ( i !== iNoClone ) {
  47409. node = jQuery.clone( node, true, true );
  47410. // Keep references to cloned scripts for later restoration
  47411. if ( hasScripts ) {
  47412. // Support: Android <=4.0 only, PhantomJS 1 only
  47413. // push.apply(_, arraylike) throws on ancient WebKit
  47414. jQuery.merge( scripts, getAll( node, "script" ) );
  47415. }
  47416. }
  47417. callback.call( collection[ i ], node, i );
  47418. }
  47419. if ( hasScripts ) {
  47420. doc = scripts[ scripts.length - 1 ].ownerDocument;
  47421. // Reenable scripts
  47422. jQuery.map( scripts, restoreScript );
  47423. // Evaluate executable scripts on first document insertion
  47424. for ( i = 0; i < hasScripts; i++ ) {
  47425. node = scripts[ i ];
  47426. if ( rscriptType.test( node.type || "" ) &&
  47427. !dataPriv.access( node, "globalEval" ) &&
  47428. jQuery.contains( doc, node ) ) {
  47429. if ( node.src && ( node.type || "" ).toLowerCase() !== "module" ) {
  47430. // Optional AJAX dependency, but won't run scripts if not present
  47431. if ( jQuery._evalUrl ) {
  47432. jQuery._evalUrl( node.src );
  47433. }
  47434. } else {
  47435. DOMEval( node.textContent.replace( rcleanScript, "" ), doc, node );
  47436. }
  47437. }
  47438. }
  47439. }
  47440. }
  47441. }
  47442. return collection;
  47443. }
  47444. function remove( elem, selector, keepData ) {
  47445. var node,
  47446. nodes = selector ? jQuery.filter( selector, elem ) : elem,
  47447. i = 0;
  47448. for ( ; ( node = nodes[ i ] ) != null; i++ ) {
  47449. if ( !keepData && node.nodeType === 1 ) {
  47450. jQuery.cleanData( getAll( node ) );
  47451. }
  47452. if ( node.parentNode ) {
  47453. if ( keepData && jQuery.contains( node.ownerDocument, node ) ) {
  47454. setGlobalEval( getAll( node, "script" ) );
  47455. }
  47456. node.parentNode.removeChild( node );
  47457. }
  47458. }
  47459. return elem;
  47460. }
  47461. jQuery.extend( {
  47462. htmlPrefilter: function( html ) {
  47463. return html.replace( rxhtmlTag, "<$1></$2>" );
  47464. },
  47465. clone: function( elem, dataAndEvents, deepDataAndEvents ) {
  47466. var i, l, srcElements, destElements,
  47467. clone = elem.cloneNode( true ),
  47468. inPage = jQuery.contains( elem.ownerDocument, elem );
  47469. // Fix IE cloning issues
  47470. if ( !support.noCloneChecked && ( elem.nodeType === 1 || elem.nodeType === 11 ) &&
  47471. !jQuery.isXMLDoc( elem ) ) {
  47472. // We eschew Sizzle here for performance reasons: https://jsperf.com/getall-vs-sizzle/2
  47473. destElements = getAll( clone );
  47474. srcElements = getAll( elem );
  47475. for ( i = 0, l = srcElements.length; i < l; i++ ) {
  47476. fixInput( srcElements[ i ], destElements[ i ] );
  47477. }
  47478. }
  47479. // Copy the events from the original to the clone
  47480. if ( dataAndEvents ) {
  47481. if ( deepDataAndEvents ) {
  47482. srcElements = srcElements || getAll( elem );
  47483. destElements = destElements || getAll( clone );
  47484. for ( i = 0, l = srcElements.length; i < l; i++ ) {
  47485. cloneCopyEvent( srcElements[ i ], destElements[ i ] );
  47486. }
  47487. } else {
  47488. cloneCopyEvent( elem, clone );
  47489. }
  47490. }
  47491. // Preserve script evaluation history
  47492. destElements = getAll( clone, "script" );
  47493. if ( destElements.length > 0 ) {
  47494. setGlobalEval( destElements, !inPage && getAll( elem, "script" ) );
  47495. }
  47496. // Return the cloned set
  47497. return clone;
  47498. },
  47499. cleanData: function( elems ) {
  47500. var data, elem, type,
  47501. special = jQuery.event.special,
  47502. i = 0;
  47503. for ( ; ( elem = elems[ i ] ) !== undefined; i++ ) {
  47504. if ( acceptData( elem ) ) {
  47505. if ( ( data = elem[ dataPriv.expando ] ) ) {
  47506. if ( data.events ) {
  47507. for ( type in data.events ) {
  47508. if ( special[ type ] ) {
  47509. jQuery.event.remove( elem, type );
  47510. // This is a shortcut to avoid jQuery.event.remove's overhead
  47511. } else {
  47512. jQuery.removeEvent( elem, type, data.handle );
  47513. }
  47514. }
  47515. }
  47516. // Support: Chrome <=35 - 45+
  47517. // Assign undefined instead of using delete, see Data#remove
  47518. elem[ dataPriv.expando ] = undefined;
  47519. }
  47520. if ( elem[ dataUser.expando ] ) {
  47521. // Support: Chrome <=35 - 45+
  47522. // Assign undefined instead of using delete, see Data#remove
  47523. elem[ dataUser.expando ] = undefined;
  47524. }
  47525. }
  47526. }
  47527. }
  47528. } );
  47529. jQuery.fn.extend( {
  47530. detach: function( selector ) {
  47531. return remove( this, selector, true );
  47532. },
  47533. remove: function( selector ) {
  47534. return remove( this, selector );
  47535. },
  47536. text: function( value ) {
  47537. return access( this, function( value ) {
  47538. return value === undefined ?
  47539. jQuery.text( this ) :
  47540. this.empty().each( function() {
  47541. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  47542. this.textContent = value;
  47543. }
  47544. } );
  47545. }, null, value, arguments.length );
  47546. },
  47547. append: function() {
  47548. return domManip( this, arguments, function( elem ) {
  47549. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  47550. var target = manipulationTarget( this, elem );
  47551. target.appendChild( elem );
  47552. }
  47553. } );
  47554. },
  47555. prepend: function() {
  47556. return domManip( this, arguments, function( elem ) {
  47557. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  47558. var target = manipulationTarget( this, elem );
  47559. target.insertBefore( elem, target.firstChild );
  47560. }
  47561. } );
  47562. },
  47563. before: function() {
  47564. return domManip( this, arguments, function( elem ) {
  47565. if ( this.parentNode ) {
  47566. this.parentNode.insertBefore( elem, this );
  47567. }
  47568. } );
  47569. },
  47570. after: function() {
  47571. return domManip( this, arguments, function( elem ) {
  47572. if ( this.parentNode ) {
  47573. this.parentNode.insertBefore( elem, this.nextSibling );
  47574. }
  47575. } );
  47576. },
  47577. empty: function() {
  47578. var elem,
  47579. i = 0;
  47580. for ( ; ( elem = this[ i ] ) != null; i++ ) {
  47581. if ( elem.nodeType === 1 ) {
  47582. // Prevent memory leaks
  47583. jQuery.cleanData( getAll( elem, false ) );
  47584. // Remove any remaining nodes
  47585. elem.textContent = "";
  47586. }
  47587. }
  47588. return this;
  47589. },
  47590. clone: function( dataAndEvents, deepDataAndEvents ) {
  47591. dataAndEvents = dataAndEvents == null ? false : dataAndEvents;
  47592. deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;
  47593. return this.map( function() {
  47594. return jQuery.clone( this, dataAndEvents, deepDataAndEvents );
  47595. } );
  47596. },
  47597. html: function( value ) {
  47598. return access( this, function( value ) {
  47599. var elem = this[ 0 ] || {},
  47600. i = 0,
  47601. l = this.length;
  47602. if ( value === undefined && elem.nodeType === 1 ) {
  47603. return elem.innerHTML;
  47604. }
  47605. // See if we can take a shortcut and just use innerHTML
  47606. if ( typeof value === "string" && !rnoInnerhtml.test( value ) &&
  47607. !wrapMap[ ( rtagName.exec( value ) || [ "", "" ] )[ 1 ].toLowerCase() ] ) {
  47608. value = jQuery.htmlPrefilter( value );
  47609. try {
  47610. for ( ; i < l; i++ ) {
  47611. elem = this[ i ] || {};
  47612. // Remove element nodes and prevent memory leaks
  47613. if ( elem.nodeType === 1 ) {
  47614. jQuery.cleanData( getAll( elem, false ) );
  47615. elem.innerHTML = value;
  47616. }
  47617. }
  47618. elem = 0;
  47619. // If using innerHTML throws an exception, use the fallback method
  47620. } catch ( e ) {}
  47621. }
  47622. if ( elem ) {
  47623. this.empty().append( value );
  47624. }
  47625. }, null, value, arguments.length );
  47626. },
  47627. replaceWith: function() {
  47628. var ignored = [];
  47629. // Make the changes, replacing each non-ignored context element with the new content
  47630. return domManip( this, arguments, function( elem ) {
  47631. var parent = this.parentNode;
  47632. if ( jQuery.inArray( this, ignored ) < 0 ) {
  47633. jQuery.cleanData( getAll( this ) );
  47634. if ( parent ) {
  47635. parent.replaceChild( elem, this );
  47636. }
  47637. }
  47638. // Force callback invocation
  47639. }, ignored );
  47640. }
  47641. } );
  47642. jQuery.each( {
  47643. appendTo: "append",
  47644. prependTo: "prepend",
  47645. insertBefore: "before",
  47646. insertAfter: "after",
  47647. replaceAll: "replaceWith"
  47648. }, function( name, original ) {
  47649. jQuery.fn[ name ] = function( selector ) {
  47650. var elems,
  47651. ret = [],
  47652. insert = jQuery( selector ),
  47653. last = insert.length - 1,
  47654. i = 0;
  47655. for ( ; i <= last; i++ ) {
  47656. elems = i === last ? this : this.clone( true );
  47657. jQuery( insert[ i ] )[ original ]( elems );
  47658. // Support: Android <=4.0 only, PhantomJS 1 only
  47659. // .get() because push.apply(_, arraylike) throws on ancient WebKit
  47660. push.apply( ret, elems.get() );
  47661. }
  47662. return this.pushStack( ret );
  47663. };
  47664. } );
  47665. var rnumnonpx = new RegExp( "^(" + pnum + ")(?!px)[a-z%]+$", "i" );
  47666. var getStyles = function( elem ) {
  47667. // Support: IE <=11 only, Firefox <=30 (#15098, #14150)
  47668. // IE throws on elements created in popups
  47669. // FF meanwhile throws on frame elements through "defaultView.getComputedStyle"
  47670. var view = elem.ownerDocument.defaultView;
  47671. if ( !view || !view.opener ) {
  47672. view = window;
  47673. }
  47674. return view.getComputedStyle( elem );
  47675. };
  47676. var rboxStyle = new RegExp( cssExpand.join( "|" ), "i" );
  47677. ( function() {
  47678. // Executing both pixelPosition & boxSizingReliable tests require only one layout
  47679. // so they're executed at the same time to save the second computation.
  47680. function computeStyleTests() {
  47681. // This is a singleton, we need to execute it only once
  47682. if ( !div ) {
  47683. return;
  47684. }
  47685. container.style.cssText = "position:absolute;left:-11111px;width:60px;" +
  47686. "margin-top:1px;padding:0;border:0";
  47687. div.style.cssText =
  47688. "position:relative;display:block;box-sizing:border-box;overflow:scroll;" +
  47689. "margin:auto;border:1px;padding:1px;" +
  47690. "width:60%;top:1%";
  47691. documentElement.appendChild( container ).appendChild( div );
  47692. var divStyle = window.getComputedStyle( div );
  47693. pixelPositionVal = divStyle.top !== "1%";
  47694. // Support: Android 4.0 - 4.3 only, Firefox <=3 - 44
  47695. reliableMarginLeftVal = roundPixelMeasures( divStyle.marginLeft ) === 12;
  47696. // Support: Android 4.0 - 4.3 only, Safari <=9.1 - 10.1, iOS <=7.0 - 9.3
  47697. // Some styles come back with percentage values, even though they shouldn't
  47698. div.style.right = "60%";
  47699. pixelBoxStylesVal = roundPixelMeasures( divStyle.right ) === 36;
  47700. // Support: IE 9 - 11 only
  47701. // Detect misreporting of content dimensions for box-sizing:border-box elements
  47702. boxSizingReliableVal = roundPixelMeasures( divStyle.width ) === 36;
  47703. // Support: IE 9 only
  47704. // Detect overflow:scroll screwiness (gh-3699)
  47705. div.style.position = "absolute";
  47706. scrollboxSizeVal = div.offsetWidth === 36 || "absolute";
  47707. documentElement.removeChild( container );
  47708. // Nullify the div so it wouldn't be stored in the memory and
  47709. // it will also be a sign that checks already performed
  47710. div = null;
  47711. }
  47712. function roundPixelMeasures( measure ) {
  47713. return Math.round( parseFloat( measure ) );
  47714. }
  47715. var pixelPositionVal, boxSizingReliableVal, scrollboxSizeVal, pixelBoxStylesVal,
  47716. reliableMarginLeftVal,
  47717. container = document.createElement( "div" ),
  47718. div = document.createElement( "div" );
  47719. // Finish early in limited (non-browser) environments
  47720. if ( !div.style ) {
  47721. return;
  47722. }
  47723. // Support: IE <=9 - 11 only
  47724. // Style of cloned element affects source element cloned (#8908)
  47725. div.style.backgroundClip = "content-box";
  47726. div.cloneNode( true ).style.backgroundClip = "";
  47727. support.clearCloneStyle = div.style.backgroundClip === "content-box";
  47728. jQuery.extend( support, {
  47729. boxSizingReliable: function() {
  47730. computeStyleTests();
  47731. return boxSizingReliableVal;
  47732. },
  47733. pixelBoxStyles: function() {
  47734. computeStyleTests();
  47735. return pixelBoxStylesVal;
  47736. },
  47737. pixelPosition: function() {
  47738. computeStyleTests();
  47739. return pixelPositionVal;
  47740. },
  47741. reliableMarginLeft: function() {
  47742. computeStyleTests();
  47743. return reliableMarginLeftVal;
  47744. },
  47745. scrollboxSize: function() {
  47746. computeStyleTests();
  47747. return scrollboxSizeVal;
  47748. }
  47749. } );
  47750. } )();
  47751. function curCSS( elem, name, computed ) {
  47752. var width, minWidth, maxWidth, ret,
  47753. // Support: Firefox 51+
  47754. // Retrieving style before computed somehow
  47755. // fixes an issue with getting wrong values
  47756. // on detached elements
  47757. style = elem.style;
  47758. computed = computed || getStyles( elem );
  47759. // getPropertyValue is needed for:
  47760. // .css('filter') (IE 9 only, #12537)
  47761. // .css('--customProperty) (#3144)
  47762. if ( computed ) {
  47763. ret = computed.getPropertyValue( name ) || computed[ name ];
  47764. if ( ret === "" && !jQuery.contains( elem.ownerDocument, elem ) ) {
  47765. ret = jQuery.style( elem, name );
  47766. }
  47767. // A tribute to the "awesome hack by Dean Edwards"
  47768. // Android Browser returns percentage for some values,
  47769. // but width seems to be reliably pixels.
  47770. // This is against the CSSOM draft spec:
  47771. // https://drafts.csswg.org/cssom/#resolved-values
  47772. if ( !support.pixelBoxStyles() && rnumnonpx.test( ret ) && rboxStyle.test( name ) ) {
  47773. // Remember the original values
  47774. width = style.width;
  47775. minWidth = style.minWidth;
  47776. maxWidth = style.maxWidth;
  47777. // Put in the new values to get a computed value out
  47778. style.minWidth = style.maxWidth = style.width = ret;
  47779. ret = computed.width;
  47780. // Revert the changed values
  47781. style.width = width;
  47782. style.minWidth = minWidth;
  47783. style.maxWidth = maxWidth;
  47784. }
  47785. }
  47786. return ret !== undefined ?
  47787. // Support: IE <=9 - 11 only
  47788. // IE returns zIndex value as an integer.
  47789. ret + "" :
  47790. ret;
  47791. }
  47792. function addGetHookIf( conditionFn, hookFn ) {
  47793. // Define the hook, we'll check on the first run if it's really needed.
  47794. return {
  47795. get: function() {
  47796. if ( conditionFn() ) {
  47797. // Hook not needed (or it's not possible to use it due
  47798. // to missing dependency), remove it.
  47799. delete this.get;
  47800. return;
  47801. }
  47802. // Hook needed; redefine it so that the support test is not executed again.
  47803. return ( this.get = hookFn ).apply( this, arguments );
  47804. }
  47805. };
  47806. }
  47807. var
  47808. // Swappable if display is none or starts with table
  47809. // except "table", "table-cell", or "table-caption"
  47810. // See here for display values: https://developer.mozilla.org/en-US/docs/CSS/display
  47811. rdisplayswap = /^(none|table(?!-c[ea]).+)/,
  47812. rcustomProp = /^--/,
  47813. cssShow = { position: "absolute", visibility: "hidden", display: "block" },
  47814. cssNormalTransform = {
  47815. letterSpacing: "0",
  47816. fontWeight: "400"
  47817. },
  47818. cssPrefixes = [ "Webkit", "Moz", "ms" ],
  47819. emptyStyle = document.createElement( "div" ).style;
  47820. // Return a css property mapped to a potentially vendor prefixed property
  47821. function vendorPropName( name ) {
  47822. // Shortcut for names that are not vendor prefixed
  47823. if ( name in emptyStyle ) {
  47824. return name;
  47825. }
  47826. // Check for vendor prefixed names
  47827. var capName = name[ 0 ].toUpperCase() + name.slice( 1 ),
  47828. i = cssPrefixes.length;
  47829. while ( i-- ) {
  47830. name = cssPrefixes[ i ] + capName;
  47831. if ( name in emptyStyle ) {
  47832. return name;
  47833. }
  47834. }
  47835. }
  47836. // Return a property mapped along what jQuery.cssProps suggests or to
  47837. // a vendor prefixed property.
  47838. function finalPropName( name ) {
  47839. var ret = jQuery.cssProps[ name ];
  47840. if ( !ret ) {
  47841. ret = jQuery.cssProps[ name ] = vendorPropName( name ) || name;
  47842. }
  47843. return ret;
  47844. }
  47845. function setPositiveNumber( elem, value, subtract ) {
  47846. // Any relative (+/-) values have already been
  47847. // normalized at this point
  47848. var matches = rcssNum.exec( value );
  47849. return matches ?
  47850. // Guard against undefined "subtract", e.g., when used as in cssHooks
  47851. Math.max( 0, matches[ 2 ] - ( subtract || 0 ) ) + ( matches[ 3 ] || "px" ) :
  47852. value;
  47853. }
  47854. function boxModelAdjustment( elem, dimension, box, isBorderBox, styles, computedVal ) {
  47855. var i = dimension === "width" ? 1 : 0,
  47856. extra = 0,
  47857. delta = 0;
  47858. // Adjustment may not be necessary
  47859. if ( box === ( isBorderBox ? "border" : "content" ) ) {
  47860. return 0;
  47861. }
  47862. for ( ; i < 4; i += 2 ) {
  47863. // Both box models exclude margin
  47864. if ( box === "margin" ) {
  47865. delta += jQuery.css( elem, box + cssExpand[ i ], true, styles );
  47866. }
  47867. // If we get here with a content-box, we're seeking "padding" or "border" or "margin"
  47868. if ( !isBorderBox ) {
  47869. // Add padding
  47870. delta += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
  47871. // For "border" or "margin", add border
  47872. if ( box !== "padding" ) {
  47873. delta += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  47874. // But still keep track of it otherwise
  47875. } else {
  47876. extra += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  47877. }
  47878. // If we get here with a border-box (content + padding + border), we're seeking "content" or
  47879. // "padding" or "margin"
  47880. } else {
  47881. // For "content", subtract padding
  47882. if ( box === "content" ) {
  47883. delta -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
  47884. }
  47885. // For "content" or "padding", subtract border
  47886. if ( box !== "margin" ) {
  47887. delta -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  47888. }
  47889. }
  47890. }
  47891. // Account for positive content-box scroll gutter when requested by providing computedVal
  47892. if ( !isBorderBox && computedVal >= 0 ) {
  47893. // offsetWidth/offsetHeight is a rounded sum of content, padding, scroll gutter, and border
  47894. // Assuming integer scroll gutter, subtract the rest and round down
  47895. delta += Math.max( 0, Math.ceil(
  47896. elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] -
  47897. computedVal -
  47898. delta -
  47899. extra -
  47900. 0.5
  47901. ) );
  47902. }
  47903. return delta;
  47904. }
  47905. function getWidthOrHeight( elem, dimension, extra ) {
  47906. // Start with computed style
  47907. var styles = getStyles( elem ),
  47908. val = curCSS( elem, dimension, styles ),
  47909. isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
  47910. valueIsBorderBox = isBorderBox;
  47911. // Support: Firefox <=54
  47912. // Return a confounding non-pixel value or feign ignorance, as appropriate.
  47913. if ( rnumnonpx.test( val ) ) {
  47914. if ( !extra ) {
  47915. return val;
  47916. }
  47917. val = "auto";
  47918. }
  47919. // Check for style in case a browser which returns unreliable values
  47920. // for getComputedStyle silently falls back to the reliable elem.style
  47921. valueIsBorderBox = valueIsBorderBox &&
  47922. ( support.boxSizingReliable() || val === elem.style[ dimension ] );
  47923. // Fall back to offsetWidth/offsetHeight when value is "auto"
  47924. // This happens for inline elements with no explicit setting (gh-3571)
  47925. // Support: Android <=4.1 - 4.3 only
  47926. // Also use offsetWidth/offsetHeight for misreported inline dimensions (gh-3602)
  47927. if ( val === "auto" ||
  47928. !parseFloat( val ) && jQuery.css( elem, "display", false, styles ) === "inline" ) {
  47929. val = elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ];
  47930. // offsetWidth/offsetHeight provide border-box values
  47931. valueIsBorderBox = true;
  47932. }
  47933. // Normalize "" and auto
  47934. val = parseFloat( val ) || 0;
  47935. // Adjust for the element's box model
  47936. return ( val +
  47937. boxModelAdjustment(
  47938. elem,
  47939. dimension,
  47940. extra || ( isBorderBox ? "border" : "content" ),
  47941. valueIsBorderBox,
  47942. styles,
  47943. // Provide the current computed size to request scroll gutter calculation (gh-3589)
  47944. val
  47945. )
  47946. ) + "px";
  47947. }
  47948. jQuery.extend( {
  47949. // Add in style property hooks for overriding the default
  47950. // behavior of getting and setting a style property
  47951. cssHooks: {
  47952. opacity: {
  47953. get: function( elem, computed ) {
  47954. if ( computed ) {
  47955. // We should always get a number back from opacity
  47956. var ret = curCSS( elem, "opacity" );
  47957. return ret === "" ? "1" : ret;
  47958. }
  47959. }
  47960. }
  47961. },
  47962. // Don't automatically add "px" to these possibly-unitless properties
  47963. cssNumber: {
  47964. "animationIterationCount": true,
  47965. "columnCount": true,
  47966. "fillOpacity": true,
  47967. "flexGrow": true,
  47968. "flexShrink": true,
  47969. "fontWeight": true,
  47970. "lineHeight": true,
  47971. "opacity": true,
  47972. "order": true,
  47973. "orphans": true,
  47974. "widows": true,
  47975. "zIndex": true,
  47976. "zoom": true
  47977. },
  47978. // Add in properties whose names you wish to fix before
  47979. // setting or getting the value
  47980. cssProps: {},
  47981. // Get and set the style property on a DOM Node
  47982. style: function( elem, name, value, extra ) {
  47983. // Don't set styles on text and comment nodes
  47984. if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) {
  47985. return;
  47986. }
  47987. // Make sure that we're working with the right name
  47988. var ret, type, hooks,
  47989. origName = camelCase( name ),
  47990. isCustomProp = rcustomProp.test( name ),
  47991. style = elem.style;
  47992. // Make sure that we're working with the right name. We don't
  47993. // want to query the value if it is a CSS custom property
  47994. // since they are user-defined.
  47995. if ( !isCustomProp ) {
  47996. name = finalPropName( origName );
  47997. }
  47998. // Gets hook for the prefixed version, then unprefixed version
  47999. hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
  48000. // Check if we're setting a value
  48001. if ( value !== undefined ) {
  48002. type = typeof value;
  48003. // Convert "+=" or "-=" to relative numbers (#7345)
  48004. if ( type === "string" && ( ret = rcssNum.exec( value ) ) && ret[ 1 ] ) {
  48005. value = adjustCSS( elem, name, ret );
  48006. // Fixes bug #9237
  48007. type = "number";
  48008. }
  48009. // Make sure that null and NaN values aren't set (#7116)
  48010. if ( value == null || value !== value ) {
  48011. return;
  48012. }
  48013. // If a number was passed in, add the unit (except for certain CSS properties)
  48014. if ( type === "number" ) {
  48015. value += ret && ret[ 3 ] || ( jQuery.cssNumber[ origName ] ? "" : "px" );
  48016. }
  48017. // background-* props affect original clone's values
  48018. if ( !support.clearCloneStyle && value === "" && name.indexOf( "background" ) === 0 ) {
  48019. style[ name ] = "inherit";
  48020. }
  48021. // If a hook was provided, use that value, otherwise just set the specified value
  48022. if ( !hooks || !( "set" in hooks ) ||
  48023. ( value = hooks.set( elem, value, extra ) ) !== undefined ) {
  48024. if ( isCustomProp ) {
  48025. style.setProperty( name, value );
  48026. } else {
  48027. style[ name ] = value;
  48028. }
  48029. }
  48030. } else {
  48031. // If a hook was provided get the non-computed value from there
  48032. if ( hooks && "get" in hooks &&
  48033. ( ret = hooks.get( elem, false, extra ) ) !== undefined ) {
  48034. return ret;
  48035. }
  48036. // Otherwise just get the value from the style object
  48037. return style[ name ];
  48038. }
  48039. },
  48040. css: function( elem, name, extra, styles ) {
  48041. var val, num, hooks,
  48042. origName = camelCase( name ),
  48043. isCustomProp = rcustomProp.test( name );
  48044. // Make sure that we're working with the right name. We don't
  48045. // want to modify the value if it is a CSS custom property
  48046. // since they are user-defined.
  48047. if ( !isCustomProp ) {
  48048. name = finalPropName( origName );
  48049. }
  48050. // Try prefixed name followed by the unprefixed name
  48051. hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
  48052. // If a hook was provided get the computed value from there
  48053. if ( hooks && "get" in hooks ) {
  48054. val = hooks.get( elem, true, extra );
  48055. }
  48056. // Otherwise, if a way to get the computed value exists, use that
  48057. if ( val === undefined ) {
  48058. val = curCSS( elem, name, styles );
  48059. }
  48060. // Convert "normal" to computed value
  48061. if ( val === "normal" && name in cssNormalTransform ) {
  48062. val = cssNormalTransform[ name ];
  48063. }
  48064. // Make numeric if forced or a qualifier was provided and val looks numeric
  48065. if ( extra === "" || extra ) {
  48066. num = parseFloat( val );
  48067. return extra === true || isFinite( num ) ? num || 0 : val;
  48068. }
  48069. return val;
  48070. }
  48071. } );
  48072. jQuery.each( [ "height", "width" ], function( i, dimension ) {
  48073. jQuery.cssHooks[ dimension ] = {
  48074. get: function( elem, computed, extra ) {
  48075. if ( computed ) {
  48076. // Certain elements can have dimension info if we invisibly show them
  48077. // but it must have a current display style that would benefit
  48078. return rdisplayswap.test( jQuery.css( elem, "display" ) ) &&
  48079. // Support: Safari 8+
  48080. // Table columns in Safari have non-zero offsetWidth & zero
  48081. // getBoundingClientRect().width unless display is changed.
  48082. // Support: IE <=11 only
  48083. // Running getBoundingClientRect on a disconnected node
  48084. // in IE throws an error.
  48085. ( !elem.getClientRects().length || !elem.getBoundingClientRect().width ) ?
  48086. swap( elem, cssShow, function() {
  48087. return getWidthOrHeight( elem, dimension, extra );
  48088. } ) :
  48089. getWidthOrHeight( elem, dimension, extra );
  48090. }
  48091. },
  48092. set: function( elem, value, extra ) {
  48093. var matches,
  48094. styles = getStyles( elem ),
  48095. isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
  48096. subtract = extra && boxModelAdjustment(
  48097. elem,
  48098. dimension,
  48099. extra,
  48100. isBorderBox,
  48101. styles
  48102. );
  48103. // Account for unreliable border-box dimensions by comparing offset* to computed and
  48104. // faking a content-box to get border and padding (gh-3699)
  48105. if ( isBorderBox && support.scrollboxSize() === styles.position ) {
  48106. subtract -= Math.ceil(
  48107. elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] -
  48108. parseFloat( styles[ dimension ] ) -
  48109. boxModelAdjustment( elem, dimension, "border", false, styles ) -
  48110. 0.5
  48111. );
  48112. }
  48113. // Convert to pixels if value adjustment is needed
  48114. if ( subtract && ( matches = rcssNum.exec( value ) ) &&
  48115. ( matches[ 3 ] || "px" ) !== "px" ) {
  48116. elem.style[ dimension ] = value;
  48117. value = jQuery.css( elem, dimension );
  48118. }
  48119. return setPositiveNumber( elem, value, subtract );
  48120. }
  48121. };
  48122. } );
  48123. jQuery.cssHooks.marginLeft = addGetHookIf( support.reliableMarginLeft,
  48124. function( elem, computed ) {
  48125. if ( computed ) {
  48126. return ( parseFloat( curCSS( elem, "marginLeft" ) ) ||
  48127. elem.getBoundingClientRect().left -
  48128. swap( elem, { marginLeft: 0 }, function() {
  48129. return elem.getBoundingClientRect().left;
  48130. } )
  48131. ) + "px";
  48132. }
  48133. }
  48134. );
  48135. // These hooks are used by animate to expand properties
  48136. jQuery.each( {
  48137. margin: "",
  48138. padding: "",
  48139. border: "Width"
  48140. }, function( prefix, suffix ) {
  48141. jQuery.cssHooks[ prefix + suffix ] = {
  48142. expand: function( value ) {
  48143. var i = 0,
  48144. expanded = {},
  48145. // Assumes a single number if not a string
  48146. parts = typeof value === "string" ? value.split( " " ) : [ value ];
  48147. for ( ; i < 4; i++ ) {
  48148. expanded[ prefix + cssExpand[ i ] + suffix ] =
  48149. parts[ i ] || parts[ i - 2 ] || parts[ 0 ];
  48150. }
  48151. return expanded;
  48152. }
  48153. };
  48154. if ( prefix !== "margin" ) {
  48155. jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber;
  48156. }
  48157. } );
  48158. jQuery.fn.extend( {
  48159. css: function( name, value ) {
  48160. return access( this, function( elem, name, value ) {
  48161. var styles, len,
  48162. map = {},
  48163. i = 0;
  48164. if ( Array.isArray( name ) ) {
  48165. styles = getStyles( elem );
  48166. len = name.length;
  48167. for ( ; i < len; i++ ) {
  48168. map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles );
  48169. }
  48170. return map;
  48171. }
  48172. return value !== undefined ?
  48173. jQuery.style( elem, name, value ) :
  48174. jQuery.css( elem, name );
  48175. }, name, value, arguments.length > 1 );
  48176. }
  48177. } );
  48178. function Tween( elem, options, prop, end, easing ) {
  48179. return new Tween.prototype.init( elem, options, prop, end, easing );
  48180. }
  48181. jQuery.Tween = Tween;
  48182. Tween.prototype = {
  48183. constructor: Tween,
  48184. init: function( elem, options, prop, end, easing, unit ) {
  48185. this.elem = elem;
  48186. this.prop = prop;
  48187. this.easing = easing || jQuery.easing._default;
  48188. this.options = options;
  48189. this.start = this.now = this.cur();
  48190. this.end = end;
  48191. this.unit = unit || ( jQuery.cssNumber[ prop ] ? "" : "px" );
  48192. },
  48193. cur: function() {
  48194. var hooks = Tween.propHooks[ this.prop ];
  48195. return hooks && hooks.get ?
  48196. hooks.get( this ) :
  48197. Tween.propHooks._default.get( this );
  48198. },
  48199. run: function( percent ) {
  48200. var eased,
  48201. hooks = Tween.propHooks[ this.prop ];
  48202. if ( this.options.duration ) {
  48203. this.pos = eased = jQuery.easing[ this.easing ](
  48204. percent, this.options.duration * percent, 0, 1, this.options.duration
  48205. );
  48206. } else {
  48207. this.pos = eased = percent;
  48208. }
  48209. this.now = ( this.end - this.start ) * eased + this.start;
  48210. if ( this.options.step ) {
  48211. this.options.step.call( this.elem, this.now, this );
  48212. }
  48213. if ( hooks && hooks.set ) {
  48214. hooks.set( this );
  48215. } else {
  48216. Tween.propHooks._default.set( this );
  48217. }
  48218. return this;
  48219. }
  48220. };
  48221. Tween.prototype.init.prototype = Tween.prototype;
  48222. Tween.propHooks = {
  48223. _default: {
  48224. get: function( tween ) {
  48225. var result;
  48226. // Use a property on the element directly when it is not a DOM element,
  48227. // or when there is no matching style property that exists.
  48228. if ( tween.elem.nodeType !== 1 ||
  48229. tween.elem[ tween.prop ] != null && tween.elem.style[ tween.prop ] == null ) {
  48230. return tween.elem[ tween.prop ];
  48231. }
  48232. // Passing an empty string as a 3rd parameter to .css will automatically
  48233. // attempt a parseFloat and fallback to a string if the parse fails.
  48234. // Simple values such as "10px" are parsed to Float;
  48235. // complex values such as "rotate(1rad)" are returned as-is.
  48236. result = jQuery.css( tween.elem, tween.prop, "" );
  48237. // Empty strings, null, undefined and "auto" are converted to 0.
  48238. return !result || result === "auto" ? 0 : result;
  48239. },
  48240. set: function( tween ) {
  48241. // Use step hook for back compat.
  48242. // Use cssHook if its there.
  48243. // Use .style if available and use plain properties where available.
  48244. if ( jQuery.fx.step[ tween.prop ] ) {
  48245. jQuery.fx.step[ tween.prop ]( tween );
  48246. } else if ( tween.elem.nodeType === 1 &&
  48247. ( tween.elem.style[ jQuery.cssProps[ tween.prop ] ] != null ||
  48248. jQuery.cssHooks[ tween.prop ] ) ) {
  48249. jQuery.style( tween.elem, tween.prop, tween.now + tween.unit );
  48250. } else {
  48251. tween.elem[ tween.prop ] = tween.now;
  48252. }
  48253. }
  48254. }
  48255. };
  48256. // Support: IE <=9 only
  48257. // Panic based approach to setting things on disconnected nodes
  48258. Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = {
  48259. set: function( tween ) {
  48260. if ( tween.elem.nodeType && tween.elem.parentNode ) {
  48261. tween.elem[ tween.prop ] = tween.now;
  48262. }
  48263. }
  48264. };
  48265. jQuery.easing = {
  48266. linear: function( p ) {
  48267. return p;
  48268. },
  48269. swing: function( p ) {
  48270. return 0.5 - Math.cos( p * Math.PI ) / 2;
  48271. },
  48272. _default: "swing"
  48273. };
  48274. jQuery.fx = Tween.prototype.init;
  48275. // Back compat <1.8 extension point
  48276. jQuery.fx.step = {};
  48277. var
  48278. fxNow, inProgress,
  48279. rfxtypes = /^(?:toggle|show|hide)$/,
  48280. rrun = /queueHooks$/;
  48281. function schedule() {
  48282. if ( inProgress ) {
  48283. if ( document.hidden === false && window.requestAnimationFrame ) {
  48284. window.requestAnimationFrame( schedule );
  48285. } else {
  48286. window.setTimeout( schedule, jQuery.fx.interval );
  48287. }
  48288. jQuery.fx.tick();
  48289. }
  48290. }
  48291. // Animations created synchronously will run synchronously
  48292. function createFxNow() {
  48293. window.setTimeout( function() {
  48294. fxNow = undefined;
  48295. } );
  48296. return ( fxNow = Date.now() );
  48297. }
  48298. // Generate parameters to create a standard animation
  48299. function genFx( type, includeWidth ) {
  48300. var which,
  48301. i = 0,
  48302. attrs = { height: type };
  48303. // If we include width, step value is 1 to do all cssExpand values,
  48304. // otherwise step value is 2 to skip over Left and Right
  48305. includeWidth = includeWidth ? 1 : 0;
  48306. for ( ; i < 4; i += 2 - includeWidth ) {
  48307. which = cssExpand[ i ];
  48308. attrs[ "margin" + which ] = attrs[ "padding" + which ] = type;
  48309. }
  48310. if ( includeWidth ) {
  48311. attrs.opacity = attrs.width = type;
  48312. }
  48313. return attrs;
  48314. }
  48315. function createTween( value, prop, animation ) {
  48316. var tween,
  48317. collection = ( Animation.tweeners[ prop ] || [] ).concat( Animation.tweeners[ "*" ] ),
  48318. index = 0,
  48319. length = collection.length;
  48320. for ( ; index < length; index++ ) {
  48321. if ( ( tween = collection[ index ].call( animation, prop, value ) ) ) {
  48322. // We're done with this property
  48323. return tween;
  48324. }
  48325. }
  48326. }
  48327. function defaultPrefilter( elem, props, opts ) {
  48328. var prop, value, toggle, hooks, oldfire, propTween, restoreDisplay, display,
  48329. isBox = "width" in props || "height" in props,
  48330. anim = this,
  48331. orig = {},
  48332. style = elem.style,
  48333. hidden = elem.nodeType && isHiddenWithinTree( elem ),
  48334. dataShow = dataPriv.get( elem, "fxshow" );
  48335. // Queue-skipping animations hijack the fx hooks
  48336. if ( !opts.queue ) {
  48337. hooks = jQuery._queueHooks( elem, "fx" );
  48338. if ( hooks.unqueued == null ) {
  48339. hooks.unqueued = 0;
  48340. oldfire = hooks.empty.fire;
  48341. hooks.empty.fire = function() {
  48342. if ( !hooks.unqueued ) {
  48343. oldfire();
  48344. }
  48345. };
  48346. }
  48347. hooks.unqueued++;
  48348. anim.always( function() {
  48349. // Ensure the complete handler is called before this completes
  48350. anim.always( function() {
  48351. hooks.unqueued--;
  48352. if ( !jQuery.queue( elem, "fx" ).length ) {
  48353. hooks.empty.fire();
  48354. }
  48355. } );
  48356. } );
  48357. }
  48358. // Detect show/hide animations
  48359. for ( prop in props ) {
  48360. value = props[ prop ];
  48361. if ( rfxtypes.test( value ) ) {
  48362. delete props[ prop ];
  48363. toggle = toggle || value === "toggle";
  48364. if ( value === ( hidden ? "hide" : "show" ) ) {
  48365. // Pretend to be hidden if this is a "show" and
  48366. // there is still data from a stopped show/hide
  48367. if ( value === "show" && dataShow && dataShow[ prop ] !== undefined ) {
  48368. hidden = true;
  48369. // Ignore all other no-op show/hide data
  48370. } else {
  48371. continue;
  48372. }
  48373. }
  48374. orig[ prop ] = dataShow && dataShow[ prop ] || jQuery.style( elem, prop );
  48375. }
  48376. }
  48377. // Bail out if this is a no-op like .hide().hide()
  48378. propTween = !jQuery.isEmptyObject( props );
  48379. if ( !propTween && jQuery.isEmptyObject( orig ) ) {
  48380. return;
  48381. }
  48382. // Restrict "overflow" and "display" styles during box animations
  48383. if ( isBox && elem.nodeType === 1 ) {
  48384. // Support: IE <=9 - 11, Edge 12 - 15
  48385. // Record all 3 overflow attributes because IE does not infer the shorthand
  48386. // from identically-valued overflowX and overflowY and Edge just mirrors
  48387. // the overflowX value there.
  48388. opts.overflow = [ style.overflow, style.overflowX, style.overflowY ];
  48389. // Identify a display type, preferring old show/hide data over the CSS cascade
  48390. restoreDisplay = dataShow && dataShow.display;
  48391. if ( restoreDisplay == null ) {
  48392. restoreDisplay = dataPriv.get( elem, "display" );
  48393. }
  48394. display = jQuery.css( elem, "display" );
  48395. if ( display === "none" ) {
  48396. if ( restoreDisplay ) {
  48397. display = restoreDisplay;
  48398. } else {
  48399. // Get nonempty value(s) by temporarily forcing visibility
  48400. showHide( [ elem ], true );
  48401. restoreDisplay = elem.style.display || restoreDisplay;
  48402. display = jQuery.css( elem, "display" );
  48403. showHide( [ elem ] );
  48404. }
  48405. }
  48406. // Animate inline elements as inline-block
  48407. if ( display === "inline" || display === "inline-block" && restoreDisplay != null ) {
  48408. if ( jQuery.css( elem, "float" ) === "none" ) {
  48409. // Restore the original display value at the end of pure show/hide animations
  48410. if ( !propTween ) {
  48411. anim.done( function() {
  48412. style.display = restoreDisplay;
  48413. } );
  48414. if ( restoreDisplay == null ) {
  48415. display = style.display;
  48416. restoreDisplay = display === "none" ? "" : display;
  48417. }
  48418. }
  48419. style.display = "inline-block";
  48420. }
  48421. }
  48422. }
  48423. if ( opts.overflow ) {
  48424. style.overflow = "hidden";
  48425. anim.always( function() {
  48426. style.overflow = opts.overflow[ 0 ];
  48427. style.overflowX = opts.overflow[ 1 ];
  48428. style.overflowY = opts.overflow[ 2 ];
  48429. } );
  48430. }
  48431. // Implement show/hide animations
  48432. propTween = false;
  48433. for ( prop in orig ) {
  48434. // General show/hide setup for this element animation
  48435. if ( !propTween ) {
  48436. if ( dataShow ) {
  48437. if ( "hidden" in dataShow ) {
  48438. hidden = dataShow.hidden;
  48439. }
  48440. } else {
  48441. dataShow = dataPriv.access( elem, "fxshow", { display: restoreDisplay } );
  48442. }
  48443. // Store hidden/visible for toggle so `.stop().toggle()` "reverses"
  48444. if ( toggle ) {
  48445. dataShow.hidden = !hidden;
  48446. }
  48447. // Show elements before animating them
  48448. if ( hidden ) {
  48449. showHide( [ elem ], true );
  48450. }
  48451. /* eslint-disable no-loop-func */
  48452. anim.done( function() {
  48453. /* eslint-enable no-loop-func */
  48454. // The final step of a "hide" animation is actually hiding the element
  48455. if ( !hidden ) {
  48456. showHide( [ elem ] );
  48457. }
  48458. dataPriv.remove( elem, "fxshow" );
  48459. for ( prop in orig ) {
  48460. jQuery.style( elem, prop, orig[ prop ] );
  48461. }
  48462. } );
  48463. }
  48464. // Per-property setup
  48465. propTween = createTween( hidden ? dataShow[ prop ] : 0, prop, anim );
  48466. if ( !( prop in dataShow ) ) {
  48467. dataShow[ prop ] = propTween.start;
  48468. if ( hidden ) {
  48469. propTween.end = propTween.start;
  48470. propTween.start = 0;
  48471. }
  48472. }
  48473. }
  48474. }
  48475. function propFilter( props, specialEasing ) {
  48476. var index, name, easing, value, hooks;
  48477. // camelCase, specialEasing and expand cssHook pass
  48478. for ( index in props ) {
  48479. name = camelCase( index );
  48480. easing = specialEasing[ name ];
  48481. value = props[ index ];
  48482. if ( Array.isArray( value ) ) {
  48483. easing = value[ 1 ];
  48484. value = props[ index ] = value[ 0 ];
  48485. }
  48486. if ( index !== name ) {
  48487. props[ name ] = value;
  48488. delete props[ index ];
  48489. }
  48490. hooks = jQuery.cssHooks[ name ];
  48491. if ( hooks && "expand" in hooks ) {
  48492. value = hooks.expand( value );
  48493. delete props[ name ];
  48494. // Not quite $.extend, this won't overwrite existing keys.
  48495. // Reusing 'index' because we have the correct "name"
  48496. for ( index in value ) {
  48497. if ( !( index in props ) ) {
  48498. props[ index ] = value[ index ];
  48499. specialEasing[ index ] = easing;
  48500. }
  48501. }
  48502. } else {
  48503. specialEasing[ name ] = easing;
  48504. }
  48505. }
  48506. }
  48507. function Animation( elem, properties, options ) {
  48508. var result,
  48509. stopped,
  48510. index = 0,
  48511. length = Animation.prefilters.length,
  48512. deferred = jQuery.Deferred().always( function() {
  48513. // Don't match elem in the :animated selector
  48514. delete tick.elem;
  48515. } ),
  48516. tick = function() {
  48517. if ( stopped ) {
  48518. return false;
  48519. }
  48520. var currentTime = fxNow || createFxNow(),
  48521. remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ),
  48522. // Support: Android 2.3 only
  48523. // Archaic crash bug won't allow us to use `1 - ( 0.5 || 0 )` (#12497)
  48524. temp = remaining / animation.duration || 0,
  48525. percent = 1 - temp,
  48526. index = 0,
  48527. length = animation.tweens.length;
  48528. for ( ; index < length; index++ ) {
  48529. animation.tweens[ index ].run( percent );
  48530. }
  48531. deferred.notifyWith( elem, [ animation, percent, remaining ] );
  48532. // If there's more to do, yield
  48533. if ( percent < 1 && length ) {
  48534. return remaining;
  48535. }
  48536. // If this was an empty animation, synthesize a final progress notification
  48537. if ( !length ) {
  48538. deferred.notifyWith( elem, [ animation, 1, 0 ] );
  48539. }
  48540. // Resolve the animation and report its conclusion
  48541. deferred.resolveWith( elem, [ animation ] );
  48542. return false;
  48543. },
  48544. animation = deferred.promise( {
  48545. elem: elem,
  48546. props: jQuery.extend( {}, properties ),
  48547. opts: jQuery.extend( true, {
  48548. specialEasing: {},
  48549. easing: jQuery.easing._default
  48550. }, options ),
  48551. originalProperties: properties,
  48552. originalOptions: options,
  48553. startTime: fxNow || createFxNow(),
  48554. duration: options.duration,
  48555. tweens: [],
  48556. createTween: function( prop, end ) {
  48557. var tween = jQuery.Tween( elem, animation.opts, prop, end,
  48558. animation.opts.specialEasing[ prop ] || animation.opts.easing );
  48559. animation.tweens.push( tween );
  48560. return tween;
  48561. },
  48562. stop: function( gotoEnd ) {
  48563. var index = 0,
  48564. // If we are going to the end, we want to run all the tweens
  48565. // otherwise we skip this part
  48566. length = gotoEnd ? animation.tweens.length : 0;
  48567. if ( stopped ) {
  48568. return this;
  48569. }
  48570. stopped = true;
  48571. for ( ; index < length; index++ ) {
  48572. animation.tweens[ index ].run( 1 );
  48573. }
  48574. // Resolve when we played the last frame; otherwise, reject
  48575. if ( gotoEnd ) {
  48576. deferred.notifyWith( elem, [ animation, 1, 0 ] );
  48577. deferred.resolveWith( elem, [ animation, gotoEnd ] );
  48578. } else {
  48579. deferred.rejectWith( elem, [ animation, gotoEnd ] );
  48580. }
  48581. return this;
  48582. }
  48583. } ),
  48584. props = animation.props;
  48585. propFilter( props, animation.opts.specialEasing );
  48586. for ( ; index < length; index++ ) {
  48587. result = Animation.prefilters[ index ].call( animation, elem, props, animation.opts );
  48588. if ( result ) {
  48589. if ( isFunction( result.stop ) ) {
  48590. jQuery._queueHooks( animation.elem, animation.opts.queue ).stop =
  48591. result.stop.bind( result );
  48592. }
  48593. return result;
  48594. }
  48595. }
  48596. jQuery.map( props, createTween, animation );
  48597. if ( isFunction( animation.opts.start ) ) {
  48598. animation.opts.start.call( elem, animation );
  48599. }
  48600. // Attach callbacks from options
  48601. animation
  48602. .progress( animation.opts.progress )
  48603. .done( animation.opts.done, animation.opts.complete )
  48604. .fail( animation.opts.fail )
  48605. .always( animation.opts.always );
  48606. jQuery.fx.timer(
  48607. jQuery.extend( tick, {
  48608. elem: elem,
  48609. anim: animation,
  48610. queue: animation.opts.queue
  48611. } )
  48612. );
  48613. return animation;
  48614. }
  48615. jQuery.Animation = jQuery.extend( Animation, {
  48616. tweeners: {
  48617. "*": [ function( prop, value ) {
  48618. var tween = this.createTween( prop, value );
  48619. adjustCSS( tween.elem, prop, rcssNum.exec( value ), tween );
  48620. return tween;
  48621. } ]
  48622. },
  48623. tweener: function( props, callback ) {
  48624. if ( isFunction( props ) ) {
  48625. callback = props;
  48626. props = [ "*" ];
  48627. } else {
  48628. props = props.match( rnothtmlwhite );
  48629. }
  48630. var prop,
  48631. index = 0,
  48632. length = props.length;
  48633. for ( ; index < length; index++ ) {
  48634. prop = props[ index ];
  48635. Animation.tweeners[ prop ] = Animation.tweeners[ prop ] || [];
  48636. Animation.tweeners[ prop ].unshift( callback );
  48637. }
  48638. },
  48639. prefilters: [ defaultPrefilter ],
  48640. prefilter: function( callback, prepend ) {
  48641. if ( prepend ) {
  48642. Animation.prefilters.unshift( callback );
  48643. } else {
  48644. Animation.prefilters.push( callback );
  48645. }
  48646. }
  48647. } );
  48648. jQuery.speed = function( speed, easing, fn ) {
  48649. var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : {
  48650. complete: fn || !fn && easing ||
  48651. isFunction( speed ) && speed,
  48652. duration: speed,
  48653. easing: fn && easing || easing && !isFunction( easing ) && easing
  48654. };
  48655. // Go to the end state if fx are off
  48656. if ( jQuery.fx.off ) {
  48657. opt.duration = 0;
  48658. } else {
  48659. if ( typeof opt.duration !== "number" ) {
  48660. if ( opt.duration in jQuery.fx.speeds ) {
  48661. opt.duration = jQuery.fx.speeds[ opt.duration ];
  48662. } else {
  48663. opt.duration = jQuery.fx.speeds._default;
  48664. }
  48665. }
  48666. }
  48667. // Normalize opt.queue - true/undefined/null -> "fx"
  48668. if ( opt.queue == null || opt.queue === true ) {
  48669. opt.queue = "fx";
  48670. }
  48671. // Queueing
  48672. opt.old = opt.complete;
  48673. opt.complete = function() {
  48674. if ( isFunction( opt.old ) ) {
  48675. opt.old.call( this );
  48676. }
  48677. if ( opt.queue ) {
  48678. jQuery.dequeue( this, opt.queue );
  48679. }
  48680. };
  48681. return opt;
  48682. };
  48683. jQuery.fn.extend( {
  48684. fadeTo: function( speed, to, easing, callback ) {
  48685. // Show any hidden elements after setting opacity to 0
  48686. return this.filter( isHiddenWithinTree ).css( "opacity", 0 ).show()
  48687. // Animate to the value specified
  48688. .end().animate( { opacity: to }, speed, easing, callback );
  48689. },
  48690. animate: function( prop, speed, easing, callback ) {
  48691. var empty = jQuery.isEmptyObject( prop ),
  48692. optall = jQuery.speed( speed, easing, callback ),
  48693. doAnimation = function() {
  48694. // Operate on a copy of prop so per-property easing won't be lost
  48695. var anim = Animation( this, jQuery.extend( {}, prop ), optall );
  48696. // Empty animations, or finishing resolves immediately
  48697. if ( empty || dataPriv.get( this, "finish" ) ) {
  48698. anim.stop( true );
  48699. }
  48700. };
  48701. doAnimation.finish = doAnimation;
  48702. return empty || optall.queue === false ?
  48703. this.each( doAnimation ) :
  48704. this.queue( optall.queue, doAnimation );
  48705. },
  48706. stop: function( type, clearQueue, gotoEnd ) {
  48707. var stopQueue = function( hooks ) {
  48708. var stop = hooks.stop;
  48709. delete hooks.stop;
  48710. stop( gotoEnd );
  48711. };
  48712. if ( typeof type !== "string" ) {
  48713. gotoEnd = clearQueue;
  48714. clearQueue = type;
  48715. type = undefined;
  48716. }
  48717. if ( clearQueue && type !== false ) {
  48718. this.queue( type || "fx", [] );
  48719. }
  48720. return this.each( function() {
  48721. var dequeue = true,
  48722. index = type != null && type + "queueHooks",
  48723. timers = jQuery.timers,
  48724. data = dataPriv.get( this );
  48725. if ( index ) {
  48726. if ( data[ index ] && data[ index ].stop ) {
  48727. stopQueue( data[ index ] );
  48728. }
  48729. } else {
  48730. for ( index in data ) {
  48731. if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) {
  48732. stopQueue( data[ index ] );
  48733. }
  48734. }
  48735. }
  48736. for ( index = timers.length; index--; ) {
  48737. if ( timers[ index ].elem === this &&
  48738. ( type == null || timers[ index ].queue === type ) ) {
  48739. timers[ index ].anim.stop( gotoEnd );
  48740. dequeue = false;
  48741. timers.splice( index, 1 );
  48742. }
  48743. }
  48744. // Start the next in the queue if the last step wasn't forced.
  48745. // Timers currently will call their complete callbacks, which
  48746. // will dequeue but only if they were gotoEnd.
  48747. if ( dequeue || !gotoEnd ) {
  48748. jQuery.dequeue( this, type );
  48749. }
  48750. } );
  48751. },
  48752. finish: function( type ) {
  48753. if ( type !== false ) {
  48754. type = type || "fx";
  48755. }
  48756. return this.each( function() {
  48757. var index,
  48758. data = dataPriv.get( this ),
  48759. queue = data[ type + "queue" ],
  48760. hooks = data[ type + "queueHooks" ],
  48761. timers = jQuery.timers,
  48762. length = queue ? queue.length : 0;
  48763. // Enable finishing flag on private data
  48764. data.finish = true;
  48765. // Empty the queue first
  48766. jQuery.queue( this, type, [] );
  48767. if ( hooks && hooks.stop ) {
  48768. hooks.stop.call( this, true );
  48769. }
  48770. // Look for any active animations, and finish them
  48771. for ( index = timers.length; index--; ) {
  48772. if ( timers[ index ].elem === this && timers[ index ].queue === type ) {
  48773. timers[ index ].anim.stop( true );
  48774. timers.splice( index, 1 );
  48775. }
  48776. }
  48777. // Look for any animations in the old queue and finish them
  48778. for ( index = 0; index < length; index++ ) {
  48779. if ( queue[ index ] && queue[ index ].finish ) {
  48780. queue[ index ].finish.call( this );
  48781. }
  48782. }
  48783. // Turn off finishing flag
  48784. delete data.finish;
  48785. } );
  48786. }
  48787. } );
  48788. jQuery.each( [ "toggle", "show", "hide" ], function( i, name ) {
  48789. var cssFn = jQuery.fn[ name ];
  48790. jQuery.fn[ name ] = function( speed, easing, callback ) {
  48791. return speed == null || typeof speed === "boolean" ?
  48792. cssFn.apply( this, arguments ) :
  48793. this.animate( genFx( name, true ), speed, easing, callback );
  48794. };
  48795. } );
  48796. // Generate shortcuts for custom animations
  48797. jQuery.each( {
  48798. slideDown: genFx( "show" ),
  48799. slideUp: genFx( "hide" ),
  48800. slideToggle: genFx( "toggle" ),
  48801. fadeIn: { opacity: "show" },
  48802. fadeOut: { opacity: "hide" },
  48803. fadeToggle: { opacity: "toggle" }
  48804. }, function( name, props ) {
  48805. jQuery.fn[ name ] = function( speed, easing, callback ) {
  48806. return this.animate( props, speed, easing, callback );
  48807. };
  48808. } );
  48809. jQuery.timers = [];
  48810. jQuery.fx.tick = function() {
  48811. var timer,
  48812. i = 0,
  48813. timers = jQuery.timers;
  48814. fxNow = Date.now();
  48815. for ( ; i < timers.length; i++ ) {
  48816. timer = timers[ i ];
  48817. // Run the timer and safely remove it when done (allowing for external removal)
  48818. if ( !timer() && timers[ i ] === timer ) {
  48819. timers.splice( i--, 1 );
  48820. }
  48821. }
  48822. if ( !timers.length ) {
  48823. jQuery.fx.stop();
  48824. }
  48825. fxNow = undefined;
  48826. };
  48827. jQuery.fx.timer = function( timer ) {
  48828. jQuery.timers.push( timer );
  48829. jQuery.fx.start();
  48830. };
  48831. jQuery.fx.interval = 13;
  48832. jQuery.fx.start = function() {
  48833. if ( inProgress ) {
  48834. return;
  48835. }
  48836. inProgress = true;
  48837. schedule();
  48838. };
  48839. jQuery.fx.stop = function() {
  48840. inProgress = null;
  48841. };
  48842. jQuery.fx.speeds = {
  48843. slow: 600,
  48844. fast: 200,
  48845. // Default speed
  48846. _default: 400
  48847. };
  48848. // Based off of the plugin by Clint Helfers, with permission.
  48849. // https://web.archive.org/web/20100324014747/http://blindsignals.com/index.php/2009/07/jquery-delay/
  48850. jQuery.fn.delay = function( time, type ) {
  48851. time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time;
  48852. type = type || "fx";
  48853. return this.queue( type, function( next, hooks ) {
  48854. var timeout = window.setTimeout( next, time );
  48855. hooks.stop = function() {
  48856. window.clearTimeout( timeout );
  48857. };
  48858. } );
  48859. };
  48860. ( function() {
  48861. var input = document.createElement( "input" ),
  48862. select = document.createElement( "select" ),
  48863. opt = select.appendChild( document.createElement( "option" ) );
  48864. input.type = "checkbox";
  48865. // Support: Android <=4.3 only
  48866. // Default value for a checkbox should be "on"
  48867. support.checkOn = input.value !== "";
  48868. // Support: IE <=11 only
  48869. // Must access selectedIndex to make default options select
  48870. support.optSelected = opt.selected;
  48871. // Support: IE <=11 only
  48872. // An input loses its value after becoming a radio
  48873. input = document.createElement( "input" );
  48874. input.value = "t";
  48875. input.type = "radio";
  48876. support.radioValue = input.value === "t";
  48877. } )();
  48878. var boolHook,
  48879. attrHandle = jQuery.expr.attrHandle;
  48880. jQuery.fn.extend( {
  48881. attr: function( name, value ) {
  48882. return access( this, jQuery.attr, name, value, arguments.length > 1 );
  48883. },
  48884. removeAttr: function( name ) {
  48885. return this.each( function() {
  48886. jQuery.removeAttr( this, name );
  48887. } );
  48888. }
  48889. } );
  48890. jQuery.extend( {
  48891. attr: function( elem, name, value ) {
  48892. var ret, hooks,
  48893. nType = elem.nodeType;
  48894. // Don't get/set attributes on text, comment and attribute nodes
  48895. if ( nType === 3 || nType === 8 || nType === 2 ) {
  48896. return;
  48897. }
  48898. // Fallback to prop when attributes are not supported
  48899. if ( typeof elem.getAttribute === "undefined" ) {
  48900. return jQuery.prop( elem, name, value );
  48901. }
  48902. // Attribute hooks are determined by the lowercase version
  48903. // Grab necessary hook if one is defined
  48904. if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
  48905. hooks = jQuery.attrHooks[ name.toLowerCase() ] ||
  48906. ( jQuery.expr.match.bool.test( name ) ? boolHook : undefined );
  48907. }
  48908. if ( value !== undefined ) {
  48909. if ( value === null ) {
  48910. jQuery.removeAttr( elem, name );
  48911. return;
  48912. }
  48913. if ( hooks && "set" in hooks &&
  48914. ( ret = hooks.set( elem, value, name ) ) !== undefined ) {
  48915. return ret;
  48916. }
  48917. elem.setAttribute( name, value + "" );
  48918. return value;
  48919. }
  48920. if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {
  48921. return ret;
  48922. }
  48923. ret = jQuery.find.attr( elem, name );
  48924. // Non-existent attributes return null, we normalize to undefined
  48925. return ret == null ? undefined : ret;
  48926. },
  48927. attrHooks: {
  48928. type: {
  48929. set: function( elem, value ) {
  48930. if ( !support.radioValue && value === "radio" &&
  48931. nodeName( elem, "input" ) ) {
  48932. var val = elem.value;
  48933. elem.setAttribute( "type", value );
  48934. if ( val ) {
  48935. elem.value = val;
  48936. }
  48937. return value;
  48938. }
  48939. }
  48940. }
  48941. },
  48942. removeAttr: function( elem, value ) {
  48943. var name,
  48944. i = 0,
  48945. // Attribute names can contain non-HTML whitespace characters
  48946. // https://html.spec.whatwg.org/multipage/syntax.html#attributes-2
  48947. attrNames = value && value.match( rnothtmlwhite );
  48948. if ( attrNames && elem.nodeType === 1 ) {
  48949. while ( ( name = attrNames[ i++ ] ) ) {
  48950. elem.removeAttribute( name );
  48951. }
  48952. }
  48953. }
  48954. } );
  48955. // Hooks for boolean attributes
  48956. boolHook = {
  48957. set: function( elem, value, name ) {
  48958. if ( value === false ) {
  48959. // Remove boolean attributes when set to false
  48960. jQuery.removeAttr( elem, name );
  48961. } else {
  48962. elem.setAttribute( name, name );
  48963. }
  48964. return name;
  48965. }
  48966. };
  48967. jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( i, name ) {
  48968. var getter = attrHandle[ name ] || jQuery.find.attr;
  48969. attrHandle[ name ] = function( elem, name, isXML ) {
  48970. var ret, handle,
  48971. lowercaseName = name.toLowerCase();
  48972. if ( !isXML ) {
  48973. // Avoid an infinite loop by temporarily removing this function from the getter
  48974. handle = attrHandle[ lowercaseName ];
  48975. attrHandle[ lowercaseName ] = ret;
  48976. ret = getter( elem, name, isXML ) != null ?
  48977. lowercaseName :
  48978. null;
  48979. attrHandle[ lowercaseName ] = handle;
  48980. }
  48981. return ret;
  48982. };
  48983. } );
  48984. var rfocusable = /^(?:input|select|textarea|button)$/i,
  48985. rclickable = /^(?:a|area)$/i;
  48986. jQuery.fn.extend( {
  48987. prop: function( name, value ) {
  48988. return access( this, jQuery.prop, name, value, arguments.length > 1 );
  48989. },
  48990. removeProp: function( name ) {
  48991. return this.each( function() {
  48992. delete this[ jQuery.propFix[ name ] || name ];
  48993. } );
  48994. }
  48995. } );
  48996. jQuery.extend( {
  48997. prop: function( elem, name, value ) {
  48998. var ret, hooks,
  48999. nType = elem.nodeType;
  49000. // Don't get/set properties on text, comment and attribute nodes
  49001. if ( nType === 3 || nType === 8 || nType === 2 ) {
  49002. return;
  49003. }
  49004. if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
  49005. // Fix name and attach hooks
  49006. name = jQuery.propFix[ name ] || name;
  49007. hooks = jQuery.propHooks[ name ];
  49008. }
  49009. if ( value !== undefined ) {
  49010. if ( hooks && "set" in hooks &&
  49011. ( ret = hooks.set( elem, value, name ) ) !== undefined ) {
  49012. return ret;
  49013. }
  49014. return ( elem[ name ] = value );
  49015. }
  49016. if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {
  49017. return ret;
  49018. }
  49019. return elem[ name ];
  49020. },
  49021. propHooks: {
  49022. tabIndex: {
  49023. get: function( elem ) {
  49024. // Support: IE <=9 - 11 only
  49025. // elem.tabIndex doesn't always return the
  49026. // correct value when it hasn't been explicitly set
  49027. // https://web.archive.org/web/20141116233347/http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
  49028. // Use proper attribute retrieval(#12072)
  49029. var tabindex = jQuery.find.attr( elem, "tabindex" );
  49030. if ( tabindex ) {
  49031. return parseInt( tabindex, 10 );
  49032. }
  49033. if (
  49034. rfocusable.test( elem.nodeName ) ||
  49035. rclickable.test( elem.nodeName ) &&
  49036. elem.href
  49037. ) {
  49038. return 0;
  49039. }
  49040. return -1;
  49041. }
  49042. }
  49043. },
  49044. propFix: {
  49045. "for": "htmlFor",
  49046. "class": "className"
  49047. }
  49048. } );
  49049. // Support: IE <=11 only
  49050. // Accessing the selectedIndex property
  49051. // forces the browser to respect setting selected
  49052. // on the option
  49053. // The getter ensures a default option is selected
  49054. // when in an optgroup
  49055. // eslint rule "no-unused-expressions" is disabled for this code
  49056. // since it considers such accessions noop
  49057. if ( !support.optSelected ) {
  49058. jQuery.propHooks.selected = {
  49059. get: function( elem ) {
  49060. /* eslint no-unused-expressions: "off" */
  49061. var parent = elem.parentNode;
  49062. if ( parent && parent.parentNode ) {
  49063. parent.parentNode.selectedIndex;
  49064. }
  49065. return null;
  49066. },
  49067. set: function( elem ) {
  49068. /* eslint no-unused-expressions: "off" */
  49069. var parent = elem.parentNode;
  49070. if ( parent ) {
  49071. parent.selectedIndex;
  49072. if ( parent.parentNode ) {
  49073. parent.parentNode.selectedIndex;
  49074. }
  49075. }
  49076. }
  49077. };
  49078. }
  49079. jQuery.each( [
  49080. "tabIndex",
  49081. "readOnly",
  49082. "maxLength",
  49083. "cellSpacing",
  49084. "cellPadding",
  49085. "rowSpan",
  49086. "colSpan",
  49087. "useMap",
  49088. "frameBorder",
  49089. "contentEditable"
  49090. ], function() {
  49091. jQuery.propFix[ this.toLowerCase() ] = this;
  49092. } );
  49093. // Strip and collapse whitespace according to HTML spec
  49094. // https://infra.spec.whatwg.org/#strip-and-collapse-ascii-whitespace
  49095. function stripAndCollapse( value ) {
  49096. var tokens = value.match( rnothtmlwhite ) || [];
  49097. return tokens.join( " " );
  49098. }
  49099. function getClass( elem ) {
  49100. return elem.getAttribute && elem.getAttribute( "class" ) || "";
  49101. }
  49102. function classesToArray( value ) {
  49103. if ( Array.isArray( value ) ) {
  49104. return value;
  49105. }
  49106. if ( typeof value === "string" ) {
  49107. return value.match( rnothtmlwhite ) || [];
  49108. }
  49109. return [];
  49110. }
  49111. jQuery.fn.extend( {
  49112. addClass: function( value ) {
  49113. var classes, elem, cur, curValue, clazz, j, finalValue,
  49114. i = 0;
  49115. if ( isFunction( value ) ) {
  49116. return this.each( function( j ) {
  49117. jQuery( this ).addClass( value.call( this, j, getClass( this ) ) );
  49118. } );
  49119. }
  49120. classes = classesToArray( value );
  49121. if ( classes.length ) {
  49122. while ( ( elem = this[ i++ ] ) ) {
  49123. curValue = getClass( elem );
  49124. cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " );
  49125. if ( cur ) {
  49126. j = 0;
  49127. while ( ( clazz = classes[ j++ ] ) ) {
  49128. if ( cur.indexOf( " " + clazz + " " ) < 0 ) {
  49129. cur += clazz + " ";
  49130. }
  49131. }
  49132. // Only assign if different to avoid unneeded rendering.
  49133. finalValue = stripAndCollapse( cur );
  49134. if ( curValue !== finalValue ) {
  49135. elem.setAttribute( "class", finalValue );
  49136. }
  49137. }
  49138. }
  49139. }
  49140. return this;
  49141. },
  49142. removeClass: function( value ) {
  49143. var classes, elem, cur, curValue, clazz, j, finalValue,
  49144. i = 0;
  49145. if ( isFunction( value ) ) {
  49146. return this.each( function( j ) {
  49147. jQuery( this ).removeClass( value.call( this, j, getClass( this ) ) );
  49148. } );
  49149. }
  49150. if ( !arguments.length ) {
  49151. return this.attr( "class", "" );
  49152. }
  49153. classes = classesToArray( value );
  49154. if ( classes.length ) {
  49155. while ( ( elem = this[ i++ ] ) ) {
  49156. curValue = getClass( elem );
  49157. // This expression is here for better compressibility (see addClass)
  49158. cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " );
  49159. if ( cur ) {
  49160. j = 0;
  49161. while ( ( clazz = classes[ j++ ] ) ) {
  49162. // Remove *all* instances
  49163. while ( cur.indexOf( " " + clazz + " " ) > -1 ) {
  49164. cur = cur.replace( " " + clazz + " ", " " );
  49165. }
  49166. }
  49167. // Only assign if different to avoid unneeded rendering.
  49168. finalValue = stripAndCollapse( cur );
  49169. if ( curValue !== finalValue ) {
  49170. elem.setAttribute( "class", finalValue );
  49171. }
  49172. }
  49173. }
  49174. }
  49175. return this;
  49176. },
  49177. toggleClass: function( value, stateVal ) {
  49178. var type = typeof value,
  49179. isValidValue = type === "string" || Array.isArray( value );
  49180. if ( typeof stateVal === "boolean" && isValidValue ) {
  49181. return stateVal ? this.addClass( value ) : this.removeClass( value );
  49182. }
  49183. if ( isFunction( value ) ) {
  49184. return this.each( function( i ) {
  49185. jQuery( this ).toggleClass(
  49186. value.call( this, i, getClass( this ), stateVal ),
  49187. stateVal
  49188. );
  49189. } );
  49190. }
  49191. return this.each( function() {
  49192. var className, i, self, classNames;
  49193. if ( isValidValue ) {
  49194. // Toggle individual class names
  49195. i = 0;
  49196. self = jQuery( this );
  49197. classNames = classesToArray( value );
  49198. while ( ( className = classNames[ i++ ] ) ) {
  49199. // Check each className given, space separated list
  49200. if ( self.hasClass( className ) ) {
  49201. self.removeClass( className );
  49202. } else {
  49203. self.addClass( className );
  49204. }
  49205. }
  49206. // Toggle whole class name
  49207. } else if ( value === undefined || type === "boolean" ) {
  49208. className = getClass( this );
  49209. if ( className ) {
  49210. // Store className if set
  49211. dataPriv.set( this, "__className__", className );
  49212. }
  49213. // If the element has a class name or if we're passed `false`,
  49214. // then remove the whole classname (if there was one, the above saved it).
  49215. // Otherwise bring back whatever was previously saved (if anything),
  49216. // falling back to the empty string if nothing was stored.
  49217. if ( this.setAttribute ) {
  49218. this.setAttribute( "class",
  49219. className || value === false ?
  49220. "" :
  49221. dataPriv.get( this, "__className__" ) || ""
  49222. );
  49223. }
  49224. }
  49225. } );
  49226. },
  49227. hasClass: function( selector ) {
  49228. var className, elem,
  49229. i = 0;
  49230. className = " " + selector + " ";
  49231. while ( ( elem = this[ i++ ] ) ) {
  49232. if ( elem.nodeType === 1 &&
  49233. ( " " + stripAndCollapse( getClass( elem ) ) + " " ).indexOf( className ) > -1 ) {
  49234. return true;
  49235. }
  49236. }
  49237. return false;
  49238. }
  49239. } );
  49240. var rreturn = /\r/g;
  49241. jQuery.fn.extend( {
  49242. val: function( value ) {
  49243. var hooks, ret, valueIsFunction,
  49244. elem = this[ 0 ];
  49245. if ( !arguments.length ) {
  49246. if ( elem ) {
  49247. hooks = jQuery.valHooks[ elem.type ] ||
  49248. jQuery.valHooks[ elem.nodeName.toLowerCase() ];
  49249. if ( hooks &&
  49250. "get" in hooks &&
  49251. ( ret = hooks.get( elem, "value" ) ) !== undefined
  49252. ) {
  49253. return ret;
  49254. }
  49255. ret = elem.value;
  49256. // Handle most common string cases
  49257. if ( typeof ret === "string" ) {
  49258. return ret.replace( rreturn, "" );
  49259. }
  49260. // Handle cases where value is null/undef or number
  49261. return ret == null ? "" : ret;
  49262. }
  49263. return;
  49264. }
  49265. valueIsFunction = isFunction( value );
  49266. return this.each( function( i ) {
  49267. var val;
  49268. if ( this.nodeType !== 1 ) {
  49269. return;
  49270. }
  49271. if ( valueIsFunction ) {
  49272. val = value.call( this, i, jQuery( this ).val() );
  49273. } else {
  49274. val = value;
  49275. }
  49276. // Treat null/undefined as ""; convert numbers to string
  49277. if ( val == null ) {
  49278. val = "";
  49279. } else if ( typeof val === "number" ) {
  49280. val += "";
  49281. } else if ( Array.isArray( val ) ) {
  49282. val = jQuery.map( val, function( value ) {
  49283. return value == null ? "" : value + "";
  49284. } );
  49285. }
  49286. hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ];
  49287. // If set returns undefined, fall back to normal setting
  49288. if ( !hooks || !( "set" in hooks ) || hooks.set( this, val, "value" ) === undefined ) {
  49289. this.value = val;
  49290. }
  49291. } );
  49292. }
  49293. } );
  49294. jQuery.extend( {
  49295. valHooks: {
  49296. option: {
  49297. get: function( elem ) {
  49298. var val = jQuery.find.attr( elem, "value" );
  49299. return val != null ?
  49300. val :
  49301. // Support: IE <=10 - 11 only
  49302. // option.text throws exceptions (#14686, #14858)
  49303. // Strip and collapse whitespace
  49304. // https://html.spec.whatwg.org/#strip-and-collapse-whitespace
  49305. stripAndCollapse( jQuery.text( elem ) );
  49306. }
  49307. },
  49308. select: {
  49309. get: function( elem ) {
  49310. var value, option, i,
  49311. options = elem.options,
  49312. index = elem.selectedIndex,
  49313. one = elem.type === "select-one",
  49314. values = one ? null : [],
  49315. max = one ? index + 1 : options.length;
  49316. if ( index < 0 ) {
  49317. i = max;
  49318. } else {
  49319. i = one ? index : 0;
  49320. }
  49321. // Loop through all the selected options
  49322. for ( ; i < max; i++ ) {
  49323. option = options[ i ];
  49324. // Support: IE <=9 only
  49325. // IE8-9 doesn't update selected after form reset (#2551)
  49326. if ( ( option.selected || i === index ) &&
  49327. // Don't return options that are disabled or in a disabled optgroup
  49328. !option.disabled &&
  49329. ( !option.parentNode.disabled ||
  49330. !nodeName( option.parentNode, "optgroup" ) ) ) {
  49331. // Get the specific value for the option
  49332. value = jQuery( option ).val();
  49333. // We don't need an array for one selects
  49334. if ( one ) {
  49335. return value;
  49336. }
  49337. // Multi-Selects return an array
  49338. values.push( value );
  49339. }
  49340. }
  49341. return values;
  49342. },
  49343. set: function( elem, value ) {
  49344. var optionSet, option,
  49345. options = elem.options,
  49346. values = jQuery.makeArray( value ),
  49347. i = options.length;
  49348. while ( i-- ) {
  49349. option = options[ i ];
  49350. /* eslint-disable no-cond-assign */
  49351. if ( option.selected =
  49352. jQuery.inArray( jQuery.valHooks.option.get( option ), values ) > -1
  49353. ) {
  49354. optionSet = true;
  49355. }
  49356. /* eslint-enable no-cond-assign */
  49357. }
  49358. // Force browsers to behave consistently when non-matching value is set
  49359. if ( !optionSet ) {
  49360. elem.selectedIndex = -1;
  49361. }
  49362. return values;
  49363. }
  49364. }
  49365. }
  49366. } );
  49367. // Radios and checkboxes getter/setter
  49368. jQuery.each( [ "radio", "checkbox" ], function() {
  49369. jQuery.valHooks[ this ] = {
  49370. set: function( elem, value ) {
  49371. if ( Array.isArray( value ) ) {
  49372. return ( elem.checked = jQuery.inArray( jQuery( elem ).val(), value ) > -1 );
  49373. }
  49374. }
  49375. };
  49376. if ( !support.checkOn ) {
  49377. jQuery.valHooks[ this ].get = function( elem ) {
  49378. return elem.getAttribute( "value" ) === null ? "on" : elem.value;
  49379. };
  49380. }
  49381. } );
  49382. // Return jQuery for attributes-only inclusion
  49383. support.focusin = "onfocusin" in window;
  49384. var rfocusMorph = /^(?:focusinfocus|focusoutblur)$/,
  49385. stopPropagationCallback = function( e ) {
  49386. e.stopPropagation();
  49387. };
  49388. jQuery.extend( jQuery.event, {
  49389. trigger: function( event, data, elem, onlyHandlers ) {
  49390. var i, cur, tmp, bubbleType, ontype, handle, special, lastElement,
  49391. eventPath = [ elem || document ],
  49392. type = hasOwn.call( event, "type" ) ? event.type : event,
  49393. namespaces = hasOwn.call( event, "namespace" ) ? event.namespace.split( "." ) : [];
  49394. cur = lastElement = tmp = elem = elem || document;
  49395. // Don't do events on text and comment nodes
  49396. if ( elem.nodeType === 3 || elem.nodeType === 8 ) {
  49397. return;
  49398. }
  49399. // focus/blur morphs to focusin/out; ensure we're not firing them right now
  49400. if ( rfocusMorph.test( type + jQuery.event.triggered ) ) {
  49401. return;
  49402. }
  49403. if ( type.indexOf( "." ) > -1 ) {
  49404. // Namespaced trigger; create a regexp to match event type in handle()
  49405. namespaces = type.split( "." );
  49406. type = namespaces.shift();
  49407. namespaces.sort();
  49408. }
  49409. ontype = type.indexOf( ":" ) < 0 && "on" + type;
  49410. // Caller can pass in a jQuery.Event object, Object, or just an event type string
  49411. event = event[ jQuery.expando ] ?
  49412. event :
  49413. new jQuery.Event( type, typeof event === "object" && event );
  49414. // Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true)
  49415. event.isTrigger = onlyHandlers ? 2 : 3;
  49416. event.namespace = namespaces.join( "." );
  49417. event.rnamespace = event.namespace ?
  49418. new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" ) :
  49419. null;
  49420. // Clean up the event in case it is being reused
  49421. event.result = undefined;
  49422. if ( !event.target ) {
  49423. event.target = elem;
  49424. }
  49425. // Clone any incoming data and prepend the event, creating the handler arg list
  49426. data = data == null ?
  49427. [ event ] :
  49428. jQuery.makeArray( data, [ event ] );
  49429. // Allow special events to draw outside the lines
  49430. special = jQuery.event.special[ type ] || {};
  49431. if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) {
  49432. return;
  49433. }
  49434. // Determine event propagation path in advance, per W3C events spec (#9951)
  49435. // Bubble up to document, then to window; watch for a global ownerDocument var (#9724)
  49436. if ( !onlyHandlers && !special.noBubble && !isWindow( elem ) ) {
  49437. bubbleType = special.delegateType || type;
  49438. if ( !rfocusMorph.test( bubbleType + type ) ) {
  49439. cur = cur.parentNode;
  49440. }
  49441. for ( ; cur; cur = cur.parentNode ) {
  49442. eventPath.push( cur );
  49443. tmp = cur;
  49444. }
  49445. // Only add window if we got to document (e.g., not plain obj or detached DOM)
  49446. if ( tmp === ( elem.ownerDocument || document ) ) {
  49447. eventPath.push( tmp.defaultView || tmp.parentWindow || window );
  49448. }
  49449. }
  49450. // Fire handlers on the event path
  49451. i = 0;
  49452. while ( ( cur = eventPath[ i++ ] ) && !event.isPropagationStopped() ) {
  49453. lastElement = cur;
  49454. event.type = i > 1 ?
  49455. bubbleType :
  49456. special.bindType || type;
  49457. // jQuery handler
  49458. handle = ( dataPriv.get( cur, "events" ) || {} )[ event.type ] &&
  49459. dataPriv.get( cur, "handle" );
  49460. if ( handle ) {
  49461. handle.apply( cur, data );
  49462. }
  49463. // Native handler
  49464. handle = ontype && cur[ ontype ];
  49465. if ( handle && handle.apply && acceptData( cur ) ) {
  49466. event.result = handle.apply( cur, data );
  49467. if ( event.result === false ) {
  49468. event.preventDefault();
  49469. }
  49470. }
  49471. }
  49472. event.type = type;
  49473. // If nobody prevented the default action, do it now
  49474. if ( !onlyHandlers && !event.isDefaultPrevented() ) {
  49475. if ( ( !special._default ||
  49476. special._default.apply( eventPath.pop(), data ) === false ) &&
  49477. acceptData( elem ) ) {
  49478. // Call a native DOM method on the target with the same name as the event.
  49479. // Don't do default actions on window, that's where global variables be (#6170)
  49480. if ( ontype && isFunction( elem[ type ] ) && !isWindow( elem ) ) {
  49481. // Don't re-trigger an onFOO event when we call its FOO() method
  49482. tmp = elem[ ontype ];
  49483. if ( tmp ) {
  49484. elem[ ontype ] = null;
  49485. }
  49486. // Prevent re-triggering of the same event, since we already bubbled it above
  49487. jQuery.event.triggered = type;
  49488. if ( event.isPropagationStopped() ) {
  49489. lastElement.addEventListener( type, stopPropagationCallback );
  49490. }
  49491. elem[ type ]();
  49492. if ( event.isPropagationStopped() ) {
  49493. lastElement.removeEventListener( type, stopPropagationCallback );
  49494. }
  49495. jQuery.event.triggered = undefined;
  49496. if ( tmp ) {
  49497. elem[ ontype ] = tmp;
  49498. }
  49499. }
  49500. }
  49501. }
  49502. return event.result;
  49503. },
  49504. // Piggyback on a donor event to simulate a different one
  49505. // Used only for `focus(in | out)` events
  49506. simulate: function( type, elem, event ) {
  49507. var e = jQuery.extend(
  49508. new jQuery.Event(),
  49509. event,
  49510. {
  49511. type: type,
  49512. isSimulated: true
  49513. }
  49514. );
  49515. jQuery.event.trigger( e, null, elem );
  49516. }
  49517. } );
  49518. jQuery.fn.extend( {
  49519. trigger: function( type, data ) {
  49520. return this.each( function() {
  49521. jQuery.event.trigger( type, data, this );
  49522. } );
  49523. },
  49524. triggerHandler: function( type, data ) {
  49525. var elem = this[ 0 ];
  49526. if ( elem ) {
  49527. return jQuery.event.trigger( type, data, elem, true );
  49528. }
  49529. }
  49530. } );
  49531. // Support: Firefox <=44
  49532. // Firefox doesn't have focus(in | out) events
  49533. // Related ticket - https://bugzilla.mozilla.org/show_bug.cgi?id=687787
  49534. //
  49535. // Support: Chrome <=48 - 49, Safari <=9.0 - 9.1
  49536. // focus(in | out) events fire after focus & blur events,
  49537. // which is spec violation - http://www.w3.org/TR/DOM-Level-3-Events/#events-focusevent-event-order
  49538. // Related ticket - https://bugs.chromium.org/p/chromium/issues/detail?id=449857
  49539. if ( !support.focusin ) {
  49540. jQuery.each( { focus: "focusin", blur: "focusout" }, function( orig, fix ) {
  49541. // Attach a single capturing handler on the document while someone wants focusin/focusout
  49542. var handler = function( event ) {
  49543. jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ) );
  49544. };
  49545. jQuery.event.special[ fix ] = {
  49546. setup: function() {
  49547. var doc = this.ownerDocument || this,
  49548. attaches = dataPriv.access( doc, fix );
  49549. if ( !attaches ) {
  49550. doc.addEventListener( orig, handler, true );
  49551. }
  49552. dataPriv.access( doc, fix, ( attaches || 0 ) + 1 );
  49553. },
  49554. teardown: function() {
  49555. var doc = this.ownerDocument || this,
  49556. attaches = dataPriv.access( doc, fix ) - 1;
  49557. if ( !attaches ) {
  49558. doc.removeEventListener( orig, handler, true );
  49559. dataPriv.remove( doc, fix );
  49560. } else {
  49561. dataPriv.access( doc, fix, attaches );
  49562. }
  49563. }
  49564. };
  49565. } );
  49566. }
  49567. var location = window.location;
  49568. var nonce = Date.now();
  49569. var rquery = ( /\?/ );
  49570. // Cross-browser xml parsing
  49571. jQuery.parseXML = function( data ) {
  49572. var xml;
  49573. if ( !data || typeof data !== "string" ) {
  49574. return null;
  49575. }
  49576. // Support: IE 9 - 11 only
  49577. // IE throws on parseFromString with invalid input.
  49578. try {
  49579. xml = ( new window.DOMParser() ).parseFromString( data, "text/xml" );
  49580. } catch ( e ) {
  49581. xml = undefined;
  49582. }
  49583. if ( !xml || xml.getElementsByTagName( "parsererror" ).length ) {
  49584. jQuery.error( "Invalid XML: " + data );
  49585. }
  49586. return xml;
  49587. };
  49588. var
  49589. rbracket = /\[\]$/,
  49590. rCRLF = /\r?\n/g,
  49591. rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i,
  49592. rsubmittable = /^(?:input|select|textarea|keygen)/i;
  49593. function buildParams( prefix, obj, traditional, add ) {
  49594. var name;
  49595. if ( Array.isArray( obj ) ) {
  49596. // Serialize array item.
  49597. jQuery.each( obj, function( i, v ) {
  49598. if ( traditional || rbracket.test( prefix ) ) {
  49599. // Treat each array item as a scalar.
  49600. add( prefix, v );
  49601. } else {
  49602. // Item is non-scalar (array or object), encode its numeric index.
  49603. buildParams(
  49604. prefix + "[" + ( typeof v === "object" && v != null ? i : "" ) + "]",
  49605. v,
  49606. traditional,
  49607. add
  49608. );
  49609. }
  49610. } );
  49611. } else if ( !traditional && toType( obj ) === "object" ) {
  49612. // Serialize object item.
  49613. for ( name in obj ) {
  49614. buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add );
  49615. }
  49616. } else {
  49617. // Serialize scalar item.
  49618. add( prefix, obj );
  49619. }
  49620. }
  49621. // Serialize an array of form elements or a set of
  49622. // key/values into a query string
  49623. jQuery.param = function( a, traditional ) {
  49624. var prefix,
  49625. s = [],
  49626. add = function( key, valueOrFunction ) {
  49627. // If value is a function, invoke it and use its return value
  49628. var value = isFunction( valueOrFunction ) ?
  49629. valueOrFunction() :
  49630. valueOrFunction;
  49631. s[ s.length ] = encodeURIComponent( key ) + "=" +
  49632. encodeURIComponent( value == null ? "" : value );
  49633. };
  49634. // If an array was passed in, assume that it is an array of form elements.
  49635. if ( Array.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) {
  49636. // Serialize the form elements
  49637. jQuery.each( a, function() {
  49638. add( this.name, this.value );
  49639. } );
  49640. } else {
  49641. // If traditional, encode the "old" way (the way 1.3.2 or older
  49642. // did it), otherwise encode params recursively.
  49643. for ( prefix in a ) {
  49644. buildParams( prefix, a[ prefix ], traditional, add );
  49645. }
  49646. }
  49647. // Return the resulting serialization
  49648. return s.join( "&" );
  49649. };
  49650. jQuery.fn.extend( {
  49651. serialize: function() {
  49652. return jQuery.param( this.serializeArray() );
  49653. },
  49654. serializeArray: function() {
  49655. return this.map( function() {
  49656. // Can add propHook for "elements" to filter or add form elements
  49657. var elements = jQuery.prop( this, "elements" );
  49658. return elements ? jQuery.makeArray( elements ) : this;
  49659. } )
  49660. .filter( function() {
  49661. var type = this.type;
  49662. // Use .is( ":disabled" ) so that fieldset[disabled] works
  49663. return this.name && !jQuery( this ).is( ":disabled" ) &&
  49664. rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) &&
  49665. ( this.checked || !rcheckableType.test( type ) );
  49666. } )
  49667. .map( function( i, elem ) {
  49668. var val = jQuery( this ).val();
  49669. if ( val == null ) {
  49670. return null;
  49671. }
  49672. if ( Array.isArray( val ) ) {
  49673. return jQuery.map( val, function( val ) {
  49674. return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
  49675. } );
  49676. }
  49677. return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
  49678. } ).get();
  49679. }
  49680. } );
  49681. var
  49682. r20 = /%20/g,
  49683. rhash = /#.*$/,
  49684. rantiCache = /([?&])_=[^&]*/,
  49685. rheaders = /^(.*?):[ \t]*([^\r\n]*)$/mg,
  49686. // #7653, #8125, #8152: local protocol detection
  49687. rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/,
  49688. rnoContent = /^(?:GET|HEAD)$/,
  49689. rprotocol = /^\/\//,
  49690. /* Prefilters
  49691. * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example)
  49692. * 2) These are called:
  49693. * - BEFORE asking for a transport
  49694. * - AFTER param serialization (s.data is a string if s.processData is true)
  49695. * 3) key is the dataType
  49696. * 4) the catchall symbol "*" can be used
  49697. * 5) execution will start with transport dataType and THEN continue down to "*" if needed
  49698. */
  49699. prefilters = {},
  49700. /* Transports bindings
  49701. * 1) key is the dataType
  49702. * 2) the catchall symbol "*" can be used
  49703. * 3) selection will start with transport dataType and THEN go to "*" if needed
  49704. */
  49705. transports = {},
  49706. // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression
  49707. allTypes = "*/".concat( "*" ),
  49708. // Anchor tag for parsing the document origin
  49709. originAnchor = document.createElement( "a" );
  49710. originAnchor.href = location.href;
  49711. // Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport
  49712. function addToPrefiltersOrTransports( structure ) {
  49713. // dataTypeExpression is optional and defaults to "*"
  49714. return function( dataTypeExpression, func ) {
  49715. if ( typeof dataTypeExpression !== "string" ) {
  49716. func = dataTypeExpression;
  49717. dataTypeExpression = "*";
  49718. }
  49719. var dataType,
  49720. i = 0,
  49721. dataTypes = dataTypeExpression.toLowerCase().match( rnothtmlwhite ) || [];
  49722. if ( isFunction( func ) ) {
  49723. // For each dataType in the dataTypeExpression
  49724. while ( ( dataType = dataTypes[ i++ ] ) ) {
  49725. // Prepend if requested
  49726. if ( dataType[ 0 ] === "+" ) {
  49727. dataType = dataType.slice( 1 ) || "*";
  49728. ( structure[ dataType ] = structure[ dataType ] || [] ).unshift( func );
  49729. // Otherwise append
  49730. } else {
  49731. ( structure[ dataType ] = structure[ dataType ] || [] ).push( func );
  49732. }
  49733. }
  49734. }
  49735. };
  49736. }
  49737. // Base inspection function for prefilters and transports
  49738. function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) {
  49739. var inspected = {},
  49740. seekingTransport = ( structure === transports );
  49741. function inspect( dataType ) {
  49742. var selected;
  49743. inspected[ dataType ] = true;
  49744. jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) {
  49745. var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR );
  49746. if ( typeof dataTypeOrTransport === "string" &&
  49747. !seekingTransport && !inspected[ dataTypeOrTransport ] ) {
  49748. options.dataTypes.unshift( dataTypeOrTransport );
  49749. inspect( dataTypeOrTransport );
  49750. return false;
  49751. } else if ( seekingTransport ) {
  49752. return !( selected = dataTypeOrTransport );
  49753. }
  49754. } );
  49755. return selected;
  49756. }
  49757. return inspect( options.dataTypes[ 0 ] ) || !inspected[ "*" ] && inspect( "*" );
  49758. }
  49759. // A special extend for ajax options
  49760. // that takes "flat" options (not to be deep extended)
  49761. // Fixes #9887
  49762. function ajaxExtend( target, src ) {
  49763. var key, deep,
  49764. flatOptions = jQuery.ajaxSettings.flatOptions || {};
  49765. for ( key in src ) {
  49766. if ( src[ key ] !== undefined ) {
  49767. ( flatOptions[ key ] ? target : ( deep || ( deep = {} ) ) )[ key ] = src[ key ];
  49768. }
  49769. }
  49770. if ( deep ) {
  49771. jQuery.extend( true, target, deep );
  49772. }
  49773. return target;
  49774. }
  49775. /* Handles responses to an ajax request:
  49776. * - finds the right dataType (mediates between content-type and expected dataType)
  49777. * - returns the corresponding response
  49778. */
  49779. function ajaxHandleResponses( s, jqXHR, responses ) {
  49780. var ct, type, finalDataType, firstDataType,
  49781. contents = s.contents,
  49782. dataTypes = s.dataTypes;
  49783. // Remove auto dataType and get content-type in the process
  49784. while ( dataTypes[ 0 ] === "*" ) {
  49785. dataTypes.shift();
  49786. if ( ct === undefined ) {
  49787. ct = s.mimeType || jqXHR.getResponseHeader( "Content-Type" );
  49788. }
  49789. }
  49790. // Check if we're dealing with a known content-type
  49791. if ( ct ) {
  49792. for ( type in contents ) {
  49793. if ( contents[ type ] && contents[ type ].test( ct ) ) {
  49794. dataTypes.unshift( type );
  49795. break;
  49796. }
  49797. }
  49798. }
  49799. // Check to see if we have a response for the expected dataType
  49800. if ( dataTypes[ 0 ] in responses ) {
  49801. finalDataType = dataTypes[ 0 ];
  49802. } else {
  49803. // Try convertible dataTypes
  49804. for ( type in responses ) {
  49805. if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[ 0 ] ] ) {
  49806. finalDataType = type;
  49807. break;
  49808. }
  49809. if ( !firstDataType ) {
  49810. firstDataType = type;
  49811. }
  49812. }
  49813. // Or just use first one
  49814. finalDataType = finalDataType || firstDataType;
  49815. }
  49816. // If we found a dataType
  49817. // We add the dataType to the list if needed
  49818. // and return the corresponding response
  49819. if ( finalDataType ) {
  49820. if ( finalDataType !== dataTypes[ 0 ] ) {
  49821. dataTypes.unshift( finalDataType );
  49822. }
  49823. return responses[ finalDataType ];
  49824. }
  49825. }
  49826. /* Chain conversions given the request and the original response
  49827. * Also sets the responseXXX fields on the jqXHR instance
  49828. */
  49829. function ajaxConvert( s, response, jqXHR, isSuccess ) {
  49830. var conv2, current, conv, tmp, prev,
  49831. converters = {},
  49832. // Work with a copy of dataTypes in case we need to modify it for conversion
  49833. dataTypes = s.dataTypes.slice();
  49834. // Create converters map with lowercased keys
  49835. if ( dataTypes[ 1 ] ) {
  49836. for ( conv in s.converters ) {
  49837. converters[ conv.toLowerCase() ] = s.converters[ conv ];
  49838. }
  49839. }
  49840. current = dataTypes.shift();
  49841. // Convert to each sequential dataType
  49842. while ( current ) {
  49843. if ( s.responseFields[ current ] ) {
  49844. jqXHR[ s.responseFields[ current ] ] = response;
  49845. }
  49846. // Apply the dataFilter if provided
  49847. if ( !prev && isSuccess && s.dataFilter ) {
  49848. response = s.dataFilter( response, s.dataType );
  49849. }
  49850. prev = current;
  49851. current = dataTypes.shift();
  49852. if ( current ) {
  49853. // There's only work to do if current dataType is non-auto
  49854. if ( current === "*" ) {
  49855. current = prev;
  49856. // Convert response if prev dataType is non-auto and differs from current
  49857. } else if ( prev !== "*" && prev !== current ) {
  49858. // Seek a direct converter
  49859. conv = converters[ prev + " " + current ] || converters[ "* " + current ];
  49860. // If none found, seek a pair
  49861. if ( !conv ) {
  49862. for ( conv2 in converters ) {
  49863. // If conv2 outputs current
  49864. tmp = conv2.split( " " );
  49865. if ( tmp[ 1 ] === current ) {
  49866. // If prev can be converted to accepted input
  49867. conv = converters[ prev + " " + tmp[ 0 ] ] ||
  49868. converters[ "* " + tmp[ 0 ] ];
  49869. if ( conv ) {
  49870. // Condense equivalence converters
  49871. if ( conv === true ) {
  49872. conv = converters[ conv2 ];
  49873. // Otherwise, insert the intermediate dataType
  49874. } else if ( converters[ conv2 ] !== true ) {
  49875. current = tmp[ 0 ];
  49876. dataTypes.unshift( tmp[ 1 ] );
  49877. }
  49878. break;
  49879. }
  49880. }
  49881. }
  49882. }
  49883. // Apply converter (if not an equivalence)
  49884. if ( conv !== true ) {
  49885. // Unless errors are allowed to bubble, catch and return them
  49886. if ( conv && s.throws ) {
  49887. response = conv( response );
  49888. } else {
  49889. try {
  49890. response = conv( response );
  49891. } catch ( e ) {
  49892. return {
  49893. state: "parsererror",
  49894. error: conv ? e : "No conversion from " + prev + " to " + current
  49895. };
  49896. }
  49897. }
  49898. }
  49899. }
  49900. }
  49901. }
  49902. return { state: "success", data: response };
  49903. }
  49904. jQuery.extend( {
  49905. // Counter for holding the number of active queries
  49906. active: 0,
  49907. // Last-Modified header cache for next request
  49908. lastModified: {},
  49909. etag: {},
  49910. ajaxSettings: {
  49911. url: location.href,
  49912. type: "GET",
  49913. isLocal: rlocalProtocol.test( location.protocol ),
  49914. global: true,
  49915. processData: true,
  49916. async: true,
  49917. contentType: "application/x-www-form-urlencoded; charset=UTF-8",
  49918. /*
  49919. timeout: 0,
  49920. data: null,
  49921. dataType: null,
  49922. username: null,
  49923. password: null,
  49924. cache: null,
  49925. throws: false,
  49926. traditional: false,
  49927. headers: {},
  49928. */
  49929. accepts: {
  49930. "*": allTypes,
  49931. text: "text/plain",
  49932. html: "text/html",
  49933. xml: "application/xml, text/xml",
  49934. json: "application/json, text/javascript"
  49935. },
  49936. contents: {
  49937. xml: /\bxml\b/,
  49938. html: /\bhtml/,
  49939. json: /\bjson\b/
  49940. },
  49941. responseFields: {
  49942. xml: "responseXML",
  49943. text: "responseText",
  49944. json: "responseJSON"
  49945. },
  49946. // Data converters
  49947. // Keys separate source (or catchall "*") and destination types with a single space
  49948. converters: {
  49949. // Convert anything to text
  49950. "* text": String,
  49951. // Text to html (true = no transformation)
  49952. "text html": true,
  49953. // Evaluate text as a json expression
  49954. "text json": JSON.parse,
  49955. // Parse text as xml
  49956. "text xml": jQuery.parseXML
  49957. },
  49958. // For options that shouldn't be deep extended:
  49959. // you can add your own custom options here if
  49960. // and when you create one that shouldn't be
  49961. // deep extended (see ajaxExtend)
  49962. flatOptions: {
  49963. url: true,
  49964. context: true
  49965. }
  49966. },
  49967. // Creates a full fledged settings object into target
  49968. // with both ajaxSettings and settings fields.
  49969. // If target is omitted, writes into ajaxSettings.
  49970. ajaxSetup: function( target, settings ) {
  49971. return settings ?
  49972. // Building a settings object
  49973. ajaxExtend( ajaxExtend( target, jQuery.ajaxSettings ), settings ) :
  49974. // Extending ajaxSettings
  49975. ajaxExtend( jQuery.ajaxSettings, target );
  49976. },
  49977. ajaxPrefilter: addToPrefiltersOrTransports( prefilters ),
  49978. ajaxTransport: addToPrefiltersOrTransports( transports ),
  49979. // Main method
  49980. ajax: function( url, options ) {
  49981. // If url is an object, simulate pre-1.5 signature
  49982. if ( typeof url === "object" ) {
  49983. options = url;
  49984. url = undefined;
  49985. }
  49986. // Force options to be an object
  49987. options = options || {};
  49988. var transport,
  49989. // URL without anti-cache param
  49990. cacheURL,
  49991. // Response headers
  49992. responseHeadersString,
  49993. responseHeaders,
  49994. // timeout handle
  49995. timeoutTimer,
  49996. // Url cleanup var
  49997. urlAnchor,
  49998. // Request state (becomes false upon send and true upon completion)
  49999. completed,
  50000. // To know if global events are to be dispatched
  50001. fireGlobals,
  50002. // Loop variable
  50003. i,
  50004. // uncached part of the url
  50005. uncached,
  50006. // Create the final options object
  50007. s = jQuery.ajaxSetup( {}, options ),
  50008. // Callbacks context
  50009. callbackContext = s.context || s,
  50010. // Context for global events is callbackContext if it is a DOM node or jQuery collection
  50011. globalEventContext = s.context &&
  50012. ( callbackContext.nodeType || callbackContext.jquery ) ?
  50013. jQuery( callbackContext ) :
  50014. jQuery.event,
  50015. // Deferreds
  50016. deferred = jQuery.Deferred(),
  50017. completeDeferred = jQuery.Callbacks( "once memory" ),
  50018. // Status-dependent callbacks
  50019. statusCode = s.statusCode || {},
  50020. // Headers (they are sent all at once)
  50021. requestHeaders = {},
  50022. requestHeadersNames = {},
  50023. // Default abort message
  50024. strAbort = "canceled",
  50025. // Fake xhr
  50026. jqXHR = {
  50027. readyState: 0,
  50028. // Builds headers hashtable if needed
  50029. getResponseHeader: function( key ) {
  50030. var match;
  50031. if ( completed ) {
  50032. if ( !responseHeaders ) {
  50033. responseHeaders = {};
  50034. while ( ( match = rheaders.exec( responseHeadersString ) ) ) {
  50035. responseHeaders[ match[ 1 ].toLowerCase() ] = match[ 2 ];
  50036. }
  50037. }
  50038. match = responseHeaders[ key.toLowerCase() ];
  50039. }
  50040. return match == null ? null : match;
  50041. },
  50042. // Raw string
  50043. getAllResponseHeaders: function() {
  50044. return completed ? responseHeadersString : null;
  50045. },
  50046. // Caches the header
  50047. setRequestHeader: function( name, value ) {
  50048. if ( completed == null ) {
  50049. name = requestHeadersNames[ name.toLowerCase() ] =
  50050. requestHeadersNames[ name.toLowerCase() ] || name;
  50051. requestHeaders[ name ] = value;
  50052. }
  50053. return this;
  50054. },
  50055. // Overrides response content-type header
  50056. overrideMimeType: function( type ) {
  50057. if ( completed == null ) {
  50058. s.mimeType = type;
  50059. }
  50060. return this;
  50061. },
  50062. // Status-dependent callbacks
  50063. statusCode: function( map ) {
  50064. var code;
  50065. if ( map ) {
  50066. if ( completed ) {
  50067. // Execute the appropriate callbacks
  50068. jqXHR.always( map[ jqXHR.status ] );
  50069. } else {
  50070. // Lazy-add the new callbacks in a way that preserves old ones
  50071. for ( code in map ) {
  50072. statusCode[ code ] = [ statusCode[ code ], map[ code ] ];
  50073. }
  50074. }
  50075. }
  50076. return this;
  50077. },
  50078. // Cancel the request
  50079. abort: function( statusText ) {
  50080. var finalText = statusText || strAbort;
  50081. if ( transport ) {
  50082. transport.abort( finalText );
  50083. }
  50084. done( 0, finalText );
  50085. return this;
  50086. }
  50087. };
  50088. // Attach deferreds
  50089. deferred.promise( jqXHR );
  50090. // Add protocol if not provided (prefilters might expect it)
  50091. // Handle falsy url in the settings object (#10093: consistency with old signature)
  50092. // We also use the url parameter if available
  50093. s.url = ( ( url || s.url || location.href ) + "" )
  50094. .replace( rprotocol, location.protocol + "//" );
  50095. // Alias method option to type as per ticket #12004
  50096. s.type = options.method || options.type || s.method || s.type;
  50097. // Extract dataTypes list
  50098. s.dataTypes = ( s.dataType || "*" ).toLowerCase().match( rnothtmlwhite ) || [ "" ];
  50099. // A cross-domain request is in order when the origin doesn't match the current origin.
  50100. if ( s.crossDomain == null ) {
  50101. urlAnchor = document.createElement( "a" );
  50102. // Support: IE <=8 - 11, Edge 12 - 15
  50103. // IE throws exception on accessing the href property if url is malformed,
  50104. // e.g. http://example.com:80x/
  50105. try {
  50106. urlAnchor.href = s.url;
  50107. // Support: IE <=8 - 11 only
  50108. // Anchor's host property isn't correctly set when s.url is relative
  50109. urlAnchor.href = urlAnchor.href;
  50110. s.crossDomain = originAnchor.protocol + "//" + originAnchor.host !==
  50111. urlAnchor.protocol + "//" + urlAnchor.host;
  50112. } catch ( e ) {
  50113. // If there is an error parsing the URL, assume it is crossDomain,
  50114. // it can be rejected by the transport if it is invalid
  50115. s.crossDomain = true;
  50116. }
  50117. }
  50118. // Convert data if not already a string
  50119. if ( s.data && s.processData && typeof s.data !== "string" ) {
  50120. s.data = jQuery.param( s.data, s.traditional );
  50121. }
  50122. // Apply prefilters
  50123. inspectPrefiltersOrTransports( prefilters, s, options, jqXHR );
  50124. // If request was aborted inside a prefilter, stop there
  50125. if ( completed ) {
  50126. return jqXHR;
  50127. }
  50128. // We can fire global events as of now if asked to
  50129. // Don't fire events if jQuery.event is undefined in an AMD-usage scenario (#15118)
  50130. fireGlobals = jQuery.event && s.global;
  50131. // Watch for a new set of requests
  50132. if ( fireGlobals && jQuery.active++ === 0 ) {
  50133. jQuery.event.trigger( "ajaxStart" );
  50134. }
  50135. // Uppercase the type
  50136. s.type = s.type.toUpperCase();
  50137. // Determine if request has content
  50138. s.hasContent = !rnoContent.test( s.type );
  50139. // Save the URL in case we're toying with the If-Modified-Since
  50140. // and/or If-None-Match header later on
  50141. // Remove hash to simplify url manipulation
  50142. cacheURL = s.url.replace( rhash, "" );
  50143. // More options handling for requests with no content
  50144. if ( !s.hasContent ) {
  50145. // Remember the hash so we can put it back
  50146. uncached = s.url.slice( cacheURL.length );
  50147. // If data is available and should be processed, append data to url
  50148. if ( s.data && ( s.processData || typeof s.data === "string" ) ) {
  50149. cacheURL += ( rquery.test( cacheURL ) ? "&" : "?" ) + s.data;
  50150. // #9682: remove data so that it's not used in an eventual retry
  50151. delete s.data;
  50152. }
  50153. // Add or update anti-cache param if needed
  50154. if ( s.cache === false ) {
  50155. cacheURL = cacheURL.replace( rantiCache, "$1" );
  50156. uncached = ( rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + ( nonce++ ) + uncached;
  50157. }
  50158. // Put hash and anti-cache on the URL that will be requested (gh-1732)
  50159. s.url = cacheURL + uncached;
  50160. // Change '%20' to '+' if this is encoded form body content (gh-2658)
  50161. } else if ( s.data && s.processData &&
  50162. ( s.contentType || "" ).indexOf( "application/x-www-form-urlencoded" ) === 0 ) {
  50163. s.data = s.data.replace( r20, "+" );
  50164. }
  50165. // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
  50166. if ( s.ifModified ) {
  50167. if ( jQuery.lastModified[ cacheURL ] ) {
  50168. jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ cacheURL ] );
  50169. }
  50170. if ( jQuery.etag[ cacheURL ] ) {
  50171. jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ cacheURL ] );
  50172. }
  50173. }
  50174. // Set the correct header, if data is being sent
  50175. if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) {
  50176. jqXHR.setRequestHeader( "Content-Type", s.contentType );
  50177. }
  50178. // Set the Accepts header for the server, depending on the dataType
  50179. jqXHR.setRequestHeader(
  50180. "Accept",
  50181. s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[ 0 ] ] ?
  50182. s.accepts[ s.dataTypes[ 0 ] ] +
  50183. ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) :
  50184. s.accepts[ "*" ]
  50185. );
  50186. // Check for headers option
  50187. for ( i in s.headers ) {
  50188. jqXHR.setRequestHeader( i, s.headers[ i ] );
  50189. }
  50190. // Allow custom headers/mimetypes and early abort
  50191. if ( s.beforeSend &&
  50192. ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || completed ) ) {
  50193. // Abort if not done already and return
  50194. return jqXHR.abort();
  50195. }
  50196. // Aborting is no longer a cancellation
  50197. strAbort = "abort";
  50198. // Install callbacks on deferreds
  50199. completeDeferred.add( s.complete );
  50200. jqXHR.done( s.success );
  50201. jqXHR.fail( s.error );
  50202. // Get transport
  50203. transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR );
  50204. // If no transport, we auto-abort
  50205. if ( !transport ) {
  50206. done( -1, "No Transport" );
  50207. } else {
  50208. jqXHR.readyState = 1;
  50209. // Send global event
  50210. if ( fireGlobals ) {
  50211. globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] );
  50212. }
  50213. // If request was aborted inside ajaxSend, stop there
  50214. if ( completed ) {
  50215. return jqXHR;
  50216. }
  50217. // Timeout
  50218. if ( s.async && s.timeout > 0 ) {
  50219. timeoutTimer = window.setTimeout( function() {
  50220. jqXHR.abort( "timeout" );
  50221. }, s.timeout );
  50222. }
  50223. try {
  50224. completed = false;
  50225. transport.send( requestHeaders, done );
  50226. } catch ( e ) {
  50227. // Rethrow post-completion exceptions
  50228. if ( completed ) {
  50229. throw e;
  50230. }
  50231. // Propagate others as results
  50232. done( -1, e );
  50233. }
  50234. }
  50235. // Callback for when everything is done
  50236. function done( status, nativeStatusText, responses, headers ) {
  50237. var isSuccess, success, error, response, modified,
  50238. statusText = nativeStatusText;
  50239. // Ignore repeat invocations
  50240. if ( completed ) {
  50241. return;
  50242. }
  50243. completed = true;
  50244. // Clear timeout if it exists
  50245. if ( timeoutTimer ) {
  50246. window.clearTimeout( timeoutTimer );
  50247. }
  50248. // Dereference transport for early garbage collection
  50249. // (no matter how long the jqXHR object will be used)
  50250. transport = undefined;
  50251. // Cache response headers
  50252. responseHeadersString = headers || "";
  50253. // Set readyState
  50254. jqXHR.readyState = status > 0 ? 4 : 0;
  50255. // Determine if successful
  50256. isSuccess = status >= 200 && status < 300 || status === 304;
  50257. // Get response data
  50258. if ( responses ) {
  50259. response = ajaxHandleResponses( s, jqXHR, responses );
  50260. }
  50261. // Convert no matter what (that way responseXXX fields are always set)
  50262. response = ajaxConvert( s, response, jqXHR, isSuccess );
  50263. // If successful, handle type chaining
  50264. if ( isSuccess ) {
  50265. // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
  50266. if ( s.ifModified ) {
  50267. modified = jqXHR.getResponseHeader( "Last-Modified" );
  50268. if ( modified ) {
  50269. jQuery.lastModified[ cacheURL ] = modified;
  50270. }
  50271. modified = jqXHR.getResponseHeader( "etag" );
  50272. if ( modified ) {
  50273. jQuery.etag[ cacheURL ] = modified;
  50274. }
  50275. }
  50276. // if no content
  50277. if ( status === 204 || s.type === "HEAD" ) {
  50278. statusText = "nocontent";
  50279. // if not modified
  50280. } else if ( status === 304 ) {
  50281. statusText = "notmodified";
  50282. // If we have data, let's convert it
  50283. } else {
  50284. statusText = response.state;
  50285. success = response.data;
  50286. error = response.error;
  50287. isSuccess = !error;
  50288. }
  50289. } else {
  50290. // Extract error from statusText and normalize for non-aborts
  50291. error = statusText;
  50292. if ( status || !statusText ) {
  50293. statusText = "error";
  50294. if ( status < 0 ) {
  50295. status = 0;
  50296. }
  50297. }
  50298. }
  50299. // Set data for the fake xhr object
  50300. jqXHR.status = status;
  50301. jqXHR.statusText = ( nativeStatusText || statusText ) + "";
  50302. // Success/Error
  50303. if ( isSuccess ) {
  50304. deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] );
  50305. } else {
  50306. deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] );
  50307. }
  50308. // Status-dependent callbacks
  50309. jqXHR.statusCode( statusCode );
  50310. statusCode = undefined;
  50311. if ( fireGlobals ) {
  50312. globalEventContext.trigger( isSuccess ? "ajaxSuccess" : "ajaxError",
  50313. [ jqXHR, s, isSuccess ? success : error ] );
  50314. }
  50315. // Complete
  50316. completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] );
  50317. if ( fireGlobals ) {
  50318. globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] );
  50319. // Handle the global AJAX counter
  50320. if ( !( --jQuery.active ) ) {
  50321. jQuery.event.trigger( "ajaxStop" );
  50322. }
  50323. }
  50324. }
  50325. return jqXHR;
  50326. },
  50327. getJSON: function( url, data, callback ) {
  50328. return jQuery.get( url, data, callback, "json" );
  50329. },
  50330. getScript: function( url, callback ) {
  50331. return jQuery.get( url, undefined, callback, "script" );
  50332. }
  50333. } );
  50334. jQuery.each( [ "get", "post" ], function( i, method ) {
  50335. jQuery[ method ] = function( url, data, callback, type ) {
  50336. // Shift arguments if data argument was omitted
  50337. if ( isFunction( data ) ) {
  50338. type = type || callback;
  50339. callback = data;
  50340. data = undefined;
  50341. }
  50342. // The url can be an options object (which then must have .url)
  50343. return jQuery.ajax( jQuery.extend( {
  50344. url: url,
  50345. type: method,
  50346. dataType: type,
  50347. data: data,
  50348. success: callback
  50349. }, jQuery.isPlainObject( url ) && url ) );
  50350. };
  50351. } );
  50352. jQuery._evalUrl = function( url ) {
  50353. return jQuery.ajax( {
  50354. url: url,
  50355. // Make this explicit, since user can override this through ajaxSetup (#11264)
  50356. type: "GET",
  50357. dataType: "script",
  50358. cache: true,
  50359. async: false,
  50360. global: false,
  50361. "throws": true
  50362. } );
  50363. };
  50364. jQuery.fn.extend( {
  50365. wrapAll: function( html ) {
  50366. var wrap;
  50367. if ( this[ 0 ] ) {
  50368. if ( isFunction( html ) ) {
  50369. html = html.call( this[ 0 ] );
  50370. }
  50371. // The elements to wrap the target around
  50372. wrap = jQuery( html, this[ 0 ].ownerDocument ).eq( 0 ).clone( true );
  50373. if ( this[ 0 ].parentNode ) {
  50374. wrap.insertBefore( this[ 0 ] );
  50375. }
  50376. wrap.map( function() {
  50377. var elem = this;
  50378. while ( elem.firstElementChild ) {
  50379. elem = elem.firstElementChild;
  50380. }
  50381. return elem;
  50382. } ).append( this );
  50383. }
  50384. return this;
  50385. },
  50386. wrapInner: function( html ) {
  50387. if ( isFunction( html ) ) {
  50388. return this.each( function( i ) {
  50389. jQuery( this ).wrapInner( html.call( this, i ) );
  50390. } );
  50391. }
  50392. return this.each( function() {
  50393. var self = jQuery( this ),
  50394. contents = self.contents();
  50395. if ( contents.length ) {
  50396. contents.wrapAll( html );
  50397. } else {
  50398. self.append( html );
  50399. }
  50400. } );
  50401. },
  50402. wrap: function( html ) {
  50403. var htmlIsFunction = isFunction( html );
  50404. return this.each( function( i ) {
  50405. jQuery( this ).wrapAll( htmlIsFunction ? html.call( this, i ) : html );
  50406. } );
  50407. },
  50408. unwrap: function( selector ) {
  50409. this.parent( selector ).not( "body" ).each( function() {
  50410. jQuery( this ).replaceWith( this.childNodes );
  50411. } );
  50412. return this;
  50413. }
  50414. } );
  50415. jQuery.expr.pseudos.hidden = function( elem ) {
  50416. return !jQuery.expr.pseudos.visible( elem );
  50417. };
  50418. jQuery.expr.pseudos.visible = function( elem ) {
  50419. return !!( elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length );
  50420. };
  50421. jQuery.ajaxSettings.xhr = function() {
  50422. try {
  50423. return new window.XMLHttpRequest();
  50424. } catch ( e ) {}
  50425. };
  50426. var xhrSuccessStatus = {
  50427. // File protocol always yields status code 0, assume 200
  50428. 0: 200,
  50429. // Support: IE <=9 only
  50430. // #1450: sometimes IE returns 1223 when it should be 204
  50431. 1223: 204
  50432. },
  50433. xhrSupported = jQuery.ajaxSettings.xhr();
  50434. support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported );
  50435. support.ajax = xhrSupported = !!xhrSupported;
  50436. jQuery.ajaxTransport( function( options ) {
  50437. var callback, errorCallback;
  50438. // Cross domain only allowed if supported through XMLHttpRequest
  50439. if ( support.cors || xhrSupported && !options.crossDomain ) {
  50440. return {
  50441. send: function( headers, complete ) {
  50442. var i,
  50443. xhr = options.xhr();
  50444. xhr.open(
  50445. options.type,
  50446. options.url,
  50447. options.async,
  50448. options.username,
  50449. options.password
  50450. );
  50451. // Apply custom fields if provided
  50452. if ( options.xhrFields ) {
  50453. for ( i in options.xhrFields ) {
  50454. xhr[ i ] = options.xhrFields[ i ];
  50455. }
  50456. }
  50457. // Override mime type if needed
  50458. if ( options.mimeType && xhr.overrideMimeType ) {
  50459. xhr.overrideMimeType( options.mimeType );
  50460. }
  50461. // X-Requested-With header
  50462. // For cross-domain requests, seeing as conditions for a preflight are
  50463. // akin to a jigsaw puzzle, we simply never set it to be sure.
  50464. // (it can always be set on a per-request basis or even using ajaxSetup)
  50465. // For same-domain requests, won't change header if already provided.
  50466. if ( !options.crossDomain && !headers[ "X-Requested-With" ] ) {
  50467. headers[ "X-Requested-With" ] = "XMLHttpRequest";
  50468. }
  50469. // Set headers
  50470. for ( i in headers ) {
  50471. xhr.setRequestHeader( i, headers[ i ] );
  50472. }
  50473. // Callback
  50474. callback = function( type ) {
  50475. return function() {
  50476. if ( callback ) {
  50477. callback = errorCallback = xhr.onload =
  50478. xhr.onerror = xhr.onabort = xhr.ontimeout =
  50479. xhr.onreadystatechange = null;
  50480. if ( type === "abort" ) {
  50481. xhr.abort();
  50482. } else if ( type === "error" ) {
  50483. // Support: IE <=9 only
  50484. // On a manual native abort, IE9 throws
  50485. // errors on any property access that is not readyState
  50486. if ( typeof xhr.status !== "number" ) {
  50487. complete( 0, "error" );
  50488. } else {
  50489. complete(
  50490. // File: protocol always yields status 0; see #8605, #14207
  50491. xhr.status,
  50492. xhr.statusText
  50493. );
  50494. }
  50495. } else {
  50496. complete(
  50497. xhrSuccessStatus[ xhr.status ] || xhr.status,
  50498. xhr.statusText,
  50499. // Support: IE <=9 only
  50500. // IE9 has no XHR2 but throws on binary (trac-11426)
  50501. // For XHR2 non-text, let the caller handle it (gh-2498)
  50502. ( xhr.responseType || "text" ) !== "text" ||
  50503. typeof xhr.responseText !== "string" ?
  50504. { binary: xhr.response } :
  50505. { text: xhr.responseText },
  50506. xhr.getAllResponseHeaders()
  50507. );
  50508. }
  50509. }
  50510. };
  50511. };
  50512. // Listen to events
  50513. xhr.onload = callback();
  50514. errorCallback = xhr.onerror = xhr.ontimeout = callback( "error" );
  50515. // Support: IE 9 only
  50516. // Use onreadystatechange to replace onabort
  50517. // to handle uncaught aborts
  50518. if ( xhr.onabort !== undefined ) {
  50519. xhr.onabort = errorCallback;
  50520. } else {
  50521. xhr.onreadystatechange = function() {
  50522. // Check readyState before timeout as it changes
  50523. if ( xhr.readyState === 4 ) {
  50524. // Allow onerror to be called first,
  50525. // but that will not handle a native abort
  50526. // Also, save errorCallback to a variable
  50527. // as xhr.onerror cannot be accessed
  50528. window.setTimeout( function() {
  50529. if ( callback ) {
  50530. errorCallback();
  50531. }
  50532. } );
  50533. }
  50534. };
  50535. }
  50536. // Create the abort callback
  50537. callback = callback( "abort" );
  50538. try {
  50539. // Do send the request (this may raise an exception)
  50540. xhr.send( options.hasContent && options.data || null );
  50541. } catch ( e ) {
  50542. // #14683: Only rethrow if this hasn't been notified as an error yet
  50543. if ( callback ) {
  50544. throw e;
  50545. }
  50546. }
  50547. },
  50548. abort: function() {
  50549. if ( callback ) {
  50550. callback();
  50551. }
  50552. }
  50553. };
  50554. }
  50555. } );
  50556. // Prevent auto-execution of scripts when no explicit dataType was provided (See gh-2432)
  50557. jQuery.ajaxPrefilter( function( s ) {
  50558. if ( s.crossDomain ) {
  50559. s.contents.script = false;
  50560. }
  50561. } );
  50562. // Install script dataType
  50563. jQuery.ajaxSetup( {
  50564. accepts: {
  50565. script: "text/javascript, application/javascript, " +
  50566. "application/ecmascript, application/x-ecmascript"
  50567. },
  50568. contents: {
  50569. script: /\b(?:java|ecma)script\b/
  50570. },
  50571. converters: {
  50572. "text script": function( text ) {
  50573. jQuery.globalEval( text );
  50574. return text;
  50575. }
  50576. }
  50577. } );
  50578. // Handle cache's special case and crossDomain
  50579. jQuery.ajaxPrefilter( "script", function( s ) {
  50580. if ( s.cache === undefined ) {
  50581. s.cache = false;
  50582. }
  50583. if ( s.crossDomain ) {
  50584. s.type = "GET";
  50585. }
  50586. } );
  50587. // Bind script tag hack transport
  50588. jQuery.ajaxTransport( "script", function( s ) {
  50589. // This transport only deals with cross domain requests
  50590. if ( s.crossDomain ) {
  50591. var script, callback;
  50592. return {
  50593. send: function( _, complete ) {
  50594. script = jQuery( "<script>" ).prop( {
  50595. charset: s.scriptCharset,
  50596. src: s.url
  50597. } ).on(
  50598. "load error",
  50599. callback = function( evt ) {
  50600. script.remove();
  50601. callback = null;
  50602. if ( evt ) {
  50603. complete( evt.type === "error" ? 404 : 200, evt.type );
  50604. }
  50605. }
  50606. );
  50607. // Use native DOM manipulation to avoid our domManip AJAX trickery
  50608. document.head.appendChild( script[ 0 ] );
  50609. },
  50610. abort: function() {
  50611. if ( callback ) {
  50612. callback();
  50613. }
  50614. }
  50615. };
  50616. }
  50617. } );
  50618. var oldCallbacks = [],
  50619. rjsonp = /(=)\?(?=&|$)|\?\?/;
  50620. // Default jsonp settings
  50621. jQuery.ajaxSetup( {
  50622. jsonp: "callback",
  50623. jsonpCallback: function() {
  50624. var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( nonce++ ) );
  50625. this[ callback ] = true;
  50626. return callback;
  50627. }
  50628. } );
  50629. // Detect, normalize options and install callbacks for jsonp requests
  50630. jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) {
  50631. var callbackName, overwritten, responseContainer,
  50632. jsonProp = s.jsonp !== false && ( rjsonp.test( s.url ) ?
  50633. "url" :
  50634. typeof s.data === "string" &&
  50635. ( s.contentType || "" )
  50636. .indexOf( "application/x-www-form-urlencoded" ) === 0 &&
  50637. rjsonp.test( s.data ) && "data"
  50638. );
  50639. // Handle iff the expected data type is "jsonp" or we have a parameter to set
  50640. if ( jsonProp || s.dataTypes[ 0 ] === "jsonp" ) {
  50641. // Get callback name, remembering preexisting value associated with it
  50642. callbackName = s.jsonpCallback = isFunction( s.jsonpCallback ) ?
  50643. s.jsonpCallback() :
  50644. s.jsonpCallback;
  50645. // Insert callback into url or form data
  50646. if ( jsonProp ) {
  50647. s[ jsonProp ] = s[ jsonProp ].replace( rjsonp, "$1" + callbackName );
  50648. } else if ( s.jsonp !== false ) {
  50649. s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.jsonp + "=" + callbackName;
  50650. }
  50651. // Use data converter to retrieve json after script execution
  50652. s.converters[ "script json" ] = function() {
  50653. if ( !responseContainer ) {
  50654. jQuery.error( callbackName + " was not called" );
  50655. }
  50656. return responseContainer[ 0 ];
  50657. };
  50658. // Force json dataType
  50659. s.dataTypes[ 0 ] = "json";
  50660. // Install callback
  50661. overwritten = window[ callbackName ];
  50662. window[ callbackName ] = function() {
  50663. responseContainer = arguments;
  50664. };
  50665. // Clean-up function (fires after converters)
  50666. jqXHR.always( function() {
  50667. // If previous value didn't exist - remove it
  50668. if ( overwritten === undefined ) {
  50669. jQuery( window ).removeProp( callbackName );
  50670. // Otherwise restore preexisting value
  50671. } else {
  50672. window[ callbackName ] = overwritten;
  50673. }
  50674. // Save back as free
  50675. if ( s[ callbackName ] ) {
  50676. // Make sure that re-using the options doesn't screw things around
  50677. s.jsonpCallback = originalSettings.jsonpCallback;
  50678. // Save the callback name for future use
  50679. oldCallbacks.push( callbackName );
  50680. }
  50681. // Call if it was a function and we have a response
  50682. if ( responseContainer && isFunction( overwritten ) ) {
  50683. overwritten( responseContainer[ 0 ] );
  50684. }
  50685. responseContainer = overwritten = undefined;
  50686. } );
  50687. // Delegate to script
  50688. return "script";
  50689. }
  50690. } );
  50691. // Support: Safari 8 only
  50692. // In Safari 8 documents created via document.implementation.createHTMLDocument
  50693. // collapse sibling forms: the second one becomes a child of the first one.
  50694. // Because of that, this security measure has to be disabled in Safari 8.
  50695. // https://bugs.webkit.org/show_bug.cgi?id=137337
  50696. support.createHTMLDocument = ( function() {
  50697. var body = document.implementation.createHTMLDocument( "" ).body;
  50698. body.innerHTML = "<form></form><form></form>";
  50699. return body.childNodes.length === 2;
  50700. } )();
  50701. // Argument "data" should be string of html
  50702. // context (optional): If specified, the fragment will be created in this context,
  50703. // defaults to document
  50704. // keepScripts (optional): If true, will include scripts passed in the html string
  50705. jQuery.parseHTML = function( data, context, keepScripts ) {
  50706. if ( typeof data !== "string" ) {
  50707. return [];
  50708. }
  50709. if ( typeof context === "boolean" ) {
  50710. keepScripts = context;
  50711. context = false;
  50712. }
  50713. var base, parsed, scripts;
  50714. if ( !context ) {
  50715. // Stop scripts or inline event handlers from being executed immediately
  50716. // by using document.implementation
  50717. if ( support.createHTMLDocument ) {
  50718. context = document.implementation.createHTMLDocument( "" );
  50719. // Set the base href for the created document
  50720. // so any parsed elements with URLs
  50721. // are based on the document's URL (gh-2965)
  50722. base = context.createElement( "base" );
  50723. base.href = document.location.href;
  50724. context.head.appendChild( base );
  50725. } else {
  50726. context = document;
  50727. }
  50728. }
  50729. parsed = rsingleTag.exec( data );
  50730. scripts = !keepScripts && [];
  50731. // Single tag
  50732. if ( parsed ) {
  50733. return [ context.createElement( parsed[ 1 ] ) ];
  50734. }
  50735. parsed = buildFragment( [ data ], context, scripts );
  50736. if ( scripts && scripts.length ) {
  50737. jQuery( scripts ).remove();
  50738. }
  50739. return jQuery.merge( [], parsed.childNodes );
  50740. };
  50741. /**
  50742. * Load a url into a page
  50743. */
  50744. jQuery.fn.load = function( url, params, callback ) {
  50745. var selector, type, response,
  50746. self = this,
  50747. off = url.indexOf( " " );
  50748. if ( off > -1 ) {
  50749. selector = stripAndCollapse( url.slice( off ) );
  50750. url = url.slice( 0, off );
  50751. }
  50752. // If it's a function
  50753. if ( isFunction( params ) ) {
  50754. // We assume that it's the callback
  50755. callback = params;
  50756. params = undefined;
  50757. // Otherwise, build a param string
  50758. } else if ( params && typeof params === "object" ) {
  50759. type = "POST";
  50760. }
  50761. // If we have elements to modify, make the request
  50762. if ( self.length > 0 ) {
  50763. jQuery.ajax( {
  50764. url: url,
  50765. // If "type" variable is undefined, then "GET" method will be used.
  50766. // Make value of this field explicit since
  50767. // user can override it through ajaxSetup method
  50768. type: type || "GET",
  50769. dataType: "html",
  50770. data: params
  50771. } ).done( function( responseText ) {
  50772. // Save response for use in complete callback
  50773. response = arguments;
  50774. self.html( selector ?
  50775. // If a selector was specified, locate the right elements in a dummy div
  50776. // Exclude scripts to avoid IE 'Permission Denied' errors
  50777. jQuery( "<div>" ).append( jQuery.parseHTML( responseText ) ).find( selector ) :
  50778. // Otherwise use the full result
  50779. responseText );
  50780. // If the request succeeds, this function gets "data", "status", "jqXHR"
  50781. // but they are ignored because response was set above.
  50782. // If it fails, this function gets "jqXHR", "status", "error"
  50783. } ).always( callback && function( jqXHR, status ) {
  50784. self.each( function() {
  50785. callback.apply( this, response || [ jqXHR.responseText, status, jqXHR ] );
  50786. } );
  50787. } );
  50788. }
  50789. return this;
  50790. };
  50791. // Attach a bunch of functions for handling common AJAX events
  50792. jQuery.each( [
  50793. "ajaxStart",
  50794. "ajaxStop",
  50795. "ajaxComplete",
  50796. "ajaxError",
  50797. "ajaxSuccess",
  50798. "ajaxSend"
  50799. ], function( i, type ) {
  50800. jQuery.fn[ type ] = function( fn ) {
  50801. return this.on( type, fn );
  50802. };
  50803. } );
  50804. jQuery.expr.pseudos.animated = function( elem ) {
  50805. return jQuery.grep( jQuery.timers, function( fn ) {
  50806. return elem === fn.elem;
  50807. } ).length;
  50808. };
  50809. jQuery.offset = {
  50810. setOffset: function( elem, options, i ) {
  50811. var curPosition, curLeft, curCSSTop, curTop, curOffset, curCSSLeft, calculatePosition,
  50812. position = jQuery.css( elem, "position" ),
  50813. curElem = jQuery( elem ),
  50814. props = {};
  50815. // Set position first, in-case top/left are set even on static elem
  50816. if ( position === "static" ) {
  50817. elem.style.position = "relative";
  50818. }
  50819. curOffset = curElem.offset();
  50820. curCSSTop = jQuery.css( elem, "top" );
  50821. curCSSLeft = jQuery.css( elem, "left" );
  50822. calculatePosition = ( position === "absolute" || position === "fixed" ) &&
  50823. ( curCSSTop + curCSSLeft ).indexOf( "auto" ) > -1;
  50824. // Need to be able to calculate position if either
  50825. // top or left is auto and position is either absolute or fixed
  50826. if ( calculatePosition ) {
  50827. curPosition = curElem.position();
  50828. curTop = curPosition.top;
  50829. curLeft = curPosition.left;
  50830. } else {
  50831. curTop = parseFloat( curCSSTop ) || 0;
  50832. curLeft = parseFloat( curCSSLeft ) || 0;
  50833. }
  50834. if ( isFunction( options ) ) {
  50835. // Use jQuery.extend here to allow modification of coordinates argument (gh-1848)
  50836. options = options.call( elem, i, jQuery.extend( {}, curOffset ) );
  50837. }
  50838. if ( options.top != null ) {
  50839. props.top = ( options.top - curOffset.top ) + curTop;
  50840. }
  50841. if ( options.left != null ) {
  50842. props.left = ( options.left - curOffset.left ) + curLeft;
  50843. }
  50844. if ( "using" in options ) {
  50845. options.using.call( elem, props );
  50846. } else {
  50847. curElem.css( props );
  50848. }
  50849. }
  50850. };
  50851. jQuery.fn.extend( {
  50852. // offset() relates an element's border box to the document origin
  50853. offset: function( options ) {
  50854. // Preserve chaining for setter
  50855. if ( arguments.length ) {
  50856. return options === undefined ?
  50857. this :
  50858. this.each( function( i ) {
  50859. jQuery.offset.setOffset( this, options, i );
  50860. } );
  50861. }
  50862. var rect, win,
  50863. elem = this[ 0 ];
  50864. if ( !elem ) {
  50865. return;
  50866. }
  50867. // Return zeros for disconnected and hidden (display: none) elements (gh-2310)
  50868. // Support: IE <=11 only
  50869. // Running getBoundingClientRect on a
  50870. // disconnected node in IE throws an error
  50871. if ( !elem.getClientRects().length ) {
  50872. return { top: 0, left: 0 };
  50873. }
  50874. // Get document-relative position by adding viewport scroll to viewport-relative gBCR
  50875. rect = elem.getBoundingClientRect();
  50876. win = elem.ownerDocument.defaultView;
  50877. return {
  50878. top: rect.top + win.pageYOffset,
  50879. left: rect.left + win.pageXOffset
  50880. };
  50881. },
  50882. // position() relates an element's margin box to its offset parent's padding box
  50883. // This corresponds to the behavior of CSS absolute positioning
  50884. position: function() {
  50885. if ( !this[ 0 ] ) {
  50886. return;
  50887. }
  50888. var offsetParent, offset, doc,
  50889. elem = this[ 0 ],
  50890. parentOffset = { top: 0, left: 0 };
  50891. // position:fixed elements are offset from the viewport, which itself always has zero offset
  50892. if ( jQuery.css( elem, "position" ) === "fixed" ) {
  50893. // Assume position:fixed implies availability of getBoundingClientRect
  50894. offset = elem.getBoundingClientRect();
  50895. } else {
  50896. offset = this.offset();
  50897. // Account for the *real* offset parent, which can be the document or its root element
  50898. // when a statically positioned element is identified
  50899. doc = elem.ownerDocument;
  50900. offsetParent = elem.offsetParent || doc.documentElement;
  50901. while ( offsetParent &&
  50902. ( offsetParent === doc.body || offsetParent === doc.documentElement ) &&
  50903. jQuery.css( offsetParent, "position" ) === "static" ) {
  50904. offsetParent = offsetParent.parentNode;
  50905. }
  50906. if ( offsetParent && offsetParent !== elem && offsetParent.nodeType === 1 ) {
  50907. // Incorporate borders into its offset, since they are outside its content origin
  50908. parentOffset = jQuery( offsetParent ).offset();
  50909. parentOffset.top += jQuery.css( offsetParent, "borderTopWidth", true );
  50910. parentOffset.left += jQuery.css( offsetParent, "borderLeftWidth", true );
  50911. }
  50912. }
  50913. // Subtract parent offsets and element margins
  50914. return {
  50915. top: offset.top - parentOffset.top - jQuery.css( elem, "marginTop", true ),
  50916. left: offset.left - parentOffset.left - jQuery.css( elem, "marginLeft", true )
  50917. };
  50918. },
  50919. // This method will return documentElement in the following cases:
  50920. // 1) For the element inside the iframe without offsetParent, this method will return
  50921. // documentElement of the parent window
  50922. // 2) For the hidden or detached element
  50923. // 3) For body or html element, i.e. in case of the html node - it will return itself
  50924. //
  50925. // but those exceptions were never presented as a real life use-cases
  50926. // and might be considered as more preferable results.
  50927. //
  50928. // This logic, however, is not guaranteed and can change at any point in the future
  50929. offsetParent: function() {
  50930. return this.map( function() {
  50931. var offsetParent = this.offsetParent;
  50932. while ( offsetParent && jQuery.css( offsetParent, "position" ) === "static" ) {
  50933. offsetParent = offsetParent.offsetParent;
  50934. }
  50935. return offsetParent || documentElement;
  50936. } );
  50937. }
  50938. } );
  50939. // Create scrollLeft and scrollTop methods
  50940. jQuery.each( { scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, function( method, prop ) {
  50941. var top = "pageYOffset" === prop;
  50942. jQuery.fn[ method ] = function( val ) {
  50943. return access( this, function( elem, method, val ) {
  50944. // Coalesce documents and windows
  50945. var win;
  50946. if ( isWindow( elem ) ) {
  50947. win = elem;
  50948. } else if ( elem.nodeType === 9 ) {
  50949. win = elem.defaultView;
  50950. }
  50951. if ( val === undefined ) {
  50952. return win ? win[ prop ] : elem[ method ];
  50953. }
  50954. if ( win ) {
  50955. win.scrollTo(
  50956. !top ? val : win.pageXOffset,
  50957. top ? val : win.pageYOffset
  50958. );
  50959. } else {
  50960. elem[ method ] = val;
  50961. }
  50962. }, method, val, arguments.length );
  50963. };
  50964. } );
  50965. // Support: Safari <=7 - 9.1, Chrome <=37 - 49
  50966. // Add the top/left cssHooks using jQuery.fn.position
  50967. // Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084
  50968. // Blink bug: https://bugs.chromium.org/p/chromium/issues/detail?id=589347
  50969. // getComputedStyle returns percent when specified for top/left/bottom/right;
  50970. // rather than make the css module depend on the offset module, just check for it here
  50971. jQuery.each( [ "top", "left" ], function( i, prop ) {
  50972. jQuery.cssHooks[ prop ] = addGetHookIf( support.pixelPosition,
  50973. function( elem, computed ) {
  50974. if ( computed ) {
  50975. computed = curCSS( elem, prop );
  50976. // If curCSS returns percentage, fallback to offset
  50977. return rnumnonpx.test( computed ) ?
  50978. jQuery( elem ).position()[ prop ] + "px" :
  50979. computed;
  50980. }
  50981. }
  50982. );
  50983. } );
  50984. // Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods
  50985. jQuery.each( { Height: "height", Width: "width" }, function( name, type ) {
  50986. jQuery.each( { padding: "inner" + name, content: type, "": "outer" + name },
  50987. function( defaultExtra, funcName ) {
  50988. // Margin is only for outerHeight, outerWidth
  50989. jQuery.fn[ funcName ] = function( margin, value ) {
  50990. var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ),
  50991. extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" );
  50992. return access( this, function( elem, type, value ) {
  50993. var doc;
  50994. if ( isWindow( elem ) ) {
  50995. // $( window ).outerWidth/Height return w/h including scrollbars (gh-1729)
  50996. return funcName.indexOf( "outer" ) === 0 ?
  50997. elem[ "inner" + name ] :
  50998. elem.document.documentElement[ "client" + name ];
  50999. }
  51000. // Get document width or height
  51001. if ( elem.nodeType === 9 ) {
  51002. doc = elem.documentElement;
  51003. // Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height],
  51004. // whichever is greatest
  51005. return Math.max(
  51006. elem.body[ "scroll" + name ], doc[ "scroll" + name ],
  51007. elem.body[ "offset" + name ], doc[ "offset" + name ],
  51008. doc[ "client" + name ]
  51009. );
  51010. }
  51011. return value === undefined ?
  51012. // Get width or height on the element, requesting but not forcing parseFloat
  51013. jQuery.css( elem, type, extra ) :
  51014. // Set width or height on the element
  51015. jQuery.style( elem, type, value, extra );
  51016. }, type, chainable ? margin : undefined, chainable );
  51017. };
  51018. } );
  51019. } );
  51020. jQuery.each( ( "blur focus focusin focusout resize scroll click dblclick " +
  51021. "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
  51022. "change select submit keydown keypress keyup contextmenu" ).split( " " ),
  51023. function( i, name ) {
  51024. // Handle event binding
  51025. jQuery.fn[ name ] = function( data, fn ) {
  51026. return arguments.length > 0 ?
  51027. this.on( name, null, data, fn ) :
  51028. this.trigger( name );
  51029. };
  51030. } );
  51031. jQuery.fn.extend( {
  51032. hover: function( fnOver, fnOut ) {
  51033. return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );
  51034. }
  51035. } );
  51036. jQuery.fn.extend( {
  51037. bind: function( types, data, fn ) {
  51038. return this.on( types, null, data, fn );
  51039. },
  51040. unbind: function( types, fn ) {
  51041. return this.off( types, null, fn );
  51042. },
  51043. delegate: function( selector, types, data, fn ) {
  51044. return this.on( types, selector, data, fn );
  51045. },
  51046. undelegate: function( selector, types, fn ) {
  51047. // ( namespace ) or ( selector, types [, fn] )
  51048. return arguments.length === 1 ?
  51049. this.off( selector, "**" ) :
  51050. this.off( types, selector || "**", fn );
  51051. }
  51052. } );
  51053. // Bind a function to a context, optionally partially applying any
  51054. // arguments.
  51055. // jQuery.proxy is deprecated to promote standards (specifically Function#bind)
  51056. // However, it is not slated for removal any time soon
  51057. jQuery.proxy = function( fn, context ) {
  51058. var tmp, args, proxy;
  51059. if ( typeof context === "string" ) {
  51060. tmp = fn[ context ];
  51061. context = fn;
  51062. fn = tmp;
  51063. }
  51064. // Quick check to determine if target is callable, in the spec
  51065. // this throws a TypeError, but we will just return undefined.
  51066. if ( !isFunction( fn ) ) {
  51067. return undefined;
  51068. }
  51069. // Simulated bind
  51070. args = slice.call( arguments, 2 );
  51071. proxy = function() {
  51072. return fn.apply( context || this, args.concat( slice.call( arguments ) ) );
  51073. };
  51074. // Set the guid of unique handler to the same of original handler, so it can be removed
  51075. proxy.guid = fn.guid = fn.guid || jQuery.guid++;
  51076. return proxy;
  51077. };
  51078. jQuery.holdReady = function( hold ) {
  51079. if ( hold ) {
  51080. jQuery.readyWait++;
  51081. } else {
  51082. jQuery.ready( true );
  51083. }
  51084. };
  51085. jQuery.isArray = Array.isArray;
  51086. jQuery.parseJSON = JSON.parse;
  51087. jQuery.nodeName = nodeName;
  51088. jQuery.isFunction = isFunction;
  51089. jQuery.isWindow = isWindow;
  51090. jQuery.camelCase = camelCase;
  51091. jQuery.type = toType;
  51092. jQuery.now = Date.now;
  51093. jQuery.isNumeric = function( obj ) {
  51094. // As of jQuery 3.0, isNumeric is limited to
  51095. // strings and numbers (primitives or objects)
  51096. // that can be coerced to finite numbers (gh-2662)
  51097. var type = jQuery.type( obj );
  51098. return ( type === "number" || type === "string" ) &&
  51099. // parseFloat NaNs numeric-cast false positives ("")
  51100. // ...but misinterprets leading-number strings, particularly hex literals ("0x...")
  51101. // subtraction forces infinities to NaN
  51102. !isNaN( obj - parseFloat( obj ) );
  51103. };
  51104. // Register as a named AMD module, since jQuery can be concatenated with other
  51105. // files that may use define, but not via a proper concatenation script that
  51106. // understands anonymous AMD modules. A named AMD is safest and most robust
  51107. // way to register. Lowercase jquery is used because AMD module names are
  51108. // derived from file names, and jQuery is normally delivered in a lowercase
  51109. // file name. Do this after creating the global so that if an AMD module wants
  51110. // to call noConflict to hide this version of jQuery, it will work.
  51111. // Note that for maximum portability, libraries that are not jQuery should
  51112. // declare themselves as anonymous modules, and avoid setting a global if an
  51113. // AMD loader is present. jQuery is a special case. For more information, see
  51114. // https://github.com/jrburke/requirejs/wiki/Updating-existing-libraries#wiki-anon
  51115. if ( true ) {
  51116. !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = (function() {
  51117. return jQuery;
  51118. }).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
  51119. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  51120. }
  51121. var
  51122. // Map over jQuery in case of overwrite
  51123. _jQuery = window.jQuery,
  51124. // Map over the $ in case of overwrite
  51125. _$ = window.$;
  51126. jQuery.noConflict = function( deep ) {
  51127. if ( window.$ === jQuery ) {
  51128. window.$ = _$;
  51129. }
  51130. if ( deep && window.jQuery === jQuery ) {
  51131. window.jQuery = _jQuery;
  51132. }
  51133. return jQuery;
  51134. };
  51135. // Expose jQuery and $ identifiers, even in AMD
  51136. // (#7102#comment:10, https://github.com/jquery/jquery/pull/557)
  51137. // and CommonJS for browser emulators (#13566)
  51138. if ( !noGlobal ) {
  51139. window.jQuery = window.$ = jQuery;
  51140. }
  51141. return jQuery;
  51142. } );
  51143. /***/ }),
  51144. /***/ "./node_modules/line-i18n/dist/LanguageService.js":
  51145. /*!********************************************************!*\
  51146. !*** ./node_modules/line-i18n/dist/LanguageService.js ***!
  51147. \********************************************************/
  51148. /*! exports provided: LanguageService */
  51149. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  51150. "use strict";
  51151. __webpack_require__.r(__webpack_exports__);
  51152. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "LanguageService", function() { return LanguageService; });
  51153. var LanguageService = /** @class */ (function () {
  51154. function LanguageService(lsKey, defaultLang) {
  51155. if (defaultLang === void 0) { defaultLang = 'pt'; }
  51156. this.lsKey = lsKey;
  51157. this.defaultLang = defaultLang;
  51158. this.listeners = [];
  51159. this.document = document;
  51160. this.setupListener();
  51161. }
  51162. LanguageService.prototype.setupListener = function () {
  51163. var _this = this;
  51164. if (this.document !== null) {
  51165. this.document.addEventListener("storage", (function (event) {
  51166. var e = event;
  51167. if (e.key === _this.lsKey) {
  51168. _this.listeners.forEach(function (l) { return l(); });
  51169. }
  51170. }));
  51171. }
  51172. };
  51173. LanguageService.prototype.getLang = function () {
  51174. var lang = localStorage.getItem(this.lsKey);
  51175. if (lang === null || lang === undefined) {
  51176. console.warn("Internal Error: User language information has not been set. Returning default...");
  51177. return this.getDefaultLang();
  51178. }
  51179. return lang;
  51180. };
  51181. LanguageService.prototype.getDefaultLang = function () {
  51182. return this.defaultLang;
  51183. };
  51184. LanguageService.prototype.registerLanguageChangeListener = function (listener) {
  51185. this.listeners.push(listener);
  51186. };
  51187. return LanguageService;
  51188. }());
  51189. /***/ }),
  51190. /***/ "./node_modules/line-i18n/dist/LanguageServiceNoLS.js":
  51191. /*!************************************************************!*\
  51192. !*** ./node_modules/line-i18n/dist/LanguageServiceNoLS.js ***!
  51193. \************************************************************/
  51194. /*! exports provided: LanguageServiceNoLS */
  51195. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  51196. "use strict";
  51197. __webpack_require__.r(__webpack_exports__);
  51198. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "LanguageServiceNoLS", function() { return LanguageServiceNoLS; });
  51199. var LanguageServiceNoLS = /** @class */ (function () {
  51200. function LanguageServiceNoLS(lang) {
  51201. this.lang = lang;
  51202. this.listeners = [];
  51203. }
  51204. LanguageServiceNoLS.prototype.setupListener = function () { };
  51205. LanguageServiceNoLS.prototype.notifyChange = function () {
  51206. this.listeners.forEach(function (l) { return l(); });
  51207. };
  51208. LanguageServiceNoLS.prototype.setLang = function (lang) {
  51209. this.lang = lang;
  51210. this.notifyChange();
  51211. };
  51212. LanguageServiceNoLS.prototype.getLang = function () {
  51213. return this.lang;
  51214. };
  51215. LanguageServiceNoLS.prototype.getDefaultLang = function () {
  51216. return this.lang;
  51217. };
  51218. LanguageServiceNoLS.prototype.registerLanguageChangeListener = function (listener) {
  51219. this.listeners.push(listener);
  51220. };
  51221. return LanguageServiceNoLS;
  51222. }());
  51223. /***/ }),
  51224. /***/ "./node_modules/line-i18n/dist/LocalizedStrings.js":
  51225. /*!*********************************************************!*\
  51226. !*** ./node_modules/line-i18n/dist/LocalizedStrings.js ***!
  51227. \*********************************************************/
  51228. /*! exports provided: LocalizedStrings */
  51229. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  51230. "use strict";
  51231. __webpack_require__.r(__webpack_exports__);
  51232. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "LocalizedStrings", function() { return LocalizedStrings; });
  51233. /* harmony import */ var _StringTypes__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./StringTypes */ "./node_modules/line-i18n/dist/StringTypes.js");
  51234. var LocalizedStrings = /** @class */ (function () {
  51235. function LocalizedStrings(service, i18nData, listenToChange) {
  51236. if (listenToChange === void 0) { listenToChange = false; }
  51237. var _this = this;
  51238. this.service = service;
  51239. this.i18nData = i18nData;
  51240. this.listenToChange = listenToChange;
  51241. this.document = document;
  51242. if (this.listenToChange) {
  51243. service.registerLanguageChangeListener(function () {
  51244. _this.updateTagText();
  51245. });
  51246. }
  51247. }
  51248. LocalizedStrings.prototype.getString = function (id, type) {
  51249. var i18nObj = this.i18nData[this.service.getLang()];
  51250. if (!!!i18nObj) {
  51251. console.warn("Internal Error. The language set at ivprog.lang is not valid: " + this.service.getLang());
  51252. i18nObj = this.i18nData[this.service.getDefaultLang()];
  51253. }
  51254. if (!!!i18nObj[type]) {
  51255. return "{MISSING_I18N_TYPE_IDENTIFIER}";
  51256. }
  51257. else if (!!!i18nObj[type][id]) {
  51258. return "{MISSING_I18N_IDENTIFIER}";
  51259. }
  51260. else {
  51261. return i18nObj[type][id];
  51262. }
  51263. };
  51264. LocalizedStrings.prototype.getOR = function () {
  51265. return this.getUI('join_or');
  51266. };
  51267. LocalizedStrings.prototype.getError = function (id, context) {
  51268. if (context === void 0) { context = []; }
  51269. var text = this.getString(id, _StringTypes__WEBPACK_IMPORTED_MODULE_0__["StringTypes"].ERROR);
  51270. return this.processString(text, context);
  51271. };
  51272. LocalizedStrings.prototype.getMessage = function (id, context) {
  51273. if (context === void 0) { context = []; }
  51274. var text = this.getString(id, _StringTypes__WEBPACK_IMPORTED_MODULE_0__["StringTypes"].MESSAGE);
  51275. return this.processString(text, context);
  51276. };
  51277. LocalizedStrings.prototype.getUI = function (id, context) {
  51278. if (context === void 0) { context = []; }
  51279. var text = this.getString(id, _StringTypes__WEBPACK_IMPORTED_MODULE_0__["StringTypes"].UI);
  51280. return this.processString(text, context);
  51281. };
  51282. LocalizedStrings.prototype.processString = function (text, context) {
  51283. for (var i = 0; i < context.length; i++) {
  51284. var v = context[i];
  51285. text = text.replace('\$' + i, v);
  51286. }
  51287. return text;
  51288. };
  51289. LocalizedStrings.prototype.updateTagText = function (func) {
  51290. var _this = this;
  51291. if (func === void 0) { func = null; }
  51292. if (this.document !== null) {
  51293. var list = this.document.querySelectorAll("data.i18n");
  51294. list.forEach(function (node) {
  51295. if (func === null) {
  51296. node.innerHTML = _this.processTagTex(node.getAttribute("value"));
  51297. }
  51298. else {
  51299. node.innerHTML = func(node.getAttribute("value"));
  51300. }
  51301. });
  51302. }
  51303. };
  51304. LocalizedStrings.prototype.processTagTex = function (text) {
  51305. if (text === null) {
  51306. return "<Invalid i18n identifier>";
  51307. }
  51308. var opts = text.split(':');
  51309. var type = opts[0].toLowerCase();
  51310. var id = opts[1];
  51311. if (_StringTypes__WEBPACK_IMPORTED_MODULE_0__["StringTypes"].ERROR === type) {
  51312. return this.getError(id);
  51313. }
  51314. else if (_StringTypes__WEBPACK_IMPORTED_MODULE_0__["StringTypes"].MESSAGE === type) {
  51315. return this.getMessage(id);
  51316. }
  51317. else if (_StringTypes__WEBPACK_IMPORTED_MODULE_0__["StringTypes"].UI === type) {
  51318. return this.getUI(id);
  51319. }
  51320. else {
  51321. console.warn(" A string has been passed to the i18n helper function that was not in the form type:id -> " + text);
  51322. return this.getString(id, type);
  51323. }
  51324. };
  51325. return LocalizedStrings;
  51326. }());
  51327. /***/ }),
  51328. /***/ "./node_modules/line-i18n/dist/StringTypes.js":
  51329. /*!****************************************************!*\
  51330. !*** ./node_modules/line-i18n/dist/StringTypes.js ***!
  51331. \****************************************************/
  51332. /*! exports provided: StringTypes */
  51333. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  51334. "use strict";
  51335. __webpack_require__.r(__webpack_exports__);
  51336. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "StringTypes", function() { return StringTypes; });
  51337. var StringTypes;
  51338. (function (StringTypes) {
  51339. StringTypes["ERROR"] = "error";
  51340. StringTypes["MESSAGE"] = "message";
  51341. StringTypes["UI"] = "ui";
  51342. })(StringTypes || (StringTypes = {}));
  51343. /***/ }),
  51344. /***/ "./node_modules/line-i18n/dist/index.js":
  51345. /*!**********************************************!*\
  51346. !*** ./node_modules/line-i18n/dist/index.js ***!
  51347. \**********************************************/
  51348. /*! exports provided: default */
  51349. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  51350. "use strict";
  51351. __webpack_require__.r(__webpack_exports__);
  51352. /* harmony import */ var _LanguageService__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./LanguageService */ "./node_modules/line-i18n/dist/LanguageService.js");
  51353. /* harmony import */ var _LocalizedStrings__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./LocalizedStrings */ "./node_modules/line-i18n/dist/LocalizedStrings.js");
  51354. /* harmony import */ var _StringTypes__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./StringTypes */ "./node_modules/line-i18n/dist/StringTypes.js");
  51355. /* harmony import */ var _LanguageServiceNoLS__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./LanguageServiceNoLS */ "./node_modules/line-i18n/dist/LanguageServiceNoLS.js");
  51356. /* harmony default export */ __webpack_exports__["default"] = ({
  51357. LanguageService: _LanguageService__WEBPACK_IMPORTED_MODULE_0__["LanguageService"],
  51358. LanguageServiceNoLS: _LanguageServiceNoLS__WEBPACK_IMPORTED_MODULE_3__["LanguageServiceNoLS"],
  51359. LocalizedStrings: _LocalizedStrings__WEBPACK_IMPORTED_MODULE_1__["LocalizedStrings"],
  51360. StringTypes: _StringTypes__WEBPACK_IMPORTED_MODULE_2__["StringTypes"]
  51361. });
  51362. /***/ }),
  51363. /***/ "./node_modules/melanke-watchjs/src/watch.js":
  51364. /*!***************************************************!*\
  51365. !*** ./node_modules/melanke-watchjs/src/watch.js ***!
  51366. \***************************************************/
  51367. /*! no static exports found */
  51368. /***/ (function(module, exports, __webpack_require__) {
  51369. "use strict";
  51370. /**
  51371. * DEVELOPED BY
  51372. * GIL LOPES BUENO
  51373. * gilbueno.mail@gmail.com
  51374. *
  51375. * WORKS WITH:
  51376. * IE8*, IE 9+, FF 4+, SF 5+, WebKit, CH 7+, OP 12+, BESEN, Rhino 1.7+
  51377. * For IE8 (and other legacy browsers) WatchJS will use dirty checking
  51378. *
  51379. * FORK:
  51380. * https://github.com/melanke/Watch.JS
  51381. *
  51382. * LICENSE: MIT
  51383. */
  51384. (function (factory) {
  51385. if (true) {
  51386. // Node. Does not work with strict CommonJS, but
  51387. // only CommonJS-like enviroments that support module.exports,
  51388. // like Node.
  51389. module.exports = factory();
  51390. } else {}
  51391. }(function () {
  51392. var WatchJS = {
  51393. noMore: false, // use WatchJS.suspend(obj) instead
  51394. useDirtyCheck: false, // use only dirty checking to track changes.
  51395. preserveExistingSetters: false
  51396. },
  51397. lengthsubjects = [];
  51398. var dirtyChecklist = [];
  51399. var pendingChanges = []; // used coalesce changes from defineProperty and __defineSetter__
  51400. var supportDefineProperty = false;
  51401. try {
  51402. supportDefineProperty = Object.defineProperty && Object.defineProperty({},'x', {});
  51403. } catch(ex) { /* not supported */ }
  51404. var isFunction = function (functionToCheck) {
  51405. var getType = {};
  51406. return functionToCheck && getType.toString.call(functionToCheck) == '[object Function]';
  51407. };
  51408. var isInt = function (x) {
  51409. return x % 1 === 0;
  51410. };
  51411. var isArray = function(obj) {
  51412. return Object.prototype.toString.call(obj) === '[object Array]';
  51413. };
  51414. var isObject = function(obj) {
  51415. return {}.toString.apply(obj) === '[object Object]';
  51416. };
  51417. var getObjDiff = function(a, b){
  51418. var aplus = [],
  51419. bplus = [];
  51420. if(!(typeof a == "string") && !(typeof b == "string")){
  51421. if (isArray(a) && b) {
  51422. for (var i=0; i<a.length; i++) {
  51423. if (b[i] === undefined) aplus.push(i);
  51424. }
  51425. } else {
  51426. for(var i in a){
  51427. if (a.hasOwnProperty(i)) {
  51428. if(b && !b.hasOwnProperty(i)) {
  51429. aplus.push(i);
  51430. }
  51431. }
  51432. }
  51433. }
  51434. if (isArray(b) && a) {
  51435. for (var j=0; j<b.length; j++) {
  51436. if (a[j] === undefined) bplus.push(j);
  51437. }
  51438. } else {
  51439. for(var j in b){
  51440. if (b.hasOwnProperty(j)) {
  51441. if(a && !a.hasOwnProperty(j)) {
  51442. bplus.push(j);
  51443. }
  51444. }
  51445. }
  51446. }
  51447. }
  51448. return {
  51449. added: aplus,
  51450. removed: bplus
  51451. }
  51452. };
  51453. var clone = function(obj){
  51454. if (null == obj || "object" != typeof obj) {
  51455. return obj;
  51456. }
  51457. var copy = obj.constructor();
  51458. for (var attr in obj) {
  51459. copy[attr] = obj[attr];
  51460. }
  51461. return copy;
  51462. }
  51463. var getExistingSetter = function (obj, propName) {
  51464. if (WatchJS.preserveExistingSetters) {
  51465. var existing = Object.getOwnPropertyDescriptor(obj, propName);
  51466. return existing.set;
  51467. }
  51468. return undefined;
  51469. }
  51470. var defineGetAndSet = function (obj, propName, getter, setter) {
  51471. try {
  51472. var existingSetter = getExistingSetter(obj, propName);
  51473. Object.defineProperty(obj, propName, {
  51474. get: getter,
  51475. set: function(value) {
  51476. setter.call(this, value, true); // coalesce changes
  51477. if (existingSetter) {
  51478. existingSetter(value);
  51479. }
  51480. },
  51481. enumerable: true,
  51482. configurable: true
  51483. });
  51484. }
  51485. catch(e1) {
  51486. try{
  51487. Object.prototype.__defineGetter__.call(obj, propName, getter);
  51488. Object.prototype.__defineSetter__.call(obj, propName, function(value) {
  51489. setter.call(this,value,true); // coalesce changes
  51490. });
  51491. }
  51492. catch(e2) {
  51493. observeDirtyChanges(obj,propName,setter);
  51494. //throw new Error("watchJS error: browser not supported :/")
  51495. }
  51496. }
  51497. };
  51498. var defineProp = function (obj, propName, value) {
  51499. try {
  51500. Object.defineProperty(obj, propName, {
  51501. enumerable: false,
  51502. configurable: true,
  51503. writable: false,
  51504. value: value
  51505. });
  51506. } catch(error) {
  51507. obj[propName] = value;
  51508. }
  51509. };
  51510. var observeDirtyChanges = function(obj,propName,setter) {
  51511. dirtyChecklist[dirtyChecklist.length] = {
  51512. prop: propName,
  51513. object: obj,
  51514. orig: clone(obj[propName]),
  51515. callback: setter
  51516. }
  51517. }
  51518. var watch = function () {
  51519. if (isFunction(arguments[1])) {
  51520. watchAll.apply(this, arguments);
  51521. } else if (isArray(arguments[1])) {
  51522. watchMany.apply(this, arguments);
  51523. } else {
  51524. watchOne.apply(this, arguments);
  51525. }
  51526. };
  51527. var watchAll = function (obj, watcher, level, addNRemove) {
  51528. if ((typeof obj == "string") || (!(obj instanceof Object) && !isArray(obj))) { //accepts only objects and array (not string)
  51529. return;
  51530. }
  51531. if(isArray(obj)) {
  51532. defineWatcher(obj, "__watchall__", watcher, level); // watch all changes on the array
  51533. if (level===undefined||level > 0) {
  51534. for (var prop = 0; prop < obj.length; prop++) { // watch objects in array
  51535. watchAll(obj[prop],watcher,level, addNRemove);
  51536. }
  51537. }
  51538. }
  51539. else {
  51540. var prop,props = [];
  51541. for (prop in obj) { //for each attribute if obj is an object
  51542. if (prop == "$val" || (!supportDefineProperty && prop === 'watchers')) {
  51543. continue;
  51544. }
  51545. if (Object.prototype.hasOwnProperty.call(obj, prop)) {
  51546. props.push(prop); //put in the props
  51547. }
  51548. }
  51549. watchMany(obj, props, watcher, level, addNRemove); //watch all items of the props
  51550. }
  51551. if (addNRemove) {
  51552. pushToLengthSubjects(obj, "$$watchlengthsubjectroot", watcher, level);
  51553. }
  51554. };
  51555. var watchMany = function (obj, props, watcher, level, addNRemove) {
  51556. if ((typeof obj == "string") || (!(obj instanceof Object) && !isArray(obj))) { //accepts only objects and array (not string)
  51557. return;
  51558. }
  51559. for (var i=0; i<props.length; i++) { //watch each property
  51560. var prop = props[i];
  51561. watchOne(obj, prop, watcher, level, addNRemove);
  51562. }
  51563. };
  51564. var watchOne = function (obj, prop, watcher, level, addNRemove) {
  51565. if ((typeof obj == "string") || (!(obj instanceof Object) && !isArray(obj))) { //accepts only objects and array (not string)
  51566. return;
  51567. }
  51568. if(isFunction(obj[prop])) { //dont watch if it is a function
  51569. return;
  51570. }
  51571. if(obj[prop] != null && (level === undefined || level > 0)){
  51572. watchAll(obj[prop], watcher, level!==undefined? level-1 : level); //recursively watch all attributes of this
  51573. }
  51574. defineWatcher(obj, prop, watcher, level);
  51575. if(addNRemove && (level === undefined || level > 0)){
  51576. pushToLengthSubjects(obj, prop, watcher, level);
  51577. }
  51578. };
  51579. var unwatch = function () {
  51580. if (isFunction(arguments[1])) {
  51581. unwatchAll.apply(this, arguments);
  51582. } else if (isArray(arguments[1])) {
  51583. unwatchMany.apply(this, arguments);
  51584. } else {
  51585. unwatchOne.apply(this, arguments);
  51586. }
  51587. };
  51588. var unwatchAll = function (obj, watcher) {
  51589. if (obj instanceof String || (!(obj instanceof Object) && !isArray(obj))) { //accepts only objects and array (not string)
  51590. return;
  51591. }
  51592. if (isArray(obj)) {
  51593. var props = ['__watchall__'];
  51594. for (var prop = 0; prop < obj.length; prop++) { //for each item if obj is an array
  51595. props.push(prop); //put in the props
  51596. }
  51597. unwatchMany(obj, props, watcher); //watch all itens of the props
  51598. } else {
  51599. var unwatchPropsInObject = function (obj2) {
  51600. var props = [];
  51601. for (var prop2 in obj2) { //for each attribute if obj is an object
  51602. if (obj2.hasOwnProperty(prop2)) {
  51603. if (obj2[prop2] instanceof Object) {
  51604. unwatchPropsInObject(obj2[prop2]); //recurs into object props
  51605. } else {
  51606. props.push(prop2); //put in the props
  51607. }
  51608. }
  51609. }
  51610. unwatchMany(obj2, props, watcher); //unwatch all of the props
  51611. };
  51612. unwatchPropsInObject(obj);
  51613. }
  51614. };
  51615. var unwatchMany = function (obj, props, watcher) {
  51616. for (var prop2 in props) { //watch each attribute of "props" if is an object
  51617. if (props.hasOwnProperty(prop2)) {
  51618. unwatchOne(obj, props[prop2], watcher);
  51619. }
  51620. }
  51621. };
  51622. var timeouts = [],
  51623. timerID = null;
  51624. function clearTimerID() {
  51625. timerID = null;
  51626. for(var i=0; i< timeouts.length; i++) {
  51627. timeouts[i]();
  51628. }
  51629. timeouts.length = 0;
  51630. }
  51631. var getTimerID= function () {
  51632. if (!timerID) {
  51633. timerID = setTimeout(clearTimerID);
  51634. }
  51635. return timerID;
  51636. }
  51637. var registerTimeout = function(fn) { // register function to be called on timeout
  51638. if (timerID==null) getTimerID();
  51639. timeouts[timeouts.length] = fn;
  51640. }
  51641. // Track changes made to an array, object or an object's property
  51642. // and invoke callback with a single change object containing type, value, oldvalue and array splices
  51643. // Syntax:
  51644. // trackChange(obj, callback, recursive, addNRemove)
  51645. // trackChange(obj, prop, callback, recursive, addNRemove)
  51646. var trackChange = function() {
  51647. var fn = (isFunction(arguments[2])) ? trackProperty : trackObject ;
  51648. fn.apply(this,arguments);
  51649. }
  51650. // track changes made to an object and invoke callback with a single change object containing type, value and array splices
  51651. var trackObject= function(obj, callback, recursive, addNRemove) {
  51652. var change = null,lastTimerID = -1;
  51653. var isArr = isArray(obj);
  51654. var level,fn = function(prop, action, newValue, oldValue) {
  51655. var timerID = getTimerID();
  51656. if (lastTimerID!==timerID) { // check if timer has changed since last update
  51657. lastTimerID = timerID;
  51658. change = {
  51659. type: 'update'
  51660. }
  51661. change['value'] = obj;
  51662. change['splices'] = null;
  51663. registerTimeout(function() {
  51664. callback.call(this,change);
  51665. change = null;
  51666. });
  51667. }
  51668. // create splices for array changes
  51669. if (isArr && obj === this && change !== null) {
  51670. if (action==='pop'||action==='shift') {
  51671. newValue = [];
  51672. oldValue = [oldValue];
  51673. }
  51674. else if (action==='push'||action==='unshift') {
  51675. newValue = [newValue];
  51676. oldValue = [];
  51677. }
  51678. else if (action!=='splice') {
  51679. return; // return here - for reverse and sort operations we don't need to return splices. a simple update will do
  51680. }
  51681. if (!change.splices) change.splices = [];
  51682. change.splices[change.splices.length] = {
  51683. index: prop,
  51684. deleteCount: oldValue ? oldValue.length : 0,
  51685. addedCount: newValue ? newValue.length : 0,
  51686. added: newValue,
  51687. deleted: oldValue
  51688. };
  51689. }
  51690. }
  51691. level = (recursive==true) ? undefined : 0;
  51692. watchAll(obj,fn, level, addNRemove);
  51693. }
  51694. // track changes made to the property of an object and invoke callback with a single change object containing type, value, oldvalue and splices
  51695. var trackProperty = function(obj,prop,callback,recursive, addNRemove) {
  51696. if (obj && prop) {
  51697. watchOne(obj,prop,function(prop, action, newvalue, oldvalue) {
  51698. var change = {
  51699. type: 'update'
  51700. }
  51701. change['value'] = newvalue;
  51702. change['oldvalue'] = oldvalue;
  51703. if (recursive && isObject(newvalue)||isArray(newvalue)) {
  51704. trackObject(newvalue,callback,recursive, addNRemove);
  51705. }
  51706. callback.call(this,change);
  51707. },0)
  51708. if (recursive && isObject(obj[prop])||isArray(obj[prop])) {
  51709. trackObject(obj[prop],callback,recursive, addNRemove);
  51710. }
  51711. }
  51712. }
  51713. var defineWatcher = function (obj, prop, watcher, level) {
  51714. var newWatcher = false;
  51715. var isArr = isArray(obj);
  51716. if (!obj.watchers) {
  51717. defineProp(obj, "watchers", {});
  51718. if (isArr) {
  51719. // watch array functions
  51720. watchFunctions(obj, function(index,action,newValue, oldValue) {
  51721. addPendingChange(obj, index, action,newValue, oldValue);
  51722. if (level !== 0 && newValue && (isObject(newValue) || isArray(newValue))) {
  51723. var i,n, ln, wAll, watchList = obj.watchers[prop];
  51724. if ((wAll = obj.watchers['__watchall__'])) {
  51725. watchList = watchList ? watchList.concat(wAll) : wAll;
  51726. }
  51727. ln = watchList ? watchList.length : 0;
  51728. for (i = 0; i<ln; i++) {
  51729. if (action!=='splice') {
  51730. watchAll(newValue, watchList[i], (level===undefined)?level:level-1);
  51731. }
  51732. else {
  51733. // watch spliced values
  51734. for(n=0; n < newValue.length; n++) {
  51735. watchAll(newValue[n], watchList[i], (level===undefined)?level:level-1);
  51736. }
  51737. }
  51738. }
  51739. }
  51740. });
  51741. }
  51742. }
  51743. if (!obj.watchers[prop]) {
  51744. obj.watchers[prop] = [];
  51745. if (!isArr) newWatcher = true;
  51746. }
  51747. for (var i=0; i<obj.watchers[prop].length; i++) {
  51748. if(obj.watchers[prop][i] === watcher){
  51749. return;
  51750. }
  51751. }
  51752. obj.watchers[prop].push(watcher); //add the new watcher to the watchers array
  51753. if (newWatcher) {
  51754. var val = obj[prop];
  51755. var getter = function () {
  51756. return val;
  51757. };
  51758. var setter = function (newval, delayWatcher) {
  51759. var oldval = val;
  51760. val = newval;
  51761. if (level !== 0
  51762. && obj[prop] && (isObject(obj[prop]) || isArray(obj[prop]))
  51763. && !obj[prop].watchers) {
  51764. // watch sub properties
  51765. var i,ln = obj.watchers[prop].length;
  51766. for(i=0; i<ln; i++) {
  51767. watchAll(obj[prop], obj.watchers[prop][i], (level===undefined)?level:level-1);
  51768. }
  51769. }
  51770. //watchFunctions(obj, prop);
  51771. if (isSuspended(obj, prop)) {
  51772. resume(obj, prop);
  51773. return;
  51774. }
  51775. if (!WatchJS.noMore){ // this does not work with Object.observe
  51776. //if (JSON.stringify(oldval) !== JSON.stringify(newval)) {
  51777. if (oldval !== newval) {
  51778. if (!delayWatcher) {
  51779. callWatchers(obj, prop, "set", newval, oldval);
  51780. }
  51781. else {
  51782. addPendingChange(obj, prop, "set", newval, oldval);
  51783. }
  51784. WatchJS.noMore = false;
  51785. }
  51786. }
  51787. };
  51788. if (WatchJS.useDirtyCheck) {
  51789. observeDirtyChanges(obj,prop,setter);
  51790. }
  51791. else {
  51792. defineGetAndSet(obj, prop, getter, setter);
  51793. }
  51794. }
  51795. };
  51796. var callWatchers = function (obj, prop, action, newval, oldval) {
  51797. if (prop !== undefined) {
  51798. var ln, wl, watchList = obj.watchers[prop];
  51799. if ((wl = obj.watchers['__watchall__'])) {
  51800. watchList = watchList ? watchList.concat(wl) : wl;
  51801. }
  51802. ln = watchList ? watchList.length : 0;
  51803. for (var wr=0; wr< ln; wr++) {
  51804. watchList[wr].call(obj, prop, action, newval, oldval);
  51805. }
  51806. } else {
  51807. for (var prop in obj) {//call all
  51808. if (obj.hasOwnProperty(prop)) {
  51809. callWatchers(obj, prop, action, newval, oldval);
  51810. }
  51811. }
  51812. }
  51813. };
  51814. var methodNames = ['pop', 'push', 'reverse', 'shift', 'sort', 'slice', 'unshift', 'splice'];
  51815. var defineArrayMethodWatcher = function (obj, original, methodName, callback) {
  51816. defineProp(obj, methodName, function () {
  51817. var index = 0;
  51818. var i,newValue, oldValue, response;
  51819. // get values before splicing array
  51820. if (methodName === 'splice') {
  51821. var start = arguments[0];
  51822. var end = start + arguments[1];
  51823. oldValue = obj.slice(start,end);
  51824. newValue = [];
  51825. for(i=2;i<arguments.length;i++) {
  51826. newValue[i-2] = arguments[i];
  51827. }
  51828. index = start;
  51829. }
  51830. else {
  51831. newValue = arguments.length > 0 ? arguments[0] : undefined;
  51832. }
  51833. response = original.apply(obj, arguments);
  51834. if (methodName !== 'slice') {
  51835. if (methodName === 'pop') {
  51836. oldValue = response;
  51837. index = obj.length;
  51838. }
  51839. else if (methodName === 'push') {
  51840. index = obj.length-1;
  51841. }
  51842. else if (methodName === 'shift') {
  51843. oldValue = response;
  51844. }
  51845. else if (methodName !== 'unshift' && newValue===undefined) {
  51846. newValue = response;
  51847. }
  51848. callback.call(obj, index, methodName,newValue, oldValue)
  51849. }
  51850. return response;
  51851. });
  51852. };
  51853. var watchFunctions = function(obj, callback) {
  51854. if (!isFunction(callback) || !obj || (obj instanceof String) || (!isArray(obj))) {
  51855. return;
  51856. }
  51857. for (var i = methodNames.length, methodName; i--;) {
  51858. methodName = methodNames[i];
  51859. defineArrayMethodWatcher(obj, obj[methodName], methodName, callback);
  51860. }
  51861. };
  51862. var unwatchOne = function (obj, prop, watcher) {
  51863. if (prop) {
  51864. if (obj.watchers && obj.watchers[prop]) {
  51865. if (watcher === undefined) {
  51866. delete obj.watchers[prop]; // remove all property watchers
  51867. }
  51868. else {
  51869. for (var i = 0; i < obj.watchers[prop].length; i++) {
  51870. var w = obj.watchers[prop][i];
  51871. if (w == watcher) {
  51872. obj.watchers[prop].splice(i, 1);
  51873. }
  51874. }
  51875. }
  51876. }
  51877. } else {
  51878. delete obj.watchers;
  51879. }
  51880. removeFromLengthSubjects(obj, prop, watcher);
  51881. removeFromDirtyChecklist(obj, prop);
  51882. };
  51883. // suspend watchers until next update cycle
  51884. var suspend = function(obj, prop) {
  51885. if (obj.watchers) {
  51886. var name = '__wjs_suspend__'+(prop!==undefined ? prop : '');
  51887. obj.watchers[name] = true;
  51888. }
  51889. }
  51890. var isSuspended = function(obj, prop) {
  51891. return obj.watchers
  51892. && (obj.watchers['__wjs_suspend__'] ||
  51893. obj.watchers['__wjs_suspend__'+prop]);
  51894. }
  51895. // resumes preivously suspended watchers
  51896. var resume = function(obj, prop) {
  51897. registerTimeout(function() {
  51898. delete obj.watchers['__wjs_suspend__'];
  51899. delete obj.watchers['__wjs_suspend__'+prop];
  51900. })
  51901. }
  51902. var pendingTimerID = null;
  51903. var addPendingChange = function(obj,prop, mode, newval, oldval) {
  51904. pendingChanges[pendingChanges.length] = {
  51905. obj:obj,
  51906. prop: prop,
  51907. mode: mode,
  51908. newval: newval,
  51909. oldval: oldval
  51910. };
  51911. if (pendingTimerID===null) {
  51912. pendingTimerID = setTimeout(applyPendingChanges);
  51913. }
  51914. };
  51915. var applyPendingChanges = function() {
  51916. // apply pending changes
  51917. var change = null;
  51918. pendingTimerID = null;
  51919. for(var i=0;i < pendingChanges.length;i++) {
  51920. change = pendingChanges[i];
  51921. callWatchers(change.obj, change.prop, change.mode, change.newval, change.oldval);
  51922. }
  51923. if (change) {
  51924. pendingChanges = [];
  51925. change = null;
  51926. }
  51927. }
  51928. var loop = function(){
  51929. // check for new or deleted props
  51930. for(var i=0; i<lengthsubjects.length; i++) {
  51931. var subj = lengthsubjects[i];
  51932. if (subj.prop === "$$watchlengthsubjectroot") {
  51933. var difference = getObjDiff(subj.obj, subj.actual);
  51934. if(difference.added.length || difference.removed.length){
  51935. if(difference.added.length){
  51936. watchMany(subj.obj, difference.added, subj.watcher, subj.level - 1, true);
  51937. }
  51938. subj.watcher.call(subj.obj, "root", "differentattr", difference, subj.actual);
  51939. }
  51940. subj.actual = clone(subj.obj);
  51941. } else {
  51942. var difference = getObjDiff(subj.obj[subj.prop], subj.actual);
  51943. if(difference.added.length || difference.removed.length){
  51944. if(difference.added.length){
  51945. for (var j=0; j<subj.obj.watchers[subj.prop].length; j++) {
  51946. watchMany(subj.obj[subj.prop], difference.added, subj.obj.watchers[subj.prop][j], subj.level - 1, true);
  51947. }
  51948. }
  51949. callWatchers(subj.obj, subj.prop, "differentattr", difference, subj.actual);
  51950. }
  51951. subj.actual = clone(subj.obj[subj.prop]);
  51952. }
  51953. }
  51954. // start dirty check
  51955. var n, value;
  51956. if (dirtyChecklist.length > 0) {
  51957. for (var i = 0; i < dirtyChecklist.length; i++) {
  51958. n = dirtyChecklist[i];
  51959. value = n.object[n.prop];
  51960. if (!compareValues(n.orig, value)) {
  51961. n.orig = clone(value);
  51962. n.callback(value);
  51963. }
  51964. }
  51965. }
  51966. };
  51967. var compareValues = function(a,b) {
  51968. var i, state = true;
  51969. if (a!==b) {
  51970. if (isObject(a)) {
  51971. for(i in a) {
  51972. if (!supportDefineProperty && i==='watchers') continue;
  51973. if (a[i]!==b[i]) {
  51974. state = false;
  51975. break;
  51976. };
  51977. }
  51978. }
  51979. else {
  51980. state = false;
  51981. }
  51982. }
  51983. return state;
  51984. }
  51985. var pushToLengthSubjects = function(obj, prop, watcher, level){
  51986. var actual;
  51987. if (prop === "$$watchlengthsubjectroot") {
  51988. actual = clone(obj);
  51989. } else {
  51990. actual = clone(obj[prop]);
  51991. }
  51992. lengthsubjects.push({
  51993. obj: obj,
  51994. prop: prop,
  51995. actual: actual,
  51996. watcher: watcher,
  51997. level: level
  51998. });
  51999. };
  52000. var removeFromLengthSubjects = function(obj, prop, watcher){
  52001. for (var i=0; i<lengthsubjects.length; i++) {
  52002. var subj = lengthsubjects[i];
  52003. if (subj.obj == obj) {
  52004. if (!prop || subj.prop == prop) {
  52005. if (!watcher || subj.watcher == watcher) {
  52006. // if we splice off one item at position i
  52007. // we need to decrement i as the array is one item shorter
  52008. // so when we increment i in the loop statement we
  52009. // will land at the correct index.
  52010. // if it's not decremented, you won't delete all length subjects
  52011. lengthsubjects.splice(i--, 1);
  52012. }
  52013. }
  52014. }
  52015. }
  52016. };
  52017. var removeFromDirtyChecklist = function(obj, prop){
  52018. var notInUse;
  52019. for (var i=0; i<dirtyChecklist.length; i++) {
  52020. var n = dirtyChecklist[i];
  52021. var watchers = n.object.watchers;
  52022. notInUse = (
  52023. n.object == obj
  52024. && (!prop || n.prop == prop)
  52025. && watchers
  52026. && (!prop || !watchers[prop] || watchers[prop].length == 0 )
  52027. );
  52028. if (notInUse) {
  52029. // we use the same syntax as in removeFromLengthSubjects
  52030. dirtyChecklist.splice(i--, 1);
  52031. }
  52032. }
  52033. };
  52034. setInterval(loop, 50);
  52035. WatchJS.watch = watch;
  52036. WatchJS.unwatch = unwatch;
  52037. WatchJS.callWatchers = callWatchers;
  52038. WatchJS.suspend = suspend; // suspend watchers
  52039. WatchJS.onChange = trackChange; // track changes made to object or it's property and return a single change object
  52040. return WatchJS;
  52041. }));
  52042. /***/ }),
  52043. /***/ "./node_modules/node-libs-browser/mock/empty.js":
  52044. /*!******************************************************!*\
  52045. !*** ./node_modules/node-libs-browser/mock/empty.js ***!
  52046. \******************************************************/
  52047. /*! no static exports found */
  52048. /***/ (function(module, exports) {
  52049. /***/ })
  52050. /******/ });
  52051. });
  52052. //# sourceMappingURL=ivprog.bundle.js.map