handlebars.js 141 KB

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