sinatra-hexacta 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (96) hide show
  1. checksums.yaml +7 -0
  2. data/lib/sinatra/handlers/errors.rb +23 -0
  3. data/lib/sinatra/handlers/init.rb +3 -0
  4. data/lib/sinatra/handlers/notifications.rb +74 -0
  5. data/lib/sinatra/handlers/reports.rb +1 -0
  6. data/lib/sinatra/helpers/charts.rb +15 -0
  7. data/lib/sinatra/helpers/init.rb +5 -0
  8. data/lib/sinatra/helpers/inputs.rb +47 -0
  9. data/lib/sinatra/helpers/libraries.rb +25 -0
  10. data/lib/sinatra/helpers/subscriptions.rb +44 -0
  11. data/lib/sinatra/hexacta.rb +32 -0
  12. data/lib/sinatra/public/css/app.min.1.css +16231 -0
  13. data/lib/sinatra/public/css/app.min.2.css +3341 -0
  14. data/lib/sinatra/public/css/shell.css +65 -0
  15. data/lib/sinatra/public/fonts/montserrat/Montserrat-Black.otf +0 -0
  16. data/lib/sinatra/public/fonts/montserrat/Montserrat-ExtraLight.otf +0 -0
  17. data/lib/sinatra/public/fonts/montserrat/Montserrat-Light.otf +0 -0
  18. data/lib/sinatra/public/fonts/montserrat/Montserrat-SemiBold.otf +0 -0
  19. data/lib/sinatra/public/fonts/roboto/Roboto-Bold-webfont.eot +0 -0
  20. data/lib/sinatra/public/fonts/roboto/Roboto-Bold-webfont.svg +593 -0
  21. data/lib/sinatra/public/fonts/roboto/Roboto-Bold-webfont.ttf +0 -0
  22. data/lib/sinatra/public/fonts/roboto/Roboto-Bold-webfont.woff +0 -0
  23. data/lib/sinatra/public/fonts/roboto/Roboto-Light-webfont.eot +0 -0
  24. data/lib/sinatra/public/fonts/roboto/Roboto-Light-webfont.svg +641 -0
  25. data/lib/sinatra/public/fonts/roboto/Roboto-Light-webfont.ttf +0 -0
  26. data/lib/sinatra/public/fonts/roboto/Roboto-Light-webfont.woff +0 -0
  27. data/lib/sinatra/public/fonts/roboto/Roboto-Medium-webfont.eot +0 -0
  28. data/lib/sinatra/public/fonts/roboto/Roboto-Medium-webfont.svg +593 -0
  29. data/lib/sinatra/public/fonts/roboto/Roboto-Medium-webfont.ttf +0 -0
  30. data/lib/sinatra/public/fonts/roboto/Roboto-Medium-webfont.woff +0 -0
  31. data/lib/sinatra/public/fonts/roboto/Roboto-Regular-webfont.eot +0 -0
  32. data/lib/sinatra/public/fonts/roboto/Roboto-Regular-webfont.svg +621 -0
  33. data/lib/sinatra/public/fonts/roboto/Roboto-Regular-webfont.ttf +0 -0
  34. data/lib/sinatra/public/fonts/roboto/Roboto-Regular-webfont.woff +0 -0
  35. data/lib/sinatra/public/fonts/roboto/Roboto-Thin-webfont.eot +0 -0
  36. data/lib/sinatra/public/fonts/roboto/Roboto-Thin-webfont.svg +631 -0
  37. data/lib/sinatra/public/fonts/roboto/Roboto-Thin-webfont.ttf +0 -0
  38. data/lib/sinatra/public/fonts/roboto/Roboto-Thin-webfont.woff +0 -0
  39. data/lib/sinatra/public/img/select.png +0 -0
  40. data/lib/sinatra/public/img/select@2x.png +0 -0
  41. data/lib/sinatra/public/js/app.js +794 -0
  42. data/lib/sinatra/public/js/form_validator.js +29 -0
  43. data/lib/sinatra/public/vendors/animate.css/animate.min.css +7 -0
  44. data/lib/sinatra/public/vendors/bootstrap-validator/validator.js +405 -0
  45. data/lib/sinatra/public/vendors/bootstrap/bootstrap.min.js +7 -0
  46. data/lib/sinatra/public/vendors/chartist/chartist.min.css +1 -0
  47. data/lib/sinatra/public/vendors/chartist/chartist.min.js +10 -0
  48. data/lib/sinatra/public/vendors/chosen/chosen-sprite.png +0 -0
  49. data/lib/sinatra/public/vendors/chosen/chosen-sprite@2x.png +0 -0
  50. data/lib/sinatra/public/vendors/chosen/chosen.jquery.min.js +3 -0
  51. data/lib/sinatra/public/vendors/chosen/chosen.min.css +11 -0
  52. data/lib/sinatra/public/vendors/eonasdan-bootstrap-datetimepicker/bootstrap-datetimepicker.js +2051 -0
  53. data/lib/sinatra/public/vendors/eonasdan-bootstrap-datetimepicker/bootstrap-datetimepicker.min.css +5 -0
  54. data/lib/sinatra/public/vendors/jquery/jquery.min.js +5 -0
  55. data/lib/sinatra/public/vendors/malihu-custom-scrollbar-plugin/jquery.mCustomScrollbar.concat.min.js +5 -0
  56. data/lib/sinatra/public/vendors/malihu-custom-scrollbar-plugin/jquery.mCustomScrollbar.css +1267 -0
  57. data/lib/sinatra/public/vendors/malihu-custom-scrollbar-plugin/jquery.mCustomScrollbar.js +2370 -0
  58. data/lib/sinatra/public/vendors/malihu-custom-scrollbar-plugin/jquery.mCustomScrollbar.min.css +1 -0
  59. data/lib/sinatra/public/vendors/malihu-custom-scrollbar-plugin/mCSB_buttons.png +0 -0
  60. data/lib/sinatra/public/vendors/material-design-iconic-font/css/material-design-iconic-font.css +5166 -0
  61. data/lib/sinatra/public/vendors/material-design-iconic-font/css/material-design-iconic-font.min.css +1 -0
  62. data/lib/sinatra/public/vendors/material-design-iconic-font/fonts/Material-Design-Iconic-Font.eot +0 -0
  63. data/lib/sinatra/public/vendors/material-design-iconic-font/fonts/Material-Design-Iconic-Font.svg +787 -0
  64. data/lib/sinatra/public/vendors/material-design-iconic-font/fonts/Material-Design-Iconic-Font.ttf +0 -0
  65. data/lib/sinatra/public/vendors/material-design-iconic-font/fonts/Material-Design-Iconic-Font.woff +0 -0
  66. data/lib/sinatra/public/vendors/material-design-iconic-font/fonts/Material-Design-Iconic-Font.woff2 +0 -0
  67. data/lib/sinatra/public/vendors/moment/moment.min.js +7 -0
  68. data/lib/sinatra/public/vendors/typeahead.js/bloodhound.min.js +7 -0
  69. data/lib/sinatra/public/vendors/typeahead.js/handlebars.js +2610 -0
  70. data/lib/sinatra/public/vendors/typeahead.js/typeahead.bundle.min.js +8 -0
  71. data/lib/sinatra/public/vendors/waves/waves.min.css +8 -0
  72. data/lib/sinatra/public/vendors/waves/waves.min.js +10 -0
  73. data/lib/sinatra/views/charts/simple_line.slim +36 -0
  74. data/lib/sinatra/views/errors/403.slim +9 -0
  75. data/lib/sinatra/views/errors/404.slim +27 -0
  76. data/lib/sinatra/views/errors/500.slim +24 -0
  77. data/lib/sinatra/views/inputs/date.slim +12 -0
  78. data/lib/sinatra/views/inputs/input.slim +18 -0
  79. data/lib/sinatra/views/inputs/month.slim +13 -0
  80. data/lib/sinatra/views/inputs/multiple_select.slim +27 -0
  81. data/lib/sinatra/views/inputs/radio.slim +8 -0
  82. data/lib/sinatra/views/inputs/select.slim +26 -0
  83. data/lib/sinatra/views/inputs/textarea.slim +14 -0
  84. data/lib/sinatra/views/inputs/tick.slim +8 -0
  85. data/lib/sinatra/views/inputs/year.slim +12 -0
  86. data/lib/sinatra/views/libraries/include_css.slim +28 -0
  87. data/lib/sinatra/views/libraries/include_js_after.slim +53 -0
  88. data/lib/sinatra/views/libraries/include_js_before.slim +7 -0
  89. data/lib/sinatra/views/notifications.slim +98 -0
  90. data/lib/sinatra/views/notifications/form.slim +41 -0
  91. data/lib/sinatra/views/notifications/item.slim +11 -0
  92. data/lib/sinatra/views/notifications/modal.slim +29 -0
  93. data/lib/sinatra/views/notifications/new.slim +21 -0
  94. data/lib/sinatra/views/notifications/view.slim +80 -0
  95. data/lib/sinatra/views/notifications/widget.slim +33 -0
  96. metadata +136 -0
