handlebars.js 163 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845
  1. /**!
  2. @license
  3. handlebars v4.1.2
  4. Copyright (C) 2011-2017 by Yehuda Katz
  5. Permission is hereby granted, free of charge, to any person obtaining a copy
  6. of this software and associated documentation files (the "Software"), to deal
  7. in the Software without restriction, including without limitation the rights
  8. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  9. copies of the Software, and to permit persons to whom the Software is
  10. furnished to do so, subject to the following conditions:
  11. The above copyright notice and this permission notice shall be included in
  12. all copies or substantial portions of the Software.
  13. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  14. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  15. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  16. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  17. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  18. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  19. THE SOFTWARE.
  20. */
  21. (function webpackUniversalModuleDefinition(root, factory) {
  22. if(typeof exports === 'object' && typeof module === 'object')
  23. module.exports = factory();
  24. else if(typeof define === 'function' && define.amd)
  25. define([], factory);
  26. else if(typeof exports === 'object')
  27. exports["Handlebars"] = factory();
  28. else
  29. root["Handlebars"] = factory();
  30. })(this, function() {
  31. return /******/ (function(modules) { // webpackBootstrap
  32. /******/ // The module cache
  33. /******/ var installedModules = {};
  34. /******/ // The require function
  35. /******/ function __webpack_require__(moduleId) {
  36. /******/ // Check if module is in cache
  37. /******/ if(installedModules[moduleId])
  38. /******/ return installedModules[moduleId].exports;
  39. /******/ // Create a new module (and put it into the cache)
  40. /******/ var module = installedModules[moduleId] = {
  41. /******/ exports: {},
  42. /******/ id: moduleId,
  43. /******/ loaded: false
  44. /******/ };
  45. /******/ // Execute the module function
  46. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  47. /******/ // Flag the module as loaded
  48. /******/ module.loaded = true;
  49. /******/ // Return the exports of the module
  50. /******/ return module.exports;
  51. /******/ }
  52. /******/ // expose the modules object (__webpack_modules__)
  53. /******/ __webpack_require__.m = modules;
  54. /******/ // expose the module cache
  55. /******/ __webpack_require__.c = installedModules;
  56. /******/ // __webpack_public_path__
  57. /******/ __webpack_require__.p = "";
  58. /******/ // Load entry module and return exports
  59. /******/ return __webpack_require__(0);
  60. /******/ })
  61. /************************************************************************/
  62. /******/ ([
  63. /* 0 */
  64. /***/ (function(module, exports, __webpack_require__) {
  65. 'use strict';
  66. var _interopRequireDefault = __webpack_require__(1)['default'];
  67. exports.__esModule = true;
  68. var _handlebarsRuntime = __webpack_require__(2);
  69. var _handlebarsRuntime2 = _interopRequireDefault(_handlebarsRuntime);
  70. // Compiler imports
  71. var _handlebarsCompilerAst = __webpack_require__(35);
  72. var _handlebarsCompilerAst2 = _interopRequireDefault(_handlebarsCompilerAst);
  73. var _handlebarsCompilerBase = __webpack_require__(36);
  74. var _handlebarsCompilerCompiler = __webpack_require__(41);
  75. var _handlebarsCompilerJavascriptCompiler = __webpack_require__(42);
  76. var _handlebarsCompilerJavascriptCompiler2 = _interopRequireDefault(_handlebarsCompilerJavascriptCompiler);
  77. var _handlebarsCompilerVisitor = __webpack_require__(39);
  78. var _handlebarsCompilerVisitor2 = _interopRequireDefault(_handlebarsCompilerVisitor);
  79. var _handlebarsNoConflict = __webpack_require__(34);
  80. var _handlebarsNoConflict2 = _interopRequireDefault(_handlebarsNoConflict);
  81. var _create = _handlebarsRuntime2['default'].create;
  82. function create() {
  83. var hb = _create();
  84. hb.compile = function (input, options) {
  85. return _handlebarsCompilerCompiler.compile(input, options, hb);
  86. };
  87. hb.precompile = function (input, options) {
  88. return _handlebarsCompilerCompiler.precompile(input, options, hb);
  89. };
  90. hb.AST = _handlebarsCompilerAst2['default'];
  91. hb.Compiler = _handlebarsCompilerCompiler.Compiler;
  92. hb.JavaScriptCompiler = _handlebarsCompilerJavascriptCompiler2['default'];
  93. hb.Parser = _handlebarsCompilerBase.parser;
  94. hb.parse = _handlebarsCompilerBase.parse;
  95. return hb;
  96. }
  97. var inst = create();
  98. inst.create = create;
  99. _handlebarsNoConflict2['default'](inst);
  100. inst.Visitor = _handlebarsCompilerVisitor2['default'];
  101. inst['default'] = inst;
  102. exports['default'] = inst;
  103. module.exports = exports['default'];
  104. /***/ }),
  105. /* 1 */
  106. /***/ (function(module, exports) {
  107. "use strict";
  108. exports["default"] = function (obj) {
  109. return obj && obj.__esModule ? obj : {
  110. "default": obj
  111. };
  112. };
  113. exports.__esModule = true;
  114. /***/ }),
  115. /* 2 */
  116. /***/ (function(module, exports, __webpack_require__) {
  117. 'use strict';
  118. var _interopRequireWildcard = __webpack_require__(3)['default'];
  119. var _interopRequireDefault = __webpack_require__(1)['default'];
  120. exports.__esModule = true;
  121. var _handlebarsBase = __webpack_require__(4);
  122. var base = _interopRequireWildcard(_handlebarsBase);
  123. // Each of these augment the Handlebars object. No need to setup here.
  124. // (This is done to easily share code between commonjs and browse envs)
  125. var _handlebarsSafeString = __webpack_require__(21);
  126. var _handlebarsSafeString2 = _interopRequireDefault(_handlebarsSafeString);
  127. var _handlebarsException = __webpack_require__(6);
  128. var _handlebarsException2 = _interopRequireDefault(_handlebarsException);
  129. var _handlebarsUtils = __webpack_require__(5);
  130. var Utils = _interopRequireWildcard(_handlebarsUtils);
  131. var _handlebarsRuntime = __webpack_require__(22);
  132. var runtime = _interopRequireWildcard(_handlebarsRuntime);
  133. var _handlebarsNoConflict = __webpack_require__(34);
  134. var _handlebarsNoConflict2 = _interopRequireDefault(_handlebarsNoConflict);
  135. // For compatibility and usage outside of module systems, make the Handlebars object a namespace
  136. function create() {
  137. var hb = new base.HandlebarsEnvironment();
  138. Utils.extend(hb, base);
  139. hb.SafeString = _handlebarsSafeString2['default'];
  140. hb.Exception = _handlebarsException2['default'];
  141. hb.Utils = Utils;
  142. hb.escapeExpression = Utils.escapeExpression;
  143. hb.VM = runtime;
  144. hb.template = function (spec) {
  145. return runtime.template(spec, hb);
  146. };
  147. return hb;
  148. }
  149. var inst = create();
  150. inst.create = create;
  151. _handlebarsNoConflict2['default'](inst);
  152. inst['default'] = inst;
  153. exports['default'] = inst;
  154. module.exports = exports['default'];
  155. /***/ }),
  156. /* 3 */
  157. /***/ (function(module, exports) {
  158. "use strict";
  159. exports["default"] = function (obj) {
  160. if (obj && obj.__esModule) {
  161. return obj;
  162. } else {
  163. var newObj = {};
  164. if (obj != null) {
  165. for (var key in obj) {
  166. if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key];
  167. }
  168. }
  169. newObj["default"] = obj;
  170. return newObj;
  171. }
  172. };
  173. exports.__esModule = true;
  174. /***/ }),
  175. /* 4 */
  176. /***/ (function(module, exports, __webpack_require__) {
  177. 'use strict';
  178. var _interopRequireDefault = __webpack_require__(1)['default'];
  179. exports.__esModule = true;
  180. exports.HandlebarsEnvironment = HandlebarsEnvironment;
  181. var _utils = __webpack_require__(5);
  182. var _exception = __webpack_require__(6);
  183. var _exception2 = _interopRequireDefault(_exception);
  184. var _helpers = __webpack_require__(10);
  185. var _decorators = __webpack_require__(18);
  186. var _logger = __webpack_require__(20);
  187. var _logger2 = _interopRequireDefault(_logger);
  188. var VERSION = '4.1.2';
  189. exports.VERSION = VERSION;
  190. var COMPILER_REVISION = 7;
  191. exports.COMPILER_REVISION = COMPILER_REVISION;
  192. var REVISION_CHANGES = {
  193. 1: '<= 1.0.rc.2', // 1.0.rc.2 is actually rev2 but doesn't report it
  194. 2: '== 1.0.0-rc.3',
  195. 3: '== 1.0.0-rc.4',
  196. 4: '== 1.x.x',
  197. 5: '== 2.0.0-alpha.x',
  198. 6: '>= 2.0.0-beta.1',
  199. 7: '>= 4.0.0'
  200. };
  201. exports.REVISION_CHANGES = REVISION_CHANGES;
  202. var objectType = '[object Object]';
  203. function HandlebarsEnvironment(helpers, partials, decorators) {
  204. this.helpers = helpers || {};
  205. this.partials = partials || {};
  206. this.decorators = decorators || {};
  207. _helpers.registerDefaultHelpers(this);
  208. _decorators.registerDefaultDecorators(this);
  209. }
  210. HandlebarsEnvironment.prototype = {
  211. constructor: HandlebarsEnvironment,
  212. logger: _logger2['default'],
  213. log: _logger2['default'].log,
  214. registerHelper: function registerHelper(name, fn) {
  215. if (_utils.toString.call(name) === objectType) {
  216. if (fn) {
  217. throw new _exception2['default']('Arg not supported with multiple helpers');
  218. }
  219. _utils.extend(this.helpers, name);
  220. } else {
  221. this.helpers[name] = fn;
  222. }
  223. },
  224. unregisterHelper: function unregisterHelper(name) {
  225. delete this.helpers[name];
  226. },
  227. registerPartial: function registerPartial(name, partial) {
  228. if (_utils.toString.call(name) === objectType) {
  229. _utils.extend(this.partials, name);
  230. } else {
  231. if (typeof partial === 'undefined') {
  232. throw new _exception2['default']('Attempting to register a partial called "' + name + '" as undefined');
  233. }
  234. this.partials[name] = partial;
  235. }
  236. },
  237. unregisterPartial: function unregisterPartial(name) {
  238. delete this.partials[name];
  239. },
  240. registerDecorator: function registerDecorator(name, fn) {
  241. if (_utils.toString.call(name) === objectType) {
  242. if (fn) {
  243. throw new _exception2['default']('Arg not supported with multiple decorators');
  244. }
  245. _utils.extend(this.decorators, name);
  246. } else {
  247. this.decorators[name] = fn;
  248. }
  249. },
  250. unregisterDecorator: function unregisterDecorator(name) {
  251. delete this.decorators[name];
  252. }
  253. };
  254. var log = _logger2['default'].log;
  255. exports.log = log;
  256. exports.createFrame = _utils.createFrame;
  257. exports.logger = _logger2['default'];
  258. /***/ }),
  259. /* 5 */
  260. /***/ (function(module, exports) {
  261. 'use strict';
  262. exports.__esModule = true;
  263. exports.extend = extend;
  264. exports.indexOf = indexOf;
  265. exports.escapeExpression = escapeExpression;
  266. exports.isEmpty = isEmpty;
  267. exports.createFrame = createFrame;
  268. exports.blockParams = blockParams;
  269. exports.appendContextPath = appendContextPath;
  270. var escape = {
  271. '&': '&amp;',
  272. '<': '&lt;',
  273. '>': '&gt;',
  274. '"': '&quot;',
  275. "'": '&#x27;',
  276. '`': '&#x60;',
  277. '=': '&#x3D;'
  278. };
  279. var badChars = /[&<>"'`=]/g,
  280. possible = /[&<>"'`=]/;
  281. function escapeChar(chr) {
  282. return escape[chr];
  283. }
  284. function extend(obj /* , ...source */) {
  285. for (var i = 1; i < arguments.length; i++) {
  286. for (var key in arguments[i]) {
  287. if (Object.prototype.hasOwnProperty.call(arguments[i], key)) {
  288. obj[key] = arguments[i][key];
  289. }
  290. }
  291. }
  292. return obj;
  293. }
  294. var toString = Object.prototype.toString;
  295. exports.toString = toString;
  296. // Sourced from lodash
  297. // https://github.com/bestiejs/lodash/blob/master/LICENSE.txt
  298. /* eslint-disable func-style */
  299. var isFunction = function isFunction(value) {
  300. return typeof value === 'function';
  301. };
  302. // fallback for older versions of Chrome and Safari
  303. /* istanbul ignore next */
  304. if (isFunction(/x/)) {
  305. exports.isFunction = isFunction = function (value) {
  306. return typeof value === 'function' && toString.call(value) === '[object Function]';
  307. };
  308. }
  309. exports.isFunction = isFunction;
  310. /* eslint-enable func-style */
  311. /* istanbul ignore next */
  312. var isArray = Array.isArray || function (value) {
  313. return value && typeof value === 'object' ? toString.call(value) === '[object Array]' : false;
  314. };
  315. exports.isArray = isArray;
  316. // Older IE versions do not directly support indexOf so we must implement our own, sadly.
  317. function indexOf(array, value) {
  318. for (var i = 0, len = array.length; i < len; i++) {
  319. if (array[i] === value) {
  320. return i;
  321. }
  322. }
  323. return -1;
  324. }
  325. function escapeExpression(string) {
  326. if (typeof string !== 'string') {
  327. // don't escape SafeStrings, since they're already safe
  328. if (string && string.toHTML) {
  329. return string.toHTML();
  330. } else if (string == null) {
  331. return '';
  332. } else if (!string) {
  333. return string + '';
  334. }
  335. // Force a string conversion as this will be done by the append regardless and
  336. // the regex test will do this transparently behind the scenes, causing issues if
  337. // an object's to string has escaped characters in it.
  338. string = '' + string;
  339. }
  340. if (!possible.test(string)) {
  341. return string;
  342. }
  343. return string.replace(badChars, escapeChar);
  344. }
  345. function isEmpty(value) {
  346. if (!value && value !== 0) {
  347. return true;
  348. } else if (isArray(value) && value.length === 0) {
  349. return true;
  350. } else {
  351. return false;
  352. }
  353. }
  354. function createFrame(object) {
  355. var frame = extend({}, object);
  356. frame._parent = object;
  357. return frame;
  358. }
  359. function blockParams(params, ids) {
  360. params.path = ids;
  361. return params;
  362. }
  363. function appendContextPath(contextPath, id) {
  364. return (contextPath ? contextPath + '.' : '') + id;
  365. }
  366. /***/ }),
  367. /* 6 */
  368. /***/ (function(module, exports, __webpack_require__) {
  369. 'use strict';
  370. var _Object$defineProperty = __webpack_require__(7)['default'];
  371. exports.__esModule = true;
  372. var errorProps = ['description', 'fileName', 'lineNumber', 'message', 'name', 'number', 'stack'];
  373. function Exception(message, node) {
  374. var loc = node && node.loc,
  375. line = undefined,
  376. column = undefined;
  377. if (loc) {
  378. line = loc.start.line;
  379. column = loc.start.column;
  380. message += ' - ' + line + ':' + column;
  381. }
  382. var tmp = Error.prototype.constructor.call(this, message);
  383. // Unfortunately errors are not enumerable in Chrome (at least), so `for prop in tmp` doesn't work.
  384. for (var idx = 0; idx < errorProps.length; idx++) {
  385. this[errorProps[idx]] = tmp[errorProps[idx]];
  386. }
  387. /* istanbul ignore else */
  388. if (Error.captureStackTrace) {
  389. Error.captureStackTrace(this, Exception);
  390. }
  391. try {
  392. if (loc) {
  393. this.lineNumber = line;
  394. // Work around issue under safari where we can't directly set the column value
  395. /* istanbul ignore next */
  396. if (_Object$defineProperty) {
  397. Object.defineProperty(this, 'column', {
  398. value: column,
  399. enumerable: true
  400. });
  401. } else {
  402. this.column = column;
  403. }
  404. }
  405. } catch (nop) {
  406. /* Ignore if the browser is very particular */
  407. }
  408. }
  409. Exception.prototype = new Error();
  410. exports['default'] = Exception;
  411. module.exports = exports['default'];
  412. /***/ }),
  413. /* 7 */
  414. /***/ (function(module, exports, __webpack_require__) {
  415. module.exports = { "default": __webpack_require__(8), __esModule: true };
  416. /***/ }),
  417. /* 8 */
  418. /***/ (function(module, exports, __webpack_require__) {
  419. var $ = __webpack_require__(9);
  420. module.exports = function defineProperty(it, key, desc){
  421. return $.setDesc(it, key, desc);
  422. };
  423. /***/ }),
  424. /* 9 */
  425. /***/ (function(module, exports) {
  426. var $Object = Object;
  427. module.exports = {
  428. create: $Object.create,
  429. getProto: $Object.getPrototypeOf,
  430. isEnum: {}.propertyIsEnumerable,
  431. getDesc: $Object.getOwnPropertyDescriptor,
  432. setDesc: $Object.defineProperty,
  433. setDescs: $Object.defineProperties,
  434. getKeys: $Object.keys,
  435. getNames: $Object.getOwnPropertyNames,
  436. getSymbols: $Object.getOwnPropertySymbols,
  437. each: [].forEach
  438. };
  439. /***/ }),
  440. /* 10 */
  441. /***/ (function(module, exports, __webpack_require__) {
  442. 'use strict';
  443. var _interopRequireDefault = __webpack_require__(1)['default'];
  444. exports.__esModule = true;
  445. exports.registerDefaultHelpers = registerDefaultHelpers;
  446. var _helpersBlockHelperMissing = __webpack_require__(11);
  447. var _helpersBlockHelperMissing2 = _interopRequireDefault(_helpersBlockHelperMissing);
  448. var _helpersEach = __webpack_require__(12);
  449. var _helpersEach2 = _interopRequireDefault(_helpersEach);
  450. var _helpersHelperMissing = __webpack_require__(13);
  451. var _helpersHelperMissing2 = _interopRequireDefault(_helpersHelperMissing);
  452. var _helpersIf = __webpack_require__(14);
  453. var _helpersIf2 = _interopRequireDefault(_helpersIf);
  454. var _helpersLog = __webpack_require__(15);
  455. var _helpersLog2 = _interopRequireDefault(_helpersLog);
  456. var _helpersLookup = __webpack_require__(16);
  457. var _helpersLookup2 = _interopRequireDefault(_helpersLookup);
  458. var _helpersWith = __webpack_require__(17);
  459. var _helpersWith2 = _interopRequireDefault(_helpersWith);
  460. function registerDefaultHelpers(instance) {
  461. _helpersBlockHelperMissing2['default'](instance);
  462. _helpersEach2['default'](instance);
  463. _helpersHelperMissing2['default'](instance);
  464. _helpersIf2['default'](instance);
  465. _helpersLog2['default'](instance);
  466. _helpersLookup2['default'](instance);
  467. _helpersWith2['default'](instance);
  468. }
  469. /***/ }),
  470. /* 11 */
  471. /***/ (function(module, exports, __webpack_require__) {
  472. 'use strict';
  473. exports.__esModule = true;
  474. var _utils = __webpack_require__(5);
  475. exports['default'] = function (instance) {
  476. instance.registerHelper('blockHelperMissing', function (context, options) {
  477. var inverse = options.inverse,
  478. fn = options.fn;
  479. if (context === true) {
  480. return fn(this);
  481. } else if (context === false || context == null) {
  482. return inverse(this);
  483. } else if (_utils.isArray(context)) {
  484. if (context.length > 0) {
  485. if (options.ids) {
  486. options.ids = [options.name];
  487. }
  488. return instance.helpers.each(context, options);
  489. } else {
  490. return inverse(this);
  491. }
  492. } else {
  493. if (options.data && options.ids) {
  494. var data = _utils.createFrame(options.data);
  495. data.contextPath = _utils.appendContextPath(options.data.contextPath, options.name);
  496. options = { data: data };
  497. }
  498. return fn(context, options);
  499. }
  500. });
  501. };
  502. module.exports = exports['default'];
  503. /***/ }),
  504. /* 12 */
  505. /***/ (function(module, exports, __webpack_require__) {
  506. 'use strict';
  507. var _interopRequireDefault = __webpack_require__(1)['default'];
  508. exports.__esModule = true;
  509. var _utils = __webpack_require__(5);
  510. var _exception = __webpack_require__(6);
  511. var _exception2 = _interopRequireDefault(_exception);
  512. exports['default'] = function (instance) {
  513. instance.registerHelper('each', function (context, options) {
  514. if (!options) {
  515. throw new _exception2['default']('Must pass iterator to #each');
  516. }
  517. var fn = options.fn,
  518. inverse = options.inverse,
  519. i = 0,
  520. ret = '',
  521. data = undefined,
  522. contextPath = undefined;
  523. if (options.data && options.ids) {
  524. contextPath = _utils.appendContextPath(options.data.contextPath, options.ids[0]) + '.';
  525. }
  526. if (_utils.isFunction(context)) {
  527. context = context.call(this);
  528. }
  529. if (options.data) {
  530. data = _utils.createFrame(options.data);
  531. }
  532. function execIteration(field, index, last) {
  533. if (data) {
  534. data.key = field;
  535. data.index = index;
  536. data.first = index === 0;
  537. data.last = !!last;
  538. if (contextPath) {
  539. data.contextPath = contextPath + field;
  540. }
  541. }
  542. ret = ret + fn(context[field], {
  543. data: data,
  544. blockParams: _utils.blockParams([context[field], field], [contextPath + field, null])
  545. });
  546. }
  547. if (context && typeof context === 'object') {
  548. if (_utils.isArray(context)) {
  549. for (var j = context.length; i < j; i++) {
  550. if (i in context) {
  551. execIteration(i, i, i === context.length - 1);
  552. }
  553. }
  554. } else {
  555. var priorKey = undefined;
  556. for (var key in context) {
  557. if (context.hasOwnProperty(key)) {
  558. // We're running the iterations one step out of sync so we can detect
  559. // the last iteration without have to scan the object twice and create
  560. // an itermediate keys array.
  561. if (priorKey !== undefined) {
  562. execIteration(priorKey, i - 1);
  563. }
  564. priorKey = key;
  565. i++;
  566. }
  567. }
  568. if (priorKey !== undefined) {
  569. execIteration(priorKey, i - 1, true);
  570. }
  571. }
  572. }
  573. if (i === 0) {
  574. ret = inverse(this);
  575. }
  576. return ret;
  577. });
  578. };
  579. module.exports = exports['default'];
  580. /***/ }),
  581. /* 13 */
  582. /***/ (function(module, exports, __webpack_require__) {
  583. 'use strict';
  584. var _interopRequireDefault = __webpack_require__(1)['default'];
  585. exports.__esModule = true;
  586. var _exception = __webpack_require__(6);
  587. var _exception2 = _interopRequireDefault(_exception);
  588. exports['default'] = function (instance) {
  589. instance.registerHelper('helperMissing', function () /* [args, ]options */{
  590. if (arguments.length === 1) {
  591. // A missing field in a {{foo}} construct.
  592. return undefined;
  593. } else {
  594. // Someone is actually trying to call something, blow up.
  595. throw new _exception2['default']('Missing helper: "' + arguments[arguments.length - 1].name + '"');
  596. }
  597. });
  598. };
  599. module.exports = exports['default'];
  600. /***/ }),
  601. /* 14 */
  602. /***/ (function(module, exports, __webpack_require__) {
  603. 'use strict';
  604. exports.__esModule = true;
  605. var _utils = __webpack_require__(5);
  606. exports['default'] = function (instance) {
  607. instance.registerHelper('if', function (conditional, options) {
  608. if (_utils.isFunction(conditional)) {
  609. conditional = conditional.call(this);
  610. }
  611. // Default behavior is to render the positive path if the value is truthy and not empty.
  612. // The `includeZero` option may be set to treat the condtional as purely not empty based on the
  613. // behavior of isEmpty. Effectively this determines if 0 is handled by the positive path or negative.
  614. if (!options.hash.includeZero && !conditional || _utils.isEmpty(conditional)) {
  615. return options.inverse(this);
  616. } else {
  617. return options.fn(this);
  618. }
  619. });
  620. instance.registerHelper('unless', function (conditional, options) {
  621. return instance.helpers['if'].call(this, conditional, { fn: options.inverse, inverse: options.fn, hash: options.hash });
  622. });
  623. };
  624. module.exports = exports['default'];
  625. /***/ }),
  626. /* 15 */
  627. /***/ (function(module, exports) {
  628. 'use strict';
  629. exports.__esModule = true;
  630. exports['default'] = function (instance) {
  631. instance.registerHelper('log', function () /* message, options */{
  632. var args = [undefined],
  633. options = arguments[arguments.length - 1];
  634. for (var i = 0; i < arguments.length - 1; i++) {
  635. args.push(arguments[i]);
  636. }
  637. var level = 1;
  638. if (options.hash.level != null) {
  639. level = options.hash.level;
  640. } else if (options.data && options.data.level != null) {
  641. level = options.data.level;
  642. }
  643. args[0] = level;
  644. instance.log.apply(instance, args);
  645. });
  646. };
  647. module.exports = exports['default'];
  648. /***/ }),
  649. /* 16 */
  650. /***/ (function(module, exports) {
  651. 'use strict';
  652. exports.__esModule = true;
  653. exports['default'] = function (instance) {
  654. instance.registerHelper('lookup', function (obj, field) {
  655. if (!obj) {
  656. return obj;
  657. }
  658. if (field === 'constructor' && !obj.propertyIsEnumerable(field)) {
  659. return undefined;
  660. }
  661. return obj[field];
  662. });
  663. };
  664. module.exports = exports['default'];
  665. /***/ }),
  666. /* 17 */
  667. /***/ (function(module, exports, __webpack_require__) {
  668. 'use strict';
  669. exports.__esModule = true;
  670. var _utils = __webpack_require__(5);
  671. exports['default'] = function (instance) {
  672. instance.registerHelper('with', function (context, options) {
  673. if (_utils.isFunction(context)) {
  674. context = context.call(this);
  675. }
  676. var fn = options.fn;
  677. if (!_utils.isEmpty(context)) {
  678. var data = options.data;
  679. if (options.data && options.ids) {
  680. data = _utils.createFrame(options.data);
  681. data.contextPath = _utils.appendContextPath(options.data.contextPath, options.ids[0]);
  682. }
  683. return fn(context, {
  684. data: data,
  685. blockParams: _utils.blockParams([context], [data && data.contextPath])
  686. });
  687. } else {
  688. return options.inverse(this);
  689. }
  690. });
  691. };
  692. module.exports = exports['default'];
  693. /***/ }),
  694. /* 18 */
  695. /***/ (function(module, exports, __webpack_require__) {
  696. 'use strict';
  697. var _interopRequireDefault = __webpack_require__(1)['default'];
  698. exports.__esModule = true;
  699. exports.registerDefaultDecorators = registerDefaultDecorators;
  700. var _decoratorsInline = __webpack_require__(19);
  701. var _decoratorsInline2 = _interopRequireDefault(_decoratorsInline);
  702. function registerDefaultDecorators(instance) {
  703. _decoratorsInline2['default'](instance);
  704. }
  705. /***/ }),
  706. /* 19 */
  707. /***/ (function(module, exports, __webpack_require__) {
  708. 'use strict';
  709. exports.__esModule = true;
  710. var _utils = __webpack_require__(5);
  711. exports['default'] = function (instance) {
  712. instance.registerDecorator('inline', function (fn, props, container, options) {
  713. var ret = fn;
  714. if (!props.partials) {
  715. props.partials = {};
  716. ret = function (context, options) {
  717. // Create a new partials stack frame prior to exec.
  718. var original = container.partials;
  719. container.partials = _utils.extend({}, original, props.partials);
  720. var ret = fn(context, options);
  721. container.partials = original;
  722. return ret;
  723. };
  724. }
  725. props.partials[options.args[0]] = options.fn;
  726. return ret;
  727. });
  728. };
  729. module.exports = exports['default'];
  730. /***/ }),
  731. /* 20 */
  732. /***/ (function(module, exports, __webpack_require__) {
  733. 'use strict';
  734. exports.__esModule = true;
  735. var _utils = __webpack_require__(5);
  736. var logger = {
  737. methodMap: ['debug', 'info', 'warn', 'error'],
  738. level: 'info',
  739. // Maps a given level value to the `methodMap` indexes above.
  740. lookupLevel: function lookupLevel(level) {
  741. if (typeof level === 'string') {
  742. var levelMap = _utils.indexOf(logger.methodMap, level.toLowerCase());
  743. if (levelMap >= 0) {
  744. level = levelMap;
  745. } else {
  746. level = parseInt(level, 10);
  747. }
  748. }
  749. return level;
  750. },
  751. // Can be overridden in the host environment
  752. log: function log(level) {
  753. level = logger.lookupLevel(level);
  754. if (typeof console !== 'undefined' && logger.lookupLevel(logger.level) <= level) {
  755. var method = logger.methodMap[level];
  756. if (!console[method]) {
  757. // eslint-disable-line no-console
  758. method = 'log';
  759. }
  760. for (var _len = arguments.length, message = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
  761. message[_key - 1] = arguments[_key];
  762. }
  763. console[method].apply(console, message); // eslint-disable-line no-console
  764. }
  765. }
  766. };
  767. exports['default'] = logger;
  768. module.exports = exports['default'];
  769. /***/ }),
  770. /* 21 */
  771. /***/ (function(module, exports) {
  772. // Build out our basic SafeString type
  773. 'use strict';
  774. exports.__esModule = true;
  775. function SafeString(string) {
  776. this.string = string;
  777. }
  778. SafeString.prototype.toString = SafeString.prototype.toHTML = function () {
  779. return '' + this.string;
  780. };
  781. exports['default'] = SafeString;
  782. module.exports = exports['default'];
  783. /***/ }),
  784. /* 22 */
  785. /***/ (function(module, exports, __webpack_require__) {
  786. 'use strict';
  787. var _Object$seal = __webpack_require__(23)['default'];
  788. var _interopRequireWildcard = __webpack_require__(3)['default'];
  789. var _interopRequireDefault = __webpack_require__(1)['default'];
  790. exports.__esModule = true;
  791. exports.checkRevision = checkRevision;
  792. exports.template = template;
  793. exports.wrapProgram = wrapProgram;
  794. exports.resolvePartial = resolvePartial;
  795. exports.invokePartial = invokePartial;
  796. exports.noop = noop;
  797. var _utils = __webpack_require__(5);
  798. var Utils = _interopRequireWildcard(_utils);
  799. var _exception = __webpack_require__(6);
  800. var _exception2 = _interopRequireDefault(_exception);
  801. var _base = __webpack_require__(4);
  802. function checkRevision(compilerInfo) {
  803. var compilerRevision = compilerInfo && compilerInfo[0] || 1,
  804. currentRevision = _base.COMPILER_REVISION;
  805. if (compilerRevision !== currentRevision) {
  806. if (compilerRevision < currentRevision) {
  807. var runtimeVersions = _base.REVISION_CHANGES[currentRevision],
  808. compilerVersions = _base.REVISION_CHANGES[compilerRevision];
  809. throw new _exception2['default']('Template was precompiled with an older version of Handlebars than the current runtime. ' + 'Please update your precompiler to a newer version (' + runtimeVersions + ') or downgrade your runtime to an older version (' + compilerVersions + ').');
  810. } else {
  811. // Use the embedded version info since the runtime doesn't know about this revision yet
  812. throw new _exception2['default']('Template was precompiled with a newer version of Handlebars than the current runtime. ' + 'Please update your runtime to a newer version (' + compilerInfo[1] + ').');
  813. }
  814. }
  815. }
  816. function template(templateSpec, env) {
  817. /* istanbul ignore next */
  818. if (!env) {
  819. throw new _exception2['default']('No environment passed to template');
  820. }
  821. if (!templateSpec || !templateSpec.main) {
  822. throw new _exception2['default']('Unknown template object: ' + typeof templateSpec);
  823. }
  824. templateSpec.main.decorator = templateSpec.main_d;
  825. // Note: Using env.VM references rather than local var references throughout this section to allow
  826. // for external users to override these as psuedo-supported APIs.
  827. env.VM.checkRevision(templateSpec.compiler);
  828. function invokePartialWrapper(partial, context, options) {
  829. if (options.hash) {
  830. context = Utils.extend({}, context, options.hash);
  831. if (options.ids) {
  832. options.ids[0] = true;
  833. }
  834. }
  835. partial = env.VM.resolvePartial.call(this, partial, context, options);
  836. var result = env.VM.invokePartial.call(this, partial, context, options);
  837. if (result == null && env.compile) {
  838. options.partials[options.name] = env.compile(partial, templateSpec.compilerOptions, env);
  839. result = options.partials[options.name](context, options);
  840. }
  841. if (result != null) {
  842. if (options.indent) {
  843. var lines = result.split('\n');
  844. for (var i = 0, l = lines.length; i < l; i++) {
  845. if (!lines[i] && i + 1 === l) {
  846. break;
  847. }
  848. lines[i] = options.indent + lines[i];
  849. }
  850. result = lines.join('\n');
  851. }
  852. return result;
  853. } else {
  854. throw new _exception2['default']('The partial ' + options.name + ' could not be compiled when running in runtime-only mode');
  855. }
  856. }
  857. // Just add water
  858. var container = {
  859. strict: function strict(obj, name) {
  860. if (!(name in obj)) {
  861. throw new _exception2['default']('"' + name + '" not defined in ' + obj);
  862. }
  863. return obj[name];
  864. },
  865. lookup: function lookup(depths, name) {
  866. var len = depths.length;
  867. for (var i = 0; i < len; i++) {
  868. if (depths[i] && depths[i][name] != null) {
  869. return depths[i][name];
  870. }
  871. }
  872. },
  873. lambda: function lambda(current, context) {
  874. return typeof current === 'function' ? current.call(context) : current;
  875. },
  876. escapeExpression: Utils.escapeExpression,
  877. invokePartial: invokePartialWrapper,
  878. fn: function fn(i) {
  879. var ret = templateSpec[i];
  880. ret.decorator = templateSpec[i + '_d'];
  881. return ret;
  882. },
  883. programs: [],
  884. program: function program(i, data, declaredBlockParams, blockParams, depths) {
  885. var programWrapper = this.programs[i],
  886. fn = this.fn(i);
  887. if (data || depths || blockParams || declaredBlockParams) {
  888. programWrapper = wrapProgram(this, i, fn, data, declaredBlockParams, blockParams, depths);
  889. } else if (!programWrapper) {
  890. programWrapper = this.programs[i] = wrapProgram(this, i, fn);
  891. }
  892. return programWrapper;
  893. },
  894. data: function data(value, depth) {
  895. while (value && depth--) {
  896. value = value._parent;
  897. }
  898. return value;
  899. },
  900. merge: function merge(param, common) {
  901. var obj = param || common;
  902. if (param && common && param !== common) {
  903. obj = Utils.extend({}, common, param);
  904. }
  905. return obj;
  906. },
  907. // An empty object to use as replacement for null-contexts
  908. nullContext: _Object$seal({}),
  909. noop: env.VM.noop,
  910. compilerInfo: templateSpec.compiler
  911. };
  912. function ret(context) {
  913. var options = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];
  914. var data = options.data;
  915. ret._setup(options);
  916. if (!options.partial && templateSpec.useData) {
  917. data = initData(context, data);
  918. }
  919. var depths = undefined,
  920. blockParams = templateSpec.useBlockParams ? [] : undefined;
  921. if (templateSpec.useDepths) {
  922. if (options.depths) {
  923. depths = context != options.depths[0] ? [context].concat(options.depths) : options.depths;
  924. } else {
  925. depths = [context];
  926. }
  927. }
  928. function main(context /*, options*/) {
  929. return '' + templateSpec.main(container, context, container.helpers, container.partials, data, blockParams, depths);
  930. }
  931. main = executeDecorators(templateSpec.main, main, container, options.depths || [], data, blockParams);
  932. return main(context, options);
  933. }
  934. ret.isTop = true;
  935. ret._setup = function (options) {
  936. if (!options.partial) {
  937. container.helpers = container.merge(options.helpers, env.helpers);
  938. if (templateSpec.usePartial) {
  939. container.partials = container.merge(options.partials, env.partials);
  940. }
  941. if (templateSpec.usePartial || templateSpec.useDecorators) {
  942. container.decorators = container.merge(options.decorators, env.decorators);
  943. }
  944. } else {
  945. container.helpers = options.helpers;
  946. container.partials = options.partials;
  947. container.decorators = options.decorators;
  948. }
  949. };
  950. ret._child = function (i, data, blockParams, depths) {
  951. if (templateSpec.useBlockParams && !blockParams) {
  952. throw new _exception2['default']('must pass block params');
  953. }
  954. if (templateSpec.useDepths && !depths) {
  955. throw new _exception2['default']('must pass parent depths');
  956. }
  957. return wrapProgram(container, i, templateSpec[i], data, 0, blockParams, depths);
  958. };
  959. return ret;
  960. }
  961. function wrapProgram(container, i, fn, data, declaredBlockParams, blockParams, depths) {
  962. function prog(context) {
  963. var options = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];
  964. var currentDepths = depths;
  965. if (depths && context != depths[0] && !(context === container.nullContext && depths[0] === null)) {
  966. currentDepths = [context].concat(depths);
  967. }
  968. return fn(container, context, container.helpers, container.partials, options.data || data, blockParams && [options.blockParams].concat(blockParams), currentDepths);
  969. }
  970. prog = executeDecorators(fn, prog, container, depths, data, blockParams);
  971. prog.program = i;
  972. prog.depth = depths ? depths.length : 0;
  973. prog.blockParams = declaredBlockParams || 0;
  974. return prog;
  975. }
  976. function resolvePartial(partial, context, options) {
  977. if (!partial) {
  978. if (options.name === '@partial-block') {
  979. partial = options.data['partial-block'];
  980. } else {
  981. partial = options.partials[options.name];
  982. }
  983. } else if (!partial.call && !options.name) {
  984. // This is a dynamic partial that returned a string
  985. options.name = partial;
  986. partial = options.partials[partial];
  987. }
  988. return partial;
  989. }
  990. function invokePartial(partial, context, options) {
  991. // Use the current closure context to save the partial-block if this partial
  992. var currentPartialBlock = options.data && options.data['partial-block'];
  993. options.partial = true;
  994. if (options.ids) {
  995. options.data.contextPath = options.ids[0] || options.data.contextPath;
  996. }
  997. var partialBlock = undefined;
  998. if (options.fn && options.fn !== noop) {
  999. (function () {
  1000. options.data = _base.createFrame(options.data);
  1001. // Wrapper function to get access to currentPartialBlock from the closure
  1002. var fn = options.fn;
  1003. partialBlock = options.data['partial-block'] = function partialBlockWrapper(context) {
  1004. var options = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];
  1005. // Restore the partial-block from the closure for the execution of the block
  1006. // i.e. the part inside the block of the partial call.
  1007. options.data = _base.createFrame(options.data);
  1008. options.data['partial-block'] = currentPartialBlock;
  1009. return fn(context, options);
  1010. };
  1011. if (fn.partials) {
  1012. options.partials = Utils.extend({}, options.partials, fn.partials);
  1013. }
  1014. })();
  1015. }
  1016. if (partial === undefined && partialBlock) {
  1017. partial = partialBlock;
  1018. }
  1019. if (partial === undefined) {
  1020. throw new _exception2['default']('The partial ' + options.name + ' could not be found');
  1021. } else if (partial instanceof Function) {
  1022. return partial(context, options);
  1023. }
  1024. }
  1025. function noop() {
  1026. return '';
  1027. }
  1028. function initData(context, data) {
  1029. if (!data || !('root' in data)) {
  1030. data = data ? _base.createFrame(data) : {};
  1031. data.root = context;
  1032. }
  1033. return data;
  1034. }
  1035. function executeDecorators(fn, prog, container, depths, data, blockParams) {
  1036. if (fn.decorator) {
  1037. var props = {};
  1038. prog = fn.decorator(prog, props, container, depths && depths[0], data, blockParams, depths);
  1039. Utils.extend(prog, props);
  1040. }
  1041. return prog;
  1042. }
  1043. /***/ }),
  1044. /* 23 */
  1045. /***/ (function(module, exports, __webpack_require__) {
  1046. module.exports = { "default": __webpack_require__(24), __esModule: true };
  1047. /***/ }),
  1048. /* 24 */
  1049. /***/ (function(module, exports, __webpack_require__) {
  1050. __webpack_require__(25);
  1051. module.exports = __webpack_require__(30).Object.seal;
  1052. /***/ }),
  1053. /* 25 */
  1054. /***/ (function(module, exports, __webpack_require__) {
  1055. // 19.1.2.17 Object.seal(O)
  1056. var isObject = __webpack_require__(26);
  1057. __webpack_require__(27)('seal', function($seal){
  1058. return function seal(it){
  1059. return $seal && isObject(it) ? $seal(it) : it;
  1060. };
  1061. });
  1062. /***/ }),
  1063. /* 26 */
  1064. /***/ (function(module, exports) {
  1065. module.exports = function(it){
  1066. return typeof it === 'object' ? it !== null : typeof it === 'function';
  1067. };
  1068. /***/ }),
  1069. /* 27 */
  1070. /***/ (function(module, exports, __webpack_require__) {
  1071. // most Object methods by ES6 should accept primitives
  1072. var $export = __webpack_require__(28)
  1073. , core = __webpack_require__(30)
  1074. , fails = __webpack_require__(33);
  1075. module.exports = function(KEY, exec){
  1076. var fn = (core.Object || {})[KEY] || Object[KEY]
  1077. , exp = {};
  1078. exp[KEY] = exec(fn);
  1079. $export($export.S + $export.F * fails(function(){ fn(1); }), 'Object', exp);
  1080. };
  1081. /***/ }),
  1082. /* 28 */
  1083. /***/ (function(module, exports, __webpack_require__) {
  1084. var global = __webpack_require__(29)
  1085. , core = __webpack_require__(30)
  1086. , ctx = __webpack_require__(31)
  1087. , PROTOTYPE = 'prototype';
  1088. var $export = function(type, name, source){
  1089. var IS_FORCED = type & $export.F
  1090. , IS_GLOBAL = type & $export.G
  1091. , IS_STATIC = type & $export.S
  1092. , IS_PROTO = type & $export.P
  1093. , IS_BIND = type & $export.B
  1094. , IS_WRAP = type & $export.W
  1095. , exports = IS_GLOBAL ? core : core[name] || (core[name] = {})
  1096. , target = IS_GLOBAL ? global : IS_STATIC ? global[name] : (global[name] || {})[PROTOTYPE]
  1097. , key, own, out;
  1098. if(IS_GLOBAL)source = name;
  1099. for(key in source){
  1100. // contains in native
  1101. own = !IS_FORCED && target && key in target;
  1102. if(own && key in exports)continue;
  1103. // export native or passed
  1104. out = own ? target[key] : source[key];
  1105. // prevent global pollution for namespaces
  1106. exports[key] = IS_GLOBAL && typeof target[key] != 'function' ? source[key]
  1107. // bind timers to global for call from export context
  1108. : IS_BIND && own ? ctx(out, global)
  1109. // wrap global constructors for prevent change them in library
  1110. : IS_WRAP && target[key] == out ? (function(C){
  1111. var F = function(param){
  1112. return this instanceof C ? new C(param) : C(param);
  1113. };
  1114. F[PROTOTYPE] = C[PROTOTYPE];
  1115. return F;
  1116. // make static versions for prototype methods
  1117. })(out) : IS_PROTO && typeof out == 'function' ? ctx(Function.call, out) : out;
  1118. if(IS_PROTO)(exports[PROTOTYPE] || (exports[PROTOTYPE] = {}))[key] = out;
  1119. }
  1120. };
  1121. // type bitmap
  1122. $export.F = 1; // forced
  1123. $export.G = 2; // global
  1124. $export.S = 4; // static
  1125. $export.P = 8; // proto
  1126. $export.B = 16; // bind
  1127. $export.W = 32; // wrap
  1128. module.exports = $export;
  1129. /***/ }),
  1130. /* 29 */
  1131. /***/ (function(module, exports) {
  1132. // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
  1133. var global = module.exports = typeof window != 'undefined' && window.Math == Math
  1134. ? window : typeof self != 'undefined' && self.Math == Math ? self : Function('return this')();
  1135. if(typeof __g == 'number')__g = global; // eslint-disable-line no-undef
  1136. /***/ }),
  1137. /* 30 */
  1138. /***/ (function(module, exports) {
  1139. var core = module.exports = {version: '1.2.6'};
  1140. if(typeof __e == 'number')__e = core; // eslint-disable-line no-undef
  1141. /***/ }),
  1142. /* 31 */
  1143. /***/ (function(module, exports, __webpack_require__) {
  1144. // optional / simple context binding
  1145. var aFunction = __webpack_require__(32);
  1146. module.exports = function(fn, that, length){
  1147. aFunction(fn);
  1148. if(that === undefined)return fn;
  1149. switch(length){
  1150. case 1: return function(a){
  1151. return fn.call(that, a);
  1152. };
  1153. case 2: return function(a, b){
  1154. return fn.call(that, a, b);
  1155. };
  1156. case 3: return function(a, b, c){
  1157. return fn.call(that, a, b, c);
  1158. };
  1159. }
  1160. return function(/* ...args */){
  1161. return fn.apply(that, arguments);
  1162. };
  1163. };
  1164. /***/ }),
  1165. /* 32 */
  1166. /***/ (function(module, exports) {
  1167. module.exports = function(it){
  1168. if(typeof it != 'function')throw TypeError(it + ' is not a function!');
  1169. return it;
  1170. };
  1171. /***/ }),
  1172. /* 33 */
  1173. /***/ (function(module, exports) {
  1174. module.exports = function(exec){
  1175. try {
  1176. return !!exec();
  1177. } catch(e){
  1178. return true;
  1179. }
  1180. };
  1181. /***/ }),
  1182. /* 34 */
  1183. /***/ (function(module, exports) {
  1184. /* WEBPACK VAR INJECTION */(function(global) {/* global window */
  1185. 'use strict';
  1186. exports.__esModule = true;
  1187. exports['default'] = function (Handlebars) {
  1188. /* istanbul ignore next */
  1189. var root = typeof global !== 'undefined' ? global : window,
  1190. $Handlebars = root.Handlebars;
  1191. /* istanbul ignore next */
  1192. Handlebars.noConflict = function () {
  1193. if (root.Handlebars === Handlebars) {
  1194. root.Handlebars = $Handlebars;
  1195. }
  1196. return Handlebars;
  1197. };
  1198. };
  1199. module.exports = exports['default'];
  1200. /* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }())))
  1201. /***/ }),
  1202. /* 35 */
  1203. /***/ (function(module, exports) {
  1204. 'use strict';
  1205. exports.__esModule = true;
  1206. var AST = {
  1207. // Public API used to evaluate derived attributes regarding AST nodes
  1208. helpers: {
  1209. // a mustache is definitely a helper if:
  1210. // * it is an eligible helper, and
  1211. // * it has at least one parameter or hash segment
  1212. helperExpression: function helperExpression(node) {
  1213. return node.type === 'SubExpression' || (node.type === 'MustacheStatement' || node.type === 'BlockStatement') && !!(node.params && node.params.length || node.hash);
  1214. },
  1215. scopedId: function scopedId(path) {
  1216. return (/^\.|this\b/.test(path.original)
  1217. );
  1218. },
  1219. // an ID is simple if it only has one part, and that part is not
  1220. // `..` or `this`.
  1221. simpleId: function simpleId(path) {
  1222. return path.parts.length === 1 && !AST.helpers.scopedId(path) && !path.depth;
  1223. }
  1224. }
  1225. };
  1226. // Must be exported as an object rather than the root of the module as the jison lexer
  1227. // must modify the object to operate properly.
  1228. exports['default'] = AST;
  1229. module.exports = exports['default'];
  1230. /***/ }),
  1231. /* 36 */
  1232. /***/ (function(module, exports, __webpack_require__) {
  1233. 'use strict';
  1234. var _interopRequireDefault = __webpack_require__(1)['default'];
  1235. var _interopRequireWildcard = __webpack_require__(3)['default'];
  1236. exports.__esModule = true;
  1237. exports.parse = parse;
  1238. var _parser = __webpack_require__(37);
  1239. var _parser2 = _interopRequireDefault(_parser);
  1240. var _whitespaceControl = __webpack_require__(38);
  1241. var _whitespaceControl2 = _interopRequireDefault(_whitespaceControl);
  1242. var _helpers = __webpack_require__(40);
  1243. var Helpers = _interopRequireWildcard(_helpers);
  1244. var _utils = __webpack_require__(5);
  1245. exports.parser = _parser2['default'];
  1246. var yy = {};
  1247. _utils.extend(yy, Helpers);
  1248. function parse(input, options) {
  1249. // Just return if an already-compiled AST was passed in.
  1250. if (input.type === 'Program') {
  1251. return input;
  1252. }
  1253. _parser2['default'].yy = yy;
  1254. // Altering the shared object here, but this is ok as parser is a sync operation
  1255. yy.locInfo = function (locInfo) {
  1256. return new yy.SourceLocation(options && options.srcName, locInfo);
  1257. };
  1258. var strip = new _whitespaceControl2['default'](options);
  1259. return strip.accept(_parser2['default'].parse(input));
  1260. }
  1261. /***/ }),
  1262. /* 37 */
  1263. /***/ (function(module, exports) {
  1264. // File ignored in coverage tests via setting in .istanbul.yml
  1265. /* Jison generated parser */
  1266. "use strict";
  1267. exports.__esModule = true;
  1268. var handlebars = (function () {
  1269. var parser = { trace: function trace() {},
  1270. yy: {},
  1271. symbols_: { "error": 2, "root": 3, "program": 4, "EOF": 5, "program_repetition0": 6, "statement": 7, "mustache": 8, "block": 9, "rawBlock": 10, "partial": 11, "partialBlock": 12, "content": 13, "COMMENT": 14, "CONTENT": 15, "openRawBlock": 16, "rawBlock_repetition_plus0": 17, "END_RAW_BLOCK": 18, "OPEN_RAW_BLOCK": 19, "helperName": 20, "openRawBlock_repetition0": 21, "openRawBlock_option0": 22, "CLOSE_RAW_BLOCK": 23, "openBlock": 24, "block_option0": 25, "closeBlock": 26, "openInverse": 27, "block_option1": 28, "OPEN_BLOCK": 29, "openBlock_repetition0": 30, "openBlock_option0": 31, "openBlock_option1": 32, "CLOSE": 33, "OPEN_INVERSE": 34, "openInverse_repetition0": 35, "openInverse_option0": 36, "openInverse_option1": 37, "openInverseChain": 38, "OPEN_INVERSE_CHAIN": 39, "openInverseChain_repetition0": 40, "openInverseChain_option0": 41, "openInverseChain_option1": 42, "inverseAndProgram": 43, "INVERSE": 44, "inverseChain": 45, "inverseChain_option0": 46, "OPEN_ENDBLOCK": 47, "OPEN": 48, "mustache_repetition0": 49, "mustache_option0": 50, "OPEN_UNESCAPED": 51, "mustache_repetition1": 52, "mustache_option1": 53, "CLOSE_UNESCAPED": 54, "OPEN_PARTIAL": 55, "partialName": 56, "partial_repetition0": 57, "partial_option0": 58, "openPartialBlock": 59, "OPEN_PARTIAL_BLOCK": 60, "openPartialBlock_repetition0": 61, "openPartialBlock_option0": 62, "param": 63, "sexpr": 64, "OPEN_SEXPR": 65, "sexpr_repetition0": 66, "sexpr_option0": 67, "CLOSE_SEXPR": 68, "hash": 69, "hash_repetition_plus0": 70, "hashSegment": 71, "ID": 72, "EQUALS": 73, "blockParams": 74, "OPEN_BLOCK_PARAMS": 75, "blockParams_repetition_plus0": 76, "CLOSE_BLOCK_PARAMS": 77, "path": 78, "dataName": 79, "STRING": 80, "NUMBER": 81, "BOOLEAN": 82, "UNDEFINED": 83, "NULL": 84, "DATA": 85, "pathSegments": 86, "SEP": 87, "$accept": 0, "$end": 1 },
  1272. terminals_: { 2: "error", 5: "EOF", 14: "COMMENT", 15: "CONTENT", 18: "END_RAW_BLOCK", 19: "OPEN_RAW_BLOCK", 23: "CLOSE_RAW_BLOCK", 29: "OPEN_BLOCK", 33: "CLOSE", 34: "OPEN_INVERSE", 39: "OPEN_INVERSE_CHAIN", 44: "INVERSE", 47: "OPEN_ENDBLOCK", 48: "OPEN", 51: "OPEN_UNESCAPED", 54: "CLOSE_UNESCAPED", 55: "OPEN_PARTIAL", 60: "OPEN_PARTIAL_BLOCK", 65: "OPEN_SEXPR", 68: "CLOSE_SEXPR", 72: "ID", 73: "EQUALS", 75: "OPEN_BLOCK_PARAMS", 77: "CLOSE_BLOCK_PARAMS", 80: "STRING", 81: "NUMBER", 82: "BOOLEAN", 83: "UNDEFINED", 84: "NULL", 85: "DATA", 87: "SEP" },
  1273. productions_: [0, [3, 2], [4, 1], [7, 1], [7, 1], [7, 1], [7, 1], [7, 1], [7, 1], [7, 1], [13, 1], [10, 3], [16, 5], [9, 4], [9, 4], [24, 6], [27, 6], [38, 6], [43, 2], [45, 3], [45, 1], [26, 3], [8, 5], [8, 5], [11, 5], [12, 3], [59, 5], [63, 1], [63, 1], [64, 5], [69, 1], [71, 3], [74, 3], [20, 1], [20, 1], [20, 1], [20, 1], [20, 1], [20, 1], [20, 1], [56, 1], [56, 1], [79, 2], [78, 1], [86, 3], [86, 1], [6, 0], [6, 2], [17, 1], [17, 2], [21, 0], [21, 2], [22, 0], [22, 1], [25, 0], [25, 1], [28, 0], [28, 1], [30, 0], [30, 2], [31, 0], [31, 1], [32, 0], [32, 1], [35, 0], [35, 2], [36, 0], [36, 1], [37, 0], [37, 1], [40, 0], [40, 2], [41, 0], [41, 1], [42, 0], [42, 1], [46, 0], [46, 1], [49, 0], [49, 2], [50, 0], [50, 1], [52, 0], [52, 2], [53, 0], [53, 1], [57, 0], [57, 2], [58, 0], [58, 1], [61, 0], [61, 2], [62, 0], [62, 1], [66, 0], [66, 2], [67, 0], [67, 1], [70, 1], [70, 2], [76, 1], [76, 2]],
  1274. performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$) {
  1275. var $0 = $$.length - 1;
  1276. switch (yystate) {
  1277. case 1:
  1278. return $$[$0 - 1];
  1279. break;
  1280. case 2:
  1281. this.$ = yy.prepareProgram($$[$0]);
  1282. break;
  1283. case 3:
  1284. this.$ = $$[$0];
  1285. break;
  1286. case 4:
  1287. this.$ = $$[$0];
  1288. break;
  1289. case 5:
  1290. this.$ = $$[$0];
  1291. break;
  1292. case 6:
  1293. this.$ = $$[$0];
  1294. break;
  1295. case 7:
  1296. this.$ = $$[$0];
  1297. break;
  1298. case 8:
  1299. this.$ = $$[$0];
  1300. break;
  1301. case 9:
  1302. this.$ = {
  1303. type: 'CommentStatement',
  1304. value: yy.stripComment($$[$0]),
  1305. strip: yy.stripFlags($$[$0], $$[$0]),
  1306. loc: yy.locInfo(this._$)
  1307. };
  1308. break;
  1309. case 10:
  1310. this.$ = {
  1311. type: 'ContentStatement',
  1312. original: $$[$0],
  1313. value: $$[$0],
  1314. loc: yy.locInfo(this._$)
  1315. };
  1316. break;
  1317. case 11:
  1318. this.$ = yy.prepareRawBlock($$[$0 - 2], $$[$0 - 1], $$[$0], this._$);
  1319. break;
  1320. case 12:
  1321. this.$ = { path: $$[$0 - 3], params: $$[$0 - 2], hash: $$[$0 - 1] };
  1322. break;
  1323. case 13:
  1324. this.$ = yy.prepareBlock($$[$0 - 3], $$[$0 - 2], $$[$0 - 1], $$[$0], false, this._$);
  1325. break;
  1326. case 14:
  1327. this.$ = yy.prepareBlock($$[$0 - 3], $$[$0 - 2], $$[$0 - 1], $$[$0], true, this._$);
  1328. break;
  1329. case 15:
  1330. this.$ = { open: $$[$0 - 5], path: $$[$0 - 4], params: $$[$0 - 3], hash: $$[$0 - 2], blockParams: $$[$0 - 1], strip: yy.stripFlags($$[$0 - 5], $$[$0]) };
  1331. break;
  1332. case 16:
  1333. this.$ = { path: $$[$0 - 4], params: $$[$0 - 3], hash: $$[$0 - 2], blockParams: $$[$0 - 1], strip: yy.stripFlags($$[$0 - 5], $$[$0]) };
  1334. break;
  1335. case 17:
  1336. this.$ = { path: $$[$0 - 4], params: $$[$0 - 3], hash: $$[$0 - 2], blockParams: $$[$0 - 1], strip: yy.stripFlags($$[$0 - 5], $$[$0]) };
  1337. break;
  1338. case 18:
  1339. this.$ = { strip: yy.stripFlags($$[$0 - 1], $$[$0 - 1]), program: $$[$0] };
  1340. break;
  1341. case 19:
  1342. var inverse = yy.prepareBlock($$[$0 - 2], $$[$0 - 1], $$[$0], $$[$0], false, this._$),
  1343. program = yy.prepareProgram([inverse], $$[$0 - 1].loc);
  1344. program.chained = true;
  1345. this.$ = { strip: $$[$0 - 2].strip, program: program, chain: true };
  1346. break;
  1347. case 20:
  1348. this.$ = $$[$0];
  1349. break;
  1350. case 21:
  1351. this.$ = { path: $$[$0 - 1], strip: yy.stripFlags($$[$0 - 2], $$[$0]) };
  1352. break;
  1353. case 22:
  1354. this.$ = yy.prepareMustache($$[$0 - 3], $$[$0 - 2], $$[$0 - 1], $$[$0 - 4], yy.stripFlags($$[$0 - 4], $$[$0]), this._$);
  1355. break;
  1356. case 23:
  1357. this.$ = yy.prepareMustache($$[$0 - 3], $$[$0 - 2], $$[$0 - 1], $$[$0 - 4], yy.stripFlags($$[$0 - 4], $$[$0]), this._$);
  1358. break;
  1359. case 24:
  1360. this.$ = {
  1361. type: 'PartialStatement',
  1362. name: $$[$0 - 3],
  1363. params: $$[$0 - 2],
  1364. hash: $$[$0 - 1],
  1365. indent: '',
  1366. strip: yy.stripFlags($$[$0 - 4], $$[$0]),
  1367. loc: yy.locInfo(this._$)
  1368. };
  1369. break;
  1370. case 25:
  1371. this.$ = yy.preparePartialBlock($$[$0 - 2], $$[$0 - 1], $$[$0], this._$);
  1372. break;
  1373. case 26:
  1374. this.$ = { path: $$[$0 - 3], params: $$[$0 - 2], hash: $$[$0 - 1], strip: yy.stripFlags($$[$0 - 4], $$[$0]) };
  1375. break;
  1376. case 27:
  1377. this.$ = $$[$0];
  1378. break;
  1379. case 28:
  1380. this.$ = $$[$0];
  1381. break;
  1382. case 29:
  1383. this.$ = {
  1384. type: 'SubExpression',
  1385. path: $$[$0 - 3],
  1386. params: $$[$0 - 2],
  1387. hash: $$[$0 - 1],
  1388. loc: yy.locInfo(this._$)
  1389. };
  1390. break;
  1391. case 30:
  1392. this.$ = { type: 'Hash', pairs: $$[$0], loc: yy.locInfo(this._$) };
  1393. break;
  1394. case 31:
  1395. this.$ = { type: 'HashPair', key: yy.id($$[$0 - 2]), value: $$[$0], loc: yy.locInfo(this._$) };
  1396. break;
  1397. case 32:
  1398. this.$ = yy.id($$[$0 - 1]);
  1399. break;
  1400. case 33:
  1401. this.$ = $$[$0];
  1402. break;
  1403. case 34:
  1404. this.$ = $$[$0];
  1405. break;
  1406. case 35:
  1407. this.$ = { type: 'StringLiteral', value: $$[$0], original: $$[$0], loc: yy.locInfo(this._$) };
  1408. break;
  1409. case 36:
  1410. this.$ = { type: 'NumberLiteral', value: Number($$[$0]), original: Number($$[$0]), loc: yy.locInfo(this._$) };
  1411. break;
  1412. case 37:
  1413. this.$ = { type: 'BooleanLiteral', value: $$[$0] === 'true', original: $$[$0] === 'true', loc: yy.locInfo(this._$) };
  1414. break;
  1415. case 38:
  1416. this.$ = { type: 'UndefinedLiteral', original: undefined, value: undefined, loc: yy.locInfo(this._$) };
  1417. break;
  1418. case 39:
  1419. this.$ = { type: 'NullLiteral', original: null, value: null, loc: yy.locInfo(this._$) };
  1420. break;
  1421. case 40:
  1422. this.$ = $$[$0];
  1423. break;
  1424. case 41:
  1425. this.$ = $$[$0];
  1426. break;
  1427. case 42:
  1428. this.$ = yy.preparePath(true, $$[$0], this._$);
  1429. break;
  1430. case 43:
  1431. this.$ = yy.preparePath(false, $$[$0], this._$);
  1432. break;
  1433. case 44:
  1434. $$[$0 - 2].push({ part: yy.id($$[$0]), original: $$[$0], separator: $$[$0 - 1] });this.$ = $$[$0 - 2];
  1435. break;
  1436. case 45:
  1437. this.$ = [{ part: yy.id($$[$0]), original: $$[$0] }];
  1438. break;
  1439. case 46:
  1440. this.$ = [];
  1441. break;
  1442. case 47:
  1443. $$[$0 - 1].push($$[$0]);
  1444. break;
  1445. case 48:
  1446. this.$ = [$$[$0]];
  1447. break;
  1448. case 49:
  1449. $$[$0 - 1].push($$[$0]);
  1450. break;
  1451. case 50:
  1452. this.$ = [];
  1453. break;
  1454. case 51:
  1455. $$[$0 - 1].push($$[$0]);
  1456. break;
  1457. case 58:
  1458. this.$ = [];
  1459. break;
  1460. case 59:
  1461. $$[$0 - 1].push($$[$0]);
  1462. break;
  1463. case 64:
  1464. this.$ = [];
  1465. break;
  1466. case 65:
  1467. $$[$0 - 1].push($$[$0]);
  1468. break;
  1469. case 70:
  1470. this.$ = [];
  1471. break;
  1472. case 71:
  1473. $$[$0 - 1].push($$[$0]);
  1474. break;
  1475. case 78:
  1476. this.$ = [];
  1477. break;
  1478. case 79:
  1479. $$[$0 - 1].push($$[$0]);
  1480. break;
  1481. case 82:
  1482. this.$ = [];
  1483. break;
  1484. case 83:
  1485. $$[$0 - 1].push($$[$0]);
  1486. break;
  1487. case 86:
  1488. this.$ = [];
  1489. break;
  1490. case 87:
  1491. $$[$0 - 1].push($$[$0]);
  1492. break;
  1493. case 90:
  1494. this.$ = [];
  1495. break;
  1496. case 91:
  1497. $$[$0 - 1].push($$[$0]);
  1498. break;
  1499. case 94:
  1500. this.$ = [];
  1501. break;
  1502. case 95:
  1503. $$[$0 - 1].push($$[$0]);
  1504. break;
  1505. case 98:
  1506. this.$ = [$$[$0]];
  1507. break;
  1508. case 99:
  1509. $$[$0 - 1].push($$[$0]);
  1510. break;
  1511. case 100:
  1512. this.$ = [$$[$0]];
  1513. break;
  1514. case 101:
  1515. $$[$0 - 1].push($$[$0]);
  1516. break;
  1517. }
  1518. },
  1519. table: [{ 3: 1, 4: 2, 5: [2, 46], 6: 3, 14: [2, 46], 15: [2, 46], 19: [2, 46], 29: [2, 46], 34: [2, 46], 48: [2, 46], 51: [2, 46], 55: [2, 46], 60: [2, 46] }, { 1: [3] }, { 5: [1, 4] }, { 5: [2, 2], 7: 5, 8: 6, 9: 7, 10: 8, 11: 9, 12: 10, 13: 11, 14: [1, 12], 15: [1, 20], 16: 17, 19: [1, 23], 24: 15, 27: 16, 29: [1, 21], 34: [1, 22], 39: [2, 2], 44: [2, 2], 47: [2, 2], 48: [1, 13], 51: [1, 14], 55: [1, 18], 59: 19, 60: [1, 24] }, { 1: [2, 1] }, { 5: [2, 47], 14: [2, 47], 15: [2, 47], 19: [2, 47], 29: [2, 47], 34: [2, 47], 39: [2, 47], 44: [2, 47], 47: [2, 47], 48: [2, 47], 51: [2, 47], 55: [2, 47], 60: [2, 47] }, { 5: [2, 3], 14: [2, 3], 15: [2, 3], 19: [2, 3], 29: [2, 3], 34: [2, 3], 39: [2, 3], 44: [2, 3], 47: [2, 3], 48: [2, 3], 51: [2, 3], 55: [2, 3], 60: [2, 3] }, { 5: [2, 4], 14: [2, 4], 15: [2, 4], 19: [2, 4], 29: [2, 4], 34: [2, 4], 39: [2, 4], 44: [2, 4], 47: [2, 4], 48: [2, 4], 51: [2, 4], 55: [2, 4], 60: [2, 4] }, { 5: [2, 5], 14: [2, 5], 15: [2, 5], 19: [2, 5], 29: [2, 5], 34: [2, 5], 39: [2, 5], 44: [2, 5], 47: [2, 5], 48: [2, 5], 51: [2, 5], 55: [2, 5], 60: [2, 5] }, { 5: [2, 6], 14: [2, 6], 15: [2, 6], 19: [2, 6], 29: [2, 6], 34: [2, 6], 39: [2, 6], 44: [2, 6], 47: [2, 6], 48: [2, 6], 51: [2, 6], 55: [2, 6], 60: [2, 6] }, { 5: [2, 7], 14: [2, 7], 15: [2, 7], 19: [2, 7], 29: [2, 7], 34: [2, 7], 39: [2, 7], 44: [2, 7], 47: [2, 7], 48: [2, 7], 51: [2, 7], 55: [2, 7], 60: [2, 7] }, { 5: [2, 8], 14: [2, 8], 15: [2, 8], 19: [2, 8], 29: [2, 8], 34: [2, 8], 39: [2, 8], 44: [2, 8], 47: [2, 8], 48: [2, 8], 51: [2, 8], 55: [2, 8], 60: [2, 8] }, { 5: [2, 9], 14: [2, 9], 15: [2, 9], 19: [2, 9], 29: [2, 9], 34: [2, 9], 39: [2, 9], 44: [2, 9], 47: [2, 9], 48: [2, 9], 51: [2, 9], 55: [2, 9], 60: [2, 9] }, { 20: 25, 72: [1, 35], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 20: 36, 72: [1, 35], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 4: 37, 6: 3, 14: [2, 46], 15: [2, 46], 19: [2, 46], 29: [2, 46], 34: [2, 46], 39: [2, 46], 44: [2, 46], 47: [2, 46], 48: [2, 46], 51: [2, 46], 55: [2, 46], 60: [2, 46] }, { 4: 38, 6: 3, 14: [2, 46], 15: [2, 46], 19: [2, 46], 29: [2, 46], 34: [2, 46], 44: [2, 46], 47: [2, 46], 48: [2, 46], 51: [2, 46], 55: [2, 46], 60: [2, 46] }, { 13: 40, 15: [1, 20], 17: 39 }, { 20: 42, 56: 41, 64: 43, 65: [1, 44], 72: [1, 35], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 4: 45, 6: 3, 14: [2, 46], 15: [2, 46], 19: [2, 46], 29: [2, 46], 34: [2, 46], 47: [2, 46], 48: [2, 46], 51: [2, 46], 55: [2, 46], 60: [2, 46] }, { 5: [2, 10], 14: [2, 10], 15: [2, 10], 18: [2, 10], 19: [2, 10], 29: [2, 10], 34: [2, 10], 39: [2, 10], 44: [2, 10], 47: [2, 10], 48: [2, 10], 51: [2, 10], 55: [2, 10], 60: [2, 10] }, { 20: 46, 72: [1, 35], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 20: 47, 72: [1, 35], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 20: 48, 72: [1, 35], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 20: 42, 56: 49, 64: 43, 65: [1, 44], 72: [1, 35], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 33: [2, 78], 49: 50, 65: [2, 78], 72: [2, 78], 80: [2, 78], 81: [2, 78], 82: [2, 78], 83: [2, 78], 84: [2, 78], 85: [2, 78] }, { 23: [2, 33], 33: [2, 33], 54: [2, 33], 65: [2, 33], 68: [2, 33], 72: [2, 33], 75: [2, 33], 80: [2, 33], 81: [2, 33], 82: [2, 33], 83: [2, 33], 84: [2, 33], 85: [2, 33] }, { 23: [2, 34], 33: [2, 34], 54: [2, 34], 65: [2, 34], 68: [2, 34], 72: [2, 34], 75: [2, 34], 80: [2, 34], 81: [2, 34], 82: [2, 34], 83: [2, 34], 84: [2, 34], 85: [2, 34] }, { 23: [2, 35], 33: [2, 35], 54: [2, 35], 65: [2, 35], 68: [2, 35], 72: [2, 35], 75: [2, 35], 80: [2, 35], 81: [2, 35], 82: [2, 35], 83: [2, 35], 84: [2, 35], 85: [2, 35] }, { 23: [2, 36], 33: [2, 36], 54: [2, 36], 65: [2, 36], 68: [2, 36], 72: [2, 36], 75: [2, 36], 80: [2, 36], 81: [2, 36], 82: [2, 36], 83: [2, 36], 84: [2, 36], 85: [2, 36] }, { 23: [2, 37], 33: [2, 37], 54: [2, 37], 65: [2, 37], 68: [2, 37], 72: [2, 37], 75: [2, 37], 80: [2, 37], 81: [2, 37], 82: [2, 37], 83: [2, 37], 84: [2, 37], 85: [2, 37] }, { 23: [2, 38], 33: [2, 38], 54: [2, 38], 65: [2, 38], 68: [2, 38], 72: [2, 38], 75: [2, 38], 80: [2, 38], 81: [2, 38], 82: [2, 38], 83: [2, 38], 84: [2, 38], 85: [2, 38] }, { 23: [2, 39], 33: [2, 39], 54: [2, 39], 65: [2, 39], 68: [2, 39], 72: [2, 39], 75: [2, 39], 80: [2, 39], 81: [2, 39], 82: [2, 39], 83: [2, 39], 84: [2, 39], 85: [2, 39] }, { 23: [2, 43], 33: [2, 43], 54: [2, 43], 65: [2, 43], 68: [2, 43], 72: [2, 43], 75: [2, 43], 80: [2, 43], 81: [2, 43], 82: [2, 43], 83: [2, 43], 84: [2, 43], 85: [2, 43], 87: [1, 51] }, { 72: [1, 35], 86: 52 }, { 23: [2, 45], 33: [2, 45], 54: [2, 45], 65: [2, 45], 68: [2, 45], 72: [2, 45], 75: [2, 45], 80: [2, 45], 81: [2, 45], 82: [2, 45], 83: [2, 45], 84: [2, 45], 85: [2, 45], 87: [2, 45] }, { 52: 53, 54: [2, 82], 65: [2, 82], 72: [2, 82], 80: [2, 82], 81: [2, 82], 82: [2, 82], 83: [2, 82], 84: [2, 82], 85: [2, 82] }, { 25: 54, 38: 56, 39: [1, 58], 43: 57, 44: [1, 59], 45: 55, 47: [2, 54] }, { 28: 60, 43: 61, 44: [1, 59], 47: [2, 56] }, { 13: 63, 15: [1, 20], 18: [1, 62] }, { 15: [2, 48], 18: [2, 48] }, { 33: [2, 86], 57: 64, 65: [2, 86], 72: [2, 86], 80: [2, 86], 81: [2, 86], 82: [2, 86], 83: [2, 86], 84: [2, 86], 85: [2, 86] }, { 33: [2, 40], 65: [2, 40], 72: [2, 40], 80: [2, 40], 81: [2, 40], 82: [2, 40], 83: [2, 40], 84: [2, 40], 85: [2, 40] }, { 33: [2, 41], 65: [2, 41], 72: [2, 41], 80: [2, 41], 81: [2, 41], 82: [2, 41], 83: [2, 41], 84: [2, 41], 85: [2, 41] }, { 20: 65, 72: [1, 35], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 26: 66, 47: [1, 67] }, { 30: 68, 33: [2, 58], 65: [2, 58], 72: [2, 58], 75: [2, 58], 80: [2, 58], 81: [2, 58], 82: [2, 58], 83: [2, 58], 84: [2, 58], 85: [2, 58] }, { 33: [2, 64], 35: 69, 65: [2, 64], 72: [2, 64], 75: [2, 64], 80: [2, 64], 81: [2, 64], 82: [2, 64], 83: [2, 64], 84: [2, 64], 85: [2, 64] }, { 21: 70, 23: [2, 50], 65: [2, 50], 72: [2, 50], 80: [2, 50], 81: [2, 50], 82: [2, 50], 83: [2, 50], 84: [2, 50], 85: [2, 50] }, { 33: [2, 90], 61: 71, 65: [2, 90], 72: [2, 90], 80: [2, 90], 81: [2, 90], 82: [2, 90], 83: [2, 90], 84: [2, 90], 85: [2, 90] }, { 20: 75, 33: [2, 80], 50: 72, 63: 73, 64: 76, 65: [1, 44], 69: 74, 70: 77, 71: 78, 72: [1, 79], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 72: [1, 80] }, { 23: [2, 42], 33: [2, 42], 54: [2, 42], 65: [2, 42], 68: [2, 42], 72: [2, 42], 75: [2, 42], 80: [2, 42], 81: [2, 42], 82: [2, 42], 83: [2, 42], 84: [2, 42], 85: [2, 42], 87: [1, 51] }, { 20: 75, 53: 81, 54: [2, 84], 63: 82, 64: 76, 65: [1, 44], 69: 83, 70: 77, 71: 78, 72: [1, 79], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 26: 84, 47: [1, 67] }, { 47: [2, 55] }, { 4: 85, 6: 3, 14: [2, 46], 15: [2, 46], 19: [2, 46], 29: [2, 46], 34: [2, 46], 39: [2, 46], 44: [2, 46], 47: [2, 46], 48: [2, 46], 51: [2, 46], 55: [2, 46], 60: [2, 46] }, { 47: [2, 20] }, { 20: 86, 72: [1, 35], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 4: 87, 6: 3, 14: [2, 46], 15: [2, 46], 19: [2, 46], 29: [2, 46], 34: [2, 46], 47: [2, 46], 48: [2, 46], 51: [2, 46], 55: [2, 46], 60: [2, 46] }, { 26: 88, 47: [1, 67] }, { 47: [2, 57] }, { 5: [2, 11], 14: [2, 11], 15: [2, 11], 19: [2, 11], 29: [2, 11], 34: [2, 11], 39: [2, 11], 44: [2, 11], 47: [2, 11], 48: [2, 11], 51: [2, 11], 55: [2, 11], 60: [2, 11] }, { 15: [2, 49], 18: [2, 49] }, { 20: 75, 33: [2, 88], 58: 89, 63: 90, 64: 76, 65: [1, 44], 69: 91, 70: 77, 71: 78, 72: [1, 79], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 65: [2, 94], 66: 92, 68: [2, 94], 72: [2, 94], 80: [2, 94], 81: [2, 94], 82: [2, 94], 83: [2, 94], 84: [2, 94], 85: [2, 94] }, { 5: [2, 25], 14: [2, 25], 15: [2, 25], 19: [2, 25], 29: [2, 25], 34: [2, 25], 39: [2, 25], 44: [2, 25], 47: [2, 25], 48: [2, 25], 51: [2, 25], 55: [2, 25], 60: [2, 25] }, { 20: 93, 72: [1, 35], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 20: 75, 31: 94, 33: [2, 60], 63: 95, 64: 76, 65: [1, 44], 69: 96, 70: 77, 71: 78, 72: [1, 79], 75: [2, 60], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 20: 75, 33: [2, 66], 36: 97, 63: 98, 64: 76, 65: [1, 44], 69: 99, 70: 77, 71: 78, 72: [1, 79], 75: [2, 66], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 20: 75, 22: 100, 23: [2, 52], 63: 101, 64: 76, 65: [1, 44], 69: 102, 70: 77, 71: 78, 72: [1, 79], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 20: 75, 33: [2, 92], 62: 103, 63: 104, 64: 76, 65: [1, 44], 69: 105, 70: 77, 71: 78, 72: [1, 79], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 33: [1, 106] }, { 33: [2, 79], 65: [2, 79], 72: [2, 79], 80: [2, 79], 81: [2, 79], 82: [2, 79], 83: [2, 79], 84: [2, 79], 85: [2, 79] }, { 33: [2, 81] }, { 23: [2, 27], 33: [2, 27], 54: [2, 27], 65: [2, 27], 68: [2, 27], 72: [2, 27], 75: [2, 27], 80: [2, 27], 81: [2, 27], 82: [2, 27], 83: [2, 27], 84: [2, 27], 85: [2, 27] }, { 23: [2, 28], 33: [2, 28], 54: [2, 28], 65: [2, 28], 68: [2, 28], 72: [2, 28], 75: [2, 28], 80: [2, 28], 81: [2, 28], 82: [2, 28], 83: [2, 28], 84: [2, 28], 85: [2, 28] }, { 23: [2, 30], 33: [2, 30], 54: [2, 30], 68: [2, 30], 71: 107, 72: [1, 108], 75: [2, 30] }, { 23: [2, 98], 33: [2, 98], 54: [2, 98], 68: [2, 98], 72: [2, 98], 75: [2, 98] }, { 23: [2, 45], 33: [2, 45], 54: [2, 45], 65: [2, 45], 68: [2, 45], 72: [2, 45], 73: [1, 109], 75: [2, 45], 80: [2, 45], 81: [2, 45], 82: [2, 45], 83: [2, 45], 84: [2, 45], 85: [2, 45], 87: [2, 45] }, { 23: [2, 44], 33: [2, 44], 54: [2, 44], 65: [2, 44], 68: [2, 44], 72: [2, 44], 75: [2, 44], 80: [2, 44], 81: [2, 44], 82: [2, 44], 83: [2, 44], 84: [2, 44], 85: [2, 44], 87: [2, 44] }, { 54: [1, 110] }, { 54: [2, 83], 65: [2, 83], 72: [2, 83], 80: [2, 83], 81: [2, 83], 82: [2, 83], 83: [2, 83], 84: [2, 83], 85: [2, 83] }, { 54: [2, 85] }, { 5: [2, 13], 14: [2, 13], 15: [2, 13], 19: [2, 13], 29: [2, 13], 34: [2, 13], 39: [2, 13], 44: [2, 13], 47: [2, 13], 48: [2, 13], 51: [2, 13], 55: [2, 13], 60: [2, 13] }, { 38: 56, 39: [1, 58], 43: 57, 44: [1, 59], 45: 112, 46: 111, 47: [2, 76] }, { 33: [2, 70], 40: 113, 65: [2, 70], 72: [2, 70], 75: [2, 70], 80: [2, 70], 81: [2, 70], 82: [2, 70], 83: [2, 70], 84: [2, 70], 85: [2, 70] }, { 47: [2, 18] }, { 5: [2, 14], 14: [2, 14], 15: [2, 14], 19: [2, 14], 29: [2, 14], 34: [2, 14], 39: [2, 14], 44: [2, 14], 47: [2, 14], 48: [2, 14], 51: [2, 14], 55: [2, 14], 60: [2, 14] }, { 33: [1, 114] }, { 33: [2, 87], 65: [2, 87], 72: [2, 87], 80: [2, 87], 81: [2, 87], 82: [2, 87], 83: [2, 87], 84: [2, 87], 85: [2, 87] }, { 33: [2, 89] }, { 20: 75, 63: 116, 64: 76, 65: [1, 44], 67: 115, 68: [2, 96], 69: 117, 70: 77, 71: 78, 72: [1, 79], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 33: [1, 118] }, { 32: 119, 33: [2, 62], 74: 120, 75: [1, 121] }, { 33: [2, 59], 65: [2, 59], 72: [2, 59], 75: [2, 59], 80: [2, 59], 81: [2, 59], 82: [2, 59], 83: [2, 59], 84: [2, 59], 85: [2, 59] }, { 33: [2, 61], 75: [2, 61] }, { 33: [2, 68], 37: 122, 74: 123, 75: [1, 121] }, { 33: [2, 65], 65: [2, 65], 72: [2, 65], 75: [2, 65], 80: [2, 65], 81: [2, 65], 82: [2, 65], 83: [2, 65], 84: [2, 65], 85: [2, 65] }, { 33: [2, 67], 75: [2, 67] }, { 23: [1, 124] }, { 23: [2, 51], 65: [2, 51], 72: [2, 51], 80: [2, 51], 81: [2, 51], 82: [2, 51], 83: [2, 51], 84: [2, 51], 85: [2, 51] }, { 23: [2, 53] }, { 33: [1, 125] }, { 33: [2, 91], 65: [2, 91], 72: [2, 91], 80: [2, 91], 81: [2, 91], 82: [2, 91], 83: [2, 91], 84: [2, 91], 85: [2, 91] }, { 33: [2, 93] }, { 5: [2, 22], 14: [2, 22], 15: [2, 22], 19: [2, 22], 29: [2, 22], 34: [2, 22], 39: [2, 22], 44: [2, 22], 47: [2, 22], 48: [2, 22], 51: [2, 22], 55: [2, 22], 60: [2, 22] }, { 23: [2, 99], 33: [2, 99], 54: [2, 99], 68: [2, 99], 72: [2, 99], 75: [2, 99] }, { 73: [1, 109] }, { 20: 75, 63: 126, 64: 76, 65: [1, 44], 72: [1, 35], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 5: [2, 23], 14: [2, 23], 15: [2, 23], 19: [2, 23], 29: [2, 23], 34: [2, 23], 39: [2, 23], 44: [2, 23], 47: [2, 23], 48: [2, 23], 51: [2, 23], 55: [2, 23], 60: [2, 23] }, { 47: [2, 19] }, { 47: [2, 77] }, { 20: 75, 33: [2, 72], 41: 127, 63: 128, 64: 76, 65: [1, 44], 69: 129, 70: 77, 71: 78, 72: [1, 79], 75: [2, 72], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 5: [2, 24], 14: [2, 24], 15: [2, 24], 19: [2, 24], 29: [2, 24], 34: [2, 24], 39: [2, 24], 44: [2, 24], 47: [2, 24], 48: [2, 24], 51: [2, 24], 55: [2, 24], 60: [2, 24] }, { 68: [1, 130] }, { 65: [2, 95], 68: [2, 95], 72: [2, 95], 80: [2, 95], 81: [2, 95], 82: [2, 95], 83: [2, 95], 84: [2, 95], 85: [2, 95] }, { 68: [2, 97] }, { 5: [2, 21], 14: [2, 21], 15: [2, 21], 19: [2, 21], 29: [2, 21], 34: [2, 21], 39: [2, 21], 44: [2, 21], 47: [2, 21], 48: [2, 21], 51: [2, 21], 55: [2, 21], 60: [2, 21] }, { 33: [1, 131] }, { 33: [2, 63] }, { 72: [1, 133], 76: 132 }, { 33: [1, 134] }, { 33: [2, 69] }, { 15: [2, 12] }, { 14: [2, 26], 15: [2, 26], 19: [2, 26], 29: [2, 26], 34: [2, 26], 47: [2, 26], 48: [2, 26], 51: [2, 26], 55: [2, 26], 60: [2, 26] }, { 23: [2, 31], 33: [2, 31], 54: [2, 31], 68: [2, 31], 72: [2, 31], 75: [2, 31] }, { 33: [2, 74], 42: 135, 74: 136, 75: [1, 121] }, { 33: [2, 71], 65: [2, 71], 72: [2, 71], 75: [2, 71], 80: [2, 71], 81: [2, 71], 82: [2, 71], 83: [2, 71], 84: [2, 71], 85: [2, 71] }, { 33: [2, 73], 75: [2, 73] }, { 23: [2, 29], 33: [2, 29], 54: [2, 29], 65: [2, 29], 68: [2, 29], 72: [2, 29], 75: [2, 29], 80: [2, 29], 81: [2, 29], 82: [2, 29], 83: [2, 29], 84: [2, 29], 85: [2, 29] }, { 14: [2, 15], 15: [2, 15], 19: [2, 15], 29: [2, 15], 34: [2, 15], 39: [2, 15], 44: [2, 15], 47: [2, 15], 48: [2, 15], 51: [2, 15], 55: [2, 15], 60: [2, 15] }, { 72: [1, 138], 77: [1, 137] }, { 72: [2, 100], 77: [2, 100] }, { 14: [2, 16], 15: [2, 16], 19: [2, 16], 29: [2, 16], 34: [2, 16], 44: [2, 16], 47: [2, 16], 48: [2, 16], 51: [2, 16], 55: [2, 16], 60: [2, 16] }, { 33: [1, 139] }, { 33: [2, 75] }, { 33: [2, 32] }, { 72: [2, 101], 77: [2, 101] }, { 14: [2, 17], 15: [2, 17], 19: [2, 17], 29: [2, 17], 34: [2, 17], 39: [2, 17], 44: [2, 17], 47: [2, 17], 48: [2, 17], 51: [2, 17], 55: [2, 17], 60: [2, 17] }],
  1520. defaultActions: { 4: [2, 1], 55: [2, 55], 57: [2, 20], 61: [2, 57], 74: [2, 81], 83: [2, 85], 87: [2, 18], 91: [2, 89], 102: [2, 53], 105: [2, 93], 111: [2, 19], 112: [2, 77], 117: [2, 97], 120: [2, 63], 123: [2, 69], 124: [2, 12], 136: [2, 75], 137: [2, 32] },
  1521. parseError: function parseError(str, hash) {
  1522. throw new Error(str);
  1523. },
  1524. parse: function parse(input) {
  1525. var self = this,
  1526. stack = [0],
  1527. vstack = [null],
  1528. lstack = [],
  1529. table = this.table,
  1530. yytext = "",
  1531. yylineno = 0,
  1532. yyleng = 0,
  1533. recovering = 0,
  1534. TERROR = 2,
  1535. EOF = 1;
  1536. this.lexer.setInput(input);
  1537. this.lexer.yy = this.yy;
  1538. this.yy.lexer = this.lexer;
  1539. this.yy.parser = this;
  1540. if (typeof this.lexer.yylloc == "undefined") this.lexer.yylloc = {};
  1541. var yyloc = this.lexer.yylloc;
  1542. lstack.push(yyloc);
  1543. var ranges = this.lexer.options && this.lexer.options.ranges;
  1544. if (typeof this.yy.parseError === "function") this.parseError = this.yy.parseError;
  1545. function popStack(n) {
  1546. stack.length = stack.length - 2 * n;
  1547. vstack.length = vstack.length - n;
  1548. lstack.length = lstack.length - n;
  1549. }
  1550. function lex() {
  1551. var token;
  1552. token = self.lexer.lex() || 1;
  1553. if (typeof token !== "number") {
  1554. token = self.symbols_[token] || token;
  1555. }
  1556. return token;
  1557. }
  1558. var symbol,
  1559. preErrorSymbol,
  1560. state,
  1561. action,
  1562. a,
  1563. r,
  1564. yyval = {},
  1565. p,
  1566. len,
  1567. newState,
  1568. expected;
  1569. while (true) {
  1570. state = stack[stack.length - 1];
  1571. if (this.defaultActions[state]) {
  1572. action = this.defaultActions[state];
  1573. } else {
  1574. if (symbol === null || typeof symbol == "undefined") {
  1575. symbol = lex();
  1576. }
  1577. action = table[state] && table[state][symbol];
  1578. }
  1579. if (typeof action === "undefined" || !action.length || !action[0]) {
  1580. var errStr = "";
  1581. if (!recovering) {
  1582. expected = [];
  1583. for (p in table[state]) if (this.terminals_[p] && p > 2) {
  1584. expected.push("'" + this.terminals_[p] + "'");
  1585. }
  1586. if (this.lexer.showPosition) {
  1587. errStr = "Parse error on line " + (yylineno + 1) + ":\n" + this.lexer.showPosition() + "\nExpecting " + expected.join(", ") + ", got '" + (this.terminals_[symbol] || symbol) + "'";
  1588. } else {
  1589. errStr = "Parse error on line " + (yylineno + 1) + ": Unexpected " + (symbol == 1 ? "end of input" : "'" + (this.terminals_[symbol] || symbol) + "'");
  1590. }
  1591. this.parseError(errStr, { text: this.lexer.match, token: this.terminals_[symbol] || symbol, line: this.lexer.yylineno, loc: yyloc, expected: expected });
  1592. }
  1593. }
  1594. if (action[0] instanceof Array && action.length > 1) {
  1595. throw new Error("Parse Error: multiple actions possible at state: " + state + ", token: " + symbol);
  1596. }
  1597. switch (action[0]) {
  1598. case 1:
  1599. stack.push(symbol);
  1600. vstack.push(this.lexer.yytext);
  1601. lstack.push(this.lexer.yylloc);
  1602. stack.push(action[1]);
  1603. symbol = null;
  1604. if (!preErrorSymbol) {
  1605. yyleng = this.lexer.yyleng;
  1606. yytext = this.lexer.yytext;
  1607. yylineno = this.lexer.yylineno;
  1608. yyloc = this.lexer.yylloc;
  1609. if (recovering > 0) recovering--;
  1610. } else {
  1611. symbol = preErrorSymbol;
  1612. preErrorSymbol = null;
  1613. }
  1614. break;
  1615. case 2:
  1616. len = this.productions_[action[1]][1];
  1617. yyval.$ = vstack[vstack.length - len];
  1618. yyval._$ = { first_line: lstack[lstack.length - (len || 1)].first_line, last_line: lstack[lstack.length - 1].last_line, first_column: lstack[lstack.length - (len || 1)].first_column, last_column: lstack[lstack.length - 1].last_column };
  1619. if (ranges) {
  1620. yyval._$.range = [lstack[lstack.length - (len || 1)].range[0], lstack[lstack.length - 1].range[1]];
  1621. }
  1622. r = this.performAction.call(yyval, yytext, yyleng, yylineno, this.yy, action[1], vstack, lstack);
  1623. if (typeof r !== "undefined") {
  1624. return r;
  1625. }
  1626. if (len) {
  1627. stack = stack.slice(0, -1 * len * 2);
  1628. vstack = vstack.slice(0, -1 * len);
  1629. lstack = lstack.slice(0, -1 * len);
  1630. }
  1631. stack.push(this.productions_[action[1]][0]);
  1632. vstack.push(yyval.$);
  1633. lstack.push(yyval._$);
  1634. newState = table[stack[stack.length - 2]][stack[stack.length - 1]];
  1635. stack.push(newState);
  1636. break;
  1637. case 3:
  1638. return true;
  1639. }
  1640. }
  1641. return true;
  1642. }
  1643. };
  1644. /* Jison generated lexer */
  1645. var lexer = (function () {
  1646. var lexer = { EOF: 1,
  1647. parseError: function parseError(str, hash) {
  1648. if (this.yy.parser) {
  1649. this.yy.parser.parseError(str, hash);
  1650. } else {
  1651. throw new Error(str);
  1652. }
  1653. },
  1654. setInput: function setInput(input) {
  1655. this._input = input;
  1656. this._more = this._less = this.done = false;
  1657. this.yylineno = this.yyleng = 0;
  1658. this.yytext = this.matched = this.match = '';
  1659. this.conditionStack = ['INITIAL'];
  1660. this.yylloc = { first_line: 1, first_column: 0, last_line: 1, last_column: 0 };
  1661. if (this.options.ranges) this.yylloc.range = [0, 0];
  1662. this.offset = 0;
  1663. return this;
  1664. },
  1665. input: function input() {
  1666. var ch = this._input[0];
  1667. this.yytext += ch;
  1668. this.yyleng++;
  1669. this.offset++;
  1670. this.match += ch;
  1671. this.matched += ch;
  1672. var lines = ch.match(/(?:\r\n?|\n).*/g);
  1673. if (lines) {
  1674. this.yylineno++;
  1675. this.yylloc.last_line++;
  1676. } else {
  1677. this.yylloc.last_column++;
  1678. }
  1679. if (this.options.ranges) this.yylloc.range[1]++;
  1680. this._input = this._input.slice(1);
  1681. return ch;
  1682. },
  1683. unput: function unput(ch) {
  1684. var len = ch.length;
  1685. var lines = ch.split(/(?:\r\n?|\n)/g);
  1686. this._input = ch + this._input;
  1687. this.yytext = this.yytext.substr(0, this.yytext.length - len - 1);
  1688. //this.yyleng -= len;
  1689. this.offset -= len;
  1690. var oldLines = this.match.split(/(?:\r\n?|\n)/g);
  1691. this.match = this.match.substr(0, this.match.length - 1);
  1692. this.matched = this.matched.substr(0, this.matched.length - 1);
  1693. if (lines.length - 1) this.yylineno -= lines.length - 1;
  1694. var r = this.yylloc.range;
  1695. this.yylloc = { first_line: this.yylloc.first_line,
  1696. last_line: this.yylineno + 1,
  1697. first_column: this.yylloc.first_column,
  1698. last_column: lines ? (lines.length === oldLines.length ? this.yylloc.first_column : 0) + oldLines[oldLines.length - lines.length].length - lines[0].length : this.yylloc.first_column - len
  1699. };
  1700. if (this.options.ranges) {
  1701. this.yylloc.range = [r[0], r[0] + this.yyleng - len];
  1702. }
  1703. return this;
  1704. },
  1705. more: function more() {
  1706. this._more = true;
  1707. return this;
  1708. },
  1709. less: function less(n) {
  1710. this.unput(this.match.slice(n));
  1711. },
  1712. pastInput: function pastInput() {
  1713. var past = this.matched.substr(0, this.matched.length - this.match.length);
  1714. return (past.length > 20 ? '...' : '') + past.substr(-20).replace(/\n/g, "");
  1715. },
  1716. upcomingInput: function upcomingInput() {
  1717. var next = this.match;
  1718. if (next.length < 20) {
  1719. next += this._input.substr(0, 20 - next.length);
  1720. }
  1721. return (next.substr(0, 20) + (next.length > 20 ? '...' : '')).replace(/\n/g, "");
  1722. },
  1723. showPosition: function showPosition() {
  1724. var pre = this.pastInput();
  1725. var c = new Array(pre.length + 1).join("-");
  1726. return pre + this.upcomingInput() + "\n" + c + "^";
  1727. },
  1728. next: function next() {
  1729. if (this.done) {
  1730. return this.EOF;
  1731. }
  1732. if (!this._input) this.done = true;
  1733. var token, match, tempMatch, index, col, lines;
  1734. if (!this._more) {
  1735. this.yytext = '';
  1736. this.match = '';
  1737. }
  1738. var rules = this._currentRules();
  1739. for (var i = 0; i < rules.length; i++) {
  1740. tempMatch = this._input.match(this.rules[rules[i]]);
  1741. if (tempMatch && (!match || tempMatch[0].length > match[0].length)) {
  1742. match = tempMatch;
  1743. index = i;
  1744. if (!this.options.flex) break;
  1745. }
  1746. }
  1747. if (match) {
  1748. lines = match[0].match(/(?:\r\n?|\n).*/g);
  1749. if (lines) this.yylineno += lines.length;
  1750. this.yylloc = { first_line: this.yylloc.last_line,
  1751. last_line: this.yylineno + 1,
  1752. first_column: this.yylloc.last_column,
  1753. last_column: lines ? lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + match[0].length };
  1754. this.yytext += match[0];
  1755. this.match += match[0];
  1756. this.matches = match;
  1757. this.yyleng = this.yytext.length;
  1758. if (this.options.ranges) {
  1759. this.yylloc.range = [this.offset, this.offset += this.yyleng];
  1760. }
  1761. this._more = false;
  1762. this._input = this._input.slice(match[0].length);
  1763. this.matched += match[0];
  1764. token = this.performAction.call(this, this.yy, this, rules[index], this.conditionStack[this.conditionStack.length - 1]);
  1765. if (this.done && this._input) this.done = false;
  1766. if (token) return token;else return;
  1767. }
  1768. if (this._input === "") {
  1769. return this.EOF;
  1770. } else {
  1771. return this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. Unrecognized text.\n' + this.showPosition(), { text: "", token: null, line: this.yylineno });
  1772. }
  1773. },
  1774. lex: function lex() {
  1775. var r = this.next();
  1776. if (typeof r !== 'undefined') {
  1777. return r;
  1778. } else {
  1779. return this.lex();
  1780. }
  1781. },
  1782. begin: function begin(condition) {
  1783. this.conditionStack.push(condition);
  1784. },
  1785. popState: function popState() {
  1786. return this.conditionStack.pop();
  1787. },
  1788. _currentRules: function _currentRules() {
  1789. return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules;
  1790. },
  1791. topState: function topState() {
  1792. return this.conditionStack[this.conditionStack.length - 2];
  1793. },
  1794. pushState: function begin(condition) {
  1795. this.begin(condition);
  1796. } };
  1797. lexer.options = {};
  1798. lexer.performAction = function anonymous(yy, yy_, $avoiding_name_collisions, YY_START) {
  1799. function strip(start, end) {
  1800. return yy_.yytext = yy_.yytext.substring(start, yy_.yyleng - end + start);
  1801. }
  1802. var YYSTATE = YY_START;
  1803. switch ($avoiding_name_collisions) {
  1804. case 0:
  1805. if (yy_.yytext.slice(-2) === "\\\\") {
  1806. strip(0, 1);
  1807. this.begin("mu");
  1808. } else if (yy_.yytext.slice(-1) === "\\") {
  1809. strip(0, 1);
  1810. this.begin("emu");
  1811. } else {
  1812. this.begin("mu");
  1813. }
  1814. if (yy_.yytext) return 15;
  1815. break;
  1816. case 1:
  1817. return 15;
  1818. break;
  1819. case 2:
  1820. this.popState();
  1821. return 15;
  1822. break;
  1823. case 3:
  1824. this.begin('raw');return 15;
  1825. break;
  1826. case 4:
  1827. this.popState();
  1828. // Should be using `this.topState()` below, but it currently
  1829. // returns the second top instead of the first top. Opened an
  1830. // issue about it at https://github.com/zaach/jison/issues/291
  1831. if (this.conditionStack[this.conditionStack.length - 1] === 'raw') {
  1832. return 15;
  1833. } else {
  1834. strip(5, 9);
  1835. return 'END_RAW_BLOCK';
  1836. }
  1837. break;
  1838. case 5:
  1839. return 15;
  1840. break;
  1841. case 6:
  1842. this.popState();
  1843. return 14;
  1844. break;
  1845. case 7:
  1846. return 65;
  1847. break;
  1848. case 8:
  1849. return 68;
  1850. break;
  1851. case 9:
  1852. return 19;
  1853. break;
  1854. case 10:
  1855. this.popState();
  1856. this.begin('raw');
  1857. return 23;
  1858. break;
  1859. case 11:
  1860. return 55;
  1861. break;
  1862. case 12:
  1863. return 60;
  1864. break;
  1865. case 13:
  1866. return 29;
  1867. break;
  1868. case 14:
  1869. return 47;
  1870. break;
  1871. case 15:
  1872. this.popState();return 44;
  1873. break;
  1874. case 16:
  1875. this.popState();return 44;
  1876. break;
  1877. case 17:
  1878. return 34;
  1879. break;
  1880. case 18:
  1881. return 39;
  1882. break;
  1883. case 19:
  1884. return 51;
  1885. break;
  1886. case 20:
  1887. return 48;
  1888. break;
  1889. case 21:
  1890. this.unput(yy_.yytext);
  1891. this.popState();
  1892. this.begin('com');
  1893. break;
  1894. case 22:
  1895. this.popState();
  1896. return 14;
  1897. break;
  1898. case 23:
  1899. return 48;
  1900. break;
  1901. case 24:
  1902. return 73;
  1903. break;
  1904. case 25:
  1905. return 72;
  1906. break;
  1907. case 26:
  1908. return 72;
  1909. break;
  1910. case 27:
  1911. return 87;
  1912. break;
  1913. case 28:
  1914. // ignore whitespace
  1915. break;
  1916. case 29:
  1917. this.popState();return 54;
  1918. break;
  1919. case 30:
  1920. this.popState();return 33;
  1921. break;
  1922. case 31:
  1923. yy_.yytext = strip(1, 2).replace(/\\"/g, '"');return 80;
  1924. break;
  1925. case 32:
  1926. yy_.yytext = strip(1, 2).replace(/\\'/g, "'");return 80;
  1927. break;
  1928. case 33:
  1929. return 85;
  1930. break;
  1931. case 34:
  1932. return 82;
  1933. break;
  1934. case 35:
  1935. return 82;
  1936. break;
  1937. case 36:
  1938. return 83;
  1939. break;
  1940. case 37:
  1941. return 84;
  1942. break;
  1943. case 38:
  1944. return 81;
  1945. break;
  1946. case 39:
  1947. return 75;
  1948. break;
  1949. case 40:
  1950. return 77;
  1951. break;
  1952. case 41:
  1953. return 72;
  1954. break;
  1955. case 42:
  1956. yy_.yytext = yy_.yytext.replace(/\\([\\\]])/g, '$1');return 72;
  1957. break;
  1958. case 43:
  1959. return 'INVALID';
  1960. break;
  1961. case 44:
  1962. return 5;
  1963. break;
  1964. }
  1965. };
  1966. lexer.rules = [/^(?:[^\x00]*?(?=(\{\{)))/, /^(?:[^\x00]+)/, /^(?:[^\x00]{2,}?(?=(\{\{|\\\{\{|\\\\\{\{|$)))/, /^(?:\{\{\{\{(?=[^\/]))/, /^(?:\{\{\{\{\/[^\s!"#%-,\.\/;->@\[-\^`\{-~]+(?=[=}\s\/.])\}\}\}\})/, /^(?:[^\x00]*?(?=(\{\{\{\{)))/, /^(?:[\s\S]*?--(~)?\}\})/, /^(?:\()/, /^(?:\))/, /^(?:\{\{\{\{)/, /^(?:\}\}\}\})/, /^(?:\{\{(~)?>)/, /^(?:\{\{(~)?#>)/, /^(?:\{\{(~)?#\*?)/, /^(?:\{\{(~)?\/)/, /^(?:\{\{(~)?\^\s*(~)?\}\})/, /^(?:\{\{(~)?\s*else\s*(~)?\}\})/, /^(?:\{\{(~)?\^)/, /^(?:\{\{(~)?\s*else\b)/, /^(?:\{\{(~)?\{)/, /^(?:\{\{(~)?&)/, /^(?:\{\{(~)?!--)/, /^(?:\{\{(~)?![\s\S]*?\}\})/, /^(?:\{\{(~)?\*?)/, /^(?:=)/, /^(?:\.\.)/, /^(?:\.(?=([=~}\s\/.)|])))/, /^(?:[\/.])/, /^(?:\s+)/, /^(?:\}(~)?\}\})/, /^(?:(~)?\}\})/, /^(?:"(\\["]|[^"])*")/, /^(?:'(\\[']|[^'])*')/, /^(?:@)/, /^(?:true(?=([~}\s)])))/, /^(?:false(?=([~}\s)])))/, /^(?:undefined(?=([~}\s)])))/, /^(?:null(?=([~}\s)])))/, /^(?:-?[0-9]+(?:\.[0-9]+)?(?=([~}\s)])))/, /^(?:as\s+\|)/, /^(?:\|)/, /^(?:([^\s!"#%-,\.\/;->@\[-\^`\{-~]+(?=([=~}\s\/.)|]))))/, /^(?:\[(\\\]|[^\]])*\])/, /^(?:.)/, /^(?:$)/];
  1967. lexer.conditions = { "mu": { "rules": [7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44], "inclusive": false }, "emu": { "rules": [2], "inclusive": false }, "com": { "rules": [6], "inclusive": false }, "raw": { "rules": [3, 4, 5], "inclusive": false }, "INITIAL": { "rules": [0, 1, 44], "inclusive": true } };
  1968. return lexer;
  1969. })();
  1970. parser.lexer = lexer;
  1971. function Parser() {
  1972. this.yy = {};
  1973. }Parser.prototype = parser;parser.Parser = Parser;
  1974. return new Parser();
  1975. })();exports["default"] = handlebars;
  1976. module.exports = exports["default"];
  1977. /***/ }),
  1978. /* 38 */
  1979. /***/ (function(module, exports, __webpack_require__) {
  1980. 'use strict';
  1981. var _interopRequireDefault = __webpack_require__(1)['default'];
  1982. exports.__esModule = true;
  1983. var _visitor = __webpack_require__(39);
  1984. var _visitor2 = _interopRequireDefault(_visitor);
  1985. function WhitespaceControl() {
  1986. var options = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];
  1987. this.options = options;
  1988. }
  1989. WhitespaceControl.prototype = new _visitor2['default']();
  1990. WhitespaceControl.prototype.Program = function (program) {
  1991. var doStandalone = !this.options.ignoreStandalone;
  1992. var isRoot = !this.isRootSeen;
  1993. this.isRootSeen = true;
  1994. var body = program.body;
  1995. for (var i = 0, l = body.length; i < l; i++) {
  1996. var current = body[i],
  1997. strip = this.accept(current);
  1998. if (!strip) {
  1999. continue;
  2000. }
  2001. var _isPrevWhitespace = isPrevWhitespace(body, i, isRoot),
  2002. _isNextWhitespace = isNextWhitespace(body, i, isRoot),
  2003. openStandalone = strip.openStandalone && _isPrevWhitespace,
  2004. closeStandalone = strip.closeStandalone && _isNextWhitespace,
  2005. inlineStandalone = strip.inlineStandalone && _isPrevWhitespace && _isNextWhitespace;
  2006. if (strip.close) {
  2007. omitRight(body, i, true);
  2008. }
  2009. if (strip.open) {
  2010. omitLeft(body, i, true);
  2011. }
  2012. if (doStandalone && inlineStandalone) {
  2013. omitRight(body, i);
  2014. if (omitLeft(body, i)) {
  2015. // If we are on a standalone node, save the indent info for partials
  2016. if (current.type === 'PartialStatement') {
  2017. // Pull out the whitespace from the final line
  2018. current.indent = /([ \t]+$)/.exec(body[i - 1].original)[1];
  2019. }
  2020. }
  2021. }
  2022. if (doStandalone && openStandalone) {
  2023. omitRight((current.program || current.inverse).body);
  2024. // Strip out the previous content node if it's whitespace only
  2025. omitLeft(body, i);
  2026. }
  2027. if (doStandalone && closeStandalone) {
  2028. // Always strip the next node
  2029. omitRight(body, i);
  2030. omitLeft((current.inverse || current.program).body);
  2031. }
  2032. }
  2033. return program;
  2034. };
  2035. WhitespaceControl.prototype.BlockStatement = WhitespaceControl.prototype.DecoratorBlock = WhitespaceControl.prototype.PartialBlockStatement = function (block) {
  2036. this.accept(block.program);
  2037. this.accept(block.inverse);
  2038. // Find the inverse program that is involed with whitespace stripping.
  2039. var program = block.program || block.inverse,
  2040. inverse = block.program && block.inverse,
  2041. firstInverse = inverse,
  2042. lastInverse = inverse;
  2043. if (inverse && inverse.chained) {
  2044. firstInverse = inverse.body[0].program;
  2045. // Walk the inverse chain to find the last inverse that is actually in the chain.
  2046. while (lastInverse.chained) {
  2047. lastInverse = lastInverse.body[lastInverse.body.length - 1].program;
  2048. }
  2049. }
  2050. var strip = {
  2051. open: block.openStrip.open,
  2052. close: block.closeStrip.close,
  2053. // Determine the standalone candiacy. Basically flag our content as being possibly standalone
  2054. // so our parent can determine if we actually are standalone
  2055. openStandalone: isNextWhitespace(program.body),
  2056. closeStandalone: isPrevWhitespace((firstInverse || program).body)
  2057. };
  2058. if (block.openStrip.close) {
  2059. omitRight(program.body, null, true);
  2060. }
  2061. if (inverse) {
  2062. var inverseStrip = block.inverseStrip;
  2063. if (inverseStrip.open) {
  2064. omitLeft(program.body, null, true);
  2065. }
  2066. if (inverseStrip.close) {
  2067. omitRight(firstInverse.body, null, true);
  2068. }
  2069. if (block.closeStrip.open) {
  2070. omitLeft(lastInverse.body, null, true);
  2071. }
  2072. // Find standalone else statments
  2073. if (!this.options.ignoreStandalone && isPrevWhitespace(program.body) && isNextWhitespace(firstInverse.body)) {
  2074. omitLeft(program.body);
  2075. omitRight(firstInverse.body);
  2076. }
  2077. } else if (block.closeStrip.open) {
  2078. omitLeft(program.body, null, true);
  2079. }
  2080. return strip;
  2081. };
  2082. WhitespaceControl.prototype.Decorator = WhitespaceControl.prototype.MustacheStatement = function (mustache) {
  2083. return mustache.strip;
  2084. };
  2085. WhitespaceControl.prototype.PartialStatement = WhitespaceControl.prototype.CommentStatement = function (node) {
  2086. /* istanbul ignore next */
  2087. var strip = node.strip || {};
  2088. return {
  2089. inlineStandalone: true,
  2090. open: strip.open,
  2091. close: strip.close
  2092. };
  2093. };
  2094. function isPrevWhitespace(body, i, isRoot) {
  2095. if (i === undefined) {
  2096. i = body.length;
  2097. }
  2098. // Nodes that end with newlines are considered whitespace (but are special
  2099. // cased for strip operations)
  2100. var prev = body[i - 1],
  2101. sibling = body[i - 2];
  2102. if (!prev) {
  2103. return isRoot;
  2104. }
  2105. if (prev.type === 'ContentStatement') {
  2106. return (sibling || !isRoot ? /\r?\n\s*?$/ : /(^|\r?\n)\s*?$/).test(prev.original);
  2107. }
  2108. }
  2109. function isNextWhitespace(body, i, isRoot) {
  2110. if (i === undefined) {
  2111. i = -1;
  2112. }
  2113. var next = body[i + 1],
  2114. sibling = body[i + 2];
  2115. if (!next) {
  2116. return isRoot;
  2117. }
  2118. if (next.type === 'ContentStatement') {
  2119. return (sibling || !isRoot ? /^\s*?\r?\n/ : /^\s*?(\r?\n|$)/).test(next.original);
  2120. }
  2121. }
  2122. // Marks the node to the right of the position as omitted.
  2123. // I.e. {{foo}}' ' will mark the ' ' node as omitted.
  2124. //
  2125. // If i is undefined, then the first child will be marked as such.
  2126. //
  2127. // If mulitple is truthy then all whitespace will be stripped out until non-whitespace
  2128. // content is met.
  2129. function omitRight(body, i, multiple) {
  2130. var current = body[i == null ? 0 : i + 1];
  2131. if (!current || current.type !== 'ContentStatement' || !multiple && current.rightStripped) {
  2132. return;
  2133. }
  2134. var original = current.value;
  2135. current.value = current.value.replace(multiple ? /^\s+/ : /^[ \t]*\r?\n?/, '');
  2136. current.rightStripped = current.value !== original;
  2137. }
  2138. // Marks the node to the left of the position as omitted.
  2139. // I.e. ' '{{foo}} will mark the ' ' node as omitted.
  2140. //
  2141. // If i is undefined then the last child will be marked as such.
  2142. //
  2143. // If mulitple is truthy then all whitespace will be stripped out until non-whitespace
  2144. // content is met.
  2145. function omitLeft(body, i, multiple) {
  2146. var current = body[i == null ? body.length - 1 : i - 1];
  2147. if (!current || current.type !== 'ContentStatement' || !multiple && current.leftStripped) {
  2148. return;
  2149. }
  2150. // We omit the last node if it's whitespace only and not preceeded by a non-content node.
  2151. var original = current.value;
  2152. current.value = current.value.replace(multiple ? /\s+$/ : /[ \t]+$/, '');
  2153. current.leftStripped = current.value !== original;
  2154. return current.leftStripped;
  2155. }
  2156. exports['default'] = WhitespaceControl;
  2157. module.exports = exports['default'];
  2158. /***/ }),
  2159. /* 39 */
  2160. /***/ (function(module, exports, __webpack_require__) {
  2161. 'use strict';
  2162. var _interopRequireDefault = __webpack_require__(1)['default'];
  2163. exports.__esModule = true;
  2164. var _exception = __webpack_require__(6);
  2165. var _exception2 = _interopRequireDefault(_exception);
  2166. function Visitor() {
  2167. this.parents = [];
  2168. }
  2169. Visitor.prototype = {
  2170. constructor: Visitor,
  2171. mutating: false,
  2172. // Visits a given value. If mutating, will replace the value if necessary.
  2173. acceptKey: function acceptKey(node, name) {
  2174. var value = this.accept(node[name]);
  2175. if (this.mutating) {
  2176. // Hacky sanity check: This may have a few false positives for type for the helper
  2177. // methods but will generally do the right thing without a lot of overhead.
  2178. if (value && !Visitor.prototype[value.type]) {
  2179. throw new _exception2['default']('Unexpected node type "' + value.type + '" found when accepting ' + name + ' on ' + node.type);
  2180. }
  2181. node[name] = value;
  2182. }
  2183. },
  2184. // Performs an accept operation with added sanity check to ensure
  2185. // required keys are not removed.
  2186. acceptRequired: function acceptRequired(node, name) {
  2187. this.acceptKey(node, name);
  2188. if (!node[name]) {
  2189. throw new _exception2['default'](node.type + ' requires ' + name);
  2190. }
  2191. },
  2192. // Traverses a given array. If mutating, empty respnses will be removed
  2193. // for child elements.
  2194. acceptArray: function acceptArray(array) {
  2195. for (var i = 0, l = array.length; i < l; i++) {
  2196. this.acceptKey(array, i);
  2197. if (!array[i]) {
  2198. array.splice(i, 1);
  2199. i--;
  2200. l--;
  2201. }
  2202. }
  2203. },
  2204. accept: function accept(object) {
  2205. if (!object) {
  2206. return;
  2207. }
  2208. /* istanbul ignore next: Sanity code */
  2209. if (!this[object.type]) {
  2210. throw new _exception2['default']('Unknown type: ' + object.type, object);
  2211. }
  2212. if (this.current) {
  2213. this.parents.unshift(this.current);
  2214. }
  2215. this.current = object;
  2216. var ret = this[object.type](object);
  2217. this.current = this.parents.shift();
  2218. if (!this.mutating || ret) {
  2219. return ret;
  2220. } else if (ret !== false) {
  2221. return object;
  2222. }
  2223. },
  2224. Program: function Program(program) {
  2225. this.acceptArray(program.body);
  2226. },
  2227. MustacheStatement: visitSubExpression,
  2228. Decorator: visitSubExpression,
  2229. BlockStatement: visitBlock,
  2230. DecoratorBlock: visitBlock,
  2231. PartialStatement: visitPartial,
  2232. PartialBlockStatement: function PartialBlockStatement(partial) {
  2233. visitPartial.call(this, partial);
  2234. this.acceptKey(partial, 'program');
  2235. },
  2236. ContentStatement: function ContentStatement() /* content */{},
  2237. CommentStatement: function CommentStatement() /* comment */{},
  2238. SubExpression: visitSubExpression,
  2239. PathExpression: function PathExpression() /* path */{},
  2240. StringLiteral: function StringLiteral() /* string */{},
  2241. NumberLiteral: function NumberLiteral() /* number */{},
  2242. BooleanLiteral: function BooleanLiteral() /* bool */{},
  2243. UndefinedLiteral: function UndefinedLiteral() /* literal */{},
  2244. NullLiteral: function NullLiteral() /* literal */{},
  2245. Hash: function Hash(hash) {
  2246. this.acceptArray(hash.pairs);
  2247. },
  2248. HashPair: function HashPair(pair) {
  2249. this.acceptRequired(pair, 'value');
  2250. }
  2251. };
  2252. function visitSubExpression(mustache) {
  2253. this.acceptRequired(mustache, 'path');
  2254. this.acceptArray(mustache.params);
  2255. this.acceptKey(mustache, 'hash');
  2256. }
  2257. function visitBlock(block) {
  2258. visitSubExpression.call(this, block);
  2259. this.acceptKey(block, 'program');
  2260. this.acceptKey(block, 'inverse');
  2261. }
  2262. function visitPartial(partial) {
  2263. this.acceptRequired(partial, 'name');
  2264. this.acceptArray(partial.params);
  2265. this.acceptKey(partial, 'hash');
  2266. }
  2267. exports['default'] = Visitor;
  2268. module.exports = exports['default'];
  2269. /***/ }),
  2270. /* 40 */
  2271. /***/ (function(module, exports, __webpack_require__) {
  2272. 'use strict';
  2273. var _interopRequireDefault = __webpack_require__(1)['default'];
  2274. exports.__esModule = true;
  2275. exports.SourceLocation = SourceLocation;
  2276. exports.id = id;
  2277. exports.stripFlags = stripFlags;
  2278. exports.stripComment = stripComment;
  2279. exports.preparePath = preparePath;
  2280. exports.prepareMustache = prepareMustache;
  2281. exports.prepareRawBlock = prepareRawBlock;
  2282. exports.prepareBlock = prepareBlock;
  2283. exports.prepareProgram = prepareProgram;
  2284. exports.preparePartialBlock = preparePartialBlock;
  2285. var _exception = __webpack_require__(6);
  2286. var _exception2 = _interopRequireDefault(_exception);
  2287. function validateClose(open, close) {
  2288. close = close.path ? close.path.original : close;
  2289. if (open.path.original !== close) {
  2290. var errorNode = { loc: open.path.loc };
  2291. throw new _exception2['default'](open.path.original + " doesn't match " + close, errorNode);
  2292. }
  2293. }
  2294. function SourceLocation(source, locInfo) {
  2295. this.source = source;
  2296. this.start = {
  2297. line: locInfo.first_line,
  2298. column: locInfo.first_column
  2299. };
  2300. this.end = {
  2301. line: locInfo.last_line,
  2302. column: locInfo.last_column
  2303. };
  2304. }
  2305. function id(token) {
  2306. if (/^\[.*\]$/.test(token)) {
  2307. return token.substring(1, token.length - 1);
  2308. } else {
  2309. return token;
  2310. }
  2311. }
  2312. function stripFlags(open, close) {
  2313. return {
  2314. open: open.charAt(2) === '~',
  2315. close: close.charAt(close.length - 3) === '~'
  2316. };
  2317. }
  2318. function stripComment(comment) {
  2319. return comment.replace(/^\{\{~?!-?-?/, '').replace(/-?-?~?\}\}$/, '');
  2320. }
  2321. function preparePath(data, parts, loc) {
  2322. loc = this.locInfo(loc);
  2323. var original = data ? '@' : '',
  2324. dig = [],
  2325. depth = 0;
  2326. for (var i = 0, l = parts.length; i < l; i++) {
  2327. var part = parts[i].part,
  2328. // If we have [] syntax then we do not treat path references as operators,
  2329. // i.e. foo.[this] resolves to approximately context.foo['this']
  2330. isLiteral = parts[i].original !== part;
  2331. original += (parts[i].separator || '') + part;
  2332. if (!isLiteral && (part === '..' || part === '.' || part === 'this')) {
  2333. if (dig.length > 0) {
  2334. throw new _exception2['default']('Invalid path: ' + original, { loc: loc });
  2335. } else if (part === '..') {
  2336. depth++;
  2337. }
  2338. } else {
  2339. dig.push(part);
  2340. }
  2341. }
  2342. return {
  2343. type: 'PathExpression',
  2344. data: data,
  2345. depth: depth,
  2346. parts: dig,
  2347. original: original,
  2348. loc: loc
  2349. };
  2350. }
  2351. function prepareMustache(path, params, hash, open, strip, locInfo) {
  2352. // Must use charAt to support IE pre-10
  2353. var escapeFlag = open.charAt(3) || open.charAt(2),
  2354. escaped = escapeFlag !== '{' && escapeFlag !== '&';
  2355. var decorator = /\*/.test(open);
  2356. return {
  2357. type: decorator ? 'Decorator' : 'MustacheStatement',
  2358. path: path,
  2359. params: params,
  2360. hash: hash,
  2361. escaped: escaped,
  2362. strip: strip,
  2363. loc: this.locInfo(locInfo)
  2364. };
  2365. }
  2366. function prepareRawBlock(openRawBlock, contents, close, locInfo) {
  2367. validateClose(openRawBlock, close);
  2368. locInfo = this.locInfo(locInfo);
  2369. var program = {
  2370. type: 'Program',
  2371. body: contents,
  2372. strip: {},
  2373. loc: locInfo
  2374. };
  2375. return {
  2376. type: 'BlockStatement',
  2377. path: openRawBlock.path,
  2378. params: openRawBlock.params,
  2379. hash: openRawBlock.hash,
  2380. program: program,
  2381. openStrip: {},
  2382. inverseStrip: {},
  2383. closeStrip: {},
  2384. loc: locInfo
  2385. };
  2386. }
  2387. function prepareBlock(openBlock, program, inverseAndProgram, close, inverted, locInfo) {
  2388. if (close && close.path) {
  2389. validateClose(openBlock, close);
  2390. }
  2391. var decorator = /\*/.test(openBlock.open);
  2392. program.blockParams = openBlock.blockParams;
  2393. var inverse = undefined,
  2394. inverseStrip = undefined;
  2395. if (inverseAndProgram) {
  2396. if (decorator) {
  2397. throw new _exception2['default']('Unexpected inverse block on decorator', inverseAndProgram);
  2398. }
  2399. if (inverseAndProgram.chain) {
  2400. inverseAndProgram.program.body[0].closeStrip = close.strip;
  2401. }
  2402. inverseStrip = inverseAndProgram.strip;
  2403. inverse = inverseAndProgram.program;
  2404. }
  2405. if (inverted) {
  2406. inverted = inverse;
  2407. inverse = program;
  2408. program = inverted;
  2409. }
  2410. return {
  2411. type: decorator ? 'DecoratorBlock' : 'BlockStatement',
  2412. path: openBlock.path,
  2413. params: openBlock.params,
  2414. hash: openBlock.hash,
  2415. program: program,
  2416. inverse: inverse,
  2417. openStrip: openBlock.strip,
  2418. inverseStrip: inverseStrip,
  2419. closeStrip: close && close.strip,
  2420. loc: this.locInfo(locInfo)
  2421. };
  2422. }
  2423. function prepareProgram(statements, loc) {
  2424. if (!loc && statements.length) {
  2425. var firstLoc = statements[0].loc,
  2426. lastLoc = statements[statements.length - 1].loc;
  2427. /* istanbul ignore else */
  2428. if (firstLoc && lastLoc) {
  2429. loc = {
  2430. source: firstLoc.source,
  2431. start: {
  2432. line: firstLoc.start.line,
  2433. column: firstLoc.start.column
  2434. },
  2435. end: {
  2436. line: lastLoc.end.line,
  2437. column: lastLoc.end.column
  2438. }
  2439. };
  2440. }
  2441. }
  2442. return {
  2443. type: 'Program',
  2444. body: statements,
  2445. strip: {},
  2446. loc: loc
  2447. };
  2448. }
  2449. function preparePartialBlock(open, program, close, locInfo) {
  2450. validateClose(open, close);
  2451. return {
  2452. type: 'PartialBlockStatement',
  2453. name: open.path,
  2454. params: open.params,
  2455. hash: open.hash,
  2456. program: program,
  2457. openStrip: open.strip,
  2458. closeStrip: close && close.strip,
  2459. loc: this.locInfo(locInfo)
  2460. };
  2461. }
  2462. /***/ }),
  2463. /* 41 */
  2464. /***/ (function(module, exports, __webpack_require__) {
  2465. /* eslint-disable new-cap */
  2466. 'use strict';
  2467. var _interopRequireDefault = __webpack_require__(1)['default'];
  2468. exports.__esModule = true;
  2469. exports.Compiler = Compiler;
  2470. exports.precompile = precompile;
  2471. exports.compile = compile;
  2472. var _exception = __webpack_require__(6);
  2473. var _exception2 = _interopRequireDefault(_exception);
  2474. var _utils = __webpack_require__(5);
  2475. var _ast = __webpack_require__(35);
  2476. var _ast2 = _interopRequireDefault(_ast);
  2477. var slice = [].slice;
  2478. function Compiler() {}
  2479. // the foundHelper register will disambiguate helper lookup from finding a
  2480. // function in a context. This is necessary for mustache compatibility, which
  2481. // requires that context functions in blocks are evaluated by blockHelperMissing,
  2482. // and then proceed as if the resulting value was provided to blockHelperMissing.
  2483. Compiler.prototype = {
  2484. compiler: Compiler,
  2485. equals: function equals(other) {
  2486. var len = this.opcodes.length;
  2487. if (other.opcodes.length !== len) {
  2488. return false;
  2489. }
  2490. for (var i = 0; i < len; i++) {
  2491. var opcode = this.opcodes[i],
  2492. otherOpcode = other.opcodes[i];
  2493. if (opcode.opcode !== otherOpcode.opcode || !argEquals(opcode.args, otherOpcode.args)) {
  2494. return false;
  2495. }
  2496. }
  2497. // We know that length is the same between the two arrays because they are directly tied
  2498. // to the opcode behavior above.
  2499. len = this.children.length;
  2500. for (var i = 0; i < len; i++) {
  2501. if (!this.children[i].equals(other.children[i])) {
  2502. return false;
  2503. }
  2504. }
  2505. return true;
  2506. },
  2507. guid: 0,
  2508. compile: function compile(program, options) {
  2509. this.sourceNode = [];
  2510. this.opcodes = [];
  2511. this.children = [];
  2512. this.options = options;
  2513. this.stringParams = options.stringParams;
  2514. this.trackIds = options.trackIds;
  2515. options.blockParams = options.blockParams || [];
  2516. // These changes will propagate to the other compiler components
  2517. var knownHelpers = options.knownHelpers;
  2518. options.knownHelpers = {
  2519. 'helperMissing': true,
  2520. 'blockHelperMissing': true,
  2521. 'each': true,
  2522. 'if': true,
  2523. 'unless': true,
  2524. 'with': true,
  2525. 'log': true,
  2526. 'lookup': true
  2527. };
  2528. if (knownHelpers) {
  2529. // the next line should use "Object.keys", but the code has been like this a long time and changing it, might
  2530. // cause backwards-compatibility issues... It's an old library...
  2531. // eslint-disable-next-line guard-for-in
  2532. for (var _name in knownHelpers) {
  2533. this.options.knownHelpers[_name] = knownHelpers[_name];
  2534. }
  2535. }
  2536. return this.accept(program);
  2537. },
  2538. compileProgram: function compileProgram(program) {
  2539. var childCompiler = new this.compiler(),
  2540. // eslint-disable-line new-cap
  2541. result = childCompiler.compile(program, this.options),
  2542. guid = this.guid++;
  2543. this.usePartial = this.usePartial || result.usePartial;
  2544. this.children[guid] = result;
  2545. this.useDepths = this.useDepths || result.useDepths;
  2546. return guid;
  2547. },
  2548. accept: function accept(node) {
  2549. /* istanbul ignore next: Sanity code */
  2550. if (!this[node.type]) {
  2551. throw new _exception2['default']('Unknown type: ' + node.type, node);
  2552. }
  2553. this.sourceNode.unshift(node);
  2554. var ret = this[node.type](node);
  2555. this.sourceNode.shift();
  2556. return ret;
  2557. },
  2558. Program: function Program(program) {
  2559. this.options.blockParams.unshift(program.blockParams);
  2560. var body = program.body,
  2561. bodyLength = body.length;
  2562. for (var i = 0; i < bodyLength; i++) {
  2563. this.accept(body[i]);
  2564. }
  2565. this.options.blockParams.shift();
  2566. this.isSimple = bodyLength === 1;
  2567. this.blockParams = program.blockParams ? program.blockParams.length : 0;
  2568. return this;
  2569. },
  2570. BlockStatement: function BlockStatement(block) {
  2571. transformLiteralToPath(block);
  2572. var program = block.program,
  2573. inverse = block.inverse;
  2574. program = program && this.compileProgram(program);
  2575. inverse = inverse && this.compileProgram(inverse);
  2576. var type = this.classifySexpr(block);
  2577. if (type === 'helper') {
  2578. this.helperSexpr(block, program, inverse);
  2579. } else if (type === 'simple') {
  2580. this.simpleSexpr(block);
  2581. // now that the simple mustache is resolved, we need to
  2582. // evaluate it by executing `blockHelperMissing`
  2583. this.opcode('pushProgram', program);
  2584. this.opcode('pushProgram', inverse);
  2585. this.opcode('emptyHash');
  2586. this.opcode('blockValue', block.path.original);
  2587. } else {
  2588. this.ambiguousSexpr(block, program, inverse);
  2589. // now that the simple mustache is resolved, we need to
  2590. // evaluate it by executing `blockHelperMissing`
  2591. this.opcode('pushProgram', program);
  2592. this.opcode('pushProgram', inverse);
  2593. this.opcode('emptyHash');
  2594. this.opcode('ambiguousBlockValue');
  2595. }
  2596. this.opcode('append');
  2597. },
  2598. DecoratorBlock: function DecoratorBlock(decorator) {
  2599. var program = decorator.program && this.compileProgram(decorator.program);
  2600. var params = this.setupFullMustacheParams(decorator, program, undefined),
  2601. path = decorator.path;
  2602. this.useDecorators = true;
  2603. this.opcode('registerDecorator', params.length, path.original);
  2604. },
  2605. PartialStatement: function PartialStatement(partial) {
  2606. this.usePartial = true;
  2607. var program = partial.program;
  2608. if (program) {
  2609. program = this.compileProgram(partial.program);
  2610. }
  2611. var params = partial.params;
  2612. if (params.length > 1) {
  2613. throw new _exception2['default']('Unsupported number of partial arguments: ' + params.length, partial);
  2614. } else if (!params.length) {
  2615. if (this.options.explicitPartialContext) {
  2616. this.opcode('pushLiteral', 'undefined');
  2617. } else {
  2618. params.push({ type: 'PathExpression', parts: [], depth: 0 });
  2619. }
  2620. }
  2621. var partialName = partial.name.original,
  2622. isDynamic = partial.name.type === 'SubExpression';
  2623. if (isDynamic) {
  2624. this.accept(partial.name);
  2625. }
  2626. this.setupFullMustacheParams(partial, program, undefined, true);
  2627. var indent = partial.indent || '';
  2628. if (this.options.preventIndent && indent) {
  2629. this.opcode('appendContent', indent);
  2630. indent = '';
  2631. }
  2632. this.opcode('invokePartial', isDynamic, partialName, indent);
  2633. this.opcode('append');
  2634. },
  2635. PartialBlockStatement: function PartialBlockStatement(partialBlock) {
  2636. this.PartialStatement(partialBlock);
  2637. },
  2638. MustacheStatement: function MustacheStatement(mustache) {
  2639. this.SubExpression(mustache);
  2640. if (mustache.escaped && !this.options.noEscape) {
  2641. this.opcode('appendEscaped');
  2642. } else {
  2643. this.opcode('append');
  2644. }
  2645. },
  2646. Decorator: function Decorator(decorator) {
  2647. this.DecoratorBlock(decorator);
  2648. },
  2649. ContentStatement: function ContentStatement(content) {
  2650. if (content.value) {
  2651. this.opcode('appendContent', content.value);
  2652. }
  2653. },
  2654. CommentStatement: function CommentStatement() {},
  2655. SubExpression: function SubExpression(sexpr) {
  2656. transformLiteralToPath(sexpr);
  2657. var type = this.classifySexpr(sexpr);
  2658. if (type === 'simple') {
  2659. this.simpleSexpr(sexpr);
  2660. } else if (type === 'helper') {
  2661. this.helperSexpr(sexpr);
  2662. } else {
  2663. this.ambiguousSexpr(sexpr);
  2664. }
  2665. },
  2666. ambiguousSexpr: function ambiguousSexpr(sexpr, program, inverse) {
  2667. var path = sexpr.path,
  2668. name = path.parts[0],
  2669. isBlock = program != null || inverse != null;
  2670. this.opcode('getContext', path.depth);
  2671. this.opcode('pushProgram', program);
  2672. this.opcode('pushProgram', inverse);
  2673. path.strict = true;
  2674. this.accept(path);
  2675. this.opcode('invokeAmbiguous', name, isBlock);
  2676. },
  2677. simpleSexpr: function simpleSexpr(sexpr) {
  2678. var path = sexpr.path;
  2679. path.strict = true;
  2680. this.accept(path);
  2681. this.opcode('resolvePossibleLambda');
  2682. },
  2683. helperSexpr: function helperSexpr(sexpr, program, inverse) {
  2684. var params = this.setupFullMustacheParams(sexpr, program, inverse),
  2685. path = sexpr.path,
  2686. name = path.parts[0];
  2687. if (this.options.knownHelpers[name]) {
  2688. this.opcode('invokeKnownHelper', params.length, name);
  2689. } else if (this.options.knownHelpersOnly) {
  2690. throw new _exception2['default']('You specified knownHelpersOnly, but used the unknown helper ' + name, sexpr);
  2691. } else {
  2692. path.strict = true;
  2693. path.falsy = true;
  2694. this.accept(path);
  2695. this.opcode('invokeHelper', params.length, path.original, _ast2['default'].helpers.simpleId(path));
  2696. }
  2697. },
  2698. PathExpression: function PathExpression(path) {
  2699. this.addDepth(path.depth);
  2700. this.opcode('getContext', path.depth);
  2701. var name = path.parts[0],
  2702. scoped = _ast2['default'].helpers.scopedId(path),
  2703. blockParamId = !path.depth && !scoped && this.blockParamIndex(name);
  2704. if (blockParamId) {
  2705. this.opcode('lookupBlockParam', blockParamId, path.parts);
  2706. } else if (!name) {
  2707. // Context reference, i.e. `{{foo .}}` or `{{foo ..}}`
  2708. this.opcode('pushContext');
  2709. } else if (path.data) {
  2710. this.options.data = true;
  2711. this.opcode('lookupData', path.depth, path.parts, path.strict);
  2712. } else {
  2713. this.opcode('lookupOnContext', path.parts, path.falsy, path.strict, scoped);
  2714. }
  2715. },
  2716. StringLiteral: function StringLiteral(string) {
  2717. this.opcode('pushString', string.value);
  2718. },
  2719. NumberLiteral: function NumberLiteral(number) {
  2720. this.opcode('pushLiteral', number.value);
  2721. },
  2722. BooleanLiteral: function BooleanLiteral(bool) {
  2723. this.opcode('pushLiteral', bool.value);
  2724. },
  2725. UndefinedLiteral: function UndefinedLiteral() {
  2726. this.opcode('pushLiteral', 'undefined');
  2727. },
  2728. NullLiteral: function NullLiteral() {
  2729. this.opcode('pushLiteral', 'null');
  2730. },
  2731. Hash: function Hash(hash) {
  2732. var pairs = hash.pairs,
  2733. i = 0,
  2734. l = pairs.length;
  2735. this.opcode('pushHash');
  2736. for (; i < l; i++) {
  2737. this.pushParam(pairs[i].value);
  2738. }
  2739. while (i--) {
  2740. this.opcode('assignToHash', pairs[i].key);
  2741. }
  2742. this.opcode('popHash');
  2743. },
  2744. // HELPERS
  2745. opcode: function opcode(name) {
  2746. this.opcodes.push({ opcode: name, args: slice.call(arguments, 1), loc: this.sourceNode[0].loc });
  2747. },
  2748. addDepth: function addDepth(depth) {
  2749. if (!depth) {
  2750. return;
  2751. }
  2752. this.useDepths = true;
  2753. },
  2754. classifySexpr: function classifySexpr(sexpr) {
  2755. var isSimple = _ast2['default'].helpers.simpleId(sexpr.path);
  2756. var isBlockParam = isSimple && !!this.blockParamIndex(sexpr.path.parts[0]);
  2757. // a mustache is an eligible helper if:
  2758. // * its id is simple (a single part, not `this` or `..`)
  2759. var isHelper = !isBlockParam && _ast2['default'].helpers.helperExpression(sexpr);
  2760. // if a mustache is an eligible helper but not a definite
  2761. // helper, it is ambiguous, and will be resolved in a later
  2762. // pass or at runtime.
  2763. var isEligible = !isBlockParam && (isHelper || isSimple);
  2764. // if ambiguous, we can possibly resolve the ambiguity now
  2765. // An eligible helper is one that does not have a complex path, i.e. `this.foo`, `../foo` etc.
  2766. if (isEligible && !isHelper) {
  2767. var _name2 = sexpr.path.parts[0],
  2768. options = this.options;
  2769. if (options.knownHelpers[_name2]) {
  2770. isHelper = true;
  2771. } else if (options.knownHelpersOnly) {
  2772. isEligible = false;
  2773. }
  2774. }
  2775. if (isHelper) {
  2776. return 'helper';
  2777. } else if (isEligible) {
  2778. return 'ambiguous';
  2779. } else {
  2780. return 'simple';
  2781. }
  2782. },
  2783. pushParams: function pushParams(params) {
  2784. for (var i = 0, l = params.length; i < l; i++) {
  2785. this.pushParam(params[i]);
  2786. }
  2787. },
  2788. pushParam: function pushParam(val) {
  2789. var value = val.value != null ? val.value : val.original || '';
  2790. if (this.stringParams) {
  2791. if (value.replace) {
  2792. value = value.replace(/^(\.?\.\/)*/g, '').replace(/\//g, '.');
  2793. }
  2794. if (val.depth) {
  2795. this.addDepth(val.depth);
  2796. }
  2797. this.opcode('getContext', val.depth || 0);
  2798. this.opcode('pushStringParam', value, val.type);
  2799. if (val.type === 'SubExpression') {
  2800. // SubExpressions get evaluated and passed in
  2801. // in string params mode.
  2802. this.accept(val);
  2803. }
  2804. } else {
  2805. if (this.trackIds) {
  2806. var blockParamIndex = undefined;
  2807. if (val.parts && !_ast2['default'].helpers.scopedId(val) && !val.depth) {
  2808. blockParamIndex = this.blockParamIndex(val.parts[0]);
  2809. }
  2810. if (blockParamIndex) {
  2811. var blockParamChild = val.parts.slice(1).join('.');
  2812. this.opcode('pushId', 'BlockParam', blockParamIndex, blockParamChild);
  2813. } else {
  2814. value = val.original || value;
  2815. if (value.replace) {
  2816. value = value.replace(/^this(?:\.|$)/, '').replace(/^\.\//, '').replace(/^\.$/, '');
  2817. }
  2818. this.opcode('pushId', val.type, value);
  2819. }
  2820. }
  2821. this.accept(val);
  2822. }
  2823. },
  2824. setupFullMustacheParams: function setupFullMustacheParams(sexpr, program, inverse, omitEmpty) {
  2825. var params = sexpr.params;
  2826. this.pushParams(params);
  2827. this.opcode('pushProgram', program);
  2828. this.opcode('pushProgram', inverse);
  2829. if (sexpr.hash) {
  2830. this.accept(sexpr.hash);
  2831. } else {
  2832. this.opcode('emptyHash', omitEmpty);
  2833. }
  2834. return params;
  2835. },
  2836. blockParamIndex: function blockParamIndex(name) {
  2837. for (var depth = 0, len = this.options.blockParams.length; depth < len; depth++) {
  2838. var blockParams = this.options.blockParams[depth],
  2839. param = blockParams && _utils.indexOf(blockParams, name);
  2840. if (blockParams && param >= 0) {
  2841. return [depth, param];
  2842. }
  2843. }
  2844. }
  2845. };
  2846. function precompile(input, options, env) {
  2847. if (input == null || typeof input !== 'string' && input.type !== 'Program') {
  2848. throw new _exception2['default']('You must pass a string or Handlebars AST to Handlebars.precompile. You passed ' + input);
  2849. }
  2850. options = options || {};
  2851. if (!('data' in options)) {
  2852. options.data = true;
  2853. }
  2854. if (options.compat) {
  2855. options.useDepths = true;
  2856. }
  2857. var ast = env.parse(input, options),
  2858. environment = new env.Compiler().compile(ast, options);
  2859. return new env.JavaScriptCompiler().compile(environment, options);
  2860. }
  2861. function compile(input, options, env) {
  2862. if (options === undefined) options = {};
  2863. if (input == null || typeof input !== 'string' && input.type !== 'Program') {
  2864. throw new _exception2['default']('You must pass a string or Handlebars AST to Handlebars.compile. You passed ' + input);
  2865. }
  2866. options = _utils.extend({}, options);
  2867. if (!('data' in options)) {
  2868. options.data = true;
  2869. }
  2870. if (options.compat) {
  2871. options.useDepths = true;
  2872. }
  2873. var compiled = undefined;
  2874. function compileInput() {
  2875. var ast = env.parse(input, options),
  2876. environment = new env.Compiler().compile(ast, options),
  2877. templateSpec = new env.JavaScriptCompiler().compile(environment, options, undefined, true);
  2878. return env.template(templateSpec);
  2879. }
  2880. // Template is only compiled on first use and cached after that point.
  2881. function ret(context, execOptions) {
  2882. if (!compiled) {
  2883. compiled = compileInput();
  2884. }
  2885. return compiled.call(this, context, execOptions);
  2886. }
  2887. ret._setup = function (setupOptions) {
  2888. if (!compiled) {
  2889. compiled = compileInput();
  2890. }
  2891. return compiled._setup(setupOptions);
  2892. };
  2893. ret._child = function (i, data, blockParams, depths) {
  2894. if (!compiled) {
  2895. compiled = compileInput();
  2896. }
  2897. return compiled._child(i, data, blockParams, depths);
  2898. };
  2899. return ret;
  2900. }
  2901. function argEquals(a, b) {
  2902. if (a === b) {
  2903. return true;
  2904. }
  2905. if (_utils.isArray(a) && _utils.isArray(b) && a.length === b.length) {
  2906. for (var i = 0; i < a.length; i++) {
  2907. if (!argEquals(a[i], b[i])) {
  2908. return false;
  2909. }
  2910. }
  2911. return true;
  2912. }
  2913. }
  2914. function transformLiteralToPath(sexpr) {
  2915. if (!sexpr.path.parts) {
  2916. var literal = sexpr.path;
  2917. // Casting to string here to make false and 0 literal values play nicely with the rest
  2918. // of the system.
  2919. sexpr.path = {
  2920. type: 'PathExpression',
  2921. data: false,
  2922. depth: 0,
  2923. parts: [literal.original + ''],
  2924. original: literal.original + '',
  2925. loc: literal.loc
  2926. };
  2927. }
  2928. }
  2929. /***/ }),
  2930. /* 42 */
  2931. /***/ (function(module, exports, __webpack_require__) {
  2932. 'use strict';
  2933. var _interopRequireDefault = __webpack_require__(1)['default'];
  2934. exports.__esModule = true;
  2935. var _base = __webpack_require__(4);
  2936. var _exception = __webpack_require__(6);
  2937. var _exception2 = _interopRequireDefault(_exception);
  2938. var _utils = __webpack_require__(5);
  2939. var _codeGen = __webpack_require__(43);
  2940. var _codeGen2 = _interopRequireDefault(_codeGen);
  2941. function Literal(value) {
  2942. this.value = value;
  2943. }
  2944. function JavaScriptCompiler() {}
  2945. JavaScriptCompiler.prototype = {
  2946. // PUBLIC API: You can override these methods in a subclass to provide
  2947. // alternative compiled forms for name lookup and buffering semantics
  2948. nameLookup: function nameLookup(parent, name /* , type*/) {
  2949. if (name === 'constructor') {
  2950. return ['(', parent, '.propertyIsEnumerable(\'constructor\') ? ', parent, '.constructor : undefined', ')'];
  2951. }
  2952. if (JavaScriptCompiler.isValidJavaScriptVariableName(name)) {
  2953. return [parent, '.', name];
  2954. } else {
  2955. return [parent, '[', JSON.stringify(name), ']'];
  2956. }
  2957. },
  2958. depthedLookup: function depthedLookup(name) {
  2959. return [this.aliasable('container.lookup'), '(depths, "', name, '")'];
  2960. },
  2961. compilerInfo: function compilerInfo() {
  2962. var revision = _base.COMPILER_REVISION,
  2963. versions = _base.REVISION_CHANGES[revision];
  2964. return [revision, versions];
  2965. },
  2966. appendToBuffer: function appendToBuffer(source, location, explicit) {
  2967. // Force a source as this simplifies the merge logic.
  2968. if (!_utils.isArray(source)) {
  2969. source = [source];
  2970. }
  2971. source = this.source.wrap(source, location);
  2972. if (this.environment.isSimple) {
  2973. return ['return ', source, ';'];
  2974. } else if (explicit) {
  2975. // This is a case where the buffer operation occurs as a child of another
  2976. // construct, generally braces. We have to explicitly output these buffer
  2977. // operations to ensure that the emitted code goes in the correct location.
  2978. return ['buffer += ', source, ';'];
  2979. } else {
  2980. source.appendToBuffer = true;
  2981. return source;
  2982. }
  2983. },
  2984. initializeBuffer: function initializeBuffer() {
  2985. return this.quotedString('');
  2986. },
  2987. // END PUBLIC API
  2988. compile: function compile(environment, options, context, asObject) {
  2989. this.environment = environment;
  2990. this.options = options;
  2991. this.stringParams = this.options.stringParams;
  2992. this.trackIds = this.options.trackIds;
  2993. this.precompile = !asObject;
  2994. this.name = this.environment.name;
  2995. this.isChild = !!context;
  2996. this.context = context || {
  2997. decorators: [],
  2998. programs: [],
  2999. environments: []
  3000. };
  3001. this.preamble();
  3002. this.stackSlot = 0;
  3003. this.stackVars = [];
  3004. this.aliases = {};
  3005. this.registers = { list: [] };
  3006. this.hashes = [];
  3007. this.compileStack = [];
  3008. this.inlineStack = [];
  3009. this.blockParams = [];
  3010. this.compileChildren(environment, options);
  3011. this.useDepths = this.useDepths || environment.useDepths || environment.useDecorators || this.options.compat;
  3012. this.useBlockParams = this.useBlockParams || environment.useBlockParams;
  3013. var opcodes = environment.opcodes,
  3014. opcode = undefined,
  3015. firstLoc = undefined,
  3016. i = undefined,
  3017. l = undefined;
  3018. for (i = 0, l = opcodes.length; i < l; i++) {
  3019. opcode = opcodes[i];
  3020. this.source.currentLocation = opcode.loc;
  3021. firstLoc = firstLoc || opcode.loc;
  3022. this[opcode.opcode].apply(this, opcode.args);
  3023. }
  3024. // Flush any trailing content that might be pending.
  3025. this.source.currentLocation = firstLoc;
  3026. this.pushSource('');
  3027. /* istanbul ignore next */
  3028. if (this.stackSlot || this.inlineStack.length || this.compileStack.length) {
  3029. throw new _exception2['default']('Compile completed with content left on stack');
  3030. }
  3031. if (!this.decorators.isEmpty()) {
  3032. this.useDecorators = true;
  3033. this.decorators.prepend('var decorators = container.decorators;\n');
  3034. this.decorators.push('return fn;');
  3035. if (asObject) {
  3036. this.decorators = Function.apply(this, ['fn', 'props', 'container', 'depth0', 'data', 'blockParams', 'depths', this.decorators.merge()]);
  3037. } else {
  3038. this.decorators.prepend('function(fn, props, container, depth0, data, blockParams, depths) {\n');
  3039. this.decorators.push('}\n');
  3040. this.decorators = this.decorators.merge();
  3041. }
  3042. } else {
  3043. this.decorators = undefined;
  3044. }
  3045. var fn = this.createFunctionContext(asObject);
  3046. if (!this.isChild) {
  3047. var ret = {
  3048. compiler: this.compilerInfo(),
  3049. main: fn
  3050. };
  3051. if (this.decorators) {
  3052. ret.main_d = this.decorators; // eslint-disable-line camelcase
  3053. ret.useDecorators = true;
  3054. }
  3055. var _context = this.context;
  3056. var programs = _context.programs;
  3057. var decorators = _context.decorators;
  3058. for (i = 0, l = programs.length; i < l; i++) {
  3059. if (programs[i]) {
  3060. ret[i] = programs[i];
  3061. if (decorators[i]) {
  3062. ret[i + '_d'] = decorators[i];
  3063. ret.useDecorators = true;
  3064. }
  3065. }
  3066. }
  3067. if (this.environment.usePartial) {
  3068. ret.usePartial = true;
  3069. }
  3070. if (this.options.data) {
  3071. ret.useData = true;
  3072. }
  3073. if (this.useDepths) {
  3074. ret.useDepths = true;
  3075. }
  3076. if (this.useBlockParams) {
  3077. ret.useBlockParams = true;
  3078. }
  3079. if (this.options.compat) {
  3080. ret.compat = true;
  3081. }
  3082. if (!asObject) {
  3083. ret.compiler = JSON.stringify(ret.compiler);
  3084. this.source.currentLocation = { start: { line: 1, column: 0 } };
  3085. ret = this.objectLiteral(ret);
  3086. if (options.srcName) {
  3087. ret = ret.toStringWithSourceMap({ file: options.destName });
  3088. ret.map = ret.map && ret.map.toString();
  3089. } else {
  3090. ret = ret.toString();
  3091. }
  3092. } else {
  3093. ret.compilerOptions = this.options;
  3094. }
  3095. return ret;
  3096. } else {
  3097. return fn;
  3098. }
  3099. },
  3100. preamble: function preamble() {
  3101. // track the last context pushed into place to allow skipping the
  3102. // getContext opcode when it would be a noop
  3103. this.lastContext = 0;
  3104. this.source = new _codeGen2['default'](this.options.srcName);
  3105. this.decorators = new _codeGen2['default'](this.options.srcName);
  3106. },
  3107. createFunctionContext: function createFunctionContext(asObject) {
  3108. var varDeclarations = '';
  3109. var locals = this.stackVars.concat(this.registers.list);
  3110. if (locals.length > 0) {
  3111. varDeclarations += ', ' + locals.join(', ');
  3112. }
  3113. // Generate minimizer alias mappings
  3114. //
  3115. // When using true SourceNodes, this will update all references to the given alias
  3116. // as the source nodes are reused in situ. For the non-source node compilation mode,
  3117. // aliases will not be used, but this case is already being run on the client and
  3118. // we aren't concern about minimizing the template size.
  3119. var aliasCount = 0;
  3120. for (var alias in this.aliases) {
  3121. // eslint-disable-line guard-for-in
  3122. var node = this.aliases[alias];
  3123. if (this.aliases.hasOwnProperty(alias) && node.children && node.referenceCount > 1) {
  3124. varDeclarations += ', alias' + ++aliasCount + '=' + alias;
  3125. node.children[0] = 'alias' + aliasCount;
  3126. }
  3127. }
  3128. var params = ['container', 'depth0', 'helpers', 'partials', 'data'];
  3129. if (this.useBlockParams || this.useDepths) {
  3130. params.push('blockParams');
  3131. }
  3132. if (this.useDepths) {
  3133. params.push('depths');
  3134. }
  3135. // Perform a second pass over the output to merge content when possible
  3136. var source = this.mergeSource(varDeclarations);
  3137. if (asObject) {
  3138. params.push(source);
  3139. return Function.apply(this, params);
  3140. } else {
  3141. return this.source.wrap(['function(', params.join(','), ') {\n ', source, '}']);
  3142. }
  3143. },
  3144. mergeSource: function mergeSource(varDeclarations) {
  3145. var isSimple = this.environment.isSimple,
  3146. appendOnly = !this.forceBuffer,
  3147. appendFirst = undefined,
  3148. sourceSeen = undefined,
  3149. bufferStart = undefined,
  3150. bufferEnd = undefined;
  3151. this.source.each(function (line) {
  3152. if (line.appendToBuffer) {
  3153. if (bufferStart) {
  3154. line.prepend(' + ');
  3155. } else {
  3156. bufferStart = line;
  3157. }
  3158. bufferEnd = line;
  3159. } else {
  3160. if (bufferStart) {
  3161. if (!sourceSeen) {
  3162. appendFirst = true;
  3163. } else {
  3164. bufferStart.prepend('buffer += ');
  3165. }
  3166. bufferEnd.add(';');
  3167. bufferStart = bufferEnd = undefined;
  3168. }
  3169. sourceSeen = true;
  3170. if (!isSimple) {
  3171. appendOnly = false;
  3172. }
  3173. }
  3174. });
  3175. if (appendOnly) {
  3176. if (bufferStart) {
  3177. bufferStart.prepend('return ');
  3178. bufferEnd.add(';');
  3179. } else if (!sourceSeen) {
  3180. this.source.push('return "";');
  3181. }
  3182. } else {
  3183. varDeclarations += ', buffer = ' + (appendFirst ? '' : this.initializeBuffer());
  3184. if (bufferStart) {
  3185. bufferStart.prepend('return buffer + ');
  3186. bufferEnd.add(';');
  3187. } else {
  3188. this.source.push('return buffer;');
  3189. }
  3190. }
  3191. if (varDeclarations) {
  3192. this.source.prepend('var ' + varDeclarations.substring(2) + (appendFirst ? '' : ';\n'));
  3193. }
  3194. return this.source.merge();
  3195. },
  3196. // [blockValue]
  3197. //
  3198. // On stack, before: hash, inverse, program, value
  3199. // On stack, after: return value of blockHelperMissing
  3200. //
  3201. // The purpose of this opcode is to take a block of the form
  3202. // `{{#this.foo}}...{{/this.foo}}`, resolve the value of `foo`, and
  3203. // replace it on the stack with the result of properly
  3204. // invoking blockHelperMissing.
  3205. blockValue: function blockValue(name) {
  3206. var blockHelperMissing = this.aliasable('helpers.blockHelperMissing'),
  3207. params = [this.contextName(0)];
  3208. this.setupHelperArgs(name, 0, params);
  3209. var blockName = this.popStack();
  3210. params.splice(1, 0, blockName);
  3211. this.push(this.source.functionCall(blockHelperMissing, 'call', params));
  3212. },
  3213. // [ambiguousBlockValue]
  3214. //
  3215. // On stack, before: hash, inverse, program, value
  3216. // Compiler value, before: lastHelper=value of last found helper, if any
  3217. // On stack, after, if no lastHelper: same as [blockValue]
  3218. // On stack, after, if lastHelper: value
  3219. ambiguousBlockValue: function ambiguousBlockValue() {
  3220. // We're being a bit cheeky and reusing the options value from the prior exec
  3221. var blockHelperMissing = this.aliasable('helpers.blockHelperMissing'),
  3222. params = [this.contextName(0)];
  3223. this.setupHelperArgs('', 0, params, true);
  3224. this.flushInline();
  3225. var current = this.topStack();
  3226. params.splice(1, 0, current);
  3227. this.pushSource(['if (!', this.lastHelper, ') { ', current, ' = ', this.source.functionCall(blockHelperMissing, 'call', params), '}']);
  3228. },
  3229. // [appendContent]
  3230. //
  3231. // On stack, before: ...
  3232. // On stack, after: ...
  3233. //
  3234. // Appends the string value of `content` to the current buffer
  3235. appendContent: function appendContent(content) {
  3236. if (this.pendingContent) {
  3237. content = this.pendingContent + content;
  3238. } else {
  3239. this.pendingLocation = this.source.currentLocation;
  3240. }
  3241. this.pendingContent = content;
  3242. },
  3243. // [append]
  3244. //
  3245. // On stack, before: value, ...
  3246. // On stack, after: ...
  3247. //
  3248. // Coerces `value` to a String and appends it to the current buffer.
  3249. //
  3250. // If `value` is truthy, or 0, it is coerced into a string and appended
  3251. // Otherwise, the empty string is appended
  3252. append: function append() {
  3253. if (this.isInline()) {
  3254. this.replaceStack(function (current) {
  3255. return [' != null ? ', current, ' : ""'];
  3256. });
  3257. this.pushSource(this.appendToBuffer(this.popStack()));
  3258. } else {
  3259. var local = this.popStack();
  3260. this.pushSource(['if (', local, ' != null) { ', this.appendToBuffer(local, undefined, true), ' }']);
  3261. if (this.environment.isSimple) {
  3262. this.pushSource(['else { ', this.appendToBuffer("''", undefined, true), ' }']);
  3263. }
  3264. }
  3265. },
  3266. // [appendEscaped]
  3267. //
  3268. // On stack, before: value, ...
  3269. // On stack, after: ...
  3270. //
  3271. // Escape `value` and append it to the buffer
  3272. appendEscaped: function appendEscaped() {
  3273. this.pushSource(this.appendToBuffer([this.aliasable('container.escapeExpression'), '(', this.popStack(), ')']));
  3274. },
  3275. // [getContext]
  3276. //
  3277. // On stack, before: ...
  3278. // On stack, after: ...
  3279. // Compiler value, after: lastContext=depth
  3280. //
  3281. // Set the value of the `lastContext` compiler value to the depth
  3282. getContext: function getContext(depth) {
  3283. this.lastContext = depth;
  3284. },
  3285. // [pushContext]
  3286. //
  3287. // On stack, before: ...
  3288. // On stack, after: currentContext, ...
  3289. //
  3290. // Pushes the value of the current context onto the stack.
  3291. pushContext: function pushContext() {
  3292. this.pushStackLiteral(this.contextName(this.lastContext));
  3293. },
  3294. // [lookupOnContext]
  3295. //
  3296. // On stack, before: ...
  3297. // On stack, after: currentContext[name], ...
  3298. //
  3299. // Looks up the value of `name` on the current context and pushes
  3300. // it onto the stack.
  3301. lookupOnContext: function lookupOnContext(parts, falsy, strict, scoped) {
  3302. var i = 0;
  3303. if (!scoped && this.options.compat && !this.lastContext) {
  3304. // The depthed query is expected to handle the undefined logic for the root level that
  3305. // is implemented below, so we evaluate that directly in compat mode
  3306. this.push(this.depthedLookup(parts[i++]));
  3307. } else {
  3308. this.pushContext();
  3309. }
  3310. this.resolvePath('context', parts, i, falsy, strict);
  3311. },
  3312. // [lookupBlockParam]
  3313. //
  3314. // On stack, before: ...
  3315. // On stack, after: blockParam[name], ...
  3316. //
  3317. // Looks up the value of `parts` on the given block param and pushes
  3318. // it onto the stack.
  3319. lookupBlockParam: function lookupBlockParam(blockParamId, parts) {
  3320. this.useBlockParams = true;
  3321. this.push(['blockParams[', blockParamId[0], '][', blockParamId[1], ']']);
  3322. this.resolvePath('context', parts, 1);
  3323. },
  3324. // [lookupData]
  3325. //
  3326. // On stack, before: ...
  3327. // On stack, after: data, ...
  3328. //
  3329. // Push the data lookup operator
  3330. lookupData: function lookupData(depth, parts, strict) {
  3331. if (!depth) {
  3332. this.pushStackLiteral('data');
  3333. } else {
  3334. this.pushStackLiteral('container.data(data, ' + depth + ')');
  3335. }
  3336. this.resolvePath('data', parts, 0, true, strict);
  3337. },
  3338. resolvePath: function resolvePath(type, parts, i, falsy, strict) {
  3339. // istanbul ignore next
  3340. var _this = this;
  3341. if (this.options.strict || this.options.assumeObjects) {
  3342. this.push(strictLookup(this.options.strict && strict, this, parts, type));
  3343. return;
  3344. }
  3345. var len = parts.length;
  3346. for (; i < len; i++) {
  3347. /* eslint-disable no-loop-func */
  3348. this.replaceStack(function (current) {
  3349. var lookup = _this.nameLookup(current, parts[i], type);
  3350. // We want to ensure that zero and false are handled properly if the context (falsy flag)
  3351. // needs to have the special handling for these values.
  3352. if (!falsy) {
  3353. return [' != null ? ', lookup, ' : ', current];
  3354. } else {
  3355. // Otherwise we can use generic falsy handling
  3356. return [' && ', lookup];
  3357. }
  3358. });
  3359. /* eslint-enable no-loop-func */
  3360. }
  3361. },
  3362. // [resolvePossibleLambda]
  3363. //
  3364. // On stack, before: value, ...
  3365. // On stack, after: resolved value, ...
  3366. //
  3367. // If the `value` is a lambda, replace it on the stack by
  3368. // the return value of the lambda
  3369. resolvePossibleLambda: function resolvePossibleLambda() {
  3370. this.push([this.aliasable('container.lambda'), '(', this.popStack(), ', ', this.contextName(0), ')']);
  3371. },
  3372. // [pushStringParam]
  3373. //
  3374. // On stack, before: ...
  3375. // On stack, after: string, currentContext, ...
  3376. //
  3377. // This opcode is designed for use in string mode, which
  3378. // provides the string value of a parameter along with its
  3379. // depth rather than resolving it immediately.
  3380. pushStringParam: function pushStringParam(string, type) {
  3381. this.pushContext();
  3382. this.pushString(type);
  3383. // If it's a subexpression, the string result
  3384. // will be pushed after this opcode.
  3385. if (type !== 'SubExpression') {
  3386. if (typeof string === 'string') {
  3387. this.pushString(string);
  3388. } else {
  3389. this.pushStackLiteral(string);
  3390. }
  3391. }
  3392. },
  3393. emptyHash: function emptyHash(omitEmpty) {
  3394. if (this.trackIds) {
  3395. this.push('{}'); // hashIds
  3396. }
  3397. if (this.stringParams) {
  3398. this.push('{}'); // hashContexts
  3399. this.push('{}'); // hashTypes
  3400. }
  3401. this.pushStackLiteral(omitEmpty ? 'undefined' : '{}');
  3402. },
  3403. pushHash: function pushHash() {
  3404. if (this.hash) {
  3405. this.hashes.push(this.hash);
  3406. }
  3407. this.hash = { values: [], types: [], contexts: [], ids: [] };
  3408. },
  3409. popHash: function popHash() {
  3410. var hash = this.hash;
  3411. this.hash = this.hashes.pop();
  3412. if (this.trackIds) {
  3413. this.push(this.objectLiteral(hash.ids));
  3414. }
  3415. if (this.stringParams) {
  3416. this.push(this.objectLiteral(hash.contexts));
  3417. this.push(this.objectLiteral(hash.types));
  3418. }
  3419. this.push(this.objectLiteral(hash.values));
  3420. },
  3421. // [pushString]
  3422. //
  3423. // On stack, before: ...
  3424. // On stack, after: quotedString(string), ...
  3425. //
  3426. // Push a quoted version of `string` onto the stack
  3427. pushString: function pushString(string) {
  3428. this.pushStackLiteral(this.quotedString(string));
  3429. },
  3430. // [pushLiteral]
  3431. //
  3432. // On stack, before: ...
  3433. // On stack, after: value, ...
  3434. //
  3435. // Pushes a value onto the stack. This operation prevents
  3436. // the compiler from creating a temporary variable to hold
  3437. // it.
  3438. pushLiteral: function pushLiteral(value) {
  3439. this.pushStackLiteral(value);
  3440. },
  3441. // [pushProgram]
  3442. //
  3443. // On stack, before: ...
  3444. // On stack, after: program(guid), ...
  3445. //
  3446. // Push a program expression onto the stack. This takes
  3447. // a compile-time guid and converts it into a runtime-accessible
  3448. // expression.
  3449. pushProgram: function pushProgram(guid) {
  3450. if (guid != null) {
  3451. this.pushStackLiteral(this.programExpression(guid));
  3452. } else {
  3453. this.pushStackLiteral(null);
  3454. }
  3455. },
  3456. // [registerDecorator]
  3457. //
  3458. // On stack, before: hash, program, params..., ...
  3459. // On stack, after: ...
  3460. //
  3461. // Pops off the decorator's parameters, invokes the decorator,
  3462. // and inserts the decorator into the decorators list.
  3463. registerDecorator: function registerDecorator(paramSize, name) {
  3464. var foundDecorator = this.nameLookup('decorators', name, 'decorator'),
  3465. options = this.setupHelperArgs(name, paramSize);
  3466. this.decorators.push(['fn = ', this.decorators.functionCall(foundDecorator, '', ['fn', 'props', 'container', options]), ' || fn;']);
  3467. },
  3468. // [invokeHelper]
  3469. //
  3470. // On stack, before: hash, inverse, program, params..., ...
  3471. // On stack, after: result of helper invocation
  3472. //
  3473. // Pops off the helper's parameters, invokes the helper,
  3474. // and pushes the helper's return value onto the stack.
  3475. //
  3476. // If the helper is not found, `helperMissing` is called.
  3477. invokeHelper: function invokeHelper(paramSize, name, isSimple) {
  3478. var nonHelper = this.popStack(),
  3479. helper = this.setupHelper(paramSize, name),
  3480. simple = isSimple ? [helper.name, ' || '] : '';
  3481. var lookup = ['('].concat(simple, nonHelper);
  3482. if (!this.options.strict) {
  3483. lookup.push(' || ', this.aliasable('helpers.helperMissing'));
  3484. }
  3485. lookup.push(')');
  3486. this.push(this.source.functionCall(lookup, 'call', helper.callParams));
  3487. },
  3488. // [invokeKnownHelper]
  3489. //
  3490. // On stack, before: hash, inverse, program, params..., ...
  3491. // On stack, after: result of helper invocation
  3492. //
  3493. // This operation is used when the helper is known to exist,
  3494. // so a `helperMissing` fallback is not required.
  3495. invokeKnownHelper: function invokeKnownHelper(paramSize, name) {
  3496. var helper = this.setupHelper(paramSize, name);
  3497. this.push(this.source.functionCall(helper.name, 'call', helper.callParams));
  3498. },
  3499. // [invokeAmbiguous]
  3500. //
  3501. // On stack, before: hash, inverse, program, params..., ...
  3502. // On stack, after: result of disambiguation
  3503. //
  3504. // This operation is used when an expression like `{{foo}}`
  3505. // is provided, but we don't know at compile-time whether it
  3506. // is a helper or a path.
  3507. //
  3508. // This operation emits more code than the other options,
  3509. // and can be avoided by passing the `knownHelpers` and
  3510. // `knownHelpersOnly` flags at compile-time.
  3511. invokeAmbiguous: function invokeAmbiguous(name, helperCall) {
  3512. this.useRegister('helper');
  3513. var nonHelper = this.popStack();
  3514. this.emptyHash();
  3515. var helper = this.setupHelper(0, name, helperCall);
  3516. var helperName = this.lastHelper = this.nameLookup('helpers', name, 'helper');
  3517. var lookup = ['(', '(helper = ', helperName, ' || ', nonHelper, ')'];
  3518. if (!this.options.strict) {
  3519. lookup[0] = '(helper = ';
  3520. lookup.push(' != null ? helper : ', this.aliasable('helpers.helperMissing'));
  3521. }
  3522. this.push(['(', lookup, helper.paramsInit ? ['),(', helper.paramsInit] : [], '),', '(typeof helper === ', this.aliasable('"function"'), ' ? ', this.source.functionCall('helper', 'call', helper.callParams), ' : helper))']);
  3523. },
  3524. // [invokePartial]
  3525. //
  3526. // On stack, before: context, ...
  3527. // On stack after: result of partial invocation
  3528. //
  3529. // This operation pops off a context, invokes a partial with that context,
  3530. // and pushes the result of the invocation back.
  3531. invokePartial: function invokePartial(isDynamic, name, indent) {
  3532. var params = [],
  3533. options = this.setupParams(name, 1, params);
  3534. if (isDynamic) {
  3535. name = this.popStack();
  3536. delete options.name;
  3537. }
  3538. if (indent) {
  3539. options.indent = JSON.stringify(indent);
  3540. }
  3541. options.helpers = 'helpers';
  3542. options.partials = 'partials';
  3543. options.decorators = 'container.decorators';
  3544. if (!isDynamic) {
  3545. params.unshift(this.nameLookup('partials', name, 'partial'));
  3546. } else {
  3547. params.unshift(name);
  3548. }
  3549. if (this.options.compat) {
  3550. options.depths = 'depths';
  3551. }
  3552. options = this.objectLiteral(options);
  3553. params.push(options);
  3554. this.push(this.source.functionCall('container.invokePartial', '', params));
  3555. },
  3556. // [assignToHash]
  3557. //
  3558. // On stack, before: value, ..., hash, ...
  3559. // On stack, after: ..., hash, ...
  3560. //
  3561. // Pops a value off the stack and assigns it to the current hash
  3562. assignToHash: function assignToHash(key) {
  3563. var value = this.popStack(),
  3564. context = undefined,
  3565. type = undefined,
  3566. id = undefined;
  3567. if (this.trackIds) {
  3568. id = this.popStack();
  3569. }
  3570. if (this.stringParams) {
  3571. type = this.popStack();
  3572. context = this.popStack();
  3573. }
  3574. var hash = this.hash;
  3575. if (context) {
  3576. hash.contexts[key] = context;
  3577. }
  3578. if (type) {
  3579. hash.types[key] = type;
  3580. }
  3581. if (id) {
  3582. hash.ids[key] = id;
  3583. }
  3584. hash.values[key] = value;
  3585. },
  3586. pushId: function pushId(type, name, child) {
  3587. if (type === 'BlockParam') {
  3588. this.pushStackLiteral('blockParams[' + name[0] + '].path[' + name[1] + ']' + (child ? ' + ' + JSON.stringify('.' + child) : ''));
  3589. } else if (type === 'PathExpression') {
  3590. this.pushString(name);
  3591. } else if (type === 'SubExpression') {
  3592. this.pushStackLiteral('true');
  3593. } else {
  3594. this.pushStackLiteral('null');
  3595. }
  3596. },
  3597. // HELPERS
  3598. compiler: JavaScriptCompiler,
  3599. compileChildren: function compileChildren(environment, options) {
  3600. var children = environment.children,
  3601. child = undefined,
  3602. compiler = undefined;
  3603. for (var i = 0, l = children.length; i < l; i++) {
  3604. child = children[i];
  3605. compiler = new this.compiler(); // eslint-disable-line new-cap
  3606. var existing = this.matchExistingProgram(child);
  3607. if (existing == null) {
  3608. this.context.programs.push(''); // Placeholder to prevent name conflicts for nested children
  3609. var index = this.context.programs.length;
  3610. child.index = index;
  3611. child.name = 'program' + index;
  3612. this.context.programs[index] = compiler.compile(child, options, this.context, !this.precompile);
  3613. this.context.decorators[index] = compiler.decorators;
  3614. this.context.environments[index] = child;
  3615. this.useDepths = this.useDepths || compiler.useDepths;
  3616. this.useBlockParams = this.useBlockParams || compiler.useBlockParams;
  3617. child.useDepths = this.useDepths;
  3618. child.useBlockParams = this.useBlockParams;
  3619. } else {
  3620. child.index = existing.index;
  3621. child.name = 'program' + existing.index;
  3622. this.useDepths = this.useDepths || existing.useDepths;
  3623. this.useBlockParams = this.useBlockParams || existing.useBlockParams;
  3624. }
  3625. }
  3626. },
  3627. matchExistingProgram: function matchExistingProgram(child) {
  3628. for (var i = 0, len = this.context.environments.length; i < len; i++) {
  3629. var environment = this.context.environments[i];
  3630. if (environment && environment.equals(child)) {
  3631. return environment;
  3632. }
  3633. }
  3634. },
  3635. programExpression: function programExpression(guid) {
  3636. var child = this.environment.children[guid],
  3637. programParams = [child.index, 'data', child.blockParams];
  3638. if (this.useBlockParams || this.useDepths) {
  3639. programParams.push('blockParams');
  3640. }
  3641. if (this.useDepths) {
  3642. programParams.push('depths');
  3643. }
  3644. return 'container.program(' + programParams.join(', ') + ')';
  3645. },
  3646. useRegister: function useRegister(name) {
  3647. if (!this.registers[name]) {
  3648. this.registers[name] = true;
  3649. this.registers.list.push(name);
  3650. }
  3651. },
  3652. push: function push(expr) {
  3653. if (!(expr instanceof Literal)) {
  3654. expr = this.source.wrap(expr);
  3655. }
  3656. this.inlineStack.push(expr);
  3657. return expr;
  3658. },
  3659. pushStackLiteral: function pushStackLiteral(item) {
  3660. this.push(new Literal(item));
  3661. },
  3662. pushSource: function pushSource(source) {
  3663. if (this.pendingContent) {
  3664. this.source.push(this.appendToBuffer(this.source.quotedString(this.pendingContent), this.pendingLocation));
  3665. this.pendingContent = undefined;
  3666. }
  3667. if (source) {
  3668. this.source.push(source);
  3669. }
  3670. },
  3671. replaceStack: function replaceStack(callback) {
  3672. var prefix = ['('],
  3673. stack = undefined,
  3674. createdStack = undefined,
  3675. usedLiteral = undefined;
  3676. /* istanbul ignore next */
  3677. if (!this.isInline()) {
  3678. throw new _exception2['default']('replaceStack on non-inline');
  3679. }
  3680. // We want to merge the inline statement into the replacement statement via ','
  3681. var top = this.popStack(true);
  3682. if (top instanceof Literal) {
  3683. // Literals do not need to be inlined
  3684. stack = [top.value];
  3685. prefix = ['(', stack];
  3686. usedLiteral = true;
  3687. } else {
  3688. // Get or create the current stack name for use by the inline
  3689. createdStack = true;
  3690. var _name = this.incrStack();
  3691. prefix = ['((', this.push(_name), ' = ', top, ')'];
  3692. stack = this.topStack();
  3693. }
  3694. var item = callback.call(this, stack);
  3695. if (!usedLiteral) {
  3696. this.popStack();
  3697. }
  3698. if (createdStack) {
  3699. this.stackSlot--;
  3700. }
  3701. this.push(prefix.concat(item, ')'));
  3702. },
  3703. incrStack: function incrStack() {
  3704. this.stackSlot++;
  3705. if (this.stackSlot > this.stackVars.length) {
  3706. this.stackVars.push('stack' + this.stackSlot);
  3707. }
  3708. return this.topStackName();
  3709. },
  3710. topStackName: function topStackName() {
  3711. return 'stack' + this.stackSlot;
  3712. },
  3713. flushInline: function flushInline() {
  3714. var inlineStack = this.inlineStack;
  3715. this.inlineStack = [];
  3716. for (var i = 0, len = inlineStack.length; i < len; i++) {
  3717. var entry = inlineStack[i];
  3718. /* istanbul ignore if */
  3719. if (entry instanceof Literal) {
  3720. this.compileStack.push(entry);
  3721. } else {
  3722. var stack = this.incrStack();
  3723. this.pushSource([stack, ' = ', entry, ';']);
  3724. this.compileStack.push(stack);
  3725. }
  3726. }
  3727. },
  3728. isInline: function isInline() {
  3729. return this.inlineStack.length;
  3730. },
  3731. popStack: function popStack(wrapped) {
  3732. var inline = this.isInline(),
  3733. item = (inline ? this.inlineStack : this.compileStack).pop();
  3734. if (!wrapped && item instanceof Literal) {
  3735. return item.value;
  3736. } else {
  3737. if (!inline) {
  3738. /* istanbul ignore next */
  3739. if (!this.stackSlot) {
  3740. throw new _exception2['default']('Invalid stack pop');
  3741. }
  3742. this.stackSlot--;
  3743. }
  3744. return item;
  3745. }
  3746. },
  3747. topStack: function topStack() {
  3748. var stack = this.isInline() ? this.inlineStack : this.compileStack,
  3749. item = stack[stack.length - 1];
  3750. /* istanbul ignore if */
  3751. if (item instanceof Literal) {
  3752. return item.value;
  3753. } else {
  3754. return item;
  3755. }
  3756. },
  3757. contextName: function contextName(context) {
  3758. if (this.useDepths && context) {
  3759. return 'depths[' + context + ']';
  3760. } else {
  3761. return 'depth' + context;
  3762. }
  3763. },
  3764. quotedString: function quotedString(str) {
  3765. return this.source.quotedString(str);
  3766. },
  3767. objectLiteral: function objectLiteral(obj) {
  3768. return this.source.objectLiteral(obj);
  3769. },
  3770. aliasable: function aliasable(name) {
  3771. var ret = this.aliases[name];
  3772. if (ret) {
  3773. ret.referenceCount++;
  3774. return ret;
  3775. }
  3776. ret = this.aliases[name] = this.source.wrap(name);
  3777. ret.aliasable = true;
  3778. ret.referenceCount = 1;
  3779. return ret;
  3780. },
  3781. setupHelper: function setupHelper(paramSize, name, blockHelper) {
  3782. var params = [],
  3783. paramsInit = this.setupHelperArgs(name, paramSize, params, blockHelper);
  3784. var foundHelper = this.nameLookup('helpers', name, 'helper'),
  3785. callContext = this.aliasable(this.contextName(0) + ' != null ? ' + this.contextName(0) + ' : (container.nullContext || {})');
  3786. return {
  3787. params: params,
  3788. paramsInit: paramsInit,
  3789. name: foundHelper,
  3790. callParams: [callContext].concat(params)
  3791. };
  3792. },
  3793. setupParams: function setupParams(helper, paramSize, params) {
  3794. var options = {},
  3795. contexts = [],
  3796. types = [],
  3797. ids = [],
  3798. objectArgs = !params,
  3799. param = undefined;
  3800. if (objectArgs) {
  3801. params = [];
  3802. }
  3803. options.name = this.quotedString(helper);
  3804. options.hash = this.popStack();
  3805. if (this.trackIds) {
  3806. options.hashIds = this.popStack();
  3807. }
  3808. if (this.stringParams) {
  3809. options.hashTypes = this.popStack();
  3810. options.hashContexts = this.popStack();
  3811. }
  3812. var inverse = this.popStack(),
  3813. program = this.popStack();
  3814. // Avoid setting fn and inverse if neither are set. This allows
  3815. // helpers to do a check for `if (options.fn)`
  3816. if (program || inverse) {
  3817. options.fn = program || 'container.noop';
  3818. options.inverse = inverse || 'container.noop';
  3819. }
  3820. // The parameters go on to the stack in order (making sure that they are evaluated in order)
  3821. // so we need to pop them off the stack in reverse order
  3822. var i = paramSize;
  3823. while (i--) {
  3824. param = this.popStack();
  3825. params[i] = param;
  3826. if (this.trackIds) {
  3827. ids[i] = this.popStack();
  3828. }
  3829. if (this.stringParams) {
  3830. types[i] = this.popStack();
  3831. contexts[i] = this.popStack();
  3832. }
  3833. }
  3834. if (objectArgs) {
  3835. options.args = this.source.generateArray(params);
  3836. }
  3837. if (this.trackIds) {
  3838. options.ids = this.source.generateArray(ids);
  3839. }
  3840. if (this.stringParams) {
  3841. options.types = this.source.generateArray(types);
  3842. options.contexts = this.source.generateArray(contexts);
  3843. }
  3844. if (this.options.data) {
  3845. options.data = 'data';
  3846. }
  3847. if (this.useBlockParams) {
  3848. options.blockParams = 'blockParams';
  3849. }
  3850. return options;
  3851. },
  3852. setupHelperArgs: function setupHelperArgs(helper, paramSize, params, useRegister) {
  3853. var options = this.setupParams(helper, paramSize, params);
  3854. options = this.objectLiteral(options);
  3855. if (useRegister) {
  3856. this.useRegister('options');
  3857. params.push('options');
  3858. return ['options=', options];
  3859. } else if (params) {
  3860. params.push(options);
  3861. return '';
  3862. } else {
  3863. return options;
  3864. }
  3865. }
  3866. };
  3867. (function () {
  3868. var reservedWords = ('break else new var' + ' case finally return void' + ' catch for switch while' + ' continue function this with' + ' default if throw' + ' delete in try' + ' do instanceof typeof' + ' abstract enum int short' + ' boolean export interface static' + ' byte extends long super' + ' char final native synchronized' + ' class float package throws' + ' const goto private transient' + ' debugger implements protected volatile' + ' double import public let yield await' + ' null true false').split(' ');
  3869. var compilerWords = JavaScriptCompiler.RESERVED_WORDS = {};
  3870. for (var i = 0, l = reservedWords.length; i < l; i++) {
  3871. compilerWords[reservedWords[i]] = true;
  3872. }
  3873. })();
  3874. JavaScriptCompiler.isValidJavaScriptVariableName = function (name) {
  3875. return !JavaScriptCompiler.RESERVED_WORDS[name] && /^[a-zA-Z_$][0-9a-zA-Z_$]*$/.test(name);
  3876. };
  3877. function strictLookup(requireTerminal, compiler, parts, type) {
  3878. var stack = compiler.popStack(),
  3879. i = 0,
  3880. len = parts.length;
  3881. if (requireTerminal) {
  3882. len--;
  3883. }
  3884. for (; i < len; i++) {
  3885. stack = compiler.nameLookup(stack, parts[i], type);
  3886. }
  3887. if (requireTerminal) {
  3888. return [compiler.aliasable('container.strict'), '(', stack, ', ', compiler.quotedString(parts[i]), ')'];
  3889. } else {
  3890. return stack;
  3891. }
  3892. }
  3893. exports['default'] = JavaScriptCompiler;
  3894. module.exports = exports['default'];
  3895. /***/ }),
  3896. /* 43 */
  3897. /***/ (function(module, exports, __webpack_require__) {
  3898. /* global define */
  3899. 'use strict';
  3900. exports.__esModule = true;
  3901. var _utils = __webpack_require__(5);
  3902. var SourceNode = undefined;
  3903. try {
  3904. /* istanbul ignore next */
  3905. if (false) {
  3906. // We don't support this in AMD environments. For these environments, we asusme that
  3907. // they are running on the browser and thus have no need for the source-map library.
  3908. var SourceMap = require('source-map');
  3909. SourceNode = SourceMap.SourceNode;
  3910. }
  3911. } catch (err) {}
  3912. /* NOP */
  3913. /* istanbul ignore if: tested but not covered in istanbul due to dist build */
  3914. if (!SourceNode) {
  3915. SourceNode = function (line, column, srcFile, chunks) {
  3916. this.src = '';
  3917. if (chunks) {
  3918. this.add(chunks);
  3919. }
  3920. };
  3921. /* istanbul ignore next */
  3922. SourceNode.prototype = {
  3923. add: function add(chunks) {
  3924. if (_utils.isArray(chunks)) {
  3925. chunks = chunks.join('');
  3926. }
  3927. this.src += chunks;
  3928. },
  3929. prepend: function prepend(chunks) {
  3930. if (_utils.isArray(chunks)) {
  3931. chunks = chunks.join('');
  3932. }
  3933. this.src = chunks + this.src;
  3934. },
  3935. toStringWithSourceMap: function toStringWithSourceMap() {
  3936. return { code: this.toString() };
  3937. },
  3938. toString: function toString() {
  3939. return this.src;
  3940. }
  3941. };
  3942. }
  3943. function castChunk(chunk, codeGen, loc) {
  3944. if (_utils.isArray(chunk)) {
  3945. var ret = [];
  3946. for (var i = 0, len = chunk.length; i < len; i++) {
  3947. ret.push(codeGen.wrap(chunk[i], loc));
  3948. }
  3949. return ret;
  3950. } else if (typeof chunk === 'boolean' || typeof chunk === 'number') {
  3951. // Handle primitives that the SourceNode will throw up on
  3952. return chunk + '';
  3953. }
  3954. return chunk;
  3955. }
  3956. function CodeGen(srcFile) {
  3957. this.srcFile = srcFile;
  3958. this.source = [];
  3959. }
  3960. CodeGen.prototype = {
  3961. isEmpty: function isEmpty() {
  3962. return !this.source.length;
  3963. },
  3964. prepend: function prepend(source, loc) {
  3965. this.source.unshift(this.wrap(source, loc));
  3966. },
  3967. push: function push(source, loc) {
  3968. this.source.push(this.wrap(source, loc));
  3969. },
  3970. merge: function merge() {
  3971. var source = this.empty();
  3972. this.each(function (line) {
  3973. source.add([' ', line, '\n']);
  3974. });
  3975. return source;
  3976. },
  3977. each: function each(iter) {
  3978. for (var i = 0, len = this.source.length; i < len; i++) {
  3979. iter(this.source[i]);
  3980. }
  3981. },
  3982. empty: function empty() {
  3983. var loc = this.currentLocation || { start: {} };
  3984. return new SourceNode(loc.start.line, loc.start.column, this.srcFile);
  3985. },
  3986. wrap: function wrap(chunk) {
  3987. var loc = arguments.length <= 1 || arguments[1] === undefined ? this.currentLocation || { start: {} } : arguments[1];
  3988. if (chunk instanceof SourceNode) {
  3989. return chunk;
  3990. }
  3991. chunk = castChunk(chunk, this, loc);
  3992. return new SourceNode(loc.start.line, loc.start.column, this.srcFile, chunk);
  3993. },
  3994. functionCall: function functionCall(fn, type, params) {
  3995. params = this.generateList(params);
  3996. return this.wrap([fn, type ? '.' + type + '(' : '(', params, ')']);
  3997. },
  3998. quotedString: function quotedString(str) {
  3999. return '"' + (str + '').replace(/\\/g, '\\\\').replace(/"/g, '\\"').replace(/\n/g, '\\n').replace(/\r/g, '\\r').replace(/\u2028/g, '\\u2028') // Per Ecma-262 7.3 + 7.8.4
  4000. .replace(/\u2029/g, '\\u2029') + '"';
  4001. },
  4002. objectLiteral: function objectLiteral(obj) {
  4003. var pairs = [];
  4004. for (var key in obj) {
  4005. if (obj.hasOwnProperty(key)) {
  4006. var value = castChunk(obj[key], this);
  4007. if (value !== 'undefined') {
  4008. pairs.push([this.quotedString(key), ':', value]);
  4009. }
  4010. }
  4011. }
  4012. var ret = this.generateList(pairs);
  4013. ret.prepend('{');
  4014. ret.add('}');
  4015. return ret;
  4016. },
  4017. generateList: function generateList(entries) {
  4018. var ret = this.empty();
  4019. for (var i = 0, len = entries.length; i < len; i++) {
  4020. if (i) {
  4021. ret.add(',');
  4022. }
  4023. ret.add(castChunk(entries[i], this));
  4024. }
  4025. return ret;
  4026. },
  4027. generateArray: function generateArray(entries) {
  4028. var ret = this.generateList(entries);
  4029. ret.prepend('[');
  4030. ret.add(']');
  4031. return ret;
  4032. }
  4033. };
  4034. exports['default'] = CodeGen;
  4035. module.exports = exports['default'];
  4036. /***/ })
  4037. /******/ ])
  4038. });
  4039. ;