ivprog.bundle.js 2.0 MB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350123511235212353123541235512356123571235812359123601236112362123631236412365123661236712368123691237012371123721237312374123751237612377123781237912380123811238212383123841238512386123871238812389123901239112392123931239412395123961239712398123991240012401124021240312404124051240612407124081240912410124111241212413124141241512416124171241812419124201242112422124231242412425124261242712428124291243012431124321243312434124351243612437124381243912440124411244212443124441244512446124471244812449124501245112452124531245412455124561245712458124591246012461124621246312464124651246612467124681246912470124711247212473124741247512476124771247812479124801248112482124831248412485124861248712488124891249012491124921249312494124951249612497124981249912500125011250212503125041250512506125071250812509125101251112512125131251412515125161251712518125191252012521125221252312524125251252612527125281252912530125311253212533125341253512536125371253812539125401254112542125431254412545125461254712548125491255012551125521255312554125551255612557125581255912560125611256212563125641256512566125671256812569125701257112572125731257412575125761257712578125791258012581125821258312584125851258612587125881258912590125911259212593125941259512596125971259812599126001260112602126031260412605126061260712608126091261012611126121261312614126151261612617126181261912620126211262212623126241262512626126271262812629126301263112632126331263412635126361263712638126391264012641126421264312644126451264612647126481264912650126511265212653126541265512656126571265812659126601266112662126631266412665126661266712668126691267012671126721267312674126751267612677126781267912680126811268212683126841268512686126871268812689126901269112692126931269412695126961269712698126991270012701127021270312704127051270612707127081270912710127111271212713127141271512716127171271812719127201272112722127231272412725127261272712728127291273012731127321273312734127351273612737127381273912740127411274212743127441274512746127471274812749127501275112752127531275412755127561275712758127591276012761127621276312764127651276612767127681276912770127711277212773127741277512776127771277812779127801278112782127831278412785127861278712788127891279012791127921279312794127951279612797127981279912800128011280212803128041280512806128071280812809128101281112812128131281412815128161281712818128191282012821128221282312824128251282612827128281282912830128311283212833128341283512836128371283812839128401284112842128431284412845128461284712848128491285012851128521285312854128551285612857128581285912860128611286212863128641286512866128671286812869128701287112872128731287412875128761287712878128791288012881128821288312884128851288612887128881288912890128911289212893128941289512896128971289812899129001290112902129031290412905129061290712908129091291012911129121291312914129151291612917129181291912920129211292212923129241292512926129271292812929129301293112932129331293412935129361293712938129391294012941129421294312944129451294612947129481294912950129511295212953129541295512956129571295812959129601296112962129631296412965129661296712968129691297012971129721297312974129751297612977129781297912980129811298212983129841298512986129871298812989129901299112992129931299412995129961299712998129991300013001130021300313004130051300613007130081300913010130111301213013130141301513016130171301813019130201302113022130231302413025130261302713028130291303013031130321303313034130351303613037130381303913040130411304213043130441304513046130471304813049130501305113052130531305413055130561305713058130591306013061130621306313064130651306613067130681306913070130711307213073130741307513076130771307813079130801308113082130831308413085130861308713088130891309013091130921309313094130951309613097130981309913100131011310213103131041310513106131071310813109131101311113112131131311413115131161311713118131191312013121131221312313124131251312613127131281312913130131311313213133131341313513136131371313813139131401314113142131431314413145131461314713148131491315013151131521315313154131551315613157131581315913160131611316213163131641316513166131671316813169131701317113172131731317413175131761317713178131791318013181131821318313184131851318613187131881318913190131911319213193131941319513196131971319813199132001320113202132031320413205132061320713208132091321013211132121321313214132151321613217132181321913220132211322213223132241322513226132271322813229132301323113232132331323413235132361323713238132391324013241132421324313244132451324613247132481324913250132511325213253132541325513256132571325813259132601326113262132631326413265132661326713268132691327013271132721327313274132751327613277132781327913280132811328213283132841328513286132871328813289132901329113292132931329413295132961329713298132991330013301133021330313304133051330613307133081330913310133111331213313133141331513316133171331813319133201332113322133231332413325133261332713328133291333013331133321333313334133351333613337133381333913340133411334213343133441334513346133471334813349133501335113352133531335413355133561335713358133591336013361133621336313364133651336613367133681336913370133711337213373133741337513376133771337813379133801338113382133831338413385133861338713388133891339013391133921339313394133951339613397133981339913400134011340213403134041340513406134071340813409134101341113412134131341413415134161341713418134191342013421134221342313424134251342613427134281342913430134311343213433134341343513436134371343813439134401344113442134431344413445134461344713448134491345013451134521345313454134551345613457134581345913460134611346213463134641346513466134671346813469134701347113472134731347413475134761347713478134791348013481134821348313484134851348613487134881348913490134911349213493134941349513496134971349813499135001350113502135031350413505135061350713508135091351013511135121351313514135151351613517135181351913520135211352213523135241352513526135271352813529135301353113532135331353413535135361353713538135391354013541135421354313544135451354613547135481354913550135511355213553135541355513556135571355813559135601356113562135631356413565135661356713568135691357013571135721357313574135751357613577135781357913580135811358213583135841358513586135871358813589135901359113592135931359413595135961359713598135991360013601136021360313604136051360613607136081360913610136111361213613136141361513616136171361813619136201362113622136231362413625136261362713628136291363013631136321363313634136351363613637136381363913640136411364213643136441364513646136471364813649136501365113652136531365413655136561365713658136591366013661136621366313664136651366613667136681366913670136711367213673136741367513676136771367813679136801368113682136831368413685136861368713688136891369013691136921369313694136951369613697136981369913700137011370213703137041370513706137071370813709137101371113712137131371413715137161371713718137191372013721137221372313724137251372613727137281372913730137311373213733137341373513736137371373813739137401374113742137431374413745137461374713748137491375013751137521375313754137551375613757137581375913760137611376213763137641376513766137671376813769137701377113772137731377413775137761377713778137791378013781137821378313784137851378613787137881378913790137911379213793137941379513796137971379813799138001380113802138031380413805138061380713808138091381013811138121381313814138151381613817138181381913820138211382213823138241382513826138271382813829138301383113832138331383413835138361383713838138391384013841138421384313844138451384613847138481384913850138511385213853138541385513856138571385813859138601386113862138631386413865138661386713868138691387013871138721387313874138751387613877138781387913880138811388213883138841388513886138871388813889138901389113892138931389413895138961389713898138991390013901139021390313904139051390613907139081390913910139111391213913139141391513916139171391813919139201392113922139231392413925139261392713928139291393013931139321393313934139351393613937139381393913940139411394213943139441394513946139471394813949139501395113952139531395413955139561395713958139591396013961139621396313964139651396613967139681396913970139711397213973139741397513976139771397813979139801398113982139831398413985139861398713988139891399013991139921399313994139951399613997139981399914000140011400214003140041400514006140071400814009140101401114012140131401414015140161401714018140191402014021140221402314024140251402614027140281402914030140311403214033140341403514036140371403814039140401404114042140431404414045140461404714048140491405014051140521405314054140551405614057140581405914060140611406214063140641406514066140671406814069140701407114072140731407414075140761407714078140791408014081140821408314084140851408614087140881408914090140911409214093140941409514096140971409814099141001410114102141031410414105141061410714108141091411014111141121411314114141151411614117141181411914120141211412214123141241412514126141271412814129141301413114132141331413414135141361413714138141391414014141141421414314144141451414614147141481414914150141511415214153141541415514156141571415814159141601416114162141631416414165141661416714168141691417014171141721417314174141751417614177141781417914180141811418214183141841418514186141871418814189141901419114192141931419414195141961419714198141991420014201142021420314204142051420614207142081420914210142111421214213142141421514216142171421814219142201422114222142231422414225142261422714228142291423014231142321423314234142351423614237142381423914240142411424214243142441424514246142471424814249142501425114252142531425414255142561425714258142591426014261142621426314264142651426614267142681426914270142711427214273142741427514276142771427814279142801428114282142831428414285142861428714288142891429014291142921429314294142951429614297142981429914300143011430214303143041430514306143071430814309143101431114312143131431414315143161431714318143191432014321143221432314324143251432614327143281432914330143311433214333143341433514336143371433814339143401434114342143431434414345143461434714348143491435014351143521435314354143551435614357143581435914360143611436214363143641436514366143671436814369143701437114372143731437414375143761437714378143791438014381143821438314384143851438614387143881438914390143911439214393143941439514396143971439814399144001440114402144031440414405144061440714408144091441014411144121441314414144151441614417144181441914420144211442214423144241442514426144271442814429144301443114432144331443414435144361443714438144391444014441144421444314444144451444614447144481444914450144511445214453144541445514456144571445814459144601446114462144631446414465144661446714468144691447014471144721447314474144751447614477144781447914480144811448214483144841448514486144871448814489144901449114492144931449414495144961449714498144991450014501145021450314504145051450614507145081450914510145111451214513145141451514516145171451814519145201452114522145231452414525145261452714528145291453014531145321453314534145351453614537145381453914540145411454214543145441454514546145471454814549145501455114552145531455414555145561455714558145591456014561145621456314564145651456614567145681456914570145711457214573145741457514576145771457814579145801458114582145831458414585145861458714588145891459014591145921459314594145951459614597145981459914600146011460214603146041460514606146071460814609146101461114612146131461414615146161461714618146191462014621146221462314624146251462614627146281462914630146311463214633146341463514636146371463814639146401464114642146431464414645146461464714648146491465014651146521465314654146551465614657146581465914660146611466214663146641466514666146671466814669146701467114672146731467414675146761467714678146791468014681146821468314684146851468614687146881468914690146911469214693146941469514696146971469814699147001470114702147031470414705147061470714708147091471014711147121471314714147151471614717147181471914720147211472214723147241472514726147271472814729147301473114732147331473414735147361473714738147391474014741147421474314744147451474614747147481474914750147511475214753147541475514756147571475814759147601476114762147631476414765147661476714768147691477014771147721477314774147751477614777147781477914780147811478214783147841478514786147871478814789147901479114792147931479414795147961479714798147991480014801148021480314804148051480614807148081480914810148111481214813148141481514816148171481814819148201482114822148231482414825148261482714828148291483014831148321483314834148351483614837148381483914840148411484214843148441484514846148471484814849148501485114852148531485414855148561485714858148591486014861148621486314864148651486614867148681486914870148711487214873148741487514876148771487814879148801488114882148831488414885148861488714888148891489014891148921489314894148951489614897148981489914900149011490214903149041490514906149071490814909149101491114912149131491414915149161491714918149191492014921149221492314924149251492614927149281492914930149311493214933149341493514936149371493814939149401494114942149431494414945149461494714948149491495014951149521495314954149551495614957149581495914960149611496214963149641496514966149671496814969149701497114972149731497414975149761497714978149791498014981149821498314984149851498614987149881498914990149911499214993149941499514996149971499814999150001500115002150031500415005150061500715008150091501015011150121501315014150151501615017150181501915020150211502215023150241502515026150271502815029150301503115032150331503415035150361503715038150391504015041150421504315044150451504615047150481504915050150511505215053150541505515056150571505815059150601506115062150631506415065150661506715068150691507015071150721507315074150751507615077150781507915080150811508215083150841508515086150871508815089150901509115092150931509415095150961509715098150991510015101151021510315104151051510615107151081510915110151111511215113151141511515116151171511815119151201512115122151231512415125151261512715128151291513015131151321513315134151351513615137151381513915140151411514215143151441514515146151471514815149151501515115152151531515415155151561515715158151591516015161151621516315164151651516615167151681516915170151711517215173151741517515176151771517815179151801518115182151831518415185151861518715188151891519015191151921519315194151951519615197151981519915200152011520215203152041520515206152071520815209152101521115212152131521415215152161521715218152191522015221152221522315224152251522615227152281522915230152311523215233152341523515236152371523815239152401524115242152431524415245152461524715248152491525015251152521525315254152551525615257152581525915260152611526215263152641526515266152671526815269152701527115272152731527415275152761527715278152791528015281152821528315284152851528615287152881528915290152911529215293152941529515296152971529815299153001530115302153031530415305153061530715308153091531015311153121531315314153151531615317153181531915320153211532215323153241532515326153271532815329153301533115332153331533415335153361533715338153391534015341153421534315344153451534615347153481534915350153511535215353153541535515356153571535815359153601536115362153631536415365153661536715368153691537015371153721537315374153751537615377153781537915380153811538215383153841538515386153871538815389153901539115392153931539415395153961539715398153991540015401154021540315404154051540615407154081540915410154111541215413154141541515416154171541815419154201542115422154231542415425154261542715428154291543015431154321543315434154351543615437154381543915440154411544215443154441544515446154471544815449154501545115452154531545415455154561545715458154591546015461154621546315464154651546615467154681546915470154711547215473154741547515476154771547815479154801548115482154831548415485154861548715488154891549015491154921549315494154951549615497154981549915500155011550215503155041550515506155071550815509155101551115512155131551415515155161551715518155191552015521155221552315524155251552615527155281552915530155311553215533155341553515536155371553815539155401554115542155431554415545155461554715548155491555015551155521555315554155551555615557155581555915560155611556215563155641556515566155671556815569155701557115572155731557415575155761557715578155791558015581155821558315584155851558615587155881558915590155911559215593155941559515596155971559815599156001560115602156031560415605156061560715608156091561015611156121561315614156151561615617156181561915620156211562215623156241562515626156271562815629156301563115632156331563415635156361563715638156391564015641156421564315644156451564615647156481564915650156511565215653156541565515656156571565815659156601566115662156631566415665156661566715668156691567015671156721567315674156751567615677156781567915680156811568215683156841568515686156871568815689156901569115692156931569415695156961569715698156991570015701157021570315704157051570615707157081570915710157111571215713157141571515716157171571815719157201572115722157231572415725157261572715728157291573015731157321573315734157351573615737157381573915740157411574215743157441574515746157471574815749157501575115752157531575415755157561575715758157591576015761157621576315764157651576615767157681576915770157711577215773157741577515776157771577815779157801578115782157831578415785157861578715788157891579015791157921579315794157951579615797157981579915800158011580215803158041580515806158071580815809158101581115812158131581415815158161581715818158191582015821158221582315824158251582615827158281582915830158311583215833158341583515836158371583815839158401584115842158431584415845158461584715848158491585015851158521585315854158551585615857158581585915860158611586215863158641586515866158671586815869158701587115872158731587415875158761587715878158791588015881158821588315884158851588615887158881588915890158911589215893158941589515896158971589815899159001590115902159031590415905159061590715908159091591015911159121591315914159151591615917159181591915920159211592215923159241592515926159271592815929159301593115932159331593415935159361593715938159391594015941159421594315944159451594615947159481594915950159511595215953159541595515956159571595815959159601596115962159631596415965159661596715968159691597015971159721597315974159751597615977159781597915980159811598215983159841598515986159871598815989159901599115992159931599415995159961599715998159991600016001160021600316004160051600616007160081600916010160111601216013160141601516016160171601816019160201602116022160231602416025160261602716028160291603016031160321603316034160351603616037160381603916040160411604216043160441604516046160471604816049160501605116052160531605416055160561605716058160591606016061160621606316064160651606616067160681606916070160711607216073160741607516076160771607816079160801608116082160831608416085160861608716088160891609016091160921609316094160951609616097160981609916100161011610216103161041610516106161071610816109161101611116112161131611416115161161611716118161191612016121161221612316124161251612616127161281612916130161311613216133161341613516136161371613816139161401614116142161431614416145161461614716148161491615016151161521615316154161551615616157161581615916160161611616216163161641616516166161671616816169161701617116172161731617416175161761617716178161791618016181161821618316184161851618616187161881618916190161911619216193161941619516196161971619816199162001620116202162031620416205162061620716208162091621016211162121621316214162151621616217162181621916220162211622216223162241622516226162271622816229162301623116232162331623416235162361623716238162391624016241162421624316244162451624616247162481624916250162511625216253162541625516256162571625816259162601626116262162631626416265162661626716268162691627016271162721627316274162751627616277162781627916280162811628216283162841628516286162871628816289162901629116292162931629416295162961629716298162991630016301163021630316304163051630616307163081630916310163111631216313163141631516316163171631816319163201632116322163231632416325163261632716328163291633016331163321633316334163351633616337163381633916340163411634216343163441634516346163471634816349163501635116352163531635416355163561635716358163591636016361163621636316364163651636616367163681636916370163711637216373163741637516376163771637816379163801638116382163831638416385163861638716388163891639016391163921639316394163951639616397163981639916400164011640216403164041640516406164071640816409164101641116412164131641416415164161641716418164191642016421164221642316424164251642616427164281642916430164311643216433164341643516436164371643816439164401644116442164431644416445164461644716448164491645016451164521645316454164551645616457164581645916460164611646216463164641646516466164671646816469164701647116472164731647416475164761647716478164791648016481164821648316484164851648616487164881648916490164911649216493164941649516496164971649816499165001650116502165031650416505165061650716508165091651016511165121651316514165151651616517165181651916520165211652216523165241652516526165271652816529165301653116532165331653416535165361653716538165391654016541165421654316544165451654616547165481654916550165511655216553165541655516556165571655816559165601656116562165631656416565165661656716568165691657016571165721657316574165751657616577165781657916580165811658216583165841658516586165871658816589165901659116592165931659416595165961659716598165991660016601166021660316604166051660616607166081660916610166111661216613166141661516616166171661816619166201662116622166231662416625166261662716628166291663016631166321663316634166351663616637166381663916640166411664216643166441664516646166471664816649166501665116652166531665416655166561665716658166591666016661166621666316664166651666616667166681666916670166711667216673166741667516676166771667816679166801668116682166831668416685166861668716688166891669016691166921669316694166951669616697166981669916700167011670216703167041670516706167071670816709167101671116712167131671416715167161671716718167191672016721167221672316724167251672616727167281672916730167311673216733167341673516736167371673816739167401674116742167431674416745167461674716748167491675016751167521675316754167551675616757167581675916760167611676216763167641676516766167671676816769167701677116772167731677416775167761677716778167791678016781167821678316784167851678616787167881678916790167911679216793167941679516796167971679816799168001680116802168031680416805168061680716808168091681016811168121681316814168151681616817168181681916820168211682216823168241682516826168271682816829168301683116832168331683416835168361683716838168391684016841168421684316844168451684616847168481684916850168511685216853168541685516856168571685816859168601686116862168631686416865168661686716868168691687016871168721687316874168751687616877168781687916880168811688216883168841688516886168871688816889168901689116892168931689416895168961689716898168991690016901169021690316904169051690616907169081690916910169111691216913169141691516916169171691816919169201692116922169231692416925169261692716928169291693016931169321693316934169351693616937169381693916940169411694216943169441694516946169471694816949169501695116952169531695416955169561695716958169591696016961169621696316964169651696616967169681696916970169711697216973169741697516976169771697816979169801698116982169831698416985169861698716988169891699016991169921699316994169951699616997169981699917000170011700217003170041700517006170071700817009170101701117012170131701417015170161701717018170191702017021170221702317024170251702617027170281702917030170311703217033170341703517036170371703817039170401704117042170431704417045170461704717048170491705017051170521705317054170551705617057170581705917060170611706217063170641706517066170671706817069170701707117072170731707417075170761707717078170791708017081170821708317084170851708617087170881708917090170911709217093170941709517096170971709817099171001710117102171031710417105171061710717108171091711017111171121711317114171151711617117171181711917120171211712217123171241712517126171271712817129171301713117132171331713417135171361713717138171391714017141171421714317144171451714617147171481714917150171511715217153171541715517156171571715817159171601716117162171631716417165171661716717168171691717017171171721717317174171751717617177171781717917180171811718217183171841718517186171871718817189171901719117192171931719417195171961719717198171991720017201172021720317204172051720617207172081720917210172111721217213172141721517216172171721817219172201722117222172231722417225172261722717228172291723017231172321723317234172351723617237172381723917240172411724217243172441724517246172471724817249172501725117252172531725417255172561725717258172591726017261172621726317264172651726617267172681726917270172711727217273172741727517276172771727817279172801728117282172831728417285172861728717288172891729017291172921729317294172951729617297172981729917300173011730217303173041730517306173071730817309173101731117312173131731417315173161731717318173191732017321173221732317324173251732617327173281732917330173311733217333173341733517336173371733817339173401734117342173431734417345173461734717348173491735017351173521735317354173551735617357173581735917360173611736217363173641736517366173671736817369173701737117372173731737417375173761737717378173791738017381173821738317384173851738617387173881738917390173911739217393173941739517396173971739817399174001740117402174031740417405174061740717408174091741017411174121741317414174151741617417174181741917420174211742217423174241742517426174271742817429174301743117432174331743417435174361743717438174391744017441174421744317444174451744617447174481744917450174511745217453174541745517456174571745817459174601746117462174631746417465174661746717468174691747017471174721747317474174751747617477174781747917480174811748217483174841748517486174871748817489174901749117492174931749417495174961749717498174991750017501175021750317504175051750617507175081750917510175111751217513175141751517516175171751817519175201752117522175231752417525175261752717528175291753017531175321753317534175351753617537175381753917540175411754217543175441754517546175471754817549175501755117552175531755417555175561755717558175591756017561175621756317564175651756617567175681756917570175711757217573175741757517576175771757817579175801758117582175831758417585175861758717588175891759017591175921759317594175951759617597175981759917600176011760217603176041760517606176071760817609176101761117612176131761417615176161761717618176191762017621176221762317624176251762617627176281762917630176311763217633176341763517636176371763817639176401764117642176431764417645176461764717648176491765017651176521765317654176551765617657176581765917660176611766217663176641766517666176671766817669176701767117672176731767417675176761767717678176791768017681176821768317684176851768617687176881768917690176911769217693176941769517696176971769817699177001770117702177031770417705177061770717708177091771017711177121771317714177151771617717177181771917720177211772217723177241772517726177271772817729177301773117732177331773417735177361773717738177391774017741177421774317744177451774617747177481774917750177511775217753177541775517756177571775817759177601776117762177631776417765177661776717768177691777017771177721777317774177751777617777177781777917780177811778217783177841778517786177871778817789177901779117792177931779417795177961779717798177991780017801178021780317804178051780617807178081780917810178111781217813178141781517816178171781817819178201782117822178231782417825178261782717828178291783017831178321783317834178351783617837178381783917840178411784217843178441784517846178471784817849178501785117852178531785417855178561785717858178591786017861178621786317864178651786617867178681786917870178711787217873178741787517876178771787817879178801788117882178831788417885178861788717888178891789017891178921789317894178951789617897178981789917900179011790217903179041790517906179071790817909179101791117912179131791417915179161791717918179191792017921179221792317924179251792617927179281792917930179311793217933179341793517936179371793817939179401794117942179431794417945179461794717948179491795017951179521795317954179551795617957179581795917960179611796217963179641796517966179671796817969179701797117972179731797417975179761797717978179791798017981179821798317984179851798617987179881798917990179911799217993179941799517996179971799817999180001800118002180031800418005180061800718008180091801018011180121801318014180151801618017180181801918020180211802218023180241802518026180271802818029180301803118032180331803418035180361803718038180391804018041180421804318044180451804618047180481804918050180511805218053180541805518056180571805818059180601806118062180631806418065180661806718068180691807018071180721807318074180751807618077180781807918080180811808218083180841808518086180871808818089180901809118092180931809418095180961809718098180991810018101181021810318104181051810618107181081810918110181111811218113181141811518116181171811818119181201812118122181231812418125181261812718128181291813018131181321813318134181351813618137181381813918140181411814218143181441814518146181471814818149181501815118152181531815418155181561815718158181591816018161181621816318164181651816618167181681816918170181711817218173181741817518176181771817818179181801818118182181831818418185181861818718188181891819018191181921819318194181951819618197181981819918200182011820218203182041820518206182071820818209182101821118212182131821418215182161821718218182191822018221182221822318224182251822618227182281822918230182311823218233182341823518236182371823818239182401824118242182431824418245182461824718248182491825018251182521825318254182551825618257182581825918260182611826218263182641826518266182671826818269182701827118272182731827418275182761827718278182791828018281182821828318284182851828618287182881828918290182911829218293182941829518296182971829818299183001830118302183031830418305183061830718308183091831018311183121831318314183151831618317183181831918320183211832218323183241832518326183271832818329183301833118332183331833418335183361833718338183391834018341183421834318344183451834618347183481834918350183511835218353183541835518356183571835818359183601836118362183631836418365183661836718368183691837018371183721837318374183751837618377183781837918380183811838218383183841838518386183871838818389183901839118392183931839418395183961839718398183991840018401184021840318404184051840618407184081840918410184111841218413184141841518416184171841818419184201842118422184231842418425184261842718428184291843018431184321843318434184351843618437184381843918440184411844218443184441844518446184471844818449184501845118452184531845418455184561845718458184591846018461184621846318464184651846618467184681846918470184711847218473184741847518476184771847818479184801848118482184831848418485184861848718488184891849018491184921849318494184951849618497184981849918500185011850218503185041850518506185071850818509185101851118512185131851418515185161851718518185191852018521185221852318524185251852618527185281852918530185311853218533185341853518536185371853818539185401854118542185431854418545185461854718548185491855018551185521855318554185551855618557185581855918560185611856218563185641856518566185671856818569185701857118572185731857418575185761857718578185791858018581185821858318584185851858618587185881858918590185911859218593185941859518596185971859818599186001860118602186031860418605186061860718608186091861018611186121861318614186151861618617186181861918620186211862218623186241862518626186271862818629186301863118632186331863418635186361863718638186391864018641186421864318644186451864618647186481864918650186511865218653186541865518656186571865818659186601866118662186631866418665186661866718668186691867018671186721867318674186751867618677186781867918680186811868218683186841868518686186871868818689186901869118692186931869418695186961869718698186991870018701187021870318704187051870618707187081870918710187111871218713187141871518716187171871818719187201872118722187231872418725187261872718728187291873018731187321873318734187351873618737187381873918740187411874218743187441874518746187471874818749187501875118752187531875418755187561875718758187591876018761187621876318764187651876618767187681876918770187711877218773187741877518776187771877818779187801878118782187831878418785187861878718788187891879018791187921879318794187951879618797187981879918800188011880218803188041880518806188071880818809188101881118812188131881418815188161881718818188191882018821188221882318824188251882618827188281882918830188311883218833188341883518836188371883818839188401884118842188431884418845188461884718848188491885018851188521885318854188551885618857188581885918860188611886218863188641886518866188671886818869188701887118872188731887418875188761887718878188791888018881188821888318884188851888618887188881888918890188911889218893188941889518896188971889818899189001890118902189031890418905189061890718908189091891018911189121891318914189151891618917189181891918920189211892218923189241892518926189271892818929189301893118932189331893418935189361893718938189391894018941189421894318944189451894618947189481894918950189511895218953189541895518956189571895818959189601896118962189631896418965189661896718968189691897018971189721897318974189751897618977189781897918980189811898218983189841898518986189871898818989189901899118992189931899418995189961899718998189991900019001190021900319004190051900619007190081900919010190111901219013190141901519016190171901819019190201902119022190231902419025190261902719028190291903019031190321903319034190351903619037190381903919040190411904219043190441904519046190471904819049190501905119052190531905419055190561905719058190591906019061190621906319064190651906619067190681906919070190711907219073190741907519076190771907819079190801908119082190831908419085190861908719088190891909019091190921909319094190951909619097190981909919100191011910219103191041910519106191071910819109191101911119112191131911419115191161911719118191191912019121191221912319124191251912619127191281912919130191311913219133191341913519136191371913819139191401914119142191431914419145191461914719148191491915019151191521915319154191551915619157191581915919160191611916219163191641916519166191671916819169191701917119172191731917419175191761917719178191791918019181191821918319184191851918619187191881918919190191911919219193191941919519196191971919819199192001920119202192031920419205192061920719208192091921019211192121921319214192151921619217192181921919220192211922219223192241922519226192271922819229192301923119232192331923419235192361923719238192391924019241192421924319244192451924619247192481924919250192511925219253192541925519256192571925819259192601926119262192631926419265192661926719268192691927019271192721927319274192751927619277192781927919280192811928219283192841928519286192871928819289192901929119292192931929419295192961929719298192991930019301193021930319304193051930619307193081930919310193111931219313193141931519316193171931819319193201932119322193231932419325193261932719328193291933019331193321933319334193351933619337193381933919340193411934219343193441934519346193471934819349193501935119352193531935419355193561935719358193591936019361193621936319364193651936619367193681936919370193711937219373193741937519376193771937819379193801938119382193831938419385193861938719388193891939019391193921939319394193951939619397193981939919400194011940219403194041940519406194071940819409194101941119412194131941419415194161941719418194191942019421194221942319424194251942619427194281942919430194311943219433194341943519436194371943819439194401944119442194431944419445194461944719448194491945019451194521945319454194551945619457194581945919460194611946219463194641946519466194671946819469194701947119472194731947419475194761947719478194791948019481194821948319484194851948619487194881948919490194911949219493194941949519496194971949819499195001950119502195031950419505195061950719508195091951019511195121951319514195151951619517195181951919520195211952219523195241952519526195271952819529195301953119532195331953419535195361953719538195391954019541195421954319544195451954619547195481954919550195511955219553195541955519556195571955819559195601956119562195631956419565195661956719568195691957019571195721957319574195751957619577195781957919580195811958219583195841958519586195871958819589195901959119592195931959419595195961959719598195991960019601196021960319604196051960619607196081960919610196111961219613196141961519616196171961819619196201962119622196231962419625196261962719628196291963019631196321963319634196351963619637196381963919640196411964219643196441964519646196471964819649196501965119652196531965419655196561965719658196591966019661196621966319664196651966619667196681966919670196711967219673196741967519676196771967819679196801968119682196831968419685196861968719688196891969019691196921969319694196951969619697196981969919700197011970219703197041970519706197071970819709197101971119712197131971419715197161971719718197191972019721197221972319724197251972619727197281972919730197311973219733197341973519736197371973819739197401974119742197431974419745197461974719748197491975019751197521975319754197551975619757197581975919760197611976219763197641976519766197671976819769197701977119772197731977419775197761977719778197791978019781197821978319784197851978619787197881978919790197911979219793197941979519796197971979819799198001980119802198031980419805198061980719808198091981019811198121981319814198151981619817198181981919820198211982219823198241982519826198271982819829198301983119832198331983419835198361983719838198391984019841198421984319844198451984619847198481984919850198511985219853198541985519856198571985819859198601986119862198631986419865198661986719868198691987019871198721987319874198751987619877198781987919880198811988219883198841988519886198871988819889198901989119892198931989419895198961989719898198991990019901199021990319904199051990619907199081990919910199111991219913199141991519916199171991819919199201992119922199231992419925199261992719928199291993019931199321993319934199351993619937199381993919940199411994219943199441994519946199471994819949199501995119952199531995419955199561995719958199591996019961199621996319964199651996619967199681996919970199711997219973199741997519976199771997819979199801998119982199831998419985199861998719988199891999019991199921999319994199951999619997199981999920000200012000220003200042000520006200072000820009200102001120012200132001420015200162001720018200192002020021200222002320024200252002620027200282002920030200312003220033200342003520036200372003820039200402004120042200432004420045200462004720048200492005020051200522005320054200552005620057200582005920060200612006220063200642006520066200672006820069200702007120072200732007420075200762007720078200792008020081200822008320084200852008620087200882008920090200912009220093200942009520096200972009820099201002010120102201032010420105201062010720108201092011020111201122011320114201152011620117201182011920120201212012220123201242012520126201272012820129201302013120132201332013420135201362013720138201392014020141201422014320144201452014620147201482014920150201512015220153201542015520156201572015820159201602016120162201632016420165201662016720168201692017020171201722017320174201752017620177201782017920180201812018220183201842018520186201872018820189201902019120192201932019420195201962019720198201992020020201202022020320204202052020620207202082020920210202112021220213202142021520216202172021820219202202022120222202232022420225202262022720228202292023020231202322023320234202352023620237202382023920240202412024220243202442024520246202472024820249202502025120252202532025420255202562025720258202592026020261202622026320264202652026620267202682026920270202712027220273202742027520276202772027820279202802028120282202832028420285202862028720288202892029020291202922029320294202952029620297202982029920300203012030220303203042030520306203072030820309203102031120312203132031420315203162031720318203192032020321203222032320324203252032620327203282032920330203312033220333203342033520336203372033820339203402034120342203432034420345203462034720348203492035020351203522035320354203552035620357203582035920360203612036220363203642036520366203672036820369203702037120372203732037420375203762037720378203792038020381203822038320384203852038620387203882038920390203912039220393203942039520396203972039820399204002040120402204032040420405204062040720408204092041020411204122041320414204152041620417204182041920420204212042220423204242042520426204272042820429204302043120432204332043420435204362043720438204392044020441204422044320444204452044620447204482044920450204512045220453204542045520456204572045820459204602046120462204632046420465204662046720468204692047020471204722047320474204752047620477204782047920480204812048220483204842048520486204872048820489204902049120492204932049420495204962049720498204992050020501205022050320504205052050620507205082050920510205112051220513205142051520516205172051820519205202052120522205232052420525205262052720528205292053020531205322053320534205352053620537205382053920540205412054220543205442054520546205472054820549205502055120552205532055420555205562055720558205592056020561205622056320564205652056620567205682056920570205712057220573205742057520576205772057820579205802058120582205832058420585205862058720588205892059020591205922059320594205952059620597205982059920600206012060220603206042060520606206072060820609206102061120612206132061420615206162061720618206192062020621206222062320624206252062620627206282062920630206312063220633206342063520636206372063820639206402064120642206432064420645206462064720648206492065020651206522065320654206552065620657206582065920660206612066220663206642066520666206672066820669206702067120672206732067420675206762067720678206792068020681206822068320684206852068620687206882068920690206912069220693206942069520696206972069820699207002070120702207032070420705207062070720708207092071020711207122071320714207152071620717207182071920720207212072220723207242072520726207272072820729207302073120732207332073420735207362073720738207392074020741207422074320744207452074620747207482074920750207512075220753207542075520756207572075820759207602076120762207632076420765207662076720768207692077020771207722077320774207752077620777207782077920780207812078220783207842078520786207872078820789207902079120792207932079420795207962079720798207992080020801208022080320804208052080620807208082080920810208112081220813208142081520816208172081820819208202082120822208232082420825208262082720828208292083020831208322083320834208352083620837208382083920840208412084220843208442084520846208472084820849208502085120852208532085420855208562085720858208592086020861208622086320864208652086620867208682086920870208712087220873208742087520876208772087820879208802088120882208832088420885208862088720888208892089020891208922089320894208952089620897208982089920900209012090220903209042090520906209072090820909209102091120912209132091420915209162091720918209192092020921209222092320924209252092620927209282092920930209312093220933209342093520936209372093820939209402094120942209432094420945209462094720948209492095020951209522095320954209552095620957209582095920960209612096220963209642096520966209672096820969209702097120972209732097420975209762097720978209792098020981209822098320984209852098620987209882098920990209912099220993209942099520996209972099820999210002100121002210032100421005210062100721008210092101021011210122101321014210152101621017210182101921020210212102221023210242102521026210272102821029210302103121032210332103421035210362103721038210392104021041210422104321044210452104621047210482104921050210512105221053210542105521056210572105821059210602106121062210632106421065210662106721068210692107021071210722107321074210752107621077210782107921080210812108221083210842108521086210872108821089210902109121092210932109421095210962109721098210992110021101211022110321104211052110621107211082110921110211112111221113211142111521116211172111821119211202112121122211232112421125211262112721128211292113021131211322113321134211352113621137211382113921140211412114221143211442114521146211472114821149211502115121152211532115421155211562115721158211592116021161211622116321164211652116621167211682116921170211712117221173211742117521176211772117821179211802118121182211832118421185211862118721188211892119021191211922119321194211952119621197211982119921200212012120221203212042120521206212072120821209212102121121212212132121421215212162121721218212192122021221212222122321224212252122621227212282122921230212312123221233212342123521236212372123821239212402124121242212432124421245212462124721248212492125021251212522125321254212552125621257212582125921260212612126221263212642126521266212672126821269212702127121272212732127421275212762127721278212792128021281212822128321284212852128621287212882128921290212912129221293212942129521296212972129821299213002130121302213032130421305213062130721308213092131021311213122131321314213152131621317213182131921320213212132221323213242132521326213272132821329213302133121332213332133421335213362133721338213392134021341213422134321344213452134621347213482134921350213512135221353213542135521356213572135821359213602136121362213632136421365213662136721368213692137021371213722137321374213752137621377213782137921380213812138221383213842138521386213872138821389213902139121392213932139421395213962139721398213992140021401214022140321404214052140621407214082140921410214112141221413214142141521416214172141821419214202142121422214232142421425214262142721428214292143021431214322143321434214352143621437214382143921440214412144221443214442144521446214472144821449214502145121452214532145421455214562145721458214592146021461214622146321464214652146621467214682146921470214712147221473214742147521476214772147821479214802148121482214832148421485214862148721488214892149021491214922149321494214952149621497214982149921500215012150221503215042150521506215072150821509215102151121512215132151421515215162151721518215192152021521215222152321524215252152621527215282152921530215312153221533215342153521536215372153821539215402154121542215432154421545215462154721548215492155021551215522155321554215552155621557215582155921560215612156221563215642156521566215672156821569215702157121572215732157421575215762157721578215792158021581215822158321584215852158621587215882158921590215912159221593215942159521596215972159821599216002160121602216032160421605216062160721608216092161021611216122161321614216152161621617216182161921620216212162221623216242162521626216272162821629216302163121632216332163421635216362163721638216392164021641216422164321644216452164621647216482164921650216512165221653216542165521656216572165821659216602166121662216632166421665216662166721668216692167021671216722167321674216752167621677216782167921680216812168221683216842168521686216872168821689216902169121692216932169421695216962169721698216992170021701217022170321704217052170621707217082170921710217112171221713217142171521716217172171821719217202172121722217232172421725217262172721728217292173021731217322173321734217352173621737217382173921740217412174221743217442174521746217472174821749217502175121752217532175421755217562175721758217592176021761217622176321764217652176621767217682176921770217712177221773217742177521776217772177821779217802178121782217832178421785217862178721788217892179021791217922179321794217952179621797217982179921800218012180221803218042180521806218072180821809218102181121812218132181421815218162181721818218192182021821218222182321824218252182621827218282182921830218312183221833218342183521836218372183821839218402184121842218432184421845218462184721848218492185021851218522185321854218552185621857218582185921860218612186221863218642186521866218672186821869218702187121872218732187421875218762187721878218792188021881218822188321884218852188621887218882188921890218912189221893218942189521896218972189821899219002190121902219032190421905219062190721908219092191021911219122191321914219152191621917219182191921920219212192221923219242192521926219272192821929219302193121932219332193421935219362193721938219392194021941219422194321944219452194621947219482194921950219512195221953219542195521956219572195821959219602196121962219632196421965219662196721968219692197021971219722197321974219752197621977219782197921980219812198221983219842198521986219872198821989219902199121992219932199421995219962199721998219992200022001220022200322004220052200622007220082200922010220112201222013220142201522016220172201822019220202202122022220232202422025220262202722028220292203022031220322203322034220352203622037220382203922040220412204222043220442204522046220472204822049220502205122052220532205422055220562205722058220592206022061220622206322064220652206622067220682206922070220712207222073220742207522076220772207822079220802208122082220832208422085220862208722088220892209022091220922209322094220952209622097220982209922100221012210222103221042210522106221072210822109221102211122112221132211422115221162211722118221192212022121221222212322124221252212622127221282212922130221312213222133221342213522136221372213822139221402214122142221432214422145221462214722148221492215022151221522215322154221552215622157221582215922160221612216222163221642216522166221672216822169221702217122172221732217422175221762217722178221792218022181221822218322184221852218622187221882218922190221912219222193221942219522196221972219822199222002220122202222032220422205222062220722208222092221022211222122221322214222152221622217222182221922220222212222222223222242222522226222272222822229222302223122232222332223422235222362223722238222392224022241222422224322244222452224622247222482224922250222512225222253222542225522256222572225822259222602226122262222632226422265222662226722268222692227022271222722227322274222752227622277222782227922280222812228222283222842228522286222872228822289222902229122292222932229422295222962229722298222992230022301223022230322304223052230622307223082230922310223112231222313223142231522316223172231822319223202232122322223232232422325223262232722328223292233022331223322233322334223352233622337223382233922340223412234222343223442234522346223472234822349223502235122352223532235422355223562235722358223592236022361223622236322364223652236622367223682236922370223712237222373223742237522376223772237822379223802238122382223832238422385223862238722388223892239022391223922239322394223952239622397223982239922400224012240222403224042240522406224072240822409224102241122412224132241422415224162241722418224192242022421224222242322424224252242622427224282242922430224312243222433224342243522436224372243822439224402244122442224432244422445224462244722448224492245022451224522245322454224552245622457224582245922460224612246222463224642246522466224672246822469224702247122472224732247422475224762247722478224792248022481224822248322484224852248622487224882248922490224912249222493224942249522496224972249822499225002250122502225032250422505225062250722508225092251022511225122251322514225152251622517225182251922520225212252222523225242252522526225272252822529225302253122532225332253422535225362253722538225392254022541225422254322544225452254622547225482254922550225512255222553225542255522556225572255822559225602256122562225632256422565225662256722568225692257022571225722257322574225752257622577225782257922580225812258222583225842258522586225872258822589225902259122592225932259422595225962259722598225992260022601226022260322604226052260622607226082260922610226112261222613226142261522616226172261822619226202262122622226232262422625226262262722628226292263022631226322263322634226352263622637226382263922640226412264222643226442264522646226472264822649226502265122652226532265422655226562265722658226592266022661226622266322664226652266622667226682266922670226712267222673226742267522676226772267822679226802268122682226832268422685226862268722688226892269022691226922269322694226952269622697226982269922700227012270222703227042270522706227072270822709227102271122712227132271422715227162271722718227192272022721227222272322724227252272622727227282272922730227312273222733227342273522736227372273822739227402274122742227432274422745227462274722748227492275022751227522275322754227552275622757227582275922760227612276222763227642276522766227672276822769227702277122772227732277422775227762277722778227792278022781227822278322784227852278622787227882278922790227912279222793227942279522796227972279822799228002280122802228032280422805228062280722808228092281022811228122281322814228152281622817228182281922820228212282222823228242282522826228272282822829228302283122832228332283422835228362283722838228392284022841228422284322844228452284622847228482284922850228512285222853228542285522856228572285822859228602286122862228632286422865228662286722868228692287022871228722287322874228752287622877228782287922880228812288222883228842288522886228872288822889228902289122892228932289422895228962289722898228992290022901229022290322904229052290622907229082290922910229112291222913229142291522916229172291822919229202292122922229232292422925229262292722928229292293022931229322293322934229352293622937229382293922940229412294222943229442294522946229472294822949229502295122952229532295422955229562295722958229592296022961229622296322964229652296622967229682296922970229712297222973229742297522976229772297822979229802298122982229832298422985229862298722988229892299022991229922299322994229952299622997229982299923000230012300223003230042300523006230072300823009230102301123012230132301423015230162301723018230192302023021230222302323024230252302623027230282302923030230312303223033230342303523036230372303823039230402304123042230432304423045230462304723048230492305023051230522305323054230552305623057230582305923060230612306223063230642306523066230672306823069230702307123072230732307423075230762307723078230792308023081230822308323084230852308623087230882308923090230912309223093230942309523096230972309823099231002310123102231032310423105231062310723108231092311023111231122311323114231152311623117231182311923120231212312223123231242312523126231272312823129231302313123132231332313423135231362313723138231392314023141231422314323144231452314623147231482314923150231512315223153231542315523156231572315823159231602316123162231632316423165231662316723168231692317023171231722317323174231752317623177231782317923180231812318223183231842318523186231872318823189231902319123192231932319423195231962319723198231992320023201232022320323204232052320623207232082320923210232112321223213232142321523216232172321823219232202322123222232232322423225232262322723228232292323023231232322323323234232352323623237232382323923240232412324223243232442324523246232472324823249232502325123252232532325423255232562325723258232592326023261232622326323264232652326623267232682326923270232712327223273232742327523276232772327823279232802328123282232832328423285232862328723288232892329023291232922329323294232952329623297232982329923300233012330223303233042330523306233072330823309233102331123312233132331423315233162331723318233192332023321233222332323324233252332623327233282332923330233312333223333233342333523336233372333823339233402334123342233432334423345233462334723348233492335023351233522335323354233552335623357233582335923360233612336223363233642336523366233672336823369233702337123372233732337423375233762337723378233792338023381233822338323384233852338623387233882338923390233912339223393233942339523396233972339823399234002340123402234032340423405234062340723408234092341023411234122341323414234152341623417234182341923420234212342223423234242342523426234272342823429234302343123432234332343423435234362343723438234392344023441234422344323444234452344623447234482344923450234512345223453234542345523456234572345823459234602346123462234632346423465234662346723468234692347023471234722347323474234752347623477234782347923480234812348223483234842348523486234872348823489234902349123492234932349423495234962349723498234992350023501235022350323504235052350623507235082350923510235112351223513235142351523516235172351823519235202352123522235232352423525235262352723528235292353023531235322353323534235352353623537235382353923540235412354223543235442354523546235472354823549235502355123552235532355423555235562355723558235592356023561235622356323564235652356623567235682356923570235712357223573235742357523576235772357823579235802358123582235832358423585235862358723588235892359023591235922359323594235952359623597235982359923600236012360223603236042360523606236072360823609236102361123612236132361423615236162361723618236192362023621236222362323624236252362623627236282362923630236312363223633236342363523636236372363823639236402364123642236432364423645236462364723648236492365023651236522365323654236552365623657236582365923660236612366223663236642366523666236672366823669236702367123672236732367423675236762367723678236792368023681236822368323684236852368623687236882368923690236912369223693236942369523696236972369823699237002370123702237032370423705237062370723708237092371023711237122371323714237152371623717237182371923720237212372223723237242372523726237272372823729237302373123732237332373423735237362373723738237392374023741237422374323744237452374623747237482374923750237512375223753237542375523756237572375823759237602376123762237632376423765237662376723768237692377023771237722377323774237752377623777237782377923780237812378223783237842378523786237872378823789237902379123792237932379423795237962379723798237992380023801238022380323804238052380623807238082380923810238112381223813238142381523816238172381823819238202382123822238232382423825238262382723828238292383023831238322383323834238352383623837238382383923840238412384223843238442384523846238472384823849238502385123852238532385423855238562385723858238592386023861238622386323864238652386623867238682386923870238712387223873238742387523876238772387823879238802388123882238832388423885238862388723888238892389023891238922389323894238952389623897238982389923900239012390223903239042390523906239072390823909239102391123912239132391423915239162391723918239192392023921239222392323924239252392623927239282392923930239312393223933239342393523936239372393823939239402394123942239432394423945239462394723948239492395023951239522395323954239552395623957239582395923960239612396223963239642396523966239672396823969239702397123972239732397423975239762397723978239792398023981239822398323984239852398623987239882398923990239912399223993239942399523996239972399823999240002400124002240032400424005240062400724008240092401024011240122401324014240152401624017240182401924020240212402224023240242402524026240272402824029240302403124032240332403424035240362403724038240392404024041240422404324044240452404624047240482404924050240512405224053240542405524056240572405824059240602406124062240632406424065240662406724068240692407024071240722407324074240752407624077240782407924080240812408224083240842408524086240872408824089240902409124092240932409424095240962409724098240992410024101241022410324104241052410624107241082410924110241112411224113241142411524116241172411824119241202412124122241232412424125241262412724128241292413024131241322413324134241352413624137241382413924140241412414224143241442414524146241472414824149241502415124152241532415424155241562415724158241592416024161241622416324164241652416624167241682416924170241712417224173241742417524176241772417824179241802418124182241832418424185241862418724188241892419024191241922419324194241952419624197241982419924200242012420224203242042420524206242072420824209242102421124212242132421424215242162421724218242192422024221242222422324224242252422624227242282422924230242312423224233242342423524236242372423824239242402424124242242432424424245242462424724248242492425024251242522425324254242552425624257242582425924260242612426224263242642426524266242672426824269242702427124272242732427424275242762427724278242792428024281242822428324284242852428624287242882428924290242912429224293242942429524296242972429824299243002430124302243032430424305243062430724308243092431024311243122431324314243152431624317243182431924320243212432224323243242432524326243272432824329243302433124332243332433424335243362433724338243392434024341243422434324344243452434624347243482434924350243512435224353243542435524356243572435824359243602436124362243632436424365243662436724368243692437024371243722437324374243752437624377243782437924380243812438224383243842438524386243872438824389243902439124392243932439424395243962439724398243992440024401244022440324404244052440624407244082440924410244112441224413244142441524416244172441824419244202442124422244232442424425244262442724428244292443024431244322443324434244352443624437244382443924440244412444224443244442444524446244472444824449244502445124452244532445424455244562445724458244592446024461244622446324464244652446624467244682446924470244712447224473244742447524476244772447824479244802448124482244832448424485244862448724488244892449024491244922449324494244952449624497244982449924500245012450224503245042450524506245072450824509245102451124512245132451424515245162451724518245192452024521245222452324524245252452624527245282452924530245312453224533245342453524536245372453824539245402454124542245432454424545245462454724548245492455024551245522455324554245552455624557245582455924560245612456224563245642456524566245672456824569245702457124572245732457424575245762457724578245792458024581245822458324584245852458624587245882458924590245912459224593245942459524596245972459824599246002460124602246032460424605246062460724608246092461024611246122461324614246152461624617246182461924620246212462224623246242462524626246272462824629246302463124632246332463424635246362463724638246392464024641246422464324644246452464624647246482464924650246512465224653246542465524656246572465824659246602466124662246632466424665246662466724668246692467024671246722467324674246752467624677246782467924680246812468224683246842468524686246872468824689246902469124692246932469424695246962469724698246992470024701247022470324704247052470624707247082470924710247112471224713247142471524716247172471824719247202472124722247232472424725247262472724728247292473024731247322473324734247352473624737247382473924740247412474224743247442474524746247472474824749247502475124752247532475424755247562475724758247592476024761247622476324764247652476624767247682476924770247712477224773247742477524776247772477824779247802478124782247832478424785247862478724788247892479024791247922479324794247952479624797247982479924800248012480224803248042480524806248072480824809248102481124812248132481424815248162481724818248192482024821248222482324824248252482624827248282482924830248312483224833248342483524836248372483824839248402484124842248432484424845248462484724848248492485024851248522485324854248552485624857248582485924860248612486224863248642486524866248672486824869248702487124872248732487424875248762487724878248792488024881248822488324884248852488624887248882488924890248912489224893248942489524896248972489824899249002490124902249032490424905249062490724908249092491024911249122491324914249152491624917249182491924920249212492224923249242492524926249272492824929249302493124932249332493424935249362493724938249392494024941249422494324944249452494624947249482494924950249512495224953249542495524956249572495824959249602496124962249632496424965249662496724968249692497024971249722497324974249752497624977249782497924980249812498224983249842498524986249872498824989249902499124992249932499424995249962499724998249992500025001250022500325004250052500625007250082500925010250112501225013250142501525016250172501825019250202502125022250232502425025250262502725028250292503025031250322503325034250352503625037250382503925040250412504225043250442504525046250472504825049250502505125052250532505425055250562505725058250592506025061250622506325064250652506625067250682506925070250712507225073250742507525076250772507825079250802508125082250832508425085250862508725088250892509025091250922509325094250952509625097250982509925100251012510225103251042510525106251072510825109251102511125112251132511425115251162511725118251192512025121251222512325124251252512625127251282512925130251312513225133251342513525136251372513825139251402514125142251432514425145251462514725148251492515025151251522515325154251552515625157251582515925160251612516225163251642516525166251672516825169251702517125172251732517425175251762517725178251792518025181251822518325184251852518625187251882518925190251912519225193251942519525196251972519825199252002520125202252032520425205252062520725208252092521025211252122521325214252152521625217252182521925220252212522225223252242522525226252272522825229252302523125232252332523425235252362523725238252392524025241252422524325244252452524625247252482524925250252512525225253252542525525256252572525825259252602526125262252632526425265252662526725268252692527025271252722527325274252752527625277252782527925280252812528225283252842528525286252872528825289252902529125292252932529425295252962529725298252992530025301253022530325304253052530625307253082530925310253112531225313253142531525316253172531825319253202532125322253232532425325253262532725328253292533025331253322533325334253352533625337253382533925340253412534225343253442534525346253472534825349253502535125352253532535425355253562535725358253592536025361253622536325364253652536625367253682536925370253712537225373253742537525376253772537825379253802538125382253832538425385253862538725388253892539025391253922539325394253952539625397253982539925400254012540225403254042540525406254072540825409254102541125412254132541425415254162541725418254192542025421254222542325424254252542625427254282542925430254312543225433254342543525436254372543825439254402544125442254432544425445254462544725448254492545025451254522545325454254552545625457254582545925460254612546225463254642546525466254672546825469254702547125472254732547425475254762547725478254792548025481254822548325484254852548625487254882548925490254912549225493254942549525496254972549825499255002550125502255032550425505255062550725508255092551025511255122551325514255152551625517255182551925520255212552225523255242552525526255272552825529255302553125532255332553425535255362553725538255392554025541255422554325544255452554625547255482554925550255512555225553255542555525556255572555825559255602556125562255632556425565255662556725568255692557025571255722557325574255752557625577255782557925580255812558225583255842558525586255872558825589255902559125592255932559425595255962559725598255992560025601256022560325604256052560625607256082560925610256112561225613256142561525616256172561825619256202562125622256232562425625256262562725628256292563025631256322563325634256352563625637256382563925640256412564225643256442564525646256472564825649256502565125652256532565425655256562565725658256592566025661256622566325664256652566625667256682566925670256712567225673256742567525676256772567825679256802568125682256832568425685256862568725688256892569025691256922569325694256952569625697256982569925700257012570225703257042570525706257072570825709257102571125712257132571425715257162571725718257192572025721257222572325724257252572625727257282572925730257312573225733257342573525736257372573825739257402574125742257432574425745257462574725748257492575025751257522575325754257552575625757257582575925760257612576225763257642576525766257672576825769257702577125772257732577425775257762577725778257792578025781257822578325784257852578625787257882578925790257912579225793257942579525796257972579825799258002580125802258032580425805258062580725808258092581025811258122581325814258152581625817258182581925820258212582225823258242582525826258272582825829258302583125832258332583425835258362583725838258392584025841258422584325844258452584625847258482584925850258512585225853258542585525856258572585825859258602586125862258632586425865258662586725868258692587025871258722587325874258752587625877258782587925880258812588225883258842588525886258872588825889258902589125892258932589425895258962589725898258992590025901259022590325904259052590625907259082590925910259112591225913259142591525916259172591825919259202592125922259232592425925259262592725928259292593025931259322593325934259352593625937259382593925940259412594225943259442594525946259472594825949259502595125952259532595425955259562595725958259592596025961259622596325964259652596625967259682596925970259712597225973259742597525976259772597825979259802598125982259832598425985259862598725988259892599025991259922599325994259952599625997259982599926000260012600226003260042600526006260072600826009260102601126012260132601426015260162601726018260192602026021260222602326024260252602626027260282602926030260312603226033260342603526036260372603826039260402604126042260432604426045260462604726048260492605026051260522605326054260552605626057260582605926060260612606226063260642606526066260672606826069260702607126072260732607426075260762607726078260792608026081260822608326084260852608626087260882608926090260912609226093260942609526096260972609826099261002610126102261032610426105261062610726108261092611026111261122611326114261152611626117261182611926120261212612226123261242612526126261272612826129261302613126132261332613426135261362613726138261392614026141261422614326144261452614626147261482614926150261512615226153261542615526156261572615826159261602616126162261632616426165261662616726168261692617026171261722617326174261752617626177261782617926180261812618226183261842618526186261872618826189261902619126192261932619426195261962619726198261992620026201262022620326204262052620626207262082620926210262112621226213262142621526216262172621826219262202622126222262232622426225262262622726228262292623026231262322623326234262352623626237262382623926240262412624226243262442624526246262472624826249262502625126252262532625426255262562625726258262592626026261262622626326264262652626626267262682626926270262712627226273262742627526276262772627826279262802628126282262832628426285262862628726288262892629026291262922629326294262952629626297262982629926300263012630226303263042630526306263072630826309263102631126312263132631426315263162631726318263192632026321263222632326324263252632626327263282632926330263312633226333263342633526336263372633826339263402634126342263432634426345263462634726348263492635026351263522635326354263552635626357263582635926360263612636226363263642636526366263672636826369263702637126372263732637426375263762637726378263792638026381263822638326384263852638626387263882638926390263912639226393263942639526396263972639826399264002640126402264032640426405264062640726408264092641026411264122641326414264152641626417264182641926420264212642226423264242642526426264272642826429264302643126432264332643426435264362643726438264392644026441264422644326444264452644626447264482644926450264512645226453264542645526456264572645826459264602646126462264632646426465264662646726468264692647026471264722647326474264752647626477264782647926480264812648226483264842648526486264872648826489264902649126492264932649426495264962649726498264992650026501265022650326504265052650626507265082650926510265112651226513265142651526516265172651826519265202652126522265232652426525265262652726528265292653026531265322653326534265352653626537265382653926540265412654226543265442654526546265472654826549265502655126552265532655426555265562655726558265592656026561265622656326564265652656626567265682656926570265712657226573265742657526576265772657826579265802658126582265832658426585265862658726588265892659026591265922659326594265952659626597265982659926600266012660226603266042660526606266072660826609266102661126612266132661426615266162661726618266192662026621266222662326624266252662626627266282662926630266312663226633266342663526636266372663826639266402664126642266432664426645266462664726648266492665026651266522665326654266552665626657266582665926660266612666226663266642666526666266672666826669266702667126672266732667426675266762667726678266792668026681266822668326684266852668626687266882668926690266912669226693266942669526696266972669826699267002670126702267032670426705267062670726708267092671026711267122671326714267152671626717267182671926720267212672226723267242672526726267272672826729267302673126732267332673426735267362673726738267392674026741267422674326744267452674626747267482674926750267512675226753267542675526756267572675826759267602676126762267632676426765267662676726768267692677026771267722677326774267752677626777267782677926780267812678226783267842678526786267872678826789267902679126792267932679426795267962679726798267992680026801268022680326804268052680626807268082680926810268112681226813268142681526816268172681826819268202682126822268232682426825268262682726828268292683026831268322683326834268352683626837268382683926840268412684226843268442684526846268472684826849268502685126852268532685426855268562685726858268592686026861268622686326864268652686626867268682686926870268712687226873268742687526876268772687826879268802688126882268832688426885268862688726888268892689026891268922689326894268952689626897268982689926900269012690226903269042690526906269072690826909269102691126912269132691426915269162691726918269192692026921269222692326924269252692626927269282692926930269312693226933269342693526936269372693826939269402694126942269432694426945269462694726948269492695026951269522695326954269552695626957269582695926960269612696226963269642696526966269672696826969269702697126972269732697426975269762697726978269792698026981269822698326984269852698626987269882698926990269912699226993269942699526996269972699826999270002700127002270032700427005270062700727008270092701027011270122701327014270152701627017270182701927020270212702227023270242702527026270272702827029270302703127032270332703427035270362703727038270392704027041270422704327044270452704627047270482704927050270512705227053270542705527056270572705827059270602706127062270632706427065270662706727068270692707027071270722707327074270752707627077270782707927080270812708227083270842708527086270872708827089270902709127092270932709427095270962709727098270992710027101271022710327104271052710627107271082710927110271112711227113271142711527116271172711827119271202712127122271232712427125271262712727128271292713027131271322713327134271352713627137271382713927140271412714227143271442714527146271472714827149271502715127152271532715427155271562715727158271592716027161271622716327164271652716627167271682716927170271712717227173271742717527176271772717827179271802718127182271832718427185271862718727188271892719027191271922719327194271952719627197271982719927200272012720227203272042720527206272072720827209272102721127212272132721427215272162721727218272192722027221272222722327224272252722627227272282722927230272312723227233272342723527236272372723827239272402724127242272432724427245272462724727248272492725027251272522725327254272552725627257272582725927260272612726227263272642726527266272672726827269272702727127272272732727427275272762727727278272792728027281272822728327284272852728627287272882728927290272912729227293272942729527296272972729827299273002730127302273032730427305273062730727308273092731027311273122731327314273152731627317273182731927320273212732227323273242732527326273272732827329273302733127332273332733427335273362733727338273392734027341273422734327344273452734627347273482734927350273512735227353273542735527356273572735827359273602736127362273632736427365273662736727368273692737027371273722737327374273752737627377273782737927380273812738227383273842738527386273872738827389273902739127392273932739427395273962739727398273992740027401274022740327404274052740627407274082740927410274112741227413274142741527416274172741827419274202742127422274232742427425274262742727428274292743027431274322743327434274352743627437274382743927440274412744227443274442744527446274472744827449274502745127452274532745427455274562745727458274592746027461274622746327464274652746627467274682746927470274712747227473274742747527476274772747827479274802748127482274832748427485274862748727488274892749027491274922749327494274952749627497274982749927500275012750227503275042750527506275072750827509275102751127512275132751427515275162751727518275192752027521275222752327524275252752627527275282752927530275312753227533275342753527536275372753827539275402754127542275432754427545275462754727548275492755027551275522755327554275552755627557275582755927560275612756227563275642756527566275672756827569275702757127572275732757427575275762757727578275792758027581275822758327584275852758627587275882758927590275912759227593275942759527596275972759827599276002760127602276032760427605276062760727608276092761027611276122761327614276152761627617276182761927620276212762227623276242762527626276272762827629276302763127632276332763427635276362763727638276392764027641276422764327644276452764627647276482764927650276512765227653276542765527656276572765827659276602766127662276632766427665276662766727668276692767027671276722767327674276752767627677276782767927680276812768227683276842768527686276872768827689276902769127692276932769427695276962769727698276992770027701277022770327704277052770627707277082770927710277112771227713277142771527716277172771827719277202772127722277232772427725277262772727728277292773027731277322773327734277352773627737277382773927740277412774227743277442774527746277472774827749277502775127752277532775427755277562775727758277592776027761277622776327764277652776627767277682776927770277712777227773277742777527776277772777827779277802778127782277832778427785277862778727788277892779027791277922779327794277952779627797277982779927800278012780227803278042780527806278072780827809278102781127812278132781427815278162781727818278192782027821278222782327824278252782627827278282782927830278312783227833278342783527836278372783827839278402784127842278432784427845278462784727848278492785027851278522785327854278552785627857278582785927860278612786227863278642786527866278672786827869278702787127872278732787427875278762787727878278792788027881278822788327884278852788627887278882788927890278912789227893278942789527896278972789827899279002790127902279032790427905279062790727908279092791027911279122791327914279152791627917279182791927920279212792227923279242792527926279272792827929279302793127932279332793427935279362793727938279392794027941279422794327944279452794627947279482794927950279512795227953279542795527956279572795827959279602796127962279632796427965279662796727968279692797027971279722797327974279752797627977279782797927980279812798227983279842798527986279872798827989279902799127992279932799427995279962799727998279992800028001280022800328004280052800628007280082800928010280112801228013280142801528016280172801828019280202802128022280232802428025280262802728028280292803028031280322803328034280352803628037280382803928040280412804228043280442804528046280472804828049280502805128052280532805428055280562805728058280592806028061280622806328064280652806628067280682806928070280712807228073280742807528076280772807828079280802808128082280832808428085280862808728088280892809028091280922809328094280952809628097280982809928100281012810228103281042810528106281072810828109281102811128112281132811428115281162811728118281192812028121281222812328124281252812628127281282812928130281312813228133281342813528136281372813828139281402814128142281432814428145281462814728148281492815028151281522815328154281552815628157281582815928160281612816228163281642816528166281672816828169281702817128172281732817428175281762817728178281792818028181281822818328184281852818628187281882818928190281912819228193281942819528196281972819828199282002820128202282032820428205282062820728208282092821028211282122821328214282152821628217282182821928220282212822228223282242822528226282272822828229282302823128232282332823428235282362823728238282392824028241282422824328244282452824628247282482824928250282512825228253282542825528256282572825828259282602826128262282632826428265282662826728268282692827028271282722827328274282752827628277282782827928280282812828228283282842828528286282872828828289282902829128292282932829428295282962829728298282992830028301283022830328304283052830628307283082830928310283112831228313283142831528316283172831828319283202832128322283232832428325283262832728328283292833028331283322833328334283352833628337283382833928340283412834228343283442834528346283472834828349283502835128352283532835428355283562835728358283592836028361283622836328364283652836628367283682836928370283712837228373283742837528376283772837828379283802838128382283832838428385283862838728388283892839028391283922839328394283952839628397283982839928400284012840228403284042840528406284072840828409284102841128412284132841428415284162841728418284192842028421284222842328424284252842628427284282842928430284312843228433284342843528436284372843828439284402844128442284432844428445284462844728448284492845028451284522845328454284552845628457284582845928460284612846228463284642846528466284672846828469284702847128472284732847428475284762847728478284792848028481284822848328484284852848628487284882848928490284912849228493284942849528496284972849828499285002850128502285032850428505285062850728508285092851028511285122851328514285152851628517285182851928520285212852228523285242852528526285272852828529285302853128532285332853428535285362853728538285392854028541285422854328544285452854628547285482854928550285512855228553285542855528556285572855828559285602856128562285632856428565285662856728568285692857028571285722857328574285752857628577285782857928580285812858228583285842858528586285872858828589285902859128592285932859428595285962859728598285992860028601286022860328604286052860628607286082860928610286112861228613286142861528616286172861828619286202862128622286232862428625286262862728628286292863028631286322863328634286352863628637286382863928640286412864228643286442864528646286472864828649286502865128652286532865428655286562865728658286592866028661286622866328664286652866628667286682866928670286712867228673286742867528676286772867828679286802868128682286832868428685286862868728688286892869028691286922869328694286952869628697286982869928700287012870228703287042870528706287072870828709287102871128712287132871428715287162871728718287192872028721287222872328724287252872628727287282872928730287312873228733287342873528736287372873828739287402874128742287432874428745287462874728748287492875028751287522875328754287552875628757287582875928760287612876228763287642876528766287672876828769287702877128772287732877428775287762877728778287792878028781287822878328784287852878628787287882878928790287912879228793287942879528796287972879828799288002880128802288032880428805288062880728808288092881028811288122881328814288152881628817288182881928820288212882228823288242882528826288272882828829288302883128832288332883428835288362883728838288392884028841288422884328844288452884628847288482884928850288512885228853288542885528856288572885828859288602886128862288632886428865288662886728868288692887028871288722887328874288752887628877288782887928880288812888228883288842888528886288872888828889288902889128892288932889428895288962889728898288992890028901289022890328904289052890628907289082890928910289112891228913289142891528916289172891828919289202892128922289232892428925289262892728928289292893028931289322893328934289352893628937289382893928940289412894228943289442894528946289472894828949289502895128952289532895428955289562895728958289592896028961289622896328964289652896628967289682896928970289712897228973289742897528976289772897828979289802898128982289832898428985289862898728988289892899028991289922899328994289952899628997289982899929000290012900229003290042900529006290072900829009290102901129012290132901429015290162901729018290192902029021290222902329024290252902629027290282902929030290312903229033290342903529036290372903829039290402904129042290432904429045290462904729048290492905029051290522905329054290552905629057290582905929060290612906229063290642906529066290672906829069290702907129072290732907429075290762907729078290792908029081290822908329084290852908629087290882908929090290912909229093290942909529096290972909829099291002910129102291032910429105291062910729108291092911029111291122911329114291152911629117291182911929120291212912229123291242912529126291272912829129291302913129132291332913429135291362913729138291392914029141291422914329144291452914629147291482914929150291512915229153291542915529156291572915829159291602916129162291632916429165291662916729168291692917029171291722917329174291752917629177291782917929180291812918229183291842918529186291872918829189291902919129192291932919429195291962919729198291992920029201292022920329204292052920629207292082920929210292112921229213292142921529216292172921829219292202922129222292232922429225292262922729228292292923029231292322923329234292352923629237292382923929240292412924229243292442924529246292472924829249292502925129252292532925429255292562925729258292592926029261292622926329264292652926629267292682926929270292712927229273292742927529276292772927829279292802928129282292832928429285292862928729288292892929029291292922929329294292952929629297292982929929300293012930229303293042930529306293072930829309293102931129312293132931429315293162931729318293192932029321293222932329324293252932629327293282932929330293312933229333293342933529336293372933829339293402934129342293432934429345293462934729348293492935029351293522935329354293552935629357293582935929360293612936229363293642936529366293672936829369293702937129372293732937429375293762937729378293792938029381293822938329384293852938629387293882938929390293912939229393293942939529396293972939829399294002940129402294032940429405294062940729408294092941029411294122941329414294152941629417294182941929420294212942229423294242942529426294272942829429294302943129432294332943429435294362943729438294392944029441294422944329444294452944629447294482944929450294512945229453294542945529456294572945829459294602946129462294632946429465294662946729468294692947029471294722947329474294752947629477294782947929480294812948229483294842948529486294872948829489294902949129492294932949429495294962949729498294992950029501295022950329504295052950629507295082950929510295112951229513295142951529516295172951829519295202952129522295232952429525295262952729528295292953029531295322953329534295352953629537295382953929540295412954229543295442954529546295472954829549295502955129552295532955429555295562955729558295592956029561295622956329564295652956629567295682956929570295712957229573295742957529576295772957829579295802958129582295832958429585295862958729588295892959029591295922959329594295952959629597295982959929600296012960229603296042960529606296072960829609296102961129612296132961429615296162961729618296192962029621296222962329624296252962629627296282962929630296312963229633296342963529636296372963829639296402964129642296432964429645296462964729648296492965029651296522965329654296552965629657296582965929660296612966229663296642966529666296672966829669296702967129672296732967429675296762967729678296792968029681296822968329684296852968629687296882968929690296912969229693296942969529696296972969829699297002970129702297032970429705297062970729708297092971029711297122971329714297152971629717297182971929720297212972229723297242972529726297272972829729297302973129732297332973429735297362973729738297392974029741297422974329744297452974629747297482974929750297512975229753297542975529756297572975829759297602976129762297632976429765297662976729768297692977029771297722977329774297752977629777297782977929780297812978229783297842978529786297872978829789297902979129792297932979429795297962979729798297992980029801298022980329804298052980629807298082980929810298112981229813298142981529816298172981829819298202982129822298232982429825298262982729828298292983029831298322983329834298352983629837298382983929840298412984229843298442984529846298472984829849298502985129852298532985429855298562985729858298592986029861298622986329864298652986629867298682986929870298712987229873298742987529876298772987829879298802988129882298832988429885298862988729888298892989029891298922989329894298952989629897298982989929900299012990229903299042990529906299072990829909299102991129912299132991429915299162991729918299192992029921299222992329924299252992629927299282992929930299312993229933299342993529936299372993829939299402994129942299432994429945299462994729948299492995029951299522995329954299552995629957299582995929960299612996229963299642996529966299672996829969299702997129972299732997429975299762997729978299792998029981299822998329984299852998629987299882998929990299912999229993299942999529996299972999829999300003000130002300033000430005300063000730008300093001030011300123001330014300153001630017300183001930020300213002230023300243002530026300273002830029300303003130032300333003430035300363003730038300393004030041300423004330044300453004630047300483004930050300513005230053300543005530056300573005830059300603006130062300633006430065300663006730068300693007030071300723007330074300753007630077300783007930080300813008230083300843008530086300873008830089300903009130092300933009430095300963009730098300993010030101301023010330104301053010630107301083010930110301113011230113301143011530116301173011830119301203012130122301233012430125301263012730128301293013030131301323013330134301353013630137301383013930140301413014230143301443014530146301473014830149301503015130152301533015430155301563015730158301593016030161301623016330164301653016630167301683016930170301713017230173301743017530176301773017830179301803018130182301833018430185301863018730188301893019030191301923019330194301953019630197301983019930200302013020230203302043020530206302073020830209302103021130212302133021430215302163021730218302193022030221302223022330224302253022630227302283022930230302313023230233302343023530236302373023830239302403024130242302433024430245302463024730248302493025030251302523025330254302553025630257302583025930260302613026230263302643026530266302673026830269302703027130272302733027430275302763027730278302793028030281302823028330284302853028630287302883028930290302913029230293302943029530296302973029830299303003030130302303033030430305303063030730308303093031030311303123031330314303153031630317303183031930320303213032230323303243032530326303273032830329303303033130332303333033430335303363033730338303393034030341303423034330344303453034630347303483034930350303513035230353303543035530356303573035830359303603036130362303633036430365303663036730368303693037030371303723037330374303753037630377303783037930380303813038230383303843038530386303873038830389303903039130392303933039430395303963039730398303993040030401304023040330404304053040630407304083040930410304113041230413304143041530416304173041830419304203042130422304233042430425304263042730428304293043030431304323043330434304353043630437304383043930440304413044230443304443044530446304473044830449304503045130452304533045430455304563045730458304593046030461304623046330464304653046630467304683046930470304713047230473304743047530476304773047830479304803048130482304833048430485304863048730488304893049030491304923049330494304953049630497304983049930500305013050230503305043050530506305073050830509305103051130512305133051430515305163051730518305193052030521305223052330524305253052630527305283052930530305313053230533305343053530536305373053830539305403054130542305433054430545305463054730548305493055030551305523055330554305553055630557305583055930560305613056230563305643056530566305673056830569305703057130572305733057430575305763057730578305793058030581305823058330584305853058630587305883058930590305913059230593305943059530596305973059830599306003060130602306033060430605306063060730608306093061030611306123061330614306153061630617306183061930620306213062230623306243062530626306273062830629306303063130632306333063430635306363063730638306393064030641306423064330644306453064630647306483064930650306513065230653306543065530656306573065830659306603066130662306633066430665306663066730668306693067030671306723067330674306753067630677306783067930680306813068230683306843068530686306873068830689306903069130692306933069430695306963069730698306993070030701307023070330704307053070630707307083070930710307113071230713307143071530716307173071830719307203072130722307233072430725307263072730728307293073030731307323073330734307353073630737307383073930740307413074230743307443074530746307473074830749307503075130752307533075430755307563075730758307593076030761307623076330764307653076630767307683076930770307713077230773307743077530776307773077830779307803078130782307833078430785307863078730788307893079030791307923079330794307953079630797307983079930800308013080230803308043080530806308073080830809308103081130812308133081430815308163081730818308193082030821308223082330824308253082630827308283082930830308313083230833308343083530836308373083830839308403084130842308433084430845308463084730848308493085030851308523085330854308553085630857308583085930860308613086230863308643086530866308673086830869308703087130872308733087430875308763087730878308793088030881308823088330884308853088630887308883088930890308913089230893308943089530896308973089830899309003090130902309033090430905309063090730908309093091030911309123091330914309153091630917309183091930920309213092230923309243092530926309273092830929309303093130932309333093430935309363093730938309393094030941309423094330944309453094630947309483094930950309513095230953309543095530956309573095830959309603096130962309633096430965309663096730968309693097030971309723097330974309753097630977309783097930980309813098230983309843098530986309873098830989309903099130992309933099430995309963099730998309993100031001310023100331004310053100631007310083100931010310113101231013310143101531016310173101831019310203102131022310233102431025310263102731028310293103031031310323103331034310353103631037310383103931040310413104231043310443104531046310473104831049310503105131052310533105431055310563105731058310593106031061310623106331064310653106631067310683106931070310713107231073310743107531076310773107831079310803108131082310833108431085310863108731088310893109031091310923109331094310953109631097310983109931100311013110231103311043110531106311073110831109311103111131112311133111431115311163111731118311193112031121311223112331124311253112631127311283112931130311313113231133311343113531136311373113831139311403114131142311433114431145311463114731148311493115031151311523115331154311553115631157311583115931160311613116231163311643116531166311673116831169311703117131172311733117431175311763117731178311793118031181311823118331184311853118631187311883118931190311913119231193311943119531196311973119831199312003120131202312033120431205312063120731208312093121031211312123121331214312153121631217312183121931220312213122231223312243122531226312273122831229312303123131232312333123431235312363123731238312393124031241312423124331244312453124631247312483124931250312513125231253312543125531256312573125831259312603126131262312633126431265312663126731268312693127031271312723127331274312753127631277312783127931280312813128231283312843128531286312873128831289312903129131292312933129431295312963129731298312993130031301313023130331304313053130631307313083130931310313113131231313313143131531316313173131831319313203132131322313233132431325313263132731328313293133031331313323133331334313353133631337313383133931340313413134231343313443134531346313473134831349313503135131352313533135431355313563135731358313593136031361313623136331364313653136631367313683136931370313713137231373313743137531376313773137831379313803138131382313833138431385313863138731388313893139031391313923139331394313953139631397313983139931400314013140231403314043140531406314073140831409314103141131412314133141431415314163141731418314193142031421314223142331424314253142631427314283142931430314313143231433314343143531436314373143831439314403144131442314433144431445314463144731448314493145031451314523145331454314553145631457314583145931460314613146231463314643146531466314673146831469314703147131472314733147431475314763147731478314793148031481314823148331484314853148631487314883148931490314913149231493314943149531496314973149831499315003150131502315033150431505315063150731508315093151031511315123151331514315153151631517315183151931520315213152231523315243152531526315273152831529315303153131532315333153431535315363153731538315393154031541315423154331544315453154631547315483154931550315513155231553315543155531556315573155831559315603156131562315633156431565315663156731568315693157031571315723157331574315753157631577315783157931580315813158231583315843158531586315873158831589315903159131592315933159431595315963159731598315993160031601316023160331604316053160631607316083160931610316113161231613316143161531616316173161831619316203162131622316233162431625316263162731628316293163031631316323163331634316353163631637316383163931640316413164231643316443164531646316473164831649316503165131652316533165431655316563165731658316593166031661316623166331664316653166631667316683166931670316713167231673316743167531676316773167831679316803168131682316833168431685316863168731688316893169031691316923169331694316953169631697316983169931700317013170231703317043170531706317073170831709317103171131712317133171431715317163171731718317193172031721317223172331724317253172631727317283172931730317313173231733317343173531736317373173831739317403174131742317433174431745317463174731748317493175031751317523175331754317553175631757317583175931760317613176231763317643176531766317673176831769317703177131772317733177431775317763177731778317793178031781317823178331784317853178631787317883178931790317913179231793317943179531796317973179831799318003180131802318033180431805318063180731808318093181031811318123181331814318153181631817318183181931820318213182231823318243182531826318273182831829318303183131832318333183431835318363183731838318393184031841318423184331844318453184631847318483184931850318513185231853318543185531856318573185831859318603186131862318633186431865318663186731868318693187031871318723187331874318753187631877318783187931880318813188231883318843188531886318873188831889318903189131892318933189431895318963189731898318993190031901319023190331904319053190631907319083190931910319113191231913319143191531916319173191831919319203192131922319233192431925319263192731928319293193031931319323193331934319353193631937319383193931940319413194231943319443194531946319473194831949319503195131952319533195431955319563195731958319593196031961319623196331964319653196631967319683196931970319713197231973319743197531976319773197831979319803198131982319833198431985319863198731988319893199031991319923199331994319953199631997319983199932000320013200232003320043200532006320073200832009320103201132012320133201432015320163201732018320193202032021320223202332024320253202632027320283202932030320313203232033320343203532036320373203832039320403204132042320433204432045320463204732048320493205032051320523205332054320553205632057320583205932060320613206232063320643206532066320673206832069320703207132072320733207432075320763207732078320793208032081320823208332084320853208632087320883208932090320913209232093320943209532096320973209832099321003210132102321033210432105321063210732108321093211032111321123211332114321153211632117321183211932120321213212232123321243212532126321273212832129321303213132132321333213432135321363213732138321393214032141321423214332144321453214632147321483214932150321513215232153321543215532156321573215832159321603216132162321633216432165321663216732168321693217032171321723217332174321753217632177321783217932180321813218232183321843218532186321873218832189321903219132192321933219432195321963219732198321993220032201322023220332204322053220632207322083220932210322113221232213322143221532216322173221832219322203222132222322233222432225322263222732228322293223032231322323223332234322353223632237322383223932240322413224232243322443224532246322473224832249322503225132252322533225432255322563225732258322593226032261322623226332264322653226632267322683226932270322713227232273322743227532276322773227832279322803228132282322833228432285322863228732288322893229032291322923229332294322953229632297322983229932300323013230232303323043230532306323073230832309323103231132312323133231432315323163231732318323193232032321323223232332324323253232632327323283232932330323313233232333323343233532336323373233832339323403234132342323433234432345323463234732348323493235032351323523235332354323553235632357323583235932360323613236232363323643236532366323673236832369323703237132372323733237432375323763237732378323793238032381323823238332384323853238632387323883238932390323913239232393323943239532396323973239832399324003240132402324033240432405324063240732408324093241032411324123241332414324153241632417324183241932420324213242232423324243242532426324273242832429324303243132432324333243432435324363243732438324393244032441324423244332444324453244632447324483244932450324513245232453324543245532456324573245832459324603246132462324633246432465324663246732468324693247032471324723247332474324753247632477324783247932480324813248232483324843248532486324873248832489324903249132492324933249432495324963249732498324993250032501325023250332504325053250632507325083250932510325113251232513325143251532516325173251832519325203252132522325233252432525325263252732528325293253032531325323253332534325353253632537325383253932540325413254232543325443254532546325473254832549325503255132552325533255432555325563255732558325593256032561325623256332564325653256632567325683256932570325713257232573325743257532576325773257832579325803258132582325833258432585325863258732588325893259032591325923259332594325953259632597325983259932600326013260232603326043260532606326073260832609326103261132612326133261432615326163261732618326193262032621326223262332624326253262632627326283262932630326313263232633326343263532636326373263832639326403264132642326433264432645326463264732648326493265032651326523265332654326553265632657326583265932660326613266232663326643266532666326673266832669326703267132672326733267432675326763267732678326793268032681326823268332684326853268632687326883268932690326913269232693326943269532696326973269832699327003270132702327033270432705327063270732708327093271032711327123271332714327153271632717327183271932720327213272232723327243272532726327273272832729327303273132732327333273432735327363273732738327393274032741327423274332744327453274632747327483274932750327513275232753327543275532756327573275832759327603276132762327633276432765327663276732768327693277032771327723277332774327753277632777327783277932780327813278232783327843278532786327873278832789327903279132792327933279432795327963279732798327993280032801328023280332804328053280632807328083280932810328113281232813328143281532816328173281832819328203282132822328233282432825328263282732828328293283032831328323283332834328353283632837328383283932840328413284232843328443284532846328473284832849328503285132852328533285432855328563285732858328593286032861328623286332864328653286632867328683286932870328713287232873328743287532876328773287832879328803288132882328833288432885328863288732888328893289032891328923289332894328953289632897328983289932900329013290232903329043290532906329073290832909329103291132912329133291432915329163291732918329193292032921329223292332924329253292632927329283292932930329313293232933329343293532936329373293832939329403294132942329433294432945329463294732948329493295032951329523295332954329553295632957329583295932960329613296232963329643296532966329673296832969329703297132972329733297432975329763297732978329793298032981329823298332984329853298632987329883298932990329913299232993329943299532996329973299832999330003300133002330033300433005330063300733008330093301033011330123301333014330153301633017330183301933020330213302233023330243302533026330273302833029330303303133032330333303433035330363303733038330393304033041330423304333044330453304633047330483304933050330513305233053330543305533056330573305833059330603306133062330633306433065330663306733068330693307033071330723307333074330753307633077330783307933080330813308233083330843308533086330873308833089330903309133092330933309433095330963309733098330993310033101331023310333104331053310633107331083310933110331113311233113331143311533116331173311833119331203312133122331233312433125331263312733128331293313033131331323313333134331353313633137331383313933140331413314233143331443314533146331473314833149331503315133152331533315433155331563315733158331593316033161331623316333164331653316633167331683316933170331713317233173331743317533176331773317833179331803318133182331833318433185331863318733188331893319033191331923319333194331953319633197331983319933200332013320233203332043320533206332073320833209332103321133212332133321433215332163321733218332193322033221332223322333224332253322633227332283322933230332313323233233332343323533236332373323833239332403324133242332433324433245332463324733248332493325033251332523325333254332553325633257332583325933260332613326233263332643326533266332673326833269332703327133272332733327433275332763327733278332793328033281332823328333284332853328633287332883328933290332913329233293332943329533296332973329833299333003330133302333033330433305333063330733308333093331033311333123331333314333153331633317333183331933320333213332233323333243332533326333273332833329333303333133332333333333433335333363333733338333393334033341333423334333344333453334633347333483334933350333513335233353333543335533356333573335833359333603336133362333633336433365333663336733368333693337033371333723337333374333753337633377333783337933380333813338233383333843338533386333873338833389333903339133392333933339433395333963339733398333993340033401334023340333404334053340633407334083340933410334113341233413334143341533416334173341833419334203342133422334233342433425334263342733428334293343033431334323343333434334353343633437334383343933440334413344233443334443344533446334473344833449334503345133452334533345433455334563345733458334593346033461334623346333464334653346633467334683346933470334713347233473334743347533476334773347833479334803348133482334833348433485334863348733488334893349033491334923349333494334953349633497334983349933500335013350233503335043350533506335073350833509335103351133512335133351433515335163351733518335193352033521335223352333524335253352633527335283352933530335313353233533335343353533536335373353833539335403354133542335433354433545335463354733548335493355033551335523355333554335553355633557335583355933560335613356233563335643356533566335673356833569335703357133572335733357433575335763357733578335793358033581335823358333584335853358633587335883358933590335913359233593335943359533596335973359833599336003360133602336033360433605336063360733608336093361033611336123361333614336153361633617336183361933620336213362233623336243362533626336273362833629336303363133632336333363433635336363363733638336393364033641336423364333644336453364633647336483364933650336513365233653336543365533656336573365833659336603366133662336633366433665336663366733668336693367033671336723367333674336753367633677336783367933680336813368233683336843368533686336873368833689336903369133692336933369433695336963369733698336993370033701337023370333704337053370633707337083370933710337113371233713337143371533716337173371833719337203372133722337233372433725337263372733728337293373033731337323373333734337353373633737337383373933740337413374233743337443374533746337473374833749337503375133752337533375433755337563375733758337593376033761337623376333764337653376633767337683376933770337713377233773337743377533776337773377833779337803378133782337833378433785337863378733788337893379033791337923379333794337953379633797337983379933800338013380233803338043380533806338073380833809338103381133812338133381433815338163381733818338193382033821338223382333824338253382633827338283382933830338313383233833338343383533836338373383833839338403384133842338433384433845338463384733848338493385033851338523385333854338553385633857338583385933860338613386233863338643386533866338673386833869338703387133872338733387433875338763387733878338793388033881338823388333884338853388633887338883388933890338913389233893338943389533896338973389833899339003390133902339033390433905339063390733908339093391033911339123391333914339153391633917339183391933920339213392233923339243392533926339273392833929339303393133932339333393433935339363393733938339393394033941339423394333944339453394633947339483394933950339513395233953339543395533956339573395833959339603396133962339633396433965339663396733968339693397033971339723397333974339753397633977339783397933980339813398233983339843398533986339873398833989339903399133992339933399433995339963399733998339993400034001340023400334004340053400634007340083400934010340113401234013340143401534016340173401834019340203402134022340233402434025340263402734028340293403034031340323403334034340353403634037340383403934040340413404234043340443404534046340473404834049340503405134052340533405434055340563405734058340593406034061340623406334064340653406634067340683406934070340713407234073340743407534076340773407834079340803408134082340833408434085340863408734088340893409034091340923409334094340953409634097340983409934100341013410234103341043410534106341073410834109341103411134112341133411434115341163411734118341193412034121341223412334124341253412634127341283412934130341313413234133341343413534136341373413834139341403414134142341433414434145341463414734148341493415034151341523415334154341553415634157341583415934160341613416234163341643416534166341673416834169341703417134172341733417434175341763417734178341793418034181341823418334184341853418634187341883418934190341913419234193341943419534196341973419834199342003420134202342033420434205342063420734208342093421034211342123421334214342153421634217342183421934220342213422234223342243422534226342273422834229342303423134232342333423434235342363423734238342393424034241342423424334244342453424634247342483424934250342513425234253342543425534256342573425834259342603426134262342633426434265342663426734268342693427034271342723427334274342753427634277342783427934280342813428234283342843428534286342873428834289342903429134292342933429434295342963429734298342993430034301343023430334304343053430634307343083430934310343113431234313343143431534316343173431834319343203432134322343233432434325343263432734328343293433034331343323433334334343353433634337343383433934340343413434234343343443434534346343473434834349343503435134352343533435434355343563435734358343593436034361343623436334364343653436634367343683436934370343713437234373343743437534376343773437834379343803438134382343833438434385343863438734388343893439034391343923439334394343953439634397343983439934400344013440234403344043440534406344073440834409344103441134412344133441434415344163441734418344193442034421344223442334424344253442634427344283442934430344313443234433344343443534436344373443834439344403444134442344433444434445344463444734448344493445034451344523445334454344553445634457344583445934460344613446234463344643446534466344673446834469344703447134472344733447434475344763447734478344793448034481344823448334484344853448634487344883448934490344913449234493344943449534496344973449834499345003450134502345033450434505345063450734508345093451034511345123451334514345153451634517345183451934520345213452234523345243452534526345273452834529345303453134532345333453434535345363453734538345393454034541345423454334544345453454634547345483454934550345513455234553345543455534556345573455834559345603456134562345633456434565345663456734568345693457034571345723457334574345753457634577345783457934580345813458234583345843458534586345873458834589345903459134592345933459434595345963459734598345993460034601346023460334604346053460634607346083460934610346113461234613346143461534616346173461834619346203462134622346233462434625346263462734628346293463034631346323463334634346353463634637346383463934640346413464234643346443464534646346473464834649346503465134652346533465434655346563465734658346593466034661346623466334664346653466634667346683466934670346713467234673346743467534676346773467834679346803468134682346833468434685346863468734688346893469034691346923469334694346953469634697346983469934700347013470234703347043470534706347073470834709347103471134712347133471434715347163471734718347193472034721347223472334724347253472634727347283472934730347313473234733347343473534736347373473834739347403474134742347433474434745347463474734748347493475034751347523475334754347553475634757347583475934760347613476234763347643476534766347673476834769347703477134772347733477434775347763477734778347793478034781347823478334784347853478634787347883478934790347913479234793347943479534796347973479834799348003480134802348033480434805348063480734808348093481034811348123481334814348153481634817348183481934820348213482234823348243482534826348273482834829348303483134832348333483434835348363483734838348393484034841348423484334844348453484634847348483484934850348513485234853348543485534856348573485834859348603486134862348633486434865348663486734868348693487034871348723487334874348753487634877348783487934880348813488234883348843488534886348873488834889348903489134892348933489434895348963489734898348993490034901349023490334904349053490634907349083490934910349113491234913349143491534916349173491834919349203492134922349233492434925349263492734928349293493034931349323493334934349353493634937349383493934940349413494234943349443494534946349473494834949349503495134952349533495434955349563495734958349593496034961349623496334964349653496634967349683496934970349713497234973349743497534976349773497834979349803498134982349833498434985349863498734988349893499034991349923499334994349953499634997349983499935000350013500235003350043500535006350073500835009350103501135012350133501435015350163501735018350193502035021350223502335024350253502635027350283502935030350313503235033350343503535036350373503835039350403504135042350433504435045350463504735048350493505035051350523505335054350553505635057350583505935060350613506235063350643506535066350673506835069350703507135072350733507435075350763507735078350793508035081350823508335084350853508635087350883508935090350913509235093350943509535096350973509835099351003510135102351033510435105351063510735108351093511035111351123511335114351153511635117351183511935120351213512235123351243512535126351273512835129351303513135132351333513435135351363513735138351393514035141351423514335144351453514635147351483514935150351513515235153351543515535156351573515835159351603516135162351633516435165351663516735168351693517035171351723517335174351753517635177351783517935180351813518235183351843518535186351873518835189351903519135192351933519435195351963519735198351993520035201352023520335204352053520635207352083520935210352113521235213352143521535216352173521835219352203522135222352233522435225352263522735228352293523035231352323523335234352353523635237352383523935240352413524235243352443524535246352473524835249352503525135252352533525435255352563525735258352593526035261352623526335264352653526635267352683526935270352713527235273352743527535276352773527835279352803528135282352833528435285352863528735288352893529035291352923529335294352953529635297352983529935300353013530235303353043530535306353073530835309353103531135312353133531435315353163531735318353193532035321353223532335324353253532635327353283532935330353313533235333353343533535336353373533835339353403534135342353433534435345353463534735348353493535035351353523535335354353553535635357353583535935360353613536235363353643536535366353673536835369353703537135372353733537435375353763537735378353793538035381353823538335384353853538635387353883538935390353913539235393353943539535396353973539835399354003540135402354033540435405354063540735408354093541035411354123541335414354153541635417354183541935420354213542235423354243542535426354273542835429354303543135432354333543435435354363543735438354393544035441354423544335444354453544635447354483544935450354513545235453354543545535456354573545835459354603546135462354633546435465354663546735468354693547035471354723547335474354753547635477354783547935480354813548235483354843548535486354873548835489354903549135492354933549435495354963549735498354993550035501355023550335504355053550635507355083550935510355113551235513355143551535516355173551835519355203552135522355233552435525355263552735528355293553035531355323553335534355353553635537355383553935540355413554235543355443554535546355473554835549355503555135552355533555435555355563555735558355593556035561355623556335564355653556635567355683556935570355713557235573355743557535576355773557835579355803558135582355833558435585355863558735588355893559035591355923559335594355953559635597355983559935600356013560235603356043560535606356073560835609356103561135612356133561435615356163561735618356193562035621356223562335624356253562635627356283562935630356313563235633356343563535636356373563835639356403564135642356433564435645356463564735648356493565035651356523565335654356553565635657356583565935660356613566235663356643566535666356673566835669356703567135672356733567435675356763567735678356793568035681356823568335684356853568635687356883568935690356913569235693356943569535696356973569835699357003570135702357033570435705357063570735708357093571035711357123571335714357153571635717357183571935720357213572235723357243572535726357273572835729357303573135732357333573435735357363573735738357393574035741357423574335744357453574635747357483574935750357513575235753357543575535756357573575835759357603576135762357633576435765357663576735768357693577035771357723577335774357753577635777357783577935780357813578235783357843578535786357873578835789357903579135792357933579435795357963579735798357993580035801358023580335804358053580635807358083580935810358113581235813358143581535816358173581835819358203582135822358233582435825358263582735828358293583035831358323583335834358353583635837358383583935840358413584235843358443584535846358473584835849358503585135852358533585435855358563585735858358593586035861358623586335864358653586635867358683586935870358713587235873358743587535876358773587835879358803588135882358833588435885358863588735888358893589035891358923589335894358953589635897358983589935900359013590235903359043590535906359073590835909359103591135912359133591435915359163591735918359193592035921359223592335924359253592635927359283592935930359313593235933359343593535936359373593835939359403594135942359433594435945359463594735948359493595035951359523595335954359553595635957359583595935960359613596235963359643596535966359673596835969359703597135972359733597435975359763597735978359793598035981359823598335984359853598635987359883598935990359913599235993359943599535996359973599835999360003600136002360033600436005360063600736008360093601036011360123601336014360153601636017360183601936020360213602236023360243602536026360273602836029360303603136032360333603436035360363603736038360393604036041360423604336044360453604636047360483604936050360513605236053360543605536056360573605836059360603606136062360633606436065360663606736068360693607036071360723607336074360753607636077360783607936080360813608236083360843608536086360873608836089360903609136092360933609436095360963609736098360993610036101361023610336104361053610636107361083610936110361113611236113361143611536116361173611836119361203612136122361233612436125361263612736128361293613036131361323613336134361353613636137361383613936140361413614236143361443614536146361473614836149361503615136152361533615436155361563615736158361593616036161361623616336164361653616636167361683616936170361713617236173361743617536176361773617836179361803618136182361833618436185361863618736188361893619036191361923619336194361953619636197361983619936200362013620236203362043620536206362073620836209362103621136212362133621436215362163621736218362193622036221362223622336224362253622636227362283622936230362313623236233362343623536236362373623836239362403624136242362433624436245362463624736248362493625036251362523625336254362553625636257362583625936260362613626236263362643626536266362673626836269362703627136272362733627436275362763627736278362793628036281362823628336284362853628636287362883628936290362913629236293362943629536296362973629836299363003630136302363033630436305363063630736308363093631036311363123631336314363153631636317363183631936320363213632236323363243632536326363273632836329363303633136332363333633436335363363633736338363393634036341363423634336344363453634636347363483634936350363513635236353363543635536356363573635836359363603636136362363633636436365363663636736368363693637036371363723637336374363753637636377363783637936380363813638236383363843638536386363873638836389363903639136392363933639436395363963639736398363993640036401364023640336404364053640636407364083640936410364113641236413364143641536416364173641836419364203642136422364233642436425364263642736428364293643036431364323643336434364353643636437364383643936440364413644236443364443644536446364473644836449364503645136452364533645436455364563645736458364593646036461364623646336464364653646636467364683646936470364713647236473364743647536476364773647836479364803648136482364833648436485364863648736488364893649036491364923649336494364953649636497364983649936500365013650236503365043650536506365073650836509365103651136512365133651436515365163651736518365193652036521365223652336524365253652636527365283652936530365313653236533365343653536536365373653836539365403654136542365433654436545365463654736548365493655036551365523655336554365553655636557365583655936560365613656236563365643656536566365673656836569365703657136572365733657436575365763657736578365793658036581365823658336584365853658636587365883658936590365913659236593365943659536596365973659836599366003660136602366033660436605366063660736608366093661036611366123661336614366153661636617366183661936620366213662236623366243662536626366273662836629366303663136632366333663436635366363663736638366393664036641366423664336644366453664636647366483664936650366513665236653366543665536656366573665836659366603666136662366633666436665366663666736668366693667036671366723667336674366753667636677366783667936680366813668236683366843668536686366873668836689366903669136692366933669436695366963669736698366993670036701367023670336704367053670636707367083670936710367113671236713367143671536716367173671836719367203672136722367233672436725367263672736728367293673036731367323673336734367353673636737367383673936740367413674236743367443674536746367473674836749367503675136752367533675436755367563675736758367593676036761367623676336764367653676636767367683676936770367713677236773367743677536776367773677836779367803678136782367833678436785367863678736788367893679036791367923679336794367953679636797367983679936800368013680236803368043680536806368073680836809368103681136812368133681436815368163681736818368193682036821368223682336824368253682636827368283682936830368313683236833368343683536836368373683836839368403684136842368433684436845368463684736848368493685036851368523685336854368553685636857368583685936860368613686236863368643686536866368673686836869368703687136872368733687436875368763687736878368793688036881368823688336884368853688636887368883688936890368913689236893368943689536896368973689836899369003690136902369033690436905369063690736908369093691036911369123691336914369153691636917369183691936920369213692236923369243692536926369273692836929369303693136932369333693436935369363693736938369393694036941369423694336944369453694636947369483694936950369513695236953369543695536956369573695836959369603696136962369633696436965369663696736968369693697036971369723697336974369753697636977369783697936980369813698236983369843698536986369873698836989369903699136992369933699436995369963699736998369993700037001370023700337004370053700637007370083700937010370113701237013370143701537016370173701837019370203702137022370233702437025370263702737028370293703037031370323703337034370353703637037370383703937040370413704237043370443704537046370473704837049370503705137052370533705437055370563705737058370593706037061370623706337064370653706637067370683706937070370713707237073370743707537076370773707837079370803708137082370833708437085370863708737088370893709037091370923709337094370953709637097370983709937100371013710237103371043710537106371073710837109371103711137112371133711437115371163711737118371193712037121371223712337124371253712637127371283712937130371313713237133371343713537136371373713837139371403714137142371433714437145371463714737148371493715037151371523715337154371553715637157371583715937160371613716237163371643716537166371673716837169371703717137172371733717437175371763717737178371793718037181371823718337184371853718637187371883718937190371913719237193371943719537196371973719837199372003720137202372033720437205372063720737208372093721037211372123721337214372153721637217372183721937220372213722237223372243722537226372273722837229372303723137232372333723437235372363723737238372393724037241372423724337244372453724637247372483724937250372513725237253372543725537256372573725837259372603726137262372633726437265372663726737268372693727037271372723727337274372753727637277372783727937280372813728237283372843728537286372873728837289372903729137292372933729437295372963729737298372993730037301373023730337304373053730637307373083730937310373113731237313373143731537316373173731837319373203732137322373233732437325373263732737328373293733037331373323733337334373353733637337373383733937340373413734237343373443734537346373473734837349373503735137352373533735437355373563735737358373593736037361373623736337364373653736637367373683736937370373713737237373373743737537376373773737837379373803738137382373833738437385373863738737388373893739037391373923739337394373953739637397373983739937400374013740237403374043740537406374073740837409374103741137412374133741437415374163741737418374193742037421374223742337424374253742637427374283742937430374313743237433374343743537436374373743837439374403744137442374433744437445374463744737448374493745037451374523745337454374553745637457374583745937460374613746237463374643746537466374673746837469374703747137472374733747437475374763747737478374793748037481374823748337484374853748637487374883748937490374913749237493374943749537496374973749837499375003750137502375033750437505375063750737508375093751037511375123751337514375153751637517375183751937520375213752237523375243752537526375273752837529375303753137532375333753437535375363753737538375393754037541375423754337544375453754637547375483754937550375513755237553375543755537556375573755837559375603756137562375633756437565375663756737568375693757037571375723757337574375753757637577375783757937580375813758237583375843758537586375873758837589375903759137592375933759437595375963759737598375993760037601376023760337604376053760637607376083760937610376113761237613376143761537616376173761837619376203762137622376233762437625376263762737628376293763037631376323763337634376353763637637376383763937640376413764237643376443764537646376473764837649376503765137652376533765437655376563765737658376593766037661376623766337664376653766637667376683766937670376713767237673376743767537676376773767837679376803768137682376833768437685376863768737688376893769037691376923769337694376953769637697376983769937700377013770237703377043770537706377073770837709377103771137712377133771437715377163771737718377193772037721377223772337724377253772637727377283772937730377313773237733377343773537736377373773837739377403774137742377433774437745377463774737748377493775037751377523775337754377553775637757377583775937760377613776237763377643776537766377673776837769377703777137772377733777437775377763777737778377793778037781377823778337784377853778637787377883778937790377913779237793377943779537796377973779837799378003780137802378033780437805378063780737808378093781037811378123781337814378153781637817378183781937820378213782237823378243782537826378273782837829378303783137832378333783437835378363783737838378393784037841378423784337844378453784637847378483784937850378513785237853378543785537856378573785837859378603786137862378633786437865378663786737868378693787037871378723787337874378753787637877378783787937880378813788237883378843788537886378873788837889378903789137892378933789437895378963789737898378993790037901379023790337904379053790637907379083790937910379113791237913379143791537916379173791837919379203792137922379233792437925379263792737928379293793037931379323793337934379353793637937379383793937940379413794237943379443794537946379473794837949379503795137952379533795437955379563795737958379593796037961379623796337964379653796637967379683796937970379713797237973379743797537976379773797837979379803798137982379833798437985379863798737988379893799037991379923799337994379953799637997379983799938000380013800238003380043800538006380073800838009380103801138012380133801438015380163801738018380193802038021380223802338024380253802638027380283802938030380313803238033380343803538036380373803838039380403804138042380433804438045380463804738048380493805038051380523805338054380553805638057380583805938060380613806238063380643806538066380673806838069380703807138072380733807438075380763807738078380793808038081380823808338084380853808638087380883808938090380913809238093380943809538096380973809838099381003810138102381033810438105381063810738108381093811038111381123811338114381153811638117381183811938120381213812238123381243812538126381273812838129381303813138132381333813438135381363813738138381393814038141381423814338144381453814638147381483814938150381513815238153381543815538156381573815838159381603816138162381633816438165381663816738168381693817038171381723817338174381753817638177381783817938180381813818238183381843818538186381873818838189381903819138192381933819438195381963819738198381993820038201382023820338204382053820638207382083820938210382113821238213382143821538216382173821838219382203822138222382233822438225382263822738228382293823038231382323823338234382353823638237382383823938240382413824238243382443824538246382473824838249382503825138252382533825438255382563825738258382593826038261382623826338264382653826638267382683826938270382713827238273382743827538276382773827838279382803828138282382833828438285382863828738288382893829038291382923829338294382953829638297382983829938300383013830238303383043830538306383073830838309383103831138312383133831438315383163831738318383193832038321383223832338324383253832638327383283832938330383313833238333383343833538336383373833838339383403834138342383433834438345383463834738348383493835038351383523835338354383553835638357383583835938360383613836238363383643836538366383673836838369383703837138372383733837438375383763837738378383793838038381383823838338384383853838638387383883838938390383913839238393383943839538396383973839838399384003840138402384033840438405384063840738408384093841038411384123841338414384153841638417384183841938420384213842238423384243842538426384273842838429384303843138432384333843438435384363843738438384393844038441384423844338444384453844638447384483844938450384513845238453384543845538456384573845838459384603846138462384633846438465384663846738468384693847038471384723847338474384753847638477384783847938480384813848238483384843848538486384873848838489384903849138492384933849438495384963849738498384993850038501385023850338504385053850638507385083850938510385113851238513385143851538516385173851838519385203852138522385233852438525385263852738528385293853038531385323853338534385353853638537385383853938540385413854238543385443854538546385473854838549385503855138552385533855438555385563855738558385593856038561385623856338564385653856638567385683856938570385713857238573385743857538576385773857838579385803858138582385833858438585385863858738588385893859038591385923859338594385953859638597385983859938600386013860238603386043860538606386073860838609386103861138612386133861438615386163861738618386193862038621386223862338624386253862638627386283862938630386313863238633386343863538636386373863838639386403864138642386433864438645386463864738648386493865038651386523865338654386553865638657386583865938660386613866238663386643866538666386673866838669386703867138672386733867438675386763867738678386793868038681386823868338684386853868638687386883868938690386913869238693386943869538696386973869838699387003870138702387033870438705387063870738708387093871038711387123871338714387153871638717387183871938720387213872238723387243872538726387273872838729387303873138732387333873438735387363873738738387393874038741387423874338744387453874638747387483874938750387513875238753387543875538756387573875838759387603876138762387633876438765387663876738768387693877038771387723877338774387753877638777387783877938780387813878238783387843878538786387873878838789387903879138792387933879438795387963879738798387993880038801388023880338804388053880638807388083880938810388113881238813388143881538816388173881838819388203882138822388233882438825388263882738828388293883038831388323883338834388353883638837388383883938840388413884238843388443884538846388473884838849388503885138852388533885438855388563885738858388593886038861388623886338864388653886638867388683886938870388713887238873388743887538876388773887838879388803888138882388833888438885388863888738888388893889038891388923889338894388953889638897388983889938900389013890238903389043890538906389073890838909389103891138912389133891438915389163891738918389193892038921389223892338924389253892638927389283892938930389313893238933389343893538936389373893838939389403894138942389433894438945389463894738948389493895038951389523895338954389553895638957389583895938960389613896238963389643896538966389673896838969389703897138972389733897438975389763897738978389793898038981389823898338984389853898638987389883898938990389913899238993389943899538996389973899838999390003900139002390033900439005390063900739008390093901039011390123901339014390153901639017390183901939020390213902239023390243902539026390273902839029390303903139032390333903439035390363903739038390393904039041390423904339044390453904639047390483904939050390513905239053390543905539056390573905839059390603906139062390633906439065390663906739068390693907039071390723907339074390753907639077390783907939080390813908239083390843908539086390873908839089390903909139092390933909439095390963909739098390993910039101391023910339104391053910639107391083910939110391113911239113391143911539116391173911839119391203912139122391233912439125391263912739128391293913039131391323913339134391353913639137391383913939140391413914239143391443914539146391473914839149391503915139152391533915439155391563915739158391593916039161391623916339164391653916639167391683916939170391713917239173391743917539176391773917839179391803918139182391833918439185391863918739188391893919039191391923919339194391953919639197391983919939200392013920239203392043920539206392073920839209392103921139212392133921439215392163921739218392193922039221392223922339224392253922639227392283922939230392313923239233392343923539236392373923839239392403924139242392433924439245392463924739248392493925039251392523925339254392553925639257392583925939260392613926239263392643926539266392673926839269392703927139272392733927439275392763927739278392793928039281392823928339284392853928639287392883928939290392913929239293392943929539296392973929839299393003930139302393033930439305393063930739308393093931039311393123931339314393153931639317393183931939320393213932239323393243932539326393273932839329393303933139332393333933439335393363933739338393393934039341393423934339344393453934639347393483934939350393513935239353393543935539356393573935839359393603936139362393633936439365393663936739368393693937039371393723937339374393753937639377393783937939380393813938239383393843938539386393873938839389393903939139392393933939439395393963939739398393993940039401394023940339404394053940639407394083940939410394113941239413394143941539416394173941839419394203942139422394233942439425394263942739428394293943039431394323943339434394353943639437394383943939440394413944239443394443944539446394473944839449394503945139452394533945439455394563945739458394593946039461394623946339464394653946639467394683946939470394713947239473394743947539476394773947839479394803948139482394833948439485394863948739488394893949039491394923949339494394953949639497394983949939500395013950239503395043950539506395073950839509395103951139512395133951439515395163951739518395193952039521395223952339524395253952639527395283952939530395313953239533395343953539536395373953839539395403954139542395433954439545395463954739548395493955039551395523955339554395553955639557395583955939560395613956239563395643956539566395673956839569395703957139572395733957439575395763957739578395793958039581395823958339584395853958639587395883958939590395913959239593395943959539596395973959839599396003960139602396033960439605396063960739608396093961039611396123961339614396153961639617396183961939620396213962239623396243962539626396273962839629396303963139632396333963439635396363963739638396393964039641396423964339644396453964639647396483964939650396513965239653396543965539656396573965839659396603966139662396633966439665396663966739668396693967039671396723967339674396753967639677396783967939680396813968239683396843968539686396873968839689396903969139692396933969439695396963969739698396993970039701397023970339704397053970639707397083970939710397113971239713397143971539716397173971839719397203972139722397233972439725397263972739728397293973039731397323973339734397353973639737397383973939740397413974239743397443974539746397473974839749397503975139752397533975439755397563975739758397593976039761397623976339764397653976639767397683976939770397713977239773397743977539776397773977839779397803978139782397833978439785397863978739788397893979039791397923979339794397953979639797397983979939800398013980239803398043980539806398073980839809398103981139812398133981439815398163981739818398193982039821398223982339824398253982639827398283982939830398313983239833398343983539836398373983839839398403984139842398433984439845398463984739848398493985039851398523985339854398553985639857398583985939860398613986239863398643986539866398673986839869398703987139872398733987439875398763987739878398793988039881398823988339884398853988639887398883988939890398913989239893398943989539896398973989839899399003990139902399033990439905399063990739908399093991039911399123991339914399153991639917399183991939920399213992239923399243992539926399273992839929399303993139932399333993439935399363993739938399393994039941399423994339944399453994639947399483994939950399513995239953399543995539956399573995839959399603996139962399633996439965399663996739968399693997039971399723997339974399753997639977399783997939980399813998239983399843998539986399873998839989399903999139992399933999439995399963999739998399994000040001400024000340004400054000640007400084000940010400114001240013400144001540016400174001840019400204002140022400234002440025400264002740028400294003040031400324003340034400354003640037400384003940040400414004240043400444004540046400474004840049400504005140052400534005440055400564005740058400594006040061400624006340064400654006640067400684006940070400714007240073400744007540076400774007840079400804008140082400834008440085400864008740088400894009040091400924009340094400954009640097400984009940100401014010240103401044010540106401074010840109401104011140112401134011440115401164011740118401194012040121401224012340124401254012640127401284012940130401314013240133401344013540136401374013840139401404014140142401434014440145401464014740148401494015040151401524015340154401554015640157401584015940160401614016240163401644016540166401674016840169401704017140172401734017440175401764017740178401794018040181401824018340184401854018640187401884018940190401914019240193401944019540196401974019840199402004020140202402034020440205402064020740208402094021040211402124021340214402154021640217402184021940220402214022240223402244022540226402274022840229402304023140232402334023440235402364023740238402394024040241402424024340244402454024640247402484024940250402514025240253402544025540256402574025840259402604026140262402634026440265402664026740268402694027040271402724027340274402754027640277402784027940280402814028240283402844028540286402874028840289402904029140292402934029440295402964029740298402994030040301403024030340304403054030640307403084030940310403114031240313403144031540316403174031840319403204032140322403234032440325403264032740328403294033040331403324033340334403354033640337403384033940340403414034240343403444034540346403474034840349403504035140352403534035440355403564035740358403594036040361403624036340364403654036640367403684036940370403714037240373403744037540376403774037840379403804038140382403834038440385403864038740388403894039040391403924039340394403954039640397403984039940400404014040240403404044040540406404074040840409404104041140412404134041440415404164041740418404194042040421404224042340424404254042640427404284042940430404314043240433404344043540436404374043840439404404044140442404434044440445404464044740448404494045040451404524045340454404554045640457404584045940460404614046240463404644046540466404674046840469404704047140472404734047440475404764047740478404794048040481404824048340484404854048640487404884048940490404914049240493404944049540496404974049840499405004050140502405034050440505405064050740508405094051040511405124051340514405154051640517405184051940520405214052240523405244052540526405274052840529405304053140532405334053440535405364053740538405394054040541405424054340544405454054640547405484054940550405514055240553405544055540556405574055840559405604056140562405634056440565405664056740568405694057040571405724057340574405754057640577405784057940580405814058240583405844058540586405874058840589405904059140592405934059440595405964059740598405994060040601406024060340604406054060640607406084060940610406114061240613406144061540616406174061840619406204062140622406234062440625406264062740628406294063040631406324063340634406354063640637406384063940640406414064240643406444064540646406474064840649406504065140652406534065440655406564065740658406594066040661406624066340664406654066640667406684066940670406714067240673406744067540676406774067840679406804068140682406834068440685406864068740688406894069040691406924069340694406954069640697406984069940700407014070240703407044070540706407074070840709407104071140712407134071440715407164071740718407194072040721407224072340724407254072640727407284072940730407314073240733407344073540736407374073840739407404074140742407434074440745407464074740748407494075040751407524075340754407554075640757407584075940760407614076240763407644076540766407674076840769407704077140772407734077440775407764077740778407794078040781407824078340784407854078640787407884078940790407914079240793407944079540796407974079840799408004080140802408034080440805408064080740808408094081040811408124081340814408154081640817408184081940820408214082240823408244082540826408274082840829408304083140832408334083440835408364083740838408394084040841408424084340844408454084640847408484084940850408514085240853408544085540856408574085840859408604086140862408634086440865408664086740868408694087040871408724087340874408754087640877408784087940880408814088240883408844088540886408874088840889408904089140892408934089440895408964089740898408994090040901409024090340904409054090640907409084090940910409114091240913409144091540916409174091840919409204092140922409234092440925409264092740928409294093040931409324093340934409354093640937409384093940940409414094240943409444094540946409474094840949409504095140952409534095440955409564095740958409594096040961409624096340964409654096640967409684096940970409714097240973409744097540976409774097840979409804098140982409834098440985409864098740988409894099040991409924099340994409954099640997409984099941000410014100241003410044100541006410074100841009410104101141012410134101441015410164101741018410194102041021410224102341024410254102641027410284102941030410314103241033410344103541036410374103841039410404104141042410434104441045410464104741048410494105041051410524105341054410554105641057410584105941060410614106241063410644106541066410674106841069410704107141072410734107441075410764107741078410794108041081410824108341084410854108641087410884108941090410914109241093410944109541096410974109841099411004110141102411034110441105411064110741108411094111041111411124111341114411154111641117411184111941120411214112241123411244112541126411274112841129411304113141132411334113441135411364113741138411394114041141411424114341144411454114641147411484114941150411514115241153411544115541156411574115841159411604116141162411634116441165411664116741168411694117041171411724117341174411754117641177411784117941180411814118241183411844118541186411874118841189411904119141192411934119441195411964119741198411994120041201412024120341204412054120641207412084120941210412114121241213412144121541216412174121841219412204122141222412234122441225412264122741228412294123041231412324123341234412354123641237412384123941240412414124241243412444124541246412474124841249412504125141252412534125441255412564125741258412594126041261412624126341264412654126641267412684126941270412714127241273412744127541276412774127841279412804128141282412834128441285412864128741288412894129041291412924129341294412954129641297412984129941300413014130241303413044130541306413074130841309413104131141312413134131441315413164131741318413194132041321413224132341324413254132641327413284132941330413314133241333413344133541336413374133841339413404134141342413434134441345413464134741348413494135041351413524135341354413554135641357413584135941360413614136241363413644136541366413674136841369413704137141372413734137441375413764137741378413794138041381413824138341384413854138641387413884138941390413914139241393413944139541396413974139841399414004140141402414034140441405414064140741408414094141041411414124141341414414154141641417414184141941420414214142241423414244142541426414274142841429414304143141432414334143441435414364143741438414394144041441414424144341444414454144641447414484144941450414514145241453414544145541456414574145841459414604146141462414634146441465414664146741468414694147041471414724147341474414754147641477414784147941480414814148241483414844148541486414874148841489414904149141492414934149441495414964149741498414994150041501415024150341504415054150641507415084150941510415114151241513415144151541516415174151841519415204152141522415234152441525415264152741528415294153041531415324153341534415354153641537415384153941540415414154241543415444154541546415474154841549415504155141552415534155441555415564155741558415594156041561415624156341564415654156641567415684156941570415714157241573415744157541576415774157841579415804158141582415834158441585415864158741588415894159041591415924159341594415954159641597415984159941600416014160241603416044160541606416074160841609416104161141612416134161441615416164161741618416194162041621416224162341624416254162641627416284162941630416314163241633416344163541636416374163841639416404164141642416434164441645416464164741648416494165041651416524165341654416554165641657416584165941660416614166241663416644166541666416674166841669416704167141672416734167441675416764167741678416794168041681416824168341684416854168641687416884168941690416914169241693416944169541696416974169841699417004170141702417034170441705417064170741708417094171041711417124171341714417154171641717417184171941720417214172241723417244172541726417274172841729417304173141732417334173441735417364173741738417394174041741417424174341744417454174641747417484174941750417514175241753417544175541756417574175841759417604176141762417634176441765417664176741768417694177041771417724177341774417754177641777417784177941780417814178241783417844178541786417874178841789417904179141792417934179441795417964179741798417994180041801418024180341804418054180641807418084180941810418114181241813418144181541816418174181841819418204182141822418234182441825418264182741828418294183041831418324183341834418354183641837418384183941840418414184241843418444184541846418474184841849418504185141852418534185441855418564185741858418594186041861418624186341864418654186641867418684186941870418714187241873418744187541876418774187841879418804188141882418834188441885418864188741888418894189041891418924189341894418954189641897418984189941900419014190241903419044190541906419074190841909419104191141912419134191441915419164191741918419194192041921419224192341924419254192641927419284192941930419314193241933419344193541936419374193841939419404194141942419434194441945419464194741948419494195041951419524195341954419554195641957419584195941960419614196241963419644196541966419674196841969419704197141972419734197441975419764197741978419794198041981419824198341984419854198641987419884198941990419914199241993419944199541996419974199841999420004200142002420034200442005420064200742008420094201042011420124201342014420154201642017420184201942020420214202242023420244202542026420274202842029420304203142032420334203442035420364203742038420394204042041420424204342044420454204642047420484204942050420514205242053420544205542056420574205842059420604206142062420634206442065420664206742068420694207042071420724207342074420754207642077420784207942080420814208242083420844208542086420874208842089420904209142092420934209442095420964209742098420994210042101421024210342104421054210642107421084210942110421114211242113421144211542116421174211842119421204212142122421234212442125421264212742128421294213042131421324213342134421354213642137421384213942140421414214242143421444214542146421474214842149421504215142152421534215442155421564215742158421594216042161421624216342164421654216642167421684216942170421714217242173421744217542176421774217842179421804218142182421834218442185421864218742188421894219042191421924219342194421954219642197421984219942200422014220242203422044220542206422074220842209422104221142212422134221442215422164221742218422194222042221422224222342224422254222642227422284222942230422314223242233422344223542236422374223842239422404224142242422434224442245422464224742248422494225042251422524225342254422554225642257422584225942260422614226242263422644226542266422674226842269422704227142272422734227442275422764227742278422794228042281422824228342284422854228642287422884228942290422914229242293422944229542296422974229842299423004230142302423034230442305423064230742308423094231042311423124231342314423154231642317423184231942320423214232242323423244232542326423274232842329423304233142332423334233442335423364233742338423394234042341423424234342344423454234642347423484234942350423514235242353423544235542356423574235842359423604236142362423634236442365423664236742368423694237042371423724237342374423754237642377423784237942380423814238242383423844238542386423874238842389423904239142392423934239442395423964239742398423994240042401424024240342404424054240642407424084240942410424114241242413424144241542416424174241842419424204242142422424234242442425424264242742428424294243042431424324243342434424354243642437424384243942440424414244242443424444244542446424474244842449424504245142452424534245442455424564245742458424594246042461424624246342464424654246642467424684246942470424714247242473424744247542476424774247842479424804248142482424834248442485424864248742488424894249042491424924249342494424954249642497424984249942500425014250242503425044250542506425074250842509425104251142512425134251442515425164251742518425194252042521425224252342524425254252642527425284252942530425314253242533425344253542536425374253842539425404254142542425434254442545425464254742548425494255042551425524255342554425554255642557425584255942560425614256242563425644256542566425674256842569425704257142572425734257442575425764257742578425794258042581425824258342584425854258642587425884258942590425914259242593425944259542596425974259842599426004260142602426034260442605426064260742608426094261042611426124261342614426154261642617426184261942620426214262242623426244262542626426274262842629426304263142632426334263442635426364263742638426394264042641426424264342644426454264642647426484264942650426514265242653426544265542656426574265842659426604266142662426634266442665426664266742668426694267042671426724267342674426754267642677426784267942680426814268242683426844268542686426874268842689426904269142692426934269442695426964269742698426994270042701427024270342704427054270642707427084270942710427114271242713427144271542716427174271842719427204272142722427234272442725427264272742728427294273042731427324273342734427354273642737427384273942740427414274242743427444274542746427474274842749427504275142752427534275442755427564275742758427594276042761427624276342764427654276642767427684276942770427714277242773427744277542776427774277842779427804278142782427834278442785427864278742788427894279042791427924279342794427954279642797427984279942800428014280242803428044280542806428074280842809428104281142812428134281442815428164281742818428194282042821428224282342824428254282642827428284282942830428314283242833428344283542836428374283842839428404284142842428434284442845428464284742848428494285042851428524285342854428554285642857428584285942860428614286242863428644286542866428674286842869428704287142872428734287442875428764287742878428794288042881428824288342884428854288642887428884288942890428914289242893428944289542896428974289842899429004290142902429034290442905429064290742908429094291042911429124291342914429154291642917429184291942920429214292242923429244292542926429274292842929429304293142932429334293442935429364293742938429394294042941429424294342944429454294642947429484294942950429514295242953429544295542956429574295842959429604296142962429634296442965429664296742968429694297042971429724297342974429754297642977429784297942980429814298242983429844298542986429874298842989429904299142992429934299442995429964299742998429994300043001430024300343004430054300643007430084300943010430114301243013430144301543016430174301843019430204302143022430234302443025430264302743028430294303043031430324303343034430354303643037430384303943040430414304243043430444304543046430474304843049430504305143052430534305443055430564305743058430594306043061430624306343064430654306643067430684306943070430714307243073430744307543076430774307843079430804308143082430834308443085430864308743088430894309043091430924309343094430954309643097430984309943100431014310243103431044310543106431074310843109431104311143112431134311443115431164311743118431194312043121431224312343124431254312643127431284312943130431314313243133431344313543136431374313843139431404314143142431434314443145431464314743148431494315043151431524315343154431554315643157431584315943160431614316243163431644316543166431674316843169431704317143172431734317443175431764317743178431794318043181431824318343184431854318643187431884318943190431914319243193431944319543196431974319843199432004320143202432034320443205432064320743208432094321043211432124321343214432154321643217432184321943220432214322243223432244322543226432274322843229432304323143232432334323443235432364323743238432394324043241432424324343244432454324643247432484324943250432514325243253432544325543256432574325843259432604326143262432634326443265432664326743268432694327043271432724327343274432754327643277432784327943280432814328243283432844328543286432874328843289432904329143292432934329443295432964329743298432994330043301433024330343304433054330643307433084330943310433114331243313433144331543316433174331843319433204332143322433234332443325433264332743328433294333043331433324333343334433354333643337433384333943340433414334243343433444334543346433474334843349433504335143352433534335443355433564335743358433594336043361433624336343364433654336643367433684336943370433714337243373433744337543376433774337843379433804338143382433834338443385433864338743388433894339043391433924339343394433954339643397433984339943400434014340243403434044340543406434074340843409434104341143412434134341443415434164341743418434194342043421434224342343424434254342643427434284342943430434314343243433434344343543436434374343843439434404344143442434434344443445434464344743448434494345043451434524345343454434554345643457434584345943460434614346243463434644346543466434674346843469434704347143472434734347443475434764347743478434794348043481434824348343484434854348643487434884348943490434914349243493434944349543496434974349843499435004350143502435034350443505435064350743508435094351043511435124351343514435154351643517435184351943520435214352243523435244352543526435274352843529435304353143532435334353443535435364353743538435394354043541435424354343544435454354643547435484354943550435514355243553435544355543556435574355843559435604356143562435634356443565435664356743568435694357043571435724357343574435754357643577435784357943580435814358243583435844358543586435874358843589435904359143592435934359443595435964359743598435994360043601436024360343604436054360643607436084360943610436114361243613436144361543616436174361843619436204362143622436234362443625436264362743628436294363043631436324363343634436354363643637436384363943640436414364243643436444364543646436474364843649436504365143652436534365443655436564365743658436594366043661436624366343664436654366643667436684366943670436714367243673436744367543676436774367843679436804368143682436834368443685436864368743688436894369043691436924369343694436954369643697436984369943700437014370243703437044370543706437074370843709437104371143712437134371443715437164371743718437194372043721437224372343724437254372643727437284372943730437314373243733437344373543736437374373843739437404374143742437434374443745437464374743748437494375043751437524375343754437554375643757437584375943760437614376243763437644376543766437674376843769437704377143772437734377443775437764377743778437794378043781437824378343784437854378643787437884378943790437914379243793437944379543796437974379843799438004380143802438034380443805438064380743808438094381043811438124381343814438154381643817438184381943820438214382243823438244382543826438274382843829438304383143832438334383443835438364383743838438394384043841438424384343844438454384643847438484384943850438514385243853438544385543856438574385843859438604386143862438634386443865438664386743868438694387043871438724387343874438754387643877438784387943880438814388243883438844388543886438874388843889438904389143892438934389443895438964389743898438994390043901439024390343904439054390643907439084390943910439114391243913439144391543916439174391843919439204392143922439234392443925439264392743928439294393043931439324393343934439354393643937439384393943940439414394243943439444394543946439474394843949439504395143952439534395443955439564395743958439594396043961439624396343964439654396643967439684396943970439714397243973439744397543976439774397843979439804398143982439834398443985439864398743988439894399043991439924399343994439954399643997439984399944000440014400244003440044400544006440074400844009440104401144012440134401444015440164401744018440194402044021440224402344024440254402644027440284402944030440314403244033440344403544036440374403844039440404404144042440434404444045440464404744048440494405044051440524405344054440554405644057440584405944060440614406244063440644406544066440674406844069440704407144072440734407444075440764407744078440794408044081440824408344084440854408644087440884408944090440914409244093440944409544096440974409844099441004410144102441034410444105441064410744108441094411044111441124411344114441154411644117441184411944120441214412244123441244412544126441274412844129441304413144132441334413444135441364413744138441394414044141441424414344144441454414644147441484414944150441514415244153441544415544156441574415844159441604416144162441634416444165441664416744168441694417044171441724417344174441754417644177441784417944180441814418244183441844418544186441874418844189441904419144192441934419444195441964419744198441994420044201442024420344204442054420644207442084420944210442114421244213442144421544216442174421844219442204422144222442234422444225442264422744228442294423044231442324423344234442354423644237442384423944240442414424244243442444424544246442474424844249442504425144252442534425444255442564425744258442594426044261442624426344264442654426644267442684426944270442714427244273442744427544276442774427844279442804428144282442834428444285442864428744288442894429044291442924429344294442954429644297442984429944300443014430244303443044430544306443074430844309443104431144312443134431444315443164431744318443194432044321443224432344324443254432644327443284432944330443314433244333443344433544336443374433844339443404434144342443434434444345443464434744348443494435044351443524435344354443554435644357443584435944360443614436244363443644436544366443674436844369443704437144372443734437444375443764437744378443794438044381443824438344384443854438644387443884438944390443914439244393443944439544396443974439844399444004440144402444034440444405444064440744408444094441044411444124441344414444154441644417444184441944420444214442244423444244442544426444274442844429444304443144432444334443444435444364443744438444394444044441444424444344444444454444644447444484444944450444514445244453444544445544456444574445844459444604446144462444634446444465444664446744468444694447044471444724447344474444754447644477444784447944480444814448244483444844448544486444874448844489444904449144492444934449444495444964449744498444994450044501445024450344504445054450644507445084450944510445114451244513445144451544516445174451844519445204452144522445234452444525445264452744528445294453044531445324453344534445354453644537445384453944540445414454244543445444454544546445474454844549445504455144552445534455444555445564455744558445594456044561445624456344564445654456644567445684456944570445714457244573445744457544576445774457844579445804458144582445834458444585445864458744588445894459044591445924459344594445954459644597445984459944600446014460244603446044460544606446074460844609446104461144612446134461444615446164461744618446194462044621446224462344624446254462644627446284462944630446314463244633446344463544636446374463844639446404464144642446434464444645446464464744648446494465044651446524465344654446554465644657446584465944660446614466244663446644466544666446674466844669446704467144672446734467444675446764467744678446794468044681446824468344684446854468644687446884468944690446914469244693446944469544696446974469844699447004470144702447034470444705447064470744708447094471044711447124471344714447154471644717447184471944720447214472244723447244472544726447274472844729447304473144732447334473444735447364473744738447394474044741447424474344744447454474644747447484474944750447514475244753447544475544756447574475844759447604476144762447634476444765447664476744768447694477044771447724477344774447754477644777447784477944780447814478244783447844478544786447874478844789447904479144792447934479444795447964479744798447994480044801448024480344804448054480644807448084480944810448114481244813448144481544816448174481844819448204482144822448234482444825448264482744828448294483044831448324483344834448354483644837448384483944840448414484244843448444484544846448474484844849448504485144852448534485444855448564485744858448594486044861448624486344864448654486644867448684486944870448714487244873448744487544876448774487844879448804488144882448834488444885448864488744888448894489044891448924489344894448954489644897448984489944900449014490244903449044490544906449074490844909449104491144912449134491444915449164491744918449194492044921449224492344924449254492644927449284492944930449314493244933449344493544936449374493844939449404494144942449434494444945449464494744948449494495044951449524495344954449554495644957449584495944960449614496244963449644496544966449674496844969449704497144972449734497444975449764497744978449794498044981449824498344984449854498644987449884498944990449914499244993449944499544996449974499844999450004500145002450034500445005450064500745008450094501045011450124501345014450154501645017450184501945020450214502245023450244502545026450274502845029450304503145032450334503445035450364503745038450394504045041450424504345044450454504645047450484504945050450514505245053450544505545056450574505845059450604506145062450634506445065450664506745068450694507045071450724507345074450754507645077450784507945080450814508245083450844508545086450874508845089450904509145092450934509445095450964509745098450994510045101451024510345104451054510645107451084510945110451114511245113451144511545116451174511845119451204512145122451234512445125451264512745128451294513045131451324513345134451354513645137451384513945140451414514245143451444514545146451474514845149451504515145152451534515445155451564515745158451594516045161451624516345164451654516645167451684516945170451714517245173451744517545176451774517845179451804518145182451834518445185451864518745188451894519045191451924519345194451954519645197451984519945200452014520245203452044520545206452074520845209452104521145212452134521445215452164521745218452194522045221452224522345224452254522645227452284522945230452314523245233452344523545236452374523845239452404524145242452434524445245452464524745248452494525045251452524525345254452554525645257452584525945260452614526245263452644526545266452674526845269452704527145272452734527445275452764527745278452794528045281452824528345284452854528645287452884528945290452914529245293452944529545296452974529845299453004530145302453034530445305453064530745308453094531045311453124531345314453154531645317453184531945320453214532245323453244532545326453274532845329453304533145332453334533445335453364533745338453394534045341453424534345344453454534645347453484534945350453514535245353453544535545356453574535845359453604536145362453634536445365453664536745368453694537045371453724537345374453754537645377453784537945380453814538245383453844538545386453874538845389453904539145392453934539445395453964539745398453994540045401454024540345404454054540645407454084540945410454114541245413454144541545416454174541845419454204542145422454234542445425454264542745428454294543045431454324543345434454354543645437454384543945440454414544245443454444544545446454474544845449454504545145452454534545445455454564545745458454594546045461454624546345464454654546645467454684546945470454714547245473454744547545476454774547845479454804548145482454834548445485454864548745488454894549045491454924549345494454954549645497454984549945500455014550245503455044550545506455074550845509455104551145512455134551445515455164551745518455194552045521455224552345524455254552645527455284552945530455314553245533455344553545536455374553845539455404554145542455434554445545455464554745548455494555045551455524555345554455554555645557455584555945560455614556245563455644556545566455674556845569455704557145572455734557445575455764557745578455794558045581455824558345584455854558645587455884558945590455914559245593455944559545596455974559845599456004560145602456034560445605456064560745608456094561045611456124561345614456154561645617456184561945620456214562245623456244562545626456274562845629456304563145632456334563445635456364563745638456394564045641456424564345644456454564645647456484564945650456514565245653456544565545656456574565845659456604566145662456634566445665456664566745668456694567045671456724567345674456754567645677456784567945680456814568245683456844568545686456874568845689456904569145692456934569445695456964569745698456994570045701457024570345704457054570645707457084570945710457114571245713457144571545716457174571845719457204572145722457234572445725457264572745728457294573045731457324573345734457354573645737457384573945740457414574245743457444574545746457474574845749457504575145752457534575445755457564575745758457594576045761457624576345764457654576645767457684576945770457714577245773457744577545776457774577845779457804578145782457834578445785457864578745788457894579045791457924579345794457954579645797457984579945800458014580245803458044580545806458074580845809458104581145812458134581445815458164581745818458194582045821458224582345824458254582645827458284582945830458314583245833458344583545836458374583845839458404584145842458434584445845458464584745848458494585045851458524585345854458554585645857458584585945860458614586245863458644586545866458674586845869458704587145872458734587445875458764587745878458794588045881458824588345884458854588645887458884588945890458914589245893458944589545896458974589845899459004590145902459034590445905459064590745908459094591045911459124591345914459154591645917459184591945920459214592245923459244592545926459274592845929459304593145932459334593445935459364593745938459394594045941459424594345944459454594645947459484594945950459514595245953459544595545956459574595845959459604596145962459634596445965459664596745968459694597045971459724597345974459754597645977459784597945980459814598245983459844598545986459874598845989459904599145992459934599445995459964599745998459994600046001460024600346004460054600646007460084600946010460114601246013460144601546016460174601846019460204602146022460234602446025460264602746028460294603046031460324603346034460354603646037460384603946040460414604246043460444604546046460474604846049460504605146052460534605446055460564605746058460594606046061460624606346064460654606646067460684606946070460714607246073460744607546076460774607846079460804608146082460834608446085460864608746088460894609046091460924609346094460954609646097460984609946100461014610246103461044610546106461074610846109461104611146112461134611446115461164611746118461194612046121461224612346124461254612646127461284612946130461314613246133461344613546136461374613846139461404614146142461434614446145461464614746148461494615046151461524615346154461554615646157461584615946160461614616246163461644616546166461674616846169461704617146172461734617446175461764617746178461794618046181461824618346184461854618646187461884618946190461914619246193461944619546196461974619846199462004620146202462034620446205462064620746208462094621046211462124621346214462154621646217462184621946220462214622246223462244622546226462274622846229462304623146232462334623446235462364623746238462394624046241462424624346244462454624646247462484624946250462514625246253462544625546256462574625846259462604626146262462634626446265462664626746268462694627046271462724627346274462754627646277462784627946280462814628246283462844628546286462874628846289462904629146292462934629446295462964629746298462994630046301463024630346304463054630646307463084630946310463114631246313463144631546316463174631846319463204632146322463234632446325463264632746328463294633046331463324633346334463354633646337463384633946340463414634246343463444634546346463474634846349463504635146352463534635446355463564635746358463594636046361463624636346364463654636646367463684636946370463714637246373463744637546376463774637846379463804638146382463834638446385463864638746388463894639046391463924639346394463954639646397463984639946400464014640246403464044640546406464074640846409464104641146412464134641446415464164641746418464194642046421464224642346424464254642646427464284642946430464314643246433464344643546436464374643846439464404644146442464434644446445464464644746448464494645046451464524645346454464554645646457464584645946460464614646246463464644646546466464674646846469464704647146472464734647446475464764647746478464794648046481464824648346484464854648646487464884648946490464914649246493464944649546496464974649846499465004650146502465034650446505465064650746508465094651046511465124651346514465154651646517465184651946520465214652246523465244652546526465274652846529465304653146532465334653446535465364653746538465394654046541465424654346544465454654646547465484654946550465514655246553465544655546556465574655846559465604656146562465634656446565465664656746568465694657046571465724657346574465754657646577465784657946580465814658246583465844658546586465874658846589465904659146592465934659446595465964659746598465994660046601466024660346604466054660646607466084660946610466114661246613466144661546616466174661846619466204662146622466234662446625466264662746628466294663046631466324663346634466354663646637466384663946640466414664246643466444664546646466474664846649466504665146652466534665446655466564665746658466594666046661466624666346664466654666646667466684666946670466714667246673466744667546676466774667846679466804668146682466834668446685466864668746688466894669046691466924669346694466954669646697466984669946700467014670246703467044670546706467074670846709467104671146712467134671446715467164671746718467194672046721467224672346724467254672646727467284672946730467314673246733467344673546736467374673846739467404674146742467434674446745467464674746748467494675046751467524675346754467554675646757467584675946760467614676246763467644676546766467674676846769467704677146772467734677446775467764677746778467794678046781467824678346784467854678646787467884678946790467914679246793467944679546796467974679846799468004680146802468034680446805468064680746808468094681046811468124681346814468154681646817468184681946820468214682246823468244682546826468274682846829468304683146832468334683446835468364683746838468394684046841468424684346844468454684646847468484684946850468514685246853468544685546856468574685846859468604686146862468634686446865468664686746868468694687046871468724687346874468754687646877468784687946880468814688246883468844688546886468874688846889468904689146892468934689446895468964689746898468994690046901469024690346904469054690646907469084690946910469114691246913469144691546916469174691846919469204692146922469234692446925469264692746928469294693046931469324693346934469354693646937469384693946940469414694246943469444694546946469474694846949469504695146952469534695446955469564695746958469594696046961469624696346964469654696646967469684696946970469714697246973469744697546976469774697846979469804698146982469834698446985469864698746988469894699046991469924699346994469954699646997469984699947000470014700247003470044700547006470074700847009470104701147012470134701447015470164701747018470194702047021470224702347024470254702647027470284702947030470314703247033470344703547036470374703847039470404704147042470434704447045470464704747048470494705047051470524705347054470554705647057470584705947060470614706247063470644706547066470674706847069470704707147072470734707447075470764707747078470794708047081470824708347084470854708647087470884708947090470914709247093470944709547096470974709847099471004710147102471034710447105471064710747108471094711047111471124711347114471154711647117471184711947120471214712247123471244712547126471274712847129471304713147132471334713447135471364713747138471394714047141471424714347144471454714647147471484714947150471514715247153471544715547156471574715847159471604716147162471634716447165471664716747168471694717047171471724717347174471754717647177471784717947180471814718247183471844718547186471874718847189471904719147192471934719447195471964719747198471994720047201472024720347204472054720647207472084720947210472114721247213472144721547216472174721847219472204722147222472234722447225472264722747228472294723047231472324723347234472354723647237472384723947240472414724247243472444724547246472474724847249472504725147252472534725447255472564725747258472594726047261472624726347264472654726647267472684726947270472714727247273472744727547276472774727847279472804728147282472834728447285472864728747288472894729047291472924729347294472954729647297472984729947300473014730247303473044730547306473074730847309473104731147312473134731447315473164731747318473194732047321473224732347324473254732647327473284732947330473314733247333473344733547336473374733847339473404734147342473434734447345473464734747348473494735047351473524735347354473554735647357473584735947360473614736247363473644736547366473674736847369473704737147372473734737447375473764737747378473794738047381473824738347384473854738647387473884738947390473914739247393473944739547396473974739847399474004740147402474034740447405474064740747408474094741047411474124741347414474154741647417474184741947420474214742247423474244742547426474274742847429474304743147432474334743447435474364743747438474394744047441474424744347444474454744647447474484744947450474514745247453474544745547456474574745847459474604746147462474634746447465474664746747468474694747047471474724747347474474754747647477474784747947480474814748247483474844748547486474874748847489474904749147492474934749447495474964749747498474994750047501475024750347504475054750647507475084750947510475114751247513475144751547516475174751847519475204752147522475234752447525475264752747528475294753047531475324753347534475354753647537475384753947540475414754247543475444754547546475474754847549475504755147552475534755447555475564755747558475594756047561475624756347564475654756647567475684756947570475714757247573475744757547576475774757847579475804758147582475834758447585475864758747588475894759047591475924759347594475954759647597475984759947600476014760247603476044760547606476074760847609476104761147612476134761447615476164761747618476194762047621476224762347624476254762647627476284762947630476314763247633476344763547636476374763847639476404764147642476434764447645476464764747648476494765047651476524765347654476554765647657476584765947660476614766247663476644766547666476674766847669476704767147672476734767447675476764767747678476794768047681476824768347684476854768647687476884768947690476914769247693476944769547696476974769847699477004770147702477034770447705477064770747708477094771047711477124771347714477154771647717477184771947720477214772247723477244772547726477274772847729477304773147732477334773447735477364773747738477394774047741477424774347744477454774647747477484774947750477514775247753477544775547756477574775847759477604776147762477634776447765477664776747768477694777047771477724777347774477754777647777477784777947780477814778247783477844778547786477874778847789477904779147792477934779447795477964779747798477994780047801478024780347804478054780647807478084780947810478114781247813478144781547816478174781847819478204782147822478234782447825478264782747828478294783047831478324783347834478354783647837478384783947840478414784247843478444784547846478474784847849478504785147852478534785447855478564785747858478594786047861478624786347864478654786647867478684786947870478714787247873478744787547876478774787847879478804788147882478834788447885478864788747888478894789047891478924789347894478954789647897478984789947900479014790247903479044790547906479074790847909479104791147912479134791447915479164791747918479194792047921479224792347924479254792647927479284792947930479314793247933479344793547936479374793847939479404794147942479434794447945479464794747948479494795047951479524795347954479554795647957479584795947960479614796247963479644796547966479674796847969479704797147972479734797447975479764797747978479794798047981479824798347984479854798647987479884798947990479914799247993479944799547996479974799847999480004800148002480034800448005480064800748008480094801048011480124801348014480154801648017480184801948020480214802248023480244802548026480274802848029480304803148032480334803448035480364803748038480394804048041480424804348044480454804648047480484804948050480514805248053480544805548056480574805848059480604806148062480634806448065480664806748068480694807048071480724807348074480754807648077480784807948080480814808248083480844808548086480874808848089480904809148092480934809448095480964809748098480994810048101481024810348104481054810648107481084810948110481114811248113481144811548116481174811848119481204812148122481234812448125481264812748128481294813048131481324813348134481354813648137481384813948140481414814248143481444814548146481474814848149481504815148152481534815448155481564815748158481594816048161481624816348164481654816648167481684816948170481714817248173481744817548176481774817848179481804818148182481834818448185481864818748188481894819048191481924819348194481954819648197481984819948200482014820248203482044820548206482074820848209482104821148212482134821448215482164821748218482194822048221482224822348224482254822648227482284822948230482314823248233482344823548236482374823848239482404824148242482434824448245482464824748248482494825048251482524825348254482554825648257482584825948260482614826248263482644826548266482674826848269482704827148272482734827448275482764827748278482794828048281482824828348284482854828648287482884828948290482914829248293482944829548296482974829848299483004830148302483034830448305483064830748308483094831048311483124831348314483154831648317483184831948320483214832248323483244832548326483274832848329483304833148332483334833448335483364833748338483394834048341483424834348344483454834648347483484834948350483514835248353483544835548356483574835848359483604836148362483634836448365483664836748368483694837048371483724837348374483754837648377483784837948380483814838248383483844838548386483874838848389483904839148392483934839448395483964839748398483994840048401484024840348404484054840648407484084840948410484114841248413484144841548416484174841848419484204842148422484234842448425484264842748428484294843048431484324843348434484354843648437484384843948440484414844248443484444844548446484474844848449484504845148452484534845448455484564845748458484594846048461484624846348464484654846648467484684846948470484714847248473484744847548476484774847848479484804848148482484834848448485484864848748488484894849048491484924849348494484954849648497484984849948500485014850248503485044850548506485074850848509485104851148512485134851448515485164851748518485194852048521485224852348524485254852648527485284852948530485314853248533485344853548536485374853848539485404854148542485434854448545485464854748548485494855048551485524855348554485554855648557485584855948560485614856248563485644856548566485674856848569485704857148572485734857448575485764857748578485794858048581485824858348584485854858648587485884858948590485914859248593485944859548596485974859848599486004860148602486034860448605486064860748608486094861048611486124861348614486154861648617486184861948620486214862248623486244862548626486274862848629486304863148632486334863448635486364863748638486394864048641486424864348644486454864648647486484864948650486514865248653486544865548656486574865848659486604866148662486634866448665486664866748668486694867048671486724867348674486754867648677486784867948680486814868248683486844868548686486874868848689486904869148692486934869448695486964869748698486994870048701487024870348704487054870648707487084870948710487114871248713487144871548716487174871848719487204872148722487234872448725487264872748728487294873048731487324873348734487354873648737487384873948740487414874248743487444874548746487474874848749487504875148752487534875448755487564875748758487594876048761487624876348764487654876648767487684876948770487714877248773487744877548776487774877848779487804878148782487834878448785487864878748788487894879048791487924879348794487954879648797487984879948800488014880248803488044880548806488074880848809488104881148812488134881448815488164881748818488194882048821488224882348824488254882648827488284882948830488314883248833488344883548836488374883848839488404884148842488434884448845488464884748848488494885048851488524885348854488554885648857488584885948860488614886248863488644886548866488674886848869488704887148872488734887448875488764887748878488794888048881488824888348884488854888648887488884888948890488914889248893488944889548896488974889848899489004890148902489034890448905489064890748908489094891048911489124891348914489154891648917489184891948920489214892248923489244892548926489274892848929489304893148932489334893448935489364893748938489394894048941489424894348944489454894648947489484894948950489514895248953489544895548956489574895848959489604896148962489634896448965489664896748968489694897048971489724897348974489754897648977489784897948980489814898248983489844898548986489874898848989489904899148992489934899448995489964899748998489994900049001490024900349004490054900649007490084900949010490114901249013490144901549016490174901849019490204902149022490234902449025490264902749028490294903049031490324903349034490354903649037490384903949040490414904249043490444904549046490474904849049490504905149052490534905449055490564905749058490594906049061490624906349064490654906649067490684906949070490714907249073490744907549076490774907849079490804908149082490834908449085490864908749088490894909049091490924909349094490954909649097490984909949100491014910249103491044910549106491074910849109491104911149112491134911449115491164911749118491194912049121491224912349124491254912649127491284912949130491314913249133491344913549136491374913849139491404914149142491434914449145491464914749148491494915049151491524915349154491554915649157491584915949160491614916249163491644916549166491674916849169491704917149172491734917449175491764917749178491794918049181491824918349184491854918649187491884918949190491914919249193491944919549196491974919849199492004920149202492034920449205492064920749208492094921049211492124921349214492154921649217492184921949220492214922249223492244922549226492274922849229492304923149232492334923449235492364923749238492394924049241492424924349244492454924649247492484924949250492514925249253492544925549256492574925849259492604926149262492634926449265492664926749268492694927049271492724927349274492754927649277492784927949280492814928249283492844928549286492874928849289492904929149292492934929449295492964929749298492994930049301493024930349304493054930649307493084930949310493114931249313493144931549316493174931849319493204932149322493234932449325493264932749328493294933049331493324933349334493354933649337493384933949340493414934249343493444934549346493474934849349493504935149352493534935449355493564935749358493594936049361493624936349364493654936649367493684936949370493714937249373493744937549376493774937849379493804938149382493834938449385493864938749388493894939049391493924939349394493954939649397493984939949400494014940249403494044940549406494074940849409494104941149412494134941449415494164941749418494194942049421494224942349424494254942649427494284942949430494314943249433494344943549436494374943849439494404944149442494434944449445494464944749448494494945049451494524945349454494554945649457494584945949460494614946249463494644946549466494674946849469494704947149472494734947449475494764947749478494794948049481494824948349484494854948649487494884948949490494914949249493494944949549496494974949849499495004950149502495034950449505495064950749508495094951049511495124951349514495154951649517495184951949520495214952249523495244952549526495274952849529495304953149532495334953449535495364953749538495394954049541495424954349544495454954649547495484954949550495514955249553495544955549556495574955849559495604956149562495634956449565495664956749568495694957049571495724957349574495754957649577495784957949580495814958249583495844958549586495874958849589495904959149592495934959449595495964959749598495994960049601496024960349604496054960649607496084960949610496114961249613496144961549616496174961849619496204962149622496234962449625496264962749628496294963049631496324963349634496354963649637496384963949640496414964249643496444964549646496474964849649496504965149652496534965449655496564965749658496594966049661496624966349664496654966649667496684966949670496714967249673496744967549676496774967849679496804968149682496834968449685496864968749688496894969049691496924969349694496954969649697496984969949700497014970249703497044970549706497074970849709497104971149712497134971449715497164971749718497194972049721497224972349724497254972649727497284972949730497314973249733497344973549736497374973849739497404974149742497434974449745497464974749748497494975049751497524975349754497554975649757497584975949760497614976249763497644976549766497674976849769497704977149772497734977449775497764977749778497794978049781497824978349784497854978649787497884978949790497914979249793497944979549796497974979849799498004980149802498034980449805498064980749808498094981049811498124981349814498154981649817498184981949820498214982249823498244982549826498274982849829498304983149832498334983449835498364983749838498394984049841498424984349844498454984649847498484984949850498514985249853498544985549856498574985849859498604986149862498634986449865498664986749868498694987049871498724987349874498754987649877498784987949880498814988249883498844988549886498874988849889498904989149892498934989449895498964989749898498994990049901499024990349904499054990649907499084990949910499114991249913499144991549916499174991849919499204992149922499234992449925499264992749928499294993049931499324993349934499354993649937499384993949940499414994249943499444994549946499474994849949499504995149952499534995449955499564995749958499594996049961499624996349964499654996649967499684996949970499714997249973499744997549976499774997849979499804998149982499834998449985499864998749988499894999049991499924999349994499954999649997499984999950000500015000250003500045000550006500075000850009500105001150012500135001450015500165001750018500195002050021500225002350024500255002650027500285002950030500315003250033500345003550036500375003850039500405004150042500435004450045500465004750048500495005050051500525005350054500555005650057500585005950060500615006250063500645006550066500675006850069500705007150072500735007450075500765007750078500795008050081500825008350084500855008650087500885008950090500915009250093500945009550096500975009850099501005010150102501035010450105501065010750108501095011050111501125011350114501155011650117501185011950120501215012250123501245012550126501275012850129501305013150132501335013450135501365013750138501395014050141501425014350144501455014650147501485014950150501515015250153501545015550156501575015850159501605016150162501635016450165501665016750168501695017050171501725017350174501755017650177501785017950180501815018250183501845018550186501875018850189501905019150192501935019450195501965019750198501995020050201502025020350204502055020650207502085020950210502115021250213502145021550216502175021850219502205022150222502235022450225502265022750228502295023050231502325023350234502355023650237502385023950240502415024250243502445024550246502475024850249502505025150252502535025450255502565025750258502595026050261502625026350264502655026650267502685026950270502715027250273502745027550276502775027850279502805028150282502835028450285502865028750288502895029050291502925029350294502955029650297502985029950300503015030250303503045030550306503075030850309503105031150312503135031450315503165031750318503195032050321503225032350324503255032650327503285032950330503315033250333503345033550336503375033850339503405034150342503435034450345503465034750348503495035050351503525035350354503555035650357503585035950360503615036250363503645036550366503675036850369503705037150372503735037450375503765037750378503795038050381503825038350384503855038650387503885038950390503915039250393503945039550396503975039850399504005040150402504035040450405504065040750408504095041050411504125041350414504155041650417504185041950420504215042250423504245042550426504275042850429504305043150432504335043450435504365043750438504395044050441504425044350444504455044650447504485044950450504515045250453504545045550456504575045850459504605046150462504635046450465504665046750468504695047050471504725047350474504755047650477504785047950480504815048250483504845048550486504875048850489504905049150492504935049450495504965049750498504995050050501505025050350504505055050650507505085050950510505115051250513505145051550516505175051850519505205052150522505235052450525505265052750528505295053050531505325053350534505355053650537505385053950540505415054250543505445054550546505475054850549505505055150552505535055450555505565055750558505595056050561505625056350564505655056650567505685056950570505715057250573505745057550576505775057850579505805058150582505835058450585505865058750588505895059050591505925059350594505955059650597505985059950600506015060250603506045060550606506075060850609506105061150612506135061450615506165061750618506195062050621506225062350624506255062650627506285062950630506315063250633506345063550636506375063850639506405064150642506435064450645506465064750648506495065050651506525065350654506555065650657506585065950660506615066250663506645066550666506675066850669506705067150672506735067450675506765067750678506795068050681506825068350684506855068650687506885068950690506915069250693506945069550696506975069850699507005070150702507035070450705507065070750708507095071050711507125071350714507155071650717507185071950720507215072250723507245072550726507275072850729507305073150732507335073450735507365073750738507395074050741507425074350744507455074650747507485074950750507515075250753507545075550756507575075850759507605076150762507635076450765507665076750768507695077050771507725077350774507755077650777507785077950780507815078250783507845078550786507875078850789507905079150792507935079450795507965079750798507995080050801508025080350804508055080650807508085080950810508115081250813508145081550816508175081850819508205082150822508235082450825508265082750828508295083050831508325083350834508355083650837508385083950840508415084250843508445084550846508475084850849508505085150852508535085450855508565085750858508595086050861508625086350864508655086650867508685086950870508715087250873508745087550876508775087850879508805088150882508835088450885508865088750888508895089050891508925089350894508955089650897508985089950900509015090250903509045090550906509075090850909509105091150912509135091450915509165091750918509195092050921509225092350924509255092650927509285092950930509315093250933509345093550936509375093850939509405094150942509435094450945509465094750948509495095050951509525095350954509555095650957509585095950960509615096250963509645096550966509675096850969509705097150972509735097450975509765097750978509795098050981509825098350984509855098650987509885098950990509915099250993509945099550996509975099850999510005100151002510035100451005510065100751008510095101051011510125101351014510155101651017510185101951020510215102251023510245102551026510275102851029510305103151032510335103451035510365103751038510395104051041510425104351044510455104651047510485104951050510515105251053510545105551056510575105851059510605106151062510635106451065510665106751068510695107051071510725107351074510755107651077510785107951080510815108251083510845108551086510875108851089510905109151092510935109451095510965109751098510995110051101511025110351104511055110651107511085110951110511115111251113511145111551116511175111851119511205112151122511235112451125511265112751128511295113051131511325113351134511355113651137511385113951140511415114251143511445114551146511475114851149511505115151152511535115451155511565115751158511595116051161511625116351164511655116651167511685116951170511715117251173511745117551176511775117851179511805118151182511835118451185511865118751188511895119051191511925119351194511955119651197511985119951200512015120251203512045120551206512075120851209512105121151212512135121451215512165121751218512195122051221512225122351224512255122651227512285122951230512315123251233512345123551236512375123851239512405124151242512435124451245512465124751248512495125051251512525125351254512555125651257512585125951260512615126251263512645126551266512675126851269512705127151272512735127451275512765127751278512795128051281512825128351284512855128651287512885128951290512915129251293512945129551296512975129851299513005130151302513035130451305513065130751308513095131051311513125131351314513155131651317513185131951320513215132251323513245132551326513275132851329513305133151332513335133451335513365133751338513395134051341513425134351344513455134651347513485134951350513515135251353513545135551356513575135851359513605136151362513635136451365513665136751368513695137051371513725137351374513755137651377513785137951380513815138251383513845138551386513875138851389513905139151392513935139451395513965139751398513995140051401514025140351404514055140651407514085140951410514115141251413514145141551416514175141851419514205142151422514235142451425514265142751428514295143051431514325143351434514355143651437514385143951440514415144251443514445144551446514475144851449514505145151452514535145451455514565145751458514595146051461514625146351464514655146651467514685146951470514715147251473514745147551476514775147851479514805148151482514835148451485514865148751488514895149051491514925149351494514955149651497514985149951500515015150251503515045150551506515075150851509515105151151512515135151451515515165151751518515195152051521515225152351524515255152651527515285152951530515315153251533515345153551536515375153851539515405154151542515435154451545515465154751548515495155051551515525155351554515555155651557515585155951560515615156251563515645156551566515675156851569515705157151572515735157451575515765157751578515795158051581515825158351584515855158651587515885158951590515915159251593515945159551596515975159851599516005160151602516035160451605516065160751608516095161051611516125161351614516155161651617516185161951620516215162251623516245162551626516275162851629516305163151632516335163451635516365163751638516395164051641516425164351644516455164651647516485164951650516515165251653516545165551656516575165851659516605166151662516635166451665516665166751668516695167051671516725167351674516755167651677516785167951680516815168251683516845168551686516875168851689516905169151692516935169451695516965169751698516995170051701517025170351704517055170651707517085170951710517115171251713517145171551716517175171851719517205172151722517235172451725517265172751728517295173051731517325173351734517355173651737517385173951740517415174251743517445174551746517475174851749517505175151752517535175451755517565175751758517595176051761517625176351764517655176651767517685176951770517715177251773517745177551776517775177851779517805178151782517835178451785517865178751788517895179051791517925179351794517955179651797517985179951800518015180251803518045180551806518075180851809518105181151812518135181451815518165181751818518195182051821518225182351824518255182651827518285182951830518315183251833518345183551836518375183851839518405184151842518435184451845518465184751848518495185051851518525185351854518555185651857518585185951860518615186251863518645186551866518675186851869518705187151872518735187451875518765187751878518795188051881518825188351884518855188651887518885188951890518915189251893518945189551896518975189851899519005190151902519035190451905519065190751908519095191051911519125191351914519155191651917519185191951920519215192251923519245192551926519275192851929519305193151932519335193451935519365193751938519395194051941519425194351944519455194651947519485194951950519515195251953519545195551956519575195851959519605196151962519635196451965519665196751968519695197051971519725197351974519755197651977519785197951980519815198251983519845198551986519875198851989519905199151992519935199451995519965199751998519995200052001520025200352004520055200652007520085200952010520115201252013520145201552016520175201852019520205202152022520235202452025520265202752028520295203052031520325203352034520355203652037520385203952040520415204252043520445204552046520475204852049520505205152052520535205452055520565205752058520595206052061520625206352064520655206652067520685206952070520715207252073520745207552076520775207852079520805208152082520835208452085520865208752088520895209052091520925209352094520955209652097520985209952100521015210252103521045210552106521075210852109521105211152112521135211452115521165211752118521195212052121521225212352124521255212652127521285212952130521315213252133521345213552136521375213852139521405214152142521435214452145521465214752148521495215052151521525215352154521555215652157521585215952160521615216252163521645216552166521675216852169521705217152172521735217452175521765217752178521795218052181521825218352184521855218652187521885218952190521915219252193521945219552196521975219852199522005220152202522035220452205522065220752208522095221052211522125221352214522155221652217522185221952220522215222252223522245222552226522275222852229522305223152232522335223452235522365223752238522395224052241522425224352244522455224652247522485224952250522515225252253522545225552256522575225852259522605226152262522635226452265522665226752268522695227052271522725227352274522755227652277522785227952280522815228252283522845228552286522875228852289522905229152292522935229452295522965229752298522995230052301523025230352304523055230652307523085230952310523115231252313523145231552316523175231852319523205232152322523235232452325523265232752328523295233052331523325233352334523355233652337523385233952340523415234252343523445234552346523475234852349523505235152352523535235452355523565235752358523595236052361523625236352364523655236652367523685236952370523715237252373523745237552376523775237852379523805238152382523835238452385523865238752388523895239052391523925239352394523955239652397523985239952400524015240252403524045240552406524075240852409524105241152412524135241452415524165241752418524195242052421524225242352424524255242652427524285242952430524315243252433524345243552436524375243852439524405244152442524435244452445524465244752448524495245052451524525245352454524555245652457524585245952460524615246252463524645246552466524675246852469524705247152472524735247452475524765247752478524795248052481524825248352484524855248652487524885248952490524915249252493524945249552496524975249852499525005250152502525035250452505525065250752508525095251052511525125251352514525155251652517525185251952520525215252252523525245252552526525275252852529525305253152532525335253452535525365253752538525395254052541525425254352544525455254652547525485254952550525515255252553525545255552556525575255852559525605256152562525635256452565525665256752568525695257052571525725257352574525755257652577525785257952580525815258252583525845258552586525875258852589525905259152592525935259452595525965259752598525995260052601526025260352604526055260652607526085260952610526115261252613526145261552616526175261852619526205262152622526235262452625526265262752628526295263052631526325263352634526355263652637526385263952640526415264252643526445264552646526475264852649526505265152652526535265452655526565265752658526595266052661526625266352664526655266652667526685266952670526715267252673526745267552676526775267852679526805268152682526835268452685526865268752688526895269052691526925269352694526955269652697526985269952700527015270252703527045270552706527075270852709527105271152712527135271452715527165271752718527195272052721527225272352724527255272652727527285272952730527315273252733527345273552736527375273852739527405274152742527435274452745527465274752748527495275052751527525275352754527555275652757527585275952760527615276252763527645276552766527675276852769527705277152772527735277452775527765277752778527795278052781527825278352784527855278652787527885278952790527915279252793527945279552796527975279852799528005280152802528035280452805528065280752808528095281052811528125281352814528155281652817528185281952820528215282252823528245282552826528275282852829528305283152832528335283452835528365283752838528395284052841528425284352844528455284652847528485284952850528515285252853528545285552856528575285852859528605286152862528635286452865528665286752868528695287052871528725287352874528755287652877528785287952880528815288252883528845288552886528875288852889528905289152892528935289452895528965289752898528995290052901529025290352904529055290652907529085290952910529115291252913529145291552916529175291852919529205292152922529235292452925529265292752928529295293052931529325293352934529355293652937529385293952940529415294252943529445294552946529475294852949529505295152952529535295452955529565295752958529595296052961529625296352964529655296652967529685296952970529715297252973529745297552976529775297852979529805298152982529835298452985529865298752988529895299052991529925299352994529955299652997529985299953000530015300253003530045300553006530075300853009530105301153012530135301453015530165301753018530195302053021530225302353024530255302653027530285302953030530315303253033530345303553036530375303853039530405304153042530435304453045530465304753048530495305053051530525305353054530555305653057530585305953060530615306253063530645306553066530675306853069530705307153072530735307453075530765307753078530795308053081530825308353084530855308653087530885308953090530915309253093530945309553096530975309853099531005310153102531035310453105531065310753108531095311053111531125311353114531155311653117531185311953120531215312253123531245312553126531275312853129531305313153132531335313453135531365313753138531395314053141531425314353144531455314653147531485314953150531515315253153531545315553156531575315853159531605316153162531635316453165531665316753168531695317053171531725317353174531755317653177531785317953180531815318253183531845318553186531875318853189531905319153192531935319453195531965319753198531995320053201532025320353204532055320653207532085320953210532115321253213532145321553216532175321853219532205322153222532235322453225532265322753228532295323053231532325323353234532355323653237532385323953240532415324253243532445324553246532475324853249532505325153252532535325453255532565325753258532595326053261532625326353264532655326653267532685326953270532715327253273532745327553276532775327853279532805328153282532835328453285532865328753288532895329053291532925329353294532955329653297532985329953300533015330253303533045330553306533075330853309533105331153312533135331453315533165331753318533195332053321533225332353324533255332653327533285332953330533315333253333533345333553336533375333853339533405334153342533435334453345533465334753348533495335053351533525335353354533555335653357533585335953360533615336253363533645336553366533675336853369533705337153372533735337453375533765337753378533795338053381533825338353384533855338653387533885338953390533915339253393533945339553396533975339853399534005340153402534035340453405534065340753408534095341053411534125341353414534155341653417534185341953420534215342253423534245342553426534275342853429534305343153432534335343453435534365343753438534395344053441534425344353444534455344653447534485344953450534515345253453534545345553456534575345853459534605346153462534635346453465534665346753468534695347053471534725347353474534755347653477534785347953480534815348253483
  1. (function webpackUniversalModuleDefinition(root, factory) {
  2. if(typeof exports === 'object' && typeof module === 'object')
  3. module.exports = factory();
  4. else if(typeof define === 'function' && define.amd)
  5. define([], factory);
  6. else if(typeof exports === 'object')
  7. exports["ivprogCore"] = factory();
  8. else
  9. root["ivprogCore"] = factory();
  10. })(window, function() {
  11. return /******/ (function(modules) { // webpackBootstrap
  12. /******/ // The module cache
  13. /******/ var installedModules = {};
  14. /******/
  15. /******/ // The require function
  16. /******/ function __webpack_require__(moduleId) {
  17. /******/
  18. /******/ // Check if module is in cache
  19. /******/ if(installedModules[moduleId]) {
  20. /******/ return installedModules[moduleId].exports;
  21. /******/ }
  22. /******/ // Create a new module (and put it into the cache)
  23. /******/ var module = installedModules[moduleId] = {
  24. /******/ i: moduleId,
  25. /******/ l: false,
  26. /******/ exports: {}
  27. /******/ };
  28. /******/
  29. /******/ // Execute the module function
  30. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  31. /******/
  32. /******/ // Flag the module as loaded
  33. /******/ module.l = true;
  34. /******/
  35. /******/ // Return the exports of the module
  36. /******/ return module.exports;
  37. /******/ }
  38. /******/
  39. /******/
  40. /******/ // expose the modules object (__webpack_modules__)
  41. /******/ __webpack_require__.m = modules;
  42. /******/
  43. /******/ // expose the module cache
  44. /******/ __webpack_require__.c = installedModules;
  45. /******/
  46. /******/ // define getter function for harmony exports
  47. /******/ __webpack_require__.d = function(exports, name, getter) {
  48. /******/ if(!__webpack_require__.o(exports, name)) {
  49. /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
  50. /******/ }
  51. /******/ };
  52. /******/
  53. /******/ // define __esModule on exports
  54. /******/ __webpack_require__.r = function(exports) {
  55. /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  56. /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  57. /******/ }
  58. /******/ Object.defineProperty(exports, '__esModule', { value: true });
  59. /******/ };
  60. /******/
  61. /******/ // create a fake namespace object
  62. /******/ // mode & 1: value is a module id, require it
  63. /******/ // mode & 2: merge all properties of value into the ns
  64. /******/ // mode & 4: return value when already ns object
  65. /******/ // mode & 8|1: behave like require
  66. /******/ __webpack_require__.t = function(value, mode) {
  67. /******/ if(mode & 1) value = __webpack_require__(value);
  68. /******/ if(mode & 8) return value;
  69. /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
  70. /******/ var ns = Object.create(null);
  71. /******/ __webpack_require__.r(ns);
  72. /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
  73. /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
  74. /******/ return ns;
  75. /******/ };
  76. /******/
  77. /******/ // getDefaultExport function for compatibility with non-harmony modules
  78. /******/ __webpack_require__.n = function(module) {
  79. /******/ var getter = module && module.__esModule ?
  80. /******/ function getDefault() { return module['default']; } :
  81. /******/ function getModuleExports() { return module; };
  82. /******/ __webpack_require__.d(getter, 'a', getter);
  83. /******/ return getter;
  84. /******/ };
  85. /******/
  86. /******/ // Object.prototype.hasOwnProperty.call
  87. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  88. /******/
  89. /******/ // __webpack_public_path__
  90. /******/ __webpack_require__.p = "";
  91. /******/
  92. /******/
  93. /******/ // Load entry module and return exports
  94. /******/ return __webpack_require__(__webpack_require__.s = "./js/main.js");
  95. /******/ })
  96. /************************************************************************/
  97. /******/ ({
  98. /***/ "./grammar/en/ivprog.g4":
  99. /*!******************************!*\
  100. !*** ./grammar/en/ivprog.g4 ***!
  101. \******************************/
  102. /*! no static exports found */
  103. /***/ (function(module, exports, __webpack_require__) {
  104. module.exports =
  105. /******/ (function(modules) { // webpackBootstrap
  106. /******/ // The module cache
  107. /******/ var installedModules = {};
  108. /******/
  109. /******/ // The require function
  110. /******/ function __webpack_require__(moduleId) {
  111. /******/
  112. /******/ // Check if module is in cache
  113. /******/ if(installedModules[moduleId]) {
  114. /******/ return installedModules[moduleId].exports;
  115. /******/ }
  116. /******/ // Create a new module (and put it into the cache)
  117. /******/ var module = installedModules[moduleId] = {
  118. /******/ i: moduleId,
  119. /******/ l: false,
  120. /******/ exports: {}
  121. /******/ };
  122. /******/
  123. /******/ // Execute the module function
  124. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  125. /******/
  126. /******/ // Flag the module as loaded
  127. /******/ module.l = true;
  128. /******/
  129. /******/ // Return the exports of the module
  130. /******/ return module.exports;
  131. /******/ }
  132. /******/
  133. /******/
  134. /******/ // expose the modules object (__webpack_modules__)
  135. /******/ __webpack_require__.m = modules;
  136. /******/
  137. /******/ // expose the module cache
  138. /******/ __webpack_require__.c = installedModules;
  139. /******/
  140. /******/ // identity function for calling harmony imports with the correct context
  141. /******/ __webpack_require__.i = function(value) { return value; };
  142. /******/
  143. /******/ // define getter function for harmony exports
  144. /******/ __webpack_require__.d = function(exports, name, getter) {
  145. /******/ if(!__webpack_require__.o(exports, name)) {
  146. /******/ Object.defineProperty(exports, name, {
  147. /******/ configurable: false,
  148. /******/ enumerable: true,
  149. /******/ get: getter
  150. /******/ });
  151. /******/ }
  152. /******/ };
  153. /******/
  154. /******/ // getDefaultExport function for compatibility with non-harmony modules
  155. /******/ __webpack_require__.n = function(module) {
  156. /******/ var getter = module && module.__esModule ?
  157. /******/ function getDefault() { return module['default']; } :
  158. /******/ function getModuleExports() { return module; };
  159. /******/ __webpack_require__.d(getter, 'a', getter);
  160. /******/ return getter;
  161. /******/ };
  162. /******/
  163. /******/ // Object.prototype.hasOwnProperty.call
  164. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  165. /******/
  166. /******/ // __webpack_public_path__
  167. /******/ __webpack_require__.p = "";
  168. /******/
  169. /******/ // Load entry module and return exports
  170. /******/ return __webpack_require__(__webpack_require__.s = 1);
  171. /******/ })
  172. /************************************************************************/
  173. /******/ ([
  174. /* 0 */
  175. /***/ (function(module, exports, __webpack_require__) {
  176. // Generated from /tmp/tmp-3417pRptzVtsQAPm/ivprog.g4 by ANTLR 4.7
  177. // jshint ignore: start
  178. var antlr4 = __webpack_require__(2);
  179. var serializedATN = ["\u0003\u608b\ua72a\u8133\ub9ed\u417c\u3be7\u7786\u5964",
  180. "\u0002/\u01d1\b\u0001\u0004\u0002\t\u0002\u0004\u0003\t\u0003\u0004",
  181. "\u0004\t\u0004\u0004\u0005\t\u0005\u0004\u0006\t\u0006\u0004\u0007\t",
  182. "\u0007\u0004\b\t\b\u0004\t\t\t\u0004\n\t\n\u0004\u000b\t\u000b\u0004",
  183. "\f\t\f\u0004\r\t\r\u0004\u000e\t\u000e\u0004\u000f\t\u000f\u0004\u0010",
  184. "\t\u0010\u0004\u0011\t\u0011\u0004\u0012\t\u0012\u0004\u0013\t\u0013",
  185. "\u0004\u0014\t\u0014\u0004\u0015\t\u0015\u0004\u0016\t\u0016\u0004\u0017",
  186. "\t\u0017\u0004\u0018\t\u0018\u0004\u0019\t\u0019\u0004\u001a\t\u001a",
  187. "\u0004\u001b\t\u001b\u0004\u001c\t\u001c\u0004\u001d\t\u001d\u0004\u001e",
  188. "\t\u001e\u0004\u001f\t\u001f\u0004 \t \u0004!\t!\u0004\"\t\"\u0004#",
  189. "\t#\u0004$\t$\u0004%\t%\u0004&\t&\u0004\'\t\'\u0004(\t(\u0004)\t)\u0004",
  190. "*\t*\u0004+\t+\u0004,\t,\u0004-\t-\u0004.\t.\u0004/\t/\u00040\t0\u0004",
  191. "1\t1\u00042\t2\u00043\t3\u00044\t4\u00045\t5\u00046\t6\u00047\t7\u0004",
  192. "8\t8\u00049\t9\u0003\u0002\u0003\u0002\u0003\u0002\u0003\u0002\u0003",
  193. "\u0002\u0003\u0002\u0003\u0002\u0003\u0002\u0003\u0003\u0003\u0003\u0003",
  194. "\u0003\u0003\u0003\u0003\u0003\u0003\u0004\u0003\u0004\u0003\u0004\u0003",
  195. "\u0004\u0003\u0004\u0003\u0005\u0003\u0005\u0003\u0005\u0003\u0005\u0003",
  196. "\u0005\u0003\u0005\u0003\u0005\u0003\u0005\u0003\u0006\u0003\u0006\u0003",
  197. "\u0006\u0003\u0006\u0003\u0006\u0003\u0006\u0003\u0006\u0003\u0007\u0003",
  198. "\u0007\u0003\u0007\u0003\u0007\u0003\u0007\u0003\u0007\u0003\u0007\u0003",
  199. "\u0007\u0003\b\u0003\b\u0003\b\u0003\b\u0003\b\u0003\b\u0003\b\u0003",
  200. "\b\u0003\b\u0003\b\u0003\t\u0003\t\u0003\t\u0003\t\u0003\t\u0003\t\u0003",
  201. "\t\u0003\n\u0003\n\u0003\n\u0003\n\u0003\n\u0003\u000b\u0003\u000b\u0003",
  202. "\u000b\u0003\u000b\u0003\u000b\u0003\u000b\u0003\u000b\u0003\u000b\u0003",
  203. "\u000b\u0003\u000b\u0003\f\u0003\f\u0003\f\u0003\f\u0003\f\u0003\f\u0003",
  204. "\r\u0003\r\u0003\r\u0003\r\u0003\r\u0003\r\u0003\r\u0003\r\u0003\r\u0003",
  205. "\u000e\u0003\u000e\u0003\u000e\u0003\u000e\u0003\u000e\u0003\u000e\u0003",
  206. "\u000e\u0003\u000f\u0003\u000f\u0003\u000f\u0003\u000f\u0003\u0010\u0003",
  207. "\u0010\u0003\u0010\u0003\u0010\u0003\u0010\u0003\u0010\u0003\u0011\u0003",
  208. "\u0011\u0003\u0011\u0003\u0012\u0003\u0012\u0003\u0012\u0003\u0012\u0003",
  209. "\u0012\u0003\u0012\u0003\u0013\u0003\u0013\u0003\u0013\u0003\u0014\u0003",
  210. "\u0014\u0003\u0014\u0003\u0014\u0003\u0014\u0003\u0015\u0003\u0015\u0003",
  211. "\u0015\u0003\u0015\u0003\u0015\u0003\u0015\u0003\u0016\u0003\u0016\u0003",
  212. "\u0016\u0003\u0016\u0003\u0016\u0003\u0017\u0003\u0017\u0003\u0017\u0003",
  213. "\u0017\u0003\u0018\u0003\u0018\u0003\u0018\u0003\u0018\u0003\u0019\u0003",
  214. "\u0019\u0003\u0019\u0003\u001a\u0003\u001a\u0003\u001b\u0003\u001b\u0003",
  215. "\u001c\u0003\u001c\u0003\u001d\u0003\u001d\u0003\u001e\u0003\u001e\u0003",
  216. "\u001f\u0003\u001f\u0003 \u0003 \u0003!\u0003!\u0003\"\u0003\"\u0003",
  217. "#\u0003#\u0003$\u0003$\u0003%\u0003%\u0003&\u0003&\u0003&\u0003&\u0003",
  218. "&\u0003&\u0003&\u0003&\u0003&\u0005&\u0125\n&\u0003\'\u0003\'\u0003",
  219. "(\u0003(\u0003)\u0003)\u0007)\u012d\n)\f)\u000e)\u0130\u000b)\u0003",
  220. "*\u0003*\u0003*\u0003*\u0003+\u0006+\u0137\n+\r+\u000e+\u0138\u0003",
  221. "+\u0003+\u0003+\u0003+\u0005+\u013f\n+\u0003+\u0006+\u0142\n+\r+\u000e",
  222. "+\u0143\u0003+\u0003+\u0003+\u0003+\u0005+\u014a\n+\u0003+\u0006+\u014d",
  223. "\n+\r+\u000e+\u014e\u0005+\u0151\n+\u0003,\u0006,\u0154\n,\r,\u000e",
  224. ",\u0155\u0003,\u0003,\u0006,\u015a\n,\r,\u000e,\u015b\u0003,\u0006,",
  225. "\u015f\n,\r,\u000e,\u0160\u0003,\u0003,\u0007,\u0165\n,\f,\u000e,\u0168",
  226. "\u000b,\u0003,\u0005,\u016b\n,\u0003-\u0003-\u0005-\u016f\n-\u0003-",
  227. "\u0006-\u0172\n-\r-\u000e-\u0173\u0003.\u0003.\u0007.\u0178\n.\f.\u000e",
  228. ".\u017b\u000b.\u0003.\u0003.\u0003/\u0003/\u0005/\u0181\n/\u00030\u0003",
  229. "0\u00030\u00050\u0186\n0\u00030\u00030\u00031\u00031\u00031\u00031\u0003",
  230. "2\u00032\u00033\u00063\u0191\n3\r3\u000e3\u0192\u00033\u00053\u0196",
  231. "\n3\u00034\u00034\u00035\u00035\u00036\u00036\u00036\u00036\u00056\u01a0",
  232. "\n6\u00037\u00037\u00037\u00037\u00037\u00037\u00037\u00037\u00037\u0003",
  233. "7\u00037\u00057\u01ad\n7\u00038\u00038\u00038\u00038\u00038\u00038\u0003",
  234. "8\u00039\u00039\u00039\u00039\u00079\u01ba\n9\f9\u000e9\u01bd\u000b",
  235. "9\u00039\u00059\u01c0\n9\u00039\u00039\u00039\u00039\u00039\u00079\u01c7",
  236. "\n9\f9\u000e9\u01ca\u000b9\u00039\u00039\u00059\u01ce\n9\u00039\u0003",
  237. "9\u0003\u01c8\u0002:\u0003\u0003\u0005\u0004\u0007\u0005\t\u0006\u000b",
  238. "\u0007\r\b\u000f\t\u0011\n\u0013\u000b\u0015\f\u0017\r\u0019\u000e\u001b",
  239. "\u000f\u001d\u0010\u001f\u0011!\u0012#\u0013%\u0014\'\u0015)\u0016+",
  240. "\u0017-\u0002/\u00021\u00023\u00185\u00197\u001a9\u001b;\u001c=\u001d",
  241. "?\u001eA\u001fC E!G\"I#K$M%O&Q\'S(U)W*Y\u0002[+]\u0002_,a-c\u0002e.",
  242. "g\u0002i\u0002k\u0002m\u0002o\u0002q/\u0003\u0002\u0012\u0004\u0002",
  243. "--//\u0005\u0002\'\',,11\u0004\u0002>>@@\u0005\u0002C\\aac|\u0006\u0002",
  244. "2;C\\aac|\u0003\u00022;\u0003\u000223\u0004\u0002GGgg\u0006\u0002\f",
  245. "\f\u000f\u000f$$^^\u0006\u0002\f\f\u000f\u000f))^^\u0004\u0002\u000b",
  246. "\u000b\"\"\u0004\u0002\f\f\u000f\u000f\u0005\u00022;CHch\u0003\u0002",
  247. "29\n\u0002$$))^^ddhhppttvv\u0003\u000225\u0002\u01e5\u0002\u0003\u0003",
  248. "\u0002\u0002\u0002\u0002\u0005\u0003\u0002\u0002\u0002\u0002\u0007\u0003",
  249. "\u0002\u0002\u0002\u0002\t\u0003\u0002\u0002\u0002\u0002\u000b\u0003",
  250. "\u0002\u0002\u0002\u0002\r\u0003\u0002\u0002\u0002\u0002\u000f\u0003",
  251. "\u0002\u0002\u0002\u0002\u0011\u0003\u0002\u0002\u0002\u0002\u0013\u0003",
  252. "\u0002\u0002\u0002\u0002\u0015\u0003\u0002\u0002\u0002\u0002\u0017\u0003",
  253. "\u0002\u0002\u0002\u0002\u0019\u0003\u0002\u0002\u0002\u0002\u001b\u0003",
  254. "\u0002\u0002\u0002\u0002\u001d\u0003\u0002\u0002\u0002\u0002\u001f\u0003",
  255. "\u0002\u0002\u0002\u0002!\u0003\u0002\u0002\u0002\u0002#\u0003\u0002",
  256. "\u0002\u0002\u0002%\u0003\u0002\u0002\u0002\u0002\'\u0003\u0002\u0002",
  257. "\u0002\u0002)\u0003\u0002\u0002\u0002\u0002+\u0003\u0002\u0002\u0002",
  258. "\u00023\u0003\u0002\u0002\u0002\u00025\u0003\u0002\u0002\u0002\u0002",
  259. "7\u0003\u0002\u0002\u0002\u00029\u0003\u0002\u0002\u0002\u0002;\u0003",
  260. "\u0002\u0002\u0002\u0002=\u0003\u0002\u0002\u0002\u0002?\u0003\u0002",
  261. "\u0002\u0002\u0002A\u0003\u0002\u0002\u0002\u0002C\u0003\u0002\u0002",
  262. "\u0002\u0002E\u0003\u0002\u0002\u0002\u0002G\u0003\u0002\u0002\u0002",
  263. "\u0002I\u0003\u0002\u0002\u0002\u0002K\u0003\u0002\u0002\u0002\u0002",
  264. "M\u0003\u0002\u0002\u0002\u0002O\u0003\u0002\u0002\u0002\u0002Q\u0003",
  265. "\u0002\u0002\u0002\u0002S\u0003\u0002\u0002\u0002\u0002U\u0003\u0002",
  266. "\u0002\u0002\u0002W\u0003\u0002\u0002\u0002\u0002[\u0003\u0002\u0002",
  267. "\u0002\u0002_\u0003\u0002\u0002\u0002\u0002a\u0003\u0002\u0002\u0002",
  268. "\u0002e\u0003\u0002\u0002\u0002\u0002q\u0003\u0002\u0002\u0002\u0003",
  269. "s\u0003\u0002\u0002\u0002\u0005{\u0003\u0002\u0002\u0002\u0007\u0080",
  270. "\u0003\u0002\u0002\u0002\t\u0085\u0003\u0002\u0002\u0002\u000b\u008d",
  271. "\u0003\u0002\u0002\u0002\r\u0094\u0003\u0002\u0002\u0002\u000f\u009c",
  272. "\u0003\u0002\u0002\u0002\u0011\u00a6\u0003\u0002\u0002\u0002\u0013\u00ad",
  273. "\u0003\u0002\u0002\u0002\u0015\u00b2\u0003\u0002\u0002\u0002\u0017\u00bc",
  274. "\u0003\u0002\u0002\u0002\u0019\u00c2\u0003\u0002\u0002\u0002\u001b\u00cb",
  275. "\u0003\u0002\u0002\u0002\u001d\u00d2\u0003\u0002\u0002\u0002\u001f\u00d6",
  276. "\u0003\u0002\u0002\u0002!\u00dc\u0003\u0002\u0002\u0002#\u00df\u0003",
  277. "\u0002\u0002\u0002%\u00e5\u0003\u0002\u0002\u0002\'\u00e8\u0003\u0002",
  278. "\u0002\u0002)\u00ed\u0003\u0002\u0002\u0002+\u00f3\u0003\u0002\u0002",
  279. "\u0002-\u00f8\u0003\u0002\u0002\u0002/\u00fc\u0003\u0002\u0002\u0002",
  280. "1\u0100\u0003\u0002\u0002\u00023\u0103\u0003\u0002\u0002\u00025\u0105",
  281. "\u0003\u0002\u0002\u00027\u0107\u0003\u0002\u0002\u00029\u0109\u0003",
  282. "\u0002\u0002\u0002;\u010b\u0003\u0002\u0002\u0002=\u010d\u0003\u0002",
  283. "\u0002\u0002?\u010f\u0003\u0002\u0002\u0002A\u0111\u0003\u0002\u0002",
  284. "\u0002C\u0113\u0003\u0002\u0002\u0002E\u0115\u0003\u0002\u0002\u0002",
  285. "G\u0117\u0003\u0002\u0002\u0002I\u0119\u0003\u0002\u0002\u0002K\u0124",
  286. "\u0003\u0002\u0002\u0002M\u0126\u0003\u0002\u0002\u0002O\u0128\u0003",
  287. "\u0002\u0002\u0002Q\u012a\u0003\u0002\u0002\u0002S\u0131\u0003\u0002",
  288. "\u0002\u0002U\u0150\u0003\u0002\u0002\u0002W\u016a\u0003\u0002\u0002",
  289. "\u0002Y\u016c\u0003\u0002\u0002\u0002[\u0175\u0003\u0002\u0002\u0002",
  290. "]\u0180\u0003\u0002\u0002\u0002_\u0182\u0003\u0002\u0002\u0002a\u0189",
  291. "\u0003\u0002\u0002\u0002c\u018d\u0003\u0002\u0002\u0002e\u0195\u0003",
  292. "\u0002\u0002\u0002g\u0197\u0003\u0002\u0002\u0002i\u0199\u0003\u0002",
  293. "\u0002\u0002k\u019f\u0003\u0002\u0002\u0002m\u01ac\u0003\u0002\u0002",
  294. "\u0002o\u01ae\u0003\u0002\u0002\u0002q\u01cd\u0003\u0002\u0002\u0002",
  295. "st\u0007r\u0002\u0002tu\u0007t\u0002\u0002uv\u0007q\u0002\u0002vw\u0007",
  296. "i\u0002\u0002wx\u0007t\u0002\u0002xy\u0007c\u0002\u0002yz\u0007o\u0002",
  297. "\u0002z\u0004\u0003\u0002\u0002\u0002{|\u0007t\u0002\u0002|}\u0007g",
  298. "\u0002\u0002}~\u0007c\u0002\u0002~\u007f\u0007n\u0002\u0002\u007f\u0006",
  299. "\u0003\u0002\u0002\u0002\u0080\u0081\u0007x\u0002\u0002\u0081\u0082",
  300. "\u0007q\u0002\u0002\u0082\u0083\u0007k\u0002\u0002\u0083\u0084\u0007",
  301. "f\u0002\u0002\u0084\b\u0003\u0002\u0002\u0002\u0085\u0086\u0007d\u0002",
  302. "\u0002\u0086\u0087\u0007q\u0002\u0002\u0087\u0088\u0007q\u0002\u0002",
  303. "\u0088\u0089\u0007n\u0002\u0002\u0089\u008a\u0007g\u0002\u0002\u008a",
  304. "\u008b\u0007c\u0002\u0002\u008b\u008c\u0007p\u0002\u0002\u008c\n\u0003",
  305. "\u0002\u0002\u0002\u008d\u008e\u0007u\u0002\u0002\u008e\u008f\u0007",
  306. "v\u0002\u0002\u008f\u0090\u0007t\u0002\u0002\u0090\u0091\u0007k\u0002",
  307. "\u0002\u0091\u0092\u0007p\u0002\u0002\u0092\u0093\u0007i\u0002\u0002",
  308. "\u0093\f\u0003\u0002\u0002\u0002\u0094\u0095\u0007k\u0002\u0002\u0095",
  309. "\u0096\u0007p\u0002\u0002\u0096\u0097\u0007v\u0002\u0002\u0097\u0098",
  310. "\u0007g\u0002\u0002\u0098\u0099\u0007i\u0002\u0002\u0099\u009a\u0007",
  311. "g\u0002\u0002\u009a\u009b\u0007t\u0002\u0002\u009b\u000e\u0003\u0002",
  312. "\u0002\u0002\u009c\u009d\u0007e\u0002\u0002\u009d\u009e\u0007j\u0002",
  313. "\u0002\u009e\u009f\u0007c\u0002\u0002\u009f\u00a0\u0007t\u0002\u0002",
  314. "\u00a0\u00a1\u0007c\u0002\u0002\u00a1\u00a2\u0007e\u0002\u0002\u00a2",
  315. "\u00a3\u0007v\u0002\u0002\u00a3\u00a4\u0007g\u0002\u0002\u00a4\u00a5",
  316. "\u0007t\u0002\u0002\u00a5\u0010\u0003\u0002\u0002\u0002\u00a6\u00a7",
  317. "\u0007u\u0002\u0002\u00a7\u00a8\u0007y\u0002\u0002\u00a8\u00a9\u0007",
  318. "k\u0002\u0002\u00a9\u00aa\u0007v\u0002\u0002\u00aa\u00ab\u0007e\u0002",
  319. "\u0002\u00ab\u00ac\u0007j\u0002\u0002\u00ac\u0012\u0003\u0002\u0002",
  320. "\u0002\u00ad\u00ae\u0007e\u0002\u0002\u00ae\u00af\u0007c\u0002\u0002",
  321. "\u00af\u00b0\u0007u\u0002\u0002\u00b0\u00b1\u0007g\u0002\u0002\u00b1",
  322. "\u0014\u0003\u0002\u0002\u0002\u00b2\u00b3\u0007q\u0002\u0002\u00b3",
  323. "\u00b4\u0007v\u0002\u0002\u00b4\u00b5\u0007j\u0002\u0002\u00b5\u00b6",
  324. "\u0007g\u0002\u0002\u00b6\u00b7\u0007t\u0002\u0002\u00b7\u00b8\u0007",
  325. "y\u0002\u0002\u00b8\u00b9\u0007k\u0002\u0002\u00b9\u00ba\u0007u\u0002",
  326. "\u0002\u00ba\u00bb\u0007g\u0002\u0002\u00bb\u0016\u0003\u0002\u0002",
  327. "\u0002\u00bc\u00bd\u0007e\u0002\u0002\u00bd\u00be\u0007q\u0002\u0002",
  328. "\u00be\u00bf\u0007p\u0002\u0002\u00bf\u00c0\u0007u\u0002\u0002\u00c0",
  329. "\u00c1\u0007v\u0002\u0002\u00c1\u0018\u0003\u0002\u0002\u0002\u00c2",
  330. "\u00c3\u0007h\u0002\u0002\u00c3\u00c4\u0007w\u0002\u0002\u00c4\u00c5",
  331. "\u0007p\u0002\u0002\u00c5\u00c6\u0007e\u0002\u0002\u00c6\u00c7\u0007",
  332. "v\u0002\u0002\u00c7\u00c8\u0007k\u0002\u0002\u00c8\u00c9\u0007q\u0002",
  333. "\u0002\u00c9\u00ca\u0007p\u0002\u0002\u00ca\u001a\u0003\u0002\u0002",
  334. "\u0002\u00cb\u00cc\u0007t\u0002\u0002\u00cc\u00cd\u0007g\u0002\u0002",
  335. "\u00cd\u00ce\u0007v\u0002\u0002\u00ce\u00cf\u0007w\u0002\u0002\u00cf",
  336. "\u00d0\u0007t\u0002\u0002\u00d0\u00d1\u0007p\u0002\u0002\u00d1\u001c",
  337. "\u0003\u0002\u0002\u0002\u00d2\u00d3\u0007h\u0002\u0002\u00d3\u00d4",
  338. "\u0007q\u0002\u0002\u00d4\u00d5\u0007t\u0002\u0002\u00d5\u001e\u0003",
  339. "\u0002\u0002\u0002\u00d6\u00d7\u0007d\u0002\u0002\u00d7\u00d8\u0007",
  340. "t\u0002\u0002\u00d8\u00d9\u0007g\u0002\u0002\u00d9\u00da\u0007c\u0002",
  341. "\u0002\u00da\u00db\u0007m\u0002\u0002\u00db \u0003\u0002\u0002\u0002",
  342. "\u00dc\u00dd\u0007f\u0002\u0002\u00dd\u00de\u0007q\u0002\u0002\u00de",
  343. "\"\u0003\u0002\u0002\u0002\u00df\u00e0\u0007y\u0002\u0002\u00e0\u00e1",
  344. "\u0007j\u0002\u0002\u00e1\u00e2\u0007k\u0002\u0002\u00e2\u00e3\u0007",
  345. "n\u0002\u0002\u00e3\u00e4\u0007g\u0002\u0002\u00e4$\u0003\u0002\u0002",
  346. "\u0002\u00e5\u00e6\u0007k\u0002\u0002\u00e6\u00e7\u0007h\u0002\u0002",
  347. "\u00e7&\u0003\u0002\u0002\u0002\u00e8\u00e9\u0007g\u0002\u0002\u00e9",
  348. "\u00ea\u0007n\u0002\u0002\u00ea\u00eb\u0007u\u0002\u0002\u00eb\u00ec",
  349. "\u0007g\u0002\u0002\u00ec(\u0003\u0002\u0002\u0002\u00ed\u00ee\u0007",
  350. "h\u0002\u0002\u00ee\u00ef\u0007c\u0002\u0002\u00ef\u00f0\u0007n\u0002",
  351. "\u0002\u00f0\u00f1\u0007u\u0002\u0002\u00f1\u00f2\u0007g\u0002\u0002",
  352. "\u00f2*\u0003\u0002\u0002\u0002\u00f3\u00f4\u0007v\u0002\u0002\u00f4",
  353. "\u00f5\u0007t\u0002\u0002\u00f5\u00f6\u0007w\u0002\u0002\u00f6\u00f7",
  354. "\u0007g\u0002\u0002\u00f7,\u0003\u0002\u0002\u0002\u00f8\u00f9\u0007",
  355. "p\u0002\u0002\u00f9\u00fa\u0007q\u0002\u0002\u00fa\u00fb\u0007v\u0002",
  356. "\u0002\u00fb.\u0003\u0002\u0002\u0002\u00fc\u00fd\u0007C\u0002\u0002",
  357. "\u00fd\u00fe\u0007P\u0002\u0002\u00fe\u00ff\u0007F\u0002\u0002\u00ff",
  358. "0\u0003\u0002\u0002\u0002\u0100\u0101\u0007Q\u0002\u0002\u0101\u0102",
  359. "\u0007T\u0002\u0002\u01022\u0003\u0002\u0002\u0002\u0103\u0104\u0007",
  360. "*\u0002\u0002\u01044\u0003\u0002\u0002\u0002\u0105\u0106\u0007+\u0002",
  361. "\u0002\u01066\u0003\u0002\u0002\u0002\u0107\u0108\u0007]\u0002\u0002",
  362. "\u01088\u0003\u0002\u0002\u0002\u0109\u010a\u0007_\u0002\u0002\u010a",
  363. ":\u0003\u0002\u0002\u0002\u010b\u010c\u0007}\u0002\u0002\u010c<\u0003",
  364. "\u0002\u0002\u0002\u010d\u010e\u0007\u007f\u0002\u0002\u010e>\u0003",
  365. "\u0002\u0002\u0002\u010f\u0110\u0007.\u0002\u0002\u0110@\u0003\u0002",
  366. "\u0002\u0002\u0111\u0112\u0007?\u0002\u0002\u0112B\u0003\u0002\u0002",
  367. "\u0002\u0113\u0114\t\u0002\u0002\u0002\u0114D\u0003\u0002\u0002\u0002",
  368. "\u0115\u0116\t\u0003\u0002\u0002\u0116F\u0003\u0002\u0002\u0002\u0117",
  369. "\u0118\u0005/\u0018\u0002\u0118H\u0003\u0002\u0002\u0002\u0119\u011a",
  370. "\u00051\u0019\u0002\u011aJ\u0003\u0002\u0002\u0002\u011b\u011c\u0007",
  371. "@\u0002\u0002\u011c\u0125\u0007?\u0002\u0002\u011d\u011e\u0007?\u0002",
  372. "\u0002\u011e\u0125\u0007?\u0002\u0002\u011f\u0120\u0007>\u0002\u0002",
  373. "\u0120\u0125\u0007?\u0002\u0002\u0121\u0125\t\u0004\u0002\u0002\u0122",
  374. "\u0123\u0007#\u0002\u0002\u0123\u0125\u0007?\u0002\u0002\u0124\u011b",
  375. "\u0003\u0002\u0002\u0002\u0124\u011d\u0003\u0002\u0002\u0002\u0124\u011f",
  376. "\u0003\u0002\u0002\u0002\u0124\u0121\u0003\u0002\u0002\u0002\u0124\u0122",
  377. "\u0003\u0002\u0002\u0002\u0125L\u0003\u0002\u0002\u0002\u0126\u0127",
  378. "\u0007<\u0002\u0002\u0127N\u0003\u0002\u0002\u0002\u0128\u0129\u0005",
  379. "-\u0017\u0002\u0129P\u0003\u0002\u0002\u0002\u012a\u012e\t\u0005\u0002",
  380. "\u0002\u012b\u012d\t\u0006\u0002\u0002\u012c\u012b\u0003\u0002\u0002",
  381. "\u0002\u012d\u0130\u0003\u0002\u0002\u0002\u012e\u012c\u0003\u0002\u0002",
  382. "\u0002\u012e\u012f\u0003\u0002\u0002\u0002\u012fR\u0003\u0002\u0002",
  383. "\u0002\u0130\u012e\u0003\u0002\u0002\u0002\u0131\u0132\u0005Q)\u0002",
  384. "\u0132\u0133\u00070\u0002\u0002\u0133\u0134\u0005Q)\u0002\u0134T\u0003",
  385. "\u0002\u0002\u0002\u0135\u0137\t\u0007\u0002\u0002\u0136\u0135\u0003",
  386. "\u0002\u0002\u0002\u0137\u0138\u0003\u0002\u0002\u0002\u0138\u0136\u0003",
  387. "\u0002\u0002\u0002\u0138\u0139\u0003\u0002\u0002\u0002\u0139\u0151\u0003",
  388. "\u0002\u0002\u0002\u013a\u013b\u00072\u0002\u0002\u013b\u013f\u0007",
  389. "z\u0002\u0002\u013c\u013d\u00072\u0002\u0002\u013d\u013f\u0007Z\u0002",
  390. "\u0002\u013e\u013a\u0003\u0002\u0002\u0002\u013e\u013c\u0003\u0002\u0002",
  391. "\u0002\u013f\u0141\u0003\u0002\u0002\u0002\u0140\u0142\u0005g4\u0002",
  392. "\u0141\u0140\u0003\u0002\u0002\u0002\u0142\u0143\u0003\u0002\u0002\u0002",
  393. "\u0143\u0141\u0003\u0002\u0002\u0002\u0143\u0144\u0003\u0002\u0002\u0002",
  394. "\u0144\u0151\u0003\u0002\u0002\u0002\u0145\u0146\u00072\u0002\u0002",
  395. "\u0146\u014a\u0007d\u0002\u0002\u0147\u0148\u00072\u0002\u0002\u0148",
  396. "\u014a\u0007D\u0002\u0002\u0149\u0145\u0003\u0002\u0002\u0002\u0149",
  397. "\u0147\u0003\u0002\u0002\u0002\u014a\u014c\u0003\u0002\u0002\u0002\u014b",
  398. "\u014d\t\b\u0002\u0002\u014c\u014b\u0003\u0002\u0002\u0002\u014d\u014e",
  399. "\u0003\u0002\u0002\u0002\u014e\u014c\u0003\u0002\u0002\u0002\u014e\u014f",
  400. "\u0003\u0002\u0002\u0002\u014f\u0151\u0003\u0002\u0002\u0002\u0150\u0136",
  401. "\u0003\u0002\u0002\u0002\u0150\u013e\u0003\u0002\u0002\u0002\u0150\u0149",
  402. "\u0003\u0002\u0002\u0002\u0151V\u0003\u0002\u0002\u0002\u0152\u0154",
  403. "\t\u0007\u0002\u0002\u0153\u0152\u0003\u0002\u0002\u0002\u0154\u0155",
  404. "\u0003\u0002\u0002\u0002\u0155\u0153\u0003\u0002\u0002\u0002\u0155\u0156",
  405. "\u0003\u0002\u0002\u0002\u0156\u0157\u0003\u0002\u0002\u0002\u0157\u0159",
  406. "\u00070\u0002\u0002\u0158\u015a\t\u0007\u0002\u0002\u0159\u0158\u0003",
  407. "\u0002\u0002\u0002\u015a\u015b\u0003\u0002\u0002\u0002\u015b\u0159\u0003",
  408. "\u0002\u0002\u0002\u015b\u015c\u0003\u0002\u0002\u0002\u015c\u016b\u0003",
  409. "\u0002\u0002\u0002\u015d\u015f\t\u0007\u0002\u0002\u015e\u015d\u0003",
  410. "\u0002\u0002\u0002\u015f\u0160\u0003\u0002\u0002\u0002\u0160\u015e\u0003",
  411. "\u0002\u0002\u0002\u0160\u0161\u0003\u0002\u0002\u0002\u0161\u0162\u0003",
  412. "\u0002\u0002\u0002\u0162\u0166\u00070\u0002\u0002\u0163\u0165\t\u0007",
  413. "\u0002\u0002\u0164\u0163\u0003\u0002\u0002\u0002\u0165\u0168\u0003\u0002",
  414. "\u0002\u0002\u0166\u0164\u0003\u0002\u0002\u0002\u0166\u0167\u0003\u0002",
  415. "\u0002\u0002\u0167\u0169\u0003\u0002\u0002\u0002\u0168\u0166\u0003\u0002",
  416. "\u0002\u0002\u0169\u016b\u0005Y-\u0002\u016a\u0153\u0003\u0002\u0002",
  417. "\u0002\u016a\u015e\u0003\u0002\u0002\u0002\u016bX\u0003\u0002\u0002",
  418. "\u0002\u016c\u016e\t\t\u0002\u0002\u016d\u016f\t\u0002\u0002\u0002\u016e",
  419. "\u016d\u0003\u0002\u0002\u0002\u016e\u016f\u0003\u0002\u0002\u0002\u016f",
  420. "\u0171\u0003\u0002\u0002\u0002\u0170\u0172\t\u0007\u0002\u0002\u0171",
  421. "\u0170\u0003\u0002\u0002\u0002\u0172\u0173\u0003\u0002\u0002\u0002\u0173",
  422. "\u0171\u0003\u0002\u0002\u0002\u0173\u0174\u0003\u0002\u0002\u0002\u0174",
  423. "Z\u0003\u0002\u0002\u0002\u0175\u0179\u0007$\u0002\u0002\u0176\u0178",
  424. "\u0005]/\u0002\u0177\u0176\u0003\u0002\u0002\u0002\u0178\u017b\u0003",
  425. "\u0002\u0002\u0002\u0179\u0177\u0003\u0002\u0002\u0002\u0179\u017a\u0003",
  426. "\u0002\u0002\u0002\u017a\u017c\u0003\u0002\u0002\u0002\u017b\u0179\u0003",
  427. "\u0002\u0002\u0002\u017c\u017d\u0007$\u0002\u0002\u017d\\\u0003\u0002",
  428. "\u0002\u0002\u017e\u0181\n\n\u0002\u0002\u017f\u0181\u0005k6\u0002\u0180",
  429. "\u017e\u0003\u0002\u0002\u0002\u0180\u017f\u0003\u0002\u0002\u0002\u0181",
  430. "^\u0003\u0002\u0002\u0002\u0182\u0185\u0007)\u0002\u0002\u0183\u0186",
  431. "\u0005k6\u0002\u0184\u0186\n\u000b\u0002\u0002\u0185\u0183\u0003\u0002",
  432. "\u0002\u0002\u0185\u0184\u0003\u0002\u0002\u0002\u0186\u0187\u0003\u0002",
  433. "\u0002\u0002\u0187\u0188\u0007)\u0002\u0002\u0188`\u0003\u0002\u0002",
  434. "\u0002\u0189\u018a\t\f\u0002\u0002\u018a\u018b\u0003\u0002\u0002\u0002",
  435. "\u018b\u018c\b1\u0002\u0002\u018cb\u0003\u0002\u0002\u0002\u018d\u018e",
  436. "\u0007=\u0002\u0002\u018ed\u0003\u0002\u0002\u0002\u018f\u0191\t\r\u0002",
  437. "\u0002\u0190\u018f\u0003\u0002\u0002\u0002\u0191\u0192\u0003\u0002\u0002",
  438. "\u0002\u0192\u0190\u0003\u0002\u0002\u0002\u0192\u0193\u0003\u0002\u0002",
  439. "\u0002\u0193\u0196\u0003\u0002\u0002\u0002\u0194\u0196\u0005c2\u0002",
  440. "\u0195\u0190\u0003\u0002\u0002\u0002\u0195\u0194\u0003\u0002\u0002\u0002",
  441. "\u0196f\u0003\u0002\u0002\u0002\u0197\u0198\t\u000e\u0002\u0002\u0198",
  442. "h\u0003\u0002\u0002\u0002\u0199\u019a\t\u000f\u0002\u0002\u019aj\u0003",
  443. "\u0002\u0002\u0002\u019b\u019c\u0007^\u0002\u0002\u019c\u01a0\t\u0010",
  444. "\u0002\u0002\u019d\u01a0\u0005o8\u0002\u019e\u01a0\u0005m7\u0002\u019f",
  445. "\u019b\u0003\u0002\u0002\u0002\u019f\u019d\u0003\u0002\u0002\u0002\u019f",
  446. "\u019e\u0003\u0002\u0002\u0002\u01a0l\u0003\u0002\u0002\u0002\u01a1",
  447. "\u01a2\u0007^\u0002\u0002\u01a2\u01a3\t\u0011\u0002\u0002\u01a3\u01a4",
  448. "\u0005i5\u0002\u01a4\u01a5\u0005i5\u0002\u01a5\u01ad\u0003\u0002\u0002",
  449. "\u0002\u01a6\u01a7\u0007^\u0002\u0002\u01a7\u01a8\u0005i5\u0002\u01a8",
  450. "\u01a9\u0005i5\u0002\u01a9\u01ad\u0003\u0002\u0002\u0002\u01aa\u01ab",
  451. "\u0007^\u0002\u0002\u01ab\u01ad\u0005i5\u0002\u01ac\u01a1\u0003\u0002",
  452. "\u0002\u0002\u01ac\u01a6\u0003\u0002\u0002\u0002\u01ac\u01aa\u0003\u0002",
  453. "\u0002\u0002\u01adn\u0003\u0002\u0002\u0002\u01ae\u01af\u0007^\u0002",
  454. "\u0002\u01af\u01b0\u0007w\u0002\u0002\u01b0\u01b1\u0005g4\u0002\u01b1",
  455. "\u01b2\u0005g4\u0002\u01b2\u01b3\u0005g4\u0002\u01b3\u01b4\u0005g4\u0002",
  456. "\u01b4p\u0003\u0002\u0002\u0002\u01b5\u01b6\u00071\u0002\u0002\u01b6",
  457. "\u01b7\u00071\u0002\u0002\u01b7\u01bb\u0003\u0002\u0002\u0002\u01b8",
  458. "\u01ba\n\r\u0002\u0002\u01b9\u01b8\u0003\u0002\u0002\u0002\u01ba\u01bd",
  459. "\u0003\u0002\u0002\u0002\u01bb\u01b9\u0003\u0002\u0002\u0002\u01bb\u01bc",
  460. "\u0003\u0002\u0002\u0002\u01bc\u01bf\u0003\u0002\u0002\u0002\u01bd\u01bb",
  461. "\u0003\u0002\u0002\u0002\u01be\u01c0\u0007\u000f\u0002\u0002\u01bf\u01be",
  462. "\u0003\u0002\u0002\u0002\u01bf\u01c0\u0003\u0002\u0002\u0002\u01c0\u01c1",
  463. "\u0003\u0002\u0002\u0002\u01c1\u01ce\u0007\f\u0002\u0002\u01c2\u01c3",
  464. "\u00071\u0002\u0002\u01c3\u01c4\u0007,\u0002\u0002\u01c4\u01c8\u0003",
  465. "\u0002\u0002\u0002\u01c5\u01c7\u000b\u0002\u0002\u0002\u01c6\u01c5\u0003",
  466. "\u0002\u0002\u0002\u01c7\u01ca\u0003\u0002\u0002\u0002\u01c8\u01c9\u0003",
  467. "\u0002\u0002\u0002\u01c8\u01c6\u0003\u0002\u0002\u0002\u01c9\u01cb\u0003",
  468. "\u0002\u0002\u0002\u01ca\u01c8\u0003\u0002\u0002\u0002\u01cb\u01cc\u0007",
  469. ",\u0002\u0002\u01cc\u01ce\u00071\u0002\u0002\u01cd\u01b5\u0003\u0002",
  470. "\u0002\u0002\u01cd\u01c2\u0003\u0002\u0002\u0002\u01ce\u01cf\u0003\u0002",
  471. "\u0002\u0002\u01cf\u01d0\b9\u0003\u0002\u01d0r\u0003\u0002\u0002\u0002",
  472. "\u001d\u0002\u0124\u012e\u0138\u013e\u0143\u0149\u014e\u0150\u0155\u015b",
  473. "\u0160\u0166\u016a\u016e\u0173\u0179\u0180\u0185\u0192\u0195\u019f\u01ac",
  474. "\u01bb\u01bf\u01c8\u01cd\u0004\b\u0002\u0002\u0002\u0003\u0002"].join("");
  475. var atn = new antlr4.atn.ATNDeserializer().deserialize(serializedATN);
  476. var decisionsToDFA = atn.decisionToState.map( function(ds, index) { return new antlr4.dfa.DFA(ds, index); });
  477. function ivprog(input) {
  478. antlr4.Lexer.call(this, input);
  479. this._interp = new antlr4.atn.LexerATNSimulator(this, atn, decisionsToDFA, new antlr4.PredictionContextCache());
  480. return this;
  481. }
  482. ivprog.prototype = Object.create(antlr4.Lexer.prototype);
  483. ivprog.prototype.constructor = ivprog;
  484. ivprog.EOF = antlr4.Token.EOF;
  485. ivprog.RK_PROGRAM = 1;
  486. ivprog.RK_REAL = 2;
  487. ivprog.RK_VOID = 3;
  488. ivprog.RK_BOOLEAN = 4;
  489. ivprog.RK_STRING = 5;
  490. ivprog.RK_INTEGER = 6;
  491. ivprog.RK_CHARACTER = 7;
  492. ivprog.RK_SWITCH = 8;
  493. ivprog.RK_CASE = 9;
  494. ivprog.RK_DEFAULT = 10;
  495. ivprog.RK_CONST = 11;
  496. ivprog.RK_FUNCTION = 12;
  497. ivprog.RK_RETURN = 13;
  498. ivprog.RK_FOR = 14;
  499. ivprog.RK_BREAK = 15;
  500. ivprog.RK_DO = 16;
  501. ivprog.RK_WHILE = 17;
  502. ivprog.RK_IF = 18;
  503. ivprog.RK_ELSE = 19;
  504. ivprog.RK_FALSE = 20;
  505. ivprog.RK_TRUE = 21;
  506. ivprog.OPEN_PARENTHESIS = 22;
  507. ivprog.CLOSE_PARENTHESIS = 23;
  508. ivprog.OPEN_BRACE = 24;
  509. ivprog.CLOSE_BRACE = 25;
  510. ivprog.OPEN_CURLY = 26;
  511. ivprog.CLOSE_CURLY = 27;
  512. ivprog.COMMA = 28;
  513. ivprog.EQUAL = 29;
  514. ivprog.SUM_OP = 30;
  515. ivprog.MULTI_OP = 31;
  516. ivprog.AND_OPERATOR = 32;
  517. ivprog.OR_OPERATOR = 33;
  518. ivprog.RELATIONAL_OPERATOR = 34;
  519. ivprog.COLON = 35;
  520. ivprog.NOT_OPERATOR = 36;
  521. ivprog.ID = 37;
  522. ivprog.LIB_ID = 38;
  523. ivprog.INTEGER = 39;
  524. ivprog.REAL = 40;
  525. ivprog.STRING = 41;
  526. ivprog.CHARACTER = 42;
  527. ivprog.WHITESPACE = 43;
  528. ivprog.EOS = 44;
  529. ivprog.COMMENTS = 45;
  530. ivprog.prototype.channelNames = [ "DEFAULT_TOKEN_CHANNEL", "HIDDEN" ];
  531. ivprog.prototype.modeNames = [ "DEFAULT_MODE" ];
  532. ivprog.prototype.literalNames = [ null, "'program'", "'real'", "'void'",
  533. "'boolean'", "'string'", "'integer'",
  534. "'character'", "'switch'", "'case'", "'otherwise'",
  535. "'const'", "'function'", "'return'", "'for'",
  536. "'break'", "'do'", "'while'", "'if'",
  537. "'else'", "'false'", "'true'", "'('",
  538. "')'", "'['", "']'", "'{'", "'}'", "','",
  539. "'='", null, null, null, null, null, "':'" ];
  540. ivprog.prototype.symbolicNames = [ null, "RK_PROGRAM", "RK_REAL", "RK_VOID",
  541. "RK_BOOLEAN", "RK_STRING", "RK_INTEGER",
  542. "RK_CHARACTER", "RK_SWITCH", "RK_CASE",
  543. "RK_DEFAULT", "RK_CONST", "RK_FUNCTION",
  544. "RK_RETURN", "RK_FOR", "RK_BREAK", "RK_DO",
  545. "RK_WHILE", "RK_IF", "RK_ELSE", "RK_FALSE",
  546. "RK_TRUE", "OPEN_PARENTHESIS", "CLOSE_PARENTHESIS",
  547. "OPEN_BRACE", "CLOSE_BRACE", "OPEN_CURLY",
  548. "CLOSE_CURLY", "COMMA", "EQUAL", "SUM_OP",
  549. "MULTI_OP", "AND_OPERATOR", "OR_OPERATOR",
  550. "RELATIONAL_OPERATOR", "COLON", "NOT_OPERATOR",
  551. "ID", "LIB_ID", "INTEGER", "REAL", "STRING",
  552. "CHARACTER", "WHITESPACE", "EOS", "COMMENTS" ];
  553. ivprog.prototype.ruleNames = [ "RK_PROGRAM", "RK_REAL", "RK_VOID", "RK_BOOLEAN",
  554. "RK_STRING", "RK_INTEGER", "RK_CHARACTER",
  555. "RK_SWITCH", "RK_CASE", "RK_DEFAULT", "RK_CONST",
  556. "RK_FUNCTION", "RK_RETURN", "RK_FOR", "RK_BREAK",
  557. "RK_DO", "RK_WHILE", "RK_IF", "RK_ELSE",
  558. "RK_FALSE", "RK_TRUE", "RK_LOGICAL_NOT",
  559. "RK_LOGICAL_AND", "RK_LOGICAL_OR", "OPEN_PARENTHESIS",
  560. "CLOSE_PARENTHESIS", "OPEN_BRACE", "CLOSE_BRACE",
  561. "OPEN_CURLY", "CLOSE_CURLY", "COMMA", "EQUAL",
  562. "SUM_OP", "MULTI_OP", "AND_OPERATOR", "OR_OPERATOR",
  563. "RELATIONAL_OPERATOR", "COLON", "NOT_OPERATOR",
  564. "ID", "LIB_ID", "INTEGER", "REAL", "ExponentPart",
  565. "STRING", "STRING_CHARACTER", "CHARACTER",
  566. "WHITESPACE", "SEMICOLON", "EOS", "HEX_DIGIT",
  567. "OCTAL_DIGIT", "ESC_SEQ", "ESC_OCTAL", "ESC_UNICODE",
  568. "COMMENTS" ];
  569. ivprog.prototype.grammarFileName = "ivprog.g4";
  570. exports.ivprog = ivprog;
  571. /***/ }),
  572. /* 1 */
  573. /***/ (function(module, exports, __webpack_require__) {
  574. module.exports = {
  575. ivprog: __webpack_require__(0).ivprog
  576. };
  577. /***/ }),
  578. /* 2 */
  579. /***/ (function(module, exports) {
  580. module.exports = __webpack_require__(/*! antlr4/index */ "./node_modules/antlr4/index.js");
  581. /***/ })
  582. /******/ ]);
  583. /***/ }),
  584. /***/ "./grammar/en/langFunctions.js":
  585. /*!*************************************!*\
  586. !*** ./grammar/en/langFunctions.js ***!
  587. \*************************************/
  588. /*! no static exports found */
  589. /***/ (function(module, exports, __webpack_require__) {
  590. "use strict";
  591. Object.defineProperty(exports, "__esModule", {
  592. value: true
  593. });
  594. /* This is a dictionary of the language defined functions
  595. **/
  596. exports.default = {
  597. main_function: "start",
  598. $read: "read",
  599. $write: "write",
  600. $numElements: "total_of_elements",
  601. $matrixLines: "total_of_lines",
  602. $matrixColumns: "total_of_columns",
  603. $substring: "subcadeia",
  604. $length: "comprimento",
  605. $uppercase: "caixa_alta",
  606. $lowercase: "caixa_baixa",
  607. $charAt: "char_at",
  608. $isReal: "is_real",
  609. $isInt: "is_integer",
  610. $isBool: "is_logic",
  611. $castReal: "to_real",
  612. $castInt: "to_integer",
  613. $castBool: "to_logic",
  614. $castString: "to_string",
  615. $sin: "sin",
  616. $cos: "cos",
  617. $tan: "tan",
  618. $sqrt: "sqrt",
  619. $pow: "pow",
  620. $log: "log",
  621. $abs: "abs",
  622. $negate: "negate",
  623. $invert: "invert",
  624. $max: "maximum",
  625. $min: "minimum"
  626. };
  627. /***/ }),
  628. /***/ "./grammar/en/langLibs.js":
  629. /*!********************************!*\
  630. !*** ./grammar/en/langLibs.js ***!
  631. \********************************/
  632. /*! no static exports found */
  633. /***/ (function(module, exports, __webpack_require__) {
  634. "use strict";
  635. Object.defineProperty(exports, "__esModule", {
  636. value: true
  637. });
  638. /**
  639. * This is the dictionary of the language defined libraries
  640. */
  641. exports.default = {
  642. $mathLib: "Mathematic",
  643. $ioLib: "ES",
  644. $strLib: "Texto",
  645. $arrayLib: "Arranjo",
  646. $langLib: "Conversion"
  647. };
  648. /***/ }),
  649. /***/ "./grammar/es/ivprog.g4":
  650. /*!******************************!*\
  651. !*** ./grammar/es/ivprog.g4 ***!
  652. \******************************/
  653. /*! no static exports found */
  654. /***/ (function(module, exports, __webpack_require__) {
  655. module.exports =
  656. /******/ (function(modules) { // webpackBootstrap
  657. /******/ // The module cache
  658. /******/ var installedModules = {};
  659. /******/
  660. /******/ // The require function
  661. /******/ function __webpack_require__(moduleId) {
  662. /******/
  663. /******/ // Check if module is in cache
  664. /******/ if(installedModules[moduleId]) {
  665. /******/ return installedModules[moduleId].exports;
  666. /******/ }
  667. /******/ // Create a new module (and put it into the cache)
  668. /******/ var module = installedModules[moduleId] = {
  669. /******/ i: moduleId,
  670. /******/ l: false,
  671. /******/ exports: {}
  672. /******/ };
  673. /******/
  674. /******/ // Execute the module function
  675. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  676. /******/
  677. /******/ // Flag the module as loaded
  678. /******/ module.l = true;
  679. /******/
  680. /******/ // Return the exports of the module
  681. /******/ return module.exports;
  682. /******/ }
  683. /******/
  684. /******/
  685. /******/ // expose the modules object (__webpack_modules__)
  686. /******/ __webpack_require__.m = modules;
  687. /******/
  688. /******/ // expose the module cache
  689. /******/ __webpack_require__.c = installedModules;
  690. /******/
  691. /******/ // identity function for calling harmony imports with the correct context
  692. /******/ __webpack_require__.i = function(value) { return value; };
  693. /******/
  694. /******/ // define getter function for harmony exports
  695. /******/ __webpack_require__.d = function(exports, name, getter) {
  696. /******/ if(!__webpack_require__.o(exports, name)) {
  697. /******/ Object.defineProperty(exports, name, {
  698. /******/ configurable: false,
  699. /******/ enumerable: true,
  700. /******/ get: getter
  701. /******/ });
  702. /******/ }
  703. /******/ };
  704. /******/
  705. /******/ // getDefaultExport function for compatibility with non-harmony modules
  706. /******/ __webpack_require__.n = function(module) {
  707. /******/ var getter = module && module.__esModule ?
  708. /******/ function getDefault() { return module['default']; } :
  709. /******/ function getModuleExports() { return module; };
  710. /******/ __webpack_require__.d(getter, 'a', getter);
  711. /******/ return getter;
  712. /******/ };
  713. /******/
  714. /******/ // Object.prototype.hasOwnProperty.call
  715. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  716. /******/
  717. /******/ // __webpack_public_path__
  718. /******/ __webpack_require__.p = "";
  719. /******/
  720. /******/ // Load entry module and return exports
  721. /******/ return __webpack_require__(__webpack_require__.s = 1);
  722. /******/ })
  723. /************************************************************************/
  724. /******/ ([
  725. /* 0 */
  726. /***/ (function(module, exports, __webpack_require__) {
  727. // Generated from /tmp/tmp-3417Yy87YlUWLZeI/ivprog.g4 by ANTLR 4.7
  728. // jshint ignore: start
  729. var antlr4 = __webpack_require__(2);
  730. var serializedATN = ["\u0003\u608b\ua72a\u8133\ub9ed\u417c\u3be7\u7786\u5964",
  731. "\u0002/\u01dc\b\u0001\u0004\u0002\t\u0002\u0004\u0003\t\u0003\u0004",
  732. "\u0004\t\u0004\u0004\u0005\t\u0005\u0004\u0006\t\u0006\u0004\u0007\t",
  733. "\u0007\u0004\b\t\b\u0004\t\t\t\u0004\n\t\n\u0004\u000b\t\u000b\u0004",
  734. "\f\t\f\u0004\r\t\r\u0004\u000e\t\u000e\u0004\u000f\t\u000f\u0004\u0010",
  735. "\t\u0010\u0004\u0011\t\u0011\u0004\u0012\t\u0012\u0004\u0013\t\u0013",
  736. "\u0004\u0014\t\u0014\u0004\u0015\t\u0015\u0004\u0016\t\u0016\u0004\u0017",
  737. "\t\u0017\u0004\u0018\t\u0018\u0004\u0019\t\u0019\u0004\u001a\t\u001a",
  738. "\u0004\u001b\t\u001b\u0004\u001c\t\u001c\u0004\u001d\t\u001d\u0004\u001e",
  739. "\t\u001e\u0004\u001f\t\u001f\u0004 \t \u0004!\t!\u0004\"\t\"\u0004#",
  740. "\t#\u0004$\t$\u0004%\t%\u0004&\t&\u0004\'\t\'\u0004(\t(\u0004)\t)\u0004",
  741. "*\t*\u0004+\t+\u0004,\t,\u0004-\t-\u0004.\t.\u0004/\t/\u00040\t0\u0004",
  742. "1\t1\u00042\t2\u00043\t3\u00044\t4\u00045\t5\u00046\t6\u00047\t7\u0004",
  743. "8\t8\u00049\t9\u0003\u0002\u0003\u0002\u0003\u0002\u0003\u0002\u0003",
  744. "\u0002\u0003\u0002\u0003\u0002\u0003\u0002\u0003\u0002\u0003\u0003\u0003",
  745. "\u0003\u0003\u0003\u0003\u0003\u0003\u0003\u0003\u0004\u0003\u0004\u0003",
  746. "\u0004\u0003\u0004\u0003\u0004\u0003\u0004\u0003\u0005\u0003\u0005\u0003",
  747. "\u0005\u0003\u0005\u0003\u0005\u0003\u0005\u0003\u0005\u0003\u0006\u0003",
  748. "\u0006\u0003\u0006\u0003\u0006\u0003\u0006\u0003\u0006\u0003\u0006\u0003",
  749. "\u0007\u0003\u0007\u0003\u0007\u0003\u0007\u0003\u0007\u0003\u0007\u0003",
  750. "\u0007\u0003\u0007\u0003\b\u0003\b\u0003\b\u0003\b\u0003\b\u0003\b\u0003",
  751. "\b\u0003\b\u0003\b\u0003\b\u0003\t\u0003\t\u0003\t\u0003\t\u0003\t\u0003",
  752. "\t\u0003\t\u0003\t\u0003\n\u0003\n\u0003\n\u0003\n\u0003\n\u0003\u000b",
  753. "\u0003\u000b\u0003\u000b\u0003\u000b\u0003\u000b\u0003\u000b\u0003\u000b",
  754. "\u0003\u000b\u0003\u000b\u0003\u000b\u0003\f\u0003\f\u0003\f\u0003\f",
  755. "\u0003\f\u0003\f\u0003\r\u0003\r\u0003\r\u0003\r\u0003\r\u0003\r\u0003",
  756. "\r\u0003\u000e\u0003\u000e\u0003\u000e\u0003\u000e\u0003\u000e\u0003",
  757. "\u000e\u0003\u000e\u0003\u000e\u0003\u000f\u0003\u000f\u0003\u000f\u0003",
  758. "\u000f\u0003\u000f\u0003\u0010\u0003\u0010\u0003\u0010\u0003\u0010\u0003",
  759. "\u0010\u0003\u0011\u0003\u0011\u0003\u0011\u0003\u0011\u0003\u0011\u0003",
  760. "\u0012\u0003\u0012\u0003\u0012\u0003\u0012\u0003\u0012\u0003\u0012\u0003",
  761. "\u0012\u0003\u0012\u0003\u0012\u0003\u0013\u0003\u0013\u0003\u0013\u0003",
  762. "\u0014\u0003\u0014\u0003\u0014\u0003\u0014\u0003\u0014\u0003\u0014\u0003",
  763. "\u0015\u0003\u0015\u0003\u0015\u0003\u0015\u0003\u0015\u0003\u0015\u0003",
  764. "\u0016\u0003\u0016\u0003\u0016\u0003\u0016\u0003\u0016\u0003\u0016\u0003",
  765. "\u0016\u0003\u0016\u0003\u0016\u0003\u0016\u0003\u0016\u0003\u0017\u0003",
  766. "\u0017\u0003\u0017\u0003\u0017\u0003\u0018\u0003\u0018\u0003\u0019\u0003",
  767. "\u0019\u0003\u0019\u0003\u001a\u0003\u001a\u0003\u001b\u0003\u001b\u0003",
  768. "\u001c\u0003\u001c\u0003\u001d\u0003\u001d\u0003\u001e\u0003\u001e\u0003",
  769. "\u001f\u0003\u001f\u0003 \u0003 \u0003!\u0003!\u0003\"\u0003\"\u0003",
  770. "#\u0003#\u0003$\u0003$\u0003%\u0003%\u0003&\u0003&\u0003&\u0003&\u0003",
  771. "&\u0003&\u0003&\u0003&\u0003&\u0005&\u0130\n&\u0003\'\u0003\'\u0003",
  772. "(\u0003(\u0003)\u0003)\u0007)\u0138\n)\f)\u000e)\u013b\u000b)\u0003",
  773. "*\u0003*\u0003*\u0003*\u0003+\u0006+\u0142\n+\r+\u000e+\u0143\u0003",
  774. "+\u0003+\u0003+\u0003+\u0005+\u014a\n+\u0003+\u0006+\u014d\n+\r+\u000e",
  775. "+\u014e\u0003+\u0003+\u0003+\u0003+\u0005+\u0155\n+\u0003+\u0006+\u0158",
  776. "\n+\r+\u000e+\u0159\u0005+\u015c\n+\u0003,\u0006,\u015f\n,\r,\u000e",
  777. ",\u0160\u0003,\u0003,\u0006,\u0165\n,\r,\u000e,\u0166\u0003,\u0006,",
  778. "\u016a\n,\r,\u000e,\u016b\u0003,\u0003,\u0007,\u0170\n,\f,\u000e,\u0173",
  779. "\u000b,\u0003,\u0005,\u0176\n,\u0003-\u0003-\u0005-\u017a\n-\u0003-",
  780. "\u0006-\u017d\n-\r-\u000e-\u017e\u0003.\u0003.\u0007.\u0183\n.\f.\u000e",
  781. ".\u0186\u000b.\u0003.\u0003.\u0003/\u0003/\u0005/\u018c\n/\u00030\u0003",
  782. "0\u00030\u00050\u0191\n0\u00030\u00030\u00031\u00031\u00031\u00031\u0003",
  783. "2\u00032\u00033\u00063\u019c\n3\r3\u000e3\u019d\u00033\u00053\u01a1",
  784. "\n3\u00034\u00034\u00035\u00035\u00036\u00036\u00036\u00036\u00056\u01ab",
  785. "\n6\u00037\u00037\u00037\u00037\u00037\u00037\u00037\u00037\u00037\u0003",
  786. "7\u00037\u00057\u01b8\n7\u00038\u00038\u00038\u00038\u00038\u00038\u0003",
  787. "8\u00039\u00039\u00039\u00039\u00079\u01c5\n9\f9\u000e9\u01c8\u000b",
  788. "9\u00039\u00059\u01cb\n9\u00039\u00039\u00039\u00039\u00039\u00079\u01d2",
  789. "\n9\f9\u000e9\u01d5\u000b9\u00039\u00039\u00059\u01d9\n9\u00039\u0003",
  790. "9\u0003\u01d3\u0002:\u0003\u0003\u0005\u0004\u0007\u0005\t\u0006\u000b",
  791. "\u0007\r\b\u000f\t\u0011\n\u0013\u000b\u0015\f\u0017\r\u0019\u000e\u001b",
  792. "\u000f\u001d\u0010\u001f\u0011!\u0012#\u0013%\u0014\'\u0015)\u0016+",
  793. "\u0017-\u0002/\u00021\u00023\u00185\u00197\u001a9\u001b;\u001c=\u001d",
  794. "?\u001eA\u001fC E!G\"I#K$M%O&Q\'S(U)W*Y\u0002[+]\u0002_,a-c\u0002e.",
  795. "g\u0002i\u0002k\u0002m\u0002o\u0002q/\u0003\u0002\u0012\u0004\u0002",
  796. "--//\u0005\u0002\'\',,11\u0004\u0002>>@@\u0005\u0002C\\aac|\u0006\u0002",
  797. "2;C\\aac|\u0003\u00022;\u0003\u000223\u0004\u0002GGgg\u0006\u0002\f",
  798. "\f\u000f\u000f$$^^\u0006\u0002\f\f\u000f\u000f))^^\u0004\u0002\u000b",
  799. "\u000b\"\"\u0004\u0002\f\f\u000f\u000f\u0005\u00022;CHch\u0003\u0002",
  800. "29\n\u0002$$))^^ddhhppttvv\u0003\u000225\u0002\u01f0\u0002\u0003\u0003",
  801. "\u0002\u0002\u0002\u0002\u0005\u0003\u0002\u0002\u0002\u0002\u0007\u0003",
  802. "\u0002\u0002\u0002\u0002\t\u0003\u0002\u0002\u0002\u0002\u000b\u0003",
  803. "\u0002\u0002\u0002\u0002\r\u0003\u0002\u0002\u0002\u0002\u000f\u0003",
  804. "\u0002\u0002\u0002\u0002\u0011\u0003\u0002\u0002\u0002\u0002\u0013\u0003",
  805. "\u0002\u0002\u0002\u0002\u0015\u0003\u0002\u0002\u0002\u0002\u0017\u0003",
  806. "\u0002\u0002\u0002\u0002\u0019\u0003\u0002\u0002\u0002\u0002\u001b\u0003",
  807. "\u0002\u0002\u0002\u0002\u001d\u0003\u0002\u0002\u0002\u0002\u001f\u0003",
  808. "\u0002\u0002\u0002\u0002!\u0003\u0002\u0002\u0002\u0002#\u0003\u0002",
  809. "\u0002\u0002\u0002%\u0003\u0002\u0002\u0002\u0002\'\u0003\u0002\u0002",
  810. "\u0002\u0002)\u0003\u0002\u0002\u0002\u0002+\u0003\u0002\u0002\u0002",
  811. "\u00023\u0003\u0002\u0002\u0002\u00025\u0003\u0002\u0002\u0002\u0002",
  812. "7\u0003\u0002\u0002\u0002\u00029\u0003\u0002\u0002\u0002\u0002;\u0003",
  813. "\u0002\u0002\u0002\u0002=\u0003\u0002\u0002\u0002\u0002?\u0003\u0002",
  814. "\u0002\u0002\u0002A\u0003\u0002\u0002\u0002\u0002C\u0003\u0002\u0002",
  815. "\u0002\u0002E\u0003\u0002\u0002\u0002\u0002G\u0003\u0002\u0002\u0002",
  816. "\u0002I\u0003\u0002\u0002\u0002\u0002K\u0003\u0002\u0002\u0002\u0002",
  817. "M\u0003\u0002\u0002\u0002\u0002O\u0003\u0002\u0002\u0002\u0002Q\u0003",
  818. "\u0002\u0002\u0002\u0002S\u0003\u0002\u0002\u0002\u0002U\u0003\u0002",
  819. "\u0002\u0002\u0002W\u0003\u0002\u0002\u0002\u0002[\u0003\u0002\u0002",
  820. "\u0002\u0002_\u0003\u0002\u0002\u0002\u0002a\u0003\u0002\u0002\u0002",
  821. "\u0002e\u0003\u0002\u0002\u0002\u0002q\u0003\u0002\u0002\u0002\u0003",
  822. "s\u0003\u0002\u0002\u0002\u0005|\u0003\u0002\u0002\u0002\u0007\u0081",
  823. "\u0003\u0002\u0002\u0002\t\u0087\u0003\u0002\u0002\u0002\u000b\u008e",
  824. "\u0003\u0002\u0002\u0002\r\u0095\u0003\u0002\u0002\u0002\u000f\u009d",
  825. "\u0003\u0002\u0002\u0002\u0011\u00a7\u0003\u0002\u0002\u0002\u0013\u00af",
  826. "\u0003\u0002\u0002\u0002\u0015\u00b4\u0003\u0002\u0002\u0002\u0017\u00be",
  827. "\u0003\u0002\u0002\u0002\u0019\u00c4\u0003\u0002\u0002\u0002\u001b\u00cb",
  828. "\u0003\u0002\u0002\u0002\u001d\u00d3\u0003\u0002\u0002\u0002\u001f\u00d8",
  829. "\u0003\u0002\u0002\u0002!\u00dd\u0003\u0002\u0002\u0002#\u00e2\u0003",
  830. "\u0002\u0002\u0002%\u00eb\u0003\u0002\u0002\u0002\'\u00ee\u0003\u0002",
  831. "\u0002\u0002)\u00f4\u0003\u0002\u0002\u0002+\u00fa\u0003\u0002\u0002",
  832. "\u0002-\u0105\u0003\u0002\u0002\u0002/\u0109\u0003\u0002\u0002\u0002",
  833. "1\u010b\u0003\u0002\u0002\u00023\u010e\u0003\u0002\u0002\u00025\u0110",
  834. "\u0003\u0002\u0002\u00027\u0112\u0003\u0002\u0002\u00029\u0114\u0003",
  835. "\u0002\u0002\u0002;\u0116\u0003\u0002\u0002\u0002=\u0118\u0003\u0002",
  836. "\u0002\u0002?\u011a\u0003\u0002\u0002\u0002A\u011c\u0003\u0002\u0002",
  837. "\u0002C\u011e\u0003\u0002\u0002\u0002E\u0120\u0003\u0002\u0002\u0002",
  838. "G\u0122\u0003\u0002\u0002\u0002I\u0124\u0003\u0002\u0002\u0002K\u012f",
  839. "\u0003\u0002\u0002\u0002M\u0131\u0003\u0002\u0002\u0002O\u0133\u0003",
  840. "\u0002\u0002\u0002Q\u0135\u0003\u0002\u0002\u0002S\u013c\u0003\u0002",
  841. "\u0002\u0002U\u015b\u0003\u0002\u0002\u0002W\u0175\u0003\u0002\u0002",
  842. "\u0002Y\u0177\u0003\u0002\u0002\u0002[\u0180\u0003\u0002\u0002\u0002",
  843. "]\u018b\u0003\u0002\u0002\u0002_\u018d\u0003\u0002\u0002\u0002a\u0194",
  844. "\u0003\u0002\u0002\u0002c\u0198\u0003\u0002\u0002\u0002e\u01a0\u0003",
  845. "\u0002\u0002\u0002g\u01a2\u0003\u0002\u0002\u0002i\u01a4\u0003\u0002",
  846. "\u0002\u0002k\u01aa\u0003\u0002\u0002\u0002m\u01b7\u0003\u0002\u0002",
  847. "\u0002o\u01b9\u0003\u0002\u0002\u0002q\u01d8\u0003\u0002\u0002\u0002",
  848. "st\u0007r\u0002\u0002tu\u0007t\u0002\u0002uv\u0007q\u0002\u0002vw\u0007",
  849. "i\u0002\u0002wx\u0007t\u0002\u0002xy\u0007c\u0002\u0002yz\u0007o\u0002",
  850. "\u0002z{\u0007c\u0002\u0002{\u0004\u0003\u0002\u0002\u0002|}\u0007t",
  851. "\u0002\u0002}~\u0007g\u0002\u0002~\u007f\u0007c\u0002\u0002\u007f\u0080",
  852. "\u0007n\u0002\u0002\u0080\u0006\u0003\u0002\u0002\u0002\u0081\u0082",
  853. "\u0007x\u0002\u0002\u0082\u0083\u0007c\u0002\u0002\u0083\u0084\u0007",
  854. "|\u0002\u0002\u0084\u0085\u0007k\u0002\u0002\u0085\u0086\u0007q\u0002",
  855. "\u0002\u0086\b\u0003\u0002\u0002\u0002\u0087\u0088\u0007n\u0002\u0002",
  856. "\u0088\u0089\u0007q\u0002\u0002\u0089\u008a\u0007i\u0002\u0002\u008a",
  857. "\u008b\u0007k\u0002\u0002\u008b\u008c\u0007e\u0002\u0002\u008c\u008d",
  858. "\u0007q\u0002\u0002\u008d\n\u0003\u0002\u0002\u0002\u008e\u008f\u0007",
  859. "e\u0002\u0002\u008f\u0090\u0007c\u0002\u0002\u0090\u0091\u0007f\u0002",
  860. "\u0002\u0091\u0092\u0007g\u0002\u0002\u0092\u0093\u0007k\u0002\u0002",
  861. "\u0093\u0094\u0007c\u0002\u0002\u0094\f\u0003\u0002\u0002\u0002\u0095",
  862. "\u0096\u0007k\u0002\u0002\u0096\u0097\u0007p\u0002\u0002\u0097\u0098",
  863. "\u0007v\u0002\u0002\u0098\u0099\u0007g\u0002\u0002\u0099\u009a\u0007",
  864. "k\u0002\u0002\u009a\u009b\u0007t\u0002\u0002\u009b\u009c\u0007q\u0002",
  865. "\u0002\u009c\u000e\u0003\u0002\u0002\u0002\u009d\u009e\u0007e\u0002",
  866. "\u0002\u009e\u009f\u0007c\u0002\u0002\u009f\u00a0\u0007t\u0002\u0002",
  867. "\u00a0\u00a1\u0007c\u0002\u0002\u00a1\u00a2\u0007e\u0002\u0002\u00a2",
  868. "\u00a3\u0007v\u0002\u0002\u00a3\u00a4\u0007g\u0002\u0002\u00a4\u00a5",
  869. "\u0007t\u0002\u0002\u00a5\u00a6\u0007g\u0002\u0002\u00a6\u0010\u0003",
  870. "\u0002\u0002\u0002\u00a7\u00a8\u0007g\u0002\u0002\u00a8\u00a9\u0007",
  871. "u\u0002\u0002\u00a9\u00aa\u0007e\u0002\u0002\u00aa\u00ab\u0007q\u0002",
  872. "\u0002\u00ab\u00ac\u0007n\u0002\u0002\u00ac\u00ad\u0007j\u0002\u0002",
  873. "\u00ad\u00ae\u0007c\u0002\u0002\u00ae\u0012\u0003\u0002\u0002\u0002",
  874. "\u00af\u00b0\u0007e\u0002\u0002\u00b0\u00b1\u0007c\u0002\u0002\u00b1",
  875. "\u00b2\u0007u\u0002\u0002\u00b2\u00b3\u0007q\u0002\u0002\u00b3\u0014",
  876. "\u0003\u0002\u0002\u0002\u00b4\u00b5\u0007e\u0002\u0002\u00b5\u00b6",
  877. "\u0007q\u0002\u0002\u00b6\u00b7\u0007p\u0002\u0002\u00b7\u00b8\u0007",
  878. "v\u0002\u0002\u00b8\u00b9\u0007t\u0002\u0002\u00b9\u00ba\u0007c\u0002",
  879. "\u0002\u00ba\u00bb\u0007t\u0002\u0002\u00bb\u00bc\u0007k\u0002\u0002",
  880. "\u00bc\u00bd\u0007q\u0002\u0002\u00bd\u0016\u0003\u0002\u0002\u0002",
  881. "\u00be\u00bf\u0007e\u0002\u0002\u00bf\u00c0\u0007q\u0002\u0002\u00c0",
  882. "\u00c1\u0007p\u0002\u0002\u00c1\u00c2\u0007u\u0002\u0002\u00c2\u00c3",
  883. "\u0007v\u0002\u0002\u00c3\u0018\u0003\u0002\u0002\u0002\u00c4\u00c5",
  884. "\u0007h\u0002\u0002\u00c5\u00c6\u0007w\u0002\u0002\u00c6\u00c7\u0007",
  885. "p\u0002\u0002\u00c7\u00c8\u0007e\u0002\u0002\u00c8\u00c9\u0007c\u0002",
  886. "\u0002\u00c9\u00ca\u0007q\u0002\u0002\u00ca\u001a\u0003\u0002\u0002",
  887. "\u0002\u00cb\u00cc\u0007t\u0002\u0002\u00cc\u00cd\u0007g\u0002\u0002",
  888. "\u00cd\u00ce\u0007v\u0002\u0002\u00ce\u00cf\u0007q\u0002\u0002\u00cf",
  889. "\u00d0\u0007t\u0002\u0002\u00d0\u00d1\u0007p\u0002\u0002\u00d1\u00d2",
  890. "\u0007g\u0002\u0002\u00d2\u001c\u0003\u0002\u0002\u0002\u00d3\u00d4",
  891. "\u0007r\u0002\u0002\u00d4\u00d5\u0007c\u0002\u0002\u00d5\u00d6\u0007",
  892. "t\u0002\u0002\u00d6\u00d7\u0007c\u0002\u0002\u00d7\u001e\u0003\u0002",
  893. "\u0002\u0002\u00d8\u00d9\u0007r\u0002\u0002\u00d9\u00da\u0007c\u0002",
  894. "\u0002\u00da\u00db\u0007t\u0002\u0002\u00db\u00dc\u0007g\u0002\u0002",
  895. "\u00dc \u0003\u0002\u0002\u0002\u00dd\u00de\u0007h\u0002\u0002\u00de",
  896. "\u00df\u0007c\u0002\u0002\u00df\u00e0\u0007e\u0002\u0002\u00e0\u00e1",
  897. "\u0007c\u0002\u0002\u00e1\"\u0003\u0002\u0002\u0002\u00e2\u00e3\u0007",
  898. "g\u0002\u0002\u00e3\u00e4\u0007p\u0002\u0002\u00e4\u00e5\u0007s\u0002",
  899. "\u0002\u00e5\u00e6\u0007w\u0002\u0002\u00e6\u00e7\u0007c\u0002\u0002",
  900. "\u00e7\u00e8\u0007p\u0002\u0002\u00e8\u00e9\u0007v\u0002\u0002\u00e9",
  901. "\u00ea\u0007q\u0002\u0002\u00ea$\u0003\u0002\u0002\u0002\u00eb\u00ec",
  902. "\u0007u\u0002\u0002\u00ec\u00ed\u0007g\u0002\u0002\u00ed&\u0003\u0002",
  903. "\u0002\u0002\u00ee\u00ef\u0007u\u0002\u0002\u00ef\u00f0\u0007g\u0002",
  904. "\u0002\u00f0\u00f1\u0007p\u0002\u0002\u00f1\u00f2\u0007c\u0002\u0002",
  905. "\u00f2\u00f3\u0007q\u0002\u0002\u00f3(\u0003\u0002\u0002\u0002\u00f4",
  906. "\u00f5\u0007h\u0002\u0002\u00f5\u00f6\u0007c\u0002\u0002\u00f6\u00f7",
  907. "\u0007n\u0002\u0002\u00f7\u00f8\u0007u\u0002\u0002\u00f8\u00f9\u0007",
  908. "q\u0002\u0002\u00f9*\u0003\u0002\u0002\u0002\u00fa\u00fb\u0007x\u0002",
  909. "\u0002\u00fb\u00fc\u0007g\u0002\u0002\u00fc\u00fd\u0007t\u0002\u0002",
  910. "\u00fd\u00fe\u0007f\u0002\u0002\u00fe\u00ff\u0007c\u0002\u0002\u00ff",
  911. "\u0100\u0007f\u0002\u0002\u0100\u0101\u0007g\u0002\u0002\u0101\u0102",
  912. "\u0007k\u0002\u0002\u0102\u0103\u0007t\u0002\u0002\u0103\u0104\u0007",
  913. "q\u0002\u0002\u0104,\u0003\u0002\u0002\u0002\u0105\u0106\u0007p\u0002",
  914. "\u0002\u0106\u0107\u0007c\u0002\u0002\u0107\u0108\u0007q\u0002\u0002",
  915. "\u0108.\u0003\u0002\u0002\u0002\u0109\u010a\u0007G\u0002\u0002\u010a",
  916. "0\u0003\u0002\u0002\u0002\u010b\u010c\u0007Q\u0002\u0002\u010c\u010d",
  917. "\u0007W\u0002\u0002\u010d2\u0003\u0002\u0002\u0002\u010e\u010f\u0007",
  918. "*\u0002\u0002\u010f4\u0003\u0002\u0002\u0002\u0110\u0111\u0007+\u0002",
  919. "\u0002\u01116\u0003\u0002\u0002\u0002\u0112\u0113\u0007]\u0002\u0002",
  920. "\u01138\u0003\u0002\u0002\u0002\u0114\u0115\u0007_\u0002\u0002\u0115",
  921. ":\u0003\u0002\u0002\u0002\u0116\u0117\u0007}\u0002\u0002\u0117<\u0003",
  922. "\u0002\u0002\u0002\u0118\u0119\u0007\u007f\u0002\u0002\u0119>\u0003",
  923. "\u0002\u0002\u0002\u011a\u011b\u0007.\u0002\u0002\u011b@\u0003\u0002",
  924. "\u0002\u0002\u011c\u011d\u0007?\u0002\u0002\u011dB\u0003\u0002\u0002",
  925. "\u0002\u011e\u011f\t\u0002\u0002\u0002\u011fD\u0003\u0002\u0002\u0002",
  926. "\u0120\u0121\t\u0003\u0002\u0002\u0121F\u0003\u0002\u0002\u0002\u0122",
  927. "\u0123\u0005/\u0018\u0002\u0123H\u0003\u0002\u0002\u0002\u0124\u0125",
  928. "\u00051\u0019\u0002\u0125J\u0003\u0002\u0002\u0002\u0126\u0127\u0007",
  929. "@\u0002\u0002\u0127\u0130\u0007?\u0002\u0002\u0128\u0129\u0007?\u0002",
  930. "\u0002\u0129\u0130\u0007?\u0002\u0002\u012a\u012b\u0007>\u0002\u0002",
  931. "\u012b\u0130\u0007?\u0002\u0002\u012c\u0130\t\u0004\u0002\u0002\u012d",
  932. "\u012e\u0007#\u0002\u0002\u012e\u0130\u0007?\u0002\u0002\u012f\u0126",
  933. "\u0003\u0002\u0002\u0002\u012f\u0128\u0003\u0002\u0002\u0002\u012f\u012a",
  934. "\u0003\u0002\u0002\u0002\u012f\u012c\u0003\u0002\u0002\u0002\u012f\u012d",
  935. "\u0003\u0002\u0002\u0002\u0130L\u0003\u0002\u0002\u0002\u0131\u0132",
  936. "\u0007<\u0002\u0002\u0132N\u0003\u0002\u0002\u0002\u0133\u0134\u0005",
  937. "-\u0017\u0002\u0134P\u0003\u0002\u0002\u0002\u0135\u0139\t\u0005\u0002",
  938. "\u0002\u0136\u0138\t\u0006\u0002\u0002\u0137\u0136\u0003\u0002\u0002",
  939. "\u0002\u0138\u013b\u0003\u0002\u0002\u0002\u0139\u0137\u0003\u0002\u0002",
  940. "\u0002\u0139\u013a\u0003\u0002\u0002\u0002\u013aR\u0003\u0002\u0002",
  941. "\u0002\u013b\u0139\u0003\u0002\u0002\u0002\u013c\u013d\u0005Q)\u0002",
  942. "\u013d\u013e\u00070\u0002\u0002\u013e\u013f\u0005Q)\u0002\u013fT\u0003",
  943. "\u0002\u0002\u0002\u0140\u0142\t\u0007\u0002\u0002\u0141\u0140\u0003",
  944. "\u0002\u0002\u0002\u0142\u0143\u0003\u0002\u0002\u0002\u0143\u0141\u0003",
  945. "\u0002\u0002\u0002\u0143\u0144\u0003\u0002\u0002\u0002\u0144\u015c\u0003",
  946. "\u0002\u0002\u0002\u0145\u0146\u00072\u0002\u0002\u0146\u014a\u0007",
  947. "z\u0002\u0002\u0147\u0148\u00072\u0002\u0002\u0148\u014a\u0007Z\u0002",
  948. "\u0002\u0149\u0145\u0003\u0002\u0002\u0002\u0149\u0147\u0003\u0002\u0002",
  949. "\u0002\u014a\u014c\u0003\u0002\u0002\u0002\u014b\u014d\u0005g4\u0002",
  950. "\u014c\u014b\u0003\u0002\u0002\u0002\u014d\u014e\u0003\u0002\u0002\u0002",
  951. "\u014e\u014c\u0003\u0002\u0002\u0002\u014e\u014f\u0003\u0002\u0002\u0002",
  952. "\u014f\u015c\u0003\u0002\u0002\u0002\u0150\u0151\u00072\u0002\u0002",
  953. "\u0151\u0155\u0007d\u0002\u0002\u0152\u0153\u00072\u0002\u0002\u0153",
  954. "\u0155\u0007D\u0002\u0002\u0154\u0150\u0003\u0002\u0002\u0002\u0154",
  955. "\u0152\u0003\u0002\u0002\u0002\u0155\u0157\u0003\u0002\u0002\u0002\u0156",
  956. "\u0158\t\b\u0002\u0002\u0157\u0156\u0003\u0002\u0002\u0002\u0158\u0159",
  957. "\u0003\u0002\u0002\u0002\u0159\u0157\u0003\u0002\u0002\u0002\u0159\u015a",
  958. "\u0003\u0002\u0002\u0002\u015a\u015c\u0003\u0002\u0002\u0002\u015b\u0141",
  959. "\u0003\u0002\u0002\u0002\u015b\u0149\u0003\u0002\u0002\u0002\u015b\u0154",
  960. "\u0003\u0002\u0002\u0002\u015cV\u0003\u0002\u0002\u0002\u015d\u015f",
  961. "\t\u0007\u0002\u0002\u015e\u015d\u0003\u0002\u0002\u0002\u015f\u0160",
  962. "\u0003\u0002\u0002\u0002\u0160\u015e\u0003\u0002\u0002\u0002\u0160\u0161",
  963. "\u0003\u0002\u0002\u0002\u0161\u0162\u0003\u0002\u0002\u0002\u0162\u0164",
  964. "\u00070\u0002\u0002\u0163\u0165\t\u0007\u0002\u0002\u0164\u0163\u0003",
  965. "\u0002\u0002\u0002\u0165\u0166\u0003\u0002\u0002\u0002\u0166\u0164\u0003",
  966. "\u0002\u0002\u0002\u0166\u0167\u0003\u0002\u0002\u0002\u0167\u0176\u0003",
  967. "\u0002\u0002\u0002\u0168\u016a\t\u0007\u0002\u0002\u0169\u0168\u0003",
  968. "\u0002\u0002\u0002\u016a\u016b\u0003\u0002\u0002\u0002\u016b\u0169\u0003",
  969. "\u0002\u0002\u0002\u016b\u016c\u0003\u0002\u0002\u0002\u016c\u016d\u0003",
  970. "\u0002\u0002\u0002\u016d\u0171\u00070\u0002\u0002\u016e\u0170\t\u0007",
  971. "\u0002\u0002\u016f\u016e\u0003\u0002\u0002\u0002\u0170\u0173\u0003\u0002",
  972. "\u0002\u0002\u0171\u016f\u0003\u0002\u0002\u0002\u0171\u0172\u0003\u0002",
  973. "\u0002\u0002\u0172\u0174\u0003\u0002\u0002\u0002\u0173\u0171\u0003\u0002",
  974. "\u0002\u0002\u0174\u0176\u0005Y-\u0002\u0175\u015e\u0003\u0002\u0002",
  975. "\u0002\u0175\u0169\u0003\u0002\u0002\u0002\u0176X\u0003\u0002\u0002",
  976. "\u0002\u0177\u0179\t\t\u0002\u0002\u0178\u017a\t\u0002\u0002\u0002\u0179",
  977. "\u0178\u0003\u0002\u0002\u0002\u0179\u017a\u0003\u0002\u0002\u0002\u017a",
  978. "\u017c\u0003\u0002\u0002\u0002\u017b\u017d\t\u0007\u0002\u0002\u017c",
  979. "\u017b\u0003\u0002\u0002\u0002\u017d\u017e\u0003\u0002\u0002\u0002\u017e",
  980. "\u017c\u0003\u0002\u0002\u0002\u017e\u017f\u0003\u0002\u0002\u0002\u017f",
  981. "Z\u0003\u0002\u0002\u0002\u0180\u0184\u0007$\u0002\u0002\u0181\u0183",
  982. "\u0005]/\u0002\u0182\u0181\u0003\u0002\u0002\u0002\u0183\u0186\u0003",
  983. "\u0002\u0002\u0002\u0184\u0182\u0003\u0002\u0002\u0002\u0184\u0185\u0003",
  984. "\u0002\u0002\u0002\u0185\u0187\u0003\u0002\u0002\u0002\u0186\u0184\u0003",
  985. "\u0002\u0002\u0002\u0187\u0188\u0007$\u0002\u0002\u0188\\\u0003\u0002",
  986. "\u0002\u0002\u0189\u018c\n\n\u0002\u0002\u018a\u018c\u0005k6\u0002\u018b",
  987. "\u0189\u0003\u0002\u0002\u0002\u018b\u018a\u0003\u0002\u0002\u0002\u018c",
  988. "^\u0003\u0002\u0002\u0002\u018d\u0190\u0007)\u0002\u0002\u018e\u0191",
  989. "\u0005k6\u0002\u018f\u0191\n\u000b\u0002\u0002\u0190\u018e\u0003\u0002",
  990. "\u0002\u0002\u0190\u018f\u0003\u0002\u0002\u0002\u0191\u0192\u0003\u0002",
  991. "\u0002\u0002\u0192\u0193\u0007)\u0002\u0002\u0193`\u0003\u0002\u0002",
  992. "\u0002\u0194\u0195\t\f\u0002\u0002\u0195\u0196\u0003\u0002\u0002\u0002",
  993. "\u0196\u0197\b1\u0002\u0002\u0197b\u0003\u0002\u0002\u0002\u0198\u0199",
  994. "\u0007=\u0002\u0002\u0199d\u0003\u0002\u0002\u0002\u019a\u019c\t\r\u0002",
  995. "\u0002\u019b\u019a\u0003\u0002\u0002\u0002\u019c\u019d\u0003\u0002\u0002",
  996. "\u0002\u019d\u019b\u0003\u0002\u0002\u0002\u019d\u019e\u0003\u0002\u0002",
  997. "\u0002\u019e\u01a1\u0003\u0002\u0002\u0002\u019f\u01a1\u0005c2\u0002",
  998. "\u01a0\u019b\u0003\u0002\u0002\u0002\u01a0\u019f\u0003\u0002\u0002\u0002",
  999. "\u01a1f\u0003\u0002\u0002\u0002\u01a2\u01a3\t\u000e\u0002\u0002\u01a3",
  1000. "h\u0003\u0002\u0002\u0002\u01a4\u01a5\t\u000f\u0002\u0002\u01a5j\u0003",
  1001. "\u0002\u0002\u0002\u01a6\u01a7\u0007^\u0002\u0002\u01a7\u01ab\t\u0010",
  1002. "\u0002\u0002\u01a8\u01ab\u0005o8\u0002\u01a9\u01ab\u0005m7\u0002\u01aa",
  1003. "\u01a6\u0003\u0002\u0002\u0002\u01aa\u01a8\u0003\u0002\u0002\u0002\u01aa",
  1004. "\u01a9\u0003\u0002\u0002\u0002\u01abl\u0003\u0002\u0002\u0002\u01ac",
  1005. "\u01ad\u0007^\u0002\u0002\u01ad\u01ae\t\u0011\u0002\u0002\u01ae\u01af",
  1006. "\u0005i5\u0002\u01af\u01b0\u0005i5\u0002\u01b0\u01b8\u0003\u0002\u0002",
  1007. "\u0002\u01b1\u01b2\u0007^\u0002\u0002\u01b2\u01b3\u0005i5\u0002\u01b3",
  1008. "\u01b4\u0005i5\u0002\u01b4\u01b8\u0003\u0002\u0002\u0002\u01b5\u01b6",
  1009. "\u0007^\u0002\u0002\u01b6\u01b8\u0005i5\u0002\u01b7\u01ac\u0003\u0002",
  1010. "\u0002\u0002\u01b7\u01b1\u0003\u0002\u0002\u0002\u01b7\u01b5\u0003\u0002",
  1011. "\u0002\u0002\u01b8n\u0003\u0002\u0002\u0002\u01b9\u01ba\u0007^\u0002",
  1012. "\u0002\u01ba\u01bb\u0007w\u0002\u0002\u01bb\u01bc\u0005g4\u0002\u01bc",
  1013. "\u01bd\u0005g4\u0002\u01bd\u01be\u0005g4\u0002\u01be\u01bf\u0005g4\u0002",
  1014. "\u01bfp\u0003\u0002\u0002\u0002\u01c0\u01c1\u00071\u0002\u0002\u01c1",
  1015. "\u01c2\u00071\u0002\u0002\u01c2\u01c6\u0003\u0002\u0002\u0002\u01c3",
  1016. "\u01c5\n\r\u0002\u0002\u01c4\u01c3\u0003\u0002\u0002\u0002\u01c5\u01c8",
  1017. "\u0003\u0002\u0002\u0002\u01c6\u01c4\u0003\u0002\u0002\u0002\u01c6\u01c7",
  1018. "\u0003\u0002\u0002\u0002\u01c7\u01ca\u0003\u0002\u0002\u0002\u01c8\u01c6",
  1019. "\u0003\u0002\u0002\u0002\u01c9\u01cb\u0007\u000f\u0002\u0002\u01ca\u01c9",
  1020. "\u0003\u0002\u0002\u0002\u01ca\u01cb\u0003\u0002\u0002\u0002\u01cb\u01cc",
  1021. "\u0003\u0002\u0002\u0002\u01cc\u01d9\u0007\f\u0002\u0002\u01cd\u01ce",
  1022. "\u00071\u0002\u0002\u01ce\u01cf\u0007,\u0002\u0002\u01cf\u01d3\u0003",
  1023. "\u0002\u0002\u0002\u01d0\u01d2\u000b\u0002\u0002\u0002\u01d1\u01d0\u0003",
  1024. "\u0002\u0002\u0002\u01d2\u01d5\u0003\u0002\u0002\u0002\u01d3\u01d4\u0003",
  1025. "\u0002\u0002\u0002\u01d3\u01d1\u0003\u0002\u0002\u0002\u01d4\u01d6\u0003",
  1026. "\u0002\u0002\u0002\u01d5\u01d3\u0003\u0002\u0002\u0002\u01d6\u01d7\u0007",
  1027. ",\u0002\u0002\u01d7\u01d9\u00071\u0002\u0002\u01d8\u01c0\u0003\u0002",
  1028. "\u0002\u0002\u01d8\u01cd\u0003\u0002\u0002\u0002\u01d9\u01da\u0003\u0002",
  1029. "\u0002\u0002\u01da\u01db\b9\u0003\u0002\u01dbr\u0003\u0002\u0002\u0002",
  1030. "\u001d\u0002\u012f\u0139\u0143\u0149\u014e\u0154\u0159\u015b\u0160\u0166",
  1031. "\u016b\u0171\u0175\u0179\u017e\u0184\u018b\u0190\u019d\u01a0\u01aa\u01b7",
  1032. "\u01c6\u01ca\u01d3\u01d8\u0004\b\u0002\u0002\u0002\u0003\u0002"].join("");
  1033. var atn = new antlr4.atn.ATNDeserializer().deserialize(serializedATN);
  1034. var decisionsToDFA = atn.decisionToState.map( function(ds, index) { return new antlr4.dfa.DFA(ds, index); });
  1035. function ivprog(input) {
  1036. antlr4.Lexer.call(this, input);
  1037. this._interp = new antlr4.atn.LexerATNSimulator(this, atn, decisionsToDFA, new antlr4.PredictionContextCache());
  1038. return this;
  1039. }
  1040. ivprog.prototype = Object.create(antlr4.Lexer.prototype);
  1041. ivprog.prototype.constructor = ivprog;
  1042. ivprog.EOF = antlr4.Token.EOF;
  1043. ivprog.RK_PROGRAM = 1;
  1044. ivprog.RK_REAL = 2;
  1045. ivprog.RK_VOID = 3;
  1046. ivprog.RK_BOOLEAN = 4;
  1047. ivprog.RK_STRING = 5;
  1048. ivprog.RK_INTEGER = 6;
  1049. ivprog.RK_CHARACTER = 7;
  1050. ivprog.RK_SWITCH = 8;
  1051. ivprog.RK_CASE = 9;
  1052. ivprog.RK_DEFAULT = 10;
  1053. ivprog.RK_CONST = 11;
  1054. ivprog.RK_FUNCTION = 12;
  1055. ivprog.RK_RETURN = 13;
  1056. ivprog.RK_FOR = 14;
  1057. ivprog.RK_BREAK = 15;
  1058. ivprog.RK_DO = 16;
  1059. ivprog.RK_WHILE = 17;
  1060. ivprog.RK_IF = 18;
  1061. ivprog.RK_ELSE = 19;
  1062. ivprog.RK_FALSE = 20;
  1063. ivprog.RK_TRUE = 21;
  1064. ivprog.OPEN_PARENTHESIS = 22;
  1065. ivprog.CLOSE_PARENTHESIS = 23;
  1066. ivprog.OPEN_BRACE = 24;
  1067. ivprog.CLOSE_BRACE = 25;
  1068. ivprog.OPEN_CURLY = 26;
  1069. ivprog.CLOSE_CURLY = 27;
  1070. ivprog.COMMA = 28;
  1071. ivprog.EQUAL = 29;
  1072. ivprog.SUM_OP = 30;
  1073. ivprog.MULTI_OP = 31;
  1074. ivprog.AND_OPERATOR = 32;
  1075. ivprog.OR_OPERATOR = 33;
  1076. ivprog.RELATIONAL_OPERATOR = 34;
  1077. ivprog.COLON = 35;
  1078. ivprog.NOT_OPERATOR = 36;
  1079. ivprog.ID = 37;
  1080. ivprog.LIB_ID = 38;
  1081. ivprog.INTEGER = 39;
  1082. ivprog.REAL = 40;
  1083. ivprog.STRING = 41;
  1084. ivprog.CHARACTER = 42;
  1085. ivprog.WHITESPACE = 43;
  1086. ivprog.EOS = 44;
  1087. ivprog.COMMENTS = 45;
  1088. ivprog.prototype.channelNames = [ "DEFAULT_TOKEN_CHANNEL", "HIDDEN" ];
  1089. ivprog.prototype.modeNames = [ "DEFAULT_MODE" ];
  1090. ivprog.prototype.literalNames = [ null, "'programa'", "'real'", "'vazio'",
  1091. "'logico'", "'cadeia'", "'inteiro'", "'caractere'",
  1092. "'escolha'", "'caso'", "'contrario'",
  1093. "'const'", "'funcao'", "'retorne'", "'para'",
  1094. "'pare'", "'faca'", "'enquanto'", "'se'",
  1095. "'senao'", "'falso'", "'verdadeiro'",
  1096. "'('", "')'", "'['", "']'", "'{'", "'}'",
  1097. "','", "'='", null, null, null, null,
  1098. null, "':'" ];
  1099. ivprog.prototype.symbolicNames = [ null, "RK_PROGRAM", "RK_REAL", "RK_VOID",
  1100. "RK_BOOLEAN", "RK_STRING", "RK_INTEGER",
  1101. "RK_CHARACTER", "RK_SWITCH", "RK_CASE",
  1102. "RK_DEFAULT", "RK_CONST", "RK_FUNCTION",
  1103. "RK_RETURN", "RK_FOR", "RK_BREAK", "RK_DO",
  1104. "RK_WHILE", "RK_IF", "RK_ELSE", "RK_FALSE",
  1105. "RK_TRUE", "OPEN_PARENTHESIS", "CLOSE_PARENTHESIS",
  1106. "OPEN_BRACE", "CLOSE_BRACE", "OPEN_CURLY",
  1107. "CLOSE_CURLY", "COMMA", "EQUAL", "SUM_OP",
  1108. "MULTI_OP", "AND_OPERATOR", "OR_OPERATOR",
  1109. "RELATIONAL_OPERATOR", "COLON", "NOT_OPERATOR",
  1110. "ID", "LIB_ID", "INTEGER", "REAL", "STRING",
  1111. "CHARACTER", "WHITESPACE", "EOS", "COMMENTS" ];
  1112. ivprog.prototype.ruleNames = [ "RK_PROGRAM", "RK_REAL", "RK_VOID", "RK_BOOLEAN",
  1113. "RK_STRING", "RK_INTEGER", "RK_CHARACTER",
  1114. "RK_SWITCH", "RK_CASE", "RK_DEFAULT", "RK_CONST",
  1115. "RK_FUNCTION", "RK_RETURN", "RK_FOR", "RK_BREAK",
  1116. "RK_DO", "RK_WHILE", "RK_IF", "RK_ELSE",
  1117. "RK_FALSE", "RK_TRUE", "RK_LOGICAL_NOT",
  1118. "RK_LOGICAL_AND", "RK_LOGICAL_OR", "OPEN_PARENTHESIS",
  1119. "CLOSE_PARENTHESIS", "OPEN_BRACE", "CLOSE_BRACE",
  1120. "OPEN_CURLY", "CLOSE_CURLY", "COMMA", "EQUAL",
  1121. "SUM_OP", "MULTI_OP", "AND_OPERATOR", "OR_OPERATOR",
  1122. "RELATIONAL_OPERATOR", "COLON", "NOT_OPERATOR",
  1123. "ID", "LIB_ID", "INTEGER", "REAL", "ExponentPart",
  1124. "STRING", "STRING_CHARACTER", "CHARACTER",
  1125. "WHITESPACE", "SEMICOLON", "EOS", "HEX_DIGIT",
  1126. "OCTAL_DIGIT", "ESC_SEQ", "ESC_OCTAL", "ESC_UNICODE",
  1127. "COMMENTS" ];
  1128. ivprog.prototype.grammarFileName = "ivprog.g4";
  1129. exports.ivprog = ivprog;
  1130. /***/ }),
  1131. /* 1 */
  1132. /***/ (function(module, exports, __webpack_require__) {
  1133. module.exports = {
  1134. ivprog: __webpack_require__(0).ivprog
  1135. };
  1136. /***/ }),
  1137. /* 2 */
  1138. /***/ (function(module, exports) {
  1139. module.exports = __webpack_require__(/*! antlr4/index */ "./node_modules/antlr4/index.js");
  1140. /***/ })
  1141. /******/ ]);
  1142. /***/ }),
  1143. /***/ "./grammar/es/langFunctions.js":
  1144. /*!*************************************!*\
  1145. !*** ./grammar/es/langFunctions.js ***!
  1146. \*************************************/
  1147. /*! no static exports found */
  1148. /***/ (function(module, exports, __webpack_require__) {
  1149. "use strict";
  1150. Object.defineProperty(exports, "__esModule", {
  1151. value: true
  1152. });
  1153. /* This is a dictionary of the language defined functions
  1154. **/
  1155. exports.default = {
  1156. main_function: "inicio",
  1157. $read: "leia",
  1158. $write: "escreva",
  1159. $numElements: "total_of_elements",
  1160. $matrixLines: "total_of_lines",
  1161. $matrixColumns: "total_of_columns",
  1162. $substring: "subcadeia",
  1163. $length: "comprimento",
  1164. $uppercase: "caixa_alta",
  1165. $lowercase: "caixa_baixa",
  1166. $charAt: "char_at",
  1167. $isReal: "is_real",
  1168. $isInt: "is_integer",
  1169. $isBool: "is_logic",
  1170. $castReal: "to_real",
  1171. $castInt: "to_integer",
  1172. $castBool: "to_logic",
  1173. $castString: "to_string",
  1174. $sin: "sin",
  1175. $cos: "cos",
  1176. $tan: "tan",
  1177. $sqrt: "sqrt",
  1178. $pow: "pow",
  1179. $log: "log",
  1180. $abs: "abs",
  1181. $negate: "negate",
  1182. $invert: "invert",
  1183. $max: "maximum",
  1184. $min: "minimum"
  1185. };
  1186. /***/ }),
  1187. /***/ "./grammar/es/langLibs.js":
  1188. /*!********************************!*\
  1189. !*** ./grammar/es/langLibs.js ***!
  1190. \********************************/
  1191. /*! no static exports found */
  1192. /***/ (function(module, exports, __webpack_require__) {
  1193. "use strict";
  1194. Object.defineProperty(exports, "__esModule", {
  1195. value: true
  1196. });
  1197. /**
  1198. * This is the dictionary of the language defined libraries
  1199. */
  1200. exports.default = {
  1201. $mathLib: "Mathematic",
  1202. $ioLib: "ES",
  1203. $strLib: "Texto",
  1204. $arrayLib: "Arranjo",
  1205. $langLib: "Conversion"
  1206. };
  1207. /***/ }),
  1208. /***/ "./grammar/index.js":
  1209. /*!**************************!*\
  1210. !*** ./grammar/index.js ***!
  1211. \**************************/
  1212. /*! no static exports found */
  1213. /***/ (function(module, exports, __webpack_require__) {
  1214. "use strict";
  1215. var _ivprog = __webpack_require__(/*! ./pt/ivprog.g4 */ "./grammar/pt/ivprog.g4");
  1216. var PT = _interopRequireWildcard(_ivprog);
  1217. var _langFunctions = __webpack_require__(/*! ./pt/langFunctions */ "./grammar/pt/langFunctions.js");
  1218. var _langFunctions2 = _interopRequireDefault(_langFunctions);
  1219. var _langLibs = __webpack_require__(/*! ./pt/langLibs */ "./grammar/pt/langLibs.js");
  1220. var _langLibs2 = _interopRequireDefault(_langLibs);
  1221. var _ivprog2 = __webpack_require__(/*! ./en/ivprog.g4 */ "./grammar/en/ivprog.g4");
  1222. var EN = _interopRequireWildcard(_ivprog2);
  1223. var _langFunctions3 = __webpack_require__(/*! ./en/langFunctions */ "./grammar/en/langFunctions.js");
  1224. var _langFunctions4 = _interopRequireDefault(_langFunctions3);
  1225. var _langLibs3 = __webpack_require__(/*! ./en/langLibs */ "./grammar/en/langLibs.js");
  1226. var _langLibs4 = _interopRequireDefault(_langLibs3);
  1227. var _ivprog3 = __webpack_require__(/*! ./es/ivprog.g4 */ "./grammar/es/ivprog.g4");
  1228. var ES = _interopRequireWildcard(_ivprog3);
  1229. var _langFunctions5 = __webpack_require__(/*! ./es/langFunctions */ "./grammar/es/langFunctions.js");
  1230. var _langFunctions6 = _interopRequireDefault(_langFunctions5);
  1231. var _langLibs5 = __webpack_require__(/*! ./es/langLibs */ "./grammar/es/langLibs.js");
  1232. var _langLibs6 = _interopRequireDefault(_langLibs5);
  1233. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  1234. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  1235. exports.pt = { lexer: PT.ivprog, langFuncs: _langFunctions2.default, langLibs: _langLibs2.default };
  1236. exports.en = { lexer: EN.ivprog, langFuncs: _langFunctions4.default, langLibs: _langLibs4.default };
  1237. exports.es = { lexer: ES.ivprog, langFuncs: _langFunctions6.default, langLibs: _langLibs6.default };
  1238. /***/ }),
  1239. /***/ "./grammar/pt/ivprog.g4":
  1240. /*!******************************!*\
  1241. !*** ./grammar/pt/ivprog.g4 ***!
  1242. \******************************/
  1243. /*! no static exports found */
  1244. /***/ (function(module, exports, __webpack_require__) {
  1245. module.exports =
  1246. /******/ (function(modules) { // webpackBootstrap
  1247. /******/ // The module cache
  1248. /******/ var installedModules = {};
  1249. /******/
  1250. /******/ // The require function
  1251. /******/ function __webpack_require__(moduleId) {
  1252. /******/
  1253. /******/ // Check if module is in cache
  1254. /******/ if(installedModules[moduleId]) {
  1255. /******/ return installedModules[moduleId].exports;
  1256. /******/ }
  1257. /******/ // Create a new module (and put it into the cache)
  1258. /******/ var module = installedModules[moduleId] = {
  1259. /******/ i: moduleId,
  1260. /******/ l: false,
  1261. /******/ exports: {}
  1262. /******/ };
  1263. /******/
  1264. /******/ // Execute the module function
  1265. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  1266. /******/
  1267. /******/ // Flag the module as loaded
  1268. /******/ module.l = true;
  1269. /******/
  1270. /******/ // Return the exports of the module
  1271. /******/ return module.exports;
  1272. /******/ }
  1273. /******/
  1274. /******/
  1275. /******/ // expose the modules object (__webpack_modules__)
  1276. /******/ __webpack_require__.m = modules;
  1277. /******/
  1278. /******/ // expose the module cache
  1279. /******/ __webpack_require__.c = installedModules;
  1280. /******/
  1281. /******/ // identity function for calling harmony imports with the correct context
  1282. /******/ __webpack_require__.i = function(value) { return value; };
  1283. /******/
  1284. /******/ // define getter function for harmony exports
  1285. /******/ __webpack_require__.d = function(exports, name, getter) {
  1286. /******/ if(!__webpack_require__.o(exports, name)) {
  1287. /******/ Object.defineProperty(exports, name, {
  1288. /******/ configurable: false,
  1289. /******/ enumerable: true,
  1290. /******/ get: getter
  1291. /******/ });
  1292. /******/ }
  1293. /******/ };
  1294. /******/
  1295. /******/ // getDefaultExport function for compatibility with non-harmony modules
  1296. /******/ __webpack_require__.n = function(module) {
  1297. /******/ var getter = module && module.__esModule ?
  1298. /******/ function getDefault() { return module['default']; } :
  1299. /******/ function getModuleExports() { return module; };
  1300. /******/ __webpack_require__.d(getter, 'a', getter);
  1301. /******/ return getter;
  1302. /******/ };
  1303. /******/
  1304. /******/ // Object.prototype.hasOwnProperty.call
  1305. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  1306. /******/
  1307. /******/ // __webpack_public_path__
  1308. /******/ __webpack_require__.p = "";
  1309. /******/
  1310. /******/ // Load entry module and return exports
  1311. /******/ return __webpack_require__(__webpack_require__.s = 1);
  1312. /******/ })
  1313. /************************************************************************/
  1314. /******/ ([
  1315. /* 0 */
  1316. /***/ (function(module, exports, __webpack_require__) {
  1317. // Generated from /tmp/tmp-3417ZzpSKjvYshMW/ivprog.g4 by ANTLR 4.7
  1318. // jshint ignore: start
  1319. var antlr4 = __webpack_require__(2);
  1320. var serializedATN = ["\u0003\u608b\ua72a\u8133\ub9ed\u417c\u3be7\u7786\u5964",
  1321. "\u0002/\u01dc\b\u0001\u0004\u0002\t\u0002\u0004\u0003\t\u0003\u0004",
  1322. "\u0004\t\u0004\u0004\u0005\t\u0005\u0004\u0006\t\u0006\u0004\u0007\t",
  1323. "\u0007\u0004\b\t\b\u0004\t\t\t\u0004\n\t\n\u0004\u000b\t\u000b\u0004",
  1324. "\f\t\f\u0004\r\t\r\u0004\u000e\t\u000e\u0004\u000f\t\u000f\u0004\u0010",
  1325. "\t\u0010\u0004\u0011\t\u0011\u0004\u0012\t\u0012\u0004\u0013\t\u0013",
  1326. "\u0004\u0014\t\u0014\u0004\u0015\t\u0015\u0004\u0016\t\u0016\u0004\u0017",
  1327. "\t\u0017\u0004\u0018\t\u0018\u0004\u0019\t\u0019\u0004\u001a\t\u001a",
  1328. "\u0004\u001b\t\u001b\u0004\u001c\t\u001c\u0004\u001d\t\u001d\u0004\u001e",
  1329. "\t\u001e\u0004\u001f\t\u001f\u0004 \t \u0004!\t!\u0004\"\t\"\u0004#",
  1330. "\t#\u0004$\t$\u0004%\t%\u0004&\t&\u0004\'\t\'\u0004(\t(\u0004)\t)\u0004",
  1331. "*\t*\u0004+\t+\u0004,\t,\u0004-\t-\u0004.\t.\u0004/\t/\u00040\t0\u0004",
  1332. "1\t1\u00042\t2\u00043\t3\u00044\t4\u00045\t5\u00046\t6\u00047\t7\u0004",
  1333. "8\t8\u00049\t9\u0003\u0002\u0003\u0002\u0003\u0002\u0003\u0002\u0003",
  1334. "\u0002\u0003\u0002\u0003\u0002\u0003\u0002\u0003\u0002\u0003\u0003\u0003",
  1335. "\u0003\u0003\u0003\u0003\u0003\u0003\u0003\u0003\u0004\u0003\u0004\u0003",
  1336. "\u0004\u0003\u0004\u0003\u0004\u0003\u0004\u0003\u0005\u0003\u0005\u0003",
  1337. "\u0005\u0003\u0005\u0003\u0005\u0003\u0005\u0003\u0005\u0003\u0006\u0003",
  1338. "\u0006\u0003\u0006\u0003\u0006\u0003\u0006\u0003\u0006\u0003\u0006\u0003",
  1339. "\u0007\u0003\u0007\u0003\u0007\u0003\u0007\u0003\u0007\u0003\u0007\u0003",
  1340. "\u0007\u0003\u0007\u0003\b\u0003\b\u0003\b\u0003\b\u0003\b\u0003\b\u0003",
  1341. "\b\u0003\b\u0003\b\u0003\b\u0003\t\u0003\t\u0003\t\u0003\t\u0003\t\u0003",
  1342. "\t\u0003\t\u0003\t\u0003\n\u0003\n\u0003\n\u0003\n\u0003\n\u0003\u000b",
  1343. "\u0003\u000b\u0003\u000b\u0003\u000b\u0003\u000b\u0003\u000b\u0003\u000b",
  1344. "\u0003\u000b\u0003\u000b\u0003\u000b\u0003\f\u0003\f\u0003\f\u0003\f",
  1345. "\u0003\f\u0003\f\u0003\r\u0003\r\u0003\r\u0003\r\u0003\r\u0003\r\u0003",
  1346. "\r\u0003\u000e\u0003\u000e\u0003\u000e\u0003\u000e\u0003\u000e\u0003",
  1347. "\u000e\u0003\u000e\u0003\u000e\u0003\u000f\u0003\u000f\u0003\u000f\u0003",
  1348. "\u000f\u0003\u000f\u0003\u0010\u0003\u0010\u0003\u0010\u0003\u0010\u0003",
  1349. "\u0010\u0003\u0011\u0003\u0011\u0003\u0011\u0003\u0011\u0003\u0011\u0003",
  1350. "\u0012\u0003\u0012\u0003\u0012\u0003\u0012\u0003\u0012\u0003\u0012\u0003",
  1351. "\u0012\u0003\u0012\u0003\u0012\u0003\u0013\u0003\u0013\u0003\u0013\u0003",
  1352. "\u0014\u0003\u0014\u0003\u0014\u0003\u0014\u0003\u0014\u0003\u0014\u0003",
  1353. "\u0015\u0003\u0015\u0003\u0015\u0003\u0015\u0003\u0015\u0003\u0015\u0003",
  1354. "\u0016\u0003\u0016\u0003\u0016\u0003\u0016\u0003\u0016\u0003\u0016\u0003",
  1355. "\u0016\u0003\u0016\u0003\u0016\u0003\u0016\u0003\u0016\u0003\u0017\u0003",
  1356. "\u0017\u0003\u0017\u0003\u0017\u0003\u0018\u0003\u0018\u0003\u0019\u0003",
  1357. "\u0019\u0003\u0019\u0003\u001a\u0003\u001a\u0003\u001b\u0003\u001b\u0003",
  1358. "\u001c\u0003\u001c\u0003\u001d\u0003\u001d\u0003\u001e\u0003\u001e\u0003",
  1359. "\u001f\u0003\u001f\u0003 \u0003 \u0003!\u0003!\u0003\"\u0003\"\u0003",
  1360. "#\u0003#\u0003$\u0003$\u0003%\u0003%\u0003&\u0003&\u0003&\u0003&\u0003",
  1361. "&\u0003&\u0003&\u0003&\u0003&\u0005&\u0130\n&\u0003\'\u0003\'\u0003",
  1362. "(\u0003(\u0003)\u0003)\u0007)\u0138\n)\f)\u000e)\u013b\u000b)\u0003",
  1363. "*\u0003*\u0003*\u0003*\u0003+\u0006+\u0142\n+\r+\u000e+\u0143\u0003",
  1364. "+\u0003+\u0003+\u0003+\u0005+\u014a\n+\u0003+\u0006+\u014d\n+\r+\u000e",
  1365. "+\u014e\u0003+\u0003+\u0003+\u0003+\u0005+\u0155\n+\u0003+\u0006+\u0158",
  1366. "\n+\r+\u000e+\u0159\u0005+\u015c\n+\u0003,\u0006,\u015f\n,\r,\u000e",
  1367. ",\u0160\u0003,\u0003,\u0006,\u0165\n,\r,\u000e,\u0166\u0003,\u0006,",
  1368. "\u016a\n,\r,\u000e,\u016b\u0003,\u0003,\u0007,\u0170\n,\f,\u000e,\u0173",
  1369. "\u000b,\u0003,\u0005,\u0176\n,\u0003-\u0003-\u0005-\u017a\n-\u0003-",
  1370. "\u0006-\u017d\n-\r-\u000e-\u017e\u0003.\u0003.\u0007.\u0183\n.\f.\u000e",
  1371. ".\u0186\u000b.\u0003.\u0003.\u0003/\u0003/\u0005/\u018c\n/\u00030\u0003",
  1372. "0\u00030\u00050\u0191\n0\u00030\u00030\u00031\u00031\u00031\u00031\u0003",
  1373. "2\u00032\u00033\u00063\u019c\n3\r3\u000e3\u019d\u00033\u00053\u01a1",
  1374. "\n3\u00034\u00034\u00035\u00035\u00036\u00036\u00036\u00036\u00056\u01ab",
  1375. "\n6\u00037\u00037\u00037\u00037\u00037\u00037\u00037\u00037\u00037\u0003",
  1376. "7\u00037\u00057\u01b8\n7\u00038\u00038\u00038\u00038\u00038\u00038\u0003",
  1377. "8\u00039\u00039\u00039\u00039\u00079\u01c5\n9\f9\u000e9\u01c8\u000b",
  1378. "9\u00039\u00059\u01cb\n9\u00039\u00039\u00039\u00039\u00039\u00079\u01d2",
  1379. "\n9\f9\u000e9\u01d5\u000b9\u00039\u00039\u00059\u01d9\n9\u00039\u0003",
  1380. "9\u0003\u01d3\u0002:\u0003\u0003\u0005\u0004\u0007\u0005\t\u0006\u000b",
  1381. "\u0007\r\b\u000f\t\u0011\n\u0013\u000b\u0015\f\u0017\r\u0019\u000e\u001b",
  1382. "\u000f\u001d\u0010\u001f\u0011!\u0012#\u0013%\u0014\'\u0015)\u0016+",
  1383. "\u0017-\u0002/\u00021\u00023\u00185\u00197\u001a9\u001b;\u001c=\u001d",
  1384. "?\u001eA\u001fC E!G\"I#K$M%O&Q\'S(U)W*Y\u0002[+]\u0002_,a-c\u0002e.",
  1385. "g\u0002i\u0002k\u0002m\u0002o\u0002q/\u0003\u0002\u0012\u0004\u0002",
  1386. "--//\u0005\u0002\'\',,11\u0004\u0002>>@@\u0005\u0002C\\aac|\u0006\u0002",
  1387. "2;C\\aac|\u0003\u00022;\u0003\u000223\u0004\u0002GGgg\u0006\u0002\f",
  1388. "\f\u000f\u000f$$^^\u0006\u0002\f\f\u000f\u000f))^^\u0004\u0002\u000b",
  1389. "\u000b\"\"\u0004\u0002\f\f\u000f\u000f\u0005\u00022;CHch\u0003\u0002",
  1390. "29\n\u0002$$))^^ddhhppttvv\u0003\u000225\u0002\u01f0\u0002\u0003\u0003",
  1391. "\u0002\u0002\u0002\u0002\u0005\u0003\u0002\u0002\u0002\u0002\u0007\u0003",
  1392. "\u0002\u0002\u0002\u0002\t\u0003\u0002\u0002\u0002\u0002\u000b\u0003",
  1393. "\u0002\u0002\u0002\u0002\r\u0003\u0002\u0002\u0002\u0002\u000f\u0003",
  1394. "\u0002\u0002\u0002\u0002\u0011\u0003\u0002\u0002\u0002\u0002\u0013\u0003",
  1395. "\u0002\u0002\u0002\u0002\u0015\u0003\u0002\u0002\u0002\u0002\u0017\u0003",
  1396. "\u0002\u0002\u0002\u0002\u0019\u0003\u0002\u0002\u0002\u0002\u001b\u0003",
  1397. "\u0002\u0002\u0002\u0002\u001d\u0003\u0002\u0002\u0002\u0002\u001f\u0003",
  1398. "\u0002\u0002\u0002\u0002!\u0003\u0002\u0002\u0002\u0002#\u0003\u0002",
  1399. "\u0002\u0002\u0002%\u0003\u0002\u0002\u0002\u0002\'\u0003\u0002\u0002",
  1400. "\u0002\u0002)\u0003\u0002\u0002\u0002\u0002+\u0003\u0002\u0002\u0002",
  1401. "\u00023\u0003\u0002\u0002\u0002\u00025\u0003\u0002\u0002\u0002\u0002",
  1402. "7\u0003\u0002\u0002\u0002\u00029\u0003\u0002\u0002\u0002\u0002;\u0003",
  1403. "\u0002\u0002\u0002\u0002=\u0003\u0002\u0002\u0002\u0002?\u0003\u0002",
  1404. "\u0002\u0002\u0002A\u0003\u0002\u0002\u0002\u0002C\u0003\u0002\u0002",
  1405. "\u0002\u0002E\u0003\u0002\u0002\u0002\u0002G\u0003\u0002\u0002\u0002",
  1406. "\u0002I\u0003\u0002\u0002\u0002\u0002K\u0003\u0002\u0002\u0002\u0002",
  1407. "M\u0003\u0002\u0002\u0002\u0002O\u0003\u0002\u0002\u0002\u0002Q\u0003",
  1408. "\u0002\u0002\u0002\u0002S\u0003\u0002\u0002\u0002\u0002U\u0003\u0002",
  1409. "\u0002\u0002\u0002W\u0003\u0002\u0002\u0002\u0002[\u0003\u0002\u0002",
  1410. "\u0002\u0002_\u0003\u0002\u0002\u0002\u0002a\u0003\u0002\u0002\u0002",
  1411. "\u0002e\u0003\u0002\u0002\u0002\u0002q\u0003\u0002\u0002\u0002\u0003",
  1412. "s\u0003\u0002\u0002\u0002\u0005|\u0003\u0002\u0002\u0002\u0007\u0081",
  1413. "\u0003\u0002\u0002\u0002\t\u0087\u0003\u0002\u0002\u0002\u000b\u008e",
  1414. "\u0003\u0002\u0002\u0002\r\u0095\u0003\u0002\u0002\u0002\u000f\u009d",
  1415. "\u0003\u0002\u0002\u0002\u0011\u00a7\u0003\u0002\u0002\u0002\u0013\u00af",
  1416. "\u0003\u0002\u0002\u0002\u0015\u00b4\u0003\u0002\u0002\u0002\u0017\u00be",
  1417. "\u0003\u0002\u0002\u0002\u0019\u00c4\u0003\u0002\u0002\u0002\u001b\u00cb",
  1418. "\u0003\u0002\u0002\u0002\u001d\u00d3\u0003\u0002\u0002\u0002\u001f\u00d8",
  1419. "\u0003\u0002\u0002\u0002!\u00dd\u0003\u0002\u0002\u0002#\u00e2\u0003",
  1420. "\u0002\u0002\u0002%\u00eb\u0003\u0002\u0002\u0002\'\u00ee\u0003\u0002",
  1421. "\u0002\u0002)\u00f4\u0003\u0002\u0002\u0002+\u00fa\u0003\u0002\u0002",
  1422. "\u0002-\u0105\u0003\u0002\u0002\u0002/\u0109\u0003\u0002\u0002\u0002",
  1423. "1\u010b\u0003\u0002\u0002\u00023\u010e\u0003\u0002\u0002\u00025\u0110",
  1424. "\u0003\u0002\u0002\u00027\u0112\u0003\u0002\u0002\u00029\u0114\u0003",
  1425. "\u0002\u0002\u0002;\u0116\u0003\u0002\u0002\u0002=\u0118\u0003\u0002",
  1426. "\u0002\u0002?\u011a\u0003\u0002\u0002\u0002A\u011c\u0003\u0002\u0002",
  1427. "\u0002C\u011e\u0003\u0002\u0002\u0002E\u0120\u0003\u0002\u0002\u0002",
  1428. "G\u0122\u0003\u0002\u0002\u0002I\u0124\u0003\u0002\u0002\u0002K\u012f",
  1429. "\u0003\u0002\u0002\u0002M\u0131\u0003\u0002\u0002\u0002O\u0133\u0003",
  1430. "\u0002\u0002\u0002Q\u0135\u0003\u0002\u0002\u0002S\u013c\u0003\u0002",
  1431. "\u0002\u0002U\u015b\u0003\u0002\u0002\u0002W\u0175\u0003\u0002\u0002",
  1432. "\u0002Y\u0177\u0003\u0002\u0002\u0002[\u0180\u0003\u0002\u0002\u0002",
  1433. "]\u018b\u0003\u0002\u0002\u0002_\u018d\u0003\u0002\u0002\u0002a\u0194",
  1434. "\u0003\u0002\u0002\u0002c\u0198\u0003\u0002\u0002\u0002e\u01a0\u0003",
  1435. "\u0002\u0002\u0002g\u01a2\u0003\u0002\u0002\u0002i\u01a4\u0003\u0002",
  1436. "\u0002\u0002k\u01aa\u0003\u0002\u0002\u0002m\u01b7\u0003\u0002\u0002",
  1437. "\u0002o\u01b9\u0003\u0002\u0002\u0002q\u01d8\u0003\u0002\u0002\u0002",
  1438. "st\u0007r\u0002\u0002tu\u0007t\u0002\u0002uv\u0007q\u0002\u0002vw\u0007",
  1439. "i\u0002\u0002wx\u0007t\u0002\u0002xy\u0007c\u0002\u0002yz\u0007o\u0002",
  1440. "\u0002z{\u0007c\u0002\u0002{\u0004\u0003\u0002\u0002\u0002|}\u0007t",
  1441. "\u0002\u0002}~\u0007g\u0002\u0002~\u007f\u0007c\u0002\u0002\u007f\u0080",
  1442. "\u0007n\u0002\u0002\u0080\u0006\u0003\u0002\u0002\u0002\u0081\u0082",
  1443. "\u0007x\u0002\u0002\u0082\u0083\u0007c\u0002\u0002\u0083\u0084\u0007",
  1444. "|\u0002\u0002\u0084\u0085\u0007k\u0002\u0002\u0085\u0086\u0007q\u0002",
  1445. "\u0002\u0086\b\u0003\u0002\u0002\u0002\u0087\u0088\u0007n\u0002\u0002",
  1446. "\u0088\u0089\u0007q\u0002\u0002\u0089\u008a\u0007i\u0002\u0002\u008a",
  1447. "\u008b\u0007k\u0002\u0002\u008b\u008c\u0007e\u0002\u0002\u008c\u008d",
  1448. "\u0007q\u0002\u0002\u008d\n\u0003\u0002\u0002\u0002\u008e\u008f\u0007",
  1449. "e\u0002\u0002\u008f\u0090\u0007c\u0002\u0002\u0090\u0091\u0007f\u0002",
  1450. "\u0002\u0091\u0092\u0007g\u0002\u0002\u0092\u0093\u0007k\u0002\u0002",
  1451. "\u0093\u0094\u0007c\u0002\u0002\u0094\f\u0003\u0002\u0002\u0002\u0095",
  1452. "\u0096\u0007k\u0002\u0002\u0096\u0097\u0007p\u0002\u0002\u0097\u0098",
  1453. "\u0007v\u0002\u0002\u0098\u0099\u0007g\u0002\u0002\u0099\u009a\u0007",
  1454. "k\u0002\u0002\u009a\u009b\u0007t\u0002\u0002\u009b\u009c\u0007q\u0002",
  1455. "\u0002\u009c\u000e\u0003\u0002\u0002\u0002\u009d\u009e\u0007e\u0002",
  1456. "\u0002\u009e\u009f\u0007c\u0002\u0002\u009f\u00a0\u0007t\u0002\u0002",
  1457. "\u00a0\u00a1\u0007c\u0002\u0002\u00a1\u00a2\u0007e\u0002\u0002\u00a2",
  1458. "\u00a3\u0007v\u0002\u0002\u00a3\u00a4\u0007g\u0002\u0002\u00a4\u00a5",
  1459. "\u0007t\u0002\u0002\u00a5\u00a6\u0007g\u0002\u0002\u00a6\u0010\u0003",
  1460. "\u0002\u0002\u0002\u00a7\u00a8\u0007g\u0002\u0002\u00a8\u00a9\u0007",
  1461. "u\u0002\u0002\u00a9\u00aa\u0007e\u0002\u0002\u00aa\u00ab\u0007q\u0002",
  1462. "\u0002\u00ab\u00ac\u0007n\u0002\u0002\u00ac\u00ad\u0007j\u0002\u0002",
  1463. "\u00ad\u00ae\u0007c\u0002\u0002\u00ae\u0012\u0003\u0002\u0002\u0002",
  1464. "\u00af\u00b0\u0007e\u0002\u0002\u00b0\u00b1\u0007c\u0002\u0002\u00b1",
  1465. "\u00b2\u0007u\u0002\u0002\u00b2\u00b3\u0007q\u0002\u0002\u00b3\u0014",
  1466. "\u0003\u0002\u0002\u0002\u00b4\u00b5\u0007e\u0002\u0002\u00b5\u00b6",
  1467. "\u0007q\u0002\u0002\u00b6\u00b7\u0007p\u0002\u0002\u00b7\u00b8\u0007",
  1468. "v\u0002\u0002\u00b8\u00b9\u0007t\u0002\u0002\u00b9\u00ba\u0007c\u0002",
  1469. "\u0002\u00ba\u00bb\u0007t\u0002\u0002\u00bb\u00bc\u0007k\u0002\u0002",
  1470. "\u00bc\u00bd\u0007q\u0002\u0002\u00bd\u0016\u0003\u0002\u0002\u0002",
  1471. "\u00be\u00bf\u0007e\u0002\u0002\u00bf\u00c0\u0007q\u0002\u0002\u00c0",
  1472. "\u00c1\u0007p\u0002\u0002\u00c1\u00c2\u0007u\u0002\u0002\u00c2\u00c3",
  1473. "\u0007v\u0002\u0002\u00c3\u0018\u0003\u0002\u0002\u0002\u00c4\u00c5",
  1474. "\u0007h\u0002\u0002\u00c5\u00c6\u0007w\u0002\u0002\u00c6\u00c7\u0007",
  1475. "p\u0002\u0002\u00c7\u00c8\u0007e\u0002\u0002\u00c8\u00c9\u0007c\u0002",
  1476. "\u0002\u00c9\u00ca\u0007q\u0002\u0002\u00ca\u001a\u0003\u0002\u0002",
  1477. "\u0002\u00cb\u00cc\u0007t\u0002\u0002\u00cc\u00cd\u0007g\u0002\u0002",
  1478. "\u00cd\u00ce\u0007v\u0002\u0002\u00ce\u00cf\u0007q\u0002\u0002\u00cf",
  1479. "\u00d0\u0007t\u0002\u0002\u00d0\u00d1\u0007p\u0002\u0002\u00d1\u00d2",
  1480. "\u0007g\u0002\u0002\u00d2\u001c\u0003\u0002\u0002\u0002\u00d3\u00d4",
  1481. "\u0007r\u0002\u0002\u00d4\u00d5\u0007c\u0002\u0002\u00d5\u00d6\u0007",
  1482. "t\u0002\u0002\u00d6\u00d7\u0007c\u0002\u0002\u00d7\u001e\u0003\u0002",
  1483. "\u0002\u0002\u00d8\u00d9\u0007r\u0002\u0002\u00d9\u00da\u0007c\u0002",
  1484. "\u0002\u00da\u00db\u0007t\u0002\u0002\u00db\u00dc\u0007g\u0002\u0002",
  1485. "\u00dc \u0003\u0002\u0002\u0002\u00dd\u00de\u0007h\u0002\u0002\u00de",
  1486. "\u00df\u0007c\u0002\u0002\u00df\u00e0\u0007e\u0002\u0002\u00e0\u00e1",
  1487. "\u0007c\u0002\u0002\u00e1\"\u0003\u0002\u0002\u0002\u00e2\u00e3\u0007",
  1488. "g\u0002\u0002\u00e3\u00e4\u0007p\u0002\u0002\u00e4\u00e5\u0007s\u0002",
  1489. "\u0002\u00e5\u00e6\u0007w\u0002\u0002\u00e6\u00e7\u0007c\u0002\u0002",
  1490. "\u00e7\u00e8\u0007p\u0002\u0002\u00e8\u00e9\u0007v\u0002\u0002\u00e9",
  1491. "\u00ea\u0007q\u0002\u0002\u00ea$\u0003\u0002\u0002\u0002\u00eb\u00ec",
  1492. "\u0007u\u0002\u0002\u00ec\u00ed\u0007g\u0002\u0002\u00ed&\u0003\u0002",
  1493. "\u0002\u0002\u00ee\u00ef\u0007u\u0002\u0002\u00ef\u00f0\u0007g\u0002",
  1494. "\u0002\u00f0\u00f1\u0007p\u0002\u0002\u00f1\u00f2\u0007c\u0002\u0002",
  1495. "\u00f2\u00f3\u0007q\u0002\u0002\u00f3(\u0003\u0002\u0002\u0002\u00f4",
  1496. "\u00f5\u0007h\u0002\u0002\u00f5\u00f6\u0007c\u0002\u0002\u00f6\u00f7",
  1497. "\u0007n\u0002\u0002\u00f7\u00f8\u0007u\u0002\u0002\u00f8\u00f9\u0007",
  1498. "q\u0002\u0002\u00f9*\u0003\u0002\u0002\u0002\u00fa\u00fb\u0007x\u0002",
  1499. "\u0002\u00fb\u00fc\u0007g\u0002\u0002\u00fc\u00fd\u0007t\u0002\u0002",
  1500. "\u00fd\u00fe\u0007f\u0002\u0002\u00fe\u00ff\u0007c\u0002\u0002\u00ff",
  1501. "\u0100\u0007f\u0002\u0002\u0100\u0101\u0007g\u0002\u0002\u0101\u0102",
  1502. "\u0007k\u0002\u0002\u0102\u0103\u0007t\u0002\u0002\u0103\u0104\u0007",
  1503. "q\u0002\u0002\u0104,\u0003\u0002\u0002\u0002\u0105\u0106\u0007p\u0002",
  1504. "\u0002\u0106\u0107\u0007c\u0002\u0002\u0107\u0108\u0007q\u0002\u0002",
  1505. "\u0108.\u0003\u0002\u0002\u0002\u0109\u010a\u0007G\u0002\u0002\u010a",
  1506. "0\u0003\u0002\u0002\u0002\u010b\u010c\u0007Q\u0002\u0002\u010c\u010d",
  1507. "\u0007W\u0002\u0002\u010d2\u0003\u0002\u0002\u0002\u010e\u010f\u0007",
  1508. "*\u0002\u0002\u010f4\u0003\u0002\u0002\u0002\u0110\u0111\u0007+\u0002",
  1509. "\u0002\u01116\u0003\u0002\u0002\u0002\u0112\u0113\u0007]\u0002\u0002",
  1510. "\u01138\u0003\u0002\u0002\u0002\u0114\u0115\u0007_\u0002\u0002\u0115",
  1511. ":\u0003\u0002\u0002\u0002\u0116\u0117\u0007}\u0002\u0002\u0117<\u0003",
  1512. "\u0002\u0002\u0002\u0118\u0119\u0007\u007f\u0002\u0002\u0119>\u0003",
  1513. "\u0002\u0002\u0002\u011a\u011b\u0007.\u0002\u0002\u011b@\u0003\u0002",
  1514. "\u0002\u0002\u011c\u011d\u0007?\u0002\u0002\u011dB\u0003\u0002\u0002",
  1515. "\u0002\u011e\u011f\t\u0002\u0002\u0002\u011fD\u0003\u0002\u0002\u0002",
  1516. "\u0120\u0121\t\u0003\u0002\u0002\u0121F\u0003\u0002\u0002\u0002\u0122",
  1517. "\u0123\u0005/\u0018\u0002\u0123H\u0003\u0002\u0002\u0002\u0124\u0125",
  1518. "\u00051\u0019\u0002\u0125J\u0003\u0002\u0002\u0002\u0126\u0127\u0007",
  1519. "@\u0002\u0002\u0127\u0130\u0007?\u0002\u0002\u0128\u0129\u0007?\u0002",
  1520. "\u0002\u0129\u0130\u0007?\u0002\u0002\u012a\u012b\u0007>\u0002\u0002",
  1521. "\u012b\u0130\u0007?\u0002\u0002\u012c\u0130\t\u0004\u0002\u0002\u012d",
  1522. "\u012e\u0007#\u0002\u0002\u012e\u0130\u0007?\u0002\u0002\u012f\u0126",
  1523. "\u0003\u0002\u0002\u0002\u012f\u0128\u0003\u0002\u0002\u0002\u012f\u012a",
  1524. "\u0003\u0002\u0002\u0002\u012f\u012c\u0003\u0002\u0002\u0002\u012f\u012d",
  1525. "\u0003\u0002\u0002\u0002\u0130L\u0003\u0002\u0002\u0002\u0131\u0132",
  1526. "\u0007<\u0002\u0002\u0132N\u0003\u0002\u0002\u0002\u0133\u0134\u0005",
  1527. "-\u0017\u0002\u0134P\u0003\u0002\u0002\u0002\u0135\u0139\t\u0005\u0002",
  1528. "\u0002\u0136\u0138\t\u0006\u0002\u0002\u0137\u0136\u0003\u0002\u0002",
  1529. "\u0002\u0138\u013b\u0003\u0002\u0002\u0002\u0139\u0137\u0003\u0002\u0002",
  1530. "\u0002\u0139\u013a\u0003\u0002\u0002\u0002\u013aR\u0003\u0002\u0002",
  1531. "\u0002\u013b\u0139\u0003\u0002\u0002\u0002\u013c\u013d\u0005Q)\u0002",
  1532. "\u013d\u013e\u00070\u0002\u0002\u013e\u013f\u0005Q)\u0002\u013fT\u0003",
  1533. "\u0002\u0002\u0002\u0140\u0142\t\u0007\u0002\u0002\u0141\u0140\u0003",
  1534. "\u0002\u0002\u0002\u0142\u0143\u0003\u0002\u0002\u0002\u0143\u0141\u0003",
  1535. "\u0002\u0002\u0002\u0143\u0144\u0003\u0002\u0002\u0002\u0144\u015c\u0003",
  1536. "\u0002\u0002\u0002\u0145\u0146\u00072\u0002\u0002\u0146\u014a\u0007",
  1537. "z\u0002\u0002\u0147\u0148\u00072\u0002\u0002\u0148\u014a\u0007Z\u0002",
  1538. "\u0002\u0149\u0145\u0003\u0002\u0002\u0002\u0149\u0147\u0003\u0002\u0002",
  1539. "\u0002\u014a\u014c\u0003\u0002\u0002\u0002\u014b\u014d\u0005g4\u0002",
  1540. "\u014c\u014b\u0003\u0002\u0002\u0002\u014d\u014e\u0003\u0002\u0002\u0002",
  1541. "\u014e\u014c\u0003\u0002\u0002\u0002\u014e\u014f\u0003\u0002\u0002\u0002",
  1542. "\u014f\u015c\u0003\u0002\u0002\u0002\u0150\u0151\u00072\u0002\u0002",
  1543. "\u0151\u0155\u0007d\u0002\u0002\u0152\u0153\u00072\u0002\u0002\u0153",
  1544. "\u0155\u0007D\u0002\u0002\u0154\u0150\u0003\u0002\u0002\u0002\u0154",
  1545. "\u0152\u0003\u0002\u0002\u0002\u0155\u0157\u0003\u0002\u0002\u0002\u0156",
  1546. "\u0158\t\b\u0002\u0002\u0157\u0156\u0003\u0002\u0002\u0002\u0158\u0159",
  1547. "\u0003\u0002\u0002\u0002\u0159\u0157\u0003\u0002\u0002\u0002\u0159\u015a",
  1548. "\u0003\u0002\u0002\u0002\u015a\u015c\u0003\u0002\u0002\u0002\u015b\u0141",
  1549. "\u0003\u0002\u0002\u0002\u015b\u0149\u0003\u0002\u0002\u0002\u015b\u0154",
  1550. "\u0003\u0002\u0002\u0002\u015cV\u0003\u0002\u0002\u0002\u015d\u015f",
  1551. "\t\u0007\u0002\u0002\u015e\u015d\u0003\u0002\u0002\u0002\u015f\u0160",
  1552. "\u0003\u0002\u0002\u0002\u0160\u015e\u0003\u0002\u0002\u0002\u0160\u0161",
  1553. "\u0003\u0002\u0002\u0002\u0161\u0162\u0003\u0002\u0002\u0002\u0162\u0164",
  1554. "\u00070\u0002\u0002\u0163\u0165\t\u0007\u0002\u0002\u0164\u0163\u0003",
  1555. "\u0002\u0002\u0002\u0165\u0166\u0003\u0002\u0002\u0002\u0166\u0164\u0003",
  1556. "\u0002\u0002\u0002\u0166\u0167\u0003\u0002\u0002\u0002\u0167\u0176\u0003",
  1557. "\u0002\u0002\u0002\u0168\u016a\t\u0007\u0002\u0002\u0169\u0168\u0003",
  1558. "\u0002\u0002\u0002\u016a\u016b\u0003\u0002\u0002\u0002\u016b\u0169\u0003",
  1559. "\u0002\u0002\u0002\u016b\u016c\u0003\u0002\u0002\u0002\u016c\u016d\u0003",
  1560. "\u0002\u0002\u0002\u016d\u0171\u00070\u0002\u0002\u016e\u0170\t\u0007",
  1561. "\u0002\u0002\u016f\u016e\u0003\u0002\u0002\u0002\u0170\u0173\u0003\u0002",
  1562. "\u0002\u0002\u0171\u016f\u0003\u0002\u0002\u0002\u0171\u0172\u0003\u0002",
  1563. "\u0002\u0002\u0172\u0174\u0003\u0002\u0002\u0002\u0173\u0171\u0003\u0002",
  1564. "\u0002\u0002\u0174\u0176\u0005Y-\u0002\u0175\u015e\u0003\u0002\u0002",
  1565. "\u0002\u0175\u0169\u0003\u0002\u0002\u0002\u0176X\u0003\u0002\u0002",
  1566. "\u0002\u0177\u0179\t\t\u0002\u0002\u0178\u017a\t\u0002\u0002\u0002\u0179",
  1567. "\u0178\u0003\u0002\u0002\u0002\u0179\u017a\u0003\u0002\u0002\u0002\u017a",
  1568. "\u017c\u0003\u0002\u0002\u0002\u017b\u017d\t\u0007\u0002\u0002\u017c",
  1569. "\u017b\u0003\u0002\u0002\u0002\u017d\u017e\u0003\u0002\u0002\u0002\u017e",
  1570. "\u017c\u0003\u0002\u0002\u0002\u017e\u017f\u0003\u0002\u0002\u0002\u017f",
  1571. "Z\u0003\u0002\u0002\u0002\u0180\u0184\u0007$\u0002\u0002\u0181\u0183",
  1572. "\u0005]/\u0002\u0182\u0181\u0003\u0002\u0002\u0002\u0183\u0186\u0003",
  1573. "\u0002\u0002\u0002\u0184\u0182\u0003\u0002\u0002\u0002\u0184\u0185\u0003",
  1574. "\u0002\u0002\u0002\u0185\u0187\u0003\u0002\u0002\u0002\u0186\u0184\u0003",
  1575. "\u0002\u0002\u0002\u0187\u0188\u0007$\u0002\u0002\u0188\\\u0003\u0002",
  1576. "\u0002\u0002\u0189\u018c\n\n\u0002\u0002\u018a\u018c\u0005k6\u0002\u018b",
  1577. "\u0189\u0003\u0002\u0002\u0002\u018b\u018a\u0003\u0002\u0002\u0002\u018c",
  1578. "^\u0003\u0002\u0002\u0002\u018d\u0190\u0007)\u0002\u0002\u018e\u0191",
  1579. "\u0005k6\u0002\u018f\u0191\n\u000b\u0002\u0002\u0190\u018e\u0003\u0002",
  1580. "\u0002\u0002\u0190\u018f\u0003\u0002\u0002\u0002\u0191\u0192\u0003\u0002",
  1581. "\u0002\u0002\u0192\u0193\u0007)\u0002\u0002\u0193`\u0003\u0002\u0002",
  1582. "\u0002\u0194\u0195\t\f\u0002\u0002\u0195\u0196\u0003\u0002\u0002\u0002",
  1583. "\u0196\u0197\b1\u0002\u0002\u0197b\u0003\u0002\u0002\u0002\u0198\u0199",
  1584. "\u0007=\u0002\u0002\u0199d\u0003\u0002\u0002\u0002\u019a\u019c\t\r\u0002",
  1585. "\u0002\u019b\u019a\u0003\u0002\u0002\u0002\u019c\u019d\u0003\u0002\u0002",
  1586. "\u0002\u019d\u019b\u0003\u0002\u0002\u0002\u019d\u019e\u0003\u0002\u0002",
  1587. "\u0002\u019e\u01a1\u0003\u0002\u0002\u0002\u019f\u01a1\u0005c2\u0002",
  1588. "\u01a0\u019b\u0003\u0002\u0002\u0002\u01a0\u019f\u0003\u0002\u0002\u0002",
  1589. "\u01a1f\u0003\u0002\u0002\u0002\u01a2\u01a3\t\u000e\u0002\u0002\u01a3",
  1590. "h\u0003\u0002\u0002\u0002\u01a4\u01a5\t\u000f\u0002\u0002\u01a5j\u0003",
  1591. "\u0002\u0002\u0002\u01a6\u01a7\u0007^\u0002\u0002\u01a7\u01ab\t\u0010",
  1592. "\u0002\u0002\u01a8\u01ab\u0005o8\u0002\u01a9\u01ab\u0005m7\u0002\u01aa",
  1593. "\u01a6\u0003\u0002\u0002\u0002\u01aa\u01a8\u0003\u0002\u0002\u0002\u01aa",
  1594. "\u01a9\u0003\u0002\u0002\u0002\u01abl\u0003\u0002\u0002\u0002\u01ac",
  1595. "\u01ad\u0007^\u0002\u0002\u01ad\u01ae\t\u0011\u0002\u0002\u01ae\u01af",
  1596. "\u0005i5\u0002\u01af\u01b0\u0005i5\u0002\u01b0\u01b8\u0003\u0002\u0002",
  1597. "\u0002\u01b1\u01b2\u0007^\u0002\u0002\u01b2\u01b3\u0005i5\u0002\u01b3",
  1598. "\u01b4\u0005i5\u0002\u01b4\u01b8\u0003\u0002\u0002\u0002\u01b5\u01b6",
  1599. "\u0007^\u0002\u0002\u01b6\u01b8\u0005i5\u0002\u01b7\u01ac\u0003\u0002",
  1600. "\u0002\u0002\u01b7\u01b1\u0003\u0002\u0002\u0002\u01b7\u01b5\u0003\u0002",
  1601. "\u0002\u0002\u01b8n\u0003\u0002\u0002\u0002\u01b9\u01ba\u0007^\u0002",
  1602. "\u0002\u01ba\u01bb\u0007w\u0002\u0002\u01bb\u01bc\u0005g4\u0002\u01bc",
  1603. "\u01bd\u0005g4\u0002\u01bd\u01be\u0005g4\u0002\u01be\u01bf\u0005g4\u0002",
  1604. "\u01bfp\u0003\u0002\u0002\u0002\u01c0\u01c1\u00071\u0002\u0002\u01c1",
  1605. "\u01c2\u00071\u0002\u0002\u01c2\u01c6\u0003\u0002\u0002\u0002\u01c3",
  1606. "\u01c5\n\r\u0002\u0002\u01c4\u01c3\u0003\u0002\u0002\u0002\u01c5\u01c8",
  1607. "\u0003\u0002\u0002\u0002\u01c6\u01c4\u0003\u0002\u0002\u0002\u01c6\u01c7",
  1608. "\u0003\u0002\u0002\u0002\u01c7\u01ca\u0003\u0002\u0002\u0002\u01c8\u01c6",
  1609. "\u0003\u0002\u0002\u0002\u01c9\u01cb\u0007\u000f\u0002\u0002\u01ca\u01c9",
  1610. "\u0003\u0002\u0002\u0002\u01ca\u01cb\u0003\u0002\u0002\u0002\u01cb\u01cc",
  1611. "\u0003\u0002\u0002\u0002\u01cc\u01d9\u0007\f\u0002\u0002\u01cd\u01ce",
  1612. "\u00071\u0002\u0002\u01ce\u01cf\u0007,\u0002\u0002\u01cf\u01d3\u0003",
  1613. "\u0002\u0002\u0002\u01d0\u01d2\u000b\u0002\u0002\u0002\u01d1\u01d0\u0003",
  1614. "\u0002\u0002\u0002\u01d2\u01d5\u0003\u0002\u0002\u0002\u01d3\u01d4\u0003",
  1615. "\u0002\u0002\u0002\u01d3\u01d1\u0003\u0002\u0002\u0002\u01d4\u01d6\u0003",
  1616. "\u0002\u0002\u0002\u01d5\u01d3\u0003\u0002\u0002\u0002\u01d6\u01d7\u0007",
  1617. ",\u0002\u0002\u01d7\u01d9\u00071\u0002\u0002\u01d8\u01c0\u0003\u0002",
  1618. "\u0002\u0002\u01d8\u01cd\u0003\u0002\u0002\u0002\u01d9\u01da\u0003\u0002",
  1619. "\u0002\u0002\u01da\u01db\b9\u0003\u0002\u01dbr\u0003\u0002\u0002\u0002",
  1620. "\u001d\u0002\u012f\u0139\u0143\u0149\u014e\u0154\u0159\u015b\u0160\u0166",
  1621. "\u016b\u0171\u0175\u0179\u017e\u0184\u018b\u0190\u019d\u01a0\u01aa\u01b7",
  1622. "\u01c6\u01ca\u01d3\u01d8\u0004\b\u0002\u0002\u0002\u0003\u0002"].join("");
  1623. var atn = new antlr4.atn.ATNDeserializer().deserialize(serializedATN);
  1624. var decisionsToDFA = atn.decisionToState.map( function(ds, index) { return new antlr4.dfa.DFA(ds, index); });
  1625. function ivprog(input) {
  1626. antlr4.Lexer.call(this, input);
  1627. this._interp = new antlr4.atn.LexerATNSimulator(this, atn, decisionsToDFA, new antlr4.PredictionContextCache());
  1628. return this;
  1629. }
  1630. ivprog.prototype = Object.create(antlr4.Lexer.prototype);
  1631. ivprog.prototype.constructor = ivprog;
  1632. ivprog.EOF = antlr4.Token.EOF;
  1633. ivprog.RK_PROGRAM = 1;
  1634. ivprog.RK_REAL = 2;
  1635. ivprog.RK_VOID = 3;
  1636. ivprog.RK_BOOLEAN = 4;
  1637. ivprog.RK_STRING = 5;
  1638. ivprog.RK_INTEGER = 6;
  1639. ivprog.RK_CHARACTER = 7;
  1640. ivprog.RK_SWITCH = 8;
  1641. ivprog.RK_CASE = 9;
  1642. ivprog.RK_DEFAULT = 10;
  1643. ivprog.RK_CONST = 11;
  1644. ivprog.RK_FUNCTION = 12;
  1645. ivprog.RK_RETURN = 13;
  1646. ivprog.RK_FOR = 14;
  1647. ivprog.RK_BREAK = 15;
  1648. ivprog.RK_DO = 16;
  1649. ivprog.RK_WHILE = 17;
  1650. ivprog.RK_IF = 18;
  1651. ivprog.RK_ELSE = 19;
  1652. ivprog.RK_FALSE = 20;
  1653. ivprog.RK_TRUE = 21;
  1654. ivprog.OPEN_PARENTHESIS = 22;
  1655. ivprog.CLOSE_PARENTHESIS = 23;
  1656. ivprog.OPEN_BRACE = 24;
  1657. ivprog.CLOSE_BRACE = 25;
  1658. ivprog.OPEN_CURLY = 26;
  1659. ivprog.CLOSE_CURLY = 27;
  1660. ivprog.COMMA = 28;
  1661. ivprog.EQUAL = 29;
  1662. ivprog.SUM_OP = 30;
  1663. ivprog.MULTI_OP = 31;
  1664. ivprog.AND_OPERATOR = 32;
  1665. ivprog.OR_OPERATOR = 33;
  1666. ivprog.RELATIONAL_OPERATOR = 34;
  1667. ivprog.COLON = 35;
  1668. ivprog.NOT_OPERATOR = 36;
  1669. ivprog.ID = 37;
  1670. ivprog.LIB_ID = 38;
  1671. ivprog.INTEGER = 39;
  1672. ivprog.REAL = 40;
  1673. ivprog.STRING = 41;
  1674. ivprog.CHARACTER = 42;
  1675. ivprog.WHITESPACE = 43;
  1676. ivprog.EOS = 44;
  1677. ivprog.COMMENTS = 45;
  1678. ivprog.prototype.channelNames = [ "DEFAULT_TOKEN_CHANNEL", "HIDDEN" ];
  1679. ivprog.prototype.modeNames = [ "DEFAULT_MODE" ];
  1680. ivprog.prototype.literalNames = [ null, "'programa'", "'real'", "'vazio'",
  1681. "'logico'", "'cadeia'", "'inteiro'", "'caractere'",
  1682. "'escolha'", "'caso'", "'contrario'",
  1683. "'const'", "'funcao'", "'retorne'", "'para'",
  1684. "'pare'", "'faca'", "'enquanto'", "'se'",
  1685. "'senao'", "'falso'", "'verdadeiro'",
  1686. "'('", "')'", "'['", "']'", "'{'", "'}'",
  1687. "','", "'='", null, null, null, null,
  1688. null, "':'" ];
  1689. ivprog.prototype.symbolicNames = [ null, "RK_PROGRAM", "RK_REAL", "RK_VOID",
  1690. "RK_BOOLEAN", "RK_STRING", "RK_INTEGER",
  1691. "RK_CHARACTER", "RK_SWITCH", "RK_CASE",
  1692. "RK_DEFAULT", "RK_CONST", "RK_FUNCTION",
  1693. "RK_RETURN", "RK_FOR", "RK_BREAK", "RK_DO",
  1694. "RK_WHILE", "RK_IF", "RK_ELSE", "RK_FALSE",
  1695. "RK_TRUE", "OPEN_PARENTHESIS", "CLOSE_PARENTHESIS",
  1696. "OPEN_BRACE", "CLOSE_BRACE", "OPEN_CURLY",
  1697. "CLOSE_CURLY", "COMMA", "EQUAL", "SUM_OP",
  1698. "MULTI_OP", "AND_OPERATOR", "OR_OPERATOR",
  1699. "RELATIONAL_OPERATOR", "COLON", "NOT_OPERATOR",
  1700. "ID", "LIB_ID", "INTEGER", "REAL", "STRING",
  1701. "CHARACTER", "WHITESPACE", "EOS", "COMMENTS" ];
  1702. ivprog.prototype.ruleNames = [ "RK_PROGRAM", "RK_REAL", "RK_VOID", "RK_BOOLEAN",
  1703. "RK_STRING", "RK_INTEGER", "RK_CHARACTER",
  1704. "RK_SWITCH", "RK_CASE", "RK_DEFAULT", "RK_CONST",
  1705. "RK_FUNCTION", "RK_RETURN", "RK_FOR", "RK_BREAK",
  1706. "RK_DO", "RK_WHILE", "RK_IF", "RK_ELSE",
  1707. "RK_FALSE", "RK_TRUE", "RK_LOGICAL_NOT",
  1708. "RK_LOGICAL_AND", "RK_LOGICAL_OR", "OPEN_PARENTHESIS",
  1709. "CLOSE_PARENTHESIS", "OPEN_BRACE", "CLOSE_BRACE",
  1710. "OPEN_CURLY", "CLOSE_CURLY", "COMMA", "EQUAL",
  1711. "SUM_OP", "MULTI_OP", "AND_OPERATOR", "OR_OPERATOR",
  1712. "RELATIONAL_OPERATOR", "COLON", "NOT_OPERATOR",
  1713. "ID", "LIB_ID", "INTEGER", "REAL", "ExponentPart",
  1714. "STRING", "STRING_CHARACTER", "CHARACTER",
  1715. "WHITESPACE", "SEMICOLON", "EOS", "HEX_DIGIT",
  1716. "OCTAL_DIGIT", "ESC_SEQ", "ESC_OCTAL", "ESC_UNICODE",
  1717. "COMMENTS" ];
  1718. ivprog.prototype.grammarFileName = "ivprog.g4";
  1719. exports.ivprog = ivprog;
  1720. /***/ }),
  1721. /* 1 */
  1722. /***/ (function(module, exports, __webpack_require__) {
  1723. module.exports = {
  1724. ivprog: __webpack_require__(0).ivprog
  1725. };
  1726. /***/ }),
  1727. /* 2 */
  1728. /***/ (function(module, exports) {
  1729. module.exports = __webpack_require__(/*! antlr4/index */ "./node_modules/antlr4/index.js");
  1730. /***/ })
  1731. /******/ ]);
  1732. /***/ }),
  1733. /***/ "./grammar/pt/langFunctions.js":
  1734. /*!*************************************!*\
  1735. !*** ./grammar/pt/langFunctions.js ***!
  1736. \*************************************/
  1737. /*! no static exports found */
  1738. /***/ (function(module, exports, __webpack_require__) {
  1739. "use strict";
  1740. Object.defineProperty(exports, "__esModule", {
  1741. value: true
  1742. });
  1743. /* This is a dictionary of the language defined functions
  1744. **/
  1745. exports.default = {
  1746. main_function: "inicio",
  1747. $read: "leia",
  1748. $write: "escreva",
  1749. $numElements: "total_de_elementos",
  1750. $matrixLines: "total_de_linhas",
  1751. $matrixColumns: "total_de_colunas",
  1752. $substring: "subcadeia",
  1753. $length: "comprimento",
  1754. $uppercase: "caixa_alta",
  1755. $lowercase: "caixa_baixa",
  1756. $charAt: "char_at",
  1757. $isReal: "e_real",
  1758. $isInt: "e_inteiro",
  1759. $isBool: "e_logico",
  1760. $castReal: "como_real",
  1761. $castInt: "como_inteiro",
  1762. $castBool: "como_logico",
  1763. $castString: "como_cadeia",
  1764. $sin: "seno",
  1765. $cos: "cosseno",
  1766. $tan: "tangente",
  1767. $sqrt: "raiz_quadrada",
  1768. $pow: "potencia",
  1769. $log: "logaritmo",
  1770. $abs: "modulo",
  1771. $negate: "trocar_sinal",
  1772. $invert: "inverter_valor",
  1773. $max: "maximo",
  1774. $min: "minimo"
  1775. };
  1776. /***/ }),
  1777. /***/ "./grammar/pt/langLibs.js":
  1778. /*!********************************!*\
  1779. !*** ./grammar/pt/langLibs.js ***!
  1780. \********************************/
  1781. /*! no static exports found */
  1782. /***/ (function(module, exports, __webpack_require__) {
  1783. "use strict";
  1784. Object.defineProperty(exports, "__esModule", {
  1785. value: true
  1786. });
  1787. /**
  1788. * This is the dictionary of the language defined libraries
  1789. */
  1790. exports.default = {
  1791. $mathLib: "Matematica",
  1792. $ioLib: "ES",
  1793. $strLib: "Texto",
  1794. $arrayLib: "Arranjo",
  1795. $langLib: "Conversao"
  1796. };
  1797. /***/ }),
  1798. /***/ "./i18n/en/error.json":
  1799. /*!****************************!*\
  1800. !*** ./i18n/en/error.json ***!
  1801. \****************************/
  1802. /*! exports provided: token_missing_one, token_missing_two, eos_missing, invalid_type, invalid_array_dimension, invalid_array_size, extra_lines, invalid_main_return, invalid_var_declaration, invalid_break_command, invalid_terminal, id_missing, main_missing, invalid_global_var, not_implemented, function_missing, invalid_parameters_size, invalid_ref, invalid_parameter_type, unknown_command, loop_condition_type, if_condition_type, invalid_return_type, unexpected_break_command, invalid_dimension, void_in_expression, invalid_array, invalid_array_access, column_outbounds, line_outbounds, invalid_infix_op, invalid_unary_op, unknown_op, default */
  1803. /***/ (function(module) {
  1804. module.exports = {"token_missing_one":"Erro de sintaxe: Espera-se $0, mas encontrou-se $1 na linha:$2, coluna:$3","token_missing_two":"Erro de sintaxe: Esperava-se $0 ou $1 mas encontrou-se $2 na liha:$3, coluna: $4","eos_missing":"Falta uma nova linha ou ; na linha: $0, coluna: $1","invalid_type":"$0 na linha: $1, coluna: $2 é um tipo inválido. Os tipos válidos são: $3","invalid_array_dimension":"A dimensão inválida na linha: $0, coluna: $1. Insira um $2 ou identificador válido do mesmo tipo.","invalid_array_size":"O tamnho do vetor/matriz excede o máximo de 2 na linha $0","extra_lines":"Nenhum texto é permitido após '}' em 'programa {...}'","invalid_main_return":"A função $0 deve retornar $1 na linha $2","invalid_var_declaration":"Erro na linha $0. Variáveis só podem ser declarados no corpo principal da função e de preferência nas primeiras linhas.","invalid_break_command":"Erro na linha $0. O comando $1 não pode ser usado fora de uma estrutura de repetição ou 'escolha...caso'","invalid_terminal":"Não é possível utilizar $0 na expressão da linha: $1, coluna: $2. Tente um valor númerico, variável ou chamada de função.","id_missing":"Esperava-se um identificador, mas encontrou-se $0 na linha: $1, coluna: $2","main_missing":"A função principal não foi encontrada","invalid_global_var":"Erro crítico: Chamada inválida da função initGlobal fora do contexto BASE","not_implemented":"Erro interno crítico: A função definida pelo sistema $0 não foi implementada.","function_missing":"A função $0 não foi encontrada","invalid_parameters_size":"A quantidade de parâmetros fornecidos está incorreta. Esperava-se $0, encontrou-se $1","invalid_ref":"Você deve fornecer apenas um identificador como parâmetro","invalid_parameter_type":"O valor fornecido como parâmetro é do tipo $0, mas o tipo esperado é $1","unknown_command":"Erro interno crítico: Comando desconhecido encontrado","loop_condition_type":"A condição dos laços de repetição deve ser do tipo lógico","if_condition_type":"A condição de um comando se...senao deve ser do tipo lógico","invalid_return_type":"A função $0 deve retornar um tipo $1, ao invés de $1","unexpected_break_command":"Erro interno crítico: Comando pare encontrado fora do contexto de um laço/escolha..caso","invalid_dimension":"As dimensões de um vetor/matriz devem ser do tipo inteiro","void_in_expression":"A função $0 não pode ser utilizada aqui pois seu tipo de retorno é vazio","invalid_array":"Expressão literal de Vetor/Mariz inválida","invalid_array_access":"Identificador $0 não se refere a um vetor/matriz válido","column_outbounds":"Número de colunas $0 é inválido para a matriz $1 que possui $2 colunas","line_outbounds":"Número de linhas $0 é invaálido para a matriz $1 que possui $2 linhas","invalid_infix_op":"Não é possível aplicar a operação $0 entre os tipos $1 e $2","invalid_unary_op":"Não é possível aplicar a operação $0 ao tipo $1","unknown_op":"Erro interno crítico: Operação $0 desconhecida"};
  1805. /***/ }),
  1806. /***/ "./i18n/en/index.js":
  1807. /*!**************************!*\
  1808. !*** ./i18n/en/index.js ***!
  1809. \**************************/
  1810. /*! no static exports found */
  1811. /***/ (function(module, exports, __webpack_require__) {
  1812. "use strict";
  1813. Object.defineProperty(exports, "__esModule", {
  1814. value: true
  1815. });
  1816. var _error = __webpack_require__(/*! ./error.json */ "./i18n/en/error.json");
  1817. var _error2 = _interopRequireDefault(_error);
  1818. var _message = __webpack_require__(/*! ./message.json */ "./i18n/en/message.json");
  1819. var _message2 = _interopRequireDefault(_message);
  1820. var _ui = __webpack_require__(/*! ./ui.json */ "./i18n/en/ui.json");
  1821. var _ui2 = _interopRequireDefault(_ui);
  1822. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  1823. exports.default = {
  1824. 'message': _message2.default,
  1825. 'error': _error2.default,
  1826. 'ui': _ui2.default
  1827. };
  1828. /***/ }),
  1829. /***/ "./i18n/en/message.json":
  1830. /*!******************************!*\
  1831. !*** ./i18n/en/message.json ***!
  1832. \******************************/
  1833. /*! exports provided: default */
  1834. /***/ (function(module) {
  1835. module.exports = {};
  1836. /***/ }),
  1837. /***/ "./i18n/en/ui.json":
  1838. /*!*************************!*\
  1839. !*** ./i18n/en/ui.json ***!
  1840. \*************************/
  1841. /*! exports provided: function, btn_clear, btn_function, btn_arithmetic_plus, btn_arithmetic_minus, btn_arithmetic_multiplication, btn_arithmetic_division, btn_arithmetic_module, btn_break, btn_case, start, void, integer, real, program, text, text_start, boolean, true, false, variable, command, new_parameter, new_variable, new_global, new_function, vector, text_comment_start, text_comment_main, text_read_var, text_write_var, text_command_read, text_command_write, text_comment, text_attribution, text_if, text_else, text_break, text_for, text_code_while, text_code_do, text_command_do, text_code_switch, text_code_case, text_logic_expression, text_arithmetic_expression, text_iftrue, text_receives, text_repeatNtimes, text_return, text_btn_return, text_whiletrue, text_dowhiletrue, text_switch, text_functioncall, text_value, text_operator, text_parentheses, text_change, text_teacher_algorithm, text_teacher_algorithm_include, text_teacher_test_case, text_teacher_config, text_teacher_data_types, text_teacher_commands, text_teacher_functions, text_teacher_create_functions, text_teacher_create_movement_functions, text_teacher_test_case_input, text_teacher_test_case_output, text_teacher_test_case_actions, text_teacher_test_case_add, text_header_ivprog_functions, text_menu_functions_math, text_menu_functions_text, text_menu_functions_arrangement, text_menu_functions_conversion, text_none_variable, text_none_variable_instruction, tooltip_visual, tooltip_textual, tooltip_upload, tooltip_download, tooltip_undo, tooltip_redo, tooltip_run, tooltip_evaluate, tooltip_help, tooltip_add_global, tooltip_minimize, tooltip_console, var_menu_select_var, var_menu_select_all, var_menu_select_function, expression_menu_select, math, text_t, arrangement, conversion, $sin, $cos, $tan, $sqrt, $pow, $log, $abs, $negate, $invert, $max, $min, $substring, $length, $uppercase, $lowercase, $charAt, $numElements, $matrixLines, $matrixColumns, $isReal, $isInt, $isBool, $castReal, $castInt, $castBool, $castString, default */
  1842. /***/ (function(module) {
  1843. module.exports = {"function":"function","btn_clear":"Clear","btn_function":"Function","btn_arithmetic_plus":"Sum","btn_arithmetic_minus":"Minus","btn_arithmetic_multiplication":"Multiplication","btn_arithmetic_division":"Division","btn_arithmetic_module":"Module","btn_break":"Break","btn_case":"Case","start":"start","void":"void","integer":"integer","real":"real","program":"program","text":"string","text_start":"text","boolean":"boolean","true":"true","false":"false","variable":"Variable","command":"Command","new_parameter":"new_parameter","new_variable":"new_variable","new_global":"new_global","new_function":"new_function","vector":"vector","text_comment_start":"Initial comment of function...","text_comment_main":"This is the main function...","text_read_var":"Reading data","text_write_var":"Writing data","text_command_read":"read","text_command_write":"write","text_comment":"Comment","text_attribution":"Attribution","text_if":"if","text_else":"else","text_break":"break","text_for":"for","text_code_while":"while","text_code_do":"do","text_command_do":"do","text_code_switch":"switch","text_code_case":"case","text_logic_expression":"Logic Expression","text_arithmetic_expression":"Arithmetic Expression","text_iftrue":"If true then","text_receives":"receives","text_repeatNtimes":"Repeat N times","text_return":"return","text_btn_return":"Return","text_whiletrue":"While true","text_dowhiletrue":"Do while true","text_switch":"Switch","text_functioncall":"Function call","text_value":"Value","text_operator":"Operator","text_parentheses":"Parentheses","text_change":"Change","text_teacher_algorithm":"Algorithm","text_teacher_algorithm_include":"Include the following algorithm in exercise","text_teacher_test_case":"Test cases","text_teacher_config":"Settings","text_teacher_data_types":"Data types","text_teacher_commands":"Commands","text_teacher_functions":"Functions","text_teacher_create_functions":"Create new functions","text_teacher_create_movement_functions":"Move functions","text_teacher_test_case_input":"Input","text_teacher_test_case_output":"Output","text_teacher_test_case_actions":"Actions","text_teacher_test_case_add":"Add test cases","text_header_ivprog_functions":"iVProg Functions","text_menu_functions_math":"Mathematic","text_menu_functions_text":"Text","text_menu_functions_arrangement":"Arrangement","text_menu_functions_conversion":"Conversion","text_none_variable":"There is no declared variable","text_none_variable_instruction":"Create a new variable to use it","tooltip_visual":"Visual programming","tooltip_textual":"Textual programming","tooltip_upload":"Upload code file","tooltip_download":"Download code file","tooltip_undo":"Undo","tooltip_redo":"Redo","tooltip_run":"Run program","tooltip_evaluate":"Evaluate program","tooltip_help":"Help","tooltip_add_global":"Add global variable","tooltip_minimize":"Hidde function elements","tooltip_console":"Open/Close console","var_menu_select_var":"Select a var","var_menu_select_all":"Select","var_menu_select_function":"Select a function","expression_menu_select":"Select an expression","math":"Mathematic","text_t":"Text","arrangement":"Arrangement","conversion":"Conversion","$sin":"sin","$cos":"cos","$tan":"tan","$sqrt":"sqrt","$pow":"pow","$log":"log","$abs":"abs","$negate":"negate","$invert":"invert","$max":"maximum","$min":"minimum","$substring":"substring","$length":"length","$uppercase":"uppercase","$lowercase":"lowercase","$charAt":"char_at","$numElements":"total_of_elements","$matrixLines":"total_of_lines","$matrixColumns":"total_of_columns","$isReal":"is_real","$isInt":"is_integer","$isBool":"is_logic","$castReal":"to_real","$castInt":"to_integer","$castBool":"to_logic","$castString":"to_string"};
  1844. /***/ }),
  1845. /***/ "./i18n/es/error.json":
  1846. /*!****************************!*\
  1847. !*** ./i18n/es/error.json ***!
  1848. \****************************/
  1849. /*! exports provided: default */
  1850. /***/ (function(module) {
  1851. module.exports = {};
  1852. /***/ }),
  1853. /***/ "./i18n/es/index.js":
  1854. /*!**************************!*\
  1855. !*** ./i18n/es/index.js ***!
  1856. \**************************/
  1857. /*! no static exports found */
  1858. /***/ (function(module, exports, __webpack_require__) {
  1859. "use strict";
  1860. Object.defineProperty(exports, "__esModule", {
  1861. value: true
  1862. });
  1863. var _error = __webpack_require__(/*! ./error.json */ "./i18n/es/error.json");
  1864. var _error2 = _interopRequireDefault(_error);
  1865. var _message = __webpack_require__(/*! ./message.json */ "./i18n/es/message.json");
  1866. var _message2 = _interopRequireDefault(_message);
  1867. var _ui = __webpack_require__(/*! ./ui.json */ "./i18n/es/ui.json");
  1868. var _ui2 = _interopRequireDefault(_ui);
  1869. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  1870. exports.default = {
  1871. 'message': _message2.default,
  1872. 'error': _error2.default,
  1873. 'ui': _ui2.default
  1874. };
  1875. /***/ }),
  1876. /***/ "./i18n/es/message.json":
  1877. /*!******************************!*\
  1878. !*** ./i18n/es/message.json ***!
  1879. \******************************/
  1880. /*! exports provided: default */
  1881. /***/ (function(module) {
  1882. module.exports = {};
  1883. /***/ }),
  1884. /***/ "./i18n/es/ui.json":
  1885. /*!*************************!*\
  1886. !*** ./i18n/es/ui.json ***!
  1887. \*************************/
  1888. /*! exports provided: function, btn_clear, btn_function, btn_arithmetic_plus, btn_arithmetic_minus, btn_arithmetic_multiplication, btn_arithmetic_division, btn_arithmetic_module, btn_break, btn_case, start, void, integer, real, program, text, text_start, boolean, true, false, variable, command, new_parameter, new_variable, new_global, new_function, vector, text_comment_start, text_comment_main, text_read_var, text_write_var, text_command_read, text_command_write, text_comment, text_attribution, text_if, text_break, text_else, text_return, text_btn_return, text_for, text_code_while, text_code_do, text_command_do, text_code_switch, text_code_case, text_logic_expression, text_arithmetic_expression, text_iftrue, text_repeatNtimes, text_receives, text_whiletrue, text_dowhiletrue, text_switch, text_functioncall, text_value, text_operator, text_parentheses, text_change, text_teacher_algorithm, text_teacher_algorithm_include, text_teacher_test_case, text_teacher_config, text_teacher_data_types, text_teacher_commands, text_teacher_functions, text_teacher_create_functions, text_teacher_create_movement_functions, text_teacher_test_case_input, text_teacher_test_case_output, text_teacher_test_case_actions, text_teacher_test_case_add, text_header_ivprog_functions, text_menu_functions_math, text_menu_functions_text, text_menu_functions_arrangement, text_menu_functions_conversion, text_none_variable, text_none_variable_instruction, tooltip_visual, tooltip_textual, tooltip_upload, tooltip_download, tooltip_undo, tooltip_redo, tooltip_run, tooltip_evaluate, tooltip_help, tooltip_add_global, tooltip_minimize, tooltip_console, var_menu_select_var, var_menu_select_all, var_menu_select_function, expression_menu_select, $sin, math, arrangement, conversion, text_t, $cos, $tan, $sqrt, $pow, $log, $abs, $negate, $invert, $max, $min, $substring, $length, $uppercase, $lowercase, $charAt, $numElements, $matrixLines, $matrixColumns, $isReal, $isInt, $isBool, $castReal, $castInt, $castBool, $castString, default */
  1889. /***/ (function(module) {
  1890. module.exports = {"function":"function","btn_clear":"Clear","btn_function":"Function","btn_arithmetic_plus":"Sum","btn_arithmetic_minus":"Minus","btn_arithmetic_multiplication":"Multiplication","btn_arithmetic_division":"Division","btn_arithmetic_module":"Module","btn_break":"Break","btn_case":"Case","start":"start","void":"void","integer":"integer","real":"real","program":"program","text":"Text","text_start":"text","boolean":"boolean","true":"true","false":"false","variable":"Variable","command":"Command","new_parameter":"new_parameter","new_variable":"new_variable","new_global":"new_global","new_function":"new_function","vector":"vector","text_comment_start":"Initial comment of function...","text_comment_main":"This is the main function...","text_read_var":"Reading data","text_write_var":"Writing data","text_command_read":"read","text_command_write":"write","text_comment":"Comment","text_attribution":"Attribution","text_if":"if","text_break":"break","text_else":"else","text_return":"return","text_btn_return":"Return","text_for":"for","text_code_while":"while","text_code_do":"do","text_command_do":"do","text_code_switch":"switch","text_code_case":"case","text_logic_expression":"Logic Expression","text_arithmetic_expression":"Arithmetic Expression","text_iftrue":"If true then","text_repeatNtimes":"Repeat N times","text_receives":"receives","text_whiletrue":"While true","text_dowhiletrue":"Do while true","text_switch":"Switch","text_functioncall":"Function call","text_value":"Value","text_operator":"Operator","text_parentheses":"Parentheses","text_change":"Change","text_teacher_algorithm":"Algorithm","text_teacher_algorithm_include":"Include the following algorithm in exercise","text_teacher_test_case":"Test cases","text_teacher_config":"Settings","text_teacher_data_types":"Data types","text_teacher_commands":"Commands","text_teacher_functions":"Functions","text_teacher_create_functions":"Create new functions","text_teacher_create_movement_functions":"Move functions","text_teacher_test_case_input":"Input","text_teacher_test_case_output":"Output","text_teacher_test_case_actions":"Actions","text_teacher_test_case_add":"Add test cases","text_header_ivprog_functions":"iVProg Functions","text_menu_functions_math":"Mathematics","text_menu_functions_text":"Text","text_menu_functions_arrangement":"Arrangement","text_menu_functions_conversion":"Conversion","text_none_variable":"There is no declared variable","text_none_variable_instruction":"Create a new variable to use it","tooltip_visual":"Visual programming","tooltip_textual":"Textual programming","tooltip_upload":"Upload code file","tooltip_download":"Download code file","tooltip_undo":"Undo","tooltip_redo":"Redo","tooltip_run":"Run program","tooltip_evaluate":"Evaluate program","tooltip_help":"Help","tooltip_add_global":"Add global variable","tooltip_minimize":"Hidde function elements","tooltip_console":"Open/Close console","var_menu_select_var":"Select a var","var_menu_select_all":"Select","var_menu_select_function":"Select a function","expression_menu_select":"Select an expression","$sin":"sin","math":"Mathematic","arrangement":"Arrangement","conversion":"Conversion","text_t":"Text","$cos":"cos","$tan":"tan","$sqrt":"sqrt","$pow":"pow","$log":"log","$abs":"abs","$negate":"negate","$invert":"invert","$max":"maximum","$min":"minimum","$substring":"substring","$length":"length","$uppercase":"uppercase","$lowercase":"lowercase","$charAt":"char_at","$numElements":"total_of_elements","$matrixLines":"total_of_lines","$matrixColumns":"total_of_columns","$isReal":"is_real","$isInt":"is_integer","$isBool":"is_logic","$castReal":"to_real","$castInt":"to_integer","$castBool":"to_logic","$castString":"to_string"};
  1891. /***/ }),
  1892. /***/ "./i18n/index.js":
  1893. /*!***********************!*\
  1894. !*** ./i18n/index.js ***!
  1895. \***********************/
  1896. /*! no static exports found */
  1897. /***/ (function(module, exports, __webpack_require__) {
  1898. "use strict";
  1899. Object.defineProperty(exports, "__esModule", {
  1900. value: true
  1901. });
  1902. var _en = __webpack_require__(/*! ./en */ "./i18n/en/index.js");
  1903. var _en2 = _interopRequireDefault(_en);
  1904. var _pt = __webpack_require__(/*! ./pt */ "./i18n/pt/index.js");
  1905. var _pt2 = _interopRequireDefault(_pt);
  1906. var _es = __webpack_require__(/*! ./es */ "./i18n/es/index.js");
  1907. var _es2 = _interopRequireDefault(_es);
  1908. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  1909. exports.default = {
  1910. 'en': _en2.default,
  1911. 'pt': _pt2.default,
  1912. 'es': _es2.default
  1913. };
  1914. /***/ }),
  1915. /***/ "./i18n/pt/error.json":
  1916. /*!****************************!*\
  1917. !*** ./i18n/pt/error.json ***!
  1918. \****************************/
  1919. /*! exports provided: token_missing_one, token_missing_two, eos_missing, invalid_type, invalid_array_dimension, invalid_array_size, extra_lines, invalid_main_return, invalid_var_declaration, invalid_break_command, invalid_terminal, const_not_init, id_missing, invalid_id_format, main_missing, invalid_global_var, not_implemented, function_missing, function_missing_full, invalid_parameters_size_full, invalid_parameters_size, invalid_ref_full, invalid_ref, invalid_parameter_type_full, invalid_parameter_type, unknown_command_full, unknown_command, loop_condition_type_full, loop_condition_type, endless_loop_full, endless_loop, for_condition_type_full, for_condition_type, if_condition_type_full, if_condition_type, invalid_return_type_full, invalid_return_type, invalid_void_return_full, invalid_void_return, unexpected_break_command_full, unexpected_break_command, invalid_dimension, void_in_expression_full, void_in_expression, invalid_array_access_full, invalid_array_access, invalid_matrix_access_full, invalid_matrix_access, matrix_column_outbounds_full, matrix_column_outbounds, matrix_line_outbounds_full, matrix_line_outbounds, vector_line_outbounds_full, vector_line_outbounds, vector_not_matrix_full, vector_not_matrix, invalid_infix_op_full, invalid_infix_op, invalid_unary_op_full, invalid_unary_op, unknown_op, duplicate_function, duplicate_variable, main_parameters, symbol_not_found_full, symbol_not_found, array_dimension_not_int_full, array_dimension_not_int, array_dimension_not_positive_full, array_dimension_not_positive, incompatible_types_full, incompatible_types, incompatible_types_array_full, incompatible_types_array, invalid_case_type_full, invalid_case_type, function_no_return, invalid_array_literal_type_full, invalid_array_literal_type, invalid_array_literal_line_full, invalid_array_literal_line, invalid_array_literal_column_full, invalid_array_literal_column, default */
  1920. /***/ (function(module) {
  1921. module.exports = {"token_missing_one":"Erro de sintaxe: Espera-se $0, mas encontrou-se $1 na linha:$2, coluna:$3","token_missing_two":"Erro de sintaxe: Esperava-se $0 ou $1 mas encontrou-se $2 na liha:$3, coluna: $4","eos_missing":"Falta uma nova linha ou ; na linha: $0, coluna: $1","invalid_type":"$0 na linha: $1, coluna: $2 é um tipo inválido. Os tipos válidos são: $3","invalid_array_dimension":"A dimensão inválida na linha: $0, coluna: $1. Insira um $2 ou identificador válido do mesmo tipo.","invalid_array_size":"O tamnho do vetor/matriz excede o máximo de 2 na linha $0","extra_lines":"Nenhum texto é permitido após '}' em 'programa {...}'","invalid_main_return":"A função $0 deve retornar $1 na linha $2","invalid_var_declaration":"Erro na linha $0. Variáveis só podem ser declarados no corpo principal da função e de preferência nas primeiras linhas.","invalid_break_command":"Erro na linha $0. O comando $1 não pode ser usado fora de uma estrutura de repetição ou 'escolha...caso'","invalid_terminal":"Não é possível utilizar $0 na expressão da linha: $1, coluna: $2. Tente um valor númerico, variável ou chamada de função.","const_not_init":"Erro na linha: $0, coluna: $1. Uma variável declarada como const deve ser inicializada","id_missing":"Esperava-se um identificador, mas encontrou-se $0 na linha: $1, coluna: $2","invalid_id_format":"$0 na linha: $1, coluna: $2 não é um identificador válido. O símbolo '.' não é permitido neste contexto.","main_missing":"A função principal não foi encontrada","invalid_global_var":"Erro crítico: Chamada inválida da função initGlobal fora do contexto BASE","not_implemented":"Erro interno crítico: A função definida pelo sistema $0 não foi implementada.","function_missing":"A função $0 não foi encontrada","function_missing_full":"A função $0 na linha: $1, coluna: $2 não foi encontrada","invalid_parameters_size_full":"Erro na linha $0: a quantidade de parâmetros fornecidos à função $1 está incorreta. Esperava-se $2, encontrou-se $3.","invalid_parameters_size":"A quantidade de parâmetros fornecidos à função $0 está incorreta. Esperava-se $1, encontrou-se $2","invalid_ref_full":"A expressão $0 fornecida como parâmetro para a função $1 na linha $2 não é válida para esta função. Use uma variável ou posição de vetor.","invalid_ref":"A expressão $0 fornecida como parâmetro para a função $1 não é válida para esta função. Use uma variável ou posição de vetor.","invalid_parameter_type_full":"A expressão $0 fornecida como parâmetro para a função $1 na linha $2 não é compatível com o tipo esperado.","invalid_parameter_type":"A expressão $0 fornecida como parâmetro para a função $1 não é compatível com o tipo esperado.","unknown_command_full":"Erro interno crítico: comando desconhecido encontrado na linha $0","unknown_command":"Erro interno crítico: comando desconhecido encontrado!","loop_condition_type_full":"Erro na linha: $0, coluna $1: a condição dos laços de repetição deve ser do tipo lógico","loop_condition_type":"A condição dos laços de repetição deve ser do tipo lógico","endless_loop_full":"Possível laço infinito detectado no seu código. Verifique a linha $0","endless_loop":"Possível laço infinito detectado no seu código.","for_condition_type_full":"Erro na linha: $0, coluna $1: a condição de parada do comando para(...) deve ser do tipo lógico","for_condition_type":"A condição de parada do comando para(...) deve ser do tipo lógico","if_condition_type_full":"Erro na linha: $0, coluna $1: a condição de um comando se...senao deve ser do tipo lógico","if_condition_type":"A condição de um comando se...senao deve ser do tipo lógico","invalid_return_type_full":"Erro na linha $0: a expressão não produz um tipo compatível com a função $1. Tipo esperado: $2.","invalid_return_type":"A expressão não produz um tipo compatível com a função $0. Tipo esperado: $1.","invalid_void_return_full":"Erro na linha $0: a função $1 não pode retornar uma expressão vazia, use uma espressão do tipo $2","invalid_void_return":"A função $0 não pode retornar uma expressão vazia, use uma espressão do tipo $1","unexpected_break_command_full":"Erro interno crítico: comando pare encontrado fora do contexto de um laço/escolha..caso na linha $0","unexpected_break_command":"Erro interno crítico: comando pare encontrado fora do contexto de um laço/escolha..caso","invalid_dimension":"As dimensões de um vetor/matriz devem ser do tipo inteiro","void_in_expression_full":"Erro na linha: $0, coluna: $1: a função $2 não pode ser utilizada em uma expressão pois seu tipo de retorno é vazio","void_in_expression":"A função $0 não pode ser utilizada em uma expressão pois seu tipo de retorno é vazio","invalid_array_access_full":"Identificador $0 na linha: $1, coluna: $2 não se refere a um vetor/matriz válido","invalid_array_access":"Identificador $0 não se refere a um vetor/matriz válido","invalid_matrix_access_full":"Identificador $0 na linha: $1, coluna: $2 não se refere a uma matriz válida","invalid_matrix_access":"Identificador $0 não se refere a uma matriz válida","matrix_column_outbounds_full":"Erro na linha $0: número de colunas $1 é inválido para a matriz $2 que possui $3 colunas","matrix_column_outbounds":"Número de colunas $0 é inválido para a matriz $1 que possui $2 colunas","matrix_line_outbounds_full":"Erro na linha $0: número de linhas $1 é inválido para a matriz $2 que possui $3 linhas","matrix_line_outbounds":"Número de linhas $0 é inválido para a matriz $1 que possui $2 linhas","vector_line_outbounds_full":"Erro na linha $0: número de linhas $1 é inválido para a matriz $2 que possui $3 linhas","vector_line_outbounds":"Número de linhas $0 é inválido para a matriz $1 que possui $2 linhas","vector_not_matrix_full":"Erro na linha $0: $1 não é uma matriz","vector_not_matrix":"$1 não é uma matriz","invalid_infix_op_full":"Erro na linha $0: não é possível aplicar a operação $1 entre os tipos $2 e $3","invalid_infix_op":"Não é possível aplicar a operação $0 entre os tipos $1 e $2","invalid_unary_op_full":"Erro na linha $0: não é possível aplicar a operação $1 ao tipo $2","invalid_unary_op":"Não é possível aplicar a operação $0 ao tipo $1","unknown_op":"Erro interno crítico: Operação $0 desconhecida","duplicate_function":"A função $0 na linha: $1, coluna: $2 já foi definida anteriormente.","duplicate_variable":"A variável $0 na linha: $1, coluna: $2 já foi declarada anteriormente.","main_parameters":"A função inicio não pode ter parâmetros.","symbol_not_found_full":"A variável $0 na linha: $1, coluna: $2 não foi declarada","symbol_not_found":"A variável $0 não foi declarada","array_dimension_not_int_full":"As dimensões de um vetor/matriz na linha: $0 devem ser do tipo inteiro.","array_dimension_not_int":"As dimensões de um vetor/matriz devem ser do tipo inteiro.","array_dimension_not_positive_full":"As dimensões de um vetor/matriz na linha: $0 devem ser valores positivos.","array_dimension_not_positive":"As dimensões de um vetor/matriz devem ser valores positivos.","incompatible_types_full":"O tipo $0 não é compatível com o tipo resultante da expressão na linha $1","incompatible_types":"O tipo $0 não é compatível com o tipo resultante da expressão fornecida.","incompatible_types_array_full":"A expressão $0 é incompatível com o tipo $1 na linha: $2, coluna: $3.","incompatible_types_array":"A expressão $0 é incompatível com o tipo $1.","invalid_case_type_full":"O caso $0 na linha $1 é incompatível com o tipo $2.","invalid_case_type":"O caso $0 é incompatível com o tipo $1.","function_no_return":"A função $0 não possui um retorno acessível. Toda função deve ter ao menos um retorno no seu corpo principal.","invalid_array_literal_type_full":"Erro na linha $0: a expressão $1 não resulta em um tipo compatível.","invalid_array_literal_type":"A expressão $0 não resulta em um tipo compatível.","invalid_array_literal_line_full":"Erro na linha $0: esperava-se $1 linhas mas encontrou $2.","invalid_array_literal_line":"Esperava-se $0 linhas mas encontrou $1.","invalid_array_literal_column_full":"Erro na linha $0: esperava-se $1 colunas mas encontrou $2.","invalid_array_literal_column":"Esperava-se $0 colunas mas encontrou $1."};
  1922. /***/ }),
  1923. /***/ "./i18n/pt/index.js":
  1924. /*!**************************!*\
  1925. !*** ./i18n/pt/index.js ***!
  1926. \**************************/
  1927. /*! no static exports found */
  1928. /***/ (function(module, exports, __webpack_require__) {
  1929. "use strict";
  1930. Object.defineProperty(exports, "__esModule", {
  1931. value: true
  1932. });
  1933. var _error = __webpack_require__(/*! ./error.json */ "./i18n/pt/error.json");
  1934. var _error2 = _interopRequireDefault(_error);
  1935. var _message = __webpack_require__(/*! ./message.json */ "./i18n/pt/message.json");
  1936. var _message2 = _interopRequireDefault(_message);
  1937. var _ui = __webpack_require__(/*! ./ui.json */ "./i18n/pt/ui.json");
  1938. var _ui2 = _interopRequireDefault(_ui);
  1939. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  1940. exports.default = {
  1941. 'message': _message2.default,
  1942. 'error': _error2.default,
  1943. 'ui': _ui2.default
  1944. };
  1945. /***/ }),
  1946. /***/ "./i18n/pt/message.json":
  1947. /*!******************************!*\
  1948. !*** ./i18n/pt/message.json ***!
  1949. \******************************/
  1950. /*! exports provided: default */
  1951. /***/ (function(module) {
  1952. module.exports = {};
  1953. /***/ }),
  1954. /***/ "./i18n/pt/ui.json":
  1955. /*!*************************!*\
  1956. !*** ./i18n/pt/ui.json ***!
  1957. \*************************/
  1958. /*! exports provided: function, btn_clear, btn_function, btn_arithmetic_plus, btn_arithmetic_minus, btn_arithmetic_multiplication, btn_arithmetic_division, btn_arithmetic_module, btn_break, btn_case, start, void, integer, and, or, not, real, program, text, text_start, boolean, true, false, variable, command, new_parameter, new_variable, new_global, new_function, vector, text_comment_start, text_comment_main, text_read_var, text_write_var, text_command_read, text_command_write, text_return, text_btn_return, text_comment, join_or, matrix_string, vector_string, text_attribution, text_if, text_break, text_else, text_for, text_code_while, text_code_do, text_command_do, text_code_switch, text_code_case, text_logic_expression, text_arithmetic_expression, text_iftrue, text_repeatNtimes, text_receives, text_whiletrue, text_dowhiletrue, text_switch, text_functioncall, text_value, text_operator, text_parentheses, text_change, text_teacher_algorithm, text_teacher_algorithm_include, text_teacher_test_case, text_teacher_config, text_teacher_data_types, text_teacher_commands, text_teacher_functions, text_teacher_create_functions, text_teacher_create_movement_functions, text_teacher_test_case_input, text_teacher_test_case_output, text_teacher_test_case_actions, text_teacher_test_case_add, text_header_ivprog_functions, text_menu_functions_math, text_menu_functions_text, text_menu_functions_arrangement, text_menu_functions_conversion, text_none_variable, text_none_variable_instruction, tooltip_visual, tooltip_textual, tooltip_upload, tooltip_download, tooltip_undo, tooltip_redo, tooltip_run, tooltip_evaluate, tooltip_help, tooltip_add_global, tooltip_minimize, tooltip_console, var_menu_select_var, var_menu_select_all, var_menu_select_function, expression_menu_select, $sin, math, text_t, arrangement, conversion, $cos, $tan, $sqrt, $pow, $log, $abs, $negate, $invert, $max, $min, $substring, $length, $uppercase, $lowercase, $charAt, $numElements, $matrixLines, $matrixColumns, $isReal, $isInt, $isBool, $castReal, $castInt, $castBool, $castString, default */
  1959. /***/ (function(module) {
  1960. module.exports = {"function":"funcao","btn_clear":"Limpar","btn_function":"Função","btn_arithmetic_plus":"Adição","btn_arithmetic_minus":"Subtração","btn_arithmetic_multiplication":"Multiplicação","btn_arithmetic_division":"Divisão","btn_arithmetic_module":"Módulo","btn_break":"Pare","btn_case":"Caso","start":"inicio","void":"vazio","integer":"inteiro","and":"E","or":"OU","not":"nao","real":"real","program":"programa","text":"cadeia","text_start":"texto","boolean":"logico","true":"verdadeiro","false":"falso","variable":"Variável","command":"Comando","new_parameter":"novo_parametro","new_variable":"nova_variavel","new_global":"nova_global","new_function":"nova_funcao","vector":"vetor","text_comment_start":"Comentário inicial da função...","text_comment_main":"Esta é a função principal...","text_read_var":"Leitura de dados","text_write_var":"Escrita de dados","text_command_read":"leia","text_command_write":"escreva","text_return":"retorne","text_btn_return":"Retorno","text_comment":"Comentário","join_or":"ou","matrix_string":"matriz de $0","vector_string":"vetor de $0","text_attribution":"Atribuição","text_if":"se","text_break":"pare","text_else":"senao","text_for":"para","text_code_while":"enquanto","text_code_do":"faca","text_command_do":"faça","text_code_switch":"escolha","text_code_case":"caso","text_logic_expression":"Expressão Lógica","text_arithmetic_expression":"Expressão Aritmética","text_iftrue":"Se verdadeiro então","text_repeatNtimes":"Repita N vezes","text_receives":"recebe","text_whiletrue":"Enquanto verdadeiro","text_dowhiletrue":"Faça enquanto verdadeiro","text_switch":"Escolha","text_functioncall":"Chamada de função","text_value":"Valor","text_operator":"Operador","text_parentheses":"Parênteses","text_change":"Alterar","text_teacher_algorithm":"Algoritmo","text_teacher_algorithm_include":"Incluir o algoritmo abaixo no exercício","text_teacher_test_case":"Casos de teste","text_teacher_config":"Configurações","text_teacher_data_types":"Tipos de dados","text_teacher_commands":"Comandos","text_teacher_functions":"Funções","text_teacher_create_functions":"Criar novas funções","text_teacher_create_movement_functions":"Movimentar funções","text_teacher_test_case_input":"Entrada","text_teacher_test_case_output":"Saída","text_teacher_test_case_actions":"Ações","text_teacher_test_case_add":"Adicionar caso de teste","text_header_ivprog_functions":"Funções do iVProg","text_menu_functions_math":"Matemática","text_menu_functions_text":"Texto","text_menu_functions_arrangement":"Arranjo","text_menu_functions_conversion":"Conversão","text_none_variable":"Nenhuma variável declarada","text_none_variable_instruction":"Antes de utilizar uma variável, é necessário criá-la","tooltip_visual":"Programação visual","tooltip_textual":"Programação textual","tooltip_upload":"Upload de código fonte","tooltip_download":"Download do código fonte","tooltip_undo":"Desfazer","tooltip_redo":"Refazer","tooltip_run":"Executar o programa","tooltip_evaluate":"Avaliar o programa","tooltip_help":"Ajuda","tooltip_add_global":"Adicionar variável global","tooltip_minimize":"Ocultar os elementos da função","tooltip_console":"Abrir/fechar o terminal","var_menu_select_var":"Selecione uma variável","var_menu_select_all":"Selecione","var_menu_select_function":"Selecione uma função","expression_menu_select":"Selecione uma expressão","$sin":"seno","math":"Matematica","text_t":"Texto","arrangement":"Arranjo","conversion":"Conversao","$cos":"cosseno","$tan":"tangente","$sqrt":"raiz_quadrada","$pow":"potencia","$log":"logaritmo","$abs":"modulo","$negate":"trocar_sinal","$invert":"inverter_valor","$max":"maximo","$min":"minimo","$substring":"subcadeia","$length":"comprimento","$uppercase":"caixa_alta","$lowercase":"caixa_baixa","$charAt":"texto_na_posicao","$numElements":"total_de_elementos","$matrixLines":"total_de_linhas","$matrixColumns":"total_de_colunas","$isReal":"e_real","$isInt":"e_inteiro","$isBool":"e_logico","$castReal":"como_real","$castInt":"como_inteiro","$castBool":"como_logico","$castString":"como_cadeia"};
  1961. /***/ }),
  1962. /***/ "./js/Sortable.js":
  1963. /*!************************!*\
  1964. !*** ./js/Sortable.js ***!
  1965. \************************/
  1966. /*! no static exports found */
  1967. /***/ (function(module, exports, __webpack_require__) {
  1968. "use strict";
  1969. var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;
  1970. var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
  1971. /**!
  1972. * Sortable
  1973. * @author RubaXa <trash@rubaxa.org>
  1974. * @license MIT
  1975. */
  1976. (function sortableModule(factory) {
  1977. "use strict";
  1978. if (true) {
  1979. !(__WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
  1980. __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
  1981. (__WEBPACK_AMD_DEFINE_FACTORY__.call(exports, __webpack_require__, exports, module)) :
  1982. __WEBPACK_AMD_DEFINE_FACTORY__),
  1983. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  1984. } else {}
  1985. })(function sortableFactory() {
  1986. "use strict";
  1987. if (typeof window == "undefined" || !window.document) {
  1988. return function sortableError() {
  1989. throw new Error("Sortable.js requires a window with a document");
  1990. };
  1991. }
  1992. var dragEl,
  1993. parentEl,
  1994. ghostEl,
  1995. cloneEl,
  1996. rootEl,
  1997. nextEl,
  1998. lastDownEl,
  1999. scrollEl,
  2000. scrollParentEl,
  2001. scrollCustomFn,
  2002. lastEl,
  2003. lastCSS,
  2004. lastParentCSS,
  2005. oldIndex,
  2006. newIndex,
  2007. activeGroup,
  2008. putSortable,
  2009. autoScroll = {},
  2010. tapEvt,
  2011. touchEvt,
  2012. moved,
  2013. /** @const */
  2014. R_SPACE = /\s+/g,
  2015. R_FLOAT = /left|right|inline/,
  2016. expando = 'Sortable' + new Date().getTime(),
  2017. win = window,
  2018. document = win.document,
  2019. parseInt = win.parseInt,
  2020. $ = win.jQuery || win.Zepto,
  2021. Polymer = win.Polymer,
  2022. captureMode = false,
  2023. supportDraggable = !!('draggable' in document.createElement('div')),
  2024. supportCssPointerEvents = function (el) {
  2025. // false when IE11
  2026. if (!!navigator.userAgent.match(/Trident.*rv[ :]?11\./)) {
  2027. return false;
  2028. }
  2029. el = document.createElement('x');
  2030. el.style.cssText = 'pointer-events:auto';
  2031. return el.style.pointerEvents === 'auto';
  2032. }(),
  2033. _silent = false,
  2034. abs = Math.abs,
  2035. min = Math.min,
  2036. savedInputChecked = [],
  2037. touchDragOverListeners = [],
  2038. _autoScroll = _throttle(function ( /**Event*/evt, /**Object*/options, /**HTMLElement*/rootEl) {
  2039. // Bug: https://bugzilla.mozilla.org/show_bug.cgi?id=505521
  2040. if (rootEl && options.scroll) {
  2041. var _this = rootEl[expando],
  2042. el,
  2043. rect,
  2044. sens = options.scrollSensitivity,
  2045. speed = options.scrollSpeed,
  2046. x = evt.clientX,
  2047. y = evt.clientY,
  2048. winWidth = window.innerWidth,
  2049. winHeight = window.innerHeight,
  2050. vx,
  2051. vy,
  2052. scrollOffsetX,
  2053. scrollOffsetY;
  2054. // Delect scrollEl
  2055. if (scrollParentEl !== rootEl) {
  2056. scrollEl = options.scroll;
  2057. scrollParentEl = rootEl;
  2058. scrollCustomFn = options.scrollFn;
  2059. if (scrollEl === true) {
  2060. scrollEl = rootEl;
  2061. do {
  2062. if (scrollEl.offsetWidth < scrollEl.scrollWidth || scrollEl.offsetHeight < scrollEl.scrollHeight) {
  2063. break;
  2064. }
  2065. /* jshint boss:true */
  2066. } while (scrollEl = scrollEl.parentNode);
  2067. }
  2068. }
  2069. if (scrollEl) {
  2070. el = scrollEl;
  2071. rect = scrollEl.getBoundingClientRect();
  2072. vx = (abs(rect.right - x) <= sens) - (abs(rect.left - x) <= sens);
  2073. vy = (abs(rect.bottom - y) <= sens) - (abs(rect.top - y) <= sens);
  2074. }
  2075. if (!(vx || vy)) {
  2076. vx = (winWidth - x <= sens) - (x <= sens);
  2077. vy = (winHeight - y <= sens) - (y <= sens);
  2078. /* jshint expr:true */
  2079. (vx || vy) && (el = win);
  2080. }
  2081. if (autoScroll.vx !== vx || autoScroll.vy !== vy || autoScroll.el !== el) {
  2082. autoScroll.el = el;
  2083. autoScroll.vx = vx;
  2084. autoScroll.vy = vy;
  2085. clearInterval(autoScroll.pid);
  2086. if (el) {
  2087. autoScroll.pid = setInterval(function () {
  2088. scrollOffsetY = vy ? vy * speed : 0;
  2089. scrollOffsetX = vx ? vx * speed : 0;
  2090. if ('function' === typeof scrollCustomFn) {
  2091. return scrollCustomFn.call(_this, scrollOffsetX, scrollOffsetY, evt);
  2092. }
  2093. if (el === win) {
  2094. win.scrollTo(win.pageXOffset + scrollOffsetX, win.pageYOffset + scrollOffsetY);
  2095. } else {
  2096. el.scrollTop += scrollOffsetY;
  2097. el.scrollLeft += scrollOffsetX;
  2098. }
  2099. }, 24);
  2100. }
  2101. }
  2102. }
  2103. }, 30),
  2104. _prepareGroup = function _prepareGroup(options) {
  2105. function toFn(value, pull) {
  2106. if (value === void 0 || value === true) {
  2107. value = group.name;
  2108. }
  2109. if (typeof value === 'function') {
  2110. return value;
  2111. } else {
  2112. return function (to, from) {
  2113. var fromGroup = from.options.group.name;
  2114. return pull ? value : value && (value.join ? value.indexOf(fromGroup) > -1 : fromGroup == value);
  2115. };
  2116. }
  2117. }
  2118. var group = {};
  2119. var originalGroup = options.group;
  2120. if (!originalGroup || (typeof originalGroup === "undefined" ? "undefined" : _typeof(originalGroup)) != 'object') {
  2121. originalGroup = { name: originalGroup };
  2122. }
  2123. group.name = originalGroup.name;
  2124. group.checkPull = toFn(originalGroup.pull, true);
  2125. group.checkPut = toFn(originalGroup.put);
  2126. group.revertClone = originalGroup.revertClone;
  2127. options.group = group;
  2128. };
  2129. /**
  2130. * @class Sortable
  2131. * @param {HTMLElement} el
  2132. * @param {Object} [options]
  2133. */
  2134. function Sortable(el, options) {
  2135. if (!(el && el.nodeType && el.nodeType === 1)) {
  2136. throw 'Sortable: `el` must be HTMLElement, and not ' + {}.toString.call(el);
  2137. }
  2138. this.el = el; // root element
  2139. this.options = options = _extend({}, options);
  2140. // Export instance
  2141. el[expando] = this;
  2142. // Default options
  2143. var defaults = {
  2144. group: Math.random(),
  2145. sort: true,
  2146. disabled: false,
  2147. store: null,
  2148. handle: null,
  2149. scroll: true,
  2150. scrollSensitivity: 30,
  2151. scrollSpeed: 10,
  2152. draggable: /[uo]l/i.test(el.nodeName) ? 'li' : '>*',
  2153. ghostClass: 'sortable-ghost',
  2154. chosenClass: 'sortable-chosen',
  2155. dragClass: 'sortable-drag',
  2156. ignore: 'a, img',
  2157. filter: null,
  2158. preventOnFilter: true,
  2159. animation: 0,
  2160. setData: function setData(dataTransfer, dragEl) {
  2161. dataTransfer.setData('Text', dragEl.textContent);
  2162. },
  2163. dropBubble: false,
  2164. dragoverBubble: false,
  2165. dataIdAttr: 'data-id',
  2166. delay: 0,
  2167. forceFallback: false,
  2168. fallbackClass: 'sortable-fallback',
  2169. fallbackOnBody: false,
  2170. fallbackTolerance: 0,
  2171. fallbackOffset: { x: 0, y: 0 }
  2172. };
  2173. // Set default options
  2174. for (var name in defaults) {
  2175. !(name in options) && (options[name] = defaults[name]);
  2176. }
  2177. _prepareGroup(options);
  2178. // Bind all private methods
  2179. for (var fn in this) {
  2180. if (fn.charAt(0) === '_' && typeof this[fn] === 'function') {
  2181. this[fn] = this[fn].bind(this);
  2182. }
  2183. }
  2184. // Setup drag mode
  2185. this.nativeDraggable = options.forceFallback ? false : supportDraggable;
  2186. // Bind events
  2187. _on(el, 'mousedown', this._onTapStart);
  2188. _on(el, 'touchstart', this._onTapStart);
  2189. _on(el, 'pointerdown', this._onTapStart);
  2190. if (this.nativeDraggable) {
  2191. _on(el, 'dragover', this);
  2192. _on(el, 'dragenter', this);
  2193. }
  2194. touchDragOverListeners.push(this._onDragOver);
  2195. // Restore sorting
  2196. options.store && this.sort(options.store.get(this));
  2197. }
  2198. Sortable.prototype = /** @lends Sortable.prototype */{
  2199. constructor: Sortable,
  2200. _onTapStart: function _onTapStart( /** Event|TouchEvent */evt) {
  2201. var _this = this,
  2202. el = this.el,
  2203. options = this.options,
  2204. preventOnFilter = options.preventOnFilter,
  2205. type = evt.type,
  2206. touch = evt.touches && evt.touches[0],
  2207. target = (touch || evt).target,
  2208. originalTarget = evt.target.shadowRoot && evt.path && evt.path[0] || target,
  2209. filter = options.filter,
  2210. startIndex;
  2211. _saveInputCheckedState(el);
  2212. // Don't trigger start event when an element is been dragged, otherwise the evt.oldindex always wrong when set option.group.
  2213. if (dragEl) {
  2214. return;
  2215. }
  2216. if (/mousedown|pointerdown/.test(type) && evt.button !== 0 || options.disabled) {
  2217. return; // only left button or enabled
  2218. }
  2219. target = _closest(target, options.draggable, el);
  2220. if (!target) {
  2221. return;
  2222. }
  2223. if (lastDownEl === target) {
  2224. // Ignoring duplicate `down`
  2225. return;
  2226. }
  2227. // Get the index of the dragged element within its parent
  2228. startIndex = _index(target, options.draggable);
  2229. // Check filter
  2230. if (typeof filter === 'function') {
  2231. if (filter.call(this, evt, target, this)) {
  2232. _dispatchEvent(_this, originalTarget, 'filter', target, el, startIndex);
  2233. preventOnFilter && evt.preventDefault();
  2234. return; // cancel dnd
  2235. }
  2236. } else if (filter) {
  2237. filter = filter.split(',').some(function (criteria) {
  2238. criteria = _closest(originalTarget, criteria.trim(), el);
  2239. if (criteria) {
  2240. _dispatchEvent(_this, criteria, 'filter', target, el, startIndex);
  2241. return true;
  2242. }
  2243. });
  2244. if (filter) {
  2245. preventOnFilter && evt.preventDefault();
  2246. return; // cancel dnd
  2247. }
  2248. }
  2249. if (options.handle && !_closest(originalTarget, options.handle, el)) {
  2250. return;
  2251. }
  2252. // Prepare `dragstart`
  2253. this._prepareDragStart(evt, touch, target, startIndex);
  2254. },
  2255. _prepareDragStart: function _prepareDragStart( /** Event */evt, /** Touch */touch, /** HTMLElement */target, /** Number */startIndex) {
  2256. var _this = this,
  2257. el = _this.el,
  2258. options = _this.options,
  2259. ownerDocument = el.ownerDocument,
  2260. dragStartFn;
  2261. if (target && !dragEl && target.parentNode === el) {
  2262. tapEvt = evt;
  2263. rootEl = el;
  2264. dragEl = target;
  2265. parentEl = dragEl.parentNode;
  2266. nextEl = dragEl.nextSibling;
  2267. lastDownEl = target;
  2268. activeGroup = options.group;
  2269. oldIndex = startIndex;
  2270. this._lastX = (touch || evt).clientX;
  2271. this._lastY = (touch || evt).clientY;
  2272. dragEl.style['will-change'] = 'transform';
  2273. dragStartFn = function dragStartFn() {
  2274. // Delayed drag has been triggered
  2275. // we can re-enable the events: touchmove/mousemove
  2276. _this._disableDelayedDrag();
  2277. // Make the element draggable
  2278. dragEl.draggable = _this.nativeDraggable;
  2279. // Chosen item
  2280. _toggleClass(dragEl, options.chosenClass, true);
  2281. // Bind the events: dragstart/dragend
  2282. _this._triggerDragStart(evt, touch);
  2283. // Drag start event
  2284. _dispatchEvent(_this, rootEl, 'choose', dragEl, rootEl, oldIndex);
  2285. };
  2286. // Disable "draggable"
  2287. options.ignore.split(',').forEach(function (criteria) {
  2288. _find(dragEl, criteria.trim(), _disableDraggable);
  2289. });
  2290. _on(ownerDocument, 'mouseup', _this._onDrop);
  2291. _on(ownerDocument, 'touchend', _this._onDrop);
  2292. _on(ownerDocument, 'touchcancel', _this._onDrop);
  2293. _on(ownerDocument, 'pointercancel', _this._onDrop);
  2294. _on(ownerDocument, 'selectstart', _this);
  2295. if (options.delay) {
  2296. // If the user moves the pointer or let go the click or touch
  2297. // before the delay has been reached:
  2298. // disable the delayed drag
  2299. _on(ownerDocument, 'mouseup', _this._disableDelayedDrag);
  2300. _on(ownerDocument, 'touchend', _this._disableDelayedDrag);
  2301. _on(ownerDocument, 'touchcancel', _this._disableDelayedDrag);
  2302. _on(ownerDocument, 'mousemove', _this._disableDelayedDrag);
  2303. _on(ownerDocument, 'touchmove', _this._disableDelayedDrag);
  2304. _on(ownerDocument, 'pointermove', _this._disableDelayedDrag);
  2305. _this._dragStartTimer = setTimeout(dragStartFn, options.delay);
  2306. } else {
  2307. dragStartFn();
  2308. }
  2309. }
  2310. },
  2311. _disableDelayedDrag: function _disableDelayedDrag() {
  2312. var ownerDocument = this.el.ownerDocument;
  2313. clearTimeout(this._dragStartTimer);
  2314. _off(ownerDocument, 'mouseup', this._disableDelayedDrag);
  2315. _off(ownerDocument, 'touchend', this._disableDelayedDrag);
  2316. _off(ownerDocument, 'touchcancel', this._disableDelayedDrag);
  2317. _off(ownerDocument, 'mousemove', this._disableDelayedDrag);
  2318. _off(ownerDocument, 'touchmove', this._disableDelayedDrag);
  2319. _off(ownerDocument, 'pointermove', this._disableDelayedDrag);
  2320. },
  2321. _triggerDragStart: function _triggerDragStart( /** Event */evt, /** Touch */touch) {
  2322. touch = touch || (evt.pointerType == 'touch' ? evt : null);
  2323. if (touch) {
  2324. // Touch device support
  2325. tapEvt = {
  2326. target: dragEl,
  2327. clientX: touch.clientX,
  2328. clientY: touch.clientY
  2329. };
  2330. this._onDragStart(tapEvt, 'touch');
  2331. } else if (!this.nativeDraggable) {
  2332. this._onDragStart(tapEvt, true);
  2333. } else {
  2334. _on(dragEl, 'dragend', this);
  2335. _on(rootEl, 'dragstart', this._onDragStart);
  2336. }
  2337. try {
  2338. if (document.selection) {
  2339. // Timeout neccessary for IE9
  2340. setTimeout(function () {
  2341. document.selection.empty();
  2342. });
  2343. } else {
  2344. window.getSelection().removeAllRanges();
  2345. }
  2346. } catch (err) {}
  2347. },
  2348. _dragStarted: function _dragStarted() {
  2349. if (rootEl && dragEl) {
  2350. var options = this.options;
  2351. // Apply effect
  2352. _toggleClass(dragEl, options.ghostClass, true);
  2353. _toggleClass(dragEl, options.dragClass, false);
  2354. Sortable.active = this;
  2355. // Drag start event
  2356. _dispatchEvent(this, rootEl, 'start', dragEl, rootEl, oldIndex);
  2357. } else {
  2358. this._nulling();
  2359. }
  2360. },
  2361. _emulateDragOver: function _emulateDragOver() {
  2362. if (touchEvt) {
  2363. if (this._lastX === touchEvt.clientX && this._lastY === touchEvt.clientY) {
  2364. return;
  2365. }
  2366. this._lastX = touchEvt.clientX;
  2367. this._lastY = touchEvt.clientY;
  2368. if (!supportCssPointerEvents) {
  2369. _css(ghostEl, 'display', 'none');
  2370. }
  2371. var target = document.elementFromPoint(touchEvt.clientX, touchEvt.clientY),
  2372. parent = target,
  2373. i = touchDragOverListeners.length;
  2374. if (parent) {
  2375. do {
  2376. if (parent[expando]) {
  2377. while (i--) {
  2378. touchDragOverListeners[i]({
  2379. clientX: touchEvt.clientX,
  2380. clientY: touchEvt.clientY,
  2381. target: target,
  2382. rootEl: parent
  2383. });
  2384. }
  2385. break;
  2386. }
  2387. target = parent; // store last element
  2388. }
  2389. /* jshint boss:true */
  2390. while (parent = parent.parentNode);
  2391. }
  2392. if (!supportCssPointerEvents) {
  2393. _css(ghostEl, 'display', '');
  2394. }
  2395. }
  2396. },
  2397. _onTouchMove: function _onTouchMove( /**TouchEvent*/evt) {
  2398. if (tapEvt) {
  2399. var options = this.options,
  2400. fallbackTolerance = options.fallbackTolerance,
  2401. fallbackOffset = options.fallbackOffset,
  2402. touch = evt.touches ? evt.touches[0] : evt,
  2403. dx = touch.clientX - tapEvt.clientX + fallbackOffset.x,
  2404. dy = touch.clientY - tapEvt.clientY + fallbackOffset.y,
  2405. translate3d = evt.touches ? 'translate3d(' + dx + 'px,' + dy + 'px,0)' : 'translate(' + dx + 'px,' + dy + 'px)';
  2406. // only set the status to dragging, when we are actually dragging
  2407. if (!Sortable.active) {
  2408. if (fallbackTolerance && min(abs(touch.clientX - this._lastX), abs(touch.clientY - this._lastY)) < fallbackTolerance) {
  2409. return;
  2410. }
  2411. this._dragStarted();
  2412. }
  2413. // as well as creating the ghost element on the document body
  2414. this._appendGhost();
  2415. moved = true;
  2416. touchEvt = touch;
  2417. _css(ghostEl, 'webkitTransform', translate3d);
  2418. _css(ghostEl, 'mozTransform', translate3d);
  2419. _css(ghostEl, 'msTransform', translate3d);
  2420. _css(ghostEl, 'transform', translate3d);
  2421. evt.preventDefault();
  2422. }
  2423. },
  2424. _appendGhost: function _appendGhost() {
  2425. if (!ghostEl) {
  2426. var rect = dragEl.getBoundingClientRect(),
  2427. css = _css(dragEl),
  2428. options = this.options,
  2429. ghostRect;
  2430. ghostEl = dragEl.cloneNode(true);
  2431. _toggleClass(ghostEl, options.ghostClass, false);
  2432. _toggleClass(ghostEl, options.fallbackClass, true);
  2433. _toggleClass(ghostEl, options.dragClass, true);
  2434. _css(ghostEl, 'top', rect.top - parseInt(css.marginTop, 10));
  2435. _css(ghostEl, 'left', rect.left - parseInt(css.marginLeft, 10));
  2436. _css(ghostEl, 'width', rect.width);
  2437. _css(ghostEl, 'height', rect.height);
  2438. _css(ghostEl, 'opacity', '0.8');
  2439. _css(ghostEl, 'position', 'fixed');
  2440. _css(ghostEl, 'zIndex', '100000');
  2441. _css(ghostEl, 'pointerEvents', 'none');
  2442. options.fallbackOnBody && document.body.appendChild(ghostEl) || rootEl.appendChild(ghostEl);
  2443. // Fixing dimensions.
  2444. ghostRect = ghostEl.getBoundingClientRect();
  2445. _css(ghostEl, 'width', rect.width * 2 - ghostRect.width);
  2446. _css(ghostEl, 'height', rect.height * 2 - ghostRect.height);
  2447. }
  2448. },
  2449. _onDragStart: function _onDragStart( /**Event*/evt, /**boolean*/useFallback) {
  2450. var dataTransfer = evt.dataTransfer,
  2451. options = this.options;
  2452. this._offUpEvents();
  2453. if (activeGroup.checkPull(this, this, dragEl, evt)) {
  2454. cloneEl = _clone(dragEl);
  2455. cloneEl.draggable = false;
  2456. cloneEl.style['will-change'] = '';
  2457. _css(cloneEl, 'display', 'none');
  2458. _toggleClass(cloneEl, this.options.chosenClass, false);
  2459. rootEl.insertBefore(cloneEl, dragEl);
  2460. _dispatchEvent(this, rootEl, 'clone', dragEl);
  2461. }
  2462. _toggleClass(dragEl, options.dragClass, true);
  2463. if (useFallback) {
  2464. if (useFallback === 'touch') {
  2465. // Bind touch events
  2466. _on(document, 'touchmove', this._onTouchMove);
  2467. _on(document, 'touchend', this._onDrop);
  2468. _on(document, 'touchcancel', this._onDrop);
  2469. _on(document, 'pointermove', this._onTouchMove);
  2470. _on(document, 'pointerup', this._onDrop);
  2471. } else {
  2472. // Old brwoser
  2473. _on(document, 'mousemove', this._onTouchMove);
  2474. _on(document, 'mouseup', this._onDrop);
  2475. }
  2476. this._loopId = setInterval(this._emulateDragOver, 50);
  2477. } else {
  2478. if (dataTransfer) {
  2479. dataTransfer.effectAllowed = 'move';
  2480. options.setData && options.setData.call(this, dataTransfer, dragEl);
  2481. }
  2482. _on(document, 'drop', this);
  2483. setTimeout(this._dragStarted, 0);
  2484. }
  2485. },
  2486. _onDragOver: function _onDragOver( /**Event*/evt) {
  2487. var el = this.el,
  2488. target,
  2489. dragRect,
  2490. targetRect,
  2491. revert,
  2492. options = this.options,
  2493. group = options.group,
  2494. activeSortable = Sortable.active,
  2495. isOwner = activeGroup === group,
  2496. isMovingBetweenSortable = false,
  2497. canSort = options.sort;
  2498. if (evt.preventDefault !== void 0) {
  2499. evt.preventDefault();
  2500. !options.dragoverBubble && evt.stopPropagation();
  2501. }
  2502. if (dragEl.animated) {
  2503. return;
  2504. }
  2505. moved = true;
  2506. if (activeSortable && !options.disabled && (isOwner ? canSort || (revert = !rootEl.contains(dragEl)) // Reverting item into the original list
  2507. : putSortable === this || (activeSortable.lastPullMode = activeGroup.checkPull(this, activeSortable, dragEl, evt)) && group.checkPut(this, activeSortable, dragEl, evt)) && (evt.rootEl === void 0 || evt.rootEl === this.el) // touch fallback
  2508. ) {
  2509. // Smart auto-scrolling
  2510. _autoScroll(evt, options, this.el);
  2511. if (_silent) {
  2512. return;
  2513. }
  2514. target = _closest(evt.target, options.draggable, el);
  2515. dragRect = dragEl.getBoundingClientRect();
  2516. if (putSortable !== this) {
  2517. putSortable = this;
  2518. isMovingBetweenSortable = true;
  2519. }
  2520. if (revert) {
  2521. _cloneHide(activeSortable, true);
  2522. parentEl = rootEl; // actualization
  2523. if (cloneEl || nextEl) {
  2524. rootEl.insertBefore(dragEl, cloneEl || nextEl);
  2525. } else if (!canSort) {
  2526. rootEl.appendChild(dragEl);
  2527. }
  2528. return;
  2529. }
  2530. if (el.children.length === 0 || el.children[0] === ghostEl || el === evt.target && _ghostIsLast(el, evt)) {
  2531. //assign target only if condition is true
  2532. if (el.children.length !== 0 && el.children[0] !== ghostEl && el === evt.target) {
  2533. target = el.lastElementChild;
  2534. }
  2535. if (target) {
  2536. if (target.animated) {
  2537. return;
  2538. }
  2539. targetRect = target.getBoundingClientRect();
  2540. }
  2541. _cloneHide(activeSortable, isOwner);
  2542. if (_onMove(rootEl, el, dragEl, dragRect, target, targetRect, evt) !== false) {
  2543. if (!dragEl.contains(el)) {
  2544. el.appendChild(dragEl);
  2545. parentEl = el; // actualization
  2546. }
  2547. this._animate(dragRect, dragEl);
  2548. target && this._animate(targetRect, target);
  2549. }
  2550. } else if (target && !target.animated && target !== dragEl && target.parentNode[expando] !== void 0) {
  2551. if (lastEl !== target) {
  2552. lastEl = target;
  2553. lastCSS = _css(target);
  2554. lastParentCSS = _css(target.parentNode);
  2555. }
  2556. targetRect = target.getBoundingClientRect();
  2557. var width = targetRect.right - targetRect.left,
  2558. height = targetRect.bottom - targetRect.top,
  2559. floating = R_FLOAT.test(lastCSS.cssFloat + lastCSS.display) || lastParentCSS.display == 'flex' && lastParentCSS['flex-direction'].indexOf('row') === 0,
  2560. isWide = target.offsetWidth > dragEl.offsetWidth,
  2561. isLong = target.offsetHeight > dragEl.offsetHeight,
  2562. halfway = (floating ? (evt.clientX - targetRect.left) / width : (evt.clientY - targetRect.top) / height) > 0.5,
  2563. nextSibling = target.nextElementSibling,
  2564. after = false;
  2565. if (floating) {
  2566. var elTop = dragEl.offsetTop,
  2567. tgTop = target.offsetTop;
  2568. if (elTop === tgTop) {
  2569. after = target.previousElementSibling === dragEl && !isWide || halfway && isWide;
  2570. } else if (target.previousElementSibling === dragEl || dragEl.previousElementSibling === target) {
  2571. after = (evt.clientY - targetRect.top) / height > 0.5;
  2572. } else {
  2573. after = tgTop > elTop;
  2574. }
  2575. } else if (!isMovingBetweenSortable) {
  2576. after = nextSibling !== dragEl && !isLong || halfway && isLong;
  2577. }
  2578. var moveVector = _onMove(rootEl, el, dragEl, dragRect, target, targetRect, evt, after);
  2579. if (moveVector !== false) {
  2580. if (moveVector === 1 || moveVector === -1) {
  2581. after = moveVector === 1;
  2582. }
  2583. _silent = true;
  2584. setTimeout(_unsilent, 30);
  2585. _cloneHide(activeSortable, isOwner);
  2586. if (!dragEl.contains(el)) {
  2587. if (after && !nextSibling) {
  2588. el.appendChild(dragEl);
  2589. } else {
  2590. target.parentNode.insertBefore(dragEl, after ? nextSibling : target);
  2591. }
  2592. }
  2593. parentEl = dragEl.parentNode; // actualization
  2594. this._animate(dragRect, dragEl);
  2595. this._animate(targetRect, target);
  2596. }
  2597. }
  2598. }
  2599. },
  2600. _animate: function _animate(prevRect, target) {
  2601. var ms = this.options.animation;
  2602. if (ms) {
  2603. var currentRect = target.getBoundingClientRect();
  2604. if (prevRect.nodeType === 1) {
  2605. prevRect = prevRect.getBoundingClientRect();
  2606. }
  2607. _css(target, 'transition', 'none');
  2608. _css(target, 'transform', 'translate3d(' + (prevRect.left - currentRect.left) + 'px,' + (prevRect.top - currentRect.top) + 'px,0)');
  2609. target.offsetWidth; // repaint
  2610. _css(target, 'transition', 'all ' + ms + 'ms');
  2611. _css(target, 'transform', 'translate3d(0,0,0)');
  2612. clearTimeout(target.animated);
  2613. target.animated = setTimeout(function () {
  2614. _css(target, 'transition', '');
  2615. _css(target, 'transform', '');
  2616. target.animated = false;
  2617. }, ms);
  2618. }
  2619. },
  2620. _offUpEvents: function _offUpEvents() {
  2621. var ownerDocument = this.el.ownerDocument;
  2622. _off(document, 'touchmove', this._onTouchMove);
  2623. _off(document, 'pointermove', this._onTouchMove);
  2624. _off(ownerDocument, 'mouseup', this._onDrop);
  2625. _off(ownerDocument, 'touchend', this._onDrop);
  2626. _off(ownerDocument, 'pointerup', this._onDrop);
  2627. _off(ownerDocument, 'touchcancel', this._onDrop);
  2628. _off(ownerDocument, 'pointercancel', this._onDrop);
  2629. _off(ownerDocument, 'selectstart', this);
  2630. },
  2631. _onDrop: function _onDrop( /**Event*/evt) {
  2632. var el = this.el,
  2633. options = this.options;
  2634. clearInterval(this._loopId);
  2635. clearInterval(autoScroll.pid);
  2636. clearTimeout(this._dragStartTimer);
  2637. // Unbind events
  2638. _off(document, 'mousemove', this._onTouchMove);
  2639. if (this.nativeDraggable) {
  2640. _off(document, 'drop', this);
  2641. _off(el, 'dragstart', this._onDragStart);
  2642. }
  2643. this._offUpEvents();
  2644. if (evt) {
  2645. if (moved) {
  2646. evt.preventDefault();
  2647. !options.dropBubble && evt.stopPropagation();
  2648. }
  2649. ghostEl && ghostEl.parentNode && ghostEl.parentNode.removeChild(ghostEl);
  2650. if (rootEl === parentEl || Sortable.active.lastPullMode !== 'clone') {
  2651. // Remove clone
  2652. cloneEl && cloneEl.parentNode && cloneEl.parentNode.removeChild(cloneEl);
  2653. }
  2654. if (dragEl) {
  2655. if (this.nativeDraggable) {
  2656. _off(dragEl, 'dragend', this);
  2657. }
  2658. _disableDraggable(dragEl);
  2659. dragEl.style['will-change'] = '';
  2660. // Remove class's
  2661. _toggleClass(dragEl, this.options.ghostClass, false);
  2662. _toggleClass(dragEl, this.options.chosenClass, false);
  2663. // Drag stop event
  2664. _dispatchEvent(this, rootEl, 'unchoose', dragEl, rootEl, oldIndex);
  2665. if (rootEl !== parentEl) {
  2666. newIndex = _index(dragEl, options.draggable);
  2667. if (newIndex >= 0) {
  2668. // Add event
  2669. _dispatchEvent(null, parentEl, 'add', dragEl, rootEl, oldIndex, newIndex);
  2670. // Remove event
  2671. _dispatchEvent(this, rootEl, 'remove', dragEl, rootEl, oldIndex, newIndex);
  2672. // drag from one list and drop into another
  2673. _dispatchEvent(null, parentEl, 'sort', dragEl, rootEl, oldIndex, newIndex);
  2674. _dispatchEvent(this, rootEl, 'sort', dragEl, rootEl, oldIndex, newIndex);
  2675. }
  2676. } else {
  2677. if (dragEl.nextSibling !== nextEl) {
  2678. // Get the index of the dragged element within its parent
  2679. newIndex = _index(dragEl, options.draggable);
  2680. if (newIndex >= 0) {
  2681. // drag & drop within the same list
  2682. _dispatchEvent(this, rootEl, 'update', dragEl, rootEl, oldIndex, newIndex);
  2683. _dispatchEvent(this, rootEl, 'sort', dragEl, rootEl, oldIndex, newIndex);
  2684. }
  2685. }
  2686. }
  2687. if (Sortable.active) {
  2688. /* jshint eqnull:true */
  2689. if (newIndex == null || newIndex === -1) {
  2690. newIndex = oldIndex;
  2691. }
  2692. _dispatchEvent(this, rootEl, 'end', dragEl, rootEl, oldIndex, newIndex);
  2693. // Save sorting
  2694. this.save();
  2695. }
  2696. }
  2697. }
  2698. this._nulling();
  2699. },
  2700. _nulling: function _nulling() {
  2701. rootEl = dragEl = parentEl = ghostEl = nextEl = cloneEl = lastDownEl = scrollEl = scrollParentEl = tapEvt = touchEvt = moved = newIndex = lastEl = lastCSS = putSortable = activeGroup = Sortable.active = null;
  2702. savedInputChecked.forEach(function (el) {
  2703. el.checked = true;
  2704. });
  2705. savedInputChecked.length = 0;
  2706. },
  2707. handleEvent: function handleEvent( /**Event*/evt) {
  2708. switch (evt.type) {
  2709. case 'drop':
  2710. case 'dragend':
  2711. this._onDrop(evt);
  2712. break;
  2713. case 'dragover':
  2714. case 'dragenter':
  2715. if (dragEl) {
  2716. this._onDragOver(evt);
  2717. _globalDragOver(evt);
  2718. }
  2719. break;
  2720. case 'selectstart':
  2721. evt.preventDefault();
  2722. break;
  2723. }
  2724. },
  2725. /**
  2726. * Serializes the item into an array of string.
  2727. * @returns {String[]}
  2728. */
  2729. toArray: function toArray() {
  2730. var order = [],
  2731. el,
  2732. children = this.el.children,
  2733. i = 0,
  2734. n = children.length,
  2735. options = this.options;
  2736. for (; i < n; i++) {
  2737. el = children[i];
  2738. if (_closest(el, options.draggable, this.el)) {
  2739. order.push(el.getAttribute(options.dataIdAttr) || _generateId(el));
  2740. }
  2741. }
  2742. return order;
  2743. },
  2744. /**
  2745. * Sorts the elements according to the array.
  2746. * @param {String[]} order order of the items
  2747. */
  2748. sort: function sort(order) {
  2749. var items = {},
  2750. rootEl = this.el;
  2751. this.toArray().forEach(function (id, i) {
  2752. var el = rootEl.children[i];
  2753. if (_closest(el, this.options.draggable, rootEl)) {
  2754. items[id] = el;
  2755. }
  2756. }, this);
  2757. order.forEach(function (id) {
  2758. if (items[id]) {
  2759. rootEl.removeChild(items[id]);
  2760. rootEl.appendChild(items[id]);
  2761. }
  2762. });
  2763. },
  2764. /**
  2765. * Save the current sorting
  2766. */
  2767. save: function save() {
  2768. var store = this.options.store;
  2769. store && store.set(this);
  2770. },
  2771. /**
  2772. * For each element in the set, get the first element that matches the selector by testing the element itself and traversing up through its ancestors in the DOM tree.
  2773. * @param {HTMLElement} el
  2774. * @param {String} [selector] default: `options.draggable`
  2775. * @returns {HTMLElement|null}
  2776. */
  2777. closest: function closest(el, selector) {
  2778. return _closest(el, selector || this.options.draggable, this.el);
  2779. },
  2780. /**
  2781. * Set/get option
  2782. * @param {string} name
  2783. * @param {*} [value]
  2784. * @returns {*}
  2785. */
  2786. option: function option(name, value) {
  2787. var options = this.options;
  2788. if (value === void 0) {
  2789. return options[name];
  2790. } else {
  2791. options[name] = value;
  2792. if (name === 'group') {
  2793. _prepareGroup(options);
  2794. }
  2795. }
  2796. },
  2797. /**
  2798. * Destroy
  2799. */
  2800. destroy: function destroy() {
  2801. var el = this.el;
  2802. el[expando] = null;
  2803. _off(el, 'mousedown', this._onTapStart);
  2804. _off(el, 'touchstart', this._onTapStart);
  2805. _off(el, 'pointerdown', this._onTapStart);
  2806. if (this.nativeDraggable) {
  2807. _off(el, 'dragover', this);
  2808. _off(el, 'dragenter', this);
  2809. }
  2810. // Remove draggable attributes
  2811. Array.prototype.forEach.call(el.querySelectorAll('[draggable]'), function (el) {
  2812. el.removeAttribute('draggable');
  2813. });
  2814. touchDragOverListeners.splice(touchDragOverListeners.indexOf(this._onDragOver), 1);
  2815. this._onDrop();
  2816. this.el = el = null;
  2817. }
  2818. };
  2819. function _cloneHide(sortable, state) {
  2820. if (sortable.lastPullMode !== 'clone') {
  2821. state = true;
  2822. }
  2823. if (cloneEl && cloneEl.state !== state) {
  2824. _css(cloneEl, 'display', state ? 'none' : '');
  2825. if (!state) {
  2826. if (cloneEl.state) {
  2827. if (sortable.options.group.revertClone) {
  2828. rootEl.insertBefore(cloneEl, nextEl);
  2829. sortable._animate(dragEl, cloneEl);
  2830. } else {
  2831. rootEl.insertBefore(cloneEl, dragEl);
  2832. }
  2833. }
  2834. }
  2835. cloneEl.state = state;
  2836. }
  2837. }
  2838. function _closest( /**HTMLElement*/el, /**String*/selector, /**HTMLElement*/ctx) {
  2839. if (el) {
  2840. ctx = ctx || document;
  2841. do {
  2842. if (selector === '>*' && el.parentNode === ctx || _matches(el, selector)) {
  2843. return el;
  2844. }
  2845. /* jshint boss:true */
  2846. } while (el = _getParentOrHost(el));
  2847. }
  2848. return null;
  2849. }
  2850. function _getParentOrHost(el) {
  2851. var parent = el.host;
  2852. return parent && parent.nodeType ? parent : el.parentNode;
  2853. }
  2854. function _globalDragOver( /**Event*/evt) {
  2855. if (evt.dataTransfer) {
  2856. evt.dataTransfer.dropEffect = 'move';
  2857. }
  2858. evt.preventDefault();
  2859. }
  2860. function _on(el, event, fn) {
  2861. el.addEventListener(event, fn, captureMode);
  2862. }
  2863. function _off(el, event, fn) {
  2864. el.removeEventListener(event, fn, captureMode);
  2865. }
  2866. function _toggleClass(el, name, state) {
  2867. if (el) {
  2868. if (el.classList) {
  2869. el.classList[state ? 'add' : 'remove'](name);
  2870. } else {
  2871. var className = (' ' + el.className + ' ').replace(R_SPACE, ' ').replace(' ' + name + ' ', ' ');
  2872. el.className = (className + (state ? ' ' + name : '')).replace(R_SPACE, ' ');
  2873. }
  2874. }
  2875. }
  2876. function _css(el, prop, val) {
  2877. var style = el && el.style;
  2878. if (style) {
  2879. if (val === void 0) {
  2880. if (document.defaultView && document.defaultView.getComputedStyle) {
  2881. val = document.defaultView.getComputedStyle(el, '');
  2882. } else if (el.currentStyle) {
  2883. val = el.currentStyle;
  2884. }
  2885. return prop === void 0 ? val : val[prop];
  2886. } else {
  2887. if (!(prop in style)) {
  2888. prop = '-webkit-' + prop;
  2889. }
  2890. style[prop] = val + (typeof val === 'string' ? '' : 'px');
  2891. }
  2892. }
  2893. }
  2894. function _find(ctx, tagName, iterator) {
  2895. if (ctx) {
  2896. var list = ctx.getElementsByTagName(tagName),
  2897. i = 0,
  2898. n = list.length;
  2899. if (iterator) {
  2900. for (; i < n; i++) {
  2901. iterator(list[i], i);
  2902. }
  2903. }
  2904. return list;
  2905. }
  2906. return [];
  2907. }
  2908. function _dispatchEvent(sortable, rootEl, name, targetEl, fromEl, startIndex, newIndex) {
  2909. sortable = sortable || rootEl[expando];
  2910. var evt = document.createEvent('Event'),
  2911. options = sortable.options,
  2912. onName = 'on' + name.charAt(0).toUpperCase() + name.substr(1);
  2913. evt.initEvent(name, true, true);
  2914. evt.to = rootEl;
  2915. evt.from = fromEl || rootEl;
  2916. evt.item = targetEl || rootEl;
  2917. evt.clone = cloneEl;
  2918. evt.oldIndex = startIndex;
  2919. evt.newIndex = newIndex;
  2920. rootEl.dispatchEvent(evt);
  2921. if (options[onName]) {
  2922. options[onName].call(sortable, evt);
  2923. }
  2924. }
  2925. function _onMove(fromEl, toEl, dragEl, dragRect, targetEl, targetRect, originalEvt, willInsertAfter) {
  2926. var evt,
  2927. sortable = fromEl[expando],
  2928. onMoveFn = sortable.options.onMove,
  2929. retVal;
  2930. evt = document.createEvent('Event');
  2931. evt.initEvent('move', true, true);
  2932. evt.to = toEl;
  2933. evt.from = fromEl;
  2934. evt.dragged = dragEl;
  2935. evt.draggedRect = dragRect;
  2936. evt.related = targetEl || toEl;
  2937. evt.relatedRect = targetRect || toEl.getBoundingClientRect();
  2938. evt.willInsertAfter = willInsertAfter;
  2939. fromEl.dispatchEvent(evt);
  2940. if (onMoveFn) {
  2941. retVal = onMoveFn.call(sortable, evt, originalEvt);
  2942. }
  2943. return retVal;
  2944. }
  2945. function _disableDraggable(el) {
  2946. el.draggable = false;
  2947. }
  2948. function _unsilent() {
  2949. _silent = false;
  2950. }
  2951. /** @returns {HTMLElement|false} */
  2952. function _ghostIsLast(el, evt) {
  2953. var lastEl = el.lastElementChild,
  2954. rect = lastEl.getBoundingClientRect();
  2955. // 5 — min delta
  2956. // abs — нельзя добавлять, а то глюки при наведении сверху
  2957. return evt.clientY - (rect.top + rect.height) > 5 || evt.clientX - (rect.left + rect.width) > 5;
  2958. }
  2959. /**
  2960. * Generate id
  2961. * @param {HTMLElement} el
  2962. * @returns {String}
  2963. * @private
  2964. */
  2965. function _generateId(el) {
  2966. var str = el.tagName + el.className + el.src + el.href + el.textContent,
  2967. i = str.length,
  2968. sum = 0;
  2969. while (i--) {
  2970. sum += str.charCodeAt(i);
  2971. }
  2972. return sum.toString(36);
  2973. }
  2974. /**
  2975. * Returns the index of an element within its parent for a selected set of
  2976. * elements
  2977. * @param {HTMLElement} el
  2978. * @param {selector} selector
  2979. * @return {number}
  2980. */
  2981. function _index(el, selector) {
  2982. var index = 0;
  2983. if (!el || !el.parentNode) {
  2984. return -1;
  2985. }
  2986. while (el && (el = el.previousElementSibling)) {
  2987. if (el.nodeName.toUpperCase() !== 'TEMPLATE' && (selector === '>*' || _matches(el, selector))) {
  2988. index++;
  2989. }
  2990. }
  2991. return index;
  2992. }
  2993. function _matches( /**HTMLElement*/el, /**String*/selector) {
  2994. if (el) {
  2995. selector = selector.split('.');
  2996. var tag = selector.shift().toUpperCase(),
  2997. re = new RegExp('\\s(' + selector.join('|') + ')(?=\\s)', 'g');
  2998. return (tag === '' || el.nodeName.toUpperCase() == tag) && (!selector.length || ((' ' + el.className + ' ').match(re) || []).length == selector.length);
  2999. }
  3000. return false;
  3001. }
  3002. function _throttle(callback, ms) {
  3003. var args, _this;
  3004. return function () {
  3005. if (args === void 0) {
  3006. args = arguments;
  3007. _this = this;
  3008. setTimeout(function () {
  3009. if (args.length === 1) {
  3010. callback.call(_this, args[0]);
  3011. } else {
  3012. callback.apply(_this, args);
  3013. }
  3014. args = void 0;
  3015. }, ms);
  3016. }
  3017. };
  3018. }
  3019. function _extend(dst, src) {
  3020. if (dst && src) {
  3021. for (var key in src) {
  3022. if (src.hasOwnProperty(key)) {
  3023. dst[key] = src[key];
  3024. }
  3025. }
  3026. }
  3027. return dst;
  3028. }
  3029. function _clone(el) {
  3030. return $ ? $(el).clone(true)[0] : Polymer && Polymer.dom ? Polymer.dom(el).cloneNode(true) : el.cloneNode(true);
  3031. }
  3032. function _saveInputCheckedState(root) {
  3033. var inputs = root.getElementsByTagName('input');
  3034. var idx = inputs.length;
  3035. while (idx--) {
  3036. var el = inputs[idx];
  3037. el.checked && savedInputChecked.push(el);
  3038. }
  3039. }
  3040. // Fixed #973:
  3041. _on(document, 'touchmove', function (evt) {
  3042. if (Sortable.active) {
  3043. evt.preventDefault();
  3044. }
  3045. });
  3046. try {
  3047. window.addEventListener('test', null, Object.defineProperty({}, 'passive', {
  3048. get: function get() {
  3049. captureMode = {
  3050. capture: false,
  3051. passive: false
  3052. };
  3053. }
  3054. }));
  3055. } catch (err) {}
  3056. // Export utils
  3057. Sortable.utils = {
  3058. on: _on,
  3059. off: _off,
  3060. css: _css,
  3061. find: _find,
  3062. is: function is(el, selector) {
  3063. return !!_closest(el, selector, el);
  3064. },
  3065. extend: _extend,
  3066. throttle: _throttle,
  3067. closest: _closest,
  3068. toggleClass: _toggleClass,
  3069. clone: _clone,
  3070. index: _index
  3071. };
  3072. /**
  3073. * Create sortable instance
  3074. * @param {HTMLElement} el
  3075. * @param {Object} [options]
  3076. */
  3077. Sortable.create = function (el, options) {
  3078. return new Sortable(el, options);
  3079. };
  3080. // Export
  3081. Sortable.version = '1.6.1';
  3082. return Sortable;
  3083. });
  3084. /***/ }),
  3085. /***/ "./js/assessment/ivprogAssessment.js":
  3086. /*!*******************************************!*\
  3087. !*** ./js/assessment/ivprogAssessment.js ***!
  3088. \*******************************************/
  3089. /*! no static exports found */
  3090. /***/ (function(module, exports, __webpack_require__) {
  3091. "use strict";
  3092. Object.defineProperty(exports, "__esModule", {
  3093. value: true
  3094. });
  3095. exports.IVProgAssessment = undefined;
  3096. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  3097. var _ivprogParser = __webpack_require__(/*! ./../ast/ivprogParser */ "./js/ast/ivprogParser.js");
  3098. var _semanticAnalyser = __webpack_require__(/*! ./../processor/semantic/semanticAnalyser */ "./js/processor/semantic/semanticAnalyser.js");
  3099. var _ivprogProcessor = __webpack_require__(/*! ./../processor/ivprogProcessor */ "./js/processor/ivprogProcessor.js");
  3100. var _inputTest = __webpack_require__(/*! ./../util/inputTest */ "./js/util/inputTest.js");
  3101. var _outputTest = __webpack_require__(/*! ./../util/outputTest */ "./js/util/outputTest.js");
  3102. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3103. var IVProgAssessment = exports.IVProgAssessment = function () {
  3104. function IVProgAssessment(textCode, testCases, domConsole) {
  3105. _classCallCheck(this, IVProgAssessment);
  3106. this.textCode = textCode;
  3107. this.testCases = testCases;
  3108. this.domConsole = domConsole;
  3109. }
  3110. _createClass(IVProgAssessment, [{
  3111. key: "runTest",
  3112. value: function runTest() {
  3113. var _this = this;
  3114. try {
  3115. // try and show error messages through domconsole
  3116. var parser = _ivprogParser.IVProgParser.createParser(this.textCode);
  3117. var semantic = new _semanticAnalyser.SemanticAnalyser(parser.parseTree());
  3118. var validTree = semantic.analyseTree();
  3119. // loop test cases and show messages through domconsole
  3120. var partialTests = this.testCases.map(function (t, name) {
  3121. return _this.partialEvaluateTestCase(new _ivprogProcessor.IVProgProcessor(validTree), t.input, t.output, name);
  3122. });
  3123. var testResult = partialTests.reduce(function (acc, curr) {
  3124. return acc.then(function (v) {
  3125. return curr(v);
  3126. });
  3127. }, Promise.resolve(0));
  3128. return testResult.then(function (total) {
  3129. return Promise.resolve(total / _this.testCases.length);
  3130. }).catch(function (err) {
  3131. _this.domConsole.err("Erro durante a execução do programa"); // try and show error messages through domconsole
  3132. _this.domConsole.err(err.message);
  3133. return Promise.resolve(0);
  3134. });
  3135. } catch (error) {
  3136. this.domConsole.err("Erro durante a execução do programa"); // try and show error messages through domconsole
  3137. this.domConsole.err(error.message);
  3138. return Promise.resolve(0);
  3139. }
  3140. }
  3141. }, {
  3142. key: "evaluateTestCase",
  3143. value: function evaluateTestCase(prog, inputList, outputList, name, accumulator) {
  3144. var outerThis = this;
  3145. var input = new _inputTest.InputTest(inputList);
  3146. var output = new _outputTest.OutputTest();
  3147. prog.registerInput(input);
  3148. prog.registerOutput(output);
  3149. var startTime = Date.now();
  3150. return prog.interpretAST().then(function (_) {
  3151. var millis = Date.now() - startTime;
  3152. if (input.inputList.length !== input.index) {
  3153. outerThis.domConsole.err("Caso de teste " + (name + 1) + ": Falhou, ainda restam entradas!");
  3154. outerThis.domConsole.info("Levou " + millis + "ms");
  3155. return Promise.resolve(accumulator + 1 * (input.index / inputList.length));
  3156. } else if (output.list.length < outputList.length) {
  3157. outerThis.domConsole.err("Caso de teste " + (name + 1) + ": Falhou <" + inputList.join(", ") + ";" + outputList.join(", ") + ";" + output.list.join(", ") + ">");
  3158. outerThis.domConsole.info("Levou " + millis + "ms");
  3159. return Promise.resolve(accumulator + 1 * (output.list.length / outputList.length));
  3160. } else if (output.list.length > outputList.length) {
  3161. outerThis.domConsole.err("Caso de teste " + (name + 1) + ": Falhou <" + inputList.join(", ") + ";" + outputList.join(", ") + ";" + output.list.join(", ") + ">");
  3162. outerThis.domConsole.info("Levou " + millis + "ms");
  3163. return Promise.resolve(accumulator + 1 * (outputList.length / output.list.length));
  3164. } else {
  3165. var isOk = outerThis.checkOutput(output.list, outputList);
  3166. if (!isOk) {
  3167. outerThis.domConsole.err("Caso de teste " + (name + 1) + ": Falhou <" + inputList.join(", ") + ";" + outputList.join(", ") + ";" + output.list.join(", ") + ">");
  3168. outerThis.domConsole.info("Levou " + millis + "ms");
  3169. return Promise.resolve(accumulator);
  3170. } else {
  3171. outerThis.domConsole.info("Caso de teste " + (name + 1) + ": OK!");
  3172. outerThis.domConsole.info("Levou " + millis + "ms");
  3173. return Promise.resolve(accumulator + 1);
  3174. }
  3175. }
  3176. }).catch(function (_) {
  3177. return Promise.resolve(accumulator);
  3178. });
  3179. }
  3180. }, {
  3181. key: "partialEvaluateTestCase",
  3182. value: function partialEvaluateTestCase(prog, inputList, outputList, name) {
  3183. var _this2 = this;
  3184. var partial = function partial(accumulator) {
  3185. return _this2.evaluateTestCase(prog, inputList, outputList, name, accumulator);
  3186. };
  3187. partial = partial.bind(this);
  3188. return partial;
  3189. }
  3190. }, {
  3191. key: "checkOutput",
  3192. value: function checkOutput(aList, bList) {
  3193. for (var i = 0; i < aList.length; i++) {
  3194. var outValue = aList[i];
  3195. if (outValue != bList[i]) {
  3196. return false;
  3197. }
  3198. }
  3199. return true;
  3200. }
  3201. }]);
  3202. return IVProgAssessment;
  3203. }();
  3204. /***/ }),
  3205. /***/ "./js/ast/commands/arrayAssign.js":
  3206. /*!****************************************!*\
  3207. !*** ./js/ast/commands/arrayAssign.js ***!
  3208. \****************************************/
  3209. /*! no static exports found */
  3210. /***/ (function(module, exports, __webpack_require__) {
  3211. "use strict";
  3212. Object.defineProperty(exports, "__esModule", {
  3213. value: true
  3214. });
  3215. exports.ArrayIndexAssign = undefined;
  3216. var _assign = __webpack_require__(/*! ./assign */ "./js/ast/commands/assign.js");
  3217. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3218. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  3219. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  3220. var ArrayIndexAssign = exports.ArrayIndexAssign = function (_Assign) {
  3221. _inherits(ArrayIndexAssign, _Assign);
  3222. function ArrayIndexAssign(id, lineExpression, columnExpression, expression) {
  3223. _classCallCheck(this, ArrayIndexAssign);
  3224. var _this = _possibleConstructorReturn(this, (ArrayIndexAssign.__proto__ || Object.getPrototypeOf(ArrayIndexAssign)).call(this, id, expression));
  3225. _this.line = lineExpression;
  3226. _this.column = columnExpression;
  3227. return _this;
  3228. }
  3229. return ArrayIndexAssign;
  3230. }(_assign.Assign);
  3231. /***/ }),
  3232. /***/ "./js/ast/commands/arrayDeclaration.js":
  3233. /*!*********************************************!*\
  3234. !*** ./js/ast/commands/arrayDeclaration.js ***!
  3235. \*********************************************/
  3236. /*! no static exports found */
  3237. /***/ (function(module, exports, __webpack_require__) {
  3238. "use strict";
  3239. Object.defineProperty(exports, "__esModule", {
  3240. value: true
  3241. });
  3242. exports.ArrayDeclaration = undefined;
  3243. var _declaration = __webpack_require__(/*! ./declaration */ "./js/ast/commands/declaration.js");
  3244. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3245. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  3246. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  3247. var ArrayDeclaration = exports.ArrayDeclaration = function (_Declaration) {
  3248. _inherits(ArrayDeclaration, _Declaration);
  3249. function ArrayDeclaration(id, type, lines, columns, initial, isConst) {
  3250. _classCallCheck(this, ArrayDeclaration);
  3251. var _this = _possibleConstructorReturn(this, (ArrayDeclaration.__proto__ || Object.getPrototypeOf(ArrayDeclaration)).call(this, id, type, initial, isConst));
  3252. _this.lines = lines;
  3253. _this.columns = columns;
  3254. return _this;
  3255. }
  3256. return ArrayDeclaration;
  3257. }(_declaration.Declaration);
  3258. /***/ }),
  3259. /***/ "./js/ast/commands/assign.js":
  3260. /*!***********************************!*\
  3261. !*** ./js/ast/commands/assign.js ***!
  3262. \***********************************/
  3263. /*! no static exports found */
  3264. /***/ (function(module, exports, __webpack_require__) {
  3265. "use strict";
  3266. Object.defineProperty(exports, "__esModule", {
  3267. value: true
  3268. });
  3269. exports.Assign = undefined;
  3270. var _command = __webpack_require__(/*! ./command */ "./js/ast/commands/command.js");
  3271. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3272. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  3273. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  3274. var Assign = exports.Assign = function (_Command) {
  3275. _inherits(Assign, _Command);
  3276. function Assign(id, expression) {
  3277. _classCallCheck(this, Assign);
  3278. var _this = _possibleConstructorReturn(this, (Assign.__proto__ || Object.getPrototypeOf(Assign)).call(this));
  3279. _this.id = id;
  3280. _this.expression = expression;
  3281. return _this;
  3282. }
  3283. return Assign;
  3284. }(_command.Command);
  3285. /***/ }),
  3286. /***/ "./js/ast/commands/break.js":
  3287. /*!**********************************!*\
  3288. !*** ./js/ast/commands/break.js ***!
  3289. \**********************************/
  3290. /*! no static exports found */
  3291. /***/ (function(module, exports, __webpack_require__) {
  3292. "use strict";
  3293. Object.defineProperty(exports, "__esModule", {
  3294. value: true
  3295. });
  3296. exports.Break = undefined;
  3297. var _command = __webpack_require__(/*! ./command */ "./js/ast/commands/command.js");
  3298. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3299. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  3300. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  3301. var Break = exports.Break = function (_Command) {
  3302. _inherits(Break, _Command);
  3303. function Break() {
  3304. _classCallCheck(this, Break);
  3305. return _possibleConstructorReturn(this, (Break.__proto__ || Object.getPrototypeOf(Break)).call(this));
  3306. }
  3307. return Break;
  3308. }(_command.Command);
  3309. /***/ }),
  3310. /***/ "./js/ast/commands/case.js":
  3311. /*!*********************************!*\
  3312. !*** ./js/ast/commands/case.js ***!
  3313. \*********************************/
  3314. /*! no static exports found */
  3315. /***/ (function(module, exports, __webpack_require__) {
  3316. "use strict";
  3317. Object.defineProperty(exports, "__esModule", {
  3318. value: true
  3319. });
  3320. exports.Case = undefined;
  3321. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  3322. var _command = __webpack_require__(/*! ./command */ "./js/ast/commands/command.js");
  3323. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3324. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  3325. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  3326. var Case = exports.Case = function (_Command) {
  3327. _inherits(Case, _Command);
  3328. function Case(expression) {
  3329. _classCallCheck(this, Case);
  3330. var _this = _possibleConstructorReturn(this, (Case.__proto__ || Object.getPrototypeOf(Case)).call(this));
  3331. _this.expression = expression;
  3332. _this.commands = [];
  3333. return _this;
  3334. }
  3335. _createClass(Case, [{
  3336. key: 'setCommands',
  3337. value: function setCommands(commands) {
  3338. this.commands = commands;
  3339. }
  3340. }, {
  3341. key: 'isDefault',
  3342. get: function get() {
  3343. return this.expression === null;
  3344. }
  3345. }]);
  3346. return Case;
  3347. }(_command.Command);
  3348. /***/ }),
  3349. /***/ "./js/ast/commands/command.js":
  3350. /*!************************************!*\
  3351. !*** ./js/ast/commands/command.js ***!
  3352. \************************************/
  3353. /*! no static exports found */
  3354. /***/ (function(module, exports, __webpack_require__) {
  3355. "use strict";
  3356. Object.defineProperty(exports, "__esModule", {
  3357. value: true
  3358. });
  3359. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  3360. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3361. var Command = exports.Command = function () {
  3362. function Command() {
  3363. _classCallCheck(this, Command);
  3364. this._sourceInfo = null;
  3365. }
  3366. _createClass(Command, [{
  3367. key: "sourceInfo",
  3368. set: function set(sourceInfo) {
  3369. this._sourceInfo = sourceInfo;
  3370. },
  3371. get: function get() {
  3372. return this._sourceInfo;
  3373. }
  3374. }]);
  3375. return Command;
  3376. }();
  3377. /***/ }),
  3378. /***/ "./js/ast/commands/commandBlock.js":
  3379. /*!*****************************************!*\
  3380. !*** ./js/ast/commands/commandBlock.js ***!
  3381. \*****************************************/
  3382. /*! no static exports found */
  3383. /***/ (function(module, exports, __webpack_require__) {
  3384. "use strict";
  3385. Object.defineProperty(exports, "__esModule", {
  3386. value: true
  3387. });
  3388. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  3389. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3390. var CommandBlock = exports.CommandBlock = function () {
  3391. function CommandBlock(variables, commands) {
  3392. _classCallCheck(this, CommandBlock);
  3393. this.variables = variables;
  3394. this.commands = commands;
  3395. this._sourceInfo = null;
  3396. }
  3397. _createClass(CommandBlock, [{
  3398. key: "sourceInfo",
  3399. set: function set(sourceInfo) {
  3400. this._sourceInfo = sourceInfo;
  3401. },
  3402. get: function get() {
  3403. return this._sourceInfo;
  3404. }
  3405. }]);
  3406. return CommandBlock;
  3407. }();
  3408. /***/ }),
  3409. /***/ "./js/ast/commands/declaration.js":
  3410. /*!****************************************!*\
  3411. !*** ./js/ast/commands/declaration.js ***!
  3412. \****************************************/
  3413. /*! no static exports found */
  3414. /***/ (function(module, exports, __webpack_require__) {
  3415. "use strict";
  3416. Object.defineProperty(exports, "__esModule", {
  3417. value: true
  3418. });
  3419. exports.Declaration = undefined;
  3420. var _command = __webpack_require__(/*! ./command */ "./js/ast/commands/command.js");
  3421. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3422. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  3423. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  3424. var Declaration = exports.Declaration = function (_Command) {
  3425. _inherits(Declaration, _Command);
  3426. function Declaration(id, type, initial, isConst) {
  3427. _classCallCheck(this, Declaration);
  3428. var _this = _possibleConstructorReturn(this, (Declaration.__proto__ || Object.getPrototypeOf(Declaration)).call(this));
  3429. _this.id = id;
  3430. _this.type = type;
  3431. _this.initial = initial;
  3432. _this.isConst = isConst;
  3433. return _this;
  3434. }
  3435. return Declaration;
  3436. }(_command.Command);
  3437. /***/ }),
  3438. /***/ "./js/ast/commands/doWhile.js":
  3439. /*!************************************!*\
  3440. !*** ./js/ast/commands/doWhile.js ***!
  3441. \************************************/
  3442. /*! no static exports found */
  3443. /***/ (function(module, exports, __webpack_require__) {
  3444. "use strict";
  3445. Object.defineProperty(exports, "__esModule", {
  3446. value: true
  3447. });
  3448. exports.DoWhile = undefined;
  3449. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  3450. var _while = __webpack_require__(/*! ./while */ "./js/ast/commands/while.js");
  3451. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3452. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  3453. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  3454. var DoWhile = exports.DoWhile = function (_While) {
  3455. _inherits(DoWhile, _While);
  3456. function DoWhile(condition, commandBlock) {
  3457. _classCallCheck(this, DoWhile);
  3458. return _possibleConstructorReturn(this, (DoWhile.__proto__ || Object.getPrototypeOf(DoWhile)).call(this, condition, commandBlock));
  3459. }
  3460. _createClass(DoWhile, [{
  3461. key: 'testFirst',
  3462. get: function get() {
  3463. return false;
  3464. }
  3465. }]);
  3466. return DoWhile;
  3467. }(_while.While);
  3468. /***/ }),
  3469. /***/ "./js/ast/commands/for.js":
  3470. /*!********************************!*\
  3471. !*** ./js/ast/commands/for.js ***!
  3472. \********************************/
  3473. /*! no static exports found */
  3474. /***/ (function(module, exports, __webpack_require__) {
  3475. "use strict";
  3476. Object.defineProperty(exports, "__esModule", {
  3477. value: true
  3478. });
  3479. exports.For = undefined;
  3480. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  3481. var _command = __webpack_require__(/*! ./command */ "./js/ast/commands/command.js");
  3482. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3483. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  3484. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  3485. var For = exports.For = function (_Command) {
  3486. _inherits(For, _Command);
  3487. function For(assignment, condition, increment, commandBlock) {
  3488. _classCallCheck(this, For);
  3489. var _this = _possibleConstructorReturn(this, (For.__proto__ || Object.getPrototypeOf(For)).call(this));
  3490. _this.assignment = assignment;
  3491. _this.condition = condition;
  3492. _this.increment = increment;
  3493. _this.commandBlock = commandBlock;
  3494. return _this;
  3495. }
  3496. _createClass(For, [{
  3497. key: 'commands',
  3498. get: function get() {
  3499. return this.commandBlock.commands;
  3500. }
  3501. }]);
  3502. return For;
  3503. }(_command.Command);
  3504. /***/ }),
  3505. /***/ "./js/ast/commands/formalParameter.js":
  3506. /*!********************************************!*\
  3507. !*** ./js/ast/commands/formalParameter.js ***!
  3508. \********************************************/
  3509. /*! no static exports found */
  3510. /***/ (function(module, exports, __webpack_require__) {
  3511. "use strict";
  3512. Object.defineProperty(exports, "__esModule", {
  3513. value: true
  3514. });
  3515. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  3516. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3517. var FormalParameter = exports.FormalParameter = function () {
  3518. function FormalParameter(type, id) {
  3519. var byRef = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  3520. _classCallCheck(this, FormalParameter);
  3521. this.type = type;
  3522. this.id = id;
  3523. this.byRef = byRef;
  3524. this._sourceInfo = null;
  3525. }
  3526. _createClass(FormalParameter, [{
  3527. key: "sourceInfo",
  3528. set: function set(sourceInfo) {
  3529. this._sourceInfo = sourceInfo;
  3530. },
  3531. get: function get() {
  3532. return this._sourceInfo;
  3533. }
  3534. }]);
  3535. return FormalParameter;
  3536. }();
  3537. /***/ }),
  3538. /***/ "./js/ast/commands/function.js":
  3539. /*!*************************************!*\
  3540. !*** ./js/ast/commands/function.js ***!
  3541. \*************************************/
  3542. /*! no static exports found */
  3543. /***/ (function(module, exports, __webpack_require__) {
  3544. "use strict";
  3545. Object.defineProperty(exports, "__esModule", {
  3546. value: true
  3547. });
  3548. exports.Function = undefined;
  3549. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  3550. var _types = __webpack_require__(/*! ./../../typeSystem/types */ "./js/typeSystem/types.js");
  3551. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3552. var Function = exports.Function = function () {
  3553. function Function(name, returnType, formalParameters, commandBlock) {
  3554. _classCallCheck(this, Function);
  3555. this.name = name;
  3556. this.returnType = returnType;
  3557. this.formalParameters = formalParameters;
  3558. this.commandBlock = commandBlock;
  3559. this._sourceInfo = null;
  3560. }
  3561. _createClass(Function, [{
  3562. key: 'isMain',
  3563. get: function get() {
  3564. return this.name === null && this.returnType.isCompatible(_types.Types.VOID);
  3565. }
  3566. }, {
  3567. key: 'commands',
  3568. get: function get() {
  3569. return this.commandBlock.commands;
  3570. }
  3571. }, {
  3572. key: 'variablesDeclarations',
  3573. get: function get() {
  3574. return this.commandBlock.variables;
  3575. }
  3576. }, {
  3577. key: 'sourceInfo',
  3578. set: function set(sourceInfo) {
  3579. this._sourceInfo = sourceInfo;
  3580. },
  3581. get: function get() {
  3582. return this._sourceInfo;
  3583. }
  3584. }]);
  3585. return Function;
  3586. }();
  3587. /***/ }),
  3588. /***/ "./js/ast/commands/ifThenElse.js":
  3589. /*!***************************************!*\
  3590. !*** ./js/ast/commands/ifThenElse.js ***!
  3591. \***************************************/
  3592. /*! no static exports found */
  3593. /***/ (function(module, exports, __webpack_require__) {
  3594. "use strict";
  3595. Object.defineProperty(exports, "__esModule", {
  3596. value: true
  3597. });
  3598. exports.IfThenElse = undefined;
  3599. var _command = __webpack_require__(/*! ./command */ "./js/ast/commands/command.js");
  3600. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3601. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  3602. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  3603. var IfThenElse = exports.IfThenElse = function (_Command) {
  3604. _inherits(IfThenElse, _Command);
  3605. function IfThenElse(condition, ifTrue, ifFalse) {
  3606. _classCallCheck(this, IfThenElse);
  3607. var _this = _possibleConstructorReturn(this, (IfThenElse.__proto__ || Object.getPrototypeOf(IfThenElse)).call(this));
  3608. _this.condition = condition;
  3609. _this.ifTrue = ifTrue;
  3610. _this.ifFalse = ifFalse;
  3611. return _this;
  3612. }
  3613. return IfThenElse;
  3614. }(_command.Command);
  3615. /***/ }),
  3616. /***/ "./js/ast/commands/index.js":
  3617. /*!**********************************!*\
  3618. !*** ./js/ast/commands/index.js ***!
  3619. \**********************************/
  3620. /*! no static exports found */
  3621. /***/ (function(module, exports, __webpack_require__) {
  3622. "use strict";
  3623. Object.defineProperty(exports, "__esModule", {
  3624. value: true
  3625. });
  3626. exports.FunctionCall = exports.FormalParameter = exports.SysCall = exports.Case = exports.Switch = exports.DoWhile = exports.CommandBlock = exports.IfThenElse = exports.Function = exports.For = exports.While = exports.ArrayDeclaration = exports.Declaration = exports.ArrayIndexAssign = exports.Assign = exports.Return = exports.Break = undefined;
  3627. var _break = __webpack_require__(/*! ./break */ "./js/ast/commands/break.js");
  3628. var _return = __webpack_require__(/*! ./return */ "./js/ast/commands/return.js");
  3629. var _assign = __webpack_require__(/*! ./assign */ "./js/ast/commands/assign.js");
  3630. var _arrayAssign = __webpack_require__(/*! ./arrayAssign */ "./js/ast/commands/arrayAssign.js");
  3631. var _declaration = __webpack_require__(/*! ./declaration */ "./js/ast/commands/declaration.js");
  3632. var _arrayDeclaration = __webpack_require__(/*! ./arrayDeclaration */ "./js/ast/commands/arrayDeclaration.js");
  3633. var _while = __webpack_require__(/*! ./while */ "./js/ast/commands/while.js");
  3634. var _for = __webpack_require__(/*! ./for */ "./js/ast/commands/for.js");
  3635. var _function = __webpack_require__(/*! ./function */ "./js/ast/commands/function.js");
  3636. var _ifThenElse = __webpack_require__(/*! ./ifThenElse */ "./js/ast/commands/ifThenElse.js");
  3637. var _commandBlock = __webpack_require__(/*! ./commandBlock */ "./js/ast/commands/commandBlock.js");
  3638. var _doWhile = __webpack_require__(/*! ./doWhile */ "./js/ast/commands/doWhile.js");
  3639. var _switch = __webpack_require__(/*! ./switch */ "./js/ast/commands/switch.js");
  3640. var _case = __webpack_require__(/*! ./case */ "./js/ast/commands/case.js");
  3641. var _sysCall = __webpack_require__(/*! ./sysCall */ "./js/ast/commands/sysCall.js");
  3642. var _formalParameter = __webpack_require__(/*! ./formalParameter */ "./js/ast/commands/formalParameter.js");
  3643. var _functionCall = __webpack_require__(/*! ./../expressions/functionCall */ "./js/ast/expressions/functionCall.js");
  3644. //Proxy to expression since they do exatcly the same thing
  3645. exports.Break = _break.Break;
  3646. exports.Return = _return.Return;
  3647. exports.Assign = _assign.Assign;
  3648. exports.ArrayIndexAssign = _arrayAssign.ArrayIndexAssign;
  3649. exports.Declaration = _declaration.Declaration;
  3650. exports.ArrayDeclaration = _arrayDeclaration.ArrayDeclaration;
  3651. exports.While = _while.While;
  3652. exports.For = _for.For;
  3653. exports.Function = _function.Function;
  3654. exports.IfThenElse = _ifThenElse.IfThenElse;
  3655. exports.CommandBlock = _commandBlock.CommandBlock;
  3656. exports.DoWhile = _doWhile.DoWhile;
  3657. exports.Switch = _switch.Switch;
  3658. exports.Case = _case.Case;
  3659. exports.SysCall = _sysCall.SysCall;
  3660. exports.FormalParameter = _formalParameter.FormalParameter;
  3661. exports.FunctionCall = _functionCall.FunctionCall;
  3662. /***/ }),
  3663. /***/ "./js/ast/commands/return.js":
  3664. /*!***********************************!*\
  3665. !*** ./js/ast/commands/return.js ***!
  3666. \***********************************/
  3667. /*! no static exports found */
  3668. /***/ (function(module, exports, __webpack_require__) {
  3669. "use strict";
  3670. Object.defineProperty(exports, "__esModule", {
  3671. value: true
  3672. });
  3673. exports.Return = undefined;
  3674. var _command = __webpack_require__(/*! ./command */ "./js/ast/commands/command.js");
  3675. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3676. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  3677. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  3678. var Return = exports.Return = function (_Command) {
  3679. _inherits(Return, _Command);
  3680. function Return(expression) {
  3681. _classCallCheck(this, Return);
  3682. var _this = _possibleConstructorReturn(this, (Return.__proto__ || Object.getPrototypeOf(Return)).call(this));
  3683. _this.expression = expression;
  3684. return _this;
  3685. }
  3686. return Return;
  3687. }(_command.Command);
  3688. /***/ }),
  3689. /***/ "./js/ast/commands/switch.js":
  3690. /*!***********************************!*\
  3691. !*** ./js/ast/commands/switch.js ***!
  3692. \***********************************/
  3693. /*! no static exports found */
  3694. /***/ (function(module, exports, __webpack_require__) {
  3695. "use strict";
  3696. Object.defineProperty(exports, "__esModule", {
  3697. value: true
  3698. });
  3699. exports.Switch = undefined;
  3700. var _command = __webpack_require__(/*! ./command */ "./js/ast/commands/command.js");
  3701. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3702. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  3703. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  3704. var Switch = exports.Switch = function (_Command) {
  3705. _inherits(Switch, _Command);
  3706. function Switch(expression, cases) {
  3707. _classCallCheck(this, Switch);
  3708. var _this = _possibleConstructorReturn(this, (Switch.__proto__ || Object.getPrototypeOf(Switch)).call(this));
  3709. _this.expression = expression;
  3710. _this.cases = cases;
  3711. return _this;
  3712. }
  3713. return Switch;
  3714. }(_command.Command);
  3715. /***/ }),
  3716. /***/ "./js/ast/commands/sysCall.js":
  3717. /*!************************************!*\
  3718. !*** ./js/ast/commands/sysCall.js ***!
  3719. \************************************/
  3720. /*! no static exports found */
  3721. /***/ (function(module, exports, __webpack_require__) {
  3722. "use strict";
  3723. Object.defineProperty(exports, "__esModule", {
  3724. value: true
  3725. });
  3726. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3727. /**
  3728. * This class represents all the language defined functions.
  3729. * The language processor uses the id provided here to properly execute the desired function.
  3730. * The function is actually implemented inside the language processor.
  3731. * All the functions can be found at: js/processor/definedFunctions.js
  3732. */
  3733. var SysCall = exports.SysCall = function SysCall(langFunc) {
  3734. _classCallCheck(this, SysCall);
  3735. this.langFunc = langFunc;
  3736. };
  3737. /***/ }),
  3738. /***/ "./js/ast/commands/while.js":
  3739. /*!**********************************!*\
  3740. !*** ./js/ast/commands/while.js ***!
  3741. \**********************************/
  3742. /*! no static exports found */
  3743. /***/ (function(module, exports, __webpack_require__) {
  3744. "use strict";
  3745. Object.defineProperty(exports, "__esModule", {
  3746. value: true
  3747. });
  3748. exports.While = undefined;
  3749. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  3750. var _command = __webpack_require__(/*! ./command */ "./js/ast/commands/command.js");
  3751. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3752. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  3753. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  3754. var While = exports.While = function (_Command) {
  3755. _inherits(While, _Command);
  3756. function While(expression, commandBlock) {
  3757. _classCallCheck(this, While);
  3758. var _this = _possibleConstructorReturn(this, (While.__proto__ || Object.getPrototypeOf(While)).call(this));
  3759. _this.expression = expression;
  3760. _this.commandBlock = commandBlock;
  3761. return _this;
  3762. }
  3763. _createClass(While, [{
  3764. key: 'commands',
  3765. get: function get() {
  3766. return this.commandBlock.commands;
  3767. }
  3768. }, {
  3769. key: 'testFirst',
  3770. get: function get() {
  3771. return true;
  3772. }
  3773. }]);
  3774. return While;
  3775. }(_command.Command);
  3776. /***/ }),
  3777. /***/ "./js/ast/error/syntaxError.js":
  3778. /*!*************************************!*\
  3779. !*** ./js/ast/error/syntaxError.js ***!
  3780. \*************************************/
  3781. /*! no static exports found */
  3782. /***/ (function(module, exports, __webpack_require__) {
  3783. "use strict";
  3784. Object.defineProperty(exports, "__esModule", {
  3785. value: true
  3786. });
  3787. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3788. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  3789. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  3790. var SyntaxError = exports.SyntaxError = function (_Error) {
  3791. _inherits(SyntaxError, _Error);
  3792. function SyntaxError() {
  3793. var _ref;
  3794. _classCallCheck(this, SyntaxError);
  3795. for (var _len = arguments.length, msg = Array(_len), _key = 0; _key < _len; _key++) {
  3796. msg[_key] = arguments[_key];
  3797. }
  3798. var _this = _possibleConstructorReturn(this, (_ref = SyntaxError.__proto__ || Object.getPrototypeOf(SyntaxError)).call.apply(_ref, [this].concat(msg)));
  3799. if (Error.captureStackTrace) Error.captureStackTrace(_this, SyntaxError);
  3800. return _this;
  3801. }
  3802. return SyntaxError;
  3803. }(Error);
  3804. /***/ }),
  3805. /***/ "./js/ast/error/syntaxErrorFactory.js":
  3806. /*!********************************************!*\
  3807. !*** ./js/ast/error/syntaxErrorFactory.js ***!
  3808. \********************************************/
  3809. /*! no static exports found */
  3810. /***/ (function(module, exports, __webpack_require__) {
  3811. "use strict";
  3812. Object.defineProperty(exports, "__esModule", {
  3813. value: true
  3814. });
  3815. exports.SyntaxErrorFactory = undefined;
  3816. var _localizedStringsService = __webpack_require__(/*! ./../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  3817. var _syntaxError = __webpack_require__(/*! ./syntaxError */ "./js/ast/error/syntaxError.js");
  3818. var SyntaxErrorFactory = exports.SyntaxErrorFactory = Object.freeze({
  3819. extra_lines: function extra_lines() {
  3820. return new _syntaxError.SyntaxError(_localizedStringsService.LocalizedStrings.getError("extra_lines"));
  3821. },
  3822. token_missing_one: function token_missing_one(expected, token) {
  3823. var context = [expected, token.text, token.line, token.column];
  3824. return new _syntaxError.SyntaxError(_localizedStringsService.LocalizedStrings.getError("token_missing_one", context));
  3825. },
  3826. token_missing_list: function token_missing_list(expectedList, token) {
  3827. var line = expectedList.join(_localizedStringsService.LocalizedStrings.getOR());
  3828. return SyntaxErrorFactory.token_missing_one(line, token);
  3829. },
  3830. id_missing: function id_missing(token) {
  3831. var context = [token.text, token.line, token.column];
  3832. return new _syntaxError.SyntaxError(_localizedStringsService.LocalizedStrings.getError("id_missing", context));
  3833. },
  3834. eos_missing: function eos_missing(token) {
  3835. var context = [token.line, token.column];
  3836. return new _syntaxError.SyntaxError(_localizedStringsService.LocalizedStrings.getError("eos_missing", context));
  3837. },
  3838. invalid_array_dimension: function invalid_array_dimension(typeName, token) {
  3839. var context = [token.line, token.column, typeName];
  3840. return new _syntaxError.SyntaxError(_localizedStringsService.LocalizedStrings.getError("invalid_array_dimension", context));
  3841. },
  3842. invalid_array_size: function invalid_array_size(token) {
  3843. var context = [token.line];
  3844. return new _syntaxError.SyntaxError(_localizedStringsService.LocalizedStrings.getError("invalid_array_size", context));
  3845. },
  3846. invalid_main_return: function invalid_main_return(name, typeName, token) {
  3847. var context = [name, typeName, token.line];
  3848. return new _syntaxError.SyntaxError(_localizedStringsService.LocalizedStrings.getError("invalid_main_return", context));
  3849. },
  3850. invalid_var_declaration: function invalid_var_declaration(token) {
  3851. var context = [token.line];
  3852. return new _syntaxError.SyntaxError(_localizedStringsService.LocalizedStrings.getError("invalid_var_declaration", context));
  3853. },
  3854. invalid_break_command: function invalid_break_command(cmdName, token) {
  3855. var context = [token.line, cmdName];
  3856. return new _syntaxError.SyntaxError(_localizedStringsService.LocalizedStrings.getError("invalid_break_command", context));
  3857. },
  3858. invalid_terminal: function invalid_terminal(token) {
  3859. var context = [token.text, token.line, token.column];
  3860. return new _syntaxError.SyntaxError(_localizedStringsService.LocalizedStrings.getError('invalid_terminal', context));
  3861. },
  3862. invalid_type: function invalid_type(list, token) {
  3863. var line = list.join(_localizedStringsService.LocalizedStrings.getOR());
  3864. var context = [token.text, token.line, token.column, line];
  3865. return new _syntaxError.SyntaxError(_localizedStringsService.LocalizedStrings.getError("invalid_type", context));
  3866. },
  3867. const_not_init: function const_not_init(token) {
  3868. var context = [token.line, token.column];
  3869. return new _syntaxError.SyntaxError(_localizedStringsService.LocalizedStrings.getError("const_not_init", context));
  3870. },
  3871. invalid_id_format: function invalid_id_format(token) {
  3872. var context = [token.text, token.line, token.column];
  3873. return new _syntaxError.SyntaxError(_localizedStringsService.LocalizedStrings.getError("invalid_id_format", context));
  3874. },
  3875. duplicate_function: function duplicate_function(token) {
  3876. var context = [token.text, token.line, token.column];
  3877. return new _syntaxError.SyntaxError(_localizedStringsService.LocalizedStrings.getError("duplicate_function", context));
  3878. },
  3879. main_parameters: function main_parameters() {
  3880. return new _syntaxError.SyntaxError(_localizedStringsService.LocalizedStrings.getError("main_parameters"));
  3881. },
  3882. duplicate_variable: function duplicate_variable(token) {
  3883. var context = [token.text, token.line, token.column];
  3884. return new _syntaxError.SyntaxError(_localizedStringsService.LocalizedStrings.getError("duplicate_variable", context));
  3885. }
  3886. });
  3887. /***/ }),
  3888. /***/ "./js/ast/expressions/arrayAccess.js":
  3889. /*!*******************************************!*\
  3890. !*** ./js/ast/expressions/arrayAccess.js ***!
  3891. \*******************************************/
  3892. /*! no static exports found */
  3893. /***/ (function(module, exports, __webpack_require__) {
  3894. "use strict";
  3895. Object.defineProperty(exports, "__esModule", {
  3896. value: true
  3897. });
  3898. exports.ArrayAccess = undefined;
  3899. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  3900. var _expression = __webpack_require__(/*! ./expression */ "./js/ast/expressions/expression.js");
  3901. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3902. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  3903. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  3904. var ArrayAccess = exports.ArrayAccess = function (_Expression) {
  3905. _inherits(ArrayAccess, _Expression);
  3906. function ArrayAccess(id, line, column) {
  3907. _classCallCheck(this, ArrayAccess);
  3908. var _this = _possibleConstructorReturn(this, (ArrayAccess.__proto__ || Object.getPrototypeOf(ArrayAccess)).call(this));
  3909. _this.id = id;
  3910. _this.line = line;
  3911. _this.column = column;
  3912. return _this;
  3913. }
  3914. _createClass(ArrayAccess, [{
  3915. key: 'toString',
  3916. value: function toString() {
  3917. var strLine = this.line.toString();
  3918. var strColumn = null;
  3919. if (this.column) {
  3920. strColumn = this.column.toString();
  3921. }
  3922. if (strColumn) {
  3923. return this.id + '[' + strLine + '][' + strColumn + ']';
  3924. } else {
  3925. return this.id + '[' + strLine + ']';
  3926. }
  3927. }
  3928. }]);
  3929. return ArrayAccess;
  3930. }(_expression.Expression);
  3931. /***/ }),
  3932. /***/ "./js/ast/expressions/arrayLiteral.js":
  3933. /*!********************************************!*\
  3934. !*** ./js/ast/expressions/arrayLiteral.js ***!
  3935. \********************************************/
  3936. /*! no static exports found */
  3937. /***/ (function(module, exports, __webpack_require__) {
  3938. "use strict";
  3939. Object.defineProperty(exports, "__esModule", {
  3940. value: true
  3941. });
  3942. exports.ArrayLiteral = undefined;
  3943. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  3944. var _literal = __webpack_require__(/*! ./literal */ "./js/ast/expressions/literal.js");
  3945. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3946. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  3947. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  3948. var ArrayLiteral = exports.ArrayLiteral = function (_Literal) {
  3949. _inherits(ArrayLiteral, _Literal);
  3950. function ArrayLiteral(type, value) {
  3951. _classCallCheck(this, ArrayLiteral);
  3952. var _this = _possibleConstructorReturn(this, (ArrayLiteral.__proto__ || Object.getPrototypeOf(ArrayLiteral)).call(this, type));
  3953. _this.value = value;
  3954. return _this;
  3955. }
  3956. _createClass(ArrayLiteral, [{
  3957. key: 'validateType',
  3958. value: function validateType() {
  3959. // let valid = true;
  3960. // if(this.columns !== null) {
  3961. // const len = this.columns;
  3962. // const len2 = this.lines;
  3963. // for (let i = len - 1; i >= 0; i--) {
  3964. // for (let j = len2 - 1; j >= 0; j--) {
  3965. // if(this.value[i].value[j].type !== this.subtype) {
  3966. // valid = false;
  3967. // break;
  3968. // }
  3969. // }
  3970. // }
  3971. // } else {
  3972. // const len = this.lines;
  3973. // for (var i = len - 1; i >= 0; i--) {
  3974. // if(this.value[i].type !== this.subtype) {
  3975. // valid = false;
  3976. // break;
  3977. // }
  3978. // }
  3979. // }
  3980. return true; //valid;
  3981. }
  3982. }, {
  3983. key: 'validateSize',
  3984. value: function validateSize() {
  3985. var valid = true;
  3986. if (this.columns !== null) {
  3987. var equalityTest = data.value.map(function (v) {
  3988. return v.length;
  3989. }).reduce(function (old, next) {
  3990. if (old === null) {
  3991. return next;
  3992. } else if (old === next) {
  3993. return old;
  3994. } else {
  3995. return -1;
  3996. }
  3997. }, null);
  3998. valid = equalityTest !== -1;
  3999. }
  4000. return valid;
  4001. }
  4002. }, {
  4003. key: 'toString',
  4004. value: function toString() {
  4005. var strList = this.value.map(function (arrayLiteral) {
  4006. return arrayLiteral.toString();
  4007. });
  4008. return "{" + strList.join(',') + "}";
  4009. }
  4010. }, {
  4011. key: 'subtype',
  4012. get: function get() {
  4013. var element = this.value[0];
  4014. if (element instanceof ArrayLiteral) {
  4015. return element.value[0].type;
  4016. } else {
  4017. return element.type;
  4018. }
  4019. }
  4020. }, {
  4021. key: 'lines',
  4022. get: function get() {
  4023. return this.value.length;
  4024. }
  4025. }, {
  4026. key: 'columns',
  4027. get: function get() {
  4028. var element = this.value[0];
  4029. if (!(element instanceof ArrayLiteral)) {
  4030. return null;
  4031. } else {
  4032. return element.value[0].value.length;
  4033. }
  4034. }
  4035. }, {
  4036. key: 'isVector',
  4037. get: function get() {
  4038. return this.columns === null;
  4039. }
  4040. }, {
  4041. key: 'isValid',
  4042. get: function get() {
  4043. return true; //this.validateType() && this.validateSize();
  4044. }
  4045. }]);
  4046. return ArrayLiteral;
  4047. }(_literal.Literal);
  4048. /***/ }),
  4049. /***/ "./js/ast/expressions/boolLiteral.js":
  4050. /*!*******************************************!*\
  4051. !*** ./js/ast/expressions/boolLiteral.js ***!
  4052. \*******************************************/
  4053. /*! no static exports found */
  4054. /***/ (function(module, exports, __webpack_require__) {
  4055. "use strict";
  4056. Object.defineProperty(exports, "__esModule", {
  4057. value: true
  4058. });
  4059. exports.BoolLiteral = undefined;
  4060. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  4061. var _literal = __webpack_require__(/*! ./literal */ "./js/ast/expressions/literal.js");
  4062. var _types = __webpack_require__(/*! ./../../typeSystem/types */ "./js/typeSystem/types.js");
  4063. var _parsers = __webpack_require__(/*! ./../../typeSystem/parsers */ "./js/typeSystem/parsers.js");
  4064. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4065. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  4066. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  4067. var BoolLiteral = exports.BoolLiteral = function (_Literal) {
  4068. _inherits(BoolLiteral, _Literal);
  4069. function BoolLiteral(value) {
  4070. _classCallCheck(this, BoolLiteral);
  4071. var _this = _possibleConstructorReturn(this, (BoolLiteral.__proto__ || Object.getPrototypeOf(BoolLiteral)).call(this, _types.Types.BOOLEAN));
  4072. _this.value = value;
  4073. return _this;
  4074. }
  4075. _createClass(BoolLiteral, [{
  4076. key: 'toString',
  4077. value: function toString() {
  4078. return (0, _parsers.convertBoolToString)(this.value);
  4079. }
  4080. }]);
  4081. return BoolLiteral;
  4082. }(_literal.Literal);
  4083. /***/ }),
  4084. /***/ "./js/ast/expressions/expression.js":
  4085. /*!******************************************!*\
  4086. !*** ./js/ast/expressions/expression.js ***!
  4087. \******************************************/
  4088. /*! no static exports found */
  4089. /***/ (function(module, exports, __webpack_require__) {
  4090. "use strict";
  4091. Object.defineProperty(exports, "__esModule", {
  4092. value: true
  4093. });
  4094. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  4095. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4096. var Expression = exports.Expression = function () {
  4097. function Expression() {
  4098. _classCallCheck(this, Expression);
  4099. this._sourceInfo = null;
  4100. }
  4101. _createClass(Expression, [{
  4102. key: "sourceInfo",
  4103. set: function set(sourceInfo) {
  4104. this._sourceInfo = sourceInfo;
  4105. },
  4106. get: function get() {
  4107. return this._sourceInfo;
  4108. }
  4109. }]);
  4110. return Expression;
  4111. }();
  4112. /***/ }),
  4113. /***/ "./js/ast/expressions/functionCall.js":
  4114. /*!********************************************!*\
  4115. !*** ./js/ast/expressions/functionCall.js ***!
  4116. \********************************************/
  4117. /*! no static exports found */
  4118. /***/ (function(module, exports, __webpack_require__) {
  4119. "use strict";
  4120. Object.defineProperty(exports, "__esModule", {
  4121. value: true
  4122. });
  4123. exports.FunctionCall = undefined;
  4124. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  4125. var _expression = __webpack_require__(/*! ./expression */ "./js/ast/expressions/expression.js");
  4126. var _definedFunctions = __webpack_require__(/*! ../../processor/definedFunctions */ "./js/processor/definedFunctions.js");
  4127. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4128. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  4129. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  4130. var FunctionCall = exports.FunctionCall = function (_Expression) {
  4131. _inherits(FunctionCall, _Expression);
  4132. function FunctionCall(id, actualParameters) {
  4133. _classCallCheck(this, FunctionCall);
  4134. var _this = _possibleConstructorReturn(this, (FunctionCall.__proto__ || Object.getPrototypeOf(FunctionCall)).call(this));
  4135. _this.id = id;
  4136. _this.actualParameters = actualParameters;
  4137. return _this;
  4138. }
  4139. _createClass(FunctionCall, [{
  4140. key: 'toString',
  4141. value: function toString() {
  4142. var name = null;
  4143. if (this.isMainCall) {
  4144. name = _definedFunctions.LanguageDefinedFunction.getMainFunctionName();
  4145. } else {
  4146. name = _definedFunctions.LanguageDefinedFunction.getLocalName(this.id);
  4147. }
  4148. var params = null;
  4149. if (this.actualParameters.length == 0) {
  4150. params = "()";
  4151. } else {
  4152. var strParams = this.actualParameters.map(function (v) {
  4153. return v.toString();
  4154. });
  4155. params = "(" + strParams.join(",") + ")";
  4156. }
  4157. return name + params;
  4158. }
  4159. }, {
  4160. key: 'isMainCall',
  4161. get: function get() {
  4162. return this.id === null;
  4163. }
  4164. }, {
  4165. key: 'parametersSize',
  4166. get: function get() {
  4167. return this.actualParameters.length;
  4168. }
  4169. }]);
  4170. return FunctionCall;
  4171. }(_expression.Expression);
  4172. /***/ }),
  4173. /***/ "./js/ast/expressions/index.js":
  4174. /*!*************************************!*\
  4175. !*** ./js/ast/expressions/index.js ***!
  4176. \*************************************/
  4177. /*! no static exports found */
  4178. /***/ (function(module, exports, __webpack_require__) {
  4179. "use strict";
  4180. Object.defineProperty(exports, "__esModule", {
  4181. value: true
  4182. });
  4183. exports.UnaryApp = exports.InfixApp = exports.VariableLiteral = exports.ArrayLiteral = exports.StringLiteral = exports.BoolLiteral = exports.RealLiteral = exports.IntLiteral = exports.FunctionCall = exports.ArrayAccess = undefined;
  4184. var _arrayAccess = __webpack_require__(/*! ./arrayAccess */ "./js/ast/expressions/arrayAccess.js");
  4185. var _functionCall = __webpack_require__(/*! ./functionCall */ "./js/ast/expressions/functionCall.js");
  4186. var _intLiteral = __webpack_require__(/*! ./intLiteral */ "./js/ast/expressions/intLiteral.js");
  4187. var _realLiteral = __webpack_require__(/*! ./realLiteral */ "./js/ast/expressions/realLiteral.js");
  4188. var _boolLiteral = __webpack_require__(/*! ./boolLiteral */ "./js/ast/expressions/boolLiteral.js");
  4189. var _stringLiteral = __webpack_require__(/*! ./stringLiteral */ "./js/ast/expressions/stringLiteral.js");
  4190. var _arrayLiteral = __webpack_require__(/*! ./arrayLiteral */ "./js/ast/expressions/arrayLiteral.js");
  4191. var _variableLiteral = __webpack_require__(/*! ./variableLiteral */ "./js/ast/expressions/variableLiteral.js");
  4192. var _infixApp = __webpack_require__(/*! ./infixApp */ "./js/ast/expressions/infixApp.js");
  4193. var _unaryApp = __webpack_require__(/*! ./unaryApp */ "./js/ast/expressions/unaryApp.js");
  4194. exports.ArrayAccess = _arrayAccess.ArrayAccess;
  4195. exports.FunctionCall = _functionCall.FunctionCall;
  4196. exports.IntLiteral = _intLiteral.IntLiteral;
  4197. exports.RealLiteral = _realLiteral.RealLiteral;
  4198. exports.BoolLiteral = _boolLiteral.BoolLiteral;
  4199. exports.StringLiteral = _stringLiteral.StringLiteral;
  4200. exports.ArrayLiteral = _arrayLiteral.ArrayLiteral;
  4201. exports.VariableLiteral = _variableLiteral.VariableLiteral;
  4202. exports.InfixApp = _infixApp.InfixApp;
  4203. exports.UnaryApp = _unaryApp.UnaryApp;
  4204. /***/ }),
  4205. /***/ "./js/ast/expressions/infixApp.js":
  4206. /*!****************************************!*\
  4207. !*** ./js/ast/expressions/infixApp.js ***!
  4208. \****************************************/
  4209. /*! no static exports found */
  4210. /***/ (function(module, exports, __webpack_require__) {
  4211. "use strict";
  4212. Object.defineProperty(exports, "__esModule", {
  4213. value: true
  4214. });
  4215. exports.InfixApp = undefined;
  4216. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  4217. var _expression = __webpack_require__(/*! ./expression */ "./js/ast/expressions/expression.js");
  4218. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4219. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  4220. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  4221. var InfixApp = exports.InfixApp = function (_Expression) {
  4222. _inherits(InfixApp, _Expression);
  4223. function InfixApp(op, left, right) {
  4224. _classCallCheck(this, InfixApp);
  4225. var _this = _possibleConstructorReturn(this, (InfixApp.__proto__ || Object.getPrototypeOf(InfixApp)).call(this));
  4226. _this.op = op;
  4227. _this.left = left;
  4228. _this.right = right;
  4229. return _this;
  4230. }
  4231. _createClass(InfixApp, [{
  4232. key: 'toString',
  4233. value: function toString() {
  4234. var l = this.left.toString();
  4235. var op = this.op.value;
  4236. var r = this.right.toString();
  4237. return l + op + r;
  4238. }
  4239. }]);
  4240. return InfixApp;
  4241. }(_expression.Expression);
  4242. /***/ }),
  4243. /***/ "./js/ast/expressions/intLiteral.js":
  4244. /*!******************************************!*\
  4245. !*** ./js/ast/expressions/intLiteral.js ***!
  4246. \******************************************/
  4247. /*! no static exports found */
  4248. /***/ (function(module, exports, __webpack_require__) {
  4249. "use strict";
  4250. Object.defineProperty(exports, "__esModule", {
  4251. value: true
  4252. });
  4253. exports.IntLiteral = undefined;
  4254. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  4255. var _literal = __webpack_require__(/*! ./literal */ "./js/ast/expressions/literal.js");
  4256. var _types = __webpack_require__(/*! ./../../typeSystem/types */ "./js/typeSystem/types.js");
  4257. var _parsers = __webpack_require__(/*! ./../../typeSystem/parsers */ "./js/typeSystem/parsers.js");
  4258. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4259. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  4260. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  4261. var IntLiteral = exports.IntLiteral = function (_Literal) {
  4262. _inherits(IntLiteral, _Literal);
  4263. function IntLiteral(value) {
  4264. _classCallCheck(this, IntLiteral);
  4265. var _this = _possibleConstructorReturn(this, (IntLiteral.__proto__ || Object.getPrototypeOf(IntLiteral)).call(this, _types.Types.INTEGER));
  4266. _this.value = value;
  4267. return _this;
  4268. }
  4269. _createClass(IntLiteral, [{
  4270. key: 'toString',
  4271. value: function toString() {
  4272. return (0, _parsers.convertToString)(this.value, this.type);
  4273. }
  4274. }]);
  4275. return IntLiteral;
  4276. }(_literal.Literal);
  4277. /***/ }),
  4278. /***/ "./js/ast/expressions/literal.js":
  4279. /*!***************************************!*\
  4280. !*** ./js/ast/expressions/literal.js ***!
  4281. \***************************************/
  4282. /*! no static exports found */
  4283. /***/ (function(module, exports, __webpack_require__) {
  4284. "use strict";
  4285. Object.defineProperty(exports, "__esModule", {
  4286. value: true
  4287. });
  4288. exports.Literal = undefined;
  4289. var _expression = __webpack_require__(/*! ./expression */ "./js/ast/expressions/expression.js");
  4290. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4291. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  4292. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  4293. var Literal = exports.Literal = function (_Expression) {
  4294. _inherits(Literal, _Expression);
  4295. function Literal(type) {
  4296. _classCallCheck(this, Literal);
  4297. var _this = _possibleConstructorReturn(this, (Literal.__proto__ || Object.getPrototypeOf(Literal)).call(this));
  4298. _this.type = type;
  4299. return _this;
  4300. }
  4301. return Literal;
  4302. }(_expression.Expression);
  4303. /***/ }),
  4304. /***/ "./js/ast/expressions/realLiteral.js":
  4305. /*!*******************************************!*\
  4306. !*** ./js/ast/expressions/realLiteral.js ***!
  4307. \*******************************************/
  4308. /*! no static exports found */
  4309. /***/ (function(module, exports, __webpack_require__) {
  4310. "use strict";
  4311. Object.defineProperty(exports, "__esModule", {
  4312. value: true
  4313. });
  4314. exports.RealLiteral = undefined;
  4315. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  4316. var _literal = __webpack_require__(/*! ./literal */ "./js/ast/expressions/literal.js");
  4317. var _types = __webpack_require__(/*! ./../../typeSystem/types */ "./js/typeSystem/types.js");
  4318. var _parsers = __webpack_require__(/*! ./../../typeSystem/parsers */ "./js/typeSystem/parsers.js");
  4319. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4320. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  4321. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  4322. var RealLiteral = exports.RealLiteral = function (_Literal) {
  4323. _inherits(RealLiteral, _Literal);
  4324. function RealLiteral(value) {
  4325. _classCallCheck(this, RealLiteral);
  4326. var _this = _possibleConstructorReturn(this, (RealLiteral.__proto__ || Object.getPrototypeOf(RealLiteral)).call(this, _types.Types.REAL));
  4327. _this.value = value;
  4328. return _this;
  4329. }
  4330. _createClass(RealLiteral, [{
  4331. key: 'toString',
  4332. value: function toString() {
  4333. return (0, _parsers.convertToString)(this.value, this.type);
  4334. }
  4335. }]);
  4336. return RealLiteral;
  4337. }(_literal.Literal);
  4338. /***/ }),
  4339. /***/ "./js/ast/expressions/stringLiteral.js":
  4340. /*!*********************************************!*\
  4341. !*** ./js/ast/expressions/stringLiteral.js ***!
  4342. \*********************************************/
  4343. /*! no static exports found */
  4344. /***/ (function(module, exports, __webpack_require__) {
  4345. "use strict";
  4346. Object.defineProperty(exports, "__esModule", {
  4347. value: true
  4348. });
  4349. exports.StringLiteral = undefined;
  4350. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  4351. var _literal = __webpack_require__(/*! ./literal */ "./js/ast/expressions/literal.js");
  4352. var _types = __webpack_require__(/*! ./../../typeSystem/types */ "./js/typeSystem/types.js");
  4353. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4354. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  4355. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  4356. var StringLiteral = exports.StringLiteral = function (_Literal) {
  4357. _inherits(StringLiteral, _Literal);
  4358. function StringLiteral(value) {
  4359. _classCallCheck(this, StringLiteral);
  4360. var _this = _possibleConstructorReturn(this, (StringLiteral.__proto__ || Object.getPrototypeOf(StringLiteral)).call(this, _types.Types.STRING));
  4361. _this.value = value;
  4362. return _this;
  4363. }
  4364. _createClass(StringLiteral, [{
  4365. key: 'toString',
  4366. value: function toString() {
  4367. return this.value;
  4368. }
  4369. }]);
  4370. return StringLiteral;
  4371. }(_literal.Literal);
  4372. /***/ }),
  4373. /***/ "./js/ast/expressions/unaryApp.js":
  4374. /*!****************************************!*\
  4375. !*** ./js/ast/expressions/unaryApp.js ***!
  4376. \****************************************/
  4377. /*! no static exports found */
  4378. /***/ (function(module, exports, __webpack_require__) {
  4379. "use strict";
  4380. Object.defineProperty(exports, "__esModule", {
  4381. value: true
  4382. });
  4383. exports.UnaryApp = undefined;
  4384. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  4385. var _infixApp = __webpack_require__(/*! ./infixApp */ "./js/ast/expressions/infixApp.js");
  4386. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4387. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  4388. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  4389. var UnaryApp = exports.UnaryApp = function (_InfixApp) {
  4390. _inherits(UnaryApp, _InfixApp);
  4391. function UnaryApp(op, left) {
  4392. _classCallCheck(this, UnaryApp);
  4393. return _possibleConstructorReturn(this, (UnaryApp.__proto__ || Object.getPrototypeOf(UnaryApp)).call(this, op, left, null));
  4394. }
  4395. _createClass(UnaryApp, [{
  4396. key: 'toString',
  4397. value: function toString() {
  4398. var l = this.left.toString();
  4399. var op = this.op.value;
  4400. return op + l;
  4401. }
  4402. }]);
  4403. return UnaryApp;
  4404. }(_infixApp.InfixApp);
  4405. /***/ }),
  4406. /***/ "./js/ast/expressions/variableLiteral.js":
  4407. /*!***********************************************!*\
  4408. !*** ./js/ast/expressions/variableLiteral.js ***!
  4409. \***********************************************/
  4410. /*! no static exports found */
  4411. /***/ (function(module, exports, __webpack_require__) {
  4412. "use strict";
  4413. Object.defineProperty(exports, "__esModule", {
  4414. value: true
  4415. });
  4416. exports.VariableLiteral = undefined;
  4417. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  4418. var _literal = __webpack_require__(/*! ./literal */ "./js/ast/expressions/literal.js");
  4419. var _types = __webpack_require__(/*! ./../../typeSystem/types */ "./js/typeSystem/types.js");
  4420. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4421. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  4422. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  4423. var VariableLiteral = exports.VariableLiteral = function (_Literal) {
  4424. _inherits(VariableLiteral, _Literal);
  4425. function VariableLiteral(id) {
  4426. _classCallCheck(this, VariableLiteral);
  4427. var _this = _possibleConstructorReturn(this, (VariableLiteral.__proto__ || Object.getPrototypeOf(VariableLiteral)).call(this, _types.Types.UNDEFINED));
  4428. _this.id = id;
  4429. return _this;
  4430. }
  4431. _createClass(VariableLiteral, [{
  4432. key: 'toString',
  4433. value: function toString() {
  4434. return this.id;
  4435. }
  4436. }]);
  4437. return VariableLiteral;
  4438. }(_literal.Literal);
  4439. /***/ }),
  4440. /***/ "./js/ast/ivprogParser.js":
  4441. /*!********************************!*\
  4442. !*** ./js/ast/ivprogParser.js ***!
  4443. \********************************/
  4444. /*! no static exports found */
  4445. /***/ (function(module, exports, __webpack_require__) {
  4446. "use strict";
  4447. Object.defineProperty(exports, "__esModule", {
  4448. value: true
  4449. });
  4450. exports.IVProgParser = undefined;
  4451. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  4452. var _index = __webpack_require__(/*! antlr4/index */ "./node_modules/antlr4/index.js");
  4453. var _expressions = __webpack_require__(/*! ./expressions/ */ "./js/ast/expressions/index.js");
  4454. var Expressions = _interopRequireWildcard(_expressions);
  4455. var _commands = __webpack_require__(/*! ./commands/ */ "./js/ast/commands/index.js");
  4456. var Commands = _interopRequireWildcard(_commands);
  4457. var _parsers = __webpack_require__(/*! ./../typeSystem/parsers */ "./js/typeSystem/parsers.js");
  4458. var _types = __webpack_require__(/*! ./../typeSystem/types */ "./js/typeSystem/types.js");
  4459. var _compoundType = __webpack_require__(/*! ./../typeSystem/compoundType */ "./js/typeSystem/compoundType.js");
  4460. var _sourceInfo2 = __webpack_require__(/*! ./sourceInfo */ "./js/ast/sourceInfo.js");
  4461. var _operators = __webpack_require__(/*! ./operators */ "./js/ast/operators.js");
  4462. var _syntaxErrorFactory = __webpack_require__(/*! ./error/syntaxErrorFactory */ "./js/ast/error/syntaxErrorFactory.js");
  4463. var _definedFunctions = __webpack_require__(/*! ./../processor/definedFunctions */ "./js/processor/definedFunctions.js");
  4464. var _languageService = __webpack_require__(/*! ../services/languageService */ "./js/services/languageService.js");
  4465. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  4466. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4467. var IVProgParser = exports.IVProgParser = function () {
  4468. _createClass(IVProgParser, null, [{
  4469. key: 'createParser',
  4470. value: function createParser(input) {
  4471. var lexerClass = _languageService.LanguageService.getCurrentLexer();
  4472. return new IVProgParser(input, lexerClass);
  4473. }
  4474. // <BEGIN scope consts>
  4475. }, {
  4476. key: 'BASE',
  4477. get: function get() {
  4478. return 0;
  4479. }
  4480. }, {
  4481. key: 'FUNCTION',
  4482. get: function get() {
  4483. return 1;
  4484. }
  4485. }, {
  4486. key: 'COMMAND',
  4487. get: function get() {
  4488. return 2;
  4489. }
  4490. }, {
  4491. key: 'BREAKABLE',
  4492. get: function get() {
  4493. return 4;
  4494. }
  4495. // </ END scope consts>
  4496. }]);
  4497. function IVProgParser(input, lexerClass) {
  4498. _classCallCheck(this, IVProgParser);
  4499. this.lexerClass = lexerClass;
  4500. this.lexer = new lexerClass(new _index.InputStream(input));
  4501. this.tokenStream = new _index.CommonTokenStream(this.lexer);
  4502. this.tokenStream.fill();
  4503. this.pos = 1;
  4504. this.variableTypes = [this.lexerClass.RK_INTEGER, this.lexerClass.RK_REAL, this.lexerClass.RK_BOOLEAN, this.lexerClass.RK_STRING];
  4505. this.functionTypes = this.variableTypes.concat(this.lexerClass.RK_VOID);
  4506. this.parsingArrayDimension = 0;
  4507. this.scope = [];
  4508. this.langFuncs = _languageService.LanguageService.getCurrentLangFuncs();
  4509. this.definedFuncsNameList = [];
  4510. this.definedVariablesStack = [];
  4511. }
  4512. _createClass(IVProgParser, [{
  4513. key: 'parseTree',
  4514. value: function parseTree() {
  4515. return this.parseProgram();
  4516. }
  4517. }, {
  4518. key: 'getToken',
  4519. value: function getToken() {
  4520. var index = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.pos;
  4521. // if(index === null)
  4522. // index = this.pos;
  4523. return this.tokenStream.LT(index);
  4524. }
  4525. }, {
  4526. key: 'insideScope',
  4527. value: function insideScope(scope) {
  4528. if (this.scope.length <= 0) {
  4529. return IVProgParser.BASE === scope;
  4530. } else {
  4531. return this.scope[this.scope.length - 1] === scope;
  4532. }
  4533. }
  4534. }, {
  4535. key: 'pushScope',
  4536. value: function pushScope(scope) {
  4537. this.scope.push(scope);
  4538. }
  4539. }, {
  4540. key: 'pushVariableStack',
  4541. value: function pushVariableStack() {
  4542. this.definedVariablesStack.push([]);
  4543. }
  4544. }, {
  4545. key: 'popScope',
  4546. value: function popScope() {
  4547. return this.scope.pop();
  4548. }
  4549. }, {
  4550. key: 'popVariableStack',
  4551. value: function popVariableStack() {
  4552. return this.definedVariablesStack.pop();
  4553. }
  4554. }, {
  4555. key: 'getCurrentVariableStack',
  4556. value: function getCurrentVariableStack() {
  4557. return this.definedVariablesStack[this.definedVariablesStack.length - 1];
  4558. }
  4559. }, {
  4560. key: 'isEOF',
  4561. value: function isEOF() {
  4562. this.getToken(this.pos);
  4563. return this.tokenStream.fetchedEOF;
  4564. }
  4565. }, {
  4566. key: 'parseProgram',
  4567. value: function parseProgram() {
  4568. var token = this.getToken();
  4569. var globalVars = [];
  4570. var functions = [];
  4571. if (this.lexerClass.RK_PROGRAM === token.type) {
  4572. this.pos++;
  4573. this.consumeNewLines();
  4574. this.checkOpenCurly();
  4575. this.pos++;
  4576. this.pushVariableStack();
  4577. while (true) {
  4578. this.consumeNewLines();
  4579. var _token = this.getToken();
  4580. if (_token.type === this.lexerClass.RK_CONST || this.isVariableType(_token)) {
  4581. globalVars = globalVars.concat(this.parseGlobalVariables());
  4582. } else if (_token.type === this.lexerClass.RK_FUNCTION) {
  4583. this.pushVariableStack();
  4584. functions = functions.concat(this.parseFunction());
  4585. this.popVariableStack();
  4586. } else {
  4587. break;
  4588. }
  4589. }
  4590. this.consumeNewLines();
  4591. this.checkCloseCurly();
  4592. this.pos++;
  4593. this.consumeNewLines();
  4594. if (!this.isEOF()) {
  4595. throw _syntaxErrorFactory.SyntaxErrorFactory.extra_lines();
  4596. }
  4597. this.popVariableStack();
  4598. return { global: globalVars, functions: functions };
  4599. } else {
  4600. throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_one(this.lexer.literalNames[this.lexerClass.RK_PROGRAM], token);
  4601. }
  4602. }
  4603. }, {
  4604. key: 'checkOpenCurly',
  4605. value: function checkOpenCurly() {
  4606. var attempt = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  4607. var token = this.getToken();
  4608. if (this.lexerClass.OPEN_CURLY !== token.type) {
  4609. if (!attempt) throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_one('{', token);else return false;
  4610. }
  4611. return true;
  4612. }
  4613. }, {
  4614. key: 'checkCloseCurly',
  4615. value: function checkCloseCurly() {
  4616. var attempt = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  4617. var token = this.getToken();
  4618. if (this.lexerClass.CLOSE_CURLY !== token.type) {
  4619. if (!attempt) throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_one('}', token);else return false;
  4620. }
  4621. return true;
  4622. }
  4623. /* It checks if the current token at position pos is a ']'.
  4624. * As a check function it doesn't increment pos.
  4625. *
  4626. * @params bool:attempt, indicates that the token is optional. Defaults: false
  4627. *
  4628. * @returns true if the attempt is true and current token is '[',
  4629. * false is attempt is true and current token is not '['
  4630. **/
  4631. }, {
  4632. key: 'checkOpenBrace',
  4633. value: function checkOpenBrace() {
  4634. var attempt = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  4635. var token = this.getToken();
  4636. if (this.lexerClass.OPEN_BRACE !== token.type) {
  4637. if (!attempt) {
  4638. throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_one('[', token);
  4639. } else {
  4640. return false;
  4641. }
  4642. }
  4643. return true;
  4644. }
  4645. }, {
  4646. key: 'checkCloseBrace',
  4647. value: function checkCloseBrace() {
  4648. var attempt = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  4649. var token = this.getToken();
  4650. if (this.lexerClass.CLOSE_BRACE !== token.type) {
  4651. if (!attempt) {
  4652. throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_one(']', token);
  4653. } else {
  4654. return false;
  4655. }
  4656. }
  4657. return true;
  4658. }
  4659. }, {
  4660. key: 'checkOpenParenthesis',
  4661. value: function checkOpenParenthesis() {
  4662. var attempt = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  4663. var token = this.getToken();
  4664. if (this.lexerClass.OPEN_PARENTHESIS !== token.type) {
  4665. if (!attempt) {
  4666. throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_one('(', token);
  4667. } else {
  4668. return false;
  4669. }
  4670. }
  4671. return true;
  4672. }
  4673. }, {
  4674. key: 'checkCloseParenthesis',
  4675. value: function checkCloseParenthesis() {
  4676. var attempt = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  4677. var token = this.getToken();
  4678. if (this.lexerClass.CLOSE_PARENTHESIS !== token.type) {
  4679. if (!attempt) {
  4680. throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_one(')', token);
  4681. } else {
  4682. return false;
  4683. }
  4684. }
  4685. return true;
  4686. }
  4687. }, {
  4688. key: 'checkEOS',
  4689. value: function checkEOS() {
  4690. var attempt = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  4691. var eosToken = this.getToken();
  4692. if (eosToken.type !== this.lexerClass.EOS) {
  4693. if (!attempt) throw _syntaxErrorFactory.SyntaxErrorFactory.eos_missing(eosToken);else return false;
  4694. }
  4695. return true;
  4696. }
  4697. }, {
  4698. key: 'checkFunctionDuplicate',
  4699. value: function checkFunctionDuplicate(functionID, funcIDToken) {
  4700. var id = functionID === null ? "$main" : functionID;
  4701. var index = this.definedFuncsNameList.indexOf(id);
  4702. if (index !== -1) {
  4703. throw _syntaxErrorFactory.SyntaxErrorFactory.duplicate_function(funcIDToken);
  4704. }
  4705. this.definedFuncsNameList.push(id);
  4706. }
  4707. }, {
  4708. key: 'checkVariableDuplicate',
  4709. value: function checkVariableDuplicate(variableID, variableIDToken) {
  4710. var index = this.getCurrentVariableStack().indexOf(variableID);
  4711. if (index !== -1) {
  4712. throw _syntaxErrorFactory.SyntaxErrorFactory.duplicate_variable(variableIDToken);
  4713. }
  4714. this.getCurrentVariableStack().push(variableID);
  4715. }
  4716. }, {
  4717. key: 'consumeForSemiColon',
  4718. value: function consumeForSemiColon() {
  4719. var eosToken = this.getToken();
  4720. if (eosToken.type === this.lexerClass.EOS && eosToken.text.match(';')) {
  4721. this.pos++;
  4722. return;
  4723. }
  4724. throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_one(';', eosToken);
  4725. }
  4726. }, {
  4727. key: 'parseGlobalVariables',
  4728. value: function parseGlobalVariables() {
  4729. var decl = this.parseMaybeConst();
  4730. this.checkEOS();
  4731. this.pos++;
  4732. return decl;
  4733. }
  4734. /*
  4735. * Checks if the next token is PR_CONST. It's only available
  4736. * at global variables declaration level
  4737. * @returns Declararion(const, type, id, initVal?)
  4738. **/
  4739. }, {
  4740. key: 'parseMaybeConst',
  4741. value: function parseMaybeConst() {
  4742. var constToken = this.getToken();
  4743. if (constToken.type === this.lexerClass.RK_CONST) {
  4744. this.pos++;
  4745. var typeString = this.parseType();
  4746. return this.parseDeclaration(typeString, true);
  4747. } else if (this.isVariableType(constToken)) {
  4748. var _typeString = this.parseType();
  4749. return this.parseDeclaration(_typeString);
  4750. } else {
  4751. throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_list([this.lexer.literalNames[this.lexerClass.RK_CONST]].concat(this.getTypeArray()), constToken);
  4752. }
  4753. }
  4754. /*
  4755. * Parses a declarion of the form: type --- id --- (= --- EAnd)?
  4756. * @returns a list of Declararion(const, type, id, initVal?)
  4757. **/
  4758. }, {
  4759. key: 'parseDeclaration',
  4760. value: function parseDeclaration(typeString) {
  4761. var isConst = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  4762. var initial = null;
  4763. var dim1 = null;
  4764. var dim2 = null;
  4765. var idToken = this.getToken();
  4766. var idString = this.parseID();
  4767. this.checkVariableDuplicate(idString, idToken);
  4768. // Check for array or vector
  4769. // ID[int/IDi][int/IDj]
  4770. if (this.checkOpenBrace(true)) {
  4771. this.pos++;
  4772. this.consumeNewLines();
  4773. dim1 = this.parseArrayDimension();
  4774. this.consumeNewLines();
  4775. this.checkCloseBrace();
  4776. this.pos++;
  4777. if (this.checkOpenBrace(true)) {
  4778. this.pos++;
  4779. this.consumeNewLines();
  4780. dim2 = this.parseArrayDimension();
  4781. this.consumeNewLines();
  4782. this.checkCloseBrace();
  4783. this.pos++;
  4784. }
  4785. }
  4786. var equalsToken = this.getToken();
  4787. if (isConst && equalsToken.type !== this.lexerClass.EQUAL) {
  4788. throw _syntaxErrorFactory.SyntaxErrorFactory.const_not_init(idToken);
  4789. }
  4790. if (equalsToken.type === this.lexerClass.EQUAL) {
  4791. this.pos++;
  4792. initial = this.parseExpressionOR();
  4793. }
  4794. var declaration = null;
  4795. var dimensions = 0;
  4796. if (dim1 !== null) {
  4797. dimensions++;
  4798. if (dim2 !== null) {
  4799. dimensions++;
  4800. }
  4801. declaration = new Commands.ArrayDeclaration(idString, new _compoundType.CompoundType(typeString, dimensions), dim1, dim2, initial, isConst);
  4802. } else {
  4803. declaration = new Commands.Declaration(idString, typeString, initial, isConst);
  4804. }
  4805. declaration.sourceInfo = _sourceInfo2.SourceInfo.createSourceInfo(idToken);
  4806. var commaToken = this.getToken();
  4807. if (commaToken.type === this.lexerClass.COMMA) {
  4808. this.pos++;
  4809. this.consumeNewLines();
  4810. return [declaration].concat(this.parseDeclaration(typeString, isConst));
  4811. } else {
  4812. return [declaration];
  4813. }
  4814. }
  4815. }, {
  4816. key: 'consumeNewLines',
  4817. value: function consumeNewLines() {
  4818. var token = this.getToken();
  4819. while (token.type === this.lexerClass.EOS && token.text.match('[\r\n]+')) {
  4820. this.pos++;
  4821. token = this.getToken();
  4822. }
  4823. }
  4824. }, {
  4825. key: 'isVariableType',
  4826. value: function isVariableType(token) {
  4827. return this.variableTypes.find(function (v) {
  4828. return v === token.type;
  4829. });
  4830. }
  4831. /*
  4832. * Reads the next token of the stream to check if it is a Integer or an ID.
  4833. * @returns Integer | ID
  4834. **/
  4835. }, {
  4836. key: 'parseArrayDimension',
  4837. value: function parseArrayDimension() {
  4838. var dimToken = this.getToken();
  4839. if (dimToken.type === this.lexerClass.INTEGER) {
  4840. //parse as int literal
  4841. this.pos++;
  4842. return this.getIntLiteral(dimToken);
  4843. } else if (dimToken.type === this.lexerClass.ID) {
  4844. //parse as variable
  4845. this.pos++;
  4846. return this.parseVariable(dimToken);
  4847. } else {
  4848. throw _syntaxErrorFactory.SyntaxErrorFactory.invalid_array_dimension(this.lexer.literalNames[this.lexerClass.RK_INTEGER], dimToken);
  4849. }
  4850. }
  4851. /*
  4852. * Returns an object {type: 'int', value: value}.
  4853. * It checks for binary and hexadecimal integers.
  4854. * @returns object with fields type and value
  4855. **/
  4856. }, {
  4857. key: 'getIntLiteral',
  4858. value: function getIntLiteral(token) {
  4859. var text = token.text;
  4860. var sourceInfo = _sourceInfo2.SourceInfo.createSourceInfo(token);
  4861. var exp = new Expressions.IntLiteral((0, _parsers.toInt)(text));
  4862. exp.sourceInfo = sourceInfo;
  4863. return exp;
  4864. }
  4865. }, {
  4866. key: 'getRealLiteral',
  4867. value: function getRealLiteral(token) {
  4868. var sourceInfo = _sourceInfo2.SourceInfo.createSourceInfo(token);
  4869. var exp = new Expressions.RealLiteral((0, _parsers.toReal)(token.text));
  4870. exp.sourceInfo = sourceInfo;
  4871. return exp;
  4872. }
  4873. }, {
  4874. key: 'getStringLiteral',
  4875. value: function getStringLiteral(token) {
  4876. var text = token.text;
  4877. var sourceInfo = _sourceInfo2.SourceInfo.createSourceInfo(token);
  4878. var exp = new Expressions.StringLiteral((0, _parsers.toString)(text));
  4879. exp.sourceInfo = sourceInfo;
  4880. return exp;
  4881. }
  4882. }, {
  4883. key: 'getBoolLiteral',
  4884. value: function getBoolLiteral(token) {
  4885. var val = (0, _parsers.toBool)(token.text);
  4886. var exp = new Expressions.BoolLiteral(val);
  4887. exp.sourceInfo = _sourceInfo2.SourceInfo.createSourceInfo(token);;
  4888. return exp;
  4889. }
  4890. }, {
  4891. key: 'parseArrayLiteral',
  4892. value: function parseArrayLiteral() {
  4893. this.checkOpenCurly();
  4894. var beginArray = this.getToken();
  4895. if (this.parsingArrayDimension >= 2) {
  4896. throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_list('Array dimensions exceed maximum size of 2 at line ' + beginArray.line);
  4897. }
  4898. this.pos++;
  4899. this.parsingArrayDimension++;
  4900. this.consumeNewLines();
  4901. var data = this.parseExpressionList();
  4902. this.consumeNewLines();
  4903. this.checkCloseCurly();
  4904. var endArray = this.getToken();
  4905. this.pos++;
  4906. this.parsingArrayDimension--;
  4907. if (this.parsingArrayDimension === 0) {
  4908. // if (!data.isValid) {
  4909. // // TODO: better error message
  4910. // console.log('invalid array');
  4911. // throw new Error(`Invalid array at line ${beginArray.line}`);
  4912. // }
  4913. }
  4914. var sourceInfo = _sourceInfo2.SourceInfo.createSourceInfoFromList(beginArray, endArray);
  4915. var dataDim = 1;
  4916. if (data[0] instanceof Expressions.ArrayLiteral) {
  4917. dataDim++;
  4918. }
  4919. var type = new _compoundType.CompoundType(_types.Types.UNDEFINED, dataDim);
  4920. var exp = new Expressions.ArrayLiteral(type, data);
  4921. exp.sourceInfo = sourceInfo;
  4922. return exp;
  4923. }
  4924. /*
  4925. * Returns an object {type: 'variable', value: value}.
  4926. * @returns object with fields type and value
  4927. **/
  4928. }, {
  4929. key: 'parseVariable',
  4930. value: function parseVariable(token) {
  4931. var sourceInfo = _sourceInfo2.SourceInfo.createSourceInfo(token);
  4932. var exp = new Expressions.VariableLiteral(token.text);
  4933. exp.sourceInfo = sourceInfo;
  4934. return exp;
  4935. }
  4936. /*
  4937. * Returns an object representing a function. It has
  4938. * four attributes: returnType, id, formalParams and block.
  4939. * The block object has two attributes: declarations and commands
  4940. **/
  4941. }, {
  4942. key: 'parseFunction',
  4943. value: function parseFunction() {
  4944. this.pushScope(IVProgParser.FUNCTION);
  4945. var formalParams = [];
  4946. var token = this.getToken();
  4947. if (token.type !== this.lexerClass.RK_FUNCTION) {
  4948. //throw SyntaxError.createError(this.lexer.literalNames[this.lexerClass.PR_FUNCAO], token);
  4949. return null;
  4950. }
  4951. this.pos++;
  4952. var funType = this.parseType();
  4953. var dimensions = 0;
  4954. if (this.checkOpenBrace(true)) {
  4955. this.pos++;
  4956. this.checkCloseBrace();
  4957. this.pos++;
  4958. dimensions++;
  4959. if (this.checkOpenBrace(true)) {
  4960. this.pos++;
  4961. this.checkCloseBrace();
  4962. this.pos++;
  4963. dimensions++;
  4964. }
  4965. }
  4966. var funcIDToken = this.getToken();
  4967. var functionID = this.parseID();
  4968. this.checkFunctionDuplicate(functionID, funcIDToken);
  4969. this.checkOpenParenthesis();
  4970. this.pos++;
  4971. this.consumeNewLines();
  4972. if (!this.checkCloseParenthesis(true)) {
  4973. formalParams = this.parseFormalParameters(); // formal parameters
  4974. this.consumeNewLines();
  4975. this.checkCloseParenthesis();
  4976. this.pos++;
  4977. } else {
  4978. this.pos++;
  4979. }
  4980. this.consumeNewLines();
  4981. var commandsBlock = this.parseCommandBlock();
  4982. var returnType = funType;
  4983. if (dimensions > 0) {
  4984. returnType = new _compoundType.CompoundType(funType, dimensions);
  4985. }
  4986. var func = new Commands.Function(functionID, returnType, formalParams, commandsBlock);
  4987. if (functionID === null && !func.isMain) {
  4988. throw _syntaxErrorFactory.SyntaxErrorFactory.invalid_main_return(_definedFunctions.LanguageDefinedFunction.getMainFunctionName(), this.lexer.literalNames[this.lexerClass.RK_VOID], token.line);
  4989. } else if (func.isMain && formalParams.length !== 0) {
  4990. throw _syntaxErrorFactory.SyntaxErrorFactory.main_parameters();
  4991. }
  4992. this.popScope();
  4993. return func;
  4994. }
  4995. /*
  4996. * Parse the formal parameters of a function.
  4997. * @returns a list of objects with the following attributes: type, id and dimensions.
  4998. **/
  4999. }, {
  5000. key: 'parseFormalParameters',
  5001. value: function parseFormalParameters() {
  5002. var list = [];
  5003. while (true) {
  5004. var dimensions = 0;
  5005. var typeString = this.parseType();
  5006. var idToken = this.getToken();
  5007. var idString = this.parseID();
  5008. this.checkVariableDuplicate(idString, idToken);
  5009. if (this.checkOpenBrace(true)) {
  5010. this.pos++;
  5011. dimensions++;
  5012. this.checkCloseBrace();
  5013. this.pos++;
  5014. if (this.checkOpenBrace(true)) {
  5015. this.pos++;
  5016. dimensions++;
  5017. this.checkCloseBrace();
  5018. this.pos++;
  5019. }
  5020. }
  5021. var type = null;
  5022. if (dimensions > 0) {
  5023. type = new _compoundType.CompoundType(typeString, dimensions);
  5024. } else {
  5025. type = typeString;
  5026. }
  5027. list.push(new Commands.FormalParameter(type, idString));
  5028. var commaToken = this.getToken();
  5029. if (commaToken.type !== this.lexerClass.COMMA) break;
  5030. this.pos++;
  5031. this.consumeNewLines();
  5032. }
  5033. return list;
  5034. }
  5035. }, {
  5036. key: 'parseID',
  5037. value: function parseID() {
  5038. var token = this.getToken();
  5039. if (token.type !== this.lexerClass.ID) {
  5040. throw _syntaxErrorFactory.SyntaxErrorFactory.id_missing(token);
  5041. }
  5042. this.pos++;
  5043. if (this.insideScope(IVProgParser.FUNCTION)) {
  5044. if (token.text === _definedFunctions.LanguageDefinedFunction.getMainFunctionName()) {
  5045. return null;
  5046. }
  5047. }
  5048. return token.text;
  5049. }
  5050. }, {
  5051. key: 'parseMaybeLibID',
  5052. value: function parseMaybeLibID() {
  5053. var token = this.getToken();
  5054. if (token.type !== this.lexerClass.ID && token.type !== this.lexerClass.LIB_ID) {
  5055. throw _syntaxErrorFactory.SyntaxErrorFactory.id_missing(token);
  5056. }
  5057. this.pos++;
  5058. return token.text;
  5059. }
  5060. }, {
  5061. key: 'parseType',
  5062. value: function parseType() {
  5063. var token = this.getToken();
  5064. if (token.type === this.lexerClass.ID && this.insideScope(IVProgParser.FUNCTION)) {
  5065. return _types.Types.VOID;
  5066. } else if (token.type === this.lexerClass.RK_VOID && this.insideScope(IVProgParser.FUNCTION)) {
  5067. this.pos++;
  5068. return _types.Types.VOID;
  5069. } else if (this.isVariableType(token)) {
  5070. this.pos++;
  5071. switch (token.type) {
  5072. case this.lexerClass.RK_INTEGER:
  5073. return _types.Types.INTEGER;
  5074. case this.lexerClass.RK_BOOLEAN:
  5075. return _types.Types.BOOLEAN;
  5076. case this.lexerClass.RK_REAL:
  5077. return _types.Types.REAL;
  5078. case this.lexerClass.RK_STRING:
  5079. return _types.Types.STRING;
  5080. default:
  5081. break;
  5082. }
  5083. }
  5084. throw _syntaxErrorFactory.SyntaxErrorFactory.invalid_type(this.getTypeArray(), token);
  5085. }
  5086. }, {
  5087. key: 'parseCommandBlock',
  5088. value: function parseCommandBlock() {
  5089. var optionalCurly = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  5090. var variablesDecl = [];
  5091. var commands = [];
  5092. var hasOpen = false;
  5093. if (this.checkOpenCurly(optionalCurly)) {
  5094. this.pos++;
  5095. hasOpen = true;
  5096. }
  5097. this.consumeNewLines();
  5098. while (true) {
  5099. var cmd = this.parseCommand();
  5100. if (cmd === null) break;
  5101. if (cmd !== -1) {
  5102. if (cmd instanceof Array) {
  5103. variablesDecl = variablesDecl.concat(cmd);
  5104. } else {
  5105. commands.push(cmd);
  5106. }
  5107. }
  5108. }
  5109. this.consumeNewLines();
  5110. if (hasOpen) {
  5111. this.checkCloseCurly();
  5112. this.pos++;
  5113. this.consumeNewLines();
  5114. }
  5115. return new Commands.CommandBlock(variablesDecl, commands);
  5116. }
  5117. }, {
  5118. key: 'parseCommand',
  5119. value: function parseCommand() {
  5120. var token = this.getToken();
  5121. if (this.isVariableType(token)) {
  5122. if (!this.insideScope(IVProgParser.FUNCTION)) {
  5123. throw _syntaxErrorFactory.SyntaxErrorFactory.invalid_var_declaration(token.line);
  5124. }
  5125. this.pushScope(IVProgParser.BASE);
  5126. var varType = this.parseType();
  5127. this.popScope();
  5128. var cmd = this.parseDeclaration(varType);
  5129. this.checkEOS();
  5130. this.pos++;
  5131. return cmd;
  5132. } else if (token.type === this.lexerClass.ID) {
  5133. return this.parseIDCommand();
  5134. } else if (token.type === this.lexerClass.LIB_ID) {
  5135. return this.parseIDCommand();
  5136. } else if (token.type === this.lexerClass.RK_RETURN) {
  5137. return this.parseReturn();
  5138. } else if (token.type === this.lexerClass.RK_WHILE) {
  5139. return this.parseWhile();
  5140. } else if (token.type === this.lexerClass.RK_FOR) {
  5141. return this.parseFor();
  5142. } else if (token.type === this.lexerClass.RK_BREAK) {
  5143. if (!this.insideScope(IVProgParser.BREAKABLE)) {
  5144. throw _syntaxErrorFactory.SyntaxErrorFactory.invalid_break_command(this.lexer.literalNames[this.lexerClass.RK_BREAK], token);
  5145. }
  5146. return this.parseBreak();
  5147. } else if (token.type === this.lexerClass.RK_SWITCH) {
  5148. return this.parseSwitchCase();
  5149. } else if (token.type === this.lexerClass.RK_DO) {
  5150. return this.parseDoWhile();
  5151. } else if (token.type === this.lexerClass.RK_IF) {
  5152. return this.parseIfThenElse();
  5153. } else if (this.checkEOS(true)) {
  5154. this.pos++;
  5155. return -1;
  5156. } else {
  5157. return null;
  5158. }
  5159. }
  5160. }, {
  5161. key: 'parseSwitchCase',
  5162. value: function parseSwitchCase() {
  5163. this.pushScope(IVProgParser.BREAKABLE);
  5164. this.pos++;
  5165. this.checkOpenParenthesis();
  5166. this.pos++;
  5167. this.consumeNewLines();
  5168. var exp = this.parseExpressionOR();
  5169. this.consumeNewLines();
  5170. this.checkCloseParenthesis();
  5171. this.pos++;
  5172. this.consumeNewLines();
  5173. this.checkOpenCurly();
  5174. this.pos++;
  5175. this.consumeNewLines();
  5176. var casesList = this.parseCases();
  5177. this.consumeNewLines();
  5178. this.checkCloseCurly();
  5179. this.pos++;
  5180. this.consumeNewLines();
  5181. this.popScope();
  5182. return new Commands.Switch(exp, casesList);
  5183. }
  5184. }, {
  5185. key: 'parseDoWhile',
  5186. value: function parseDoWhile() {
  5187. this.pos++;
  5188. this.consumeNewLines();
  5189. this.pushScope(IVProgParser.BREAKABLE);
  5190. var commandsBlock = this.parseCommandBlock();
  5191. this.consumeNewLines(); //Maybe not...
  5192. var whileToken = this.getToken();
  5193. if (whileToken.type !== this.lexerClass.RK_WHILE) {
  5194. throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_one(this.lexer.literalNames[this.lexerClass.RK_WHILE], whileToken);
  5195. }
  5196. this.pos++;
  5197. this.checkOpenParenthesis();
  5198. this.pos++;
  5199. this.consumeNewLines();
  5200. var condition = this.parseExpressionOR();
  5201. this.consumeNewLines();
  5202. this.checkCloseParenthesis();
  5203. this.pos++;
  5204. this.checkEOS();
  5205. this.popScope();
  5206. return new Commands.DoWhile(condition, commandsBlock);
  5207. }
  5208. }, {
  5209. key: 'parseIfThenElse',
  5210. value: function parseIfThenElse() {
  5211. if (this.insideScope(IVProgParser.BREAKABLE)) {
  5212. this.pushScope(IVProgParser.BREAKABLE);
  5213. } else {
  5214. this.pushScope(IVProgParser.COMMAND);
  5215. }
  5216. this.pos++;
  5217. this.checkOpenParenthesis();
  5218. this.pos++;
  5219. this.consumeNewLines();
  5220. var logicalExpression = this.parseExpressionOR();
  5221. this.consumeNewLines();
  5222. this.checkCloseParenthesis();
  5223. this.pos++;
  5224. this.consumeNewLines();
  5225. var cmdBlocks = this.parseCommandBlock();
  5226. var maybeElse = this.getToken();
  5227. if (maybeElse.type === this.lexerClass.RK_ELSE) {
  5228. this.pos++;
  5229. this.consumeNewLines();
  5230. var maybeIf = this.getToken();
  5231. var elseBlock = null;
  5232. if (this.checkOpenCurly(true)) {
  5233. elseBlock = this.parseCommandBlock();
  5234. } else if (maybeIf.type === this.lexerClass.RK_IF) {
  5235. elseBlock = this.parseIfThenElse();
  5236. } else {
  5237. throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_list([this.lexer.literalNames[this.lexerClass.RK_IF], '{'], maybeIf);
  5238. }
  5239. return new Commands.IfThenElse(logicalExpression, cmdBlocks, elseBlock);
  5240. }
  5241. this.popScope();
  5242. return new Commands.IfThenElse(logicalExpression, cmdBlocks, null);
  5243. }
  5244. }, {
  5245. key: 'parseFor',
  5246. value: function parseFor() {
  5247. this.pushScope(IVProgParser.BREAKABLE);
  5248. this.pos++;
  5249. this.checkOpenParenthesis();
  5250. this.pos++;
  5251. this.consumeNewLines();
  5252. var attribution = this.parseForAssign();
  5253. this.consumeNewLines();
  5254. var condition = this.parseExpressionOR();
  5255. this.consumeForSemiColon();
  5256. var increment = this.parseForAssign(true);
  5257. this.checkCloseParenthesis();
  5258. this.pos++;
  5259. this.consumeNewLines();
  5260. var commandsBlock = this.parseCommandBlock();
  5261. this.popScope();
  5262. return new Commands.For(attribution, condition, increment, commandsBlock);
  5263. }
  5264. }, {
  5265. key: 'parseWhile',
  5266. value: function parseWhile() {
  5267. this.pushScope(IVProgParser.BREAKABLE);
  5268. this.pos++;
  5269. this.checkOpenParenthesis();
  5270. this.pos++;
  5271. this.consumeNewLines();
  5272. var logicalExpression = this.parseExpressionOR();
  5273. this.consumeNewLines();
  5274. this.checkCloseParenthesis();
  5275. this.pos++;
  5276. this.consumeNewLines();
  5277. var cmdBlocks = this.parseCommandBlock();
  5278. this.popScope();
  5279. return new Commands.While(logicalExpression, cmdBlocks);
  5280. }
  5281. }, {
  5282. key: 'parseBreak',
  5283. value: function parseBreak() {
  5284. this.pos++;
  5285. this.checkEOS();
  5286. this.pos++;
  5287. return new Commands.Break();
  5288. }
  5289. }, {
  5290. key: 'parseReturn',
  5291. value: function parseReturn() {
  5292. this.pos++;
  5293. var exp = null;
  5294. if (!this.checkEOS(true)) {
  5295. exp = this.parseExpressionOR();
  5296. this.checkEOS();
  5297. }
  5298. this.pos++;
  5299. return new Commands.Return(exp);
  5300. }
  5301. }, {
  5302. key: 'parseIDCommand',
  5303. value: function parseIDCommand() {
  5304. var refToken = this.getToken();
  5305. var isID = refToken.type === this.lexerClass.ID;
  5306. var id = this.parseMaybeLibID();
  5307. if (this.checkOpenBrace(true)) {
  5308. this.pos++;
  5309. var lineExpression = null;
  5310. var columnExpression = null;
  5311. this.consumeNewLines();
  5312. lineExpression = this.parseExpression();
  5313. this.consumeNewLines();
  5314. this.checkCloseBrace();
  5315. this.pos++;
  5316. if (this.checkOpenBrace(true)) {
  5317. this.pos++;
  5318. this.consumeNewLines();
  5319. columnExpression = this.parseExpression();
  5320. this.consumeNewLines();
  5321. this.checkCloseBrace();
  5322. this.pos++;
  5323. }
  5324. var equalToken = this.getToken();
  5325. if (equalToken.type !== this.lexerClass.EQUAL) {
  5326. throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_one('=', equalToken);
  5327. }
  5328. this.pos++;
  5329. var exp = this.parseExpressionOR();
  5330. this.checkEOS();
  5331. this.pos++;
  5332. var cmd = new Commands.ArrayIndexAssign(id, lineExpression, columnExpression, exp);
  5333. cmd.sourceInfo = _sourceInfo2.SourceInfo.createSourceInfo(equalToken);
  5334. return cmd;
  5335. }
  5336. var equalOrParenthesis = this.getToken();
  5337. if (isID && equalOrParenthesis.type === this.lexerClass.EQUAL) {
  5338. this.pos++;
  5339. var _exp = this.parseExpressionOR();
  5340. this.checkEOS();
  5341. this.pos++;
  5342. var _cmd = new Commands.Assign(id, _exp);
  5343. _cmd.sourceInfo = _sourceInfo2.SourceInfo.createSourceInfo(equalOrParenthesis);
  5344. return _cmd;
  5345. } else if (equalOrParenthesis.type === this.lexerClass.OPEN_PARENTHESIS) {
  5346. var funcCall = this.parseFunctionCallCommand(id);
  5347. this.checkEOS();
  5348. this.pos++;
  5349. return funcCall;
  5350. } else if (isID) {
  5351. throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_list(['=', '('], equalOrParenthesis);
  5352. } else {
  5353. throw _syntaxErrorFactory.SyntaxErrorFactory.invalid_id_format(refToken);
  5354. }
  5355. }
  5356. }, {
  5357. key: 'parseForAssign',
  5358. value: function parseForAssign() {
  5359. var isLast = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  5360. if (!isLast) this.consumeNewLines();
  5361. if (this.checkEOS(true)) {
  5362. return null;
  5363. }
  5364. var id = this.parseID();
  5365. var equal = this.getToken();
  5366. if (equal.type !== this.lexerClass.EQUAL) {
  5367. throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_one('=', equal);
  5368. }
  5369. this.pos++;
  5370. var exp = this.parseExpressionOR();
  5371. if (!isLast) {
  5372. this.consumeForSemiColon();
  5373. }
  5374. var sourceInfo = _sourceInfo2.SourceInfo.createSourceInfo(equal);
  5375. var cmd = new Commands.Assign(id, exp);
  5376. cmd.sourceInfo = sourceInfo;
  5377. return cmd;
  5378. }
  5379. }, {
  5380. key: 'parseCases',
  5381. value: function parseCases() {
  5382. var token = this.getToken();
  5383. if (token.type !== this.lexerClass.RK_CASE) {
  5384. throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_one(this.lexer.literalNames[this.lexerClass.RK_CASE], token);
  5385. }
  5386. this.pos++;
  5387. var nextToken = this.getToken();
  5388. if (nextToken.type === this.lexerClass.RK_DEFAULT) {
  5389. this.pos++;
  5390. var colonToken = this.getToken();
  5391. if (colonToken.type !== this.lexerClass.COLON) {
  5392. throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_one(':', colonToken);
  5393. }
  5394. this.pos++;
  5395. this.consumeNewLines();
  5396. var block = this.parseCommandBlock(true);
  5397. var defaultCase = new Commands.Case(null);
  5398. defaultCase.setCommands(block.commands);
  5399. return [defaultCase];
  5400. } else {
  5401. var exp = this.parseExpressionOR();
  5402. var _colonToken = this.getToken();
  5403. if (_colonToken.type !== this.lexerClass.COLON) {
  5404. throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_one(':', _colonToken);
  5405. }
  5406. this.pos++;
  5407. this.consumeNewLines();
  5408. var _block = this.parseCommandBlock(true);
  5409. var aCase = new Commands.Case(exp);
  5410. aCase.setCommands(_block.commands);
  5411. var caseToken = this.getToken();
  5412. if (caseToken.type === this.lexerClass.RK_CASE) {
  5413. return [aCase].concat(this.parseCases());
  5414. } else {
  5415. return [aCase];
  5416. }
  5417. }
  5418. }
  5419. /*
  5420. * Parses an Expression following the structure:
  5421. *
  5422. * EOR => EAnd ( 'or' EOR)? #expression and
  5423. *
  5424. * EOR => ENot ('and' EOR)? #expression or
  5425. *
  5426. * ENot => 'not'? ER #expression not
  5427. *
  5428. * ER => E ((>=, <=, ==, >, <) E)? #expression relational
  5429. *
  5430. * E => factor ((+, -) E)? #expression
  5431. *
  5432. * factor=> term ((*, /, %) factor)?
  5433. *
  5434. * term => literal || arrayAccess || FuncCall || ID || '('EAnd')'
  5435. **/
  5436. }, {
  5437. key: 'parseExpressionOR',
  5438. value: function parseExpressionOR() {
  5439. var exp1 = this.parseExpressionAND();
  5440. while (this.getToken().type === this.lexerClass.OR_OPERATOR) {
  5441. var opToken = this.getToken();
  5442. this.pos++;
  5443. var or = (0, _operators.convertFromString)('or');
  5444. this.consumeNewLines();
  5445. var exp2 = this.parseExpressionAND();
  5446. var _finalExp = new Expressions.InfixApp(or, exp1, exp2);
  5447. _finalExp.sourceInfo = _sourceInfo2.SourceInfo.createSourceInfo(opToken);
  5448. exp1 = _finalExp;
  5449. }
  5450. return exp1;
  5451. }
  5452. }, {
  5453. key: 'parseExpressionAND',
  5454. value: function parseExpressionAND() {
  5455. var exp1 = this.parseExpressionNot();
  5456. while (this.getToken().type === this.lexerClass.AND_OPERATOR) {
  5457. var opToken = this.getToken();
  5458. this.pos++;
  5459. var and = (0, _operators.convertFromString)('and');
  5460. this.consumeNewLines();
  5461. var exp2 = this.parseExpressionNot();
  5462. var _finalExp2 = new Expressions.InfixApp(and, exp1, exp2);
  5463. _finalExp2.sourceInfo = _sourceInfo2.SourceInfo.createSourceInfo(opToken);
  5464. exp1 = _finalExp2;
  5465. }
  5466. return exp1;
  5467. }
  5468. }, {
  5469. key: 'parseExpressionNot',
  5470. value: function parseExpressionNot() {
  5471. var maybeNotToken = this.getToken();
  5472. if (maybeNotToken.type === this.lexerClass.NOT_OPERATOR) {
  5473. var opToken = this.getToken();
  5474. this.pos++;
  5475. var not = (0, _operators.convertFromString)('not');
  5476. var exp1 = this.parseExpressionRel();
  5477. finalExp = new Expressions.UnaryApp(not, exp1);
  5478. finalExp.sourceInfo = _sourceInfo2.SourceInfo.createSourceInfo(opToken);
  5479. return finalExp;
  5480. } else {
  5481. return this.parseExpressionRel();
  5482. }
  5483. }
  5484. }, {
  5485. key: 'parseExpressionRel',
  5486. value: function parseExpressionRel() {
  5487. var exp1 = this.parseExpression();
  5488. while (this.getToken().type === this.lexerClass.RELATIONAL_OPERATOR) {
  5489. var relToken = this.getToken();
  5490. this.pos++;
  5491. var rel = (0, _operators.convertFromString)(relToken.text);
  5492. var exp2 = this.parseExpression();
  5493. var _finalExp3 = new Expressions.InfixApp(rel, exp1, exp2);
  5494. _finalExp3.sourceInfo = _sourceInfo2.SourceInfo.createSourceInfo(relToken);
  5495. exp1 = _finalExp3;
  5496. }
  5497. return exp1;
  5498. }
  5499. }, {
  5500. key: 'parseExpression',
  5501. value: function parseExpression() {
  5502. var factor = this.parseFactor();
  5503. while (this.getToken().type === this.lexerClass.SUM_OP) {
  5504. var sumOpToken = this.getToken();
  5505. this.pos++;
  5506. var op = (0, _operators.convertFromString)(sumOpToken.text);
  5507. var factor2 = this.parseFactor();
  5508. var _finalExp4 = new Expressions.InfixApp(op, factor, factor2);
  5509. _finalExp4.sourceInfo = _sourceInfo2.SourceInfo.createSourceInfo(sumOpToken);
  5510. factor = _finalExp4;
  5511. }
  5512. return factor;
  5513. }
  5514. }, {
  5515. key: 'parseFactor',
  5516. value: function parseFactor() {
  5517. var term = this.parseTerm();
  5518. while (this.getToken().type === this.lexerClass.MULTI_OP) {
  5519. var multOpToken = this.getToken();
  5520. this.pos++;
  5521. var op = (0, _operators.convertFromString)(multOpToken.text);
  5522. var term2 = this.parseTerm();
  5523. var _finalExp5 = new Expressions.InfixApp(op, term, term2);
  5524. _finalExp5.sourceInfo = _sourceInfo2.SourceInfo.createSourceInfo(multOpToken);
  5525. term = _finalExp5;
  5526. }
  5527. return term;
  5528. }
  5529. }, {
  5530. key: 'parseTerm',
  5531. value: function parseTerm() {
  5532. var token = this.getToken();
  5533. var sourceInfo = null;
  5534. switch (token.type) {
  5535. case this.lexerClass.SUM_OP:
  5536. this.pos++;
  5537. sourceInfo = _sourceInfo2.SourceInfo.createSourceInfo(token);
  5538. var exp = new Expressions.UnaryApp((0, _operators.convertFromString)(token.text), this.parseTerm());
  5539. exp.sourceInfo = sourceInfo;
  5540. return exp;
  5541. case this.lexerClass.INTEGER:
  5542. this.pos++;
  5543. return this.getIntLiteral(token);
  5544. case this.lexerClass.REAL:
  5545. this.pos++;
  5546. return this.getRealLiteral(token);
  5547. case this.lexerClass.STRING:
  5548. this.pos++;
  5549. return this.getStringLiteral(token);
  5550. case this.lexerClass.RK_TRUE:
  5551. case this.lexerClass.RK_FALSE:
  5552. this.pos++;
  5553. return this.getBoolLiteral(token);
  5554. case this.lexerClass.OPEN_CURLY:
  5555. return this.parseArrayLiteral();
  5556. case this.lexerClass.ID:
  5557. case this.lexerClass.LIB_ID:
  5558. return this.parseIDTerm();
  5559. case this.lexerClass.OPEN_PARENTHESIS:
  5560. return this.parseParenthesisExp();
  5561. default:
  5562. throw _syntaxErrorFactory.SyntaxErrorFactory.invalid_terminal(token);
  5563. }
  5564. }
  5565. }, {
  5566. key: 'parseIDTerm',
  5567. value: function parseIDTerm() {
  5568. var tokenA = this.getToken();
  5569. var id = this.parseMaybeLibID();
  5570. var isID = tokenA.type === this.lexerClass.ID;
  5571. if (isID && this.checkOpenBrace(true)) {
  5572. var tokenB = null;
  5573. this.pos++;
  5574. var firstIndex = this.parseExpression();
  5575. var secondIndex = null;
  5576. this.consumeNewLines();
  5577. this.checkCloseBrace();
  5578. tokenB = this.getToken();
  5579. this.pos++;
  5580. if (this.checkOpenBrace(true)) {
  5581. this.pos++;
  5582. secondIndex = this.parseExpression();
  5583. this.consumeNewLines();
  5584. this.checkCloseBrace();
  5585. tokenB = this.getToken();
  5586. this.pos++;
  5587. }
  5588. var sourceInfo = _sourceInfo2.SourceInfo.createSourceInfoFromList(tokenA, tokenB);
  5589. var exp = new Expressions.ArrayAccess(id, firstIndex, secondIndex);
  5590. exp.sourceInfo = sourceInfo;
  5591. return exp;
  5592. } else if (this.checkOpenParenthesis(true)) {
  5593. return this.parseFunctionCallExpression(id);
  5594. } else if (isID) {
  5595. var _sourceInfo = _sourceInfo2.SourceInfo.createSourceInfo(tokenA);
  5596. var _exp2 = new Expressions.VariableLiteral(id);
  5597. _exp2.sourceInfo = _sourceInfo;
  5598. return _exp2;
  5599. } else {
  5600. throw _syntaxErrorFactory.SyntaxErrorFactory.invalid_id_format(tokenA);
  5601. }
  5602. }
  5603. }, {
  5604. key: 'getFunctionName',
  5605. value: function getFunctionName(id) {
  5606. var name = _definedFunctions.LanguageDefinedFunction.getInternalName(id);
  5607. if (name === null) {
  5608. if (id === _definedFunctions.LanguageDefinedFunction.getMainFunctionName()) {
  5609. return null;
  5610. }
  5611. return id;
  5612. } else {
  5613. return name;
  5614. }
  5615. }
  5616. }, {
  5617. key: 'parseFunctionCallExpression',
  5618. value: function parseFunctionCallExpression(id) {
  5619. var tokenA = this.getToken(this.pos - 1);
  5620. var actualParameters = this.parseActualParameters();
  5621. var tokenB = this.getToken(this.pos - 1);
  5622. var funcName = this.getFunctionName(id);
  5623. var sourceInfo = _sourceInfo2.SourceInfo.createSourceInfoFromList(tokenA, tokenB);
  5624. var cmd = new Expressions.FunctionCall(funcName, actualParameters);
  5625. cmd.sourceInfo = sourceInfo;
  5626. return cmd;
  5627. }
  5628. }, {
  5629. key: 'parseFunctionCallCommand',
  5630. value: function parseFunctionCallCommand(id) {
  5631. return this.parseFunctionCallExpression(id);
  5632. }
  5633. }, {
  5634. key: 'parseParenthesisExp',
  5635. value: function parseParenthesisExp() {
  5636. this.checkOpenParenthesis();
  5637. var tokenA = this.getToken();
  5638. this.pos++;
  5639. this.consumeNewLines();
  5640. var exp = this.parseExpressionOR();
  5641. this.consumeNewLines();
  5642. this.checkCloseParenthesis();
  5643. var tokenB = this.getToken();
  5644. var sourceInfo = _sourceInfo2.SourceInfo.createSourceInfoFromList(tokenA, tokenB);
  5645. this.pos++;
  5646. exp.sourceInfo = sourceInfo;
  5647. return exp;
  5648. }
  5649. }, {
  5650. key: 'parseActualParameters',
  5651. value: function parseActualParameters() {
  5652. this.checkOpenParenthesis();
  5653. this.pos++;
  5654. if (this.checkCloseParenthesis(true)) {
  5655. this.pos++;
  5656. return [];
  5657. }
  5658. this.consumeNewLines();
  5659. var list = this.parseExpressionList();
  5660. this.consumeNewLines();
  5661. this.checkCloseParenthesis();
  5662. this.pos++;
  5663. return list;
  5664. }
  5665. }, {
  5666. key: 'parseExpressionList',
  5667. value: function parseExpressionList() {
  5668. var list = [];
  5669. while (true) {
  5670. var exp = this.parseExpressionOR();
  5671. list.push(exp);
  5672. var maybeToken = this.getToken();
  5673. if (maybeToken.type !== this.lexerClass.COMMA) {
  5674. break;
  5675. } else {
  5676. this.pos++;
  5677. this.consumeNewLines();
  5678. }
  5679. }
  5680. return list;
  5681. }
  5682. }, {
  5683. key: 'getTypeArray',
  5684. value: function getTypeArray() {
  5685. var _this = this;
  5686. var types = this.insideScope(IVProgParser.FUNCTION) ? this.functionTypes : this.variableTypes;
  5687. return types.map(function (x) {
  5688. return _this.lexer.literalNames[x];
  5689. });
  5690. }
  5691. }]);
  5692. return IVProgParser;
  5693. }();
  5694. /***/ }),
  5695. /***/ "./js/ast/operators.js":
  5696. /*!*****************************!*\
  5697. !*** ./js/ast/operators.js ***!
  5698. \*****************************/
  5699. /*! no static exports found */
  5700. /***/ (function(module, exports, __webpack_require__) {
  5701. "use strict";
  5702. Object.defineProperty(exports, "__esModule", {
  5703. value: true
  5704. });
  5705. exports.convertFromString = convertFromString;
  5706. var Operators = exports.Operators = Object.freeze({
  5707. ADD: { ord: 0, value: "+" },
  5708. SUB: { ord: 1, value: "-" },
  5709. MULT: { ord: 2, value: '*' },
  5710. DIV: { ord: 3, value: '/' },
  5711. MOD: { ord: 4, value: '%' },
  5712. GT: { ord: 5, value: '>' },
  5713. GE: { ord: 6, value: '>=' },
  5714. LT: { ord: 7, value: '<' },
  5715. LE: { ord: 8, value: '<=' },
  5716. EQ: { ord: 9, value: '==' },
  5717. NEQ: { ord: 10, value: '!=' },
  5718. AND: { ord: 11, value: 'and' },
  5719. OR: { ord: 12, value: 'or' },
  5720. NOT: { ord: 13, value: 'not' }
  5721. });
  5722. function convertFromString(op) {
  5723. switch (op) {
  5724. case '+':
  5725. return Operators.ADD;
  5726. case '-':
  5727. return Operators.SUB;
  5728. case '*':
  5729. return Operators.MULT;
  5730. case '/':
  5731. return Operators.DIV;
  5732. case '%':
  5733. return Operators.MOD;
  5734. case '>':
  5735. return Operators.GT;
  5736. case '>=':
  5737. return Operators.GE;
  5738. case '<':
  5739. return Operators.LT;
  5740. case '<=':
  5741. return Operators.LE;
  5742. case '==':
  5743. return Operators.EQ;
  5744. case '!=':
  5745. return Operators.NEQ;
  5746. case 'and':
  5747. return Operators.AND;
  5748. case 'or':
  5749. return Operators.OR;
  5750. case 'not':
  5751. return Operators.NOT;
  5752. }
  5753. }
  5754. /***/ }),
  5755. /***/ "./js/ast/sourceInfo.js":
  5756. /*!******************************!*\
  5757. !*** ./js/ast/sourceInfo.js ***!
  5758. \******************************/
  5759. /*! no static exports found */
  5760. /***/ (function(module, exports, __webpack_require__) {
  5761. "use strict";
  5762. Object.defineProperty(exports, "__esModule", {
  5763. value: true
  5764. });
  5765. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  5766. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  5767. var SourceInfo = exports.SourceInfo = function () {
  5768. _createClass(SourceInfo, null, [{
  5769. key: "createSourceInfo",
  5770. value: function createSourceInfo(token) {
  5771. return new SourceInfo(token.line, token.column, token.text.length);
  5772. }
  5773. }, {
  5774. key: "createSourceInfoFromList",
  5775. value: function createSourceInfoFromList(tokenA, tokenB) {
  5776. var line = tokenA.line;
  5777. var column = tokenA.column;
  5778. // copied from https://github.com/UNIVALI-LITE/Portugol-Studio/blob/master/core/src/main/java/br/univali/portugol/nucleo/analise/sintatica/Portugol.g
  5779. // No idea why...
  5780. var size = tokenB.tokenIndex + 1 - tokenA.tokenIndex;
  5781. return new SourceInfo(line, column, size);
  5782. }
  5783. }]);
  5784. function SourceInfo(line, column, size) {
  5785. _classCallCheck(this, SourceInfo);
  5786. this.line = line;
  5787. this.column = column;
  5788. this.size = size;
  5789. }
  5790. return SourceInfo;
  5791. }();
  5792. /***/ }),
  5793. /***/ "./js/io/domConsole.js":
  5794. /*!*****************************!*\
  5795. !*** ./js/io/domConsole.js ***!
  5796. \*****************************/
  5797. /*! no static exports found */
  5798. /***/ (function(module, exports, __webpack_require__) {
  5799. "use strict";
  5800. Object.defineProperty(exports, "__esModule", {
  5801. value: true
  5802. });
  5803. exports.DOMConsole = undefined;
  5804. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  5805. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  5806. var _jquery2 = _interopRequireDefault(_jquery);
  5807. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  5808. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  5809. var DOMConsole = exports.DOMConsole = function () {
  5810. _createClass(DOMConsole, null, [{
  5811. key: 'USER',
  5812. get: function get() {
  5813. return 0;
  5814. }
  5815. }, {
  5816. key: 'INFO',
  5817. get: function get() {
  5818. return 1;
  5819. }
  5820. }, {
  5821. key: 'ERR',
  5822. get: function get() {
  5823. return 2;
  5824. }
  5825. }]);
  5826. function DOMConsole(elementID) {
  5827. _classCallCheck(this, DOMConsole);
  5828. this.input = null;
  5829. this.needInput = false;
  5830. this.termDiv = null;
  5831. this.anyKey = false;
  5832. this.parent = (0, _jquery2.default)(elementID);
  5833. this.setup();
  5834. this.inputListeners = [];
  5835. }
  5836. _createClass(DOMConsole, [{
  5837. key: 'setup',
  5838. value: function setup() {
  5839. this._setupDom();
  5840. this._setupEvents();
  5841. }
  5842. }, {
  5843. key: '_setupEvents',
  5844. value: function _setupEvents() {
  5845. var _this = this;
  5846. this.input.on("keydown", function (event) {
  5847. if (!_this.needInput) {
  5848. event.preventDefault();
  5849. return;
  5850. }
  5851. var keyCode = event.which;
  5852. if (keyCode === 13 || _this.anyKey) {
  5853. var text = _this.input.val();
  5854. text = text.replace('[\n\r]+', '');
  5855. _this.notifyListeners(text);
  5856. _this.write(text);
  5857. _this.input.val("");
  5858. }
  5859. });
  5860. }
  5861. }, {
  5862. key: '_setupDom',
  5863. value: function _setupDom() {
  5864. this.termDiv = (0, _jquery2.default)("<div></div>");
  5865. this.termDiv.addClass("ivprog-term-div");
  5866. this.input = (0, _jquery2.default)('<input text="type">');
  5867. this.input.addClass("ivprog-term-input");
  5868. this.termDiv.append(this.input);
  5869. this.parent.append(this.termDiv);
  5870. }
  5871. }, {
  5872. key: 'notifyListeners',
  5873. value: function notifyListeners(text) {
  5874. this.inputListeners.forEach(function (resolve) {
  5875. return resolve(text);
  5876. });
  5877. this.inputListeners.splice(0, this.inputListeners.length);
  5878. this.hideInput();
  5879. this.anyKey = false;
  5880. }
  5881. }, {
  5882. key: 'write',
  5883. value: function write(text) {
  5884. this._appendText(text, DOMConsole.USER);
  5885. }
  5886. }, {
  5887. key: 'info',
  5888. value: function info(text) {
  5889. this._appendText(text, DOMConsole.INFO);
  5890. }
  5891. }, {
  5892. key: 'err',
  5893. value: function err(text) {
  5894. this._appendText(text, DOMConsole.ERR);
  5895. }
  5896. }, {
  5897. key: '_appendText',
  5898. value: function _appendText(text, type) {
  5899. var divClass = this.getClassForType(type);
  5900. var textDiv = (0, _jquery2.default)("<div></div>");
  5901. textDiv.addClass(divClass);
  5902. textDiv.append(text);
  5903. textDiv.insertBefore(this.input);
  5904. this.scrollTerm();
  5905. }
  5906. }, {
  5907. key: 'scrollTerm',
  5908. value: function scrollTerm() {
  5909. this.termDiv.animate({
  5910. scrollTop: this.termDiv.prop('scrollHeight')
  5911. }, 0);
  5912. }
  5913. }, {
  5914. key: 'getClassForType',
  5915. value: function getClassForType(type) {
  5916. switch (type) {
  5917. case DOMConsole.USER:
  5918. return "ivprog-term-userText";
  5919. case DOMConsole.INFO:
  5920. return "ivprog-term-info";
  5921. case DOMConsole.ERR:
  5922. return "ivprog-term-error";
  5923. }
  5924. }
  5925. }, {
  5926. key: 'dispose',
  5927. value: function dispose() {
  5928. this.parent.off();
  5929. this.input.off();
  5930. this.input = null;
  5931. this.parent.empty();
  5932. }
  5933. }, {
  5934. key: 'showInput',
  5935. value: function showInput() {
  5936. this.needInput = true;
  5937. this.input.show();
  5938. this.input.focus();
  5939. }
  5940. }, {
  5941. key: 'hideInput',
  5942. value: function hideInput() {
  5943. this.needInput = false;
  5944. this.input.hide();
  5945. }
  5946. }, {
  5947. key: 'requestInput',
  5948. value: function requestInput(callback) {
  5949. var anyKey = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  5950. this.inputListeners.push(callback);
  5951. this.anyKey = anyKey;
  5952. this.showInput();
  5953. }
  5954. }, {
  5955. key: 'sendOutput',
  5956. value: function sendOutput(text) {
  5957. var _this2 = this;
  5958. text.split("\n").forEach(function (t) {
  5959. t = t.replace(/\t/g, '&#9;');
  5960. _this2.write(t);
  5961. });
  5962. }
  5963. }, {
  5964. key: 'clear',
  5965. value: function clear() {
  5966. this.input.parent().children().not(this.input).remove();
  5967. this.input.val("");
  5968. }
  5969. }]);
  5970. return DOMConsole;
  5971. }();
  5972. /***/ }),
  5973. /***/ "./js/io/input.js":
  5974. /*!************************!*\
  5975. !*** ./js/io/input.js ***!
  5976. \************************/
  5977. /*! no static exports found */
  5978. /***/ (function(module, exports, __webpack_require__) {
  5979. "use strict";
  5980. Object.defineProperty(exports, "__esModule", {
  5981. value: true
  5982. });
  5983. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  5984. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  5985. var Input = exports.Input = function () {
  5986. function Input() {
  5987. _classCallCheck(this, Input);
  5988. }
  5989. _createClass(Input, [{
  5990. key: "requestInput",
  5991. value: function requestInput(callback) {
  5992. throw new Error("Must be implemented");
  5993. }
  5994. }]);
  5995. return Input;
  5996. }();
  5997. /***/ }),
  5998. /***/ "./js/io/output.js":
  5999. /*!*************************!*\
  6000. !*** ./js/io/output.js ***!
  6001. \*************************/
  6002. /*! no static exports found */
  6003. /***/ (function(module, exports, __webpack_require__) {
  6004. "use strict";
  6005. Object.defineProperty(exports, "__esModule", {
  6006. value: true
  6007. });
  6008. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  6009. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  6010. var Output = exports.Output = function () {
  6011. function Output() {
  6012. _classCallCheck(this, Output);
  6013. }
  6014. _createClass(Output, [{
  6015. key: "sendOutput",
  6016. value: function sendOutput(text) {
  6017. throw new Error("Must be implemented");
  6018. }
  6019. }]);
  6020. return Output;
  6021. }();
  6022. /***/ }),
  6023. /***/ "./js/main.js":
  6024. /*!********************!*\
  6025. !*** ./js/main.js ***!
  6026. \********************/
  6027. /*! no static exports found */
  6028. /***/ (function(module, exports, __webpack_require__) {
  6029. "use strict";
  6030. Object.defineProperty(exports, "__esModule", {
  6031. value: true
  6032. });
  6033. exports.i18n = exports.LocalizedStrings = exports.initVisualUI = exports.runner = undefined;
  6034. var _runner = __webpack_require__(/*! ./runner */ "./js/runner.js");
  6035. var _functions = __webpack_require__(/*! ./visualUI/functions */ "./js/visualUI/functions.js");
  6036. var _localizedStringsService = __webpack_require__(/*! ./services/localizedStringsService */ "./js/services/localizedStringsService.js");
  6037. var _i18nHelper = __webpack_require__(/*! ./services/i18nHelper */ "./js/services/i18nHelper.js");
  6038. var i18n = _i18nHelper.i18nHelper.i18n;
  6039. exports.runner = _runner.runner;
  6040. exports.initVisualUI = _functions.initVisualUI;
  6041. exports.LocalizedStrings = _localizedStringsService.LocalizedStrings;
  6042. exports.i18n = i18n;
  6043. /***/ }),
  6044. /***/ "./js/processor/compatibilityTable.js":
  6045. /*!********************************************!*\
  6046. !*** ./js/processor/compatibilityTable.js ***!
  6047. \********************************************/
  6048. /*! no static exports found */
  6049. /***/ (function(module, exports, __webpack_require__) {
  6050. "use strict";
  6051. Object.defineProperty(exports, "__esModule", {
  6052. value: true
  6053. });
  6054. exports.resultTypeAfterInfixOp = resultTypeAfterInfixOp;
  6055. exports.resultTypeAfterUnaryOp = resultTypeAfterUnaryOp;
  6056. var _types = __webpack_require__(/*! ./../typeSystem/types */ "./js/typeSystem/types.js");
  6057. var _operators = __webpack_require__(/*! ./../ast/operators */ "./js/ast/operators.js");
  6058. var _multiType = __webpack_require__(/*! ../typeSystem/multiType */ "./js/typeSystem/multiType.js");
  6059. function buildInfixAddTable() {
  6060. var table = [[], [], [], []];
  6061. table[_types.Types.INTEGER.ord][_types.Types.INTEGER.ord] = _types.Types.INTEGER;
  6062. table[_types.Types.INTEGER.ord][_types.Types.REAL.ord] = _types.Types.REAL;
  6063. table[_types.Types.INTEGER.ord][_types.Types.STRING.ord] = _types.Types.STRING;
  6064. table[_types.Types.REAL.ord][_types.Types.INTEGER.ord] = _types.Types.REAL;
  6065. table[_types.Types.REAL.ord][_types.Types.REAL.ord] = _types.Types.REAL;
  6066. table[_types.Types.REAL.ord][_types.Types.STRING.ord] = _types.Types.STRING;
  6067. table[_types.Types.STRING.ord][_types.Types.INTEGER.ord] = _types.Types.STRING;
  6068. table[_types.Types.STRING.ord][_types.Types.REAL.ord] = _types.Types.STRING;
  6069. table[_types.Types.STRING.ord][_types.Types.STRING.ord] = _types.Types.STRING;
  6070. table[_types.Types.STRING.ord][_types.Types.BOOLEAN.ord] = _types.Types.STRING;
  6071. return table;
  6072. }
  6073. function buildInfixMultiDivSubTable() {
  6074. var table = [[], [], [], []];
  6075. table[_types.Types.INTEGER.ord][_types.Types.INTEGER.ord] = _types.Types.INTEGER;
  6076. table[_types.Types.INTEGER.ord][_types.Types.REAL.ord] = _types.Types.REAL;
  6077. table[_types.Types.REAL.ord][_types.Types.INTEGER.ord] = _types.Types.REAL;
  6078. table[_types.Types.REAL.ord][_types.Types.REAL.ord] = _types.Types.REAL;
  6079. return table;
  6080. }
  6081. function buildInfixEqualityInequalityTable() {
  6082. var table = [[], [], [], []];
  6083. table[_types.Types.INTEGER.ord][_types.Types.INTEGER.ord] = _types.Types.BOOLEAN;
  6084. table[_types.Types.REAL.ord][_types.Types.REAL.ord] = _types.Types.BOOLEAN;
  6085. table[_types.Types.BOOLEAN.ord][_types.Types.BOOLEAN.ord] = _types.Types.BOOLEAN;
  6086. table[_types.Types.STRING.ord][_types.Types.STRING.ord] = _types.Types.BOOLEAN;
  6087. return table;
  6088. }
  6089. function buildInfixRelationalTable() {
  6090. var table = [[], [], [], []];
  6091. table[_types.Types.INTEGER.ord][_types.Types.INTEGER.ord] = _types.Types.BOOLEAN;
  6092. table[_types.Types.REAL.ord][_types.Types.REAL.ord] = _types.Types.BOOLEAN;
  6093. table[_types.Types.STRING.ord][_types.Types.STRING.ord] = _types.Types.BOOLEAN;
  6094. return table;
  6095. }
  6096. function buildInfixAndOrTable() {
  6097. var table = [[], [], [], []];
  6098. table[_types.Types.BOOLEAN.ord][_types.Types.BOOLEAN.ord] = _types.Types.BOOLEAN;
  6099. return table;
  6100. }
  6101. function buildInfixModTable() {
  6102. var table = [[], [], [], []];
  6103. table[_types.Types.INTEGER.ord][_types.Types.INTEGER.ord] = _types.Types.INTEGER;
  6104. return table;
  6105. }
  6106. function buildUnarySumSubList() {
  6107. var list = [];
  6108. list[_types.Types.INTEGER.ord] = _types.Types.INTEGER;
  6109. list[_types.Types.REAL.ord] = _types.Types.REAL;
  6110. return list;
  6111. }
  6112. function buildUnaryNegList() {
  6113. var list = [];
  6114. list[_types.Types.BOOLEAN.ord] = _types.Types.BOOLEAN;
  6115. return list;
  6116. }
  6117. function buildInfixCompatibilityTable() {
  6118. var compatibilityMap = new WeakMap();
  6119. compatibilityMap.set(_operators.Operators.ADD, buildInfixAddTable());
  6120. compatibilityMap.set(_operators.Operators.SUB, buildInfixMultiDivSubTable());
  6121. compatibilityMap.set(_operators.Operators.MULT, buildInfixMultiDivSubTable());
  6122. compatibilityMap.set(_operators.Operators.DIV, buildInfixMultiDivSubTable());
  6123. compatibilityMap.set(_operators.Operators.EQ, buildInfixEqualityInequalityTable());
  6124. compatibilityMap.set(_operators.Operators.NEQ, buildInfixEqualityInequalityTable());
  6125. compatibilityMap.set(_operators.Operators.GE, buildInfixRelationalTable());
  6126. compatibilityMap.set(_operators.Operators.GT, buildInfixRelationalTable());
  6127. compatibilityMap.set(_operators.Operators.LE, buildInfixRelationalTable());
  6128. compatibilityMap.set(_operators.Operators.LT, buildInfixRelationalTable());
  6129. compatibilityMap.set(_operators.Operators.OR, buildInfixAndOrTable());
  6130. compatibilityMap.set(_operators.Operators.AND, buildInfixAndOrTable());
  6131. compatibilityMap.set(_operators.Operators.MOD, buildInfixModTable());
  6132. return compatibilityMap;
  6133. }
  6134. function buildUnaryCompatibilityTable() {
  6135. var compatibilityMap = new WeakMap();
  6136. compatibilityMap.set(_operators.Operators.ADD, buildUnarySumSubList());
  6137. compatibilityMap.set(_operators.Operators.SUB, buildUnarySumSubList());
  6138. compatibilityMap.set(_operators.Operators.NOT, buildUnaryNegList());
  6139. return compatibilityMap;
  6140. }
  6141. var infixMap = buildInfixCompatibilityTable();
  6142. var unaryMap = buildUnaryCompatibilityTable();
  6143. function resultTypeAfterInfixOp(operator, leftExpressionType, rightExpressionType) {
  6144. try {
  6145. if (leftExpressionType instanceof _multiType.MultiType && rightExpressionType instanceof _multiType.MultiType) {
  6146. var newMulti = [];
  6147. for (var i = 0; i < leftExpressionType.types.length; i++) {
  6148. var element = leftExpressionType.types[i];
  6149. if (rightExpressionType.types.indexOf(element) !== -1) {
  6150. newMulti.push(element);
  6151. }
  6152. }
  6153. if (newMulti.length <= 0) {
  6154. return _types.Types.UNDEFINED;
  6155. } else {
  6156. return new _multiType.MultiType(newMulti);
  6157. }
  6158. } else if (leftExpressionType instanceof _multiType.MultiType) {
  6159. if (leftExpressionType.isCompatible(rightExpressionType)) {
  6160. return rightExpressionType;
  6161. } else {
  6162. return _types.Types.UNDEFINED;
  6163. }
  6164. } else if (rightExpressionType instanceof _multiType.MultiType) {
  6165. if (rightExpressionType.isCompatible(leftExpressionType)) {
  6166. return leftExpressionType;
  6167. } else {
  6168. return _types.Types.UNDEFINED;
  6169. }
  6170. }
  6171. var resultType = infixMap.get(operator)[leftExpressionType.ord][rightExpressionType.ord];
  6172. if (resultType === null || resultType === undefined) {
  6173. return _types.Types.UNDEFINED;
  6174. }
  6175. return resultType;
  6176. } catch (e) {
  6177. if (e instanceof TypeError) {
  6178. return _types.Types.UNDEFINED;
  6179. } else {
  6180. throw e;
  6181. }
  6182. }
  6183. }
  6184. function resultTypeAfterUnaryOp(operator, leftExpressionType) {
  6185. try {
  6186. if (leftExpressionType instanceof _multiType.MultiType) {
  6187. return leftExpressionType;
  6188. }
  6189. return unaryMap.get(operator)[leftExpressionType.ord];
  6190. } catch (e) {
  6191. if (e instanceof TypeError) {
  6192. return _types.Types.UNDEFINED;
  6193. } else {
  6194. throw e;
  6195. }
  6196. }
  6197. }
  6198. /***/ }),
  6199. /***/ "./js/processor/context.js":
  6200. /*!*********************************!*\
  6201. !*** ./js/processor/context.js ***!
  6202. \*********************************/
  6203. /*! no static exports found */
  6204. /***/ (function(module, exports, __webpack_require__) {
  6205. "use strict";
  6206. Object.defineProperty(exports, "__esModule", {
  6207. value: true
  6208. });
  6209. var Context = exports.Context = Object.freeze({
  6210. BASE: Symbol('context:base'),
  6211. BREAKABLE: Symbol('context:breakable'),
  6212. FUNCTION: Symbol('context:function')
  6213. });
  6214. /***/ }),
  6215. /***/ "./js/processor/definedFunctions.js":
  6216. /*!******************************************!*\
  6217. !*** ./js/processor/definedFunctions.js ***!
  6218. \******************************************/
  6219. /*! no static exports found */
  6220. /***/ (function(module, exports, __webpack_require__) {
  6221. "use strict";
  6222. Object.defineProperty(exports, "__esModule", {
  6223. value: true
  6224. });
  6225. exports.LanguageDefinedFunction = undefined;
  6226. var _languageService = __webpack_require__(/*! ../services/languageService */ "./js/services/languageService.js");
  6227. var _io = __webpack_require__(/*! ./lib/io */ "./js/processor/lib/io.js");
  6228. var _strings = __webpack_require__(/*! ./lib/strings */ "./js/processor/lib/strings.js");
  6229. var _arrays = __webpack_require__(/*! ./lib/arrays */ "./js/processor/lib/arrays.js");
  6230. var _lang = __webpack_require__(/*! ./lib/lang */ "./js/processor/lib/lang.js");
  6231. var _math = __webpack_require__(/*! ./lib/math */ "./js/processor/lib/math.js");
  6232. function valueToKey(value, object) {
  6233. for (var key in object) {
  6234. if (object.hasOwnProperty(key)) {
  6235. if (object[key] === value) {
  6236. return key;
  6237. }
  6238. }
  6239. }
  6240. return null;
  6241. }
  6242. function concatObjects() {
  6243. var result = {};
  6244. for (var _len = arguments.length, objs = Array(_len), _key = 0; _key < _len; _key++) {
  6245. objs[_key] = arguments[_key];
  6246. }
  6247. for (var i = 0; i < objs.length; i++) {
  6248. var obj = objs[i];
  6249. for (var key in obj) {
  6250. if (obj.hasOwnProperty(key)) {
  6251. result[key] = obj[key];
  6252. }
  6253. }
  6254. }
  6255. return result;
  6256. }
  6257. var libsObject = {
  6258. $mathLib: {
  6259. $sin: (0, _math.createSinFun)(),
  6260. $cos: (0, _math.createCosFun)(),
  6261. $tan: (0, _math.createTanFun)(),
  6262. $sqrt: (0, _math.createSqrtFun)(),
  6263. $pow: (0, _math.createPowFun)(),
  6264. $log: (0, _math.createLogFun)(),
  6265. $abs: (0, _math.createAbsFun)(),
  6266. $negate: (0, _math.createNegateFun)(),
  6267. $invert: (0, _math.createInvertFun)(),
  6268. $max: (0, _math.createMaxFun)(),
  6269. $min: (0, _math.createMinFun)()
  6270. },
  6271. $ioLib: {
  6272. $read: (0, _io.createInputFun)(),
  6273. $write: (0, _io.createOutputFun)()
  6274. },
  6275. $strLib: {
  6276. $substring: (0, _strings.createSubstringFun)(),
  6277. $length: (0, _strings.createLengthFun)(),
  6278. $uppercase: (0, _strings.createUppercaseFun)(),
  6279. $lowercase: (0, _strings.createLowercaseFun)(),
  6280. $charAt: (0, _strings.createrCharAtFun)()
  6281. },
  6282. $arrayLib: {
  6283. $numElements: (0, _arrays.createNumElementsFun)(),
  6284. $matrixLines: (0, _arrays.createMatrixLinesFun)(),
  6285. $matrixColumns: (0, _arrays.createMatrixColumnsFun)()
  6286. },
  6287. $langLib: {
  6288. $isReal: (0, _lang.createIsRealFun)(),
  6289. $isInt: (0, _lang.createIsIntFun)(),
  6290. $isBool: (0, _lang.createIsBoolFun)(),
  6291. $castReal: (0, _lang.createCastRealFun)(),
  6292. $castInt: (0, _lang.createCastIntFun)(),
  6293. $castBool: (0, _lang.createCastBoolFun)(),
  6294. $castString: (0, _lang.createCastStringFun)()
  6295. }
  6296. };
  6297. var funcsObject = concatObjects(libsObject.$ioLib, libsObject.$langLib, libsObject.$strLib, libsObject.$arrayLib);
  6298. var LanguageDefinedFunction = exports.LanguageDefinedFunction = Object.freeze({
  6299. getMainFunctionName: function getMainFunctionName() {
  6300. return _languageService.LanguageService.getCurrentLangFuncs().main_function;
  6301. },
  6302. getInternalName: function getInternalName(localName) {
  6303. if (localName.indexOf(".") !== -1) {
  6304. var names = localName.split(".");
  6305. var lib = valueToKey(names[0], _languageService.LanguageService.getCurrentLangLibs());
  6306. var internalName = valueToKey(names[1], _languageService.LanguageService.getCurrentLangFuncs());
  6307. if (lib === null || internalName === null) {
  6308. return null;
  6309. }
  6310. return lib + "." + internalName;
  6311. }
  6312. var funcName = valueToKey(localName, _languageService.LanguageService.getCurrentLangFuncs());
  6313. if (funcName !== null) {
  6314. if (funcsObject[funcName]) {
  6315. return funcName;
  6316. }
  6317. }
  6318. return null;
  6319. },
  6320. getFunction: function getFunction(internalName) {
  6321. if (internalName.indexOf(".") !== -1) {
  6322. var names = internalName.split(".");
  6323. var libName = names[0];
  6324. var funName = names[1];
  6325. return libsObject[libName][funName];
  6326. }
  6327. return funcsObject[internalName];
  6328. },
  6329. getLocalName: function getLocalName(internalName) {
  6330. if (internalName.indexOf(".") !== -1) {
  6331. var names = internalName.split(".");
  6332. var libName = _languageService.LanguageService.getCurrentLangLibs()[names[0]];
  6333. var funName = _languageService.LanguageService.getCurrentLangFuncs()[names[1]];
  6334. return libName + '.' + funName;
  6335. } else if (_languageService.LanguageService.getCurrentLangFuncs()[internalName]) {
  6336. return _languageService.LanguageService.getCurrentLangFuncs()[internalName];
  6337. } else {
  6338. return internalName;
  6339. }
  6340. }
  6341. });
  6342. /***/ }),
  6343. /***/ "./js/processor/error/processorErrorFactory.js":
  6344. /*!*****************************************************!*\
  6345. !*** ./js/processor/error/processorErrorFactory.js ***!
  6346. \*****************************************************/
  6347. /*! no static exports found */
  6348. /***/ (function(module, exports, __webpack_require__) {
  6349. "use strict";
  6350. Object.defineProperty(exports, "__esModule", {
  6351. value: true
  6352. });
  6353. exports.ProcessorErrorFactory = undefined;
  6354. var _runtimeError = __webpack_require__(/*! ./runtimeError */ "./js/processor/error/runtimeError.js");
  6355. var _semanticError = __webpack_require__(/*! ./semanticError */ "./js/processor/error/semanticError.js");
  6356. var _localizedStringsService = __webpack_require__(/*! ./../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  6357. var _operators = __webpack_require__(/*! ../../ast/operators */ "./js/ast/operators.js");
  6358. function translateType(type, dim) {
  6359. switch (dim) {
  6360. case 0:
  6361. return _localizedStringsService.LocalizedStrings.getUI(type);
  6362. default:
  6363. var transType = _localizedStringsService.LocalizedStrings.getUI(type);
  6364. if (dim === 1) return _localizedStringsService.LocalizedStrings.getUI("vector_string", [transType]);else return _localizedStringsService.LocalizedStrings.getUI("matrix_string", [transType]);
  6365. }
  6366. }
  6367. function translateOp(op) {
  6368. switch (op.ord) {
  6369. case _operators.Operators.AND.ord:
  6370. case _operators.Operators.OR.ord:
  6371. case _operators.Operators.NOT.ord:
  6372. return _localizedStringsService.LocalizedStrings.getUI(op.value);
  6373. default:
  6374. return op.value;
  6375. }
  6376. }
  6377. var ProcessorErrorFactory = exports.ProcessorErrorFactory = Object.freeze({
  6378. symbol_not_found_full: function symbol_not_found_full(id, sourceInfo) {
  6379. if (sourceInfo) {
  6380. var context = [id, sourceInfo.line, sourceInfo.column];
  6381. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("symbol_not_found_full", context));
  6382. } else {
  6383. return ProcessorErrorFactory.symbol_not_found(id);
  6384. }
  6385. },
  6386. symbol_not_found: function symbol_not_found(id) {
  6387. var context = [id];
  6388. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("symbol_not_found", context));
  6389. },
  6390. function_missing_full: function function_missing_full(id, sourceInfo) {
  6391. if (sourceInfo) {
  6392. var context = [id, sourceInfo.line, sourceInfo.column];
  6393. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("function_missing_full", context));
  6394. } else {
  6395. return ProcessorErrorFactory.function_missing(id);
  6396. }
  6397. },
  6398. function_missing: function function_missing(id) {
  6399. var context = [id];
  6400. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("function_missing", context));
  6401. },
  6402. main_missing: function main_missing() {
  6403. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("main_missing"));
  6404. }, // TODO: better urgent error message
  6405. array_dimension_not_int_full: function array_dimension_not_int_full(sourceInfo) {
  6406. if (sourceInfo) {
  6407. var context = [sourceInfo.line];
  6408. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("array_dimension_not_int_full", context));
  6409. } else {
  6410. return ProcessorErrorFactory.array_dimension_not_int();
  6411. }
  6412. },
  6413. array_dimension_not_int: function array_dimension_not_int() {
  6414. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("array_dimension_not_int"));
  6415. },
  6416. unknown_command_full: function unknown_command_full(sourceInfo) {
  6417. if (sourceInfo) {
  6418. var context = [sourceInfo.line];
  6419. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("unknown_command_full", context));
  6420. } else {
  6421. return ProcessorErrorFactory.unknown_command();
  6422. }
  6423. },
  6424. unknown_command: function unknown_command() {
  6425. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("unknown_command"));
  6426. },
  6427. incompatible_types_full: function incompatible_types_full(type, dim, sourceInfo) {
  6428. if (sourceInfo) {
  6429. var context = [translateType(type, dim), sourceInfo.line, sourceInfo.column];
  6430. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("incompatible_types_full", context));
  6431. } else {
  6432. return ProcessorErrorFactory.incompatible_types(type, dim);
  6433. }
  6434. },
  6435. incompatible_types: function incompatible_types(type, dim) {
  6436. var context = [translateType(type, dim)];
  6437. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("incompatible_types", context));
  6438. },
  6439. incompatible_types_array_full: function incompatible_types_array_full(exp, type, dim, sourceInfo) {
  6440. if (sourceInfo) {
  6441. var context = [exp, translateType(type, dim), sourceInfo.line, sourceInfo.column];
  6442. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("incompatible_types_array_full", context));
  6443. } else {
  6444. return ProcessorErrorFactory.incompatible_types_array(exp, type, dim);
  6445. }
  6446. },
  6447. incompatible_types_array: function incompatible_types_array(exp, type, dim) {
  6448. var context = [exp, translateType(type, dim)];
  6449. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("incompatible_types_array", context));
  6450. },
  6451. loop_condition_type_full: function loop_condition_type_full(sourceInfo) {
  6452. if (sourceInfo) {
  6453. var context = [sourceInfo.line, sourceInfo.column];
  6454. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("loop_condition_type_full", context));
  6455. } else {
  6456. return ProcessorErrorFactory.loop_condition_type();
  6457. }
  6458. },
  6459. loop_condition_type: function loop_condition_type() {
  6460. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("loop_condition_type"));
  6461. },
  6462. endless_loop_full: function endless_loop_full(sourceInfo) {
  6463. if (sourceInfo) {
  6464. var context = [sourceInfo.line];
  6465. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("endless_loop_full", context));
  6466. } else {
  6467. return ProcessorErrorFactory.endless_loop();
  6468. }
  6469. },
  6470. endless_loop: function endless_loop() {
  6471. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("endless_loop"));
  6472. },
  6473. for_condition_type_full: function for_condition_type_full(sourceInfo) {
  6474. if (sourceInfo) {
  6475. var context = [sourceInfo.line, sourceInfo.column];
  6476. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("for_condition_type_full", context));
  6477. } else {
  6478. return ProcessorErrorFactory.for_condition_type();
  6479. }
  6480. },
  6481. for_condition_type: function for_condition_type() {
  6482. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("for_condition_type"));
  6483. },
  6484. if_condition_type_full: function if_condition_type_full(sourceInfo) {
  6485. if (sourceInfo) {
  6486. var context = [sourceInfo.line, sourceInfo.column];
  6487. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("if_condition_type_full", context));
  6488. } else {
  6489. return ProcessorErrorFactory.if_condition_type();
  6490. }
  6491. },
  6492. if_condition_type: function if_condition_type() {
  6493. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("if_condition_type"));
  6494. },
  6495. invalid_global_var: function invalid_global_var() {
  6496. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("invalid_global_var"));
  6497. },
  6498. not_implemented: function not_implemented(id) {
  6499. var context = [id];
  6500. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("not_implemented", context));
  6501. },
  6502. invalid_case_type_full: function invalid_case_type_full(exp, type, dim, sourceInfo) {
  6503. if (sourceInfo) {
  6504. var context = [exp, translateType(type, dim), sourceInfo.line, sourceInfo.column];
  6505. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("invalid_case_type_full", context));
  6506. } else {
  6507. return ProcessorErrorFactory.invalid_case_type(exp, type, dim);
  6508. }
  6509. },
  6510. invalid_case_type: function invalid_case_type(exp, type, dim) {
  6511. var context = [exp, translateType(type, dim)];
  6512. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("invalid_case_type", context));
  6513. },
  6514. void_in_expression_full: function void_in_expression_full(id, sourceInfo) {
  6515. if (sourceInfo) {
  6516. var context = [sourceInfo.line, sourceInfo.column, id];
  6517. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("void_in_expression_full", context));
  6518. } else {
  6519. return ProcessorErrorFactory.void_in_expression(id);
  6520. }
  6521. },
  6522. void_in_expression: function void_in_expression(id) {
  6523. var context = [id];
  6524. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("void_in_expression", context));
  6525. },
  6526. invalid_array_access_full: function invalid_array_access_full(id, sourceInfo) {
  6527. if (sourceInfo) {
  6528. var context = [id, sourceInfo.line, sourceInfo.column];
  6529. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("invalid_array_access_full", context));
  6530. } else {
  6531. return ProcessorErrorFactory.invalid_array_access(id);
  6532. }
  6533. },
  6534. invalid_array_access: function invalid_array_access(id) {
  6535. var context = [id];
  6536. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("invalid_array_access", context));
  6537. },
  6538. invalid_matrix_access_full: function invalid_matrix_access_full(id, sourceInfo) {
  6539. if (sourceInfo) {
  6540. var context = [id, sourceInfo.line, sourceInfo.column];
  6541. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("invalid_matrix_access_full", context));
  6542. } else {
  6543. return ProcessorErrorFactory.invalid_matrix_access(id);
  6544. }
  6545. },
  6546. invalid_matrix_access: function invalid_matrix_access(id) {
  6547. var context = [id];
  6548. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("invalid_matrix_access", context));
  6549. },
  6550. matrix_column_outbounds_full: function matrix_column_outbounds_full(id, value, columns, sourceInfo) {
  6551. if (sourceInfo) {
  6552. var context = [sourceInfo.line, value, id, columns];
  6553. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("matrix_column_outbounds_full", context));
  6554. } else {
  6555. return ProcessorErrorFactory.matrix_column_outbounds(id, value, columns);
  6556. }
  6557. },
  6558. matrix_column_outbounds: function matrix_column_outbounds(id, value, columns) {
  6559. var context = [value, id, columns];
  6560. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("matrix_column_outbounds", context));
  6561. },
  6562. matrix_line_outbounds_full: function matrix_line_outbounds_full(id, value, lines, sourceInfo) {
  6563. if (sourceInfo) {
  6564. var context = [sourceInfo.line, value, id, lines];
  6565. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("matrix_line_outbounds_full", context));
  6566. } else {
  6567. return ProcessorErrorFactory.matrix_line_outbounds(id, value, lines);
  6568. }
  6569. },
  6570. matrix_line_outbounds: function matrix_line_outbounds(id, value, lines) {
  6571. var context = [value, id, lines];
  6572. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("matrix_line_outbounds", context));
  6573. },
  6574. vector_line_outbounds_full: function vector_line_outbounds_full(id, value, lines, sourceInfo) {
  6575. if (sourceInfo) {
  6576. var context = [sourceInfo.line, value, id, lines];
  6577. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("vector_line_outbounds_full", context));
  6578. } else {
  6579. return ProcessorErrorFactory.vector_line_outbounds(id, value, lines);
  6580. }
  6581. },
  6582. vector_line_outbounds: function vector_line_outbounds(id, value, lines) {
  6583. var context = [value, id, lines];
  6584. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("vector_line_outbounds", context));
  6585. },
  6586. vector_not_matrix_full: function vector_not_matrix_full(id, sourceInfo) {
  6587. if (sourceInfo) {
  6588. var context = [sourceInfo.line, id];
  6589. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("vector_not_matrix_full", context));
  6590. } else {
  6591. return ProcessorErrorFactory.vector_not_matrix(id);
  6592. }
  6593. },
  6594. vector_not_matrix: function vector_not_matrix(id) {
  6595. var context = [id];
  6596. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("vector_not_matrix", context));
  6597. },
  6598. function_no_return: function function_no_return(id) {
  6599. var context = [id];
  6600. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("function_no_return", context));
  6601. },
  6602. invalid_void_return_full: function invalid_void_return_full(id, type, dim, sourceInfo) {
  6603. if (sourceInfo) {
  6604. var context = [sourceInfo.line, id, translateType(type, dim)];
  6605. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("invalid_void_return_full", context));
  6606. } else {
  6607. return ProcessorErrorFactory.invalid_void_return(id, type, dim);
  6608. }
  6609. },
  6610. invalid_void_return: function invalid_void_return(id, type, dim) {
  6611. var context = [id, translateType(type, dim)];
  6612. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("invalid_void_return_full", context));
  6613. },
  6614. invalid_return_type_full: function invalid_return_type_full(id, type, dim, sourceInfo) {
  6615. if (sourceInfo) {
  6616. var context = [sourceInfo.line, id, translateType(type, dim)];
  6617. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("invalid_return_type_full", context));
  6618. } else {
  6619. return ProcessorErrorFactory.invalid_return_type(id, type, dim);
  6620. }
  6621. },
  6622. invalid_return_type: function invalid_return_type(id, type, dim) {
  6623. var context = [id, translateType(type, dim)];
  6624. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("invalid_return_type", context));
  6625. },
  6626. invalid_parameters_size_full: function invalid_parameters_size_full(id, expected, actual, sourceInfo) {
  6627. if (sourceInfo) {
  6628. var context = [sourceInfo.line, id, expected, actual];
  6629. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("invalid_parameters_size_full", context));
  6630. } else {
  6631. return ProcessorErrorFactory.invalid_parameters_size(id, expected, actual);
  6632. }
  6633. },
  6634. invalid_parameters_size: function invalid_parameters_size(id, expected, actual) {
  6635. var context = [id, expected, actual];
  6636. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("invalid_parameters_size", context));
  6637. },
  6638. invalid_parameter_type_full: function invalid_parameter_type_full(id, exp, sourceInfo) {
  6639. if (sourceInfo) {
  6640. var context = [exp, id, sourceInfo.line];
  6641. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("invalid_parameter_type_full", context));
  6642. } else {
  6643. return ProcessorErrorFactory.invalid_parameter_type(id, exp);
  6644. }
  6645. },
  6646. invalid_parameter_type: function invalid_parameter_type(id, exp) {
  6647. var context = [exp, id];
  6648. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("invalid_parameter_type_full", context));
  6649. },
  6650. invalid_ref_full: function invalid_ref_full(id, exp, sourceInfo) {
  6651. if (sourceInfo) {
  6652. var context = [exp, id, sourceInfo.line];
  6653. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("invalid_ref_full", context));
  6654. } else {
  6655. return ProcessorErrorFactory.invalid_ref(id, exp);
  6656. }
  6657. },
  6658. invalid_ref: function invalid_ref(id, exp) {
  6659. var context = [exp, id];
  6660. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("invalid_ref", context));
  6661. },
  6662. unexpected_break_command_full: function unexpected_break_command_full(sourceInfo) {
  6663. if (sourceInfo) {
  6664. var context = [sourceInfo.line];
  6665. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("unexpected_break_command_full", context));
  6666. } else {
  6667. return ProcessorErrorFactory.unexpected_break_command();
  6668. }
  6669. },
  6670. unexpected_break_command: function unexpected_break_command() {
  6671. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("unexpected_break_command"));
  6672. },
  6673. invalid_array_literal_type_full: function invalid_array_literal_type_full(exp, sourceInfo) {
  6674. if (sourceInfo) {
  6675. var context = [sourceInfo.line, exp];
  6676. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("invalid_array_literal_type_full", context));
  6677. } else {
  6678. return ProcessorErrorFactory.invalid_array_literal_type(exp);
  6679. }
  6680. },
  6681. invalid_array_literal_type: function invalid_array_literal_type(exp) {
  6682. var context = [exp];
  6683. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("invalid_array_literal_type", context));
  6684. },
  6685. invalid_array_literal_line_full: function invalid_array_literal_line_full(expected, actual, sourceInfo) {
  6686. if (sourceInfo) {
  6687. var context = [sourceInfo.line, expected, actual];
  6688. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("invalid_array_literal_line_full", context));
  6689. } else {
  6690. return ProcessorErrorFactory.invalid_array_literal_type(expected, actual);
  6691. }
  6692. },
  6693. invalid_array_literal_line: function invalid_array_literal_line(expected, actual) {
  6694. var context = [expected, actual];
  6695. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("invalid_array_literal_line", context));
  6696. },
  6697. invalid_array_literal_column_full: function invalid_array_literal_column_full(expected, actual, sourceInfo) {
  6698. if (sourceInfo) {
  6699. var context = [sourceInfo.line, expected, actual];
  6700. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("invalid_array_literal_column_full", context));
  6701. } else {
  6702. return ProcessorErrorFactory.invalid_array_literal_column(expected, actual);
  6703. }
  6704. },
  6705. invalid_array_literal_column: function invalid_array_literal_column(expected, actual) {
  6706. var context = [expected, actual];
  6707. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("invalid_array_literal_column", context));
  6708. },
  6709. invalid_unary_op_full: function invalid_unary_op_full(opName, type, dim, sourceInfo) {
  6710. if (sourceInfo) {
  6711. var context = [sourceInfo.line, translateOp(opName), translateType(type, dim)];
  6712. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("invalid_unary_op_full", context));
  6713. } else {
  6714. return ProcessorErrorFactory.invalid_unary_op(opName, type, dim);
  6715. }
  6716. },
  6717. invalid_unary_op: function invalid_unary_op(opName, type, dim) {
  6718. var context = [translateOp(opName), translateType(type, dim)];
  6719. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("invalid_unary_op", context));
  6720. },
  6721. invalid_infix_op_full: function invalid_infix_op_full(opName, typeLeft, dimLeft, typeRight, dimRight, sourceInfo) {
  6722. if (sourceInfo) {
  6723. var context = [sourceInfo.line, translateOp(opName), translateType(typeLeft, dimLeft), translateType(typeRight, dimRight)];
  6724. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("invalid_infix_op_full", context));
  6725. } else {
  6726. return ProcessorErrorFactory.invalid_infix_op(opName, typeLeft, dimLeft, typeRight, dimRight);
  6727. }
  6728. },
  6729. invalid_infix_op: function invalid_infix_op(opName, typeLeft, dimLeft, typeRight, dimRight) {
  6730. var context = [translateOp(opName), translateType(typeLeft, dimLeft), translateType(typeRight, dimRight)];
  6731. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("invalid_infix_op", context));
  6732. },
  6733. array_dimension_not_positive_full: function array_dimension_not_positive_full(sourceInfo) {
  6734. if (sourceInfo) {
  6735. var context = [sourceInfo.line];
  6736. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("array_dimension_not_positive_full", context));
  6737. } else {
  6738. return ProcessorErrorFactory.array_dimension_not_positive();
  6739. }
  6740. },
  6741. array_dimension_not_positive: function array_dimension_not_positive() {
  6742. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("array_dimension_not_positive"));
  6743. }
  6744. });
  6745. /***/ }),
  6746. /***/ "./js/processor/error/runtimeError.js":
  6747. /*!********************************************!*\
  6748. !*** ./js/processor/error/runtimeError.js ***!
  6749. \********************************************/
  6750. /*! no static exports found */
  6751. /***/ (function(module, exports, __webpack_require__) {
  6752. "use strict";
  6753. Object.defineProperty(exports, "__esModule", {
  6754. value: true
  6755. });
  6756. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  6757. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  6758. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  6759. var RuntimeError = exports.RuntimeError = function (_Error) {
  6760. _inherits(RuntimeError, _Error);
  6761. function RuntimeError() {
  6762. var _ref;
  6763. _classCallCheck(this, RuntimeError);
  6764. for (var _len = arguments.length, msg = Array(_len), _key = 0; _key < _len; _key++) {
  6765. msg[_key] = arguments[_key];
  6766. }
  6767. var _this = _possibleConstructorReturn(this, (_ref = RuntimeError.__proto__ || Object.getPrototypeOf(RuntimeError)).call.apply(_ref, [this].concat(msg)));
  6768. if (Error.captureStackTrace) Error.captureStackTrace(_this, RuntimeError);
  6769. return _this;
  6770. }
  6771. return RuntimeError;
  6772. }(Error);
  6773. /***/ }),
  6774. /***/ "./js/processor/error/semanticError.js":
  6775. /*!*********************************************!*\
  6776. !*** ./js/processor/error/semanticError.js ***!
  6777. \*********************************************/
  6778. /*! no static exports found */
  6779. /***/ (function(module, exports, __webpack_require__) {
  6780. "use strict";
  6781. Object.defineProperty(exports, "__esModule", {
  6782. value: true
  6783. });
  6784. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  6785. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  6786. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  6787. var SemanticError = exports.SemanticError = function (_Error) {
  6788. _inherits(SemanticError, _Error);
  6789. function SemanticError() {
  6790. var _ref;
  6791. _classCallCheck(this, SemanticError);
  6792. for (var _len = arguments.length, msg = Array(_len), _key = 0; _key < _len; _key++) {
  6793. msg[_key] = arguments[_key];
  6794. }
  6795. var _this = _possibleConstructorReturn(this, (_ref = SemanticError.__proto__ || Object.getPrototypeOf(SemanticError)).call.apply(_ref, [this].concat(msg)));
  6796. if (Error.captureStackTrace) Error.captureStackTrace(_this, SemanticError);
  6797. return _this;
  6798. }
  6799. return SemanticError;
  6800. }(Error);
  6801. /***/ }),
  6802. /***/ "./js/processor/ivprogProcessor.js":
  6803. /*!*****************************************!*\
  6804. !*** ./js/processor/ivprogProcessor.js ***!
  6805. \*****************************************/
  6806. /*! no static exports found */
  6807. /***/ (function(module, exports, __webpack_require__) {
  6808. "use strict";
  6809. Object.defineProperty(exports, "__esModule", {
  6810. value: true
  6811. });
  6812. exports.IVProgProcessor = undefined;
  6813. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  6814. var _store = __webpack_require__(/*! ./store/store */ "./js/processor/store/store.js");
  6815. var _storeObject = __webpack_require__(/*! ./store/storeObject */ "./js/processor/store/storeObject.js");
  6816. var _storeObjectArray = __webpack_require__(/*! ./store/storeObjectArray */ "./js/processor/store/storeObjectArray.js");
  6817. var _storeObjectRef = __webpack_require__(/*! ./store/storeObjectRef */ "./js/processor/store/storeObjectRef.js");
  6818. var _modes = __webpack_require__(/*! ./modes */ "./js/processor/modes.js");
  6819. var _context = __webpack_require__(/*! ./context */ "./js/processor/context.js");
  6820. var _types = __webpack_require__(/*! ./../typeSystem/types */ "./js/typeSystem/types.js");
  6821. var _operators = __webpack_require__(/*! ./../ast/operators */ "./js/ast/operators.js");
  6822. var _definedFunctions = __webpack_require__(/*! ./definedFunctions */ "./js/processor/definedFunctions.js");
  6823. var _compatibilityTable = __webpack_require__(/*! ./compatibilityTable */ "./js/processor/compatibilityTable.js");
  6824. var _commands = __webpack_require__(/*! ./../ast/commands/ */ "./js/ast/commands/index.js");
  6825. var Commands = _interopRequireWildcard(_commands);
  6826. var _expressions = __webpack_require__(/*! ./../ast/expressions/ */ "./js/ast/expressions/index.js");
  6827. var Expressions = _interopRequireWildcard(_expressions);
  6828. var _storeObjectArrayAddress = __webpack_require__(/*! ./store/storeObjectArrayAddress */ "./js/processor/store/storeObjectArrayAddress.js");
  6829. var _storeObjectArrayAddressRef = __webpack_require__(/*! ./store/storeObjectArrayAddressRef */ "./js/processor/store/storeObjectArrayAddressRef.js");
  6830. var _compoundType = __webpack_require__(/*! ./../typeSystem/compoundType */ "./js/typeSystem/compoundType.js");
  6831. var _parsers = __webpack_require__(/*! ../typeSystem/parsers */ "./js/typeSystem/parsers.js");
  6832. var _config = __webpack_require__(/*! ../util/config */ "./js/util/config.js");
  6833. var _decimal = __webpack_require__(/*! decimal.js */ "./node_modules/decimal.js/decimal.js");
  6834. var _decimal2 = _interopRequireDefault(_decimal);
  6835. var _processorErrorFactory = __webpack_require__(/*! ./error/processorErrorFactory */ "./js/processor/error/processorErrorFactory.js");
  6836. var _runtimeError = __webpack_require__(/*! ./error/runtimeError */ "./js/processor/error/runtimeError.js");
  6837. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  6838. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  6839. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  6840. var IVProgProcessor = exports.IVProgProcessor = function () {
  6841. _createClass(IVProgProcessor, null, [{
  6842. key: 'LOOP_TIMEOUT',
  6843. get: function get() {
  6844. return _config.Config.loopTimeout;
  6845. },
  6846. set: function set(ms) {
  6847. _config.Config.setConfig({ loopTimeout: ms });
  6848. }
  6849. }, {
  6850. key: 'MAIN_INTERNAL_ID',
  6851. get: function get() {
  6852. return "$main";
  6853. }
  6854. }]);
  6855. function IVProgProcessor(ast) {
  6856. _classCallCheck(this, IVProgProcessor);
  6857. this.ast = ast;
  6858. this.globalStore = new _store.Store("$global");
  6859. this.stores = [this.globalStore];
  6860. this.context = [_context.Context.BASE];
  6861. this.input = null;
  6862. this.forceKill = false;
  6863. this.loopTimers = [];
  6864. this.output = null;
  6865. }
  6866. _createClass(IVProgProcessor, [{
  6867. key: 'registerInput',
  6868. value: function registerInput(input) {
  6869. if (this.input !== null) this.input = null;
  6870. this.input = input;
  6871. }
  6872. }, {
  6873. key: 'registerOutput',
  6874. value: function registerOutput(output) {
  6875. if (this.output !== null) this.output = null;
  6876. this.output = output;
  6877. }
  6878. }, {
  6879. key: 'checkContext',
  6880. value: function checkContext(context) {
  6881. return this.context[this.context.length - 1] === context;
  6882. }
  6883. }, {
  6884. key: 'ignoreSwitchCases',
  6885. value: function ignoreSwitchCases(store) {
  6886. if (store.mode === _modes.Modes.RETURN) {
  6887. return true;
  6888. } else if (store.mode === _modes.Modes.BREAK) {
  6889. return true;
  6890. } else {
  6891. return false;
  6892. }
  6893. }
  6894. }, {
  6895. key: 'prepareState',
  6896. value: function prepareState() {
  6897. if (this.stores !== null) {
  6898. for (var i = 0; i < this.stores.length; i++) {
  6899. delete this.stores[i];
  6900. }
  6901. this.stores = null;
  6902. }
  6903. if (this.globalStore !== null) this.globalStore = null;
  6904. this.globalStore = new _store.Store("$global");
  6905. this.stores = [this.globalStore];
  6906. this.context = [_context.Context.BASE];
  6907. }
  6908. }, {
  6909. key: 'interpretAST',
  6910. value: function interpretAST() {
  6911. this.prepareState();
  6912. this.initGlobal();
  6913. var mainFunc = this.findMainFunction();
  6914. if (mainFunc === null) {
  6915. throw _processorErrorFactory.ProcessorErrorFactory.main_missing();
  6916. }
  6917. return this.runFunction(mainFunc, [], this.globalStore);
  6918. }
  6919. }, {
  6920. key: 'initGlobal',
  6921. value: function initGlobal() {
  6922. var _this = this;
  6923. if (!this.checkContext(_context.Context.BASE)) {
  6924. throw _processorErrorFactory.ProcessorErrorFactory.invalid_global_var();
  6925. }
  6926. this.ast.global.forEach(function (decl) {
  6927. _this.executeCommand(_this.globalStore, decl).then(function (sto) {
  6928. return _this.globalStore = sto;
  6929. });
  6930. });
  6931. }
  6932. }, {
  6933. key: 'findMainFunction',
  6934. value: function findMainFunction() {
  6935. return this.ast.functions.find(function (v) {
  6936. return v.isMain;
  6937. });
  6938. }
  6939. }, {
  6940. key: 'findFunction',
  6941. value: function findFunction(name) {
  6942. if (name.match(/^\$.+$/)) {
  6943. var fun = _definedFunctions.LanguageDefinedFunction.getFunction(name);
  6944. if (!!!fun) {
  6945. throw _processorErrorFactory.ProcessorErrorFactory.not_implemented(name);
  6946. }
  6947. return fun;
  6948. } else {
  6949. var val = this.ast.functions.find(function (v) {
  6950. return v.name === name;
  6951. });
  6952. if (!!!val) {
  6953. // TODO: better error message;
  6954. throw _processorErrorFactory.ProcessorErrorFactory.function_missing(name);
  6955. }
  6956. return val;
  6957. }
  6958. }
  6959. }, {
  6960. key: 'runFunction',
  6961. value: function runFunction(func, actualParameters, store) {
  6962. var _this2 = this;
  6963. var funcName = func.isMain ? IVProgProcessor.MAIN_INTERNAL_ID : func.name;
  6964. var funcStore = new _store.Store(funcName);
  6965. funcStore.extendStore(this.globalStore);
  6966. var returnStoreObject = null;
  6967. if (func.returnType instanceof _compoundType.CompoundType) {
  6968. if (func.returnType.dimensions > 1) {
  6969. returnStoreObject = new _storeObjectArray.StoreObjectArray(func.returnType, -1, -1, [[]]);
  6970. } else {
  6971. returnStoreObject = new _storeObjectArray.StoreObjectArray(func.returnType, -1, null, []);
  6972. }
  6973. } else {
  6974. returnStoreObject = new _storeObject.StoreObject(func.returnType, null);
  6975. }
  6976. funcStore.insertStore('$', returnStoreObject);
  6977. var newFuncStore$ = this.associateParameters(func.formalParameters, actualParameters, store, funcStore);
  6978. return newFuncStore$.then(function (sto) {
  6979. _this2.context.push(_context.Context.FUNCTION);
  6980. _this2.stores.push(sto);
  6981. return _this2.executeCommands(sto, func.variablesDeclarations).then(function (stoWithVars) {
  6982. return _this2.executeCommands(stoWithVars, func.commands);
  6983. }).then(function (finalSto) {
  6984. _this2.stores.pop();
  6985. _this2.context.pop();
  6986. return finalSto;
  6987. });
  6988. });
  6989. }
  6990. }, {
  6991. key: 'associateParameters',
  6992. value: function associateParameters(formalList, actualList, callerStore, calleeStore) {
  6993. var _this3 = this;
  6994. var funcName = calleeStore.name === IVProgProcessor.MAIN_INTERNAL_ID ? _definedFunctions.LanguageDefinedFunction.getMainFunctionName() : calleeStore.name;
  6995. if (formalList.length != actualList.length) {
  6996. throw _processorErrorFactory.ProcessorErrorFactory.invalid_parameters_size(funcName, formalList.length, actualList.length);
  6997. }
  6998. var promises$ = actualList.map(function (actualParameter) {
  6999. return _this3.evaluateExpression(callerStore, actualParameter);
  7000. });
  7001. return Promise.all(promises$).then(function (values) {
  7002. for (var i = 0; i < values.length; i++) {
  7003. var stoObj = values[i];
  7004. var exp = actualList[i];
  7005. var formalParameter = formalList[i];
  7006. if (formalParameter.type.isCompatible(stoObj.type)) {
  7007. if (formalParameter.byRef && !stoObj.inStore) {
  7008. throw _processorErrorFactory.ProcessorErrorFactory.invalid_ref(funcName, exp.toString());
  7009. }
  7010. if (formalParameter.byRef) {
  7011. var ref = null;
  7012. if (stoObj instanceof _storeObjectArrayAddress.StoreObjectArrayAddress) {
  7013. ref = new _storeObjectArrayAddressRef.StoreObjectArrayAddressRef(stoObj);
  7014. } else {
  7015. ref = new _storeObjectRef.StoreObjectRef(stoObj.id, callerStore);
  7016. }
  7017. calleeStore.insertStore(formalParameter.id, ref);
  7018. } else {
  7019. var realValue = _this3.parseStoreObjectValue(stoObj);
  7020. calleeStore.insertStore(formalParameter.id, realValue);
  7021. }
  7022. } else {
  7023. throw _processorErrorFactory.ProcessorErrorFactory.invalid_parameter_type(funcName, exp.toString());
  7024. }
  7025. }
  7026. return calleeStore;
  7027. });
  7028. }
  7029. }, {
  7030. key: 'executeCommands',
  7031. value: function executeCommands(store, cmds) {
  7032. // helper to partially apply a function, in this case executeCommand
  7033. var outerRef = this;
  7034. var partial = function partial(fun, cmd) {
  7035. return function (sto) {
  7036. return fun(sto, cmd);
  7037. };
  7038. };
  7039. return cmds.reduce(function (lastCommand, next) {
  7040. var nextCommand = partial(outerRef.executeCommand.bind(outerRef), next);
  7041. return lastCommand.then(nextCommand);
  7042. }, Promise.resolve(store));
  7043. }
  7044. }, {
  7045. key: 'executeCommand',
  7046. value: function executeCommand(store, cmd) {
  7047. if (this.forceKill) {
  7048. return Promise.reject("FORCED_KILL!");
  7049. } else if (store.mode === _modes.Modes.PAUSE) {
  7050. return Promise.resolve(this.executeCommand(store, cmd));
  7051. } else if (store.mode === _modes.Modes.RETURN) {
  7052. return Promise.resolve(store);
  7053. } else if (this.checkContext(_context.Context.BREAKABLE) && store.mode === _modes.Modes.BREAK) {
  7054. return Promise.resolve(store);
  7055. }
  7056. if (cmd instanceof Commands.Declaration) {
  7057. return this.executeDeclaration(store, cmd);
  7058. } else if (cmd instanceof Commands.ArrayIndexAssign) {
  7059. return this.executeArrayIndexAssign(store, cmd);
  7060. } else if (cmd instanceof Commands.Assign) {
  7061. return this.executeAssign(store, cmd);
  7062. } else if (cmd instanceof Commands.Break) {
  7063. return this.executeBreak(store, cmd);
  7064. } else if (cmd instanceof Commands.Return) {
  7065. return this.executeReturn(store, cmd);
  7066. } else if (cmd instanceof Commands.IfThenElse) {
  7067. return this.executeIfThenElse(store, cmd);
  7068. } else if (cmd instanceof Commands.While) {
  7069. return this.executeWhile(store, cmd);
  7070. } else if (cmd instanceof Commands.DoWhile) {
  7071. return this.executeDoWhile(store, cmd);
  7072. } else if (cmd instanceof Commands.For) {
  7073. return this.executeFor(store, cmd);
  7074. } else if (cmd instanceof Commands.Switch) {
  7075. return this.executeSwitch(store, cmd);
  7076. } else if (cmd instanceof Expressions.FunctionCall) {
  7077. return this.executeFunctionCall(store, cmd);
  7078. } else if (cmd instanceof Commands.SysCall) {
  7079. return this.executeSysCall(store, cmd);
  7080. } else {
  7081. throw _processorErrorFactory.ProcessorErrorFactory.unknown_command(cmd.sourceInfo);
  7082. }
  7083. }
  7084. }, {
  7085. key: 'executeSysCall',
  7086. value: function executeSysCall(store, cmd) {
  7087. var func = cmd.langFunc.bind(this);
  7088. return func(store, cmd);
  7089. }
  7090. }, {
  7091. key: 'executeFunctionCall',
  7092. value: function executeFunctionCall(store, cmd) {
  7093. var func = null;
  7094. if (cmd.isMainCall) {
  7095. func = this.findMainFunction();
  7096. } else {
  7097. func = this.findFunction(cmd.id);
  7098. }
  7099. return this.runFunction(func, cmd.actualParameters, store).then(function (sto) {
  7100. if (!_types.Types.VOID.isCompatible(func.returnType) && sto.mode !== _modes.Modes.RETURN) {
  7101. var funcName = func.name === IVProgProcessor.MAIN_INTERNAL_ID ? _definedFunctions.LanguageDefinedFunction.getMainFunctionName() : func.name;
  7102. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.function_no_return(funcName));
  7103. } else {
  7104. return store;
  7105. }
  7106. });
  7107. }
  7108. }, {
  7109. key: 'executeSwitch',
  7110. value: function executeSwitch(store, cmd) {
  7111. var _this4 = this;
  7112. this.context.push(_context.Context.BREAKABLE);
  7113. var auxCaseFun = function auxCaseFun(promise, switchExp, aCase) {
  7114. return promise.then(function (result) {
  7115. var sto = result.sto;
  7116. if (_this4.ignoreSwitchCases(sto)) {
  7117. return Promise.resolve(result);
  7118. } else if (result.wasTrue || aCase.isDefault) {
  7119. var $newSto = _this4.executeCommands(result.sto, aCase.commands);
  7120. return $newSto.then(function (nSto) {
  7121. return Promise.resolve({ wasTrue: true, sto: nSto });
  7122. });
  7123. } else {
  7124. var $value = _this4.evaluateExpression(sto, new Expressions.InfixApp(_operators.Operators.EQ, switchExp, aCase.expression));
  7125. return $value.then(function (vl) {
  7126. if (vl.value) {
  7127. var _$newSto = _this4.executeCommands(result.sto, aCase.commands);
  7128. return _$newSto.then(function (nSto) {
  7129. return Promise.resolve({ wasTrue: true, sto: nSto });
  7130. });
  7131. } else {
  7132. return Promise.resolve({ wasTrue: false, sto: sto });
  7133. }
  7134. });
  7135. }
  7136. });
  7137. };
  7138. try {
  7139. var breakLoop = false;
  7140. var $result = Promise.resolve({ wasTrue: false, sto: store });
  7141. for (var index = 0; index < cmd.cases.length && !breakLoop; index++) {
  7142. var aCase = cmd.cases[index];
  7143. $result = auxCaseFun($result, cmd.expression, aCase);
  7144. $result.then(function (r) {
  7145. return breakLoop = _this4.ignoreSwitchCases(r.sto);
  7146. });
  7147. }
  7148. return $result.then(function (r) {
  7149. _this4.context.pop();
  7150. if (r.sto.mode === _modes.Modes.BREAK) {
  7151. r.sto.mode = _modes.Modes.RUN;
  7152. }
  7153. return r.sto;
  7154. });
  7155. } catch (error) {
  7156. return Promise.reject(error);
  7157. }
  7158. }
  7159. }, {
  7160. key: 'executeFor',
  7161. value: function executeFor(store, cmd) {
  7162. try {
  7163. //BEGIN for -> while rewrite
  7164. var initCmd = cmd.assignment;
  7165. var condition = cmd.condition;
  7166. var increment = cmd.increment;
  7167. var whileBlock = new Commands.CommandBlock([], cmd.commands.concat(increment));
  7168. var forAsWhile = new Commands.While(condition, whileBlock);
  7169. //END for -> while rewrite
  7170. var newCmdList = [initCmd, forAsWhile];
  7171. return this.executeCommands(store, newCmdList);
  7172. } catch (error) {
  7173. return Promise.reject(error);
  7174. }
  7175. }
  7176. }, {
  7177. key: 'executeDoWhile',
  7178. value: function executeDoWhile(store, cmd) {
  7179. var outerRef = this;
  7180. try {
  7181. outerRef.loopTimers.push(Date.now());
  7182. outerRef.context.push(_context.Context.BREAKABLE);
  7183. var $newStore = outerRef.executeCommands(store, cmd.commands);
  7184. return $newStore.then(function (sto) {
  7185. if (sto.mode === _modes.Modes.BREAK) {
  7186. outerRef.context.pop();
  7187. sto.mode = _modes.Modes.RUN;
  7188. outerRef.loopTimers.pop();
  7189. return sto;
  7190. }
  7191. var $value = outerRef.evaluateExpression(sto, cmd.expression);
  7192. return $value.then(function (vl) {
  7193. if (!vl.type.isCompatible(_types.Types.BOOLEAN)) {
  7194. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.loop_condition_type_full(cmd.sourceInfo));
  7195. }
  7196. if (vl.value) {
  7197. outerRef.context.pop();
  7198. for (var i = 0; i < outerRef.loopTimers.length; i++) {
  7199. var time = outerRef.loopTimers[i];
  7200. if (Date.now() - time >= IVProgProcessor.LOOP_TIMEOUT) {
  7201. outerRef.forceKill = true;
  7202. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.endless_loop_full(cmd.sourceInfo));
  7203. }
  7204. }
  7205. return outerRef.executeCommand(sto, cmd);
  7206. } else {
  7207. outerRef.context.pop();
  7208. outerRef.loopTimers.pop();
  7209. return sto;
  7210. }
  7211. });
  7212. });
  7213. } catch (error) {
  7214. return Promise.reject(error);
  7215. }
  7216. }
  7217. }, {
  7218. key: 'executeWhile',
  7219. value: function executeWhile(store, cmd) {
  7220. var outerRef = this;
  7221. try {
  7222. outerRef.loopTimers.push(Date.now());
  7223. outerRef.context.push(_context.Context.BREAKABLE);
  7224. var $value = outerRef.evaluateExpression(store, cmd.expression);
  7225. return $value.then(function (vl) {
  7226. if (vl.type.isCompatible(_types.Types.BOOLEAN)) {
  7227. if (vl.value) {
  7228. var $newStore = outerRef.executeCommands(store, cmd.commands);
  7229. return $newStore.then(function (sto) {
  7230. outerRef.context.pop();
  7231. if (sto.mode === _modes.Modes.BREAK) {
  7232. outerRef.loopTimers.pop();
  7233. sto.mode = _modes.Modes.RUN;
  7234. return sto;
  7235. }
  7236. for (var i = 0; i < outerRef.loopTimers.length; i++) {
  7237. var time = outerRef.loopTimers[i];
  7238. if (Date.now() - time >= IVProgProcessor.LOOP_TIMEOUT) {
  7239. outerRef.forceKill = true;
  7240. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.endless_loop_full(cmd.sourceInfo));
  7241. }
  7242. }
  7243. return outerRef.executeCommand(sto, cmd);
  7244. });
  7245. } else {
  7246. outerRef.context.pop();
  7247. outerRef.loopTimers.pop();
  7248. return store;
  7249. }
  7250. } else {
  7251. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.loop_condition_type_full(cmd.sourceInfo));
  7252. }
  7253. });
  7254. } catch (error) {
  7255. return Promise.reject(error);
  7256. }
  7257. }
  7258. }, {
  7259. key: 'executeIfThenElse',
  7260. value: function executeIfThenElse(store, cmd) {
  7261. var _this5 = this;
  7262. try {
  7263. var $value = this.evaluateExpression(store, cmd.condition);
  7264. return $value.then(function (vl) {
  7265. if (vl.type.isCompatible(_types.Types.BOOLEAN)) {
  7266. if (vl.value) {
  7267. return _this5.executeCommands(store, cmd.ifTrue.commands);
  7268. } else if (cmd.ifFalse !== null) {
  7269. if (cmd.ifFalse instanceof Commands.IfThenElse) {
  7270. return _this5.executeCommand(store, cmd.ifFalse);
  7271. } else {
  7272. return _this5.executeCommands(store, cmd.ifFalse.commands);
  7273. }
  7274. } else {
  7275. return Promise.resolve(store);
  7276. }
  7277. } else {
  7278. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.if_condition_type_full(cmd.sourceInfo));
  7279. }
  7280. });
  7281. } catch (error) {
  7282. return Promise.reject(error);
  7283. }
  7284. }
  7285. }, {
  7286. key: 'executeReturn',
  7287. value: function executeReturn(store, cmd) {
  7288. var _this6 = this;
  7289. try {
  7290. var funcType = store.applyStore('$').type;
  7291. var $value = this.evaluateExpression(store, cmd.expression);
  7292. var funcName = store.name === IVProgProcessor.MAIN_INTERNAL_ID ? _definedFunctions.LanguageDefinedFunction.getMainFunctionName() : store.name;
  7293. return $value.then(function (vl) {
  7294. if (vl === null && funcType.isCompatible(_types.Types.VOID)) {
  7295. return Promise.resolve(store);
  7296. }
  7297. if (vl === null || !funcType.isCompatible(vl.type)) {
  7298. var stringInfo = funcType.stringInfo();
  7299. var info = stringInfo[0];
  7300. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.invalid_return_type_full(funcName, info.type, info.dim, cmd.sourceInfo));
  7301. } else {
  7302. var realValue = _this6.parseStoreObjectValue(vl);
  7303. store.updateStore('$', realValue);
  7304. store.mode = _modes.Modes.RETURN;
  7305. return Promise.resolve(store);
  7306. }
  7307. });
  7308. } catch (error) {
  7309. return Promise.reject(error);
  7310. }
  7311. }
  7312. }, {
  7313. key: 'executeBreak',
  7314. value: function executeBreak(store, cmd) {
  7315. if (this.checkContext(_context.Context.BREAKABLE)) {
  7316. store.mode = _modes.Modes.BREAK;
  7317. return Promise.resolve(store);
  7318. } else {
  7319. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.unexpected_break_command_full(cmd.sourceInfo));
  7320. }
  7321. }
  7322. }, {
  7323. key: 'executeAssign',
  7324. value: function executeAssign(store, cmd) {
  7325. var _this7 = this;
  7326. try {
  7327. var $value = this.evaluateExpression(store, cmd.expression);
  7328. return $value.then(function (vl) {
  7329. var realValue = _this7.parseStoreObjectValue(vl);
  7330. store.updateStore(cmd.id, realValue);
  7331. return store;
  7332. });
  7333. } catch (error) {
  7334. return Promise.reject(error);
  7335. }
  7336. }
  7337. }, {
  7338. key: 'executeArrayIndexAssign',
  7339. value: function executeArrayIndexAssign(store, cmd) {
  7340. var _this8 = this;
  7341. var mustBeArray = store.applyStore(cmd.id);
  7342. if (!(mustBeArray.type instanceof _compoundType.CompoundType)) {
  7343. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.invalid_array_access_full(cmd.id, cmd.sourceInfo));
  7344. }
  7345. var line$ = this.evaluateExpression(store, cmd.line);
  7346. var column$ = this.evaluateExpression(store, cmd.column);
  7347. var value$ = this.evaluateExpression(store, cmd.expression);
  7348. return Promise.all([line$, column$, value$]).then(function (results) {
  7349. var lineSO = results[0];
  7350. if (!_types.Types.INTEGER.isCompatible(lineSO.type)) {
  7351. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.array_dimension_not_int_full(cmd.sourceInfo));
  7352. }
  7353. var line = lineSO.number;
  7354. var columnSO = results[1];
  7355. var column = null;
  7356. if (columnSO !== null) {
  7357. if (!_types.Types.INTEGER.isCompatible(columnSO.type)) {
  7358. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.array_dimension_not_int_full(cmd.sourceInfo));
  7359. }
  7360. column = columnSO.number;
  7361. }
  7362. var value = _this8.parseStoreObjectValue(results[2]);
  7363. if (line >= mustBeArray.lines) {
  7364. if (mustBeArray.isVector) {
  7365. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.vector_line_outbounds_full(cmd.id, line, mustBeArray.lines, cmd.sourceInfo));
  7366. } else {
  7367. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.matrix_line_outbounds_full(cmd.id, line, mustBeArray.lines, cmd.sourceInfo));
  7368. }
  7369. } else if (line < 0) {
  7370. throw _processorErrorFactory.ProcessorErrorFactory.array_dimension_not_positive_full(cmd.sourceInfo);
  7371. }
  7372. if (column !== null && mustBeArray.columns === null) {
  7373. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.vector_not_matrix_full(cmd.id, cmd.sourceInfo));
  7374. }
  7375. if (column !== null) {
  7376. if (column >= mustBeArray.columns) {
  7377. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.matrix_column_outbounds_full(cmd.id, column, mustBeArray.columns, cmd.sourceInfo));
  7378. } else if (column < 0) {
  7379. throw _processorErrorFactory.ProcessorErrorFactory.array_dimension_not_positive_full(cmd.sourceInfo);
  7380. }
  7381. }
  7382. var newArray = Object.assign(new _storeObjectArray.StoreObjectArray(null, null, null), mustBeArray);
  7383. if (column !== null) {
  7384. if (value.type instanceof _compoundType.CompoundType) {
  7385. var type = mustBeArray.type.innerType;
  7386. var stringInfo = type.stringInfo();
  7387. var info = stringInfo[0];
  7388. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.incompatible_types_full(info.type, info.dim, cmd.sourceInfo));
  7389. }
  7390. newArray.value[line].value[column] = value;
  7391. store.updateStore(cmd.id, newArray);
  7392. } else {
  7393. if (mustBeArray.columns !== null && value.type instanceof _compoundType.CompoundType) {
  7394. var _type = mustBeArray.type;
  7395. var _stringInfo = _type.stringInfo();
  7396. var _info = _stringInfo[0];
  7397. var exp = cmd.expression.toString();
  7398. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.incompatible_types_array_full(exp, _info.type, _info.dim - 1, cmd.sourceInfo));
  7399. }
  7400. newArray.value[line] = value;
  7401. store.updateStore(cmd.id, newArray);
  7402. }
  7403. return store;
  7404. });
  7405. }
  7406. }, {
  7407. key: 'executeDeclaration',
  7408. value: function executeDeclaration(store, cmd) {
  7409. try {
  7410. var $value = this.evaluateExpression(store, cmd.initial);
  7411. if (cmd instanceof Commands.ArrayDeclaration) {
  7412. var $lines = this.evaluateExpression(store, cmd.lines);
  7413. var $columns = cmd.columns === null ? null : this.evaluateExpression(store, cmd.columns);
  7414. return Promise.all([$lines, $columns, $value]).then(function (values) {
  7415. var lineSO = values[0];
  7416. if (!_types.Types.INTEGER.isCompatible(lineSO.type)) {
  7417. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.array_dimension_not_int_full(cmd.sourceInfo));
  7418. }
  7419. var line = lineSO.number;
  7420. if (line < 0) {
  7421. throw _processorErrorFactory.ProcessorErrorFactory.array_dimension_not_positive_full(cmd.sourceInfo);
  7422. }
  7423. var columnSO = values[1];
  7424. var column = null;
  7425. if (columnSO !== null) {
  7426. if (!_types.Types.INTEGER.isCompatible(columnSO.type)) {
  7427. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.array_dimension_not_int_full(cmd.sourceInfo));
  7428. }
  7429. column = columnSO.number;
  7430. if (column < 0) {
  7431. throw _processorErrorFactory.ProcessorErrorFactory.array_dimension_not_positive_full(cmd.sourceInfo);
  7432. }
  7433. }
  7434. var value = values[2];
  7435. var temp = new _storeObjectArray.StoreObjectArray(cmd.type, line, column, null);
  7436. store.insertStore(cmd.id, temp);
  7437. var realValue = value;
  7438. if (value !== null) {
  7439. if (value instanceof _storeObjectArrayAddress.StoreObjectArrayAddress) {
  7440. if (value.type instanceof _compoundType.CompoundType) {
  7441. realValue = Object.assign(new _storeObjectArray.StoreObjectArray(null, null, null), value.refValue);
  7442. } else {
  7443. realValue = Object.assign(new _storeObject.StoreObject(null, null), value.refValue);
  7444. }
  7445. }
  7446. } else {
  7447. realValue = new _storeObjectArray.StoreObjectArray(cmd.type, line, column, []);
  7448. if (column !== null) {
  7449. for (var i = 0; i < line; i++) {
  7450. realValue.value.push(new _storeObjectArray.StoreObjectArray(new _compoundType.CompoundType(cmd.type.innerType, 1), column, null, []));
  7451. }
  7452. }
  7453. }
  7454. realValue.readOnly = cmd.isConst;
  7455. store.updateStore(cmd.id, realValue);
  7456. return store;
  7457. });
  7458. } else {
  7459. var temp = new _storeObject.StoreObject(cmd.type, null);
  7460. store.insertStore(cmd.id, temp);
  7461. return $value.then(function (vl) {
  7462. var realValue = vl;
  7463. if (vl !== null) {
  7464. if (vl instanceof _storeObjectArrayAddress.StoreObjectArrayAddress) {
  7465. if (vl.type instanceof _compoundType.CompoundType) {
  7466. realValue = Object.assign(new _storeObjectArray.StoreObjectArray(null, null, null), vl.refValue);
  7467. } else {
  7468. realValue = Object.assign(new _storeObject.StoreObject(null, null), vl.refValue);
  7469. }
  7470. }
  7471. } else {
  7472. realValue = new _storeObject.StoreObject(cmd.type, 0);
  7473. }
  7474. realValue.readOnly = cmd.isConst;
  7475. store.updateStore(cmd.id, realValue);
  7476. return store;
  7477. });
  7478. }
  7479. } catch (e) {
  7480. return Promise.reject(e);
  7481. }
  7482. }
  7483. }, {
  7484. key: 'evaluateExpression',
  7485. value: function evaluateExpression(store, exp) {
  7486. if (exp instanceof Expressions.UnaryApp) {
  7487. return this.evaluateUnaryApp(store, exp);
  7488. } else if (exp instanceof Expressions.InfixApp) {
  7489. return this.evaluateInfixApp(store, exp);
  7490. } else if (exp instanceof Expressions.ArrayAccess) {
  7491. return this.evaluateArrayAccess(store, exp);
  7492. } else if (exp instanceof Expressions.VariableLiteral) {
  7493. return this.evaluateVariableLiteral(store, exp);
  7494. } else if (exp instanceof Expressions.IntLiteral) {
  7495. return this.evaluateLiteral(store, exp);
  7496. } else if (exp instanceof Expressions.RealLiteral) {
  7497. return this.evaluateLiteral(store, exp);
  7498. } else if (exp instanceof Expressions.BoolLiteral) {
  7499. return this.evaluateLiteral(store, exp);
  7500. } else if (exp instanceof Expressions.StringLiteral) {
  7501. return this.evaluateLiteral(store, exp);
  7502. } else if (exp instanceof Expressions.ArrayLiteral) {
  7503. return this.evaluateArrayLiteral(store, exp);
  7504. } else if (exp instanceof Expressions.FunctionCall) {
  7505. return this.evaluateFunctionCall(store, exp);
  7506. }
  7507. return Promise.resolve(null);
  7508. }
  7509. }, {
  7510. key: 'evaluateFunctionCall',
  7511. value: function evaluateFunctionCall(store, exp) {
  7512. if (exp.isMainCall) {
  7513. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.void_in_expression_full(_definedFunctions.LanguageDefinedFunction.getMainFunctionName(), exp.sourceInfo));
  7514. }
  7515. var func = this.findFunction(exp.id);
  7516. if (_types.Types.VOID.isCompatible(func.returnType)) {
  7517. // TODO: better error message
  7518. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.void_in_expression_full(exp.id, exp.sourceInfo));
  7519. }
  7520. var $newStore = this.runFunction(func, exp.actualParameters, store);
  7521. return $newStore.then(function (sto) {
  7522. if (sto.mode !== _modes.Modes.RETURN) {
  7523. return Promise.reject(new Error("The function that was called did not had a return command: " + exp.id));
  7524. }
  7525. var val = sto.applyStore('$');
  7526. if (val instanceof _storeObjectArray.StoreObjectArray) {
  7527. return Promise.resolve(Object.assign(new _storeObjectArray.StoreObjectArray(null, null, null, null, null), val));
  7528. } else {
  7529. return Promise.resolve(Object.assign(new _storeObject.StoreObject(null, null), val));
  7530. }
  7531. });
  7532. }
  7533. }, {
  7534. key: 'evaluateArrayLiteral',
  7535. value: function evaluateArrayLiteral(store, exp) {
  7536. var errorHelperFunction = function errorHelperFunction(validationResult, exp) {
  7537. var errorCode = validationResult[0];
  7538. switch (errorCode) {
  7539. case _storeObjectArray.StoreObjectArray.WRONG_COLUMN_NUMBER:
  7540. {
  7541. var columnValue = validationResult[1];
  7542. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.invalid_array_literal_column_full(arr.columns, columnValue, exp.sourceInfo));
  7543. }
  7544. case _storeObjectArray.StoreObjectArray.WRONG_LINE_NUMBER:
  7545. {
  7546. var lineValue = validationResult[1];
  7547. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.invalid_array_literal_line_full(arr.lines, lineValue, exp.sourceInfo));
  7548. }
  7549. case _storeObjectArray.StoreObjectArray.WRONG_TYPE:
  7550. {
  7551. var line = null;
  7552. var strExp = null;
  7553. if (validationResult.length > 2) {
  7554. line = validationResult[1];
  7555. var column = validationResult[2];
  7556. strExp = exp.value[line].value[column].toString();
  7557. } else {
  7558. line = validationResult[1];
  7559. strExp = exp.value[line].toString();
  7560. }
  7561. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.invalid_array_literal_type_full(strExp, exp.sourceInfo));
  7562. }
  7563. }
  7564. };
  7565. if (!exp.isVector) {
  7566. var $matrix = this.evaluateMatrix(store, exp.value);
  7567. return $matrix.then(function (list) {
  7568. var type = new _compoundType.CompoundType(list[0].type.innerType, 2);
  7569. var arr = new _storeObjectArray.StoreObjectArray(type, list.length, list[0].lines, list);
  7570. var checkResult = arr.isValid;
  7571. if (checkResult.length == 0) return Promise.resolve(arr);else {
  7572. return errorHelperFunction(checkResult, exp);
  7573. }
  7574. });
  7575. } else {
  7576. return this.evaluateVector(store, exp.value).then(function (list) {
  7577. var type = new _compoundType.CompoundType(list[0].type, 1);
  7578. var stoArray = new _storeObjectArray.StoreObjectArray(type, list.length, null, list);
  7579. var checkResult = stoArray.isValid;
  7580. if (checkResult.length == 0) return Promise.resolve(stoArray);else {
  7581. return errorHelperFunction(checkResult, exp);
  7582. }
  7583. });
  7584. }
  7585. }
  7586. }, {
  7587. key: 'evaluateVector',
  7588. value: function evaluateVector(store, exps) {
  7589. var _this9 = this;
  7590. return Promise.all(exps.map(function (exp) {
  7591. return _this9.evaluateExpression(store, exp);
  7592. }));
  7593. }
  7594. }, {
  7595. key: 'evaluateMatrix',
  7596. value: function evaluateMatrix(store, exps) {
  7597. var _this10 = this;
  7598. return Promise.all(exps.map(function (vector) {
  7599. var $vector = _this10.evaluateVector(store, vector.value);
  7600. return $vector.then(function (list) {
  7601. var type = new _compoundType.CompoundType(list[0].type, 1);
  7602. return new _storeObjectArray.StoreObjectArray(type, list.length, null, list);
  7603. });
  7604. }));
  7605. }
  7606. }, {
  7607. key: 'evaluateLiteral',
  7608. value: function evaluateLiteral(_, exp) {
  7609. return Promise.resolve(new _storeObject.StoreObject(exp.type, exp.value));
  7610. }
  7611. }, {
  7612. key: 'evaluateVariableLiteral',
  7613. value: function evaluateVariableLiteral(store, exp) {
  7614. try {
  7615. var val = store.applyStore(exp.id);
  7616. if (val instanceof _storeObjectArray.StoreObjectArray) {
  7617. return Promise.resolve(Object.assign(new _storeObjectArray.StoreObjectArray(null, null, null, null), val));
  7618. } else {
  7619. return Promise.resolve(Object.assign(new _storeObject.StoreObject(null, null), val));
  7620. }
  7621. } catch (error) {
  7622. return Promise.reject(error);
  7623. }
  7624. }
  7625. }, {
  7626. key: 'evaluateArrayAccess',
  7627. value: function evaluateArrayAccess(store, exp) {
  7628. var mustBeArray = store.applyStore(exp.id);
  7629. if (!(mustBeArray.type instanceof _compoundType.CompoundType)) {
  7630. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.invalid_array_access_full(exp.id, exp.sourceInfo));
  7631. }
  7632. var $line = this.evaluateExpression(store, exp.line);
  7633. var $column = this.evaluateExpression(store, exp.column);
  7634. return Promise.all([$line, $column]).then(function (values) {
  7635. var lineSO = values[0];
  7636. var columnSO = values[1];
  7637. if (!_types.Types.INTEGER.isCompatible(lineSO.type)) {
  7638. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.array_dimension_not_int_full(exp.sourceInfo));
  7639. }
  7640. var line = lineSO.number;
  7641. var column = null;
  7642. if (columnSO !== null) {
  7643. if (!_types.Types.INTEGER.isCompatible(columnSO.type)) {
  7644. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.array_dimension_not_int_full(exp.sourceInfo));
  7645. }
  7646. column = columnSO.number;
  7647. }
  7648. if (line >= mustBeArray.lines) {
  7649. if (mustBeArray.isVector) {
  7650. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.vector_line_outbounds_full(exp.id, line, mustBeArray.lines, exp.sourceInfo));
  7651. } else {
  7652. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.matrix_line_outbounds_full(exp.id, line, mustBeArray.lines, exp.sourceInfo));
  7653. }
  7654. } else if (line < 0) {
  7655. throw _processorErrorFactory.ProcessorErrorFactory.array_dimension_not_positive_full(exp.sourceInfo);
  7656. }
  7657. if (column !== null && mustBeArray.columns === null) {
  7658. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.vector_not_matrix_full(exp.id, exp.sourceInfo));
  7659. }
  7660. if (column !== null) {
  7661. if (column >= mustBeArray.columns) {
  7662. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.matrix_column_outbounds_full(exp.id, column, mustBeArray.columns, exp.sourceInfo));
  7663. } else if (column < 0) {
  7664. throw _processorErrorFactory.ProcessorErrorFactory.array_dimension_not_positive_full(exp.sourceInfo);
  7665. }
  7666. }
  7667. return Promise.resolve(new _storeObjectArrayAddress.StoreObjectArrayAddress(mustBeArray.id, line, column, store));
  7668. });
  7669. }
  7670. }, {
  7671. key: 'evaluateUnaryApp',
  7672. value: function evaluateUnaryApp(store, unaryApp) {
  7673. var $left = this.evaluateExpression(store, unaryApp.left);
  7674. return $left.then(function (left) {
  7675. var resultType = (0, _compatibilityTable.resultTypeAfterUnaryOp)(unaryApp.op, left.type);
  7676. if (_types.Types.UNDEFINED.isCompatible(resultType)) {
  7677. var stringInfo = left.type.stringInfo();
  7678. var info = stringInfo[0];
  7679. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.invalid_unary_op_full(unaryApp.op, info.type, info.dim, unaryApp.sourceInfo));
  7680. }
  7681. switch (unaryApp.op.ord) {
  7682. case _operators.Operators.ADD.ord:
  7683. return new _storeObject.StoreObject(resultType, left.value);
  7684. case _operators.Operators.SUB.ord:
  7685. return new _storeObject.StoreObject(resultType, left.value.negated());
  7686. case _operators.Operators.NOT.ord:
  7687. return new _storeObject.StoreObject(resultType, !left.value);
  7688. default:
  7689. return Promise.reject(new _runtimeError.RuntimeError('!!!Critical Invalid UnaryApp ' + unaryApp.op));
  7690. }
  7691. });
  7692. }
  7693. }, {
  7694. key: 'evaluateInfixApp',
  7695. value: function evaluateInfixApp(store, infixApp) {
  7696. var $left = this.evaluateExpression(store, infixApp.left);
  7697. var $right = this.evaluateExpression(store, infixApp.right);
  7698. return Promise.all([$left, $right]).then(function (values) {
  7699. var left = values[0];
  7700. var right = values[1];
  7701. var resultType = (0, _compatibilityTable.resultTypeAfterInfixOp)(infixApp.op, left.type, right.type);
  7702. if (_types.Types.UNDEFINED.isCompatible(resultType)) {
  7703. var stringInfoLeft = left.type.stringInfo();
  7704. var infoLeft = stringInfoLeft[0];
  7705. var stringInfoRight = right.type.stringInfo();
  7706. var infoRight = stringInfoRight[0];
  7707. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.invalid_infix_op_full(infixApp.op, infoLeft.type, infoLeft.dim, infoRight.type, infoRight.dim, infixApp.sourceInfo));
  7708. }
  7709. var result = null;
  7710. switch (infixApp.op.ord) {
  7711. case _operators.Operators.ADD.ord:
  7712. {
  7713. if (_types.Types.STRING.isCompatible(left.type)) {
  7714. var rightStr = (0, _parsers.convertToString)(right.value, right.type);
  7715. return new _storeObject.StoreObject(resultType, left.value + rightStr);
  7716. } else if (_types.Types.STRING.isCompatible(right.type)) {
  7717. var leftStr = (0, _parsers.convertToString)(left.value, left.type);
  7718. return new _storeObject.StoreObject(resultType, leftStr + right.value);
  7719. } else {
  7720. return new _storeObject.StoreObject(resultType, left.value.plus(right.value));
  7721. }
  7722. }
  7723. case _operators.Operators.SUB.ord:
  7724. return new _storeObject.StoreObject(resultType, left.value.minus(right.value));
  7725. case _operators.Operators.MULT.ord:
  7726. {
  7727. result = left.value.times(right.value);
  7728. if (result.dp() > _config.Config.decimalPlaces) {
  7729. result = new _decimal2.default(result.toFixed(_config.Config.decimalPlaces));
  7730. }
  7731. return new _storeObject.StoreObject(resultType, result);
  7732. }
  7733. case _operators.Operators.DIV.ord:
  7734. {
  7735. if (_types.Types.INTEGER.isCompatible(resultType)) result = left.value.divToInt(right.value);else result = left.value.div(right.value);
  7736. if (result.dp() > _config.Config.decimalPlaces) {
  7737. result = new _decimal2.default(result.toFixed(_config.Config.decimalPlaces));
  7738. }
  7739. return new _storeObject.StoreObject(resultType, result);
  7740. }
  7741. case _operators.Operators.MOD.ord:
  7742. {
  7743. result = left.value.modulo(right.value);
  7744. if (result.dp() > _config.Config.decimalPlaces) {
  7745. result = new _decimal2.default(result.toFixed(_config.Config.decimalPlaces));
  7746. }
  7747. return new _storeObject.StoreObject(resultType, result);
  7748. }
  7749. case _operators.Operators.GT.ord:
  7750. {
  7751. if (_types.Types.STRING.isCompatible(left.type)) {
  7752. result = left.value.length > right.value.length;
  7753. } else {
  7754. result = left.value.gt(right.value);
  7755. }
  7756. return new _storeObject.StoreObject(resultType, result);
  7757. }
  7758. case _operators.Operators.GE.ord:
  7759. {
  7760. if (_types.Types.STRING.isCompatible(left.type)) {
  7761. result = left.value.length >= right.value.length;
  7762. } else {
  7763. result = left.value.gte(right.value);
  7764. }
  7765. return new _storeObject.StoreObject(resultType, result);
  7766. }
  7767. case _operators.Operators.LT.ord:
  7768. {
  7769. if (_types.Types.STRING.isCompatible(left.type)) {
  7770. result = left.value.length < right.value.length;
  7771. } else {
  7772. result = left.value.lt(right.value);
  7773. }
  7774. return new _storeObject.StoreObject(resultType, result);
  7775. }
  7776. case _operators.Operators.LE.ord:
  7777. {
  7778. if (_types.Types.STRING.isCompatible(left.type)) {
  7779. result = left.value.length <= right.value.length;
  7780. } else {
  7781. result = left.value.lte(right.value);
  7782. }
  7783. return new _storeObject.StoreObject(resultType, result);
  7784. }
  7785. case _operators.Operators.EQ.ord:
  7786. {
  7787. if (_types.Types.INTEGER.isCompatible(left.type) || _types.Types.REAL.isCompatible(left.type)) {
  7788. result = left.value.eq(right.value);
  7789. } else {
  7790. result = left.value === right.value;
  7791. }
  7792. return new _storeObject.StoreObject(resultType, result);
  7793. }
  7794. case _operators.Operators.NEQ.ord:
  7795. {
  7796. if (_types.Types.INTEGER.isCompatible(left.type) || _types.Types.REAL.isCompatible(left.type)) {
  7797. result = !left.value.eq(right.value);
  7798. } else {
  7799. result = left.value !== right.value;
  7800. }
  7801. return new _storeObject.StoreObject(resultType, result);
  7802. }
  7803. case _operators.Operators.AND.ord:
  7804. return new _storeObject.StoreObject(resultType, left.value && right.value);
  7805. case _operators.Operators.OR.ord:
  7806. return new _storeObject.StoreObject(resultType, left.value || right.value);
  7807. default:
  7808. return Promise.reject(new _runtimeError.RuntimeError('!!!Critical Invalid InfixApp ' + infixApp.op));
  7809. }
  7810. });
  7811. }
  7812. }, {
  7813. key: 'parseStoreObjectValue',
  7814. value: function parseStoreObjectValue(vl) {
  7815. var realValue = vl;
  7816. if (vl instanceof _storeObjectArrayAddress.StoreObjectArrayAddress) {
  7817. if (vl.type instanceof _compoundType.CompoundType) {
  7818. switch (vl.type.dimensions) {
  7819. case 1:
  7820. {
  7821. realValue = new _storeObjectArray.StoreObjectArray(vl.type, vl.value);
  7822. break;
  7823. }
  7824. default:
  7825. {
  7826. throw new _runtimeError.RuntimeError("Three dimensional array address...");
  7827. }
  7828. }
  7829. } else {
  7830. realValue = new _storeObject.StoreObject(vl.type, vl.value);
  7831. }
  7832. }
  7833. return realValue;
  7834. }
  7835. }]);
  7836. return IVProgProcessor;
  7837. }();
  7838. /***/ }),
  7839. /***/ "./js/processor/lib/arrays.js":
  7840. /*!************************************!*\
  7841. !*** ./js/processor/lib/arrays.js ***!
  7842. \************************************/
  7843. /*! no static exports found */
  7844. /***/ (function(module, exports, __webpack_require__) {
  7845. "use strict";
  7846. Object.defineProperty(exports, "__esModule", {
  7847. value: true
  7848. });
  7849. exports.createNumElementsFun = createNumElementsFun;
  7850. exports.createMatrixLinesFun = createMatrixLinesFun;
  7851. exports.createMatrixColumnsFun = createMatrixColumnsFun;
  7852. var _storeObject = __webpack_require__(/*! ../store/storeObject */ "./js/processor/store/storeObject.js");
  7853. var _commands = __webpack_require__(/*! ./../../ast/commands */ "./js/ast/commands/index.js");
  7854. var Commands = _interopRequireWildcard(_commands);
  7855. var _types = __webpack_require__(/*! ./../../typeSystem/types */ "./js/typeSystem/types.js");
  7856. var _parsers = __webpack_require__(/*! ./../../typeSystem/parsers */ "./js/typeSystem/parsers.js");
  7857. var _compoundType = __webpack_require__(/*! ../../typeSystem/compoundType */ "./js/typeSystem/compoundType.js");
  7858. var _modes = __webpack_require__(/*! ../modes */ "./js/processor/modes.js");
  7859. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  7860. /**
  7861. * num_elements
  7862. * matrix_lines
  7863. * matrix_columns
  7864. */
  7865. function createNumElementsFun() {
  7866. var numElementsFun = function numElementsFun(sto, _) {
  7867. var vector = sto.applyStore("vector");
  7868. var temp = new _storeObject.StoreObject(_types.Types.INTEGER, (0, _parsers.toInt)(vector.lines));
  7869. sto.mode = _modes.Modes.RETURN;
  7870. return Promise.resolve(sto.updateStore("$", temp));
  7871. };
  7872. var block = new Commands.CommandBlock([], [new Commands.SysCall(numElementsFun)]);
  7873. var func = new Commands.Function('$numElements', _types.Types.INTEGER, [new Commands.FormalParameter(new _compoundType.CompoundType(_types.Types.ALL, 1), 'vector', false)], block);
  7874. return func;
  7875. }
  7876. function createMatrixLinesFun() {
  7877. var matrixLinesFun = function matrixLinesFun(sto, _) {
  7878. var matrix = sto.applyStore("matrix");
  7879. var temp = new _storeObject.StoreObject(_types.Types.INTEGER, (0, _parsers.toInt)(matrix.lines));
  7880. sto.mode = _modes.Modes.RETURN;
  7881. return Promise.resolve(sto.updateStore("$", temp));
  7882. };
  7883. var block = new Commands.CommandBlock([], [new Commands.SysCall(matrixLinesFun)]);
  7884. var func = new Commands.Function('$matrixLines', _types.Types.INTEGER, [new Commands.FormalParameter(new _compoundType.CompoundType(_types.Types.ALL, 2), 'matrix', false)], block);
  7885. return func;
  7886. }
  7887. function createMatrixColumnsFun() {
  7888. var matrixColumnsFun = function matrixColumnsFun(sto, _) {
  7889. var matrix = sto.applyStore("matrix");
  7890. var temp = new _storeObject.StoreObject(_types.Types.INTEGER, (0, _parsers.toInt)(matrix.columns));
  7891. sto.mode = _modes.Modes.RETURN;
  7892. return Promise.resolve(sto.updateStore("$", temp));
  7893. };
  7894. var block = new Commands.CommandBlock([], [new Commands.SysCall(matrixColumnsFun)]);
  7895. var func = new Commands.Function('$matrixColumns', _types.Types.INTEGER, [new Commands.FormalParameter(new _compoundType.CompoundType(_types.Types.ALL, 2), 'matrix', false)], block);
  7896. return func;
  7897. }
  7898. /***/ }),
  7899. /***/ "./js/processor/lib/io.js":
  7900. /*!********************************!*\
  7901. !*** ./js/processor/lib/io.js ***!
  7902. \********************************/
  7903. /*! no static exports found */
  7904. /***/ (function(module, exports, __webpack_require__) {
  7905. "use strict";
  7906. Object.defineProperty(exports, "__esModule", {
  7907. value: true
  7908. });
  7909. exports.createOutputFun = createOutputFun;
  7910. exports.createInputFun = createInputFun;
  7911. var _storeObject = __webpack_require__(/*! ./../store/storeObject */ "./js/processor/store/storeObject.js");
  7912. var _commands = __webpack_require__(/*! ./../../ast/commands */ "./js/ast/commands/index.js");
  7913. var Commands = _interopRequireWildcard(_commands);
  7914. var _parsers = __webpack_require__(/*! ./../../typeSystem/parsers */ "./js/typeSystem/parsers.js");
  7915. var _types = __webpack_require__(/*! ./../../typeSystem/types */ "./js/typeSystem/types.js");
  7916. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  7917. function createOutputFun() {
  7918. var writeFunction = function writeFunction(store, _) {
  7919. var val = store.applyStore('p1');
  7920. if (val.type.isCompatible(_types.Types.INTEGER)) {
  7921. this.output.sendOutput(val.value.toString());
  7922. } else if (val.type.isCompatible(_types.Types.REAL)) {
  7923. if (val.value.dp() <= 0) {
  7924. this.output.sendOutput(val.value.toFixed(1));
  7925. } else {
  7926. this.output.sendOutput(val.value.toString());
  7927. }
  7928. } else {
  7929. this.output.sendOutput(val.value);
  7930. }
  7931. return Promise.resolve(store);
  7932. };
  7933. var block = new Commands.CommandBlock([], [new Commands.SysCall(writeFunction)]);
  7934. var func = new Commands.Function('$write', _types.Types.VOID, [new Commands.FormalParameter(_types.Types.ALL, 'p1', false)], block);
  7935. return func;
  7936. }
  7937. function createInputFun() {
  7938. var readFunction = function readFunction(store, _) {
  7939. var _this = this;
  7940. var request = new Promise(function (resolve, _) {
  7941. _this.input.requestInput(resolve);
  7942. });
  7943. return request.then(function (text) {
  7944. var typeToConvert = store.applyStore('p1').type;
  7945. var stoObj = null;
  7946. if (typeToConvert.isCompatible(_types.Types.INTEGER)) {
  7947. var val = (0, _parsers.toInt)(text);
  7948. stoObj = new _storeObject.StoreObject(_types.Types.INTEGER, val);
  7949. } else if (typeToConvert.isCompatible(_types.Types.REAL)) {
  7950. stoObj = new _storeObject.StoreObject(_types.Types.REAL, (0, _parsers.toReal)(text));
  7951. } else if (typeToConvert.isCompatible(_types.Types.BOOLEAN)) {
  7952. stoObj = new _storeObject.StoreObject(_types.Types.BOOLEAN, (0, _parsers.toBool)(text));
  7953. } else if (typeToConvert.isCompatible(_types.Types.STRING)) {
  7954. stoObj = new _storeObject.StoreObject(_types.Types.STRING, (0, _parsers.toString)(text));
  7955. }
  7956. _this.loopTimers.splice(0, _this.loopTimers.length);
  7957. store.updateStore('p1', stoObj);
  7958. return Promise.resolve(store);
  7959. });
  7960. };
  7961. var block = new Commands.CommandBlock([], [new Commands.SysCall(readFunction)]);
  7962. var func = new Commands.Function('$read', _types.Types.VOID, [new Commands.FormalParameter(_types.Types.ALL, 'p1', true)], block);
  7963. return func;
  7964. }
  7965. /***/ }),
  7966. /***/ "./js/processor/lib/lang.js":
  7967. /*!**********************************!*\
  7968. !*** ./js/processor/lib/lang.js ***!
  7969. \**********************************/
  7970. /*! no static exports found */
  7971. /***/ (function(module, exports, __webpack_require__) {
  7972. "use strict";
  7973. Object.defineProperty(exports, "__esModule", {
  7974. value: true
  7975. });
  7976. exports.createIsRealFun = createIsRealFun;
  7977. exports.createIsIntFun = createIsIntFun;
  7978. exports.createIsBoolFun = createIsBoolFun;
  7979. exports.createCastRealFun = createCastRealFun;
  7980. exports.createCastIntFun = createCastIntFun;
  7981. exports.createCastBoolFun = createCastBoolFun;
  7982. exports.createCastStringFun = createCastStringFun;
  7983. var _storeObject = __webpack_require__(/*! ../store/storeObject */ "./js/processor/store/storeObject.js");
  7984. var _commands = __webpack_require__(/*! ./../../ast/commands */ "./js/ast/commands/index.js");
  7985. var Commands = _interopRequireWildcard(_commands);
  7986. var _types = __webpack_require__(/*! ./../../typeSystem/types */ "./js/typeSystem/types.js");
  7987. var _parsers = __webpack_require__(/*! ./../../typeSystem/parsers */ "./js/typeSystem/parsers.js");
  7988. var _ivprogParser = __webpack_require__(/*! ../../ast/ivprogParser */ "./js/ast/ivprogParser.js");
  7989. var _expressions = __webpack_require__(/*! ../../ast/expressions */ "./js/ast/expressions/index.js");
  7990. var _modes = __webpack_require__(/*! ../modes */ "./js/processor/modes.js");
  7991. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  7992. /**
  7993. *
  7994. * is_real
  7995. * is_int
  7996. * is_bool
  7997. * cast_real
  7998. * cast_int
  7999. * cast_bool
  8000. * cast_string
  8001. */
  8002. function createIsRealFun() {
  8003. var isRealFun = function isRealFun(sto, _) {
  8004. var str = sto.applyStore("str");
  8005. var parser = _ivprogParser.IVProgParser.createParser(str.value);
  8006. var result = false;
  8007. try {
  8008. var val = parser.parseTerm();
  8009. if (val instanceof _expressions.RealLiteral) {
  8010. result = true;
  8011. }
  8012. } catch (error) {}
  8013. var temp = new _storeObject.StoreObject(_types.Types.BOOLEAN, result);
  8014. sto.mode = _modes.Modes.RETURN;
  8015. return Promise.resolve(sto.updateStore("$", temp));
  8016. };
  8017. var block = new Commands.CommandBlock([], [new Commands.SysCall(isRealFun)]);
  8018. var func = new Commands.Function('$isReal', _types.Types.BOOLEAN, [new Commands.FormalParameter(_types.Types.STRING, 'str', false)], block);
  8019. return func;
  8020. }
  8021. function createIsIntFun() {
  8022. var isIntFun = function isIntFun(sto, _) {
  8023. var str = sto.applyStore("str");
  8024. var parser = _ivprogParser.IVProgParser.createParser(str.value);
  8025. var result = false;
  8026. try {
  8027. var val = parser.parseTerm();
  8028. if (val instanceof _expressions.IntLiteral) {
  8029. result = true;
  8030. }
  8031. } catch (error) {}
  8032. var temp = new _storeObject.StoreObject(_types.Types.BOOLEAN, result);
  8033. sto.mode = _modes.Modes.RETURN;
  8034. return Promise.resolve(sto.updateStore("$", temp));
  8035. };
  8036. var block = new Commands.CommandBlock([], [new Commands.SysCall(isIntFun)]);
  8037. var func = new Commands.Function('$isInt', _types.Types.BOOLEAN, [new Commands.FormalParameter(_types.Types.STRING, 'str', false)], block);
  8038. return func;
  8039. }
  8040. function createIsBoolFun() {
  8041. var isBoolFun = function isBoolFun(sto, _) {
  8042. var str = sto.applyStore("str");
  8043. var parser = _ivprogParser.IVProgParser.createParser(str.value);
  8044. var result = false;
  8045. try {
  8046. var val = parser.parseTerm();
  8047. if (val instanceof _expressions.BoolLiteral) {
  8048. result = true;
  8049. }
  8050. } catch (error) {}
  8051. var temp = new _storeObject.StoreObject(_types.Types.BOOLEAN, result);
  8052. sto.mode = _modes.Modes.RETURN;
  8053. return Promise.resolve(sto.updateStore("$", temp));
  8054. };
  8055. var block = new Commands.CommandBlock([], [new Commands.SysCall(isBoolFun)]);
  8056. var func = new Commands.Function('$isBool', _types.Types.BOOLEAN, [new Commands.FormalParameter(_types.Types.STRING, 'str', false)], block);
  8057. return func;
  8058. }
  8059. function createCastRealFun() {
  8060. var castRealFun = function castRealFun(sto, _) {
  8061. var val = sto.applyStore("val");
  8062. switch (val.type.ord) {
  8063. case _types.Types.INTEGER.ord:
  8064. {
  8065. var temp = new _storeObject.StoreObject(_types.Types.REAL, (0, _parsers.toReal)(val.number));
  8066. sto.mode = _modes.Modes.RETURN;
  8067. return Promise.resolve(sto.updateStore("$", temp));
  8068. }
  8069. case _types.Types.STRING.ord:
  8070. {
  8071. var parser = _ivprogParser.IVProgParser.createParser(val.value);
  8072. try {
  8073. var result = parser.parseTerm();
  8074. if (result instanceof _expressions.RealLiteral) {
  8075. var _temp = new _storeObject.StoreObject(_types.Types.REAL, result.value);
  8076. sto.mode = _modes.Modes.RETURN;
  8077. return Promise.resolve(sto.updateStore("$", _temp));
  8078. }
  8079. } catch (error) {
  8080. return Promise.reject("cannot convert string to real");
  8081. }
  8082. }
  8083. }
  8084. };
  8085. var block = new Commands.CommandBlock([], [new Commands.SysCall(castRealFun)]);
  8086. var func = new Commands.Function('$castReal', _types.Types.REAL, [new Commands.FormalParameter(_types.Types.ALL, 'val', false)], block);
  8087. return func;
  8088. }
  8089. function createCastIntFun() {
  8090. var castIntFun = function castIntFun(sto, _) {
  8091. var val = sto.applyStore("val");
  8092. switch (val.type.ord) {
  8093. case _types.Types.REAL.ord:
  8094. {
  8095. var temp = new _storeObject.StoreObject(_types.Types.INTEGER, Math.floor(val.number));
  8096. sto.mode = _modes.Modes.RETURN;
  8097. return Promise.resolve(sto.updateStore("$", temp));
  8098. }
  8099. case _types.Types.STRING.ord:
  8100. {
  8101. var parser = _ivprogParser.IVProgParser.createParser(val.value);
  8102. try {
  8103. var result = parser.parseTerm();
  8104. if (result instanceof _expressions.IntLiteral) {
  8105. var _temp2 = new _storeObject.StoreObject(_types.Types.INTEGER, result.value);
  8106. sto.mode = _modes.Modes.RETURN;
  8107. return Promise.resolve(sto.updateStore("$", _temp2));
  8108. }
  8109. } catch (error) {
  8110. return Promise.reject("cannot convert string to real");
  8111. }
  8112. }
  8113. }
  8114. };
  8115. var block = new Commands.CommandBlock([], [new Commands.SysCall(castIntFun)]);
  8116. var func = new Commands.Function('$castInt', _types.Types.INTEGER, [new Commands.FormalParameter(_types.Types.ALL, 'val', false)], block);
  8117. return func;
  8118. }
  8119. function createCastBoolFun() {
  8120. var castBoolFun = function castBoolFun(sto, _) {
  8121. var str = sto.applyStore("str");
  8122. var parser = _ivprogParser.IVProgParser.createParser(str.value);
  8123. try {
  8124. var val = parser.parseTerm();
  8125. if (val instanceof _expressions.BoolLiteral) {
  8126. var temp = new _storeObject.StoreObject(_types.Types.BOOLEAN, val.value);
  8127. sto.mode = _modes.Modes.RETURN;
  8128. return Promise.resolve(sto.updateStore("$", temp));
  8129. }
  8130. } catch (error) {}
  8131. return Promise.reject("cannot convert " + str.value + " to boolean");
  8132. };
  8133. var block = new Commands.CommandBlock([], [new Commands.SysCall(castBoolFun)]);
  8134. var func = new Commands.Function('$castBool', _types.Types.BOOLEAN, [new Commands.FormalParameter(_types.Types.STRING, 'str', false)], block);
  8135. return func;
  8136. }
  8137. function createCastStringFun() {
  8138. var castStringFun = function castStringFun(store, _) {
  8139. var val = store.applyStore('str');
  8140. var result = (0, _parsers.convertToString)(val);
  8141. var temp = new _storeObject.StoreObject(_types.Types.STRING, result);
  8142. sto.mode = _modes.Modes.RETURN;
  8143. return Promise.resolve(sto.updateStore("$", temp));
  8144. };
  8145. var block = new Commands.CommandBlock([], [new Commands.SysCall(castStringFun)]);
  8146. var func = new Commands.Function('$castString', _types.Types.STRING, [new Commands.FormalParameter(_types.Types.ALL, 'str', false)], block);
  8147. return func;
  8148. }
  8149. /***/ }),
  8150. /***/ "./js/processor/lib/math.js":
  8151. /*!**********************************!*\
  8152. !*** ./js/processor/lib/math.js ***!
  8153. \**********************************/
  8154. /*! no static exports found */
  8155. /***/ (function(module, exports, __webpack_require__) {
  8156. "use strict";
  8157. Object.defineProperty(exports, "__esModule", {
  8158. value: true
  8159. });
  8160. exports.createSinFun = createSinFun;
  8161. exports.createCosFun = createCosFun;
  8162. exports.createTanFun = createTanFun;
  8163. exports.createSqrtFun = createSqrtFun;
  8164. exports.createPowFun = createPowFun;
  8165. exports.createLogFun = createLogFun;
  8166. exports.createAbsFun = createAbsFun;
  8167. exports.createNegateFun = createNegateFun;
  8168. exports.createInvertFun = createInvertFun;
  8169. exports.createMaxFun = createMaxFun;
  8170. exports.createMinFun = createMinFun;
  8171. var _storeObject = __webpack_require__(/*! ../store/storeObject */ "./js/processor/store/storeObject.js");
  8172. var _commands = __webpack_require__(/*! ./../../ast/commands */ "./js/ast/commands/index.js");
  8173. var Commands = _interopRequireWildcard(_commands);
  8174. var _types = __webpack_require__(/*! ./../../typeSystem/types */ "./js/typeSystem/types.js");
  8175. var _parsers = __webpack_require__(/*! ./../../typeSystem/parsers */ "./js/typeSystem/parsers.js");
  8176. var _decimal = __webpack_require__(/*! decimal.js */ "./node_modules/decimal.js/decimal.js");
  8177. var _multiType = __webpack_require__(/*! ../../typeSystem/multiType */ "./js/typeSystem/multiType.js");
  8178. var _compoundType = __webpack_require__(/*! ../../typeSystem/compoundType */ "./js/typeSystem/compoundType.js");
  8179. var _modes = __webpack_require__(/*! ../modes */ "./js/processor/modes.js");
  8180. var _config = __webpack_require__(/*! ../../util/config */ "./js/util/config.js");
  8181. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  8182. function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
  8183. /**
  8184. * sin
  8185. * cos
  8186. * tan
  8187. * sqrt
  8188. * pow
  8189. * log
  8190. * abs
  8191. * negate
  8192. * invert
  8193. * max
  8194. * min
  8195. */
  8196. function convertToRadians(degrees) {
  8197. return degrees.times(_decimal.Decimal.acos(-1)).div(180);
  8198. }
  8199. function createSinFun() {
  8200. var sinFun = function sinFun(sto, _) {
  8201. var x = sto.applyStore('x');
  8202. var angle = x.value.mod(360);
  8203. var result = null;
  8204. if (angle.eq(90)) {
  8205. result = new _decimal.Decimal(1);
  8206. } else if (angle.eq(180)) {
  8207. result = new _decimal.Decimal(0);
  8208. } else if (angle.eq(270)) {
  8209. result = new _decimal.Decimal(-1);
  8210. } else {
  8211. result = _decimal.Decimal.sin(convertToRadians(angle));
  8212. }
  8213. if (result.dp() > _config.Config.decimalPlaces) {
  8214. result = new _decimal.Decimal(result.toFixed(_config.Config.decimalPlaces));
  8215. }
  8216. var temp = new _storeObject.StoreObject(_types.Types.REAL, result);
  8217. sto.mode = _modes.Modes.RETURN;
  8218. return Promise.resolve(sto.updateStore('$', temp));
  8219. };
  8220. var block = new Commands.CommandBlock([], [new Commands.SysCall(sinFun)]);
  8221. var func = new Commands.Function('$sin', _types.Types.REAL, [new Commands.FormalParameter(new _multiType.MultiType([_types.Types.INTEGER, _types.Types.REAL]), 'x', false)], block);
  8222. return func;
  8223. }
  8224. function createCosFun() {
  8225. var cosFun = function cosFun(sto, _) {
  8226. var x = sto.applyStore('x');
  8227. var angle = x.value.mod(360);
  8228. var result = null;
  8229. if (angle.eq(90)) {
  8230. result = new _decimal.Decimal(0);
  8231. } else if (angle.eq(180)) {
  8232. result = new _decimal.Decimal(-1);
  8233. } else if (angle.eq(270)) {
  8234. result = new _decimal.Decimal(0);
  8235. }
  8236. result = _decimal.Decimal.cos(convertToRadians(angle));
  8237. if (result.dp() > _config.Config.decimalPlaces) {
  8238. result = new _decimal.Decimal(result.toFixed(_config.Config.decimalPlaces));
  8239. }
  8240. var temp = new _storeObject.StoreObject(_types.Types.REAL, result);
  8241. sto.mode = _modes.Modes.RETURN;
  8242. return Promise.resolve(sto.updateStore('$', temp));
  8243. };
  8244. var block = new Commands.CommandBlock([], [new Commands.SysCall(cosFun)]);
  8245. var func = new Commands.Function('$cos', _types.Types.REAL, [new Commands.FormalParameter(new _multiType.MultiType([_types.Types.INTEGER, _types.Types.REAL]), 'x', false)], block);
  8246. return func;
  8247. }
  8248. function createTanFun() {
  8249. var tanFun = function tanFun(sto, _) {
  8250. var x = sto.applyStore('x');
  8251. var angle = x.value.mod(360);
  8252. if (angle.eq(90) || angle.eq(270)) {
  8253. return Promise.reject("Tangent of " + x.value.toNumber() + "° is undefined.");
  8254. }
  8255. var result = _decimal.Decimal.tan(convertToRadians(angle));
  8256. if (result.dp() > _config.Config.decimalPlaces) {
  8257. result = new _decimal.Decimal(result.toFixed(_config.Config.decimalPlaces));
  8258. }
  8259. var temp = new _storeObject.StoreObject(_types.Types.REAL, result);
  8260. sto.mode = _modes.Modes.RETURN;
  8261. return Promise.resolve(sto.updateStore('$', temp));
  8262. };
  8263. var block = new Commands.CommandBlock([], [new Commands.SysCall(tanFun)]);
  8264. var func = new Commands.Function('$tan', _types.Types.REAL, [new Commands.FormalParameter(new _multiType.MultiType([_types.Types.INTEGER, _types.Types.REAL]), 'x', false)], block);
  8265. return func;
  8266. }
  8267. function createSqrtFun() {
  8268. var sqrtFun = function sqrtFun(sto, _) {
  8269. var x = sto.applyStore('x');
  8270. var result = x.value.sqrt();
  8271. if (result.dp() > _config.Config.decimalPlaces) {
  8272. result = new _decimal.Decimal(result.toFixed(_config.Config.decimalPlaces));
  8273. }
  8274. var temp = new _storeObject.StoreObject(_types.Types.REAL, result);
  8275. sto.mode = _modes.Modes.RETURN;
  8276. return Promise.resolve(sto.updateStore('$', temp));
  8277. };
  8278. var block = new Commands.CommandBlock([], [new Commands.SysCall(sqrtFun)]);
  8279. var func = new Commands.Function('$sqrt', _types.Types.REAL, [new Commands.FormalParameter(new _multiType.MultiType([_types.Types.INTEGER, _types.Types.REAL]), 'x', false)], block);
  8280. return func;
  8281. }
  8282. function createPowFun() {
  8283. var powFun = function powFun(sto, _) {
  8284. var x = sto.applyStore('x');
  8285. var y = sto.applyStore('y');
  8286. var result = x.value.pow(y.value);
  8287. if (result.dp() > _config.Config.decimalPlaces) {
  8288. result = new _decimal.Decimal(result.toFixed(_config.Config.decimalPlaces));
  8289. }
  8290. var temp = new _storeObject.StoreObject(_types.Types.REAL, result);
  8291. sto.mode = _modes.Modes.RETURN;
  8292. return Promise.resolve(sto.updateStore('$', temp));
  8293. };
  8294. var block = new Commands.CommandBlock([], [new Commands.SysCall(powFun)]);
  8295. var func = new Commands.Function('$pow', _types.Types.REAL, [new Commands.FormalParameter(new _multiType.MultiType([_types.Types.INTEGER, _types.Types.REAL]), 'x', false), new Commands.FormalParameter(new _multiType.MultiType([_types.Types.INTEGER, _types.Types.REAL]), 'y', false)], block);
  8296. return func;
  8297. }
  8298. function createLogFun() {
  8299. var logFun = function logFun(sto, _) {
  8300. var x = sto.applyStore('x');
  8301. if (x.value.isNegative()) {
  8302. return Promise.reject("the value passed to log function cannot be negative");
  8303. }
  8304. var result = _decimal.Decimal.log10(x.value);
  8305. if (result.dp() > _config.Config.decimalPlaces) {
  8306. result = new _decimal.Decimal(result.toFixed(_config.Config.decimalPlaces));
  8307. }
  8308. var temp = new _storeObject.StoreObject(_types.Types.REAL, result);
  8309. sto.mode = _modes.Modes.RETURN;
  8310. return Promise.resolve(sto.updateStore('$', temp));
  8311. };
  8312. var block = new Commands.CommandBlock([], [new Commands.SysCall(logFun)]);
  8313. var func = new Commands.Function('$log', _types.Types.REAL, [new Commands.FormalParameter(new _multiType.MultiType([_types.Types.INTEGER, _types.Types.REAL]), 'x', false)], block);
  8314. return func;
  8315. }
  8316. function createAbsFun() {
  8317. var absFun = function absFun(sto, _) {
  8318. var x = sto.applyStore('x');
  8319. var result = x.value.abs();
  8320. var temp = new _storeObject.StoreObject(x.type, result);
  8321. sto.mode = _modes.Modes.RETURN;
  8322. return Promise.resolve(sto.updateStore('$', temp));
  8323. };
  8324. var block = new Commands.CommandBlock([], [new Commands.SysCall(absFun)]);
  8325. var func = new Commands.Function('$abs', new _multiType.MultiType([_types.Types.INTEGER, _types.Types.REAL]), [new Commands.FormalParameter(new _multiType.MultiType([_types.Types.INTEGER, _types.Types.REAL]), 'x', false)], block);
  8326. return func;
  8327. }
  8328. function createNegateFun() {
  8329. var negateFun = function negateFun(sto, _) {
  8330. var x = sto.applyStore('x');
  8331. var result = x.value.negated();
  8332. var temp = new _storeObject.StoreObject(x.type, result);
  8333. sto.mode = _modes.Modes.RETURN;
  8334. return Promise.resolve(sto.updateStore('$', temp));
  8335. };
  8336. var block = new Commands.CommandBlock([], [new Commands.SysCall(negateFun)]);
  8337. var func = new Commands.Function('$negate', new _multiType.MultiType([_types.Types.INTEGER, _types.Types.REAL]), [new Commands.FormalParameter(new _multiType.MultiType([_types.Types.INTEGER, _types.Types.REAL]), 'x', false)], block);
  8338. return func;
  8339. }
  8340. function createInvertFun() {
  8341. var invertFun = function invertFun(sto, _) {
  8342. var x = sto.applyStore('x');
  8343. var result = (0, _parsers.toReal)(1).dividedBy(x.value);
  8344. if (result.dp() > _config.Config.decimalPlaces) {
  8345. result = new _decimal.Decimal(result.toFixed(_config.Config.decimalPlaces));
  8346. }
  8347. var temp = new _storeObject.StoreObject(_types.Types.REAL, result);
  8348. sto.mode = _modes.Modes.RETURN;
  8349. return Promise.resolve(sto.updateStore('$', temp));
  8350. };
  8351. var block = new Commands.CommandBlock([], [new Commands.SysCall(invertFun)]);
  8352. var func = new Commands.Function('$invert', _types.Types.REAL, [new Commands.FormalParameter(new _multiType.MultiType([_types.Types.INTEGER, _types.Types.REAL]), 'x', false)], block);
  8353. return func;
  8354. }
  8355. function createMaxFun() {
  8356. var maxFun = function maxFun(sto, _) {
  8357. var x = sto.applyStore('x');
  8358. var numbers = x.value.map(function (stoObj) {
  8359. return stoObj.value;
  8360. });
  8361. var result = _decimal.Decimal.max.apply(_decimal.Decimal, _toConsumableArray(numbers));
  8362. var temp = new _storeObject.StoreObject(x.type.innerType, result);
  8363. sto.mode = _modes.Modes.RETURN;
  8364. return Promise.resolve(sto.updateStore('$', temp));
  8365. };
  8366. var paramType = new _compoundType.CompoundType(new _multiType.MultiType([_types.Types.INTEGER, _types.Types.REAL]), 1);
  8367. var block = new Commands.CommandBlock([], [new Commands.SysCall(maxFun)]);
  8368. var func = new Commands.Function('$max', new _multiType.MultiType([_types.Types.INTEGER, _types.Types.REAL]), [new Commands.FormalParameter(paramType, 'x', false)], block);
  8369. return func;
  8370. }
  8371. function createMinFun() {
  8372. var minFun = function minFun(sto, _) {
  8373. var x = sto.applyStore('x');
  8374. var numbers = x.value.map(function (stoObj) {
  8375. return stoObj.value;
  8376. });
  8377. var result = _decimal.Decimal.min.apply(_decimal.Decimal, _toConsumableArray(numbers));
  8378. var temp = new _storeObject.StoreObject(x.type.innerType, result);
  8379. sto.mode = _modes.Modes.RETURN;
  8380. return Promise.resolve(sto.updateStore('$', temp));
  8381. };
  8382. var paramType = new _compoundType.CompoundType(new _multiType.MultiType([_types.Types.INTEGER, _types.Types.REAL]), 1);
  8383. var block = new Commands.CommandBlock([], [new Commands.SysCall(minFun)]);
  8384. var func = new Commands.Function('$min', new _multiType.MultiType([_types.Types.INTEGER, _types.Types.REAL]), [new Commands.FormalParameter(paramType, 'x', false)], block);
  8385. return func;
  8386. }
  8387. /***/ }),
  8388. /***/ "./js/processor/lib/strings.js":
  8389. /*!*************************************!*\
  8390. !*** ./js/processor/lib/strings.js ***!
  8391. \*************************************/
  8392. /*! no static exports found */
  8393. /***/ (function(module, exports, __webpack_require__) {
  8394. "use strict";
  8395. Object.defineProperty(exports, "__esModule", {
  8396. value: true
  8397. });
  8398. exports.createSubstringFun = createSubstringFun;
  8399. exports.createLengthFun = createLengthFun;
  8400. exports.createUppercaseFun = createUppercaseFun;
  8401. exports.createLowercaseFun = createLowercaseFun;
  8402. exports.createrCharAtFun = createrCharAtFun;
  8403. var _storeObject = __webpack_require__(/*! ../store/storeObject */ "./js/processor/store/storeObject.js");
  8404. var _commands = __webpack_require__(/*! ./../../ast/commands */ "./js/ast/commands/index.js");
  8405. var Commands = _interopRequireWildcard(_commands);
  8406. var _types = __webpack_require__(/*! ./../../typeSystem/types */ "./js/typeSystem/types.js");
  8407. var _parsers = __webpack_require__(/*! ./../../typeSystem/parsers */ "./js/typeSystem/parsers.js");
  8408. var _modes = __webpack_require__(/*! ../modes */ "./js/processor/modes.js");
  8409. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  8410. /*
  8411. * substring
  8412. * length
  8413. * uppercase
  8414. * lowercase
  8415. * charAt
  8416. **/
  8417. function createSubstringFun() {
  8418. var substringFun = function substringFun(sto, _) {
  8419. var str = sto.applyStore("str");
  8420. var start = sto.applyStore("start");
  8421. var end = sto.applyStore("end");
  8422. var result = str.value.substring(start.value, end.value);
  8423. var temp = new _storeObject.StoreObject(_types.Types.STRING, result);
  8424. sto.mode = _modes.Modes.RETURN;
  8425. return Promise.resolve(sto.updateStore("$", temp));
  8426. };
  8427. var block = new Commands.CommandBlock([], [new Commands.SysCall(substringFun)]);
  8428. var func = new Commands.Function('$substring', _types.Types.STRING, [new Commands.FormalParameter(_types.Types.STRING, 'str', false), new Commands.FormalParameter(_types.Types.INTEGER, 'start', false), new Commands.FormalParameter(_types.Types.INTEGER, 'end', false)], block);
  8429. return func;
  8430. }
  8431. function createLengthFun() {
  8432. var lengthFun = function lengthFun(sto, _) {
  8433. var str = sto.applyStore("str");
  8434. var temp = new _storeObject.StoreObject(_types.Types.INTEGER, (0, _parsers.toInt)(str.value.length));
  8435. sto.mode = _modes.Modes.RETURN;
  8436. return Promise.resolve(sto.updateStore("$", temp));
  8437. };
  8438. var block = new Commands.CommandBlock([], [new Commands.SysCall(lengthFun)]);
  8439. var func = new Commands.Function('$length', _types.Types.INTEGER, [new Commands.FormalParameter(_types.Types.STRING, 'str', false)], block);
  8440. return func;
  8441. }
  8442. function createUppercaseFun() {
  8443. var uppercaseFun = function uppercaseFun(sto, _) {
  8444. var str = sto.applyStore("str");
  8445. var temp = new _storeObject.StoreObject(_types.Types.STRING, str.value.toUpperCase());
  8446. sto.mode = _modes.Modes.RETURN;
  8447. return Promise.resolve(sto.updateStore("$", temp));
  8448. };
  8449. var block = new Commands.CommandBlock([], [new Commands.SysCall(uppercaseFun)]);
  8450. var func = new Commands.Function('$uppercase', _types.Types.STRING, [new Commands.FormalParameter(_types.Types.STRING, 'str', false)], block);
  8451. return func;
  8452. }
  8453. function createLowercaseFun() {
  8454. var lowercaseFun = function lowercaseFun(sto, _) {
  8455. var str = sto.applyStore("str");
  8456. var temp = new _storeObject.StoreObject(_types.Types.STRING, str.value.toLowerCase());
  8457. sto.mode = _modes.Modes.RETURN;
  8458. return Promise.resolve(sto.updateStore("$", temp));
  8459. };
  8460. var block = new Commands.CommandBlock([], [new Commands.SysCall(lowercaseFun)]);
  8461. var func = new Commands.Function('$lowercase', _types.Types.STRING, [new Commands.FormalParameter(_types.Types.STRING, 'str', false)], block);
  8462. return func;
  8463. }
  8464. function createrCharAtFun() {
  8465. var charAtFun = function charAtFun(sto, _) {
  8466. var str = sto.applyStore("str");
  8467. var idx = sto.applyStore("index");
  8468. if (idx.value.toNumber() < 0 || idx.value.toNumber() >= str.value.length) {
  8469. return Promise.reject(new Error("invalid string position"));
  8470. }
  8471. var temp = new _storeObject.StoreObject(_types.Types.STRING, str.value.charAt(idx.value.toNumber()));
  8472. sto.mode = _modes.Modes.RETURN;
  8473. return Promise.resolve(sto.updateStore("$", temp));
  8474. };
  8475. var block = new Commands.CommandBlock([], [new Commands.SysCall(charAtFun)]);
  8476. var func = new Commands.Function('$charAt', _types.Types.STRING, [new Commands.FormalParameter(_types.Types.STRING, 'str', false), new Commands.FormalParameter(_types.Types.INTEGER, 'index', false)], block);
  8477. return func;
  8478. }
  8479. /***/ }),
  8480. /***/ "./js/processor/modes.js":
  8481. /*!*******************************!*\
  8482. !*** ./js/processor/modes.js ***!
  8483. \*******************************/
  8484. /*! no static exports found */
  8485. /***/ (function(module, exports, __webpack_require__) {
  8486. "use strict";
  8487. Object.defineProperty(exports, "__esModule", {
  8488. value: true
  8489. });
  8490. var Modes = exports.Modes = Object.freeze({
  8491. RETURN: Symbol('mode:return'),
  8492. BREAK: Symbol('mode:break'),
  8493. PAUSE: Symbol('mode:pause'),
  8494. RUN: Symbol('mode:run')
  8495. });
  8496. /***/ }),
  8497. /***/ "./js/processor/semantic/semanticAnalyser.js":
  8498. /*!***************************************************!*\
  8499. !*** ./js/processor/semantic/semanticAnalyser.js ***!
  8500. \***************************************************/
  8501. /*! no static exports found */
  8502. /***/ (function(module, exports, __webpack_require__) {
  8503. "use strict";
  8504. Object.defineProperty(exports, "__esModule", {
  8505. value: true
  8506. });
  8507. exports.SemanticAnalyser = undefined;
  8508. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  8509. var _processorErrorFactory = __webpack_require__(/*! ./../error/processorErrorFactory */ "./js/processor/error/processorErrorFactory.js");
  8510. var _definedFunctions = __webpack_require__(/*! ./../definedFunctions */ "./js/processor/definedFunctions.js");
  8511. var _languageService = __webpack_require__(/*! ./../../services/languageService */ "./js/services/languageService.js");
  8512. var _commands = __webpack_require__(/*! ../../ast/commands */ "./js/ast/commands/index.js");
  8513. var _expressions = __webpack_require__(/*! ../../ast/expressions */ "./js/ast/expressions/index.js");
  8514. var _literal = __webpack_require__(/*! ../../ast/expressions/literal */ "./js/ast/expressions/literal.js");
  8515. var _compatibilityTable = __webpack_require__(/*! ../compatibilityTable */ "./js/processor/compatibilityTable.js");
  8516. var _types = __webpack_require__(/*! ../../typeSystem/types */ "./js/typeSystem/types.js");
  8517. var _compoundType = __webpack_require__(/*! ../../typeSystem/compoundType */ "./js/typeSystem/compoundType.js");
  8518. var _multiType = __webpack_require__(/*! ../../typeSystem/multiType */ "./js/typeSystem/multiType.js");
  8519. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  8520. var SemanticAnalyser = exports.SemanticAnalyser = function () {
  8521. function SemanticAnalyser(ast) {
  8522. _classCallCheck(this, SemanticAnalyser);
  8523. this.ast = ast;
  8524. this.lexerClass = _languageService.LanguageService.getCurrentLexer();
  8525. var lexer = new this.lexerClass(null);
  8526. this.literalNames = lexer.literalNames;
  8527. this.symbolMap = null;
  8528. this.currentFunction = null;
  8529. }
  8530. _createClass(SemanticAnalyser, [{
  8531. key: 'pushMap',
  8532. value: function pushMap() {
  8533. if (this.symbolMap === null) {
  8534. this.symbolMap = { map: {}, next: null };
  8535. } else {
  8536. var n = { map: {}, next: this.symbolMap };
  8537. this.symbolMap = n;
  8538. }
  8539. }
  8540. }, {
  8541. key: 'popMap',
  8542. value: function popMap() {
  8543. if (this.symbolMap !== null) {
  8544. this.symbolMap = this.symbolMap.next;
  8545. }
  8546. }
  8547. }, {
  8548. key: 'insertSymbol',
  8549. value: function insertSymbol(id, typeInfo) {
  8550. this.symbolMap.map[id] = typeInfo;
  8551. }
  8552. }, {
  8553. key: 'findSymbol',
  8554. value: function findSymbol(id, symMap) {
  8555. if (!symMap.map[id]) {
  8556. if (symMap.next) {
  8557. return this.findSymbol(id, symMap.next);
  8558. }
  8559. return null;
  8560. } else {
  8561. return symMap.map[id];
  8562. }
  8563. }
  8564. }, {
  8565. key: 'getMainFunction',
  8566. value: function getMainFunction() {
  8567. return this.ast.functions.find(function (v) {
  8568. return v.isMain;
  8569. });
  8570. }
  8571. }, {
  8572. key: 'findFunction',
  8573. value: function findFunction(name) {
  8574. if (name.match(/^\$.+$/)) {
  8575. var fun = _definedFunctions.LanguageDefinedFunction.getFunction(name);
  8576. if (!!!fun) {
  8577. throw _processorErrorFactory.ProcessorErrorFactory.not_implemented(name);
  8578. }
  8579. return fun;
  8580. } else {
  8581. var val = this.ast.functions.find(function (v) {
  8582. return v.name === name;
  8583. });
  8584. if (!!!val) {
  8585. return null;
  8586. }
  8587. return val;
  8588. }
  8589. }
  8590. }, {
  8591. key: 'analyseTree',
  8592. value: function analyseTree() {
  8593. var globalVars = this.ast.global;
  8594. this.pushMap();
  8595. this.assertDeclarations(globalVars);
  8596. var functions = this.ast.functions;
  8597. var mainFunc = functions.filter(function (f) {
  8598. return f.name === null;
  8599. });
  8600. if (mainFunc.length <= 0) {
  8601. throw _processorErrorFactory.ProcessorErrorFactory.main_missing();
  8602. }
  8603. for (var i = 0; i < functions.length; i++) {
  8604. var fun = functions[i];
  8605. this.assertFunction(fun);
  8606. }
  8607. return this.ast;
  8608. }
  8609. }, {
  8610. key: 'assertDeclarations',
  8611. value: function assertDeclarations(list) {
  8612. for (var i = 0; i < list.length; i++) {
  8613. this.assertDeclaration(list[i]);
  8614. }
  8615. }
  8616. }, {
  8617. key: 'assertDeclaration',
  8618. value: function assertDeclaration(declaration) {
  8619. if (declaration instanceof _commands.ArrayDeclaration) {
  8620. if (declaration.initial === null) {
  8621. var lineType = this.evaluateExpressionType(declaration.lines);
  8622. if (!lineType.isCompatible(_types.Types.INTEGER)) {
  8623. throw _processorErrorFactory.ProcessorErrorFactory.array_dimension_not_int_full(declaration.sourceInfo);
  8624. }
  8625. if (declaration.columns !== null) {
  8626. var columnType = this.evaluateExpressionType(declaration.columns);
  8627. if (!columnType.isCompatible(_types.Types.INTEGER)) {
  8628. throw _processorErrorFactory.ProcessorErrorFactory.array_dimension_not_int_full(declaration.sourceInfo);
  8629. }
  8630. }
  8631. this.insertSymbol(declaration.id, { id: declaration.id, lines: declaration.lines, columns: declaration.columns, type: declaration.type });
  8632. return;
  8633. }
  8634. this.evaluateArrayLiteral(declaration.id, declaration.lines, declaration.columns, declaration.type, declaration.initial);
  8635. this.insertSymbol(declaration.id, { id: declaration.id, lines: declaration.lines, columns: declaration.columns, type: declaration.type });
  8636. } else {
  8637. if (declaration.initial === null) {
  8638. this.insertSymbol(declaration.id, { id: declaration.id, type: declaration.type });
  8639. return;
  8640. }
  8641. var resultType = this.evaluateExpressionType(declaration.initial);
  8642. if (resultType instanceof _multiType.MultiType) {
  8643. if (!resultType.isCompatible(declaration.type)) {
  8644. var stringInfo = declaration.type.stringInfo();
  8645. var info = stringInfo[0];
  8646. throw _processorErrorFactory.ProcessorErrorFactory.incompatible_types_full(info.type, info.dim, declaration.sourceInfo);
  8647. }
  8648. this.insertSymbol(declaration.id, { id: declaration.id, type: declaration.type });
  8649. } else if (!declaration.type.isCompatible(resultType)) {
  8650. var _stringInfo = declaration.type.stringInfo();
  8651. var _info = _stringInfo[0];
  8652. throw _processorErrorFactory.ProcessorErrorFactory.incompatible_types_full(_info.type, _info.dim, declaration.sourceInfo);
  8653. } else {
  8654. this.insertSymbol(declaration.id, { id: declaration.id, type: declaration.type });
  8655. }
  8656. }
  8657. }
  8658. }, {
  8659. key: 'evaluateExpressionType',
  8660. value: function evaluateExpressionType(expression) {
  8661. if (expression instanceof _expressions.UnaryApp) {
  8662. var op = expression.op;
  8663. var resultType = this.evaluateExpressionType(expression.left);
  8664. return (0, _compatibilityTable.resultTypeAfterUnaryOp)(op, resultType);
  8665. } else if (expression instanceof _expressions.InfixApp) {
  8666. var _op = expression.op;
  8667. var resultTypeLeft = this.evaluateExpressionType(expression.left);
  8668. var resultTypeRight = this.evaluateExpressionType(expression.right);
  8669. return (0, _compatibilityTable.resultTypeAfterInfixOp)(_op, resultTypeLeft, resultTypeRight);
  8670. } else if (expression instanceof _literal.Literal) {
  8671. return this.evaluateLiteralType(expression);
  8672. } else if (expression instanceof _expressions.FunctionCall) {
  8673. if (expression.isMainCall) {
  8674. throw _processorErrorFactory.ProcessorErrorFactory.void_in_expression_full(_definedFunctions.LanguageDefinedFunction.getMainFunctionName(), expression.sourceInfo);
  8675. }
  8676. var fun = this.findFunction(expression.id);
  8677. if (fun === null) {
  8678. throw _processorErrorFactory.ProcessorErrorFactory.function_missing_full(expression.id, expression.sourceInfo);
  8679. }
  8680. if (fun.returnType.isCompatible(_types.Types.VOID)) {
  8681. throw _processorErrorFactory.ProcessorErrorFactory.void_in_expression_full(expression.id, expression.sourceInfo);
  8682. }
  8683. this.assertParameters(fun, expression.actualParameters);
  8684. return fun.returnType;
  8685. } else if (expression instanceof _expressions.ArrayAccess) {
  8686. var arrayTypeInfo = this.findSymbol(expression.id, this.symbolMap);
  8687. if (arrayTypeInfo === null) {
  8688. throw _processorErrorFactory.ProcessorErrorFactory.symbol_not_found_full(expression.id, expression.sourceInfo);
  8689. }
  8690. if (!(arrayTypeInfo.type instanceof _compoundType.CompoundType)) {
  8691. throw _processorErrorFactory.ProcessorErrorFactory.invalid_array_access_full(expression.id, expression.sourceInfo);
  8692. }
  8693. var lineType = this.evaluateExpressionType(expression.line);
  8694. if (!lineType.isCompatible(_types.Types.INTEGER)) {
  8695. throw _processorErrorFactory.ProcessorErrorFactory.array_dimension_not_int_full(expression.sourceInfo);
  8696. }
  8697. if (expression.column !== null) {
  8698. if (arrayTypeInfo.columns === null) {
  8699. throw _processorErrorFactory.ProcessorErrorFactory.invalid_matrix_access_full(expression.id, expression.sourceInfo);
  8700. }
  8701. var columnType = this.evaluateExpressionType(expression.column);
  8702. if (!columnType.isCompatible(_types.Types.INTEGER)) {
  8703. throw _processorErrorFactory.ProcessorErrorFactory.array_dimension_not_int_full(expression.sourceInfo);
  8704. }
  8705. }
  8706. var arrType = arrayTypeInfo.type;
  8707. if (expression.column !== null) {
  8708. // indexing matrix
  8709. return arrType.innerType;
  8710. } else {
  8711. if (arrayTypeInfo.columns === null) {
  8712. return arrType.innerType;
  8713. }
  8714. return new _compoundType.CompoundType(arrType.innerType, 1);
  8715. }
  8716. }
  8717. }
  8718. }, {
  8719. key: 'evaluateLiteralType',
  8720. value: function evaluateLiteralType(literal) {
  8721. if (literal instanceof _expressions.IntLiteral) {
  8722. return literal.type;
  8723. } else if (literal instanceof _expressions.RealLiteral) {
  8724. return literal.type;
  8725. } else if (literal instanceof _expressions.StringLiteral) {
  8726. return literal.type;
  8727. } else if (literal instanceof _expressions.BoolLiteral) {
  8728. return literal.type;
  8729. } else if (literal instanceof _expressions.VariableLiteral) {
  8730. var typeInfo = this.findSymbol(literal.id, this.symbolMap);
  8731. if (typeInfo === null) {
  8732. throw _processorErrorFactory.ProcessorErrorFactory.symbol_not_found_full(literal.id, literal.sourceInfo);
  8733. }
  8734. if (typeInfo.type instanceof _compoundType.CompoundType) {
  8735. return typeInfo.type;
  8736. }
  8737. return typeInfo.type;
  8738. } else {
  8739. console.warn("Evaluating type only for an array literal...");
  8740. var last = null;
  8741. if (literal.value.length === 1) {
  8742. last = this.evaluateExpressionType(literal.value[0]);
  8743. } else {
  8744. for (var i = 0; i < literal.value.length; i++) {
  8745. var e = this.evaluateExpressionType(literal.value[i]);
  8746. if (last === null) {
  8747. last = e;
  8748. } else if (!last.isCompatible(e)) {
  8749. var strInfo = last.stringInfo();
  8750. var info = strInfo[0];
  8751. var strExp = literal.toString();
  8752. throw _processorErrorFactory.ProcessorErrorFactory.incompatible_types_array_full(strExp, info.type, info.dim, literal.sourceInfo);
  8753. }
  8754. }
  8755. }
  8756. if (last instanceof _compoundType.CompoundType) {
  8757. return new _compoundType.CompoundType(last.innerType, last.dimensions + 1);
  8758. }
  8759. return new _compoundType.CompoundType(last, 1);
  8760. }
  8761. }
  8762. }, {
  8763. key: 'evaluateArrayLiteral',
  8764. value: function evaluateArrayLiteral(id, lines, columns, type, literal) {
  8765. var _this = this;
  8766. if (literal instanceof _expressions.ArrayLiteral) {
  8767. if (columns === null) {
  8768. // it's a vector...
  8769. var dimType = this.evaluateExpressionType(lines);
  8770. if (!dimType.isCompatible(_types.Types.INTEGER)) {
  8771. throw _processorErrorFactory.ProcessorErrorFactory.array_dimension_not_int_full(literal.sourceInfo);
  8772. }
  8773. if (lines instanceof _expressions.IntLiteral) {
  8774. if (!lines.value.eq(literal.value.length)) {
  8775. if (type.dimensions > 1) {
  8776. throw _processorErrorFactory.ProcessorErrorFactory.matrix_line_outbounds_full(id, literal.value.length, lines.values.toNumber(), literal.sourceInfo);
  8777. } else {
  8778. throw _processorErrorFactory.ProcessorErrorFactory.vector_line_outbounds_full(id, literal.value.length, lines.values.toNumber(), literal.sourceInfo);
  8779. }
  8780. } else if (lines.value.isNeg()) {
  8781. throw _processorErrorFactory.ProcessorErrorFactory.array_dimension_not_positive_full(literal.sourceInfo);
  8782. }
  8783. }
  8784. literal.value.reduce(function (last, next) {
  8785. var eType = _this.evaluateExpressionType(next);
  8786. if (!last.canAccept(eType)) {
  8787. var strInfo = last.stringInfo();invalid;
  8788. var info = strInfo[0];
  8789. var strExp = literal.toString();
  8790. throw _processorErrorFactory.ProcessorErrorFactory.incompatible_types_array_full(strExp, info.type, info.dim, literal.sourceInfo);
  8791. }
  8792. return last;
  8793. }, type);
  8794. return true;
  8795. } else {
  8796. var _dimType = this.evaluateExpressionType(columns);
  8797. if (!_dimType.isCompatible(_types.Types.INTEGER)) {
  8798. throw _processorErrorFactory.ProcessorErrorFactory.array_dimension_not_int_full(literal.sourceInfo);
  8799. }
  8800. if (columns instanceof _expressions.IntLiteral) {
  8801. if (!columns.value.eq(literal.value.length)) {
  8802. if (type.dimensions > 1) {
  8803. throw _processorErrorFactory.ProcessorErrorFactory.matrix_column_outbounds_full(id, literal.value.length, columns.values.toNumber(), literal.sourceInfo);
  8804. } else {
  8805. throw _processorErrorFactory.ProcessorErrorFactory.invalid_matrix_access_full(id, literal.sourceInfo);
  8806. }
  8807. } else if (columns.value.isNeg()) {
  8808. throw _processorErrorFactory.ProcessorErrorFactory.array_dimension_not_positive_full(literal.sourceInfo);
  8809. }
  8810. }
  8811. for (var i = 0; i < columns; i++) {
  8812. var anotherArray = literal.value[i];
  8813. this.evaluateArrayLiteral(id, lines, null, type, anotherArray);
  8814. }
  8815. }
  8816. } else {
  8817. var resultType = this.evaluateExpressionType(literal);
  8818. if (!(resultType instanceof _compoundType.CompoundType)) {
  8819. var strInfo = type.stringInfo();
  8820. var info = strInfo[0];
  8821. var strExp = literal.toString();
  8822. throw _processorErrorFactory.ProcessorErrorFactory.incompatible_types_array_full(strExp, info.type, info.dim, literal.sourceInfo);
  8823. }
  8824. if (!type.isCompatible(resultType)) {
  8825. var _strInfo = type.stringInfo();
  8826. var _info2 = _strInfo[0];
  8827. var _strExp = literal.toString();
  8828. throw _processorErrorFactory.ProcessorErrorFactory.incompatible_types_array_full(_strExp, _info2.type, _info2.dim, literal.sourceInfo);
  8829. }
  8830. return true;
  8831. }
  8832. }
  8833. }, {
  8834. key: 'assertFunction',
  8835. value: function assertFunction(fun) {
  8836. var _this2 = this;
  8837. this.pushMap();
  8838. this.currentFunction = fun;
  8839. fun.formalParameters.forEach(function (formalParam) {
  8840. if (formalParam.type instanceof _compoundType.CompoundType) {
  8841. if (formalParam.type.dimensions > 1) {
  8842. _this2.insertSymbol(formalParam.id, { id: formalParam.id, lines: -1, columns: -1, type: formalParam.type });
  8843. } else {
  8844. _this2.insertSymbol(formalParam.id, { id: formalParam.id, lines: -1, columns: null, type: formalParam.type });
  8845. }
  8846. } else {
  8847. _this2.insertSymbol(formalParam.id, { id: formalParam.id, type: formalParam.type });
  8848. }
  8849. });
  8850. this.assertDeclarations(fun.variablesDeclarations);
  8851. var optional = fun.returnType.isCompatible(_types.Types.VOID);
  8852. var valid = this.assertReturn(fun, optional);
  8853. if (!valid) {
  8854. throw _processorErrorFactory.ProcessorErrorFactory.function_no_return(fun.name);
  8855. }
  8856. this.popMap();
  8857. }
  8858. }, {
  8859. key: 'assertReturn',
  8860. value: function assertReturn(fun, optional) {
  8861. var _this3 = this;
  8862. return fun.commands.reduce(function (last, next) {
  8863. return _this3.checkCommand(fun.returnType, next, optional) || last;
  8864. }, optional);
  8865. }
  8866. }, {
  8867. key: 'checkCommand',
  8868. value: function checkCommand(type, cmd, optional) {
  8869. if (cmd instanceof _commands.While) {
  8870. var resultType = this.evaluateExpressionType(cmd.expression);
  8871. if (!resultType.isCompatible(_types.Types.BOOLEAN)) {
  8872. throw _processorErrorFactory.ProcessorErrorFactory.loop_condition_type_full(cmd.sourceInfo);
  8873. }
  8874. this.checkCommands(type, cmd.commands, optional);
  8875. return false;
  8876. } else if (cmd instanceof _commands.For) {
  8877. this.checkCommand(type, cmd.assignment, optional);
  8878. var _resultType = this.evaluateExpressionType(cmd.condition);
  8879. if (!_resultType.isCompatible(_types.Types.BOOLEAN)) {
  8880. throw _processorErrorFactory.ProcessorErrorFactory.for_condition_type_full(cmd.sourceInfo);
  8881. }
  8882. this.checkCommand(type, cmd.increment, optional);
  8883. this.checkCommands(type, cmd.commands, optional);
  8884. return false;
  8885. } else if (cmd instanceof _commands.Switch) {
  8886. var sType = this.evaluateExpressionType(cmd.expression);
  8887. var result = optional;
  8888. var hasDefault = false;
  8889. for (var i = 0; i < cmd.cases.length; i++) {
  8890. var aCase = cmd.cases[i];
  8891. if (aCase.expression !== null) {
  8892. var caseType = this.evaluateExpressionType(aCase.expression);
  8893. if (!sType.isCompatible(caseType)) {
  8894. var strInfo = sType.stringInfo();
  8895. var info = strInfo[0];
  8896. var strExp = aCase.expression.toString();
  8897. throw _processorErrorFactory.ProcessorErrorFactory.invalid_case_type_full(strExp, info.type, info.dim, aCase.sourceInfo);
  8898. }
  8899. } else {
  8900. hasDefault = true;
  8901. }
  8902. result = result && this.checkCommands(type, aCase.commands, result);
  8903. }
  8904. return result && hasDefault;
  8905. } else if (cmd instanceof _commands.ArrayIndexAssign) {
  8906. var typeInfo = this.findSymbol(cmd.id, this.symbolMap);
  8907. if (typeInfo === null) {
  8908. throw _processorErrorFactory.ProcessorErrorFactory.symbol_not_found_full(cmd.id, cmd.sourceInfo);
  8909. }
  8910. if (!(typeInfo.type instanceof _compoundType.CompoundType)) {
  8911. throw _processorErrorFactory.ProcessorErrorFactory.invalid_array_access_full(cmd.id, cmd.sourceInfo);
  8912. }
  8913. var exp = cmd.expression;
  8914. var lineExp = cmd.line;
  8915. var lineType = this.evaluateExpressionType(lineExp);
  8916. if (!lineType.isCompatible(_types.Types.INTEGER)) {
  8917. throw _processorErrorFactory.ProcessorErrorFactory.array_dimension_not_int_full(cmd.sourceInfo);
  8918. }
  8919. var columnExp = cmd.column;
  8920. if (typeInfo.columns === null && columnExp !== null) {
  8921. throw _processorErrorFactory.ProcessorErrorFactory.invalid_matrix_access_full(cmd.id, cmd.sourceInfo);
  8922. } else if (columnExp !== null) {
  8923. var columnType = this.evaluateExpressionType(columnExp);
  8924. if (!columnType.isCompatible(_types.Types.INTEGER)) {
  8925. throw _processorErrorFactory.ProcessorErrorFactory.array_dimension_not_int_full(cmd.sourceInfo);
  8926. }
  8927. }
  8928. // exp can be a arrayLiteral, a single value exp or an array access
  8929. if (exp instanceof _expressions.ArrayLiteral) {
  8930. this.evaluateArrayLiteral(cmd.id, typeInfo.lines, columnExp ? typeInfo.columns : null, typeInfo.type, exp);
  8931. } else {
  8932. // cannot properly evaluate since type system is poorly constructed
  8933. }
  8934. return optional;
  8935. } else if (cmd instanceof _commands.Assign) {
  8936. var _typeInfo = this.findSymbol(cmd.id, this.symbolMap);
  8937. if (_typeInfo === null) {
  8938. throw _processorErrorFactory.ProcessorErrorFactory.symbol_not_found_full(cmd.id, cmd.sourceInfo);
  8939. }
  8940. var _exp = cmd.expression;
  8941. if (_exp instanceof _expressions.ArrayLiteral) {
  8942. if (!(_typeInfo.type instanceof _compoundType.CompoundType)) {
  8943. var stringInfo = _typeInfo.type.stringInfo();
  8944. var _info3 = stringInfo[0];
  8945. throw _processorErrorFactory.ProcessorErrorFactory.incompatible_types_full(_info3.type, _info3.dim, cmd.sourceInfo);
  8946. }
  8947. this.evaluateArrayLiteral(cmd.id, _typeInfo.lines, _typeInfo.columns, _typeInfo.type, _exp);
  8948. } else {
  8949. var _resultType2 = this.evaluateExpressionType(_exp);
  8950. if (!_resultType2.isCompatible(_typeInfo.type)) {
  8951. var _stringInfo2 = _typeInfo.type.stringInfo();
  8952. var _info4 = _stringInfo2[0];
  8953. throw _processorErrorFactory.ProcessorErrorFactory.incompatible_types_full(_info4.type, _info4.dim, cmd.sourceInfo);
  8954. }
  8955. }
  8956. return optional;
  8957. } else if (cmd instanceof _commands.Break) {
  8958. return optional;
  8959. } else if (cmd instanceof _commands.IfThenElse) {
  8960. var _resultType3 = this.evaluateExpressionType(cmd.condition);
  8961. if (!_resultType3.isCompatible(_types.Types.BOOLEAN)) {
  8962. throw _processorErrorFactory.ProcessorErrorFactory.if_condition_type_full(cmd.sourceInfo);
  8963. }
  8964. if (cmd.ifFalse instanceof _commands.IfThenElse) {
  8965. return this.checkCommands(type, cmd.ifTrue.commands, optional) && this.checkCommand(type, cmd.ifFalse, optional);
  8966. } else {
  8967. return this.checkCommands(type, cmd.ifTrue.commands, optional) && this.checkCommands(type, cmd.ifFalse.commands, optional);
  8968. }
  8969. } else if (cmd instanceof _expressions.FunctionCall) {
  8970. var fun = null;
  8971. if (cmd.isMainCall) {
  8972. fun = this.getMainFunction();
  8973. } else {
  8974. fun = this.findFunction(cmd.id);
  8975. }
  8976. if (fun === null) {
  8977. throw _processorErrorFactory.ProcessorErrorFactory.function_missing_full(cmd.id, cmd.sourceInfo);
  8978. }
  8979. this.assertParameters(fun, cmd.actualParameters);
  8980. return optional;
  8981. } else if (cmd instanceof _commands.Return) {
  8982. var funcName = this.currentFunction.isMain ? _definedFunctions.LanguageDefinedFunction.getMainFunctionName() : this.currentFunction.name;
  8983. if (cmd.expression === null && !type.isCompatible(_types.Types.VOID)) {
  8984. var _stringInfo3 = type.stringInfo();
  8985. var _info5 = _stringInfo3[0];
  8986. throw _processorErrorFactory.ProcessorErrorFactory.invalid_void_return_full(funcName, _info5.type, _info5.dim, cmd.sourceInfo);
  8987. } else if (cmd.expression !== null) {
  8988. var _resultType4 = this.evaluateExpressionType(cmd.expression);
  8989. if (!type.isCompatible(_resultType4)) {
  8990. var _stringInfo4 = type.stringInfo();
  8991. var _info6 = _stringInfo4[0];
  8992. throw _processorErrorFactory.ProcessorErrorFactory.invalid_return_type_full(funcName, _info6.type, _info6.dim, cmd.sourceInfo);
  8993. } else {
  8994. return true;
  8995. }
  8996. } else {
  8997. return true;
  8998. }
  8999. }
  9000. }
  9001. }, {
  9002. key: 'checkCommands',
  9003. value: function checkCommands(type, cmds, optional) {
  9004. var _this4 = this;
  9005. return cmds.reduce(function (last, next) {
  9006. return _this4.checkCommand(type, next, optional) || last;
  9007. }, optional);
  9008. }
  9009. }, {
  9010. key: 'assertParameters',
  9011. value: function assertParameters(fun, actualParametersList) {
  9012. if (fun.formalParameters.length !== actualParametersList.length) {
  9013. throw _processorErrorFactory.ProcessorErrorFactory.invalid_parameters_size_full(fun.name, actualParametersList.length, fun.formalParameters.length, null);
  9014. }
  9015. for (var i = 0; i < actualParametersList.length; i++) {
  9016. var param = actualParametersList[i];
  9017. var formalParam = fun.formalParameters[i];
  9018. var id = formalParam.id;
  9019. if (formalParam.byRef) {
  9020. if (!(param instanceof _expressions.VariableLiteral || param instanceof _expressions.ArrayAccess)) {
  9021. throw _processorErrorFactory.ProcessorErrorFactory.invalid_parameter_type_full(id, param.toString(), param.sourceInfo);
  9022. }
  9023. }
  9024. var resultType = this.evaluateExpressionType(param);
  9025. if (resultType instanceof _multiType.MultiType && formalParam.type instanceof _multiType.MultiType) {
  9026. var shared = 0;
  9027. for (var j = 0; j < resultType.types.length; j++) {
  9028. var element = resultType.types[j];
  9029. if (formalParam.type.types.indexOf(element) !== -1) {
  9030. shared++;
  9031. }
  9032. }
  9033. if (shared <= 0) {
  9034. throw _processorErrorFactory.ProcessorErrorFactory.invalid_parameter_type_full(id, param.toString(), param.sourceInfo);
  9035. }
  9036. } else if (resultType instanceof _multiType.MultiType) {
  9037. if (!resultType.isCompatible(formalParam.type)) {
  9038. throw _processorErrorFactory.ProcessorErrorFactory.invalid_parameter_type_full(id, param.toString(), param.sourceInfo);
  9039. }
  9040. } else if (!formalParam.type.isCompatible(resultType)) {
  9041. throw _processorErrorFactory.ProcessorErrorFactory.invalid_parameter_type_full(id, param.toString(), param.sourceInfo);
  9042. }
  9043. }
  9044. }
  9045. }]);
  9046. return SemanticAnalyser;
  9047. }();
  9048. /***/ }),
  9049. /***/ "./js/processor/store/store.js":
  9050. /*!*************************************!*\
  9051. !*** ./js/processor/store/store.js ***!
  9052. \*************************************/
  9053. /*! no static exports found */
  9054. /***/ (function(module, exports, __webpack_require__) {
  9055. "use strict";
  9056. Object.defineProperty(exports, "__esModule", {
  9057. value: true
  9058. });
  9059. exports.Store = undefined;
  9060. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  9061. var _modes = __webpack_require__(/*! ./../modes */ "./js/processor/modes.js");
  9062. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  9063. var Store = exports.Store = function () {
  9064. function Store(name) {
  9065. _classCallCheck(this, Store);
  9066. this.name = name;
  9067. this.store = {};
  9068. this.nextStore = null;
  9069. this.mode = _modes.Modes.RUN;
  9070. }
  9071. _createClass(Store, [{
  9072. key: "extendStore",
  9073. value: function extendStore(nextStore) {
  9074. this.nextStore = nextStore;
  9075. }
  9076. }, {
  9077. key: "applyStore",
  9078. value: function applyStore(id) {
  9079. if (!this.store[id]) {
  9080. if (this.nextStore !== null) {
  9081. return this.nextStore.applyStore(id);
  9082. } else {
  9083. // TODO: better error message
  9084. throw new Error("Variable " + id + " not found.");
  9085. }
  9086. }
  9087. var val = this.store[id];
  9088. if (val.isRef) {
  9089. return val.getRefObj();
  9090. }
  9091. return this.store[id];
  9092. }
  9093. }, {
  9094. key: "updateStore",
  9095. value: function updateStore(id, stoObj) {
  9096. if (!this.store[id]) {
  9097. if (this.nextStore !== null) {
  9098. this.nextStore.updateStore(id, stoObj);
  9099. return this;
  9100. } else {
  9101. // TODO: better error message
  9102. throw new Error("Variable " + id + " not found.");
  9103. }
  9104. } else {
  9105. var oldObj = this.store[id];
  9106. if (oldObj.readOnly) {
  9107. // TODO: better error message
  9108. throw new Error("Cannot change value of a read only variable: " + id);
  9109. }
  9110. if (oldObj.isRef) {
  9111. oldObj.updateRef(stoObj);
  9112. return this;
  9113. } else if (oldObj.isCompatible(stoObj)) {
  9114. stoObj.setID(id);
  9115. this.store[id] = Object.freeze(stoObj);
  9116. return this;
  9117. } else {
  9118. var oldType = oldObj.type;
  9119. var stoType = stoObj.type;
  9120. // TODO: better error message
  9121. throw new Error(oldType + " is not compatible with type " + stoType + " given");
  9122. }
  9123. }
  9124. }
  9125. //In case of future use of ref, it needs to have a special function to update the storeRefObject
  9126. // and no the StoreObject refferenced by it
  9127. // updateStoreRef(id, stoObjAddress) {...}
  9128. }, {
  9129. key: "insertStore",
  9130. value: function insertStore(id, stoObj) {
  9131. if (this.store[id]) {
  9132. // TODO: better error message
  9133. throw new Error(id + " is already defined");
  9134. }
  9135. stoObj.setID(id);
  9136. this.store[id] = Object.freeze(stoObj);
  9137. return this;
  9138. }
  9139. }]);
  9140. return Store;
  9141. }();
  9142. /***/ }),
  9143. /***/ "./js/processor/store/storeObject.js":
  9144. /*!*******************************************!*\
  9145. !*** ./js/processor/store/storeObject.js ***!
  9146. \*******************************************/
  9147. /*! no static exports found */
  9148. /***/ (function(module, exports, __webpack_require__) {
  9149. "use strict";
  9150. Object.defineProperty(exports, "__esModule", {
  9151. value: true
  9152. });
  9153. exports.StoreObject = undefined;
  9154. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  9155. var _decimal = __webpack_require__(/*! decimal.js */ "./node_modules/decimal.js/decimal.js");
  9156. var _decimal2 = _interopRequireDefault(_decimal);
  9157. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  9158. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  9159. var StoreObject = exports.StoreObject = function () {
  9160. function StoreObject(type, value) {
  9161. var readOnly = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  9162. _classCallCheck(this, StoreObject);
  9163. this._type = type;
  9164. this._value = value;
  9165. this._readOnly = readOnly;
  9166. this._id = null;
  9167. }
  9168. _createClass(StoreObject, [{
  9169. key: 'setID',
  9170. value: function setID(id) {
  9171. this._id = id;
  9172. }
  9173. }, {
  9174. key: 'isCompatible',
  9175. value: function isCompatible(another) {
  9176. if (another instanceof StoreObject) {
  9177. return this.type.isCompatible(another.type);
  9178. }
  9179. return false;
  9180. }
  9181. }, {
  9182. key: 'id',
  9183. get: function get() {
  9184. return this._id;
  9185. }
  9186. }, {
  9187. key: 'inStore',
  9188. get: function get() {
  9189. return this.id !== null;
  9190. }
  9191. }, {
  9192. key: 'type',
  9193. get: function get() {
  9194. return this._type;
  9195. }
  9196. }, {
  9197. key: 'value',
  9198. get: function get() {
  9199. return this._value;
  9200. }
  9201. }, {
  9202. key: 'number',
  9203. get: function get() {
  9204. if (this._value instanceof _decimal2.default) {
  9205. return this._value.toNumber();
  9206. } else {
  9207. return null;
  9208. }
  9209. }
  9210. }, {
  9211. key: 'readOnly',
  9212. get: function get() {
  9213. return this._readOnly;
  9214. },
  9215. set: function set(value) {
  9216. this._readOnly = value;
  9217. }
  9218. }]);
  9219. return StoreObject;
  9220. }();
  9221. /***/ }),
  9222. /***/ "./js/processor/store/storeObjectArray.js":
  9223. /*!************************************************!*\
  9224. !*** ./js/processor/store/storeObjectArray.js ***!
  9225. \************************************************/
  9226. /*! no static exports found */
  9227. /***/ (function(module, exports, __webpack_require__) {
  9228. "use strict";
  9229. Object.defineProperty(exports, "__esModule", {
  9230. value: true
  9231. });
  9232. exports.StoreObjectArray = undefined;
  9233. var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };
  9234. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  9235. var _storeObject = __webpack_require__(/*! ./storeObject */ "./js/processor/store/storeObject.js");
  9236. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  9237. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  9238. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  9239. var StoreObjectArray = exports.StoreObjectArray = function (_StoreObject) {
  9240. _inherits(StoreObjectArray, _StoreObject);
  9241. _createClass(StoreObjectArray, null, [{
  9242. key: 'WRONG_LINE_NUMBER',
  9243. get: function get() {
  9244. return 1;
  9245. }
  9246. }, {
  9247. key: 'WRONG_TYPE',
  9248. get: function get() {
  9249. return 2;
  9250. }
  9251. }, {
  9252. key: 'WRONG_COLUMN_NUMBER',
  9253. get: function get() {
  9254. return 3;
  9255. }
  9256. }]);
  9257. function StoreObjectArray(type, lines, columns) {
  9258. var value = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
  9259. var readOnly = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
  9260. _classCallCheck(this, StoreObjectArray);
  9261. var _this = _possibleConstructorReturn(this, (StoreObjectArray.__proto__ || Object.getPrototypeOf(StoreObjectArray)).call(this, type, value, readOnly));
  9262. _this._lines = lines;
  9263. _this._columns = columns;
  9264. return _this;
  9265. }
  9266. _createClass(StoreObjectArray, [{
  9267. key: 'isCompatible',
  9268. value: function isCompatible(another) {
  9269. if (another instanceof _storeObject.StoreObject) {
  9270. if (this.lines === -1 && another.lines > 0 || this.lines === another.lines) {
  9271. if (this.columns === -1 && another.columns > 0 || this.columns === another.columns) {
  9272. return _get(StoreObjectArray.prototype.__proto__ || Object.getPrototypeOf(StoreObjectArray.prototype), 'isCompatible', this).call(this, another);
  9273. }
  9274. }
  9275. }
  9276. return false;
  9277. }
  9278. }, {
  9279. key: 'lines',
  9280. get: function get() {
  9281. return this._lines;
  9282. }
  9283. }, {
  9284. key: 'columns',
  9285. get: function get() {
  9286. return this._columns;
  9287. }
  9288. }, {
  9289. key: 'isVector',
  9290. get: function get() {
  9291. return this.type.dimensions === 1;
  9292. }
  9293. }, {
  9294. key: 'isValid',
  9295. get: function get() {
  9296. var _this2 = this;
  9297. if (this.value !== null) {
  9298. if (this.isVector) {
  9299. if (this.value.length !== this.lines) {
  9300. return [StoreObjectArray.WRONG_LINE_NUMBER, this.value.length];;
  9301. }
  9302. var mustBeNull = this.value.find(function (v) {
  9303. return !_this2.type.canAccept(v.type);
  9304. });
  9305. if (!!mustBeNull) {
  9306. return [StoreObjectArray.WRONG_TYPE, this.value.indexOf(mustBeNull)];;
  9307. }
  9308. }
  9309. return [];
  9310. } else {
  9311. if (this.lines !== this.value.length) {
  9312. return [StoreObjectArray.WRONG_LINE_NUMBER, this.value.length];
  9313. }
  9314. for (var i = 0; i < this.lines; i++) {
  9315. for (var j = 0; j < this.columns; j++) {
  9316. var arr = this.value[i];
  9317. if (arr.length !== this.columns) {
  9318. return [StoreObjectArray.WRONG_COLUMN_NUMBER, arr.length];
  9319. }
  9320. var _mustBeNull = arr.find(function (v) {
  9321. return !_this2.type.canAccept(v.type);
  9322. });
  9323. if (!!_mustBeNull) {
  9324. return [StoreObjectArray.WRONG_TYPE, i, arr.indexOf(_mustBeNull)];
  9325. }
  9326. }
  9327. }
  9328. return [];
  9329. }
  9330. }
  9331. }]);
  9332. return StoreObjectArray;
  9333. }(_storeObject.StoreObject);
  9334. /***/ }),
  9335. /***/ "./js/processor/store/storeObjectArrayAddress.js":
  9336. /*!*******************************************************!*\
  9337. !*** ./js/processor/store/storeObjectArrayAddress.js ***!
  9338. \*******************************************************/
  9339. /*! no static exports found */
  9340. /***/ (function(module, exports, __webpack_require__) {
  9341. "use strict";
  9342. Object.defineProperty(exports, "__esModule", {
  9343. value: true
  9344. });
  9345. exports.StoreObjectArrayAddress = undefined;
  9346. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  9347. var _storeObject = __webpack_require__(/*! ./storeObject */ "./js/processor/store/storeObject.js");
  9348. var _storeObjectArray = __webpack_require__(/*! ./storeObjectArray */ "./js/processor/store/storeObjectArray.js");
  9349. var _compoundType = __webpack_require__(/*! ../../typeSystem/compoundType */ "./js/typeSystem/compoundType.js");
  9350. var _processorErrorFactory = __webpack_require__(/*! ../error/processorErrorFactory */ "./js/processor/error/processorErrorFactory.js");
  9351. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  9352. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  9353. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  9354. var StoreObjectArrayAddress = exports.StoreObjectArrayAddress = function (_StoreObject) {
  9355. _inherits(StoreObjectArrayAddress, _StoreObject);
  9356. function StoreObjectArrayAddress(refID, line, column, store) {
  9357. _classCallCheck(this, StoreObjectArrayAddress);
  9358. var _this = _possibleConstructorReturn(this, (StoreObjectArrayAddress.__proto__ || Object.getPrototypeOf(StoreObjectArrayAddress)).call(this, null, null, false));
  9359. _this.refID = refID;
  9360. _this.store = store;
  9361. _this.line = line;
  9362. _this.column = column;
  9363. return _this;
  9364. }
  9365. _createClass(StoreObjectArrayAddress, [{
  9366. key: 'getArrayObject',
  9367. value: function getArrayObject() {
  9368. return this.store.applyStore(this.refID);
  9369. }
  9370. }, {
  9371. key: 'updateArrayObject',
  9372. value: function updateArrayObject(stoObj) {
  9373. var anArray = this.getArrayObject();
  9374. var newArray = Object.assign(new _storeObjectArray.StoreObjectArray(null, null, null), anArray);
  9375. if (!stoObj.type.isCompatible(this.type)) {
  9376. throw new Error('Invalid operation: cannot assign the value given to ' + this.refID);
  9377. } else if (this.type instanceof _compoundType.CompoundType && this.type.canAccept(stoObj.type)) {
  9378. throw new Error('Invalid operation: cannot assign the value given to ' + this.refID);
  9379. }
  9380. if (this.column !== null) {
  9381. newArray.value[this.line].value[this.column] = stoObj;
  9382. return newArray;
  9383. } else {
  9384. newArray.value[this.line] = stoObj;
  9385. return newArray;
  9386. }
  9387. }
  9388. }, {
  9389. key: 'isCompatible',
  9390. value: function isCompatible(another) {
  9391. if (this.type.isCompatible(another.type)) {
  9392. if (another.type instanceof _compoundType.CompoundType) {
  9393. return this.lines === another.lines && this.columns === another.columns;
  9394. } else {
  9395. this.refValue.isCompatible(another);
  9396. }
  9397. }
  9398. }
  9399. }, {
  9400. key: 'isRef',
  9401. get: function get() {
  9402. return false;
  9403. }
  9404. }, {
  9405. key: 'inStore',
  9406. get: function get() {
  9407. return true;
  9408. }
  9409. }, {
  9410. key: 'refValue',
  9411. get: function get() {
  9412. var refLine = this.store.applyStore(this.refID).value[this.line];
  9413. if (!refLine) {
  9414. if (this.getArrayObject().isVector) {
  9415. throw _processorErrorFactory.ProcessorErrorFactory.vector_line_outbounds(this.refID, this.line, this.getArrayObject().lines);
  9416. } else {
  9417. throw _processorErrorFactory.ProcessorErrorFactory.matrix_line_outbounds(this.refID, this.line, this.getArrayObject().lines);
  9418. }
  9419. }
  9420. if (this.column !== null) {
  9421. var refColumn = refLine.value[this.column];
  9422. if (!refColumn) {
  9423. if (this.getArrayObject().isVector) {
  9424. throw _processorErrorFactory.ProcessorErrorFactory.vector_not_matrix(this.refID);
  9425. } else {
  9426. throw _processorErrorFactory.ProcessorErrorFactory.matrix_column_outbounds(this.refID, this.column, this.getArrayObject().columns);
  9427. }
  9428. }
  9429. return refColumn;
  9430. }
  9431. return refLine;
  9432. }
  9433. }, {
  9434. key: 'value',
  9435. get: function get() {
  9436. return this.refValue.value;
  9437. }
  9438. }, {
  9439. key: 'type',
  9440. get: function get() {
  9441. return this.refValue.type;
  9442. }
  9443. }, {
  9444. key: 'lines',
  9445. get: function get() {
  9446. if (!(this.type instanceof _compoundType.CompoundType)) {
  9447. return null;
  9448. }
  9449. return this.refValue.value.length;
  9450. }
  9451. }, {
  9452. key: 'columns',
  9453. get: function get() {
  9454. switch (this.type.dimensions) {
  9455. case 2:
  9456. return this.refValue.value[0].value.length;
  9457. default:
  9458. return null;
  9459. }
  9460. }
  9461. }]);
  9462. return StoreObjectArrayAddress;
  9463. }(_storeObject.StoreObject);
  9464. /***/ }),
  9465. /***/ "./js/processor/store/storeObjectArrayAddressRef.js":
  9466. /*!**********************************************************!*\
  9467. !*** ./js/processor/store/storeObjectArrayAddressRef.js ***!
  9468. \**********************************************************/
  9469. /*! no static exports found */
  9470. /***/ (function(module, exports, __webpack_require__) {
  9471. "use strict";
  9472. Object.defineProperty(exports, "__esModule", {
  9473. value: true
  9474. });
  9475. exports.StoreObjectArrayAddressRef = undefined;
  9476. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  9477. var _storeObject = __webpack_require__(/*! ./storeObject */ "./js/processor/store/storeObject.js");
  9478. var _decimal = __webpack_require__(/*! decimal.js */ "./node_modules/decimal.js/decimal.js");
  9479. var _decimal2 = _interopRequireDefault(_decimal);
  9480. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  9481. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  9482. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  9483. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  9484. var StoreObjectArrayAddressRef = exports.StoreObjectArrayAddressRef = function (_StoreObject) {
  9485. _inherits(StoreObjectArrayAddressRef, _StoreObject);
  9486. function StoreObjectArrayAddressRef(address) {
  9487. _classCallCheck(this, StoreObjectArrayAddressRef);
  9488. var _this = _possibleConstructorReturn(this, (StoreObjectArrayAddressRef.__proto__ || Object.getPrototypeOf(StoreObjectArrayAddressRef)).call(this, null, null, false));
  9489. _this.address = address;
  9490. return _this;
  9491. }
  9492. _createClass(StoreObjectArrayAddressRef, [{
  9493. key: 'getRefObj',
  9494. value: function getRefObj() {
  9495. return this.address.refValue;
  9496. }
  9497. }, {
  9498. key: 'updateRef',
  9499. value: function updateRef(stoObj) {
  9500. var newArray = this.address.updateArrayObject(stoObj);
  9501. this.address.store.updateStore(this.address.refID, newArray);
  9502. }
  9503. }, {
  9504. key: 'isCompatible',
  9505. value: function isCompatible(another) {
  9506. return this.address.isCompatible(another);
  9507. }
  9508. }, {
  9509. key: 'isRef',
  9510. get: function get() {
  9511. return true;
  9512. }
  9513. }, {
  9514. key: 'type',
  9515. get: function get() {
  9516. return this.address.type;
  9517. }
  9518. }, {
  9519. key: 'value',
  9520. get: function get() {
  9521. return this.address.value;
  9522. }
  9523. }, {
  9524. key: 'number',
  9525. get: function get() {
  9526. if (this.value instanceof _decimal2.default) {
  9527. return this.value.toNumber();
  9528. } else {
  9529. return null;
  9530. }
  9531. }
  9532. }]);
  9533. return StoreObjectArrayAddressRef;
  9534. }(_storeObject.StoreObject);
  9535. /***/ }),
  9536. /***/ "./js/processor/store/storeObjectRef.js":
  9537. /*!**********************************************!*\
  9538. !*** ./js/processor/store/storeObjectRef.js ***!
  9539. \**********************************************/
  9540. /*! no static exports found */
  9541. /***/ (function(module, exports, __webpack_require__) {
  9542. "use strict";
  9543. Object.defineProperty(exports, "__esModule", {
  9544. value: true
  9545. });
  9546. exports.StoreObjectRef = undefined;
  9547. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  9548. var _storeObject = __webpack_require__(/*! ./storeObject */ "./js/processor/store/storeObject.js");
  9549. var _decimal = __webpack_require__(/*! decimal.js */ "./node_modules/decimal.js/decimal.js");
  9550. var _decimal2 = _interopRequireDefault(_decimal);
  9551. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  9552. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  9553. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  9554. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  9555. var StoreObjectRef = exports.StoreObjectRef = function (_StoreObject) {
  9556. _inherits(StoreObjectRef, _StoreObject);
  9557. function StoreObjectRef(refID, store) {
  9558. _classCallCheck(this, StoreObjectRef);
  9559. var _this = _possibleConstructorReturn(this, (StoreObjectRef.__proto__ || Object.getPrototypeOf(StoreObjectRef)).call(this, null, null, false));
  9560. _this.refID = refID;
  9561. _this.store = store;
  9562. return _this;
  9563. }
  9564. _createClass(StoreObjectRef, [{
  9565. key: 'getRefObj',
  9566. value: function getRefObj() {
  9567. return this.store.applyStore(this.refID);
  9568. }
  9569. }, {
  9570. key: 'updateRef',
  9571. value: function updateRef(stoObj) {
  9572. this.store.updateStore(this.refID, stoObj);
  9573. }
  9574. }, {
  9575. key: 'isCompatible',
  9576. value: function isCompatible(another) {
  9577. return this.store.applyStore(this.refID).isCompatible(another);
  9578. }
  9579. }, {
  9580. key: 'isRef',
  9581. get: function get() {
  9582. return true;
  9583. }
  9584. }, {
  9585. key: 'type',
  9586. get: function get() {
  9587. return this.store.applyStore(this.refID).type;
  9588. }
  9589. }, {
  9590. key: 'value',
  9591. get: function get() {
  9592. return this.store.applyStore(this.refID).value;
  9593. }
  9594. }, {
  9595. key: 'number',
  9596. get: function get() {
  9597. if (this.value instanceof _decimal2.default) {
  9598. return this.value.toNumber();
  9599. } else {
  9600. return null;
  9601. }
  9602. }
  9603. }]);
  9604. return StoreObjectRef;
  9605. }(_storeObject.StoreObject);
  9606. /***/ }),
  9607. /***/ "./js/runner.js":
  9608. /*!**********************!*\
  9609. !*** ./js/runner.js ***!
  9610. \**********************/
  9611. /*! no static exports found */
  9612. /***/ (function(module, exports, __webpack_require__) {
  9613. "use strict";
  9614. Object.defineProperty(exports, "__esModule", {
  9615. value: true
  9616. });
  9617. exports.runner = runner;
  9618. var _ivprogParser = __webpack_require__(/*! ./ast/ivprogParser */ "./js/ast/ivprogParser.js");
  9619. var _ivprogProcessor = __webpack_require__(/*! ./processor/ivprogProcessor */ "./js/processor/ivprogProcessor.js");
  9620. var _domConsole = __webpack_require__(/*! ./io/domConsole */ "./js/io/domConsole.js");
  9621. var _languageService = __webpack_require__(/*! ./services/languageService */ "./js/services/languageService.js");
  9622. var _semanticAnalyser = __webpack_require__(/*! ./processor/semantic/semanticAnalyser */ "./js/processor/semantic/semanticAnalyser.js");
  9623. function runner() {
  9624. var ivprogLexer = _languageService.LanguageService.getCurrentLexer();
  9625. // const lexer = new ivprogLexer(new InputStream(input));
  9626. // const stream = new CommonTokenStream(lexer);
  9627. // stream.fill();
  9628. // let i = 1;
  9629. // let token = null;
  9630. // while ((token = stream.LT(i)).type !== ivprogLexer.EOF && token.type !== ivprogLexer.WHITESPACE) {
  9631. // console.log(`${token.type}-${token.text}`);
  9632. // console.log('\n')
  9633. // i++;
  9634. // }
  9635. // const anaSin = new IVProgParser(input, ivprogLexer);
  9636. var editor = new JsonEditor('#json-renderer', {});
  9637. var domConsole = new _domConsole.DOMConsole("#console");
  9638. // proc.interpretAST().then( sto => {
  9639. // console.log(sto.applyStore('a'));
  9640. // }).catch(e => console.log(e));
  9641. try {
  9642. $('#btn').click(function () {
  9643. var input = $('#input').val();
  9644. var analiser = new _ivprogParser.IVProgParser(input, ivprogLexer);
  9645. try {
  9646. var data = analiser.parseTree();
  9647. var semAna = new _semanticAnalyser.SemanticAnalyser(data);
  9648. var proc = new _ivprogProcessor.IVProgProcessor(semAna.analyseTree());
  9649. proc.registerInput(domConsole);
  9650. domConsole.clear();
  9651. proc.registerOutput(domConsole);
  9652. proc.interpretAST().then(function (sto) {
  9653. return editor.load(sto.store);
  9654. }).catch(function (e) {
  9655. alert(e);console.log(e);
  9656. });
  9657. } catch (error) {
  9658. alert(error);
  9659. console.log(error);
  9660. }
  9661. });
  9662. } catch (a) {
  9663. console.log(a);
  9664. }
  9665. }
  9666. /***/ }),
  9667. /***/ "./js/semantic/semantic.min.js":
  9668. /*!*************************************!*\
  9669. !*** ./js/semantic/semantic.min.js ***!
  9670. \*************************************/
  9671. /*! no static exports found */
  9672. /***/ (function(module, exports, __webpack_require__) {
  9673. "use strict";
  9674. var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
  9675. /*
  9676. * # Semantic UI - 2.3.3
  9677. * https://github.com/Semantic-Org/Semantic-UI
  9678. * http://www.semantic-ui.com/
  9679. *
  9680. * Copyright 2014 Contributors
  9681. * Released under the MIT license
  9682. * http://opensource.org/licenses/MIT
  9683. *
  9684. */
  9685. !function (e, t, n, i) {
  9686. e.site = e.fn.site = function (o) {
  9687. var a,
  9688. r,
  9689. s = new Date().getTime(),
  9690. l = [],
  9691. c = arguments[0],
  9692. u = "string" == typeof c,
  9693. d = [].slice.call(arguments, 1),
  9694. f = e.isPlainObject(o) ? e.extend(!0, {}, e.site.settings, o) : e.extend({}, e.site.settings),
  9695. m = f.namespace,
  9696. g = f.error,
  9697. p = "module-" + m,
  9698. h = e(n),
  9699. v = this,
  9700. b = h.data(p);return a = { initialize: function initialize() {
  9701. a.instantiate();
  9702. }, instantiate: function instantiate() {
  9703. a.verbose("Storing instance of site", a), b = a, h.data(p, a);
  9704. }, normalize: function normalize() {
  9705. a.fix.console(), a.fix.requestAnimationFrame();
  9706. }, fix: { console: function (_console) {
  9707. function console() {
  9708. return _console.apply(this, arguments);
  9709. }
  9710. console.toString = function () {
  9711. return _console.toString();
  9712. };
  9713. return console;
  9714. }(function () {
  9715. a.debug("Normalizing window.console"), console !== i && console.log !== i || (a.verbose("Console not available, normalizing events"), a.disable.console()), void 0 !== console.group && void 0 !== console.groupEnd && void 0 !== console.groupCollapsed || (a.verbose("Console group not available, normalizing events"), t.console.group = function () {}, t.console.groupEnd = function () {}, t.console.groupCollapsed = function () {}), void 0 === console.markTimeline && (a.verbose("Mark timeline not available, normalizing events"), t.console.markTimeline = function () {});
  9716. }), consoleClear: function consoleClear() {
  9717. a.debug("Disabling programmatic console clearing"), t.console.clear = function () {};
  9718. }, requestAnimationFrame: function requestAnimationFrame() {
  9719. a.debug("Normalizing requestAnimationFrame"), t.requestAnimationFrame === i && (a.debug("RequestAnimationFrame not available, normalizing event"), t.requestAnimationFrame = t.requestAnimationFrame || t.mozRequestAnimationFrame || t.webkitRequestAnimationFrame || t.msRequestAnimationFrame || function (e) {
  9720. setTimeout(e, 0);
  9721. });
  9722. } }, moduleExists: function moduleExists(t) {
  9723. return e.fn[t] !== i && e.fn[t].settings !== i;
  9724. }, enabled: { modules: function modules(t) {
  9725. var n = [];return t = t || f.modules, e.each(t, function (e, t) {
  9726. a.moduleExists(t) && n.push(t);
  9727. }), n;
  9728. } }, disabled: { modules: function modules(t) {
  9729. var n = [];return t = t || f.modules, e.each(t, function (e, t) {
  9730. a.moduleExists(t) || n.push(t);
  9731. }), n;
  9732. } }, change: { setting: function setting(t, n, o, r) {
  9733. o = "string" == typeof o ? "all" === o ? f.modules : [o] : o || f.modules, r = r === i || r, e.each(o, function (i, o) {
  9734. var s,
  9735. l = !a.moduleExists(o) || e.fn[o].settings.namespace || !1;a.moduleExists(o) && (a.verbose("Changing default setting", t, n, o), e.fn[o].settings[t] = n, r && l && (s = e(":data(module-" + l + ")")).length > 0 && (a.verbose("Modifying existing settings", s), s[o]("setting", t, n)));
  9736. });
  9737. }, settings: function settings(t, n, o) {
  9738. n = "string" == typeof n ? [n] : n || f.modules, o = o === i || o, e.each(n, function (n, i) {
  9739. var r;a.moduleExists(i) && (a.verbose("Changing default setting", t, i), e.extend(!0, e.fn[i].settings, t), o && m && (r = e(":data(module-" + m + ")")).length > 0 && (a.verbose("Modifying existing settings", r), r[i]("setting", t)));
  9740. });
  9741. } }, enable: { console: function console() {
  9742. a.console(!0);
  9743. }, debug: function debug(e, t) {
  9744. e = e || f.modules, a.debug("Enabling debug for modules", e), a.change.setting("debug", !0, e, t);
  9745. }, verbose: function verbose(e, t) {
  9746. e = e || f.modules, a.debug("Enabling verbose debug for modules", e), a.change.setting("verbose", !0, e, t);
  9747. } }, disable: { console: function console() {
  9748. a.console(!1);
  9749. }, debug: function debug(e, t) {
  9750. e = e || f.modules, a.debug("Disabling debug for modules", e), a.change.setting("debug", !1, e, t);
  9751. }, verbose: function verbose(e, t) {
  9752. e = e || f.modules, a.debug("Disabling verbose debug for modules", e), a.change.setting("verbose", !1, e, t);
  9753. } }, console: function console(e) {
  9754. if (e) {
  9755. if (b.cache.console === i) return void a.error(g.console);a.debug("Restoring console function"), t.console = b.cache.console;
  9756. } else a.debug("Disabling console function"), b.cache.console = t.console, t.console = { clear: function clear() {}, error: function error() {}, group: function group() {}, groupCollapsed: function groupCollapsed() {}, groupEnd: function groupEnd() {}, info: function info() {}, log: function log() {}, markTimeline: function markTimeline() {}, warn: function warn() {} };
  9757. }, destroy: function destroy() {
  9758. a.verbose("Destroying previous site for", h), h.removeData(p);
  9759. }, cache: {}, setting: function setting(t, n) {
  9760. if (e.isPlainObject(t)) e.extend(!0, f, t);else {
  9761. if (n === i) return f[t];f[t] = n;
  9762. }
  9763. }, internal: function internal(t, n) {
  9764. if (e.isPlainObject(t)) e.extend(!0, a, t);else {
  9765. if (n === i) return a[t];a[t] = n;
  9766. }
  9767. }, debug: function debug() {
  9768. f.debug && (f.performance ? a.performance.log(arguments) : (a.debug = Function.prototype.bind.call(console.info, console, f.name + ":"), a.debug.apply(console, arguments)));
  9769. }, verbose: function verbose() {
  9770. f.verbose && f.debug && (f.performance ? a.performance.log(arguments) : (a.verbose = Function.prototype.bind.call(console.info, console, f.name + ":"), a.verbose.apply(console, arguments)));
  9771. }, error: function error() {
  9772. a.error = Function.prototype.bind.call(console.error, console, f.name + ":"), a.error.apply(console, arguments);
  9773. }, performance: { log: function log(e) {
  9774. var t, n;f.performance && (n = (t = new Date().getTime()) - (s || t), s = t, l.push({ Element: v, Name: e[0], Arguments: [].slice.call(e, 1) || "", "Execution Time": n })), clearTimeout(a.performance.timer), a.performance.timer = setTimeout(a.performance.display, 500);
  9775. }, display: function display() {
  9776. var t = f.name + ":",
  9777. n = 0;s = !1, clearTimeout(a.performance.timer), e.each(l, function (e, t) {
  9778. n += t["Execution Time"];
  9779. }), t += " " + n + "ms", (console.group !== i || console.table !== i) && l.length > 0 && (console.groupCollapsed(t), console.table ? console.table(l) : e.each(l, function (e, t) {
  9780. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  9781. }), console.groupEnd()), l = [];
  9782. } }, invoke: function invoke(t, n, o) {
  9783. var s,
  9784. l,
  9785. c,
  9786. u = b;return n = n || d, o = v || o, "string" == typeof t && u !== i && (t = t.split(/[\. ]/), s = t.length - 1, e.each(t, function (n, o) {
  9787. var r = n != s ? o + t[n + 1].charAt(0).toUpperCase() + t[n + 1].slice(1) : t;if (e.isPlainObject(u[r]) && n != s) u = u[r];else {
  9788. if (u[r] !== i) return l = u[r], !1;if (!e.isPlainObject(u[o]) || n == s) return u[o] !== i ? (l = u[o], !1) : (a.error(g.method, t), !1);u = u[o];
  9789. }
  9790. })), e.isFunction(l) ? c = l.apply(o, n) : l !== i && (c = l), e.isArray(r) ? r.push(c) : r !== i ? r = [r, c] : c !== i && (r = c), l;
  9791. } }, u ? (b === i && a.initialize(), a.invoke(c)) : (b !== i && a.destroy(), a.initialize()), r !== i ? r : this;
  9792. }, e.site.settings = { name: "Site", namespace: "site", error: { console: "Console cannot be restored, most likely it was overwritten outside of module", method: "The method you called is not defined." }, debug: !1, verbose: !1, performance: !0, modules: ["accordion", "api", "checkbox", "dimmer", "dropdown", "embed", "form", "modal", "nag", "popup", "rating", "shape", "sidebar", "state", "sticky", "tab", "transition", "visit", "visibility"], siteNamespace: "site", namespaceStub: { cache: {}, config: {}, sections: {}, section: {}, utilities: {} } }, e.extend(e.expr[":"], { data: e.expr.createPseudo ? e.expr.createPseudo(function (t) {
  9793. return function (n) {
  9794. return !!e.data(n, t);
  9795. };
  9796. }) : function (t, n, i) {
  9797. return !!e.data(t, i[3]);
  9798. } });
  9799. }(jQuery, window, document), function (e, t, n, i) {
  9800. "use strict";
  9801. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.form = function (t) {
  9802. var o,
  9803. a = e(this),
  9804. r = a.selector || "",
  9805. s = new Date().getTime(),
  9806. l = [],
  9807. c = arguments[0],
  9808. u = arguments[1],
  9809. d = "string" == typeof c,
  9810. f = [].slice.call(arguments, 1);return a.each(function () {
  9811. var m,
  9812. g,
  9813. p,
  9814. h,
  9815. v,
  9816. b,
  9817. y,
  9818. x,
  9819. C,
  9820. w,
  9821. S,
  9822. k,
  9823. T,
  9824. A,
  9825. R,
  9826. P,
  9827. E = e(this),
  9828. F = this,
  9829. O = [],
  9830. D = !1;(P = { initialize: function initialize() {
  9831. P.get.settings(), d ? (R === i && P.instantiate(), P.invoke(c)) : (R !== i && R.invoke("destroy"), P.verbose("Initializing form validation", E, v), P.bindEvents(), P.set.defaults(), P.instantiate());
  9832. }, instantiate: function instantiate() {
  9833. P.verbose("Storing instance of module", P), R = P, E.data(T, P);
  9834. }, destroy: function destroy() {
  9835. P.verbose("Destroying previous module", R), P.removeEvents(), E.removeData(T);
  9836. }, refresh: function refresh() {
  9837. P.verbose("Refreshing selector cache"), m = E.find(x.field), g = E.find(x.group), p = E.find(x.message), E.find(x.prompt), h = E.find(x.submit), E.find(x.clear), E.find(x.reset);
  9838. }, submit: function submit() {
  9839. P.verbose("Submitting form", E), E.submit();
  9840. }, attachEvents: function attachEvents(t, n) {
  9841. n = n || "submit", e(t).on("click" + A, function (e) {
  9842. P[n](), e.preventDefault();
  9843. });
  9844. }, bindEvents: function bindEvents() {
  9845. P.verbose("Attaching form events"), E.on("submit" + A, P.validate.form).on("blur" + A, x.field, P.event.field.blur).on("click" + A, x.submit, P.submit).on("click" + A, x.reset, P.reset).on("click" + A, x.clear, P.clear), v.keyboardShortcuts && E.on("keydown" + A, x.field, P.event.field.keydown), m.each(function () {
  9846. var t = e(this),
  9847. n = t.prop("type"),
  9848. i = P.get.changeEvent(n, t);e(this).on(i + A, P.event.field.change);
  9849. });
  9850. }, clear: function clear() {
  9851. m.each(function () {
  9852. var t = e(this),
  9853. n = t.parent(),
  9854. i = t.closest(g),
  9855. o = i.find(x.prompt),
  9856. a = t.data(y.defaultValue) || "",
  9857. r = n.is(x.uiCheckbox),
  9858. s = n.is(x.uiDropdown);i.hasClass(C.error) && (P.verbose("Resetting error on field", i), i.removeClass(C.error), o.remove()), s ? (P.verbose("Resetting dropdown value", n, a), n.dropdown("clear")) : r ? t.prop("checked", !1) : (P.verbose("Resetting field value", t, a), t.val(""));
  9859. });
  9860. }, reset: function reset() {
  9861. m.each(function () {
  9862. var t = e(this),
  9863. n = t.parent(),
  9864. o = t.closest(g),
  9865. a = o.find(x.prompt),
  9866. r = t.data(y.defaultValue),
  9867. s = n.is(x.uiCheckbox),
  9868. l = n.is(x.uiDropdown),
  9869. c = o.hasClass(C.error);r !== i && (c && (P.verbose("Resetting error on field", o), o.removeClass(C.error), a.remove()), l ? (P.verbose("Resetting dropdown value", n, r), n.dropdown("restore defaults")) : s ? (P.verbose("Resetting checkbox value", n, r), t.prop("checked", r)) : (P.verbose("Resetting field value", t, r), t.val(r)));
  9870. });
  9871. }, determine: { isValid: function isValid() {
  9872. var t = !0;return e.each(b, function (e, n) {
  9873. P.validate.field(n, e, !0) || (t = !1);
  9874. }), t;
  9875. } }, is: { bracketedRule: function bracketedRule(e) {
  9876. return e.type && e.type.match(v.regExp.bracket);
  9877. }, shorthandFields: function shorthandFields(e) {
  9878. var t = e[Object.keys(e)[0]];return P.is.shorthandRules(t);
  9879. }, shorthandRules: function shorthandRules(t) {
  9880. return "string" == typeof t || e.isArray(t);
  9881. }, empty: function empty(e) {
  9882. return !e || 0 === e.length || (e.is('input[type="checkbox"]') ? !e.is(":checked") : P.is.blank(e));
  9883. }, blank: function blank(t) {
  9884. return "" === e.trim(t.val());
  9885. }, valid: function valid(t) {
  9886. var n = !0;return t ? (P.verbose("Checking if field is valid", t), P.validate.field(b[t], t, !1)) : (P.verbose("Checking if form is valid"), e.each(b, function (e, t) {
  9887. P.is.valid(e) || (n = !1);
  9888. }), n);
  9889. } }, removeEvents: function removeEvents() {
  9890. E.off(A), m.off(A), h.off(A), m.off(A);
  9891. }, event: { field: { keydown: function keydown(t) {
  9892. var n = e(this),
  9893. i = t.which,
  9894. o = n.is(x.input),
  9895. a = n.is(x.checkbox),
  9896. r = n.closest(x.uiDropdown).length > 0,
  9897. s = 13;i == 27 && (P.verbose("Escape key pressed blurring field"), n.blur()), t.ctrlKey || i != s || !o || r || a || (D || (n.one("keyup" + A, P.event.field.keyup), P.submit(), P.debug("Enter pressed on input submitting form")), D = !0);
  9898. }, keyup: function keyup() {
  9899. D = !1;
  9900. }, blur: function blur(t) {
  9901. var n = e(this),
  9902. i = n.closest(g),
  9903. o = P.get.validation(n);i.hasClass(C.error) ? (P.debug("Revalidating field", n, o), o && P.validate.field(o)) : "blur" == v.on && o && P.validate.field(o);
  9904. }, change: function change(t) {
  9905. var n = e(this),
  9906. i = n.closest(g),
  9907. o = P.get.validation(n);o && ("change" == v.on || i.hasClass(C.error) && v.revalidate) && (clearTimeout(P.timer), P.timer = setTimeout(function () {
  9908. P.debug("Revalidating field", n, P.get.validation(n)), P.validate.field(o);
  9909. }, v.delay));
  9910. } } }, get: { ancillaryValue: function ancillaryValue(e) {
  9911. return !(!e.type || !e.value && !P.is.bracketedRule(e)) && (e.value !== i ? e.value : e.type.match(v.regExp.bracket)[1] + "");
  9912. }, ruleName: function ruleName(e) {
  9913. return P.is.bracketedRule(e) ? e.type.replace(e.type.match(v.regExp.bracket)[0], "") : e.type;
  9914. }, changeEvent: function changeEvent(e, t) {
  9915. return "checkbox" == e || "radio" == e || "hidden" == e || t.is("select") ? "change" : P.get.inputEvent();
  9916. }, inputEvent: function inputEvent() {
  9917. return n.createElement("input").oninput !== i ? "input" : n.createElement("input").onpropertychange !== i ? "propertychange" : "keyup";
  9918. }, fieldsFromShorthand: function fieldsFromShorthand(t) {
  9919. var n = {};return e.each(t, function (t, i) {
  9920. "string" == typeof i && (i = [i]), n[t] = { rules: [] }, e.each(i, function (e, i) {
  9921. n[t].rules.push({ type: i });
  9922. });
  9923. }), n;
  9924. }, prompt: function prompt(t, n) {
  9925. var i,
  9926. o,
  9927. a = P.get.ruleName(t),
  9928. r = P.get.ancillaryValue(t),
  9929. s = P.get.field(n.identifier),
  9930. l = s.val(),
  9931. c = e.isFunction(t.prompt) ? t.prompt(l) : t.prompt || v.prompt[a] || v.text.unspecifiedRule,
  9932. u = -1 !== c.search("{value}"),
  9933. d = -1 !== c.search("{name}");return u && (c = c.replace("{value}", s.val())), d && (o = 1 == (i = s.closest(x.group).find("label").eq(0)).length ? i.text() : s.prop("placeholder") || v.text.unspecifiedField, c = c.replace("{name}", o)), c = (c = c.replace("{identifier}", n.identifier)).replace("{ruleValue}", r), t.prompt || P.verbose("Using default validation prompt for type", c, a), c;
  9934. }, settings: function settings() {
  9935. if (e.isPlainObject(t)) {
  9936. var n = Object.keys(t);n.length > 0 && t[n[0]].identifier !== i && t[n[0]].rules !== i ? (v = e.extend(!0, {}, e.fn.form.settings, u), b = e.extend({}, e.fn.form.settings.defaults, t), P.error(v.error.oldSyntax, F), P.verbose("Extending settings from legacy parameters", b, v)) : (t.fields && P.is.shorthandFields(t.fields) && (t.fields = P.get.fieldsFromShorthand(t.fields)), v = e.extend(!0, {}, e.fn.form.settings, t), b = e.extend({}, e.fn.form.settings.defaults, v.fields), P.verbose("Extending settings", b, v));
  9937. } else v = e.fn.form.settings, b = e.fn.form.settings.defaults, P.verbose("Using default form validation", b, v);k = v.namespace, y = v.metadata, x = v.selector, C = v.className, w = v.regExp, S = v.error, T = "module-" + k, A = "." + k, R = E.data(T), P.refresh();
  9938. }, field: function field(t) {
  9939. return P.verbose("Finding field with identifier", t), t = P.escape.string(t), m.filter("#" + t).length > 0 ? m.filter("#" + t) : m.filter('[name="' + t + '"]').length > 0 ? m.filter('[name="' + t + '"]') : m.filter('[name="' + t + '[]"]').length > 0 ? m.filter('[name="' + t + '[]"]') : m.filter("[data-" + y.validate + '="' + t + '"]').length > 0 ? m.filter("[data-" + y.validate + '="' + t + '"]') : e("<input/>");
  9940. }, fields: function fields(t) {
  9941. var n = e();return e.each(t, function (e, t) {
  9942. n = n.add(P.get.field(t));
  9943. }), n;
  9944. }, validation: function validation(t) {
  9945. var n, i;return !!b && (e.each(b, function (e, o) {
  9946. i = o.identifier || e, P.get.field(i)[0] == t[0] && (o.identifier = i, n = o);
  9947. }), n || !1);
  9948. }, value: function value(e) {
  9949. var t = [];return t.push(e), P.get.values.call(F, t)[e];
  9950. }, values: function values(t) {
  9951. var n = {};return (e.isArray(t) ? P.get.fields(t) : m).each(function (t, o) {
  9952. var a = e(o),
  9953. r = (a.prop("type"), a.prop("name")),
  9954. s = a.val(),
  9955. l = a.is(x.checkbox),
  9956. c = a.is(x.radio),
  9957. u = -1 !== r.indexOf("[]"),
  9958. d = !!l && a.is(":checked");r && (u ? (r = r.replace("[]", ""), n[r] || (n[r] = []), l ? d ? n[r].push(s || !0) : n[r].push(!1) : n[r].push(s)) : c ? n[r] !== i && 0 != n[r] || (n[r] = !!d && (s || !0)) : n[r] = l ? !!d && (s || !0) : s);
  9959. }), n;
  9960. } }, has: { field: function field(e) {
  9961. return P.verbose("Checking for existence of a field with identifier", e), "string" != typeof (e = P.escape.string(e)) && P.error(S.identifier, e), m.filter("#" + e).length > 0 || m.filter('[name="' + e + '"]').length > 0 || m.filter("[data-" + y.validate + '="' + e + '"]').length > 0;
  9962. } }, escape: { string: function string(e) {
  9963. return (e = String(e)).replace(w.escape, "\\$&");
  9964. } }, add: { rule: function rule(e, t) {
  9965. P.add.field(e, t);
  9966. }, field: function field(t, n) {
  9967. var i = {};P.is.shorthandRules(n) ? (n = e.isArray(n) ? n : [n], i[t] = { rules: [] }, e.each(n, function (e, n) {
  9968. i[t].rules.push({ type: n });
  9969. })) : i[t] = n, b = e.extend({}, b, i), P.debug("Adding rules", i, b);
  9970. }, fields: function fields(t) {
  9971. var n;n = t && P.is.shorthandFields(t) ? P.get.fieldsFromShorthand(t) : t, b = e.extend({}, b, n);
  9972. }, prompt: function prompt(t, n) {
  9973. var o = P.get.field(t).closest(g),
  9974. a = o.children(x.prompt),
  9975. r = 0 !== a.length;n = "string" == typeof n ? [n] : n, P.verbose("Adding field error state", t), o.addClass(C.error), v.inline && (r || (a = v.templates.prompt(n)).appendTo(o), a.html(n[0]), r ? P.verbose("Inline errors are disabled, no inline error added", t) : v.transition && e.fn.transition !== i && E.transition("is supported") ? (P.verbose("Displaying error with css transition", v.transition), a.transition(v.transition + " in", v.duration)) : (P.verbose("Displaying error with fallback javascript animation"), a.fadeIn(v.duration)));
  9976. }, errors: function errors(e) {
  9977. P.debug("Adding form error messages", e), P.set.error(), p.html(v.templates.error(e));
  9978. } }, remove: { rule: function rule(t, n) {
  9979. var o = e.isArray(n) ? n : [n];if (n == i) return P.debug("Removed all rules"), void (b[t].rules = []);b[t] != i && e.isArray(b[t].rules) && e.each(b[t].rules, function (e, n) {
  9980. -1 !== o.indexOf(n.type) && (P.debug("Removed rule", n.type), b[t].rules.splice(e, 1));
  9981. });
  9982. }, field: function field(t) {
  9983. var n = e.isArray(t) ? t : [t];e.each(n, function (e, t) {
  9984. P.remove.rule(t);
  9985. });
  9986. }, rules: function rules(t, n) {
  9987. e.isArray(t) ? e.each(fields, function (e, t) {
  9988. P.remove.rule(t, n);
  9989. }) : P.remove.rule(t, n);
  9990. }, fields: function fields(e) {
  9991. P.remove.field(e);
  9992. }, prompt: function prompt(t) {
  9993. var n = P.get.field(t).closest(g),
  9994. o = n.children(x.prompt);n.removeClass(C.error), v.inline && o.is(":visible") && (P.verbose("Removing prompt for field", t), v.transition && e.fn.transition !== i && E.transition("is supported") ? o.transition(v.transition + " out", v.duration, function () {
  9995. o.remove();
  9996. }) : o.fadeOut(v.duration, function () {
  9997. o.remove();
  9998. }));
  9999. } }, set: { success: function success() {
  10000. E.removeClass(C.error).addClass(C.success);
  10001. }, defaults: function defaults() {
  10002. m.each(function () {
  10003. var t = e(this),
  10004. n = t.filter(x.checkbox).length > 0 ? t.is(":checked") : t.val();t.data(y.defaultValue, n);
  10005. });
  10006. }, error: function error() {
  10007. E.removeClass(C.success).addClass(C.error);
  10008. }, value: function value(e, t) {
  10009. var n = {};return n[e] = t, P.set.values.call(F, n);
  10010. }, values: function values(t) {
  10011. e.isEmptyObject(t) || e.each(t, function (t, n) {
  10012. var i,
  10013. o = P.get.field(t),
  10014. a = o.parent(),
  10015. r = e.isArray(n),
  10016. s = a.is(x.uiCheckbox),
  10017. l = a.is(x.uiDropdown),
  10018. c = o.is(x.radio) && s;o.length > 0 && (r && s ? (P.verbose("Selecting multiple", n, o), a.checkbox("uncheck"), e.each(n, function (e, t) {
  10019. i = o.filter('[value="' + t + '"]'), a = i.parent(), i.length > 0 && a.checkbox("check");
  10020. })) : c ? (P.verbose("Selecting radio value", n, o), o.filter('[value="' + n + '"]').parent(x.uiCheckbox).checkbox("check")) : s ? (P.verbose("Setting checkbox value", n, a), !0 === n ? a.checkbox("check") : a.checkbox("uncheck")) : l ? (P.verbose("Setting dropdown value", n, a), a.dropdown("set selected", n)) : (P.verbose("Setting field value", n, o), o.val(n)));
  10021. });
  10022. } }, validate: { form: function form(e, t) {
  10023. var n = P.get.values();if (D) return !1;if (O = [], P.determine.isValid()) {
  10024. if (P.debug("Form has no validation errors, submitting"), P.set.success(), !0 !== t) return v.onSuccess.call(F, e, n);
  10025. } else if (P.debug("Form has errors"), P.set.error(), v.inline || P.add.errors(O), E.data("moduleApi") !== i && e.stopImmediatePropagation(), !0 !== t) return v.onFailure.call(F, O, n);
  10026. }, field: function field(t, n, o) {
  10027. o = o === i || o, "string" == typeof t && (P.verbose("Validating field", t), n = t, t = b[t]);var a = t.identifier || n,
  10028. r = P.get.field(a),
  10029. s = !!t.depends && P.get.field(t.depends),
  10030. l = !0,
  10031. c = [];return t.identifier || (P.debug("Using field name as identifier", a), t.identifier = a), r.prop("disabled") ? (P.debug("Field is disabled. Skipping", a), l = !0) : t.optional && P.is.blank(r) ? (P.debug("Field is optional and blank. Skipping", a), l = !0) : t.depends && P.is.empty(s) ? (P.debug("Field depends on another value that is not present or empty. Skipping", s), l = !0) : t.rules !== i && e.each(t.rules, function (e, n) {
  10032. P.has.field(a) && !P.validate.rule(t, n) && (P.debug("Field is invalid", a, n.type), c.push(P.get.prompt(n, t)), l = !1);
  10033. }), l ? (o && (P.remove.prompt(a, c), v.onValid.call(r)), !0) : (o && (O = O.concat(c), P.add.prompt(a, c), v.onInvalid.call(r, c)), !1);
  10034. }, rule: function rule(t, n) {
  10035. var o = P.get.field(t.identifier),
  10036. a = (n.type, o.val()),
  10037. r = P.get.ancillaryValue(n),
  10038. s = P.get.ruleName(n),
  10039. l = v.rules[s];if (e.isFunction(l)) return a = a === i || "" === a || null === a ? "" : e.trim(a + ""), l.call(o, a, r);P.error(S.noRule, s);
  10040. } }, setting: function setting(t, n) {
  10041. if (e.isPlainObject(t)) e.extend(!0, v, t);else {
  10042. if (n === i) return v[t];v[t] = n;
  10043. }
  10044. }, internal: function internal(t, n) {
  10045. if (e.isPlainObject(t)) e.extend(!0, P, t);else {
  10046. if (n === i) return P[t];P[t] = n;
  10047. }
  10048. }, debug: function debug() {
  10049. !v.silent && v.debug && (v.performance ? P.performance.log(arguments) : (P.debug = Function.prototype.bind.call(console.info, console, v.name + ":"), P.debug.apply(console, arguments)));
  10050. }, verbose: function verbose() {
  10051. !v.silent && v.verbose && v.debug && (v.performance ? P.performance.log(arguments) : (P.verbose = Function.prototype.bind.call(console.info, console, v.name + ":"), P.verbose.apply(console, arguments)));
  10052. }, error: function error() {
  10053. v.silent || (P.error = Function.prototype.bind.call(console.error, console, v.name + ":"), P.error.apply(console, arguments));
  10054. }, performance: { log: function log(e) {
  10055. var t, n;v.performance && (n = (t = new Date().getTime()) - (s || t), s = t, l.push({ Name: e[0], Arguments: [].slice.call(e, 1) || "", Element: F, "Execution Time": n })), clearTimeout(P.performance.timer), P.performance.timer = setTimeout(P.performance.display, 500);
  10056. }, display: function display() {
  10057. var t = v.name + ":",
  10058. n = 0;s = !1, clearTimeout(P.performance.timer), e.each(l, function (e, t) {
  10059. n += t["Execution Time"];
  10060. }), t += " " + n + "ms", r && (t += " '" + r + "'"), a.length > 1 && (t += " (" + a.length + ")"), (console.group !== i || console.table !== i) && l.length > 0 && (console.groupCollapsed(t), console.table ? console.table(l) : e.each(l, function (e, t) {
  10061. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  10062. }), console.groupEnd()), l = [];
  10063. } }, invoke: function invoke(t, n, a) {
  10064. var r,
  10065. s,
  10066. l,
  10067. c = R;return n = n || f, a = F || a, "string" == typeof t && c !== i && (t = t.split(/[\. ]/), r = t.length - 1, e.each(t, function (n, o) {
  10068. var a = n != r ? o + t[n + 1].charAt(0).toUpperCase() + t[n + 1].slice(1) : t;if (e.isPlainObject(c[a]) && n != r) c = c[a];else {
  10069. if (c[a] !== i) return s = c[a], !1;if (!e.isPlainObject(c[o]) || n == r) return c[o] !== i && (s = c[o], !1);c = c[o];
  10070. }
  10071. })), e.isFunction(s) ? l = s.apply(a, n) : s !== i && (l = s), e.isArray(o) ? o.push(l) : o !== i ? o = [o, l] : l !== i && (o = l), s;
  10072. } }).initialize();
  10073. }), o !== i ? o : this;
  10074. }, e.fn.form.settings = { name: "Form", namespace: "form", debug: !1, verbose: !1, performance: !0, fields: !1, keyboardShortcuts: !0, on: "submit", inline: !1, delay: 200, revalidate: !0, transition: "scale", duration: 200, onValid: function onValid() {}, onInvalid: function onInvalid() {}, onSuccess: function onSuccess() {
  10075. return !0;
  10076. }, onFailure: function onFailure() {
  10077. return !1;
  10078. }, metadata: { defaultValue: "default", validate: "validate" }, regExp: { htmlID: /^[a-zA-Z][\w:.-]*$/g, bracket: /\[(.*)\]/i, decimal: /^\d+\.?\d*$/, email: /^[a-z0-9!#$%&'*+\/=?^_`{|}~.-]+@[a-z0-9]([a-z0-9-]*[a-z0-9])?(\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)*$/i, escape: /[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, flags: /^\/(.*)\/(.*)?/, integer: /^\-?\d+$/, number: /^\-?\d*(\.\d+)?$/, url: /(https?:\/\/(?:www\.|(?!www))[^\s\.]+\.[^\s]{2,}|www\.[^\s]+\.[^\s]{2,})/i }, text: { unspecifiedRule: "Please enter a valid value", unspecifiedField: "This field" }, prompt: { empty: "{name} must have a value", checked: "{name} must be checked", email: "{name} must be a valid e-mail", url: "{name} must be a valid url", regExp: "{name} is not formatted correctly", integer: "{name} must be an integer", decimal: "{name} must be a decimal number", number: "{name} must be set to a number", is: '{name} must be "{ruleValue}"', isExactly: '{name} must be exactly "{ruleValue}"', not: '{name} cannot be set to "{ruleValue}"', notExactly: '{name} cannot be set to exactly "{ruleValue}"', contain: '{name} must contain "{ruleValue}"', containExactly: '{name} must contain exactly "{ruleValue}"', doesntContain: '{name} cannot contain "{ruleValue}"', doesntContainExactly: '{name} cannot contain exactly "{ruleValue}"', minLength: "{name} must be at least {ruleValue} characters", length: "{name} must be at least {ruleValue} characters", exactLength: "{name} must be exactly {ruleValue} characters", maxLength: "{name} cannot be longer than {ruleValue} characters", match: "{name} must match {ruleValue} field", different: "{name} must have a different value than {ruleValue} field", creditCard: "{name} must be a valid credit card number", minCount: "{name} must have at least {ruleValue} choices", exactCount: "{name} must have exactly {ruleValue} choices", maxCount: "{name} must have {ruleValue} or less choices" }, selector: { checkbox: 'input[type="checkbox"], input[type="radio"]', clear: ".clear", field: "input, textarea, select", group: ".field", input: "input", message: ".error.message", prompt: ".prompt.label", radio: 'input[type="radio"]', reset: '.reset:not([type="reset"])', submit: '.submit:not([type="submit"])', uiCheckbox: ".ui.checkbox", uiDropdown: ".ui.dropdown" }, className: { error: "error", label: "ui prompt label", pressed: "down", success: "success" }, error: { identifier: "You must specify a string identifier for each field", method: "The method you called is not defined.", noRule: "There is no rule matching the one you specified", oldSyntax: "Starting in 2.0 forms now only take a single settings object. Validation settings converted to new syntax automatically." }, templates: { error: function error(t) {
  10079. var n = '<ul class="list">';return e.each(t, function (e, t) {
  10080. n += "<li>" + t + "</li>";
  10081. }), e(n += "</ul>");
  10082. }, prompt: function prompt(t) {
  10083. return e("<div/>").addClass("ui basic red pointing prompt label").html(t[0]);
  10084. } }, rules: { empty: function empty(t) {
  10085. return !(t === i || "" === t || e.isArray(t) && 0 === t.length);
  10086. }, checked: function checked() {
  10087. return e(this).filter(":checked").length > 0;
  10088. }, email: function email(t) {
  10089. return e.fn.form.settings.regExp.email.test(t);
  10090. }, url: function url(t) {
  10091. return e.fn.form.settings.regExp.url.test(t);
  10092. }, regExp: function regExp(t, n) {
  10093. if (n instanceof RegExp) return t.match(n);var i,
  10094. o = n.match(e.fn.form.settings.regExp.flags);return o && (n = o.length >= 2 ? o[1] : n, i = o.length >= 3 ? o[2] : ""), t.match(new RegExp(n, i));
  10095. }, integer: function integer(t, n) {
  10096. var o,
  10097. a,
  10098. r,
  10099. s = e.fn.form.settings.regExp.integer;return n && -1 === ["", ".."].indexOf(n) && (-1 == n.indexOf("..") ? s.test(n) && (o = a = n - 0) : (r = n.split("..", 2), s.test(r[0]) && (o = r[0] - 0), s.test(r[1]) && (a = r[1] - 0))), s.test(t) && (o === i || t >= o) && (a === i || t <= a);
  10100. }, decimal: function decimal(t) {
  10101. return e.fn.form.settings.regExp.decimal.test(t);
  10102. }, number: function number(t) {
  10103. return e.fn.form.settings.regExp.number.test(t);
  10104. }, is: function is(e, t) {
  10105. return t = "string" == typeof t ? t.toLowerCase() : t, (e = "string" == typeof e ? e.toLowerCase() : e) == t;
  10106. }, isExactly: function isExactly(e, t) {
  10107. return e == t;
  10108. }, not: function not(e, t) {
  10109. return (e = "string" == typeof e ? e.toLowerCase() : e) != (t = "string" == typeof t ? t.toLowerCase() : t);
  10110. }, notExactly: function notExactly(e, t) {
  10111. return e != t;
  10112. }, contains: function contains(t, n) {
  10113. return n = n.replace(e.fn.form.settings.regExp.escape, "\\$&"), -1 !== t.search(new RegExp(n, "i"));
  10114. }, containsExactly: function containsExactly(t, n) {
  10115. return n = n.replace(e.fn.form.settings.regExp.escape, "\\$&"), -1 !== t.search(new RegExp(n));
  10116. }, doesntContain: function doesntContain(t, n) {
  10117. return n = n.replace(e.fn.form.settings.regExp.escape, "\\$&"), -1 === t.search(new RegExp(n, "i"));
  10118. }, doesntContainExactly: function doesntContainExactly(t, n) {
  10119. return n = n.replace(e.fn.form.settings.regExp.escape, "\\$&"), -1 === t.search(new RegExp(n));
  10120. }, minLength: function minLength(e, t) {
  10121. return e !== i && e.length >= t;
  10122. }, length: function length(e, t) {
  10123. return e !== i && e.length >= t;
  10124. }, exactLength: function exactLength(e, t) {
  10125. return e !== i && e.length == t;
  10126. }, maxLength: function maxLength(e, t) {
  10127. return e !== i && e.length <= t;
  10128. }, match: function match(t, n) {
  10129. var o;e(this);return e('[data-validate="' + n + '"]').length > 0 ? o = e('[data-validate="' + n + '"]').val() : e("#" + n).length > 0 ? o = e("#" + n).val() : e('[name="' + n + '"]').length > 0 ? o = e('[name="' + n + '"]').val() : e('[name="' + n + '[]"]').length > 0 && (o = e('[name="' + n + '[]"]')), o !== i && t.toString() == o.toString();
  10130. }, different: function different(t, n) {
  10131. var o;e(this);return e('[data-validate="' + n + '"]').length > 0 ? o = e('[data-validate="' + n + '"]').val() : e("#" + n).length > 0 ? o = e("#" + n).val() : e('[name="' + n + '"]').length > 0 ? o = e('[name="' + n + '"]').val() : e('[name="' + n + '[]"]').length > 0 && (o = e('[name="' + n + '[]"]')), o !== i && t.toString() !== o.toString();
  10132. }, creditCard: function creditCard(t, n) {
  10133. var i,
  10134. o,
  10135. a = { visa: { pattern: /^4/, length: [16] }, amex: { pattern: /^3[47]/, length: [15] }, mastercard: { pattern: /^5[1-5]/, length: [16] }, discover: { pattern: /^(6011|622(12[6-9]|1[3-9][0-9]|[2-8][0-9]{2}|9[0-1][0-9]|92[0-5]|64[4-9])|65)/, length: [16] }, unionPay: { pattern: /^(62|88)/, length: [16, 17, 18, 19] }, jcb: { pattern: /^35(2[89]|[3-8][0-9])/, length: [16] }, maestro: { pattern: /^(5018|5020|5038|6304|6759|676[1-3])/, length: [12, 13, 14, 15, 16, 17, 18, 19] }, dinersClub: { pattern: /^(30[0-5]|^36)/, length: [14] }, laser: { pattern: /^(6304|670[69]|6771)/, length: [16, 17, 18, 19] }, visaElectron: { pattern: /^(4026|417500|4508|4844|491(3|7))/, length: [16] } },
  10136. r = {},
  10137. s = !1,
  10138. l = "string" == typeof n && n.split(",");if ("string" == typeof t && 0 !== t.length) {
  10139. if (t = t.replace(/[\-]/g, ""), l && (e.each(l, function (n, i) {
  10140. (o = a[i]) && (r = { length: -1 !== e.inArray(t.length, o.length), pattern: -1 !== t.search(o.pattern) }).length && r.pattern && (s = !0);
  10141. }), !s)) return !1;if ((i = { number: -1 !== e.inArray(t.length, a.unionPay.length), pattern: -1 !== t.search(a.unionPay.pattern) }).number && i.pattern) return !0;for (var c = t.length, u = 0, d = [[0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [0, 2, 4, 6, 8, 1, 3, 5, 7, 9]], f = 0; c--;) {
  10142. f += d[u][parseInt(t.charAt(c), 10)], u ^= 1;
  10143. }return f % 10 == 0 && f > 0;
  10144. }
  10145. }, minCount: function minCount(e, t) {
  10146. return 0 == t || (1 == t ? "" !== e : e.split(",").length >= t);
  10147. }, exactCount: function exactCount(e, t) {
  10148. return 0 == t ? "" === e : 1 == t ? "" !== e && -1 === e.search(",") : e.split(",").length == t;
  10149. }, maxCount: function maxCount(e, t) {
  10150. return 0 != t && (1 == t ? -1 === e.search(",") : e.split(",").length <= t);
  10151. } } };
  10152. }(jQuery, window, document), function (e, t, n, i) {
  10153. "use strict";
  10154. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.accordion = function (n) {
  10155. var o,
  10156. a = e(this),
  10157. r = new Date().getTime(),
  10158. s = [],
  10159. l = arguments[0],
  10160. c = "string" == typeof l,
  10161. u = [].slice.call(arguments, 1);t.requestAnimationFrame || t.mozRequestAnimationFrame || t.webkitRequestAnimationFrame || t.msRequestAnimationFrame;return a.each(function () {
  10162. var d,
  10163. f,
  10164. m = e.isPlainObject(n) ? e.extend(!0, {}, e.fn.accordion.settings, n) : e.extend({}, e.fn.accordion.settings),
  10165. g = m.className,
  10166. p = m.namespace,
  10167. h = m.selector,
  10168. v = m.error,
  10169. b = "." + p,
  10170. y = "module-" + p,
  10171. x = a.selector || "",
  10172. C = e(this),
  10173. w = C.find(h.title),
  10174. S = C.find(h.content),
  10175. k = this,
  10176. T = C.data(y);f = { initialize: function initialize() {
  10177. f.debug("Initializing", C), f.bind.events(), m.observeChanges && f.observeChanges(), f.instantiate();
  10178. }, instantiate: function instantiate() {
  10179. T = f, C.data(y, f);
  10180. }, destroy: function destroy() {
  10181. f.debug("Destroying previous instance", C), C.off(b).removeData(y);
  10182. }, refresh: function refresh() {
  10183. w = C.find(h.title), S = C.find(h.content);
  10184. }, observeChanges: function observeChanges() {
  10185. "MutationObserver" in t && ((d = new MutationObserver(function (e) {
  10186. f.debug("DOM tree modified, updating selector cache"), f.refresh();
  10187. })).observe(k, { childList: !0, subtree: !0 }), f.debug("Setting up mutation observer", d));
  10188. }, bind: { events: function events() {
  10189. f.debug("Binding delegated events"), C.on(m.on + b, h.trigger, f.event.click);
  10190. } }, event: { click: function click() {
  10191. f.toggle.call(this);
  10192. } }, toggle: function toggle(t) {
  10193. var n = t !== i ? "number" == typeof t ? w.eq(t) : e(t).closest(h.title) : e(this).closest(h.title),
  10194. o = n.next(S),
  10195. a = o.hasClass(g.animating),
  10196. r = o.hasClass(g.active),
  10197. s = r && !a,
  10198. l = !r && a;f.debug("Toggling visibility of content", n), s || l ? m.collapsible ? f.close.call(n) : f.debug("Cannot close accordion content collapsing is disabled") : f.open.call(n);
  10199. }, open: function open(t) {
  10200. var n = t !== i ? "number" == typeof t ? w.eq(t) : e(t).closest(h.title) : e(this).closest(h.title),
  10201. o = n.next(S),
  10202. a = o.hasClass(g.animating);o.hasClass(g.active) || a ? f.debug("Accordion already open, skipping", o) : (f.debug("Opening accordion content", n), m.onOpening.call(o), m.onChanging.call(o), m.exclusive && f.closeOthers.call(n), n.addClass(g.active), o.stop(!0, !0).addClass(g.animating), m.animateChildren && (e.fn.transition !== i && C.transition("is supported") ? o.children().transition({ animation: "fade in", queue: !1, useFailSafe: !0, debug: m.debug, verbose: m.verbose, duration: m.duration }) : o.children().stop(!0, !0).animate({ opacity: 1 }, m.duration, f.resetOpacity)), o.slideDown(m.duration, m.easing, function () {
  10203. o.removeClass(g.animating).addClass(g.active), f.reset.display.call(this), m.onOpen.call(this), m.onChange.call(this);
  10204. }));
  10205. }, close: function close(t) {
  10206. var n = t !== i ? "number" == typeof t ? w.eq(t) : e(t).closest(h.title) : e(this).closest(h.title),
  10207. o = n.next(S),
  10208. a = o.hasClass(g.animating),
  10209. r = o.hasClass(g.active);!r && !(!r && a) || r && a || (f.debug("Closing accordion content", o), m.onClosing.call(o), m.onChanging.call(o), n.removeClass(g.active), o.stop(!0, !0).addClass(g.animating), m.animateChildren && (e.fn.transition !== i && C.transition("is supported") ? o.children().transition({ animation: "fade out", queue: !1, useFailSafe: !0, debug: m.debug, verbose: m.verbose, duration: m.duration }) : o.children().stop(!0, !0).animate({ opacity: 0 }, m.duration, f.resetOpacity)), o.slideUp(m.duration, m.easing, function () {
  10210. o.removeClass(g.animating).removeClass(g.active), f.reset.display.call(this), m.onClose.call(this), m.onChange.call(this);
  10211. }));
  10212. }, closeOthers: function closeOthers(t) {
  10213. var n,
  10214. o,
  10215. a,
  10216. r = t !== i ? w.eq(t) : e(this).closest(h.title),
  10217. s = r.parents(h.content).prev(h.title),
  10218. l = r.closest(h.accordion),
  10219. c = h.title + "." + g.active + ":visible",
  10220. u = h.content + "." + g.active + ":visible";m.closeNested ? a = (n = l.find(c).not(s)).next(S) : (n = l.find(c).not(s), o = l.find(u).find(c).not(s), a = (n = n.not(o)).next(S)), n.length > 0 && (f.debug("Exclusive enabled, closing other content", n), n.removeClass(g.active), a.removeClass(g.animating).stop(!0, !0), m.animateChildren && (e.fn.transition !== i && C.transition("is supported") ? a.children().transition({ animation: "fade out", useFailSafe: !0, debug: m.debug, verbose: m.verbose, duration: m.duration }) : a.children().stop(!0, !0).animate({ opacity: 0 }, m.duration, f.resetOpacity)), a.slideUp(m.duration, m.easing, function () {
  10221. e(this).removeClass(g.active), f.reset.display.call(this);
  10222. }));
  10223. }, reset: { display: function display() {
  10224. f.verbose("Removing inline display from element", this), e(this).css("display", ""), "" === e(this).attr("style") && e(this).attr("style", "").removeAttr("style");
  10225. }, opacity: function opacity() {
  10226. f.verbose("Removing inline opacity from element", this), e(this).css("opacity", ""), "" === e(this).attr("style") && e(this).attr("style", "").removeAttr("style");
  10227. } }, setting: function setting(t, n) {
  10228. if (f.debug("Changing setting", t, n), e.isPlainObject(t)) e.extend(!0, m, t);else {
  10229. if (n === i) return m[t];e.isPlainObject(m[t]) ? e.extend(!0, m[t], n) : m[t] = n;
  10230. }
  10231. }, internal: function internal(t, n) {
  10232. if (f.debug("Changing internal", t, n), n === i) return f[t];e.isPlainObject(t) ? e.extend(!0, f, t) : f[t] = n;
  10233. }, debug: function debug() {
  10234. !m.silent && m.debug && (m.performance ? f.performance.log(arguments) : (f.debug = Function.prototype.bind.call(console.info, console, m.name + ":"), f.debug.apply(console, arguments)));
  10235. }, verbose: function verbose() {
  10236. !m.silent && m.verbose && m.debug && (m.performance ? f.performance.log(arguments) : (f.verbose = Function.prototype.bind.call(console.info, console, m.name + ":"), f.verbose.apply(console, arguments)));
  10237. }, error: function error() {
  10238. m.silent || (f.error = Function.prototype.bind.call(console.error, console, m.name + ":"), f.error.apply(console, arguments));
  10239. }, performance: { log: function log(e) {
  10240. var t, n;m.performance && (n = (t = new Date().getTime()) - (r || t), r = t, s.push({ Name: e[0], Arguments: [].slice.call(e, 1) || "", Element: k, "Execution Time": n })), clearTimeout(f.performance.timer), f.performance.timer = setTimeout(f.performance.display, 500);
  10241. }, display: function display() {
  10242. var t = m.name + ":",
  10243. n = 0;r = !1, clearTimeout(f.performance.timer), e.each(s, function (e, t) {
  10244. n += t["Execution Time"];
  10245. }), t += " " + n + "ms", x && (t += " '" + x + "'"), (console.group !== i || console.table !== i) && s.length > 0 && (console.groupCollapsed(t), console.table ? console.table(s) : e.each(s, function (e, t) {
  10246. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  10247. }), console.groupEnd()), s = [];
  10248. } }, invoke: function invoke(t, n, a) {
  10249. var r,
  10250. s,
  10251. l,
  10252. c = T;return n = n || u, a = k || a, "string" == typeof t && c !== i && (t = t.split(/[\. ]/), r = t.length - 1, e.each(t, function (n, o) {
  10253. var a = n != r ? o + t[n + 1].charAt(0).toUpperCase() + t[n + 1].slice(1) : t;if (e.isPlainObject(c[a]) && n != r) c = c[a];else {
  10254. if (c[a] !== i) return s = c[a], !1;if (!e.isPlainObject(c[o]) || n == r) return c[o] !== i ? (s = c[o], !1) : (f.error(v.method, t), !1);c = c[o];
  10255. }
  10256. })), e.isFunction(s) ? l = s.apply(a, n) : s !== i && (l = s), e.isArray(o) ? o.push(l) : o !== i ? o = [o, l] : l !== i && (o = l), s;
  10257. } }, c ? (T === i && f.initialize(), f.invoke(l)) : (T !== i && T.invoke("destroy"), f.initialize());
  10258. }), o !== i ? o : this;
  10259. }, e.fn.accordion.settings = { name: "Accordion", namespace: "accordion", silent: !1, debug: !1, verbose: !1, performance: !0, on: "click", observeChanges: !0, exclusive: !0, collapsible: !0, closeNested: !1, animateChildren: !0, duration: 350, easing: "easeOutQuad", onOpening: function onOpening() {}, onClosing: function onClosing() {}, onChanging: function onChanging() {}, onOpen: function onOpen() {}, onClose: function onClose() {}, onChange: function onChange() {}, error: { method: "The method you called is not defined" }, className: { active: "active", animating: "animating" }, selector: { accordion: ".accordion", title: ".title", trigger: ".title", content: ".content" } }, e.extend(e.easing, { easeOutQuad: function easeOutQuad(e, t, n, i, o) {
  10260. return -i * (t /= o) * (t - 2) + n;
  10261. } });
  10262. }(jQuery, window, document), function (e, t, n, i) {
  10263. "use strict";
  10264. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.checkbox = function (o) {
  10265. var a,
  10266. r = e(this),
  10267. s = r.selector || "",
  10268. l = new Date().getTime(),
  10269. c = [],
  10270. u = arguments[0],
  10271. d = "string" == typeof u,
  10272. f = [].slice.call(arguments, 1);return r.each(function () {
  10273. var r,
  10274. m,
  10275. g = e.extend(!0, {}, e.fn.checkbox.settings, o),
  10276. p = g.className,
  10277. h = g.namespace,
  10278. v = g.selector,
  10279. b = g.error,
  10280. y = "." + h,
  10281. x = "module-" + h,
  10282. C = e(this),
  10283. w = e(this).children(v.label),
  10284. S = e(this).children(v.input),
  10285. k = S[0],
  10286. T = !1,
  10287. A = !1,
  10288. R = C.data(x),
  10289. P = this;m = { initialize: function initialize() {
  10290. m.verbose("Initializing checkbox", g), m.create.label(), m.bind.events(), m.set.tabbable(), m.hide.input(), m.observeChanges(), m.instantiate(), m.setup();
  10291. }, instantiate: function instantiate() {
  10292. m.verbose("Storing instance of module", m), R = m, C.data(x, m);
  10293. }, destroy: function destroy() {
  10294. m.verbose("Destroying module"), m.unbind.events(), m.show.input(), C.removeData(x);
  10295. }, fix: { reference: function reference() {
  10296. C.is(v.input) && (m.debug("Behavior called on <input> adjusting invoked element"), C = C.closest(v.checkbox), m.refresh());
  10297. } }, setup: function setup() {
  10298. m.set.initialLoad(), m.is.indeterminate() ? (m.debug("Initial value is indeterminate"), m.indeterminate()) : m.is.checked() ? (m.debug("Initial value is checked"), m.check()) : (m.debug("Initial value is unchecked"), m.uncheck()), m.remove.initialLoad();
  10299. }, refresh: function refresh() {
  10300. w = C.children(v.label), S = C.children(v.input), k = S[0];
  10301. }, hide: { input: function input() {
  10302. m.verbose("Modifying <input> z-index to be unselectable"), S.addClass(p.hidden);
  10303. } }, show: { input: function input() {
  10304. m.verbose("Modifying <input> z-index to be selectable"), S.removeClass(p.hidden);
  10305. } }, observeChanges: function observeChanges() {
  10306. "MutationObserver" in t && ((r = new MutationObserver(function (e) {
  10307. m.debug("DOM tree modified, updating selector cache"), m.refresh();
  10308. })).observe(P, { childList: !0, subtree: !0 }), m.debug("Setting up mutation observer", r));
  10309. }, attachEvents: function attachEvents(t, n) {
  10310. var i = e(t);n = e.isFunction(m[n]) ? m[n] : m.toggle, i.length > 0 ? (m.debug("Attaching checkbox events to element", t, n), i.on("click" + y, n)) : m.error(b.notFound);
  10311. }, event: { click: function click(t) {
  10312. var n = e(t.target);n.is(v.input) ? m.verbose("Using default check action on initialized checkbox") : n.is(v.link) ? m.debug("Clicking link inside checkbox, skipping toggle") : (m.toggle(), S.focus(), t.preventDefault());
  10313. }, keydown: function keydown(e) {
  10314. var t = e.which,
  10315. n = 13,
  10316. i = 32;t == 27 ? (m.verbose("Escape key pressed blurring field"), S.blur(), A = !0) : e.ctrlKey || t != i && t != n ? A = !1 : (m.verbose("Enter/space key pressed, toggling checkbox"), m.toggle(), A = !0);
  10317. }, keyup: function keyup(e) {
  10318. A && e.preventDefault();
  10319. } }, check: function check() {
  10320. m.should.allowCheck() && (m.debug("Checking checkbox", S), m.set.checked(), m.should.ignoreCallbacks() || (g.onChecked.call(k), g.onChange.call(k)));
  10321. }, uncheck: function uncheck() {
  10322. m.should.allowUncheck() && (m.debug("Unchecking checkbox"), m.set.unchecked(), m.should.ignoreCallbacks() || (g.onUnchecked.call(k), g.onChange.call(k)));
  10323. }, indeterminate: function indeterminate() {
  10324. m.should.allowIndeterminate() ? m.debug("Checkbox is already indeterminate") : (m.debug("Making checkbox indeterminate"), m.set.indeterminate(), m.should.ignoreCallbacks() || (g.onIndeterminate.call(k), g.onChange.call(k)));
  10325. }, determinate: function determinate() {
  10326. m.should.allowDeterminate() ? m.debug("Checkbox is already determinate") : (m.debug("Making checkbox determinate"), m.set.determinate(), m.should.ignoreCallbacks() || (g.onDeterminate.call(k), g.onChange.call(k)));
  10327. }, enable: function enable() {
  10328. m.is.enabled() ? m.debug("Checkbox is already enabled") : (m.debug("Enabling checkbox"), m.set.enabled(), g.onEnable.call(k), g.onEnabled.call(k));
  10329. }, disable: function disable() {
  10330. m.is.disabled() ? m.debug("Checkbox is already disabled") : (m.debug("Disabling checkbox"), m.set.disabled(), g.onDisable.call(k), g.onDisabled.call(k));
  10331. }, get: { radios: function radios() {
  10332. var t = m.get.name();return e('input[name="' + t + '"]').closest(v.checkbox);
  10333. }, otherRadios: function otherRadios() {
  10334. return m.get.radios().not(C);
  10335. }, name: function name() {
  10336. return S.attr("name");
  10337. } }, is: { initialLoad: function initialLoad() {
  10338. return T;
  10339. }, radio: function radio() {
  10340. return S.hasClass(p.radio) || "radio" == S.attr("type");
  10341. }, indeterminate: function indeterminate() {
  10342. return S.prop("indeterminate") !== i && S.prop("indeterminate");
  10343. }, checked: function checked() {
  10344. return S.prop("checked") !== i && S.prop("checked");
  10345. }, disabled: function disabled() {
  10346. return S.prop("disabled") !== i && S.prop("disabled");
  10347. }, enabled: function enabled() {
  10348. return !m.is.disabled();
  10349. }, determinate: function determinate() {
  10350. return !m.is.indeterminate();
  10351. }, unchecked: function unchecked() {
  10352. return !m.is.checked();
  10353. } }, should: { allowCheck: function allowCheck() {
  10354. return m.is.determinate() && m.is.checked() && !m.should.forceCallbacks() ? (m.debug("Should not allow check, checkbox is already checked"), !1) : !1 !== g.beforeChecked.apply(k) || (m.debug("Should not allow check, beforeChecked cancelled"), !1);
  10355. }, allowUncheck: function allowUncheck() {
  10356. return m.is.determinate() && m.is.unchecked() && !m.should.forceCallbacks() ? (m.debug("Should not allow uncheck, checkbox is already unchecked"), !1) : !1 !== g.beforeUnchecked.apply(k) || (m.debug("Should not allow uncheck, beforeUnchecked cancelled"), !1);
  10357. }, allowIndeterminate: function allowIndeterminate() {
  10358. return m.is.indeterminate() && !m.should.forceCallbacks() ? (m.debug("Should not allow indeterminate, checkbox is already indeterminate"), !1) : !1 !== g.beforeIndeterminate.apply(k) || (m.debug("Should not allow indeterminate, beforeIndeterminate cancelled"), !1);
  10359. }, allowDeterminate: function allowDeterminate() {
  10360. return m.is.determinate() && !m.should.forceCallbacks() ? (m.debug("Should not allow determinate, checkbox is already determinate"), !1) : !1 !== g.beforeDeterminate.apply(k) || (m.debug("Should not allow determinate, beforeDeterminate cancelled"), !1);
  10361. }, forceCallbacks: function forceCallbacks() {
  10362. return m.is.initialLoad() && g.fireOnInit;
  10363. }, ignoreCallbacks: function ignoreCallbacks() {
  10364. return T && !g.fireOnInit;
  10365. } }, can: { change: function change() {
  10366. return !(C.hasClass(p.disabled) || C.hasClass(p.readOnly) || S.prop("disabled") || S.prop("readonly"));
  10367. }, uncheck: function uncheck() {
  10368. return "boolean" == typeof g.uncheckable ? g.uncheckable : !m.is.radio();
  10369. } }, set: { initialLoad: function initialLoad() {
  10370. T = !0;
  10371. }, checked: function checked() {
  10372. m.verbose("Setting class to checked"), C.removeClass(p.indeterminate).addClass(p.checked), m.is.radio() && m.uncheckOthers(), m.is.indeterminate() || !m.is.checked() ? (m.verbose("Setting state to checked", k), S.prop("indeterminate", !1).prop("checked", !0), m.trigger.change()) : m.debug("Input is already checked, skipping input property change");
  10373. }, unchecked: function unchecked() {
  10374. m.verbose("Removing checked class"), C.removeClass(p.indeterminate).removeClass(p.checked), m.is.indeterminate() || !m.is.unchecked() ? (m.debug("Setting state to unchecked"), S.prop("indeterminate", !1).prop("checked", !1), m.trigger.change()) : m.debug("Input is already unchecked");
  10375. }, indeterminate: function indeterminate() {
  10376. m.verbose("Setting class to indeterminate"), C.addClass(p.indeterminate), m.is.indeterminate() ? m.debug("Input is already indeterminate, skipping input property change") : (m.debug("Setting state to indeterminate"), S.prop("indeterminate", !0), m.trigger.change());
  10377. }, determinate: function determinate() {
  10378. m.verbose("Removing indeterminate class"), C.removeClass(p.indeterminate), m.is.determinate() ? m.debug("Input is already determinate, skipping input property change") : (m.debug("Setting state to determinate"), S.prop("indeterminate", !1));
  10379. }, disabled: function disabled() {
  10380. m.verbose("Setting class to disabled"), C.addClass(p.disabled), m.is.disabled() ? m.debug("Input is already disabled, skipping input property change") : (m.debug("Setting state to disabled"), S.prop("disabled", "disabled"), m.trigger.change());
  10381. }, enabled: function enabled() {
  10382. m.verbose("Removing disabled class"), C.removeClass(p.disabled), m.is.enabled() ? m.debug("Input is already enabled, skipping input property change") : (m.debug("Setting state to enabled"), S.prop("disabled", !1), m.trigger.change());
  10383. }, tabbable: function tabbable() {
  10384. m.verbose("Adding tabindex to checkbox"), S.attr("tabindex") === i && S.attr("tabindex", 0);
  10385. } }, remove: { initialLoad: function initialLoad() {
  10386. T = !1;
  10387. } }, trigger: { change: function change() {
  10388. var e = n.createEvent("HTMLEvents"),
  10389. t = S[0];t && (m.verbose("Triggering native change event"), e.initEvent("change", !0, !1), t.dispatchEvent(e));
  10390. } }, create: { label: function label() {
  10391. S.prevAll(v.label).length > 0 ? (S.prev(v.label).detach().insertAfter(S), m.debug("Moving existing label", w)) : m.has.label() || (w = e("<label>").insertAfter(S), m.debug("Creating label", w));
  10392. } }, has: { label: function label() {
  10393. return w.length > 0;
  10394. } }, bind: { events: function events() {
  10395. m.verbose("Attaching checkbox events"), C.on("click" + y, m.event.click).on("keydown" + y, v.input, m.event.keydown).on("keyup" + y, v.input, m.event.keyup);
  10396. } }, unbind: { events: function events() {
  10397. m.debug("Removing events"), C.off(y);
  10398. } }, uncheckOthers: function uncheckOthers() {
  10399. var e = m.get.otherRadios();m.debug("Unchecking other radios", e), e.removeClass(p.checked);
  10400. }, toggle: function toggle() {
  10401. m.can.change() ? m.is.indeterminate() || m.is.unchecked() ? (m.debug("Currently unchecked"), m.check()) : m.is.checked() && m.can.uncheck() && (m.debug("Currently checked"), m.uncheck()) : m.is.radio() || m.debug("Checkbox is read-only or disabled, ignoring toggle");
  10402. }, setting: function setting(t, n) {
  10403. if (m.debug("Changing setting", t, n), e.isPlainObject(t)) e.extend(!0, g, t);else {
  10404. if (n === i) return g[t];e.isPlainObject(g[t]) ? e.extend(!0, g[t], n) : g[t] = n;
  10405. }
  10406. }, internal: function internal(t, n) {
  10407. if (e.isPlainObject(t)) e.extend(!0, m, t);else {
  10408. if (n === i) return m[t];m[t] = n;
  10409. }
  10410. }, debug: function debug() {
  10411. !g.silent && g.debug && (g.performance ? m.performance.log(arguments) : (m.debug = Function.prototype.bind.call(console.info, console, g.name + ":"), m.debug.apply(console, arguments)));
  10412. }, verbose: function verbose() {
  10413. !g.silent && g.verbose && g.debug && (g.performance ? m.performance.log(arguments) : (m.verbose = Function.prototype.bind.call(console.info, console, g.name + ":"), m.verbose.apply(console, arguments)));
  10414. }, error: function error() {
  10415. g.silent || (m.error = Function.prototype.bind.call(console.error, console, g.name + ":"), m.error.apply(console, arguments));
  10416. }, performance: { log: function log(e) {
  10417. var t, n;g.performance && (n = (t = new Date().getTime()) - (l || t), l = t, c.push({ Name: e[0], Arguments: [].slice.call(e, 1) || "", Element: P, "Execution Time": n })), clearTimeout(m.performance.timer), m.performance.timer = setTimeout(m.performance.display, 500);
  10418. }, display: function display() {
  10419. var t = g.name + ":",
  10420. n = 0;l = !1, clearTimeout(m.performance.timer), e.each(c, function (e, t) {
  10421. n += t["Execution Time"];
  10422. }), t += " " + n + "ms", s && (t += " '" + s + "'"), (console.group !== i || console.table !== i) && c.length > 0 && (console.groupCollapsed(t), console.table ? console.table(c) : e.each(c, function (e, t) {
  10423. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  10424. }), console.groupEnd()), c = [];
  10425. } }, invoke: function invoke(t, n, o) {
  10426. var r,
  10427. s,
  10428. l,
  10429. c = R;return n = n || f, o = P || o, "string" == typeof t && c !== i && (t = t.split(/[\. ]/), r = t.length - 1, e.each(t, function (n, o) {
  10430. var a = n != r ? o + t[n + 1].charAt(0).toUpperCase() + t[n + 1].slice(1) : t;if (e.isPlainObject(c[a]) && n != r) c = c[a];else {
  10431. if (c[a] !== i) return s = c[a], !1;if (!e.isPlainObject(c[o]) || n == r) return c[o] !== i ? (s = c[o], !1) : (m.error(b.method, t), !1);c = c[o];
  10432. }
  10433. })), e.isFunction(s) ? l = s.apply(o, n) : s !== i && (l = s), e.isArray(a) ? a.push(l) : a !== i ? a = [a, l] : l !== i && (a = l), s;
  10434. } }, d ? (R === i && m.initialize(), m.invoke(u)) : (R !== i && R.invoke("destroy"), m.initialize());
  10435. }), a !== i ? a : this;
  10436. }, e.fn.checkbox.settings = { name: "Checkbox", namespace: "checkbox", silent: !1, debug: !1, verbose: !0, performance: !0, uncheckable: "auto", fireOnInit: !1, onChange: function onChange() {}, beforeChecked: function beforeChecked() {}, beforeUnchecked: function beforeUnchecked() {}, beforeDeterminate: function beforeDeterminate() {}, beforeIndeterminate: function beforeIndeterminate() {}, onChecked: function onChecked() {}, onUnchecked: function onUnchecked() {}, onDeterminate: function onDeterminate() {}, onIndeterminate: function onIndeterminate() {}, onEnable: function onEnable() {}, onDisable: function onDisable() {}, onEnabled: function onEnabled() {}, onDisabled: function onDisabled() {}, className: { checked: "checked", indeterminate: "indeterminate", disabled: "disabled", hidden: "hidden", radio: "radio", readOnly: "read-only" }, error: { method: "The method you called is not defined" }, selector: { checkbox: ".ui.checkbox", label: "label, .box", input: 'input[type="checkbox"], input[type="radio"]', link: "a[href]" } };
  10437. }(jQuery, window, document), function (e, t, n, i) {
  10438. "use strict";
  10439. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.dimmer = function (t) {
  10440. var o,
  10441. a = e(this),
  10442. r = new Date().getTime(),
  10443. s = [],
  10444. l = arguments[0],
  10445. c = "string" == typeof l,
  10446. u = [].slice.call(arguments, 1);return a.each(function () {
  10447. var d,
  10448. f,
  10449. m,
  10450. g = e.isPlainObject(t) ? e.extend(!0, {}, e.fn.dimmer.settings, t) : e.extend({}, e.fn.dimmer.settings),
  10451. p = g.selector,
  10452. h = g.namespace,
  10453. v = g.className,
  10454. b = g.error,
  10455. y = "." + h,
  10456. x = "module-" + h,
  10457. C = a.selector || "",
  10458. w = "ontouchstart" in n.documentElement ? "touchstart" : "click",
  10459. S = e(this),
  10460. k = this,
  10461. T = S.data(x);(m = { preinitialize: function preinitialize() {
  10462. m.is.dimmer() ? (f = S.parent(), d = S) : (f = S, d = m.has.dimmer() ? g.dimmerName ? f.find(p.dimmer).filter("." + g.dimmerName) : f.find(p.dimmer) : m.create(), m.set.variation());
  10463. }, initialize: function initialize() {
  10464. m.debug("Initializing dimmer", g), m.bind.events(), m.set.dimmable(), m.instantiate();
  10465. }, instantiate: function instantiate() {
  10466. m.verbose("Storing instance of module", m), T = m, S.data(x, T);
  10467. }, destroy: function destroy() {
  10468. m.verbose("Destroying previous module", d), m.unbind.events(), m.remove.variation(), f.off(y);
  10469. }, bind: { events: function events() {
  10470. m.is.page() && f.get(0).addEventListener("touchmove", m.event.preventScroll, { passive: !1 }), "hover" == g.on ? f.on("mouseenter" + y, m.show).on("mouseleave" + y, m.hide) : "click" == g.on && f.on(w + y, m.toggle), m.is.page() && (m.debug("Setting as a page dimmer", f), m.set.pageDimmer()), m.is.closable() && (m.verbose("Adding dimmer close event", d), f.on(w + y, p.dimmer, m.event.click));
  10471. } }, unbind: { events: function events() {
  10472. m.is.page() && f.get(0).removeEventListener("touchmove", m.event.preventScroll, { passive: !1 }), S.removeData(x), f.off(y);
  10473. } }, event: { click: function click(t) {
  10474. m.verbose("Determining if event occured on dimmer", t), (0 === d.find(t.target).length || e(t.target).is(p.content)) && (m.hide(), t.stopImmediatePropagation());
  10475. }, preventScroll: function preventScroll(e) {
  10476. e.preventDefault();
  10477. } }, addContent: function addContent(t) {
  10478. var n = e(t);m.debug("Add content to dimmer", n), n.parent()[0] !== d[0] && n.detach().appendTo(d);
  10479. }, create: function create() {
  10480. var t = e(g.template.dimmer());return g.dimmerName && (m.debug("Creating named dimmer", g.dimmerName), t.addClass(g.dimmerName)), t.appendTo(f), t;
  10481. }, show: function show(t) {
  10482. t = e.isFunction(t) ? t : function () {}, m.debug("Showing dimmer", d, g), m.is.dimmed() && !m.is.animating() || !m.is.enabled() ? m.debug("Dimmer is already shown or disabled") : (m.animate.show(t), g.onShow.call(k), g.onChange.call(k));
  10483. }, hide: function hide(t) {
  10484. t = e.isFunction(t) ? t : function () {}, m.is.dimmed() || m.is.animating() ? (m.debug("Hiding dimmer", d), m.animate.hide(t), g.onHide.call(k), g.onChange.call(k)) : m.debug("Dimmer is not visible");
  10485. }, toggle: function toggle() {
  10486. m.verbose("Toggling dimmer visibility", d), m.is.dimmed() ? m.hide() : m.show();
  10487. }, animate: { show: function show(t) {
  10488. t = e.isFunction(t) ? t : function () {}, g.useCSS && e.fn.transition !== i && d.transition("is supported") ? ("auto" !== g.opacity && m.set.opacity(), d.transition({ displayType: "flex", animation: g.transition + " in", queue: !1, duration: m.get.duration(), useFailSafe: !0, onStart: function onStart() {
  10489. m.set.dimmed();
  10490. }, onComplete: function onComplete() {
  10491. m.set.active(), t();
  10492. } })) : (m.verbose("Showing dimmer animation with javascript"), m.set.dimmed(), "auto" == g.opacity && (g.opacity = .8), d.stop().css({ opacity: 0, width: "100%", height: "100%" }).fadeTo(m.get.duration(), g.opacity, function () {
  10493. d.removeAttr("style"), m.set.active(), t();
  10494. }));
  10495. }, hide: function hide(t) {
  10496. t = e.isFunction(t) ? t : function () {}, g.useCSS && e.fn.transition !== i && d.transition("is supported") ? (m.verbose("Hiding dimmer with css"), d.transition({ displayType: "flex", animation: g.transition + " out", queue: !1, duration: m.get.duration(), useFailSafe: !0, onStart: function onStart() {
  10497. m.remove.dimmed();
  10498. }, onComplete: function onComplete() {
  10499. m.remove.active(), t();
  10500. } })) : (m.verbose("Hiding dimmer with javascript"), m.remove.dimmed(), d.stop().fadeOut(m.get.duration(), function () {
  10501. m.remove.active(), d.removeAttr("style"), t();
  10502. }));
  10503. } }, get: { dimmer: function dimmer() {
  10504. return d;
  10505. }, duration: function duration() {
  10506. return "object" == _typeof(g.duration) ? m.is.active() ? g.duration.hide : g.duration.show : g.duration;
  10507. } }, has: { dimmer: function dimmer() {
  10508. return g.dimmerName ? S.find(p.dimmer).filter("." + g.dimmerName).length > 0 : S.find(p.dimmer).length > 0;
  10509. } }, is: { active: function active() {
  10510. return d.hasClass(v.active);
  10511. }, animating: function animating() {
  10512. return d.is(":animated") || d.hasClass(v.animating);
  10513. }, closable: function closable() {
  10514. return "auto" == g.closable ? "hover" != g.on : g.closable;
  10515. }, dimmer: function dimmer() {
  10516. return S.hasClass(v.dimmer);
  10517. }, dimmable: function dimmable() {
  10518. return S.hasClass(v.dimmable);
  10519. }, dimmed: function dimmed() {
  10520. return f.hasClass(v.dimmed);
  10521. }, disabled: function disabled() {
  10522. return f.hasClass(v.disabled);
  10523. }, enabled: function enabled() {
  10524. return !m.is.disabled();
  10525. }, page: function page() {
  10526. return f.is("body");
  10527. }, pageDimmer: function pageDimmer() {
  10528. return d.hasClass(v.pageDimmer);
  10529. } }, can: { show: function show() {
  10530. return !d.hasClass(v.disabled);
  10531. } }, set: { opacity: function opacity(e) {
  10532. var t = d.css("background-color"),
  10533. n = t.split(","),
  10534. i = n && 3 == n.length,
  10535. o = n && 4 == n.length;e = 0 === g.opacity ? 0 : g.opacity || e, i || o ? (n[3] = e + ")", t = n.join(",")) : t = "rgba(0, 0, 0, " + e + ")", m.debug("Setting opacity to", e), d.css("background-color", t);
  10536. }, active: function active() {
  10537. d.addClass(v.active);
  10538. }, dimmable: function dimmable() {
  10539. f.addClass(v.dimmable);
  10540. }, dimmed: function dimmed() {
  10541. f.addClass(v.dimmed);
  10542. }, pageDimmer: function pageDimmer() {
  10543. d.addClass(v.pageDimmer);
  10544. }, disabled: function disabled() {
  10545. d.addClass(v.disabled);
  10546. }, variation: function variation(e) {
  10547. (e = e || g.variation) && d.addClass(e);
  10548. } }, remove: { active: function active() {
  10549. d.removeClass(v.active);
  10550. }, dimmed: function dimmed() {
  10551. f.removeClass(v.dimmed);
  10552. }, disabled: function disabled() {
  10553. d.removeClass(v.disabled);
  10554. }, variation: function variation(e) {
  10555. (e = e || g.variation) && d.removeClass(e);
  10556. } }, setting: function setting(t, n) {
  10557. if (m.debug("Changing setting", t, n), e.isPlainObject(t)) e.extend(!0, g, t);else {
  10558. if (n === i) return g[t];e.isPlainObject(g[t]) ? e.extend(!0, g[t], n) : g[t] = n;
  10559. }
  10560. }, internal: function internal(t, n) {
  10561. if (e.isPlainObject(t)) e.extend(!0, m, t);else {
  10562. if (n === i) return m[t];m[t] = n;
  10563. }
  10564. }, debug: function debug() {
  10565. !g.silent && g.debug && (g.performance ? m.performance.log(arguments) : (m.debug = Function.prototype.bind.call(console.info, console, g.name + ":"), m.debug.apply(console, arguments)));
  10566. }, verbose: function verbose() {
  10567. !g.silent && g.verbose && g.debug && (g.performance ? m.performance.log(arguments) : (m.verbose = Function.prototype.bind.call(console.info, console, g.name + ":"), m.verbose.apply(console, arguments)));
  10568. }, error: function error() {
  10569. g.silent || (m.error = Function.prototype.bind.call(console.error, console, g.name + ":"), m.error.apply(console, arguments));
  10570. }, performance: { log: function log(e) {
  10571. var t, n;g.performance && (n = (t = new Date().getTime()) - (r || t), r = t, s.push({ Name: e[0], Arguments: [].slice.call(e, 1) || "", Element: k, "Execution Time": n })), clearTimeout(m.performance.timer), m.performance.timer = setTimeout(m.performance.display, 500);
  10572. }, display: function display() {
  10573. var t = g.name + ":",
  10574. n = 0;r = !1, clearTimeout(m.performance.timer), e.each(s, function (e, t) {
  10575. n += t["Execution Time"];
  10576. }), t += " " + n + "ms", C && (t += " '" + C + "'"), a.length > 1 && (t += " (" + a.length + ")"), (console.group !== i || console.table !== i) && s.length > 0 && (console.groupCollapsed(t), console.table ? console.table(s) : e.each(s, function (e, t) {
  10577. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  10578. }), console.groupEnd()), s = [];
  10579. } }, invoke: function invoke(t, n, a) {
  10580. var r,
  10581. s,
  10582. l,
  10583. c = T;return n = n || u, a = k || a, "string" == typeof t && c !== i && (t = t.split(/[\. ]/), r = t.length - 1, e.each(t, function (n, o) {
  10584. var a = n != r ? o + t[n + 1].charAt(0).toUpperCase() + t[n + 1].slice(1) : t;if (e.isPlainObject(c[a]) && n != r) c = c[a];else {
  10585. if (c[a] !== i) return s = c[a], !1;if (!e.isPlainObject(c[o]) || n == r) return c[o] !== i ? (s = c[o], !1) : (m.error(b.method, t), !1);c = c[o];
  10586. }
  10587. })), e.isFunction(s) ? l = s.apply(a, n) : s !== i && (l = s), e.isArray(o) ? o.push(l) : o !== i ? o = [o, l] : l !== i && (o = l), s;
  10588. } }).preinitialize(), c ? (T === i && m.initialize(), m.invoke(l)) : (T !== i && T.invoke("destroy"), m.initialize());
  10589. }), o !== i ? o : this;
  10590. }, e.fn.dimmer.settings = { name: "Dimmer", namespace: "dimmer", silent: !1, debug: !1, verbose: !1, performance: !0, dimmerName: !1, variation: !1, closable: "auto", useCSS: !0, transition: "fade", on: !1, opacity: "auto", duration: { show: 500, hide: 500 }, onChange: function onChange() {}, onShow: function onShow() {}, onHide: function onHide() {}, error: { method: "The method you called is not defined." }, className: { active: "active", animating: "animating", dimmable: "dimmable", dimmed: "dimmed", dimmer: "dimmer", disabled: "disabled", hide: "hide", pageDimmer: "page", show: "show" }, selector: { dimmer: "> .ui.dimmer", content: ".ui.dimmer > .content, .ui.dimmer > .content > .center" }, template: { dimmer: function dimmer() {
  10591. return e("<div />").attr("class", "ui dimmer");
  10592. } } };
  10593. }(jQuery, window, document), function (e, t, n, i) {
  10594. "use strict";
  10595. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.dropdown = function (o) {
  10596. var a,
  10597. r = e(this),
  10598. s = e(n),
  10599. l = r.selector || "",
  10600. c = "ontouchstart" in n.documentElement,
  10601. u = new Date().getTime(),
  10602. d = [],
  10603. f = arguments[0],
  10604. m = "string" == typeof f,
  10605. g = [].slice.call(arguments, 1);return r.each(function (p) {
  10606. var h,
  10607. v,
  10608. b,
  10609. y,
  10610. x,
  10611. C,
  10612. w,
  10613. S,
  10614. k = e.isPlainObject(o) ? e.extend(!0, {}, e.fn.dropdown.settings, o) : e.extend({}, e.fn.dropdown.settings),
  10615. T = k.className,
  10616. A = k.message,
  10617. R = k.fields,
  10618. P = k.keys,
  10619. E = k.metadata,
  10620. F = k.namespace,
  10621. O = k.regExp,
  10622. D = k.selector,
  10623. q = k.error,
  10624. j = k.templates,
  10625. z = "." + F,
  10626. I = "module-" + F,
  10627. M = e(this),
  10628. L = e(k.context),
  10629. V = M.find(D.text),
  10630. N = M.find(D.search),
  10631. H = M.find(D.sizer),
  10632. U = M.find(D.input),
  10633. W = M.find(D.icon),
  10634. B = M.prev().find(D.text).length > 0 ? M.prev().find(D.text) : M.prev(),
  10635. Q = M.children(D.menu),
  10636. X = Q.find(D.item),
  10637. $ = !1,
  10638. Y = !1,
  10639. Z = !1,
  10640. K = this,
  10641. J = M.data(I);S = { initialize: function initialize() {
  10642. S.debug("Initializing dropdown", k), S.is.alreadySetup() ? S.setup.reference() : (S.setup.layout(), k.values && S.change.values(k.values), S.refreshData(), S.save.defaults(), S.restore.selected(), S.create.id(), S.bind.events(), S.observeChanges(), S.instantiate());
  10643. }, instantiate: function instantiate() {
  10644. S.verbose("Storing instance of dropdown", S), J = S, M.data(I, S);
  10645. }, destroy: function destroy() {
  10646. S.verbose("Destroying previous dropdown", M), S.remove.tabbable(), M.off(z).removeData(I), Q.off(z), s.off(y), S.disconnect.menuObserver(), S.disconnect.selectObserver();
  10647. }, observeChanges: function observeChanges() {
  10648. "MutationObserver" in t && (C = new MutationObserver(S.event.select.mutation), w = new MutationObserver(S.event.menu.mutation), S.debug("Setting up mutation observer", C, w), S.observe.select(), S.observe.menu());
  10649. }, disconnect: { menuObserver: function menuObserver() {
  10650. w && w.disconnect();
  10651. }, selectObserver: function selectObserver() {
  10652. C && C.disconnect();
  10653. } }, observe: { select: function select() {
  10654. S.has.input() && C.observe(M[0], { childList: !0, subtree: !0 });
  10655. }, menu: function menu() {
  10656. S.has.menu() && w.observe(Q[0], { childList: !0, subtree: !0 });
  10657. } }, create: { id: function id() {
  10658. x = (Math.random().toString(16) + "000000000").substr(2, 8), y = "." + x, S.verbose("Creating unique id for element", x);
  10659. }, userChoice: function userChoice(t) {
  10660. var n, o, a;return !!(t = t || S.get.userValues()) && (t = e.isArray(t) ? t : [t], e.each(t, function (t, r) {
  10661. !1 === S.get.item(r) && (a = k.templates.addition(S.add.variables(A.addResult, r)), o = e("<div />").html(a).attr("data-" + E.value, r).attr("data-" + E.text, r).addClass(T.addition).addClass(T.item), k.hideAdditions && o.addClass(T.hidden), n = n === i ? o : n.add(o), S.verbose("Creating user choices for value", r, o));
  10662. }), n);
  10663. }, userLabels: function userLabels(t) {
  10664. var n = S.get.userValues();n && (S.debug("Adding user labels", n), e.each(n, function (e, t) {
  10665. S.verbose("Adding custom user value"), S.add.label(t, t);
  10666. }));
  10667. }, menu: function menu() {
  10668. Q = e("<div />").addClass(T.menu).appendTo(M);
  10669. }, sizer: function sizer() {
  10670. H = e("<span />").addClass(T.sizer).insertAfter(N);
  10671. } }, search: function search(e) {
  10672. e = e !== i ? e : S.get.query(), S.verbose("Searching for query", e), S.has.minCharacters(e) ? S.filter(e) : S.hide();
  10673. }, select: { firstUnfiltered: function firstUnfiltered() {
  10674. S.verbose("Selecting first non-filtered element"), S.remove.selectedItem(), X.not(D.unselectable).not(D.addition + D.hidden).eq(0).addClass(T.selected);
  10675. }, nextAvailable: function nextAvailable(e) {
  10676. var t = (e = e.eq(0)).nextAll(D.item).not(D.unselectable).eq(0),
  10677. n = e.prevAll(D.item).not(D.unselectable).eq(0);t.length > 0 ? (S.verbose("Moving selection to", t), t.addClass(T.selected)) : (S.verbose("Moving selection to", n), n.addClass(T.selected));
  10678. } }, setup: { api: function api() {
  10679. var e = { debug: k.debug, urlData: { value: S.get.value(), query: S.get.query() }, on: !1 };S.verbose("First request, initializing API"), M.api(e);
  10680. }, layout: function layout() {
  10681. M.is("select") && (S.setup.select(), S.setup.returnedObject()), S.has.menu() || S.create.menu(), S.is.search() && !S.has.search() && (S.verbose("Adding search input"), N = e("<input />").addClass(T.search).prop("autocomplete", "off").insertBefore(V)), S.is.multiple() && S.is.searchSelection() && !S.has.sizer() && S.create.sizer(), k.allowTab && S.set.tabbable();
  10682. }, select: function select() {
  10683. var t = S.get.selectValues();S.debug("Dropdown initialized on a select", t), M.is("select") && (U = M), U.parent(D.dropdown).length > 0 ? (S.debug("UI dropdown already exists. Creating dropdown menu only"), M = U.closest(D.dropdown), S.has.menu() || S.create.menu(), Q = M.children(D.menu), S.setup.menu(t)) : (S.debug("Creating entire dropdown from select"), M = e("<div />").attr("class", U.attr("class")).addClass(T.selection).addClass(T.dropdown).html(j.dropdown(t)).insertBefore(U), U.hasClass(T.multiple) && !1 === U.prop("multiple") && (S.error(q.missingMultiple), U.prop("multiple", !0)), U.is("[multiple]") && S.set.multiple(), U.prop("disabled") && (S.debug("Disabling dropdown"), M.addClass(T.disabled)), U.removeAttr("class").detach().prependTo(M)), S.refresh();
  10684. }, menu: function menu(e) {
  10685. Q.html(j.menu(e, R)), X = Q.find(D.item);
  10686. }, reference: function reference() {
  10687. S.debug("Dropdown behavior was called on select, replacing with closest dropdown"), M = M.parent(D.dropdown), J = M.data(I), K = M.get(0), S.refresh(), S.setup.returnedObject();
  10688. }, returnedObject: function returnedObject() {
  10689. var e = r.slice(0, p),
  10690. t = r.slice(p + 1);r = e.add(M).add(t);
  10691. } }, refresh: function refresh() {
  10692. S.refreshSelectors(), S.refreshData();
  10693. }, refreshItems: function refreshItems() {
  10694. X = Q.find(D.item);
  10695. }, refreshSelectors: function refreshSelectors() {
  10696. S.verbose("Refreshing selector cache"), V = M.find(D.text), N = M.find(D.search), U = M.find(D.input), W = M.find(D.icon), B = M.prev().find(D.text).length > 0 ? M.prev().find(D.text) : M.prev(), Q = M.children(D.menu), X = Q.find(D.item);
  10697. }, refreshData: function refreshData() {
  10698. S.verbose("Refreshing cached metadata"), X.removeData(E.text).removeData(E.value);
  10699. }, clearData: function clearData() {
  10700. S.verbose("Clearing metadata"), X.removeData(E.text).removeData(E.value), M.removeData(E.defaultText).removeData(E.defaultValue).removeData(E.placeholderText);
  10701. }, toggle: function toggle() {
  10702. S.verbose("Toggling menu visibility"), S.is.active() ? S.hide() : S.show();
  10703. }, show: function show(t) {
  10704. if (t = e.isFunction(t) ? t : function () {}, !S.can.show() && S.is.remote() && (S.debug("No API results retrieved, searching before show"), S.queryRemote(S.get.query(), S.show)), S.can.show() && !S.is.active()) {
  10705. if (S.debug("Showing dropdown"), !S.has.message() || S.has.maxSelections() || S.has.allResultsFiltered() || S.remove.message(), S.is.allFiltered()) return !0;!1 !== k.onShow.call(K) && S.animate.show(function () {
  10706. S.can.click() && S.bind.intent(), S.has.menuSearch() && S.focusSearch(), S.set.visible(), t.call(K);
  10707. });
  10708. }
  10709. }, hide: function hide(t) {
  10710. t = e.isFunction(t) ? t : function () {}, S.is.active() && !S.is.animatingOutward() && (S.debug("Hiding dropdown"), !1 !== k.onHide.call(K) && S.animate.hide(function () {
  10711. S.remove.visible(), t.call(K);
  10712. }));
  10713. }, hideOthers: function hideOthers() {
  10714. S.verbose("Finding other dropdowns to hide"), r.not(M).has(D.menu + "." + T.visible).dropdown("hide");
  10715. }, hideMenu: function hideMenu() {
  10716. S.verbose("Hiding menu instantaneously"), S.remove.active(), S.remove.visible(), Q.transition("hide");
  10717. }, hideSubMenus: function hideSubMenus() {
  10718. var e = Q.children(D.item).find(D.menu);S.verbose("Hiding sub menus", e), e.transition("hide");
  10719. }, bind: { events: function events() {
  10720. c && S.bind.touchEvents(), S.bind.keyboardEvents(), S.bind.inputEvents(), S.bind.mouseEvents();
  10721. }, touchEvents: function touchEvents() {
  10722. S.debug("Touch device detected binding additional touch events"), S.is.searchSelection() || S.is.single() && M.on("touchstart" + z, S.event.test.toggle), Q.on("touchstart" + z, D.item, S.event.item.mouseenter);
  10723. }, keyboardEvents: function keyboardEvents() {
  10724. S.verbose("Binding keyboard events"), M.on("keydown" + z, S.event.keydown), S.has.search() && M.on(S.get.inputEvent() + z, D.search, S.event.input), S.is.multiple() && s.on("keydown" + y, S.event.document.keydown);
  10725. }, inputEvents: function inputEvents() {
  10726. S.verbose("Binding input change events"), M.on("change" + z, D.input, S.event.change);
  10727. }, mouseEvents: function mouseEvents() {
  10728. S.verbose("Binding mouse events"), S.is.multiple() && M.on("click" + z, D.label, S.event.label.click).on("click" + z, D.remove, S.event.remove.click), S.is.searchSelection() ? (M.on("mousedown" + z, S.event.mousedown).on("mouseup" + z, S.event.mouseup).on("mousedown" + z, D.menu, S.event.menu.mousedown).on("mouseup" + z, D.menu, S.event.menu.mouseup).on("click" + z, D.icon, S.event.icon.click).on("focus" + z, D.search, S.event.search.focus).on("click" + z, D.search, S.event.search.focus).on("blur" + z, D.search, S.event.search.blur).on("click" + z, D.text, S.event.text.focus), S.is.multiple() && M.on("click" + z, S.event.click)) : ("click" == k.on ? M.on("click" + z, D.icon, S.event.icon.click).on("click" + z, S.event.test.toggle) : "hover" == k.on ? M.on("mouseenter" + z, S.delay.show).on("mouseleave" + z, S.delay.hide) : M.on(k.on + z, S.toggle), M.on("mousedown" + z, S.event.mousedown).on("mouseup" + z, S.event.mouseup).on("focus" + z, S.event.focus), S.has.menuSearch() ? M.on("blur" + z, D.search, S.event.search.blur) : M.on("blur" + z, S.event.blur)), Q.on("mouseenter" + z, D.item, S.event.item.mouseenter).on("mouseleave" + z, D.item, S.event.item.mouseleave).on("click" + z, D.item, S.event.item.click);
  10729. }, intent: function intent() {
  10730. S.verbose("Binding hide intent event to document"), c && s.on("touchstart" + y, S.event.test.touch).on("touchmove" + y, S.event.test.touch), s.on("click" + y, S.event.test.hide);
  10731. } }, unbind: { intent: function intent() {
  10732. S.verbose("Removing hide intent event from document"), c && s.off("touchstart" + y).off("touchmove" + y), s.off("click" + y);
  10733. } }, filter: function filter(e) {
  10734. var t = e !== i ? e : S.get.query(),
  10735. n = function n() {
  10736. S.is.multiple() && S.filterActive(), (e || !e && 0 == S.get.activeItem().length) && S.select.firstUnfiltered(), S.has.allResultsFiltered() ? k.onNoResults.call(K, t) ? k.allowAdditions ? k.hideAdditions && (S.verbose("User addition with no menu, setting empty style"), S.set.empty(), S.hideMenu()) : (S.verbose("All items filtered, showing message", t), S.add.message(A.noResults)) : (S.verbose("All items filtered, hiding dropdown", t), S.hideMenu()) : (S.remove.empty(), S.remove.message()), k.allowAdditions && S.add.userSuggestion(e), S.is.searchSelection() && S.can.show() && S.is.focusedOnSearch() && S.show();
  10737. };k.useLabels && S.has.maxSelections() || (k.apiSettings ? S.can.useAPI() ? S.queryRemote(t, function () {
  10738. k.filterRemoteData && S.filterItems(t), n();
  10739. }) : S.error(q.noAPI) : (S.filterItems(t), n()));
  10740. }, queryRemote: function queryRemote(t, n) {
  10741. var i = { errorDuration: !1, cache: "local", throttle: k.throttle, urlData: { query: t }, onError: function onError() {
  10742. S.add.message(A.serverError), n();
  10743. }, onFailure: function onFailure() {
  10744. S.add.message(A.serverError), n();
  10745. }, onSuccess: function onSuccess(t) {
  10746. var i = t[R.remoteValues];e.isArray(i) && i.length > 0 ? (S.remove.message(), S.setup.menu({ values: t[R.remoteValues] })) : S.add.message(A.noResults), n();
  10747. } };M.api("get request") || S.setup.api(), i = e.extend(!0, {}, i, k.apiSettings), M.api("setting", i).api("query");
  10748. }, filterItems: function filterItems(t) {
  10749. var n = t !== i ? t : S.get.query(),
  10750. o = null,
  10751. a = S.escape.string(n),
  10752. r = new RegExp("^" + a, "igm");S.has.query() && (o = [], S.verbose("Searching for matching values", n), X.each(function () {
  10753. var t,
  10754. i,
  10755. a = e(this);if ("both" == k.match || "text" == k.match) {
  10756. if (-1 !== (t = String(S.get.choiceText(a, !1))).search(r)) return o.push(this), !0;if ("exact" === k.fullTextSearch && S.exactSearch(n, t)) return o.push(this), !0;if (!0 === k.fullTextSearch && S.fuzzySearch(n, t)) return o.push(this), !0;
  10757. }if ("both" == k.match || "value" == k.match) {
  10758. if (-1 !== (i = String(S.get.choiceValue(a, t))).search(r)) return o.push(this), !0;if ("exact" === k.fullTextSearch && S.exactSearch(n, i)) return o.push(this), !0;if (!0 === k.fullTextSearch && S.fuzzySearch(n, i)) return o.push(this), !0;
  10759. }
  10760. })), S.debug("Showing only matched items", n), S.remove.filteredItem(), o && X.not(o).addClass(T.filtered);
  10761. }, fuzzySearch: function fuzzySearch(e, t) {
  10762. var n = t.length,
  10763. i = e.length;if (e = e.toLowerCase(), t = t.toLowerCase(), i > n) return !1;if (i === n) return e === t;e: for (var o = 0, a = 0; o < i; o++) {
  10764. for (var r = e.charCodeAt(o); a < n;) {
  10765. if (t.charCodeAt(a++) === r) continue e;
  10766. }return !1;
  10767. }return !0;
  10768. }, exactSearch: function exactSearch(e, t) {
  10769. return e = e.toLowerCase(), (t = t.toLowerCase()).indexOf(e) > -1;
  10770. }, filterActive: function filterActive() {
  10771. k.useLabels && X.filter("." + T.active).addClass(T.filtered);
  10772. }, focusSearch: function focusSearch(e) {
  10773. S.has.search() && !S.is.focusedOnSearch() && (e ? (M.off("focus" + z, D.search), N.focus(), M.on("focus" + z, D.search, S.event.search.focus)) : N.focus());
  10774. }, forceSelection: function forceSelection() {
  10775. var e = X.not(T.filtered).filter("." + T.selected).eq(0),
  10776. t = X.not(T.filtered).filter("." + T.active).eq(0),
  10777. n = e.length > 0 ? e : t;if (n.length > 0 && !S.is.multiple()) return S.debug("Forcing partial selection to selected item", n), void S.event.item.click.call(n, {}, !0);k.allowAdditions ? (S.set.selected(S.get.query()), S.remove.searchTerm()) : S.remove.searchTerm();
  10778. }, change: { values: function values(t) {
  10779. k.allowAdditions || S.clear(), S.debug("Creating dropdown with specified values", t), S.setup.menu({ values: t }), e.each(t, function (e, t) {
  10780. if (1 == t.selected) return S.debug("Setting initial selection to", t.value), S.set.selected(t.value), !0;
  10781. });
  10782. } }, event: { change: function change() {
  10783. Z || (S.debug("Input changed, updating selection"), S.set.selected());
  10784. }, focus: function focus() {
  10785. k.showOnFocus && !$ && S.is.hidden() && !v && S.show();
  10786. }, blur: function blur(e) {
  10787. v = n.activeElement === this, $ || v || (S.remove.activeLabel(), S.hide());
  10788. }, mousedown: function mousedown() {
  10789. S.is.searchSelection() ? b = !0 : $ = !0;
  10790. }, mouseup: function mouseup() {
  10791. S.is.searchSelection() ? b = !1 : $ = !1;
  10792. }, click: function click(t) {
  10793. e(t.target).is(M) && (S.is.focusedOnSearch() ? S.show() : S.focusSearch());
  10794. }, search: { focus: function focus() {
  10795. $ = !0, S.is.multiple() && S.remove.activeLabel(), k.showOnFocus && S.search();
  10796. }, blur: function blur(e) {
  10797. v = n.activeElement === this, S.is.searchSelection() && !b && (Y || v || (k.forceSelection && S.forceSelection(), S.hide())), b = !1;
  10798. } }, icon: { click: function click(e) {
  10799. S.toggle();
  10800. } }, text: { focus: function focus(e) {
  10801. $ = !0, S.focusSearch();
  10802. } }, input: function input(e) {
  10803. (S.is.multiple() || S.is.searchSelection()) && S.set.filtered(), clearTimeout(S.timer), S.timer = setTimeout(S.search, k.delay.search);
  10804. }, label: { click: function click(t) {
  10805. var n = e(this),
  10806. i = M.find(D.label),
  10807. o = i.filter("." + T.active),
  10808. a = n.nextAll("." + T.active),
  10809. r = n.prevAll("." + T.active),
  10810. s = a.length > 0 ? n.nextUntil(a).add(o).add(n) : n.prevUntil(r).add(o).add(n);t.shiftKey ? (o.removeClass(T.active), s.addClass(T.active)) : t.ctrlKey ? n.toggleClass(T.active) : (o.removeClass(T.active), n.addClass(T.active)), k.onLabelSelect.apply(this, i.filter("." + T.active));
  10811. } }, remove: { click: function click() {
  10812. var t = e(this).parent();t.hasClass(T.active) ? S.remove.activeLabels() : S.remove.activeLabels(t);
  10813. } }, test: { toggle: function toggle(e) {
  10814. var t = S.is.multiple() ? S.show : S.toggle;S.is.bubbledLabelClick(e) || S.is.bubbledIconClick(e) || S.determine.eventOnElement(e, t) && e.preventDefault();
  10815. }, touch: function touch(e) {
  10816. S.determine.eventOnElement(e, function () {
  10817. "touchstart" == e.type ? S.timer = setTimeout(function () {
  10818. S.hide();
  10819. }, k.delay.touch) : "touchmove" == e.type && clearTimeout(S.timer);
  10820. }), e.stopPropagation();
  10821. }, hide: function hide(e) {
  10822. S.determine.eventInModule(e, S.hide);
  10823. } }, select: { mutation: function mutation(t) {
  10824. S.debug("<select> modified, recreating menu");var n = !1;e.each(t, function (t, i) {
  10825. if (e(i.target).is("select") || e(i.addedNodes).is("select")) return n = !0, !0;
  10826. }), n && (S.disconnect.selectObserver(), S.refresh(), S.setup.select(), S.set.selected(), S.observe.select());
  10827. } }, menu: { mutation: function mutation(t) {
  10828. var n = t[0],
  10829. i = n.addedNodes ? e(n.addedNodes[0]) : e(!1),
  10830. o = n.removedNodes ? e(n.removedNodes[0]) : e(!1),
  10831. a = i.add(o),
  10832. r = a.is(D.addition) || a.closest(D.addition).length > 0,
  10833. s = a.is(D.message) || a.closest(D.message).length > 0;r || s ? (S.debug("Updating item selector cache"), S.refreshItems()) : (S.debug("Menu modified, updating selector cache"), S.refresh());
  10834. }, mousedown: function mousedown() {
  10835. Y = !0;
  10836. }, mouseup: function mouseup() {
  10837. Y = !1;
  10838. } }, item: { mouseenter: function mouseenter(t) {
  10839. var n = e(t.target),
  10840. i = e(this),
  10841. o = i.children(D.menu),
  10842. a = i.siblings(D.item).children(D.menu),
  10843. r = o.length > 0;!(o.find(n).length > 0) && r && (clearTimeout(S.itemTimer), S.itemTimer = setTimeout(function () {
  10844. S.verbose("Showing sub-menu", o), e.each(a, function () {
  10845. S.animate.hide(!1, e(this));
  10846. }), S.animate.show(!1, o);
  10847. }, k.delay.show), t.preventDefault());
  10848. }, mouseleave: function mouseleave(t) {
  10849. var n = e(this).children(D.menu);n.length > 0 && (clearTimeout(S.itemTimer), S.itemTimer = setTimeout(function () {
  10850. S.verbose("Hiding sub-menu", n), S.animate.hide(!1, n);
  10851. }, k.delay.hide));
  10852. }, click: function click(t, i) {
  10853. var o = e(this),
  10854. a = e(t ? t.target : ""),
  10855. r = o.find(D.menu),
  10856. s = S.get.choiceText(o),
  10857. l = S.get.choiceValue(o, s),
  10858. c = r.length > 0,
  10859. u = r.find(a).length > 0;S.has.menuSearch() && e(n.activeElement).blur(), u || c && !k.allowCategorySelection || (S.is.searchSelection() && (k.allowAdditions && S.remove.userAddition(), S.remove.searchTerm(), S.is.focusedOnSearch() || 1 == i || S.focusSearch(!0)), k.useLabels || (S.remove.filteredItem(), S.set.scrollPosition(o)), S.determine.selectAction.call(this, s, l));
  10860. } }, document: { keydown: function keydown(e) {
  10861. var t = e.which;if (S.is.inObject(t, P)) {
  10862. var n = M.find(D.label),
  10863. i = n.filter("." + T.active),
  10864. o = (i.data(E.value), n.index(i)),
  10865. a = n.length,
  10866. r = i.length > 0,
  10867. s = i.length > 1,
  10868. l = 0 === o,
  10869. c = o + 1 == a,
  10870. u = S.is.searchSelection(),
  10871. d = S.is.focusedOnSearch(),
  10872. f = S.is.focused(),
  10873. m = d && 0 === S.get.caretPosition();if (u && !r && !d) return;t == P.leftArrow ? !f && !m || r ? r && (e.shiftKey ? S.verbose("Adding previous label to selection") : (S.verbose("Selecting previous label"), n.removeClass(T.active)), l && !s ? i.addClass(T.active) : i.prev(D.siblingLabel).addClass(T.active).end(), e.preventDefault()) : (S.verbose("Selecting previous label"), n.last().addClass(T.active)) : t == P.rightArrow ? (f && !r && n.first().addClass(T.active), r && (e.shiftKey ? S.verbose("Adding next label to selection") : (S.verbose("Selecting next label"), n.removeClass(T.active)), c ? u ? d ? n.removeClass(T.active) : S.focusSearch() : s ? i.next(D.siblingLabel).addClass(T.active) : i.addClass(T.active) : i.next(D.siblingLabel).addClass(T.active), e.preventDefault())) : t == P.deleteKey || t == P.backspace ? r ? (S.verbose("Removing active labels"), c && u && !d && S.focusSearch(), i.last().next(D.siblingLabel).addClass(T.active), S.remove.activeLabels(i), e.preventDefault()) : m && !r && t == P.backspace && (S.verbose("Removing last label on input backspace"), i = n.last().addClass(T.active), S.remove.activeLabels(i)) : i.removeClass(T.active);
  10874. }
  10875. } }, keydown: function keydown(e) {
  10876. var t = e.which;if (S.is.inObject(t, P)) {
  10877. var n,
  10878. i = X.not(D.unselectable).filter("." + T.selected).eq(0),
  10879. o = Q.children("." + T.active).eq(0),
  10880. a = i.length > 0 ? i : o,
  10881. r = a.length > 0 ? a.siblings(":not(." + T.filtered + ")").addBack() : Q.children(":not(." + T.filtered + ")"),
  10882. s = a.children(D.menu),
  10883. l = a.closest(D.menu),
  10884. c = l.hasClass(T.visible) || l.hasClass(T.animating) || l.parent(D.menu).length > 0,
  10885. u = s.length > 0,
  10886. d = a.length > 0,
  10887. f = a.not(D.unselectable).length > 0,
  10888. m = t == P.delimiter && k.allowAdditions && S.is.multiple();if (k.allowAdditions && k.hideAdditions && (t == P.enter || m) && f && (S.verbose("Selecting item from keyboard shortcut", a), S.event.item.click.call(a, e), S.is.searchSelection() && S.remove.searchTerm()), S.is.visible()) {
  10889. if ((t == P.enter || m) && (t == P.enter && d && u && !k.allowCategorySelection ? (S.verbose("Pressed enter on unselectable category, opening sub menu"), t = P.rightArrow) : f && (S.verbose("Selecting item from keyboard shortcut", a), S.event.item.click.call(a, e), S.is.searchSelection() && S.remove.searchTerm()), e.preventDefault()), d && (t == P.leftArrow && l[0] !== Q[0] && (S.verbose("Left key pressed, closing sub-menu"), S.animate.hide(!1, l), a.removeClass(T.selected), l.closest(D.item).addClass(T.selected), e.preventDefault()), t == P.rightArrow && u && (S.verbose("Right key pressed, opening sub-menu"), S.animate.show(!1, s), a.removeClass(T.selected), s.find(D.item).eq(0).addClass(T.selected), e.preventDefault())), t == P.upArrow) {
  10890. if (n = d && c ? a.prevAll(D.item + ":not(" + D.unselectable + ")").eq(0) : X.eq(0), r.index(n) < 0) return S.verbose("Up key pressed but reached top of current menu"), void e.preventDefault();S.verbose("Up key pressed, changing active item"), a.removeClass(T.selected), n.addClass(T.selected), S.set.scrollPosition(n), k.selectOnKeydown && S.is.single() && S.set.selectedItem(n), e.preventDefault();
  10891. }if (t == P.downArrow) {
  10892. if (0 === (n = d && c ? n = a.nextAll(D.item + ":not(" + D.unselectable + ")").eq(0) : X.eq(0)).length) return S.verbose("Down key pressed but reached bottom of current menu"), void e.preventDefault();S.verbose("Down key pressed, changing active item"), X.removeClass(T.selected), n.addClass(T.selected), S.set.scrollPosition(n), k.selectOnKeydown && S.is.single() && S.set.selectedItem(n), e.preventDefault();
  10893. }t == P.pageUp && (S.scrollPage("up"), e.preventDefault()), t == P.pageDown && (S.scrollPage("down"), e.preventDefault()), t == P.escape && (S.verbose("Escape key pressed, closing dropdown"), S.hide());
  10894. } else m && e.preventDefault(), t != P.downArrow || S.is.visible() || (S.verbose("Down key pressed, showing dropdown"), S.show(), e.preventDefault());
  10895. } else S.has.search() || S.set.selectedLetter(String.fromCharCode(t));
  10896. } }, trigger: { change: function change() {
  10897. var e = n.createEvent("HTMLEvents"),
  10898. t = U[0];t && (S.verbose("Triggering native change event"), e.initEvent("change", !0, !1), t.dispatchEvent(e));
  10899. } }, determine: { selectAction: function selectAction(t, n) {
  10900. S.verbose("Determining action", k.action), e.isFunction(S.action[k.action]) ? (S.verbose("Triggering preset action", k.action, t, n), S.action[k.action].call(K, t, n, this)) : e.isFunction(k.action) ? (S.verbose("Triggering user action", k.action, t, n), k.action.call(K, t, n, this)) : S.error(q.action, k.action);
  10901. }, eventInModule: function eventInModule(t, i) {
  10902. var o = e(t.target),
  10903. a = o.closest(n.documentElement).length > 0,
  10904. r = o.closest(M).length > 0;return i = e.isFunction(i) ? i : function () {}, a && !r ? (S.verbose("Triggering event", i), i(), !0) : (S.verbose("Event occurred in dropdown, canceling callback"), !1);
  10905. }, eventOnElement: function eventOnElement(t, i) {
  10906. var o = e(t.target),
  10907. a = o.closest(D.siblingLabel),
  10908. r = n.body.contains(t.target),
  10909. s = 0 === M.find(a).length,
  10910. l = 0 === o.closest(Q).length;return i = e.isFunction(i) ? i : function () {}, r && s && l ? (S.verbose("Triggering event", i), i(), !0) : (S.verbose("Event occurred in dropdown menu, canceling callback"), !1);
  10911. } }, action: { nothing: function nothing() {}, activate: function activate(t, n, o) {
  10912. if (n = n !== i ? n : t, S.can.activate(e(o))) {
  10913. if (S.set.selected(n, e(o)), S.is.multiple() && !S.is.allFiltered()) return;S.hideAndClear();
  10914. }
  10915. }, select: function select(t, n, o) {
  10916. if (n = n !== i ? n : t, S.can.activate(e(o))) {
  10917. if (S.set.value(n, t, e(o)), S.is.multiple() && !S.is.allFiltered()) return;S.hideAndClear();
  10918. }
  10919. }, combo: function combo(t, n, o) {
  10920. n = n !== i ? n : t, S.set.selected(n, e(o)), S.hideAndClear();
  10921. }, hide: function hide(e, t, n) {
  10922. S.set.value(t, e), S.hideAndClear();
  10923. } }, get: { id: function id() {
  10924. return x;
  10925. }, defaultText: function defaultText() {
  10926. return M.data(E.defaultText);
  10927. }, defaultValue: function defaultValue() {
  10928. return M.data(E.defaultValue);
  10929. }, placeholderText: function placeholderText() {
  10930. return "auto" != k.placeholder && "string" == typeof k.placeholder ? k.placeholder : M.data(E.placeholderText) || "";
  10931. }, text: function text() {
  10932. return V.text();
  10933. }, query: function query() {
  10934. return e.trim(N.val());
  10935. }, searchWidth: function searchWidth(e) {
  10936. return e = e !== i ? e : N.val(), H.text(e), Math.ceil(H.width() + 1);
  10937. }, selectionCount: function selectionCount() {
  10938. var t = S.get.values();return S.is.multiple() ? e.isArray(t) ? t.length : 0 : "" !== S.get.value() ? 1 : 0;
  10939. }, transition: function transition(e) {
  10940. return "auto" == k.transition ? S.is.upward(e) ? "slide up" : "slide down" : k.transition;
  10941. }, userValues: function userValues() {
  10942. var t = S.get.values();return !!t && (t = e.isArray(t) ? t : [t], e.grep(t, function (e) {
  10943. return !1 === S.get.item(e);
  10944. }));
  10945. }, uniqueArray: function uniqueArray(t) {
  10946. return e.grep(t, function (n, i) {
  10947. return e.inArray(n, t) === i;
  10948. });
  10949. }, caretPosition: function caretPosition() {
  10950. var e,
  10951. t,
  10952. i = N.get(0);return "selectionStart" in i ? i.selectionStart : n.selection ? (i.focus(), t = (e = n.selection.createRange()).text.length, e.moveStart("character", -i.value.length), e.text.length - t) : void 0;
  10953. }, value: function value() {
  10954. var t = U.length > 0 ? U.val() : M.data(E.value),
  10955. n = e.isArray(t) && 1 === t.length && "" === t[0];return t === i || n ? "" : t;
  10956. }, values: function values() {
  10957. var e = S.get.value();return "" === e ? "" : !S.has.selectInput() && S.is.multiple() ? "string" == typeof e ? e.split(k.delimiter) : "" : e;
  10958. }, remoteValues: function remoteValues() {
  10959. var t = S.get.values(),
  10960. n = !1;return t && ("string" == typeof t && (t = [t]), e.each(t, function (e, t) {
  10961. var i = S.read.remoteData(t);S.verbose("Restoring value from session data", i, t), i && (n || (n = {}), n[t] = i);
  10962. })), n;
  10963. }, choiceText: function choiceText(t, n) {
  10964. if (n = n !== i ? n : k.preserveHTML, t) return t.find(D.menu).length > 0 && (S.verbose("Retrieving text of element with sub-menu"), (t = t.clone()).find(D.menu).remove(), t.find(D.menuIcon).remove()), t.data(E.text) !== i ? t.data(E.text) : n ? e.trim(t.html()) : e.trim(t.text());
  10965. }, choiceValue: function choiceValue(t, n) {
  10966. return n = n || S.get.choiceText(t), !!t && (t.data(E.value) !== i ? String(t.data(E.value)) : "string" == typeof n ? e.trim(n.toLowerCase()) : String(n));
  10967. }, inputEvent: function inputEvent() {
  10968. var e = N[0];return !!e && (e.oninput !== i ? "input" : e.onpropertychange !== i ? "propertychange" : "keyup");
  10969. }, selectValues: function selectValues() {
  10970. var t = { values: [] };return M.find("option").each(function () {
  10971. var n = e(this),
  10972. o = n.html(),
  10973. a = n.attr("disabled"),
  10974. r = n.attr("value") !== i ? n.attr("value") : o;"auto" === k.placeholder && "" === r ? t.placeholder = o : t.values.push({ name: o, value: r, disabled: a });
  10975. }), k.placeholder && "auto" !== k.placeholder && (S.debug("Setting placeholder value to", k.placeholder), t.placeholder = k.placeholder), k.sortSelect ? (t.values.sort(function (e, t) {
  10976. return e.name > t.name ? 1 : -1;
  10977. }), S.debug("Retrieved and sorted values from select", t)) : S.debug("Retrieved values from select", t), t;
  10978. }, activeItem: function activeItem() {
  10979. return X.filter("." + T.active);
  10980. }, selectedItem: function selectedItem() {
  10981. var e = X.not(D.unselectable).filter("." + T.selected);return e.length > 0 ? e : X.eq(0);
  10982. }, itemWithAdditions: function itemWithAdditions(e) {
  10983. var t = S.get.item(e),
  10984. n = S.create.userChoice(e);return n && n.length > 0 && (t = t.length > 0 ? t.add(n) : n), t;
  10985. }, item: function item(t, n) {
  10986. var o,
  10987. a,
  10988. r = !1;return t = t !== i ? t : S.get.values() !== i ? S.get.values() : S.get.text(), o = a ? t.length > 0 : t !== i && null !== t, a = S.is.multiple() && e.isArray(t), n = "" === t || 0 === t || n || !1, o && X.each(function () {
  10989. var o = e(this),
  10990. s = S.get.choiceText(o),
  10991. l = S.get.choiceValue(o, s);if (null !== l && l !== i) if (a) -1 === e.inArray(String(l), t) && -1 === e.inArray(s, t) || (r = r ? r.add(o) : o);else if (n) {
  10992. if (S.verbose("Ambiguous dropdown value using strict type check", o, t), l === t || s === t) return r = o, !0;
  10993. } else if (String(l) == String(t) || s == t) return S.verbose("Found select item by value", l, t), r = o, !0;
  10994. }), r;
  10995. } }, check: { maxSelections: function maxSelections(e) {
  10996. return !k.maxSelections || ((e = e !== i ? e : S.get.selectionCount()) >= k.maxSelections ? (S.debug("Maximum selection count reached"), k.useLabels && (X.addClass(T.filtered), S.add.message(A.maxSelections)), !0) : (S.verbose("No longer at maximum selection count"), S.remove.message(), S.remove.filteredItem(), S.is.searchSelection() && S.filterItems(), !1));
  10997. } }, restore: { defaults: function defaults() {
  10998. S.clear(), S.restore.defaultText(), S.restore.defaultValue();
  10999. }, defaultText: function defaultText() {
  11000. var e = S.get.defaultText();e === S.get.placeholderText ? (S.debug("Restoring default placeholder text", e), S.set.placeholderText(e)) : (S.debug("Restoring default text", e), S.set.text(e));
  11001. }, placeholderText: function placeholderText() {
  11002. S.set.placeholderText();
  11003. }, defaultValue: function defaultValue() {
  11004. var e = S.get.defaultValue();e !== i && (S.debug("Restoring default value", e), "" !== e ? (S.set.value(e), S.set.selected()) : (S.remove.activeItem(), S.remove.selectedItem()));
  11005. }, labels: function labels() {
  11006. k.allowAdditions && (k.useLabels || (S.error(q.labels), k.useLabels = !0), S.debug("Restoring selected values"), S.create.userLabels()), S.check.maxSelections();
  11007. }, selected: function selected() {
  11008. S.restore.values(), S.is.multiple() ? (S.debug("Restoring previously selected values and labels"), S.restore.labels()) : S.debug("Restoring previously selected values");
  11009. }, values: function values() {
  11010. S.set.initialLoad(), k.apiSettings && k.saveRemoteData && S.get.remoteValues() ? S.restore.remoteValues() : S.set.selected(), S.remove.initialLoad();
  11011. }, remoteValues: function remoteValues() {
  11012. var t = S.get.remoteValues();S.debug("Recreating selected from session data", t), t && (S.is.single() ? e.each(t, function (e, t) {
  11013. S.set.text(t);
  11014. }) : e.each(t, function (e, t) {
  11015. S.add.label(e, t);
  11016. }));
  11017. } }, read: { remoteData: function remoteData(e) {
  11018. var n;if (t.Storage !== i) return (n = sessionStorage.getItem(e)) !== i && n;S.error(q.noStorage);
  11019. } }, save: { defaults: function defaults() {
  11020. S.save.defaultText(), S.save.placeholderText(), S.save.defaultValue();
  11021. }, defaultValue: function defaultValue() {
  11022. var e = S.get.value();S.verbose("Saving default value as", e), M.data(E.defaultValue, e);
  11023. }, defaultText: function defaultText() {
  11024. var e = S.get.text();S.verbose("Saving default text as", e), M.data(E.defaultText, e);
  11025. }, placeholderText: function placeholderText() {
  11026. var e;!1 !== k.placeholder && V.hasClass(T.placeholder) && (e = S.get.text(), S.verbose("Saving placeholder text as", e), M.data(E.placeholderText, e));
  11027. }, remoteData: function remoteData(e, n) {
  11028. t.Storage !== i ? (S.verbose("Saving remote data to session storage", n, e), sessionStorage.setItem(n, e)) : S.error(q.noStorage);
  11029. } }, clear: function clear() {
  11030. S.is.multiple() && k.useLabels ? S.remove.labels() : (S.remove.activeItem(), S.remove.selectedItem()), S.set.placeholderText(), S.clearValue();
  11031. }, clearValue: function clearValue() {
  11032. S.set.value("");
  11033. }, scrollPage: function scrollPage(e, t) {
  11034. var n,
  11035. i,
  11036. o = t || S.get.selectedItem(),
  11037. a = o.closest(D.menu),
  11038. r = a.outerHeight(),
  11039. s = a.scrollTop(),
  11040. l = X.eq(0).outerHeight(),
  11041. c = Math.floor(r / l),
  11042. u = (a.prop("scrollHeight"), "up" == e ? s - l * c : s + l * c),
  11043. d = X.not(D.unselectable);i = "up" == e ? d.index(o) - c : d.index(o) + c, (n = ("up" == e ? i >= 0 : i < d.length) ? d.eq(i) : "up" == e ? d.first() : d.last()).length > 0 && (S.debug("Scrolling page", e, n), o.removeClass(T.selected), n.addClass(T.selected), k.selectOnKeydown && S.is.single() && S.set.selectedItem(n), a.scrollTop(u));
  11044. }, set: { filtered: function filtered() {
  11045. var e = S.is.multiple(),
  11046. t = S.is.searchSelection(),
  11047. n = e && t,
  11048. i = t ? S.get.query() : "",
  11049. o = "string" == typeof i && i.length > 0,
  11050. a = S.get.searchWidth(),
  11051. r = "" !== i;e && o && (S.verbose("Adjusting input width", a, k.glyphWidth), N.css("width", a)), o || n && r ? (S.verbose("Hiding placeholder text"), V.addClass(T.filtered)) : (!e || n && !r) && (S.verbose("Showing placeholder text"), V.removeClass(T.filtered));
  11052. }, empty: function empty() {
  11053. M.addClass(T.empty);
  11054. }, loading: function loading() {
  11055. M.addClass(T.loading);
  11056. }, placeholderText: function placeholderText(e) {
  11057. e = e || S.get.placeholderText(), S.debug("Setting placeholder text", e), S.set.text(e), V.addClass(T.placeholder);
  11058. }, tabbable: function tabbable() {
  11059. S.is.searchSelection() ? (S.debug("Added tabindex to searchable dropdown"), N.val("").attr("tabindex", 0), Q.attr("tabindex", -1)) : (S.debug("Added tabindex to dropdown"), M.attr("tabindex") === i && (M.attr("tabindex", 0), Q.attr("tabindex", -1)));
  11060. }, initialLoad: function initialLoad() {
  11061. S.verbose("Setting initial load"), h = !0;
  11062. }, activeItem: function activeItem(e) {
  11063. k.allowAdditions && e.filter(D.addition).length > 0 ? e.addClass(T.filtered) : e.addClass(T.active);
  11064. }, partialSearch: function partialSearch(e) {
  11065. var t = S.get.query().length;N.val(e.substr(0, t));
  11066. }, scrollPosition: function scrollPosition(e, t) {
  11067. var n, o, a, r, s, l;n = (e = e || S.get.selectedItem()).closest(D.menu), o = e && e.length > 0, t = t !== i && t, e && n.length > 0 && o && (e.position().top, n.addClass(T.loading), a = (r = n.scrollTop()) - n.offset().top + e.offset().top, t || (l = r + n.height() < a + 5, s = a - 5 < r), S.debug("Scrolling to active item", a), (t || s || l) && n.scrollTop(a), n.removeClass(T.loading));
  11068. }, text: function text(e) {
  11069. "select" !== k.action && ("combo" == k.action ? (S.debug("Changing combo button text", e, B), k.preserveHTML ? B.html(e) : B.text(e)) : (e !== S.get.placeholderText() && V.removeClass(T.placeholder), S.debug("Changing text", e, V), V.removeClass(T.filtered), k.preserveHTML ? V.html(e) : V.text(e)));
  11070. }, selectedItem: function selectedItem(e) {
  11071. var t = S.get.choiceValue(e),
  11072. n = S.get.choiceText(e, !1),
  11073. i = S.get.choiceText(e, !0);S.debug("Setting user selection to item", e), S.remove.activeItem(), S.set.partialSearch(n), S.set.activeItem(e), S.set.selected(t, e), S.set.text(i);
  11074. }, selectedLetter: function selectedLetter(t) {
  11075. var n,
  11076. i = X.filter("." + T.selected),
  11077. o = !1;i.length > 0 && S.has.firstLetter(i, t) && (n = i.nextAll(X).eq(0), S.has.firstLetter(n, t) && (o = n)), o || X.each(function () {
  11078. if (S.has.firstLetter(e(this), t)) return o = e(this), !1;
  11079. }), o && (S.verbose("Scrolling to next value with letter", t), S.set.scrollPosition(o), i.removeClass(T.selected), o.addClass(T.selected), k.selectOnKeydown && S.is.single() && S.set.selectedItem(o));
  11080. }, direction: function direction(e) {
  11081. "auto" == k.direction ? (S.remove.upward(), S.can.openDownward(e) ? S.remove.upward(e) : S.set.upward(e), S.is.leftward(e) || S.can.openRightward(e) || S.set.leftward(e)) : "upward" == k.direction && S.set.upward(e);
  11082. }, upward: function upward(e) {
  11083. (e || M).addClass(T.upward);
  11084. }, leftward: function leftward(e) {
  11085. (e || Q).addClass(T.leftward);
  11086. }, value: function value(e, t, n) {
  11087. var o = S.escape.value(e),
  11088. a = U.length > 0,
  11089. r = S.get.values(),
  11090. s = e !== i ? String(e) : e;if (a) {
  11091. if (!k.allowReselection && s == r && (S.verbose("Skipping value update already same value", e, r), !S.is.initialLoad())) return;S.is.single() && S.has.selectInput() && S.can.extendSelect() && (S.debug("Adding user option", e), S.add.optionValue(e)), S.debug("Updating input value", o, r), Z = !0, U.val(o), !1 === k.fireOnInit && S.is.initialLoad() ? S.debug("Input native change event ignored on initial load") : S.trigger.change(), Z = !1;
  11092. } else S.verbose("Storing value in metadata", o, U), o !== r && M.data(E.value, s);!1 === k.fireOnInit && S.is.initialLoad() ? S.verbose("No callback on initial load", k.onChange) : k.onChange.call(K, e, t, n);
  11093. }, active: function active() {
  11094. M.addClass(T.active);
  11095. }, multiple: function multiple() {
  11096. M.addClass(T.multiple);
  11097. }, visible: function visible() {
  11098. M.addClass(T.visible);
  11099. }, exactly: function exactly(e, t) {
  11100. S.debug("Setting selected to exact values"), S.clear(), S.set.selected(e, t);
  11101. }, selected: function selected(t, n) {
  11102. var i = S.is.multiple();(n = k.allowAdditions ? n || S.get.itemWithAdditions(t) : n || S.get.item(t)) && (S.debug("Setting selected menu item to", n), S.is.multiple() && S.remove.searchWidth(), S.is.single() ? (S.remove.activeItem(), S.remove.selectedItem()) : k.useLabels && S.remove.selectedItem(), n.each(function () {
  11103. var t = e(this),
  11104. o = S.get.choiceText(t),
  11105. a = S.get.choiceValue(t, o),
  11106. r = t.hasClass(T.filtered),
  11107. s = t.hasClass(T.active),
  11108. l = t.hasClass(T.addition),
  11109. c = i && 1 == n.length;i ? !s || l ? (k.apiSettings && k.saveRemoteData && S.save.remoteData(o, a), k.useLabels ? (S.add.label(a, o, c), S.add.value(a, o, t), S.set.activeItem(t), S.filterActive(), S.select.nextAvailable(n)) : (S.add.value(a, o, t), S.set.text(S.add.variables(A.count)), S.set.activeItem(t))) : r || (S.debug("Selected active value, removing label"), S.remove.selected(a)) : (k.apiSettings && k.saveRemoteData && S.save.remoteData(o, a), S.set.text(o), S.set.value(a, o, t), t.addClass(T.active).addClass(T.selected));
  11110. }));
  11111. } }, add: { label: function label(t, n, i) {
  11112. var o,
  11113. a = S.is.searchSelection() ? N : V,
  11114. r = S.escape.value(t);k.ignoreCase && (r = r.toLowerCase()), o = e("<a />").addClass(T.label).attr("data-" + E.value, r).html(j.label(r, n)), o = k.onLabelCreate.call(o, r, n), S.has.label(t) ? S.debug("User selection already exists, skipping", r) : (k.label.variation && o.addClass(k.label.variation), !0 === i ? (S.debug("Animating in label", o), o.addClass(T.hidden).insertBefore(a).transition(k.label.transition, k.label.duration)) : (S.debug("Adding selection label", o), o.insertBefore(a)));
  11115. }, message: function message(t) {
  11116. var n = Q.children(D.message),
  11117. i = k.templates.message(S.add.variables(t));n.length > 0 ? n.html(i) : n = e("<div/>").html(i).addClass(T.message).appendTo(Q);
  11118. }, optionValue: function optionValue(t) {
  11119. var n = S.escape.value(t);U.find('option[value="' + S.escape.string(n) + '"]').length > 0 || (S.disconnect.selectObserver(), S.is.single() && (S.verbose("Removing previous user addition"), U.find("option." + T.addition).remove()), e("<option/>").prop("value", n).addClass(T.addition).html(t).appendTo(U), S.verbose("Adding user addition as an <option>", t), S.observe.select());
  11120. }, userSuggestion: function userSuggestion(e) {
  11121. var t,
  11122. n = Q.children(D.addition),
  11123. i = S.get.item(e),
  11124. o = i && i.not(D.addition).length,
  11125. a = n.length > 0;k.useLabels && S.has.maxSelections() || ("" === e || o ? n.remove() : (a ? (n.data(E.value, e).data(E.text, e).attr("data-" + E.value, e).attr("data-" + E.text, e).removeClass(T.filtered), k.hideAdditions || (t = k.templates.addition(S.add.variables(A.addResult, e)), n.html(t)), S.verbose("Replacing user suggestion with new value", n)) : ((n = S.create.userChoice(e)).prependTo(Q), S.verbose("Adding item choice to menu corresponding with user choice addition", n)), k.hideAdditions && !S.is.allFiltered() || n.addClass(T.selected).siblings().removeClass(T.selected), S.refreshItems()));
  11126. }, variables: function variables(e, t) {
  11127. var n,
  11128. i,
  11129. o = -1 !== e.search("{count}"),
  11130. a = -1 !== e.search("{maxCount}"),
  11131. r = -1 !== e.search("{term}");return S.verbose("Adding templated variables to message", e), o && (n = S.get.selectionCount(), e = e.replace("{count}", n)), a && (n = S.get.selectionCount(), e = e.replace("{maxCount}", k.maxSelections)), r && (i = t || S.get.query(), e = e.replace("{term}", i)), e;
  11132. }, value: function value(t, n, i) {
  11133. var o,
  11134. a = S.get.values();S.has.value(t) ? S.debug("Value already selected") : "" !== t ? (e.isArray(a) ? (o = a.concat([t]), o = S.get.uniqueArray(o)) : o = [t], S.has.selectInput() ? S.can.extendSelect() && (S.debug("Adding value to select", t, o, U), S.add.optionValue(t)) : (o = o.join(k.delimiter), S.debug("Setting hidden input to delimited value", o, U)), !1 === k.fireOnInit && S.is.initialLoad() ? S.verbose("Skipping onadd callback on initial load", k.onAdd) : k.onAdd.call(K, t, n, i), S.set.value(o, t, n, i), S.check.maxSelections()) : S.debug("Cannot select blank values from multiselect");
  11135. } }, remove: { active: function active() {
  11136. M.removeClass(T.active);
  11137. }, activeLabel: function activeLabel() {
  11138. M.find(D.label).removeClass(T.active);
  11139. }, empty: function empty() {
  11140. M.removeClass(T.empty);
  11141. }, loading: function loading() {
  11142. M.removeClass(T.loading);
  11143. }, initialLoad: function initialLoad() {
  11144. h = !1;
  11145. }, upward: function upward(e) {
  11146. (e || M).removeClass(T.upward);
  11147. }, leftward: function leftward(e) {
  11148. (e || Q).removeClass(T.leftward);
  11149. }, visible: function visible() {
  11150. M.removeClass(T.visible);
  11151. }, activeItem: function activeItem() {
  11152. X.removeClass(T.active);
  11153. }, filteredItem: function filteredItem() {
  11154. k.useLabels && S.has.maxSelections() || (k.useLabels && S.is.multiple() ? X.not("." + T.active).removeClass(T.filtered) : X.removeClass(T.filtered), S.remove.empty());
  11155. }, optionValue: function optionValue(e) {
  11156. var t = S.escape.value(e),
  11157. n = U.find('option[value="' + S.escape.string(t) + '"]');n.length > 0 && n.hasClass(T.addition) && (C && (C.disconnect(), S.verbose("Temporarily disconnecting mutation observer")), n.remove(), S.verbose("Removing user addition as an <option>", t), C && C.observe(U[0], { childList: !0, subtree: !0 }));
  11158. }, message: function message() {
  11159. Q.children(D.message).remove();
  11160. }, searchWidth: function searchWidth() {
  11161. N.css("width", "");
  11162. }, searchTerm: function searchTerm() {
  11163. S.verbose("Cleared search term"), N.val(""), S.set.filtered();
  11164. }, userAddition: function userAddition() {
  11165. X.filter(D.addition).remove();
  11166. }, selected: function selected(t, n) {
  11167. if (!(n = k.allowAdditions ? n || S.get.itemWithAdditions(t) : n || S.get.item(t))) return !1;n.each(function () {
  11168. var t = e(this),
  11169. n = S.get.choiceText(t),
  11170. i = S.get.choiceValue(t, n);S.is.multiple() ? k.useLabels ? (S.remove.value(i, n, t), S.remove.label(i)) : (S.remove.value(i, n, t), 0 === S.get.selectionCount() ? S.set.placeholderText() : S.set.text(S.add.variables(A.count))) : S.remove.value(i, n, t), t.removeClass(T.filtered).removeClass(T.active), k.useLabels && t.removeClass(T.selected);
  11171. });
  11172. }, selectedItem: function selectedItem() {
  11173. X.removeClass(T.selected);
  11174. }, value: function value(e, t, n) {
  11175. var i,
  11176. o = S.get.values();S.has.selectInput() ? (S.verbose("Input is <select> removing selected option", e), i = S.remove.arrayValue(e, o), S.remove.optionValue(e)) : (S.verbose("Removing from delimited values", e), i = (i = S.remove.arrayValue(e, o)).join(k.delimiter)), !1 === k.fireOnInit && S.is.initialLoad() ? S.verbose("No callback on initial load", k.onRemove) : k.onRemove.call(K, e, t, n), S.set.value(i, t, n), S.check.maxSelections();
  11177. }, arrayValue: function arrayValue(t, n) {
  11178. return e.isArray(n) || (n = [n]), n = e.grep(n, function (e) {
  11179. return t != e;
  11180. }), S.verbose("Removed value from delimited string", t, n), n;
  11181. }, label: function label(e, t) {
  11182. var n = M.find(D.label).filter("[data-" + E.value + '="' + S.escape.string(e) + '"]');S.verbose("Removing label", n), n.remove();
  11183. }, activeLabels: function activeLabels(e) {
  11184. e = e || M.find(D.label).filter("." + T.active), S.verbose("Removing active label selections", e), S.remove.labels(e);
  11185. }, labels: function labels(t) {
  11186. t = t || M.find(D.label), S.verbose("Removing labels", t), t.each(function () {
  11187. var t = e(this),
  11188. n = t.data(E.value),
  11189. o = n !== i ? String(n) : n,
  11190. a = S.is.userValue(o);!1 !== k.onLabelRemove.call(t, n) ? (S.remove.message(), a ? (S.remove.value(o), S.remove.label(o)) : S.remove.selected(o)) : S.debug("Label remove callback cancelled removal");
  11191. });
  11192. }, tabbable: function tabbable() {
  11193. S.is.searchSelection() ? (S.debug("Searchable dropdown initialized"), N.removeAttr("tabindex"), Q.removeAttr("tabindex")) : (S.debug("Simple selection dropdown initialized"), M.removeAttr("tabindex"), Q.removeAttr("tabindex"));
  11194. } }, has: { menuSearch: function menuSearch() {
  11195. return S.has.search() && N.closest(Q).length > 0;
  11196. }, search: function search() {
  11197. return N.length > 0;
  11198. }, sizer: function sizer() {
  11199. return H.length > 0;
  11200. }, selectInput: function selectInput() {
  11201. return U.is("select");
  11202. }, minCharacters: function minCharacters(e) {
  11203. return !k.minCharacters || (e = e !== i ? String(e) : String(S.get.query())).length >= k.minCharacters;
  11204. }, firstLetter: function firstLetter(e, t) {
  11205. var n;return !(!e || 0 === e.length || "string" != typeof t) && (n = S.get.choiceText(e, !1), (t = t.toLowerCase()) == String(n).charAt(0).toLowerCase());
  11206. }, input: function input() {
  11207. return U.length > 0;
  11208. }, items: function items() {
  11209. return X.length > 0;
  11210. }, menu: function menu() {
  11211. return Q.length > 0;
  11212. }, message: function message() {
  11213. return 0 !== Q.children(D.message).length;
  11214. }, label: function label(e) {
  11215. var t = S.escape.value(e),
  11216. n = M.find(D.label);return k.ignoreCase && (t = t.toLowerCase()), n.filter("[data-" + E.value + '="' + S.escape.string(t) + '"]').length > 0;
  11217. }, maxSelections: function maxSelections() {
  11218. return k.maxSelections && S.get.selectionCount() >= k.maxSelections;
  11219. }, allResultsFiltered: function allResultsFiltered() {
  11220. var e = X.not(D.addition);return e.filter(D.unselectable).length === e.length;
  11221. }, userSuggestion: function userSuggestion() {
  11222. return Q.children(D.addition).length > 0;
  11223. }, query: function query() {
  11224. return "" !== S.get.query();
  11225. }, value: function value(e) {
  11226. return k.ignoreCase ? S.has.valueIgnoringCase(e) : S.has.valueMatchingCase(e);
  11227. }, valueMatchingCase: function valueMatchingCase(t) {
  11228. var n = S.get.values();return !!(e.isArray(n) ? n && -1 !== e.inArray(t, n) : n == t);
  11229. }, valueIgnoringCase: function valueIgnoringCase(t) {
  11230. var n = S.get.values(),
  11231. i = !1;return e.isArray(n) || (n = [n]), e.each(n, function (e, n) {
  11232. if (String(t).toLowerCase() == String(n).toLowerCase()) return i = !0, !1;
  11233. }), i;
  11234. } }, is: { active: function active() {
  11235. return M.hasClass(T.active);
  11236. }, animatingInward: function animatingInward() {
  11237. return Q.transition("is inward");
  11238. }, animatingOutward: function animatingOutward() {
  11239. return Q.transition("is outward");
  11240. }, bubbledLabelClick: function bubbledLabelClick(t) {
  11241. return e(t.target).is("select, input") && M.closest("label").length > 0;
  11242. }, bubbledIconClick: function bubbledIconClick(t) {
  11243. return e(t.target).closest(W).length > 0;
  11244. }, alreadySetup: function alreadySetup() {
  11245. return M.is("select") && M.parent(D.dropdown).data(I) !== i && 0 === M.prev().length;
  11246. }, animating: function animating(e) {
  11247. return e ? e.transition && e.transition("is animating") : Q.transition && Q.transition("is animating");
  11248. }, leftward: function leftward(e) {
  11249. return (e || Q).hasClass(T.leftward);
  11250. }, disabled: function disabled() {
  11251. return M.hasClass(T.disabled);
  11252. }, focused: function focused() {
  11253. return n.activeElement === M[0];
  11254. }, focusedOnSearch: function focusedOnSearch() {
  11255. return n.activeElement === N[0];
  11256. }, allFiltered: function allFiltered() {
  11257. return (S.is.multiple() || S.has.search()) && !(0 == k.hideAdditions && S.has.userSuggestion()) && !S.has.message() && S.has.allResultsFiltered();
  11258. }, hidden: function hidden(e) {
  11259. return !S.is.visible(e);
  11260. }, initialLoad: function initialLoad() {
  11261. return h;
  11262. }, inObject: function inObject(t, n) {
  11263. var i = !1;return e.each(n, function (e, n) {
  11264. if (n == t) return i = !0, !0;
  11265. }), i;
  11266. }, multiple: function multiple() {
  11267. return M.hasClass(T.multiple);
  11268. }, remote: function remote() {
  11269. return k.apiSettings && S.can.useAPI();
  11270. }, single: function single() {
  11271. return !S.is.multiple();
  11272. }, selectMutation: function selectMutation(t) {
  11273. var n = !1;return e.each(t, function (t, i) {
  11274. if (i.target && e(i.target).is("select")) return n = !0, !0;
  11275. }), n;
  11276. }, search: function search() {
  11277. return M.hasClass(T.search);
  11278. }, searchSelection: function searchSelection() {
  11279. return S.has.search() && 1 === N.parent(D.dropdown).length;
  11280. }, selection: function selection() {
  11281. return M.hasClass(T.selection);
  11282. }, userValue: function userValue(t) {
  11283. return -1 !== e.inArray(t, S.get.userValues());
  11284. }, upward: function upward(e) {
  11285. return (e || M).hasClass(T.upward);
  11286. }, visible: function visible(e) {
  11287. return e ? e.hasClass(T.visible) : Q.hasClass(T.visible);
  11288. }, verticallyScrollableContext: function verticallyScrollableContext() {
  11289. var e = L.get(0) !== t && L.css("overflow-y");return "auto" == e || "scroll" == e;
  11290. }, horizontallyScrollableContext: function horizontallyScrollableContext() {
  11291. var e = L.get(0) !== t && L.css("overflow-X");return "auto" == e || "scroll" == e;
  11292. } }, can: { activate: function activate(e) {
  11293. return !!k.useLabels || !S.has.maxSelections() || !(!S.has.maxSelections() || !e.hasClass(T.active));
  11294. }, openDownward: function openDownward(e) {
  11295. var n,
  11296. i,
  11297. o = e || Q,
  11298. a = !0;return o.addClass(T.loading), i = { context: { offset: L.get(0) === t ? { top: 0, left: 0 } : L.offset(), scrollTop: L.scrollTop(), height: L.outerHeight() }, menu: { offset: o.offset(), height: o.outerHeight() } }, S.is.verticallyScrollableContext() && (i.menu.offset.top += i.context.scrollTop), (n = { above: i.context.scrollTop <= i.menu.offset.top - i.context.offset.top - i.menu.height, below: i.context.scrollTop + i.context.height >= i.menu.offset.top - i.context.offset.top + i.menu.height }).below ? (S.verbose("Dropdown can fit in context downward", n), a = !0) : n.below || n.above ? (S.verbose("Dropdown cannot fit below, opening upward", n), a = !1) : (S.verbose("Dropdown cannot fit in either direction, favoring downward", n), a = !0), o.removeClass(T.loading), a;
  11299. }, openRightward: function openRightward(e) {
  11300. var n,
  11301. i,
  11302. o = e || Q,
  11303. a = !0;return o.addClass(T.loading), i = { context: { offset: L.get(0) === t ? { top: 0, left: 0 } : L.offset(), scrollLeft: L.scrollLeft(), width: L.outerWidth() }, menu: { offset: o.offset(), width: o.outerWidth() } }, S.is.horizontallyScrollableContext() && (i.menu.offset.left += i.context.scrollLeft), (n = i.menu.offset.left - i.context.offset.left + i.menu.width >= i.context.scrollLeft + i.context.width) && (S.verbose("Dropdown cannot fit in context rightward", n), a = !1), o.removeClass(T.loading), a;
  11304. }, click: function click() {
  11305. return c || "click" == k.on;
  11306. }, extendSelect: function extendSelect() {
  11307. return k.allowAdditions || k.apiSettings;
  11308. }, show: function show() {
  11309. return !S.is.disabled() && (S.has.items() || S.has.message());
  11310. }, useAPI: function useAPI() {
  11311. return e.fn.api !== i;
  11312. } }, animate: { show: function show(t, n) {
  11313. var o,
  11314. a = n || Q,
  11315. r = n ? function () {} : function () {
  11316. S.hideSubMenus(), S.hideOthers(), S.set.active();
  11317. };t = e.isFunction(t) ? t : function () {}, S.verbose("Doing menu show animation", a), S.set.direction(n), o = S.get.transition(n), S.is.selection() && S.set.scrollPosition(S.get.selectedItem(), !0), (S.is.hidden(a) || S.is.animating(a)) && ("none" == o ? (r(), a.transition("show"), t.call(K)) : e.fn.transition !== i && M.transition("is supported") ? a.transition({ animation: o + " in", debug: k.debug, verbose: k.verbose, duration: k.duration, queue: !0, onStart: r, onComplete: function onComplete() {
  11318. t.call(K);
  11319. } }) : S.error(q.noTransition, o));
  11320. }, hide: function hide(t, n) {
  11321. var o = n || Q,
  11322. a = (n ? k.duration : k.duration, n ? function () {} : function () {
  11323. S.can.click() && S.unbind.intent(), S.remove.active();
  11324. }),
  11325. r = S.get.transition(n);t = e.isFunction(t) ? t : function () {}, (S.is.visible(o) || S.is.animating(o)) && (S.verbose("Doing menu hide animation", o), "none" == r ? (a(), o.transition("hide"), t.call(K)) : e.fn.transition !== i && M.transition("is supported") ? o.transition({ animation: r + " out", duration: k.duration, debug: k.debug, verbose: k.verbose, queue: !1, onStart: a, onComplete: function onComplete() {
  11326. t.call(K);
  11327. } }) : S.error(q.transition));
  11328. } }, hideAndClear: function hideAndClear() {
  11329. S.remove.searchTerm(), S.has.maxSelections() || (S.has.search() ? S.hide(function () {
  11330. S.remove.filteredItem();
  11331. }) : S.hide());
  11332. }, delay: { show: function show() {
  11333. S.verbose("Delaying show event to ensure user intent"), clearTimeout(S.timer), S.timer = setTimeout(S.show, k.delay.show);
  11334. }, hide: function hide() {
  11335. S.verbose("Delaying hide event to ensure user intent"), clearTimeout(S.timer), S.timer = setTimeout(S.hide, k.delay.hide);
  11336. } }, escape: { value: function value(t) {
  11337. var n = e.isArray(t),
  11338. i = "string" == typeof t,
  11339. o = !i && !n,
  11340. a = i && -1 !== t.search(O.quote),
  11341. r = [];return o || !a ? t : (S.debug("Encoding quote values for use in select", t), n ? (e.each(t, function (e, t) {
  11342. r.push(t.replace(O.quote, "&quot;"));
  11343. }), r) : t.replace(O.quote, "&quot;"));
  11344. }, string: function string(e) {
  11345. return (e = String(e)).replace(O.escape, "\\$&");
  11346. } }, setting: function setting(t, n) {
  11347. if (S.debug("Changing setting", t, n), e.isPlainObject(t)) e.extend(!0, k, t);else {
  11348. if (n === i) return k[t];e.isPlainObject(k[t]) ? e.extend(!0, k[t], n) : k[t] = n;
  11349. }
  11350. }, internal: function internal(t, n) {
  11351. if (e.isPlainObject(t)) e.extend(!0, S, t);else {
  11352. if (n === i) return S[t];S[t] = n;
  11353. }
  11354. }, debug: function debug() {
  11355. !k.silent && k.debug && (k.performance ? S.performance.log(arguments) : (S.debug = Function.prototype.bind.call(console.info, console, k.name + ":"), S.debug.apply(console, arguments)));
  11356. }, verbose: function verbose() {
  11357. !k.silent && k.verbose && k.debug && (k.performance ? S.performance.log(arguments) : (S.verbose = Function.prototype.bind.call(console.info, console, k.name + ":"), S.verbose.apply(console, arguments)));
  11358. }, error: function error() {
  11359. k.silent || (S.error = Function.prototype.bind.call(console.error, console, k.name + ":"), S.error.apply(console, arguments));
  11360. }, performance: { log: function log(e) {
  11361. var t, n;k.performance && (n = (t = new Date().getTime()) - (u || t), u = t, d.push({ Name: e[0], Arguments: [].slice.call(e, 1) || "", Element: K, "Execution Time": n })), clearTimeout(S.performance.timer), S.performance.timer = setTimeout(S.performance.display, 500);
  11362. }, display: function display() {
  11363. var t = k.name + ":",
  11364. n = 0;u = !1, clearTimeout(S.performance.timer), e.each(d, function (e, t) {
  11365. n += t["Execution Time"];
  11366. }), t += " " + n + "ms", l && (t += " '" + l + "'"), (console.group !== i || console.table !== i) && d.length > 0 && (console.groupCollapsed(t), console.table ? console.table(d) : e.each(d, function (e, t) {
  11367. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  11368. }), console.groupEnd()), d = [];
  11369. } }, invoke: function invoke(t, n, o) {
  11370. var r,
  11371. s,
  11372. l,
  11373. c = J;return n = n || g, o = K || o, "string" == typeof t && c !== i && (t = t.split(/[\. ]/), r = t.length - 1, e.each(t, function (n, o) {
  11374. var a = n != r ? o + t[n + 1].charAt(0).toUpperCase() + t[n + 1].slice(1) : t;if (e.isPlainObject(c[a]) && n != r) c = c[a];else {
  11375. if (c[a] !== i) return s = c[a], !1;if (!e.isPlainObject(c[o]) || n == r) return c[o] !== i ? (s = c[o], !1) : (S.error(q.method, t), !1);c = c[o];
  11376. }
  11377. })), e.isFunction(s) ? l = s.apply(o, n) : s !== i && (l = s), e.isArray(a) ? a.push(l) : a !== i ? a = [a, l] : l !== i && (a = l), s;
  11378. } }, m ? (J === i && S.initialize(), S.invoke(f)) : (J !== i && J.invoke("destroy"), S.initialize());
  11379. }), a !== i ? a : r;
  11380. }, e.fn.dropdown.settings = { silent: !1, debug: !1, verbose: !1, performance: !0, on: "click", action: "activate", values: !1, apiSettings: !1, selectOnKeydown: !0, minCharacters: 0, filterRemoteData: !1, saveRemoteData: !0, throttle: 200, context: t, direction: "auto", keepOnScreen: !0, match: "both", fullTextSearch: !1, placeholder: "auto", preserveHTML: !0, sortSelect: !1, forceSelection: !0, allowAdditions: !1, ignoreCase: !1, hideAdditions: !0, maxSelections: !1, useLabels: !0, delimiter: ",", showOnFocus: !0, allowReselection: !1, allowTab: !0, allowCategorySelection: !1, fireOnInit: !1, transition: "auto", duration: 200, glyphWidth: 1.037, label: { transition: "scale", duration: 200, variation: !1 }, delay: { hide: 300, show: 200, search: 20, touch: 50 }, onChange: function onChange(e, t, n) {}, onAdd: function onAdd(e, t, n) {}, onRemove: function onRemove(e, t, n) {}, onLabelSelect: function onLabelSelect(e) {}, onLabelCreate: function onLabelCreate(t, n) {
  11381. return e(this);
  11382. }, onLabelRemove: function onLabelRemove(e) {
  11383. return !0;
  11384. }, onNoResults: function onNoResults(e) {
  11385. return !0;
  11386. }, onShow: function onShow() {}, onHide: function onHide() {}, name: "Dropdown", namespace: "dropdown", message: { addResult: "Add <b>{term}</b>", count: "{count} selected", maxSelections: "Max {maxCount} selections", noResults: "No results found.", serverError: "There was an error contacting the server" }, error: { action: "You called a dropdown action that was not defined", alreadySetup: "Once a select has been initialized behaviors must be called on the created ui dropdown", labels: "Allowing user additions currently requires the use of labels.", missingMultiple: "<select> requires multiple property to be set to correctly preserve multiple values", method: "The method you called is not defined.", noAPI: "The API module is required to load resources remotely", noStorage: "Saving remote data requires session storage", noTransition: "This module requires ui transitions <https://github.com/Semantic-Org/UI-Transition>" }, regExp: { escape: /[-[\]{}()*+?.,\\^$|#\s]/g, quote: /"/g }, metadata: { defaultText: "defaultText", defaultValue: "defaultValue", placeholderText: "placeholder", text: "text", value: "value" }, fields: { remoteValues: "results", values: "values", disabled: "disabled", name: "name", value: "value", text: "text" }, keys: { backspace: 8, delimiter: 188, deleteKey: 46, enter: 13, escape: 27, pageUp: 33, pageDown: 34, leftArrow: 37, upArrow: 38, rightArrow: 39, downArrow: 40 }, selector: { addition: ".addition", dropdown: ".ui.dropdown", hidden: ".hidden", icon: "> .dropdown.icon", input: '> input[type="hidden"], > select', item: ".item", label: "> .label", remove: "> .label > .delete.icon", siblingLabel: ".label", menu: ".menu", message: ".message", menuIcon: ".dropdown.icon", search: "input.search, .menu > .search > input, .menu input.search", sizer: "> input.sizer", text: "> .text:not(.icon)", unselectable: ".disabled, .filtered" }, className: { active: "active", addition: "addition", animating: "animating", disabled: "disabled", empty: "empty", dropdown: "ui dropdown", filtered: "filtered", hidden: "hidden transition", item: "item", label: "ui label", loading: "loading", menu: "menu", message: "message", multiple: "multiple", placeholder: "default", sizer: "sizer", search: "search", selected: "selected", selection: "selection", upward: "upward", leftward: "left", visible: "visible" } }, e.fn.dropdown.settings.templates = { dropdown: function dropdown(t) {
  11387. var n = t.placeholder || !1,
  11388. i = (t.values, "");return i += '<i class="dropdown icon"></i>', t.placeholder ? i += '<div class="default text">' + n + "</div>" : i += '<div class="text"></div>', i += '<div class="menu">', e.each(t.values, function (e, t) {
  11389. i += t.disabled ? '<div class="disabled item" data-value="' + t.value + '">' + t.name + "</div>" : '<div class="item" data-value="' + t.value + '">' + t.name + "</div>";
  11390. }), i += "</div>";
  11391. }, menu: function menu(t, n) {
  11392. var i = t[n.values] || {},
  11393. o = "";return e.each(i, function (e, t) {
  11394. var i = t[n.text] ? 'data-text="' + t[n.text] + '"' : "",
  11395. a = t[n.disabled] ? "disabled " : "";o += '<div class="' + a + 'item" data-value="' + t[n.value] + '"' + i + ">", o += t[n.name], o += "</div>";
  11396. }), o;
  11397. }, label: function label(e, t) {
  11398. return t + '<i class="delete icon"></i>';
  11399. }, message: function message(e) {
  11400. return e;
  11401. }, addition: function addition(e) {
  11402. return e;
  11403. } };
  11404. }(jQuery, window, document), function (e, t, n, i) {
  11405. "use strict";
  11406. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.embed = function (n) {
  11407. var o,
  11408. a = e(this),
  11409. r = a.selector || "",
  11410. s = new Date().getTime(),
  11411. l = [],
  11412. c = arguments[0],
  11413. u = "string" == typeof c,
  11414. d = [].slice.call(arguments, 1);return a.each(function () {
  11415. var f,
  11416. m = e.isPlainObject(n) ? e.extend(!0, {}, e.fn.embed.settings, n) : e.extend({}, e.fn.embed.settings),
  11417. g = m.selector,
  11418. p = m.className,
  11419. h = m.sources,
  11420. v = m.error,
  11421. b = m.metadata,
  11422. y = m.namespace,
  11423. x = m.templates,
  11424. C = "." + y,
  11425. w = "module-" + y,
  11426. S = (e(t), e(this)),
  11427. k = (S.find(g.placeholder), S.find(g.icon), S.find(g.embed)),
  11428. T = this,
  11429. A = S.data(w);f = { initialize: function initialize() {
  11430. f.debug("Initializing embed"), f.determine.autoplay(), f.create(), f.bind.events(), f.instantiate();
  11431. }, instantiate: function instantiate() {
  11432. f.verbose("Storing instance of module", f), A = f, S.data(w, f);
  11433. }, destroy: function destroy() {
  11434. f.verbose("Destroying previous instance of embed"), f.reset(), S.removeData(w).off(C);
  11435. }, refresh: function refresh() {
  11436. f.verbose("Refreshing selector cache"), S.find(g.placeholder), S.find(g.icon), k = S.find(g.embed);
  11437. }, bind: { events: function events() {
  11438. f.has.placeholder() && (f.debug("Adding placeholder events"), S.on("click" + C, g.placeholder, f.createAndShow).on("click" + C, g.icon, f.createAndShow));
  11439. } }, create: function create() {
  11440. f.get.placeholder() ? f.createPlaceholder() : f.createAndShow();
  11441. }, createPlaceholder: function createPlaceholder(e) {
  11442. var t = f.get.icon(),
  11443. n = f.get.url();f.generate.embed(n);e = e || f.get.placeholder(), S.html(x.placeholder(e, t)), f.debug("Creating placeholder for embed", e, t);
  11444. }, createEmbed: function createEmbed(t) {
  11445. f.refresh(), t = t || f.get.url(), k = e("<div/>").addClass(p.embed).html(f.generate.embed(t)).appendTo(S), m.onCreate.call(T, t), f.debug("Creating embed object", k);
  11446. }, changeEmbed: function changeEmbed(e) {
  11447. k.html(f.generate.embed(e));
  11448. }, createAndShow: function createAndShow() {
  11449. f.createEmbed(), f.show();
  11450. }, change: function change(e, t, n) {
  11451. f.debug("Changing video to ", e, t, n), S.data(b.source, e).data(b.id, t), n ? S.data(b.url, n) : S.removeData(b.url), f.has.embed() ? f.changeEmbed() : f.create();
  11452. }, reset: function reset() {
  11453. f.debug("Clearing embed and showing placeholder"), f.remove.active(), f.remove.embed(), f.showPlaceholder(), m.onReset.call(T);
  11454. }, show: function show() {
  11455. f.debug("Showing embed"), f.set.active(), m.onDisplay.call(T);
  11456. }, hide: function hide() {
  11457. f.debug("Hiding embed"), f.showPlaceholder();
  11458. }, showPlaceholder: function showPlaceholder() {
  11459. f.debug("Showing placeholder image"), f.remove.active(), m.onPlaceholderDisplay.call(T);
  11460. }, get: { id: function id() {
  11461. return m.id || S.data(b.id);
  11462. }, placeholder: function placeholder() {
  11463. return m.placeholder || S.data(b.placeholder);
  11464. }, icon: function icon() {
  11465. return m.icon ? m.icon : S.data(b.icon) !== i ? S.data(b.icon) : f.determine.icon();
  11466. }, source: function source(e) {
  11467. return m.source ? m.source : S.data(b.source) !== i ? S.data(b.source) : f.determine.source();
  11468. }, type: function type() {
  11469. var e = f.get.source();return h[e] !== i && h[e].type;
  11470. }, url: function url() {
  11471. return m.url ? m.url : S.data(b.url) !== i ? S.data(b.url) : f.determine.url();
  11472. } }, determine: { autoplay: function autoplay() {
  11473. f.should.autoplay() && (m.autoplay = !0);
  11474. }, source: function source(t) {
  11475. var n = !1;return (t = t || f.get.url()) && e.each(h, function (e, i) {
  11476. if (-1 !== t.search(i.domain)) return n = e, !1;
  11477. }), n;
  11478. }, icon: function icon() {
  11479. var e = f.get.source();return h[e] !== i && h[e].icon;
  11480. }, url: function url() {
  11481. var e,
  11482. t = m.id || S.data(b.id),
  11483. n = m.source || S.data(b.source);return (e = h[n] !== i && h[n].url.replace("{id}", t)) && S.data(b.url, e), e;
  11484. } }, set: { active: function active() {
  11485. S.addClass(p.active);
  11486. } }, remove: { active: function active() {
  11487. S.removeClass(p.active);
  11488. }, embed: function embed() {
  11489. k.empty();
  11490. } }, encode: { parameters: function parameters(e) {
  11491. var t,
  11492. n = [];for (t in e) {
  11493. n.push(encodeURIComponent(t) + "=" + encodeURIComponent(e[t]));
  11494. }return n.join("&amp;");
  11495. } }, generate: { embed: function embed(e) {
  11496. f.debug("Generating embed html");var t,
  11497. n,
  11498. i = f.get.source();return (e = f.get.url(e)) ? (n = f.generate.parameters(i), t = x.iframe(e, n)) : f.error(v.noURL, S), t;
  11499. }, parameters: function parameters(t, n) {
  11500. var o = h[t] && h[t].parameters !== i ? h[t].parameters(m) : {};return (n = n || m.parameters) && (o = e.extend({}, o, n)), o = m.onEmbed(o), f.encode.parameters(o);
  11501. } }, has: { embed: function embed() {
  11502. return k.length > 0;
  11503. }, placeholder: function placeholder() {
  11504. return m.placeholder || S.data(b.placeholder);
  11505. } }, should: { autoplay: function autoplay() {
  11506. return "auto" === m.autoplay ? m.placeholder || S.data(b.placeholder) !== i : m.autoplay;
  11507. } }, is: { video: function video() {
  11508. return "video" == f.get.type();
  11509. } }, setting: function setting(t, n) {
  11510. if (f.debug("Changing setting", t, n), e.isPlainObject(t)) e.extend(!0, m, t);else {
  11511. if (n === i) return m[t];e.isPlainObject(m[t]) ? e.extend(!0, m[t], n) : m[t] = n;
  11512. }
  11513. }, internal: function internal(t, n) {
  11514. if (e.isPlainObject(t)) e.extend(!0, f, t);else {
  11515. if (n === i) return f[t];f[t] = n;
  11516. }
  11517. }, debug: function debug() {
  11518. !m.silent && m.debug && (m.performance ? f.performance.log(arguments) : (f.debug = Function.prototype.bind.call(console.info, console, m.name + ":"), f.debug.apply(console, arguments)));
  11519. }, verbose: function verbose() {
  11520. !m.silent && m.verbose && m.debug && (m.performance ? f.performance.log(arguments) : (f.verbose = Function.prototype.bind.call(console.info, console, m.name + ":"), f.verbose.apply(console, arguments)));
  11521. }, error: function error() {
  11522. m.silent || (f.error = Function.prototype.bind.call(console.error, console, m.name + ":"), f.error.apply(console, arguments));
  11523. }, performance: { log: function log(e) {
  11524. var t, n;m.performance && (n = (t = new Date().getTime()) - (s || t), s = t, l.push({ Name: e[0], Arguments: [].slice.call(e, 1) || "", Element: T, "Execution Time": n })), clearTimeout(f.performance.timer), f.performance.timer = setTimeout(f.performance.display, 500);
  11525. }, display: function display() {
  11526. var t = m.name + ":",
  11527. n = 0;s = !1, clearTimeout(f.performance.timer), e.each(l, function (e, t) {
  11528. n += t["Execution Time"];
  11529. }), t += " " + n + "ms", r && (t += " '" + r + "'"), a.length > 1 && (t += " (" + a.length + ")"), (console.group !== i || console.table !== i) && l.length > 0 && (console.groupCollapsed(t), console.table ? console.table(l) : e.each(l, function (e, t) {
  11530. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  11531. }), console.groupEnd()), l = [];
  11532. } }, invoke: function invoke(t, n, a) {
  11533. var r,
  11534. s,
  11535. l,
  11536. c = A;return n = n || d, a = T || a, "string" == typeof t && c !== i && (t = t.split(/[\. ]/), r = t.length - 1, e.each(t, function (n, o) {
  11537. var a = n != r ? o + t[n + 1].charAt(0).toUpperCase() + t[n + 1].slice(1) : t;if (e.isPlainObject(c[a]) && n != r) c = c[a];else {
  11538. if (c[a] !== i) return s = c[a], !1;if (!e.isPlainObject(c[o]) || n == r) return c[o] !== i ? (s = c[o], !1) : (f.error(v.method, t), !1);c = c[o];
  11539. }
  11540. })), e.isFunction(s) ? l = s.apply(a, n) : s !== i && (l = s), e.isArray(o) ? o.push(l) : o !== i ? o = [o, l] : l !== i && (o = l), s;
  11541. } }, u ? (A === i && f.initialize(), f.invoke(c)) : (A !== i && A.invoke("destroy"), f.initialize());
  11542. }), o !== i ? o : this;
  11543. }, e.fn.embed.settings = { name: "Embed", namespace: "embed", silent: !1, debug: !1, verbose: !1, performance: !0, icon: !1, source: !1, url: !1, id: !1, autoplay: "auto", color: "#444444", hd: !0, brandedUI: !1, parameters: !1, onDisplay: function onDisplay() {}, onPlaceholderDisplay: function onPlaceholderDisplay() {}, onReset: function onReset() {}, onCreate: function onCreate(e) {}, onEmbed: function onEmbed(e) {
  11544. return e;
  11545. }, metadata: { id: "id", icon: "icon", placeholder: "placeholder", source: "source", url: "url" }, error: { noURL: "No URL specified", method: "The method you called is not defined" }, className: { active: "active", embed: "embed" }, selector: { embed: ".embed", placeholder: ".placeholder", icon: ".icon" }, sources: { youtube: { name: "youtube", type: "video", icon: "video play", domain: "youtube.com", url: "//www.youtube.com/embed/{id}", parameters: function parameters(e) {
  11546. return { autohide: !e.brandedUI, autoplay: e.autoplay, color: e.color || i, hq: e.hd, jsapi: e.api, modestbranding: !e.brandedUI };
  11547. } }, vimeo: { name: "vimeo", type: "video", icon: "video play", domain: "vimeo.com", url: "//player.vimeo.com/video/{id}", parameters: function parameters(e) {
  11548. return { api: e.api, autoplay: e.autoplay, byline: e.brandedUI, color: e.color || i, portrait: e.brandedUI, title: e.brandedUI };
  11549. } } }, templates: { iframe: function iframe(e, t) {
  11550. var n = e;return t && (n += "?" + t), '<iframe src="' + n + '" width="100%" height="100%" frameborder="0" scrolling="no" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>';
  11551. }, placeholder: function placeholder(e, t) {
  11552. var n = "";return t && (n += '<i class="' + t + ' icon"></i>'), e && (n += '<img class="placeholder" src="' + e + '">'), n;
  11553. } }, api: !1, onPause: function onPause() {}, onPlay: function onPlay() {}, onStop: function onStop() {} };
  11554. }(jQuery, window, document), function (e, t, n, i) {
  11555. "use strict";
  11556. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.modal = function (o) {
  11557. var a,
  11558. r = e(this),
  11559. s = e(t),
  11560. l = e(n),
  11561. c = e("body"),
  11562. u = r.selector || "",
  11563. d = new Date().getTime(),
  11564. f = [],
  11565. m = arguments[0],
  11566. g = "string" == typeof m,
  11567. p = [].slice.call(arguments, 1),
  11568. h = t.requestAnimationFrame || t.mozRequestAnimationFrame || t.webkitRequestAnimationFrame || t.msRequestAnimationFrame || function (e) {
  11569. setTimeout(e, 0);
  11570. };return r.each(function () {
  11571. var r,
  11572. v,
  11573. b,
  11574. y,
  11575. x,
  11576. C,
  11577. w,
  11578. S,
  11579. k,
  11580. T = e.isPlainObject(o) ? e.extend(!0, {}, e.fn.modal.settings, o) : e.extend({}, e.fn.modal.settings),
  11581. A = T.selector,
  11582. R = T.className,
  11583. P = T.namespace,
  11584. E = T.error,
  11585. F = "." + P,
  11586. O = "module-" + P,
  11587. D = e(this),
  11588. q = e(T.context),
  11589. j = D.find(A.close),
  11590. z = this,
  11591. I = D.data(O),
  11592. M = !1;k = { initialize: function initialize() {
  11593. k.verbose("Initializing dimmer", q), k.create.id(), k.create.dimmer(), k.refreshModals(), k.bind.events(), T.observeChanges && k.observeChanges(), k.instantiate();
  11594. }, instantiate: function instantiate() {
  11595. k.verbose("Storing instance of modal"), I = k, D.data(O, I);
  11596. }, create: { dimmer: function dimmer() {
  11597. var t = { debug: T.debug, variation: !T.centered && "top aligned", dimmerName: "modals" },
  11598. n = e.extend(!0, t, T.dimmerSettings);e.fn.dimmer !== i ? (k.debug("Creating dimmer"), y = q.dimmer(n), T.detachable ? (k.verbose("Modal is detachable, moving content into dimmer"), y.dimmer("add content", D)) : k.set.undetached(), x = y.dimmer("get dimmer")) : k.error(E.dimmer);
  11599. }, id: function id() {
  11600. w = (Math.random().toString(16) + "000000000").substr(2, 8), C = "." + w, k.verbose("Creating unique id for element", w);
  11601. } }, destroy: function destroy() {
  11602. k.verbose("Destroying previous modal"), D.removeData(O).off(F), s.off(C), x.off(C), j.off(F), q.dimmer("destroy");
  11603. }, observeChanges: function observeChanges() {
  11604. "MutationObserver" in t && ((S = new MutationObserver(function (e) {
  11605. k.debug("DOM tree modified, refreshing"), k.refresh();
  11606. })).observe(z, { childList: !0, subtree: !0 }), k.debug("Setting up mutation observer", S));
  11607. }, refresh: function refresh() {
  11608. k.remove.scrolling(), k.cacheSizes(), k.set.screenHeight(), k.set.type();
  11609. }, refreshModals: function refreshModals() {
  11610. v = D.siblings(A.modal), r = v.add(D);
  11611. }, attachEvents: function attachEvents(t, n) {
  11612. var i = e(t);n = e.isFunction(k[n]) ? k[n] : k.toggle, i.length > 0 ? (k.debug("Attaching modal events to element", t, n), i.off(F).on("click" + F, n)) : k.error(E.notFound, t);
  11613. }, bind: { events: function events() {
  11614. k.verbose("Attaching events"), D.on("click" + F, A.close, k.event.close).on("click" + F, A.approve, k.event.approve).on("click" + F, A.deny, k.event.deny), s.on("resize" + C, k.event.resize);
  11615. } }, get: { id: function id() {
  11616. return (Math.random().toString(16) + "000000000").substr(2, 8);
  11617. } }, event: { approve: function approve() {
  11618. M || !1 === T.onApprove.call(z, e(this)) ? k.verbose("Approve callback returned false cancelling hide") : (M = !0, k.hide(function () {
  11619. M = !1;
  11620. }));
  11621. }, deny: function deny() {
  11622. M || !1 === T.onDeny.call(z, e(this)) ? k.verbose("Deny callback returned false cancelling hide") : (M = !0, k.hide(function () {
  11623. M = !1;
  11624. }));
  11625. }, close: function close() {
  11626. k.hide();
  11627. }, click: function click(t) {
  11628. if (T.closable) {
  11629. var i = e(t.target).closest(A.modal).length > 0,
  11630. o = e.contains(n.documentElement, t.target);!i && o && k.is.active() && (k.debug("Dimmer clicked, hiding all modals"), k.remove.clickaway(), T.allowMultiple ? k.hide() : k.hideAll());
  11631. } else k.verbose("Dimmer clicked but closable setting is disabled");
  11632. }, debounce: function debounce(e, t) {
  11633. clearTimeout(k.timer), k.timer = setTimeout(e, t);
  11634. }, keyboard: function keyboard(e) {
  11635. 27 == e.which && (T.closable ? (k.debug("Escape key pressed hiding modal"), k.hide()) : k.debug("Escape key pressed, but closable is set to false"), e.preventDefault());
  11636. }, resize: function resize() {
  11637. y.dimmer("is active") && (k.is.animating() || k.is.active()) && h(k.refresh);
  11638. } }, toggle: function toggle() {
  11639. k.is.active() || k.is.animating() ? k.hide() : k.show();
  11640. }, show: function show(t) {
  11641. t = e.isFunction(t) ? t : function () {}, k.refreshModals(), k.set.dimmerSettings(), k.showModal(t);
  11642. }, hide: function hide(t) {
  11643. t = e.isFunction(t) ? t : function () {}, k.refreshModals(), k.hideModal(t);
  11644. }, showModal: function showModal(t) {
  11645. t = e.isFunction(t) ? t : function () {}, k.is.animating() || !k.is.active() ? (k.showDimmer(), k.cacheSizes(), k.set.screenHeight(), k.set.type(), k.set.clickaway(), !T.allowMultiple && k.others.active() ? k.hideOthers(k.showModal) : (T.allowMultiple && T.detachable && D.detach().appendTo(x), T.onShow.call(z), T.transition && e.fn.transition !== i && D.transition("is supported") ? (k.debug("Showing modal with css animations"), D.transition({ debug: T.debug, animation: T.transition + " in", queue: T.queue, duration: T.duration, useFailSafe: !0, onComplete: function onComplete() {
  11646. T.onVisible.apply(z), T.keyboardShortcuts && k.add.keyboardShortcuts(), k.save.focus(), k.set.active(), T.autofocus && k.set.autofocus(), t();
  11647. } })) : k.error(E.noTransition))) : k.debug("Modal is already visible");
  11648. }, hideModal: function hideModal(t, n) {
  11649. t = e.isFunction(t) ? t : function () {}, k.debug("Hiding modal"), !1 !== T.onHide.call(z, e(this)) ? (k.is.animating() || k.is.active()) && (T.transition && e.fn.transition !== i && D.transition("is supported") ? (k.remove.active(), D.transition({ debug: T.debug, animation: T.transition + " out", queue: T.queue, duration: T.duration, useFailSafe: !0, onStart: function onStart() {
  11650. k.others.active() || n || k.hideDimmer(), T.keyboardShortcuts && k.remove.keyboardShortcuts();
  11651. }, onComplete: function onComplete() {
  11652. T.onHidden.call(z), k.restore.focus(), t();
  11653. } })) : k.error(E.noTransition)) : k.verbose("Hide callback returned false cancelling hide");
  11654. }, showDimmer: function showDimmer() {
  11655. y.dimmer("is animating") || !y.dimmer("is active") ? (k.debug("Showing dimmer"), y.dimmer("show")) : k.debug("Dimmer already visible");
  11656. }, hideDimmer: function hideDimmer() {
  11657. y.dimmer("is animating") || y.dimmer("is active") ? y.dimmer("hide", function () {
  11658. k.remove.clickaway(), k.remove.screenHeight();
  11659. }) : k.debug("Dimmer is not visible cannot hide");
  11660. }, hideAll: function hideAll(t) {
  11661. var n = r.filter("." + R.active + ", ." + R.animating);t = e.isFunction(t) ? t : function () {}, n.length > 0 && (k.debug("Hiding all visible modals"), k.hideDimmer(), n.modal("hide modal", t));
  11662. }, hideOthers: function hideOthers(t) {
  11663. var n = v.filter("." + R.active + ", ." + R.animating);t = e.isFunction(t) ? t : function () {}, n.length > 0 && (k.debug("Hiding other modals", v), n.modal("hide modal", t, !0));
  11664. }, others: { active: function active() {
  11665. return v.filter("." + R.active).length > 0;
  11666. }, animating: function animating() {
  11667. return v.filter("." + R.animating).length > 0;
  11668. } }, add: { keyboardShortcuts: function keyboardShortcuts() {
  11669. k.verbose("Adding keyboard shortcuts"), l.on("keyup" + F, k.event.keyboard);
  11670. } }, save: { focus: function focus() {
  11671. e(n.activeElement).closest(D).length > 0 || (b = e(n.activeElement).blur());
  11672. } }, restore: { focus: function focus() {
  11673. b && b.length > 0 && b.focus();
  11674. } }, remove: { active: function active() {
  11675. D.removeClass(R.active);
  11676. }, clickaway: function clickaway() {
  11677. x.off("click" + C);
  11678. }, bodyStyle: function bodyStyle() {
  11679. "" === c.attr("style") && (k.verbose("Removing style attribute"), c.removeAttr("style"));
  11680. }, screenHeight: function screenHeight() {
  11681. k.debug("Removing page height"), c.css("height", "");
  11682. }, keyboardShortcuts: function keyboardShortcuts() {
  11683. k.verbose("Removing keyboard shortcuts"), l.off("keyup" + F);
  11684. }, scrolling: function scrolling() {
  11685. y.removeClass(R.scrolling), D.removeClass(R.scrolling);
  11686. } }, cacheSizes: function cacheSizes() {
  11687. D.addClass(R.loading);var o = D.prop("scrollHeight"),
  11688. a = D.outerHeight();k.cache !== i && 0 === a || (k.cache = { pageHeight: e(n).outerHeight(), height: a + T.offset, scrollHeight: o + T.offset, contextHeight: "body" == T.context ? e(t).height() : y.height() }, k.cache.topOffset = -k.cache.height / 2), D.removeClass(R.loading), k.debug("Caching modal and container sizes", k.cache);
  11689. }, can: { fit: function fit() {
  11690. var e = k.cache.contextHeight,
  11691. t = k.cache.contextHeight / 2,
  11692. n = k.cache.topOffset,
  11693. i = k.cache.scrollHeight,
  11694. o = k.cache.height,
  11695. a = T.padding;return i > o ? t + n + i + a < e : o + 2 * a < e;
  11696. } }, is: { active: function active() {
  11697. return D.hasClass(R.active);
  11698. }, animating: function animating() {
  11699. return D.transition("is supported") ? D.transition("is animating") : D.is(":visible");
  11700. }, scrolling: function scrolling() {
  11701. return y.hasClass(R.scrolling);
  11702. }, modernBrowser: function modernBrowser() {
  11703. return !(t.ActiveXObject || "ActiveXObject" in t);
  11704. } }, set: { autofocus: function autofocus() {
  11705. var e = D.find("[tabindex], :input").filter(":visible"),
  11706. t = e.filter("[autofocus]"),
  11707. n = t.length > 0 ? t.first() : e.first();n.length > 0 && n.focus();
  11708. }, clickaway: function clickaway() {
  11709. x.on("click" + C, k.event.click);
  11710. }, dimmerSettings: function dimmerSettings() {
  11711. if (e.fn.dimmer !== i) {
  11712. var t = { debug: T.debug, dimmerName: "modals", closable: "auto", variation: !T.centered && "top aligned", duration: { show: T.duration, hide: T.duration } },
  11713. n = e.extend(!0, t, T.dimmerSettings);T.inverted ? (n.variation = n.variation !== i ? n.variation + " inverted" : "inverted", x.addClass(R.inverted)) : x.removeClass(R.inverted), T.blurring ? y.addClass(R.blurring) : y.removeClass(R.blurring), q.dimmer("setting", n);
  11714. } else k.error(E.dimmer);
  11715. }, screenHeight: function screenHeight() {
  11716. k.can.fit() ? c.css("height", "") : (k.debug("Modal is taller than page content, resizing page height"), c.css("height", k.cache.height + 2 * T.padding));
  11717. }, active: function active() {
  11718. D.addClass(R.active);
  11719. }, scrolling: function scrolling() {
  11720. y.addClass(R.scrolling), D.addClass(R.scrolling);
  11721. }, type: function type() {
  11722. k.can.fit() ? (k.verbose("Modal fits on screen"), k.others.active() || k.others.animating() || k.remove.scrolling()) : (k.verbose("Modal cannot fit on screen setting to scrolling"), k.set.scrolling());
  11723. }, undetached: function undetached() {
  11724. y.addClass(R.undetached);
  11725. } }, setting: function setting(t, n) {
  11726. if (k.debug("Changing setting", t, n), e.isPlainObject(t)) e.extend(!0, T, t);else {
  11727. if (n === i) return T[t];e.isPlainObject(T[t]) ? e.extend(!0, T[t], n) : T[t] = n;
  11728. }
  11729. }, internal: function internal(t, n) {
  11730. if (e.isPlainObject(t)) e.extend(!0, k, t);else {
  11731. if (n === i) return k[t];k[t] = n;
  11732. }
  11733. }, debug: function debug() {
  11734. !T.silent && T.debug && (T.performance ? k.performance.log(arguments) : (k.debug = Function.prototype.bind.call(console.info, console, T.name + ":"), k.debug.apply(console, arguments)));
  11735. }, verbose: function verbose() {
  11736. !T.silent && T.verbose && T.debug && (T.performance ? k.performance.log(arguments) : (k.verbose = Function.prototype.bind.call(console.info, console, T.name + ":"), k.verbose.apply(console, arguments)));
  11737. }, error: function error() {
  11738. T.silent || (k.error = Function.prototype.bind.call(console.error, console, T.name + ":"), k.error.apply(console, arguments));
  11739. }, performance: { log: function log(e) {
  11740. var t, n;T.performance && (n = (t = new Date().getTime()) - (d || t), d = t, f.push({ Name: e[0], Arguments: [].slice.call(e, 1) || "", Element: z, "Execution Time": n })), clearTimeout(k.performance.timer), k.performance.timer = setTimeout(k.performance.display, 500);
  11741. }, display: function display() {
  11742. var t = T.name + ":",
  11743. n = 0;d = !1, clearTimeout(k.performance.timer), e.each(f, function (e, t) {
  11744. n += t["Execution Time"];
  11745. }), t += " " + n + "ms", u && (t += " '" + u + "'"), (console.group !== i || console.table !== i) && f.length > 0 && (console.groupCollapsed(t), console.table ? console.table(f) : e.each(f, function (e, t) {
  11746. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  11747. }), console.groupEnd()), f = [];
  11748. } }, invoke: function invoke(t, n, o) {
  11749. var r,
  11750. s,
  11751. l,
  11752. c = I;return n = n || p, o = z || o, "string" == typeof t && c !== i && (t = t.split(/[\. ]/), r = t.length - 1, e.each(t, function (n, o) {
  11753. var a = n != r ? o + t[n + 1].charAt(0).toUpperCase() + t[n + 1].slice(1) : t;if (e.isPlainObject(c[a]) && n != r) c = c[a];else {
  11754. if (c[a] !== i) return s = c[a], !1;if (!e.isPlainObject(c[o]) || n == r) return c[o] !== i && (s = c[o], !1);c = c[o];
  11755. }
  11756. })), e.isFunction(s) ? l = s.apply(o, n) : s !== i && (l = s), e.isArray(a) ? a.push(l) : a !== i ? a = [a, l] : l !== i && (a = l), s;
  11757. } }, g ? (I === i && k.initialize(), k.invoke(m)) : (I !== i && I.invoke("destroy"), k.initialize());
  11758. }), a !== i ? a : this;
  11759. }, e.fn.modal.settings = { name: "Modal", namespace: "modal", silent: !1, debug: !1, verbose: !1, performance: !0, observeChanges: !1, allowMultiple: !1, detachable: !0, closable: !0, autofocus: !0, inverted: !1, blurring: !1, centered: !0, dimmerSettings: { closable: !1, useCSS: !0 }, keyboardShortcuts: !0, context: "body", queue: !1, duration: 500, offset: 0, transition: "scale", padding: 50, onShow: function onShow() {}, onVisible: function onVisible() {}, onHide: function onHide() {
  11760. return !0;
  11761. }, onHidden: function onHidden() {}, onApprove: function onApprove() {
  11762. return !0;
  11763. }, onDeny: function onDeny() {
  11764. return !0;
  11765. }, selector: { close: "> .close", approve: ".actions .positive, .actions .approve, .actions .ok", deny: ".actions .negative, .actions .deny, .actions .cancel", modal: ".ui.modal" }, error: { dimmer: "UI Dimmer, a required component is not included in this page", method: "The method you called is not defined.", notFound: "The element you specified could not be found" }, className: { active: "active", animating: "animating", blurring: "blurring", inverted: "inverted", loading: "loading", scrolling: "scrolling", undetached: "undetached" } };
  11766. }(jQuery, window, document), function (e, t, n, i) {
  11767. "use strict";
  11768. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.nag = function (n) {
  11769. var o,
  11770. a = e(this),
  11771. r = a.selector || "",
  11772. s = new Date().getTime(),
  11773. l = [],
  11774. c = arguments[0],
  11775. u = "string" == typeof c,
  11776. d = [].slice.call(arguments, 1);return a.each(function () {
  11777. var a,
  11778. f = e.isPlainObject(n) ? e.extend(!0, {}, e.fn.nag.settings, n) : e.extend({}, e.fn.nag.settings),
  11779. m = (f.className, f.selector),
  11780. g = f.error,
  11781. p = f.namespace,
  11782. h = "." + p,
  11783. v = p + "-module",
  11784. b = e(this),
  11785. y = (b.find(m.close), f.context ? e(f.context) : e("body")),
  11786. x = this,
  11787. C = b.data(v);t.requestAnimationFrame || t.mozRequestAnimationFrame || t.webkitRequestAnimationFrame || t.msRequestAnimationFrame;a = { initialize: function initialize() {
  11788. a.verbose("Initializing element"), b.on("click" + h, m.close, a.dismiss).data(v, a), f.detachable && b.parent()[0] !== y[0] && b.detach().prependTo(y), f.displayTime > 0 && setTimeout(a.hide, f.displayTime), a.show();
  11789. }, destroy: function destroy() {
  11790. a.verbose("Destroying instance"), b.removeData(v).off(h);
  11791. }, show: function show() {
  11792. a.should.show() && !b.is(":visible") && (a.debug("Showing nag", f.animation.show), "fade" == f.animation.show ? b.fadeIn(f.duration, f.easing) : b.slideDown(f.duration, f.easing));
  11793. }, hide: function hide() {
  11794. a.debug("Showing nag", f.animation.hide), "fade" == f.animation.show ? b.fadeIn(f.duration, f.easing) : b.slideUp(f.duration, f.easing);
  11795. }, onHide: function onHide() {
  11796. a.debug("Removing nag", f.animation.hide), b.remove(), f.onHide && f.onHide();
  11797. }, dismiss: function dismiss(e) {
  11798. f.storageMethod && a.storage.set(f.key, f.value), a.hide(), e.stopImmediatePropagation(), e.preventDefault();
  11799. }, should: { show: function show() {
  11800. return f.persist ? (a.debug("Persistent nag is set, can show nag"), !0) : a.storage.get(f.key) != f.value.toString() ? (a.debug("Stored value is not set, can show nag", a.storage.get(f.key)), !0) : (a.debug("Stored value is set, cannot show nag", a.storage.get(f.key)), !1);
  11801. } }, get: { storageOptions: function storageOptions() {
  11802. var e = {};return f.expires && (e.expires = f.expires), f.domain && (e.domain = f.domain), f.path && (e.path = f.path), e;
  11803. } }, clear: function clear() {
  11804. a.storage.remove(f.key);
  11805. }, storage: { set: function set(n, o) {
  11806. var r = a.get.storageOptions();if ("localstorage" == f.storageMethod && t.localStorage !== i) t.localStorage.setItem(n, o), a.debug("Value stored using local storage", n, o);else if ("sessionstorage" == f.storageMethod && t.sessionStorage !== i) t.sessionStorage.setItem(n, o), a.debug("Value stored using session storage", n, o);else {
  11807. if (e.cookie === i) return void a.error(g.noCookieStorage);e.cookie(n, o, r), a.debug("Value stored using cookie", n, o, r);
  11808. }
  11809. }, get: function get(n, o) {
  11810. var r;return "localstorage" == f.storageMethod && t.localStorage !== i ? r = t.localStorage.getItem(n) : "sessionstorage" == f.storageMethod && t.sessionStorage !== i ? r = t.sessionStorage.getItem(n) : e.cookie !== i ? r = e.cookie(n) : a.error(g.noCookieStorage), "undefined" != r && "null" != r && r !== i && null !== r || (r = i), r;
  11811. }, remove: function remove(n) {
  11812. var o = a.get.storageOptions();"localstorage" == f.storageMethod && t.localStorage !== i ? t.localStorage.removeItem(n) : "sessionstorage" == f.storageMethod && t.sessionStorage !== i ? t.sessionStorage.removeItem(n) : e.cookie !== i ? e.removeCookie(n, o) : a.error(g.noStorage);
  11813. } }, setting: function setting(t, n) {
  11814. if (a.debug("Changing setting", t, n), e.isPlainObject(t)) e.extend(!0, f, t);else {
  11815. if (n === i) return f[t];e.isPlainObject(f[t]) ? e.extend(!0, f[t], n) : f[t] = n;
  11816. }
  11817. }, internal: function internal(t, n) {
  11818. if (e.isPlainObject(t)) e.extend(!0, a, t);else {
  11819. if (n === i) return a[t];a[t] = n;
  11820. }
  11821. }, debug: function debug() {
  11822. !f.silent && f.debug && (f.performance ? a.performance.log(arguments) : (a.debug = Function.prototype.bind.call(console.info, console, f.name + ":"), a.debug.apply(console, arguments)));
  11823. }, verbose: function verbose() {
  11824. !f.silent && f.verbose && f.debug && (f.performance ? a.performance.log(arguments) : (a.verbose = Function.prototype.bind.call(console.info, console, f.name + ":"), a.verbose.apply(console, arguments)));
  11825. }, error: function error() {
  11826. f.silent || (a.error = Function.prototype.bind.call(console.error, console, f.name + ":"), a.error.apply(console, arguments));
  11827. }, performance: { log: function log(e) {
  11828. var t, n;f.performance && (n = (t = new Date().getTime()) - (s || t), s = t, l.push({ Name: e[0], Arguments: [].slice.call(e, 1) || "", Element: x, "Execution Time": n })), clearTimeout(a.performance.timer), a.performance.timer = setTimeout(a.performance.display, 500);
  11829. }, display: function display() {
  11830. var t = f.name + ":",
  11831. n = 0;s = !1, clearTimeout(a.performance.timer), e.each(l, function (e, t) {
  11832. n += t["Execution Time"];
  11833. }), t += " " + n + "ms", r && (t += " '" + r + "'"), (console.group !== i || console.table !== i) && l.length > 0 && (console.groupCollapsed(t), console.table ? console.table(l) : e.each(l, function (e, t) {
  11834. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  11835. }), console.groupEnd()), l = [];
  11836. } }, invoke: function invoke(t, n, r) {
  11837. var s,
  11838. l,
  11839. c,
  11840. u = C;return n = n || d, r = x || r, "string" == typeof t && u !== i && (t = t.split(/[\. ]/), s = t.length - 1, e.each(t, function (n, o) {
  11841. var r = n != s ? o + t[n + 1].charAt(0).toUpperCase() + t[n + 1].slice(1) : t;if (e.isPlainObject(u[r]) && n != s) u = u[r];else {
  11842. if (u[r] !== i) return l = u[r], !1;if (!e.isPlainObject(u[o]) || n == s) return u[o] !== i ? (l = u[o], !1) : (a.error(g.method, t), !1);u = u[o];
  11843. }
  11844. })), e.isFunction(l) ? c = l.apply(r, n) : l !== i && (c = l), e.isArray(o) ? o.push(c) : o !== i ? o = [o, c] : c !== i && (o = c), l;
  11845. } }, u ? (C === i && a.initialize(), a.invoke(c)) : (C !== i && C.invoke("destroy"), a.initialize());
  11846. }), o !== i ? o : this;
  11847. }, e.fn.nag.settings = { name: "Nag", silent: !1, debug: !1, verbose: !1, performance: !0, namespace: "Nag", persist: !1, displayTime: 0, animation: { show: "slide", hide: "slide" }, context: !1, detachable: !1, expires: 30, domain: !1, path: "/", storageMethod: "cookie", key: "nag", value: "dismiss", error: { noCookieStorage: "$.cookie is not included. A storage solution is required.", noStorage: "Neither $.cookie or store is defined. A storage solution is required for storing state", method: "The method you called is not defined." }, className: { bottom: "bottom", fixed: "fixed" }, selector: { close: ".close.icon" }, speed: 500, easing: "easeOutQuad", onHide: function onHide() {} }, e.extend(e.easing, { easeOutQuad: function easeOutQuad(e, t, n, i, o) {
  11848. return -i * (t /= o) * (t - 2) + n;
  11849. } });
  11850. }(jQuery, window, document), function (e, t, n, i) {
  11851. "use strict";
  11852. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.popup = function (o) {
  11853. var a,
  11854. r = e(this),
  11855. s = e(n),
  11856. l = e(t),
  11857. c = e("body"),
  11858. u = r.selector || "",
  11859. d = new Date().getTime(),
  11860. f = [],
  11861. m = arguments[0],
  11862. g = "string" == typeof m,
  11863. p = [].slice.call(arguments, 1);return r.each(function () {
  11864. var r,
  11865. h,
  11866. v,
  11867. b,
  11868. y,
  11869. x,
  11870. C = e.isPlainObject(o) ? e.extend(!0, {}, e.fn.popup.settings, o) : e.extend({}, e.fn.popup.settings),
  11871. w = C.selector,
  11872. S = C.className,
  11873. k = C.error,
  11874. T = C.metadata,
  11875. A = C.namespace,
  11876. R = "." + C.namespace,
  11877. P = "module-" + A,
  11878. E = e(this),
  11879. F = e(C.context),
  11880. O = e(C.scrollContext),
  11881. D = e(C.boundary),
  11882. q = C.target ? e(C.target) : E,
  11883. j = 0,
  11884. z = !1,
  11885. I = !1,
  11886. M = this,
  11887. L = E.data(P);x = { initialize: function initialize() {
  11888. x.debug("Initializing", E), x.createID(), x.bind.events(), !x.exists() && C.preserve && x.create(), C.observeChanges && x.observeChanges(), x.instantiate();
  11889. }, instantiate: function instantiate() {
  11890. x.verbose("Storing instance", x), L = x, E.data(P, L);
  11891. }, observeChanges: function observeChanges() {
  11892. "MutationObserver" in t && ((v = new MutationObserver(x.event.documentChanged)).observe(n, { childList: !0, subtree: !0 }), x.debug("Setting up mutation observer", v));
  11893. }, refresh: function refresh() {
  11894. C.popup ? r = e(C.popup).eq(0) : C.inline && (r = q.nextAll(w.popup).eq(0), C.popup = r), C.popup ? (r.addClass(S.loading), h = x.get.offsetParent(), r.removeClass(S.loading), C.movePopup && x.has.popup() && x.get.offsetParent(r)[0] !== h[0] && (x.debug("Moving popup to the same offset parent as target"), r.detach().appendTo(h))) : h = C.inline ? x.get.offsetParent(q) : x.has.popup() ? x.get.offsetParent(r) : c, h.is("html") && h[0] !== c[0] && (x.debug("Setting page as offset parent"), h = c), x.get.variation() && x.set.variation();
  11895. }, reposition: function reposition() {
  11896. x.refresh(), x.set.position();
  11897. }, destroy: function destroy() {
  11898. x.debug("Destroying previous module"), v && v.disconnect(), r && !C.preserve && x.removePopup(), clearTimeout(x.hideTimer), clearTimeout(x.showTimer), x.unbind.close(), x.unbind.events(), E.removeData(P);
  11899. }, event: { start: function start(t) {
  11900. var n = e.isPlainObject(C.delay) ? C.delay.show : C.delay;clearTimeout(x.hideTimer), I || (x.showTimer = setTimeout(x.show, n));
  11901. }, end: function end() {
  11902. var t = e.isPlainObject(C.delay) ? C.delay.hide : C.delay;clearTimeout(x.showTimer), x.hideTimer = setTimeout(x.hide, t);
  11903. }, touchstart: function touchstart(e) {
  11904. I = !0, x.show();
  11905. }, resize: function resize() {
  11906. x.is.visible() && x.set.position();
  11907. }, documentChanged: function documentChanged(t) {
  11908. [].forEach.call(t, function (t) {
  11909. t.removedNodes && [].forEach.call(t.removedNodes, function (t) {
  11910. (t == M || e(t).find(M).length > 0) && (x.debug("Element removed from DOM, tearing down events"), x.destroy());
  11911. });
  11912. });
  11913. }, hideGracefully: function hideGracefully(t) {
  11914. var i = e(t.target),
  11915. o = e.contains(n.documentElement, t.target),
  11916. a = i.closest(w.popup).length > 0;t && !a && o ? (x.debug("Click occurred outside popup hiding popup"), x.hide()) : x.debug("Click was inside popup, keeping popup open");
  11917. } }, create: function create() {
  11918. var t = x.get.html(),
  11919. n = x.get.title(),
  11920. i = x.get.content();t || i || n ? (x.debug("Creating pop-up html"), t || (t = C.templates.popup({ title: n, content: i })), r = e("<div/>").addClass(S.popup).data(T.activator, E).html(t), C.inline ? (x.verbose("Inserting popup element inline", r), r.insertAfter(E)) : (x.verbose("Appending popup element to body", r), r.appendTo(F)), x.refresh(), x.set.variation(), C.hoverable && x.bind.popup(), C.onCreate.call(r, M)) : 0 !== q.next(w.popup).length ? (x.verbose("Pre-existing popup found"), C.inline = !0, C.popup = q.next(w.popup).data(T.activator, E), x.refresh(), C.hoverable && x.bind.popup()) : C.popup ? (e(C.popup).data(T.activator, E), x.verbose("Used popup specified in settings"), x.refresh(), C.hoverable && x.bind.popup()) : x.debug("No content specified skipping display", M);
  11921. }, createID: function createID() {
  11922. y = (Math.random().toString(16) + "000000000").substr(2, 8), b = "." + y, x.verbose("Creating unique id for element", y);
  11923. }, toggle: function toggle() {
  11924. x.debug("Toggling pop-up"), x.is.hidden() ? (x.debug("Popup is hidden, showing pop-up"), x.unbind.close(), x.show()) : (x.debug("Popup is visible, hiding pop-up"), x.hide());
  11925. }, show: function show(e) {
  11926. if (e = e || function () {}, x.debug("Showing pop-up", C.transition), x.is.hidden() && (!x.is.active() || !x.is.dropdown())) {
  11927. if (x.exists() || x.create(), !1 === C.onShow.call(r, M)) return void x.debug("onShow callback returned false, cancelling popup animation");C.preserve || C.popup || x.refresh(), r && x.set.position() && (x.save.conditions(), C.exclusive && x.hideAll(), x.animate.show(e));
  11928. }
  11929. }, hide: function hide(e) {
  11930. if (e = e || function () {}, x.is.visible() || x.is.animating()) {
  11931. if (!1 === C.onHide.call(r, M)) return void x.debug("onHide callback returned false, cancelling popup animation");x.remove.visible(), x.unbind.close(), x.restore.conditions(), x.animate.hide(e);
  11932. }
  11933. }, hideAll: function hideAll() {
  11934. e(w.popup).filter("." + S.popupVisible).each(function () {
  11935. e(this).data(T.activator).popup("hide");
  11936. });
  11937. }, exists: function exists() {
  11938. return !!r && (C.inline || C.popup ? x.has.popup() : r.closest(F).length >= 1);
  11939. }, removePopup: function removePopup() {
  11940. x.has.popup() && !C.popup && (x.debug("Removing popup", r), r.remove(), r = i, C.onRemove.call(r, M));
  11941. }, save: { conditions: function conditions() {
  11942. x.cache = { title: E.attr("title") }, x.cache.title && E.removeAttr("title"), x.verbose("Saving original attributes", x.cache.title);
  11943. } }, restore: { conditions: function conditions() {
  11944. return x.cache && x.cache.title && (E.attr("title", x.cache.title), x.verbose("Restoring original attributes", x.cache.title)), !0;
  11945. } }, supports: { svg: function svg() {
  11946. return "undefined" == typeof SVGGraphicsElement;
  11947. } }, animate: { show: function show(t) {
  11948. t = e.isFunction(t) ? t : function () {}, C.transition && e.fn.transition !== i && E.transition("is supported") ? (x.set.visible(), r.transition({ animation: C.transition + " in", queue: !1, debug: C.debug, verbose: C.verbose, duration: C.duration, onComplete: function onComplete() {
  11949. x.bind.close(), t.call(r, M), C.onVisible.call(r, M);
  11950. } })) : x.error(k.noTransition);
  11951. }, hide: function hide(t) {
  11952. t = e.isFunction(t) ? t : function () {}, x.debug("Hiding pop-up"), !1 !== C.onHide.call(r, M) ? C.transition && e.fn.transition !== i && E.transition("is supported") ? r.transition({ animation: C.transition + " out", queue: !1, duration: C.duration, debug: C.debug, verbose: C.verbose, onComplete: function onComplete() {
  11953. x.reset(), t.call(r, M), C.onHidden.call(r, M);
  11954. } }) : x.error(k.noTransition) : x.debug("onHide callback returned false, cancelling popup animation");
  11955. } }, change: { content: function content(e) {
  11956. r.html(e);
  11957. } }, get: { html: function html() {
  11958. return E.removeData(T.html), E.data(T.html) || C.html;
  11959. }, title: function title() {
  11960. return E.removeData(T.title), E.data(T.title) || C.title;
  11961. }, content: function content() {
  11962. return E.removeData(T.content), E.data(T.content) || C.content || E.attr("title");
  11963. }, variation: function variation() {
  11964. return E.removeData(T.variation), E.data(T.variation) || C.variation;
  11965. }, popup: function popup() {
  11966. return r;
  11967. }, popupOffset: function popupOffset() {
  11968. return r.offset();
  11969. }, calculations: function calculations() {
  11970. var e,
  11971. n = x.get.offsetParent(r),
  11972. i = q[0],
  11973. o = D[0] == t,
  11974. a = C.inline || C.popup && C.movePopup ? q.position() : q.offset(),
  11975. s = o ? { top: 0, left: 0 } : D.offset(),
  11976. c = {},
  11977. u = o ? { top: l.scrollTop(), left: l.scrollLeft() } : { top: 0, left: 0 };if (c = { target: { element: q[0], width: q.outerWidth(), height: q.outerHeight(), top: a.top, left: a.left, margin: {} }, popup: { width: r.outerWidth(), height: r.outerHeight() }, parent: { width: h.outerWidth(), height: h.outerHeight() }, screen: { top: s.top, left: s.left, scroll: { top: u.top, left: u.left }, width: D.width(), height: D.height() } }, n.get(0) !== h.get(0)) {
  11978. var d = n.offset();c.target.top -= d.top, c.target.left -= d.left, c.parent.width = n.outerWidth(), c.parent.height = n.outerHeight();
  11979. }return C.setFluidWidth && x.is.fluid() && (c.container = { width: r.parent().outerWidth() }, c.popup.width = c.container.width), c.target.margin.top = C.inline ? parseInt(t.getComputedStyle(i).getPropertyValue("margin-top"), 10) : 0, c.target.margin.left = C.inline ? x.is.rtl() ? parseInt(t.getComputedStyle(i).getPropertyValue("margin-right"), 10) : parseInt(t.getComputedStyle(i).getPropertyValue("margin-left"), 10) : 0, e = c.screen, c.boundary = { top: e.top + e.scroll.top, bottom: e.top + e.scroll.top + e.height, left: e.left + e.scroll.left, right: e.left + e.scroll.left + e.width }, c;
  11980. }, id: function id() {
  11981. return y;
  11982. }, startEvent: function startEvent() {
  11983. return "hover" == C.on ? "mouseenter" : "focus" == C.on && "focus";
  11984. }, scrollEvent: function scrollEvent() {
  11985. return "scroll";
  11986. }, endEvent: function endEvent() {
  11987. return "hover" == C.on ? "mouseleave" : "focus" == C.on && "blur";
  11988. }, distanceFromBoundary: function distanceFromBoundary(e, t) {
  11989. var n,
  11990. i,
  11991. o = {};return n = (t = t || x.get.calculations()).popup, i = t.boundary, e && (o = { top: e.top - i.top, left: e.left - i.left, right: i.right - (e.left + n.width), bottom: i.bottom - (e.top + n.height) }, x.verbose("Distance from boundaries determined", e, o)), o;
  11992. }, offsetParent: function offsetParent(t) {
  11993. var n = (t !== i ? t[0] : q[0]).parentNode,
  11994. o = e(n);if (n) for (var a = "none" === o.css("transform"), r = "static" === o.css("position"), s = o.is("body"); n && !s && r && a;) {
  11995. n = n.parentNode, a = "none" === (o = e(n)).css("transform"), r = "static" === o.css("position"), s = o.is("body");
  11996. }return o && o.length > 0 ? o : e();
  11997. }, positions: function positions() {
  11998. return { "top left": !1, "top center": !1, "top right": !1, "bottom left": !1, "bottom center": !1, "bottom right": !1, "left center": !1, "right center": !1 };
  11999. }, nextPosition: function nextPosition(e) {
  12000. var t = e.split(" "),
  12001. n = t[0],
  12002. i = t[1],
  12003. o = "top" == n || "bottom" == n,
  12004. a = !1,
  12005. r = !1,
  12006. s = !1;return z || (x.verbose("All available positions available"), z = x.get.positions()), x.debug("Recording last position tried", e), z[e] = !0, "opposite" === C.prefer && (s = (s = [{ top: "bottom", bottom: "top", left: "right", right: "left" }[n], i]).join(" "), a = !0 === z[s], x.debug("Trying opposite strategy", s)), "adjacent" === C.prefer && o && (s = (s = [n, { left: "center", center: "right", right: "left" }[i]]).join(" "), r = !0 === z[s], x.debug("Trying adjacent strategy", s)), (r || a) && (x.debug("Using backup position", s), s = { "top left": "top center", "top center": "top right", "top right": "right center", "right center": "bottom right", "bottom right": "bottom center", "bottom center": "bottom left", "bottom left": "left center", "left center": "top left" }[e]), s;
  12007. } }, set: { position: function position(e, t) {
  12008. if (0 !== q.length && 0 !== r.length) {
  12009. var n, o, a, s, l, c, u, d;if (t = t || x.get.calculations(), e = e || E.data(T.position) || C.position, n = E.data(T.offset) || C.offset, o = C.distanceAway, a = t.target, s = t.popup, l = t.parent, x.should.centerArrow(t) && (x.verbose("Adjusting offset to center arrow on small target element"), "top left" != e && "bottom left" != e || (n += a.width / 2, n -= C.arrowPixelsFromEdge), "top right" != e && "bottom right" != e || (n -= a.width / 2, n += C.arrowPixelsFromEdge)), 0 === a.width && 0 === a.height && !x.is.svg(a.element)) return x.debug("Popup target is hidden, no action taken"), !1;switch (C.inline && (x.debug("Adding margin to calculation", a.margin), "left center" == e || "right center" == e ? (n += a.margin.top, o += -a.margin.left) : "top left" == e || "top center" == e || "top right" == e ? (n += a.margin.left, o -= a.margin.top) : (n += a.margin.left, o += a.margin.top)), x.debug("Determining popup position from calculations", e, t), x.is.rtl() && (e = e.replace(/left|right/g, function (e) {
  12010. return "left" == e ? "right" : "left";
  12011. }), x.debug("RTL: Popup position updated", e)), j == C.maxSearchDepth && "string" == typeof C.lastResort && (e = C.lastResort), e) {case "top left":
  12012. c = { top: "auto", bottom: l.height - a.top + o, left: a.left + n, right: "auto" };break;case "top center":
  12013. c = { bottom: l.height - a.top + o, left: a.left + a.width / 2 - s.width / 2 + n, top: "auto", right: "auto" };break;case "top right":
  12014. c = { bottom: l.height - a.top + o, right: l.width - a.left - a.width - n, top: "auto", left: "auto" };break;case "left center":
  12015. c = { top: a.top + a.height / 2 - s.height / 2 + n, right: l.width - a.left + o, left: "auto", bottom: "auto" };break;case "right center":
  12016. c = { top: a.top + a.height / 2 - s.height / 2 + n, left: a.left + a.width + o, bottom: "auto", right: "auto" };break;case "bottom left":
  12017. c = { top: a.top + a.height + o, left: a.left + n, bottom: "auto", right: "auto" };break;case "bottom center":
  12018. c = { top: a.top + a.height + o, left: a.left + a.width / 2 - s.width / 2 + n, bottom: "auto", right: "auto" };break;case "bottom right":
  12019. c = { top: a.top + a.height + o, right: l.width - a.left - a.width - n, left: "auto", bottom: "auto" };}if (c === i && x.error(k.invalidPosition, e), x.debug("Calculated popup positioning values", c), r.css(c).removeClass(S.position).addClass(e).addClass(S.loading), u = x.get.popupOffset(), d = x.get.distanceFromBoundary(u, t), x.is.offstage(d, e)) {
  12020. if (x.debug("Position is outside viewport", e), j < C.maxSearchDepth) return j++, e = x.get.nextPosition(e), x.debug("Trying new position", e), !!r && x.set.position(e, t);if (!C.lastResort) return x.debug("Popup could not find a position to display", r), x.error(k.cannotPlace, M), x.remove.attempts(), x.remove.loading(), x.reset(), C.onUnplaceable.call(r, M), !1;x.debug("No position found, showing with last position");
  12021. }return x.debug("Position is on stage", e), x.remove.attempts(), x.remove.loading(), C.setFluidWidth && x.is.fluid() && x.set.fluidWidth(t), !0;
  12022. }x.error(k.notFound);
  12023. }, fluidWidth: function fluidWidth(e) {
  12024. e = e || x.get.calculations(), x.debug("Automatically setting element width to parent width", e.parent.width), r.css("width", e.container.width);
  12025. }, variation: function variation(e) {
  12026. (e = e || x.get.variation()) && x.has.popup() && (x.verbose("Adding variation to popup", e), r.addClass(e));
  12027. }, visible: function visible() {
  12028. E.addClass(S.visible);
  12029. } }, remove: { loading: function loading() {
  12030. r.removeClass(S.loading);
  12031. }, variation: function variation(e) {
  12032. (e = e || x.get.variation()) && (x.verbose("Removing variation", e), r.removeClass(e));
  12033. }, visible: function visible() {
  12034. E.removeClass(S.visible);
  12035. }, attempts: function attempts() {
  12036. x.verbose("Resetting all searched positions"), j = 0, z = !1;
  12037. } }, bind: { events: function events() {
  12038. x.debug("Binding popup events to module"), "click" == C.on && E.on("click" + R, x.toggle), "hover" == C.on && E.on("touchstart" + R, x.event.touchstart), x.get.startEvent() && E.on(x.get.startEvent() + R, x.event.start).on(x.get.endEvent() + R, x.event.end), C.target && x.debug("Target set to element", q), l.on("resize" + b, x.event.resize);
  12039. }, popup: function popup() {
  12040. x.verbose("Allowing hover events on popup to prevent closing"), r && x.has.popup() && r.on("mouseenter" + R, x.event.start).on("mouseleave" + R, x.event.end);
  12041. }, close: function close() {
  12042. (!0 === C.hideOnScroll || "auto" == C.hideOnScroll && "click" != C.on) && x.bind.closeOnScroll(), "hover" == C.on && I && x.bind.touchClose(), "click" == C.on && C.closable && x.bind.clickaway();
  12043. }, closeOnScroll: function closeOnScroll() {
  12044. x.verbose("Binding scroll close event to document"), O.one(x.get.scrollEvent() + b, x.event.hideGracefully);
  12045. }, touchClose: function touchClose() {
  12046. x.verbose("Binding popup touchclose event to document"), s.on("touchstart" + b, function (e) {
  12047. x.verbose("Touched away from popup"), x.event.hideGracefully.call(M, e);
  12048. });
  12049. }, clickaway: function clickaway() {
  12050. x.verbose("Binding popup close event to document"), s.on("click" + b, function (e) {
  12051. x.verbose("Clicked away from popup"), x.event.hideGracefully.call(M, e);
  12052. });
  12053. } }, unbind: { events: function events() {
  12054. l.off(b), E.off(R);
  12055. }, close: function close() {
  12056. s.off(b), O.off(b);
  12057. } }, has: { popup: function popup() {
  12058. return r && r.length > 0;
  12059. } }, should: { centerArrow: function centerArrow(e) {
  12060. return !x.is.basic() && e.target.width <= 2 * C.arrowPixelsFromEdge;
  12061. } }, is: { offstage: function offstage(t, n) {
  12062. var i = [];return e.each(t, function (e, t) {
  12063. t < -C.jitter && (x.debug("Position exceeds allowable distance from edge", e, t, n), i.push(e));
  12064. }), i.length > 0;
  12065. }, svg: function svg(e) {
  12066. return x.supports.svg() && e instanceof SVGGraphicsElement;
  12067. }, basic: function basic() {
  12068. return E.hasClass(S.basic);
  12069. }, active: function active() {
  12070. return E.hasClass(S.active);
  12071. }, animating: function animating() {
  12072. return r !== i && r.hasClass(S.animating);
  12073. }, fluid: function fluid() {
  12074. return r !== i && r.hasClass(S.fluid);
  12075. }, visible: function visible() {
  12076. return r !== i && r.hasClass(S.popupVisible);
  12077. }, dropdown: function dropdown() {
  12078. return E.hasClass(S.dropdown);
  12079. }, hidden: function hidden() {
  12080. return !x.is.visible();
  12081. }, rtl: function rtl() {
  12082. return "rtl" == E.css("direction");
  12083. } }, reset: function reset() {
  12084. x.remove.visible(), C.preserve ? e.fn.transition !== i && r.transition("remove transition") : x.removePopup();
  12085. }, setting: function setting(t, n) {
  12086. if (e.isPlainObject(t)) e.extend(!0, C, t);else {
  12087. if (n === i) return C[t];C[t] = n;
  12088. }
  12089. }, internal: function internal(t, n) {
  12090. if (e.isPlainObject(t)) e.extend(!0, x, t);else {
  12091. if (n === i) return x[t];x[t] = n;
  12092. }
  12093. }, debug: function debug() {
  12094. !C.silent && C.debug && (C.performance ? x.performance.log(arguments) : (x.debug = Function.prototype.bind.call(console.info, console, C.name + ":"), x.debug.apply(console, arguments)));
  12095. }, verbose: function verbose() {
  12096. !C.silent && C.verbose && C.debug && (C.performance ? x.performance.log(arguments) : (x.verbose = Function.prototype.bind.call(console.info, console, C.name + ":"), x.verbose.apply(console, arguments)));
  12097. }, error: function error() {
  12098. C.silent || (x.error = Function.prototype.bind.call(console.error, console, C.name + ":"), x.error.apply(console, arguments));
  12099. }, performance: { log: function log(e) {
  12100. var t, n;C.performance && (n = (t = new Date().getTime()) - (d || t), d = t, f.push({ Name: e[0], Arguments: [].slice.call(e, 1) || "", Element: M, "Execution Time": n })), clearTimeout(x.performance.timer), x.performance.timer = setTimeout(x.performance.display, 500);
  12101. }, display: function display() {
  12102. var t = C.name + ":",
  12103. n = 0;d = !1, clearTimeout(x.performance.timer), e.each(f, function (e, t) {
  12104. n += t["Execution Time"];
  12105. }), t += " " + n + "ms", u && (t += " '" + u + "'"), (console.group !== i || console.table !== i) && f.length > 0 && (console.groupCollapsed(t), console.table ? console.table(f) : e.each(f, function (e, t) {
  12106. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  12107. }), console.groupEnd()), f = [];
  12108. } }, invoke: function invoke(t, n, o) {
  12109. var r,
  12110. s,
  12111. l,
  12112. c = L;return n = n || p, o = M || o, "string" == typeof t && c !== i && (t = t.split(/[\. ]/), r = t.length - 1, e.each(t, function (n, o) {
  12113. var a = n != r ? o + t[n + 1].charAt(0).toUpperCase() + t[n + 1].slice(1) : t;if (e.isPlainObject(c[a]) && n != r) c = c[a];else {
  12114. if (c[a] !== i) return s = c[a], !1;if (!e.isPlainObject(c[o]) || n == r) return c[o] !== i && (s = c[o], !1);c = c[o];
  12115. }
  12116. })), e.isFunction(s) ? l = s.apply(o, n) : s !== i && (l = s), e.isArray(a) ? a.push(l) : a !== i ? a = [a, l] : l !== i && (a = l), s;
  12117. } }, g ? (L === i && x.initialize(), x.invoke(m)) : (L !== i && L.invoke("destroy"), x.initialize());
  12118. }), a !== i ? a : this;
  12119. }, e.fn.popup.settings = { name: "Popup", silent: !1, debug: !1, verbose: !1, performance: !0, namespace: "popup", observeChanges: !0, onCreate: function onCreate() {}, onRemove: function onRemove() {}, onShow: function onShow() {}, onVisible: function onVisible() {}, onHide: function onHide() {}, onUnplaceable: function onUnplaceable() {}, onHidden: function onHidden() {}, on: "hover", boundary: t, addTouchEvents: !0, position: "top left", variation: "", movePopup: !0, target: !1, popup: !1, inline: !1, preserve: !1, hoverable: !1, content: !1, html: !1, title: !1, closable: !0, hideOnScroll: "auto", exclusive: !1, context: "body", scrollContext: t, prefer: "opposite", lastResort: !1, arrowPixelsFromEdge: 20, delay: { show: 50, hide: 70 }, setFluidWidth: !0, duration: 200, transition: "scale", distanceAway: 0, jitter: 2, offset: 0, maxSearchDepth: 15, error: { invalidPosition: "The position you specified is not a valid position", cannotPlace: "Popup does not fit within the boundaries of the viewport", method: "The method you called is not defined.", noTransition: "This module requires ui transitions <https://github.com/Semantic-Org/UI-Transition>", notFound: "The target or popup you specified does not exist on the page" }, metadata: { activator: "activator", content: "content", html: "html", offset: "offset", position: "position", title: "title", variation: "variation" }, className: { active: "active", basic: "basic", animating: "animating", dropdown: "dropdown", fluid: "fluid", loading: "loading", popup: "ui popup", position: "top left center bottom right", visible: "visible", popupVisible: "visible" }, selector: { popup: ".ui.popup" }, templates: { escape: function escape(e) {
  12120. var t = { "&": "&amp;", "<": "&lt;", ">": "&gt;", '"': "&quot;", "'": "&#x27;", "`": "&#x60;" };return (/[&<>"'`]/.test(e) ? e.replace(/[&<>"'`]/g, function (e) {
  12121. return t[e];
  12122. }) : e
  12123. );
  12124. }, popup: function popup(t) {
  12125. var n = "",
  12126. o = e.fn.popup.settings.templates.escape;return (typeof t === "undefined" ? "undefined" : _typeof(t)) !== i && (_typeof(t.title) !== i && t.title && (t.title = o(t.title), n += '<div class="header">' + t.title + "</div>"), _typeof(t.content) !== i && t.content && (t.content = o(t.content), n += '<div class="content">' + t.content + "</div>")), n;
  12127. } } };
  12128. }(jQuery, window, document), function (e, t, n, i) {
  12129. "use strict";
  12130. void 0 !== (t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")()) && t.Math == Math || ("undefined" != typeof self && self.Math == Math ? self : Function("return this")());e.fn.progress = function (t) {
  12131. var o,
  12132. a = e(this),
  12133. r = a.selector || "",
  12134. s = new Date().getTime(),
  12135. l = [],
  12136. c = arguments[0],
  12137. u = "string" == typeof c,
  12138. d = [].slice.call(arguments, 1);return a.each(function () {
  12139. var a,
  12140. f = e.isPlainObject(t) ? e.extend(!0, {}, e.fn.progress.settings, t) : e.extend({}, e.fn.progress.settings),
  12141. m = f.className,
  12142. g = f.metadata,
  12143. p = f.namespace,
  12144. h = f.selector,
  12145. v = f.error,
  12146. b = "." + p,
  12147. y = "module-" + p,
  12148. x = e(this),
  12149. C = e(this).find(h.bar),
  12150. w = e(this).find(h.progress),
  12151. S = e(this).find(h.label),
  12152. k = this,
  12153. T = x.data(y),
  12154. A = !1;a = { initialize: function initialize() {
  12155. a.debug("Initializing progress bar", f), a.set.duration(), a.set.transitionEvent(), a.read.metadata(), a.read.settings(), a.instantiate();
  12156. }, instantiate: function instantiate() {
  12157. a.verbose("Storing instance of progress", a), T = a, x.data(y, a);
  12158. }, destroy: function destroy() {
  12159. a.verbose("Destroying previous progress for", x), clearInterval(T.interval), a.remove.state(), x.removeData(y), T = i;
  12160. }, reset: function reset() {
  12161. a.remove.nextValue(), a.update.progress(0);
  12162. }, complete: function complete() {
  12163. (a.percent === i || a.percent < 100) && (a.remove.progressPoll(), a.set.percent(100));
  12164. }, read: { metadata: function metadata() {
  12165. var e = { percent: x.data(g.percent), total: x.data(g.total), value: x.data(g.value) };e.percent && (a.debug("Current percent value set from metadata", e.percent), a.set.percent(e.percent)), e.total && (a.debug("Total value set from metadata", e.total), a.set.total(e.total)), e.value && (a.debug("Current value set from metadata", e.value), a.set.value(e.value), a.set.progress(e.value));
  12166. }, settings: function settings() {
  12167. !1 !== f.total && (a.debug("Current total set in settings", f.total), a.set.total(f.total)), !1 !== f.value && (a.debug("Current value set in settings", f.value), a.set.value(f.value), a.set.progress(a.value)), !1 !== f.percent && (a.debug("Current percent set in settings", f.percent), a.set.percent(f.percent));
  12168. } }, bind: { transitionEnd: function transitionEnd(e) {
  12169. var t = a.get.transitionEnd();C.one(t + b, function (t) {
  12170. clearTimeout(a.failSafeTimer), e.call(this, t);
  12171. }), a.failSafeTimer = setTimeout(function () {
  12172. C.triggerHandler(t);
  12173. }, f.duration + f.failSafeDelay), a.verbose("Adding fail safe timer", a.timer);
  12174. } }, increment: function increment(e) {
  12175. var t, n;a.has.total() ? n = (t = a.get.value()) + (e = e || 1) : (n = (t = a.get.percent()) + (e = e || a.get.randomValue()), 100, a.debug("Incrementing percentage by", t, n)), n = a.get.normalizedValue(n), a.set.progress(n);
  12176. }, decrement: function decrement(e) {
  12177. var t, n;a.get.total() ? (n = (t = a.get.value()) - (e = e || 1), a.debug("Decrementing value by", e, t)) : (n = (t = a.get.percent()) - (e = e || a.get.randomValue()), a.debug("Decrementing percentage by", e, t)), n = a.get.normalizedValue(n), a.set.progress(n);
  12178. }, has: { progressPoll: function progressPoll() {
  12179. return a.progressPoll;
  12180. }, total: function total() {
  12181. return !1 !== a.get.total();
  12182. } }, get: { text: function text(e) {
  12183. var t = a.value || 0,
  12184. n = a.total || 0,
  12185. i = A ? a.get.displayPercent() : a.percent || 0,
  12186. o = a.total > 0 ? n - t : 100 - i;return e = (e = e || "").replace("{value}", t).replace("{total}", n).replace("{left}", o).replace("{percent}", i), a.verbose("Adding variables to progress bar text", e), e;
  12187. }, normalizedValue: function normalizedValue(e) {
  12188. if (e < 0) return a.debug("Value cannot decrement below 0"), 0;if (a.has.total()) {
  12189. if (e > a.total) return a.debug("Value cannot increment above total", a.total), a.total;
  12190. } else if (e > 100) return a.debug("Value cannot increment above 100 percent"), 100;return e;
  12191. }, updateInterval: function updateInterval() {
  12192. return "auto" == f.updateInterval ? f.duration : f.updateInterval;
  12193. }, randomValue: function randomValue() {
  12194. return a.debug("Generating random increment percentage"), Math.floor(Math.random() * f.random.max + f.random.min);
  12195. }, numericValue: function numericValue(e) {
  12196. return "string" == typeof e ? "" !== e.replace(/[^\d.]/g, "") && +e.replace(/[^\d.]/g, "") : e;
  12197. }, transitionEnd: function transitionEnd() {
  12198. var e,
  12199. t = n.createElement("element"),
  12200. o = { transition: "transitionend", OTransition: "oTransitionEnd", MozTransition: "transitionend", WebkitTransition: "webkitTransitionEnd" };for (e in o) {
  12201. if (t.style[e] !== i) return o[e];
  12202. }
  12203. }, displayPercent: function displayPercent() {
  12204. var e = C.width(),
  12205. t = x.width(),
  12206. n = e > parseInt(C.css("min-width"), 10) ? e / t * 100 : a.percent;return f.precision > 0 ? Math.round(n * (10 * f.precision)) / (10 * f.precision) : Math.round(n);
  12207. }, percent: function percent() {
  12208. return a.percent || 0;
  12209. }, value: function value() {
  12210. return a.nextValue || a.value || 0;
  12211. }, total: function total() {
  12212. return a.total || !1;
  12213. } }, create: { progressPoll: function progressPoll() {
  12214. a.progressPoll = setTimeout(function () {
  12215. a.update.toNextValue(), a.remove.progressPoll();
  12216. }, a.get.updateInterval());
  12217. } }, is: { complete: function complete() {
  12218. return a.is.success() || a.is.warning() || a.is.error();
  12219. }, success: function success() {
  12220. return x.hasClass(m.success);
  12221. }, warning: function warning() {
  12222. return x.hasClass(m.warning);
  12223. }, error: function error() {
  12224. return x.hasClass(m.error);
  12225. }, active: function active() {
  12226. return x.hasClass(m.active);
  12227. }, visible: function visible() {
  12228. return x.is(":visible");
  12229. } }, remove: { progressPoll: function progressPoll() {
  12230. a.verbose("Removing progress poll timer"), a.progressPoll && (clearTimeout(a.progressPoll), delete a.progressPoll);
  12231. }, nextValue: function nextValue() {
  12232. a.verbose("Removing progress value stored for next update"), delete a.nextValue;
  12233. }, state: function state() {
  12234. a.verbose("Removing stored state"), delete a.total, delete a.percent, delete a.value;
  12235. }, active: function active() {
  12236. a.verbose("Removing active state"), x.removeClass(m.active);
  12237. }, success: function success() {
  12238. a.verbose("Removing success state"), x.removeClass(m.success);
  12239. }, warning: function warning() {
  12240. a.verbose("Removing warning state"), x.removeClass(m.warning);
  12241. }, error: function error() {
  12242. a.verbose("Removing error state"), x.removeClass(m.error);
  12243. } }, set: { barWidth: function barWidth(e) {
  12244. e > 100 ? a.error(v.tooHigh, e) : e < 0 ? a.error(v.tooLow, e) : (C.css("width", e + "%"), x.attr("data-percent", parseInt(e, 10)));
  12245. }, duration: function duration(e) {
  12246. e = "number" == typeof (e = e || f.duration) ? e + "ms" : e, a.verbose("Setting progress bar transition duration", e), C.css({ "transition-duration": e });
  12247. }, percent: function percent(e) {
  12248. e = "string" == typeof e ? +e.replace("%", "") : e, e = f.precision > 0 ? Math.round(e * (10 * f.precision)) / (10 * f.precision) : Math.round(e), a.percent = e, a.has.total() || (a.value = f.precision > 0 ? Math.round(e / 100 * a.total * (10 * f.precision)) / (10 * f.precision) : Math.round(e / 100 * a.total * 10) / 10, f.limitValues && (a.value = a.value > 100 ? 100 : a.value < 0 ? 0 : a.value)), a.set.barWidth(e), a.set.labelInterval(), a.set.labels(), f.onChange.call(k, e, a.value, a.total);
  12249. }, labelInterval: function labelInterval() {
  12250. clearInterval(a.interval), a.bind.transitionEnd(function () {
  12251. a.verbose("Bar finished animating, removing continuous label updates"), clearInterval(a.interval), A = !1, a.set.labels();
  12252. }), A = !0, a.interval = setInterval(function () {
  12253. e.contains(n.documentElement, k) || (clearInterval(a.interval), A = !1), a.set.labels();
  12254. }, f.framerate);
  12255. }, labels: function labels() {
  12256. a.verbose("Setting both bar progress and outer label text"), a.set.barLabel(), a.set.state();
  12257. }, label: function label(e) {
  12258. (e = e || "") && (e = a.get.text(e), a.verbose("Setting label to text", e), S.text(e));
  12259. }, state: function state(e) {
  12260. 100 === (e = e !== i ? e : a.percent) ? f.autoSuccess && !(a.is.warning() || a.is.error() || a.is.success()) ? (a.set.success(), a.debug("Automatically triggering success at 100%")) : (a.verbose("Reached 100% removing active state"), a.remove.active(), a.remove.progressPoll()) : e > 0 ? (a.verbose("Adjusting active progress bar label", e), a.set.active()) : (a.remove.active(), a.set.label(f.text.active));
  12261. }, barLabel: function barLabel(e) {
  12262. e !== i ? w.text(a.get.text(e)) : "ratio" == f.label && a.total ? (a.verbose("Adding ratio to bar label"), w.text(a.get.text(f.text.ratio))) : "percent" == f.label && (a.verbose("Adding percentage to bar label"), w.text(a.get.text(f.text.percent)));
  12263. }, active: function active(e) {
  12264. e = e || f.text.active, a.debug("Setting active state"), f.showActivity && !a.is.active() && x.addClass(m.active), a.remove.warning(), a.remove.error(), a.remove.success(), (e = f.onLabelUpdate("active", e, a.value, a.total)) && a.set.label(e), a.bind.transitionEnd(function () {
  12265. f.onActive.call(k, a.value, a.total);
  12266. });
  12267. }, success: function success(e) {
  12268. e = e || f.text.success || f.text.active, a.debug("Setting success state"), x.addClass(m.success), a.remove.active(), a.remove.warning(), a.remove.error(), a.complete(), f.text.success ? (e = f.onLabelUpdate("success", e, a.value, a.total), a.set.label(e)) : (e = f.onLabelUpdate("active", e, a.value, a.total), a.set.label(e)), a.bind.transitionEnd(function () {
  12269. f.onSuccess.call(k, a.total);
  12270. });
  12271. }, warning: function warning(e) {
  12272. e = e || f.text.warning, a.debug("Setting warning state"), x.addClass(m.warning), a.remove.active(), a.remove.success(), a.remove.error(), a.complete(), (e = f.onLabelUpdate("warning", e, a.value, a.total)) && a.set.label(e), a.bind.transitionEnd(function () {
  12273. f.onWarning.call(k, a.value, a.total);
  12274. });
  12275. }, error: function error(e) {
  12276. e = e || f.text.error, a.debug("Setting error state"), x.addClass(m.error), a.remove.active(), a.remove.success(), a.remove.warning(), a.complete(), (e = f.onLabelUpdate("error", e, a.value, a.total)) && a.set.label(e), a.bind.transitionEnd(function () {
  12277. f.onError.call(k, a.value, a.total);
  12278. });
  12279. }, transitionEvent: function transitionEvent() {
  12280. a.get.transitionEnd();
  12281. }, total: function total(e) {
  12282. a.total = e;
  12283. }, value: function value(e) {
  12284. a.value = e;
  12285. }, progress: function progress(e) {
  12286. a.has.progressPoll() ? (a.debug("Updated within interval, setting next update to use new value", e), a.set.nextValue(e)) : (a.debug("First update in progress update interval, immediately updating", e), a.update.progress(e), a.create.progressPoll());
  12287. }, nextValue: function nextValue(e) {
  12288. a.nextValue = e;
  12289. } }, update: { toNextValue: function toNextValue() {
  12290. var e = a.nextValue;e && (a.debug("Update interval complete using last updated value", e), a.update.progress(e), a.remove.nextValue());
  12291. }, progress: function progress(e) {
  12292. var t;!1 === (e = a.get.numericValue(e)) && a.error(v.nonNumeric, e), e = a.get.normalizedValue(e), a.has.total() ? (a.set.value(e), t = e / a.total * 100, a.debug("Calculating percent complete from total", t), a.set.percent(t)) : (t = e, a.debug("Setting value to exact percentage value", t), a.set.percent(t));
  12293. } }, setting: function setting(t, n) {
  12294. if (a.debug("Changing setting", t, n), e.isPlainObject(t)) e.extend(!0, f, t);else {
  12295. if (n === i) return f[t];e.isPlainObject(f[t]) ? e.extend(!0, f[t], n) : f[t] = n;
  12296. }
  12297. }, internal: function internal(t, n) {
  12298. if (e.isPlainObject(t)) e.extend(!0, a, t);else {
  12299. if (n === i) return a[t];a[t] = n;
  12300. }
  12301. }, debug: function debug() {
  12302. !f.silent && f.debug && (f.performance ? a.performance.log(arguments) : (a.debug = Function.prototype.bind.call(console.info, console, f.name + ":"), a.debug.apply(console, arguments)));
  12303. }, verbose: function verbose() {
  12304. !f.silent && f.verbose && f.debug && (f.performance ? a.performance.log(arguments) : (a.verbose = Function.prototype.bind.call(console.info, console, f.name + ":"), a.verbose.apply(console, arguments)));
  12305. }, error: function error() {
  12306. f.silent || (a.error = Function.prototype.bind.call(console.error, console, f.name + ":"), a.error.apply(console, arguments));
  12307. }, performance: { log: function log(e) {
  12308. var t, n;f.performance && (n = (t = new Date().getTime()) - (s || t), s = t, l.push({ Name: e[0], Arguments: [].slice.call(e, 1) || "", Element: k, "Execution Time": n })), clearTimeout(a.performance.timer), a.performance.timer = setTimeout(a.performance.display, 500);
  12309. }, display: function display() {
  12310. var t = f.name + ":",
  12311. n = 0;s = !1, clearTimeout(a.performance.timer), e.each(l, function (e, t) {
  12312. n += t["Execution Time"];
  12313. }), t += " " + n + "ms", r && (t += " '" + r + "'"), (console.group !== i || console.table !== i) && l.length > 0 && (console.groupCollapsed(t), console.table ? console.table(l) : e.each(l, function (e, t) {
  12314. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  12315. }), console.groupEnd()), l = [];
  12316. } }, invoke: function invoke(t, n, r) {
  12317. var s,
  12318. l,
  12319. c,
  12320. u = T;return n = n || d, r = k || r, "string" == typeof t && u !== i && (t = t.split(/[\. ]/), s = t.length - 1, e.each(t, function (n, o) {
  12321. var r = n != s ? o + t[n + 1].charAt(0).toUpperCase() + t[n + 1].slice(1) : t;if (e.isPlainObject(u[r]) && n != s) u = u[r];else {
  12322. if (u[r] !== i) return l = u[r], !1;if (!e.isPlainObject(u[o]) || n == s) return u[o] !== i ? (l = u[o], !1) : (a.error(v.method, t), !1);u = u[o];
  12323. }
  12324. })), e.isFunction(l) ? c = l.apply(r, n) : l !== i && (c = l), e.isArray(o) ? o.push(c) : o !== i ? o = [o, c] : c !== i && (o = c), l;
  12325. } }, u ? (T === i && a.initialize(), a.invoke(c)) : (T !== i && T.invoke("destroy"), a.initialize());
  12326. }), o !== i ? o : this;
  12327. }, e.fn.progress.settings = { name: "Progress", namespace: "progress", silent: !1, debug: !1, verbose: !1, performance: !0, random: { min: 2, max: 5 }, duration: 300, updateInterval: "auto", autoSuccess: !0, showActivity: !0, limitValues: !0, label: "percent", precision: 0, framerate: 1e3 / 30, percent: !1, total: !1, value: !1, failSafeDelay: 100, onLabelUpdate: function onLabelUpdate(e, t, n, i) {
  12328. return t;
  12329. }, onChange: function onChange(e, t, n) {}, onSuccess: function onSuccess(e) {}, onActive: function onActive(e, t) {}, onError: function onError(e, t) {}, onWarning: function onWarning(e, t) {}, error: { method: "The method you called is not defined.", nonNumeric: "Progress value is non numeric", tooHigh: "Value specified is above 100%", tooLow: "Value specified is below 0%" }, regExp: { variable: /\{\$*[A-z0-9]+\}/g }, metadata: { percent: "percent", total: "total", value: "value" }, selector: { bar: "> .bar", label: "> .label", progress: ".bar > .progress" }, text: { active: !1, error: !1, success: !1, warning: !1, percent: "{percent}%", ratio: "{value} of {total}" }, className: { active: "active", error: "error", success: "success", warning: "warning" } };
  12330. }(jQuery, window, document), function (e, t, n, i) {
  12331. "use strict";
  12332. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.rating = function (t) {
  12333. var n,
  12334. o = e(this),
  12335. a = o.selector || "",
  12336. r = new Date().getTime(),
  12337. s = [],
  12338. l = arguments[0],
  12339. c = "string" == typeof l,
  12340. u = [].slice.call(arguments, 1);return o.each(function () {
  12341. var d,
  12342. f,
  12343. m = e.isPlainObject(t) ? e.extend(!0, {}, e.fn.rating.settings, t) : e.extend({}, e.fn.rating.settings),
  12344. g = m.namespace,
  12345. p = m.className,
  12346. h = m.metadata,
  12347. v = m.selector,
  12348. b = (m.error, "." + g),
  12349. y = "module-" + g,
  12350. x = this,
  12351. C = e(this).data(y),
  12352. w = e(this),
  12353. S = w.find(v.icon);f = { initialize: function initialize() {
  12354. f.verbose("Initializing rating module", m), 0 === S.length && f.setup.layout(), m.interactive ? f.enable() : f.disable(), f.set.initialLoad(), f.set.rating(f.get.initialRating()), f.remove.initialLoad(), f.instantiate();
  12355. }, instantiate: function instantiate() {
  12356. f.verbose("Instantiating module", m), C = f, w.data(y, f);
  12357. }, destroy: function destroy() {
  12358. f.verbose("Destroying previous instance", C), f.remove.events(), w.removeData(y);
  12359. }, refresh: function refresh() {
  12360. S = w.find(v.icon);
  12361. }, setup: { layout: function layout() {
  12362. var t = f.get.maxRating(),
  12363. n = e.fn.rating.settings.templates.icon(t);f.debug("Generating icon html dynamically"), w.html(n), f.refresh();
  12364. } }, event: { mouseenter: function mouseenter() {
  12365. var t = e(this);t.nextAll().removeClass(p.selected), w.addClass(p.selected), t.addClass(p.selected).prevAll().addClass(p.selected);
  12366. }, mouseleave: function mouseleave() {
  12367. w.removeClass(p.selected), S.removeClass(p.selected);
  12368. }, click: function click() {
  12369. var t = e(this),
  12370. n = f.get.rating(),
  12371. i = S.index(t) + 1;("auto" == m.clearable ? 1 === S.length : m.clearable) && n == i ? f.clearRating() : f.set.rating(i);
  12372. } }, clearRating: function clearRating() {
  12373. f.debug("Clearing current rating"), f.set.rating(0);
  12374. }, bind: { events: function events() {
  12375. f.verbose("Binding events"), w.on("mouseenter" + b, v.icon, f.event.mouseenter).on("mouseleave" + b, v.icon, f.event.mouseleave).on("click" + b, v.icon, f.event.click);
  12376. } }, remove: { events: function events() {
  12377. f.verbose("Removing events"), w.off(b);
  12378. }, initialLoad: function initialLoad() {
  12379. d = !1;
  12380. } }, enable: function enable() {
  12381. f.debug("Setting rating to interactive mode"), f.bind.events(), w.removeClass(p.disabled);
  12382. }, disable: function disable() {
  12383. f.debug("Setting rating to read-only mode"), f.remove.events(), w.addClass(p.disabled);
  12384. }, is: { initialLoad: function initialLoad() {
  12385. return d;
  12386. } }, get: { initialRating: function initialRating() {
  12387. return w.data(h.rating) !== i ? (w.removeData(h.rating), w.data(h.rating)) : m.initialRating;
  12388. }, maxRating: function maxRating() {
  12389. return w.data(h.maxRating) !== i ? (w.removeData(h.maxRating), w.data(h.maxRating)) : m.maxRating;
  12390. }, rating: function rating() {
  12391. var e = S.filter("." + p.active).length;return f.verbose("Current rating retrieved", e), e;
  12392. } }, set: { rating: function rating(e) {
  12393. var t = e - 1 >= 0 ? e - 1 : 0,
  12394. n = S.eq(t);w.removeClass(p.selected), S.removeClass(p.selected).removeClass(p.active), e > 0 && (f.verbose("Setting current rating to", e), n.prevAll().addBack().addClass(p.active)), f.is.initialLoad() || m.onRate.call(x, e);
  12395. }, initialLoad: function initialLoad() {
  12396. d = !0;
  12397. } }, setting: function setting(t, n) {
  12398. if (f.debug("Changing setting", t, n), e.isPlainObject(t)) e.extend(!0, m, t);else {
  12399. if (n === i) return m[t];e.isPlainObject(m[t]) ? e.extend(!0, m[t], n) : m[t] = n;
  12400. }
  12401. }, internal: function internal(t, n) {
  12402. if (e.isPlainObject(t)) e.extend(!0, f, t);else {
  12403. if (n === i) return f[t];f[t] = n;
  12404. }
  12405. }, debug: function debug() {
  12406. !m.silent && m.debug && (m.performance ? f.performance.log(arguments) : (f.debug = Function.prototype.bind.call(console.info, console, m.name + ":"), f.debug.apply(console, arguments)));
  12407. }, verbose: function verbose() {
  12408. !m.silent && m.verbose && m.debug && (m.performance ? f.performance.log(arguments) : (f.verbose = Function.prototype.bind.call(console.info, console, m.name + ":"), f.verbose.apply(console, arguments)));
  12409. }, error: function error() {
  12410. m.silent || (f.error = Function.prototype.bind.call(console.error, console, m.name + ":"), f.error.apply(console, arguments));
  12411. }, performance: { log: function log(e) {
  12412. var t, n;m.performance && (n = (t = new Date().getTime()) - (r || t), r = t, s.push({ Name: e[0], Arguments: [].slice.call(e, 1) || "", Element: x, "Execution Time": n })), clearTimeout(f.performance.timer), f.performance.timer = setTimeout(f.performance.display, 500);
  12413. }, display: function display() {
  12414. var t = m.name + ":",
  12415. n = 0;r = !1, clearTimeout(f.performance.timer), e.each(s, function (e, t) {
  12416. n += t["Execution Time"];
  12417. }), t += " " + n + "ms", a && (t += " '" + a + "'"), o.length > 1 && (t += " (" + o.length + ")"), (console.group !== i || console.table !== i) && s.length > 0 && (console.groupCollapsed(t), console.table ? console.table(s) : e.each(s, function (e, t) {
  12418. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  12419. }), console.groupEnd()), s = [];
  12420. } }, invoke: function invoke(t, o, a) {
  12421. var r,
  12422. s,
  12423. l,
  12424. c = C;return o = o || u, a = x || a, "string" == typeof t && c !== i && (t = t.split(/[\. ]/), r = t.length - 1, e.each(t, function (n, o) {
  12425. var a = n != r ? o + t[n + 1].charAt(0).toUpperCase() + t[n + 1].slice(1) : t;if (e.isPlainObject(c[a]) && n != r) c = c[a];else {
  12426. if (c[a] !== i) return s = c[a], !1;if (!e.isPlainObject(c[o]) || n == r) return c[o] !== i && (s = c[o], !1);c = c[o];
  12427. }
  12428. })), e.isFunction(s) ? l = s.apply(a, o) : s !== i && (l = s), e.isArray(n) ? n.push(l) : n !== i ? n = [n, l] : l !== i && (n = l), s;
  12429. } }, c ? (C === i && f.initialize(), f.invoke(l)) : (C !== i && C.invoke("destroy"), f.initialize());
  12430. }), n !== i ? n : this;
  12431. }, e.fn.rating.settings = { name: "Rating", namespace: "rating", slent: !1, debug: !1, verbose: !1, performance: !0, initialRating: 0, interactive: !0, maxRating: 4, clearable: "auto", fireOnInit: !1, onRate: function onRate(e) {}, error: { method: "The method you called is not defined", noMaximum: "No maximum rating specified. Cannot generate HTML automatically" }, metadata: { rating: "rating", maxRating: "maxRating" }, className: { active: "active", disabled: "disabled", selected: "selected", loading: "loading" }, selector: { icon: ".icon" }, templates: { icon: function icon(e) {
  12432. for (var t = 1, n = ""; t <= e;) {
  12433. n += '<i class="icon"></i>', t++;
  12434. }return n;
  12435. } } };
  12436. }(jQuery, window, document), function (e, t, n, i) {
  12437. "use strict";
  12438. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.search = function (o) {
  12439. var a,
  12440. r = e(this),
  12441. s = r.selector || "",
  12442. l = new Date().getTime(),
  12443. c = [],
  12444. u = arguments[0],
  12445. d = "string" == typeof u,
  12446. f = [].slice.call(arguments, 1);return e(this).each(function () {
  12447. var m,
  12448. g = e.isPlainObject(o) ? e.extend(!0, {}, e.fn.search.settings, o) : e.extend({}, e.fn.search.settings),
  12449. p = g.className,
  12450. h = g.metadata,
  12451. v = g.regExp,
  12452. b = g.fields,
  12453. y = g.selector,
  12454. x = g.error,
  12455. C = g.namespace,
  12456. w = "." + C,
  12457. S = C + "-module",
  12458. k = e(this),
  12459. T = k.find(y.prompt),
  12460. A = k.find(y.searchButton),
  12461. R = k.find(y.results),
  12462. P = k.find(y.result),
  12463. E = (k.find(y.category), this),
  12464. F = k.data(S),
  12465. O = !1,
  12466. D = !1;m = { initialize: function initialize() {
  12467. m.verbose("Initializing module"), m.get.settings(), m.determine.searchFields(), m.bind.events(), m.set.type(), m.create.results(), m.instantiate();
  12468. }, instantiate: function instantiate() {
  12469. m.verbose("Storing instance of module", m), F = m, k.data(S, m);
  12470. }, destroy: function destroy() {
  12471. m.verbose("Destroying instance"), k.off(w).removeData(S);
  12472. }, refresh: function refresh() {
  12473. m.debug("Refreshing selector cache"), T = k.find(y.prompt), A = k.find(y.searchButton), k.find(y.category), R = k.find(y.results), P = k.find(y.result);
  12474. }, refreshResults: function refreshResults() {
  12475. R = k.find(y.results), P = k.find(y.result);
  12476. }, bind: { events: function events() {
  12477. m.verbose("Binding events to search"), g.automatic && (k.on(m.get.inputEvent() + w, y.prompt, m.event.input), T.attr("autocomplete", "off")), k.on("focus" + w, y.prompt, m.event.focus).on("blur" + w, y.prompt, m.event.blur).on("keydown" + w, y.prompt, m.handleKeyboard).on("click" + w, y.searchButton, m.query).on("mousedown" + w, y.results, m.event.result.mousedown).on("mouseup" + w, y.results, m.event.result.mouseup).on("click" + w, y.result, m.event.result.click);
  12478. } }, determine: { searchFields: function searchFields() {
  12479. o && o.searchFields !== i && (g.searchFields = o.searchFields);
  12480. } }, event: { input: function input() {
  12481. g.searchDelay ? (clearTimeout(m.timer), m.timer = setTimeout(function () {
  12482. m.is.focused() && m.query();
  12483. }, g.searchDelay)) : m.query();
  12484. }, focus: function focus() {
  12485. m.set.focus(), g.searchOnFocus && m.has.minimumCharacters() && m.query(function () {
  12486. m.can.show() && m.showResults();
  12487. });
  12488. }, blur: function blur(e) {
  12489. var t = function t() {
  12490. m.cancel.query(), m.remove.focus(), m.timer = setTimeout(m.hideResults, g.hideDelay);
  12491. };n.activeElement === this || (D = !1, m.resultsClicked ? (m.debug("Determining if user action caused search to close"), k.one("click.close" + w, y.results, function (e) {
  12492. m.is.inMessage(e) || O ? T.focus() : (O = !1, m.is.animating() || m.is.hidden() || t());
  12493. })) : (m.debug("Input blurred without user action, closing results"), t()));
  12494. }, result: { mousedown: function mousedown() {
  12495. m.resultsClicked = !0;
  12496. }, mouseup: function mouseup() {
  12497. m.resultsClicked = !1;
  12498. }, click: function click(n) {
  12499. m.debug("Search result selected");var i = e(this),
  12500. o = i.find(y.title).eq(0),
  12501. a = i.is("a[href]") ? i : i.find("a[href]").eq(0),
  12502. r = a.attr("href") || !1,
  12503. s = a.attr("target") || !1,
  12504. l = (o.html(), o.length > 0 && o.text()),
  12505. c = m.get.results(),
  12506. u = i.data(h.result) || m.get.result(l, c);if (e.isFunction(g.onSelect) && !1 === g.onSelect.call(E, u, c)) return m.debug("Custom onSelect callback cancelled default select action"), void (O = !0);m.hideResults(), l && m.set.value(l), r && (m.verbose("Opening search link found in result", a), "_blank" == s || n.ctrlKey ? t.open(r) : t.location.href = r);
  12507. } } }, handleKeyboard: function handleKeyboard(e) {
  12508. var t,
  12509. n = k.find(y.result),
  12510. i = k.find(y.category),
  12511. o = n.filter("." + p.active),
  12512. a = n.index(o),
  12513. r = n.length,
  12514. s = o.length > 0,
  12515. l = e.which,
  12516. c = 13,
  12517. u = 38,
  12518. d = 40;if (l == 27 && (m.verbose("Escape key pressed, blurring search field"), m.hideResults(), D = !0), m.is.visible()) {
  12519. if (l == c) {
  12520. if (m.verbose("Enter key pressed, selecting active result"), n.filter("." + p.active).length > 0) return m.event.result.click.call(n.filter("." + p.active), e), e.preventDefault(), !1;
  12521. } else l == u && s ? (m.verbose("Up key pressed, changing active result"), t = a - 1 < 0 ? a : a - 1, i.removeClass(p.active), n.removeClass(p.active).eq(t).addClass(p.active).closest(i).addClass(p.active), e.preventDefault()) : l == d && (m.verbose("Down key pressed, changing active result"), t = a + 1 >= r ? a : a + 1, i.removeClass(p.active), n.removeClass(p.active).eq(t).addClass(p.active).closest(i).addClass(p.active), e.preventDefault());
  12522. } else l == c && (m.verbose("Enter key pressed, executing query"), m.query(), m.set.buttonPressed(), T.one("keyup", m.remove.buttonFocus));
  12523. }, setup: { api: function api(t, n) {
  12524. var i = { debug: g.debug, on: !1, cache: g.cache, action: "search", urlData: { query: t }, onSuccess: function onSuccess(e) {
  12525. m.parse.response.call(E, e, t), n();
  12526. }, onFailure: function onFailure() {
  12527. m.displayMessage(x.serverError), n();
  12528. }, onAbort: function onAbort(e) {}, onError: m.error };e.extend(!0, i, g.apiSettings), m.verbose("Setting up API request", i), k.api(i);
  12529. } }, can: { useAPI: function useAPI() {
  12530. return e.fn.api !== i;
  12531. }, show: function show() {
  12532. return m.is.focused() && !m.is.visible() && !m.is.empty();
  12533. }, transition: function transition() {
  12534. return g.transition && e.fn.transition !== i && k.transition("is supported");
  12535. } }, is: { animating: function animating() {
  12536. return R.hasClass(p.animating);
  12537. }, hidden: function hidden() {
  12538. return R.hasClass(p.hidden);
  12539. }, inMessage: function inMessage(t) {
  12540. if (t.target) {
  12541. var i = e(t.target);return e.contains(n.documentElement, t.target) && i.closest(y.message).length > 0;
  12542. }
  12543. }, empty: function empty() {
  12544. return "" === R.html();
  12545. }, visible: function visible() {
  12546. return R.filter(":visible").length > 0;
  12547. }, focused: function focused() {
  12548. return T.filter(":focus").length > 0;
  12549. } }, get: { settings: function settings() {
  12550. e.isPlainObject(o) && o.searchFullText && (g.fullTextSearch = o.searchFullText, m.error(g.error.oldSearchSyntax, E));
  12551. }, inputEvent: function inputEvent() {
  12552. var e = T[0];return e !== i && e.oninput !== i ? "input" : e !== i && e.onpropertychange !== i ? "propertychange" : "keyup";
  12553. }, value: function value() {
  12554. return T.val();
  12555. }, results: function results() {
  12556. return k.data(h.results);
  12557. }, result: function result(t, n) {
  12558. var o = ["title", "id"],
  12559. a = !1;return t = t !== i ? t : m.get.value(), n = n !== i ? n : m.get.results(), "category" === g.type ? (m.debug("Finding result that matches", t), e.each(n, function (n, i) {
  12560. if (e.isArray(i.results) && (a = m.search.object(t, i.results, o)[0])) return !1;
  12561. })) : (m.debug("Finding result in results object", t), a = m.search.object(t, n, o)[0]), a || !1;
  12562. } }, select: { firstResult: function firstResult() {
  12563. m.verbose("Selecting first result"), P.first().addClass(p.active);
  12564. } }, set: { focus: function focus() {
  12565. k.addClass(p.focus);
  12566. }, loading: function loading() {
  12567. k.addClass(p.loading);
  12568. }, value: function value(e) {
  12569. m.verbose("Setting search input value", e), T.val(e);
  12570. }, type: function type(e) {
  12571. e = e || g.type, "category" == g.type && k.addClass(g.type);
  12572. }, buttonPressed: function buttonPressed() {
  12573. A.addClass(p.pressed);
  12574. } }, remove: { loading: function loading() {
  12575. k.removeClass(p.loading);
  12576. }, focus: function focus() {
  12577. k.removeClass(p.focus);
  12578. }, buttonPressed: function buttonPressed() {
  12579. A.removeClass(p.pressed);
  12580. } }, query: function query(t) {
  12581. t = e.isFunction(t) ? t : function () {};var n = m.get.value(),
  12582. i = m.read.cache(n);t = t || function () {}, m.has.minimumCharacters() ? (i ? (m.debug("Reading result from cache", n), m.save.results(i.results), m.addResults(i.html), m.inject.id(i.results), t()) : (m.debug("Querying for", n), e.isPlainObject(g.source) || e.isArray(g.source) ? (m.search.local(n), t()) : m.can.useAPI() ? m.search.remote(n, t) : (m.error(x.source), t())), g.onSearchQuery.call(E, n)) : m.hideResults();
  12583. }, search: { local: function local(e) {
  12584. var t,
  12585. n = m.search.object(e, g.content);m.set.loading(), m.save.results(n), m.debug("Returned full local search results", n), g.maxResults > 0 && (m.debug("Using specified max results", n), n = n.slice(0, g.maxResults)), "category" == g.type && (n = m.create.categoryResults(n)), t = m.generateResults({ results: n }), m.remove.loading(), m.addResults(t), m.inject.id(n), m.write.cache(e, { html: t, results: n });
  12586. }, remote: function remote(t, n) {
  12587. n = e.isFunction(n) ? n : function () {}, k.api("is loading") && k.api("abort"), m.setup.api(t, n), k.api("query");
  12588. }, object: function object(t, n, o) {
  12589. var a = [],
  12590. r = [],
  12591. s = [],
  12592. l = t.toString().replace(v.escape, "\\$&"),
  12593. c = new RegExp(v.beginsWith + l, "i"),
  12594. u = function u(t, n) {
  12595. var i = -1 == e.inArray(n, a),
  12596. o = -1 == e.inArray(n, s),
  12597. l = -1 == e.inArray(n, r);i && o && l && t.push(n);
  12598. };return n = n || g.source, o = o !== i ? o : g.searchFields, e.isArray(o) || (o = [o]), n === i || !1 === n ? (m.error(x.source), []) : (e.each(o, function (i, o) {
  12599. e.each(n, function (e, n) {
  12600. "string" == typeof n[o] && (-1 !== n[o].search(c) ? u(a, n) : "exact" === g.fullTextSearch && m.exactSearch(t, n[o]) ? u(r, n) : 1 == g.fullTextSearch && m.fuzzySearch(t, n[o]) && u(s, n));
  12601. });
  12602. }), e.merge(r, s), e.merge(a, r), a);
  12603. } }, exactSearch: function exactSearch(e, t) {
  12604. return e = e.toLowerCase(), (t = t.toLowerCase()).indexOf(e) > -1;
  12605. }, fuzzySearch: function fuzzySearch(e, t) {
  12606. var n = t.length,
  12607. i = e.length;if ("string" != typeof e) return !1;if (e = e.toLowerCase(), t = t.toLowerCase(), i > n) return !1;if (i === n) return e === t;e: for (var o = 0, a = 0; o < i; o++) {
  12608. for (var r = e.charCodeAt(o); a < n;) {
  12609. if (t.charCodeAt(a++) === r) continue e;
  12610. }return !1;
  12611. }return !0;
  12612. }, parse: { response: function response(e, t) {
  12613. var n = m.generateResults(e);m.verbose("Parsing server response", e), e !== i && t !== i && e[b.results] !== i && (m.addResults(n), m.inject.id(e[b.results]), m.write.cache(t, { html: n, results: e[b.results] }), m.save.results(e[b.results]));
  12614. } }, cancel: { query: function query() {
  12615. m.can.useAPI() && k.api("abort");
  12616. } }, has: { minimumCharacters: function minimumCharacters() {
  12617. return m.get.value().length >= g.minCharacters;
  12618. }, results: function results() {
  12619. return 0 !== R.length && "" != R.html();
  12620. } }, clear: { cache: function cache(e) {
  12621. var t = k.data(h.cache);e ? e && t && t[e] && (m.debug("Removing value from cache", e), delete t[e], k.data(h.cache, t)) : (m.debug("Clearing cache", e), k.removeData(h.cache));
  12622. } }, read: { cache: function cache(e) {
  12623. var t = k.data(h.cache);return !!g.cache && (m.verbose("Checking cache for generated html for query", e), "object" == (typeof t === "undefined" ? "undefined" : _typeof(t)) && t[e] !== i && t[e]);
  12624. } }, create: { categoryResults: function categoryResults(t) {
  12625. var n = {};return e.each(t, function (e, t) {
  12626. t.category && (n[t.category] === i ? (m.verbose("Creating new category of results", t.category), n[t.category] = { name: t.category, results: [t] }) : n[t.category].results.push(t));
  12627. }), n;
  12628. }, id: function id(e, t) {
  12629. var n,
  12630. o = e + 1;return t !== i ? (n = String.fromCharCode(97 + t) + o, m.verbose("Creating category result id", n)) : (n = o, m.verbose("Creating result id", n)), n;
  12631. }, results: function results() {
  12632. 0 === R.length && (R = e("<div />").addClass(p.results).appendTo(k));
  12633. } }, inject: { result: function result(e, t, n) {
  12634. m.verbose("Injecting result into results");var o = n !== i ? R.children().eq(n).children(y.results).first().children(y.result).eq(t) : R.children(y.result).eq(t);m.verbose("Injecting results metadata", o), o.data(h.result, e);
  12635. }, id: function id(t) {
  12636. m.debug("Injecting unique ids into results");var n = 0,
  12637. o = 0;return "category" === g.type ? e.each(t, function (t, a) {
  12638. o = 0, e.each(a.results, function (e, t) {
  12639. var r = a.results[e];r.id === i && (r.id = m.create.id(o, n)), m.inject.result(r, o, n), o++;
  12640. }), n++;
  12641. }) : e.each(t, function (e, n) {
  12642. var a = t[e];a.id === i && (a.id = m.create.id(o)), m.inject.result(a, o), o++;
  12643. }), t;
  12644. } }, save: { results: function results(e) {
  12645. m.verbose("Saving current search results to metadata", e), k.data(h.results, e);
  12646. } }, write: { cache: function cache(e, t) {
  12647. var n = k.data(h.cache) !== i ? k.data(h.cache) : {};g.cache && (m.verbose("Writing generated html to cache", e, t), n[e] = t, k.data(h.cache, n));
  12648. } }, addResults: function addResults(t) {
  12649. if (e.isFunction(g.onResultsAdd) && !1 === g.onResultsAdd.call(R, t)) return m.debug("onResultsAdd callback cancelled default action"), !1;t ? (R.html(t), m.refreshResults(), g.selectFirstResult && m.select.firstResult(), m.showResults()) : m.hideResults(function () {
  12650. R.empty();
  12651. });
  12652. }, showResults: function showResults(t) {
  12653. t = e.isFunction(t) ? t : function () {}, D || !m.is.visible() && m.has.results() && (m.can.transition() ? (m.debug("Showing results with css animations"), R.transition({ animation: g.transition + " in", debug: g.debug, verbose: g.verbose, duration: g.duration, onComplete: function onComplete() {
  12654. t();
  12655. }, queue: !0 })) : (m.debug("Showing results with javascript"), R.stop().fadeIn(g.duration, g.easing)), g.onResultsOpen.call(R));
  12656. }, hideResults: function hideResults(t) {
  12657. t = e.isFunction(t) ? t : function () {}, m.is.visible() && (m.can.transition() ? (m.debug("Hiding results with css animations"), R.transition({ animation: g.transition + " out", debug: g.debug, verbose: g.verbose, duration: g.duration, onComplete: function onComplete() {
  12658. t();
  12659. }, queue: !0 })) : (m.debug("Hiding results with javascript"), R.stop().fadeOut(g.duration, g.easing)), g.onResultsClose.call(R));
  12660. }, generateResults: function generateResults(t) {
  12661. m.debug("Generating html from response", t);var n = g.templates[g.type],
  12662. i = e.isPlainObject(t[b.results]) && !e.isEmptyObject(t[b.results]),
  12663. o = e.isArray(t[b.results]) && t[b.results].length > 0,
  12664. a = "";return i || o ? (g.maxResults > 0 && (i ? "standard" == g.type && m.error(x.maxResults) : t[b.results] = t[b.results].slice(0, g.maxResults)), e.isFunction(n) ? a = n(t, b) : m.error(x.noTemplate, !1)) : g.showNoResults && (a = m.displayMessage(x.noResults, "empty")), g.onResults.call(E, t), a;
  12665. }, displayMessage: function displayMessage(e, t) {
  12666. return t = t || "standard", m.debug("Displaying message", e, t), m.addResults(g.templates.message(e, t)), g.templates.message(e, t);
  12667. }, setting: function setting(t, n) {
  12668. if (e.isPlainObject(t)) e.extend(!0, g, t);else {
  12669. if (n === i) return g[t];g[t] = n;
  12670. }
  12671. }, internal: function internal(t, n) {
  12672. if (e.isPlainObject(t)) e.extend(!0, m, t);else {
  12673. if (n === i) return m[t];m[t] = n;
  12674. }
  12675. }, debug: function debug() {
  12676. !g.silent && g.debug && (g.performance ? m.performance.log(arguments) : (m.debug = Function.prototype.bind.call(console.info, console, g.name + ":"), m.debug.apply(console, arguments)));
  12677. }, verbose: function verbose() {
  12678. !g.silent && g.verbose && g.debug && (g.performance ? m.performance.log(arguments) : (m.verbose = Function.prototype.bind.call(console.info, console, g.name + ":"), m.verbose.apply(console, arguments)));
  12679. }, error: function error() {
  12680. g.silent || (m.error = Function.prototype.bind.call(console.error, console, g.name + ":"), m.error.apply(console, arguments));
  12681. }, performance: { log: function log(e) {
  12682. var t, n;g.performance && (n = (t = new Date().getTime()) - (l || t), l = t, c.push({ Name: e[0], Arguments: [].slice.call(e, 1) || "", Element: E, "Execution Time": n })), clearTimeout(m.performance.timer), m.performance.timer = setTimeout(m.performance.display, 500);
  12683. }, display: function display() {
  12684. var t = g.name + ":",
  12685. n = 0;l = !1, clearTimeout(m.performance.timer), e.each(c, function (e, t) {
  12686. n += t["Execution Time"];
  12687. }), t += " " + n + "ms", s && (t += " '" + s + "'"), r.length > 1 && (t += " (" + r.length + ")"), (console.group !== i || console.table !== i) && c.length > 0 && (console.groupCollapsed(t), console.table ? console.table(c) : e.each(c, function (e, t) {
  12688. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  12689. }), console.groupEnd()), c = [];
  12690. } }, invoke: function invoke(t, n, o) {
  12691. var r,
  12692. s,
  12693. l,
  12694. c = F;return n = n || f, o = E || o, "string" == typeof t && c !== i && (t = t.split(/[\. ]/), r = t.length - 1, e.each(t, function (n, o) {
  12695. var a = n != r ? o + t[n + 1].charAt(0).toUpperCase() + t[n + 1].slice(1) : t;if (e.isPlainObject(c[a]) && n != r) c = c[a];else {
  12696. if (c[a] !== i) return s = c[a], !1;if (!e.isPlainObject(c[o]) || n == r) return c[o] !== i && (s = c[o], !1);c = c[o];
  12697. }
  12698. })), e.isFunction(s) ? l = s.apply(o, n) : s !== i && (l = s), e.isArray(a) ? a.push(l) : a !== i ? a = [a, l] : l !== i && (a = l), s;
  12699. } }, d ? (F === i && m.initialize(), m.invoke(u)) : (F !== i && F.invoke("destroy"), m.initialize());
  12700. }), a !== i ? a : this;
  12701. }, e.fn.search.settings = { name: "Search", namespace: "search", silent: !1, debug: !1, verbose: !1, performance: !0, type: "standard", minCharacters: 1, selectFirstResult: !1, apiSettings: !1, source: !1, searchOnFocus: !0, searchFields: ["title", "description"], displayField: "", fullTextSearch: "exact", automatic: !0, hideDelay: 0, searchDelay: 200, maxResults: 7, cache: !0, showNoResults: !0, transition: "scale", duration: 200, easing: "easeOutExpo", onSelect: !1, onResultsAdd: !1, onSearchQuery: function onSearchQuery(e) {}, onResults: function onResults(e) {}, onResultsOpen: function onResultsOpen() {}, onResultsClose: function onResultsClose() {}, className: { animating: "animating", active: "active", empty: "empty", focus: "focus", hidden: "hidden", loading: "loading", results: "results", pressed: "down" }, error: { source: "Cannot search. No source used, and Semantic API module was not included", noResults: "Your search returned no results", logging: "Error in debug logging, exiting.", noEndpoint: "No search endpoint was specified", noTemplate: "A valid template name was not specified.", oldSearchSyntax: "searchFullText setting has been renamed fullTextSearch for consistency, please adjust your settings.", serverError: "There was an issue querying the server.", maxResults: "Results must be an array to use maxResults setting", method: "The method you called is not defined." }, metadata: { cache: "cache", results: "results", result: "result" }, regExp: { escape: /[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, beginsWith: "(?:s|^)" }, fields: { categories: "results", categoryName: "name", categoryResults: "results", description: "description", image: "image", price: "price", results: "results", title: "title", url: "url", action: "action", actionText: "text", actionURL: "url" }, selector: { prompt: ".prompt", searchButton: ".search.button", results: ".results", message: ".results > .message", category: ".category", result: ".result", title: ".title, .name" }, templates: { escape: function escape(e) {
  12702. var t = { "&": "&amp;", "<": "&lt;", ">": "&gt;", '"': "&quot;", "'": "&#x27;", "`": "&#x60;" };return (/[&<>"'`]/.test(e) ? e.replace(/[&<>"'`]/g, function (e) {
  12703. return t[e];
  12704. }) : e
  12705. );
  12706. }, message: function message(e, t) {
  12707. var n = "";return e !== i && t !== i && (n += '<div class="message ' + t + '">', n += "empty" == t ? '<div class="header">No Results</div class="header"><div class="description">' + e + '</div class="description">' : ' <div class="description">' + e + "</div>", n += "</div>"), n;
  12708. }, category: function category(t, n) {
  12709. var o = "";e.fn.search.settings.templates.escape;return t[n.categoryResults] !== i && (e.each(t[n.categoryResults], function (t, a) {
  12710. a[n.results] !== i && a.results.length > 0 && (o += '<div class="category">', a[n.categoryName] !== i && (o += '<div class="name">' + a[n.categoryName] + "</div>"), o += '<div class="results">', e.each(a.results, function (e, t) {
  12711. t[n.url] ? o += '<a class="result" href="' + t[n.url] + '">' : o += '<a class="result">', t[n.image] !== i && (o += '<div class="image"> <img src="' + t[n.image] + '"></div>'), o += '<div class="content">', t[n.price] !== i && (o += '<div class="price">' + t[n.price] + "</div>"), t[n.title] !== i && (o += '<div class="title">' + t[n.title] + "</div>"), t[n.description] !== i && (o += '<div class="description">' + t[n.description] + "</div>"), o += "</div>", o += "</a>";
  12712. }), o += "</div>", o += "</div>");
  12713. }), t[n.action] && (o += '<a href="' + t[n.action][n.actionURL] + '" class="action">' + t[n.action][n.actionText] + "</a>"), o);
  12714. }, standard: function standard(t, n) {
  12715. var o = "";return t[n.results] !== i && (e.each(t[n.results], function (e, t) {
  12716. t[n.url] ? o += '<a class="result" href="' + t[n.url] + '">' : o += '<a class="result">', t[n.image] !== i && (o += '<div class="image"> <img src="' + t[n.image] + '"></div>'), o += '<div class="content">', t[n.price] !== i && (o += '<div class="price">' + t[n.price] + "</div>"), t[n.title] !== i && (o += '<div class="title">' + t[n.title] + "</div>"), t[n.description] !== i && (o += '<div class="description">' + t[n.description] + "</div>"), o += "</div>", o += "</a>";
  12717. }), t[n.action] && (o += '<a href="' + t[n.action][n.actionURL] + '" class="action">' + t[n.action][n.actionText] + "</a>"), o);
  12718. } } };
  12719. }(jQuery, window, document), function (e, t, n, i) {
  12720. "use strict";
  12721. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.shape = function (o) {
  12722. var a,
  12723. r = e(this),
  12724. s = (e("body"), new Date().getTime()),
  12725. l = [],
  12726. c = arguments[0],
  12727. u = "string" == typeof c,
  12728. d = [].slice.call(arguments, 1),
  12729. f = t.requestAnimationFrame || t.mozRequestAnimationFrame || t.webkitRequestAnimationFrame || t.msRequestAnimationFrame || function (e) {
  12730. setTimeout(e, 0);
  12731. };return r.each(function () {
  12732. var t,
  12733. m,
  12734. g,
  12735. p = r.selector || "",
  12736. h = e.isPlainObject(o) ? e.extend(!0, {}, e.fn.shape.settings, o) : e.extend({}, e.fn.shape.settings),
  12737. v = h.namespace,
  12738. b = h.selector,
  12739. y = h.error,
  12740. x = h.className,
  12741. C = "." + v,
  12742. w = "module-" + v,
  12743. S = e(this),
  12744. k = S.find(b.sides),
  12745. T = S.find(b.side),
  12746. A = !1,
  12747. R = this,
  12748. P = S.data(w);g = { initialize: function initialize() {
  12749. g.verbose("Initializing module for", R), g.set.defaultSide(), g.instantiate();
  12750. }, instantiate: function instantiate() {
  12751. g.verbose("Storing instance of module", g), P = g, S.data(w, P);
  12752. }, destroy: function destroy() {
  12753. g.verbose("Destroying previous module for", R), S.removeData(w).off(C);
  12754. }, refresh: function refresh() {
  12755. g.verbose("Refreshing selector cache for", R), S = e(R), k = e(this).find(b.shape), T = e(this).find(b.side);
  12756. }, repaint: function repaint() {
  12757. g.verbose("Forcing repaint event");(k[0] || n.createElement("div")).offsetWidth;
  12758. }, animate: function animate(e, n) {
  12759. g.verbose("Animating box with properties", e), n = n || function (e) {
  12760. g.verbose("Executing animation callback"), e !== i && e.stopPropagation(), g.reset(), g.set.active();
  12761. }, h.beforeChange.call(m[0]), g.get.transitionEvent() ? (g.verbose("Starting CSS animation"), S.addClass(x.animating), k.css(e).one(g.get.transitionEvent(), n), g.set.duration(h.duration), f(function () {
  12762. S.addClass(x.animating), t.addClass(x.hidden);
  12763. })) : n();
  12764. }, queue: function queue(e) {
  12765. g.debug("Queueing animation of", e), k.one(g.get.transitionEvent(), function () {
  12766. g.debug("Executing queued animation"), setTimeout(function () {
  12767. S.shape(e);
  12768. }, 0);
  12769. });
  12770. }, reset: function reset() {
  12771. g.verbose("Animating states reset"), S.removeClass(x.animating).attr("style", "").removeAttr("style"), k.attr("style", "").removeAttr("style"), T.attr("style", "").removeAttr("style").removeClass(x.hidden), m.removeClass(x.animating).attr("style", "").removeAttr("style");
  12772. }, is: { complete: function complete() {
  12773. return T.filter("." + x.active)[0] == m[0];
  12774. }, animating: function animating() {
  12775. return S.hasClass(x.animating);
  12776. } }, set: { defaultSide: function defaultSide() {
  12777. t = S.find("." + h.className.active), m = t.next(b.side).length > 0 ? t.next(b.side) : S.find(b.side).first(), A = !1, g.verbose("Active side set to", t), g.verbose("Next side set to", m);
  12778. }, duration: function duration(e) {
  12779. e = "number" == typeof (e = e || h.duration) ? e + "ms" : e, g.verbose("Setting animation duration", e), (h.duration || 0 === h.duration) && k.add(T).css({ "-webkit-transition-duration": e, "-moz-transition-duration": e, "-ms-transition-duration": e, "-o-transition-duration": e, "transition-duration": e });
  12780. }, currentStageSize: function currentStageSize() {
  12781. var e = S.find("." + h.className.active),
  12782. t = e.outerWidth(!0),
  12783. n = e.outerHeight(!0);S.css({ width: t, height: n });
  12784. }, stageSize: function stageSize() {
  12785. var e = S.clone().addClass(x.loading),
  12786. t = e.find("." + h.className.active),
  12787. n = A ? e.find(b.side).eq(A) : t.next(b.side).length > 0 ? t.next(b.side) : e.find(b.side).first(),
  12788. i = "next" == h.width ? n.outerWidth(!0) : "initial" == h.width ? S.width() : h.width,
  12789. o = "next" == h.height ? n.outerHeight(!0) : "initial" == h.height ? S.height() : h.height;t.removeClass(x.active), n.addClass(x.active), e.insertAfter(S), e.remove(), "auto" != h.width && (S.css("width", i + h.jitter), g.verbose("Specifying width during animation", i)), "auto" != h.height && (S.css("height", o + h.jitter), g.verbose("Specifying height during animation", o));
  12790. }, nextSide: function nextSide(e) {
  12791. A = e, m = T.filter(e), A = T.index(m), 0 === m.length && (g.set.defaultSide(), g.error(y.side)), g.verbose("Next side manually set to", m);
  12792. }, active: function active() {
  12793. g.verbose("Setting new side to active", m), T.removeClass(x.active), m.addClass(x.active), h.onChange.call(m[0]), g.set.defaultSide();
  12794. } }, flip: { up: function up() {
  12795. if (!g.is.complete() || g.is.animating() || h.allowRepeats) {
  12796. if (g.is.animating()) g.queue("flip up");else {
  12797. g.debug("Flipping up", m);var e = g.get.transform.up();g.set.stageSize(), g.stage.above(), g.animate(e);
  12798. }
  12799. } else g.debug("Side already visible", m);
  12800. }, down: function down() {
  12801. if (!g.is.complete() || g.is.animating() || h.allowRepeats) {
  12802. if (g.is.animating()) g.queue("flip down");else {
  12803. g.debug("Flipping down", m);var e = g.get.transform.down();g.set.stageSize(), g.stage.below(), g.animate(e);
  12804. }
  12805. } else g.debug("Side already visible", m);
  12806. }, left: function left() {
  12807. if (!g.is.complete() || g.is.animating() || h.allowRepeats) {
  12808. if (g.is.animating()) g.queue("flip left");else {
  12809. g.debug("Flipping left", m);var e = g.get.transform.left();g.set.stageSize(), g.stage.left(), g.animate(e);
  12810. }
  12811. } else g.debug("Side already visible", m);
  12812. }, right: function right() {
  12813. if (!g.is.complete() || g.is.animating() || h.allowRepeats) {
  12814. if (g.is.animating()) g.queue("flip right");else {
  12815. g.debug("Flipping right", m);var e = g.get.transform.right();g.set.stageSize(), g.stage.right(), g.animate(e);
  12816. }
  12817. } else g.debug("Side already visible", m);
  12818. }, over: function over() {
  12819. !g.is.complete() || g.is.animating() || h.allowRepeats ? g.is.animating() ? g.queue("flip over") : (g.debug("Flipping over", m), g.set.stageSize(), g.stage.behind(), g.animate(g.get.transform.over())) : g.debug("Side already visible", m);
  12820. }, back: function back() {
  12821. !g.is.complete() || g.is.animating() || h.allowRepeats ? g.is.animating() ? g.queue("flip back") : (g.debug("Flipping back", m), g.set.stageSize(), g.stage.behind(), g.animate(g.get.transform.back())) : g.debug("Side already visible", m);
  12822. } }, get: { transform: { up: function up() {
  12823. return { transform: "translateY(" + -(t.outerHeight(!0) - m.outerHeight(!0)) / 2 + "px) translateZ(" + -t.outerHeight(!0) / 2 + "px) rotateX(-90deg)" };
  12824. }, down: function down() {
  12825. return { transform: "translateY(" + -(t.outerHeight(!0) - m.outerHeight(!0)) / 2 + "px) translateZ(" + -t.outerHeight(!0) / 2 + "px) rotateX(90deg)" };
  12826. }, left: function left() {
  12827. return { transform: "translateX(" + -(t.outerWidth(!0) - m.outerWidth(!0)) / 2 + "px) translateZ(" + -t.outerWidth(!0) / 2 + "px) rotateY(90deg)" };
  12828. }, right: function right() {
  12829. return { transform: "translateX(" + -(t.outerWidth(!0) - m.outerWidth(!0)) / 2 + "px) translateZ(" + -t.outerWidth(!0) / 2 + "px) rotateY(-90deg)" };
  12830. }, over: function over() {
  12831. return { transform: "translateX(" + -(t.outerWidth(!0) - m.outerWidth(!0)) / 2 + "px) rotateY(180deg)" };
  12832. }, back: function back() {
  12833. return { transform: "translateX(" + -(t.outerWidth(!0) - m.outerWidth(!0)) / 2 + "px) rotateY(-180deg)" };
  12834. } }, transitionEvent: function transitionEvent() {
  12835. var e,
  12836. t = n.createElement("element"),
  12837. o = { transition: "transitionend", OTransition: "oTransitionEnd", MozTransition: "transitionend", WebkitTransition: "webkitTransitionEnd" };for (e in o) {
  12838. if (t.style[e] !== i) return o[e];
  12839. }
  12840. }, nextSide: function nextSide() {
  12841. return t.next(b.side).length > 0 ? t.next(b.side) : S.find(b.side).first();
  12842. } }, stage: { above: function above() {
  12843. var e = { origin: (t.outerHeight(!0) - m.outerHeight(!0)) / 2, depth: { active: m.outerHeight(!0) / 2, next: t.outerHeight(!0) / 2 } };g.verbose("Setting the initial animation position as above", m, e), k.css({ transform: "translateZ(-" + e.depth.active + "px)" }), t.css({ transform: "rotateY(0deg) translateZ(" + e.depth.active + "px)" }), m.addClass(x.animating).css({ top: e.origin + "px", transform: "rotateX(90deg) translateZ(" + e.depth.next + "px)" });
  12844. }, below: function below() {
  12845. var e = { origin: (t.outerHeight(!0) - m.outerHeight(!0)) / 2, depth: { active: m.outerHeight(!0) / 2, next: t.outerHeight(!0) / 2 } };g.verbose("Setting the initial animation position as below", m, e), k.css({ transform: "translateZ(-" + e.depth.active + "px)" }), t.css({ transform: "rotateY(0deg) translateZ(" + e.depth.active + "px)" }), m.addClass(x.animating).css({ top: e.origin + "px", transform: "rotateX(-90deg) translateZ(" + e.depth.next + "px)" });
  12846. }, left: function left() {
  12847. var e = t.outerWidth(!0),
  12848. n = m.outerWidth(!0),
  12849. i = { origin: (e - n) / 2, depth: { active: n / 2, next: e / 2 } };g.verbose("Setting the initial animation position as left", m, i), k.css({ transform: "translateZ(-" + i.depth.active + "px)" }), t.css({ transform: "rotateY(0deg) translateZ(" + i.depth.active + "px)" }), m.addClass(x.animating).css({ left: i.origin + "px", transform: "rotateY(-90deg) translateZ(" + i.depth.next + "px)" });
  12850. }, right: function right() {
  12851. var e = t.outerWidth(!0),
  12852. n = m.outerWidth(!0),
  12853. i = { origin: (e - n) / 2, depth: { active: n / 2, next: e / 2 } };g.verbose("Setting the initial animation position as left", m, i), k.css({ transform: "translateZ(-" + i.depth.active + "px)" }), t.css({ transform: "rotateY(0deg) translateZ(" + i.depth.active + "px)" }), m.addClass(x.animating).css({ left: i.origin + "px", transform: "rotateY(90deg) translateZ(" + i.depth.next + "px)" });
  12854. }, behind: function behind() {
  12855. var e = t.outerWidth(!0),
  12856. n = m.outerWidth(!0),
  12857. i = { origin: (e - n) / 2, depth: { active: n / 2, next: e / 2 } };g.verbose("Setting the initial animation position as behind", m, i), t.css({ transform: "rotateY(0deg)" }), m.addClass(x.animating).css({ left: i.origin + "px", transform: "rotateY(-180deg)" });
  12858. } }, setting: function setting(t, n) {
  12859. if (g.debug("Changing setting", t, n), e.isPlainObject(t)) e.extend(!0, h, t);else {
  12860. if (n === i) return h[t];e.isPlainObject(h[t]) ? e.extend(!0, h[t], n) : h[t] = n;
  12861. }
  12862. }, internal: function internal(t, n) {
  12863. if (e.isPlainObject(t)) e.extend(!0, g, t);else {
  12864. if (n === i) return g[t];g[t] = n;
  12865. }
  12866. }, debug: function debug() {
  12867. !h.silent && h.debug && (h.performance ? g.performance.log(arguments) : (g.debug = Function.prototype.bind.call(console.info, console, h.name + ":"), g.debug.apply(console, arguments)));
  12868. }, verbose: function verbose() {
  12869. !h.silent && h.verbose && h.debug && (h.performance ? g.performance.log(arguments) : (g.verbose = Function.prototype.bind.call(console.info, console, h.name + ":"), g.verbose.apply(console, arguments)));
  12870. }, error: function error() {
  12871. h.silent || (g.error = Function.prototype.bind.call(console.error, console, h.name + ":"), g.error.apply(console, arguments));
  12872. }, performance: { log: function log(e) {
  12873. var t, n;h.performance && (n = (t = new Date().getTime()) - (s || t), s = t, l.push({ Name: e[0], Arguments: [].slice.call(e, 1) || "", Element: R, "Execution Time": n })), clearTimeout(g.performance.timer), g.performance.timer = setTimeout(g.performance.display, 500);
  12874. }, display: function display() {
  12875. var t = h.name + ":",
  12876. n = 0;s = !1, clearTimeout(g.performance.timer), e.each(l, function (e, t) {
  12877. n += t["Execution Time"];
  12878. }), t += " " + n + "ms", p && (t += " '" + p + "'"), r.length > 1 && (t += " (" + r.length + ")"), (console.group !== i || console.table !== i) && l.length > 0 && (console.groupCollapsed(t), console.table ? console.table(l) : e.each(l, function (e, t) {
  12879. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  12880. }), console.groupEnd()), l = [];
  12881. } }, invoke: function invoke(t, n, o) {
  12882. var r,
  12883. s,
  12884. l,
  12885. c = P;return n = n || d, o = R || o, "string" == typeof t && c !== i && (t = t.split(/[\. ]/), r = t.length - 1, e.each(t, function (n, o) {
  12886. var a = n != r ? o + t[n + 1].charAt(0).toUpperCase() + t[n + 1].slice(1) : t;if (e.isPlainObject(c[a]) && n != r) c = c[a];else {
  12887. if (c[a] !== i) return s = c[a], !1;if (!e.isPlainObject(c[o]) || n == r) return c[o] !== i && (s = c[o], !1);c = c[o];
  12888. }
  12889. })), e.isFunction(s) ? l = s.apply(o, n) : s !== i && (l = s), e.isArray(a) ? a.push(l) : a !== i ? a = [a, l] : l !== i && (a = l), s;
  12890. } }, u ? (P === i && g.initialize(), g.invoke(c)) : (P !== i && P.invoke("destroy"), g.initialize());
  12891. }), a !== i ? a : this;
  12892. }, e.fn.shape.settings = { name: "Shape", silent: !1, debug: !1, verbose: !1, jitter: 0, performance: !0, namespace: "shape", width: "initial", height: "initial", beforeChange: function beforeChange() {}, onChange: function onChange() {}, allowRepeats: !1, duration: !1, error: { side: "You tried to switch to a side that does not exist.", method: "The method you called is not defined" }, className: { animating: "animating", hidden: "hidden", loading: "loading", active: "active" }, selector: { sides: ".sides", side: ".side" } };
  12893. }(jQuery, window, document), function (e, t, n, i) {
  12894. "use strict";
  12895. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.sidebar = function (o) {
  12896. var a,
  12897. r = e(this),
  12898. s = e(t),
  12899. l = e(n),
  12900. c = e("html"),
  12901. u = e("head"),
  12902. d = r.selector || "",
  12903. f = new Date().getTime(),
  12904. m = [],
  12905. g = arguments[0],
  12906. p = "string" == typeof g,
  12907. h = [].slice.call(arguments, 1),
  12908. v = t.requestAnimationFrame || t.mozRequestAnimationFrame || t.webkitRequestAnimationFrame || t.msRequestAnimationFrame || function (e) {
  12909. setTimeout(e, 0);
  12910. };return r.each(function () {
  12911. var r,
  12912. b,
  12913. y,
  12914. x,
  12915. C,
  12916. w,
  12917. S = e.isPlainObject(o) ? e.extend(!0, {}, e.fn.sidebar.settings, o) : e.extend({}, e.fn.sidebar.settings),
  12918. k = S.selector,
  12919. T = S.className,
  12920. A = S.namespace,
  12921. R = S.regExp,
  12922. P = S.error,
  12923. E = "." + A,
  12924. F = "module-" + A,
  12925. O = e(this),
  12926. D = e(S.context),
  12927. q = O.children(k.sidebar),
  12928. j = (D.children(k.fixed), D.children(k.pusher)),
  12929. z = this,
  12930. I = O.data(F);w = { initialize: function initialize() {
  12931. w.debug("Initializing sidebar", o), w.create.id(), C = w.get.transitionEvent(), S.delaySetup ? v(w.setup.layout) : w.setup.layout(), v(function () {
  12932. w.setup.cache();
  12933. }), w.instantiate();
  12934. }, instantiate: function instantiate() {
  12935. w.verbose("Storing instance of module", w), I = w, O.data(F, w);
  12936. }, create: { id: function id() {
  12937. y = (Math.random().toString(16) + "000000000").substr(2, 8), b = "." + y, w.verbose("Creating unique id for element", y);
  12938. } }, destroy: function destroy() {
  12939. w.verbose("Destroying previous module for", O), O.off(E).removeData(F), w.is.ios() && w.remove.ios(), D.off(b), s.off(b), l.off(b);
  12940. }, event: { clickaway: function clickaway(e) {
  12941. var t = j.find(e.target).length > 0 || j.is(e.target),
  12942. n = D.is(e.target);t && (w.verbose("User clicked on dimmed page"), w.hide()), n && (w.verbose("User clicked on dimmable context (scaled out page)"), w.hide());
  12943. }, touch: function touch(e) {}, containScroll: function containScroll(e) {
  12944. z.scrollTop <= 0 && (z.scrollTop = 1), z.scrollTop + z.offsetHeight >= z.scrollHeight && (z.scrollTop = z.scrollHeight - z.offsetHeight - 1);
  12945. }, scroll: function scroll(t) {
  12946. 0 === e(t.target).closest(k.sidebar).length && t.preventDefault();
  12947. } }, bind: { clickaway: function clickaway() {
  12948. w.verbose("Adding clickaway events to context", D), S.closable && D.on("click" + b, w.event.clickaway).on("touchend" + b, w.event.clickaway);
  12949. }, scrollLock: function scrollLock() {
  12950. S.scrollLock && (w.debug("Disabling page scroll"), s.on("DOMMouseScroll" + b, w.event.scroll)), w.verbose("Adding events to contain sidebar scroll"), l.on("touchmove" + b, w.event.touch), O.on("scroll" + E, w.event.containScroll);
  12951. } }, unbind: { clickaway: function clickaway() {
  12952. w.verbose("Removing clickaway events from context", D), D.off(b);
  12953. }, scrollLock: function scrollLock() {
  12954. w.verbose("Removing scroll lock from page"), l.off(b), s.off(b), O.off("scroll" + E);
  12955. } }, add: { inlineCSS: function inlineCSS() {
  12956. var t,
  12957. n = w.cache.width || O.outerWidth(),
  12958. i = w.cache.height || O.outerHeight(),
  12959. o = w.is.rtl(),
  12960. a = w.get.direction(),
  12961. s = { left: n, right: -n, top: i, bottom: -i };o && (w.verbose("RTL detected, flipping widths"), s.left = -n, s.right = n), t = "<style>", "left" === a || "right" === a ? (w.debug("Adding CSS rules for animation distance", n), t += " .ui.visible." + a + ".sidebar ~ .fixed, .ui.visible." + a + ".sidebar ~ .pusher { -webkit-transform: translate3d(" + s[a] + "px, 0, 0); transform: translate3d(" + s[a] + "px, 0, 0); }") : "top" !== a && "bottom" != a || (t += " .ui.visible." + a + ".sidebar ~ .fixed, .ui.visible." + a + ".sidebar ~ .pusher { -webkit-transform: translate3d(0, " + s[a] + "px, 0); transform: translate3d(0, " + s[a] + "px, 0); }"), w.is.ie() && ("left" === a || "right" === a ? (w.debug("Adding CSS rules for animation distance", n), t += " body.pushable > .ui.visible." + a + ".sidebar ~ .pusher:after { -webkit-transform: translate3d(" + s[a] + "px, 0, 0); transform: translate3d(" + s[a] + "px, 0, 0); }") : "top" !== a && "bottom" != a || (t += " body.pushable > .ui.visible." + a + ".sidebar ~ .pusher:after { -webkit-transform: translate3d(0, " + s[a] + "px, 0); transform: translate3d(0, " + s[a] + "px, 0); }"), t += " body.pushable > .ui.visible.left.sidebar ~ .ui.visible.right.sidebar ~ .pusher:after, body.pushable > .ui.visible.right.sidebar ~ .ui.visible.left.sidebar ~ .pusher:after { -webkit-transform: translate3d(0px, 0, 0); transform: translate3d(0px, 0, 0); }"), r = e(t += "</style>").appendTo(u), w.debug("Adding sizing css to head", r);
  12962. } }, refresh: function refresh() {
  12963. w.verbose("Refreshing selector cache"), D = e(S.context), q = D.children(k.sidebar), j = D.children(k.pusher), D.children(k.fixed), w.clear.cache();
  12964. }, refreshSidebars: function refreshSidebars() {
  12965. w.verbose("Refreshing other sidebars"), q = D.children(k.sidebar);
  12966. }, repaint: function repaint() {
  12967. w.verbose("Forcing repaint event"), z.style.display = "none";z.offsetHeight;z.scrollTop = z.scrollTop, z.style.display = "";
  12968. }, setup: { cache: function cache() {
  12969. w.cache = { width: O.outerWidth(), height: O.outerHeight(), rtl: "rtl" == O.css("direction") };
  12970. }, layout: function layout() {
  12971. 0 === D.children(k.pusher).length && (w.debug("Adding wrapper element for sidebar"), w.error(P.pusher), j = e('<div class="pusher" />'), D.children().not(k.omitted).not(q).wrapAll(j), w.refresh()), 0 !== O.nextAll(k.pusher).length && O.nextAll(k.pusher)[0] === j[0] || (w.debug("Moved sidebar to correct parent element"), w.error(P.movedSidebar, z), O.detach().prependTo(D), w.refresh()), w.clear.cache(), w.set.pushable(), w.set.direction();
  12972. } }, attachEvents: function attachEvents(t, n) {
  12973. var i = e(t);n = e.isFunction(w[n]) ? w[n] : w.toggle, i.length > 0 ? (w.debug("Attaching sidebar events to element", t, n), i.on("click" + E, n)) : w.error(P.notFound, t);
  12974. }, show: function show(t) {
  12975. if (t = e.isFunction(t) ? t : function () {}, w.is.hidden()) {
  12976. if (w.refreshSidebars(), S.overlay && (w.error(P.overlay), S.transition = "overlay"), w.refresh(), w.othersActive()) if (w.debug("Other sidebars currently visible"), S.exclusive) {
  12977. if ("overlay" != S.transition) return void w.hideOthers(w.show);w.hideOthers();
  12978. } else S.transition = "overlay";w.pushPage(function () {
  12979. t.call(z), S.onShow.call(z);
  12980. }), S.onChange.call(z), S.onVisible.call(z);
  12981. } else w.debug("Sidebar is already visible");
  12982. }, hide: function hide(t) {
  12983. t = e.isFunction(t) ? t : function () {}, (w.is.visible() || w.is.animating()) && (w.debug("Hiding sidebar", t), w.refreshSidebars(), w.pullPage(function () {
  12984. t.call(z), S.onHidden.call(z);
  12985. }), S.onChange.call(z), S.onHide.call(z));
  12986. }, othersAnimating: function othersAnimating() {
  12987. return q.not(O).filter("." + T.animating).length > 0;
  12988. }, othersVisible: function othersVisible() {
  12989. return q.not(O).filter("." + T.visible).length > 0;
  12990. }, othersActive: function othersActive() {
  12991. return w.othersVisible() || w.othersAnimating();
  12992. }, hideOthers: function hideOthers(e) {
  12993. var t = q.not(O).filter("." + T.visible),
  12994. n = t.length,
  12995. i = 0;e = e || function () {}, t.sidebar("hide", function () {
  12996. ++i == n && e();
  12997. });
  12998. }, toggle: function toggle() {
  12999. w.verbose("Determining toggled direction"), w.is.hidden() ? w.show() : w.hide();
  13000. }, pushPage: function pushPage(t) {
  13001. var n,
  13002. i,
  13003. _o,
  13004. a = w.get.transition(),
  13005. r = "overlay" === a || w.othersActive() ? O : j;t = e.isFunction(t) ? t : function () {}, "scale down" == S.transition && w.scrollToTop(), w.set.transition(a), w.repaint(), n = function n() {
  13006. w.bind.clickaway(), w.add.inlineCSS(), w.set.animating(), w.set.visible();
  13007. }, i = function i() {
  13008. w.set.dimmed();
  13009. }, _o = function o(e) {
  13010. e.target == r[0] && (r.off(C + b, _o), w.remove.animating(), w.bind.scrollLock(), t.call(z));
  13011. }, r.off(C + b), r.on(C + b, _o), v(n), S.dimPage && !w.othersVisible() && v(i);
  13012. }, pullPage: function pullPage(t) {
  13013. var n,
  13014. _i,
  13015. o = w.get.transition(),
  13016. a = "overlay" == o || w.othersActive() ? O : j;t = e.isFunction(t) ? t : function () {}, w.verbose("Removing context push state", w.get.direction()), w.unbind.clickaway(), w.unbind.scrollLock(), n = function n() {
  13017. w.set.transition(o), w.set.animating(), w.remove.visible(), S.dimPage && !w.othersVisible() && j.removeClass(T.dimmed);
  13018. }, _i = function i(e) {
  13019. e.target == a[0] && (a.off(C + b, _i), w.remove.animating(), w.remove.transition(), w.remove.inlineCSS(), ("scale down" == o || S.returnScroll && w.is.mobile()) && w.scrollBack(), t.call(z));
  13020. }, a.off(C + b), a.on(C + b, _i), v(n);
  13021. }, scrollToTop: function scrollToTop() {
  13022. w.verbose("Scrolling to top of page to avoid animation issues"), x = e(t).scrollTop(), O.scrollTop(0), t.scrollTo(0, 0);
  13023. }, scrollBack: function scrollBack() {
  13024. w.verbose("Scrolling back to original page position"), t.scrollTo(0, x);
  13025. }, clear: { cache: function cache() {
  13026. w.verbose("Clearing cached dimensions"), w.cache = {};
  13027. } }, set: { ios: function ios() {
  13028. c.addClass(T.ios);
  13029. }, pushed: function pushed() {
  13030. D.addClass(T.pushed);
  13031. }, pushable: function pushable() {
  13032. D.addClass(T.pushable);
  13033. }, dimmed: function dimmed() {
  13034. j.addClass(T.dimmed);
  13035. }, active: function active() {
  13036. O.addClass(T.active);
  13037. }, animating: function animating() {
  13038. O.addClass(T.animating);
  13039. }, transition: function transition(e) {
  13040. e = e || w.get.transition(), O.addClass(e);
  13041. }, direction: function direction(e) {
  13042. e = e || w.get.direction(), O.addClass(T[e]);
  13043. }, visible: function visible() {
  13044. O.addClass(T.visible);
  13045. }, overlay: function overlay() {
  13046. O.addClass(T.overlay);
  13047. } }, remove: { inlineCSS: function inlineCSS() {
  13048. w.debug("Removing inline css styles", r), r && r.length > 0 && r.remove();
  13049. }, ios: function ios() {
  13050. c.removeClass(T.ios);
  13051. }, pushed: function pushed() {
  13052. D.removeClass(T.pushed);
  13053. }, pushable: function pushable() {
  13054. D.removeClass(T.pushable);
  13055. }, active: function active() {
  13056. O.removeClass(T.active);
  13057. }, animating: function animating() {
  13058. O.removeClass(T.animating);
  13059. }, transition: function transition(e) {
  13060. e = e || w.get.transition(), O.removeClass(e);
  13061. }, direction: function direction(e) {
  13062. e = e || w.get.direction(), O.removeClass(T[e]);
  13063. }, visible: function visible() {
  13064. O.removeClass(T.visible);
  13065. }, overlay: function overlay() {
  13066. O.removeClass(T.overlay);
  13067. } }, get: { direction: function direction() {
  13068. return O.hasClass(T.top) ? T.top : O.hasClass(T.right) ? T.right : O.hasClass(T.bottom) ? T.bottom : T.left;
  13069. }, transition: function transition() {
  13070. var e,
  13071. t = w.get.direction();return e = w.is.mobile() ? "auto" == S.mobileTransition ? S.defaultTransition.mobile[t] : S.mobileTransition : "auto" == S.transition ? S.defaultTransition.computer[t] : S.transition, w.verbose("Determined transition", e), e;
  13072. }, transitionEvent: function transitionEvent() {
  13073. var e,
  13074. t = n.createElement("element"),
  13075. o = { transition: "transitionend", OTransition: "oTransitionEnd", MozTransition: "transitionend", WebkitTransition: "webkitTransitionEnd" };for (e in o) {
  13076. if (t.style[e] !== i) return o[e];
  13077. }
  13078. } }, is: { ie: function ie() {
  13079. return !t.ActiveXObject && "ActiveXObject" in t || "ActiveXObject" in t;
  13080. }, ios: function ios() {
  13081. var e = navigator.userAgent,
  13082. t = e.match(R.ios),
  13083. n = e.match(R.mobileChrome);return !(!t || n) && (w.verbose("Browser was found to be iOS", e), !0);
  13084. }, mobile: function mobile() {
  13085. var e = navigator.userAgent;return e.match(R.mobile) ? (w.verbose("Browser was found to be mobile", e), !0) : (w.verbose("Browser is not mobile, using regular transition", e), !1);
  13086. }, hidden: function hidden() {
  13087. return !w.is.visible();
  13088. }, visible: function visible() {
  13089. return O.hasClass(T.visible);
  13090. }, open: function open() {
  13091. return w.is.visible();
  13092. }, closed: function closed() {
  13093. return w.is.hidden();
  13094. }, vertical: function vertical() {
  13095. return O.hasClass(T.top);
  13096. }, animating: function animating() {
  13097. return D.hasClass(T.animating);
  13098. }, rtl: function rtl() {
  13099. return w.cache.rtl === i && (w.cache.rtl = "rtl" == O.css("direction")), w.cache.rtl;
  13100. } }, setting: function setting(t, n) {
  13101. if (w.debug("Changing setting", t, n), e.isPlainObject(t)) e.extend(!0, S, t);else {
  13102. if (n === i) return S[t];e.isPlainObject(S[t]) ? e.extend(!0, S[t], n) : S[t] = n;
  13103. }
  13104. }, internal: function internal(t, n) {
  13105. if (e.isPlainObject(t)) e.extend(!0, w, t);else {
  13106. if (n === i) return w[t];w[t] = n;
  13107. }
  13108. }, debug: function debug() {
  13109. !S.silent && S.debug && (S.performance ? w.performance.log(arguments) : (w.debug = Function.prototype.bind.call(console.info, console, S.name + ":"), w.debug.apply(console, arguments)));
  13110. }, verbose: function verbose() {
  13111. !S.silent && S.verbose && S.debug && (S.performance ? w.performance.log(arguments) : (w.verbose = Function.prototype.bind.call(console.info, console, S.name + ":"), w.verbose.apply(console, arguments)));
  13112. }, error: function error() {
  13113. S.silent || (w.error = Function.prototype.bind.call(console.error, console, S.name + ":"), w.error.apply(console, arguments));
  13114. }, performance: { log: function log(e) {
  13115. var t, n;S.performance && (n = (t = new Date().getTime()) - (f || t), f = t, m.push({ Name: e[0], Arguments: [].slice.call(e, 1) || "", Element: z, "Execution Time": n })), clearTimeout(w.performance.timer), w.performance.timer = setTimeout(w.performance.display, 500);
  13116. }, display: function display() {
  13117. var t = S.name + ":",
  13118. n = 0;f = !1, clearTimeout(w.performance.timer), e.each(m, function (e, t) {
  13119. n += t["Execution Time"];
  13120. }), t += " " + n + "ms", d && (t += " '" + d + "'"), (console.group !== i || console.table !== i) && m.length > 0 && (console.groupCollapsed(t), console.table ? console.table(m) : e.each(m, function (e, t) {
  13121. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  13122. }), console.groupEnd()), m = [];
  13123. } }, invoke: function invoke(t, n, o) {
  13124. var r,
  13125. s,
  13126. l,
  13127. c = I;return n = n || h, o = z || o, "string" == typeof t && c !== i && (t = t.split(/[\. ]/), r = t.length - 1, e.each(t, function (n, o) {
  13128. var a = n != r ? o + t[n + 1].charAt(0).toUpperCase() + t[n + 1].slice(1) : t;if (e.isPlainObject(c[a]) && n != r) c = c[a];else {
  13129. if (c[a] !== i) return s = c[a], !1;if (!e.isPlainObject(c[o]) || n == r) return c[o] !== i ? (s = c[o], !1) : (w.error(P.method, t), !1);c = c[o];
  13130. }
  13131. })), e.isFunction(s) ? l = s.apply(o, n) : s !== i && (l = s), e.isArray(a) ? a.push(l) : a !== i ? a = [a, l] : l !== i && (a = l), s;
  13132. } }, p ? (I === i && w.initialize(), w.invoke(g)) : (I !== i && w.invoke("destroy"), w.initialize());
  13133. }), a !== i ? a : this;
  13134. }, e.fn.sidebar.settings = { name: "Sidebar", namespace: "sidebar", silent: !1, debug: !1, verbose: !1, performance: !0, transition: "auto", mobileTransition: "auto", defaultTransition: { computer: { left: "uncover", right: "uncover", top: "overlay", bottom: "overlay" }, mobile: { left: "uncover", right: "uncover", top: "overlay", bottom: "overlay" } }, context: "body", exclusive: !1, closable: !0, dimPage: !0, scrollLock: !1, returnScroll: !1, delaySetup: !1, duration: 500, onChange: function onChange() {}, onShow: function onShow() {}, onHide: function onHide() {}, onHidden: function onHidden() {}, onVisible: function onVisible() {}, className: { active: "active", animating: "animating", dimmed: "dimmed", ios: "ios", pushable: "pushable", pushed: "pushed", right: "right", top: "top", left: "left", bottom: "bottom", visible: "visible" }, selector: { fixed: ".fixed", omitted: "script, link, style, .ui.modal, .ui.dimmer, .ui.nag, .ui.fixed", pusher: ".pusher", sidebar: ".ui.sidebar" }, regExp: { ios: /(iPad|iPhone|iPod)/g, mobileChrome: /(CriOS)/g, mobile: /Mobile|iP(hone|od|ad)|Android|BlackBerry|IEMobile|Kindle|NetFront|Silk-Accelerated|(hpw|web)OS|Fennec|Minimo|Opera M(obi|ini)|Blazer|Dolfin|Dolphin|Skyfire|Zune/g }, error: { method: "The method you called is not defined.", pusher: "Had to add pusher element. For optimal performance make sure body content is inside a pusher element", movedSidebar: "Had to move sidebar. For optimal performance make sure sidebar and pusher are direct children of your body tag", overlay: "The overlay setting is no longer supported, use animation: overlay", notFound: "There were no elements that matched the specified selector" } };
  13135. }(jQuery, window, document), function (e, t, n, i) {
  13136. "use strict";
  13137. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.sticky = function (o) {
  13138. var a,
  13139. r = e(this),
  13140. s = r.selector || "",
  13141. l = new Date().getTime(),
  13142. c = [],
  13143. u = arguments[0],
  13144. d = "string" == typeof u,
  13145. f = [].slice.call(arguments, 1);return r.each(function () {
  13146. var r,
  13147. m,
  13148. g,
  13149. p,
  13150. h,
  13151. v = e.isPlainObject(o) ? e.extend(!0, {}, e.fn.sticky.settings, o) : e.extend({}, e.fn.sticky.settings),
  13152. b = v.className,
  13153. y = v.namespace,
  13154. x = v.error,
  13155. C = "." + y,
  13156. w = "module-" + y,
  13157. S = e(this),
  13158. k = e(t),
  13159. T = e(v.scrollContext),
  13160. A = (S.selector, S.data(w)),
  13161. R = t.requestAnimationFrame || t.mozRequestAnimationFrame || t.webkitRequestAnimationFrame || t.msRequestAnimationFrame || function (e) {
  13162. setTimeout(e, 0);
  13163. },
  13164. P = this;h = { initialize: function initialize() {
  13165. h.determineContainer(), h.determineContext(), h.verbose("Initializing sticky", v, r), h.save.positions(), h.checkErrors(), h.bind.events(), v.observeChanges && h.observeChanges(), h.instantiate();
  13166. }, instantiate: function instantiate() {
  13167. h.verbose("Storing instance of module", h), A = h, S.data(w, h);
  13168. }, destroy: function destroy() {
  13169. h.verbose("Destroying previous instance"), h.reset(), g && g.disconnect(), p && p.disconnect(), k.off("load" + C, h.event.load).off("resize" + C, h.event.resize), T.off("scrollchange" + C, h.event.scrollchange), S.removeData(w);
  13170. }, observeChanges: function observeChanges() {
  13171. "MutationObserver" in t && (g = new MutationObserver(h.event.documentChanged), p = new MutationObserver(h.event.changed), g.observe(n, { childList: !0, subtree: !0 }), p.observe(P, { childList: !0, subtree: !0 }), p.observe(m[0], { childList: !0, subtree: !0 }), h.debug("Setting up mutation observer", p));
  13172. }, determineContainer: function determineContainer() {
  13173. r = v.container ? e(v.container) : S.offsetParent();
  13174. }, determineContext: function determineContext() {
  13175. 0 !== (m = v.context ? e(v.context) : r).length || h.error(x.invalidContext, v.context, S);
  13176. }, checkErrors: function checkErrors() {
  13177. if (h.is.hidden() && h.error(x.visible, S), h.cache.element.height > h.cache.context.height) return h.reset(), void h.error(x.elementSize, S);
  13178. }, bind: { events: function events() {
  13179. k.on("load" + C, h.event.load).on("resize" + C, h.event.resize), T.off("scroll" + C).on("scroll" + C, h.event.scroll).on("scrollchange" + C, h.event.scrollchange);
  13180. } }, event: { changed: function changed(e) {
  13181. clearTimeout(h.timer), h.timer = setTimeout(function () {
  13182. h.verbose("DOM tree modified, updating sticky menu", e), h.refresh();
  13183. }, 100);
  13184. }, documentChanged: function documentChanged(t) {
  13185. [].forEach.call(t, function (t) {
  13186. t.removedNodes && [].forEach.call(t.removedNodes, function (t) {
  13187. (t == P || e(t).find(P).length > 0) && (h.debug("Element removed from DOM, tearing down events"), h.destroy());
  13188. });
  13189. });
  13190. }, load: function load() {
  13191. h.verbose("Page contents finished loading"), R(h.refresh);
  13192. }, resize: function resize() {
  13193. h.verbose("Window resized"), R(h.refresh);
  13194. }, scroll: function scroll() {
  13195. R(function () {
  13196. T.triggerHandler("scrollchange" + C, T.scrollTop());
  13197. });
  13198. }, scrollchange: function scrollchange(e, t) {
  13199. h.stick(t), v.onScroll.call(P);
  13200. } }, refresh: function refresh(e) {
  13201. h.reset(), v.context || h.determineContext(), e && h.determineContainer(), h.save.positions(), h.stick(), v.onReposition.call(P);
  13202. }, supports: { sticky: function sticky() {
  13203. var t = e("<div/>");t[0];return t.addClass(b.supported), t.css("position").match("sticky");
  13204. } }, save: { lastScroll: function lastScroll(e) {
  13205. h.lastScroll = e;
  13206. }, elementScroll: function elementScroll(e) {
  13207. h.elementScroll = e;
  13208. }, positions: function positions() {
  13209. var e = { height: T.height() },
  13210. t = { margin: { top: parseInt(S.css("margin-top"), 10), bottom: parseInt(S.css("margin-bottom"), 10) }, offset: S.offset(), width: S.outerWidth(), height: S.outerHeight() },
  13211. n = { offset: m.offset(), height: m.outerHeight() };r.outerHeight();h.is.standardScroll() || (h.debug("Non-standard scroll. Removing scroll offset from element offset"), e.top = T.scrollTop(), e.left = T.scrollLeft(), t.offset.top += e.top, n.offset.top += e.top, t.offset.left += e.left, n.offset.left += e.left), h.cache = { fits: t.height + v.offset <= e.height, sameHeight: t.height == n.height, scrollContext: { height: e.height }, element: { margin: t.margin, top: t.offset.top - t.margin.top, left: t.offset.left, width: t.width, height: t.height, bottom: t.offset.top + t.height }, context: { top: n.offset.top, height: n.height, bottom: n.offset.top + n.height } }, h.set.containerSize(), h.stick(), h.debug("Caching element positions", h.cache);
  13212. } }, get: { direction: function direction(e) {
  13213. var t = "down";return e = e || T.scrollTop(), h.lastScroll !== i && (h.lastScroll < e ? t = "down" : h.lastScroll > e && (t = "up")), t;
  13214. }, scrollChange: function scrollChange(e) {
  13215. return e = e || T.scrollTop(), h.lastScroll ? e - h.lastScroll : 0;
  13216. }, currentElementScroll: function currentElementScroll() {
  13217. return h.elementScroll ? h.elementScroll : h.is.top() ? Math.abs(parseInt(S.css("top"), 10)) || 0 : Math.abs(parseInt(S.css("bottom"), 10)) || 0;
  13218. }, elementScroll: function elementScroll(e) {
  13219. e = e || T.scrollTop();var t = h.cache.element,
  13220. n = h.cache.scrollContext,
  13221. i = h.get.scrollChange(e),
  13222. o = t.height - n.height + v.offset,
  13223. a = h.get.currentElementScroll(),
  13224. r = a + i;return a = h.cache.fits || r < 0 ? 0 : r > o ? o : r;
  13225. } }, remove: { lastScroll: function lastScroll() {
  13226. delete h.lastScroll;
  13227. }, elementScroll: function elementScroll(e) {
  13228. delete h.elementScroll;
  13229. }, minimumSize: function minimumSize() {
  13230. r.css("min-height", "");
  13231. }, offset: function offset() {
  13232. S.css("margin-top", "");
  13233. } }, set: { offset: function offset() {
  13234. h.verbose("Setting offset on element", v.offset), S.css("margin-top", v.offset);
  13235. }, containerSize: function containerSize() {
  13236. var e = r.get(0).tagName;"HTML" === e || "body" == e ? h.determineContainer() : Math.abs(r.outerHeight() - h.cache.context.height) > v.jitter && (h.debug("Context has padding, specifying exact height for container", h.cache.context.height), r.css({ height: h.cache.context.height }));
  13237. }, minimumSize: function minimumSize() {
  13238. var e = h.cache.element;r.css("min-height", e.height);
  13239. }, scroll: function scroll(e) {
  13240. h.debug("Setting scroll on element", e), h.elementScroll != e && (h.is.top() && S.css("bottom", "").css("top", -e), h.is.bottom() && S.css("top", "").css("bottom", e));
  13241. }, size: function size() {
  13242. 0 !== h.cache.element.height && 0 !== h.cache.element.width && (P.style.setProperty("width", h.cache.element.width + "px", "important"), P.style.setProperty("height", h.cache.element.height + "px", "important"));
  13243. } }, is: { standardScroll: function standardScroll() {
  13244. return T[0] == t;
  13245. }, top: function top() {
  13246. return S.hasClass(b.top);
  13247. }, bottom: function bottom() {
  13248. return S.hasClass(b.bottom);
  13249. }, initialPosition: function initialPosition() {
  13250. return !h.is.fixed() && !h.is.bound();
  13251. }, hidden: function hidden() {
  13252. return !S.is(":visible");
  13253. }, bound: function bound() {
  13254. return S.hasClass(b.bound);
  13255. }, fixed: function fixed() {
  13256. return S.hasClass(b.fixed);
  13257. } }, stick: function stick(e) {
  13258. var t = e || T.scrollTop(),
  13259. n = h.cache,
  13260. i = n.fits,
  13261. o = n.sameHeight,
  13262. a = n.element,
  13263. r = n.scrollContext,
  13264. s = n.context,
  13265. l = h.is.bottom() && v.pushing ? v.bottomOffset : v.offset,
  13266. c = (e = { top: t + l, bottom: t + l + r.height }, h.get.direction(e.top), i ? 0 : h.get.elementScroll(e.top)),
  13267. u = !i;0 !== a.height && !o && (h.is.initialPosition() ? e.top >= s.bottom ? (h.debug("Initial element position is bottom of container"), h.bindBottom()) : e.top > a.top && (a.height + e.top - c >= s.bottom ? (h.debug("Initial element position is bottom of container"), h.bindBottom()) : (h.debug("Initial element position is fixed"), h.fixTop())) : h.is.fixed() ? h.is.top() ? e.top <= a.top ? (h.debug("Fixed element reached top of container"), h.setInitialPosition()) : a.height + e.top - c >= s.bottom ? (h.debug("Fixed element reached bottom of container"), h.bindBottom()) : u && (h.set.scroll(c), h.save.lastScroll(e.top), h.save.elementScroll(c)) : h.is.bottom() && (e.bottom - a.height <= a.top ? (h.debug("Bottom fixed rail has reached top of container"), h.setInitialPosition()) : e.bottom >= s.bottom ? (h.debug("Bottom fixed rail has reached bottom of container"), h.bindBottom()) : u && (h.set.scroll(c), h.save.lastScroll(e.top), h.save.elementScroll(c))) : h.is.bottom() && (e.top <= a.top ? (h.debug("Jumped from bottom fixed to top fixed, most likely used home/end button"), h.setInitialPosition()) : v.pushing ? h.is.bound() && e.bottom <= s.bottom && (h.debug("Fixing bottom attached element to bottom of browser."), h.fixBottom()) : h.is.bound() && e.top <= s.bottom - a.height && (h.debug("Fixing bottom attached element to top of browser."), h.fixTop())));
  13268. }, bindTop: function bindTop() {
  13269. h.debug("Binding element to top of parent container"), h.remove.offset(), S.css({ left: "", top: "", marginBottom: "" }).removeClass(b.fixed).removeClass(b.bottom).addClass(b.bound).addClass(b.top), v.onTop.call(P), v.onUnstick.call(P);
  13270. }, bindBottom: function bindBottom() {
  13271. h.debug("Binding element to bottom of parent container"), h.remove.offset(), S.css({ left: "", top: "" }).removeClass(b.fixed).removeClass(b.top).addClass(b.bound).addClass(b.bottom), v.onBottom.call(P), v.onUnstick.call(P);
  13272. }, setInitialPosition: function setInitialPosition() {
  13273. h.debug("Returning to initial position"), h.unfix(), h.unbind();
  13274. }, fixTop: function fixTop() {
  13275. h.debug("Fixing element to top of page"), v.setSize && h.set.size(), h.set.minimumSize(), h.set.offset(), S.css({ left: h.cache.element.left, bottom: "", marginBottom: "" }).removeClass(b.bound).removeClass(b.bottom).addClass(b.fixed).addClass(b.top), v.onStick.call(P);
  13276. }, fixBottom: function fixBottom() {
  13277. h.debug("Sticking element to bottom of page"), v.setSize && h.set.size(), h.set.minimumSize(), h.set.offset(), S.css({ left: h.cache.element.left, bottom: "", marginBottom: "" }).removeClass(b.bound).removeClass(b.top).addClass(b.fixed).addClass(b.bottom), v.onStick.call(P);
  13278. }, unbind: function unbind() {
  13279. h.is.bound() && (h.debug("Removing container bound position on element"), h.remove.offset(), S.removeClass(b.bound).removeClass(b.top).removeClass(b.bottom));
  13280. }, unfix: function unfix() {
  13281. h.is.fixed() && (h.debug("Removing fixed position on element"), h.remove.minimumSize(), h.remove.offset(), S.removeClass(b.fixed).removeClass(b.top).removeClass(b.bottom), v.onUnstick.call(P));
  13282. }, reset: function reset() {
  13283. h.debug("Resetting elements position"), h.unbind(), h.unfix(), h.resetCSS(), h.remove.offset(), h.remove.lastScroll();
  13284. }, resetCSS: function resetCSS() {
  13285. S.css({ width: "", height: "" }), r.css({ height: "" });
  13286. }, setting: function setting(t, n) {
  13287. if (e.isPlainObject(t)) e.extend(!0, v, t);else {
  13288. if (n === i) return v[t];v[t] = n;
  13289. }
  13290. }, internal: function internal(t, n) {
  13291. if (e.isPlainObject(t)) e.extend(!0, h, t);else {
  13292. if (n === i) return h[t];h[t] = n;
  13293. }
  13294. }, debug: function debug() {
  13295. !v.silent && v.debug && (v.performance ? h.performance.log(arguments) : (h.debug = Function.prototype.bind.call(console.info, console, v.name + ":"), h.debug.apply(console, arguments)));
  13296. }, verbose: function verbose() {
  13297. !v.silent && v.verbose && v.debug && (v.performance ? h.performance.log(arguments) : (h.verbose = Function.prototype.bind.call(console.info, console, v.name + ":"), h.verbose.apply(console, arguments)));
  13298. }, error: function error() {
  13299. v.silent || (h.error = Function.prototype.bind.call(console.error, console, v.name + ":"), h.error.apply(console, arguments));
  13300. }, performance: { log: function log(e) {
  13301. var t, n;v.performance && (n = (t = new Date().getTime()) - (l || t), l = t, c.push({ Name: e[0], Arguments: [].slice.call(e, 1) || "", Element: P, "Execution Time": n })), clearTimeout(h.performance.timer), h.performance.timer = setTimeout(h.performance.display, 0);
  13302. }, display: function display() {
  13303. var t = v.name + ":",
  13304. n = 0;l = !1, clearTimeout(h.performance.timer), e.each(c, function (e, t) {
  13305. n += t["Execution Time"];
  13306. }), t += " " + n + "ms", s && (t += " '" + s + "'"), (console.group !== i || console.table !== i) && c.length > 0 && (console.groupCollapsed(t), console.table ? console.table(c) : e.each(c, function (e, t) {
  13307. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  13308. }), console.groupEnd()), c = [];
  13309. } }, invoke: function invoke(t, n, o) {
  13310. var r,
  13311. s,
  13312. l,
  13313. c = A;return n = n || f, o = P || o, "string" == typeof t && c !== i && (t = t.split(/[\. ]/), r = t.length - 1, e.each(t, function (n, o) {
  13314. var a = n != r ? o + t[n + 1].charAt(0).toUpperCase() + t[n + 1].slice(1) : t;if (e.isPlainObject(c[a]) && n != r) c = c[a];else {
  13315. if (c[a] !== i) return s = c[a], !1;if (!e.isPlainObject(c[o]) || n == r) return c[o] !== i && (s = c[o], !1);c = c[o];
  13316. }
  13317. })), e.isFunction(s) ? l = s.apply(o, n) : s !== i && (l = s), e.isArray(a) ? a.push(l) : a !== i ? a = [a, l] : l !== i && (a = l), s;
  13318. } }, d ? (A === i && h.initialize(), h.invoke(u)) : (A !== i && A.invoke("destroy"), h.initialize());
  13319. }), a !== i ? a : this;
  13320. }, e.fn.sticky.settings = { name: "Sticky", namespace: "sticky", silent: !1, debug: !1, verbose: !0, performance: !0, pushing: !1, context: !1, container: !1, scrollContext: t, offset: 0, bottomOffset: 0, jitter: 5, setSize: !0, observeChanges: !1, onReposition: function onReposition() {}, onScroll: function onScroll() {}, onStick: function onStick() {}, onUnstick: function onUnstick() {}, onTop: function onTop() {}, onBottom: function onBottom() {}, error: { container: "Sticky element must be inside a relative container", visible: "Element is hidden, you must call refresh after element becomes visible. Use silent setting to surpress this warning in production.", method: "The method you called is not defined.", invalidContext: "Context specified does not exist", elementSize: "Sticky element is larger than its container, cannot create sticky." }, className: { bound: "bound", fixed: "fixed", supported: "native", top: "top", bottom: "bottom" } };
  13321. }(jQuery, window, document), function (e, t, n, i) {
  13322. "use strict";
  13323. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.tab = function (o) {
  13324. var a,
  13325. r = e.isFunction(this) ? e(t) : e(this),
  13326. s = r.selector || "",
  13327. l = new Date().getTime(),
  13328. c = [],
  13329. u = arguments[0],
  13330. d = "string" == typeof u,
  13331. f = [].slice.call(arguments, 1),
  13332. m = !1;return r.each(function () {
  13333. var g,
  13334. p,
  13335. h,
  13336. v,
  13337. b,
  13338. y,
  13339. x = e.isPlainObject(o) ? e.extend(!0, {}, e.fn.tab.settings, o) : e.extend({}, e.fn.tab.settings),
  13340. C = x.className,
  13341. w = x.metadata,
  13342. S = x.selector,
  13343. k = x.error,
  13344. T = "." + x.namespace,
  13345. A = "module-" + x.namespace,
  13346. R = e(this),
  13347. P = {},
  13348. E = !0,
  13349. F = 0,
  13350. O = this,
  13351. D = R.data(A);b = { initialize: function initialize() {
  13352. b.debug("Initializing tab menu item", R), b.fix.callbacks(), b.determineTabs(), b.debug("Determining tabs", x.context, p), x.auto && b.set.auto(), b.bind.events(), x.history && !m && (b.initializeHistory(), m = !0), b.instantiate();
  13353. }, instantiate: function instantiate() {
  13354. b.verbose("Storing instance of module", b), D = b, R.data(A, b);
  13355. }, destroy: function destroy() {
  13356. b.debug("Destroying tabs", R), R.removeData(A).off(T);
  13357. }, bind: { events: function events() {
  13358. e.isWindow(O) || (b.debug("Attaching tab activation events to element", R), R.on("click" + T, b.event.click));
  13359. } }, determineTabs: function determineTabs() {
  13360. var t;"parent" === x.context ? (R.closest(S.ui).length > 0 ? (t = R.closest(S.ui), b.verbose("Using closest UI element as parent", t)) : t = R, g = t.parent(), b.verbose("Determined parent element for creating context", g)) : x.context ? (g = e(x.context), b.verbose("Using selector for tab context", x.context, g)) : g = e("body"), x.childrenOnly ? (p = g.children(S.tabs), b.debug("Searching tab context children for tabs", g, p)) : (p = g.find(S.tabs), b.debug("Searching tab context for tabs", g, p));
  13361. }, fix: { callbacks: function callbacks() {
  13362. e.isPlainObject(o) && (o.onTabLoad || o.onTabInit) && (o.onTabLoad && (o.onLoad = o.onTabLoad, delete o.onTabLoad, b.error(k.legacyLoad, o.onLoad)), o.onTabInit && (o.onFirstLoad = o.onTabInit, delete o.onTabInit, b.error(k.legacyInit, o.onFirstLoad)), x = e.extend(!0, {}, e.fn.tab.settings, o));
  13363. } }, initializeHistory: function initializeHistory() {
  13364. if (b.debug("Initializing page state"), e.address === i) return b.error(k.state), !1;if ("state" == x.historyType) {
  13365. if (b.debug("Using HTML5 to manage state"), !1 === x.path) return b.error(k.path), !1;e.address.history(!0).state(x.path);
  13366. }e.address.bind("change", b.event.history.change);
  13367. }, event: { click: function click(t) {
  13368. var n = e(this).data(w.tab);n !== i ? (x.history ? (b.verbose("Updating page state", t), e.address.value(n)) : (b.verbose("Changing tab", t), b.changeTab(n)), t.preventDefault()) : b.debug("No tab specified");
  13369. }, history: { change: function change(t) {
  13370. var n = t.pathNames.join("/") || b.get.initialPath(),
  13371. o = x.templates.determineTitle(n) || !1;b.performance.display(), b.debug("History change event", n, t), y = t, n !== i && b.changeTab(n), o && e.address.title(o);
  13372. } } }, refresh: function refresh() {
  13373. h && (b.debug("Refreshing tab", h), b.changeTab(h));
  13374. }, cache: { read: function read(e) {
  13375. return e !== i && P[e];
  13376. }, add: function add(e, t) {
  13377. e = e || h, b.debug("Adding cached content for", e), P[e] = t;
  13378. }, remove: function remove(e) {
  13379. e = e || h, b.debug("Removing cached content for", e), delete P[e];
  13380. } }, set: { auto: function auto() {
  13381. var t = "string" == typeof x.path ? x.path.replace(/\/$/, "") + "/{$tab}" : "/{$tab}";b.verbose("Setting up automatic tab retrieval from server", t), e.isPlainObject(x.apiSettings) ? x.apiSettings.url = t : x.apiSettings = { url: t };
  13382. }, loading: function loading(e) {
  13383. var t = b.get.tabElement(e);t.hasClass(C.loading) || (b.verbose("Setting loading state for", t), t.addClass(C.loading).siblings(p).removeClass(C.active + " " + C.loading), t.length > 0 && x.onRequest.call(t[0], e));
  13384. }, state: function state(t) {
  13385. e.address.value(t);
  13386. } }, changeTab: function changeTab(n) {
  13387. var i = t.history && t.history.pushState && x.ignoreFirstLoad && E,
  13388. o = x.auto || e.isPlainObject(x.apiSettings),
  13389. a = o && !i ? b.utilities.pathToArray(n) : b.get.defaultPathArray(n);n = b.utilities.arrayToPath(a), e.each(a, function (t, r) {
  13390. var s,
  13391. l,
  13392. c,
  13393. u,
  13394. d = a.slice(0, t + 1),
  13395. f = b.utilities.arrayToPath(d),
  13396. m = b.is.tab(f),
  13397. p = t + 1 == a.length,
  13398. S = b.get.tabElement(f);if (b.verbose("Looking for tab", r), m) {
  13399. if (b.verbose("Tab was found", r), h = f, v = b.utilities.filterArray(a, d), p ? u = !0 : (l = a.slice(0, t + 2), c = b.utilities.arrayToPath(l), (u = !b.is.tab(c)) && b.verbose("Tab parameters found", l)), u && o) return i ? (b.debug("Ignoring remote content on first tab load", f), E = !1, b.cache.add(n, S.html()), b.activate.all(f), x.onFirstLoad.call(S[0], f, v, y), x.onLoad.call(S[0], f, v, y)) : (b.activate.navigation(f), b.fetch.content(f, n)), !1;b.debug("Opened local tab", f), b.activate.all(f), b.cache.read(f) || (b.cache.add(f, !0), b.debug("First time tab loaded calling tab init"), x.onFirstLoad.call(S[0], f, v, y)), x.onLoad.call(S[0], f, v, y);
  13400. } else {
  13401. if (-1 != n.search("/") || "" === n) return b.error(k.missingTab, R, g, f), !1;if (f = (s = e("#" + n + ', a[name="' + n + '"]')).closest("[data-tab]").data(w.tab), S = b.get.tabElement(f), s && s.length > 0 && f) return b.debug("Anchor link used, opening parent tab", S, s), S.hasClass(C.active) || setTimeout(function () {
  13402. b.scrollTo(s);
  13403. }, 0), b.activate.all(f), b.cache.read(f) || (b.cache.add(f, !0), b.debug("First time tab loaded calling tab init"), x.onFirstLoad.call(S[0], f, v, y)), x.onLoad.call(S[0], f, v, y), !1;
  13404. }
  13405. });
  13406. }, scrollTo: function scrollTo(t) {
  13407. var i = !!(t && t.length > 0) && t.offset().top;!1 !== i && (b.debug("Forcing scroll to an in-page link in a hidden tab", i, t), e(n).scrollTop(i));
  13408. }, update: { content: function content(t, n, o) {
  13409. var a = b.get.tabElement(t),
  13410. r = a[0];o = o !== i ? o : x.evaluateScripts, "string" == typeof x.cacheType && "dom" == x.cacheType.toLowerCase() && "string" != typeof n ? a.empty().append(e(n).clone(!0)) : o ? (b.debug("Updating HTML and evaluating inline scripts", t, n), a.html(n)) : (b.debug("Updating HTML", t, n), r.innerHTML = n);
  13411. } }, fetch: { content: function content(t, n) {
  13412. var o,
  13413. a,
  13414. r = b.get.tabElement(t),
  13415. s = { dataType: "html", encodeParameters: !1, on: "now", cache: x.alwaysRefresh, headers: { "X-Remote": !0 }, onSuccess: function onSuccess(e) {
  13416. "response" == x.cacheType && b.cache.add(n, e), b.update.content(t, e), t == h ? (b.debug("Content loaded", t), b.activate.tab(t)) : b.debug("Content loaded in background", t), x.onFirstLoad.call(r[0], t, v, y), x.onLoad.call(r[0], t, v, y), x.loadOnce ? b.cache.add(n, !0) : "string" == typeof x.cacheType && "dom" == x.cacheType.toLowerCase() && r.children().length > 0 ? setTimeout(function () {
  13417. var e = r.children().clone(!0);e = e.not("script"), b.cache.add(n, e);
  13418. }, 0) : b.cache.add(n, r.html());
  13419. }, urlData: { tab: n } },
  13420. l = r.api("get request") || !1,
  13421. c = l && "pending" === l.state();n = n || t, a = b.cache.read(n), x.cache && a ? (b.activate.tab(t), b.debug("Adding cached content", n), x.loadOnce || ("once" == x.evaluateScripts ? b.update.content(t, a, !1) : b.update.content(t, a)), x.onLoad.call(r[0], t, v, y)) : c ? (b.set.loading(t), b.debug("Content is already loading", n)) : e.api !== i ? (o = e.extend(!0, {}, x.apiSettings, s), b.debug("Retrieving remote content", n, o), b.set.loading(t), r.api(o)) : b.error(k.api);
  13422. } }, activate: { all: function all(e) {
  13423. b.activate.tab(e), b.activate.navigation(e);
  13424. }, tab: function tab(e) {
  13425. var t = b.get.tabElement(e),
  13426. n = "siblings" == x.deactivate ? t.siblings(p) : p.not(t),
  13427. i = t.hasClass(C.active);b.verbose("Showing tab content for", t), i || (t.addClass(C.active), n.removeClass(C.active + " " + C.loading), t.length > 0 && x.onVisible.call(t[0], e));
  13428. }, navigation: function navigation(e) {
  13429. var t = b.get.navElement(e),
  13430. n = "siblings" == x.deactivate ? t.siblings(r) : r.not(t),
  13431. i = t.hasClass(C.active);b.verbose("Activating tab navigation for", t, e), i || (t.addClass(C.active), n.removeClass(C.active + " " + C.loading));
  13432. } }, deactivate: { all: function all() {
  13433. b.deactivate.navigation(), b.deactivate.tabs();
  13434. }, navigation: function navigation() {
  13435. r.removeClass(C.active);
  13436. }, tabs: function tabs() {
  13437. p.removeClass(C.active + " " + C.loading);
  13438. } }, is: { tab: function tab(e) {
  13439. return e !== i && b.get.tabElement(e).length > 0;
  13440. } }, get: { initialPath: function initialPath() {
  13441. return r.eq(0).data(w.tab) || p.eq(0).data(w.tab);
  13442. }, path: function path() {
  13443. return e.address.value();
  13444. }, defaultPathArray: function defaultPathArray(e) {
  13445. return b.utilities.pathToArray(b.get.defaultPath(e));
  13446. }, defaultPath: function defaultPath(e) {
  13447. var t = r.filter("[data-" + w.tab + '^="' + e + '/"]').eq(0).data(w.tab) || !1;if (t) {
  13448. if (b.debug("Found default tab", t), F < x.maxDepth) return F++, b.get.defaultPath(t);b.error(k.recursion);
  13449. } else b.debug("No default tabs found for", e, p);return F = 0, e;
  13450. }, navElement: function navElement(e) {
  13451. return e = e || h, r.filter("[data-" + w.tab + '="' + e + '"]');
  13452. }, tabElement: function tabElement(e) {
  13453. var t, n, i, o;return e = e || h, i = b.utilities.pathToArray(e), o = b.utilities.last(i), t = p.filter("[data-" + w.tab + '="' + e + '"]'), n = p.filter("[data-" + w.tab + '="' + o + '"]'), t.length > 0 ? t : n;
  13454. }, tab: function tab() {
  13455. return h;
  13456. } }, utilities: { filterArray: function filterArray(t, n) {
  13457. return e.grep(t, function (t) {
  13458. return -1 == e.inArray(t, n);
  13459. });
  13460. }, last: function last(t) {
  13461. return !!e.isArray(t) && t[t.length - 1];
  13462. }, pathToArray: function pathToArray(e) {
  13463. return e === i && (e = h), "string" == typeof e ? e.split("/") : [e];
  13464. }, arrayToPath: function arrayToPath(t) {
  13465. return !!e.isArray(t) && t.join("/");
  13466. } }, setting: function setting(t, n) {
  13467. if (b.debug("Changing setting", t, n), e.isPlainObject(t)) e.extend(!0, x, t);else {
  13468. if (n === i) return x[t];e.isPlainObject(x[t]) ? e.extend(!0, x[t], n) : x[t] = n;
  13469. }
  13470. }, internal: function internal(t, n) {
  13471. if (e.isPlainObject(t)) e.extend(!0, b, t);else {
  13472. if (n === i) return b[t];b[t] = n;
  13473. }
  13474. }, debug: function debug() {
  13475. !x.silent && x.debug && (x.performance ? b.performance.log(arguments) : (b.debug = Function.prototype.bind.call(console.info, console, x.name + ":"), b.debug.apply(console, arguments)));
  13476. }, verbose: function verbose() {
  13477. !x.silent && x.verbose && x.debug && (x.performance ? b.performance.log(arguments) : (b.verbose = Function.prototype.bind.call(console.info, console, x.name + ":"), b.verbose.apply(console, arguments)));
  13478. }, error: function error() {
  13479. x.silent || (b.error = Function.prototype.bind.call(console.error, console, x.name + ":"), b.error.apply(console, arguments));
  13480. }, performance: { log: function log(e) {
  13481. var t, n;x.performance && (n = (t = new Date().getTime()) - (l || t), l = t, c.push({ Name: e[0], Arguments: [].slice.call(e, 1) || "", Element: O, "Execution Time": n })), clearTimeout(b.performance.timer), b.performance.timer = setTimeout(b.performance.display, 500);
  13482. }, display: function display() {
  13483. var t = x.name + ":",
  13484. n = 0;l = !1, clearTimeout(b.performance.timer), e.each(c, function (e, t) {
  13485. n += t["Execution Time"];
  13486. }), t += " " + n + "ms", s && (t += " '" + s + "'"), (console.group !== i || console.table !== i) && c.length > 0 && (console.groupCollapsed(t), console.table ? console.table(c) : e.each(c, function (e, t) {
  13487. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  13488. }), console.groupEnd()), c = [];
  13489. } }, invoke: function invoke(t, n, o) {
  13490. var r,
  13491. s,
  13492. l,
  13493. c = D;return n = n || f, o = O || o, "string" == typeof t && c !== i && (t = t.split(/[\. ]/), r = t.length - 1, e.each(t, function (n, o) {
  13494. var a = n != r ? o + t[n + 1].charAt(0).toUpperCase() + t[n + 1].slice(1) : t;if (e.isPlainObject(c[a]) && n != r) c = c[a];else {
  13495. if (c[a] !== i) return s = c[a], !1;if (!e.isPlainObject(c[o]) || n == r) return c[o] !== i ? (s = c[o], !1) : (b.error(k.method, t), !1);c = c[o];
  13496. }
  13497. })), e.isFunction(s) ? l = s.apply(o, n) : s !== i && (l = s), e.isArray(a) ? a.push(l) : a !== i ? a = [a, l] : l !== i && (a = l), s;
  13498. } }, d ? (D === i && b.initialize(), b.invoke(u)) : (D !== i && D.invoke("destroy"), b.initialize());
  13499. }), a !== i ? a : this;
  13500. }, e.tab = function () {
  13501. e(t).tab.apply(this, arguments);
  13502. }, e.fn.tab.settings = { name: "Tab", namespace: "tab", silent: !1, debug: !1, verbose: !1, performance: !0, auto: !1, history: !1, historyType: "hash", path: !1, context: !1, childrenOnly: !1, maxDepth: 25, deactivate: "siblings", alwaysRefresh: !1, cache: !0, loadOnce: !1, cacheType: "response", ignoreFirstLoad: !1, apiSettings: !1, evaluateScripts: "once", onFirstLoad: function onFirstLoad(e, t, n) {}, onLoad: function onLoad(e, t, n) {}, onVisible: function onVisible(e, t, n) {}, onRequest: function onRequest(e, t, n) {}, templates: { determineTitle: function determineTitle(e) {} }, error: { api: "You attempted to load content without API module", method: "The method you called is not defined", missingTab: "Activated tab cannot be found. Tabs are case-sensitive.", noContent: "The tab you specified is missing a content url.", path: "History enabled, but no path was specified", recursion: "Max recursive depth reached", legacyInit: "onTabInit has been renamed to onFirstLoad in 2.0, please adjust your code.", legacyLoad: "onTabLoad has been renamed to onLoad in 2.0. Please adjust your code", state: "History requires Asual's Address library <https://github.com/asual/jquery-address>" }, metadata: { tab: "tab", loaded: "loaded", promise: "promise" }, className: { loading: "loading", active: "active" }, selector: { tabs: ".ui.tab", ui: ".ui" } };
  13503. }(jQuery, window, document), function (e, t, n, i) {
  13504. "use strict";
  13505. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.transition = function () {
  13506. var o,
  13507. a = e(this),
  13508. r = a.selector || "",
  13509. s = new Date().getTime(),
  13510. l = [],
  13511. c = arguments,
  13512. u = c[0],
  13513. d = [].slice.call(arguments, 1),
  13514. f = "string" == typeof u;t.requestAnimationFrame || t.mozRequestAnimationFrame || t.webkitRequestAnimationFrame || t.msRequestAnimationFrame;return a.each(function (t) {
  13515. var m,
  13516. g,
  13517. p,
  13518. h,
  13519. v,
  13520. b,
  13521. y,
  13522. x,
  13523. C,
  13524. w = e(this),
  13525. S = this;(C = { initialize: function initialize() {
  13526. m = C.get.settings.apply(S, c), h = m.className, p = m.error, v = m.metadata, x = "." + m.namespace, y = "module-" + m.namespace, g = w.data(y) || C, b = C.get.animationEndEvent(), f && (f = C.invoke(u)), !1 === f && (C.verbose("Converted arguments into settings object", m), m.interval ? C.delay(m.animate) : C.animate(), C.instantiate());
  13527. }, instantiate: function instantiate() {
  13528. C.verbose("Storing instance of module", C), g = C, w.data(y, g);
  13529. }, destroy: function destroy() {
  13530. C.verbose("Destroying previous module for", S), w.removeData(y);
  13531. }, refresh: function refresh() {
  13532. C.verbose("Refreshing display type on next animation"), delete C.displayType;
  13533. }, forceRepaint: function forceRepaint() {
  13534. C.verbose("Forcing element repaint");var e = w.parent(),
  13535. t = w.next();0 === t.length ? w.detach().appendTo(e) : w.detach().insertBefore(t);
  13536. }, repaint: function repaint() {
  13537. C.verbose("Repainting element");S.offsetWidth;
  13538. }, delay: function delay(e) {
  13539. var n,
  13540. o = C.get.animationDirection();o || (o = C.can.transition() ? C.get.direction() : "static"), e = e !== i ? e : m.interval, n = "auto" == m.reverse && o == h.outward || 1 == m.reverse ? (a.length - t) * m.interval : t * m.interval, C.debug("Delaying animation by", n), setTimeout(C.animate, n);
  13541. }, animate: function animate(e) {
  13542. if (m = e || m, !C.is.supported()) return C.error(p.support), !1;if (C.debug("Preparing animation", m.animation), C.is.animating()) {
  13543. if (m.queue) return !m.allowRepeats && C.has.direction() && C.is.occurring() && !0 !== C.queuing ? C.debug("Animation is currently occurring, preventing queueing same animation", m.animation) : C.queue(m.animation), !1;if (!m.allowRepeats && C.is.occurring()) return C.debug("Animation is already occurring, will not execute repeated animation", m.animation), !1;C.debug("New animation started, completing previous early", m.animation), g.complete();
  13544. }C.can.animate() ? C.set.animating(m.animation) : C.error(p.noAnimation, m.animation, S);
  13545. }, reset: function reset() {
  13546. C.debug("Resetting animation to beginning conditions"), C.remove.animationCallbacks(), C.restore.conditions(), C.remove.animating();
  13547. }, queue: function queue(e) {
  13548. C.debug("Queueing animation of", e), C.queuing = !0, w.one(b + ".queue" + x, function () {
  13549. C.queuing = !1, C.repaint(), C.animate.apply(this, m);
  13550. });
  13551. }, complete: function complete(e) {
  13552. C.debug("Animation complete", m.animation), C.remove.completeCallback(), C.remove.failSafe(), C.is.looping() || (C.is.outward() ? (C.verbose("Animation is outward, hiding element"), C.restore.conditions(), C.hide()) : C.is.inward() ? (C.verbose("Animation is outward, showing element"), C.restore.conditions(), C.show()) : (C.verbose("Static animation completed"), C.restore.conditions(), m.onComplete.call(S)));
  13553. }, force: { visible: function visible() {
  13554. var e = w.attr("style"),
  13555. t = C.get.userStyle(),
  13556. n = C.get.displayType(),
  13557. o = t + "display: " + n + " !important;",
  13558. a = w.css("display"),
  13559. r = e === i || "" === e;a !== n ? (C.verbose("Overriding default display to show element", n), w.attr("style", o)) : r && w.removeAttr("style");
  13560. }, hidden: function hidden() {
  13561. var e = w.attr("style"),
  13562. t = w.css("display"),
  13563. n = e === i || "" === e;"none" === t || C.is.hidden() ? n && w.removeAttr("style") : (C.verbose("Overriding default display to hide element"), w.css("display", "none"));
  13564. } }, has: { direction: function direction(t) {
  13565. var n = !1;return "string" == typeof (t = t || m.animation) && (t = t.split(" "), e.each(t, function (e, t) {
  13566. t !== h.inward && t !== h.outward || (n = !0);
  13567. })), n;
  13568. }, inlineDisplay: function inlineDisplay() {
  13569. var t = w.attr("style") || "";return e.isArray(t.match(/display.*?;/, ""));
  13570. } }, set: { animating: function animating(e) {
  13571. var t;C.remove.completeCallback(), e = e || m.animation, t = C.get.animationClass(e), C.save.animation(t), C.force.visible(), C.remove.hidden(), C.remove.direction(), C.start.animation(t);
  13572. }, duration: function duration(e, t) {
  13573. ((t = "number" == typeof (t = t || m.duration) ? t + "ms" : t) || 0 === t) && (C.verbose("Setting animation duration", t), w.css({ "animation-duration": t }));
  13574. }, direction: function direction(e) {
  13575. (e = e || C.get.direction()) == h.inward ? C.set.inward() : C.set.outward();
  13576. }, looping: function looping() {
  13577. C.debug("Transition set to loop"), w.addClass(h.looping);
  13578. }, hidden: function hidden() {
  13579. w.addClass(h.transition).addClass(h.hidden);
  13580. }, inward: function inward() {
  13581. C.debug("Setting direction to inward"), w.removeClass(h.outward).addClass(h.inward);
  13582. }, outward: function outward() {
  13583. C.debug("Setting direction to outward"), w.removeClass(h.inward).addClass(h.outward);
  13584. }, visible: function visible() {
  13585. w.addClass(h.transition).addClass(h.visible);
  13586. } }, start: { animation: function animation(e) {
  13587. e = e || C.get.animationClass(), C.debug("Starting tween", e), w.addClass(e).one(b + ".complete" + x, C.complete), m.useFailSafe && C.add.failSafe(), C.set.duration(m.duration), m.onStart.call(S);
  13588. } }, save: { animation: function animation(e) {
  13589. C.cache || (C.cache = {}), C.cache.animation = e;
  13590. }, displayType: function displayType(e) {
  13591. "none" !== e && w.data(v.displayType, e);
  13592. }, transitionExists: function transitionExists(t, n) {
  13593. e.fn.transition.exists[t] = n, C.verbose("Saving existence of transition", t, n);
  13594. } }, restore: { conditions: function conditions() {
  13595. var e = C.get.currentAnimation();e && (w.removeClass(e), C.verbose("Removing animation class", C.cache)), C.remove.duration();
  13596. } }, add: { failSafe: function failSafe() {
  13597. var e = C.get.duration();C.timer = setTimeout(function () {
  13598. w.triggerHandler(b);
  13599. }, e + m.failSafeDelay), C.verbose("Adding fail safe timer", C.timer);
  13600. } }, remove: { animating: function animating() {
  13601. w.removeClass(h.animating);
  13602. }, animationCallbacks: function animationCallbacks() {
  13603. C.remove.queueCallback(), C.remove.completeCallback();
  13604. }, queueCallback: function queueCallback() {
  13605. w.off(".queue" + x);
  13606. }, completeCallback: function completeCallback() {
  13607. w.off(".complete" + x);
  13608. }, display: function display() {
  13609. w.css("display", "");
  13610. }, direction: function direction() {
  13611. w.removeClass(h.inward).removeClass(h.outward);
  13612. }, duration: function duration() {
  13613. w.css("animation-duration", "");
  13614. }, failSafe: function failSafe() {
  13615. C.verbose("Removing fail safe timer", C.timer), C.timer && clearTimeout(C.timer);
  13616. }, hidden: function hidden() {
  13617. w.removeClass(h.hidden);
  13618. }, visible: function visible() {
  13619. w.removeClass(h.visible);
  13620. }, looping: function looping() {
  13621. C.debug("Transitions are no longer looping"), C.is.looping() && (C.reset(), w.removeClass(h.looping));
  13622. }, transition: function transition() {
  13623. w.removeClass(h.visible).removeClass(h.hidden);
  13624. } }, get: { settings: function settings(t, n, i) {
  13625. return "object" == (typeof t === "undefined" ? "undefined" : _typeof(t)) ? e.extend(!0, {}, e.fn.transition.settings, t) : "function" == typeof i ? e.extend({}, e.fn.transition.settings, { animation: t, onComplete: i, duration: n }) : "string" == typeof n || "number" == typeof n ? e.extend({}, e.fn.transition.settings, { animation: t, duration: n }) : "object" == (typeof n === "undefined" ? "undefined" : _typeof(n)) ? e.extend({}, e.fn.transition.settings, n, { animation: t }) : "function" == typeof n ? e.extend({}, e.fn.transition.settings, { animation: t, onComplete: n }) : e.extend({}, e.fn.transition.settings, { animation: t });
  13626. }, animationClass: function animationClass(e) {
  13627. var t = e || m.animation,
  13628. n = C.can.transition() && !C.has.direction() ? C.get.direction() + " " : "";return h.animating + " " + h.transition + " " + n + t;
  13629. }, currentAnimation: function currentAnimation() {
  13630. return !(!C.cache || C.cache.animation === i) && C.cache.animation;
  13631. }, currentDirection: function currentDirection() {
  13632. return C.is.inward() ? h.inward : h.outward;
  13633. }, direction: function direction() {
  13634. return C.is.hidden() || !C.is.visible() ? h.inward : h.outward;
  13635. }, animationDirection: function animationDirection(t) {
  13636. var n;return "string" == typeof (t = t || m.animation) && (t = t.split(" "), e.each(t, function (e, t) {
  13637. t === h.inward ? n = h.inward : t === h.outward && (n = h.outward);
  13638. })), n || !1;
  13639. }, duration: function duration(e) {
  13640. return !1 === (e = e || m.duration) && (e = w.css("animation-duration") || 0), "string" == typeof e ? e.indexOf("ms") > -1 ? parseFloat(e) : 1e3 * parseFloat(e) : e;
  13641. }, displayType: function displayType(e) {
  13642. return e = e === i || e, m.displayType ? m.displayType : (e && w.data(v.displayType) === i && C.can.transition(!0), w.data(v.displayType));
  13643. }, userStyle: function userStyle(e) {
  13644. return (e = e || w.attr("style") || "").replace(/display.*?;/, "");
  13645. }, transitionExists: function transitionExists(t) {
  13646. return e.fn.transition.exists[t];
  13647. }, animationStartEvent: function animationStartEvent() {
  13648. var e,
  13649. t = n.createElement("div"),
  13650. o = { animation: "animationstart", OAnimation: "oAnimationStart", MozAnimation: "mozAnimationStart", WebkitAnimation: "webkitAnimationStart" };for (e in o) {
  13651. if (t.style[e] !== i) return o[e];
  13652. }return !1;
  13653. }, animationEndEvent: function animationEndEvent() {
  13654. var e,
  13655. t = n.createElement("div"),
  13656. o = { animation: "animationend", OAnimation: "oAnimationEnd", MozAnimation: "mozAnimationEnd", WebkitAnimation: "webkitAnimationEnd" };for (e in o) {
  13657. if (t.style[e] !== i) return o[e];
  13658. }return !1;
  13659. } }, can: { transition: function transition(t) {
  13660. var n,
  13661. o,
  13662. a,
  13663. r,
  13664. s,
  13665. l,
  13666. c = m.animation,
  13667. u = C.get.transitionExists(c),
  13668. d = C.get.displayType(!1);if (u === i || t) {
  13669. if (C.verbose("Determining whether animation exists"), n = w.attr("class"), o = w.prop("tagName"), r = (a = e("<" + o + " />").addClass(n).insertAfter(w)).addClass(c).removeClass(h.inward).removeClass(h.outward).addClass(h.animating).addClass(h.transition).css("animationName"), s = a.addClass(h.inward).css("animationName"), d || (d = a.attr("class", n).removeAttr("style").removeClass(h.hidden).removeClass(h.visible).show().css("display"), C.verbose("Determining final display state", d), C.save.displayType(d)), a.remove(), r != s) C.debug("Direction exists for animation", c), l = !0;else {
  13670. if ("none" == r || !r) return void C.debug("No animation defined in css", c);C.debug("Static animation found", c, d), l = !1;
  13671. }C.save.transitionExists(c, l);
  13672. }return u !== i ? u : l;
  13673. }, animate: function animate() {
  13674. return C.can.transition() !== i;
  13675. } }, is: { animating: function animating() {
  13676. return w.hasClass(h.animating);
  13677. }, inward: function inward() {
  13678. return w.hasClass(h.inward);
  13679. }, outward: function outward() {
  13680. return w.hasClass(h.outward);
  13681. }, looping: function looping() {
  13682. return w.hasClass(h.looping);
  13683. }, occurring: function occurring(e) {
  13684. return e = "." + (e = e || m.animation).replace(" ", "."), w.filter(e).length > 0;
  13685. }, visible: function visible() {
  13686. return w.is(":visible");
  13687. }, hidden: function hidden() {
  13688. return "hidden" === w.css("visibility");
  13689. }, supported: function supported() {
  13690. return !1 !== b;
  13691. } }, hide: function hide() {
  13692. C.verbose("Hiding element"), C.is.animating() && C.reset(), S.blur(), C.remove.display(), C.remove.visible(), C.set.hidden(), C.force.hidden(), m.onHide.call(S), m.onComplete.call(S);
  13693. }, show: function show(e) {
  13694. C.verbose("Showing element", e), C.remove.hidden(), C.set.visible(), C.force.visible(), m.onShow.call(S), m.onComplete.call(S);
  13695. }, toggle: function toggle() {
  13696. C.is.visible() ? C.hide() : C.show();
  13697. }, stop: function stop() {
  13698. C.debug("Stopping current animation"), w.triggerHandler(b);
  13699. }, stopAll: function stopAll() {
  13700. C.debug("Stopping all animation"), C.remove.queueCallback(), w.triggerHandler(b);
  13701. }, clear: { queue: function queue() {
  13702. C.debug("Clearing animation queue"), C.remove.queueCallback();
  13703. } }, enable: function enable() {
  13704. C.verbose("Starting animation"), w.removeClass(h.disabled);
  13705. }, disable: function disable() {
  13706. C.debug("Stopping animation"), w.addClass(h.disabled);
  13707. }, setting: function setting(t, n) {
  13708. if (C.debug("Changing setting", t, n), e.isPlainObject(t)) e.extend(!0, m, t);else {
  13709. if (n === i) return m[t];e.isPlainObject(m[t]) ? e.extend(!0, m[t], n) : m[t] = n;
  13710. }
  13711. }, internal: function internal(t, n) {
  13712. if (e.isPlainObject(t)) e.extend(!0, C, t);else {
  13713. if (n === i) return C[t];C[t] = n;
  13714. }
  13715. }, debug: function debug() {
  13716. !m.silent && m.debug && (m.performance ? C.performance.log(arguments) : (C.debug = Function.prototype.bind.call(console.info, console, m.name + ":"), C.debug.apply(console, arguments)));
  13717. }, verbose: function verbose() {
  13718. !m.silent && m.verbose && m.debug && (m.performance ? C.performance.log(arguments) : (C.verbose = Function.prototype.bind.call(console.info, console, m.name + ":"), C.verbose.apply(console, arguments)));
  13719. }, error: function error() {
  13720. m.silent || (C.error = Function.prototype.bind.call(console.error, console, m.name + ":"), C.error.apply(console, arguments));
  13721. }, performance: { log: function log(e) {
  13722. var t, n;m.performance && (n = (t = new Date().getTime()) - (s || t), s = t, l.push({ Name: e[0], Arguments: [].slice.call(e, 1) || "", Element: S, "Execution Time": n })), clearTimeout(C.performance.timer), C.performance.timer = setTimeout(C.performance.display, 500);
  13723. }, display: function display() {
  13724. var t = m.name + ":",
  13725. n = 0;s = !1, clearTimeout(C.performance.timer), e.each(l, function (e, t) {
  13726. n += t["Execution Time"];
  13727. }), t += " " + n + "ms", r && (t += " '" + r + "'"), a.length > 1 && (t += " (" + a.length + ")"), (console.group !== i || console.table !== i) && l.length > 0 && (console.groupCollapsed(t), console.table ? console.table(l) : e.each(l, function (e, t) {
  13728. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  13729. }), console.groupEnd()), l = [];
  13730. } }, invoke: function invoke(t, n, a) {
  13731. var r,
  13732. s,
  13733. l,
  13734. c = g;return n = n || d, a = S || a, "string" == typeof t && c !== i && (t = t.split(/[\. ]/), r = t.length - 1, e.each(t, function (n, o) {
  13735. var a = n != r ? o + t[n + 1].charAt(0).toUpperCase() + t[n + 1].slice(1) : t;if (e.isPlainObject(c[a]) && n != r) c = c[a];else {
  13736. if (c[a] !== i) return s = c[a], !1;if (!e.isPlainObject(c[o]) || n == r) return c[o] !== i && (s = c[o], !1);c = c[o];
  13737. }
  13738. })), e.isFunction(s) ? l = s.apply(a, n) : s !== i && (l = s), e.isArray(o) ? o.push(l) : o !== i ? o = [o, l] : l !== i && (o = l), s !== i && s;
  13739. } }).initialize();
  13740. }), o !== i ? o : this;
  13741. }, e.fn.transition.exists = {}, e.fn.transition.settings = { name: "Transition", silent: !1, debug: !1, verbose: !1, performance: !0, namespace: "transition", interval: 0, reverse: "auto", onStart: function onStart() {}, onComplete: function onComplete() {}, onShow: function onShow() {}, onHide: function onHide() {}, useFailSafe: !0, failSafeDelay: 100, allowRepeats: !1, displayType: !1, animation: "fade", duration: !1, queue: !0, metadata: { displayType: "display" }, className: { animating: "animating", disabled: "disabled", hidden: "hidden", inward: "in", loading: "loading", looping: "looping", outward: "out", transition: "transition", visible: "visible" }, error: { noAnimation: "Element is no longer attached to DOM. Unable to animate. Use silent setting to surpress this warning in production.", repeated: "That animation is already occurring, cancelling repeated animation", method: "The method you called is not defined", support: "This browser does not support CSS animations" } };
  13742. }(jQuery, window, document), function (e, t, n, i) {
  13743. "use strict";
  13744. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")();e.api = e.fn.api = function (n) {
  13745. var o,
  13746. a = e.isFunction(this) ? e(t) : e(this),
  13747. r = a.selector || "",
  13748. s = new Date().getTime(),
  13749. l = [],
  13750. c = arguments[0],
  13751. u = "string" == typeof c,
  13752. d = [].slice.call(arguments, 1);return a.each(function () {
  13753. var a,
  13754. f,
  13755. m,
  13756. g,
  13757. p,
  13758. h,
  13759. v = e.isPlainObject(n) ? e.extend(!0, {}, e.fn.api.settings, n) : e.extend({}, e.fn.api.settings),
  13760. b = v.namespace,
  13761. y = v.metadata,
  13762. x = v.selector,
  13763. C = v.error,
  13764. w = v.className,
  13765. S = "." + b,
  13766. k = "module-" + b,
  13767. T = e(this),
  13768. A = T.closest(x.form),
  13769. R = v.stateContext ? e(v.stateContext) : T,
  13770. P = this,
  13771. E = R[0],
  13772. F = T.data(k);h = { initialize: function initialize() {
  13773. u || h.bind.events(), h.instantiate();
  13774. }, instantiate: function instantiate() {
  13775. h.verbose("Storing instance of module", h), F = h, T.data(k, F);
  13776. }, destroy: function destroy() {
  13777. h.verbose("Destroying previous module for", P), T.removeData(k).off(S);
  13778. }, bind: { events: function events() {
  13779. var e = h.get.event();e ? (h.verbose("Attaching API events to element", e), T.on(e + S, h.event.trigger)) : "now" == v.on && (h.debug("Querying API endpoint immediately"), h.query());
  13780. } }, decode: { json: function json(e) {
  13781. if (e !== i && "string" == typeof e) try {
  13782. e = JSON.parse(e);
  13783. } catch (e) {}return e;
  13784. } }, read: { cachedResponse: function cachedResponse(e) {
  13785. var n;if (t.Storage !== i) return n = sessionStorage.getItem(e), h.debug("Using cached response", e, n), n = h.decode.json(n);h.error(C.noStorage);
  13786. } }, write: { cachedResponse: function cachedResponse(n, o) {
  13787. o && "" === o ? h.debug("Response empty, not caching", o) : t.Storage !== i ? (e.isPlainObject(o) && (o = JSON.stringify(o)), sessionStorage.setItem(n, o), h.verbose("Storing cached response for url", n, o)) : h.error(C.noStorage);
  13788. } }, query: function query() {
  13789. if (h.is.disabled()) h.debug("Element is disabled API request aborted");else {
  13790. if (h.is.loading()) {
  13791. if (!v.interruptRequests) return void h.debug("Cancelling request, previous request is still pending");h.debug("Interrupting previous request"), h.abort();
  13792. }if (v.defaultData && e.extend(!0, v.urlData, h.get.defaultData()), v.serializeForm && (v.data = h.add.formData(v.data)), !1 === (f = h.get.settings())) return h.cancelled = !0, void h.error(C.beforeSend);if (h.cancelled = !1, (m = h.get.templatedURL()) || h.is.mocked()) {
  13793. if ((m = h.add.urlData(m)) || h.is.mocked()) {
  13794. if (f.url = v.base + m, a = e.extend(!0, {}, v, { type: v.method || v.type, data: g, url: v.base + m, beforeSend: v.beforeXHR, success: function success() {}, failure: function failure() {}, complete: function complete() {} }), h.debug("Querying URL", a.url), h.verbose("Using AJAX settings", a), "local" === v.cache && h.read.cachedResponse(m)) return h.debug("Response returned from local cache"), h.request = h.create.request(), void h.request.resolveWith(E, [h.read.cachedResponse(m)]);v.throttle ? v.throttleFirstRequest || h.timer ? (h.debug("Throttling request", v.throttle), clearTimeout(h.timer), h.timer = setTimeout(function () {
  13795. h.timer && delete h.timer, h.debug("Sending throttled request", g, a.method), h.send.request();
  13796. }, v.throttle)) : (h.debug("Sending request", g, a.method), h.send.request(), h.timer = setTimeout(function () {}, v.throttle)) : (h.debug("Sending request", g, a.method), h.send.request());
  13797. }
  13798. } else h.error(C.missingURL);
  13799. }
  13800. }, should: { removeError: function removeError() {
  13801. return !0 === v.hideError || "auto" === v.hideError && !h.is.form();
  13802. } }, is: { disabled: function disabled() {
  13803. return T.filter(x.disabled).length > 0;
  13804. }, expectingJSON: function expectingJSON() {
  13805. return "json" === v.dataType || "jsonp" === v.dataType;
  13806. }, form: function form() {
  13807. return T.is("form") || R.is("form");
  13808. }, mocked: function mocked() {
  13809. return v.mockResponse || v.mockResponseAsync || v.response || v.responseAsync;
  13810. }, input: function input() {
  13811. return T.is("input");
  13812. }, loading: function loading() {
  13813. return !!h.request && "pending" == h.request.state();
  13814. }, abortedRequest: function abortedRequest(e) {
  13815. return e && e.readyState !== i && 0 === e.readyState ? (h.verbose("XHR request determined to be aborted"), !0) : (h.verbose("XHR request was not aborted"), !1);
  13816. }, validResponse: function validResponse(t) {
  13817. return h.is.expectingJSON() && e.isFunction(v.successTest) ? (h.debug("Checking JSON returned success", v.successTest, t), v.successTest(t) ? (h.debug("Response passed success test", t), !0) : (h.debug("Response failed success test", t), !1)) : (h.verbose("Response is not JSON, skipping validation", v.successTest, t), !0);
  13818. } }, was: { cancelled: function cancelled() {
  13819. return h.cancelled || !1;
  13820. }, succesful: function succesful() {
  13821. return h.request && "resolved" == h.request.state();
  13822. }, failure: function failure() {
  13823. return h.request && "rejected" == h.request.state();
  13824. }, complete: function complete() {
  13825. return h.request && ("resolved" == h.request.state() || "rejected" == h.request.state());
  13826. } }, add: { urlData: function urlData(t, n) {
  13827. var o, a;return t && (o = t.match(v.regExp.required), a = t.match(v.regExp.optional), n = n || v.urlData, o && (h.debug("Looking for required URL variables", o), e.each(o, function (o, a) {
  13828. var r = -1 !== a.indexOf("$") ? a.substr(2, a.length - 3) : a.substr(1, a.length - 2),
  13829. s = e.isPlainObject(n) && n[r] !== i ? n[r] : T.data(r) !== i ? T.data(r) : R.data(r) !== i ? R.data(r) : n[r];if (s === i) return h.error(C.requiredParameter, r, t), t = !1, !1;h.verbose("Found required variable", r, s), s = v.encodeParameters ? h.get.urlEncodedValue(s) : s, t = t.replace(a, s);
  13830. })), a && (h.debug("Looking for optional URL variables", o), e.each(a, function (o, a) {
  13831. var r = -1 !== a.indexOf("$") ? a.substr(3, a.length - 4) : a.substr(2, a.length - 3),
  13832. s = e.isPlainObject(n) && n[r] !== i ? n[r] : T.data(r) !== i ? T.data(r) : R.data(r) !== i ? R.data(r) : n[r];s !== i ? (h.verbose("Optional variable Found", r, s), t = t.replace(a, s)) : (h.verbose("Optional variable not found", r), t = -1 !== t.indexOf("/" + a) ? t.replace("/" + a, "") : t.replace(a, ""));
  13833. }))), t;
  13834. }, formData: function formData(t) {
  13835. var n = e.fn.serializeObject !== i,
  13836. o = n ? A.serializeObject() : A.serialize();return t = t || v.data, e.isPlainObject(t) ? n ? (h.debug("Extending existing data with form data", t, o), t = e.extend(!0, {}, t, o)) : (h.error(C.missingSerialize), h.debug("Cant extend data. Replacing data with form data", t, o), t = o) : (h.debug("Adding form data", o), t = o), t;
  13837. } }, send: { request: function request() {
  13838. h.set.loading(), h.request = h.create.request(), h.is.mocked() ? h.mockedXHR = h.create.mockedXHR() : h.xhr = h.create.xhr(), v.onRequest.call(E, h.request, h.xhr);
  13839. } }, event: { trigger: function trigger(e) {
  13840. h.query(), "submit" != e.type && "click" != e.type || e.preventDefault();
  13841. }, xhr: { always: function always() {}, done: function done(t, n, i) {
  13842. var o = this,
  13843. a = new Date().getTime() - p,
  13844. r = v.loadingDuration - a,
  13845. s = !!e.isFunction(v.onResponse) && (h.is.expectingJSON() ? v.onResponse.call(o, e.extend(!0, {}, t)) : v.onResponse.call(o, t));r = r > 0 ? r : 0, s && (h.debug("Modified API response in onResponse callback", v.onResponse, s, t), t = s), r > 0 && h.debug("Response completed early delaying state change by", r), setTimeout(function () {
  13846. h.is.validResponse(t) ? h.request.resolveWith(o, [t, i]) : h.request.rejectWith(o, [i, "invalid"]);
  13847. }, r);
  13848. }, fail: function fail(e, t, n) {
  13849. var i = this,
  13850. o = new Date().getTime() - p,
  13851. a = v.loadingDuration - o;(a = a > 0 ? a : 0) > 0 && h.debug("Response completed early delaying state change by", a), setTimeout(function () {
  13852. h.is.abortedRequest(e) ? h.request.rejectWith(i, [e, "aborted", n]) : h.request.rejectWith(i, [e, "error", t, n]);
  13853. }, a);
  13854. } }, request: { done: function done(e, t) {
  13855. h.debug("Successful API Response", e), "local" === v.cache && m && (h.write.cachedResponse(m, e), h.debug("Saving server response locally", h.cache)), v.onSuccess.call(E, e, T, t);
  13856. }, complete: function complete(e, t) {
  13857. var n, i;h.was.succesful() ? (i = e, n = t) : (n = e, i = h.get.responseFromXHR(n)), h.remove.loading(), v.onComplete.call(E, i, T, n);
  13858. }, fail: function fail(e, t, n) {
  13859. var o = h.get.responseFromXHR(e),
  13860. r = h.get.errorFromRequest(o, t, n);if ("aborted" == t) return h.debug("XHR Aborted (Most likely caused by page navigation or CORS Policy)", t, n), v.onAbort.call(E, t, T, e), !0;"invalid" == t ? h.debug("JSON did not pass success test. A server-side error has most likely occurred", o) : "error" == t && e !== i && (h.debug("XHR produced a server error", t, n), 200 != e.status && n !== i && "" !== n && h.error(C.statusMessage + n, a.url), v.onError.call(E, r, T, e)), v.errorDuration && "aborted" !== t && (h.debug("Adding error state"), h.set.error(), h.should.removeError() && setTimeout(h.remove.error, v.errorDuration)), h.debug("API Request failed", r, e), v.onFailure.call(E, o, T, e);
  13861. } } }, create: { request: function request() {
  13862. return e.Deferred().always(h.event.request.complete).done(h.event.request.done).fail(h.event.request.fail);
  13863. }, mockedXHR: function mockedXHR() {
  13864. var t,
  13865. n,
  13866. i,
  13867. o = v.mockResponse || v.response,
  13868. a = v.mockResponseAsync || v.responseAsync;return i = e.Deferred().always(h.event.xhr.complete).done(h.event.xhr.done).fail(h.event.xhr.fail), o ? (e.isFunction(o) ? (h.debug("Using specified synchronous callback", o), n = o.call(E, f)) : (h.debug("Using settings specified response", o), n = o), i.resolveWith(E, [n, !1, { responseText: n }])) : e.isFunction(a) && (t = function t(e) {
  13869. h.debug("Async callback returned response", e), e ? i.resolveWith(E, [e, !1, { responseText: e }]) : i.rejectWith(E, [{ responseText: e }, !1, !1]);
  13870. }, h.debug("Using specified async response callback", a), a.call(E, f, t)), i;
  13871. }, xhr: function xhr() {
  13872. var t;return t = e.ajax(a).always(h.event.xhr.always).done(h.event.xhr.done).fail(h.event.xhr.fail), h.verbose("Created server request", t, a), t;
  13873. } }, set: { error: function error() {
  13874. h.verbose("Adding error state to element", R), R.addClass(w.error);
  13875. }, loading: function loading() {
  13876. h.verbose("Adding loading state to element", R), R.addClass(w.loading), p = new Date().getTime();
  13877. } }, remove: { error: function error() {
  13878. h.verbose("Removing error state from element", R), R.removeClass(w.error);
  13879. }, loading: function loading() {
  13880. h.verbose("Removing loading state from element", R), R.removeClass(w.loading);
  13881. } }, get: { responseFromXHR: function responseFromXHR(t) {
  13882. return !!e.isPlainObject(t) && (h.is.expectingJSON() ? h.decode.json(t.responseText) : t.responseText);
  13883. }, errorFromRequest: function errorFromRequest(t, n, o) {
  13884. return e.isPlainObject(t) && t.error !== i ? t.error : v.error[n] !== i ? v.error[n] : o;
  13885. }, request: function request() {
  13886. return h.request || !1;
  13887. }, xhr: function xhr() {
  13888. return h.xhr || !1;
  13889. }, settings: function settings() {
  13890. var t;return (t = v.beforeSend.call(E, v)) && (t.success !== i && (h.debug("Legacy success callback detected", t), h.error(C.legacyParameters, t.success), t.onSuccess = t.success), t.failure !== i && (h.debug("Legacy failure callback detected", t), h.error(C.legacyParameters, t.failure), t.onFailure = t.failure), t.complete !== i && (h.debug("Legacy complete callback detected", t), h.error(C.legacyParameters, t.complete), t.onComplete = t.complete)), t === i && h.error(C.noReturnedValue), !1 === t ? t : t !== i ? e.extend(!0, {}, t) : e.extend(!0, {}, v);
  13891. }, urlEncodedValue: function urlEncodedValue(e) {
  13892. var n = t.decodeURIComponent(e),
  13893. i = t.encodeURIComponent(e);return n !== e ? (h.debug("URL value is already encoded, avoiding double encoding", e), e) : (h.verbose("Encoding value using encodeURIComponent", e, i), i);
  13894. }, defaultData: function defaultData() {
  13895. var t = {};return e.isWindow(P) || (h.is.input() ? t.value = T.val() : h.is.form() || (t.text = T.text())), t;
  13896. }, event: function event() {
  13897. return e.isWindow(P) || "now" == v.on ? (h.debug("API called without element, no events attached"), !1) : "auto" == v.on ? T.is("input") ? P.oninput !== i ? "input" : P.onpropertychange !== i ? "propertychange" : "keyup" : T.is("form") ? "submit" : "click" : v.on;
  13898. }, templatedURL: function templatedURL(e) {
  13899. if (e = e || T.data(y.action) || v.action || !1, m = T.data(y.url) || v.url || !1) return h.debug("Using specified url", m), m;if (e) {
  13900. if (h.debug("Looking up url for action", e, v.api), v.api[e] === i && !h.is.mocked()) return void h.error(C.missingAction, v.action, v.api);m = v.api[e];
  13901. } else h.is.form() && (m = T.attr("action") || R.attr("action") || !1, h.debug("No url or action specified, defaulting to form action", m));return m;
  13902. } }, abort: function abort() {
  13903. var e = h.get.xhr();e && "resolved" !== e.state() && (h.debug("Cancelling API request"), e.abort());
  13904. }, reset: function reset() {
  13905. h.remove.error(), h.remove.loading();
  13906. }, setting: function setting(t, n) {
  13907. if (h.debug("Changing setting", t, n), e.isPlainObject(t)) e.extend(!0, v, t);else {
  13908. if (n === i) return v[t];e.isPlainObject(v[t]) ? e.extend(!0, v[t], n) : v[t] = n;
  13909. }
  13910. }, internal: function internal(t, n) {
  13911. if (e.isPlainObject(t)) e.extend(!0, h, t);else {
  13912. if (n === i) return h[t];h[t] = n;
  13913. }
  13914. }, debug: function debug() {
  13915. !v.silent && v.debug && (v.performance ? h.performance.log(arguments) : (h.debug = Function.prototype.bind.call(console.info, console, v.name + ":"), h.debug.apply(console, arguments)));
  13916. }, verbose: function verbose() {
  13917. !v.silent && v.verbose && v.debug && (v.performance ? h.performance.log(arguments) : (h.verbose = Function.prototype.bind.call(console.info, console, v.name + ":"), h.verbose.apply(console, arguments)));
  13918. }, error: function error() {
  13919. v.silent || (h.error = Function.prototype.bind.call(console.error, console, v.name + ":"), h.error.apply(console, arguments));
  13920. }, performance: { log: function log(e) {
  13921. var t, n;v.performance && (n = (t = new Date().getTime()) - (s || t), s = t, l.push({ Name: e[0], Arguments: [].slice.call(e, 1) || "", "Execution Time": n })), clearTimeout(h.performance.timer), h.performance.timer = setTimeout(h.performance.display, 500);
  13922. }, display: function display() {
  13923. var t = v.name + ":",
  13924. n = 0;s = !1, clearTimeout(h.performance.timer), e.each(l, function (e, t) {
  13925. n += t["Execution Time"];
  13926. }), t += " " + n + "ms", r && (t += " '" + r + "'"), (console.group !== i || console.table !== i) && l.length > 0 && (console.groupCollapsed(t), console.table ? console.table(l) : e.each(l, function (e, t) {
  13927. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  13928. }), console.groupEnd()), l = [];
  13929. } }, invoke: function invoke(t, n, a) {
  13930. var r,
  13931. s,
  13932. l,
  13933. c = F;return n = n || d, a = P || a, "string" == typeof t && c !== i && (t = t.split(/[\. ]/), r = t.length - 1, e.each(t, function (n, o) {
  13934. var a = n != r ? o + t[n + 1].charAt(0).toUpperCase() + t[n + 1].slice(1) : t;if (e.isPlainObject(c[a]) && n != r) c = c[a];else {
  13935. if (c[a] !== i) return s = c[a], !1;if (!e.isPlainObject(c[o]) || n == r) return c[o] !== i ? (s = c[o], !1) : (h.error(C.method, t), !1);c = c[o];
  13936. }
  13937. })), e.isFunction(s) ? l = s.apply(a, n) : s !== i && (l = s), e.isArray(o) ? o.push(l) : o !== i ? o = [o, l] : l !== i && (o = l), s;
  13938. } }, u ? (F === i && h.initialize(), h.invoke(c)) : (F !== i && F.invoke("destroy"), h.initialize());
  13939. }), o !== i ? o : this;
  13940. }, e.api.settings = { name: "API", namespace: "api", debug: !1, verbose: !1, performance: !0, api: {}, cache: !0, interruptRequests: !0, on: "auto", stateContext: !1, loadingDuration: 0, hideError: "auto", errorDuration: 2e3, encodeParameters: !0, action: !1, url: !1, base: "", urlData: {}, defaultData: !0, serializeForm: !1, throttle: 0, throttleFirstRequest: !0, method: "get", data: {}, dataType: "json", mockResponse: !1, mockResponseAsync: !1, response: !1, responseAsync: !1, beforeSend: function beforeSend(e) {
  13941. return e;
  13942. }, beforeXHR: function beforeXHR(e) {}, onRequest: function onRequest(e, t) {}, onResponse: !1, onSuccess: function onSuccess(e, t) {}, onComplete: function onComplete(e, t) {}, onFailure: function onFailure(e, t) {}, onError: function onError(e, t) {}, onAbort: function onAbort(e, t) {}, successTest: !1, error: { beforeSend: "The before send function has aborted the request", error: "There was an error with your request", exitConditions: "API Request Aborted. Exit conditions met", JSONParse: "JSON could not be parsed during error handling", legacyParameters: "You are using legacy API success callback names", method: "The method you called is not defined", missingAction: "API action used but no url was defined", missingSerialize: "jquery-serialize-object is required to add form data to an existing data object", missingURL: "No URL specified for api event", noReturnedValue: "The beforeSend callback must return a settings object, beforeSend ignored.", noStorage: "Caching responses locally requires session storage", parseError: "There was an error parsing your request", requiredParameter: "Missing a required URL parameter: ", statusMessage: "Server gave an error: ", timeout: "Your request timed out" }, regExp: { required: /\{\$*[A-z0-9]+\}/g, optional: /\{\/\$*[A-z0-9]+\}/g }, className: { loading: "loading", error: "error" }, selector: { disabled: ".disabled", form: "form" }, metadata: { action: "action", url: "url" } };
  13943. }(jQuery, window, document), function (e, t, n, i) {
  13944. "use strict";
  13945. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.visibility = function (o) {
  13946. var a,
  13947. r = e(this),
  13948. s = r.selector || "",
  13949. l = new Date().getTime(),
  13950. c = [],
  13951. u = arguments[0],
  13952. d = "string" == typeof u,
  13953. f = [].slice.call(arguments, 1),
  13954. m = r.length,
  13955. g = 0;return r.each(function () {
  13956. var r,
  13957. p,
  13958. h,
  13959. v,
  13960. b = e.isPlainObject(o) ? e.extend(!0, {}, e.fn.visibility.settings, o) : e.extend({}, e.fn.visibility.settings),
  13961. y = b.className,
  13962. x = b.namespace,
  13963. C = b.error,
  13964. w = b.metadata,
  13965. S = "." + x,
  13966. k = "module-" + x,
  13967. T = e(t),
  13968. A = e(this),
  13969. R = e(b.context),
  13970. P = (A.selector, A.data(k)),
  13971. E = t.requestAnimationFrame || t.mozRequestAnimationFrame || t.webkitRequestAnimationFrame || t.msRequestAnimationFrame || function (e) {
  13972. setTimeout(e, 0);
  13973. },
  13974. F = this,
  13975. O = !1;v = { initialize: function initialize() {
  13976. v.debug("Initializing", b), v.setup.cache(), v.should.trackChanges() && ("image" == b.type && v.setup.image(), "fixed" == b.type && v.setup.fixed(), b.observeChanges && v.observeChanges(), v.bind.events()), v.save.position(), v.is.visible() || v.error(C.visible, A), b.initialCheck && v.checkVisibility(), v.instantiate();
  13977. }, instantiate: function instantiate() {
  13978. v.debug("Storing instance", v), A.data(k, v), P = v;
  13979. }, destroy: function destroy() {
  13980. v.verbose("Destroying previous module"), h && h.disconnect(), p && p.disconnect(), T.off("load" + S, v.event.load).off("resize" + S, v.event.resize), R.off("scroll" + S, v.event.scroll).off("scrollchange" + S, v.event.scrollchange), "fixed" == b.type && (v.resetFixed(), v.remove.placeholder()), A.off(S).removeData(k);
  13981. }, observeChanges: function observeChanges() {
  13982. "MutationObserver" in t && (p = new MutationObserver(v.event.contextChanged), h = new MutationObserver(v.event.changed), p.observe(n, { childList: !0, subtree: !0 }), h.observe(F, { childList: !0, subtree: !0 }), v.debug("Setting up mutation observer", h));
  13983. }, bind: { events: function events() {
  13984. v.verbose("Binding visibility events to scroll and resize"), b.refreshOnLoad && T.on("load" + S, v.event.load), T.on("resize" + S, v.event.resize), R.off("scroll" + S).on("scroll" + S, v.event.scroll).on("scrollchange" + S, v.event.scrollchange);
  13985. } }, event: { changed: function changed(e) {
  13986. v.verbose("DOM tree modified, updating visibility calculations"), v.timer = setTimeout(function () {
  13987. v.verbose("DOM tree modified, updating sticky menu"), v.refresh();
  13988. }, 100);
  13989. }, contextChanged: function contextChanged(t) {
  13990. [].forEach.call(t, function (t) {
  13991. t.removedNodes && [].forEach.call(t.removedNodes, function (t) {
  13992. (t == F || e(t).find(F).length > 0) && (v.debug("Element removed from DOM, tearing down events"), v.destroy());
  13993. });
  13994. });
  13995. }, resize: function resize() {
  13996. v.debug("Window resized"), b.refreshOnResize && E(v.refresh);
  13997. }, load: function load() {
  13998. v.debug("Page finished loading"), E(v.refresh);
  13999. }, scroll: function scroll() {
  14000. b.throttle ? (clearTimeout(v.timer), v.timer = setTimeout(function () {
  14001. R.triggerHandler("scrollchange" + S, [R.scrollTop()]);
  14002. }, b.throttle)) : E(function () {
  14003. R.triggerHandler("scrollchange" + S, [R.scrollTop()]);
  14004. });
  14005. }, scrollchange: function scrollchange(e, t) {
  14006. v.checkVisibility(t);
  14007. } }, precache: function precache(t, i) {
  14008. t instanceof Array || (t = [t]);for (var o = t.length, a = 0, r = [], s = n.createElement("img"), l = function l() {
  14009. ++a >= t.length && e.isFunction(i) && i();
  14010. }; o--;) {
  14011. (s = n.createElement("img")).onload = l, s.onerror = l, s.src = t[o], r.push(s);
  14012. }
  14013. }, enableCallbacks: function enableCallbacks() {
  14014. v.debug("Allowing callbacks to occur"), O = !1;
  14015. }, disableCallbacks: function disableCallbacks() {
  14016. v.debug("Disabling all callbacks temporarily"), O = !0;
  14017. }, should: { trackChanges: function trackChanges() {
  14018. return d ? (v.debug("One time query, no need to bind events"), !1) : (v.debug("Callbacks being attached"), !0);
  14019. } }, setup: { cache: function cache() {
  14020. v.cache = { occurred: {}, screen: {}, element: {} };
  14021. }, image: function image() {
  14022. var e = A.data(w.src);e && (v.verbose("Lazy loading image", e), b.once = !0, b.observeChanges = !1, b.onOnScreen = function () {
  14023. v.debug("Image on screen", F), v.precache(e, function () {
  14024. v.set.image(e, function () {
  14025. ++g == m && b.onAllLoaded.call(this), b.onLoad.call(this);
  14026. });
  14027. });
  14028. });
  14029. }, fixed: function fixed() {
  14030. v.debug("Setting up fixed"), b.once = !1, b.observeChanges = !1, b.initialCheck = !0, b.refreshOnLoad = !0, o.transition || (b.transition = !1), v.create.placeholder(), v.debug("Added placeholder", r), b.onTopPassed = function () {
  14031. v.debug("Element passed, adding fixed position", A), v.show.placeholder(), v.set.fixed(), b.transition && e.fn.transition !== i && A.transition(b.transition, b.duration);
  14032. }, b.onTopPassedReverse = function () {
  14033. v.debug("Element returned to position, removing fixed", A), v.hide.placeholder(), v.remove.fixed();
  14034. };
  14035. } }, create: { placeholder: function placeholder() {
  14036. v.verbose("Creating fixed position placeholder"), r = A.clone(!1).css("display", "none").addClass(y.placeholder).insertAfter(A);
  14037. } }, show: { placeholder: function placeholder() {
  14038. v.verbose("Showing placeholder"), r.css("display", "block").css("visibility", "hidden");
  14039. } }, hide: { placeholder: function placeholder() {
  14040. v.verbose("Hiding placeholder"), r.css("display", "none").css("visibility", "");
  14041. } }, set: { fixed: function fixed() {
  14042. v.verbose("Setting element to fixed position"), A.addClass(y.fixed).css({ position: "fixed", top: b.offset + "px", left: "auto", zIndex: b.zIndex }), b.onFixed.call(F);
  14043. }, image: function image(t, n) {
  14044. if (A.attr("src", t), b.transition) {
  14045. if (e.fn.transition !== i) {
  14046. if (A.hasClass(y.visible)) return void v.debug("Transition already occurred on this image, skipping animation");A.transition(b.transition, b.duration, n);
  14047. } else A.fadeIn(b.duration, n);
  14048. } else A.show();
  14049. } }, is: { onScreen: function onScreen() {
  14050. return v.get.elementCalculations().onScreen;
  14051. }, offScreen: function offScreen() {
  14052. return v.get.elementCalculations().offScreen;
  14053. }, visible: function visible() {
  14054. return !(!v.cache || !v.cache.element) && !(0 === v.cache.element.width && 0 === v.cache.element.offset.top);
  14055. }, verticallyScrollableContext: function verticallyScrollableContext() {
  14056. var e = R.get(0) !== t && R.css("overflow-y");return "auto" == e || "scroll" == e;
  14057. }, horizontallyScrollableContext: function horizontallyScrollableContext() {
  14058. var e = R.get(0) !== t && R.css("overflow-x");return "auto" == e || "scroll" == e;
  14059. } }, refresh: function refresh() {
  14060. v.debug("Refreshing constants (width/height)"), "fixed" == b.type && v.resetFixed(), v.reset(), v.save.position(), b.checkOnRefresh && v.checkVisibility(), b.onRefresh.call(F);
  14061. }, resetFixed: function resetFixed() {
  14062. v.remove.fixed(), v.remove.occurred();
  14063. }, reset: function reset() {
  14064. v.verbose("Resetting all cached values"), e.isPlainObject(v.cache) && (v.cache.screen = {}, v.cache.element = {});
  14065. }, checkVisibility: function checkVisibility(e) {
  14066. v.verbose("Checking visibility of element", v.cache.element), !O && v.is.visible() && (v.save.scroll(e), v.save.calculations(), v.passed(), v.passingReverse(), v.topVisibleReverse(), v.bottomVisibleReverse(), v.topPassedReverse(), v.bottomPassedReverse(), v.onScreen(), v.offScreen(), v.passing(), v.topVisible(), v.bottomVisible(), v.topPassed(), v.bottomPassed(), b.onUpdate && b.onUpdate.call(F, v.get.elementCalculations()));
  14067. }, passed: function passed(t, n) {
  14068. var o = v.get.elementCalculations();if (t && n) b.onPassed[t] = n;else {
  14069. if (t !== i) return v.get.pixelsPassed(t) > o.pixelsPassed;o.passing && e.each(b.onPassed, function (e, t) {
  14070. o.bottomVisible || o.pixelsPassed > v.get.pixelsPassed(e) ? v.execute(t, e) : b.once || v.remove.occurred(t);
  14071. });
  14072. }
  14073. }, onScreen: function onScreen(e) {
  14074. var t = v.get.elementCalculations(),
  14075. n = e || b.onOnScreen,
  14076. o = "onScreen";if (e && (v.debug("Adding callback for onScreen", e), b.onOnScreen = e), t.onScreen ? v.execute(n, o) : b.once || v.remove.occurred(o), e !== i) return t.onOnScreen;
  14077. }, offScreen: function offScreen(e) {
  14078. var t = v.get.elementCalculations(),
  14079. n = e || b.onOffScreen,
  14080. o = "offScreen";if (e && (v.debug("Adding callback for offScreen", e), b.onOffScreen = e), t.offScreen ? v.execute(n, o) : b.once || v.remove.occurred(o), e !== i) return t.onOffScreen;
  14081. }, passing: function passing(e) {
  14082. var t = v.get.elementCalculations(),
  14083. n = e || b.onPassing,
  14084. o = "passing";if (e && (v.debug("Adding callback for passing", e), b.onPassing = e), t.passing ? v.execute(n, o) : b.once || v.remove.occurred(o), e !== i) return t.passing;
  14085. }, topVisible: function topVisible(e) {
  14086. var t = v.get.elementCalculations(),
  14087. n = e || b.onTopVisible,
  14088. o = "topVisible";if (e && (v.debug("Adding callback for top visible", e), b.onTopVisible = e), t.topVisible ? v.execute(n, o) : b.once || v.remove.occurred(o), e === i) return t.topVisible;
  14089. }, bottomVisible: function bottomVisible(e) {
  14090. var t = v.get.elementCalculations(),
  14091. n = e || b.onBottomVisible,
  14092. o = "bottomVisible";if (e && (v.debug("Adding callback for bottom visible", e), b.onBottomVisible = e), t.bottomVisible ? v.execute(n, o) : b.once || v.remove.occurred(o), e === i) return t.bottomVisible;
  14093. }, topPassed: function topPassed(e) {
  14094. var t = v.get.elementCalculations(),
  14095. n = e || b.onTopPassed,
  14096. o = "topPassed";if (e && (v.debug("Adding callback for top passed", e), b.onTopPassed = e), t.topPassed ? v.execute(n, o) : b.once || v.remove.occurred(o), e === i) return t.topPassed;
  14097. }, bottomPassed: function bottomPassed(e) {
  14098. var t = v.get.elementCalculations(),
  14099. n = e || b.onBottomPassed,
  14100. o = "bottomPassed";if (e && (v.debug("Adding callback for bottom passed", e), b.onBottomPassed = e), t.bottomPassed ? v.execute(n, o) : b.once || v.remove.occurred(o), e === i) return t.bottomPassed;
  14101. }, passingReverse: function passingReverse(e) {
  14102. var t = v.get.elementCalculations(),
  14103. n = e || b.onPassingReverse,
  14104. o = "passingReverse";if (e && (v.debug("Adding callback for passing reverse", e), b.onPassingReverse = e), t.passing ? b.once || v.remove.occurred(o) : v.get.occurred("passing") && v.execute(n, o), e !== i) return !t.passing;
  14105. }, topVisibleReverse: function topVisibleReverse(e) {
  14106. var t = v.get.elementCalculations(),
  14107. n = e || b.onTopVisibleReverse,
  14108. o = "topVisibleReverse";if (e && (v.debug("Adding callback for top visible reverse", e), b.onTopVisibleReverse = e), t.topVisible ? b.once || v.remove.occurred(o) : v.get.occurred("topVisible") && v.execute(n, o), e === i) return !t.topVisible;
  14109. }, bottomVisibleReverse: function bottomVisibleReverse(e) {
  14110. var t = v.get.elementCalculations(),
  14111. n = e || b.onBottomVisibleReverse,
  14112. o = "bottomVisibleReverse";if (e && (v.debug("Adding callback for bottom visible reverse", e), b.onBottomVisibleReverse = e), t.bottomVisible ? b.once || v.remove.occurred(o) : v.get.occurred("bottomVisible") && v.execute(n, o), e === i) return !t.bottomVisible;
  14113. }, topPassedReverse: function topPassedReverse(e) {
  14114. var t = v.get.elementCalculations(),
  14115. n = e || b.onTopPassedReverse,
  14116. o = "topPassedReverse";if (e && (v.debug("Adding callback for top passed reverse", e), b.onTopPassedReverse = e), t.topPassed ? b.once || v.remove.occurred(o) : v.get.occurred("topPassed") && v.execute(n, o), e === i) return !t.onTopPassed;
  14117. }, bottomPassedReverse: function bottomPassedReverse(e) {
  14118. var t = v.get.elementCalculations(),
  14119. n = e || b.onBottomPassedReverse,
  14120. o = "bottomPassedReverse";if (e && (v.debug("Adding callback for bottom passed reverse", e), b.onBottomPassedReverse = e), t.bottomPassed ? b.once || v.remove.occurred(o) : v.get.occurred("bottomPassed") && v.execute(n, o), e === i) return !t.bottomPassed;
  14121. }, execute: function execute(e, t) {
  14122. var n = v.get.elementCalculations(),
  14123. i = v.get.screenCalculations();(e = e || !1) && (b.continuous ? (v.debug("Callback being called continuously", t, n), e.call(F, n, i)) : v.get.occurred(t) || (v.debug("Conditions met", t, n), e.call(F, n, i))), v.save.occurred(t);
  14124. }, remove: { fixed: function fixed() {
  14125. v.debug("Removing fixed position"), A.removeClass(y.fixed).css({ position: "", top: "", left: "", zIndex: "" }), b.onUnfixed.call(F);
  14126. }, placeholder: function placeholder() {
  14127. v.debug("Removing placeholder content"), r && r.remove();
  14128. }, occurred: function occurred(e) {
  14129. if (e) {
  14130. var t = v.cache.occurred;t[e] !== i && !0 === t[e] && (v.debug("Callback can now be called again", e), v.cache.occurred[e] = !1);
  14131. } else v.cache.occurred = {};
  14132. } }, save: { calculations: function calculations() {
  14133. v.verbose("Saving all calculations necessary to determine positioning"), v.save.direction(), v.save.screenCalculations(), v.save.elementCalculations();
  14134. }, occurred: function occurred(e) {
  14135. e && (v.cache.occurred[e] !== i && !0 === v.cache.occurred[e] || (v.verbose("Saving callback occurred", e), v.cache.occurred[e] = !0));
  14136. }, scroll: function scroll(e) {
  14137. e = e + b.offset || R.scrollTop() + b.offset, v.cache.scroll = e;
  14138. }, direction: function direction() {
  14139. var e,
  14140. t = v.get.scroll(),
  14141. n = v.get.lastScroll();return e = t > n && n ? "down" : t < n && n ? "up" : "static", v.cache.direction = e, v.cache.direction;
  14142. }, elementPosition: function elementPosition() {
  14143. var e = v.cache.element,
  14144. t = v.get.screenSize();return v.verbose("Saving element position"), e.fits = e.height < t.height, e.offset = A.offset(), e.width = A.outerWidth(), e.height = A.outerHeight(), v.is.verticallyScrollableContext() && (e.offset.top += R.scrollTop() - R.offset().top), v.is.horizontallyScrollableContext() && (e.offset.left += R.scrollLeft - R.offset().left), v.cache.element = e, e;
  14145. }, elementCalculations: function elementCalculations() {
  14146. var e = v.get.screenCalculations(),
  14147. t = v.get.elementPosition();return b.includeMargin ? (t.margin = {}, t.margin.top = parseInt(A.css("margin-top"), 10), t.margin.bottom = parseInt(A.css("margin-bottom"), 10), t.top = t.offset.top - t.margin.top, t.bottom = t.offset.top + t.height + t.margin.bottom) : (t.top = t.offset.top, t.bottom = t.offset.top + t.height), t.topPassed = e.top >= t.top, t.bottomPassed = e.top >= t.bottom, t.topVisible = e.bottom >= t.top && !t.topPassed, t.bottomVisible = e.bottom >= t.bottom && !t.bottomPassed, t.pixelsPassed = 0, t.percentagePassed = 0, t.onScreen = (t.topVisible || t.passing) && !t.bottomPassed, t.passing = t.topPassed && !t.bottomPassed, t.offScreen = !t.onScreen, t.passing && (t.pixelsPassed = e.top - t.top, t.percentagePassed = (e.top - t.top) / t.height), v.cache.element = t, v.verbose("Updated element calculations", t), t;
  14148. }, screenCalculations: function screenCalculations() {
  14149. var e = v.get.scroll();return v.save.direction(), v.cache.screen.top = e, v.cache.screen.bottom = e + v.cache.screen.height, v.cache.screen;
  14150. }, screenSize: function screenSize() {
  14151. v.verbose("Saving window position"), v.cache.screen = { height: R.height() };
  14152. }, position: function position() {
  14153. v.save.screenSize(), v.save.elementPosition();
  14154. } }, get: { pixelsPassed: function pixelsPassed(e) {
  14155. var t = v.get.elementCalculations();return e.search("%") > -1 ? t.height * (parseInt(e, 10) / 100) : parseInt(e, 10);
  14156. }, occurred: function occurred(e) {
  14157. return v.cache.occurred !== i && v.cache.occurred[e] || !1;
  14158. }, direction: function direction() {
  14159. return v.cache.direction === i && v.save.direction(), v.cache.direction;
  14160. }, elementPosition: function elementPosition() {
  14161. return v.cache.element === i && v.save.elementPosition(), v.cache.element;
  14162. }, elementCalculations: function elementCalculations() {
  14163. return v.cache.element === i && v.save.elementCalculations(), v.cache.element;
  14164. }, screenCalculations: function screenCalculations() {
  14165. return v.cache.screen === i && v.save.screenCalculations(), v.cache.screen;
  14166. }, screenSize: function screenSize() {
  14167. return v.cache.screen === i && v.save.screenSize(), v.cache.screen;
  14168. }, scroll: function scroll() {
  14169. return v.cache.scroll === i && v.save.scroll(), v.cache.scroll;
  14170. }, lastScroll: function lastScroll() {
  14171. return v.cache.screen === i ? (v.debug("First scroll event, no last scroll could be found"), !1) : v.cache.screen.top;
  14172. } }, setting: function setting(t, n) {
  14173. if (e.isPlainObject(t)) e.extend(!0, b, t);else {
  14174. if (n === i) return b[t];b[t] = n;
  14175. }
  14176. }, internal: function internal(t, n) {
  14177. if (e.isPlainObject(t)) e.extend(!0, v, t);else {
  14178. if (n === i) return v[t];v[t] = n;
  14179. }
  14180. }, debug: function debug() {
  14181. !b.silent && b.debug && (b.performance ? v.performance.log(arguments) : (v.debug = Function.prototype.bind.call(console.info, console, b.name + ":"), v.debug.apply(console, arguments)));
  14182. }, verbose: function verbose() {
  14183. !b.silent && b.verbose && b.debug && (b.performance ? v.performance.log(arguments) : (v.verbose = Function.prototype.bind.call(console.info, console, b.name + ":"), v.verbose.apply(console, arguments)));
  14184. }, error: function error() {
  14185. b.silent || (v.error = Function.prototype.bind.call(console.error, console, b.name + ":"), v.error.apply(console, arguments));
  14186. }, performance: { log: function log(e) {
  14187. var t, n;b.performance && (n = (t = new Date().getTime()) - (l || t), l = t, c.push({ Name: e[0], Arguments: [].slice.call(e, 1) || "", Element: F, "Execution Time": n })), clearTimeout(v.performance.timer), v.performance.timer = setTimeout(v.performance.display, 500);
  14188. }, display: function display() {
  14189. var t = b.name + ":",
  14190. n = 0;l = !1, clearTimeout(v.performance.timer), e.each(c, function (e, t) {
  14191. n += t["Execution Time"];
  14192. }), t += " " + n + "ms", s && (t += " '" + s + "'"), (console.group !== i || console.table !== i) && c.length > 0 && (console.groupCollapsed(t), console.table ? console.table(c) : e.each(c, function (e, t) {
  14193. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  14194. }), console.groupEnd()), c = [];
  14195. } }, invoke: function invoke(t, n, o) {
  14196. var r,
  14197. s,
  14198. l,
  14199. c = P;return n = n || f, o = F || o, "string" == typeof t && c !== i && (t = t.split(/[\. ]/), r = t.length - 1, e.each(t, function (n, o) {
  14200. var a = n != r ? o + t[n + 1].charAt(0).toUpperCase() + t[n + 1].slice(1) : t;if (e.isPlainObject(c[a]) && n != r) c = c[a];else {
  14201. if (c[a] !== i) return s = c[a], !1;if (!e.isPlainObject(c[o]) || n == r) return c[o] !== i ? (s = c[o], !1) : (v.error(C.method, t), !1);c = c[o];
  14202. }
  14203. })), e.isFunction(s) ? l = s.apply(o, n) : s !== i && (l = s), e.isArray(a) ? a.push(l) : a !== i ? a = [a, l] : l !== i && (a = l), s;
  14204. } }, d ? (P === i && v.initialize(), P.save.scroll(), P.save.calculations(), v.invoke(u)) : (P !== i && P.invoke("destroy"), v.initialize());
  14205. }), a !== i ? a : this;
  14206. }, e.fn.visibility.settings = { name: "Visibility", namespace: "visibility", debug: !1, verbose: !1, performance: !0, observeChanges: !0, initialCheck: !0, refreshOnLoad: !0, refreshOnResize: !0, checkOnRefresh: !0, once: !0, continuous: !1, offset: 0, includeMargin: !1, context: t, throttle: !1, type: !1, zIndex: "10", transition: "fade in", duration: 1e3, onPassed: {}, onOnScreen: !1, onOffScreen: !1, onPassing: !1, onTopVisible: !1, onBottomVisible: !1, onTopPassed: !1, onBottomPassed: !1, onPassingReverse: !1, onTopVisibleReverse: !1, onBottomVisibleReverse: !1, onTopPassedReverse: !1, onBottomPassedReverse: !1, onLoad: function onLoad() {}, onAllLoaded: function onAllLoaded() {}, onFixed: function onFixed() {}, onUnfixed: function onUnfixed() {}, onUpdate: !1, onRefresh: function onRefresh() {}, metadata: { src: "src" }, className: { fixed: "fixed", placeholder: "placeholder", visible: "visible" }, error: { method: "The method you called is not defined.", visible: "Element is hidden, you must call refresh after element becomes visible" } };
  14207. }(jQuery, window, document);
  14208. /***/ }),
  14209. /***/ "./js/services/i18nHelper.js":
  14210. /*!***********************************!*\
  14211. !*** ./js/services/i18nHelper.js ***!
  14212. \***********************************/
  14213. /*! no static exports found */
  14214. /***/ (function(module, exports, __webpack_require__) {
  14215. "use strict";
  14216. Object.defineProperty(exports, "__esModule", {
  14217. value: true
  14218. });
  14219. exports.i18nHelper = undefined;
  14220. var _lineI18n = __webpack_require__(/*! line-i18n */ "./node_modules/line-i18n/dist/index.js");
  14221. var _lineI18n2 = _interopRequireDefault(_lineI18n);
  14222. var _localizedStringsService = __webpack_require__(/*! ./localizedStringsService */ "./js/services/localizedStringsService.js");
  14223. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  14224. var StringTypes = _lineI18n2.default.StringTypes;
  14225. var i18nHelper = exports.i18nHelper = Object.freeze({
  14226. i18n: function i18n(identifier) {
  14227. var opts = identifier.split(':');
  14228. var type = opts[0].toLowerCase();
  14229. var id = opts[1];
  14230. if (StringTypes.ERROR === type) {
  14231. return _localizedStringsService.LocalizedStrings.getError(id);
  14232. } else if (StringTypes.MESSAGE === type) {
  14233. return _localizedStringsService.LocalizedStrings.getMessage(id);
  14234. } else if (StringTypes.UI === type) {
  14235. return _localizedStringsService.LocalizedStrings.getUI(id);
  14236. } else {
  14237. console.warn("A string has been passed to the i18n helper function that was not in the form type:id -> " + identifier);
  14238. return _localizedStringsService.LocalizedStrings.getString(identifier, type);
  14239. }
  14240. }
  14241. });
  14242. /***/ }),
  14243. /***/ "./js/services/languageService.js":
  14244. /*!****************************************!*\
  14245. !*** ./js/services/languageService.js ***!
  14246. \****************************************/
  14247. /*! no static exports found */
  14248. /***/ (function(module, exports, __webpack_require__) {
  14249. "use strict";
  14250. Object.defineProperty(exports, "__esModule", {
  14251. value: true
  14252. });
  14253. exports.LanguageService = undefined;
  14254. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  14255. var _grammar = __webpack_require__(/*! ./../../grammar/ */ "./grammar/index.js");
  14256. var _grammar2 = _interopRequireDefault(_grammar);
  14257. var _lineI18n = __webpack_require__(/*! line-i18n */ "./node_modules/line-i18n/dist/index.js");
  14258. var _lineI18n2 = _interopRequireDefault(_lineI18n);
  14259. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  14260. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  14261. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  14262. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  14263. // This is for LanguageService with localStorage
  14264. // const DEFAULT_LANG = "pt";
  14265. var LanguageServiceExtended = function (_line_i18n$LanguageSe) {
  14266. _inherits(LanguageServiceExtended, _line_i18n$LanguageSe);
  14267. function LanguageServiceExtended() {
  14268. _classCallCheck(this, LanguageServiceExtended);
  14269. return _possibleConstructorReturn(this, (LanguageServiceExtended.__proto__ || Object.getPrototypeOf(LanguageServiceExtended)).call(this, iLMparameters.lang));
  14270. }
  14271. _createClass(LanguageServiceExtended, [{
  14272. key: 'getCurrentLexer',
  14273. value: function getCurrentLexer() {
  14274. var langInfo = _grammar2.default[this.getLang()];
  14275. if (langInfo === null || langInfo === undefined) {
  14276. return _grammar2.default[this.getDefaultLang()].lexer;
  14277. } else {
  14278. return langInfo.lexer;
  14279. }
  14280. }
  14281. }, {
  14282. key: 'getCurrentLangFuncs',
  14283. value: function getCurrentLangFuncs() {
  14284. var langInfo = _grammar2.default[this.getLang()];
  14285. if (langInfo === null || langInfo === undefined) {
  14286. return _grammar2.default[this.getDefaultLang()].langFuncs;
  14287. } else {
  14288. return langInfo.langFuncs;
  14289. }
  14290. }
  14291. }, {
  14292. key: 'getCurrentLangLibs',
  14293. value: function getCurrentLangLibs() {
  14294. var langInfo = _grammar2.default[this.getLang()];
  14295. if (langInfo === null || langInfo === undefined) {
  14296. return _grammar2.default[this.getDefaultLang()].langLibs;
  14297. }
  14298. return langInfo.langLibs;
  14299. }
  14300. }]);
  14301. return LanguageServiceExtended;
  14302. }(_lineI18n2.default.LanguageServiceNoLS);
  14303. var LanguageService = exports.LanguageService = new LanguageServiceExtended();
  14304. /***/ }),
  14305. /***/ "./js/services/localizedStringsService.js":
  14306. /*!************************************************!*\
  14307. !*** ./js/services/localizedStringsService.js ***!
  14308. \************************************************/
  14309. /*! no static exports found */
  14310. /***/ (function(module, exports, __webpack_require__) {
  14311. "use strict";
  14312. Object.defineProperty(exports, "__esModule", {
  14313. value: true
  14314. });
  14315. exports.LocalizedStrings = undefined;
  14316. var _languageService = __webpack_require__(/*! ./languageService */ "./js/services/languageService.js");
  14317. var _lineI18n = __webpack_require__(/*! line-i18n */ "./node_modules/line-i18n/dist/index.js");
  14318. var _lineI18n2 = _interopRequireDefault(_lineI18n);
  14319. var _i18n = __webpack_require__(/*! ./../../i18n */ "./i18n/index.js");
  14320. var _i18n2 = _interopRequireDefault(_i18n);
  14321. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  14322. var LocalizedStrings = exports.LocalizedStrings = Object.freeze(new _lineI18n2.default.LocalizedStrings(_languageService.LanguageService, _i18n2.default, true));
  14323. /***/ }),
  14324. /***/ "./js/typeSystem/baseTypes.js":
  14325. /*!************************************!*\
  14326. !*** ./js/typeSystem/baseTypes.js ***!
  14327. \************************************/
  14328. /*! no static exports found */
  14329. /***/ (function(module, exports, __webpack_require__) {
  14330. "use strict";
  14331. Object.defineProperty(exports, "__esModule", {
  14332. value: true
  14333. });
  14334. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  14335. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  14336. var BaseType = function () {
  14337. function BaseType(name, ord) {
  14338. _classCallCheck(this, BaseType);
  14339. this.name = name;
  14340. this.ord = ord;
  14341. }
  14342. _createClass(BaseType, [{
  14343. key: "isCompatible",
  14344. value: function isCompatible(another) {
  14345. if (another instanceof BaseType) {
  14346. return this.name === another.name && this.ord === another.ord;
  14347. }
  14348. return false;
  14349. }
  14350. }, {
  14351. key: "value",
  14352. get: function get() {
  14353. return this.name;
  14354. }
  14355. }]);
  14356. return BaseType;
  14357. }();
  14358. // Base types names are the same as i18n ui type keys
  14359. var BaseTypes = exports.BaseTypes = Object.freeze({
  14360. INTEGER: new BaseType("integer", 0),
  14361. REAL: new BaseType("real", 1),
  14362. STRING: new BaseType("text", 2),
  14363. BOOLEAN: new BaseType("boolean", 3),
  14364. VOID: new BaseType("void", 4),
  14365. UNDEFINED: new BaseType("undefined", 5)
  14366. });
  14367. /***/ }),
  14368. /***/ "./js/typeSystem/compoundType.js":
  14369. /*!***************************************!*\
  14370. !*** ./js/typeSystem/compoundType.js ***!
  14371. \***************************************/
  14372. /*! no static exports found */
  14373. /***/ (function(module, exports, __webpack_require__) {
  14374. "use strict";
  14375. Object.defineProperty(exports, "__esModule", {
  14376. value: true
  14377. });
  14378. exports.CompoundType = undefined;
  14379. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  14380. var _type = __webpack_require__(/*! ./type */ "./js/typeSystem/type.js");
  14381. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  14382. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  14383. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  14384. var CompoundType = exports.CompoundType = function (_Type) {
  14385. _inherits(CompoundType, _Type);
  14386. function CompoundType(type, dimensions) {
  14387. _classCallCheck(this, CompoundType);
  14388. var _this = _possibleConstructorReturn(this, (CompoundType.__proto__ || Object.getPrototypeOf(CompoundType)).call(this, null));
  14389. _this.innerType = type;
  14390. _this.dimensions = dimensions;
  14391. return _this;
  14392. }
  14393. _createClass(CompoundType, [{
  14394. key: "isCompatible",
  14395. value: function isCompatible(another) {
  14396. if (another instanceof CompoundType) {
  14397. if (this.dimensions !== another.dimensions) {
  14398. return false;
  14399. }
  14400. return this.innerType.isCompatible(another.innerType);
  14401. }
  14402. return false;
  14403. }
  14404. }, {
  14405. key: "stringInfo",
  14406. value: function stringInfo() {
  14407. var _this2 = this;
  14408. var list = this.innerType.stringInfo();
  14409. list.forEach(function (v) {
  14410. v.dim = _this2.dimensions;
  14411. });
  14412. return list;
  14413. }
  14414. }, {
  14415. key: "canAccept",
  14416. value: function canAccept(another) {
  14417. if (another instanceof CompoundType) {
  14418. return this.dimensions > another.dimensions && this.innerType.isCompatible(another.innerType);
  14419. } else {
  14420. return this.innerType.isCompatible(another);
  14421. }
  14422. }
  14423. }]);
  14424. return CompoundType;
  14425. }(_type.Type);
  14426. /***/ }),
  14427. /***/ "./js/typeSystem/multiType.js":
  14428. /*!************************************!*\
  14429. !*** ./js/typeSystem/multiType.js ***!
  14430. \************************************/
  14431. /*! no static exports found */
  14432. /***/ (function(module, exports, __webpack_require__) {
  14433. "use strict";
  14434. Object.defineProperty(exports, "__esModule", {
  14435. value: true
  14436. });
  14437. exports.MultiType = undefined;
  14438. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  14439. var _type = __webpack_require__(/*! ./type */ "./js/typeSystem/type.js");
  14440. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  14441. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  14442. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  14443. var MultiType = exports.MultiType = function (_Type) {
  14444. _inherits(MultiType, _Type);
  14445. function MultiType(types) {
  14446. _classCallCheck(this, MultiType);
  14447. var _this = _possibleConstructorReturn(this, (MultiType.__proto__ || Object.getPrototypeOf(MultiType)).call(this, null));
  14448. _this.types = types;
  14449. return _this;
  14450. }
  14451. _createClass(MultiType, [{
  14452. key: "stringInfo",
  14453. value: function stringInfo() {
  14454. var list = [];
  14455. for (var i = 0; i < this.types.length; i++) {
  14456. var t = this.types[i];
  14457. list = list.concat(t.stringInfo());
  14458. }
  14459. return list;
  14460. }
  14461. }, {
  14462. key: "isCompatible",
  14463. value: function isCompatible(another) {
  14464. if (another instanceof _type.Type) {
  14465. for (var i = 0; i < this.types.length; i++) {
  14466. var t = this.types[i];
  14467. if (t.isCompatible(another)) {
  14468. return true;
  14469. }
  14470. }
  14471. }
  14472. return false;
  14473. }
  14474. }, {
  14475. key: "value",
  14476. get: function get() {
  14477. return null;
  14478. }
  14479. }, {
  14480. key: "ord",
  14481. get: function get() {
  14482. return null;
  14483. }
  14484. }]);
  14485. return MultiType;
  14486. }(_type.Type);
  14487. /***/ }),
  14488. /***/ "./js/typeSystem/parsers.js":
  14489. /*!**********************************!*\
  14490. !*** ./js/typeSystem/parsers.js ***!
  14491. \**********************************/
  14492. /*! no static exports found */
  14493. /***/ (function(module, exports, __webpack_require__) {
  14494. "use strict";
  14495. Object.defineProperty(exports, "__esModule", {
  14496. value: true
  14497. });
  14498. exports.toInt = toInt;
  14499. exports.toString = toString;
  14500. exports.toReal = toReal;
  14501. exports.toBool = toBool;
  14502. exports.convertToString = convertToString;
  14503. var _languageService = __webpack_require__(/*! ../services/languageService */ "./js/services/languageService.js");
  14504. var _types = __webpack_require__(/*! ./types */ "./js/typeSystem/types.js");
  14505. var _decimal = __webpack_require__(/*! decimal.js */ "./node_modules/decimal.js/decimal.js");
  14506. var _decimal2 = _interopRequireDefault(_decimal);
  14507. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  14508. function toInt(str) {
  14509. return new _decimal2.default(str);
  14510. }
  14511. function toString(str) {
  14512. var value = str.replace(/^"/, '');
  14513. value = value.replace(/"$/, '');
  14514. value = value.replace(/\\b/g, "\b");
  14515. value = value.replace(/\\t/g, "\t");
  14516. value = value.replace(/\\n/g, "\n");
  14517. value = value.replace(/\\r/g, "\r");
  14518. value = value.replace(/\\\"/g, "\"");
  14519. value = value.replace(/\\\'/g, "\'");
  14520. value = value.replace(/\\\\/g, "\\");
  14521. return value;
  14522. }
  14523. function toReal(value) {
  14524. return new _decimal2.default(value);
  14525. }
  14526. function toBool(str) {
  14527. var val = "'" + str + "'";
  14528. var lexer = _languageService.LanguageService.getCurrentLexer();
  14529. var instance = new lexer(null);
  14530. if (instance.literalNames[lexer.RK_TRUE] === val) {
  14531. return true;
  14532. } else if (instance.literalNames[lexer.RK_FALSE] === val) {
  14533. return false;
  14534. } else {
  14535. // TODO: better error message
  14536. throw new Error(str + "not a valid boolean");
  14537. }
  14538. }
  14539. function convertBoolToString(bool) {
  14540. var lexer = _languageService.LanguageService.getCurrentLexer();
  14541. var instance = new lexer(null);
  14542. if (bool) {
  14543. return instance.literalNames[lexer.RK_TRUE];
  14544. } else {
  14545. return instance.literalNames[lexer.RK_FALSE];
  14546. }
  14547. }
  14548. function convertToString(stoObj, type) {
  14549. switch (type.ord) {
  14550. case _types.Types.INTEGER.ord:
  14551. return stoObj.toString();
  14552. case _types.Types.REAL.ord:
  14553. {
  14554. if (stoObj.dp() <= 0) {
  14555. return stoObj.toFixed(1);
  14556. } else {
  14557. return stoObj.toNumber();
  14558. }
  14559. }
  14560. case _types.Types.BOOLEAN.ord:
  14561. return convertBoolToString(stoObj);
  14562. default:
  14563. return stoObj;
  14564. }
  14565. }
  14566. /***/ }),
  14567. /***/ "./js/typeSystem/type.js":
  14568. /*!*******************************!*\
  14569. !*** ./js/typeSystem/type.js ***!
  14570. \*******************************/
  14571. /*! no static exports found */
  14572. /***/ (function(module, exports, __webpack_require__) {
  14573. "use strict";
  14574. Object.defineProperty(exports, "__esModule", {
  14575. value: true
  14576. });
  14577. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  14578. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  14579. var Type = exports.Type = function () {
  14580. function Type(baseType) {
  14581. _classCallCheck(this, Type);
  14582. this.baseType = baseType;
  14583. }
  14584. _createClass(Type, [{
  14585. key: "stringInfo",
  14586. value: function stringInfo() {
  14587. return [{ type: this.baseType.name, dim: 0 }];
  14588. }
  14589. }, {
  14590. key: "isCompatible",
  14591. value: function isCompatible(another) {
  14592. if (another instanceof Type) {
  14593. return this.baseType.isCompatible(another.baseType);
  14594. }
  14595. return false;
  14596. }
  14597. }, {
  14598. key: "value",
  14599. get: function get() {
  14600. return this.baseType.value;
  14601. }
  14602. }, {
  14603. key: "ord",
  14604. get: function get() {
  14605. return this.baseType.ord;
  14606. }
  14607. }]);
  14608. return Type;
  14609. }();
  14610. /***/ }),
  14611. /***/ "./js/typeSystem/types.js":
  14612. /*!********************************!*\
  14613. !*** ./js/typeSystem/types.js ***!
  14614. \********************************/
  14615. /*! no static exports found */
  14616. /***/ (function(module, exports, __webpack_require__) {
  14617. "use strict";
  14618. Object.defineProperty(exports, "__esModule", {
  14619. value: true
  14620. });
  14621. exports.Types = undefined;
  14622. var _baseTypes = __webpack_require__(/*! ./baseTypes */ "./js/typeSystem/baseTypes.js");
  14623. var _type = __webpack_require__(/*! ./type */ "./js/typeSystem/type.js");
  14624. var _multiType = __webpack_require__(/*! ./multiType */ "./js/typeSystem/multiType.js");
  14625. var INTEGER = new _type.Type(_baseTypes.BaseTypes.INTEGER);
  14626. var REAL = new _type.Type(_baseTypes.BaseTypes.REAL);
  14627. var STRING = new _type.Type(_baseTypes.BaseTypes.STRING);
  14628. var BOOLEAN = new _type.Type(_baseTypes.BaseTypes.BOOLEAN);
  14629. var VOID = new _type.Type(_baseTypes.BaseTypes.VOID);
  14630. var UNDEFINED = new _type.Type(_baseTypes.BaseTypes.UNDEFINED);
  14631. var ALL = new _multiType.MultiType([INTEGER, REAL, STRING, BOOLEAN]);
  14632. var Types = exports.Types = Object.freeze({
  14633. INTEGER: INTEGER,
  14634. REAL: REAL,
  14635. STRING: STRING,
  14636. BOOLEAN: BOOLEAN,
  14637. VOID: VOID,
  14638. UNDEFINED: UNDEFINED,
  14639. ALL: ALL
  14640. });
  14641. /***/ }),
  14642. /***/ "./js/util/config.js":
  14643. /*!***************************!*\
  14644. !*** ./js/util/config.js ***!
  14645. \***************************/
  14646. /*! no static exports found */
  14647. /***/ (function(module, exports, __webpack_require__) {
  14648. "use strict";
  14649. Object.defineProperty(exports, "__esModule", {
  14650. value: true
  14651. });
  14652. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  14653. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  14654. var ConfigObject = function () {
  14655. function ConfigObject() {
  14656. _classCallCheck(this, ConfigObject);
  14657. this.loopTimeout = 5000;
  14658. this.decimalPlaces = 5;
  14659. this.intConvertRoundMode = 2;
  14660. }
  14661. _createClass(ConfigObject, [{
  14662. key: "setConfig",
  14663. value: function setConfig(opts) {
  14664. for (var key in opts) {
  14665. if (this.hasOwnProperty(key)) {
  14666. this[key] = opts[key];
  14667. }
  14668. }
  14669. }
  14670. }]);
  14671. return ConfigObject;
  14672. }();
  14673. var config = new ConfigObject();
  14674. var Config = exports.Config = config;
  14675. /***/ }),
  14676. /***/ "./js/util/inputTest.js":
  14677. /*!******************************!*\
  14678. !*** ./js/util/inputTest.js ***!
  14679. \******************************/
  14680. /*! no static exports found */
  14681. /***/ (function(module, exports, __webpack_require__) {
  14682. "use strict";
  14683. Object.defineProperty(exports, "__esModule", {
  14684. value: true
  14685. });
  14686. exports.InputTest = undefined;
  14687. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  14688. var _input = __webpack_require__(/*! ./../io/input */ "./js/io/input.js");
  14689. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  14690. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  14691. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  14692. var InputTest = exports.InputTest = function (_Input) {
  14693. _inherits(InputTest, _Input);
  14694. function InputTest(inputList) {
  14695. _classCallCheck(this, InputTest);
  14696. var _this = _possibleConstructorReturn(this, (InputTest.__proto__ || Object.getPrototypeOf(InputTest)).call(this));
  14697. _this.index = 0;
  14698. _this.inputList = inputList;
  14699. return _this;
  14700. }
  14701. _createClass(InputTest, [{
  14702. key: 'requestInput',
  14703. value: function requestInput(callback) {
  14704. if (this.index < this.inputList.length) {
  14705. callback(this.inputList[this.index]);
  14706. this.index++;
  14707. } else {
  14708. throw new Error('The amount of requests exceeded the amount of available inputs');
  14709. }
  14710. }
  14711. }]);
  14712. return InputTest;
  14713. }(_input.Input);
  14714. /***/ }),
  14715. /***/ "./js/util/outputTest.js":
  14716. /*!*******************************!*\
  14717. !*** ./js/util/outputTest.js ***!
  14718. \*******************************/
  14719. /*! no static exports found */
  14720. /***/ (function(module, exports, __webpack_require__) {
  14721. "use strict";
  14722. Object.defineProperty(exports, "__esModule", {
  14723. value: true
  14724. });
  14725. exports.OutputTest = undefined;
  14726. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  14727. var _output = __webpack_require__(/*! ./../io/output */ "./js/io/output.js");
  14728. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  14729. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  14730. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  14731. var OutputTest = exports.OutputTest = function (_Output) {
  14732. _inherits(OutputTest, _Output);
  14733. function OutputTest() {
  14734. _classCallCheck(this, OutputTest);
  14735. var _this = _possibleConstructorReturn(this, (OutputTest.__proto__ || Object.getPrototypeOf(OutputTest)).call(this));
  14736. _this.list = [];
  14737. return _this;
  14738. }
  14739. _createClass(OutputTest, [{
  14740. key: 'sendOutput',
  14741. value: function sendOutput(text) {
  14742. this.list.push(text);
  14743. }
  14744. }]);
  14745. return OutputTest;
  14746. }(_output.Output);
  14747. /***/ }),
  14748. /***/ "./js/visualUI/algorithm.js":
  14749. /*!**********************************!*\
  14750. !*** ./js/visualUI/algorithm.js ***!
  14751. \**********************************/
  14752. /*! no static exports found */
  14753. /***/ (function(module, exports, __webpack_require__) {
  14754. "use strict";
  14755. Object.defineProperty(exports, "__esModule", {
  14756. value: true
  14757. });
  14758. exports.renderAlgorithm = renderAlgorithm;
  14759. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  14760. var _jquery2 = _interopRequireDefault(_jquery);
  14761. var _types = __webpack_require__(/*! ./types */ "./js/visualUI/types.js");
  14762. var _ivprog_elements = __webpack_require__(/*! ./ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  14763. var Models = _interopRequireWildcard(_ivprog_elements);
  14764. var _localizedStringsService = __webpack_require__(/*! ./../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  14765. var _globals = __webpack_require__(/*! ./globals */ "./js/visualUI/globals.js");
  14766. var GlobalsManagement = _interopRequireWildcard(_globals);
  14767. var _variables = __webpack_require__(/*! ./variables */ "./js/visualUI/variables.js");
  14768. var VariablesManagement = _interopRequireWildcard(_variables);
  14769. var _commands = __webpack_require__(/*! ./commands */ "./js/visualUI/commands.js");
  14770. var CommandsManagement = _interopRequireWildcard(_commands);
  14771. var _code_generator = __webpack_require__(/*! ./code_generator */ "./js/visualUI/code_generator.js");
  14772. var CodeManagement = _interopRequireWildcard(_code_generator);
  14773. var _variable_value_menu = __webpack_require__(/*! ./commands/variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  14774. var VariableValueMenu = _interopRequireWildcard(_variable_value_menu);
  14775. var _functions = __webpack_require__(/*! ./functions */ "./js/visualUI/functions.js");
  14776. var FunctionsManagement = _interopRequireWildcard(_functions);
  14777. var _domConsole = __webpack_require__(/*! ./../io/domConsole */ "./js/io/domConsole.js");
  14778. var _ivprogParser = __webpack_require__(/*! ./../ast/ivprogParser */ "./js/ast/ivprogParser.js");
  14779. var _ivprogProcessor = __webpack_require__(/*! ./../processor/ivprogProcessor */ "./js/processor/ivprogProcessor.js");
  14780. var _languageService = __webpack_require__(/*! ../services/languageService */ "./js/services/languageService.js");
  14781. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  14782. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  14783. var block_render = false;
  14784. function renderAlgorithm() {
  14785. console.log('rendering algorithm...');
  14786. if (block_render) {
  14787. return;
  14788. }
  14789. block_render = true;
  14790. (0, _jquery2.default)('.all_functions').children().off();
  14791. (0, _jquery2.default)('.all_functions').empty();
  14792. (0, _jquery2.default)('.list_globals').children().off();
  14793. (0, _jquery2.default)('.list_globals').empty();
  14794. for (var i = 0; i < window.program_obj.functions.length; i++) {
  14795. FunctionsManagement.renderFunction(window.program_obj.functions[i]);
  14796. }
  14797. for (var i = 0; i < window.program_obj.globals.length; i++) {
  14798. GlobalsManagement.renderGlobal(window.program_obj.globals[i]);
  14799. }
  14800. setTimeout(function () {
  14801. block_render = false;
  14802. }, 500);
  14803. }
  14804. /***/ }),
  14805. /***/ "./js/visualUI/code_generator.js":
  14806. /*!***************************************!*\
  14807. !*** ./js/visualUI/code_generator.js ***!
  14808. \***************************************/
  14809. /*! no static exports found */
  14810. /***/ (function(module, exports, __webpack_require__) {
  14811. "use strict";
  14812. Object.defineProperty(exports, "__esModule", {
  14813. value: true
  14814. });
  14815. exports.generate = generate;
  14816. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  14817. var _jquery2 = _interopRequireDefault(_jquery);
  14818. var _types = __webpack_require__(/*! ./types */ "./js/visualUI/types.js");
  14819. var _ivprog_elements = __webpack_require__(/*! ./ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  14820. var Models = _interopRequireWildcard(_ivprog_elements);
  14821. var _localizedStringsService = __webpack_require__(/*! ./../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  14822. var _globals = __webpack_require__(/*! ./globals */ "./js/visualUI/globals.js");
  14823. var GlobalsManagement = _interopRequireWildcard(_globals);
  14824. var _variables = __webpack_require__(/*! ./variables */ "./js/visualUI/variables.js");
  14825. var VariablesManagement = _interopRequireWildcard(_variables);
  14826. var _commands = __webpack_require__(/*! ./commands */ "./js/visualUI/commands.js");
  14827. var CommandsManagement = _interopRequireWildcard(_commands);
  14828. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  14829. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  14830. function generate() {
  14831. (0, _jquery2.default)('.ivprog_visual_panel').find('.error_icon').remove();
  14832. var code = _localizedStringsService.LocalizedStrings.getUI('program') + ' { ';
  14833. code += globalsCode();
  14834. code += '\n';
  14835. var has_error = false;
  14836. for (var i = 0; i < window.program_obj.functions.length; i++) {
  14837. var n_code = functionsCode(window.program_obj.functions[i]);
  14838. if (n_code == null) {
  14839. has_error = true;
  14840. }
  14841. code += n_code;
  14842. code += '\n';
  14843. }
  14844. code += '\n}';
  14845. if (has_error) {
  14846. return null;
  14847. } else {
  14848. return code;
  14849. }
  14850. }
  14851. function functionsCode(function_obj) {
  14852. var ret = '\n\t' + _localizedStringsService.LocalizedStrings.getUI('function') + ' ';
  14853. var has_error = false;
  14854. switch (function_obj.return_type) {
  14855. case _types.Types.INTEGER:
  14856. ret += _localizedStringsService.LocalizedStrings.getUI('integer');
  14857. break;
  14858. case _types.Types.REAL:
  14859. ret += _localizedStringsService.LocalizedStrings.getUI('real');
  14860. break;
  14861. case _types.Types.TEXT:
  14862. ret += _localizedStringsService.LocalizedStrings.getUI('text');
  14863. break;
  14864. case _types.Types.BOOLEAN:
  14865. ret += _localizedStringsService.LocalizedStrings.getUI('boolean');
  14866. break;
  14867. case _types.Types.VOID:
  14868. ret += _localizedStringsService.LocalizedStrings.getUI('void');
  14869. break;
  14870. }
  14871. ret += ' ';
  14872. if (function_obj.return_dimensions == 1) {
  14873. ret += '[] ';
  14874. } else if (function_obj.return_dimensions == 2) {
  14875. ret += '[][] ';
  14876. }
  14877. ret += function_obj.name + ' ( ';
  14878. for (var j = 0; j < function_obj.parameters_list.length; j++) {
  14879. ret += parametersCode(function_obj.parameters_list[j]);
  14880. if (j + 1 < function_obj.parameters_list.length) {
  14881. ret += ',';
  14882. }
  14883. }
  14884. ret += ' ) {';
  14885. for (var j = 0; j < function_obj.variables_list.length; j++) {
  14886. ret += variablesCode(function_obj.variables_list[j]);
  14887. }
  14888. for (var j = 0; j < function_obj.commands.length; j++) {
  14889. //try {
  14890. ret += commandsCode(function_obj.commands[j]);
  14891. /*} catch (err) {
  14892. has_error = true;
  14893. console.error(err.message);
  14894. var todos = $('body').find('.command_container');
  14895. for (var i = 0; i < todos.length; i++) {
  14896. if ($(todos[i]).data('command') == function_obj.commands[j]) {
  14897. $( todos[i] ).prepend( ' <i class="ui icon red exclamation triangle error_icon"></i> ' );
  14898. break;
  14899. }
  14900. }
  14901. }*/
  14902. }
  14903. ret += '\n\t}';
  14904. if (has_error) {
  14905. return null;
  14906. } else {
  14907. return ret;
  14908. }
  14909. }
  14910. function commandsCode(command_obj) {
  14911. var indentation = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 2;
  14912. switch (command_obj.type) {
  14913. case Models.COMMAND_TYPES.break:
  14914. return breaksCode(command_obj, indentation);
  14915. case Models.COMMAND_TYPES.comment:
  14916. return commentsCode(command_obj, indentation);
  14917. case Models.COMMAND_TYPES.reader:
  14918. return readersCode(command_obj, indentation);
  14919. case Models.COMMAND_TYPES.writer:
  14920. return writersCode(command_obj, indentation);
  14921. case Models.COMMAND_TYPES.functioncall:
  14922. return functioncallsCode(command_obj, indentation);
  14923. case Models.COMMAND_TYPES.attribution:
  14924. return attributionsCode(command_obj, indentation);
  14925. case Models.COMMAND_TYPES.whiletrue:
  14926. return whiletruesCode(command_obj, indentation);
  14927. case Models.COMMAND_TYPES.dowhiletrue:
  14928. return doWhilesCode(command_obj, indentation);
  14929. case Models.COMMAND_TYPES.iftrue:
  14930. return iftruesCode(command_obj, indentation);
  14931. case Models.COMMAND_TYPES.repeatNtimes:
  14932. return repeatNtimesCode(command_obj, indentation);
  14933. case Models.COMMAND_TYPES.switch:
  14934. return switchsCode(command_obj, indentation);
  14935. case Models.COMMAND_TYPES.return:
  14936. return returnsCode(command_obj, indentation);
  14937. }
  14938. }
  14939. function returnsCode(command_obj, indentation) {
  14940. var ret = '\n';
  14941. for (var i = 0; i < indentation; i++) {
  14942. ret += '\t';
  14943. }
  14944. ret += _localizedStringsService.LocalizedStrings.getUI('text_return');
  14945. if (command_obj.variable_value_menu) {
  14946. try {
  14947. ret += ' ' + variableValueMenuCode(command_obj.variable_value_menu);
  14948. } catch (err) {}
  14949. }
  14950. return ret;
  14951. }
  14952. function breaksCode(command_obj, indentation) {
  14953. var ret = '\n';
  14954. for (var i = 0; i < indentation; i++) {
  14955. ret += '\t';
  14956. }
  14957. ret += _localizedStringsService.LocalizedStrings.getUI('text_break');
  14958. return ret;
  14959. }
  14960. function switchsCode(command_obj, indentation) {
  14961. var ret = '\n';
  14962. for (var i = 0; i < indentation; i++) {
  14963. ret += '\t';
  14964. }
  14965. ret += _localizedStringsService.LocalizedStrings.getUI('text_code_switch') + ' ( ';
  14966. ret += variableValueMenuCode(command_obj.variable);
  14967. ret += ' ) { ';
  14968. if (command_obj.cases) {
  14969. for (var i = 0; i < command_obj.cases.length; i++) {
  14970. ret += switchcasesCode(command_obj.cases[i], indentation + 1);
  14971. }
  14972. }
  14973. ret += '\n';
  14974. for (var i = 0; i < indentation; i++) {
  14975. ret += '\t';
  14976. }
  14977. ret += '} ';
  14978. return ret;
  14979. }
  14980. function switchcasesCode(switchcase, indentation) {
  14981. var ret = '\n';
  14982. for (var i = 0; i < indentation; i++) {
  14983. ret += '\t';
  14984. }
  14985. ret += _localizedStringsService.LocalizedStrings.getUI('text_code_case') + ' ';
  14986. ret += variableValueMenuCode(switchcase.variable_value_menu);
  14987. ret += ' :';
  14988. if (switchcase.commands_block) {
  14989. for (var i = 0; i < switchcase.commands_block.length; i++) {
  14990. ret += commandsCode(switchcase.commands_block[i], indentation + 1);
  14991. }
  14992. }
  14993. return ret;
  14994. }
  14995. function repeatNtimesCode(command_obj, indentation) {
  14996. var ret = '\n';
  14997. for (var i = 0; i < indentation; i++) {
  14998. ret += '\t';
  14999. }
  15000. ret += _localizedStringsService.LocalizedStrings.getUI('text_for') + ' ( ';
  15001. if (command_obj.var_attribution) {
  15002. ret += variableValueMenuCode(command_obj.var_attribution);
  15003. ret += ' = ';
  15004. ret += variableValueMenuCode(command_obj.expression1);
  15005. }
  15006. ret += ' ; ';
  15007. if (command_obj.expression2) {
  15008. switch (command_obj.expression2.expression.type) {
  15009. case Models.EXPRESSION_TYPES.exp_logic:
  15010. ret += logicExpressionCode(command_obj.expression2.expression);
  15011. break;
  15012. case Models.EXPRESSION_TYPES.exp_arithmetic:
  15013. ret += arithmeticExpressionCode(command_obj.expression2.expression);
  15014. break;
  15015. }
  15016. }
  15017. ret += ' ; ';
  15018. if (command_obj.var_incrementation) {
  15019. ret += variableValueMenuCode(command_obj.var_incrementation);
  15020. ret += ' = ';
  15021. ret += variableValueMenuCode(command_obj.expression3.itens[0]);
  15022. switch (command_obj.expression3.itens[1]) {
  15023. case Models.ARITHMETIC_TYPES.plus:
  15024. ret += ' + ';
  15025. break;
  15026. case Models.ARITHMETIC_TYPES.minus:
  15027. ret += ' - ';
  15028. break;
  15029. case Models.ARITHMETIC_TYPES.multiplication:
  15030. ret += ' * ';
  15031. break;
  15032. case Models.ARITHMETIC_TYPES.division:
  15033. ret += ' / ';
  15034. break;
  15035. case Models.ARITHMETIC_TYPES.module:
  15036. ret += ' % ';
  15037. break;
  15038. }
  15039. ret += variableValueMenuCode(command_obj.expression3.itens[2]);
  15040. }
  15041. ret += ' ) { ';
  15042. if (command_obj.commands_block) {
  15043. for (var i = 0; i < command_obj.commands_block.length; i++) {
  15044. ret += commandsCode(command_obj.commands_block[i], indentation + 1);
  15045. }
  15046. }
  15047. ret += '\n';
  15048. for (var i = 0; i < indentation; i++) {
  15049. ret += '\t';
  15050. }
  15051. ret += '}';
  15052. return ret;
  15053. }
  15054. function iftruesCode(command_obj, indentation) {
  15055. var ret = '\n';
  15056. for (var i = 0; i < indentation; i++) {
  15057. ret += '\t';
  15058. }
  15059. ret += _localizedStringsService.LocalizedStrings.getUI('text_if');
  15060. switch (command_obj.expression.expression.type) {
  15061. case Models.EXPRESSION_TYPES.exp_logic:
  15062. ret += logicExpressionCode(command_obj.expression.expression);
  15063. break;
  15064. case Models.EXPRESSION_TYPES.exp_arithmetic:
  15065. ret += arithmeticExpressionCode(command_obj.expression.expression);
  15066. break;
  15067. }
  15068. ret += ' { ';
  15069. if (command_obj.commands_block) {
  15070. for (var i = 0; i < command_obj.commands_block.length; i++) {
  15071. ret += commandsCode(command_obj.commands_block[i], indentation + 1);
  15072. }
  15073. }
  15074. ret += '\n';
  15075. for (var i = 0; i < indentation; i++) {
  15076. ret += '\t';
  15077. }
  15078. ret += '} ' + _localizedStringsService.LocalizedStrings.getUI('text_else') + ' {';
  15079. if (command_obj.commands_else) {
  15080. for (var i = 0; i < command_obj.commands_else.length; i++) {
  15081. ret += commandsCode(command_obj.commands_else[i], indentation + 1);
  15082. }
  15083. }
  15084. ret += '\n';
  15085. for (var i = 0; i < indentation; i++) {
  15086. ret += '\t';
  15087. }
  15088. ret += '}';
  15089. return ret;
  15090. }
  15091. function doWhilesCode(command_obj, indentation) {
  15092. var ret = '\n';
  15093. for (var i = 0; i < indentation; i++) {
  15094. ret += '\t';
  15095. }
  15096. ret += _localizedStringsService.LocalizedStrings.getUI('text_code_do') + ' { ';
  15097. if (command_obj.commands_block) {
  15098. for (var i = 0; i < command_obj.commands_block.length; i++) {
  15099. ret += commandsCode(command_obj.commands_block[i], indentation + 1);
  15100. }
  15101. }
  15102. ret += '\n';
  15103. for (var i = 0; i < indentation; i++) {
  15104. ret += '\t';
  15105. }
  15106. ret += '} ' + _localizedStringsService.LocalizedStrings.getUI('text_code_while');
  15107. switch (command_obj.expression.expression.type) {
  15108. case Models.EXPRESSION_TYPES.exp_logic:
  15109. ret += logicExpressionCode(command_obj.expression.expression);
  15110. break;
  15111. case Models.EXPRESSION_TYPES.exp_arithmetic:
  15112. ret += arithmeticExpressionCode(command_obj.expression.expression);
  15113. break;
  15114. }
  15115. return ret;
  15116. }
  15117. function whiletruesCode(command_obj, indentation) {
  15118. var ret = '\n';
  15119. for (var i = 0; i < indentation; i++) {
  15120. ret += '\t';
  15121. }
  15122. ret += _localizedStringsService.LocalizedStrings.getUI('text_code_while');
  15123. switch (command_obj.expression.expression.type) {
  15124. case Models.EXPRESSION_TYPES.exp_logic:
  15125. ret += logicExpressionCode(command_obj.expression.expression);
  15126. break;
  15127. case Models.EXPRESSION_TYPES.exp_arithmetic:
  15128. ret += arithmeticExpressionCode(command_obj.expression.expression);
  15129. break;
  15130. }
  15131. ret += ' { ';
  15132. if (command_obj.commands_block) {
  15133. for (var i = 0; i < command_obj.commands_block.length; i++) {
  15134. ret += commandsCode(command_obj.commands_block[i], indentation + 1);
  15135. }
  15136. }
  15137. ret += '\n';
  15138. for (var i = 0; i < indentation; i++) {
  15139. ret += '\t';
  15140. }
  15141. ret += '}';
  15142. return ret;
  15143. }
  15144. function logicExpressionCode(expression) {
  15145. var ret = ' ( ';
  15146. if (expression.first_operand.type == Models.EXPRESSION_TYPES.exp_logic) {
  15147. ret += logicExpressionCode(expression.first_operand);
  15148. } else if (expression.first_operand.type == Models.EXPRESSION_TYPES.exp_arithmetic) {
  15149. ret += arithmeticExpressionCode(expression.first_operand);
  15150. } else {
  15151. ret += variableValueMenuCode(expression.first_operand);
  15152. }
  15153. if (expression.operator) {
  15154. switch (expression.operator) {
  15155. case Models.LOGIC_COMPARISON.equals_to:
  15156. ret += ' == ';
  15157. break;
  15158. case Models.LOGIC_COMPARISON.not_equals_to:
  15159. ret += ' != ';
  15160. break;
  15161. case Models.LOGIC_COMPARISON.and:
  15162. ret += ' && ';
  15163. break;
  15164. case Models.LOGIC_COMPARISON.or:
  15165. ret += ' || ';
  15166. break;
  15167. }
  15168. if (expression.second_operand.type == Models.EXPRESSION_TYPES.exp_logic) {
  15169. ret += logicExpressionCode(expression.second_operand);
  15170. } else if (expression.second_operand.type == Models.EXPRESSION_TYPES.exp_arithmetic) {
  15171. ret += arithmeticExpressionCode(expression.second_operand);
  15172. } else {
  15173. ret += variableValueMenuCode(expression.second_operand);
  15174. }
  15175. }
  15176. ret += ' ) ';
  15177. return ret;
  15178. }
  15179. function arithmeticExpressionCode(expression) {
  15180. var ret = ' ( ';
  15181. if (expression.first_operand.type == Models.EXPRESSION_TYPES.exp_logic) {
  15182. ret += logicExpressionCode(expression.first_operand);
  15183. } else if (expression.first_operand.type == Models.EXPRESSION_TYPES.exp_arithmetic) {
  15184. ret += arithmeticExpressionCode(expression.first_operand);
  15185. } else {
  15186. ret += variableValueMenuCode(expression.first_operand);
  15187. }
  15188. switch (expression.operator) {
  15189. case Models.ARITHMETIC_COMPARISON.greater_than:
  15190. ret += ' > ';
  15191. break;
  15192. case Models.ARITHMETIC_COMPARISON.less_than:
  15193. ret += ' < ';
  15194. break;
  15195. case Models.ARITHMETIC_COMPARISON.equals_to:
  15196. ret += ' == ';
  15197. break;
  15198. case Models.ARITHMETIC_COMPARISON.not_equals_to:
  15199. ret += ' != ';
  15200. break;
  15201. case Models.ARITHMETIC_COMPARISON.greater_than_or_equals_to:
  15202. ret += ' >= ';
  15203. break;
  15204. case Models.ARITHMETIC_COMPARISON.less_than_or_equals_to:
  15205. ret += ' <= ';
  15206. break;
  15207. }
  15208. if (expression.second_operand.type == Models.EXPRESSION_TYPES.exp_logic) {
  15209. ret += logicExpressionCode(expression.second_operand);
  15210. } else if (expression.second_operand.type == Models.EXPRESSION_TYPES.exp_arithmetic) {
  15211. ret += arithmeticExpressionCode(expression.second_operand);
  15212. } else {
  15213. ret += variableValueMenuCode(expression.second_operand);
  15214. }
  15215. ret += ' ) ';
  15216. return ret;
  15217. }
  15218. function attributionsCode(command_obj, indentation) {
  15219. var ret = '\n';
  15220. for (var i = 0; i < indentation; i++) {
  15221. ret += '\t';
  15222. }
  15223. ret += variableValueMenuCode(command_obj.variable) + ' = ';
  15224. for (var i = 0; i < command_obj.expression.length; i++) {
  15225. ret += elementExpressionCode(command_obj.expression[i]);
  15226. }
  15227. return ret;
  15228. }
  15229. function elementExpressionCode(expression_obj) {
  15230. var ret = '';
  15231. for (var i = 0; i < expression_obj.itens.length; i++) {
  15232. if (expression_obj.itens[i].type) {
  15233. ret += variableValueMenuCode(expression_obj.itens[i]);
  15234. } else if (expression_obj.itens[i].type_exp) {
  15235. if (expression_obj.itens[i].type_exp == Models.EXPRESSION_ELEMENTS.par_exp_par) {
  15236. ret += ' ( ';
  15237. }
  15238. ret += elementExpressionCode(expression_obj.itens[i]);
  15239. if (expression_obj.itens[i].type_exp == Models.EXPRESSION_ELEMENTS.par_exp_par) {
  15240. ret += ' ) ';
  15241. }
  15242. } else {
  15243. switch (expression_obj.itens[i]) {
  15244. case Models.ARITHMETIC_TYPES.plus:
  15245. ret += ' + ';
  15246. break;
  15247. case Models.ARITHMETIC_TYPES.minus:
  15248. ret += ' - ';
  15249. break;
  15250. case Models.ARITHMETIC_TYPES.multiplication:
  15251. ret += ' * ';
  15252. break;
  15253. case Models.ARITHMETIC_TYPES.division:
  15254. ret += ' / ';
  15255. break;
  15256. case Models.ARITHMETIC_TYPES.module:
  15257. ret += ' % ';
  15258. break;
  15259. }
  15260. }
  15261. }
  15262. return ret;
  15263. }
  15264. function functioncallsCode(command_obj, indentation) {
  15265. var ret = '\n';
  15266. for (var i = 0; i < indentation; i++) {
  15267. ret += '\t';
  15268. }
  15269. ret += variableValueMenuCode(command_obj.function_called);
  15270. return ret;
  15271. }
  15272. function readersCode(command_obj, indentation) {
  15273. var ret = '\n';
  15274. for (var i = 0; i < indentation; i++) {
  15275. ret += '\t';
  15276. }
  15277. ret += _localizedStringsService.LocalizedStrings.getUI('text_command_read') + ' ( ';
  15278. ret += variableValueMenuCode(command_obj.variable_value_menu);
  15279. ret += ' ) ';
  15280. return ret;
  15281. }
  15282. function variableValueMenuCode(variable_obj) {
  15283. var ret = '';
  15284. if (variable_obj.function_called) {
  15285. if (variable_obj.function_called.name) {
  15286. ret += variable_obj.function_called.name + ' ( ';
  15287. } else {
  15288. ret += _localizedStringsService.LocalizedStrings.getUI(variable_obj.function_called.category) + '.' + _localizedStringsService.LocalizedStrings.getUI(variable_obj.function_called.identifier) + ' ( ';
  15289. }
  15290. if (variable_obj.parameters_list) {
  15291. for (var i = 0; i < variable_obj.parameters_list.length; i++) {
  15292. ret += variableValueMenuCode(variable_obj.parameters_list[i]);
  15293. if (i + 1 < variable_obj.parameters_list.length) {
  15294. ret += ', ';
  15295. }
  15296. }
  15297. }
  15298. ret += ' )';
  15299. } else if (variable_obj.content.type) {
  15300. ret += variable_obj.content.name;
  15301. if (variable_obj.content.dimensions == 1) {
  15302. ret += ' [ ' + variableValueMenuCode(variable_obj.column) + ' ] ';
  15303. }
  15304. if (variable_obj.content.dimensions == 2) {
  15305. ret += ' [ ' + variableValueMenuCode(variable_obj.row) + ' ] ';
  15306. ret += ' [ ' + variableValueMenuCode(variable_obj.column) + ' ] ';
  15307. }
  15308. } else {
  15309. if (isNaN(variable_obj.content)) {
  15310. ret += '"' + variable_obj.content + '"';
  15311. } else {
  15312. ret += variable_obj.content;
  15313. }
  15314. }
  15315. return ret;
  15316. }
  15317. function writersCode(command_obj, indentation) {
  15318. var ret = '\n';
  15319. for (var i = 0; i < indentation; i++) {
  15320. ret += '\t';
  15321. }
  15322. ret += _localizedStringsService.LocalizedStrings.getUI('text_command_write') + ' ( ';
  15323. for (var i = 0; i < command_obj.content.length; i++) {
  15324. ret += variableValueMenuCode(command_obj.content[i]);
  15325. if (i + 1 < command_obj.content.length) {
  15326. ret += ' + ';
  15327. }
  15328. }
  15329. ret += ' ) ';
  15330. return ret;
  15331. }
  15332. function commentsCode(command_obj, indentation) {
  15333. var ret = '\n';
  15334. for (var i = 0; i < indentation; i++) {
  15335. ret += '\t';
  15336. }
  15337. ret += '// ';
  15338. ret += command_obj.comment_text.content;
  15339. return ret;
  15340. }
  15341. function parametersCode(parameter_obj) {
  15342. var ret = '';
  15343. switch (parameter_obj.type) {
  15344. case _types.Types.INTEGER:
  15345. ret += ' ' + _localizedStringsService.LocalizedStrings.getUI('integer') + ' ';
  15346. break;
  15347. case _types.Types.REAL:
  15348. ret += ' ' + _localizedStringsService.LocalizedStrings.getUI('real') + ' ';
  15349. break;
  15350. case _types.Types.TEXT:
  15351. ret += ' ' + _localizedStringsService.LocalizedStrings.getUI('text') + ' ';
  15352. break;
  15353. case _types.Types.BOOLEAN:
  15354. ret += ' ' + _localizedStringsService.LocalizedStrings.getUI('boolean') + ' ';
  15355. break;
  15356. }
  15357. ret += parameter_obj.name + '';
  15358. if (parameter_obj.dimensions == 1) {
  15359. ret += ' []';
  15360. } else if (parameter_obj.dimensions == 2) {
  15361. ret += ' [][]';
  15362. }
  15363. return ret;
  15364. }
  15365. function variablesCode(variable_obj) {
  15366. var ret = '';
  15367. var temp = variable_obj;
  15368. ret += '\n\t\t';
  15369. if (temp.is_constant) {
  15370. ret += 'const ';
  15371. }
  15372. switch (temp.type) {
  15373. case _types.Types.INTEGER:
  15374. ret += _localizedStringsService.LocalizedStrings.getUI('integer') + ' ';
  15375. break;
  15376. case _types.Types.REAL:
  15377. ret += _localizedStringsService.LocalizedStrings.getUI('real') + ' ';
  15378. break;
  15379. case _types.Types.TEXT:
  15380. ret += _localizedStringsService.LocalizedStrings.getUI('text') + ' ';
  15381. break;
  15382. case _types.Types.BOOLEAN:
  15383. ret += _localizedStringsService.LocalizedStrings.getUI('boolean') + ' ';
  15384. break;
  15385. }
  15386. ret += temp.name + ' ';
  15387. if (temp.dimensions == 1) {
  15388. ret += '[' + temp.columns + '] ';
  15389. switch (temp.type) {
  15390. case _types.Types.INTEGER:
  15391. ret += '= {' + temp.value + '}';
  15392. break;
  15393. case _types.Types.REAL:
  15394. ret += '= {' + temp.value.toFixed(2) + '}';
  15395. break;
  15396. case _types.Types.TEXT:
  15397. ret += '= {';
  15398. for (var j = 0; j < temp.value.length; j++) {
  15399. ret += '"' + temp.value[j] + '"';
  15400. if (j + 1 < temp.value.length) {
  15401. ret += ',';
  15402. }
  15403. }
  15404. ret += '}';
  15405. break;
  15406. case _types.Types.BOOLEAN:
  15407. ret += '= {';
  15408. for (var j = 0; j < temp.value.length; j++) {
  15409. if (temp.value[j]) {
  15410. ret += _localizedStringsService.LocalizedStrings.getUI("true");
  15411. } else {
  15412. ret += _localizedStringsService.LocalizedStrings.getUI("false");
  15413. }
  15414. if (j + 1 < temp.value.length) {
  15415. ret += ',';
  15416. }
  15417. }
  15418. ret += '}';
  15419. break;
  15420. }
  15421. } else if (temp.dimensions == 2) {
  15422. ret += '[' + temp.rows + '][' + temp.columns + '] ';
  15423. switch (temp.type) {
  15424. case _types.Types.INTEGER:
  15425. ret += '= {';
  15426. for (var j = 0; j < temp.rows; j++) {
  15427. ret += '{' + temp.value[j] + '}';
  15428. if (j + 1 < temp.rows) {
  15429. ret += ',';
  15430. }
  15431. }
  15432. ret += '}';
  15433. break;
  15434. case _types.Types.REAL:
  15435. ret += '= {';
  15436. for (var j = 0; j < temp.rows; j++) {
  15437. ret += '{' + temp.value[j].toFixed(2) + '}';
  15438. if (j + 1 < temp.rows) {
  15439. ret += ',';
  15440. }
  15441. }
  15442. ret += '}';
  15443. break;
  15444. case _types.Types.TEXT:
  15445. ret += '= {';
  15446. for (var j = 0; j < temp.rows; j++) {
  15447. ret += '{';
  15448. for (var k = 0; k < temp.columns; k++) {
  15449. ret += '"' + temp.value[j][k] + '"';
  15450. if (k + 1 < temp.columns) {
  15451. ret += ',';
  15452. }
  15453. }
  15454. ret += '}';
  15455. if (j + 1 < temp.rows) {
  15456. ret += ',';
  15457. }
  15458. }
  15459. ret += '}';
  15460. break;
  15461. case _types.Types.BOOLEAN:
  15462. ret += '= {';
  15463. for (var j = 0; j < temp.rows; j++) {
  15464. ret += '{';
  15465. for (var k = 0; k < temp.columns; k++) {
  15466. if (temp.value[j][k]) {
  15467. ret += _localizedStringsService.LocalizedStrings.getUI("true");
  15468. } else {
  15469. ret += _localizedStringsService.LocalizedStrings.getUI("false");
  15470. }
  15471. if (k + 1 < temp.columns) {
  15472. ret += ',';
  15473. }
  15474. }
  15475. ret += '}';
  15476. if (j + 1 < temp.rows) {
  15477. ret += ',';
  15478. }
  15479. }
  15480. ret += '}';
  15481. break;
  15482. }
  15483. } else {
  15484. switch (temp.type) {
  15485. case _types.Types.INTEGER:
  15486. ret += '= ' + temp.value;
  15487. break;
  15488. case _types.Types.REAL:
  15489. ret += '= ' + temp.value.toFixed(2);
  15490. break;
  15491. case _types.Types.TEXT:
  15492. ret += '= "' + temp.value + '"';
  15493. break;
  15494. case _types.Types.BOOLEAN:
  15495. ret += '= ';
  15496. if (temp.value) {
  15497. ret += _localizedStringsService.LocalizedStrings.getUI("true");
  15498. } else {
  15499. ret += _localizedStringsService.LocalizedStrings.getUI("false");
  15500. }
  15501. break;
  15502. }
  15503. }
  15504. return ret;
  15505. }
  15506. function globalsCode() {
  15507. var ret = '';
  15508. if (window.program_obj.globals) {
  15509. for (var i = 0; i < window.program_obj.globals.length; i++) {
  15510. var temp = window.program_obj.globals[i];
  15511. ret += '\n\t';
  15512. if (temp.is_constant) {
  15513. ret += 'const ';
  15514. }
  15515. switch (temp.type) {
  15516. case _types.Types.INTEGER:
  15517. ret += _localizedStringsService.LocalizedStrings.getUI('integer');
  15518. break;
  15519. case _types.Types.REAL:
  15520. ret += _localizedStringsService.LocalizedStrings.getUI('real');
  15521. break;
  15522. case _types.Types.TEXT:
  15523. ret += _localizedStringsService.LocalizedStrings.getUI('text');
  15524. break;
  15525. case _types.Types.BOOLEAN:
  15526. ret += _localizedStringsService.LocalizedStrings.getUI('boolean');
  15527. break;
  15528. }
  15529. ret += ' ' + temp.name + ' ';
  15530. if (temp.dimensions == 1) {
  15531. ret += '[' + temp.columns + '] ';
  15532. switch (temp.type) {
  15533. case _types.Types.INTEGER:
  15534. ret += '= {' + temp.value + '}';
  15535. break;
  15536. case _types.Types.REAL:
  15537. ret += '= {';
  15538. for (var j = 0; j < temp.value.length; j++) {
  15539. ret += temp.value[j].toFixed(2);
  15540. if (j + 1 < temp.value.length) {
  15541. ret += ',';
  15542. }
  15543. }
  15544. ret += '}';
  15545. break;
  15546. case _types.Types.TEXT:
  15547. ret += '= {';
  15548. for (var j = 0; j < temp.value.length; j++) {
  15549. ret += '"' + temp.value[j] + '"';
  15550. if (j + 1 < temp.value.length) {
  15551. ret += ',';
  15552. }
  15553. }
  15554. ret += '}';
  15555. break;
  15556. case _types.Types.BOOLEAN:
  15557. ret += '= {';
  15558. for (var j = 0; j < temp.value.length; j++) {
  15559. if (temp.value[j]) {
  15560. ret += _localizedStringsService.LocalizedStrings.getUI("true");
  15561. } else {
  15562. ret += _localizedStringsService.LocalizedStrings.getUI("false");
  15563. }
  15564. if (j + 1 < temp.value.length) {
  15565. ret += ',';
  15566. }
  15567. }
  15568. ret += '}';
  15569. break;
  15570. }
  15571. } else if (temp.dimensions == 2) {
  15572. ret += '[' + temp.rows + '][' + temp.columns + '] ';
  15573. switch (temp.type) {
  15574. case _types.Types.INTEGER:
  15575. ret += '= {';
  15576. for (var j = 0; j < temp.rows; j++) {
  15577. ret += '{' + temp.value[j] + '}';
  15578. if (j + 1 < temp.rows) {
  15579. ret += ',';
  15580. }
  15581. }
  15582. ret += '}';
  15583. break;
  15584. case _types.Types.REAL:
  15585. ret += '= {';
  15586. for (var j = 0; j < temp.rows; j++) {
  15587. ret += '{';
  15588. for (var k = 0; k < temp.columns; k++) {
  15589. ret += temp.value[j][k].toFixed(2);
  15590. if (k + 1 < temp.columns) {
  15591. ret += ',';
  15592. }
  15593. }
  15594. ret += '}';
  15595. if (j + 1 < temp.rows) {
  15596. ret += ',';
  15597. }
  15598. }
  15599. ret += '}';
  15600. break;
  15601. case _types.Types.TEXT:
  15602. ret += '= {';
  15603. for (var j = 0; j < temp.rows; j++) {
  15604. ret += '{';
  15605. for (var k = 0; k < temp.columns; k++) {
  15606. ret += '"' + temp.value[j][k] + '"';
  15607. if (k + 1 < temp.columns) {
  15608. ret += ',';
  15609. }
  15610. }
  15611. ret += '}';
  15612. if (j + 1 < temp.rows) {
  15613. ret += ',';
  15614. }
  15615. }
  15616. ret += '}';
  15617. break;
  15618. case _types.Types.BOOLEAN:
  15619. ret += '= {';
  15620. for (var j = 0; j < temp.rows; j++) {
  15621. ret += '{';
  15622. for (var k = 0; k < temp.columns; k++) {
  15623. if (temp.value[j][k]) {
  15624. ret += _localizedStringsService.LocalizedStrings.getUI("true");
  15625. } else {
  15626. ret += _localizedStringsService.LocalizedStrings.getUI("false");
  15627. }
  15628. if (k + 1 < temp.columns) {
  15629. ret += ',';
  15630. }
  15631. }
  15632. ret += '}';
  15633. if (j + 1 < temp.rows) {
  15634. ret += ',';
  15635. }
  15636. }
  15637. ret += '}';
  15638. break;
  15639. }
  15640. } else {
  15641. switch (temp.type) {
  15642. case _types.Types.INTEGER:
  15643. ret += '= ' + temp.value;
  15644. break;
  15645. case _types.Types.REAL:
  15646. ret += '= ' + temp.value.toFixed(2);
  15647. break;
  15648. case _types.Types.TEXT:
  15649. ret += '= "' + temp.value + '"';
  15650. break;
  15651. case _types.Types.BOOLEAN:
  15652. ret += '= ';
  15653. if (temp.value) {
  15654. ret += _localizedStringsService.LocalizedStrings.getUI("true");;
  15655. } else {
  15656. ret += _localizedStringsService.LocalizedStrings.getUI("false");;
  15657. }
  15658. break;
  15659. }
  15660. }
  15661. }
  15662. }
  15663. return ret;
  15664. }
  15665. /***/ }),
  15666. /***/ "./js/visualUI/commands.js":
  15667. /*!*********************************!*\
  15668. !*** ./js/visualUI/commands.js ***!
  15669. \*********************************/
  15670. /*! no static exports found */
  15671. /***/ (function(module, exports, __webpack_require__) {
  15672. "use strict";
  15673. Object.defineProperty(exports, "__esModule", {
  15674. value: true
  15675. });
  15676. exports.removeCommand = removeCommand;
  15677. exports.createFloatingCommand = createFloatingCommand;
  15678. exports.renderCommand = renderCommand;
  15679. exports.genericCreateCommand = genericCreateCommand;
  15680. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  15681. var _jquery2 = _interopRequireDefault(_jquery);
  15682. var _types = __webpack_require__(/*! ./types */ "./js/visualUI/types.js");
  15683. var _ivprog_elements = __webpack_require__(/*! ./ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  15684. var Models = _interopRequireWildcard(_ivprog_elements);
  15685. var _localizedStringsService = __webpack_require__(/*! ./../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  15686. var _globals = __webpack_require__(/*! ./globals */ "./js/visualUI/globals.js");
  15687. var GlobalsManagement = _interopRequireWildcard(_globals);
  15688. var _variables = __webpack_require__(/*! ./variables */ "./js/visualUI/variables.js");
  15689. var VariablesManagement = _interopRequireWildcard(_variables);
  15690. var _comment = __webpack_require__(/*! ./commands/comment */ "./js/visualUI/commands/comment.js");
  15691. var CommentsManagement = _interopRequireWildcard(_comment);
  15692. var _reader = __webpack_require__(/*! ./commands/reader */ "./js/visualUI/commands/reader.js");
  15693. var ReadersManagement = _interopRequireWildcard(_reader);
  15694. var _writer = __webpack_require__(/*! ./commands/writer */ "./js/visualUI/commands/writer.js");
  15695. var WritersManagement = _interopRequireWildcard(_writer);
  15696. var _attribution = __webpack_require__(/*! ./commands/attribution */ "./js/visualUI/commands/attribution.js");
  15697. var AttributionsManagement = _interopRequireWildcard(_attribution);
  15698. var _iftrue = __webpack_require__(/*! ./commands/iftrue */ "./js/visualUI/commands/iftrue.js");
  15699. var IftruesManagement = _interopRequireWildcard(_iftrue);
  15700. var _repeatNtimes = __webpack_require__(/*! ./commands/repeatNtimes */ "./js/visualUI/commands/repeatNtimes.js");
  15701. var RepeatNtimesManagement = _interopRequireWildcard(_repeatNtimes);
  15702. var _whiletrue = __webpack_require__(/*! ./commands/whiletrue */ "./js/visualUI/commands/whiletrue.js");
  15703. var WhiletruesManagement = _interopRequireWildcard(_whiletrue);
  15704. var _dowhiletrue = __webpack_require__(/*! ./commands/dowhiletrue */ "./js/visualUI/commands/dowhiletrue.js");
  15705. var DowhiletruesManagement = _interopRequireWildcard(_dowhiletrue);
  15706. var _switch = __webpack_require__(/*! ./commands/switch */ "./js/visualUI/commands/switch.js");
  15707. var SwitchesManagement = _interopRequireWildcard(_switch);
  15708. var _functioncall = __webpack_require__(/*! ./commands/functioncall */ "./js/visualUI/commands/functioncall.js");
  15709. var FunctioncallsManagement = _interopRequireWildcard(_functioncall);
  15710. var _variable_value_menu = __webpack_require__(/*! ./commands/variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  15711. var VariableValueMenuManagement = _interopRequireWildcard(_variable_value_menu);
  15712. var _break = __webpack_require__(/*! ./commands/break */ "./js/visualUI/commands/break.js");
  15713. var BreaksManagement = _interopRequireWildcard(_break);
  15714. var _return = __webpack_require__(/*! ./commands/return */ "./js/visualUI/commands/return.js");
  15715. var ReturnsManagement = _interopRequireWildcard(_return);
  15716. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  15717. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  15718. var has_element_created_draged = false;
  15719. var which_element_is_draged = null;
  15720. function removeCommand(command, function_obj, dom_obj) {
  15721. if (function_obj.commands.indexOf(command) > -1) {
  15722. function_obj.commands.splice(function_obj.commands.indexOf(command), 1);
  15723. return true;
  15724. }
  15725. // Utilize dois parantNode, pois o primeiro é o div de comandos
  15726. try {
  15727. if (dom_obj.parent().parent().data('command').commands_block.indexOf(command) > -1) {
  15728. dom_obj.parent().parent().data('command').commands_block.splice(dom_obj.parent().parent().data('command').commands_block.indexOf(command), 1);
  15729. return true;
  15730. }
  15731. } catch (err) {}
  15732. try {
  15733. if (dom_obj.parent().parent().data('command').type == Models.COMMAND_TYPES.iftrue) {
  15734. if (dom_obj.parent().parent().data('command').commands_else.indexOf(command) > -1) {
  15735. dom_obj.parent().parent().data('command').commands_else.splice(dom_obj.parent().parent().data('command').commands_else.indexOf(command), 1);
  15736. return true;
  15737. }
  15738. }
  15739. } catch (err) {}
  15740. if (dom_obj.parent().data('switchcase')) {
  15741. console.log("o que encontrei: ");
  15742. console.log(dom_obj.parent().data('switchcase'));
  15743. dom_obj.parent().data('switchcase').commands_block.splice(dom_obj.parent().data('switchcase').commands_block.indexOf(command), 1);
  15744. return true;
  15745. }
  15746. return false;
  15747. }
  15748. function createFloatingCommand(function_obj, function_container, command_type, mouse_event) {
  15749. var floatingObject;
  15750. switch (command_type) {
  15751. case Models.COMMAND_TYPES.break:
  15752. floatingObject = BreaksManagement.createFloatingCommand();
  15753. break;
  15754. case Models.COMMAND_TYPES.comment:
  15755. floatingObject = CommentsManagement.createFloatingCommand();
  15756. break;
  15757. case Models.COMMAND_TYPES.reader:
  15758. floatingObject = ReadersManagement.createFloatingCommand();
  15759. break;
  15760. case Models.COMMAND_TYPES.writer:
  15761. floatingObject = WritersManagement.createFloatingCommand();
  15762. break;
  15763. case Models.COMMAND_TYPES.attribution:
  15764. floatingObject = AttributionsManagement.createFloatingCommand();
  15765. break;
  15766. case Models.COMMAND_TYPES.iftrue:
  15767. floatingObject = IftruesManagement.createFloatingCommand();
  15768. break;
  15769. case Models.COMMAND_TYPES.repeatNtimes:
  15770. floatingObject = RepeatNtimesManagement.createFloatingCommand();
  15771. break;
  15772. case Models.COMMAND_TYPES.whiletrue:
  15773. floatingObject = WhiletruesManagement.createFloatingCommand();
  15774. break;
  15775. case Models.COMMAND_TYPES.dowhiletrue:
  15776. floatingObject = DowhiletruesManagement.createFloatingCommand();
  15777. break;
  15778. case Models.COMMAND_TYPES.switch:
  15779. floatingObject = SwitchesManagement.createFloatingCommand();
  15780. break;
  15781. case Models.COMMAND_TYPES.functioncall:
  15782. floatingObject = FunctioncallsManagement.createFloatingCommand();
  15783. break;
  15784. case Models.COMMAND_TYPES.return:
  15785. floatingObject = ReturnsManagement.createFloatingCommand();
  15786. break;
  15787. }
  15788. floatingObject.draggable({
  15789. drag: function drag(evt) {
  15790. borderMouseDragCommand(function_obj, function_container, evt);
  15791. },
  15792. stop: function stop(evt) {
  15793. function_container.find('.over_command_drag').each(function (index) {
  15794. (0, _jquery2.default)(this).removeClass('over_command_drag');
  15795. });
  15796. }
  15797. }).appendTo("body");
  15798. floatingObject.mouseup(function (evt) {
  15799. manageCommand(function_obj, function_container, evt, command_type);
  15800. });
  15801. floatingObject.css("position", "absolute");
  15802. mouse_event.type = "mousedown.draggable";
  15803. mouse_event.target = floatingObject[0];
  15804. floatingObject.css("left", mouse_event.pageX - 15);
  15805. floatingObject.css("top", mouse_event.pageY - 15);
  15806. floatingObject.trigger(mouse_event);
  15807. }
  15808. function borderMouseDragCommand(function_obj, function_container, evt) {
  15809. function_container.find('.over_command_drag').each(function (index) {
  15810. (0, _jquery2.default)(this).removeClass('over_command_drag');
  15811. });
  15812. var prev = null;
  15813. function_container.find('.commands_list_div').each(function (index) {
  15814. prev = (0, _jquery2.default)(this);
  15815. var objLeft = prev.offset().left;
  15816. var objTop = prev.offset().top;
  15817. var objRight = objLeft + prev.width();
  15818. var objBottom = objTop + prev.height();
  15819. if (evt.pageX > objLeft && evt.pageX < objRight && evt.pageY > objTop && evt.pageY < objBottom) {
  15820. prev.addClass("over_command_drag");
  15821. }
  15822. });
  15823. function_container.find('.command_container').each(function (index) {
  15824. var obj = (0, _jquery2.default)(this);
  15825. var objLeft = obj.offset().left;
  15826. var objTop = obj.offset().top;
  15827. var objRight = objLeft + obj.width();
  15828. var objBottom = objTop + obj.height();
  15829. if (evt.pageX > objLeft && evt.pageX < objRight && evt.pageY > objTop && evt.pageY < objBottom) {
  15830. prev.removeClass('over_command_drag');
  15831. obj.addClass("over_command_drag");
  15832. return;
  15833. }
  15834. });
  15835. }
  15836. // before_after_inside: 1 -> before, 2 -> after, 3 -> inside
  15837. function renderCommand(command, element_reference, before_after_inside, function_obj) {
  15838. var createdElement;
  15839. switch (command.type) {
  15840. case Models.COMMAND_TYPES.comment:
  15841. createdElement = CommentsManagement.renderCommand(command, function_obj);
  15842. break;
  15843. case Models.COMMAND_TYPES.break:
  15844. createdElement = BreaksManagement.renderCommand(command, function_obj);
  15845. break;
  15846. case Models.COMMAND_TYPES.reader:
  15847. createdElement = ReadersManagement.renderCommand(command, function_obj);
  15848. break;
  15849. case Models.COMMAND_TYPES.writer:
  15850. createdElement = WritersManagement.renderCommand(command, function_obj);
  15851. break;
  15852. case Models.COMMAND_TYPES.attribution:
  15853. createdElement = AttributionsManagement.renderCommand(command, function_obj);
  15854. break;
  15855. case Models.COMMAND_TYPES.functioncall:
  15856. createdElement = FunctioncallsManagement.renderCommand(command, function_obj);
  15857. break;
  15858. case Models.COMMAND_TYPES.iftrue:
  15859. createdElement = IftruesManagement.renderCommand(command, function_obj);
  15860. break;
  15861. case Models.COMMAND_TYPES.repeatNtimes:
  15862. createdElement = RepeatNtimesManagement.renderCommand(command, function_obj);
  15863. break;
  15864. case Models.COMMAND_TYPES.whiletrue:
  15865. createdElement = WhiletruesManagement.renderCommand(command, function_obj);
  15866. break;
  15867. case Models.COMMAND_TYPES.dowhiletrue:
  15868. createdElement = DowhiletruesManagement.renderCommand(command, function_obj);
  15869. break;
  15870. case Models.COMMAND_TYPES.switch:
  15871. createdElement = SwitchesManagement.renderCommand(command, function_obj);
  15872. break;
  15873. case Models.COMMAND_TYPES.return:
  15874. createdElement = ReturnsManagement.renderCommand(command, function_obj);
  15875. break;
  15876. }
  15877. switch (before_after_inside) {
  15878. case 1:
  15879. createdElement.insertBefore(element_reference);
  15880. break;
  15881. case 2:
  15882. createdElement.insertAfter(element_reference);
  15883. break;
  15884. case 3:
  15885. element_reference.append(createdElement);
  15886. break;
  15887. }
  15888. }
  15889. function genericCreateCommand(command_type) {
  15890. switch (command_type) {
  15891. case Models.COMMAND_TYPES.break:
  15892. return new Models.Break();
  15893. case Models.COMMAND_TYPES.comment:
  15894. return new Models.Comment(new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.only_value, _localizedStringsService.LocalizedStrings.getUI('text_comment'), null, null, false));
  15895. case Models.COMMAND_TYPES.reader:
  15896. return new Models.Reader(new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.only_variable, null, null, null, false));
  15897. case Models.COMMAND_TYPES.writer:
  15898. return new Models.Writer([new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all, null, null, null, true)]);
  15899. case Models.COMMAND_TYPES.attribution:
  15900. return new Models.Attribution(new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.only_variable, null, null, null, false), []);
  15901. case Models.COMMAND_TYPES.functioncall:
  15902. return new Models.FunctionCall(new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.only_function, null, null, null, false), null);
  15903. case Models.COMMAND_TYPES.iftrue:
  15904. return new Models.IfTrue(new Models.ConditionalExpression(null), null, null);
  15905. case Models.COMMAND_TYPES.repeatNtimes:
  15906. return new Models.RepeatNTimes(new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.only_variable, null, null, null, false), new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.only_variable, null, null, null, false), null, new Models.ConditionalExpression(null), null, null);
  15907. case Models.COMMAND_TYPES.whiletrue:
  15908. return new Models.WhileTrue(new Models.ConditionalExpression(null), null);
  15909. case Models.COMMAND_TYPES.dowhiletrue:
  15910. return new Models.DoWhileTrue(new Models.ConditionalExpression(null), null);
  15911. case Models.COMMAND_TYPES.switch:
  15912. var sc = [new Models.SwitchCase(new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all, null, null, null, true))];
  15913. return new Models.Switch(new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.variable_and_function, null, null, null, true), sc);
  15914. case Models.COMMAND_TYPES.return:
  15915. return new Models.Return(new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all, null, null, null, true));
  15916. }
  15917. }
  15918. function manageCommand(function_obj, function_container, event, command_type) {
  15919. (0, _jquery2.default)(".created_element").each(function (index) {
  15920. (0, _jquery2.default)(this).remove();
  15921. });
  15922. var el = (0, _jquery2.default)(document.elementFromPoint(event.clientX, event.clientY));
  15923. console.log('soltou no: ');
  15924. console.log(el);
  15925. console.log(el.data('fun'));
  15926. // Primeiro verificar se ele soltou no espaço da função correta:
  15927. var hier = el.parentsUntil(".all_functions");
  15928. var esta_correto = false;
  15929. var esta_na_div_correta = false;
  15930. if (el.hasClass("commands_list_div")) {
  15931. esta_na_div_correta = true;
  15932. }
  15933. for (var i = 0; i < hier.length; i++) {
  15934. var temp = (0, _jquery2.default)(hier[i]);
  15935. if (temp.hasClass("commands_list_div")) {
  15936. esta_na_div_correta = true;
  15937. }
  15938. if (temp.data('fun') == function_obj) {
  15939. esta_correto = true;
  15940. break;
  15941. }
  15942. }
  15943. if (!esta_correto) {
  15944. has_element_created_draged = false;
  15945. which_element_is_draged = null;
  15946. return;
  15947. } else {
  15948. if (!esta_na_div_correta) {
  15949. has_element_created_draged = false;
  15950. which_element_is_draged = null;
  15951. return;
  15952. }
  15953. }
  15954. // Agora é descobrir qual o escopo para adicionar o comando:
  15955. // Se o elemento clicado possuir o atributo "fun", então, é direto na div dos comandos:
  15956. if (typeof el.data('fun') !== 'undefined') {
  15957. // Se a lista de comandos estiver vazia, então é o primeiro.
  15958. // Portanto, ele deve soltar o elemento obrigatoriamente no objeto vazio
  15959. if (el.data('fun').commands == null || el.data('fun').commands.length == 0) {
  15960. // pode adicionar
  15961. el.data('fun').commands = [];
  15962. var new_cmd = genericCreateCommand(command_type);
  15963. el.data('fun').commands.push(new_cmd);
  15964. renderCommand(new_cmd, (0, _jquery2.default)(function_container).find('.commands_list_div'), 3, function_obj);
  15965. } else {
  15966. // Entra nesse else, caso já existam outros comandos no bloco:
  15967. findNearbyCommandToAddInFunctionScope(el, event, (0, _jquery2.default)(function_container).find('.commands_list_div'), function_obj, command_type);
  15968. }
  15969. } else {
  15970. console.log("soltou em um comando");
  15971. // descobrir em qual comando ele soltou:
  15972. var hier_find = el.parentsUntil(".commands_list_div");
  15973. var hierarquia_bottom_up = [];
  15974. if (typeof el.data('command') !== 'undefined') {
  15975. hierarquia_bottom_up.push(el.data('command'));
  15976. }
  15977. for (var i = 0; i < hier_find.length; i++) {
  15978. if (typeof (0, _jquery2.default)(hier_find[i]).data('command') !== 'undefined') {
  15979. hierarquia_bottom_up.push((0, _jquery2.default)(hier_find[i]).data('command'));
  15980. }
  15981. }
  15982. console.log("comando em que soltou: ");
  15983. console.log(hierarquia_bottom_up[0]);
  15984. console.log("hierarquia de baixo para cima na árvore, de onde ele soltou: ");
  15985. for (var i = 0; i < hierarquia_bottom_up.length; i++) {
  15986. console.log(hierarquia_bottom_up[i]);
  15987. }
  15988. // Se for do tipo break, verificar se está no contexto correto:
  15989. // Caso não esteja no contexto, apenas retorna sem dar continuidade:
  15990. var is_correct_context = false;
  15991. if (command_type == Models.COMMAND_TYPES.break) {
  15992. for (var i = 0; i < hierarquia_bottom_up.length; i++) {
  15993. if (hierarquia_bottom_up[i].type == Models.COMMAND_TYPES.repeatNtimes || hierarquia_bottom_up[i].type == Models.COMMAND_TYPES.whiletrue || hierarquia_bottom_up[i].type == Models.COMMAND_TYPES.dowhiletrue || hierarquia_bottom_up[i].type == Models.COMMAND_TYPES.switch) {
  15994. is_correct_context = true;
  15995. break;
  15996. }
  15997. }
  15998. if (!is_correct_context) {
  15999. console.error("Context not allowed to insert BREAK COMMAND!");
  16000. return;
  16001. }
  16002. }
  16003. // se a hierarquia possuir apenas um elemento, então está na raiz dos comandos:
  16004. if (hierarquia_bottom_up.length == 1) {
  16005. console.log('QQ1');
  16006. var sub_elemento = false;
  16007. for (var i = 0; i < hier_find.length; i++) {
  16008. if (typeof (0, _jquery2.default)(hier_find[i]).data('command') !== 'undefined') {
  16009. console.log('QQ2');
  16010. findBeforeOrAfterCommandToAdd(hier_find[i], event, function_obj, command_type);
  16011. sub_elemento = true;
  16012. break;
  16013. }
  16014. }
  16015. if (!sub_elemento) {
  16016. console.log('QQ3');
  16017. findBeforeOrAfterCommandToAdd(el[0], event, function_obj, command_type);
  16018. }
  16019. } else {
  16020. console.log('QQ4');
  16021. // caso exista mais de um elemento na hierarquia:
  16022. if (typeof (0, _jquery2.default)(el).data('command') !== 'undefined') {
  16023. console.log('QQ5');
  16024. console.log("PPP1");
  16025. insertCommandInBlockHierar(el[0], event, function_obj, command_type, hier_find, hierarquia_bottom_up);
  16026. } else {
  16027. console.log('QQ6');
  16028. var sub_elemento = false;
  16029. for (var i = 0; i < hier_find.length; i++) {
  16030. if (typeof (0, _jquery2.default)(hier_find[i]).data('command') !== 'undefined') {
  16031. console.log('QQ7');
  16032. insertCommandInBlockHierar(hier_find[i], event, function_obj, command_type, hier_find, hierarquia_bottom_up);
  16033. sub_elemento = true;
  16034. break;
  16035. }
  16036. }
  16037. }
  16038. }
  16039. }
  16040. has_element_created_draged = false;
  16041. which_element_is_draged = null;
  16042. }
  16043. function insertCommandInBlockHierar(el, event, function_obj, command_type, hier_dom, hier_obj) {
  16044. var el_jq = (0, _jquery2.default)(el);
  16045. var command_parent = el_jq.data('command');
  16046. if (el_jq.data('command').type == Models.COMMAND_TYPES.repeatNtimes || el_jq.data('command').type == Models.COMMAND_TYPES.whiletrue || el_jq.data('command').type == Models.COMMAND_TYPES.dowhiletrue || el_jq.data('command').type == Models.COMMAND_TYPES.switch) {
  16047. console.log('QQ17');
  16048. if (el_jq.data('command').type == Models.COMMAND_TYPES.repeatNtimes || el_jq.data('command').type == Models.COMMAND_TYPES.whiletrue || el_jq.data('command').type == Models.COMMAND_TYPES.dowhiletrue) {
  16049. console.log('QQ18');
  16050. // Se não tiver outro comando ainda no bloco, só adiciona:
  16051. if (command_parent.commands_block == null || command_parent.commands_block.length == 0) {
  16052. command_parent.commands_block = [];
  16053. var recentComand = genericCreateCommand(command_type);
  16054. command_parent.commands_block.push(recentComand);
  16055. renderCommand(recentComand, el_jq.find('.block_commands'), 3, function_obj);
  16056. } else {
  16057. // Se já tem algum comando no bloco:
  16058. findNearbyCommandToAddInBlockScope(el, event, el, function_obj, command_type, command_parent);
  16059. }
  16060. } else {
  16061. // QUANDO FOR BLOCO DO TIPO IF OU SWITCH/CASE:
  16062. addCommandToSwitchCase(event, function_obj, command_type);
  16063. }
  16064. } else {
  16065. console.log('QQ19');
  16066. // entra neste bloco, se soltou o comando sobre outro comando dentro de um subbloco:
  16067. findBeforeOrAfterCommandToAddInsertBlock(el, event, function_obj, command_type);
  16068. }
  16069. }
  16070. function findNearbyCommandToAddInBlockScope(el, event, node_list_commands, function_obj, command_type, command_parent) {
  16071. var all_sub = (0, _jquery2.default)(node_list_commands).find('div.command_container');
  16072. var menor_distancia = 999999999;
  16073. var elemento_menor_distancia = null;
  16074. var antes = true;
  16075. var t_bot;
  16076. var t_top;
  16077. // Descobrindo o elemento mais próximo:
  16078. for (var i = 0; i < all_sub.length; i++) {
  16079. t_top = all_sub[i].getBoundingClientRect().top;
  16080. t_bot = all_sub[i].getBoundingClientRect().top + all_sub[i].getBoundingClientRect().height;
  16081. if (t_top - event.clientY < menor_distancia) {
  16082. menor_distancia = event.clientY - t_top;
  16083. elemento_menor_distancia = all_sub[i];
  16084. }
  16085. }
  16086. var borda_inferior = elemento_menor_distancia.parentNode.getBoundingClientRect().top + elemento_menor_distancia.parentNode.getBoundingClientRect().height;
  16087. // Está mais próximo da borda de baixo, ou seja.. inserir por último:
  16088. if (borda_inferior - event.clientY < menor_distancia) {
  16089. var recentComand = genericCreateCommand(command_type);
  16090. command_parent.commands_block.push(recentComand);
  16091. //
  16092. renderCommand(recentComand, node_list_commands, 3, function_obj);
  16093. } else {
  16094. var recentComand = genericCreateCommand(command_type);
  16095. var index = command_parent.commands_block.indexOf((0, _jquery2.default)(elemento_menor_distancia).data('command'));
  16096. if (index > -1) {
  16097. command_parent.commands_block.splice(index, 0, recentComand);
  16098. }
  16099. renderCommand(recentComand, elemento_menor_distancia, 1, function_obj);
  16100. }
  16101. }
  16102. function findBeforeOrAfterCommandToAddInsertBlock(el, event, function_obj, command_type) {
  16103. var el_jq = (0, _jquery2.default)(el);
  16104. var command_parent = (0, _jquery2.default)(el.parentNode.parentNode).data('command');
  16105. var command_target = el_jq.data('command');
  16106. var temp_parent = (0, _jquery2.default)(el.parentNode.parentNode);
  16107. var is_in_else = false;
  16108. if (!command_parent) {
  16109. command_parent = el_jq.data('command');
  16110. temp_parent = el_jq;
  16111. var hier = el_jq.parentsUntil(".command_container");
  16112. for (var i = 0; i < hier.length; i++) {
  16113. var temp = (0, _jquery2.default)(hier[i]);
  16114. if (typeof temp.data('else') != 'undefined') {
  16115. is_in_else = true;
  16116. }
  16117. if (typeof temp.data('command') != 'undefined') {
  16118. command_parent = temp.data('command');
  16119. temp_parent = temp;
  16120. }
  16121. }
  16122. }
  16123. var hier = el_jq.parentsUntil(".command_container");
  16124. for (var i = 0; i < hier.length; i++) {
  16125. var temp = (0, _jquery2.default)(hier[i]);
  16126. if (typeof temp.data('else') != 'undefined') {
  16127. is_in_else = true;
  16128. }
  16129. }
  16130. if (command_parent == command_target) {
  16131. var hier = el_jq.parentsUntil(".command_container");
  16132. for (var i = 0; i < hier.length; i++) {
  16133. var temp = (0, _jquery2.default)(hier[i]);
  16134. if (typeof temp.data('else') !== 'undefined') {
  16135. is_in_else = true;
  16136. break;
  16137. }
  16138. }
  16139. }
  16140. if (command_parent.type != Models.COMMAND_TYPES.iftrue && command_parent.type != Models.COMMAND_TYPES.switch) {
  16141. var hier = temp_parent.parentsUntil(".all_cases_div");
  16142. console.log("vou procurar!!");
  16143. for (var i = 0; i < hier.length; i++) {
  16144. console.log("estou vasculhando...");
  16145. var temp = (0, _jquery2.default)(hier[i]);
  16146. if (typeof temp.data('switchcase') !== 'undefined') {
  16147. console.log("encontrei");
  16148. command_parent = temp.data('switchcase');
  16149. is_in_else = false;
  16150. break;
  16151. }
  16152. }
  16153. }
  16154. console.log('debugging:');
  16155. console.log('el_jq');
  16156. console.log(el_jq);
  16157. console.log('command_parent');
  16158. console.log(command_parent);
  16159. console.log('command_target');
  16160. console.log(command_target);
  16161. var menor_distancia = 999999999;
  16162. var antes = true;
  16163. var t_bot;
  16164. var t_top;
  16165. t_top = el.getBoundingClientRect().top;
  16166. t_bot = el.getBoundingClientRect().top + el.getBoundingClientRect().height;
  16167. var d_top = event.clientY - t_top; // distancia topo
  16168. var d_bot = t_bot - event.clientY; // distancia baixo
  16169. // Está mais próximo da borda de baixo, ou seja.. inserir por último:
  16170. if (d_top < d_bot) {
  16171. var recentComand = genericCreateCommand(command_type);
  16172. console.log('MMM1');
  16173. if (is_in_else) {
  16174. console.log('MMM2');
  16175. if (command_parent == command_target) {
  16176. console.log('MMM3');
  16177. if (command_parent.commands_else == null || command_parent.commands_else.length == 0) {
  16178. command_parent.commands_else = [];
  16179. var recentComand = genericCreateCommand(command_type);
  16180. command_parent.commands_else.push(recentComand);
  16181. renderCommand(recentComand, el_jq, 3, function_obj);
  16182. } else {
  16183. // Se já tem algum comando no bloco:
  16184. findInBlockCorrectPlace(el_jq, event, function_obj, command_type, true);
  16185. }
  16186. return;
  16187. }
  16188. console.log('MMM7');
  16189. var index = command_parent.commands_else.indexOf(command_target);
  16190. if (index > -1) {
  16191. command_parent.commands_else.splice(index, 0, recentComand);
  16192. }
  16193. renderCommand(recentComand, el, 1, function_obj);
  16194. } else {
  16195. console.log('MMM4');
  16196. if (command_parent == command_target) {
  16197. console.log('Nxxxx5');
  16198. if (command_parent.commands_block == null || command_parent.commands_block.length == 0) {
  16199. command_parent.commands_block = [];
  16200. console.log('SSS4');
  16201. var recentComand = genericCreateCommand(command_type);
  16202. command_parent.commands_block.push(recentComand);
  16203. renderCommand(recentComand, el_jq, 3, function_obj);
  16204. } else {
  16205. console.log('SSS5');
  16206. findInBlockCorrectPlace(el_jq, event, function_obj, command_type);
  16207. }
  16208. return;
  16209. }
  16210. console.log('MMM6');
  16211. var index = command_parent.commands_block.indexOf(command_target);
  16212. if (index > -1) {
  16213. command_parent.commands_block.splice(index, 0, recentComand);
  16214. }
  16215. renderCommand(recentComand, el, 1, function_obj);
  16216. }
  16217. } else {
  16218. console.log('XXX1');
  16219. var recentComand = genericCreateCommand(command_type);
  16220. if (is_in_else) {
  16221. if (command_parent == command_target) {
  16222. console.log('MMM3');
  16223. if (command_parent.commands_else == null || command_parent.commands_else.length == 0) {
  16224. command_parent.commands_else = [];
  16225. console.log('SSS1');
  16226. var recentComand = genericCreateCommand(command_type);
  16227. command_parent.commands_else.push(recentComand);
  16228. renderCommand(recentComand, el_jq, 3, function_obj);
  16229. } else {
  16230. // Se já tem algum comando no bloco:
  16231. console.log('SSS2');
  16232. findInBlockCorrectPlace(el_jq, event, function_obj, command_type, true);
  16233. }
  16234. return;
  16235. }
  16236. console.log('XXX2');
  16237. var index = command_parent.commands_else.indexOf(command_target);
  16238. if (index > -1) {
  16239. command_parent.commands_else.splice(index + 1, 0, recentComand);
  16240. }
  16241. renderCommand(recentComand, el, 2, function_obj);
  16242. } else {
  16243. if (command_parent == command_target) {
  16244. console.log('Nxxxx78');
  16245. if (command_parent.commands_block == null || command_parent.commands_block.length == 0) {
  16246. command_parent.commands_block = [];
  16247. var recentComand = genericCreateCommand(command_type);
  16248. command_parent.commands_block.push(recentComand);
  16249. console.log('SSS6');
  16250. renderCommand(recentComand, el_jq, 3, function_obj);
  16251. } else {
  16252. console.log('SSS7');
  16253. findInBlockCorrectPlace(el_jq, event, function_obj, command_type);
  16254. }
  16255. return;
  16256. }
  16257. console.log('XXX3');
  16258. var index = command_parent.commands_block.indexOf(command_target);
  16259. if (index > -1) {
  16260. command_parent.commands_block.splice(index + 1, 0, recentComand);
  16261. }
  16262. renderCommand(recentComand, el, 2, function_obj);
  16263. }
  16264. }
  16265. }
  16266. function insertCommandInBlock(el, event, function_obj, command_type) {
  16267. var el_jq = (0, _jquery2.default)(el);
  16268. var command_parent = el_jq.data('command');
  16269. if (el_jq.data('command').type == Models.COMMAND_TYPES.repeatNtimes || el_jq.data('command').type == Models.COMMAND_TYPES.whiletrue || el_jq.data('command').type == Models.COMMAND_TYPES.dowhiletrue) {
  16270. // Se não tiver outro comando ainda no bloco, só adiciona:
  16271. if (command_parent.commands_block == null || command_parent.commands_block.length == 0) {
  16272. command_parent.commands_block = [];
  16273. var recentComand = genericCreateCommand(command_type);
  16274. command_parent.commands_block.push(recentComand);
  16275. renderCommand(recentComand, el_jq.find('.block_commands'), 3, function_obj);
  16276. } else {
  16277. // Se já tem algum comando no bloco:
  16278. findInBlockCorrectPlace(el, event, function_obj, command_type);
  16279. }
  16280. } else if (el_jq.data('command').type == Models.COMMAND_TYPES.iftrue) {
  16281. console.log('QQ9');
  16282. // no if ou no else?
  16283. var correct_div = (0, _jquery2.default)(document.elementFromPoint(event.pageX, event.pageY));
  16284. var is_in_if = true;
  16285. if (correct_div.data('if')) {
  16286. is_in_if = true;
  16287. } else if (correct_div.data('else')) {
  16288. is_in_if = false;
  16289. } else {
  16290. var hier = correct_div.parentsUntil(".command_container");
  16291. for (var i = 0; i < hier.length; i++) {
  16292. var temp = (0, _jquery2.default)(hier[i]);
  16293. if (typeof temp.data('if') !== 'undefined') {
  16294. is_in_if = true;
  16295. break;
  16296. }
  16297. if (typeof temp.data('else') !== 'undefined') {
  16298. is_in_if = false;
  16299. break;
  16300. }
  16301. }
  16302. }
  16303. if (is_in_if) {
  16304. if (command_parent.commands_block == null || command_parent.commands_block.length == 0) {
  16305. command_parent.commands_block = [];
  16306. var recentComand = genericCreateCommand(command_type);
  16307. command_parent.commands_block.push(recentComand);
  16308. renderCommand(recentComand, el_jq.find('.commands_if'), 3, function_obj);
  16309. } else {
  16310. // Se já tem algum comando no bloco:
  16311. findInBlockCorrectPlace(el_jq.find('.commands_if'), event, function_obj, command_type);
  16312. }
  16313. } else {
  16314. if (command_parent.commands_else == null || command_parent.commands_else.length == 0) {
  16315. command_parent.commands_else = [];
  16316. var recentComand = genericCreateCommand(command_type);
  16317. command_parent.commands_else.push(recentComand);
  16318. renderCommand(recentComand, el_jq.find('.commands_else'), 3, function_obj);
  16319. } else {
  16320. // Se já tem algum comando no bloco:
  16321. findInBlockCorrectPlace(el_jq.find('.commands_else'), event, function_obj, command_type, true);
  16322. }
  16323. }
  16324. } else {
  16325. // é do tipo switch
  16326. console.log("está tentando inserir em um switch que está na raiz!");
  16327. addCommandToSwitchCase(event, function_obj, command_type);
  16328. }
  16329. }
  16330. function addCommandToSwitchCase(event, function_obj, command_type) {
  16331. var el = (0, _jquery2.default)(document.elementFromPoint(event.clientX, event.clientY));
  16332. var which_case = el.data('switchcase');
  16333. var case_div = el;
  16334. if (!which_case) {
  16335. var hier_find = el.parentsUntil(".all_cases_div");
  16336. for (var i = 0; i < hier_find.length; i++) {
  16337. if (typeof (0, _jquery2.default)(hier_find[i]).data('switchcase') !== 'undefined') {
  16338. which_case = (0, _jquery2.default)(hier_find[i]).data('switchcase');
  16339. case_div = (0, _jquery2.default)(hier_find[i]);
  16340. break;
  16341. }
  16342. }
  16343. }
  16344. if (which_case.commands_block == null || which_case.commands_block.length < 1) {
  16345. which_case.commands_block = [];
  16346. var recentComand = genericCreateCommand(command_type);
  16347. which_case.commands_block.push(recentComand);
  16348. renderCommand(recentComand, case_div.find('.case_commands_block'), 3, function_obj);
  16349. } else {
  16350. findInBlockCorrectPlaceInSwitchCase(which_case, case_div, event, function_obj, command_type);
  16351. }
  16352. }
  16353. function findInBlockCorrectPlaceInSwitchCase(which_case, case_div, event, function_obj, command_type) {
  16354. var all_sub = case_div.find('div.command_container');
  16355. var menor_distancia = 999999999;
  16356. var elemento_menor_distancia = null;
  16357. var antes = true;
  16358. var t_bot;
  16359. var t_top;
  16360. // Descobrindo o elemento mais próximo:
  16361. for (var i = 0; i < all_sub.length; i++) {
  16362. t_top = all_sub[i].getBoundingClientRect().top;
  16363. t_bot = all_sub[i].getBoundingClientRect().top + all_sub[i].getBoundingClientRect().height;
  16364. if (t_top - event.clientY < menor_distancia) {
  16365. menor_distancia = event.clientY - t_top;
  16366. elemento_menor_distancia = all_sub[i];
  16367. }
  16368. }
  16369. var borda_inferior = elemento_menor_distancia.parentNode.getBoundingClientRect().top + elemento_menor_distancia.parentNode.getBoundingClientRect().height;
  16370. // Está mais próximo da borda de baixo, ou seja.. inserir por último:
  16371. if (borda_inferior - event.clientY < menor_distancia) {
  16372. var recentComand = genericCreateCommand(command_type);
  16373. which_case.commands_block.push(recentComand);
  16374. renderCommand(recentComand, (0, _jquery2.default)(case_div.find('.case_commands_block')[0]), 3, function_obj);
  16375. } else {
  16376. var recentComand = genericCreateCommand(command_type);
  16377. var index = which_case.commands_block.indexOf((0, _jquery2.default)(elemento_menor_distancia).data('command'));
  16378. if (index > -1) {
  16379. which_case.commands_block.splice(index, 0, recentComand);
  16380. renderCommand(recentComand, elemento_menor_distancia, 1, function_obj);
  16381. }
  16382. }
  16383. }
  16384. function findInBlockCorrectPlace(el, event, function_obj, command_type) {
  16385. var is_in_else = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
  16386. var el_jq = (0, _jquery2.default)(el);
  16387. var all_sub = el_jq.find('div.command_container');
  16388. var menor_distancia = 999999999;
  16389. var elemento_menor_distancia = null;
  16390. var antes = true;
  16391. var t_bot;
  16392. var t_top;
  16393. // Descobrindo o elemento mais próximo:
  16394. for (var i = 0; i < all_sub.length; i++) {
  16395. t_top = all_sub[i].getBoundingClientRect().top;
  16396. t_bot = all_sub[i].getBoundingClientRect().top + all_sub[i].getBoundingClientRect().height;
  16397. if (t_top - event.clientY < menor_distancia) {
  16398. menor_distancia = event.clientY - t_top;
  16399. elemento_menor_distancia = all_sub[i];
  16400. }
  16401. }
  16402. var borda_inferior = elemento_menor_distancia.parentNode.getBoundingClientRect().top + elemento_menor_distancia.parentNode.getBoundingClientRect().height;
  16403. console.log("menor_distancia: ");
  16404. console.log(elemento_menor_distancia);
  16405. // Está mais próximo da borda de baixo, ou seja.. inserir por último:
  16406. if (borda_inferior - event.clientY < menor_distancia) {
  16407. console.log('QQ11');
  16408. var recentComand = genericCreateCommand(command_type);
  16409. var command_parent = el_jq.data('command');
  16410. if (is_in_else) {
  16411. console.log('QQ15');
  16412. command_parent.commands_else.push(recentComand);
  16413. console.log('el_jq');
  16414. console.log(el_jq);
  16415. console.log("$(el_jq.find('.commands_else')[0]):: ");
  16416. console.log((0, _jquery2.default)(el_jq.find('.commands_else')[0]));
  16417. renderCommand(recentComand, el_jq, 3, function_obj);
  16418. } else {
  16419. console.log('QQ16');
  16420. command_parent.commands_block.push(recentComand);
  16421. renderCommand(recentComand, (0, _jquery2.default)(el_jq.find('.block_commands')[0]), 3, function_obj);
  16422. }
  16423. } else {
  16424. console.log('QQ12');
  16425. var recentComand = genericCreateCommand(command_type);
  16426. var command_parent = el_jq.data('command');
  16427. if (is_in_else) {
  16428. var index = command_parent.commands_else.indexOf((0, _jquery2.default)(elemento_menor_distancia).data('command'));
  16429. if (index > -1) {
  16430. command_parent.commands_else.splice(index, 0, recentComand);
  16431. renderCommand(recentComand, elemento_menor_distancia, 1, function_obj);
  16432. }
  16433. } else {
  16434. var index = command_parent.commands_block.indexOf((0, _jquery2.default)(elemento_menor_distancia).data('command'));
  16435. if (index > -1) {
  16436. command_parent.commands_block.splice(index, 0, recentComand);
  16437. renderCommand(recentComand, elemento_menor_distancia, 1, function_obj);
  16438. }
  16439. }
  16440. }
  16441. }
  16442. function findBeforeOrAfterCommandToAdd(el, event, function_obj, command_type) {
  16443. switch ((0, _jquery2.default)(el).data('command').type) {
  16444. case Models.COMMAND_TYPES.iftrue:
  16445. case Models.COMMAND_TYPES.switch:
  16446. case Models.COMMAND_TYPES.repeatNtimes:
  16447. case Models.COMMAND_TYPES.whiletrue:
  16448. case Models.COMMAND_TYPES.dowhiletrue:
  16449. insertCommandInBlock(el, event, function_obj, command_type);
  16450. return;
  16451. }
  16452. var menor_distancia = 999999999;
  16453. var antes = true;
  16454. var t_bot;
  16455. var t_top;
  16456. t_top = el.getBoundingClientRect().top;
  16457. t_bot = el.getBoundingClientRect().top + el.getBoundingClientRect().height;
  16458. var d_top = event.clientY - t_top; // distancia topo
  16459. var d_bot = t_bot - event.clientY; // distancia baixo
  16460. // Está mais próximo da borda de baixo, ou seja.. inserir por último:
  16461. if (d_top < d_bot) {
  16462. var recentComand = genericCreateCommand(command_type);
  16463. var index = function_obj.commands.indexOf((0, _jquery2.default)(el).data('command'));
  16464. if (index > -1) {
  16465. function_obj.commands.splice(index, 0, recentComand);
  16466. }
  16467. renderCommand(recentComand, el, 1, function_obj);
  16468. } else {
  16469. var recentComand = genericCreateCommand(command_type);
  16470. var index = function_obj.commands.indexOf((0, _jquery2.default)(el).data('command'));
  16471. if (index > -1) {
  16472. function_obj.commands.splice(index + 1, 0, recentComand);
  16473. }
  16474. renderCommand(recentComand, el, 2, function_obj);
  16475. }
  16476. }
  16477. function findNearbyCommandToAddInFunctionScope(el, event, node_list_commands, function_obj, command_type) {
  16478. var all_sub = (0, _jquery2.default)(node_list_commands).find('div.command_container');
  16479. var menor_distancia = 999999999;
  16480. var elemento_menor_distancia = null;
  16481. var antes = true;
  16482. var t_bot;
  16483. var t_top;
  16484. // Descobrindo o elemento mais próximo:
  16485. for (var i = 0; i < all_sub.length; i++) {
  16486. t_top = all_sub[i].getBoundingClientRect().top;
  16487. t_bot = all_sub[i].getBoundingClientRect().top + all_sub[i].getBoundingClientRect().height;
  16488. if (t_top - event.clientY < menor_distancia) {
  16489. menor_distancia = event.clientY - t_top;
  16490. elemento_menor_distancia = all_sub[i];
  16491. }
  16492. }
  16493. var borda_inferior = elemento_menor_distancia.parentNode.getBoundingClientRect().top + elemento_menor_distancia.parentNode.getBoundingClientRect().height;
  16494. // Está mais próximo da borda de baixo, ou seja.. inserir por último:
  16495. if (borda_inferior - event.clientY < menor_distancia) {
  16496. var recentComand = genericCreateCommand(command_type);
  16497. function_obj.commands.push(recentComand);
  16498. //
  16499. renderCommand(recentComand, node_list_commands, 3, function_obj);
  16500. } else {
  16501. var recentComand = genericCreateCommand(command_type);
  16502. var index = function_obj.commands.indexOf((0, _jquery2.default)(elemento_menor_distancia).data('command'));
  16503. if (index > -1) {
  16504. function_obj.commands.splice(index, 0, recentComand);
  16505. }
  16506. renderCommand(recentComand, elemento_menor_distancia, 1, function_obj);
  16507. }
  16508. }
  16509. /***/ }),
  16510. /***/ "./js/visualUI/commands/attribution.js":
  16511. /*!*********************************************!*\
  16512. !*** ./js/visualUI/commands/attribution.js ***!
  16513. \*********************************************/
  16514. /*! no static exports found */
  16515. /***/ (function(module, exports, __webpack_require__) {
  16516. "use strict";
  16517. Object.defineProperty(exports, "__esModule", {
  16518. value: true
  16519. });
  16520. exports.createFloatingCommand = createFloatingCommand;
  16521. exports.renderCommand = renderCommand;
  16522. exports.manageExpressionElements = manageExpressionElements;
  16523. exports.renderMenuOperations = renderMenuOperations;
  16524. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  16525. var _jquery2 = _interopRequireDefault(_jquery);
  16526. var _types = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  16527. var _ivprog_elements = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  16528. var Models = _interopRequireWildcard(_ivprog_elements);
  16529. var _localizedStringsService = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  16530. var _globals = __webpack_require__(/*! ../globals */ "./js/visualUI/globals.js");
  16531. var GlobalsManagement = _interopRequireWildcard(_globals);
  16532. var _variables = __webpack_require__(/*! ../variables */ "./js/visualUI/variables.js");
  16533. var VariablesManagement = _interopRequireWildcard(_variables);
  16534. var _variable_value_menu = __webpack_require__(/*! ./variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  16535. var VariableValueMenu = _interopRequireWildcard(_variable_value_menu);
  16536. var VariableValueMenuManagement = _interopRequireWildcard(_variable_value_menu);
  16537. var _commands = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  16538. var CommandsManagement = _interopRequireWildcard(_commands);
  16539. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  16540. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  16541. function createFloatingCommand() {
  16542. return (0, _jquery2.default)('<div class="ui attribution created_element"> <i class="ui icon small arrow left"></i> <span> x = 1 + 1 </span></div>');
  16543. }
  16544. function renderCommand(command, function_obj) {
  16545. var el = (0, _jquery2.default)('<div class="ui attribution command_container"><i class="ui icon small arrow left command_drag"></i> <i class="ui icon times red button_remove_command"></i> <div class="var_attributed"></div> <span class="text_attr_receives span_command_spec">' + _localizedStringsService.LocalizedStrings.getUI('text_receives') + '</span> ' + '<div class="expression_elements"></div> </div>');
  16546. el.data('command', command);
  16547. VariableValueMenu.renderMenu(command, command.variable, el.find('.var_attributed'), function_obj);
  16548. if (!command.expression || command.expression.length < 1) {
  16549. var exp = new Models.ExpressionElement(Models.EXPRESSION_ELEMENTS.op_exp, [Models.ARITHMETIC_TYPES.none, new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all, null, null, null, true)]);
  16550. command.expression.push(exp);
  16551. }
  16552. addHandlers(command, function_obj, el);
  16553. renderExpressionElements(command, function_obj, el);
  16554. return el;
  16555. }
  16556. function manageExpressionElements(command, ref_object, dom_object, menu_var_or_value, function_obj, selectedItem, expression_element) {
  16557. var index_to_move = expression_element.itens.indexOf(ref_object);
  16558. switch (selectedItem.data('exp')) {
  16559. case Models.EXPRESSION_ELEMENTS.exp_op_exp:
  16560. var exp = new Models.ExpressionElement(Models.EXPRESSION_ELEMENTS.exp_op_exp, [expression_element.itens[index_to_move], Models.ARITHMETIC_TYPES.plus, new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all, null, null, null, true)]);
  16561. expression_element.itens[index_to_move] = exp;
  16562. break;
  16563. case Models.EXPRESSION_ELEMENTS.op_exp:
  16564. var exp = new Models.ExpressionElement(Models.EXPRESSION_ELEMENTS.op_exp, [Models.ARITHMETIC_TYPES.plus, expression_element.itens[index_to_move]]);
  16565. expression_element.itens[index_to_move] = exp;
  16566. break;
  16567. case Models.EXPRESSION_ELEMENTS.par_exp_par:
  16568. var exp = new Models.ExpressionElement(Models.EXPRESSION_ELEMENTS.par_exp_par, [expression_element.itens[index_to_move]]);
  16569. expression_element.itens[index_to_move] = exp;
  16570. break;
  16571. }
  16572. renderExpressionElements(command, function_obj, dom_object);
  16573. }
  16574. function renderExpressionElements(command, function_obj, el) {
  16575. var expression_div = el.find('.expression_elements');
  16576. var command_container;
  16577. if (el.hasClass("command_container") == false) {
  16578. var hier = el.parentsUntil(".command_container");
  16579. for (var i = 0; i < hier.length; i++) {
  16580. if ((0, _jquery2.default)(hier[i]).hasClass("command_container")) {
  16581. command_container = (0, _jquery2.default)(hier[i]);
  16582. break;
  16583. }
  16584. if ((0, _jquery2.default)(hier[i]).hasClass("expression_elements")) {
  16585. expression_div = (0, _jquery2.default)(hier[i]);
  16586. break;
  16587. }
  16588. }
  16589. }
  16590. if (command_container) {
  16591. expression_div = command_container.find('.expression_elements');
  16592. }
  16593. expression_div.text('');
  16594. for (var i = 0; i < command.expression.length; i++) {
  16595. var temp = (0, _jquery2.default)('<div class="expression_element"></div>');
  16596. temp.data('ref_element', command.expression[i]);
  16597. temp.data('ref_index', i);
  16598. expression_div.append(temp);
  16599. renderElement(command, function_obj, temp, command.expression[i]);
  16600. }
  16601. }
  16602. function renderOperator(command, function_obj, temp_op, expression_element, index_op) {
  16603. var context_menu = '<div class="ui dropdown"><div class="text">';
  16604. switch (expression_element.itens[index_op]) {
  16605. case Models.ARITHMETIC_TYPES.plus:
  16606. context_menu += '+';
  16607. break;
  16608. case Models.ARITHMETIC_TYPES.minus:
  16609. context_menu += '-';
  16610. break;
  16611. case Models.ARITHMETIC_TYPES.multiplication:
  16612. context_menu += '*';
  16613. break;
  16614. case Models.ARITHMETIC_TYPES.division:
  16615. context_menu += '/';
  16616. break;
  16617. case Models.ARITHMETIC_TYPES.module:
  16618. context_menu += '%';
  16619. break;
  16620. case Models.ARITHMETIC_TYPES.none:
  16621. context_menu += '...';
  16622. break;
  16623. }
  16624. context_menu += '</div><div class="menu">';
  16625. context_menu += '<div class="item" data-value="' + Models.ARITHMETIC_TYPES.plus + '">+</div>';
  16626. context_menu += '<div class="item" data-value="' + Models.ARITHMETIC_TYPES.minus + '">-</div>';
  16627. context_menu += '<div class="item" data-value="' + Models.ARITHMETIC_TYPES.multiplication + '">*</div>';
  16628. context_menu += '<div class="item" data-value="' + Models.ARITHMETIC_TYPES.division + '">/</div>';
  16629. context_menu += '<div class="item" data-value="' + Models.ARITHMETIC_TYPES.module + '">%</div>';
  16630. context_menu += '<div class="item" data-value="' + Models.ARITHMETIC_TYPES.none + '" data-text="...">Nenhum</div>';
  16631. context_menu += '</div></div>';
  16632. context_menu = (0, _jquery2.default)(context_menu);
  16633. temp_op.append(context_menu);
  16634. context_menu.dropdown({
  16635. onChange: function onChange(value, text, $selectedItem) {
  16636. expression_element.itens[index_op] = value;
  16637. }
  16638. });
  16639. }
  16640. function renderMenuAddExpression(command, function_obj, el, dom_append_menu, expression_append_new_expression) {
  16641. if (el.hasClass("command_container") == false) {
  16642. var hier = el.parentsUntil(".commands_list_div");
  16643. for (var i = 0; i < hier.length; i++) {
  16644. if ((0, _jquery2.default)(hier[i]).hasClass("command_container")) {
  16645. el = (0, _jquery2.default)(hier[i]);
  16646. break;
  16647. }
  16648. }
  16649. }
  16650. if (dom_append_menu.hasClass("expression_elements") == false) {
  16651. var hier = el.parentsUntil(".commands_list_div");
  16652. for (var i = 0; i < hier.length; i++) {
  16653. if ((0, _jquery2.default)(hier[i]).hasClass("expression_elements")) {
  16654. dom_append_menu = (0, _jquery2.default)(hier[i]);
  16655. break;
  16656. }
  16657. }
  16658. }
  16659. var context_menu = '<div class="ui dropdown"><div class="text"></div><i class="ui icon arrow alternate circle right outline"></i><div class="menu">';
  16660. context_menu += '<div class="item" data-value="' + Models.EXPRESSION_ELEMENTS.exp_op_exp + '">EXP OP EXP</div>';
  16661. context_menu += '<div class="item" data-value="' + Models.EXPRESSION_ELEMENTS.op_exp + '">OP EXP</div>';
  16662. context_menu += '<div class="item" data-value="' + Models.EXPRESSION_ELEMENTS.par_exp_par + '">( EXP )</div>';
  16663. context_menu += '</div></div>';
  16664. context_menu = (0, _jquery2.default)(context_menu);
  16665. dom_append_menu.append(context_menu);
  16666. context_menu.dropdown({
  16667. onChange: function onChange(value, text, $selectedItem) {
  16668. switch (value) {
  16669. case Models.EXPRESSION_ELEMENTS.exp_op_exp:
  16670. var exp = new Models.ExpressionElement(Models.EXPRESSION_ELEMENTS.exp_op_exp, [new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all, null, null, null, true), Models.ARITHMETIC_TYPES.plus, new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all, null, null, null, true)]);
  16671. expression_append_new_expression.push(exp);
  16672. break;
  16673. case Models.EXPRESSION_ELEMENTS.op_exp:
  16674. var exp = new Models.ExpressionElement(Models.EXPRESSION_ELEMENTS.op_exp, [Models.ARITHMETIC_TYPES.plus, new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all, null, null, null, true)]);
  16675. expression_append_new_expression.push(exp);
  16676. break;
  16677. case Models.EXPRESSION_ELEMENTS.par_exp_par:
  16678. var exp = new Models.ExpressionElement(Models.EXPRESSION_ELEMENTS.par_exp_par, [new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all, null, null, null, true)]);
  16679. expression_append_new_expression.push(exp);
  16680. break;
  16681. }
  16682. renderExpressionElements(command, function_obj, el);
  16683. }
  16684. });
  16685. }
  16686. function renderElement(command, function_obj, el, expression_element) {
  16687. switch (expression_element.type_exp) {
  16688. case Models.EXPRESSION_ELEMENTS.exp_op_exp:
  16689. var temp_op = (0, _jquery2.default)('<div class="component_element"></div>');
  16690. var temp_exp_1 = (0, _jquery2.default)('<div class="component_element"></div>');
  16691. var temp_exp_2 = (0, _jquery2.default)('<div class="component_element"></div>');
  16692. el.append(temp_exp_1);
  16693. el.append(temp_op);
  16694. el.append(temp_exp_2);
  16695. if (expression_element.itens[0].type) {
  16696. VariableValueMenu.renderMenu(command, expression_element.itens[0], temp_exp_1, function_obj, 2, expression_element);
  16697. } else {
  16698. renderElement(command, function_obj, temp_exp_1, expression_element.itens[0]);
  16699. }
  16700. renderOperator(command, function_obj, temp_op, expression_element, 1);
  16701. if (expression_element.itens[2].type) {
  16702. VariableValueMenu.renderMenu(command, expression_element.itens[2], temp_exp_2, function_obj, 2, expression_element);
  16703. } else {
  16704. renderElement(command, function_obj, temp_exp_2, expression_element.itens[2]);
  16705. }
  16706. break;
  16707. case Models.EXPRESSION_ELEMENTS.op_exp:
  16708. var temp_op = (0, _jquery2.default)('<div class="component_element"></div>');
  16709. var temp_exp = (0, _jquery2.default)('<div class="component_element"></div>');
  16710. el.append(temp_op);
  16711. el.append(temp_exp);
  16712. renderOperator(command, function_obj, temp_op, expression_element, 0);
  16713. if (expression_element.itens[1].type) {
  16714. VariableValueMenu.renderMenu(command, expression_element.itens[1], temp_exp, function_obj, 2, expression_element);
  16715. } else {
  16716. renderElement(command, function_obj, temp_exp, expression_element.itens[1]);
  16717. }
  16718. break;
  16719. case Models.EXPRESSION_ELEMENTS.par_exp_par:
  16720. var temp_par_1 = (0, _jquery2.default)('<div class="component_element"> ( </div>');
  16721. var temp_exp = (0, _jquery2.default)('<div class="component_element"></div>');
  16722. var temp_par_2 = (0, _jquery2.default)('<div class="component_element"> ) </div>');
  16723. el.append(temp_par_1);
  16724. el.append(temp_exp);
  16725. for (var j = 0; j < expression_element.itens.length; j++) {
  16726. if (expression_element.itens[j].type) {
  16727. VariableValueMenu.renderMenu(command, expression_element.itens[j], temp_exp, function_obj, 2, expression_element);
  16728. } else {
  16729. renderElement(command, function_obj, temp_exp, expression_element.itens[j]);
  16730. }
  16731. }
  16732. //renderMenuAddExpression(command, function_obj, el, el, expression_element.itens);
  16733. el.append(temp_par_2);
  16734. break;
  16735. }
  16736. }
  16737. function renderExpression(command, function_obj, el) {
  16738. var expression_div = el.find('.expression_elements');
  16739. expression_div.text('');
  16740. var menu_add_item = (0, _jquery2.default)('<div class="menu_add_item"></div>');
  16741. menu_add_item.data('index_add', 0);
  16742. expression_div.append(menu_add_item);
  16743. for (var i = 0; i < command.expression.length; i++) {
  16744. if (command.expression[i].type) {
  16745. var temp = (0, _jquery2.default)('<div class="expression_element"></div>');
  16746. temp.data('ref_element', command.expression[i]);
  16747. temp.data('ref_index', i);
  16748. expression_div.append(temp);
  16749. VariableValueMenu.renderMenu(command, command.expression[i], temp, function_obj);
  16750. } else if (command.expression[i] == "(" || command.expression[i] == ")") {
  16751. var temp = (0, _jquery2.default)('<div class="expression_element">' + command.expression[i] + '</div>');
  16752. temp.data('ref_element', command.expression[i]);
  16753. temp.data('ref_index', i);
  16754. expression_div.append(temp);
  16755. } else {
  16756. var temp = '<div class="expression_element">';
  16757. switch (command.expression[i]) {
  16758. case Models.ARITHMETIC_TYPES.plus:
  16759. temp += '+';
  16760. break;
  16761. case Models.ARITHMETIC_TYPES.minus:
  16762. temp += '-';
  16763. break;
  16764. case Models.ARITHMETIC_TYPES.multiplication:
  16765. temp += '*';
  16766. break;
  16767. case Models.ARITHMETIC_TYPES.division:
  16768. temp += '/';
  16769. break;
  16770. case Models.ARITHMETIC_TYPES.module:
  16771. temp += '%';
  16772. break;
  16773. }
  16774. temp += '</div>';
  16775. temp = (0, _jquery2.default)(temp);
  16776. temp.data('ref_element', command.expression[i]);
  16777. temp.data('ref_index', i);
  16778. expression_div.append(temp);
  16779. }
  16780. var menu_add_item_seq = (0, _jquery2.default)('<div class="menu_add_item"></div>');
  16781. var index_temp = i + 1;
  16782. menu_add_item_seq.data('index_add', index_temp);
  16783. expression_div.append(menu_add_item_seq);
  16784. }
  16785. addMenuItens(command, function_obj, el);
  16786. }
  16787. function addMenuItens(command, function_obj, expression_div) {
  16788. var divs_expression = expression_div.find('.menu_add_item');
  16789. for (var i = 0; i < divs_expression.length; i++) {
  16790. var temp = (0, _jquery2.default)(divs_expression[i]).data('index_add');
  16791. var context_menu = '<div class="ui dropdown context_menu_clear"><i class="ui icon plus square outline"></i><div class="menu">';
  16792. context_menu += '<div class="item" data-option="value" data-index="' + temp + '">' + _localizedStringsService.LocalizedStrings.getUI('text_value') + '</div>';
  16793. context_menu += '<div class="item" data-option="operator" data-index="' + temp + '">' + _localizedStringsService.LocalizedStrings.getUI('text_operator') + '</div>';
  16794. context_menu += '<div class="item" data-option="parentheses" data-index="' + temp + '">' + _localizedStringsService.LocalizedStrings.getUI('text_parentheses') + '</div>';
  16795. context_menu += '</div></div>';
  16796. context_menu = (0, _jquery2.default)(context_menu);
  16797. (0, _jquery2.default)(divs_expression[i]).append(context_menu);
  16798. context_menu.dropdown({
  16799. on: 'hover',
  16800. onChange: function onChange(value, text, $selectedItem) {
  16801. switch ($selectedItem.data('option')) {
  16802. case "value":
  16803. command.expression.splice($selectedItem.data('index'), 0, new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all, null, null, null, true));
  16804. renderExpression(command, function_obj, expression_div);
  16805. break;
  16806. case "operator":
  16807. command.expression.splice($selectedItem.data('index'), 0, Models.ARITHMETIC_TYPES.plus);
  16808. renderExpression(command, function_obj, expression_div);
  16809. break;
  16810. case "parentheses":
  16811. command.expression.splice($selectedItem.data('index'), 0, "(");
  16812. command.expression.splice($selectedItem.data('index') + 1, 0, new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all, null, null, null, true));
  16813. command.expression.splice($selectedItem.data('index') + 2, 0, ")");
  16814. renderExpression(command, function_obj, expression_div);
  16815. break;
  16816. }
  16817. }
  16818. });
  16819. }
  16820. }
  16821. function addHandlers(command, function_obj, attribution_dom) {
  16822. attribution_dom.find('.button_remove_command').on('click', function () {
  16823. if (CommandsManagement.removeCommand(command, function_obj, attribution_dom)) {
  16824. attribution_dom.fadeOut();
  16825. }
  16826. });
  16827. attribution_dom.find('.button_refresh_attribution').on('click', function () {
  16828. renderExpressionElements(command, function_obj, attribution_dom);
  16829. });
  16830. }
  16831. function renderMenuOperations(command, ref_object, dom_object, menu_var_or_value, function_obj, variable_selected) {
  16832. /*console.log("recebido o seguinte DOM: ");
  16833. console.log(dom_object);
  16834. if (dom_object.hasClass('var_attributed')) {
  16835. return;
  16836. } else {
  16837. var hier = dom_object.parentsUntil(".command_container");
  16838. for (var i = 0; i < hier.length; i++) {
  16839. if ($(hier[i]).hasClass('var_attributed') || $(hier[i]).hasClass('parameters_function_called')) {
  16840. return;
  16841. }
  16842. }
  16843. }
  16844. dom_object.find('.context_menu_clear').remove();
  16845. var menu_operations = '<div class="ui dropdown menu_operations"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
  16846. for (var tm in Models.ARITHMETIC_TYPES) {
  16847. menu_operations += '<div class="item" data-option="'+tm+'">'+LocalizedStrings.getUI('btn_arithmetic_' + tm)+'</div>';
  16848. }
  16849. menu_operations += '<div class="item" data-option="clear">'+LocalizedStrings.getUI('btn_clear')+'</div>';
  16850. menu_operations += '</div></div>';
  16851. menu_operations = $(menu_operations);
  16852. dom_object.append(menu_operations);
  16853. menu_operations.dropdown({
  16854. onChange: function(value, text, $selectedItem) {
  16855. switch ($($selectedItem).data('option')) {
  16856. case "clear":
  16857. $(dom_object).text('');
  16858. VariableValueMenu.renderMenu(command, ref_object, dom_object, function_obj);
  16859. break;
  16860. default:
  16861. createExpressionAround(command, ref_object, dom_object, function_obj);
  16862. menu_operations.find('.text').text('');
  16863. }
  16864. }
  16865. });*/
  16866. }
  16867. function createExpressionAround(command, ref_object, dom_object, function_obj) {
  16868. (0, _jquery2.default)('<span> ( </span>').insertBefore(dom_object);
  16869. (0, _jquery2.default)('<span> ) </span>').insertAfter(dom_object);
  16870. VariableValueMenu.renderMenu(command, new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all, null, null, null, true), dom_object, function_obj);
  16871. }
  16872. /***/ }),
  16873. /***/ "./js/visualUI/commands/break.js":
  16874. /*!***************************************!*\
  16875. !*** ./js/visualUI/commands/break.js ***!
  16876. \***************************************/
  16877. /*! no static exports found */
  16878. /***/ (function(module, exports, __webpack_require__) {
  16879. "use strict";
  16880. Object.defineProperty(exports, "__esModule", {
  16881. value: true
  16882. });
  16883. exports.createFloatingCommand = createFloatingCommand;
  16884. exports.renderCommand = renderCommand;
  16885. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  16886. var _jquery2 = _interopRequireDefault(_jquery);
  16887. var _types = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  16888. var _ivprog_elements = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  16889. var Models = _interopRequireWildcard(_ivprog_elements);
  16890. var _localizedStringsService = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  16891. var _commands = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  16892. var CommandsManagement = _interopRequireWildcard(_commands);
  16893. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  16894. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  16895. function createFloatingCommand() {
  16896. return (0, _jquery2.default)('<div class="ui comment created_element"> <i class="ui icon small quote left"></i> <span> ' + _localizedStringsService.LocalizedStrings.getUI('text_break') + ' </span></div>');
  16897. }
  16898. function renderCommand(command, function_obj) {
  16899. var el = (0, _jquery2.default)('<div class="ui comment command_container"> <i class="ui icon small quote left"></i> <i class="ui icon times red button_remove_command"></i> <span>' + _localizedStringsService.LocalizedStrings.getUI('text_break') + '</span> </div>');
  16900. el.data('command', command);
  16901. addHandlers(command, function_obj, el);
  16902. return el;
  16903. }
  16904. function addHandlers(command, function_obj, break_dom) {
  16905. break_dom.find('.button_remove_command').on('click', function () {
  16906. if (CommandsManagement.removeCommand(command, function_obj, break_dom)) {
  16907. break_dom.fadeOut();
  16908. }
  16909. });
  16910. }
  16911. /***/ }),
  16912. /***/ "./js/visualUI/commands/comment.js":
  16913. /*!*****************************************!*\
  16914. !*** ./js/visualUI/commands/comment.js ***!
  16915. \*****************************************/
  16916. /*! no static exports found */
  16917. /***/ (function(module, exports, __webpack_require__) {
  16918. "use strict";
  16919. Object.defineProperty(exports, "__esModule", {
  16920. value: true
  16921. });
  16922. exports.createFloatingCommand = createFloatingCommand;
  16923. exports.renderCommand = renderCommand;
  16924. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  16925. var _jquery2 = _interopRequireDefault(_jquery);
  16926. var _types = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  16927. var _ivprog_elements = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  16928. var Models = _interopRequireWildcard(_ivprog_elements);
  16929. var _localizedStringsService = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  16930. var _globals = __webpack_require__(/*! ../globals */ "./js/visualUI/globals.js");
  16931. var GlobalsManagement = _interopRequireWildcard(_globals);
  16932. var _variables = __webpack_require__(/*! ../variables */ "./js/visualUI/variables.js");
  16933. var VariablesManagement = _interopRequireWildcard(_variables);
  16934. var _variable_value_menu = __webpack_require__(/*! ./variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  16935. var VariableValueMenu = _interopRequireWildcard(_variable_value_menu);
  16936. var _commands = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  16937. var CommandsManagement = _interopRequireWildcard(_commands);
  16938. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  16939. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  16940. function createFloatingCommand() {
  16941. return (0, _jquery2.default)('<div class="ui comment created_element"> <i class="ui icon small quote left"></i> <span class="span_comment_text" "> ' + _localizedStringsService.LocalizedStrings.getUI('text_comment') + ' </span></div>');
  16942. }
  16943. function renderCommand(command, function_obj) {
  16944. var el = (0, _jquery2.default)('<div class="ui comment command_container"> <i class="ui icon small quote left command_drag"></i> <i class="ui icon times red button_remove_command"></i> <div class="var_value_menu_div"></div> <div class="div_comment_text">' + '</div> </div>');
  16945. el.data('command', command);
  16946. addHandlers(command, function_obj, el);
  16947. renderTextComment(command, function_obj, el);
  16948. return el;
  16949. }
  16950. function renderTextComment(command, function_obj, el) {
  16951. VariableValueMenu.renderMenu(command, command.comment_text, el.find('.var_value_menu_div'), function_obj, 20);
  16952. }
  16953. function addHandlers(command, function_obj, comment_dom) {
  16954. comment_dom.find('.button_remove_command').on('click', function () {
  16955. if (CommandsManagement.removeCommand(command, function_obj, comment_dom)) {
  16956. comment_dom.fadeOut();
  16957. }
  16958. });
  16959. }
  16960. /***/ }),
  16961. /***/ "./js/visualUI/commands/conditional_expression.js":
  16962. /*!********************************************************!*\
  16963. !*** ./js/visualUI/commands/conditional_expression.js ***!
  16964. \********************************************************/
  16965. /*! no static exports found */
  16966. /***/ (function(module, exports, __webpack_require__) {
  16967. "use strict";
  16968. Object.defineProperty(exports, "__esModule", {
  16969. value: true
  16970. });
  16971. exports.renderExpression = renderExpression;
  16972. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  16973. var _jquery2 = _interopRequireDefault(_jquery);
  16974. var _types = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  16975. var _ivprog_elements = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  16976. var Models = _interopRequireWildcard(_ivprog_elements);
  16977. var _localizedStringsService = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  16978. var _globals = __webpack_require__(/*! ../globals */ "./js/visualUI/globals.js");
  16979. var GlobalsManagement = _interopRequireWildcard(_globals);
  16980. var _variables = __webpack_require__(/*! ../variables */ "./js/visualUI/variables.js");
  16981. var VariablesManagement = _interopRequireWildcard(_variables);
  16982. var _variable_value_menu = __webpack_require__(/*! ./variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  16983. var VariableValueMenuManagement = _interopRequireWildcard(_variable_value_menu);
  16984. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  16985. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  16986. function renderExpression(command, expression, function_obj, initial_el_to_render) {
  16987. if (expression.expression == null || expression.expression.length < 1) {
  16988. renderStartMenu(command, expression, function_obj, initial_el_to_render);
  16989. } else {
  16990. var main_div = (0, _jquery2.default)('<div class="expression_elements"></div>');
  16991. switch (expression.expression.type) {
  16992. case Models.EXPRESSION_TYPES.exp_logic:
  16993. renderLogicExpression(command, expression, expression.expression, function_obj, main_div, initial_el_to_render);
  16994. break;
  16995. case Models.EXPRESSION_TYPES.exp_arithmetic:
  16996. renderArithmeticExpression(command, expression, expression.expression, function_obj, main_div);
  16997. break;
  16998. }
  16999. initial_el_to_render.append(main_div);
  17000. }
  17001. }
  17002. function renderArithmeticOperator(command, all_expression, expression_arithmetic, arithmetic_operator, function_obj, element_to_append) {
  17003. var menu_operator = (0, _jquery2.default)('<div class="ui dropdown"><div class="text"></div><i class="dropdown icon"></i></div>');
  17004. menu_operator.dropdown({
  17005. values: [{
  17006. name: '>',
  17007. value: Models.ARITHMETIC_COMPARISON.greater_than,
  17008. selected: arithmetic_operator == Models.ARITHMETIC_COMPARISON.greater_than
  17009. }, {
  17010. name: '<',
  17011. value: Models.ARITHMETIC_COMPARISON.less_than,
  17012. selected: arithmetic_operator == Models.ARITHMETIC_COMPARISON.less_than
  17013. }, {
  17014. name: '==',
  17015. value: Models.ARITHMETIC_COMPARISON.equals_to,
  17016. selected: arithmetic_operator == Models.ARITHMETIC_COMPARISON.equals_to
  17017. }, {
  17018. name: '!=',
  17019. value: Models.ARITHMETIC_COMPARISON.not_equals_to,
  17020. selected: arithmetic_operator == Models.ARITHMETIC_COMPARISON.not_equals_to
  17021. }, {
  17022. name: '>=',
  17023. value: Models.ARITHMETIC_COMPARISON.greater_than_or_equals_to,
  17024. selected: arithmetic_operator == Models.ARITHMETIC_COMPARISON.greater_than_or_equals_to
  17025. }, {
  17026. name: '<=',
  17027. value: Models.ARITHMETIC_COMPARISON.less_than_or_equals_to,
  17028. selected: arithmetic_operator == Models.ARITHMETIC_COMPARISON.less_than_or_equals_to
  17029. }],
  17030. onChange: function onChange(value, text, $selectedItem) {
  17031. expression_arithmetic.operator = value;
  17032. }
  17033. });
  17034. element_to_append.append(menu_operator);
  17035. }
  17036. function renderLogicOperator(command, all_expression, expression_logic, logic_operator, function_obj, element_to_append, initial_el_to_render) {
  17037. var menu_operator = (0, _jquery2.default)('<div class="ui dropdown"><div class="text"></div><i class="dropdown icon"></i></div>');
  17038. menu_operator.dropdown({
  17039. values: [{
  17040. name: '==',
  17041. value: Models.LOGIC_COMPARISON.equals_to,
  17042. selected: logic_operator == Models.LOGIC_COMPARISON.equals_to
  17043. }, {
  17044. name: '!=',
  17045. value: Models.LOGIC_COMPARISON.not_equals_to,
  17046. selected: logic_operator == Models.LOGIC_COMPARISON.not_equals_to
  17047. }, {
  17048. name: '&&',
  17049. value: Models.LOGIC_COMPARISON.and,
  17050. selected: logic_operator == Models.LOGIC_COMPARISON.and
  17051. }, {
  17052. name: '||',
  17053. value: Models.LOGIC_COMPARISON.or,
  17054. selected: logic_operator == Models.LOGIC_COMPARISON.or
  17055. }],
  17056. onChange: function onChange(value, text, $selectedItem) {
  17057. if ($selectedItem) {
  17058. expression_logic.operator = value;
  17059. if (expression_logic.second_operand == null) {
  17060. expression_logic.second_operand = new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all, null, null, null, true);
  17061. initial_el_to_render.empty();
  17062. renderExpression(command, all_expression, function_obj, initial_el_to_render);
  17063. }
  17064. }
  17065. }
  17066. });
  17067. element_to_append.append(menu_operator);
  17068. }
  17069. function renderLogicExpression(command, all_expression, expression_logic, function_obj, element_to_append, initial_el_to_render) {
  17070. var exp_el_par_1 = (0, _jquery2.default)(' <span class="span_command_spec"> </span> ');
  17071. var exp_el_expr_el_1 = (0, _jquery2.default)('<div class="expression_element"></div>');
  17072. var exp_el_expr_operand = (0, _jquery2.default)('<div class="expression_element"></div>');
  17073. var exp_el_expr_el_2 = (0, _jquery2.default)('<div class="expression_element"></div>');
  17074. var exp_el_par_2 = (0, _jquery2.default)(' <span class="span_command_spec"> </span> ');
  17075. if (expression_logic.first_operand.type == Models.EXPRESSION_TYPES.exp_logic) {
  17076. renderLogicExpression(command, all_expression, expression_logic.first_operand, function_obj, exp_el_expr_el_1);
  17077. } else if (expression_logic.first_operand.type == Models.EXPRESSION_TYPES.exp_arithmetic) {
  17078. renderArithmeticExpression(command, all_expression, expression_logic.first_operand, function_obj, exp_el_expr_el_1);
  17079. } else {
  17080. VariableValueMenuManagement.renderMenu(command, expression_logic.first_operand, exp_el_expr_el_1, function_obj);
  17081. }
  17082. element_to_append.append(exp_el_par_1);
  17083. element_to_append.append(exp_el_expr_el_1);
  17084. renderLogicOperator(command, all_expression, expression_logic, expression_logic.operator, function_obj, exp_el_expr_operand, initial_el_to_render);
  17085. element_to_append.append(exp_el_expr_operand);
  17086. if (expression_logic.second_operand) {
  17087. if (expression_logic.second_operand.type == Models.EXPRESSION_TYPES.exp_logic) {
  17088. renderLogicExpression(command, all_expression, expression_logic.second_operand, function_obj, exp_el_expr_el_2);
  17089. } else if (expression_logic.second_operand.type == Models.EXPRESSION_TYPES.exp_arithmetic) {
  17090. renderArithmeticExpression(command, all_expression, expression_logic.second_operand, function_obj, exp_el_expr_el_2);
  17091. } else {
  17092. VariableValueMenuManagement.renderMenu(command, expression_logic.second_operand, exp_el_expr_el_2, function_obj);
  17093. }
  17094. element_to_append.append(exp_el_expr_el_2);
  17095. }
  17096. element_to_append.append(exp_el_par_2);
  17097. }
  17098. function renderArithmeticExpression(command, all_expression, expression_arithmetic, function_obj, element_to_append) {
  17099. var exp_el_par_1 = (0, _jquery2.default)(' <span class="span_command_spec"> </span> ');
  17100. var exp_el_expr_el_1 = (0, _jquery2.default)('<div class="expression_element"></div>');
  17101. var exp_el_expr_operand = (0, _jquery2.default)('<div class="expression_element"></div>');
  17102. var exp_el_expr_el_2 = (0, _jquery2.default)('<div class="expression_element"></div>');
  17103. var exp_el_par_2 = (0, _jquery2.default)(' <span class="span_command_spec"> </span> ');
  17104. if (expression_arithmetic.first_operand.type == Models.EXPRESSION_TYPES.exp_logic) {
  17105. renderLogicExpression(command, all_expression, expression_arithmetic.first_operand, function_obj, exp_el_expr_el_1);
  17106. } else if (expression_arithmetic.first_operand.type == Models.EXPRESSION_TYPES.exp_arithmetic) {
  17107. renderArithmeticExpression(command, all_expression, expression_arithmetic.first_operand, function_obj, exp_el_expr_el_1);
  17108. } else {
  17109. VariableValueMenuManagement.renderMenu(command, expression_arithmetic.first_operand, exp_el_expr_el_1, function_obj);
  17110. }
  17111. if (expression_arithmetic.second_operand.type == Models.EXPRESSION_TYPES.exp_logic) {
  17112. renderLogicExpression(command, all_expression, expression_arithmetic.second_operand, function_obj, exp_el_expr_el_2);
  17113. } else if (expression_arithmetic.second_operand.type == Models.EXPRESSION_TYPES.exp_arithmetic) {
  17114. renderArithmeticExpression(command, all_expression, expression_arithmetic.second_operand, function_obj, exp_el_expr_el_2);
  17115. } else {
  17116. VariableValueMenuManagement.renderMenu(command, expression_arithmetic.second_operand, exp_el_expr_el_2, function_obj);
  17117. }
  17118. renderArithmeticOperator(command, all_expression, expression_arithmetic, expression_arithmetic.operator, function_obj, exp_el_expr_operand);
  17119. element_to_append.append(exp_el_par_1);
  17120. element_to_append.append(exp_el_expr_el_1);
  17121. element_to_append.append(exp_el_expr_operand);
  17122. element_to_append.append(exp_el_expr_el_2);
  17123. element_to_append.append(exp_el_par_2);
  17124. }
  17125. function renderStartMenu(command, expression, function_obj, initial_el_to_render) {
  17126. var start_menu = '';
  17127. start_menu += '<div class="ui dropdown menu_start_rendered"><div class="text"><i>' + _localizedStringsService.LocalizedStrings.getUI('expression_menu_select') + '</i></div><i class="dropdown icon"></i><div class="menu">';
  17128. start_menu += '<div class="item" data-exp="' + Models.EXPRESSION_TYPES.exp_logic + '">' + _localizedStringsService.LocalizedStrings.getUI('text_logic_expression') + '</div>';
  17129. start_menu += '<div class="item" data-exp="' + Models.EXPRESSION_TYPES.exp_arithmetic + '">' + _localizedStringsService.LocalizedStrings.getUI('text_arithmetic_expression') + '</div>';
  17130. start_menu += '</div></div>';
  17131. start_menu = (0, _jquery2.default)(start_menu);
  17132. start_menu.dropdown({
  17133. onChange: function onChange(value, text, $selectedItem) {
  17134. switch ($selectedItem.data('exp')) {
  17135. case Models.EXPRESSION_TYPES.exp_logic:
  17136. expression.expression = new Models.LogicExpression(false, new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all, null, null, null, true));
  17137. break;
  17138. case Models.EXPRESSION_TYPES.exp_arithmetic:
  17139. expression.expression = new Models.ArithmeticExpression(new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all, null, null, null, true), new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all, null, null, null, true), Models.ARITHMETIC_COMPARISON.less_than);
  17140. break;
  17141. }
  17142. initial_el_to_render.html('');
  17143. renderExpression(command, expression, function_obj, initial_el_to_render);
  17144. }
  17145. });
  17146. initial_el_to_render.append(' <span class="span_command_spec"> </span> ');
  17147. initial_el_to_render.append(start_menu);
  17148. initial_el_to_render.append(' <span class="span_command_spec"> </span> ');
  17149. }
  17150. /***/ }),
  17151. /***/ "./js/visualUI/commands/contextualized_menu.js":
  17152. /*!*****************************************************!*\
  17153. !*** ./js/visualUI/commands/contextualized_menu.js ***!
  17154. \*****************************************************/
  17155. /*! no static exports found */
  17156. /***/ (function(module, exports, __webpack_require__) {
  17157. "use strict";
  17158. Object.defineProperty(exports, "__esModule", {
  17159. value: true
  17160. });
  17161. exports.renderMenu = renderMenu;
  17162. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  17163. var _jquery2 = _interopRequireDefault(_jquery);
  17164. var _types = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  17165. var _ivprog_elements = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  17166. var Models = _interopRequireWildcard(_ivprog_elements);
  17167. var _localizedStringsService = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  17168. var _commands = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  17169. var CommandsManagement = _interopRequireWildcard(_commands);
  17170. var _variable_value_menu = __webpack_require__(/*! ./variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  17171. var VariableValueMenuManagement = _interopRequireWildcard(_variable_value_menu);
  17172. var _switch = __webpack_require__(/*! ./switch */ "./js/visualUI/commands/switch.js");
  17173. var SwitchManagement = _interopRequireWildcard(_switch);
  17174. var _repeatNtimes = __webpack_require__(/*! ./repeatNtimes */ "./js/visualUI/commands/repeatNtimes.js");
  17175. var RepeatNTimesManagement = _interopRequireWildcard(_repeatNtimes);
  17176. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  17177. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  17178. function renderMenu(command, dom_where_render, function_obj, dom_command) {
  17179. var menu_div = '<div class="ui dropdown menu_commands" ><i class="icon code"></i> <div class="menu"> ';
  17180. if (command.type == Models.COMMAND_TYPES.repeatNtimes || command.type == Models.COMMAND_TYPES.whiletrue || command.type == Models.COMMAND_TYPES.dowhiletrue) {
  17181. menu_div += '<a class="item" data-command="' + Models.COMMAND_TYPES.break + '"><i class="download icon"></i> ' + _localizedStringsService.LocalizedStrings.getUI('btn_break') + ' </a>';
  17182. } else {
  17183. menu_div += '<a class="item" data-command="' + Models.COMMAND_TYPES.break + '"><i class="download icon"></i> ' + _localizedStringsService.LocalizedStrings.getUI('btn_break') + ' </a>';
  17184. menu_div += '<a class="item" data-command="' + Models.COMMAND_TYPES.switchcase + '"><i class="download icon"></i> ' + _localizedStringsService.LocalizedStrings.getUI('btn_case') + ' </a>';
  17185. }
  17186. menu_div += '</div></div>';
  17187. menu_div = (0, _jquery2.default)(menu_div);
  17188. dom_where_render.append(menu_div);
  17189. addHandlers(command, dom_where_render, function_obj, dom_command);
  17190. }
  17191. function addHandlers(command, dom_where_render, function_obj, dom_command) {
  17192. dom_where_render.find('.menu_commands').dropdown({
  17193. on: 'hover'
  17194. });
  17195. dom_where_render.find('.menu_commands a').on('click', function (evt) {
  17196. if (command.type == Models.COMMAND_TYPES.repeatNtimes || command.type == Models.COMMAND_TYPES.whiletrue || command.type == Models.COMMAND_TYPES.dowhiletrue) {
  17197. if (command.commands_block == null || command.commands_block.length == 0) {
  17198. command.commands_block = [];
  17199. var new_cmd = CommandsManagement.genericCreateCommand((0, _jquery2.default)(this).data('command'));
  17200. command.commands_block.push(new_cmd);
  17201. CommandsManagement.renderCommand(new_cmd, dom_command.find('.block_commands'), 3, function_obj);
  17202. } else {
  17203. CommandsManagement.createFloatingCommand(function_obj, dom_command.find('.block_commands'), (0, _jquery2.default)(this).data('command'), evt);
  17204. }
  17205. } else {
  17206. switch ((0, _jquery2.default)(this).data('command')) {
  17207. case Models.COMMAND_TYPES.break:
  17208. CommandsManagement.createFloatingCommand(function_obj, null, (0, _jquery2.default)(this).data('command'), evt);
  17209. break;
  17210. case Models.COMMAND_TYPES.switchcase:
  17211. addCaseToSwitch(command, dom_where_render, function_obj, dom_command);
  17212. break;
  17213. }
  17214. }
  17215. });
  17216. }
  17217. function addCaseToSwitch(command, dom_where_render, function_obj, dom_command) {
  17218. if (command.cases == null) {
  17219. command.cases = [];
  17220. }
  17221. var sc = new Models.SwitchCase(new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all, null, null, null, true));
  17222. command.cases.push(sc);
  17223. SwitchManagement.renderCase(sc, command, function_obj, dom_command.find('.all_cases_div'));
  17224. }
  17225. /***/ }),
  17226. /***/ "./js/visualUI/commands/dowhiletrue.js":
  17227. /*!*********************************************!*\
  17228. !*** ./js/visualUI/commands/dowhiletrue.js ***!
  17229. \*********************************************/
  17230. /*! no static exports found */
  17231. /***/ (function(module, exports, __webpack_require__) {
  17232. "use strict";
  17233. Object.defineProperty(exports, "__esModule", {
  17234. value: true
  17235. });
  17236. exports.createFloatingCommand = createFloatingCommand;
  17237. exports.renderCommand = renderCommand;
  17238. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  17239. var _jquery2 = _interopRequireDefault(_jquery);
  17240. var _types = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  17241. var _ivprog_elements = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  17242. var Models = _interopRequireWildcard(_ivprog_elements);
  17243. var _localizedStringsService = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  17244. var _globals = __webpack_require__(/*! ../globals */ "./js/visualUI/globals.js");
  17245. var GlobalsManagement = _interopRequireWildcard(_globals);
  17246. var _variables = __webpack_require__(/*! ../variables */ "./js/visualUI/variables.js");
  17247. var VariablesManagement = _interopRequireWildcard(_variables);
  17248. var _commands = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  17249. var CommandsManagement = _interopRequireWildcard(_commands);
  17250. var _conditional_expression = __webpack_require__(/*! ./conditional_expression */ "./js/visualUI/commands/conditional_expression.js");
  17251. var ConditionalExpressionManagement = _interopRequireWildcard(_conditional_expression);
  17252. var _contextualized_menu = __webpack_require__(/*! ./contextualized_menu */ "./js/visualUI/commands/contextualized_menu.js");
  17253. var ContextualizedMenu = _interopRequireWildcard(_contextualized_menu);
  17254. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  17255. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  17256. function createFloatingCommand() {
  17257. return (0, _jquery2.default)('<div class="ui dowhiletrue created_element"> <i class="ui icon small sync"></i> <span> ' + _localizedStringsService.LocalizedStrings.getUI('text_command_do') + ' {<br>} ' + _localizedStringsService.LocalizedStrings.getUI('text_code_while') + '(x < 10) </span></div>');
  17258. }
  17259. function renderCommand(command, function_obj) {
  17260. var ret = '';
  17261. ret += '<div class="ui dowhiletrue command_container"> <i class="ui icon small random command_drag"></i> <i class="ui icon times red button_remove_command"></i> <div class="ui context_menu"></div> <span class="span_command_spec"> ' + _localizedStringsService.LocalizedStrings.getUI('text_command_do') + ' </span>';
  17262. ret += '<div class="ui block_commands" data-subblock="" data-idcommand="">';
  17263. ret += '</div>';
  17264. ret += ' <span class="span_command_spec"> ' + _localizedStringsService.LocalizedStrings.getUI('text_code_while') + ' </span> <span class="span_command_spec"> ( </span> <div class="conditional_expression"></div> <span class="span_command_spec"> ) </span>';
  17265. ret += '</div>';
  17266. var el = (0, _jquery2.default)(ret);
  17267. el.data('command', command);
  17268. addHandlers(command, function_obj, el);
  17269. ContextualizedMenu.renderMenu(command, el.find('.context_menu'), function_obj, el);
  17270. ConditionalExpressionManagement.renderExpression(command, command.expression, function_obj, el.find('.conditional_expression'));
  17271. if (command.commands_block) {
  17272. for (var j = 0; j < command.commands_block.length; j++) {
  17273. CommandsManagement.renderCommand(command.commands_block[j], (0, _jquery2.default)(el.find('.block_commands')[0]), 3, function_obj);
  17274. }
  17275. }
  17276. return el;
  17277. }
  17278. function addHandlers(command, function_obj, dowhiletrue_dom) {
  17279. dowhiletrue_dom.find('.button_remove_command').on('click', function () {
  17280. if (CommandsManagement.removeCommand(command, function_obj, dowhiletrue_dom)) {
  17281. dowhiletrue_dom.fadeOut();
  17282. }
  17283. });
  17284. }
  17285. /***/ }),
  17286. /***/ "./js/visualUI/commands/functioncall.js":
  17287. /*!**********************************************!*\
  17288. !*** ./js/visualUI/commands/functioncall.js ***!
  17289. \**********************************************/
  17290. /*! no static exports found */
  17291. /***/ (function(module, exports, __webpack_require__) {
  17292. "use strict";
  17293. Object.defineProperty(exports, "__esModule", {
  17294. value: true
  17295. });
  17296. exports.createFloatingCommand = createFloatingCommand;
  17297. exports.renderCommand = renderCommand;
  17298. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  17299. var _jquery2 = _interopRequireDefault(_jquery);
  17300. var _types = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  17301. var _ivprog_elements = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  17302. var Models = _interopRequireWildcard(_ivprog_elements);
  17303. var _localizedStringsService = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  17304. var _globals = __webpack_require__(/*! ../globals */ "./js/visualUI/globals.js");
  17305. var GlobalsManagement = _interopRequireWildcard(_globals);
  17306. var _variables = __webpack_require__(/*! ../variables */ "./js/visualUI/variables.js");
  17307. var VariablesManagement = _interopRequireWildcard(_variables);
  17308. var _variable_value_menu = __webpack_require__(/*! ./variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  17309. var VariableValueMenu = _interopRequireWildcard(_variable_value_menu);
  17310. var _commands = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  17311. var CommandsManagement = _interopRequireWildcard(_commands);
  17312. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  17313. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  17314. function createFloatingCommand() {
  17315. return (0, _jquery2.default)('<div class="ui functioncall created_element"> <i class="hand point right icon"></i> <span> funcao() </span></div>');
  17316. }
  17317. function renderCommand(command, function_obj) {
  17318. var el = (0, _jquery2.default)('<div class="ui functioncall command_container"> <i class="hand point right icon command_drag"></i> <i class="ui icon times red button_remove_command"></i> <div class="var_value_menu_div"></div> </div>');
  17319. el.data('command', command);
  17320. VariableValueMenu.renderMenu(command, command.function_called, el.find('.var_value_menu_div'), function_obj);
  17321. addHandlers(command, function_obj, el);
  17322. return el;
  17323. }
  17324. function addHandlers(command, function_obj, functioncall_dom) {
  17325. functioncall_dom.find('.button_remove_command').on('click', function () {
  17326. if (CommandsManagement.removeCommand(command, function_obj, functioncall_dom)) {
  17327. functioncall_dom.fadeOut();
  17328. }
  17329. });
  17330. }
  17331. /***/ }),
  17332. /***/ "./js/visualUI/commands/iftrue.js":
  17333. /*!****************************************!*\
  17334. !*** ./js/visualUI/commands/iftrue.js ***!
  17335. \****************************************/
  17336. /*! no static exports found */
  17337. /***/ (function(module, exports, __webpack_require__) {
  17338. "use strict";
  17339. Object.defineProperty(exports, "__esModule", {
  17340. value: true
  17341. });
  17342. exports.createFloatingCommand = createFloatingCommand;
  17343. exports.renderCommand = renderCommand;
  17344. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  17345. var _jquery2 = _interopRequireDefault(_jquery);
  17346. var _types = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  17347. var _ivprog_elements = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  17348. var Models = _interopRequireWildcard(_ivprog_elements);
  17349. var _localizedStringsService = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  17350. var _globals = __webpack_require__(/*! ../globals */ "./js/visualUI/globals.js");
  17351. var GlobalsManagement = _interopRequireWildcard(_globals);
  17352. var _variables = __webpack_require__(/*! ../variables */ "./js/visualUI/variables.js");
  17353. var VariablesManagement = _interopRequireWildcard(_variables);
  17354. var _commands = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  17355. var CommandsManagement = _interopRequireWildcard(_commands);
  17356. var _conditional_expression = __webpack_require__(/*! ./conditional_expression */ "./js/visualUI/commands/conditional_expression.js");
  17357. var ConditionalExpressionManagement = _interopRequireWildcard(_conditional_expression);
  17358. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  17359. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  17360. function createFloatingCommand() {
  17361. return (0, _jquery2.default)('<div class="ui iftrue created_element"> <i class="ui icon small random"></i> <span> if (x < 1) { } </span></div>');
  17362. }
  17363. function renderCommand(command, function_obj) {
  17364. var ret = '';
  17365. ret += '<div class="ui iftrue command_container"><div class="ui data_block_if" data-if="true"> <i class="ui icon small random command_drag"></i> <i class="ui icon times red button_remove_command"></i>';
  17366. ret += '<span class="span_command_spec"> ' + _localizedStringsService.LocalizedStrings.getUI('text_if') + '</span>';
  17367. ret += ' <span class="span_command_spec"> ( </span> <div class="conditional_expression"></div> <span class="span_command_spec"> ) </span>';
  17368. ret += '<span> </span> ';
  17369. ret += '<div class="ui block_commands commands_if conditional_comands_block" data-if="true">';
  17370. ret += '</div></div>';
  17371. ret += '<div class="ui data_block_else" data-else="true"> <span class="span_command_spec"> ' + _localizedStringsService.LocalizedStrings.getUI('text_else') + ' </span>';
  17372. ret += '<div class="ui block_commands commands_else conditional_comands_block" data-else="true">';
  17373. ret += '</div>';
  17374. ret += '<span></span></div>';
  17375. ret += '</div>';
  17376. var el = (0, _jquery2.default)(ret);
  17377. el.data('command', command);
  17378. el.find('.block_commands').data('command', command);
  17379. el.find('.data_block_if').data('command', command);
  17380. el.find('.data_block_else').data('command', command);
  17381. addHandlers(command, function_obj, el);
  17382. ConditionalExpressionManagement.renderExpression(command, command.expression, function_obj, el.find('.conditional_expression'));
  17383. if (command.commands_block) {
  17384. for (var j = 0; j < command.commands_block.length; j++) {
  17385. CommandsManagement.renderCommand(command.commands_block[j], (0, _jquery2.default)(el.find('.commands_if')[0]), 3, function_obj);
  17386. }
  17387. }
  17388. if (command.commands_else) {
  17389. for (var j = 0; j < command.commands_else.length; j++) {
  17390. CommandsManagement.renderCommand(command.commands_else[j], (0, _jquery2.default)(el.find('.commands_else')[0]), 3, function_obj);
  17391. }
  17392. }
  17393. return el;
  17394. }
  17395. function addHandlers(command, function_obj, iftrue_dom) {
  17396. iftrue_dom.find('.button_remove_command').on('click', function () {
  17397. if (CommandsManagement.removeCommand(command, function_obj, iftrue_dom)) {
  17398. iftrue_dom.fadeOut();
  17399. }
  17400. });
  17401. }
  17402. /***/ }),
  17403. /***/ "./js/visualUI/commands/reader.js":
  17404. /*!****************************************!*\
  17405. !*** ./js/visualUI/commands/reader.js ***!
  17406. \****************************************/
  17407. /*! no static exports found */
  17408. /***/ (function(module, exports, __webpack_require__) {
  17409. "use strict";
  17410. Object.defineProperty(exports, "__esModule", {
  17411. value: true
  17412. });
  17413. exports.createFloatingCommand = createFloatingCommand;
  17414. exports.renderCommand = renderCommand;
  17415. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  17416. var _jquery2 = _interopRequireDefault(_jquery);
  17417. var _types = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  17418. var _ivprog_elements = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  17419. var Models = _interopRequireWildcard(_ivprog_elements);
  17420. var _localizedStringsService = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  17421. var _globals = __webpack_require__(/*! ../globals */ "./js/visualUI/globals.js");
  17422. var GlobalsManagement = _interopRequireWildcard(_globals);
  17423. var _variables = __webpack_require__(/*! ../variables */ "./js/visualUI/variables.js");
  17424. var VariablesManagement = _interopRequireWildcard(_variables);
  17425. var _variable_value_menu = __webpack_require__(/*! ./variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  17426. var VariableValueMenu = _interopRequireWildcard(_variable_value_menu);
  17427. var _commands = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  17428. var CommandsManagement = _interopRequireWildcard(_commands);
  17429. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  17430. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  17431. function createFloatingCommand() {
  17432. return (0, _jquery2.default)('<div class="ui reader created_element"> <i class="ui icon small download"></i> <span> ' + _localizedStringsService.LocalizedStrings.getUI('text_command_read') + ' var </span></div>');
  17433. }
  17434. function renderCommand(command, function_obj) {
  17435. var el = '<div class="ui reader command_container"> <i class="ui icon small download command_drag"></i> <i class="ui icon times red button_remove_command"></i> <span class="span_command_spec">' + _localizedStringsService.LocalizedStrings.getUI('text_command_read') + ' ( </span> <div class="var_value_menu_div"></div> <span class="close_parentheses span_command_spec">)</span> </div>';
  17436. el = (0, _jquery2.default)(el);
  17437. el.data('command', command);
  17438. VariableValueMenu.renderMenu(command, command.variable_value_menu, el.find('.var_value_menu_div'), function_obj);
  17439. addHandlers(command, function_obj, el);
  17440. return el;
  17441. }
  17442. function addHandlers(command, function_obj, reader_dom) {
  17443. reader_dom.find('.button_remove_command').on('click', function () {
  17444. if (CommandsManagement.removeCommand(command, function_obj, reader_dom)) {
  17445. reader_dom.fadeOut();
  17446. }
  17447. });
  17448. }
  17449. /***/ }),
  17450. /***/ "./js/visualUI/commands/repeatNtimes.js":
  17451. /*!**********************************************!*\
  17452. !*** ./js/visualUI/commands/repeatNtimes.js ***!
  17453. \**********************************************/
  17454. /*! no static exports found */
  17455. /***/ (function(module, exports, __webpack_require__) {
  17456. "use strict";
  17457. Object.defineProperty(exports, "__esModule", {
  17458. value: true
  17459. });
  17460. exports.createFloatingCommand = createFloatingCommand;
  17461. exports.renderCommand = renderCommand;
  17462. exports.manageExpressionElements = manageExpressionElements;
  17463. exports.manageClearExpressionElements = manageClearExpressionElements;
  17464. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  17465. var _jquery2 = _interopRequireDefault(_jquery);
  17466. var _types = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  17467. var _ivprog_elements = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  17468. var Models = _interopRequireWildcard(_ivprog_elements);
  17469. var _localizedStringsService = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  17470. var _globals = __webpack_require__(/*! ../globals */ "./js/visualUI/globals.js");
  17471. var GlobalsManagement = _interopRequireWildcard(_globals);
  17472. var _variables = __webpack_require__(/*! ../variables */ "./js/visualUI/variables.js");
  17473. var VariablesManagement = _interopRequireWildcard(_variables);
  17474. var _commands = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  17475. var CommandsManagement = _interopRequireWildcard(_commands);
  17476. var _conditional_expression = __webpack_require__(/*! ./conditional_expression */ "./js/visualUI/commands/conditional_expression.js");
  17477. var ConditionalExpressionManagement = _interopRequireWildcard(_conditional_expression);
  17478. var _variable_value_menu = __webpack_require__(/*! ./variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  17479. var VariableValueMenu = _interopRequireWildcard(_variable_value_menu);
  17480. var _contextualized_menu = __webpack_require__(/*! ./contextualized_menu */ "./js/visualUI/commands/contextualized_menu.js");
  17481. var ContextualizedMenu = _interopRequireWildcard(_contextualized_menu);
  17482. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  17483. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  17484. function createFloatingCommand() {
  17485. return (0, _jquery2.default)('<div class="ui repeatNtimes created_element"> <i class="ui icon small sync"></i> <span> para (x = 0; x < 10; x ++) { } </span></div>');
  17486. }
  17487. function renderCommand(command, function_obj) {
  17488. var ret = '<div class="ui repeatNtimes command_container"> <i class="ui icon small random command_drag"></i> <i class="ui icon times red button_remove_command"></i> <div class="ui context_menu"></div> <span class="span_command_spec"> ' + _localizedStringsService.LocalizedStrings.getUI('text_for') + ' ( </span> <div class="ui attribution_expression"><div class="ui variable_attribution"></div> <span class="text_receives span_command_spec"></span> <div class="ui var_value_expression div_expression_st"></div> </div> <span class="span_command_spec separator_character">;</span> <div class="conditional_expression"></div> <span class="span_command_spec separator_character">;</span> <div class="ui incrementation_field"><div class="ui incrementation_variable"></div> <span class="text_inc_receives span_command_spec"></span> <div class="ui first_operand"></div><div class="ui operator"></div><div class="ui second_operand"></div></div> <span class="span_command_spec"> ) </span>';
  17489. ret += '<div class="ui block_commands">';
  17490. ret += '</div>';
  17491. ret += '<span> </span>';
  17492. ret += '</div>';
  17493. var el = (0, _jquery2.default)(ret);
  17494. el.data('command', command);
  17495. addHandlers(command, function_obj, el);
  17496. ContextualizedMenu.renderMenu(command, el.find('.context_menu'), function_obj, el);
  17497. VariableValueMenu.renderMenu(command, command.var_attribution, el.find('.variable_attribution'), function_obj);
  17498. ConditionalExpressionManagement.renderExpression(command, command.expression2, function_obj, el.find('.conditional_expression'));
  17499. VariableValueMenu.renderMenu(command, command.var_incrementation, el.find('.incrementation_variable'), function_obj);
  17500. if (command.expression1) {
  17501. el.find('.text_receives').text(_localizedStringsService.LocalizedStrings.getUI('text_receives'));
  17502. VariableValueMenu.renderMenu(command, command.expression1, el.find('.var_value_expression'), function_obj);
  17503. }
  17504. if (command.expression3) {
  17505. el.find('.text_inc_receives').text(_localizedStringsService.LocalizedStrings.getUI('text_receives'));
  17506. VariableValueMenu.renderMenu(command, command.expression3.itens[0], el.find('.first_operand'), function_obj);
  17507. renderOperator(command, function_obj, el.find('.operator'), command.expression3, 1);
  17508. VariableValueMenu.renderMenu(command, command.expression3.itens[2], el.find('.second_operand'), function_obj);
  17509. }
  17510. if (command.commands_block) {
  17511. for (var j = 0; j < command.commands_block.length; j++) {
  17512. CommandsManagement.renderCommand(command.commands_block[j], (0, _jquery2.default)(el.find('.block_commands')[0]), 3, function_obj);
  17513. }
  17514. }
  17515. return el;
  17516. }
  17517. function manageExpressionElements(command, ref_object, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element) {
  17518. if (dom_object.hasClass('variable_attribution')) {
  17519. if (!command.expression3) {
  17520. var exp = new Models.ExpressionElement(Models.EXPRESSION_ELEMENTS.exp_op_exp, [command.var_attribution, Models.ARITHMETIC_TYPES.plus, new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.all, "1", null, null, true)]);
  17521. command.expression3 = exp;
  17522. command.var_incrementation = command.var_attribution;
  17523. var cond_exp = new Models.ArithmeticExpression(command.var_attribution, new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.all, null, null, null, true), Models.ARITHMETIC_COMPARISON.less_than);
  17524. command.expression2.expression = cond_exp;
  17525. }
  17526. dom_object.parent().find('.text_receives').text(_localizedStringsService.LocalizedStrings.getUI('text_receives'));
  17527. command.expression1 = new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.all, "0", null, null, true);
  17528. dom_object.parent().find('.var_value_expression').empty();
  17529. VariableValueMenu.renderMenu(command, command.expression1, dom_object.parent().find('.var_value_expression'), function_obj);
  17530. renderAlgorithm();
  17531. }
  17532. if (dom_object.hasClass('incrementation_variable')) {
  17533. dom_object.parent().find('.text_inc_receives').text(_localizedStringsService.LocalizedStrings.getUI('text_receives'));
  17534. var exp = new Models.ExpressionElement(Models.EXPRESSION_ELEMENTS.exp_op_exp, [new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.all, null, null, null, true), Models.ARITHMETIC_TYPES.plus, new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.all, null, null, null, true)]);
  17535. command.expression3 = exp;
  17536. VariableValueMenu.renderMenu(command, command.expression3.itens[0], dom_object.parent().find('.first_operand'), function_obj);
  17537. renderOperator(command, function_obj, dom_object.parent().find('.operator'), command.expression3, 1);
  17538. VariableValueMenu.renderMenu(command, command.expression3.itens[2], dom_object.parent().find('.second_operand'), function_obj);
  17539. }
  17540. }
  17541. function manageClearExpressionElements(command, ref_object, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element) {
  17542. if (dom_object.hasClass('variable_attribution')) {
  17543. (0, _jquery2.default)(dom_object).parent().find('.text_receives').text('');
  17544. command.expression1 = null;
  17545. (0, _jquery2.default)(dom_object).parent().find('.var_value_expression').empty();
  17546. }
  17547. if (dom_object.hasClass('incrementation_variable')) {
  17548. (0, _jquery2.default)(dom_object).parent().find('.text_inc_receives').text('');
  17549. command.expression3 = null;
  17550. (0, _jquery2.default)(dom_object).parent().find('.first_operand').empty();
  17551. (0, _jquery2.default)(dom_object).parent().find('.operator').empty();
  17552. (0, _jquery2.default)(dom_object).parent().find('.second_operand').empty();
  17553. }
  17554. }
  17555. function addHandlers(command, function_obj, repeatNtimes_dom) {
  17556. repeatNtimes_dom.find('.button_remove_command').on('click', function () {
  17557. if (CommandsManagement.removeCommand(command, function_obj, repeatNtimes_dom)) {
  17558. repeatNtimes_dom.fadeOut();
  17559. }
  17560. });
  17561. }
  17562. function renderOperator(command, function_obj, temp_op, expression_element, index_op) {
  17563. var menu_operator = (0, _jquery2.default)('<div class="ui dropdown"><div class="text"></div></div>');
  17564. menu_operator.dropdown({
  17565. values: [{
  17566. name: '+',
  17567. value: Models.ARITHMETIC_TYPES.plus,
  17568. selected: expression_element.itens[index_op] == Models.ARITHMETIC_TYPES.plus
  17569. }, {
  17570. name: '-',
  17571. value: Models.ARITHMETIC_TYPES.minus,
  17572. selected: expression_element.itens[index_op] == Models.ARITHMETIC_TYPES.minus
  17573. }, {
  17574. name: '*',
  17575. value: Models.ARITHMETIC_TYPES.multiplication,
  17576. selected: expression_element.itens[index_op] == Models.ARITHMETIC_TYPES.multiplication
  17577. }, {
  17578. name: '/',
  17579. value: Models.ARITHMETIC_TYPES.division,
  17580. selected: expression_element.itens[index_op] == Models.ARITHMETIC_TYPES.division
  17581. }, {
  17582. name: '%',
  17583. value: Models.ARITHMETIC_TYPES.module,
  17584. selected: expression_element.itens[index_op] == Models.ARITHMETIC_TYPES.module
  17585. }],
  17586. onChange: function onChange(value, text, $selectedItem) {
  17587. expression_element.itens[index_op] = value;
  17588. }
  17589. });
  17590. temp_op.append(menu_operator);
  17591. }
  17592. /***/ }),
  17593. /***/ "./js/visualUI/commands/return.js":
  17594. /*!****************************************!*\
  17595. !*** ./js/visualUI/commands/return.js ***!
  17596. \****************************************/
  17597. /*! no static exports found */
  17598. /***/ (function(module, exports, __webpack_require__) {
  17599. "use strict";
  17600. Object.defineProperty(exports, "__esModule", {
  17601. value: true
  17602. });
  17603. exports.createFloatingCommand = createFloatingCommand;
  17604. exports.renderCommand = renderCommand;
  17605. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  17606. var _jquery2 = _interopRequireDefault(_jquery);
  17607. var _types = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  17608. var _ivprog_elements = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  17609. var Models = _interopRequireWildcard(_ivprog_elements);
  17610. var _localizedStringsService = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  17611. var _globals = __webpack_require__(/*! ../globals */ "./js/visualUI/globals.js");
  17612. var GlobalsManagement = _interopRequireWildcard(_globals);
  17613. var _variables = __webpack_require__(/*! ../variables */ "./js/visualUI/variables.js");
  17614. var VariablesManagement = _interopRequireWildcard(_variables);
  17615. var _variable_value_menu = __webpack_require__(/*! ./variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  17616. var VariableValueMenu = _interopRequireWildcard(_variable_value_menu);
  17617. var _commands = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  17618. var CommandsManagement = _interopRequireWildcard(_commands);
  17619. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  17620. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  17621. function createFloatingCommand() {
  17622. return (0, _jquery2.default)('<div class="ui return created_element"> <i class="ui icon small reply"></i> <span> ' + _localizedStringsService.LocalizedStrings.getUI('text_return') + ' </span></div>');
  17623. }
  17624. function renderCommand(command, function_obj) {
  17625. var el = (0, _jquery2.default)('<div class="ui return command_container"> <i class="ui icon small reply command_drag"></i> <i class="ui icon times red button_remove_command"></i> <span class="span_command_spec"> ' + _localizedStringsService.LocalizedStrings.getUI('text_return') + ' </span> <div class="var_value_menu_div"></div></div>');
  17626. el.data('command', command);
  17627. addHandlers(command, function_obj, el);
  17628. VariableValueMenu.renderMenu(command, command.variable_value_menu, el.find('.var_value_menu_div'), function_obj);
  17629. return el;
  17630. }
  17631. function addHandlers(command, function_obj, return_dom) {
  17632. return_dom.find('.button_remove_command').on('click', function () {
  17633. if (CommandsManagement.removeCommand(command, function_obj, return_dom)) {
  17634. return_dom.fadeOut();
  17635. }
  17636. });
  17637. }
  17638. /***/ }),
  17639. /***/ "./js/visualUI/commands/switch.js":
  17640. /*!****************************************!*\
  17641. !*** ./js/visualUI/commands/switch.js ***!
  17642. \****************************************/
  17643. /*! no static exports found */
  17644. /***/ (function(module, exports, __webpack_require__) {
  17645. "use strict";
  17646. Object.defineProperty(exports, "__esModule", {
  17647. value: true
  17648. });
  17649. exports.createFloatingCommand = createFloatingCommand;
  17650. exports.renderCommand = renderCommand;
  17651. exports.renderCase = renderCase;
  17652. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  17653. var _jquery2 = _interopRequireDefault(_jquery);
  17654. var _types = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  17655. var _ivprog_elements = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  17656. var Models = _interopRequireWildcard(_ivprog_elements);
  17657. var _localizedStringsService = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  17658. var _globals = __webpack_require__(/*! ../globals */ "./js/visualUI/globals.js");
  17659. var GlobalsManagement = _interopRequireWildcard(_globals);
  17660. var _variables = __webpack_require__(/*! ../variables */ "./js/visualUI/variables.js");
  17661. var VariablesManagement = _interopRequireWildcard(_variables);
  17662. var _commands = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  17663. var CommandsManagement = _interopRequireWildcard(_commands);
  17664. var _variable_value_menu = __webpack_require__(/*! ./variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  17665. var VariableValueMenu = _interopRequireWildcard(_variable_value_menu);
  17666. var _contextualized_menu = __webpack_require__(/*! ./contextualized_menu */ "./js/visualUI/commands/contextualized_menu.js");
  17667. var ContextualizedMenu = _interopRequireWildcard(_contextualized_menu);
  17668. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  17669. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  17670. function createFloatingCommand() {
  17671. return (0, _jquery2.default)('<div class="ui switch created_element"> <i class="ui icon small random"></i> <span> ' + _localizedStringsService.LocalizedStrings.getUI('text_code_switch') + ' ( x ) { <br> ' + _localizedStringsService.LocalizedStrings.getUI('text_code_case') + ' 1: <br> ' + _localizedStringsService.LocalizedStrings.getUI('text_code_case') + ' 2: <br> } </span></div>');
  17672. }
  17673. function renderCommand(command, function_obj) {
  17674. var ret = '';
  17675. ret += '<div class="ui switch command_container"> <i class="ui icon small random command_drag" ></i> <i class="ui icon times red button_remove_command"></i> <div class="ui context_menu"></div> <span> ' + _localizedStringsService.LocalizedStrings.getUI('text_code_switch') + ' ( <div class="ui variable_to_switch"></div> ) <div class="ui all_cases_div"></div></span>';
  17676. ret += '</div>';
  17677. var el = (0, _jquery2.default)(ret);
  17678. el.data('command', command);
  17679. addHandlers(command, function_obj, el);
  17680. ContextualizedMenu.renderMenu(command, el.find('.context_menu'), function_obj, el);
  17681. VariableValueMenu.renderMenu(command, command.variable, el.find('.variable_to_switch'), function_obj);
  17682. if (command.cases) {
  17683. for (var i = 0; i < command.cases.length; i++) {
  17684. renderCase(command.cases[i], command, function_obj, el.find('.all_cases_div'));
  17685. }
  17686. }
  17687. return el;
  17688. }
  17689. function renderCase(switchcase, command, function_obj, el) {
  17690. var casediv = (0, _jquery2.default)('<div class="ui case_div"><i class="ui icon times red button_remove_command"></i><span>' + _localizedStringsService.LocalizedStrings.getUI('text_code_case') + '</span> <div class="ui variable_case"></div>: <div class="case_commands_block"></div></div>');
  17691. VariableValueMenu.renderMenu(command, switchcase.variable_value_menu, casediv.find('.variable_case'), function_obj);
  17692. casediv.data('switchcase', switchcase);
  17693. casediv.find('.case_commands_block').data('switchcase', switchcase);
  17694. el.append(casediv);
  17695. if (switchcase.commands_block) {
  17696. for (var j = 0; j < switchcase.commands_block.length; j++) {
  17697. CommandsManagement.renderCommand(switchcase.commands_block[j], (0, _jquery2.default)(casediv.find('.case_commands_block')[0]), 3, function_obj);
  17698. }
  17699. }
  17700. casediv.find('.button_remove_command').on('click', function () {
  17701. for (var i = 0; i < command.cases.length; i++) {
  17702. if (switchcase == command.cases[i]) {
  17703. delete command.cases[i];
  17704. command.cases.splice(i, 1);
  17705. casediv.remove();
  17706. break;
  17707. }
  17708. }
  17709. });
  17710. }
  17711. function addHandlers(command, function_obj, switch_dom) {
  17712. switch_dom.find('.button_remove_command').on('click', function () {
  17713. if (CommandsManagement.removeCommand(command, function_obj, switch_dom)) {
  17714. switch_dom.fadeOut();
  17715. }
  17716. });
  17717. }
  17718. /***/ }),
  17719. /***/ "./js/visualUI/commands/variable_value_menu.js":
  17720. /*!*****************************************************!*\
  17721. !*** ./js/visualUI/commands/variable_value_menu.js ***!
  17722. \*****************************************************/
  17723. /*! no static exports found */
  17724. /***/ (function(module, exports, __webpack_require__) {
  17725. "use strict";
  17726. Object.defineProperty(exports, "__esModule", {
  17727. value: true
  17728. });
  17729. exports.VAR_OR_VALUE_TYPES = undefined;
  17730. exports.renderMenu = renderMenu;
  17731. exports.refreshMenu = refreshMenu;
  17732. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  17733. var _jquery2 = _interopRequireDefault(_jquery);
  17734. var _types = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  17735. var _ivprog_elements = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  17736. var Models = _interopRequireWildcard(_ivprog_elements);
  17737. var _localizedStringsService = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  17738. var _globals = __webpack_require__(/*! ../globals */ "./js/visualUI/globals.js");
  17739. var GlobalsManagement = _interopRequireWildcard(_globals);
  17740. var _variables = __webpack_require__(/*! ../variables */ "./js/visualUI/variables.js");
  17741. var VariablesManagement = _interopRequireWildcard(_variables);
  17742. var _attribution = __webpack_require__(/*! ./attribution */ "./js/visualUI/commands/attribution.js");
  17743. var AttribuitionsManagement = _interopRequireWildcard(_attribution);
  17744. var _writer = __webpack_require__(/*! ./writer */ "./js/visualUI/commands/writer.js");
  17745. var WritersManagement = _interopRequireWildcard(_writer);
  17746. var _repeatNtimes = __webpack_require__(/*! ./repeatNtimes */ "./js/visualUI/commands/repeatNtimes.js");
  17747. var RepeatNTimesManagement = _interopRequireWildcard(_repeatNtimes);
  17748. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  17749. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  17750. var VAR_OR_VALUE_TYPES = exports.VAR_OR_VALUE_TYPES = Object.freeze({ only_variable: 1, only_value: 2, only_function: 3, variable_and_function: 4, variable_and_value_opt: 5,
  17751. value_and_function: 6, all: 7 });
  17752. function renderMenu(command, ref_object, dom_object, function_obj) {
  17753. var size_field = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 2;
  17754. var expression_element = arguments[5];
  17755. // Verificar se o objeto atual trata-se de uma chamada de função e conferir se possui a quantidade correta de parâmetros
  17756. // Caso não possua, tem que adicionar as variáveis que servirão de parâmetros:
  17757. if (ref_object.function_called) {
  17758. if (ref_object.function_called.parameters_list) {
  17759. while (ref_object.function_called.parameters_list.length != ref_object.parameters_list.length) {
  17760. if (ref_object.parameters_list.length > ref_object.function_called.parameters_list.length) {
  17761. ref_object.parameters_list.pop();
  17762. } else {
  17763. ref_object.parameters_list.push(new Models.VariableValueMenu(VAR_OR_VALUE_TYPES.all, null, null, null, true));
  17764. }
  17765. }
  17766. }
  17767. }
  17768. var menu_var_or_value = '<div class="ui dropdown menu_var_or_value_dom" data-algo="12"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
  17769. if (ref_object.variable_and_value == VAR_OR_VALUE_TYPES.only_variable) {
  17770. menu_var_or_value = '<div class="ui dropdown menu_var_or_value_dom"><div class="text"></div><i class="dropdown icon"></i><div class="menu menu_only_vars">';
  17771. menu_var_or_value += '</div>';
  17772. }
  17773. if (ref_object.variable_and_value == VAR_OR_VALUE_TYPES.variable_and_function || ref_object.variable_and_value == VAR_OR_VALUE_TYPES.variable_and_value_opt || ref_object.variable_and_value == VAR_OR_VALUE_TYPES.all) {
  17774. menu_var_or_value += '<div class="item" data-option="' + VAR_OR_VALUE_TYPES.only_variable + '"><i class="dropdown icon"></i>' + _localizedStringsService.LocalizedStrings.getUI('variable');
  17775. menu_var_or_value += '<div class="menu menu_only_vars">';
  17776. menu_var_or_value += '</div></div>';
  17777. }
  17778. if (ref_object.variable_and_value == VAR_OR_VALUE_TYPES.only_value) {
  17779. menu_var_or_value = '<input type="text" class="width-dynamic" size="' + size_field + '" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" />';
  17780. }
  17781. if (ref_object.variable_and_value == VAR_OR_VALUE_TYPES.variable_and_value_opt || ref_object.variable_and_value == VAR_OR_VALUE_TYPES.value_and_function || ref_object.variable_and_value == VAR_OR_VALUE_TYPES.all) {
  17782. menu_var_or_value += '<div class="item" data-option="' + VAR_OR_VALUE_TYPES.only_value + '">' + _localizedStringsService.LocalizedStrings.getUI('text_value') + '</div>';
  17783. }
  17784. if (ref_object.variable_and_value == VAR_OR_VALUE_TYPES.only_function) {
  17785. menu_var_or_value = '<div class="ui dropdown menu_var_or_value_dom"><div class="text"></div><i class="dropdown icon"></i><div class="menu menu_only_functions">';
  17786. menu_var_or_value += '</div>';
  17787. }
  17788. if (ref_object.variable_and_value == VAR_OR_VALUE_TYPES.variable_and_function || ref_object.variable_and_value == VAR_OR_VALUE_TYPES.value_and_function || ref_object.variable_and_value == VAR_OR_VALUE_TYPES.all) {
  17789. menu_var_or_value += '<div class="item" data-option="' + VAR_OR_VALUE_TYPES.only_function + '"><i class="dropdown icon"></i>' + _localizedStringsService.LocalizedStrings.getUI('btn_function');
  17790. menu_var_or_value += '<div class="menu menu_only_functions">';
  17791. menu_var_or_value += '</div></div>';
  17792. if (command.type == Models.COMMAND_TYPES.attribution) {
  17793. menu_var_or_value += '<div class="item"><i class="dropdown icon"></i>' + _localizedStringsService.LocalizedStrings.getUI('text_change');
  17794. menu_var_or_value += '<div class="menu">';
  17795. menu_var_or_value += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.exp_op_exp + '">EXP OP EXP</div>';
  17796. menu_var_or_value += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.op_exp + '">OP EXP</div>';
  17797. menu_var_or_value += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.par_exp_par + '">( EXP )</div>';
  17798. menu_var_or_value += '</div></div>';
  17799. }
  17800. }
  17801. menu_var_or_value += '</div></div>';
  17802. menu_var_or_value = (0, _jquery2.default)(menu_var_or_value);
  17803. dom_object.append(menu_var_or_value);
  17804. addHandlers(command, ref_object, dom_object, menu_var_or_value, function_obj, expression_element);
  17805. addVariablesToMenu(function_obj, menu_var_or_value, ref_object, expression_element);
  17806. addFunctionsToMenu(function_obj, menu_var_or_value, ref_object, expression_element);
  17807. addIVProgFunctionsToMenu(function_obj, menu_var_or_value, ref_object, expression_element);
  17808. if (ref_object.content || ref_object.function_called) {
  17809. if (ref_object.content) {
  17810. // Verificar se a variável ainda existe:
  17811. var variable_fun = isVarInProgram(ref_object.content, function_obj);
  17812. if (variable_fun) {
  17813. ref_object.content = variable_fun;
  17814. renderPreviousContent(function_obj, menu_var_or_value, ref_object, dom_object, command, expression_element);
  17815. } else {
  17816. if (ref_object.content && ref_object.content.type) {
  17817. ref_object.content = null;
  17818. appendSelectText(ref_object, menu_var_or_value);
  17819. } else {
  17820. renderPreviousContent(function_obj, menu_var_or_value, ref_object, dom_object, command, expression_element);
  17821. }
  17822. }
  17823. } else if (ref_object.function_called) {
  17824. // Verificar se a função ainda existe:
  17825. var ret_function = isFunctionInProgram(ref_object.function_called);
  17826. if (ret_function) {
  17827. ref_object.function_called = ret_function;
  17828. renderPreviousContent(function_obj, menu_var_or_value, ref_object, dom_object, command, expression_element);
  17829. } else {
  17830. ref_object.content = null;
  17831. ref_object.row = null;
  17832. ref_object.column = null;
  17833. delete ref_object.function_called;
  17834. delete ref_object.parameters_list;
  17835. appendSelectText(ref_object, menu_var_or_value);
  17836. }
  17837. }
  17838. } else {
  17839. appendSelectText(ref_object, menu_var_or_value);
  17840. }
  17841. }
  17842. function appendSelectText(ref_object, menu_var_or_value) {
  17843. switch (ref_object.variable_and_value) {
  17844. case VAR_OR_VALUE_TYPES.only_variable:
  17845. menu_var_or_value.find('.text').append('<i>' + _localizedStringsService.LocalizedStrings.getUI('var_menu_select_var') + '</i>');
  17846. break;
  17847. case VAR_OR_VALUE_TYPES.all:
  17848. menu_var_or_value.find('.text').append('<i>' + _localizedStringsService.LocalizedStrings.getUI('var_menu_select_all') + '</i>');
  17849. break;
  17850. case VAR_OR_VALUE_TYPES.variable_and_function:
  17851. menu_var_or_value.find('.text').append('<i>' + _localizedStringsService.LocalizedStrings.getUI('var_menu_select_all') + '</i>');
  17852. break;
  17853. case VAR_OR_VALUE_TYPES.only_function:
  17854. menu_var_or_value.find('.text').append('<i>' + _localizedStringsService.LocalizedStrings.getUI('var_menu_select_function') + '</i>');
  17855. break;
  17856. }
  17857. }
  17858. function isFunctionInProgram(function_called_obj) {
  17859. if (function_called_obj.name) {
  17860. if (window.program_obj.functions) {
  17861. for (var i = 0; i < window.program_obj.functions.length; i++) {
  17862. if (window.program_obj.functions[i] == function_called_obj) {
  17863. return window.program_obj.functions[i];
  17864. }
  17865. }
  17866. for (var i = 0; i < window.program_obj.functions.length; i++) {
  17867. if (window.program_obj.functions[i].name == function_called_obj.name) {
  17868. return window.program_obj.functions[i];
  17869. }
  17870. }
  17871. }
  17872. } else if (function_called_obj.identifier) {
  17873. for (var i = 0; i < window.system_functions.length; i++) {
  17874. if (window.system_functions[i].identifier == function_called_obj.identifier) {
  17875. return window.system_functions[i];
  17876. }
  17877. }
  17878. }
  17879. return null;
  17880. }
  17881. function isVarInProgram(var_obj, function_obj) {
  17882. // Verify in locals:
  17883. if (function_obj.variables_list) {
  17884. for (var i = 0; i < function_obj.variables_list.length; i++) {
  17885. if (function_obj.variables_list[i] == var_obj) {
  17886. return function_obj.variables_list[i];
  17887. }
  17888. }
  17889. }
  17890. // Verify in parameters:
  17891. if (function_obj.parameters_list) {
  17892. for (var i = 0; i < function_obj.parameters_list.length; i++) {
  17893. if (function_obj.parameters_list[i] == var_obj) {
  17894. return function_obj.parameters_list[i];
  17895. }
  17896. }
  17897. }
  17898. // Verify in globals:
  17899. if (window.program_obj.globals) {
  17900. for (var i = 0; i < window.program_obj.globals.length; i++) {
  17901. if (window.program_obj.globals[i] == var_obj) {
  17902. return window.program_obj.globals[i];
  17903. }
  17904. }
  17905. }
  17906. // If not found, verify if the reference was lost
  17907. if (var_obj) {
  17908. if (function_obj.variables_list) {
  17909. for (var i = 0; i < function_obj.variables_list.length; i++) {
  17910. if (function_obj.variables_list[i].name == var_obj.name) {
  17911. return function_obj.variables_list[i];
  17912. }
  17913. }
  17914. }
  17915. if (function_obj.parameters_list) {
  17916. for (var i = 0; i < function_obj.parameters_list.length; i++) {
  17917. if (function_obj.parameters_list[i].name == var_obj.name) {
  17918. return function_obj.parameters_list[i];
  17919. }
  17920. }
  17921. }
  17922. if (window.program_obj.globals) {
  17923. for (var i = 0; i < window.program_obj.globals.length; i++) {
  17924. if (window.program_obj.globals[i].name == var_obj.name) {
  17925. return window.program_obj.globals[i];
  17926. }
  17927. }
  17928. }
  17929. }
  17930. return null;
  17931. }
  17932. function refreshMenu(menu_var_or_value_dom) {
  17933. console.log('\n\n');
  17934. console.log(menu_var_or_value_dom);
  17935. console.log("olá, fui chamado! note alguns DATAS recuperados: ");
  17936. console.log(menu_var_or_value_dom.data());
  17937. console.log('\n\n\n');
  17938. }
  17939. function renderPreviousContent(function_obj, menu_var_or_value, ref_object, dom_object, command, expression_element) {
  17940. if (ref_object.function_called) {
  17941. menu_var_or_value.remove();
  17942. variableValueMenuCode(command, ref_object, dom_object, function_obj, menu_var_or_value, expression_element);
  17943. } else if (ref_object.content.type) {
  17944. menu_var_or_value.remove();
  17945. variableValueMenuCode(command, ref_object, dom_object, function_obj, menu_var_or_value, expression_element);
  17946. } else {
  17947. menu_var_or_value.remove();
  17948. variableValueMenuCode(command, ref_object, dom_object, function_obj, menu_var_or_value, expression_element);
  17949. }
  17950. }
  17951. function variableValueMenuCode(command, variable_obj, dom_object, function_obj, menu_var_or_value, expression_element) {
  17952. if (variable_obj.content || variable_obj.function_called) {
  17953. // Verificar se a variável ainda existe:
  17954. var var_fun = isVarInProgram(variable_obj.content, function_obj);
  17955. if (var_fun) {
  17956. variable_obj.content = var_fun;
  17957. } else {
  17958. if (variable_obj.content && variable_obj.content.type) {
  17959. variable_obj.content = null;
  17960. appendSelectText(variable_obj, menu_var_or_value);
  17961. }
  17962. }
  17963. } else {
  17964. appendSelectText(variable_obj, menu_var_or_value);
  17965. }
  17966. if (variable_obj.content == null && variable_obj.function_called == null) {
  17967. renderMenu(command, variable_obj, dom_object, function_obj, 2, expression_element);
  17968. return;
  17969. }
  17970. var ret = '';
  17971. if (variable_obj.function_called) {
  17972. if (variable_obj.function_called.parameters_list == null || variable_obj.function_called.length == 0) {
  17973. menu_var_or_value.find('.text').text(' ');
  17974. dom_object.find('.menu_var_or_value_dom').remove();
  17975. var parameters_menu;
  17976. if (variable_obj.function_called.name) {
  17977. parameters_menu = '<div class="parameters_function_called"> ' + variable_obj.function_called.name + ' <span> ( </span>';
  17978. } else {
  17979. parameters_menu = '<div class="parameters_function_called"> <i>' + _localizedStringsService.LocalizedStrings.getUI(variable_obj.function_called.category) + '.' + _localizedStringsService.LocalizedStrings.getUI(variable_obj.function_called.identifier) + '</i> <span> ( </span>';
  17980. }
  17981. parameters_menu += '<span> ) </span></div>';
  17982. parameters_menu = (0, _jquery2.default)(parameters_menu);
  17983. dom_object.append(parameters_menu);
  17984. var context_menu = '<div class="ui dropdown context_menu_clear"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
  17985. context_menu += '<div class="item" data-clear="true">' + _localizedStringsService.LocalizedStrings.getUI('btn_clear') + '</div>';
  17986. if (command.type == Models.COMMAND_TYPES.attribution) {
  17987. context_menu += '<div class="item"><i class="dropdown icon"></i>' + _localizedStringsService.LocalizedStrings.getUI('text_change');
  17988. context_menu += '<div class="menu">';
  17989. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.exp_op_exp + '">EXP OP EXP</div>';
  17990. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.op_exp + '">OP EXP</div>';
  17991. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.par_exp_par + '">( EXP )</div>';
  17992. context_menu += '</div></div>';
  17993. }
  17994. context_menu += '</div></div>';
  17995. context_menu = (0, _jquery2.default)(context_menu);
  17996. context_menu.insertAfter(dom_object.find('.parameters_function_called'));
  17997. context_menu.dropdown({
  17998. onChange: function onChange(value, text, $selectedItem) {
  17999. console.log('S1');
  18000. if ($selectedItem.data('clear')) {
  18001. console.log('PP1');
  18002. dom_object.text('');
  18003. variable_obj.content = null;
  18004. variable_obj.row = null;
  18005. variable_obj.column = null;
  18006. delete variable_obj.function_called;
  18007. delete variable_obj.parameters_list;
  18008. renderMenu(command, variable_obj, dom_object, function_obj, 2, expression_element);
  18009. }
  18010. if ($selectedItem.data('exp')) {
  18011. AttribuitionsManagement.manageExpressionElements(command, variable_obj, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  18012. }
  18013. }
  18014. });
  18015. } else {
  18016. menu_var_or_value.find('.text').text(' ');
  18017. dom_object.find('.menu_var_or_value_dom').remove();
  18018. var parameters_menu;
  18019. if (variable_obj.function_called.name) {
  18020. parameters_menu = '<div class="parameters_function_called"> ' + variable_obj.function_called.name + ' <span> ( </span>';
  18021. } else {
  18022. parameters_menu = '<div class="parameters_function_called"> <i>' + _localizedStringsService.LocalizedStrings.getUI(variable_obj.function_called.category) + '.' + _localizedStringsService.LocalizedStrings.getUI(variable_obj.function_called.identifier) + '</i> <span> ( </span>';
  18023. }
  18024. for (var j = 0; j < variable_obj.function_called.parameters_list.length; j++) {
  18025. parameters_menu += '<div class="render_style_param parameter_' + j + '"></div>';
  18026. if (j + 1 != variable_obj.function_called.parameters_list.length) {
  18027. parameters_menu += ' , ';
  18028. }
  18029. }
  18030. parameters_menu += '<span> ) </span></div>';
  18031. parameters_menu = (0, _jquery2.default)(parameters_menu);
  18032. dom_object.append(parameters_menu);
  18033. for (var j = 0; j < variable_obj.function_called.parameters_list.length; j++) {
  18034. renderMenu(command, variable_obj.parameters_list[j], parameters_menu.find('.parameter_' + j), function_obj, 2, expression_element);
  18035. }
  18036. var context_menu = '<div class="ui dropdown context_menu_clear"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
  18037. context_menu += '<div class="item" data-clear="true">' + _localizedStringsService.LocalizedStrings.getUI('btn_clear') + '</div>';
  18038. if (command.type == Models.COMMAND_TYPES.attribution) {
  18039. context_menu += '<div class="item"><i class="dropdown icon"></i>' + _localizedStringsService.LocalizedStrings.getUI('text_change');
  18040. context_menu += '<div class="menu">';
  18041. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.exp_op_exp + '">EXP OP EXP</div>';
  18042. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.op_exp + '">OP EXP</div>';
  18043. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.par_exp_par + '">( EXP )</div>';
  18044. context_menu += '</div></div>';
  18045. }
  18046. context_menu += '</div></div>';
  18047. context_menu = (0, _jquery2.default)(context_menu);
  18048. context_menu.insertAfter(parameters_menu);
  18049. context_menu.dropdown({
  18050. onChange: function onChange(value, text, $selectedItem) {
  18051. console.log('S2');
  18052. if ($selectedItem.data('clear')) {
  18053. console.log('PP2');
  18054. dom_object.text('');
  18055. variable_obj.content = null;
  18056. variable_obj.row = null;
  18057. variable_obj.column = null;
  18058. delete variable_obj.function_called;
  18059. delete variable_obj.parameters_list;
  18060. renderMenu(command, variable_obj, dom_object, function_obj, 2, expression_element);
  18061. }
  18062. if ($selectedItem.data('exp')) {
  18063. AttribuitionsManagement.manageExpressionElements(command, variable_obj, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  18064. }
  18065. }
  18066. });
  18067. }
  18068. } else if (variable_obj.content.type) {
  18069. var variable_render = "";
  18070. if (variable_obj.content.dimensions == 1) {
  18071. variable_render = '<div class="variable_rendered"> <span class="var_name">' + variable_obj.content.name + '</span>';
  18072. variable_render += ' <span>[ </span> <div class="column_container"></div> <span> ]</span>';
  18073. variable_render += '</div>';
  18074. variable_render = (0, _jquery2.default)(variable_render);
  18075. dom_object.append(variable_render);
  18076. var context_menu = '<div class="ui dropdown context_menu_clear"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
  18077. context_menu += '<div class="item" data-clear="true">' + _localizedStringsService.LocalizedStrings.getUI('btn_clear') + '</div>';
  18078. if (command.type == Models.COMMAND_TYPES.attribution) {
  18079. context_menu += '<div class="item"><i class="dropdown icon"></i>' + _localizedStringsService.LocalizedStrings.getUI('text_change');
  18080. context_menu += '<div class="menu">';
  18081. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.exp_op_exp + '">EXP OP EXP</div>';
  18082. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.op_exp + '">OP EXP</div>';
  18083. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.par_exp_par + '">( EXP )</div>';
  18084. context_menu += '</div></div>';
  18085. }
  18086. context_menu += '</div></div>';
  18087. context_menu = (0, _jquery2.default)(context_menu);
  18088. variable_render.append(context_menu);
  18089. context_menu.dropdown({
  18090. onChange: function onChange(value, text, $selectedItem) {
  18091. console.log('S3');
  18092. if ($selectedItem.data('clear')) {
  18093. console.log('PP3');
  18094. dom_object.text('');
  18095. variable_obj.content = null;
  18096. variable_obj.row = null;
  18097. variable_obj.column = null;
  18098. delete variable_obj.function_called;
  18099. delete variable_obj.parameters_list;
  18100. renderMenu(command, variable_obj, dom_object, function_obj, 2, expression_element);
  18101. }
  18102. if ($selectedItem.data('exp')) {
  18103. AttribuitionsManagement.manageExpressionElements(command, variable_obj, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  18104. }
  18105. }
  18106. });
  18107. if (!variable_obj.column) {
  18108. variable_obj.column = new Models.VariableValueMenu(VAR_OR_VALUE_TYPES.all, null, null, null, true);
  18109. }
  18110. variableValueMenuCode(command, variable_obj.column, (0, _jquery2.default)(variable_render.find('.column_container')), function_obj, menu_var_or_value, expression_element);
  18111. } else if (variable_obj.content.dimensions == 2) {
  18112. variable_render = '<div class="variable_rendered"> <span class="var_name">' + variable_obj.content.name + '</span>';
  18113. variable_render += ' <span>[ </span> <div class="row_container"></div> <span> ]</span>';
  18114. variable_render += ' <span>[ </span> <div class="column_container"></div> <span> ] </span>';
  18115. variable_render += '</div>';
  18116. variable_render = (0, _jquery2.default)(variable_render);
  18117. dom_object.append(variable_render);
  18118. var context_menu = '<div class="ui dropdown context_menu_clear"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
  18119. context_menu += '<div class="item" data-clear="true">' + _localizedStringsService.LocalizedStrings.getUI('btn_clear') + '</div>';
  18120. if (command.type == Models.COMMAND_TYPES.attribution) {
  18121. context_menu += '<div class="item"><i class="dropdown icon"></i>' + _localizedStringsService.LocalizedStrings.getUI('text_change');
  18122. context_menu += '<div class="menu">';
  18123. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.exp_op_exp + '">EXP OP EXP</div>';
  18124. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.op_exp + '">OP EXP</div>';
  18125. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.par_exp_par + '">( EXP )</div>';
  18126. context_menu += '</div></div>';
  18127. }
  18128. context_menu += '</div></div>';
  18129. context_menu = (0, _jquery2.default)(context_menu);
  18130. variable_render.append(context_menu);
  18131. context_menu.dropdown({
  18132. onChange: function onChange(value, text, $selectedItem) {
  18133. console.log('S4');
  18134. if ($selectedItem.data('clear')) {
  18135. console.log('PP4');
  18136. dom_object.text('');
  18137. variable_obj.content = null;
  18138. variable_obj.row = null;
  18139. variable_obj.column = null;
  18140. delete variable_obj.function_called;
  18141. delete variable_obj.parameters_list;
  18142. renderMenu(command, variable_obj, dom_object, function_obj, 2, expression_element);
  18143. }
  18144. if ($selectedItem.data('exp')) {
  18145. AttribuitionsManagement.manageExpressionElements(command, variable_obj, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  18146. }
  18147. }
  18148. });
  18149. if (!variable_obj.column) {
  18150. variable_obj.column = new Models.VariableValueMenu(VAR_OR_VALUE_TYPES.all, null, null, null, true);
  18151. }
  18152. if (!variable_obj.row) {
  18153. variable_obj.row = new Models.VariableValueMenu(VAR_OR_VALUE_TYPES.all, null, null, null, true);
  18154. }
  18155. variableValueMenuCode(command, variable_obj.row, (0, _jquery2.default)(variable_render.find('.row_container')), function_obj, menu_var_or_value, expression_element);
  18156. variableValueMenuCode(command, variable_obj.column, (0, _jquery2.default)(variable_render.find('.column_container')), function_obj, menu_var_or_value, expression_element);
  18157. } else {
  18158. variable_render = '<div class="variable_rendered"> <span class="var_name">' + variable_obj.content.name + '</span>';
  18159. variable_render += '</div>';
  18160. variable_render = (0, _jquery2.default)(variable_render);
  18161. dom_object.append(variable_render);
  18162. var context_menu = '<div class="ui dropdown context_menu_clear"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
  18163. context_menu += '<div class="item" data-clear="true">' + _localizedStringsService.LocalizedStrings.getUI('btn_clear') + '</div>';
  18164. if (command.type == Models.COMMAND_TYPES.attribution && !dom_object.hasClass('var_attributed')) {
  18165. console.log('dom_object6');
  18166. console.log(dom_object);
  18167. context_menu += '<div class="item"><i class="dropdown icon"></i>' + _localizedStringsService.LocalizedStrings.getUI('text_change');
  18168. context_menu += '<div class="menu">';
  18169. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.exp_op_exp + '">EXP OP EXP</div>';
  18170. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.op_exp + '">OP EXP</div>';
  18171. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.par_exp_par + '">( EXP )</div>';
  18172. context_menu += '</div></div>';
  18173. }
  18174. context_menu += '</div></div>';
  18175. context_menu = (0, _jquery2.default)(context_menu);
  18176. variable_render.append(context_menu);
  18177. context_menu.dropdown({
  18178. onChange: function onChange(value, text, $selectedItem) {
  18179. console.log('S5');
  18180. if ($selectedItem.data('clear')) {
  18181. console.log('PP5');
  18182. dom_object.text('');
  18183. variable_obj.content = null;
  18184. variable_obj.row = null;
  18185. variable_obj.column = null;
  18186. delete variable_obj.function_called;
  18187. delete variable_obj.parameters_list;
  18188. renderMenu(command, variable_obj, dom_object, function_obj, 2, expression_element);
  18189. }
  18190. if ($selectedItem.data('exp')) {
  18191. AttribuitionsManagement.manageExpressionElements(command, variable_obj, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  18192. }
  18193. }
  18194. });
  18195. }
  18196. } else {
  18197. var variable_render = '<div class="variable_rendered"> <span class="var_name">' + variable_obj.content + '</span>';
  18198. variable_render += '</div>';
  18199. variable_render = (0, _jquery2.default)(variable_render);
  18200. dom_object.append(variable_render);
  18201. var context_menu = '<div class="ui dropdown context_menu_clear"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
  18202. context_menu += '<div class="item" data-clear="true">' + _localizedStringsService.LocalizedStrings.getUI('btn_clear') + '</div>';
  18203. if (command.type == Models.COMMAND_TYPES.attribution) {
  18204. context_menu += '<div class="item"><i class="dropdown icon"></i>' + _localizedStringsService.LocalizedStrings.getUI('text_change');
  18205. context_menu += '<div class="menu">';
  18206. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.exp_op_exp + '">EXP OP EXP</div>';
  18207. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.op_exp + '">OP EXP</div>';
  18208. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.par_exp_par + '">( EXP )</div>';
  18209. context_menu += '</div></div>';
  18210. }
  18211. context_menu += '</div></div>';
  18212. context_menu = (0, _jquery2.default)(context_menu);
  18213. if (variable_obj.variable_and_value != VAR_OR_VALUE_TYPES.only_value) {
  18214. context_menu.insertAfter(variable_render);
  18215. }
  18216. context_menu.dropdown({
  18217. onChange: function onChange(value, text, $selectedItem) {
  18218. console.log('S6');
  18219. if ($selectedItem.data('clear')) {
  18220. console.log('PP6');
  18221. dom_object.text('');
  18222. variable_obj.content = null;
  18223. variable_obj.row = null;
  18224. variable_obj.column = null;
  18225. delete variable_obj.function_called;
  18226. delete variable_obj.parameters_list;
  18227. dom_object.find('.value_rendered').remove();
  18228. dom_object.find('.context_menu_clear').remove();
  18229. dom_object.find('.width-dynamic-minus').remove();
  18230. renderMenu(command, variable_obj, dom_object, function_obj, 2, expression_element);
  18231. }
  18232. if ($selectedItem.data('exp')) {
  18233. AttribuitionsManagement.manageExpressionElements(command, variable_obj, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  18234. }
  18235. }
  18236. });
  18237. variable_render.on('click', function (e) {
  18238. variable_render.remove();
  18239. variable_render.empty();
  18240. variable_render.remove();
  18241. dom_object.empty();
  18242. dom_object.append('<span class="menu_var_or_value_dom"> </span>');
  18243. openInputToValue(command, variable_obj, dom_object, menu_var_or_value, function_obj, expression_element);
  18244. });
  18245. }
  18246. }
  18247. function addIVProgFunctionsToMenu(function_obj, menu_var_or_value, ref_object, expression_element) {
  18248. var sub_menu = menu_var_or_value.find('.menu_only_functions');
  18249. sub_menu.append('<div class="divider"></div><div class="header">' + _localizedStringsService.LocalizedStrings.getUI('text_header_ivprog_functions') + '</div>');
  18250. sub_menu.append('<div class="item"><i class="dropdown icon"></i>' + _localizedStringsService.LocalizedStrings.getUI('text_menu_functions_math') + '<div class="menu menu_math_functions"></div></div>');
  18251. sub_menu.append('<div class="item"><i class="dropdown icon"></i>' + _localizedStringsService.LocalizedStrings.getUI('text_menu_functions_text') + '<div class="menu menu_text_functions"></div></div>');
  18252. sub_menu.append('<div class="item"><i class="dropdown icon"></i>' + _localizedStringsService.LocalizedStrings.getUI('text_menu_functions_arrangement') + '<div class="menu menu_arrangement_functions"></div></div>');
  18253. sub_menu.append('<div class="item"><i class="dropdown icon"></i>' + _localizedStringsService.LocalizedStrings.getUI('text_menu_functions_conversion') + '<div class="menu menu_conversion_functions"></div></div>');
  18254. // Insert Math functions:
  18255. for (var i = 0; i < window.system_functions.length; i++) {
  18256. var t = (0, _jquery2.default)('<div class="item"></div>');
  18257. t.data('function_reference', window.system_functions[i]);
  18258. t.data('option', VAR_OR_VALUE_TYPES.only_function);
  18259. t.text(_localizedStringsService.LocalizedStrings.getUI(window.system_functions[i].identifier));
  18260. switch (window.system_functions[i].category) {
  18261. case Models.SYSTEM_FUNCTIONS_CATEGORIES.math:
  18262. sub_menu.find('.menu_math_functions').append(t);
  18263. break;
  18264. case Models.SYSTEM_FUNCTIONS_CATEGORIES.text:
  18265. sub_menu.find('.menu_text_functions').append(t);
  18266. break;
  18267. case Models.SYSTEM_FUNCTIONS_CATEGORIES.arrangement:
  18268. sub_menu.find('.menu_arrangement_functions').append(t);
  18269. break;
  18270. case Models.SYSTEM_FUNCTIONS_CATEGORIES.conversion:
  18271. sub_menu.find('.menu_conversion_functions').append(t);
  18272. break;
  18273. }
  18274. }
  18275. }
  18276. function addFunctionsToMenu(function_obj, menu_var_or_value, ref_object, expression_element) {
  18277. var sub_menu = menu_var_or_value.find('.menu_only_functions');
  18278. sub_menu.text('');
  18279. for (var i = 0; i < window.program_obj.functions.length; i++) {
  18280. var temp = (0, _jquery2.default)('<div class="item" data-option="' + VAR_OR_VALUE_TYPES.only_function + '">' + window.program_obj.functions[i].name + ' </div>');
  18281. temp.data('function_reference', window.program_obj.functions[i]);
  18282. sub_menu.append(temp);
  18283. }
  18284. }
  18285. function addVariablesToMenu(function_obj, menu_var_or_value, ref_object, expression_element) {
  18286. var sub_menu = menu_var_or_value.find('.menu_only_vars');
  18287. sub_menu.text('');
  18288. var is_there = false;
  18289. if (window.program_obj.globals) {
  18290. if (ref_object.include_constant) {
  18291. for (var i = 0; i < window.program_obj.globals.length; i++) {
  18292. var temp = (0, _jquery2.default)('<div class="item" data-option="' + VAR_OR_VALUE_TYPES.only_variable + '">' + window.program_obj.globals[i].name + ' </div>');
  18293. temp.data('variable_reference', window.program_obj.globals[i]);
  18294. sub_menu.append(temp);
  18295. is_there = true;
  18296. }
  18297. } else {
  18298. for (var i = 0; i < window.program_obj.globals.length; i++) {
  18299. if (!window.program_obj.globals[i].is_constant) {
  18300. var temp = (0, _jquery2.default)('<div class="item" data-option="' + VAR_OR_VALUE_TYPES.only_variable + '">' + window.program_obj.globals[i].name + ' </div>');
  18301. temp.data('variable_reference', window.program_obj.globals[i]);
  18302. sub_menu.append(temp);
  18303. is_there = true;
  18304. }
  18305. }
  18306. }
  18307. }
  18308. if (function_obj.parameters_list) {
  18309. for (var i = 0; i < function_obj.parameters_list.length; i++) {
  18310. var temp = (0, _jquery2.default)('<div class="item" data-option="' + VAR_OR_VALUE_TYPES.only_variable + '">' + function_obj.parameters_list[i].name + ' </div>');
  18311. temp.data('variable_reference', function_obj.parameters_list[i]);
  18312. sub_menu.append(temp);
  18313. is_there = true;
  18314. }
  18315. }
  18316. if (function_obj.variables_list) {
  18317. for (var i = 0; i < function_obj.variables_list.length; i++) {
  18318. var temp = (0, _jquery2.default)('<div class="item" data-option="' + VAR_OR_VALUE_TYPES.only_variable + '">' + function_obj.variables_list[i].name + ' </div>');
  18319. temp.data('variable_reference', function_obj.variables_list[i]);
  18320. sub_menu.append(temp);
  18321. is_there = true;
  18322. }
  18323. }
  18324. if (!is_there) {
  18325. sub_menu.append((0, _jquery2.default)('<div class="header">' + _localizedStringsService.LocalizedStrings.getUI('text_none_variable') + '</div>'));
  18326. sub_menu.append((0, _jquery2.default)('<div class="item disabled">' + _localizedStringsService.LocalizedStrings.getUI('text_none_variable_instruction') + '</div>'));
  18327. }
  18328. }
  18329. function addHandlers(command, ref_object, dom_object, menu_var_or_value, function_obj, expression_element) {
  18330. if (ref_object.variable_and_value != VAR_OR_VALUE_TYPES.only_value) {
  18331. menu_var_or_value.dropdown({
  18332. onChange: function onChange(value, text, $selectedItem) {
  18333. console.log('S7');
  18334. dom_object.find('.var_name').remove();
  18335. switch ($selectedItem.data('option')) {
  18336. case VAR_OR_VALUE_TYPES.only_function:
  18337. openInputToFunction(command, ref_object, dom_object, menu_var_or_value, function_obj, (0, _jquery2.default)($selectedItem).data('function_reference'), expression_element);
  18338. break;
  18339. case VAR_OR_VALUE_TYPES.only_value:
  18340. openInputToValue(command, ref_object, dom_object, menu_var_or_value, function_obj, expression_element);
  18341. break;
  18342. case VAR_OR_VALUE_TYPES.only_variable:
  18343. openInputToVariable(command, ref_object, dom_object, menu_var_or_value, function_obj, (0, _jquery2.default)($selectedItem).data('variable_reference'), expression_element);
  18344. break;
  18345. }
  18346. if ($selectedItem.data('exp')) {
  18347. AttribuitionsManagement.manageExpressionElements(command, ref_object, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  18348. }
  18349. if (command.type == Models.COMMAND_TYPES.repeatNtimes) {
  18350. RepeatNTimesManagement.manageExpressionElements(command, ref_object, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  18351. }
  18352. }
  18353. });
  18354. }
  18355. dom_object.find('.width-dynamic').on('input', function () {
  18356. var inputWidth = (0, _jquery2.default)(this).textWidth() + 10;
  18357. (0, _jquery2.default)(this).focus();
  18358. var tmpStr = (0, _jquery2.default)(this).val();
  18359. (0, _jquery2.default)(this).val('');
  18360. (0, _jquery2.default)(this).val(tmpStr);
  18361. (0, _jquery2.default)(this).css({
  18362. width: inputWidth
  18363. });
  18364. }).trigger('input');
  18365. if (command.type == Models.COMMAND_TYPES.comment) {
  18366. dom_object.parent().on('click', function (e) {
  18367. dom_object.find('.value_rendered').remove();
  18368. dom_object.find('.value_rendered').empty();
  18369. dom_object.find('.value_rendered').remove();
  18370. dom_object.empty();
  18371. dom_object.append('<span class="menu_var_or_value_dom"> </span>');
  18372. openInputToValue(command, ref_object, dom_object, menu_var_or_value, function_obj, expression_element);
  18373. });
  18374. }
  18375. }
  18376. function openInputToFunction(command, ref_object, dom_object, menu_var_or_value, function_obj, function_selected, expression_element) {
  18377. ref_object.function_called = function_selected;
  18378. ref_object.parameters_list = [];
  18379. if (function_selected.parameters_list != null && function_selected.parameters_list.length > 0) {
  18380. menu_var_or_value.find('.text').text(' ');
  18381. dom_object.find('.menu_var_or_value_dom').remove();
  18382. var parameters_menu;
  18383. if (function_selected.name) {
  18384. parameters_menu = '<div class="parameters_function_called"> ' + function_selected.name + ' <span> ( </span>';
  18385. } else {
  18386. parameters_menu = '<div class="parameters_function_called"> <i>' + _localizedStringsService.LocalizedStrings.getUI(function_selected.category) + '.' + _localizedStringsService.LocalizedStrings.getUI(function_selected.identifier) + '</i> <span> ( </span>';
  18387. }
  18388. for (var j = 0; j < function_selected.parameters_list.length; j++) {
  18389. parameters_menu += '<div class="render_style_param parameter_' + j + '"></div>';
  18390. if (j + 1 != function_selected.parameters_list.length) {
  18391. parameters_menu += ' , ';
  18392. }
  18393. }
  18394. parameters_menu += '<span> ) </span></div>';
  18395. parameters_menu = (0, _jquery2.default)(parameters_menu);
  18396. dom_object.append(parameters_menu);
  18397. for (var j = 0; j < function_selected.parameters_list.length; j++) {
  18398. var temp = new Models.VariableValueMenu(VAR_OR_VALUE_TYPES.all, null, null, null, true);
  18399. ref_object.parameters_list.push(temp);
  18400. renderMenu(command, temp, parameters_menu.find('.parameter_' + j), function_obj, 2, expression_element);
  18401. }
  18402. var context_menu = '<div class="ui dropdown context_menu_clear"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
  18403. context_menu += '<div class="item" data-clear="true">' + _localizedStringsService.LocalizedStrings.getUI('btn_clear') + '</div>';
  18404. if (command.type == Models.COMMAND_TYPES.attribution) {
  18405. context_menu += '<div class="item"><i class="dropdown icon"></i>' + _localizedStringsService.LocalizedStrings.getUI('text_change');
  18406. context_menu += '<div class="menu">';
  18407. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.exp_op_exp + '">EXP OP EXP</div>';
  18408. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.op_exp + '">OP EXP</div>';
  18409. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.par_exp_par + '">( EXP )</div>';
  18410. context_menu += '</div></div>';
  18411. }
  18412. context_menu += '</div></div>';
  18413. context_menu = (0, _jquery2.default)(context_menu);
  18414. context_menu.insertAfter(dom_object.find('.parameters_function_called'));
  18415. context_menu.dropdown({
  18416. onChange: function onChange(value, text, $selectedItem) {
  18417. console.log('S8');
  18418. if ($selectedItem.data('clear')) {
  18419. console.log('PP7');
  18420. dom_object.text('');
  18421. ref_object.content = null;
  18422. ref_object.row = null;
  18423. ref_object.column = null;
  18424. delete ref_object.function_called;
  18425. delete ref_object.parameters_list;
  18426. renderMenu(command, ref_object, dom_object, function_obj, 2, expression_element);
  18427. }
  18428. if ($selectedItem.data('exp')) {
  18429. AttribuitionsManagement.manageExpressionElements(command, ref_object, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  18430. }
  18431. }
  18432. });
  18433. } else {
  18434. menu_var_or_value.find('.text').text(' ');
  18435. dom_object.find('.menu_var_or_value_dom').remove();
  18436. var parameters_menu;
  18437. if (function_selected.name) {
  18438. parameters_menu = '<div class="parameters_function_called"> ' + function_selected.name + ' <span> ( </span>';
  18439. } else {
  18440. parameters_menu = '<div class="parameters_function_called"> <i>' + _localizedStringsService.LocalizedStrings.getUI(function_selected.category) + '.' + _localizedStringsService.LocalizedStrings.getUI(function_selected.identifier) + '</i> <span> ( </span>';
  18441. }
  18442. parameters_menu += '<span> ) </span></div>';
  18443. parameters_menu = (0, _jquery2.default)(parameters_menu);
  18444. dom_object.append(parameters_menu);
  18445. var context_menu = '<div class="ui dropdown context_menu_clear"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
  18446. context_menu += '<div class="item" data-clear="true">' + _localizedStringsService.LocalizedStrings.getUI('btn_clear') + '</div>';
  18447. if (command.type == Models.COMMAND_TYPES.attribution) {
  18448. context_menu += '<div class="item"><i class="dropdown icon"></i>' + _localizedStringsService.LocalizedStrings.getUI('text_change');
  18449. context_menu += '<div class="menu">';
  18450. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.exp_op_exp + '">EXP OP EXP</div>';
  18451. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.op_exp + '">OP EXP</div>';
  18452. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.par_exp_par + '">( EXP )</div>';
  18453. context_menu += '</div></div>';
  18454. }
  18455. context_menu += '</div></div>';
  18456. context_menu = (0, _jquery2.default)(context_menu);
  18457. context_menu.insertAfter(dom_object.find('.parameters_function_called'));
  18458. context_menu.dropdown({
  18459. onChange: function onChange(value, text, $selectedItem) {
  18460. console.log('S9');
  18461. if ($selectedItem.data('clear')) {
  18462. console.log('PP8');
  18463. dom_object.text('');
  18464. ref_object.content = null;
  18465. ref_object.row = null;
  18466. ref_object.column = null;
  18467. delete ref_object.function_called;
  18468. delete ref_object.parameters_list;
  18469. renderMenu(command, ref_object, dom_object, function_obj, 2, expression_element);
  18470. }
  18471. if ($selectedItem.data('exp')) {
  18472. AttribuitionsManagement.manageExpressionElements(command, ref_object, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  18473. }
  18474. }
  18475. });
  18476. }
  18477. if (command.type == Models.COMMAND_TYPES.attribution) {
  18478. AttribuitionsManagement.renderMenuOperations(command, ref_object, dom_object, menu_var_or_value, function_obj);
  18479. }
  18480. }
  18481. function openInputToVariable(command, ref_object, dom_object, menu_var_or_value, function_obj, variable_selected, expression_element) {
  18482. ref_object.content = variable_selected;
  18483. menu_var_or_value.find('.text').text(' ');
  18484. dom_object.find('.menu_var_or_value_dom').remove();
  18485. var variable_render = '<div class="variable_rendered"> <span class="var_name">' + variable_selected.name + '</span>';
  18486. if (variable_selected.dimensions == 1) {
  18487. variable_render += ' <span>[ </span> <div class="column_container"></div> <span> ]</span>';
  18488. }
  18489. if (variable_selected.dimensions == 2) {
  18490. variable_render += ' <span>[ </span> <div class="row_container"></div> <span> ]</span> ';
  18491. variable_render += ' <span>[ </span> <div class="column_container"></div> <span> ]</span>';
  18492. }
  18493. variable_render += '</div>';
  18494. variable_render = (0, _jquery2.default)(variable_render);
  18495. dom_object.append(variable_render);
  18496. if (variable_selected.dimensions == 1) {
  18497. ref_object.column = new Models.VariableValueMenu(VAR_OR_VALUE_TYPES.all, null, null, null, true);
  18498. renderMenu(command, ref_object.column, variable_render.find('.column_container'), function_obj, 2, expression_element);
  18499. }
  18500. if (variable_selected.dimensions == 2) {
  18501. ref_object.row = new Models.VariableValueMenu(VAR_OR_VALUE_TYPES.all, null, null, null, true);
  18502. renderMenu(command, ref_object.row, variable_render.find('.row_container'), function_obj, 2, expression_element);
  18503. ref_object.column = new Models.VariableValueMenu(VAR_OR_VALUE_TYPES.all, null, null, null, true);
  18504. renderMenu(command, ref_object.column, variable_render.find('.column_container'), function_obj, 2, expression_element);
  18505. }
  18506. var context_menu = '<div class="ui dropdown context_menu_clear"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
  18507. context_menu += '<div class="item" data-clear="true">' + _localizedStringsService.LocalizedStrings.getUI('btn_clear') + '</div>';
  18508. if (command.type == Models.COMMAND_TYPES.attribution && !dom_object.hasClass('var_attributed')) {
  18509. console.log("dom_object 10: ");
  18510. console.log(dom_object);
  18511. context_menu += '<div class="item"><i class="dropdown icon"></i>' + _localizedStringsService.LocalizedStrings.getUI('text_change');
  18512. context_menu += '<div class="menu">';
  18513. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.exp_op_exp + '">EXP OP EXP</div>';
  18514. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.op_exp + '">OP EXP</div>';
  18515. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.par_exp_par + '">( EXP )</div>';
  18516. context_menu += '</div></div>';
  18517. }
  18518. context_menu += '</div></div>';
  18519. context_menu = (0, _jquery2.default)(context_menu);
  18520. context_menu.insertAfter(dom_object.find('.variable_rendered'));
  18521. context_menu.dropdown({
  18522. onChange: function onChange(value, text, $selectedItem) {
  18523. console.log('S10');
  18524. if ($selectedItem.data('clear')) {
  18525. console.log('PP9');
  18526. dom_object.text('');
  18527. ref_object.content = null;
  18528. ref_object.row = null;
  18529. ref_object.column = null;
  18530. delete ref_object.function_called;
  18531. delete ref_object.parameters_list;
  18532. renderMenu(command, ref_object, dom_object, function_obj, 2, expression_element);
  18533. }
  18534. if ($selectedItem.data('exp')) {
  18535. AttribuitionsManagement.manageExpressionElements(command, ref_object, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  18536. }
  18537. if (command.type == Models.COMMAND_TYPES.repeatNtimes) {
  18538. RepeatNTimesManagement.manageClearExpressionElements(command, ref_object, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  18539. }
  18540. }
  18541. });
  18542. if (command.type == Models.COMMAND_TYPES.attribution) {
  18543. AttribuitionsManagement.renderMenuOperations(command, ref_object, dom_object, menu_var_or_value, function_obj, variable_selected);
  18544. }
  18545. }
  18546. function openInputToValue(command, ref_object, dom_object, menu_var_or_value, function_obj, expression_element) {
  18547. if (ref_object.content == null) {
  18548. ref_object.content = "";
  18549. }
  18550. menu_var_or_value.find('.text').text(' ');
  18551. var field = (0, _jquery2.default)('<input type="text" size="2" class="width-dynamic-minus" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" />');
  18552. field.insertBefore(dom_object.find('.menu_var_or_value_dom'));
  18553. var rendered = (0, _jquery2.default)('<div class="value_rendered"></div>');
  18554. rendered.insertBefore(field);
  18555. field.focus();
  18556. field.val(ref_object.content);
  18557. var context_menu = '<div class="ui dropdown context_menu_clear"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
  18558. context_menu += '<div class="item" data-clear="true">' + _localizedStringsService.LocalizedStrings.getUI('btn_clear') + '</div>';
  18559. if (command.type == Models.COMMAND_TYPES.attribution) {
  18560. context_menu += '<div class="item"><i class="dropdown icon"></i>' + _localizedStringsService.LocalizedStrings.getUI('text_change');
  18561. context_menu += '<div class="menu">';
  18562. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.exp_op_exp + '">EXP OP EXP</div>';
  18563. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.op_exp + '">OP EXP</div>';
  18564. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.par_exp_par + '">( EXP )</div>';
  18565. context_menu += '</div></div>';
  18566. }
  18567. context_menu += '</div></div>';
  18568. context_menu = (0, _jquery2.default)(context_menu);
  18569. dom_object.find('.menu_var_or_value_dom').remove();
  18570. if (ref_object.variable_and_value != VAR_OR_VALUE_TYPES.only_value) {
  18571. context_menu.insertAfter(field);
  18572. }
  18573. context_menu.dropdown({
  18574. onChange: function onChange(value, text, $selectedItem) {
  18575. console.log('S11');
  18576. if ($selectedItem.data('clear')) {
  18577. console.log('PP10');
  18578. dom_object.text('');
  18579. dom_object.find('.value_rendered').remove();
  18580. dom_object.find('.context_menu_clear').remove();
  18581. dom_object.find('.width-dynamic-minus').remove();
  18582. ref_object.content = null;
  18583. ref_object.row = null;
  18584. ref_object.column = null;
  18585. delete ref_object.function_called;
  18586. delete ref_object.parameters_list;
  18587. renderMenu(command, ref_object, dom_object, function_obj, 2, expression_element);
  18588. }
  18589. if ($selectedItem.data('exp')) {
  18590. AttribuitionsManagement.manageExpressionElements(command, ref_object, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  18591. }
  18592. }
  18593. });
  18594. dom_object.find('.width-dynamic-minus').focusout(function () {
  18595. if ((0, _jquery2.default)(this).val().trim()) {
  18596. ref_object.content = (0, _jquery2.default)(this).val().trim();
  18597. }
  18598. rendered.text(ref_object.content);
  18599. (0, _jquery2.default)(this).remove();
  18600. });
  18601. dom_object.find('.width-dynamic-minus').on('keydown', function (e) {
  18602. var code = e.keyCode || e.which;
  18603. if (code == 13) {
  18604. if ((0, _jquery2.default)(this).val().trim()) {
  18605. ref_object.content = (0, _jquery2.default)(this).val().trim();
  18606. }
  18607. rendered.text(ref_object.content);
  18608. (0, _jquery2.default)(this).remove();
  18609. }
  18610. if (code == 27) {
  18611. rendered.text(ref_object.content);
  18612. (0, _jquery2.default)(this).remove();
  18613. }
  18614. });
  18615. if (command.type == Models.COMMAND_TYPES.comment) {
  18616. rendered.parent().on('click', function (e) {
  18617. console.log("TTT14");
  18618. rendered.remove();
  18619. rendered.empty();
  18620. rendered.remove();
  18621. dom_object.empty();
  18622. dom_object.append('<span class="menu_var_or_value_dom"> </span>');
  18623. openInputToValue(command, ref_object, dom_object, menu_var_or_value, function_obj, expression_element);
  18624. });
  18625. }
  18626. rendered.on('click', function (e) {
  18627. console.log("TTT2");
  18628. rendered.remove();
  18629. rendered.empty();
  18630. rendered.remove();
  18631. dom_object.empty();
  18632. dom_object.append('<span class="menu_var_or_value_dom"> </span>');
  18633. openInputToValue(command, ref_object, dom_object, menu_var_or_value, function_obj, expression_element);
  18634. });
  18635. if (command.type == Models.COMMAND_TYPES.attribution) {
  18636. AttribuitionsManagement.renderMenuOperations(command, ref_object, dom_object, menu_var_or_value, function_obj);
  18637. }
  18638. }
  18639. _jquery2.default.fn.textWidth = function (text, font) {
  18640. if (!_jquery2.default.fn.textWidth.fakeEl) _jquery2.default.fn.textWidth.fakeEl = (0, _jquery2.default)('<span>').hide().appendTo(document.body);
  18641. _jquery2.default.fn.textWidth.fakeEl.text(text || this.val() || this.text() || this.attr('placeholder')).css('font', font || this.css('font'));
  18642. return _jquery2.default.fn.textWidth.fakeEl.width();
  18643. };
  18644. /***/ }),
  18645. /***/ "./js/visualUI/commands/whiletrue.js":
  18646. /*!*******************************************!*\
  18647. !*** ./js/visualUI/commands/whiletrue.js ***!
  18648. \*******************************************/
  18649. /*! no static exports found */
  18650. /***/ (function(module, exports, __webpack_require__) {
  18651. "use strict";
  18652. Object.defineProperty(exports, "__esModule", {
  18653. value: true
  18654. });
  18655. exports.createFloatingCommand = createFloatingCommand;
  18656. exports.renderCommand = renderCommand;
  18657. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  18658. var _jquery2 = _interopRequireDefault(_jquery);
  18659. var _types = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  18660. var _ivprog_elements = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  18661. var Models = _interopRequireWildcard(_ivprog_elements);
  18662. var _localizedStringsService = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  18663. var _globals = __webpack_require__(/*! ../globals */ "./js/visualUI/globals.js");
  18664. var GlobalsManagement = _interopRequireWildcard(_globals);
  18665. var _variables = __webpack_require__(/*! ../variables */ "./js/visualUI/variables.js");
  18666. var VariablesManagement = _interopRequireWildcard(_variables);
  18667. var _commands = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  18668. var CommandsManagement = _interopRequireWildcard(_commands);
  18669. var _conditional_expression = __webpack_require__(/*! ./conditional_expression */ "./js/visualUI/commands/conditional_expression.js");
  18670. var ConditionalExpressionManagement = _interopRequireWildcard(_conditional_expression);
  18671. var _contextualized_menu = __webpack_require__(/*! ./contextualized_menu */ "./js/visualUI/commands/contextualized_menu.js");
  18672. var ContextualizedMenu = _interopRequireWildcard(_contextualized_menu);
  18673. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  18674. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  18675. function createFloatingCommand() {
  18676. return (0, _jquery2.default)('<div class="ui whiletrue created_element"> <i class="ui icon small sync"></i> <span> ' + _localizedStringsService.LocalizedStrings.getUI('text_code_while') + ' ( x < 10 ) { } </span></div>');
  18677. }
  18678. function renderCommand(command, function_obj) {
  18679. var ret = '';
  18680. ret += '<div class="ui whiletrue command_container"> <i class="ui icon small random command_drag"></i> <i class="ui icon times red button_remove_command"></i> <div class="ui context_menu"></div> <span class="span_command_spec"> ' + _localizedStringsService.LocalizedStrings.getUI('text_code_while') + ' </span>';
  18681. ret += '<span class="span_command_spec"> ( </span> <div class="conditional_expression"></div> <span class="span_command_spec"> ) </span>';
  18682. ret += ' </span>';
  18683. ret += '<div class="ui block_commands">';
  18684. ret += '</div>';
  18685. ret += '<span> </span>';
  18686. ret += '</div>';
  18687. var el = (0, _jquery2.default)(ret);
  18688. el.data('command', command);
  18689. addHandlers(command, function_obj, el);
  18690. ContextualizedMenu.renderMenu(command, el.find('.context_menu'), function_obj, el);
  18691. ConditionalExpressionManagement.renderExpression(command, command.expression, function_obj, el.find('.conditional_expression'));
  18692. if (command.commands_block) {
  18693. for (var j = 0; j < command.commands_block.length; j++) {
  18694. CommandsManagement.renderCommand(command.commands_block[j], (0, _jquery2.default)(el.find('.block_commands')[0]), 3, function_obj);
  18695. }
  18696. }
  18697. return el;
  18698. }
  18699. function addHandlers(command, function_obj, whiletrue_dom) {
  18700. whiletrue_dom.find('.button_remove_command').on('click', function () {
  18701. if (CommandsManagement.removeCommand(command, function_obj, whiletrue_dom)) {
  18702. whiletrue_dom.fadeOut();
  18703. }
  18704. });
  18705. }
  18706. /***/ }),
  18707. /***/ "./js/visualUI/commands/writer.js":
  18708. /*!****************************************!*\
  18709. !*** ./js/visualUI/commands/writer.js ***!
  18710. \****************************************/
  18711. /*! no static exports found */
  18712. /***/ (function(module, exports, __webpack_require__) {
  18713. "use strict";
  18714. Object.defineProperty(exports, "__esModule", {
  18715. value: true
  18716. });
  18717. exports.createFloatingCommand = createFloatingCommand;
  18718. exports.renderCommand = renderCommand;
  18719. exports.addContent = addContent;
  18720. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  18721. var _jquery2 = _interopRequireDefault(_jquery);
  18722. var _types = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  18723. var _ivprog_elements = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  18724. var Models = _interopRequireWildcard(_ivprog_elements);
  18725. var _localizedStringsService = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  18726. var _globals = __webpack_require__(/*! ../globals */ "./js/visualUI/globals.js");
  18727. var GlobalsManagement = _interopRequireWildcard(_globals);
  18728. var _variables = __webpack_require__(/*! ../variables */ "./js/visualUI/variables.js");
  18729. var VariablesManagement = _interopRequireWildcard(_variables);
  18730. var _variable_value_menu = __webpack_require__(/*! ./variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  18731. var VariableValueMenu = _interopRequireWildcard(_variable_value_menu);
  18732. var VariableValueMenuManagement = _interopRequireWildcard(_variable_value_menu);
  18733. var _commands = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  18734. var CommandsManagement = _interopRequireWildcard(_commands);
  18735. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  18736. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  18737. function createFloatingCommand() {
  18738. return (0, _jquery2.default)('<div class="ui writer created_element"> <i class="ui icon small upload"></i> <span> ' + _localizedStringsService.LocalizedStrings.getUI('text_command_write') + ' var </span></div>');
  18739. }
  18740. function renderCommand(command, function_obj) {
  18741. var ret = '';
  18742. ret += '<div class="ui writer command_container"> <i class="ui icon small upload command_drag"></i> <i class="ui icon times red button_remove_command"></i> <span class="span_command_spec">' + _localizedStringsService.LocalizedStrings.getUI('text_command_write') + ' ( </span><div class="all_elements_write"></div> <span class="close_parentheses span_command_spec">)</span> </div>';
  18743. var el = (0, _jquery2.default)(ret);
  18744. el.data('command', command);
  18745. for (var i = 0; i < command.content.length; i++) {
  18746. var new_div_item = (0, _jquery2.default)('<div class="var_value_menu_div"></div>');
  18747. el.find('.all_elements_write').append(new_div_item);
  18748. VariableValueMenu.renderMenu(command, command.content[i], new_div_item, function_obj);
  18749. addHandlerIconAdd(el.find('.all_elements_write'), command, function_obj);
  18750. }
  18751. addHandlers(command, function_obj, el);
  18752. return el;
  18753. }
  18754. function addHandlers(command, function_obj, writer_dom) {
  18755. writer_dom.find('.button_remove_command').on('click', function () {
  18756. if (CommandsManagement.removeCommand(command, function_obj, writer_dom)) {
  18757. writer_dom.fadeOut();
  18758. }
  18759. });
  18760. }
  18761. function addHandlerIconAdd(dom_object, command, function_obj) {
  18762. var insert_after = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
  18763. var after_which = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : null;
  18764. var icon_add_item = (0, _jquery2.default)('<i class="ui icon plus square outline icon_add_item_to_writer"></i> ');
  18765. if (!insert_after) {
  18766. dom_object.append(icon_add_item);
  18767. } else {
  18768. icon_add_item.insertAfter(after_which);
  18769. }
  18770. icon_add_item.on('click', function (e) {
  18771. var new_div_item = (0, _jquery2.default)('<div class="var_value_menu_div" style="display:none;"></div>');
  18772. new_div_item.insertAfter(icon_add_item);
  18773. var new_related_menu = new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all, null, null, null, true);
  18774. VariableValueMenu.renderMenu(command, new_related_menu, new_div_item, function_obj);
  18775. addHandlerIconAdd(dom_object, command, function_obj, true, new_div_item);
  18776. var pos = 1;
  18777. dom_object.find('.icon_add_item_to_writer').each(function () {
  18778. if ((0, _jquery2.default)(this).get(0) === icon_add_item.get(0)) {
  18779. command.content.splice(pos, 0, new_related_menu);
  18780. } else {
  18781. pos++;
  18782. }
  18783. });
  18784. new_div_item.fadeIn();
  18785. });
  18786. }
  18787. function addContent(command, ref_object, dom_object, menu_var_or_value, function_obj, ref_object_content) {
  18788. if (dom_object.hasClass('var_value_menu_div')) {
  18789. var icon_add_item = (0, _jquery2.default)('<i class="ui icon plus square outline icon_add_item_to_writer"></i> ');
  18790. icon_add_item.insertAfter(dom_object);
  18791. icon_add_item.on('click', function (e) {
  18792. var new_div_item = (0, _jquery2.default)('<div class="var_value_menu_div"></div>');
  18793. new_div_item.insertAfter(icon_add_item);
  18794. var new_related_menu = new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all, null, null, null, true);
  18795. VariableValueMenu.renderMenu(command, new_related_menu, new_div_item, function_obj);
  18796. command.content.push(new_related_menu);
  18797. });
  18798. }
  18799. }
  18800. /***/ }),
  18801. /***/ "./js/visualUI/functions.js":
  18802. /*!**********************************!*\
  18803. !*** ./js/visualUI/functions.js ***!
  18804. \**********************************/
  18805. /*! no static exports found */
  18806. /***/ (function(module, exports, __webpack_require__) {
  18807. "use strict";
  18808. Object.defineProperty(exports, "__esModule", {
  18809. value: true
  18810. });
  18811. exports.renderFunction = renderFunction;
  18812. exports.initVisualUI = initVisualUI;
  18813. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  18814. var _jquery2 = _interopRequireDefault(_jquery);
  18815. var _types = __webpack_require__(/*! ./types */ "./js/visualUI/types.js");
  18816. var _ivprog_elements = __webpack_require__(/*! ./ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  18817. var Models = _interopRequireWildcard(_ivprog_elements);
  18818. var _localizedStringsService = __webpack_require__(/*! ./../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  18819. var _globals = __webpack_require__(/*! ./globals */ "./js/visualUI/globals.js");
  18820. var GlobalsManagement = _interopRequireWildcard(_globals);
  18821. var _variables = __webpack_require__(/*! ./variables */ "./js/visualUI/variables.js");
  18822. var VariablesManagement = _interopRequireWildcard(_variables);
  18823. var _commands = __webpack_require__(/*! ./commands */ "./js/visualUI/commands.js");
  18824. var CommandsManagement = _interopRequireWildcard(_commands);
  18825. var _code_generator = __webpack_require__(/*! ./code_generator */ "./js/visualUI/code_generator.js");
  18826. var CodeManagement = _interopRequireWildcard(_code_generator);
  18827. var _variable_value_menu = __webpack_require__(/*! ./commands/variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  18828. var VariableValueMenu = _interopRequireWildcard(_variable_value_menu);
  18829. var _domConsole = __webpack_require__(/*! ./../io/domConsole */ "./js/io/domConsole.js");
  18830. var _ivprogParser = __webpack_require__(/*! ./../ast/ivprogParser */ "./js/ast/ivprogParser.js");
  18831. var _ivprogProcessor = __webpack_require__(/*! ./../processor/ivprogProcessor */ "./js/processor/ivprogProcessor.js");
  18832. var _melankeWatchjs = __webpack_require__(/*! melanke-watchjs */ "./node_modules/melanke-watchjs/src/watch.js");
  18833. var _melankeWatchjs2 = _interopRequireDefault(_melankeWatchjs);
  18834. var _semanticAnalyser = __webpack_require__(/*! ../processor/semantic/semanticAnalyser */ "./js/processor/semantic/semanticAnalyser.js");
  18835. var _ivprogAssessment = __webpack_require__(/*! ../assessment/ivprogAssessment */ "./js/assessment/ivprogAssessment.js");
  18836. var _algorithm = __webpack_require__(/*! ./algorithm */ "./js/visualUI/algorithm.js");
  18837. var AlgorithmManagement = _interopRequireWildcard(_algorithm);
  18838. __webpack_require__(/*! ../Sortable.js */ "./js/Sortable.js");
  18839. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  18840. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  18841. var counter_new_functions = 0;
  18842. var counter_new_parameters = 0;
  18843. var studentTemp = null;
  18844. var domConsole = null;
  18845. window.studentGrade = null;
  18846. window.LocalizedStrings = _localizedStringsService.LocalizedStrings;
  18847. var program = new Models.Program();
  18848. window.system_functions = [];
  18849. // Adding math functions:
  18850. window.system_functions.push(new Models.SystemFunction('$sin', _types.Types.REAL, 0, [new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.all, null, null, null, true)], null, Models.SYSTEM_FUNCTIONS_CATEGORIES.math));
  18851. window.system_functions.push(new Models.SystemFunction('$cos', _types.Types.REAL, 0, [new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.all, null, null, null, true)], null, Models.SYSTEM_FUNCTIONS_CATEGORIES.math));
  18852. window.system_functions.push(new Models.SystemFunction('$tan', _types.Types.REAL, 0, [new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.all, null, null, null, true)], null, Models.SYSTEM_FUNCTIONS_CATEGORIES.math));
  18853. window.system_functions.push(new Models.SystemFunction('$sqrt', _types.Types.REAL, 0, [new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.all, null, null, null, true)], null, Models.SYSTEM_FUNCTIONS_CATEGORIES.math));
  18854. window.system_functions.push(new Models.SystemFunction('$pow', _types.Types.REAL, 0, [new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.all, null, null, null, true), new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.all, null, null, null, true)], null, Models.SYSTEM_FUNCTIONS_CATEGORIES.math));
  18855. window.system_functions.push(new Models.SystemFunction('$log', _types.Types.REAL, 0, [new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.all, null, null, null, true)], null, Models.SYSTEM_FUNCTIONS_CATEGORIES.math));
  18856. window.system_functions.push(new Models.SystemFunction('$abs', _types.Types.REAL, 0, [new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.all, null, null, null, true)], null, Models.SYSTEM_FUNCTIONS_CATEGORIES.math));
  18857. window.system_functions.push(new Models.SystemFunction('$negate', _types.Types.REAL, 0, [new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.all, null, null, null, true)], null, Models.SYSTEM_FUNCTIONS_CATEGORIES.math));
  18858. window.system_functions.push(new Models.SystemFunction('$invert', _types.Types.REAL, 0, [new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.all, null, null, null, true)], null, Models.SYSTEM_FUNCTIONS_CATEGORIES.math));
  18859. window.system_functions.push(new Models.SystemFunction('$max', _types.Types.REAL, 0, [new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.all, null, null, null, true)], null, Models.SYSTEM_FUNCTIONS_CATEGORIES.math));
  18860. window.system_functions.push(new Models.SystemFunction('$min', _types.Types.REAL, 0, [new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.all, null, null, null, true)], null, Models.SYSTEM_FUNCTIONS_CATEGORIES.math));
  18861. // Adding text functions:
  18862. window.system_functions.push(new Models.SystemFunction('$substring', _types.Types.TEXT, 0, [new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.all, null, null, null, true), new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.all, null, null, null, true), new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.all, null, null, null, true)], null, Models.SYSTEM_FUNCTIONS_CATEGORIES.text));
  18863. window.system_functions.push(new Models.SystemFunction('$length', _types.Types.INTEGER, 0, [new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.all, null, null, null, true)], null, Models.SYSTEM_FUNCTIONS_CATEGORIES.text));
  18864. window.system_functions.push(new Models.SystemFunction('$uppercase', _types.Types.TEXT, 0, [new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.all, null, null, null, true)], null, Models.SYSTEM_FUNCTIONS_CATEGORIES.text));
  18865. window.system_functions.push(new Models.SystemFunction('$lowercase', _types.Types.TEXT, 0, [new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.all, null, null, null, true)], null, Models.SYSTEM_FUNCTIONS_CATEGORIES.text));
  18866. window.system_functions.push(new Models.SystemFunction('$charAt', _types.Types.TEXT, 0, [new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.all, null, null, null, true), new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.all, null, null, null, true)], null, Models.SYSTEM_FUNCTIONS_CATEGORIES.text));
  18867. // Adding arrangement functions:
  18868. window.system_functions.push(new Models.SystemFunction('$numElements', _types.Types.INTEGER, 0, [new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.all, null, null, null, true)], null, Models.SYSTEM_FUNCTIONS_CATEGORIES.arrangement));
  18869. window.system_functions.push(new Models.SystemFunction('$matrixLines', _types.Types.INTEGER, 0, [new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.all, null, null, null, true)], null, Models.SYSTEM_FUNCTIONS_CATEGORIES.arrangement));
  18870. window.system_functions.push(new Models.SystemFunction('$matrixColumns', _types.Types.INTEGER, 0, [new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.all, null, null, null, true)], null, Models.SYSTEM_FUNCTIONS_CATEGORIES.arrangement));
  18871. // Adding conversion functions:
  18872. window.system_functions.push(new Models.SystemFunction('$isReal', _types.Types.BOOLEAN, 0, [new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.all, null, null, null, true)], null, Models.SYSTEM_FUNCTIONS_CATEGORIES.conversion));
  18873. window.system_functions.push(new Models.SystemFunction('$isInt', _types.Types.BOOLEAN, 0, [new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.all, null, null, null, true)], null, Models.SYSTEM_FUNCTIONS_CATEGORIES.conversion));
  18874. window.system_functions.push(new Models.SystemFunction('$isBool', _types.Types.BOOLEAN, 0, [new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.all, null, null, null, true)], null, Models.SYSTEM_FUNCTIONS_CATEGORIES.conversion));
  18875. window.system_functions.push(new Models.SystemFunction('$castReal', _types.Types.REAL, 0, [new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.all, null, null, null, true)], null, Models.SYSTEM_FUNCTIONS_CATEGORIES.conversion));
  18876. window.system_functions.push(new Models.SystemFunction('$castInt', _types.Types.INTEGER, 0, [new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.all, null, null, null, true)], null, Models.SYSTEM_FUNCTIONS_CATEGORIES.conversion));
  18877. window.system_functions.push(new Models.SystemFunction('$castBool', _types.Types.BOOLEAN, 0, [new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.all, null, null, null, true)], null, Models.SYSTEM_FUNCTIONS_CATEGORIES.conversion));
  18878. window.system_functions.push(new Models.SystemFunction('$castString', _types.Types.TEXT, 0, [new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.all, null, null, null, true)], null, Models.SYSTEM_FUNCTIONS_CATEGORIES.conversion));
  18879. /*const variable1 = new Models.Variable(Types.INTEGER, "a", 1);
  18880. const parameter1 = new Models.Variable(Types.INTEGER, "par_1", 1);
  18881. const command1 = new Models.Comment(new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.only_value, "Testing rendering commands"));
  18882. const sumFunction = new Models.Function("soma", Types.INTEGER, 0, [parameter1], false, false, [], null, [command1]);
  18883. program.addFunction(sumFunction);
  18884. */
  18885. console.log(' ___ ___ ________ \n / / / / / ____/ \n / / / / / / \n / / / / ______ ___ / /__ \n / / / / / \\ / / / ___/ \n / /______ / / / /\\ \\/ / / / \n / / / / / / \\ / / /____ \n/__________/ /___/ /___/ \\___/ /________/ ');
  18886. var mainFunction = new Models.Function(_localizedStringsService.LocalizedStrings.getUI("start"), _types.Types.VOID, 0, [], true, false);
  18887. mainFunction.function_comment = new Models.Comment(_localizedStringsService.LocalizedStrings.getUI('text_comment_main'));
  18888. program.addFunction(mainFunction);
  18889. window.program_obj = program;
  18890. window.generator = CodeManagement.generate;
  18891. window.runCodeAssessment = runCodeAssessment;
  18892. window.renderAlgorithm = AlgorithmManagement.renderAlgorithm;
  18893. window.insertContext = false;
  18894. window.watchW = _melankeWatchjs2.default;
  18895. _melankeWatchjs2.default.watch(window.program_obj.globals, function () {
  18896. if (window.insertContext) {
  18897. setTimeout(function () {
  18898. AlgorithmManagement.renderAlgorithm();
  18899. }, 300);
  18900. window.insertContext = false;
  18901. } else {
  18902. AlgorithmManagement.renderAlgorithm();
  18903. }
  18904. }, 1);
  18905. _melankeWatchjs2.default.watch(window.program_obj.functions, function () {
  18906. if (window.insertContext) {
  18907. setTimeout(function () {
  18908. AlgorithmManagement.renderAlgorithm();
  18909. }, 300);
  18910. window.insertContext = false;
  18911. } else {
  18912. AlgorithmManagement.renderAlgorithm();
  18913. }
  18914. }, 1);
  18915. function addFunctionHandler() {
  18916. var new_function = new Models.Function(_localizedStringsService.LocalizedStrings.getUI("new_function") + "_" + counter_new_functions, _types.Types.VOID, 0, [], false, false, [], new Models.Comment(_localizedStringsService.LocalizedStrings.getUI('text_comment_start')));
  18917. program.addFunction(new_function);
  18918. counter_new_functions++;
  18919. window.insertContext = true;
  18920. var newe = renderFunction(new_function);
  18921. newe.css('display', 'none');
  18922. newe.fadeIn();
  18923. }
  18924. function addParameter(function_obj, function_container) {
  18925. var is_from_click = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  18926. if (function_obj.parameters_list == null) {
  18927. function_obj.parameters_list = [];
  18928. }
  18929. var new_parameter = new Models.Variable(_types.Types.INTEGER, _localizedStringsService.LocalizedStrings.getUI("new_parameter") + "_" + counter_new_parameters);
  18930. function_obj.parameters_list.push(new_parameter);
  18931. counter_new_parameters++;
  18932. var newe = renderParameter(function_obj, new_parameter, function_container);
  18933. if (is_from_click) {
  18934. newe.css('display', 'none');
  18935. newe.fadeIn();
  18936. }
  18937. }
  18938. function updateReturnType(function_obj, new_type) {
  18939. var new_dimensions = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
  18940. function_obj.return_type = new_type;
  18941. function_obj.return_dimensions = new_dimensions;
  18942. }
  18943. function removeFunction(function_obj) {
  18944. var index = program.functions.indexOf(function_obj);
  18945. if (index > -1) {
  18946. program.functions.splice(index, 1);
  18947. }
  18948. }
  18949. function minimizeFunction(function_obj) {
  18950. function_obj.is_hidden = !function_obj.is_hidden;
  18951. }
  18952. function addHandlers(function_obj, function_container) {
  18953. function_container.find('.ui.dropdown.function_return').dropdown({
  18954. onChange: function onChange(value, text, $selectedItem) {
  18955. if ($selectedItem.data('dimensions')) {
  18956. updateReturnType(function_obj, _types.Types[$selectedItem.data('type')], $selectedItem.data('dimensions'));
  18957. } else {
  18958. updateReturnType(function_obj, _types.Types[$selectedItem.data('type')]);
  18959. }
  18960. }
  18961. });
  18962. function_container.find(".name_function_updated").on('click', function (e) {
  18963. enableNameFunctionUpdate(function_obj, function_container);
  18964. });
  18965. function_container.find(".add_parameter_button").on('click', function (e) {
  18966. window.insertContext = true;
  18967. addParameter(function_obj, function_container, true);
  18968. });
  18969. function_container.find('.menu_commands').dropdown({
  18970. on: 'hover'
  18971. });
  18972. function_container.find('.menu_commands a').on('click', function (evt) {
  18973. if (function_obj.commands == null || function_obj.commands.length == 0) {
  18974. function_obj.commands = [];
  18975. var new_cmd = CommandsManagement.genericCreateCommand((0, _jquery2.default)(this).data('command'));
  18976. function_obj.commands.push(new_cmd);
  18977. CommandsManagement.renderCommand(new_cmd, function_container.find('.commands_list_div'), 3, function_obj);
  18978. } else {
  18979. CommandsManagement.createFloatingCommand(function_obj, function_container, (0, _jquery2.default)(this).data('command'), evt);
  18980. }
  18981. });
  18982. function_container.find('.add_var_button_function').on('click', function (e) {
  18983. window.insertContext = true;
  18984. VariablesManagement.addVariable(function_obj, function_container, true);
  18985. });
  18986. function_container.find('.remove_function_button').on('click', function (e) {
  18987. removeFunction(function_obj);
  18988. function_container.fadeOut();
  18989. });
  18990. function_container.find('.minimize_function_button').on('click', function (e) {
  18991. minimizeFunction(function_obj);
  18992. if (function_obj.is_hidden) {
  18993. function_container.find(".add_var_button_function").toggle();
  18994. function_container.find(".inline_add_command").toggle();
  18995. function_container.find(".function_area").slideToggle();
  18996. } else {
  18997. function_container.find(".function_area").slideToggle(function () {
  18998. function_container.find(".add_var_button_function").toggle();
  18999. function_container.find(".inline_add_command").toggle();
  19000. });
  19001. }
  19002. });
  19003. }
  19004. // Essa função imprime o tipo de retorno da função e cria o menu do tipo 'select' para alteração
  19005. function renderFunctionReturn(function_obj, function_element) {
  19006. var ret = '<div class="ui dropdown function_return">';
  19007. if (function_obj.return_dimensions > 0) {
  19008. ret += '<div class="text">' + _localizedStringsService.LocalizedStrings.getUI("vector") + ':' + _localizedStringsService.LocalizedStrings.getUI(function_obj.return_type);
  19009. if (function_obj.return_dimensions == 1) {
  19010. ret += ' [ ] ';
  19011. } else {
  19012. ret += ' [ ] [ ] ';
  19013. }
  19014. ret += '</div>';
  19015. } else {
  19016. ret += '<div class="text">' + _localizedStringsService.LocalizedStrings.getUI(function_obj.return_type) + '</div>';
  19017. }
  19018. ret += '<div class="menu">';
  19019. for (var tm in _types.Types) {
  19020. ret += '<div class="item ' + (function_obj.return_type == tm.toLowerCase() && function_obj.return_dimensions < 1 ? ' selected ' : '') + '" data-type="' + tm + '" >' + _localizedStringsService.LocalizedStrings.getUI(tm.toLowerCase()) + '</div>';
  19021. }
  19022. for (var tm in _types.Types) {
  19023. if (tm == _types.Types.VOID.toUpperCase()) {
  19024. continue;
  19025. }
  19026. ret += '<div class="item">' + '<i class="dropdown icon"></i>' + _localizedStringsService.LocalizedStrings.getUI('vector') + ':' + _localizedStringsService.LocalizedStrings.getUI(tm.toLowerCase()) + '<div class="menu">' + '<div class="item ' + (function_obj.return_type == tm.toLowerCase() && function_obj.return_dimensions > 0 ? ' selected ' : '') + '" data-text="' + _localizedStringsService.LocalizedStrings.getUI('vector') + ':' + _localizedStringsService.LocalizedStrings.getUI(tm.toLowerCase()) + ' [ ] " data-type="' + tm + '" data-dimensions="1">[ ]</div>' + '<div class="item ' + (function_obj.return_type == tm.toLowerCase() && function_obj.return_dimensions > 0 ? ' selected ' : '') + '" data-text="' + _localizedStringsService.LocalizedStrings.getUI('vector') + ':' + _localizedStringsService.LocalizedStrings.getUI(tm.toLowerCase()) + ' [ ] [ ] " data-type="' + tm + '" data-dimensions="2">[ ] [ ] </div>' + '</div>' + '</div>';
  19027. }
  19028. ret += '</div></div>';
  19029. ret = (0, _jquery2.default)(ret);
  19030. function_element.find('.function_return').append(ret);
  19031. }
  19032. function renderFunction(function_obj) {
  19033. var appender = '<div class="ui secondary segment function_div list-group-item">';
  19034. if (function_obj.function_comment) {
  19035. //appender += renderComment(function_obj.function_comment, sequence, true, -1);
  19036. }
  19037. appender += '<span class="glyphicon glyphicon-move move_function" aria-hidden="true"><i class="icon sort alternate vertical"></i></span>';
  19038. appender += (function_obj.is_main ? '<div class="div_start_minimize_v"> </div>' : '<button class="ui icon button large remove_function_button"><i class="red icon times"></i></button>') + '<button class="ui icon button tiny minimize_function_button"><i class="icon window minimize"></i></button>';
  19039. appender += '<div class="function_signature_div">' + _localizedStringsService.LocalizedStrings.getUI("function") + ' ';
  19040. if (function_obj.is_main) {
  19041. appender += '<div class="function_name_div"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ' + _localizedStringsService.LocalizedStrings.getUI('void') + ' &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span class="span_name_function" >' + function_obj.name + '</span> </div> ' + ' <span class="parethesis_function">( </span> <div class="ui large labels parameters_list">';
  19042. } else {
  19043. appender += '<div class="ui function_return"></div>';
  19044. appender += '<div class="function_name_div function_name_div_updated"><span class="span_name_function name_function_updated">' + function_obj.name + '</span> </div> ' + ' <span class="parethesis_function"> ( </span> <i class="ui icon plus square outline add_parameter_button"></i> <div class="ui large labels parameters_list container_parameters_list">';
  19045. }
  19046. appender += '</div> <span class="parethesis_function"> ) </span> </div>' + (function_obj.is_hidden ? ' <div class="function_area" style="display: none;"> ' : ' <div class="function_area"> ');
  19047. appender += '<div class="ui add_var_context add_var_button_function" style="float: left;"><i class="icon plus circle purple"></i><i class="icon circle white back"></i><div class="ui icon button purple"><i class="icon superscript"></i></div></div>';
  19048. appender += '<div class="ui top attached segment variables_list_div"></div>';
  19049. appender += '<div class="ui inline_add_command"><i class="icon plus circle purple"></i><i class="icon circle white back"></i><div class="ui icon button dropdown menu_commands orange" style="float: left;" ><i class="icon code"></i> <div class="menu"> ';
  19050. appender += '<a class="item" data-command="' + Models.COMMAND_TYPES.reader + '"><i class="download icon"></i> ' + _localizedStringsService.LocalizedStrings.getUI('text_read_var') + '</a>' + '<a class="item" data-command="' + Models.COMMAND_TYPES.writer + '"><i class="upload icon"></i> ' + _localizedStringsService.LocalizedStrings.getUI('text_write_var') + '</a>' + '<a class="item" data-command="' + Models.COMMAND_TYPES.comment + '"><i class="quote left icon"></i> ' + _localizedStringsService.LocalizedStrings.getUI('text_comment') + '</a>' + '<a class="item" data-command="' + Models.COMMAND_TYPES.attribution + '"><i class="arrow left icon"></i> ' + _localizedStringsService.LocalizedStrings.getUI('text_attribution') + '</a>' + '<a class="item" data-command="' + Models.COMMAND_TYPES.functioncall + '"><i class="hand point right icon"></i> ' + _localizedStringsService.LocalizedStrings.getUI('text_functioncall') + '</a>' + '<a class="item" data-command="' + Models.COMMAND_TYPES.iftrue + '" ><i class="random icon"></i> ' + _localizedStringsService.LocalizedStrings.getUI('text_iftrue') + '</a>' + '<a class="item" data-command="' + Models.COMMAND_TYPES.repeatNtimes + '"><i class="sync icon"></i> ' + _localizedStringsService.LocalizedStrings.getUI('text_repeatNtimes') + '</a>' + '<a class="item" data-command="' + Models.COMMAND_TYPES.whiletrue + '"><i class="sync icon"></i> ' + _localizedStringsService.LocalizedStrings.getUI('text_whiletrue') + '</a>' + '<a class="item" data-command="' + Models.COMMAND_TYPES.dowhiletrue + '"><i class="sync icon"></i> ' + _localizedStringsService.LocalizedStrings.getUI('text_dowhiletrue') + '</a>' + '<a class="item" data-command="' + Models.COMMAND_TYPES.switch + '"><i class="list icon"></i> ' + _localizedStringsService.LocalizedStrings.getUI('text_switch') + '</a>' + '<a class="item" data-command="' + Models.COMMAND_TYPES.return + '"><i class="reply icon"></i> ' + _localizedStringsService.LocalizedStrings.getUI('text_btn_return') + '</a>' + '</div></div></div>';
  19051. appender += '<div class="ui bottom attached segment commands_list_div"></div>';
  19052. appender += '</div></div>';
  19053. appender = (0, _jquery2.default)(appender);
  19054. (0, _jquery2.default)('.all_functions').append(appender);
  19055. appender.data('fun', function_obj);
  19056. appender.find('.commands_list_div').data('fun', function_obj);
  19057. renderFunctionReturn(function_obj, appender);
  19058. addHandlers(function_obj, appender);
  19059. // Rendering parameters:
  19060. for (var j = 0; j < function_obj.parameters_list.length; j++) {
  19061. renderParameter(function_obj, function_obj.parameters_list[j], appender);
  19062. }
  19063. // Rendering variables:
  19064. for (var j = 0; j < function_obj.variables_list.length; j++) {
  19065. VariablesManagement.renderVariable(appender, function_obj.variables_list[j], function_obj);
  19066. }
  19067. // Rendering commands:
  19068. for (var j = 0; j < function_obj.commands.length; j++) {
  19069. CommandsManagement.renderCommand(function_obj.commands[j], (0, _jquery2.default)(appender.find('.commands_list_div')[0]), 3, function_obj);
  19070. }
  19071. (0, _jquery2.default)('.minimize_function_button').popup({
  19072. content: _localizedStringsService.LocalizedStrings.getUI("tooltip_minimize"),
  19073. delay: {
  19074. show: 750,
  19075. hide: 0
  19076. }
  19077. });
  19078. Sortable.create(appender.find(".variables_list_div")[0], {
  19079. handle: '.ellipsis',
  19080. animation: 100,
  19081. ghostClass: 'ghost',
  19082. group: 'local_vars_drag_' + program.functions.indexOf(function_obj),
  19083. onEnd: function onEnd(evt) {
  19084. updateSequenceLocals(evt.oldIndex, evt.newIndex, function_obj);
  19085. }
  19086. });
  19087. Sortable.create(appender.find(".commands_list_div")[0], {
  19088. handle: '.command_drag',
  19089. animation: 100,
  19090. ghostClass: 'ghost',
  19091. group: 'commands_drag_' + program.functions.indexOf(function_obj),
  19092. onEnd: function onEnd(evt) {
  19093. //updateSequenceLocals(evt.oldIndex, evt.newIndex, function_obj);
  19094. }
  19095. });
  19096. if (!function_obj.is_main) {
  19097. Sortable.create(appender.find(".container_parameters_list")[0], {
  19098. handle: '.ellipsis',
  19099. animation: 100,
  19100. ghostClass: 'ghost',
  19101. group: 'parameters_drag_' + program.functions.indexOf(function_obj),
  19102. onEnd: function onEnd(evt) {
  19103. updateSequenceParameters(evt.oldIndex, evt.newIndex, function_obj);
  19104. }
  19105. });
  19106. }
  19107. return appender;
  19108. }
  19109. function initVisualUI() {
  19110. // MUST USE CONST, LET, OR VAR !!!!!!
  19111. var mainDiv = (0, _jquery2.default)('#visual-main-div');
  19112. // fill mainDiv with functions and globals...
  19113. // renderAlgorithm()...
  19114. (0, _jquery2.default)('.add_function_button').on('click', function () {
  19115. addFunctionHandler();
  19116. });
  19117. (0, _jquery2.default)('.add_global_button').on('click', function () {
  19118. window.insertContext = true;
  19119. GlobalsManagement.addGlobal(program, true);
  19120. });
  19121. (0, _jquery2.default)('.run_button').on('click', function () {
  19122. runCode();
  19123. });
  19124. (0, _jquery2.default)('.visual_coding_button').on('click', function () {
  19125. toggleVisualCoding();
  19126. });
  19127. (0, _jquery2.default)('.textual_coding_button').on('click', function () {
  19128. toggleTextualCoding();
  19129. });
  19130. (0, _jquery2.default)('.assessment').on('click', function () {
  19131. runCodeAssessment();
  19132. is_iassign = true;
  19133. });
  19134. (0, _jquery2.default)('.div_toggle_console').on('click', function () {
  19135. toggleConsole();
  19136. });
  19137. (0, _jquery2.default)('.expand_button').on('click', function () {
  19138. full_screen();
  19139. });
  19140. }
  19141. var is_iassign = false;
  19142. (0, _jquery2.default)(document).ready(function () {
  19143. for (var i = 0; i < program.functions.length; i++) {
  19144. renderFunction(program.functions[i]);
  19145. }
  19146. var time_show = 750;
  19147. (0, _jquery2.default)('.visual_coding_button').popup({
  19148. content: _localizedStringsService.LocalizedStrings.getUI("tooltip_visual"),
  19149. delay: {
  19150. show: time_show,
  19151. hide: 0
  19152. }
  19153. });
  19154. (0, _jquery2.default)('.textual_coding_button').popup({
  19155. content: _localizedStringsService.LocalizedStrings.getUI("tooltip_textual"),
  19156. delay: {
  19157. show: time_show,
  19158. hide: 0
  19159. }
  19160. });
  19161. (0, _jquery2.default)('.upload_file_button').popup({
  19162. content: _localizedStringsService.LocalizedStrings.getUI("tooltip_upload"),
  19163. delay: {
  19164. show: time_show,
  19165. hide: 0
  19166. }
  19167. });
  19168. (0, _jquery2.default)('.download_file_button').popup({
  19169. content: _localizedStringsService.LocalizedStrings.getUI("tooltip_download"),
  19170. delay: {
  19171. show: time_show,
  19172. hide: 0
  19173. }
  19174. });
  19175. (0, _jquery2.default)('.undo_button').popup({
  19176. content: _localizedStringsService.LocalizedStrings.getUI("tooltip_undo"),
  19177. delay: {
  19178. show: time_show,
  19179. hide: 0
  19180. }
  19181. });
  19182. (0, _jquery2.default)('.redo_button').popup({
  19183. content: _localizedStringsService.LocalizedStrings.getUI("tooltip_redo"),
  19184. delay: {
  19185. show: time_show,
  19186. hide: 0
  19187. }
  19188. });
  19189. (0, _jquery2.default)('.run_button').popup({
  19190. content: _localizedStringsService.LocalizedStrings.getUI("tooltip_run"),
  19191. delay: {
  19192. show: time_show,
  19193. hide: 0
  19194. }
  19195. });
  19196. (0, _jquery2.default)('.assessment_button').popup({
  19197. content: _localizedStringsService.LocalizedStrings.getUI("tooltip_evaluate"),
  19198. delay: {
  19199. show: time_show,
  19200. hide: 0
  19201. }
  19202. });
  19203. (0, _jquery2.default)('.help_button').popup({
  19204. content: _localizedStringsService.LocalizedStrings.getUI("tooltip_help"),
  19205. delay: {
  19206. show: time_show,
  19207. hide: 0
  19208. }
  19209. });
  19210. (0, _jquery2.default)('.add_global_button').popup({
  19211. content: _localizedStringsService.LocalizedStrings.getUI("tooltip_add_global"),
  19212. delay: {
  19213. show: time_show,
  19214. hide: 0
  19215. }
  19216. });
  19217. (0, _jquery2.default)('.div_toggle_console').popup({
  19218. content: _localizedStringsService.LocalizedStrings.getUI("tooltip_console"),
  19219. delay: {
  19220. show: time_show,
  19221. hide: 0
  19222. }
  19223. });
  19224. Sortable.create(listWithHandle, {
  19225. handle: '.glyphicon-move',
  19226. animation: 100,
  19227. ghostClass: 'ghost',
  19228. group: 'functions_divs_drag',
  19229. onEnd: function onEnd(evt) {
  19230. updateSequenceFunction(evt.oldIndex, evt.newIndex);
  19231. }
  19232. });
  19233. var listGlobalsHandle = document.getElementById("listGlobalsHandle");
  19234. Sortable.create(listGlobalsHandle, {
  19235. handle: '.ellipsis',
  19236. animation: 100,
  19237. ghostClass: 'ghost',
  19238. group: 'globals_divs_drag',
  19239. onEnd: function onEnd(evt) {
  19240. updateSequenceGlobals(evt.oldIndex, evt.newIndex);
  19241. }
  19242. });
  19243. });
  19244. function updateSequenceParameters(oldIndex, newIndex, function_obj) {
  19245. function_obj.parameters_list.splice(newIndex, 0, function_obj.parameters_list.splice(oldIndex, 1)[0]);
  19246. }
  19247. function updateSequenceLocals(oldIndex, newIndex, function_obj) {
  19248. function_obj.variables_list.splice(newIndex, 0, function_obj.variables_list.splice(oldIndex, 1)[0]);
  19249. }
  19250. function updateSequenceGlobals(oldIndex, newIndex) {
  19251. program_obj.globals.splice(newIndex, 0, program_obj.globals.splice(oldIndex, 1)[0]);
  19252. }
  19253. function updateSequenceFunction(oldIndex, newIndex) {
  19254. program_obj.functions.splice(newIndex, 0, program_obj.functions.splice(oldIndex, 1)[0]);
  19255. }
  19256. function runCodeAssessment() {
  19257. toggleConsole(true);
  19258. window.studentGrade = null;
  19259. studentTemp = null;
  19260. var strCode = CodeManagement.generate();
  19261. if (strCode == null) {
  19262. return;
  19263. }
  19264. if (domConsole == null) domConsole = new _domConsole.DOMConsole("#ivprog-term");
  19265. (0, _jquery2.default)("#ivprog-term").slideDown(500);
  19266. var runner = new _ivprogAssessment.IVProgAssessment(strCode, testCases, domConsole);
  19267. runner.runTest().then(function (grade) {
  19268. if (!is_iassign) {
  19269. parent.getEvaluationCallback(grade);
  19270. } else {
  19271. is_iassign = false;
  19272. }
  19273. }).catch(function (err) {
  19274. return domConsole.err(err.message);
  19275. });
  19276. }
  19277. function runCode() {
  19278. toggleConsole(true);
  19279. var strCode = CodeManagement.generate();
  19280. if (strCode == null) {
  19281. return;
  19282. }
  19283. if (domConsole == null) domConsole = new _domConsole.DOMConsole("#ivprog-term");
  19284. (0, _jquery2.default)("#ivprog-term").slideDown(500);
  19285. try {
  19286. var parser = _ivprogParser.IVProgParser.createParser(strCode);
  19287. var analyser = new _semanticAnalyser.SemanticAnalyser(parser.parseTree());
  19288. var data = analyser.analyseTree();
  19289. var proc = new _ivprogProcessor.IVProgProcessor(data);
  19290. proc.registerInput(domConsole);
  19291. proc.registerOutput(domConsole);
  19292. (0, _jquery2.default)("#ivprog-term").addClass('ivprog-term-active');
  19293. proc.interpretAST().then(function (_) {
  19294. domConsole.info("Programa executado com sucesso!");
  19295. (0, _jquery2.default)("#ivprog-term").removeClass('ivprog-term-active');
  19296. }).catch(function (err) {
  19297. domConsole.err(err.message);
  19298. (0, _jquery2.default)("#ivprog-term").removeClass('ivprog-term-active');
  19299. });
  19300. } catch (error) {
  19301. domConsole.err(error.message);
  19302. console.log(error);
  19303. }
  19304. }
  19305. function toggleConsole(is_running) {
  19306. if (is_running) {
  19307. (0, _jquery2.default)('.ivprog-term-div').css('display', 'block');
  19308. (0, _jquery2.default)('#ivprog-term').css('min-height', '160px');
  19309. (0, _jquery2.default)('#ivprog-term').css('margin-top', '-170px');
  19310. return;
  19311. }
  19312. if ((0, _jquery2.default)('#ivprog-term').css('min-height') == '160px') {
  19313. // esconder
  19314. (0, _jquery2.default)('.ivprog-term-div').css('display', 'none');
  19315. (0, _jquery2.default)('#ivprog-term').css('min-height', '0');
  19316. (0, _jquery2.default)('#ivprog-term').css('margin-top', '-30px');
  19317. (0, _jquery2.default)('#ivprog-term').css('padding', '5px');
  19318. } else {
  19319. // mostrar
  19320. (0, _jquery2.default)('.ivprog-term-div').css('display', 'block');
  19321. (0, _jquery2.default)('#ivprog-term').css('min-height', '160px');
  19322. (0, _jquery2.default)('#ivprog-term').css('margin-top', '-170px');
  19323. }
  19324. }
  19325. function waitToCloseConsole() {
  19326. domConsole.info("Aperte qualquer tecla para fechar...");
  19327. var p = new Promise(function (resolve, _) {
  19328. domConsole.requestInput(resolve, true);
  19329. });
  19330. p.then(function (_) {
  19331. domConsole.dispose();
  19332. domConsole = null;
  19333. (0, _jquery2.default)("#ivprog-term").hide();
  19334. });
  19335. }
  19336. function toggleTextualCoding() {
  19337. var code = CodeManagement.generate();
  19338. (0, _jquery2.default)('.ivprog_visual_panel').css('display', 'none');
  19339. (0, _jquery2.default)('.ivprog_textual_panel').css('display', 'block');
  19340. (0, _jquery2.default)('.ivprog_textual_panel').removeClass('loading');
  19341. (0, _jquery2.default)('.ivprog_textual_code').text(code);
  19342. (0, _jquery2.default)('.visual_coding_button').removeClass('active');
  19343. (0, _jquery2.default)('.textual_coding_button').addClass('active');
  19344. }
  19345. function toggleVisualCoding() {
  19346. (0, _jquery2.default)('.ivprog_textual_panel').addClass('loading');
  19347. (0, _jquery2.default)('.ivprog_textual_panel').css('display', 'none');
  19348. (0, _jquery2.default)('.ivprog_visual_panel').css('display', 'block');
  19349. (0, _jquery2.default)('.textual_coding_button').removeClass('active');
  19350. (0, _jquery2.default)('.visual_coding_button').addClass('active');
  19351. }
  19352. function removeParameter(function_obj, parameter_obj, parameter_container) {
  19353. var index = function_obj.parameters_list.indexOf(parameter_obj);
  19354. if (index > -1) {
  19355. window.insertContext = true;
  19356. function_obj.parameters_list.splice(index, 1);
  19357. }
  19358. (0, _jquery2.default)(parameter_container).fadeOut();
  19359. }
  19360. function updateParameterType(parameter_obj, new_type) {
  19361. var new_dimensions = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
  19362. parameter_obj.type = new_type;
  19363. parameter_obj.dimensions = new_dimensions;
  19364. if (new_dimensions > 0) {
  19365. parameter_obj.rows = new_dimensions;
  19366. parameter_obj.columns = 2;
  19367. }
  19368. }
  19369. function renderParameter(function_obj, parameter_obj, function_container) {
  19370. var ret = "";
  19371. ret += '<div class="ui label function_name_parameter pink"><i class="ui icon ellipsis vertical inverted"></i>';
  19372. ret += '<div class="ui dropdown parameter_type">';
  19373. if (parameter_obj.dimensions > 0) {
  19374. ret += '<div class="text">' + _localizedStringsService.LocalizedStrings.getUI('vector') + ':' + _localizedStringsService.LocalizedStrings.getUI(parameter_obj.type);
  19375. if (parameter_obj.dimensions == 1) {
  19376. ret += ' [ ] ';
  19377. } else {
  19378. ret += ' [ ] [ ] ';
  19379. }
  19380. ret += '</div>';
  19381. } else {
  19382. ret += '<div class="text">' + _localizedStringsService.LocalizedStrings.getUI(parameter_obj.type) + '</div>';
  19383. }
  19384. ret += '<div class="menu">';
  19385. for (var tm in _types.Types) {
  19386. if (tm == _types.Types.VOID.toUpperCase()) {
  19387. continue;
  19388. }
  19389. ret += '<div class="item ' + (parameter_obj.type == tm.toLowerCase() ? ' selected ' : '') + '" data-type="' + tm + '" >' + _localizedStringsService.LocalizedStrings.getUI(tm.toLowerCase()) + '</div>';
  19390. }
  19391. for (var tm in _types.Types) {
  19392. if (tm == _types.Types.VOID.toUpperCase()) {
  19393. continue;
  19394. }
  19395. ret += '<div class="item">' + '<i class="dropdown icon"></i>' + _localizedStringsService.LocalizedStrings.getUI('vector') + ':' + _localizedStringsService.LocalizedStrings.getUI(tm.toLowerCase()) + '<div class="menu">' + '<div class="item" data-text="' + _localizedStringsService.LocalizedStrings.getUI('vector') + ':' + _localizedStringsService.LocalizedStrings.getUI(tm.toLowerCase()) + ' [ ] " data-type="' + tm + '" data-dimensions="1">[ ]</div>' + '<div class="item" data-text="' + _localizedStringsService.LocalizedStrings.getUI('vector') + ':' + _localizedStringsService.LocalizedStrings.getUI(tm.toLowerCase()) + ' [ ] [ ] " data-type="' + tm + '" data-dimensions="2">[ ] [ ] </div>' + '</div>' + '</div>';
  19396. }
  19397. ret += '</div></div>';
  19398. ret += '<div class="parameter_div_edit"><span class="span_name_parameter label_enable_name_parameter">' + parameter_obj.name + '</span></div> ';
  19399. ret += ' <i class="yellow inverted icon times remove_parameter"></i></div>';
  19400. ret = (0, _jquery2.default)(ret);
  19401. function_container.find('.container_parameters_list').append(ret);
  19402. ret.find('.remove_parameter').on('click', function (e) {
  19403. removeParameter(function_obj, parameter_obj, ret);
  19404. });
  19405. ret.find('.ui.dropdown.parameter_type').dropdown({
  19406. onChange: function onChange(value, text, $selectedItem) {
  19407. if ($selectedItem.data('dimensions')) {
  19408. updateParameterType(parameter_obj, _types.Types[$selectedItem.data('type')], $selectedItem.data('dimensions'));
  19409. } else {
  19410. updateParameterType(parameter_obj, _types.Types[$selectedItem.data('type')]);
  19411. }
  19412. }
  19413. });
  19414. ret.find('.label_enable_name_parameter').on('click', function (e) {
  19415. enableNameParameterUpdate(parameter_obj, ret);
  19416. });
  19417. return ret;
  19418. }
  19419. var opened_name_parameter = false;
  19420. var opened_input_parameter = null;
  19421. function enableNameParameterUpdate(parameter_obj, parent_node) {
  19422. if (opened_name_parameter) {
  19423. opened_input_parameter.focus();
  19424. return;
  19425. }
  19426. opened_name_parameter = true;
  19427. parent_node = (0, _jquery2.default)(parent_node);
  19428. var input_field;
  19429. parent_node.find('.span_name_parameter').text('');
  19430. input_field = (0, _jquery2.default)("<input type='text' class='width-dynamic input_name_function' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' value='" + parameter_obj.name + "' />");
  19431. input_field.insertBefore(parent_node.find('.span_name_parameter'));
  19432. input_field.on('input', function () {
  19433. var inputWidth = input_field.textWidth() + 10;
  19434. opened_input_parameter = input_field;
  19435. input_field.focus();
  19436. var tmpStr = input_field.val();
  19437. input_field.val('');
  19438. input_field.val(tmpStr);
  19439. input_field.css({
  19440. width: inputWidth
  19441. });
  19442. }).trigger('input');
  19443. input_field.focusout(function () {
  19444. /// update array:
  19445. if (input_field.val().trim()) {
  19446. parameter_obj.name = input_field.val().trim();
  19447. parent_node.find('.span_name_parameter').text(parameter_obj.name);
  19448. }
  19449. input_field.off();
  19450. input_field.remove();
  19451. /// update elements:
  19452. opened_name_parameter = false;
  19453. opened_input_parameter = false;
  19454. });
  19455. input_field.on('keydown', function (e) {
  19456. var code = e.keyCode || e.which;
  19457. if (code == 13) {
  19458. if (input_field.val().trim()) {
  19459. parameter_obj.name = input_field.val().trim();
  19460. parent_node.find('.span_name_parameter').text(parameter_obj.name);
  19461. }
  19462. input_field.off();
  19463. input_field.remove();
  19464. /// update elements:
  19465. opened_name_parameter = false;
  19466. opened_input_parameter = false;
  19467. }
  19468. if (code == 27) {
  19469. parent_node.find('.span_name_parameter').text(parameter_obj.name);
  19470. input_field.off();
  19471. input_field.remove();
  19472. /// update elements:
  19473. opened_name_parameter = false;
  19474. opened_input_parameter = false;
  19475. }
  19476. });
  19477. input_field.select();
  19478. }
  19479. var opened_name_function = false;
  19480. var opened_input = null;
  19481. var previousPadding = null;
  19482. function enableNameFunctionUpdate(function_obj, parent_node) {
  19483. if (opened_name_function) {
  19484. opened_input.focus();
  19485. return;
  19486. }
  19487. parent_node = (0, _jquery2.default)(parent_node);
  19488. parent_node.find('.span_name_function').text('');
  19489. var input_field;
  19490. if (!previousPadding) {
  19491. previousPadding = parent_node.find('.span_name_function').css('padding-left');
  19492. }
  19493. parent_node.find('.span_name_function').css('padding-left', '0');
  19494. parent_node.find('.span_name_function').css('padding-right', '0');
  19495. input_field = (0, _jquery2.default)("<input type='text' class='width-dynamic input_name_function' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' value='" + function_obj.name + "' />");
  19496. input_field.insertBefore(parent_node.find('.span_name_function'));
  19497. input_field.on('input', function () {
  19498. var inputWidth = input_field.textWidth() + 10;
  19499. opened_input = input_field;
  19500. input_field.focus();
  19501. var tmpStr = input_field.val();
  19502. input_field.val('');
  19503. input_field.val(tmpStr);
  19504. input_field.css({
  19505. width: inputWidth
  19506. });
  19507. }).trigger('input');
  19508. input_field.focusout(function () {
  19509. /// update array:
  19510. if (input_field.val().trim()) {
  19511. function_obj.name = input_field.val().trim();
  19512. }
  19513. input_field.off();
  19514. input_field.remove();
  19515. parent_node.find('.span_name_function').css('padding-left', previousPadding);
  19516. parent_node.find('.span_name_function').css('padding-right', previousPadding);
  19517. parent_node.find('.span_name_function').text(function_obj.name);
  19518. /// update elements:
  19519. opened_name_function = false;
  19520. opened_input = false;
  19521. });
  19522. input_field.on('keydown', function (e) {
  19523. var code = e.keyCode || e.which;
  19524. if (code == 13) {
  19525. if (input_field.val().trim()) {
  19526. function_obj.name = input_field.val().trim();
  19527. }
  19528. input_field.off();
  19529. input_field.remove();
  19530. parent_node.find('.span_name_function').css('padding-left', previousPadding);
  19531. parent_node.find('.span_name_function').css('padding-right', previousPadding);
  19532. parent_node.find('.span_name_function').text(function_obj.name);
  19533. /// update elements:
  19534. opened_name_function = false;
  19535. opened_input = false;
  19536. }
  19537. if (code == 27) {
  19538. input_field.off();
  19539. input_field.remove();
  19540. parent_node.find('.span_name_function').css('padding-left', previousPadding);
  19541. parent_node.find('.span_name_function').css('padding-right', previousPadding);
  19542. parent_node.find('.span_name_function').text(function_obj.name);
  19543. /// update elements:
  19544. opened_name_function = false;
  19545. opened_input = false;
  19546. }
  19547. });
  19548. input_field.select();
  19549. }
  19550. /***/ }),
  19551. /***/ "./js/visualUI/globals.js":
  19552. /*!********************************!*\
  19553. !*** ./js/visualUI/globals.js ***!
  19554. \********************************/
  19555. /*! no static exports found */
  19556. /***/ (function(module, exports, __webpack_require__) {
  19557. "use strict";
  19558. Object.defineProperty(exports, "__esModule", {
  19559. value: true
  19560. });
  19561. exports.addGlobal = addGlobal;
  19562. exports.renderGlobal = renderGlobal;
  19563. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  19564. var _jquery2 = _interopRequireDefault(_jquery);
  19565. var _types = __webpack_require__(/*! ./types */ "./js/visualUI/types.js");
  19566. var _ivprog_elements = __webpack_require__(/*! ./ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  19567. var Models = _interopRequireWildcard(_ivprog_elements);
  19568. var _localizedStringsService = __webpack_require__(/*! ./../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  19569. __webpack_require__(/*! ../semantic/semantic.min.js */ "./js/semantic/semantic.min.js");
  19570. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  19571. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  19572. window.jQuery = _jquery2.default;
  19573. var counter_new_globals = 0;
  19574. function addGlobal(program) {
  19575. var is_from_click = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  19576. var new_global = new Models.Variable(_types.Types.INTEGER, _localizedStringsService.LocalizedStrings.getUI('new_global') + '_' + counter_new_globals, 1);
  19577. counter_new_globals++;
  19578. program.addGlobal(new_global);
  19579. var newe = renderGlobal(new_global);
  19580. if (is_from_click) {
  19581. newe.css('display', 'none');
  19582. newe.fadeIn();
  19583. }
  19584. }
  19585. function toggleConstant(global_var) {
  19586. global_var.is_constant = !global_var.is_constant;
  19587. }
  19588. function updateName(global_var, new_name) {
  19589. global_var.name = new_name;
  19590. }
  19591. function updateType(global_var, new_type) {
  19592. var new_dimensions = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
  19593. global_var.type = new_type;
  19594. global_var.dimensions = new_dimensions;
  19595. if (new_dimensions > 0) {
  19596. global_var.rows = new_dimensions;
  19597. global_var.columns = 2;
  19598. }
  19599. updateInitialValues(global_var);
  19600. }
  19601. function removeGlobal(global_var, global_container) {
  19602. var index = window.program_obj.globals.indexOf(global_var);
  19603. if (index > -1) {
  19604. window.insertContext = true;
  19605. window.program_obj.globals.splice(index, 1);
  19606. }
  19607. global_container.children().off();
  19608. global_container.off();
  19609. global_container.fadeOut();
  19610. }
  19611. function updateInitialValues(global_var) {
  19612. if (global_var.type == _types.Types.INTEGER) {
  19613. if (global_var.dimensions == 0) {
  19614. global_var.value = 1;
  19615. }
  19616. if (global_var.dimensions == 1) {
  19617. global_var.value = [1, 1];
  19618. }
  19619. if (global_var.dimensions == 2) {
  19620. global_var.value = [[1, 1], [1, 1]];
  19621. }
  19622. }
  19623. if (global_var.type == _types.Types.REAL) {
  19624. if (global_var.dimensions == 0) {
  19625. global_var.value = 1.0;
  19626. }
  19627. if (global_var.dimensions == 1) {
  19628. global_var.value = [1.0, 1.0];
  19629. }
  19630. if (global_var.dimensions == 2) {
  19631. global_var.value = [[1.0, 1.0], [1.0, 1.0]];
  19632. }
  19633. }
  19634. if (global_var.type == _types.Types.TEXT) {
  19635. if (global_var.dimensions == 0) {
  19636. global_var.value = _localizedStringsService.LocalizedStrings.getUI('text_start');
  19637. }
  19638. if (global_var.dimensions == 1) {
  19639. global_var.value = [_localizedStringsService.LocalizedStrings.getUI('text_start'), _localizedStringsService.LocalizedStrings.getUI('text_start')];
  19640. }
  19641. if (global_var.dimensions == 2) {
  19642. global_var.value = [[_localizedStringsService.LocalizedStrings.getUI('text_start'), _localizedStringsService.LocalizedStrings.getUI('text_start')], [_localizedStringsService.LocalizedStrings.getUI('text_start'), _localizedStringsService.LocalizedStrings.getUI('text_start')]];
  19643. }
  19644. }
  19645. if (global_var.type == _types.Types.BOOLEAN) {
  19646. if (global_var.dimensions == 0) {
  19647. global_var.value = true;
  19648. }
  19649. if (global_var.dimensions == 1) {
  19650. global_var.value = [true, true];
  19651. }
  19652. if (global_var.dimensions == 2) {
  19653. global_var.value = [[true, true], [true, true]];
  19654. }
  19655. }
  19656. }
  19657. function alternateBooleanGlobalValue(global_var, value_container) {
  19658. global_var.value = !global_var.value;
  19659. (0, _jquery2.default)(value_container).find('.span_value_variable').text(_localizedStringsService.LocalizedStrings.getUI(global_var.value));
  19660. }
  19661. function alternateBooleanGlobalVectorValue(global_var, index, value_container) {
  19662. global_var.value[index] = !global_var.value[index];
  19663. (0, _jquery2.default)(value_container).find('.span_value_variable').text(_localizedStringsService.LocalizedStrings.getUI(global_var.value[index]));
  19664. }
  19665. function removeGlobalColumnVector(global_var) {
  19666. if (global_var.columns == 0) {
  19667. return;
  19668. }
  19669. global_var.columns--;
  19670. global_var.value.splice(global_var.value.length - 1, 1);
  19671. }
  19672. function addGlobalColumnVector(global_var) {
  19673. global_var.columns++;
  19674. if (global_var.type == _types.Types.INTEGER) {
  19675. global_var.value.push(1);
  19676. }
  19677. if (global_var.type == _types.Types.REAL) {
  19678. global_var.value.push(1.0);
  19679. }
  19680. if (global_var.type == _types.Types.TEXT) {
  19681. global_var.value.push(_localizedStringsService.LocalizedStrings.getUI('text_start'));
  19682. }
  19683. if (global_var.type == _types.Types.BOOLEAN) {
  19684. global_var.value.push(true);
  19685. }
  19686. }
  19687. function removeColumnGlobalMatrix(global_var) {
  19688. if (global_var.columns == 0) {
  19689. return;
  19690. }
  19691. global_var.columns--;
  19692. for (var i = 0; i < global_var.rows; i++) {
  19693. global_var.value[i].splice(global_var.value[i].length - 1, 1);
  19694. }
  19695. }
  19696. function addColumnGlobalMatrix(global_var) {
  19697. global_var.columns++;
  19698. if (global_var.type == _types.Types.INTEGER) {
  19699. for (var i = 0; i < global_var.rows; i++) {
  19700. global_var.value[i].push(1);
  19701. }
  19702. }
  19703. if (global_var.type == _types.Types.REAL) {
  19704. for (var i = 0; i < global_var.rows; i++) {
  19705. global_var.value[i].push(1.0);
  19706. }
  19707. }
  19708. if (global_var.type == _types.Types.TEXT) {
  19709. for (var i = 0; i < global_var.rows; i++) {
  19710. global_var.value[i].push(_localizedStringsService.LocalizedStrings.getUI('text_start'));
  19711. }
  19712. }
  19713. if (global_var.type == _types.Types.BOOLEAN) {
  19714. for (var i = 0; i < global_var.rows; i++) {
  19715. global_var.value[i].push(true);
  19716. }
  19717. }
  19718. }
  19719. function removeLineGlobalMatrix(global_var) {
  19720. if (global_var.rows == 0) {
  19721. return;
  19722. }
  19723. global_var.rows--;
  19724. global_var.value.splice(global_var.value.length - 1, 1);
  19725. }
  19726. function addLineGlobalMatrix(global_var) {
  19727. global_var.rows++;
  19728. if (global_var.type == _types.Types.INTEGER) {
  19729. var n_l = [];
  19730. for (var i = 0; i < global_var.columns; i++) {
  19731. n_l.push(1);
  19732. }
  19733. global_var.value.push(n_l);
  19734. }
  19735. if (global_var.type == _types.Types.REAL) {
  19736. var n_l = [];
  19737. for (i = 0; i < global_var.columns; i++) {
  19738. n_l.push(1.0);
  19739. }
  19740. global_var.value.push(n_l);
  19741. }
  19742. if (global_var.type == _types.Types.TEXT) {
  19743. var n_l = [];
  19744. for (i = 0; i < global_var.columns; i++) {
  19745. n_l.push(_localizedStringsService.LocalizedStrings.getUI('text_start'));
  19746. }
  19747. global_var.value.push(n_l);
  19748. }
  19749. if (global_var.type == _types.Types.BOOLEAN) {
  19750. var n_l = [];
  19751. for (i = 0; i < global_var.columns; i++) {
  19752. n_l.push(true);
  19753. }
  19754. global_var.value.push(n_l);
  19755. }
  19756. }
  19757. function alternateBooleanGlobalMatrixValue(global_var, row, index, value_container) {
  19758. global_var.value[row][index] = !global_var.value[row][index];
  19759. (0, _jquery2.default)(value_container).find('.span_value_variable').text(_localizedStringsService.LocalizedStrings.getUI(global_var.value[row][index]));
  19760. }
  19761. function renderValues(global_var, global_container) {
  19762. var ret = "";
  19763. var j = 0;
  19764. if (global_var.dimensions == 0) {
  19765. if (global_var.type == _types.Types.REAL) {
  19766. ret += '<div class="created_div_valor_var"><span class="span_value_variable simple_var">' + global_var.value.toFixed(1) + '</span> </div> ';
  19767. } else {
  19768. if (global_var.type == _types.Types.BOOLEAN) {
  19769. ret += '<div class="created_div_valor_var"><span class="span_value_variable boolean_simple_type">' + _localizedStringsService.LocalizedStrings.getUI(global_var.value) + '</span> </div> ';
  19770. } else {
  19771. ret += '<div class="created_div_valor_var"><span class="span_value_variable simple_var">' + global_var.value + '</span> </div> ';
  19772. }
  19773. }
  19774. } else {
  19775. ret += '<table class="tabela_var">';
  19776. if (global_var.dimensions == 1) {
  19777. ret += '<tr>';
  19778. if (global_var.type == _types.Types.REAL) {
  19779. for (var k = 0; k < global_var.columns; k++) {
  19780. ret += '<td><span class="span_value_variable vector_var" data-index="' + k + '">' + global_var.value[k].toFixed(1) + '</span></td>';
  19781. }
  19782. } else {
  19783. for (var k = 0; k < global_var.columns; k++) {
  19784. if (global_var.type == _types.Types.BOOLEAN) {
  19785. ret += '<td><span class="span_value_variable boolean_vector_var" data-index="' + k + '">' + _localizedStringsService.LocalizedStrings.getUI(global_var.value[k]) + '</span></td>';
  19786. } else {
  19787. ret += '<td><span class="span_value_variable vector_var" data-index="' + k + '">' + global_var.value[k] + '</span>' + '</td>';
  19788. }
  19789. }
  19790. }
  19791. ret += '</tr>';
  19792. ret += '</table>';
  19793. 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>';
  19794. }
  19795. if (global_var.dimensions == 2) {
  19796. if (global_var.type == _types.Types.REAL) {
  19797. for (var l = 0; l < global_var.rows; l++) {
  19798. ret += '<tr>';
  19799. for (var k = 0; k < global_var.columns; k++) {
  19800. ret += '<td><span class="span_value_variable matrix_var" data-index="' + k + '" data-row="' + l + '">' + global_var.value[l][k].toFixed(1) + '</span>' + '</td>';
  19801. }
  19802. ret += '</tr>';
  19803. }
  19804. } else {
  19805. for (var l = 0; l < global_var.rows; l++) {
  19806. ret += '<tr>';
  19807. for (var k = 0; k < global_var.columns; k++) {
  19808. if (global_var.type == _types.Types.BOOLEAN) {
  19809. ret += '<td><span class="span_value_variable boolean_matrix_var" data-index="' + k + '" data-row="' + l + '">' + _localizedStringsService.LocalizedStrings.getUI(global_var.value[l][k]) + '</span></td>';
  19810. } else {
  19811. ret += '<td><span class="span_value_variable matrix_var" data-index="' + k + '" data-row="' + l + '">' + global_var.value[l][k] + '</span></td>';
  19812. }
  19813. }
  19814. ret += '</tr>';
  19815. }
  19816. }
  19817. if (global_var.rows == 0) {
  19818. ret += '<tr><td></td></tr>';
  19819. }
  19820. 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>';
  19821. ret += '</table>';
  19822. 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>';
  19823. }
  19824. }
  19825. global_container.find(".div_valor_var").html('');
  19826. ret = (0, _jquery2.default)(ret);
  19827. ret.find('.span_value_variable').data('associatedOject', global_var);
  19828. ret.find(".boolean_simple_type").on('click', function (e) {
  19829. alternateBooleanGlobalValue(global_var, this.parentNode);
  19830. });
  19831. ret.find(".simple_var").on('click', function (e) {
  19832. enableGlobalValueUpdate(global_var, this.parentNode);
  19833. });
  19834. ret.find(".boolean_vector_var").on('click', function (e) {
  19835. alternateBooleanGlobalVectorValue(global_var, (0, _jquery2.default)(this).data('index'), this.parentNode);
  19836. });
  19837. ret.find(".vector_var").on('click', function (e) {
  19838. enableGlobalVectorValueUpdate(global_var, (0, _jquery2.default)(this).data('index'), this.parentNode);
  19839. });
  19840. ret.find(".remove_global_vector_column").on('click', function (e) {
  19841. removeGlobalColumnVector(global_var);
  19842. global_container.find(".div_valor_var").html('');
  19843. renderValues(global_var, global_container);
  19844. });
  19845. ret.find(".add_global_vector_column").on('click', function (e) {
  19846. addGlobalColumnVector(global_var);
  19847. global_container.find(".div_valor_var").html('');
  19848. renderValues(global_var, global_container);
  19849. });
  19850. ret.find(".remove_global_matrix_column").on('click', function (e) {
  19851. removeColumnGlobalMatrix(global_var);
  19852. global_container.find(".div_valor_var").html('');
  19853. renderValues(global_var, global_container);
  19854. });
  19855. ret.find(".add_global_matrix_column").on('click', function (e) {
  19856. addColumnGlobalMatrix(global_var);
  19857. global_container.find(".div_valor_var").html('');
  19858. renderValues(global_var, global_container);
  19859. });
  19860. ret.find(".remove_global_matrix_line").on('click', function (e) {
  19861. removeLineGlobalMatrix(global_var);
  19862. global_container.find(".div_valor_var").html('');
  19863. renderValues(global_var, global_container);
  19864. });
  19865. ret.find(".add_global_matrix_line").on('click', function (e) {
  19866. addLineGlobalMatrix(global_var);
  19867. global_container.find(".div_valor_var").html('');
  19868. renderValues(global_var, global_container);
  19869. });
  19870. ret.find(".boolean_matrix_var").on('click', function (e) {
  19871. alternateBooleanGlobalMatrixValue(global_var, (0, _jquery2.default)(this).data('row'), (0, _jquery2.default)(this).data('index'), this.parentNode);
  19872. });
  19873. ret.find(".matrix_var").on('click', function (e) {
  19874. enableGlobalMatrixValueUpdate(global_var, (0, _jquery2.default)(this).data('row'), (0, _jquery2.default)(this).data('index'), this.parentNode);
  19875. });
  19876. global_container.find(".div_valor_var").append(ret);
  19877. updateColumnsAndRowsText(global_container, global_var);
  19878. }
  19879. function addHandlers(global_container) {
  19880. var global_var = global_container.data('associatedOject');
  19881. // Manage constant option:
  19882. global_container.find(".alternate_constant").on('click', function (e) {
  19883. toggleConstant(global_var);
  19884. (0, _jquery2.default)(this).removeClass("on off");
  19885. if (global_var.is_constant) {
  19886. (0, _jquery2.default)(this).addClass("on");
  19887. } else {
  19888. (0, _jquery2.default)(this).addClass("off");
  19889. }
  19890. });
  19891. // Manage global name:
  19892. global_container.find(".enable_edit_name_parameter").on('click', function (e) {
  19893. enableNameUpdate(global_container);
  19894. });
  19895. // Menu to change type:
  19896. global_container.find('.ui.dropdown.global_type').dropdown({
  19897. onChange: function onChange(value, text, $selectedItem) {
  19898. if ($selectedItem.data('dimensions')) {
  19899. updateType(global_var, _types.Types[$selectedItem.data('type')], $selectedItem.data('dimensions'));
  19900. } else {
  19901. updateType(global_var, _types.Types[$selectedItem.data('type')]);
  19902. }
  19903. renderValues(global_var, global_container);
  19904. }
  19905. });
  19906. // Remove global:
  19907. global_container.find(".remove_global").on('click', function (e) {
  19908. removeGlobal(global_var, global_container);
  19909. });
  19910. }
  19911. function updateColumnsAndRowsText(global_container, global_var) {
  19912. var prev = global_container.find('.text').text().split('[');
  19913. if (prev.length == 2) {
  19914. var ff = prev[0] + '[ ' + global_var.columns + ' ] ';
  19915. global_container.find('.text').empty();
  19916. global_container.find('.text').text(ff);
  19917. }
  19918. if (prev.length == 3) {
  19919. var ff = prev[0] + '[ ' + global_var.columns + ' ] [ ' + global_var.rows + ' ] ';
  19920. global_container.find('.text').empty();
  19921. global_container.find('.text').text(ff);
  19922. }
  19923. }
  19924. function renderGlobal(global_var) {
  19925. var element = '<div class="ui label global_container pink"><i class="ui icon ellipsis vertical inverted"></i><div class="global_const">const: ';
  19926. element += '<i class="ui icon toggle ' + (global_var.is_constant ? "on" : "off") + ' alternate_constant"></i></div>';
  19927. element += '<div class="ui dropdown global_type">';
  19928. if (global_var.dimensions > 0) {
  19929. element += '<div class="text">' + _localizedStringsService.LocalizedStrings.getUI('vector') + ':' + _localizedStringsService.LocalizedStrings.getUI(global_var.type);
  19930. for (var i = 0; i < global_var.dimensions; i++) {
  19931. element += ' [ <span class="dimensions_' + i + '"></span> ] ';
  19932. }
  19933. element += '</div>';
  19934. } else {
  19935. element += '<div class="text">' + _localizedStringsService.LocalizedStrings.getUI(global_var.type.toLowerCase()) + '</div>';
  19936. }
  19937. element += '<div class="menu">';
  19938. for (var tm in _types.Types) {
  19939. if (tm == _types.Types.VOID.toUpperCase()) {
  19940. continue;
  19941. }
  19942. element += '<div class="item ' + (global_var.type == tm.toLowerCase() ? ' selected ' : '') + '" data-type="' + tm + '" >' + _localizedStringsService.LocalizedStrings.getUI(tm.toLowerCase()) + '</div>';
  19943. }
  19944. for (var tm in _types.Types) {
  19945. if (tm == _types.Types.VOID.toUpperCase()) {
  19946. continue;
  19947. }
  19948. element += '<div class="item">' + '<i class="dropdown icon"></i>' + _localizedStringsService.LocalizedStrings.getUI('vector') + ':' + _localizedStringsService.LocalizedStrings.getUI(tm.toLowerCase()) + '<div class="menu">' + '<div class="item" data-text="' + _localizedStringsService.LocalizedStrings.getUI('vector') + ':' + _localizedStringsService.LocalizedStrings.getUI(tm.toLowerCase()) + ' [ ] " data-type="' + tm + '" data-dimensions="1">[ ]</div>' + '<div class="item" data-text="' + _localizedStringsService.LocalizedStrings.getUI('vector') + ':' + _localizedStringsService.LocalizedStrings.getUI(tm.toLowerCase()) + ' [ ] [ ] " data-type="' + tm + '" data-dimensions="2">[ ] [ ] </div>' + '</div>' + '</div>';
  19949. }
  19950. 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> ';
  19951. element += '<div class="ui div_valor_var">' + global_var.value + '</div>';
  19952. element += ' <i class="yellow inverted icon times remove_global"></i></div>';
  19953. var complete_element = (0, _jquery2.default)(element);
  19954. complete_element.data('associatedOject', global_var);
  19955. (0, _jquery2.default)('.list_globals').append(complete_element);
  19956. addHandlers(complete_element);
  19957. renderValues(global_var, complete_element);
  19958. if (global_var.dimensions == 1) {
  19959. complete_element.find('.dimensions_0').text(global_var.columns);
  19960. }
  19961. if (global_var.dimensions == 2) {
  19962. complete_element.find('.dimensions_0').text(global_var.columns);
  19963. complete_element.find('.dimensions_1').text(global_var.rows);
  19964. }
  19965. return complete_element;
  19966. }
  19967. var opened_name_value_matrix_global_v = false;
  19968. var opened_input_value_matrix_global_v = null;
  19969. function enableGlobalMatrixValueUpdate(global_var, row, index, parent_node) {
  19970. if (opened_name_value_matrix_global_v) {
  19971. opened_input_value_matrix_global_v.focus();
  19972. return;
  19973. }
  19974. parent_node = (0, _jquery2.default)(parent_node);
  19975. opened_name_value_matrix_global_v = true;
  19976. parent_node.find('.span_value_variable').text('');
  19977. var input_field;
  19978. if (global_var.type == _types.Types.REAL) {
  19979. input_field = (0, _jquery2.default)("<input type='text' class='width-dynamic input_name_function' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' value='" + global_var.value[row][index].toFixed(1) + "' />");
  19980. input_field.insertBefore(parent_node.find('.span_value_variable'));
  19981. } else {
  19982. input_field = (0, _jquery2.default)("<input type='text' class='width-dynamic input_name_function' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' value='" + global_var.value[row][index] + "' />");
  19983. input_field.insertBefore(parent_node.find('.span_value_variable'));
  19984. }
  19985. input_field.on('input', function () {
  19986. var inputWidth = input_field.textWidth() + 10;
  19987. opened_input_value_matrix_global_v = input_field;
  19988. input_field.focus();
  19989. var tmpStr = input_field.val();
  19990. input_field.val('');
  19991. input_field.val(tmpStr);
  19992. input_field.css({
  19993. width: inputWidth
  19994. });
  19995. }).trigger('input');
  19996. input_field.focusout(function () {
  19997. /// update array:
  19998. if (input_field.val().trim()) {
  19999. if (global_var.type == _types.Types.REAL) {
  20000. global_var.value[row][index] = parseFloat(input_field.val().trim());
  20001. parent_node.find('.span_value_variable').text(global_var.value[row][index].toFixed(1));
  20002. } else {
  20003. if (global_var.type == _types.Types.INTEGER) {
  20004. global_var.value[row][index] = parseInt(input_field.val().trim());
  20005. } else {
  20006. global_var.value[row][index] = input_field.val().trim();
  20007. }
  20008. parent_node.find('.span_value_variable').text(global_var.value[row][index]);
  20009. }
  20010. } else {
  20011. if (global_var.type == _types.Types.REAL) {
  20012. parent_node.find('.span_value_variable').text(global_var.value[row][index].toFixed(1));
  20013. } else {
  20014. parent_node.find('.span_value_variable').text(global_var.value[row][index]);
  20015. }
  20016. }
  20017. if (global_var.type == _types.Types.TEXT) {
  20018. global_var.value[row][index] = input_field.val();
  20019. parent_node.find('.span_value_variable').text(global_var.value[row][index]);
  20020. }
  20021. input_field.off();
  20022. input_field.remove();
  20023. /// update elements:
  20024. opened_name_value_matrix_global_v = false;
  20025. opened_input_value_matrix_global_v = false;
  20026. });
  20027. input_field.on('keydown', function (e) {
  20028. var code = e.keyCode || e.which;
  20029. if (code == 13) {
  20030. if (input_field.val().trim()) {
  20031. if (global_var.type == _types.Types.REAL) {
  20032. global_var.value[row][index] = parseFloat(input_field.val().trim());
  20033. parent_node.find('.span_value_variable').text(global_var.value[row][index].toFixed(1));
  20034. } else {
  20035. if (global_var.type == _types.Types.INTEGER) {
  20036. global_var.value[row][index] = parseInt(input_field.val().trim());
  20037. } else {
  20038. global_var.value[row][index] = input_field.val().trim();
  20039. }
  20040. parent_node.find('.span_value_variable').text(global_var.value[row][index]);
  20041. }
  20042. } else {
  20043. if (global_var.type == _types.Types.REAL) {
  20044. parent_node.find('.span_value_variable').text(global_var.value[row][index].toFixed(1));
  20045. } else {
  20046. parent_node.find('.span_value_variable').text(global_var.value[row][index]);
  20047. }
  20048. }
  20049. if (global_var.type == _types.Types.TEXT) {
  20050. global_var.value[row][index] = input_field.val();
  20051. parent_node.find('.span_value_variable').text(global_var.value[row][index]);
  20052. }
  20053. input_field.off();
  20054. input_field.remove();
  20055. /// update elements:
  20056. opened_name_value_matrix_global_v = false;
  20057. opened_input_value_matrix_global_v = false;
  20058. }
  20059. if (code == 27) {
  20060. if (global_var.type == _types.Types.REAL) {
  20061. parent_node.find('.span_value_variable').text(global_var.value[row][index].toFixed(1));
  20062. } else {
  20063. parent_node.find('.span_value_variable').text(global_var.value[row][index]);
  20064. }
  20065. input_field.off();
  20066. input_field.remove();
  20067. /// update elements:
  20068. opened_name_value_matrix_global_v = false;
  20069. opened_input_value_matrix_global_v = false;
  20070. }
  20071. });
  20072. input_field.select();
  20073. }
  20074. var opened_name_value_global_var = false;
  20075. var opened_input_value_global_ar = null;
  20076. function enableGlobalValueUpdate(global_var, parent_node) {
  20077. if (opened_name_value_global_var) {
  20078. opened_input_value_global_ar.focus();
  20079. return;
  20080. }
  20081. parent_node = (0, _jquery2.default)(parent_node);
  20082. opened_name_value_global_var = true;
  20083. parent_node.find('.span_value_variable').text('');
  20084. var input_field;
  20085. if (global_var.type == _types.Types.REAL) {
  20086. input_field = (0, _jquery2.default)("<input type='text' class='width-dynamic input_name_function' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' value='" + global_var.value.toFixed(1) + "' />");
  20087. input_field.insertBefore(parent_node.find('.span_value_variable'));
  20088. } else {
  20089. input_field = (0, _jquery2.default)("<input type='text' class='width-dynamic input_name_function' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' value='" + global_var.value + "' />");
  20090. input_field.insertBefore(parent_node.find('.span_value_variable'));
  20091. }
  20092. input_field.on('input', function () {
  20093. var inputWidth = input_field.textWidth() + 10;
  20094. opened_input_value_global_ar = input_field;
  20095. input_field.focus();
  20096. var tmpStr = input_field.val();
  20097. input_field.val('');
  20098. input_field.val(tmpStr);
  20099. input_field.css({
  20100. width: inputWidth
  20101. });
  20102. }).trigger('input');
  20103. input_field.focusout(function () {
  20104. /// update array:
  20105. if (input_field.val().trim()) {
  20106. if (global_var.type == _types.Types.REAL) {
  20107. global_var.value = parseFloat(input_field.val().trim());
  20108. parent_node.find('.span_value_variable').text(global_var.value.toFixed(1));
  20109. } else {
  20110. if (global_var.type == _types.Types.INTEGER) {
  20111. global_var.value = parseInt(input_field.val().trim());
  20112. } else {
  20113. global_var.value = input_field.val().trim();
  20114. }
  20115. parent_node.find('.span_value_variable').text(global_var.value);
  20116. }
  20117. } else {
  20118. if (global_var.type == _types.Types.REAL) {
  20119. parent_node.find('.span_value_variable').text(global_var.value.toFixed(1));
  20120. } else {
  20121. parent_node.find('.span_value_variable').text(global_var.value);
  20122. }
  20123. }
  20124. if (global_var.type == _types.Types.TEXT) {
  20125. global_var.value = input_field.val();
  20126. parent_node.find('.span_value_variable').text(global_var.value);
  20127. }
  20128. input_field.off();
  20129. input_field.remove();
  20130. /// update elements:
  20131. opened_name_value_global_var = false;
  20132. opened_input_value_global_ar = false;
  20133. });
  20134. input_field.on('keydown', function (e) {
  20135. var code = e.keyCode || e.which;
  20136. if (code == 13) {
  20137. if (input_field.val().trim()) {
  20138. if (global_var.type == _types.Types.REAL) {
  20139. global_var.value = parseFloat(input_field.val().trim());
  20140. parent_node.find('.span_value_variable').text(global_var.value.toFixed(1));
  20141. } else {
  20142. if (global_var.type == _types.Types.INTEGER) {
  20143. global_var.value = parseInt(input_field.val().trim());
  20144. } else {
  20145. global_var.value = input_field.val().trim();
  20146. }
  20147. parent_node.find('.span_value_variable').text(global_var.value);
  20148. }
  20149. } else {
  20150. if (global_var.type == _types.Types.REAL) {
  20151. parent_node.find('.span_value_variable').text(global_var.value.toFixed(1));
  20152. } else {
  20153. parent_node.find('.span_value_variable').text(global_var.value);
  20154. }
  20155. }
  20156. if (global_var.type == _types.Types.TEXT) {
  20157. global_var.value = input_field.val();
  20158. parent_node.find('.span_value_variable').text(global_var.value);
  20159. }
  20160. input_field.off();
  20161. input_field.remove();
  20162. /// update elements:
  20163. opened_name_value_global_var = false;
  20164. opened_input_value_global_ar = false;
  20165. }
  20166. if (code == 27) {
  20167. if (global_var.type == _types.Types.REAL) {
  20168. parent_node.find('.span_value_variable').text(global_var.value.toFixed(1));
  20169. } else {
  20170. parent_node.find('.span_value_variable').text(global_var.value);
  20171. }
  20172. input_field.off();
  20173. input_field.remove();
  20174. /// update elements:
  20175. opened_name_value_global_var = false;
  20176. opened_input_value_global_ar = false;
  20177. }
  20178. });
  20179. input_field.select();
  20180. }
  20181. var opened_name_global = false;
  20182. var opened_input_global = null;
  20183. function enableNameUpdate(global_container) {
  20184. var global_var = global_container.data('associatedOject');
  20185. if (opened_name_global) {
  20186. opened_input_global.focus();
  20187. return;
  20188. }
  20189. opened_name_global = true;
  20190. global_container.find('.span_name_variable').text('');
  20191. var input_name = (0, _jquery2.default)("<input type='text' class='width-dynamic input_name_function' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' value='" + global_var.name + "' />");
  20192. input_name.insertBefore(global_container.find('.span_name_variable'));
  20193. input_name.on('input', function () {
  20194. var inputWidth = input_name.textWidth() + 10;
  20195. opened_input_global = input_name;
  20196. opened_input_global.focus();
  20197. opened_input_global.css({
  20198. width: inputWidth
  20199. });
  20200. }).trigger('input');
  20201. input_name.focusout(function () {
  20202. /// update array:
  20203. if (input_name.val().trim().length > 0) {
  20204. updateName(global_var, input_name.val().trim());
  20205. global_container.find('.span_name_variable').text(global_var.name);
  20206. } else {
  20207. global_container.find('.span_name_variable').text(global_var.name);
  20208. }
  20209. input_name.off();
  20210. input_name.remove();
  20211. /// update elements:
  20212. opened_name_global = false;
  20213. opened_input_global = false;
  20214. });
  20215. input_name.on('keydown', function (e) {
  20216. var code = e.keyCode || e.which;
  20217. if (code == 13) {
  20218. if (input_name.val().trim()) {
  20219. updateName(global_var, input_name.val().trim());
  20220. global_container.find('.span_name_variable').text(global_var.name);
  20221. } else {
  20222. global_container.find('.span_name_variable').text(global_var.name);
  20223. }
  20224. input_name.off();
  20225. input_name.remove();
  20226. /// update elements:
  20227. opened_name_global = false;
  20228. opened_input_global = false;
  20229. }
  20230. if (code == 27) {
  20231. global_container.find('.span_name_variable').text(global_var.name);
  20232. input_name.off();
  20233. input_name.remove();
  20234. /// update elements:
  20235. opened_name_global = false;
  20236. opened_input_global = false;
  20237. }
  20238. });
  20239. input_name.select();
  20240. }
  20241. var opened_name_value_vector_global_ = false;
  20242. var opened_input_value_vector_global_ = null;
  20243. function enableGlobalVectorValueUpdate(global_var, index, parent_node) {
  20244. if (opened_name_value_vector_global_) {
  20245. opened_input_value_vector_global_.focus();
  20246. return;
  20247. }
  20248. parent_node = (0, _jquery2.default)(parent_node);
  20249. opened_name_value_vector_global_ = true;
  20250. parent_node.find('.span_value_variable').text('');
  20251. var input_field;
  20252. if (global_var.type == _types.Types.REAL) {
  20253. input_field = (0, _jquery2.default)("<input type='text' class='width-dynamic input_name_function' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' value='" + global_var.value[index].toFixed(1) + "' />");
  20254. input_field.insertBefore(parent_node.find('.span_value_variable'));
  20255. } else {
  20256. input_field = (0, _jquery2.default)("<input type='text' class='width-dynamic input_name_function' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' value='" + global_var.value[index] + "' />");
  20257. input_field.insertBefore(parent_node.find('.span_value_variable'));
  20258. }
  20259. input_field.on('input', function () {
  20260. var inputWidth = input_field.textWidth() + 10;
  20261. opened_input_value_vector_global_ = input_field;
  20262. input_field.focus();
  20263. var tmpStr = input_field.val();
  20264. input_field.val('');
  20265. input_field.val(tmpStr);
  20266. input_field.css({
  20267. width: inputWidth
  20268. });
  20269. }).trigger('input');
  20270. input_field.focusout(function () {
  20271. /// update array:
  20272. if (input_field.val().trim()) {
  20273. if (global_var.type == _types.Types.REAL) {
  20274. global_var.value[index] = parseFloat(input_field.val().trim());
  20275. parent_node.find('.span_value_variable').text(global_var.value[index].toFixed(1));
  20276. } else {
  20277. if (global_var.type == _types.Types.INTEGER) {
  20278. global_var.value[index] = parseInt(input_field.val().trim());
  20279. } else {
  20280. global_var.value[index] = input_field.val().trim();
  20281. }
  20282. parent_node.find('.span_value_variable').text(global_var.value[index]);
  20283. }
  20284. } else {
  20285. if (global_var.type == _types.Types.REAL) {
  20286. parent_node.find('.span_value_variable').text(global_var.value[index].toFixed(1));
  20287. } else {
  20288. parent_node.find('.span_value_variable').text(global_var.value[index]);
  20289. }
  20290. }
  20291. if (global_var.type == _types.Types.TEXT) {
  20292. global_var.value[index] = input_field.val();
  20293. parent_node.find('.span_value_variable').text(global_var.value[index]);
  20294. }
  20295. input_field.off();
  20296. input_field.remove();
  20297. /// update elements:
  20298. opened_name_value_vector_global_ = false;
  20299. opened_input_value_vector_global_ = false;
  20300. });
  20301. input_field.on('keydown', function (e) {
  20302. var code = e.keyCode || e.which;
  20303. if (code == 13) {
  20304. if (input_field.val().trim()) {
  20305. if (global_var.type == _types.Types.REAL) {
  20306. global_var.value[index] = parseFloat(input_field.val().trim());
  20307. parent_node.find('.span_value_variable').text(global_var.value[index].toFixed(1));
  20308. } else {
  20309. if (global_var.type == _types.Types.INTEGER) {
  20310. global_var.value[index] = parseInt(input_field.val().trim());
  20311. } else {
  20312. global_var.value[index] = input_field.val().trim();
  20313. }
  20314. parent_node.find('.span_value_variable').text(global_var.value[index]);
  20315. }
  20316. } else {
  20317. if (global_var.type == _types.Types.REAL) {
  20318. parent_node.find('.span_value_variable').text(global_var.value[index].toFixed(1));
  20319. } else {
  20320. parent_node.find('.span_value_variable').text(global_var.value[index]);
  20321. }
  20322. }
  20323. if (global_var.type == _types.Types.TEXT) {
  20324. global_var.value[index] = input_field.val();
  20325. parent_node.find('.span_value_variable').text(global_var.value[index]);
  20326. }
  20327. input_field.off();
  20328. input_field.remove();
  20329. /// update elements:
  20330. opened_name_value_vector_global_ = false;
  20331. opened_input_value_vector_global_ = false;
  20332. }
  20333. if (code == 27) {
  20334. if (global_var.type == _types.Types.REAL) {
  20335. parent_node.find('.span_value_variable').text(global_var.value[index].toFixed(1));
  20336. } else {
  20337. parent_node.find('.span_value_variable').text(global_var.value[index]);
  20338. }
  20339. input_field.off();
  20340. input_field.remove();
  20341. /// update elements:
  20342. opened_name_value_vector_global_ = false;
  20343. opened_input_value_vector_global_ = false;
  20344. }
  20345. });
  20346. input_field.select();
  20347. }
  20348. _jquery2.default.fn.textWidth = function (text, font) {
  20349. if (!_jquery2.default.fn.textWidth.fakeEl) _jquery2.default.fn.textWidth.fakeEl = (0, _jquery2.default)('<span>').hide().appendTo(document.body);
  20350. _jquery2.default.fn.textWidth.fakeEl.text(text || this.val() || this.text() || this.attr('placeholder')).css('font', font || this.css('font'));
  20351. return _jquery2.default.fn.textWidth.fakeEl.width();
  20352. };
  20353. /***/ }),
  20354. /***/ "./js/visualUI/ivprog_elements.js":
  20355. /*!****************************************!*\
  20356. !*** ./js/visualUI/ivprog_elements.js ***!
  20357. \****************************************/
  20358. /*! no static exports found */
  20359. /***/ (function(module, exports, __webpack_require__) {
  20360. "use strict";
  20361. Object.defineProperty(exports, "__esModule", {
  20362. value: true
  20363. });
  20364. exports.Program = exports.FunctionCallMenu = exports.VariableValueMenu = exports.FunctionCall = exports.SwitchCase = exports.Return = exports.Switch = exports.DoWhileTrue = exports.WhileTrue = exports.RepeatNTimes = exports.IfTrue = exports.ArithmeticExpression = exports.LogicExpression = exports.ConditionalExpression = exports.ExpressionElement = exports.Attribution = exports.Writer = exports.Reader = exports.Break = exports.Comment = exports.SystemFunction = exports.Function = exports.Variable = exports.SYSTEM_FUNCTIONS_CATEGORIES = exports.LOGIC_COMPARISON = exports.ARITHMETIC_COMPARISON = exports.EXPRESSION_TYPES = exports.EXPRESSION_ELEMENTS = exports.ARITHMETIC_TYPES = exports.COMMAND_TYPES = undefined;
  20365. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  20366. var _variable_value_menu = __webpack_require__(/*! ./commands/variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  20367. var VariableValueMenuManagement = _interopRequireWildcard(_variable_value_menu);
  20368. var _types = __webpack_require__(/*! ./types */ "./js/visualUI/types.js");
  20369. var _melankeWatchjs = __webpack_require__(/*! melanke-watchjs */ "./node_modules/melanke-watchjs/src/watch.js");
  20370. var _melankeWatchjs2 = _interopRequireDefault(_melankeWatchjs);
  20371. var _algorithm = __webpack_require__(/*! ./algorithm */ "./js/visualUI/algorithm.js");
  20372. var AlgorithmManagement = _interopRequireWildcard(_algorithm);
  20373. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  20374. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  20375. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  20376. var COMMAND_TYPES = exports.COMMAND_TYPES = Object.freeze({ function: "function", comment: "comment", reader: "reader", writer: "writer", attribution: "attribution", iftrue: "iftrue",
  20377. repeatNtimes: "repeatNtimes", whiletrue: "whiletrue", dowhiletrue: "dowhiletrue", switch: "switch", switchcase: "switchcase", functioncall: "functioncall", break: "break",
  20378. return: "return" });
  20379. var ARITHMETIC_TYPES = exports.ARITHMETIC_TYPES = Object.freeze({ plus: "plus", minus: "minus", multiplication: "multiplication", division: "division", module: "module", none: "none" });
  20380. var EXPRESSION_ELEMENTS = exports.EXPRESSION_ELEMENTS = Object.freeze({ exp_op_exp: "exp_op_exp", op_exp: "op_exp", par_exp_par: "par_exp_par", start_point: "start_point" });
  20381. var EXPRESSION_TYPES = exports.EXPRESSION_TYPES = Object.freeze({ exp_conditional: "exp_conditional", exp_logic: "exp_logic", exp_arithmetic: "exp_arithmetic" });
  20382. var ARITHMETIC_COMPARISON = exports.ARITHMETIC_COMPARISON = Object.freeze({ greater_than: "greater_than", less_than: "less_than", equals_to: "equals_to", not_equals_to: "not_equals_to", greater_than_or_equals_to: "greater_than_or_equals_to", less_than_or_equals_to: "less_than_or_equals_to" });
  20383. var LOGIC_COMPARISON = exports.LOGIC_COMPARISON = Object.freeze({ equals_to: "equals_to", not_equals_to: "not_equals_to", and: "and", or: "or" });
  20384. var SYSTEM_FUNCTIONS_CATEGORIES = exports.SYSTEM_FUNCTIONS_CATEGORIES = Object.freeze({ math: "math", text: "text_t", arrangement: "arrangement", conversion: "conversion" });
  20385. var Variable = exports.Variable = function Variable(type, name, value) {
  20386. var dimensions = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
  20387. var is_constant = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
  20388. var rows = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 0;
  20389. var columns = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : 0;
  20390. _classCallCheck(this, Variable);
  20391. this.type = type;
  20392. this.name = name;
  20393. this.value = value;
  20394. this.dimensions = dimensions;
  20395. this.is_constant = is_constant;
  20396. this.rows = rows;
  20397. this.columns = columns;
  20398. };
  20399. var Function = exports.Function = function Function(name) {
  20400. var return_type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _types.Types.VOID;
  20401. var return_dimensions = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
  20402. var parameters_list = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : [];
  20403. var is_main = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
  20404. var is_hidden = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : false;
  20405. var variables_list = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : [];
  20406. var function_comment = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : null;
  20407. var commands = arguments.length > 8 && arguments[8] !== undefined ? arguments[8] : [];
  20408. _classCallCheck(this, Function);
  20409. this.type = COMMAND_TYPES.function;
  20410. this.name = name;
  20411. this.return_type = return_type;
  20412. this.return_dimensions = return_dimensions;
  20413. this.parameters_list = parameters_list;
  20414. this.is_main = is_main;
  20415. this.is_hidden = is_hidden;
  20416. this.variables_list = variables_list;
  20417. this.function_comment = function_comment;
  20418. this.commands = commands;
  20419. };
  20420. var SystemFunction = exports.SystemFunction = function SystemFunction(identifier, return_type, return_dimensions, parameters_list) {
  20421. var function_comment = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : null;
  20422. var category = arguments[5];
  20423. _classCallCheck(this, SystemFunction);
  20424. this.type = COMMAND_TYPES.function;
  20425. this.identifier = identifier;
  20426. this.return_type = return_type;
  20427. this.return_dimensions = return_dimensions;
  20428. this.parameters_list = parameters_list;
  20429. this.function_comment = function_comment;
  20430. this.category = category;
  20431. };
  20432. var Comment = exports.Comment = function Comment(comment_text) {
  20433. _classCallCheck(this, Comment);
  20434. this.type = COMMAND_TYPES.comment;
  20435. this.comment_text = comment_text;
  20436. };
  20437. var Break = exports.Break = function Break() {
  20438. _classCallCheck(this, Break);
  20439. this.type = COMMAND_TYPES.break;
  20440. };
  20441. var Reader = exports.Reader = function Reader() {
  20442. var variable_value_menu = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : new VariableValueMenu();
  20443. _classCallCheck(this, Reader);
  20444. this.type = COMMAND_TYPES.reader;
  20445. this.variable_value_menu = variable_value_menu;
  20446. };
  20447. var Writer = exports.Writer = function Writer(content) {
  20448. _classCallCheck(this, Writer);
  20449. this.type = COMMAND_TYPES.writer;
  20450. this.content = content;
  20451. };
  20452. var Attribution = exports.Attribution = function Attribution(variable) {
  20453. var expression = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
  20454. _classCallCheck(this, Attribution);
  20455. this.type = COMMAND_TYPES.attribution;
  20456. this.variable = variable;
  20457. this.expression = expression;
  20458. };
  20459. var ExpressionElement = exports.ExpressionElement = function ExpressionElement(type_exp) {
  20460. var itens = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
  20461. _classCallCheck(this, ExpressionElement);
  20462. this.type_exp = type_exp;
  20463. this.itens = itens;
  20464. };
  20465. var ConditionalExpression = exports.ConditionalExpression = function ConditionalExpression(expression) {
  20466. _classCallCheck(this, ConditionalExpression);
  20467. this.type = EXPRESSION_TYPES.exp_conditional;
  20468. this.expression = expression;
  20469. };
  20470. var LogicExpression = exports.LogicExpression = function LogicExpression(has_neg, first_operand, second_operand, operator) {
  20471. _classCallCheck(this, LogicExpression);
  20472. this.type = EXPRESSION_TYPES.exp_logic;
  20473. this.has_neg = has_neg;
  20474. this.first_operand = first_operand;
  20475. this.second_operand = second_operand;
  20476. this.operator = operator;
  20477. };
  20478. var ArithmeticExpression = exports.ArithmeticExpression = function ArithmeticExpression(first_operand, second_operand, operator) {
  20479. _classCallCheck(this, ArithmeticExpression);
  20480. this.type = EXPRESSION_TYPES.exp_arithmetic;
  20481. this.first_operand = first_operand;
  20482. this.second_operand = second_operand;
  20483. this.operator = operator;
  20484. };
  20485. var IfTrue = exports.IfTrue = function IfTrue(expression, commands_block, commands_else) {
  20486. _classCallCheck(this, IfTrue);
  20487. this.type = COMMAND_TYPES.iftrue;
  20488. this.expression = expression;
  20489. this.commands_block = commands_block;
  20490. this.commands_else = commands_else;
  20491. };
  20492. var RepeatNTimes = exports.RepeatNTimes = function RepeatNTimes(var_attribution, var_incrementation, expression1, expression2, expression3, commands_block) {
  20493. _classCallCheck(this, RepeatNTimes);
  20494. this.type = COMMAND_TYPES.repeatNtimes;
  20495. this.var_attribution = var_attribution;
  20496. this.var_incrementation = var_incrementation;
  20497. this.expression1 = expression1;
  20498. this.expression2 = expression2;
  20499. this.expression3 = expression3;
  20500. this.commands_block = commands_block;
  20501. };
  20502. var WhileTrue = exports.WhileTrue = function WhileTrue(expression, commands_block) {
  20503. _classCallCheck(this, WhileTrue);
  20504. this.type = COMMAND_TYPES.whiletrue;
  20505. this.expression = expression;
  20506. this.commands_block = commands_block;
  20507. };
  20508. var DoWhileTrue = exports.DoWhileTrue = function DoWhileTrue(expression, commands_block) {
  20509. _classCallCheck(this, DoWhileTrue);
  20510. this.type = COMMAND_TYPES.dowhiletrue;
  20511. this.expression = expression;
  20512. this.commands_block = commands_block;
  20513. };
  20514. var Switch = exports.Switch = function Switch(variable) {
  20515. var cases = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
  20516. _classCallCheck(this, Switch);
  20517. this.type = COMMAND_TYPES.switch;
  20518. this.variable = variable;
  20519. this.cases = cases;
  20520. };
  20521. var Return = exports.Return = function Return(variable_value_menu) {
  20522. _classCallCheck(this, Return);
  20523. this.type = COMMAND_TYPES.return;
  20524. this.variable_value_menu = variable_value_menu;
  20525. };
  20526. var SwitchCase = exports.SwitchCase = function SwitchCase(variable_value_menu) {
  20527. var commands_block = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
  20528. _classCallCheck(this, SwitchCase);
  20529. this.type = COMMAND_TYPES.switchcase;
  20530. this.variable_value_menu = variable_value_menu;
  20531. this.commands_block = commands_block;
  20532. };
  20533. var FunctionCall = exports.FunctionCall = function FunctionCall(function_called, parameters_list) {
  20534. _classCallCheck(this, FunctionCall);
  20535. this.type = COMMAND_TYPES.functioncall;
  20536. this.function_called = function_called;
  20537. this.parameters_list = parameters_list;
  20538. };
  20539. var VariableValueMenu = exports.VariableValueMenu = function VariableValueMenu() {
  20540. var variable_and_value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 7;
  20541. var content = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
  20542. var row = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
  20543. var column = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
  20544. var include_constant = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : true;
  20545. _classCallCheck(this, VariableValueMenu);
  20546. this.type = "var_value";
  20547. this.variable_and_value = variable_and_value;
  20548. this.content = content;
  20549. this.row = row;
  20550. this.column = column;
  20551. this.include_constant = include_constant;
  20552. };
  20553. var FunctionCallMenu = exports.FunctionCallMenu = function FunctionCallMenu() {
  20554. var function_called = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
  20555. var parameters_list = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
  20556. _classCallCheck(this, FunctionCallMenu);
  20557. this.type = "function_call";
  20558. this.function_called = function_called;
  20559. this.parameters_list = parameters_list;
  20560. };
  20561. var Program = exports.Program = function () {
  20562. function Program() {
  20563. _classCallCheck(this, Program);
  20564. this.functions = [];
  20565. this.globals = [];
  20566. }
  20567. _createClass(Program, [{
  20568. key: 'addFunction',
  20569. value: function addFunction(function_to_add) {
  20570. _melankeWatchjs2.default.watch(function_to_add.parameters_list, function () {
  20571. if (window.insertContext) {
  20572. setTimeout(function () {
  20573. AlgorithmManagement.renderAlgorithm();
  20574. }, 300);
  20575. window.insertContext = false;
  20576. } else {
  20577. AlgorithmManagement.renderAlgorithm();
  20578. }
  20579. }, 1);
  20580. _melankeWatchjs2.default.watch(function_to_add.variables_list, function () {
  20581. if (window.insertContext) {
  20582. setTimeout(function () {
  20583. AlgorithmManagement.renderAlgorithm();
  20584. }, 300);
  20585. window.insertContext = false;
  20586. } else {
  20587. AlgorithmManagement.renderAlgorithm();
  20588. }
  20589. }, 1);
  20590. this.functions.push(function_to_add);
  20591. }
  20592. }, {
  20593. key: 'addVariable',
  20594. value: function addVariable(function_to_receive, variable) {
  20595. if (this.functions[function_to_receive].variable === null) {
  20596. this.functions[function_to_receive].variables_list = [];
  20597. }
  20598. this.functions[function_to_receive].variables_list.push(variable);
  20599. }
  20600. }, {
  20601. key: 'addGlobal',
  20602. value: function addGlobal(variable) {
  20603. this.globals.push(variable);
  20604. }
  20605. }]);
  20606. return Program;
  20607. }();
  20608. /***/ }),
  20609. /***/ "./js/visualUI/types.js":
  20610. /*!******************************!*\
  20611. !*** ./js/visualUI/types.js ***!
  20612. \******************************/
  20613. /*! no static exports found */
  20614. /***/ (function(module, exports, __webpack_require__) {
  20615. "use strict";
  20616. Object.defineProperty(exports, "__esModule", {
  20617. value: true
  20618. });
  20619. var Types = exports.Types = Object.freeze({
  20620. INTEGER: "integer",
  20621. REAL: "real",
  20622. TEXT: "text",
  20623. BOOLEAN: "boolean",
  20624. VOID: "void"
  20625. });
  20626. /***/ }),
  20627. /***/ "./js/visualUI/variables.js":
  20628. /*!**********************************!*\
  20629. !*** ./js/visualUI/variables.js ***!
  20630. \**********************************/
  20631. /*! no static exports found */
  20632. /***/ (function(module, exports, __webpack_require__) {
  20633. "use strict";
  20634. Object.defineProperty(exports, "__esModule", {
  20635. value: true
  20636. });
  20637. exports.addVariable = addVariable;
  20638. exports.renderVariable = renderVariable;
  20639. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  20640. var _jquery2 = _interopRequireDefault(_jquery);
  20641. var _types = __webpack_require__(/*! ./types */ "./js/visualUI/types.js");
  20642. var _ivprog_elements = __webpack_require__(/*! ./ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  20643. var Models = _interopRequireWildcard(_ivprog_elements);
  20644. var _localizedStringsService = __webpack_require__(/*! ./../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  20645. __webpack_require__(/*! ../semantic/semantic.min.js */ "./js/semantic/semantic.min.js");
  20646. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  20647. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  20648. window.jQuery = _jquery2.default;
  20649. var counter_new_variables = 0;
  20650. function addVariable(function_obj, function_container) {
  20651. var is_in_click = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  20652. var new_var = new Models.Variable(_types.Types.INTEGER, _localizedStringsService.LocalizedStrings.getUI('new_variable') + '_' + counter_new_variables, 1);
  20653. if (function_obj.variables_list == null) {
  20654. function_obj.variables_list = [];
  20655. }
  20656. function_obj.variables_list.push(new_var);
  20657. counter_new_variables++;
  20658. var newe = renderVariable(function_container, new_var, function_obj);
  20659. if (is_in_click) {
  20660. newe.css('display', 'none');
  20661. newe.fadeIn();
  20662. }
  20663. }
  20664. function updateName(variable_obj, new_name) {
  20665. variable_obj.name = new_name;
  20666. }
  20667. function removeVariable(variable_obj, variable_container) {
  20668. var function_associated = variable_container.data('associatedFunction');
  20669. var index = function_associated.variables_list.indexOf(variable_obj);
  20670. if (index > -1) {
  20671. window.insertContext = true;
  20672. delete function_associated.variables_list[index];
  20673. function_associated.variables_list.splice(index, 1);
  20674. }
  20675. variable_container.children().off();
  20676. variable_container.off();
  20677. variable_container.fadeOut();
  20678. }
  20679. function updateType(variable_obj, new_type) {
  20680. var new_dimensions = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
  20681. variable_obj.type = new_type;
  20682. variable_obj.dimensions = new_dimensions;
  20683. if (new_dimensions > 0) {
  20684. variable_obj.rows = new_dimensions;
  20685. variable_obj.columns = 2;
  20686. }
  20687. updateInitialValues(variable_obj);
  20688. }
  20689. function addHandlers(variable_obj, variable_container) {
  20690. // Manage variable name:
  20691. variable_container.find(".enable_edit_name_variable").on('click', function (e) {
  20692. enableNameUpdate(variable_obj, variable_container);
  20693. });
  20694. // Menu to change type:
  20695. variable_container.find('.ui.dropdown.variable_type').dropdown({
  20696. onChange: function onChange(value, text, $selectedItem) {
  20697. if ($selectedItem.data('dimensions')) {
  20698. updateType(variable_obj, _types.Types[$selectedItem.data('type')], $selectedItem.data('dimensions'));
  20699. } else {
  20700. updateType(variable_obj, _types.Types[$selectedItem.data('type')]);
  20701. }
  20702. renderValues(variable_obj, variable_container);
  20703. }
  20704. });
  20705. // Remove variable:
  20706. variable_container.find(".remove_variable").on('click', function (e) {
  20707. removeVariable(variable_obj, variable_container);
  20708. });
  20709. }
  20710. function renderVariable(function_container, new_var, function_obj) {
  20711. var element = '<div class="ui label variable_container pink"><i class="ui icon ellipsis vertical inverted"></i>';
  20712. element += '<div class="ui dropdown variable_type">';
  20713. if (new_var.dimensions > 0) {
  20714. element += '<div class="text">' + _localizedStringsService.LocalizedStrings.getUI('vector') + ':' + _localizedStringsService.LocalizedStrings.getUI(new_var.type.toLowerCase());
  20715. for (var i = 0; i < new_var.dimensions; i++) {
  20716. element += ' [ ] ';
  20717. }
  20718. element += '</div>';
  20719. } else {
  20720. element += '<div class="text">' + _localizedStringsService.LocalizedStrings.getUI(new_var.type.toLowerCase()) + '</div>';
  20721. }
  20722. element += '<div class="menu">';
  20723. for (var tm in _types.Types) {
  20724. if (tm == _types.Types.VOID.toUpperCase()) {
  20725. continue;
  20726. }
  20727. element += '<div class="item ' + (new_var.type == tm.toLowerCase() ? ' selected ' : '') + '" data-type="' + tm + '" >' + _localizedStringsService.LocalizedStrings.getUI(tm.toLowerCase()) + '</div>';
  20728. }
  20729. for (var tm in _types.Types) {
  20730. if (tm == _types.Types.VOID.toUpperCase()) {
  20731. continue;
  20732. }
  20733. element += '<div class="item">' + '<i class="dropdown icon"></i>' + _localizedStringsService.LocalizedStrings.getUI('vector') + ':' + _localizedStringsService.LocalizedStrings.getUI(tm.toLowerCase()) + '<div class="menu">' + '<div class="item" data-text="' + _localizedStringsService.LocalizedStrings.getUI('vector') + ':' + _localizedStringsService.LocalizedStrings.getUI(tm.toLowerCase()) + ' [ ] " data-type="' + tm + '" data-dimensions="1">[ ]</div>' + '<div class="item" data-text="' + _localizedStringsService.LocalizedStrings.getUI('vector') + ':' + _localizedStringsService.LocalizedStrings.getUI(tm.toLowerCase()) + ' [ ] [ ] " data-type="' + tm + '" data-dimensions="2">[ ] [ ] </div>' + '</div>' + '</div>';
  20734. }
  20735. element += '</div></div> ';
  20736. element += '<div class="editing_name_var"><span class="span_name_variable enable_edit_name_variable">' + new_var.name + '</span> </div>';
  20737. element += ' <span class="character_equals"> = </span> <div class="ui div_valor_var">' + new_var.value + '</div>';
  20738. element += ' <i class="yellow inverted icon times remove_variable"></i></div>';
  20739. element = (0, _jquery2.default)(element);
  20740. element.data('associatedFunction', function_obj);
  20741. function_container.find('.variables_list_div').append(element);
  20742. addHandlers(new_var, element);
  20743. renderValues(new_var, element);
  20744. return element;
  20745. }
  20746. function updateColumnsAndRowsText(variable_container, variable_var) {
  20747. var prev = variable_container.find('.text').text().split('[');
  20748. if (prev.length == 2) {
  20749. var ff = prev[0] + '[ ' + variable_var.columns + ' ] ';
  20750. variable_container.find('.text').empty();
  20751. variable_container.find('.text').text(ff);
  20752. }
  20753. if (prev.length == 3) {
  20754. var ff = prev[0] + '[ ' + variable_var.columns + ' ] [ ' + variable_var.rows + ' ] ';
  20755. variable_container.find('.text').empty();
  20756. variable_container.find('.text').text(ff);
  20757. }
  20758. }
  20759. function renderValues(new_var, variable_container) {
  20760. var ret = "";
  20761. var j = 0;
  20762. if (new_var.dimensions == 0) {
  20763. if (new_var.type == _types.Types.REAL) {
  20764. ret += '<div class="created_div_valor_var"><span class="span_value_variable simple_var">' + new_var.value.toFixed(1) + '</span> </div> ';
  20765. } else {
  20766. if (new_var.type == _types.Types.BOOLEAN) {
  20767. ret += '<div class="created_div_valor_var"><span class="span_value_variable boolean_simple_type">' + _localizedStringsService.LocalizedStrings.getUI(new_var.value) + '</span> </div> ';
  20768. } else {
  20769. ret += '<div class="created_div_valor_var"><span class="span_value_variable simple_var">' + new_var.value + '</span> </div> ';
  20770. }
  20771. }
  20772. } else {
  20773. ret += '<table class="tabela_var">';
  20774. if (new_var.dimensions == 1) {
  20775. ret += '<tr>';
  20776. if (new_var.type == _types.Types.REAL) {
  20777. for (var k = 0; k < new_var.columns; k++) {
  20778. ret += '<td><span class="span_value_variable vector_var" data-index="' + k + '">' + new_var.value[k].toFixed(1) + '</span></td>';
  20779. }
  20780. } else {
  20781. for (var k = 0; k < new_var.columns; k++) {
  20782. if (new_var.type == _types.Types.BOOLEAN) {
  20783. ret += '<td><span class="span_value_variable boolean_vector_var" data-index="' + k + '">' + _localizedStringsService.LocalizedStrings.getUI(new_var.value[k]) + '</span></td>';
  20784. } else {
  20785. ret += '<td><span class="span_value_variable vector_var" data-index="' + k + '">' + new_var.value[k] + '</span>' + '</td>';
  20786. }
  20787. }
  20788. }
  20789. ret += '</tr>';
  20790. ret += '</table>';
  20791. 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>';
  20792. }
  20793. if (new_var.dimensions == 2) {
  20794. if (new_var.type == _types.Types.REAL) {
  20795. for (var l = 0; l < new_var.rows; l++) {
  20796. ret += '<tr>';
  20797. for (var k = 0; k < new_var.columns; k++) {
  20798. ret += '<td><span class="span_value_variable matrix_var" data-index="' + k + '" data-row="' + l + '">' + new_var.value[l][k].toFixed(1) + '</span>' + '</td>';
  20799. }
  20800. ret += '</tr>';
  20801. }
  20802. } else {
  20803. for (var l = 0; l < new_var.rows; l++) {
  20804. ret += '<tr>';
  20805. for (var k = 0; k < new_var.columns; k++) {
  20806. if (new_var.type == _types.Types.BOOLEAN) {
  20807. ret += '<td><span class="span_value_variable boolean_matrix_var" data-index="' + k + '" data-row="' + l + '">' + _localizedStringsService.LocalizedStrings.getUI(new_var.value[l][k]) + '</span></td>';
  20808. } else {
  20809. ret += '<td><span class="span_value_variable matrix_var" data-index="' + k + '" data-row="' + l + '">' + new_var.value[l][k] + '</span></td>';
  20810. }
  20811. }
  20812. ret += '</tr>';
  20813. }
  20814. }
  20815. if (new_var.rows == 0) {
  20816. ret += '<tr><td></td></tr>';
  20817. }
  20818. 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>';
  20819. ret += '</table>';
  20820. 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>';
  20821. }
  20822. }
  20823. (0, _jquery2.default)(variable_container).find(".div_valor_var").html('');
  20824. ret = (0, _jquery2.default)(ret);
  20825. (0, _jquery2.default)(ret).find('.span_value_variable').data('associatedOject', new_var);
  20826. (0, _jquery2.default)(ret).find(".boolean_simple_type").on('click', function (e) {
  20827. alternateBooleanValue(new_var, this.parentNode);
  20828. });
  20829. (0, _jquery2.default)(ret).find(".simple_var").on('click', function (e) {
  20830. enableValueUpdate(new_var, this.parentNode);
  20831. });
  20832. (0, _jquery2.default)(ret).find(".boolean_vector_var").on('click', function (e) {
  20833. alternateBooleanVectorValue(new_var, (0, _jquery2.default)(this).data('index'), this.parentNode);
  20834. });
  20835. (0, _jquery2.default)(ret).find(".vector_var").on('click', function (e) {
  20836. enableVectorValueUpdate(new_var, (0, _jquery2.default)(this).data('index'), this.parentNode);
  20837. });
  20838. (0, _jquery2.default)(ret).find(".remove_global_vector_column").on('click', function (e) {
  20839. removeColumnVector(new_var);
  20840. (0, _jquery2.default)(variable_container).find(".div_valor_var").html('');
  20841. renderValues(new_var, variable_container);
  20842. });
  20843. (0, _jquery2.default)(ret).find(".add_global_vector_column").on('click', function (e) {
  20844. addColumnVector(new_var);
  20845. (0, _jquery2.default)(variable_container).find(".div_valor_var").html('');
  20846. renderValues(new_var, variable_container);
  20847. });
  20848. (0, _jquery2.default)(ret).find(".remove_global_matrix_column").on('click', function (e) {
  20849. removeColumnMatrix(new_var);
  20850. (0, _jquery2.default)(variable_container).find(".div_valor_var").html('');
  20851. renderValues(new_var, variable_container);
  20852. });
  20853. (0, _jquery2.default)(ret).find(".add_global_matrix_column").on('click', function (e) {
  20854. addColumnMatrix(new_var);
  20855. (0, _jquery2.default)(variable_container).find(".div_valor_var").html('');
  20856. renderValues(new_var, variable_container);
  20857. });
  20858. (0, _jquery2.default)(ret).find(".remove_global_matrix_line").on('click', function (e) {
  20859. removeLineMatrix(new_var);
  20860. (0, _jquery2.default)(variable_container).find(".div_valor_var").html('');
  20861. renderValues(new_var, variable_container);
  20862. });
  20863. (0, _jquery2.default)(ret).find(".add_global_matrix_line").on('click', function (e) {
  20864. addLineMatrix(new_var);
  20865. (0, _jquery2.default)(variable_container).find(".div_valor_var").html('');
  20866. renderValues(new_var, variable_container);
  20867. });
  20868. (0, _jquery2.default)(ret).find(".boolean_matrix_var").on('click', function (e) {
  20869. alternateBooleanMatrixValue(new_var, (0, _jquery2.default)(this).data('row'), (0, _jquery2.default)(this).data('index'), this.parentNode);
  20870. });
  20871. (0, _jquery2.default)(ret).find(".matrix_var").on('click', function (e) {
  20872. enableMatrixValueUpdate(new_var, (0, _jquery2.default)(this).data('row'), (0, _jquery2.default)(this).data('index'), this.parentNode);
  20873. });
  20874. (0, _jquery2.default)(variable_container).find(".div_valor_var").append(ret);
  20875. updateColumnsAndRowsText(variable_container, new_var);
  20876. }
  20877. function alternateBooleanMatrixValue(var_obj, row, index, value_container) {
  20878. var_obj.value[row][index] = !var_obj.value[row][index];
  20879. (0, _jquery2.default)(value_container).find('.span_value_variable').text(_localizedStringsService.LocalizedStrings.getUI(var_obj.value[row][index]));
  20880. }
  20881. function addLineMatrix(var_obj) {
  20882. var_obj.rows++;
  20883. if (var_obj.type == _types.Types.INTEGER) {
  20884. var n_l = [];
  20885. for (var i = 0; i < var_obj.columns; i++) {
  20886. n_l.push(1);
  20887. }
  20888. var_obj.value.push(n_l);
  20889. }
  20890. if (var_obj.type == _types.Types.REAL) {
  20891. var n_l = [];
  20892. for (i = 0; i < var_obj.columns; i++) {
  20893. n_l.push(1.0);
  20894. }
  20895. var_obj.value.push(n_l);
  20896. }
  20897. if (var_obj.type == _types.Types.TEXT) {
  20898. var n_l = [];
  20899. for (i = 0; i < var_obj.columns; i++) {
  20900. n_l.push(_localizedStringsService.LocalizedStrings.getUI('text_start'));
  20901. }
  20902. var_obj.value.push(n_l);
  20903. }
  20904. if (var_obj.type == _types.Types.BOOLEAN) {
  20905. var n_l = [];
  20906. for (i = 0; i < var_obj.columns; i++) {
  20907. n_l.push(true);
  20908. }
  20909. var_obj.value.push(n_l);
  20910. }
  20911. }
  20912. function removeLineMatrix(var_obj) {
  20913. if (var_obj.rows == 0) {
  20914. return;
  20915. }
  20916. var_obj.rows--;
  20917. var_obj.value.splice(var_obj.value.length - 1, 1);
  20918. }
  20919. function addColumnMatrix(var_obj) {
  20920. var_obj.columns++;
  20921. if (var_obj.type == _types.Types.INTEGER) {
  20922. for (var i = 0; i < var_obj.rows; i++) {
  20923. var_obj.value[i].push(1);
  20924. }
  20925. }
  20926. if (var_obj.type == _types.Types.REAL) {
  20927. for (var i = 0; i < var_obj.rows; i++) {
  20928. var_obj.value[i].push(1.0);
  20929. }
  20930. }
  20931. if (var_obj.type == _types.Types.TEXT) {
  20932. for (var i = 0; i < var_obj.rows; i++) {
  20933. var_obj.value[i].push(_localizedStringsService.LocalizedStrings.getUI('text_start'));
  20934. }
  20935. }
  20936. if (var_obj.type == _types.Types.BOOLEAN) {
  20937. for (var i = 0; i < var_obj.rows; i++) {
  20938. var_obj.value[i].push(true);
  20939. }
  20940. }
  20941. }
  20942. function removeColumnMatrix(var_obj) {
  20943. if (var_obj.columns == 0) {
  20944. return;
  20945. }
  20946. var_obj.columns--;
  20947. for (var i = 0; i < var_obj.rows; i++) {
  20948. var_obj.value[i].splice(var_obj.value[i].length - 1, 1);
  20949. }
  20950. }
  20951. function addColumnVector(var_obj) {
  20952. var_obj.columns++;
  20953. if (var_obj.type == _types.Types.INTEGER) {
  20954. var_obj.value.push(1);
  20955. }
  20956. if (var_obj.type == _types.Types.REAL) {
  20957. var_obj.value.push(1.0);
  20958. }
  20959. if (var_obj.type == _types.Types.TEXT) {
  20960. var_obj.value.push(_localizedStringsService.LocalizedStrings.getUI('text_start'));
  20961. }
  20962. if (var_obj.type == _types.Types.BOOLEAN) {
  20963. var_obj.value.push(true);
  20964. }
  20965. }
  20966. function removeColumnVector(var_obj) {
  20967. if (var_obj.columns == 0) {
  20968. return;
  20969. }
  20970. var_obj.columns--;
  20971. var_obj.value.splice(var_obj.value.length - 1, 1);
  20972. }
  20973. function alternateBooleanValue(var_obj, value_container) {
  20974. var_obj.value = !var_obj.value;
  20975. (0, _jquery2.default)(value_container).find('.span_value_variable').text(_localizedStringsService.LocalizedStrings.getUI(var_obj.value));
  20976. }
  20977. function alternateBooleanVectorValue(var_obj, index, value_container) {
  20978. var_obj.value[index] = !var_obj.value[index];
  20979. (0, _jquery2.default)(value_container).find('.span_value_variable').text(_localizedStringsService.LocalizedStrings.getUI(var_obj.value[index]));
  20980. }
  20981. function updateInitialValues(variable_obj) {
  20982. if (variable_obj.type == _types.Types.INTEGER) {
  20983. if (variable_obj.dimensions == 0) {
  20984. variable_obj.value = 1;
  20985. }
  20986. if (variable_obj.dimensions == 1) {
  20987. variable_obj.value = [1, 1];
  20988. }
  20989. if (variable_obj.dimensions == 2) {
  20990. variable_obj.value = [[1, 1], [1, 1]];
  20991. }
  20992. }
  20993. if (variable_obj.type == _types.Types.REAL) {
  20994. if (variable_obj.dimensions == 0) {
  20995. variable_obj.value = 1.0;
  20996. }
  20997. if (variable_obj.dimensions == 1) {
  20998. variable_obj.value = [1.0, 1.0];
  20999. }
  21000. if (variable_obj.dimensions == 2) {
  21001. variable_obj.value = [[1.0, 1.0], [1.0, 1.0]];
  21002. }
  21003. }
  21004. if (variable_obj.type == _types.Types.TEXT) {
  21005. if (variable_obj.dimensions == 0) {
  21006. variable_obj.value = _localizedStringsService.LocalizedStrings.getUI('text_start');
  21007. }
  21008. if (variable_obj.dimensions == 1) {
  21009. variable_obj.value = [_localizedStringsService.LocalizedStrings.getUI('text_start'), _localizedStringsService.LocalizedStrings.getUI('text_start')];
  21010. }
  21011. if (variable_obj.dimensions == 2) {
  21012. variable_obj.value = [[_localizedStringsService.LocalizedStrings.getUI('text_start'), _localizedStringsService.LocalizedStrings.getUI('text_start')], [_localizedStringsService.LocalizedStrings.getUI('text_start'), _localizedStringsService.LocalizedStrings.getUI('text_start')]];
  21013. }
  21014. }
  21015. if (variable_obj.type == _types.Types.BOOLEAN) {
  21016. if (variable_obj.dimensions == 0) {
  21017. variable_obj.value = true;
  21018. }
  21019. if (variable_obj.dimensions == 1) {
  21020. variable_obj.value = [true, true];
  21021. }
  21022. if (variable_obj.dimensions == 2) {
  21023. variable_obj.value = [[true, true], [true, true]];
  21024. }
  21025. }
  21026. }
  21027. var opened_name_value_vector_global_ = false;
  21028. var opened_input_value_vector_global_ = null;
  21029. function enableVectorValueUpdate(var_obj, index, parent_node) {
  21030. if (opened_name_value_vector_global_) {
  21031. opened_input_value_vector_global_.focus();
  21032. return;
  21033. }
  21034. parent_node = (0, _jquery2.default)(parent_node);
  21035. opened_name_value_vector_global_ = true;
  21036. parent_node.find('.span_value_variable').text('');
  21037. var input_field;
  21038. if (var_obj.type == _types.Types.REAL) {
  21039. input_field = (0, _jquery2.default)("<input type='text' class='width-dynamic input_name_function' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' value='" + var_obj.value[index].toFixed(1) + "' />");
  21040. input_field.insertBefore(parent_node.find('.span_value_variable'));
  21041. } else {
  21042. input_field = (0, _jquery2.default)("<input type='text' class='width-dynamic input_name_function' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' value='" + var_obj.value[index] + "' />");
  21043. input_field.insertBefore(parent_node.find('.span_value_variable'));
  21044. }
  21045. input_field.on('input', function () {
  21046. var inputWidth = input_field.textWidth() + 10;
  21047. opened_input_value_vector_global_ = input_field;
  21048. input_field.focus();
  21049. var tmpStr = input_field.val();
  21050. input_field.val('');
  21051. input_field.val(tmpStr);
  21052. input_field.css({
  21053. width: inputWidth
  21054. });
  21055. }).trigger('input');
  21056. input_field.focusout(function () {
  21057. /// update array:
  21058. if (input_field.val().trim()) {
  21059. if (var_obj.type == _types.Types.REAL) {
  21060. var_obj.value[index] = parseFloat(input_field.val().trim());
  21061. parent_node.find('.span_value_variable').text(var_obj.value[index].toFixed(1));
  21062. } else {
  21063. if (var_obj.type == _types.Types.INTEGER) {
  21064. var_obj.value[index] = parseInt(input_field.val().trim());
  21065. } else {
  21066. var_obj.value[index] = input_field.val().trim();
  21067. }
  21068. parent_node.find('.span_value_variable').text(var_obj.value[index]);
  21069. }
  21070. } else {
  21071. if (var_obj.type == _types.Types.REAL) {
  21072. parent_node.find('.span_value_variable').text(var_obj.value[index].toFixed(1));
  21073. } else {
  21074. parent_node.find('.span_value_variable').text(var_obj.value[index]);
  21075. }
  21076. }
  21077. if (var_obj.type == _types.Types.TEXT) {
  21078. var_obj.value[index] = input_field.val();
  21079. parent_node.find('.span_value_variable').text(var_obj.value[index]);
  21080. }
  21081. input_field.off();
  21082. input_field.remove();
  21083. /// update elements:
  21084. opened_name_value_vector_global_ = false;
  21085. opened_input_value_vector_global_ = false;
  21086. });
  21087. input_field.on('keydown', function (e) {
  21088. var code = e.keyCode || e.which;
  21089. if (code == 13) {
  21090. if (input_field.val().trim()) {
  21091. if (var_obj.type == _types.Types.REAL) {
  21092. var_obj.value[index] = parseFloat(input_field.val().trim());
  21093. parent_node.find('.span_value_variable').text(var_obj.value[index].toFixed(1));
  21094. } else {
  21095. if (var_obj.type == _types.Types.INTEGER) {
  21096. var_obj.value[index] = parseInt(input_field.val().trim());
  21097. } else {
  21098. var_obj.value[index] = input_field.val().trim();
  21099. }
  21100. parent_node.find('.span_value_variable').text(var_obj.value[index]);
  21101. }
  21102. } else {
  21103. if (var_obj.type == _types.Types.REAL) {
  21104. parent_node.find('.span_value_variable').text(var_obj.value[index].toFixed(1));
  21105. } else {
  21106. parent_node.find('.span_value_variable').text(var_obj.value[index]);
  21107. }
  21108. }
  21109. if (var_obj.type == _types.Types.TEXT) {
  21110. var_obj.value[index] = input_field.val();
  21111. parent_node.find('.span_value_variable').text(var_obj.value[index]);
  21112. }
  21113. input_field.off();
  21114. input_field.remove();
  21115. /// update elements:
  21116. opened_name_value_vector_global_ = false;
  21117. opened_input_value_vector_global_ = false;
  21118. }
  21119. if (code == 27) {
  21120. if (var_obj.type == _types.Types.REAL) {
  21121. parent_node.find('.span_value_variable').text(var_obj.value[index].toFixed(1));
  21122. } else {
  21123. parent_node.find('.span_value_variable').text(var_obj.value[index]);
  21124. }
  21125. input_field.off();
  21126. input_field.remove();
  21127. /// update elements:
  21128. opened_name_value_vector_global_ = false;
  21129. opened_input_value_vector_global_ = false;
  21130. }
  21131. });
  21132. input_field.select();
  21133. }
  21134. var opened_name_value_global_var = false;
  21135. var opened_input_value_global_ar = null;
  21136. function enableValueUpdate(var_obj, parent_node) {
  21137. if (opened_name_value_global_var) {
  21138. opened_input_value_global_ar.focus();
  21139. return;
  21140. }
  21141. parent_node = (0, _jquery2.default)(parent_node);
  21142. opened_name_value_global_var = true;
  21143. var input_field;
  21144. parent_node.find('.span_value_variable').text('');
  21145. if (var_obj.type == _types.Types.REAL) {
  21146. input_field = (0, _jquery2.default)("<input type='text' class='width-dynamic input_name_function' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' value='" + var_obj.value.toFixed(1) + "' />");
  21147. input_field.insertBefore(parent_node.find('.span_value_variable'));
  21148. } else {
  21149. input_field = (0, _jquery2.default)("<input type='text' class='width-dynamic input_name_function' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' value='" + var_obj.value + "' />");
  21150. input_field.insertBefore(parent_node.find('.span_value_variable'));
  21151. }
  21152. input_field.on('input', function () {
  21153. var inputWidth = input_field.textWidth() + 10;
  21154. opened_input_value_global_ar = input_field;
  21155. input_field.focus();
  21156. var tmpStr = input_field.val();
  21157. input_field.val('');
  21158. input_field.val(tmpStr);
  21159. input_field.css({
  21160. width: inputWidth
  21161. });
  21162. }).trigger('input');
  21163. input_field.focusout(function () {
  21164. /// update array:
  21165. if (input_field.val().trim()) {
  21166. if (var_obj.type == _types.Types.REAL) {
  21167. var_obj.value = parseFloat(input_field.val().trim());
  21168. parent_node.find('.span_value_variable').text(var_obj.value.toFixed(1));
  21169. } else {
  21170. if (var_obj.type == _types.Types.INTEGER) {
  21171. var_obj.value = parseInt(input_field.val().trim());
  21172. } else {
  21173. var_obj.value = input_field.val().trim();
  21174. }
  21175. parent_node.find('.span_value_variable').text(var_obj.value);
  21176. }
  21177. } else {
  21178. if (var_obj.type == _types.Types.REAL) {
  21179. parent_node.find('.span_value_variable').text(var_obj.value.toFixed(1));
  21180. } else {
  21181. parent_node.find('.span_value_variable').text(var_obj.value);
  21182. }
  21183. }
  21184. if (var_obj.type == _types.Types.TEXT) {
  21185. var_obj.value = input_field.val();
  21186. parent_node.find('.span_value_variable').text(var_obj.value);
  21187. }
  21188. input_field.off();
  21189. input_field.remove();
  21190. /// update elements:
  21191. opened_name_value_global_var = false;
  21192. opened_input_value_global_ar = false;
  21193. });
  21194. input_field.on('keydown', function (e) {
  21195. var code = e.keyCode || e.which;
  21196. if (code == 13) {
  21197. if (input_field.val().trim()) {
  21198. if (var_obj.type == _types.Types.REAL) {
  21199. var_obj.value = parseFloat(input_field.val().trim());
  21200. parent_node.find('.span_value_variable').text(var_obj.value.toFixed(1));
  21201. } else {
  21202. if (var_obj.type == _types.Types.INTEGER) {
  21203. var_obj.value = parseInt(input_field.val().trim());
  21204. } else {
  21205. var_obj.value = input_field.val().trim();
  21206. }
  21207. parent_node.find('.span_value_variable').text(var_obj.value);
  21208. }
  21209. } else {
  21210. if (var_obj.type == _types.Types.REAL) {
  21211. parent_node.find('.span_value_variable').text(var_obj.value.toFixed(1));
  21212. } else {
  21213. parent_node.find('.span_value_variable').text(var_obj.value);
  21214. }
  21215. }
  21216. if (var_obj.type == _types.Types.TEXT) {
  21217. var_obj.value = input_field.val();
  21218. parent_node.find('.span_value_variable').text(var_obj.value);
  21219. }
  21220. input_field.off();
  21221. input_field.remove();
  21222. /// update elements:
  21223. opened_name_value_global_var = false;
  21224. opened_input_value_global_ar = false;
  21225. }
  21226. if (code == 27) {
  21227. if (var_obj.type == _types.Types.REAL) {
  21228. parent_node.find('.span_value_variable').text(var_obj.value.toFixed(1));
  21229. } else {
  21230. parent_node.find('.span_value_variable').text(var_obj.value);
  21231. }
  21232. input_field.off();
  21233. input_field.remove();
  21234. /// update elements:
  21235. opened_name_value_global_var = false;
  21236. opened_input_value_global_ar = false;
  21237. }
  21238. });
  21239. input_field.select();
  21240. }
  21241. var opened_name_global = false;
  21242. var opened_input_global = null;
  21243. function enableNameUpdate(variable_obj, variable_container) {
  21244. if (opened_name_global) {
  21245. opened_input_global.focus();
  21246. return;
  21247. }
  21248. opened_name_global = true;
  21249. variable_container.find('.span_name_variable').text('');
  21250. var input_name;
  21251. input_name = (0, _jquery2.default)("<input type='text' class='width-dynamic input_name_function' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' value='" + variable_obj.name + "' />");
  21252. input_name.insertBefore(variable_container.find('.span_name_variable'));
  21253. input_name.on('input', function () {
  21254. var inputWidth = input_name.textWidth() + 10;
  21255. opened_input_global = input_name;
  21256. input_name.focus();
  21257. var tmpStr = input_name.val();
  21258. input_name.val('');
  21259. input_name.val(tmpStr);
  21260. input_name.css({
  21261. width: inputWidth
  21262. });
  21263. }).trigger('input');
  21264. input_name.focusout(function () {
  21265. /// update array:
  21266. if (input_name.val().trim().length > 0) {
  21267. updateName(variable_obj, input_name.val().trim());
  21268. variable_container.find('.span_name_variable').text(variable_obj.name);
  21269. } else {
  21270. variable_container.find('.span_name_variable').text(variable_obj.name);
  21271. }
  21272. input_name.off();
  21273. input_name.remove();
  21274. /// update elements:
  21275. opened_name_global = false;
  21276. opened_input_global = false;
  21277. });
  21278. input_name.on('keydown', function (e) {
  21279. var code = e.keyCode || e.which;
  21280. if (code == 13) {
  21281. if (input_name.val().trim().length > 0) {
  21282. updateName(variable_obj, input_name.val().trim());
  21283. variable_container.find('.span_name_variable').text(variable_obj.name);
  21284. } else {
  21285. variable_container.find('.span_name_variable').text(variable_obj.name);
  21286. }
  21287. input_name.off();
  21288. input_name.remove();
  21289. /// update elements:
  21290. opened_name_global = false;
  21291. opened_input_global = false;
  21292. }
  21293. if (code == 27) {
  21294. variable_container.find('.span_name_variable').text(variable_obj.name);
  21295. input_name.off();
  21296. input_name.remove();
  21297. /// update elements:
  21298. opened_name_global = false;
  21299. opened_input_global = false;
  21300. }
  21301. });
  21302. input_name.select();
  21303. }
  21304. var opened_name_value_matrix_global_v = false;
  21305. var opened_input_value_matrix_global_v = null;
  21306. function enableMatrixValueUpdate(var_obj, row, index, parent_node) {
  21307. if (opened_name_value_matrix_global_v) {
  21308. opened_input_value_matrix_global_v.focus();
  21309. return;
  21310. }
  21311. parent_node = (0, _jquery2.default)(parent_node);
  21312. opened_name_value_matrix_global_v = true;
  21313. parent_node.find('.span_value_variable').text('');
  21314. var input_field;
  21315. if (var_obj.type == _types.Types.REAL) {
  21316. input_field = (0, _jquery2.default)("<input type='text' class='width-dynamic input_name_function' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' value='" + var_obj.value[row][index].toFixed(1) + "' />");
  21317. input_field.insertBefore(parent_node.find('.span_value_variable'));
  21318. } else {
  21319. input_field = (0, _jquery2.default)("<input type='text' class='width-dynamic input_name_function' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' value='" + var_obj.value[row][index] + "' />");
  21320. input_field.insertBefore(parent_node.find('.span_value_variable'));
  21321. }
  21322. input_field.on('input', function () {
  21323. var inputWidth = input_field.textWidth() + 10;
  21324. opened_input_value_matrix_global_v = input_field;
  21325. input_field.focus();
  21326. var tmpStr = input_field.val();
  21327. input_field.val('');
  21328. input_field.val(tmpStr);
  21329. input_field.css({
  21330. width: inputWidth
  21331. });
  21332. }).trigger('input');
  21333. input_field.focusout(function () {
  21334. /// update array:
  21335. if (input_field.val().trim()) {
  21336. if (var_obj.type == _types.Types.REAL) {
  21337. var_obj.value[row][index] = parseFloat(input_field.val().trim());
  21338. parent_node.find('.span_value_variable').text(var_obj.value[row][index].toFixed(1));
  21339. } else {
  21340. if (var_obj.type == _types.Types.INTEGER) {
  21341. var_obj.value[row][index] = parseInt(input_field.val().trim());
  21342. } else {
  21343. var_obj.value[row][index] = input_field.val().trim();
  21344. }
  21345. parent_node.find('.span_value_variable').text(var_obj.value[row][index]);
  21346. }
  21347. } else {
  21348. if (var_obj.type == _types.Types.REAL) {
  21349. parent_node.find('.span_value_variable').text(var_obj.value[row][index].toFixed(1));
  21350. } else {
  21351. parent_node.find('.span_value_variable').text(var_obj.value[row][index]);
  21352. }
  21353. }
  21354. if (var_obj.type == _types.Types.TEXT) {
  21355. var_obj.value[row][index] = input_field.val();
  21356. parent_node.find('.span_value_variable').text(var_obj.value[row][index]);
  21357. }
  21358. input_field.off();
  21359. input_field.remove();
  21360. /// update elements:
  21361. opened_name_value_matrix_global_v = false;
  21362. opened_input_value_matrix_global_v = false;
  21363. });
  21364. input_field.on('keydown', function (e) {
  21365. var code = e.keyCode || e.which;
  21366. if (code == 13) {
  21367. if (input_field.val().trim()) {
  21368. if (var_obj.type == _types.Types.REAL) {
  21369. var_obj.value[row][index] = parseFloat(input_field.val().trim());
  21370. parent_node.find('.span_value_variable').text(var_obj.value[row][index].toFixed(1));
  21371. } else {
  21372. if (var_obj.type == _types.Types.INTEGER) {
  21373. var_obj.value[row][index] = parseInt(input_field.val().trim());
  21374. } else {
  21375. var_obj.value[row][index] = input_field.val().trim();
  21376. }
  21377. parent_node.find('.span_value_variable').text(var_obj.value[row][index]);
  21378. }
  21379. } else {
  21380. if (var_obj.type == _types.Types.REAL) {
  21381. parent_node.find('.span_value_variable').text(var_obj.value[row][index].toFixed(1));
  21382. } else {
  21383. parent_node.find('.span_value_variable').text(var_obj.value[row][index]);
  21384. }
  21385. }
  21386. if (var_obj.type == _types.Types.TEXT) {
  21387. var_obj.value[row][index] = input_field.val();
  21388. parent_node.find('.span_value_variable').text(var_obj.value[row][index]);
  21389. }
  21390. input_field.off();
  21391. input_field.remove();
  21392. /// update elements:
  21393. opened_name_value_matrix_global_v = false;
  21394. opened_input_value_matrix_global_v = false;
  21395. }
  21396. if (code == 27) {
  21397. if (var_obj.type == _types.Types.REAL) {
  21398. parent_node.find('.span_value_variable').text(var_obj.value[row][index].toFixed(1));
  21399. } else {
  21400. parent_node.find('.span_value_variable').text(var_obj.value[row][index]);
  21401. }
  21402. input_field.off();
  21403. input_field.remove();
  21404. /// update elements:
  21405. opened_name_value_matrix_global_v = false;
  21406. opened_input_value_matrix_global_v = false;
  21407. }
  21408. });
  21409. input_field.select();
  21410. }
  21411. /***/ }),
  21412. /***/ "./node_modules/antlr4/BufferedTokenStream.js":
  21413. /*!****************************************************!*\
  21414. !*** ./node_modules/antlr4/BufferedTokenStream.js ***!
  21415. \****************************************************/
  21416. /*! no static exports found */
  21417. /***/ (function(module, exports, __webpack_require__) {
  21418. "use strict";
  21419. //
  21420. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  21421. * Use of this file is governed by the BSD 3-clause license that
  21422. * can be found in the LICENSE.txt file in the project root.
  21423. */
  21424. // This implementation of {@link TokenStream} loads tokens from a
  21425. // {@link TokenSource} on-demand, and places the tokens in a buffer to provide
  21426. // access to any previous token by index.
  21427. //
  21428. // <p>
  21429. // This token stream ignores the value of {@link Token//getChannel}. If your
  21430. // parser requires the token stream filter tokens to only those on a particular
  21431. // channel, such as {@link Token//DEFAULT_CHANNEL} or
  21432. // {@link Token//HIDDEN_CHANNEL}, use a filtering token stream such a
  21433. // {@link CommonTokenStream}.</p>
  21434. var Token = __webpack_require__(/*! ./Token */ "./node_modules/antlr4/Token.js").Token;
  21435. var Lexer = __webpack_require__(/*! ./Lexer */ "./node_modules/antlr4/Lexer.js").Lexer;
  21436. var Interval = __webpack_require__(/*! ./IntervalSet */ "./node_modules/antlr4/IntervalSet.js").Interval;
  21437. // this is just to keep meaningful parameter types to Parser
  21438. function TokenStream() {
  21439. return this;
  21440. }
  21441. function BufferedTokenStream(tokenSource) {
  21442. TokenStream.call(this);
  21443. // The {@link TokenSource} from which tokens for this stream are fetched.
  21444. this.tokenSource = tokenSource;
  21445. // A collection of all tokens fetched from the token source. The list is
  21446. // considered a complete view of the input once {@link //fetchedEOF} is set
  21447. // to {@code true}.
  21448. this.tokens = [];
  21449. // The index into {@link //tokens} of the current token (next token to
  21450. // {@link //consume}). {@link //tokens}{@code [}{@link //p}{@code ]} should
  21451. // be
  21452. // {@link //LT LT(1)}.
  21453. //
  21454. // <p>This field is set to -1 when the stream is first constructed or when
  21455. // {@link //setTokenSource} is called, indicating that the first token has
  21456. // not yet been fetched from the token source. For additional information,
  21457. // see the documentation of {@link IntStream} for a description of
  21458. // Initializing Methods.</p>
  21459. this.index = -1;
  21460. // Indicates whether the {@link Token//EOF} token has been fetched from
  21461. // {@link //tokenSource} and added to {@link //tokens}. This field improves
  21462. // performance for the following cases:
  21463. //
  21464. // <ul>
  21465. // <li>{@link //consume}: The lookahead check in {@link //consume} to
  21466. // prevent
  21467. // consuming the EOF symbol is optimized by checking the values of
  21468. // {@link //fetchedEOF} and {@link //p} instead of calling {@link
  21469. // //LA}.</li>
  21470. // <li>{@link //fetch}: The check to prevent adding multiple EOF symbols
  21471. // into
  21472. // {@link //tokens} is trivial with this field.</li>
  21473. // <ul>
  21474. this.fetchedEOF = false;
  21475. return this;
  21476. }
  21477. BufferedTokenStream.prototype = Object.create(TokenStream.prototype);
  21478. BufferedTokenStream.prototype.constructor = BufferedTokenStream;
  21479. BufferedTokenStream.prototype.mark = function () {
  21480. return 0;
  21481. };
  21482. BufferedTokenStream.prototype.release = function (marker) {
  21483. // no resources to release
  21484. };
  21485. BufferedTokenStream.prototype.reset = function () {
  21486. this.seek(0);
  21487. };
  21488. BufferedTokenStream.prototype.seek = function (index) {
  21489. this.lazyInit();
  21490. this.index = this.adjustSeekIndex(index);
  21491. };
  21492. BufferedTokenStream.prototype.get = function (index) {
  21493. this.lazyInit();
  21494. return this.tokens[index];
  21495. };
  21496. BufferedTokenStream.prototype.consume = function () {
  21497. var skipEofCheck = false;
  21498. if (this.index >= 0) {
  21499. if (this.fetchedEOF) {
  21500. // the last token in tokens is EOF. skip check if p indexes any
  21501. // fetched token except the last.
  21502. skipEofCheck = this.index < this.tokens.length - 1;
  21503. } else {
  21504. // no EOF token in tokens. skip check if p indexes a fetched token.
  21505. skipEofCheck = this.index < this.tokens.length;
  21506. }
  21507. } else {
  21508. // not yet initialized
  21509. skipEofCheck = false;
  21510. }
  21511. if (!skipEofCheck && this.LA(1) === Token.EOF) {
  21512. throw "cannot consume EOF";
  21513. }
  21514. if (this.sync(this.index + 1)) {
  21515. this.index = this.adjustSeekIndex(this.index + 1);
  21516. }
  21517. };
  21518. // Make sure index {@code i} in tokens has a token.
  21519. //
  21520. // @return {@code true} if a token is located at index {@code i}, otherwise
  21521. // {@code false}.
  21522. // @see //get(int i)
  21523. // /
  21524. BufferedTokenStream.prototype.sync = function (i) {
  21525. var n = i - this.tokens.length + 1; // how many more elements we need?
  21526. if (n > 0) {
  21527. var fetched = this.fetch(n);
  21528. return fetched >= n;
  21529. }
  21530. return true;
  21531. };
  21532. // Add {@code n} elements to buffer.
  21533. //
  21534. // @return The actual number of elements added to the buffer.
  21535. // /
  21536. BufferedTokenStream.prototype.fetch = function (n) {
  21537. if (this.fetchedEOF) {
  21538. return 0;
  21539. }
  21540. for (var i = 0; i < n; i++) {
  21541. var t = this.tokenSource.nextToken();
  21542. t.tokenIndex = this.tokens.length;
  21543. this.tokens.push(t);
  21544. if (t.type === Token.EOF) {
  21545. this.fetchedEOF = true;
  21546. return i + 1;
  21547. }
  21548. }
  21549. return n;
  21550. };
  21551. // Get all tokens from start..stop inclusively///
  21552. BufferedTokenStream.prototype.getTokens = function (start, stop, types) {
  21553. if (types === undefined) {
  21554. types = null;
  21555. }
  21556. if (start < 0 || stop < 0) {
  21557. return null;
  21558. }
  21559. this.lazyInit();
  21560. var subset = [];
  21561. if (stop >= this.tokens.length) {
  21562. stop = this.tokens.length - 1;
  21563. }
  21564. for (var i = start; i < stop; i++) {
  21565. var t = this.tokens[i];
  21566. if (t.type === Token.EOF) {
  21567. break;
  21568. }
  21569. if (types === null || types.contains(t.type)) {
  21570. subset.push(t);
  21571. }
  21572. }
  21573. return subset;
  21574. };
  21575. BufferedTokenStream.prototype.LA = function (i) {
  21576. return this.LT(i).type;
  21577. };
  21578. BufferedTokenStream.prototype.LB = function (k) {
  21579. if (this.index - k < 0) {
  21580. return null;
  21581. }
  21582. return this.tokens[this.index - k];
  21583. };
  21584. BufferedTokenStream.prototype.LT = function (k) {
  21585. this.lazyInit();
  21586. if (k === 0) {
  21587. return null;
  21588. }
  21589. if (k < 0) {
  21590. return this.LB(-k);
  21591. }
  21592. var i = this.index + k - 1;
  21593. this.sync(i);
  21594. if (i >= this.tokens.length) {
  21595. // return EOF token
  21596. // EOF must be last token
  21597. return this.tokens[this.tokens.length - 1];
  21598. }
  21599. return this.tokens[i];
  21600. };
  21601. // Allowed derived classes to modify the behavior of operations which change
  21602. // the current stream position by adjusting the target token index of a seek
  21603. // operation. The default implementation simply returns {@code i}. If an
  21604. // exception is thrown in this method, the current stream index should not be
  21605. // changed.
  21606. //
  21607. // <p>For example, {@link CommonTokenStream} overrides this method to ensure
  21608. // that
  21609. // the seek target is always an on-channel token.</p>
  21610. //
  21611. // @param i The target token index.
  21612. // @return The adjusted target token index.
  21613. BufferedTokenStream.prototype.adjustSeekIndex = function (i) {
  21614. return i;
  21615. };
  21616. BufferedTokenStream.prototype.lazyInit = function () {
  21617. if (this.index === -1) {
  21618. this.setup();
  21619. }
  21620. };
  21621. BufferedTokenStream.prototype.setup = function () {
  21622. this.sync(0);
  21623. this.index = this.adjustSeekIndex(0);
  21624. };
  21625. // Reset this token stream by setting its token source.///
  21626. BufferedTokenStream.prototype.setTokenSource = function (tokenSource) {
  21627. this.tokenSource = tokenSource;
  21628. this.tokens = [];
  21629. this.index = -1;
  21630. this.fetchedEOF = false;
  21631. };
  21632. // Given a starting index, return the index of the next token on channel.
  21633. // Return i if tokens[i] is on channel. Return -1 if there are no tokens
  21634. // on channel between i and EOF.
  21635. // /
  21636. BufferedTokenStream.prototype.nextTokenOnChannel = function (i, channel) {
  21637. this.sync(i);
  21638. if (i >= this.tokens.length) {
  21639. return -1;
  21640. }
  21641. var token = this.tokens[i];
  21642. while (token.channel !== this.channel) {
  21643. if (token.type === Token.EOF) {
  21644. return -1;
  21645. }
  21646. i += 1;
  21647. this.sync(i);
  21648. token = this.tokens[i];
  21649. }
  21650. return i;
  21651. };
  21652. // Given a starting index, return the index of the previous token on channel.
  21653. // Return i if tokens[i] is on channel. Return -1 if there are no tokens
  21654. // on channel between i and 0.
  21655. BufferedTokenStream.prototype.previousTokenOnChannel = function (i, channel) {
  21656. while (i >= 0 && this.tokens[i].channel !== channel) {
  21657. i -= 1;
  21658. }
  21659. return i;
  21660. };
  21661. // Collect all tokens on specified channel to the right of
  21662. // the current token up until we see a token on DEFAULT_TOKEN_CHANNEL or
  21663. // EOF. If channel is -1, find any non default channel token.
  21664. BufferedTokenStream.prototype.getHiddenTokensToRight = function (tokenIndex, channel) {
  21665. if (channel === undefined) {
  21666. channel = -1;
  21667. }
  21668. this.lazyInit();
  21669. if (tokenIndex < 0 || tokenIndex >= this.tokens.length) {
  21670. throw "" + tokenIndex + " not in 0.." + this.tokens.length - 1;
  21671. }
  21672. var nextOnChannel = this.nextTokenOnChannel(tokenIndex + 1, Lexer.DEFAULT_TOKEN_CHANNEL);
  21673. var from_ = tokenIndex + 1;
  21674. // if none onchannel to right, nextOnChannel=-1 so set to = last token
  21675. var to = nextOnChannel === -1 ? this.tokens.length - 1 : nextOnChannel;
  21676. return this.filterForChannel(from_, to, channel);
  21677. };
  21678. // Collect all tokens on specified channel to the left of
  21679. // the current token up until we see a token on DEFAULT_TOKEN_CHANNEL.
  21680. // If channel is -1, find any non default channel token.
  21681. BufferedTokenStream.prototype.getHiddenTokensToLeft = function (tokenIndex, channel) {
  21682. if (channel === undefined) {
  21683. channel = -1;
  21684. }
  21685. this.lazyInit();
  21686. if (tokenIndex < 0 || tokenIndex >= this.tokens.length) {
  21687. throw "" + tokenIndex + " not in 0.." + this.tokens.length - 1;
  21688. }
  21689. var prevOnChannel = this.previousTokenOnChannel(tokenIndex - 1, Lexer.DEFAULT_TOKEN_CHANNEL);
  21690. if (prevOnChannel === tokenIndex - 1) {
  21691. return null;
  21692. }
  21693. // if none on channel to left, prevOnChannel=-1 then from=0
  21694. var from_ = prevOnChannel + 1;
  21695. var to = tokenIndex - 1;
  21696. return this.filterForChannel(from_, to, channel);
  21697. };
  21698. BufferedTokenStream.prototype.filterForChannel = function (left, right, channel) {
  21699. var hidden = [];
  21700. for (var i = left; i < right + 1; i++) {
  21701. var t = this.tokens[i];
  21702. if (channel === -1) {
  21703. if (t.channel !== Lexer.DEFAULT_TOKEN_CHANNEL) {
  21704. hidden.push(t);
  21705. }
  21706. } else if (t.channel === channel) {
  21707. hidden.push(t);
  21708. }
  21709. }
  21710. if (hidden.length === 0) {
  21711. return null;
  21712. }
  21713. return hidden;
  21714. };
  21715. BufferedTokenStream.prototype.getSourceName = function () {
  21716. return this.tokenSource.getSourceName();
  21717. };
  21718. // Get the text of all tokens in this buffer.///
  21719. BufferedTokenStream.prototype.getText = function (interval) {
  21720. this.lazyInit();
  21721. this.fill();
  21722. if (interval === undefined || interval === null) {
  21723. interval = new Interval(0, this.tokens.length - 1);
  21724. }
  21725. var start = interval.start;
  21726. if (start instanceof Token) {
  21727. start = start.tokenIndex;
  21728. }
  21729. var stop = interval.stop;
  21730. if (stop instanceof Token) {
  21731. stop = stop.tokenIndex;
  21732. }
  21733. if (start === null || stop === null || start < 0 || stop < 0) {
  21734. return "";
  21735. }
  21736. if (stop >= this.tokens.length) {
  21737. stop = this.tokens.length - 1;
  21738. }
  21739. var s = "";
  21740. for (var i = start; i < stop + 1; i++) {
  21741. var t = this.tokens[i];
  21742. if (t.type === Token.EOF) {
  21743. break;
  21744. }
  21745. s = s + t.text;
  21746. }
  21747. return s;
  21748. };
  21749. // Get all tokens from lexer until EOF///
  21750. BufferedTokenStream.prototype.fill = function () {
  21751. this.lazyInit();
  21752. while (this.fetch(1000) === 1000) {
  21753. continue;
  21754. }
  21755. };
  21756. exports.BufferedTokenStream = BufferedTokenStream;
  21757. /***/ }),
  21758. /***/ "./node_modules/antlr4/CharStreams.js":
  21759. /*!********************************************!*\
  21760. !*** ./node_modules/antlr4/CharStreams.js ***!
  21761. \********************************************/
  21762. /*! no static exports found */
  21763. /***/ (function(module, exports, __webpack_require__) {
  21764. "use strict";
  21765. //
  21766. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  21767. * Use of this file is governed by the BSD 3-clause license that
  21768. * can be found in the LICENSE.txt file in the project root.
  21769. */
  21770. //
  21771. var InputStream = __webpack_require__(/*! ./InputStream */ "./node_modules/antlr4/InputStream.js").InputStream;
  21772. var isNodeJs = typeof window === 'undefined' && typeof importScripts === 'undefined';
  21773. var fs = isNodeJs ? __webpack_require__(/*! fs */ "./node_modules/node-libs-browser/mock/empty.js") : null;
  21774. // Utility functions to create InputStreams from various sources.
  21775. //
  21776. // All returned InputStreams support the full range of Unicode
  21777. // up to U+10FFFF (the default behavior of InputStream only supports
  21778. // code points up to U+FFFF).
  21779. var CharStreams = {
  21780. // Creates an InputStream from a string.
  21781. fromString: function fromString(str) {
  21782. return new InputStream(str, true);
  21783. },
  21784. // Asynchronously creates an InputStream from a blob given the
  21785. // encoding of the bytes in that blob (defaults to 'utf8' if
  21786. // encoding is null).
  21787. //
  21788. // Invokes onLoad(result) on success, onError(error) on
  21789. // failure.
  21790. fromBlob: function fromBlob(blob, encoding, onLoad, onError) {
  21791. var reader = FileReader();
  21792. reader.onload = function (e) {
  21793. var is = new InputStream(e.target.result, true);
  21794. onLoad(is);
  21795. };
  21796. reader.onerror = onError;
  21797. reader.readAsText(blob, encoding);
  21798. },
  21799. // Creates an InputStream from a Buffer given the
  21800. // encoding of the bytes in that buffer (defaults to 'utf8' if
  21801. // encoding is null).
  21802. fromBuffer: function fromBuffer(buffer, encoding) {
  21803. return new InputStream(buffer.toString(encoding), true);
  21804. },
  21805. // Asynchronously creates an InputStream from a file on disk given
  21806. // the encoding of the bytes in that file (defaults to 'utf8' if
  21807. // encoding is null).
  21808. //
  21809. // Invokes callback(error, result) on completion.
  21810. fromPath: function fromPath(path, encoding, callback) {
  21811. fs.readFile(path, encoding, function (err, data) {
  21812. var is = null;
  21813. if (data !== null) {
  21814. is = new InputStream(data, true);
  21815. }
  21816. callback(err, is);
  21817. });
  21818. },
  21819. // Synchronously creates an InputStream given a path to a file
  21820. // on disk and the encoding of the bytes in that file (defaults to
  21821. // 'utf8' if encoding is null).
  21822. fromPathSync: function fromPathSync(path, encoding) {
  21823. var data = fs.readFileSync(path, encoding);
  21824. return new InputStream(data, true);
  21825. }
  21826. };
  21827. exports.CharStreams = CharStreams;
  21828. /***/ }),
  21829. /***/ "./node_modules/antlr4/CommonTokenFactory.js":
  21830. /*!***************************************************!*\
  21831. !*** ./node_modules/antlr4/CommonTokenFactory.js ***!
  21832. \***************************************************/
  21833. /*! no static exports found */
  21834. /***/ (function(module, exports, __webpack_require__) {
  21835. "use strict";
  21836. //
  21837. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  21838. * Use of this file is governed by the BSD 3-clause license that
  21839. * can be found in the LICENSE.txt file in the project root.
  21840. */
  21841. //
  21842. //
  21843. // This default implementation of {@link TokenFactory} creates
  21844. // {@link CommonToken} objects.
  21845. //
  21846. var CommonToken = __webpack_require__(/*! ./Token */ "./node_modules/antlr4/Token.js").CommonToken;
  21847. function TokenFactory() {
  21848. return this;
  21849. }
  21850. function CommonTokenFactory(copyText) {
  21851. TokenFactory.call(this);
  21852. // Indicates whether {@link CommonToken//setText} should be called after
  21853. // constructing tokens to explicitly set the text. This is useful for cases
  21854. // where the input stream might not be able to provide arbitrary substrings
  21855. // of text from the input after the lexer creates a token (e.g. the
  21856. // implementation of {@link CharStream//getText} in
  21857. // {@link UnbufferedCharStream} throws an
  21858. // {@link UnsupportedOperationException}). Explicitly setting the token text
  21859. // allows {@link Token//getText} to be called at any time regardless of the
  21860. // input stream implementation.
  21861. //
  21862. // <p>
  21863. // The default value is {@code false} to avoid the performance and memory
  21864. // overhead of copying text for every token unless explicitly requested.</p>
  21865. //
  21866. this.copyText = copyText === undefined ? false : copyText;
  21867. return this;
  21868. }
  21869. CommonTokenFactory.prototype = Object.create(TokenFactory.prototype);
  21870. CommonTokenFactory.prototype.constructor = CommonTokenFactory;
  21871. //
  21872. // The default {@link CommonTokenFactory} instance.
  21873. //
  21874. // <p>
  21875. // This token factory does not explicitly copy token text when constructing
  21876. // tokens.</p>
  21877. //
  21878. CommonTokenFactory.DEFAULT = new CommonTokenFactory();
  21879. CommonTokenFactory.prototype.create = function (source, type, text, channel, start, stop, line, column) {
  21880. var t = new CommonToken(source, type, channel, start, stop);
  21881. t.line = line;
  21882. t.column = column;
  21883. if (text !== null) {
  21884. t.text = text;
  21885. } else if (this.copyText && source[1] !== null) {
  21886. t.text = source[1].getText(start, stop);
  21887. }
  21888. return t;
  21889. };
  21890. CommonTokenFactory.prototype.createThin = function (type, text) {
  21891. var t = new CommonToken(null, type);
  21892. t.text = text;
  21893. return t;
  21894. };
  21895. exports.CommonTokenFactory = CommonTokenFactory;
  21896. /***/ }),
  21897. /***/ "./node_modules/antlr4/CommonTokenStream.js":
  21898. /*!**************************************************!*\
  21899. !*** ./node_modules/antlr4/CommonTokenStream.js ***!
  21900. \**************************************************/
  21901. /*! no static exports found */
  21902. /***/ (function(module, exports, __webpack_require__) {
  21903. "use strict";
  21904. //
  21905. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  21906. * Use of this file is governed by the BSD 3-clause license that
  21907. * can be found in the LICENSE.txt file in the project root.
  21908. */
  21909. ///
  21910. //
  21911. // This class extends {@link BufferedTokenStream} with functionality to filter
  21912. // token streams to tokens on a particular channel (tokens where
  21913. // {@link Token//getChannel} returns a particular value).
  21914. //
  21915. // <p>
  21916. // This token stream provides access to all tokens by index or when calling
  21917. // methods like {@link //getText}. The channel filtering is only used for code
  21918. // accessing tokens via the lookahead methods {@link //LA}, {@link //LT}, and
  21919. // {@link //LB}.</p>
  21920. //
  21921. // <p>
  21922. // By default, tokens are placed on the default channel
  21923. // ({@link Token//DEFAULT_CHANNEL}), but may be reassigned by using the
  21924. // {@code ->channel(HIDDEN)} lexer command, or by using an embedded action to
  21925. // call {@link Lexer//setChannel}.
  21926. // </p>
  21927. //
  21928. // <p>
  21929. // Note: lexer rules which use the {@code ->skip} lexer command or call
  21930. // {@link Lexer//skip} do not produce tokens at all, so input text matched by
  21931. // such a rule will not be available as part of the token stream, regardless of
  21932. // channel.</p>
  21933. ///
  21934. var Token = __webpack_require__(/*! ./Token */ "./node_modules/antlr4/Token.js").Token;
  21935. var BufferedTokenStream = __webpack_require__(/*! ./BufferedTokenStream */ "./node_modules/antlr4/BufferedTokenStream.js").BufferedTokenStream;
  21936. function CommonTokenStream(lexer, channel) {
  21937. BufferedTokenStream.call(this, lexer);
  21938. this.channel = channel === undefined ? Token.DEFAULT_CHANNEL : channel;
  21939. return this;
  21940. }
  21941. CommonTokenStream.prototype = Object.create(BufferedTokenStream.prototype);
  21942. CommonTokenStream.prototype.constructor = CommonTokenStream;
  21943. CommonTokenStream.prototype.adjustSeekIndex = function (i) {
  21944. return this.nextTokenOnChannel(i, this.channel);
  21945. };
  21946. CommonTokenStream.prototype.LB = function (k) {
  21947. if (k === 0 || this.index - k < 0) {
  21948. return null;
  21949. }
  21950. var i = this.index;
  21951. var n = 1;
  21952. // find k good tokens looking backwards
  21953. while (n <= k) {
  21954. // skip off-channel tokens
  21955. i = this.previousTokenOnChannel(i - 1, this.channel);
  21956. n += 1;
  21957. }
  21958. if (i < 0) {
  21959. return null;
  21960. }
  21961. return this.tokens[i];
  21962. };
  21963. CommonTokenStream.prototype.LT = function (k) {
  21964. this.lazyInit();
  21965. if (k === 0) {
  21966. return null;
  21967. }
  21968. if (k < 0) {
  21969. return this.LB(-k);
  21970. }
  21971. var i = this.index;
  21972. var n = 1; // we know tokens[pos] is a good one
  21973. // find k good tokens
  21974. while (n < k) {
  21975. // skip off-channel tokens, but make sure to not look past EOF
  21976. if (this.sync(i + 1)) {
  21977. i = this.nextTokenOnChannel(i + 1, this.channel);
  21978. }
  21979. n += 1;
  21980. }
  21981. return this.tokens[i];
  21982. };
  21983. // Count EOF just once.///
  21984. CommonTokenStream.prototype.getNumberOfOnChannelTokens = function () {
  21985. var n = 0;
  21986. this.fill();
  21987. for (var i = 0; i < this.tokens.length; i++) {
  21988. var t = this.tokens[i];
  21989. if (t.channel === this.channel) {
  21990. n += 1;
  21991. }
  21992. if (t.type === Token.EOF) {
  21993. break;
  21994. }
  21995. }
  21996. return n;
  21997. };
  21998. exports.CommonTokenStream = CommonTokenStream;
  21999. /***/ }),
  22000. /***/ "./node_modules/antlr4/FileStream.js":
  22001. /*!*******************************************!*\
  22002. !*** ./node_modules/antlr4/FileStream.js ***!
  22003. \*******************************************/
  22004. /*! no static exports found */
  22005. /***/ (function(module, exports, __webpack_require__) {
  22006. "use strict";
  22007. //
  22008. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  22009. * Use of this file is governed by the BSD 3-clause license that
  22010. * can be found in the LICENSE.txt file in the project root.
  22011. */
  22012. //
  22013. //
  22014. // This is an InputStream that is loaded from a file all at once
  22015. // when you construct the object.
  22016. //
  22017. var InputStream = __webpack_require__(/*! ./InputStream */ "./node_modules/antlr4/InputStream.js").InputStream;
  22018. var isNodeJs = typeof window === 'undefined' && typeof importScripts === 'undefined';
  22019. var fs = isNodeJs ? __webpack_require__(/*! fs */ "./node_modules/node-libs-browser/mock/empty.js") : null;
  22020. function FileStream(fileName, decodeToUnicodeCodePoints) {
  22021. var data = fs.readFileSync(fileName, "utf8");
  22022. InputStream.call(this, data, decodeToUnicodeCodePoints);
  22023. this.fileName = fileName;
  22024. return this;
  22025. }
  22026. FileStream.prototype = Object.create(InputStream.prototype);
  22027. FileStream.prototype.constructor = FileStream;
  22028. exports.FileStream = FileStream;
  22029. /***/ }),
  22030. /***/ "./node_modules/antlr4/InputStream.js":
  22031. /*!********************************************!*\
  22032. !*** ./node_modules/antlr4/InputStream.js ***!
  22033. \********************************************/
  22034. /*! no static exports found */
  22035. /***/ (function(module, exports, __webpack_require__) {
  22036. "use strict";
  22037. //
  22038. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  22039. * Use of this file is governed by the BSD 3-clause license that
  22040. * can be found in the LICENSE.txt file in the project root.
  22041. */
  22042. //
  22043. var Token = __webpack_require__(/*! ./Token */ "./node_modules/antlr4/Token.js").Token;
  22044. __webpack_require__(/*! ./polyfills/codepointat */ "./node_modules/antlr4/polyfills/codepointat.js");
  22045. __webpack_require__(/*! ./polyfills/fromcodepoint */ "./node_modules/antlr4/polyfills/fromcodepoint.js");
  22046. // Vacuum all input from a string and then treat it like a buffer.
  22047. function _loadString(stream, decodeToUnicodeCodePoints) {
  22048. stream._index = 0;
  22049. stream.data = [];
  22050. if (stream.decodeToUnicodeCodePoints) {
  22051. for (var i = 0; i < stream.strdata.length;) {
  22052. var codePoint = stream.strdata.codePointAt(i);
  22053. stream.data.push(codePoint);
  22054. i += codePoint <= 0xFFFF ? 1 : 2;
  22055. }
  22056. } else {
  22057. for (var i = 0; i < stream.strdata.length; i++) {
  22058. var codeUnit = stream.strdata.charCodeAt(i);
  22059. stream.data.push(codeUnit);
  22060. }
  22061. }
  22062. stream._size = stream.data.length;
  22063. }
  22064. // If decodeToUnicodeCodePoints is true, the input is treated
  22065. // as a series of Unicode code points.
  22066. //
  22067. // Otherwise, the input is treated as a series of 16-bit UTF-16 code
  22068. // units.
  22069. function InputStream(data, decodeToUnicodeCodePoints) {
  22070. this.name = "<empty>";
  22071. this.strdata = data;
  22072. this.decodeToUnicodeCodePoints = decodeToUnicodeCodePoints || false;
  22073. _loadString(this);
  22074. return this;
  22075. }
  22076. Object.defineProperty(InputStream.prototype, "index", {
  22077. get: function get() {
  22078. return this._index;
  22079. }
  22080. });
  22081. Object.defineProperty(InputStream.prototype, "size", {
  22082. get: function get() {
  22083. return this._size;
  22084. }
  22085. });
  22086. // Reset the stream so that it's in the same state it was
  22087. // when the object was created *except* the data array is not
  22088. // touched.
  22089. //
  22090. InputStream.prototype.reset = function () {
  22091. this._index = 0;
  22092. };
  22093. InputStream.prototype.consume = function () {
  22094. if (this._index >= this._size) {
  22095. // assert this.LA(1) == Token.EOF
  22096. throw "cannot consume EOF";
  22097. }
  22098. this._index += 1;
  22099. };
  22100. InputStream.prototype.LA = function (offset) {
  22101. if (offset === 0) {
  22102. return 0; // undefined
  22103. }
  22104. if (offset < 0) {
  22105. offset += 1; // e.g., translate LA(-1) to use offset=0
  22106. }
  22107. var pos = this._index + offset - 1;
  22108. if (pos < 0 || pos >= this._size) {
  22109. // invalid
  22110. return Token.EOF;
  22111. }
  22112. return this.data[pos];
  22113. };
  22114. InputStream.prototype.LT = function (offset) {
  22115. return this.LA(offset);
  22116. };
  22117. // mark/release do nothing; we have entire buffer
  22118. InputStream.prototype.mark = function () {
  22119. return -1;
  22120. };
  22121. InputStream.prototype.release = function (marker) {};
  22122. // consume() ahead until p==_index; can't just set p=_index as we must
  22123. // update line and column. If we seek backwards, just set p
  22124. //
  22125. InputStream.prototype.seek = function (_index) {
  22126. if (_index <= this._index) {
  22127. this._index = _index; // just jump; don't update stream state (line,
  22128. // ...)
  22129. return;
  22130. }
  22131. // seek forward
  22132. this._index = Math.min(_index, this._size);
  22133. };
  22134. InputStream.prototype.getText = function (start, stop) {
  22135. if (stop >= this._size) {
  22136. stop = this._size - 1;
  22137. }
  22138. if (start >= this._size) {
  22139. return "";
  22140. } else {
  22141. if (this.decodeToUnicodeCodePoints) {
  22142. var result = "";
  22143. for (var i = start; i <= stop; i++) {
  22144. result += String.fromCodePoint(this.data[i]);
  22145. }
  22146. return result;
  22147. } else {
  22148. return this.strdata.slice(start, stop + 1);
  22149. }
  22150. }
  22151. };
  22152. InputStream.prototype.toString = function () {
  22153. return this.strdata;
  22154. };
  22155. exports.InputStream = InputStream;
  22156. /***/ }),
  22157. /***/ "./node_modules/antlr4/IntervalSet.js":
  22158. /*!********************************************!*\
  22159. !*** ./node_modules/antlr4/IntervalSet.js ***!
  22160. \********************************************/
  22161. /*! no static exports found */
  22162. /***/ (function(module, exports, __webpack_require__) {
  22163. "use strict";
  22164. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  22165. * Use of this file is governed by the BSD 3-clause license that
  22166. * can be found in the LICENSE.txt file in the project root.
  22167. */
  22168. /*jslint smarttabs:true */
  22169. var Token = __webpack_require__(/*! ./Token */ "./node_modules/antlr4/Token.js").Token;
  22170. /* stop is not included! */
  22171. function Interval(start, stop) {
  22172. this.start = start;
  22173. this.stop = stop;
  22174. return this;
  22175. }
  22176. Interval.prototype.contains = function (item) {
  22177. return item >= this.start && item < this.stop;
  22178. };
  22179. Interval.prototype.toString = function () {
  22180. if (this.start === this.stop - 1) {
  22181. return this.start.toString();
  22182. } else {
  22183. return this.start.toString() + ".." + (this.stop - 1).toString();
  22184. }
  22185. };
  22186. Object.defineProperty(Interval.prototype, "length", {
  22187. get: function get() {
  22188. return this.stop - this.start;
  22189. }
  22190. });
  22191. function IntervalSet() {
  22192. this.intervals = null;
  22193. this.readOnly = false;
  22194. }
  22195. IntervalSet.prototype.first = function (v) {
  22196. if (this.intervals === null || this.intervals.length === 0) {
  22197. return Token.INVALID_TYPE;
  22198. } else {
  22199. return this.intervals[0].start;
  22200. }
  22201. };
  22202. IntervalSet.prototype.addOne = function (v) {
  22203. this.addInterval(new Interval(v, v + 1));
  22204. };
  22205. IntervalSet.prototype.addRange = function (l, h) {
  22206. this.addInterval(new Interval(l, h + 1));
  22207. };
  22208. IntervalSet.prototype.addInterval = function (v) {
  22209. if (this.intervals === null) {
  22210. this.intervals = [];
  22211. this.intervals.push(v);
  22212. } else {
  22213. // find insert pos
  22214. for (var k = 0; k < this.intervals.length; k++) {
  22215. var i = this.intervals[k];
  22216. // distinct range -> insert
  22217. if (v.stop < i.start) {
  22218. this.intervals.splice(k, 0, v);
  22219. return;
  22220. }
  22221. // contiguous range -> adjust
  22222. else if (v.stop === i.start) {
  22223. this.intervals[k].start = v.start;
  22224. return;
  22225. }
  22226. // overlapping range -> adjust and reduce
  22227. else if (v.start <= i.stop) {
  22228. this.intervals[k] = new Interval(Math.min(i.start, v.start), Math.max(i.stop, v.stop));
  22229. this.reduce(k);
  22230. return;
  22231. }
  22232. }
  22233. // greater than any existing
  22234. this.intervals.push(v);
  22235. }
  22236. };
  22237. IntervalSet.prototype.addSet = function (other) {
  22238. if (other.intervals !== null) {
  22239. for (var k = 0; k < other.intervals.length; k++) {
  22240. var i = other.intervals[k];
  22241. this.addInterval(new Interval(i.start, i.stop));
  22242. }
  22243. }
  22244. return this;
  22245. };
  22246. IntervalSet.prototype.reduce = function (k) {
  22247. // only need to reduce if k is not the last
  22248. if (k < this.intervalslength - 1) {
  22249. var l = this.intervals[k];
  22250. var r = this.intervals[k + 1];
  22251. // if r contained in l
  22252. if (l.stop >= r.stop) {
  22253. this.intervals.pop(k + 1);
  22254. this.reduce(k);
  22255. } else if (l.stop >= r.start) {
  22256. this.intervals[k] = new Interval(l.start, r.stop);
  22257. this.intervals.pop(k + 1);
  22258. }
  22259. }
  22260. };
  22261. IntervalSet.prototype.complement = function (start, stop) {
  22262. var result = new IntervalSet();
  22263. result.addInterval(new Interval(start, stop + 1));
  22264. for (var i = 0; i < this.intervals.length; i++) {
  22265. result.removeRange(this.intervals[i]);
  22266. }
  22267. return result;
  22268. };
  22269. IntervalSet.prototype.contains = function (item) {
  22270. if (this.intervals === null) {
  22271. return false;
  22272. } else {
  22273. for (var k = 0; k < this.intervals.length; k++) {
  22274. if (this.intervals[k].contains(item)) {
  22275. return true;
  22276. }
  22277. }
  22278. return false;
  22279. }
  22280. };
  22281. Object.defineProperty(IntervalSet.prototype, "length", {
  22282. get: function get() {
  22283. var len = 0;
  22284. this.intervals.map(function (i) {
  22285. len += i.length;
  22286. });
  22287. return len;
  22288. }
  22289. });
  22290. IntervalSet.prototype.removeRange = function (v) {
  22291. if (v.start === v.stop - 1) {
  22292. this.removeOne(v.start);
  22293. } else if (this.intervals !== null) {
  22294. var k = 0;
  22295. for (var n = 0; n < this.intervals.length; n++) {
  22296. var i = this.intervals[k];
  22297. // intervals are ordered
  22298. if (v.stop <= i.start) {
  22299. return;
  22300. }
  22301. // check for including range, split it
  22302. else if (v.start > i.start && v.stop < i.stop) {
  22303. this.intervals[k] = new Interval(i.start, v.start);
  22304. var x = new Interval(v.stop, i.stop);
  22305. this.intervals.splice(k, 0, x);
  22306. return;
  22307. }
  22308. // check for included range, remove it
  22309. else if (v.start <= i.start && v.stop >= i.stop) {
  22310. this.intervals.splice(k, 1);
  22311. k = k - 1; // need another pass
  22312. }
  22313. // check for lower boundary
  22314. else if (v.start < i.stop) {
  22315. this.intervals[k] = new Interval(i.start, v.start);
  22316. }
  22317. // check for upper boundary
  22318. else if (v.stop < i.stop) {
  22319. this.intervals[k] = new Interval(v.stop, i.stop);
  22320. }
  22321. k += 1;
  22322. }
  22323. }
  22324. };
  22325. IntervalSet.prototype.removeOne = function (v) {
  22326. if (this.intervals !== null) {
  22327. for (var k = 0; k < this.intervals.length; k++) {
  22328. var i = this.intervals[k];
  22329. // intervals is ordered
  22330. if (v < i.start) {
  22331. return;
  22332. }
  22333. // check for single value range
  22334. else if (v === i.start && v === i.stop - 1) {
  22335. this.intervals.splice(k, 1);
  22336. return;
  22337. }
  22338. // check for lower boundary
  22339. else if (v === i.start) {
  22340. this.intervals[k] = new Interval(i.start + 1, i.stop);
  22341. return;
  22342. }
  22343. // check for upper boundary
  22344. else if (v === i.stop - 1) {
  22345. this.intervals[k] = new Interval(i.start, i.stop - 1);
  22346. return;
  22347. }
  22348. // split existing range
  22349. else if (v < i.stop - 1) {
  22350. var x = new Interval(i.start, v);
  22351. i.start = v + 1;
  22352. this.intervals.splice(k, 0, x);
  22353. return;
  22354. }
  22355. }
  22356. }
  22357. };
  22358. IntervalSet.prototype.toString = function (literalNames, symbolicNames, elemsAreChar) {
  22359. literalNames = literalNames || null;
  22360. symbolicNames = symbolicNames || null;
  22361. elemsAreChar = elemsAreChar || false;
  22362. if (this.intervals === null) {
  22363. return "{}";
  22364. } else if (literalNames !== null || symbolicNames !== null) {
  22365. return this.toTokenString(literalNames, symbolicNames);
  22366. } else if (elemsAreChar) {
  22367. return this.toCharString();
  22368. } else {
  22369. return this.toIndexString();
  22370. }
  22371. };
  22372. IntervalSet.prototype.toCharString = function () {
  22373. var names = [];
  22374. for (var i = 0; i < this.intervals.length; i++) {
  22375. var v = this.intervals[i];
  22376. if (v.stop === v.start + 1) {
  22377. if (v.start === Token.EOF) {
  22378. names.push("<EOF>");
  22379. } else {
  22380. names.push("'" + String.fromCharCode(v.start) + "'");
  22381. }
  22382. } else {
  22383. names.push("'" + String.fromCharCode(v.start) + "'..'" + String.fromCharCode(v.stop - 1) + "'");
  22384. }
  22385. }
  22386. if (names.length > 1) {
  22387. return "{" + names.join(", ") + "}";
  22388. } else {
  22389. return names[0];
  22390. }
  22391. };
  22392. IntervalSet.prototype.toIndexString = function () {
  22393. var names = [];
  22394. for (var i = 0; i < this.intervals.length; i++) {
  22395. var v = this.intervals[i];
  22396. if (v.stop === v.start + 1) {
  22397. if (v.start === Token.EOF) {
  22398. names.push("<EOF>");
  22399. } else {
  22400. names.push(v.start.toString());
  22401. }
  22402. } else {
  22403. names.push(v.start.toString() + ".." + (v.stop - 1).toString());
  22404. }
  22405. }
  22406. if (names.length > 1) {
  22407. return "{" + names.join(", ") + "}";
  22408. } else {
  22409. return names[0];
  22410. }
  22411. };
  22412. IntervalSet.prototype.toTokenString = function (literalNames, symbolicNames) {
  22413. var names = [];
  22414. for (var i = 0; i < this.intervals.length; i++) {
  22415. var v = this.intervals[i];
  22416. for (var j = v.start; j < v.stop; j++) {
  22417. names.push(this.elementName(literalNames, symbolicNames, j));
  22418. }
  22419. }
  22420. if (names.length > 1) {
  22421. return "{" + names.join(", ") + "}";
  22422. } else {
  22423. return names[0];
  22424. }
  22425. };
  22426. IntervalSet.prototype.elementName = function (literalNames, symbolicNames, a) {
  22427. if (a === Token.EOF) {
  22428. return "<EOF>";
  22429. } else if (a === Token.EPSILON) {
  22430. return "<EPSILON>";
  22431. } else {
  22432. return literalNames[a] || symbolicNames[a];
  22433. }
  22434. };
  22435. exports.Interval = Interval;
  22436. exports.IntervalSet = IntervalSet;
  22437. /***/ }),
  22438. /***/ "./node_modules/antlr4/LL1Analyzer.js":
  22439. /*!********************************************!*\
  22440. !*** ./node_modules/antlr4/LL1Analyzer.js ***!
  22441. \********************************************/
  22442. /*! no static exports found */
  22443. /***/ (function(module, exports, __webpack_require__) {
  22444. "use strict";
  22445. //
  22446. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  22447. * Use of this file is governed by the BSD 3-clause license that
  22448. * can be found in the LICENSE.txt file in the project root.
  22449. */
  22450. ///
  22451. var Set = __webpack_require__(/*! ./Utils */ "./node_modules/antlr4/Utils.js").Set;
  22452. var BitSet = __webpack_require__(/*! ./Utils */ "./node_modules/antlr4/Utils.js").BitSet;
  22453. var Token = __webpack_require__(/*! ./Token */ "./node_modules/antlr4/Token.js").Token;
  22454. var ATNConfig = __webpack_require__(/*! ./atn/ATNConfig */ "./node_modules/antlr4/atn/ATNConfig.js").ATNConfig;
  22455. var Interval = __webpack_require__(/*! ./IntervalSet */ "./node_modules/antlr4/IntervalSet.js").Interval;
  22456. var IntervalSet = __webpack_require__(/*! ./IntervalSet */ "./node_modules/antlr4/IntervalSet.js").IntervalSet;
  22457. var RuleStopState = __webpack_require__(/*! ./atn/ATNState */ "./node_modules/antlr4/atn/ATNState.js").RuleStopState;
  22458. var RuleTransition = __webpack_require__(/*! ./atn/Transition */ "./node_modules/antlr4/atn/Transition.js").RuleTransition;
  22459. var NotSetTransition = __webpack_require__(/*! ./atn/Transition */ "./node_modules/antlr4/atn/Transition.js").NotSetTransition;
  22460. var WildcardTransition = __webpack_require__(/*! ./atn/Transition */ "./node_modules/antlr4/atn/Transition.js").WildcardTransition;
  22461. var AbstractPredicateTransition = __webpack_require__(/*! ./atn/Transition */ "./node_modules/antlr4/atn/Transition.js").AbstractPredicateTransition;
  22462. var pc = __webpack_require__(/*! ./PredictionContext */ "./node_modules/antlr4/PredictionContext.js");
  22463. var predictionContextFromRuleContext = pc.predictionContextFromRuleContext;
  22464. var PredictionContext = pc.PredictionContext;
  22465. var SingletonPredictionContext = pc.SingletonPredictionContext;
  22466. function LL1Analyzer(atn) {
  22467. this.atn = atn;
  22468. }
  22469. //* Special value added to the lookahead sets to indicate that we hit
  22470. // a predicate during analysis if {@code seeThruPreds==false}.
  22471. ///
  22472. LL1Analyzer.HIT_PRED = Token.INVALID_TYPE;
  22473. //*
  22474. // Calculates the SLL(1) expected lookahead set for each outgoing transition
  22475. // of an {@link ATNState}. The returned array has one element for each
  22476. // outgoing transition in {@code s}. If the closure from transition
  22477. // <em>i</em> leads to a semantic predicate before matching a symbol, the
  22478. // element at index <em>i</em> of the result will be {@code null}.
  22479. //
  22480. // @param s the ATN state
  22481. // @return the expected symbols for each outgoing transition of {@code s}.
  22482. ///
  22483. LL1Analyzer.prototype.getDecisionLookahead = function (s) {
  22484. if (s === null) {
  22485. return null;
  22486. }
  22487. var count = s.transitions.length;
  22488. var look = [];
  22489. for (var alt = 0; alt < count; alt++) {
  22490. look[alt] = new IntervalSet();
  22491. var lookBusy = new Set();
  22492. var seeThruPreds = false; // fail to get lookahead upon pred
  22493. this._LOOK(s.transition(alt).target, null, PredictionContext.EMPTY, look[alt], lookBusy, new BitSet(), seeThruPreds, false);
  22494. // Wipe out lookahead for this alternative if we found nothing
  22495. // or we had a predicate when we !seeThruPreds
  22496. if (look[alt].length === 0 || look[alt].contains(LL1Analyzer.HIT_PRED)) {
  22497. look[alt] = null;
  22498. }
  22499. }
  22500. return look;
  22501. };
  22502. //*
  22503. // Compute set of tokens that can follow {@code s} in the ATN in the
  22504. // specified {@code ctx}.
  22505. //
  22506. // <p>If {@code ctx} is {@code null} and the end of the rule containing
  22507. // {@code s} is reached, {@link Token//EPSILON} is added to the result set.
  22508. // If {@code ctx} is not {@code null} and the end of the outermost rule is
  22509. // reached, {@link Token//EOF} is added to the result set.</p>
  22510. //
  22511. // @param s the ATN state
  22512. // @param stopState the ATN state to stop at. This can be a
  22513. // {@link BlockEndState} to detect epsilon paths through a closure.
  22514. // @param ctx the complete parser context, or {@code null} if the context
  22515. // should be ignored
  22516. //
  22517. // @return The set of tokens that can follow {@code s} in the ATN in the
  22518. // specified {@code ctx}.
  22519. ///
  22520. LL1Analyzer.prototype.LOOK = function (s, stopState, ctx) {
  22521. var r = new IntervalSet();
  22522. var seeThruPreds = true; // ignore preds; get all lookahead
  22523. ctx = ctx || null;
  22524. var lookContext = ctx !== null ? predictionContextFromRuleContext(s.atn, ctx) : null;
  22525. this._LOOK(s, stopState, lookContext, r, new Set(), new BitSet(), seeThruPreds, true);
  22526. return r;
  22527. };
  22528. //*
  22529. // Compute set of tokens that can follow {@code s} in the ATN in the
  22530. // specified {@code ctx}.
  22531. //
  22532. // <p>If {@code ctx} is {@code null} and {@code stopState} or the end of the
  22533. // rule containing {@code s} is reached, {@link Token//EPSILON} is added to
  22534. // the result set. If {@code ctx} is not {@code null} and {@code addEOF} is
  22535. // {@code true} and {@code stopState} or the end of the outermost rule is
  22536. // reached, {@link Token//EOF} is added to the result set.</p>
  22537. //
  22538. // @param s the ATN state.
  22539. // @param stopState the ATN state to stop at. This can be a
  22540. // {@link BlockEndState} to detect epsilon paths through a closure.
  22541. // @param ctx The outer context, or {@code null} if the outer context should
  22542. // not be used.
  22543. // @param look The result lookahead set.
  22544. // @param lookBusy A set used for preventing epsilon closures in the ATN
  22545. // from causing a stack overflow. Outside code should pass
  22546. // {@code new Set<ATNConfig>} for this argument.
  22547. // @param calledRuleStack A set used for preventing left recursion in the
  22548. // ATN from causing a stack overflow. Outside code should pass
  22549. // {@code new BitSet()} for this argument.
  22550. // @param seeThruPreds {@code true} to true semantic predicates as
  22551. // implicitly {@code true} and "see through them", otherwise {@code false}
  22552. // to treat semantic predicates as opaque and add {@link //HIT_PRED} to the
  22553. // result if one is encountered.
  22554. // @param addEOF Add {@link Token//EOF} to the result if the end of the
  22555. // outermost context is reached. This parameter has no effect if {@code ctx}
  22556. // is {@code null}.
  22557. ///
  22558. LL1Analyzer.prototype._LOOK = function (s, stopState, ctx, look, lookBusy, calledRuleStack, seeThruPreds, addEOF) {
  22559. var c = new ATNConfig({ state: s, alt: 0, context: ctx }, null);
  22560. if (lookBusy.contains(c)) {
  22561. return;
  22562. }
  22563. lookBusy.add(c);
  22564. if (s === stopState) {
  22565. if (ctx === null) {
  22566. look.addOne(Token.EPSILON);
  22567. return;
  22568. } else if (ctx.isEmpty() && addEOF) {
  22569. look.addOne(Token.EOF);
  22570. return;
  22571. }
  22572. }
  22573. if (s instanceof RuleStopState) {
  22574. if (ctx === null) {
  22575. look.addOne(Token.EPSILON);
  22576. return;
  22577. } else if (ctx.isEmpty() && addEOF) {
  22578. look.addOne(Token.EOF);
  22579. return;
  22580. }
  22581. if (ctx !== PredictionContext.EMPTY) {
  22582. // run thru all possible stack tops in ctx
  22583. for (var i = 0; i < ctx.length; i++) {
  22584. var returnState = this.atn.states[ctx.getReturnState(i)];
  22585. var removed = calledRuleStack.contains(returnState.ruleIndex);
  22586. try {
  22587. calledRuleStack.remove(returnState.ruleIndex);
  22588. this._LOOK(returnState, stopState, ctx.getParent(i), look, lookBusy, calledRuleStack, seeThruPreds, addEOF);
  22589. } finally {
  22590. if (removed) {
  22591. calledRuleStack.add(returnState.ruleIndex);
  22592. }
  22593. }
  22594. }
  22595. return;
  22596. }
  22597. }
  22598. for (var j = 0; j < s.transitions.length; j++) {
  22599. var t = s.transitions[j];
  22600. if (t.constructor === RuleTransition) {
  22601. if (calledRuleStack.contains(t.target.ruleIndex)) {
  22602. continue;
  22603. }
  22604. var newContext = SingletonPredictionContext.create(ctx, t.followState.stateNumber);
  22605. try {
  22606. calledRuleStack.add(t.target.ruleIndex);
  22607. this._LOOK(t.target, stopState, newContext, look, lookBusy, calledRuleStack, seeThruPreds, addEOF);
  22608. } finally {
  22609. calledRuleStack.remove(t.target.ruleIndex);
  22610. }
  22611. } else if (t instanceof AbstractPredicateTransition) {
  22612. if (seeThruPreds) {
  22613. this._LOOK(t.target, stopState, ctx, look, lookBusy, calledRuleStack, seeThruPreds, addEOF);
  22614. } else {
  22615. look.addOne(LL1Analyzer.HIT_PRED);
  22616. }
  22617. } else if (t.isEpsilon) {
  22618. this._LOOK(t.target, stopState, ctx, look, lookBusy, calledRuleStack, seeThruPreds, addEOF);
  22619. } else if (t.constructor === WildcardTransition) {
  22620. look.addRange(Token.MIN_USER_TOKEN_TYPE, this.atn.maxTokenType);
  22621. } else {
  22622. var set = t.label;
  22623. if (set !== null) {
  22624. if (t instanceof NotSetTransition) {
  22625. set = set.complement(Token.MIN_USER_TOKEN_TYPE, this.atn.maxTokenType);
  22626. }
  22627. look.addSet(set);
  22628. }
  22629. }
  22630. }
  22631. };
  22632. exports.LL1Analyzer = LL1Analyzer;
  22633. /***/ }),
  22634. /***/ "./node_modules/antlr4/Lexer.js":
  22635. /*!**************************************!*\
  22636. !*** ./node_modules/antlr4/Lexer.js ***!
  22637. \**************************************/
  22638. /*! no static exports found */
  22639. /***/ (function(module, exports, __webpack_require__) {
  22640. "use strict";
  22641. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  22642. * Use of this file is governed by the BSD 3-clause license that
  22643. * can be found in the LICENSE.txt file in the project root.
  22644. */
  22645. ///
  22646. // A lexer is recognizer that draws input symbols from a character stream.
  22647. // lexer grammars result in a subclass of this object. A Lexer object
  22648. // uses simplified match() and error recovery mechanisms in the interest of speed.
  22649. var Token = __webpack_require__(/*! ./Token */ "./node_modules/antlr4/Token.js").Token;
  22650. var Recognizer = __webpack_require__(/*! ./Recognizer */ "./node_modules/antlr4/Recognizer.js").Recognizer;
  22651. var CommonTokenFactory = __webpack_require__(/*! ./CommonTokenFactory */ "./node_modules/antlr4/CommonTokenFactory.js").CommonTokenFactory;
  22652. var RecognitionException = __webpack_require__(/*! ./error/Errors */ "./node_modules/antlr4/error/Errors.js").RecognitionException;
  22653. var LexerNoViableAltException = __webpack_require__(/*! ./error/Errors */ "./node_modules/antlr4/error/Errors.js").LexerNoViableAltException;
  22654. function TokenSource() {
  22655. return this;
  22656. }
  22657. function Lexer(input) {
  22658. Recognizer.call(this);
  22659. this._input = input;
  22660. this._factory = CommonTokenFactory.DEFAULT;
  22661. this._tokenFactorySourcePair = [this, input];
  22662. this._interp = null; // child classes must populate this
  22663. // The goal of all lexer rules/methods is to create a token object.
  22664. // this is an instance variable as multiple rules may collaborate to
  22665. // create a single token. nextToken will return this object after
  22666. // matching lexer rule(s). If you subclass to allow multiple token
  22667. // emissions, then set this to the last token to be matched or
  22668. // something nonnull so that the auto token emit mechanism will not
  22669. // emit another token.
  22670. this._token = null;
  22671. // What character index in the stream did the current token start at?
  22672. // Needed, for example, to get the text for current token. Set at
  22673. // the start of nextToken.
  22674. this._tokenStartCharIndex = -1;
  22675. // The line on which the first character of the token resides///
  22676. this._tokenStartLine = -1;
  22677. // The character position of first character within the line///
  22678. this._tokenStartColumn = -1;
  22679. // Once we see EOF on char stream, next token will be EOF.
  22680. // If you have DONE : EOF ; then you see DONE EOF.
  22681. this._hitEOF = false;
  22682. // The channel number for the current token///
  22683. this._channel = Token.DEFAULT_CHANNEL;
  22684. // The token type for the current token///
  22685. this._type = Token.INVALID_TYPE;
  22686. this._modeStack = [];
  22687. this._mode = Lexer.DEFAULT_MODE;
  22688. // You can set the text for the current token to override what is in
  22689. // the input char buffer. Use setText() or can set this instance var.
  22690. // /
  22691. this._text = null;
  22692. return this;
  22693. }
  22694. Lexer.prototype = Object.create(Recognizer.prototype);
  22695. Lexer.prototype.constructor = Lexer;
  22696. Lexer.DEFAULT_MODE = 0;
  22697. Lexer.MORE = -2;
  22698. Lexer.SKIP = -3;
  22699. Lexer.DEFAULT_TOKEN_CHANNEL = Token.DEFAULT_CHANNEL;
  22700. Lexer.HIDDEN = Token.HIDDEN_CHANNEL;
  22701. Lexer.MIN_CHAR_VALUE = 0x0000;
  22702. Lexer.MAX_CHAR_VALUE = 0x10FFFF;
  22703. Lexer.prototype.reset = function () {
  22704. // wack Lexer state variables
  22705. if (this._input !== null) {
  22706. this._input.seek(0); // rewind the input
  22707. }
  22708. this._token = null;
  22709. this._type = Token.INVALID_TYPE;
  22710. this._channel = Token.DEFAULT_CHANNEL;
  22711. this._tokenStartCharIndex = -1;
  22712. this._tokenStartColumn = -1;
  22713. this._tokenStartLine = -1;
  22714. this._text = null;
  22715. this._hitEOF = false;
  22716. this._mode = Lexer.DEFAULT_MODE;
  22717. this._modeStack = [];
  22718. this._interp.reset();
  22719. };
  22720. // Return a token from this source; i.e., match a token on the char stream.
  22721. Lexer.prototype.nextToken = function () {
  22722. if (this._input === null) {
  22723. throw "nextToken requires a non-null input stream.";
  22724. }
  22725. // Mark start location in char stream so unbuffered streams are
  22726. // guaranteed at least have text of current token
  22727. var tokenStartMarker = this._input.mark();
  22728. try {
  22729. while (true) {
  22730. if (this._hitEOF) {
  22731. this.emitEOF();
  22732. return this._token;
  22733. }
  22734. this._token = null;
  22735. this._channel = Token.DEFAULT_CHANNEL;
  22736. this._tokenStartCharIndex = this._input.index;
  22737. this._tokenStartColumn = this._interp.column;
  22738. this._tokenStartLine = this._interp.line;
  22739. this._text = null;
  22740. var continueOuter = false;
  22741. while (true) {
  22742. this._type = Token.INVALID_TYPE;
  22743. var ttype = Lexer.SKIP;
  22744. try {
  22745. ttype = this._interp.match(this._input, this._mode);
  22746. } catch (e) {
  22747. if (e instanceof RecognitionException) {
  22748. this.notifyListeners(e); // report error
  22749. this.recover(e);
  22750. } else {
  22751. console.log(e.stack);
  22752. throw e;
  22753. }
  22754. }
  22755. if (this._input.LA(1) === Token.EOF) {
  22756. this._hitEOF = true;
  22757. }
  22758. if (this._type === Token.INVALID_TYPE) {
  22759. this._type = ttype;
  22760. }
  22761. if (this._type === Lexer.SKIP) {
  22762. continueOuter = true;
  22763. break;
  22764. }
  22765. if (this._type !== Lexer.MORE) {
  22766. break;
  22767. }
  22768. }
  22769. if (continueOuter) {
  22770. continue;
  22771. }
  22772. if (this._token === null) {
  22773. this.emit();
  22774. }
  22775. return this._token;
  22776. }
  22777. } finally {
  22778. // make sure we release marker after match or
  22779. // unbuffered char stream will keep buffering
  22780. this._input.release(tokenStartMarker);
  22781. }
  22782. };
  22783. // Instruct the lexer to skip creating a token for current lexer rule
  22784. // and look for another token. nextToken() knows to keep looking when
  22785. // a lexer rule finishes with token set to SKIP_TOKEN. Recall that
  22786. // if token==null at end of any token rule, it creates one for you
  22787. // and emits it.
  22788. // /
  22789. Lexer.prototype.skip = function () {
  22790. this._type = Lexer.SKIP;
  22791. };
  22792. Lexer.prototype.more = function () {
  22793. this._type = Lexer.MORE;
  22794. };
  22795. Lexer.prototype.mode = function (m) {
  22796. this._mode = m;
  22797. };
  22798. Lexer.prototype.pushMode = function (m) {
  22799. if (this._interp.debug) {
  22800. console.log("pushMode " + m);
  22801. }
  22802. this._modeStack.push(this._mode);
  22803. this.mode(m);
  22804. };
  22805. Lexer.prototype.popMode = function () {
  22806. if (this._modeStack.length === 0) {
  22807. throw "Empty Stack";
  22808. }
  22809. if (this._interp.debug) {
  22810. console.log("popMode back to " + this._modeStack.slice(0, -1));
  22811. }
  22812. this.mode(this._modeStack.pop());
  22813. return this._mode;
  22814. };
  22815. // Set the char stream and reset the lexer
  22816. Object.defineProperty(Lexer.prototype, "inputStream", {
  22817. get: function get() {
  22818. return this._input;
  22819. },
  22820. set: function set(input) {
  22821. this._input = null;
  22822. this._tokenFactorySourcePair = [this, this._input];
  22823. this.reset();
  22824. this._input = input;
  22825. this._tokenFactorySourcePair = [this, this._input];
  22826. }
  22827. });
  22828. Object.defineProperty(Lexer.prototype, "sourceName", {
  22829. get: function sourceName() {
  22830. return this._input.sourceName;
  22831. }
  22832. });
  22833. // By default does not support multiple emits per nextToken invocation
  22834. // for efficiency reasons. Subclass and override this method, nextToken,
  22835. // and getToken (to push tokens into a list and pull from that list
  22836. // rather than a single variable as this implementation does).
  22837. // /
  22838. Lexer.prototype.emitToken = function (token) {
  22839. this._token = token;
  22840. };
  22841. // The standard method called to automatically emit a token at the
  22842. // outermost lexical rule. The token object should point into the
  22843. // char buffer start..stop. If there is a text override in 'text',
  22844. // use that to set the token's text. Override this method to emit
  22845. // custom Token objects or provide a new factory.
  22846. // /
  22847. Lexer.prototype.emit = function () {
  22848. var t = this._factory.create(this._tokenFactorySourcePair, this._type, this._text, this._channel, this._tokenStartCharIndex, this.getCharIndex() - 1, this._tokenStartLine, this._tokenStartColumn);
  22849. this.emitToken(t);
  22850. return t;
  22851. };
  22852. Lexer.prototype.emitEOF = function () {
  22853. var cpos = this.column;
  22854. var lpos = this.line;
  22855. var eof = this._factory.create(this._tokenFactorySourcePair, Token.EOF, null, Token.DEFAULT_CHANNEL, this._input.index, this._input.index - 1, lpos, cpos);
  22856. this.emitToken(eof);
  22857. return eof;
  22858. };
  22859. Object.defineProperty(Lexer.prototype, "type", {
  22860. get: function get() {
  22861. return this.type;
  22862. },
  22863. set: function set(type) {
  22864. this._type = type;
  22865. }
  22866. });
  22867. Object.defineProperty(Lexer.prototype, "line", {
  22868. get: function get() {
  22869. return this._interp.line;
  22870. },
  22871. set: function set(line) {
  22872. this._interp.line = line;
  22873. }
  22874. });
  22875. Object.defineProperty(Lexer.prototype, "column", {
  22876. get: function get() {
  22877. return this._interp.column;
  22878. },
  22879. set: function set(column) {
  22880. this._interp.column = column;
  22881. }
  22882. });
  22883. // What is the index of the current character of lookahead?///
  22884. Lexer.prototype.getCharIndex = function () {
  22885. return this._input.index;
  22886. };
  22887. // Return the text matched so far for the current token or any text override.
  22888. //Set the complete text of this token; it wipes any previous changes to the text.
  22889. Object.defineProperty(Lexer.prototype, "text", {
  22890. get: function get() {
  22891. if (this._text !== null) {
  22892. return this._text;
  22893. } else {
  22894. return this._interp.getText(this._input);
  22895. }
  22896. },
  22897. set: function set(text) {
  22898. this._text = text;
  22899. }
  22900. });
  22901. // Return a list of all Token objects in input char stream.
  22902. // Forces load of all tokens. Does not include EOF token.
  22903. // /
  22904. Lexer.prototype.getAllTokens = function () {
  22905. var tokens = [];
  22906. var t = this.nextToken();
  22907. while (t.type !== Token.EOF) {
  22908. tokens.push(t);
  22909. t = this.nextToken();
  22910. }
  22911. return tokens;
  22912. };
  22913. Lexer.prototype.notifyListeners = function (e) {
  22914. var start = this._tokenStartCharIndex;
  22915. var stop = this._input.index;
  22916. var text = this._input.getText(start, stop);
  22917. var msg = "token recognition error at: '" + this.getErrorDisplay(text) + "'";
  22918. var listener = this.getErrorListenerDispatch();
  22919. listener.syntaxError(this, null, this._tokenStartLine, this._tokenStartColumn, msg, e);
  22920. };
  22921. Lexer.prototype.getErrorDisplay = function (s) {
  22922. var d = [];
  22923. for (var i = 0; i < s.length; i++) {
  22924. d.push(s[i]);
  22925. }
  22926. return d.join('');
  22927. };
  22928. Lexer.prototype.getErrorDisplayForChar = function (c) {
  22929. if (c.charCodeAt(0) === Token.EOF) {
  22930. return "<EOF>";
  22931. } else if (c === '\n') {
  22932. return "\\n";
  22933. } else if (c === '\t') {
  22934. return "\\t";
  22935. } else if (c === '\r') {
  22936. return "\\r";
  22937. } else {
  22938. return c;
  22939. }
  22940. };
  22941. Lexer.prototype.getCharErrorDisplay = function (c) {
  22942. return "'" + this.getErrorDisplayForChar(c) + "'";
  22943. };
  22944. // Lexers can normally match any char in it's vocabulary after matching
  22945. // a token, so do the easy thing and just kill a character and hope
  22946. // it all works out. You can instead use the rule invocation stack
  22947. // to do sophisticated error recovery if you are in a fragment rule.
  22948. // /
  22949. Lexer.prototype.recover = function (re) {
  22950. if (this._input.LA(1) !== Token.EOF) {
  22951. if (re instanceof LexerNoViableAltException) {
  22952. // skip a char and try again
  22953. this._interp.consume(this._input);
  22954. } else {
  22955. // TODO: Do we lose character or line position information?
  22956. this._input.consume();
  22957. }
  22958. }
  22959. };
  22960. exports.Lexer = Lexer;
  22961. /***/ }),
  22962. /***/ "./node_modules/antlr4/Parser.js":
  22963. /*!***************************************!*\
  22964. !*** ./node_modules/antlr4/Parser.js ***!
  22965. \***************************************/
  22966. /*! no static exports found */
  22967. /***/ (function(module, exports, __webpack_require__) {
  22968. "use strict";
  22969. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  22970. * Use of this file is governed by the BSD 3-clause license that
  22971. * can be found in the LICENSE.txt file in the project root.
  22972. */
  22973. var Token = __webpack_require__(/*! ./Token */ "./node_modules/antlr4/Token.js").Token;
  22974. var ParseTreeListener = __webpack_require__(/*! ./tree/Tree */ "./node_modules/antlr4/tree/Tree.js").ParseTreeListener;
  22975. var Recognizer = __webpack_require__(/*! ./Recognizer */ "./node_modules/antlr4/Recognizer.js").Recognizer;
  22976. var DefaultErrorStrategy = __webpack_require__(/*! ./error/ErrorStrategy */ "./node_modules/antlr4/error/ErrorStrategy.js").DefaultErrorStrategy;
  22977. var ATNDeserializer = __webpack_require__(/*! ./atn/ATNDeserializer */ "./node_modules/antlr4/atn/ATNDeserializer.js").ATNDeserializer;
  22978. var ATNDeserializationOptions = __webpack_require__(/*! ./atn/ATNDeserializationOptions */ "./node_modules/antlr4/atn/ATNDeserializationOptions.js").ATNDeserializationOptions;
  22979. var TerminalNode = __webpack_require__(/*! ./tree/Tree */ "./node_modules/antlr4/tree/Tree.js").TerminalNode;
  22980. var ErrorNode = __webpack_require__(/*! ./tree/Tree */ "./node_modules/antlr4/tree/Tree.js").ErrorNode;
  22981. function TraceListener(parser) {
  22982. ParseTreeListener.call(this);
  22983. this.parser = parser;
  22984. return this;
  22985. }
  22986. TraceListener.prototype = Object.create(ParseTreeListener.prototype);
  22987. TraceListener.prototype.constructor = TraceListener;
  22988. TraceListener.prototype.enterEveryRule = function (ctx) {
  22989. console.log("enter " + this.parser.ruleNames[ctx.ruleIndex] + ", LT(1)=" + this.parser._input.LT(1).text);
  22990. };
  22991. TraceListener.prototype.visitTerminal = function (node) {
  22992. console.log("consume " + node.symbol + " rule " + this.parser.ruleNames[this.parser._ctx.ruleIndex]);
  22993. };
  22994. TraceListener.prototype.exitEveryRule = function (ctx) {
  22995. console.log("exit " + this.parser.ruleNames[ctx.ruleIndex] + ", LT(1)=" + this.parser._input.LT(1).text);
  22996. };
  22997. // this is all the parsing support code essentially; most of it is error
  22998. // recovery stuff.//
  22999. function Parser(input) {
  23000. Recognizer.call(this);
  23001. // The input stream.
  23002. this._input = null;
  23003. // The error handling strategy for the parser. The default value is a new
  23004. // instance of {@link DefaultErrorStrategy}.
  23005. this._errHandler = new DefaultErrorStrategy();
  23006. this._precedenceStack = [];
  23007. this._precedenceStack.push(0);
  23008. // The {@link ParserRuleContext} object for the currently executing rule.
  23009. // this is always non-null during the parsing process.
  23010. this._ctx = null;
  23011. // Specifies whether or not the parser should construct a parse tree during
  23012. // the parsing process. The default value is {@code true}.
  23013. this.buildParseTrees = true;
  23014. // When {@link //setTrace}{@code (true)} is called, a reference to the
  23015. // {@link TraceListener} is stored here so it can be easily removed in a
  23016. // later call to {@link //setTrace}{@code (false)}. The listener itself is
  23017. // implemented as a parser listener so this field is not directly used by
  23018. // other parser methods.
  23019. this._tracer = null;
  23020. // The list of {@link ParseTreeListener} listeners registered to receive
  23021. // events during the parse.
  23022. this._parseListeners = null;
  23023. // The number of syntax errors reported during parsing. this value is
  23024. // incremented each time {@link //notifyErrorListeners} is called.
  23025. this._syntaxErrors = 0;
  23026. this.setInputStream(input);
  23027. return this;
  23028. }
  23029. Parser.prototype = Object.create(Recognizer.prototype);
  23030. Parser.prototype.contructor = Parser;
  23031. // this field maps from the serialized ATN string to the deserialized {@link
  23032. // ATN} with
  23033. // bypass alternatives.
  23034. //
  23035. // @see ATNDeserializationOptions//isGenerateRuleBypassTransitions()
  23036. //
  23037. Parser.bypassAltsAtnCache = {};
  23038. // reset the parser's state//
  23039. Parser.prototype.reset = function () {
  23040. if (this._input !== null) {
  23041. this._input.seek(0);
  23042. }
  23043. this._errHandler.reset(this);
  23044. this._ctx = null;
  23045. this._syntaxErrors = 0;
  23046. this.setTrace(false);
  23047. this._precedenceStack = [];
  23048. this._precedenceStack.push(0);
  23049. if (this._interp !== null) {
  23050. this._interp.reset();
  23051. }
  23052. };
  23053. // Match current input symbol against {@code ttype}. If the symbol type
  23054. // matches, {@link ANTLRErrorStrategy//reportMatch} and {@link //consume} are
  23055. // called to complete the match process.
  23056. //
  23057. // <p>If the symbol type does not match,
  23058. // {@link ANTLRErrorStrategy//recoverInline} is called on the current error
  23059. // strategy to attempt recovery. If {@link //getBuildParseTree} is
  23060. // {@code true} and the token index of the symbol returned by
  23061. // {@link ANTLRErrorStrategy//recoverInline} is -1, the symbol is added to
  23062. // the parse tree by calling {@link ParserRuleContext//addErrorNode}.</p>
  23063. //
  23064. // @param ttype the token type to match
  23065. // @return the matched symbol
  23066. // @throws RecognitionException if the current input symbol did not match
  23067. // {@code ttype} and the error strategy could not recover from the
  23068. // mismatched symbol
  23069. Parser.prototype.match = function (ttype) {
  23070. var t = this.getCurrentToken();
  23071. if (t.type === ttype) {
  23072. this._errHandler.reportMatch(this);
  23073. this.consume();
  23074. } else {
  23075. t = this._errHandler.recoverInline(this);
  23076. if (this.buildParseTrees && t.tokenIndex === -1) {
  23077. // we must have conjured up a new token during single token
  23078. // insertion
  23079. // if it's not the current symbol
  23080. this._ctx.addErrorNode(t);
  23081. }
  23082. }
  23083. return t;
  23084. };
  23085. // Match current input symbol as a wildcard. If the symbol type matches
  23086. // (i.e. has a value greater than 0), {@link ANTLRErrorStrategy//reportMatch}
  23087. // and {@link //consume} are called to complete the match process.
  23088. //
  23089. // <p>If the symbol type does not match,
  23090. // {@link ANTLRErrorStrategy//recoverInline} is called on the current error
  23091. // strategy to attempt recovery. If {@link //getBuildParseTree} is
  23092. // {@code true} and the token index of the symbol returned by
  23093. // {@link ANTLRErrorStrategy//recoverInline} is -1, the symbol is added to
  23094. // the parse tree by calling {@link ParserRuleContext//addErrorNode}.</p>
  23095. //
  23096. // @return the matched symbol
  23097. // @throws RecognitionException if the current input symbol did not match
  23098. // a wildcard and the error strategy could not recover from the mismatched
  23099. // symbol
  23100. Parser.prototype.matchWildcard = function () {
  23101. var t = this.getCurrentToken();
  23102. if (t.type > 0) {
  23103. this._errHandler.reportMatch(this);
  23104. this.consume();
  23105. } else {
  23106. t = this._errHandler.recoverInline(this);
  23107. if (this._buildParseTrees && t.tokenIndex === -1) {
  23108. // we must have conjured up a new token during single token
  23109. // insertion
  23110. // if it's not the current symbol
  23111. this._ctx.addErrorNode(t);
  23112. }
  23113. }
  23114. return t;
  23115. };
  23116. Parser.prototype.getParseListeners = function () {
  23117. return this._parseListeners || [];
  23118. };
  23119. // Registers {@code listener} to receive events during the parsing process.
  23120. //
  23121. // <p>To support output-preserving grammar transformations (including but not
  23122. // limited to left-recursion removal, automated left-factoring, and
  23123. // optimized code generation), calls to listener methods during the parse
  23124. // may differ substantially from calls made by
  23125. // {@link ParseTreeWalker//DEFAULT} used after the parse is complete. In
  23126. // particular, rule entry and exit events may occur in a different order
  23127. // during the parse than after the parser. In addition, calls to certain
  23128. // rule entry methods may be omitted.</p>
  23129. //
  23130. // <p>With the following specific exceptions, calls to listener events are
  23131. // <em>deterministic</em>, i.e. for identical input the calls to listener
  23132. // methods will be the same.</p>
  23133. //
  23134. // <ul>
  23135. // <li>Alterations to the grammar used to generate code may change the
  23136. // behavior of the listener calls.</li>
  23137. // <li>Alterations to the command line options passed to ANTLR 4 when
  23138. // generating the parser may change the behavior of the listener calls.</li>
  23139. // <li>Changing the version of the ANTLR Tool used to generate the parser
  23140. // may change the behavior of the listener calls.</li>
  23141. // </ul>
  23142. //
  23143. // @param listener the listener to add
  23144. //
  23145. // @throws NullPointerException if {@code} listener is {@code null}
  23146. //
  23147. Parser.prototype.addParseListener = function (listener) {
  23148. if (listener === null) {
  23149. throw "listener";
  23150. }
  23151. if (this._parseListeners === null) {
  23152. this._parseListeners = [];
  23153. }
  23154. this._parseListeners.push(listener);
  23155. };
  23156. //
  23157. // Remove {@code listener} from the list of parse listeners.
  23158. //
  23159. // <p>If {@code listener} is {@code null} or has not been added as a parse
  23160. // listener, this method does nothing.</p>
  23161. // @param listener the listener to remove
  23162. //
  23163. Parser.prototype.removeParseListener = function (listener) {
  23164. if (this._parseListeners !== null) {
  23165. var idx = this._parseListeners.indexOf(listener);
  23166. if (idx >= 0) {
  23167. this._parseListeners.splice(idx, 1);
  23168. }
  23169. if (this._parseListeners.length === 0) {
  23170. this._parseListeners = null;
  23171. }
  23172. }
  23173. };
  23174. // Remove all parse listeners.
  23175. Parser.prototype.removeParseListeners = function () {
  23176. this._parseListeners = null;
  23177. };
  23178. // Notify any parse listeners of an enter rule event.
  23179. Parser.prototype.triggerEnterRuleEvent = function () {
  23180. if (this._parseListeners !== null) {
  23181. var ctx = this._ctx;
  23182. this._parseListeners.map(function (listener) {
  23183. listener.enterEveryRule(ctx);
  23184. ctx.enterRule(listener);
  23185. });
  23186. }
  23187. };
  23188. //
  23189. // Notify any parse listeners of an exit rule event.
  23190. //
  23191. // @see //addParseListener
  23192. //
  23193. Parser.prototype.triggerExitRuleEvent = function () {
  23194. if (this._parseListeners !== null) {
  23195. // reverse order walk of listeners
  23196. var ctx = this._ctx;
  23197. this._parseListeners.slice(0).reverse().map(function (listener) {
  23198. ctx.exitRule(listener);
  23199. listener.exitEveryRule(ctx);
  23200. });
  23201. }
  23202. };
  23203. Parser.prototype.getTokenFactory = function () {
  23204. return this._input.tokenSource._factory;
  23205. };
  23206. // Tell our token source and error strategy about a new way to create tokens.//
  23207. Parser.prototype.setTokenFactory = function (factory) {
  23208. this._input.tokenSource._factory = factory;
  23209. };
  23210. // The ATN with bypass alternatives is expensive to create so we create it
  23211. // lazily.
  23212. //
  23213. // @throws UnsupportedOperationException if the current parser does not
  23214. // implement the {@link //getSerializedATN()} method.
  23215. //
  23216. Parser.prototype.getATNWithBypassAlts = function () {
  23217. var serializedAtn = this.getSerializedATN();
  23218. if (serializedAtn === null) {
  23219. throw "The current parser does not support an ATN with bypass alternatives.";
  23220. }
  23221. var result = this.bypassAltsAtnCache[serializedAtn];
  23222. if (result === null) {
  23223. var deserializationOptions = new ATNDeserializationOptions();
  23224. deserializationOptions.generateRuleBypassTransitions = true;
  23225. result = new ATNDeserializer(deserializationOptions).deserialize(serializedAtn);
  23226. this.bypassAltsAtnCache[serializedAtn] = result;
  23227. }
  23228. return result;
  23229. };
  23230. // The preferred method of getting a tree pattern. For example, here's a
  23231. // sample use:
  23232. //
  23233. // <pre>
  23234. // ParseTree t = parser.expr();
  23235. // ParseTreePattern p = parser.compileParseTreePattern("&lt;ID&gt;+0",
  23236. // MyParser.RULE_expr);
  23237. // ParseTreeMatch m = p.match(t);
  23238. // String id = m.get("ID");
  23239. // </pre>
  23240. var Lexer = __webpack_require__(/*! ./Lexer */ "./node_modules/antlr4/Lexer.js").Lexer;
  23241. Parser.prototype.compileParseTreePattern = function (pattern, patternRuleIndex, lexer) {
  23242. lexer = lexer || null;
  23243. if (lexer === null) {
  23244. if (this.getTokenStream() !== null) {
  23245. var tokenSource = this.getTokenStream().tokenSource;
  23246. if (tokenSource instanceof Lexer) {
  23247. lexer = tokenSource;
  23248. }
  23249. }
  23250. }
  23251. if (lexer === null) {
  23252. throw "Parser can't discover a lexer to use";
  23253. }
  23254. var m = new ParseTreePatternMatcher(lexer, this);
  23255. return m.compile(pattern, patternRuleIndex);
  23256. };
  23257. Parser.prototype.getInputStream = function () {
  23258. return this.getTokenStream();
  23259. };
  23260. Parser.prototype.setInputStream = function (input) {
  23261. this.setTokenStream(input);
  23262. };
  23263. Parser.prototype.getTokenStream = function () {
  23264. return this._input;
  23265. };
  23266. // Set the token stream and reset the parser.//
  23267. Parser.prototype.setTokenStream = function (input) {
  23268. this._input = null;
  23269. this.reset();
  23270. this._input = input;
  23271. };
  23272. // Match needs to return the current input symbol, which gets put
  23273. // into the label for the associated token ref; e.g., x=ID.
  23274. //
  23275. Parser.prototype.getCurrentToken = function () {
  23276. return this._input.LT(1);
  23277. };
  23278. Parser.prototype.notifyErrorListeners = function (msg, offendingToken, err) {
  23279. offendingToken = offendingToken || null;
  23280. err = err || null;
  23281. if (offendingToken === null) {
  23282. offendingToken = this.getCurrentToken();
  23283. }
  23284. this._syntaxErrors += 1;
  23285. var line = offendingToken.line;
  23286. var column = offendingToken.column;
  23287. var listener = this.getErrorListenerDispatch();
  23288. listener.syntaxError(this, offendingToken, line, column, msg, err);
  23289. };
  23290. //
  23291. // Consume and return the {@linkplain //getCurrentToken current symbol}.
  23292. //
  23293. // <p>E.g., given the following input with {@code A} being the current
  23294. // lookahead symbol, this function moves the cursor to {@code B} and returns
  23295. // {@code A}.</p>
  23296. //
  23297. // <pre>
  23298. // A B
  23299. // ^
  23300. // </pre>
  23301. //
  23302. // If the parser is not in error recovery mode, the consumed symbol is added
  23303. // to the parse tree using {@link ParserRuleContext//addChild(Token)}, and
  23304. // {@link ParseTreeListener//visitTerminal} is called on any parse listeners.
  23305. // If the parser <em>is</em> in error recovery mode, the consumed symbol is
  23306. // added to the parse tree using
  23307. // {@link ParserRuleContext//addErrorNode(Token)}, and
  23308. // {@link ParseTreeListener//visitErrorNode} is called on any parse
  23309. // listeners.
  23310. //
  23311. Parser.prototype.consume = function () {
  23312. var o = this.getCurrentToken();
  23313. if (o.type !== Token.EOF) {
  23314. this.getInputStream().consume();
  23315. }
  23316. var hasListener = this._parseListeners !== null && this._parseListeners.length > 0;
  23317. if (this.buildParseTrees || hasListener) {
  23318. var node;
  23319. if (this._errHandler.inErrorRecoveryMode(this)) {
  23320. node = this._ctx.addErrorNode(o);
  23321. } else {
  23322. node = this._ctx.addTokenNode(o);
  23323. }
  23324. node.invokingState = this.state;
  23325. if (hasListener) {
  23326. this._parseListeners.map(function (listener) {
  23327. if (node instanceof ErrorNode || node.isErrorNode !== undefined && node.isErrorNode()) {
  23328. listener.visitErrorNode(node);
  23329. } else if (node instanceof TerminalNode) {
  23330. listener.visitTerminal(node);
  23331. }
  23332. });
  23333. }
  23334. }
  23335. return o;
  23336. };
  23337. Parser.prototype.addContextToParseTree = function () {
  23338. // add current context to parent if we have a parent
  23339. if (this._ctx.parentCtx !== null) {
  23340. this._ctx.parentCtx.addChild(this._ctx);
  23341. }
  23342. };
  23343. // Always called by generated parsers upon entry to a rule. Access field
  23344. // {@link //_ctx} get the current context.
  23345. Parser.prototype.enterRule = function (localctx, state, ruleIndex) {
  23346. this.state = state;
  23347. this._ctx = localctx;
  23348. this._ctx.start = this._input.LT(1);
  23349. if (this.buildParseTrees) {
  23350. this.addContextToParseTree();
  23351. }
  23352. if (this._parseListeners !== null) {
  23353. this.triggerEnterRuleEvent();
  23354. }
  23355. };
  23356. Parser.prototype.exitRule = function () {
  23357. this._ctx.stop = this._input.LT(-1);
  23358. // trigger event on _ctx, before it reverts to parent
  23359. if (this._parseListeners !== null) {
  23360. this.triggerExitRuleEvent();
  23361. }
  23362. this.state = this._ctx.invokingState;
  23363. this._ctx = this._ctx.parentCtx;
  23364. };
  23365. Parser.prototype.enterOuterAlt = function (localctx, altNum) {
  23366. localctx.setAltNumber(altNum);
  23367. // if we have new localctx, make sure we replace existing ctx
  23368. // that is previous child of parse tree
  23369. if (this.buildParseTrees && this._ctx !== localctx) {
  23370. if (this._ctx.parentCtx !== null) {
  23371. this._ctx.parentCtx.removeLastChild();
  23372. this._ctx.parentCtx.addChild(localctx);
  23373. }
  23374. }
  23375. this._ctx = localctx;
  23376. };
  23377. // Get the precedence level for the top-most precedence rule.
  23378. //
  23379. // @return The precedence level for the top-most precedence rule, or -1 if
  23380. // the parser context is not nested within a precedence rule.
  23381. Parser.prototype.getPrecedence = function () {
  23382. if (this._precedenceStack.length === 0) {
  23383. return -1;
  23384. } else {
  23385. return this._precedenceStack[this._precedenceStack.length - 1];
  23386. }
  23387. };
  23388. Parser.prototype.enterRecursionRule = function (localctx, state, ruleIndex, precedence) {
  23389. this.state = state;
  23390. this._precedenceStack.push(precedence);
  23391. this._ctx = localctx;
  23392. this._ctx.start = this._input.LT(1);
  23393. if (this._parseListeners !== null) {
  23394. this.triggerEnterRuleEvent(); // simulates rule entry for
  23395. // left-recursive rules
  23396. }
  23397. };
  23398. //
  23399. // Like {@link //enterRule} but for recursive rules.
  23400. Parser.prototype.pushNewRecursionContext = function (localctx, state, ruleIndex) {
  23401. var previous = this._ctx;
  23402. previous.parentCtx = localctx;
  23403. previous.invokingState = state;
  23404. previous.stop = this._input.LT(-1);
  23405. this._ctx = localctx;
  23406. this._ctx.start = previous.start;
  23407. if (this.buildParseTrees) {
  23408. this._ctx.addChild(previous);
  23409. }
  23410. if (this._parseListeners !== null) {
  23411. this.triggerEnterRuleEvent(); // simulates rule entry for
  23412. // left-recursive rules
  23413. }
  23414. };
  23415. Parser.prototype.unrollRecursionContexts = function (parentCtx) {
  23416. this._precedenceStack.pop();
  23417. this._ctx.stop = this._input.LT(-1);
  23418. var retCtx = this._ctx; // save current ctx (return value)
  23419. // unroll so _ctx is as it was before call to recursive method
  23420. if (this._parseListeners !== null) {
  23421. while (this._ctx !== parentCtx) {
  23422. this.triggerExitRuleEvent();
  23423. this._ctx = this._ctx.parentCtx;
  23424. }
  23425. } else {
  23426. this._ctx = parentCtx;
  23427. }
  23428. // hook into tree
  23429. retCtx.parentCtx = parentCtx;
  23430. if (this.buildParseTrees && parentCtx !== null) {
  23431. // add return ctx into invoking rule's tree
  23432. parentCtx.addChild(retCtx);
  23433. }
  23434. };
  23435. Parser.prototype.getInvokingContext = function (ruleIndex) {
  23436. var ctx = this._ctx;
  23437. while (ctx !== null) {
  23438. if (ctx.ruleIndex === ruleIndex) {
  23439. return ctx;
  23440. }
  23441. ctx = ctx.parentCtx;
  23442. }
  23443. return null;
  23444. };
  23445. Parser.prototype.precpred = function (localctx, precedence) {
  23446. return precedence >= this._precedenceStack[this._precedenceStack.length - 1];
  23447. };
  23448. Parser.prototype.inContext = function (context) {
  23449. // TODO: useful in parser?
  23450. return false;
  23451. };
  23452. //
  23453. // Checks whether or not {@code symbol} can follow the current state in the
  23454. // ATN. The behavior of this method is equivalent to the following, but is
  23455. // implemented such that the complete context-sensitive follow set does not
  23456. // need to be explicitly constructed.
  23457. //
  23458. // <pre>
  23459. // return getExpectedTokens().contains(symbol);
  23460. // </pre>
  23461. //
  23462. // @param symbol the symbol type to check
  23463. // @return {@code true} if {@code symbol} can follow the current state in
  23464. // the ATN, otherwise {@code false}.
  23465. Parser.prototype.isExpectedToken = function (symbol) {
  23466. var atn = this._interp.atn;
  23467. var ctx = this._ctx;
  23468. var s = atn.states[this.state];
  23469. var following = atn.nextTokens(s);
  23470. if (following.contains(symbol)) {
  23471. return true;
  23472. }
  23473. if (!following.contains(Token.EPSILON)) {
  23474. return false;
  23475. }
  23476. while (ctx !== null && ctx.invokingState >= 0 && following.contains(Token.EPSILON)) {
  23477. var invokingState = atn.states[ctx.invokingState];
  23478. var rt = invokingState.transitions[0];
  23479. following = atn.nextTokens(rt.followState);
  23480. if (following.contains(symbol)) {
  23481. return true;
  23482. }
  23483. ctx = ctx.parentCtx;
  23484. }
  23485. if (following.contains(Token.EPSILON) && symbol === Token.EOF) {
  23486. return true;
  23487. } else {
  23488. return false;
  23489. }
  23490. };
  23491. // Computes the set of input symbols which could follow the current parser
  23492. // state and context, as given by {@link //getState} and {@link //getContext},
  23493. // respectively.
  23494. //
  23495. // @see ATN//getExpectedTokens(int, RuleContext)
  23496. //
  23497. Parser.prototype.getExpectedTokens = function () {
  23498. return this._interp.atn.getExpectedTokens(this.state, this._ctx);
  23499. };
  23500. Parser.prototype.getExpectedTokensWithinCurrentRule = function () {
  23501. var atn = this._interp.atn;
  23502. var s = atn.states[this.state];
  23503. return atn.nextTokens(s);
  23504. };
  23505. // Get a rule's index (i.e., {@code RULE_ruleName} field) or -1 if not found.//
  23506. Parser.prototype.getRuleIndex = function (ruleName) {
  23507. var ruleIndex = this.getRuleIndexMap()[ruleName];
  23508. if (ruleIndex !== null) {
  23509. return ruleIndex;
  23510. } else {
  23511. return -1;
  23512. }
  23513. };
  23514. // Return List&lt;String&gt; of the rule names in your parser instance
  23515. // leading up to a call to the current rule. You could override if
  23516. // you want more details such as the file/line info of where
  23517. // in the ATN a rule is invoked.
  23518. //
  23519. // this is very useful for error messages.
  23520. //
  23521. Parser.prototype.getRuleInvocationStack = function (p) {
  23522. p = p || null;
  23523. if (p === null) {
  23524. p = this._ctx;
  23525. }
  23526. var stack = [];
  23527. while (p !== null) {
  23528. // compute what follows who invoked us
  23529. var ruleIndex = p.ruleIndex;
  23530. if (ruleIndex < 0) {
  23531. stack.push("n/a");
  23532. } else {
  23533. stack.push(this.ruleNames[ruleIndex]);
  23534. }
  23535. p = p.parentCtx;
  23536. }
  23537. return stack;
  23538. };
  23539. // For debugging and other purposes.//
  23540. Parser.prototype.getDFAStrings = function () {
  23541. return this._interp.decisionToDFA.toString();
  23542. };
  23543. // For debugging and other purposes.//
  23544. Parser.prototype.dumpDFA = function () {
  23545. var seenOne = false;
  23546. for (var i = 0; i < this._interp.decisionToDFA.length; i++) {
  23547. var dfa = this._interp.decisionToDFA[i];
  23548. if (dfa.states.length > 0) {
  23549. if (seenOne) {
  23550. console.log();
  23551. }
  23552. this.printer.println("Decision " + dfa.decision + ":");
  23553. this.printer.print(dfa.toString(this.literalNames, this.symbolicNames));
  23554. seenOne = true;
  23555. }
  23556. }
  23557. };
  23558. /*
  23559. " printer = function() {\r\n" +
  23560. " this.println = function(s) { document.getElementById('output') += s + '\\n'; }\r\n" +
  23561. " this.print = function(s) { document.getElementById('output') += s; }\r\n" +
  23562. " };\r\n" +
  23563. */
  23564. Parser.prototype.getSourceName = function () {
  23565. return this._input.sourceName;
  23566. };
  23567. // During a parse is sometimes useful to listen in on the rule entry and exit
  23568. // events as well as token matches. this is for quick and dirty debugging.
  23569. //
  23570. Parser.prototype.setTrace = function (trace) {
  23571. if (!trace) {
  23572. this.removeParseListener(this._tracer);
  23573. this._tracer = null;
  23574. } else {
  23575. if (this._tracer !== null) {
  23576. this.removeParseListener(this._tracer);
  23577. }
  23578. this._tracer = new TraceListener(this);
  23579. this.addParseListener(this._tracer);
  23580. }
  23581. };
  23582. exports.Parser = Parser;
  23583. /***/ }),
  23584. /***/ "./node_modules/antlr4/ParserRuleContext.js":
  23585. /*!**************************************************!*\
  23586. !*** ./node_modules/antlr4/ParserRuleContext.js ***!
  23587. \**************************************************/
  23588. /*! no static exports found */
  23589. /***/ (function(module, exports, __webpack_require__) {
  23590. "use strict";
  23591. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  23592. * Use of this file is governed by the BSD 3-clause license that
  23593. * can be found in the LICENSE.txt file in the project root.
  23594. */
  23595. //* A rule invocation record for parsing.
  23596. //
  23597. // Contains all of the information about the current rule not stored in the
  23598. // RuleContext. It handles parse tree children list, Any ATN state
  23599. // tracing, and the default values available for rule indications:
  23600. // start, stop, rule index, current alt number, current
  23601. // ATN state.
  23602. //
  23603. // Subclasses made for each rule and grammar track the parameters,
  23604. // return values, locals, and labels specific to that rule. These
  23605. // are the objects that are returned from rules.
  23606. //
  23607. // Note text is not an actual field of a rule return value; it is computed
  23608. // from start and stop using the input stream's toString() method. I
  23609. // could add a ctor to this so that we can pass in and store the input
  23610. // stream, but I'm not sure we want to do that. It would seem to be undefined
  23611. // to get the .text property anyway if the rule matches tokens from multiple
  23612. // input streams.
  23613. //
  23614. // I do not use getters for fields of objects that are used simply to
  23615. // group values such as this aggregate. The getters/setters are there to
  23616. // satisfy the superclass interface.
  23617. var RuleContext = __webpack_require__(/*! ./RuleContext */ "./node_modules/antlr4/RuleContext.js").RuleContext;
  23618. var Tree = __webpack_require__(/*! ./tree/Tree */ "./node_modules/antlr4/tree/Tree.js");
  23619. var INVALID_INTERVAL = Tree.INVALID_INTERVAL;
  23620. var TerminalNode = Tree.TerminalNode;
  23621. var TerminalNodeImpl = Tree.TerminalNodeImpl;
  23622. var ErrorNodeImpl = Tree.ErrorNodeImpl;
  23623. var Interval = __webpack_require__(/*! ./IntervalSet */ "./node_modules/antlr4/IntervalSet.js").Interval;
  23624. function ParserRuleContext(parent, invokingStateNumber) {
  23625. parent = parent || null;
  23626. invokingStateNumber = invokingStateNumber || null;
  23627. RuleContext.call(this, parent, invokingStateNumber);
  23628. this.ruleIndex = -1;
  23629. // * If we are debugging or building a parse tree for a visitor,
  23630. // we need to track all of the tokens and rule invocations associated
  23631. // with this rule's context. This is empty for parsing w/o tree constr.
  23632. // operation because we don't the need to track the details about
  23633. // how we parse this rule.
  23634. // /
  23635. this.children = null;
  23636. this.start = null;
  23637. this.stop = null;
  23638. // The exception that forced this rule to return. If the rule successfully
  23639. // completed, this is {@code null}.
  23640. this.exception = null;
  23641. }
  23642. ParserRuleContext.prototype = Object.create(RuleContext.prototype);
  23643. ParserRuleContext.prototype.constructor = ParserRuleContext;
  23644. // * COPY a ctx (I'm deliberately not using copy constructor)///
  23645. ParserRuleContext.prototype.copyFrom = function (ctx) {
  23646. // from RuleContext
  23647. this.parentCtx = ctx.parentCtx;
  23648. this.invokingState = ctx.invokingState;
  23649. this.children = null;
  23650. this.start = ctx.start;
  23651. this.stop = ctx.stop;
  23652. // copy any error nodes to alt label node
  23653. if (ctx.children) {
  23654. this.children = [];
  23655. // reset parent pointer for any error nodes
  23656. ctx.children.map(function (child) {
  23657. if (child instanceof ErrorNodeImpl) {
  23658. this.children.push(child);
  23659. child.parentCtx = this;
  23660. }
  23661. }, this);
  23662. }
  23663. };
  23664. // Double dispatch methods for listeners
  23665. ParserRuleContext.prototype.enterRule = function (listener) {};
  23666. ParserRuleContext.prototype.exitRule = function (listener) {};
  23667. // * Does not set parent link; other add methods do that///
  23668. ParserRuleContext.prototype.addChild = function (child) {
  23669. if (this.children === null) {
  23670. this.children = [];
  23671. }
  23672. this.children.push(child);
  23673. return child;
  23674. };
  23675. // * Used by enterOuterAlt to toss out a RuleContext previously added as
  23676. // we entered a rule. If we have // label, we will need to remove
  23677. // generic ruleContext object.
  23678. // /
  23679. ParserRuleContext.prototype.removeLastChild = function () {
  23680. if (this.children !== null) {
  23681. this.children.pop();
  23682. }
  23683. };
  23684. ParserRuleContext.prototype.addTokenNode = function (token) {
  23685. var node = new TerminalNodeImpl(token);
  23686. this.addChild(node);
  23687. node.parentCtx = this;
  23688. return node;
  23689. };
  23690. ParserRuleContext.prototype.addErrorNode = function (badToken) {
  23691. var node = new ErrorNodeImpl(badToken);
  23692. this.addChild(node);
  23693. node.parentCtx = this;
  23694. return node;
  23695. };
  23696. ParserRuleContext.prototype.getChild = function (i, type) {
  23697. type = type || null;
  23698. if (this.children === null || i < 0 || i >= this.children.length) {
  23699. return null;
  23700. }
  23701. if (type === null) {
  23702. return this.children[i];
  23703. } else {
  23704. for (var j = 0; j < this.children.length; j++) {
  23705. var child = this.children[j];
  23706. if (child instanceof type) {
  23707. if (i === 0) {
  23708. return child;
  23709. } else {
  23710. i -= 1;
  23711. }
  23712. }
  23713. }
  23714. return null;
  23715. }
  23716. };
  23717. ParserRuleContext.prototype.getToken = function (ttype, i) {
  23718. if (this.children === null || i < 0 || i >= this.children.length) {
  23719. return null;
  23720. }
  23721. for (var j = 0; j < this.children.length; j++) {
  23722. var child = this.children[j];
  23723. if (child instanceof TerminalNode) {
  23724. if (child.symbol.type === ttype) {
  23725. if (i === 0) {
  23726. return child;
  23727. } else {
  23728. i -= 1;
  23729. }
  23730. }
  23731. }
  23732. }
  23733. return null;
  23734. };
  23735. ParserRuleContext.prototype.getTokens = function (ttype) {
  23736. if (this.children === null) {
  23737. return [];
  23738. } else {
  23739. var tokens = [];
  23740. for (var j = 0; j < this.children.length; j++) {
  23741. var child = this.children[j];
  23742. if (child instanceof TerminalNode) {
  23743. if (child.symbol.type === ttype) {
  23744. tokens.push(child);
  23745. }
  23746. }
  23747. }
  23748. return tokens;
  23749. }
  23750. };
  23751. ParserRuleContext.prototype.getTypedRuleContext = function (ctxType, i) {
  23752. return this.getChild(i, ctxType);
  23753. };
  23754. ParserRuleContext.prototype.getTypedRuleContexts = function (ctxType) {
  23755. if (this.children === null) {
  23756. return [];
  23757. } else {
  23758. var contexts = [];
  23759. for (var j = 0; j < this.children.length; j++) {
  23760. var child = this.children[j];
  23761. if (child instanceof ctxType) {
  23762. contexts.push(child);
  23763. }
  23764. }
  23765. return contexts;
  23766. }
  23767. };
  23768. ParserRuleContext.prototype.getChildCount = function () {
  23769. if (this.children === null) {
  23770. return 0;
  23771. } else {
  23772. return this.children.length;
  23773. }
  23774. };
  23775. ParserRuleContext.prototype.getSourceInterval = function () {
  23776. if (this.start === null || this.stop === null) {
  23777. return INVALID_INTERVAL;
  23778. } else {
  23779. return new Interval(this.start.tokenIndex, this.stop.tokenIndex);
  23780. }
  23781. };
  23782. RuleContext.EMPTY = new ParserRuleContext();
  23783. function InterpreterRuleContext(parent, invokingStateNumber, ruleIndex) {
  23784. ParserRuleContext.call(parent, invokingStateNumber);
  23785. this.ruleIndex = ruleIndex;
  23786. return this;
  23787. }
  23788. InterpreterRuleContext.prototype = Object.create(ParserRuleContext.prototype);
  23789. InterpreterRuleContext.prototype.constructor = InterpreterRuleContext;
  23790. exports.ParserRuleContext = ParserRuleContext;
  23791. /***/ }),
  23792. /***/ "./node_modules/antlr4/PredictionContext.js":
  23793. /*!**************************************************!*\
  23794. !*** ./node_modules/antlr4/PredictionContext.js ***!
  23795. \**************************************************/
  23796. /*! no static exports found */
  23797. /***/ (function(module, exports, __webpack_require__) {
  23798. "use strict";
  23799. //
  23800. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  23801. * Use of this file is governed by the BSD 3-clause license that
  23802. * can be found in the LICENSE.txt file in the project root.
  23803. */
  23804. ///
  23805. var RuleContext = __webpack_require__(/*! ./RuleContext */ "./node_modules/antlr4/RuleContext.js").RuleContext;
  23806. var Hash = __webpack_require__(/*! ./Utils */ "./node_modules/antlr4/Utils.js").Hash;
  23807. function PredictionContext(cachedHashCode) {
  23808. this.cachedHashCode = cachedHashCode;
  23809. }
  23810. // Represents {@code $} in local context prediction, which means wildcard.
  23811. // {@code//+x =//}.
  23812. // /
  23813. PredictionContext.EMPTY = null;
  23814. // Represents {@code $} in an array in full context mode, when {@code $}
  23815. // doesn't mean wildcard: {@code $ + x = [$,x]}. Here,
  23816. // {@code $} = {@link //EMPTY_RETURN_STATE}.
  23817. // /
  23818. PredictionContext.EMPTY_RETURN_STATE = 0x7FFFFFFF;
  23819. PredictionContext.globalNodeCount = 1;
  23820. PredictionContext.id = PredictionContext.globalNodeCount;
  23821. // Stores the computed hash code of this {@link PredictionContext}. The hash
  23822. // code is computed in parts to match the following reference algorithm.
  23823. //
  23824. // <pre>
  23825. // private int referenceHashCode() {
  23826. // int hash = {@link MurmurHash//initialize MurmurHash.initialize}({@link
  23827. // //INITIAL_HASH});
  23828. //
  23829. // for (int i = 0; i &lt; {@link //size()}; i++) {
  23830. // hash = {@link MurmurHash//update MurmurHash.update}(hash, {@link //getParent
  23831. // getParent}(i));
  23832. // }
  23833. //
  23834. // for (int i = 0; i &lt; {@link //size()}; i++) {
  23835. // hash = {@link MurmurHash//update MurmurHash.update}(hash, {@link
  23836. // //getReturnState getReturnState}(i));
  23837. // }
  23838. //
  23839. // hash = {@link MurmurHash//finish MurmurHash.finish}(hash, 2// {@link
  23840. // //size()});
  23841. // return hash;
  23842. // }
  23843. // </pre>
  23844. // /
  23845. // This means only the {@link //EMPTY} context is in set.
  23846. PredictionContext.prototype.isEmpty = function () {
  23847. return this === PredictionContext.EMPTY;
  23848. };
  23849. PredictionContext.prototype.hasEmptyPath = function () {
  23850. return this.getReturnState(this.length - 1) === PredictionContext.EMPTY_RETURN_STATE;
  23851. };
  23852. PredictionContext.prototype.hashCode = function () {
  23853. return this.cachedHashCode;
  23854. };
  23855. PredictionContext.prototype.updateHashCode = function (hash) {
  23856. hash.update(this.cachedHashCode);
  23857. };
  23858. /*
  23859. function calculateHashString(parent, returnState) {
  23860. return "" + parent + returnState;
  23861. }
  23862. */
  23863. // Used to cache {@link PredictionContext} objects. Its used for the shared
  23864. // context cash associated with contexts in DFA states. This cache
  23865. // can be used for both lexers and parsers.
  23866. function PredictionContextCache() {
  23867. this.cache = {};
  23868. return this;
  23869. }
  23870. // Add a context to the cache and return it. If the context already exists,
  23871. // return that one instead and do not add a new context to the cache.
  23872. // Protect shared cache from unsafe thread access.
  23873. //
  23874. PredictionContextCache.prototype.add = function (ctx) {
  23875. if (ctx === PredictionContext.EMPTY) {
  23876. return PredictionContext.EMPTY;
  23877. }
  23878. var existing = this.cache[ctx] || null;
  23879. if (existing !== null) {
  23880. return existing;
  23881. }
  23882. this.cache[ctx] = ctx;
  23883. return ctx;
  23884. };
  23885. PredictionContextCache.prototype.get = function (ctx) {
  23886. return this.cache[ctx] || null;
  23887. };
  23888. Object.defineProperty(PredictionContextCache.prototype, "length", {
  23889. get: function get() {
  23890. return this.cache.length;
  23891. }
  23892. });
  23893. function SingletonPredictionContext(parent, returnState) {
  23894. var hashCode = 0;
  23895. if (parent !== null) {
  23896. var hash = new Hash();
  23897. hash.update(parent, returnState);
  23898. hashCode = hash.finish();
  23899. }
  23900. PredictionContext.call(this, hashCode);
  23901. this.parentCtx = parent;
  23902. this.returnState = returnState;
  23903. }
  23904. SingletonPredictionContext.prototype = Object.create(PredictionContext.prototype);
  23905. SingletonPredictionContext.prototype.contructor = SingletonPredictionContext;
  23906. SingletonPredictionContext.create = function (parent, returnState) {
  23907. if (returnState === PredictionContext.EMPTY_RETURN_STATE && parent === null) {
  23908. // someone can pass in the bits of an array ctx that mean $
  23909. return PredictionContext.EMPTY;
  23910. } else {
  23911. return new SingletonPredictionContext(parent, returnState);
  23912. }
  23913. };
  23914. Object.defineProperty(SingletonPredictionContext.prototype, "length", {
  23915. get: function get() {
  23916. return 1;
  23917. }
  23918. });
  23919. SingletonPredictionContext.prototype.getParent = function (index) {
  23920. return this.parentCtx;
  23921. };
  23922. SingletonPredictionContext.prototype.getReturnState = function (index) {
  23923. return this.returnState;
  23924. };
  23925. SingletonPredictionContext.prototype.equals = function (other) {
  23926. if (this === other) {
  23927. return true;
  23928. } else if (!(other instanceof SingletonPredictionContext)) {
  23929. return false;
  23930. } else if (this.hashCode() !== other.hashCode()) {
  23931. return false; // can't be same if hash is different
  23932. } else {
  23933. if (this.returnState !== other.returnState) return false;else if (this.parentCtx == null) return other.parentCtx == null;else return this.parentCtx.equals(other.parentCtx);
  23934. }
  23935. };
  23936. SingletonPredictionContext.prototype.toString = function () {
  23937. var up = this.parentCtx === null ? "" : this.parentCtx.toString();
  23938. if (up.length === 0) {
  23939. if (this.returnState === PredictionContext.EMPTY_RETURN_STATE) {
  23940. return "$";
  23941. } else {
  23942. return "" + this.returnState;
  23943. }
  23944. } else {
  23945. return "" + this.returnState + " " + up;
  23946. }
  23947. };
  23948. function EmptyPredictionContext() {
  23949. SingletonPredictionContext.call(this, null, PredictionContext.EMPTY_RETURN_STATE);
  23950. return this;
  23951. }
  23952. EmptyPredictionContext.prototype = Object.create(SingletonPredictionContext.prototype);
  23953. EmptyPredictionContext.prototype.constructor = EmptyPredictionContext;
  23954. EmptyPredictionContext.prototype.isEmpty = function () {
  23955. return true;
  23956. };
  23957. EmptyPredictionContext.prototype.getParent = function (index) {
  23958. return null;
  23959. };
  23960. EmptyPredictionContext.prototype.getReturnState = function (index) {
  23961. return this.returnState;
  23962. };
  23963. EmptyPredictionContext.prototype.equals = function (other) {
  23964. return this === other;
  23965. };
  23966. EmptyPredictionContext.prototype.toString = function () {
  23967. return "$";
  23968. };
  23969. PredictionContext.EMPTY = new EmptyPredictionContext();
  23970. function ArrayPredictionContext(parents, returnStates) {
  23971. // Parent can be null only if full ctx mode and we make an array
  23972. // from {@link //EMPTY} and non-empty. We merge {@link //EMPTY} by using
  23973. // null parent and
  23974. // returnState == {@link //EMPTY_RETURN_STATE}.
  23975. var h = new Hash();
  23976. h.update(parents, returnStates);
  23977. var hashCode = h.finish();
  23978. PredictionContext.call(this, hashCode);
  23979. this.parents = parents;
  23980. this.returnStates = returnStates;
  23981. return this;
  23982. }
  23983. ArrayPredictionContext.prototype = Object.create(PredictionContext.prototype);
  23984. ArrayPredictionContext.prototype.constructor = ArrayPredictionContext;
  23985. ArrayPredictionContext.prototype.isEmpty = function () {
  23986. // since EMPTY_RETURN_STATE can only appear in the last position, we
  23987. // don't need to verify that size==1
  23988. return this.returnStates[0] === PredictionContext.EMPTY_RETURN_STATE;
  23989. };
  23990. Object.defineProperty(ArrayPredictionContext.prototype, "length", {
  23991. get: function get() {
  23992. return this.returnStates.length;
  23993. }
  23994. });
  23995. ArrayPredictionContext.prototype.getParent = function (index) {
  23996. return this.parents[index];
  23997. };
  23998. ArrayPredictionContext.prototype.getReturnState = function (index) {
  23999. return this.returnStates[index];
  24000. };
  24001. ArrayPredictionContext.prototype.equals = function (other) {
  24002. if (this === other) {
  24003. return true;
  24004. } else if (!(other instanceof ArrayPredictionContext)) {
  24005. return false;
  24006. } else if (this.hashCode() !== other.hashCode()) {
  24007. return false; // can't be same if hash is different
  24008. } else {
  24009. return this.returnStates === other.returnStates && this.parents === other.parents;
  24010. }
  24011. };
  24012. ArrayPredictionContext.prototype.toString = function () {
  24013. if (this.isEmpty()) {
  24014. return "[]";
  24015. } else {
  24016. var s = "[";
  24017. for (var i = 0; i < this.returnStates.length; i++) {
  24018. if (i > 0) {
  24019. s = s + ", ";
  24020. }
  24021. if (this.returnStates[i] === PredictionContext.EMPTY_RETURN_STATE) {
  24022. s = s + "$";
  24023. continue;
  24024. }
  24025. s = s + this.returnStates[i];
  24026. if (this.parents[i] !== null) {
  24027. s = s + " " + this.parents[i];
  24028. } else {
  24029. s = s + "null";
  24030. }
  24031. }
  24032. return s + "]";
  24033. }
  24034. };
  24035. // Convert a {@link RuleContext} tree to a {@link PredictionContext} graph.
  24036. // Return {@link //EMPTY} if {@code outerContext} is empty or null.
  24037. // /
  24038. function predictionContextFromRuleContext(atn, outerContext) {
  24039. if (outerContext === undefined || outerContext === null) {
  24040. outerContext = RuleContext.EMPTY;
  24041. }
  24042. // if we are in RuleContext of start rule, s, then PredictionContext
  24043. // is EMPTY. Nobody called us. (if we are empty, return empty)
  24044. if (outerContext.parentCtx === null || outerContext === RuleContext.EMPTY) {
  24045. return PredictionContext.EMPTY;
  24046. }
  24047. // If we have a parent, convert it to a PredictionContext graph
  24048. var parent = predictionContextFromRuleContext(atn, outerContext.parentCtx);
  24049. var state = atn.states[outerContext.invokingState];
  24050. var transition = state.transitions[0];
  24051. return SingletonPredictionContext.create(parent, transition.followState.stateNumber);
  24052. }
  24053. /*
  24054. function calculateListsHashString(parents, returnStates) {
  24055. var s = "";
  24056. parents.map(function(p) {
  24057. s = s + p;
  24058. });
  24059. returnStates.map(function(r) {
  24060. s = s + r;
  24061. });
  24062. return s;
  24063. }
  24064. */
  24065. function merge(a, b, rootIsWildcard, mergeCache) {
  24066. // share same graph if both same
  24067. if (a === b) {
  24068. return a;
  24069. }
  24070. if (a instanceof SingletonPredictionContext && b instanceof SingletonPredictionContext) {
  24071. return mergeSingletons(a, b, rootIsWildcard, mergeCache);
  24072. }
  24073. // At least one of a or b is array
  24074. // If one is $ and rootIsWildcard, return $ as// wildcard
  24075. if (rootIsWildcard) {
  24076. if (a instanceof EmptyPredictionContext) {
  24077. return a;
  24078. }
  24079. if (b instanceof EmptyPredictionContext) {
  24080. return b;
  24081. }
  24082. }
  24083. // convert singleton so both are arrays to normalize
  24084. if (a instanceof SingletonPredictionContext) {
  24085. a = new ArrayPredictionContext([a.getParent()], [a.returnState]);
  24086. }
  24087. if (b instanceof SingletonPredictionContext) {
  24088. b = new ArrayPredictionContext([b.getParent()], [b.returnState]);
  24089. }
  24090. return mergeArrays(a, b, rootIsWildcard, mergeCache);
  24091. }
  24092. //
  24093. // Merge two {@link SingletonPredictionContext} instances.
  24094. //
  24095. // <p>Stack tops equal, parents merge is same; return left graph.<br>
  24096. // <embed src="images/SingletonMerge_SameRootSamePar.svg"
  24097. // type="image/svg+xml"/></p>
  24098. //
  24099. // <p>Same stack top, parents differ; merge parents giving array node, then
  24100. // remainders of those graphs. A new root node is created to point to the
  24101. // merged parents.<br>
  24102. // <embed src="images/SingletonMerge_SameRootDiffPar.svg"
  24103. // type="image/svg+xml"/></p>
  24104. //
  24105. // <p>Different stack tops pointing to same parent. Make array node for the
  24106. // root where both element in the root point to the same (original)
  24107. // parent.<br>
  24108. // <embed src="images/SingletonMerge_DiffRootSamePar.svg"
  24109. // type="image/svg+xml"/></p>
  24110. //
  24111. // <p>Different stack tops pointing to different parents. Make array node for
  24112. // the root where each element points to the corresponding original
  24113. // parent.<br>
  24114. // <embed src="images/SingletonMerge_DiffRootDiffPar.svg"
  24115. // type="image/svg+xml"/></p>
  24116. //
  24117. // @param a the first {@link SingletonPredictionContext}
  24118. // @param b the second {@link SingletonPredictionContext}
  24119. // @param rootIsWildcard {@code true} if this is a local-context merge,
  24120. // otherwise false to indicate a full-context merge
  24121. // @param mergeCache
  24122. // /
  24123. function mergeSingletons(a, b, rootIsWildcard, mergeCache) {
  24124. if (mergeCache !== null) {
  24125. var previous = mergeCache.get(a, b);
  24126. if (previous !== null) {
  24127. return previous;
  24128. }
  24129. previous = mergeCache.get(b, a);
  24130. if (previous !== null) {
  24131. return previous;
  24132. }
  24133. }
  24134. var rootMerge = mergeRoot(a, b, rootIsWildcard);
  24135. if (rootMerge !== null) {
  24136. if (mergeCache !== null) {
  24137. mergeCache.set(a, b, rootMerge);
  24138. }
  24139. return rootMerge;
  24140. }
  24141. if (a.returnState === b.returnState) {
  24142. var parent = merge(a.parentCtx, b.parentCtx, rootIsWildcard, mergeCache);
  24143. // if parent is same as existing a or b parent or reduced to a parent,
  24144. // return it
  24145. if (parent === a.parentCtx) {
  24146. return a; // ax + bx = ax, if a=b
  24147. }
  24148. if (parent === b.parentCtx) {
  24149. return b; // ax + bx = bx, if a=b
  24150. }
  24151. // else: ax + ay = a'[x,y]
  24152. // merge parents x and y, giving array node with x,y then remainders
  24153. // of those graphs. dup a, a' points at merged array
  24154. // new joined parent so create new singleton pointing to it, a'
  24155. var spc = SingletonPredictionContext.create(parent, a.returnState);
  24156. if (mergeCache !== null) {
  24157. mergeCache.set(a, b, spc);
  24158. }
  24159. return spc;
  24160. } else {
  24161. // a != b payloads differ
  24162. // see if we can collapse parents due to $+x parents if local ctx
  24163. var singleParent = null;
  24164. if (a === b || a.parentCtx !== null && a.parentCtx === b.parentCtx) {
  24165. // ax +
  24166. // bx =
  24167. // [a,b]x
  24168. singleParent = a.parentCtx;
  24169. }
  24170. if (singleParent !== null) {
  24171. // parents are same
  24172. // sort payloads and use same parent
  24173. var payloads = [a.returnState, b.returnState];
  24174. if (a.returnState > b.returnState) {
  24175. payloads[0] = b.returnState;
  24176. payloads[1] = a.returnState;
  24177. }
  24178. var parents = [singleParent, singleParent];
  24179. var apc = new ArrayPredictionContext(parents, payloads);
  24180. if (mergeCache !== null) {
  24181. mergeCache.set(a, b, apc);
  24182. }
  24183. return apc;
  24184. }
  24185. // parents differ and can't merge them. Just pack together
  24186. // into array; can't merge.
  24187. // ax + by = [ax,by]
  24188. var payloads = [a.returnState, b.returnState];
  24189. var parents = [a.parentCtx, b.parentCtx];
  24190. if (a.returnState > b.returnState) {
  24191. // sort by payload
  24192. payloads[0] = b.returnState;
  24193. payloads[1] = a.returnState;
  24194. parents = [b.parentCtx, a.parentCtx];
  24195. }
  24196. var a_ = new ArrayPredictionContext(parents, payloads);
  24197. if (mergeCache !== null) {
  24198. mergeCache.set(a, b, a_);
  24199. }
  24200. return a_;
  24201. }
  24202. }
  24203. //
  24204. // Handle case where at least one of {@code a} or {@code b} is
  24205. // {@link //EMPTY}. In the following diagrams, the symbol {@code $} is used
  24206. // to represent {@link //EMPTY}.
  24207. //
  24208. // <h2>Local-Context Merges</h2>
  24209. //
  24210. // <p>These local-context merge operations are used when {@code rootIsWildcard}
  24211. // is true.</p>
  24212. //
  24213. // <p>{@link //EMPTY} is superset of any graph; return {@link //EMPTY}.<br>
  24214. // <embed src="images/LocalMerge_EmptyRoot.svg" type="image/svg+xml"/></p>
  24215. //
  24216. // <p>{@link //EMPTY} and anything is {@code //EMPTY}, so merged parent is
  24217. // {@code //EMPTY}; return left graph.<br>
  24218. // <embed src="images/LocalMerge_EmptyParent.svg" type="image/svg+xml"/></p>
  24219. //
  24220. // <p>Special case of last merge if local context.<br>
  24221. // <embed src="images/LocalMerge_DiffRoots.svg" type="image/svg+xml"/></p>
  24222. //
  24223. // <h2>Full-Context Merges</h2>
  24224. //
  24225. // <p>These full-context merge operations are used when {@code rootIsWildcard}
  24226. // is false.</p>
  24227. //
  24228. // <p><embed src="images/FullMerge_EmptyRoots.svg" type="image/svg+xml"/></p>
  24229. //
  24230. // <p>Must keep all contexts; {@link //EMPTY} in array is a special value (and
  24231. // null parent).<br>
  24232. // <embed src="images/FullMerge_EmptyRoot.svg" type="image/svg+xml"/></p>
  24233. //
  24234. // <p><embed src="images/FullMerge_SameRoot.svg" type="image/svg+xml"/></p>
  24235. //
  24236. // @param a the first {@link SingletonPredictionContext}
  24237. // @param b the second {@link SingletonPredictionContext}
  24238. // @param rootIsWildcard {@code true} if this is a local-context merge,
  24239. // otherwise false to indicate a full-context merge
  24240. // /
  24241. function mergeRoot(a, b, rootIsWildcard) {
  24242. if (rootIsWildcard) {
  24243. if (a === PredictionContext.EMPTY) {
  24244. return PredictionContext.EMPTY; // // + b =//
  24245. }
  24246. if (b === PredictionContext.EMPTY) {
  24247. return PredictionContext.EMPTY; // a +// =//
  24248. }
  24249. } else {
  24250. if (a === PredictionContext.EMPTY && b === PredictionContext.EMPTY) {
  24251. return PredictionContext.EMPTY; // $ + $ = $
  24252. } else if (a === PredictionContext.EMPTY) {
  24253. // $ + x = [$,x]
  24254. var payloads = [b.returnState, PredictionContext.EMPTY_RETURN_STATE];
  24255. var parents = [b.parentCtx, null];
  24256. return new ArrayPredictionContext(parents, payloads);
  24257. } else if (b === PredictionContext.EMPTY) {
  24258. // x + $ = [$,x] ($ is always first if present)
  24259. var payloads = [a.returnState, PredictionContext.EMPTY_RETURN_STATE];
  24260. var parents = [a.parentCtx, null];
  24261. return new ArrayPredictionContext(parents, payloads);
  24262. }
  24263. }
  24264. return null;
  24265. }
  24266. //
  24267. // Merge two {@link ArrayPredictionContext} instances.
  24268. //
  24269. // <p>Different tops, different parents.<br>
  24270. // <embed src="images/ArrayMerge_DiffTopDiffPar.svg" type="image/svg+xml"/></p>
  24271. //
  24272. // <p>Shared top, same parents.<br>
  24273. // <embed src="images/ArrayMerge_ShareTopSamePar.svg" type="image/svg+xml"/></p>
  24274. //
  24275. // <p>Shared top, different parents.<br>
  24276. // <embed src="images/ArrayMerge_ShareTopDiffPar.svg" type="image/svg+xml"/></p>
  24277. //
  24278. // <p>Shared top, all shared parents.<br>
  24279. // <embed src="images/ArrayMerge_ShareTopSharePar.svg"
  24280. // type="image/svg+xml"/></p>
  24281. //
  24282. // <p>Equal tops, merge parents and reduce top to
  24283. // {@link SingletonPredictionContext}.<br>
  24284. // <embed src="images/ArrayMerge_EqualTop.svg" type="image/svg+xml"/></p>
  24285. // /
  24286. function mergeArrays(a, b, rootIsWildcard, mergeCache) {
  24287. if (mergeCache !== null) {
  24288. var previous = mergeCache.get(a, b);
  24289. if (previous !== null) {
  24290. return previous;
  24291. }
  24292. previous = mergeCache.get(b, a);
  24293. if (previous !== null) {
  24294. return previous;
  24295. }
  24296. }
  24297. // merge sorted payloads a + b => M
  24298. var i = 0; // walks a
  24299. var j = 0; // walks b
  24300. var k = 0; // walks target M array
  24301. var mergedReturnStates = [];
  24302. var mergedParents = [];
  24303. // walk and merge to yield mergedParents, mergedReturnStates
  24304. while (i < a.returnStates.length && j < b.returnStates.length) {
  24305. var a_parent = a.parents[i];
  24306. var b_parent = b.parents[j];
  24307. if (a.returnStates[i] === b.returnStates[j]) {
  24308. // same payload (stack tops are equal), must yield merged singleton
  24309. var payload = a.returnStates[i];
  24310. // $+$ = $
  24311. var bothDollars = payload === PredictionContext.EMPTY_RETURN_STATE && a_parent === null && b_parent === null;
  24312. var ax_ax = a_parent !== null && b_parent !== null && a_parent === b_parent; // ax+ax
  24313. // ->
  24314. // ax
  24315. if (bothDollars || ax_ax) {
  24316. mergedParents[k] = a_parent; // choose left
  24317. mergedReturnStates[k] = payload;
  24318. } else {
  24319. // ax+ay -> a'[x,y]
  24320. var mergedParent = merge(a_parent, b_parent, rootIsWildcard, mergeCache);
  24321. mergedParents[k] = mergedParent;
  24322. mergedReturnStates[k] = payload;
  24323. }
  24324. i += 1; // hop over left one as usual
  24325. j += 1; // but also skip one in right side since we merge
  24326. } else if (a.returnStates[i] < b.returnStates[j]) {
  24327. // copy a[i] to M
  24328. mergedParents[k] = a_parent;
  24329. mergedReturnStates[k] = a.returnStates[i];
  24330. i += 1;
  24331. } else {
  24332. // b > a, copy b[j] to M
  24333. mergedParents[k] = b_parent;
  24334. mergedReturnStates[k] = b.returnStates[j];
  24335. j += 1;
  24336. }
  24337. k += 1;
  24338. }
  24339. // copy over any payloads remaining in either array
  24340. if (i < a.returnStates.length) {
  24341. for (var p = i; p < a.returnStates.length; p++) {
  24342. mergedParents[k] = a.parents[p];
  24343. mergedReturnStates[k] = a.returnStates[p];
  24344. k += 1;
  24345. }
  24346. } else {
  24347. for (var p = j; p < b.returnStates.length; p++) {
  24348. mergedParents[k] = b.parents[p];
  24349. mergedReturnStates[k] = b.returnStates[p];
  24350. k += 1;
  24351. }
  24352. }
  24353. // trim merged if we combined a few that had same stack tops
  24354. if (k < mergedParents.length) {
  24355. // write index < last position; trim
  24356. if (k === 1) {
  24357. // for just one merged element, return singleton top
  24358. var a_ = SingletonPredictionContext.create(mergedParents[0], mergedReturnStates[0]);
  24359. if (mergeCache !== null) {
  24360. mergeCache.set(a, b, a_);
  24361. }
  24362. return a_;
  24363. }
  24364. mergedParents = mergedParents.slice(0, k);
  24365. mergedReturnStates = mergedReturnStates.slice(0, k);
  24366. }
  24367. var M = new ArrayPredictionContext(mergedParents, mergedReturnStates);
  24368. // if we created same array as a or b, return that instead
  24369. // TODO: track whether this is possible above during merge sort for speed
  24370. if (M === a) {
  24371. if (mergeCache !== null) {
  24372. mergeCache.set(a, b, a);
  24373. }
  24374. return a;
  24375. }
  24376. if (M === b) {
  24377. if (mergeCache !== null) {
  24378. mergeCache.set(a, b, b);
  24379. }
  24380. return b;
  24381. }
  24382. combineCommonParents(mergedParents);
  24383. if (mergeCache !== null) {
  24384. mergeCache.set(a, b, M);
  24385. }
  24386. return M;
  24387. }
  24388. //
  24389. // Make pass over all <em>M</em> {@code parents}; merge any {@code equals()}
  24390. // ones.
  24391. // /
  24392. function combineCommonParents(parents) {
  24393. var uniqueParents = {};
  24394. for (var p = 0; p < parents.length; p++) {
  24395. var parent = parents[p];
  24396. if (!(parent in uniqueParents)) {
  24397. uniqueParents[parent] = parent;
  24398. }
  24399. }
  24400. for (var q = 0; q < parents.length; q++) {
  24401. parents[q] = uniqueParents[parents[q]];
  24402. }
  24403. }
  24404. function getCachedPredictionContext(context, contextCache, visited) {
  24405. if (context.isEmpty()) {
  24406. return context;
  24407. }
  24408. var existing = visited[context] || null;
  24409. if (existing !== null) {
  24410. return existing;
  24411. }
  24412. existing = contextCache.get(context);
  24413. if (existing !== null) {
  24414. visited[context] = existing;
  24415. return existing;
  24416. }
  24417. var changed = false;
  24418. var parents = [];
  24419. for (var i = 0; i < parents.length; i++) {
  24420. var parent = getCachedPredictionContext(context.getParent(i), contextCache, visited);
  24421. if (changed || parent !== context.getParent(i)) {
  24422. if (!changed) {
  24423. parents = [];
  24424. for (var j = 0; j < context.length; j++) {
  24425. parents[j] = context.getParent(j);
  24426. }
  24427. changed = true;
  24428. }
  24429. parents[i] = parent;
  24430. }
  24431. }
  24432. if (!changed) {
  24433. contextCache.add(context);
  24434. visited[context] = context;
  24435. return context;
  24436. }
  24437. var updated = null;
  24438. if (parents.length === 0) {
  24439. updated = PredictionContext.EMPTY;
  24440. } else if (parents.length === 1) {
  24441. updated = SingletonPredictionContext.create(parents[0], context.getReturnState(0));
  24442. } else {
  24443. updated = new ArrayPredictionContext(parents, context.returnStates);
  24444. }
  24445. contextCache.add(updated);
  24446. visited[updated] = updated;
  24447. visited[context] = updated;
  24448. return updated;
  24449. }
  24450. // ter's recursive version of Sam's getAllNodes()
  24451. function getAllContextNodes(context, nodes, visited) {
  24452. if (nodes === null) {
  24453. nodes = [];
  24454. return getAllContextNodes(context, nodes, visited);
  24455. } else if (visited === null) {
  24456. visited = {};
  24457. return getAllContextNodes(context, nodes, visited);
  24458. } else {
  24459. if (context === null || visited[context] !== null) {
  24460. return nodes;
  24461. }
  24462. visited[context] = context;
  24463. nodes.push(context);
  24464. for (var i = 0; i < context.length; i++) {
  24465. getAllContextNodes(context.getParent(i), nodes, visited);
  24466. }
  24467. return nodes;
  24468. }
  24469. }
  24470. exports.merge = merge;
  24471. exports.PredictionContext = PredictionContext;
  24472. exports.PredictionContextCache = PredictionContextCache;
  24473. exports.SingletonPredictionContext = SingletonPredictionContext;
  24474. exports.predictionContextFromRuleContext = predictionContextFromRuleContext;
  24475. exports.getCachedPredictionContext = getCachedPredictionContext;
  24476. /***/ }),
  24477. /***/ "./node_modules/antlr4/Recognizer.js":
  24478. /*!*******************************************!*\
  24479. !*** ./node_modules/antlr4/Recognizer.js ***!
  24480. \*******************************************/
  24481. /*! no static exports found */
  24482. /***/ (function(module, exports, __webpack_require__) {
  24483. "use strict";
  24484. //
  24485. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  24486. * Use of this file is governed by the BSD 3-clause license that
  24487. * can be found in the LICENSE.txt file in the project root.
  24488. */
  24489. //
  24490. var Token = __webpack_require__(/*! ./Token */ "./node_modules/antlr4/Token.js").Token;
  24491. var ConsoleErrorListener = __webpack_require__(/*! ./error/ErrorListener */ "./node_modules/antlr4/error/ErrorListener.js").ConsoleErrorListener;
  24492. var ProxyErrorListener = __webpack_require__(/*! ./error/ErrorListener */ "./node_modules/antlr4/error/ErrorListener.js").ProxyErrorListener;
  24493. function Recognizer() {
  24494. this._listeners = [ConsoleErrorListener.INSTANCE];
  24495. this._interp = null;
  24496. this._stateNumber = -1;
  24497. return this;
  24498. }
  24499. Recognizer.tokenTypeMapCache = {};
  24500. Recognizer.ruleIndexMapCache = {};
  24501. Recognizer.prototype.checkVersion = function (toolVersion) {
  24502. var runtimeVersion = "4.7.1";
  24503. if (runtimeVersion !== toolVersion) {
  24504. console.log("ANTLR runtime and generated code versions disagree: " + runtimeVersion + "!=" + toolVersion);
  24505. }
  24506. };
  24507. Recognizer.prototype.addErrorListener = function (listener) {
  24508. this._listeners.push(listener);
  24509. };
  24510. Recognizer.prototype.removeErrorListeners = function () {
  24511. this._listeners = [];
  24512. };
  24513. Recognizer.prototype.getTokenTypeMap = function () {
  24514. var tokenNames = this.getTokenNames();
  24515. if (tokenNames === null) {
  24516. throw "The current recognizer does not provide a list of token names.";
  24517. }
  24518. var result = this.tokenTypeMapCache[tokenNames];
  24519. if (result === undefined) {
  24520. result = tokenNames.reduce(function (o, k, i) {
  24521. o[k] = i;
  24522. });
  24523. result.EOF = Token.EOF;
  24524. this.tokenTypeMapCache[tokenNames] = result;
  24525. }
  24526. return result;
  24527. };
  24528. // Get a map from rule names to rule indexes.
  24529. //
  24530. // <p>Used for XPath and tree pattern compilation.</p>
  24531. //
  24532. Recognizer.prototype.getRuleIndexMap = function () {
  24533. var ruleNames = this.ruleNames;
  24534. if (ruleNames === null) {
  24535. throw "The current recognizer does not provide a list of rule names.";
  24536. }
  24537. var result = this.ruleIndexMapCache[ruleNames];
  24538. if (result === undefined) {
  24539. result = ruleNames.reduce(function (o, k, i) {
  24540. o[k] = i;
  24541. });
  24542. this.ruleIndexMapCache[ruleNames] = result;
  24543. }
  24544. return result;
  24545. };
  24546. Recognizer.prototype.getTokenType = function (tokenName) {
  24547. var ttype = this.getTokenTypeMap()[tokenName];
  24548. if (ttype !== undefined) {
  24549. return ttype;
  24550. } else {
  24551. return Token.INVALID_TYPE;
  24552. }
  24553. };
  24554. // What is the error header, normally line/character position information?//
  24555. Recognizer.prototype.getErrorHeader = function (e) {
  24556. var line = e.getOffendingToken().line;
  24557. var column = e.getOffendingToken().column;
  24558. return "line " + line + ":" + column;
  24559. };
  24560. // How should a token be displayed in an error message? The default
  24561. // is to display just the text, but during development you might
  24562. // want to have a lot of information spit out. Override in that case
  24563. // to use t.toString() (which, for CommonToken, dumps everything about
  24564. // the token). This is better than forcing you to override a method in
  24565. // your token objects because you don't have to go modify your lexer
  24566. // so that it creates a new Java type.
  24567. //
  24568. // @deprecated This method is not called by the ANTLR 4 Runtime. Specific
  24569. // implementations of {@link ANTLRErrorStrategy} may provide a similar
  24570. // feature when necessary. For example, see
  24571. // {@link DefaultErrorStrategy//getTokenErrorDisplay}.
  24572. //
  24573. Recognizer.prototype.getTokenErrorDisplay = function (t) {
  24574. if (t === null) {
  24575. return "<no token>";
  24576. }
  24577. var s = t.text;
  24578. if (s === null) {
  24579. if (t.type === Token.EOF) {
  24580. s = "<EOF>";
  24581. } else {
  24582. s = "<" + t.type + ">";
  24583. }
  24584. }
  24585. s = s.replace("\n", "\\n").replace("\r", "\\r").replace("\t", "\\t");
  24586. return "'" + s + "'";
  24587. };
  24588. Recognizer.prototype.getErrorListenerDispatch = function () {
  24589. return new ProxyErrorListener(this._listeners);
  24590. };
  24591. // subclass needs to override these if there are sempreds or actions
  24592. // that the ATN interp needs to execute
  24593. Recognizer.prototype.sempred = function (localctx, ruleIndex, actionIndex) {
  24594. return true;
  24595. };
  24596. Recognizer.prototype.precpred = function (localctx, precedence) {
  24597. return true;
  24598. };
  24599. //Indicate that the recognizer has changed internal state that is
  24600. //consistent with the ATN state passed in. This way we always know
  24601. //where we are in the ATN as the parser goes along. The rule
  24602. //context objects form a stack that lets us see the stack of
  24603. //invoking rules. Combine this and we have complete ATN
  24604. //configuration information.
  24605. Object.defineProperty(Recognizer.prototype, "state", {
  24606. get: function get() {
  24607. return this._stateNumber;
  24608. },
  24609. set: function set(state) {
  24610. this._stateNumber = state;
  24611. }
  24612. });
  24613. exports.Recognizer = Recognizer;
  24614. /***/ }),
  24615. /***/ "./node_modules/antlr4/RuleContext.js":
  24616. /*!********************************************!*\
  24617. !*** ./node_modules/antlr4/RuleContext.js ***!
  24618. \********************************************/
  24619. /*! no static exports found */
  24620. /***/ (function(module, exports, __webpack_require__) {
  24621. "use strict";
  24622. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  24623. * Use of this file is governed by the BSD 3-clause license that
  24624. * can be found in the LICENSE.txt file in the project root.
  24625. */
  24626. ///
  24627. // A rule context is a record of a single rule invocation. It knows
  24628. // which context invoked it, if any. If there is no parent context, then
  24629. // naturally the invoking state is not valid. The parent link
  24630. // provides a chain upwards from the current rule invocation to the root
  24631. // of the invocation tree, forming a stack. We actually carry no
  24632. // information about the rule associated with this context (except
  24633. // when parsing). We keep only the state number of the invoking state from
  24634. // the ATN submachine that invoked this. Contrast this with the s
  24635. // pointer inside ParserRuleContext that tracks the current state
  24636. // being "executed" for the current rule.
  24637. //
  24638. // The parent contexts are useful for computing lookahead sets and
  24639. // getting error information.
  24640. //
  24641. // These objects are used during parsing and prediction.
  24642. // For the special case of parsers, we use the subclass
  24643. // ParserRuleContext.
  24644. //
  24645. // @see ParserRuleContext
  24646. ///
  24647. var RuleNode = __webpack_require__(/*! ./tree/Tree */ "./node_modules/antlr4/tree/Tree.js").RuleNode;
  24648. var INVALID_INTERVAL = __webpack_require__(/*! ./tree/Tree */ "./node_modules/antlr4/tree/Tree.js").INVALID_INTERVAL;
  24649. var INVALID_ALT_NUMBER = __webpack_require__(/*! ./atn/ATN */ "./node_modules/antlr4/atn/ATN.js").INVALID_ALT_NUMBER;
  24650. function RuleContext(parent, invokingState) {
  24651. RuleNode.call(this);
  24652. // What context invoked this rule?
  24653. this.parentCtx = parent || null;
  24654. // What state invoked the rule associated with this context?
  24655. // The "return address" is the followState of invokingState
  24656. // If parent is null, this should be -1.
  24657. this.invokingState = invokingState || -1;
  24658. return this;
  24659. }
  24660. RuleContext.prototype = Object.create(RuleNode.prototype);
  24661. RuleContext.prototype.constructor = RuleContext;
  24662. RuleContext.prototype.depth = function () {
  24663. var n = 0;
  24664. var p = this;
  24665. while (p !== null) {
  24666. p = p.parentCtx;
  24667. n += 1;
  24668. }
  24669. return n;
  24670. };
  24671. // A context is empty if there is no invoking state; meaning nobody call
  24672. // current context.
  24673. RuleContext.prototype.isEmpty = function () {
  24674. return this.invokingState === -1;
  24675. };
  24676. // satisfy the ParseTree / SyntaxTree interface
  24677. RuleContext.prototype.getSourceInterval = function () {
  24678. return INVALID_INTERVAL;
  24679. };
  24680. RuleContext.prototype.getRuleContext = function () {
  24681. return this;
  24682. };
  24683. RuleContext.prototype.getPayload = function () {
  24684. return this;
  24685. };
  24686. // Return the combined text of all child nodes. This method only considers
  24687. // tokens which have been added to the parse tree.
  24688. // <p>
  24689. // Since tokens on hidden channels (e.g. whitespace or comments) are not
  24690. // added to the parse trees, they will not appear in the output of this
  24691. // method.
  24692. // /
  24693. RuleContext.prototype.getText = function () {
  24694. if (this.getChildCount() === 0) {
  24695. return "";
  24696. } else {
  24697. return this.children.map(function (child) {
  24698. return child.getText();
  24699. }).join("");
  24700. }
  24701. };
  24702. // For rule associated with this parse tree internal node, return
  24703. // the outer alternative number used to match the input. Default
  24704. // implementation does not compute nor store this alt num. Create
  24705. // a subclass of ParserRuleContext with backing field and set
  24706. // option contextSuperClass.
  24707. // to set it.
  24708. RuleContext.prototype.getAltNumber = function () {
  24709. return INVALID_ALT_NUMBER;
  24710. };
  24711. // Set the outer alternative number for this context node. Default
  24712. // implementation does nothing to avoid backing field overhead for
  24713. // trees that don't need it. Create
  24714. // a subclass of ParserRuleContext with backing field and set
  24715. // option contextSuperClass.
  24716. RuleContext.prototype.setAltNumber = function (altNumber) {};
  24717. RuleContext.prototype.getChild = function (i) {
  24718. return null;
  24719. };
  24720. RuleContext.prototype.getChildCount = function () {
  24721. return 0;
  24722. };
  24723. RuleContext.prototype.accept = function (visitor) {
  24724. return visitor.visitChildren(this);
  24725. };
  24726. //need to manage circular dependencies, so export now
  24727. exports.RuleContext = RuleContext;
  24728. var Trees = __webpack_require__(/*! ./tree/Trees */ "./node_modules/antlr4/tree/Trees.js").Trees;
  24729. // Print out a whole tree, not just a node, in LISP format
  24730. // (root child1 .. childN). Print just a node if this is a leaf.
  24731. //
  24732. RuleContext.prototype.toStringTree = function (ruleNames, recog) {
  24733. return Trees.toStringTree(this, ruleNames, recog);
  24734. };
  24735. RuleContext.prototype.toString = function (ruleNames, stop) {
  24736. ruleNames = ruleNames || null;
  24737. stop = stop || null;
  24738. var p = this;
  24739. var s = "[";
  24740. while (p !== null && p !== stop) {
  24741. if (ruleNames === null) {
  24742. if (!p.isEmpty()) {
  24743. s += p.invokingState;
  24744. }
  24745. } else {
  24746. var ri = p.ruleIndex;
  24747. var ruleName = ri >= 0 && ri < ruleNames.length ? ruleNames[ri] : "" + ri;
  24748. s += ruleName;
  24749. }
  24750. if (p.parentCtx !== null && (ruleNames !== null || !p.parentCtx.isEmpty())) {
  24751. s += " ";
  24752. }
  24753. p = p.parentCtx;
  24754. }
  24755. s += "]";
  24756. return s;
  24757. };
  24758. /***/ }),
  24759. /***/ "./node_modules/antlr4/Token.js":
  24760. /*!**************************************!*\
  24761. !*** ./node_modules/antlr4/Token.js ***!
  24762. \**************************************/
  24763. /*! no static exports found */
  24764. /***/ (function(module, exports, __webpack_require__) {
  24765. "use strict";
  24766. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  24767. * Use of this file is governed by the BSD 3-clause license that
  24768. * can be found in the LICENSE.txt file in the project root.
  24769. */
  24770. //
  24771. // A token has properties: text, type, line, character position in the line
  24772. // (so we can ignore tabs), token channel, index, and source from which
  24773. // we obtained this token.
  24774. function Token() {
  24775. this.source = null;
  24776. this.type = null; // token type of the token
  24777. this.channel = null; // The parser ignores everything not on DEFAULT_CHANNEL
  24778. this.start = null; // optional; return -1 if not implemented.
  24779. this.stop = null; // optional; return -1 if not implemented.
  24780. this.tokenIndex = null; // from 0..n-1 of the token object in the input stream
  24781. this.line = null; // line=1..n of the 1st character
  24782. this.column = null; // beginning of the line at which it occurs, 0..n-1
  24783. this._text = null; // text of the token.
  24784. return this;
  24785. }
  24786. Token.INVALID_TYPE = 0;
  24787. // During lookahead operations, this "token" signifies we hit rule end ATN state
  24788. // and did not follow it despite needing to.
  24789. Token.EPSILON = -2;
  24790. Token.MIN_USER_TOKEN_TYPE = 1;
  24791. Token.EOF = -1;
  24792. // All tokens go to the parser (unless skip() is called in that rule)
  24793. // on a particular "channel". The parser tunes to a particular channel
  24794. // so that whitespace etc... can go to the parser on a "hidden" channel.
  24795. Token.DEFAULT_CHANNEL = 0;
  24796. // Anything on different channel than DEFAULT_CHANNEL is not parsed
  24797. // by parser.
  24798. Token.HIDDEN_CHANNEL = 1;
  24799. // Explicitly set the text for this token. If {code text} is not
  24800. // {@code null}, then {@link //getText} will return this value rather than
  24801. // extracting the text from the input.
  24802. //
  24803. // @param text The explicit text of the token, or {@code null} if the text
  24804. // should be obtained from the input along with the start and stop indexes
  24805. // of the token.
  24806. Object.defineProperty(Token.prototype, "text", {
  24807. get: function get() {
  24808. return this._text;
  24809. },
  24810. set: function set(text) {
  24811. this._text = text;
  24812. }
  24813. });
  24814. Token.prototype.getTokenSource = function () {
  24815. return this.source[0];
  24816. };
  24817. Token.prototype.getInputStream = function () {
  24818. return this.source[1];
  24819. };
  24820. function CommonToken(source, type, channel, start, stop) {
  24821. Token.call(this);
  24822. this.source = source !== undefined ? source : CommonToken.EMPTY_SOURCE;
  24823. this.type = type !== undefined ? type : null;
  24824. this.channel = channel !== undefined ? channel : Token.DEFAULT_CHANNEL;
  24825. this.start = start !== undefined ? start : -1;
  24826. this.stop = stop !== undefined ? stop : -1;
  24827. this.tokenIndex = -1;
  24828. if (this.source[0] !== null) {
  24829. this.line = source[0].line;
  24830. this.column = source[0].column;
  24831. } else {
  24832. this.column = -1;
  24833. }
  24834. return this;
  24835. }
  24836. CommonToken.prototype = Object.create(Token.prototype);
  24837. CommonToken.prototype.constructor = CommonToken;
  24838. // An empty {@link Pair} which is used as the default value of
  24839. // {@link //source} for tokens that do not have a source.
  24840. CommonToken.EMPTY_SOURCE = [null, null];
  24841. // Constructs a new {@link CommonToken} as a copy of another {@link Token}.
  24842. //
  24843. // <p>
  24844. // If {@code oldToken} is also a {@link CommonToken} instance, the newly
  24845. // constructed token will share a reference to the {@link //text} field and
  24846. // the {@link Pair} stored in {@link //source}. Otherwise, {@link //text} will
  24847. // be assigned the result of calling {@link //getText}, and {@link //source}
  24848. // will be constructed from the result of {@link Token//getTokenSource} and
  24849. // {@link Token//getInputStream}.</p>
  24850. //
  24851. // @param oldToken The token to copy.
  24852. //
  24853. CommonToken.prototype.clone = function () {
  24854. var t = new CommonToken(this.source, this.type, this.channel, this.start, this.stop);
  24855. t.tokenIndex = this.tokenIndex;
  24856. t.line = this.line;
  24857. t.column = this.column;
  24858. t.text = this.text;
  24859. return t;
  24860. };
  24861. Object.defineProperty(CommonToken.prototype, "text", {
  24862. get: function get() {
  24863. if (this._text !== null) {
  24864. return this._text;
  24865. }
  24866. var input = this.getInputStream();
  24867. if (input === null) {
  24868. return null;
  24869. }
  24870. var n = input.size;
  24871. if (this.start < n && this.stop < n) {
  24872. return input.getText(this.start, this.stop);
  24873. } else {
  24874. return "<EOF>";
  24875. }
  24876. },
  24877. set: function set(text) {
  24878. this._text = text;
  24879. }
  24880. });
  24881. CommonToken.prototype.toString = function () {
  24882. var txt = this.text;
  24883. if (txt !== null) {
  24884. txt = txt.replace(/\n/g, "\\n").replace(/\r/g, "\\r").replace(/\t/g, "\\t");
  24885. } else {
  24886. txt = "<no text>";
  24887. }
  24888. return "[@" + this.tokenIndex + "," + this.start + ":" + this.stop + "='" + txt + "',<" + this.type + ">" + (this.channel > 0 ? ",channel=" + this.channel : "") + "," + this.line + ":" + this.column + "]";
  24889. };
  24890. exports.Token = Token;
  24891. exports.CommonToken = CommonToken;
  24892. /***/ }),
  24893. /***/ "./node_modules/antlr4/Utils.js":
  24894. /*!**************************************!*\
  24895. !*** ./node_modules/antlr4/Utils.js ***!
  24896. \**************************************/
  24897. /*! no static exports found */
  24898. /***/ (function(module, exports, __webpack_require__) {
  24899. "use strict";
  24900. var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
  24901. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  24902. * Use of this file is governed by the BSD 3-clause license that
  24903. * can be found in the LICENSE.txt file in the project root.
  24904. */
  24905. function arrayToString(a) {
  24906. return "[" + a.join(", ") + "]";
  24907. }
  24908. String.prototype.seed = String.prototype.seed || Math.round(Math.random() * Math.pow(2, 32));
  24909. String.prototype.hashCode = function () {
  24910. var remainder,
  24911. bytes,
  24912. h1,
  24913. h1b,
  24914. c1,
  24915. c1b,
  24916. c2,
  24917. c2b,
  24918. k1,
  24919. i,
  24920. key = this.toString();
  24921. remainder = key.length & 3; // key.length % 4
  24922. bytes = key.length - remainder;
  24923. h1 = String.prototype.seed;
  24924. c1 = 0xcc9e2d51;
  24925. c2 = 0x1b873593;
  24926. i = 0;
  24927. while (i < bytes) {
  24928. k1 = key.charCodeAt(i) & 0xff | (key.charCodeAt(++i) & 0xff) << 8 | (key.charCodeAt(++i) & 0xff) << 16 | (key.charCodeAt(++i) & 0xff) << 24;
  24929. ++i;
  24930. k1 = (k1 & 0xffff) * c1 + (((k1 >>> 16) * c1 & 0xffff) << 16) & 0xffffffff;
  24931. k1 = k1 << 15 | k1 >>> 17;
  24932. k1 = (k1 & 0xffff) * c2 + (((k1 >>> 16) * c2 & 0xffff) << 16) & 0xffffffff;
  24933. h1 ^= k1;
  24934. h1 = h1 << 13 | h1 >>> 19;
  24935. h1b = (h1 & 0xffff) * 5 + (((h1 >>> 16) * 5 & 0xffff) << 16) & 0xffffffff;
  24936. h1 = (h1b & 0xffff) + 0x6b64 + (((h1b >>> 16) + 0xe654 & 0xffff) << 16);
  24937. }
  24938. k1 = 0;
  24939. switch (remainder) {
  24940. case 3:
  24941. k1 ^= (key.charCodeAt(i + 2) & 0xff) << 16;
  24942. case 2:
  24943. k1 ^= (key.charCodeAt(i + 1) & 0xff) << 8;
  24944. case 1:
  24945. k1 ^= key.charCodeAt(i) & 0xff;
  24946. k1 = (k1 & 0xffff) * c1 + (((k1 >>> 16) * c1 & 0xffff) << 16) & 0xffffffff;
  24947. k1 = k1 << 15 | k1 >>> 17;
  24948. k1 = (k1 & 0xffff) * c2 + (((k1 >>> 16) * c2 & 0xffff) << 16) & 0xffffffff;
  24949. h1 ^= k1;
  24950. }
  24951. h1 ^= key.length;
  24952. h1 ^= h1 >>> 16;
  24953. h1 = (h1 & 0xffff) * 0x85ebca6b + (((h1 >>> 16) * 0x85ebca6b & 0xffff) << 16) & 0xffffffff;
  24954. h1 ^= h1 >>> 13;
  24955. h1 = (h1 & 0xffff) * 0xc2b2ae35 + (((h1 >>> 16) * 0xc2b2ae35 & 0xffff) << 16) & 0xffffffff;
  24956. h1 ^= h1 >>> 16;
  24957. return h1 >>> 0;
  24958. };
  24959. function standardEqualsFunction(a, b) {
  24960. return a.equals(b);
  24961. }
  24962. function standardHashCodeFunction(a) {
  24963. return a.hashCode();
  24964. }
  24965. function Set(hashFunction, equalsFunction) {
  24966. this.data = {};
  24967. this.hashFunction = hashFunction || standardHashCodeFunction;
  24968. this.equalsFunction = equalsFunction || standardEqualsFunction;
  24969. return this;
  24970. }
  24971. Object.defineProperty(Set.prototype, "length", {
  24972. get: function get() {
  24973. var l = 0;
  24974. for (var key in this.data) {
  24975. if (key.indexOf("hash_") === 0) {
  24976. l = l + this.data[key].length;
  24977. }
  24978. }
  24979. return l;
  24980. }
  24981. });
  24982. Set.prototype.add = function (value) {
  24983. var hash = this.hashFunction(value);
  24984. var key = "hash_" + hash;
  24985. if (key in this.data) {
  24986. var values = this.data[key];
  24987. for (var i = 0; i < values.length; i++) {
  24988. if (this.equalsFunction(value, values[i])) {
  24989. return values[i];
  24990. }
  24991. }
  24992. values.push(value);
  24993. return value;
  24994. } else {
  24995. this.data[key] = [value];
  24996. return value;
  24997. }
  24998. };
  24999. Set.prototype.contains = function (value) {
  25000. return this.get(value) != null;
  25001. };
  25002. Set.prototype.get = function (value) {
  25003. var hash = this.hashFunction(value);
  25004. var key = "hash_" + hash;
  25005. if (key in this.data) {
  25006. var values = this.data[key];
  25007. for (var i = 0; i < values.length; i++) {
  25008. if (this.equalsFunction(value, values[i])) {
  25009. return values[i];
  25010. }
  25011. }
  25012. }
  25013. return null;
  25014. };
  25015. Set.prototype.values = function () {
  25016. var l = [];
  25017. for (var key in this.data) {
  25018. if (key.indexOf("hash_") === 0) {
  25019. l = l.concat(this.data[key]);
  25020. }
  25021. }
  25022. return l;
  25023. };
  25024. Set.prototype.toString = function () {
  25025. return arrayToString(this.values());
  25026. };
  25027. function BitSet() {
  25028. this.data = [];
  25029. return this;
  25030. }
  25031. BitSet.prototype.add = function (value) {
  25032. this.data[value] = true;
  25033. };
  25034. BitSet.prototype.or = function (set) {
  25035. var bits = this;
  25036. Object.keys(set.data).map(function (alt) {
  25037. bits.add(alt);
  25038. });
  25039. };
  25040. BitSet.prototype.remove = function (value) {
  25041. delete this.data[value];
  25042. };
  25043. BitSet.prototype.contains = function (value) {
  25044. return this.data[value] === true;
  25045. };
  25046. BitSet.prototype.values = function () {
  25047. return Object.keys(this.data);
  25048. };
  25049. BitSet.prototype.minValue = function () {
  25050. return Math.min.apply(null, this.values());
  25051. };
  25052. BitSet.prototype.hashCode = function () {
  25053. var hash = new Hash();
  25054. hash.update(this.values());
  25055. return hash.finish();
  25056. };
  25057. BitSet.prototype.equals = function (other) {
  25058. if (!(other instanceof BitSet)) {
  25059. return false;
  25060. }
  25061. return this.hashCode() === other.hashCode();
  25062. };
  25063. Object.defineProperty(BitSet.prototype, "length", {
  25064. get: function get() {
  25065. return this.values().length;
  25066. }
  25067. });
  25068. BitSet.prototype.toString = function () {
  25069. return "{" + this.values().join(", ") + "}";
  25070. };
  25071. function Map(hashFunction, equalsFunction) {
  25072. this.data = {};
  25073. this.hashFunction = hashFunction || standardHashCodeFunction;
  25074. this.equalsFunction = equalsFunction || standardEqualsFunction;
  25075. return this;
  25076. }
  25077. Object.defineProperty(Map.prototype, "length", {
  25078. get: function get() {
  25079. var l = 0;
  25080. for (var hashKey in this.data) {
  25081. if (hashKey.indexOf("hash_") === 0) {
  25082. l = l + this.data[hashKey].length;
  25083. }
  25084. }
  25085. return l;
  25086. }
  25087. });
  25088. Map.prototype.put = function (key, value) {
  25089. var hashKey = "hash_" + this.hashFunction(key);
  25090. if (hashKey in this.data) {
  25091. var entries = this.data[hashKey];
  25092. for (var i = 0; i < entries.length; i++) {
  25093. var entry = entries[i];
  25094. if (this.equalsFunction(key, entry.key)) {
  25095. var oldValue = entry.value;
  25096. entry.value = value;
  25097. return oldValue;
  25098. }
  25099. }
  25100. entries.push({ key: key, value: value });
  25101. return value;
  25102. } else {
  25103. this.data[hashKey] = [{ key: key, value: value }];
  25104. return value;
  25105. }
  25106. };
  25107. Map.prototype.containsKey = function (key) {
  25108. var hashKey = "hash_" + this.hashFunction(key);
  25109. if (hashKey in this.data) {
  25110. var entries = this.data[hashKey];
  25111. for (var i = 0; i < entries.length; i++) {
  25112. var entry = entries[i];
  25113. if (this.equalsFunction(key, entry.key)) return true;
  25114. }
  25115. }
  25116. return false;
  25117. };
  25118. Map.prototype.get = function (key) {
  25119. var hashKey = "hash_" + this.hashFunction(key);
  25120. if (hashKey in this.data) {
  25121. var entries = this.data[hashKey];
  25122. for (var i = 0; i < entries.length; i++) {
  25123. var entry = entries[i];
  25124. if (this.equalsFunction(key, entry.key)) return entry.value;
  25125. }
  25126. }
  25127. return null;
  25128. };
  25129. Map.prototype.entries = function () {
  25130. var l = [];
  25131. for (var key in this.data) {
  25132. if (key.indexOf("hash_") === 0) {
  25133. l = l.concat(this.data[key]);
  25134. }
  25135. }
  25136. return l;
  25137. };
  25138. Map.prototype.getKeys = function () {
  25139. return this.entries().map(function (e) {
  25140. return e.key;
  25141. });
  25142. };
  25143. Map.prototype.getValues = function () {
  25144. return this.entries().map(function (e) {
  25145. return e.value;
  25146. });
  25147. };
  25148. Map.prototype.toString = function () {
  25149. var ss = this.entries().map(function (entry) {
  25150. return '{' + entry.key + ':' + entry.value + '}';
  25151. });
  25152. return '[' + ss.join(", ") + ']';
  25153. };
  25154. function AltDict() {
  25155. this.data = {};
  25156. return this;
  25157. }
  25158. AltDict.prototype.get = function (key) {
  25159. key = "k-" + key;
  25160. if (key in this.data) {
  25161. return this.data[key];
  25162. } else {
  25163. return null;
  25164. }
  25165. };
  25166. AltDict.prototype.put = function (key, value) {
  25167. key = "k-" + key;
  25168. this.data[key] = value;
  25169. };
  25170. AltDict.prototype.values = function () {
  25171. var data = this.data;
  25172. var keys = Object.keys(this.data);
  25173. return keys.map(function (key) {
  25174. return data[key];
  25175. });
  25176. };
  25177. function DoubleDict() {
  25178. return this;
  25179. }
  25180. function Hash() {
  25181. this.count = 0;
  25182. this.hash = 0;
  25183. return this;
  25184. }
  25185. Hash.prototype.update = function () {
  25186. for (var i = 0; i < arguments.length; i++) {
  25187. var value = arguments[i];
  25188. if (value == null) continue;
  25189. if (Array.isArray(value)) this.update.apply(value);else {
  25190. var k = 0;
  25191. switch (typeof value === "undefined" ? "undefined" : _typeof(value)) {
  25192. case 'undefined':
  25193. case 'function':
  25194. continue;
  25195. case 'number':
  25196. case 'boolean':
  25197. k = value;
  25198. break;
  25199. case 'string':
  25200. k = value.hashCode();
  25201. break;
  25202. default:
  25203. value.updateHashCode(this);
  25204. continue;
  25205. }
  25206. k = k * 0xCC9E2D51;
  25207. k = k << 15 | k >>> 32 - 15;
  25208. k = k * 0x1B873593;
  25209. this.count = this.count + 1;
  25210. var hash = this.hash ^ k;
  25211. hash = hash << 13 | hash >>> 32 - 13;
  25212. hash = hash * 5 + 0xE6546B64;
  25213. this.hash = hash;
  25214. }
  25215. }
  25216. };
  25217. Hash.prototype.finish = function () {
  25218. var hash = this.hash ^ this.count * 4;
  25219. hash = hash ^ hash >>> 16;
  25220. hash = hash * 0x85EBCA6B;
  25221. hash = hash ^ hash >>> 13;
  25222. hash = hash * 0xC2B2AE35;
  25223. hash = hash ^ hash >>> 16;
  25224. return hash;
  25225. };
  25226. function hashStuff() {
  25227. var hash = new Hash();
  25228. hash.update.apply(arguments);
  25229. return hash.finish();
  25230. }
  25231. DoubleDict.prototype.get = function (a, b) {
  25232. var d = this[a] || null;
  25233. return d === null ? null : d[b] || null;
  25234. };
  25235. DoubleDict.prototype.set = function (a, b, o) {
  25236. var d = this[a] || null;
  25237. if (d === null) {
  25238. d = {};
  25239. this[a] = d;
  25240. }
  25241. d[b] = o;
  25242. };
  25243. function escapeWhitespace(s, escapeSpaces) {
  25244. s = s.replace(/\t/g, "\\t").replace(/\n/g, "\\n").replace(/\r/g, "\\r");
  25245. if (escapeSpaces) {
  25246. s = s.replace(/ /g, "\xB7");
  25247. }
  25248. return s;
  25249. }
  25250. function titleCase(str) {
  25251. return str.replace(/\w\S*/g, function (txt) {
  25252. return txt.charAt(0).toUpperCase() + txt.substr(1);
  25253. });
  25254. };
  25255. function equalArrays(a, b) {
  25256. if (!Array.isArray(a) || !Array.isArray(b)) return false;
  25257. if (a == b) return true;
  25258. if (a.length != b.length) return false;
  25259. for (var i = 0; i < a.length; i++) {
  25260. if (a[i] == b[i]) continue;
  25261. if (!a[i].equals(b[i])) return false;
  25262. }
  25263. return true;
  25264. };
  25265. exports.Hash = Hash;
  25266. exports.Set = Set;
  25267. exports.Map = Map;
  25268. exports.BitSet = BitSet;
  25269. exports.AltDict = AltDict;
  25270. exports.DoubleDict = DoubleDict;
  25271. exports.hashStuff = hashStuff;
  25272. exports.escapeWhitespace = escapeWhitespace;
  25273. exports.arrayToString = arrayToString;
  25274. exports.titleCase = titleCase;
  25275. exports.equalArrays = equalArrays;
  25276. /***/ }),
  25277. /***/ "./node_modules/antlr4/atn/ATN.js":
  25278. /*!****************************************!*\
  25279. !*** ./node_modules/antlr4/atn/ATN.js ***!
  25280. \****************************************/
  25281. /*! no static exports found */
  25282. /***/ (function(module, exports, __webpack_require__) {
  25283. "use strict";
  25284. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  25285. * Use of this file is governed by the BSD 3-clause license that
  25286. * can be found in the LICENSE.txt file in the project root.
  25287. */
  25288. var LL1Analyzer = __webpack_require__(/*! ./../LL1Analyzer */ "./node_modules/antlr4/LL1Analyzer.js").LL1Analyzer;
  25289. var IntervalSet = __webpack_require__(/*! ./../IntervalSet */ "./node_modules/antlr4/IntervalSet.js").IntervalSet;
  25290. function ATN(grammarType, maxTokenType) {
  25291. // Used for runtime deserialization of ATNs from strings///
  25292. // The type of the ATN.
  25293. this.grammarType = grammarType;
  25294. // The maximum value for any symbol recognized by a transition in the ATN.
  25295. this.maxTokenType = maxTokenType;
  25296. this.states = [];
  25297. // Each subrule/rule is a decision point and we must track them so we
  25298. // can go back later and build DFA predictors for them. This includes
  25299. // all the rules, subrules, optional blocks, ()+, ()* etc...
  25300. this.decisionToState = [];
  25301. // Maps from rule index to starting state number.
  25302. this.ruleToStartState = [];
  25303. // Maps from rule index to stop state number.
  25304. this.ruleToStopState = null;
  25305. this.modeNameToStartState = {};
  25306. // For lexer ATNs, this maps the rule index to the resulting token type.
  25307. // For parser ATNs, this maps the rule index to the generated bypass token
  25308. // type if the
  25309. // {@link ATNDeserializationOptions//isGenerateRuleBypassTransitions}
  25310. // deserialization option was specified; otherwise, this is {@code null}.
  25311. this.ruleToTokenType = null;
  25312. // For lexer ATNs, this is an array of {@link LexerAction} objects which may
  25313. // be referenced by action transitions in the ATN.
  25314. this.lexerActions = null;
  25315. this.modeToStartState = [];
  25316. return this;
  25317. }
  25318. // Compute the set of valid tokens that can occur starting in state {@code s}.
  25319. // If {@code ctx} is null, the set of tokens will not include what can follow
  25320. // the rule surrounding {@code s}. In other words, the set will be
  25321. // restricted to tokens reachable staying within {@code s}'s rule.
  25322. ATN.prototype.nextTokensInContext = function (s, ctx) {
  25323. var anal = new LL1Analyzer(this);
  25324. return anal.LOOK(s, null, ctx);
  25325. };
  25326. // Compute the set of valid tokens that can occur starting in {@code s} and
  25327. // staying in same rule. {@link Token//EPSILON} is in set if we reach end of
  25328. // rule.
  25329. ATN.prototype.nextTokensNoContext = function (s) {
  25330. if (s.nextTokenWithinRule !== null) {
  25331. return s.nextTokenWithinRule;
  25332. }
  25333. s.nextTokenWithinRule = this.nextTokensInContext(s, null);
  25334. s.nextTokenWithinRule.readOnly = true;
  25335. return s.nextTokenWithinRule;
  25336. };
  25337. ATN.prototype.nextTokens = function (s, ctx) {
  25338. if (ctx === undefined) {
  25339. return this.nextTokensNoContext(s);
  25340. } else {
  25341. return this.nextTokensInContext(s, ctx);
  25342. }
  25343. };
  25344. ATN.prototype.addState = function (state) {
  25345. if (state !== null) {
  25346. state.atn = this;
  25347. state.stateNumber = this.states.length;
  25348. }
  25349. this.states.push(state);
  25350. };
  25351. ATN.prototype.removeState = function (state) {
  25352. this.states[state.stateNumber] = null; // just free mem, don't shift states in list
  25353. };
  25354. ATN.prototype.defineDecisionState = function (s) {
  25355. this.decisionToState.push(s);
  25356. s.decision = this.decisionToState.length - 1;
  25357. return s.decision;
  25358. };
  25359. ATN.prototype.getDecisionState = function (decision) {
  25360. if (this.decisionToState.length === 0) {
  25361. return null;
  25362. } else {
  25363. return this.decisionToState[decision];
  25364. }
  25365. };
  25366. // Computes the set of input symbols which could follow ATN state number
  25367. // {@code stateNumber} in the specified full {@code context}. This method
  25368. // considers the complete parser context, but does not evaluate semantic
  25369. // predicates (i.e. all predicates encountered during the calculation are
  25370. // assumed true). If a path in the ATN exists from the starting state to the
  25371. // {@link RuleStopState} of the outermost context without matching any
  25372. // symbols, {@link Token//EOF} is added to the returned set.
  25373. //
  25374. // <p>If {@code context} is {@code null}, it is treated as
  25375. // {@link ParserRuleContext//EMPTY}.</p>
  25376. //
  25377. // @param stateNumber the ATN state number
  25378. // @param context the full parse context
  25379. // @return The set of potentially valid input symbols which could follow the
  25380. // specified state in the specified context.
  25381. // @throws IllegalArgumentException if the ATN does not contain a state with
  25382. // number {@code stateNumber}
  25383. var Token = __webpack_require__(/*! ./../Token */ "./node_modules/antlr4/Token.js").Token;
  25384. ATN.prototype.getExpectedTokens = function (stateNumber, ctx) {
  25385. if (stateNumber < 0 || stateNumber >= this.states.length) {
  25386. throw "Invalid state number.";
  25387. }
  25388. var s = this.states[stateNumber];
  25389. var following = this.nextTokens(s);
  25390. if (!following.contains(Token.EPSILON)) {
  25391. return following;
  25392. }
  25393. var expected = new IntervalSet();
  25394. expected.addSet(following);
  25395. expected.removeOne(Token.EPSILON);
  25396. while (ctx !== null && ctx.invokingState >= 0 && following.contains(Token.EPSILON)) {
  25397. var invokingState = this.states[ctx.invokingState];
  25398. var rt = invokingState.transitions[0];
  25399. following = this.nextTokens(rt.followState);
  25400. expected.addSet(following);
  25401. expected.removeOne(Token.EPSILON);
  25402. ctx = ctx.parentCtx;
  25403. }
  25404. if (following.contains(Token.EPSILON)) {
  25405. expected.addOne(Token.EOF);
  25406. }
  25407. return expected;
  25408. };
  25409. ATN.INVALID_ALT_NUMBER = 0;
  25410. exports.ATN = ATN;
  25411. /***/ }),
  25412. /***/ "./node_modules/antlr4/atn/ATNConfig.js":
  25413. /*!**********************************************!*\
  25414. !*** ./node_modules/antlr4/atn/ATNConfig.js ***!
  25415. \**********************************************/
  25416. /*! no static exports found */
  25417. /***/ (function(module, exports, __webpack_require__) {
  25418. "use strict";
  25419. //
  25420. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  25421. * Use of this file is governed by the BSD 3-clause license that
  25422. * can be found in the LICENSE.txt file in the project root.
  25423. */
  25424. ///
  25425. // A tuple: (ATN state, predicted alt, syntactic, semantic context).
  25426. // The syntactic context is a graph-structured stack node whose
  25427. // path(s) to the root is the rule invocation(s)
  25428. // chain used to arrive at the state. The semantic context is
  25429. // the tree of semantic predicates encountered before reaching
  25430. // an ATN state.
  25431. ///
  25432. var DecisionState = __webpack_require__(/*! ./ATNState */ "./node_modules/antlr4/atn/ATNState.js").DecisionState;
  25433. var SemanticContext = __webpack_require__(/*! ./SemanticContext */ "./node_modules/antlr4/atn/SemanticContext.js").SemanticContext;
  25434. var Hash = __webpack_require__(/*! ../Utils */ "./node_modules/antlr4/Utils.js").Hash;
  25435. function checkParams(params, isCfg) {
  25436. if (params === null) {
  25437. var result = { state: null, alt: null, context: null, semanticContext: null };
  25438. if (isCfg) {
  25439. result.reachesIntoOuterContext = 0;
  25440. }
  25441. return result;
  25442. } else {
  25443. var props = {};
  25444. props.state = params.state || null;
  25445. props.alt = params.alt === undefined ? null : params.alt;
  25446. props.context = params.context || null;
  25447. props.semanticContext = params.semanticContext || null;
  25448. if (isCfg) {
  25449. props.reachesIntoOuterContext = params.reachesIntoOuterContext || 0;
  25450. props.precedenceFilterSuppressed = params.precedenceFilterSuppressed || false;
  25451. }
  25452. return props;
  25453. }
  25454. }
  25455. function ATNConfig(params, config) {
  25456. this.checkContext(params, config);
  25457. params = checkParams(params);
  25458. config = checkParams(config, true);
  25459. // The ATN state associated with this configuration///
  25460. this.state = params.state !== null ? params.state : config.state;
  25461. // What alt (or lexer rule) is predicted by this configuration///
  25462. this.alt = params.alt !== null ? params.alt : config.alt;
  25463. // The stack of invoking states leading to the rule/states associated
  25464. // with this config. We track only those contexts pushed during
  25465. // execution of the ATN simulator.
  25466. this.context = params.context !== null ? params.context : config.context;
  25467. this.semanticContext = params.semanticContext !== null ? params.semanticContext : config.semanticContext !== null ? config.semanticContext : SemanticContext.NONE;
  25468. // We cannot execute predicates dependent upon local context unless
  25469. // we know for sure we are in the correct context. Because there is
  25470. // no way to do this efficiently, we simply cannot evaluate
  25471. // dependent predicates unless we are in the rule that initially
  25472. // invokes the ATN simulator.
  25473. //
  25474. // closure() tracks the depth of how far we dip into the
  25475. // outer context: depth &gt; 0. Note that it may not be totally
  25476. // accurate depth since I don't ever decrement. TODO: make it a boolean then
  25477. this.reachesIntoOuterContext = config.reachesIntoOuterContext;
  25478. this.precedenceFilterSuppressed = config.precedenceFilterSuppressed;
  25479. return this;
  25480. }
  25481. ATNConfig.prototype.checkContext = function (params, config) {
  25482. if ((params.context === null || params.context === undefined) && (config === null || config.context === null || config.context === undefined)) {
  25483. this.context = null;
  25484. }
  25485. };
  25486. ATNConfig.prototype.hashCode = function () {
  25487. var hash = new Hash();
  25488. this.updateHashCode(hash);
  25489. return hash.finish();
  25490. };
  25491. ATNConfig.prototype.updateHashCode = function (hash) {
  25492. hash.update(this.state.stateNumber, this.alt, this.context, this.semanticContext);
  25493. };
  25494. // An ATN configuration is equal to another if both have
  25495. // the same state, they predict the same alternative, and
  25496. // syntactic/semantic contexts are the same.
  25497. ATNConfig.prototype.equals = function (other) {
  25498. if (this === other) {
  25499. return true;
  25500. } else if (!(other instanceof ATNConfig)) {
  25501. return false;
  25502. } else {
  25503. return this.state.stateNumber === other.state.stateNumber && this.alt === other.alt && (this.context === null ? other.context === null : this.context.equals(other.context)) && this.semanticContext.equals(other.semanticContext) && this.precedenceFilterSuppressed === other.precedenceFilterSuppressed;
  25504. }
  25505. };
  25506. ATNConfig.prototype.hashCodeForConfigSet = function () {
  25507. var hash = new Hash();
  25508. hash.update(this.state.stateNumber, this.alt, this.semanticContext);
  25509. return hash.finish();
  25510. };
  25511. ATNConfig.prototype.equalsForConfigSet = function (other) {
  25512. if (this === other) {
  25513. return true;
  25514. } else if (!(other instanceof ATNConfig)) {
  25515. return false;
  25516. } else {
  25517. return this.state.stateNumber === other.state.stateNumber && this.alt === other.alt && this.semanticContext.equals(other.semanticContext);
  25518. }
  25519. };
  25520. ATNConfig.prototype.toString = function () {
  25521. return "(" + this.state + "," + this.alt + (this.context !== null ? ",[" + this.context.toString() + "]" : "") + (this.semanticContext !== SemanticContext.NONE ? "," + this.semanticContext.toString() : "") + (this.reachesIntoOuterContext > 0 ? ",up=" + this.reachesIntoOuterContext : "") + ")";
  25522. };
  25523. function LexerATNConfig(params, config) {
  25524. ATNConfig.call(this, params, config);
  25525. // This is the backing field for {@link //getLexerActionExecutor}.
  25526. var lexerActionExecutor = params.lexerActionExecutor || null;
  25527. this.lexerActionExecutor = lexerActionExecutor || (config !== null ? config.lexerActionExecutor : null);
  25528. this.passedThroughNonGreedyDecision = config !== null ? this.checkNonGreedyDecision(config, this.state) : false;
  25529. return this;
  25530. }
  25531. LexerATNConfig.prototype = Object.create(ATNConfig.prototype);
  25532. LexerATNConfig.prototype.constructor = LexerATNConfig;
  25533. LexerATNConfig.prototype.updateHashCode = function (hash) {
  25534. hash.update(this.state.stateNumber, this.alt, this.context, this.semanticContext, this.passedThroughNonGreedyDecision, this.lexerActionExecutor);
  25535. };
  25536. LexerATNConfig.prototype.equals = function (other) {
  25537. return this === other || other instanceof LexerATNConfig && this.passedThroughNonGreedyDecision == other.passedThroughNonGreedyDecision && (this.lexerActionExecutor ? this.lexerActionExecutor.equals(other.lexerActionExecutor) : !other.lexerActionExecutor) && ATNConfig.prototype.equals.call(this, other);
  25538. };
  25539. LexerATNConfig.prototype.hashCodeForConfigSet = LexerATNConfig.prototype.hashCode;
  25540. LexerATNConfig.prototype.equalsForConfigSet = LexerATNConfig.prototype.equals;
  25541. LexerATNConfig.prototype.checkNonGreedyDecision = function (source, target) {
  25542. return source.passedThroughNonGreedyDecision || target instanceof DecisionState && target.nonGreedy;
  25543. };
  25544. exports.ATNConfig = ATNConfig;
  25545. exports.LexerATNConfig = LexerATNConfig;
  25546. /***/ }),
  25547. /***/ "./node_modules/antlr4/atn/ATNConfigSet.js":
  25548. /*!*************************************************!*\
  25549. !*** ./node_modules/antlr4/atn/ATNConfigSet.js ***!
  25550. \*************************************************/
  25551. /*! no static exports found */
  25552. /***/ (function(module, exports, __webpack_require__) {
  25553. "use strict";
  25554. //
  25555. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  25556. * Use of this file is governed by the BSD 3-clause license that
  25557. * can be found in the LICENSE.txt file in the project root.
  25558. */
  25559. //
  25560. // Specialized {@link Set}{@code <}{@link ATNConfig}{@code >} that can track
  25561. // info about the set, with support for combining similar configurations using a
  25562. // graph-structured stack.
  25563. ///
  25564. var ATN = __webpack_require__(/*! ./ATN */ "./node_modules/antlr4/atn/ATN.js").ATN;
  25565. var Utils = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js");
  25566. var Hash = Utils.Hash;
  25567. var Set = Utils.Set;
  25568. var SemanticContext = __webpack_require__(/*! ./SemanticContext */ "./node_modules/antlr4/atn/SemanticContext.js").SemanticContext;
  25569. var merge = __webpack_require__(/*! ./../PredictionContext */ "./node_modules/antlr4/PredictionContext.js").merge;
  25570. function hashATNConfig(c) {
  25571. return c.hashCodeForConfigSet();
  25572. }
  25573. function equalATNConfigs(a, b) {
  25574. if (a === b) {
  25575. return true;
  25576. } else if (a === null || b === null) {
  25577. return false;
  25578. } else return a.equalsForConfigSet(b);
  25579. }
  25580. function ATNConfigSet(fullCtx) {
  25581. //
  25582. // The reason that we need this is because we don't want the hash map to use
  25583. // the standard hash code and equals. We need all configurations with the
  25584. // same
  25585. // {@code (s,i,_,semctx)} to be equal. Unfortunately, this key effectively
  25586. // doubles
  25587. // the number of objects associated with ATNConfigs. The other solution is
  25588. // to
  25589. // use a hash table that lets us specify the equals/hashcode operation.
  25590. // All configs but hashed by (s, i, _, pi) not including context. Wiped out
  25591. // when we go readonly as this set becomes a DFA state.
  25592. this.configLookup = new Set(hashATNConfig, equalATNConfigs);
  25593. // Indicates that this configuration set is part of a full context
  25594. // LL prediction. It will be used to determine how to merge $. With SLL
  25595. // it's a wildcard whereas it is not for LL context merge.
  25596. this.fullCtx = fullCtx === undefined ? true : fullCtx;
  25597. // Indicates that the set of configurations is read-only. Do not
  25598. // allow any code to manipulate the set; DFA states will point at
  25599. // the sets and they must not change. This does not protect the other
  25600. // fields; in particular, conflictingAlts is set after
  25601. // we've made this readonly.
  25602. this.readOnly = false;
  25603. // Track the elements as they are added to the set; supports get(i)///
  25604. this.configs = [];
  25605. // TODO: these fields make me pretty uncomfortable but nice to pack up info
  25606. // together, saves recomputation
  25607. // TODO: can we track conflicts as they are added to save scanning configs
  25608. // later?
  25609. this.uniqueAlt = 0;
  25610. this.conflictingAlts = null;
  25611. // Used in parser and lexer. In lexer, it indicates we hit a pred
  25612. // while computing a closure operation. Don't make a DFA state from this.
  25613. this.hasSemanticContext = false;
  25614. this.dipsIntoOuterContext = false;
  25615. this.cachedHashCode = -1;
  25616. return this;
  25617. }
  25618. // Adding a new config means merging contexts with existing configs for
  25619. // {@code (s, i, pi, _)}, where {@code s} is the
  25620. // {@link ATNConfig//state}, {@code i} is the {@link ATNConfig//alt}, and
  25621. // {@code pi} is the {@link ATNConfig//semanticContext}. We use
  25622. // {@code (s,i,pi)} as key.
  25623. //
  25624. // <p>This method updates {@link //dipsIntoOuterContext} and
  25625. // {@link //hasSemanticContext} when necessary.</p>
  25626. // /
  25627. ATNConfigSet.prototype.add = function (config, mergeCache) {
  25628. if (mergeCache === undefined) {
  25629. mergeCache = null;
  25630. }
  25631. if (this.readOnly) {
  25632. throw "This set is readonly";
  25633. }
  25634. if (config.semanticContext !== SemanticContext.NONE) {
  25635. this.hasSemanticContext = true;
  25636. }
  25637. if (config.reachesIntoOuterContext > 0) {
  25638. this.dipsIntoOuterContext = true;
  25639. }
  25640. var existing = this.configLookup.add(config);
  25641. if (existing === config) {
  25642. this.cachedHashCode = -1;
  25643. this.configs.push(config); // track order here
  25644. return true;
  25645. }
  25646. // a previous (s,i,pi,_), merge with it and save result
  25647. var rootIsWildcard = !this.fullCtx;
  25648. var merged = merge(existing.context, config.context, rootIsWildcard, mergeCache);
  25649. // no need to check for existing.context, config.context in cache
  25650. // since only way to create new graphs is "call rule" and here. We
  25651. // cache at both places.
  25652. existing.reachesIntoOuterContext = Math.max(existing.reachesIntoOuterContext, config.reachesIntoOuterContext);
  25653. // make sure to preserve the precedence filter suppression during the merge
  25654. if (config.precedenceFilterSuppressed) {
  25655. existing.precedenceFilterSuppressed = true;
  25656. }
  25657. existing.context = merged; // replace context; no need to alt mapping
  25658. return true;
  25659. };
  25660. ATNConfigSet.prototype.getStates = function () {
  25661. var states = new Set();
  25662. for (var i = 0; i < this.configs.length; i++) {
  25663. states.add(this.configs[i].state);
  25664. }
  25665. return states;
  25666. };
  25667. ATNConfigSet.prototype.getPredicates = function () {
  25668. var preds = [];
  25669. for (var i = 0; i < this.configs.length; i++) {
  25670. var c = this.configs[i].semanticContext;
  25671. if (c !== SemanticContext.NONE) {
  25672. preds.push(c.semanticContext);
  25673. }
  25674. }
  25675. return preds;
  25676. };
  25677. Object.defineProperty(ATNConfigSet.prototype, "items", {
  25678. get: function get() {
  25679. return this.configs;
  25680. }
  25681. });
  25682. ATNConfigSet.prototype.optimizeConfigs = function (interpreter) {
  25683. if (this.readOnly) {
  25684. throw "This set is readonly";
  25685. }
  25686. if (this.configLookup.length === 0) {
  25687. return;
  25688. }
  25689. for (var i = 0; i < this.configs.length; i++) {
  25690. var config = this.configs[i];
  25691. config.context = interpreter.getCachedContext(config.context);
  25692. }
  25693. };
  25694. ATNConfigSet.prototype.addAll = function (coll) {
  25695. for (var i = 0; i < coll.length; i++) {
  25696. this.add(coll[i]);
  25697. }
  25698. return false;
  25699. };
  25700. ATNConfigSet.prototype.equals = function (other) {
  25701. return this === other || other instanceof ATNConfigSet && Utils.equalArrays(this.configs, other.configs) && this.fullCtx === other.fullCtx && this.uniqueAlt === other.uniqueAlt && this.conflictingAlts === other.conflictingAlts && this.hasSemanticContext === other.hasSemanticContext && this.dipsIntoOuterContext === other.dipsIntoOuterContext;
  25702. };
  25703. ATNConfigSet.prototype.hashCode = function () {
  25704. var hash = new Hash();
  25705. this.updateHashCode(hash);
  25706. return hash.finish();
  25707. };
  25708. ATNConfigSet.prototype.updateHashCode = function (hash) {
  25709. if (this.readOnly) {
  25710. if (this.cachedHashCode === -1) {
  25711. var hash = new Hash();
  25712. hash.update(this.configs);
  25713. this.cachedHashCode = hash.finish();
  25714. }
  25715. hash.update(this.cachedHashCode);
  25716. } else {
  25717. hash.update(this.configs);
  25718. }
  25719. };
  25720. Object.defineProperty(ATNConfigSet.prototype, "length", {
  25721. get: function get() {
  25722. return this.configs.length;
  25723. }
  25724. });
  25725. ATNConfigSet.prototype.isEmpty = function () {
  25726. return this.configs.length === 0;
  25727. };
  25728. ATNConfigSet.prototype.contains = function (item) {
  25729. if (this.configLookup === null) {
  25730. throw "This method is not implemented for readonly sets.";
  25731. }
  25732. return this.configLookup.contains(item);
  25733. };
  25734. ATNConfigSet.prototype.containsFast = function (item) {
  25735. if (this.configLookup === null) {
  25736. throw "This method is not implemented for readonly sets.";
  25737. }
  25738. return this.configLookup.containsFast(item);
  25739. };
  25740. ATNConfigSet.prototype.clear = function () {
  25741. if (this.readOnly) {
  25742. throw "This set is readonly";
  25743. }
  25744. this.configs = [];
  25745. this.cachedHashCode = -1;
  25746. this.configLookup = new Set();
  25747. };
  25748. ATNConfigSet.prototype.setReadonly = function (readOnly) {
  25749. this.readOnly = readOnly;
  25750. if (readOnly) {
  25751. this.configLookup = null; // can't mod, no need for lookup cache
  25752. }
  25753. };
  25754. ATNConfigSet.prototype.toString = function () {
  25755. return Utils.arrayToString(this.configs) + (this.hasSemanticContext ? ",hasSemanticContext=" + this.hasSemanticContext : "") + (this.uniqueAlt !== ATN.INVALID_ALT_NUMBER ? ",uniqueAlt=" + this.uniqueAlt : "") + (this.conflictingAlts !== null ? ",conflictingAlts=" + this.conflictingAlts : "") + (this.dipsIntoOuterContext ? ",dipsIntoOuterContext" : "");
  25756. };
  25757. function OrderedATNConfigSet() {
  25758. ATNConfigSet.call(this);
  25759. this.configLookup = new Set();
  25760. return this;
  25761. }
  25762. OrderedATNConfigSet.prototype = Object.create(ATNConfigSet.prototype);
  25763. OrderedATNConfigSet.prototype.constructor = OrderedATNConfigSet;
  25764. exports.ATNConfigSet = ATNConfigSet;
  25765. exports.OrderedATNConfigSet = OrderedATNConfigSet;
  25766. /***/ }),
  25767. /***/ "./node_modules/antlr4/atn/ATNDeserializationOptions.js":
  25768. /*!**************************************************************!*\
  25769. !*** ./node_modules/antlr4/atn/ATNDeserializationOptions.js ***!
  25770. \**************************************************************/
  25771. /*! no static exports found */
  25772. /***/ (function(module, exports, __webpack_require__) {
  25773. "use strict";
  25774. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  25775. * Use of this file is governed by the BSD 3-clause license that
  25776. * can be found in the LICENSE.txt file in the project root.
  25777. */
  25778. function ATNDeserializationOptions(copyFrom) {
  25779. if (copyFrom === undefined) {
  25780. copyFrom = null;
  25781. }
  25782. this.readOnly = false;
  25783. this.verifyATN = copyFrom === null ? true : copyFrom.verifyATN;
  25784. this.generateRuleBypassTransitions = copyFrom === null ? false : copyFrom.generateRuleBypassTransitions;
  25785. return this;
  25786. }
  25787. ATNDeserializationOptions.defaultOptions = new ATNDeserializationOptions();
  25788. ATNDeserializationOptions.defaultOptions.readOnly = true;
  25789. // def __setattr__(self, key, value):
  25790. // if key!="readOnly" and self.readOnly:
  25791. // raise Exception("The object is read only.")
  25792. // super(type(self), self).__setattr__(key,value)
  25793. exports.ATNDeserializationOptions = ATNDeserializationOptions;
  25794. /***/ }),
  25795. /***/ "./node_modules/antlr4/atn/ATNDeserializer.js":
  25796. /*!****************************************************!*\
  25797. !*** ./node_modules/antlr4/atn/ATNDeserializer.js ***!
  25798. \****************************************************/
  25799. /*! no static exports found */
  25800. /***/ (function(module, exports, __webpack_require__) {
  25801. "use strict";
  25802. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  25803. * Use of this file is governed by the BSD 3-clause license that
  25804. * can be found in the LICENSE.txt file in the project root.
  25805. */
  25806. var Token = __webpack_require__(/*! ./../Token */ "./node_modules/antlr4/Token.js").Token;
  25807. var ATN = __webpack_require__(/*! ./ATN */ "./node_modules/antlr4/atn/ATN.js").ATN;
  25808. var ATNType = __webpack_require__(/*! ./ATNType */ "./node_modules/antlr4/atn/ATNType.js").ATNType;
  25809. var ATNStates = __webpack_require__(/*! ./ATNState */ "./node_modules/antlr4/atn/ATNState.js");
  25810. var ATNState = ATNStates.ATNState;
  25811. var BasicState = ATNStates.BasicState;
  25812. var DecisionState = ATNStates.DecisionState;
  25813. var BlockStartState = ATNStates.BlockStartState;
  25814. var BlockEndState = ATNStates.BlockEndState;
  25815. var LoopEndState = ATNStates.LoopEndState;
  25816. var RuleStartState = ATNStates.RuleStartState;
  25817. var RuleStopState = ATNStates.RuleStopState;
  25818. var TokensStartState = ATNStates.TokensStartState;
  25819. var PlusLoopbackState = ATNStates.PlusLoopbackState;
  25820. var StarLoopbackState = ATNStates.StarLoopbackState;
  25821. var StarLoopEntryState = ATNStates.StarLoopEntryState;
  25822. var PlusBlockStartState = ATNStates.PlusBlockStartState;
  25823. var StarBlockStartState = ATNStates.StarBlockStartState;
  25824. var BasicBlockStartState = ATNStates.BasicBlockStartState;
  25825. var Transitions = __webpack_require__(/*! ./Transition */ "./node_modules/antlr4/atn/Transition.js");
  25826. var Transition = Transitions.Transition;
  25827. var AtomTransition = Transitions.AtomTransition;
  25828. var SetTransition = Transitions.SetTransition;
  25829. var NotSetTransition = Transitions.NotSetTransition;
  25830. var RuleTransition = Transitions.RuleTransition;
  25831. var RangeTransition = Transitions.RangeTransition;
  25832. var ActionTransition = Transitions.ActionTransition;
  25833. var EpsilonTransition = Transitions.EpsilonTransition;
  25834. var WildcardTransition = Transitions.WildcardTransition;
  25835. var PredicateTransition = Transitions.PredicateTransition;
  25836. var PrecedencePredicateTransition = Transitions.PrecedencePredicateTransition;
  25837. var IntervalSet = __webpack_require__(/*! ./../IntervalSet */ "./node_modules/antlr4/IntervalSet.js").IntervalSet;
  25838. var Interval = __webpack_require__(/*! ./../IntervalSet */ "./node_modules/antlr4/IntervalSet.js").Interval;
  25839. var ATNDeserializationOptions = __webpack_require__(/*! ./ATNDeserializationOptions */ "./node_modules/antlr4/atn/ATNDeserializationOptions.js").ATNDeserializationOptions;
  25840. var LexerActions = __webpack_require__(/*! ./LexerAction */ "./node_modules/antlr4/atn/LexerAction.js");
  25841. var LexerActionType = LexerActions.LexerActionType;
  25842. var LexerSkipAction = LexerActions.LexerSkipAction;
  25843. var LexerChannelAction = LexerActions.LexerChannelAction;
  25844. var LexerCustomAction = LexerActions.LexerCustomAction;
  25845. var LexerMoreAction = LexerActions.LexerMoreAction;
  25846. var LexerTypeAction = LexerActions.LexerTypeAction;
  25847. var LexerPushModeAction = LexerActions.LexerPushModeAction;
  25848. var LexerPopModeAction = LexerActions.LexerPopModeAction;
  25849. var LexerModeAction = LexerActions.LexerModeAction;
  25850. // This is the earliest supported serialized UUID.
  25851. // stick to serialized version for now, we don't need a UUID instance
  25852. var BASE_SERIALIZED_UUID = "AADB8D7E-AEEF-4415-AD2B-8204D6CF042E";
  25853. //
  25854. // This UUID indicates the serialized ATN contains two sets of
  25855. // IntervalSets, where the second set's values are encoded as
  25856. // 32-bit integers to support the full Unicode SMP range up to U+10FFFF.
  25857. //
  25858. var ADDED_UNICODE_SMP = "59627784-3BE5-417A-B9EB-8131A7286089";
  25859. // This list contains all of the currently supported UUIDs, ordered by when
  25860. // the feature first appeared in this branch.
  25861. var SUPPORTED_UUIDS = [BASE_SERIALIZED_UUID, ADDED_UNICODE_SMP];
  25862. var SERIALIZED_VERSION = 3;
  25863. // This is the current serialized UUID.
  25864. var SERIALIZED_UUID = ADDED_UNICODE_SMP;
  25865. function initArray(length, value) {
  25866. var tmp = [];
  25867. tmp[length - 1] = value;
  25868. return tmp.map(function (i) {
  25869. return value;
  25870. });
  25871. }
  25872. function ATNDeserializer(options) {
  25873. if (options === undefined || options === null) {
  25874. options = ATNDeserializationOptions.defaultOptions;
  25875. }
  25876. this.deserializationOptions = options;
  25877. this.stateFactories = null;
  25878. this.actionFactories = null;
  25879. return this;
  25880. }
  25881. // Determines if a particular serialized representation of an ATN supports
  25882. // a particular feature, identified by the {@link UUID} used for serializing
  25883. // the ATN at the time the feature was first introduced.
  25884. //
  25885. // @param feature The {@link UUID} marking the first time the feature was
  25886. // supported in the serialized ATN.
  25887. // @param actualUuid The {@link UUID} of the actual serialized ATN which is
  25888. // currently being deserialized.
  25889. // @return {@code true} if the {@code actualUuid} value represents a
  25890. // serialized ATN at or after the feature identified by {@code feature} was
  25891. // introduced; otherwise, {@code false}.
  25892. ATNDeserializer.prototype.isFeatureSupported = function (feature, actualUuid) {
  25893. var idx1 = SUPPORTED_UUIDS.indexOf(feature);
  25894. if (idx1 < 0) {
  25895. return false;
  25896. }
  25897. var idx2 = SUPPORTED_UUIDS.indexOf(actualUuid);
  25898. return idx2 >= idx1;
  25899. };
  25900. ATNDeserializer.prototype.deserialize = function (data) {
  25901. this.reset(data);
  25902. this.checkVersion();
  25903. this.checkUUID();
  25904. var atn = this.readATN();
  25905. this.readStates(atn);
  25906. this.readRules(atn);
  25907. this.readModes(atn);
  25908. var sets = [];
  25909. // First, deserialize sets with 16-bit arguments <= U+FFFF.
  25910. this.readSets(atn, sets, this.readInt.bind(this));
  25911. // Next, if the ATN was serialized with the Unicode SMP feature,
  25912. // deserialize sets with 32-bit arguments <= U+10FFFF.
  25913. if (this.isFeatureSupported(ADDED_UNICODE_SMP, this.uuid)) {
  25914. this.readSets(atn, sets, this.readInt32.bind(this));
  25915. }
  25916. this.readEdges(atn, sets);
  25917. this.readDecisions(atn);
  25918. this.readLexerActions(atn);
  25919. this.markPrecedenceDecisions(atn);
  25920. this.verifyATN(atn);
  25921. if (this.deserializationOptions.generateRuleBypassTransitions && atn.grammarType === ATNType.PARSER) {
  25922. this.generateRuleBypassTransitions(atn);
  25923. // re-verify after modification
  25924. this.verifyATN(atn);
  25925. }
  25926. return atn;
  25927. };
  25928. ATNDeserializer.prototype.reset = function (data) {
  25929. var adjust = function adjust(c) {
  25930. var v = c.charCodeAt(0);
  25931. return v > 1 ? v - 2 : v + 65533;
  25932. };
  25933. var temp = data.split("").map(adjust);
  25934. // don't adjust the first value since that's the version number
  25935. temp[0] = data.charCodeAt(0);
  25936. this.data = temp;
  25937. this.pos = 0;
  25938. };
  25939. ATNDeserializer.prototype.checkVersion = function () {
  25940. var version = this.readInt();
  25941. if (version !== SERIALIZED_VERSION) {
  25942. throw "Could not deserialize ATN with version " + version + " (expected " + SERIALIZED_VERSION + ").";
  25943. }
  25944. };
  25945. ATNDeserializer.prototype.checkUUID = function () {
  25946. var uuid = this.readUUID();
  25947. if (SUPPORTED_UUIDS.indexOf(uuid) < 0) {
  25948. throw "Could not deserialize ATN with UUID: " + uuid + " (expected " + SERIALIZED_UUID + " or a legacy UUID).", uuid, SERIALIZED_UUID;
  25949. }
  25950. this.uuid = uuid;
  25951. };
  25952. ATNDeserializer.prototype.readATN = function () {
  25953. var grammarType = this.readInt();
  25954. var maxTokenType = this.readInt();
  25955. return new ATN(grammarType, maxTokenType);
  25956. };
  25957. ATNDeserializer.prototype.readStates = function (atn) {
  25958. var j, pair, stateNumber;
  25959. var loopBackStateNumbers = [];
  25960. var endStateNumbers = [];
  25961. var nstates = this.readInt();
  25962. for (var i = 0; i < nstates; i++) {
  25963. var stype = this.readInt();
  25964. // ignore bad type of states
  25965. if (stype === ATNState.INVALID_TYPE) {
  25966. atn.addState(null);
  25967. continue;
  25968. }
  25969. var ruleIndex = this.readInt();
  25970. if (ruleIndex === 0xFFFF) {
  25971. ruleIndex = -1;
  25972. }
  25973. var s = this.stateFactory(stype, ruleIndex);
  25974. if (stype === ATNState.LOOP_END) {
  25975. // special case
  25976. var loopBackStateNumber = this.readInt();
  25977. loopBackStateNumbers.push([s, loopBackStateNumber]);
  25978. } else if (s instanceof BlockStartState) {
  25979. var endStateNumber = this.readInt();
  25980. endStateNumbers.push([s, endStateNumber]);
  25981. }
  25982. atn.addState(s);
  25983. }
  25984. // delay the assignment of loop back and end states until we know all the
  25985. // state instances have been initialized
  25986. for (j = 0; j < loopBackStateNumbers.length; j++) {
  25987. pair = loopBackStateNumbers[j];
  25988. pair[0].loopBackState = atn.states[pair[1]];
  25989. }
  25990. for (j = 0; j < endStateNumbers.length; j++) {
  25991. pair = endStateNumbers[j];
  25992. pair[0].endState = atn.states[pair[1]];
  25993. }
  25994. var numNonGreedyStates = this.readInt();
  25995. for (j = 0; j < numNonGreedyStates; j++) {
  25996. stateNumber = this.readInt();
  25997. atn.states[stateNumber].nonGreedy = true;
  25998. }
  25999. var numPrecedenceStates = this.readInt();
  26000. for (j = 0; j < numPrecedenceStates; j++) {
  26001. stateNumber = this.readInt();
  26002. atn.states[stateNumber].isPrecedenceRule = true;
  26003. }
  26004. };
  26005. ATNDeserializer.prototype.readRules = function (atn) {
  26006. var i;
  26007. var nrules = this.readInt();
  26008. if (atn.grammarType === ATNType.LEXER) {
  26009. atn.ruleToTokenType = initArray(nrules, 0);
  26010. }
  26011. atn.ruleToStartState = initArray(nrules, 0);
  26012. for (i = 0; i < nrules; i++) {
  26013. var s = this.readInt();
  26014. var startState = atn.states[s];
  26015. atn.ruleToStartState[i] = startState;
  26016. if (atn.grammarType === ATNType.LEXER) {
  26017. var tokenType = this.readInt();
  26018. if (tokenType === 0xFFFF) {
  26019. tokenType = Token.EOF;
  26020. }
  26021. atn.ruleToTokenType[i] = tokenType;
  26022. }
  26023. }
  26024. atn.ruleToStopState = initArray(nrules, 0);
  26025. for (i = 0; i < atn.states.length; i++) {
  26026. var state = atn.states[i];
  26027. if (!(state instanceof RuleStopState)) {
  26028. continue;
  26029. }
  26030. atn.ruleToStopState[state.ruleIndex] = state;
  26031. atn.ruleToStartState[state.ruleIndex].stopState = state;
  26032. }
  26033. };
  26034. ATNDeserializer.prototype.readModes = function (atn) {
  26035. var nmodes = this.readInt();
  26036. for (var i = 0; i < nmodes; i++) {
  26037. var s = this.readInt();
  26038. atn.modeToStartState.push(atn.states[s]);
  26039. }
  26040. };
  26041. ATNDeserializer.prototype.readSets = function (atn, sets, readUnicode) {
  26042. var m = this.readInt();
  26043. for (var i = 0; i < m; i++) {
  26044. var iset = new IntervalSet();
  26045. sets.push(iset);
  26046. var n = this.readInt();
  26047. var containsEof = this.readInt();
  26048. if (containsEof !== 0) {
  26049. iset.addOne(-1);
  26050. }
  26051. for (var j = 0; j < n; j++) {
  26052. var i1 = readUnicode();
  26053. var i2 = readUnicode();
  26054. iset.addRange(i1, i2);
  26055. }
  26056. }
  26057. };
  26058. ATNDeserializer.prototype.readEdges = function (atn, sets) {
  26059. var i, j, state, trans, target;
  26060. var nedges = this.readInt();
  26061. for (i = 0; i < nedges; i++) {
  26062. var src = this.readInt();
  26063. var trg = this.readInt();
  26064. var ttype = this.readInt();
  26065. var arg1 = this.readInt();
  26066. var arg2 = this.readInt();
  26067. var arg3 = this.readInt();
  26068. trans = this.edgeFactory(atn, ttype, src, trg, arg1, arg2, arg3, sets);
  26069. var srcState = atn.states[src];
  26070. srcState.addTransition(trans);
  26071. }
  26072. // edges for rule stop states can be derived, so they aren't serialized
  26073. for (i = 0; i < atn.states.length; i++) {
  26074. state = atn.states[i];
  26075. for (j = 0; j < state.transitions.length; j++) {
  26076. var t = state.transitions[j];
  26077. if (!(t instanceof RuleTransition)) {
  26078. continue;
  26079. }
  26080. var outermostPrecedenceReturn = -1;
  26081. if (atn.ruleToStartState[t.target.ruleIndex].isPrecedenceRule) {
  26082. if (t.precedence === 0) {
  26083. outermostPrecedenceReturn = t.target.ruleIndex;
  26084. }
  26085. }
  26086. trans = new EpsilonTransition(t.followState, outermostPrecedenceReturn);
  26087. atn.ruleToStopState[t.target.ruleIndex].addTransition(trans);
  26088. }
  26089. }
  26090. for (i = 0; i < atn.states.length; i++) {
  26091. state = atn.states[i];
  26092. if (state instanceof BlockStartState) {
  26093. // we need to know the end state to set its start state
  26094. if (state.endState === null) {
  26095. throw "IllegalState";
  26096. }
  26097. // block end states can only be associated to a single block start
  26098. // state
  26099. if (state.endState.startState !== null) {
  26100. throw "IllegalState";
  26101. }
  26102. state.endState.startState = state;
  26103. }
  26104. if (state instanceof PlusLoopbackState) {
  26105. for (j = 0; j < state.transitions.length; j++) {
  26106. target = state.transitions[j].target;
  26107. if (target instanceof PlusBlockStartState) {
  26108. target.loopBackState = state;
  26109. }
  26110. }
  26111. } else if (state instanceof StarLoopbackState) {
  26112. for (j = 0; j < state.transitions.length; j++) {
  26113. target = state.transitions[j].target;
  26114. if (target instanceof StarLoopEntryState) {
  26115. target.loopBackState = state;
  26116. }
  26117. }
  26118. }
  26119. }
  26120. };
  26121. ATNDeserializer.prototype.readDecisions = function (atn) {
  26122. var ndecisions = this.readInt();
  26123. for (var i = 0; i < ndecisions; i++) {
  26124. var s = this.readInt();
  26125. var decState = atn.states[s];
  26126. atn.decisionToState.push(decState);
  26127. decState.decision = i;
  26128. }
  26129. };
  26130. ATNDeserializer.prototype.readLexerActions = function (atn) {
  26131. if (atn.grammarType === ATNType.LEXER) {
  26132. var count = this.readInt();
  26133. atn.lexerActions = initArray(count, null);
  26134. for (var i = 0; i < count; i++) {
  26135. var actionType = this.readInt();
  26136. var data1 = this.readInt();
  26137. if (data1 === 0xFFFF) {
  26138. data1 = -1;
  26139. }
  26140. var data2 = this.readInt();
  26141. if (data2 === 0xFFFF) {
  26142. data2 = -1;
  26143. }
  26144. var lexerAction = this.lexerActionFactory(actionType, data1, data2);
  26145. atn.lexerActions[i] = lexerAction;
  26146. }
  26147. }
  26148. };
  26149. ATNDeserializer.prototype.generateRuleBypassTransitions = function (atn) {
  26150. var i;
  26151. var count = atn.ruleToStartState.length;
  26152. for (i = 0; i < count; i++) {
  26153. atn.ruleToTokenType[i] = atn.maxTokenType + i + 1;
  26154. }
  26155. for (i = 0; i < count; i++) {
  26156. this.generateRuleBypassTransition(atn, i);
  26157. }
  26158. };
  26159. ATNDeserializer.prototype.generateRuleBypassTransition = function (atn, idx) {
  26160. var i, state;
  26161. var bypassStart = new BasicBlockStartState();
  26162. bypassStart.ruleIndex = idx;
  26163. atn.addState(bypassStart);
  26164. var bypassStop = new BlockEndState();
  26165. bypassStop.ruleIndex = idx;
  26166. atn.addState(bypassStop);
  26167. bypassStart.endState = bypassStop;
  26168. atn.defineDecisionState(bypassStart);
  26169. bypassStop.startState = bypassStart;
  26170. var excludeTransition = null;
  26171. var endState = null;
  26172. if (atn.ruleToStartState[idx].isPrecedenceRule) {
  26173. // wrap from the beginning of the rule to the StarLoopEntryState
  26174. endState = null;
  26175. for (i = 0; i < atn.states.length; i++) {
  26176. state = atn.states[i];
  26177. if (this.stateIsEndStateFor(state, idx)) {
  26178. endState = state;
  26179. excludeTransition = state.loopBackState.transitions[0];
  26180. break;
  26181. }
  26182. }
  26183. if (excludeTransition === null) {
  26184. throw "Couldn't identify final state of the precedence rule prefix section.";
  26185. }
  26186. } else {
  26187. endState = atn.ruleToStopState[idx];
  26188. }
  26189. // all non-excluded transitions that currently target end state need to
  26190. // target blockEnd instead
  26191. for (i = 0; i < atn.states.length; i++) {
  26192. state = atn.states[i];
  26193. for (var j = 0; j < state.transitions.length; j++) {
  26194. var transition = state.transitions[j];
  26195. if (transition === excludeTransition) {
  26196. continue;
  26197. }
  26198. if (transition.target === endState) {
  26199. transition.target = bypassStop;
  26200. }
  26201. }
  26202. }
  26203. // all transitions leaving the rule start state need to leave blockStart
  26204. // instead
  26205. var ruleToStartState = atn.ruleToStartState[idx];
  26206. var count = ruleToStartState.transitions.length;
  26207. while (count > 0) {
  26208. bypassStart.addTransition(ruleToStartState.transitions[count - 1]);
  26209. ruleToStartState.transitions = ruleToStartState.transitions.slice(-1);
  26210. }
  26211. // link the new states
  26212. atn.ruleToStartState[idx].addTransition(new EpsilonTransition(bypassStart));
  26213. bypassStop.addTransition(new EpsilonTransition(endState));
  26214. var matchState = new BasicState();
  26215. atn.addState(matchState);
  26216. matchState.addTransition(new AtomTransition(bypassStop, atn.ruleToTokenType[idx]));
  26217. bypassStart.addTransition(new EpsilonTransition(matchState));
  26218. };
  26219. ATNDeserializer.prototype.stateIsEndStateFor = function (state, idx) {
  26220. if (state.ruleIndex !== idx) {
  26221. return null;
  26222. }
  26223. if (!(state instanceof StarLoopEntryState)) {
  26224. return null;
  26225. }
  26226. var maybeLoopEndState = state.transitions[state.transitions.length - 1].target;
  26227. if (!(maybeLoopEndState instanceof LoopEndState)) {
  26228. return null;
  26229. }
  26230. if (maybeLoopEndState.epsilonOnlyTransitions && maybeLoopEndState.transitions[0].target instanceof RuleStopState) {
  26231. return state;
  26232. } else {
  26233. return null;
  26234. }
  26235. };
  26236. //
  26237. // Analyze the {@link StarLoopEntryState} states in the specified ATN to set
  26238. // the {@link StarLoopEntryState//isPrecedenceDecision} field to the
  26239. // correct value.
  26240. //
  26241. // @param atn The ATN.
  26242. //
  26243. ATNDeserializer.prototype.markPrecedenceDecisions = function (atn) {
  26244. for (var i = 0; i < atn.states.length; i++) {
  26245. var state = atn.states[i];
  26246. if (!(state instanceof StarLoopEntryState)) {
  26247. continue;
  26248. }
  26249. // We analyze the ATN to determine if this ATN decision state is the
  26250. // decision for the closure block that determines whether a
  26251. // precedence rule should continue or complete.
  26252. //
  26253. if (atn.ruleToStartState[state.ruleIndex].isPrecedenceRule) {
  26254. var maybeLoopEndState = state.transitions[state.transitions.length - 1].target;
  26255. if (maybeLoopEndState instanceof LoopEndState) {
  26256. if (maybeLoopEndState.epsilonOnlyTransitions && maybeLoopEndState.transitions[0].target instanceof RuleStopState) {
  26257. state.isPrecedenceDecision = true;
  26258. }
  26259. }
  26260. }
  26261. }
  26262. };
  26263. ATNDeserializer.prototype.verifyATN = function (atn) {
  26264. if (!this.deserializationOptions.verifyATN) {
  26265. return;
  26266. }
  26267. // verify assumptions
  26268. for (var i = 0; i < atn.states.length; i++) {
  26269. var state = atn.states[i];
  26270. if (state === null) {
  26271. continue;
  26272. }
  26273. this.checkCondition(state.epsilonOnlyTransitions || state.transitions.length <= 1);
  26274. if (state instanceof PlusBlockStartState) {
  26275. this.checkCondition(state.loopBackState !== null);
  26276. } else if (state instanceof StarLoopEntryState) {
  26277. this.checkCondition(state.loopBackState !== null);
  26278. this.checkCondition(state.transitions.length === 2);
  26279. if (state.transitions[0].target instanceof StarBlockStartState) {
  26280. this.checkCondition(state.transitions[1].target instanceof LoopEndState);
  26281. this.checkCondition(!state.nonGreedy);
  26282. } else if (state.transitions[0].target instanceof LoopEndState) {
  26283. this.checkCondition(state.transitions[1].target instanceof StarBlockStartState);
  26284. this.checkCondition(state.nonGreedy);
  26285. } else {
  26286. throw "IllegalState";
  26287. }
  26288. } else if (state instanceof StarLoopbackState) {
  26289. this.checkCondition(state.transitions.length === 1);
  26290. this.checkCondition(state.transitions[0].target instanceof StarLoopEntryState);
  26291. } else if (state instanceof LoopEndState) {
  26292. this.checkCondition(state.loopBackState !== null);
  26293. } else if (state instanceof RuleStartState) {
  26294. this.checkCondition(state.stopState !== null);
  26295. } else if (state instanceof BlockStartState) {
  26296. this.checkCondition(state.endState !== null);
  26297. } else if (state instanceof BlockEndState) {
  26298. this.checkCondition(state.startState !== null);
  26299. } else if (state instanceof DecisionState) {
  26300. this.checkCondition(state.transitions.length <= 1 || state.decision >= 0);
  26301. } else {
  26302. this.checkCondition(state.transitions.length <= 1 || state instanceof RuleStopState);
  26303. }
  26304. }
  26305. };
  26306. ATNDeserializer.prototype.checkCondition = function (condition, message) {
  26307. if (!condition) {
  26308. if (message === undefined || message === null) {
  26309. message = "IllegalState";
  26310. }
  26311. throw message;
  26312. }
  26313. };
  26314. ATNDeserializer.prototype.readInt = function () {
  26315. return this.data[this.pos++];
  26316. };
  26317. ATNDeserializer.prototype.readInt32 = function () {
  26318. var low = this.readInt();
  26319. var high = this.readInt();
  26320. return low | high << 16;
  26321. };
  26322. ATNDeserializer.prototype.readLong = function () {
  26323. var low = this.readInt32();
  26324. var high = this.readInt32();
  26325. return low & 0x00000000FFFFFFFF | high << 32;
  26326. };
  26327. function createByteToHex() {
  26328. var bth = [];
  26329. for (var i = 0; i < 256; i++) {
  26330. bth[i] = (i + 0x100).toString(16).substr(1).toUpperCase();
  26331. }
  26332. return bth;
  26333. }
  26334. var byteToHex = createByteToHex();
  26335. ATNDeserializer.prototype.readUUID = function () {
  26336. var bb = [];
  26337. for (var i = 7; i >= 0; i--) {
  26338. var int = this.readInt();
  26339. /* jshint bitwise: false */
  26340. bb[2 * i + 1] = int & 0xFF;
  26341. bb[2 * i] = int >> 8 & 0xFF;
  26342. }
  26343. return byteToHex[bb[0]] + byteToHex[bb[1]] + byteToHex[bb[2]] + byteToHex[bb[3]] + '-' + byteToHex[bb[4]] + byteToHex[bb[5]] + '-' + byteToHex[bb[6]] + byteToHex[bb[7]] + '-' + byteToHex[bb[8]] + byteToHex[bb[9]] + '-' + byteToHex[bb[10]] + byteToHex[bb[11]] + byteToHex[bb[12]] + byteToHex[bb[13]] + byteToHex[bb[14]] + byteToHex[bb[15]];
  26344. };
  26345. ATNDeserializer.prototype.edgeFactory = function (atn, type, src, trg, arg1, arg2, arg3, sets) {
  26346. var target = atn.states[trg];
  26347. switch (type) {
  26348. case Transition.EPSILON:
  26349. return new EpsilonTransition(target);
  26350. case Transition.RANGE:
  26351. return arg3 !== 0 ? new RangeTransition(target, Token.EOF, arg2) : new RangeTransition(target, arg1, arg2);
  26352. case Transition.RULE:
  26353. return new RuleTransition(atn.states[arg1], arg2, arg3, target);
  26354. case Transition.PREDICATE:
  26355. return new PredicateTransition(target, arg1, arg2, arg3 !== 0);
  26356. case Transition.PRECEDENCE:
  26357. return new PrecedencePredicateTransition(target, arg1);
  26358. case Transition.ATOM:
  26359. return arg3 !== 0 ? new AtomTransition(target, Token.EOF) : new AtomTransition(target, arg1);
  26360. case Transition.ACTION:
  26361. return new ActionTransition(target, arg1, arg2, arg3 !== 0);
  26362. case Transition.SET:
  26363. return new SetTransition(target, sets[arg1]);
  26364. case Transition.NOT_SET:
  26365. return new NotSetTransition(target, sets[arg1]);
  26366. case Transition.WILDCARD:
  26367. return new WildcardTransition(target);
  26368. default:
  26369. throw "The specified transition type: " + type + " is not valid.";
  26370. }
  26371. };
  26372. ATNDeserializer.prototype.stateFactory = function (type, ruleIndex) {
  26373. if (this.stateFactories === null) {
  26374. var sf = [];
  26375. sf[ATNState.INVALID_TYPE] = null;
  26376. sf[ATNState.BASIC] = function () {
  26377. return new BasicState();
  26378. };
  26379. sf[ATNState.RULE_START] = function () {
  26380. return new RuleStartState();
  26381. };
  26382. sf[ATNState.BLOCK_START] = function () {
  26383. return new BasicBlockStartState();
  26384. };
  26385. sf[ATNState.PLUS_BLOCK_START] = function () {
  26386. return new PlusBlockStartState();
  26387. };
  26388. sf[ATNState.STAR_BLOCK_START] = function () {
  26389. return new StarBlockStartState();
  26390. };
  26391. sf[ATNState.TOKEN_START] = function () {
  26392. return new TokensStartState();
  26393. };
  26394. sf[ATNState.RULE_STOP] = function () {
  26395. return new RuleStopState();
  26396. };
  26397. sf[ATNState.BLOCK_END] = function () {
  26398. return new BlockEndState();
  26399. };
  26400. sf[ATNState.STAR_LOOP_BACK] = function () {
  26401. return new StarLoopbackState();
  26402. };
  26403. sf[ATNState.STAR_LOOP_ENTRY] = function () {
  26404. return new StarLoopEntryState();
  26405. };
  26406. sf[ATNState.PLUS_LOOP_BACK] = function () {
  26407. return new PlusLoopbackState();
  26408. };
  26409. sf[ATNState.LOOP_END] = function () {
  26410. return new LoopEndState();
  26411. };
  26412. this.stateFactories = sf;
  26413. }
  26414. if (type > this.stateFactories.length || this.stateFactories[type] === null) {
  26415. throw "The specified state type " + type + " is not valid.";
  26416. } else {
  26417. var s = this.stateFactories[type]();
  26418. if (s !== null) {
  26419. s.ruleIndex = ruleIndex;
  26420. return s;
  26421. }
  26422. }
  26423. };
  26424. ATNDeserializer.prototype.lexerActionFactory = function (type, data1, data2) {
  26425. if (this.actionFactories === null) {
  26426. var af = [];
  26427. af[LexerActionType.CHANNEL] = function (data1, data2) {
  26428. return new LexerChannelAction(data1);
  26429. };
  26430. af[LexerActionType.CUSTOM] = function (data1, data2) {
  26431. return new LexerCustomAction(data1, data2);
  26432. };
  26433. af[LexerActionType.MODE] = function (data1, data2) {
  26434. return new LexerModeAction(data1);
  26435. };
  26436. af[LexerActionType.MORE] = function (data1, data2) {
  26437. return LexerMoreAction.INSTANCE;
  26438. };
  26439. af[LexerActionType.POP_MODE] = function (data1, data2) {
  26440. return LexerPopModeAction.INSTANCE;
  26441. };
  26442. af[LexerActionType.PUSH_MODE] = function (data1, data2) {
  26443. return new LexerPushModeAction(data1);
  26444. };
  26445. af[LexerActionType.SKIP] = function (data1, data2) {
  26446. return LexerSkipAction.INSTANCE;
  26447. };
  26448. af[LexerActionType.TYPE] = function (data1, data2) {
  26449. return new LexerTypeAction(data1);
  26450. };
  26451. this.actionFactories = af;
  26452. }
  26453. if (type > this.actionFactories.length || this.actionFactories[type] === null) {
  26454. throw "The specified lexer action type " + type + " is not valid.";
  26455. } else {
  26456. return this.actionFactories[type](data1, data2);
  26457. }
  26458. };
  26459. exports.ATNDeserializer = ATNDeserializer;
  26460. /***/ }),
  26461. /***/ "./node_modules/antlr4/atn/ATNSimulator.js":
  26462. /*!*************************************************!*\
  26463. !*** ./node_modules/antlr4/atn/ATNSimulator.js ***!
  26464. \*************************************************/
  26465. /*! no static exports found */
  26466. /***/ (function(module, exports, __webpack_require__) {
  26467. "use strict";
  26468. //
  26469. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  26470. * Use of this file is governed by the BSD 3-clause license that
  26471. * can be found in the LICENSE.txt file in the project root.
  26472. */
  26473. ///
  26474. var DFAState = __webpack_require__(/*! ./../dfa/DFAState */ "./node_modules/antlr4/dfa/DFAState.js").DFAState;
  26475. var ATNConfigSet = __webpack_require__(/*! ./ATNConfigSet */ "./node_modules/antlr4/atn/ATNConfigSet.js").ATNConfigSet;
  26476. var getCachedPredictionContext = __webpack_require__(/*! ./../PredictionContext */ "./node_modules/antlr4/PredictionContext.js").getCachedPredictionContext;
  26477. function ATNSimulator(atn, sharedContextCache) {
  26478. // The context cache maps all PredictionContext objects that are ==
  26479. // to a single cached copy. This cache is shared across all contexts
  26480. // in all ATNConfigs in all DFA states. We rebuild each ATNConfigSet
  26481. // to use only cached nodes/graphs in addDFAState(). We don't want to
  26482. // fill this during closure() since there are lots of contexts that
  26483. // pop up but are not used ever again. It also greatly slows down closure().
  26484. //
  26485. // <p>This cache makes a huge difference in memory and a little bit in speed.
  26486. // For the Java grammar on java.*, it dropped the memory requirements
  26487. // at the end from 25M to 16M. We don't store any of the full context
  26488. // graphs in the DFA because they are limited to local context only,
  26489. // but apparently there's a lot of repetition there as well. We optimize
  26490. // the config contexts before storing the config set in the DFA states
  26491. // by literally rebuilding them with cached subgraphs only.</p>
  26492. //
  26493. // <p>I tried a cache for use during closure operations, that was
  26494. // whacked after each adaptivePredict(). It cost a little bit
  26495. // more time I think and doesn't save on the overall footprint
  26496. // so it's not worth the complexity.</p>
  26497. ///
  26498. this.atn = atn;
  26499. this.sharedContextCache = sharedContextCache;
  26500. return this;
  26501. }
  26502. // Must distinguish between missing edge and edge we know leads nowhere///
  26503. ATNSimulator.ERROR = new DFAState(0x7FFFFFFF, new ATNConfigSet());
  26504. ATNSimulator.prototype.getCachedContext = function (context) {
  26505. if (this.sharedContextCache === null) {
  26506. return context;
  26507. }
  26508. var visited = {};
  26509. return getCachedPredictionContext(context, this.sharedContextCache, visited);
  26510. };
  26511. exports.ATNSimulator = ATNSimulator;
  26512. /***/ }),
  26513. /***/ "./node_modules/antlr4/atn/ATNState.js":
  26514. /*!*********************************************!*\
  26515. !*** ./node_modules/antlr4/atn/ATNState.js ***!
  26516. \*********************************************/
  26517. /*! no static exports found */
  26518. /***/ (function(module, exports, __webpack_require__) {
  26519. "use strict";
  26520. //
  26521. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  26522. * Use of this file is governed by the BSD 3-clause license that
  26523. * can be found in the LICENSE.txt file in the project root.
  26524. */
  26525. //
  26526. // The following images show the relation of states and
  26527. // {@link ATNState//transitions} for various grammar constructs.
  26528. //
  26529. // <ul>
  26530. //
  26531. // <li>Solid edges marked with an &//0949; indicate a required
  26532. // {@link EpsilonTransition}.</li>
  26533. //
  26534. // <li>Dashed edges indicate locations where any transition derived from
  26535. // {@link Transition} might appear.</li>
  26536. //
  26537. // <li>Dashed nodes are place holders for either a sequence of linked
  26538. // {@link BasicState} states or the inclusion of a block representing a nested
  26539. // construct in one of the forms below.</li>
  26540. //
  26541. // <li>Nodes showing multiple outgoing alternatives with a {@code ...} support
  26542. // any number of alternatives (one or more). Nodes without the {@code ...} only
  26543. // support the exact number of alternatives shown in the diagram.</li>
  26544. //
  26545. // </ul>
  26546. //
  26547. // <h2>Basic Blocks</h2>
  26548. //
  26549. // <h3>Rule</h3>
  26550. //
  26551. // <embed src="images/Rule.svg" type="image/svg+xml"/>
  26552. //
  26553. // <h3>Block of 1 or more alternatives</h3>
  26554. //
  26555. // <embed src="images/Block.svg" type="image/svg+xml"/>
  26556. //
  26557. // <h2>Greedy Loops</h2>
  26558. //
  26559. // <h3>Greedy Closure: {@code (...)*}</h3>
  26560. //
  26561. // <embed src="images/ClosureGreedy.svg" type="image/svg+xml"/>
  26562. //
  26563. // <h3>Greedy Positive Closure: {@code (...)+}</h3>
  26564. //
  26565. // <embed src="images/PositiveClosureGreedy.svg" type="image/svg+xml"/>
  26566. //
  26567. // <h3>Greedy Optional: {@code (...)?}</h3>
  26568. //
  26569. // <embed src="images/OptionalGreedy.svg" type="image/svg+xml"/>
  26570. //
  26571. // <h2>Non-Greedy Loops</h2>
  26572. //
  26573. // <h3>Non-Greedy Closure: {@code (...)*?}</h3>
  26574. //
  26575. // <embed src="images/ClosureNonGreedy.svg" type="image/svg+xml"/>
  26576. //
  26577. // <h3>Non-Greedy Positive Closure: {@code (...)+?}</h3>
  26578. //
  26579. // <embed src="images/PositiveClosureNonGreedy.svg" type="image/svg+xml"/>
  26580. //
  26581. // <h3>Non-Greedy Optional: {@code (...)??}</h3>
  26582. //
  26583. // <embed src="images/OptionalNonGreedy.svg" type="image/svg+xml"/>
  26584. //
  26585. var INITIAL_NUM_TRANSITIONS = 4;
  26586. function ATNState() {
  26587. // Which ATN are we in?
  26588. this.atn = null;
  26589. this.stateNumber = ATNState.INVALID_STATE_NUMBER;
  26590. this.stateType = null;
  26591. this.ruleIndex = 0; // at runtime, we don't have Rule objects
  26592. this.epsilonOnlyTransitions = false;
  26593. // Track the transitions emanating from this ATN state.
  26594. this.transitions = [];
  26595. // Used to cache lookahead during parsing, not used during construction
  26596. this.nextTokenWithinRule = null;
  26597. return this;
  26598. }
  26599. // constants for serialization
  26600. ATNState.INVALID_TYPE = 0;
  26601. ATNState.BASIC = 1;
  26602. ATNState.RULE_START = 2;
  26603. ATNState.BLOCK_START = 3;
  26604. ATNState.PLUS_BLOCK_START = 4;
  26605. ATNState.STAR_BLOCK_START = 5;
  26606. ATNState.TOKEN_START = 6;
  26607. ATNState.RULE_STOP = 7;
  26608. ATNState.BLOCK_END = 8;
  26609. ATNState.STAR_LOOP_BACK = 9;
  26610. ATNState.STAR_LOOP_ENTRY = 10;
  26611. ATNState.PLUS_LOOP_BACK = 11;
  26612. ATNState.LOOP_END = 12;
  26613. ATNState.serializationNames = ["INVALID", "BASIC", "RULE_START", "BLOCK_START", "PLUS_BLOCK_START", "STAR_BLOCK_START", "TOKEN_START", "RULE_STOP", "BLOCK_END", "STAR_LOOP_BACK", "STAR_LOOP_ENTRY", "PLUS_LOOP_BACK", "LOOP_END"];
  26614. ATNState.INVALID_STATE_NUMBER = -1;
  26615. ATNState.prototype.toString = function () {
  26616. return this.stateNumber;
  26617. };
  26618. ATNState.prototype.equals = function (other) {
  26619. if (other instanceof ATNState) {
  26620. return this.stateNumber === other.stateNumber;
  26621. } else {
  26622. return false;
  26623. }
  26624. };
  26625. ATNState.prototype.isNonGreedyExitState = function () {
  26626. return false;
  26627. };
  26628. ATNState.prototype.addTransition = function (trans, index) {
  26629. if (index === undefined) {
  26630. index = -1;
  26631. }
  26632. if (this.transitions.length === 0) {
  26633. this.epsilonOnlyTransitions = trans.isEpsilon;
  26634. } else if (this.epsilonOnlyTransitions !== trans.isEpsilon) {
  26635. this.epsilonOnlyTransitions = false;
  26636. }
  26637. if (index === -1) {
  26638. this.transitions.push(trans);
  26639. } else {
  26640. this.transitions.splice(index, 1, trans);
  26641. }
  26642. };
  26643. function BasicState() {
  26644. ATNState.call(this);
  26645. this.stateType = ATNState.BASIC;
  26646. return this;
  26647. }
  26648. BasicState.prototype = Object.create(ATNState.prototype);
  26649. BasicState.prototype.constructor = BasicState;
  26650. function DecisionState() {
  26651. ATNState.call(this);
  26652. this.decision = -1;
  26653. this.nonGreedy = false;
  26654. return this;
  26655. }
  26656. DecisionState.prototype = Object.create(ATNState.prototype);
  26657. DecisionState.prototype.constructor = DecisionState;
  26658. // The start of a regular {@code (...)} block.
  26659. function BlockStartState() {
  26660. DecisionState.call(this);
  26661. this.endState = null;
  26662. return this;
  26663. }
  26664. BlockStartState.prototype = Object.create(DecisionState.prototype);
  26665. BlockStartState.prototype.constructor = BlockStartState;
  26666. function BasicBlockStartState() {
  26667. BlockStartState.call(this);
  26668. this.stateType = ATNState.BLOCK_START;
  26669. return this;
  26670. }
  26671. BasicBlockStartState.prototype = Object.create(BlockStartState.prototype);
  26672. BasicBlockStartState.prototype.constructor = BasicBlockStartState;
  26673. // Terminal node of a simple {@code (a|b|c)} block.
  26674. function BlockEndState() {
  26675. ATNState.call(this);
  26676. this.stateType = ATNState.BLOCK_END;
  26677. this.startState = null;
  26678. return this;
  26679. }
  26680. BlockEndState.prototype = Object.create(ATNState.prototype);
  26681. BlockEndState.prototype.constructor = BlockEndState;
  26682. // The last node in the ATN for a rule, unless that rule is the start symbol.
  26683. // In that case, there is one transition to EOF. Later, we might encode
  26684. // references to all calls to this rule to compute FOLLOW sets for
  26685. // error handling.
  26686. //
  26687. function RuleStopState() {
  26688. ATNState.call(this);
  26689. this.stateType = ATNState.RULE_STOP;
  26690. return this;
  26691. }
  26692. RuleStopState.prototype = Object.create(ATNState.prototype);
  26693. RuleStopState.prototype.constructor = RuleStopState;
  26694. function RuleStartState() {
  26695. ATNState.call(this);
  26696. this.stateType = ATNState.RULE_START;
  26697. this.stopState = null;
  26698. this.isPrecedenceRule = false;
  26699. return this;
  26700. }
  26701. RuleStartState.prototype = Object.create(ATNState.prototype);
  26702. RuleStartState.prototype.constructor = RuleStartState;
  26703. // Decision state for {@code A+} and {@code (A|B)+}. It has two transitions:
  26704. // one to the loop back to start of the block and one to exit.
  26705. //
  26706. function PlusLoopbackState() {
  26707. DecisionState.call(this);
  26708. this.stateType = ATNState.PLUS_LOOP_BACK;
  26709. return this;
  26710. }
  26711. PlusLoopbackState.prototype = Object.create(DecisionState.prototype);
  26712. PlusLoopbackState.prototype.constructor = PlusLoopbackState;
  26713. // Start of {@code (A|B|...)+} loop. Technically a decision state, but
  26714. // we don't use for code generation; somebody might need it, so I'm defining
  26715. // it for completeness. In reality, the {@link PlusLoopbackState} node is the
  26716. // real decision-making note for {@code A+}.
  26717. //
  26718. function PlusBlockStartState() {
  26719. BlockStartState.call(this);
  26720. this.stateType = ATNState.PLUS_BLOCK_START;
  26721. this.loopBackState = null;
  26722. return this;
  26723. }
  26724. PlusBlockStartState.prototype = Object.create(BlockStartState.prototype);
  26725. PlusBlockStartState.prototype.constructor = PlusBlockStartState;
  26726. // The block that begins a closure loop.
  26727. function StarBlockStartState() {
  26728. BlockStartState.call(this);
  26729. this.stateType = ATNState.STAR_BLOCK_START;
  26730. return this;
  26731. }
  26732. StarBlockStartState.prototype = Object.create(BlockStartState.prototype);
  26733. StarBlockStartState.prototype.constructor = StarBlockStartState;
  26734. function StarLoopbackState() {
  26735. ATNState.call(this);
  26736. this.stateType = ATNState.STAR_LOOP_BACK;
  26737. return this;
  26738. }
  26739. StarLoopbackState.prototype = Object.create(ATNState.prototype);
  26740. StarLoopbackState.prototype.constructor = StarLoopbackState;
  26741. function StarLoopEntryState() {
  26742. DecisionState.call(this);
  26743. this.stateType = ATNState.STAR_LOOP_ENTRY;
  26744. this.loopBackState = null;
  26745. // Indicates whether this state can benefit from a precedence DFA during SLL decision making.
  26746. this.isPrecedenceDecision = null;
  26747. return this;
  26748. }
  26749. StarLoopEntryState.prototype = Object.create(DecisionState.prototype);
  26750. StarLoopEntryState.prototype.constructor = StarLoopEntryState;
  26751. // Mark the end of a * or + loop.
  26752. function LoopEndState() {
  26753. ATNState.call(this);
  26754. this.stateType = ATNState.LOOP_END;
  26755. this.loopBackState = null;
  26756. return this;
  26757. }
  26758. LoopEndState.prototype = Object.create(ATNState.prototype);
  26759. LoopEndState.prototype.constructor = LoopEndState;
  26760. // The Tokens rule start state linking to each lexer rule start state */
  26761. function TokensStartState() {
  26762. DecisionState.call(this);
  26763. this.stateType = ATNState.TOKEN_START;
  26764. return this;
  26765. }
  26766. TokensStartState.prototype = Object.create(DecisionState.prototype);
  26767. TokensStartState.prototype.constructor = TokensStartState;
  26768. exports.ATNState = ATNState;
  26769. exports.BasicState = BasicState;
  26770. exports.DecisionState = DecisionState;
  26771. exports.BlockStartState = BlockStartState;
  26772. exports.BlockEndState = BlockEndState;
  26773. exports.LoopEndState = LoopEndState;
  26774. exports.RuleStartState = RuleStartState;
  26775. exports.RuleStopState = RuleStopState;
  26776. exports.TokensStartState = TokensStartState;
  26777. exports.PlusLoopbackState = PlusLoopbackState;
  26778. exports.StarLoopbackState = StarLoopbackState;
  26779. exports.StarLoopEntryState = StarLoopEntryState;
  26780. exports.PlusBlockStartState = PlusBlockStartState;
  26781. exports.StarBlockStartState = StarBlockStartState;
  26782. exports.BasicBlockStartState = BasicBlockStartState;
  26783. /***/ }),
  26784. /***/ "./node_modules/antlr4/atn/ATNType.js":
  26785. /*!********************************************!*\
  26786. !*** ./node_modules/antlr4/atn/ATNType.js ***!
  26787. \********************************************/
  26788. /*! no static exports found */
  26789. /***/ (function(module, exports, __webpack_require__) {
  26790. "use strict";
  26791. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  26792. * Use of this file is governed by the BSD 3-clause license that
  26793. * can be found in the LICENSE.txt file in the project root.
  26794. */
  26795. ///
  26796. // Represents the type of recognizer an ATN applies to.
  26797. function ATNType() {}
  26798. ATNType.LEXER = 0;
  26799. ATNType.PARSER = 1;
  26800. exports.ATNType = ATNType;
  26801. /***/ }),
  26802. /***/ "./node_modules/antlr4/atn/LexerATNSimulator.js":
  26803. /*!******************************************************!*\
  26804. !*** ./node_modules/antlr4/atn/LexerATNSimulator.js ***!
  26805. \******************************************************/
  26806. /*! no static exports found */
  26807. /***/ (function(module, exports, __webpack_require__) {
  26808. "use strict";
  26809. //
  26810. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  26811. * Use of this file is governed by the BSD 3-clause license that
  26812. * can be found in the LICENSE.txt file in the project root.
  26813. */
  26814. ///
  26815. // When we hit an accept state in either the DFA or the ATN, we
  26816. // have to notify the character stream to start buffering characters
  26817. // via {@link IntStream//mark} and record the current state. The current sim state
  26818. // includes the current index into the input, the current line,
  26819. // and current character position in that line. Note that the Lexer is
  26820. // tracking the starting line and characterization of the token. These
  26821. // variables track the "state" of the simulator when it hits an accept state.
  26822. //
  26823. // <p>We track these variables separately for the DFA and ATN simulation
  26824. // because the DFA simulation often has to fail over to the ATN
  26825. // simulation. If the ATN simulation fails, we need the DFA to fall
  26826. // back to its previously accepted state, if any. If the ATN succeeds,
  26827. // then the ATN does the accept and the DFA simulator that invoked it
  26828. // can simply return the predicted token type.</p>
  26829. ///
  26830. var Token = __webpack_require__(/*! ./../Token */ "./node_modules/antlr4/Token.js").Token;
  26831. var Lexer = __webpack_require__(/*! ./../Lexer */ "./node_modules/antlr4/Lexer.js").Lexer;
  26832. var ATN = __webpack_require__(/*! ./ATN */ "./node_modules/antlr4/atn/ATN.js").ATN;
  26833. var ATNSimulator = __webpack_require__(/*! ./ATNSimulator */ "./node_modules/antlr4/atn/ATNSimulator.js").ATNSimulator;
  26834. var DFAState = __webpack_require__(/*! ./../dfa/DFAState */ "./node_modules/antlr4/dfa/DFAState.js").DFAState;
  26835. var ATNConfigSet = __webpack_require__(/*! ./ATNConfigSet */ "./node_modules/antlr4/atn/ATNConfigSet.js").ATNConfigSet;
  26836. var OrderedATNConfigSet = __webpack_require__(/*! ./ATNConfigSet */ "./node_modules/antlr4/atn/ATNConfigSet.js").OrderedATNConfigSet;
  26837. var PredictionContext = __webpack_require__(/*! ./../PredictionContext */ "./node_modules/antlr4/PredictionContext.js").PredictionContext;
  26838. var SingletonPredictionContext = __webpack_require__(/*! ./../PredictionContext */ "./node_modules/antlr4/PredictionContext.js").SingletonPredictionContext;
  26839. var RuleStopState = __webpack_require__(/*! ./ATNState */ "./node_modules/antlr4/atn/ATNState.js").RuleStopState;
  26840. var LexerATNConfig = __webpack_require__(/*! ./ATNConfig */ "./node_modules/antlr4/atn/ATNConfig.js").LexerATNConfig;
  26841. var Transition = __webpack_require__(/*! ./Transition */ "./node_modules/antlr4/atn/Transition.js").Transition;
  26842. var LexerActionExecutor = __webpack_require__(/*! ./LexerActionExecutor */ "./node_modules/antlr4/atn/LexerActionExecutor.js").LexerActionExecutor;
  26843. var LexerNoViableAltException = __webpack_require__(/*! ./../error/Errors */ "./node_modules/antlr4/error/Errors.js").LexerNoViableAltException;
  26844. function resetSimState(sim) {
  26845. sim.index = -1;
  26846. sim.line = 0;
  26847. sim.column = -1;
  26848. sim.dfaState = null;
  26849. }
  26850. function SimState() {
  26851. resetSimState(this);
  26852. return this;
  26853. }
  26854. SimState.prototype.reset = function () {
  26855. resetSimState(this);
  26856. };
  26857. function LexerATNSimulator(recog, atn, decisionToDFA, sharedContextCache) {
  26858. ATNSimulator.call(this, atn, sharedContextCache);
  26859. this.decisionToDFA = decisionToDFA;
  26860. this.recog = recog;
  26861. // The current token's starting index into the character stream.
  26862. // Shared across DFA to ATN simulation in case the ATN fails and the
  26863. // DFA did not have a previous accept state. In this case, we use the
  26864. // ATN-generated exception object.
  26865. this.startIndex = -1;
  26866. // line number 1..n within the input///
  26867. this.line = 1;
  26868. // The index of the character relative to the beginning of the line
  26869. // 0..n-1///
  26870. this.column = 0;
  26871. this.mode = Lexer.DEFAULT_MODE;
  26872. // Used during DFA/ATN exec to record the most recent accept configuration
  26873. // info
  26874. this.prevAccept = new SimState();
  26875. // done
  26876. return this;
  26877. }
  26878. LexerATNSimulator.prototype = Object.create(ATNSimulator.prototype);
  26879. LexerATNSimulator.prototype.constructor = LexerATNSimulator;
  26880. LexerATNSimulator.debug = false;
  26881. LexerATNSimulator.dfa_debug = false;
  26882. LexerATNSimulator.MIN_DFA_EDGE = 0;
  26883. LexerATNSimulator.MAX_DFA_EDGE = 127; // forces unicode to stay in ATN
  26884. LexerATNSimulator.match_calls = 0;
  26885. LexerATNSimulator.prototype.copyState = function (simulator) {
  26886. this.column = simulator.column;
  26887. this.line = simulator.line;
  26888. this.mode = simulator.mode;
  26889. this.startIndex = simulator.startIndex;
  26890. };
  26891. LexerATNSimulator.prototype.match = function (input, mode) {
  26892. this.match_calls += 1;
  26893. this.mode = mode;
  26894. var mark = input.mark();
  26895. try {
  26896. this.startIndex = input.index;
  26897. this.prevAccept.reset();
  26898. var dfa = this.decisionToDFA[mode];
  26899. if (dfa.s0 === null) {
  26900. return this.matchATN(input);
  26901. } else {
  26902. return this.execATN(input, dfa.s0);
  26903. }
  26904. } finally {
  26905. input.release(mark);
  26906. }
  26907. };
  26908. LexerATNSimulator.prototype.reset = function () {
  26909. this.prevAccept.reset();
  26910. this.startIndex = -1;
  26911. this.line = 1;
  26912. this.column = 0;
  26913. this.mode = Lexer.DEFAULT_MODE;
  26914. };
  26915. LexerATNSimulator.prototype.matchATN = function (input) {
  26916. var startState = this.atn.modeToStartState[this.mode];
  26917. if (LexerATNSimulator.debug) {
  26918. console.log("matchATN mode " + this.mode + " start: " + startState);
  26919. }
  26920. var old_mode = this.mode;
  26921. var s0_closure = this.computeStartState(input, startState);
  26922. var suppressEdge = s0_closure.hasSemanticContext;
  26923. s0_closure.hasSemanticContext = false;
  26924. var next = this.addDFAState(s0_closure);
  26925. if (!suppressEdge) {
  26926. this.decisionToDFA[this.mode].s0 = next;
  26927. }
  26928. var predict = this.execATN(input, next);
  26929. if (LexerATNSimulator.debug) {
  26930. console.log("DFA after matchATN: " + this.decisionToDFA[old_mode].toLexerString());
  26931. }
  26932. return predict;
  26933. };
  26934. LexerATNSimulator.prototype.execATN = function (input, ds0) {
  26935. if (LexerATNSimulator.debug) {
  26936. console.log("start state closure=" + ds0.configs);
  26937. }
  26938. if (ds0.isAcceptState) {
  26939. // allow zero-length tokens
  26940. this.captureSimState(this.prevAccept, input, ds0);
  26941. }
  26942. var t = input.LA(1);
  26943. var s = ds0; // s is current/from DFA state
  26944. while (true) {
  26945. // while more work
  26946. if (LexerATNSimulator.debug) {
  26947. console.log("execATN loop starting closure: " + s.configs);
  26948. }
  26949. // As we move src->trg, src->trg, we keep track of the previous trg to
  26950. // avoid looking up the DFA state again, which is expensive.
  26951. // If the previous target was already part of the DFA, we might
  26952. // be able to avoid doing a reach operation upon t. If s!=null,
  26953. // it means that semantic predicates didn't prevent us from
  26954. // creating a DFA state. Once we know s!=null, we check to see if
  26955. // the DFA state has an edge already for t. If so, we can just reuse
  26956. // it's configuration set; there's no point in re-computing it.
  26957. // This is kind of like doing DFA simulation within the ATN
  26958. // simulation because DFA simulation is really just a way to avoid
  26959. // computing reach/closure sets. Technically, once we know that
  26960. // we have a previously added DFA state, we could jump over to
  26961. // the DFA simulator. But, that would mean popping back and forth
  26962. // a lot and making things more complicated algorithmically.
  26963. // This optimization makes a lot of sense for loops within DFA.
  26964. // A character will take us back to an existing DFA state
  26965. // that already has lots of edges out of it. e.g., .* in comments.
  26966. // print("Target for:" + str(s) + " and:" + str(t))
  26967. var target = this.getExistingTargetState(s, t);
  26968. // print("Existing:" + str(target))
  26969. if (target === null) {
  26970. target = this.computeTargetState(input, s, t);
  26971. // print("Computed:" + str(target))
  26972. }
  26973. if (target === ATNSimulator.ERROR) {
  26974. break;
  26975. }
  26976. // If this is a consumable input element, make sure to consume before
  26977. // capturing the accept state so the input index, line, and char
  26978. // position accurately reflect the state of the interpreter at the
  26979. // end of the token.
  26980. if (t !== Token.EOF) {
  26981. this.consume(input);
  26982. }
  26983. if (target.isAcceptState) {
  26984. this.captureSimState(this.prevAccept, input, target);
  26985. if (t === Token.EOF) {
  26986. break;
  26987. }
  26988. }
  26989. t = input.LA(1);
  26990. s = target; // flip; current DFA target becomes new src/from state
  26991. }
  26992. return this.failOrAccept(this.prevAccept, input, s.configs, t);
  26993. };
  26994. // Get an existing target state for an edge in the DFA. If the target state
  26995. // for the edge has not yet been computed or is otherwise not available,
  26996. // this method returns {@code null}.
  26997. //
  26998. // @param s The current DFA state
  26999. // @param t The next input symbol
  27000. // @return The existing target DFA state for the given input symbol
  27001. // {@code t}, or {@code null} if the target state for this edge is not
  27002. // already cached
  27003. LexerATNSimulator.prototype.getExistingTargetState = function (s, t) {
  27004. if (s.edges === null || t < LexerATNSimulator.MIN_DFA_EDGE || t > LexerATNSimulator.MAX_DFA_EDGE) {
  27005. return null;
  27006. }
  27007. var target = s.edges[t - LexerATNSimulator.MIN_DFA_EDGE];
  27008. if (target === undefined) {
  27009. target = null;
  27010. }
  27011. if (LexerATNSimulator.debug && target !== null) {
  27012. console.log("reuse state " + s.stateNumber + " edge to " + target.stateNumber);
  27013. }
  27014. return target;
  27015. };
  27016. // Compute a target state for an edge in the DFA, and attempt to add the
  27017. // computed state and corresponding edge to the DFA.
  27018. //
  27019. // @param input The input stream
  27020. // @param s The current DFA state
  27021. // @param t The next input symbol
  27022. //
  27023. // @return The computed target DFA state for the given input symbol
  27024. // {@code t}. If {@code t} does not lead to a valid DFA state, this method
  27025. // returns {@link //ERROR}.
  27026. LexerATNSimulator.prototype.computeTargetState = function (input, s, t) {
  27027. var reach = new OrderedATNConfigSet();
  27028. // if we don't find an existing DFA state
  27029. // Fill reach starting from closure, following t transitions
  27030. this.getReachableConfigSet(input, s.configs, reach, t);
  27031. if (reach.items.length === 0) {
  27032. // we got nowhere on t from s
  27033. if (!reach.hasSemanticContext) {
  27034. // we got nowhere on t, don't throw out this knowledge; it'd
  27035. // cause a failover from DFA later.
  27036. this.addDFAEdge(s, t, ATNSimulator.ERROR);
  27037. }
  27038. // stop when we can't match any more char
  27039. return ATNSimulator.ERROR;
  27040. }
  27041. // Add an edge from s to target DFA found/created for reach
  27042. return this.addDFAEdge(s, t, null, reach);
  27043. };
  27044. LexerATNSimulator.prototype.failOrAccept = function (prevAccept, input, reach, t) {
  27045. if (this.prevAccept.dfaState !== null) {
  27046. var lexerActionExecutor = prevAccept.dfaState.lexerActionExecutor;
  27047. this.accept(input, lexerActionExecutor, this.startIndex, prevAccept.index, prevAccept.line, prevAccept.column);
  27048. return prevAccept.dfaState.prediction;
  27049. } else {
  27050. // if no accept and EOF is first char, return EOF
  27051. if (t === Token.EOF && input.index === this.startIndex) {
  27052. return Token.EOF;
  27053. }
  27054. throw new LexerNoViableAltException(this.recog, input, this.startIndex, reach);
  27055. }
  27056. };
  27057. // Given a starting configuration set, figure out all ATN configurations
  27058. // we can reach upon input {@code t}. Parameter {@code reach} is a return
  27059. // parameter.
  27060. LexerATNSimulator.prototype.getReachableConfigSet = function (input, closure, reach, t) {
  27061. // this is used to skip processing for configs which have a lower priority
  27062. // than a config that already reached an accept state for the same rule
  27063. var skipAlt = ATN.INVALID_ALT_NUMBER;
  27064. for (var i = 0; i < closure.items.length; i++) {
  27065. var cfg = closure.items[i];
  27066. var currentAltReachedAcceptState = cfg.alt === skipAlt;
  27067. if (currentAltReachedAcceptState && cfg.passedThroughNonGreedyDecision) {
  27068. continue;
  27069. }
  27070. if (LexerATNSimulator.debug) {
  27071. console.log("testing %s at %s\n", this.getTokenName(t), cfg.toString(this.recog, true));
  27072. }
  27073. for (var j = 0; j < cfg.state.transitions.length; j++) {
  27074. var trans = cfg.state.transitions[j]; // for each transition
  27075. var target = this.getReachableTarget(trans, t);
  27076. if (target !== null) {
  27077. var lexerActionExecutor = cfg.lexerActionExecutor;
  27078. if (lexerActionExecutor !== null) {
  27079. lexerActionExecutor = lexerActionExecutor.fixOffsetBeforeMatch(input.index - this.startIndex);
  27080. }
  27081. var treatEofAsEpsilon = t === Token.EOF;
  27082. var config = new LexerATNConfig({ state: target, lexerActionExecutor: lexerActionExecutor }, cfg);
  27083. if (this.closure(input, config, reach, currentAltReachedAcceptState, true, treatEofAsEpsilon)) {
  27084. // any remaining configs for this alt have a lower priority
  27085. // than the one that just reached an accept state.
  27086. skipAlt = cfg.alt;
  27087. }
  27088. }
  27089. }
  27090. }
  27091. };
  27092. LexerATNSimulator.prototype.accept = function (input, lexerActionExecutor, startIndex, index, line, charPos) {
  27093. if (LexerATNSimulator.debug) {
  27094. console.log("ACTION %s\n", lexerActionExecutor);
  27095. }
  27096. // seek to after last char in token
  27097. input.seek(index);
  27098. this.line = line;
  27099. this.column = charPos;
  27100. if (lexerActionExecutor !== null && this.recog !== null) {
  27101. lexerActionExecutor.execute(this.recog, input, startIndex);
  27102. }
  27103. };
  27104. LexerATNSimulator.prototype.getReachableTarget = function (trans, t) {
  27105. if (trans.matches(t, 0, Lexer.MAX_CHAR_VALUE)) {
  27106. return trans.target;
  27107. } else {
  27108. return null;
  27109. }
  27110. };
  27111. LexerATNSimulator.prototype.computeStartState = function (input, p) {
  27112. var initialContext = PredictionContext.EMPTY;
  27113. var configs = new OrderedATNConfigSet();
  27114. for (var i = 0; i < p.transitions.length; i++) {
  27115. var target = p.transitions[i].target;
  27116. var cfg = new LexerATNConfig({ state: target, alt: i + 1, context: initialContext }, null);
  27117. this.closure(input, cfg, configs, false, false, false);
  27118. }
  27119. return configs;
  27120. };
  27121. // Since the alternatives within any lexer decision are ordered by
  27122. // preference, this method stops pursuing the closure as soon as an accept
  27123. // state is reached. After the first accept state is reached by depth-first
  27124. // search from {@code config}, all other (potentially reachable) states for
  27125. // this rule would have a lower priority.
  27126. //
  27127. // @return {@code true} if an accept state is reached, otherwise
  27128. // {@code false}.
  27129. LexerATNSimulator.prototype.closure = function (input, config, configs, currentAltReachedAcceptState, speculative, treatEofAsEpsilon) {
  27130. var cfg = null;
  27131. if (LexerATNSimulator.debug) {
  27132. console.log("closure(" + config.toString(this.recog, true) + ")");
  27133. }
  27134. if (config.state instanceof RuleStopState) {
  27135. if (LexerATNSimulator.debug) {
  27136. if (this.recog !== null) {
  27137. console.log("closure at %s rule stop %s\n", this.recog.ruleNames[config.state.ruleIndex], config);
  27138. } else {
  27139. console.log("closure at rule stop %s\n", config);
  27140. }
  27141. }
  27142. if (config.context === null || config.context.hasEmptyPath()) {
  27143. if (config.context === null || config.context.isEmpty()) {
  27144. configs.add(config);
  27145. return true;
  27146. } else {
  27147. configs.add(new LexerATNConfig({ state: config.state, context: PredictionContext.EMPTY }, config));
  27148. currentAltReachedAcceptState = true;
  27149. }
  27150. }
  27151. if (config.context !== null && !config.context.isEmpty()) {
  27152. for (var i = 0; i < config.context.length; i++) {
  27153. if (config.context.getReturnState(i) !== PredictionContext.EMPTY_RETURN_STATE) {
  27154. var newContext = config.context.getParent(i); // "pop" return state
  27155. var returnState = this.atn.states[config.context.getReturnState(i)];
  27156. cfg = new LexerATNConfig({ state: returnState, context: newContext }, config);
  27157. currentAltReachedAcceptState = this.closure(input, cfg, configs, currentAltReachedAcceptState, speculative, treatEofAsEpsilon);
  27158. }
  27159. }
  27160. }
  27161. return currentAltReachedAcceptState;
  27162. }
  27163. // optimization
  27164. if (!config.state.epsilonOnlyTransitions) {
  27165. if (!currentAltReachedAcceptState || !config.passedThroughNonGreedyDecision) {
  27166. configs.add(config);
  27167. }
  27168. }
  27169. for (var j = 0; j < config.state.transitions.length; j++) {
  27170. var trans = config.state.transitions[j];
  27171. cfg = this.getEpsilonTarget(input, config, trans, configs, speculative, treatEofAsEpsilon);
  27172. if (cfg !== null) {
  27173. currentAltReachedAcceptState = this.closure(input, cfg, configs, currentAltReachedAcceptState, speculative, treatEofAsEpsilon);
  27174. }
  27175. }
  27176. return currentAltReachedAcceptState;
  27177. };
  27178. // side-effect: can alter configs.hasSemanticContext
  27179. LexerATNSimulator.prototype.getEpsilonTarget = function (input, config, trans, configs, speculative, treatEofAsEpsilon) {
  27180. var cfg = null;
  27181. if (trans.serializationType === Transition.RULE) {
  27182. var newContext = SingletonPredictionContext.create(config.context, trans.followState.stateNumber);
  27183. cfg = new LexerATNConfig({ state: trans.target, context: newContext }, config);
  27184. } else if (trans.serializationType === Transition.PRECEDENCE) {
  27185. throw "Precedence predicates are not supported in lexers.";
  27186. } else if (trans.serializationType === Transition.PREDICATE) {
  27187. // Track traversing semantic predicates. If we traverse,
  27188. // we cannot add a DFA state for this "reach" computation
  27189. // because the DFA would not test the predicate again in the
  27190. // future. Rather than creating collections of semantic predicates
  27191. // like v3 and testing them on prediction, v4 will test them on the
  27192. // fly all the time using the ATN not the DFA. This is slower but
  27193. // semantically it's not used that often. One of the key elements to
  27194. // this predicate mechanism is not adding DFA states that see
  27195. // predicates immediately afterwards in the ATN. For example,
  27196. // a : ID {p1}? | ID {p2}? ;
  27197. // should create the start state for rule 'a' (to save start state
  27198. // competition), but should not create target of ID state. The
  27199. // collection of ATN states the following ID references includes
  27200. // states reached by traversing predicates. Since this is when we
  27201. // test them, we cannot cash the DFA state target of ID.
  27202. if (LexerATNSimulator.debug) {
  27203. console.log("EVAL rule " + trans.ruleIndex + ":" + trans.predIndex);
  27204. }
  27205. configs.hasSemanticContext = true;
  27206. if (this.evaluatePredicate(input, trans.ruleIndex, trans.predIndex, speculative)) {
  27207. cfg = new LexerATNConfig({ state: trans.target }, config);
  27208. }
  27209. } else if (trans.serializationType === Transition.ACTION) {
  27210. if (config.context === null || config.context.hasEmptyPath()) {
  27211. // execute actions anywhere in the start rule for a token.
  27212. //
  27213. // TODO: if the entry rule is invoked recursively, some
  27214. // actions may be executed during the recursive call. The
  27215. // problem can appear when hasEmptyPath() is true but
  27216. // isEmpty() is false. In this case, the config needs to be
  27217. // split into two contexts - one with just the empty path
  27218. // and another with everything but the empty path.
  27219. // Unfortunately, the current algorithm does not allow
  27220. // getEpsilonTarget to return two configurations, so
  27221. // additional modifications are needed before we can support
  27222. // the split operation.
  27223. var lexerActionExecutor = LexerActionExecutor.append(config.lexerActionExecutor, this.atn.lexerActions[trans.actionIndex]);
  27224. cfg = new LexerATNConfig({ state: trans.target, lexerActionExecutor: lexerActionExecutor }, config);
  27225. } else {
  27226. // ignore actions in referenced rules
  27227. cfg = new LexerATNConfig({ state: trans.target }, config);
  27228. }
  27229. } else if (trans.serializationType === Transition.EPSILON) {
  27230. cfg = new LexerATNConfig({ state: trans.target }, config);
  27231. } else if (trans.serializationType === Transition.ATOM || trans.serializationType === Transition.RANGE || trans.serializationType === Transition.SET) {
  27232. if (treatEofAsEpsilon) {
  27233. if (trans.matches(Token.EOF, 0, Lexer.MAX_CHAR_VALUE)) {
  27234. cfg = new LexerATNConfig({ state: trans.target }, config);
  27235. }
  27236. }
  27237. }
  27238. return cfg;
  27239. };
  27240. // Evaluate a predicate specified in the lexer.
  27241. //
  27242. // <p>If {@code speculative} is {@code true}, this method was called before
  27243. // {@link //consume} for the matched character. This method should call
  27244. // {@link //consume} before evaluating the predicate to ensure position
  27245. // sensitive values, including {@link Lexer//getText}, {@link Lexer//getLine},
  27246. // and {@link Lexer//getcolumn}, properly reflect the current
  27247. // lexer state. This method should restore {@code input} and the simulator
  27248. // to the original state before returning (i.e. undo the actions made by the
  27249. // call to {@link //consume}.</p>
  27250. //
  27251. // @param input The input stream.
  27252. // @param ruleIndex The rule containing the predicate.
  27253. // @param predIndex The index of the predicate within the rule.
  27254. // @param speculative {@code true} if the current index in {@code input} is
  27255. // one character before the predicate's location.
  27256. //
  27257. // @return {@code true} if the specified predicate evaluates to
  27258. // {@code true}.
  27259. // /
  27260. LexerATNSimulator.prototype.evaluatePredicate = function (input, ruleIndex, predIndex, speculative) {
  27261. // assume true if no recognizer was provided
  27262. if (this.recog === null) {
  27263. return true;
  27264. }
  27265. if (!speculative) {
  27266. return this.recog.sempred(null, ruleIndex, predIndex);
  27267. }
  27268. var savedcolumn = this.column;
  27269. var savedLine = this.line;
  27270. var index = input.index;
  27271. var marker = input.mark();
  27272. try {
  27273. this.consume(input);
  27274. return this.recog.sempred(null, ruleIndex, predIndex);
  27275. } finally {
  27276. this.column = savedcolumn;
  27277. this.line = savedLine;
  27278. input.seek(index);
  27279. input.release(marker);
  27280. }
  27281. };
  27282. LexerATNSimulator.prototype.captureSimState = function (settings, input, dfaState) {
  27283. settings.index = input.index;
  27284. settings.line = this.line;
  27285. settings.column = this.column;
  27286. settings.dfaState = dfaState;
  27287. };
  27288. LexerATNSimulator.prototype.addDFAEdge = function (from_, tk, to, cfgs) {
  27289. if (to === undefined) {
  27290. to = null;
  27291. }
  27292. if (cfgs === undefined) {
  27293. cfgs = null;
  27294. }
  27295. if (to === null && cfgs !== null) {
  27296. // leading to this call, ATNConfigSet.hasSemanticContext is used as a
  27297. // marker indicating dynamic predicate evaluation makes this edge
  27298. // dependent on the specific input sequence, so the static edge in the
  27299. // DFA should be omitted. The target DFAState is still created since
  27300. // execATN has the ability to resynchronize with the DFA state cache
  27301. // following the predicate evaluation step.
  27302. //
  27303. // TJP notes: next time through the DFA, we see a pred again and eval.
  27304. // If that gets us to a previously created (but dangling) DFA
  27305. // state, we can continue in pure DFA mode from there.
  27306. // /
  27307. var suppressEdge = cfgs.hasSemanticContext;
  27308. cfgs.hasSemanticContext = false;
  27309. to = this.addDFAState(cfgs);
  27310. if (suppressEdge) {
  27311. return to;
  27312. }
  27313. }
  27314. // add the edge
  27315. if (tk < LexerATNSimulator.MIN_DFA_EDGE || tk > LexerATNSimulator.MAX_DFA_EDGE) {
  27316. // Only track edges within the DFA bounds
  27317. return to;
  27318. }
  27319. if (LexerATNSimulator.debug) {
  27320. console.log("EDGE " + from_ + " -> " + to + " upon " + tk);
  27321. }
  27322. if (from_.edges === null) {
  27323. // make room for tokens 1..n and -1 masquerading as index 0
  27324. from_.edges = [];
  27325. }
  27326. from_.edges[tk - LexerATNSimulator.MIN_DFA_EDGE] = to; // connect
  27327. return to;
  27328. };
  27329. // Add a new DFA state if there isn't one with this set of
  27330. // configurations already. This method also detects the first
  27331. // configuration containing an ATN rule stop state. Later, when
  27332. // traversing the DFA, we will know which rule to accept.
  27333. LexerATNSimulator.prototype.addDFAState = function (configs) {
  27334. var proposed = new DFAState(null, configs);
  27335. var firstConfigWithRuleStopState = null;
  27336. for (var i = 0; i < configs.items.length; i++) {
  27337. var cfg = configs.items[i];
  27338. if (cfg.state instanceof RuleStopState) {
  27339. firstConfigWithRuleStopState = cfg;
  27340. break;
  27341. }
  27342. }
  27343. if (firstConfigWithRuleStopState !== null) {
  27344. proposed.isAcceptState = true;
  27345. proposed.lexerActionExecutor = firstConfigWithRuleStopState.lexerActionExecutor;
  27346. proposed.prediction = this.atn.ruleToTokenType[firstConfigWithRuleStopState.state.ruleIndex];
  27347. }
  27348. var dfa = this.decisionToDFA[this.mode];
  27349. var existing = dfa.states.get(proposed);
  27350. if (existing !== null) {
  27351. return existing;
  27352. }
  27353. var newState = proposed;
  27354. newState.stateNumber = dfa.states.length;
  27355. configs.setReadonly(true);
  27356. newState.configs = configs;
  27357. dfa.states.add(newState);
  27358. return newState;
  27359. };
  27360. LexerATNSimulator.prototype.getDFA = function (mode) {
  27361. return this.decisionToDFA[mode];
  27362. };
  27363. // Get the text matched so far for the current token.
  27364. LexerATNSimulator.prototype.getText = function (input) {
  27365. // index is first lookahead char, don't include.
  27366. return input.getText(this.startIndex, input.index - 1);
  27367. };
  27368. LexerATNSimulator.prototype.consume = function (input) {
  27369. var curChar = input.LA(1);
  27370. if (curChar === "\n".charCodeAt(0)) {
  27371. this.line += 1;
  27372. this.column = 0;
  27373. } else {
  27374. this.column += 1;
  27375. }
  27376. input.consume();
  27377. };
  27378. LexerATNSimulator.prototype.getTokenName = function (tt) {
  27379. if (tt === -1) {
  27380. return "EOF";
  27381. } else {
  27382. return "'" + String.fromCharCode(tt) + "'";
  27383. }
  27384. };
  27385. exports.LexerATNSimulator = LexerATNSimulator;
  27386. /***/ }),
  27387. /***/ "./node_modules/antlr4/atn/LexerAction.js":
  27388. /*!************************************************!*\
  27389. !*** ./node_modules/antlr4/atn/LexerAction.js ***!
  27390. \************************************************/
  27391. /*! no static exports found */
  27392. /***/ (function(module, exports, __webpack_require__) {
  27393. "use strict";
  27394. //
  27395. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  27396. * Use of this file is governed by the BSD 3-clause license that
  27397. * can be found in the LICENSE.txt file in the project root.
  27398. */
  27399. //
  27400. function LexerActionType() {}
  27401. LexerActionType.CHANNEL = 0; //The type of a {@link LexerChannelAction} action.
  27402. LexerActionType.CUSTOM = 1; //The type of a {@link LexerCustomAction} action.
  27403. LexerActionType.MODE = 2; //The type of a {@link LexerModeAction} action.
  27404. LexerActionType.MORE = 3; //The type of a {@link LexerMoreAction} action.
  27405. LexerActionType.POP_MODE = 4; //The type of a {@link LexerPopModeAction} action.
  27406. LexerActionType.PUSH_MODE = 5; //The type of a {@link LexerPushModeAction} action.
  27407. LexerActionType.SKIP = 6; //The type of a {@link LexerSkipAction} action.
  27408. LexerActionType.TYPE = 7; //The type of a {@link LexerTypeAction} action.
  27409. function LexerAction(action) {
  27410. this.actionType = action;
  27411. this.isPositionDependent = false;
  27412. return this;
  27413. }
  27414. LexerAction.prototype.hashCode = function () {
  27415. var hash = new Hash();
  27416. this.updateHashCode(hash);
  27417. return hash.finish();
  27418. };
  27419. LexerAction.prototype.updateHashCode = function (hash) {
  27420. hash.update(this.actionType);
  27421. };
  27422. LexerAction.prototype.equals = function (other) {
  27423. return this === other;
  27424. };
  27425. //
  27426. // Implements the {@code skip} lexer action by calling {@link Lexer//skip}.
  27427. //
  27428. // <p>The {@code skip} command does not have any parameters, so this action is
  27429. // implemented as a singleton instance exposed by {@link //INSTANCE}.</p>
  27430. function LexerSkipAction() {
  27431. LexerAction.call(this, LexerActionType.SKIP);
  27432. return this;
  27433. }
  27434. LexerSkipAction.prototype = Object.create(LexerAction.prototype);
  27435. LexerSkipAction.prototype.constructor = LexerSkipAction;
  27436. // Provides a singleton instance of this parameterless lexer action.
  27437. LexerSkipAction.INSTANCE = new LexerSkipAction();
  27438. LexerSkipAction.prototype.execute = function (lexer) {
  27439. lexer.skip();
  27440. };
  27441. LexerSkipAction.prototype.toString = function () {
  27442. return "skip";
  27443. };
  27444. // Implements the {@code type} lexer action by calling {@link Lexer//setType}
  27445. // with the assigned type.
  27446. function LexerTypeAction(type) {
  27447. LexerAction.call(this, LexerActionType.TYPE);
  27448. this.type = type;
  27449. return this;
  27450. }
  27451. LexerTypeAction.prototype = Object.create(LexerAction.prototype);
  27452. LexerTypeAction.prototype.constructor = LexerTypeAction;
  27453. LexerTypeAction.prototype.execute = function (lexer) {
  27454. lexer.type = this.type;
  27455. };
  27456. LexerTypeAction.prototype.updateHashCode = function (hash) {
  27457. hash.update(this.actionType, this.type);
  27458. };
  27459. LexerTypeAction.prototype.equals = function (other) {
  27460. if (this === other) {
  27461. return true;
  27462. } else if (!(other instanceof LexerTypeAction)) {
  27463. return false;
  27464. } else {
  27465. return this.type === other.type;
  27466. }
  27467. };
  27468. LexerTypeAction.prototype.toString = function () {
  27469. return "type(" + this.type + ")";
  27470. };
  27471. // Implements the {@code pushMode} lexer action by calling
  27472. // {@link Lexer//pushMode} with the assigned mode.
  27473. function LexerPushModeAction(mode) {
  27474. LexerAction.call(this, LexerActionType.PUSH_MODE);
  27475. this.mode = mode;
  27476. return this;
  27477. }
  27478. LexerPushModeAction.prototype = Object.create(LexerAction.prototype);
  27479. LexerPushModeAction.prototype.constructor = LexerPushModeAction;
  27480. // <p>This action is implemented by calling {@link Lexer//pushMode} with the
  27481. // value provided by {@link //getMode}.</p>
  27482. LexerPushModeAction.prototype.execute = function (lexer) {
  27483. lexer.pushMode(this.mode);
  27484. };
  27485. LexerPushModeAction.prototype.updateHashCode = function (hash) {
  27486. hash.update(this.actionType, this.mode);
  27487. };
  27488. LexerPushModeAction.prototype.equals = function (other) {
  27489. if (this === other) {
  27490. return true;
  27491. } else if (!(other instanceof LexerPushModeAction)) {
  27492. return false;
  27493. } else {
  27494. return this.mode === other.mode;
  27495. }
  27496. };
  27497. LexerPushModeAction.prototype.toString = function () {
  27498. return "pushMode(" + this.mode + ")";
  27499. };
  27500. // Implements the {@code popMode} lexer action by calling {@link Lexer//popMode}.
  27501. //
  27502. // <p>The {@code popMode} command does not have any parameters, so this action is
  27503. // implemented as a singleton instance exposed by {@link //INSTANCE}.</p>
  27504. function LexerPopModeAction() {
  27505. LexerAction.call(this, LexerActionType.POP_MODE);
  27506. return this;
  27507. }
  27508. LexerPopModeAction.prototype = Object.create(LexerAction.prototype);
  27509. LexerPopModeAction.prototype.constructor = LexerPopModeAction;
  27510. LexerPopModeAction.INSTANCE = new LexerPopModeAction();
  27511. // <p>This action is implemented by calling {@link Lexer//popMode}.</p>
  27512. LexerPopModeAction.prototype.execute = function (lexer) {
  27513. lexer.popMode();
  27514. };
  27515. LexerPopModeAction.prototype.toString = function () {
  27516. return "popMode";
  27517. };
  27518. // Implements the {@code more} lexer action by calling {@link Lexer//more}.
  27519. //
  27520. // <p>The {@code more} command does not have any parameters, so this action is
  27521. // implemented as a singleton instance exposed by {@link //INSTANCE}.</p>
  27522. function LexerMoreAction() {
  27523. LexerAction.call(this, LexerActionType.MORE);
  27524. return this;
  27525. }
  27526. LexerMoreAction.prototype = Object.create(LexerAction.prototype);
  27527. LexerMoreAction.prototype.constructor = LexerMoreAction;
  27528. LexerMoreAction.INSTANCE = new LexerMoreAction();
  27529. // <p>This action is implemented by calling {@link Lexer//popMode}.</p>
  27530. LexerMoreAction.prototype.execute = function (lexer) {
  27531. lexer.more();
  27532. };
  27533. LexerMoreAction.prototype.toString = function () {
  27534. return "more";
  27535. };
  27536. // Implements the {@code mode} lexer action by calling {@link Lexer//mode} with
  27537. // the assigned mode.
  27538. function LexerModeAction(mode) {
  27539. LexerAction.call(this, LexerActionType.MODE);
  27540. this.mode = mode;
  27541. return this;
  27542. }
  27543. LexerModeAction.prototype = Object.create(LexerAction.prototype);
  27544. LexerModeAction.prototype.constructor = LexerModeAction;
  27545. // <p>This action is implemented by calling {@link Lexer//mode} with the
  27546. // value provided by {@link //getMode}.</p>
  27547. LexerModeAction.prototype.execute = function (lexer) {
  27548. lexer.mode(this.mode);
  27549. };
  27550. LexerModeAction.prototype.updateHashCode = function (hash) {
  27551. hash.update(this.actionType, this.mode);
  27552. };
  27553. LexerModeAction.prototype.equals = function (other) {
  27554. if (this === other) {
  27555. return true;
  27556. } else if (!(other instanceof LexerModeAction)) {
  27557. return false;
  27558. } else {
  27559. return this.mode === other.mode;
  27560. }
  27561. };
  27562. LexerModeAction.prototype.toString = function () {
  27563. return "mode(" + this.mode + ")";
  27564. };
  27565. // Executes a custom lexer action by calling {@link Recognizer//action} with the
  27566. // rule and action indexes assigned to the custom action. The implementation of
  27567. // a custom action is added to the generated code for the lexer in an override
  27568. // of {@link Recognizer//action} when the grammar is compiled.
  27569. //
  27570. // <p>This class may represent embedded actions created with the <code>{...}</code>
  27571. // syntax in ANTLR 4, as well as actions created for lexer commands where the
  27572. // command argument could not be evaluated when the grammar was compiled.</p>
  27573. // Constructs a custom lexer action with the specified rule and action
  27574. // indexes.
  27575. //
  27576. // @param ruleIndex The rule index to use for calls to
  27577. // {@link Recognizer//action}.
  27578. // @param actionIndex The action index to use for calls to
  27579. // {@link Recognizer//action}.
  27580. function LexerCustomAction(ruleIndex, actionIndex) {
  27581. LexerAction.call(this, LexerActionType.CUSTOM);
  27582. this.ruleIndex = ruleIndex;
  27583. this.actionIndex = actionIndex;
  27584. this.isPositionDependent = true;
  27585. return this;
  27586. }
  27587. LexerCustomAction.prototype = Object.create(LexerAction.prototype);
  27588. LexerCustomAction.prototype.constructor = LexerCustomAction;
  27589. // <p>Custom actions are implemented by calling {@link Lexer//action} with the
  27590. // appropriate rule and action indexes.</p>
  27591. LexerCustomAction.prototype.execute = function (lexer) {
  27592. lexer.action(null, this.ruleIndex, this.actionIndex);
  27593. };
  27594. LexerCustomAction.prototype.updateHashCode = function (hash) {
  27595. hash.update(this.actionType, this.ruleIndex, this.actionIndex);
  27596. };
  27597. LexerCustomAction.prototype.equals = function (other) {
  27598. if (this === other) {
  27599. return true;
  27600. } else if (!(other instanceof LexerCustomAction)) {
  27601. return false;
  27602. } else {
  27603. return this.ruleIndex === other.ruleIndex && this.actionIndex === other.actionIndex;
  27604. }
  27605. };
  27606. // Implements the {@code channel} lexer action by calling
  27607. // {@link Lexer//setChannel} with the assigned channel.
  27608. // Constructs a new {@code channel} action with the specified channel value.
  27609. // @param channel The channel value to pass to {@link Lexer//setChannel}.
  27610. function LexerChannelAction(channel) {
  27611. LexerAction.call(this, LexerActionType.CHANNEL);
  27612. this.channel = channel;
  27613. return this;
  27614. }
  27615. LexerChannelAction.prototype = Object.create(LexerAction.prototype);
  27616. LexerChannelAction.prototype.constructor = LexerChannelAction;
  27617. // <p>This action is implemented by calling {@link Lexer//setChannel} with the
  27618. // value provided by {@link //getChannel}.</p>
  27619. LexerChannelAction.prototype.execute = function (lexer) {
  27620. lexer._channel = this.channel;
  27621. };
  27622. LexerChannelAction.prototype.updateHashCode = function (hash) {
  27623. hash.update(this.actionType, this.channel);
  27624. };
  27625. LexerChannelAction.prototype.equals = function (other) {
  27626. if (this === other) {
  27627. return true;
  27628. } else if (!(other instanceof LexerChannelAction)) {
  27629. return false;
  27630. } else {
  27631. return this.channel === other.channel;
  27632. }
  27633. };
  27634. LexerChannelAction.prototype.toString = function () {
  27635. return "channel(" + this.channel + ")";
  27636. };
  27637. // This implementation of {@link LexerAction} is used for tracking input offsets
  27638. // for position-dependent actions within a {@link LexerActionExecutor}.
  27639. //
  27640. // <p>This action is not serialized as part of the ATN, and is only required for
  27641. // position-dependent lexer actions which appear at a location other than the
  27642. // end of a rule. For more information about DFA optimizations employed for
  27643. // lexer actions, see {@link LexerActionExecutor//append} and
  27644. // {@link LexerActionExecutor//fixOffsetBeforeMatch}.</p>
  27645. // Constructs a new indexed custom action by associating a character offset
  27646. // with a {@link LexerAction}.
  27647. //
  27648. // <p>Note: This class is only required for lexer actions for which
  27649. // {@link LexerAction//isPositionDependent} returns {@code true}.</p>
  27650. //
  27651. // @param offset The offset into the input {@link CharStream}, relative to
  27652. // the token start index, at which the specified lexer action should be
  27653. // executed.
  27654. // @param action The lexer action to execute at a particular offset in the
  27655. // input {@link CharStream}.
  27656. function LexerIndexedCustomAction(offset, action) {
  27657. LexerAction.call(this, action.actionType);
  27658. this.offset = offset;
  27659. this.action = action;
  27660. this.isPositionDependent = true;
  27661. return this;
  27662. }
  27663. LexerIndexedCustomAction.prototype = Object.create(LexerAction.prototype);
  27664. LexerIndexedCustomAction.prototype.constructor = LexerIndexedCustomAction;
  27665. // <p>This method calls {@link //execute} on the result of {@link //getAction}
  27666. // using the provided {@code lexer}.</p>
  27667. LexerIndexedCustomAction.prototype.execute = function (lexer) {
  27668. // assume the input stream position was properly set by the calling code
  27669. this.action.execute(lexer);
  27670. };
  27671. LexerIndexedCustomAction.prototype.updateHashCode = function (hash) {
  27672. hash.update(this.actionType, this.offset, this.action);
  27673. };
  27674. LexerIndexedCustomAction.prototype.equals = function (other) {
  27675. if (this === other) {
  27676. return true;
  27677. } else if (!(other instanceof LexerIndexedCustomAction)) {
  27678. return false;
  27679. } else {
  27680. return this.offset === other.offset && this.action === other.action;
  27681. }
  27682. };
  27683. exports.LexerActionType = LexerActionType;
  27684. exports.LexerSkipAction = LexerSkipAction;
  27685. exports.LexerChannelAction = LexerChannelAction;
  27686. exports.LexerCustomAction = LexerCustomAction;
  27687. exports.LexerIndexedCustomAction = LexerIndexedCustomAction;
  27688. exports.LexerMoreAction = LexerMoreAction;
  27689. exports.LexerTypeAction = LexerTypeAction;
  27690. exports.LexerPushModeAction = LexerPushModeAction;
  27691. exports.LexerPopModeAction = LexerPopModeAction;
  27692. exports.LexerModeAction = LexerModeAction;
  27693. /***/ }),
  27694. /***/ "./node_modules/antlr4/atn/LexerActionExecutor.js":
  27695. /*!********************************************************!*\
  27696. !*** ./node_modules/antlr4/atn/LexerActionExecutor.js ***!
  27697. \********************************************************/
  27698. /*! no static exports found */
  27699. /***/ (function(module, exports, __webpack_require__) {
  27700. "use strict";
  27701. //
  27702. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  27703. * Use of this file is governed by the BSD 3-clause license that
  27704. * can be found in the LICENSE.txt file in the project root.
  27705. */
  27706. ///
  27707. // Represents an executor for a sequence of lexer actions which traversed during
  27708. // the matching operation of a lexer rule (token).
  27709. //
  27710. // <p>The executor tracks position information for position-dependent lexer actions
  27711. // efficiently, ensuring that actions appearing only at the end of the rule do
  27712. // not cause bloating of the {@link DFA} created for the lexer.</p>
  27713. var hashStuff = __webpack_require__(/*! ../Utils */ "./node_modules/antlr4/Utils.js").hashStuff;
  27714. var LexerIndexedCustomAction = __webpack_require__(/*! ./LexerAction */ "./node_modules/antlr4/atn/LexerAction.js").LexerIndexedCustomAction;
  27715. function LexerActionExecutor(lexerActions) {
  27716. this.lexerActions = lexerActions === null ? [] : lexerActions;
  27717. // Caches the result of {@link //hashCode} since the hash code is an element
  27718. // of the performance-critical {@link LexerATNConfig//hashCode} operation.
  27719. this.cachedHashCode = hashStuff(lexerActions); // "".join([str(la) for la in
  27720. // lexerActions]))
  27721. return this;
  27722. }
  27723. // Creates a {@link LexerActionExecutor} which executes the actions for
  27724. // the input {@code lexerActionExecutor} followed by a specified
  27725. // {@code lexerAction}.
  27726. //
  27727. // @param lexerActionExecutor The executor for actions already traversed by
  27728. // the lexer while matching a token within a particular
  27729. // {@link LexerATNConfig}. If this is {@code null}, the method behaves as
  27730. // though it were an empty executor.
  27731. // @param lexerAction The lexer action to execute after the actions
  27732. // specified in {@code lexerActionExecutor}.
  27733. //
  27734. // @return A {@link LexerActionExecutor} for executing the combine actions
  27735. // of {@code lexerActionExecutor} and {@code lexerAction}.
  27736. LexerActionExecutor.append = function (lexerActionExecutor, lexerAction) {
  27737. if (lexerActionExecutor === null) {
  27738. return new LexerActionExecutor([lexerAction]);
  27739. }
  27740. var lexerActions = lexerActionExecutor.lexerActions.concat([lexerAction]);
  27741. return new LexerActionExecutor(lexerActions);
  27742. };
  27743. // Creates a {@link LexerActionExecutor} which encodes the current offset
  27744. // for position-dependent lexer actions.
  27745. //
  27746. // <p>Normally, when the executor encounters lexer actions where
  27747. // {@link LexerAction//isPositionDependent} returns {@code true}, it calls
  27748. // {@link IntStream//seek} on the input {@link CharStream} to set the input
  27749. // position to the <em>end</em> of the current token. This behavior provides
  27750. // for efficient DFA representation of lexer actions which appear at the end
  27751. // of a lexer rule, even when the lexer rule matches a variable number of
  27752. // characters.</p>
  27753. //
  27754. // <p>Prior to traversing a match transition in the ATN, the current offset
  27755. // from the token start index is assigned to all position-dependent lexer
  27756. // actions which have not already been assigned a fixed offset. By storing
  27757. // the offsets relative to the token start index, the DFA representation of
  27758. // lexer actions which appear in the middle of tokens remains efficient due
  27759. // to sharing among tokens of the same length, regardless of their absolute
  27760. // position in the input stream.</p>
  27761. //
  27762. // <p>If the current executor already has offsets assigned to all
  27763. // position-dependent lexer actions, the method returns {@code this}.</p>
  27764. //
  27765. // @param offset The current offset to assign to all position-dependent
  27766. // lexer actions which do not already have offsets assigned.
  27767. //
  27768. // @return A {@link LexerActionExecutor} which stores input stream offsets
  27769. // for all position-dependent lexer actions.
  27770. // /
  27771. LexerActionExecutor.prototype.fixOffsetBeforeMatch = function (offset) {
  27772. var updatedLexerActions = null;
  27773. for (var i = 0; i < this.lexerActions.length; i++) {
  27774. if (this.lexerActions[i].isPositionDependent && !(this.lexerActions[i] instanceof LexerIndexedCustomAction)) {
  27775. if (updatedLexerActions === null) {
  27776. updatedLexerActions = this.lexerActions.concat([]);
  27777. }
  27778. updatedLexerActions[i] = new LexerIndexedCustomAction(offset, this.lexerActions[i]);
  27779. }
  27780. }
  27781. if (updatedLexerActions === null) {
  27782. return this;
  27783. } else {
  27784. return new LexerActionExecutor(updatedLexerActions);
  27785. }
  27786. };
  27787. // Execute the actions encapsulated by this executor within the context of a
  27788. // particular {@link Lexer}.
  27789. //
  27790. // <p>This method calls {@link IntStream//seek} to set the position of the
  27791. // {@code input} {@link CharStream} prior to calling
  27792. // {@link LexerAction//execute} on a position-dependent action. Before the
  27793. // method returns, the input position will be restored to the same position
  27794. // it was in when the method was invoked.</p>
  27795. //
  27796. // @param lexer The lexer instance.
  27797. // @param input The input stream which is the source for the current token.
  27798. // When this method is called, the current {@link IntStream//index} for
  27799. // {@code input} should be the start of the following token, i.e. 1
  27800. // character past the end of the current token.
  27801. // @param startIndex The token start index. This value may be passed to
  27802. // {@link IntStream//seek} to set the {@code input} position to the beginning
  27803. // of the token.
  27804. // /
  27805. LexerActionExecutor.prototype.execute = function (lexer, input, startIndex) {
  27806. var requiresSeek = false;
  27807. var stopIndex = input.index;
  27808. try {
  27809. for (var i = 0; i < this.lexerActions.length; i++) {
  27810. var lexerAction = this.lexerActions[i];
  27811. if (lexerAction instanceof LexerIndexedCustomAction) {
  27812. var offset = lexerAction.offset;
  27813. input.seek(startIndex + offset);
  27814. lexerAction = lexerAction.action;
  27815. requiresSeek = startIndex + offset !== stopIndex;
  27816. } else if (lexerAction.isPositionDependent) {
  27817. input.seek(stopIndex);
  27818. requiresSeek = false;
  27819. }
  27820. lexerAction.execute(lexer);
  27821. }
  27822. } finally {
  27823. if (requiresSeek) {
  27824. input.seek(stopIndex);
  27825. }
  27826. }
  27827. };
  27828. LexerActionExecutor.prototype.hashCode = function () {
  27829. return this.cachedHashCode;
  27830. };
  27831. LexerActionExecutor.prototype.updateHashCode = function (hash) {
  27832. hash.update(this.cachedHashCode);
  27833. };
  27834. LexerActionExecutor.prototype.equals = function (other) {
  27835. if (this === other) {
  27836. return true;
  27837. } else if (!(other instanceof LexerActionExecutor)) {
  27838. return false;
  27839. } else if (this.cachedHashCode != other.cachedHashCode) {
  27840. return false;
  27841. } else if (this.lexerActions.length != other.lexerActions.length) {
  27842. return false;
  27843. } else {
  27844. var numActions = this.lexerActions.length;
  27845. for (var idx = 0; idx < numActions; ++idx) {
  27846. if (!this.lexerActions[idx].equals(other.lexerActions[idx])) {
  27847. return false;
  27848. }
  27849. }
  27850. return true;
  27851. }
  27852. };
  27853. exports.LexerActionExecutor = LexerActionExecutor;
  27854. /***/ }),
  27855. /***/ "./node_modules/antlr4/atn/ParserATNSimulator.js":
  27856. /*!*******************************************************!*\
  27857. !*** ./node_modules/antlr4/atn/ParserATNSimulator.js ***!
  27858. \*******************************************************/
  27859. /*! no static exports found */
  27860. /***/ (function(module, exports, __webpack_require__) {
  27861. "use strict";
  27862. //
  27863. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  27864. * Use of this file is governed by the BSD 3-clause license that
  27865. * can be found in the LICENSE.txt file in the project root.
  27866. */
  27867. //
  27868. //
  27869. // The embodiment of the adaptive LL(*), ALL(*), parsing strategy.
  27870. //
  27871. // <p>
  27872. // The basic complexity of the adaptive strategy makes it harder to understand.
  27873. // We begin with ATN simulation to build paths in a DFA. Subsequent prediction
  27874. // requests go through the DFA first. If they reach a state without an edge for
  27875. // the current symbol, the algorithm fails over to the ATN simulation to
  27876. // complete the DFA path for the current input (until it finds a conflict state
  27877. // or uniquely predicting state).</p>
  27878. //
  27879. // <p>
  27880. // All of that is done without using the outer context because we want to create
  27881. // a DFA that is not dependent upon the rule invocation stack when we do a
  27882. // prediction. One DFA works in all contexts. We avoid using context not
  27883. // necessarily because it's slower, although it can be, but because of the DFA
  27884. // caching problem. The closure routine only considers the rule invocation stack
  27885. // created during prediction beginning in the decision rule. For example, if
  27886. // prediction occurs without invoking another rule's ATN, there are no context
  27887. // stacks in the configurations. When lack of context leads to a conflict, we
  27888. // don't know if it's an ambiguity or a weakness in the strong LL(*) parsing
  27889. // strategy (versus full LL(*)).</p>
  27890. //
  27891. // <p>
  27892. // When SLL yields a configuration set with conflict, we rewind the input and
  27893. // retry the ATN simulation, this time using full outer context without adding
  27894. // to the DFA. Configuration context stacks will be the full invocation stacks
  27895. // from the start rule. If we get a conflict using full context, then we can
  27896. // definitively say we have a true ambiguity for that input sequence. If we
  27897. // don't get a conflict, it implies that the decision is sensitive to the outer
  27898. // context. (It is not context-sensitive in the sense of context-sensitive
  27899. // grammars.)</p>
  27900. //
  27901. // <p>
  27902. // The next time we reach this DFA state with an SLL conflict, through DFA
  27903. // simulation, we will again retry the ATN simulation using full context mode.
  27904. // This is slow because we can't save the results and have to "interpret" the
  27905. // ATN each time we get that input.</p>
  27906. //
  27907. // <p>
  27908. // <strong>CACHING FULL CONTEXT PREDICTIONS</strong></p>
  27909. //
  27910. // <p>
  27911. // We could cache results from full context to predicted alternative easily and
  27912. // that saves a lot of time but doesn't work in presence of predicates. The set
  27913. // of visible predicates from the ATN start state changes depending on the
  27914. // context, because closure can fall off the end of a rule. I tried to cache
  27915. // tuples (stack context, semantic context, predicted alt) but it was slower
  27916. // than interpreting and much more complicated. Also required a huge amount of
  27917. // memory. The goal is not to create the world's fastest parser anyway. I'd like
  27918. // to keep this algorithm simple. By launching multiple threads, we can improve
  27919. // the speed of parsing across a large number of files.</p>
  27920. //
  27921. // <p>
  27922. // There is no strict ordering between the amount of input used by SLL vs LL,
  27923. // which makes it really hard to build a cache for full context. Let's say that
  27924. // we have input A B C that leads to an SLL conflict with full context X. That
  27925. // implies that using X we might only use A B but we could also use A B C D to
  27926. // resolve conflict. Input A B C D could predict alternative 1 in one position
  27927. // in the input and A B C E could predict alternative 2 in another position in
  27928. // input. The conflicting SLL configurations could still be non-unique in the
  27929. // full context prediction, which would lead us to requiring more input than the
  27930. // original A B C. To make a prediction cache work, we have to track the exact
  27931. // input used during the previous prediction. That amounts to a cache that maps
  27932. // X to a specific DFA for that context.</p>
  27933. //
  27934. // <p>
  27935. // Something should be done for left-recursive expression predictions. They are
  27936. // likely LL(1) + pred eval. Easier to do the whole SLL unless error and retry
  27937. // with full LL thing Sam does.</p>
  27938. //
  27939. // <p>
  27940. // <strong>AVOIDING FULL CONTEXT PREDICTION</strong></p>
  27941. //
  27942. // <p>
  27943. // We avoid doing full context retry when the outer context is empty, we did not
  27944. // dip into the outer context by falling off the end of the decision state rule,
  27945. // or when we force SLL mode.</p>
  27946. //
  27947. // <p>
  27948. // As an example of the not dip into outer context case, consider as super
  27949. // constructor calls versus function calls. One grammar might look like
  27950. // this:</p>
  27951. //
  27952. // <pre>
  27953. // ctorBody
  27954. // : '{' superCall? stat* '}'
  27955. // ;
  27956. // </pre>
  27957. //
  27958. // <p>
  27959. // Or, you might see something like</p>
  27960. //
  27961. // <pre>
  27962. // stat
  27963. // : superCall ';'
  27964. // | expression ';'
  27965. // | ...
  27966. // ;
  27967. // </pre>
  27968. //
  27969. // <p>
  27970. // In both cases I believe that no closure operations will dip into the outer
  27971. // context. In the first case ctorBody in the worst case will stop at the '}'.
  27972. // In the 2nd case it should stop at the ';'. Both cases should stay within the
  27973. // entry rule and not dip into the outer context.</p>
  27974. //
  27975. // <p>
  27976. // <strong>PREDICATES</strong></p>
  27977. //
  27978. // <p>
  27979. // Predicates are always evaluated if present in either SLL or LL both. SLL and
  27980. // LL simulation deals with predicates differently. SLL collects predicates as
  27981. // it performs closure operations like ANTLR v3 did. It delays predicate
  27982. // evaluation until it reaches and accept state. This allows us to cache the SLL
  27983. // ATN simulation whereas, if we had evaluated predicates on-the-fly during
  27984. // closure, the DFA state configuration sets would be different and we couldn't
  27985. // build up a suitable DFA.</p>
  27986. //
  27987. // <p>
  27988. // When building a DFA accept state during ATN simulation, we evaluate any
  27989. // predicates and return the sole semantically valid alternative. If there is
  27990. // more than 1 alternative, we report an ambiguity. If there are 0 alternatives,
  27991. // we throw an exception. Alternatives without predicates act like they have
  27992. // true predicates. The simple way to think about it is to strip away all
  27993. // alternatives with false predicates and choose the minimum alternative that
  27994. // remains.</p>
  27995. //
  27996. // <p>
  27997. // When we start in the DFA and reach an accept state that's predicated, we test
  27998. // those and return the minimum semantically viable alternative. If no
  27999. // alternatives are viable, we throw an exception.</p>
  28000. //
  28001. // <p>
  28002. // During full LL ATN simulation, closure always evaluates predicates and
  28003. // on-the-fly. This is crucial to reducing the configuration set size during
  28004. // closure. It hits a landmine when parsing with the Java grammar, for example,
  28005. // without this on-the-fly evaluation.</p>
  28006. //
  28007. // <p>
  28008. // <strong>SHARING DFA</strong></p>
  28009. //
  28010. // <p>
  28011. // All instances of the same parser share the same decision DFAs through a
  28012. // static field. Each instance gets its own ATN simulator but they share the
  28013. // same {@link //decisionToDFA} field. They also share a
  28014. // {@link PredictionContextCache} object that makes sure that all
  28015. // {@link PredictionContext} objects are shared among the DFA states. This makes
  28016. // a big size difference.</p>
  28017. //
  28018. // <p>
  28019. // <strong>THREAD SAFETY</strong></p>
  28020. //
  28021. // <p>
  28022. // The {@link ParserATNSimulator} locks on the {@link //decisionToDFA} field when
  28023. // it adds a new DFA object to that array. {@link //addDFAEdge}
  28024. // locks on the DFA for the current decision when setting the
  28025. // {@link DFAState//edges} field. {@link //addDFAState} locks on
  28026. // the DFA for the current decision when looking up a DFA state to see if it
  28027. // already exists. We must make sure that all requests to add DFA states that
  28028. // are equivalent result in the same shared DFA object. This is because lots of
  28029. // threads will be trying to update the DFA at once. The
  28030. // {@link //addDFAState} method also locks inside the DFA lock
  28031. // but this time on the shared context cache when it rebuilds the
  28032. // configurations' {@link PredictionContext} objects using cached
  28033. // subgraphs/nodes. No other locking occurs, even during DFA simulation. This is
  28034. // safe as long as we can guarantee that all threads referencing
  28035. // {@code s.edge[t]} get the same physical target {@link DFAState}, or
  28036. // {@code null}. Once into the DFA, the DFA simulation does not reference the
  28037. // {@link DFA//states} map. It follows the {@link DFAState//edges} field to new
  28038. // targets. The DFA simulator will either find {@link DFAState//edges} to be
  28039. // {@code null}, to be non-{@code null} and {@code dfa.edges[t]} null, or
  28040. // {@code dfa.edges[t]} to be non-null. The
  28041. // {@link //addDFAEdge} method could be racing to set the field
  28042. // but in either case the DFA simulator works; if {@code null}, and requests ATN
  28043. // simulation. It could also race trying to get {@code dfa.edges[t]}, but either
  28044. // way it will work because it's not doing a test and set operation.</p>
  28045. //
  28046. // <p>
  28047. // <strong>Starting with SLL then failing to combined SLL/LL (Two-Stage
  28048. // Parsing)</strong></p>
  28049. //
  28050. // <p>
  28051. // Sam pointed out that if SLL does not give a syntax error, then there is no
  28052. // point in doing full LL, which is slower. We only have to try LL if we get a
  28053. // syntax error. For maximum speed, Sam starts the parser set to pure SLL
  28054. // mode with the {@link BailErrorStrategy}:</p>
  28055. //
  28056. // <pre>
  28057. // parser.{@link Parser//getInterpreter() getInterpreter()}.{@link //setPredictionMode setPredictionMode}{@code (}{@link PredictionMode//SLL}{@code )};
  28058. // parser.{@link Parser//setErrorHandler setErrorHandler}(new {@link BailErrorStrategy}());
  28059. // </pre>
  28060. //
  28061. // <p>
  28062. // If it does not get a syntax error, then we're done. If it does get a syntax
  28063. // error, we need to retry with the combined SLL/LL strategy.</p>
  28064. //
  28065. // <p>
  28066. // The reason this works is as follows. If there are no SLL conflicts, then the
  28067. // grammar is SLL (at least for that input set). If there is an SLL conflict,
  28068. // the full LL analysis must yield a set of viable alternatives which is a
  28069. // subset of the alternatives reported by SLL. If the LL set is a singleton,
  28070. // then the grammar is LL but not SLL. If the LL set is the same size as the SLL
  28071. // set, the decision is SLL. If the LL set has size &gt; 1, then that decision
  28072. // is truly ambiguous on the current input. If the LL set is smaller, then the
  28073. // SLL conflict resolution might choose an alternative that the full LL would
  28074. // rule out as a possibility based upon better context information. If that's
  28075. // the case, then the SLL parse will definitely get an error because the full LL
  28076. // analysis says it's not viable. If SLL conflict resolution chooses an
  28077. // alternative within the LL set, them both SLL and LL would choose the same
  28078. // alternative because they both choose the minimum of multiple conflicting
  28079. // alternatives.</p>
  28080. //
  28081. // <p>
  28082. // Let's say we have a set of SLL conflicting alternatives {@code {1, 2, 3}} and
  28083. // a smaller LL set called <em>s</em>. If <em>s</em> is {@code {2, 3}}, then SLL
  28084. // parsing will get an error because SLL will pursue alternative 1. If
  28085. // <em>s</em> is {@code {1, 2}} or {@code {1, 3}} then both SLL and LL will
  28086. // choose the same alternative because alternative one is the minimum of either
  28087. // set. If <em>s</em> is {@code {2}} or {@code {3}} then SLL will get a syntax
  28088. // error. If <em>s</em> is {@code {1}} then SLL will succeed.</p>
  28089. //
  28090. // <p>
  28091. // Of course, if the input is invalid, then we will get an error for sure in
  28092. // both SLL and LL parsing. Erroneous input will therefore require 2 passes over
  28093. // the input.</p>
  28094. //
  28095. var Utils = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js");
  28096. var Set = Utils.Set;
  28097. var BitSet = Utils.BitSet;
  28098. var DoubleDict = Utils.DoubleDict;
  28099. var ATN = __webpack_require__(/*! ./ATN */ "./node_modules/antlr4/atn/ATN.js").ATN;
  28100. var ATNState = __webpack_require__(/*! ./ATNState */ "./node_modules/antlr4/atn/ATNState.js").ATNState;
  28101. var ATNConfig = __webpack_require__(/*! ./ATNConfig */ "./node_modules/antlr4/atn/ATNConfig.js").ATNConfig;
  28102. var ATNConfigSet = __webpack_require__(/*! ./ATNConfigSet */ "./node_modules/antlr4/atn/ATNConfigSet.js").ATNConfigSet;
  28103. var Token = __webpack_require__(/*! ./../Token */ "./node_modules/antlr4/Token.js").Token;
  28104. var DFAState = __webpack_require__(/*! ./../dfa/DFAState */ "./node_modules/antlr4/dfa/DFAState.js").DFAState;
  28105. var PredPrediction = __webpack_require__(/*! ./../dfa/DFAState */ "./node_modules/antlr4/dfa/DFAState.js").PredPrediction;
  28106. var ATNSimulator = __webpack_require__(/*! ./ATNSimulator */ "./node_modules/antlr4/atn/ATNSimulator.js").ATNSimulator;
  28107. var PredictionMode = __webpack_require__(/*! ./PredictionMode */ "./node_modules/antlr4/atn/PredictionMode.js").PredictionMode;
  28108. var RuleContext = __webpack_require__(/*! ./../RuleContext */ "./node_modules/antlr4/RuleContext.js").RuleContext;
  28109. var ParserRuleContext = __webpack_require__(/*! ./../ParserRuleContext */ "./node_modules/antlr4/ParserRuleContext.js").ParserRuleContext;
  28110. var SemanticContext = __webpack_require__(/*! ./SemanticContext */ "./node_modules/antlr4/atn/SemanticContext.js").SemanticContext;
  28111. var StarLoopEntryState = __webpack_require__(/*! ./ATNState */ "./node_modules/antlr4/atn/ATNState.js").StarLoopEntryState;
  28112. var RuleStopState = __webpack_require__(/*! ./ATNState */ "./node_modules/antlr4/atn/ATNState.js").RuleStopState;
  28113. var PredictionContext = __webpack_require__(/*! ./../PredictionContext */ "./node_modules/antlr4/PredictionContext.js").PredictionContext;
  28114. var Interval = __webpack_require__(/*! ./../IntervalSet */ "./node_modules/antlr4/IntervalSet.js").Interval;
  28115. var Transitions = __webpack_require__(/*! ./Transition */ "./node_modules/antlr4/atn/Transition.js");
  28116. var Transition = Transitions.Transition;
  28117. var SetTransition = Transitions.SetTransition;
  28118. var NotSetTransition = Transitions.NotSetTransition;
  28119. var RuleTransition = Transitions.RuleTransition;
  28120. var ActionTransition = Transitions.ActionTransition;
  28121. var NoViableAltException = __webpack_require__(/*! ./../error/Errors */ "./node_modules/antlr4/error/Errors.js").NoViableAltException;
  28122. var SingletonPredictionContext = __webpack_require__(/*! ./../PredictionContext */ "./node_modules/antlr4/PredictionContext.js").SingletonPredictionContext;
  28123. var predictionContextFromRuleContext = __webpack_require__(/*! ./../PredictionContext */ "./node_modules/antlr4/PredictionContext.js").predictionContextFromRuleContext;
  28124. function ParserATNSimulator(parser, atn, decisionToDFA, sharedContextCache) {
  28125. ATNSimulator.call(this, atn, sharedContextCache);
  28126. this.parser = parser;
  28127. this.decisionToDFA = decisionToDFA;
  28128. // SLL, LL, or LL + exact ambig detection?//
  28129. this.predictionMode = PredictionMode.LL;
  28130. // LAME globals to avoid parameters!!!!! I need these down deep in predTransition
  28131. this._input = null;
  28132. this._startIndex = 0;
  28133. this._outerContext = null;
  28134. this._dfa = null;
  28135. // Each prediction operation uses a cache for merge of prediction contexts.
  28136. // Don't keep around as it wastes huge amounts of memory. DoubleKeyMap
  28137. // isn't synchronized but we're ok since two threads shouldn't reuse same
  28138. // parser/atnsim object because it can only handle one input at a time.
  28139. // This maps graphs a and b to merged result c. (a,b)&rarr;c. We can avoid
  28140. // the merge if we ever see a and b again. Note that (b,a)&rarr;c should
  28141. // also be examined during cache lookup.
  28142. //
  28143. this.mergeCache = null;
  28144. return this;
  28145. }
  28146. ParserATNSimulator.prototype = Object.create(ATNSimulator.prototype);
  28147. ParserATNSimulator.prototype.constructor = ParserATNSimulator;
  28148. ParserATNSimulator.prototype.debug = false;
  28149. ParserATNSimulator.prototype.debug_closure = false;
  28150. ParserATNSimulator.prototype.debug_add = false;
  28151. ParserATNSimulator.prototype.debug_list_atn_decisions = false;
  28152. ParserATNSimulator.prototype.dfa_debug = false;
  28153. ParserATNSimulator.prototype.retry_debug = false;
  28154. ParserATNSimulator.prototype.reset = function () {};
  28155. ParserATNSimulator.prototype.adaptivePredict = function (input, decision, outerContext) {
  28156. if (this.debug || this.debug_list_atn_decisions) {
  28157. console.log("adaptivePredict decision " + decision + " exec LA(1)==" + this.getLookaheadName(input) + " line " + input.LT(1).line + ":" + input.LT(1).column);
  28158. }
  28159. this._input = input;
  28160. this._startIndex = input.index;
  28161. this._outerContext = outerContext;
  28162. var dfa = this.decisionToDFA[decision];
  28163. this._dfa = dfa;
  28164. var m = input.mark();
  28165. var index = input.index;
  28166. // Now we are certain to have a specific decision's DFA
  28167. // But, do we still need an initial state?
  28168. try {
  28169. var s0;
  28170. if (dfa.precedenceDfa) {
  28171. // the start state for a precedence DFA depends on the current
  28172. // parser precedence, and is provided by a DFA method.
  28173. s0 = dfa.getPrecedenceStartState(this.parser.getPrecedence());
  28174. } else {
  28175. // the start state for a "regular" DFA is just s0
  28176. s0 = dfa.s0;
  28177. }
  28178. if (s0 === null) {
  28179. if (outerContext === null) {
  28180. outerContext = RuleContext.EMPTY;
  28181. }
  28182. if (this.debug || this.debug_list_atn_decisions) {
  28183. console.log("predictATN decision " + dfa.decision + " exec LA(1)==" + this.getLookaheadName(input) + ", outerContext=" + outerContext.toString(this.parser.ruleNames));
  28184. }
  28185. var fullCtx = false;
  28186. var s0_closure = this.computeStartState(dfa.atnStartState, RuleContext.EMPTY, fullCtx);
  28187. if (dfa.precedenceDfa) {
  28188. // If this is a precedence DFA, we use applyPrecedenceFilter
  28189. // to convert the computed start state to a precedence start
  28190. // state. We then use DFA.setPrecedenceStartState to set the
  28191. // appropriate start state for the precedence level rather
  28192. // than simply setting DFA.s0.
  28193. //
  28194. dfa.s0.configs = s0_closure; // not used for prediction but useful to know start configs anyway
  28195. s0_closure = this.applyPrecedenceFilter(s0_closure);
  28196. s0 = this.addDFAState(dfa, new DFAState(null, s0_closure));
  28197. dfa.setPrecedenceStartState(this.parser.getPrecedence(), s0);
  28198. } else {
  28199. s0 = this.addDFAState(dfa, new DFAState(null, s0_closure));
  28200. dfa.s0 = s0;
  28201. }
  28202. }
  28203. var alt = this.execATN(dfa, s0, input, index, outerContext);
  28204. if (this.debug) {
  28205. console.log("DFA after predictATN: " + dfa.toString(this.parser.literalNames));
  28206. }
  28207. return alt;
  28208. } finally {
  28209. this._dfa = null;
  28210. this.mergeCache = null; // wack cache after each prediction
  28211. input.seek(index);
  28212. input.release(m);
  28213. }
  28214. };
  28215. // Performs ATN simulation to compute a predicted alternative based
  28216. // upon the remaining input, but also updates the DFA cache to avoid
  28217. // having to traverse the ATN again for the same input sequence.
  28218. // There are some key conditions we're looking for after computing a new
  28219. // set of ATN configs (proposed DFA state):
  28220. // if the set is empty, there is no viable alternative for current symbol
  28221. // does the state uniquely predict an alternative?
  28222. // does the state have a conflict that would prevent us from
  28223. // putting it on the work list?
  28224. // We also have some key operations to do:
  28225. // add an edge from previous DFA state to potentially new DFA state, D,
  28226. // upon current symbol but only if adding to work list, which means in all
  28227. // cases except no viable alternative (and possibly non-greedy decisions?)
  28228. // collecting predicates and adding semantic context to DFA accept states
  28229. // adding rule context to context-sensitive DFA accept states
  28230. // consuming an input symbol
  28231. // reporting a conflict
  28232. // reporting an ambiguity
  28233. // reporting a context sensitivity
  28234. // reporting insufficient predicates
  28235. // cover these cases:
  28236. // dead end
  28237. // single alt
  28238. // single alt + preds
  28239. // conflict
  28240. // conflict + preds
  28241. //
  28242. ParserATNSimulator.prototype.execATN = function (dfa, s0, input, startIndex, outerContext) {
  28243. if (this.debug || this.debug_list_atn_decisions) {
  28244. console.log("execATN decision " + dfa.decision + " exec LA(1)==" + this.getLookaheadName(input) + " line " + input.LT(1).line + ":" + input.LT(1).column);
  28245. }
  28246. var alt;
  28247. var previousD = s0;
  28248. if (this.debug) {
  28249. console.log("s0 = " + s0);
  28250. }
  28251. var t = input.LA(1);
  28252. while (true) {
  28253. // while more work
  28254. var D = this.getExistingTargetState(previousD, t);
  28255. if (D === null) {
  28256. D = this.computeTargetState(dfa, previousD, t);
  28257. }
  28258. if (D === ATNSimulator.ERROR) {
  28259. // if any configs in previous dipped into outer context, that
  28260. // means that input up to t actually finished entry rule
  28261. // at least for SLL decision. Full LL doesn't dip into outer
  28262. // so don't need special case.
  28263. // We will get an error no matter what so delay until after
  28264. // decision; better error message. Also, no reachable target
  28265. // ATN states in SLL implies LL will also get nowhere.
  28266. // If conflict in states that dip out, choose min since we
  28267. // will get error no matter what.
  28268. var e = this.noViableAlt(input, outerContext, previousD.configs, startIndex);
  28269. input.seek(startIndex);
  28270. alt = this.getSynValidOrSemInvalidAltThatFinishedDecisionEntryRule(previousD.configs, outerContext);
  28271. if (alt !== ATN.INVALID_ALT_NUMBER) {
  28272. return alt;
  28273. } else {
  28274. throw e;
  28275. }
  28276. }
  28277. if (D.requiresFullContext && this.predictionMode !== PredictionMode.SLL) {
  28278. // IF PREDS, MIGHT RESOLVE TO SINGLE ALT => SLL (or syntax error)
  28279. var conflictingAlts = null;
  28280. if (D.predicates !== null) {
  28281. if (this.debug) {
  28282. console.log("DFA state has preds in DFA sim LL failover");
  28283. }
  28284. var conflictIndex = input.index;
  28285. if (conflictIndex !== startIndex) {
  28286. input.seek(startIndex);
  28287. }
  28288. conflictingAlts = this.evalSemanticContext(D.predicates, outerContext, true);
  28289. if (conflictingAlts.length === 1) {
  28290. if (this.debug) {
  28291. console.log("Full LL avoided");
  28292. }
  28293. return conflictingAlts.minValue();
  28294. }
  28295. if (conflictIndex !== startIndex) {
  28296. // restore the index so reporting the fallback to full
  28297. // context occurs with the index at the correct spot
  28298. input.seek(conflictIndex);
  28299. }
  28300. }
  28301. if (this.dfa_debug) {
  28302. console.log("ctx sensitive state " + outerContext + " in " + D);
  28303. }
  28304. var fullCtx = true;
  28305. var s0_closure = this.computeStartState(dfa.atnStartState, outerContext, fullCtx);
  28306. this.reportAttemptingFullContext(dfa, conflictingAlts, D.configs, startIndex, input.index);
  28307. alt = this.execATNWithFullContext(dfa, D, s0_closure, input, startIndex, outerContext);
  28308. return alt;
  28309. }
  28310. if (D.isAcceptState) {
  28311. if (D.predicates === null) {
  28312. return D.prediction;
  28313. }
  28314. var stopIndex = input.index;
  28315. input.seek(startIndex);
  28316. var alts = this.evalSemanticContext(D.predicates, outerContext, true);
  28317. if (alts.length === 0) {
  28318. throw this.noViableAlt(input, outerContext, D.configs, startIndex);
  28319. } else if (alts.length === 1) {
  28320. return alts.minValue();
  28321. } else {
  28322. // report ambiguity after predicate evaluation to make sure the correct set of ambig alts is reported.
  28323. this.reportAmbiguity(dfa, D, startIndex, stopIndex, false, alts, D.configs);
  28324. return alts.minValue();
  28325. }
  28326. }
  28327. previousD = D;
  28328. if (t !== Token.EOF) {
  28329. input.consume();
  28330. t = input.LA(1);
  28331. }
  28332. }
  28333. };
  28334. //
  28335. // Get an existing target state for an edge in the DFA. If the target state
  28336. // for the edge has not yet been computed or is otherwise not available,
  28337. // this method returns {@code null}.
  28338. //
  28339. // @param previousD The current DFA state
  28340. // @param t The next input symbol
  28341. // @return The existing target DFA state for the given input symbol
  28342. // {@code t}, or {@code null} if the target state for this edge is not
  28343. // already cached
  28344. //
  28345. ParserATNSimulator.prototype.getExistingTargetState = function (previousD, t) {
  28346. var edges = previousD.edges;
  28347. if (edges === null) {
  28348. return null;
  28349. } else {
  28350. return edges[t + 1] || null;
  28351. }
  28352. };
  28353. //
  28354. // Compute a target state for an edge in the DFA, and attempt to add the
  28355. // computed state and corresponding edge to the DFA.
  28356. //
  28357. // @param dfa The DFA
  28358. // @param previousD The current DFA state
  28359. // @param t The next input symbol
  28360. //
  28361. // @return The computed target DFA state for the given input symbol
  28362. // {@code t}. If {@code t} does not lead to a valid DFA state, this method
  28363. // returns {@link //ERROR}.
  28364. //
  28365. ParserATNSimulator.prototype.computeTargetState = function (dfa, previousD, t) {
  28366. var reach = this.computeReachSet(previousD.configs, t, false);
  28367. if (reach === null) {
  28368. this.addDFAEdge(dfa, previousD, t, ATNSimulator.ERROR);
  28369. return ATNSimulator.ERROR;
  28370. }
  28371. // create new target state; we'll add to DFA after it's complete
  28372. var D = new DFAState(null, reach);
  28373. var predictedAlt = this.getUniqueAlt(reach);
  28374. if (this.debug) {
  28375. var altSubSets = PredictionMode.getConflictingAltSubsets(reach);
  28376. console.log("SLL altSubSets=" + Utils.arrayToString(altSubSets) + ", previous=" + previousD.configs + ", configs=" + reach + ", predict=" + predictedAlt + ", allSubsetsConflict=" + PredictionMode.allSubsetsConflict(altSubSets) + ", conflictingAlts=" + this.getConflictingAlts(reach));
  28377. }
  28378. if (predictedAlt !== ATN.INVALID_ALT_NUMBER) {
  28379. // NO CONFLICT, UNIQUELY PREDICTED ALT
  28380. D.isAcceptState = true;
  28381. D.configs.uniqueAlt = predictedAlt;
  28382. D.prediction = predictedAlt;
  28383. } else if (PredictionMode.hasSLLConflictTerminatingPrediction(this.predictionMode, reach)) {
  28384. // MORE THAN ONE VIABLE ALTERNATIVE
  28385. D.configs.conflictingAlts = this.getConflictingAlts(reach);
  28386. D.requiresFullContext = true;
  28387. // in SLL-only mode, we will stop at this state and return the minimum alt
  28388. D.isAcceptState = true;
  28389. D.prediction = D.configs.conflictingAlts.minValue();
  28390. }
  28391. if (D.isAcceptState && D.configs.hasSemanticContext) {
  28392. this.predicateDFAState(D, this.atn.getDecisionState(dfa.decision));
  28393. if (D.predicates !== null) {
  28394. D.prediction = ATN.INVALID_ALT_NUMBER;
  28395. }
  28396. }
  28397. // all adds to dfa are done after we've created full D state
  28398. D = this.addDFAEdge(dfa, previousD, t, D);
  28399. return D;
  28400. };
  28401. ParserATNSimulator.prototype.predicateDFAState = function (dfaState, decisionState) {
  28402. // We need to test all predicates, even in DFA states that
  28403. // uniquely predict alternative.
  28404. var nalts = decisionState.transitions.length;
  28405. // Update DFA so reach becomes accept state with (predicate,alt)
  28406. // pairs if preds found for conflicting alts
  28407. var altsToCollectPredsFrom = this.getConflictingAltsOrUniqueAlt(dfaState.configs);
  28408. var altToPred = this.getPredsForAmbigAlts(altsToCollectPredsFrom, dfaState.configs, nalts);
  28409. if (altToPred !== null) {
  28410. dfaState.predicates = this.getPredicatePredictions(altsToCollectPredsFrom, altToPred);
  28411. dfaState.prediction = ATN.INVALID_ALT_NUMBER; // make sure we use preds
  28412. } else {
  28413. // There are preds in configs but they might go away
  28414. // when OR'd together like {p}? || NONE == NONE. If neither
  28415. // alt has preds, resolve to min alt
  28416. dfaState.prediction = altsToCollectPredsFrom.minValue();
  28417. }
  28418. };
  28419. // comes back with reach.uniqueAlt set to a valid alt
  28420. ParserATNSimulator.prototype.execATNWithFullContext = function (dfa, D, // how far we got before failing over
  28421. s0, input, startIndex, outerContext) {
  28422. if (this.debug || this.debug_list_atn_decisions) {
  28423. console.log("execATNWithFullContext " + s0);
  28424. }
  28425. var fullCtx = true;
  28426. var foundExactAmbig = false;
  28427. var reach = null;
  28428. var previous = s0;
  28429. input.seek(startIndex);
  28430. var t = input.LA(1);
  28431. var predictedAlt = -1;
  28432. while (true) {
  28433. // while more work
  28434. reach = this.computeReachSet(previous, t, fullCtx);
  28435. if (reach === null) {
  28436. // if any configs in previous dipped into outer context, that
  28437. // means that input up to t actually finished entry rule
  28438. // at least for LL decision. Full LL doesn't dip into outer
  28439. // so don't need special case.
  28440. // We will get an error no matter what so delay until after
  28441. // decision; better error message. Also, no reachable target
  28442. // ATN states in SLL implies LL will also get nowhere.
  28443. // If conflict in states that dip out, choose min since we
  28444. // will get error no matter what.
  28445. var e = this.noViableAlt(input, outerContext, previous, startIndex);
  28446. input.seek(startIndex);
  28447. var alt = this.getSynValidOrSemInvalidAltThatFinishedDecisionEntryRule(previous, outerContext);
  28448. if (alt !== ATN.INVALID_ALT_NUMBER) {
  28449. return alt;
  28450. } else {
  28451. throw e;
  28452. }
  28453. }
  28454. var altSubSets = PredictionMode.getConflictingAltSubsets(reach);
  28455. if (this.debug) {
  28456. console.log("LL altSubSets=" + altSubSets + ", predict=" + PredictionMode.getUniqueAlt(altSubSets) + ", resolvesToJustOneViableAlt=" + PredictionMode.resolvesToJustOneViableAlt(altSubSets));
  28457. }
  28458. reach.uniqueAlt = this.getUniqueAlt(reach);
  28459. // unique prediction?
  28460. if (reach.uniqueAlt !== ATN.INVALID_ALT_NUMBER) {
  28461. predictedAlt = reach.uniqueAlt;
  28462. break;
  28463. } else if (this.predictionMode !== PredictionMode.LL_EXACT_AMBIG_DETECTION) {
  28464. predictedAlt = PredictionMode.resolvesToJustOneViableAlt(altSubSets);
  28465. if (predictedAlt !== ATN.INVALID_ALT_NUMBER) {
  28466. break;
  28467. }
  28468. } else {
  28469. // In exact ambiguity mode, we never try to terminate early.
  28470. // Just keeps scarfing until we know what the conflict is
  28471. if (PredictionMode.allSubsetsConflict(altSubSets) && PredictionMode.allSubsetsEqual(altSubSets)) {
  28472. foundExactAmbig = true;
  28473. predictedAlt = PredictionMode.getSingleViableAlt(altSubSets);
  28474. break;
  28475. }
  28476. // else there are multiple non-conflicting subsets or
  28477. // we're not sure what the ambiguity is yet.
  28478. // So, keep going.
  28479. }
  28480. previous = reach;
  28481. if (t !== Token.EOF) {
  28482. input.consume();
  28483. t = input.LA(1);
  28484. }
  28485. }
  28486. // If the configuration set uniquely predicts an alternative,
  28487. // without conflict, then we know that it's a full LL decision
  28488. // not SLL.
  28489. if (reach.uniqueAlt !== ATN.INVALID_ALT_NUMBER) {
  28490. this.reportContextSensitivity(dfa, predictedAlt, reach, startIndex, input.index);
  28491. return predictedAlt;
  28492. }
  28493. // We do not check predicates here because we have checked them
  28494. // on-the-fly when doing full context prediction.
  28495. //
  28496. // In non-exact ambiguity detection mode, we might actually be able to
  28497. // detect an exact ambiguity, but I'm not going to spend the cycles
  28498. // needed to check. We only emit ambiguity warnings in exact ambiguity
  28499. // mode.
  28500. //
  28501. // For example, we might know that we have conflicting configurations.
  28502. // But, that does not mean that there is no way forward without a
  28503. // conflict. It's possible to have nonconflicting alt subsets as in:
  28504. // altSubSets=[{1, 2}, {1, 2}, {1}, {1, 2}]
  28505. // from
  28506. //
  28507. // [(17,1,[5 $]), (13,1,[5 10 $]), (21,1,[5 10 $]), (11,1,[$]),
  28508. // (13,2,[5 10 $]), (21,2,[5 10 $]), (11,2,[$])]
  28509. //
  28510. // In this case, (17,1,[5 $]) indicates there is some next sequence that
  28511. // would resolve this without conflict to alternative 1. Any other viable
  28512. // next sequence, however, is associated with a conflict. We stop
  28513. // looking for input because no amount of further lookahead will alter
  28514. // the fact that we should predict alternative 1. We just can't say for
  28515. // sure that there is an ambiguity without looking further.
  28516. this.reportAmbiguity(dfa, D, startIndex, input.index, foundExactAmbig, null, reach);
  28517. return predictedAlt;
  28518. };
  28519. ParserATNSimulator.prototype.computeReachSet = function (closure, t, fullCtx) {
  28520. if (this.debug) {
  28521. console.log("in computeReachSet, starting closure: " + closure);
  28522. }
  28523. if (this.mergeCache === null) {
  28524. this.mergeCache = new DoubleDict();
  28525. }
  28526. var intermediate = new ATNConfigSet(fullCtx);
  28527. // Configurations already in a rule stop state indicate reaching the end
  28528. // of the decision rule (local context) or end of the start rule (full
  28529. // context). Once reached, these configurations are never updated by a
  28530. // closure operation, so they are handled separately for the performance
  28531. // advantage of having a smaller intermediate set when calling closure.
  28532. //
  28533. // For full-context reach operations, separate handling is required to
  28534. // ensure that the alternative matching the longest overall sequence is
  28535. // chosen when multiple such configurations can match the input.
  28536. var skippedStopStates = null;
  28537. // First figure out where we can reach on input t
  28538. for (var i = 0; i < closure.items.length; i++) {
  28539. var c = closure.items[i];
  28540. if (this.debug_add) {
  28541. console.log("testing " + this.getTokenName(t) + " at " + c);
  28542. }
  28543. if (c.state instanceof RuleStopState) {
  28544. if (fullCtx || t === Token.EOF) {
  28545. if (skippedStopStates === null) {
  28546. skippedStopStates = [];
  28547. }
  28548. skippedStopStates.push(c);
  28549. if (this.debug_add) {
  28550. console.log("added " + c + " to skippedStopStates");
  28551. }
  28552. }
  28553. continue;
  28554. }
  28555. for (var j = 0; j < c.state.transitions.length; j++) {
  28556. var trans = c.state.transitions[j];
  28557. var target = this.getReachableTarget(trans, t);
  28558. if (target !== null) {
  28559. var cfg = new ATNConfig({ state: target }, c);
  28560. intermediate.add(cfg, this.mergeCache);
  28561. if (this.debug_add) {
  28562. console.log("added " + cfg + " to intermediate");
  28563. }
  28564. }
  28565. }
  28566. }
  28567. // Now figure out where the reach operation can take us...
  28568. var reach = null;
  28569. // This block optimizes the reach operation for intermediate sets which
  28570. // trivially indicate a termination state for the overall
  28571. // adaptivePredict operation.
  28572. //
  28573. // The conditions assume that intermediate
  28574. // contains all configurations relevant to the reach set, but this
  28575. // condition is not true when one or more configurations have been
  28576. // withheld in skippedStopStates, or when the current symbol is EOF.
  28577. //
  28578. if (skippedStopStates === null && t !== Token.EOF) {
  28579. if (intermediate.items.length === 1) {
  28580. // Don't pursue the closure if there is just one state.
  28581. // It can only have one alternative; just add to result
  28582. // Also don't pursue the closure if there is unique alternative
  28583. // among the configurations.
  28584. reach = intermediate;
  28585. } else if (this.getUniqueAlt(intermediate) !== ATN.INVALID_ALT_NUMBER) {
  28586. // Also don't pursue the closure if there is unique alternative
  28587. // among the configurations.
  28588. reach = intermediate;
  28589. }
  28590. }
  28591. // If the reach set could not be trivially determined, perform a closure
  28592. // operation on the intermediate set to compute its initial value.
  28593. //
  28594. if (reach === null) {
  28595. reach = new ATNConfigSet(fullCtx);
  28596. var closureBusy = new Set();
  28597. var treatEofAsEpsilon = t === Token.EOF;
  28598. for (var k = 0; k < intermediate.items.length; k++) {
  28599. this.closure(intermediate.items[k], reach, closureBusy, false, fullCtx, treatEofAsEpsilon);
  28600. }
  28601. }
  28602. if (t === Token.EOF) {
  28603. // After consuming EOF no additional input is possible, so we are
  28604. // only interested in configurations which reached the end of the
  28605. // decision rule (local context) or end of the start rule (full
  28606. // context). Update reach to contain only these configurations. This
  28607. // handles both explicit EOF transitions in the grammar and implicit
  28608. // EOF transitions following the end of the decision or start rule.
  28609. //
  28610. // When reach==intermediate, no closure operation was performed. In
  28611. // this case, removeAllConfigsNotInRuleStopState needs to check for
  28612. // reachable rule stop states as well as configurations already in
  28613. // a rule stop state.
  28614. //
  28615. // This is handled before the configurations in skippedStopStates,
  28616. // because any configurations potentially added from that list are
  28617. // already guaranteed to meet this condition whether or not it's
  28618. // required.
  28619. //
  28620. reach = this.removeAllConfigsNotInRuleStopState(reach, reach === intermediate);
  28621. }
  28622. // If skippedStopStates!==null, then it contains at least one
  28623. // configuration. For full-context reach operations, these
  28624. // configurations reached the end of the start rule, in which case we
  28625. // only add them back to reach if no configuration during the current
  28626. // closure operation reached such a state. This ensures adaptivePredict
  28627. // chooses an alternative matching the longest overall sequence when
  28628. // multiple alternatives are viable.
  28629. //
  28630. if (skippedStopStates !== null && (!fullCtx || !PredictionMode.hasConfigInRuleStopState(reach))) {
  28631. for (var l = 0; l < skippedStopStates.length; l++) {
  28632. reach.add(skippedStopStates[l], this.mergeCache);
  28633. }
  28634. }
  28635. if (reach.items.length === 0) {
  28636. return null;
  28637. } else {
  28638. return reach;
  28639. }
  28640. };
  28641. //
  28642. // Return a configuration set containing only the configurations from
  28643. // {@code configs} which are in a {@link RuleStopState}. If all
  28644. // configurations in {@code configs} are already in a rule stop state, this
  28645. // method simply returns {@code configs}.
  28646. //
  28647. // <p>When {@code lookToEndOfRule} is true, this method uses
  28648. // {@link ATN//nextTokens} for each configuration in {@code configs} which is
  28649. // not already in a rule stop state to see if a rule stop state is reachable
  28650. // from the configuration via epsilon-only transitions.</p>
  28651. //
  28652. // @param configs the configuration set to update
  28653. // @param lookToEndOfRule when true, this method checks for rule stop states
  28654. // reachable by epsilon-only transitions from each configuration in
  28655. // {@code configs}.
  28656. //
  28657. // @return {@code configs} if all configurations in {@code configs} are in a
  28658. // rule stop state, otherwise return a new configuration set containing only
  28659. // the configurations from {@code configs} which are in a rule stop state
  28660. //
  28661. ParserATNSimulator.prototype.removeAllConfigsNotInRuleStopState = function (configs, lookToEndOfRule) {
  28662. if (PredictionMode.allConfigsInRuleStopStates(configs)) {
  28663. return configs;
  28664. }
  28665. var result = new ATNConfigSet(configs.fullCtx);
  28666. for (var i = 0; i < configs.items.length; i++) {
  28667. var config = configs.items[i];
  28668. if (config.state instanceof RuleStopState) {
  28669. result.add(config, this.mergeCache);
  28670. continue;
  28671. }
  28672. if (lookToEndOfRule && config.state.epsilonOnlyTransitions) {
  28673. var nextTokens = this.atn.nextTokens(config.state);
  28674. if (nextTokens.contains(Token.EPSILON)) {
  28675. var endOfRuleState = this.atn.ruleToStopState[config.state.ruleIndex];
  28676. result.add(new ATNConfig({ state: endOfRuleState }, config), this.mergeCache);
  28677. }
  28678. }
  28679. }
  28680. return result;
  28681. };
  28682. ParserATNSimulator.prototype.computeStartState = function (p, ctx, fullCtx) {
  28683. // always at least the implicit call to start rule
  28684. var initialContext = predictionContextFromRuleContext(this.atn, ctx);
  28685. var configs = new ATNConfigSet(fullCtx);
  28686. for (var i = 0; i < p.transitions.length; i++) {
  28687. var target = p.transitions[i].target;
  28688. var c = new ATNConfig({ state: target, alt: i + 1, context: initialContext }, null);
  28689. var closureBusy = new Set();
  28690. this.closure(c, configs, closureBusy, true, fullCtx, false);
  28691. }
  28692. return configs;
  28693. };
  28694. //
  28695. // This method transforms the start state computed by
  28696. // {@link //computeStartState} to the special start state used by a
  28697. // precedence DFA for a particular precedence value. The transformation
  28698. // process applies the following changes to the start state's configuration
  28699. // set.
  28700. //
  28701. // <ol>
  28702. // <li>Evaluate the precedence predicates for each configuration using
  28703. // {@link SemanticContext//evalPrecedence}.</li>
  28704. // <li>Remove all configurations which predict an alternative greater than
  28705. // 1, for which another configuration that predicts alternative 1 is in the
  28706. // same ATN state with the same prediction context. This transformation is
  28707. // valid for the following reasons:
  28708. // <ul>
  28709. // <li>The closure block cannot contain any epsilon transitions which bypass
  28710. // the body of the closure, so all states reachable via alternative 1 are
  28711. // part of the precedence alternatives of the transformed left-recursive
  28712. // rule.</li>
  28713. // <li>The "primary" portion of a left recursive rule cannot contain an
  28714. // epsilon transition, so the only way an alternative other than 1 can exist
  28715. // in a state that is also reachable via alternative 1 is by nesting calls
  28716. // to the left-recursive rule, with the outer calls not being at the
  28717. // preferred precedence level.</li>
  28718. // </ul>
  28719. // </li>
  28720. // </ol>
  28721. //
  28722. // <p>
  28723. // The prediction context must be considered by this filter to address
  28724. // situations like the following.
  28725. // </p>
  28726. // <code>
  28727. // <pre>
  28728. // grammar TA;
  28729. // prog: statement* EOF;
  28730. // statement: letterA | statement letterA 'b' ;
  28731. // letterA: 'a';
  28732. // </pre>
  28733. // </code>
  28734. // <p>
  28735. // If the above grammar, the ATN state immediately before the token
  28736. // reference {@code 'a'} in {@code letterA} is reachable from the left edge
  28737. // of both the primary and closure blocks of the left-recursive rule
  28738. // {@code statement}. The prediction context associated with each of these
  28739. // configurations distinguishes between them, and prevents the alternative
  28740. // which stepped out to {@code prog} (and then back in to {@code statement}
  28741. // from being eliminated by the filter.
  28742. // </p>
  28743. //
  28744. // @param configs The configuration set computed by
  28745. // {@link //computeStartState} as the start state for the DFA.
  28746. // @return The transformed configuration set representing the start state
  28747. // for a precedence DFA at a particular precedence level (determined by
  28748. // calling {@link Parser//getPrecedence}).
  28749. //
  28750. ParserATNSimulator.prototype.applyPrecedenceFilter = function (configs) {
  28751. var config;
  28752. var statesFromAlt1 = [];
  28753. var configSet = new ATNConfigSet(configs.fullCtx);
  28754. for (var i = 0; i < configs.items.length; i++) {
  28755. config = configs.items[i];
  28756. // handle alt 1 first
  28757. if (config.alt !== 1) {
  28758. continue;
  28759. }
  28760. var updatedContext = config.semanticContext.evalPrecedence(this.parser, this._outerContext);
  28761. if (updatedContext === null) {
  28762. // the configuration was eliminated
  28763. continue;
  28764. }
  28765. statesFromAlt1[config.state.stateNumber] = config.context;
  28766. if (updatedContext !== config.semanticContext) {
  28767. configSet.add(new ATNConfig({ semanticContext: updatedContext }, config), this.mergeCache);
  28768. } else {
  28769. configSet.add(config, this.mergeCache);
  28770. }
  28771. }
  28772. for (i = 0; i < configs.items.length; i++) {
  28773. config = configs.items[i];
  28774. if (config.alt === 1) {
  28775. // already handled
  28776. continue;
  28777. }
  28778. // In the future, this elimination step could be updated to also
  28779. // filter the prediction context for alternatives predicting alt>1
  28780. // (basically a graph subtraction algorithm).
  28781. if (!config.precedenceFilterSuppressed) {
  28782. var context = statesFromAlt1[config.state.stateNumber] || null;
  28783. if (context !== null && context.equals(config.context)) {
  28784. // eliminated
  28785. continue;
  28786. }
  28787. }
  28788. configSet.add(config, this.mergeCache);
  28789. }
  28790. return configSet;
  28791. };
  28792. ParserATNSimulator.prototype.getReachableTarget = function (trans, ttype) {
  28793. if (trans.matches(ttype, 0, this.atn.maxTokenType)) {
  28794. return trans.target;
  28795. } else {
  28796. return null;
  28797. }
  28798. };
  28799. ParserATNSimulator.prototype.getPredsForAmbigAlts = function (ambigAlts, configs, nalts) {
  28800. // REACH=[1|1|[]|0:0, 1|2|[]|0:1]
  28801. // altToPred starts as an array of all null contexts. The entry at index i
  28802. // corresponds to alternative i. altToPred[i] may have one of three values:
  28803. // 1. null: no ATNConfig c is found such that c.alt==i
  28804. // 2. SemanticContext.NONE: At least one ATNConfig c exists such that
  28805. // c.alt==i and c.semanticContext==SemanticContext.NONE. In other words,
  28806. // alt i has at least one unpredicated config.
  28807. // 3. Non-NONE Semantic Context: There exists at least one, and for all
  28808. // ATNConfig c such that c.alt==i, c.semanticContext!=SemanticContext.NONE.
  28809. //
  28810. // From this, it is clear that NONE||anything==NONE.
  28811. //
  28812. var altToPred = [];
  28813. for (var i = 0; i < configs.items.length; i++) {
  28814. var c = configs.items[i];
  28815. if (ambigAlts.contains(c.alt)) {
  28816. altToPred[c.alt] = SemanticContext.orContext(altToPred[c.alt] || null, c.semanticContext);
  28817. }
  28818. }
  28819. var nPredAlts = 0;
  28820. for (i = 1; i < nalts + 1; i++) {
  28821. var pred = altToPred[i] || null;
  28822. if (pred === null) {
  28823. altToPred[i] = SemanticContext.NONE;
  28824. } else if (pred !== SemanticContext.NONE) {
  28825. nPredAlts += 1;
  28826. }
  28827. }
  28828. // nonambig alts are null in altToPred
  28829. if (nPredAlts === 0) {
  28830. altToPred = null;
  28831. }
  28832. if (this.debug) {
  28833. console.log("getPredsForAmbigAlts result " + Utils.arrayToString(altToPred));
  28834. }
  28835. return altToPred;
  28836. };
  28837. ParserATNSimulator.prototype.getPredicatePredictions = function (ambigAlts, altToPred) {
  28838. var pairs = [];
  28839. var containsPredicate = false;
  28840. for (var i = 1; i < altToPred.length; i++) {
  28841. var pred = altToPred[i];
  28842. // unpredicated is indicated by SemanticContext.NONE
  28843. if (ambigAlts !== null && ambigAlts.contains(i)) {
  28844. pairs.push(new PredPrediction(pred, i));
  28845. }
  28846. if (pred !== SemanticContext.NONE) {
  28847. containsPredicate = true;
  28848. }
  28849. }
  28850. if (!containsPredicate) {
  28851. return null;
  28852. }
  28853. return pairs;
  28854. };
  28855. //
  28856. // This method is used to improve the localization of error messages by
  28857. // choosing an alternative rather than throwing a
  28858. // {@link NoViableAltException} in particular prediction scenarios where the
  28859. // {@link //ERROR} state was reached during ATN simulation.
  28860. //
  28861. // <p>
  28862. // The default implementation of this method uses the following
  28863. // algorithm to identify an ATN configuration which successfully parsed the
  28864. // decision entry rule. Choosing such an alternative ensures that the
  28865. // {@link ParserRuleContext} returned by the calling rule will be complete
  28866. // and valid, and the syntax error will be reported later at a more
  28867. // localized location.</p>
  28868. //
  28869. // <ul>
  28870. // <li>If a syntactically valid path or paths reach the end of the decision rule and
  28871. // they are semantically valid if predicated, return the min associated alt.</li>
  28872. // <li>Else, if a semantically invalid but syntactically valid path exist
  28873. // or paths exist, return the minimum associated alt.
  28874. // </li>
  28875. // <li>Otherwise, return {@link ATN//INVALID_ALT_NUMBER}.</li>
  28876. // </ul>
  28877. //
  28878. // <p>
  28879. // In some scenarios, the algorithm described above could predict an
  28880. // alternative which will result in a {@link FailedPredicateException} in
  28881. // the parser. Specifically, this could occur if the <em>only</em> configuration
  28882. // capable of successfully parsing to the end of the decision rule is
  28883. // blocked by a semantic predicate. By choosing this alternative within
  28884. // {@link //adaptivePredict} instead of throwing a
  28885. // {@link NoViableAltException}, the resulting
  28886. // {@link FailedPredicateException} in the parser will identify the specific
  28887. // predicate which is preventing the parser from successfully parsing the
  28888. // decision rule, which helps developers identify and correct logic errors
  28889. // in semantic predicates.
  28890. // </p>
  28891. //
  28892. // @param configs The ATN configurations which were valid immediately before
  28893. // the {@link //ERROR} state was reached
  28894. // @param outerContext The is the \gamma_0 initial parser context from the paper
  28895. // or the parser stack at the instant before prediction commences.
  28896. //
  28897. // @return The value to return from {@link //adaptivePredict}, or
  28898. // {@link ATN//INVALID_ALT_NUMBER} if a suitable alternative was not
  28899. // identified and {@link //adaptivePredict} should report an error instead.
  28900. //
  28901. ParserATNSimulator.prototype.getSynValidOrSemInvalidAltThatFinishedDecisionEntryRule = function (configs, outerContext) {
  28902. var cfgs = this.splitAccordingToSemanticValidity(configs, outerContext);
  28903. var semValidConfigs = cfgs[0];
  28904. var semInvalidConfigs = cfgs[1];
  28905. var alt = this.getAltThatFinishedDecisionEntryRule(semValidConfigs);
  28906. if (alt !== ATN.INVALID_ALT_NUMBER) {
  28907. // semantically/syntactically viable path exists
  28908. return alt;
  28909. }
  28910. // Is there a syntactically valid path with a failed pred?
  28911. if (semInvalidConfigs.items.length > 0) {
  28912. alt = this.getAltThatFinishedDecisionEntryRule(semInvalidConfigs);
  28913. if (alt !== ATN.INVALID_ALT_NUMBER) {
  28914. // syntactically viable path exists
  28915. return alt;
  28916. }
  28917. }
  28918. return ATN.INVALID_ALT_NUMBER;
  28919. };
  28920. ParserATNSimulator.prototype.getAltThatFinishedDecisionEntryRule = function (configs) {
  28921. var alts = [];
  28922. for (var i = 0; i < configs.items.length; i++) {
  28923. var c = configs.items[i];
  28924. if (c.reachesIntoOuterContext > 0 || c.state instanceof RuleStopState && c.context.hasEmptyPath()) {
  28925. if (alts.indexOf(c.alt) < 0) {
  28926. alts.push(c.alt);
  28927. }
  28928. }
  28929. }
  28930. if (alts.length === 0) {
  28931. return ATN.INVALID_ALT_NUMBER;
  28932. } else {
  28933. return Math.min.apply(null, alts);
  28934. }
  28935. };
  28936. // Walk the list of configurations and split them according to
  28937. // those that have preds evaluating to true/false. If no pred, assume
  28938. // true pred and include in succeeded set. Returns Pair of sets.
  28939. //
  28940. // Create a new set so as not to alter the incoming parameter.
  28941. //
  28942. // Assumption: the input stream has been restored to the starting point
  28943. // prediction, which is where predicates need to evaluate.
  28944. //
  28945. ParserATNSimulator.prototype.splitAccordingToSemanticValidity = function (configs, outerContext) {
  28946. var succeeded = new ATNConfigSet(configs.fullCtx);
  28947. var failed = new ATNConfigSet(configs.fullCtx);
  28948. for (var i = 0; i < configs.items.length; i++) {
  28949. var c = configs.items[i];
  28950. if (c.semanticContext !== SemanticContext.NONE) {
  28951. var predicateEvaluationResult = c.semanticContext.evaluate(this.parser, outerContext);
  28952. if (predicateEvaluationResult) {
  28953. succeeded.add(c);
  28954. } else {
  28955. failed.add(c);
  28956. }
  28957. } else {
  28958. succeeded.add(c);
  28959. }
  28960. }
  28961. return [succeeded, failed];
  28962. };
  28963. // Look through a list of predicate/alt pairs, returning alts for the
  28964. // pairs that win. A {@code NONE} predicate indicates an alt containing an
  28965. // unpredicated config which behaves as "always true." If !complete
  28966. // then we stop at the first predicate that evaluates to true. This
  28967. // includes pairs with null predicates.
  28968. //
  28969. ParserATNSimulator.prototype.evalSemanticContext = function (predPredictions, outerContext, complete) {
  28970. var predictions = new BitSet();
  28971. for (var i = 0; i < predPredictions.length; i++) {
  28972. var pair = predPredictions[i];
  28973. if (pair.pred === SemanticContext.NONE) {
  28974. predictions.add(pair.alt);
  28975. if (!complete) {
  28976. break;
  28977. }
  28978. continue;
  28979. }
  28980. var predicateEvaluationResult = pair.pred.evaluate(this.parser, outerContext);
  28981. if (this.debug || this.dfa_debug) {
  28982. console.log("eval pred " + pair + "=" + predicateEvaluationResult);
  28983. }
  28984. if (predicateEvaluationResult) {
  28985. if (this.debug || this.dfa_debug) {
  28986. console.log("PREDICT " + pair.alt);
  28987. }
  28988. predictions.add(pair.alt);
  28989. if (!complete) {
  28990. break;
  28991. }
  28992. }
  28993. }
  28994. return predictions;
  28995. };
  28996. // TODO: If we are doing predicates, there is no point in pursuing
  28997. // closure operations if we reach a DFA state that uniquely predicts
  28998. // alternative. We will not be caching that DFA state and it is a
  28999. // waste to pursue the closure. Might have to advance when we do
  29000. // ambig detection thought :(
  29001. //
  29002. ParserATNSimulator.prototype.closure = function (config, configs, closureBusy, collectPredicates, fullCtx, treatEofAsEpsilon) {
  29003. var initialDepth = 0;
  29004. this.closureCheckingStopState(config, configs, closureBusy, collectPredicates, fullCtx, initialDepth, treatEofAsEpsilon);
  29005. };
  29006. ParserATNSimulator.prototype.closureCheckingStopState = function (config, configs, closureBusy, collectPredicates, fullCtx, depth, treatEofAsEpsilon) {
  29007. if (this.debug || this.debug_closure) {
  29008. console.log("closure(" + config.toString(this.parser, true) + ")");
  29009. // console.log("configs(" + configs.toString() + ")");
  29010. if (config.reachesIntoOuterContext > 50) {
  29011. throw "problem";
  29012. }
  29013. }
  29014. if (config.state instanceof RuleStopState) {
  29015. // We hit rule end. If we have context info, use it
  29016. // run thru all possible stack tops in ctx
  29017. if (!config.context.isEmpty()) {
  29018. for (var i = 0; i < config.context.length; i++) {
  29019. if (config.context.getReturnState(i) === PredictionContext.EMPTY_RETURN_STATE) {
  29020. if (fullCtx) {
  29021. configs.add(new ATNConfig({ state: config.state, context: PredictionContext.EMPTY }, config), this.mergeCache);
  29022. continue;
  29023. } else {
  29024. // we have no context info, just chase follow links (if greedy)
  29025. if (this.debug) {
  29026. console.log("FALLING off rule " + this.getRuleName(config.state.ruleIndex));
  29027. }
  29028. this.closure_(config, configs, closureBusy, collectPredicates, fullCtx, depth, treatEofAsEpsilon);
  29029. }
  29030. continue;
  29031. }
  29032. var returnState = this.atn.states[config.context.getReturnState(i)];
  29033. var newContext = config.context.getParent(i); // "pop" return state
  29034. var parms = { state: returnState, alt: config.alt, context: newContext, semanticContext: config.semanticContext };
  29035. var c = new ATNConfig(parms, null);
  29036. // While we have context to pop back from, we may have
  29037. // gotten that context AFTER having falling off a rule.
  29038. // Make sure we track that we are now out of context.
  29039. c.reachesIntoOuterContext = config.reachesIntoOuterContext;
  29040. this.closureCheckingStopState(c, configs, closureBusy, collectPredicates, fullCtx, depth - 1, treatEofAsEpsilon);
  29041. }
  29042. return;
  29043. } else if (fullCtx) {
  29044. // reached end of start rule
  29045. configs.add(config, this.mergeCache);
  29046. return;
  29047. } else {
  29048. // else if we have no context info, just chase follow links (if greedy)
  29049. if (this.debug) {
  29050. console.log("FALLING off rule " + this.getRuleName(config.state.ruleIndex));
  29051. }
  29052. }
  29053. }
  29054. this.closure_(config, configs, closureBusy, collectPredicates, fullCtx, depth, treatEofAsEpsilon);
  29055. };
  29056. // Do the actual work of walking epsilon edges//
  29057. ParserATNSimulator.prototype.closure_ = function (config, configs, closureBusy, collectPredicates, fullCtx, depth, treatEofAsEpsilon) {
  29058. var p = config.state;
  29059. // optimization
  29060. if (!p.epsilonOnlyTransitions) {
  29061. configs.add(config, this.mergeCache);
  29062. // make sure to not return here, because EOF transitions can act as
  29063. // both epsilon transitions and non-epsilon transitions.
  29064. }
  29065. for (var i = 0; i < p.transitions.length; i++) {
  29066. if (i == 0 && this.canDropLoopEntryEdgeInLeftRecursiveRule(config)) continue;
  29067. var t = p.transitions[i];
  29068. var continueCollecting = collectPredicates && !(t instanceof ActionTransition);
  29069. var c = this.getEpsilonTarget(config, t, continueCollecting, depth === 0, fullCtx, treatEofAsEpsilon);
  29070. if (c !== null) {
  29071. if (!t.isEpsilon && closureBusy.add(c) !== c) {
  29072. // avoid infinite recursion for EOF* and EOF+
  29073. continue;
  29074. }
  29075. var newDepth = depth;
  29076. if (config.state instanceof RuleStopState) {
  29077. // target fell off end of rule; mark resulting c as having dipped into outer context
  29078. // We can't get here if incoming config was rule stop and we had context
  29079. // track how far we dip into outer context. Might
  29080. // come in handy and we avoid evaluating context dependent
  29081. // preds if this is > 0.
  29082. if (closureBusy.add(c) !== c) {
  29083. // avoid infinite recursion for right-recursive rules
  29084. continue;
  29085. }
  29086. if (this._dfa !== null && this._dfa.precedenceDfa) {
  29087. if (t.outermostPrecedenceReturn === this._dfa.atnStartState.ruleIndex) {
  29088. c.precedenceFilterSuppressed = true;
  29089. }
  29090. }
  29091. c.reachesIntoOuterContext += 1;
  29092. configs.dipsIntoOuterContext = true; // TODO: can remove? only care when we add to set per middle of this method
  29093. newDepth -= 1;
  29094. if (this.debug) {
  29095. console.log("dips into outer ctx: " + c);
  29096. }
  29097. } else if (t instanceof RuleTransition) {
  29098. // latch when newDepth goes negative - once we step out of the entry context we can't return
  29099. if (newDepth >= 0) {
  29100. newDepth += 1;
  29101. }
  29102. }
  29103. this.closureCheckingStopState(c, configs, closureBusy, continueCollecting, fullCtx, newDepth, treatEofAsEpsilon);
  29104. }
  29105. }
  29106. };
  29107. ParserATNSimulator.prototype.canDropLoopEntryEdgeInLeftRecursiveRule = function (config) {
  29108. // return False
  29109. var p = config.state;
  29110. // First check to see if we are in StarLoopEntryState generated during
  29111. // left-recursion elimination. For efficiency, also check if
  29112. // the context has an empty stack case. If so, it would mean
  29113. // global FOLLOW so we can't perform optimization
  29114. // Are we the special loop entry/exit state? or SLL wildcard
  29115. if (p.stateType != ATNState.STAR_LOOP_ENTRY) return false;
  29116. if (p.stateType != ATNState.STAR_LOOP_ENTRY || !p.isPrecedenceDecision || config.context.isEmpty() || config.context.hasEmptyPath()) return false;
  29117. // Require all return states to return back to the same rule that p is in.
  29118. var numCtxs = config.context.length;
  29119. for (var i = 0; i < numCtxs; i++) {
  29120. // for each stack context
  29121. var returnState = this.atn.states[config.context.getReturnState(i)];
  29122. if (returnState.ruleIndex != p.ruleIndex) return false;
  29123. }
  29124. var decisionStartState = p.transitions[0].target;
  29125. var blockEndStateNum = decisionStartState.endState.stateNumber;
  29126. var blockEndState = this.atn.states[blockEndStateNum];
  29127. // Verify that the top of each stack context leads to loop entry/exit
  29128. // state through epsilon edges and w/o leaving rule.
  29129. for (var i = 0; i < numCtxs; i++) {
  29130. // for each stack context
  29131. var returnStateNumber = config.context.getReturnState(i);
  29132. var returnState = this.atn.states[returnStateNumber];
  29133. // all states must have single outgoing epsilon edge
  29134. if (returnState.transitions.length != 1 || !returnState.transitions[0].isEpsilon) return false;
  29135. // Look for prefix op case like 'not expr', (' type ')' expr
  29136. var returnStateTarget = returnState.transitions[0].target;
  29137. if (returnState.stateType == ATNState.BLOCK_END && returnStateTarget == p) continue;
  29138. // Look for 'expr op expr' or case where expr's return state is block end
  29139. // of (...)* internal block; the block end points to loop back
  29140. // which points to p but we don't need to check that
  29141. if (returnState == blockEndState) continue;
  29142. // Look for ternary expr ? expr : expr. The return state points at block end,
  29143. // which points at loop entry state
  29144. if (returnStateTarget == blockEndState) continue;
  29145. // Look for complex prefix 'between expr and expr' case where 2nd expr's
  29146. // return state points at block end state of (...)* internal block
  29147. if (returnStateTarget.stateType == ATNState.BLOCK_END && returnStateTarget.transitions.length == 1 && returnStateTarget.transitions[0].isEpsilon && returnStateTarget.transitions[0].target == p) continue;
  29148. // anything else ain't conforming
  29149. return false;
  29150. }
  29151. return true;
  29152. };
  29153. ParserATNSimulator.prototype.getRuleName = function (index) {
  29154. if (this.parser !== null && index >= 0) {
  29155. return this.parser.ruleNames[index];
  29156. } else {
  29157. return "<rule " + index + ">";
  29158. }
  29159. };
  29160. ParserATNSimulator.prototype.getEpsilonTarget = function (config, t, collectPredicates, inContext, fullCtx, treatEofAsEpsilon) {
  29161. switch (t.serializationType) {
  29162. case Transition.RULE:
  29163. return this.ruleTransition(config, t);
  29164. case Transition.PRECEDENCE:
  29165. return this.precedenceTransition(config, t, collectPredicates, inContext, fullCtx);
  29166. case Transition.PREDICATE:
  29167. return this.predTransition(config, t, collectPredicates, inContext, fullCtx);
  29168. case Transition.ACTION:
  29169. return this.actionTransition(config, t);
  29170. case Transition.EPSILON:
  29171. return new ATNConfig({ state: t.target }, config);
  29172. case Transition.ATOM:
  29173. case Transition.RANGE:
  29174. case Transition.SET:
  29175. // EOF transitions act like epsilon transitions after the first EOF
  29176. // transition is traversed
  29177. if (treatEofAsEpsilon) {
  29178. if (t.matches(Token.EOF, 0, 1)) {
  29179. return new ATNConfig({ state: t.target }, config);
  29180. }
  29181. }
  29182. return null;
  29183. default:
  29184. return null;
  29185. }
  29186. };
  29187. ParserATNSimulator.prototype.actionTransition = function (config, t) {
  29188. if (this.debug) {
  29189. var index = t.actionIndex == -1 ? 65535 : t.actionIndex;
  29190. console.log("ACTION edge " + t.ruleIndex + ":" + index);
  29191. }
  29192. return new ATNConfig({ state: t.target }, config);
  29193. };
  29194. ParserATNSimulator.prototype.precedenceTransition = function (config, pt, collectPredicates, inContext, fullCtx) {
  29195. if (this.debug) {
  29196. console.log("PRED (collectPredicates=" + collectPredicates + ") " + pt.precedence + ">=_p, ctx dependent=true");
  29197. if (this.parser !== null) {
  29198. console.log("context surrounding pred is " + Utils.arrayToString(this.parser.getRuleInvocationStack()));
  29199. }
  29200. }
  29201. var c = null;
  29202. if (collectPredicates && inContext) {
  29203. if (fullCtx) {
  29204. // In full context mode, we can evaluate predicates on-the-fly
  29205. // during closure, which dramatically reduces the size of
  29206. // the config sets. It also obviates the need to test predicates
  29207. // later during conflict resolution.
  29208. var currentPosition = this._input.index;
  29209. this._input.seek(this._startIndex);
  29210. var predSucceeds = pt.getPredicate().evaluate(this.parser, this._outerContext);
  29211. this._input.seek(currentPosition);
  29212. if (predSucceeds) {
  29213. c = new ATNConfig({ state: pt.target }, config); // no pred context
  29214. }
  29215. } else {
  29216. var newSemCtx = SemanticContext.andContext(config.semanticContext, pt.getPredicate());
  29217. c = new ATNConfig({ state: pt.target, semanticContext: newSemCtx }, config);
  29218. }
  29219. } else {
  29220. c = new ATNConfig({ state: pt.target }, config);
  29221. }
  29222. if (this.debug) {
  29223. console.log("config from pred transition=" + c);
  29224. }
  29225. return c;
  29226. };
  29227. ParserATNSimulator.prototype.predTransition = function (config, pt, collectPredicates, inContext, fullCtx) {
  29228. if (this.debug) {
  29229. console.log("PRED (collectPredicates=" + collectPredicates + ") " + pt.ruleIndex + ":" + pt.predIndex + ", ctx dependent=" + pt.isCtxDependent);
  29230. if (this.parser !== null) {
  29231. console.log("context surrounding pred is " + Utils.arrayToString(this.parser.getRuleInvocationStack()));
  29232. }
  29233. }
  29234. var c = null;
  29235. if (collectPredicates && (pt.isCtxDependent && inContext || !pt.isCtxDependent)) {
  29236. if (fullCtx) {
  29237. // In full context mode, we can evaluate predicates on-the-fly
  29238. // during closure, which dramatically reduces the size of
  29239. // the config sets. It also obviates the need to test predicates
  29240. // later during conflict resolution.
  29241. var currentPosition = this._input.index;
  29242. this._input.seek(this._startIndex);
  29243. var predSucceeds = pt.getPredicate().evaluate(this.parser, this._outerContext);
  29244. this._input.seek(currentPosition);
  29245. if (predSucceeds) {
  29246. c = new ATNConfig({ state: pt.target }, config); // no pred context
  29247. }
  29248. } else {
  29249. var newSemCtx = SemanticContext.andContext(config.semanticContext, pt.getPredicate());
  29250. c = new ATNConfig({ state: pt.target, semanticContext: newSemCtx }, config);
  29251. }
  29252. } else {
  29253. c = new ATNConfig({ state: pt.target }, config);
  29254. }
  29255. if (this.debug) {
  29256. console.log("config from pred transition=" + c);
  29257. }
  29258. return c;
  29259. };
  29260. ParserATNSimulator.prototype.ruleTransition = function (config, t) {
  29261. if (this.debug) {
  29262. console.log("CALL rule " + this.getRuleName(t.target.ruleIndex) + ", ctx=" + config.context);
  29263. }
  29264. var returnState = t.followState;
  29265. var newContext = SingletonPredictionContext.create(config.context, returnState.stateNumber);
  29266. return new ATNConfig({ state: t.target, context: newContext }, config);
  29267. };
  29268. ParserATNSimulator.prototype.getConflictingAlts = function (configs) {
  29269. var altsets = PredictionMode.getConflictingAltSubsets(configs);
  29270. return PredictionMode.getAlts(altsets);
  29271. };
  29272. // Sam pointed out a problem with the previous definition, v3, of
  29273. // ambiguous states. If we have another state associated with conflicting
  29274. // alternatives, we should keep going. For example, the following grammar
  29275. //
  29276. // s : (ID | ID ID?) ';' ;
  29277. //
  29278. // When the ATN simulation reaches the state before ';', it has a DFA
  29279. // state that looks like: [12|1|[], 6|2|[], 12|2|[]]. Naturally
  29280. // 12|1|[] and 12|2|[] conflict, but we cannot stop processing this node
  29281. // because alternative to has another way to continue, via [6|2|[]].
  29282. // The key is that we have a single state that has config's only associated
  29283. // with a single alternative, 2, and crucially the state transitions
  29284. // among the configurations are all non-epsilon transitions. That means
  29285. // we don't consider any conflicts that include alternative 2. So, we
  29286. // ignore the conflict between alts 1 and 2. We ignore a set of
  29287. // conflicting alts when there is an intersection with an alternative
  29288. // associated with a single alt state in the state&rarr;config-list map.
  29289. //
  29290. // It's also the case that we might have two conflicting configurations but
  29291. // also a 3rd nonconflicting configuration for a different alternative:
  29292. // [1|1|[], 1|2|[], 8|3|[]]. This can come about from grammar:
  29293. //
  29294. // a : A | A | A B ;
  29295. //
  29296. // After matching input A, we reach the stop state for rule A, state 1.
  29297. // State 8 is the state right before B. Clearly alternatives 1 and 2
  29298. // conflict and no amount of further lookahead will separate the two.
  29299. // However, alternative 3 will be able to continue and so we do not
  29300. // stop working on this state. In the previous example, we're concerned
  29301. // with states associated with the conflicting alternatives. Here alt
  29302. // 3 is not associated with the conflicting configs, but since we can continue
  29303. // looking for input reasonably, I don't declare the state done. We
  29304. // ignore a set of conflicting alts when we have an alternative
  29305. // that we still need to pursue.
  29306. //
  29307. ParserATNSimulator.prototype.getConflictingAltsOrUniqueAlt = function (configs) {
  29308. var conflictingAlts = null;
  29309. if (configs.uniqueAlt !== ATN.INVALID_ALT_NUMBER) {
  29310. conflictingAlts = new BitSet();
  29311. conflictingAlts.add(configs.uniqueAlt);
  29312. } else {
  29313. conflictingAlts = configs.conflictingAlts;
  29314. }
  29315. return conflictingAlts;
  29316. };
  29317. ParserATNSimulator.prototype.getTokenName = function (t) {
  29318. if (t === Token.EOF) {
  29319. return "EOF";
  29320. }
  29321. if (this.parser !== null && this.parser.literalNames !== null) {
  29322. if (t >= this.parser.literalNames.length && t >= this.parser.symbolicNames.length) {
  29323. console.log("" + t + " ttype out of range: " + this.parser.literalNames);
  29324. console.log("" + this.parser.getInputStream().getTokens());
  29325. } else {
  29326. var name = this.parser.literalNames[t] || this.parser.symbolicNames[t];
  29327. return name + "<" + t + ">";
  29328. }
  29329. }
  29330. return "" + t;
  29331. };
  29332. ParserATNSimulator.prototype.getLookaheadName = function (input) {
  29333. return this.getTokenName(input.LA(1));
  29334. };
  29335. // Used for debugging in adaptivePredict around execATN but I cut
  29336. // it out for clarity now that alg. works well. We can leave this
  29337. // "dead" code for a bit.
  29338. //
  29339. ParserATNSimulator.prototype.dumpDeadEndConfigs = function (nvae) {
  29340. console.log("dead end configs: ");
  29341. var decs = nvae.getDeadEndConfigs();
  29342. for (var i = 0; i < decs.length; i++) {
  29343. var c = decs[i];
  29344. var trans = "no edges";
  29345. if (c.state.transitions.length > 0) {
  29346. var t = c.state.transitions[0];
  29347. if (t instanceof AtomTransition) {
  29348. trans = "Atom " + this.getTokenName(t.label);
  29349. } else if (t instanceof SetTransition) {
  29350. var neg = t instanceof NotSetTransition;
  29351. trans = (neg ? "~" : "") + "Set " + t.set;
  29352. }
  29353. }
  29354. console.error(c.toString(this.parser, true) + ":" + trans);
  29355. }
  29356. };
  29357. ParserATNSimulator.prototype.noViableAlt = function (input, outerContext, configs, startIndex) {
  29358. return new NoViableAltException(this.parser, input, input.get(startIndex), input.LT(1), configs, outerContext);
  29359. };
  29360. ParserATNSimulator.prototype.getUniqueAlt = function (configs) {
  29361. var alt = ATN.INVALID_ALT_NUMBER;
  29362. for (var i = 0; i < configs.items.length; i++) {
  29363. var c = configs.items[i];
  29364. if (alt === ATN.INVALID_ALT_NUMBER) {
  29365. alt = c.alt; // found first alt
  29366. } else if (c.alt !== alt) {
  29367. return ATN.INVALID_ALT_NUMBER;
  29368. }
  29369. }
  29370. return alt;
  29371. };
  29372. //
  29373. // Add an edge to the DFA, if possible. This method calls
  29374. // {@link //addDFAState} to ensure the {@code to} state is present in the
  29375. // DFA. If {@code from} is {@code null}, or if {@code t} is outside the
  29376. // range of edges that can be represented in the DFA tables, this method
  29377. // returns without adding the edge to the DFA.
  29378. //
  29379. // <p>If {@code to} is {@code null}, this method returns {@code null}.
  29380. // Otherwise, this method returns the {@link DFAState} returned by calling
  29381. // {@link //addDFAState} for the {@code to} state.</p>
  29382. //
  29383. // @param dfa The DFA
  29384. // @param from The source state for the edge
  29385. // @param t The input symbol
  29386. // @param to The target state for the edge
  29387. //
  29388. // @return If {@code to} is {@code null}, this method returns {@code null};
  29389. // otherwise this method returns the result of calling {@link //addDFAState}
  29390. // on {@code to}
  29391. //
  29392. ParserATNSimulator.prototype.addDFAEdge = function (dfa, from_, t, to) {
  29393. if (this.debug) {
  29394. console.log("EDGE " + from_ + " -> " + to + " upon " + this.getTokenName(t));
  29395. }
  29396. if (to === null) {
  29397. return null;
  29398. }
  29399. to = this.addDFAState(dfa, to); // used existing if possible not incoming
  29400. if (from_ === null || t < -1 || t > this.atn.maxTokenType) {
  29401. return to;
  29402. }
  29403. if (from_.edges === null) {
  29404. from_.edges = [];
  29405. }
  29406. from_.edges[t + 1] = to; // connect
  29407. if (this.debug) {
  29408. var literalNames = this.parser === null ? null : this.parser.literalNames;
  29409. var symbolicNames = this.parser === null ? null : this.parser.symbolicNames;
  29410. console.log("DFA=\n" + dfa.toString(literalNames, symbolicNames));
  29411. }
  29412. return to;
  29413. };
  29414. //
  29415. // Add state {@code D} to the DFA if it is not already present, and return
  29416. // the actual instance stored in the DFA. If a state equivalent to {@code D}
  29417. // is already in the DFA, the existing state is returned. Otherwise this
  29418. // method returns {@code D} after adding it to the DFA.
  29419. //
  29420. // <p>If {@code D} is {@link //ERROR}, this method returns {@link //ERROR} and
  29421. // does not change the DFA.</p>
  29422. //
  29423. // @param dfa The dfa
  29424. // @param D The DFA state to add
  29425. // @return The state stored in the DFA. This will be either the existing
  29426. // state if {@code D} is already in the DFA, or {@code D} itself if the
  29427. // state was not already present.
  29428. //
  29429. ParserATNSimulator.prototype.addDFAState = function (dfa, D) {
  29430. if (D == ATNSimulator.ERROR) {
  29431. return D;
  29432. }
  29433. var existing = dfa.states.get(D);
  29434. if (existing !== null) {
  29435. return existing;
  29436. }
  29437. D.stateNumber = dfa.states.length;
  29438. if (!D.configs.readOnly) {
  29439. D.configs.optimizeConfigs(this);
  29440. D.configs.setReadonly(true);
  29441. }
  29442. dfa.states.add(D);
  29443. if (this.debug) {
  29444. console.log("adding new DFA state: " + D);
  29445. }
  29446. return D;
  29447. };
  29448. ParserATNSimulator.prototype.reportAttemptingFullContext = function (dfa, conflictingAlts, configs, startIndex, stopIndex) {
  29449. if (this.debug || this.retry_debug) {
  29450. var interval = new Interval(startIndex, stopIndex + 1);
  29451. console.log("reportAttemptingFullContext decision=" + dfa.decision + ":" + configs + ", input=" + this.parser.getTokenStream().getText(interval));
  29452. }
  29453. if (this.parser !== null) {
  29454. this.parser.getErrorListenerDispatch().reportAttemptingFullContext(this.parser, dfa, startIndex, stopIndex, conflictingAlts, configs);
  29455. }
  29456. };
  29457. ParserATNSimulator.prototype.reportContextSensitivity = function (dfa, prediction, configs, startIndex, stopIndex) {
  29458. if (this.debug || this.retry_debug) {
  29459. var interval = new Interval(startIndex, stopIndex + 1);
  29460. console.log("reportContextSensitivity decision=" + dfa.decision + ":" + configs + ", input=" + this.parser.getTokenStream().getText(interval));
  29461. }
  29462. if (this.parser !== null) {
  29463. this.parser.getErrorListenerDispatch().reportContextSensitivity(this.parser, dfa, startIndex, stopIndex, prediction, configs);
  29464. }
  29465. };
  29466. // If context sensitive parsing, we know it's ambiguity not conflict//
  29467. ParserATNSimulator.prototype.reportAmbiguity = function (dfa, D, startIndex, stopIndex, exact, ambigAlts, configs) {
  29468. if (this.debug || this.retry_debug) {
  29469. var interval = new Interval(startIndex, stopIndex + 1);
  29470. console.log("reportAmbiguity " + ambigAlts + ":" + configs + ", input=" + this.parser.getTokenStream().getText(interval));
  29471. }
  29472. if (this.parser !== null) {
  29473. this.parser.getErrorListenerDispatch().reportAmbiguity(this.parser, dfa, startIndex, stopIndex, exact, ambigAlts, configs);
  29474. }
  29475. };
  29476. exports.ParserATNSimulator = ParserATNSimulator;
  29477. /***/ }),
  29478. /***/ "./node_modules/antlr4/atn/PredictionMode.js":
  29479. /*!***************************************************!*\
  29480. !*** ./node_modules/antlr4/atn/PredictionMode.js ***!
  29481. \***************************************************/
  29482. /*! no static exports found */
  29483. /***/ (function(module, exports, __webpack_require__) {
  29484. "use strict";
  29485. //
  29486. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  29487. * Use of this file is governed by the BSD 3-clause license that
  29488. * can be found in the LICENSE.txt file in the project root.
  29489. */
  29490. //
  29491. //
  29492. // This enumeration defines the prediction modes available in ANTLR 4 along with
  29493. // utility methods for analyzing configuration sets for conflicts and/or
  29494. // ambiguities.
  29495. var Set = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js").Set;
  29496. var Map = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js").Map;
  29497. var BitSet = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js").BitSet;
  29498. var AltDict = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js").AltDict;
  29499. var ATN = __webpack_require__(/*! ./ATN */ "./node_modules/antlr4/atn/ATN.js").ATN;
  29500. var RuleStopState = __webpack_require__(/*! ./ATNState */ "./node_modules/antlr4/atn/ATNState.js").RuleStopState;
  29501. var ATNConfigSet = __webpack_require__(/*! ./ATNConfigSet */ "./node_modules/antlr4/atn/ATNConfigSet.js").ATNConfigSet;
  29502. var ATNConfig = __webpack_require__(/*! ./ATNConfig */ "./node_modules/antlr4/atn/ATNConfig.js").ATNConfig;
  29503. var SemanticContext = __webpack_require__(/*! ./SemanticContext */ "./node_modules/antlr4/atn/SemanticContext.js").SemanticContext;
  29504. var Hash = __webpack_require__(/*! ../Utils */ "./node_modules/antlr4/Utils.js").Hash;
  29505. var hashStuff = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js").hashStuff;
  29506. var equalArrays = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js").equalArrays;
  29507. function PredictionMode() {
  29508. return this;
  29509. }
  29510. //
  29511. // The SLL(*) prediction mode. This prediction mode ignores the current
  29512. // parser context when making predictions. This is the fastest prediction
  29513. // mode, and provides correct results for many grammars. This prediction
  29514. // mode is more powerful than the prediction mode provided by ANTLR 3, but
  29515. // may result in syntax errors for grammar and input combinations which are
  29516. // not SLL.
  29517. //
  29518. // <p>
  29519. // When using this prediction mode, the parser will either return a correct
  29520. // parse tree (i.e. the same parse tree that would be returned with the
  29521. // {@link //LL} prediction mode), or it will report a syntax error. If a
  29522. // syntax error is encountered when using the {@link //SLL} prediction mode,
  29523. // it may be due to either an actual syntax error in the input or indicate
  29524. // that the particular combination of grammar and input requires the more
  29525. // powerful {@link //LL} prediction abilities to complete successfully.</p>
  29526. //
  29527. // <p>
  29528. // This prediction mode does not provide any guarantees for prediction
  29529. // behavior for syntactically-incorrect inputs.</p>
  29530. //
  29531. PredictionMode.SLL = 0;
  29532. //
  29533. // The LL(*) prediction mode. This prediction mode allows the current parser
  29534. // context to be used for resolving SLL conflicts that occur during
  29535. // prediction. This is the fastest prediction mode that guarantees correct
  29536. // parse results for all combinations of grammars with syntactically correct
  29537. // inputs.
  29538. //
  29539. // <p>
  29540. // When using this prediction mode, the parser will make correct decisions
  29541. // for all syntactically-correct grammar and input combinations. However, in
  29542. // cases where the grammar is truly ambiguous this prediction mode might not
  29543. // report a precise answer for <em>exactly which</em> alternatives are
  29544. // ambiguous.</p>
  29545. //
  29546. // <p>
  29547. // This prediction mode does not provide any guarantees for prediction
  29548. // behavior for syntactically-incorrect inputs.</p>
  29549. //
  29550. PredictionMode.LL = 1;
  29551. //
  29552. // The LL(*) prediction mode with exact ambiguity detection. In addition to
  29553. // the correctness guarantees provided by the {@link //LL} prediction mode,
  29554. // this prediction mode instructs the prediction algorithm to determine the
  29555. // complete and exact set of ambiguous alternatives for every ambiguous
  29556. // decision encountered while parsing.
  29557. //
  29558. // <p>
  29559. // This prediction mode may be used for diagnosing ambiguities during
  29560. // grammar development. Due to the performance overhead of calculating sets
  29561. // of ambiguous alternatives, this prediction mode should be avoided when
  29562. // the exact results are not necessary.</p>
  29563. //
  29564. // <p>
  29565. // This prediction mode does not provide any guarantees for prediction
  29566. // behavior for syntactically-incorrect inputs.</p>
  29567. //
  29568. PredictionMode.LL_EXACT_AMBIG_DETECTION = 2;
  29569. //
  29570. // Computes the SLL prediction termination condition.
  29571. //
  29572. // <p>
  29573. // This method computes the SLL prediction termination condition for both of
  29574. // the following cases.</p>
  29575. //
  29576. // <ul>
  29577. // <li>The usual SLL+LL fallback upon SLL conflict</li>
  29578. // <li>Pure SLL without LL fallback</li>
  29579. // </ul>
  29580. //
  29581. // <p><strong>COMBINED SLL+LL PARSING</strong></p>
  29582. //
  29583. // <p>When LL-fallback is enabled upon SLL conflict, correct predictions are
  29584. // ensured regardless of how the termination condition is computed by this
  29585. // method. Due to the substantially higher cost of LL prediction, the
  29586. // prediction should only fall back to LL when the additional lookahead
  29587. // cannot lead to a unique SLL prediction.</p>
  29588. //
  29589. // <p>Assuming combined SLL+LL parsing, an SLL configuration set with only
  29590. // conflicting subsets should fall back to full LL, even if the
  29591. // configuration sets don't resolve to the same alternative (e.g.
  29592. // {@code {1,2}} and {@code {3,4}}. If there is at least one non-conflicting
  29593. // configuration, SLL could continue with the hopes that more lookahead will
  29594. // resolve via one of those non-conflicting configurations.</p>
  29595. //
  29596. // <p>Here's the prediction termination rule them: SLL (for SLL+LL parsing)
  29597. // stops when it sees only conflicting configuration subsets. In contrast,
  29598. // full LL keeps going when there is uncertainty.</p>
  29599. //
  29600. // <p><strong>HEURISTIC</strong></p>
  29601. //
  29602. // <p>As a heuristic, we stop prediction when we see any conflicting subset
  29603. // unless we see a state that only has one alternative associated with it.
  29604. // The single-alt-state thing lets prediction continue upon rules like
  29605. // (otherwise, it would admit defeat too soon):</p>
  29606. //
  29607. // <p>{@code [12|1|[], 6|2|[], 12|2|[]]. s : (ID | ID ID?) ';' ;}</p>
  29608. //
  29609. // <p>When the ATN simulation reaches the state before {@code ';'}, it has a
  29610. // DFA state that looks like: {@code [12|1|[], 6|2|[], 12|2|[]]}. Naturally
  29611. // {@code 12|1|[]} and {@code 12|2|[]} conflict, but we cannot stop
  29612. // processing this node because alternative to has another way to continue,
  29613. // via {@code [6|2|[]]}.</p>
  29614. //
  29615. // <p>It also let's us continue for this rule:</p>
  29616. //
  29617. // <p>{@code [1|1|[], 1|2|[], 8|3|[]] a : A | A | A B ;}</p>
  29618. //
  29619. // <p>After matching input A, we reach the stop state for rule A, state 1.
  29620. // State 8 is the state right before B. Clearly alternatives 1 and 2
  29621. // conflict and no amount of further lookahead will separate the two.
  29622. // However, alternative 3 will be able to continue and so we do not stop
  29623. // working on this state. In the previous example, we're concerned with
  29624. // states associated with the conflicting alternatives. Here alt 3 is not
  29625. // associated with the conflicting configs, but since we can continue
  29626. // looking for input reasonably, don't declare the state done.</p>
  29627. //
  29628. // <p><strong>PURE SLL PARSING</strong></p>
  29629. //
  29630. // <p>To handle pure SLL parsing, all we have to do is make sure that we
  29631. // combine stack contexts for configurations that differ only by semantic
  29632. // predicate. From there, we can do the usual SLL termination heuristic.</p>
  29633. //
  29634. // <p><strong>PREDICATES IN SLL+LL PARSING</strong></p>
  29635. //
  29636. // <p>SLL decisions don't evaluate predicates until after they reach DFA stop
  29637. // states because they need to create the DFA cache that works in all
  29638. // semantic situations. In contrast, full LL evaluates predicates collected
  29639. // during start state computation so it can ignore predicates thereafter.
  29640. // This means that SLL termination detection can totally ignore semantic
  29641. // predicates.</p>
  29642. //
  29643. // <p>Implementation-wise, {@link ATNConfigSet} combines stack contexts but not
  29644. // semantic predicate contexts so we might see two configurations like the
  29645. // following.</p>
  29646. //
  29647. // <p>{@code (s, 1, x, {}), (s, 1, x', {p})}</p>
  29648. //
  29649. // <p>Before testing these configurations against others, we have to merge
  29650. // {@code x} and {@code x'} (without modifying the existing configurations).
  29651. // For example, we test {@code (x+x')==x''} when looking for conflicts in
  29652. // the following configurations.</p>
  29653. //
  29654. // <p>{@code (s, 1, x, {}), (s, 1, x', {p}), (s, 2, x'', {})}</p>
  29655. //
  29656. // <p>If the configuration set has predicates (as indicated by
  29657. // {@link ATNConfigSet//hasSemanticContext}), this algorithm makes a copy of
  29658. // the configurations to strip out all of the predicates so that a standard
  29659. // {@link ATNConfigSet} will merge everything ignoring predicates.</p>
  29660. //
  29661. PredictionMode.hasSLLConflictTerminatingPrediction = function (mode, configs) {
  29662. // Configs in rule stop states indicate reaching the end of the decision
  29663. // rule (local context) or end of start rule (full context). If all
  29664. // configs meet this condition, then none of the configurations is able
  29665. // to match additional input so we terminate prediction.
  29666. //
  29667. if (PredictionMode.allConfigsInRuleStopStates(configs)) {
  29668. return true;
  29669. }
  29670. // pure SLL mode parsing
  29671. if (mode === PredictionMode.SLL) {
  29672. // Don't bother with combining configs from different semantic
  29673. // contexts if we can fail over to full LL; costs more time
  29674. // since we'll often fail over anyway.
  29675. if (configs.hasSemanticContext) {
  29676. // dup configs, tossing out semantic predicates
  29677. var dup = new ATNConfigSet();
  29678. for (var i = 0; i < configs.items.length; i++) {
  29679. var c = configs.items[i];
  29680. c = new ATNConfig({ semanticContext: SemanticContext.NONE }, c);
  29681. dup.add(c);
  29682. }
  29683. configs = dup;
  29684. }
  29685. // now we have combined contexts for configs with dissimilar preds
  29686. }
  29687. // pure SLL or combined SLL+LL mode parsing
  29688. var altsets = PredictionMode.getConflictingAltSubsets(configs);
  29689. return PredictionMode.hasConflictingAltSet(altsets) && !PredictionMode.hasStateAssociatedWithOneAlt(configs);
  29690. };
  29691. // Checks if any configuration in {@code configs} is in a
  29692. // {@link RuleStopState}. Configurations meeting this condition have reached
  29693. // the end of the decision rule (local context) or end of start rule (full
  29694. // context).
  29695. //
  29696. // @param configs the configuration set to test
  29697. // @return {@code true} if any configuration in {@code configs} is in a
  29698. // {@link RuleStopState}, otherwise {@code false}
  29699. PredictionMode.hasConfigInRuleStopState = function (configs) {
  29700. for (var i = 0; i < configs.items.length; i++) {
  29701. var c = configs.items[i];
  29702. if (c.state instanceof RuleStopState) {
  29703. return true;
  29704. }
  29705. }
  29706. return false;
  29707. };
  29708. // Checks if all configurations in {@code configs} are in a
  29709. // {@link RuleStopState}. Configurations meeting this condition have reached
  29710. // the end of the decision rule (local context) or end of start rule (full
  29711. // context).
  29712. //
  29713. // @param configs the configuration set to test
  29714. // @return {@code true} if all configurations in {@code configs} are in a
  29715. // {@link RuleStopState}, otherwise {@code false}
  29716. PredictionMode.allConfigsInRuleStopStates = function (configs) {
  29717. for (var i = 0; i < configs.items.length; i++) {
  29718. var c = configs.items[i];
  29719. if (!(c.state instanceof RuleStopState)) {
  29720. return false;
  29721. }
  29722. }
  29723. return true;
  29724. };
  29725. //
  29726. // Full LL prediction termination.
  29727. //
  29728. // <p>Can we stop looking ahead during ATN simulation or is there some
  29729. // uncertainty as to which alternative we will ultimately pick, after
  29730. // consuming more input? Even if there are partial conflicts, we might know
  29731. // that everything is going to resolve to the same minimum alternative. That
  29732. // means we can stop since no more lookahead will change that fact. On the
  29733. // other hand, there might be multiple conflicts that resolve to different
  29734. // minimums. That means we need more look ahead to decide which of those
  29735. // alternatives we should predict.</p>
  29736. //
  29737. // <p>The basic idea is to split the set of configurations {@code C}, into
  29738. // conflicting subsets {@code (s, _, ctx, _)} and singleton subsets with
  29739. // non-conflicting configurations. Two configurations conflict if they have
  29740. // identical {@link ATNConfig//state} and {@link ATNConfig//context} values
  29741. // but different {@link ATNConfig//alt} value, e.g. {@code (s, i, ctx, _)}
  29742. // and {@code (s, j, ctx, _)} for {@code i!=j}.</p>
  29743. //
  29744. // <p>Reduce these configuration subsets to the set of possible alternatives.
  29745. // You can compute the alternative subsets in one pass as follows:</p>
  29746. //
  29747. // <p>{@code A_s,ctx = {i | (s, i, ctx, _)}} for each configuration in
  29748. // {@code C} holding {@code s} and {@code ctx} fixed.</p>
  29749. //
  29750. // <p>Or in pseudo-code, for each configuration {@code c} in {@code C}:</p>
  29751. //
  29752. // <pre>
  29753. // map[c] U= c.{@link ATNConfig//alt alt} // map hash/equals uses s and x, not
  29754. // alt and not pred
  29755. // </pre>
  29756. //
  29757. // <p>The values in {@code map} are the set of {@code A_s,ctx} sets.</p>
  29758. //
  29759. // <p>If {@code |A_s,ctx|=1} then there is no conflict associated with
  29760. // {@code s} and {@code ctx}.</p>
  29761. //
  29762. // <p>Reduce the subsets to singletons by choosing a minimum of each subset. If
  29763. // the union of these alternative subsets is a singleton, then no amount of
  29764. // more lookahead will help us. We will always pick that alternative. If,
  29765. // however, there is more than one alternative, then we are uncertain which
  29766. // alternative to predict and must continue looking for resolution. We may
  29767. // or may not discover an ambiguity in the future, even if there are no
  29768. // conflicting subsets this round.</p>
  29769. //
  29770. // <p>The biggest sin is to terminate early because it means we've made a
  29771. // decision but were uncertain as to the eventual outcome. We haven't used
  29772. // enough lookahead. On the other hand, announcing a conflict too late is no
  29773. // big deal; you will still have the conflict. It's just inefficient. It
  29774. // might even look until the end of file.</p>
  29775. //
  29776. // <p>No special consideration for semantic predicates is required because
  29777. // predicates are evaluated on-the-fly for full LL prediction, ensuring that
  29778. // no configuration contains a semantic context during the termination
  29779. // check.</p>
  29780. //
  29781. // <p><strong>CONFLICTING CONFIGS</strong></p>
  29782. //
  29783. // <p>Two configurations {@code (s, i, x)} and {@code (s, j, x')}, conflict
  29784. // when {@code i!=j} but {@code x=x'}. Because we merge all
  29785. // {@code (s, i, _)} configurations together, that means that there are at
  29786. // most {@code n} configurations associated with state {@code s} for
  29787. // {@code n} possible alternatives in the decision. The merged stacks
  29788. // complicate the comparison of configuration contexts {@code x} and
  29789. // {@code x'}. Sam checks to see if one is a subset of the other by calling
  29790. // merge and checking to see if the merged result is either {@code x} or
  29791. // {@code x'}. If the {@code x} associated with lowest alternative {@code i}
  29792. // is the superset, then {@code i} is the only possible prediction since the
  29793. // others resolve to {@code min(i)} as well. However, if {@code x} is
  29794. // associated with {@code j>i} then at least one stack configuration for
  29795. // {@code j} is not in conflict with alternative {@code i}. The algorithm
  29796. // should keep going, looking for more lookahead due to the uncertainty.</p>
  29797. //
  29798. // <p>For simplicity, I'm doing a equality check between {@code x} and
  29799. // {@code x'} that lets the algorithm continue to consume lookahead longer
  29800. // than necessary. The reason I like the equality is of course the
  29801. // simplicity but also because that is the test you need to detect the
  29802. // alternatives that are actually in conflict.</p>
  29803. //
  29804. // <p><strong>CONTINUE/STOP RULE</strong></p>
  29805. //
  29806. // <p>Continue if union of resolved alternative sets from non-conflicting and
  29807. // conflicting alternative subsets has more than one alternative. We are
  29808. // uncertain about which alternative to predict.</p>
  29809. //
  29810. // <p>The complete set of alternatives, {@code [i for (_,i,_)]}, tells us which
  29811. // alternatives are still in the running for the amount of input we've
  29812. // consumed at this point. The conflicting sets let us to strip away
  29813. // configurations that won't lead to more states because we resolve
  29814. // conflicts to the configuration with a minimum alternate for the
  29815. // conflicting set.</p>
  29816. //
  29817. // <p><strong>CASES</strong></p>
  29818. //
  29819. // <ul>
  29820. //
  29821. // <li>no conflicts and more than 1 alternative in set =&gt; continue</li>
  29822. //
  29823. // <li> {@code (s, 1, x)}, {@code (s, 2, x)}, {@code (s, 3, z)},
  29824. // {@code (s', 1, y)}, {@code (s', 2, y)} yields non-conflicting set
  29825. // {@code {3}} U conflicting sets {@code min({1,2})} U {@code min({1,2})} =
  29826. // {@code {1,3}} =&gt; continue
  29827. // </li>
  29828. //
  29829. // <li>{@code (s, 1, x)}, {@code (s, 2, x)}, {@code (s', 1, y)},
  29830. // {@code (s', 2, y)}, {@code (s'', 1, z)} yields non-conflicting set
  29831. // {@code {1}} U conflicting sets {@code min({1,2})} U {@code min({1,2})} =
  29832. // {@code {1}} =&gt; stop and predict 1</li>
  29833. //
  29834. // <li>{@code (s, 1, x)}, {@code (s, 2, x)}, {@code (s', 1, y)},
  29835. // {@code (s', 2, y)} yields conflicting, reduced sets {@code {1}} U
  29836. // {@code {1}} = {@code {1}} =&gt; stop and predict 1, can announce
  29837. // ambiguity {@code {1,2}}</li>
  29838. //
  29839. // <li>{@code (s, 1, x)}, {@code (s, 2, x)}, {@code (s', 2, y)},
  29840. // {@code (s', 3, y)} yields conflicting, reduced sets {@code {1}} U
  29841. // {@code {2}} = {@code {1,2}} =&gt; continue</li>
  29842. //
  29843. // <li>{@code (s, 1, x)}, {@code (s, 2, x)}, {@code (s', 3, y)},
  29844. // {@code (s', 4, y)} yields conflicting, reduced sets {@code {1}} U
  29845. // {@code {3}} = {@code {1,3}} =&gt; continue</li>
  29846. //
  29847. // </ul>
  29848. //
  29849. // <p><strong>EXACT AMBIGUITY DETECTION</strong></p>
  29850. //
  29851. // <p>If all states report the same conflicting set of alternatives, then we
  29852. // know we have the exact ambiguity set.</p>
  29853. //
  29854. // <p><code>|A_<em>i</em>|&gt;1</code> and
  29855. // <code>A_<em>i</em> = A_<em>j</em></code> for all <em>i</em>, <em>j</em>.</p>
  29856. //
  29857. // <p>In other words, we continue examining lookahead until all {@code A_i}
  29858. // have more than one alternative and all {@code A_i} are the same. If
  29859. // {@code A={{1,2}, {1,3}}}, then regular LL prediction would terminate
  29860. // because the resolved set is {@code {1}}. To determine what the real
  29861. // ambiguity is, we have to know whether the ambiguity is between one and
  29862. // two or one and three so we keep going. We can only stop prediction when
  29863. // we need exact ambiguity detection when the sets look like
  29864. // {@code A={{1,2}}} or {@code {{1,2},{1,2}}}, etc...</p>
  29865. //
  29866. PredictionMode.resolvesToJustOneViableAlt = function (altsets) {
  29867. return PredictionMode.getSingleViableAlt(altsets);
  29868. };
  29869. //
  29870. // Determines if every alternative subset in {@code altsets} contains more
  29871. // than one alternative.
  29872. //
  29873. // @param altsets a collection of alternative subsets
  29874. // @return {@code true} if every {@link BitSet} in {@code altsets} has
  29875. // {@link BitSet//cardinality cardinality} &gt; 1, otherwise {@code false}
  29876. //
  29877. PredictionMode.allSubsetsConflict = function (altsets) {
  29878. return !PredictionMode.hasNonConflictingAltSet(altsets);
  29879. };
  29880. //
  29881. // Determines if any single alternative subset in {@code altsets} contains
  29882. // exactly one alternative.
  29883. //
  29884. // @param altsets a collection of alternative subsets
  29885. // @return {@code true} if {@code altsets} contains a {@link BitSet} with
  29886. // {@link BitSet//cardinality cardinality} 1, otherwise {@code false}
  29887. //
  29888. PredictionMode.hasNonConflictingAltSet = function (altsets) {
  29889. for (var i = 0; i < altsets.length; i++) {
  29890. var alts = altsets[i];
  29891. if (alts.length === 1) {
  29892. return true;
  29893. }
  29894. }
  29895. return false;
  29896. };
  29897. //
  29898. // Determines if any single alternative subset in {@code altsets} contains
  29899. // more than one alternative.
  29900. //
  29901. // @param altsets a collection of alternative subsets
  29902. // @return {@code true} if {@code altsets} contains a {@link BitSet} with
  29903. // {@link BitSet//cardinality cardinality} &gt; 1, otherwise {@code false}
  29904. //
  29905. PredictionMode.hasConflictingAltSet = function (altsets) {
  29906. for (var i = 0; i < altsets.length; i++) {
  29907. var alts = altsets[i];
  29908. if (alts.length > 1) {
  29909. return true;
  29910. }
  29911. }
  29912. return false;
  29913. };
  29914. //
  29915. // Determines if every alternative subset in {@code altsets} is equivalent.
  29916. //
  29917. // @param altsets a collection of alternative subsets
  29918. // @return {@code true} if every member of {@code altsets} is equal to the
  29919. // others, otherwise {@code false}
  29920. //
  29921. PredictionMode.allSubsetsEqual = function (altsets) {
  29922. var first = null;
  29923. for (var i = 0; i < altsets.length; i++) {
  29924. var alts = altsets[i];
  29925. if (first === null) {
  29926. first = alts;
  29927. } else if (alts !== first) {
  29928. return false;
  29929. }
  29930. }
  29931. return true;
  29932. };
  29933. //
  29934. // Returns the unique alternative predicted by all alternative subsets in
  29935. // {@code altsets}. If no such alternative exists, this method returns
  29936. // {@link ATN//INVALID_ALT_NUMBER}.
  29937. //
  29938. // @param altsets a collection of alternative subsets
  29939. //
  29940. PredictionMode.getUniqueAlt = function (altsets) {
  29941. var all = PredictionMode.getAlts(altsets);
  29942. if (all.length === 1) {
  29943. return all.minValue();
  29944. } else {
  29945. return ATN.INVALID_ALT_NUMBER;
  29946. }
  29947. };
  29948. // Gets the complete set of represented alternatives for a collection of
  29949. // alternative subsets. This method returns the union of each {@link BitSet}
  29950. // in {@code altsets}.
  29951. //
  29952. // @param altsets a collection of alternative subsets
  29953. // @return the set of represented alternatives in {@code altsets}
  29954. //
  29955. PredictionMode.getAlts = function (altsets) {
  29956. var all = new BitSet();
  29957. altsets.map(function (alts) {
  29958. all.or(alts);
  29959. });
  29960. return all;
  29961. };
  29962. //
  29963. // This function gets the conflicting alt subsets from a configuration set.
  29964. // For each configuration {@code c} in {@code configs}:
  29965. //
  29966. // <pre>
  29967. // map[c] U= c.{@link ATNConfig//alt alt} // map hash/equals uses s and x, not
  29968. // alt and not pred
  29969. // </pre>
  29970. PredictionMode.getConflictingAltSubsets = function (configs) {
  29971. var configToAlts = new Map();
  29972. configToAlts.hashFunction = function (cfg) {
  29973. hashStuff(cfg.state.stateNumber, cfg.context);
  29974. };
  29975. configToAlts.equalsFunction = function (c1, c2) {
  29976. return c1.state.stateNumber == c2.state.stateNumber && c1.context.equals(c2.context);
  29977. };
  29978. configs.items.map(function (cfg) {
  29979. var alts = configToAlts.get(cfg);
  29980. if (alts === null) {
  29981. alts = new BitSet();
  29982. configToAlts.put(cfg, alts);
  29983. }
  29984. alts.add(cfg.alt);
  29985. });
  29986. return configToAlts.getValues();
  29987. };
  29988. //
  29989. // Get a map from state to alt subset from a configuration set. For each
  29990. // configuration {@code c} in {@code configs}:
  29991. //
  29992. // <pre>
  29993. // map[c.{@link ATNConfig//state state}] U= c.{@link ATNConfig//alt alt}
  29994. // </pre>
  29995. //
  29996. PredictionMode.getStateToAltMap = function (configs) {
  29997. var m = new AltDict();
  29998. configs.items.map(function (c) {
  29999. var alts = m.get(c.state);
  30000. if (alts === null) {
  30001. alts = new BitSet();
  30002. m.put(c.state, alts);
  30003. }
  30004. alts.add(c.alt);
  30005. });
  30006. return m;
  30007. };
  30008. PredictionMode.hasStateAssociatedWithOneAlt = function (configs) {
  30009. var values = PredictionMode.getStateToAltMap(configs).values();
  30010. for (var i = 0; i < values.length; i++) {
  30011. if (values[i].length === 1) {
  30012. return true;
  30013. }
  30014. }
  30015. return false;
  30016. };
  30017. PredictionMode.getSingleViableAlt = function (altsets) {
  30018. var result = null;
  30019. for (var i = 0; i < altsets.length; i++) {
  30020. var alts = altsets[i];
  30021. var minAlt = alts.minValue();
  30022. if (result === null) {
  30023. result = minAlt;
  30024. } else if (result !== minAlt) {
  30025. // more than 1 viable alt
  30026. return ATN.INVALID_ALT_NUMBER;
  30027. }
  30028. }
  30029. return result;
  30030. };
  30031. exports.PredictionMode = PredictionMode;
  30032. /***/ }),
  30033. /***/ "./node_modules/antlr4/atn/SemanticContext.js":
  30034. /*!****************************************************!*\
  30035. !*** ./node_modules/antlr4/atn/SemanticContext.js ***!
  30036. \****************************************************/
  30037. /*! no static exports found */
  30038. /***/ (function(module, exports, __webpack_require__) {
  30039. "use strict";
  30040. //
  30041. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  30042. * Use of this file is governed by the BSD 3-clause license that
  30043. * can be found in the LICENSE.txt file in the project root.
  30044. */
  30045. //
  30046. // A tree structure used to record the semantic context in which
  30047. // an ATN configuration is valid. It's either a single predicate,
  30048. // a conjunction {@code p1&&p2}, or a sum of products {@code p1||p2}.
  30049. //
  30050. // <p>I have scoped the {@link AND}, {@link OR}, and {@link Predicate} subclasses of
  30051. // {@link SemanticContext} within the scope of this outer class.</p>
  30052. //
  30053. var Set = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js").Set;
  30054. var Hash = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js").Hash;
  30055. function SemanticContext() {
  30056. return this;
  30057. }
  30058. SemanticContext.prototype.hashCode = function () {
  30059. var hash = new Hash();
  30060. this.updateHashCode(hash);
  30061. return hash.finish();
  30062. };
  30063. // For context independent predicates, we evaluate them without a local
  30064. // context (i.e., null context). That way, we can evaluate them without
  30065. // having to create proper rule-specific context during prediction (as
  30066. // opposed to the parser, which creates them naturally). In a practical
  30067. // sense, this avoids a cast exception from RuleContext to myruleContext.
  30068. //
  30069. // <p>For context dependent predicates, we must pass in a local context so that
  30070. // references such as $arg evaluate properly as _localctx.arg. We only
  30071. // capture context dependent predicates in the context in which we begin
  30072. // prediction, so we passed in the outer context here in case of context
  30073. // dependent predicate evaluation.</p>
  30074. //
  30075. SemanticContext.prototype.evaluate = function (parser, outerContext) {};
  30076. //
  30077. // Evaluate the precedence predicates for the context and reduce the result.
  30078. //
  30079. // @param parser The parser instance.
  30080. // @param outerContext The current parser context object.
  30081. // @return The simplified semantic context after precedence predicates are
  30082. // evaluated, which will be one of the following values.
  30083. // <ul>
  30084. // <li>{@link //NONE}: if the predicate simplifies to {@code true} after
  30085. // precedence predicates are evaluated.</li>
  30086. // <li>{@code null}: if the predicate simplifies to {@code false} after
  30087. // precedence predicates are evaluated.</li>
  30088. // <li>{@code this}: if the semantic context is not changed as a result of
  30089. // precedence predicate evaluation.</li>
  30090. // <li>A non-{@code null} {@link SemanticContext}: the new simplified
  30091. // semantic context after precedence predicates are evaluated.</li>
  30092. // </ul>
  30093. //
  30094. SemanticContext.prototype.evalPrecedence = function (parser, outerContext) {
  30095. return this;
  30096. };
  30097. SemanticContext.andContext = function (a, b) {
  30098. if (a === null || a === SemanticContext.NONE) {
  30099. return b;
  30100. }
  30101. if (b === null || b === SemanticContext.NONE) {
  30102. return a;
  30103. }
  30104. var result = new AND(a, b);
  30105. if (result.opnds.length === 1) {
  30106. return result.opnds[0];
  30107. } else {
  30108. return result;
  30109. }
  30110. };
  30111. SemanticContext.orContext = function (a, b) {
  30112. if (a === null) {
  30113. return b;
  30114. }
  30115. if (b === null) {
  30116. return a;
  30117. }
  30118. if (a === SemanticContext.NONE || b === SemanticContext.NONE) {
  30119. return SemanticContext.NONE;
  30120. }
  30121. var result = new OR(a, b);
  30122. if (result.opnds.length === 1) {
  30123. return result.opnds[0];
  30124. } else {
  30125. return result;
  30126. }
  30127. };
  30128. function Predicate(ruleIndex, predIndex, isCtxDependent) {
  30129. SemanticContext.call(this);
  30130. this.ruleIndex = ruleIndex === undefined ? -1 : ruleIndex;
  30131. this.predIndex = predIndex === undefined ? -1 : predIndex;
  30132. this.isCtxDependent = isCtxDependent === undefined ? false : isCtxDependent; // e.g., $i ref in pred
  30133. return this;
  30134. }
  30135. Predicate.prototype = Object.create(SemanticContext.prototype);
  30136. Predicate.prototype.constructor = Predicate;
  30137. //The default {@link SemanticContext}, which is semantically equivalent to
  30138. //a predicate of the form {@code {true}?}.
  30139. //
  30140. SemanticContext.NONE = new Predicate();
  30141. Predicate.prototype.evaluate = function (parser, outerContext) {
  30142. var localctx = this.isCtxDependent ? outerContext : null;
  30143. return parser.sempred(localctx, this.ruleIndex, this.predIndex);
  30144. };
  30145. Predicate.prototype.updateHashCode = function (hash) {
  30146. hash.update(this.ruleIndex, this.predIndex, this.isCtxDependent);
  30147. };
  30148. Predicate.prototype.equals = function (other) {
  30149. if (this === other) {
  30150. return true;
  30151. } else if (!(other instanceof Predicate)) {
  30152. return false;
  30153. } else {
  30154. return this.ruleIndex === other.ruleIndex && this.predIndex === other.predIndex && this.isCtxDependent === other.isCtxDependent;
  30155. }
  30156. };
  30157. Predicate.prototype.toString = function () {
  30158. return "{" + this.ruleIndex + ":" + this.predIndex + "}?";
  30159. };
  30160. function PrecedencePredicate(precedence) {
  30161. SemanticContext.call(this);
  30162. this.precedence = precedence === undefined ? 0 : precedence;
  30163. }
  30164. PrecedencePredicate.prototype = Object.create(SemanticContext.prototype);
  30165. PrecedencePredicate.prototype.constructor = PrecedencePredicate;
  30166. PrecedencePredicate.prototype.evaluate = function (parser, outerContext) {
  30167. return parser.precpred(outerContext, this.precedence);
  30168. };
  30169. PrecedencePredicate.prototype.evalPrecedence = function (parser, outerContext) {
  30170. if (parser.precpred(outerContext, this.precedence)) {
  30171. return SemanticContext.NONE;
  30172. } else {
  30173. return null;
  30174. }
  30175. };
  30176. PrecedencePredicate.prototype.compareTo = function (other) {
  30177. return this.precedence - other.precedence;
  30178. };
  30179. PrecedencePredicate.prototype.updateHashCode = function (hash) {
  30180. hash.update(31);
  30181. };
  30182. PrecedencePredicate.prototype.equals = function (other) {
  30183. if (this === other) {
  30184. return true;
  30185. } else if (!(other instanceof PrecedencePredicate)) {
  30186. return false;
  30187. } else {
  30188. return this.precedence === other.precedence;
  30189. }
  30190. };
  30191. PrecedencePredicate.prototype.toString = function () {
  30192. return "{" + this.precedence + ">=prec}?";
  30193. };
  30194. PrecedencePredicate.filterPrecedencePredicates = function (set) {
  30195. var result = [];
  30196. set.values().map(function (context) {
  30197. if (context instanceof PrecedencePredicate) {
  30198. result.push(context);
  30199. }
  30200. });
  30201. return result;
  30202. };
  30203. // A semantic context which is true whenever none of the contained contexts
  30204. // is false.
  30205. //
  30206. function AND(a, b) {
  30207. SemanticContext.call(this);
  30208. var operands = new Set();
  30209. if (a instanceof AND) {
  30210. a.opnds.map(function (o) {
  30211. operands.add(o);
  30212. });
  30213. } else {
  30214. operands.add(a);
  30215. }
  30216. if (b instanceof AND) {
  30217. b.opnds.map(function (o) {
  30218. operands.add(o);
  30219. });
  30220. } else {
  30221. operands.add(b);
  30222. }
  30223. var precedencePredicates = PrecedencePredicate.filterPrecedencePredicates(operands);
  30224. if (precedencePredicates.length > 0) {
  30225. // interested in the transition with the lowest precedence
  30226. var reduced = null;
  30227. precedencePredicates.map(function (p) {
  30228. if (reduced === null || p.precedence < reduced.precedence) {
  30229. reduced = p;
  30230. }
  30231. });
  30232. operands.add(reduced);
  30233. }
  30234. this.opnds = operands.values();
  30235. return this;
  30236. }
  30237. AND.prototype = Object.create(SemanticContext.prototype);
  30238. AND.prototype.constructor = AND;
  30239. AND.prototype.equals = function (other) {
  30240. if (this === other) {
  30241. return true;
  30242. } else if (!(other instanceof AND)) {
  30243. return false;
  30244. } else {
  30245. return this.opnds === other.opnds;
  30246. }
  30247. };
  30248. AND.prototype.updateHashCode = function (hash) {
  30249. hash.update(this.opnds, "AND");
  30250. };
  30251. //
  30252. // {@inheritDoc}
  30253. //
  30254. // <p>
  30255. // The evaluation of predicates by this context is short-circuiting, but
  30256. // unordered.</p>
  30257. //
  30258. AND.prototype.evaluate = function (parser, outerContext) {
  30259. for (var i = 0; i < this.opnds.length; i++) {
  30260. if (!this.opnds[i].evaluate(parser, outerContext)) {
  30261. return false;
  30262. }
  30263. }
  30264. return true;
  30265. };
  30266. AND.prototype.evalPrecedence = function (parser, outerContext) {
  30267. var differs = false;
  30268. var operands = [];
  30269. for (var i = 0; i < this.opnds.length; i++) {
  30270. var context = this.opnds[i];
  30271. var evaluated = context.evalPrecedence(parser, outerContext);
  30272. differs |= evaluated !== context;
  30273. if (evaluated === null) {
  30274. // The AND context is false if any element is false
  30275. return null;
  30276. } else if (evaluated !== SemanticContext.NONE) {
  30277. // Reduce the result by skipping true elements
  30278. operands.push(evaluated);
  30279. }
  30280. }
  30281. if (!differs) {
  30282. return this;
  30283. }
  30284. if (operands.length === 0) {
  30285. // all elements were true, so the AND context is true
  30286. return SemanticContext.NONE;
  30287. }
  30288. var result = null;
  30289. operands.map(function (o) {
  30290. result = result === null ? o : SemanticContext.andContext(result, o);
  30291. });
  30292. return result;
  30293. };
  30294. AND.prototype.toString = function () {
  30295. var s = "";
  30296. this.opnds.map(function (o) {
  30297. s += "&& " + o.toString();
  30298. });
  30299. return s.length > 3 ? s.slice(3) : s;
  30300. };
  30301. //
  30302. // A semantic context which is true whenever at least one of the contained
  30303. // contexts is true.
  30304. //
  30305. function OR(a, b) {
  30306. SemanticContext.call(this);
  30307. var operands = new Set();
  30308. if (a instanceof OR) {
  30309. a.opnds.map(function (o) {
  30310. operands.add(o);
  30311. });
  30312. } else {
  30313. operands.add(a);
  30314. }
  30315. if (b instanceof OR) {
  30316. b.opnds.map(function (o) {
  30317. operands.add(o);
  30318. });
  30319. } else {
  30320. operands.add(b);
  30321. }
  30322. var precedencePredicates = PrecedencePredicate.filterPrecedencePredicates(operands);
  30323. if (precedencePredicates.length > 0) {
  30324. // interested in the transition with the highest precedence
  30325. var s = precedencePredicates.sort(function (a, b) {
  30326. return a.compareTo(b);
  30327. });
  30328. var reduced = s[s.length - 1];
  30329. operands.add(reduced);
  30330. }
  30331. this.opnds = operands.values();
  30332. return this;
  30333. }
  30334. OR.prototype = Object.create(SemanticContext.prototype);
  30335. OR.prototype.constructor = OR;
  30336. OR.prototype.constructor = function (other) {
  30337. if (this === other) {
  30338. return true;
  30339. } else if (!(other instanceof OR)) {
  30340. return false;
  30341. } else {
  30342. return this.opnds === other.opnds;
  30343. }
  30344. };
  30345. OR.prototype.updateHashCode = function (hash) {
  30346. hash.update(this.opnds, "OR");
  30347. };
  30348. // <p>
  30349. // The evaluation of predicates by this context is short-circuiting, but
  30350. // unordered.</p>
  30351. //
  30352. OR.prototype.evaluate = function (parser, outerContext) {
  30353. for (var i = 0; i < this.opnds.length; i++) {
  30354. if (this.opnds[i].evaluate(parser, outerContext)) {
  30355. return true;
  30356. }
  30357. }
  30358. return false;
  30359. };
  30360. OR.prototype.evalPrecedence = function (parser, outerContext) {
  30361. var differs = false;
  30362. var operands = [];
  30363. for (var i = 0; i < this.opnds.length; i++) {
  30364. var context = this.opnds[i];
  30365. var evaluated = context.evalPrecedence(parser, outerContext);
  30366. differs |= evaluated !== context;
  30367. if (evaluated === SemanticContext.NONE) {
  30368. // The OR context is true if any element is true
  30369. return SemanticContext.NONE;
  30370. } else if (evaluated !== null) {
  30371. // Reduce the result by skipping false elements
  30372. operands.push(evaluated);
  30373. }
  30374. }
  30375. if (!differs) {
  30376. return this;
  30377. }
  30378. if (operands.length === 0) {
  30379. // all elements were false, so the OR context is false
  30380. return null;
  30381. }
  30382. var result = null;
  30383. operands.map(function (o) {
  30384. return result === null ? o : SemanticContext.orContext(result, o);
  30385. });
  30386. return result;
  30387. };
  30388. OR.prototype.toString = function () {
  30389. var s = "";
  30390. this.opnds.map(function (o) {
  30391. s += "|| " + o.toString();
  30392. });
  30393. return s.length > 3 ? s.slice(3) : s;
  30394. };
  30395. exports.SemanticContext = SemanticContext;
  30396. exports.PrecedencePredicate = PrecedencePredicate;
  30397. exports.Predicate = Predicate;
  30398. /***/ }),
  30399. /***/ "./node_modules/antlr4/atn/Transition.js":
  30400. /*!***********************************************!*\
  30401. !*** ./node_modules/antlr4/atn/Transition.js ***!
  30402. \***********************************************/
  30403. /*! no static exports found */
  30404. /***/ (function(module, exports, __webpack_require__) {
  30405. "use strict";
  30406. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  30407. * Use of this file is governed by the BSD 3-clause license that
  30408. * can be found in the LICENSE.txt file in the project root.
  30409. */
  30410. //
  30411. // An ATN transition between any two ATN states. Subclasses define
  30412. // atom, set, epsilon, action, predicate, rule transitions.
  30413. //
  30414. // <p>This is a one way link. It emanates from a state (usually via a list of
  30415. // transitions) and has a target state.</p>
  30416. //
  30417. // <p>Since we never have to change the ATN transitions once we construct it,
  30418. // we can fix these transitions as specific classes. The DFA transitions
  30419. // on the other hand need to update the labels as it adds transitions to
  30420. // the states. We'll use the term Edge for the DFA to distinguish them from
  30421. // ATN transitions.</p>
  30422. var Token = __webpack_require__(/*! ./../Token */ "./node_modules/antlr4/Token.js").Token;
  30423. var Interval = __webpack_require__(/*! ./../IntervalSet */ "./node_modules/antlr4/IntervalSet.js").Interval;
  30424. var IntervalSet = __webpack_require__(/*! ./../IntervalSet */ "./node_modules/antlr4/IntervalSet.js").IntervalSet;
  30425. var Predicate = __webpack_require__(/*! ./SemanticContext */ "./node_modules/antlr4/atn/SemanticContext.js").Predicate;
  30426. var PrecedencePredicate = __webpack_require__(/*! ./SemanticContext */ "./node_modules/antlr4/atn/SemanticContext.js").PrecedencePredicate;
  30427. function Transition(target) {
  30428. // The target of this transition.
  30429. if (target === undefined || target === null) {
  30430. throw "target cannot be null.";
  30431. }
  30432. this.target = target;
  30433. // Are we epsilon, action, sempred?
  30434. this.isEpsilon = false;
  30435. this.label = null;
  30436. return this;
  30437. }
  30438. // constants for serialization
  30439. Transition.EPSILON = 1;
  30440. Transition.RANGE = 2;
  30441. Transition.RULE = 3;
  30442. Transition.PREDICATE = 4; // e.g., {isType(input.LT(1))}?
  30443. Transition.ATOM = 5;
  30444. Transition.ACTION = 6;
  30445. Transition.SET = 7; // ~(A|B) or ~atom, wildcard, which convert to next 2
  30446. Transition.NOT_SET = 8;
  30447. Transition.WILDCARD = 9;
  30448. Transition.PRECEDENCE = 10;
  30449. Transition.serializationNames = ["INVALID", "EPSILON", "RANGE", "RULE", "PREDICATE", "ATOM", "ACTION", "SET", "NOT_SET", "WILDCARD", "PRECEDENCE"];
  30450. Transition.serializationTypes = {
  30451. EpsilonTransition: Transition.EPSILON,
  30452. RangeTransition: Transition.RANGE,
  30453. RuleTransition: Transition.RULE,
  30454. PredicateTransition: Transition.PREDICATE,
  30455. AtomTransition: Transition.ATOM,
  30456. ActionTransition: Transition.ACTION,
  30457. SetTransition: Transition.SET,
  30458. NotSetTransition: Transition.NOT_SET,
  30459. WildcardTransition: Transition.WILDCARD,
  30460. PrecedencePredicateTransition: Transition.PRECEDENCE
  30461. };
  30462. // TODO: make all transitions sets? no, should remove set edges
  30463. function AtomTransition(target, label) {
  30464. Transition.call(this, target);
  30465. this.label_ = label; // The token type or character value; or, signifies special label.
  30466. this.label = this.makeLabel();
  30467. this.serializationType = Transition.ATOM;
  30468. return this;
  30469. }
  30470. AtomTransition.prototype = Object.create(Transition.prototype);
  30471. AtomTransition.prototype.constructor = AtomTransition;
  30472. AtomTransition.prototype.makeLabel = function () {
  30473. var s = new IntervalSet();
  30474. s.addOne(this.label_);
  30475. return s;
  30476. };
  30477. AtomTransition.prototype.matches = function (symbol, minVocabSymbol, maxVocabSymbol) {
  30478. return this.label_ === symbol;
  30479. };
  30480. AtomTransition.prototype.toString = function () {
  30481. return this.label_;
  30482. };
  30483. function RuleTransition(ruleStart, ruleIndex, precedence, followState) {
  30484. Transition.call(this, ruleStart);
  30485. this.ruleIndex = ruleIndex; // ptr to the rule definition object for this rule ref
  30486. this.precedence = precedence;
  30487. this.followState = followState; // what node to begin computations following ref to rule
  30488. this.serializationType = Transition.RULE;
  30489. this.isEpsilon = true;
  30490. return this;
  30491. }
  30492. RuleTransition.prototype = Object.create(Transition.prototype);
  30493. RuleTransition.prototype.constructor = RuleTransition;
  30494. RuleTransition.prototype.matches = function (symbol, minVocabSymbol, maxVocabSymbol) {
  30495. return false;
  30496. };
  30497. function EpsilonTransition(target, outermostPrecedenceReturn) {
  30498. Transition.call(this, target);
  30499. this.serializationType = Transition.EPSILON;
  30500. this.isEpsilon = true;
  30501. this.outermostPrecedenceReturn = outermostPrecedenceReturn;
  30502. return this;
  30503. }
  30504. EpsilonTransition.prototype = Object.create(Transition.prototype);
  30505. EpsilonTransition.prototype.constructor = EpsilonTransition;
  30506. EpsilonTransition.prototype.matches = function (symbol, minVocabSymbol, maxVocabSymbol) {
  30507. return false;
  30508. };
  30509. EpsilonTransition.prototype.toString = function () {
  30510. return "epsilon";
  30511. };
  30512. function RangeTransition(target, start, stop) {
  30513. Transition.call(this, target);
  30514. this.serializationType = Transition.RANGE;
  30515. this.start = start;
  30516. this.stop = stop;
  30517. this.label = this.makeLabel();
  30518. return this;
  30519. }
  30520. RangeTransition.prototype = Object.create(Transition.prototype);
  30521. RangeTransition.prototype.constructor = RangeTransition;
  30522. RangeTransition.prototype.makeLabel = function () {
  30523. var s = new IntervalSet();
  30524. s.addRange(this.start, this.stop);
  30525. return s;
  30526. };
  30527. RangeTransition.prototype.matches = function (symbol, minVocabSymbol, maxVocabSymbol) {
  30528. return symbol >= this.start && symbol <= this.stop;
  30529. };
  30530. RangeTransition.prototype.toString = function () {
  30531. return "'" + String.fromCharCode(this.start) + "'..'" + String.fromCharCode(this.stop) + "'";
  30532. };
  30533. function AbstractPredicateTransition(target) {
  30534. Transition.call(this, target);
  30535. return this;
  30536. }
  30537. AbstractPredicateTransition.prototype = Object.create(Transition.prototype);
  30538. AbstractPredicateTransition.prototype.constructor = AbstractPredicateTransition;
  30539. function PredicateTransition(target, ruleIndex, predIndex, isCtxDependent) {
  30540. AbstractPredicateTransition.call(this, target);
  30541. this.serializationType = Transition.PREDICATE;
  30542. this.ruleIndex = ruleIndex;
  30543. this.predIndex = predIndex;
  30544. this.isCtxDependent = isCtxDependent; // e.g., $i ref in pred
  30545. this.isEpsilon = true;
  30546. return this;
  30547. }
  30548. PredicateTransition.prototype = Object.create(AbstractPredicateTransition.prototype);
  30549. PredicateTransition.prototype.constructor = PredicateTransition;
  30550. PredicateTransition.prototype.matches = function (symbol, minVocabSymbol, maxVocabSymbol) {
  30551. return false;
  30552. };
  30553. PredicateTransition.prototype.getPredicate = function () {
  30554. return new Predicate(this.ruleIndex, this.predIndex, this.isCtxDependent);
  30555. };
  30556. PredicateTransition.prototype.toString = function () {
  30557. return "pred_" + this.ruleIndex + ":" + this.predIndex;
  30558. };
  30559. function ActionTransition(target, ruleIndex, actionIndex, isCtxDependent) {
  30560. Transition.call(this, target);
  30561. this.serializationType = Transition.ACTION;
  30562. this.ruleIndex = ruleIndex;
  30563. this.actionIndex = actionIndex === undefined ? -1 : actionIndex;
  30564. this.isCtxDependent = isCtxDependent === undefined ? false : isCtxDependent; // e.g., $i ref in pred
  30565. this.isEpsilon = true;
  30566. return this;
  30567. }
  30568. ActionTransition.prototype = Object.create(Transition.prototype);
  30569. ActionTransition.prototype.constructor = ActionTransition;
  30570. ActionTransition.prototype.matches = function (symbol, minVocabSymbol, maxVocabSymbol) {
  30571. return false;
  30572. };
  30573. ActionTransition.prototype.toString = function () {
  30574. return "action_" + this.ruleIndex + ":" + this.actionIndex;
  30575. };
  30576. // A transition containing a set of values.
  30577. function SetTransition(target, set) {
  30578. Transition.call(this, target);
  30579. this.serializationType = Transition.SET;
  30580. if (set !== undefined && set !== null) {
  30581. this.label = set;
  30582. } else {
  30583. this.label = new IntervalSet();
  30584. this.label.addOne(Token.INVALID_TYPE);
  30585. }
  30586. return this;
  30587. }
  30588. SetTransition.prototype = Object.create(Transition.prototype);
  30589. SetTransition.prototype.constructor = SetTransition;
  30590. SetTransition.prototype.matches = function (symbol, minVocabSymbol, maxVocabSymbol) {
  30591. return this.label.contains(symbol);
  30592. };
  30593. SetTransition.prototype.toString = function () {
  30594. return this.label.toString();
  30595. };
  30596. function NotSetTransition(target, set) {
  30597. SetTransition.call(this, target, set);
  30598. this.serializationType = Transition.NOT_SET;
  30599. return this;
  30600. }
  30601. NotSetTransition.prototype = Object.create(SetTransition.prototype);
  30602. NotSetTransition.prototype.constructor = NotSetTransition;
  30603. NotSetTransition.prototype.matches = function (symbol, minVocabSymbol, maxVocabSymbol) {
  30604. return symbol >= minVocabSymbol && symbol <= maxVocabSymbol && !SetTransition.prototype.matches.call(this, symbol, minVocabSymbol, maxVocabSymbol);
  30605. };
  30606. NotSetTransition.prototype.toString = function () {
  30607. return '~' + SetTransition.prototype.toString.call(this);
  30608. };
  30609. function WildcardTransition(target) {
  30610. Transition.call(this, target);
  30611. this.serializationType = Transition.WILDCARD;
  30612. return this;
  30613. }
  30614. WildcardTransition.prototype = Object.create(Transition.prototype);
  30615. WildcardTransition.prototype.constructor = WildcardTransition;
  30616. WildcardTransition.prototype.matches = function (symbol, minVocabSymbol, maxVocabSymbol) {
  30617. return symbol >= minVocabSymbol && symbol <= maxVocabSymbol;
  30618. };
  30619. WildcardTransition.prototype.toString = function () {
  30620. return ".";
  30621. };
  30622. function PrecedencePredicateTransition(target, precedence) {
  30623. AbstractPredicateTransition.call(this, target);
  30624. this.serializationType = Transition.PRECEDENCE;
  30625. this.precedence = precedence;
  30626. this.isEpsilon = true;
  30627. return this;
  30628. }
  30629. PrecedencePredicateTransition.prototype = Object.create(AbstractPredicateTransition.prototype);
  30630. PrecedencePredicateTransition.prototype.constructor = PrecedencePredicateTransition;
  30631. PrecedencePredicateTransition.prototype.matches = function (symbol, minVocabSymbol, maxVocabSymbol) {
  30632. return false;
  30633. };
  30634. PrecedencePredicateTransition.prototype.getPredicate = function () {
  30635. return new PrecedencePredicate(this.precedence);
  30636. };
  30637. PrecedencePredicateTransition.prototype.toString = function () {
  30638. return this.precedence + " >= _p";
  30639. };
  30640. exports.Transition = Transition;
  30641. exports.AtomTransition = AtomTransition;
  30642. exports.SetTransition = SetTransition;
  30643. exports.NotSetTransition = NotSetTransition;
  30644. exports.RuleTransition = RuleTransition;
  30645. exports.ActionTransition = ActionTransition;
  30646. exports.EpsilonTransition = EpsilonTransition;
  30647. exports.RangeTransition = RangeTransition;
  30648. exports.WildcardTransition = WildcardTransition;
  30649. exports.PredicateTransition = PredicateTransition;
  30650. exports.PrecedencePredicateTransition = PrecedencePredicateTransition;
  30651. exports.AbstractPredicateTransition = AbstractPredicateTransition;
  30652. /***/ }),
  30653. /***/ "./node_modules/antlr4/atn/index.js":
  30654. /*!******************************************!*\
  30655. !*** ./node_modules/antlr4/atn/index.js ***!
  30656. \******************************************/
  30657. /*! no static exports found */
  30658. /***/ (function(module, exports, __webpack_require__) {
  30659. "use strict";
  30660. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  30661. * Use of this file is governed by the BSD 3-clause license that
  30662. * can be found in the LICENSE.txt file in the project root.
  30663. */
  30664. exports.ATN = __webpack_require__(/*! ./ATN */ "./node_modules/antlr4/atn/ATN.js").ATN;
  30665. exports.ATNDeserializer = __webpack_require__(/*! ./ATNDeserializer */ "./node_modules/antlr4/atn/ATNDeserializer.js").ATNDeserializer;
  30666. exports.LexerATNSimulator = __webpack_require__(/*! ./LexerATNSimulator */ "./node_modules/antlr4/atn/LexerATNSimulator.js").LexerATNSimulator;
  30667. exports.ParserATNSimulator = __webpack_require__(/*! ./ParserATNSimulator */ "./node_modules/antlr4/atn/ParserATNSimulator.js").ParserATNSimulator;
  30668. exports.PredictionMode = __webpack_require__(/*! ./PredictionMode */ "./node_modules/antlr4/atn/PredictionMode.js").PredictionMode;
  30669. /***/ }),
  30670. /***/ "./node_modules/antlr4/dfa/DFA.js":
  30671. /*!****************************************!*\
  30672. !*** ./node_modules/antlr4/dfa/DFA.js ***!
  30673. \****************************************/
  30674. /*! no static exports found */
  30675. /***/ (function(module, exports, __webpack_require__) {
  30676. "use strict";
  30677. //
  30678. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  30679. * Use of this file is governed by the BSD 3-clause license that
  30680. * can be found in the LICENSE.txt file in the project root.
  30681. */
  30682. var Set = __webpack_require__(/*! ../Utils */ "./node_modules/antlr4/Utils.js").Set;
  30683. var DFAState = __webpack_require__(/*! ./DFAState */ "./node_modules/antlr4/dfa/DFAState.js").DFAState;
  30684. var StarLoopEntryState = __webpack_require__(/*! ../atn/ATNState */ "./node_modules/antlr4/atn/ATNState.js").StarLoopEntryState;
  30685. var ATNConfigSet = __webpack_require__(/*! ./../atn/ATNConfigSet */ "./node_modules/antlr4/atn/ATNConfigSet.js").ATNConfigSet;
  30686. var DFASerializer = __webpack_require__(/*! ./DFASerializer */ "./node_modules/antlr4/dfa/DFASerializer.js").DFASerializer;
  30687. var LexerDFASerializer = __webpack_require__(/*! ./DFASerializer */ "./node_modules/antlr4/dfa/DFASerializer.js").LexerDFASerializer;
  30688. function DFA(atnStartState, decision) {
  30689. if (decision === undefined) {
  30690. decision = 0;
  30691. }
  30692. // From which ATN state did we create this DFA?
  30693. this.atnStartState = atnStartState;
  30694. this.decision = decision;
  30695. // A set of all DFA states. Use {@link Map} so we can get old state back
  30696. // ({@link Set} only allows you to see if it's there).
  30697. this._states = new Set();
  30698. this.s0 = null;
  30699. // {@code true} if this DFA is for a precedence decision; otherwise,
  30700. // {@code false}. This is the backing field for {@link //isPrecedenceDfa},
  30701. // {@link //setPrecedenceDfa}.
  30702. this.precedenceDfa = false;
  30703. if (atnStartState instanceof StarLoopEntryState) {
  30704. if (atnStartState.isPrecedenceDecision) {
  30705. this.precedenceDfa = true;
  30706. var precedenceState = new DFAState(null, new ATNConfigSet());
  30707. precedenceState.edges = [];
  30708. precedenceState.isAcceptState = false;
  30709. precedenceState.requiresFullContext = false;
  30710. this.s0 = precedenceState;
  30711. }
  30712. }
  30713. return this;
  30714. }
  30715. // Get the start state for a specific precedence value.
  30716. //
  30717. // @param precedence The current precedence.
  30718. // @return The start state corresponding to the specified precedence, or
  30719. // {@code null} if no start state exists for the specified precedence.
  30720. //
  30721. // @throws IllegalStateException if this is not a precedence DFA.
  30722. // @see //isPrecedenceDfa()
  30723. DFA.prototype.getPrecedenceStartState = function (precedence) {
  30724. if (!this.precedenceDfa) {
  30725. throw "Only precedence DFAs may contain a precedence start state.";
  30726. }
  30727. // s0.edges is never null for a precedence DFA
  30728. if (precedence < 0 || precedence >= this.s0.edges.length) {
  30729. return null;
  30730. }
  30731. return this.s0.edges[precedence] || null;
  30732. };
  30733. // Set the start state for a specific precedence value.
  30734. //
  30735. // @param precedence The current precedence.
  30736. // @param startState The start state corresponding to the specified
  30737. // precedence.
  30738. //
  30739. // @throws IllegalStateException if this is not a precedence DFA.
  30740. // @see //isPrecedenceDfa()
  30741. //
  30742. DFA.prototype.setPrecedenceStartState = function (precedence, startState) {
  30743. if (!this.precedenceDfa) {
  30744. throw "Only precedence DFAs may contain a precedence start state.";
  30745. }
  30746. if (precedence < 0) {
  30747. return;
  30748. }
  30749. // synchronization on s0 here is ok. when the DFA is turned into a
  30750. // precedence DFA, s0 will be initialized once and not updated again
  30751. // s0.edges is never null for a precedence DFA
  30752. this.s0.edges[precedence] = startState;
  30753. };
  30754. //
  30755. // Sets whether this is a precedence DFA. If the specified value differs
  30756. // from the current DFA configuration, the following actions are taken;
  30757. // otherwise no changes are made to the current DFA.
  30758. //
  30759. // <ul>
  30760. // <li>The {@link //states} map is cleared</li>
  30761. // <li>If {@code precedenceDfa} is {@code false}, the initial state
  30762. // {@link //s0} is set to {@code null}; otherwise, it is initialized to a new
  30763. // {@link DFAState} with an empty outgoing {@link DFAState//edges} array to
  30764. // store the start states for individual precedence values.</li>
  30765. // <li>The {@link //precedenceDfa} field is updated</li>
  30766. // </ul>
  30767. //
  30768. // @param precedenceDfa {@code true} if this is a precedence DFA; otherwise,
  30769. // {@code false}
  30770. DFA.prototype.setPrecedenceDfa = function (precedenceDfa) {
  30771. if (this.precedenceDfa !== precedenceDfa) {
  30772. this._states = new DFAStatesSet();
  30773. if (precedenceDfa) {
  30774. var precedenceState = new DFAState(null, new ATNConfigSet());
  30775. precedenceState.edges = [];
  30776. precedenceState.isAcceptState = false;
  30777. precedenceState.requiresFullContext = false;
  30778. this.s0 = precedenceState;
  30779. } else {
  30780. this.s0 = null;
  30781. }
  30782. this.precedenceDfa = precedenceDfa;
  30783. }
  30784. };
  30785. Object.defineProperty(DFA.prototype, "states", {
  30786. get: function get() {
  30787. return this._states;
  30788. }
  30789. });
  30790. // Return a list of all states in this DFA, ordered by state number.
  30791. DFA.prototype.sortedStates = function () {
  30792. var list = this._states.values();
  30793. return list.sort(function (a, b) {
  30794. return a.stateNumber - b.stateNumber;
  30795. });
  30796. };
  30797. DFA.prototype.toString = function (literalNames, symbolicNames) {
  30798. literalNames = literalNames || null;
  30799. symbolicNames = symbolicNames || null;
  30800. if (this.s0 === null) {
  30801. return "";
  30802. }
  30803. var serializer = new DFASerializer(this, literalNames, symbolicNames);
  30804. return serializer.toString();
  30805. };
  30806. DFA.prototype.toLexerString = function () {
  30807. if (this.s0 === null) {
  30808. return "";
  30809. }
  30810. var serializer = new LexerDFASerializer(this);
  30811. return serializer.toString();
  30812. };
  30813. exports.DFA = DFA;
  30814. /***/ }),
  30815. /***/ "./node_modules/antlr4/dfa/DFASerializer.js":
  30816. /*!**************************************************!*\
  30817. !*** ./node_modules/antlr4/dfa/DFASerializer.js ***!
  30818. \**************************************************/
  30819. /*! no static exports found */
  30820. /***/ (function(module, exports, __webpack_require__) {
  30821. "use strict";
  30822. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  30823. * Use of this file is governed by the BSD 3-clause license that
  30824. * can be found in the LICENSE.txt file in the project root.
  30825. */
  30826. // A DFA walker that knows how to dump them to serialized strings.#/
  30827. function DFASerializer(dfa, literalNames, symbolicNames) {
  30828. this.dfa = dfa;
  30829. this.literalNames = literalNames || [];
  30830. this.symbolicNames = symbolicNames || [];
  30831. return this;
  30832. }
  30833. DFASerializer.prototype.toString = function () {
  30834. if (this.dfa.s0 === null) {
  30835. return null;
  30836. }
  30837. var buf = "";
  30838. var states = this.dfa.sortedStates();
  30839. for (var i = 0; i < states.length; i++) {
  30840. var s = states[i];
  30841. if (s.edges !== null) {
  30842. var n = s.edges.length;
  30843. for (var j = 0; j < n; j++) {
  30844. var t = s.edges[j] || null;
  30845. if (t !== null && t.stateNumber !== 0x7FFFFFFF) {
  30846. buf = buf.concat(this.getStateString(s));
  30847. buf = buf.concat("-");
  30848. buf = buf.concat(this.getEdgeLabel(j));
  30849. buf = buf.concat("->");
  30850. buf = buf.concat(this.getStateString(t));
  30851. buf = buf.concat('\n');
  30852. }
  30853. }
  30854. }
  30855. }
  30856. return buf.length === 0 ? null : buf;
  30857. };
  30858. DFASerializer.prototype.getEdgeLabel = function (i) {
  30859. if (i === 0) {
  30860. return "EOF";
  30861. } else if (this.literalNames !== null || this.symbolicNames !== null) {
  30862. return this.literalNames[i - 1] || this.symbolicNames[i - 1];
  30863. } else {
  30864. return String.fromCharCode(i - 1);
  30865. }
  30866. };
  30867. DFASerializer.prototype.getStateString = function (s) {
  30868. var baseStateStr = (s.isAcceptState ? ":" : "") + "s" + s.stateNumber + (s.requiresFullContext ? "^" : "");
  30869. if (s.isAcceptState) {
  30870. if (s.predicates !== null) {
  30871. return baseStateStr + "=>" + s.predicates.toString();
  30872. } else {
  30873. return baseStateStr + "=>" + s.prediction.toString();
  30874. }
  30875. } else {
  30876. return baseStateStr;
  30877. }
  30878. };
  30879. function LexerDFASerializer(dfa) {
  30880. DFASerializer.call(this, dfa, null);
  30881. return this;
  30882. }
  30883. LexerDFASerializer.prototype = Object.create(DFASerializer.prototype);
  30884. LexerDFASerializer.prototype.constructor = LexerDFASerializer;
  30885. LexerDFASerializer.prototype.getEdgeLabel = function (i) {
  30886. return "'" + String.fromCharCode(i) + "'";
  30887. };
  30888. exports.DFASerializer = DFASerializer;
  30889. exports.LexerDFASerializer = LexerDFASerializer;
  30890. /***/ }),
  30891. /***/ "./node_modules/antlr4/dfa/DFAState.js":
  30892. /*!*********************************************!*\
  30893. !*** ./node_modules/antlr4/dfa/DFAState.js ***!
  30894. \*********************************************/
  30895. /*! no static exports found */
  30896. /***/ (function(module, exports, __webpack_require__) {
  30897. "use strict";
  30898. //
  30899. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  30900. * Use of this file is governed by the BSD 3-clause license that
  30901. * can be found in the LICENSE.txt file in the project root.
  30902. */
  30903. ///
  30904. var ATNConfigSet = __webpack_require__(/*! ./../atn/ATNConfigSet */ "./node_modules/antlr4/atn/ATNConfigSet.js").ATNConfigSet;
  30905. var Utils = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js");
  30906. var Hash = Utils.Hash;
  30907. var Set = Utils.Set;
  30908. // Map a predicate to a predicted alternative.///
  30909. function PredPrediction(pred, alt) {
  30910. this.alt = alt;
  30911. this.pred = pred;
  30912. return this;
  30913. }
  30914. PredPrediction.prototype.toString = function () {
  30915. return "(" + this.pred + ", " + this.alt + ")";
  30916. };
  30917. // A DFA state represents a set of possible ATN configurations.
  30918. // As Aho, Sethi, Ullman p. 117 says "The DFA uses its state
  30919. // to keep track of all possible states the ATN can be in after
  30920. // reading each input symbol. That is to say, after reading
  30921. // input a1a2..an, the DFA is in a state that represents the
  30922. // subset T of the states of the ATN that are reachable from the
  30923. // ATN's start state along some path labeled a1a2..an."
  30924. // In conventional NFA&rarr;DFA conversion, therefore, the subset T
  30925. // would be a bitset representing the set of states the
  30926. // ATN could be in. We need to track the alt predicted by each
  30927. // state as well, however. More importantly, we need to maintain
  30928. // a stack of states, tracking the closure operations as they
  30929. // jump from rule to rule, emulating rule invocations (method calls).
  30930. // I have to add a stack to simulate the proper lookahead sequences for
  30931. // the underlying LL grammar from which the ATN was derived.
  30932. //
  30933. // <p>I use a set of ATNConfig objects not simple states. An ATNConfig
  30934. // is both a state (ala normal conversion) and a RuleContext describing
  30935. // the chain of rules (if any) followed to arrive at that state.</p>
  30936. //
  30937. // <p>A DFA state may have multiple references to a particular state,
  30938. // but with different ATN contexts (with same or different alts)
  30939. // meaning that state was reached via a different set of rule invocations.</p>
  30940. // /
  30941. function DFAState(stateNumber, configs) {
  30942. if (stateNumber === null) {
  30943. stateNumber = -1;
  30944. }
  30945. if (configs === null) {
  30946. configs = new ATNConfigSet();
  30947. }
  30948. this.stateNumber = stateNumber;
  30949. this.configs = configs;
  30950. // {@code edges[symbol]} points to target of symbol. Shift up by 1 so (-1)
  30951. // {@link Token//EOF} maps to {@code edges[0]}.
  30952. this.edges = null;
  30953. this.isAcceptState = false;
  30954. // if accept state, what ttype do we match or alt do we predict?
  30955. // This is set to {@link ATN//INVALID_ALT_NUMBER} when {@link
  30956. // //predicates}{@code !=null} or
  30957. // {@link //requiresFullContext}.
  30958. this.prediction = 0;
  30959. this.lexerActionExecutor = null;
  30960. // Indicates that this state was created during SLL prediction that
  30961. // discovered a conflict between the configurations in the state. Future
  30962. // {@link ParserATNSimulator//execATN} invocations immediately jumped doing
  30963. // full context prediction if this field is true.
  30964. this.requiresFullContext = false;
  30965. // During SLL parsing, this is a list of predicates associated with the
  30966. // ATN configurations of the DFA state. When we have predicates,
  30967. // {@link //requiresFullContext} is {@code false} since full context
  30968. // prediction evaluates predicates
  30969. // on-the-fly. If this is not null, then {@link //prediction} is
  30970. // {@link ATN//INVALID_ALT_NUMBER}.
  30971. //
  30972. // <p>We only use these for non-{@link //requiresFullContext} but
  30973. // conflicting states. That
  30974. // means we know from the context (it's $ or we don't dip into outer
  30975. // context) that it's an ambiguity not a conflict.</p>
  30976. //
  30977. // <p>This list is computed by {@link
  30978. // ParserATNSimulator//predicateDFAState}.</p>
  30979. this.predicates = null;
  30980. return this;
  30981. }
  30982. // Get the set of all alts mentioned by all ATN configurations in this
  30983. // DFA state.
  30984. DFAState.prototype.getAltSet = function () {
  30985. var alts = new Set();
  30986. if (this.configs !== null) {
  30987. for (var i = 0; i < this.configs.length; i++) {
  30988. var c = this.configs[i];
  30989. alts.add(c.alt);
  30990. }
  30991. }
  30992. if (alts.length === 0) {
  30993. return null;
  30994. } else {
  30995. return alts;
  30996. }
  30997. };
  30998. // Two {@link DFAState} instances are equal if their ATN configuration sets
  30999. // are the same. This method is used to see if a state already exists.
  31000. //
  31001. // <p>Because the number of alternatives and number of ATN configurations are
  31002. // finite, there is a finite number of DFA states that can be processed.
  31003. // This is necessary to show that the algorithm terminates.</p>
  31004. //
  31005. // <p>Cannot test the DFA state numbers here because in
  31006. // {@link ParserATNSimulator//addDFAState} we need to know if any other state
  31007. // exists that has this exact set of ATN configurations. The
  31008. // {@link //stateNumber} is irrelevant.</p>
  31009. DFAState.prototype.equals = function (other) {
  31010. // compare set of ATN configurations in this set with other
  31011. return this === other || other instanceof DFAState && this.configs.equals(other.configs);
  31012. };
  31013. DFAState.prototype.toString = function () {
  31014. var s = "" + this.stateNumber + ":" + this.configs;
  31015. if (this.isAcceptState) {
  31016. s = s + "=>";
  31017. if (this.predicates !== null) s = s + this.predicates;else s = s + this.prediction;
  31018. }
  31019. return s;
  31020. };
  31021. DFAState.prototype.hashCode = function () {
  31022. var hash = new Hash();
  31023. hash.update(this.configs);
  31024. if (this.isAcceptState) {
  31025. if (this.predicates !== null) hash.update(this.predicates);else hash.update(this.prediction);
  31026. }
  31027. return hash.finish();
  31028. };
  31029. exports.DFAState = DFAState;
  31030. exports.PredPrediction = PredPrediction;
  31031. /***/ }),
  31032. /***/ "./node_modules/antlr4/dfa/index.js":
  31033. /*!******************************************!*\
  31034. !*** ./node_modules/antlr4/dfa/index.js ***!
  31035. \******************************************/
  31036. /*! no static exports found */
  31037. /***/ (function(module, exports, __webpack_require__) {
  31038. "use strict";
  31039. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  31040. * Use of this file is governed by the BSD 3-clause license that
  31041. * can be found in the LICENSE.txt file in the project root.
  31042. */
  31043. exports.DFA = __webpack_require__(/*! ./DFA */ "./node_modules/antlr4/dfa/DFA.js").DFA;
  31044. exports.DFASerializer = __webpack_require__(/*! ./DFASerializer */ "./node_modules/antlr4/dfa/DFASerializer.js").DFASerializer;
  31045. exports.LexerDFASerializer = __webpack_require__(/*! ./DFASerializer */ "./node_modules/antlr4/dfa/DFASerializer.js").LexerDFASerializer;
  31046. exports.PredPrediction = __webpack_require__(/*! ./DFAState */ "./node_modules/antlr4/dfa/DFAState.js").PredPrediction;
  31047. /***/ }),
  31048. /***/ "./node_modules/antlr4/error/DiagnosticErrorListener.js":
  31049. /*!**************************************************************!*\
  31050. !*** ./node_modules/antlr4/error/DiagnosticErrorListener.js ***!
  31051. \**************************************************************/
  31052. /*! no static exports found */
  31053. /***/ (function(module, exports, __webpack_require__) {
  31054. "use strict";
  31055. //
  31056. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  31057. * Use of this file is governed by the BSD 3-clause license that
  31058. * can be found in the LICENSE.txt file in the project root.
  31059. */
  31060. //
  31061. //
  31062. // This implementation of {@link ANTLRErrorListener} can be used to identify
  31063. // certain potential correctness and performance problems in grammars. "Reports"
  31064. // are made by calling {@link Parser//notifyErrorListeners} with the appropriate
  31065. // message.
  31066. //
  31067. // <ul>
  31068. // <li><b>Ambiguities</b>: These are cases where more than one path through the
  31069. // grammar can match the input.</li>
  31070. // <li><b>Weak context sensitivity</b>: These are cases where full-context
  31071. // prediction resolved an SLL conflict to a unique alternative which equaled the
  31072. // minimum alternative of the SLL conflict.</li>
  31073. // <li><b>Strong (forced) context sensitivity</b>: These are cases where the
  31074. // full-context prediction resolved an SLL conflict to a unique alternative,
  31075. // <em>and</em> the minimum alternative of the SLL conflict was found to not be
  31076. // a truly viable alternative. Two-stage parsing cannot be used for inputs where
  31077. // this situation occurs.</li>
  31078. // </ul>
  31079. var BitSet = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js").BitSet;
  31080. var ErrorListener = __webpack_require__(/*! ./ErrorListener */ "./node_modules/antlr4/error/ErrorListener.js").ErrorListener;
  31081. var Interval = __webpack_require__(/*! ./../IntervalSet */ "./node_modules/antlr4/IntervalSet.js").Interval;
  31082. function DiagnosticErrorListener(exactOnly) {
  31083. ErrorListener.call(this);
  31084. exactOnly = exactOnly || true;
  31085. // whether all ambiguities or only exact ambiguities are reported.
  31086. this.exactOnly = exactOnly;
  31087. return this;
  31088. }
  31089. DiagnosticErrorListener.prototype = Object.create(ErrorListener.prototype);
  31090. DiagnosticErrorListener.prototype.constructor = DiagnosticErrorListener;
  31091. DiagnosticErrorListener.prototype.reportAmbiguity = function (recognizer, dfa, startIndex, stopIndex, exact, ambigAlts, configs) {
  31092. if (this.exactOnly && !exact) {
  31093. return;
  31094. }
  31095. var msg = "reportAmbiguity d=" + this.getDecisionDescription(recognizer, dfa) + ": ambigAlts=" + this.getConflictingAlts(ambigAlts, configs) + ", input='" + recognizer.getTokenStream().getText(new Interval(startIndex, stopIndex)) + "'";
  31096. recognizer.notifyErrorListeners(msg);
  31097. };
  31098. DiagnosticErrorListener.prototype.reportAttemptingFullContext = function (recognizer, dfa, startIndex, stopIndex, conflictingAlts, configs) {
  31099. var msg = "reportAttemptingFullContext d=" + this.getDecisionDescription(recognizer, dfa) + ", input='" + recognizer.getTokenStream().getText(new Interval(startIndex, stopIndex)) + "'";
  31100. recognizer.notifyErrorListeners(msg);
  31101. };
  31102. DiagnosticErrorListener.prototype.reportContextSensitivity = function (recognizer, dfa, startIndex, stopIndex, prediction, configs) {
  31103. var msg = "reportContextSensitivity d=" + this.getDecisionDescription(recognizer, dfa) + ", input='" + recognizer.getTokenStream().getText(new Interval(startIndex, stopIndex)) + "'";
  31104. recognizer.notifyErrorListeners(msg);
  31105. };
  31106. DiagnosticErrorListener.prototype.getDecisionDescription = function (recognizer, dfa) {
  31107. var decision = dfa.decision;
  31108. var ruleIndex = dfa.atnStartState.ruleIndex;
  31109. var ruleNames = recognizer.ruleNames;
  31110. if (ruleIndex < 0 || ruleIndex >= ruleNames.length) {
  31111. return "" + decision;
  31112. }
  31113. var ruleName = ruleNames[ruleIndex] || null;
  31114. if (ruleName === null || ruleName.length === 0) {
  31115. return "" + decision;
  31116. }
  31117. return "" + decision + " (" + ruleName + ")";
  31118. };
  31119. //
  31120. // Computes the set of conflicting or ambiguous alternatives from a
  31121. // configuration set, if that information was not already provided by the
  31122. // parser.
  31123. //
  31124. // @param reportedAlts The set of conflicting or ambiguous alternatives, as
  31125. // reported by the parser.
  31126. // @param configs The conflicting or ambiguous configuration set.
  31127. // @return Returns {@code reportedAlts} if it is not {@code null}, otherwise
  31128. // returns the set of alternatives represented in {@code configs}.
  31129. //
  31130. DiagnosticErrorListener.prototype.getConflictingAlts = function (reportedAlts, configs) {
  31131. if (reportedAlts !== null) {
  31132. return reportedAlts;
  31133. }
  31134. var result = new BitSet();
  31135. for (var i = 0; i < configs.items.length; i++) {
  31136. result.add(configs.items[i].alt);
  31137. }
  31138. return "{" + result.values().join(", ") + "}";
  31139. };
  31140. exports.DiagnosticErrorListener = DiagnosticErrorListener;
  31141. /***/ }),
  31142. /***/ "./node_modules/antlr4/error/ErrorListener.js":
  31143. /*!****************************************************!*\
  31144. !*** ./node_modules/antlr4/error/ErrorListener.js ***!
  31145. \****************************************************/
  31146. /*! no static exports found */
  31147. /***/ (function(module, exports, __webpack_require__) {
  31148. "use strict";
  31149. //
  31150. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  31151. * Use of this file is governed by the BSD 3-clause license that
  31152. * can be found in the LICENSE.txt file in the project root.
  31153. */
  31154. // Provides an empty default implementation of {@link ANTLRErrorListener}. The
  31155. // default implementation of each method does nothing, but can be overridden as
  31156. // necessary.
  31157. function ErrorListener() {
  31158. return this;
  31159. }
  31160. ErrorListener.prototype.syntaxError = function (recognizer, offendingSymbol, line, column, msg, e) {};
  31161. ErrorListener.prototype.reportAmbiguity = function (recognizer, dfa, startIndex, stopIndex, exact, ambigAlts, configs) {};
  31162. ErrorListener.prototype.reportAttemptingFullContext = function (recognizer, dfa, startIndex, stopIndex, conflictingAlts, configs) {};
  31163. ErrorListener.prototype.reportContextSensitivity = function (recognizer, dfa, startIndex, stopIndex, prediction, configs) {};
  31164. function ConsoleErrorListener() {
  31165. ErrorListener.call(this);
  31166. return this;
  31167. }
  31168. ConsoleErrorListener.prototype = Object.create(ErrorListener.prototype);
  31169. ConsoleErrorListener.prototype.constructor = ConsoleErrorListener;
  31170. //
  31171. // Provides a default instance of {@link ConsoleErrorListener}.
  31172. //
  31173. ConsoleErrorListener.INSTANCE = new ConsoleErrorListener();
  31174. //
  31175. // {@inheritDoc}
  31176. //
  31177. // <p>
  31178. // This implementation prints messages to {@link System//err} containing the
  31179. // values of {@code line}, {@code charPositionInLine}, and {@code msg} using
  31180. // the following format.</p>
  31181. //
  31182. // <pre>
  31183. // line <em>line</em>:<em>charPositionInLine</em> <em>msg</em>
  31184. // </pre>
  31185. //
  31186. ConsoleErrorListener.prototype.syntaxError = function (recognizer, offendingSymbol, line, column, msg, e) {
  31187. console.error("line " + line + ":" + column + " " + msg);
  31188. };
  31189. function ProxyErrorListener(delegates) {
  31190. ErrorListener.call(this);
  31191. if (delegates === null) {
  31192. throw "delegates";
  31193. }
  31194. this.delegates = delegates;
  31195. return this;
  31196. }
  31197. ProxyErrorListener.prototype = Object.create(ErrorListener.prototype);
  31198. ProxyErrorListener.prototype.constructor = ProxyErrorListener;
  31199. ProxyErrorListener.prototype.syntaxError = function (recognizer, offendingSymbol, line, column, msg, e) {
  31200. this.delegates.map(function (d) {
  31201. d.syntaxError(recognizer, offendingSymbol, line, column, msg, e);
  31202. });
  31203. };
  31204. ProxyErrorListener.prototype.reportAmbiguity = function (recognizer, dfa, startIndex, stopIndex, exact, ambigAlts, configs) {
  31205. this.delegates.map(function (d) {
  31206. d.reportAmbiguity(recognizer, dfa, startIndex, stopIndex, exact, ambigAlts, configs);
  31207. });
  31208. };
  31209. ProxyErrorListener.prototype.reportAttemptingFullContext = function (recognizer, dfa, startIndex, stopIndex, conflictingAlts, configs) {
  31210. this.delegates.map(function (d) {
  31211. d.reportAttemptingFullContext(recognizer, dfa, startIndex, stopIndex, conflictingAlts, configs);
  31212. });
  31213. };
  31214. ProxyErrorListener.prototype.reportContextSensitivity = function (recognizer, dfa, startIndex, stopIndex, prediction, configs) {
  31215. this.delegates.map(function (d) {
  31216. d.reportContextSensitivity(recognizer, dfa, startIndex, stopIndex, prediction, configs);
  31217. });
  31218. };
  31219. exports.ErrorListener = ErrorListener;
  31220. exports.ConsoleErrorListener = ConsoleErrorListener;
  31221. exports.ProxyErrorListener = ProxyErrorListener;
  31222. /***/ }),
  31223. /***/ "./node_modules/antlr4/error/ErrorStrategy.js":
  31224. /*!****************************************************!*\
  31225. !*** ./node_modules/antlr4/error/ErrorStrategy.js ***!
  31226. \****************************************************/
  31227. /*! no static exports found */
  31228. /***/ (function(module, exports, __webpack_require__) {
  31229. "use strict";
  31230. //
  31231. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  31232. * Use of this file is governed by the BSD 3-clause license that
  31233. * can be found in the LICENSE.txt file in the project root.
  31234. */
  31235. //
  31236. var Token = __webpack_require__(/*! ./../Token */ "./node_modules/antlr4/Token.js").Token;
  31237. var Errors = __webpack_require__(/*! ./Errors */ "./node_modules/antlr4/error/Errors.js");
  31238. var NoViableAltException = Errors.NoViableAltException;
  31239. var InputMismatchException = Errors.InputMismatchException;
  31240. var FailedPredicateException = Errors.FailedPredicateException;
  31241. var ParseCancellationException = Errors.ParseCancellationException;
  31242. var ATNState = __webpack_require__(/*! ./../atn/ATNState */ "./node_modules/antlr4/atn/ATNState.js").ATNState;
  31243. var Interval = __webpack_require__(/*! ./../IntervalSet */ "./node_modules/antlr4/IntervalSet.js").Interval;
  31244. var IntervalSet = __webpack_require__(/*! ./../IntervalSet */ "./node_modules/antlr4/IntervalSet.js").IntervalSet;
  31245. function ErrorStrategy() {}
  31246. ErrorStrategy.prototype.reset = function (recognizer) {};
  31247. ErrorStrategy.prototype.recoverInline = function (recognizer) {};
  31248. ErrorStrategy.prototype.recover = function (recognizer, e) {};
  31249. ErrorStrategy.prototype.sync = function (recognizer) {};
  31250. ErrorStrategy.prototype.inErrorRecoveryMode = function (recognizer) {};
  31251. ErrorStrategy.prototype.reportError = function (recognizer) {};
  31252. // This is the default implementation of {@link ANTLRErrorStrategy} used for
  31253. // error reporting and recovery in ANTLR parsers.
  31254. //
  31255. function DefaultErrorStrategy() {
  31256. ErrorStrategy.call(this);
  31257. // Indicates whether the error strategy is currently "recovering from an
  31258. // error". This is used to suppress reporting multiple error messages while
  31259. // attempting to recover from a detected syntax error.
  31260. //
  31261. // @see //inErrorRecoveryMode
  31262. //
  31263. this.errorRecoveryMode = false;
  31264. // The index into the input stream where the last error occurred.
  31265. // This is used to prevent infinite loops where an error is found
  31266. // but no token is consumed during recovery...another error is found,
  31267. // ad nauseum. This is a failsafe mechanism to guarantee that at least
  31268. // one token/tree node is consumed for two errors.
  31269. //
  31270. this.lastErrorIndex = -1;
  31271. this.lastErrorStates = null;
  31272. return this;
  31273. }
  31274. DefaultErrorStrategy.prototype = Object.create(ErrorStrategy.prototype);
  31275. DefaultErrorStrategy.prototype.constructor = DefaultErrorStrategy;
  31276. // <p>The default implementation simply calls {@link //endErrorCondition} to
  31277. // ensure that the handler is not in error recovery mode.</p>
  31278. DefaultErrorStrategy.prototype.reset = function (recognizer) {
  31279. this.endErrorCondition(recognizer);
  31280. };
  31281. //
  31282. // This method is called to enter error recovery mode when a recognition
  31283. // exception is reported.
  31284. //
  31285. // @param recognizer the parser instance
  31286. //
  31287. DefaultErrorStrategy.prototype.beginErrorCondition = function (recognizer) {
  31288. this.errorRecoveryMode = true;
  31289. };
  31290. DefaultErrorStrategy.prototype.inErrorRecoveryMode = function (recognizer) {
  31291. return this.errorRecoveryMode;
  31292. };
  31293. //
  31294. // This method is called to leave error recovery mode after recovering from
  31295. // a recognition exception.
  31296. //
  31297. // @param recognizer
  31298. //
  31299. DefaultErrorStrategy.prototype.endErrorCondition = function (recognizer) {
  31300. this.errorRecoveryMode = false;
  31301. this.lastErrorStates = null;
  31302. this.lastErrorIndex = -1;
  31303. };
  31304. //
  31305. // {@inheritDoc}
  31306. //
  31307. // <p>The default implementation simply calls {@link //endErrorCondition}.</p>
  31308. //
  31309. DefaultErrorStrategy.prototype.reportMatch = function (recognizer) {
  31310. this.endErrorCondition(recognizer);
  31311. };
  31312. //
  31313. // {@inheritDoc}
  31314. //
  31315. // <p>The default implementation returns immediately if the handler is already
  31316. // in error recovery mode. Otherwise, it calls {@link //beginErrorCondition}
  31317. // and dispatches the reporting task based on the runtime type of {@code e}
  31318. // according to the following table.</p>
  31319. //
  31320. // <ul>
  31321. // <li>{@link NoViableAltException}: Dispatches the call to
  31322. // {@link //reportNoViableAlternative}</li>
  31323. // <li>{@link InputMismatchException}: Dispatches the call to
  31324. // {@link //reportInputMismatch}</li>
  31325. // <li>{@link FailedPredicateException}: Dispatches the call to
  31326. // {@link //reportFailedPredicate}</li>
  31327. // <li>All other types: calls {@link Parser//notifyErrorListeners} to report
  31328. // the exception</li>
  31329. // </ul>
  31330. //
  31331. DefaultErrorStrategy.prototype.reportError = function (recognizer, e) {
  31332. // if we've already reported an error and have not matched a token
  31333. // yet successfully, don't report any errors.
  31334. if (this.inErrorRecoveryMode(recognizer)) {
  31335. return; // don't report spurious errors
  31336. }
  31337. this.beginErrorCondition(recognizer);
  31338. if (e instanceof NoViableAltException) {
  31339. this.reportNoViableAlternative(recognizer, e);
  31340. } else if (e instanceof InputMismatchException) {
  31341. this.reportInputMismatch(recognizer, e);
  31342. } else if (e instanceof FailedPredicateException) {
  31343. this.reportFailedPredicate(recognizer, e);
  31344. } else {
  31345. console.log("unknown recognition error type: " + e.constructor.name);
  31346. console.log(e.stack);
  31347. recognizer.notifyErrorListeners(e.getOffendingToken(), e.getMessage(), e);
  31348. }
  31349. };
  31350. //
  31351. // {@inheritDoc}
  31352. //
  31353. // <p>The default implementation resynchronizes the parser by consuming tokens
  31354. // until we find one in the resynchronization set--loosely the set of tokens
  31355. // that can follow the current rule.</p>
  31356. //
  31357. DefaultErrorStrategy.prototype.recover = function (recognizer, e) {
  31358. if (this.lastErrorIndex === recognizer.getInputStream().index && this.lastErrorStates !== null && this.lastErrorStates.indexOf(recognizer.state) >= 0) {
  31359. // uh oh, another error at same token index and previously-visited
  31360. // state in ATN; must be a case where LT(1) is in the recovery
  31361. // token set so nothing got consumed. Consume a single token
  31362. // at least to prevent an infinite loop; this is a failsafe.
  31363. recognizer.consume();
  31364. }
  31365. this.lastErrorIndex = recognizer._input.index;
  31366. if (this.lastErrorStates === null) {
  31367. this.lastErrorStates = [];
  31368. }
  31369. this.lastErrorStates.push(recognizer.state);
  31370. var followSet = this.getErrorRecoverySet(recognizer);
  31371. this.consumeUntil(recognizer, followSet);
  31372. };
  31373. // The default implementation of {@link ANTLRErrorStrategy//sync} makes sure
  31374. // that the current lookahead symbol is consistent with what were expecting
  31375. // at this point in the ATN. You can call this anytime but ANTLR only
  31376. // generates code to check before subrules/loops and each iteration.
  31377. //
  31378. // <p>Implements Jim Idle's magic sync mechanism in closures and optional
  31379. // subrules. E.g.,</p>
  31380. //
  31381. // <pre>
  31382. // a : sync ( stuff sync )* ;
  31383. // sync : {consume to what can follow sync} ;
  31384. // </pre>
  31385. //
  31386. // At the start of a sub rule upon error, {@link //sync} performs single
  31387. // token deletion, if possible. If it can't do that, it bails on the current
  31388. // rule and uses the default error recovery, which consumes until the
  31389. // resynchronization set of the current rule.
  31390. //
  31391. // <p>If the sub rule is optional ({@code (...)?}, {@code (...)*}, or block
  31392. // with an empty alternative), then the expected set includes what follows
  31393. // the subrule.</p>
  31394. //
  31395. // <p>During loop iteration, it consumes until it sees a token that can start a
  31396. // sub rule or what follows loop. Yes, that is pretty aggressive. We opt to
  31397. // stay in the loop as long as possible.</p>
  31398. //
  31399. // <p><strong>ORIGINS</strong></p>
  31400. //
  31401. // <p>Previous versions of ANTLR did a poor job of their recovery within loops.
  31402. // A single mismatch token or missing token would force the parser to bail
  31403. // out of the entire rules surrounding the loop. So, for rule</p>
  31404. //
  31405. // <pre>
  31406. // classDef : 'class' ID '{' member* '}'
  31407. // </pre>
  31408. //
  31409. // input with an extra token between members would force the parser to
  31410. // consume until it found the next class definition rather than the next
  31411. // member definition of the current class.
  31412. //
  31413. // <p>This functionality cost a little bit of effort because the parser has to
  31414. // compare token set at the start of the loop and at each iteration. If for
  31415. // some reason speed is suffering for you, you can turn off this
  31416. // functionality by simply overriding this method as a blank { }.</p>
  31417. //
  31418. DefaultErrorStrategy.prototype.sync = function (recognizer) {
  31419. // If already recovering, don't try to sync
  31420. if (this.inErrorRecoveryMode(recognizer)) {
  31421. return;
  31422. }
  31423. var s = recognizer._interp.atn.states[recognizer.state];
  31424. var la = recognizer.getTokenStream().LA(1);
  31425. // try cheaper subset first; might get lucky. seems to shave a wee bit off
  31426. var nextTokens = recognizer.atn.nextTokens(s);
  31427. if (nextTokens.contains(Token.EPSILON) || nextTokens.contains(la)) {
  31428. return;
  31429. }
  31430. switch (s.stateType) {
  31431. case ATNState.BLOCK_START:
  31432. case ATNState.STAR_BLOCK_START:
  31433. case ATNState.PLUS_BLOCK_START:
  31434. case ATNState.STAR_LOOP_ENTRY:
  31435. // report error and recover if possible
  31436. if (this.singleTokenDeletion(recognizer) !== null) {
  31437. return;
  31438. } else {
  31439. throw new InputMismatchException(recognizer);
  31440. }
  31441. break;
  31442. case ATNState.PLUS_LOOP_BACK:
  31443. case ATNState.STAR_LOOP_BACK:
  31444. this.reportUnwantedToken(recognizer);
  31445. var expecting = new IntervalSet();
  31446. expecting.addSet(recognizer.getExpectedTokens());
  31447. var whatFollowsLoopIterationOrRule = expecting.addSet(this.getErrorRecoverySet(recognizer));
  31448. this.consumeUntil(recognizer, whatFollowsLoopIterationOrRule);
  31449. break;
  31450. default:
  31451. // do nothing if we can't identify the exact kind of ATN state
  31452. }
  31453. };
  31454. // This is called by {@link //reportError} when the exception is a
  31455. // {@link NoViableAltException}.
  31456. //
  31457. // @see //reportError
  31458. //
  31459. // @param recognizer the parser instance
  31460. // @param e the recognition exception
  31461. //
  31462. DefaultErrorStrategy.prototype.reportNoViableAlternative = function (recognizer, e) {
  31463. var tokens = recognizer.getTokenStream();
  31464. var input;
  31465. if (tokens !== null) {
  31466. if (e.startToken.type === Token.EOF) {
  31467. input = "<EOF>";
  31468. } else {
  31469. input = tokens.getText(new Interval(e.startToken.tokenIndex, e.offendingToken.tokenIndex));
  31470. }
  31471. } else {
  31472. input = "<unknown input>";
  31473. }
  31474. var msg = "no viable alternative at input " + this.escapeWSAndQuote(input);
  31475. recognizer.notifyErrorListeners(msg, e.offendingToken, e);
  31476. };
  31477. //
  31478. // This is called by {@link //reportError} when the exception is an
  31479. // {@link InputMismatchException}.
  31480. //
  31481. // @see //reportError
  31482. //
  31483. // @param recognizer the parser instance
  31484. // @param e the recognition exception
  31485. //
  31486. DefaultErrorStrategy.prototype.reportInputMismatch = function (recognizer, e) {
  31487. var msg = "mismatched input " + this.getTokenErrorDisplay(e.offendingToken) + " expecting " + e.getExpectedTokens().toString(recognizer.literalNames, recognizer.symbolicNames);
  31488. recognizer.notifyErrorListeners(msg, e.offendingToken, e);
  31489. };
  31490. //
  31491. // This is called by {@link //reportError} when the exception is a
  31492. // {@link FailedPredicateException}.
  31493. //
  31494. // @see //reportError
  31495. //
  31496. // @param recognizer the parser instance
  31497. // @param e the recognition exception
  31498. //
  31499. DefaultErrorStrategy.prototype.reportFailedPredicate = function (recognizer, e) {
  31500. var ruleName = recognizer.ruleNames[recognizer._ctx.ruleIndex];
  31501. var msg = "rule " + ruleName + " " + e.message;
  31502. recognizer.notifyErrorListeners(msg, e.offendingToken, e);
  31503. };
  31504. // This method is called to report a syntax error which requires the removal
  31505. // of a token from the input stream. At the time this method is called, the
  31506. // erroneous symbol is current {@code LT(1)} symbol and has not yet been
  31507. // removed from the input stream. When this method returns,
  31508. // {@code recognizer} is in error recovery mode.
  31509. //
  31510. // <p>This method is called when {@link //singleTokenDeletion} identifies
  31511. // single-token deletion as a viable recovery strategy for a mismatched
  31512. // input error.</p>
  31513. //
  31514. // <p>The default implementation simply returns if the handler is already in
  31515. // error recovery mode. Otherwise, it calls {@link //beginErrorCondition} to
  31516. // enter error recovery mode, followed by calling
  31517. // {@link Parser//notifyErrorListeners}.</p>
  31518. //
  31519. // @param recognizer the parser instance
  31520. //
  31521. DefaultErrorStrategy.prototype.reportUnwantedToken = function (recognizer) {
  31522. if (this.inErrorRecoveryMode(recognizer)) {
  31523. return;
  31524. }
  31525. this.beginErrorCondition(recognizer);
  31526. var t = recognizer.getCurrentToken();
  31527. var tokenName = this.getTokenErrorDisplay(t);
  31528. var expecting = this.getExpectedTokens(recognizer);
  31529. var msg = "extraneous input " + tokenName + " expecting " + expecting.toString(recognizer.literalNames, recognizer.symbolicNames);
  31530. recognizer.notifyErrorListeners(msg, t, null);
  31531. };
  31532. // This method is called to report a syntax error which requires the
  31533. // insertion of a missing token into the input stream. At the time this
  31534. // method is called, the missing token has not yet been inserted. When this
  31535. // method returns, {@code recognizer} is in error recovery mode.
  31536. //
  31537. // <p>This method is called when {@link //singleTokenInsertion} identifies
  31538. // single-token insertion as a viable recovery strategy for a mismatched
  31539. // input error.</p>
  31540. //
  31541. // <p>The default implementation simply returns if the handler is already in
  31542. // error recovery mode. Otherwise, it calls {@link //beginErrorCondition} to
  31543. // enter error recovery mode, followed by calling
  31544. // {@link Parser//notifyErrorListeners}.</p>
  31545. //
  31546. // @param recognizer the parser instance
  31547. //
  31548. DefaultErrorStrategy.prototype.reportMissingToken = function (recognizer) {
  31549. if (this.inErrorRecoveryMode(recognizer)) {
  31550. return;
  31551. }
  31552. this.beginErrorCondition(recognizer);
  31553. var t = recognizer.getCurrentToken();
  31554. var expecting = this.getExpectedTokens(recognizer);
  31555. var msg = "missing " + expecting.toString(recognizer.literalNames, recognizer.symbolicNames) + " at " + this.getTokenErrorDisplay(t);
  31556. recognizer.notifyErrorListeners(msg, t, null);
  31557. };
  31558. // <p>The default implementation attempts to recover from the mismatched input
  31559. // by using single token insertion and deletion as described below. If the
  31560. // recovery attempt fails, this method throws an
  31561. // {@link InputMismatchException}.</p>
  31562. //
  31563. // <p><strong>EXTRA TOKEN</strong> (single token deletion)</p>
  31564. //
  31565. // <p>{@code LA(1)} is not what we are looking for. If {@code LA(2)} has the
  31566. // right token, however, then assume {@code LA(1)} is some extra spurious
  31567. // token and delete it. Then consume and return the next token (which was
  31568. // the {@code LA(2)} token) as the successful result of the match operation.</p>
  31569. //
  31570. // <p>This recovery strategy is implemented by {@link
  31571. // //singleTokenDeletion}.</p>
  31572. //
  31573. // <p><strong>MISSING TOKEN</strong> (single token insertion)</p>
  31574. //
  31575. // <p>If current token (at {@code LA(1)}) is consistent with what could come
  31576. // after the expected {@code LA(1)} token, then assume the token is missing
  31577. // and use the parser's {@link TokenFactory} to create it on the fly. The
  31578. // "insertion" is performed by returning the created token as the successful
  31579. // result of the match operation.</p>
  31580. //
  31581. // <p>This recovery strategy is implemented by {@link
  31582. // //singleTokenInsertion}.</p>
  31583. //
  31584. // <p><strong>EXAMPLE</strong></p>
  31585. //
  31586. // <p>For example, Input {@code i=(3;} is clearly missing the {@code ')'}. When
  31587. // the parser returns from the nested call to {@code expr}, it will have
  31588. // call chain:</p>
  31589. //
  31590. // <pre>
  31591. // stat &rarr; expr &rarr; atom
  31592. // </pre>
  31593. //
  31594. // and it will be trying to match the {@code ')'} at this point in the
  31595. // derivation:
  31596. //
  31597. // <pre>
  31598. // =&gt; ID '=' '(' INT ')' ('+' atom)* ';'
  31599. // ^
  31600. // </pre>
  31601. //
  31602. // The attempt to match {@code ')'} will fail when it sees {@code ';'} and
  31603. // call {@link //recoverInline}. To recover, it sees that {@code LA(1)==';'}
  31604. // is in the set of tokens that can follow the {@code ')'} token reference
  31605. // in rule {@code atom}. It can assume that you forgot the {@code ')'}.
  31606. //
  31607. DefaultErrorStrategy.prototype.recoverInline = function (recognizer) {
  31608. // SINGLE TOKEN DELETION
  31609. var matchedSymbol = this.singleTokenDeletion(recognizer);
  31610. if (matchedSymbol !== null) {
  31611. // we have deleted the extra token.
  31612. // now, move past ttype token as if all were ok
  31613. recognizer.consume();
  31614. return matchedSymbol;
  31615. }
  31616. // SINGLE TOKEN INSERTION
  31617. if (this.singleTokenInsertion(recognizer)) {
  31618. return this.getMissingSymbol(recognizer);
  31619. }
  31620. // even that didn't work; must throw the exception
  31621. throw new InputMismatchException(recognizer);
  31622. };
  31623. //
  31624. // This method implements the single-token insertion inline error recovery
  31625. // strategy. It is called by {@link //recoverInline} if the single-token
  31626. // deletion strategy fails to recover from the mismatched input. If this
  31627. // method returns {@code true}, {@code recognizer} will be in error recovery
  31628. // mode.
  31629. //
  31630. // <p>This method determines whether or not single-token insertion is viable by
  31631. // checking if the {@code LA(1)} input symbol could be successfully matched
  31632. // if it were instead the {@code LA(2)} symbol. If this method returns
  31633. // {@code true}, the caller is responsible for creating and inserting a
  31634. // token with the correct type to produce this behavior.</p>
  31635. //
  31636. // @param recognizer the parser instance
  31637. // @return {@code true} if single-token insertion is a viable recovery
  31638. // strategy for the current mismatched input, otherwise {@code false}
  31639. //
  31640. DefaultErrorStrategy.prototype.singleTokenInsertion = function (recognizer) {
  31641. var currentSymbolType = recognizer.getTokenStream().LA(1);
  31642. // if current token is consistent with what could come after current
  31643. // ATN state, then we know we're missing a token; error recovery
  31644. // is free to conjure up and insert the missing token
  31645. var atn = recognizer._interp.atn;
  31646. var currentState = atn.states[recognizer.state];
  31647. var next = currentState.transitions[0].target;
  31648. var expectingAtLL2 = atn.nextTokens(next, recognizer._ctx);
  31649. if (expectingAtLL2.contains(currentSymbolType)) {
  31650. this.reportMissingToken(recognizer);
  31651. return true;
  31652. } else {
  31653. return false;
  31654. }
  31655. };
  31656. // This method implements the single-token deletion inline error recovery
  31657. // strategy. It is called by {@link //recoverInline} to attempt to recover
  31658. // from mismatched input. If this method returns null, the parser and error
  31659. // handler state will not have changed. If this method returns non-null,
  31660. // {@code recognizer} will <em>not</em> be in error recovery mode since the
  31661. // returned token was a successful match.
  31662. //
  31663. // <p>If the single-token deletion is successful, this method calls
  31664. // {@link //reportUnwantedToken} to report the error, followed by
  31665. // {@link Parser//consume} to actually "delete" the extraneous token. Then,
  31666. // before returning {@link //reportMatch} is called to signal a successful
  31667. // match.</p>
  31668. //
  31669. // @param recognizer the parser instance
  31670. // @return the successfully matched {@link Token} instance if single-token
  31671. // deletion successfully recovers from the mismatched input, otherwise
  31672. // {@code null}
  31673. //
  31674. DefaultErrorStrategy.prototype.singleTokenDeletion = function (recognizer) {
  31675. var nextTokenType = recognizer.getTokenStream().LA(2);
  31676. var expecting = this.getExpectedTokens(recognizer);
  31677. if (expecting.contains(nextTokenType)) {
  31678. this.reportUnwantedToken(recognizer);
  31679. // print("recoverFromMismatchedToken deleting " \
  31680. // + str(recognizer.getTokenStream().LT(1)) \
  31681. // + " since " + str(recognizer.getTokenStream().LT(2)) \
  31682. // + " is what we want", file=sys.stderr)
  31683. recognizer.consume(); // simply delete extra token
  31684. // we want to return the token we're actually matching
  31685. var matchedSymbol = recognizer.getCurrentToken();
  31686. this.reportMatch(recognizer); // we know current token is correct
  31687. return matchedSymbol;
  31688. } else {
  31689. return null;
  31690. }
  31691. };
  31692. // Conjure up a missing token during error recovery.
  31693. //
  31694. // The recognizer attempts to recover from single missing
  31695. // symbols. But, actions might refer to that missing symbol.
  31696. // For example, x=ID {f($x);}. The action clearly assumes
  31697. // that there has been an identifier matched previously and that
  31698. // $x points at that token. If that token is missing, but
  31699. // the next token in the stream is what we want we assume that
  31700. // this token is missing and we keep going. Because we
  31701. // have to return some token to replace the missing token,
  31702. // we have to conjure one up. This method gives the user control
  31703. // over the tokens returned for missing tokens. Mostly,
  31704. // you will want to create something special for identifier
  31705. // tokens. For literals such as '{' and ',', the default
  31706. // action in the parser or tree parser works. It simply creates
  31707. // a CommonToken of the appropriate type. The text will be the token.
  31708. // If you change what tokens must be created by the lexer,
  31709. // override this method to create the appropriate tokens.
  31710. //
  31711. DefaultErrorStrategy.prototype.getMissingSymbol = function (recognizer) {
  31712. var currentSymbol = recognizer.getCurrentToken();
  31713. var expecting = this.getExpectedTokens(recognizer);
  31714. var expectedTokenType = expecting.first(); // get any element
  31715. var tokenText;
  31716. if (expectedTokenType === Token.EOF) {
  31717. tokenText = "<missing EOF>";
  31718. } else {
  31719. tokenText = "<missing " + recognizer.literalNames[expectedTokenType] + ">";
  31720. }
  31721. var current = currentSymbol;
  31722. var lookback = recognizer.getTokenStream().LT(-1);
  31723. if (current.type === Token.EOF && lookback !== null) {
  31724. current = lookback;
  31725. }
  31726. return recognizer.getTokenFactory().create(current.source, expectedTokenType, tokenText, Token.DEFAULT_CHANNEL, -1, -1, current.line, current.column);
  31727. };
  31728. DefaultErrorStrategy.prototype.getExpectedTokens = function (recognizer) {
  31729. return recognizer.getExpectedTokens();
  31730. };
  31731. // How should a token be displayed in an error message? The default
  31732. // is to display just the text, but during development you might
  31733. // want to have a lot of information spit out. Override in that case
  31734. // to use t.toString() (which, for CommonToken, dumps everything about
  31735. // the token). This is better than forcing you to override a method in
  31736. // your token objects because you don't have to go modify your lexer
  31737. // so that it creates a new Java type.
  31738. //
  31739. DefaultErrorStrategy.prototype.getTokenErrorDisplay = function (t) {
  31740. if (t === null) {
  31741. return "<no token>";
  31742. }
  31743. var s = t.text;
  31744. if (s === null) {
  31745. if (t.type === Token.EOF) {
  31746. s = "<EOF>";
  31747. } else {
  31748. s = "<" + t.type + ">";
  31749. }
  31750. }
  31751. return this.escapeWSAndQuote(s);
  31752. };
  31753. DefaultErrorStrategy.prototype.escapeWSAndQuote = function (s) {
  31754. s = s.replace(/\n/g, "\\n");
  31755. s = s.replace(/\r/g, "\\r");
  31756. s = s.replace(/\t/g, "\\t");
  31757. return "'" + s + "'";
  31758. };
  31759. // Compute the error recovery set for the current rule. During
  31760. // rule invocation, the parser pushes the set of tokens that can
  31761. // follow that rule reference on the stack; this amounts to
  31762. // computing FIRST of what follows the rule reference in the
  31763. // enclosing rule. See LinearApproximator.FIRST().
  31764. // This local follow set only includes tokens
  31765. // from within the rule; i.e., the FIRST computation done by
  31766. // ANTLR stops at the end of a rule.
  31767. //
  31768. // EXAMPLE
  31769. //
  31770. // When you find a "no viable alt exception", the input is not
  31771. // consistent with any of the alternatives for rule r. The best
  31772. // thing to do is to consume tokens until you see something that
  31773. // can legally follow a call to r//or* any rule that called r.
  31774. // You don't want the exact set of viable next tokens because the
  31775. // input might just be missing a token--you might consume the
  31776. // rest of the input looking for one of the missing tokens.
  31777. //
  31778. // Consider grammar:
  31779. //
  31780. // a : '[' b ']'
  31781. // | '(' b ')'
  31782. // ;
  31783. // b : c '^' INT ;
  31784. // c : ID
  31785. // | INT
  31786. // ;
  31787. //
  31788. // At each rule invocation, the set of tokens that could follow
  31789. // that rule is pushed on a stack. Here are the various
  31790. // context-sensitive follow sets:
  31791. //
  31792. // FOLLOW(b1_in_a) = FIRST(']') = ']'
  31793. // FOLLOW(b2_in_a) = FIRST(')') = ')'
  31794. // FOLLOW(c_in_b) = FIRST('^') = '^'
  31795. //
  31796. // Upon erroneous input "[]", the call chain is
  31797. //
  31798. // a -> b -> c
  31799. //
  31800. // and, hence, the follow context stack is:
  31801. //
  31802. // depth follow set start of rule execution
  31803. // 0 <EOF> a (from main())
  31804. // 1 ']' b
  31805. // 2 '^' c
  31806. //
  31807. // Notice that ')' is not included, because b would have to have
  31808. // been called from a different context in rule a for ')' to be
  31809. // included.
  31810. //
  31811. // For error recovery, we cannot consider FOLLOW(c)
  31812. // (context-sensitive or otherwise). We need the combined set of
  31813. // all context-sensitive FOLLOW sets--the set of all tokens that
  31814. // could follow any reference in the call chain. We need to
  31815. // resync to one of those tokens. Note that FOLLOW(c)='^' and if
  31816. // we resync'd to that token, we'd consume until EOF. We need to
  31817. // sync to context-sensitive FOLLOWs for a, b, and c: {']','^'}.
  31818. // In this case, for input "[]", LA(1) is ']' and in the set, so we would
  31819. // not consume anything. After printing an error, rule c would
  31820. // return normally. Rule b would not find the required '^' though.
  31821. // At this point, it gets a mismatched token error and throws an
  31822. // exception (since LA(1) is not in the viable following token
  31823. // set). The rule exception handler tries to recover, but finds
  31824. // the same recovery set and doesn't consume anything. Rule b
  31825. // exits normally returning to rule a. Now it finds the ']' (and
  31826. // with the successful match exits errorRecovery mode).
  31827. //
  31828. // So, you can see that the parser walks up the call chain looking
  31829. // for the token that was a member of the recovery set.
  31830. //
  31831. // Errors are not generated in errorRecovery mode.
  31832. //
  31833. // ANTLR's error recovery mechanism is based upon original ideas:
  31834. //
  31835. // "Algorithms + Data Structures = Programs" by Niklaus Wirth
  31836. //
  31837. // and
  31838. //
  31839. // "A note on error recovery in recursive descent parsers":
  31840. // http://portal.acm.org/citation.cfm?id=947902.947905
  31841. //
  31842. // Later, Josef Grosch had some good ideas:
  31843. //
  31844. // "Efficient and Comfortable Error Recovery in Recursive Descent
  31845. // Parsers":
  31846. // ftp://www.cocolab.com/products/cocktail/doca4.ps/ell.ps.zip
  31847. //
  31848. // Like Grosch I implement context-sensitive FOLLOW sets that are combined
  31849. // at run-time upon error to avoid overhead during parsing.
  31850. //
  31851. DefaultErrorStrategy.prototype.getErrorRecoverySet = function (recognizer) {
  31852. var atn = recognizer._interp.atn;
  31853. var ctx = recognizer._ctx;
  31854. var recoverSet = new IntervalSet();
  31855. while (ctx !== null && ctx.invokingState >= 0) {
  31856. // compute what follows who invoked us
  31857. var invokingState = atn.states[ctx.invokingState];
  31858. var rt = invokingState.transitions[0];
  31859. var follow = atn.nextTokens(rt.followState);
  31860. recoverSet.addSet(follow);
  31861. ctx = ctx.parentCtx;
  31862. }
  31863. recoverSet.removeOne(Token.EPSILON);
  31864. return recoverSet;
  31865. };
  31866. // Consume tokens until one matches the given token set.//
  31867. DefaultErrorStrategy.prototype.consumeUntil = function (recognizer, set) {
  31868. var ttype = recognizer.getTokenStream().LA(1);
  31869. while (ttype !== Token.EOF && !set.contains(ttype)) {
  31870. recognizer.consume();
  31871. ttype = recognizer.getTokenStream().LA(1);
  31872. }
  31873. };
  31874. //
  31875. // This implementation of {@link ANTLRErrorStrategy} responds to syntax errors
  31876. // by immediately canceling the parse operation with a
  31877. // {@link ParseCancellationException}. The implementation ensures that the
  31878. // {@link ParserRuleContext//exception} field is set for all parse tree nodes
  31879. // that were not completed prior to encountering the error.
  31880. //
  31881. // <p>
  31882. // This error strategy is useful in the following scenarios.</p>
  31883. //
  31884. // <ul>
  31885. // <li><strong>Two-stage parsing:</strong> This error strategy allows the first
  31886. // stage of two-stage parsing to immediately terminate if an error is
  31887. // encountered, and immediately fall back to the second stage. In addition to
  31888. // avoiding wasted work by attempting to recover from errors here, the empty
  31889. // implementation of {@link BailErrorStrategy//sync} improves the performance of
  31890. // the first stage.</li>
  31891. // <li><strong>Silent validation:</strong> When syntax errors are not being
  31892. // reported or logged, and the parse result is simply ignored if errors occur,
  31893. // the {@link BailErrorStrategy} avoids wasting work on recovering from errors
  31894. // when the result will be ignored either way.</li>
  31895. // </ul>
  31896. //
  31897. // <p>
  31898. // {@code myparser.setErrorHandler(new BailErrorStrategy());}</p>
  31899. //
  31900. // @see Parser//setErrorHandler(ANTLRErrorStrategy)
  31901. //
  31902. function BailErrorStrategy() {
  31903. DefaultErrorStrategy.call(this);
  31904. return this;
  31905. }
  31906. BailErrorStrategy.prototype = Object.create(DefaultErrorStrategy.prototype);
  31907. BailErrorStrategy.prototype.constructor = BailErrorStrategy;
  31908. // Instead of recovering from exception {@code e}, re-throw it wrapped
  31909. // in a {@link ParseCancellationException} so it is not caught by the
  31910. // rule function catches. Use {@link Exception//getCause()} to get the
  31911. // original {@link RecognitionException}.
  31912. //
  31913. BailErrorStrategy.prototype.recover = function (recognizer, e) {
  31914. var context = recognizer._ctx;
  31915. while (context !== null) {
  31916. context.exception = e;
  31917. context = context.parentCtx;
  31918. }
  31919. throw new ParseCancellationException(e);
  31920. };
  31921. // Make sure we don't attempt to recover inline; if the parser
  31922. // successfully recovers, it won't throw an exception.
  31923. //
  31924. BailErrorStrategy.prototype.recoverInline = function (recognizer) {
  31925. this.recover(recognizer, new InputMismatchException(recognizer));
  31926. };
  31927. // Make sure we don't attempt to recover from problems in subrules.//
  31928. BailErrorStrategy.prototype.sync = function (recognizer) {
  31929. // pass
  31930. };
  31931. exports.BailErrorStrategy = BailErrorStrategy;
  31932. exports.DefaultErrorStrategy = DefaultErrorStrategy;
  31933. /***/ }),
  31934. /***/ "./node_modules/antlr4/error/Errors.js":
  31935. /*!*********************************************!*\
  31936. !*** ./node_modules/antlr4/error/Errors.js ***!
  31937. \*********************************************/
  31938. /*! no static exports found */
  31939. /***/ (function(module, exports, __webpack_require__) {
  31940. "use strict";
  31941. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  31942. * Use of this file is governed by the BSD 3-clause license that
  31943. * can be found in the LICENSE.txt file in the project root.
  31944. */
  31945. // The root of the ANTLR exception hierarchy. In general, ANTLR tracks just
  31946. // 3 kinds of errors: prediction errors, failed predicate errors, and
  31947. // mismatched input errors. In each case, the parser knows where it is
  31948. // in the input, where it is in the ATN, the rule invocation stack,
  31949. // and what kind of problem occurred.
  31950. var PredicateTransition = __webpack_require__(/*! ./../atn/Transition */ "./node_modules/antlr4/atn/Transition.js").PredicateTransition;
  31951. function RecognitionException(params) {
  31952. Error.call(this);
  31953. if (!!Error.captureStackTrace) {
  31954. Error.captureStackTrace(this, RecognitionException);
  31955. } else {
  31956. var stack = new Error().stack;
  31957. }
  31958. this.message = params.message;
  31959. this.recognizer = params.recognizer;
  31960. this.input = params.input;
  31961. this.ctx = params.ctx;
  31962. // The current {@link Token} when an error occurred. Since not all streams
  31963. // support accessing symbols by index, we have to track the {@link Token}
  31964. // instance itself.
  31965. this.offendingToken = null;
  31966. // Get the ATN state number the parser was in at the time the error
  31967. // occurred. For {@link NoViableAltException} and
  31968. // {@link LexerNoViableAltException} exceptions, this is the
  31969. // {@link DecisionState} number. For others, it is the state whose outgoing
  31970. // edge we couldn't match.
  31971. this.offendingState = -1;
  31972. if (this.recognizer !== null) {
  31973. this.offendingState = this.recognizer.state;
  31974. }
  31975. return this;
  31976. }
  31977. RecognitionException.prototype = Object.create(Error.prototype);
  31978. RecognitionException.prototype.constructor = RecognitionException;
  31979. // <p>If the state number is not known, this method returns -1.</p>
  31980. //
  31981. // Gets the set of input symbols which could potentially follow the
  31982. // previously matched symbol at the time this exception was thrown.
  31983. //
  31984. // <p>If the set of expected tokens is not known and could not be computed,
  31985. // this method returns {@code null}.</p>
  31986. //
  31987. // @return The set of token types that could potentially follow the current
  31988. // state in the ATN, or {@code null} if the information is not available.
  31989. // /
  31990. RecognitionException.prototype.getExpectedTokens = function () {
  31991. if (this.recognizer !== null) {
  31992. return this.recognizer.atn.getExpectedTokens(this.offendingState, this.ctx);
  31993. } else {
  31994. return null;
  31995. }
  31996. };
  31997. RecognitionException.prototype.toString = function () {
  31998. return this.message;
  31999. };
  32000. function LexerNoViableAltException(lexer, input, startIndex, deadEndConfigs) {
  32001. RecognitionException.call(this, { message: "", recognizer: lexer, input: input, ctx: null });
  32002. this.startIndex = startIndex;
  32003. this.deadEndConfigs = deadEndConfigs;
  32004. return this;
  32005. }
  32006. LexerNoViableAltException.prototype = Object.create(RecognitionException.prototype);
  32007. LexerNoViableAltException.prototype.constructor = LexerNoViableAltException;
  32008. LexerNoViableAltException.prototype.toString = function () {
  32009. var symbol = "";
  32010. if (this.startIndex >= 0 && this.startIndex < this.input.size) {
  32011. symbol = this.input.getText((this.startIndex, this.startIndex));
  32012. }
  32013. return "LexerNoViableAltException" + symbol;
  32014. };
  32015. // Indicates that the parser could not decide which of two or more paths
  32016. // to take based upon the remaining input. It tracks the starting token
  32017. // of the offending input and also knows where the parser was
  32018. // in the various paths when the error. Reported by reportNoViableAlternative()
  32019. //
  32020. function NoViableAltException(recognizer, input, startToken, offendingToken, deadEndConfigs, ctx) {
  32021. ctx = ctx || recognizer._ctx;
  32022. offendingToken = offendingToken || recognizer.getCurrentToken();
  32023. startToken = startToken || recognizer.getCurrentToken();
  32024. input = input || recognizer.getInputStream();
  32025. RecognitionException.call(this, { message: "", recognizer: recognizer, input: input, ctx: ctx });
  32026. // Which configurations did we try at input.index() that couldn't match
  32027. // input.LT(1)?//
  32028. this.deadEndConfigs = deadEndConfigs;
  32029. // The token object at the start index; the input stream might
  32030. // not be buffering tokens so get a reference to it. (At the
  32031. // time the error occurred, of course the stream needs to keep a
  32032. // buffer all of the tokens but later we might not have access to those.)
  32033. this.startToken = startToken;
  32034. this.offendingToken = offendingToken;
  32035. }
  32036. NoViableAltException.prototype = Object.create(RecognitionException.prototype);
  32037. NoViableAltException.prototype.constructor = NoViableAltException;
  32038. // This signifies any kind of mismatched input exceptions such as
  32039. // when the current input does not match the expected token.
  32040. //
  32041. function InputMismatchException(recognizer) {
  32042. RecognitionException.call(this, { message: "", recognizer: recognizer, input: recognizer.getInputStream(), ctx: recognizer._ctx });
  32043. this.offendingToken = recognizer.getCurrentToken();
  32044. }
  32045. InputMismatchException.prototype = Object.create(RecognitionException.prototype);
  32046. InputMismatchException.prototype.constructor = InputMismatchException;
  32047. // A semantic predicate failed during validation. Validation of predicates
  32048. // occurs when normally parsing the alternative just like matching a token.
  32049. // Disambiguating predicate evaluation occurs when we test a predicate during
  32050. // prediction.
  32051. function FailedPredicateException(recognizer, predicate, message) {
  32052. RecognitionException.call(this, { message: this.formatMessage(predicate, message || null), recognizer: recognizer,
  32053. input: recognizer.getInputStream(), ctx: recognizer._ctx });
  32054. var s = recognizer._interp.atn.states[recognizer.state];
  32055. var trans = s.transitions[0];
  32056. if (trans instanceof PredicateTransition) {
  32057. this.ruleIndex = trans.ruleIndex;
  32058. this.predicateIndex = trans.predIndex;
  32059. } else {
  32060. this.ruleIndex = 0;
  32061. this.predicateIndex = 0;
  32062. }
  32063. this.predicate = predicate;
  32064. this.offendingToken = recognizer.getCurrentToken();
  32065. return this;
  32066. }
  32067. FailedPredicateException.prototype = Object.create(RecognitionException.prototype);
  32068. FailedPredicateException.prototype.constructor = FailedPredicateException;
  32069. FailedPredicateException.prototype.formatMessage = function (predicate, message) {
  32070. if (message !== null) {
  32071. return message;
  32072. } else {
  32073. return "failed predicate: {" + predicate + "}?";
  32074. }
  32075. };
  32076. function ParseCancellationException() {
  32077. Error.call(this);
  32078. Error.captureStackTrace(this, ParseCancellationException);
  32079. return this;
  32080. }
  32081. ParseCancellationException.prototype = Object.create(Error.prototype);
  32082. ParseCancellationException.prototype.constructor = ParseCancellationException;
  32083. exports.RecognitionException = RecognitionException;
  32084. exports.NoViableAltException = NoViableAltException;
  32085. exports.LexerNoViableAltException = LexerNoViableAltException;
  32086. exports.InputMismatchException = InputMismatchException;
  32087. exports.FailedPredicateException = FailedPredicateException;
  32088. exports.ParseCancellationException = ParseCancellationException;
  32089. /***/ }),
  32090. /***/ "./node_modules/antlr4/error/index.js":
  32091. /*!********************************************!*\
  32092. !*** ./node_modules/antlr4/error/index.js ***!
  32093. \********************************************/
  32094. /*! no static exports found */
  32095. /***/ (function(module, exports, __webpack_require__) {
  32096. "use strict";
  32097. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  32098. * Use of this file is governed by the BSD 3-clause license that
  32099. * can be found in the LICENSE.txt file in the project root.
  32100. */
  32101. exports.RecognitionException = __webpack_require__(/*! ./Errors */ "./node_modules/antlr4/error/Errors.js").RecognitionException;
  32102. exports.NoViableAltException = __webpack_require__(/*! ./Errors */ "./node_modules/antlr4/error/Errors.js").NoViableAltException;
  32103. exports.LexerNoViableAltException = __webpack_require__(/*! ./Errors */ "./node_modules/antlr4/error/Errors.js").LexerNoViableAltException;
  32104. exports.InputMismatchException = __webpack_require__(/*! ./Errors */ "./node_modules/antlr4/error/Errors.js").InputMismatchException;
  32105. exports.FailedPredicateException = __webpack_require__(/*! ./Errors */ "./node_modules/antlr4/error/Errors.js").FailedPredicateException;
  32106. exports.DiagnosticErrorListener = __webpack_require__(/*! ./DiagnosticErrorListener */ "./node_modules/antlr4/error/DiagnosticErrorListener.js").DiagnosticErrorListener;
  32107. exports.BailErrorStrategy = __webpack_require__(/*! ./ErrorStrategy */ "./node_modules/antlr4/error/ErrorStrategy.js").BailErrorStrategy;
  32108. exports.ErrorListener = __webpack_require__(/*! ./ErrorListener */ "./node_modules/antlr4/error/ErrorListener.js").ErrorListener;
  32109. /***/ }),
  32110. /***/ "./node_modules/antlr4/index.js":
  32111. /*!**************************************!*\
  32112. !*** ./node_modules/antlr4/index.js ***!
  32113. \**************************************/
  32114. /*! no static exports found */
  32115. /***/ (function(module, exports, __webpack_require__) {
  32116. "use strict";
  32117. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  32118. * Use of this file is governed by the BSD 3-clause license that
  32119. * can be found in the LICENSE.txt file in the project root.
  32120. */
  32121. exports.atn = __webpack_require__(/*! ./atn/index */ "./node_modules/antlr4/atn/index.js");
  32122. exports.codepointat = __webpack_require__(/*! ./polyfills/codepointat */ "./node_modules/antlr4/polyfills/codepointat.js");
  32123. exports.dfa = __webpack_require__(/*! ./dfa/index */ "./node_modules/antlr4/dfa/index.js");
  32124. exports.fromcodepoint = __webpack_require__(/*! ./polyfills/fromcodepoint */ "./node_modules/antlr4/polyfills/fromcodepoint.js");
  32125. exports.tree = __webpack_require__(/*! ./tree/index */ "./node_modules/antlr4/tree/index.js");
  32126. exports.error = __webpack_require__(/*! ./error/index */ "./node_modules/antlr4/error/index.js");
  32127. exports.Token = __webpack_require__(/*! ./Token */ "./node_modules/antlr4/Token.js").Token;
  32128. exports.CharStreams = __webpack_require__(/*! ./CharStreams */ "./node_modules/antlr4/CharStreams.js").CharStreams;
  32129. exports.CommonToken = __webpack_require__(/*! ./Token */ "./node_modules/antlr4/Token.js").CommonToken;
  32130. exports.InputStream = __webpack_require__(/*! ./InputStream */ "./node_modules/antlr4/InputStream.js").InputStream;
  32131. exports.FileStream = __webpack_require__(/*! ./FileStream */ "./node_modules/antlr4/FileStream.js").FileStream;
  32132. exports.CommonTokenStream = __webpack_require__(/*! ./CommonTokenStream */ "./node_modules/antlr4/CommonTokenStream.js").CommonTokenStream;
  32133. exports.Lexer = __webpack_require__(/*! ./Lexer */ "./node_modules/antlr4/Lexer.js").Lexer;
  32134. exports.Parser = __webpack_require__(/*! ./Parser */ "./node_modules/antlr4/Parser.js").Parser;
  32135. var pc = __webpack_require__(/*! ./PredictionContext */ "./node_modules/antlr4/PredictionContext.js");
  32136. exports.PredictionContextCache = pc.PredictionContextCache;
  32137. exports.ParserRuleContext = __webpack_require__(/*! ./ParserRuleContext */ "./node_modules/antlr4/ParserRuleContext.js").ParserRuleContext;
  32138. exports.Interval = __webpack_require__(/*! ./IntervalSet */ "./node_modules/antlr4/IntervalSet.js").Interval;
  32139. exports.Utils = __webpack_require__(/*! ./Utils */ "./node_modules/antlr4/Utils.js");
  32140. /***/ }),
  32141. /***/ "./node_modules/antlr4/polyfills/codepointat.js":
  32142. /*!******************************************************!*\
  32143. !*** ./node_modules/antlr4/polyfills/codepointat.js ***!
  32144. \******************************************************/
  32145. /*! no static exports found */
  32146. /***/ (function(module, exports, __webpack_require__) {
  32147. "use strict";
  32148. /*! https://mths.be/codepointat v0.2.0 by @mathias */
  32149. if (!String.prototype.codePointAt) {
  32150. (function () {
  32151. 'use strict'; // needed to support `apply`/`call` with `undefined`/`null`
  32152. var defineProperty = function () {
  32153. // IE 8 only supports `Object.defineProperty` on DOM elements
  32154. try {
  32155. var object = {};
  32156. var $defineProperty = Object.defineProperty;
  32157. var result = $defineProperty(object, object, object) && $defineProperty;
  32158. } catch (error) {}
  32159. return result;
  32160. }();
  32161. var codePointAt = function codePointAt(position) {
  32162. if (this == null) {
  32163. throw TypeError();
  32164. }
  32165. var string = String(this);
  32166. var size = string.length;
  32167. // `ToInteger`
  32168. var index = position ? Number(position) : 0;
  32169. if (index != index) {
  32170. // better `isNaN`
  32171. index = 0;
  32172. }
  32173. // Account for out-of-bounds indices:
  32174. if (index < 0 || index >= size) {
  32175. return undefined;
  32176. }
  32177. // Get the first code unit
  32178. var first = string.charCodeAt(index);
  32179. var second;
  32180. if ( // check if it’s the start of a surrogate pair
  32181. first >= 0xD800 && first <= 0xDBFF && // high surrogate
  32182. size > index + 1 // there is a next code unit
  32183. ) {
  32184. second = string.charCodeAt(index + 1);
  32185. if (second >= 0xDC00 && second <= 0xDFFF) {
  32186. // low surrogate
  32187. // https://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae
  32188. return (first - 0xD800) * 0x400 + second - 0xDC00 + 0x10000;
  32189. }
  32190. }
  32191. return first;
  32192. };
  32193. if (defineProperty) {
  32194. defineProperty(String.prototype, 'codePointAt', {
  32195. 'value': codePointAt,
  32196. 'configurable': true,
  32197. 'writable': true
  32198. });
  32199. } else {
  32200. String.prototype.codePointAt = codePointAt;
  32201. }
  32202. })();
  32203. }
  32204. /***/ }),
  32205. /***/ "./node_modules/antlr4/polyfills/fromcodepoint.js":
  32206. /*!********************************************************!*\
  32207. !*** ./node_modules/antlr4/polyfills/fromcodepoint.js ***!
  32208. \********************************************************/
  32209. /*! no static exports found */
  32210. /***/ (function(module, exports, __webpack_require__) {
  32211. "use strict";
  32212. /*! https://mths.be/fromcodepoint v0.2.1 by @mathias */
  32213. if (!String.fromCodePoint) {
  32214. (function () {
  32215. var defineProperty = function () {
  32216. // IE 8 only supports `Object.defineProperty` on DOM elements
  32217. try {
  32218. var object = {};
  32219. var $defineProperty = Object.defineProperty;
  32220. var result = $defineProperty(object, object, object) && $defineProperty;
  32221. } catch (error) {}
  32222. return result;
  32223. }();
  32224. var stringFromCharCode = String.fromCharCode;
  32225. var floor = Math.floor;
  32226. var fromCodePoint = function fromCodePoint(_) {
  32227. var MAX_SIZE = 0x4000;
  32228. var codeUnits = [];
  32229. var highSurrogate;
  32230. var lowSurrogate;
  32231. var index = -1;
  32232. var length = arguments.length;
  32233. if (!length) {
  32234. return '';
  32235. }
  32236. var result = '';
  32237. while (++index < length) {
  32238. var codePoint = Number(arguments[index]);
  32239. if (!isFinite(codePoint) || // `NaN`, `+Infinity`, or `-Infinity`
  32240. codePoint < 0 || // not a valid Unicode code point
  32241. codePoint > 0x10FFFF || // not a valid Unicode code point
  32242. floor(codePoint) != codePoint // not an integer
  32243. ) {
  32244. throw RangeError('Invalid code point: ' + codePoint);
  32245. }
  32246. if (codePoint <= 0xFFFF) {
  32247. // BMP code point
  32248. codeUnits.push(codePoint);
  32249. } else {
  32250. // Astral code point; split in surrogate halves
  32251. // https://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae
  32252. codePoint -= 0x10000;
  32253. highSurrogate = (codePoint >> 10) + 0xD800;
  32254. lowSurrogate = codePoint % 0x400 + 0xDC00;
  32255. codeUnits.push(highSurrogate, lowSurrogate);
  32256. }
  32257. if (index + 1 == length || codeUnits.length > MAX_SIZE) {
  32258. result += stringFromCharCode.apply(null, codeUnits);
  32259. codeUnits.length = 0;
  32260. }
  32261. }
  32262. return result;
  32263. };
  32264. if (defineProperty) {
  32265. defineProperty(String, 'fromCodePoint', {
  32266. 'value': fromCodePoint,
  32267. 'configurable': true,
  32268. 'writable': true
  32269. });
  32270. } else {
  32271. String.fromCodePoint = fromCodePoint;
  32272. }
  32273. })();
  32274. }
  32275. /***/ }),
  32276. /***/ "./node_modules/antlr4/tree/Tree.js":
  32277. /*!******************************************!*\
  32278. !*** ./node_modules/antlr4/tree/Tree.js ***!
  32279. \******************************************/
  32280. /*! no static exports found */
  32281. /***/ (function(module, exports, __webpack_require__) {
  32282. "use strict";
  32283. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  32284. * Use of this file is governed by the BSD 3-clause license that
  32285. * can be found in the LICENSE.txt file in the project root.
  32286. */
  32287. ///
  32288. // The basic notion of a tree has a parent, a payload, and a list of children.
  32289. // It is the most abstract interface for all the trees used by ANTLR.
  32290. ///
  32291. var Token = __webpack_require__(/*! ./../Token */ "./node_modules/antlr4/Token.js").Token;
  32292. var Interval = __webpack_require__(/*! ./../IntervalSet */ "./node_modules/antlr4/IntervalSet.js").Interval;
  32293. var INVALID_INTERVAL = new Interval(-1, -2);
  32294. var Utils = __webpack_require__(/*! ../Utils.js */ "./node_modules/antlr4/Utils.js");
  32295. function Tree() {
  32296. return this;
  32297. }
  32298. function SyntaxTree() {
  32299. Tree.call(this);
  32300. return this;
  32301. }
  32302. SyntaxTree.prototype = Object.create(Tree.prototype);
  32303. SyntaxTree.prototype.constructor = SyntaxTree;
  32304. function ParseTree() {
  32305. SyntaxTree.call(this);
  32306. return this;
  32307. }
  32308. ParseTree.prototype = Object.create(SyntaxTree.prototype);
  32309. ParseTree.prototype.constructor = ParseTree;
  32310. function RuleNode() {
  32311. ParseTree.call(this);
  32312. return this;
  32313. }
  32314. RuleNode.prototype = Object.create(ParseTree.prototype);
  32315. RuleNode.prototype.constructor = RuleNode;
  32316. function TerminalNode() {
  32317. ParseTree.call(this);
  32318. return this;
  32319. }
  32320. TerminalNode.prototype = Object.create(ParseTree.prototype);
  32321. TerminalNode.prototype.constructor = TerminalNode;
  32322. function ErrorNode() {
  32323. TerminalNode.call(this);
  32324. return this;
  32325. }
  32326. ErrorNode.prototype = Object.create(TerminalNode.prototype);
  32327. ErrorNode.prototype.constructor = ErrorNode;
  32328. function ParseTreeVisitor() {
  32329. return this;
  32330. }
  32331. ParseTreeVisitor.prototype.visit = function (ctx) {
  32332. if (Array.isArray(ctx)) {
  32333. return ctx.map(function (child) {
  32334. return child.accept(this);
  32335. }, this);
  32336. } else {
  32337. return ctx.accept(this);
  32338. }
  32339. };
  32340. ParseTreeVisitor.prototype.visitChildren = function (ctx) {
  32341. return this.visit(ctx.children);
  32342. };
  32343. ParseTreeVisitor.prototype.visitTerminal = function (node) {};
  32344. ParseTreeVisitor.prototype.visitErrorNode = function (node) {};
  32345. function ParseTreeListener() {
  32346. return this;
  32347. }
  32348. ParseTreeListener.prototype.visitTerminal = function (node) {};
  32349. ParseTreeListener.prototype.visitErrorNode = function (node) {};
  32350. ParseTreeListener.prototype.enterEveryRule = function (node) {};
  32351. ParseTreeListener.prototype.exitEveryRule = function (node) {};
  32352. function TerminalNodeImpl(symbol) {
  32353. TerminalNode.call(this);
  32354. this.parentCtx = null;
  32355. this.symbol = symbol;
  32356. return this;
  32357. }
  32358. TerminalNodeImpl.prototype = Object.create(TerminalNode.prototype);
  32359. TerminalNodeImpl.prototype.constructor = TerminalNodeImpl;
  32360. TerminalNodeImpl.prototype.getChild = function (i) {
  32361. return null;
  32362. };
  32363. TerminalNodeImpl.prototype.getSymbol = function () {
  32364. return this.symbol;
  32365. };
  32366. TerminalNodeImpl.prototype.getParent = function () {
  32367. return this.parentCtx;
  32368. };
  32369. TerminalNodeImpl.prototype.getPayload = function () {
  32370. return this.symbol;
  32371. };
  32372. TerminalNodeImpl.prototype.getSourceInterval = function () {
  32373. if (this.symbol === null) {
  32374. return INVALID_INTERVAL;
  32375. }
  32376. var tokenIndex = this.symbol.tokenIndex;
  32377. return new Interval(tokenIndex, tokenIndex);
  32378. };
  32379. TerminalNodeImpl.prototype.getChildCount = function () {
  32380. return 0;
  32381. };
  32382. TerminalNodeImpl.prototype.accept = function (visitor) {
  32383. return visitor.visitTerminal(this);
  32384. };
  32385. TerminalNodeImpl.prototype.getText = function () {
  32386. return this.symbol.text;
  32387. };
  32388. TerminalNodeImpl.prototype.toString = function () {
  32389. if (this.symbol.type === Token.EOF) {
  32390. return "<EOF>";
  32391. } else {
  32392. return this.symbol.text;
  32393. }
  32394. };
  32395. // Represents a token that was consumed during resynchronization
  32396. // rather than during a valid match operation. For example,
  32397. // we will create this kind of a node during single token insertion
  32398. // and deletion as well as during "consume until error recovery set"
  32399. // upon no viable alternative exceptions.
  32400. function ErrorNodeImpl(token) {
  32401. TerminalNodeImpl.call(this, token);
  32402. return this;
  32403. }
  32404. ErrorNodeImpl.prototype = Object.create(TerminalNodeImpl.prototype);
  32405. ErrorNodeImpl.prototype.constructor = ErrorNodeImpl;
  32406. ErrorNodeImpl.prototype.isErrorNode = function () {
  32407. return true;
  32408. };
  32409. ErrorNodeImpl.prototype.accept = function (visitor) {
  32410. return visitor.visitErrorNode(this);
  32411. };
  32412. function ParseTreeWalker() {
  32413. return this;
  32414. }
  32415. ParseTreeWalker.prototype.walk = function (listener, t) {
  32416. var errorNode = t instanceof ErrorNode || t.isErrorNode !== undefined && t.isErrorNode();
  32417. if (errorNode) {
  32418. listener.visitErrorNode(t);
  32419. } else if (t instanceof TerminalNode) {
  32420. listener.visitTerminal(t);
  32421. } else {
  32422. this.enterRule(listener, t);
  32423. for (var i = 0; i < t.getChildCount(); i++) {
  32424. var child = t.getChild(i);
  32425. this.walk(listener, child);
  32426. }
  32427. this.exitRule(listener, t);
  32428. }
  32429. };
  32430. //
  32431. // The discovery of a rule node, involves sending two events: the generic
  32432. // {@link ParseTreeListener//enterEveryRule} and a
  32433. // {@link RuleContext}-specific event. First we trigger the generic and then
  32434. // the rule specific. We to them in reverse order upon finishing the node.
  32435. //
  32436. ParseTreeWalker.prototype.enterRule = function (listener, r) {
  32437. var ctx = r.getRuleContext();
  32438. listener.enterEveryRule(ctx);
  32439. ctx.enterRule(listener);
  32440. };
  32441. ParseTreeWalker.prototype.exitRule = function (listener, r) {
  32442. var ctx = r.getRuleContext();
  32443. ctx.exitRule(listener);
  32444. listener.exitEveryRule(ctx);
  32445. };
  32446. ParseTreeWalker.DEFAULT = new ParseTreeWalker();
  32447. exports.RuleNode = RuleNode;
  32448. exports.ErrorNode = ErrorNode;
  32449. exports.TerminalNode = TerminalNode;
  32450. exports.ErrorNodeImpl = ErrorNodeImpl;
  32451. exports.TerminalNodeImpl = TerminalNodeImpl;
  32452. exports.ParseTreeListener = ParseTreeListener;
  32453. exports.ParseTreeVisitor = ParseTreeVisitor;
  32454. exports.ParseTreeWalker = ParseTreeWalker;
  32455. exports.INVALID_INTERVAL = INVALID_INTERVAL;
  32456. /***/ }),
  32457. /***/ "./node_modules/antlr4/tree/Trees.js":
  32458. /*!*******************************************!*\
  32459. !*** ./node_modules/antlr4/tree/Trees.js ***!
  32460. \*******************************************/
  32461. /*! no static exports found */
  32462. /***/ (function(module, exports, __webpack_require__) {
  32463. "use strict";
  32464. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  32465. * Use of this file is governed by the BSD 3-clause license that
  32466. * can be found in the LICENSE.txt file in the project root.
  32467. */
  32468. var Utils = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js");
  32469. var Token = __webpack_require__(/*! ./../Token */ "./node_modules/antlr4/Token.js").Token;
  32470. var RuleNode = __webpack_require__(/*! ./Tree */ "./node_modules/antlr4/tree/Tree.js").RuleNode;
  32471. var ErrorNode = __webpack_require__(/*! ./Tree */ "./node_modules/antlr4/tree/Tree.js").ErrorNode;
  32472. var TerminalNode = __webpack_require__(/*! ./Tree */ "./node_modules/antlr4/tree/Tree.js").TerminalNode;
  32473. var ParserRuleContext = __webpack_require__(/*! ./../ParserRuleContext */ "./node_modules/antlr4/ParserRuleContext.js").ParserRuleContext;
  32474. var RuleContext = __webpack_require__(/*! ./../RuleContext */ "./node_modules/antlr4/RuleContext.js").RuleContext;
  32475. var INVALID_ALT_NUMBER = __webpack_require__(/*! ./../atn/ATN */ "./node_modules/antlr4/atn/ATN.js").INVALID_ALT_NUMBER;
  32476. /** A set of utility routines useful for all kinds of ANTLR trees. */
  32477. function Trees() {}
  32478. // Print out a whole tree in LISP form. {@link //getNodeText} is used on the
  32479. // node payloads to get the text for the nodes. Detect
  32480. // parse trees and extract data appropriately.
  32481. Trees.toStringTree = function (tree, ruleNames, recog) {
  32482. ruleNames = ruleNames || null;
  32483. recog = recog || null;
  32484. if (recog !== null) {
  32485. ruleNames = recog.ruleNames;
  32486. }
  32487. var s = Trees.getNodeText(tree, ruleNames);
  32488. s = Utils.escapeWhitespace(s, false);
  32489. var c = tree.getChildCount();
  32490. if (c === 0) {
  32491. return s;
  32492. }
  32493. var res = "(" + s + ' ';
  32494. if (c > 0) {
  32495. s = Trees.toStringTree(tree.getChild(0), ruleNames);
  32496. res = res.concat(s);
  32497. }
  32498. for (var i = 1; i < c; i++) {
  32499. s = Trees.toStringTree(tree.getChild(i), ruleNames);
  32500. res = res.concat(' ' + s);
  32501. }
  32502. res = res.concat(")");
  32503. return res;
  32504. };
  32505. Trees.getNodeText = function (t, ruleNames, recog) {
  32506. ruleNames = ruleNames || null;
  32507. recog = recog || null;
  32508. if (recog !== null) {
  32509. ruleNames = recog.ruleNames;
  32510. }
  32511. if (ruleNames !== null) {
  32512. if (t instanceof RuleContext) {
  32513. var altNumber = t.getAltNumber();
  32514. if (altNumber != INVALID_ALT_NUMBER) {
  32515. return ruleNames[t.ruleIndex] + ":" + altNumber;
  32516. }
  32517. return ruleNames[t.ruleIndex];
  32518. } else if (t instanceof ErrorNode) {
  32519. return t.toString();
  32520. } else if (t instanceof TerminalNode) {
  32521. if (t.symbol !== null) {
  32522. return t.symbol.text;
  32523. }
  32524. }
  32525. }
  32526. // no recog for rule names
  32527. var payload = t.getPayload();
  32528. if (payload instanceof Token) {
  32529. return payload.text;
  32530. }
  32531. return t.getPayload().toString();
  32532. };
  32533. // Return ordered list of all children of this node
  32534. Trees.getChildren = function (t) {
  32535. var list = [];
  32536. for (var i = 0; i < t.getChildCount(); i++) {
  32537. list.push(t.getChild(i));
  32538. }
  32539. return list;
  32540. };
  32541. // Return a list of all ancestors of this node. The first node of
  32542. // list is the root and the last is the parent of this node.
  32543. //
  32544. Trees.getAncestors = function (t) {
  32545. var ancestors = [];
  32546. t = t.getParent();
  32547. while (t !== null) {
  32548. ancestors = [t].concat(ancestors);
  32549. t = t.getParent();
  32550. }
  32551. return ancestors;
  32552. };
  32553. Trees.findAllTokenNodes = function (t, ttype) {
  32554. return Trees.findAllNodes(t, ttype, true);
  32555. };
  32556. Trees.findAllRuleNodes = function (t, ruleIndex) {
  32557. return Trees.findAllNodes(t, ruleIndex, false);
  32558. };
  32559. Trees.findAllNodes = function (t, index, findTokens) {
  32560. var nodes = [];
  32561. Trees._findAllNodes(t, index, findTokens, nodes);
  32562. return nodes;
  32563. };
  32564. Trees._findAllNodes = function (t, index, findTokens, nodes) {
  32565. // check this node (the root) first
  32566. if (findTokens && t instanceof TerminalNode) {
  32567. if (t.symbol.type === index) {
  32568. nodes.push(t);
  32569. }
  32570. } else if (!findTokens && t instanceof ParserRuleContext) {
  32571. if (t.ruleIndex === index) {
  32572. nodes.push(t);
  32573. }
  32574. }
  32575. // check children
  32576. for (var i = 0; i < t.getChildCount(); i++) {
  32577. Trees._findAllNodes(t.getChild(i), index, findTokens, nodes);
  32578. }
  32579. };
  32580. Trees.descendants = function (t) {
  32581. var nodes = [t];
  32582. for (var i = 0; i < t.getChildCount(); i++) {
  32583. nodes = nodes.concat(Trees.descendants(t.getChild(i)));
  32584. }
  32585. return nodes;
  32586. };
  32587. exports.Trees = Trees;
  32588. /***/ }),
  32589. /***/ "./node_modules/antlr4/tree/index.js":
  32590. /*!*******************************************!*\
  32591. !*** ./node_modules/antlr4/tree/index.js ***!
  32592. \*******************************************/
  32593. /*! no static exports found */
  32594. /***/ (function(module, exports, __webpack_require__) {
  32595. "use strict";
  32596. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  32597. * Use of this file is governed by the BSD 3-clause license that
  32598. * can be found in the LICENSE.txt file in the project root.
  32599. */
  32600. var Tree = __webpack_require__(/*! ./Tree */ "./node_modules/antlr4/tree/Tree.js");
  32601. exports.Trees = __webpack_require__(/*! ./Trees */ "./node_modules/antlr4/tree/Trees.js").Trees;
  32602. exports.RuleNode = Tree.RuleNode;
  32603. exports.ParseTreeListener = Tree.ParseTreeListener;
  32604. exports.ParseTreeVisitor = Tree.ParseTreeVisitor;
  32605. exports.ParseTreeWalker = Tree.ParseTreeWalker;
  32606. /***/ }),
  32607. /***/ "./node_modules/decimal.js/decimal.js":
  32608. /*!********************************************!*\
  32609. !*** ./node_modules/decimal.js/decimal.js ***!
  32610. \********************************************/
  32611. /*! no static exports found */
  32612. /***/ (function(module, exports, __webpack_require__) {
  32613. "use strict";
  32614. var __WEBPACK_AMD_DEFINE_RESULT__;
  32615. var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
  32616. /*! decimal.js v10.0.1 https://github.com/MikeMcl/decimal.js/LICENCE */
  32617. ;(function (globalScope) {
  32618. 'use strict';
  32619. /*
  32620. * decimal.js v10.0.1
  32621. * An arbitrary-precision Decimal type for JavaScript.
  32622. * https://github.com/MikeMcl/decimal.js
  32623. * Copyright (c) 2017 Michael Mclaughlin <M8ch88l@gmail.com>
  32624. * MIT Licence
  32625. */
  32626. // ----------------------------------- EDITABLE DEFAULTS ------------------------------------ //
  32627. // The maximum exponent magnitude.
  32628. // The limit on the value of `toExpNeg`, `toExpPos`, `minE` and `maxE`.
  32629. var EXP_LIMIT = 9e15,
  32630. // 0 to 9e15
  32631. // The limit on the value of `precision`, and on the value of the first argument to
  32632. // `toDecimalPlaces`, `toExponential`, `toFixed`, `toPrecision` and `toSignificantDigits`.
  32633. MAX_DIGITS = 1e9,
  32634. // 0 to 1e9
  32635. // Base conversion alphabet.
  32636. NUMERALS = '0123456789abcdef',
  32637. // The natural logarithm of 10 (1025 digits).
  32638. LN10 = '2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058',
  32639. // Pi (1025 digits).
  32640. PI = '3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789',
  32641. // The initial configuration properties of the Decimal constructor.
  32642. DEFAULTS = {
  32643. // These values must be integers within the stated ranges (inclusive).
  32644. // Most of these values can be changed at run-time using the `Decimal.config` method.
  32645. // The maximum number of significant digits of the result of a calculation or base conversion.
  32646. // E.g. `Decimal.config({ precision: 20 });`
  32647. precision: 20, // 1 to MAX_DIGITS
  32648. // The rounding mode used when rounding to `precision`.
  32649. //
  32650. // ROUND_UP 0 Away from zero.
  32651. // ROUND_DOWN 1 Towards zero.
  32652. // ROUND_CEIL 2 Towards +Infinity.
  32653. // ROUND_FLOOR 3 Towards -Infinity.
  32654. // ROUND_HALF_UP 4 Towards nearest neighbour. If equidistant, up.
  32655. // ROUND_HALF_DOWN 5 Towards nearest neighbour. If equidistant, down.
  32656. // ROUND_HALF_EVEN 6 Towards nearest neighbour. If equidistant, towards even neighbour.
  32657. // ROUND_HALF_CEIL 7 Towards nearest neighbour. If equidistant, towards +Infinity.
  32658. // ROUND_HALF_FLOOR 8 Towards nearest neighbour. If equidistant, towards -Infinity.
  32659. //
  32660. // E.g.
  32661. // `Decimal.rounding = 4;`
  32662. // `Decimal.rounding = Decimal.ROUND_HALF_UP;`
  32663. rounding: 4, // 0 to 8
  32664. // The modulo mode used when calculating the modulus: a mod n.
  32665. // The quotient (q = a / n) is calculated according to the corresponding rounding mode.
  32666. // The remainder (r) is calculated as: r = a - n * q.
  32667. //
  32668. // UP 0 The remainder is positive if the dividend is negative, else is negative.
  32669. // DOWN 1 The remainder has the same sign as the dividend (JavaScript %).
  32670. // FLOOR 3 The remainder has the same sign as the divisor (Python %).
  32671. // HALF_EVEN 6 The IEEE 754 remainder function.
  32672. // EUCLID 9 Euclidian division. q = sign(n) * floor(a / abs(n)). Always positive.
  32673. //
  32674. // Truncated division (1), floored division (3), the IEEE 754 remainder (6), and Euclidian
  32675. // division (9) are commonly used for the modulus operation. The other rounding modes can also
  32676. // be used, but they may not give useful results.
  32677. modulo: 1, // 0 to 9
  32678. // The exponent value at and beneath which `toString` returns exponential notation.
  32679. // JavaScript numbers: -7
  32680. toExpNeg: -7, // 0 to -EXP_LIMIT
  32681. // The exponent value at and above which `toString` returns exponential notation.
  32682. // JavaScript numbers: 21
  32683. toExpPos: 21, // 0 to EXP_LIMIT
  32684. // The minimum exponent value, beneath which underflow to zero occurs.
  32685. // JavaScript numbers: -324 (5e-324)
  32686. minE: -EXP_LIMIT, // -1 to -EXP_LIMIT
  32687. // The maximum exponent value, above which overflow to Infinity occurs.
  32688. // JavaScript numbers: 308 (1.7976931348623157e+308)
  32689. maxE: EXP_LIMIT, // 1 to EXP_LIMIT
  32690. // Whether to use cryptographically-secure random number generation, if available.
  32691. crypto: false // true/false
  32692. },
  32693. // ----------------------------------- END OF EDITABLE DEFAULTS ------------------------------- //
  32694. Decimal,
  32695. inexact,
  32696. noConflict,
  32697. quadrant,
  32698. external = true,
  32699. decimalError = '[DecimalError] ',
  32700. invalidArgument = decimalError + 'Invalid argument: ',
  32701. precisionLimitExceeded = decimalError + 'Precision limit exceeded',
  32702. cryptoUnavailable = decimalError + 'crypto unavailable',
  32703. mathfloor = Math.floor,
  32704. mathpow = Math.pow,
  32705. isBinary = /^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i,
  32706. isHex = /^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i,
  32707. isOctal = /^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i,
  32708. isDecimal = /^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,
  32709. BASE = 1e7,
  32710. LOG_BASE = 7,
  32711. MAX_SAFE_INTEGER = 9007199254740991,
  32712. LN10_PRECISION = LN10.length - 1,
  32713. PI_PRECISION = PI.length - 1,
  32714. // Decimal.prototype object
  32715. P = { name: '[object Decimal]' };
  32716. // Decimal prototype methods
  32717. /*
  32718. * absoluteValue abs
  32719. * ceil
  32720. * comparedTo cmp
  32721. * cosine cos
  32722. * cubeRoot cbrt
  32723. * decimalPlaces dp
  32724. * dividedBy div
  32725. * dividedToIntegerBy divToInt
  32726. * equals eq
  32727. * floor
  32728. * greaterThan gt
  32729. * greaterThanOrEqualTo gte
  32730. * hyperbolicCosine cosh
  32731. * hyperbolicSine sinh
  32732. * hyperbolicTangent tanh
  32733. * inverseCosine acos
  32734. * inverseHyperbolicCosine acosh
  32735. * inverseHyperbolicSine asinh
  32736. * inverseHyperbolicTangent atanh
  32737. * inverseSine asin
  32738. * inverseTangent atan
  32739. * isFinite
  32740. * isInteger isInt
  32741. * isNaN
  32742. * isNegative isNeg
  32743. * isPositive isPos
  32744. * isZero
  32745. * lessThan lt
  32746. * lessThanOrEqualTo lte
  32747. * logarithm log
  32748. * [maximum] [max]
  32749. * [minimum] [min]
  32750. * minus sub
  32751. * modulo mod
  32752. * naturalExponential exp
  32753. * naturalLogarithm ln
  32754. * negated neg
  32755. * plus add
  32756. * precision sd
  32757. * round
  32758. * sine sin
  32759. * squareRoot sqrt
  32760. * tangent tan
  32761. * times mul
  32762. * toBinary
  32763. * toDecimalPlaces toDP
  32764. * toExponential
  32765. * toFixed
  32766. * toFraction
  32767. * toHexadecimal toHex
  32768. * toNearest
  32769. * toNumber
  32770. * toOctal
  32771. * toPower pow
  32772. * toPrecision
  32773. * toSignificantDigits toSD
  32774. * toString
  32775. * truncated trunc
  32776. * valueOf toJSON
  32777. */
  32778. /*
  32779. * Return a new Decimal whose value is the absolute value of this Decimal.
  32780. *
  32781. */
  32782. P.absoluteValue = P.abs = function () {
  32783. var x = new this.constructor(this);
  32784. if (x.s < 0) x.s = 1;
  32785. return finalise(x);
  32786. };
  32787. /*
  32788. * Return a new Decimal whose value is the value of this Decimal rounded to a whole number in the
  32789. * direction of positive Infinity.
  32790. *
  32791. */
  32792. P.ceil = function () {
  32793. return finalise(new this.constructor(this), this.e + 1, 2);
  32794. };
  32795. /*
  32796. * Return
  32797. * 1 if the value of this Decimal is greater than the value of `y`,
  32798. * -1 if the value of this Decimal is less than the value of `y`,
  32799. * 0 if they have the same value,
  32800. * NaN if the value of either Decimal is NaN.
  32801. *
  32802. */
  32803. P.comparedTo = P.cmp = function (y) {
  32804. var i,
  32805. j,
  32806. xdL,
  32807. ydL,
  32808. x = this,
  32809. xd = x.d,
  32810. yd = (y = new x.constructor(y)).d,
  32811. xs = x.s,
  32812. ys = y.s;
  32813. // Either NaN or ±Infinity?
  32814. if (!xd || !yd) {
  32815. return !xs || !ys ? NaN : xs !== ys ? xs : xd === yd ? 0 : !xd ^ xs < 0 ? 1 : -1;
  32816. }
  32817. // Either zero?
  32818. if (!xd[0] || !yd[0]) return xd[0] ? xs : yd[0] ? -ys : 0;
  32819. // Signs differ?
  32820. if (xs !== ys) return xs;
  32821. // Compare exponents.
  32822. if (x.e !== y.e) return x.e > y.e ^ xs < 0 ? 1 : -1;
  32823. xdL = xd.length;
  32824. ydL = yd.length;
  32825. // Compare digit by digit.
  32826. for (i = 0, j = xdL < ydL ? xdL : ydL; i < j; ++i) {
  32827. if (xd[i] !== yd[i]) return xd[i] > yd[i] ^ xs < 0 ? 1 : -1;
  32828. }
  32829. // Compare lengths.
  32830. return xdL === ydL ? 0 : xdL > ydL ^ xs < 0 ? 1 : -1;
  32831. };
  32832. /*
  32833. * Return a new Decimal whose value is the cosine of the value in radians of this Decimal.
  32834. *
  32835. * Domain: [-Infinity, Infinity]
  32836. * Range: [-1, 1]
  32837. *
  32838. * cos(0) = 1
  32839. * cos(-0) = 1
  32840. * cos(Infinity) = NaN
  32841. * cos(-Infinity) = NaN
  32842. * cos(NaN) = NaN
  32843. *
  32844. */
  32845. P.cosine = P.cos = function () {
  32846. var pr,
  32847. rm,
  32848. x = this,
  32849. Ctor = x.constructor;
  32850. if (!x.d) return new Ctor(NaN);
  32851. // cos(0) = cos(-0) = 1
  32852. if (!x.d[0]) return new Ctor(1);
  32853. pr = Ctor.precision;
  32854. rm = Ctor.rounding;
  32855. Ctor.precision = pr + Math.max(x.e, x.sd()) + LOG_BASE;
  32856. Ctor.rounding = 1;
  32857. x = cosine(Ctor, toLessThanHalfPi(Ctor, x));
  32858. Ctor.precision = pr;
  32859. Ctor.rounding = rm;
  32860. return finalise(quadrant == 2 || quadrant == 3 ? x.neg() : x, pr, rm, true);
  32861. };
  32862. /*
  32863. *
  32864. * Return a new Decimal whose value is the cube root of the value of this Decimal, rounded to
  32865. * `precision` significant digits using rounding mode `rounding`.
  32866. *
  32867. * cbrt(0) = 0
  32868. * cbrt(-0) = -0
  32869. * cbrt(1) = 1
  32870. * cbrt(-1) = -1
  32871. * cbrt(N) = N
  32872. * cbrt(-I) = -I
  32873. * cbrt(I) = I
  32874. *
  32875. * Math.cbrt(x) = (x < 0 ? -Math.pow(-x, 1/3) : Math.pow(x, 1/3))
  32876. *
  32877. */
  32878. P.cubeRoot = P.cbrt = function () {
  32879. var e,
  32880. m,
  32881. n,
  32882. r,
  32883. rep,
  32884. s,
  32885. sd,
  32886. t,
  32887. t3,
  32888. t3plusx,
  32889. x = this,
  32890. Ctor = x.constructor;
  32891. if (!x.isFinite() || x.isZero()) return new Ctor(x);
  32892. external = false;
  32893. // Initial estimate.
  32894. s = x.s * Math.pow(x.s * x, 1 / 3);
  32895. // Math.cbrt underflow/overflow?
  32896. // Pass x to Math.pow as integer, then adjust the exponent of the result.
  32897. if (!s || Math.abs(s) == 1 / 0) {
  32898. n = digitsToString(x.d);
  32899. e = x.e;
  32900. // Adjust n exponent so it is a multiple of 3 away from x exponent.
  32901. if (s = (e - n.length + 1) % 3) n += s == 1 || s == -2 ? '0' : '00';
  32902. s = Math.pow(n, 1 / 3);
  32903. // Rarely, e may be one less than the result exponent value.
  32904. e = mathfloor((e + 1) / 3) - (e % 3 == (e < 0 ? -1 : 2));
  32905. if (s == 1 / 0) {
  32906. n = '5e' + e;
  32907. } else {
  32908. n = s.toExponential();
  32909. n = n.slice(0, n.indexOf('e') + 1) + e;
  32910. }
  32911. r = new Ctor(n);
  32912. r.s = x.s;
  32913. } else {
  32914. r = new Ctor(s.toString());
  32915. }
  32916. sd = (e = Ctor.precision) + 3;
  32917. // Halley's method.
  32918. // TODO? Compare Newton's method.
  32919. for (;;) {
  32920. t = r;
  32921. t3 = t.times(t).times(t);
  32922. t3plusx = t3.plus(x);
  32923. r = divide(t3plusx.plus(x).times(t), t3plusx.plus(t3), sd + 2, 1);
  32924. // TODO? Replace with for-loop and checkRoundingDigits.
  32925. if (digitsToString(t.d).slice(0, sd) === (n = digitsToString(r.d)).slice(0, sd)) {
  32926. n = n.slice(sd - 3, sd + 1);
  32927. // The 4th rounding digit may be in error by -1 so if the 4 rounding digits are 9999 or 4999
  32928. // , i.e. approaching a rounding boundary, continue the iteration.
  32929. if (n == '9999' || !rep && n == '4999') {
  32930. // On the first iteration only, check to see if rounding up gives the exact result as the
  32931. // nines may infinitely repeat.
  32932. if (!rep) {
  32933. finalise(t, e + 1, 0);
  32934. if (t.times(t).times(t).eq(x)) {
  32935. r = t;
  32936. break;
  32937. }
  32938. }
  32939. sd += 4;
  32940. rep = 1;
  32941. } else {
  32942. // If the rounding digits are null, 0{0,4} or 50{0,3}, check for an exact result.
  32943. // If not, then there are further digits and m will be truthy.
  32944. if (!+n || !+n.slice(1) && n.charAt(0) == '5') {
  32945. // Truncate to the first rounding digit.
  32946. finalise(r, e + 1, 1);
  32947. m = !r.times(r).times(r).eq(x);
  32948. }
  32949. break;
  32950. }
  32951. }
  32952. }
  32953. external = true;
  32954. return finalise(r, e, Ctor.rounding, m);
  32955. };
  32956. /*
  32957. * Return the number of decimal places of the value of this Decimal.
  32958. *
  32959. */
  32960. P.decimalPlaces = P.dp = function () {
  32961. var w,
  32962. d = this.d,
  32963. n = NaN;
  32964. if (d) {
  32965. w = d.length - 1;
  32966. n = (w - mathfloor(this.e / LOG_BASE)) * LOG_BASE;
  32967. // Subtract the number of trailing zeros of the last word.
  32968. w = d[w];
  32969. if (w) for (; w % 10 == 0; w /= 10) {
  32970. n--;
  32971. }if (n < 0) n = 0;
  32972. }
  32973. return n;
  32974. };
  32975. /*
  32976. * n / 0 = I
  32977. * n / N = N
  32978. * n / I = 0
  32979. * 0 / n = 0
  32980. * 0 / 0 = N
  32981. * 0 / N = N
  32982. * 0 / I = 0
  32983. * N / n = N
  32984. * N / 0 = N
  32985. * N / N = N
  32986. * N / I = N
  32987. * I / n = I
  32988. * I / 0 = I
  32989. * I / N = N
  32990. * I / I = N
  32991. *
  32992. * Return a new Decimal whose value is the value of this Decimal divided by `y`, rounded to
  32993. * `precision` significant digits using rounding mode `rounding`.
  32994. *
  32995. */
  32996. P.dividedBy = P.div = function (y) {
  32997. return divide(this, new this.constructor(y));
  32998. };
  32999. /*
  33000. * Return a new Decimal whose value is the integer part of dividing the value of this Decimal
  33001. * by the value of `y`, rounded to `precision` significant digits using rounding mode `rounding`.
  33002. *
  33003. */
  33004. P.dividedToIntegerBy = P.divToInt = function (y) {
  33005. var x = this,
  33006. Ctor = x.constructor;
  33007. return finalise(divide(x, new Ctor(y), 0, 1, 1), Ctor.precision, Ctor.rounding);
  33008. };
  33009. /*
  33010. * Return true if the value of this Decimal is equal to the value of `y`, otherwise return false.
  33011. *
  33012. */
  33013. P.equals = P.eq = function (y) {
  33014. return this.cmp(y) === 0;
  33015. };
  33016. /*
  33017. * Return a new Decimal whose value is the value of this Decimal rounded to a whole number in the
  33018. * direction of negative Infinity.
  33019. *
  33020. */
  33021. P.floor = function () {
  33022. return finalise(new this.constructor(this), this.e + 1, 3);
  33023. };
  33024. /*
  33025. * Return true if the value of this Decimal is greater than the value of `y`, otherwise return
  33026. * false.
  33027. *
  33028. */
  33029. P.greaterThan = P.gt = function (y) {
  33030. return this.cmp(y) > 0;
  33031. };
  33032. /*
  33033. * Return true if the value of this Decimal is greater than or equal to the value of `y`,
  33034. * otherwise return false.
  33035. *
  33036. */
  33037. P.greaterThanOrEqualTo = P.gte = function (y) {
  33038. var k = this.cmp(y);
  33039. return k == 1 || k === 0;
  33040. };
  33041. /*
  33042. * Return a new Decimal whose value is the hyperbolic cosine of the value in radians of this
  33043. * Decimal.
  33044. *
  33045. * Domain: [-Infinity, Infinity]
  33046. * Range: [1, Infinity]
  33047. *
  33048. * cosh(x) = 1 + x^2/2! + x^4/4! + x^6/6! + ...
  33049. *
  33050. * cosh(0) = 1
  33051. * cosh(-0) = 1
  33052. * cosh(Infinity) = Infinity
  33053. * cosh(-Infinity) = Infinity
  33054. * cosh(NaN) = NaN
  33055. *
  33056. * x time taken (ms) result
  33057. * 1000 9 9.8503555700852349694e+433
  33058. * 10000 25 4.4034091128314607936e+4342
  33059. * 100000 171 1.4033316802130615897e+43429
  33060. * 1000000 3817 1.5166076984010437725e+434294
  33061. * 10000000 abandoned after 2 minute wait
  33062. *
  33063. * TODO? Compare performance of cosh(x) = 0.5 * (exp(x) + exp(-x))
  33064. *
  33065. */
  33066. P.hyperbolicCosine = P.cosh = function () {
  33067. var k,
  33068. n,
  33069. pr,
  33070. rm,
  33071. len,
  33072. x = this,
  33073. Ctor = x.constructor,
  33074. one = new Ctor(1);
  33075. if (!x.isFinite()) return new Ctor(x.s ? 1 / 0 : NaN);
  33076. if (x.isZero()) return one;
  33077. pr = Ctor.precision;
  33078. rm = Ctor.rounding;
  33079. Ctor.precision = pr + Math.max(x.e, x.sd()) + 4;
  33080. Ctor.rounding = 1;
  33081. len = x.d.length;
  33082. // Argument reduction: cos(4x) = 1 - 8cos^2(x) + 8cos^4(x) + 1
  33083. // i.e. cos(x) = 1 - cos^2(x/4)(8 - 8cos^2(x/4))
  33084. // Estimate the optimum number of times to use the argument reduction.
  33085. // TODO? Estimation reused from cosine() and may not be optimal here.
  33086. if (len < 32) {
  33087. k = Math.ceil(len / 3);
  33088. n = Math.pow(4, -k).toString();
  33089. } else {
  33090. k = 16;
  33091. n = '2.3283064365386962890625e-10';
  33092. }
  33093. x = taylorSeries(Ctor, 1, x.times(n), new Ctor(1), true);
  33094. // Reverse argument reduction
  33095. var cosh2_x,
  33096. i = k,
  33097. d8 = new Ctor(8);
  33098. for (; i--;) {
  33099. cosh2_x = x.times(x);
  33100. x = one.minus(cosh2_x.times(d8.minus(cosh2_x.times(d8))));
  33101. }
  33102. return finalise(x, Ctor.precision = pr, Ctor.rounding = rm, true);
  33103. };
  33104. /*
  33105. * Return a new Decimal whose value is the hyperbolic sine of the value in radians of this
  33106. * Decimal.
  33107. *
  33108. * Domain: [-Infinity, Infinity]
  33109. * Range: [-Infinity, Infinity]
  33110. *
  33111. * sinh(x) = x + x^3/3! + x^5/5! + x^7/7! + ...
  33112. *
  33113. * sinh(0) = 0
  33114. * sinh(-0) = -0
  33115. * sinh(Infinity) = Infinity
  33116. * sinh(-Infinity) = -Infinity
  33117. * sinh(NaN) = NaN
  33118. *
  33119. * x time taken (ms)
  33120. * 10 2 ms
  33121. * 100 5 ms
  33122. * 1000 14 ms
  33123. * 10000 82 ms
  33124. * 100000 886 ms 1.4033316802130615897e+43429
  33125. * 200000 2613 ms
  33126. * 300000 5407 ms
  33127. * 400000 8824 ms
  33128. * 500000 13026 ms 8.7080643612718084129e+217146
  33129. * 1000000 48543 ms
  33130. *
  33131. * TODO? Compare performance of sinh(x) = 0.5 * (exp(x) - exp(-x))
  33132. *
  33133. */
  33134. P.hyperbolicSine = P.sinh = function () {
  33135. var k,
  33136. pr,
  33137. rm,
  33138. len,
  33139. x = this,
  33140. Ctor = x.constructor;
  33141. if (!x.isFinite() || x.isZero()) return new Ctor(x);
  33142. pr = Ctor.precision;
  33143. rm = Ctor.rounding;
  33144. Ctor.precision = pr + Math.max(x.e, x.sd()) + 4;
  33145. Ctor.rounding = 1;
  33146. len = x.d.length;
  33147. if (len < 3) {
  33148. x = taylorSeries(Ctor, 2, x, x, true);
  33149. } else {
  33150. // Alternative argument reduction: sinh(3x) = sinh(x)(3 + 4sinh^2(x))
  33151. // i.e. sinh(x) = sinh(x/3)(3 + 4sinh^2(x/3))
  33152. // 3 multiplications and 1 addition
  33153. // Argument reduction: sinh(5x) = sinh(x)(5 + sinh^2(x)(20 + 16sinh^2(x)))
  33154. // i.e. sinh(x) = sinh(x/5)(5 + sinh^2(x/5)(20 + 16sinh^2(x/5)))
  33155. // 4 multiplications and 2 additions
  33156. // Estimate the optimum number of times to use the argument reduction.
  33157. k = 1.4 * Math.sqrt(len);
  33158. k = k > 16 ? 16 : k | 0;
  33159. x = x.times(Math.pow(5, -k));
  33160. x = taylorSeries(Ctor, 2, x, x, true);
  33161. // Reverse argument reduction
  33162. var sinh2_x,
  33163. d5 = new Ctor(5),
  33164. d16 = new Ctor(16),
  33165. d20 = new Ctor(20);
  33166. for (; k--;) {
  33167. sinh2_x = x.times(x);
  33168. x = x.times(d5.plus(sinh2_x.times(d16.times(sinh2_x).plus(d20))));
  33169. }
  33170. }
  33171. Ctor.precision = pr;
  33172. Ctor.rounding = rm;
  33173. return finalise(x, pr, rm, true);
  33174. };
  33175. /*
  33176. * Return a new Decimal whose value is the hyperbolic tangent of the value in radians of this
  33177. * Decimal.
  33178. *
  33179. * Domain: [-Infinity, Infinity]
  33180. * Range: [-1, 1]
  33181. *
  33182. * tanh(x) = sinh(x) / cosh(x)
  33183. *
  33184. * tanh(0) = 0
  33185. * tanh(-0) = -0
  33186. * tanh(Infinity) = 1
  33187. * tanh(-Infinity) = -1
  33188. * tanh(NaN) = NaN
  33189. *
  33190. */
  33191. P.hyperbolicTangent = P.tanh = function () {
  33192. var pr,
  33193. rm,
  33194. x = this,
  33195. Ctor = x.constructor;
  33196. if (!x.isFinite()) return new Ctor(x.s);
  33197. if (x.isZero()) return new Ctor(x);
  33198. pr = Ctor.precision;
  33199. rm = Ctor.rounding;
  33200. Ctor.precision = pr + 7;
  33201. Ctor.rounding = 1;
  33202. return divide(x.sinh(), x.cosh(), Ctor.precision = pr, Ctor.rounding = rm);
  33203. };
  33204. /*
  33205. * Return a new Decimal whose value is the arccosine (inverse cosine) in radians of the value of
  33206. * this Decimal.
  33207. *
  33208. * Domain: [-1, 1]
  33209. * Range: [0, pi]
  33210. *
  33211. * acos(x) = pi/2 - asin(x)
  33212. *
  33213. * acos(0) = pi/2
  33214. * acos(-0) = pi/2
  33215. * acos(1) = 0
  33216. * acos(-1) = pi
  33217. * acos(1/2) = pi/3
  33218. * acos(-1/2) = 2*pi/3
  33219. * acos(|x| > 1) = NaN
  33220. * acos(NaN) = NaN
  33221. *
  33222. */
  33223. P.inverseCosine = P.acos = function () {
  33224. var halfPi,
  33225. x = this,
  33226. Ctor = x.constructor,
  33227. k = x.abs().cmp(1),
  33228. pr = Ctor.precision,
  33229. rm = Ctor.rounding;
  33230. if (k !== -1) {
  33231. return k === 0
  33232. // |x| is 1
  33233. ? x.isNeg() ? getPi(Ctor, pr, rm) : new Ctor(0)
  33234. // |x| > 1 or x is NaN
  33235. : new Ctor(NaN);
  33236. }
  33237. if (x.isZero()) return getPi(Ctor, pr + 4, rm).times(0.5);
  33238. // TODO? Special case acos(0.5) = pi/3 and acos(-0.5) = 2*pi/3
  33239. Ctor.precision = pr + 6;
  33240. Ctor.rounding = 1;
  33241. x = x.asin();
  33242. halfPi = getPi(Ctor, pr + 4, rm).times(0.5);
  33243. Ctor.precision = pr;
  33244. Ctor.rounding = rm;
  33245. return halfPi.minus(x);
  33246. };
  33247. /*
  33248. * Return a new Decimal whose value is the inverse of the hyperbolic cosine in radians of the
  33249. * value of this Decimal.
  33250. *
  33251. * Domain: [1, Infinity]
  33252. * Range: [0, Infinity]
  33253. *
  33254. * acosh(x) = ln(x + sqrt(x^2 - 1))
  33255. *
  33256. * acosh(x < 1) = NaN
  33257. * acosh(NaN) = NaN
  33258. * acosh(Infinity) = Infinity
  33259. * acosh(-Infinity) = NaN
  33260. * acosh(0) = NaN
  33261. * acosh(-0) = NaN
  33262. * acosh(1) = 0
  33263. * acosh(-1) = NaN
  33264. *
  33265. */
  33266. P.inverseHyperbolicCosine = P.acosh = function () {
  33267. var pr,
  33268. rm,
  33269. x = this,
  33270. Ctor = x.constructor;
  33271. if (x.lte(1)) return new Ctor(x.eq(1) ? 0 : NaN);
  33272. if (!x.isFinite()) return new Ctor(x);
  33273. pr = Ctor.precision;
  33274. rm = Ctor.rounding;
  33275. Ctor.precision = pr + Math.max(Math.abs(x.e), x.sd()) + 4;
  33276. Ctor.rounding = 1;
  33277. external = false;
  33278. x = x.times(x).minus(1).sqrt().plus(x);
  33279. external = true;
  33280. Ctor.precision = pr;
  33281. Ctor.rounding = rm;
  33282. return x.ln();
  33283. };
  33284. /*
  33285. * Return a new Decimal whose value is the inverse of the hyperbolic sine in radians of the value
  33286. * of this Decimal.
  33287. *
  33288. * Domain: [-Infinity, Infinity]
  33289. * Range: [-Infinity, Infinity]
  33290. *
  33291. * asinh(x) = ln(x + sqrt(x^2 + 1))
  33292. *
  33293. * asinh(NaN) = NaN
  33294. * asinh(Infinity) = Infinity
  33295. * asinh(-Infinity) = -Infinity
  33296. * asinh(0) = 0
  33297. * asinh(-0) = -0
  33298. *
  33299. */
  33300. P.inverseHyperbolicSine = P.asinh = function () {
  33301. var pr,
  33302. rm,
  33303. x = this,
  33304. Ctor = x.constructor;
  33305. if (!x.isFinite() || x.isZero()) return new Ctor(x);
  33306. pr = Ctor.precision;
  33307. rm = Ctor.rounding;
  33308. Ctor.precision = pr + 2 * Math.max(Math.abs(x.e), x.sd()) + 6;
  33309. Ctor.rounding = 1;
  33310. external = false;
  33311. x = x.times(x).plus(1).sqrt().plus(x);
  33312. external = true;
  33313. Ctor.precision = pr;
  33314. Ctor.rounding = rm;
  33315. return x.ln();
  33316. };
  33317. /*
  33318. * Return a new Decimal whose value is the inverse of the hyperbolic tangent in radians of the
  33319. * value of this Decimal.
  33320. *
  33321. * Domain: [-1, 1]
  33322. * Range: [-Infinity, Infinity]
  33323. *
  33324. * atanh(x) = 0.5 * ln((1 + x) / (1 - x))
  33325. *
  33326. * atanh(|x| > 1) = NaN
  33327. * atanh(NaN) = NaN
  33328. * atanh(Infinity) = NaN
  33329. * atanh(-Infinity) = NaN
  33330. * atanh(0) = 0
  33331. * atanh(-0) = -0
  33332. * atanh(1) = Infinity
  33333. * atanh(-1) = -Infinity
  33334. *
  33335. */
  33336. P.inverseHyperbolicTangent = P.atanh = function () {
  33337. var pr,
  33338. rm,
  33339. wpr,
  33340. xsd,
  33341. x = this,
  33342. Ctor = x.constructor;
  33343. if (!x.isFinite()) return new Ctor(NaN);
  33344. if (x.e >= 0) return new Ctor(x.abs().eq(1) ? x.s / 0 : x.isZero() ? x : NaN);
  33345. pr = Ctor.precision;
  33346. rm = Ctor.rounding;
  33347. xsd = x.sd();
  33348. if (Math.max(xsd, pr) < 2 * -x.e - 1) return finalise(new Ctor(x), pr, rm, true);
  33349. Ctor.precision = wpr = xsd - x.e;
  33350. x = divide(x.plus(1), new Ctor(1).minus(x), wpr + pr, 1);
  33351. Ctor.precision = pr + 4;
  33352. Ctor.rounding = 1;
  33353. x = x.ln();
  33354. Ctor.precision = pr;
  33355. Ctor.rounding = rm;
  33356. return x.times(0.5);
  33357. };
  33358. /*
  33359. * Return a new Decimal whose value is the arcsine (inverse sine) in radians of the value of this
  33360. * Decimal.
  33361. *
  33362. * Domain: [-Infinity, Infinity]
  33363. * Range: [-pi/2, pi/2]
  33364. *
  33365. * asin(x) = 2*atan(x/(1 + sqrt(1 - x^2)))
  33366. *
  33367. * asin(0) = 0
  33368. * asin(-0) = -0
  33369. * asin(1/2) = pi/6
  33370. * asin(-1/2) = -pi/6
  33371. * asin(1) = pi/2
  33372. * asin(-1) = -pi/2
  33373. * asin(|x| > 1) = NaN
  33374. * asin(NaN) = NaN
  33375. *
  33376. * TODO? Compare performance of Taylor series.
  33377. *
  33378. */
  33379. P.inverseSine = P.asin = function () {
  33380. var halfPi,
  33381. k,
  33382. pr,
  33383. rm,
  33384. x = this,
  33385. Ctor = x.constructor;
  33386. if (x.isZero()) return new Ctor(x);
  33387. k = x.abs().cmp(1);
  33388. pr = Ctor.precision;
  33389. rm = Ctor.rounding;
  33390. if (k !== -1) {
  33391. // |x| is 1
  33392. if (k === 0) {
  33393. halfPi = getPi(Ctor, pr + 4, rm).times(0.5);
  33394. halfPi.s = x.s;
  33395. return halfPi;
  33396. }
  33397. // |x| > 1 or x is NaN
  33398. return new Ctor(NaN);
  33399. }
  33400. // TODO? Special case asin(1/2) = pi/6 and asin(-1/2) = -pi/6
  33401. Ctor.precision = pr + 6;
  33402. Ctor.rounding = 1;
  33403. x = x.div(new Ctor(1).minus(x.times(x)).sqrt().plus(1)).atan();
  33404. Ctor.precision = pr;
  33405. Ctor.rounding = rm;
  33406. return x.times(2);
  33407. };
  33408. /*
  33409. * Return a new Decimal whose value is the arctangent (inverse tangent) in radians of the value
  33410. * of this Decimal.
  33411. *
  33412. * Domain: [-Infinity, Infinity]
  33413. * Range: [-pi/2, pi/2]
  33414. *
  33415. * atan(x) = x - x^3/3 + x^5/5 - x^7/7 + ...
  33416. *
  33417. * atan(0) = 0
  33418. * atan(-0) = -0
  33419. * atan(1) = pi/4
  33420. * atan(-1) = -pi/4
  33421. * atan(Infinity) = pi/2
  33422. * atan(-Infinity) = -pi/2
  33423. * atan(NaN) = NaN
  33424. *
  33425. */
  33426. P.inverseTangent = P.atan = function () {
  33427. var i,
  33428. j,
  33429. k,
  33430. n,
  33431. px,
  33432. t,
  33433. r,
  33434. wpr,
  33435. x2,
  33436. x = this,
  33437. Ctor = x.constructor,
  33438. pr = Ctor.precision,
  33439. rm = Ctor.rounding;
  33440. if (!x.isFinite()) {
  33441. if (!x.s) return new Ctor(NaN);
  33442. if (pr + 4 <= PI_PRECISION) {
  33443. r = getPi(Ctor, pr + 4, rm).times(0.5);
  33444. r.s = x.s;
  33445. return r;
  33446. }
  33447. } else if (x.isZero()) {
  33448. return new Ctor(x);
  33449. } else if (x.abs().eq(1) && pr + 4 <= PI_PRECISION) {
  33450. r = getPi(Ctor, pr + 4, rm).times(0.25);
  33451. r.s = x.s;
  33452. return r;
  33453. }
  33454. Ctor.precision = wpr = pr + 10;
  33455. Ctor.rounding = 1;
  33456. // TODO? if (x >= 1 && pr <= PI_PRECISION) atan(x) = halfPi * x.s - atan(1 / x);
  33457. // Argument reduction
  33458. // Ensure |x| < 0.42
  33459. // atan(x) = 2 * atan(x / (1 + sqrt(1 + x^2)))
  33460. k = Math.min(28, wpr / LOG_BASE + 2 | 0);
  33461. for (i = k; i; --i) {
  33462. x = x.div(x.times(x).plus(1).sqrt().plus(1));
  33463. }external = false;
  33464. j = Math.ceil(wpr / LOG_BASE);
  33465. n = 1;
  33466. x2 = x.times(x);
  33467. r = new Ctor(x);
  33468. px = x;
  33469. // atan(x) = x - x^3/3 + x^5/5 - x^7/7 + ...
  33470. for (; i !== -1;) {
  33471. px = px.times(x2);
  33472. t = r.minus(px.div(n += 2));
  33473. px = px.times(x2);
  33474. r = t.plus(px.div(n += 2));
  33475. if (r.d[j] !== void 0) for (i = j; r.d[i] === t.d[i] && i--;) {}
  33476. }
  33477. if (k) r = r.times(2 << k - 1);
  33478. external = true;
  33479. return finalise(r, Ctor.precision = pr, Ctor.rounding = rm, true);
  33480. };
  33481. /*
  33482. * Return true if the value of this Decimal is a finite number, otherwise return false.
  33483. *
  33484. */
  33485. P.isFinite = function () {
  33486. return !!this.d;
  33487. };
  33488. /*
  33489. * Return true if the value of this Decimal is an integer, otherwise return false.
  33490. *
  33491. */
  33492. P.isInteger = P.isInt = function () {
  33493. return !!this.d && mathfloor(this.e / LOG_BASE) > this.d.length - 2;
  33494. };
  33495. /*
  33496. * Return true if the value of this Decimal is NaN, otherwise return false.
  33497. *
  33498. */
  33499. P.isNaN = function () {
  33500. return !this.s;
  33501. };
  33502. /*
  33503. * Return true if the value of this Decimal is negative, otherwise return false.
  33504. *
  33505. */
  33506. P.isNegative = P.isNeg = function () {
  33507. return this.s < 0;
  33508. };
  33509. /*
  33510. * Return true if the value of this Decimal is positive, otherwise return false.
  33511. *
  33512. */
  33513. P.isPositive = P.isPos = function () {
  33514. return this.s > 0;
  33515. };
  33516. /*
  33517. * Return true if the value of this Decimal is 0 or -0, otherwise return false.
  33518. *
  33519. */
  33520. P.isZero = function () {
  33521. return !!this.d && this.d[0] === 0;
  33522. };
  33523. /*
  33524. * Return true if the value of this Decimal is less than `y`, otherwise return false.
  33525. *
  33526. */
  33527. P.lessThan = P.lt = function (y) {
  33528. return this.cmp(y) < 0;
  33529. };
  33530. /*
  33531. * Return true if the value of this Decimal is less than or equal to `y`, otherwise return false.
  33532. *
  33533. */
  33534. P.lessThanOrEqualTo = P.lte = function (y) {
  33535. return this.cmp(y) < 1;
  33536. };
  33537. /*
  33538. * Return the logarithm of the value of this Decimal to the specified base, rounded to `precision`
  33539. * significant digits using rounding mode `rounding`.
  33540. *
  33541. * If no base is specified, return log[10](arg).
  33542. *
  33543. * log[base](arg) = ln(arg) / ln(base)
  33544. *
  33545. * The result will always be correctly rounded if the base of the log is 10, and 'almost always'
  33546. * otherwise:
  33547. *
  33548. * Depending on the rounding mode, the result may be incorrectly rounded if the first fifteen
  33549. * rounding digits are [49]99999999999999 or [50]00000000000000. In that case, the maximum error
  33550. * between the result and the correctly rounded result will be one ulp (unit in the last place).
  33551. *
  33552. * log[-b](a) = NaN
  33553. * log[0](a) = NaN
  33554. * log[1](a) = NaN
  33555. * log[NaN](a) = NaN
  33556. * log[Infinity](a) = NaN
  33557. * log[b](0) = -Infinity
  33558. * log[b](-0) = -Infinity
  33559. * log[b](-a) = NaN
  33560. * log[b](1) = 0
  33561. * log[b](Infinity) = Infinity
  33562. * log[b](NaN) = NaN
  33563. *
  33564. * [base] {number|string|Decimal} The base of the logarithm.
  33565. *
  33566. */
  33567. P.logarithm = P.log = function (base) {
  33568. var isBase10,
  33569. d,
  33570. denominator,
  33571. k,
  33572. inf,
  33573. num,
  33574. sd,
  33575. r,
  33576. arg = this,
  33577. Ctor = arg.constructor,
  33578. pr = Ctor.precision,
  33579. rm = Ctor.rounding,
  33580. guard = 5;
  33581. // Default base is 10.
  33582. if (base == null) {
  33583. base = new Ctor(10);
  33584. isBase10 = true;
  33585. } else {
  33586. base = new Ctor(base);
  33587. d = base.d;
  33588. // Return NaN if base is negative, or non-finite, or is 0 or 1.
  33589. if (base.s < 0 || !d || !d[0] || base.eq(1)) return new Ctor(NaN);
  33590. isBase10 = base.eq(10);
  33591. }
  33592. d = arg.d;
  33593. // Is arg negative, non-finite, 0 or 1?
  33594. if (arg.s < 0 || !d || !d[0] || arg.eq(1)) {
  33595. return new Ctor(d && !d[0] ? -1 / 0 : arg.s != 1 ? NaN : d ? 0 : 1 / 0);
  33596. }
  33597. // The result will have a non-terminating decimal expansion if base is 10 and arg is not an
  33598. // integer power of 10.
  33599. if (isBase10) {
  33600. if (d.length > 1) {
  33601. inf = true;
  33602. } else {
  33603. for (k = d[0]; k % 10 === 0;) {
  33604. k /= 10;
  33605. }inf = k !== 1;
  33606. }
  33607. }
  33608. external = false;
  33609. sd = pr + guard;
  33610. num = naturalLogarithm(arg, sd);
  33611. denominator = isBase10 ? getLn10(Ctor, sd + 10) : naturalLogarithm(base, sd);
  33612. // The result will have 5 rounding digits.
  33613. r = divide(num, denominator, sd, 1);
  33614. // If at a rounding boundary, i.e. the result's rounding digits are [49]9999 or [50]0000,
  33615. // calculate 10 further digits.
  33616. //
  33617. // If the result is known to have an infinite decimal expansion, repeat this until it is clear
  33618. // that the result is above or below the boundary. Otherwise, if after calculating the 10
  33619. // further digits, the last 14 are nines, round up and assume the result is exact.
  33620. // Also assume the result is exact if the last 14 are zero.
  33621. //
  33622. // Example of a result that will be incorrectly rounded:
  33623. // log[1048576](4503599627370502) = 2.60000000000000009610279511444746...
  33624. // The above result correctly rounded using ROUND_CEIL to 1 decimal place should be 2.7, but it
  33625. // will be given as 2.6 as there are 15 zeros immediately after the requested decimal place, so
  33626. // the exact result would be assumed to be 2.6, which rounded using ROUND_CEIL to 1 decimal
  33627. // place is still 2.6.
  33628. if (checkRoundingDigits(r.d, k = pr, rm)) {
  33629. do {
  33630. sd += 10;
  33631. num = naturalLogarithm(arg, sd);
  33632. denominator = isBase10 ? getLn10(Ctor, sd + 10) : naturalLogarithm(base, sd);
  33633. r = divide(num, denominator, sd, 1);
  33634. if (!inf) {
  33635. // Check for 14 nines from the 2nd rounding digit, as the first may be 4.
  33636. if (+digitsToString(r.d).slice(k + 1, k + 15) + 1 == 1e14) {
  33637. r = finalise(r, pr + 1, 0);
  33638. }
  33639. break;
  33640. }
  33641. } while (checkRoundingDigits(r.d, k += 10, rm));
  33642. }
  33643. external = true;
  33644. return finalise(r, pr, rm);
  33645. };
  33646. /*
  33647. * Return a new Decimal whose value is the maximum of the arguments and the value of this Decimal.
  33648. *
  33649. * arguments {number|string|Decimal}
  33650. *
  33651. P.max = function () {
  33652. Array.prototype.push.call(arguments, this);
  33653. return maxOrMin(this.constructor, arguments, 'lt');
  33654. };
  33655. */
  33656. /*
  33657. * Return a new Decimal whose value is the minimum of the arguments and the value of this Decimal.
  33658. *
  33659. * arguments {number|string|Decimal}
  33660. *
  33661. P.min = function () {
  33662. Array.prototype.push.call(arguments, this);
  33663. return maxOrMin(this.constructor, arguments, 'gt');
  33664. };
  33665. */
  33666. /*
  33667. * n - 0 = n
  33668. * n - N = N
  33669. * n - I = -I
  33670. * 0 - n = -n
  33671. * 0 - 0 = 0
  33672. * 0 - N = N
  33673. * 0 - I = -I
  33674. * N - n = N
  33675. * N - 0 = N
  33676. * N - N = N
  33677. * N - I = N
  33678. * I - n = I
  33679. * I - 0 = I
  33680. * I - N = N
  33681. * I - I = N
  33682. *
  33683. * Return a new Decimal whose value is the value of this Decimal minus `y`, rounded to `precision`
  33684. * significant digits using rounding mode `rounding`.
  33685. *
  33686. */
  33687. P.minus = P.sub = function (y) {
  33688. var d,
  33689. e,
  33690. i,
  33691. j,
  33692. k,
  33693. len,
  33694. pr,
  33695. rm,
  33696. xd,
  33697. xe,
  33698. xLTy,
  33699. yd,
  33700. x = this,
  33701. Ctor = x.constructor;
  33702. y = new Ctor(y);
  33703. // If either is not finite...
  33704. if (!x.d || !y.d) {
  33705. // Return NaN if either is NaN.
  33706. if (!x.s || !y.s) y = new Ctor(NaN);
  33707. // Return y negated if x is finite and y is ±Infinity.
  33708. else if (x.d) y.s = -y.s;
  33709. // Return x if y is finite and x is ±Infinity.
  33710. // Return x if both are ±Infinity with different signs.
  33711. // Return NaN if both are ±Infinity with the same sign.
  33712. else y = new Ctor(y.d || x.s !== y.s ? x : NaN);
  33713. return y;
  33714. }
  33715. // If signs differ...
  33716. if (x.s != y.s) {
  33717. y.s = -y.s;
  33718. return x.plus(y);
  33719. }
  33720. xd = x.d;
  33721. yd = y.d;
  33722. pr = Ctor.precision;
  33723. rm = Ctor.rounding;
  33724. // If either is zero...
  33725. if (!xd[0] || !yd[0]) {
  33726. // Return y negated if x is zero and y is non-zero.
  33727. if (yd[0]) y.s = -y.s;
  33728. // Return x if y is zero and x is non-zero.
  33729. else if (xd[0]) y = new Ctor(x);
  33730. // Return zero if both are zero.
  33731. // From IEEE 754 (2008) 6.3: 0 - 0 = -0 - -0 = -0 when rounding to -Infinity.
  33732. else return new Ctor(rm === 3 ? -0 : 0);
  33733. return external ? finalise(y, pr, rm) : y;
  33734. }
  33735. // x and y are finite, non-zero numbers with the same sign.
  33736. // Calculate base 1e7 exponents.
  33737. e = mathfloor(y.e / LOG_BASE);
  33738. xe = mathfloor(x.e / LOG_BASE);
  33739. xd = xd.slice();
  33740. k = xe - e;
  33741. // If base 1e7 exponents differ...
  33742. if (k) {
  33743. xLTy = k < 0;
  33744. if (xLTy) {
  33745. d = xd;
  33746. k = -k;
  33747. len = yd.length;
  33748. } else {
  33749. d = yd;
  33750. e = xe;
  33751. len = xd.length;
  33752. }
  33753. // Numbers with massively different exponents would result in a very high number of
  33754. // zeros needing to be prepended, but this can be avoided while still ensuring correct
  33755. // rounding by limiting the number of zeros to `Math.ceil(pr / LOG_BASE) + 2`.
  33756. i = Math.max(Math.ceil(pr / LOG_BASE), len) + 2;
  33757. if (k > i) {
  33758. k = i;
  33759. d.length = 1;
  33760. }
  33761. // Prepend zeros to equalise exponents.
  33762. d.reverse();
  33763. for (i = k; i--;) {
  33764. d.push(0);
  33765. }d.reverse();
  33766. // Base 1e7 exponents equal.
  33767. } else {
  33768. // Check digits to determine which is the bigger number.
  33769. i = xd.length;
  33770. len = yd.length;
  33771. xLTy = i < len;
  33772. if (xLTy) len = i;
  33773. for (i = 0; i < len; i++) {
  33774. if (xd[i] != yd[i]) {
  33775. xLTy = xd[i] < yd[i];
  33776. break;
  33777. }
  33778. }
  33779. k = 0;
  33780. }
  33781. if (xLTy) {
  33782. d = xd;
  33783. xd = yd;
  33784. yd = d;
  33785. y.s = -y.s;
  33786. }
  33787. len = xd.length;
  33788. // Append zeros to `xd` if shorter.
  33789. // Don't add zeros to `yd` if shorter as subtraction only needs to start at `yd` length.
  33790. for (i = yd.length - len; i > 0; --i) {
  33791. xd[len++] = 0;
  33792. } // Subtract yd from xd.
  33793. for (i = yd.length; i > k;) {
  33794. if (xd[--i] < yd[i]) {
  33795. for (j = i; j && xd[--j] === 0;) {
  33796. xd[j] = BASE - 1;
  33797. }--xd[j];
  33798. xd[i] += BASE;
  33799. }
  33800. xd[i] -= yd[i];
  33801. }
  33802. // Remove trailing zeros.
  33803. for (; xd[--len] === 0;) {
  33804. xd.pop();
  33805. } // Remove leading zeros and adjust exponent accordingly.
  33806. for (; xd[0] === 0; xd.shift()) {
  33807. --e;
  33808. } // Zero?
  33809. if (!xd[0]) return new Ctor(rm === 3 ? -0 : 0);
  33810. y.d = xd;
  33811. y.e = getBase10Exponent(xd, e);
  33812. return external ? finalise(y, pr, rm) : y;
  33813. };
  33814. /*
  33815. * n % 0 = N
  33816. * n % N = N
  33817. * n % I = n
  33818. * 0 % n = 0
  33819. * -0 % n = -0
  33820. * 0 % 0 = N
  33821. * 0 % N = N
  33822. * 0 % I = 0
  33823. * N % n = N
  33824. * N % 0 = N
  33825. * N % N = N
  33826. * N % I = N
  33827. * I % n = N
  33828. * I % 0 = N
  33829. * I % N = N
  33830. * I % I = N
  33831. *
  33832. * Return a new Decimal whose value is the value of this Decimal modulo `y`, rounded to
  33833. * `precision` significant digits using rounding mode `rounding`.
  33834. *
  33835. * The result depends on the modulo mode.
  33836. *
  33837. */
  33838. P.modulo = P.mod = function (y) {
  33839. var q,
  33840. x = this,
  33841. Ctor = x.constructor;
  33842. y = new Ctor(y);
  33843. // Return NaN if x is ±Infinity or NaN, or y is NaN or ±0.
  33844. if (!x.d || !y.s || y.d && !y.d[0]) return new Ctor(NaN);
  33845. // Return x if y is ±Infinity or x is ±0.
  33846. if (!y.d || x.d && !x.d[0]) {
  33847. return finalise(new Ctor(x), Ctor.precision, Ctor.rounding);
  33848. }
  33849. // Prevent rounding of intermediate calculations.
  33850. external = false;
  33851. if (Ctor.modulo == 9) {
  33852. // Euclidian division: q = sign(y) * floor(x / abs(y))
  33853. // result = x - q * y where 0 <= result < abs(y)
  33854. q = divide(x, y.abs(), 0, 3, 1);
  33855. q.s *= y.s;
  33856. } else {
  33857. q = divide(x, y, 0, Ctor.modulo, 1);
  33858. }
  33859. q = q.times(y);
  33860. external = true;
  33861. return x.minus(q);
  33862. };
  33863. /*
  33864. * Return a new Decimal whose value is the natural exponential of the value of this Decimal,
  33865. * i.e. the base e raised to the power the value of this Decimal, rounded to `precision`
  33866. * significant digits using rounding mode `rounding`.
  33867. *
  33868. */
  33869. P.naturalExponential = P.exp = function () {
  33870. return naturalExponential(this);
  33871. };
  33872. /*
  33873. * Return a new Decimal whose value is the natural logarithm of the value of this Decimal,
  33874. * rounded to `precision` significant digits using rounding mode `rounding`.
  33875. *
  33876. */
  33877. P.naturalLogarithm = P.ln = function () {
  33878. return naturalLogarithm(this);
  33879. };
  33880. /*
  33881. * Return a new Decimal whose value is the value of this Decimal negated, i.e. as if multiplied by
  33882. * -1.
  33883. *
  33884. */
  33885. P.negated = P.neg = function () {
  33886. var x = new this.constructor(this);
  33887. x.s = -x.s;
  33888. return finalise(x);
  33889. };
  33890. /*
  33891. * n + 0 = n
  33892. * n + N = N
  33893. * n + I = I
  33894. * 0 + n = n
  33895. * 0 + 0 = 0
  33896. * 0 + N = N
  33897. * 0 + I = I
  33898. * N + n = N
  33899. * N + 0 = N
  33900. * N + N = N
  33901. * N + I = N
  33902. * I + n = I
  33903. * I + 0 = I
  33904. * I + N = N
  33905. * I + I = I
  33906. *
  33907. * Return a new Decimal whose value is the value of this Decimal plus `y`, rounded to `precision`
  33908. * significant digits using rounding mode `rounding`.
  33909. *
  33910. */
  33911. P.plus = P.add = function (y) {
  33912. var carry,
  33913. d,
  33914. e,
  33915. i,
  33916. k,
  33917. len,
  33918. pr,
  33919. rm,
  33920. xd,
  33921. yd,
  33922. x = this,
  33923. Ctor = x.constructor;
  33924. y = new Ctor(y);
  33925. // If either is not finite...
  33926. if (!x.d || !y.d) {
  33927. // Return NaN if either is NaN.
  33928. if (!x.s || !y.s) y = new Ctor(NaN);
  33929. // Return x if y is finite and x is ±Infinity.
  33930. // Return x if both are ±Infinity with the same sign.
  33931. // Return NaN if both are ±Infinity with different signs.
  33932. // Return y if x is finite and y is ±Infinity.
  33933. else if (!x.d) y = new Ctor(y.d || x.s === y.s ? x : NaN);
  33934. return y;
  33935. }
  33936. // If signs differ...
  33937. if (x.s != y.s) {
  33938. y.s = -y.s;
  33939. return x.minus(y);
  33940. }
  33941. xd = x.d;
  33942. yd = y.d;
  33943. pr = Ctor.precision;
  33944. rm = Ctor.rounding;
  33945. // If either is zero...
  33946. if (!xd[0] || !yd[0]) {
  33947. // Return x if y is zero.
  33948. // Return y if y is non-zero.
  33949. if (!yd[0]) y = new Ctor(x);
  33950. return external ? finalise(y, pr, rm) : y;
  33951. }
  33952. // x and y are finite, non-zero numbers with the same sign.
  33953. // Calculate base 1e7 exponents.
  33954. k = mathfloor(x.e / LOG_BASE);
  33955. e = mathfloor(y.e / LOG_BASE);
  33956. xd = xd.slice();
  33957. i = k - e;
  33958. // If base 1e7 exponents differ...
  33959. if (i) {
  33960. if (i < 0) {
  33961. d = xd;
  33962. i = -i;
  33963. len = yd.length;
  33964. } else {
  33965. d = yd;
  33966. e = k;
  33967. len = xd.length;
  33968. }
  33969. // Limit number of zeros prepended to max(ceil(pr / LOG_BASE), len) + 1.
  33970. k = Math.ceil(pr / LOG_BASE);
  33971. len = k > len ? k + 1 : len + 1;
  33972. if (i > len) {
  33973. i = len;
  33974. d.length = 1;
  33975. }
  33976. // Prepend zeros to equalise exponents. Note: Faster to use reverse then do unshifts.
  33977. d.reverse();
  33978. for (; i--;) {
  33979. d.push(0);
  33980. }d.reverse();
  33981. }
  33982. len = xd.length;
  33983. i = yd.length;
  33984. // If yd is longer than xd, swap xd and yd so xd points to the longer array.
  33985. if (len - i < 0) {
  33986. i = len;
  33987. d = yd;
  33988. yd = xd;
  33989. xd = d;
  33990. }
  33991. // Only start adding at yd.length - 1 as the further digits of xd can be left as they are.
  33992. for (carry = 0; i;) {
  33993. carry = (xd[--i] = xd[i] + yd[i] + carry) / BASE | 0;
  33994. xd[i] %= BASE;
  33995. }
  33996. if (carry) {
  33997. xd.unshift(carry);
  33998. ++e;
  33999. }
  34000. // Remove trailing zeros.
  34001. // No need to check for zero, as +x + +y != 0 && -x + -y != 0
  34002. for (len = xd.length; xd[--len] == 0;) {
  34003. xd.pop();
  34004. }y.d = xd;
  34005. y.e = getBase10Exponent(xd, e);
  34006. return external ? finalise(y, pr, rm) : y;
  34007. };
  34008. /*
  34009. * Return the number of significant digits of the value of this Decimal.
  34010. *
  34011. * [z] {boolean|number} Whether to count integer-part trailing zeros: true, false, 1 or 0.
  34012. *
  34013. */
  34014. P.precision = P.sd = function (z) {
  34015. var k,
  34016. x = this;
  34017. if (z !== void 0 && z !== !!z && z !== 1 && z !== 0) throw Error(invalidArgument + z);
  34018. if (x.d) {
  34019. k = getPrecision(x.d);
  34020. if (z && x.e + 1 > k) k = x.e + 1;
  34021. } else {
  34022. k = NaN;
  34023. }
  34024. return k;
  34025. };
  34026. /*
  34027. * Return a new Decimal whose value is the value of this Decimal rounded to a whole number using
  34028. * rounding mode `rounding`.
  34029. *
  34030. */
  34031. P.round = function () {
  34032. var x = this,
  34033. Ctor = x.constructor;
  34034. return finalise(new Ctor(x), x.e + 1, Ctor.rounding);
  34035. };
  34036. /*
  34037. * Return a new Decimal whose value is the sine of the value in radians of this Decimal.
  34038. *
  34039. * Domain: [-Infinity, Infinity]
  34040. * Range: [-1, 1]
  34041. *
  34042. * sin(x) = x - x^3/3! + x^5/5! - ...
  34043. *
  34044. * sin(0) = 0
  34045. * sin(-0) = -0
  34046. * sin(Infinity) = NaN
  34047. * sin(-Infinity) = NaN
  34048. * sin(NaN) = NaN
  34049. *
  34050. */
  34051. P.sine = P.sin = function () {
  34052. var pr,
  34053. rm,
  34054. x = this,
  34055. Ctor = x.constructor;
  34056. if (!x.isFinite()) return new Ctor(NaN);
  34057. if (x.isZero()) return new Ctor(x);
  34058. pr = Ctor.precision;
  34059. rm = Ctor.rounding;
  34060. Ctor.precision = pr + Math.max(x.e, x.sd()) + LOG_BASE;
  34061. Ctor.rounding = 1;
  34062. x = sine(Ctor, toLessThanHalfPi(Ctor, x));
  34063. Ctor.precision = pr;
  34064. Ctor.rounding = rm;
  34065. return finalise(quadrant > 2 ? x.neg() : x, pr, rm, true);
  34066. };
  34067. /*
  34068. * Return a new Decimal whose value is the square root of this Decimal, rounded to `precision`
  34069. * significant digits using rounding mode `rounding`.
  34070. *
  34071. * sqrt(-n) = N
  34072. * sqrt(N) = N
  34073. * sqrt(-I) = N
  34074. * sqrt(I) = I
  34075. * sqrt(0) = 0
  34076. * sqrt(-0) = -0
  34077. *
  34078. */
  34079. P.squareRoot = P.sqrt = function () {
  34080. var m,
  34081. n,
  34082. sd,
  34083. r,
  34084. rep,
  34085. t,
  34086. x = this,
  34087. d = x.d,
  34088. e = x.e,
  34089. s = x.s,
  34090. Ctor = x.constructor;
  34091. // Negative/NaN/Infinity/zero?
  34092. if (s !== 1 || !d || !d[0]) {
  34093. return new Ctor(!s || s < 0 && (!d || d[0]) ? NaN : d ? x : 1 / 0);
  34094. }
  34095. external = false;
  34096. // Initial estimate.
  34097. s = Math.sqrt(+x);
  34098. // Math.sqrt underflow/overflow?
  34099. // Pass x to Math.sqrt as integer, then adjust the exponent of the result.
  34100. if (s == 0 || s == 1 / 0) {
  34101. n = digitsToString(d);
  34102. if ((n.length + e) % 2 == 0) n += '0';
  34103. s = Math.sqrt(n);
  34104. e = mathfloor((e + 1) / 2) - (e < 0 || e % 2);
  34105. if (s == 1 / 0) {
  34106. n = '1e' + e;
  34107. } else {
  34108. n = s.toExponential();
  34109. n = n.slice(0, n.indexOf('e') + 1) + e;
  34110. }
  34111. r = new Ctor(n);
  34112. } else {
  34113. r = new Ctor(s.toString());
  34114. }
  34115. sd = (e = Ctor.precision) + 3;
  34116. // Newton-Raphson iteration.
  34117. for (;;) {
  34118. t = r;
  34119. r = t.plus(divide(x, t, sd + 2, 1)).times(0.5);
  34120. // TODO? Replace with for-loop and checkRoundingDigits.
  34121. if (digitsToString(t.d).slice(0, sd) === (n = digitsToString(r.d)).slice(0, sd)) {
  34122. n = n.slice(sd - 3, sd + 1);
  34123. // The 4th rounding digit may be in error by -1 so if the 4 rounding digits are 9999 or
  34124. // 4999, i.e. approaching a rounding boundary, continue the iteration.
  34125. if (n == '9999' || !rep && n == '4999') {
  34126. // On the first iteration only, check to see if rounding up gives the exact result as the
  34127. // nines may infinitely repeat.
  34128. if (!rep) {
  34129. finalise(t, e + 1, 0);
  34130. if (t.times(t).eq(x)) {
  34131. r = t;
  34132. break;
  34133. }
  34134. }
  34135. sd += 4;
  34136. rep = 1;
  34137. } else {
  34138. // If the rounding digits are null, 0{0,4} or 50{0,3}, check for an exact result.
  34139. // If not, then there are further digits and m will be truthy.
  34140. if (!+n || !+n.slice(1) && n.charAt(0) == '5') {
  34141. // Truncate to the first rounding digit.
  34142. finalise(r, e + 1, 1);
  34143. m = !r.times(r).eq(x);
  34144. }
  34145. break;
  34146. }
  34147. }
  34148. }
  34149. external = true;
  34150. return finalise(r, e, Ctor.rounding, m);
  34151. };
  34152. /*
  34153. * Return a new Decimal whose value is the tangent of the value in radians of this Decimal.
  34154. *
  34155. * Domain: [-Infinity, Infinity]
  34156. * Range: [-Infinity, Infinity]
  34157. *
  34158. * tan(0) = 0
  34159. * tan(-0) = -0
  34160. * tan(Infinity) = NaN
  34161. * tan(-Infinity) = NaN
  34162. * tan(NaN) = NaN
  34163. *
  34164. */
  34165. P.tangent = P.tan = function () {
  34166. var pr,
  34167. rm,
  34168. x = this,
  34169. Ctor = x.constructor;
  34170. if (!x.isFinite()) return new Ctor(NaN);
  34171. if (x.isZero()) return new Ctor(x);
  34172. pr = Ctor.precision;
  34173. rm = Ctor.rounding;
  34174. Ctor.precision = pr + 10;
  34175. Ctor.rounding = 1;
  34176. x = x.sin();
  34177. x.s = 1;
  34178. x = divide(x, new Ctor(1).minus(x.times(x)).sqrt(), pr + 10, 0);
  34179. Ctor.precision = pr;
  34180. Ctor.rounding = rm;
  34181. return finalise(quadrant == 2 || quadrant == 4 ? x.neg() : x, pr, rm, true);
  34182. };
  34183. /*
  34184. * n * 0 = 0
  34185. * n * N = N
  34186. * n * I = I
  34187. * 0 * n = 0
  34188. * 0 * 0 = 0
  34189. * 0 * N = N
  34190. * 0 * I = N
  34191. * N * n = N
  34192. * N * 0 = N
  34193. * N * N = N
  34194. * N * I = N
  34195. * I * n = I
  34196. * I * 0 = N
  34197. * I * N = N
  34198. * I * I = I
  34199. *
  34200. * Return a new Decimal whose value is this Decimal times `y`, rounded to `precision` significant
  34201. * digits using rounding mode `rounding`.
  34202. *
  34203. */
  34204. P.times = P.mul = function (y) {
  34205. var carry,
  34206. e,
  34207. i,
  34208. k,
  34209. r,
  34210. rL,
  34211. t,
  34212. xdL,
  34213. ydL,
  34214. x = this,
  34215. Ctor = x.constructor,
  34216. xd = x.d,
  34217. yd = (y = new Ctor(y)).d;
  34218. y.s *= x.s;
  34219. // If either is NaN, ±Infinity or ±0...
  34220. if (!xd || !xd[0] || !yd || !yd[0]) {
  34221. return new Ctor(!y.s || xd && !xd[0] && !yd || yd && !yd[0] && !xd
  34222. // Return NaN if either is NaN.
  34223. // Return NaN if x is ±0 and y is ±Infinity, or y is ±0 and x is ±Infinity.
  34224. ? NaN
  34225. // Return ±Infinity if either is ±Infinity.
  34226. // Return ±0 if either is ±0.
  34227. : !xd || !yd ? y.s / 0 : y.s * 0);
  34228. }
  34229. e = mathfloor(x.e / LOG_BASE) + mathfloor(y.e / LOG_BASE);
  34230. xdL = xd.length;
  34231. ydL = yd.length;
  34232. // Ensure xd points to the longer array.
  34233. if (xdL < ydL) {
  34234. r = xd;
  34235. xd = yd;
  34236. yd = r;
  34237. rL = xdL;
  34238. xdL = ydL;
  34239. ydL = rL;
  34240. }
  34241. // Initialise the result array with zeros.
  34242. r = [];
  34243. rL = xdL + ydL;
  34244. for (i = rL; i--;) {
  34245. r.push(0);
  34246. } // Multiply!
  34247. for (i = ydL; --i >= 0;) {
  34248. carry = 0;
  34249. for (k = xdL + i; k > i;) {
  34250. t = r[k] + yd[i] * xd[k - i - 1] + carry;
  34251. r[k--] = t % BASE | 0;
  34252. carry = t / BASE | 0;
  34253. }
  34254. r[k] = (r[k] + carry) % BASE | 0;
  34255. }
  34256. // Remove trailing zeros.
  34257. for (; !r[--rL];) {
  34258. r.pop();
  34259. }if (carry) ++e;else r.shift();
  34260. y.d = r;
  34261. y.e = getBase10Exponent(r, e);
  34262. return external ? finalise(y, Ctor.precision, Ctor.rounding) : y;
  34263. };
  34264. /*
  34265. * Return a string representing the value of this Decimal in base 2, round to `sd` significant
  34266. * digits using rounding mode `rm`.
  34267. *
  34268. * If the optional `sd` argument is present then return binary exponential notation.
  34269. *
  34270. * [sd] {number} Significant digits. Integer, 1 to MAX_DIGITS inclusive.
  34271. * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.
  34272. *
  34273. */
  34274. P.toBinary = function (sd, rm) {
  34275. return toStringBinary(this, 2, sd, rm);
  34276. };
  34277. /*
  34278. * Return a new Decimal whose value is the value of this Decimal rounded to a maximum of `dp`
  34279. * decimal places using rounding mode `rm` or `rounding` if `rm` is omitted.
  34280. *
  34281. * If `dp` is omitted, return a new Decimal whose value is the value of this Decimal.
  34282. *
  34283. * [dp] {number} Decimal places. Integer, 0 to MAX_DIGITS inclusive.
  34284. * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.
  34285. *
  34286. */
  34287. P.toDecimalPlaces = P.toDP = function (dp, rm) {
  34288. var x = this,
  34289. Ctor = x.constructor;
  34290. x = new Ctor(x);
  34291. if (dp === void 0) return x;
  34292. checkInt32(dp, 0, MAX_DIGITS);
  34293. if (rm === void 0) rm = Ctor.rounding;else checkInt32(rm, 0, 8);
  34294. return finalise(x, dp + x.e + 1, rm);
  34295. };
  34296. /*
  34297. * Return a string representing the value of this Decimal in exponential notation rounded to
  34298. * `dp` fixed decimal places using rounding mode `rounding`.
  34299. *
  34300. * [dp] {number} Decimal places. Integer, 0 to MAX_DIGITS inclusive.
  34301. * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.
  34302. *
  34303. */
  34304. P.toExponential = function (dp, rm) {
  34305. var str,
  34306. x = this,
  34307. Ctor = x.constructor;
  34308. if (dp === void 0) {
  34309. str = finiteToString(x, true);
  34310. } else {
  34311. checkInt32(dp, 0, MAX_DIGITS);
  34312. if (rm === void 0) rm = Ctor.rounding;else checkInt32(rm, 0, 8);
  34313. x = finalise(new Ctor(x), dp + 1, rm);
  34314. str = finiteToString(x, true, dp + 1);
  34315. }
  34316. return x.isNeg() && !x.isZero() ? '-' + str : str;
  34317. };
  34318. /*
  34319. * Return a string representing the value of this Decimal in normal (fixed-point) notation to
  34320. * `dp` fixed decimal places and rounded using rounding mode `rm` or `rounding` if `rm` is
  34321. * omitted.
  34322. *
  34323. * As with JavaScript numbers, (-0).toFixed(0) is '0', but e.g. (-0.00001).toFixed(0) is '-0'.
  34324. *
  34325. * [dp] {number} Decimal places. Integer, 0 to MAX_DIGITS inclusive.
  34326. * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.
  34327. *
  34328. * (-0).toFixed(0) is '0', but (-0.1).toFixed(0) is '-0'.
  34329. * (-0).toFixed(1) is '0.0', but (-0.01).toFixed(1) is '-0.0'.
  34330. * (-0).toFixed(3) is '0.000'.
  34331. * (-0.5).toFixed(0) is '-0'.
  34332. *
  34333. */
  34334. P.toFixed = function (dp, rm) {
  34335. var str,
  34336. y,
  34337. x = this,
  34338. Ctor = x.constructor;
  34339. if (dp === void 0) {
  34340. str = finiteToString(x);
  34341. } else {
  34342. checkInt32(dp, 0, MAX_DIGITS);
  34343. if (rm === void 0) rm = Ctor.rounding;else checkInt32(rm, 0, 8);
  34344. y = finalise(new Ctor(x), dp + x.e + 1, rm);
  34345. str = finiteToString(y, false, dp + y.e + 1);
  34346. }
  34347. // To determine whether to add the minus sign look at the value before it was rounded,
  34348. // i.e. look at `x` rather than `y`.
  34349. return x.isNeg() && !x.isZero() ? '-' + str : str;
  34350. };
  34351. /*
  34352. * Return an array representing the value of this Decimal as a simple fraction with an integer
  34353. * numerator and an integer denominator.
  34354. *
  34355. * The denominator will be a positive non-zero value less than or equal to the specified maximum
  34356. * denominator. If a maximum denominator is not specified, the denominator will be the lowest
  34357. * value necessary to represent the number exactly.
  34358. *
  34359. * [maxD] {number|string|Decimal} Maximum denominator. Integer >= 1 and < Infinity.
  34360. *
  34361. */
  34362. P.toFraction = function (maxD) {
  34363. var d,
  34364. d0,
  34365. d1,
  34366. d2,
  34367. e,
  34368. k,
  34369. n,
  34370. n0,
  34371. n1,
  34372. pr,
  34373. q,
  34374. r,
  34375. x = this,
  34376. xd = x.d,
  34377. Ctor = x.constructor;
  34378. if (!xd) return new Ctor(x);
  34379. n1 = d0 = new Ctor(1);
  34380. d1 = n0 = new Ctor(0);
  34381. d = new Ctor(d1);
  34382. e = d.e = getPrecision(xd) - x.e - 1;
  34383. k = e % LOG_BASE;
  34384. d.d[0] = mathpow(10, k < 0 ? LOG_BASE + k : k);
  34385. if (maxD == null) {
  34386. // d is 10**e, the minimum max-denominator needed.
  34387. maxD = e > 0 ? d : n1;
  34388. } else {
  34389. n = new Ctor(maxD);
  34390. if (!n.isInt() || n.lt(n1)) throw Error(invalidArgument + n);
  34391. maxD = n.gt(d) ? e > 0 ? d : n1 : n;
  34392. }
  34393. external = false;
  34394. n = new Ctor(digitsToString(xd));
  34395. pr = Ctor.precision;
  34396. Ctor.precision = e = xd.length * LOG_BASE * 2;
  34397. for (;;) {
  34398. q = divide(n, d, 0, 1, 1);
  34399. d2 = d0.plus(q.times(d1));
  34400. if (d2.cmp(maxD) == 1) break;
  34401. d0 = d1;
  34402. d1 = d2;
  34403. d2 = n1;
  34404. n1 = n0.plus(q.times(d2));
  34405. n0 = d2;
  34406. d2 = d;
  34407. d = n.minus(q.times(d2));
  34408. n = d2;
  34409. }
  34410. d2 = divide(maxD.minus(d0), d1, 0, 1, 1);
  34411. n0 = n0.plus(d2.times(n1));
  34412. d0 = d0.plus(d2.times(d1));
  34413. n0.s = n1.s = x.s;
  34414. // Determine which fraction is closer to x, n0/d0 or n1/d1?
  34415. r = divide(n1, d1, e, 1).minus(x).abs().cmp(divide(n0, d0, e, 1).minus(x).abs()) < 1 ? [n1, d1] : [n0, d0];
  34416. Ctor.precision = pr;
  34417. external = true;
  34418. return r;
  34419. };
  34420. /*
  34421. * Return a string representing the value of this Decimal in base 16, round to `sd` significant
  34422. * digits using rounding mode `rm`.
  34423. *
  34424. * If the optional `sd` argument is present then return binary exponential notation.
  34425. *
  34426. * [sd] {number} Significant digits. Integer, 1 to MAX_DIGITS inclusive.
  34427. * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.
  34428. *
  34429. */
  34430. P.toHexadecimal = P.toHex = function (sd, rm) {
  34431. return toStringBinary(this, 16, sd, rm);
  34432. };
  34433. /*
  34434. * Returns a new Decimal whose value is the nearest multiple of `y` in the direction of rounding
  34435. * mode `rm`, or `Decimal.rounding` if `rm` is omitted, to the value of this Decimal.
  34436. *
  34437. * The return value will always have the same sign as this Decimal, unless either this Decimal
  34438. * or `y` is NaN, in which case the return value will be also be NaN.
  34439. *
  34440. * The return value is not affected by the value of `precision`.
  34441. *
  34442. * y {number|string|Decimal} The magnitude to round to a multiple of.
  34443. * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.
  34444. *
  34445. * 'toNearest() rounding mode not an integer: {rm}'
  34446. * 'toNearest() rounding mode out of range: {rm}'
  34447. *
  34448. */
  34449. P.toNearest = function (y, rm) {
  34450. var x = this,
  34451. Ctor = x.constructor;
  34452. x = new Ctor(x);
  34453. if (y == null) {
  34454. // If x is not finite, return x.
  34455. if (!x.d) return x;
  34456. y = new Ctor(1);
  34457. rm = Ctor.rounding;
  34458. } else {
  34459. y = new Ctor(y);
  34460. if (rm === void 0) {
  34461. rm = Ctor.rounding;
  34462. } else {
  34463. checkInt32(rm, 0, 8);
  34464. }
  34465. // If x is not finite, return x if y is not NaN, else NaN.
  34466. if (!x.d) return y.s ? x : y;
  34467. // If y is not finite, return Infinity with the sign of x if y is Infinity, else NaN.
  34468. if (!y.d) {
  34469. if (y.s) y.s = x.s;
  34470. return y;
  34471. }
  34472. }
  34473. // If y is not zero, calculate the nearest multiple of y to x.
  34474. if (y.d[0]) {
  34475. external = false;
  34476. x = divide(x, y, 0, rm, 1).times(y);
  34477. external = true;
  34478. finalise(x);
  34479. // If y is zero, return zero with the sign of x.
  34480. } else {
  34481. y.s = x.s;
  34482. x = y;
  34483. }
  34484. return x;
  34485. };
  34486. /*
  34487. * Return the value of this Decimal converted to a number primitive.
  34488. * Zero keeps its sign.
  34489. *
  34490. */
  34491. P.toNumber = function () {
  34492. return +this;
  34493. };
  34494. /*
  34495. * Return a string representing the value of this Decimal in base 8, round to `sd` significant
  34496. * digits using rounding mode `rm`.
  34497. *
  34498. * If the optional `sd` argument is present then return binary exponential notation.
  34499. *
  34500. * [sd] {number} Significant digits. Integer, 1 to MAX_DIGITS inclusive.
  34501. * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.
  34502. *
  34503. */
  34504. P.toOctal = function (sd, rm) {
  34505. return toStringBinary(this, 8, sd, rm);
  34506. };
  34507. /*
  34508. * Return a new Decimal whose value is the value of this Decimal raised to the power `y`, rounded
  34509. * to `precision` significant digits using rounding mode `rounding`.
  34510. *
  34511. * ECMAScript compliant.
  34512. *
  34513. * pow(x, NaN) = NaN
  34514. * pow(x, ±0) = 1
  34515. * pow(NaN, non-zero) = NaN
  34516. * pow(abs(x) > 1, +Infinity) = +Infinity
  34517. * pow(abs(x) > 1, -Infinity) = +0
  34518. * pow(abs(x) == 1, ±Infinity) = NaN
  34519. * pow(abs(x) < 1, +Infinity) = +0
  34520. * pow(abs(x) < 1, -Infinity) = +Infinity
  34521. * pow(+Infinity, y > 0) = +Infinity
  34522. * pow(+Infinity, y < 0) = +0
  34523. * pow(-Infinity, odd integer > 0) = -Infinity
  34524. * pow(-Infinity, even integer > 0) = +Infinity
  34525. * pow(-Infinity, odd integer < 0) = -0
  34526. * pow(-Infinity, even integer < 0) = +0
  34527. * pow(+0, y > 0) = +0
  34528. * pow(+0, y < 0) = +Infinity
  34529. * pow(-0, odd integer > 0) = -0
  34530. * pow(-0, even integer > 0) = +0
  34531. * pow(-0, odd integer < 0) = -Infinity
  34532. * pow(-0, even integer < 0) = +Infinity
  34533. * pow(finite x < 0, finite non-integer) = NaN
  34534. *
  34535. * For non-integer or very large exponents pow(x, y) is calculated using
  34536. *
  34537. * x^y = exp(y*ln(x))
  34538. *
  34539. * Assuming the first 15 rounding digits are each equally likely to be any digit 0-9, the
  34540. * probability of an incorrectly rounded result
  34541. * P([49]9{14} | [50]0{14}) = 2 * 0.2 * 10^-14 = 4e-15 = 1/2.5e+14
  34542. * i.e. 1 in 250,000,000,000,000
  34543. *
  34544. * If a result is incorrectly rounded the maximum error will be 1 ulp (unit in last place).
  34545. *
  34546. * y {number|string|Decimal} The power to which to raise this Decimal.
  34547. *
  34548. */
  34549. P.toPower = P.pow = function (y) {
  34550. var e,
  34551. k,
  34552. pr,
  34553. r,
  34554. rm,
  34555. s,
  34556. x = this,
  34557. Ctor = x.constructor,
  34558. yn = +(y = new Ctor(y));
  34559. // Either ±Infinity, NaN or ±0?
  34560. if (!x.d || !y.d || !x.d[0] || !y.d[0]) return new Ctor(mathpow(+x, yn));
  34561. x = new Ctor(x);
  34562. if (x.eq(1)) return x;
  34563. pr = Ctor.precision;
  34564. rm = Ctor.rounding;
  34565. if (y.eq(1)) return finalise(x, pr, rm);
  34566. // y exponent
  34567. e = mathfloor(y.e / LOG_BASE);
  34568. // If y is a small integer use the 'exponentiation by squaring' algorithm.
  34569. if (e >= y.d.length - 1 && (k = yn < 0 ? -yn : yn) <= MAX_SAFE_INTEGER) {
  34570. r = intPow(Ctor, x, k, pr);
  34571. return y.s < 0 ? new Ctor(1).div(r) : finalise(r, pr, rm);
  34572. }
  34573. s = x.s;
  34574. // if x is negative
  34575. if (s < 0) {
  34576. // if y is not an integer
  34577. if (e < y.d.length - 1) return new Ctor(NaN);
  34578. // Result is positive if x is negative and the last digit of integer y is even.
  34579. if ((y.d[e] & 1) == 0) s = 1;
  34580. // if x.eq(-1)
  34581. if (x.e == 0 && x.d[0] == 1 && x.d.length == 1) {
  34582. x.s = s;
  34583. return x;
  34584. }
  34585. }
  34586. // Estimate result exponent.
  34587. // x^y = 10^e, where e = y * log10(x)
  34588. // log10(x) = log10(x_significand) + x_exponent
  34589. // log10(x_significand) = ln(x_significand) / ln(10)
  34590. k = mathpow(+x, yn);
  34591. e = k == 0 || !isFinite(k) ? mathfloor(yn * (Math.log('0.' + digitsToString(x.d)) / Math.LN10 + x.e + 1)) : new Ctor(k + '').e;
  34592. // Exponent estimate may be incorrect e.g. x: 0.999999999999999999, y: 2.29, e: 0, r.e: -1.
  34593. // Overflow/underflow?
  34594. if (e > Ctor.maxE + 1 || e < Ctor.minE - 1) return new Ctor(e > 0 ? s / 0 : 0);
  34595. external = false;
  34596. Ctor.rounding = x.s = 1;
  34597. // Estimate the extra guard digits needed to ensure five correct rounding digits from
  34598. // naturalLogarithm(x). Example of failure without these extra digits (precision: 10):
  34599. // new Decimal(2.32456).pow('2087987436534566.46411')
  34600. // should be 1.162377823e+764914905173815, but is 1.162355823e+764914905173815
  34601. k = Math.min(12, (e + '').length);
  34602. // r = x^y = exp(y*ln(x))
  34603. r = naturalExponential(y.times(naturalLogarithm(x, pr + k)), pr);
  34604. // r may be Infinity, e.g. (0.9999999999999999).pow(-1e+40)
  34605. if (r.d) {
  34606. // Truncate to the required precision plus five rounding digits.
  34607. r = finalise(r, pr + 5, 1);
  34608. // If the rounding digits are [49]9999 or [50]0000 increase the precision by 10 and recalculate
  34609. // the result.
  34610. if (checkRoundingDigits(r.d, pr, rm)) {
  34611. e = pr + 10;
  34612. // Truncate to the increased precision plus five rounding digits.
  34613. r = finalise(naturalExponential(y.times(naturalLogarithm(x, e + k)), e), e + 5, 1);
  34614. // Check for 14 nines from the 2nd rounding digit (the first rounding digit may be 4 or 9).
  34615. if (+digitsToString(r.d).slice(pr + 1, pr + 15) + 1 == 1e14) {
  34616. r = finalise(r, pr + 1, 0);
  34617. }
  34618. }
  34619. }
  34620. r.s = s;
  34621. external = true;
  34622. Ctor.rounding = rm;
  34623. return finalise(r, pr, rm);
  34624. };
  34625. /*
  34626. * Return a string representing the value of this Decimal rounded to `sd` significant digits
  34627. * using rounding mode `rounding`.
  34628. *
  34629. * Return exponential notation if `sd` is less than the number of digits necessary to represent
  34630. * the integer part of the value in normal notation.
  34631. *
  34632. * [sd] {number} Significant digits. Integer, 1 to MAX_DIGITS inclusive.
  34633. * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.
  34634. *
  34635. */
  34636. P.toPrecision = function (sd, rm) {
  34637. var str,
  34638. x = this,
  34639. Ctor = x.constructor;
  34640. if (sd === void 0) {
  34641. str = finiteToString(x, x.e <= Ctor.toExpNeg || x.e >= Ctor.toExpPos);
  34642. } else {
  34643. checkInt32(sd, 1, MAX_DIGITS);
  34644. if (rm === void 0) rm = Ctor.rounding;else checkInt32(rm, 0, 8);
  34645. x = finalise(new Ctor(x), sd, rm);
  34646. str = finiteToString(x, sd <= x.e || x.e <= Ctor.toExpNeg, sd);
  34647. }
  34648. return x.isNeg() && !x.isZero() ? '-' + str : str;
  34649. };
  34650. /*
  34651. * Return a new Decimal whose value is the value of this Decimal rounded to a maximum of `sd`
  34652. * significant digits using rounding mode `rm`, or to `precision` and `rounding` respectively if
  34653. * omitted.
  34654. *
  34655. * [sd] {number} Significant digits. Integer, 1 to MAX_DIGITS inclusive.
  34656. * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.
  34657. *
  34658. * 'toSD() digits out of range: {sd}'
  34659. * 'toSD() digits not an integer: {sd}'
  34660. * 'toSD() rounding mode not an integer: {rm}'
  34661. * 'toSD() rounding mode out of range: {rm}'
  34662. *
  34663. */
  34664. P.toSignificantDigits = P.toSD = function (sd, rm) {
  34665. var x = this,
  34666. Ctor = x.constructor;
  34667. if (sd === void 0) {
  34668. sd = Ctor.precision;
  34669. rm = Ctor.rounding;
  34670. } else {
  34671. checkInt32(sd, 1, MAX_DIGITS);
  34672. if (rm === void 0) rm = Ctor.rounding;else checkInt32(rm, 0, 8);
  34673. }
  34674. return finalise(new Ctor(x), sd, rm);
  34675. };
  34676. /*
  34677. * Return a string representing the value of this Decimal.
  34678. *
  34679. * Return exponential notation if this Decimal has a positive exponent equal to or greater than
  34680. * `toExpPos`, or a negative exponent equal to or less than `toExpNeg`.
  34681. *
  34682. */
  34683. P.toString = function () {
  34684. var x = this,
  34685. Ctor = x.constructor,
  34686. str = finiteToString(x, x.e <= Ctor.toExpNeg || x.e >= Ctor.toExpPos);
  34687. return x.isNeg() && !x.isZero() ? '-' + str : str;
  34688. };
  34689. /*
  34690. * Return a new Decimal whose value is the value of this Decimal truncated to a whole number.
  34691. *
  34692. */
  34693. P.truncated = P.trunc = function () {
  34694. return finalise(new this.constructor(this), this.e + 1, 1);
  34695. };
  34696. /*
  34697. * Return a string representing the value of this Decimal.
  34698. * Unlike `toString`, negative zero will include the minus sign.
  34699. *
  34700. */
  34701. P.valueOf = P.toJSON = function () {
  34702. var x = this,
  34703. Ctor = x.constructor,
  34704. str = finiteToString(x, x.e <= Ctor.toExpNeg || x.e >= Ctor.toExpPos);
  34705. return x.isNeg() ? '-' + str : str;
  34706. };
  34707. /*
  34708. // Add aliases to match BigDecimal method names.
  34709. // P.add = P.plus;
  34710. P.subtract = P.minus;
  34711. P.multiply = P.times;
  34712. P.divide = P.div;
  34713. P.remainder = P.mod;
  34714. P.compareTo = P.cmp;
  34715. P.negate = P.neg;
  34716. */
  34717. // Helper functions for Decimal.prototype (P) and/or Decimal methods, and their callers.
  34718. /*
  34719. * digitsToString P.cubeRoot, P.logarithm, P.squareRoot, P.toFraction, P.toPower,
  34720. * finiteToString, naturalExponential, naturalLogarithm
  34721. * checkInt32 P.toDecimalPlaces, P.toExponential, P.toFixed, P.toNearest,
  34722. * P.toPrecision, P.toSignificantDigits, toStringBinary, random
  34723. * checkRoundingDigits P.logarithm, P.toPower, naturalExponential, naturalLogarithm
  34724. * convertBase toStringBinary, parseOther
  34725. * cos P.cos
  34726. * divide P.atanh, P.cubeRoot, P.dividedBy, P.dividedToIntegerBy,
  34727. * P.logarithm, P.modulo, P.squareRoot, P.tan, P.tanh, P.toFraction,
  34728. * P.toNearest, toStringBinary, naturalExponential, naturalLogarithm,
  34729. * taylorSeries, atan2, parseOther
  34730. * finalise P.absoluteValue, P.atan, P.atanh, P.ceil, P.cos, P.cosh,
  34731. * P.cubeRoot, P.dividedToIntegerBy, P.floor, P.logarithm, P.minus,
  34732. * P.modulo, P.negated, P.plus, P.round, P.sin, P.sinh, P.squareRoot,
  34733. * P.tan, P.times, P.toDecimalPlaces, P.toExponential, P.toFixed,
  34734. * P.toNearest, P.toPower, P.toPrecision, P.toSignificantDigits,
  34735. * P.truncated, divide, getLn10, getPi, naturalExponential,
  34736. * naturalLogarithm, ceil, floor, round, trunc
  34737. * finiteToString P.toExponential, P.toFixed, P.toPrecision, P.toString, P.valueOf,
  34738. * toStringBinary
  34739. * getBase10Exponent P.minus, P.plus, P.times, parseOther
  34740. * getLn10 P.logarithm, naturalLogarithm
  34741. * getPi P.acos, P.asin, P.atan, toLessThanHalfPi, atan2
  34742. * getPrecision P.precision, P.toFraction
  34743. * getZeroString digitsToString, finiteToString
  34744. * intPow P.toPower, parseOther
  34745. * isOdd toLessThanHalfPi
  34746. * maxOrMin max, min
  34747. * naturalExponential P.naturalExponential, P.toPower
  34748. * naturalLogarithm P.acosh, P.asinh, P.atanh, P.logarithm, P.naturalLogarithm,
  34749. * P.toPower, naturalExponential
  34750. * nonFiniteToString finiteToString, toStringBinary
  34751. * parseDecimal Decimal
  34752. * parseOther Decimal
  34753. * sin P.sin
  34754. * taylorSeries P.cosh, P.sinh, cos, sin
  34755. * toLessThanHalfPi P.cos, P.sin
  34756. * toStringBinary P.toBinary, P.toHexadecimal, P.toOctal
  34757. * truncate intPow
  34758. *
  34759. * Throws: P.logarithm, P.precision, P.toFraction, checkInt32, getLn10, getPi,
  34760. * naturalLogarithm, config, parseOther, random, Decimal
  34761. */
  34762. function digitsToString(d) {
  34763. var i,
  34764. k,
  34765. ws,
  34766. indexOfLastWord = d.length - 1,
  34767. str = '',
  34768. w = d[0];
  34769. if (indexOfLastWord > 0) {
  34770. str += w;
  34771. for (i = 1; i < indexOfLastWord; i++) {
  34772. ws = d[i] + '';
  34773. k = LOG_BASE - ws.length;
  34774. if (k) str += getZeroString(k);
  34775. str += ws;
  34776. }
  34777. w = d[i];
  34778. ws = w + '';
  34779. k = LOG_BASE - ws.length;
  34780. if (k) str += getZeroString(k);
  34781. } else if (w === 0) {
  34782. return '0';
  34783. }
  34784. // Remove trailing zeros of last w.
  34785. for (; w % 10 === 0;) {
  34786. w /= 10;
  34787. }return str + w;
  34788. }
  34789. function checkInt32(i, min, max) {
  34790. if (i !== ~~i || i < min || i > max) {
  34791. throw Error(invalidArgument + i);
  34792. }
  34793. }
  34794. /*
  34795. * Check 5 rounding digits if `repeating` is null, 4 otherwise.
  34796. * `repeating == null` if caller is `log` or `pow`,
  34797. * `repeating != null` if caller is `naturalLogarithm` or `naturalExponential`.
  34798. */
  34799. function checkRoundingDigits(d, i, rm, repeating) {
  34800. var di, k, r, rd;
  34801. // Get the length of the first word of the array d.
  34802. for (k = d[0]; k >= 10; k /= 10) {
  34803. --i;
  34804. } // Is the rounding digit in the first word of d?
  34805. if (--i < 0) {
  34806. i += LOG_BASE;
  34807. di = 0;
  34808. } else {
  34809. di = Math.ceil((i + 1) / LOG_BASE);
  34810. i %= LOG_BASE;
  34811. }
  34812. // i is the index (0 - 6) of the rounding digit.
  34813. // E.g. if within the word 3487563 the first rounding digit is 5,
  34814. // then i = 4, k = 1000, rd = 3487563 % 1000 = 563
  34815. k = mathpow(10, LOG_BASE - i);
  34816. rd = d[di] % k | 0;
  34817. if (repeating == null) {
  34818. if (i < 3) {
  34819. if (i == 0) rd = rd / 100 | 0;else if (i == 1) rd = rd / 10 | 0;
  34820. r = rm < 4 && rd == 99999 || rm > 3 && rd == 49999 || rd == 50000 || rd == 0;
  34821. } else {
  34822. r = (rm < 4 && rd + 1 == k || rm > 3 && rd + 1 == k / 2) && (d[di + 1] / k / 100 | 0) == mathpow(10, i - 2) - 1 || (rd == k / 2 || rd == 0) && (d[di + 1] / k / 100 | 0) == 0;
  34823. }
  34824. } else {
  34825. if (i < 4) {
  34826. if (i == 0) rd = rd / 1000 | 0;else if (i == 1) rd = rd / 100 | 0;else if (i == 2) rd = rd / 10 | 0;
  34827. r = (repeating || rm < 4) && rd == 9999 || !repeating && rm > 3 && rd == 4999;
  34828. } else {
  34829. r = ((repeating || rm < 4) && rd + 1 == k || !repeating && rm > 3 && rd + 1 == k / 2) && (d[di + 1] / k / 1000 | 0) == mathpow(10, i - 3) - 1;
  34830. }
  34831. }
  34832. return r;
  34833. }
  34834. // Convert string of `baseIn` to an array of numbers of `baseOut`.
  34835. // Eg. convertBase('255', 10, 16) returns [15, 15].
  34836. // Eg. convertBase('ff', 16, 10) returns [2, 5, 5].
  34837. function convertBase(str, baseIn, baseOut) {
  34838. var j,
  34839. arr = [0],
  34840. arrL,
  34841. i = 0,
  34842. strL = str.length;
  34843. for (; i < strL;) {
  34844. for (arrL = arr.length; arrL--;) {
  34845. arr[arrL] *= baseIn;
  34846. }arr[0] += NUMERALS.indexOf(str.charAt(i++));
  34847. for (j = 0; j < arr.length; j++) {
  34848. if (arr[j] > baseOut - 1) {
  34849. if (arr[j + 1] === void 0) arr[j + 1] = 0;
  34850. arr[j + 1] += arr[j] / baseOut | 0;
  34851. arr[j] %= baseOut;
  34852. }
  34853. }
  34854. }
  34855. return arr.reverse();
  34856. }
  34857. /*
  34858. * cos(x) = 1 - x^2/2! + x^4/4! - ...
  34859. * |x| < pi/2
  34860. *
  34861. */
  34862. function cosine(Ctor, x) {
  34863. var k,
  34864. y,
  34865. len = x.d.length;
  34866. // Argument reduction: cos(4x) = 8*(cos^4(x) - cos^2(x)) + 1
  34867. // i.e. cos(x) = 8*(cos^4(x/4) - cos^2(x/4)) + 1
  34868. // Estimate the optimum number of times to use the argument reduction.
  34869. if (len < 32) {
  34870. k = Math.ceil(len / 3);
  34871. y = Math.pow(4, -k).toString();
  34872. } else {
  34873. k = 16;
  34874. y = '2.3283064365386962890625e-10';
  34875. }
  34876. Ctor.precision += k;
  34877. x = taylorSeries(Ctor, 1, x.times(y), new Ctor(1));
  34878. // Reverse argument reduction
  34879. for (var i = k; i--;) {
  34880. var cos2x = x.times(x);
  34881. x = cos2x.times(cos2x).minus(cos2x).times(8).plus(1);
  34882. }
  34883. Ctor.precision -= k;
  34884. return x;
  34885. }
  34886. /*
  34887. * Perform division in the specified base.
  34888. */
  34889. var divide = function () {
  34890. // Assumes non-zero x and k, and hence non-zero result.
  34891. function multiplyInteger(x, k, base) {
  34892. var temp,
  34893. carry = 0,
  34894. i = x.length;
  34895. for (x = x.slice(); i--;) {
  34896. temp = x[i] * k + carry;
  34897. x[i] = temp % base | 0;
  34898. carry = temp / base | 0;
  34899. }
  34900. if (carry) x.unshift(carry);
  34901. return x;
  34902. }
  34903. function compare(a, b, aL, bL) {
  34904. var i, r;
  34905. if (aL != bL) {
  34906. r = aL > bL ? 1 : -1;
  34907. } else {
  34908. for (i = r = 0; i < aL; i++) {
  34909. if (a[i] != b[i]) {
  34910. r = a[i] > b[i] ? 1 : -1;
  34911. break;
  34912. }
  34913. }
  34914. }
  34915. return r;
  34916. }
  34917. function subtract(a, b, aL, base) {
  34918. var i = 0;
  34919. // Subtract b from a.
  34920. for (; aL--;) {
  34921. a[aL] -= i;
  34922. i = a[aL] < b[aL] ? 1 : 0;
  34923. a[aL] = i * base + a[aL] - b[aL];
  34924. }
  34925. // Remove leading zeros.
  34926. for (; !a[0] && a.length > 1;) {
  34927. a.shift();
  34928. }
  34929. }
  34930. return function (x, y, pr, rm, dp, base) {
  34931. var cmp,
  34932. e,
  34933. i,
  34934. k,
  34935. logBase,
  34936. more,
  34937. prod,
  34938. prodL,
  34939. q,
  34940. qd,
  34941. rem,
  34942. remL,
  34943. rem0,
  34944. sd,
  34945. t,
  34946. xi,
  34947. xL,
  34948. yd0,
  34949. yL,
  34950. yz,
  34951. Ctor = x.constructor,
  34952. sign = x.s == y.s ? 1 : -1,
  34953. xd = x.d,
  34954. yd = y.d;
  34955. // Either NaN, Infinity or 0?
  34956. if (!xd || !xd[0] || !yd || !yd[0]) {
  34957. return new Ctor( // Return NaN if either NaN, or both Infinity or 0.
  34958. !x.s || !y.s || (xd ? yd && xd[0] == yd[0] : !yd) ? NaN :
  34959. // Return ±0 if x is 0 or y is ±Infinity, or return ±Infinity as y is 0.
  34960. xd && xd[0] == 0 || !yd ? sign * 0 : sign / 0);
  34961. }
  34962. if (base) {
  34963. logBase = 1;
  34964. e = x.e - y.e;
  34965. } else {
  34966. base = BASE;
  34967. logBase = LOG_BASE;
  34968. e = mathfloor(x.e / logBase) - mathfloor(y.e / logBase);
  34969. }
  34970. yL = yd.length;
  34971. xL = xd.length;
  34972. q = new Ctor(sign);
  34973. qd = q.d = [];
  34974. // Result exponent may be one less than e.
  34975. // The digit array of a Decimal from toStringBinary may have trailing zeros.
  34976. for (i = 0; yd[i] == (xd[i] || 0); i++) {}
  34977. if (yd[i] > (xd[i] || 0)) e--;
  34978. if (pr == null) {
  34979. sd = pr = Ctor.precision;
  34980. rm = Ctor.rounding;
  34981. } else if (dp) {
  34982. sd = pr + (x.e - y.e) + 1;
  34983. } else {
  34984. sd = pr;
  34985. }
  34986. if (sd < 0) {
  34987. qd.push(1);
  34988. more = true;
  34989. } else {
  34990. // Convert precision in number of base 10 digits to base 1e7 digits.
  34991. sd = sd / logBase + 2 | 0;
  34992. i = 0;
  34993. // divisor < 1e7
  34994. if (yL == 1) {
  34995. k = 0;
  34996. yd = yd[0];
  34997. sd++;
  34998. // k is the carry.
  34999. for (; (i < xL || k) && sd--; i++) {
  35000. t = k * base + (xd[i] || 0);
  35001. qd[i] = t / yd | 0;
  35002. k = t % yd | 0;
  35003. }
  35004. more = k || i < xL;
  35005. // divisor >= 1e7
  35006. } else {
  35007. // Normalise xd and yd so highest order digit of yd is >= base/2
  35008. k = base / (yd[0] + 1) | 0;
  35009. if (k > 1) {
  35010. yd = multiplyInteger(yd, k, base);
  35011. xd = multiplyInteger(xd, k, base);
  35012. yL = yd.length;
  35013. xL = xd.length;
  35014. }
  35015. xi = yL;
  35016. rem = xd.slice(0, yL);
  35017. remL = rem.length;
  35018. // Add zeros to make remainder as long as divisor.
  35019. for (; remL < yL;) {
  35020. rem[remL++] = 0;
  35021. }yz = yd.slice();
  35022. yz.unshift(0);
  35023. yd0 = yd[0];
  35024. if (yd[1] >= base / 2) ++yd0;
  35025. do {
  35026. k = 0;
  35027. // Compare divisor and remainder.
  35028. cmp = compare(yd, rem, yL, remL);
  35029. // If divisor < remainder.
  35030. if (cmp < 0) {
  35031. // Calculate trial digit, k.
  35032. rem0 = rem[0];
  35033. if (yL != remL) rem0 = rem0 * base + (rem[1] || 0);
  35034. // k will be how many times the divisor goes into the current remainder.
  35035. k = rem0 / yd0 | 0;
  35036. // Algorithm:
  35037. // 1. product = divisor * trial digit (k)
  35038. // 2. if product > remainder: product -= divisor, k--
  35039. // 3. remainder -= product
  35040. // 4. if product was < remainder at 2:
  35041. // 5. compare new remainder and divisor
  35042. // 6. If remainder > divisor: remainder -= divisor, k++
  35043. if (k > 1) {
  35044. if (k >= base) k = base - 1;
  35045. // product = divisor * trial digit.
  35046. prod = multiplyInteger(yd, k, base);
  35047. prodL = prod.length;
  35048. remL = rem.length;
  35049. // Compare product and remainder.
  35050. cmp = compare(prod, rem, prodL, remL);
  35051. // product > remainder.
  35052. if (cmp == 1) {
  35053. k--;
  35054. // Subtract divisor from product.
  35055. subtract(prod, yL < prodL ? yz : yd, prodL, base);
  35056. }
  35057. } else {
  35058. // cmp is -1.
  35059. // If k is 0, there is no need to compare yd and rem again below, so change cmp to 1
  35060. // to avoid it. If k is 1 there is a need to compare yd and rem again below.
  35061. if (k == 0) cmp = k = 1;
  35062. prod = yd.slice();
  35063. }
  35064. prodL = prod.length;
  35065. if (prodL < remL) prod.unshift(0);
  35066. // Subtract product from remainder.
  35067. subtract(rem, prod, remL, base);
  35068. // If product was < previous remainder.
  35069. if (cmp == -1) {
  35070. remL = rem.length;
  35071. // Compare divisor and new remainder.
  35072. cmp = compare(yd, rem, yL, remL);
  35073. // If divisor < new remainder, subtract divisor from remainder.
  35074. if (cmp < 1) {
  35075. k++;
  35076. // Subtract divisor from remainder.
  35077. subtract(rem, yL < remL ? yz : yd, remL, base);
  35078. }
  35079. }
  35080. remL = rem.length;
  35081. } else if (cmp === 0) {
  35082. k++;
  35083. rem = [0];
  35084. } // if cmp === 1, k will be 0
  35085. // Add the next digit, k, to the result array.
  35086. qd[i++] = k;
  35087. // Update the remainder.
  35088. if (cmp && rem[0]) {
  35089. rem[remL++] = xd[xi] || 0;
  35090. } else {
  35091. rem = [xd[xi]];
  35092. remL = 1;
  35093. }
  35094. } while ((xi++ < xL || rem[0] !== void 0) && sd--);
  35095. more = rem[0] !== void 0;
  35096. }
  35097. // Leading zero?
  35098. if (!qd[0]) qd.shift();
  35099. }
  35100. // logBase is 1 when divide is being used for base conversion.
  35101. if (logBase == 1) {
  35102. q.e = e;
  35103. inexact = more;
  35104. } else {
  35105. // To calculate q.e, first get the number of digits of qd[0].
  35106. for (i = 1, k = qd[0]; k >= 10; k /= 10) {
  35107. i++;
  35108. }q.e = i + e * logBase - 1;
  35109. finalise(q, dp ? pr + q.e + 1 : pr, rm, more);
  35110. }
  35111. return q;
  35112. };
  35113. }();
  35114. /*
  35115. * Round `x` to `sd` significant digits using rounding mode `rm`.
  35116. * Check for over/under-flow.
  35117. */
  35118. function finalise(x, sd, rm, isTruncated) {
  35119. var digits,
  35120. i,
  35121. j,
  35122. k,
  35123. rd,
  35124. roundUp,
  35125. w,
  35126. xd,
  35127. xdi,
  35128. Ctor = x.constructor;
  35129. // Don't round if sd is null or undefined.
  35130. out: if (sd != null) {
  35131. xd = x.d;
  35132. // Infinity/NaN.
  35133. if (!xd) return x;
  35134. // rd: the rounding digit, i.e. the digit after the digit that may be rounded up.
  35135. // w: the word of xd containing rd, a base 1e7 number.
  35136. // xdi: the index of w within xd.
  35137. // digits: the number of digits of w.
  35138. // i: what would be the index of rd within w if all the numbers were 7 digits long (i.e. if
  35139. // they had leading zeros)
  35140. // j: if > 0, the actual index of rd within w (if < 0, rd is a leading zero).
  35141. // Get the length of the first word of the digits array xd.
  35142. for (digits = 1, k = xd[0]; k >= 10; k /= 10) {
  35143. digits++;
  35144. }i = sd - digits;
  35145. // Is the rounding digit in the first word of xd?
  35146. if (i < 0) {
  35147. i += LOG_BASE;
  35148. j = sd;
  35149. w = xd[xdi = 0];
  35150. // Get the rounding digit at index j of w.
  35151. rd = w / mathpow(10, digits - j - 1) % 10 | 0;
  35152. } else {
  35153. xdi = Math.ceil((i + 1) / LOG_BASE);
  35154. k = xd.length;
  35155. if (xdi >= k) {
  35156. if (isTruncated) {
  35157. // Needed by `naturalExponential`, `naturalLogarithm` and `squareRoot`.
  35158. for (; k++ <= xdi;) {
  35159. xd.push(0);
  35160. }w = rd = 0;
  35161. digits = 1;
  35162. i %= LOG_BASE;
  35163. j = i - LOG_BASE + 1;
  35164. } else {
  35165. break out;
  35166. }
  35167. } else {
  35168. w = k = xd[xdi];
  35169. // Get the number of digits of w.
  35170. for (digits = 1; k >= 10; k /= 10) {
  35171. digits++;
  35172. } // Get the index of rd within w.
  35173. i %= LOG_BASE;
  35174. // Get the index of rd within w, adjusted for leading zeros.
  35175. // The number of leading zeros of w is given by LOG_BASE - digits.
  35176. j = i - LOG_BASE + digits;
  35177. // Get the rounding digit at index j of w.
  35178. rd = j < 0 ? 0 : w / mathpow(10, digits - j - 1) % 10 | 0;
  35179. }
  35180. }
  35181. // Are there any non-zero digits after the rounding digit?
  35182. isTruncated = isTruncated || sd < 0 || xd[xdi + 1] !== void 0 || (j < 0 ? w : w % mathpow(10, digits - j - 1));
  35183. // The expression `w % mathpow(10, digits - j - 1)` returns all the digits of w to the right
  35184. // of the digit at (left-to-right) index j, e.g. if w is 908714 and j is 2, the expression
  35185. // will give 714.
  35186. roundUp = rm < 4 ? (rd || isTruncated) && (rm == 0 || rm == (x.s < 0 ? 3 : 2)) : rd > 5 || rd == 5 && (rm == 4 || isTruncated || rm == 6 &&
  35187. // Check whether the digit to the left of the rounding digit is odd.
  35188. (i > 0 ? j > 0 ? w / mathpow(10, digits - j) : 0 : xd[xdi - 1]) % 10 & 1 || rm == (x.s < 0 ? 8 : 7));
  35189. if (sd < 1 || !xd[0]) {
  35190. xd.length = 0;
  35191. if (roundUp) {
  35192. // Convert sd to decimal places.
  35193. sd -= x.e + 1;
  35194. // 1, 0.1, 0.01, 0.001, 0.0001 etc.
  35195. xd[0] = mathpow(10, (LOG_BASE - sd % LOG_BASE) % LOG_BASE);
  35196. x.e = -sd || 0;
  35197. } else {
  35198. // Zero.
  35199. xd[0] = x.e = 0;
  35200. }
  35201. return x;
  35202. }
  35203. // Remove excess digits.
  35204. if (i == 0) {
  35205. xd.length = xdi;
  35206. k = 1;
  35207. xdi--;
  35208. } else {
  35209. xd.length = xdi + 1;
  35210. k = mathpow(10, LOG_BASE - i);
  35211. // E.g. 56700 becomes 56000 if 7 is the rounding digit.
  35212. // j > 0 means i > number of leading zeros of w.
  35213. xd[xdi] = j > 0 ? (w / mathpow(10, digits - j) % mathpow(10, j) | 0) * k : 0;
  35214. }
  35215. if (roundUp) {
  35216. for (;;) {
  35217. // Is the digit to be rounded up in the first word of xd?
  35218. if (xdi == 0) {
  35219. // i will be the length of xd[0] before k is added.
  35220. for (i = 1, j = xd[0]; j >= 10; j /= 10) {
  35221. i++;
  35222. }j = xd[0] += k;
  35223. for (k = 1; j >= 10; j /= 10) {
  35224. k++;
  35225. } // if i != k the length has increased.
  35226. if (i != k) {
  35227. x.e++;
  35228. if (xd[0] == BASE) xd[0] = 1;
  35229. }
  35230. break;
  35231. } else {
  35232. xd[xdi] += k;
  35233. if (xd[xdi] != BASE) break;
  35234. xd[xdi--] = 0;
  35235. k = 1;
  35236. }
  35237. }
  35238. }
  35239. // Remove trailing zeros.
  35240. for (i = xd.length; xd[--i] === 0;) {
  35241. xd.pop();
  35242. }
  35243. }
  35244. if (external) {
  35245. // Overflow?
  35246. if (x.e > Ctor.maxE) {
  35247. // Infinity.
  35248. x.d = null;
  35249. x.e = NaN;
  35250. // Underflow?
  35251. } else if (x.e < Ctor.minE) {
  35252. // Zero.
  35253. x.e = 0;
  35254. x.d = [0];
  35255. // Ctor.underflow = true;
  35256. } // else Ctor.underflow = false;
  35257. }
  35258. return x;
  35259. }
  35260. function finiteToString(x, isExp, sd) {
  35261. if (!x.isFinite()) return nonFiniteToString(x);
  35262. var k,
  35263. e = x.e,
  35264. str = digitsToString(x.d),
  35265. len = str.length;
  35266. if (isExp) {
  35267. if (sd && (k = sd - len) > 0) {
  35268. str = str.charAt(0) + '.' + str.slice(1) + getZeroString(k);
  35269. } else if (len > 1) {
  35270. str = str.charAt(0) + '.' + str.slice(1);
  35271. }
  35272. str = str + (x.e < 0 ? 'e' : 'e+') + x.e;
  35273. } else if (e < 0) {
  35274. str = '0.' + getZeroString(-e - 1) + str;
  35275. if (sd && (k = sd - len) > 0) str += getZeroString(k);
  35276. } else if (e >= len) {
  35277. str += getZeroString(e + 1 - len);
  35278. if (sd && (k = sd - e - 1) > 0) str = str + '.' + getZeroString(k);
  35279. } else {
  35280. if ((k = e + 1) < len) str = str.slice(0, k) + '.' + str.slice(k);
  35281. if (sd && (k = sd - len) > 0) {
  35282. if (e + 1 === len) str += '.';
  35283. str += getZeroString(k);
  35284. }
  35285. }
  35286. return str;
  35287. }
  35288. // Calculate the base 10 exponent from the base 1e7 exponent.
  35289. function getBase10Exponent(digits, e) {
  35290. var w = digits[0];
  35291. // Add the number of digits of the first word of the digits array.
  35292. for (e *= LOG_BASE; w >= 10; w /= 10) {
  35293. e++;
  35294. }return e;
  35295. }
  35296. function getLn10(Ctor, sd, pr) {
  35297. if (sd > LN10_PRECISION) {
  35298. // Reset global state in case the exception is caught.
  35299. external = true;
  35300. if (pr) Ctor.precision = pr;
  35301. throw Error(precisionLimitExceeded);
  35302. }
  35303. return finalise(new Ctor(LN10), sd, 1, true);
  35304. }
  35305. function getPi(Ctor, sd, rm) {
  35306. if (sd > PI_PRECISION) throw Error(precisionLimitExceeded);
  35307. return finalise(new Ctor(PI), sd, rm, true);
  35308. }
  35309. function getPrecision(digits) {
  35310. var w = digits.length - 1,
  35311. len = w * LOG_BASE + 1;
  35312. w = digits[w];
  35313. // If non-zero...
  35314. if (w) {
  35315. // Subtract the number of trailing zeros of the last word.
  35316. for (; w % 10 == 0; w /= 10) {
  35317. len--;
  35318. } // Add the number of digits of the first word.
  35319. for (w = digits[0]; w >= 10; w /= 10) {
  35320. len++;
  35321. }
  35322. }
  35323. return len;
  35324. }
  35325. function getZeroString(k) {
  35326. var zs = '';
  35327. for (; k--;) {
  35328. zs += '0';
  35329. }return zs;
  35330. }
  35331. /*
  35332. * Return a new Decimal whose value is the value of Decimal `x` to the power `n`, where `n` is an
  35333. * integer of type number.
  35334. *
  35335. * Implements 'exponentiation by squaring'. Called by `pow` and `parseOther`.
  35336. *
  35337. */
  35338. function intPow(Ctor, x, n, pr) {
  35339. var isTruncated,
  35340. r = new Ctor(1),
  35341. // Max n of 9007199254740991 takes 53 loop iterations.
  35342. // Maximum digits array length; leaves [28, 34] guard digits.
  35343. k = Math.ceil(pr / LOG_BASE + 4);
  35344. external = false;
  35345. for (;;) {
  35346. if (n % 2) {
  35347. r = r.times(x);
  35348. if (truncate(r.d, k)) isTruncated = true;
  35349. }
  35350. n = mathfloor(n / 2);
  35351. if (n === 0) {
  35352. // To ensure correct rounding when r.d is truncated, increment the last word if it is zero.
  35353. n = r.d.length - 1;
  35354. if (isTruncated && r.d[n] === 0) ++r.d[n];
  35355. break;
  35356. }
  35357. x = x.times(x);
  35358. truncate(x.d, k);
  35359. }
  35360. external = true;
  35361. return r;
  35362. }
  35363. function isOdd(n) {
  35364. return n.d[n.d.length - 1] & 1;
  35365. }
  35366. /*
  35367. * Handle `max` and `min`. `ltgt` is 'lt' or 'gt'.
  35368. */
  35369. function maxOrMin(Ctor, args, ltgt) {
  35370. var y,
  35371. x = new Ctor(args[0]),
  35372. i = 0;
  35373. for (; ++i < args.length;) {
  35374. y = new Ctor(args[i]);
  35375. if (!y.s) {
  35376. x = y;
  35377. break;
  35378. } else if (x[ltgt](y)) {
  35379. x = y;
  35380. }
  35381. }
  35382. return x;
  35383. }
  35384. /*
  35385. * Return a new Decimal whose value is the natural exponential of `x` rounded to `sd` significant
  35386. * digits.
  35387. *
  35388. * Taylor/Maclaurin series.
  35389. *
  35390. * exp(x) = x^0/0! + x^1/1! + x^2/2! + x^3/3! + ...
  35391. *
  35392. * Argument reduction:
  35393. * Repeat x = x / 32, k += 5, until |x| < 0.1
  35394. * exp(x) = exp(x / 2^k)^(2^k)
  35395. *
  35396. * Previously, the argument was initially reduced by
  35397. * exp(x) = exp(r) * 10^k where r = x - k * ln10, k = floor(x / ln10)
  35398. * to first put r in the range [0, ln10], before dividing by 32 until |x| < 0.1, but this was
  35399. * found to be slower than just dividing repeatedly by 32 as above.
  35400. *
  35401. * Max integer argument: exp('20723265836946413') = 6.3e+9000000000000000
  35402. * Min integer argument: exp('-20723265836946411') = 1.2e-9000000000000000
  35403. * (Math object integer min/max: Math.exp(709) = 8.2e+307, Math.exp(-745) = 5e-324)
  35404. *
  35405. * exp(Infinity) = Infinity
  35406. * exp(-Infinity) = 0
  35407. * exp(NaN) = NaN
  35408. * exp(±0) = 1
  35409. *
  35410. * exp(x) is non-terminating for any finite, non-zero x.
  35411. *
  35412. * The result will always be correctly rounded.
  35413. *
  35414. */
  35415. function naturalExponential(x, sd) {
  35416. var denominator,
  35417. guard,
  35418. j,
  35419. pow,
  35420. sum,
  35421. t,
  35422. wpr,
  35423. rep = 0,
  35424. i = 0,
  35425. k = 0,
  35426. Ctor = x.constructor,
  35427. rm = Ctor.rounding,
  35428. pr = Ctor.precision;
  35429. // 0/NaN/Infinity?
  35430. if (!x.d || !x.d[0] || x.e > 17) {
  35431. return new Ctor(x.d ? !x.d[0] ? 1 : x.s < 0 ? 0 : 1 / 0 : x.s ? x.s < 0 ? 0 : x : 0 / 0);
  35432. }
  35433. if (sd == null) {
  35434. external = false;
  35435. wpr = pr;
  35436. } else {
  35437. wpr = sd;
  35438. }
  35439. t = new Ctor(0.03125);
  35440. // while abs(x) >= 0.1
  35441. while (x.e > -2) {
  35442. // x = x / 2^5
  35443. x = x.times(t);
  35444. k += 5;
  35445. }
  35446. // Use 2 * log10(2^k) + 5 (empirically derived) to estimate the increase in precision
  35447. // necessary to ensure the first 4 rounding digits are correct.
  35448. guard = Math.log(mathpow(2, k)) / Math.LN10 * 2 + 5 | 0;
  35449. wpr += guard;
  35450. denominator = pow = sum = new Ctor(1);
  35451. Ctor.precision = wpr;
  35452. for (;;) {
  35453. pow = finalise(pow.times(x), wpr, 1);
  35454. denominator = denominator.times(++i);
  35455. t = sum.plus(divide(pow, denominator, wpr, 1));
  35456. if (digitsToString(t.d).slice(0, wpr) === digitsToString(sum.d).slice(0, wpr)) {
  35457. j = k;
  35458. while (j--) {
  35459. sum = finalise(sum.times(sum), wpr, 1);
  35460. } // Check to see if the first 4 rounding digits are [49]999.
  35461. // If so, repeat the summation with a higher precision, otherwise
  35462. // e.g. with precision: 18, rounding: 1
  35463. // exp(18.404272462595034083567793919843761) = 98372560.1229999999 (should be 98372560.123)
  35464. // `wpr - guard` is the index of first rounding digit.
  35465. if (sd == null) {
  35466. if (rep < 3 && checkRoundingDigits(sum.d, wpr - guard, rm, rep)) {
  35467. Ctor.precision = wpr += 10;
  35468. denominator = pow = t = new Ctor(1);
  35469. i = 0;
  35470. rep++;
  35471. } else {
  35472. return finalise(sum, Ctor.precision = pr, rm, external = true);
  35473. }
  35474. } else {
  35475. Ctor.precision = pr;
  35476. return sum;
  35477. }
  35478. }
  35479. sum = t;
  35480. }
  35481. }
  35482. /*
  35483. * Return a new Decimal whose value is the natural logarithm of `x` rounded to `sd` significant
  35484. * digits.
  35485. *
  35486. * ln(-n) = NaN
  35487. * ln(0) = -Infinity
  35488. * ln(-0) = -Infinity
  35489. * ln(1) = 0
  35490. * ln(Infinity) = Infinity
  35491. * ln(-Infinity) = NaN
  35492. * ln(NaN) = NaN
  35493. *
  35494. * ln(n) (n != 1) is non-terminating.
  35495. *
  35496. */
  35497. function naturalLogarithm(y, sd) {
  35498. var c,
  35499. c0,
  35500. denominator,
  35501. e,
  35502. numerator,
  35503. rep,
  35504. sum,
  35505. t,
  35506. wpr,
  35507. x1,
  35508. x2,
  35509. n = 1,
  35510. guard = 10,
  35511. x = y,
  35512. xd = x.d,
  35513. Ctor = x.constructor,
  35514. rm = Ctor.rounding,
  35515. pr = Ctor.precision;
  35516. // Is x negative or Infinity, NaN, 0 or 1?
  35517. if (x.s < 0 || !xd || !xd[0] || !x.e && xd[0] == 1 && xd.length == 1) {
  35518. return new Ctor(xd && !xd[0] ? -1 / 0 : x.s != 1 ? NaN : xd ? 0 : x);
  35519. }
  35520. if (sd == null) {
  35521. external = false;
  35522. wpr = pr;
  35523. } else {
  35524. wpr = sd;
  35525. }
  35526. Ctor.precision = wpr += guard;
  35527. c = digitsToString(xd);
  35528. c0 = c.charAt(0);
  35529. if (Math.abs(e = x.e) < 1.5e15) {
  35530. // Argument reduction.
  35531. // The series converges faster the closer the argument is to 1, so using
  35532. // ln(a^b) = b * ln(a), ln(a) = ln(a^b) / b
  35533. // multiply the argument by itself until the leading digits of the significand are 7, 8, 9,
  35534. // 10, 11, 12 or 13, recording the number of multiplications so the sum of the series can
  35535. // later be divided by this number, then separate out the power of 10 using
  35536. // ln(a*10^b) = ln(a) + b*ln(10).
  35537. // max n is 21 (gives 0.9, 1.0 or 1.1) (9e15 / 21 = 4.2e14).
  35538. //while (c0 < 9 && c0 != 1 || c0 == 1 && c.charAt(1) > 1) {
  35539. // max n is 6 (gives 0.7 - 1.3)
  35540. while (c0 < 7 && c0 != 1 || c0 == 1 && c.charAt(1) > 3) {
  35541. x = x.times(y);
  35542. c = digitsToString(x.d);
  35543. c0 = c.charAt(0);
  35544. n++;
  35545. }
  35546. e = x.e;
  35547. if (c0 > 1) {
  35548. x = new Ctor('0.' + c);
  35549. e++;
  35550. } else {
  35551. x = new Ctor(c0 + '.' + c.slice(1));
  35552. }
  35553. } else {
  35554. // The argument reduction method above may result in overflow if the argument y is a massive
  35555. // number with exponent >= 1500000000000000 (9e15 / 6 = 1.5e15), so instead recall this
  35556. // function using ln(x*10^e) = ln(x) + e*ln(10).
  35557. t = getLn10(Ctor, wpr + 2, pr).times(e + '');
  35558. x = naturalLogarithm(new Ctor(c0 + '.' + c.slice(1)), wpr - guard).plus(t);
  35559. Ctor.precision = pr;
  35560. return sd == null ? finalise(x, pr, rm, external = true) : x;
  35561. }
  35562. // x1 is x reduced to a value near 1.
  35563. x1 = x;
  35564. // Taylor series.
  35565. // ln(y) = ln((1 + x)/(1 - x)) = 2(x + x^3/3 + x^5/5 + x^7/7 + ...)
  35566. // where x = (y - 1)/(y + 1) (|x| < 1)
  35567. sum = numerator = x = divide(x.minus(1), x.plus(1), wpr, 1);
  35568. x2 = finalise(x.times(x), wpr, 1);
  35569. denominator = 3;
  35570. for (;;) {
  35571. numerator = finalise(numerator.times(x2), wpr, 1);
  35572. t = sum.plus(divide(numerator, new Ctor(denominator), wpr, 1));
  35573. if (digitsToString(t.d).slice(0, wpr) === digitsToString(sum.d).slice(0, wpr)) {
  35574. sum = sum.times(2);
  35575. // Reverse the argument reduction. Check that e is not 0 because, besides preventing an
  35576. // unnecessary calculation, -0 + 0 = +0 and to ensure correct rounding -0 needs to stay -0.
  35577. if (e !== 0) sum = sum.plus(getLn10(Ctor, wpr + 2, pr).times(e + ''));
  35578. sum = divide(sum, new Ctor(n), wpr, 1);
  35579. // Is rm > 3 and the first 4 rounding digits 4999, or rm < 4 (or the summation has
  35580. // been repeated previously) and the first 4 rounding digits 9999?
  35581. // If so, restart the summation with a higher precision, otherwise
  35582. // e.g. with precision: 12, rounding: 1
  35583. // ln(135520028.6126091714265381533) = 18.7246299999 when it should be 18.72463.
  35584. // `wpr - guard` is the index of first rounding digit.
  35585. if (sd == null) {
  35586. if (checkRoundingDigits(sum.d, wpr - guard, rm, rep)) {
  35587. Ctor.precision = wpr += guard;
  35588. t = numerator = x = divide(x1.minus(1), x1.plus(1), wpr, 1);
  35589. x2 = finalise(x.times(x), wpr, 1);
  35590. denominator = rep = 1;
  35591. } else {
  35592. return finalise(sum, Ctor.precision = pr, rm, external = true);
  35593. }
  35594. } else {
  35595. Ctor.precision = pr;
  35596. return sum;
  35597. }
  35598. }
  35599. sum = t;
  35600. denominator += 2;
  35601. }
  35602. }
  35603. // ±Infinity, NaN.
  35604. function nonFiniteToString(x) {
  35605. // Unsigned.
  35606. return String(x.s * x.s / 0);
  35607. }
  35608. /*
  35609. * Parse the value of a new Decimal `x` from string `str`.
  35610. */
  35611. function parseDecimal(x, str) {
  35612. var e, i, len;
  35613. // Decimal point?
  35614. if ((e = str.indexOf('.')) > -1) str = str.replace('.', '');
  35615. // Exponential form?
  35616. if ((i = str.search(/e/i)) > 0) {
  35617. // Determine exponent.
  35618. if (e < 0) e = i;
  35619. e += +str.slice(i + 1);
  35620. str = str.substring(0, i);
  35621. } else if (e < 0) {
  35622. // Integer.
  35623. e = str.length;
  35624. }
  35625. // Determine leading zeros.
  35626. for (i = 0; str.charCodeAt(i) === 48; i++) {}
  35627. // Determine trailing zeros.
  35628. for (len = str.length; str.charCodeAt(len - 1) === 48; --len) {}
  35629. str = str.slice(i, len);
  35630. if (str) {
  35631. len -= i;
  35632. x.e = e = e - i - 1;
  35633. x.d = [];
  35634. // Transform base
  35635. // e is the base 10 exponent.
  35636. // i is where to slice str to get the first word of the digits array.
  35637. i = (e + 1) % LOG_BASE;
  35638. if (e < 0) i += LOG_BASE;
  35639. if (i < len) {
  35640. if (i) x.d.push(+str.slice(0, i));
  35641. for (len -= LOG_BASE; i < len;) {
  35642. x.d.push(+str.slice(i, i += LOG_BASE));
  35643. }str = str.slice(i);
  35644. i = LOG_BASE - str.length;
  35645. } else {
  35646. i -= len;
  35647. }
  35648. for (; i--;) {
  35649. str += '0';
  35650. }x.d.push(+str);
  35651. if (external) {
  35652. // Overflow?
  35653. if (x.e > x.constructor.maxE) {
  35654. // Infinity.
  35655. x.d = null;
  35656. x.e = NaN;
  35657. // Underflow?
  35658. } else if (x.e < x.constructor.minE) {
  35659. // Zero.
  35660. x.e = 0;
  35661. x.d = [0];
  35662. // x.constructor.underflow = true;
  35663. } // else x.constructor.underflow = false;
  35664. }
  35665. } else {
  35666. // Zero.
  35667. x.e = 0;
  35668. x.d = [0];
  35669. }
  35670. return x;
  35671. }
  35672. /*
  35673. * Parse the value of a new Decimal `x` from a string `str`, which is not a decimal value.
  35674. */
  35675. function parseOther(x, str) {
  35676. var base, Ctor, divisor, i, isFloat, len, p, xd, xe;
  35677. if (str === 'Infinity' || str === 'NaN') {
  35678. if (!+str) x.s = NaN;
  35679. x.e = NaN;
  35680. x.d = null;
  35681. return x;
  35682. }
  35683. if (isHex.test(str)) {
  35684. base = 16;
  35685. str = str.toLowerCase();
  35686. } else if (isBinary.test(str)) {
  35687. base = 2;
  35688. } else if (isOctal.test(str)) {
  35689. base = 8;
  35690. } else {
  35691. throw Error(invalidArgument + str);
  35692. }
  35693. // Is there a binary exponent part?
  35694. i = str.search(/p/i);
  35695. if (i > 0) {
  35696. p = +str.slice(i + 1);
  35697. str = str.substring(2, i);
  35698. } else {
  35699. str = str.slice(2);
  35700. }
  35701. // Convert `str` as an integer then divide the result by `base` raised to a power such that the
  35702. // fraction part will be restored.
  35703. i = str.indexOf('.');
  35704. isFloat = i >= 0;
  35705. Ctor = x.constructor;
  35706. if (isFloat) {
  35707. str = str.replace('.', '');
  35708. len = str.length;
  35709. i = len - i;
  35710. // log[10](16) = 1.2041... , log[10](88) = 1.9444....
  35711. divisor = intPow(Ctor, new Ctor(base), i, i * 2);
  35712. }
  35713. xd = convertBase(str, base, BASE);
  35714. xe = xd.length - 1;
  35715. // Remove trailing zeros.
  35716. for (i = xe; xd[i] === 0; --i) {
  35717. xd.pop();
  35718. }if (i < 0) return new Ctor(x.s * 0);
  35719. x.e = getBase10Exponent(xd, xe);
  35720. x.d = xd;
  35721. external = false;
  35722. // At what precision to perform the division to ensure exact conversion?
  35723. // maxDecimalIntegerPartDigitCount = ceil(log[10](b) * otherBaseIntegerPartDigitCount)
  35724. // log[10](2) = 0.30103, log[10](8) = 0.90309, log[10](16) = 1.20412
  35725. // E.g. ceil(1.2 * 3) = 4, so up to 4 decimal digits are needed to represent 3 hex int digits.
  35726. // maxDecimalFractionPartDigitCount = {Hex:4|Oct:3|Bin:1} * otherBaseFractionPartDigitCount
  35727. // Therefore using 4 * the number of digits of str will always be enough.
  35728. if (isFloat) x = divide(x, divisor, len * 4);
  35729. // Multiply by the binary exponent part if present.
  35730. if (p) x = x.times(Math.abs(p) < 54 ? Math.pow(2, p) : Decimal.pow(2, p));
  35731. external = true;
  35732. return x;
  35733. }
  35734. /*
  35735. * sin(x) = x - x^3/3! + x^5/5! - ...
  35736. * |x| < pi/2
  35737. *
  35738. */
  35739. function sine(Ctor, x) {
  35740. var k,
  35741. len = x.d.length;
  35742. if (len < 3) return taylorSeries(Ctor, 2, x, x);
  35743. // Argument reduction: sin(5x) = 16*sin^5(x) - 20*sin^3(x) + 5*sin(x)
  35744. // i.e. sin(x) = 16*sin^5(x/5) - 20*sin^3(x/5) + 5*sin(x/5)
  35745. // and sin(x) = sin(x/5)(5 + sin^2(x/5)(16sin^2(x/5) - 20))
  35746. // Estimate the optimum number of times to use the argument reduction.
  35747. k = 1.4 * Math.sqrt(len);
  35748. k = k > 16 ? 16 : k | 0;
  35749. // Max k before Math.pow precision loss is 22
  35750. x = x.times(Math.pow(5, -k));
  35751. x = taylorSeries(Ctor, 2, x, x);
  35752. // Reverse argument reduction
  35753. var sin2_x,
  35754. d5 = new Ctor(5),
  35755. d16 = new Ctor(16),
  35756. d20 = new Ctor(20);
  35757. for (; k--;) {
  35758. sin2_x = x.times(x);
  35759. x = x.times(d5.plus(sin2_x.times(d16.times(sin2_x).minus(d20))));
  35760. }
  35761. return x;
  35762. }
  35763. // Calculate Taylor series for `cos`, `cosh`, `sin` and `sinh`.
  35764. function taylorSeries(Ctor, n, x, y, isHyperbolic) {
  35765. var j,
  35766. t,
  35767. u,
  35768. x2,
  35769. i = 1,
  35770. pr = Ctor.precision,
  35771. k = Math.ceil(pr / LOG_BASE);
  35772. external = false;
  35773. x2 = x.times(x);
  35774. u = new Ctor(y);
  35775. for (;;) {
  35776. t = divide(u.times(x2), new Ctor(n++ * n++), pr, 1);
  35777. u = isHyperbolic ? y.plus(t) : y.minus(t);
  35778. y = divide(t.times(x2), new Ctor(n++ * n++), pr, 1);
  35779. t = u.plus(y);
  35780. if (t.d[k] !== void 0) {
  35781. for (j = k; t.d[j] === u.d[j] && j--;) {}
  35782. if (j == -1) break;
  35783. }
  35784. j = u;
  35785. u = y;
  35786. y = t;
  35787. t = j;
  35788. i++;
  35789. }
  35790. external = true;
  35791. t.d.length = k + 1;
  35792. return t;
  35793. }
  35794. // Return the absolute value of `x` reduced to less than or equal to half pi.
  35795. function toLessThanHalfPi(Ctor, x) {
  35796. var t,
  35797. isNeg = x.s < 0,
  35798. pi = getPi(Ctor, Ctor.precision, 1),
  35799. halfPi = pi.times(0.5);
  35800. x = x.abs();
  35801. if (x.lte(halfPi)) {
  35802. quadrant = isNeg ? 4 : 1;
  35803. return x;
  35804. }
  35805. t = x.divToInt(pi);
  35806. if (t.isZero()) {
  35807. quadrant = isNeg ? 3 : 2;
  35808. } else {
  35809. x = x.minus(t.times(pi));
  35810. // 0 <= x < pi
  35811. if (x.lte(halfPi)) {
  35812. quadrant = isOdd(t) ? isNeg ? 2 : 3 : isNeg ? 4 : 1;
  35813. return x;
  35814. }
  35815. quadrant = isOdd(t) ? isNeg ? 1 : 4 : isNeg ? 3 : 2;
  35816. }
  35817. return x.minus(pi).abs();
  35818. }
  35819. /*
  35820. * Return the value of Decimal `x` as a string in base `baseOut`.
  35821. *
  35822. * If the optional `sd` argument is present include a binary exponent suffix.
  35823. */
  35824. function toStringBinary(x, baseOut, sd, rm) {
  35825. var base,
  35826. e,
  35827. i,
  35828. k,
  35829. len,
  35830. roundUp,
  35831. str,
  35832. xd,
  35833. y,
  35834. Ctor = x.constructor,
  35835. isExp = sd !== void 0;
  35836. if (isExp) {
  35837. checkInt32(sd, 1, MAX_DIGITS);
  35838. if (rm === void 0) rm = Ctor.rounding;else checkInt32(rm, 0, 8);
  35839. } else {
  35840. sd = Ctor.precision;
  35841. rm = Ctor.rounding;
  35842. }
  35843. if (!x.isFinite()) {
  35844. str = nonFiniteToString(x);
  35845. } else {
  35846. str = finiteToString(x);
  35847. i = str.indexOf('.');
  35848. // Use exponential notation according to `toExpPos` and `toExpNeg`? No, but if required:
  35849. // maxBinaryExponent = floor((decimalExponent + 1) * log[2](10))
  35850. // minBinaryExponent = floor(decimalExponent * log[2](10))
  35851. // log[2](10) = 3.321928094887362347870319429489390175864
  35852. if (isExp) {
  35853. base = 2;
  35854. if (baseOut == 16) {
  35855. sd = sd * 4 - 3;
  35856. } else if (baseOut == 8) {
  35857. sd = sd * 3 - 2;
  35858. }
  35859. } else {
  35860. base = baseOut;
  35861. }
  35862. // Convert the number as an integer then divide the result by its base raised to a power such
  35863. // that the fraction part will be restored.
  35864. // Non-integer.
  35865. if (i >= 0) {
  35866. str = str.replace('.', '');
  35867. y = new Ctor(1);
  35868. y.e = str.length - i;
  35869. y.d = convertBase(finiteToString(y), 10, base);
  35870. y.e = y.d.length;
  35871. }
  35872. xd = convertBase(str, 10, base);
  35873. e = len = xd.length;
  35874. // Remove trailing zeros.
  35875. for (; xd[--len] == 0;) {
  35876. xd.pop();
  35877. }if (!xd[0]) {
  35878. str = isExp ? '0p+0' : '0';
  35879. } else {
  35880. if (i < 0) {
  35881. e--;
  35882. } else {
  35883. x = new Ctor(x);
  35884. x.d = xd;
  35885. x.e = e;
  35886. x = divide(x, y, sd, rm, 0, base);
  35887. xd = x.d;
  35888. e = x.e;
  35889. roundUp = inexact;
  35890. }
  35891. // The rounding digit, i.e. the digit after the digit that may be rounded up.
  35892. i = xd[sd];
  35893. k = base / 2;
  35894. roundUp = roundUp || xd[sd + 1] !== void 0;
  35895. roundUp = rm < 4 ? (i !== void 0 || roundUp) && (rm === 0 || rm === (x.s < 0 ? 3 : 2)) : i > k || i === k && (rm === 4 || roundUp || rm === 6 && xd[sd - 1] & 1 || rm === (x.s < 0 ? 8 : 7));
  35896. xd.length = sd;
  35897. if (roundUp) {
  35898. // Rounding up may mean the previous digit has to be rounded up and so on.
  35899. for (; ++xd[--sd] > base - 1;) {
  35900. xd[sd] = 0;
  35901. if (!sd) {
  35902. ++e;
  35903. xd.unshift(1);
  35904. }
  35905. }
  35906. }
  35907. // Determine trailing zeros.
  35908. for (len = xd.length; !xd[len - 1]; --len) {}
  35909. // E.g. [4, 11, 15] becomes 4bf.
  35910. for (i = 0, str = ''; i < len; i++) {
  35911. str += NUMERALS.charAt(xd[i]);
  35912. } // Add binary exponent suffix?
  35913. if (isExp) {
  35914. if (len > 1) {
  35915. if (baseOut == 16 || baseOut == 8) {
  35916. i = baseOut == 16 ? 4 : 3;
  35917. for (--len; len % i; len++) {
  35918. str += '0';
  35919. }xd = convertBase(str, base, baseOut);
  35920. for (len = xd.length; !xd[len - 1]; --len) {}
  35921. // xd[0] will always be be 1
  35922. for (i = 1, str = '1.'; i < len; i++) {
  35923. str += NUMERALS.charAt(xd[i]);
  35924. }
  35925. } else {
  35926. str = str.charAt(0) + '.' + str.slice(1);
  35927. }
  35928. }
  35929. str = str + (e < 0 ? 'p' : 'p+') + e;
  35930. } else if (e < 0) {
  35931. for (; ++e;) {
  35932. str = '0' + str;
  35933. }str = '0.' + str;
  35934. } else {
  35935. if (++e > len) for (e -= len; e--;) {
  35936. str += '0';
  35937. } else if (e < len) str = str.slice(0, e) + '.' + str.slice(e);
  35938. }
  35939. }
  35940. str = (baseOut == 16 ? '0x' : baseOut == 2 ? '0b' : baseOut == 8 ? '0o' : '') + str;
  35941. }
  35942. return x.s < 0 ? '-' + str : str;
  35943. }
  35944. // Does not strip trailing zeros.
  35945. function truncate(arr, len) {
  35946. if (arr.length > len) {
  35947. arr.length = len;
  35948. return true;
  35949. }
  35950. }
  35951. // Decimal methods
  35952. /*
  35953. * abs
  35954. * acos
  35955. * acosh
  35956. * add
  35957. * asin
  35958. * asinh
  35959. * atan
  35960. * atanh
  35961. * atan2
  35962. * cbrt
  35963. * ceil
  35964. * clone
  35965. * config
  35966. * cos
  35967. * cosh
  35968. * div
  35969. * exp
  35970. * floor
  35971. * hypot
  35972. * ln
  35973. * log
  35974. * log2
  35975. * log10
  35976. * max
  35977. * min
  35978. * mod
  35979. * mul
  35980. * pow
  35981. * random
  35982. * round
  35983. * set
  35984. * sign
  35985. * sin
  35986. * sinh
  35987. * sqrt
  35988. * sub
  35989. * tan
  35990. * tanh
  35991. * trunc
  35992. */
  35993. /*
  35994. * Return a new Decimal whose value is the absolute value of `x`.
  35995. *
  35996. * x {number|string|Decimal}
  35997. *
  35998. */
  35999. function abs(x) {
  36000. return new this(x).abs();
  36001. }
  36002. /*
  36003. * Return a new Decimal whose value is the arccosine in radians of `x`.
  36004. *
  36005. * x {number|string|Decimal}
  36006. *
  36007. */
  36008. function acos(x) {
  36009. return new this(x).acos();
  36010. }
  36011. /*
  36012. * Return a new Decimal whose value is the inverse of the hyperbolic cosine of `x`, rounded to
  36013. * `precision` significant digits using rounding mode `rounding`.
  36014. *
  36015. * x {number|string|Decimal} A value in radians.
  36016. *
  36017. */
  36018. function acosh(x) {
  36019. return new this(x).acosh();
  36020. }
  36021. /*
  36022. * Return a new Decimal whose value is the sum of `x` and `y`, rounded to `precision` significant
  36023. * digits using rounding mode `rounding`.
  36024. *
  36025. * x {number|string|Decimal}
  36026. * y {number|string|Decimal}
  36027. *
  36028. */
  36029. function add(x, y) {
  36030. return new this(x).plus(y);
  36031. }
  36032. /*
  36033. * Return a new Decimal whose value is the arcsine in radians of `x`, rounded to `precision`
  36034. * significant digits using rounding mode `rounding`.
  36035. *
  36036. * x {number|string|Decimal}
  36037. *
  36038. */
  36039. function asin(x) {
  36040. return new this(x).asin();
  36041. }
  36042. /*
  36043. * Return a new Decimal whose value is the inverse of the hyperbolic sine of `x`, rounded to
  36044. * `precision` significant digits using rounding mode `rounding`.
  36045. *
  36046. * x {number|string|Decimal} A value in radians.
  36047. *
  36048. */
  36049. function asinh(x) {
  36050. return new this(x).asinh();
  36051. }
  36052. /*
  36053. * Return a new Decimal whose value is the arctangent in radians of `x`, rounded to `precision`
  36054. * significant digits using rounding mode `rounding`.
  36055. *
  36056. * x {number|string|Decimal}
  36057. *
  36058. */
  36059. function atan(x) {
  36060. return new this(x).atan();
  36061. }
  36062. /*
  36063. * Return a new Decimal whose value is the inverse of the hyperbolic tangent of `x`, rounded to
  36064. * `precision` significant digits using rounding mode `rounding`.
  36065. *
  36066. * x {number|string|Decimal} A value in radians.
  36067. *
  36068. */
  36069. function atanh(x) {
  36070. return new this(x).atanh();
  36071. }
  36072. /*
  36073. * Return a new Decimal whose value is the arctangent in radians of `y/x` in the range -pi to pi
  36074. * (inclusive), rounded to `precision` significant digits using rounding mode `rounding`.
  36075. *
  36076. * Domain: [-Infinity, Infinity]
  36077. * Range: [-pi, pi]
  36078. *
  36079. * y {number|string|Decimal} The y-coordinate.
  36080. * x {number|string|Decimal} The x-coordinate.
  36081. *
  36082. * atan2(±0, -0) = ±pi
  36083. * atan2(±0, +0) = ±0
  36084. * atan2(±0, -x) = ±pi for x > 0
  36085. * atan2(±0, x) = ±0 for x > 0
  36086. * atan2(-y, ±0) = -pi/2 for y > 0
  36087. * atan2(y, ±0) = pi/2 for y > 0
  36088. * atan2(±y, -Infinity) = ±pi for finite y > 0
  36089. * atan2(±y, +Infinity) = ±0 for finite y > 0
  36090. * atan2(±Infinity, x) = ±pi/2 for finite x
  36091. * atan2(±Infinity, -Infinity) = ±3*pi/4
  36092. * atan2(±Infinity, +Infinity) = ±pi/4
  36093. * atan2(NaN, x) = NaN
  36094. * atan2(y, NaN) = NaN
  36095. *
  36096. */
  36097. function atan2(y, x) {
  36098. y = new this(y);
  36099. x = new this(x);
  36100. var r,
  36101. pr = this.precision,
  36102. rm = this.rounding,
  36103. wpr = pr + 4;
  36104. // Either NaN
  36105. if (!y.s || !x.s) {
  36106. r = new this(NaN);
  36107. // Both ±Infinity
  36108. } else if (!y.d && !x.d) {
  36109. r = getPi(this, wpr, 1).times(x.s > 0 ? 0.25 : 0.75);
  36110. r.s = y.s;
  36111. // x is ±Infinity or y is ±0
  36112. } else if (!x.d || y.isZero()) {
  36113. r = x.s < 0 ? getPi(this, pr, rm) : new this(0);
  36114. r.s = y.s;
  36115. // y is ±Infinity or x is ±0
  36116. } else if (!y.d || x.isZero()) {
  36117. r = getPi(this, wpr, 1).times(0.5);
  36118. r.s = y.s;
  36119. // Both non-zero and finite
  36120. } else if (x.s < 0) {
  36121. this.precision = wpr;
  36122. this.rounding = 1;
  36123. r = this.atan(divide(y, x, wpr, 1));
  36124. x = getPi(this, wpr, 1);
  36125. this.precision = pr;
  36126. this.rounding = rm;
  36127. r = y.s < 0 ? r.minus(x) : r.plus(x);
  36128. } else {
  36129. r = this.atan(divide(y, x, wpr, 1));
  36130. }
  36131. return r;
  36132. }
  36133. /*
  36134. * Return a new Decimal whose value is the cube root of `x`, rounded to `precision` significant
  36135. * digits using rounding mode `rounding`.
  36136. *
  36137. * x {number|string|Decimal}
  36138. *
  36139. */
  36140. function cbrt(x) {
  36141. return new this(x).cbrt();
  36142. }
  36143. /*
  36144. * Return a new Decimal whose value is `x` rounded to an integer using `ROUND_CEIL`.
  36145. *
  36146. * x {number|string|Decimal}
  36147. *
  36148. */
  36149. function ceil(x) {
  36150. return finalise(x = new this(x), x.e + 1, 2);
  36151. }
  36152. /*
  36153. * Configure global settings for a Decimal constructor.
  36154. *
  36155. * `obj` is an object with one or more of the following properties,
  36156. *
  36157. * precision {number}
  36158. * rounding {number}
  36159. * toExpNeg {number}
  36160. * toExpPos {number}
  36161. * maxE {number}
  36162. * minE {number}
  36163. * modulo {number}
  36164. * crypto {boolean|number}
  36165. * defaults {true}
  36166. *
  36167. * E.g. Decimal.config({ precision: 20, rounding: 4 })
  36168. *
  36169. */
  36170. function config(obj) {
  36171. if (!obj || (typeof obj === 'undefined' ? 'undefined' : _typeof(obj)) !== 'object') throw Error(decimalError + 'Object expected');
  36172. var i,
  36173. p,
  36174. v,
  36175. useDefaults = obj.defaults === true,
  36176. ps = ['precision', 1, MAX_DIGITS, 'rounding', 0, 8, 'toExpNeg', -EXP_LIMIT, 0, 'toExpPos', 0, EXP_LIMIT, 'maxE', 0, EXP_LIMIT, 'minE', -EXP_LIMIT, 0, 'modulo', 0, 9];
  36177. for (i = 0; i < ps.length; i += 3) {
  36178. if (p = ps[i], useDefaults) this[p] = DEFAULTS[p];
  36179. if ((v = obj[p]) !== void 0) {
  36180. if (mathfloor(v) === v && v >= ps[i + 1] && v <= ps[i + 2]) this[p] = v;else throw Error(invalidArgument + p + ': ' + v);
  36181. }
  36182. }
  36183. if (p = 'crypto', useDefaults) this[p] = DEFAULTS[p];
  36184. if ((v = obj[p]) !== void 0) {
  36185. if (v === true || v === false || v === 0 || v === 1) {
  36186. if (v) {
  36187. if (typeof crypto != 'undefined' && crypto && (crypto.getRandomValues || crypto.randomBytes)) {
  36188. this[p] = true;
  36189. } else {
  36190. throw Error(cryptoUnavailable);
  36191. }
  36192. } else {
  36193. this[p] = false;
  36194. }
  36195. } else {
  36196. throw Error(invalidArgument + p + ': ' + v);
  36197. }
  36198. }
  36199. return this;
  36200. }
  36201. /*
  36202. * Return a new Decimal whose value is the cosine of `x`, rounded to `precision` significant
  36203. * digits using rounding mode `rounding`.
  36204. *
  36205. * x {number|string|Decimal} A value in radians.
  36206. *
  36207. */
  36208. function cos(x) {
  36209. return new this(x).cos();
  36210. }
  36211. /*
  36212. * Return a new Decimal whose value is the hyperbolic cosine of `x`, rounded to precision
  36213. * significant digits using rounding mode `rounding`.
  36214. *
  36215. * x {number|string|Decimal} A value in radians.
  36216. *
  36217. */
  36218. function cosh(x) {
  36219. return new this(x).cosh();
  36220. }
  36221. /*
  36222. * Create and return a Decimal constructor with the same configuration properties as this Decimal
  36223. * constructor.
  36224. *
  36225. */
  36226. function clone(obj) {
  36227. var i, p, ps;
  36228. /*
  36229. * The Decimal constructor and exported function.
  36230. * Return a new Decimal instance.
  36231. *
  36232. * v {number|string|Decimal} A numeric value.
  36233. *
  36234. */
  36235. function Decimal(v) {
  36236. var e,
  36237. i,
  36238. t,
  36239. x = this;
  36240. // Decimal called without new.
  36241. if (!(x instanceof Decimal)) return new Decimal(v);
  36242. // Retain a reference to this Decimal constructor, and shadow Decimal.prototype.constructor
  36243. // which points to Object.
  36244. x.constructor = Decimal;
  36245. // Duplicate.
  36246. if (v instanceof Decimal) {
  36247. x.s = v.s;
  36248. x.e = v.e;
  36249. x.d = (v = v.d) ? v.slice() : v;
  36250. return;
  36251. }
  36252. t = typeof v === 'undefined' ? 'undefined' : _typeof(v);
  36253. if (t === 'number') {
  36254. if (v === 0) {
  36255. x.s = 1 / v < 0 ? -1 : 1;
  36256. x.e = 0;
  36257. x.d = [0];
  36258. return;
  36259. }
  36260. if (v < 0) {
  36261. v = -v;
  36262. x.s = -1;
  36263. } else {
  36264. x.s = 1;
  36265. }
  36266. // Fast path for small integers.
  36267. if (v === ~~v && v < 1e7) {
  36268. for (e = 0, i = v; i >= 10; i /= 10) {
  36269. e++;
  36270. }x.e = e;
  36271. x.d = [v];
  36272. return;
  36273. // Infinity, NaN.
  36274. } else if (v * 0 !== 0) {
  36275. if (!v) x.s = NaN;
  36276. x.e = NaN;
  36277. x.d = null;
  36278. return;
  36279. }
  36280. return parseDecimal(x, v.toString());
  36281. } else if (t !== 'string') {
  36282. throw Error(invalidArgument + v);
  36283. }
  36284. // Minus sign?
  36285. if (v.charCodeAt(0) === 45) {
  36286. v = v.slice(1);
  36287. x.s = -1;
  36288. } else {
  36289. x.s = 1;
  36290. }
  36291. return isDecimal.test(v) ? parseDecimal(x, v) : parseOther(x, v);
  36292. }
  36293. Decimal.prototype = P;
  36294. Decimal.ROUND_UP = 0;
  36295. Decimal.ROUND_DOWN = 1;
  36296. Decimal.ROUND_CEIL = 2;
  36297. Decimal.ROUND_FLOOR = 3;
  36298. Decimal.ROUND_HALF_UP = 4;
  36299. Decimal.ROUND_HALF_DOWN = 5;
  36300. Decimal.ROUND_HALF_EVEN = 6;
  36301. Decimal.ROUND_HALF_CEIL = 7;
  36302. Decimal.ROUND_HALF_FLOOR = 8;
  36303. Decimal.EUCLID = 9;
  36304. Decimal.config = Decimal.set = config;
  36305. Decimal.clone = clone;
  36306. Decimal.isDecimal = isDecimalInstance;
  36307. Decimal.abs = abs;
  36308. Decimal.acos = acos;
  36309. Decimal.acosh = acosh; // ES6
  36310. Decimal.add = add;
  36311. Decimal.asin = asin;
  36312. Decimal.asinh = asinh; // ES6
  36313. Decimal.atan = atan;
  36314. Decimal.atanh = atanh; // ES6
  36315. Decimal.atan2 = atan2;
  36316. Decimal.cbrt = cbrt; // ES6
  36317. Decimal.ceil = ceil;
  36318. Decimal.cos = cos;
  36319. Decimal.cosh = cosh; // ES6
  36320. Decimal.div = div;
  36321. Decimal.exp = exp;
  36322. Decimal.floor = floor;
  36323. Decimal.hypot = hypot; // ES6
  36324. Decimal.ln = ln;
  36325. Decimal.log = log;
  36326. Decimal.log10 = log10; // ES6
  36327. Decimal.log2 = log2; // ES6
  36328. Decimal.max = max;
  36329. Decimal.min = min;
  36330. Decimal.mod = mod;
  36331. Decimal.mul = mul;
  36332. Decimal.pow = pow;
  36333. Decimal.random = random;
  36334. Decimal.round = round;
  36335. Decimal.sign = sign; // ES6
  36336. Decimal.sin = sin;
  36337. Decimal.sinh = sinh; // ES6
  36338. Decimal.sqrt = sqrt;
  36339. Decimal.sub = sub;
  36340. Decimal.tan = tan;
  36341. Decimal.tanh = tanh; // ES6
  36342. Decimal.trunc = trunc; // ES6
  36343. if (obj === void 0) obj = {};
  36344. if (obj) {
  36345. if (obj.defaults !== true) {
  36346. ps = ['precision', 'rounding', 'toExpNeg', 'toExpPos', 'maxE', 'minE', 'modulo', 'crypto'];
  36347. for (i = 0; i < ps.length;) {
  36348. if (!obj.hasOwnProperty(p = ps[i++])) obj[p] = this[p];
  36349. }
  36350. }
  36351. }
  36352. Decimal.config(obj);
  36353. return Decimal;
  36354. }
  36355. /*
  36356. * Return a new Decimal whose value is `x` divided by `y`, rounded to `precision` significant
  36357. * digits using rounding mode `rounding`.
  36358. *
  36359. * x {number|string|Decimal}
  36360. * y {number|string|Decimal}
  36361. *
  36362. */
  36363. function div(x, y) {
  36364. return new this(x).div(y);
  36365. }
  36366. /*
  36367. * Return a new Decimal whose value is the natural exponential of `x`, rounded to `precision`
  36368. * significant digits using rounding mode `rounding`.
  36369. *
  36370. * x {number|string|Decimal} The power to which to raise the base of the natural log.
  36371. *
  36372. */
  36373. function exp(x) {
  36374. return new this(x).exp();
  36375. }
  36376. /*
  36377. * Return a new Decimal whose value is `x` round to an integer using `ROUND_FLOOR`.
  36378. *
  36379. * x {number|string|Decimal}
  36380. *
  36381. */
  36382. function floor(x) {
  36383. return finalise(x = new this(x), x.e + 1, 3);
  36384. }
  36385. /*
  36386. * Return a new Decimal whose value is the square root of the sum of the squares of the arguments,
  36387. * rounded to `precision` significant digits using rounding mode `rounding`.
  36388. *
  36389. * hypot(a, b, ...) = sqrt(a^2 + b^2 + ...)
  36390. *
  36391. */
  36392. function hypot() {
  36393. var i,
  36394. n,
  36395. t = new this(0);
  36396. external = false;
  36397. for (i = 0; i < arguments.length;) {
  36398. n = new this(arguments[i++]);
  36399. if (!n.d) {
  36400. if (n.s) {
  36401. external = true;
  36402. return new this(1 / 0);
  36403. }
  36404. t = n;
  36405. } else if (t.d) {
  36406. t = t.plus(n.times(n));
  36407. }
  36408. }
  36409. external = true;
  36410. return t.sqrt();
  36411. }
  36412. /*
  36413. * Return true if object is a Decimal instance (where Decimal is any Decimal constructor),
  36414. * otherwise return false.
  36415. *
  36416. */
  36417. function isDecimalInstance(obj) {
  36418. return obj instanceof Decimal || obj && obj.name === '[object Decimal]' || false;
  36419. }
  36420. /*
  36421. * Return a new Decimal whose value is the natural logarithm of `x`, rounded to `precision`
  36422. * significant digits using rounding mode `rounding`.
  36423. *
  36424. * x {number|string|Decimal}
  36425. *
  36426. */
  36427. function ln(x) {
  36428. return new this(x).ln();
  36429. }
  36430. /*
  36431. * Return a new Decimal whose value is the log of `x` to the base `y`, or to base 10 if no base
  36432. * is specified, rounded to `precision` significant digits using rounding mode `rounding`.
  36433. *
  36434. * log[y](x)
  36435. *
  36436. * x {number|string|Decimal} The argument of the logarithm.
  36437. * y {number|string|Decimal} The base of the logarithm.
  36438. *
  36439. */
  36440. function log(x, y) {
  36441. return new this(x).log(y);
  36442. }
  36443. /*
  36444. * Return a new Decimal whose value is the base 2 logarithm of `x`, rounded to `precision`
  36445. * significant digits using rounding mode `rounding`.
  36446. *
  36447. * x {number|string|Decimal}
  36448. *
  36449. */
  36450. function log2(x) {
  36451. return new this(x).log(2);
  36452. }
  36453. /*
  36454. * Return a new Decimal whose value is the base 10 logarithm of `x`, rounded to `precision`
  36455. * significant digits using rounding mode `rounding`.
  36456. *
  36457. * x {number|string|Decimal}
  36458. *
  36459. */
  36460. function log10(x) {
  36461. return new this(x).log(10);
  36462. }
  36463. /*
  36464. * Return a new Decimal whose value is the maximum of the arguments.
  36465. *
  36466. * arguments {number|string|Decimal}
  36467. *
  36468. */
  36469. function max() {
  36470. return maxOrMin(this, arguments, 'lt');
  36471. }
  36472. /*
  36473. * Return a new Decimal whose value is the minimum of the arguments.
  36474. *
  36475. * arguments {number|string|Decimal}
  36476. *
  36477. */
  36478. function min() {
  36479. return maxOrMin(this, arguments, 'gt');
  36480. }
  36481. /*
  36482. * Return a new Decimal whose value is `x` modulo `y`, rounded to `precision` significant digits
  36483. * using rounding mode `rounding`.
  36484. *
  36485. * x {number|string|Decimal}
  36486. * y {number|string|Decimal}
  36487. *
  36488. */
  36489. function mod(x, y) {
  36490. return new this(x).mod(y);
  36491. }
  36492. /*
  36493. * Return a new Decimal whose value is `x` multiplied by `y`, rounded to `precision` significant
  36494. * digits using rounding mode `rounding`.
  36495. *
  36496. * x {number|string|Decimal}
  36497. * y {number|string|Decimal}
  36498. *
  36499. */
  36500. function mul(x, y) {
  36501. return new this(x).mul(y);
  36502. }
  36503. /*
  36504. * Return a new Decimal whose value is `x` raised to the power `y`, rounded to precision
  36505. * significant digits using rounding mode `rounding`.
  36506. *
  36507. * x {number|string|Decimal} The base.
  36508. * y {number|string|Decimal} The exponent.
  36509. *
  36510. */
  36511. function pow(x, y) {
  36512. return new this(x).pow(y);
  36513. }
  36514. /*
  36515. * Returns a new Decimal with a random value equal to or greater than 0 and less than 1, and with
  36516. * `sd`, or `Decimal.precision` if `sd` is omitted, significant digits (or less if trailing zeros
  36517. * are produced).
  36518. *
  36519. * [sd] {number} Significant digits. Integer, 0 to MAX_DIGITS inclusive.
  36520. *
  36521. */
  36522. function random(sd) {
  36523. var d,
  36524. e,
  36525. k,
  36526. n,
  36527. i = 0,
  36528. r = new this(1),
  36529. rd = [];
  36530. if (sd === void 0) sd = this.precision;else checkInt32(sd, 1, MAX_DIGITS);
  36531. k = Math.ceil(sd / LOG_BASE);
  36532. if (!this.crypto) {
  36533. for (; i < k;) {
  36534. rd[i++] = Math.random() * 1e7 | 0;
  36535. } // Browsers supporting crypto.getRandomValues.
  36536. } else if (crypto.getRandomValues) {
  36537. d = crypto.getRandomValues(new Uint32Array(k));
  36538. for (; i < k;) {
  36539. n = d[i];
  36540. // 0 <= n < 4294967296
  36541. // Probability n >= 4.29e9, is 4967296 / 4294967296 = 0.00116 (1 in 865).
  36542. if (n >= 4.29e9) {
  36543. d[i] = crypto.getRandomValues(new Uint32Array(1))[0];
  36544. } else {
  36545. // 0 <= n <= 4289999999
  36546. // 0 <= (n % 1e7) <= 9999999
  36547. rd[i++] = n % 1e7;
  36548. }
  36549. }
  36550. // Node.js supporting crypto.randomBytes.
  36551. } else if (crypto.randomBytes) {
  36552. // buffer
  36553. d = crypto.randomBytes(k *= 4);
  36554. for (; i < k;) {
  36555. // 0 <= n < 2147483648
  36556. n = d[i] + (d[i + 1] << 8) + (d[i + 2] << 16) + ((d[i + 3] & 0x7f) << 24);
  36557. // Probability n >= 2.14e9, is 7483648 / 2147483648 = 0.0035 (1 in 286).
  36558. if (n >= 2.14e9) {
  36559. crypto.randomBytes(4).copy(d, i);
  36560. } else {
  36561. // 0 <= n <= 2139999999
  36562. // 0 <= (n % 1e7) <= 9999999
  36563. rd.push(n % 1e7);
  36564. i += 4;
  36565. }
  36566. }
  36567. i = k / 4;
  36568. } else {
  36569. throw Error(cryptoUnavailable);
  36570. }
  36571. k = rd[--i];
  36572. sd %= LOG_BASE;
  36573. // Convert trailing digits to zeros according to sd.
  36574. if (k && sd) {
  36575. n = mathpow(10, LOG_BASE - sd);
  36576. rd[i] = (k / n | 0) * n;
  36577. }
  36578. // Remove trailing words which are zero.
  36579. for (; rd[i] === 0; i--) {
  36580. rd.pop();
  36581. } // Zero?
  36582. if (i < 0) {
  36583. e = 0;
  36584. rd = [0];
  36585. } else {
  36586. e = -1;
  36587. // Remove leading words which are zero and adjust exponent accordingly.
  36588. for (; rd[0] === 0; e -= LOG_BASE) {
  36589. rd.shift();
  36590. } // Count the digits of the first word of rd to determine leading zeros.
  36591. for (k = 1, n = rd[0]; n >= 10; n /= 10) {
  36592. k++;
  36593. } // Adjust the exponent for leading zeros of the first word of rd.
  36594. if (k < LOG_BASE) e -= LOG_BASE - k;
  36595. }
  36596. r.e = e;
  36597. r.d = rd;
  36598. return r;
  36599. }
  36600. /*
  36601. * Return a new Decimal whose value is `x` rounded to an integer using rounding mode `rounding`.
  36602. *
  36603. * To emulate `Math.round`, set rounding to 7 (ROUND_HALF_CEIL).
  36604. *
  36605. * x {number|string|Decimal}
  36606. *
  36607. */
  36608. function round(x) {
  36609. return finalise(x = new this(x), x.e + 1, this.rounding);
  36610. }
  36611. /*
  36612. * Return
  36613. * 1 if x > 0,
  36614. * -1 if x < 0,
  36615. * 0 if x is 0,
  36616. * -0 if x is -0,
  36617. * NaN otherwise
  36618. *
  36619. */
  36620. function sign(x) {
  36621. x = new this(x);
  36622. return x.d ? x.d[0] ? x.s : 0 * x.s : x.s || NaN;
  36623. }
  36624. /*
  36625. * Return a new Decimal whose value is the sine of `x`, rounded to `precision` significant digits
  36626. * using rounding mode `rounding`.
  36627. *
  36628. * x {number|string|Decimal} A value in radians.
  36629. *
  36630. */
  36631. function sin(x) {
  36632. return new this(x).sin();
  36633. }
  36634. /*
  36635. * Return a new Decimal whose value is the hyperbolic sine of `x`, rounded to `precision`
  36636. * significant digits using rounding mode `rounding`.
  36637. *
  36638. * x {number|string|Decimal} A value in radians.
  36639. *
  36640. */
  36641. function sinh(x) {
  36642. return new this(x).sinh();
  36643. }
  36644. /*
  36645. * Return a new Decimal whose value is the square root of `x`, rounded to `precision` significant
  36646. * digits using rounding mode `rounding`.
  36647. *
  36648. * x {number|string|Decimal}
  36649. *
  36650. */
  36651. function sqrt(x) {
  36652. return new this(x).sqrt();
  36653. }
  36654. /*
  36655. * Return a new Decimal whose value is `x` minus `y`, rounded to `precision` significant digits
  36656. * using rounding mode `rounding`.
  36657. *
  36658. * x {number|string|Decimal}
  36659. * y {number|string|Decimal}
  36660. *
  36661. */
  36662. function sub(x, y) {
  36663. return new this(x).sub(y);
  36664. }
  36665. /*
  36666. * Return a new Decimal whose value is the tangent of `x`, rounded to `precision` significant
  36667. * digits using rounding mode `rounding`.
  36668. *
  36669. * x {number|string|Decimal} A value in radians.
  36670. *
  36671. */
  36672. function tan(x) {
  36673. return new this(x).tan();
  36674. }
  36675. /*
  36676. * Return a new Decimal whose value is the hyperbolic tangent of `x`, rounded to `precision`
  36677. * significant digits using rounding mode `rounding`.
  36678. *
  36679. * x {number|string|Decimal} A value in radians.
  36680. *
  36681. */
  36682. function tanh(x) {
  36683. return new this(x).tanh();
  36684. }
  36685. /*
  36686. * Return a new Decimal whose value is `x` truncated to an integer.
  36687. *
  36688. * x {number|string|Decimal}
  36689. *
  36690. */
  36691. function trunc(x) {
  36692. return finalise(x = new this(x), x.e + 1, 1);
  36693. }
  36694. // Create and configure initial Decimal constructor.
  36695. Decimal = clone(DEFAULTS);
  36696. Decimal['default'] = Decimal.Decimal = Decimal;
  36697. // Create the internal constants from their string values.
  36698. LN10 = new Decimal(LN10);
  36699. PI = new Decimal(PI);
  36700. // Export.
  36701. // AMD.
  36702. if (true) {
  36703. !(__WEBPACK_AMD_DEFINE_RESULT__ = (function () {
  36704. return Decimal;
  36705. }).call(exports, __webpack_require__, exports, module),
  36706. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  36707. // Node and other environments that support module.exports.
  36708. } else {}
  36709. })(undefined);
  36710. /***/ }),
  36711. /***/ "./node_modules/jquery/dist/jquery.js":
  36712. /*!********************************************!*\
  36713. !*** ./node_modules/jquery/dist/jquery.js ***!
  36714. \********************************************/
  36715. /*! no static exports found */
  36716. /***/ (function(module, exports, __webpack_require__) {
  36717. "use strict";
  36718. /* WEBPACK VAR INJECTION */(function(module) {var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;
  36719. var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
  36720. /*!
  36721. * jQuery JavaScript Library v3.3.1
  36722. * https://jquery.com/
  36723. *
  36724. * Includes Sizzle.js
  36725. * https://sizzlejs.com/
  36726. *
  36727. * Copyright JS Foundation and other contributors
  36728. * Released under the MIT license
  36729. * https://jquery.org/license
  36730. *
  36731. * Date: 2018-01-20T17:24Z
  36732. */
  36733. (function (global, factory) {
  36734. "use strict";
  36735. if (( false ? undefined : _typeof(module)) === "object" && _typeof(module.exports) === "object") {
  36736. // For CommonJS and CommonJS-like environments where a proper `window`
  36737. // is present, execute the factory and get jQuery.
  36738. // For environments that do not have a `window` with a `document`
  36739. // (such as Node.js), expose a factory as module.exports.
  36740. // This accentuates the need for the creation of a real `window`.
  36741. // e.g. var jQuery = require("jquery")(window);
  36742. // See ticket #14549 for more info.
  36743. module.exports = global.document ? factory(global, true) : function (w) {
  36744. if (!w.document) {
  36745. throw new Error("jQuery requires a window with a document");
  36746. }
  36747. return factory(w);
  36748. };
  36749. } else {
  36750. factory(global);
  36751. }
  36752. // Pass this if window is not defined yet
  36753. })(typeof window !== "undefined" ? window : undefined, function (window, noGlobal) {
  36754. // Edge <= 12 - 13+, Firefox <=18 - 45+, IE 10 - 11, Safari 5.1 - 9+, iOS 6 - 9.1
  36755. // throw exceptions when non-strict code (e.g., ASP.NET 4.5) accesses strict mode
  36756. // arguments.callee.caller (trac-13335). But as of jQuery 3.0 (2016), strict mode should be common
  36757. // enough that all such attempts are guarded in a try block.
  36758. "use strict";
  36759. var arr = [];
  36760. var document = window.document;
  36761. var getProto = Object.getPrototypeOf;
  36762. var _slice = arr.slice;
  36763. var concat = arr.concat;
  36764. var push = arr.push;
  36765. var indexOf = arr.indexOf;
  36766. var class2type = {};
  36767. var toString = class2type.toString;
  36768. var hasOwn = class2type.hasOwnProperty;
  36769. var fnToString = hasOwn.toString;
  36770. var ObjectFunctionString = fnToString.call(Object);
  36771. var support = {};
  36772. var isFunction = function isFunction(obj) {
  36773. // Support: Chrome <=57, Firefox <=52
  36774. // In some browsers, typeof returns "function" for HTML <object> elements
  36775. // (i.e., `typeof document.createElement( "object" ) === "function"`).
  36776. // We don't want to classify *any* DOM node as a function.
  36777. return typeof obj === "function" && typeof obj.nodeType !== "number";
  36778. };
  36779. var isWindow = function isWindow(obj) {
  36780. return obj != null && obj === obj.window;
  36781. };
  36782. var preservedScriptAttributes = {
  36783. type: true,
  36784. src: true,
  36785. noModule: true
  36786. };
  36787. function DOMEval(code, doc, node) {
  36788. doc = doc || document;
  36789. var i,
  36790. script = doc.createElement("script");
  36791. script.text = code;
  36792. if (node) {
  36793. for (i in preservedScriptAttributes) {
  36794. if (node[i]) {
  36795. script[i] = node[i];
  36796. }
  36797. }
  36798. }
  36799. doc.head.appendChild(script).parentNode.removeChild(script);
  36800. }
  36801. function toType(obj) {
  36802. if (obj == null) {
  36803. return obj + "";
  36804. }
  36805. // Support: Android <=2.3 only (functionish RegExp)
  36806. return (typeof obj === "undefined" ? "undefined" : _typeof(obj)) === "object" || typeof obj === "function" ? class2type[toString.call(obj)] || "object" : typeof obj === "undefined" ? "undefined" : _typeof(obj);
  36807. }
  36808. /* global Symbol */
  36809. // Defining this global in .eslintrc.json would create a danger of using the global
  36810. // unguarded in another place, it seems safer to define global only for this module
  36811. var version = "3.3.1",
  36812. // Define a local copy of jQuery
  36813. jQuery = function jQuery(selector, context) {
  36814. // The jQuery object is actually just the init constructor 'enhanced'
  36815. // Need init if jQuery is called (just allow error to be thrown if not included)
  36816. return new jQuery.fn.init(selector, context);
  36817. },
  36818. // Support: Android <=4.0 only
  36819. // Make sure we trim BOM and NBSP
  36820. rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;
  36821. jQuery.fn = jQuery.prototype = {
  36822. // The current version of jQuery being used
  36823. jquery: version,
  36824. constructor: jQuery,
  36825. // The default length of a jQuery object is 0
  36826. length: 0,
  36827. toArray: function toArray() {
  36828. return _slice.call(this);
  36829. },
  36830. // Get the Nth element in the matched element set OR
  36831. // Get the whole matched element set as a clean array
  36832. get: function get(num) {
  36833. // Return all the elements in a clean array
  36834. if (num == null) {
  36835. return _slice.call(this);
  36836. }
  36837. // Return just the one element from the set
  36838. return num < 0 ? this[num + this.length] : this[num];
  36839. },
  36840. // Take an array of elements and push it onto the stack
  36841. // (returning the new matched element set)
  36842. pushStack: function pushStack(elems) {
  36843. // Build a new jQuery matched element set
  36844. var ret = jQuery.merge(this.constructor(), elems);
  36845. // Add the old object onto the stack (as a reference)
  36846. ret.prevObject = this;
  36847. // Return the newly-formed element set
  36848. return ret;
  36849. },
  36850. // Execute a callback for every element in the matched set.
  36851. each: function each(callback) {
  36852. return jQuery.each(this, callback);
  36853. },
  36854. map: function map(callback) {
  36855. return this.pushStack(jQuery.map(this, function (elem, i) {
  36856. return callback.call(elem, i, elem);
  36857. }));
  36858. },
  36859. slice: function slice() {
  36860. return this.pushStack(_slice.apply(this, arguments));
  36861. },
  36862. first: function first() {
  36863. return this.eq(0);
  36864. },
  36865. last: function last() {
  36866. return this.eq(-1);
  36867. },
  36868. eq: function eq(i) {
  36869. var len = this.length,
  36870. j = +i + (i < 0 ? len : 0);
  36871. return this.pushStack(j >= 0 && j < len ? [this[j]] : []);
  36872. },
  36873. end: function end() {
  36874. return this.prevObject || this.constructor();
  36875. },
  36876. // For internal use only.
  36877. // Behaves like an Array's method, not like a jQuery method.
  36878. push: push,
  36879. sort: arr.sort,
  36880. splice: arr.splice
  36881. };
  36882. jQuery.extend = jQuery.fn.extend = function () {
  36883. var options,
  36884. name,
  36885. src,
  36886. copy,
  36887. copyIsArray,
  36888. clone,
  36889. target = arguments[0] || {},
  36890. i = 1,
  36891. length = arguments.length,
  36892. deep = false;
  36893. // Handle a deep copy situation
  36894. if (typeof target === "boolean") {
  36895. deep = target;
  36896. // Skip the boolean and the target
  36897. target = arguments[i] || {};
  36898. i++;
  36899. }
  36900. // Handle case when target is a string or something (possible in deep copy)
  36901. if ((typeof target === "undefined" ? "undefined" : _typeof(target)) !== "object" && !isFunction(target)) {
  36902. target = {};
  36903. }
  36904. // Extend jQuery itself if only one argument is passed
  36905. if (i === length) {
  36906. target = this;
  36907. i--;
  36908. }
  36909. for (; i < length; i++) {
  36910. // Only deal with non-null/undefined values
  36911. if ((options = arguments[i]) != null) {
  36912. // Extend the base object
  36913. for (name in options) {
  36914. src = target[name];
  36915. copy = options[name];
  36916. // Prevent never-ending loop
  36917. if (target === copy) {
  36918. continue;
  36919. }
  36920. // Recurse if we're merging plain objects or arrays
  36921. if (deep && copy && (jQuery.isPlainObject(copy) || (copyIsArray = Array.isArray(copy)))) {
  36922. if (copyIsArray) {
  36923. copyIsArray = false;
  36924. clone = src && Array.isArray(src) ? src : [];
  36925. } else {
  36926. clone = src && jQuery.isPlainObject(src) ? src : {};
  36927. }
  36928. // Never move original objects, clone them
  36929. target[name] = jQuery.extend(deep, clone, copy);
  36930. // Don't bring in undefined values
  36931. } else if (copy !== undefined) {
  36932. target[name] = copy;
  36933. }
  36934. }
  36935. }
  36936. }
  36937. // Return the modified object
  36938. return target;
  36939. };
  36940. jQuery.extend({
  36941. // Unique for each copy of jQuery on the page
  36942. expando: "jQuery" + (version + Math.random()).replace(/\D/g, ""),
  36943. // Assume jQuery is ready without the ready module
  36944. isReady: true,
  36945. error: function error(msg) {
  36946. throw new Error(msg);
  36947. },
  36948. noop: function noop() {},
  36949. isPlainObject: function isPlainObject(obj) {
  36950. var proto, Ctor;
  36951. // Detect obvious negatives
  36952. // Use toString instead of jQuery.type to catch host objects
  36953. if (!obj || toString.call(obj) !== "[object Object]") {
  36954. return false;
  36955. }
  36956. proto = getProto(obj);
  36957. // Objects with no prototype (e.g., `Object.create( null )`) are plain
  36958. if (!proto) {
  36959. return true;
  36960. }
  36961. // Objects with prototype are plain iff they were constructed by a global Object function
  36962. Ctor = hasOwn.call(proto, "constructor") && proto.constructor;
  36963. return typeof Ctor === "function" && fnToString.call(Ctor) === ObjectFunctionString;
  36964. },
  36965. isEmptyObject: function isEmptyObject(obj) {
  36966. /* eslint-disable no-unused-vars */
  36967. // See https://github.com/eslint/eslint/issues/6125
  36968. var name;
  36969. for (name in obj) {
  36970. return false;
  36971. }
  36972. return true;
  36973. },
  36974. // Evaluates a script in a global context
  36975. globalEval: function globalEval(code) {
  36976. DOMEval(code);
  36977. },
  36978. each: function each(obj, callback) {
  36979. var length,
  36980. i = 0;
  36981. if (isArrayLike(obj)) {
  36982. length = obj.length;
  36983. for (; i < length; i++) {
  36984. if (callback.call(obj[i], i, obj[i]) === false) {
  36985. break;
  36986. }
  36987. }
  36988. } else {
  36989. for (i in obj) {
  36990. if (callback.call(obj[i], i, obj[i]) === false) {
  36991. break;
  36992. }
  36993. }
  36994. }
  36995. return obj;
  36996. },
  36997. // Support: Android <=4.0 only
  36998. trim: function trim(text) {
  36999. return text == null ? "" : (text + "").replace(rtrim, "");
  37000. },
  37001. // results is for internal usage only
  37002. makeArray: function makeArray(arr, results) {
  37003. var ret = results || [];
  37004. if (arr != null) {
  37005. if (isArrayLike(Object(arr))) {
  37006. jQuery.merge(ret, typeof arr === "string" ? [arr] : arr);
  37007. } else {
  37008. push.call(ret, arr);
  37009. }
  37010. }
  37011. return ret;
  37012. },
  37013. inArray: function inArray(elem, arr, i) {
  37014. return arr == null ? -1 : indexOf.call(arr, elem, i);
  37015. },
  37016. // Support: Android <=4.0 only, PhantomJS 1 only
  37017. // push.apply(_, arraylike) throws on ancient WebKit
  37018. merge: function merge(first, second) {
  37019. var len = +second.length,
  37020. j = 0,
  37021. i = first.length;
  37022. for (; j < len; j++) {
  37023. first[i++] = second[j];
  37024. }
  37025. first.length = i;
  37026. return first;
  37027. },
  37028. grep: function grep(elems, callback, invert) {
  37029. var callbackInverse,
  37030. matches = [],
  37031. i = 0,
  37032. length = elems.length,
  37033. callbackExpect = !invert;
  37034. // Go through the array, only saving the items
  37035. // that pass the validator function
  37036. for (; i < length; i++) {
  37037. callbackInverse = !callback(elems[i], i);
  37038. if (callbackInverse !== callbackExpect) {
  37039. matches.push(elems[i]);
  37040. }
  37041. }
  37042. return matches;
  37043. },
  37044. // arg is for internal usage only
  37045. map: function map(elems, callback, arg) {
  37046. var length,
  37047. value,
  37048. i = 0,
  37049. ret = [];
  37050. // Go through the array, translating each of the items to their new values
  37051. if (isArrayLike(elems)) {
  37052. length = elems.length;
  37053. for (; i < length; i++) {
  37054. value = callback(elems[i], i, arg);
  37055. if (value != null) {
  37056. ret.push(value);
  37057. }
  37058. }
  37059. // Go through every key on the object,
  37060. } else {
  37061. for (i in elems) {
  37062. value = callback(elems[i], i, arg);
  37063. if (value != null) {
  37064. ret.push(value);
  37065. }
  37066. }
  37067. }
  37068. // Flatten any nested arrays
  37069. return concat.apply([], ret);
  37070. },
  37071. // A global GUID counter for objects
  37072. guid: 1,
  37073. // jQuery.support is not used in Core but other projects attach their
  37074. // properties to it so it needs to exist.
  37075. support: support
  37076. });
  37077. if (typeof Symbol === "function") {
  37078. jQuery.fn[Symbol.iterator] = arr[Symbol.iterator];
  37079. }
  37080. // Populate the class2type map
  37081. jQuery.each("Boolean Number String Function Array Date RegExp Object Error Symbol".split(" "), function (i, name) {
  37082. class2type["[object " + name + "]"] = name.toLowerCase();
  37083. });
  37084. function isArrayLike(obj) {
  37085. // Support: real iOS 8.2 only (not reproducible in simulator)
  37086. // `in` check used to prevent JIT error (gh-2145)
  37087. // hasOwn isn't used here due to false negatives
  37088. // regarding Nodelist length in IE
  37089. var length = !!obj && "length" in obj && obj.length,
  37090. type = toType(obj);
  37091. if (isFunction(obj) || isWindow(obj)) {
  37092. return false;
  37093. }
  37094. return type === "array" || length === 0 || typeof length === "number" && length > 0 && length - 1 in obj;
  37095. }
  37096. var Sizzle =
  37097. /*!
  37098. * Sizzle CSS Selector Engine v2.3.3
  37099. * https://sizzlejs.com/
  37100. *
  37101. * Copyright jQuery Foundation and other contributors
  37102. * Released under the MIT license
  37103. * http://jquery.org/license
  37104. *
  37105. * Date: 2016-08-08
  37106. */
  37107. function (window) {
  37108. var i,
  37109. support,
  37110. Expr,
  37111. getText,
  37112. isXML,
  37113. tokenize,
  37114. compile,
  37115. select,
  37116. outermostContext,
  37117. sortInput,
  37118. hasDuplicate,
  37119. // Local document vars
  37120. setDocument,
  37121. document,
  37122. docElem,
  37123. documentIsHTML,
  37124. rbuggyQSA,
  37125. rbuggyMatches,
  37126. matches,
  37127. contains,
  37128. // Instance-specific data
  37129. expando = "sizzle" + 1 * new Date(),
  37130. preferredDoc = window.document,
  37131. dirruns = 0,
  37132. done = 0,
  37133. classCache = createCache(),
  37134. tokenCache = createCache(),
  37135. compilerCache = createCache(),
  37136. sortOrder = function sortOrder(a, b) {
  37137. if (a === b) {
  37138. hasDuplicate = true;
  37139. }
  37140. return 0;
  37141. },
  37142. // Instance methods
  37143. hasOwn = {}.hasOwnProperty,
  37144. arr = [],
  37145. pop = arr.pop,
  37146. push_native = arr.push,
  37147. push = arr.push,
  37148. slice = arr.slice,
  37149. // Use a stripped-down indexOf as it's faster than native
  37150. // https://jsperf.com/thor-indexof-vs-for/5
  37151. indexOf = function indexOf(list, elem) {
  37152. var i = 0,
  37153. len = list.length;
  37154. for (; i < len; i++) {
  37155. if (list[i] === elem) {
  37156. return i;
  37157. }
  37158. }
  37159. return -1;
  37160. },
  37161. booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",
  37162. // Regular expressions
  37163. // http://www.w3.org/TR/css3-selectors/#whitespace
  37164. whitespace = "[\\x20\\t\\r\\n\\f]",
  37165. // http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier
  37166. identifier = "(?:\\\\.|[\\w-]|[^\0-\\xa0])+",
  37167. // Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors
  37168. attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace +
  37169. // Operator (capture 2)
  37170. "*([*^$|!~]?=)" + whitespace +
  37171. // "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]"
  37172. "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + whitespace + "*\\]",
  37173. pseudos = ":(" + identifier + ")(?:\\((" +
  37174. // To reduce the number of selectors needing tokenize in the preFilter, prefer arguments:
  37175. // 1. quoted (capture 3; capture 4 or capture 5)
  37176. "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" +
  37177. // 2. simple (capture 6)
  37178. "((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" +
  37179. // 3. anything else (capture 2)
  37180. ".*" + ")\\)|)",
  37181. // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter
  37182. rwhitespace = new RegExp(whitespace + "+", "g"),
  37183. rtrim = new RegExp("^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g"),
  37184. rcomma = new RegExp("^" + whitespace + "*," + whitespace + "*"),
  37185. rcombinators = new RegExp("^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*"),
  37186. rattributeQuotes = new RegExp("=" + whitespace + "*([^\\]'\"]*?)" + whitespace + "*\\]", "g"),
  37187. rpseudo = new RegExp(pseudos),
  37188. ridentifier = new RegExp("^" + identifier + "$"),
  37189. matchExpr = {
  37190. "ID": new RegExp("^#(" + identifier + ")"),
  37191. "CLASS": new RegExp("^\\.(" + identifier + ")"),
  37192. "TAG": new RegExp("^(" + identifier + "|[*])"),
  37193. "ATTR": new RegExp("^" + attributes),
  37194. "PSEUDO": new RegExp("^" + pseudos),
  37195. "CHILD": new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace + "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace + "*(\\d+)|))" + whitespace + "*\\)|)", "i"),
  37196. "bool": new RegExp("^(?:" + booleans + ")$", "i"),
  37197. // For use in libraries implementing .is()
  37198. // We use this for POS matching in `select`
  37199. "needsContext": new RegExp("^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" + whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i")
  37200. },
  37201. rinputs = /^(?:input|select|textarea|button)$/i,
  37202. rheader = /^h\d$/i,
  37203. rnative = /^[^{]+\{\s*\[native \w/,
  37204. // Easily-parseable/retrievable ID or TAG or CLASS selectors
  37205. rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,
  37206. rsibling = /[+~]/,
  37207. // CSS escapes
  37208. // http://www.w3.org/TR/CSS21/syndata.html#escaped-characters
  37209. runescape = new RegExp("\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig"),
  37210. funescape = function funescape(_, escaped, escapedWhitespace) {
  37211. var high = "0x" + escaped - 0x10000;
  37212. // NaN means non-codepoint
  37213. // Support: Firefox<24
  37214. // Workaround erroneous numeric interpretation of +"0x"
  37215. return high !== high || escapedWhitespace ? escaped : high < 0 ?
  37216. // BMP codepoint
  37217. String.fromCharCode(high + 0x10000) :
  37218. // Supplemental Plane codepoint (surrogate pair)
  37219. String.fromCharCode(high >> 10 | 0xD800, high & 0x3FF | 0xDC00);
  37220. },
  37221. // CSS string/identifier serialization
  37222. // https://drafts.csswg.org/cssom/#common-serializing-idioms
  37223. rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,
  37224. fcssescape = function fcssescape(ch, asCodePoint) {
  37225. if (asCodePoint) {
  37226. // U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER
  37227. if (ch === "\0") {
  37228. return "\uFFFD";
  37229. }
  37230. // Control characters and (dependent upon position) numbers get escaped as code points
  37231. return ch.slice(0, -1) + "\\" + ch.charCodeAt(ch.length - 1).toString(16) + " ";
  37232. }
  37233. // Other potentially-special ASCII characters get backslash-escaped
  37234. return "\\" + ch;
  37235. },
  37236. // Used for iframes
  37237. // See setDocument()
  37238. // Removing the function wrapper causes a "Permission Denied"
  37239. // error in IE
  37240. unloadHandler = function unloadHandler() {
  37241. setDocument();
  37242. },
  37243. disabledAncestor = addCombinator(function (elem) {
  37244. return elem.disabled === true && ("form" in elem || "label" in elem);
  37245. }, { dir: "parentNode", next: "legend" });
  37246. // Optimize for push.apply( _, NodeList )
  37247. try {
  37248. push.apply(arr = slice.call(preferredDoc.childNodes), preferredDoc.childNodes);
  37249. // Support: Android<4.0
  37250. // Detect silently failing push.apply
  37251. arr[preferredDoc.childNodes.length].nodeType;
  37252. } catch (e) {
  37253. push = { apply: arr.length ?
  37254. // Leverage slice if possible
  37255. function (target, els) {
  37256. push_native.apply(target, slice.call(els));
  37257. } :
  37258. // Support: IE<9
  37259. // Otherwise append directly
  37260. function (target, els) {
  37261. var j = target.length,
  37262. i = 0;
  37263. // Can't trust NodeList.length
  37264. while (target[j++] = els[i++]) {}
  37265. target.length = j - 1;
  37266. }
  37267. };
  37268. }
  37269. function Sizzle(selector, context, results, seed) {
  37270. var m,
  37271. i,
  37272. elem,
  37273. nid,
  37274. match,
  37275. groups,
  37276. newSelector,
  37277. newContext = context && context.ownerDocument,
  37278. // nodeType defaults to 9, since context defaults to document
  37279. nodeType = context ? context.nodeType : 9;
  37280. results = results || [];
  37281. // Return early from calls with invalid selector or context
  37282. if (typeof selector !== "string" || !selector || nodeType !== 1 && nodeType !== 9 && nodeType !== 11) {
  37283. return results;
  37284. }
  37285. // Try to shortcut find operations (as opposed to filters) in HTML documents
  37286. if (!seed) {
  37287. if ((context ? context.ownerDocument || context : preferredDoc) !== document) {
  37288. setDocument(context);
  37289. }
  37290. context = context || document;
  37291. if (documentIsHTML) {
  37292. // If the selector is sufficiently simple, try using a "get*By*" DOM method
  37293. // (excepting DocumentFragment context, where the methods don't exist)
  37294. if (nodeType !== 11 && (match = rquickExpr.exec(selector))) {
  37295. // ID selector
  37296. if (m = match[1]) {
  37297. // Document context
  37298. if (nodeType === 9) {
  37299. if (elem = context.getElementById(m)) {
  37300. // Support: IE, Opera, Webkit
  37301. // TODO: identify versions
  37302. // getElementById can match elements by name instead of ID
  37303. if (elem.id === m) {
  37304. results.push(elem);
  37305. return results;
  37306. }
  37307. } else {
  37308. return results;
  37309. }
  37310. // Element context
  37311. } else {
  37312. // Support: IE, Opera, Webkit
  37313. // TODO: identify versions
  37314. // getElementById can match elements by name instead of ID
  37315. if (newContext && (elem = newContext.getElementById(m)) && contains(context, elem) && elem.id === m) {
  37316. results.push(elem);
  37317. return results;
  37318. }
  37319. }
  37320. // Type selector
  37321. } else if (match[2]) {
  37322. push.apply(results, context.getElementsByTagName(selector));
  37323. return results;
  37324. // Class selector
  37325. } else if ((m = match[3]) && support.getElementsByClassName && context.getElementsByClassName) {
  37326. push.apply(results, context.getElementsByClassName(m));
  37327. return results;
  37328. }
  37329. }
  37330. // Take advantage of querySelectorAll
  37331. if (support.qsa && !compilerCache[selector + " "] && (!rbuggyQSA || !rbuggyQSA.test(selector))) {
  37332. if (nodeType !== 1) {
  37333. newContext = context;
  37334. newSelector = selector;
  37335. // qSA looks outside Element context, which is not what we want
  37336. // Thanks to Andrew Dupont for this workaround technique
  37337. // Support: IE <=8
  37338. // Exclude object elements
  37339. } else if (context.nodeName.toLowerCase() !== "object") {
  37340. // Capture the context ID, setting it first if necessary
  37341. if (nid = context.getAttribute("id")) {
  37342. nid = nid.replace(rcssescape, fcssescape);
  37343. } else {
  37344. context.setAttribute("id", nid = expando);
  37345. }
  37346. // Prefix every selector in the list
  37347. groups = tokenize(selector);
  37348. i = groups.length;
  37349. while (i--) {
  37350. groups[i] = "#" + nid + " " + toSelector(groups[i]);
  37351. }
  37352. newSelector = groups.join(",");
  37353. // Expand context for sibling selectors
  37354. newContext = rsibling.test(selector) && testContext(context.parentNode) || context;
  37355. }
  37356. if (newSelector) {
  37357. try {
  37358. push.apply(results, newContext.querySelectorAll(newSelector));
  37359. return results;
  37360. } catch (qsaError) {} finally {
  37361. if (nid === expando) {
  37362. context.removeAttribute("id");
  37363. }
  37364. }
  37365. }
  37366. }
  37367. }
  37368. }
  37369. // All others
  37370. return select(selector.replace(rtrim, "$1"), context, results, seed);
  37371. }
  37372. /**
  37373. * Create key-value caches of limited size
  37374. * @returns {function(string, object)} Returns the Object data after storing it on itself with
  37375. * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength)
  37376. * deleting the oldest entry
  37377. */
  37378. function createCache() {
  37379. var keys = [];
  37380. function cache(key, value) {
  37381. // Use (key + " ") to avoid collision with native prototype properties (see Issue #157)
  37382. if (keys.push(key + " ") > Expr.cacheLength) {
  37383. // Only keep the most recent entries
  37384. delete cache[keys.shift()];
  37385. }
  37386. return cache[key + " "] = value;
  37387. }
  37388. return cache;
  37389. }
  37390. /**
  37391. * Mark a function for special use by Sizzle
  37392. * @param {Function} fn The function to mark
  37393. */
  37394. function markFunction(fn) {
  37395. fn[expando] = true;
  37396. return fn;
  37397. }
  37398. /**
  37399. * Support testing using an element
  37400. * @param {Function} fn Passed the created element and returns a boolean result
  37401. */
  37402. function assert(fn) {
  37403. var el = document.createElement("fieldset");
  37404. try {
  37405. return !!fn(el);
  37406. } catch (e) {
  37407. return false;
  37408. } finally {
  37409. // Remove from its parent by default
  37410. if (el.parentNode) {
  37411. el.parentNode.removeChild(el);
  37412. }
  37413. // release memory in IE
  37414. el = null;
  37415. }
  37416. }
  37417. /**
  37418. * Adds the same handler for all of the specified attrs
  37419. * @param {String} attrs Pipe-separated list of attributes
  37420. * @param {Function} handler The method that will be applied
  37421. */
  37422. function addHandle(attrs, handler) {
  37423. var arr = attrs.split("|"),
  37424. i = arr.length;
  37425. while (i--) {
  37426. Expr.attrHandle[arr[i]] = handler;
  37427. }
  37428. }
  37429. /**
  37430. * Checks document order of two siblings
  37431. * @param {Element} a
  37432. * @param {Element} b
  37433. * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b
  37434. */
  37435. function siblingCheck(a, b) {
  37436. var cur = b && a,
  37437. diff = cur && a.nodeType === 1 && b.nodeType === 1 && a.sourceIndex - b.sourceIndex;
  37438. // Use IE sourceIndex if available on both nodes
  37439. if (diff) {
  37440. return diff;
  37441. }
  37442. // Check if b follows a
  37443. if (cur) {
  37444. while (cur = cur.nextSibling) {
  37445. if (cur === b) {
  37446. return -1;
  37447. }
  37448. }
  37449. }
  37450. return a ? 1 : -1;
  37451. }
  37452. /**
  37453. * Returns a function to use in pseudos for input types
  37454. * @param {String} type
  37455. */
  37456. function createInputPseudo(type) {
  37457. return function (elem) {
  37458. var name = elem.nodeName.toLowerCase();
  37459. return name === "input" && elem.type === type;
  37460. };
  37461. }
  37462. /**
  37463. * Returns a function to use in pseudos for buttons
  37464. * @param {String} type
  37465. */
  37466. function createButtonPseudo(type) {
  37467. return function (elem) {
  37468. var name = elem.nodeName.toLowerCase();
  37469. return (name === "input" || name === "button") && elem.type === type;
  37470. };
  37471. }
  37472. /**
  37473. * Returns a function to use in pseudos for :enabled/:disabled
  37474. * @param {Boolean} disabled true for :disabled; false for :enabled
  37475. */
  37476. function createDisabledPseudo(disabled) {
  37477. // Known :disabled false positives: fieldset[disabled] > legend:nth-of-type(n+2) :can-disable
  37478. return function (elem) {
  37479. // Only certain elements can match :enabled or :disabled
  37480. // https://html.spec.whatwg.org/multipage/scripting.html#selector-enabled
  37481. // https://html.spec.whatwg.org/multipage/scripting.html#selector-disabled
  37482. if ("form" in elem) {
  37483. // Check for inherited disabledness on relevant non-disabled elements:
  37484. // * listed form-associated elements in a disabled fieldset
  37485. // https://html.spec.whatwg.org/multipage/forms.html#category-listed
  37486. // https://html.spec.whatwg.org/multipage/forms.html#concept-fe-disabled
  37487. // * option elements in a disabled optgroup
  37488. // https://html.spec.whatwg.org/multipage/forms.html#concept-option-disabled
  37489. // All such elements have a "form" property.
  37490. if (elem.parentNode && elem.disabled === false) {
  37491. // Option elements defer to a parent optgroup if present
  37492. if ("label" in elem) {
  37493. if ("label" in elem.parentNode) {
  37494. return elem.parentNode.disabled === disabled;
  37495. } else {
  37496. return elem.disabled === disabled;
  37497. }
  37498. }
  37499. // Support: IE 6 - 11
  37500. // Use the isDisabled shortcut property to check for disabled fieldset ancestors
  37501. return elem.isDisabled === disabled ||
  37502. // Where there is no isDisabled, check manually
  37503. /* jshint -W018 */
  37504. elem.isDisabled !== !disabled && disabledAncestor(elem) === disabled;
  37505. }
  37506. return elem.disabled === disabled;
  37507. // Try to winnow out elements that can't be disabled before trusting the disabled property.
  37508. // Some victims get caught in our net (label, legend, menu, track), but it shouldn't
  37509. // even exist on them, let alone have a boolean value.
  37510. } else if ("label" in elem) {
  37511. return elem.disabled === disabled;
  37512. }
  37513. // Remaining elements are neither :enabled nor :disabled
  37514. return false;
  37515. };
  37516. }
  37517. /**
  37518. * Returns a function to use in pseudos for positionals
  37519. * @param {Function} fn
  37520. */
  37521. function createPositionalPseudo(fn) {
  37522. return markFunction(function (argument) {
  37523. argument = +argument;
  37524. return markFunction(function (seed, matches) {
  37525. var j,
  37526. matchIndexes = fn([], seed.length, argument),
  37527. i = matchIndexes.length;
  37528. // Match elements found at the specified indexes
  37529. while (i--) {
  37530. if (seed[j = matchIndexes[i]]) {
  37531. seed[j] = !(matches[j] = seed[j]);
  37532. }
  37533. }
  37534. });
  37535. });
  37536. }
  37537. /**
  37538. * Checks a node for validity as a Sizzle context
  37539. * @param {Element|Object=} context
  37540. * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value
  37541. */
  37542. function testContext(context) {
  37543. return context && typeof context.getElementsByTagName !== "undefined" && context;
  37544. }
  37545. // Expose support vars for convenience
  37546. support = Sizzle.support = {};
  37547. /**
  37548. * Detects XML nodes
  37549. * @param {Element|Object} elem An element or a document
  37550. * @returns {Boolean} True iff elem is a non-HTML XML node
  37551. */
  37552. isXML = Sizzle.isXML = function (elem) {
  37553. // documentElement is verified for cases where it doesn't yet exist
  37554. // (such as loading iframes in IE - #4833)
  37555. var documentElement = elem && (elem.ownerDocument || elem).documentElement;
  37556. return documentElement ? documentElement.nodeName !== "HTML" : false;
  37557. };
  37558. /**
  37559. * Sets document-related variables once based on the current document
  37560. * @param {Element|Object} [doc] An element or document object to use to set the document
  37561. * @returns {Object} Returns the current document
  37562. */
  37563. setDocument = Sizzle.setDocument = function (node) {
  37564. var hasCompare,
  37565. subWindow,
  37566. doc = node ? node.ownerDocument || node : preferredDoc;
  37567. // Return early if doc is invalid or already selected
  37568. if (doc === document || doc.nodeType !== 9 || !doc.documentElement) {
  37569. return document;
  37570. }
  37571. // Update global variables
  37572. document = doc;
  37573. docElem = document.documentElement;
  37574. documentIsHTML = !isXML(document);
  37575. // Support: IE 9-11, Edge
  37576. // Accessing iframe documents after unload throws "permission denied" errors (jQuery #13936)
  37577. if (preferredDoc !== document && (subWindow = document.defaultView) && subWindow.top !== subWindow) {
  37578. // Support: IE 11, Edge
  37579. if (subWindow.addEventListener) {
  37580. subWindow.addEventListener("unload", unloadHandler, false);
  37581. // Support: IE 9 - 10 only
  37582. } else if (subWindow.attachEvent) {
  37583. subWindow.attachEvent("onunload", unloadHandler);
  37584. }
  37585. }
  37586. /* Attributes
  37587. ---------------------------------------------------------------------- */
  37588. // Support: IE<8
  37589. // Verify that getAttribute really returns attributes and not properties
  37590. // (excepting IE8 booleans)
  37591. support.attributes = assert(function (el) {
  37592. el.className = "i";
  37593. return !el.getAttribute("className");
  37594. });
  37595. /* getElement(s)By*
  37596. ---------------------------------------------------------------------- */
  37597. // Check if getElementsByTagName("*") returns only elements
  37598. support.getElementsByTagName = assert(function (el) {
  37599. el.appendChild(document.createComment(""));
  37600. return !el.getElementsByTagName("*").length;
  37601. });
  37602. // Support: IE<9
  37603. support.getElementsByClassName = rnative.test(document.getElementsByClassName);
  37604. // Support: IE<10
  37605. // Check if getElementById returns elements by name
  37606. // The broken getElementById methods don't pick up programmatically-set names,
  37607. // so use a roundabout getElementsByName test
  37608. support.getById = assert(function (el) {
  37609. docElem.appendChild(el).id = expando;
  37610. return !document.getElementsByName || !document.getElementsByName(expando).length;
  37611. });
  37612. // ID filter and find
  37613. if (support.getById) {
  37614. Expr.filter["ID"] = function (id) {
  37615. var attrId = id.replace(runescape, funescape);
  37616. return function (elem) {
  37617. return elem.getAttribute("id") === attrId;
  37618. };
  37619. };
  37620. Expr.find["ID"] = function (id, context) {
  37621. if (typeof context.getElementById !== "undefined" && documentIsHTML) {
  37622. var elem = context.getElementById(id);
  37623. return elem ? [elem] : [];
  37624. }
  37625. };
  37626. } else {
  37627. Expr.filter["ID"] = function (id) {
  37628. var attrId = id.replace(runescape, funescape);
  37629. return function (elem) {
  37630. var node = typeof elem.getAttributeNode !== "undefined" && elem.getAttributeNode("id");
  37631. return node && node.value === attrId;
  37632. };
  37633. };
  37634. // Support: IE 6 - 7 only
  37635. // getElementById is not reliable as a find shortcut
  37636. Expr.find["ID"] = function (id, context) {
  37637. if (typeof context.getElementById !== "undefined" && documentIsHTML) {
  37638. var node,
  37639. i,
  37640. elems,
  37641. elem = context.getElementById(id);
  37642. if (elem) {
  37643. // Verify the id attribute
  37644. node = elem.getAttributeNode("id");
  37645. if (node && node.value === id) {
  37646. return [elem];
  37647. }
  37648. // Fall back on getElementsByName
  37649. elems = context.getElementsByName(id);
  37650. i = 0;
  37651. while (elem = elems[i++]) {
  37652. node = elem.getAttributeNode("id");
  37653. if (node && node.value === id) {
  37654. return [elem];
  37655. }
  37656. }
  37657. }
  37658. return [];
  37659. }
  37660. };
  37661. }
  37662. // Tag
  37663. Expr.find["TAG"] = support.getElementsByTagName ? function (tag, context) {
  37664. if (typeof context.getElementsByTagName !== "undefined") {
  37665. return context.getElementsByTagName(tag);
  37666. // DocumentFragment nodes don't have gEBTN
  37667. } else if (support.qsa) {
  37668. return context.querySelectorAll(tag);
  37669. }
  37670. } : function (tag, context) {
  37671. var elem,
  37672. tmp = [],
  37673. i = 0,
  37674. // By happy coincidence, a (broken) gEBTN appears on DocumentFragment nodes too
  37675. results = context.getElementsByTagName(tag);
  37676. // Filter out possible comments
  37677. if (tag === "*") {
  37678. while (elem = results[i++]) {
  37679. if (elem.nodeType === 1) {
  37680. tmp.push(elem);
  37681. }
  37682. }
  37683. return tmp;
  37684. }
  37685. return results;
  37686. };
  37687. // Class
  37688. Expr.find["CLASS"] = support.getElementsByClassName && function (className, context) {
  37689. if (typeof context.getElementsByClassName !== "undefined" && documentIsHTML) {
  37690. return context.getElementsByClassName(className);
  37691. }
  37692. };
  37693. /* QSA/matchesSelector
  37694. ---------------------------------------------------------------------- */
  37695. // QSA and matchesSelector support
  37696. // matchesSelector(:active) reports false when true (IE9/Opera 11.5)
  37697. rbuggyMatches = [];
  37698. // qSa(:focus) reports false when true (Chrome 21)
  37699. // We allow this because of a bug in IE8/9 that throws an error
  37700. // whenever `document.activeElement` is accessed on an iframe
  37701. // So, we allow :focus to pass through QSA all the time to avoid the IE error
  37702. // See https://bugs.jquery.com/ticket/13378
  37703. rbuggyQSA = [];
  37704. if (support.qsa = rnative.test(document.querySelectorAll)) {
  37705. // Build QSA regex
  37706. // Regex strategy adopted from Diego Perini
  37707. assert(function (el) {
  37708. // Select is set to empty string on purpose
  37709. // This is to test IE's treatment of not explicitly
  37710. // setting a boolean content attribute,
  37711. // since its presence should be enough
  37712. // https://bugs.jquery.com/ticket/12359
  37713. docElem.appendChild(el).innerHTML = "<a id='" + expando + "'></a>" + "<select id='" + expando + "-\r\\' msallowcapture=''>" + "<option selected=''></option></select>";
  37714. // Support: IE8, Opera 11-12.16
  37715. // Nothing should be selected when empty strings follow ^= or $= or *=
  37716. // The test attribute must be unknown in Opera but "safe" for WinRT
  37717. // https://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section
  37718. if (el.querySelectorAll("[msallowcapture^='']").length) {
  37719. rbuggyQSA.push("[*^$]=" + whitespace + "*(?:''|\"\")");
  37720. }
  37721. // Support: IE8
  37722. // Boolean attributes and "value" are not treated correctly
  37723. if (!el.querySelectorAll("[selected]").length) {
  37724. rbuggyQSA.push("\\[" + whitespace + "*(?:value|" + booleans + ")");
  37725. }
  37726. // Support: Chrome<29, Android<4.4, Safari<7.0+, iOS<7.0+, PhantomJS<1.9.8+
  37727. if (!el.querySelectorAll("[id~=" + expando + "-]").length) {
  37728. rbuggyQSA.push("~=");
  37729. }
  37730. // Webkit/Opera - :checked should return selected option elements
  37731. // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
  37732. // IE8 throws error here and will not see later tests
  37733. if (!el.querySelectorAll(":checked").length) {
  37734. rbuggyQSA.push(":checked");
  37735. }
  37736. // Support: Safari 8+, iOS 8+
  37737. // https://bugs.webkit.org/show_bug.cgi?id=136851
  37738. // In-page `selector#id sibling-combinator selector` fails
  37739. if (!el.querySelectorAll("a#" + expando + "+*").length) {
  37740. rbuggyQSA.push(".#.+[+~]");
  37741. }
  37742. });
  37743. assert(function (el) {
  37744. el.innerHTML = "<a href='' disabled='disabled'></a>" + "<select disabled='disabled'><option/></select>";
  37745. // Support: Windows 8 Native Apps
  37746. // The type and name attributes are restricted during .innerHTML assignment
  37747. var input = document.createElement("input");
  37748. input.setAttribute("type", "hidden");
  37749. el.appendChild(input).setAttribute("name", "D");
  37750. // Support: IE8
  37751. // Enforce case-sensitivity of name attribute
  37752. if (el.querySelectorAll("[name=d]").length) {
  37753. rbuggyQSA.push("name" + whitespace + "*[*^$|!~]?=");
  37754. }
  37755. // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled)
  37756. // IE8 throws error here and will not see later tests
  37757. if (el.querySelectorAll(":enabled").length !== 2) {
  37758. rbuggyQSA.push(":enabled", ":disabled");
  37759. }
  37760. // Support: IE9-11+
  37761. // IE's :disabled selector does not pick up the children of disabled fieldsets
  37762. docElem.appendChild(el).disabled = true;
  37763. if (el.querySelectorAll(":disabled").length !== 2) {
  37764. rbuggyQSA.push(":enabled", ":disabled");
  37765. }
  37766. // Opera 10-11 does not throw on post-comma invalid pseudos
  37767. el.querySelectorAll("*,:x");
  37768. rbuggyQSA.push(",.*:");
  37769. });
  37770. }
  37771. if (support.matchesSelector = rnative.test(matches = docElem.matches || docElem.webkitMatchesSelector || docElem.mozMatchesSelector || docElem.oMatchesSelector || docElem.msMatchesSelector)) {
  37772. assert(function (el) {
  37773. // Check to see if it's possible to do matchesSelector
  37774. // on a disconnected node (IE 9)
  37775. support.disconnectedMatch = matches.call(el, "*");
  37776. // This should fail with an exception
  37777. // Gecko does not error, returns false instead
  37778. matches.call(el, "[s!='']:x");
  37779. rbuggyMatches.push("!=", pseudos);
  37780. });
  37781. }
  37782. rbuggyQSA = rbuggyQSA.length && new RegExp(rbuggyQSA.join("|"));
  37783. rbuggyMatches = rbuggyMatches.length && new RegExp(rbuggyMatches.join("|"));
  37784. /* Contains
  37785. ---------------------------------------------------------------------- */
  37786. hasCompare = rnative.test(docElem.compareDocumentPosition);
  37787. // Element contains another
  37788. // Purposefully self-exclusive
  37789. // As in, an element does not contain itself
  37790. contains = hasCompare || rnative.test(docElem.contains) ? function (a, b) {
  37791. var adown = a.nodeType === 9 ? a.documentElement : a,
  37792. bup = b && b.parentNode;
  37793. return a === bup || !!(bup && bup.nodeType === 1 && (adown.contains ? adown.contains(bup) : a.compareDocumentPosition && a.compareDocumentPosition(bup) & 16));
  37794. } : function (a, b) {
  37795. if (b) {
  37796. while (b = b.parentNode) {
  37797. if (b === a) {
  37798. return true;
  37799. }
  37800. }
  37801. }
  37802. return false;
  37803. };
  37804. /* Sorting
  37805. ---------------------------------------------------------------------- */
  37806. // Document order sorting
  37807. sortOrder = hasCompare ? function (a, b) {
  37808. // Flag for duplicate removal
  37809. if (a === b) {
  37810. hasDuplicate = true;
  37811. return 0;
  37812. }
  37813. // Sort on method existence if only one input has compareDocumentPosition
  37814. var compare = !a.compareDocumentPosition - !b.compareDocumentPosition;
  37815. if (compare) {
  37816. return compare;
  37817. }
  37818. // Calculate position if both inputs belong to the same document
  37819. compare = (a.ownerDocument || a) === (b.ownerDocument || b) ? a.compareDocumentPosition(b) :
  37820. // Otherwise we know they are disconnected
  37821. 1;
  37822. // Disconnected nodes
  37823. if (compare & 1 || !support.sortDetached && b.compareDocumentPosition(a) === compare) {
  37824. // Choose the first element that is related to our preferred document
  37825. if (a === document || a.ownerDocument === preferredDoc && contains(preferredDoc, a)) {
  37826. return -1;
  37827. }
  37828. if (b === document || b.ownerDocument === preferredDoc && contains(preferredDoc, b)) {
  37829. return 1;
  37830. }
  37831. // Maintain original order
  37832. return sortInput ? indexOf(sortInput, a) - indexOf(sortInput, b) : 0;
  37833. }
  37834. return compare & 4 ? -1 : 1;
  37835. } : function (a, b) {
  37836. // Exit early if the nodes are identical
  37837. if (a === b) {
  37838. hasDuplicate = true;
  37839. return 0;
  37840. }
  37841. var cur,
  37842. i = 0,
  37843. aup = a.parentNode,
  37844. bup = b.parentNode,
  37845. ap = [a],
  37846. bp = [b];
  37847. // Parentless nodes are either documents or disconnected
  37848. if (!aup || !bup) {
  37849. return a === document ? -1 : b === document ? 1 : aup ? -1 : bup ? 1 : sortInput ? indexOf(sortInput, a) - indexOf(sortInput, b) : 0;
  37850. // If the nodes are siblings, we can do a quick check
  37851. } else if (aup === bup) {
  37852. return siblingCheck(a, b);
  37853. }
  37854. // Otherwise we need full lists of their ancestors for comparison
  37855. cur = a;
  37856. while (cur = cur.parentNode) {
  37857. ap.unshift(cur);
  37858. }
  37859. cur = b;
  37860. while (cur = cur.parentNode) {
  37861. bp.unshift(cur);
  37862. }
  37863. // Walk down the tree looking for a discrepancy
  37864. while (ap[i] === bp[i]) {
  37865. i++;
  37866. }
  37867. return i ?
  37868. // Do a sibling check if the nodes have a common ancestor
  37869. siblingCheck(ap[i], bp[i]) :
  37870. // Otherwise nodes in our document sort first
  37871. ap[i] === preferredDoc ? -1 : bp[i] === preferredDoc ? 1 : 0;
  37872. };
  37873. return document;
  37874. };
  37875. Sizzle.matches = function (expr, elements) {
  37876. return Sizzle(expr, null, null, elements);
  37877. };
  37878. Sizzle.matchesSelector = function (elem, expr) {
  37879. // Set document vars if needed
  37880. if ((elem.ownerDocument || elem) !== document) {
  37881. setDocument(elem);
  37882. }
  37883. // Make sure that attribute selectors are quoted
  37884. expr = expr.replace(rattributeQuotes, "='$1']");
  37885. if (support.matchesSelector && documentIsHTML && !compilerCache[expr + " "] && (!rbuggyMatches || !rbuggyMatches.test(expr)) && (!rbuggyQSA || !rbuggyQSA.test(expr))) {
  37886. try {
  37887. var ret = matches.call(elem, expr);
  37888. // IE 9's matchesSelector returns false on disconnected nodes
  37889. if (ret || support.disconnectedMatch ||
  37890. // As well, disconnected nodes are said to be in a document
  37891. // fragment in IE 9
  37892. elem.document && elem.document.nodeType !== 11) {
  37893. return ret;
  37894. }
  37895. } catch (e) {}
  37896. }
  37897. return Sizzle(expr, document, null, [elem]).length > 0;
  37898. };
  37899. Sizzle.contains = function (context, elem) {
  37900. // Set document vars if needed
  37901. if ((context.ownerDocument || context) !== document) {
  37902. setDocument(context);
  37903. }
  37904. return contains(context, elem);
  37905. };
  37906. Sizzle.attr = function (elem, name) {
  37907. // Set document vars if needed
  37908. if ((elem.ownerDocument || elem) !== document) {
  37909. setDocument(elem);
  37910. }
  37911. var fn = Expr.attrHandle[name.toLowerCase()],
  37912. // Don't get fooled by Object.prototype properties (jQuery #13807)
  37913. val = fn && hasOwn.call(Expr.attrHandle, name.toLowerCase()) ? fn(elem, name, !documentIsHTML) : undefined;
  37914. return val !== undefined ? val : support.attributes || !documentIsHTML ? elem.getAttribute(name) : (val = elem.getAttributeNode(name)) && val.specified ? val.value : null;
  37915. };
  37916. Sizzle.escape = function (sel) {
  37917. return (sel + "").replace(rcssescape, fcssescape);
  37918. };
  37919. Sizzle.error = function (msg) {
  37920. throw new Error("Syntax error, unrecognized expression: " + msg);
  37921. };
  37922. /**
  37923. * Document sorting and removing duplicates
  37924. * @param {ArrayLike} results
  37925. */
  37926. Sizzle.uniqueSort = function (results) {
  37927. var elem,
  37928. duplicates = [],
  37929. j = 0,
  37930. i = 0;
  37931. // Unless we *know* we can detect duplicates, assume their presence
  37932. hasDuplicate = !support.detectDuplicates;
  37933. sortInput = !support.sortStable && results.slice(0);
  37934. results.sort(sortOrder);
  37935. if (hasDuplicate) {
  37936. while (elem = results[i++]) {
  37937. if (elem === results[i]) {
  37938. j = duplicates.push(i);
  37939. }
  37940. }
  37941. while (j--) {
  37942. results.splice(duplicates[j], 1);
  37943. }
  37944. }
  37945. // Clear input after sorting to release objects
  37946. // See https://github.com/jquery/sizzle/pull/225
  37947. sortInput = null;
  37948. return results;
  37949. };
  37950. /**
  37951. * Utility function for retrieving the text value of an array of DOM nodes
  37952. * @param {Array|Element} elem
  37953. */
  37954. getText = Sizzle.getText = function (elem) {
  37955. var node,
  37956. ret = "",
  37957. i = 0,
  37958. nodeType = elem.nodeType;
  37959. if (!nodeType) {
  37960. // If no nodeType, this is expected to be an array
  37961. while (node = elem[i++]) {
  37962. // Do not traverse comment nodes
  37963. ret += getText(node);
  37964. }
  37965. } else if (nodeType === 1 || nodeType === 9 || nodeType === 11) {
  37966. // Use textContent for elements
  37967. // innerText usage removed for consistency of new lines (jQuery #11153)
  37968. if (typeof elem.textContent === "string") {
  37969. return elem.textContent;
  37970. } else {
  37971. // Traverse its children
  37972. for (elem = elem.firstChild; elem; elem = elem.nextSibling) {
  37973. ret += getText(elem);
  37974. }
  37975. }
  37976. } else if (nodeType === 3 || nodeType === 4) {
  37977. return elem.nodeValue;
  37978. }
  37979. // Do not include comment or processing instruction nodes
  37980. return ret;
  37981. };
  37982. Expr = Sizzle.selectors = {
  37983. // Can be adjusted by the user
  37984. cacheLength: 50,
  37985. createPseudo: markFunction,
  37986. match: matchExpr,
  37987. attrHandle: {},
  37988. find: {},
  37989. relative: {
  37990. ">": { dir: "parentNode", first: true },
  37991. " ": { dir: "parentNode" },
  37992. "+": { dir: "previousSibling", first: true },
  37993. "~": { dir: "previousSibling" }
  37994. },
  37995. preFilter: {
  37996. "ATTR": function ATTR(match) {
  37997. match[1] = match[1].replace(runescape, funescape);
  37998. // Move the given value to match[3] whether quoted or unquoted
  37999. match[3] = (match[3] || match[4] || match[5] || "").replace(runescape, funescape);
  38000. if (match[2] === "~=") {
  38001. match[3] = " " + match[3] + " ";
  38002. }
  38003. return match.slice(0, 4);
  38004. },
  38005. "CHILD": function CHILD(match) {
  38006. /* matches from matchExpr["CHILD"]
  38007. 1 type (only|nth|...)
  38008. 2 what (child|of-type)
  38009. 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...)
  38010. 4 xn-component of xn+y argument ([+-]?\d*n|)
  38011. 5 sign of xn-component
  38012. 6 x of xn-component
  38013. 7 sign of y-component
  38014. 8 y of y-component
  38015. */
  38016. match[1] = match[1].toLowerCase();
  38017. if (match[1].slice(0, 3) === "nth") {
  38018. // nth-* requires argument
  38019. if (!match[3]) {
  38020. Sizzle.error(match[0]);
  38021. }
  38022. // numeric x and y parameters for Expr.filter.CHILD
  38023. // remember that false/true cast respectively to 0/1
  38024. match[4] = +(match[4] ? match[5] + (match[6] || 1) : 2 * (match[3] === "even" || match[3] === "odd"));
  38025. match[5] = +(match[7] + match[8] || match[3] === "odd");
  38026. // other types prohibit arguments
  38027. } else if (match[3]) {
  38028. Sizzle.error(match[0]);
  38029. }
  38030. return match;
  38031. },
  38032. "PSEUDO": function PSEUDO(match) {
  38033. var excess,
  38034. unquoted = !match[6] && match[2];
  38035. if (matchExpr["CHILD"].test(match[0])) {
  38036. return null;
  38037. }
  38038. // Accept quoted arguments as-is
  38039. if (match[3]) {
  38040. match[2] = match[4] || match[5] || "";
  38041. // Strip excess characters from unquoted arguments
  38042. } else if (unquoted && rpseudo.test(unquoted) && (
  38043. // Get excess from tokenize (recursively)
  38044. excess = tokenize(unquoted, true)) && (
  38045. // advance to the next closing parenthesis
  38046. excess = unquoted.indexOf(")", unquoted.length - excess) - unquoted.length)) {
  38047. // excess is a negative index
  38048. match[0] = match[0].slice(0, excess);
  38049. match[2] = unquoted.slice(0, excess);
  38050. }
  38051. // Return only captures needed by the pseudo filter method (type and argument)
  38052. return match.slice(0, 3);
  38053. }
  38054. },
  38055. filter: {
  38056. "TAG": function TAG(nodeNameSelector) {
  38057. var nodeName = nodeNameSelector.replace(runescape, funescape).toLowerCase();
  38058. return nodeNameSelector === "*" ? function () {
  38059. return true;
  38060. } : function (elem) {
  38061. return elem.nodeName && elem.nodeName.toLowerCase() === nodeName;
  38062. };
  38063. },
  38064. "CLASS": function CLASS(className) {
  38065. var pattern = classCache[className + " "];
  38066. return pattern || (pattern = new RegExp("(^|" + whitespace + ")" + className + "(" + whitespace + "|$)")) && classCache(className, function (elem) {
  38067. return pattern.test(typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== "undefined" && elem.getAttribute("class") || "");
  38068. });
  38069. },
  38070. "ATTR": function ATTR(name, operator, check) {
  38071. return function (elem) {
  38072. var result = Sizzle.attr(elem, name);
  38073. if (result == null) {
  38074. return operator === "!=";
  38075. }
  38076. if (!operator) {
  38077. return true;
  38078. }
  38079. result += "";
  38080. return operator === "=" ? result === check : operator === "!=" ? result !== check : operator === "^=" ? check && result.indexOf(check) === 0 : operator === "*=" ? check && result.indexOf(check) > -1 : operator === "$=" ? check && result.slice(-check.length) === check : operator === "~=" ? (" " + result.replace(rwhitespace, " ") + " ").indexOf(check) > -1 : operator === "|=" ? result === check || result.slice(0, check.length + 1) === check + "-" : false;
  38081. };
  38082. },
  38083. "CHILD": function CHILD(type, what, argument, first, last) {
  38084. var simple = type.slice(0, 3) !== "nth",
  38085. forward = type.slice(-4) !== "last",
  38086. ofType = what === "of-type";
  38087. return first === 1 && last === 0 ?
  38088. // Shortcut for :nth-*(n)
  38089. function (elem) {
  38090. return !!elem.parentNode;
  38091. } : function (elem, context, xml) {
  38092. var cache,
  38093. uniqueCache,
  38094. outerCache,
  38095. node,
  38096. nodeIndex,
  38097. start,
  38098. dir = simple !== forward ? "nextSibling" : "previousSibling",
  38099. parent = elem.parentNode,
  38100. name = ofType && elem.nodeName.toLowerCase(),
  38101. useCache = !xml && !ofType,
  38102. diff = false;
  38103. if (parent) {
  38104. // :(first|last|only)-(child|of-type)
  38105. if (simple) {
  38106. while (dir) {
  38107. node = elem;
  38108. while (node = node[dir]) {
  38109. if (ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1) {
  38110. return false;
  38111. }
  38112. }
  38113. // Reverse direction for :only-* (if we haven't yet done so)
  38114. start = dir = type === "only" && !start && "nextSibling";
  38115. }
  38116. return true;
  38117. }
  38118. start = [forward ? parent.firstChild : parent.lastChild];
  38119. // non-xml :nth-child(...) stores cache data on `parent`
  38120. if (forward && useCache) {
  38121. // Seek `elem` from a previously-cached index
  38122. // ...in a gzip-friendly way
  38123. node = parent;
  38124. outerCache = node[expando] || (node[expando] = {});
  38125. // Support: IE <9 only
  38126. // Defend against cloned attroperties (jQuery gh-1709)
  38127. uniqueCache = outerCache[node.uniqueID] || (outerCache[node.uniqueID] = {});
  38128. cache = uniqueCache[type] || [];
  38129. nodeIndex = cache[0] === dirruns && cache[1];
  38130. diff = nodeIndex && cache[2];
  38131. node = nodeIndex && parent.childNodes[nodeIndex];
  38132. while (node = ++nodeIndex && node && node[dir] || (
  38133. // Fallback to seeking `elem` from the start
  38134. diff = nodeIndex = 0) || start.pop()) {
  38135. // When found, cache indexes on `parent` and break
  38136. if (node.nodeType === 1 && ++diff && node === elem) {
  38137. uniqueCache[type] = [dirruns, nodeIndex, diff];
  38138. break;
  38139. }
  38140. }
  38141. } else {
  38142. // Use previously-cached element index if available
  38143. if (useCache) {
  38144. // ...in a gzip-friendly way
  38145. node = elem;
  38146. outerCache = node[expando] || (node[expando] = {});
  38147. // Support: IE <9 only
  38148. // Defend against cloned attroperties (jQuery gh-1709)
  38149. uniqueCache = outerCache[node.uniqueID] || (outerCache[node.uniqueID] = {});
  38150. cache = uniqueCache[type] || [];
  38151. nodeIndex = cache[0] === dirruns && cache[1];
  38152. diff = nodeIndex;
  38153. }
  38154. // xml :nth-child(...)
  38155. // or :nth-last-child(...) or :nth(-last)?-of-type(...)
  38156. if (diff === false) {
  38157. // Use the same loop as above to seek `elem` from the start
  38158. while (node = ++nodeIndex && node && node[dir] || (diff = nodeIndex = 0) || start.pop()) {
  38159. if ((ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1) && ++diff) {
  38160. // Cache the index of each encountered element
  38161. if (useCache) {
  38162. outerCache = node[expando] || (node[expando] = {});
  38163. // Support: IE <9 only
  38164. // Defend against cloned attroperties (jQuery gh-1709)
  38165. uniqueCache = outerCache[node.uniqueID] || (outerCache[node.uniqueID] = {});
  38166. uniqueCache[type] = [dirruns, diff];
  38167. }
  38168. if (node === elem) {
  38169. break;
  38170. }
  38171. }
  38172. }
  38173. }
  38174. }
  38175. // Incorporate the offset, then check against cycle size
  38176. diff -= last;
  38177. return diff === first || diff % first === 0 && diff / first >= 0;
  38178. }
  38179. };
  38180. },
  38181. "PSEUDO": function PSEUDO(pseudo, argument) {
  38182. // pseudo-class names are case-insensitive
  38183. // http://www.w3.org/TR/selectors/#pseudo-classes
  38184. // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters
  38185. // Remember that setFilters inherits from pseudos
  38186. var args,
  38187. fn = Expr.pseudos[pseudo] || Expr.setFilters[pseudo.toLowerCase()] || Sizzle.error("unsupported pseudo: " + pseudo);
  38188. // The user may use createPseudo to indicate that
  38189. // arguments are needed to create the filter function
  38190. // just as Sizzle does
  38191. if (fn[expando]) {
  38192. return fn(argument);
  38193. }
  38194. // But maintain support for old signatures
  38195. if (fn.length > 1) {
  38196. args = [pseudo, pseudo, "", argument];
  38197. return Expr.setFilters.hasOwnProperty(pseudo.toLowerCase()) ? markFunction(function (seed, matches) {
  38198. var idx,
  38199. matched = fn(seed, argument),
  38200. i = matched.length;
  38201. while (i--) {
  38202. idx = indexOf(seed, matched[i]);
  38203. seed[idx] = !(matches[idx] = matched[i]);
  38204. }
  38205. }) : function (elem) {
  38206. return fn(elem, 0, args);
  38207. };
  38208. }
  38209. return fn;
  38210. }
  38211. },
  38212. pseudos: {
  38213. // Potentially complex pseudos
  38214. "not": markFunction(function (selector) {
  38215. // Trim the selector passed to compile
  38216. // to avoid treating leading and trailing
  38217. // spaces as combinators
  38218. var input = [],
  38219. results = [],
  38220. matcher = compile(selector.replace(rtrim, "$1"));
  38221. return matcher[expando] ? markFunction(function (seed, matches, context, xml) {
  38222. var elem,
  38223. unmatched = matcher(seed, null, xml, []),
  38224. i = seed.length;
  38225. // Match elements unmatched by `matcher`
  38226. while (i--) {
  38227. if (elem = unmatched[i]) {
  38228. seed[i] = !(matches[i] = elem);
  38229. }
  38230. }
  38231. }) : function (elem, context, xml) {
  38232. input[0] = elem;
  38233. matcher(input, null, xml, results);
  38234. // Don't keep the element (issue #299)
  38235. input[0] = null;
  38236. return !results.pop();
  38237. };
  38238. }),
  38239. "has": markFunction(function (selector) {
  38240. return function (elem) {
  38241. return Sizzle(selector, elem).length > 0;
  38242. };
  38243. }),
  38244. "contains": markFunction(function (text) {
  38245. text = text.replace(runescape, funescape);
  38246. return function (elem) {
  38247. return (elem.textContent || elem.innerText || getText(elem)).indexOf(text) > -1;
  38248. };
  38249. }),
  38250. // "Whether an element is represented by a :lang() selector
  38251. // is based solely on the element's language value
  38252. // being equal to the identifier C,
  38253. // or beginning with the identifier C immediately followed by "-".
  38254. // The matching of C against the element's language value is performed case-insensitively.
  38255. // The identifier C does not have to be a valid language name."
  38256. // http://www.w3.org/TR/selectors/#lang-pseudo
  38257. "lang": markFunction(function (lang) {
  38258. // lang value must be a valid identifier
  38259. if (!ridentifier.test(lang || "")) {
  38260. Sizzle.error("unsupported lang: " + lang);
  38261. }
  38262. lang = lang.replace(runescape, funescape).toLowerCase();
  38263. return function (elem) {
  38264. var elemLang;
  38265. do {
  38266. if (elemLang = documentIsHTML ? elem.lang : elem.getAttribute("xml:lang") || elem.getAttribute("lang")) {
  38267. elemLang = elemLang.toLowerCase();
  38268. return elemLang === lang || elemLang.indexOf(lang + "-") === 0;
  38269. }
  38270. } while ((elem = elem.parentNode) && elem.nodeType === 1);
  38271. return false;
  38272. };
  38273. }),
  38274. // Miscellaneous
  38275. "target": function target(elem) {
  38276. var hash = window.location && window.location.hash;
  38277. return hash && hash.slice(1) === elem.id;
  38278. },
  38279. "root": function root(elem) {
  38280. return elem === docElem;
  38281. },
  38282. "focus": function focus(elem) {
  38283. return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex);
  38284. },
  38285. // Boolean properties
  38286. "enabled": createDisabledPseudo(false),
  38287. "disabled": createDisabledPseudo(true),
  38288. "checked": function checked(elem) {
  38289. // In CSS3, :checked should return both checked and selected elements
  38290. // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
  38291. var nodeName = elem.nodeName.toLowerCase();
  38292. return nodeName === "input" && !!elem.checked || nodeName === "option" && !!elem.selected;
  38293. },
  38294. "selected": function selected(elem) {
  38295. // Accessing this property makes selected-by-default
  38296. // options in Safari work properly
  38297. if (elem.parentNode) {
  38298. elem.parentNode.selectedIndex;
  38299. }
  38300. return elem.selected === true;
  38301. },
  38302. // Contents
  38303. "empty": function empty(elem) {
  38304. // http://www.w3.org/TR/selectors/#empty-pseudo
  38305. // :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5),
  38306. // but not by others (comment: 8; processing instruction: 7; etc.)
  38307. // nodeType < 6 works because attributes (2) do not appear as children
  38308. for (elem = elem.firstChild; elem; elem = elem.nextSibling) {
  38309. if (elem.nodeType < 6) {
  38310. return false;
  38311. }
  38312. }
  38313. return true;
  38314. },
  38315. "parent": function parent(elem) {
  38316. return !Expr.pseudos["empty"](elem);
  38317. },
  38318. // Element/input types
  38319. "header": function header(elem) {
  38320. return rheader.test(elem.nodeName);
  38321. },
  38322. "input": function input(elem) {
  38323. return rinputs.test(elem.nodeName);
  38324. },
  38325. "button": function button(elem) {
  38326. var name = elem.nodeName.toLowerCase();
  38327. return name === "input" && elem.type === "button" || name === "button";
  38328. },
  38329. "text": function text(elem) {
  38330. var attr;
  38331. return elem.nodeName.toLowerCase() === "input" && elem.type === "text" && (
  38332. // Support: IE<8
  38333. // New HTML5 attribute values (e.g., "search") appear with elem.type === "text"
  38334. (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === "text");
  38335. },
  38336. // Position-in-collection
  38337. "first": createPositionalPseudo(function () {
  38338. return [0];
  38339. }),
  38340. "last": createPositionalPseudo(function (matchIndexes, length) {
  38341. return [length - 1];
  38342. }),
  38343. "eq": createPositionalPseudo(function (matchIndexes, length, argument) {
  38344. return [argument < 0 ? argument + length : argument];
  38345. }),
  38346. "even": createPositionalPseudo(function (matchIndexes, length) {
  38347. var i = 0;
  38348. for (; i < length; i += 2) {
  38349. matchIndexes.push(i);
  38350. }
  38351. return matchIndexes;
  38352. }),
  38353. "odd": createPositionalPseudo(function (matchIndexes, length) {
  38354. var i = 1;
  38355. for (; i < length; i += 2) {
  38356. matchIndexes.push(i);
  38357. }
  38358. return matchIndexes;
  38359. }),
  38360. "lt": createPositionalPseudo(function (matchIndexes, length, argument) {
  38361. var i = argument < 0 ? argument + length : argument;
  38362. for (; --i >= 0;) {
  38363. matchIndexes.push(i);
  38364. }
  38365. return matchIndexes;
  38366. }),
  38367. "gt": createPositionalPseudo(function (matchIndexes, length, argument) {
  38368. var i = argument < 0 ? argument + length : argument;
  38369. for (; ++i < length;) {
  38370. matchIndexes.push(i);
  38371. }
  38372. return matchIndexes;
  38373. })
  38374. }
  38375. };
  38376. Expr.pseudos["nth"] = Expr.pseudos["eq"];
  38377. // Add button/input type pseudos
  38378. for (i in { radio: true, checkbox: true, file: true, password: true, image: true }) {
  38379. Expr.pseudos[i] = createInputPseudo(i);
  38380. }
  38381. for (i in { submit: true, reset: true }) {
  38382. Expr.pseudos[i] = createButtonPseudo(i);
  38383. }
  38384. // Easy API for creating new setFilters
  38385. function setFilters() {}
  38386. setFilters.prototype = Expr.filters = Expr.pseudos;
  38387. Expr.setFilters = new setFilters();
  38388. tokenize = Sizzle.tokenize = function (selector, parseOnly) {
  38389. var matched,
  38390. match,
  38391. tokens,
  38392. type,
  38393. soFar,
  38394. groups,
  38395. preFilters,
  38396. cached = tokenCache[selector + " "];
  38397. if (cached) {
  38398. return parseOnly ? 0 : cached.slice(0);
  38399. }
  38400. soFar = selector;
  38401. groups = [];
  38402. preFilters = Expr.preFilter;
  38403. while (soFar) {
  38404. // Comma and first run
  38405. if (!matched || (match = rcomma.exec(soFar))) {
  38406. if (match) {
  38407. // Don't consume trailing commas as valid
  38408. soFar = soFar.slice(match[0].length) || soFar;
  38409. }
  38410. groups.push(tokens = []);
  38411. }
  38412. matched = false;
  38413. // Combinators
  38414. if (match = rcombinators.exec(soFar)) {
  38415. matched = match.shift();
  38416. tokens.push({
  38417. value: matched,
  38418. // Cast descendant combinators to space
  38419. type: match[0].replace(rtrim, " ")
  38420. });
  38421. soFar = soFar.slice(matched.length);
  38422. }
  38423. // Filters
  38424. for (type in Expr.filter) {
  38425. if ((match = matchExpr[type].exec(soFar)) && (!preFilters[type] || (match = preFilters[type](match)))) {
  38426. matched = match.shift();
  38427. tokens.push({
  38428. value: matched,
  38429. type: type,
  38430. matches: match
  38431. });
  38432. soFar = soFar.slice(matched.length);
  38433. }
  38434. }
  38435. if (!matched) {
  38436. break;
  38437. }
  38438. }
  38439. // Return the length of the invalid excess
  38440. // if we're just parsing
  38441. // Otherwise, throw an error or return tokens
  38442. return parseOnly ? soFar.length : soFar ? Sizzle.error(selector) :
  38443. // Cache the tokens
  38444. tokenCache(selector, groups).slice(0);
  38445. };
  38446. function toSelector(tokens) {
  38447. var i = 0,
  38448. len = tokens.length,
  38449. selector = "";
  38450. for (; i < len; i++) {
  38451. selector += tokens[i].value;
  38452. }
  38453. return selector;
  38454. }
  38455. function addCombinator(matcher, combinator, base) {
  38456. var dir = combinator.dir,
  38457. skip = combinator.next,
  38458. key = skip || dir,
  38459. checkNonElements = base && key === "parentNode",
  38460. doneName = done++;
  38461. return combinator.first ?
  38462. // Check against closest ancestor/preceding element
  38463. function (elem, context, xml) {
  38464. while (elem = elem[dir]) {
  38465. if (elem.nodeType === 1 || checkNonElements) {
  38466. return matcher(elem, context, xml);
  38467. }
  38468. }
  38469. return false;
  38470. } :
  38471. // Check against all ancestor/preceding elements
  38472. function (elem, context, xml) {
  38473. var oldCache,
  38474. uniqueCache,
  38475. outerCache,
  38476. newCache = [dirruns, doneName];
  38477. // We can't set arbitrary data on XML nodes, so they don't benefit from combinator caching
  38478. if (xml) {
  38479. while (elem = elem[dir]) {
  38480. if (elem.nodeType === 1 || checkNonElements) {
  38481. if (matcher(elem, context, xml)) {
  38482. return true;
  38483. }
  38484. }
  38485. }
  38486. } else {
  38487. while (elem = elem[dir]) {
  38488. if (elem.nodeType === 1 || checkNonElements) {
  38489. outerCache = elem[expando] || (elem[expando] = {});
  38490. // Support: IE <9 only
  38491. // Defend against cloned attroperties (jQuery gh-1709)
  38492. uniqueCache = outerCache[elem.uniqueID] || (outerCache[elem.uniqueID] = {});
  38493. if (skip && skip === elem.nodeName.toLowerCase()) {
  38494. elem = elem[dir] || elem;
  38495. } else if ((oldCache = uniqueCache[key]) && oldCache[0] === dirruns && oldCache[1] === doneName) {
  38496. // Assign to newCache so results back-propagate to previous elements
  38497. return newCache[2] = oldCache[2];
  38498. } else {
  38499. // Reuse newcache so results back-propagate to previous elements
  38500. uniqueCache[key] = newCache;
  38501. // A match means we're done; a fail means we have to keep checking
  38502. if (newCache[2] = matcher(elem, context, xml)) {
  38503. return true;
  38504. }
  38505. }
  38506. }
  38507. }
  38508. }
  38509. return false;
  38510. };
  38511. }
  38512. function elementMatcher(matchers) {
  38513. return matchers.length > 1 ? function (elem, context, xml) {
  38514. var i = matchers.length;
  38515. while (i--) {
  38516. if (!matchers[i](elem, context, xml)) {
  38517. return false;
  38518. }
  38519. }
  38520. return true;
  38521. } : matchers[0];
  38522. }
  38523. function multipleContexts(selector, contexts, results) {
  38524. var i = 0,
  38525. len = contexts.length;
  38526. for (; i < len; i++) {
  38527. Sizzle(selector, contexts[i], results);
  38528. }
  38529. return results;
  38530. }
  38531. function condense(unmatched, map, filter, context, xml) {
  38532. var elem,
  38533. newUnmatched = [],
  38534. i = 0,
  38535. len = unmatched.length,
  38536. mapped = map != null;
  38537. for (; i < len; i++) {
  38538. if (elem = unmatched[i]) {
  38539. if (!filter || filter(elem, context, xml)) {
  38540. newUnmatched.push(elem);
  38541. if (mapped) {
  38542. map.push(i);
  38543. }
  38544. }
  38545. }
  38546. }
  38547. return newUnmatched;
  38548. }
  38549. function setMatcher(preFilter, selector, matcher, postFilter, postFinder, postSelector) {
  38550. if (postFilter && !postFilter[expando]) {
  38551. postFilter = setMatcher(postFilter);
  38552. }
  38553. if (postFinder && !postFinder[expando]) {
  38554. postFinder = setMatcher(postFinder, postSelector);
  38555. }
  38556. return markFunction(function (seed, results, context, xml) {
  38557. var temp,
  38558. i,
  38559. elem,
  38560. preMap = [],
  38561. postMap = [],
  38562. preexisting = results.length,
  38563. // Get initial elements from seed or context
  38564. elems = seed || multipleContexts(selector || "*", context.nodeType ? [context] : context, []),
  38565. // Prefilter to get matcher input, preserving a map for seed-results synchronization
  38566. matcherIn = preFilter && (seed || !selector) ? condense(elems, preMap, preFilter, context, xml) : elems,
  38567. matcherOut = matcher ?
  38568. // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results,
  38569. postFinder || (seed ? preFilter : preexisting || postFilter) ?
  38570. // ...intermediate processing is necessary
  38571. [] :
  38572. // ...otherwise use results directly
  38573. results : matcherIn;
  38574. // Find primary matches
  38575. if (matcher) {
  38576. matcher(matcherIn, matcherOut, context, xml);
  38577. }
  38578. // Apply postFilter
  38579. if (postFilter) {
  38580. temp = condense(matcherOut, postMap);
  38581. postFilter(temp, [], context, xml);
  38582. // Un-match failing elements by moving them back to matcherIn
  38583. i = temp.length;
  38584. while (i--) {
  38585. if (elem = temp[i]) {
  38586. matcherOut[postMap[i]] = !(matcherIn[postMap[i]] = elem);
  38587. }
  38588. }
  38589. }
  38590. if (seed) {
  38591. if (postFinder || preFilter) {
  38592. if (postFinder) {
  38593. // Get the final matcherOut by condensing this intermediate into postFinder contexts
  38594. temp = [];
  38595. i = matcherOut.length;
  38596. while (i--) {
  38597. if (elem = matcherOut[i]) {
  38598. // Restore matcherIn since elem is not yet a final match
  38599. temp.push(matcherIn[i] = elem);
  38600. }
  38601. }
  38602. postFinder(null, matcherOut = [], temp, xml);
  38603. }
  38604. // Move matched elements from seed to results to keep them synchronized
  38605. i = matcherOut.length;
  38606. while (i--) {
  38607. if ((elem = matcherOut[i]) && (temp = postFinder ? indexOf(seed, elem) : preMap[i]) > -1) {
  38608. seed[temp] = !(results[temp] = elem);
  38609. }
  38610. }
  38611. }
  38612. // Add elements to results, through postFinder if defined
  38613. } else {
  38614. matcherOut = condense(matcherOut === results ? matcherOut.splice(preexisting, matcherOut.length) : matcherOut);
  38615. if (postFinder) {
  38616. postFinder(null, results, matcherOut, xml);
  38617. } else {
  38618. push.apply(results, matcherOut);
  38619. }
  38620. }
  38621. });
  38622. }
  38623. function matcherFromTokens(tokens) {
  38624. var checkContext,
  38625. matcher,
  38626. j,
  38627. len = tokens.length,
  38628. leadingRelative = Expr.relative[tokens[0].type],
  38629. implicitRelative = leadingRelative || Expr.relative[" "],
  38630. i = leadingRelative ? 1 : 0,
  38631. // The foundational matcher ensures that elements are reachable from top-level context(s)
  38632. matchContext = addCombinator(function (elem) {
  38633. return elem === checkContext;
  38634. }, implicitRelative, true),
  38635. matchAnyContext = addCombinator(function (elem) {
  38636. return indexOf(checkContext, elem) > -1;
  38637. }, implicitRelative, true),
  38638. matchers = [function (elem, context, xml) {
  38639. var ret = !leadingRelative && (xml || context !== outermostContext) || ((checkContext = context).nodeType ? matchContext(elem, context, xml) : matchAnyContext(elem, context, xml));
  38640. // Avoid hanging onto element (issue #299)
  38641. checkContext = null;
  38642. return ret;
  38643. }];
  38644. for (; i < len; i++) {
  38645. if (matcher = Expr.relative[tokens[i].type]) {
  38646. matchers = [addCombinator(elementMatcher(matchers), matcher)];
  38647. } else {
  38648. matcher = Expr.filter[tokens[i].type].apply(null, tokens[i].matches);
  38649. // Return special upon seeing a positional matcher
  38650. if (matcher[expando]) {
  38651. // Find the next relative operator (if any) for proper handling
  38652. j = ++i;
  38653. for (; j < len; j++) {
  38654. if (Expr.relative[tokens[j].type]) {
  38655. break;
  38656. }
  38657. }
  38658. return setMatcher(i > 1 && elementMatcher(matchers), i > 1 && toSelector(
  38659. // If the preceding token was a descendant combinator, insert an implicit any-element `*`
  38660. tokens.slice(0, i - 1).concat({ value: tokens[i - 2].type === " " ? "*" : "" })).replace(rtrim, "$1"), matcher, i < j && matcherFromTokens(tokens.slice(i, j)), j < len && matcherFromTokens(tokens = tokens.slice(j)), j < len && toSelector(tokens));
  38661. }
  38662. matchers.push(matcher);
  38663. }
  38664. }
  38665. return elementMatcher(matchers);
  38666. }
  38667. function matcherFromGroupMatchers(elementMatchers, setMatchers) {
  38668. var bySet = setMatchers.length > 0,
  38669. byElement = elementMatchers.length > 0,
  38670. superMatcher = function superMatcher(seed, context, xml, results, outermost) {
  38671. var elem,
  38672. j,
  38673. matcher,
  38674. matchedCount = 0,
  38675. i = "0",
  38676. unmatched = seed && [],
  38677. setMatched = [],
  38678. contextBackup = outermostContext,
  38679. // We must always have either seed elements or outermost context
  38680. elems = seed || byElement && Expr.find["TAG"]("*", outermost),
  38681. // Use integer dirruns iff this is the outermost matcher
  38682. dirrunsUnique = dirruns += contextBackup == null ? 1 : Math.random() || 0.1,
  38683. len = elems.length;
  38684. if (outermost) {
  38685. outermostContext = context === document || context || outermost;
  38686. }
  38687. // Add elements passing elementMatchers directly to results
  38688. // Support: IE<9, Safari
  38689. // Tolerate NodeList properties (IE: "length"; Safari: <number>) matching elements by id
  38690. for (; i !== len && (elem = elems[i]) != null; i++) {
  38691. if (byElement && elem) {
  38692. j = 0;
  38693. if (!context && elem.ownerDocument !== document) {
  38694. setDocument(elem);
  38695. xml = !documentIsHTML;
  38696. }
  38697. while (matcher = elementMatchers[j++]) {
  38698. if (matcher(elem, context || document, xml)) {
  38699. results.push(elem);
  38700. break;
  38701. }
  38702. }
  38703. if (outermost) {
  38704. dirruns = dirrunsUnique;
  38705. }
  38706. }
  38707. // Track unmatched elements for set filters
  38708. if (bySet) {
  38709. // They will have gone through all possible matchers
  38710. if (elem = !matcher && elem) {
  38711. matchedCount--;
  38712. }
  38713. // Lengthen the array for every element, matched or not
  38714. if (seed) {
  38715. unmatched.push(elem);
  38716. }
  38717. }
  38718. }
  38719. // `i` is now the count of elements visited above, and adding it to `matchedCount`
  38720. // makes the latter nonnegative.
  38721. matchedCount += i;
  38722. // Apply set filters to unmatched elements
  38723. // NOTE: This can be skipped if there are no unmatched elements (i.e., `matchedCount`
  38724. // equals `i`), unless we didn't visit _any_ elements in the above loop because we have
  38725. // no element matchers and no seed.
  38726. // Incrementing an initially-string "0" `i` allows `i` to remain a string only in that
  38727. // case, which will result in a "00" `matchedCount` that differs from `i` but is also
  38728. // numerically zero.
  38729. if (bySet && i !== matchedCount) {
  38730. j = 0;
  38731. while (matcher = setMatchers[j++]) {
  38732. matcher(unmatched, setMatched, context, xml);
  38733. }
  38734. if (seed) {
  38735. // Reintegrate element matches to eliminate the need for sorting
  38736. if (matchedCount > 0) {
  38737. while (i--) {
  38738. if (!(unmatched[i] || setMatched[i])) {
  38739. setMatched[i] = pop.call(results);
  38740. }
  38741. }
  38742. }
  38743. // Discard index placeholder values to get only actual matches
  38744. setMatched = condense(setMatched);
  38745. }
  38746. // Add matches to results
  38747. push.apply(results, setMatched);
  38748. // Seedless set matches succeeding multiple successful matchers stipulate sorting
  38749. if (outermost && !seed && setMatched.length > 0 && matchedCount + setMatchers.length > 1) {
  38750. Sizzle.uniqueSort(results);
  38751. }
  38752. }
  38753. // Override manipulation of globals by nested matchers
  38754. if (outermost) {
  38755. dirruns = dirrunsUnique;
  38756. outermostContext = contextBackup;
  38757. }
  38758. return unmatched;
  38759. };
  38760. return bySet ? markFunction(superMatcher) : superMatcher;
  38761. }
  38762. compile = Sizzle.compile = function (selector, match /* Internal Use Only */) {
  38763. var i,
  38764. setMatchers = [],
  38765. elementMatchers = [],
  38766. cached = compilerCache[selector + " "];
  38767. if (!cached) {
  38768. // Generate a function of recursive functions that can be used to check each element
  38769. if (!match) {
  38770. match = tokenize(selector);
  38771. }
  38772. i = match.length;
  38773. while (i--) {
  38774. cached = matcherFromTokens(match[i]);
  38775. if (cached[expando]) {
  38776. setMatchers.push(cached);
  38777. } else {
  38778. elementMatchers.push(cached);
  38779. }
  38780. }
  38781. // Cache the compiled function
  38782. cached = compilerCache(selector, matcherFromGroupMatchers(elementMatchers, setMatchers));
  38783. // Save selector and tokenization
  38784. cached.selector = selector;
  38785. }
  38786. return cached;
  38787. };
  38788. /**
  38789. * A low-level selection function that works with Sizzle's compiled
  38790. * selector functions
  38791. * @param {String|Function} selector A selector or a pre-compiled
  38792. * selector function built with Sizzle.compile
  38793. * @param {Element} context
  38794. * @param {Array} [results]
  38795. * @param {Array} [seed] A set of elements to match against
  38796. */
  38797. select = Sizzle.select = function (selector, context, results, seed) {
  38798. var i,
  38799. tokens,
  38800. token,
  38801. type,
  38802. find,
  38803. compiled = typeof selector === "function" && selector,
  38804. match = !seed && tokenize(selector = compiled.selector || selector);
  38805. results = results || [];
  38806. // Try to minimize operations if there is only one selector in the list and no seed
  38807. // (the latter of which guarantees us context)
  38808. if (match.length === 1) {
  38809. // Reduce context if the leading compound selector is an ID
  38810. tokens = match[0] = match[0].slice(0);
  38811. if (tokens.length > 2 && (token = tokens[0]).type === "ID" && context.nodeType === 9 && documentIsHTML && Expr.relative[tokens[1].type]) {
  38812. context = (Expr.find["ID"](token.matches[0].replace(runescape, funescape), context) || [])[0];
  38813. if (!context) {
  38814. return results;
  38815. // Precompiled matchers will still verify ancestry, so step up a level
  38816. } else if (compiled) {
  38817. context = context.parentNode;
  38818. }
  38819. selector = selector.slice(tokens.shift().value.length);
  38820. }
  38821. // Fetch a seed set for right-to-left matching
  38822. i = matchExpr["needsContext"].test(selector) ? 0 : tokens.length;
  38823. while (i--) {
  38824. token = tokens[i];
  38825. // Abort if we hit a combinator
  38826. if (Expr.relative[type = token.type]) {
  38827. break;
  38828. }
  38829. if (find = Expr.find[type]) {
  38830. // Search, expanding context for leading sibling combinators
  38831. if (seed = find(token.matches[0].replace(runescape, funescape), rsibling.test(tokens[0].type) && testContext(context.parentNode) || context)) {
  38832. // If seed is empty or no tokens remain, we can return early
  38833. tokens.splice(i, 1);
  38834. selector = seed.length && toSelector(tokens);
  38835. if (!selector) {
  38836. push.apply(results, seed);
  38837. return results;
  38838. }
  38839. break;
  38840. }
  38841. }
  38842. }
  38843. }
  38844. // Compile and execute a filtering function if one is not provided
  38845. // Provide `match` to avoid retokenization if we modified the selector above
  38846. (compiled || compile(selector, match))(seed, context, !documentIsHTML, results, !context || rsibling.test(selector) && testContext(context.parentNode) || context);
  38847. return results;
  38848. };
  38849. // One-time assignments
  38850. // Sort stability
  38851. support.sortStable = expando.split("").sort(sortOrder).join("") === expando;
  38852. // Support: Chrome 14-35+
  38853. // Always assume duplicates if they aren't passed to the comparison function
  38854. support.detectDuplicates = !!hasDuplicate;
  38855. // Initialize against the default document
  38856. setDocument();
  38857. // Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27)
  38858. // Detached nodes confoundingly follow *each other*
  38859. support.sortDetached = assert(function (el) {
  38860. // Should return 1, but returns 4 (following)
  38861. return el.compareDocumentPosition(document.createElement("fieldset")) & 1;
  38862. });
  38863. // Support: IE<8
  38864. // Prevent attribute/property "interpolation"
  38865. // https://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx
  38866. if (!assert(function (el) {
  38867. el.innerHTML = "<a href='#'></a>";
  38868. return el.firstChild.getAttribute("href") === "#";
  38869. })) {
  38870. addHandle("type|href|height|width", function (elem, name, isXML) {
  38871. if (!isXML) {
  38872. return elem.getAttribute(name, name.toLowerCase() === "type" ? 1 : 2);
  38873. }
  38874. });
  38875. }
  38876. // Support: IE<9
  38877. // Use defaultValue in place of getAttribute("value")
  38878. if (!support.attributes || !assert(function (el) {
  38879. el.innerHTML = "<input/>";
  38880. el.firstChild.setAttribute("value", "");
  38881. return el.firstChild.getAttribute("value") === "";
  38882. })) {
  38883. addHandle("value", function (elem, name, isXML) {
  38884. if (!isXML && elem.nodeName.toLowerCase() === "input") {
  38885. return elem.defaultValue;
  38886. }
  38887. });
  38888. }
  38889. // Support: IE<9
  38890. // Use getAttributeNode to fetch booleans when getAttribute lies
  38891. if (!assert(function (el) {
  38892. return el.getAttribute("disabled") == null;
  38893. })) {
  38894. addHandle(booleans, function (elem, name, isXML) {
  38895. var val;
  38896. if (!isXML) {
  38897. return elem[name] === true ? name.toLowerCase() : (val = elem.getAttributeNode(name)) && val.specified ? val.value : null;
  38898. }
  38899. });
  38900. }
  38901. return Sizzle;
  38902. }(window);
  38903. jQuery.find = Sizzle;
  38904. jQuery.expr = Sizzle.selectors;
  38905. // Deprecated
  38906. jQuery.expr[":"] = jQuery.expr.pseudos;
  38907. jQuery.uniqueSort = jQuery.unique = Sizzle.uniqueSort;
  38908. jQuery.text = Sizzle.getText;
  38909. jQuery.isXMLDoc = Sizzle.isXML;
  38910. jQuery.contains = Sizzle.contains;
  38911. jQuery.escapeSelector = Sizzle.escape;
  38912. var dir = function dir(elem, _dir, until) {
  38913. var matched = [],
  38914. truncate = until !== undefined;
  38915. while ((elem = elem[_dir]) && elem.nodeType !== 9) {
  38916. if (elem.nodeType === 1) {
  38917. if (truncate && jQuery(elem).is(until)) {
  38918. break;
  38919. }
  38920. matched.push(elem);
  38921. }
  38922. }
  38923. return matched;
  38924. };
  38925. var _siblings = function _siblings(n, elem) {
  38926. var matched = [];
  38927. for (; n; n = n.nextSibling) {
  38928. if (n.nodeType === 1 && n !== elem) {
  38929. matched.push(n);
  38930. }
  38931. }
  38932. return matched;
  38933. };
  38934. var rneedsContext = jQuery.expr.match.needsContext;
  38935. function nodeName(elem, name) {
  38936. return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
  38937. };
  38938. var rsingleTag = /^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i;
  38939. // Implement the identical functionality for filter and not
  38940. function winnow(elements, qualifier, not) {
  38941. if (isFunction(qualifier)) {
  38942. return jQuery.grep(elements, function (elem, i) {
  38943. return !!qualifier.call(elem, i, elem) !== not;
  38944. });
  38945. }
  38946. // Single element
  38947. if (qualifier.nodeType) {
  38948. return jQuery.grep(elements, function (elem) {
  38949. return elem === qualifier !== not;
  38950. });
  38951. }
  38952. // Arraylike of elements (jQuery, arguments, Array)
  38953. if (typeof qualifier !== "string") {
  38954. return jQuery.grep(elements, function (elem) {
  38955. return indexOf.call(qualifier, elem) > -1 !== not;
  38956. });
  38957. }
  38958. // Filtered directly for both simple and complex selectors
  38959. return jQuery.filter(qualifier, elements, not);
  38960. }
  38961. jQuery.filter = function (expr, elems, not) {
  38962. var elem = elems[0];
  38963. if (not) {
  38964. expr = ":not(" + expr + ")";
  38965. }
  38966. if (elems.length === 1 && elem.nodeType === 1) {
  38967. return jQuery.find.matchesSelector(elem, expr) ? [elem] : [];
  38968. }
  38969. return jQuery.find.matches(expr, jQuery.grep(elems, function (elem) {
  38970. return elem.nodeType === 1;
  38971. }));
  38972. };
  38973. jQuery.fn.extend({
  38974. find: function find(selector) {
  38975. var i,
  38976. ret,
  38977. len = this.length,
  38978. self = this;
  38979. if (typeof selector !== "string") {
  38980. return this.pushStack(jQuery(selector).filter(function () {
  38981. for (i = 0; i < len; i++) {
  38982. if (jQuery.contains(self[i], this)) {
  38983. return true;
  38984. }
  38985. }
  38986. }));
  38987. }
  38988. ret = this.pushStack([]);
  38989. for (i = 0; i < len; i++) {
  38990. jQuery.find(selector, self[i], ret);
  38991. }
  38992. return len > 1 ? jQuery.uniqueSort(ret) : ret;
  38993. },
  38994. filter: function filter(selector) {
  38995. return this.pushStack(winnow(this, selector || [], false));
  38996. },
  38997. not: function not(selector) {
  38998. return this.pushStack(winnow(this, selector || [], true));
  38999. },
  39000. is: function is(selector) {
  39001. return !!winnow(this,
  39002. // If this is a positional/relative selector, check membership in the returned set
  39003. // so $("p:first").is("p:last") won't return true for a doc with two "p".
  39004. typeof selector === "string" && rneedsContext.test(selector) ? jQuery(selector) : selector || [], false).length;
  39005. }
  39006. });
  39007. // Initialize a jQuery object
  39008. // A central reference to the root jQuery(document)
  39009. var rootjQuery,
  39010. // A simple way to check for HTML strings
  39011. // Prioritize #id over <tag> to avoid XSS via location.hash (#9521)
  39012. // Strict HTML recognition (#11290: must start with <)
  39013. // Shortcut simple #id case for speed
  39014. rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/,
  39015. init = jQuery.fn.init = function (selector, context, root) {
  39016. var match, elem;
  39017. // HANDLE: $(""), $(null), $(undefined), $(false)
  39018. if (!selector) {
  39019. return this;
  39020. }
  39021. // Method init() accepts an alternate rootjQuery
  39022. // so migrate can support jQuery.sub (gh-2101)
  39023. root = root || rootjQuery;
  39024. // Handle HTML strings
  39025. if (typeof selector === "string") {
  39026. if (selector[0] === "<" && selector[selector.length - 1] === ">" && selector.length >= 3) {
  39027. // Assume that strings that start and end with <> are HTML and skip the regex check
  39028. match = [null, selector, null];
  39029. } else {
  39030. match = rquickExpr.exec(selector);
  39031. }
  39032. // Match html or make sure no context is specified for #id
  39033. if (match && (match[1] || !context)) {
  39034. // HANDLE: $(html) -> $(array)
  39035. if (match[1]) {
  39036. context = context instanceof jQuery ? context[0] : context;
  39037. // Option to run scripts is true for back-compat
  39038. // Intentionally let the error be thrown if parseHTML is not present
  39039. jQuery.merge(this, jQuery.parseHTML(match[1], context && context.nodeType ? context.ownerDocument || context : document, true));
  39040. // HANDLE: $(html, props)
  39041. if (rsingleTag.test(match[1]) && jQuery.isPlainObject(context)) {
  39042. for (match in context) {
  39043. // Properties of context are called as methods if possible
  39044. if (isFunction(this[match])) {
  39045. this[match](context[match]);
  39046. // ...and otherwise set as attributes
  39047. } else {
  39048. this.attr(match, context[match]);
  39049. }
  39050. }
  39051. }
  39052. return this;
  39053. // HANDLE: $(#id)
  39054. } else {
  39055. elem = document.getElementById(match[2]);
  39056. if (elem) {
  39057. // Inject the element directly into the jQuery object
  39058. this[0] = elem;
  39059. this.length = 1;
  39060. }
  39061. return this;
  39062. }
  39063. // HANDLE: $(expr, $(...))
  39064. } else if (!context || context.jquery) {
  39065. return (context || root).find(selector);
  39066. // HANDLE: $(expr, context)
  39067. // (which is just equivalent to: $(context).find(expr)
  39068. } else {
  39069. return this.constructor(context).find(selector);
  39070. }
  39071. // HANDLE: $(DOMElement)
  39072. } else if (selector.nodeType) {
  39073. this[0] = selector;
  39074. this.length = 1;
  39075. return this;
  39076. // HANDLE: $(function)
  39077. // Shortcut for document ready
  39078. } else if (isFunction(selector)) {
  39079. return root.ready !== undefined ? root.ready(selector) :
  39080. // Execute immediately if ready is not present
  39081. selector(jQuery);
  39082. }
  39083. return jQuery.makeArray(selector, this);
  39084. };
  39085. // Give the init function the jQuery prototype for later instantiation
  39086. init.prototype = jQuery.fn;
  39087. // Initialize central reference
  39088. rootjQuery = jQuery(document);
  39089. var rparentsprev = /^(?:parents|prev(?:Until|All))/,
  39090. // Methods guaranteed to produce a unique set when starting from a unique set
  39091. guaranteedUnique = {
  39092. children: true,
  39093. contents: true,
  39094. next: true,
  39095. prev: true
  39096. };
  39097. jQuery.fn.extend({
  39098. has: function has(target) {
  39099. var targets = jQuery(target, this),
  39100. l = targets.length;
  39101. return this.filter(function () {
  39102. var i = 0;
  39103. for (; i < l; i++) {
  39104. if (jQuery.contains(this, targets[i])) {
  39105. return true;
  39106. }
  39107. }
  39108. });
  39109. },
  39110. closest: function closest(selectors, context) {
  39111. var cur,
  39112. i = 0,
  39113. l = this.length,
  39114. matched = [],
  39115. targets = typeof selectors !== "string" && jQuery(selectors);
  39116. // Positional selectors never match, since there's no _selection_ context
  39117. if (!rneedsContext.test(selectors)) {
  39118. for (; i < l; i++) {
  39119. for (cur = this[i]; cur && cur !== context; cur = cur.parentNode) {
  39120. // Always skip document fragments
  39121. if (cur.nodeType < 11 && (targets ? targets.index(cur) > -1 :
  39122. // Don't pass non-elements to Sizzle
  39123. cur.nodeType === 1 && jQuery.find.matchesSelector(cur, selectors))) {
  39124. matched.push(cur);
  39125. break;
  39126. }
  39127. }
  39128. }
  39129. }
  39130. return this.pushStack(matched.length > 1 ? jQuery.uniqueSort(matched) : matched);
  39131. },
  39132. // Determine the position of an element within the set
  39133. index: function index(elem) {
  39134. // No argument, return index in parent
  39135. if (!elem) {
  39136. return this[0] && this[0].parentNode ? this.first().prevAll().length : -1;
  39137. }
  39138. // Index in selector
  39139. if (typeof elem === "string") {
  39140. return indexOf.call(jQuery(elem), this[0]);
  39141. }
  39142. // Locate the position of the desired element
  39143. return indexOf.call(this,
  39144. // If it receives a jQuery object, the first element is used
  39145. elem.jquery ? elem[0] : elem);
  39146. },
  39147. add: function add(selector, context) {
  39148. return this.pushStack(jQuery.uniqueSort(jQuery.merge(this.get(), jQuery(selector, context))));
  39149. },
  39150. addBack: function addBack(selector) {
  39151. return this.add(selector == null ? this.prevObject : this.prevObject.filter(selector));
  39152. }
  39153. });
  39154. function sibling(cur, dir) {
  39155. while ((cur = cur[dir]) && cur.nodeType !== 1) {}
  39156. return cur;
  39157. }
  39158. jQuery.each({
  39159. parent: function parent(elem) {
  39160. var parent = elem.parentNode;
  39161. return parent && parent.nodeType !== 11 ? parent : null;
  39162. },
  39163. parents: function parents(elem) {
  39164. return dir(elem, "parentNode");
  39165. },
  39166. parentsUntil: function parentsUntil(elem, i, until) {
  39167. return dir(elem, "parentNode", until);
  39168. },
  39169. next: function next(elem) {
  39170. return sibling(elem, "nextSibling");
  39171. },
  39172. prev: function prev(elem) {
  39173. return sibling(elem, "previousSibling");
  39174. },
  39175. nextAll: function nextAll(elem) {
  39176. return dir(elem, "nextSibling");
  39177. },
  39178. prevAll: function prevAll(elem) {
  39179. return dir(elem, "previousSibling");
  39180. },
  39181. nextUntil: function nextUntil(elem, i, until) {
  39182. return dir(elem, "nextSibling", until);
  39183. },
  39184. prevUntil: function prevUntil(elem, i, until) {
  39185. return dir(elem, "previousSibling", until);
  39186. },
  39187. siblings: function siblings(elem) {
  39188. return _siblings((elem.parentNode || {}).firstChild, elem);
  39189. },
  39190. children: function children(elem) {
  39191. return _siblings(elem.firstChild);
  39192. },
  39193. contents: function contents(elem) {
  39194. if (nodeName(elem, "iframe")) {
  39195. return elem.contentDocument;
  39196. }
  39197. // Support: IE 9 - 11 only, iOS 7 only, Android Browser <=4.3 only
  39198. // Treat the template element as a regular one in browsers that
  39199. // don't support it.
  39200. if (nodeName(elem, "template")) {
  39201. elem = elem.content || elem;
  39202. }
  39203. return jQuery.merge([], elem.childNodes);
  39204. }
  39205. }, function (name, fn) {
  39206. jQuery.fn[name] = function (until, selector) {
  39207. var matched = jQuery.map(this, fn, until);
  39208. if (name.slice(-5) !== "Until") {
  39209. selector = until;
  39210. }
  39211. if (selector && typeof selector === "string") {
  39212. matched = jQuery.filter(selector, matched);
  39213. }
  39214. if (this.length > 1) {
  39215. // Remove duplicates
  39216. if (!guaranteedUnique[name]) {
  39217. jQuery.uniqueSort(matched);
  39218. }
  39219. // Reverse order for parents* and prev-derivatives
  39220. if (rparentsprev.test(name)) {
  39221. matched.reverse();
  39222. }
  39223. }
  39224. return this.pushStack(matched);
  39225. };
  39226. });
  39227. var rnothtmlwhite = /[^\x20\t\r\n\f]+/g;
  39228. // Convert String-formatted options into Object-formatted ones
  39229. function createOptions(options) {
  39230. var object = {};
  39231. jQuery.each(options.match(rnothtmlwhite) || [], function (_, flag) {
  39232. object[flag] = true;
  39233. });
  39234. return object;
  39235. }
  39236. /*
  39237. * Create a callback list using the following parameters:
  39238. *
  39239. * options: an optional list of space-separated options that will change how
  39240. * the callback list behaves or a more traditional option object
  39241. *
  39242. * By default a callback list will act like an event callback list and can be
  39243. * "fired" multiple times.
  39244. *
  39245. * Possible options:
  39246. *
  39247. * once: will ensure the callback list can only be fired once (like a Deferred)
  39248. *
  39249. * memory: will keep track of previous values and will call any callback added
  39250. * after the list has been fired right away with the latest "memorized"
  39251. * values (like a Deferred)
  39252. *
  39253. * unique: will ensure a callback can only be added once (no duplicate in the list)
  39254. *
  39255. * stopOnFalse: interrupt callings when a callback returns false
  39256. *
  39257. */
  39258. jQuery.Callbacks = function (options) {
  39259. // Convert options from String-formatted to Object-formatted if needed
  39260. // (we check in cache first)
  39261. options = typeof options === "string" ? createOptions(options) : jQuery.extend({}, options);
  39262. var // Flag to know if list is currently firing
  39263. firing,
  39264. // Last fire value for non-forgettable lists
  39265. memory,
  39266. // Flag to know if list was already fired
  39267. _fired,
  39268. // Flag to prevent firing
  39269. _locked,
  39270. // Actual callback list
  39271. list = [],
  39272. // Queue of execution data for repeatable lists
  39273. queue = [],
  39274. // Index of currently firing callback (modified by add/remove as needed)
  39275. firingIndex = -1,
  39276. // Fire callbacks
  39277. fire = function fire() {
  39278. // Enforce single-firing
  39279. _locked = _locked || options.once;
  39280. // Execute callbacks for all pending executions,
  39281. // respecting firingIndex overrides and runtime changes
  39282. _fired = firing = true;
  39283. for (; queue.length; firingIndex = -1) {
  39284. memory = queue.shift();
  39285. while (++firingIndex < list.length) {
  39286. // Run callback and check for early termination
  39287. if (list[firingIndex].apply(memory[0], memory[1]) === false && options.stopOnFalse) {
  39288. // Jump to end and forget the data so .add doesn't re-fire
  39289. firingIndex = list.length;
  39290. memory = false;
  39291. }
  39292. }
  39293. }
  39294. // Forget the data if we're done with it
  39295. if (!options.memory) {
  39296. memory = false;
  39297. }
  39298. firing = false;
  39299. // Clean up if we're done firing for good
  39300. if (_locked) {
  39301. // Keep an empty list if we have data for future add calls
  39302. if (memory) {
  39303. list = [];
  39304. // Otherwise, this object is spent
  39305. } else {
  39306. list = "";
  39307. }
  39308. }
  39309. },
  39310. // Actual Callbacks object
  39311. self = {
  39312. // Add a callback or a collection of callbacks to the list
  39313. add: function add() {
  39314. if (list) {
  39315. // If we have memory from a past run, we should fire after adding
  39316. if (memory && !firing) {
  39317. firingIndex = list.length - 1;
  39318. queue.push(memory);
  39319. }
  39320. (function add(args) {
  39321. jQuery.each(args, function (_, arg) {
  39322. if (isFunction(arg)) {
  39323. if (!options.unique || !self.has(arg)) {
  39324. list.push(arg);
  39325. }
  39326. } else if (arg && arg.length && toType(arg) !== "string") {
  39327. // Inspect recursively
  39328. add(arg);
  39329. }
  39330. });
  39331. })(arguments);
  39332. if (memory && !firing) {
  39333. fire();
  39334. }
  39335. }
  39336. return this;
  39337. },
  39338. // Remove a callback from the list
  39339. remove: function remove() {
  39340. jQuery.each(arguments, function (_, arg) {
  39341. var index;
  39342. while ((index = jQuery.inArray(arg, list, index)) > -1) {
  39343. list.splice(index, 1);
  39344. // Handle firing indexes
  39345. if (index <= firingIndex) {
  39346. firingIndex--;
  39347. }
  39348. }
  39349. });
  39350. return this;
  39351. },
  39352. // Check if a given callback is in the list.
  39353. // If no argument is given, return whether or not list has callbacks attached.
  39354. has: function has(fn) {
  39355. return fn ? jQuery.inArray(fn, list) > -1 : list.length > 0;
  39356. },
  39357. // Remove all callbacks from the list
  39358. empty: function empty() {
  39359. if (list) {
  39360. list = [];
  39361. }
  39362. return this;
  39363. },
  39364. // Disable .fire and .add
  39365. // Abort any current/pending executions
  39366. // Clear all callbacks and values
  39367. disable: function disable() {
  39368. _locked = queue = [];
  39369. list = memory = "";
  39370. return this;
  39371. },
  39372. disabled: function disabled() {
  39373. return !list;
  39374. },
  39375. // Disable .fire
  39376. // Also disable .add unless we have memory (since it would have no effect)
  39377. // Abort any pending executions
  39378. lock: function lock() {
  39379. _locked = queue = [];
  39380. if (!memory && !firing) {
  39381. list = memory = "";
  39382. }
  39383. return this;
  39384. },
  39385. locked: function locked() {
  39386. return !!_locked;
  39387. },
  39388. // Call all callbacks with the given context and arguments
  39389. fireWith: function fireWith(context, args) {
  39390. if (!_locked) {
  39391. args = args || [];
  39392. args = [context, args.slice ? args.slice() : args];
  39393. queue.push(args);
  39394. if (!firing) {
  39395. fire();
  39396. }
  39397. }
  39398. return this;
  39399. },
  39400. // Call all the callbacks with the given arguments
  39401. fire: function fire() {
  39402. self.fireWith(this, arguments);
  39403. return this;
  39404. },
  39405. // To know if the callbacks have already been called at least once
  39406. fired: function fired() {
  39407. return !!_fired;
  39408. }
  39409. };
  39410. return self;
  39411. };
  39412. function Identity(v) {
  39413. return v;
  39414. }
  39415. function Thrower(ex) {
  39416. throw ex;
  39417. }
  39418. function adoptValue(value, resolve, reject, noValue) {
  39419. var method;
  39420. try {
  39421. // Check for promise aspect first to privilege synchronous behavior
  39422. if (value && isFunction(method = value.promise)) {
  39423. method.call(value).done(resolve).fail(reject);
  39424. // Other thenables
  39425. } else if (value && isFunction(method = value.then)) {
  39426. method.call(value, resolve, reject);
  39427. // Other non-thenables
  39428. } else {
  39429. // Control `resolve` arguments by letting Array#slice cast boolean `noValue` to integer:
  39430. // * false: [ value ].slice( 0 ) => resolve( value )
  39431. // * true: [ value ].slice( 1 ) => resolve()
  39432. resolve.apply(undefined, [value].slice(noValue));
  39433. }
  39434. // For Promises/A+, convert exceptions into rejections
  39435. // Since jQuery.when doesn't unwrap thenables, we can skip the extra checks appearing in
  39436. // Deferred#then to conditionally suppress rejection.
  39437. } catch (value) {
  39438. // Support: Android 4.0 only
  39439. // Strict mode functions invoked without .call/.apply get global-object context
  39440. reject.apply(undefined, [value]);
  39441. }
  39442. }
  39443. jQuery.extend({
  39444. Deferred: function Deferred(func) {
  39445. var tuples = [
  39446. // action, add listener, callbacks,
  39447. // ... .then handlers, argument index, [final state]
  39448. ["notify", "progress", jQuery.Callbacks("memory"), jQuery.Callbacks("memory"), 2], ["resolve", "done", jQuery.Callbacks("once memory"), jQuery.Callbacks("once memory"), 0, "resolved"], ["reject", "fail", jQuery.Callbacks("once memory"), jQuery.Callbacks("once memory"), 1, "rejected"]],
  39449. _state = "pending",
  39450. _promise = {
  39451. state: function state() {
  39452. return _state;
  39453. },
  39454. always: function always() {
  39455. deferred.done(arguments).fail(arguments);
  39456. return this;
  39457. },
  39458. "catch": function _catch(fn) {
  39459. return _promise.then(null, fn);
  39460. },
  39461. // Keep pipe for back-compat
  39462. pipe: function pipe() /* fnDone, fnFail, fnProgress */{
  39463. var fns = arguments;
  39464. return jQuery.Deferred(function (newDefer) {
  39465. jQuery.each(tuples, function (i, tuple) {
  39466. // Map tuples (progress, done, fail) to arguments (done, fail, progress)
  39467. var fn = isFunction(fns[tuple[4]]) && fns[tuple[4]];
  39468. // deferred.progress(function() { bind to newDefer or newDefer.notify })
  39469. // deferred.done(function() { bind to newDefer or newDefer.resolve })
  39470. // deferred.fail(function() { bind to newDefer or newDefer.reject })
  39471. deferred[tuple[1]](function () {
  39472. var returned = fn && fn.apply(this, arguments);
  39473. if (returned && isFunction(returned.promise)) {
  39474. returned.promise().progress(newDefer.notify).done(newDefer.resolve).fail(newDefer.reject);
  39475. } else {
  39476. newDefer[tuple[0] + "With"](this, fn ? [returned] : arguments);
  39477. }
  39478. });
  39479. });
  39480. fns = null;
  39481. }).promise();
  39482. },
  39483. then: function then(onFulfilled, onRejected, onProgress) {
  39484. var maxDepth = 0;
  39485. function resolve(depth, deferred, handler, special) {
  39486. return function () {
  39487. var that = this,
  39488. args = arguments,
  39489. mightThrow = function mightThrow() {
  39490. var returned, then;
  39491. // Support: Promises/A+ section 2.3.3.3.3
  39492. // https://promisesaplus.com/#point-59
  39493. // Ignore double-resolution attempts
  39494. if (depth < maxDepth) {
  39495. return;
  39496. }
  39497. returned = handler.apply(that, args);
  39498. // Support: Promises/A+ section 2.3.1
  39499. // https://promisesaplus.com/#point-48
  39500. if (returned === deferred.promise()) {
  39501. throw new TypeError("Thenable self-resolution");
  39502. }
  39503. // Support: Promises/A+ sections 2.3.3.1, 3.5
  39504. // https://promisesaplus.com/#point-54
  39505. // https://promisesaplus.com/#point-75
  39506. // Retrieve `then` only once
  39507. then = returned && (
  39508. // Support: Promises/A+ section 2.3.4
  39509. // https://promisesaplus.com/#point-64
  39510. // Only check objects and functions for thenability
  39511. (typeof returned === "undefined" ? "undefined" : _typeof(returned)) === "object" || typeof returned === "function") && returned.then;
  39512. // Handle a returned thenable
  39513. if (isFunction(then)) {
  39514. // Special processors (notify) just wait for resolution
  39515. if (special) {
  39516. then.call(returned, resolve(maxDepth, deferred, Identity, special), resolve(maxDepth, deferred, Thrower, special));
  39517. // Normal processors (resolve) also hook into progress
  39518. } else {
  39519. // ...and disregard older resolution values
  39520. maxDepth++;
  39521. then.call(returned, resolve(maxDepth, deferred, Identity, special), resolve(maxDepth, deferred, Thrower, special), resolve(maxDepth, deferred, Identity, deferred.notifyWith));
  39522. }
  39523. // Handle all other returned values
  39524. } else {
  39525. // Only substitute handlers pass on context
  39526. // and multiple values (non-spec behavior)
  39527. if (handler !== Identity) {
  39528. that = undefined;
  39529. args = [returned];
  39530. }
  39531. // Process the value(s)
  39532. // Default process is resolve
  39533. (special || deferred.resolveWith)(that, args);
  39534. }
  39535. },
  39536. // Only normal processors (resolve) catch and reject exceptions
  39537. process = special ? mightThrow : function () {
  39538. try {
  39539. mightThrow();
  39540. } catch (e) {
  39541. if (jQuery.Deferred.exceptionHook) {
  39542. jQuery.Deferred.exceptionHook(e, process.stackTrace);
  39543. }
  39544. // Support: Promises/A+ section 2.3.3.3.4.1
  39545. // https://promisesaplus.com/#point-61
  39546. // Ignore post-resolution exceptions
  39547. if (depth + 1 >= maxDepth) {
  39548. // Only substitute handlers pass on context
  39549. // and multiple values (non-spec behavior)
  39550. if (handler !== Thrower) {
  39551. that = undefined;
  39552. args = [e];
  39553. }
  39554. deferred.rejectWith(that, args);
  39555. }
  39556. }
  39557. };
  39558. // Support: Promises/A+ section 2.3.3.3.1
  39559. // https://promisesaplus.com/#point-57
  39560. // Re-resolve promises immediately to dodge false rejection from
  39561. // subsequent errors
  39562. if (depth) {
  39563. process();
  39564. } else {
  39565. // Call an optional hook to record the stack, in case of exception
  39566. // since it's otherwise lost when execution goes async
  39567. if (jQuery.Deferred.getStackHook) {
  39568. process.stackTrace = jQuery.Deferred.getStackHook();
  39569. }
  39570. window.setTimeout(process);
  39571. }
  39572. };
  39573. }
  39574. return jQuery.Deferred(function (newDefer) {
  39575. // progress_handlers.add( ... )
  39576. tuples[0][3].add(resolve(0, newDefer, isFunction(onProgress) ? onProgress : Identity, newDefer.notifyWith));
  39577. // fulfilled_handlers.add( ... )
  39578. tuples[1][3].add(resolve(0, newDefer, isFunction(onFulfilled) ? onFulfilled : Identity));
  39579. // rejected_handlers.add( ... )
  39580. tuples[2][3].add(resolve(0, newDefer, isFunction(onRejected) ? onRejected : Thrower));
  39581. }).promise();
  39582. },
  39583. // Get a promise for this deferred
  39584. // If obj is provided, the promise aspect is added to the object
  39585. promise: function promise(obj) {
  39586. return obj != null ? jQuery.extend(obj, _promise) : _promise;
  39587. }
  39588. },
  39589. deferred = {};
  39590. // Add list-specific methods
  39591. jQuery.each(tuples, function (i, tuple) {
  39592. var list = tuple[2],
  39593. stateString = tuple[5];
  39594. // promise.progress = list.add
  39595. // promise.done = list.add
  39596. // promise.fail = list.add
  39597. _promise[tuple[1]] = list.add;
  39598. // Handle state
  39599. if (stateString) {
  39600. list.add(function () {
  39601. // state = "resolved" (i.e., fulfilled)
  39602. // state = "rejected"
  39603. _state = stateString;
  39604. },
  39605. // rejected_callbacks.disable
  39606. // fulfilled_callbacks.disable
  39607. tuples[3 - i][2].disable,
  39608. // rejected_handlers.disable
  39609. // fulfilled_handlers.disable
  39610. tuples[3 - i][3].disable,
  39611. // progress_callbacks.lock
  39612. tuples[0][2].lock,
  39613. // progress_handlers.lock
  39614. tuples[0][3].lock);
  39615. }
  39616. // progress_handlers.fire
  39617. // fulfilled_handlers.fire
  39618. // rejected_handlers.fire
  39619. list.add(tuple[3].fire);
  39620. // deferred.notify = function() { deferred.notifyWith(...) }
  39621. // deferred.resolve = function() { deferred.resolveWith(...) }
  39622. // deferred.reject = function() { deferred.rejectWith(...) }
  39623. deferred[tuple[0]] = function () {
  39624. deferred[tuple[0] + "With"](this === deferred ? undefined : this, arguments);
  39625. return this;
  39626. };
  39627. // deferred.notifyWith = list.fireWith
  39628. // deferred.resolveWith = list.fireWith
  39629. // deferred.rejectWith = list.fireWith
  39630. deferred[tuple[0] + "With"] = list.fireWith;
  39631. });
  39632. // Make the deferred a promise
  39633. _promise.promise(deferred);
  39634. // Call given func if any
  39635. if (func) {
  39636. func.call(deferred, deferred);
  39637. }
  39638. // All done!
  39639. return deferred;
  39640. },
  39641. // Deferred helper
  39642. when: function when(singleValue) {
  39643. var
  39644. // count of uncompleted subordinates
  39645. remaining = arguments.length,
  39646. // count of unprocessed arguments
  39647. i = remaining,
  39648. // subordinate fulfillment data
  39649. resolveContexts = Array(i),
  39650. resolveValues = _slice.call(arguments),
  39651. // the master Deferred
  39652. master = jQuery.Deferred(),
  39653. // subordinate callback factory
  39654. updateFunc = function updateFunc(i) {
  39655. return function (value) {
  39656. resolveContexts[i] = this;
  39657. resolveValues[i] = arguments.length > 1 ? _slice.call(arguments) : value;
  39658. if (! --remaining) {
  39659. master.resolveWith(resolveContexts, resolveValues);
  39660. }
  39661. };
  39662. };
  39663. // Single- and empty arguments are adopted like Promise.resolve
  39664. if (remaining <= 1) {
  39665. adoptValue(singleValue, master.done(updateFunc(i)).resolve, master.reject, !remaining);
  39666. // Use .then() to unwrap secondary thenables (cf. gh-3000)
  39667. if (master.state() === "pending" || isFunction(resolveValues[i] && resolveValues[i].then)) {
  39668. return master.then();
  39669. }
  39670. }
  39671. // Multiple arguments are aggregated like Promise.all array elements
  39672. while (i--) {
  39673. adoptValue(resolveValues[i], updateFunc(i), master.reject);
  39674. }
  39675. return master.promise();
  39676. }
  39677. });
  39678. // These usually indicate a programmer mistake during development,
  39679. // warn about them ASAP rather than swallowing them by default.
  39680. var rerrorNames = /^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;
  39681. jQuery.Deferred.exceptionHook = function (error, stack) {
  39682. // Support: IE 8 - 9 only
  39683. // Console exists when dev tools are open, which can happen at any time
  39684. if (window.console && window.console.warn && error && rerrorNames.test(error.name)) {
  39685. window.console.warn("jQuery.Deferred exception: " + error.message, error.stack, stack);
  39686. }
  39687. };
  39688. jQuery.readyException = function (error) {
  39689. window.setTimeout(function () {
  39690. throw error;
  39691. });
  39692. };
  39693. // The deferred used on DOM ready
  39694. var readyList = jQuery.Deferred();
  39695. jQuery.fn.ready = function (fn) {
  39696. readyList.then(fn)
  39697. // Wrap jQuery.readyException in a function so that the lookup
  39698. // happens at the time of error handling instead of callback
  39699. // registration.
  39700. .catch(function (error) {
  39701. jQuery.readyException(error);
  39702. });
  39703. return this;
  39704. };
  39705. jQuery.extend({
  39706. // Is the DOM ready to be used? Set to true once it occurs.
  39707. isReady: false,
  39708. // A counter to track how many items to wait for before
  39709. // the ready event fires. See #6781
  39710. readyWait: 1,
  39711. // Handle when the DOM is ready
  39712. ready: function ready(wait) {
  39713. // Abort if there are pending holds or we're already ready
  39714. if (wait === true ? --jQuery.readyWait : jQuery.isReady) {
  39715. return;
  39716. }
  39717. // Remember that the DOM is ready
  39718. jQuery.isReady = true;
  39719. // If a normal DOM Ready event fired, decrement, and wait if need be
  39720. if (wait !== true && --jQuery.readyWait > 0) {
  39721. return;
  39722. }
  39723. // If there are functions bound, to execute
  39724. readyList.resolveWith(document, [jQuery]);
  39725. }
  39726. });
  39727. jQuery.ready.then = readyList.then;
  39728. // The ready event handler and self cleanup method
  39729. function completed() {
  39730. document.removeEventListener("DOMContentLoaded", completed);
  39731. window.removeEventListener("load", completed);
  39732. jQuery.ready();
  39733. }
  39734. // Catch cases where $(document).ready() is called
  39735. // after the browser event has already occurred.
  39736. // Support: IE <=9 - 10 only
  39737. // Older IE sometimes signals "interactive" too soon
  39738. if (document.readyState === "complete" || document.readyState !== "loading" && !document.documentElement.doScroll) {
  39739. // Handle it asynchronously to allow scripts the opportunity to delay ready
  39740. window.setTimeout(jQuery.ready);
  39741. } else {
  39742. // Use the handy event callback
  39743. document.addEventListener("DOMContentLoaded", completed);
  39744. // A fallback to window.onload, that will always work
  39745. window.addEventListener("load", completed);
  39746. }
  39747. // Multifunctional method to get and set values of a collection
  39748. // The value/s can optionally be executed if it's a function
  39749. var access = function access(elems, fn, key, value, chainable, emptyGet, raw) {
  39750. var i = 0,
  39751. len = elems.length,
  39752. bulk = key == null;
  39753. // Sets many values
  39754. if (toType(key) === "object") {
  39755. chainable = true;
  39756. for (i in key) {
  39757. access(elems, fn, i, key[i], true, emptyGet, raw);
  39758. }
  39759. // Sets one value
  39760. } else if (value !== undefined) {
  39761. chainable = true;
  39762. if (!isFunction(value)) {
  39763. raw = true;
  39764. }
  39765. if (bulk) {
  39766. // Bulk operations run against the entire set
  39767. if (raw) {
  39768. fn.call(elems, value);
  39769. fn = null;
  39770. // ...except when executing function values
  39771. } else {
  39772. bulk = fn;
  39773. fn = function fn(elem, key, value) {
  39774. return bulk.call(jQuery(elem), value);
  39775. };
  39776. }
  39777. }
  39778. if (fn) {
  39779. for (; i < len; i++) {
  39780. fn(elems[i], key, raw ? value : value.call(elems[i], i, fn(elems[i], key)));
  39781. }
  39782. }
  39783. }
  39784. if (chainable) {
  39785. return elems;
  39786. }
  39787. // Gets
  39788. if (bulk) {
  39789. return fn.call(elems);
  39790. }
  39791. return len ? fn(elems[0], key) : emptyGet;
  39792. };
  39793. // Matches dashed string for camelizing
  39794. var rmsPrefix = /^-ms-/,
  39795. rdashAlpha = /-([a-z])/g;
  39796. // Used by camelCase as callback to replace()
  39797. function fcamelCase(all, letter) {
  39798. return letter.toUpperCase();
  39799. }
  39800. // Convert dashed to camelCase; used by the css and data modules
  39801. // Support: IE <=9 - 11, Edge 12 - 15
  39802. // Microsoft forgot to hump their vendor prefix (#9572)
  39803. function camelCase(string) {
  39804. return string.replace(rmsPrefix, "ms-").replace(rdashAlpha, fcamelCase);
  39805. }
  39806. var acceptData = function acceptData(owner) {
  39807. // Accepts only:
  39808. // - Node
  39809. // - Node.ELEMENT_NODE
  39810. // - Node.DOCUMENT_NODE
  39811. // - Object
  39812. // - Any
  39813. return owner.nodeType === 1 || owner.nodeType === 9 || !+owner.nodeType;
  39814. };
  39815. function Data() {
  39816. this.expando = jQuery.expando + Data.uid++;
  39817. }
  39818. Data.uid = 1;
  39819. Data.prototype = {
  39820. cache: function cache(owner) {
  39821. // Check if the owner object already has a cache
  39822. var value = owner[this.expando];
  39823. // If not, create one
  39824. if (!value) {
  39825. value = {};
  39826. // We can accept data for non-element nodes in modern browsers,
  39827. // but we should not, see #8335.
  39828. // Always return an empty object.
  39829. if (acceptData(owner)) {
  39830. // If it is a node unlikely to be stringify-ed or looped over
  39831. // use plain assignment
  39832. if (owner.nodeType) {
  39833. owner[this.expando] = value;
  39834. // Otherwise secure it in a non-enumerable property
  39835. // configurable must be true to allow the property to be
  39836. // deleted when data is removed
  39837. } else {
  39838. Object.defineProperty(owner, this.expando, {
  39839. value: value,
  39840. configurable: true
  39841. });
  39842. }
  39843. }
  39844. }
  39845. return value;
  39846. },
  39847. set: function set(owner, data, value) {
  39848. var prop,
  39849. cache = this.cache(owner);
  39850. // Handle: [ owner, key, value ] args
  39851. // Always use camelCase key (gh-2257)
  39852. if (typeof data === "string") {
  39853. cache[camelCase(data)] = value;
  39854. // Handle: [ owner, { properties } ] args
  39855. } else {
  39856. // Copy the properties one-by-one to the cache object
  39857. for (prop in data) {
  39858. cache[camelCase(prop)] = data[prop];
  39859. }
  39860. }
  39861. return cache;
  39862. },
  39863. get: function get(owner, key) {
  39864. return key === undefined ? this.cache(owner) :
  39865. // Always use camelCase key (gh-2257)
  39866. owner[this.expando] && owner[this.expando][camelCase(key)];
  39867. },
  39868. access: function access(owner, key, value) {
  39869. // In cases where either:
  39870. //
  39871. // 1. No key was specified
  39872. // 2. A string key was specified, but no value provided
  39873. //
  39874. // Take the "read" path and allow the get method to determine
  39875. // which value to return, respectively either:
  39876. //
  39877. // 1. The entire cache object
  39878. // 2. The data stored at the key
  39879. //
  39880. if (key === undefined || key && typeof key === "string" && value === undefined) {
  39881. return this.get(owner, key);
  39882. }
  39883. // When the key is not a string, or both a key and value
  39884. // are specified, set or extend (existing objects) with either:
  39885. //
  39886. // 1. An object of properties
  39887. // 2. A key and value
  39888. //
  39889. this.set(owner, key, value);
  39890. // Since the "set" path can have two possible entry points
  39891. // return the expected data based on which path was taken[*]
  39892. return value !== undefined ? value : key;
  39893. },
  39894. remove: function remove(owner, key) {
  39895. var i,
  39896. cache = owner[this.expando];
  39897. if (cache === undefined) {
  39898. return;
  39899. }
  39900. if (key !== undefined) {
  39901. // Support array or space separated string of keys
  39902. if (Array.isArray(key)) {
  39903. // If key is an array of keys...
  39904. // We always set camelCase keys, so remove that.
  39905. key = key.map(camelCase);
  39906. } else {
  39907. key = camelCase(key);
  39908. // If a key with the spaces exists, use it.
  39909. // Otherwise, create an array by matching non-whitespace
  39910. key = key in cache ? [key] : key.match(rnothtmlwhite) || [];
  39911. }
  39912. i = key.length;
  39913. while (i--) {
  39914. delete cache[key[i]];
  39915. }
  39916. }
  39917. // Remove the expando if there's no more data
  39918. if (key === undefined || jQuery.isEmptyObject(cache)) {
  39919. // Support: Chrome <=35 - 45
  39920. // Webkit & Blink performance suffers when deleting properties
  39921. // from DOM nodes, so set to undefined instead
  39922. // https://bugs.chromium.org/p/chromium/issues/detail?id=378607 (bug restricted)
  39923. if (owner.nodeType) {
  39924. owner[this.expando] = undefined;
  39925. } else {
  39926. delete owner[this.expando];
  39927. }
  39928. }
  39929. },
  39930. hasData: function hasData(owner) {
  39931. var cache = owner[this.expando];
  39932. return cache !== undefined && !jQuery.isEmptyObject(cache);
  39933. }
  39934. };
  39935. var dataPriv = new Data();
  39936. var dataUser = new Data();
  39937. // Implementation Summary
  39938. //
  39939. // 1. Enforce API surface and semantic compatibility with 1.9.x branch
  39940. // 2. Improve the module's maintainability by reducing the storage
  39941. // paths to a single mechanism.
  39942. // 3. Use the same single mechanism to support "private" and "user" data.
  39943. // 4. _Never_ expose "private" data to user code (TODO: Drop _data, _removeData)
  39944. // 5. Avoid exposing implementation details on user objects (eg. expando properties)
  39945. // 6. Provide a clear path for implementation upgrade to WeakMap in 2014
  39946. var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,
  39947. rmultiDash = /[A-Z]/g;
  39948. function getData(data) {
  39949. if (data === "true") {
  39950. return true;
  39951. }
  39952. if (data === "false") {
  39953. return false;
  39954. }
  39955. if (data === "null") {
  39956. return null;
  39957. }
  39958. // Only convert to a number if it doesn't change the string
  39959. if (data === +data + "") {
  39960. return +data;
  39961. }
  39962. if (rbrace.test(data)) {
  39963. return JSON.parse(data);
  39964. }
  39965. return data;
  39966. }
  39967. function dataAttr(elem, key, data) {
  39968. var name;
  39969. // If nothing was found internally, try to fetch any
  39970. // data from the HTML5 data-* attribute
  39971. if (data === undefined && elem.nodeType === 1) {
  39972. name = "data-" + key.replace(rmultiDash, "-$&").toLowerCase();
  39973. data = elem.getAttribute(name);
  39974. if (typeof data === "string") {
  39975. try {
  39976. data = getData(data);
  39977. } catch (e) {}
  39978. // Make sure we set the data so it isn't changed later
  39979. dataUser.set(elem, key, data);
  39980. } else {
  39981. data = undefined;
  39982. }
  39983. }
  39984. return data;
  39985. }
  39986. jQuery.extend({
  39987. hasData: function hasData(elem) {
  39988. return dataUser.hasData(elem) || dataPriv.hasData(elem);
  39989. },
  39990. data: function data(elem, name, _data) {
  39991. return dataUser.access(elem, name, _data);
  39992. },
  39993. removeData: function removeData(elem, name) {
  39994. dataUser.remove(elem, name);
  39995. },
  39996. // TODO: Now that all calls to _data and _removeData have been replaced
  39997. // with direct calls to dataPriv methods, these can be deprecated.
  39998. _data: function _data(elem, name, data) {
  39999. return dataPriv.access(elem, name, data);
  40000. },
  40001. _removeData: function _removeData(elem, name) {
  40002. dataPriv.remove(elem, name);
  40003. }
  40004. });
  40005. jQuery.fn.extend({
  40006. data: function data(key, value) {
  40007. var i,
  40008. name,
  40009. data,
  40010. elem = this[0],
  40011. attrs = elem && elem.attributes;
  40012. // Gets all values
  40013. if (key === undefined) {
  40014. if (this.length) {
  40015. data = dataUser.get(elem);
  40016. if (elem.nodeType === 1 && !dataPriv.get(elem, "hasDataAttrs")) {
  40017. i = attrs.length;
  40018. while (i--) {
  40019. // Support: IE 11 only
  40020. // The attrs elements can be null (#14894)
  40021. if (attrs[i]) {
  40022. name = attrs[i].name;
  40023. if (name.indexOf("data-") === 0) {
  40024. name = camelCase(name.slice(5));
  40025. dataAttr(elem, name, data[name]);
  40026. }
  40027. }
  40028. }
  40029. dataPriv.set(elem, "hasDataAttrs", true);
  40030. }
  40031. }
  40032. return data;
  40033. }
  40034. // Sets multiple values
  40035. if ((typeof key === "undefined" ? "undefined" : _typeof(key)) === "object") {
  40036. return this.each(function () {
  40037. dataUser.set(this, key);
  40038. });
  40039. }
  40040. return access(this, function (value) {
  40041. var data;
  40042. // The calling jQuery object (element matches) is not empty
  40043. // (and therefore has an element appears at this[ 0 ]) and the
  40044. // `value` parameter was not undefined. An empty jQuery object
  40045. // will result in `undefined` for elem = this[ 0 ] which will
  40046. // throw an exception if an attempt to read a data cache is made.
  40047. if (elem && value === undefined) {
  40048. // Attempt to get data from the cache
  40049. // The key will always be camelCased in Data
  40050. data = dataUser.get(elem, key);
  40051. if (data !== undefined) {
  40052. return data;
  40053. }
  40054. // Attempt to "discover" the data in
  40055. // HTML5 custom data-* attrs
  40056. data = dataAttr(elem, key);
  40057. if (data !== undefined) {
  40058. return data;
  40059. }
  40060. // We tried really hard, but the data doesn't exist.
  40061. return;
  40062. }
  40063. // Set the data...
  40064. this.each(function () {
  40065. // We always store the camelCased key
  40066. dataUser.set(this, key, value);
  40067. });
  40068. }, null, value, arguments.length > 1, null, true);
  40069. },
  40070. removeData: function removeData(key) {
  40071. return this.each(function () {
  40072. dataUser.remove(this, key);
  40073. });
  40074. }
  40075. });
  40076. jQuery.extend({
  40077. queue: function queue(elem, type, data) {
  40078. var queue;
  40079. if (elem) {
  40080. type = (type || "fx") + "queue";
  40081. queue = dataPriv.get(elem, type);
  40082. // Speed up dequeue by getting out quickly if this is just a lookup
  40083. if (data) {
  40084. if (!queue || Array.isArray(data)) {
  40085. queue = dataPriv.access(elem, type, jQuery.makeArray(data));
  40086. } else {
  40087. queue.push(data);
  40088. }
  40089. }
  40090. return queue || [];
  40091. }
  40092. },
  40093. dequeue: function dequeue(elem, type) {
  40094. type = type || "fx";
  40095. var queue = jQuery.queue(elem, type),
  40096. startLength = queue.length,
  40097. fn = queue.shift(),
  40098. hooks = jQuery._queueHooks(elem, type),
  40099. next = function next() {
  40100. jQuery.dequeue(elem, type);
  40101. };
  40102. // If the fx queue is dequeued, always remove the progress sentinel
  40103. if (fn === "inprogress") {
  40104. fn = queue.shift();
  40105. startLength--;
  40106. }
  40107. if (fn) {
  40108. // Add a progress sentinel to prevent the fx queue from being
  40109. // automatically dequeued
  40110. if (type === "fx") {
  40111. queue.unshift("inprogress");
  40112. }
  40113. // Clear up the last queue stop function
  40114. delete hooks.stop;
  40115. fn.call(elem, next, hooks);
  40116. }
  40117. if (!startLength && hooks) {
  40118. hooks.empty.fire();
  40119. }
  40120. },
  40121. // Not public - generate a queueHooks object, or return the current one
  40122. _queueHooks: function _queueHooks(elem, type) {
  40123. var key = type + "queueHooks";
  40124. return dataPriv.get(elem, key) || dataPriv.access(elem, key, {
  40125. empty: jQuery.Callbacks("once memory").add(function () {
  40126. dataPriv.remove(elem, [type + "queue", key]);
  40127. })
  40128. });
  40129. }
  40130. });
  40131. jQuery.fn.extend({
  40132. queue: function queue(type, data) {
  40133. var setter = 2;
  40134. if (typeof type !== "string") {
  40135. data = type;
  40136. type = "fx";
  40137. setter--;
  40138. }
  40139. if (arguments.length < setter) {
  40140. return jQuery.queue(this[0], type);
  40141. }
  40142. return data === undefined ? this : this.each(function () {
  40143. var queue = jQuery.queue(this, type, data);
  40144. // Ensure a hooks for this queue
  40145. jQuery._queueHooks(this, type);
  40146. if (type === "fx" && queue[0] !== "inprogress") {
  40147. jQuery.dequeue(this, type);
  40148. }
  40149. });
  40150. },
  40151. dequeue: function dequeue(type) {
  40152. return this.each(function () {
  40153. jQuery.dequeue(this, type);
  40154. });
  40155. },
  40156. clearQueue: function clearQueue(type) {
  40157. return this.queue(type || "fx", []);
  40158. },
  40159. // Get a promise resolved when queues of a certain type
  40160. // are emptied (fx is the type by default)
  40161. promise: function promise(type, obj) {
  40162. var tmp,
  40163. count = 1,
  40164. defer = jQuery.Deferred(),
  40165. elements = this,
  40166. i = this.length,
  40167. resolve = function resolve() {
  40168. if (! --count) {
  40169. defer.resolveWith(elements, [elements]);
  40170. }
  40171. };
  40172. if (typeof type !== "string") {
  40173. obj = type;
  40174. type = undefined;
  40175. }
  40176. type = type || "fx";
  40177. while (i--) {
  40178. tmp = dataPriv.get(elements[i], type + "queueHooks");
  40179. if (tmp && tmp.empty) {
  40180. count++;
  40181. tmp.empty.add(resolve);
  40182. }
  40183. }
  40184. resolve();
  40185. return defer.promise(obj);
  40186. }
  40187. });
  40188. var pnum = /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source;
  40189. var rcssNum = new RegExp("^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i");
  40190. var cssExpand = ["Top", "Right", "Bottom", "Left"];
  40191. var isHiddenWithinTree = function isHiddenWithinTree(elem, el) {
  40192. // isHiddenWithinTree might be called from jQuery#filter function;
  40193. // in that case, element will be second argument
  40194. elem = el || elem;
  40195. // Inline style trumps all
  40196. return elem.style.display === "none" || elem.style.display === "" &&
  40197. // Otherwise, check computed style
  40198. // Support: Firefox <=43 - 45
  40199. // Disconnected elements can have computed display: none, so first confirm that elem is
  40200. // in the document.
  40201. jQuery.contains(elem.ownerDocument, elem) && jQuery.css(elem, "display") === "none";
  40202. };
  40203. var swap = function swap(elem, options, callback, args) {
  40204. var ret,
  40205. name,
  40206. old = {};
  40207. // Remember the old values, and insert the new ones
  40208. for (name in options) {
  40209. old[name] = elem.style[name];
  40210. elem.style[name] = options[name];
  40211. }
  40212. ret = callback.apply(elem, args || []);
  40213. // Revert the old values
  40214. for (name in options) {
  40215. elem.style[name] = old[name];
  40216. }
  40217. return ret;
  40218. };
  40219. function adjustCSS(elem, prop, valueParts, tween) {
  40220. var adjusted,
  40221. scale,
  40222. maxIterations = 20,
  40223. currentValue = tween ? function () {
  40224. return tween.cur();
  40225. } : function () {
  40226. return jQuery.css(elem, prop, "");
  40227. },
  40228. initial = currentValue(),
  40229. unit = valueParts && valueParts[3] || (jQuery.cssNumber[prop] ? "" : "px"),
  40230. // Starting value computation is required for potential unit mismatches
  40231. initialInUnit = (jQuery.cssNumber[prop] || unit !== "px" && +initial) && rcssNum.exec(jQuery.css(elem, prop));
  40232. if (initialInUnit && initialInUnit[3] !== unit) {
  40233. // Support: Firefox <=54
  40234. // Halve the iteration target value to prevent interference from CSS upper bounds (gh-2144)
  40235. initial = initial / 2;
  40236. // Trust units reported by jQuery.css
  40237. unit = unit || initialInUnit[3];
  40238. // Iteratively approximate from a nonzero starting point
  40239. initialInUnit = +initial || 1;
  40240. while (maxIterations--) {
  40241. // Evaluate and update our best guess (doubling guesses that zero out).
  40242. // Finish if the scale equals or crosses 1 (making the old*new product non-positive).
  40243. jQuery.style(elem, prop, initialInUnit + unit);
  40244. if ((1 - scale) * (1 - (scale = currentValue() / initial || 0.5)) <= 0) {
  40245. maxIterations = 0;
  40246. }
  40247. initialInUnit = initialInUnit / scale;
  40248. }
  40249. initialInUnit = initialInUnit * 2;
  40250. jQuery.style(elem, prop, initialInUnit + unit);
  40251. // Make sure we update the tween properties later on
  40252. valueParts = valueParts || [];
  40253. }
  40254. if (valueParts) {
  40255. initialInUnit = +initialInUnit || +initial || 0;
  40256. // Apply relative offset (+=/-=) if specified
  40257. adjusted = valueParts[1] ? initialInUnit + (valueParts[1] + 1) * valueParts[2] : +valueParts[2];
  40258. if (tween) {
  40259. tween.unit = unit;
  40260. tween.start = initialInUnit;
  40261. tween.end = adjusted;
  40262. }
  40263. }
  40264. return adjusted;
  40265. }
  40266. var defaultDisplayMap = {};
  40267. function getDefaultDisplay(elem) {
  40268. var temp,
  40269. doc = elem.ownerDocument,
  40270. nodeName = elem.nodeName,
  40271. display = defaultDisplayMap[nodeName];
  40272. if (display) {
  40273. return display;
  40274. }
  40275. temp = doc.body.appendChild(doc.createElement(nodeName));
  40276. display = jQuery.css(temp, "display");
  40277. temp.parentNode.removeChild(temp);
  40278. if (display === "none") {
  40279. display = "block";
  40280. }
  40281. defaultDisplayMap[nodeName] = display;
  40282. return display;
  40283. }
  40284. function showHide(elements, show) {
  40285. var display,
  40286. elem,
  40287. values = [],
  40288. index = 0,
  40289. length = elements.length;
  40290. // Determine new display value for elements that need to change
  40291. for (; index < length; index++) {
  40292. elem = elements[index];
  40293. if (!elem.style) {
  40294. continue;
  40295. }
  40296. display = elem.style.display;
  40297. if (show) {
  40298. // Since we force visibility upon cascade-hidden elements, an immediate (and slow)
  40299. // check is required in this first loop unless we have a nonempty display value (either
  40300. // inline or about-to-be-restored)
  40301. if (display === "none") {
  40302. values[index] = dataPriv.get(elem, "display") || null;
  40303. if (!values[index]) {
  40304. elem.style.display = "";
  40305. }
  40306. }
  40307. if (elem.style.display === "" && isHiddenWithinTree(elem)) {
  40308. values[index] = getDefaultDisplay(elem);
  40309. }
  40310. } else {
  40311. if (display !== "none") {
  40312. values[index] = "none";
  40313. // Remember what we're overwriting
  40314. dataPriv.set(elem, "display", display);
  40315. }
  40316. }
  40317. }
  40318. // Set the display of the elements in a second loop to avoid constant reflow
  40319. for (index = 0; index < length; index++) {
  40320. if (values[index] != null) {
  40321. elements[index].style.display = values[index];
  40322. }
  40323. }
  40324. return elements;
  40325. }
  40326. jQuery.fn.extend({
  40327. show: function show() {
  40328. return showHide(this, true);
  40329. },
  40330. hide: function hide() {
  40331. return showHide(this);
  40332. },
  40333. toggle: function toggle(state) {
  40334. if (typeof state === "boolean") {
  40335. return state ? this.show() : this.hide();
  40336. }
  40337. return this.each(function () {
  40338. if (isHiddenWithinTree(this)) {
  40339. jQuery(this).show();
  40340. } else {
  40341. jQuery(this).hide();
  40342. }
  40343. });
  40344. }
  40345. });
  40346. var rcheckableType = /^(?:checkbox|radio)$/i;
  40347. var rtagName = /<([a-z][^\/\0>\x20\t\r\n\f]+)/i;
  40348. var rscriptType = /^$|^module$|\/(?:java|ecma)script/i;
  40349. // We have to close these tags to support XHTML (#13200)
  40350. var wrapMap = {
  40351. // Support: IE <=9 only
  40352. option: [1, "<select multiple='multiple'>", "</select>"],
  40353. // XHTML parsers do not magically insert elements in the
  40354. // same way that tag soup parsers do. So we cannot shorten
  40355. // this by omitting <tbody> or other required elements.
  40356. thead: [1, "<table>", "</table>"],
  40357. col: [2, "<table><colgroup>", "</colgroup></table>"],
  40358. tr: [2, "<table><tbody>", "</tbody></table>"],
  40359. td: [3, "<table><tbody><tr>", "</tr></tbody></table>"],
  40360. _default: [0, "", ""]
  40361. };
  40362. // Support: IE <=9 only
  40363. wrapMap.optgroup = wrapMap.option;
  40364. wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
  40365. wrapMap.th = wrapMap.td;
  40366. function getAll(context, tag) {
  40367. // Support: IE <=9 - 11 only
  40368. // Use typeof to avoid zero-argument method invocation on host objects (#15151)
  40369. var ret;
  40370. if (typeof context.getElementsByTagName !== "undefined") {
  40371. ret = context.getElementsByTagName(tag || "*");
  40372. } else if (typeof context.querySelectorAll !== "undefined") {
  40373. ret = context.querySelectorAll(tag || "*");
  40374. } else {
  40375. ret = [];
  40376. }
  40377. if (tag === undefined || tag && nodeName(context, tag)) {
  40378. return jQuery.merge([context], ret);
  40379. }
  40380. return ret;
  40381. }
  40382. // Mark scripts as having already been evaluated
  40383. function setGlobalEval(elems, refElements) {
  40384. var i = 0,
  40385. l = elems.length;
  40386. for (; i < l; i++) {
  40387. dataPriv.set(elems[i], "globalEval", !refElements || dataPriv.get(refElements[i], "globalEval"));
  40388. }
  40389. }
  40390. var rhtml = /<|&#?\w+;/;
  40391. function buildFragment(elems, context, scripts, selection, ignored) {
  40392. var elem,
  40393. tmp,
  40394. tag,
  40395. wrap,
  40396. contains,
  40397. j,
  40398. fragment = context.createDocumentFragment(),
  40399. nodes = [],
  40400. i = 0,
  40401. l = elems.length;
  40402. for (; i < l; i++) {
  40403. elem = elems[i];
  40404. if (elem || elem === 0) {
  40405. // Add nodes directly
  40406. if (toType(elem) === "object") {
  40407. // Support: Android <=4.0 only, PhantomJS 1 only
  40408. // push.apply(_, arraylike) throws on ancient WebKit
  40409. jQuery.merge(nodes, elem.nodeType ? [elem] : elem);
  40410. // Convert non-html into a text node
  40411. } else if (!rhtml.test(elem)) {
  40412. nodes.push(context.createTextNode(elem));
  40413. // Convert html into DOM nodes
  40414. } else {
  40415. tmp = tmp || fragment.appendChild(context.createElement("div"));
  40416. // Deserialize a standard representation
  40417. tag = (rtagName.exec(elem) || ["", ""])[1].toLowerCase();
  40418. wrap = wrapMap[tag] || wrapMap._default;
  40419. tmp.innerHTML = wrap[1] + jQuery.htmlPrefilter(elem) + wrap[2];
  40420. // Descend through wrappers to the right content
  40421. j = wrap[0];
  40422. while (j--) {
  40423. tmp = tmp.lastChild;
  40424. }
  40425. // Support: Android <=4.0 only, PhantomJS 1 only
  40426. // push.apply(_, arraylike) throws on ancient WebKit
  40427. jQuery.merge(nodes, tmp.childNodes);
  40428. // Remember the top-level container
  40429. tmp = fragment.firstChild;
  40430. // Ensure the created nodes are orphaned (#12392)
  40431. tmp.textContent = "";
  40432. }
  40433. }
  40434. }
  40435. // Remove wrapper from fragment
  40436. fragment.textContent = "";
  40437. i = 0;
  40438. while (elem = nodes[i++]) {
  40439. // Skip elements already in the context collection (trac-4087)
  40440. if (selection && jQuery.inArray(elem, selection) > -1) {
  40441. if (ignored) {
  40442. ignored.push(elem);
  40443. }
  40444. continue;
  40445. }
  40446. contains = jQuery.contains(elem.ownerDocument, elem);
  40447. // Append to fragment
  40448. tmp = getAll(fragment.appendChild(elem), "script");
  40449. // Preserve script evaluation history
  40450. if (contains) {
  40451. setGlobalEval(tmp);
  40452. }
  40453. // Capture executables
  40454. if (scripts) {
  40455. j = 0;
  40456. while (elem = tmp[j++]) {
  40457. if (rscriptType.test(elem.type || "")) {
  40458. scripts.push(elem);
  40459. }
  40460. }
  40461. }
  40462. }
  40463. return fragment;
  40464. }
  40465. (function () {
  40466. var fragment = document.createDocumentFragment(),
  40467. div = fragment.appendChild(document.createElement("div")),
  40468. input = document.createElement("input");
  40469. // Support: Android 4.0 - 4.3 only
  40470. // Check state lost if the name is set (#11217)
  40471. // Support: Windows Web Apps (WWA)
  40472. // `name` and `type` must use .setAttribute for WWA (#14901)
  40473. input.setAttribute("type", "radio");
  40474. input.setAttribute("checked", "checked");
  40475. input.setAttribute("name", "t");
  40476. div.appendChild(input);
  40477. // Support: Android <=4.1 only
  40478. // Older WebKit doesn't clone checked state correctly in fragments
  40479. support.checkClone = div.cloneNode(true).cloneNode(true).lastChild.checked;
  40480. // Support: IE <=11 only
  40481. // Make sure textarea (and checkbox) defaultValue is properly cloned
  40482. div.innerHTML = "<textarea>x</textarea>";
  40483. support.noCloneChecked = !!div.cloneNode(true).lastChild.defaultValue;
  40484. })();
  40485. var documentElement = document.documentElement;
  40486. var rkeyEvent = /^key/,
  40487. rmouseEvent = /^(?:mouse|pointer|contextmenu|drag|drop)|click/,
  40488. rtypenamespace = /^([^.]*)(?:\.(.+)|)/;
  40489. function returnTrue() {
  40490. return true;
  40491. }
  40492. function returnFalse() {
  40493. return false;
  40494. }
  40495. // Support: IE <=9 only
  40496. // See #13393 for more info
  40497. function safeActiveElement() {
  40498. try {
  40499. return document.activeElement;
  40500. } catch (err) {}
  40501. }
  40502. function _on(elem, types, selector, data, fn, one) {
  40503. var origFn, type;
  40504. // Types can be a map of types/handlers
  40505. if ((typeof types === "undefined" ? "undefined" : _typeof(types)) === "object") {
  40506. // ( types-Object, selector, data )
  40507. if (typeof selector !== "string") {
  40508. // ( types-Object, data )
  40509. data = data || selector;
  40510. selector = undefined;
  40511. }
  40512. for (type in types) {
  40513. _on(elem, type, selector, data, types[type], one);
  40514. }
  40515. return elem;
  40516. }
  40517. if (data == null && fn == null) {
  40518. // ( types, fn )
  40519. fn = selector;
  40520. data = selector = undefined;
  40521. } else if (fn == null) {
  40522. if (typeof selector === "string") {
  40523. // ( types, selector, fn )
  40524. fn = data;
  40525. data = undefined;
  40526. } else {
  40527. // ( types, data, fn )
  40528. fn = data;
  40529. data = selector;
  40530. selector = undefined;
  40531. }
  40532. }
  40533. if (fn === false) {
  40534. fn = returnFalse;
  40535. } else if (!fn) {
  40536. return elem;
  40537. }
  40538. if (one === 1) {
  40539. origFn = fn;
  40540. fn = function fn(event) {
  40541. // Can use an empty set, since event contains the info
  40542. jQuery().off(event);
  40543. return origFn.apply(this, arguments);
  40544. };
  40545. // Use same guid so caller can remove using origFn
  40546. fn.guid = origFn.guid || (origFn.guid = jQuery.guid++);
  40547. }
  40548. return elem.each(function () {
  40549. jQuery.event.add(this, types, fn, data, selector);
  40550. });
  40551. }
  40552. /*
  40553. * Helper functions for managing events -- not part of the public interface.
  40554. * Props to Dean Edwards' addEvent library for many of the ideas.
  40555. */
  40556. jQuery.event = {
  40557. global: {},
  40558. add: function add(elem, types, handler, data, selector) {
  40559. var handleObjIn,
  40560. eventHandle,
  40561. tmp,
  40562. events,
  40563. t,
  40564. handleObj,
  40565. special,
  40566. handlers,
  40567. type,
  40568. namespaces,
  40569. origType,
  40570. elemData = dataPriv.get(elem);
  40571. // Don't attach events to noData or text/comment nodes (but allow plain objects)
  40572. if (!elemData) {
  40573. return;
  40574. }
  40575. // Caller can pass in an object of custom data in lieu of the handler
  40576. if (handler.handler) {
  40577. handleObjIn = handler;
  40578. handler = handleObjIn.handler;
  40579. selector = handleObjIn.selector;
  40580. }
  40581. // Ensure that invalid selectors throw exceptions at attach time
  40582. // Evaluate against documentElement in case elem is a non-element node (e.g., document)
  40583. if (selector) {
  40584. jQuery.find.matchesSelector(documentElement, selector);
  40585. }
  40586. // Make sure that the handler has a unique ID, used to find/remove it later
  40587. if (!handler.guid) {
  40588. handler.guid = jQuery.guid++;
  40589. }
  40590. // Init the element's event structure and main handler, if this is the first
  40591. if (!(events = elemData.events)) {
  40592. events = elemData.events = {};
  40593. }
  40594. if (!(eventHandle = elemData.handle)) {
  40595. eventHandle = elemData.handle = function (e) {
  40596. // Discard the second event of a jQuery.event.trigger() and
  40597. // when an event is called after a page has unloaded
  40598. return typeof jQuery !== "undefined" && jQuery.event.triggered !== e.type ? jQuery.event.dispatch.apply(elem, arguments) : undefined;
  40599. };
  40600. }
  40601. // Handle multiple events separated by a space
  40602. types = (types || "").match(rnothtmlwhite) || [""];
  40603. t = types.length;
  40604. while (t--) {
  40605. tmp = rtypenamespace.exec(types[t]) || [];
  40606. type = origType = tmp[1];
  40607. namespaces = (tmp[2] || "").split(".").sort();
  40608. // There *must* be a type, no attaching namespace-only handlers
  40609. if (!type) {
  40610. continue;
  40611. }
  40612. // If event changes its type, use the special event handlers for the changed type
  40613. special = jQuery.event.special[type] || {};
  40614. // If selector defined, determine special event api type, otherwise given type
  40615. type = (selector ? special.delegateType : special.bindType) || type;
  40616. // Update special based on newly reset type
  40617. special = jQuery.event.special[type] || {};
  40618. // handleObj is passed to all event handlers
  40619. handleObj = jQuery.extend({
  40620. type: type,
  40621. origType: origType,
  40622. data: data,
  40623. handler: handler,
  40624. guid: handler.guid,
  40625. selector: selector,
  40626. needsContext: selector && jQuery.expr.match.needsContext.test(selector),
  40627. namespace: namespaces.join(".")
  40628. }, handleObjIn);
  40629. // Init the event handler queue if we're the first
  40630. if (!(handlers = events[type])) {
  40631. handlers = events[type] = [];
  40632. handlers.delegateCount = 0;
  40633. // Only use addEventListener if the special events handler returns false
  40634. if (!special.setup || special.setup.call(elem, data, namespaces, eventHandle) === false) {
  40635. if (elem.addEventListener) {
  40636. elem.addEventListener(type, eventHandle);
  40637. }
  40638. }
  40639. }
  40640. if (special.add) {
  40641. special.add.call(elem, handleObj);
  40642. if (!handleObj.handler.guid) {
  40643. handleObj.handler.guid = handler.guid;
  40644. }
  40645. }
  40646. // Add to the element's handler list, delegates in front
  40647. if (selector) {
  40648. handlers.splice(handlers.delegateCount++, 0, handleObj);
  40649. } else {
  40650. handlers.push(handleObj);
  40651. }
  40652. // Keep track of which events have ever been used, for event optimization
  40653. jQuery.event.global[type] = true;
  40654. }
  40655. },
  40656. // Detach an event or set of events from an element
  40657. remove: function remove(elem, types, handler, selector, mappedTypes) {
  40658. var j,
  40659. origCount,
  40660. tmp,
  40661. events,
  40662. t,
  40663. handleObj,
  40664. special,
  40665. handlers,
  40666. type,
  40667. namespaces,
  40668. origType,
  40669. elemData = dataPriv.hasData(elem) && dataPriv.get(elem);
  40670. if (!elemData || !(events = elemData.events)) {
  40671. return;
  40672. }
  40673. // Once for each type.namespace in types; type may be omitted
  40674. types = (types || "").match(rnothtmlwhite) || [""];
  40675. t = types.length;
  40676. while (t--) {
  40677. tmp = rtypenamespace.exec(types[t]) || [];
  40678. type = origType = tmp[1];
  40679. namespaces = (tmp[2] || "").split(".").sort();
  40680. // Unbind all events (on this namespace, if provided) for the element
  40681. if (!type) {
  40682. for (type in events) {
  40683. jQuery.event.remove(elem, type + types[t], handler, selector, true);
  40684. }
  40685. continue;
  40686. }
  40687. special = jQuery.event.special[type] || {};
  40688. type = (selector ? special.delegateType : special.bindType) || type;
  40689. handlers = events[type] || [];
  40690. tmp = tmp[2] && new RegExp("(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)");
  40691. // Remove matching events
  40692. origCount = j = handlers.length;
  40693. while (j--) {
  40694. handleObj = handlers[j];
  40695. if ((mappedTypes || origType === handleObj.origType) && (!handler || handler.guid === handleObj.guid) && (!tmp || tmp.test(handleObj.namespace)) && (!selector || selector === handleObj.selector || selector === "**" && handleObj.selector)) {
  40696. handlers.splice(j, 1);
  40697. if (handleObj.selector) {
  40698. handlers.delegateCount--;
  40699. }
  40700. if (special.remove) {
  40701. special.remove.call(elem, handleObj);
  40702. }
  40703. }
  40704. }
  40705. // Remove generic event handler if we removed something and no more handlers exist
  40706. // (avoids potential for endless recursion during removal of special event handlers)
  40707. if (origCount && !handlers.length) {
  40708. if (!special.teardown || special.teardown.call(elem, namespaces, elemData.handle) === false) {
  40709. jQuery.removeEvent(elem, type, elemData.handle);
  40710. }
  40711. delete events[type];
  40712. }
  40713. }
  40714. // Remove data and the expando if it's no longer used
  40715. if (jQuery.isEmptyObject(events)) {
  40716. dataPriv.remove(elem, "handle events");
  40717. }
  40718. },
  40719. dispatch: function dispatch(nativeEvent) {
  40720. // Make a writable jQuery.Event from the native event object
  40721. var event = jQuery.event.fix(nativeEvent);
  40722. var i,
  40723. j,
  40724. ret,
  40725. matched,
  40726. handleObj,
  40727. handlerQueue,
  40728. args = new Array(arguments.length),
  40729. handlers = (dataPriv.get(this, "events") || {})[event.type] || [],
  40730. special = jQuery.event.special[event.type] || {};
  40731. // Use the fix-ed jQuery.Event rather than the (read-only) native event
  40732. args[0] = event;
  40733. for (i = 1; i < arguments.length; i++) {
  40734. args[i] = arguments[i];
  40735. }
  40736. event.delegateTarget = this;
  40737. // Call the preDispatch hook for the mapped type, and let it bail if desired
  40738. if (special.preDispatch && special.preDispatch.call(this, event) === false) {
  40739. return;
  40740. }
  40741. // Determine handlers
  40742. handlerQueue = jQuery.event.handlers.call(this, event, handlers);
  40743. // Run delegates first; they may want to stop propagation beneath us
  40744. i = 0;
  40745. while ((matched = handlerQueue[i++]) && !event.isPropagationStopped()) {
  40746. event.currentTarget = matched.elem;
  40747. j = 0;
  40748. while ((handleObj = matched.handlers[j++]) && !event.isImmediatePropagationStopped()) {
  40749. // Triggered event must either 1) have no namespace, or 2) have namespace(s)
  40750. // a subset or equal to those in the bound event (both can have no namespace).
  40751. if (!event.rnamespace || event.rnamespace.test(handleObj.namespace)) {
  40752. event.handleObj = handleObj;
  40753. event.data = handleObj.data;
  40754. ret = ((jQuery.event.special[handleObj.origType] || {}).handle || handleObj.handler).apply(matched.elem, args);
  40755. if (ret !== undefined) {
  40756. if ((event.result = ret) === false) {
  40757. event.preventDefault();
  40758. event.stopPropagation();
  40759. }
  40760. }
  40761. }
  40762. }
  40763. }
  40764. // Call the postDispatch hook for the mapped type
  40765. if (special.postDispatch) {
  40766. special.postDispatch.call(this, event);
  40767. }
  40768. return event.result;
  40769. },
  40770. handlers: function handlers(event, _handlers) {
  40771. var i,
  40772. handleObj,
  40773. sel,
  40774. matchedHandlers,
  40775. matchedSelectors,
  40776. handlerQueue = [],
  40777. delegateCount = _handlers.delegateCount,
  40778. cur = event.target;
  40779. // Find delegate handlers
  40780. if (delegateCount &&
  40781. // Support: IE <=9
  40782. // Black-hole SVG <use> instance trees (trac-13180)
  40783. cur.nodeType &&
  40784. // Support: Firefox <=42
  40785. // Suppress spec-violating clicks indicating a non-primary pointer button (trac-3861)
  40786. // https://www.w3.org/TR/DOM-Level-3-Events/#event-type-click
  40787. // Support: IE 11 only
  40788. // ...but not arrow key "clicks" of radio inputs, which can have `button` -1 (gh-2343)
  40789. !(event.type === "click" && event.button >= 1)) {
  40790. for (; cur !== this; cur = cur.parentNode || this) {
  40791. // Don't check non-elements (#13208)
  40792. // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764)
  40793. if (cur.nodeType === 1 && !(event.type === "click" && cur.disabled === true)) {
  40794. matchedHandlers = [];
  40795. matchedSelectors = {};
  40796. for (i = 0; i < delegateCount; i++) {
  40797. handleObj = _handlers[i];
  40798. // Don't conflict with Object.prototype properties (#13203)
  40799. sel = handleObj.selector + " ";
  40800. if (matchedSelectors[sel] === undefined) {
  40801. matchedSelectors[sel] = handleObj.needsContext ? jQuery(sel, this).index(cur) > -1 : jQuery.find(sel, this, null, [cur]).length;
  40802. }
  40803. if (matchedSelectors[sel]) {
  40804. matchedHandlers.push(handleObj);
  40805. }
  40806. }
  40807. if (matchedHandlers.length) {
  40808. handlerQueue.push({ elem: cur, handlers: matchedHandlers });
  40809. }
  40810. }
  40811. }
  40812. }
  40813. // Add the remaining (directly-bound) handlers
  40814. cur = this;
  40815. if (delegateCount < _handlers.length) {
  40816. handlerQueue.push({ elem: cur, handlers: _handlers.slice(delegateCount) });
  40817. }
  40818. return handlerQueue;
  40819. },
  40820. addProp: function addProp(name, hook) {
  40821. Object.defineProperty(jQuery.Event.prototype, name, {
  40822. enumerable: true,
  40823. configurable: true,
  40824. get: isFunction(hook) ? function () {
  40825. if (this.originalEvent) {
  40826. return hook(this.originalEvent);
  40827. }
  40828. } : function () {
  40829. if (this.originalEvent) {
  40830. return this.originalEvent[name];
  40831. }
  40832. },
  40833. set: function set(value) {
  40834. Object.defineProperty(this, name, {
  40835. enumerable: true,
  40836. configurable: true,
  40837. writable: true,
  40838. value: value
  40839. });
  40840. }
  40841. });
  40842. },
  40843. fix: function fix(originalEvent) {
  40844. return originalEvent[jQuery.expando] ? originalEvent : new jQuery.Event(originalEvent);
  40845. },
  40846. special: {
  40847. load: {
  40848. // Prevent triggered image.load events from bubbling to window.load
  40849. noBubble: true
  40850. },
  40851. focus: {
  40852. // Fire native event if possible so blur/focus sequence is correct
  40853. trigger: function trigger() {
  40854. if (this !== safeActiveElement() && this.focus) {
  40855. this.focus();
  40856. return false;
  40857. }
  40858. },
  40859. delegateType: "focusin"
  40860. },
  40861. blur: {
  40862. trigger: function trigger() {
  40863. if (this === safeActiveElement() && this.blur) {
  40864. this.blur();
  40865. return false;
  40866. }
  40867. },
  40868. delegateType: "focusout"
  40869. },
  40870. click: {
  40871. // For checkbox, fire native event so checked state will be right
  40872. trigger: function trigger() {
  40873. if (this.type === "checkbox" && this.click && nodeName(this, "input")) {
  40874. this.click();
  40875. return false;
  40876. }
  40877. },
  40878. // For cross-browser consistency, don't fire native .click() on links
  40879. _default: function _default(event) {
  40880. return nodeName(event.target, "a");
  40881. }
  40882. },
  40883. beforeunload: {
  40884. postDispatch: function postDispatch(event) {
  40885. // Support: Firefox 20+
  40886. // Firefox doesn't alert if the returnValue field is not set.
  40887. if (event.result !== undefined && event.originalEvent) {
  40888. event.originalEvent.returnValue = event.result;
  40889. }
  40890. }
  40891. }
  40892. }
  40893. };
  40894. jQuery.removeEvent = function (elem, type, handle) {
  40895. // This "if" is needed for plain objects
  40896. if (elem.removeEventListener) {
  40897. elem.removeEventListener(type, handle);
  40898. }
  40899. };
  40900. jQuery.Event = function (src, props) {
  40901. // Allow instantiation without the 'new' keyword
  40902. if (!(this instanceof jQuery.Event)) {
  40903. return new jQuery.Event(src, props);
  40904. }
  40905. // Event object
  40906. if (src && src.type) {
  40907. this.originalEvent = src;
  40908. this.type = src.type;
  40909. // Events bubbling up the document may have been marked as prevented
  40910. // by a handler lower down the tree; reflect the correct value.
  40911. this.isDefaultPrevented = src.defaultPrevented || src.defaultPrevented === undefined &&
  40912. // Support: Android <=2.3 only
  40913. src.returnValue === false ? returnTrue : returnFalse;
  40914. // Create target properties
  40915. // Support: Safari <=6 - 7 only
  40916. // Target should not be a text node (#504, #13143)
  40917. this.target = src.target && src.target.nodeType === 3 ? src.target.parentNode : src.target;
  40918. this.currentTarget = src.currentTarget;
  40919. this.relatedTarget = src.relatedTarget;
  40920. // Event type
  40921. } else {
  40922. this.type = src;
  40923. }
  40924. // Put explicitly provided properties onto the event object
  40925. if (props) {
  40926. jQuery.extend(this, props);
  40927. }
  40928. // Create a timestamp if incoming event doesn't have one
  40929. this.timeStamp = src && src.timeStamp || Date.now();
  40930. // Mark it as fixed
  40931. this[jQuery.expando] = true;
  40932. };
  40933. // jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
  40934. // https://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
  40935. jQuery.Event.prototype = {
  40936. constructor: jQuery.Event,
  40937. isDefaultPrevented: returnFalse,
  40938. isPropagationStopped: returnFalse,
  40939. isImmediatePropagationStopped: returnFalse,
  40940. isSimulated: false,
  40941. preventDefault: function preventDefault() {
  40942. var e = this.originalEvent;
  40943. this.isDefaultPrevented = returnTrue;
  40944. if (e && !this.isSimulated) {
  40945. e.preventDefault();
  40946. }
  40947. },
  40948. stopPropagation: function stopPropagation() {
  40949. var e = this.originalEvent;
  40950. this.isPropagationStopped = returnTrue;
  40951. if (e && !this.isSimulated) {
  40952. e.stopPropagation();
  40953. }
  40954. },
  40955. stopImmediatePropagation: function stopImmediatePropagation() {
  40956. var e = this.originalEvent;
  40957. this.isImmediatePropagationStopped = returnTrue;
  40958. if (e && !this.isSimulated) {
  40959. e.stopImmediatePropagation();
  40960. }
  40961. this.stopPropagation();
  40962. }
  40963. };
  40964. // Includes all common event props including KeyEvent and MouseEvent specific props
  40965. jQuery.each({
  40966. altKey: true,
  40967. bubbles: true,
  40968. cancelable: true,
  40969. changedTouches: true,
  40970. ctrlKey: true,
  40971. detail: true,
  40972. eventPhase: true,
  40973. metaKey: true,
  40974. pageX: true,
  40975. pageY: true,
  40976. shiftKey: true,
  40977. view: true,
  40978. "char": true,
  40979. charCode: true,
  40980. key: true,
  40981. keyCode: true,
  40982. button: true,
  40983. buttons: true,
  40984. clientX: true,
  40985. clientY: true,
  40986. offsetX: true,
  40987. offsetY: true,
  40988. pointerId: true,
  40989. pointerType: true,
  40990. screenX: true,
  40991. screenY: true,
  40992. targetTouches: true,
  40993. toElement: true,
  40994. touches: true,
  40995. which: function which(event) {
  40996. var button = event.button;
  40997. // Add which for key events
  40998. if (event.which == null && rkeyEvent.test(event.type)) {
  40999. return event.charCode != null ? event.charCode : event.keyCode;
  41000. }
  41001. // Add which for click: 1 === left; 2 === middle; 3 === right
  41002. if (!event.which && button !== undefined && rmouseEvent.test(event.type)) {
  41003. if (button & 1) {
  41004. return 1;
  41005. }
  41006. if (button & 2) {
  41007. return 3;
  41008. }
  41009. if (button & 4) {
  41010. return 2;
  41011. }
  41012. return 0;
  41013. }
  41014. return event.which;
  41015. }
  41016. }, jQuery.event.addProp);
  41017. // Create mouseenter/leave events using mouseover/out and event-time checks
  41018. // so that event delegation works in jQuery.
  41019. // Do the same for pointerenter/pointerleave and pointerover/pointerout
  41020. //
  41021. // Support: Safari 7 only
  41022. // Safari sends mouseenter too often; see:
  41023. // https://bugs.chromium.org/p/chromium/issues/detail?id=470258
  41024. // for the description of the bug (it existed in older Chrome versions as well).
  41025. jQuery.each({
  41026. mouseenter: "mouseover",
  41027. mouseleave: "mouseout",
  41028. pointerenter: "pointerover",
  41029. pointerleave: "pointerout"
  41030. }, function (orig, fix) {
  41031. jQuery.event.special[orig] = {
  41032. delegateType: fix,
  41033. bindType: fix,
  41034. handle: function handle(event) {
  41035. var ret,
  41036. target = this,
  41037. related = event.relatedTarget,
  41038. handleObj = event.handleObj;
  41039. // For mouseenter/leave call the handler if related is outside the target.
  41040. // NB: No relatedTarget if the mouse left/entered the browser window
  41041. if (!related || related !== target && !jQuery.contains(target, related)) {
  41042. event.type = handleObj.origType;
  41043. ret = handleObj.handler.apply(this, arguments);
  41044. event.type = fix;
  41045. }
  41046. return ret;
  41047. }
  41048. };
  41049. });
  41050. jQuery.fn.extend({
  41051. on: function on(types, selector, data, fn) {
  41052. return _on(this, types, selector, data, fn);
  41053. },
  41054. one: function one(types, selector, data, fn) {
  41055. return _on(this, types, selector, data, fn, 1);
  41056. },
  41057. off: function off(types, selector, fn) {
  41058. var handleObj, type;
  41059. if (types && types.preventDefault && types.handleObj) {
  41060. // ( event ) dispatched jQuery.Event
  41061. handleObj = types.handleObj;
  41062. jQuery(types.delegateTarget).off(handleObj.namespace ? handleObj.origType + "." + handleObj.namespace : handleObj.origType, handleObj.selector, handleObj.handler);
  41063. return this;
  41064. }
  41065. if ((typeof types === "undefined" ? "undefined" : _typeof(types)) === "object") {
  41066. // ( types-object [, selector] )
  41067. for (type in types) {
  41068. this.off(type, selector, types[type]);
  41069. }
  41070. return this;
  41071. }
  41072. if (selector === false || typeof selector === "function") {
  41073. // ( types [, fn] )
  41074. fn = selector;
  41075. selector = undefined;
  41076. }
  41077. if (fn === false) {
  41078. fn = returnFalse;
  41079. }
  41080. return this.each(function () {
  41081. jQuery.event.remove(this, types, fn, selector);
  41082. });
  41083. }
  41084. });
  41085. var
  41086. /* eslint-disable max-len */
  41087. // See https://github.com/eslint/eslint/issues/3229
  41088. rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([a-z][^\/\0>\x20\t\r\n\f]*)[^>]*)\/>/gi,
  41089. /* eslint-enable */
  41090. // Support: IE <=10 - 11, Edge 12 - 13 only
  41091. // In IE/Edge using regex groups here causes severe slowdowns.
  41092. // See https://connect.microsoft.com/IE/feedback/details/1736512/
  41093. rnoInnerhtml = /<script|<style|<link/i,
  41094. // checked="checked" or checked
  41095. rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
  41096. rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g;
  41097. // Prefer a tbody over its parent table for containing new rows
  41098. function manipulationTarget(elem, content) {
  41099. if (nodeName(elem, "table") && nodeName(content.nodeType !== 11 ? content : content.firstChild, "tr")) {
  41100. return jQuery(elem).children("tbody")[0] || elem;
  41101. }
  41102. return elem;
  41103. }
  41104. // Replace/restore the type attribute of script elements for safe DOM manipulation
  41105. function disableScript(elem) {
  41106. elem.type = (elem.getAttribute("type") !== null) + "/" + elem.type;
  41107. return elem;
  41108. }
  41109. function restoreScript(elem) {
  41110. if ((elem.type || "").slice(0, 5) === "true/") {
  41111. elem.type = elem.type.slice(5);
  41112. } else {
  41113. elem.removeAttribute("type");
  41114. }
  41115. return elem;
  41116. }
  41117. function cloneCopyEvent(src, dest) {
  41118. var i, l, type, pdataOld, pdataCur, udataOld, udataCur, events;
  41119. if (dest.nodeType !== 1) {
  41120. return;
  41121. }
  41122. // 1. Copy private data: events, handlers, etc.
  41123. if (dataPriv.hasData(src)) {
  41124. pdataOld = dataPriv.access(src);
  41125. pdataCur = dataPriv.set(dest, pdataOld);
  41126. events = pdataOld.events;
  41127. if (events) {
  41128. delete pdataCur.handle;
  41129. pdataCur.events = {};
  41130. for (type in events) {
  41131. for (i = 0, l = events[type].length; i < l; i++) {
  41132. jQuery.event.add(dest, type, events[type][i]);
  41133. }
  41134. }
  41135. }
  41136. }
  41137. // 2. Copy user data
  41138. if (dataUser.hasData(src)) {
  41139. udataOld = dataUser.access(src);
  41140. udataCur = jQuery.extend({}, udataOld);
  41141. dataUser.set(dest, udataCur);
  41142. }
  41143. }
  41144. // Fix IE bugs, see support tests
  41145. function fixInput(src, dest) {
  41146. var nodeName = dest.nodeName.toLowerCase();
  41147. // Fails to persist the checked state of a cloned checkbox or radio button.
  41148. if (nodeName === "input" && rcheckableType.test(src.type)) {
  41149. dest.checked = src.checked;
  41150. // Fails to return the selected option to the default selected state when cloning options
  41151. } else if (nodeName === "input" || nodeName === "textarea") {
  41152. dest.defaultValue = src.defaultValue;
  41153. }
  41154. }
  41155. function domManip(collection, args, callback, ignored) {
  41156. // Flatten any nested arrays
  41157. args = concat.apply([], args);
  41158. var fragment,
  41159. first,
  41160. scripts,
  41161. hasScripts,
  41162. node,
  41163. doc,
  41164. i = 0,
  41165. l = collection.length,
  41166. iNoClone = l - 1,
  41167. value = args[0],
  41168. valueIsFunction = isFunction(value);
  41169. // We can't cloneNode fragments that contain checked, in WebKit
  41170. if (valueIsFunction || l > 1 && typeof value === "string" && !support.checkClone && rchecked.test(value)) {
  41171. return collection.each(function (index) {
  41172. var self = collection.eq(index);
  41173. if (valueIsFunction) {
  41174. args[0] = value.call(this, index, self.html());
  41175. }
  41176. domManip(self, args, callback, ignored);
  41177. });
  41178. }
  41179. if (l) {
  41180. fragment = buildFragment(args, collection[0].ownerDocument, false, collection, ignored);
  41181. first = fragment.firstChild;
  41182. if (fragment.childNodes.length === 1) {
  41183. fragment = first;
  41184. }
  41185. // Require either new content or an interest in ignored elements to invoke the callback
  41186. if (first || ignored) {
  41187. scripts = jQuery.map(getAll(fragment, "script"), disableScript);
  41188. hasScripts = scripts.length;
  41189. // Use the original fragment for the last item
  41190. // instead of the first because it can end up
  41191. // being emptied incorrectly in certain situations (#8070).
  41192. for (; i < l; i++) {
  41193. node = fragment;
  41194. if (i !== iNoClone) {
  41195. node = jQuery.clone(node, true, true);
  41196. // Keep references to cloned scripts for later restoration
  41197. if (hasScripts) {
  41198. // Support: Android <=4.0 only, PhantomJS 1 only
  41199. // push.apply(_, arraylike) throws on ancient WebKit
  41200. jQuery.merge(scripts, getAll(node, "script"));
  41201. }
  41202. }
  41203. callback.call(collection[i], node, i);
  41204. }
  41205. if (hasScripts) {
  41206. doc = scripts[scripts.length - 1].ownerDocument;
  41207. // Reenable scripts
  41208. jQuery.map(scripts, restoreScript);
  41209. // Evaluate executable scripts on first document insertion
  41210. for (i = 0; i < hasScripts; i++) {
  41211. node = scripts[i];
  41212. if (rscriptType.test(node.type || "") && !dataPriv.access(node, "globalEval") && jQuery.contains(doc, node)) {
  41213. if (node.src && (node.type || "").toLowerCase() !== "module") {
  41214. // Optional AJAX dependency, but won't run scripts if not present
  41215. if (jQuery._evalUrl) {
  41216. jQuery._evalUrl(node.src);
  41217. }
  41218. } else {
  41219. DOMEval(node.textContent.replace(rcleanScript, ""), doc, node);
  41220. }
  41221. }
  41222. }
  41223. }
  41224. }
  41225. }
  41226. return collection;
  41227. }
  41228. function _remove(elem, selector, keepData) {
  41229. var node,
  41230. nodes = selector ? jQuery.filter(selector, elem) : elem,
  41231. i = 0;
  41232. for (; (node = nodes[i]) != null; i++) {
  41233. if (!keepData && node.nodeType === 1) {
  41234. jQuery.cleanData(getAll(node));
  41235. }
  41236. if (node.parentNode) {
  41237. if (keepData && jQuery.contains(node.ownerDocument, node)) {
  41238. setGlobalEval(getAll(node, "script"));
  41239. }
  41240. node.parentNode.removeChild(node);
  41241. }
  41242. }
  41243. return elem;
  41244. }
  41245. jQuery.extend({
  41246. htmlPrefilter: function htmlPrefilter(html) {
  41247. return html.replace(rxhtmlTag, "<$1></$2>");
  41248. },
  41249. clone: function clone(elem, dataAndEvents, deepDataAndEvents) {
  41250. var i,
  41251. l,
  41252. srcElements,
  41253. destElements,
  41254. clone = elem.cloneNode(true),
  41255. inPage = jQuery.contains(elem.ownerDocument, elem);
  41256. // Fix IE cloning issues
  41257. if (!support.noCloneChecked && (elem.nodeType === 1 || elem.nodeType === 11) && !jQuery.isXMLDoc(elem)) {
  41258. // We eschew Sizzle here for performance reasons: https://jsperf.com/getall-vs-sizzle/2
  41259. destElements = getAll(clone);
  41260. srcElements = getAll(elem);
  41261. for (i = 0, l = srcElements.length; i < l; i++) {
  41262. fixInput(srcElements[i], destElements[i]);
  41263. }
  41264. }
  41265. // Copy the events from the original to the clone
  41266. if (dataAndEvents) {
  41267. if (deepDataAndEvents) {
  41268. srcElements = srcElements || getAll(elem);
  41269. destElements = destElements || getAll(clone);
  41270. for (i = 0, l = srcElements.length; i < l; i++) {
  41271. cloneCopyEvent(srcElements[i], destElements[i]);
  41272. }
  41273. } else {
  41274. cloneCopyEvent(elem, clone);
  41275. }
  41276. }
  41277. // Preserve script evaluation history
  41278. destElements = getAll(clone, "script");
  41279. if (destElements.length > 0) {
  41280. setGlobalEval(destElements, !inPage && getAll(elem, "script"));
  41281. }
  41282. // Return the cloned set
  41283. return clone;
  41284. },
  41285. cleanData: function cleanData(elems) {
  41286. var data,
  41287. elem,
  41288. type,
  41289. special = jQuery.event.special,
  41290. i = 0;
  41291. for (; (elem = elems[i]) !== undefined; i++) {
  41292. if (acceptData(elem)) {
  41293. if (data = elem[dataPriv.expando]) {
  41294. if (data.events) {
  41295. for (type in data.events) {
  41296. if (special[type]) {
  41297. jQuery.event.remove(elem, type);
  41298. // This is a shortcut to avoid jQuery.event.remove's overhead
  41299. } else {
  41300. jQuery.removeEvent(elem, type, data.handle);
  41301. }
  41302. }
  41303. }
  41304. // Support: Chrome <=35 - 45+
  41305. // Assign undefined instead of using delete, see Data#remove
  41306. elem[dataPriv.expando] = undefined;
  41307. }
  41308. if (elem[dataUser.expando]) {
  41309. // Support: Chrome <=35 - 45+
  41310. // Assign undefined instead of using delete, see Data#remove
  41311. elem[dataUser.expando] = undefined;
  41312. }
  41313. }
  41314. }
  41315. }
  41316. });
  41317. jQuery.fn.extend({
  41318. detach: function detach(selector) {
  41319. return _remove(this, selector, true);
  41320. },
  41321. remove: function remove(selector) {
  41322. return _remove(this, selector);
  41323. },
  41324. text: function text(value) {
  41325. return access(this, function (value) {
  41326. return value === undefined ? jQuery.text(this) : this.empty().each(function () {
  41327. if (this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9) {
  41328. this.textContent = value;
  41329. }
  41330. });
  41331. }, null, value, arguments.length);
  41332. },
  41333. append: function append() {
  41334. return domManip(this, arguments, function (elem) {
  41335. if (this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9) {
  41336. var target = manipulationTarget(this, elem);
  41337. target.appendChild(elem);
  41338. }
  41339. });
  41340. },
  41341. prepend: function prepend() {
  41342. return domManip(this, arguments, function (elem) {
  41343. if (this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9) {
  41344. var target = manipulationTarget(this, elem);
  41345. target.insertBefore(elem, target.firstChild);
  41346. }
  41347. });
  41348. },
  41349. before: function before() {
  41350. return domManip(this, arguments, function (elem) {
  41351. if (this.parentNode) {
  41352. this.parentNode.insertBefore(elem, this);
  41353. }
  41354. });
  41355. },
  41356. after: function after() {
  41357. return domManip(this, arguments, function (elem) {
  41358. if (this.parentNode) {
  41359. this.parentNode.insertBefore(elem, this.nextSibling);
  41360. }
  41361. });
  41362. },
  41363. empty: function empty() {
  41364. var elem,
  41365. i = 0;
  41366. for (; (elem = this[i]) != null; i++) {
  41367. if (elem.nodeType === 1) {
  41368. // Prevent memory leaks
  41369. jQuery.cleanData(getAll(elem, false));
  41370. // Remove any remaining nodes
  41371. elem.textContent = "";
  41372. }
  41373. }
  41374. return this;
  41375. },
  41376. clone: function clone(dataAndEvents, deepDataAndEvents) {
  41377. dataAndEvents = dataAndEvents == null ? false : dataAndEvents;
  41378. deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;
  41379. return this.map(function () {
  41380. return jQuery.clone(this, dataAndEvents, deepDataAndEvents);
  41381. });
  41382. },
  41383. html: function html(value) {
  41384. return access(this, function (value) {
  41385. var elem = this[0] || {},
  41386. i = 0,
  41387. l = this.length;
  41388. if (value === undefined && elem.nodeType === 1) {
  41389. return elem.innerHTML;
  41390. }
  41391. // See if we can take a shortcut and just use innerHTML
  41392. if (typeof value === "string" && !rnoInnerhtml.test(value) && !wrapMap[(rtagName.exec(value) || ["", ""])[1].toLowerCase()]) {
  41393. value = jQuery.htmlPrefilter(value);
  41394. try {
  41395. for (; i < l; i++) {
  41396. elem = this[i] || {};
  41397. // Remove element nodes and prevent memory leaks
  41398. if (elem.nodeType === 1) {
  41399. jQuery.cleanData(getAll(elem, false));
  41400. elem.innerHTML = value;
  41401. }
  41402. }
  41403. elem = 0;
  41404. // If using innerHTML throws an exception, use the fallback method
  41405. } catch (e) {}
  41406. }
  41407. if (elem) {
  41408. this.empty().append(value);
  41409. }
  41410. }, null, value, arguments.length);
  41411. },
  41412. replaceWith: function replaceWith() {
  41413. var ignored = [];
  41414. // Make the changes, replacing each non-ignored context element with the new content
  41415. return domManip(this, arguments, function (elem) {
  41416. var parent = this.parentNode;
  41417. if (jQuery.inArray(this, ignored) < 0) {
  41418. jQuery.cleanData(getAll(this));
  41419. if (parent) {
  41420. parent.replaceChild(elem, this);
  41421. }
  41422. }
  41423. // Force callback invocation
  41424. }, ignored);
  41425. }
  41426. });
  41427. jQuery.each({
  41428. appendTo: "append",
  41429. prependTo: "prepend",
  41430. insertBefore: "before",
  41431. insertAfter: "after",
  41432. replaceAll: "replaceWith"
  41433. }, function (name, original) {
  41434. jQuery.fn[name] = function (selector) {
  41435. var elems,
  41436. ret = [],
  41437. insert = jQuery(selector),
  41438. last = insert.length - 1,
  41439. i = 0;
  41440. for (; i <= last; i++) {
  41441. elems = i === last ? this : this.clone(true);
  41442. jQuery(insert[i])[original](elems);
  41443. // Support: Android <=4.0 only, PhantomJS 1 only
  41444. // .get() because push.apply(_, arraylike) throws on ancient WebKit
  41445. push.apply(ret, elems.get());
  41446. }
  41447. return this.pushStack(ret);
  41448. };
  41449. });
  41450. var rnumnonpx = new RegExp("^(" + pnum + ")(?!px)[a-z%]+$", "i");
  41451. var getStyles = function getStyles(elem) {
  41452. // Support: IE <=11 only, Firefox <=30 (#15098, #14150)
  41453. // IE throws on elements created in popups
  41454. // FF meanwhile throws on frame elements through "defaultView.getComputedStyle"
  41455. var view = elem.ownerDocument.defaultView;
  41456. if (!view || !view.opener) {
  41457. view = window;
  41458. }
  41459. return view.getComputedStyle(elem);
  41460. };
  41461. var rboxStyle = new RegExp(cssExpand.join("|"), "i");
  41462. (function () {
  41463. // Executing both pixelPosition & boxSizingReliable tests require only one layout
  41464. // so they're executed at the same time to save the second computation.
  41465. function computeStyleTests() {
  41466. // This is a singleton, we need to execute it only once
  41467. if (!div) {
  41468. return;
  41469. }
  41470. container.style.cssText = "position:absolute;left:-11111px;width:60px;" + "margin-top:1px;padding:0;border:0";
  41471. div.style.cssText = "position:relative;display:block;box-sizing:border-box;overflow:scroll;" + "margin:auto;border:1px;padding:1px;" + "width:60%;top:1%";
  41472. documentElement.appendChild(container).appendChild(div);
  41473. var divStyle = window.getComputedStyle(div);
  41474. pixelPositionVal = divStyle.top !== "1%";
  41475. // Support: Android 4.0 - 4.3 only, Firefox <=3 - 44
  41476. reliableMarginLeftVal = roundPixelMeasures(divStyle.marginLeft) === 12;
  41477. // Support: Android 4.0 - 4.3 only, Safari <=9.1 - 10.1, iOS <=7.0 - 9.3
  41478. // Some styles come back with percentage values, even though they shouldn't
  41479. div.style.right = "60%";
  41480. pixelBoxStylesVal = roundPixelMeasures(divStyle.right) === 36;
  41481. // Support: IE 9 - 11 only
  41482. // Detect misreporting of content dimensions for box-sizing:border-box elements
  41483. boxSizingReliableVal = roundPixelMeasures(divStyle.width) === 36;
  41484. // Support: IE 9 only
  41485. // Detect overflow:scroll screwiness (gh-3699)
  41486. div.style.position = "absolute";
  41487. scrollboxSizeVal = div.offsetWidth === 36 || "absolute";
  41488. documentElement.removeChild(container);
  41489. // Nullify the div so it wouldn't be stored in the memory and
  41490. // it will also be a sign that checks already performed
  41491. div = null;
  41492. }
  41493. function roundPixelMeasures(measure) {
  41494. return Math.round(parseFloat(measure));
  41495. }
  41496. var pixelPositionVal,
  41497. boxSizingReliableVal,
  41498. scrollboxSizeVal,
  41499. pixelBoxStylesVal,
  41500. reliableMarginLeftVal,
  41501. container = document.createElement("div"),
  41502. div = document.createElement("div");
  41503. // Finish early in limited (non-browser) environments
  41504. if (!div.style) {
  41505. return;
  41506. }
  41507. // Support: IE <=9 - 11 only
  41508. // Style of cloned element affects source element cloned (#8908)
  41509. div.style.backgroundClip = "content-box";
  41510. div.cloneNode(true).style.backgroundClip = "";
  41511. support.clearCloneStyle = div.style.backgroundClip === "content-box";
  41512. jQuery.extend(support, {
  41513. boxSizingReliable: function boxSizingReliable() {
  41514. computeStyleTests();
  41515. return boxSizingReliableVal;
  41516. },
  41517. pixelBoxStyles: function pixelBoxStyles() {
  41518. computeStyleTests();
  41519. return pixelBoxStylesVal;
  41520. },
  41521. pixelPosition: function pixelPosition() {
  41522. computeStyleTests();
  41523. return pixelPositionVal;
  41524. },
  41525. reliableMarginLeft: function reliableMarginLeft() {
  41526. computeStyleTests();
  41527. return reliableMarginLeftVal;
  41528. },
  41529. scrollboxSize: function scrollboxSize() {
  41530. computeStyleTests();
  41531. return scrollboxSizeVal;
  41532. }
  41533. });
  41534. })();
  41535. function curCSS(elem, name, computed) {
  41536. var width,
  41537. minWidth,
  41538. maxWidth,
  41539. ret,
  41540. // Support: Firefox 51+
  41541. // Retrieving style before computed somehow
  41542. // fixes an issue with getting wrong values
  41543. // on detached elements
  41544. style = elem.style;
  41545. computed = computed || getStyles(elem);
  41546. // getPropertyValue is needed for:
  41547. // .css('filter') (IE 9 only, #12537)
  41548. // .css('--customProperty) (#3144)
  41549. if (computed) {
  41550. ret = computed.getPropertyValue(name) || computed[name];
  41551. if (ret === "" && !jQuery.contains(elem.ownerDocument, elem)) {
  41552. ret = jQuery.style(elem, name);
  41553. }
  41554. // A tribute to the "awesome hack by Dean Edwards"
  41555. // Android Browser returns percentage for some values,
  41556. // but width seems to be reliably pixels.
  41557. // This is against the CSSOM draft spec:
  41558. // https://drafts.csswg.org/cssom/#resolved-values
  41559. if (!support.pixelBoxStyles() && rnumnonpx.test(ret) && rboxStyle.test(name)) {
  41560. // Remember the original values
  41561. width = style.width;
  41562. minWidth = style.minWidth;
  41563. maxWidth = style.maxWidth;
  41564. // Put in the new values to get a computed value out
  41565. style.minWidth = style.maxWidth = style.width = ret;
  41566. ret = computed.width;
  41567. // Revert the changed values
  41568. style.width = width;
  41569. style.minWidth = minWidth;
  41570. style.maxWidth = maxWidth;
  41571. }
  41572. }
  41573. return ret !== undefined ?
  41574. // Support: IE <=9 - 11 only
  41575. // IE returns zIndex value as an integer.
  41576. ret + "" : ret;
  41577. }
  41578. function addGetHookIf(conditionFn, hookFn) {
  41579. // Define the hook, we'll check on the first run if it's really needed.
  41580. return {
  41581. get: function get() {
  41582. if (conditionFn()) {
  41583. // Hook not needed (or it's not possible to use it due
  41584. // to missing dependency), remove it.
  41585. delete this.get;
  41586. return;
  41587. }
  41588. // Hook needed; redefine it so that the support test is not executed again.
  41589. return (this.get = hookFn).apply(this, arguments);
  41590. }
  41591. };
  41592. }
  41593. var
  41594. // Swappable if display is none or starts with table
  41595. // except "table", "table-cell", or "table-caption"
  41596. // See here for display values: https://developer.mozilla.org/en-US/docs/CSS/display
  41597. rdisplayswap = /^(none|table(?!-c[ea]).+)/,
  41598. rcustomProp = /^--/,
  41599. cssShow = { position: "absolute", visibility: "hidden", display: "block" },
  41600. cssNormalTransform = {
  41601. letterSpacing: "0",
  41602. fontWeight: "400"
  41603. },
  41604. cssPrefixes = ["Webkit", "Moz", "ms"],
  41605. emptyStyle = document.createElement("div").style;
  41606. // Return a css property mapped to a potentially vendor prefixed property
  41607. function vendorPropName(name) {
  41608. // Shortcut for names that are not vendor prefixed
  41609. if (name in emptyStyle) {
  41610. return name;
  41611. }
  41612. // Check for vendor prefixed names
  41613. var capName = name[0].toUpperCase() + name.slice(1),
  41614. i = cssPrefixes.length;
  41615. while (i--) {
  41616. name = cssPrefixes[i] + capName;
  41617. if (name in emptyStyle) {
  41618. return name;
  41619. }
  41620. }
  41621. }
  41622. // Return a property mapped along what jQuery.cssProps suggests or to
  41623. // a vendor prefixed property.
  41624. function finalPropName(name) {
  41625. var ret = jQuery.cssProps[name];
  41626. if (!ret) {
  41627. ret = jQuery.cssProps[name] = vendorPropName(name) || name;
  41628. }
  41629. return ret;
  41630. }
  41631. function setPositiveNumber(elem, value, subtract) {
  41632. // Any relative (+/-) values have already been
  41633. // normalized at this point
  41634. var matches = rcssNum.exec(value);
  41635. return matches ?
  41636. // Guard against undefined "subtract", e.g., when used as in cssHooks
  41637. Math.max(0, matches[2] - (subtract || 0)) + (matches[3] || "px") : value;
  41638. }
  41639. function boxModelAdjustment(elem, dimension, box, isBorderBox, styles, computedVal) {
  41640. var i = dimension === "width" ? 1 : 0,
  41641. extra = 0,
  41642. delta = 0;
  41643. // Adjustment may not be necessary
  41644. if (box === (isBorderBox ? "border" : "content")) {
  41645. return 0;
  41646. }
  41647. for (; i < 4; i += 2) {
  41648. // Both box models exclude margin
  41649. if (box === "margin") {
  41650. delta += jQuery.css(elem, box + cssExpand[i], true, styles);
  41651. }
  41652. // If we get here with a content-box, we're seeking "padding" or "border" or "margin"
  41653. if (!isBorderBox) {
  41654. // Add padding
  41655. delta += jQuery.css(elem, "padding" + cssExpand[i], true, styles);
  41656. // For "border" or "margin", add border
  41657. if (box !== "padding") {
  41658. delta += jQuery.css(elem, "border" + cssExpand[i] + "Width", true, styles);
  41659. // But still keep track of it otherwise
  41660. } else {
  41661. extra += jQuery.css(elem, "border" + cssExpand[i] + "Width", true, styles);
  41662. }
  41663. // If we get here with a border-box (content + padding + border), we're seeking "content" or
  41664. // "padding" or "margin"
  41665. } else {
  41666. // For "content", subtract padding
  41667. if (box === "content") {
  41668. delta -= jQuery.css(elem, "padding" + cssExpand[i], true, styles);
  41669. }
  41670. // For "content" or "padding", subtract border
  41671. if (box !== "margin") {
  41672. delta -= jQuery.css(elem, "border" + cssExpand[i] + "Width", true, styles);
  41673. }
  41674. }
  41675. }
  41676. // Account for positive content-box scroll gutter when requested by providing computedVal
  41677. if (!isBorderBox && computedVal >= 0) {
  41678. // offsetWidth/offsetHeight is a rounded sum of content, padding, scroll gutter, and border
  41679. // Assuming integer scroll gutter, subtract the rest and round down
  41680. delta += Math.max(0, Math.ceil(elem["offset" + dimension[0].toUpperCase() + dimension.slice(1)] - computedVal - delta - extra - 0.5));
  41681. }
  41682. return delta;
  41683. }
  41684. function getWidthOrHeight(elem, dimension, extra) {
  41685. // Start with computed style
  41686. var styles = getStyles(elem),
  41687. val = curCSS(elem, dimension, styles),
  41688. isBorderBox = jQuery.css(elem, "boxSizing", false, styles) === "border-box",
  41689. valueIsBorderBox = isBorderBox;
  41690. // Support: Firefox <=54
  41691. // Return a confounding non-pixel value or feign ignorance, as appropriate.
  41692. if (rnumnonpx.test(val)) {
  41693. if (!extra) {
  41694. return val;
  41695. }
  41696. val = "auto";
  41697. }
  41698. // Check for style in case a browser which returns unreliable values
  41699. // for getComputedStyle silently falls back to the reliable elem.style
  41700. valueIsBorderBox = valueIsBorderBox && (support.boxSizingReliable() || val === elem.style[dimension]);
  41701. // Fall back to offsetWidth/offsetHeight when value is "auto"
  41702. // This happens for inline elements with no explicit setting (gh-3571)
  41703. // Support: Android <=4.1 - 4.3 only
  41704. // Also use offsetWidth/offsetHeight for misreported inline dimensions (gh-3602)
  41705. if (val === "auto" || !parseFloat(val) && jQuery.css(elem, "display", false, styles) === "inline") {
  41706. val = elem["offset" + dimension[0].toUpperCase() + dimension.slice(1)];
  41707. // offsetWidth/offsetHeight provide border-box values
  41708. valueIsBorderBox = true;
  41709. }
  41710. // Normalize "" and auto
  41711. val = parseFloat(val) || 0;
  41712. // Adjust for the element's box model
  41713. return val + boxModelAdjustment(elem, dimension, extra || (isBorderBox ? "border" : "content"), valueIsBorderBox, styles,
  41714. // Provide the current computed size to request scroll gutter calculation (gh-3589)
  41715. val) + "px";
  41716. }
  41717. jQuery.extend({
  41718. // Add in style property hooks for overriding the default
  41719. // behavior of getting and setting a style property
  41720. cssHooks: {
  41721. opacity: {
  41722. get: function get(elem, computed) {
  41723. if (computed) {
  41724. // We should always get a number back from opacity
  41725. var ret = curCSS(elem, "opacity");
  41726. return ret === "" ? "1" : ret;
  41727. }
  41728. }
  41729. }
  41730. },
  41731. // Don't automatically add "px" to these possibly-unitless properties
  41732. cssNumber: {
  41733. "animationIterationCount": true,
  41734. "columnCount": true,
  41735. "fillOpacity": true,
  41736. "flexGrow": true,
  41737. "flexShrink": true,
  41738. "fontWeight": true,
  41739. "lineHeight": true,
  41740. "opacity": true,
  41741. "order": true,
  41742. "orphans": true,
  41743. "widows": true,
  41744. "zIndex": true,
  41745. "zoom": true
  41746. },
  41747. // Add in properties whose names you wish to fix before
  41748. // setting or getting the value
  41749. cssProps: {},
  41750. // Get and set the style property on a DOM Node
  41751. style: function style(elem, name, value, extra) {
  41752. // Don't set styles on text and comment nodes
  41753. if (!elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style) {
  41754. return;
  41755. }
  41756. // Make sure that we're working with the right name
  41757. var ret,
  41758. type,
  41759. hooks,
  41760. origName = camelCase(name),
  41761. isCustomProp = rcustomProp.test(name),
  41762. style = elem.style;
  41763. // Make sure that we're working with the right name. We don't
  41764. // want to query the value if it is a CSS custom property
  41765. // since they are user-defined.
  41766. if (!isCustomProp) {
  41767. name = finalPropName(origName);
  41768. }
  41769. // Gets hook for the prefixed version, then unprefixed version
  41770. hooks = jQuery.cssHooks[name] || jQuery.cssHooks[origName];
  41771. // Check if we're setting a value
  41772. if (value !== undefined) {
  41773. type = typeof value === "undefined" ? "undefined" : _typeof(value);
  41774. // Convert "+=" or "-=" to relative numbers (#7345)
  41775. if (type === "string" && (ret = rcssNum.exec(value)) && ret[1]) {
  41776. value = adjustCSS(elem, name, ret);
  41777. // Fixes bug #9237
  41778. type = "number";
  41779. }
  41780. // Make sure that null and NaN values aren't set (#7116)
  41781. if (value == null || value !== value) {
  41782. return;
  41783. }
  41784. // If a number was passed in, add the unit (except for certain CSS properties)
  41785. if (type === "number") {
  41786. value += ret && ret[3] || (jQuery.cssNumber[origName] ? "" : "px");
  41787. }
  41788. // background-* props affect original clone's values
  41789. if (!support.clearCloneStyle && value === "" && name.indexOf("background") === 0) {
  41790. style[name] = "inherit";
  41791. }
  41792. // If a hook was provided, use that value, otherwise just set the specified value
  41793. if (!hooks || !("set" in hooks) || (value = hooks.set(elem, value, extra)) !== undefined) {
  41794. if (isCustomProp) {
  41795. style.setProperty(name, value);
  41796. } else {
  41797. style[name] = value;
  41798. }
  41799. }
  41800. } else {
  41801. // If a hook was provided get the non-computed value from there
  41802. if (hooks && "get" in hooks && (ret = hooks.get(elem, false, extra)) !== undefined) {
  41803. return ret;
  41804. }
  41805. // Otherwise just get the value from the style object
  41806. return style[name];
  41807. }
  41808. },
  41809. css: function css(elem, name, extra, styles) {
  41810. var val,
  41811. num,
  41812. hooks,
  41813. origName = camelCase(name),
  41814. isCustomProp = rcustomProp.test(name);
  41815. // Make sure that we're working with the right name. We don't
  41816. // want to modify the value if it is a CSS custom property
  41817. // since they are user-defined.
  41818. if (!isCustomProp) {
  41819. name = finalPropName(origName);
  41820. }
  41821. // Try prefixed name followed by the unprefixed name
  41822. hooks = jQuery.cssHooks[name] || jQuery.cssHooks[origName];
  41823. // If a hook was provided get the computed value from there
  41824. if (hooks && "get" in hooks) {
  41825. val = hooks.get(elem, true, extra);
  41826. }
  41827. // Otherwise, if a way to get the computed value exists, use that
  41828. if (val === undefined) {
  41829. val = curCSS(elem, name, styles);
  41830. }
  41831. // Convert "normal" to computed value
  41832. if (val === "normal" && name in cssNormalTransform) {
  41833. val = cssNormalTransform[name];
  41834. }
  41835. // Make numeric if forced or a qualifier was provided and val looks numeric
  41836. if (extra === "" || extra) {
  41837. num = parseFloat(val);
  41838. return extra === true || isFinite(num) ? num || 0 : val;
  41839. }
  41840. return val;
  41841. }
  41842. });
  41843. jQuery.each(["height", "width"], function (i, dimension) {
  41844. jQuery.cssHooks[dimension] = {
  41845. get: function get(elem, computed, extra) {
  41846. if (computed) {
  41847. // Certain elements can have dimension info if we invisibly show them
  41848. // but it must have a current display style that would benefit
  41849. return rdisplayswap.test(jQuery.css(elem, "display")) && (
  41850. // Support: Safari 8+
  41851. // Table columns in Safari have non-zero offsetWidth & zero
  41852. // getBoundingClientRect().width unless display is changed.
  41853. // Support: IE <=11 only
  41854. // Running getBoundingClientRect on a disconnected node
  41855. // in IE throws an error.
  41856. !elem.getClientRects().length || !elem.getBoundingClientRect().width) ? swap(elem, cssShow, function () {
  41857. return getWidthOrHeight(elem, dimension, extra);
  41858. }) : getWidthOrHeight(elem, dimension, extra);
  41859. }
  41860. },
  41861. set: function set(elem, value, extra) {
  41862. var matches,
  41863. styles = getStyles(elem),
  41864. isBorderBox = jQuery.css(elem, "boxSizing", false, styles) === "border-box",
  41865. subtract = extra && boxModelAdjustment(elem, dimension, extra, isBorderBox, styles);
  41866. // Account for unreliable border-box dimensions by comparing offset* to computed and
  41867. // faking a content-box to get border and padding (gh-3699)
  41868. if (isBorderBox && support.scrollboxSize() === styles.position) {
  41869. subtract -= Math.ceil(elem["offset" + dimension[0].toUpperCase() + dimension.slice(1)] - parseFloat(styles[dimension]) - boxModelAdjustment(elem, dimension, "border", false, styles) - 0.5);
  41870. }
  41871. // Convert to pixels if value adjustment is needed
  41872. if (subtract && (matches = rcssNum.exec(value)) && (matches[3] || "px") !== "px") {
  41873. elem.style[dimension] = value;
  41874. value = jQuery.css(elem, dimension);
  41875. }
  41876. return setPositiveNumber(elem, value, subtract);
  41877. }
  41878. };
  41879. });
  41880. jQuery.cssHooks.marginLeft = addGetHookIf(support.reliableMarginLeft, function (elem, computed) {
  41881. if (computed) {
  41882. return (parseFloat(curCSS(elem, "marginLeft")) || elem.getBoundingClientRect().left - swap(elem, { marginLeft: 0 }, function () {
  41883. return elem.getBoundingClientRect().left;
  41884. })) + "px";
  41885. }
  41886. });
  41887. // These hooks are used by animate to expand properties
  41888. jQuery.each({
  41889. margin: "",
  41890. padding: "",
  41891. border: "Width"
  41892. }, function (prefix, suffix) {
  41893. jQuery.cssHooks[prefix + suffix] = {
  41894. expand: function expand(value) {
  41895. var i = 0,
  41896. expanded = {},
  41897. // Assumes a single number if not a string
  41898. parts = typeof value === "string" ? value.split(" ") : [value];
  41899. for (; i < 4; i++) {
  41900. expanded[prefix + cssExpand[i] + suffix] = parts[i] || parts[i - 2] || parts[0];
  41901. }
  41902. return expanded;
  41903. }
  41904. };
  41905. if (prefix !== "margin") {
  41906. jQuery.cssHooks[prefix + suffix].set = setPositiveNumber;
  41907. }
  41908. });
  41909. jQuery.fn.extend({
  41910. css: function css(name, value) {
  41911. return access(this, function (elem, name, value) {
  41912. var styles,
  41913. len,
  41914. map = {},
  41915. i = 0;
  41916. if (Array.isArray(name)) {
  41917. styles = getStyles(elem);
  41918. len = name.length;
  41919. for (; i < len; i++) {
  41920. map[name[i]] = jQuery.css(elem, name[i], false, styles);
  41921. }
  41922. return map;
  41923. }
  41924. return value !== undefined ? jQuery.style(elem, name, value) : jQuery.css(elem, name);
  41925. }, name, value, arguments.length > 1);
  41926. }
  41927. });
  41928. function Tween(elem, options, prop, end, easing) {
  41929. return new Tween.prototype.init(elem, options, prop, end, easing);
  41930. }
  41931. jQuery.Tween = Tween;
  41932. Tween.prototype = {
  41933. constructor: Tween,
  41934. init: function init(elem, options, prop, end, easing, unit) {
  41935. this.elem = elem;
  41936. this.prop = prop;
  41937. this.easing = easing || jQuery.easing._default;
  41938. this.options = options;
  41939. this.start = this.now = this.cur();
  41940. this.end = end;
  41941. this.unit = unit || (jQuery.cssNumber[prop] ? "" : "px");
  41942. },
  41943. cur: function cur() {
  41944. var hooks = Tween.propHooks[this.prop];
  41945. return hooks && hooks.get ? hooks.get(this) : Tween.propHooks._default.get(this);
  41946. },
  41947. run: function run(percent) {
  41948. var eased,
  41949. hooks = Tween.propHooks[this.prop];
  41950. if (this.options.duration) {
  41951. this.pos = eased = jQuery.easing[this.easing](percent, this.options.duration * percent, 0, 1, this.options.duration);
  41952. } else {
  41953. this.pos = eased = percent;
  41954. }
  41955. this.now = (this.end - this.start) * eased + this.start;
  41956. if (this.options.step) {
  41957. this.options.step.call(this.elem, this.now, this);
  41958. }
  41959. if (hooks && hooks.set) {
  41960. hooks.set(this);
  41961. } else {
  41962. Tween.propHooks._default.set(this);
  41963. }
  41964. return this;
  41965. }
  41966. };
  41967. Tween.prototype.init.prototype = Tween.prototype;
  41968. Tween.propHooks = {
  41969. _default: {
  41970. get: function get(tween) {
  41971. var result;
  41972. // Use a property on the element directly when it is not a DOM element,
  41973. // or when there is no matching style property that exists.
  41974. if (tween.elem.nodeType !== 1 || tween.elem[tween.prop] != null && tween.elem.style[tween.prop] == null) {
  41975. return tween.elem[tween.prop];
  41976. }
  41977. // Passing an empty string as a 3rd parameter to .css will automatically
  41978. // attempt a parseFloat and fallback to a string if the parse fails.
  41979. // Simple values such as "10px" are parsed to Float;
  41980. // complex values such as "rotate(1rad)" are returned as-is.
  41981. result = jQuery.css(tween.elem, tween.prop, "");
  41982. // Empty strings, null, undefined and "auto" are converted to 0.
  41983. return !result || result === "auto" ? 0 : result;
  41984. },
  41985. set: function set(tween) {
  41986. // Use step hook for back compat.
  41987. // Use cssHook if its there.
  41988. // Use .style if available and use plain properties where available.
  41989. if (jQuery.fx.step[tween.prop]) {
  41990. jQuery.fx.step[tween.prop](tween);
  41991. } else if (tween.elem.nodeType === 1 && (tween.elem.style[jQuery.cssProps[tween.prop]] != null || jQuery.cssHooks[tween.prop])) {
  41992. jQuery.style(tween.elem, tween.prop, tween.now + tween.unit);
  41993. } else {
  41994. tween.elem[tween.prop] = tween.now;
  41995. }
  41996. }
  41997. }
  41998. };
  41999. // Support: IE <=9 only
  42000. // Panic based approach to setting things on disconnected nodes
  42001. Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = {
  42002. set: function set(tween) {
  42003. if (tween.elem.nodeType && tween.elem.parentNode) {
  42004. tween.elem[tween.prop] = tween.now;
  42005. }
  42006. }
  42007. };
  42008. jQuery.easing = {
  42009. linear: function linear(p) {
  42010. return p;
  42011. },
  42012. swing: function swing(p) {
  42013. return 0.5 - Math.cos(p * Math.PI) / 2;
  42014. },
  42015. _default: "swing"
  42016. };
  42017. jQuery.fx = Tween.prototype.init;
  42018. // Back compat <1.8 extension point
  42019. jQuery.fx.step = {};
  42020. var fxNow,
  42021. inProgress,
  42022. rfxtypes = /^(?:toggle|show|hide)$/,
  42023. rrun = /queueHooks$/;
  42024. function schedule() {
  42025. if (inProgress) {
  42026. if (document.hidden === false && window.requestAnimationFrame) {
  42027. window.requestAnimationFrame(schedule);
  42028. } else {
  42029. window.setTimeout(schedule, jQuery.fx.interval);
  42030. }
  42031. jQuery.fx.tick();
  42032. }
  42033. }
  42034. // Animations created synchronously will run synchronously
  42035. function createFxNow() {
  42036. window.setTimeout(function () {
  42037. fxNow = undefined;
  42038. });
  42039. return fxNow = Date.now();
  42040. }
  42041. // Generate parameters to create a standard animation
  42042. function genFx(type, includeWidth) {
  42043. var which,
  42044. i = 0,
  42045. attrs = { height: type };
  42046. // If we include width, step value is 1 to do all cssExpand values,
  42047. // otherwise step value is 2 to skip over Left and Right
  42048. includeWidth = includeWidth ? 1 : 0;
  42049. for (; i < 4; i += 2 - includeWidth) {
  42050. which = cssExpand[i];
  42051. attrs["margin" + which] = attrs["padding" + which] = type;
  42052. }
  42053. if (includeWidth) {
  42054. attrs.opacity = attrs.width = type;
  42055. }
  42056. return attrs;
  42057. }
  42058. function createTween(value, prop, animation) {
  42059. var tween,
  42060. collection = (Animation.tweeners[prop] || []).concat(Animation.tweeners["*"]),
  42061. index = 0,
  42062. length = collection.length;
  42063. for (; index < length; index++) {
  42064. if (tween = collection[index].call(animation, prop, value)) {
  42065. // We're done with this property
  42066. return tween;
  42067. }
  42068. }
  42069. }
  42070. function defaultPrefilter(elem, props, opts) {
  42071. var prop,
  42072. value,
  42073. toggle,
  42074. hooks,
  42075. oldfire,
  42076. propTween,
  42077. restoreDisplay,
  42078. display,
  42079. isBox = "width" in props || "height" in props,
  42080. anim = this,
  42081. orig = {},
  42082. style = elem.style,
  42083. hidden = elem.nodeType && isHiddenWithinTree(elem),
  42084. dataShow = dataPriv.get(elem, "fxshow");
  42085. // Queue-skipping animations hijack the fx hooks
  42086. if (!opts.queue) {
  42087. hooks = jQuery._queueHooks(elem, "fx");
  42088. if (hooks.unqueued == null) {
  42089. hooks.unqueued = 0;
  42090. oldfire = hooks.empty.fire;
  42091. hooks.empty.fire = function () {
  42092. if (!hooks.unqueued) {
  42093. oldfire();
  42094. }
  42095. };
  42096. }
  42097. hooks.unqueued++;
  42098. anim.always(function () {
  42099. // Ensure the complete handler is called before this completes
  42100. anim.always(function () {
  42101. hooks.unqueued--;
  42102. if (!jQuery.queue(elem, "fx").length) {
  42103. hooks.empty.fire();
  42104. }
  42105. });
  42106. });
  42107. }
  42108. // Detect show/hide animations
  42109. for (prop in props) {
  42110. value = props[prop];
  42111. if (rfxtypes.test(value)) {
  42112. delete props[prop];
  42113. toggle = toggle || value === "toggle";
  42114. if (value === (hidden ? "hide" : "show")) {
  42115. // Pretend to be hidden if this is a "show" and
  42116. // there is still data from a stopped show/hide
  42117. if (value === "show" && dataShow && dataShow[prop] !== undefined) {
  42118. hidden = true;
  42119. // Ignore all other no-op show/hide data
  42120. } else {
  42121. continue;
  42122. }
  42123. }
  42124. orig[prop] = dataShow && dataShow[prop] || jQuery.style(elem, prop);
  42125. }
  42126. }
  42127. // Bail out if this is a no-op like .hide().hide()
  42128. propTween = !jQuery.isEmptyObject(props);
  42129. if (!propTween && jQuery.isEmptyObject(orig)) {
  42130. return;
  42131. }
  42132. // Restrict "overflow" and "display" styles during box animations
  42133. if (isBox && elem.nodeType === 1) {
  42134. // Support: IE <=9 - 11, Edge 12 - 15
  42135. // Record all 3 overflow attributes because IE does not infer the shorthand
  42136. // from identically-valued overflowX and overflowY and Edge just mirrors
  42137. // the overflowX value there.
  42138. opts.overflow = [style.overflow, style.overflowX, style.overflowY];
  42139. // Identify a display type, preferring old show/hide data over the CSS cascade
  42140. restoreDisplay = dataShow && dataShow.display;
  42141. if (restoreDisplay == null) {
  42142. restoreDisplay = dataPriv.get(elem, "display");
  42143. }
  42144. display = jQuery.css(elem, "display");
  42145. if (display === "none") {
  42146. if (restoreDisplay) {
  42147. display = restoreDisplay;
  42148. } else {
  42149. // Get nonempty value(s) by temporarily forcing visibility
  42150. showHide([elem], true);
  42151. restoreDisplay = elem.style.display || restoreDisplay;
  42152. display = jQuery.css(elem, "display");
  42153. showHide([elem]);
  42154. }
  42155. }
  42156. // Animate inline elements as inline-block
  42157. if (display === "inline" || display === "inline-block" && restoreDisplay != null) {
  42158. if (jQuery.css(elem, "float") === "none") {
  42159. // Restore the original display value at the end of pure show/hide animations
  42160. if (!propTween) {
  42161. anim.done(function () {
  42162. style.display = restoreDisplay;
  42163. });
  42164. if (restoreDisplay == null) {
  42165. display = style.display;
  42166. restoreDisplay = display === "none" ? "" : display;
  42167. }
  42168. }
  42169. style.display = "inline-block";
  42170. }
  42171. }
  42172. }
  42173. if (opts.overflow) {
  42174. style.overflow = "hidden";
  42175. anim.always(function () {
  42176. style.overflow = opts.overflow[0];
  42177. style.overflowX = opts.overflow[1];
  42178. style.overflowY = opts.overflow[2];
  42179. });
  42180. }
  42181. // Implement show/hide animations
  42182. propTween = false;
  42183. for (prop in orig) {
  42184. // General show/hide setup for this element animation
  42185. if (!propTween) {
  42186. if (dataShow) {
  42187. if ("hidden" in dataShow) {
  42188. hidden = dataShow.hidden;
  42189. }
  42190. } else {
  42191. dataShow = dataPriv.access(elem, "fxshow", { display: restoreDisplay });
  42192. }
  42193. // Store hidden/visible for toggle so `.stop().toggle()` "reverses"
  42194. if (toggle) {
  42195. dataShow.hidden = !hidden;
  42196. }
  42197. // Show elements before animating them
  42198. if (hidden) {
  42199. showHide([elem], true);
  42200. }
  42201. /* eslint-disable no-loop-func */
  42202. anim.done(function () {
  42203. /* eslint-enable no-loop-func */
  42204. // The final step of a "hide" animation is actually hiding the element
  42205. if (!hidden) {
  42206. showHide([elem]);
  42207. }
  42208. dataPriv.remove(elem, "fxshow");
  42209. for (prop in orig) {
  42210. jQuery.style(elem, prop, orig[prop]);
  42211. }
  42212. });
  42213. }
  42214. // Per-property setup
  42215. propTween = createTween(hidden ? dataShow[prop] : 0, prop, anim);
  42216. if (!(prop in dataShow)) {
  42217. dataShow[prop] = propTween.start;
  42218. if (hidden) {
  42219. propTween.end = propTween.start;
  42220. propTween.start = 0;
  42221. }
  42222. }
  42223. }
  42224. }
  42225. function propFilter(props, specialEasing) {
  42226. var index, name, easing, value, hooks;
  42227. // camelCase, specialEasing and expand cssHook pass
  42228. for (index in props) {
  42229. name = camelCase(index);
  42230. easing = specialEasing[name];
  42231. value = props[index];
  42232. if (Array.isArray(value)) {
  42233. easing = value[1];
  42234. value = props[index] = value[0];
  42235. }
  42236. if (index !== name) {
  42237. props[name] = value;
  42238. delete props[index];
  42239. }
  42240. hooks = jQuery.cssHooks[name];
  42241. if (hooks && "expand" in hooks) {
  42242. value = hooks.expand(value);
  42243. delete props[name];
  42244. // Not quite $.extend, this won't overwrite existing keys.
  42245. // Reusing 'index' because we have the correct "name"
  42246. for (index in value) {
  42247. if (!(index in props)) {
  42248. props[index] = value[index];
  42249. specialEasing[index] = easing;
  42250. }
  42251. }
  42252. } else {
  42253. specialEasing[name] = easing;
  42254. }
  42255. }
  42256. }
  42257. function Animation(elem, properties, options) {
  42258. var result,
  42259. stopped,
  42260. index = 0,
  42261. length = Animation.prefilters.length,
  42262. deferred = jQuery.Deferred().always(function () {
  42263. // Don't match elem in the :animated selector
  42264. delete tick.elem;
  42265. }),
  42266. tick = function tick() {
  42267. if (stopped) {
  42268. return false;
  42269. }
  42270. var currentTime = fxNow || createFxNow(),
  42271. remaining = Math.max(0, animation.startTime + animation.duration - currentTime),
  42272. // Support: Android 2.3 only
  42273. // Archaic crash bug won't allow us to use `1 - ( 0.5 || 0 )` (#12497)
  42274. temp = remaining / animation.duration || 0,
  42275. percent = 1 - temp,
  42276. index = 0,
  42277. length = animation.tweens.length;
  42278. for (; index < length; index++) {
  42279. animation.tweens[index].run(percent);
  42280. }
  42281. deferred.notifyWith(elem, [animation, percent, remaining]);
  42282. // If there's more to do, yield
  42283. if (percent < 1 && length) {
  42284. return remaining;
  42285. }
  42286. // If this was an empty animation, synthesize a final progress notification
  42287. if (!length) {
  42288. deferred.notifyWith(elem, [animation, 1, 0]);
  42289. }
  42290. // Resolve the animation and report its conclusion
  42291. deferred.resolveWith(elem, [animation]);
  42292. return false;
  42293. },
  42294. animation = deferred.promise({
  42295. elem: elem,
  42296. props: jQuery.extend({}, properties),
  42297. opts: jQuery.extend(true, {
  42298. specialEasing: {},
  42299. easing: jQuery.easing._default
  42300. }, options),
  42301. originalProperties: properties,
  42302. originalOptions: options,
  42303. startTime: fxNow || createFxNow(),
  42304. duration: options.duration,
  42305. tweens: [],
  42306. createTween: function createTween(prop, end) {
  42307. var tween = jQuery.Tween(elem, animation.opts, prop, end, animation.opts.specialEasing[prop] || animation.opts.easing);
  42308. animation.tweens.push(tween);
  42309. return tween;
  42310. },
  42311. stop: function stop(gotoEnd) {
  42312. var index = 0,
  42313. // If we are going to the end, we want to run all the tweens
  42314. // otherwise we skip this part
  42315. length = gotoEnd ? animation.tweens.length : 0;
  42316. if (stopped) {
  42317. return this;
  42318. }
  42319. stopped = true;
  42320. for (; index < length; index++) {
  42321. animation.tweens[index].run(1);
  42322. }
  42323. // Resolve when we played the last frame; otherwise, reject
  42324. if (gotoEnd) {
  42325. deferred.notifyWith(elem, [animation, 1, 0]);
  42326. deferred.resolveWith(elem, [animation, gotoEnd]);
  42327. } else {
  42328. deferred.rejectWith(elem, [animation, gotoEnd]);
  42329. }
  42330. return this;
  42331. }
  42332. }),
  42333. props = animation.props;
  42334. propFilter(props, animation.opts.specialEasing);
  42335. for (; index < length; index++) {
  42336. result = Animation.prefilters[index].call(animation, elem, props, animation.opts);
  42337. if (result) {
  42338. if (isFunction(result.stop)) {
  42339. jQuery._queueHooks(animation.elem, animation.opts.queue).stop = result.stop.bind(result);
  42340. }
  42341. return result;
  42342. }
  42343. }
  42344. jQuery.map(props, createTween, animation);
  42345. if (isFunction(animation.opts.start)) {
  42346. animation.opts.start.call(elem, animation);
  42347. }
  42348. // Attach callbacks from options
  42349. animation.progress(animation.opts.progress).done(animation.opts.done, animation.opts.complete).fail(animation.opts.fail).always(animation.opts.always);
  42350. jQuery.fx.timer(jQuery.extend(tick, {
  42351. elem: elem,
  42352. anim: animation,
  42353. queue: animation.opts.queue
  42354. }));
  42355. return animation;
  42356. }
  42357. jQuery.Animation = jQuery.extend(Animation, {
  42358. tweeners: {
  42359. "*": [function (prop, value) {
  42360. var tween = this.createTween(prop, value);
  42361. adjustCSS(tween.elem, prop, rcssNum.exec(value), tween);
  42362. return tween;
  42363. }]
  42364. },
  42365. tweener: function tweener(props, callback) {
  42366. if (isFunction(props)) {
  42367. callback = props;
  42368. props = ["*"];
  42369. } else {
  42370. props = props.match(rnothtmlwhite);
  42371. }
  42372. var prop,
  42373. index = 0,
  42374. length = props.length;
  42375. for (; index < length; index++) {
  42376. prop = props[index];
  42377. Animation.tweeners[prop] = Animation.tweeners[prop] || [];
  42378. Animation.tweeners[prop].unshift(callback);
  42379. }
  42380. },
  42381. prefilters: [defaultPrefilter],
  42382. prefilter: function prefilter(callback, prepend) {
  42383. if (prepend) {
  42384. Animation.prefilters.unshift(callback);
  42385. } else {
  42386. Animation.prefilters.push(callback);
  42387. }
  42388. }
  42389. });
  42390. jQuery.speed = function (speed, easing, fn) {
  42391. var opt = speed && (typeof speed === "undefined" ? "undefined" : _typeof(speed)) === "object" ? jQuery.extend({}, speed) : {
  42392. complete: fn || !fn && easing || isFunction(speed) && speed,
  42393. duration: speed,
  42394. easing: fn && easing || easing && !isFunction(easing) && easing
  42395. };
  42396. // Go to the end state if fx are off
  42397. if (jQuery.fx.off) {
  42398. opt.duration = 0;
  42399. } else {
  42400. if (typeof opt.duration !== "number") {
  42401. if (opt.duration in jQuery.fx.speeds) {
  42402. opt.duration = jQuery.fx.speeds[opt.duration];
  42403. } else {
  42404. opt.duration = jQuery.fx.speeds._default;
  42405. }
  42406. }
  42407. }
  42408. // Normalize opt.queue - true/undefined/null -> "fx"
  42409. if (opt.queue == null || opt.queue === true) {
  42410. opt.queue = "fx";
  42411. }
  42412. // Queueing
  42413. opt.old = opt.complete;
  42414. opt.complete = function () {
  42415. if (isFunction(opt.old)) {
  42416. opt.old.call(this);
  42417. }
  42418. if (opt.queue) {
  42419. jQuery.dequeue(this, opt.queue);
  42420. }
  42421. };
  42422. return opt;
  42423. };
  42424. jQuery.fn.extend({
  42425. fadeTo: function fadeTo(speed, to, easing, callback) {
  42426. // Show any hidden elements after setting opacity to 0
  42427. return this.filter(isHiddenWithinTree).css("opacity", 0).show()
  42428. // Animate to the value specified
  42429. .end().animate({ opacity: to }, speed, easing, callback);
  42430. },
  42431. animate: function animate(prop, speed, easing, callback) {
  42432. var empty = jQuery.isEmptyObject(prop),
  42433. optall = jQuery.speed(speed, easing, callback),
  42434. doAnimation = function doAnimation() {
  42435. // Operate on a copy of prop so per-property easing won't be lost
  42436. var anim = Animation(this, jQuery.extend({}, prop), optall);
  42437. // Empty animations, or finishing resolves immediately
  42438. if (empty || dataPriv.get(this, "finish")) {
  42439. anim.stop(true);
  42440. }
  42441. };
  42442. doAnimation.finish = doAnimation;
  42443. return empty || optall.queue === false ? this.each(doAnimation) : this.queue(optall.queue, doAnimation);
  42444. },
  42445. stop: function stop(type, clearQueue, gotoEnd) {
  42446. var stopQueue = function stopQueue(hooks) {
  42447. var stop = hooks.stop;
  42448. delete hooks.stop;
  42449. stop(gotoEnd);
  42450. };
  42451. if (typeof type !== "string") {
  42452. gotoEnd = clearQueue;
  42453. clearQueue = type;
  42454. type = undefined;
  42455. }
  42456. if (clearQueue && type !== false) {
  42457. this.queue(type || "fx", []);
  42458. }
  42459. return this.each(function () {
  42460. var dequeue = true,
  42461. index = type != null && type + "queueHooks",
  42462. timers = jQuery.timers,
  42463. data = dataPriv.get(this);
  42464. if (index) {
  42465. if (data[index] && data[index].stop) {
  42466. stopQueue(data[index]);
  42467. }
  42468. } else {
  42469. for (index in data) {
  42470. if (data[index] && data[index].stop && rrun.test(index)) {
  42471. stopQueue(data[index]);
  42472. }
  42473. }
  42474. }
  42475. for (index = timers.length; index--;) {
  42476. if (timers[index].elem === this && (type == null || timers[index].queue === type)) {
  42477. timers[index].anim.stop(gotoEnd);
  42478. dequeue = false;
  42479. timers.splice(index, 1);
  42480. }
  42481. }
  42482. // Start the next in the queue if the last step wasn't forced.
  42483. // Timers currently will call their complete callbacks, which
  42484. // will dequeue but only if they were gotoEnd.
  42485. if (dequeue || !gotoEnd) {
  42486. jQuery.dequeue(this, type);
  42487. }
  42488. });
  42489. },
  42490. finish: function finish(type) {
  42491. if (type !== false) {
  42492. type = type || "fx";
  42493. }
  42494. return this.each(function () {
  42495. var index,
  42496. data = dataPriv.get(this),
  42497. queue = data[type + "queue"],
  42498. hooks = data[type + "queueHooks"],
  42499. timers = jQuery.timers,
  42500. length = queue ? queue.length : 0;
  42501. // Enable finishing flag on private data
  42502. data.finish = true;
  42503. // Empty the queue first
  42504. jQuery.queue(this, type, []);
  42505. if (hooks && hooks.stop) {
  42506. hooks.stop.call(this, true);
  42507. }
  42508. // Look for any active animations, and finish them
  42509. for (index = timers.length; index--;) {
  42510. if (timers[index].elem === this && timers[index].queue === type) {
  42511. timers[index].anim.stop(true);
  42512. timers.splice(index, 1);
  42513. }
  42514. }
  42515. // Look for any animations in the old queue and finish them
  42516. for (index = 0; index < length; index++) {
  42517. if (queue[index] && queue[index].finish) {
  42518. queue[index].finish.call(this);
  42519. }
  42520. }
  42521. // Turn off finishing flag
  42522. delete data.finish;
  42523. });
  42524. }
  42525. });
  42526. jQuery.each(["toggle", "show", "hide"], function (i, name) {
  42527. var cssFn = jQuery.fn[name];
  42528. jQuery.fn[name] = function (speed, easing, callback) {
  42529. return speed == null || typeof speed === "boolean" ? cssFn.apply(this, arguments) : this.animate(genFx(name, true), speed, easing, callback);
  42530. };
  42531. });
  42532. // Generate shortcuts for custom animations
  42533. jQuery.each({
  42534. slideDown: genFx("show"),
  42535. slideUp: genFx("hide"),
  42536. slideToggle: genFx("toggle"),
  42537. fadeIn: { opacity: "show" },
  42538. fadeOut: { opacity: "hide" },
  42539. fadeToggle: { opacity: "toggle" }
  42540. }, function (name, props) {
  42541. jQuery.fn[name] = function (speed, easing, callback) {
  42542. return this.animate(props, speed, easing, callback);
  42543. };
  42544. });
  42545. jQuery.timers = [];
  42546. jQuery.fx.tick = function () {
  42547. var timer,
  42548. i = 0,
  42549. timers = jQuery.timers;
  42550. fxNow = Date.now();
  42551. for (; i < timers.length; i++) {
  42552. timer = timers[i];
  42553. // Run the timer and safely remove it when done (allowing for external removal)
  42554. if (!timer() && timers[i] === timer) {
  42555. timers.splice(i--, 1);
  42556. }
  42557. }
  42558. if (!timers.length) {
  42559. jQuery.fx.stop();
  42560. }
  42561. fxNow = undefined;
  42562. };
  42563. jQuery.fx.timer = function (timer) {
  42564. jQuery.timers.push(timer);
  42565. jQuery.fx.start();
  42566. };
  42567. jQuery.fx.interval = 13;
  42568. jQuery.fx.start = function () {
  42569. if (inProgress) {
  42570. return;
  42571. }
  42572. inProgress = true;
  42573. schedule();
  42574. };
  42575. jQuery.fx.stop = function () {
  42576. inProgress = null;
  42577. };
  42578. jQuery.fx.speeds = {
  42579. slow: 600,
  42580. fast: 200,
  42581. // Default speed
  42582. _default: 400
  42583. };
  42584. // Based off of the plugin by Clint Helfers, with permission.
  42585. // https://web.archive.org/web/20100324014747/http://blindsignals.com/index.php/2009/07/jquery-delay/
  42586. jQuery.fn.delay = function (time, type) {
  42587. time = jQuery.fx ? jQuery.fx.speeds[time] || time : time;
  42588. type = type || "fx";
  42589. return this.queue(type, function (next, hooks) {
  42590. var timeout = window.setTimeout(next, time);
  42591. hooks.stop = function () {
  42592. window.clearTimeout(timeout);
  42593. };
  42594. });
  42595. };
  42596. (function () {
  42597. var input = document.createElement("input"),
  42598. select = document.createElement("select"),
  42599. opt = select.appendChild(document.createElement("option"));
  42600. input.type = "checkbox";
  42601. // Support: Android <=4.3 only
  42602. // Default value for a checkbox should be "on"
  42603. support.checkOn = input.value !== "";
  42604. // Support: IE <=11 only
  42605. // Must access selectedIndex to make default options select
  42606. support.optSelected = opt.selected;
  42607. // Support: IE <=11 only
  42608. // An input loses its value after becoming a radio
  42609. input = document.createElement("input");
  42610. input.value = "t";
  42611. input.type = "radio";
  42612. support.radioValue = input.value === "t";
  42613. })();
  42614. var boolHook,
  42615. attrHandle = jQuery.expr.attrHandle;
  42616. jQuery.fn.extend({
  42617. attr: function attr(name, value) {
  42618. return access(this, jQuery.attr, name, value, arguments.length > 1);
  42619. },
  42620. removeAttr: function removeAttr(name) {
  42621. return this.each(function () {
  42622. jQuery.removeAttr(this, name);
  42623. });
  42624. }
  42625. });
  42626. jQuery.extend({
  42627. attr: function attr(elem, name, value) {
  42628. var ret,
  42629. hooks,
  42630. nType = elem.nodeType;
  42631. // Don't get/set attributes on text, comment and attribute nodes
  42632. if (nType === 3 || nType === 8 || nType === 2) {
  42633. return;
  42634. }
  42635. // Fallback to prop when attributes are not supported
  42636. if (typeof elem.getAttribute === "undefined") {
  42637. return jQuery.prop(elem, name, value);
  42638. }
  42639. // Attribute hooks are determined by the lowercase version
  42640. // Grab necessary hook if one is defined
  42641. if (nType !== 1 || !jQuery.isXMLDoc(elem)) {
  42642. hooks = jQuery.attrHooks[name.toLowerCase()] || (jQuery.expr.match.bool.test(name) ? boolHook : undefined);
  42643. }
  42644. if (value !== undefined) {
  42645. if (value === null) {
  42646. jQuery.removeAttr(elem, name);
  42647. return;
  42648. }
  42649. if (hooks && "set" in hooks && (ret = hooks.set(elem, value, name)) !== undefined) {
  42650. return ret;
  42651. }
  42652. elem.setAttribute(name, value + "");
  42653. return value;
  42654. }
  42655. if (hooks && "get" in hooks && (ret = hooks.get(elem, name)) !== null) {
  42656. return ret;
  42657. }
  42658. ret = jQuery.find.attr(elem, name);
  42659. // Non-existent attributes return null, we normalize to undefined
  42660. return ret == null ? undefined : ret;
  42661. },
  42662. attrHooks: {
  42663. type: {
  42664. set: function set(elem, value) {
  42665. if (!support.radioValue && value === "radio" && nodeName(elem, "input")) {
  42666. var val = elem.value;
  42667. elem.setAttribute("type", value);
  42668. if (val) {
  42669. elem.value = val;
  42670. }
  42671. return value;
  42672. }
  42673. }
  42674. }
  42675. },
  42676. removeAttr: function removeAttr(elem, value) {
  42677. var name,
  42678. i = 0,
  42679. // Attribute names can contain non-HTML whitespace characters
  42680. // https://html.spec.whatwg.org/multipage/syntax.html#attributes-2
  42681. attrNames = value && value.match(rnothtmlwhite);
  42682. if (attrNames && elem.nodeType === 1) {
  42683. while (name = attrNames[i++]) {
  42684. elem.removeAttribute(name);
  42685. }
  42686. }
  42687. }
  42688. });
  42689. // Hooks for boolean attributes
  42690. boolHook = {
  42691. set: function set(elem, value, name) {
  42692. if (value === false) {
  42693. // Remove boolean attributes when set to false
  42694. jQuery.removeAttr(elem, name);
  42695. } else {
  42696. elem.setAttribute(name, name);
  42697. }
  42698. return name;
  42699. }
  42700. };
  42701. jQuery.each(jQuery.expr.match.bool.source.match(/\w+/g), function (i, name) {
  42702. var getter = attrHandle[name] || jQuery.find.attr;
  42703. attrHandle[name] = function (elem, name, isXML) {
  42704. var ret,
  42705. handle,
  42706. lowercaseName = name.toLowerCase();
  42707. if (!isXML) {
  42708. // Avoid an infinite loop by temporarily removing this function from the getter
  42709. handle = attrHandle[lowercaseName];
  42710. attrHandle[lowercaseName] = ret;
  42711. ret = getter(elem, name, isXML) != null ? lowercaseName : null;
  42712. attrHandle[lowercaseName] = handle;
  42713. }
  42714. return ret;
  42715. };
  42716. });
  42717. var rfocusable = /^(?:input|select|textarea|button)$/i,
  42718. rclickable = /^(?:a|area)$/i;
  42719. jQuery.fn.extend({
  42720. prop: function prop(name, value) {
  42721. return access(this, jQuery.prop, name, value, arguments.length > 1);
  42722. },
  42723. removeProp: function removeProp(name) {
  42724. return this.each(function () {
  42725. delete this[jQuery.propFix[name] || name];
  42726. });
  42727. }
  42728. });
  42729. jQuery.extend({
  42730. prop: function prop(elem, name, value) {
  42731. var ret,
  42732. hooks,
  42733. nType = elem.nodeType;
  42734. // Don't get/set properties on text, comment and attribute nodes
  42735. if (nType === 3 || nType === 8 || nType === 2) {
  42736. return;
  42737. }
  42738. if (nType !== 1 || !jQuery.isXMLDoc(elem)) {
  42739. // Fix name and attach hooks
  42740. name = jQuery.propFix[name] || name;
  42741. hooks = jQuery.propHooks[name];
  42742. }
  42743. if (value !== undefined) {
  42744. if (hooks && "set" in hooks && (ret = hooks.set(elem, value, name)) !== undefined) {
  42745. return ret;
  42746. }
  42747. return elem[name] = value;
  42748. }
  42749. if (hooks && "get" in hooks && (ret = hooks.get(elem, name)) !== null) {
  42750. return ret;
  42751. }
  42752. return elem[name];
  42753. },
  42754. propHooks: {
  42755. tabIndex: {
  42756. get: function get(elem) {
  42757. // Support: IE <=9 - 11 only
  42758. // elem.tabIndex doesn't always return the
  42759. // correct value when it hasn't been explicitly set
  42760. // https://web.archive.org/web/20141116233347/http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
  42761. // Use proper attribute retrieval(#12072)
  42762. var tabindex = jQuery.find.attr(elem, "tabindex");
  42763. if (tabindex) {
  42764. return parseInt(tabindex, 10);
  42765. }
  42766. if (rfocusable.test(elem.nodeName) || rclickable.test(elem.nodeName) && elem.href) {
  42767. return 0;
  42768. }
  42769. return -1;
  42770. }
  42771. }
  42772. },
  42773. propFix: {
  42774. "for": "htmlFor",
  42775. "class": "className"
  42776. }
  42777. });
  42778. // Support: IE <=11 only
  42779. // Accessing the selectedIndex property
  42780. // forces the browser to respect setting selected
  42781. // on the option
  42782. // The getter ensures a default option is selected
  42783. // when in an optgroup
  42784. // eslint rule "no-unused-expressions" is disabled for this code
  42785. // since it considers such accessions noop
  42786. if (!support.optSelected) {
  42787. jQuery.propHooks.selected = {
  42788. get: function get(elem) {
  42789. /* eslint no-unused-expressions: "off" */
  42790. var parent = elem.parentNode;
  42791. if (parent && parent.parentNode) {
  42792. parent.parentNode.selectedIndex;
  42793. }
  42794. return null;
  42795. },
  42796. set: function set(elem) {
  42797. /* eslint no-unused-expressions: "off" */
  42798. var parent = elem.parentNode;
  42799. if (parent) {
  42800. parent.selectedIndex;
  42801. if (parent.parentNode) {
  42802. parent.parentNode.selectedIndex;
  42803. }
  42804. }
  42805. }
  42806. };
  42807. }
  42808. jQuery.each(["tabIndex", "readOnly", "maxLength", "cellSpacing", "cellPadding", "rowSpan", "colSpan", "useMap", "frameBorder", "contentEditable"], function () {
  42809. jQuery.propFix[this.toLowerCase()] = this;
  42810. });
  42811. // Strip and collapse whitespace according to HTML spec
  42812. // https://infra.spec.whatwg.org/#strip-and-collapse-ascii-whitespace
  42813. function stripAndCollapse(value) {
  42814. var tokens = value.match(rnothtmlwhite) || [];
  42815. return tokens.join(" ");
  42816. }
  42817. function getClass(elem) {
  42818. return elem.getAttribute && elem.getAttribute("class") || "";
  42819. }
  42820. function classesToArray(value) {
  42821. if (Array.isArray(value)) {
  42822. return value;
  42823. }
  42824. if (typeof value === "string") {
  42825. return value.match(rnothtmlwhite) || [];
  42826. }
  42827. return [];
  42828. }
  42829. jQuery.fn.extend({
  42830. addClass: function addClass(value) {
  42831. var classes,
  42832. elem,
  42833. cur,
  42834. curValue,
  42835. clazz,
  42836. j,
  42837. finalValue,
  42838. i = 0;
  42839. if (isFunction(value)) {
  42840. return this.each(function (j) {
  42841. jQuery(this).addClass(value.call(this, j, getClass(this)));
  42842. });
  42843. }
  42844. classes = classesToArray(value);
  42845. if (classes.length) {
  42846. while (elem = this[i++]) {
  42847. curValue = getClass(elem);
  42848. cur = elem.nodeType === 1 && " " + stripAndCollapse(curValue) + " ";
  42849. if (cur) {
  42850. j = 0;
  42851. while (clazz = classes[j++]) {
  42852. if (cur.indexOf(" " + clazz + " ") < 0) {
  42853. cur += clazz + " ";
  42854. }
  42855. }
  42856. // Only assign if different to avoid unneeded rendering.
  42857. finalValue = stripAndCollapse(cur);
  42858. if (curValue !== finalValue) {
  42859. elem.setAttribute("class", finalValue);
  42860. }
  42861. }
  42862. }
  42863. }
  42864. return this;
  42865. },
  42866. removeClass: function removeClass(value) {
  42867. var classes,
  42868. elem,
  42869. cur,
  42870. curValue,
  42871. clazz,
  42872. j,
  42873. finalValue,
  42874. i = 0;
  42875. if (isFunction(value)) {
  42876. return this.each(function (j) {
  42877. jQuery(this).removeClass(value.call(this, j, getClass(this)));
  42878. });
  42879. }
  42880. if (!arguments.length) {
  42881. return this.attr("class", "");
  42882. }
  42883. classes = classesToArray(value);
  42884. if (classes.length) {
  42885. while (elem = this[i++]) {
  42886. curValue = getClass(elem);
  42887. // This expression is here for better compressibility (see addClass)
  42888. cur = elem.nodeType === 1 && " " + stripAndCollapse(curValue) + " ";
  42889. if (cur) {
  42890. j = 0;
  42891. while (clazz = classes[j++]) {
  42892. // Remove *all* instances
  42893. while (cur.indexOf(" " + clazz + " ") > -1) {
  42894. cur = cur.replace(" " + clazz + " ", " ");
  42895. }
  42896. }
  42897. // Only assign if different to avoid unneeded rendering.
  42898. finalValue = stripAndCollapse(cur);
  42899. if (curValue !== finalValue) {
  42900. elem.setAttribute("class", finalValue);
  42901. }
  42902. }
  42903. }
  42904. }
  42905. return this;
  42906. },
  42907. toggleClass: function toggleClass(value, stateVal) {
  42908. var type = typeof value === "undefined" ? "undefined" : _typeof(value),
  42909. isValidValue = type === "string" || Array.isArray(value);
  42910. if (typeof stateVal === "boolean" && isValidValue) {
  42911. return stateVal ? this.addClass(value) : this.removeClass(value);
  42912. }
  42913. if (isFunction(value)) {
  42914. return this.each(function (i) {
  42915. jQuery(this).toggleClass(value.call(this, i, getClass(this), stateVal), stateVal);
  42916. });
  42917. }
  42918. return this.each(function () {
  42919. var className, i, self, classNames;
  42920. if (isValidValue) {
  42921. // Toggle individual class names
  42922. i = 0;
  42923. self = jQuery(this);
  42924. classNames = classesToArray(value);
  42925. while (className = classNames[i++]) {
  42926. // Check each className given, space separated list
  42927. if (self.hasClass(className)) {
  42928. self.removeClass(className);
  42929. } else {
  42930. self.addClass(className);
  42931. }
  42932. }
  42933. // Toggle whole class name
  42934. } else if (value === undefined || type === "boolean") {
  42935. className = getClass(this);
  42936. if (className) {
  42937. // Store className if set
  42938. dataPriv.set(this, "__className__", className);
  42939. }
  42940. // If the element has a class name or if we're passed `false`,
  42941. // then remove the whole classname (if there was one, the above saved it).
  42942. // Otherwise bring back whatever was previously saved (if anything),
  42943. // falling back to the empty string if nothing was stored.
  42944. if (this.setAttribute) {
  42945. this.setAttribute("class", className || value === false ? "" : dataPriv.get(this, "__className__") || "");
  42946. }
  42947. }
  42948. });
  42949. },
  42950. hasClass: function hasClass(selector) {
  42951. var className,
  42952. elem,
  42953. i = 0;
  42954. className = " " + selector + " ";
  42955. while (elem = this[i++]) {
  42956. if (elem.nodeType === 1 && (" " + stripAndCollapse(getClass(elem)) + " ").indexOf(className) > -1) {
  42957. return true;
  42958. }
  42959. }
  42960. return false;
  42961. }
  42962. });
  42963. var rreturn = /\r/g;
  42964. jQuery.fn.extend({
  42965. val: function val(value) {
  42966. var hooks,
  42967. ret,
  42968. valueIsFunction,
  42969. elem = this[0];
  42970. if (!arguments.length) {
  42971. if (elem) {
  42972. hooks = jQuery.valHooks[elem.type] || jQuery.valHooks[elem.nodeName.toLowerCase()];
  42973. if (hooks && "get" in hooks && (ret = hooks.get(elem, "value")) !== undefined) {
  42974. return ret;
  42975. }
  42976. ret = elem.value;
  42977. // Handle most common string cases
  42978. if (typeof ret === "string") {
  42979. return ret.replace(rreturn, "");
  42980. }
  42981. // Handle cases where value is null/undef or number
  42982. return ret == null ? "" : ret;
  42983. }
  42984. return;
  42985. }
  42986. valueIsFunction = isFunction(value);
  42987. return this.each(function (i) {
  42988. var val;
  42989. if (this.nodeType !== 1) {
  42990. return;
  42991. }
  42992. if (valueIsFunction) {
  42993. val = value.call(this, i, jQuery(this).val());
  42994. } else {
  42995. val = value;
  42996. }
  42997. // Treat null/undefined as ""; convert numbers to string
  42998. if (val == null) {
  42999. val = "";
  43000. } else if (typeof val === "number") {
  43001. val += "";
  43002. } else if (Array.isArray(val)) {
  43003. val = jQuery.map(val, function (value) {
  43004. return value == null ? "" : value + "";
  43005. });
  43006. }
  43007. hooks = jQuery.valHooks[this.type] || jQuery.valHooks[this.nodeName.toLowerCase()];
  43008. // If set returns undefined, fall back to normal setting
  43009. if (!hooks || !("set" in hooks) || hooks.set(this, val, "value") === undefined) {
  43010. this.value = val;
  43011. }
  43012. });
  43013. }
  43014. });
  43015. jQuery.extend({
  43016. valHooks: {
  43017. option: {
  43018. get: function get(elem) {
  43019. var val = jQuery.find.attr(elem, "value");
  43020. return val != null ? val :
  43021. // Support: IE <=10 - 11 only
  43022. // option.text throws exceptions (#14686, #14858)
  43023. // Strip and collapse whitespace
  43024. // https://html.spec.whatwg.org/#strip-and-collapse-whitespace
  43025. stripAndCollapse(jQuery.text(elem));
  43026. }
  43027. },
  43028. select: {
  43029. get: function get(elem) {
  43030. var value,
  43031. option,
  43032. i,
  43033. options = elem.options,
  43034. index = elem.selectedIndex,
  43035. one = elem.type === "select-one",
  43036. values = one ? null : [],
  43037. max = one ? index + 1 : options.length;
  43038. if (index < 0) {
  43039. i = max;
  43040. } else {
  43041. i = one ? index : 0;
  43042. }
  43043. // Loop through all the selected options
  43044. for (; i < max; i++) {
  43045. option = options[i];
  43046. // Support: IE <=9 only
  43047. // IE8-9 doesn't update selected after form reset (#2551)
  43048. if ((option.selected || i === index) &&
  43049. // Don't return options that are disabled or in a disabled optgroup
  43050. !option.disabled && (!option.parentNode.disabled || !nodeName(option.parentNode, "optgroup"))) {
  43051. // Get the specific value for the option
  43052. value = jQuery(option).val();
  43053. // We don't need an array for one selects
  43054. if (one) {
  43055. return value;
  43056. }
  43057. // Multi-Selects return an array
  43058. values.push(value);
  43059. }
  43060. }
  43061. return values;
  43062. },
  43063. set: function set(elem, value) {
  43064. var optionSet,
  43065. option,
  43066. options = elem.options,
  43067. values = jQuery.makeArray(value),
  43068. i = options.length;
  43069. while (i--) {
  43070. option = options[i];
  43071. /* eslint-disable no-cond-assign */
  43072. if (option.selected = jQuery.inArray(jQuery.valHooks.option.get(option), values) > -1) {
  43073. optionSet = true;
  43074. }
  43075. /* eslint-enable no-cond-assign */
  43076. }
  43077. // Force browsers to behave consistently when non-matching value is set
  43078. if (!optionSet) {
  43079. elem.selectedIndex = -1;
  43080. }
  43081. return values;
  43082. }
  43083. }
  43084. }
  43085. });
  43086. // Radios and checkboxes getter/setter
  43087. jQuery.each(["radio", "checkbox"], function () {
  43088. jQuery.valHooks[this] = {
  43089. set: function set(elem, value) {
  43090. if (Array.isArray(value)) {
  43091. return elem.checked = jQuery.inArray(jQuery(elem).val(), value) > -1;
  43092. }
  43093. }
  43094. };
  43095. if (!support.checkOn) {
  43096. jQuery.valHooks[this].get = function (elem) {
  43097. return elem.getAttribute("value") === null ? "on" : elem.value;
  43098. };
  43099. }
  43100. });
  43101. // Return jQuery for attributes-only inclusion
  43102. support.focusin = "onfocusin" in window;
  43103. var rfocusMorph = /^(?:focusinfocus|focusoutblur)$/,
  43104. stopPropagationCallback = function stopPropagationCallback(e) {
  43105. e.stopPropagation();
  43106. };
  43107. jQuery.extend(jQuery.event, {
  43108. trigger: function trigger(event, data, elem, onlyHandlers) {
  43109. var i,
  43110. cur,
  43111. tmp,
  43112. bubbleType,
  43113. ontype,
  43114. handle,
  43115. special,
  43116. lastElement,
  43117. eventPath = [elem || document],
  43118. type = hasOwn.call(event, "type") ? event.type : event,
  43119. namespaces = hasOwn.call(event, "namespace") ? event.namespace.split(".") : [];
  43120. cur = lastElement = tmp = elem = elem || document;
  43121. // Don't do events on text and comment nodes
  43122. if (elem.nodeType === 3 || elem.nodeType === 8) {
  43123. return;
  43124. }
  43125. // focus/blur morphs to focusin/out; ensure we're not firing them right now
  43126. if (rfocusMorph.test(type + jQuery.event.triggered)) {
  43127. return;
  43128. }
  43129. if (type.indexOf(".") > -1) {
  43130. // Namespaced trigger; create a regexp to match event type in handle()
  43131. namespaces = type.split(".");
  43132. type = namespaces.shift();
  43133. namespaces.sort();
  43134. }
  43135. ontype = type.indexOf(":") < 0 && "on" + type;
  43136. // Caller can pass in a jQuery.Event object, Object, or just an event type string
  43137. event = event[jQuery.expando] ? event : new jQuery.Event(type, (typeof event === "undefined" ? "undefined" : _typeof(event)) === "object" && event);
  43138. // Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true)
  43139. event.isTrigger = onlyHandlers ? 2 : 3;
  43140. event.namespace = namespaces.join(".");
  43141. event.rnamespace = event.namespace ? new RegExp("(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)") : null;
  43142. // Clean up the event in case it is being reused
  43143. event.result = undefined;
  43144. if (!event.target) {
  43145. event.target = elem;
  43146. }
  43147. // Clone any incoming data and prepend the event, creating the handler arg list
  43148. data = data == null ? [event] : jQuery.makeArray(data, [event]);
  43149. // Allow special events to draw outside the lines
  43150. special = jQuery.event.special[type] || {};
  43151. if (!onlyHandlers && special.trigger && special.trigger.apply(elem, data) === false) {
  43152. return;
  43153. }
  43154. // Determine event propagation path in advance, per W3C events spec (#9951)
  43155. // Bubble up to document, then to window; watch for a global ownerDocument var (#9724)
  43156. if (!onlyHandlers && !special.noBubble && !isWindow(elem)) {
  43157. bubbleType = special.delegateType || type;
  43158. if (!rfocusMorph.test(bubbleType + type)) {
  43159. cur = cur.parentNode;
  43160. }
  43161. for (; cur; cur = cur.parentNode) {
  43162. eventPath.push(cur);
  43163. tmp = cur;
  43164. }
  43165. // Only add window if we got to document (e.g., not plain obj or detached DOM)
  43166. if (tmp === (elem.ownerDocument || document)) {
  43167. eventPath.push(tmp.defaultView || tmp.parentWindow || window);
  43168. }
  43169. }
  43170. // Fire handlers on the event path
  43171. i = 0;
  43172. while ((cur = eventPath[i++]) && !event.isPropagationStopped()) {
  43173. lastElement = cur;
  43174. event.type = i > 1 ? bubbleType : special.bindType || type;
  43175. // jQuery handler
  43176. handle = (dataPriv.get(cur, "events") || {})[event.type] && dataPriv.get(cur, "handle");
  43177. if (handle) {
  43178. handle.apply(cur, data);
  43179. }
  43180. // Native handler
  43181. handle = ontype && cur[ontype];
  43182. if (handle && handle.apply && acceptData(cur)) {
  43183. event.result = handle.apply(cur, data);
  43184. if (event.result === false) {
  43185. event.preventDefault();
  43186. }
  43187. }
  43188. }
  43189. event.type = type;
  43190. // If nobody prevented the default action, do it now
  43191. if (!onlyHandlers && !event.isDefaultPrevented()) {
  43192. if ((!special._default || special._default.apply(eventPath.pop(), data) === false) && acceptData(elem)) {
  43193. // Call a native DOM method on the target with the same name as the event.
  43194. // Don't do default actions on window, that's where global variables be (#6170)
  43195. if (ontype && isFunction(elem[type]) && !isWindow(elem)) {
  43196. // Don't re-trigger an onFOO event when we call its FOO() method
  43197. tmp = elem[ontype];
  43198. if (tmp) {
  43199. elem[ontype] = null;
  43200. }
  43201. // Prevent re-triggering of the same event, since we already bubbled it above
  43202. jQuery.event.triggered = type;
  43203. if (event.isPropagationStopped()) {
  43204. lastElement.addEventListener(type, stopPropagationCallback);
  43205. }
  43206. elem[type]();
  43207. if (event.isPropagationStopped()) {
  43208. lastElement.removeEventListener(type, stopPropagationCallback);
  43209. }
  43210. jQuery.event.triggered = undefined;
  43211. if (tmp) {
  43212. elem[ontype] = tmp;
  43213. }
  43214. }
  43215. }
  43216. }
  43217. return event.result;
  43218. },
  43219. // Piggyback on a donor event to simulate a different one
  43220. // Used only for `focus(in | out)` events
  43221. simulate: function simulate(type, elem, event) {
  43222. var e = jQuery.extend(new jQuery.Event(), event, {
  43223. type: type,
  43224. isSimulated: true
  43225. });
  43226. jQuery.event.trigger(e, null, elem);
  43227. }
  43228. });
  43229. jQuery.fn.extend({
  43230. trigger: function trigger(type, data) {
  43231. return this.each(function () {
  43232. jQuery.event.trigger(type, data, this);
  43233. });
  43234. },
  43235. triggerHandler: function triggerHandler(type, data) {
  43236. var elem = this[0];
  43237. if (elem) {
  43238. return jQuery.event.trigger(type, data, elem, true);
  43239. }
  43240. }
  43241. });
  43242. // Support: Firefox <=44
  43243. // Firefox doesn't have focus(in | out) events
  43244. // Related ticket - https://bugzilla.mozilla.org/show_bug.cgi?id=687787
  43245. //
  43246. // Support: Chrome <=48 - 49, Safari <=9.0 - 9.1
  43247. // focus(in | out) events fire after focus & blur events,
  43248. // which is spec violation - http://www.w3.org/TR/DOM-Level-3-Events/#events-focusevent-event-order
  43249. // Related ticket - https://bugs.chromium.org/p/chromium/issues/detail?id=449857
  43250. if (!support.focusin) {
  43251. jQuery.each({ focus: "focusin", blur: "focusout" }, function (orig, fix) {
  43252. // Attach a single capturing handler on the document while someone wants focusin/focusout
  43253. var handler = function handler(event) {
  43254. jQuery.event.simulate(fix, event.target, jQuery.event.fix(event));
  43255. };
  43256. jQuery.event.special[fix] = {
  43257. setup: function setup() {
  43258. var doc = this.ownerDocument || this,
  43259. attaches = dataPriv.access(doc, fix);
  43260. if (!attaches) {
  43261. doc.addEventListener(orig, handler, true);
  43262. }
  43263. dataPriv.access(doc, fix, (attaches || 0) + 1);
  43264. },
  43265. teardown: function teardown() {
  43266. var doc = this.ownerDocument || this,
  43267. attaches = dataPriv.access(doc, fix) - 1;
  43268. if (!attaches) {
  43269. doc.removeEventListener(orig, handler, true);
  43270. dataPriv.remove(doc, fix);
  43271. } else {
  43272. dataPriv.access(doc, fix, attaches);
  43273. }
  43274. }
  43275. };
  43276. });
  43277. }
  43278. var location = window.location;
  43279. var nonce = Date.now();
  43280. var rquery = /\?/;
  43281. // Cross-browser xml parsing
  43282. jQuery.parseXML = function (data) {
  43283. var xml;
  43284. if (!data || typeof data !== "string") {
  43285. return null;
  43286. }
  43287. // Support: IE 9 - 11 only
  43288. // IE throws on parseFromString with invalid input.
  43289. try {
  43290. xml = new window.DOMParser().parseFromString(data, "text/xml");
  43291. } catch (e) {
  43292. xml = undefined;
  43293. }
  43294. if (!xml || xml.getElementsByTagName("parsererror").length) {
  43295. jQuery.error("Invalid XML: " + data);
  43296. }
  43297. return xml;
  43298. };
  43299. var rbracket = /\[\]$/,
  43300. rCRLF = /\r?\n/g,
  43301. rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i,
  43302. rsubmittable = /^(?:input|select|textarea|keygen)/i;
  43303. function buildParams(prefix, obj, traditional, add) {
  43304. var name;
  43305. if (Array.isArray(obj)) {
  43306. // Serialize array item.
  43307. jQuery.each(obj, function (i, v) {
  43308. if (traditional || rbracket.test(prefix)) {
  43309. // Treat each array item as a scalar.
  43310. add(prefix, v);
  43311. } else {
  43312. // Item is non-scalar (array or object), encode its numeric index.
  43313. buildParams(prefix + "[" + ((typeof v === "undefined" ? "undefined" : _typeof(v)) === "object" && v != null ? i : "") + "]", v, traditional, add);
  43314. }
  43315. });
  43316. } else if (!traditional && toType(obj) === "object") {
  43317. // Serialize object item.
  43318. for (name in obj) {
  43319. buildParams(prefix + "[" + name + "]", obj[name], traditional, add);
  43320. }
  43321. } else {
  43322. // Serialize scalar item.
  43323. add(prefix, obj);
  43324. }
  43325. }
  43326. // Serialize an array of form elements or a set of
  43327. // key/values into a query string
  43328. jQuery.param = function (a, traditional) {
  43329. var prefix,
  43330. s = [],
  43331. add = function add(key, valueOrFunction) {
  43332. // If value is a function, invoke it and use its return value
  43333. var value = isFunction(valueOrFunction) ? valueOrFunction() : valueOrFunction;
  43334. s[s.length] = encodeURIComponent(key) + "=" + encodeURIComponent(value == null ? "" : value);
  43335. };
  43336. // If an array was passed in, assume that it is an array of form elements.
  43337. if (Array.isArray(a) || a.jquery && !jQuery.isPlainObject(a)) {
  43338. // Serialize the form elements
  43339. jQuery.each(a, function () {
  43340. add(this.name, this.value);
  43341. });
  43342. } else {
  43343. // If traditional, encode the "old" way (the way 1.3.2 or older
  43344. // did it), otherwise encode params recursively.
  43345. for (prefix in a) {
  43346. buildParams(prefix, a[prefix], traditional, add);
  43347. }
  43348. }
  43349. // Return the resulting serialization
  43350. return s.join("&");
  43351. };
  43352. jQuery.fn.extend({
  43353. serialize: function serialize() {
  43354. return jQuery.param(this.serializeArray());
  43355. },
  43356. serializeArray: function serializeArray() {
  43357. return this.map(function () {
  43358. // Can add propHook for "elements" to filter or add form elements
  43359. var elements = jQuery.prop(this, "elements");
  43360. return elements ? jQuery.makeArray(elements) : this;
  43361. }).filter(function () {
  43362. var type = this.type;
  43363. // Use .is( ":disabled" ) so that fieldset[disabled] works
  43364. return this.name && !jQuery(this).is(":disabled") && rsubmittable.test(this.nodeName) && !rsubmitterTypes.test(type) && (this.checked || !rcheckableType.test(type));
  43365. }).map(function (i, elem) {
  43366. var val = jQuery(this).val();
  43367. if (val == null) {
  43368. return null;
  43369. }
  43370. if (Array.isArray(val)) {
  43371. return jQuery.map(val, function (val) {
  43372. return { name: elem.name, value: val.replace(rCRLF, "\r\n") };
  43373. });
  43374. }
  43375. return { name: elem.name, value: val.replace(rCRLF, "\r\n") };
  43376. }).get();
  43377. }
  43378. });
  43379. var r20 = /%20/g,
  43380. rhash = /#.*$/,
  43381. rantiCache = /([?&])_=[^&]*/,
  43382. rheaders = /^(.*?):[ \t]*([^\r\n]*)$/mg,
  43383. // #7653, #8125, #8152: local protocol detection
  43384. rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/,
  43385. rnoContent = /^(?:GET|HEAD)$/,
  43386. rprotocol = /^\/\//,
  43387. /* Prefilters
  43388. * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example)
  43389. * 2) These are called:
  43390. * - BEFORE asking for a transport
  43391. * - AFTER param serialization (s.data is a string if s.processData is true)
  43392. * 3) key is the dataType
  43393. * 4) the catchall symbol "*" can be used
  43394. * 5) execution will start with transport dataType and THEN continue down to "*" if needed
  43395. */
  43396. prefilters = {},
  43397. /* Transports bindings
  43398. * 1) key is the dataType
  43399. * 2) the catchall symbol "*" can be used
  43400. * 3) selection will start with transport dataType and THEN go to "*" if needed
  43401. */
  43402. transports = {},
  43403. // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression
  43404. allTypes = "*/".concat("*"),
  43405. // Anchor tag for parsing the document origin
  43406. originAnchor = document.createElement("a");
  43407. originAnchor.href = location.href;
  43408. // Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport
  43409. function addToPrefiltersOrTransports(structure) {
  43410. // dataTypeExpression is optional and defaults to "*"
  43411. return function (dataTypeExpression, func) {
  43412. if (typeof dataTypeExpression !== "string") {
  43413. func = dataTypeExpression;
  43414. dataTypeExpression = "*";
  43415. }
  43416. var dataType,
  43417. i = 0,
  43418. dataTypes = dataTypeExpression.toLowerCase().match(rnothtmlwhite) || [];
  43419. if (isFunction(func)) {
  43420. // For each dataType in the dataTypeExpression
  43421. while (dataType = dataTypes[i++]) {
  43422. // Prepend if requested
  43423. if (dataType[0] === "+") {
  43424. dataType = dataType.slice(1) || "*";
  43425. (structure[dataType] = structure[dataType] || []).unshift(func);
  43426. // Otherwise append
  43427. } else {
  43428. (structure[dataType] = structure[dataType] || []).push(func);
  43429. }
  43430. }
  43431. }
  43432. };
  43433. }
  43434. // Base inspection function for prefilters and transports
  43435. function inspectPrefiltersOrTransports(structure, options, originalOptions, jqXHR) {
  43436. var inspected = {},
  43437. seekingTransport = structure === transports;
  43438. function inspect(dataType) {
  43439. var selected;
  43440. inspected[dataType] = true;
  43441. jQuery.each(structure[dataType] || [], function (_, prefilterOrFactory) {
  43442. var dataTypeOrTransport = prefilterOrFactory(options, originalOptions, jqXHR);
  43443. if (typeof dataTypeOrTransport === "string" && !seekingTransport && !inspected[dataTypeOrTransport]) {
  43444. options.dataTypes.unshift(dataTypeOrTransport);
  43445. inspect(dataTypeOrTransport);
  43446. return false;
  43447. } else if (seekingTransport) {
  43448. return !(selected = dataTypeOrTransport);
  43449. }
  43450. });
  43451. return selected;
  43452. }
  43453. return inspect(options.dataTypes[0]) || !inspected["*"] && inspect("*");
  43454. }
  43455. // A special extend for ajax options
  43456. // that takes "flat" options (not to be deep extended)
  43457. // Fixes #9887
  43458. function ajaxExtend(target, src) {
  43459. var key,
  43460. deep,
  43461. flatOptions = jQuery.ajaxSettings.flatOptions || {};
  43462. for (key in src) {
  43463. if (src[key] !== undefined) {
  43464. (flatOptions[key] ? target : deep || (deep = {}))[key] = src[key];
  43465. }
  43466. }
  43467. if (deep) {
  43468. jQuery.extend(true, target, deep);
  43469. }
  43470. return target;
  43471. }
  43472. /* Handles responses to an ajax request:
  43473. * - finds the right dataType (mediates between content-type and expected dataType)
  43474. * - returns the corresponding response
  43475. */
  43476. function ajaxHandleResponses(s, jqXHR, responses) {
  43477. var ct,
  43478. type,
  43479. finalDataType,
  43480. firstDataType,
  43481. contents = s.contents,
  43482. dataTypes = s.dataTypes;
  43483. // Remove auto dataType and get content-type in the process
  43484. while (dataTypes[0] === "*") {
  43485. dataTypes.shift();
  43486. if (ct === undefined) {
  43487. ct = s.mimeType || jqXHR.getResponseHeader("Content-Type");
  43488. }
  43489. }
  43490. // Check if we're dealing with a known content-type
  43491. if (ct) {
  43492. for (type in contents) {
  43493. if (contents[type] && contents[type].test(ct)) {
  43494. dataTypes.unshift(type);
  43495. break;
  43496. }
  43497. }
  43498. }
  43499. // Check to see if we have a response for the expected dataType
  43500. if (dataTypes[0] in responses) {
  43501. finalDataType = dataTypes[0];
  43502. } else {
  43503. // Try convertible dataTypes
  43504. for (type in responses) {
  43505. if (!dataTypes[0] || s.converters[type + " " + dataTypes[0]]) {
  43506. finalDataType = type;
  43507. break;
  43508. }
  43509. if (!firstDataType) {
  43510. firstDataType = type;
  43511. }
  43512. }
  43513. // Or just use first one
  43514. finalDataType = finalDataType || firstDataType;
  43515. }
  43516. // If we found a dataType
  43517. // We add the dataType to the list if needed
  43518. // and return the corresponding response
  43519. if (finalDataType) {
  43520. if (finalDataType !== dataTypes[0]) {
  43521. dataTypes.unshift(finalDataType);
  43522. }
  43523. return responses[finalDataType];
  43524. }
  43525. }
  43526. /* Chain conversions given the request and the original response
  43527. * Also sets the responseXXX fields on the jqXHR instance
  43528. */
  43529. function ajaxConvert(s, response, jqXHR, isSuccess) {
  43530. var conv2,
  43531. current,
  43532. conv,
  43533. tmp,
  43534. prev,
  43535. converters = {},
  43536. // Work with a copy of dataTypes in case we need to modify it for conversion
  43537. dataTypes = s.dataTypes.slice();
  43538. // Create converters map with lowercased keys
  43539. if (dataTypes[1]) {
  43540. for (conv in s.converters) {
  43541. converters[conv.toLowerCase()] = s.converters[conv];
  43542. }
  43543. }
  43544. current = dataTypes.shift();
  43545. // Convert to each sequential dataType
  43546. while (current) {
  43547. if (s.responseFields[current]) {
  43548. jqXHR[s.responseFields[current]] = response;
  43549. }
  43550. // Apply the dataFilter if provided
  43551. if (!prev && isSuccess && s.dataFilter) {
  43552. response = s.dataFilter(response, s.dataType);
  43553. }
  43554. prev = current;
  43555. current = dataTypes.shift();
  43556. if (current) {
  43557. // There's only work to do if current dataType is non-auto
  43558. if (current === "*") {
  43559. current = prev;
  43560. // Convert response if prev dataType is non-auto and differs from current
  43561. } else if (prev !== "*" && prev !== current) {
  43562. // Seek a direct converter
  43563. conv = converters[prev + " " + current] || converters["* " + current];
  43564. // If none found, seek a pair
  43565. if (!conv) {
  43566. for (conv2 in converters) {
  43567. // If conv2 outputs current
  43568. tmp = conv2.split(" ");
  43569. if (tmp[1] === current) {
  43570. // If prev can be converted to accepted input
  43571. conv = converters[prev + " " + tmp[0]] || converters["* " + tmp[0]];
  43572. if (conv) {
  43573. // Condense equivalence converters
  43574. if (conv === true) {
  43575. conv = converters[conv2];
  43576. // Otherwise, insert the intermediate dataType
  43577. } else if (converters[conv2] !== true) {
  43578. current = tmp[0];
  43579. dataTypes.unshift(tmp[1]);
  43580. }
  43581. break;
  43582. }
  43583. }
  43584. }
  43585. }
  43586. // Apply converter (if not an equivalence)
  43587. if (conv !== true) {
  43588. // Unless errors are allowed to bubble, catch and return them
  43589. if (conv && s.throws) {
  43590. response = conv(response);
  43591. } else {
  43592. try {
  43593. response = conv(response);
  43594. } catch (e) {
  43595. return {
  43596. state: "parsererror",
  43597. error: conv ? e : "No conversion from " + prev + " to " + current
  43598. };
  43599. }
  43600. }
  43601. }
  43602. }
  43603. }
  43604. }
  43605. return { state: "success", data: response };
  43606. }
  43607. jQuery.extend({
  43608. // Counter for holding the number of active queries
  43609. active: 0,
  43610. // Last-Modified header cache for next request
  43611. lastModified: {},
  43612. etag: {},
  43613. ajaxSettings: {
  43614. url: location.href,
  43615. type: "GET",
  43616. isLocal: rlocalProtocol.test(location.protocol),
  43617. global: true,
  43618. processData: true,
  43619. async: true,
  43620. contentType: "application/x-www-form-urlencoded; charset=UTF-8",
  43621. /*
  43622. timeout: 0,
  43623. data: null,
  43624. dataType: null,
  43625. username: null,
  43626. password: null,
  43627. cache: null,
  43628. throws: false,
  43629. traditional: false,
  43630. headers: {},
  43631. */
  43632. accepts: {
  43633. "*": allTypes,
  43634. text: "text/plain",
  43635. html: "text/html",
  43636. xml: "application/xml, text/xml",
  43637. json: "application/json, text/javascript"
  43638. },
  43639. contents: {
  43640. xml: /\bxml\b/,
  43641. html: /\bhtml/,
  43642. json: /\bjson\b/
  43643. },
  43644. responseFields: {
  43645. xml: "responseXML",
  43646. text: "responseText",
  43647. json: "responseJSON"
  43648. },
  43649. // Data converters
  43650. // Keys separate source (or catchall "*") and destination types with a single space
  43651. converters: {
  43652. // Convert anything to text
  43653. "* text": String,
  43654. // Text to html (true = no transformation)
  43655. "text html": true,
  43656. // Evaluate text as a json expression
  43657. "text json": JSON.parse,
  43658. // Parse text as xml
  43659. "text xml": jQuery.parseXML
  43660. },
  43661. // For options that shouldn't be deep extended:
  43662. // you can add your own custom options here if
  43663. // and when you create one that shouldn't be
  43664. // deep extended (see ajaxExtend)
  43665. flatOptions: {
  43666. url: true,
  43667. context: true
  43668. }
  43669. },
  43670. // Creates a full fledged settings object into target
  43671. // with both ajaxSettings and settings fields.
  43672. // If target is omitted, writes into ajaxSettings.
  43673. ajaxSetup: function ajaxSetup(target, settings) {
  43674. return settings ?
  43675. // Building a settings object
  43676. ajaxExtend(ajaxExtend(target, jQuery.ajaxSettings), settings) :
  43677. // Extending ajaxSettings
  43678. ajaxExtend(jQuery.ajaxSettings, target);
  43679. },
  43680. ajaxPrefilter: addToPrefiltersOrTransports(prefilters),
  43681. ajaxTransport: addToPrefiltersOrTransports(transports),
  43682. // Main method
  43683. ajax: function ajax(url, options) {
  43684. // If url is an object, simulate pre-1.5 signature
  43685. if ((typeof url === "undefined" ? "undefined" : _typeof(url)) === "object") {
  43686. options = url;
  43687. url = undefined;
  43688. }
  43689. // Force options to be an object
  43690. options = options || {};
  43691. var transport,
  43692. // URL without anti-cache param
  43693. cacheURL,
  43694. // Response headers
  43695. responseHeadersString,
  43696. responseHeaders,
  43697. // timeout handle
  43698. timeoutTimer,
  43699. // Url cleanup var
  43700. urlAnchor,
  43701. // Request state (becomes false upon send and true upon completion)
  43702. completed,
  43703. // To know if global events are to be dispatched
  43704. fireGlobals,
  43705. // Loop variable
  43706. i,
  43707. // uncached part of the url
  43708. uncached,
  43709. // Create the final options object
  43710. s = jQuery.ajaxSetup({}, options),
  43711. // Callbacks context
  43712. callbackContext = s.context || s,
  43713. // Context for global events is callbackContext if it is a DOM node or jQuery collection
  43714. globalEventContext = s.context && (callbackContext.nodeType || callbackContext.jquery) ? jQuery(callbackContext) : jQuery.event,
  43715. // Deferreds
  43716. deferred = jQuery.Deferred(),
  43717. completeDeferred = jQuery.Callbacks("once memory"),
  43718. // Status-dependent callbacks
  43719. _statusCode = s.statusCode || {},
  43720. // Headers (they are sent all at once)
  43721. requestHeaders = {},
  43722. requestHeadersNames = {},
  43723. // Default abort message
  43724. strAbort = "canceled",
  43725. // Fake xhr
  43726. jqXHR = {
  43727. readyState: 0,
  43728. // Builds headers hashtable if needed
  43729. getResponseHeader: function getResponseHeader(key) {
  43730. var match;
  43731. if (completed) {
  43732. if (!responseHeaders) {
  43733. responseHeaders = {};
  43734. while (match = rheaders.exec(responseHeadersString)) {
  43735. responseHeaders[match[1].toLowerCase()] = match[2];
  43736. }
  43737. }
  43738. match = responseHeaders[key.toLowerCase()];
  43739. }
  43740. return match == null ? null : match;
  43741. },
  43742. // Raw string
  43743. getAllResponseHeaders: function getAllResponseHeaders() {
  43744. return completed ? responseHeadersString : null;
  43745. },
  43746. // Caches the header
  43747. setRequestHeader: function setRequestHeader(name, value) {
  43748. if (completed == null) {
  43749. name = requestHeadersNames[name.toLowerCase()] = requestHeadersNames[name.toLowerCase()] || name;
  43750. requestHeaders[name] = value;
  43751. }
  43752. return this;
  43753. },
  43754. // Overrides response content-type header
  43755. overrideMimeType: function overrideMimeType(type) {
  43756. if (completed == null) {
  43757. s.mimeType = type;
  43758. }
  43759. return this;
  43760. },
  43761. // Status-dependent callbacks
  43762. statusCode: function statusCode(map) {
  43763. var code;
  43764. if (map) {
  43765. if (completed) {
  43766. // Execute the appropriate callbacks
  43767. jqXHR.always(map[jqXHR.status]);
  43768. } else {
  43769. // Lazy-add the new callbacks in a way that preserves old ones
  43770. for (code in map) {
  43771. _statusCode[code] = [_statusCode[code], map[code]];
  43772. }
  43773. }
  43774. }
  43775. return this;
  43776. },
  43777. // Cancel the request
  43778. abort: function abort(statusText) {
  43779. var finalText = statusText || strAbort;
  43780. if (transport) {
  43781. transport.abort(finalText);
  43782. }
  43783. done(0, finalText);
  43784. return this;
  43785. }
  43786. };
  43787. // Attach deferreds
  43788. deferred.promise(jqXHR);
  43789. // Add protocol if not provided (prefilters might expect it)
  43790. // Handle falsy url in the settings object (#10093: consistency with old signature)
  43791. // We also use the url parameter if available
  43792. s.url = ((url || s.url || location.href) + "").replace(rprotocol, location.protocol + "//");
  43793. // Alias method option to type as per ticket #12004
  43794. s.type = options.method || options.type || s.method || s.type;
  43795. // Extract dataTypes list
  43796. s.dataTypes = (s.dataType || "*").toLowerCase().match(rnothtmlwhite) || [""];
  43797. // A cross-domain request is in order when the origin doesn't match the current origin.
  43798. if (s.crossDomain == null) {
  43799. urlAnchor = document.createElement("a");
  43800. // Support: IE <=8 - 11, Edge 12 - 15
  43801. // IE throws exception on accessing the href property if url is malformed,
  43802. // e.g. http://example.com:80x/
  43803. try {
  43804. urlAnchor.href = s.url;
  43805. // Support: IE <=8 - 11 only
  43806. // Anchor's host property isn't correctly set when s.url is relative
  43807. urlAnchor.href = urlAnchor.href;
  43808. s.crossDomain = originAnchor.protocol + "//" + originAnchor.host !== urlAnchor.protocol + "//" + urlAnchor.host;
  43809. } catch (e) {
  43810. // If there is an error parsing the URL, assume it is crossDomain,
  43811. // it can be rejected by the transport if it is invalid
  43812. s.crossDomain = true;
  43813. }
  43814. }
  43815. // Convert data if not already a string
  43816. if (s.data && s.processData && typeof s.data !== "string") {
  43817. s.data = jQuery.param(s.data, s.traditional);
  43818. }
  43819. // Apply prefilters
  43820. inspectPrefiltersOrTransports(prefilters, s, options, jqXHR);
  43821. // If request was aborted inside a prefilter, stop there
  43822. if (completed) {
  43823. return jqXHR;
  43824. }
  43825. // We can fire global events as of now if asked to
  43826. // Don't fire events if jQuery.event is undefined in an AMD-usage scenario (#15118)
  43827. fireGlobals = jQuery.event && s.global;
  43828. // Watch for a new set of requests
  43829. if (fireGlobals && jQuery.active++ === 0) {
  43830. jQuery.event.trigger("ajaxStart");
  43831. }
  43832. // Uppercase the type
  43833. s.type = s.type.toUpperCase();
  43834. // Determine if request has content
  43835. s.hasContent = !rnoContent.test(s.type);
  43836. // Save the URL in case we're toying with the If-Modified-Since
  43837. // and/or If-None-Match header later on
  43838. // Remove hash to simplify url manipulation
  43839. cacheURL = s.url.replace(rhash, "");
  43840. // More options handling for requests with no content
  43841. if (!s.hasContent) {
  43842. // Remember the hash so we can put it back
  43843. uncached = s.url.slice(cacheURL.length);
  43844. // If data is available and should be processed, append data to url
  43845. if (s.data && (s.processData || typeof s.data === "string")) {
  43846. cacheURL += (rquery.test(cacheURL) ? "&" : "?") + s.data;
  43847. // #9682: remove data so that it's not used in an eventual retry
  43848. delete s.data;
  43849. }
  43850. // Add or update anti-cache param if needed
  43851. if (s.cache === false) {
  43852. cacheURL = cacheURL.replace(rantiCache, "$1");
  43853. uncached = (rquery.test(cacheURL) ? "&" : "?") + "_=" + nonce++ + uncached;
  43854. }
  43855. // Put hash and anti-cache on the URL that will be requested (gh-1732)
  43856. s.url = cacheURL + uncached;
  43857. // Change '%20' to '+' if this is encoded form body content (gh-2658)
  43858. } else if (s.data && s.processData && (s.contentType || "").indexOf("application/x-www-form-urlencoded") === 0) {
  43859. s.data = s.data.replace(r20, "+");
  43860. }
  43861. // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
  43862. if (s.ifModified) {
  43863. if (jQuery.lastModified[cacheURL]) {
  43864. jqXHR.setRequestHeader("If-Modified-Since", jQuery.lastModified[cacheURL]);
  43865. }
  43866. if (jQuery.etag[cacheURL]) {
  43867. jqXHR.setRequestHeader("If-None-Match", jQuery.etag[cacheURL]);
  43868. }
  43869. }
  43870. // Set the correct header, if data is being sent
  43871. if (s.data && s.hasContent && s.contentType !== false || options.contentType) {
  43872. jqXHR.setRequestHeader("Content-Type", s.contentType);
  43873. }
  43874. // Set the Accepts header for the server, depending on the dataType
  43875. jqXHR.setRequestHeader("Accept", s.dataTypes[0] && s.accepts[s.dataTypes[0]] ? s.accepts[s.dataTypes[0]] + (s.dataTypes[0] !== "*" ? ", " + allTypes + "; q=0.01" : "") : s.accepts["*"]);
  43876. // Check for headers option
  43877. for (i in s.headers) {
  43878. jqXHR.setRequestHeader(i, s.headers[i]);
  43879. }
  43880. // Allow custom headers/mimetypes and early abort
  43881. if (s.beforeSend && (s.beforeSend.call(callbackContext, jqXHR, s) === false || completed)) {
  43882. // Abort if not done already and return
  43883. return jqXHR.abort();
  43884. }
  43885. // Aborting is no longer a cancellation
  43886. strAbort = "abort";
  43887. // Install callbacks on deferreds
  43888. completeDeferred.add(s.complete);
  43889. jqXHR.done(s.success);
  43890. jqXHR.fail(s.error);
  43891. // Get transport
  43892. transport = inspectPrefiltersOrTransports(transports, s, options, jqXHR);
  43893. // If no transport, we auto-abort
  43894. if (!transport) {
  43895. done(-1, "No Transport");
  43896. } else {
  43897. jqXHR.readyState = 1;
  43898. // Send global event
  43899. if (fireGlobals) {
  43900. globalEventContext.trigger("ajaxSend", [jqXHR, s]);
  43901. }
  43902. // If request was aborted inside ajaxSend, stop there
  43903. if (completed) {
  43904. return jqXHR;
  43905. }
  43906. // Timeout
  43907. if (s.async && s.timeout > 0) {
  43908. timeoutTimer = window.setTimeout(function () {
  43909. jqXHR.abort("timeout");
  43910. }, s.timeout);
  43911. }
  43912. try {
  43913. completed = false;
  43914. transport.send(requestHeaders, done);
  43915. } catch (e) {
  43916. // Rethrow post-completion exceptions
  43917. if (completed) {
  43918. throw e;
  43919. }
  43920. // Propagate others as results
  43921. done(-1, e);
  43922. }
  43923. }
  43924. // Callback for when everything is done
  43925. function done(status, nativeStatusText, responses, headers) {
  43926. var isSuccess,
  43927. success,
  43928. error,
  43929. response,
  43930. modified,
  43931. statusText = nativeStatusText;
  43932. // Ignore repeat invocations
  43933. if (completed) {
  43934. return;
  43935. }
  43936. completed = true;
  43937. // Clear timeout if it exists
  43938. if (timeoutTimer) {
  43939. window.clearTimeout(timeoutTimer);
  43940. }
  43941. // Dereference transport for early garbage collection
  43942. // (no matter how long the jqXHR object will be used)
  43943. transport = undefined;
  43944. // Cache response headers
  43945. responseHeadersString = headers || "";
  43946. // Set readyState
  43947. jqXHR.readyState = status > 0 ? 4 : 0;
  43948. // Determine if successful
  43949. isSuccess = status >= 200 && status < 300 || status === 304;
  43950. // Get response data
  43951. if (responses) {
  43952. response = ajaxHandleResponses(s, jqXHR, responses);
  43953. }
  43954. // Convert no matter what (that way responseXXX fields are always set)
  43955. response = ajaxConvert(s, response, jqXHR, isSuccess);
  43956. // If successful, handle type chaining
  43957. if (isSuccess) {
  43958. // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
  43959. if (s.ifModified) {
  43960. modified = jqXHR.getResponseHeader("Last-Modified");
  43961. if (modified) {
  43962. jQuery.lastModified[cacheURL] = modified;
  43963. }
  43964. modified = jqXHR.getResponseHeader("etag");
  43965. if (modified) {
  43966. jQuery.etag[cacheURL] = modified;
  43967. }
  43968. }
  43969. // if no content
  43970. if (status === 204 || s.type === "HEAD") {
  43971. statusText = "nocontent";
  43972. // if not modified
  43973. } else if (status === 304) {
  43974. statusText = "notmodified";
  43975. // If we have data, let's convert it
  43976. } else {
  43977. statusText = response.state;
  43978. success = response.data;
  43979. error = response.error;
  43980. isSuccess = !error;
  43981. }
  43982. } else {
  43983. // Extract error from statusText and normalize for non-aborts
  43984. error = statusText;
  43985. if (status || !statusText) {
  43986. statusText = "error";
  43987. if (status < 0) {
  43988. status = 0;
  43989. }
  43990. }
  43991. }
  43992. // Set data for the fake xhr object
  43993. jqXHR.status = status;
  43994. jqXHR.statusText = (nativeStatusText || statusText) + "";
  43995. // Success/Error
  43996. if (isSuccess) {
  43997. deferred.resolveWith(callbackContext, [success, statusText, jqXHR]);
  43998. } else {
  43999. deferred.rejectWith(callbackContext, [jqXHR, statusText, error]);
  44000. }
  44001. // Status-dependent callbacks
  44002. jqXHR.statusCode(_statusCode);
  44003. _statusCode = undefined;
  44004. if (fireGlobals) {
  44005. globalEventContext.trigger(isSuccess ? "ajaxSuccess" : "ajaxError", [jqXHR, s, isSuccess ? success : error]);
  44006. }
  44007. // Complete
  44008. completeDeferred.fireWith(callbackContext, [jqXHR, statusText]);
  44009. if (fireGlobals) {
  44010. globalEventContext.trigger("ajaxComplete", [jqXHR, s]);
  44011. // Handle the global AJAX counter
  44012. if (! --jQuery.active) {
  44013. jQuery.event.trigger("ajaxStop");
  44014. }
  44015. }
  44016. }
  44017. return jqXHR;
  44018. },
  44019. getJSON: function getJSON(url, data, callback) {
  44020. return jQuery.get(url, data, callback, "json");
  44021. },
  44022. getScript: function getScript(url, callback) {
  44023. return jQuery.get(url, undefined, callback, "script");
  44024. }
  44025. });
  44026. jQuery.each(["get", "post"], function (i, method) {
  44027. jQuery[method] = function (url, data, callback, type) {
  44028. // Shift arguments if data argument was omitted
  44029. if (isFunction(data)) {
  44030. type = type || callback;
  44031. callback = data;
  44032. data = undefined;
  44033. }
  44034. // The url can be an options object (which then must have .url)
  44035. return jQuery.ajax(jQuery.extend({
  44036. url: url,
  44037. type: method,
  44038. dataType: type,
  44039. data: data,
  44040. success: callback
  44041. }, jQuery.isPlainObject(url) && url));
  44042. };
  44043. });
  44044. jQuery._evalUrl = function (url) {
  44045. return jQuery.ajax({
  44046. url: url,
  44047. // Make this explicit, since user can override this through ajaxSetup (#11264)
  44048. type: "GET",
  44049. dataType: "script",
  44050. cache: true,
  44051. async: false,
  44052. global: false,
  44053. "throws": true
  44054. });
  44055. };
  44056. jQuery.fn.extend({
  44057. wrapAll: function wrapAll(html) {
  44058. var wrap;
  44059. if (this[0]) {
  44060. if (isFunction(html)) {
  44061. html = html.call(this[0]);
  44062. }
  44063. // The elements to wrap the target around
  44064. wrap = jQuery(html, this[0].ownerDocument).eq(0).clone(true);
  44065. if (this[0].parentNode) {
  44066. wrap.insertBefore(this[0]);
  44067. }
  44068. wrap.map(function () {
  44069. var elem = this;
  44070. while (elem.firstElementChild) {
  44071. elem = elem.firstElementChild;
  44072. }
  44073. return elem;
  44074. }).append(this);
  44075. }
  44076. return this;
  44077. },
  44078. wrapInner: function wrapInner(html) {
  44079. if (isFunction(html)) {
  44080. return this.each(function (i) {
  44081. jQuery(this).wrapInner(html.call(this, i));
  44082. });
  44083. }
  44084. return this.each(function () {
  44085. var self = jQuery(this),
  44086. contents = self.contents();
  44087. if (contents.length) {
  44088. contents.wrapAll(html);
  44089. } else {
  44090. self.append(html);
  44091. }
  44092. });
  44093. },
  44094. wrap: function wrap(html) {
  44095. var htmlIsFunction = isFunction(html);
  44096. return this.each(function (i) {
  44097. jQuery(this).wrapAll(htmlIsFunction ? html.call(this, i) : html);
  44098. });
  44099. },
  44100. unwrap: function unwrap(selector) {
  44101. this.parent(selector).not("body").each(function () {
  44102. jQuery(this).replaceWith(this.childNodes);
  44103. });
  44104. return this;
  44105. }
  44106. });
  44107. jQuery.expr.pseudos.hidden = function (elem) {
  44108. return !jQuery.expr.pseudos.visible(elem);
  44109. };
  44110. jQuery.expr.pseudos.visible = function (elem) {
  44111. return !!(elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length);
  44112. };
  44113. jQuery.ajaxSettings.xhr = function () {
  44114. try {
  44115. return new window.XMLHttpRequest();
  44116. } catch (e) {}
  44117. };
  44118. var xhrSuccessStatus = {
  44119. // File protocol always yields status code 0, assume 200
  44120. 0: 200,
  44121. // Support: IE <=9 only
  44122. // #1450: sometimes IE returns 1223 when it should be 204
  44123. 1223: 204
  44124. },
  44125. xhrSupported = jQuery.ajaxSettings.xhr();
  44126. support.cors = !!xhrSupported && "withCredentials" in xhrSupported;
  44127. support.ajax = xhrSupported = !!xhrSupported;
  44128. jQuery.ajaxTransport(function (options) {
  44129. var _callback, errorCallback;
  44130. // Cross domain only allowed if supported through XMLHttpRequest
  44131. if (support.cors || xhrSupported && !options.crossDomain) {
  44132. return {
  44133. send: function send(headers, complete) {
  44134. var i,
  44135. xhr = options.xhr();
  44136. xhr.open(options.type, options.url, options.async, options.username, options.password);
  44137. // Apply custom fields if provided
  44138. if (options.xhrFields) {
  44139. for (i in options.xhrFields) {
  44140. xhr[i] = options.xhrFields[i];
  44141. }
  44142. }
  44143. // Override mime type if needed
  44144. if (options.mimeType && xhr.overrideMimeType) {
  44145. xhr.overrideMimeType(options.mimeType);
  44146. }
  44147. // X-Requested-With header
  44148. // For cross-domain requests, seeing as conditions for a preflight are
  44149. // akin to a jigsaw puzzle, we simply never set it to be sure.
  44150. // (it can always be set on a per-request basis or even using ajaxSetup)
  44151. // For same-domain requests, won't change header if already provided.
  44152. if (!options.crossDomain && !headers["X-Requested-With"]) {
  44153. headers["X-Requested-With"] = "XMLHttpRequest";
  44154. }
  44155. // Set headers
  44156. for (i in headers) {
  44157. xhr.setRequestHeader(i, headers[i]);
  44158. }
  44159. // Callback
  44160. _callback = function callback(type) {
  44161. return function () {
  44162. if (_callback) {
  44163. _callback = errorCallback = xhr.onload = xhr.onerror = xhr.onabort = xhr.ontimeout = xhr.onreadystatechange = null;
  44164. if (type === "abort") {
  44165. xhr.abort();
  44166. } else if (type === "error") {
  44167. // Support: IE <=9 only
  44168. // On a manual native abort, IE9 throws
  44169. // errors on any property access that is not readyState
  44170. if (typeof xhr.status !== "number") {
  44171. complete(0, "error");
  44172. } else {
  44173. complete(
  44174. // File: protocol always yields status 0; see #8605, #14207
  44175. xhr.status, xhr.statusText);
  44176. }
  44177. } else {
  44178. complete(xhrSuccessStatus[xhr.status] || xhr.status, xhr.statusText,
  44179. // Support: IE <=9 only
  44180. // IE9 has no XHR2 but throws on binary (trac-11426)
  44181. // For XHR2 non-text, let the caller handle it (gh-2498)
  44182. (xhr.responseType || "text") !== "text" || typeof xhr.responseText !== "string" ? { binary: xhr.response } : { text: xhr.responseText }, xhr.getAllResponseHeaders());
  44183. }
  44184. }
  44185. };
  44186. };
  44187. // Listen to events
  44188. xhr.onload = _callback();
  44189. errorCallback = xhr.onerror = xhr.ontimeout = _callback("error");
  44190. // Support: IE 9 only
  44191. // Use onreadystatechange to replace onabort
  44192. // to handle uncaught aborts
  44193. if (xhr.onabort !== undefined) {
  44194. xhr.onabort = errorCallback;
  44195. } else {
  44196. xhr.onreadystatechange = function () {
  44197. // Check readyState before timeout as it changes
  44198. if (xhr.readyState === 4) {
  44199. // Allow onerror to be called first,
  44200. // but that will not handle a native abort
  44201. // Also, save errorCallback to a variable
  44202. // as xhr.onerror cannot be accessed
  44203. window.setTimeout(function () {
  44204. if (_callback) {
  44205. errorCallback();
  44206. }
  44207. });
  44208. }
  44209. };
  44210. }
  44211. // Create the abort callback
  44212. _callback = _callback("abort");
  44213. try {
  44214. // Do send the request (this may raise an exception)
  44215. xhr.send(options.hasContent && options.data || null);
  44216. } catch (e) {
  44217. // #14683: Only rethrow if this hasn't been notified as an error yet
  44218. if (_callback) {
  44219. throw e;
  44220. }
  44221. }
  44222. },
  44223. abort: function abort() {
  44224. if (_callback) {
  44225. _callback();
  44226. }
  44227. }
  44228. };
  44229. }
  44230. });
  44231. // Prevent auto-execution of scripts when no explicit dataType was provided (See gh-2432)
  44232. jQuery.ajaxPrefilter(function (s) {
  44233. if (s.crossDomain) {
  44234. s.contents.script = false;
  44235. }
  44236. });
  44237. // Install script dataType
  44238. jQuery.ajaxSetup({
  44239. accepts: {
  44240. script: "text/javascript, application/javascript, " + "application/ecmascript, application/x-ecmascript"
  44241. },
  44242. contents: {
  44243. script: /\b(?:java|ecma)script\b/
  44244. },
  44245. converters: {
  44246. "text script": function textScript(text) {
  44247. jQuery.globalEval(text);
  44248. return text;
  44249. }
  44250. }
  44251. });
  44252. // Handle cache's special case and crossDomain
  44253. jQuery.ajaxPrefilter("script", function (s) {
  44254. if (s.cache === undefined) {
  44255. s.cache = false;
  44256. }
  44257. if (s.crossDomain) {
  44258. s.type = "GET";
  44259. }
  44260. });
  44261. // Bind script tag hack transport
  44262. jQuery.ajaxTransport("script", function (s) {
  44263. // This transport only deals with cross domain requests
  44264. if (s.crossDomain) {
  44265. var script, _callback2;
  44266. return {
  44267. send: function send(_, complete) {
  44268. script = jQuery("<script>").prop({
  44269. charset: s.scriptCharset,
  44270. src: s.url
  44271. }).on("load error", _callback2 = function callback(evt) {
  44272. script.remove();
  44273. _callback2 = null;
  44274. if (evt) {
  44275. complete(evt.type === "error" ? 404 : 200, evt.type);
  44276. }
  44277. });
  44278. // Use native DOM manipulation to avoid our domManip AJAX trickery
  44279. document.head.appendChild(script[0]);
  44280. },
  44281. abort: function abort() {
  44282. if (_callback2) {
  44283. _callback2();
  44284. }
  44285. }
  44286. };
  44287. }
  44288. });
  44289. var oldCallbacks = [],
  44290. rjsonp = /(=)\?(?=&|$)|\?\?/;
  44291. // Default jsonp settings
  44292. jQuery.ajaxSetup({
  44293. jsonp: "callback",
  44294. jsonpCallback: function jsonpCallback() {
  44295. var callback = oldCallbacks.pop() || jQuery.expando + "_" + nonce++;
  44296. this[callback] = true;
  44297. return callback;
  44298. }
  44299. });
  44300. // Detect, normalize options and install callbacks for jsonp requests
  44301. jQuery.ajaxPrefilter("json jsonp", function (s, originalSettings, jqXHR) {
  44302. var callbackName,
  44303. overwritten,
  44304. responseContainer,
  44305. jsonProp = s.jsonp !== false && (rjsonp.test(s.url) ? "url" : typeof s.data === "string" && (s.contentType || "").indexOf("application/x-www-form-urlencoded") === 0 && rjsonp.test(s.data) && "data");
  44306. // Handle iff the expected data type is "jsonp" or we have a parameter to set
  44307. if (jsonProp || s.dataTypes[0] === "jsonp") {
  44308. // Get callback name, remembering preexisting value associated with it
  44309. callbackName = s.jsonpCallback = isFunction(s.jsonpCallback) ? s.jsonpCallback() : s.jsonpCallback;
  44310. // Insert callback into url or form data
  44311. if (jsonProp) {
  44312. s[jsonProp] = s[jsonProp].replace(rjsonp, "$1" + callbackName);
  44313. } else if (s.jsonp !== false) {
  44314. s.url += (rquery.test(s.url) ? "&" : "?") + s.jsonp + "=" + callbackName;
  44315. }
  44316. // Use data converter to retrieve json after script execution
  44317. s.converters["script json"] = function () {
  44318. if (!responseContainer) {
  44319. jQuery.error(callbackName + " was not called");
  44320. }
  44321. return responseContainer[0];
  44322. };
  44323. // Force json dataType
  44324. s.dataTypes[0] = "json";
  44325. // Install callback
  44326. overwritten = window[callbackName];
  44327. window[callbackName] = function () {
  44328. responseContainer = arguments;
  44329. };
  44330. // Clean-up function (fires after converters)
  44331. jqXHR.always(function () {
  44332. // If previous value didn't exist - remove it
  44333. if (overwritten === undefined) {
  44334. jQuery(window).removeProp(callbackName);
  44335. // Otherwise restore preexisting value
  44336. } else {
  44337. window[callbackName] = overwritten;
  44338. }
  44339. // Save back as free
  44340. if (s[callbackName]) {
  44341. // Make sure that re-using the options doesn't screw things around
  44342. s.jsonpCallback = originalSettings.jsonpCallback;
  44343. // Save the callback name for future use
  44344. oldCallbacks.push(callbackName);
  44345. }
  44346. // Call if it was a function and we have a response
  44347. if (responseContainer && isFunction(overwritten)) {
  44348. overwritten(responseContainer[0]);
  44349. }
  44350. responseContainer = overwritten = undefined;
  44351. });
  44352. // Delegate to script
  44353. return "script";
  44354. }
  44355. });
  44356. // Support: Safari 8 only
  44357. // In Safari 8 documents created via document.implementation.createHTMLDocument
  44358. // collapse sibling forms: the second one becomes a child of the first one.
  44359. // Because of that, this security measure has to be disabled in Safari 8.
  44360. // https://bugs.webkit.org/show_bug.cgi?id=137337
  44361. support.createHTMLDocument = function () {
  44362. var body = document.implementation.createHTMLDocument("").body;
  44363. body.innerHTML = "<form></form><form></form>";
  44364. return body.childNodes.length === 2;
  44365. }();
  44366. // Argument "data" should be string of html
  44367. // context (optional): If specified, the fragment will be created in this context,
  44368. // defaults to document
  44369. // keepScripts (optional): If true, will include scripts passed in the html string
  44370. jQuery.parseHTML = function (data, context, keepScripts) {
  44371. if (typeof data !== "string") {
  44372. return [];
  44373. }
  44374. if (typeof context === "boolean") {
  44375. keepScripts = context;
  44376. context = false;
  44377. }
  44378. var base, parsed, scripts;
  44379. if (!context) {
  44380. // Stop scripts or inline event handlers from being executed immediately
  44381. // by using document.implementation
  44382. if (support.createHTMLDocument) {
  44383. context = document.implementation.createHTMLDocument("");
  44384. // Set the base href for the created document
  44385. // so any parsed elements with URLs
  44386. // are based on the document's URL (gh-2965)
  44387. base = context.createElement("base");
  44388. base.href = document.location.href;
  44389. context.head.appendChild(base);
  44390. } else {
  44391. context = document;
  44392. }
  44393. }
  44394. parsed = rsingleTag.exec(data);
  44395. scripts = !keepScripts && [];
  44396. // Single tag
  44397. if (parsed) {
  44398. return [context.createElement(parsed[1])];
  44399. }
  44400. parsed = buildFragment([data], context, scripts);
  44401. if (scripts && scripts.length) {
  44402. jQuery(scripts).remove();
  44403. }
  44404. return jQuery.merge([], parsed.childNodes);
  44405. };
  44406. /**
  44407. * Load a url into a page
  44408. */
  44409. jQuery.fn.load = function (url, params, callback) {
  44410. var selector,
  44411. type,
  44412. response,
  44413. self = this,
  44414. off = url.indexOf(" ");
  44415. if (off > -1) {
  44416. selector = stripAndCollapse(url.slice(off));
  44417. url = url.slice(0, off);
  44418. }
  44419. // If it's a function
  44420. if (isFunction(params)) {
  44421. // We assume that it's the callback
  44422. callback = params;
  44423. params = undefined;
  44424. // Otherwise, build a param string
  44425. } else if (params && (typeof params === "undefined" ? "undefined" : _typeof(params)) === "object") {
  44426. type = "POST";
  44427. }
  44428. // If we have elements to modify, make the request
  44429. if (self.length > 0) {
  44430. jQuery.ajax({
  44431. url: url,
  44432. // If "type" variable is undefined, then "GET" method will be used.
  44433. // Make value of this field explicit since
  44434. // user can override it through ajaxSetup method
  44435. type: type || "GET",
  44436. dataType: "html",
  44437. data: params
  44438. }).done(function (responseText) {
  44439. // Save response for use in complete callback
  44440. response = arguments;
  44441. self.html(selector ?
  44442. // If a selector was specified, locate the right elements in a dummy div
  44443. // Exclude scripts to avoid IE 'Permission Denied' errors
  44444. jQuery("<div>").append(jQuery.parseHTML(responseText)).find(selector) :
  44445. // Otherwise use the full result
  44446. responseText);
  44447. // If the request succeeds, this function gets "data", "status", "jqXHR"
  44448. // but they are ignored because response was set above.
  44449. // If it fails, this function gets "jqXHR", "status", "error"
  44450. }).always(callback && function (jqXHR, status) {
  44451. self.each(function () {
  44452. callback.apply(this, response || [jqXHR.responseText, status, jqXHR]);
  44453. });
  44454. });
  44455. }
  44456. return this;
  44457. };
  44458. // Attach a bunch of functions for handling common AJAX events
  44459. jQuery.each(["ajaxStart", "ajaxStop", "ajaxComplete", "ajaxError", "ajaxSuccess", "ajaxSend"], function (i, type) {
  44460. jQuery.fn[type] = function (fn) {
  44461. return this.on(type, fn);
  44462. };
  44463. });
  44464. jQuery.expr.pseudos.animated = function (elem) {
  44465. return jQuery.grep(jQuery.timers, function (fn) {
  44466. return elem === fn.elem;
  44467. }).length;
  44468. };
  44469. jQuery.offset = {
  44470. setOffset: function setOffset(elem, options, i) {
  44471. var curPosition,
  44472. curLeft,
  44473. curCSSTop,
  44474. curTop,
  44475. curOffset,
  44476. curCSSLeft,
  44477. calculatePosition,
  44478. position = jQuery.css(elem, "position"),
  44479. curElem = jQuery(elem),
  44480. props = {};
  44481. // Set position first, in-case top/left are set even on static elem
  44482. if (position === "static") {
  44483. elem.style.position = "relative";
  44484. }
  44485. curOffset = curElem.offset();
  44486. curCSSTop = jQuery.css(elem, "top");
  44487. curCSSLeft = jQuery.css(elem, "left");
  44488. calculatePosition = (position === "absolute" || position === "fixed") && (curCSSTop + curCSSLeft).indexOf("auto") > -1;
  44489. // Need to be able to calculate position if either
  44490. // top or left is auto and position is either absolute or fixed
  44491. if (calculatePosition) {
  44492. curPosition = curElem.position();
  44493. curTop = curPosition.top;
  44494. curLeft = curPosition.left;
  44495. } else {
  44496. curTop = parseFloat(curCSSTop) || 0;
  44497. curLeft = parseFloat(curCSSLeft) || 0;
  44498. }
  44499. if (isFunction(options)) {
  44500. // Use jQuery.extend here to allow modification of coordinates argument (gh-1848)
  44501. options = options.call(elem, i, jQuery.extend({}, curOffset));
  44502. }
  44503. if (options.top != null) {
  44504. props.top = options.top - curOffset.top + curTop;
  44505. }
  44506. if (options.left != null) {
  44507. props.left = options.left - curOffset.left + curLeft;
  44508. }
  44509. if ("using" in options) {
  44510. options.using.call(elem, props);
  44511. } else {
  44512. curElem.css(props);
  44513. }
  44514. }
  44515. };
  44516. jQuery.fn.extend({
  44517. // offset() relates an element's border box to the document origin
  44518. offset: function offset(options) {
  44519. // Preserve chaining for setter
  44520. if (arguments.length) {
  44521. return options === undefined ? this : this.each(function (i) {
  44522. jQuery.offset.setOffset(this, options, i);
  44523. });
  44524. }
  44525. var rect,
  44526. win,
  44527. elem = this[0];
  44528. if (!elem) {
  44529. return;
  44530. }
  44531. // Return zeros for disconnected and hidden (display: none) elements (gh-2310)
  44532. // Support: IE <=11 only
  44533. // Running getBoundingClientRect on a
  44534. // disconnected node in IE throws an error
  44535. if (!elem.getClientRects().length) {
  44536. return { top: 0, left: 0 };
  44537. }
  44538. // Get document-relative position by adding viewport scroll to viewport-relative gBCR
  44539. rect = elem.getBoundingClientRect();
  44540. win = elem.ownerDocument.defaultView;
  44541. return {
  44542. top: rect.top + win.pageYOffset,
  44543. left: rect.left + win.pageXOffset
  44544. };
  44545. },
  44546. // position() relates an element's margin box to its offset parent's padding box
  44547. // This corresponds to the behavior of CSS absolute positioning
  44548. position: function position() {
  44549. if (!this[0]) {
  44550. return;
  44551. }
  44552. var offsetParent,
  44553. offset,
  44554. doc,
  44555. elem = this[0],
  44556. parentOffset = { top: 0, left: 0 };
  44557. // position:fixed elements are offset from the viewport, which itself always has zero offset
  44558. if (jQuery.css(elem, "position") === "fixed") {
  44559. // Assume position:fixed implies availability of getBoundingClientRect
  44560. offset = elem.getBoundingClientRect();
  44561. } else {
  44562. offset = this.offset();
  44563. // Account for the *real* offset parent, which can be the document or its root element
  44564. // when a statically positioned element is identified
  44565. doc = elem.ownerDocument;
  44566. offsetParent = elem.offsetParent || doc.documentElement;
  44567. while (offsetParent && (offsetParent === doc.body || offsetParent === doc.documentElement) && jQuery.css(offsetParent, "position") === "static") {
  44568. offsetParent = offsetParent.parentNode;
  44569. }
  44570. if (offsetParent && offsetParent !== elem && offsetParent.nodeType === 1) {
  44571. // Incorporate borders into its offset, since they are outside its content origin
  44572. parentOffset = jQuery(offsetParent).offset();
  44573. parentOffset.top += jQuery.css(offsetParent, "borderTopWidth", true);
  44574. parentOffset.left += jQuery.css(offsetParent, "borderLeftWidth", true);
  44575. }
  44576. }
  44577. // Subtract parent offsets and element margins
  44578. return {
  44579. top: offset.top - parentOffset.top - jQuery.css(elem, "marginTop", true),
  44580. left: offset.left - parentOffset.left - jQuery.css(elem, "marginLeft", true)
  44581. };
  44582. },
  44583. // This method will return documentElement in the following cases:
  44584. // 1) For the element inside the iframe without offsetParent, this method will return
  44585. // documentElement of the parent window
  44586. // 2) For the hidden or detached element
  44587. // 3) For body or html element, i.e. in case of the html node - it will return itself
  44588. //
  44589. // but those exceptions were never presented as a real life use-cases
  44590. // and might be considered as more preferable results.
  44591. //
  44592. // This logic, however, is not guaranteed and can change at any point in the future
  44593. offsetParent: function offsetParent() {
  44594. return this.map(function () {
  44595. var offsetParent = this.offsetParent;
  44596. while (offsetParent && jQuery.css(offsetParent, "position") === "static") {
  44597. offsetParent = offsetParent.offsetParent;
  44598. }
  44599. return offsetParent || documentElement;
  44600. });
  44601. }
  44602. });
  44603. // Create scrollLeft and scrollTop methods
  44604. jQuery.each({ scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, function (method, prop) {
  44605. var top = "pageYOffset" === prop;
  44606. jQuery.fn[method] = function (val) {
  44607. return access(this, function (elem, method, val) {
  44608. // Coalesce documents and windows
  44609. var win;
  44610. if (isWindow(elem)) {
  44611. win = elem;
  44612. } else if (elem.nodeType === 9) {
  44613. win = elem.defaultView;
  44614. }
  44615. if (val === undefined) {
  44616. return win ? win[prop] : elem[method];
  44617. }
  44618. if (win) {
  44619. win.scrollTo(!top ? val : win.pageXOffset, top ? val : win.pageYOffset);
  44620. } else {
  44621. elem[method] = val;
  44622. }
  44623. }, method, val, arguments.length);
  44624. };
  44625. });
  44626. // Support: Safari <=7 - 9.1, Chrome <=37 - 49
  44627. // Add the top/left cssHooks using jQuery.fn.position
  44628. // Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084
  44629. // Blink bug: https://bugs.chromium.org/p/chromium/issues/detail?id=589347
  44630. // getComputedStyle returns percent when specified for top/left/bottom/right;
  44631. // rather than make the css module depend on the offset module, just check for it here
  44632. jQuery.each(["top", "left"], function (i, prop) {
  44633. jQuery.cssHooks[prop] = addGetHookIf(support.pixelPosition, function (elem, computed) {
  44634. if (computed) {
  44635. computed = curCSS(elem, prop);
  44636. // If curCSS returns percentage, fallback to offset
  44637. return rnumnonpx.test(computed) ? jQuery(elem).position()[prop] + "px" : computed;
  44638. }
  44639. });
  44640. });
  44641. // Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods
  44642. jQuery.each({ Height: "height", Width: "width" }, function (name, type) {
  44643. jQuery.each({ padding: "inner" + name, content: type, "": "outer" + name }, function (defaultExtra, funcName) {
  44644. // Margin is only for outerHeight, outerWidth
  44645. jQuery.fn[funcName] = function (margin, value) {
  44646. var chainable = arguments.length && (defaultExtra || typeof margin !== "boolean"),
  44647. extra = defaultExtra || (margin === true || value === true ? "margin" : "border");
  44648. return access(this, function (elem, type, value) {
  44649. var doc;
  44650. if (isWindow(elem)) {
  44651. // $( window ).outerWidth/Height return w/h including scrollbars (gh-1729)
  44652. return funcName.indexOf("outer") === 0 ? elem["inner" + name] : elem.document.documentElement["client" + name];
  44653. }
  44654. // Get document width or height
  44655. if (elem.nodeType === 9) {
  44656. doc = elem.documentElement;
  44657. // Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height],
  44658. // whichever is greatest
  44659. return Math.max(elem.body["scroll" + name], doc["scroll" + name], elem.body["offset" + name], doc["offset" + name], doc["client" + name]);
  44660. }
  44661. return value === undefined ?
  44662. // Get width or height on the element, requesting but not forcing parseFloat
  44663. jQuery.css(elem, type, extra) :
  44664. // Set width or height on the element
  44665. jQuery.style(elem, type, value, extra);
  44666. }, type, chainable ? margin : undefined, chainable);
  44667. };
  44668. });
  44669. });
  44670. jQuery.each(("blur focus focusin focusout resize scroll click dblclick " + "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " + "change select submit keydown keypress keyup contextmenu").split(" "), function (i, name) {
  44671. // Handle event binding
  44672. jQuery.fn[name] = function (data, fn) {
  44673. return arguments.length > 0 ? this.on(name, null, data, fn) : this.trigger(name);
  44674. };
  44675. });
  44676. jQuery.fn.extend({
  44677. hover: function hover(fnOver, fnOut) {
  44678. return this.mouseenter(fnOver).mouseleave(fnOut || fnOver);
  44679. }
  44680. });
  44681. jQuery.fn.extend({
  44682. bind: function bind(types, data, fn) {
  44683. return this.on(types, null, data, fn);
  44684. },
  44685. unbind: function unbind(types, fn) {
  44686. return this.off(types, null, fn);
  44687. },
  44688. delegate: function delegate(selector, types, data, fn) {
  44689. return this.on(types, selector, data, fn);
  44690. },
  44691. undelegate: function undelegate(selector, types, fn) {
  44692. // ( namespace ) or ( selector, types [, fn] )
  44693. return arguments.length === 1 ? this.off(selector, "**") : this.off(types, selector || "**", fn);
  44694. }
  44695. });
  44696. // Bind a function to a context, optionally partially applying any
  44697. // arguments.
  44698. // jQuery.proxy is deprecated to promote standards (specifically Function#bind)
  44699. // However, it is not slated for removal any time soon
  44700. jQuery.proxy = function (fn, context) {
  44701. var tmp, args, proxy;
  44702. if (typeof context === "string") {
  44703. tmp = fn[context];
  44704. context = fn;
  44705. fn = tmp;
  44706. }
  44707. // Quick check to determine if target is callable, in the spec
  44708. // this throws a TypeError, but we will just return undefined.
  44709. if (!isFunction(fn)) {
  44710. return undefined;
  44711. }
  44712. // Simulated bind
  44713. args = _slice.call(arguments, 2);
  44714. proxy = function proxy() {
  44715. return fn.apply(context || this, args.concat(_slice.call(arguments)));
  44716. };
  44717. // Set the guid of unique handler to the same of original handler, so it can be removed
  44718. proxy.guid = fn.guid = fn.guid || jQuery.guid++;
  44719. return proxy;
  44720. };
  44721. jQuery.holdReady = function (hold) {
  44722. if (hold) {
  44723. jQuery.readyWait++;
  44724. } else {
  44725. jQuery.ready(true);
  44726. }
  44727. };
  44728. jQuery.isArray = Array.isArray;
  44729. jQuery.parseJSON = JSON.parse;
  44730. jQuery.nodeName = nodeName;
  44731. jQuery.isFunction = isFunction;
  44732. jQuery.isWindow = isWindow;
  44733. jQuery.camelCase = camelCase;
  44734. jQuery.type = toType;
  44735. jQuery.now = Date.now;
  44736. jQuery.isNumeric = function (obj) {
  44737. // As of jQuery 3.0, isNumeric is limited to
  44738. // strings and numbers (primitives or objects)
  44739. // that can be coerced to finite numbers (gh-2662)
  44740. var type = jQuery.type(obj);
  44741. return (type === "number" || type === "string") &&
  44742. // parseFloat NaNs numeric-cast false positives ("")
  44743. // ...but misinterprets leading-number strings, particularly hex literals ("0x...")
  44744. // subtraction forces infinities to NaN
  44745. !isNaN(obj - parseFloat(obj));
  44746. };
  44747. // Register as a named AMD module, since jQuery can be concatenated with other
  44748. // files that may use define, but not via a proper concatenation script that
  44749. // understands anonymous AMD modules. A named AMD is safest and most robust
  44750. // way to register. Lowercase jquery is used because AMD module names are
  44751. // derived from file names, and jQuery is normally delivered in a lowercase
  44752. // file name. Do this after creating the global so that if an AMD module wants
  44753. // to call noConflict to hide this version of jQuery, it will work.
  44754. // Note that for maximum portability, libraries that are not jQuery should
  44755. // declare themselves as anonymous modules, and avoid setting a global if an
  44756. // AMD loader is present. jQuery is a special case. For more information, see
  44757. // https://github.com/jrburke/requirejs/wiki/Updating-existing-libraries#wiki-anon
  44758. if (true) {
  44759. !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = (function () {
  44760. return jQuery;
  44761. }).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
  44762. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  44763. }
  44764. var
  44765. // Map over jQuery in case of overwrite
  44766. _jQuery = window.jQuery,
  44767. // Map over the $ in case of overwrite
  44768. _$ = window.$;
  44769. jQuery.noConflict = function (deep) {
  44770. if (window.$ === jQuery) {
  44771. window.$ = _$;
  44772. }
  44773. if (deep && window.jQuery === jQuery) {
  44774. window.jQuery = _jQuery;
  44775. }
  44776. return jQuery;
  44777. };
  44778. // Expose jQuery and $ identifiers, even in AMD
  44779. // (#7102#comment:10, https://github.com/jquery/jquery/pull/557)
  44780. // and CommonJS for browser emulators (#13566)
  44781. if (!noGlobal) {
  44782. window.jQuery = window.$ = jQuery;
  44783. }
  44784. return jQuery;
  44785. });
  44786. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../webpack/buildin/module.js */ "./node_modules/webpack/buildin/module.js")(module)))
  44787. /***/ }),
  44788. /***/ "./node_modules/line-i18n/dist/LanguageService.js":
  44789. /*!********************************************************!*\
  44790. !*** ./node_modules/line-i18n/dist/LanguageService.js ***!
  44791. \********************************************************/
  44792. /*! no static exports found */
  44793. /***/ (function(module, exports, __webpack_require__) {
  44794. "use strict";
  44795. Object.defineProperty(exports, "__esModule", {
  44796. value: true
  44797. });
  44798. var LanguageService = /** @class */function () {
  44799. function LanguageService(lsKey, defaultLang) {
  44800. if (defaultLang === void 0) {
  44801. defaultLang = 'pt';
  44802. }
  44803. this.lsKey = lsKey;
  44804. this.defaultLang = defaultLang;
  44805. this.listeners = [];
  44806. this.document = document;
  44807. this.setupListener();
  44808. }
  44809. LanguageService.prototype.setupListener = function () {
  44810. var _this = this;
  44811. if (this.document !== null) {
  44812. this.document.addEventListener("storage", function (event) {
  44813. var e = event;
  44814. if (e.key === _this.lsKey) {
  44815. _this.listeners.forEach(function (l) {
  44816. return l();
  44817. });
  44818. }
  44819. });
  44820. }
  44821. };
  44822. LanguageService.prototype.getLang = function () {
  44823. var lang = localStorage.getItem(this.lsKey);
  44824. if (lang === null || lang === undefined) {
  44825. console.warn("Internal Error: User language information has not been set. Returning default...");
  44826. return this.getDefaultLang();
  44827. }
  44828. return lang;
  44829. };
  44830. LanguageService.prototype.getDefaultLang = function () {
  44831. return this.defaultLang;
  44832. };
  44833. LanguageService.prototype.registerLanguageChangeListener = function (listener) {
  44834. this.listeners.push(listener);
  44835. };
  44836. return LanguageService;
  44837. }();
  44838. exports.LanguageService = LanguageService;
  44839. /***/ }),
  44840. /***/ "./node_modules/line-i18n/dist/LanguageServiceNoLS.js":
  44841. /*!************************************************************!*\
  44842. !*** ./node_modules/line-i18n/dist/LanguageServiceNoLS.js ***!
  44843. \************************************************************/
  44844. /*! no static exports found */
  44845. /***/ (function(module, exports, __webpack_require__) {
  44846. "use strict";
  44847. Object.defineProperty(exports, "__esModule", {
  44848. value: true
  44849. });
  44850. var LanguageServiceNoLS = /** @class */function () {
  44851. function LanguageServiceNoLS(lang) {
  44852. this.lang = lang;
  44853. this.listeners = [];
  44854. }
  44855. LanguageServiceNoLS.prototype.setupListener = function () {};
  44856. LanguageServiceNoLS.prototype.notifyChange = function () {
  44857. this.listeners.forEach(function (l) {
  44858. return l();
  44859. });
  44860. };
  44861. LanguageServiceNoLS.prototype.setLang = function (lang) {
  44862. this.lang = lang;
  44863. this.notifyChange();
  44864. };
  44865. LanguageServiceNoLS.prototype.getLang = function () {
  44866. return this.lang;
  44867. };
  44868. LanguageServiceNoLS.prototype.getDefaultLang = function () {
  44869. return this.lang;
  44870. };
  44871. LanguageServiceNoLS.prototype.registerLanguageChangeListener = function (listener) {
  44872. this.listeners.push(listener);
  44873. };
  44874. return LanguageServiceNoLS;
  44875. }();
  44876. exports.LanguageServiceNoLS = LanguageServiceNoLS;
  44877. /***/ }),
  44878. /***/ "./node_modules/line-i18n/dist/LocalizedStrings.js":
  44879. /*!*********************************************************!*\
  44880. !*** ./node_modules/line-i18n/dist/LocalizedStrings.js ***!
  44881. \*********************************************************/
  44882. /*! no static exports found */
  44883. /***/ (function(module, exports, __webpack_require__) {
  44884. "use strict";
  44885. Object.defineProperty(exports, "__esModule", {
  44886. value: true
  44887. });
  44888. exports.LocalizedStrings = undefined;
  44889. var _StringTypes = __webpack_require__(/*! ./StringTypes */ "./node_modules/line-i18n/dist/StringTypes.js");
  44890. var LocalizedStrings = /** @class */function () {
  44891. function LocalizedStrings(service, i18nData, listenToChange) {
  44892. if (listenToChange === void 0) {
  44893. listenToChange = false;
  44894. }
  44895. var _this = this;
  44896. this.service = service;
  44897. this.i18nData = i18nData;
  44898. this.listenToChange = listenToChange;
  44899. this.document = document;
  44900. if (this.listenToChange) {
  44901. service.registerLanguageChangeListener(function () {
  44902. _this.updateTagText();
  44903. });
  44904. }
  44905. }
  44906. LocalizedStrings.prototype.getString = function (id, type) {
  44907. var i18nObj = this.i18nData[this.service.getLang()];
  44908. if (!!!i18nObj) {
  44909. console.warn("Internal Error. The language set at ivprog.lang is not valid: " + this.service.getLang());
  44910. i18nObj = this.i18nData[this.service.getDefaultLang()];
  44911. }
  44912. if (!!!i18nObj[type]) {
  44913. return "{MISSING_I18N_TYPE_IDENTIFIER}";
  44914. } else if (!!!i18nObj[type][id]) {
  44915. return "{MISSING_I18N_IDENTIFIER}";
  44916. } else {
  44917. return i18nObj[type][id];
  44918. }
  44919. };
  44920. LocalizedStrings.prototype.getOR = function () {
  44921. return this.getUI('join_or');
  44922. };
  44923. LocalizedStrings.prototype.getError = function (id, context) {
  44924. if (context === void 0) {
  44925. context = [];
  44926. }
  44927. var text = this.getString(id, _StringTypes.StringTypes.ERROR);
  44928. return this.processString(text, context);
  44929. };
  44930. LocalizedStrings.prototype.getMessage = function (id, context) {
  44931. if (context === void 0) {
  44932. context = [];
  44933. }
  44934. var text = this.getString(id, _StringTypes.StringTypes.MESSAGE);
  44935. return this.processString(text, context);
  44936. };
  44937. LocalizedStrings.prototype.getUI = function (id, context) {
  44938. if (context === void 0) {
  44939. context = [];
  44940. }
  44941. var text = this.getString(id, _StringTypes.StringTypes.UI);
  44942. return this.processString(text, context);
  44943. };
  44944. LocalizedStrings.prototype.processString = function (text, context) {
  44945. for (var i = 0; i < context.length; i++) {
  44946. var v = context[i];
  44947. text = text.replace('\$' + i, v);
  44948. }
  44949. return text;
  44950. };
  44951. LocalizedStrings.prototype.updateTagText = function (func) {
  44952. var _this = this;
  44953. if (func === void 0) {
  44954. func = null;
  44955. }
  44956. if (this.document !== null) {
  44957. var list = this.document.querySelectorAll("data.i18n");
  44958. list.forEach(function (node) {
  44959. if (func === null) {
  44960. node.innerHTML = _this.processTagTex(node.getAttribute("value"));
  44961. } else {
  44962. node.innerHTML = func(node.getAttribute("value"));
  44963. }
  44964. });
  44965. }
  44966. };
  44967. LocalizedStrings.prototype.processTagTex = function (text) {
  44968. if (text === null) {
  44969. return "<Invalid i18n identifier>";
  44970. }
  44971. var opts = text.split(':');
  44972. var type = opts[0].toLowerCase();
  44973. var id = opts[1];
  44974. if (_StringTypes.StringTypes.ERROR === type) {
  44975. return this.getError(id);
  44976. } else if (_StringTypes.StringTypes.MESSAGE === type) {
  44977. return this.getMessage(id);
  44978. } else if (_StringTypes.StringTypes.UI === type) {
  44979. return this.getUI(id);
  44980. } else {
  44981. console.warn(" A string has been passed to the i18n helper function that was not in the form type:id -> " + text);
  44982. return this.getString(id, type);
  44983. }
  44984. };
  44985. return LocalizedStrings;
  44986. }();
  44987. exports.LocalizedStrings = LocalizedStrings;
  44988. /***/ }),
  44989. /***/ "./node_modules/line-i18n/dist/StringTypes.js":
  44990. /*!****************************************************!*\
  44991. !*** ./node_modules/line-i18n/dist/StringTypes.js ***!
  44992. \****************************************************/
  44993. /*! no static exports found */
  44994. /***/ (function(module, exports, __webpack_require__) {
  44995. "use strict";
  44996. Object.defineProperty(exports, "__esModule", {
  44997. value: true
  44998. });
  44999. var StringTypes = exports.StringTypes = undefined;
  45000. (function (StringTypes) {
  45001. StringTypes["ERROR"] = "error";
  45002. StringTypes["MESSAGE"] = "message";
  45003. StringTypes["UI"] = "ui";
  45004. })(StringTypes || (exports.StringTypes = StringTypes = {}));
  45005. /***/ }),
  45006. /***/ "./node_modules/line-i18n/dist/index.js":
  45007. /*!**********************************************!*\
  45008. !*** ./node_modules/line-i18n/dist/index.js ***!
  45009. \**********************************************/
  45010. /*! no static exports found */
  45011. /***/ (function(module, exports, __webpack_require__) {
  45012. "use strict";
  45013. Object.defineProperty(exports, "__esModule", {
  45014. value: true
  45015. });
  45016. var _LanguageService = __webpack_require__(/*! ./LanguageService */ "./node_modules/line-i18n/dist/LanguageService.js");
  45017. var _LocalizedStrings = __webpack_require__(/*! ./LocalizedStrings */ "./node_modules/line-i18n/dist/LocalizedStrings.js");
  45018. var _StringTypes = __webpack_require__(/*! ./StringTypes */ "./node_modules/line-i18n/dist/StringTypes.js");
  45019. var _LanguageServiceNoLS = __webpack_require__(/*! ./LanguageServiceNoLS */ "./node_modules/line-i18n/dist/LanguageServiceNoLS.js");
  45020. exports.default = {
  45021. LanguageService: _LanguageService.LanguageService,
  45022. LanguageServiceNoLS: _LanguageServiceNoLS.LanguageServiceNoLS,
  45023. LocalizedStrings: _LocalizedStrings.LocalizedStrings,
  45024. StringTypes: _StringTypes.StringTypes
  45025. };
  45026. /***/ }),
  45027. /***/ "./node_modules/melanke-watchjs/src/watch.js":
  45028. /*!***************************************************!*\
  45029. !*** ./node_modules/melanke-watchjs/src/watch.js ***!
  45030. \***************************************************/
  45031. /*! no static exports found */
  45032. /***/ (function(module, exports, __webpack_require__) {
  45033. "use strict";
  45034. var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;/**
  45035. * DEVELOPED BY
  45036. * GIL LOPES BUENO
  45037. * gilbueno.mail@gmail.com
  45038. *
  45039. * WORKS WITH:
  45040. * IE8*, IE 9+, FF 4+, SF 5+, WebKit, CH 7+, OP 12+, BESEN, Rhino 1.7+
  45041. * For IE8 (and other legacy browsers) WatchJS will use dirty checking
  45042. *
  45043. * FORK:
  45044. * https://github.com/melanke/Watch.JS
  45045. *
  45046. * LICENSE: MIT
  45047. */
  45048. var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
  45049. (function (factory) {
  45050. if (( false ? undefined : _typeof(exports)) === 'object') {
  45051. // Node. Does not work with strict CommonJS, but
  45052. // only CommonJS-like enviroments that support module.exports,
  45053. // like Node.
  45054. module.exports = factory();
  45055. } else if (true) {
  45056. // AMD. Register as an anonymous module.
  45057. !(__WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
  45058. __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
  45059. (__WEBPACK_AMD_DEFINE_FACTORY__.call(exports, __webpack_require__, exports, module)) :
  45060. __WEBPACK_AMD_DEFINE_FACTORY__),
  45061. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  45062. } else {}
  45063. })(function () {
  45064. var WatchJS = {
  45065. noMore: false, // use WatchJS.suspend(obj) instead
  45066. useDirtyCheck: false, // use only dirty checking to track changes.
  45067. preserveExistingSetters: false
  45068. },
  45069. lengthsubjects = [];
  45070. var dirtyChecklist = [];
  45071. var pendingChanges = []; // used coalesce changes from defineProperty and __defineSetter__
  45072. var supportDefineProperty = false;
  45073. try {
  45074. supportDefineProperty = Object.defineProperty && Object.defineProperty({}, 'x', {});
  45075. } catch (ex) {/* not supported */}
  45076. var isFunction = function isFunction(functionToCheck) {
  45077. var getType = {};
  45078. return functionToCheck && getType.toString.call(functionToCheck) == '[object Function]';
  45079. };
  45080. var isInt = function isInt(x) {
  45081. return x % 1 === 0;
  45082. };
  45083. var isArray = function isArray(obj) {
  45084. return Object.prototype.toString.call(obj) === '[object Array]';
  45085. };
  45086. var isObject = function isObject(obj) {
  45087. return {}.toString.apply(obj) === '[object Object]';
  45088. };
  45089. var getObjDiff = function getObjDiff(a, b) {
  45090. var aplus = [],
  45091. bplus = [];
  45092. if (!(typeof a == "string") && !(typeof b == "string")) {
  45093. if (isArray(a) && b) {
  45094. for (var i = 0; i < a.length; i++) {
  45095. if (b[i] === undefined) aplus.push(i);
  45096. }
  45097. } else {
  45098. for (var i in a) {
  45099. if (a.hasOwnProperty(i)) {
  45100. if (b && !b.hasOwnProperty(i)) {
  45101. aplus.push(i);
  45102. }
  45103. }
  45104. }
  45105. }
  45106. if (isArray(b) && a) {
  45107. for (var j = 0; j < b.length; j++) {
  45108. if (a[j] === undefined) bplus.push(j);
  45109. }
  45110. } else {
  45111. for (var j in b) {
  45112. if (b.hasOwnProperty(j)) {
  45113. if (a && !a.hasOwnProperty(j)) {
  45114. bplus.push(j);
  45115. }
  45116. }
  45117. }
  45118. }
  45119. }
  45120. return {
  45121. added: aplus,
  45122. removed: bplus
  45123. };
  45124. };
  45125. var clone = function clone(obj) {
  45126. if (null == obj || "object" != (typeof obj === 'undefined' ? 'undefined' : _typeof(obj))) {
  45127. return obj;
  45128. }
  45129. var copy = obj.constructor();
  45130. for (var attr in obj) {
  45131. copy[attr] = obj[attr];
  45132. }
  45133. return copy;
  45134. };
  45135. var getExistingSetter = function getExistingSetter(obj, propName) {
  45136. if (WatchJS.preserveExistingSetters) {
  45137. var existing = Object.getOwnPropertyDescriptor(obj, propName);
  45138. return existing.set;
  45139. }
  45140. return undefined;
  45141. };
  45142. var defineGetAndSet = function defineGetAndSet(obj, propName, getter, setter) {
  45143. try {
  45144. var existingSetter = getExistingSetter(obj, propName);
  45145. Object.defineProperty(obj, propName, {
  45146. get: getter,
  45147. set: function set(value) {
  45148. setter.call(this, value, true); // coalesce changes
  45149. if (existingSetter) {
  45150. existingSetter(value);
  45151. }
  45152. },
  45153. enumerable: true,
  45154. configurable: true
  45155. });
  45156. } catch (e1) {
  45157. try {
  45158. Object.prototype.__defineGetter__.call(obj, propName, getter);
  45159. Object.prototype.__defineSetter__.call(obj, propName, function (value) {
  45160. setter.call(this, value, true); // coalesce changes
  45161. });
  45162. } catch (e2) {
  45163. observeDirtyChanges(obj, propName, setter);
  45164. //throw new Error("watchJS error: browser not supported :/")
  45165. }
  45166. }
  45167. };
  45168. var defineProp = function defineProp(obj, propName, value) {
  45169. try {
  45170. Object.defineProperty(obj, propName, {
  45171. enumerable: false,
  45172. configurable: true,
  45173. writable: false,
  45174. value: value
  45175. });
  45176. } catch (error) {
  45177. obj[propName] = value;
  45178. }
  45179. };
  45180. var observeDirtyChanges = function observeDirtyChanges(obj, propName, setter) {
  45181. dirtyChecklist[dirtyChecklist.length] = {
  45182. prop: propName,
  45183. object: obj,
  45184. orig: clone(obj[propName]),
  45185. callback: setter
  45186. };
  45187. };
  45188. var watch = function watch() {
  45189. if (isFunction(arguments[1])) {
  45190. watchAll.apply(this, arguments);
  45191. } else if (isArray(arguments[1])) {
  45192. watchMany.apply(this, arguments);
  45193. } else {
  45194. watchOne.apply(this, arguments);
  45195. }
  45196. };
  45197. var watchAll = function watchAll(obj, watcher, level, addNRemove) {
  45198. if (typeof obj == "string" || !(obj instanceof Object) && !isArray(obj)) {
  45199. //accepts only objects and array (not string)
  45200. return;
  45201. }
  45202. if (isArray(obj)) {
  45203. defineWatcher(obj, "__watchall__", watcher, level); // watch all changes on the array
  45204. if (level === undefined || level > 0) {
  45205. for (var prop = 0; prop < obj.length; prop++) {
  45206. // watch objects in array
  45207. watchAll(obj[prop], watcher, level, addNRemove);
  45208. }
  45209. }
  45210. } else {
  45211. var prop,
  45212. props = [];
  45213. for (prop in obj) {
  45214. //for each attribute if obj is an object
  45215. if (prop == "$val" || !supportDefineProperty && prop === 'watchers') {
  45216. continue;
  45217. }
  45218. if (Object.prototype.hasOwnProperty.call(obj, prop)) {
  45219. props.push(prop); //put in the props
  45220. }
  45221. }
  45222. watchMany(obj, props, watcher, level, addNRemove); //watch all items of the props
  45223. }
  45224. if (addNRemove) {
  45225. pushToLengthSubjects(obj, "$$watchlengthsubjectroot", watcher, level);
  45226. }
  45227. };
  45228. var watchMany = function watchMany(obj, props, watcher, level, addNRemove) {
  45229. if (typeof obj == "string" || !(obj instanceof Object) && !isArray(obj)) {
  45230. //accepts only objects and array (not string)
  45231. return;
  45232. }
  45233. for (var i = 0; i < props.length; i++) {
  45234. //watch each property
  45235. var prop = props[i];
  45236. watchOne(obj, prop, watcher, level, addNRemove);
  45237. }
  45238. };
  45239. var watchOne = function watchOne(obj, prop, watcher, level, addNRemove) {
  45240. if (typeof obj == "string" || !(obj instanceof Object) && !isArray(obj)) {
  45241. //accepts only objects and array (not string)
  45242. return;
  45243. }
  45244. if (isFunction(obj[prop])) {
  45245. //dont watch if it is a function
  45246. return;
  45247. }
  45248. if (obj[prop] != null && (level === undefined || level > 0)) {
  45249. watchAll(obj[prop], watcher, level !== undefined ? level - 1 : level); //recursively watch all attributes of this
  45250. }
  45251. defineWatcher(obj, prop, watcher, level);
  45252. if (addNRemove && (level === undefined || level > 0)) {
  45253. pushToLengthSubjects(obj, prop, watcher, level);
  45254. }
  45255. };
  45256. var unwatch = function unwatch() {
  45257. if (isFunction(arguments[1])) {
  45258. unwatchAll.apply(this, arguments);
  45259. } else if (isArray(arguments[1])) {
  45260. unwatchMany.apply(this, arguments);
  45261. } else {
  45262. unwatchOne.apply(this, arguments);
  45263. }
  45264. };
  45265. var unwatchAll = function unwatchAll(obj, watcher) {
  45266. if (obj instanceof String || !(obj instanceof Object) && !isArray(obj)) {
  45267. //accepts only objects and array (not string)
  45268. return;
  45269. }
  45270. if (isArray(obj)) {
  45271. var props = ['__watchall__'];
  45272. for (var prop = 0; prop < obj.length; prop++) {
  45273. //for each item if obj is an array
  45274. props.push(prop); //put in the props
  45275. }
  45276. unwatchMany(obj, props, watcher); //watch all itens of the props
  45277. } else {
  45278. var unwatchPropsInObject = function unwatchPropsInObject(obj2) {
  45279. var props = [];
  45280. for (var prop2 in obj2) {
  45281. //for each attribute if obj is an object
  45282. if (obj2.hasOwnProperty(prop2)) {
  45283. if (obj2[prop2] instanceof Object) {
  45284. unwatchPropsInObject(obj2[prop2]); //recurs into object props
  45285. } else {
  45286. props.push(prop2); //put in the props
  45287. }
  45288. }
  45289. }
  45290. unwatchMany(obj2, props, watcher); //unwatch all of the props
  45291. };
  45292. unwatchPropsInObject(obj);
  45293. }
  45294. };
  45295. var unwatchMany = function unwatchMany(obj, props, watcher) {
  45296. for (var prop2 in props) {
  45297. //watch each attribute of "props" if is an object
  45298. if (props.hasOwnProperty(prop2)) {
  45299. unwatchOne(obj, props[prop2], watcher);
  45300. }
  45301. }
  45302. };
  45303. var timeouts = [],
  45304. timerID = null;
  45305. function clearTimerID() {
  45306. timerID = null;
  45307. for (var i = 0; i < timeouts.length; i++) {
  45308. timeouts[i]();
  45309. }
  45310. timeouts.length = 0;
  45311. }
  45312. var getTimerID = function getTimerID() {
  45313. if (!timerID) {
  45314. timerID = setTimeout(clearTimerID);
  45315. }
  45316. return timerID;
  45317. };
  45318. var registerTimeout = function registerTimeout(fn) {
  45319. // register function to be called on timeout
  45320. if (timerID == null) getTimerID();
  45321. timeouts[timeouts.length] = fn;
  45322. };
  45323. // Track changes made to an array, object or an object's property
  45324. // and invoke callback with a single change object containing type, value, oldvalue and array splices
  45325. // Syntax:
  45326. // trackChange(obj, callback, recursive, addNRemove)
  45327. // trackChange(obj, prop, callback, recursive, addNRemove)
  45328. var trackChange = function trackChange() {
  45329. var fn = isFunction(arguments[2]) ? trackProperty : trackObject;
  45330. fn.apply(this, arguments);
  45331. };
  45332. // track changes made to an object and invoke callback with a single change object containing type, value and array splices
  45333. var trackObject = function trackObject(obj, callback, recursive, addNRemove) {
  45334. var change = null,
  45335. lastTimerID = -1;
  45336. var isArr = isArray(obj);
  45337. var level,
  45338. fn = function fn(prop, action, newValue, oldValue) {
  45339. var timerID = getTimerID();
  45340. if (lastTimerID !== timerID) {
  45341. // check if timer has changed since last update
  45342. lastTimerID = timerID;
  45343. change = {
  45344. type: 'update'
  45345. };
  45346. change['value'] = obj;
  45347. change['splices'] = null;
  45348. registerTimeout(function () {
  45349. callback.call(this, change);
  45350. change = null;
  45351. });
  45352. }
  45353. // create splices for array changes
  45354. if (isArr && obj === this && change !== null) {
  45355. if (action === 'pop' || action === 'shift') {
  45356. newValue = [];
  45357. oldValue = [oldValue];
  45358. } else if (action === 'push' || action === 'unshift') {
  45359. newValue = [newValue];
  45360. oldValue = [];
  45361. } else if (action !== 'splice') {
  45362. return; // return here - for reverse and sort operations we don't need to return splices. a simple update will do
  45363. }
  45364. if (!change.splices) change.splices = [];
  45365. change.splices[change.splices.length] = {
  45366. index: prop,
  45367. deleteCount: oldValue ? oldValue.length : 0,
  45368. addedCount: newValue ? newValue.length : 0,
  45369. added: newValue,
  45370. deleted: oldValue
  45371. };
  45372. }
  45373. };
  45374. level = recursive == true ? undefined : 0;
  45375. watchAll(obj, fn, level, addNRemove);
  45376. };
  45377. // track changes made to the property of an object and invoke callback with a single change object containing type, value, oldvalue and splices
  45378. var trackProperty = function trackProperty(obj, prop, callback, recursive, addNRemove) {
  45379. if (obj && prop) {
  45380. watchOne(obj, prop, function (prop, action, newvalue, oldvalue) {
  45381. var change = {
  45382. type: 'update'
  45383. };
  45384. change['value'] = newvalue;
  45385. change['oldvalue'] = oldvalue;
  45386. if (recursive && isObject(newvalue) || isArray(newvalue)) {
  45387. trackObject(newvalue, callback, recursive, addNRemove);
  45388. }
  45389. callback.call(this, change);
  45390. }, 0);
  45391. if (recursive && isObject(obj[prop]) || isArray(obj[prop])) {
  45392. trackObject(obj[prop], callback, recursive, addNRemove);
  45393. }
  45394. }
  45395. };
  45396. var defineWatcher = function defineWatcher(obj, prop, watcher, level) {
  45397. var newWatcher = false;
  45398. var isArr = isArray(obj);
  45399. if (!obj.watchers) {
  45400. defineProp(obj, "watchers", {});
  45401. if (isArr) {
  45402. // watch array functions
  45403. watchFunctions(obj, function (index, action, newValue, oldValue) {
  45404. addPendingChange(obj, index, action, newValue, oldValue);
  45405. if (level !== 0 && newValue && (isObject(newValue) || isArray(newValue))) {
  45406. var i,
  45407. n,
  45408. ln,
  45409. wAll,
  45410. watchList = obj.watchers[prop];
  45411. if (wAll = obj.watchers['__watchall__']) {
  45412. watchList = watchList ? watchList.concat(wAll) : wAll;
  45413. }
  45414. ln = watchList ? watchList.length : 0;
  45415. for (i = 0; i < ln; i++) {
  45416. if (action !== 'splice') {
  45417. watchAll(newValue, watchList[i], level === undefined ? level : level - 1);
  45418. } else {
  45419. // watch spliced values
  45420. for (n = 0; n < newValue.length; n++) {
  45421. watchAll(newValue[n], watchList[i], level === undefined ? level : level - 1);
  45422. }
  45423. }
  45424. }
  45425. }
  45426. });
  45427. }
  45428. }
  45429. if (!obj.watchers[prop]) {
  45430. obj.watchers[prop] = [];
  45431. if (!isArr) newWatcher = true;
  45432. }
  45433. for (var i = 0; i < obj.watchers[prop].length; i++) {
  45434. if (obj.watchers[prop][i] === watcher) {
  45435. return;
  45436. }
  45437. }
  45438. obj.watchers[prop].push(watcher); //add the new watcher to the watchers array
  45439. if (newWatcher) {
  45440. var val = obj[prop];
  45441. var getter = function getter() {
  45442. return val;
  45443. };
  45444. var setter = function setter(newval, delayWatcher) {
  45445. var oldval = val;
  45446. val = newval;
  45447. if (level !== 0 && obj[prop] && (isObject(obj[prop]) || isArray(obj[prop])) && !obj[prop].watchers) {
  45448. // watch sub properties
  45449. var i,
  45450. ln = obj.watchers[prop].length;
  45451. for (i = 0; i < ln; i++) {
  45452. watchAll(obj[prop], obj.watchers[prop][i], level === undefined ? level : level - 1);
  45453. }
  45454. }
  45455. //watchFunctions(obj, prop);
  45456. if (isSuspended(obj, prop)) {
  45457. resume(obj, prop);
  45458. return;
  45459. }
  45460. if (!WatchJS.noMore) {
  45461. // this does not work with Object.observe
  45462. //if (JSON.stringify(oldval) !== JSON.stringify(newval)) {
  45463. if (oldval !== newval) {
  45464. if (!delayWatcher) {
  45465. callWatchers(obj, prop, "set", newval, oldval);
  45466. } else {
  45467. addPendingChange(obj, prop, "set", newval, oldval);
  45468. }
  45469. WatchJS.noMore = false;
  45470. }
  45471. }
  45472. };
  45473. if (WatchJS.useDirtyCheck) {
  45474. observeDirtyChanges(obj, prop, setter);
  45475. } else {
  45476. defineGetAndSet(obj, prop, getter, setter);
  45477. }
  45478. }
  45479. };
  45480. var callWatchers = function callWatchers(obj, prop, action, newval, oldval) {
  45481. if (prop !== undefined) {
  45482. var ln,
  45483. wl,
  45484. watchList = obj.watchers[prop];
  45485. if (wl = obj.watchers['__watchall__']) {
  45486. watchList = watchList ? watchList.concat(wl) : wl;
  45487. }
  45488. ln = watchList ? watchList.length : 0;
  45489. for (var wr = 0; wr < ln; wr++) {
  45490. watchList[wr].call(obj, prop, action, newval, oldval);
  45491. }
  45492. } else {
  45493. for (var prop in obj) {
  45494. //call all
  45495. if (obj.hasOwnProperty(prop)) {
  45496. callWatchers(obj, prop, action, newval, oldval);
  45497. }
  45498. }
  45499. }
  45500. };
  45501. var methodNames = ['pop', 'push', 'reverse', 'shift', 'sort', 'slice', 'unshift', 'splice'];
  45502. var defineArrayMethodWatcher = function defineArrayMethodWatcher(obj, original, methodName, callback) {
  45503. defineProp(obj, methodName, function () {
  45504. var index = 0;
  45505. var i, newValue, oldValue, response;
  45506. // get values before splicing array
  45507. if (methodName === 'splice') {
  45508. var start = arguments[0];
  45509. var end = start + arguments[1];
  45510. oldValue = obj.slice(start, end);
  45511. newValue = [];
  45512. for (i = 2; i < arguments.length; i++) {
  45513. newValue[i - 2] = arguments[i];
  45514. }
  45515. index = start;
  45516. } else {
  45517. newValue = arguments.length > 0 ? arguments[0] : undefined;
  45518. }
  45519. response = original.apply(obj, arguments);
  45520. if (methodName !== 'slice') {
  45521. if (methodName === 'pop') {
  45522. oldValue = response;
  45523. index = obj.length;
  45524. } else if (methodName === 'push') {
  45525. index = obj.length - 1;
  45526. } else if (methodName === 'shift') {
  45527. oldValue = response;
  45528. } else if (methodName !== 'unshift' && newValue === undefined) {
  45529. newValue = response;
  45530. }
  45531. callback.call(obj, index, methodName, newValue, oldValue);
  45532. }
  45533. return response;
  45534. });
  45535. };
  45536. var watchFunctions = function watchFunctions(obj, callback) {
  45537. if (!isFunction(callback) || !obj || obj instanceof String || !isArray(obj)) {
  45538. return;
  45539. }
  45540. for (var i = methodNames.length, methodName; i--;) {
  45541. methodName = methodNames[i];
  45542. defineArrayMethodWatcher(obj, obj[methodName], methodName, callback);
  45543. }
  45544. };
  45545. var unwatchOne = function unwatchOne(obj, prop, watcher) {
  45546. if (prop) {
  45547. if (obj.watchers && obj.watchers[prop]) {
  45548. if (watcher === undefined) {
  45549. delete obj.watchers[prop]; // remove all property watchers
  45550. } else {
  45551. for (var i = 0; i < obj.watchers[prop].length; i++) {
  45552. var w = obj.watchers[prop][i];
  45553. if (w == watcher) {
  45554. obj.watchers[prop].splice(i, 1);
  45555. }
  45556. }
  45557. }
  45558. }
  45559. } else {
  45560. delete obj.watchers;
  45561. }
  45562. removeFromLengthSubjects(obj, prop, watcher);
  45563. removeFromDirtyChecklist(obj, prop);
  45564. };
  45565. // suspend watchers until next update cycle
  45566. var suspend = function suspend(obj, prop) {
  45567. if (obj.watchers) {
  45568. var name = '__wjs_suspend__' + (prop !== undefined ? prop : '');
  45569. obj.watchers[name] = true;
  45570. }
  45571. };
  45572. var isSuspended = function isSuspended(obj, prop) {
  45573. return obj.watchers && (obj.watchers['__wjs_suspend__'] || obj.watchers['__wjs_suspend__' + prop]);
  45574. };
  45575. // resumes preivously suspended watchers
  45576. var resume = function resume(obj, prop) {
  45577. registerTimeout(function () {
  45578. delete obj.watchers['__wjs_suspend__'];
  45579. delete obj.watchers['__wjs_suspend__' + prop];
  45580. });
  45581. };
  45582. var pendingTimerID = null;
  45583. var addPendingChange = function addPendingChange(obj, prop, mode, newval, oldval) {
  45584. pendingChanges[pendingChanges.length] = {
  45585. obj: obj,
  45586. prop: prop,
  45587. mode: mode,
  45588. newval: newval,
  45589. oldval: oldval
  45590. };
  45591. if (pendingTimerID === null) {
  45592. pendingTimerID = setTimeout(applyPendingChanges);
  45593. }
  45594. };
  45595. var applyPendingChanges = function applyPendingChanges() {
  45596. // apply pending changes
  45597. var change = null;
  45598. pendingTimerID = null;
  45599. for (var i = 0; i < pendingChanges.length; i++) {
  45600. change = pendingChanges[i];
  45601. callWatchers(change.obj, change.prop, change.mode, change.newval, change.oldval);
  45602. }
  45603. if (change) {
  45604. pendingChanges = [];
  45605. change = null;
  45606. }
  45607. };
  45608. var loop = function loop() {
  45609. // check for new or deleted props
  45610. for (var i = 0; i < lengthsubjects.length; i++) {
  45611. var subj = lengthsubjects[i];
  45612. if (subj.prop === "$$watchlengthsubjectroot") {
  45613. var difference = getObjDiff(subj.obj, subj.actual);
  45614. if (difference.added.length || difference.removed.length) {
  45615. if (difference.added.length) {
  45616. watchMany(subj.obj, difference.added, subj.watcher, subj.level - 1, true);
  45617. }
  45618. subj.watcher.call(subj.obj, "root", "differentattr", difference, subj.actual);
  45619. }
  45620. subj.actual = clone(subj.obj);
  45621. } else {
  45622. var difference = getObjDiff(subj.obj[subj.prop], subj.actual);
  45623. if (difference.added.length || difference.removed.length) {
  45624. if (difference.added.length) {
  45625. for (var j = 0; j < subj.obj.watchers[subj.prop].length; j++) {
  45626. watchMany(subj.obj[subj.prop], difference.added, subj.obj.watchers[subj.prop][j], subj.level - 1, true);
  45627. }
  45628. }
  45629. callWatchers(subj.obj, subj.prop, "differentattr", difference, subj.actual);
  45630. }
  45631. subj.actual = clone(subj.obj[subj.prop]);
  45632. }
  45633. }
  45634. // start dirty check
  45635. var n, value;
  45636. if (dirtyChecklist.length > 0) {
  45637. for (var i = 0; i < dirtyChecklist.length; i++) {
  45638. n = dirtyChecklist[i];
  45639. value = n.object[n.prop];
  45640. if (!compareValues(n.orig, value)) {
  45641. n.orig = clone(value);
  45642. n.callback(value);
  45643. }
  45644. }
  45645. }
  45646. };
  45647. var compareValues = function compareValues(a, b) {
  45648. var i,
  45649. state = true;
  45650. if (a !== b) {
  45651. if (isObject(a)) {
  45652. for (i in a) {
  45653. if (!supportDefineProperty && i === 'watchers') continue;
  45654. if (a[i] !== b[i]) {
  45655. state = false;
  45656. break;
  45657. };
  45658. }
  45659. } else {
  45660. state = false;
  45661. }
  45662. }
  45663. return state;
  45664. };
  45665. var pushToLengthSubjects = function pushToLengthSubjects(obj, prop, watcher, level) {
  45666. var actual;
  45667. if (prop === "$$watchlengthsubjectroot") {
  45668. actual = clone(obj);
  45669. } else {
  45670. actual = clone(obj[prop]);
  45671. }
  45672. lengthsubjects.push({
  45673. obj: obj,
  45674. prop: prop,
  45675. actual: actual,
  45676. watcher: watcher,
  45677. level: level
  45678. });
  45679. };
  45680. var removeFromLengthSubjects = function removeFromLengthSubjects(obj, prop, watcher) {
  45681. for (var i = 0; i < lengthsubjects.length; i++) {
  45682. var subj = lengthsubjects[i];
  45683. if (subj.obj == obj) {
  45684. if (!prop || subj.prop == prop) {
  45685. if (!watcher || subj.watcher == watcher) {
  45686. // if we splice off one item at position i
  45687. // we need to decrement i as the array is one item shorter
  45688. // so when we increment i in the loop statement we
  45689. // will land at the correct index.
  45690. // if it's not decremented, you won't delete all length subjects
  45691. lengthsubjects.splice(i--, 1);
  45692. }
  45693. }
  45694. }
  45695. }
  45696. };
  45697. var removeFromDirtyChecklist = function removeFromDirtyChecklist(obj, prop) {
  45698. var notInUse;
  45699. for (var i = 0; i < dirtyChecklist.length; i++) {
  45700. var n = dirtyChecklist[i];
  45701. var watchers = n.object.watchers;
  45702. notInUse = n.object == obj && (!prop || n.prop == prop) && watchers && (!prop || !watchers[prop] || watchers[prop].length == 0);
  45703. if (notInUse) {
  45704. // we use the same syntax as in removeFromLengthSubjects
  45705. dirtyChecklist.splice(i--, 1);
  45706. }
  45707. }
  45708. };
  45709. setInterval(loop, 50);
  45710. WatchJS.watch = watch;
  45711. WatchJS.unwatch = unwatch;
  45712. WatchJS.callWatchers = callWatchers;
  45713. WatchJS.suspend = suspend; // suspend watchers
  45714. WatchJS.onChange = trackChange; // track changes made to object or it's property and return a single change object
  45715. return WatchJS;
  45716. });
  45717. /***/ }),
  45718. /***/ "./node_modules/node-libs-browser/mock/empty.js":
  45719. /*!******************************************************!*\
  45720. !*** ./node_modules/node-libs-browser/mock/empty.js ***!
  45721. \******************************************************/
  45722. /*! no static exports found */
  45723. /***/ (function(module, exports, __webpack_require__) {
  45724. "use strict";
  45725. /***/ }),
  45726. /***/ "./node_modules/webpack/buildin/module.js":
  45727. /*!***********************************!*\
  45728. !*** (webpack)/buildin/module.js ***!
  45729. \***********************************/
  45730. /*! no static exports found */
  45731. /***/ (function(module, exports, __webpack_require__) {
  45732. "use strict";
  45733. module.exports = function (module) {
  45734. if (!module.webpackPolyfill) {
  45735. module.deprecate = function () {};
  45736. module.paths = [];
  45737. // module.parent = undefined by default
  45738. if (!module.children) module.children = [];
  45739. Object.defineProperty(module, "loaded", {
  45740. enumerable: true,
  45741. get: function get() {
  45742. return module.l;
  45743. }
  45744. });
  45745. Object.defineProperty(module, "id", {
  45746. enumerable: true,
  45747. get: function get() {
  45748. return module.i;
  45749. }
  45750. });
  45751. module.webpackPolyfill = 1;
  45752. }
  45753. return module;
  45754. };
  45755. /***/ })
  45756. /******/ });
  45757. });
  45758. //# sourceMappingURL=ivprog.bundle.js.map