@@ -0,0 +1,7 @@
1
+ //! moment.js
2
+ //! version : 2.10.6
3
+ //! authors : Tim Wood, Iskren Chernev, Moment.js contributors
4
+ //! license : MIT
5
+ //! momentjs.com
6
+ !function(a,b){"object"==typeof exports&&"undefined"!=typeof module?module.exports=b():"function"==typeof define&&define.amd?define(b):a.moment=b()}(this,function(){"use strict";function a(){return Hc.apply(null,arguments)}function b(a){Hc=a}function c(a){return"[object Array]"===Object.prototype.toString.call(a)}function d(a){return a instanceof Date||"[object Date]"===Object.prototype.toString.call(a)}function e(a,b){var c,d=[];for(c=0;c<a.length;++c)d.push(b(a[c],c));return d}function f(a,b){return Object.prototype.hasOwnProperty.call(a,b)}function g(a,b){for(var c in b)f(b,c)&&(a[c]=b[c]);return f(b,"toString")&&(a.toString=b.toString),f(b,"valueOf")&&(a.valueOf=b.valueOf),a}function h(a,b,c,d){return Ca(a,b,c,d,!0).utc()}function i(){return{empty:!1,unusedTokens:[],unusedInput:[],overflow:-2,charsLeftOver:0,nullInput:!1,invalidMonth:null,invalidFormat:!1,userInvalidated:!1,iso:!1}}function j(a){return null==a._pf&&(a._pf=i()),a._pf}function k(a){if(null==a._isValid){var b=j(a);a._isValid=!(isNaN(a._d.getTime())||!(b.overflow<0)||b.empty||b.invalidMonth||b.invalidWeekday||b.nullInput||b.invalidFormat||b.userInvalidated),a._strict&&(a._isValid=a._isValid&&0===b.charsLeftOver&&0===b.unusedTokens.length&&void 0===b.bigHour)}return a._isValid}function l(a){var b=h(NaN);return null!=a?g(j(b),a):j(b).userInvalidated=!0,b}function m(a,b){var c,d,e;if("undefined"!=typeof b._isAMomentObject&&(a._isAMomentObject=b._isAMomentObject),"undefined"!=typeof b._i&&(a._i=b._i),"undefined"!=typeof b._f&&(a._f=b._f),"undefined"!=typeof b._l&&(a._l=b._l),"undefined"!=typeof b._strict&&(a._strict=b._strict),"undefined"!=typeof b._tzm&&(a._tzm=b._tzm),"undefined"!=typeof b._isUTC&&(a._isUTC=b._isUTC),"undefined"!=typeof b._offset&&(a._offset=b._offset),"undefined"!=typeof b._pf&&(a._pf=j(b)),"undefined"!=typeof b._locale&&(a._locale=b._locale),Jc.length>0)for(c in Jc)d=Jc[c],e=b[d],"undefined"!=typeof e&&(a[d]=e);return a}function n(b){m(this,b),this._d=new Date(null!=b._d?b._d.getTime():NaN),Kc===!1&&(Kc=!0,a.updateOffset(this),Kc=!1)}function o(a){return a instanceof n||null!=a&&null!=a._isAMomentObject}function p(a){return 0>a?Math.ceil(a):Math.floor(a)}function q(a){var b=+a,c=0;return 0!==b&&isFinite(b)&&(c=p(b)),c}function r(a,b,c){var d,e=Math.min(a.length,b.length),f=Math.abs(a.length-b.length),g=0;for(d=0;e>d;d++)(c&&a[d]!==b[d]||!c&&q(a[d])!==q(b[d]))&&g++;return g+f}function s(){}function t(a){return a?a.toLowerCase().replace("_","-"):a}function u(a){for(var b,c,d,e,f=0;f<a.length;){for(e=t(a[f]).split("-"),b=e.length,c=t(a[f+1]),c=c?c.split("-"):null;b>0;){if(d=v(e.slice(0,b).join("-")))return d;if(c&&c.length>=b&&r(e,c,!0)>=b-1)break;b--}f++}return null}function v(a){var b=null;if(!Lc[a]&&"undefined"!=typeof module&&module&&module.exports)try{b=Ic._abbr,require("./locale/"+a),w(b)}catch(c){}return Lc[a]}function w(a,b){var c;return a&&(c="undefined"==typeof b?y(a):x(a,b),c&&(Ic=c)),Ic._abbr}function x(a,b){return null!==b?(b.abbr=a,Lc[a]=Lc[a]||new s,Lc[a].set(b),w(a),Lc[a]):(delete Lc[a],null)}function y(a){var b;if(a&&a._locale&&a._locale._abbr&&(a=a._locale._abbr),!a)return Ic;if(!c(a)){if(b=v(a))return b;a=[a]}return u(a)}function z(a,b){var c=a.toLowerCase();Mc[c]=Mc[c+"s"]=Mc[b]=a}function A(a){return"string"==typeof a?Mc[a]||Mc[a.toLowerCase()]:void 0}function B(a){var b,c,d={};for(c in a)f(a,c)&&(b=A(c),b&&(d[b]=a[c]));return d}function C(b,c){return function(d){return null!=d?(E(this,b,d),a.updateOffset(this,c),this):D(this,b)}}function D(a,b){return a._d["get"+(a._isUTC?"UTC":"")+b]()}function E(a,b,c){return a._d["set"+(a._isUTC?"UTC":"")+b](c)}function F(a,b){var c;if("object"==typeof a)for(c in a)this.set(c,a[c]);else if(a=A(a),"function"==typeof this[a])return this[a](b);return this}function G(a,b,c){var d=""+Math.abs(a),e=b-d.length,f=a>=0;return(f?c?"+":"":"-")+Math.pow(10,Math.max(0,e)).toString().substr(1)+d}function H(a,b,c,d){var e=d;"string"==typeof d&&(e=function(){return this[d]()}),a&&(Qc[a]=e),b&&(Qc[b[0]]=function(){return G(e.apply(this,arguments),b[1],b[2])}),c&&(Qc[c]=function(){return this.localeData().ordinal(e.apply(this,arguments),a)})}function I(a){return a.match(/\[[\s\S]/)?a.replace(/^\[|\]$/g,""):a.replace(/\\/g,"")}function J(a){var b,c,d=a.match(Nc);for(b=0,c=d.length;c>b;b++)Qc[d[b]]?d[b]=Qc[d[b]]:d[b]=I(d[b]);return function(e){var f="";for(b=0;c>b;b++)f+=d[b]instanceof Function?d[b].call(e,a):d[b];return f}}function K(a,b){return a.isValid()?(b=L(b,a.localeData()),Pc[b]=Pc[b]||J(b),Pc[b](a)):a.localeData().invalidDate()}function L(a,b){function c(a){return b.longDateFormat(a)||a}var d=5;for(Oc.lastIndex=0;d>=0&&Oc.test(a);)a=a.replace(Oc,c),Oc.lastIndex=0,d-=1;return a}function M(a){return"function"==typeof a&&"[object Function]"===Object.prototype.toString.call(a)}function N(a,b,c){dd[a]=M(b)?b:function(a){return a&&c?c:b}}function O(a,b){return f(dd,a)?dd[a](b._strict,b._locale):new RegExp(P(a))}function P(a){return a.replace("\\","").replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g,function(a,b,c,d,e){return b||c||d||e}).replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}function Q(a,b){var c,d=b;for("string"==typeof a&&(a=[a]),"number"==typeof b&&(d=function(a,c){c[b]=q(a)}),c=0;c<a.length;c++)ed[a[c]]=d}function R(a,b){Q(a,function(a,c,d,e){d._w=d._w||{},b(a,d._w,d,e)})}function S(a,b,c){null!=b&&f(ed,a)&&ed[a](b,c._a,c,a)}function T(a,b){return new Date(Date.UTC(a,b+1,0)).getUTCDate()}function U(a){return this._months[a.month()]}function V(a){return this._monthsShort[a.month()]}function W(a,b,c){var d,e,f;for(this._monthsParse||(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[]),d=0;12>d;d++){if(e=h([2e3,d]),c&&!this._longMonthsParse[d]&&(this._longMonthsParse[d]=new RegExp("^"+this.months(e,"").replace(".","")+"$","i"),this._shortMonthsParse[d]=new RegExp("^"+this.monthsShort(e,"").replace(".","")+"$","i")),c||this._monthsParse[d]||(f="^"+this.months(e,"")+"|^"+this.monthsShort(e,""),this._monthsParse[d]=new RegExp(f.replace(".",""),"i")),c&&"MMMM"===b&&this._longMonthsParse[d].test(a))return d;if(c&&"MMM"===b&&this._shortMonthsParse[d].test(a))return d;if(!c&&this._monthsParse[d].test(a))return d}}function X(a,b){var c;return"string"==typeof b&&(b=a.localeData().monthsParse(b),"number"!=typeof b)?a:(c=Math.min(a.date(),T(a.year(),b)),a._d["set"+(a._isUTC?"UTC":"")+"Month"](b,c),a)}function Y(b){return null!=b?(X(this,b),a.updateOffset(this,!0),this):D(this,"Month")}function Z(){return T(this.year(),this.month())}function $(a){var b,c=a._a;return c&&-2===j(a).overflow&&(b=c[gd]<0||c[gd]>11?gd:c[hd]<1||c[hd]>T(c[fd],c[gd])?hd:c[id]<0||c[id]>24||24===c[id]&&(0!==c[jd]||0!==c[kd]||0!==c[ld])?id:c[jd]<0||c[jd]>59?jd:c[kd]<0||c[kd]>59?kd:c[ld]<0||c[ld]>999?ld:-1,j(a)._overflowDayOfYear&&(fd>b||b>hd)&&(b=hd),j(a).overflow=b),a}function _(b){a.suppressDeprecationWarnings===!1&&"undefined"!=typeof console&&console.warn&&console.warn("Deprecation warning: "+b)}function aa(a,b){var c=!0;return g(function(){return c&&(_(a+"\n"+(new Error).stack),c=!1),b.apply(this,arguments)},b)}function ba(a,b){od[a]||(_(b),od[a]=!0)}function ca(a){var b,c,d=a._i,e=pd.exec(d);if(e){for(j(a).iso=!0,b=0,c=qd.length;c>b;b++)if(qd[b][1].exec(d)){a._f=qd[b][0];break}for(b=0,c=rd.length;c>b;b++)if(rd[b][1].exec(d)){a._f+=(e[6]||" ")+rd[b][0];break}d.match(ad)&&(a._f+="Z"),va(a)}else a._isValid=!1}function da(b){var c=sd.exec(b._i);return null!==c?void(b._d=new Date(+c[1])):(ca(b),void(b._isValid===!1&&(delete b._isValid,a.createFromInputFallback(b))))}function ea(a,b,c,d,e,f,g){var h=new Date(a,b,c,d,e,f,g);return 1970>a&&h.setFullYear(a),h}function fa(a){var b=new Date(Date.UTC.apply(null,arguments));return 1970>a&&b.setUTCFullYear(a),b}function ga(a){return ha(a)?366:365}function ha(a){return a%4===0&&a%100!==0||a%400===0}function ia(){return ha(this.year())}function ja(a,b,c){var d,e=c-b,f=c-a.day();return f>e&&(f-=7),e-7>f&&(f+=7),d=Da(a).add(f,"d"),{week:Math.ceil(d.dayOfYear()/7),year:d.year()}}function ka(a){return ja(a,this._week.dow,this._week.doy).week}function la(){return this._week.dow}function ma(){return this._week.doy}function na(a){var b=this.localeData().week(this);return null==a?b:this.add(7*(a-b),"d")}function oa(a){var b=ja(this,1,4).week;return null==a?b:this.add(7*(a-b),"d")}function pa(a,b,c,d,e){var f,g=6+e-d,h=fa(a,0,1+g),i=h.getUTCDay();return e>i&&(i+=7),c=null!=c?1*c:e,f=1+g+7*(b-1)-i+c,{year:f>0?a:a-1,dayOfYear:f>0?f:ga(a-1)+f}}function qa(a){var b=Math.round((this.clone().startOf("day")-this.clone().startOf("year"))/864e5)+1;return null==a?b:this.add(a-b,"d")}function ra(a,b,c){return null!=a?a:null!=b?b:c}function sa(a){var b=new Date;return a._useUTC?[b.getUTCFullYear(),b.getUTCMonth(),b.getUTCDate()]:[b.getFullYear(),b.getMonth(),b.getDate()]}function ta(a){var b,c,d,e,f=[];if(!a._d){for(d=sa(a),a._w&&null==a._a[hd]&&null==a._a[gd]&&ua(a),a._dayOfYear&&(e=ra(a._a[fd],d[fd]),a._dayOfYear>ga(e)&&(j(a)._overflowDayOfYear=!0),c=fa(e,0,a._dayOfYear),a._a[gd]=c.getUTCMonth(),a._a[hd]=c.getUTCDate()),b=0;3>b&&null==a._a[b];++b)a._a[b]=f[b]=d[b];for(;7>b;b++)a._a[b]=f[b]=null==a._a[b]?2===b?1:0:a._a[b];24===a._a[id]&&0===a._a[jd]&&0===a._a[kd]&&0===a._a[ld]&&(a._nextDay=!0,a._a[id]=0),a._d=(a._useUTC?fa:ea).apply(null,f),null!=a._tzm&&a._d.setUTCMinutes(a._d.getUTCMinutes()-a._tzm),a._nextDay&&(a._a[id]=24)}}function ua(a){var b,c,d,e,f,g,h;b=a._w,null!=b.GG||null!=b.W||null!=b.E?(f=1,g=4,c=ra(b.GG,a._a[fd],ja(Da(),1,4).year),d=ra(b.W,1),e=ra(b.E,1)):(f=a._locale._week.dow,g=a._locale._week.doy,c=ra(b.gg,a._a[fd],ja(Da(),f,g).year),d=ra(b.w,1),null!=b.d?(e=b.d,f>e&&++d):e=null!=b.e?b.e+f:f),h=pa(c,d,e,g,f),a._a[fd]=h.year,a._dayOfYear=h.dayOfYear}function va(b){if(b._f===a.ISO_8601)return void ca(b);b._a=[],j(b).empty=!0;var c,d,e,f,g,h=""+b._i,i=h.length,k=0;for(e=L(b._f,b._locale).match(Nc)||[],c=0;c<e.length;c++)f=e[c],d=(h.match(O(f,b))||[])[0],d&&(g=h.substr(0,h.indexOf(d)),g.length>0&&j(b).unusedInput.push(g),h=h.slice(h.indexOf(d)+d.length),k+=d.length),Qc[f]?(d?j(b).empty=!1:j(b).unusedTokens.push(f),S(f,d,b)):b._strict&&!d&&j(b).unusedTokens.push(f);j(b).charsLeftOver=i-k,h.length>0&&j(b).unusedInput.push(h),j(b).bigHour===!0&&b._a[id]<=12&&b._a[id]>0&&(j(b).bigHour=void 0),b._a[id]=wa(b._locale,b._a[id],b._meridiem),ta(b),$(b)}function wa(a,b,c){var d;return null==c?b:null!=a.meridiemHour?a.meridiemHour(b,c):null!=a.isPM?(d=a.isPM(c),d&&12>b&&(b+=12),d||12!==b||(b=0),b):b}function xa(a){var b,c,d,e,f;if(0===a._f.length)return j(a).invalidFormat=!0,void(a._d=new Date(NaN));for(e=0;e<a._f.length;e++)f=0,b=m({},a),null!=a._useUTC&&(b._useUTC=a._useUTC),b._f=a._f[e],va(b),k(b)&&(f+=j(b).charsLeftOver,f+=10*j(b).unusedTokens.length,j(b).score=f,(null==d||d>f)&&(d=f,c=b));g(a,c||b)}function ya(a){if(!a._d){var b=B(a._i);a._a=[b.year,b.month,b.day||b.date,b.hour,b.minute,b.second,b.millisecond],ta(a)}}function za(a){var b=new n($(Aa(a)));return b._nextDay&&(b.add(1,"d"),b._nextDay=void 0),b}function Aa(a){var b=a._i,e=a._f;return a._locale=a._locale||y(a._l),null===b||void 0===e&&""===b?l({nullInput:!0}):("string"==typeof b&&(a._i=b=a._locale.preparse(b)),o(b)?new n($(b)):(c(e)?xa(a):e?va(a):d(b)?a._d=b:Ba(a),a))}function Ba(b){var f=b._i;void 0===f?b._d=new Date:d(f)?b._d=new Date(+f):"string"==typeof f?da(b):c(f)?(b._a=e(f.slice(0),function(a){return parseInt(a,10)}),ta(b)):"object"==typeof f?ya(b):"number"==typeof f?b._d=new Date(f):a.createFromInputFallback(b)}function Ca(a,b,c,d,e){var f={};return"boolean"==typeof c&&(d=c,c=void 0),f._isAMomentObject=!0,f._useUTC=f._isUTC=e,f._l=c,f._i=a,f._f=b,f._strict=d,za(f)}function Da(a,b,c,d){return Ca(a,b,c,d,!1)}function Ea(a,b){var d,e;if(1===b.length&&c(b[0])&&(b=b[0]),!b.length)return Da();for(d=b[0],e=1;e<b.length;++e)(!b[e].isValid()||b[e][a](d))&&(d=b[e]);return d}function Fa(){var a=[].slice.call(arguments,0);return Ea("isBefore",a)}function Ga(){var a=[].slice.call(arguments,0);return Ea("isAfter",a)}function Ha(a){var b=B(a),c=b.year||0,d=b.quarter||0,e=b.month||0,f=b.week||0,g=b.day||0,h=b.hour||0,i=b.minute||0,j=b.second||0,k=b.millisecond||0;this._milliseconds=+k+1e3*j+6e4*i+36e5*h,this._days=+g+7*f,this._months=+e+3*d+12*c,this._data={},this._locale=y(),this._bubble()}function Ia(a){return a instanceof Ha}function Ja(a,b){H(a,0,0,function(){var a=this.utcOffset(),c="+";return 0>a&&(a=-a,c="-"),c+G(~~(a/60),2)+b+G(~~a%60,2)})}function Ka(a){var b=(a||"").match(ad)||[],c=b[b.length-1]||[],d=(c+"").match(xd)||["-",0,0],e=+(60*d[1])+q(d[2]);return"+"===d[0]?e:-e}function La(b,c){var e,f;return c._isUTC?(e=c.clone(),f=(o(b)||d(b)?+b:+Da(b))-+e,e._d.setTime(+e._d+f),a.updateOffset(e,!1),e):Da(b).local()}function Ma(a){return 15*-Math.round(a._d.getTimezoneOffset()/15)}function Na(b,c){var d,e=this._offset||0;return null!=b?("string"==typeof b&&(b=Ka(b)),Math.abs(b)<16&&(b=60*b),!this._isUTC&&c&&(d=Ma(this)),this._offset=b,this._isUTC=!0,null!=d&&this.add(d,"m"),e!==b&&(!c||this._changeInProgress?bb(this,Ya(b-e,"m"),1,!1):this._changeInProgress||(this._changeInProgress=!0,a.updateOffset(this,!0),this._changeInProgress=null)),this):this._isUTC?e:Ma(this)}function Oa(a,b){return null!=a?("string"!=typeof a&&(a=-a),this.utcOffset(a,b),this):-this.utcOffset()}function Pa(a){return this.utcOffset(0,a)}function Qa(a){return this._isUTC&&(this.utcOffset(0,a),this._isUTC=!1,a&&this.subtract(Ma(this),"m")),this}function Ra(){return this._tzm?this.utcOffset(this._tzm):"string"==typeof this._i&&this.utcOffset(Ka(this._i)),this}function Sa(a){return a=a?Da(a).utcOffset():0,(this.utcOffset()-a)%60===0}function Ta(){return this.utcOffset()>this.clone().month(0).utcOffset()||this.utcOffset()>this.clone().month(5).utcOffset()}function Ua(){if("undefined"!=typeof this._isDSTShifted)return this._isDSTShifted;var a={};if(m(a,this),a=Aa(a),a._a){var b=a._isUTC?h(a._a):Da(a._a);this._isDSTShifted=this.isValid()&&r(a._a,b.toArray())>0}else this._isDSTShifted=!1;return this._isDSTShifted}function Va(){return!this._isUTC}function Wa(){return this._isUTC}function Xa(){return this._isUTC&&0===this._offset}function Ya(a,b){var c,d,e,g=a,h=null;return Ia(a)?g={ms:a._milliseconds,d:a._days,M:a._months}:"number"==typeof a?(g={},b?g[b]=a:g.milliseconds=a):(h=yd.exec(a))?(c="-"===h[1]?-1:1,g={y:0,d:q(h[hd])*c,h:q(h[id])*c,m:q(h[jd])*c,s:q(h[kd])*c,ms:q(h[ld])*c}):(h=zd.exec(a))?(c="-"===h[1]?-1:1,g={y:Za(h[2],c),M:Za(h[3],c),d:Za(h[4],c),h:Za(h[5],c),m:Za(h[6],c),s:Za(h[7],c),w:Za(h[8],c)}):null==g?g={}:"object"==typeof g&&("from"in g||"to"in g)&&(e=_a(Da(g.from),Da(g.to)),g={},g.ms=e.milliseconds,g.M=e.months),d=new Ha(g),Ia(a)&&f(a,"_locale")&&(d._locale=a._locale),d}function Za(a,b){var c=a&&parseFloat(a.replace(",","."));return(isNaN(c)?0:c)*b}function $a(a,b){var c={milliseconds:0,months:0};return c.months=b.month()-a.month()+12*(b.year()-a.year()),a.clone().add(c.months,"M").isAfter(b)&&--c.months,c.milliseconds=+b-+a.clone().add(c.months,"M"),c}function _a(a,b){var c;return b=La(b,a),a.isBefore(b)?c=$a(a,b):(c=$a(b,a),c.milliseconds=-c.milliseconds,c.months=-c.months),c}function ab(a,b){return function(c,d){var e,f;return null===d||isNaN(+d)||(ba(b,"moment()."+b+"(period, number) is deprecated. Please use moment()."+b+"(number, period)."),f=c,c=d,d=f),c="string"==typeof c?+c:c,e=Ya(c,d),bb(this,e,a),this}}function bb(b,c,d,e){var f=c._milliseconds,g=c._days,h=c._months;e=null==e?!0:e,f&&b._d.setTime(+b._d+f*d),g&&E(b,"Date",D(b,"Date")+g*d),h&&X(b,D(b,"Month")+h*d),e&&a.updateOffset(b,g||h)}function cb(a,b){var c=a||Da(),d=La(c,this).startOf("day"),e=this.diff(d,"days",!0),f=-6>e?"sameElse":-1>e?"lastWeek":0>e?"lastDay":1>e?"sameDay":2>e?"nextDay":7>e?"nextWeek":"sameElse";return this.format(b&&b[f]||this.localeData().calendar(f,this,Da(c)))}function db(){return new n(this)}function eb(a,b){var c;return b=A("undefined"!=typeof b?b:"millisecond"),"millisecond"===b?(a=o(a)?a:Da(a),+this>+a):(c=o(a)?+a:+Da(a),c<+this.clone().startOf(b))}function fb(a,b){var c;return b=A("undefined"!=typeof b?b:"millisecond"),"millisecond"===b?(a=o(a)?a:Da(a),+a>+this):(c=o(a)?+a:+Da(a),+this.clone().endOf(b)<c)}function gb(a,b,c){return this.isAfter(a,c)&&this.isBefore(b,c)}function hb(a,b){var c;return b=A(b||"millisecond"),"millisecond"===b?(a=o(a)?a:Da(a),+this===+a):(c=+Da(a),+this.clone().startOf(b)<=c&&c<=+this.clone().endOf(b))}function ib(a,b,c){var d,e,f=La(a,this),g=6e4*(f.utcOffset()-this.utcOffset());return b=A(b),"year"===b||"month"===b||"quarter"===b?(e=jb(this,f),"quarter"===b?e/=3:"year"===b&&(e/=12)):(d=this-f,e="second"===b?d/1e3:"minute"===b?d/6e4:"hour"===b?d/36e5:"day"===b?(d-g)/864e5:"week"===b?(d-g)/6048e5:d),c?e:p(e)}function jb(a,b){var c,d,e=12*(b.year()-a.year())+(b.month()-a.month()),f=a.clone().add(e,"months");return 0>b-f?(c=a.clone().add(e-1,"months"),d=(b-f)/(f-c)):(c=a.clone().add(e+1,"months"),d=(b-f)/(c-f)),-(e+d)}function kb(){return this.clone().locale("en").format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ")}function lb(){var a=this.clone().utc();return 0<a.year()&&a.year()<=9999?"function"==typeof Date.prototype.toISOString?this.toDate().toISOString():K(a,"YYYY-MM-DD[T]HH:mm:ss.SSS[Z]"):K(a,"YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]")}function mb(b){var c=K(this,b||a.defaultFormat);return this.localeData().postformat(c)}function nb(a,b){return this.isValid()?Ya({to:this,from:a}).locale(this.locale()).humanize(!b):this.localeData().invalidDate()}function ob(a){return this.from(Da(),a)}function pb(a,b){return this.isValid()?Ya({from:this,to:a}).locale(this.locale()).humanize(!b):this.localeData().invalidDate()}function qb(a){return this.to(Da(),a)}function rb(a){var b;return void 0===a?this._locale._abbr:(b=y(a),null!=b&&(this._locale=b),this)}function sb(){return this._locale}function tb(a){switch(a=A(a)){case"year":this.month(0);case"quarter":case"month":this.date(1);case"week":case"isoWeek":case"day":this.hours(0);case"hour":this.minutes(0);case"minute":this.seconds(0);case"second":this.milliseconds(0)}return"week"===a&&this.weekday(0),"isoWeek"===a&&this.isoWeekday(1),"quarter"===a&&this.month(3*Math.floor(this.month()/3)),this}function ub(a){return a=A(a),void 0===a||"millisecond"===a?this:this.startOf(a).add(1,"isoWeek"===a?"week":a).subtract(1,"ms")}function vb(){return+this._d-6e4*(this._offset||0)}function wb(){return Math.floor(+this/1e3)}function xb(){return this._offset?new Date(+this):this._d}function yb(){var a=this;return[a.year(),a.month(),a.date(),a.hour(),a.minute(),a.second(),a.millisecond()]}function zb(){var a=this;return{years:a.year(),months:a.month(),date:a.date(),hours:a.hours(),minutes:a.minutes(),seconds:a.seconds(),milliseconds:a.milliseconds()}}function Ab(){return k(this)}function Bb(){return g({},j(this))}function Cb(){return j(this).overflow}function Db(a,b){H(0,[a,a.length],0,b)}function Eb(a,b,c){return ja(Da([a,11,31+b-c]),b,c).week}function Fb(a){var b=ja(this,this.localeData()._week.dow,this.localeData()._week.doy).year;return null==a?b:this.add(a-b,"y")}function Gb(a){var b=ja(this,1,4).year;return null==a?b:this.add(a-b,"y")}function Hb(){return Eb(this.year(),1,4)}function Ib(){var a=this.localeData()._week;return Eb(this.year(),a.dow,a.doy)}function Jb(a){return null==a?Math.ceil((this.month()+1)/3):this.month(3*(a-1)+this.month()%3)}function Kb(a,b){return"string"!=typeof a?a:isNaN(a)?(a=b.weekdaysParse(a),"number"==typeof a?a:null):parseInt(a,10)}function Lb(a){return this._weekdays[a.day()]}function Mb(a){return this._weekdaysShort[a.day()]}function Nb(a){return this._weekdaysMin[a.day()]}function Ob(a){var b,c,d;for(this._weekdaysParse=this._weekdaysParse||[],b=0;7>b;b++)if(this._weekdaysParse[b]||(c=Da([2e3,1]).day(b),d="^"+this.weekdays(c,"")+"|^"+this.weekdaysShort(c,"")+"|^"+this.weekdaysMin(c,""),this._weekdaysParse[b]=new RegExp(d.replace(".",""),"i")),this._weekdaysParse[b].test(a))return b}function Pb(a){var b=this._isUTC?this._d.getUTCDay():this._d.getDay();return null!=a?(a=Kb(a,this.localeData()),this.add(a-b,"d")):b}function Qb(a){var b=(this.day()+7-this.localeData()._week.dow)%7;return null==a?b:this.add(a-b,"d")}function Rb(a){return null==a?this.day()||7:this.day(this.day()%7?a:a-7)}function Sb(a,b){H(a,0,0,function(){return this.localeData().meridiem(this.hours(),this.minutes(),b)})}function Tb(a,b){return b._meridiemParse}function Ub(a){return"p"===(a+"").toLowerCase().charAt(0)}function Vb(a,b,c){return a>11?c?"pm":"PM":c?"am":"AM"}function Wb(a,b){b[ld]=q(1e3*("0."+a))}function Xb(){return this._isUTC?"UTC":""}function Yb(){return this._isUTC?"Coordinated Universal Time":""}function Zb(a){return Da(1e3*a)}function $b(){return Da.apply(null,arguments).parseZone()}function _b(a,b,c){var d=this._calendar[a];return"function"==typeof d?d.call(b,c):d}function ac(a){var b=this._longDateFormat[a],c=this._longDateFormat[a.toUpperCase()];return b||!c?b:(this._longDateFormat[a]=c.replace(/MMMM|MM|DD|dddd/g,function(a){return a.slice(1)}),this._longDateFormat[a])}function bc(){return this._invalidDate}function cc(a){return this._ordinal.replace("%d",a)}function dc(a){return a}function ec(a,b,c,d){var e=this._relativeTime[c];return"function"==typeof e?e(a,b,c,d):e.replace(/%d/i,a)}function fc(a,b){var c=this._relativeTime[a>0?"future":"past"];return"function"==typeof c?c(b):c.replace(/%s/i,b)}function gc(a){var b,c;for(c in a)b=a[c],"function"==typeof b?this[c]=b:this["_"+c]=b;this._ordinalParseLenient=new RegExp(this._ordinalParse.source+"|"+/\d{1,2}/.source)}function hc(a,b,c,d){var e=y(),f=h().set(d,b);return e[c](f,a)}function ic(a,b,c,d,e){if("number"==typeof a&&(b=a,a=void 0),a=a||"",null!=b)return hc(a,b,c,e);var f,g=[];for(f=0;d>f;f++)g[f]=hc(a,f,c,e);return g}function jc(a,b){return ic(a,b,"months",12,"month")}function kc(a,b){return ic(a,b,"monthsShort",12,"month")}function lc(a,b){return ic(a,b,"weekdays",7,"day")}function mc(a,b){return ic(a,b,"weekdaysShort",7,"day")}function nc(a,b){return ic(a,b,"weekdaysMin",7,"day")}function oc(){var a=this._data;return this._milliseconds=Wd(this._milliseconds),this._days=Wd(this._days),this._months=Wd(this._months),a.milliseconds=Wd(a.milliseconds),a.seconds=Wd(a.seconds),a.minutes=Wd(a.minutes),a.hours=Wd(a.hours),a.months=Wd(a.months),a.years=Wd(a.years),this}function pc(a,b,c,d){var e=Ya(b,c);return a._milliseconds+=d*e._milliseconds,a._days+=d*e._days,a._months+=d*e._months,a._bubble()}function qc(a,b){return pc(this,a,b,1)}function rc(a,b){return pc(this,a,b,-1)}function sc(a){return 0>a?Math.floor(a):Math.ceil(a)}function tc(){var a,b,c,d,e,f=this._milliseconds,g=this._days,h=this._months,i=this._data;return f>=0&&g>=0&&h>=0||0>=f&&0>=g&&0>=h||(f+=864e5*sc(vc(h)+g),g=0,h=0),i.milliseconds=f%1e3,a=p(f/1e3),i.seconds=a%60,b=p(a/60),i.minutes=b%60,c=p(b/60),i.hours=c%24,g+=p(c/24),e=p(uc(g)),h+=e,g-=sc(vc(e)),d=p(h/12),h%=12,i.days=g,i.months=h,i.years=d,this}function uc(a){return 4800*a/146097}function vc(a){return 146097*a/4800}function wc(a){var b,c,d=this._milliseconds;if(a=A(a),"month"===a||"year"===a)return b=this._days+d/864e5,c=this._months+uc(b),"month"===a?c:c/12;switch(b=this._days+Math.round(vc(this._months)),a){case"week":return b/7+d/6048e5;case"day":return b+d/864e5;case"hour":return 24*b+d/36e5;case"minute":return 1440*b+d/6e4;case"second":return 86400*b+d/1e3;case"millisecond":return Math.floor(864e5*b)+d;default:throw new Error("Unknown unit "+a)}}function xc(){return this._milliseconds+864e5*this._days+this._months%12*2592e6+31536e6*q(this._months/12)}function yc(a){return function(){return this.as(a)}}function zc(a){return a=A(a),this[a+"s"]()}function Ac(a){return function(){return this._data[a]}}function Bc(){return p(this.days()/7)}function Cc(a,b,c,d,e){return e.relativeTime(b||1,!!c,a,d)}function Dc(a,b,c){var d=Ya(a).abs(),e=ke(d.as("s")),f=ke(d.as("m")),g=ke(d.as("h")),h=ke(d.as("d")),i=ke(d.as("M")),j=ke(d.as("y")),k=e<le.s&&["s",e]||1===f&&["m"]||f<le.m&&["mm",f]||1===g&&["h"]||g<le.h&&["hh",g]||1===h&&["d"]||h<le.d&&["dd",h]||1===i&&["M"]||i<le.M&&["MM",i]||1===j&&["y"]||["yy",j];return k[2]=b,k[3]=+a>0,k[4]=c,Cc.apply(null,k)}function Ec(a,b){return void 0===le[a]?!1:void 0===b?le[a]:(le[a]=b,!0)}function Fc(a){var b=this.localeData(),c=Dc(this,!a,b);return a&&(c=b.pastFuture(+this,c)),b.postformat(c)}function Gc(){var a,b,c,d=me(this._milliseconds)/1e3,e=me(this._days),f=me(this._months);a=p(d/60),b=p(a/60),d%=60,a%=60,c=p(f/12),f%=12;var g=c,h=f,i=e,j=b,k=a,l=d,m=this.asSeconds();return m?(0>m?"-":"")+"P"+(g?g+"Y":"")+(h?h+"M":"")+(i?i+"D":"")+(j||k||l?"T":"")+(j?j+"H":"")+(k?k+"M":"")+(l?l+"S":""):"P0D"}var Hc,Ic,Jc=a.momentProperties=[],Kc=!1,Lc={},Mc={},Nc=/(\[[^\[]*\])|(\\)?(Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Q|YYYYYY|YYYYY|YYYY|YY|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g,Oc=/(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g,Pc={},Qc={},Rc=/\d/,Sc=/\d\d/,Tc=/\d{3}/,Uc=/\d{4}/,Vc=/[+-]?\d{6}/,Wc=/\d\d?/,Xc=/\d{1,3}/,Yc=/\d{1,4}/,Zc=/[+-]?\d{1,6}/,$c=/\d+/,_c=/[+-]?\d+/,ad=/Z|[+-]\d\d:?\d\d/gi,bd=/[+-]?\d+(\.\d{1,3})?/,cd=/[0-9]*['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+|[\u0600-\u06FF\/]+(\s*?[\u0600-\u06FF]+){1,2}/i,dd={},ed={},fd=0,gd=1,hd=2,id=3,jd=4,kd=5,ld=6;H("M",["MM",2],"Mo",function(){return this.month()+1}),H("MMM",0,0,function(a){return this.localeData().monthsShort(this,a)}),H("MMMM",0,0,function(a){return this.localeData().months(this,a)}),z("month","M"),N("M",Wc),N("MM",Wc,Sc),N("MMM",cd),N("MMMM",cd),Q(["M","MM"],function(a,b){b[gd]=q(a)-1}),Q(["MMM","MMMM"],function(a,b,c,d){var e=c._locale.monthsParse(a,d,c._strict);null!=e?b[gd]=e:j(c).invalidMonth=a});var md="January_February_March_April_May_June_July_August_September_October_November_December".split("_"),nd="Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),od={};a.suppressDeprecationWarnings=!1;var pd=/^\s*(?:[+-]\d{6}|\d{4})-(?:(\d\d-\d\d)|(W\d\d$)|(W\d\d-\d)|(\d\d\d))((T| )(\d\d(:\d\d(:\d\d(\.\d+)?)?)?)?([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?$/,qd=[["YYYYYY-MM-DD",/[+-]\d{6}-\d{2}-\d{2}/],["YYYY-MM-DD",/\d{4}-\d{2}-\d{2}/],["GGGG-[W]WW-E",/\d{4}-W\d{2}-\d/],["GGGG-[W]WW",/\d{4}-W\d{2}/],["YYYY-DDD",/\d{4}-\d{3}/]],rd=[["HH:mm:ss.SSSS",/(T| )\d\d:\d\d:\d\d\.\d+/],["HH:mm:ss",/(T| )\d\d:\d\d:\d\d/],["HH:mm",/(T| )\d\d:\d\d/],["HH",/(T| )\d\d/]],sd=/^\/?Date\((\-?\d+)/i;a.createFromInputFallback=aa("moment construction falls back to js Date. This is discouraged and will be removed in upcoming major release. Please refer to https://github.com/moment/moment/issues/1407 for more info.",function(a){a._d=new Date(a._i+(a._useUTC?" UTC":""))}),H(0,["YY",2],0,function(){return this.year()%100}),H(0,["YYYY",4],0,"year"),H(0,["YYYYY",5],0,"year"),H(0,["YYYYYY",6,!0],0,"year"),z("year","y"),N("Y",_c),N("YY",Wc,Sc),N("YYYY",Yc,Uc),N("YYYYY",Zc,Vc),N("YYYYYY",Zc,Vc),Q(["YYYYY","YYYYYY"],fd),Q("YYYY",function(b,c){c[fd]=2===b.length?a.parseTwoDigitYear(b):q(b)}),Q("YY",function(b,c){c[fd]=a.parseTwoDigitYear(b)}),a.parseTwoDigitYear=function(a){return q(a)+(q(a)>68?1900:2e3)};var td=C("FullYear",!1);H("w",["ww",2],"wo","week"),H("W",["WW",2],"Wo","isoWeek"),z("week","w"),z("isoWeek","W"),N("w",Wc),N("ww",Wc,Sc),N("W",Wc),N("WW",Wc,Sc),R(["w","ww","W","WW"],function(a,b,c,d){b[d.substr(0,1)]=q(a)});var ud={dow:0,doy:6};H("DDD",["DDDD",3],"DDDo","dayOfYear"),z("dayOfYear","DDD"),N("DDD",Xc),N("DDDD",Tc),Q(["DDD","DDDD"],function(a,b,c){c._dayOfYear=q(a)}),a.ISO_8601=function(){};var vd=aa("moment().min is deprecated, use moment.min instead. https://github.com/moment/moment/issues/1548",function(){var a=Da.apply(null,arguments);return this>a?this:a}),wd=aa("moment().max is deprecated, use moment.max instead. https://github.com/moment/moment/issues/1548",function(){var a=Da.apply(null,arguments);return a>this?this:a});Ja("Z",":"),Ja("ZZ",""),N("Z",ad),N("ZZ",ad),Q(["Z","ZZ"],function(a,b,c){c._useUTC=!0,c._tzm=Ka(a)});var xd=/([\+\-]|\d\d)/gi;a.updateOffset=function(){};var yd=/(\-)?(?:(\d*)\.)?(\d+)\:(\d+)(?:\:(\d+)\.?(\d{3})?)?/,zd=/^(-)?P(?:(?:([0-9,.]*)Y)?(?:([0-9,.]*)M)?(?:([0-9,.]*)D)?(?:T(?:([0-9,.]*)H)?(?:([0-9,.]*)M)?(?:([0-9,.]*)S)?)?|([0-9,.]*)W)$/;Ya.fn=Ha.prototype;var Ad=ab(1,"add"),Bd=ab(-1,"subtract");a.defaultFormat="YYYY-MM-DDTHH:mm:ssZ";var Cd=aa("moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.",function(a){return void 0===a?this.localeData():this.locale(a)});H(0,["gg",2],0,function(){return this.weekYear()%100}),H(0,["GG",2],0,function(){return this.isoWeekYear()%100}),Db("gggg","weekYear"),Db("ggggg","weekYear"),Db("GGGG","isoWeekYear"),Db("GGGGG","isoWeekYear"),z("weekYear","gg"),z("isoWeekYear","GG"),N("G",_c),N("g",_c),N("GG",Wc,Sc),N("gg",Wc,Sc),N("GGGG",Yc,Uc),N("gggg",Yc,Uc),N("GGGGG",Zc,Vc),N("ggggg",Zc,Vc),R(["gggg","ggggg","GGGG","GGGGG"],function(a,b,c,d){b[d.substr(0,2)]=q(a)}),R(["gg","GG"],function(b,c,d,e){c[e]=a.parseTwoDigitYear(b)}),H("Q",0,0,"quarter"),z("quarter","Q"),N("Q",Rc),Q("Q",function(a,b){b[gd]=3*(q(a)-1)}),H("D",["DD",2],"Do","date"),z("date","D"),N("D",Wc),N("DD",Wc,Sc),N("Do",function(a,b){return a?b._ordinalParse:b._ordinalParseLenient}),Q(["D","DD"],hd),Q("Do",function(a,b){b[hd]=q(a.match(Wc)[0],10)});var Dd=C("Date",!0);H("d",0,"do","day"),H("dd",0,0,function(a){return this.localeData().weekdaysMin(this,a)}),H("ddd",0,0,function(a){return this.localeData().weekdaysShort(this,a)}),H("dddd",0,0,function(a){return this.localeData().weekdays(this,a)}),H("e",0,0,"weekday"),H("E",0,0,"isoWeekday"),z("day","d"),z("weekday","e"),z("isoWeekday","E"),N("d",Wc),N("e",Wc),N("E",Wc),N("dd",cd),N("ddd",cd),N("dddd",cd),R(["dd","ddd","dddd"],function(a,b,c){var d=c._locale.weekdaysParse(a);null!=d?b.d=d:j(c).invalidWeekday=a}),R(["d","e","E"],function(a,b,c,d){b[d]=q(a)});var Ed="Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),Fd="Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),Gd="Su_Mo_Tu_We_Th_Fr_Sa".split("_");H("H",["HH",2],0,"hour"),H("h",["hh",2],0,function(){return this.hours()%12||12}),Sb("a",!0),Sb("A",!1),z("hour","h"),N("a",Tb),N("A",Tb),N("H",Wc),N("h",Wc),N("HH",Wc,Sc),N("hh",Wc,Sc),Q(["H","HH"],id),Q(["a","A"],function(a,b,c){c._isPm=c._locale.isPM(a),c._meridiem=a}),Q(["h","hh"],function(a,b,c){b[id]=q(a),j(c).bigHour=!0});var Hd=/[ap]\.?m?\.?/i,Id=C("Hours",!0);H("m",["mm",2],0,"minute"),z("minute","m"),N("m",Wc),N("mm",Wc,Sc),Q(["m","mm"],jd);var Jd=C("Minutes",!1);H("s",["ss",2],0,"second"),z("second","s"),N("s",Wc),N("ss",Wc,Sc),Q(["s","ss"],kd);var Kd=C("Seconds",!1);H("S",0,0,function(){return~~(this.millisecond()/100)}),H(0,["SS",2],0,function(){return~~(this.millisecond()/10)}),H(0,["SSS",3],0,"millisecond"),H(0,["SSSS",4],0,function(){return 10*this.millisecond()}),H(0,["SSSSS",5],0,function(){return 100*this.millisecond()}),H(0,["SSSSSS",6],0,function(){return 1e3*this.millisecond()}),H(0,["SSSSSSS",7],0,function(){return 1e4*this.millisecond()}),H(0,["SSSSSSSS",8],0,function(){return 1e5*this.millisecond()}),H(0,["SSSSSSSSS",9],0,function(){return 1e6*this.millisecond()}),z("millisecond","ms"),N("S",Xc,Rc),N("SS",Xc,Sc),N("SSS",Xc,Tc);var Ld;for(Ld="SSSS";Ld.length<=9;Ld+="S")N(Ld,$c);for(Ld="S";Ld.length<=9;Ld+="S")Q(Ld,Wb);var Md=C("Milliseconds",!1);H("z",0,0,"zoneAbbr"),H("zz",0,0,"zoneName");var Nd=n.prototype;Nd.add=Ad,Nd.calendar=cb,Nd.clone=db,Nd.diff=ib,Nd.endOf=ub,Nd.format=mb,Nd.from=nb,Nd.fromNow=ob,Nd.to=pb,Nd.toNow=qb,Nd.get=F,Nd.invalidAt=Cb,Nd.isAfter=eb,Nd.isBefore=fb,Nd.isBetween=gb,Nd.isSame=hb,Nd.isValid=Ab,Nd.lang=Cd,Nd.locale=rb,Nd.localeData=sb,Nd.max=wd,Nd.min=vd,Nd.parsingFlags=Bb,Nd.set=F,Nd.startOf=tb,Nd.subtract=Bd,Nd.toArray=yb,Nd.toObject=zb,Nd.toDate=xb,Nd.toISOString=lb,Nd.toJSON=lb,Nd.toString=kb,Nd.unix=wb,Nd.valueOf=vb,Nd.year=td,Nd.isLeapYear=ia,Nd.weekYear=Fb,Nd.isoWeekYear=Gb,Nd.quarter=Nd.quarters=Jb,Nd.month=Y,Nd.daysInMonth=Z,Nd.week=Nd.weeks=na,Nd.isoWeek=Nd.isoWeeks=oa,Nd.weeksInYear=Ib,Nd.isoWeeksInYear=Hb,Nd.date=Dd,Nd.day=Nd.days=Pb,Nd.weekday=Qb,Nd.isoWeekday=Rb,Nd.dayOfYear=qa,Nd.hour=Nd.hours=Id,Nd.minute=Nd.minutes=Jd,Nd.second=Nd.seconds=Kd,
7
+ Nd.millisecond=Nd.milliseconds=Md,Nd.utcOffset=Na,Nd.utc=Pa,Nd.local=Qa,Nd.parseZone=Ra,Nd.hasAlignedHourOffset=Sa,Nd.isDST=Ta,Nd.isDSTShifted=Ua,Nd.isLocal=Va,Nd.isUtcOffset=Wa,Nd.isUtc=Xa,Nd.isUTC=Xa,Nd.zoneAbbr=Xb,Nd.zoneName=Yb,Nd.dates=aa("dates accessor is deprecated. Use date instead.",Dd),Nd.months=aa("months accessor is deprecated. Use month instead",Y),Nd.years=aa("years accessor is deprecated. Use year instead",td),Nd.zone=aa("moment().zone is deprecated, use moment().utcOffset instead. https://github.com/moment/moment/issues/1779",Oa);var Od=Nd,Pd={sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"},Qd={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},Rd="Invalid date",Sd="%d",Td=/\d{1,2}/,Ud={future:"in %s",past:"%s ago",s:"a few seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},Vd=s.prototype;Vd._calendar=Pd,Vd.calendar=_b,Vd._longDateFormat=Qd,Vd.longDateFormat=ac,Vd._invalidDate=Rd,Vd.invalidDate=bc,Vd._ordinal=Sd,Vd.ordinal=cc,Vd._ordinalParse=Td,Vd.preparse=dc,Vd.postformat=dc,Vd._relativeTime=Ud,Vd.relativeTime=ec,Vd.pastFuture=fc,Vd.set=gc,Vd.months=U,Vd._months=md,Vd.monthsShort=V,Vd._monthsShort=nd,Vd.monthsParse=W,Vd.week=ka,Vd._week=ud,Vd.firstDayOfYear=ma,Vd.firstDayOfWeek=la,Vd.weekdays=Lb,Vd._weekdays=Ed,Vd.weekdaysMin=Nb,Vd._weekdaysMin=Gd,Vd.weekdaysShort=Mb,Vd._weekdaysShort=Fd,Vd.weekdaysParse=Ob,Vd.isPM=Ub,Vd._meridiemParse=Hd,Vd.meridiem=Vb,w("en",{ordinalParse:/\d{1,2}(th|st|nd|rd)/,ordinal:function(a){var b=a%10,c=1===q(a%100/10)?"th":1===b?"st":2===b?"nd":3===b?"rd":"th";return a+c}}),a.lang=aa("moment.lang is deprecated. Use moment.locale instead.",w),a.langData=aa("moment.langData is deprecated. Use moment.localeData instead.",y);var Wd=Math.abs,Xd=yc("ms"),Yd=yc("s"),Zd=yc("m"),$d=yc("h"),_d=yc("d"),ae=yc("w"),be=yc("M"),ce=yc("y"),de=Ac("milliseconds"),ee=Ac("seconds"),fe=Ac("minutes"),ge=Ac("hours"),he=Ac("days"),ie=Ac("months"),je=Ac("years"),ke=Math.round,le={s:45,m:45,h:22,d:26,M:11},me=Math.abs,ne=Ha.prototype;ne.abs=oc,ne.add=qc,ne.subtract=rc,ne.as=wc,ne.asMilliseconds=Xd,ne.asSeconds=Yd,ne.asMinutes=Zd,ne.asHours=$d,ne.asDays=_d,ne.asWeeks=ae,ne.asMonths=be,ne.asYears=ce,ne.valueOf=xc,ne._bubble=tc,ne.get=zc,ne.milliseconds=de,ne.seconds=ee,ne.minutes=fe,ne.hours=ge,ne.days=he,ne.weeks=Bc,ne.months=ie,ne.years=je,ne.humanize=Fc,ne.toISOString=Gc,ne.toString=Gc,ne.toJSON=Gc,ne.locale=rb,ne.localeData=sb,ne.toIsoString=aa("toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)",Gc),ne.lang=Cd,H("X",0,0,"unix"),H("x",0,0,"valueOf"),N("x",_c),N("X",bd),Q("X",function(a,b,c){c._d=new Date(1e3*parseFloat(a,10))}),Q("x",function(a,b,c){c._d=new Date(q(a))}),a.version="2.10.6",b(Da),a.fn=Od,a.min=Fa,a.max=Ga,a.utc=h,a.unix=Zb,a.months=jc,a.isDate=d,a.locale=w,a.invalid=l,a.duration=Ya,a.isMoment=o,a.weekdays=lc,a.parseZone=$b,a.localeData=y,a.isDuration=Ia,a.monthsShort=kc,a.weekdaysMin=nc,a.defineLocale=x,a.weekdaysShort=mc,a.normalizeUnits=A,a.relativeTimeThreshold=Ec;var oe=a;return oe});
@@ -0,0 +1,7 @@
1
+ /*!
2
+ * typeahead.js 0.11.1
3
+ * https://github.com/twitter/typeahead.js
4
+ * Copyright 2013-2015 Twitter, Inc. and other contributors; Licensed MIT
5
+ */
6
+
7
+ !function(a,b){"function"==typeof define&&define.amd?define("bloodhound",["jquery"],function(c){return a.Bloodhound=b(c)}):"object"==typeof exports?module.exports=b(require("jquery")):a.Bloodhound=b(jQuery)}(this,function(a){var b=function(){"use strict";return{isMsie:function(){return/(msie|trident)/i.test(navigator.userAgent)?navigator.userAgent.match(/(msie |rv:)(\d+(.\d+)?)/i)[2]:!1},isBlankString:function(a){return!a||/^\s*$/.test(a)},escapeRegExChars:function(a){return a.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")},isString:function(a){return"string"==typeof a},isNumber:function(a){return"number"==typeof a},isArray:a.isArray,isFunction:a.isFunction,isObject:a.isPlainObject,isUndefined:function(a){return"undefined"==typeof a},isElement:function(a){return!(!a||1!==a.nodeType)},isJQuery:function(b){return b instanceof a},toStr:function(a){return b.isUndefined(a)||null===a?"":a+""},bind:a.proxy,each:function(b,c){function d(a,b){return c(b,a)}a.each(b,d)},map:a.map,filter:a.grep,every:function(b,c){var d=!0;return b?(a.each(b,function(a,e){return(d=c.call(null,e,a,b))?void 0:!1}),!!d):d},some:function(b,c){var d=!1;return b?(a.each(b,function(a,e){return(d=c.call(null,e,a,b))?!1:void 0}),!!d):d},mixin:a.extend,identity:function(a){return a},clone:function(b){return a.extend(!0,{},b)},getIdGenerator:function(){var a=0;return function(){return a++}},templatify:function(b){function c(){return String(b)}return a.isFunction(b)?b:c},defer:function(a){setTimeout(a,0)},debounce:function(a,b,c){var d,e;return function(){var f,g,h=this,i=arguments;return f=function(){d=null,c||(e=a.apply(h,i))},g=c&&!d,clearTimeout(d),d=setTimeout(f,b),g&&(e=a.apply(h,i)),e}},throttle:function(a,b){var c,d,e,f,g,h;return g=0,h=function(){g=new Date,e=null,f=a.apply(c,d)},function(){var i=new Date,j=b-(i-g);return c=this,d=arguments,0>=j?(clearTimeout(e),e=null,g=i,f=a.apply(c,d)):e||(e=setTimeout(h,j)),f}},stringify:function(a){return b.isString(a)?a:JSON.stringify(a)},noop:function(){}}}(),c="0.11.1",d=function(){"use strict";function a(a){return a=b.toStr(a),a?a.split(/\s+/):[]}function c(a){return a=b.toStr(a),a?a.split(/\W+/):[]}function d(a){return function(c){return c=b.isArray(c)?c:[].slice.call(arguments,0),function(d){var e=[];return b.each(c,function(c){e=e.concat(a(b.toStr(d[c])))}),e}}}return{nonword:c,whitespace:a,obj:{nonword:d(c),whitespace:d(a)}}}(),e=function(){"use strict";function c(c){this.maxSize=b.isNumber(c)?c:100,this.reset(),this.maxSize<=0&&(this.set=this.get=a.noop)}function d(){this.head=this.tail=null}function e(a,b){this.key=a,this.val=b,this.prev=this.next=null}return b.mixin(c.prototype,{set:function(a,b){var c,d=this.list.tail;this.size>=this.maxSize&&(this.list.remove(d),delete this.hash[d.key],this.size--),(c=this.hash[a])?(c.val=b,this.list.moveToFront(c)):(c=new e(a,b),this.list.add(c),this.hash[a]=c,this.size++)},get:function(a){var b=this.hash[a];return b?(this.list.moveToFront(b),b.val):void 0},reset:function(){this.size=0,this.hash={},this.list=new d}}),b.mixin(d.prototype,{add:function(a){this.head&&(a.next=this.head,this.head.prev=a),this.head=a,this.tail=this.tail||a},remove:function(a){a.prev?a.prev.next=a.next:this.head=a.next,a.next?a.next.prev=a.prev:this.tail=a.prev},moveToFront:function(a){this.remove(a),this.add(a)}}),c}(),f=function(){"use strict";function c(a,c){this.prefix=["__",a,"__"].join(""),this.ttlKey="__ttl__",this.keyMatcher=new RegExp("^"+b.escapeRegExChars(this.prefix)),this.ls=c||h,!this.ls&&this._noop()}function d(){return(new Date).getTime()}function e(a){return JSON.stringify(b.isUndefined(a)?null:a)}function f(b){return a.parseJSON(b)}function g(a){var b,c,d=[],e=h.length;for(b=0;e>b;b++)(c=h.key(b)).match(a)&&d.push(c.replace(a,""));return d}var h;try{h=window.localStorage,h.setItem("~~~","!"),h.removeItem("~~~")}catch(i){h=null}return b.mixin(c.prototype,{_prefix:function(a){return this.prefix+a},_ttlKey:function(a){return this._prefix(a)+this.ttlKey},_noop:function(){this.get=this.set=this.remove=this.clear=this.isExpired=b.noop},_safeSet:function(a,b){try{this.ls.setItem(a,b)}catch(c){"QuotaExceededError"===c.name&&(this.clear(),this._noop())}},get:function(a){return this.isExpired(a)&&this.remove(a),f(this.ls.getItem(this._prefix(a)))},set:function(a,c,f){return b.isNumber(f)?this._safeSet(this._ttlKey(a),e(d()+f)):this.ls.removeItem(this._ttlKey(a)),this._safeSet(this._prefix(a),e(c))},remove:function(a){return this.ls.removeItem(this._ttlKey(a)),this.ls.removeItem(this._prefix(a)),this},clear:function(){var a,b=g(this.keyMatcher);for(a=b.length;a--;)this.remove(b[a]);return this},isExpired:function(a){var c=f(this.ls.getItem(this._ttlKey(a)));return b.isNumber(c)&&d()>c?!0:!1}}),c}(),g=function(){"use strict";function c(a){a=a||{},this.cancelled=!1,this.lastReq=null,this._send=a.transport,this._get=a.limiter?a.limiter(this._get):this._get,this._cache=a.cache===!1?new e(0):h}var d=0,f={},g=6,h=new e(10);return c.setMaxPendingRequests=function(a){g=a},c.resetCache=function(){h.reset()},b.mixin(c.prototype,{_fingerprint:function(b){return b=b||{},b.url+b.type+a.param(b.data||{})},_get:function(a,b){function c(a){b(null,a),k._cache.set(i,a)}function e(){b(!0)}function h(){d--,delete f[i],k.onDeckRequestArgs&&(k._get.apply(k,k.onDeckRequestArgs),k.onDeckRequestArgs=null)}var i,j,k=this;i=this._fingerprint(a),this.cancelled||i!==this.lastReq||((j=f[i])?j.done(c).fail(e):g>d?(d++,f[i]=this._send(a).done(c).fail(e).always(h)):this.onDeckRequestArgs=[].slice.call(arguments,0))},get:function(c,d){var e,f;d=d||a.noop,c=b.isString(c)?{url:c}:c||{},f=this._fingerprint(c),this.cancelled=!1,this.lastReq=f,(e=this._cache.get(f))?d(null,e):this._get(c,d)},cancel:function(){this.cancelled=!0}}),c}(),h=window.SearchIndex=function(){"use strict";function c(c){c=c||{},c.datumTokenizer&&c.queryTokenizer||a.error("datumTokenizer and queryTokenizer are both required"),this.identify=c.identify||b.stringify,this.datumTokenizer=c.datumTokenizer,this.queryTokenizer=c.queryTokenizer,this.reset()}function d(a){return a=b.filter(a,function(a){return!!a}),a=b.map(a,function(a){return a.toLowerCase()})}function e(){var a={};return a[i]=[],a[h]={},a}function f(a){for(var b={},c=[],d=0,e=a.length;e>d;d++)b[a[d]]||(b[a[d]]=!0,c.push(a[d]));return c}function g(a,b){var c=0,d=0,e=[];a=a.sort(),b=b.sort();for(var f=a.length,g=b.length;f>c&&g>d;)a[c]<b[d]?c++:a[c]>b[d]?d++:(e.push(a[c]),c++,d++);return e}var h="c",i="i";return b.mixin(c.prototype,{bootstrap:function(a){this.datums=a.datums,this.trie=a.trie},add:function(a){var c=this;a=b.isArray(a)?a:[a],b.each(a,function(a){var f,g;c.datums[f=c.identify(a)]=a,g=d(c.datumTokenizer(a)),b.each(g,function(a){var b,d,g;for(b=c.trie,d=a.split("");g=d.shift();)b=b[h][g]||(b[h][g]=e()),b[i].push(f)})})},get:function(a){var c=this;return b.map(a,function(a){return c.datums[a]})},search:function(a){var c,e,j=this;return c=d(this.queryTokenizer(a)),b.each(c,function(a){var b,c,d,f;if(e&&0===e.length)return!1;for(b=j.trie,c=a.split("");b&&(d=c.shift());)b=b[h][d];return b&&0===c.length?(f=b[i].slice(0),void(e=e?g(e,f):f)):(e=[],!1)}),e?b.map(f(e),function(a){return j.datums[a]}):[]},all:function(){var a=[];for(var b in this.datums)a.push(this.datums[b]);return a},reset:function(){this.datums={},this.trie=e()},serialize:function(){return{datums:this.datums,trie:this.trie}}}),c}(),i=function(){"use strict";function a(a){this.url=a.url,this.ttl=a.ttl,this.cache=a.cache,this.prepare=a.prepare,this.transform=a.transform,this.transport=a.transport,this.thumbprint=a.thumbprint,this.storage=new f(a.cacheKey)}var c;return c={data:"data",protocol:"protocol",thumbprint:"thumbprint"},b.mixin(a.prototype,{_settings:function(){return{url:this.url,type:"GET",dataType:"json"}},store:function(a){this.cache&&(this.storage.set(c.data,a,this.ttl),this.storage.set(c.protocol,location.protocol,this.ttl),this.storage.set(c.thumbprint,this.thumbprint,this.ttl))},fromCache:function(){var a,b={};return this.cache?(b.data=this.storage.get(c.data),b.protocol=this.storage.get(c.protocol),b.thumbprint=this.storage.get(c.thumbprint),a=b.thumbprint!==this.thumbprint||b.protocol!==location.protocol,b.data&&!a?b.data:null):null},fromNetwork:function(a){function b(){a(!0)}function c(b){a(null,e.transform(b))}var d,e=this;a&&(d=this.prepare(this._settings()),this.transport(d).fail(b).done(c))},clear:function(){return this.storage.clear(),this}}),a}(),j=function(){"use strict";function a(a){this.url=a.url,this.prepare=a.prepare,this.transform=a.transform,this.transport=new g({cache:a.cache,limiter:a.limiter,transport:a.transport})}return b.mixin(a.prototype,{_settings:function(){return{url:this.url,type:"GET",dataType:"json"}},get:function(a,b){function c(a,c){b(a?[]:e.transform(c))}var d,e=this;if(b)return a=a||"",d=this.prepare(a,this._settings()),this.transport.get(d,c)},cancelLastRequest:function(){this.transport.cancel()}}),a}(),k=function(){"use strict";function d(d){var e;return d?(e={url:null,ttl:864e5,cache:!0,cacheKey:null,thumbprint:"",prepare:b.identity,transform:b.identity,transport:null},d=b.isString(d)?{url:d}:d,d=b.mixin(e,d),!d.url&&a.error("prefetch requires url to be set"),d.transform=d.filter||d.transform,d.cacheKey=d.cacheKey||d.url,d.thumbprint=c+d.thumbprint,d.transport=d.transport?h(d.transport):a.ajax,d):null}function e(c){var d;if(c)return d={url:null,cache:!0,prepare:null,replace:null,wildcard:null,limiter:null,rateLimitBy:"debounce",rateLimitWait:300,transform:b.identity,transport:null},c=b.isString(c)?{url:c}:c,c=b.mixin(d,c),!c.url&&a.error("remote requires url to be set"),c.transform=c.filter||c.transform,c.prepare=f(c),c.limiter=g(c),c.transport=c.transport?h(c.transport):a.ajax,delete c.replace,delete c.wildcard,delete c.rateLimitBy,delete c.rateLimitWait,c}function f(a){function b(a,b){return b.url=f(b.url,a),b}function c(a,b){return b.url=b.url.replace(g,encodeURIComponent(a)),b}function d(a,b){return b}var e,f,g;return e=a.prepare,f=a.replace,g=a.wildcard,e?e:e=f?b:a.wildcard?c:d}function g(a){function c(a){return function(c){return b.debounce(c,a)}}function d(a){return function(c){return b.throttle(c,a)}}var e,f,g;return e=a.limiter,f=a.rateLimitBy,g=a.rateLimitWait,e||(e=/^throttle$/i.test(f)?d(g):c(g)),e}function h(c){return function(d){function e(a){b.defer(function(){g.resolve(a)})}function f(a){b.defer(function(){g.reject(a)})}var g=a.Deferred();return c(d,e,f),g}}return function(c){var f,g;return f={initialize:!0,identify:b.stringify,datumTokenizer:null,queryTokenizer:null,sufficient:5,sorter:null,local:[],prefetch:null,remote:null},c=b.mixin(f,c||{}),!c.datumTokenizer&&a.error("datumTokenizer is required"),!c.queryTokenizer&&a.error("queryTokenizer is required"),g=c.sorter,c.sorter=g?function(a){return a.sort(g)}:b.identity,c.local=b.isFunction(c.local)?c.local():c.local,c.prefetch=d(c.prefetch),c.remote=e(c.remote),c}}(),l=function(){"use strict";function c(a){a=k(a),this.sorter=a.sorter,this.identify=a.identify,this.sufficient=a.sufficient,this.local=a.local,this.remote=a.remote?new j(a.remote):null,this.prefetch=a.prefetch?new i(a.prefetch):null,this.index=new h({identify:this.identify,datumTokenizer:a.datumTokenizer,queryTokenizer:a.queryTokenizer}),a.initialize!==!1&&this.initialize()}var e;return e=window&&window.Bloodhound,c.noConflict=function(){return window&&(window.Bloodhound=e),c},c.tokenizers=d,b.mixin(c.prototype,{__ttAdapter:function(){function a(a,b,d){return c.search(a,b,d)}function b(a,b){return c.search(a,b)}var c=this;return this.remote?a:b},_loadPrefetch:function(){function b(a,b){return a?c.reject():(e.add(b),e.prefetch.store(e.index.serialize()),void c.resolve())}var c,d,e=this;return c=a.Deferred(),this.prefetch?(d=this.prefetch.fromCache())?(this.index.bootstrap(d),c.resolve()):this.prefetch.fromNetwork(b):c.resolve(),c.promise()},_initialize:function(){function a(){b.add(b.local)}var b=this;return this.clear(),(this.initPromise=this._loadPrefetch()).done(a),this.initPromise},initialize:function(a){return!this.initPromise||a?this._initialize():this.initPromise},add:function(a){return this.index.add(a),this},get:function(a){return a=b.isArray(a)?a:[].slice.call(arguments),this.index.get(a)},search:function(a,c,d){function e(a){var c=[];b.each(a,function(a){!b.some(f,function(b){return g.identify(a)===g.identify(b)})&&c.push(a)}),d&&d(c)}var f,g=this;return f=this.sorter(this.index.search(a)),c(this.remote?f.slice():f),this.remote&&f.length<this.sufficient?this.remote.get(a,e):this.remote&&this.remote.cancelLastRequest(),this},all:function(){return this.index.all()},clear:function(){return this.index.reset(),this},clearPrefetchCache:function(){return this.prefetch&&this.prefetch.clear(),this},clearRemoteCache:function(){return g.resetCache(),this},ttAdapter:function(){return this.__ttAdapter()}}),c}();return l});
@@ -0,0 +1,2610 @@
1
+ /*!
2
+
3
+ handlebars v1.2.0
4
+
5
+ Copyright (C) 2011 by Yehuda Katz
6
+
7
+ Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ of this software and associated documentation files (the "Software"), to deal
9
+ in the Software without restriction, including without limitation the rights
10
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ copies of the Software, and to permit persons to whom the Software is
12
+ furnished to do so, subject to the following conditions:
13
+
14
+ The above copyright notice and this permission notice shall be included in
15
+ all copies or substantial portions of the Software.
16
+
17
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23
+ THE SOFTWARE.
24
+
25
+ @license
26
+ */
27
+ var Handlebars = (function() {
28
+ // handlebars/safe-string.js
29
+ var __module4__ = (function() {
30
+ "use strict";
31
+ var __exports__;
32
+ // Build out our basic SafeString type
33
+ function SafeString(string) {
34
+ this.string = string;
35
+ }
36
+
37
+ SafeString.prototype.toString = function() {
38
+ return "" + this.string;
39
+ };
40
+
41
+ __exports__ = SafeString;
42
+ return __exports__;
43
+ })();
44
+
45
+ // handlebars/utils.js
46
+ var __module3__ = (function(__dependency1__) {
47
+ "use strict";
48
+ var __exports__ = {};
49
+ /*jshint -W004 */
50
+ var SafeString = __dependency1__;
51
+
52
+ var escape = {
53
+ "&": "&amp;",
54
+ "<": "&lt;",
55
+ ">": "&gt;",
56
+ '"': "&quot;",
57
+ "'": "&#x27;",
58
+ "`": "&#x60;"
59
+ };
60
+
61
+ var badChars = /[&<>"'`]/g;
62
+ var possible = /[&<>"'`]/;
63
+
64
+ function escapeChar(chr) {
65
+ return escape[chr] || "&amp;";
66
+ }
67
+
68
+ function extend(obj, value) {
69
+ for(var key in value) {
70
+ if(Object.prototype.hasOwnProperty.call(value, key)) {
71
+ obj[key] = value[key];
72
+ }
73
+ }
74
+ }
75
+
76
+ __exports__.extend = extend;var toString = Object.prototype.toString;
77
+ __exports__.toString = toString;
78
+ // Sourced from lodash
79
+ // https://github.com/bestiejs/lodash/blob/master/LICENSE.txt
80
+ var isFunction = function(value) {
81
+ return typeof value === 'function';
82
+ };
83
+ // fallback for older versions of Chrome and Safari
84
+ if (isFunction(/x/)) {
85
+ isFunction = function(value) {
86
+ return typeof value === 'function' && toString.call(value) === '[object Function]';
87
+ };
88
+ }
89
+ var isFunction;
90
+ __exports__.isFunction = isFunction;
91
+ var isArray = Array.isArray || function(value) {
92
+ return (value && typeof value === 'object') ? toString.call(value) === '[object Array]' : false;
93
+ };
94
+ __exports__.isArray = isArray;
95
+
96
+ function escapeExpression(string) {
97
+ // don't escape SafeStrings, since they're already safe
98
+ if (string instanceof SafeString) {
99
+ return string.toString();
100
+ } else if (!string && string !== 0) {
101
+ return "";
102
+ }
103
+
104
+ // Force a string conversion as this will be done by the append regardless and
105
+ // the regex test will do this transparently behind the scenes, causing issues if
106
+ // an object's to string has escaped characters in it.
107
+ string = "" + string;
108
+
109
+ if(!possible.test(string)) { return string; }
110
+ return string.replace(badChars, escapeChar);
111
+ }
112
+
113
+ __exports__.escapeExpression = escapeExpression;function isEmpty(value) {
114
+ if (!value && value !== 0) {
115
+ return true;
116
+ } else if (isArray(value) && value.length === 0) {
117
+ return true;
118
+ } else {
119
+ return false;
120
+ }
121
+ }
122
+
123
+ __exports__.isEmpty = isEmpty;
124
+ return __exports__;
125
+ })(__module4__);
126
+
127
+ // handlebars/exception.js
128
+ var __module5__ = (function() {
129
+ "use strict";
130
+ var __exports__;
131
+
132
+ var errorProps = ['description', 'fileName', 'lineNumber', 'message', 'name', 'number', 'stack'];
133
+
134
+ function Exception(/* message */) {
135
+ var tmp = Error.prototype.constructor.apply(this, arguments);
136
+
137
+ // Unfortunately errors are not enumerable in Chrome (at least), so `for prop in tmp` doesn't work.
138
+ for (var idx = 0; idx < errorProps.length; idx++) {
139
+ this[errorProps[idx]] = tmp[errorProps[idx]];
140
+ }
141
+ }
142
+
143
+ Exception.prototype = new Error();
144
+
145
+ __exports__ = Exception;
146
+ return __exports__;
147
+ })();
148
+
149
+ // handlebars/base.js
150
+ var __module2__ = (function(__dependency1__, __dependency2__) {
151
+ "use strict";
152
+ var __exports__ = {};
153
+ var Utils = __dependency1__;
154
+ var Exception = __dependency2__;
155
+
156
+ var VERSION = "1.2.0";
157
+ __exports__.VERSION = VERSION;var COMPILER_REVISION = 4;
158
+ __exports__.COMPILER_REVISION = COMPILER_REVISION;
159
+ var REVISION_CHANGES = {
160
+ 1: '<= 1.0.rc.2', // 1.0.rc.2 is actually rev2 but doesn't report it
161
+ 2: '== 1.0.0-rc.3',
162
+ 3: '== 1.0.0-rc.4',
163
+ 4: '>= 1.0.0'
164
+ };
165
+ __exports__.REVISION_CHANGES = REVISION_CHANGES;
166
+ var isArray = Utils.isArray,
167
+ isFunction = Utils.isFunction,
168
+ toString = Utils.toString,
169
+ objectType = '[object Object]';
170
+
171
+ function HandlebarsEnvironment(helpers, partials) {
172
+ this.helpers = helpers || {};
173
+ this.partials = partials || {};
174
+
175
+ registerDefaultHelpers(this);
176
+ }
177
+
178
+ __exports__.HandlebarsEnvironment = HandlebarsEnvironment;HandlebarsEnvironment.prototype = {
179
+ constructor: HandlebarsEnvironment,
180
+
181
+ logger: logger,
182
+ log: log,
183
+
184
+ registerHelper: function(name, fn, inverse) {
185
+ if (toString.call(name) === objectType) {
186
+ if (inverse || fn) { throw new Exception('Arg not supported with multiple helpers'); }
187
+ Utils.extend(this.helpers, name);
188
+ } else {
189
+ if (inverse) { fn.not = inverse; }
190
+ this.helpers[name] = fn;
191
+ }
192
+ },
193
+
194
+ registerPartial: function(name, str) {
195
+ if (toString.call(name) === objectType) {
196
+ Utils.extend(this.partials, name);
197
+ } else {
198
+ this.partials[name] = str;
199
+ }
200
+ }
201
+ };
202
+
203
+ function registerDefaultHelpers(instance) {
204
+ instance.registerHelper('helperMissing', function(arg) {
205
+ if(arguments.length === 2) {
206
+ return undefined;
207
+ } else {
208
+ throw new Error("Missing helper: '" + arg + "'");
209
+ }
210
+ });
211
+
212
+ instance.registerHelper('blockHelperMissing', function(context, options) {
213
+ var inverse = options.inverse || function() {}, fn = options.fn;
214
+
215
+ if (isFunction(context)) { context = context.call(this); }
216
+
217
+ if(context === true) {
218
+ return fn(this);
219
+ } else if(context === false || context == null) {
220
+ return inverse(this);
221
+ } else if (isArray(context)) {
222
+ if(context.length > 0) {
223
+ return instance.helpers.each(context, options);
224
+ } else {
225
+ return inverse(this);
226
+ }
227
+ } else {
228
+ return fn(context);
229
+ }
230
+ });
231
+
232
+ instance.registerHelper('each', function(context, options) {
233
+ var fn = options.fn, inverse = options.inverse;
234
+ var i = 0, ret = "", data;
235
+
236
+ if (isFunction(context)) { context = context.call(this); }
237
+
238
+ if (options.data) {
239
+ data = createFrame(options.data);
240
+ }
241
+
242
+ if(context && typeof context === 'object') {
243
+ if (isArray(context)) {
244
+ for(var j = context.length; i<j; i++) {
245
+ if (data) {
246
+ data.index = i;
247
+ data.first = (i === 0);
248
+ data.last = (i === (context.length-1));
249
+ }
250
+ ret = ret + fn(context[i], { data: data });
251
+ }
252
+ } else {
253
+ for(var key in context) {
254
+ if(context.hasOwnProperty(key)) {
255
+ if(data) {
256
+ data.key = key;
257
+ data.index = i;
258
+ data.first = (i === 0);
259
+ }
260
+ ret = ret + fn(context[key], {data: data});
261
+ i++;
262
+ }
263
+ }
264
+ }
265
+ }
266
+
267
+ if(i === 0){
268
+ ret = inverse(this);
269
+ }
270
+
271
+ return ret;
272
+ });
273
+
274
+ instance.registerHelper('if', function(conditional, options) {
275
+ if (isFunction(conditional)) { conditional = conditional.call(this); }
276
+
277
+ // Default behavior is to render the positive path if the value is truthy and not empty.
278
+ // The `includeZero` option may be set to treat the condtional as purely not empty based on the
279
+ // behavior of isEmpty. Effectively this determines if 0 is handled by the positive path or negative.
280
+ if ((!options.hash.includeZero && !conditional) || Utils.isEmpty(conditional)) {
281
+ return options.inverse(this);
282
+ } else {
283
+ return options.fn(this);
284
+ }
285
+ });
286
+
287
+ instance.registerHelper('unless', function(conditional, options) {
288
+ return instance.helpers['if'].call(this, conditional, {fn: options.inverse, inverse: options.fn, hash: options.hash});
289
+ });
290
+
291
+ instance.registerHelper('with', function(context, options) {
292
+ if (isFunction(context)) { context = context.call(this); }
293
+
294
+ if (!Utils.isEmpty(context)) return options.fn(context);
295
+ });
296
+
297
+ instance.registerHelper('log', function(context, options) {
298
+ var level = options.data && options.data.level != null ? parseInt(options.data.level, 10) : 1;
299
+ instance.log(level, context);
300
+ });
301
+ }
302
+
303
+ var logger = {
304
+ methodMap: { 0: 'debug', 1: 'info', 2: 'warn', 3: 'error' },
305
+
306
+ // State enum
307
+ DEBUG: 0,
308
+ INFO: 1,
309
+ WARN: 2,
310
+ ERROR: 3,
311
+ level: 3,
312
+
313
+ // can be overridden in the host environment
314
+ log: function(level, obj) {
315
+ if (logger.level <= level) {
316
+ var method = logger.methodMap[level];
317
+ if (typeof console !== 'undefined' && console[method]) {
318
+ console[method].call(console, obj);
319
+ }
320
+ }
321
+ }
322
+ };
323
+ __exports__.logger = logger;
324
+ function log(level, obj) { logger.log(level, obj); }
325
+
326
+ __exports__.log = log;var createFrame = function(object) {
327
+ var obj = {};
328
+ Utils.extend(obj, object);
329
+ return obj;
330
+ };
331
+ __exports__.createFrame = createFrame;
332
+ return __exports__;
333
+ })(__module3__, __module5__);
334
+
335
+ // handlebars/runtime.js
336
+ var __module6__ = (function(__dependency1__, __dependency2__, __dependency3__) {
337
+ "use strict";
338
+ var __exports__ = {};
339
+ var Utils = __dependency1__;
340
+ var Exception = __dependency2__;
341
+ var COMPILER_REVISION = __dependency3__.COMPILER_REVISION;
342
+ var REVISION_CHANGES = __dependency3__.REVISION_CHANGES;
343
+
344
+ function checkRevision(compilerInfo) {
345
+ var compilerRevision = compilerInfo && compilerInfo[0] || 1,
346
+ currentRevision = COMPILER_REVISION;
347
+
348
+ if (compilerRevision !== currentRevision) {
349
+ if (compilerRevision < currentRevision) {
350
+ var runtimeVersions = REVISION_CHANGES[currentRevision],
351
+ compilerVersions = REVISION_CHANGES[compilerRevision];
352
+ throw new Error("Template was precompiled with an older version of Handlebars than the current runtime. "+
353
+ "Please update your precompiler to a newer version ("+runtimeVersions+") or downgrade your runtime to an older version ("+compilerVersions+").");
354
+ } else {
355
+ // Use the embedded version info since the runtime doesn't know about this revision yet
356
+ throw new Error("Template was precompiled with a newer version of Handlebars than the current runtime. "+
357
+ "Please update your runtime to a newer version ("+compilerInfo[1]+").");
358
+ }
359
+ }
360
+ }
361
+
362
+ __exports__.checkRevision = checkRevision;// TODO: Remove this line and break up compilePartial
363
+
364
+ function template(templateSpec, env) {
365
+ if (!env) {
366
+ throw new Error("No environment passed to template");
367
+ }
368
+
369
+ // Note: Using env.VM references rather than local var references throughout this section to allow
370
+ // for external users to override these as psuedo-supported APIs.
371
+ var invokePartialWrapper = function(partial, name, context, helpers, partials, data) {
372
+ var result = env.VM.invokePartial.apply(this, arguments);
373
+ if (result != null) { return result; }
374
+
375
+ if (env.compile) {
376
+ var options = { helpers: helpers, partials: partials, data: data };
377
+ partials[name] = env.compile(partial, { data: data !== undefined }, env);
378
+ return partials[name](context, options);
379
+ } else {
380
+ throw new Exception("The partial " + name + " could not be compiled when running in runtime-only mode");
381
+ }
382
+ };
383
+
384
+ // Just add water
385
+ var container = {
386
+ escapeExpression: Utils.escapeExpression,
387
+ invokePartial: invokePartialWrapper,
388
+ programs: [],
389
+ program: function(i, fn, data) {
390
+ var programWrapper = this.programs[i];
391
+ if(data) {
392
+ programWrapper = program(i, fn, data);
393
+ } else if (!programWrapper) {
394
+ programWrapper = this.programs[i] = program(i, fn);
395
+ }
396
+ return programWrapper;
397
+ },
398
+ merge: function(param, common) {
399
+ var ret = param || common;
400
+
401
+ if (param && common && (param !== common)) {
402
+ ret = {};
403
+ Utils.extend(ret, common);
404
+ Utils.extend(ret, param);
405
+ }
406
+ return ret;
407
+ },
408
+ programWithDepth: env.VM.programWithDepth,
409
+ noop: env.VM.noop,
410
+ compilerInfo: null
411
+ };
412
+
413
+ return function(context, options) {
414
+ options = options || {};
415
+ var namespace = options.partial ? options : env,
416
+ helpers,
417
+ partials;
418
+
419
+ if (!options.partial) {
420
+ helpers = options.helpers;
421
+ partials = options.partials;
422
+ }
423
+ var result = templateSpec.call(
424
+ container,
425
+ namespace, context,
426
+ helpers,
427
+ partials,
428
+ options.data);
429
+
430
+ if (!options.partial) {
431
+ env.VM.checkRevision(container.compilerInfo);
432
+ }
433
+
434
+ return result;
435
+ };
436
+ }
437
+
438
+ __exports__.template = template;function programWithDepth(i, fn, data /*, $depth */) {
439
+ var args = Array.prototype.slice.call(arguments, 3);
440
+
441
+ var prog = function(context, options) {
442
+ options = options || {};
443
+
444
+ return fn.apply(this, [context, options.data || data].concat(args));
445
+ };
446
+ prog.program = i;
447
+ prog.depth = args.length;
448
+ return prog;
449
+ }
450
+
451
+ __exports__.programWithDepth = programWithDepth;function program(i, fn, data) {
452
+ var prog = function(context, options) {
453
+ options = options || {};
454
+
455
+ return fn(context, options.data || data);
456
+ };
457
+ prog.program = i;
458
+ prog.depth = 0;
459
+ return prog;
460
+ }
461
+
462
+ __exports__.program = program;function invokePartial(partial, name, context, helpers, partials, data) {
463
+ var options = { partial: true, helpers: helpers, partials: partials, data: data };
464
+
465
+ if(partial === undefined) {
466
+ throw new Exception("The partial " + name + " could not be found");
467
+ } else if(partial instanceof Function) {
468
+ return partial(context, options);
469
+ }
470
+ }
471
+
472
+ __exports__.invokePartial = invokePartial;function noop() { return ""; }
473
+
474
+ __exports__.noop = noop;
475
+ return __exports__;
476
+ })(__module3__, __module5__, __module2__);
477
+
478
+ // handlebars.runtime.js
479
+ var __module1__ = (function(__dependency1__, __dependency2__, __dependency3__, __dependency4__, __dependency5__) {
480
+ "use strict";
481
+ var __exports__;
482
+ /*globals Handlebars: true */
483
+ var base = __dependency1__;
484
+
485
+ // Each of these augment the Handlebars object. No need to setup here.
486
+ // (This is done to easily share code between commonjs and browse envs)
487
+ var SafeString = __dependency2__;
488
+ var Exception = __dependency3__;
489
+ var Utils = __dependency4__;
490
+ var runtime = __dependency5__;
491
+
492
+ // For compatibility and usage outside of module systems, make the Handlebars object a namespace
493
+ var create = function() {
494
+ var hb = new base.HandlebarsEnvironment();
495
+
496
+ Utils.extend(hb, base);
497
+ hb.SafeString = SafeString;
498
+ hb.Exception = Exception;
499
+ hb.Utils = Utils;
500
+
501
+ hb.VM = runtime;
502
+ hb.template = function(spec) {
503
+ return runtime.template(spec, hb);
504
+ };
505
+
506
+ return hb;
507
+ };
508
+
509
+ var Handlebars = create();
510
+ Handlebars.create = create;
511
+
512
+ __exports__ = Handlebars;
513
+ return __exports__;
514
+ })(__module2__, __module4__, __module5__, __module3__, __module6__);
515
+
516
+ // handlebars/compiler/ast.js
517
+ var __module7__ = (function(__dependency1__) {
518
+ "use strict";
519
+ var __exports__;
520
+ var Exception = __dependency1__;
521
+
522
+ var AST = {
523
+ ProgramNode: function(statements, inverseStrip, inverse) {
524
+ this.type = "program";
525
+ this.statements = statements;
526
+ this.strip = {};
527
+
528
+ if(inverse) {
529
+ this.inverse = new AST.ProgramNode(inverse, inverseStrip);
530
+ this.strip.right = inverseStrip.left;
531
+ } else if (inverseStrip) {
532
+ this.strip.left = inverseStrip.right;
533
+ }
534
+ },
535
+
536
+ MustacheNode: function(rawParams, hash, open, strip) {
537
+ this.type = "mustache";
538
+ this.hash = hash;
539
+ this.strip = strip;
540
+
541
+ // Open may be a string parsed from the parser or a passed boolean flag
542
+ if (open != null && open.charAt) {
543
+ // Must use charAt to support IE pre-10
544
+ var escapeFlag = open.charAt(3) || open.charAt(2);
545
+ this.escaped = escapeFlag !== '{' && escapeFlag !== '&';
546
+ } else {
547
+ this.escaped = !!open;
548
+ }
549
+
550
+ var id = this.id = rawParams[0];
551
+ var params = this.params = rawParams.slice(1);
552
+
553
+ // a mustache is an eligible helper if:
554
+ // * its id is simple (a single part, not `this` or `..`)
555
+ var eligibleHelper = this.eligibleHelper = id.isSimple;
556
+
557
+ // a mustache is definitely a helper if:
558
+ // * it is an eligible helper, and
559
+ // * it has at least one parameter or hash segment
560
+ this.isHelper = eligibleHelper && (params.length || hash);
561
+
562
+ // if a mustache is an eligible helper but not a definite
563
+ // helper, it is ambiguous, and will be resolved in a later
564
+ // pass or at runtime.
565
+ },
566
+
567
+ PartialNode: function(partialName, context, strip) {
568
+ this.type = "partial";
569
+ this.partialName = partialName;
570
+ this.context = context;
571
+ this.strip = strip;
572
+ },
573
+
574
+ BlockNode: function(mustache, program, inverse, close) {
575
+ if(mustache.id.original !== close.path.original) {
576
+ throw new Exception(mustache.id.original + " doesn't match " + close.path.original);
577
+ }
578
+
579
+ this.type = "block";
580
+ this.mustache = mustache;
581
+ this.program = program;
582
+ this.inverse = inverse;
583
+
584
+ this.strip = {
585
+ left: mustache.strip.left,
586
+ right: close.strip.right
587
+ };
588
+
589
+ (program || inverse).strip.left = mustache.strip.right;
590
+ (inverse || program).strip.right = close.strip.left;
591
+
592
+ if (inverse && !program) {
593
+ this.isInverse = true;
594
+ }
595
+ },
596
+
597
+ ContentNode: function(string) {
598
+ this.type = "content";
599
+ this.string = string;
600
+ },
601
+
602
+ HashNode: function(pairs) {
603
+ this.type = "hash";
604
+ this.pairs = pairs;
605
+ },
606
+
607
+ IdNode: function(parts) {
608
+ this.type = "ID";
609
+
610
+ var original = "",
611
+ dig = [],
612
+ depth = 0;
613
+
614
+ for(var i=0,l=parts.length; i<l; i++) {
615
+ var part = parts[i].part;
616
+ original += (parts[i].separator || '') + part;
617
+
618
+ if (part === ".." || part === "." || part === "this") {
619
+ if (dig.length > 0) { throw new Exception("Invalid path: " + original); }
620
+ else if (part === "..") { depth++; }
621
+ else { this.isScoped = true; }
622
+ }
623
+ else { dig.push(part); }
624
+ }
625
+
626
+ this.original = original;
627
+ this.parts = dig;
628
+ this.string = dig.join('.');
629
+ this.depth = depth;
630
+
631
+ // an ID is simple if it only has one part, and that part is not
632
+ // `..` or `this`.
633
+ this.isSimple = parts.length === 1 && !this.isScoped && depth === 0;
634
+
635
+ this.stringModeValue = this.string;
636
+ },
637
+
638
+ PartialNameNode: function(name) {
639
+ this.type = "PARTIAL_NAME";
640
+ this.name = name.original;
641
+ },
642
+
643
+ DataNode: function(id) {
644
+ this.type = "DATA";
645
+ this.id = id;
646
+ },
647
+
648
+ StringNode: function(string) {
649
+ this.type = "STRING";
650
+ this.original =
651
+ this.string =
652
+ this.stringModeValue = string;
653
+ },
654
+
655
+ IntegerNode: function(integer) {
656
+ this.type = "INTEGER";
657
+ this.original =
658
+ this.integer = integer;
659
+ this.stringModeValue = Number(integer);
660
+ },
661
+
662
+ BooleanNode: function(bool) {
663
+ this.type = "BOOLEAN";
664
+ this.bool = bool;
665
+ this.stringModeValue = bool === "true";
666
+ },
667
+
668
+ CommentNode: function(comment) {
669
+ this.type = "comment";
670
+ this.comment = comment;
671
+ }
672
+ };
673
+
674
+ // Must be exported as an object rather than the root of the module as the jison lexer
675
+ // most modify the object to operate properly.
676
+ __exports__ = AST;
677
+ return __exports__;
678
+ })(__module5__);
679
+
680
+ // handlebars/compiler/parser.js
681
+ var __module9__ = (function() {
682
+ "use strict";
683
+ var __exports__;
684
+ /* jshint ignore:start */
685
+ /* Jison generated parser */
686
+ var handlebars = (function(){
687
+ var parser = {trace: function trace() { },
688
+ yy: {},
689
+ symbols_: {"error":2,"root":3,"statements":4,"EOF":5,"program":6,"simpleInverse":7,"statement":8,"openInverse":9,"closeBlock":10,"openBlock":11,"mustache":12,"partial":13,"CONTENT":14,"COMMENT":15,"OPEN_BLOCK":16,"inMustache":17,"CLOSE":18,"OPEN_INVERSE":19,"OPEN_ENDBLOCK":20,"path":21,"OPEN":22,"OPEN_UNESCAPED":23,"CLOSE_UNESCAPED":24,"OPEN_PARTIAL":25,"partialName":26,"partial_option0":27,"inMustache_repetition0":28,"inMustache_option0":29,"dataName":30,"param":31,"STRING":32,"INTEGER":33,"BOOLEAN":34,"hash":35,"hash_repetition_plus0":36,"hashSegment":37,"ID":38,"EQUALS":39,"DATA":40,"pathSegments":41,"SEP":42,"$accept":0,"$end":1},
690
+ terminals_: {2:"error",5:"EOF",14:"CONTENT",15:"COMMENT",16:"OPEN_BLOCK",18:"CLOSE",19:"OPEN_INVERSE",20:"OPEN_ENDBLOCK",22:"OPEN",23:"OPEN_UNESCAPED",24:"CLOSE_UNESCAPED",25:"OPEN_PARTIAL",32:"STRING",33:"INTEGER",34:"BOOLEAN",38:"ID",39:"EQUALS",40:"DATA",42:"SEP"},
691
+ productions_: [0,[3,2],[3,1],[6,2],[6,3],[6,2],[6,1],[6,1],[6,0],[4,1],[4,2],[8,3],[8,3],[8,1],[8,1],[8,1],[8,1],[11,3],[9,3],[10,3],[12,3],[12,3],[13,4],[7,2],[17,3],[17,1],[31,1],[31,1],[31,1],[31,1],[31,1],[35,1],[37,3],[26,1],[26,1],[26,1],[30,2],[21,1],[41,3],[41,1],[27,0],[27,1],[28,0],[28,2],[29,0],[29,1],[36,1],[36,2]],
692
+ performAction: function anonymous(yytext,yyleng,yylineno,yy,yystate,$$,_$) {
693
+
694
+ var $0 = $$.length - 1;
695
+ switch (yystate) {
696
+ case 1: return new yy.ProgramNode($$[$0-1]);
697
+ break;
698
+ case 2: return new yy.ProgramNode([]);
699
+ break;
700
+ case 3:this.$ = new yy.ProgramNode([], $$[$0-1], $$[$0]);
701
+ break;
702
+ case 4:this.$ = new yy.ProgramNode($$[$0-2], $$[$0-1], $$[$0]);
703
+ break;
704
+ case 5:this.$ = new yy.ProgramNode($$[$0-1], $$[$0], []);
705
+ break;
706
+ case 6:this.$ = new yy.ProgramNode($$[$0]);
707
+ break;
708
+ case 7:this.$ = new yy.ProgramNode([]);
709
+ break;
710
+ case 8:this.$ = new yy.ProgramNode([]);
711
+ break;
712
+ case 9:this.$ = [$$[$0]];
713
+ break;
714
+ case 10: $$[$0-1].push($$[$0]); this.$ = $$[$0-1];
715
+ break;
716
+ case 11:this.$ = new yy.BlockNode($$[$0-2], $$[$0-1].inverse, $$[$0-1], $$[$0]);
717
+ break;
718
+ case 12:this.$ = new yy.BlockNode($$[$0-2], $$[$0-1], $$[$0-1].inverse, $$[$0]);
719
+ break;
720
+ case 13:this.$ = $$[$0];
721
+ break;
722
+ case 14:this.$ = $$[$0];
723
+ break;
724
+ case 15:this.$ = new yy.ContentNode($$[$0]);
725
+ break;
726
+ case 16:this.$ = new yy.CommentNode($$[$0]);
727
+ break;
728
+ case 17:this.$ = new yy.MustacheNode($$[$0-1][0], $$[$0-1][1], $$[$0-2], stripFlags($$[$0-2], $$[$0]));
729
+ break;
730
+ case 18:this.$ = new yy.MustacheNode($$[$0-1][0], $$[$0-1][1], $$[$0-2], stripFlags($$[$0-2], $$[$0]));
731
+ break;
732
+ case 19:this.$ = {path: $$[$0-1], strip: stripFlags($$[$0-2], $$[$0])};
733
+ break;
734
+ case 20:this.$ = new yy.MustacheNode($$[$0-1][0], $$[$0-1][1], $$[$0-2], stripFlags($$[$0-2], $$[$0]));
735
+ break;
736
+ case 21:this.$ = new yy.MustacheNode($$[$0-1][0], $$[$0-1][1], $$[$0-2], stripFlags($$[$0-2], $$[$0]));
737
+ break;
738
+ case 22:this.$ = new yy.PartialNode($$[$0-2], $$[$0-1], stripFlags($$[$0-3], $$[$0]));
739
+ break;
740
+ case 23:this.$ = stripFlags($$[$0-1], $$[$0]);
741
+ break;
742
+ case 24:this.$ = [[$$[$0-2]].concat($$[$0-1]), $$[$0]];
743
+ break;
744
+ case 25:this.$ = [[$$[$0]], null];
745
+ break;
746
+ case 26:this.$ = $$[$0];
747
+ break;
748
+ case 27:this.$ = new yy.StringNode($$[$0]);
749
+ break;
750
+ case 28:this.$ = new yy.IntegerNode($$[$0]);
751
+ break;
752
+ case 29:this.$ = new yy.BooleanNode($$[$0]);
753
+ break;
754
+ case 30:this.$ = $$[$0];
755
+ break;
756
+ case 31:this.$ = new yy.HashNode($$[$0]);
757
+ break;
758
+ case 32:this.$ = [$$[$0-2], $$[$0]];
759
+ break;
760
+ case 33:this.$ = new yy.PartialNameNode($$[$0]);
761
+ break;
762
+ case 34:this.$ = new yy.PartialNameNode(new yy.StringNode($$[$0]));
763
+ break;
764
+ case 35:this.$ = new yy.PartialNameNode(new yy.IntegerNode($$[$0]));
765
+ break;
766
+ case 36:this.$ = new yy.DataNode($$[$0]);
767
+ break;
768
+ case 37:this.$ = new yy.IdNode($$[$0]);
769
+ break;
770
+ case 38: $$[$0-2].push({part: $$[$0], separator: $$[$0-1]}); this.$ = $$[$0-2];
771
+ break;
772
+ case 39:this.$ = [{part: $$[$0]}];
773
+ break;
774
+ case 42:this.$ = [];
775
+ break;
776
+ case 43:$$[$0-1].push($$[$0]);
777
+ break;
778
+ case 46:this.$ = [$$[$0]];
779
+ break;
780
+ case 47:$$[$0-1].push($$[$0]);
781
+ break;
782
+ }
783
+ },
784
+ table: [{3:1,4:2,5:[1,3],8:4,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,11],22:[1,13],23:[1,14],25:[1,15]},{1:[3]},{5:[1,16],8:17,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,11],22:[1,13],23:[1,14],25:[1,15]},{1:[2,2]},{5:[2,9],14:[2,9],15:[2,9],16:[2,9],19:[2,9],20:[2,9],22:[2,9],23:[2,9],25:[2,9]},{4:20,6:18,7:19,8:4,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,21],20:[2,8],22:[1,13],23:[1,14],25:[1,15]},{4:20,6:22,7:19,8:4,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,21],20:[2,8],22:[1,13],23:[1,14],25:[1,15]},{5:[2,13],14:[2,13],15:[2,13],16:[2,13],19:[2,13],20:[2,13],22:[2,13],23:[2,13],25:[2,13]},{5:[2,14],14:[2,14],15:[2,14],16:[2,14],19:[2,14],20:[2,14],22:[2,14],23:[2,14],25:[2,14]},{5:[2,15],14:[2,15],15:[2,15],16:[2,15],19:[2,15],20:[2,15],22:[2,15],23:[2,15],25:[2,15]},{5:[2,16],14:[2,16],15:[2,16],16:[2,16],19:[2,16],20:[2,16],22:[2,16],23:[2,16],25:[2,16]},{17:23,21:24,30:25,38:[1,28],40:[1,27],41:26},{17:29,21:24,30:25,38:[1,28],40:[1,27],41:26},{17:30,21:24,30:25,38:[1,28],40:[1,27],41:26},{17:31,21:24,30:25,38:[1,28],40:[1,27],41:26},{21:33,26:32,32:[1,34],33:[1,35],38:[1,28],41:26},{1:[2,1]},{5:[2,10],14:[2,10],15:[2,10],16:[2,10],19:[2,10],20:[2,10],22:[2,10],23:[2,10],25:[2,10]},{10:36,20:[1,37]},{4:38,8:4,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,11],20:[2,7],22:[1,13],23:[1,14],25:[1,15]},{7:39,8:17,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,21],20:[2,6],22:[1,13],23:[1,14],25:[1,15]},{17:23,18:[1,40],21:24,30:25,38:[1,28],40:[1,27],41:26},{10:41,20:[1,37]},{18:[1,42]},{18:[2,42],24:[2,42],28:43,32:[2,42],33:[2,42],34:[2,42],38:[2,42],40:[2,42]},{18:[2,25],24:[2,25]},{18:[2,37],24:[2,37],32:[2,37],33:[2,37],34:[2,37],38:[2,37],40:[2,37],42:[1,44]},{21:45,38:[1,28],41:26},{18:[2,39],24:[2,39],32:[2,39],33:[2,39],34:[2,39],38:[2,39],40:[2,39],42:[2,39]},{18:[1,46]},{18:[1,47]},{24:[1,48]},{18:[2,40],21:50,27:49,38:[1,28],41:26},{18:[2,33],38:[2,33]},{18:[2,34],38:[2,34]},{18:[2,35],38:[2,35]},{5:[2,11],14:[2,11],15:[2,11],16:[2,11],19:[2,11],20:[2,11],22:[2,11],23:[2,11],25:[2,11]},{21:51,38:[1,28],41:26},{8:17,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,11],20:[2,3],22:[1,13],23:[1,14],25:[1,15]},{4:52,8:4,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,11],20:[2,5],22:[1,13],23:[1,14],25:[1,15]},{14:[2,23],15:[2,23],16:[2,23],19:[2,23],20:[2,23],22:[2,23],23:[2,23],25:[2,23]},{5:[2,12],14:[2,12],15:[2,12],16:[2,12],19:[2,12],20:[2,12],22:[2,12],23:[2,12],25:[2,12]},{14:[2,18],15:[2,18],16:[2,18],19:[2,18],20:[2,18],22:[2,18],23:[2,18],25:[2,18]},{18:[2,44],21:56,24:[2,44],29:53,30:60,31:54,32:[1,57],33:[1,58],34:[1,59],35:55,36:61,37:62,38:[1,63],40:[1,27],41:26},{38:[1,64]},{18:[2,36],24:[2,36],32:[2,36],33:[2,36],34:[2,36],38:[2,36],40:[2,36]},{14:[2,17],15:[2,17],16:[2,17],19:[2,17],20:[2,17],22:[2,17],23:[2,17],25:[2,17]},{5:[2,20],14:[2,20],15:[2,20],16:[2,20],19:[2,20],20:[2,20],22:[2,20],23:[2,20],25:[2,20]},{5:[2,21],14:[2,21],15:[2,21],16:[2,21],19:[2,21],20:[2,21],22:[2,21],23:[2,21],25:[2,21]},{18:[1,65]},{18:[2,41]},{18:[1,66]},{8:17,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,11],20:[2,4],22:[1,13],23:[1,14],25:[1,15]},{18:[2,24],24:[2,24]},{18:[2,43],24:[2,43],32:[2,43],33:[2,43],34:[2,43],38:[2,43],40:[2,43]},{18:[2,45],24:[2,45]},{18:[2,26],24:[2,26],32:[2,26],33:[2,26],34:[2,26],38:[2,26],40:[2,26]},{18:[2,27],24:[2,27],32:[2,27],33:[2,27],34:[2,27],38:[2,27],40:[2,27]},{18:[2,28],24:[2,28],32:[2,28],33:[2,28],34:[2,28],38:[2,28],40:[2,28]},{18:[2,29],24:[2,29],32:[2,29],33:[2,29],34:[2,29],38:[2,29],40:[2,29]},{18:[2,30],24:[2,30],32:[2,30],33:[2,30],34:[2,30],38:[2,30],40:[2,30]},{18:[2,31],24:[2,31],37:67,38:[1,68]},{18:[2,46],24:[2,46],38:[2,46]},{18:[2,39],24:[2,39],32:[2,39],33:[2,39],34:[2,39],38:[2,39],39:[1,69],40:[2,39],42:[2,39]},{18:[2,38],24:[2,38],32:[2,38],33:[2,38],34:[2,38],38:[2,38],40:[2,38],42:[2,38]},{5:[2,22],14:[2,22],15:[2,22],16:[2,22],19:[2,22],20:[2,22],22:[2,22],23:[2,22],25:[2,22]},{5:[2,19],14:[2,19],15:[2,19],16:[2,19],19:[2,19],20:[2,19],22:[2,19],23:[2,19],25:[2,19]},{18:[2,47],24:[2,47],38:[2,47]},{39:[1,69]},{21:56,30:60,31:70,32:[1,57],33:[1,58],34:[1,59],38:[1,28],40:[1,27],41:26},{18:[2,32],24:[2,32],38:[2,32]}],
785
+ defaultActions: {3:[2,2],16:[2,1],50:[2,41]},
786
+ parseError: function parseError(str, hash) {
787
+ throw new Error(str);
788
+ },
789
+ parse: function parse(input) {
790
+ var self = this, stack = [0], vstack = [null], lstack = [], table = this.table, yytext = "", yylineno = 0, yyleng = 0, recovering = 0, TERROR = 2, EOF = 1;
791
+ this.lexer.setInput(input);
792
+ this.lexer.yy = this.yy;
793
+ this.yy.lexer = this.lexer;
794
+ this.yy.parser = this;
795
+ if (typeof this.lexer.yylloc == "undefined")
796
+ this.lexer.yylloc = {};
797
+ var yyloc = this.lexer.yylloc;
798
+ lstack.push(yyloc);
799
+ var ranges = this.lexer.options && this.lexer.options.ranges;
800
+ if (typeof this.yy.parseError === "function")
801
+ this.parseError = this.yy.parseError;
802
+ function popStack(n) {
803
+ stack.length = stack.length - 2 * n;
804
+ vstack.length = vstack.length - n;
805
+ lstack.length = lstack.length - n;
806
+ }
807
+ function lex() {
808
+ var token;
809
+ token = self.lexer.lex() || 1;
810
+ if (typeof token !== "number") {
811
+ token = self.symbols_[token] || token;
812
+ }
813
+ return token;
814
+ }
815
+ var symbol, preErrorSymbol, state, action, a, r, yyval = {}, p, len, newState, expected;
816
+ while (true) {
817
+ state = stack[stack.length - 1];
818
+ if (this.defaultActions[state]) {
819
+ action = this.defaultActions[state];
820
+ } else {
821
+ if (symbol === null || typeof symbol == "undefined") {
822
+ symbol = lex();
823
+ }
824
+ action = table[state] && table[state][symbol];
825
+ }
826
+ if (typeof action === "undefined" || !action.length || !action[0]) {
827
+ var errStr = "";
828
+ if (!recovering) {
829
+ expected = [];
830
+ for (p in table[state])
831
+ if (this.terminals_[p] && p > 2) {
832
+ expected.push("'" + this.terminals_[p] + "'");
833
+ }
834
+ if (this.lexer.showPosition) {
835
+ errStr = "Parse error on line " + (yylineno + 1) + ":\n" + this.lexer.showPosition() + "\nExpecting " + expected.join(", ") + ", got '" + (this.terminals_[symbol] || symbol) + "'";
836
+ } else {
837
+ errStr = "Parse error on line " + (yylineno + 1) + ": Unexpected " + (symbol == 1?"end of input":"'" + (this.terminals_[symbol] || symbol) + "'");
838
+ }
839
+ this.parseError(errStr, {text: this.lexer.match, token: this.terminals_[symbol] || symbol, line: this.lexer.yylineno, loc: yyloc, expected: expected});
840
+ }
841
+ }
842
+ if (action[0] instanceof Array && action.length > 1) {
843
+ throw new Error("Parse Error: multiple actions possible at state: " + state + ", token: " + symbol);
844
+ }
845
+ switch (action[0]) {
846
+ case 1:
847
+ stack.push(symbol);
848
+ vstack.push(this.lexer.yytext);
849
+ lstack.push(this.lexer.yylloc);
850
+ stack.push(action[1]);
851
+ symbol = null;
852
+ if (!preErrorSymbol) {
853
+ yyleng = this.lexer.yyleng;
854
+ yytext = this.lexer.yytext;
855
+ yylineno = this.lexer.yylineno;
856
+ yyloc = this.lexer.yylloc;
857
+ if (recovering > 0)
858
+ recovering--;
859
+ } else {
860
+ symbol = preErrorSymbol;
861
+ preErrorSymbol = null;
862
+ }
863
+ break;
864
+ case 2:
865
+ len = this.productions_[action[1]][1];
866
+ yyval.$ = vstack[vstack.length - len];
867
+ 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};
868
+ if (ranges) {
869
+ yyval._$.range = [lstack[lstack.length - (len || 1)].range[0], lstack[lstack.length - 1].range[1]];
870
+ }
871
+ r = this.performAction.call(yyval, yytext, yyleng, yylineno, this.yy, action[1], vstack, lstack);
872
+ if (typeof r !== "undefined") {
873
+ return r;
874
+ }
875
+ if (len) {
876
+ stack = stack.slice(0, -1 * len * 2);
877
+ vstack = vstack.slice(0, -1 * len);
878
+ lstack = lstack.slice(0, -1 * len);
879
+ }
880
+ stack.push(this.productions_[action[1]][0]);
881
+ vstack.push(yyval.$);
882
+ lstack.push(yyval._$);
883
+ newState = table[stack[stack.length - 2]][stack[stack.length - 1]];
884
+ stack.push(newState);
885
+ break;
886
+ case 3:
887
+ return true;
888
+ }
889
+ }
890
+ return true;
891
+ }
892
+ };
893
+
894
+
895
+ function stripFlags(open, close) {
896
+ return {
897
+ left: open.charAt(2) === '~',
898
+ right: close.charAt(0) === '~' || close.charAt(1) === '~'
899
+ };
900
+ }
901
+
902
+ /* Jison generated lexer */
903
+ var lexer = (function(){
904
+ var lexer = ({EOF:1,
905
+ parseError:function parseError(str, hash) {
906
+ if (this.yy.parser) {
907
+ this.yy.parser.parseError(str, hash);
908
+ } else {
909
+ throw new Error(str);
910
+ }
911
+ },
912
+ setInput:function (input) {
913
+ this._input = input;
914
+ this._more = this._less = this.done = false;
915
+ this.yylineno = this.yyleng = 0;
916
+ this.yytext = this.matched = this.match = '';
917
+ this.conditionStack = ['INITIAL'];
918
+ this.yylloc = {first_line:1,first_column:0,last_line:1,last_column:0};
919
+ if (this.options.ranges) this.yylloc.range = [0,0];
920
+ this.offset = 0;
921
+ return this;
922
+ },
923
+ input:function () {
924
+ var ch = this._input[0];
925
+ this.yytext += ch;
926
+ this.yyleng++;
927
+ this.offset++;
928
+ this.match += ch;
929
+ this.matched += ch;
930
+ var lines = ch.match(/(?:\r\n?|\n).*/g);
931
+ if (lines) {
932
+ this.yylineno++;
933
+ this.yylloc.last_line++;
934
+ } else {
935
+ this.yylloc.last_column++;
936
+ }
937
+ if (this.options.ranges) this.yylloc.range[1]++;
938
+
939
+ this._input = this._input.slice(1);
940
+ return ch;
941
+ },
942
+ unput:function (ch) {
943
+ var len = ch.length;
944
+ var lines = ch.split(/(?:\r\n?|\n)/g);
945
+
946
+ this._input = ch + this._input;
947
+ this.yytext = this.yytext.substr(0, this.yytext.length-len-1);
948
+ //this.yyleng -= len;
949
+ this.offset -= len;
950
+ var oldLines = this.match.split(/(?:\r\n?|\n)/g);
951
+ this.match = this.match.substr(0, this.match.length-1);
952
+ this.matched = this.matched.substr(0, this.matched.length-1);
953
+
954
+ if (lines.length-1) this.yylineno -= lines.length-1;
955
+ var r = this.yylloc.range;
956
+
957
+ this.yylloc = {first_line: this.yylloc.first_line,
958
+ last_line: this.yylineno+1,
959
+ first_column: this.yylloc.first_column,
960
+ last_column: lines ?
961
+ (lines.length === oldLines.length ? this.yylloc.first_column : 0) + oldLines[oldLines.length - lines.length].length - lines[0].length:
962
+ this.yylloc.first_column - len
963
+ };
964
+
965
+ if (this.options.ranges) {
966
+ this.yylloc.range = [r[0], r[0] + this.yyleng - len];
967
+ }
968
+ return this;
969
+ },
970
+ more:function () {
971
+ this._more = true;
972
+ return this;
973
+ },
974
+ less:function (n) {
975
+ this.unput(this.match.slice(n));
976
+ },
977
+ pastInput:function () {
978
+ var past = this.matched.substr(0, this.matched.length - this.match.length);
979
+ return (past.length > 20 ? '...':'') + past.substr(-20).replace(/\n/g, "");
980
+ },
981
+ upcomingInput:function () {
982
+ var next = this.match;
983
+ if (next.length < 20) {
984
+ next += this._input.substr(0, 20-next.length);
985
+ }
986
+ return (next.substr(0,20)+(next.length > 20 ? '...':'')).replace(/\n/g, "");
987
+ },
988
+ showPosition:function () {
989
+ var pre = this.pastInput();
990
+ var c = new Array(pre.length + 1).join("-");
991
+ return pre + this.upcomingInput() + "\n" + c+"^";
992
+ },
993
+ next:function () {
994
+ if (this.done) {
995
+ return this.EOF;
996
+ }
997
+ if (!this._input) this.done = true;
998
+
999
+ var token,
1000
+ match,
1001
+ tempMatch,
1002
+ index,
1003
+ col,
1004
+ lines;
1005
+ if (!this._more) {
1006
+ this.yytext = '';
1007
+ this.match = '';
1008
+ }
1009
+ var rules = this._currentRules();
1010
+ for (var i=0;i < rules.length; i++) {
1011
+ tempMatch = this._input.match(this.rules[rules[i]]);
1012
+ if (tempMatch && (!match || tempMatch[0].length > match[0].length)) {
1013
+ match = tempMatch;
1014
+ index = i;
1015
+ if (!this.options.flex) break;
1016
+ }
1017
+ }
1018
+ if (match) {
1019
+ lines = match[0].match(/(?:\r\n?|\n).*/g);
1020
+ if (lines) this.yylineno += lines.length;
1021
+ this.yylloc = {first_line: this.yylloc.last_line,
1022
+ last_line: this.yylineno+1,
1023
+ first_column: this.yylloc.last_column,
1024
+ last_column: lines ? lines[lines.length-1].length-lines[lines.length-1].match(/\r?\n?/)[0].length : this.yylloc.last_column + match[0].length};
1025
+ this.yytext += match[0];
1026
+ this.match += match[0];
1027
+ this.matches = match;
1028
+ this.yyleng = this.yytext.length;
1029
+ if (this.options.ranges) {
1030
+ this.yylloc.range = [this.offset, this.offset += this.yyleng];
1031
+ }
1032
+ this._more = false;
1033
+ this._input = this._input.slice(match[0].length);
1034
+ this.matched += match[0];
1035
+ token = this.performAction.call(this, this.yy, this, rules[index],this.conditionStack[this.conditionStack.length-1]);
1036
+ if (this.done && this._input) this.done = false;
1037
+ if (token) return token;
1038
+ else return;
1039
+ }
1040
+ if (this._input === "") {
1041
+ return this.EOF;
1042
+ } else {
1043
+ return this.parseError('Lexical error on line '+(this.yylineno+1)+'. Unrecognized text.\n'+this.showPosition(),
1044
+ {text: "", token: null, line: this.yylineno});
1045
+ }
1046
+ },
1047
+ lex:function lex() {
1048
+ var r = this.next();
1049
+ if (typeof r !== 'undefined') {
1050
+ return r;
1051
+ } else {
1052
+ return this.lex();
1053
+ }
1054
+ },
1055
+ begin:function begin(condition) {
1056
+ this.conditionStack.push(condition);
1057
+ },
1058
+ popState:function popState() {
1059
+ return this.conditionStack.pop();
1060
+ },
1061
+ _currentRules:function _currentRules() {
1062
+ return this.conditions[this.conditionStack[this.conditionStack.length-1]].rules;
1063
+ },
1064
+ topState:function () {
1065
+ return this.conditionStack[this.conditionStack.length-2];
1066
+ },
1067
+ pushState:function begin(condition) {
1068
+ this.begin(condition);
1069
+ }});
1070
+ lexer.options = {};
1071
+ lexer.performAction = function anonymous(yy,yy_,$avoiding_name_collisions,YY_START) {
1072
+
1073
+
1074
+ function strip(start, end) {
1075
+ return yy_.yytext = yy_.yytext.substr(start, yy_.yyleng-end);
1076
+ }
1077
+
1078
+
1079
+ var YYSTATE=YY_START
1080
+ switch($avoiding_name_collisions) {
1081
+ case 0:
1082
+ if(yy_.yytext.slice(-2) === "\\\\") {
1083
+ strip(0,1);
1084
+ this.begin("mu");
1085
+ } else if(yy_.yytext.slice(-1) === "\\") {
1086
+ strip(0,1);
1087
+ this.begin("emu");
1088
+ } else {
1089
+ this.begin("mu");
1090
+ }
1091
+ if(yy_.yytext) return 14;
1092
+
1093
+ break;
1094
+ case 1:return 14;
1095
+ break;
1096
+ case 2:
1097
+ this.popState();
1098
+ return 14;
1099
+
1100
+ break;
1101
+ case 3:strip(0,4); this.popState(); return 15;
1102
+ break;
1103
+ case 4:return 25;
1104
+ break;
1105
+ case 5:return 16;
1106
+ break;
1107
+ case 6:return 20;
1108
+ break;
1109
+ case 7:return 19;
1110
+ break;
1111
+ case 8:return 19;
1112
+ break;
1113
+ case 9:return 23;
1114
+ break;
1115
+ case 10:return 22;
1116
+ break;
1117
+ case 11:this.popState(); this.begin('com');
1118
+ break;
1119
+ case 12:strip(3,5); this.popState(); return 15;
1120
+ break;
1121
+ case 13:return 22;
1122
+ break;
1123
+ case 14:return 39;
1124
+ break;
1125
+ case 15:return 38;
1126
+ break;
1127
+ case 16:return 38;
1128
+ break;
1129
+ case 17:return 42;
1130
+ break;
1131
+ case 18:// ignore whitespace
1132
+ break;
1133
+ case 19:this.popState(); return 24;
1134
+ break;
1135
+ case 20:this.popState(); return 18;
1136
+ break;
1137
+ case 21:yy_.yytext = strip(1,2).replace(/\\"/g,'"'); return 32;
1138
+ break;
1139
+ case 22:yy_.yytext = strip(1,2).replace(/\\'/g,"'"); return 32;
1140
+ break;
1141
+ case 23:return 40;
1142
+ break;
1143
+ case 24:return 34;
1144
+ break;
1145
+ case 25:return 34;
1146
+ break;
1147
+ case 26:return 33;
1148
+ break;
1149
+ case 27:return 38;
1150
+ break;
1151
+ case 28:yy_.yytext = strip(1,2); return 38;
1152
+ break;
1153
+ case 29:return 'INVALID';
1154
+ break;
1155
+ case 30:return 5;
1156
+ break;
1157
+ }
1158
+ };
1159
+ lexer.rules = [/^(?:[^\x00]*?(?=(\{\{)))/,/^(?:[^\x00]+)/,/^(?:[^\x00]{2,}?(?=(\{\{|\\\{\{|\\\\\{\{|$)))/,/^(?:[\s\S]*?--\}\})/,/^(?:\{\{(~)?>)/,/^(?:\{\{(~)?#)/,/^(?:\{\{(~)?\/)/,/^(?:\{\{(~)?\^)/,/^(?:\{\{(~)?\s*else\b)/,/^(?:\{\{(~)?\{)/,/^(?:\{\{(~)?&)/,/^(?:\{\{!--)/,/^(?:\{\{![\s\S]*?\}\})/,/^(?:\{\{(~)?)/,/^(?:=)/,/^(?:\.\.)/,/^(?:\.(?=([=~}\s\/.])))/,/^(?:[\/.])/,/^(?:\s+)/,/^(?:\}(~)?\}\})/,/^(?:(~)?\}\})/,/^(?:"(\\["]|[^"])*")/,/^(?:'(\\[']|[^'])*')/,/^(?:@)/,/^(?:true(?=([~}\s])))/,/^(?:false(?=([~}\s])))/,/^(?:-?[0-9]+(?=([~}\s])))/,/^(?:([^\s!"#%-,\.\/;->@\[-\^`\{-~]+(?=([=~}\s\/.]))))/,/^(?:\[[^\]]*\])/,/^(?:.)/,/^(?:$)/];
1160
+ lexer.conditions = {"mu":{"rules":[4,5,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],"inclusive":false},"emu":{"rules":[2],"inclusive":false},"com":{"rules":[3],"inclusive":false},"INITIAL":{"rules":[0,1,30],"inclusive":true}};
1161
+ return lexer;})()
1162
+ parser.lexer = lexer;
1163
+ function Parser () { this.yy = {}; }Parser.prototype = parser;parser.Parser = Parser;
1164
+ return new Parser;
1165
+ })();__exports__ = handlebars;
1166
+ /* jshint ignore:end */
1167
+ return __exports__;
1168
+ })();
1169
+
1170
+ // handlebars/compiler/base.js
1171
+ var __module8__ = (function(__dependency1__, __dependency2__) {
1172
+ "use strict";
1173
+ var __exports__ = {};
1174
+ var parser = __dependency1__;
1175
+ var AST = __dependency2__;
1176
+
1177
+ __exports__.parser = parser;
1178
+
1179
+ function parse(input) {
1180
+ // Just return if an already-compile AST was passed in.
1181
+ if(input.constructor === AST.ProgramNode) { return input; }
1182
+
1183
+ parser.yy = AST;
1184
+ return parser.parse(input);
1185
+ }
1186
+
1187
+ __exports__.parse = parse;
1188
+ return __exports__;
1189
+ })(__module9__, __module7__);
1190
+
1191
+ // handlebars/compiler/javascript-compiler.js
1192
+ var __module11__ = (function(__dependency1__) {
1193
+ "use strict";
1194
+ var __exports__;
1195
+ var COMPILER_REVISION = __dependency1__.COMPILER_REVISION;
1196
+ var REVISION_CHANGES = __dependency1__.REVISION_CHANGES;
1197
+ var log = __dependency1__.log;
1198
+
1199
+ function Literal(value) {
1200
+ this.value = value;
1201
+ }
1202
+
1203
+ function JavaScriptCompiler() {}
1204
+
1205
+ JavaScriptCompiler.prototype = {
1206
+ // PUBLIC API: You can override these methods in a subclass to provide
1207
+ // alternative compiled forms for name lookup and buffering semantics
1208
+ nameLookup: function(parent, name /* , type*/) {
1209
+ var wrap,
1210
+ ret;
1211
+ if (parent.indexOf('depth') === 0) {
1212
+ wrap = true;
1213
+ }
1214
+
1215
+ if (/^[0-9]+$/.test(name)) {
1216
+ ret = parent + "[" + name + "]";
1217
+ } else if (JavaScriptCompiler.isValidJavaScriptVariableName(name)) {
1218
+ ret = parent + "." + name;
1219
+ }
1220
+ else {
1221
+ ret = parent + "['" + name + "']";
1222
+ }
1223
+
1224
+ if (wrap) {
1225
+ return '(' + parent + ' && ' + ret + ')';
1226
+ } else {
1227
+ return ret;
1228
+ }
1229
+ },
1230
+
1231
+ compilerInfo: function() {
1232
+ var revision = COMPILER_REVISION,
1233
+ versions = REVISION_CHANGES[revision];
1234
+ return "this.compilerInfo = ["+revision+",'"+versions+"'];\n";
1235
+ },
1236
+
1237
+ appendToBuffer: function(string) {
1238
+ if (this.environment.isSimple) {
1239
+ return "return " + string + ";";
1240
+ } else {
1241
+ return {
1242
+ appendToBuffer: true,
1243
+ content: string,
1244
+ toString: function() { return "buffer += " + string + ";"; }
1245
+ };
1246
+ }
1247
+ },
1248
+
1249
+ initializeBuffer: function() {
1250
+ return this.quotedString("");
1251
+ },
1252
+
1253
+ namespace: "Handlebars",
1254
+ // END PUBLIC API
1255
+
1256
+ compile: function(environment, options, context, asObject) {
1257
+ this.environment = environment;
1258
+ this.options = options || {};
1259
+
1260
+ log('debug', this.environment.disassemble() + "\n\n");
1261
+
1262
+ this.name = this.environment.name;
1263
+ this.isChild = !!context;
1264
+ this.context = context || {
1265
+ programs: [],
1266
+ environments: [],
1267
+ aliases: { }
1268
+ };
1269
+
1270
+ this.preamble();
1271
+
1272
+ this.stackSlot = 0;
1273
+ this.stackVars = [];
1274
+ this.registers = { list: [] };
1275
+ this.compileStack = [];
1276
+ this.inlineStack = [];
1277
+
1278
+ this.compileChildren(environment, options);
1279
+
1280
+ var opcodes = environment.opcodes, opcode;
1281
+
1282
+ this.i = 0;
1283
+
1284
+ for(var l=opcodes.length; this.i<l; this.i++) {
1285
+ opcode = opcodes[this.i];
1286
+
1287
+ if(opcode.opcode === 'DECLARE') {
1288
+ this[opcode.name] = opcode.value;
1289
+ } else {
1290
+ this[opcode.opcode].apply(this, opcode.args);
1291
+ }
1292
+
1293
+ // Reset the stripNext flag if it was not set by this operation.
1294
+ if (opcode.opcode !== this.stripNext) {
1295
+ this.stripNext = false;
1296
+ }
1297
+ }
1298
+
1299
+ // Flush any trailing content that might be pending.
1300
+ this.pushSource('');
1301
+
1302
+ return this.createFunctionContext(asObject);
1303
+ },
1304
+
1305
+ preamble: function() {
1306
+ var out = [];
1307
+
1308
+ if (!this.isChild) {
1309
+ var namespace = this.namespace;
1310
+
1311
+ var copies = "helpers = this.merge(helpers, " + namespace + ".helpers);";
1312
+ if (this.environment.usePartial) { copies = copies + " partials = this.merge(partials, " + namespace + ".partials);"; }
1313
+ if (this.options.data) { copies = copies + " data = data || {};"; }
1314
+ out.push(copies);
1315
+ } else {
1316
+ out.push('');
1317
+ }
1318
+
1319
+ if (!this.environment.isSimple) {
1320
+ out.push(", buffer = " + this.initializeBuffer());
1321
+ } else {
1322
+ out.push("");
1323
+ }
1324
+
1325
+ // track the last context pushed into place to allow skipping the
1326
+ // getContext opcode when it would be a noop
1327
+ this.lastContext = 0;
1328
+ this.source = out;
1329
+ },
1330
+
1331
+ createFunctionContext: function(asObject) {
1332
+ var locals = this.stackVars.concat(this.registers.list);
1333
+
1334
+ if(locals.length > 0) {
1335
+ this.source[1] = this.source[1] + ", " + locals.join(", ");
1336
+ }
1337
+
1338
+ // Generate minimizer alias mappings
1339
+ if (!this.isChild) {
1340
+ for (var alias in this.context.aliases) {
1341
+ if (this.context.aliases.hasOwnProperty(alias)) {
1342
+ this.source[1] = this.source[1] + ', ' + alias + '=' + this.context.aliases[alias];
1343
+ }
1344
+ }
1345
+ }
1346
+
1347
+ if (this.source[1]) {
1348
+ this.source[1] = "var " + this.source[1].substring(2) + ";";
1349
+ }
1350
+
1351
+ // Merge children
1352
+ if (!this.isChild) {
1353
+ this.source[1] += '\n' + this.context.programs.join('\n') + '\n';
1354
+ }
1355
+
1356
+ if (!this.environment.isSimple) {
1357
+ this.pushSource("return buffer;");
1358
+ }
1359
+
1360
+ var params = this.isChild ? ["depth0", "data"] : ["Handlebars", "depth0", "helpers", "partials", "data"];
1361
+
1362
+ for(var i=0, l=this.environment.depths.list.length; i<l; i++) {
1363
+ params.push("depth" + this.environment.depths.list[i]);
1364
+ }
1365
+
1366
+ // Perform a second pass over the output to merge content when possible
1367
+ var source = this.mergeSource();
1368
+
1369
+ if (!this.isChild) {
1370
+ source = this.compilerInfo()+source;
1371
+ }
1372
+
1373
+ if (asObject) {
1374
+ params.push(source);
1375
+
1376
+ return Function.apply(this, params);
1377
+ } else {
1378
+ var functionSource = 'function ' + (this.name || '') + '(' + params.join(',') + ') {\n ' + source + '}';
1379
+ log('debug', functionSource + "\n\n");
1380
+ return functionSource;
1381
+ }
1382
+ },
1383
+ mergeSource: function() {
1384
+ // WARN: We are not handling the case where buffer is still populated as the source should
1385
+ // not have buffer append operations as their final action.
1386
+ var source = '',
1387
+ buffer;
1388
+ for (var i = 0, len = this.source.length; i < len; i++) {
1389
+ var line = this.source[i];
1390
+ if (line.appendToBuffer) {
1391
+ if (buffer) {
1392
+ buffer = buffer + '\n + ' + line.content;
1393
+ } else {
1394
+ buffer = line.content;
1395
+ }
1396
+ } else {
1397
+ if (buffer) {
1398
+ source += 'buffer += ' + buffer + ';\n ';
1399
+ buffer = undefined;
1400
+ }
1401
+ source += line + '\n ';
1402
+ }
1403
+ }
1404
+ return source;
1405
+ },
1406
+
1407
+ // [blockValue]
1408
+ //
1409
+ // On stack, before: hash, inverse, program, value
1410
+ // On stack, after: return value of blockHelperMissing
1411
+ //
1412
+ // The purpose of this opcode is to take a block of the form
1413
+ // `{{#foo}}...{{/foo}}`, resolve the value of `foo`, and
1414
+ // replace it on the stack with the result of properly
1415
+ // invoking blockHelperMissing.
1416
+ blockValue: function() {
1417
+ this.context.aliases.blockHelperMissing = 'helpers.blockHelperMissing';
1418
+
1419
+ var params = ["depth0"];
1420
+ this.setupParams(0, params);
1421
+
1422
+ this.replaceStack(function(current) {
1423
+ params.splice(1, 0, current);
1424
+ return "blockHelperMissing.call(" + params.join(", ") + ")";
1425
+ });
1426
+ },
1427
+
1428
+ // [ambiguousBlockValue]
1429
+ //
1430
+ // On stack, before: hash, inverse, program, value
1431
+ // Compiler value, before: lastHelper=value of last found helper, if any
1432
+ // On stack, after, if no lastHelper: same as [blockValue]
1433
+ // On stack, after, if lastHelper: value
1434
+ ambiguousBlockValue: function() {
1435
+ this.context.aliases.blockHelperMissing = 'helpers.blockHelperMissing';
1436
+
1437
+ var params = ["depth0"];
1438
+ this.setupParams(0, params);
1439
+
1440
+ var current = this.topStack();
1441
+ params.splice(1, 0, current);
1442
+
1443
+ // Use the options value generated from the invocation
1444
+ params[params.length-1] = 'options';
1445
+
1446
+ this.pushSource("if (!" + this.lastHelper + ") { " + current + " = blockHelperMissing.call(" + params.join(", ") + "); }");
1447
+ },
1448
+
1449
+ // [appendContent]
1450
+ //
1451
+ // On stack, before: ...
1452
+ // On stack, after: ...
1453
+ //
1454
+ // Appends the string value of `content` to the current buffer
1455
+ appendContent: function(content) {
1456
+ if (this.pendingContent) {
1457
+ content = this.pendingContent + content;
1458
+ }
1459
+ if (this.stripNext) {
1460
+ content = content.replace(/^\s+/, '');
1461
+ }
1462
+
1463
+ this.pendingContent = content;
1464
+ },
1465
+
1466
+ // [strip]
1467
+ //
1468
+ // On stack, before: ...
1469
+ // On stack, after: ...
1470
+ //
1471
+ // Removes any trailing whitespace from the prior content node and flags
1472
+ // the next operation for stripping if it is a content node.
1473
+ strip: function() {
1474
+ if (this.pendingContent) {
1475
+ this.pendingContent = this.pendingContent.replace(/\s+$/, '');
1476
+ }
1477
+ this.stripNext = 'strip';
1478
+ },
1479
+
1480
+ // [append]
1481
+ //
1482
+ // On stack, before: value, ...
1483
+ // On stack, after: ...
1484
+ //
1485
+ // Coerces `value` to a String and appends it to the current buffer.
1486
+ //
1487
+ // If `value` is truthy, or 0, it is coerced into a string and appended
1488
+ // Otherwise, the empty string is appended
1489
+ append: function() {
1490
+ // Force anything that is inlined onto the stack so we don't have duplication
1491
+ // when we examine local
1492
+ this.flushInline();
1493
+ var local = this.popStack();
1494
+ this.pushSource("if(" + local + " || " + local + " === 0) { " + this.appendToBuffer(local) + " }");
1495
+ if (this.environment.isSimple) {
1496
+ this.pushSource("else { " + this.appendToBuffer("''") + " }");
1497
+ }
1498
+ },
1499
+
1500
+ // [appendEscaped]
1501
+ //
1502
+ // On stack, before: value, ...
1503
+ // On stack, after: ...
1504
+ //
1505
+ // Escape `value` and append it to the buffer
1506
+ appendEscaped: function() {
1507
+ this.context.aliases.escapeExpression = 'this.escapeExpression';
1508
+
1509
+ this.pushSource(this.appendToBuffer("escapeExpression(" + this.popStack() + ")"));
1510
+ },
1511
+
1512
+ // [getContext]
1513
+ //
1514
+ // On stack, before: ...
1515
+ // On stack, after: ...
1516
+ // Compiler value, after: lastContext=depth
1517
+ //
1518
+ // Set the value of the `lastContext` compiler value to the depth
1519
+ getContext: function(depth) {
1520
+ if(this.lastContext !== depth) {
1521
+ this.lastContext = depth;
1522
+ }
1523
+ },
1524
+
1525
+ // [lookupOnContext]
1526
+ //
1527
+ // On stack, before: ...
1528
+ // On stack, after: currentContext[name], ...
1529
+ //
1530
+ // Looks up the value of `name` on the current context and pushes
1531
+ // it onto the stack.
1532
+ lookupOnContext: function(name) {
1533
+ this.push(this.nameLookup('depth' + this.lastContext, name, 'context'));
1534
+ },
1535
+
1536
+ // [pushContext]
1537
+ //
1538
+ // On stack, before: ...
1539
+ // On stack, after: currentContext, ...
1540
+ //
1541
+ // Pushes the value of the current context onto the stack.
1542
+ pushContext: function() {
1543
+ this.pushStackLiteral('depth' + this.lastContext);
1544
+ },
1545
+
1546
+ // [resolvePossibleLambda]
1547
+ //
1548
+ // On stack, before: value, ...
1549
+ // On stack, after: resolved value, ...
1550
+ //
1551
+ // If the `value` is a lambda, replace it on the stack by
1552
+ // the return value of the lambda
1553
+ resolvePossibleLambda: function() {
1554
+ this.context.aliases.functionType = '"function"';
1555
+
1556
+ this.replaceStack(function(current) {
1557
+ return "typeof " + current + " === functionType ? " + current + ".apply(depth0) : " + current;
1558
+ });
1559
+ },
1560
+
1561
+ // [lookup]
1562
+ //
1563
+ // On stack, before: value, ...
1564
+ // On stack, after: value[name], ...
1565
+ //
1566
+ // Replace the value on the stack with the result of looking
1567
+ // up `name` on `value`
1568
+ lookup: function(name) {
1569
+ this.replaceStack(function(current) {
1570
+ return current + " == null || " + current + " === false ? " + current + " : " + this.nameLookup(current, name, 'context');
1571
+ });
1572
+ },
1573
+
1574
+ // [lookupData]
1575
+ //
1576
+ // On stack, before: ...
1577
+ // On stack, after: data, ...
1578
+ //
1579
+ // Push the data lookup operator
1580
+ lookupData: function() {
1581
+ this.push('data');
1582
+ },
1583
+
1584
+ // [pushStringParam]
1585
+ //
1586
+ // On stack, before: ...
1587
+ // On stack, after: string, currentContext, ...
1588
+ //
1589
+ // This opcode is designed for use in string mode, which
1590
+ // provides the string value of a parameter along with its
1591
+ // depth rather than resolving it immediately.
1592
+ pushStringParam: function(string, type) {
1593
+ this.pushStackLiteral('depth' + this.lastContext);
1594
+
1595
+ this.pushString(type);
1596
+
1597
+ if (typeof string === 'string') {
1598
+ this.pushString(string);
1599
+ } else {
1600
+ this.pushStackLiteral(string);
1601
+ }
1602
+ },
1603
+
1604
+ emptyHash: function() {
1605
+ this.pushStackLiteral('{}');
1606
+
1607
+ if (this.options.stringParams) {
1608
+ this.register('hashTypes', '{}');
1609
+ this.register('hashContexts', '{}');
1610
+ }
1611
+ },
1612
+ pushHash: function() {
1613
+ this.hash = {values: [], types: [], contexts: []};
1614
+ },
1615
+ popHash: function() {
1616
+ var hash = this.hash;
1617
+ this.hash = undefined;
1618
+
1619
+ if (this.options.stringParams) {
1620
+ this.register('hashContexts', '{' + hash.contexts.join(',') + '}');
1621
+ this.register('hashTypes', '{' + hash.types.join(',') + '}');
1622
+ }
1623
+ this.push('{\n ' + hash.values.join(',\n ') + '\n }');
1624
+ },
1625
+
1626
+ // [pushString]
1627
+ //
1628
+ // On stack, before: ...
1629
+ // On stack, after: quotedString(string), ...
1630
+ //
1631
+ // Push a quoted version of `string` onto the stack
1632
+ pushString: function(string) {
1633
+ this.pushStackLiteral(this.quotedString(string));
1634
+ },
1635
+
1636
+ // [push]
1637
+ //
1638
+ // On stack, before: ...
1639
+ // On stack, after: expr, ...
1640
+ //
1641
+ // Push an expression onto the stack
1642
+ push: function(expr) {
1643
+ this.inlineStack.push(expr);
1644
+ return expr;
1645
+ },
1646
+
1647
+ // [pushLiteral]
1648
+ //
1649
+ // On stack, before: ...
1650
+ // On stack, after: value, ...
1651
+ //
1652
+ // Pushes a value onto the stack. This operation prevents
1653
+ // the compiler from creating a temporary variable to hold
1654
+ // it.
1655
+ pushLiteral: function(value) {
1656
+ this.pushStackLiteral(value);
1657
+ },
1658
+
1659
+ // [pushProgram]
1660
+ //
1661
+ // On stack, before: ...
1662
+ // On stack, after: program(guid), ...
1663
+ //
1664
+ // Push a program expression onto the stack. This takes
1665
+ // a compile-time guid and converts it into a runtime-accessible
1666
+ // expression.
1667
+ pushProgram: function(guid) {
1668
+ if (guid != null) {
1669
+ this.pushStackLiteral(this.programExpression(guid));
1670
+ } else {
1671
+ this.pushStackLiteral(null);
1672
+ }
1673
+ },
1674
+
1675
+ // [invokeHelper]
1676
+ //
1677
+ // On stack, before: hash, inverse, program, params..., ...
1678
+ // On stack, after: result of helper invocation
1679
+ //
1680
+ // Pops off the helper's parameters, invokes the helper,
1681
+ // and pushes the helper's return value onto the stack.
1682
+ //
1683
+ // If the helper is not found, `helperMissing` is called.
1684
+ invokeHelper: function(paramSize, name) {
1685
+ this.context.aliases.helperMissing = 'helpers.helperMissing';
1686
+
1687
+ var helper = this.lastHelper = this.setupHelper(paramSize, name, true);
1688
+ var nonHelper = this.nameLookup('depth' + this.lastContext, name, 'context');
1689
+
1690
+ this.push(helper.name + ' || ' + nonHelper);
1691
+ this.replaceStack(function(name) {
1692
+ return name + ' ? ' + name + '.call(' +
1693
+ helper.callParams + ") " + ": helperMissing.call(" +
1694
+ helper.helperMissingParams + ")";
1695
+ });
1696
+ },
1697
+
1698
+ // [invokeKnownHelper]
1699
+ //
1700
+ // On stack, before: hash, inverse, program, params..., ...
1701
+ // On stack, after: result of helper invocation
1702
+ //
1703
+ // This operation is used when the helper is known to exist,
1704
+ // so a `helperMissing` fallback is not required.
1705
+ invokeKnownHelper: function(paramSize, name) {
1706
+ var helper = this.setupHelper(paramSize, name);
1707
+ this.push(helper.name + ".call(" + helper.callParams + ")");
1708
+ },
1709
+
1710
+ // [invokeAmbiguous]
1711
+ //
1712
+ // On stack, before: hash, inverse, program, params..., ...
1713
+ // On stack, after: result of disambiguation
1714
+ //
1715
+ // This operation is used when an expression like `{{foo}}`
1716
+ // is provided, but we don't know at compile-time whether it
1717
+ // is a helper or a path.
1718
+ //
1719
+ // This operation emits more code than the other options,
1720
+ // and can be avoided by passing the `knownHelpers` and
1721
+ // `knownHelpersOnly` flags at compile-time.
1722
+ invokeAmbiguous: function(name, helperCall) {
1723
+ this.context.aliases.functionType = '"function"';
1724
+
1725
+ this.pushStackLiteral('{}'); // Hash value
1726
+ var helper = this.setupHelper(0, name, helperCall);
1727
+
1728
+ var helperName = this.lastHelper = this.nameLookup('helpers', name, 'helper');
1729
+
1730
+ var nonHelper = this.nameLookup('depth' + this.lastContext, name, 'context');
1731
+ var nextStack = this.nextStack();
1732
+
1733
+ this.pushSource('if (' + nextStack + ' = ' + helperName + ') { ' + nextStack + ' = ' + nextStack + '.call(' + helper.callParams + '); }');
1734
+ this.pushSource('else { ' + nextStack + ' = ' + nonHelper + '; ' + nextStack + ' = typeof ' + nextStack + ' === functionType ? ' + nextStack + '.call(' + helper.callParams + ') : ' + nextStack + '; }');
1735
+ },
1736
+
1737
+ // [invokePartial]
1738
+ //
1739
+ // On stack, before: context, ...
1740
+ // On stack after: result of partial invocation
1741
+ //
1742
+ // This operation pops off a context, invokes a partial with that context,
1743
+ // and pushes the result of the invocation back.
1744
+ invokePartial: function(name) {
1745
+ var params = [this.nameLookup('partials', name, 'partial'), "'" + name + "'", this.popStack(), "helpers", "partials"];
1746
+
1747
+ if (this.options.data) {
1748
+ params.push("data");
1749
+ }
1750
+
1751
+ this.context.aliases.self = "this";
1752
+ this.push("self.invokePartial(" + params.join(", ") + ")");
1753
+ },
1754
+
1755
+ // [assignToHash]
1756
+ //
1757
+ // On stack, before: value, hash, ...
1758
+ // On stack, after: hash, ...
1759
+ //
1760
+ // Pops a value and hash off the stack, assigns `hash[key] = value`
1761
+ // and pushes the hash back onto the stack.
1762
+ assignToHash: function(key) {
1763
+ var value = this.popStack(),
1764
+ context,
1765
+ type;
1766
+
1767
+ if (this.options.stringParams) {
1768
+ type = this.popStack();
1769
+ context = this.popStack();
1770
+ }
1771
+
1772
+ var hash = this.hash;
1773
+ if (context) {
1774
+ hash.contexts.push("'" + key + "': " + context);
1775
+ }
1776
+ if (type) {
1777
+ hash.types.push("'" + key + "': " + type);
1778
+ }
1779
+ hash.values.push("'" + key + "': (" + value + ")");
1780
+ },
1781
+
1782
+ // HELPERS
1783
+
1784
+ compiler: JavaScriptCompiler,
1785
+
1786
+ compileChildren: function(environment, options) {
1787
+ var children = environment.children, child, compiler;
1788
+
1789
+ for(var i=0, l=children.length; i<l; i++) {
1790
+ child = children[i];
1791
+ compiler = new this.compiler();
1792
+
1793
+ var index = this.matchExistingProgram(child);
1794
+
1795
+ if (index == null) {
1796
+ this.context.programs.push(''); // Placeholder to prevent name conflicts for nested children
1797
+ index = this.context.programs.length;
1798
+ child.index = index;
1799
+ child.name = 'program' + index;
1800
+ this.context.programs[index] = compiler.compile(child, options, this.context);
1801
+ this.context.environments[index] = child;
1802
+ } else {
1803
+ child.index = index;
1804
+ child.name = 'program' + index;
1805
+ }
1806
+ }
1807
+ },
1808
+ matchExistingProgram: function(child) {
1809
+ for (var i = 0, len = this.context.environments.length; i < len; i++) {
1810
+ var environment = this.context.environments[i];
1811
+ if (environment && environment.equals(child)) {
1812
+ return i;
1813
+ }
1814
+ }
1815
+ },
1816
+
1817
+ programExpression: function(guid) {
1818
+ this.context.aliases.self = "this";
1819
+
1820
+ if(guid == null) {
1821
+ return "self.noop";
1822
+ }
1823
+
1824
+ var child = this.environment.children[guid],
1825
+ depths = child.depths.list, depth;
1826
+
1827
+ var programParams = [child.index, child.name, "data"];
1828
+
1829
+ for(var i=0, l = depths.length; i<l; i++) {
1830
+ depth = depths[i];
1831
+
1832
+ if(depth === 1) { programParams.push("depth0"); }
1833
+ else { programParams.push("depth" + (depth - 1)); }
1834
+ }
1835
+
1836
+ return (depths.length === 0 ? "self.program(" : "self.programWithDepth(") + programParams.join(", ") + ")";
1837
+ },
1838
+
1839
+ register: function(name, val) {
1840
+ this.useRegister(name);
1841
+ this.pushSource(name + " = " + val + ";");
1842
+ },
1843
+
1844
+ useRegister: function(name) {
1845
+ if(!this.registers[name]) {
1846
+ this.registers[name] = true;
1847
+ this.registers.list.push(name);
1848
+ }
1849
+ },
1850
+
1851
+ pushStackLiteral: function(item) {
1852
+ return this.push(new Literal(item));
1853
+ },
1854
+
1855
+ pushSource: function(source) {
1856
+ if (this.pendingContent) {
1857
+ this.source.push(this.appendToBuffer(this.quotedString(this.pendingContent)));
1858
+ this.pendingContent = undefined;
1859
+ }
1860
+
1861
+ if (source) {
1862
+ this.source.push(source);
1863
+ }
1864
+ },
1865
+
1866
+ pushStack: function(item) {
1867
+ this.flushInline();
1868
+
1869
+ var stack = this.incrStack();
1870
+ if (item) {
1871
+ this.pushSource(stack + " = " + item + ";");
1872
+ }
1873
+ this.compileStack.push(stack);
1874
+ return stack;
1875
+ },
1876
+
1877
+ replaceStack: function(callback) {
1878
+ var prefix = '',
1879
+ inline = this.isInline(),
1880
+ stack;
1881
+
1882
+ // If we are currently inline then we want to merge the inline statement into the
1883
+ // replacement statement via ','
1884
+ if (inline) {
1885
+ var top = this.popStack(true);
1886
+
1887
+ if (top instanceof Literal) {
1888
+ // Literals do not need to be inlined
1889
+ stack = top.value;
1890
+ } else {
1891
+ // Get or create the current stack name for use by the inline
1892
+ var name = this.stackSlot ? this.topStackName() : this.incrStack();
1893
+
1894
+ prefix = '(' + this.push(name) + ' = ' + top + '),';
1895
+ stack = this.topStack();
1896
+ }
1897
+ } else {
1898
+ stack = this.topStack();
1899
+ }
1900
+
1901
+ var item = callback.call(this, stack);
1902
+
1903
+ if (inline) {
1904
+ if (this.inlineStack.length || this.compileStack.length) {
1905
+ this.popStack();
1906
+ }
1907
+ this.push('(' + prefix + item + ')');
1908
+ } else {
1909
+ // Prevent modification of the context depth variable. Through replaceStack
1910
+ if (!/^stack/.test(stack)) {
1911
+ stack = this.nextStack();
1912
+ }
1913
+
1914
+ this.pushSource(stack + " = (" + prefix + item + ");");
1915
+ }
1916
+ return stack;
1917
+ },
1918
+
1919
+ nextStack: function() {
1920
+ return this.pushStack();
1921
+ },
1922
+
1923
+ incrStack: function() {
1924
+ this.stackSlot++;
1925
+ if(this.stackSlot > this.stackVars.length) { this.stackVars.push("stack" + this.stackSlot); }
1926
+ return this.topStackName();
1927
+ },
1928
+ topStackName: function() {
1929
+ return "stack" + this.stackSlot;
1930
+ },
1931
+ flushInline: function() {
1932
+ var inlineStack = this.inlineStack;
1933
+ if (inlineStack.length) {
1934
+ this.inlineStack = [];
1935
+ for (var i = 0, len = inlineStack.length; i < len; i++) {
1936
+ var entry = inlineStack[i];
1937
+ if (entry instanceof Literal) {
1938
+ this.compileStack.push(entry);
1939
+ } else {
1940
+ this.pushStack(entry);
1941
+ }
1942
+ }
1943
+ }
1944
+ },
1945
+ isInline: function() {
1946
+ return this.inlineStack.length;
1947
+ },
1948
+
1949
+ popStack: function(wrapped) {
1950
+ var inline = this.isInline(),
1951
+ item = (inline ? this.inlineStack : this.compileStack).pop();
1952
+
1953
+ if (!wrapped && (item instanceof Literal)) {
1954
+ return item.value;
1955
+ } else {
1956
+ if (!inline) {
1957
+ this.stackSlot--;
1958
+ }
1959
+ return item;
1960
+ }
1961
+ },
1962
+
1963
+ topStack: function(wrapped) {
1964
+ var stack = (this.isInline() ? this.inlineStack : this.compileStack),
1965
+ item = stack[stack.length - 1];
1966
+
1967
+ if (!wrapped && (item instanceof Literal)) {
1968
+ return item.value;
1969
+ } else {
1970
+ return item;
1971
+ }
1972
+ },
1973
+
1974
+ quotedString: function(str) {
1975
+ return '"' + str
1976
+ .replace(/\\/g, '\\\\')
1977
+ .replace(/"/g, '\\"')
1978
+ .replace(/\n/g, '\\n')
1979
+ .replace(/\r/g, '\\r')
1980
+ .replace(/\u2028/g, '\\u2028') // Per Ecma-262 7.3 + 7.8.4
1981
+ .replace(/\u2029/g, '\\u2029') + '"';
1982
+ },
1983
+
1984
+ setupHelper: function(paramSize, name, missingParams) {
1985
+ var params = [];
1986
+ this.setupParams(paramSize, params, missingParams);
1987
+ var foundHelper = this.nameLookup('helpers', name, 'helper');
1988
+
1989
+ return {
1990
+ params: params,
1991
+ name: foundHelper,
1992
+ callParams: ["depth0"].concat(params).join(", "),
1993
+ helperMissingParams: missingParams && ["depth0", this.quotedString(name)].concat(params).join(", ")
1994
+ };
1995
+ },
1996
+
1997
+ // the params and contexts arguments are passed in arrays
1998
+ // to fill in
1999
+ setupParams: function(paramSize, params, useRegister) {
2000
+ var options = [], contexts = [], types = [], param, inverse, program;
2001
+
2002
+ options.push("hash:" + this.popStack());
2003
+
2004
+ inverse = this.popStack();
2005
+ program = this.popStack();
2006
+
2007
+ // Avoid setting fn and inverse if neither are set. This allows
2008
+ // helpers to do a check for `if (options.fn)`
2009
+ if (program || inverse) {
2010
+ if (!program) {
2011
+ this.context.aliases.self = "this";
2012
+ program = "self.noop";
2013
+ }
2014
+
2015
+ if (!inverse) {
2016
+ this.context.aliases.self = "this";
2017
+ inverse = "self.noop";
2018
+ }
2019
+
2020
+ options.push("inverse:" + inverse);
2021
+ options.push("fn:" + program);
2022
+ }
2023
+
2024
+ for(var i=0; i<paramSize; i++) {
2025
+ param = this.popStack();
2026
+ params.push(param);
2027
+
2028
+ if(this.options.stringParams) {
2029
+ types.push(this.popStack());
2030
+ contexts.push(this.popStack());
2031
+ }
2032
+ }
2033
+
2034
+ if (this.options.stringParams) {
2035
+ options.push("contexts:[" + contexts.join(",") + "]");
2036
+ options.push("types:[" + types.join(",") + "]");
2037
+ options.push("hashContexts:hashContexts");
2038
+ options.push("hashTypes:hashTypes");
2039
+ }
2040
+
2041
+ if(this.options.data) {
2042
+ options.push("data:data");
2043
+ }
2044
+
2045
+ options = "{" + options.join(",") + "}";
2046
+ if (useRegister) {
2047
+ this.register('options', options);
2048
+ params.push('options');
2049
+ } else {
2050
+ params.push(options);
2051
+ }
2052
+ return params.join(", ");
2053
+ }
2054
+ };
2055
+
2056
+ var reservedWords = (
2057
+ "break else new var" +
2058
+ " case finally return void" +
2059
+ " catch for switch while" +
2060
+ " continue function this with" +
2061
+ " default if throw" +
2062
+ " delete in try" +
2063
+ " do instanceof typeof" +
2064
+ " abstract enum int short" +
2065
+ " boolean export interface static" +
2066
+ " byte extends long super" +
2067
+ " char final native synchronized" +
2068
+ " class float package throws" +
2069
+ " const goto private transient" +
2070
+ " debugger implements protected volatile" +
2071
+ " double import public let yield"
2072
+ ).split(" ");
2073
+
2074
+ var compilerWords = JavaScriptCompiler.RESERVED_WORDS = {};
2075
+
2076
+ for(var i=0, l=reservedWords.length; i<l; i++) {
2077
+ compilerWords[reservedWords[i]] = true;
2078
+ }
2079
+
2080
+ JavaScriptCompiler.isValidJavaScriptVariableName = function(name) {
2081
+ if(!JavaScriptCompiler.RESERVED_WORDS[name] && /^[a-zA-Z_$][0-9a-zA-Z_$]+$/.test(name)) {
2082
+ return true;
2083
+ }
2084
+ return false;
2085
+ };
2086
+
2087
+ __exports__ = JavaScriptCompiler;
2088
+ return __exports__;
2089
+ })(__module2__);
2090
+
2091
+ // handlebars/compiler/compiler.js
2092
+ var __module10__ = (function(__dependency1__, __dependency2__, __dependency3__, __dependency4__) {
2093
+ "use strict";
2094
+ var __exports__ = {};
2095
+ var Exception = __dependency1__;
2096
+ var parse = __dependency2__.parse;
2097
+ var JavaScriptCompiler = __dependency3__;
2098
+ var AST = __dependency4__;
2099
+
2100
+ function Compiler() {}
2101
+
2102
+ __exports__.Compiler = Compiler;// the foundHelper register will disambiguate helper lookup from finding a
2103
+ // function in a context. This is necessary for mustache compatibility, which
2104
+ // requires that context functions in blocks are evaluated by blockHelperMissing,
2105
+ // and then proceed as if the resulting value was provided to blockHelperMissing.
2106
+
2107
+ Compiler.prototype = {
2108
+ compiler: Compiler,
2109
+
2110
+ disassemble: function() {
2111
+ var opcodes = this.opcodes, opcode, out = [], params, param;
2112
+
2113
+ for (var i=0, l=opcodes.length; i<l; i++) {
2114
+ opcode = opcodes[i];
2115
+
2116
+ if (opcode.opcode === 'DECLARE') {
2117
+ out.push("DECLARE " + opcode.name + "=" + opcode.value);
2118
+ } else {
2119
+ params = [];
2120
+ for (var j=0; j<opcode.args.length; j++) {
2121
+ param = opcode.args[j];
2122
+ if (typeof param === "string") {
2123
+ param = "\"" + param.replace("\n", "\\n") + "\"";
2124
+ }
2125
+ params.push(param);
2126
+ }
2127
+ out.push(opcode.opcode + " " + params.join(" "));
2128
+ }
2129
+ }
2130
+
2131
+ return out.join("\n");
2132
+ },
2133
+
2134
+ equals: function(other) {
2135
+ var len = this.opcodes.length;
2136
+ if (other.opcodes.length !== len) {
2137
+ return false;
2138
+ }
2139
+
2140
+ for (var i = 0; i < len; i++) {
2141
+ var opcode = this.opcodes[i],
2142
+ otherOpcode = other.opcodes[i];
2143
+ if (opcode.opcode !== otherOpcode.opcode || opcode.args.length !== otherOpcode.args.length) {
2144
+ return false;
2145
+ }
2146
+ for (var j = 0; j < opcode.args.length; j++) {
2147
+ if (opcode.args[j] !== otherOpcode.args[j]) {
2148
+ return false;
2149
+ }
2150
+ }
2151
+ }
2152
+
2153
+ len = this.children.length;
2154
+ if (other.children.length !== len) {
2155
+ return false;
2156
+ }
2157
+ for (i = 0; i < len; i++) {
2158
+ if (!this.children[i].equals(other.children[i])) {
2159
+ return false;
2160
+ }
2161
+ }
2162
+
2163
+ return true;
2164
+ },
2165
+
2166
+ guid: 0,
2167
+
2168
+ compile: function(program, options) {
2169
+ this.opcodes = [];
2170
+ this.children = [];
2171
+ this.depths = {list: []};
2172
+ this.options = options;
2173
+
2174
+ // These changes will propagate to the other compiler components
2175
+ var knownHelpers = this.options.knownHelpers;
2176
+ this.options.knownHelpers = {
2177
+ 'helperMissing': true,
2178
+ 'blockHelperMissing': true,
2179
+ 'each': true,
2180
+ 'if': true,
2181
+ 'unless': true,
2182
+ 'with': true,
2183
+ 'log': true
2184
+ };
2185
+ if (knownHelpers) {
2186
+ for (var name in knownHelpers) {
2187
+ this.options.knownHelpers[name] = knownHelpers[name];
2188
+ }
2189
+ }
2190
+
2191
+ return this.accept(program);
2192
+ },
2193
+
2194
+ accept: function(node) {
2195
+ var strip = node.strip || {},
2196
+ ret;
2197
+ if (strip.left) {
2198
+ this.opcode('strip');
2199
+ }
2200
+
2201
+ ret = this[node.type](node);
2202
+
2203
+ if (strip.right) {
2204
+ this.opcode('strip');
2205
+ }
2206
+
2207
+ return ret;
2208
+ },
2209
+
2210
+ program: function(program) {
2211
+ var statements = program.statements;
2212
+
2213
+ for(var i=0, l=statements.length; i<l; i++) {
2214
+ this.accept(statements[i]);
2215
+ }
2216
+ this.isSimple = l === 1;
2217
+
2218
+ this.depths.list = this.depths.list.sort(function(a, b) {
2219
+ return a - b;
2220
+ });
2221
+
2222
+ return this;
2223
+ },
2224
+
2225
+ compileProgram: function(program) {
2226
+ var result = new this.compiler().compile(program, this.options);
2227
+ var guid = this.guid++, depth;
2228
+
2229
+ this.usePartial = this.usePartial || result.usePartial;
2230
+
2231
+ this.children[guid] = result;
2232
+
2233
+ for(var i=0, l=result.depths.list.length; i<l; i++) {
2234
+ depth = result.depths.list[i];
2235
+
2236
+ if(depth < 2) { continue; }
2237
+ else { this.addDepth(depth - 1); }
2238
+ }
2239
+
2240
+ return guid;
2241
+ },
2242
+
2243
+ block: function(block) {
2244
+ var mustache = block.mustache,
2245
+ program = block.program,
2246
+ inverse = block.inverse;
2247
+
2248
+ if (program) {
2249
+ program = this.compileProgram(program);
2250
+ }
2251
+
2252
+ if (inverse) {
2253
+ inverse = this.compileProgram(inverse);
2254
+ }
2255
+
2256
+ var type = this.classifyMustache(mustache);
2257
+
2258
+ if (type === "helper") {
2259
+ this.helperMustache(mustache, program, inverse);
2260
+ } else if (type === "simple") {
2261
+ this.simpleMustache(mustache);
2262
+
2263
+ // now that the simple mustache is resolved, we need to
2264
+ // evaluate it by executing `blockHelperMissing`
2265
+ this.opcode('pushProgram', program);
2266
+ this.opcode('pushProgram', inverse);
2267
+ this.opcode('emptyHash');
2268
+ this.opcode('blockValue');
2269
+ } else {
2270
+ this.ambiguousMustache(mustache, program, inverse);
2271
+
2272
+ // now that the simple mustache is resolved, we need to
2273
+ // evaluate it by executing `blockHelperMissing`
2274
+ this.opcode('pushProgram', program);
2275
+ this.opcode('pushProgram', inverse);
2276
+ this.opcode('emptyHash');
2277
+ this.opcode('ambiguousBlockValue');
2278
+ }
2279
+
2280
+ this.opcode('append');
2281
+ },
2282
+
2283
+ hash: function(hash) {
2284
+ var pairs = hash.pairs, pair, val;
2285
+
2286
+ this.opcode('pushHash');
2287
+
2288
+ for(var i=0, l=pairs.length; i<l; i++) {
2289
+ pair = pairs[i];
2290
+ val = pair[1];
2291
+
2292
+ if (this.options.stringParams) {
2293
+ if(val.depth) {
2294
+ this.addDepth(val.depth);
2295
+ }
2296
+ this.opcode('getContext', val.depth || 0);
2297
+ this.opcode('pushStringParam', val.stringModeValue, val.type);
2298
+ } else {
2299
+ this.accept(val);
2300
+ }
2301
+
2302
+ this.opcode('assignToHash', pair[0]);
2303
+ }
2304
+ this.opcode('popHash');
2305
+ },
2306
+
2307
+ partial: function(partial) {
2308
+ var partialName = partial.partialName;
2309
+ this.usePartial = true;
2310
+
2311
+ if(partial.context) {
2312
+ this.ID(partial.context);
2313
+ } else {
2314
+ this.opcode('push', 'depth0');
2315
+ }
2316
+
2317
+ this.opcode('invokePartial', partialName.name);
2318
+ this.opcode('append');
2319
+ },
2320
+
2321
+ content: function(content) {
2322
+ this.opcode('appendContent', content.string);
2323
+ },
2324
+
2325
+ mustache: function(mustache) {
2326
+ var options = this.options;
2327
+ var type = this.classifyMustache(mustache);
2328
+
2329
+ if (type === "simple") {
2330
+ this.simpleMustache(mustache);
2331
+ } else if (type === "helper") {
2332
+ this.helperMustache(mustache);
2333
+ } else {
2334
+ this.ambiguousMustache(mustache);
2335
+ }
2336
+
2337
+ if(mustache.escaped && !options.noEscape) {
2338
+ this.opcode('appendEscaped');
2339
+ } else {
2340
+ this.opcode('append');
2341
+ }
2342
+ },
2343
+
2344
+ ambiguousMustache: function(mustache, program, inverse) {
2345
+ var id = mustache.id,
2346
+ name = id.parts[0],
2347
+ isBlock = program != null || inverse != null;
2348
+
2349
+ this.opcode('getContext', id.depth);
2350
+
2351
+ this.opcode('pushProgram', program);
2352
+ this.opcode('pushProgram', inverse);
2353
+
2354
+ this.opcode('invokeAmbiguous', name, isBlock);
2355
+ },
2356
+
2357
+ simpleMustache: function(mustache) {
2358
+ var id = mustache.id;
2359
+
2360
+ if (id.type === 'DATA') {
2361
+ this.DATA(id);
2362
+ } else if (id.parts.length) {
2363
+ this.ID(id);
2364
+ } else {
2365
+ // Simplified ID for `this`
2366
+ this.addDepth(id.depth);
2367
+ this.opcode('getContext', id.depth);
2368
+ this.opcode('pushContext');
2369
+ }
2370
+
2371
+ this.opcode('resolvePossibleLambda');
2372
+ },
2373
+
2374
+ helperMustache: function(mustache, program, inverse) {
2375
+ var params = this.setupFullMustacheParams(mustache, program, inverse),
2376
+ name = mustache.id.parts[0];
2377
+
2378
+ if (this.options.knownHelpers[name]) {
2379
+ this.opcode('invokeKnownHelper', params.length, name);
2380
+ } else if (this.options.knownHelpersOnly) {
2381
+ throw new Error("You specified knownHelpersOnly, but used the unknown helper " + name);
2382
+ } else {
2383
+ this.opcode('invokeHelper', params.length, name);
2384
+ }
2385
+ },
2386
+
2387
+ ID: function(id) {
2388
+ this.addDepth(id.depth);
2389
+ this.opcode('getContext', id.depth);
2390
+
2391
+ var name = id.parts[0];
2392
+ if (!name) {
2393
+ this.opcode('pushContext');
2394
+ } else {
2395
+ this.opcode('lookupOnContext', id.parts[0]);
2396
+ }
2397
+
2398
+ for(var i=1, l=id.parts.length; i<l; i++) {
2399
+ this.opcode('lookup', id.parts[i]);
2400
+ }
2401
+ },
2402
+
2403
+ DATA: function(data) {
2404
+ this.options.data = true;
2405
+ if (data.id.isScoped || data.id.depth) {
2406
+ throw new Exception('Scoped data references are not supported: ' + data.original);
2407
+ }
2408
+
2409
+ this.opcode('lookupData');
2410
+ var parts = data.id.parts;
2411
+ for(var i=0, l=parts.length; i<l; i++) {
2412
+ this.opcode('lookup', parts[i]);
2413
+ }
2414
+ },
2415
+
2416
+ STRING: function(string) {
2417
+ this.opcode('pushString', string.string);
2418
+ },
2419
+
2420
+ INTEGER: function(integer) {
2421
+ this.opcode('pushLiteral', integer.integer);
2422
+ },
2423
+
2424
+ BOOLEAN: function(bool) {
2425
+ this.opcode('pushLiteral', bool.bool);
2426
+ },
2427
+
2428
+ comment: function() {},
2429
+
2430
+ // HELPERS
2431
+ opcode: function(name) {
2432
+ this.opcodes.push({ opcode: name, args: [].slice.call(arguments, 1) });
2433
+ },
2434
+
2435
+ declare: function(name, value) {
2436
+ this.opcodes.push({ opcode: 'DECLARE', name: name, value: value });
2437
+ },
2438
+
2439
+ addDepth: function(depth) {
2440
+ if(isNaN(depth)) { throw new Error("EWOT"); }
2441
+ if(depth === 0) { return; }
2442
+
2443
+ if(!this.depths[depth]) {
2444
+ this.depths[depth] = true;
2445
+ this.depths.list.push(depth);
2446
+ }
2447
+ },
2448
+
2449
+ classifyMustache: function(mustache) {
2450
+ var isHelper = mustache.isHelper;
2451
+ var isEligible = mustache.eligibleHelper;
2452
+ var options = this.options;
2453
+
2454
+ // if ambiguous, we can possibly resolve the ambiguity now
2455
+ if (isEligible && !isHelper) {
2456
+ var name = mustache.id.parts[0];
2457
+
2458
+ if (options.knownHelpers[name]) {
2459
+ isHelper = true;
2460
+ } else if (options.knownHelpersOnly) {
2461
+ isEligible = false;
2462
+ }
2463
+ }
2464
+
2465
+ if (isHelper) { return "helper"; }
2466
+ else if (isEligible) { return "ambiguous"; }
2467
+ else { return "simple"; }
2468
+ },
2469
+
2470
+ pushParams: function(params) {
2471
+ var i = params.length, param;
2472
+
2473
+ while(i--) {
2474
+ param = params[i];
2475
+
2476
+ if(this.options.stringParams) {
2477
+ if(param.depth) {
2478
+ this.addDepth(param.depth);
2479
+ }
2480
+
2481
+ this.opcode('getContext', param.depth || 0);
2482
+ this.opcode('pushStringParam', param.stringModeValue, param.type);
2483
+ } else {
2484
+ this[param.type](param);
2485
+ }
2486
+ }
2487
+ },
2488
+
2489
+ setupMustacheParams: function(mustache) {
2490
+ var params = mustache.params;
2491
+ this.pushParams(params);
2492
+
2493
+ if(mustache.hash) {
2494
+ this.hash(mustache.hash);
2495
+ } else {
2496
+ this.opcode('emptyHash');
2497
+ }
2498
+
2499
+ return params;
2500
+ },
2501
+
2502
+ // this will replace setupMustacheParams when we're done
2503
+ setupFullMustacheParams: function(mustache, program, inverse) {
2504
+ var params = mustache.params;
2505
+ this.pushParams(params);
2506
+
2507
+ this.opcode('pushProgram', program);
2508
+ this.opcode('pushProgram', inverse);
2509
+
2510
+ if(mustache.hash) {
2511
+ this.hash(mustache.hash);
2512
+ } else {
2513
+ this.opcode('emptyHash');
2514
+ }
2515
+
2516
+ return params;
2517
+ }
2518
+ };
2519
+
2520
+ function precompile(input, options) {
2521
+ if (input == null || (typeof input !== 'string' && input.constructor !== AST.ProgramNode)) {
2522
+ throw new Exception("You must pass a string or Handlebars AST to Handlebars.precompile. You passed " + input);
2523
+ }
2524
+
2525
+ options = options || {};
2526
+ if (!('data' in options)) {
2527
+ options.data = true;
2528
+ }
2529
+
2530
+ var ast = parse(input);
2531
+ var environment = new Compiler().compile(ast, options);
2532
+ return new JavaScriptCompiler().compile(environment, options);
2533
+ }
2534
+
2535
+ __exports__.precompile = precompile;function compile(input, options, env) {
2536
+ if (input == null || (typeof input !== 'string' && input.constructor !== AST.ProgramNode)) {
2537
+ throw new Exception("You must pass a string or Handlebars AST to Handlebars.compile. You passed " + input);
2538
+ }
2539
+
2540
+ options = options || {};
2541
+
2542
+ if (!('data' in options)) {
2543
+ options.data = true;
2544
+ }
2545
+
2546
+ var compiled;
2547
+
2548
+ function compileInput() {
2549
+ var ast = parse(input);
2550
+ var environment = new Compiler().compile(ast, options);
2551
+ var templateSpec = new JavaScriptCompiler().compile(environment, options, undefined, true);
2552
+ return env.template(templateSpec);
2553
+ }
2554
+
2555
+ // Template is only compiled on first use and cached after that point.
2556
+ return function(context, options) {
2557
+ if (!compiled) {
2558
+ compiled = compileInput();
2559
+ }
2560
+ return compiled.call(this, context, options);
2561
+ };
2562
+ }
2563
+
2564
+ __exports__.compile = compile;
2565
+ return __exports__;
2566
+ })(__module5__, __module8__, __module11__, __module7__);
2567
+
2568
+ // handlebars.js
2569
+ var __module0__ = (function(__dependency1__, __dependency2__, __dependency3__, __dependency4__, __dependency5__) {
2570
+ "use strict";
2571
+ var __exports__;
2572
+ /*globals Handlebars: true */
2573
+ var Handlebars = __dependency1__;
2574
+
2575
+ // Compiler imports
2576
+ var AST = __dependency2__;
2577
+ var Parser = __dependency3__.parser;
2578
+ var parse = __dependency3__.parse;
2579
+ var Compiler = __dependency4__.Compiler;
2580
+ var compile = __dependency4__.compile;
2581
+ var precompile = __dependency4__.precompile;
2582
+ var JavaScriptCompiler = __dependency5__;
2583
+
2584
+ var _create = Handlebars.create;
2585
+ var create = function() {
2586
+ var hb = _create();
2587
+
2588
+ hb.compile = function(input, options) {
2589
+ return compile(input, options, hb);
2590
+ };
2591
+ hb.precompile = precompile;
2592
+
2593
+ hb.AST = AST;
2594
+ hb.Compiler = Compiler;
2595
+ hb.JavaScriptCompiler = JavaScriptCompiler;
2596
+ hb.Parser = Parser;
2597
+ hb.parse = parse;
2598
+
2599
+ return hb;
2600
+ };
2601
+
2602
+ Handlebars = create();
2603
+ Handlebars.create = create;
2604
+
2605
+ __exports__ = Handlebars;
2606
+ return __exports__;
2607
+ })(__module1__, __module7__, __module8__, __module10__, __module11__);
2608
+
2609
+ return __module0__;
2610
+ })();