From 09ea11086d09f9e82ef2f4c9aaa9f41a0e1aca2d Mon Sep 17 00:00:00 2001 From: Omar Skalli Date: Tue, 27 May 2014 14:20:23 -0700 Subject: [PATCH 01/81] Update version to 0.16 --- CHANGELOG.md | 5 +++++ lib/handlebars_assets/version.rb | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 943814f..9fb5fa1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +## 0.16 (2014-05-27) + +* README clarification - @jithugopal +* Upgrade `handlebars` to 1.1.3 - @neodude + ## 0.15 (2013-12-06) * Allow use of ember and other handlebars simultaneously - @rbhitchcock diff --git a/lib/handlebars_assets/version.rb b/lib/handlebars_assets/version.rb index ba8204f..9d29e63 100644 --- a/lib/handlebars_assets/version.rb +++ b/lib/handlebars_assets/version.rb @@ -1,3 +1,3 @@ module HandlebarsAssets - VERSION = "0.15" + VERSION = "0.16" end From 3cc92f53a3f513c8da98dc7f5518d6bebd036950 Mon Sep 17 00:00:00 2001 From: Omar Skalli Date: Tue, 27 May 2014 14:49:06 -0700 Subject: [PATCH 02/81] Fix typo in README --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9fb5fa1..134a9aa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,7 @@ ## 0.16 (2014-05-27) * README clarification - @jithugopal -* Upgrade `handlebars` to 1.1.3 - @neodude +* Upgrade `handlebars` to 1.3 - @neodude ## 0.15 (2013-12-06) From 9e8e3f82c453f7f5ea9f555867aa50f789cd568b Mon Sep 17 00:00:00 2001 From: Alexander Lang Date: Thu, 19 Jun 2014 13:31:36 +0200 Subject: [PATCH 03/81] fixes regex matching template names --- lib/handlebars_assets/tilt_handlebars.rb | 2 +- test/handlebars_assets/tilt_handlebars_test.rb | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/handlebars_assets/tilt_handlebars.rb b/lib/handlebars_assets/tilt_handlebars.rb index d677591..57370aa 100644 --- a/lib/handlebars_assets/tilt_handlebars.rb +++ b/lib/handlebars_assets/tilt_handlebars.rb @@ -106,7 +106,7 @@ def is_partial? end def is_ember? - full_path.to_s =~ %r{.ember(.hbs|.hamlbars|.slimbars)?$} + full_path.to_s =~ %r{\.ember(\.hbs|\.hamlbars|\.slimbars)?$} end def name diff --git a/test/handlebars_assets/tilt_handlebars_test.rb b/test/handlebars_assets/tilt_handlebars_test.rb index d1b1c25..67d9338 100644 --- a/test/handlebars_assets/tilt_handlebars_test.rb +++ b/test/handlebars_assets/tilt_handlebars_test.rb @@ -152,6 +152,7 @@ def test_ember_render def test_multiple_frameworks_with_ember_render root = '/myapp/app/assets/templates' non_ember = 'test_render.hbs' + non_ember_but_with_ember = 'test_member.hbs' ember_ext_no_hbs = 'test_render.ember' ember_ext = 'test_render.ember.hbs' ember_with_haml = 'test_render.ember.hamlbars' @@ -166,6 +167,12 @@ def test_multiple_frameworks_with_ember_render template = HandlebarsAssets::TiltHandlebars.new(scope.pathname.to_s) { source } assert_equal hbs_compiled('test_render', source), template.render(scope, {}) + # File without ember extension but with ember in it should compile to default namespace + scope = make_scope root, non_ember_but_with_ember + source = "This is {{handlebars}}" + template = HandlebarsAssets::TiltHandlebars.new(scope.pathname.to_s) { source } + assert_equal hbs_compiled('test_member', source), template.render(scope, {}) + # File with ember extension should compile to ember specific namespace expected_compiled = %{window.Ember.TEMPLATES["test_render"] = Ember.Handlebars.compile("This is {{handlebars}}");}; scope = make_scope root, ember_ext_no_hbs From b7f6cf98b57758440555c54c2293c21895693317 Mon Sep 17 00:00:00 2001 From: Alexander Lang Date: Thu, 19 Jun 2014 14:30:36 +0200 Subject: [PATCH 04/81] adds handling .hbs.erb (or other extensions) files --- lib/handlebars_assets/tilt_handlebars.rb | 2 +- test/handlebars_assets/tilt_handlebars_test.rb | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/handlebars_assets/tilt_handlebars.rb b/lib/handlebars_assets/tilt_handlebars.rb index 57370aa..8595a2b 100644 --- a/lib/handlebars_assets/tilt_handlebars.rb +++ b/lib/handlebars_assets/tilt_handlebars.rb @@ -106,7 +106,7 @@ def is_partial? end def is_ember? - full_path.to_s =~ %r{\.ember(\.hbs|\.hamlbars|\.slimbars)?$} + full_path.to_s =~ %r{\.ember(\.hbs|\.hamlbars|\.slimbars)?} end def name diff --git a/test/handlebars_assets/tilt_handlebars_test.rb b/test/handlebars_assets/tilt_handlebars_test.rb index 67d9338..61f5034 100644 --- a/test/handlebars_assets/tilt_handlebars_test.rb +++ b/test/handlebars_assets/tilt_handlebars_test.rb @@ -157,6 +157,7 @@ def test_multiple_frameworks_with_ember_render ember_ext = 'test_render.ember.hbs' ember_with_haml = 'test_render.ember.hamlbars' ember_with_slim = 'test_render.ember.slimbars' + ember_ext_with_erb = 'test_render.ember.hbs.erb' HandlebarsAssets::Config.ember = true HandlebarsAssets::Config.multiple_frameworks = true @@ -179,6 +180,12 @@ def test_multiple_frameworks_with_ember_render template = HandlebarsAssets::TiltHandlebars.new(scope.pathname.to_s) { source } assert_equal expected_compiled, template.render(scope, {}) + # File with ember and erb extension should compile to ember specific namespace + expected_compiled = %{window.Ember.TEMPLATES["test_render"] = Ember.Handlebars.compile("This is {{handlebars}}");}; + scope = make_scope root, ember_ext_with_erb + template = HandlebarsAssets::TiltHandlebars.new(scope.pathname.to_s) { source } + assert_equal expected_compiled, template.render(scope, {}) + # File with ember.hbs extension should compile to ember specific namespace expected_compiled = %{window.Ember.TEMPLATES["test_render"] = Ember.Handlebars.compile("This is {{handlebars}}");}; scope = make_scope root, ember_ext From 84a09492f5067f96b147acaadeda2f424a5774b3 Mon Sep 17 00:00:00 2001 From: Alex Riedler Date: Fri, 20 Sep 2013 21:34:27 -0700 Subject: [PATCH 05/81] step 1, refactor --- lib/handlebars_assets.rb | 26 +++++++++++++++----------- lib/handlebars_assets/engine.rb | 11 ----------- lib/handlebars_assets/railtie.rb | 7 +++++++ 3 files changed, 22 insertions(+), 22 deletions(-) delete mode 100644 lib/handlebars_assets/engine.rb create mode 100644 lib/handlebars_assets/railtie.rb diff --git a/lib/handlebars_assets.rb b/lib/handlebars_assets.rb index 462157a..9894531 100644 --- a/lib/handlebars_assets.rb +++ b/lib/handlebars_assets.rb @@ -1,23 +1,27 @@ -require "handlebars_assets/version" +require 'handlebars_assets/version' +require 'sprockets' module HandlebarsAssets - PATH = File.expand_path("../../vendor/assets/javascripts", __FILE__) + PATH = File.expand_path('../../vendor/assets/javascripts', __FILE__) def self.path PATH end + def register_extensions(sprockets_environment) + sprockets_environment.register_engine('.hbs', TiltHandlebars) + sprockets_environment.register_engine('.handlebars', TiltHandlebars) + sprockets_environment.register_engine('.hamlbars', TiltHandlebars) if HandlebarsAssets::Config.haml_available? + sprockets_environment.register_engine('.slimbars', TiltHandlebars) if HandlebarsAssets::Config.slim_available? + end + autoload(:Config, 'handlebars_assets/config') autoload(:Handlebars, 'handlebars_assets/handlebars') autoload(:TiltHandlebars, 'handlebars_assets/tilt_handlebars') +end - if defined?(Rails) && defined?(::Rails::Engine) - require 'handlebars_assets/engine' - else - require 'sprockets' - Sprockets.register_engine '.hbs', TiltHandlebars - Sprockets.register_engine '.handlebars', TiltHandlebars - Sprockets.register_engine('.hamlbars', TiltHandlebars) if HandlebarsAssets::Config.haml_available? - Sprockets.register_engine('.slimbars', TiltHandlebars) if HandlebarsAssets::Config.slim_available? - end +if defined?(Rails) + require 'handlebar_assets/railtie' +else + register_extensions(Sprockets) end diff --git a/lib/handlebars_assets/engine.rb b/lib/handlebars_assets/engine.rb deleted file mode 100644 index aaef0b4..0000000 --- a/lib/handlebars_assets/engine.rb +++ /dev/null @@ -1,11 +0,0 @@ -module HandlebarsAssets - class Engine < ::Rails::Engine - initializer "sprockets.handlebars", :after => "sprockets.environment", :group => :all do |app| - next unless app.assets - app.assets.register_engine('.hbs', TiltHandlebars) - app.assets.register_engine('.handlebars', TiltHandlebars) - app.assets.register_engine('.hamlbars', TiltHandlebars) if HandlebarsAssets::Config.haml_available? - app.assets.register_engine('.slimbars', TiltHandlebars) if HandlebarsAssets::Config.slim_available? - end - end -end diff --git a/lib/handlebars_assets/railtie.rb b/lib/handlebars_assets/railtie.rb new file mode 100644 index 0000000..858450a --- /dev/null +++ b/lib/handlebars_assets/railtie.rb @@ -0,0 +1,7 @@ +module HandlebarsAssets + class Railtie < ::Rails::Railtie + initializer "sprockets.handlebars", :after => "sprockets.environment", :group => :all do |app| + HandlebarsAssets.register_extensions(app.assets) + end + end +end From 828d46ea0673bbc17bca0460284c7d8204919c2a Mon Sep 17 00:00:00 2001 From: Alex Riedler Date: Fri, 20 Sep 2013 21:47:03 -0700 Subject: [PATCH 06/81] change how sprocket registers, we need an engine --- lib/handlebars_assets.rb | 17 +++++++---------- lib/handlebars_assets/engine.rb | 5 +++++ lib/handlebars_assets/railtie.rb | 7 ------- 3 files changed, 12 insertions(+), 17 deletions(-) create mode 100644 lib/handlebars_assets/engine.rb delete mode 100644 lib/handlebars_assets/railtie.rb diff --git a/lib/handlebars_assets.rb b/lib/handlebars_assets.rb index 9894531..43f45fe 100644 --- a/lib/handlebars_assets.rb +++ b/lib/handlebars_assets.rb @@ -8,11 +8,11 @@ def self.path PATH end - def register_extensions(sprockets_environment) - sprockets_environment.register_engine('.hbs', TiltHandlebars) - sprockets_environment.register_engine('.handlebars', TiltHandlebars) - sprockets_environment.register_engine('.hamlbars', TiltHandlebars) if HandlebarsAssets::Config.haml_available? - sprockets_environment.register_engine('.slimbars', TiltHandlebars) if HandlebarsAssets::Config.slim_available? + def self.register_extensions(sprockets_environment) + Sprockets.register_engine('.hbs', TiltHandlebars) + Sprockets.register_engine('.handlebars', TiltHandlebars) + Sprockets.register_engine('.hamlbars', TiltHandlebars) if HandlebarsAssets::Config.haml_available? + Sprockets.register_engine('.slimbars', TiltHandlebars) if HandlebarsAssets::Config.slim_available? end autoload(:Config, 'handlebars_assets/config') @@ -20,8 +20,5 @@ def register_extensions(sprockets_environment) autoload(:TiltHandlebars, 'handlebars_assets/tilt_handlebars') end -if defined?(Rails) - require 'handlebar_assets/railtie' -else - register_extensions(Sprockets) -end +HandlebarsAssets.register_extensions(Sprockets) +require 'handlebars_assets/engine' if defined?(Rails) diff --git a/lib/handlebars_assets/engine.rb b/lib/handlebars_assets/engine.rb new file mode 100644 index 0000000..7a8fef0 --- /dev/null +++ b/lib/handlebars_assets/engine.rb @@ -0,0 +1,5 @@ +module HandlebarsAssets + # NOTE: must be an engine because we are including assets in the gem + class Engine < ::Rails::Engine + end +end diff --git a/lib/handlebars_assets/railtie.rb b/lib/handlebars_assets/railtie.rb deleted file mode 100644 index 858450a..0000000 --- a/lib/handlebars_assets/railtie.rb +++ /dev/null @@ -1,7 +0,0 @@ -module HandlebarsAssets - class Railtie < ::Rails::Railtie - initializer "sprockets.handlebars", :after => "sprockets.environment", :group => :all do |app| - HandlebarsAssets.register_extensions(app.assets) - end - end -end From 5ef5084f3bd827b1418ff334154bac262dc680e7 Mon Sep 17 00:00:00 2001 From: Alex Riedler Date: Sat, 21 Sep 2013 00:58:52 -0700 Subject: [PATCH 07/81] Massive cleanup, chomp trailing newline. --- lib/handlebars_assets.rb | 10 +- lib/handlebars_assets/config.rb | 9 +- lib/handlebars_assets/handlebars_template.rb | 138 ++++++++++++++++++ lib/handlebars_assets/tilt_handlebars.rb | 129 ---------------- test/handlebars_assets/hamlbars_test.rb | 4 +- test/handlebars_assets/slimbars_test.rb | 2 +- .../handlebars_assets/tilt_handlebars_test.rb | 38 ++--- test/test_helper.rb | 2 +- 8 files changed, 173 insertions(+), 159 deletions(-) create mode 100644 lib/handlebars_assets/handlebars_template.rb delete mode 100644 lib/handlebars_assets/tilt_handlebars.rb diff --git a/lib/handlebars_assets.rb b/lib/handlebars_assets.rb index 43f45fe..842a448 100644 --- a/lib/handlebars_assets.rb +++ b/lib/handlebars_assets.rb @@ -9,15 +9,15 @@ def self.path end def self.register_extensions(sprockets_environment) - Sprockets.register_engine('.hbs', TiltHandlebars) - Sprockets.register_engine('.handlebars', TiltHandlebars) - Sprockets.register_engine('.hamlbars', TiltHandlebars) if HandlebarsAssets::Config.haml_available? - Sprockets.register_engine('.slimbars', TiltHandlebars) if HandlebarsAssets::Config.slim_available? + Sprockets.register_engine('.hbs', HandlebarsTemplate) + Sprockets.register_engine('.handlebars', HandlebarsTemplate) + Sprockets.register_engine('.hamlbars', HandlebarsTemplate) if HandlebarsAssets::Config.haml_available? + Sprockets.register_engine('.slimbars', HandlebarsTemplate) if HandlebarsAssets::Config.slim_available? end autoload(:Config, 'handlebars_assets/config') autoload(:Handlebars, 'handlebars_assets/handlebars') - autoload(:TiltHandlebars, 'handlebars_assets/tilt_handlebars') + autoload(:HandlebarsTemplate, 'handlebars_assets/handlebars_template') end HandlebarsAssets.register_extensions(Sprockets) diff --git a/lib/handlebars_assets/config.rb b/lib/handlebars_assets/config.rb index d3f22ad..07b7268 100644 --- a/lib/handlebars_assets/config.rb +++ b/lib/handlebars_assets/config.rb @@ -7,7 +7,8 @@ module Config attr_writer :compiler, :compiler_path, :ember, :multiple_frameworks, :haml_options, :known_helpers, :known_helpers_only, :options, - :patch_files, :patch_path, :path_prefix, :slim_options, :template_namespace + :patch_files, :patch_path, :path_prefix, :slim_options, :template_namespace, + :precompile def configure yield self @@ -58,7 +59,11 @@ def patch_path end def path_prefix - @path_prefix || 'templates' + @path_prefix ||= 'templates' + end + + def precompile + @precompile ||= true end def slim_available? diff --git a/lib/handlebars_assets/handlebars_template.rb b/lib/handlebars_assets/handlebars_template.rb new file mode 100644 index 0000000..c6d7ca1 --- /dev/null +++ b/lib/handlebars_assets/handlebars_template.rb @@ -0,0 +1,138 @@ +require 'tilt' + +module HandlebarsAssets + module Unindent + # http://bit.ly/aze9FV + # Strip leading whitespace from each line that is the same as the + # amount of whitespace on the first line of the string. + # Leaves _additional_ indentation on later lines intact. + def unindent(heredoc) + heredoc.gsub(/^#{heredoc[/\A\s*/]}/, '') + end + end + + class HandlebarsTemplate < Tilt::Template + + include Unindent + + def self.default_mime_type + 'application/javascript' + end + + def initialize_engine + begin + require 'haml' + rescue LoadError + # haml not available + end + begin + require 'slim' + rescue LoadError + # slim not available + end + end + + def prepare + @template_path = TemplatePath.new(@file) + @engine = + if @template_path.is_haml? + Haml::Engine.new(data, HandlebarsAssets::Config.haml_options) + elsif @template_path.is_slim? + Slim::Template.new(HandlebarsAssets::Config.slim_options) { data } + else + nil + end + end + + def evaluate(scope, locals, &block) + source = + if @engine + @engine.render(scope, locals, &block) + else + data + end + + # remove trailing \n on file, for some reason the directives pipeline adds this + source.chomp!($/) + + # handle the case of multiple frameworks combined with ember + # DEFER: use extension setup for ember + if (HandlebarsAssets::Config.multiple_frameworks? && @template_path.is_ember?) || + (HandlebarsAssets::Config.ember? && !HandlebarsAssets::Config.multiple_frameworks?) + compile_ember(source) + else + compile_default(source) + end + end + + def compile_ember(source) + "window.Ember.TEMPLATES[#{@template_path.name}] = Ember.Handlebars.compile(#{source.to_json});" + end + + def compile_default(source) + template = + if HandlebarsAssets::Config.precompile + compiled_hbs = Handlebars.precompile(source, HandlebarsAssets::Config.options) + "Handlebars.template(#{compiled_hbs})" + else + "Handlebars.compile(#{source.to_json})" + end + + template_namespace = HandlebarsAssets::Config.template_namespace + + if @template_path.is_partial? + unindent <<-PARTIAL + (function() { + Handlebars.registerPartial(#{@template_path.name}, #{template}); + }).call(this); + PARTIAL + else + unindent <<-TEMPLATE + (function() { + this.#{template_namespace} || (this.#{template_namespace} = {}); + this.#{template_namespace}[#{@template_path.name}] = #{template}; + return this.#{template_namespace}[#{@template_path.name}]; + }).call(this); + TEMPLATE + end + end + + protected + + class TemplatePath + def initialize(path) + @full_path = path + end + + def is_haml? + @full_path.end_with?('.hamlbars') + end + + def is_slim? + @full_path.end_with?('.slimbars') + end + + def is_partial? + @full_path.gsub(%r{.*/}, '').start_with?('_') + end + + def is_ember? + @full_path =~ %r{\.ember(\.hbs|\.hamlbars|\.slimbars)?} + end + + def name + template_name + end + + private + + def relative_path + @full_path.match(/.*#{HandlebarsAssets::Config.path_prefix}\/((.*\/)*([^.]*)).*$/)[1] + end + + def template_name + relative_path.dump + end + end + end +end diff --git a/lib/handlebars_assets/tilt_handlebars.rb b/lib/handlebars_assets/tilt_handlebars.rb deleted file mode 100644 index 8595a2b..0000000 --- a/lib/handlebars_assets/tilt_handlebars.rb +++ /dev/null @@ -1,129 +0,0 @@ -require 'tilt' -require 'multi_json' - -module HandlebarsAssets - module Unindent - # http://bit.ly/aze9FV - # Strip leading whitespace from each line that is the same as the - # amount of whitespace on the first line of the string. - # Leaves _additional_ indentation on later lines intact. - def unindent(heredoc) - heredoc.gsub /^#{heredoc[/\A\s*/]}/, '' - end - end - - class TiltHandlebars < Tilt::Template - - include Unindent - - def self.default_mime_type - 'application/javascript' - end - - def evaluate(scope, locals, &block) - template_path = TemplatePath.new(scope) - - source = if template_path.is_haml? - Haml::Engine.new(data, HandlebarsAssets::Config.haml_options).render(scope, locals) - elsif template_path.is_slim? - Slim::Template.new(HandlebarsAssets::Config.slim_options) { data }.render(scope, locals) - else - data - end - - if HandlebarsAssets::Config.multiple_frameworks? && HandlebarsAssets::Config.ember? - if template_path.is_ember? - compile_ember(source, template_path) - else - compile_default(source, template_path) - end - elsif HandlebarsAssets::Config.ember? && !HandlebarsAssets::Config.multiple_frameworks? - compile_ember(source, template_path) - else - compile_default(source, template_path) - end - end - - def initialize_engine - begin - require 'haml' - rescue LoadError - # haml not available - end - begin - require 'slim' - rescue LoadError - # slim not available - end - end - - def compile_ember(source, template_path) - "window.Ember.TEMPLATES[#{template_path.name}] = Ember.Handlebars.compile(#{::MultiJson.dump source});" - end - - def compile_default(source, template_path) - compiled_hbs = Handlebars.precompile(source, HandlebarsAssets::Config.options) - - template_namespace = HandlebarsAssets::Config.template_namespace - - if template_path.is_partial? - unindent <<-PARTIAL - (function() { - Handlebars.registerPartial(#{template_path.name}, Handlebars.template(#{compiled_hbs})); - }).call(this); - PARTIAL - else - unindent <<-TEMPLATE - (function() { - this.#{template_namespace} || (this.#{template_namespace} = {}); - this.#{template_namespace}[#{template_path.name}] = Handlebars.template(#{compiled_hbs}); - return this.#{template_namespace}[#{template_path.name}]; - }).call(this); - TEMPLATE - end - end - - protected - - def prepare; end - - class TemplatePath - def initialize(scope) - self.full_path = scope.pathname - self.template_path = scope.logical_path - end - - def is_haml? - full_path.to_s.end_with?('.hamlbars') - end - - def is_slim? - full_path.to_s.end_with?('.slimbars') - end - - def is_partial? - template_path.gsub(%r{.*/}, '').start_with?('_') - end - - def is_ember? - full_path.to_s =~ %r{\.ember(\.hbs|\.hamlbars|\.slimbars)?} - end - - def name - template_name - end - - private - - attr_accessor :full_path, :template_path - - def relative_path - template_path.gsub(/^#{HandlebarsAssets::Config.path_prefix}\/(.*)$/i, "\\1") - end - - def template_name - relative_path.dump - end - end - end -end diff --git a/test/handlebars_assets/hamlbars_test.rb b/test/handlebars_assets/hamlbars_test.rb index 4fe00d3..8a51e6e 100644 --- a/test/handlebars_assets/hamlbars_test.rb +++ b/test/handlebars_assets/hamlbars_test.rb @@ -6,7 +6,7 @@ class HamlbarsTest < Test::Unit::TestCase include CompilerSupport def compile_haml(source) - Haml::Engine.new(source, HandlebarsAssets::Config.haml_options).render + (Haml::Engine.new(source, HandlebarsAssets::Config.haml_options).render).chomp end def teardown @@ -20,7 +20,7 @@ def test_render_haml scope = make_scope root, file source = "%p This is {{handlebars}}" - template = HandlebarsAssets::TiltHandlebars.new(scope.pathname.to_s) { source } + template = HandlebarsAssets::HandlebarsTemplate.new(scope.pathname.to_s) { source } assert_equal hbs_compiled('test_render', compile_haml(source)), template.render(scope, {}) end diff --git a/test/handlebars_assets/slimbars_test.rb b/test/handlebars_assets/slimbars_test.rb index 1087900..222bdb5 100644 --- a/test/handlebars_assets/slimbars_test.rb +++ b/test/handlebars_assets/slimbars_test.rb @@ -20,7 +20,7 @@ def test_render_slim scope = make_scope root, file source = "p This is {{handlebars}}" - template = HandlebarsAssets::TiltHandlebars.new(scope.pathname.to_s) { source } + template = HandlebarsAssets::HandlebarsTemplate.new(scope.pathname.to_s) { source } assert_equal hbs_compiled('test_render', compile_slim(source)), template.render(scope, {}) end diff --git a/test/handlebars_assets/tilt_handlebars_test.rb b/test/handlebars_assets/tilt_handlebars_test.rb index 61f5034..3f0c0dd 100644 --- a/test/handlebars_assets/tilt_handlebars_test.rb +++ b/test/handlebars_assets/tilt_handlebars_test.rb @@ -1,7 +1,7 @@ require 'test_helper' module HandlebarsAssets - class TiltHandlebarsTest < Test::Unit::TestCase + class HandlebarsTemplateTest < Test::Unit::TestCase include CompilerSupport include SprocketsScope @@ -24,7 +24,7 @@ def test_render scope = make_scope root, file source = "This is {{handlebars}}" - template = HandlebarsAssets::TiltHandlebars.new(scope.pathname.to_s) { source } + template = HandlebarsAssets::HandlebarsTemplate.new(scope.pathname.to_s) { source } assert_equal hbs_compiled('test_render', source), template.render(scope, {}) end @@ -37,7 +37,7 @@ def test_template_misnaming scope = make_scope root, file source = "This is {{handlebars}}" - template = HandlebarsAssets::TiltHandlebars.new(scope.pathname.to_s) { source } + template = HandlebarsAssets::HandlebarsTemplate.new(scope.pathname.to_s) { source } assert_equal hbs_compiled('test_template_misnaming', source), template.render(scope, {}) end @@ -50,7 +50,7 @@ def test_path_prefix HandlebarsAssets::Config.path_prefix = 'app/templates' - template = HandlebarsAssets::TiltHandlebars.new(scope.pathname.to_s) { source } + template = HandlebarsAssets::HandlebarsTemplate.new(scope.pathname.to_s) { source } assert_equal hbs_compiled('test_path_prefix', source), template.render(scope, {}) end @@ -65,11 +65,11 @@ def test_underscore_partials HandlebarsAssets::Config.path_prefix = 'app/templates' - template1 = HandlebarsAssets::TiltHandlebars.new(scope1.pathname.to_s) { source } + template1 = HandlebarsAssets::HandlebarsTemplate.new(scope1.pathname.to_s) { source } assert_equal hbs_compiled_partial('_test_underscore', source), template1.render(scope1, {}) - template2 = HandlebarsAssets::TiltHandlebars.new(scope2.pathname.to_s) { source } + template2 = HandlebarsAssets::HandlebarsTemplate.new(scope2.pathname.to_s) { source } assert_equal hbs_compiled_partial('some/thing/_test_underscore', source), template2.render(scope2, {}) end @@ -80,7 +80,7 @@ def test_without_known_helpers_opt scope = make_scope root, file source = "{{#with author}}By {{first_name}} {{last_name}}{{/with}}" - template = HandlebarsAssets::TiltHandlebars.new(scope.pathname.to_s) { source } + template = HandlebarsAssets::HandlebarsTemplate.new(scope.pathname.to_s) { source } assert_equal hbs_compiled('test_without_known', source), template.render(scope, {}) end @@ -93,7 +93,7 @@ def test_known_helpers_opt HandlebarsAssets::Config.known_helpers_only = true - template = HandlebarsAssets::TiltHandlebars.new(scope.pathname.to_s) { source } + template = HandlebarsAssets::HandlebarsTemplate.new(scope.pathname.to_s) { source } assert_equal hbs_compiled('test_known', source), template.render(scope, {}) end @@ -104,7 +104,7 @@ def test_with_custom_helpers scope = make_scope root, file source = "{{#custom author}}By {{first_name}} {{last_name}}{{/custom}}" - template = HandlebarsAssets::TiltHandlebars.new(scope.pathname.to_s) { source } + template = HandlebarsAssets::HandlebarsTemplate.new(scope.pathname.to_s) { source } assert_equal hbs_compiled('test_custom_helper', source), template.render(scope, {}) end @@ -118,20 +118,20 @@ def test_with_custom_known_helpers HandlebarsAssets::Config.known_helpers_only = true HandlebarsAssets::Config.known_helpers = %w(custom) - template = HandlebarsAssets::TiltHandlebars.new(scope.pathname.to_s) { source } + template = HandlebarsAssets::HandlebarsTemplate.new(scope.pathname.to_s) { source } assert_equal hbs_compiled('test_custom_known_helper', source), template.render(scope, {}) end def test_template_namespace - root = '/myapp/app/assets/javascripts' + root = '/myapp/app/assets/javascripts/templates' file = 'test_template_namespace.hbs' scope = make_scope root, file source = "This is {{handlebars}}" HandlebarsAssets::Config.template_namespace = 'JST' - template = HandlebarsAssets::TiltHandlebars.new(scope.pathname.to_s) { source } + template = HandlebarsAssets::HandlebarsTemplate.new(scope.pathname.to_s) { source } assert_equal hbs_compiled('test_template_namespace', source), template.render(scope, {}) end @@ -143,7 +143,7 @@ def test_ember_render source = "This is {{handlebars}}" HandlebarsAssets::Config.ember = true - template = HandlebarsAssets::TiltHandlebars.new(scope.pathname.to_s) { source } + template = HandlebarsAssets::HandlebarsTemplate.new(scope.pathname.to_s) { source } expected_compiled = %{window.Ember.TEMPLATES["test_render"] = Ember.Handlebars.compile("This is {{handlebars}}");}; assert_equal expected_compiled, template.render(scope, {}) @@ -165,7 +165,7 @@ def test_multiple_frameworks_with_ember_render # File without ember extension should compile to default namespace scope = make_scope root, non_ember source = "This is {{handlebars}}" - template = HandlebarsAssets::TiltHandlebars.new(scope.pathname.to_s) { source } + template = HandlebarsAssets::HandlebarsTemplate.new(scope.pathname.to_s) { source } assert_equal hbs_compiled('test_render', source), template.render(scope, {}) # File without ember extension but with ember in it should compile to default namespace @@ -177,7 +177,7 @@ def test_multiple_frameworks_with_ember_render # File with ember extension should compile to ember specific namespace expected_compiled = %{window.Ember.TEMPLATES["test_render"] = Ember.Handlebars.compile("This is {{handlebars}}");}; scope = make_scope root, ember_ext_no_hbs - template = HandlebarsAssets::TiltHandlebars.new(scope.pathname.to_s) { source } + template = HandlebarsAssets::HandlebarsTemplate.new(scope.pathname.to_s) { source } assert_equal expected_compiled, template.render(scope, {}) # File with ember and erb extension should compile to ember specific namespace @@ -189,21 +189,21 @@ def test_multiple_frameworks_with_ember_render # File with ember.hbs extension should compile to ember specific namespace expected_compiled = %{window.Ember.TEMPLATES["test_render"] = Ember.Handlebars.compile("This is {{handlebars}}");}; scope = make_scope root, ember_ext - template = HandlebarsAssets::TiltHandlebars.new(scope.pathname.to_s) { source } + template = HandlebarsAssets::HandlebarsTemplate.new(scope.pathname.to_s) { source } assert_equal expected_compiled, template.render(scope, {}) # File with ember.hamlbars extension should compile to ember specific namespace - expected_compiled = %{window.Ember.TEMPLATES["test_render"] = Ember.Handlebars.compile("

This is {{handlebars}}

\\n");}; + expected_compiled = %{window.Ember.TEMPLATES["test_render"] = Ember.Handlebars.compile("

This is {{handlebars}}

");}; scope = make_scope root, ember_with_haml source = "%p This is {{handlebars}}" - template = HandlebarsAssets::TiltHandlebars.new(scope.pathname.to_s) { compile_haml(source) } + template = HandlebarsAssets::HandlebarsTemplate.new(scope.pathname.to_s) { compile_haml(source) } assert_equal expected_compiled, template.render(scope, {}) # File with ember.slimbars extension should compile to ember specific namespace expected_compiled = %{window.Ember.TEMPLATES["test_render"] = Ember.Handlebars.compile("

This is {{handlebars}}

");}; source = "p This is {{handlebars}}" scope = make_scope root, ember_with_slim - template = HandlebarsAssets::TiltHandlebars.new(scope.pathname.to_s) { compile_slim(source) } + template = HandlebarsAssets::HandlebarsTemplate.new(scope.pathname.to_s) { compile_slim(source) } assert_equal expected_compiled, template.render(scope, {}) end end diff --git a/test/test_helper.rb b/test/test_helper.rb index 2824d82..3ce8e7f 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -1,6 +1,6 @@ require 'handlebars_assets' require 'handlebars_assets/config' -require 'handlebars_assets/tilt_handlebars' +require 'handlebars_assets/handlebars_template' require 'handlebars_assets/handlebars' require 'test/unit' From 11a53e7f2bbd5a41531768789cc57dbd2e525040 Mon Sep 17 00:00:00 2001 From: Alex Riedler Date: Wed, 2 Oct 2013 19:54:18 -0700 Subject: [PATCH 08/81] remove automatic registration of extensions, temporarily. --- lib/handlebars_assets.rb | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/handlebars_assets.rb b/lib/handlebars_assets.rb index 842a448..12c9547 100644 --- a/lib/handlebars_assets.rb +++ b/lib/handlebars_assets.rb @@ -20,5 +20,4 @@ def self.register_extensions(sprockets_environment) autoload(:HandlebarsTemplate, 'handlebars_assets/handlebars_template') end -HandlebarsAssets.register_extensions(Sprockets) require 'handlebars_assets/engine' if defined?(Rails) From 32846d653eb9801aa5857e695d3e88ae700b3ee9 Mon Sep 17 00:00:00 2001 From: Alex Riedler Date: Wed, 2 Oct 2013 22:33:23 -0700 Subject: [PATCH 09/81] cleanup configuration, and add extension configuration --- lib/handlebars_assets.rb | 38 ++++++++++--- lib/handlebars_assets/config.rb | 59 +++++++++++++++----- lib/handlebars_assets/engine.rb | 3 + lib/handlebars_assets/handlebars_template.rb | 18 +++++- 4 files changed, 92 insertions(+), 26 deletions(-) diff --git a/lib/handlebars_assets.rb b/lib/handlebars_assets.rb index 12c9547..4bd9791 100644 --- a/lib/handlebars_assets.rb +++ b/lib/handlebars_assets.rb @@ -1,23 +1,43 @@ require 'handlebars_assets/version' -require 'sprockets' module HandlebarsAssets + autoload(:Config, 'handlebars_assets/config') + autoload(:Handlebars, 'handlebars_assets/handlebars') + autoload(:HandlebarsTemplate, 'handlebars_assets/handlebars_template') + PATH = File.expand_path('../../vendor/assets/javascripts', __FILE__) def self.path PATH end + def self.configure + yield Config + end + def self.register_extensions(sprockets_environment) - Sprockets.register_engine('.hbs', HandlebarsTemplate) - Sprockets.register_engine('.handlebars', HandlebarsTemplate) - Sprockets.register_engine('.hamlbars', HandlebarsTemplate) if HandlebarsAssets::Config.haml_available? - Sprockets.register_engine('.slimbars', HandlebarsTemplate) if HandlebarsAssets::Config.slim_available? + Config.handlebars_extensions.each do |ext| + sprockets_environment.register_engine(ext, HandlebarsTemplate) + end + if Config.haml_enabled? && Config.haml_available? + Config.hamlbars_extensions.each do |ext| + sprockets_environment.register_engine(ext, HandlebarsTemplate) + end + end + if Config.slim_enabled? && Config.slim_available? + Config.slimbars_extensions.each do |ext| + sprockets_environment.register_engine(ext, HandlebarsTemplate) + end + end end - autoload(:Config, 'handlebars_assets/config') - autoload(:Handlebars, 'handlebars_assets/handlebars') - autoload(:HandlebarsTemplate, 'handlebars_assets/handlebars_template') end -require 'handlebars_assets/engine' if defined?(Rails) +# Register the engine (which will register extension in the app) +# or ASSUME using sprockets +if defined?(Rails) + require 'handlebars_assets/engine' +else + require 'sprockets' + ::HandlebarsAssets.register_extensions(Sprockets) +end diff --git a/lib/handlebars_assets/config.rb b/lib/handlebars_assets/config.rb index 07b7268..209d9ce 100644 --- a/lib/handlebars_assets/config.rb +++ b/lib/handlebars_assets/config.rb @@ -2,28 +2,31 @@ module HandlebarsAssets # Change config options in an initializer: # # HandlebarsAssets::Config.path_prefix = 'app/templates' + module Config extend self attr_writer :compiler, :compiler_path, :ember, :multiple_frameworks, :haml_options, :known_helpers, :known_helpers_only, :options, :patch_files, :patch_path, :path_prefix, :slim_options, :template_namespace, - :precompile - - def configure - yield self - end + :precompile, :haml_enabled, :slim_enabled, + :handlebars_extensions, :hamlbars_extensions, :slimbars_extensions, + :amd def compiler @compiler || 'handlebars.js' end + def self.configure + yield self + end + def compiler_path @compiler_path || HandlebarsAssets.path end def ember? - @ember + @ember || false end def multiple_frameworks? @@ -34,16 +37,35 @@ def haml_available? defined? ::Haml::Engine end + def haml_enabled? + @haml_enabled = true if @haml_enabled.nil? + @haml_enabled + end + def haml_options @haml_options || {} end + def slim_available? + defined? ::Slim::Engine + end + + def slim_enabled? + @slim_enabled = true if @slim_enabled.nil? + @slim_enabled + end + + def slim_options + @slim_options || {} + end + def known_helpers @known_helpers || [] end def known_helpers_only - @known_helpers_only || false + @known_helpers_only = false if @known_helpers_only.nil? + @known_helpers_only end def options @@ -63,19 +85,28 @@ def path_prefix end def precompile - @precompile ||= true + @precompile = true if @precompile.nil? + @precompile end - def slim_available? - defined? ::Slim::Engine + def template_namespace + @template_namespace || 'HandlebarsTemplates' end - def slim_options - @slim_options || {} + def handlebars_extensions + @hbs_extensions ||= ['.hbs', 'handlebars'] end - def template_namespace - @template_namespace || 'HandlebarsTemplates' + def hamlbars_extensions + @hamlbars_extensions ||= ['.hamlbars'] + end + + def slimbars_extensions + @slimbars_extensions ||= ['.slimbars'] + end + + def ember_extensions + @ember_extensions ||= ['.ember'] end private diff --git a/lib/handlebars_assets/engine.rb b/lib/handlebars_assets/engine.rb index 7a8fef0..d6cbdfd 100644 --- a/lib/handlebars_assets/engine.rb +++ b/lib/handlebars_assets/engine.rb @@ -1,5 +1,8 @@ module HandlebarsAssets # NOTE: must be an engine because we are including assets in the gem class Engine < ::Rails::Engine + initializer "handlebars_assets.assets.register" do |app| + ::HandlebarsAssets::register_extensions(app.assets) + end end end diff --git a/lib/handlebars_assets/handlebars_template.rb b/lib/handlebars_assets/handlebars_template.rb index c6d7ca1..890f5b0 100644 --- a/lib/handlebars_assets/handlebars_template.rb +++ b/lib/handlebars_assets/handlebars_template.rb @@ -105,11 +105,19 @@ def initialize(path) end def is_haml? - @full_path.end_with?('.hamlbars') + result = false + ::HandlebarsAssets::Config.hamlbars_extensions.each do |ext| + result ||= !(@full_path =~ /#{ext}(\.[a-zA-Z0-9]*)*$/).nil? + end + result end def is_slim? - @full_path.end_with?('.slimbars') + result = false + ::HandlebarsAssets::Config.slimbars_extensions.each do |ext| + result ||= !(@full_path =~ /#{ext}(\.[a-zA-Z0-9]*)*$/).nil? + end + result end def is_partial? @@ -117,7 +125,11 @@ def is_partial? end def is_ember? - @full_path =~ %r{\.ember(\.hbs|\.hamlbars|\.slimbars)?} + result = false + ::HandlebarsAssets::Config.ember_extensions.each do |ext| + result ||= !(@full_path =~ /\.#{ext}(\.[a-zA-Z0-9]*)*$/).nil? + end + result end def name From 3b6bf7f1c463a2427b7a81bd33cbc6f18431bc0f Mon Sep 17 00:00:00 2001 From: Alex Riedler Date: Sat, 21 Jun 2014 16:26:34 -0400 Subject: [PATCH 10/81] cleanup and fix some test issues --- lib/handlebars_assets/config.rb | 8 ++++---- test/handlebars_assets/tilt_handlebars_test.rb | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/handlebars_assets/config.rb b/lib/handlebars_assets/config.rb index 209d9ce..7321d25 100644 --- a/lib/handlebars_assets/config.rb +++ b/lib/handlebars_assets/config.rb @@ -94,19 +94,19 @@ def template_namespace end def handlebars_extensions - @hbs_extensions ||= ['.hbs', 'handlebars'] + @hbs_extensions ||= ['hbs', 'handlebars'] end def hamlbars_extensions - @hamlbars_extensions ||= ['.hamlbars'] + @hamlbars_extensions ||= ['hamlbars'] end def slimbars_extensions - @slimbars_extensions ||= ['.slimbars'] + @slimbars_extensions ||= ['slimbars'] end def ember_extensions - @ember_extensions ||= ['.ember'] + @ember_extensions ||= ['ember'] end private diff --git a/test/handlebars_assets/tilt_handlebars_test.rb b/test/handlebars_assets/tilt_handlebars_test.rb index 3f0c0dd..6a76142 100644 --- a/test/handlebars_assets/tilt_handlebars_test.rb +++ b/test/handlebars_assets/tilt_handlebars_test.rb @@ -171,7 +171,7 @@ def test_multiple_frameworks_with_ember_render # File without ember extension but with ember in it should compile to default namespace scope = make_scope root, non_ember_but_with_ember source = "This is {{handlebars}}" - template = HandlebarsAssets::TiltHandlebars.new(scope.pathname.to_s) { source } + template = HandlebarsAssets::HandlebarsTemplate.new(scope.pathname.to_s) { source } assert_equal hbs_compiled('test_member', source), template.render(scope, {}) # File with ember extension should compile to ember specific namespace @@ -183,7 +183,7 @@ def test_multiple_frameworks_with_ember_render # File with ember and erb extension should compile to ember specific namespace expected_compiled = %{window.Ember.TEMPLATES["test_render"] = Ember.Handlebars.compile("This is {{handlebars}}");}; scope = make_scope root, ember_ext_with_erb - template = HandlebarsAssets::TiltHandlebars.new(scope.pathname.to_s) { source } + template = HandlebarsAssets::HandlebarsTemplate.new(scope.pathname.to_s) { source } assert_equal expected_compiled, template.render(scope, {}) # File with ember.hbs extension should compile to ember specific namespace From e73b0cad6405cbe8c70146e1c8edaf745a20ac35 Mon Sep 17 00:00:00 2001 From: Alex Riedler Date: Sat, 21 Jun 2014 18:21:50 -0400 Subject: [PATCH 11/81] Fix extension handling. --- lib/handlebars_assets/handlebars_template.rb | 26 ++++++++++++++++---- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/lib/handlebars_assets/handlebars_template.rb b/lib/handlebars_assets/handlebars_template.rb index 890f5b0..aaf61be 100644 --- a/lib/handlebars_assets/handlebars_template.rb +++ b/lib/handlebars_assets/handlebars_template.rb @@ -1,4 +1,5 @@ require 'tilt' +require 'json' module HandlebarsAssets module Unindent @@ -66,7 +67,7 @@ def evaluate(scope, locals, &block) end def compile_ember(source) - "window.Ember.TEMPLATES[#{@template_path.name}] = Ember.Handlebars.compile(#{source.to_json});" + "window.Ember.TEMPLATES[#{@template_path.name}] = Ember.Handlebars.compile(#{JSON.dump(source)});" end def compile_default(source) @@ -75,7 +76,7 @@ def compile_default(source) compiled_hbs = Handlebars.precompile(source, HandlebarsAssets::Config.options) "Handlebars.template(#{compiled_hbs})" else - "Handlebars.compile(#{source.to_json})" + "Handlebars.compile(#{JSON.dump(source)})" end template_namespace = HandlebarsAssets::Config.template_namespace @@ -107,7 +108,12 @@ def initialize(path) def is_haml? result = false ::HandlebarsAssets::Config.hamlbars_extensions.each do |ext| - result ||= !(@full_path =~ /#{ext}(\.[a-zA-Z0-9]*)*$/).nil? + if ext.start_with? '.' + ext = '\\#{ext}' + result ||= !(@full_path =~ /#{ext}(\..*)*$/).nil? + else + result ||= !(@full_path =~ /\.#{ext}(\..*)*$/).nil? + end end result end @@ -115,7 +121,12 @@ def is_haml? def is_slim? result = false ::HandlebarsAssets::Config.slimbars_extensions.each do |ext| - result ||= !(@full_path =~ /#{ext}(\.[a-zA-Z0-9]*)*$/).nil? + if ext.start_with? '.' + ext = '\\#{ext}' + result ||= !(@full_path =~ /#{ext}(\..*)*$/).nil? + else + result ||= !(@full_path =~ /\.#{ext}(\..*)*$/).nil? + end end result end @@ -127,7 +138,12 @@ def is_partial? def is_ember? result = false ::HandlebarsAssets::Config.ember_extensions.each do |ext| - result ||= !(@full_path =~ /\.#{ext}(\.[a-zA-Z0-9]*)*$/).nil? + if ext.start_with? '.' + ext = '\\#{ext}' + result ||= !(@full_path =~ /#{ext}(\..*)*$/).nil? + else + result ||= !(@full_path =~ /\.#{ext}(\..*)*$/).nil? + end end result end From 29eea86bcec7f857921241c9432e829bbece939c Mon Sep 17 00:00:00 2001 From: Alex Riedler Date: Sat, 21 Jun 2014 18:39:54 -0400 Subject: [PATCH 12/81] Update changelog and readme --- CHANGELOG.md | 7 +++++++ README.md | 4 ++++ 2 files changed, 11 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 134a9aa..f121350 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +## 0.17 (2014-06-21) + +* Massive revamp - @AlexRiedler +* Changed how sprockets is registered - @AlexRiedler +* AMD loading - @AlexRiedler +* Fix extension being too liberal issues - @langalex + ## 0.16 (2014-05-27) * README clarification - @jithugopal diff --git a/README.md b/README.md index 754caad..21e194e 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,10 @@ Yea, I think so too. That is why I wrote **handlebars_assets**. Give your Handle Using `sprockets` with Sinatra or another framework? **handlebars_assets** works outside of Rails too (as of v0.2.0) +# BREAKING CHANGES AS OF OF v0.17 + +@AlexRiedler has made some larger changes to this repository for going forward; If you have existing monkey patches they may not work, and the configuration schema has changed slightly to handle multiple extensions for the same compilation pipeline. + # BREAKING CHANGE AS OF v0.9.0 My pull request to allow `/` in partials was pulled into Handlebars. The hack that converted partial names to underscored paths (`shared/_time` -> `_shared_time`) is no longer necessary and has been removed. You should change all the partial references in your app when upgrading from a version prior to v0.9.0. From 7c3d9486b2eed9f8904b84966e27e2c885b4032a Mon Sep 17 00:00:00 2001 From: Alex Riedler Date: Sun, 22 Jun 2014 00:05:13 -0400 Subject: [PATCH 13/81] AMD Loading based on @pboling approach. --- CHANGELOG.md | 2 +- README.md | 1 + lib/handlebars_assets/config.rb | 18 +++++- lib/handlebars_assets/handlebars_template.rb | 65 ++++++++++++++++---- 4 files changed, 71 insertions(+), 15 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f121350..5ed0546 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ * Massive revamp - @AlexRiedler * Changed how sprockets is registered - @AlexRiedler -* AMD loading - @AlexRiedler +* AMD loading - @AlexRiedler, based on @pboling changes (THANKS!) * Fix extension being too liberal issues - @langalex ## 0.16 (2014-05-27) diff --git a/README.md b/README.md index 21e194e..ab55026 100644 --- a/README.md +++ b/README.md @@ -290,6 +290,7 @@ Les Hill, follow me on [Github](https://github.com/leshill) and [Twitter](https: * Parker Selbert (@sorentwo) : README section for `multiple_frameworks` * Francisco QV (@panchoqv) : README clarification * Dylan Markow (@dmarkow) : README cleanup +* Peter Boling (@pboling) : AMD Loading # Contributing diff --git a/lib/handlebars_assets/config.rb b/lib/handlebars_assets/config.rb index 7321d25..9a54aa0 100644 --- a/lib/handlebars_assets/config.rb +++ b/lib/handlebars_assets/config.rb @@ -11,7 +11,7 @@ module Config :patch_files, :patch_path, :path_prefix, :slim_options, :template_namespace, :precompile, :haml_enabled, :slim_enabled, :handlebars_extensions, :hamlbars_extensions, :slimbars_extensions, - :amd + :amd, :handlebars_amd_path, :amd_with_template_namespace def compiler @compiler || 'handlebars.js' @@ -109,6 +109,22 @@ def ember_extensions @ember_extensions ||= ['ember'] end + def amd? + @amd || false + end + + # indicate whether the template should + # be added to the global template namespace + def amd_with_template_namespace + @amd_with_template_namespace || false + end + + # path specified by the require.js paths + # during configuration for the handlebars + def handlebars_amd_path + @handlebars_amd_path || 'handlebars' + end + private def generate_known_helpers_hash diff --git a/lib/handlebars_assets/handlebars_template.rb b/lib/handlebars_assets/handlebars_template.rb index aaf61be..19d2d35 100644 --- a/lib/handlebars_assets/handlebars_template.rb +++ b/lib/handlebars_assets/handlebars_template.rb @@ -81,20 +81,59 @@ def compile_default(source) template_namespace = HandlebarsAssets::Config.template_namespace - if @template_path.is_partial? - unindent <<-PARTIAL - (function() { - Handlebars.registerPartial(#{@template_path.name}, #{template}); - }).call(this); - PARTIAL + if HandlebarsAssets::Config.amd? + handlebars_amd_path = HandlebarsAssets::Config.handlebars_amd_path + if HandlebarsAssets::Config.amd_with_template_namespace + if @template_path.is_partial? + unindent <<-PARTIAL + define(['#{handlebars_amd_path}'],function(Handlebars){ + var t = #{template}; + Handlebars.registerPartial(#{@template_path.name}, t); + return t; + ;}) + PARTIAL + else + unindent <<-TEMPLATE + define(['#{handlebars_amd_path}'],function(Handlebars){ + return #{template}; + }); + TEMPLATE + end + else + if @template_path.is_partial? + unindent <<-PARTIAL + define(['#{handlebars_amd_path}'],function(Handlebars){ + var t = #{template}; + Handlebars.registerPartial(#{@template_path.name}, t); + return t; + ;}) + PARTIAL + else + unindent <<-TEMPLATE + define(['#{handlebars_amd_path}'],function(Handlebars){ + this.#{template_namespace} || (this.#{template_namespace} = {}); + this.#{template_namespace}[#{@template_path.name}] = #{template}; + return this.#{template_namespace}[#{@template_path.name}]; + }); + TEMPLATE + end + end else - unindent <<-TEMPLATE - (function() { - this.#{template_namespace} || (this.#{template_namespace} = {}); - this.#{template_namespace}[#{@template_path.name}] = #{template}; - return this.#{template_namespace}[#{@template_path.name}]; - }).call(this); - TEMPLATE + if @template_path.is_partial? + unindent <<-PARTIAL + (function() { + Handlebars.registerPartial(#{@template_path.name}, #{template}); + }).call(this); + PARTIAL + else + unindent <<-TEMPLATE + (function() { + this.#{template_namespace} || (this.#{template_namespace} = {}); + this.#{template_namespace}[#{@template_path.name}] = #{template}; + return this.#{template_namespace}[#{@template_path.name}]; + }).call(this); + TEMPLATE + end end end From 5f61e04a8dd69350a33322db7ea0f8d32caaf480 Mon Sep 17 00:00:00 2001 From: Alex Riedler Date: Sun, 22 Jun 2014 00:07:10 -0400 Subject: [PATCH 14/81] Release v0.17 --- CHANGELOG.md | 2 +- README.md | 2 ++ lib/handlebars_assets/version.rb | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5ed0546..da2c24c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,4 @@ -## 0.17 (2014-06-21) +## 0.17 (2014-06-22) * Massive revamp - @AlexRiedler * Changed how sprockets is registered - @AlexRiedler diff --git a/README.md b/README.md index ab55026..05c5395 100644 --- a/README.md +++ b/README.md @@ -10,6 +10,8 @@ Using `sprockets` with Sinatra or another framework? **handlebars_assets** works @AlexRiedler has made some larger changes to this repository for going forward; If you have existing monkey patches they may not work, and the configuration schema has changed slightly to handle multiple extensions for the same compilation pipeline. +If you have any problems, please post an issue! I will attempt to fix ASAP + # BREAKING CHANGE AS OF v0.9.0 My pull request to allow `/` in partials was pulled into Handlebars. The hack that converted partial names to underscored paths (`shared/_time` -> `_shared_time`) is no longer necessary and has been removed. You should change all the partial references in your app when upgrading from a version prior to v0.9.0. diff --git a/lib/handlebars_assets/version.rb b/lib/handlebars_assets/version.rb index 9d29e63..b2c434f 100644 --- a/lib/handlebars_assets/version.rb +++ b/lib/handlebars_assets/version.rb @@ -1,3 +1,3 @@ module HandlebarsAssets - VERSION = "0.16" + VERSION = "0.17" end From 6f64b56413eaba9e06f581bdc4274baa11ec6509 Mon Sep 17 00:00:00 2001 From: Alex Riedler Date: Sat, 28 Jun 2014 15:16:59 -0400 Subject: [PATCH 15/81] Fix engine initialization error on rails during assets precompile, up version to 0.17.1 --- CHANGELOG.md | 4 ++++ lib/handlebars_assets/engine.rb | 2 +- lib/handlebars_assets/version.rb | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index da2c24c..94eb0cb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.17.1 (2014-06-28) + +* Fix engine initialization error on rails during assets precompile - @AlexRiedler + ## 0.17 (2014-06-22) * Massive revamp - @AlexRiedler diff --git a/lib/handlebars_assets/engine.rb b/lib/handlebars_assets/engine.rb index d6cbdfd..9c6711b 100644 --- a/lib/handlebars_assets/engine.rb +++ b/lib/handlebars_assets/engine.rb @@ -1,7 +1,7 @@ module HandlebarsAssets # NOTE: must be an engine because we are including assets in the gem class Engine < ::Rails::Engine - initializer "handlebars_assets.assets.register" do |app| + initializer "handlebars_assets.assets.register", group: :all do |app| ::HandlebarsAssets::register_extensions(app.assets) end end diff --git a/lib/handlebars_assets/version.rb b/lib/handlebars_assets/version.rb index b2c434f..89a818f 100644 --- a/lib/handlebars_assets/version.rb +++ b/lib/handlebars_assets/version.rb @@ -1,3 +1,3 @@ module HandlebarsAssets - VERSION = "0.17" + VERSION = "0.17.1" end From 70a9e2477afe451ef59157e9e939c4cbd9b8cf03 Mon Sep 17 00:00:00 2001 From: Blaine Kasten Date: Mon, 18 Aug 2014 10:31:32 -0500 Subject: [PATCH 16/81] Allows assets to precompile properly in Ruby 1.8 --- lib/handlebars_assets/engine.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/handlebars_assets/engine.rb b/lib/handlebars_assets/engine.rb index 9c6711b..2a6c8a5 100644 --- a/lib/handlebars_assets/engine.rb +++ b/lib/handlebars_assets/engine.rb @@ -1,7 +1,7 @@ module HandlebarsAssets # NOTE: must be an engine because we are including assets in the gem class Engine < ::Rails::Engine - initializer "handlebars_assets.assets.register", group: :all do |app| + initializer "handlebars_assets.assets.register", :group => :all do |app| ::HandlebarsAssets::register_extensions(app.assets) end end From 4950dbce642a504efe9df89c77fd7b2275a92daf Mon Sep 17 00:00:00 2001 From: Alex Riedler Date: Mon, 8 Sep 2014 18:35:23 -0400 Subject: [PATCH 17/81] Update version to 0.17.2 --- CHANGELOG.md | 4 ++++ lib/handlebars_assets/version.rb | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 94eb0cb..d0e5682 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.17.2 (2014-09-08) + +* Support for Ruby v1.8 - @blainekasten + ## 0.17.1 (2014-06-28) * Fix engine initialization error on rails during assets precompile - @AlexRiedler diff --git a/lib/handlebars_assets/version.rb b/lib/handlebars_assets/version.rb index 89a818f..a74f04a 100644 --- a/lib/handlebars_assets/version.rb +++ b/lib/handlebars_assets/version.rb @@ -1,3 +1,3 @@ module HandlebarsAssets - VERSION = "0.17.1" + VERSION = "0.17.2" end From c6e981f6e93256c0b063efbe34643c8e8ecfc6ec Mon Sep 17 00:00:00 2001 From: Alex Riedler Date: Mon, 8 Sep 2014 18:43:55 -0400 Subject: [PATCH 18/81] Update to Handlebars v2.0.0 --- vendor/assets/javascripts/handlebars.js | 1665 ++++++++++------- .../assets/javascripts/handlebars.runtime.js | 308 ++- 2 files changed, 1218 insertions(+), 755 deletions(-) diff --git a/vendor/assets/javascripts/handlebars.js b/vendor/assets/javascripts/handlebars.js index bec7085..f826bbf 100644 --- a/vendor/assets/javascripts/handlebars.js +++ b/vendor/assets/javascripts/handlebars.js @@ -1,8 +1,8 @@ /*! - handlebars v1.3.0 + handlebars v2.0.0 -Copyright (C) 2011 by Yehuda Katz +Copyright (C) 2011-2014 by Yehuda Katz Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal @@ -25,7 +25,15 @@ THE SOFTWARE. @license */ /* exported Handlebars */ -var Handlebars = (function() { +(function (root, factory) { + if (typeof define === 'function' && define.amd) { + define([], factory); + } else if (typeof exports === 'object') { + module.exports = factory(); + } else { + root.Handlebars = root.Handlebars || factory(); + } +}(this, function () { // handlebars/safe-string.js var __module4__ = (function() { "use strict"; @@ -63,15 +71,19 @@ var __module3__ = (function(__dependency1__) { var possible = /[&<>"'`]/; function escapeChar(chr) { - return escape[chr] || "&"; + return escape[chr]; } - function extend(obj, value) { - for(var key in value) { - if(Object.prototype.hasOwnProperty.call(value, key)) { - obj[key] = value[key]; + function extend(obj /* , ...source */) { + for (var i = 1; i < arguments.length; i++) { + for (var key in arguments[i]) { + if (Object.prototype.hasOwnProperty.call(arguments[i], key)) { + obj[key] = arguments[i][key]; + } } } + + return obj; } __exports__.extend = extend;var toString = Object.prototype.toString; @@ -82,6 +94,7 @@ var __module3__ = (function(__dependency1__) { return typeof value === 'function'; }; // fallback for older versions of Chrome and Safari + /* istanbul ignore next */ if (isFunction(/x/)) { isFunction = function(value) { return typeof value === 'function' && toString.call(value) === '[object Function]'; @@ -89,6 +102,7 @@ var __module3__ = (function(__dependency1__) { } var isFunction; __exports__.isFunction = isFunction; + /* istanbul ignore next */ var isArray = Array.isArray || function(value) { return (value && typeof value === 'object') ? toString.call(value) === '[object Array]' : false; }; @@ -98,8 +112,10 @@ var __module3__ = (function(__dependency1__) { // don't escape SafeStrings, since they're already safe if (string instanceof SafeString) { return string.toString(); - } else if (!string && string !== 0) { + } else if (string == null) { return ""; + } else if (!string) { + return string + ''; } // Force a string conversion as this will be done by the append regardless and @@ -121,7 +137,11 @@ var __module3__ = (function(__dependency1__) { } } - __exports__.isEmpty = isEmpty; + __exports__.isEmpty = isEmpty;function appendContextPath(contextPath, id) { + return (contextPath ? contextPath + '.' : '') + id; + } + + __exports__.appendContextPath = appendContextPath; return __exports__; })(__module4__); @@ -166,14 +186,16 @@ var __module2__ = (function(__dependency1__, __dependency2__) { var Utils = __dependency1__; var Exception = __dependency2__; - var VERSION = "1.3.0"; - __exports__.VERSION = VERSION;var COMPILER_REVISION = 4; + var VERSION = "2.0.0"; + __exports__.VERSION = VERSION;var COMPILER_REVISION = 6; __exports__.COMPILER_REVISION = COMPILER_REVISION; var REVISION_CHANGES = { 1: '<= 1.0.rc.2', // 1.0.rc.2 is actually rev2 but doesn't report it 2: '== 1.0.0-rc.3', 3: '== 1.0.0-rc.4', - 4: '>= 1.0.0' + 4: '== 1.x.x', + 5: '== 2.0.0-alpha.x', + 6: '>= 2.0.0-beta.1' }; __exports__.REVISION_CHANGES = REVISION_CHANGES; var isArray = Utils.isArray, @@ -194,38 +216,44 @@ var __module2__ = (function(__dependency1__, __dependency2__) { logger: logger, log: log, - registerHelper: function(name, fn, inverse) { + registerHelper: function(name, fn) { if (toString.call(name) === objectType) { - if (inverse || fn) { throw new Exception('Arg not supported with multiple helpers'); } + if (fn) { throw new Exception('Arg not supported with multiple helpers'); } Utils.extend(this.helpers, name); } else { - if (inverse) { fn.not = inverse; } this.helpers[name] = fn; } }, + unregisterHelper: function(name) { + delete this.helpers[name]; + }, - registerPartial: function(name, str) { + registerPartial: function(name, partial) { if (toString.call(name) === objectType) { Utils.extend(this.partials, name); } else { - this.partials[name] = str; + this.partials[name] = partial; } + }, + unregisterPartial: function(name) { + delete this.partials[name]; } }; function registerDefaultHelpers(instance) { - instance.registerHelper('helperMissing', function(arg) { - if(arguments.length === 2) { + instance.registerHelper('helperMissing', function(/* [args, ]options */) { + if(arguments.length === 1) { + // A missing field in a {{foo}} constuct. return undefined; } else { - throw new Exception("Missing helper: '" + arg + "'"); + // Someone is actually trying to call something, blow up. + throw new Exception("Missing helper: '" + arguments[arguments.length-1].name + "'"); } }); instance.registerHelper('blockHelperMissing', function(context, options) { - var inverse = options.inverse || function() {}, fn = options.fn; - - if (isFunction(context)) { context = context.call(this); } + var inverse = options.inverse, + fn = options.fn; if(context === true) { return fn(this); @@ -233,19 +261,38 @@ var __module2__ = (function(__dependency1__, __dependency2__) { return inverse(this); } else if (isArray(context)) { if(context.length > 0) { + if (options.ids) { + options.ids = [options.name]; + } + return instance.helpers.each(context, options); } else { return inverse(this); } } else { - return fn(context); + if (options.data && options.ids) { + var data = createFrame(options.data); + data.contextPath = Utils.appendContextPath(options.data.contextPath, options.name); + options = {data: data}; + } + + return fn(context, options); } }); instance.registerHelper('each', function(context, options) { + if (!options) { + throw new Exception('Must pass iterator to #each'); + } + var fn = options.fn, inverse = options.inverse; var i = 0, ret = "", data; + var contextPath; + if (options.data && options.ids) { + contextPath = Utils.appendContextPath(options.data.contextPath, options.ids[0]) + '.'; + } + if (isFunction(context)) { context = context.call(this); } if (options.data) { @@ -259,16 +306,24 @@ var __module2__ = (function(__dependency1__, __dependency2__) { data.index = i; data.first = (i === 0); data.last = (i === (context.length-1)); + + if (contextPath) { + data.contextPath = contextPath + i; + } } ret = ret + fn(context[i], { data: data }); } } else { for(var key in context) { if(context.hasOwnProperty(key)) { - if(data) { - data.key = key; + if(data) { + data.key = key; data.index = i; data.first = (i === 0); + + if (contextPath) { + data.contextPath = contextPath + key; + } } ret = ret + fn(context[key], {data: data}); i++; @@ -304,12 +359,28 @@ var __module2__ = (function(__dependency1__, __dependency2__) { instance.registerHelper('with', function(context, options) { if (isFunction(context)) { context = context.call(this); } - if (!Utils.isEmpty(context)) return options.fn(context); + var fn = options.fn; + + if (!Utils.isEmpty(context)) { + if (options.data && options.ids) { + var data = createFrame(options.data); + data.contextPath = Utils.appendContextPath(options.data.contextPath, options.ids[0]); + options = {data:data}; + } + + return fn(context, options); + } else { + return options.inverse(this); + } }); - instance.registerHelper('log', function(context, options) { + instance.registerHelper('log', function(message, options) { var level = options.data && options.data.level != null ? parseInt(options.data.level, 10) : 1; - instance.log(level, context); + instance.log(level, message); + }); + + instance.registerHelper('lookup', function(obj, field) { + return obj && obj[field]; }); } @@ -324,22 +395,22 @@ var __module2__ = (function(__dependency1__, __dependency2__) { level: 3, // can be overridden in the host environment - log: function(level, obj) { + log: function(level, message) { if (logger.level <= level) { var method = logger.methodMap[level]; if (typeof console !== 'undefined' && console[method]) { - console[method].call(console, obj); + console[method].call(console, message); } } } }; __exports__.logger = logger; - function log(level, obj) { logger.log(level, obj); } - - __exports__.log = log;var createFrame = function(object) { - var obj = {}; - Utils.extend(obj, object); - return obj; + var log = logger.log; + __exports__.log = log; + var createFrame = function(object) { + var frame = Utils.extend({}, object); + frame._parent = object; + return frame; }; __exports__.createFrame = createFrame; return __exports__; @@ -353,6 +424,7 @@ var __module6__ = (function(__dependency1__, __dependency2__, __dependency3__) { var Exception = __dependency2__; var COMPILER_REVISION = __dependency3__.COMPILER_REVISION; var REVISION_CHANGES = __dependency3__.REVISION_CHANGES; + var createFrame = __dependency3__.createFrame; function checkRevision(compilerInfo) { var compilerRevision = compilerInfo && compilerInfo[0] || 1, @@ -375,20 +447,43 @@ var __module6__ = (function(__dependency1__, __dependency2__, __dependency3__) { __exports__.checkRevision = checkRevision;// TODO: Remove this line and break up compilePartial function template(templateSpec, env) { + /* istanbul ignore next */ if (!env) { throw new Exception("No environment passed to template"); } + if (!templateSpec || !templateSpec.main) { + throw new Exception('Unknown template object: ' + typeof templateSpec); + } // Note: Using env.VM references rather than local var references throughout this section to allow // for external users to override these as psuedo-supported APIs. - var invokePartialWrapper = function(partial, name, context, helpers, partials, data) { - var result = env.VM.invokePartial.apply(this, arguments); - if (result != null) { return result; } - - if (env.compile) { - var options = { helpers: helpers, partials: partials, data: data }; - partials[name] = env.compile(partial, { data: data !== undefined }, env); - return partials[name](context, options); + env.VM.checkRevision(templateSpec.compiler); + + var invokePartialWrapper = function(partial, indent, name, context, hash, helpers, partials, data, depths) { + if (hash) { + context = Utils.extend({}, context, hash); + } + + var result = env.VM.invokePartial.call(this, partial, name, context, helpers, partials, data, depths); + + if (result == null && env.compile) { + var options = { helpers: helpers, partials: partials, data: data, depths: depths }; + partials[name] = env.compile(partial, { data: data !== undefined, compat: templateSpec.compat }, env); + result = partials[name](context, options); + } + if (result != null) { + if (indent) { + var lines = result.split('\n'); + for (var i = 0, l = lines.length; i < l; i++) { + if (!lines[i] && i + 1 === l) { + break; + } + + lines[i] = indent + lines[i]; + } + result = lines.join('\n'); + } + return result; } else { throw new Exception("The partial " + name + " could not be compiled when running in runtime-only mode"); } @@ -396,84 +491,110 @@ var __module6__ = (function(__dependency1__, __dependency2__, __dependency3__) { // Just add water var container = { + lookup: function(depths, name) { + var len = depths.length; + for (var i = 0; i < len; i++) { + if (depths[i] && depths[i][name] != null) { + return depths[i][name]; + } + } + }, + lambda: function(current, context) { + return typeof current === 'function' ? current.call(context) : current; + }, + escapeExpression: Utils.escapeExpression, invokePartial: invokePartialWrapper, + + fn: function(i) { + return templateSpec[i]; + }, + programs: [], - program: function(i, fn, data) { - var programWrapper = this.programs[i]; - if(data) { - programWrapper = program(i, fn, data); + program: function(i, data, depths) { + var programWrapper = this.programs[i], + fn = this.fn(i); + if (data || depths) { + programWrapper = program(this, i, fn, data, depths); } else if (!programWrapper) { - programWrapper = this.programs[i] = program(i, fn); + programWrapper = this.programs[i] = program(this, i, fn); } return programWrapper; }, + + data: function(data, depth) { + while (data && depth--) { + data = data._parent; + } + return data; + }, merge: function(param, common) { var ret = param || common; if (param && common && (param !== common)) { - ret = {}; - Utils.extend(ret, common); - Utils.extend(ret, param); + ret = Utils.extend({}, common, param); } + return ret; }, - programWithDepth: env.VM.programWithDepth, + noop: env.VM.noop, - compilerInfo: null + compilerInfo: templateSpec.compiler }; - return function(context, options) { + var ret = function(context, options) { options = options || {}; - var namespace = options.partial ? options : env, - helpers, - partials; + var data = options.data; - if (!options.partial) { - helpers = options.helpers; - partials = options.partials; + ret._setup(options); + if (!options.partial && templateSpec.useData) { + data = initData(context, data); } - var result = templateSpec.call( - container, - namespace, context, - helpers, - partials, - options.data); - - if (!options.partial) { - env.VM.checkRevision(container.compilerInfo); + var depths; + if (templateSpec.useDepths) { + depths = options.depths ? [context].concat(options.depths) : [context]; } - return result; + return templateSpec.main.call(container, context, container.helpers, container.partials, data, depths); }; - } + ret.isTop = true; - __exports__.template = template;function programWithDepth(i, fn, data /*, $depth */) { - var args = Array.prototype.slice.call(arguments, 3); + ret._setup = function(options) { + if (!options.partial) { + container.helpers = container.merge(options.helpers, env.helpers); - var prog = function(context, options) { - options = options || {}; + if (templateSpec.usePartial) { + container.partials = container.merge(options.partials, env.partials); + } + } else { + container.helpers = options.helpers; + container.partials = options.partials; + } + }; - return fn.apply(this, [context, options.data || data].concat(args)); + ret._child = function(i, data, depths) { + if (templateSpec.useDepths && !depths) { + throw new Exception('must pass parent depths'); + } + + return program(container, i, templateSpec[i], data, depths); }; - prog.program = i; - prog.depth = args.length; - return prog; + return ret; } - __exports__.programWithDepth = programWithDepth;function program(i, fn, data) { + __exports__.template = template;function program(container, i, fn, data, depths) { var prog = function(context, options) { options = options || {}; - return fn(context, options.data || data); + return fn.call(container, context, container.helpers, container.partials, options.data || data, depths && [context].concat(depths)); }; prog.program = i; - prog.depth = 0; + prog.depth = depths ? depths.length : 0; return prog; } - __exports__.program = program;function invokePartial(partial, name, context, helpers, partials, data) { - var options = { partial: true, helpers: helpers, partials: partials, data: data }; + __exports__.program = program;function invokePartial(partial, name, context, helpers, partials, data, depths) { + var options = { partial: true, helpers: helpers, partials: partials, data: data, depths: depths }; if(partial === undefined) { throw new Exception("The partial " + name + " could not be found"); @@ -484,7 +605,13 @@ var __module6__ = (function(__dependency1__, __dependency2__, __dependency3__) { __exports__.invokePartial = invokePartial;function noop() { return ""; } - __exports__.noop = noop; + __exports__.noop = noop;function initData(context, data) { + if (!data || !('root' in data)) { + data = data ? createFrame(data) : {}; + data.root = context; + } + return data; + } return __exports__; })(__module3__, __module5__, __module2__); @@ -510,6 +637,7 @@ var __module1__ = (function(__dependency1__, __dependency2__, __dependency3__, _ hb.SafeString = SafeString; hb.Exception = Exception; hb.Utils = Utils; + hb.escapeExpression = Utils.escapeExpression; hb.VM = runtime; hb.template = function(spec) { @@ -522,6 +650,8 @@ var __module1__ = (function(__dependency1__, __dependency2__, __dependency3__, _ var Handlebars = create(); Handlebars.create = create; + Handlebars['default'] = Handlebars; + __exports__ = Handlebars; return __exports__; })(__module2__, __module4__, __module5__, __module3__, __module6__); @@ -532,7 +662,7 @@ var __module7__ = (function(__dependency1__) { var __exports__; var Exception = __dependency1__; - function LocationInfo(locInfo){ + function LocationInfo(locInfo) { locInfo = locInfo || {}; this.firstLine = locInfo.first_line; this.firstColumn = locInfo.first_column; @@ -541,38 +671,11 @@ var __module7__ = (function(__dependency1__) { } var AST = { - ProgramNode: function(statements, inverseStrip, inverse, locInfo) { - var inverseLocationInfo, firstInverseNode; - if (arguments.length === 3) { - locInfo = inverse; - inverse = null; - } else if (arguments.length === 2) { - locInfo = inverseStrip; - inverseStrip = null; - } - + ProgramNode: function(statements, strip, locInfo) { LocationInfo.call(this, locInfo); this.type = "program"; this.statements = statements; - this.strip = {}; - - if(inverse) { - firstInverseNode = inverse[0]; - if (firstInverseNode) { - inverseLocationInfo = { - first_line: firstInverseNode.firstLine, - last_line: firstInverseNode.lastLine, - last_column: firstInverseNode.lastColumn, - first_column: firstInverseNode.firstColumn - }; - this.inverse = new AST.ProgramNode(inverse, inverseStrip, inverseLocationInfo); - } else { - this.inverse = new AST.ProgramNode(inverse, inverseStrip); - } - this.strip.right = inverseStrip.left; - } else if (inverseStrip) { - this.strip.left = inverseStrip.right; - } + this.strip = strip; }, MustacheNode: function(rawParams, hash, open, strip, locInfo) { @@ -596,8 +699,6 @@ var __module7__ = (function(__dependency1__) { this.sexpr = new AST.SexprNode(rawParams, hash); } - this.sexpr.isRoot = true; - // Support old AST API that stored this info in MustacheNode this.id = this.sexpr.id; this.params = this.sexpr.params; @@ -615,57 +716,63 @@ var __module7__ = (function(__dependency1__) { var id = this.id = rawParams[0]; var params = this.params = rawParams.slice(1); - // a mustache is an eligible helper if: - // * its id is simple (a single part, not `this` or `..`) - var eligibleHelper = this.eligibleHelper = id.isSimple; - // a mustache is definitely a helper if: // * it is an eligible helper, and // * it has at least one parameter or hash segment - this.isHelper = eligibleHelper && (params.length || hash); + this.isHelper = !!(params.length || hash); + + // a mustache is an eligible helper if: + // * its id is simple (a single part, not `this` or `..`) + this.eligibleHelper = this.isHelper || id.isSimple; // if a mustache is an eligible helper but not a definite // helper, it is ambiguous, and will be resolved in a later // pass or at runtime. }, - PartialNode: function(partialName, context, strip, locInfo) { + PartialNode: function(partialName, context, hash, strip, locInfo) { LocationInfo.call(this, locInfo); this.type = "partial"; this.partialName = partialName; this.context = context; + this.hash = hash; this.strip = strip; + + this.strip.inlineStandalone = true; }, - BlockNode: function(mustache, program, inverse, close, locInfo) { + BlockNode: function(mustache, program, inverse, strip, locInfo) { LocationInfo.call(this, locInfo); - if(mustache.sexpr.id.original !== close.path.original) { - throw new Exception(mustache.sexpr.id.original + " doesn't match " + close.path.original, this); - } - this.type = 'block'; this.mustache = mustache; this.program = program; this.inverse = inverse; - - this.strip = { - left: mustache.strip.left, - right: close.strip.right - }; - - (program || inverse).strip.left = mustache.strip.right; - (inverse || program).strip.right = close.strip.left; + this.strip = strip; if (inverse && !program) { this.isInverse = true; } }, + RawBlockNode: function(mustache, content, close, locInfo) { + LocationInfo.call(this, locInfo); + + if (mustache.sexpr.id.original !== close) { + throw new Exception(mustache.sexpr.id.original + " doesn't match " + close, this); + } + + content = new AST.ContentNode(content, locInfo); + + this.type = 'block'; + this.mustache = mustache; + this.program = new AST.ProgramNode([content], {}, locInfo); + }, + ContentNode: function(string, locInfo) { LocationInfo.call(this, locInfo); this.type = "content"; - this.string = string; + this.original = this.string = string; }, HashNode: function(pairs, locInfo) { @@ -680,7 +787,8 @@ var __module7__ = (function(__dependency1__) { var original = "", dig = [], - depth = 0; + depth = 0, + depthString = ''; for(var i=0,l=parts.length; i)/,/^(?:\{\{(~)?#)/,/^(?:\{\{(~)?\/)/,/^(?:\{\{(~)?\^)/,/^(?:\{\{(~)?\s*else\b)/,/^(?:\{\{(~)?\{)/,/^(?:\{\{(~)?&)/,/^(?:\{\{!--)/,/^(?:\{\{![\s\S]*?\}\})/,/^(?:\{\{(~)?)/,/^(?:=)/,/^(?:\.\.)/,/^(?:\.(?=([=~}\s\/.)])))/,/^(?:[\/.])/,/^(?:\s+)/,/^(?:\}(~)?\}\})/,/^(?:(~)?\}\})/,/^(?:"(\\["]|[^"])*")/,/^(?:'(\\[']|[^'])*')/,/^(?:@)/,/^(?:true(?=([~}\s)])))/,/^(?:false(?=([~}\s)])))/,/^(?:-?[0-9]+(?=([~}\s)])))/,/^(?:([^\s!"#%-,\.\/;->@\[-\^`\{-~]+(?=([=~}\s\/.)]))))/,/^(?:\[[^\]]*\])/,/^(?:.)/,/^(?:$)/]; - 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,31,32],"inclusive":false},"emu":{"rules":[2],"inclusive":false},"com":{"rules":[3],"inclusive":false},"INITIAL":{"rules":[0,1,32],"inclusive":true}}; + lexer.rules = [/^(?:[^\x00]*?(?=(\{\{)))/,/^(?:[^\x00]+)/,/^(?:[^\x00]{2,}?(?=(\{\{|\\\{\{|\\\\\{\{|$)))/,/^(?:\{\{\{\{\/[^\s!"#%-,\.\/;->@\[-\^`\{-~]+(?=[=}\s\/.])\}\}\}\})/,/^(?:[^\x00]*?(?=(\{\{\{\{\/)))/,/^(?:[\s\S]*?--\}\})/,/^(?:\()/,/^(?:\))/,/^(?:\{\{\{\{)/,/^(?:\}\}\}\})/,/^(?:\{\{(~)?>)/,/^(?:\{\{(~)?#)/,/^(?:\{\{(~)?\/)/,/^(?:\{\{(~)?\^\s*(~)?\}\})/,/^(?:\{\{(~)?\s*else\s*(~)?\}\})/,/^(?:\{\{(~)?\^)/,/^(?:\{\{(~)?\s*else\b)/,/^(?:\{\{(~)?\{)/,/^(?:\{\{(~)?&)/,/^(?:\{\{!--)/,/^(?:\{\{![\s\S]*?\}\})/,/^(?:\{\{(~)?)/,/^(?:=)/,/^(?:\.\.)/,/^(?:\.(?=([=~}\s\/.)])))/,/^(?:[\/.])/,/^(?:\s+)/,/^(?:\}(~)?\}\})/,/^(?:(~)?\}\})/,/^(?:"(\\["]|[^"])*")/,/^(?:'(\\[']|[^'])*')/,/^(?:@)/,/^(?:true(?=([~}\s)])))/,/^(?:false(?=([~}\s)])))/,/^(?:-?[0-9]+(?:\.[0-9]+)?(?=([~}\s)])))/,/^(?:([^\s!"#%-,\.\/;->@\[-\^`\{-~]+(?=([=~}\s\/.)]))))/,/^(?:\[[^\]]*\])/,/^(?:.)/,/^(?:$)/]; + lexer.conditions = {"mu":{"rules":[6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38],"inclusive":false},"emu":{"rules":[2],"inclusive":false},"com":{"rules":[5],"inclusive":false},"raw":{"rules":[3,4],"inclusive":false},"INITIAL":{"rules":[0,1,38],"inclusive":true}}; return lexer;})() parser.lexer = lexer; function Parser () { this.yy = {}; }Parser.prototype = parser;parser.Parser = Parser; @@ -1255,32 +1382,234 @@ var __module9__ = (function() { return __exports__; })(); +// handlebars/compiler/helpers.js +var __module10__ = (function(__dependency1__) { + "use strict"; + var __exports__ = {}; + var Exception = __dependency1__; + + function stripFlags(open, close) { + return { + left: open.charAt(2) === '~', + right: close.charAt(close.length-3) === '~' + }; + } + + __exports__.stripFlags = stripFlags; + function prepareBlock(mustache, program, inverseAndProgram, close, inverted, locInfo) { + /*jshint -W040 */ + if (mustache.sexpr.id.original !== close.path.original) { + throw new Exception(mustache.sexpr.id.original + ' doesn\'t match ' + close.path.original, mustache); + } + + var inverse = inverseAndProgram && inverseAndProgram.program; + + var strip = { + left: mustache.strip.left, + right: close.strip.right, + + // Determine the standalone candiacy. Basically flag our content as being possibly standalone + // so our parent can determine if we actually are standalone + openStandalone: isNextWhitespace(program.statements), + closeStandalone: isPrevWhitespace((inverse || program).statements) + }; + + if (mustache.strip.right) { + omitRight(program.statements, null, true); + } + + if (inverse) { + var inverseStrip = inverseAndProgram.strip; + + if (inverseStrip.left) { + omitLeft(program.statements, null, true); + } + if (inverseStrip.right) { + omitRight(inverse.statements, null, true); + } + if (close.strip.left) { + omitLeft(inverse.statements, null, true); + } + + // Find standalone else statments + if (isPrevWhitespace(program.statements) + && isNextWhitespace(inverse.statements)) { + + omitLeft(program.statements); + omitRight(inverse.statements); + } + } else { + if (close.strip.left) { + omitLeft(program.statements, null, true); + } + } + + if (inverted) { + return new this.BlockNode(mustache, inverse, program, strip, locInfo); + } else { + return new this.BlockNode(mustache, program, inverse, strip, locInfo); + } + } + + __exports__.prepareBlock = prepareBlock; + function prepareProgram(statements, isRoot) { + for (var i = 0, l = statements.length; i < l; i++) { + var current = statements[i], + strip = current.strip; + + if (!strip) { + continue; + } + + var _isPrevWhitespace = isPrevWhitespace(statements, i, isRoot, current.type === 'partial'), + _isNextWhitespace = isNextWhitespace(statements, i, isRoot), + + openStandalone = strip.openStandalone && _isPrevWhitespace, + closeStandalone = strip.closeStandalone && _isNextWhitespace, + inlineStandalone = strip.inlineStandalone && _isPrevWhitespace && _isNextWhitespace; + + if (strip.right) { + omitRight(statements, i, true); + } + if (strip.left) { + omitLeft(statements, i, true); + } + + if (inlineStandalone) { + omitRight(statements, i); + + if (omitLeft(statements, i)) { + // If we are on a standalone node, save the indent info for partials + if (current.type === 'partial') { + current.indent = (/([ \t]+$)/).exec(statements[i-1].original) ? RegExp.$1 : ''; + } + } + } + if (openStandalone) { + omitRight((current.program || current.inverse).statements); + + // Strip out the previous content node if it's whitespace only + omitLeft(statements, i); + } + if (closeStandalone) { + // Always strip the next node + omitRight(statements, i); + + omitLeft((current.inverse || current.program).statements); + } + } + + return statements; + } + + __exports__.prepareProgram = prepareProgram;function isPrevWhitespace(statements, i, isRoot) { + if (i === undefined) { + i = statements.length; + } + + // Nodes that end with newlines are considered whitespace (but are special + // cased for strip operations) + var prev = statements[i-1], + sibling = statements[i-2]; + if (!prev) { + return isRoot; + } + + if (prev.type === 'content') { + return (sibling || !isRoot ? (/\r?\n\s*?$/) : (/(^|\r?\n)\s*?$/)).test(prev.original); + } + } + function isNextWhitespace(statements, i, isRoot) { + if (i === undefined) { + i = -1; + } + + var next = statements[i+1], + sibling = statements[i+2]; + if (!next) { + return isRoot; + } + + if (next.type === 'content') { + return (sibling || !isRoot ? (/^\s*?\r?\n/) : (/^\s*?(\r?\n|$)/)).test(next.original); + } + } + + // Marks the node to the right of the position as omitted. + // I.e. {{foo}}' ' will mark the ' ' node as omitted. + // + // If i is undefined, then the first child will be marked as such. + // + // If mulitple is truthy then all whitespace will be stripped out until non-whitespace + // content is met. + function omitRight(statements, i, multiple) { + var current = statements[i == null ? 0 : i + 1]; + if (!current || current.type !== 'content' || (!multiple && current.rightStripped)) { + return; + } + + var original = current.string; + current.string = current.string.replace(multiple ? (/^\s+/) : (/^[ \t]*\r?\n?/), ''); + current.rightStripped = current.string !== original; + } + + // Marks the node to the left of the position as omitted. + // I.e. ' '{{foo}} will mark the ' ' node as omitted. + // + // If i is undefined then the last child will be marked as such. + // + // If mulitple is truthy then all whitespace will be stripped out until non-whitespace + // content is met. + function omitLeft(statements, i, multiple) { + var current = statements[i == null ? statements.length - 1 : i - 1]; + if (!current || current.type !== 'content' || (!multiple && current.leftStripped)) { + return; + } + + // We omit the last node if it's whitespace only and not preceeded by a non-content node. + var original = current.string; + current.string = current.string.replace(multiple ? (/\s+$/) : (/[ \t]+$/), ''); + current.leftStripped = current.string !== original; + return current.leftStripped; + } + return __exports__; +})(__module5__); + // handlebars/compiler/base.js -var __module8__ = (function(__dependency1__, __dependency2__) { +var __module8__ = (function(__dependency1__, __dependency2__, __dependency3__, __dependency4__) { "use strict"; var __exports__ = {}; var parser = __dependency1__; var AST = __dependency2__; + var Helpers = __dependency3__; + var extend = __dependency4__.extend; __exports__.parser = parser; + var yy = {}; + extend(yy, Helpers, AST); + function parse(input) { // Just return if an already-compile AST was passed in. - if(input.constructor === AST.ProgramNode) { return input; } + if (input.constructor === AST.ProgramNode) { return input; } + + parser.yy = yy; - parser.yy = AST; return parser.parse(input); } __exports__.parse = parse; return __exports__; -})(__module9__, __module7__); +})(__module9__, __module7__, __module10__, __module3__); // handlebars/compiler/compiler.js -var __module10__ = (function(__dependency1__) { +var __module11__ = (function(__dependency1__, __dependency2__) { "use strict"; var __exports__ = {}; var Exception = __dependency1__; + var isArray = __dependency2__.isArray; + + var slice = [].slice; function Compiler() {} @@ -1292,30 +1621,6 @@ var __module10__ = (function(__dependency1__) { Compiler.prototype = { compiler: Compiler, - disassemble: function() { - var opcodes = this.opcodes, opcode, out = [], params, param; - - for (var i=0, l=opcodes.length; i 0) { - this.source[1] = this.source[1] + ", " + locals.join(", "); + varDeclarations += ", " + locals.join(", "); } // Generate minimizer alias mappings - if (!this.isChild) { - for (var alias in this.context.aliases) { - if (this.context.aliases.hasOwnProperty(alias)) { - this.source[1] = this.source[1] + ', ' + alias + '=' + this.context.aliases[alias]; - } + for (var alias in this.aliases) { + if (this.aliases.hasOwnProperty(alias)) { + varDeclarations += ', ' + alias + '=' + this.aliases[alias]; } } - if (this.source[1]) { - this.source[1] = "var " + this.source[1].substring(2) + ";"; - } - - // Merge children - if (!this.isChild) { - this.source[1] += '\n' + this.context.programs.join('\n') + '\n'; - } + var params = ["depth0", "helpers", "partials", "data"]; - if (!this.environment.isSimple) { - this.pushSource("return buffer;"); - } - - var params = this.isChild ? ["depth0", "data"] : ["Handlebars", "depth0", "helpers", "partials", "data"]; - - for(var i=0, l=this.environment.depths.list.length; i"'`]/; function escapeChar(chr) { - return escape[chr] || "&"; + return escape[chr]; } - function extend(obj, value) { - for(var key in value) { - if(Object.prototype.hasOwnProperty.call(value, key)) { - obj[key] = value[key]; + function extend(obj /* , ...source */) { + for (var i = 1; i < arguments.length; i++) { + for (var key in arguments[i]) { + if (Object.prototype.hasOwnProperty.call(arguments[i], key)) { + obj[key] = arguments[i][key]; + } } } + + return obj; } __exports__.extend = extend;var toString = Object.prototype.toString; @@ -82,6 +94,7 @@ var __module2__ = (function(__dependency1__) { return typeof value === 'function'; }; // fallback for older versions of Chrome and Safari + /* istanbul ignore next */ if (isFunction(/x/)) { isFunction = function(value) { return typeof value === 'function' && toString.call(value) === '[object Function]'; @@ -89,6 +102,7 @@ var __module2__ = (function(__dependency1__) { } var isFunction; __exports__.isFunction = isFunction; + /* istanbul ignore next */ var isArray = Array.isArray || function(value) { return (value && typeof value === 'object') ? toString.call(value) === '[object Array]' : false; }; @@ -98,8 +112,10 @@ var __module2__ = (function(__dependency1__) { // don't escape SafeStrings, since they're already safe if (string instanceof SafeString) { return string.toString(); - } else if (!string && string !== 0) { + } else if (string == null) { return ""; + } else if (!string) { + return string + ''; } // Force a string conversion as this will be done by the append regardless and @@ -121,7 +137,11 @@ var __module2__ = (function(__dependency1__) { } } - __exports__.isEmpty = isEmpty; + __exports__.isEmpty = isEmpty;function appendContextPath(contextPath, id) { + return (contextPath ? contextPath + '.' : '') + id; + } + + __exports__.appendContextPath = appendContextPath; return __exports__; })(__module3__); @@ -166,14 +186,16 @@ var __module1__ = (function(__dependency1__, __dependency2__) { var Utils = __dependency1__; var Exception = __dependency2__; - var VERSION = "1.3.0"; - __exports__.VERSION = VERSION;var COMPILER_REVISION = 4; + var VERSION = "2.0.0"; + __exports__.VERSION = VERSION;var COMPILER_REVISION = 6; __exports__.COMPILER_REVISION = COMPILER_REVISION; var REVISION_CHANGES = { 1: '<= 1.0.rc.2', // 1.0.rc.2 is actually rev2 but doesn't report it 2: '== 1.0.0-rc.3', 3: '== 1.0.0-rc.4', - 4: '>= 1.0.0' + 4: '== 1.x.x', + 5: '== 2.0.0-alpha.x', + 6: '>= 2.0.0-beta.1' }; __exports__.REVISION_CHANGES = REVISION_CHANGES; var isArray = Utils.isArray, @@ -194,38 +216,44 @@ var __module1__ = (function(__dependency1__, __dependency2__) { logger: logger, log: log, - registerHelper: function(name, fn, inverse) { + registerHelper: function(name, fn) { if (toString.call(name) === objectType) { - if (inverse || fn) { throw new Exception('Arg not supported with multiple helpers'); } + if (fn) { throw new Exception('Arg not supported with multiple helpers'); } Utils.extend(this.helpers, name); } else { - if (inverse) { fn.not = inverse; } this.helpers[name] = fn; } }, + unregisterHelper: function(name) { + delete this.helpers[name]; + }, - registerPartial: function(name, str) { + registerPartial: function(name, partial) { if (toString.call(name) === objectType) { Utils.extend(this.partials, name); } else { - this.partials[name] = str; + this.partials[name] = partial; } + }, + unregisterPartial: function(name) { + delete this.partials[name]; } }; function registerDefaultHelpers(instance) { - instance.registerHelper('helperMissing', function(arg) { - if(arguments.length === 2) { + instance.registerHelper('helperMissing', function(/* [args, ]options */) { + if(arguments.length === 1) { + // A missing field in a {{foo}} constuct. return undefined; } else { - throw new Exception("Missing helper: '" + arg + "'"); + // Someone is actually trying to call something, blow up. + throw new Exception("Missing helper: '" + arguments[arguments.length-1].name + "'"); } }); instance.registerHelper('blockHelperMissing', function(context, options) { - var inverse = options.inverse || function() {}, fn = options.fn; - - if (isFunction(context)) { context = context.call(this); } + var inverse = options.inverse, + fn = options.fn; if(context === true) { return fn(this); @@ -233,19 +261,38 @@ var __module1__ = (function(__dependency1__, __dependency2__) { return inverse(this); } else if (isArray(context)) { if(context.length > 0) { + if (options.ids) { + options.ids = [options.name]; + } + return instance.helpers.each(context, options); } else { return inverse(this); } } else { - return fn(context); + if (options.data && options.ids) { + var data = createFrame(options.data); + data.contextPath = Utils.appendContextPath(options.data.contextPath, options.name); + options = {data: data}; + } + + return fn(context, options); } }); instance.registerHelper('each', function(context, options) { + if (!options) { + throw new Exception('Must pass iterator to #each'); + } + var fn = options.fn, inverse = options.inverse; var i = 0, ret = "", data; + var contextPath; + if (options.data && options.ids) { + contextPath = Utils.appendContextPath(options.data.contextPath, options.ids[0]) + '.'; + } + if (isFunction(context)) { context = context.call(this); } if (options.data) { @@ -259,16 +306,24 @@ var __module1__ = (function(__dependency1__, __dependency2__) { data.index = i; data.first = (i === 0); data.last = (i === (context.length-1)); + + if (contextPath) { + data.contextPath = contextPath + i; + } } ret = ret + fn(context[i], { data: data }); } } else { for(var key in context) { if(context.hasOwnProperty(key)) { - if(data) { - data.key = key; + if(data) { + data.key = key; data.index = i; data.first = (i === 0); + + if (contextPath) { + data.contextPath = contextPath + key; + } } ret = ret + fn(context[key], {data: data}); i++; @@ -304,12 +359,28 @@ var __module1__ = (function(__dependency1__, __dependency2__) { instance.registerHelper('with', function(context, options) { if (isFunction(context)) { context = context.call(this); } - if (!Utils.isEmpty(context)) return options.fn(context); + var fn = options.fn; + + if (!Utils.isEmpty(context)) { + if (options.data && options.ids) { + var data = createFrame(options.data); + data.contextPath = Utils.appendContextPath(options.data.contextPath, options.ids[0]); + options = {data:data}; + } + + return fn(context, options); + } else { + return options.inverse(this); + } }); - instance.registerHelper('log', function(context, options) { + instance.registerHelper('log', function(message, options) { var level = options.data && options.data.level != null ? parseInt(options.data.level, 10) : 1; - instance.log(level, context); + instance.log(level, message); + }); + + instance.registerHelper('lookup', function(obj, field) { + return obj && obj[field]; }); } @@ -324,22 +395,22 @@ var __module1__ = (function(__dependency1__, __dependency2__) { level: 3, // can be overridden in the host environment - log: function(level, obj) { + log: function(level, message) { if (logger.level <= level) { var method = logger.methodMap[level]; if (typeof console !== 'undefined' && console[method]) { - console[method].call(console, obj); + console[method].call(console, message); } } } }; __exports__.logger = logger; - function log(level, obj) { logger.log(level, obj); } - - __exports__.log = log;var createFrame = function(object) { - var obj = {}; - Utils.extend(obj, object); - return obj; + var log = logger.log; + __exports__.log = log; + var createFrame = function(object) { + var frame = Utils.extend({}, object); + frame._parent = object; + return frame; }; __exports__.createFrame = createFrame; return __exports__; @@ -353,6 +424,7 @@ var __module5__ = (function(__dependency1__, __dependency2__, __dependency3__) { var Exception = __dependency2__; var COMPILER_REVISION = __dependency3__.COMPILER_REVISION; var REVISION_CHANGES = __dependency3__.REVISION_CHANGES; + var createFrame = __dependency3__.createFrame; function checkRevision(compilerInfo) { var compilerRevision = compilerInfo && compilerInfo[0] || 1, @@ -375,20 +447,43 @@ var __module5__ = (function(__dependency1__, __dependency2__, __dependency3__) { __exports__.checkRevision = checkRevision;// TODO: Remove this line and break up compilePartial function template(templateSpec, env) { + /* istanbul ignore next */ if (!env) { throw new Exception("No environment passed to template"); } + if (!templateSpec || !templateSpec.main) { + throw new Exception('Unknown template object: ' + typeof templateSpec); + } // Note: Using env.VM references rather than local var references throughout this section to allow // for external users to override these as psuedo-supported APIs. - var invokePartialWrapper = function(partial, name, context, helpers, partials, data) { - var result = env.VM.invokePartial.apply(this, arguments); - if (result != null) { return result; } - - if (env.compile) { - var options = { helpers: helpers, partials: partials, data: data }; - partials[name] = env.compile(partial, { data: data !== undefined }, env); - return partials[name](context, options); + env.VM.checkRevision(templateSpec.compiler); + + var invokePartialWrapper = function(partial, indent, name, context, hash, helpers, partials, data, depths) { + if (hash) { + context = Utils.extend({}, context, hash); + } + + var result = env.VM.invokePartial.call(this, partial, name, context, helpers, partials, data, depths); + + if (result == null && env.compile) { + var options = { helpers: helpers, partials: partials, data: data, depths: depths }; + partials[name] = env.compile(partial, { data: data !== undefined, compat: templateSpec.compat }, env); + result = partials[name](context, options); + } + if (result != null) { + if (indent) { + var lines = result.split('\n'); + for (var i = 0, l = lines.length; i < l; i++) { + if (!lines[i] && i + 1 === l) { + break; + } + + lines[i] = indent + lines[i]; + } + result = lines.join('\n'); + } + return result; } else { throw new Exception("The partial " + name + " could not be compiled when running in runtime-only mode"); } @@ -396,84 +491,110 @@ var __module5__ = (function(__dependency1__, __dependency2__, __dependency3__) { // Just add water var container = { + lookup: function(depths, name) { + var len = depths.length; + for (var i = 0; i < len; i++) { + if (depths[i] && depths[i][name] != null) { + return depths[i][name]; + } + } + }, + lambda: function(current, context) { + return typeof current === 'function' ? current.call(context) : current; + }, + escapeExpression: Utils.escapeExpression, invokePartial: invokePartialWrapper, + + fn: function(i) { + return templateSpec[i]; + }, + programs: [], - program: function(i, fn, data) { - var programWrapper = this.programs[i]; - if(data) { - programWrapper = program(i, fn, data); + program: function(i, data, depths) { + var programWrapper = this.programs[i], + fn = this.fn(i); + if (data || depths) { + programWrapper = program(this, i, fn, data, depths); } else if (!programWrapper) { - programWrapper = this.programs[i] = program(i, fn); + programWrapper = this.programs[i] = program(this, i, fn); } return programWrapper; }, + + data: function(data, depth) { + while (data && depth--) { + data = data._parent; + } + return data; + }, merge: function(param, common) { var ret = param || common; if (param && common && (param !== common)) { - ret = {}; - Utils.extend(ret, common); - Utils.extend(ret, param); + ret = Utils.extend({}, common, param); } + return ret; }, - programWithDepth: env.VM.programWithDepth, + noop: env.VM.noop, - compilerInfo: null + compilerInfo: templateSpec.compiler }; - return function(context, options) { + var ret = function(context, options) { options = options || {}; - var namespace = options.partial ? options : env, - helpers, - partials; + var data = options.data; - if (!options.partial) { - helpers = options.helpers; - partials = options.partials; + ret._setup(options); + if (!options.partial && templateSpec.useData) { + data = initData(context, data); } - var result = templateSpec.call( - container, - namespace, context, - helpers, - partials, - options.data); - - if (!options.partial) { - env.VM.checkRevision(container.compilerInfo); + var depths; + if (templateSpec.useDepths) { + depths = options.depths ? [context].concat(options.depths) : [context]; } - return result; + return templateSpec.main.call(container, context, container.helpers, container.partials, data, depths); }; - } + ret.isTop = true; - __exports__.template = template;function programWithDepth(i, fn, data /*, $depth */) { - var args = Array.prototype.slice.call(arguments, 3); + ret._setup = function(options) { + if (!options.partial) { + container.helpers = container.merge(options.helpers, env.helpers); - var prog = function(context, options) { - options = options || {}; + if (templateSpec.usePartial) { + container.partials = container.merge(options.partials, env.partials); + } + } else { + container.helpers = options.helpers; + container.partials = options.partials; + } + }; + + ret._child = function(i, data, depths) { + if (templateSpec.useDepths && !depths) { + throw new Exception('must pass parent depths'); + } - return fn.apply(this, [context, options.data || data].concat(args)); + return program(container, i, templateSpec[i], data, depths); }; - prog.program = i; - prog.depth = args.length; - return prog; + return ret; } - __exports__.programWithDepth = programWithDepth;function program(i, fn, data) { + __exports__.template = template;function program(container, i, fn, data, depths) { var prog = function(context, options) { options = options || {}; - return fn(context, options.data || data); + return fn.call(container, context, container.helpers, container.partials, options.data || data, depths && [context].concat(depths)); }; prog.program = i; - prog.depth = 0; + prog.depth = depths ? depths.length : 0; return prog; } - __exports__.program = program;function invokePartial(partial, name, context, helpers, partials, data) { - var options = { partial: true, helpers: helpers, partials: partials, data: data }; + __exports__.program = program;function invokePartial(partial, name, context, helpers, partials, data, depths) { + var options = { partial: true, helpers: helpers, partials: partials, data: data, depths: depths }; if(partial === undefined) { throw new Exception("The partial " + name + " could not be found"); @@ -484,7 +605,13 @@ var __module5__ = (function(__dependency1__, __dependency2__, __dependency3__) { __exports__.invokePartial = invokePartial;function noop() { return ""; } - __exports__.noop = noop; + __exports__.noop = noop;function initData(context, data) { + if (!data || !('root' in data)) { + data = data ? createFrame(data) : {}; + data.root = context; + } + return data; + } return __exports__; })(__module2__, __module4__, __module1__); @@ -510,6 +637,7 @@ var __module0__ = (function(__dependency1__, __dependency2__, __dependency3__, _ hb.SafeString = SafeString; hb.Exception = Exception; hb.Utils = Utils; + hb.escapeExpression = Utils.escapeExpression; hb.VM = runtime; hb.template = function(spec) { @@ -522,9 +650,11 @@ var __module0__ = (function(__dependency1__, __dependency2__, __dependency3__, _ var Handlebars = create(); Handlebars.create = create; + Handlebars['default'] = Handlebars; + __exports__ = Handlebars; return __exports__; })(__module1__, __module3__, __module4__, __module2__, __module5__); return __module0__; -})(); +})); From 2b90c53887184e14dea531181e732425c828c9da Mon Sep 17 00:00:00 2001 From: Alex Riedler Date: Mon, 8 Sep 2014 18:44:46 -0400 Subject: [PATCH 19/81] Release v0.18 --- CHANGELOG.md | 4 ++++ lib/handlebars_assets/version.rb | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d0e5682..1e61461 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.18 (2014-09-08) + +* Update to handlebars v2.0.0 - @AlexRiedler + ## 0.17.2 (2014-09-08) * Support for Ruby v1.8 - @blainekasten diff --git a/lib/handlebars_assets/version.rb b/lib/handlebars_assets/version.rb index a74f04a..aef986f 100644 --- a/lib/handlebars_assets/version.rb +++ b/lib/handlebars_assets/version.rb @@ -1,3 +1,3 @@ module HandlebarsAssets - VERSION = "0.17.2" + VERSION = "0.18" end From 70e3bac7da5db11b12e9070ef5d7eab706997a50 Mon Sep 17 00:00:00 2001 From: Alex Riedler Date: Mon, 8 Sep 2014 18:47:44 -0400 Subject: [PATCH 20/81] Add Licenses and Homepage to gemspec. --- handlebars_assets.gemspec | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/handlebars_assets.gemspec b/handlebars_assets.gemspec index df97c18..4f7dee6 100644 --- a/handlebars_assets.gemspec +++ b/handlebars_assets.gemspec @@ -6,8 +6,9 @@ Gem::Specification.new do |s| s.name = "handlebars_assets" s.version = HandlebarsAssets::VERSION s.authors = ["Les Hill"] + s.licenses = ["MIT"] s.email = ["leshill@gmail.com"] - s.homepage = "" + s.homepage = "https://github.com/leshill/handlebars_assets" s.summary = "Compile Handlebars templates in the Rails asset pipeline." s.description = "Compile Handlebars templates in the Rails asset pipeline." From b09f1e3da004f91cc7db406c43e8fae486e9e382 Mon Sep 17 00:00:00 2001 From: David Graham Date: Sat, 18 Oct 2014 11:45:09 -0600 Subject: [PATCH 21/81] Register extension on Sprockets. The `app.assets` instance is `nil` in Rails 4.1. --- lib/handlebars_assets/engine.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/handlebars_assets/engine.rb b/lib/handlebars_assets/engine.rb index 2a6c8a5..d95a105 100644 --- a/lib/handlebars_assets/engine.rb +++ b/lib/handlebars_assets/engine.rb @@ -2,7 +2,7 @@ module HandlebarsAssets # NOTE: must be an engine because we are including assets in the gem class Engine < ::Rails::Engine initializer "handlebars_assets.assets.register", :group => :all do |app| - ::HandlebarsAssets::register_extensions(app.assets) + ::HandlebarsAssets::register_extensions(Sprockets) end end end From 6fcb5fb5bf0cb6d5beef7352eaa2a2e546db33dd Mon Sep 17 00:00:00 2001 From: David Graham Date: Sat, 18 Oct 2014 11:48:09 -0600 Subject: [PATCH 22/81] Extensions must begin with a period separator. Rails 4.1 can't locate the .hbs files without the separator. --- lib/handlebars_assets/config.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/handlebars_assets/config.rb b/lib/handlebars_assets/config.rb index 9a54aa0..79b5c10 100644 --- a/lib/handlebars_assets/config.rb +++ b/lib/handlebars_assets/config.rb @@ -94,19 +94,19 @@ def template_namespace end def handlebars_extensions - @hbs_extensions ||= ['hbs', 'handlebars'] + @hbs_extensions ||= ['.hbs', '.handlebars'] end def hamlbars_extensions - @hamlbars_extensions ||= ['hamlbars'] + @hamlbars_extensions ||= ['.hamlbars'] end def slimbars_extensions - @slimbars_extensions ||= ['slimbars'] + @slimbars_extensions ||= ['.slimbars'] end def ember_extensions - @ember_extensions ||= ['ember'] + @ember_extensions ||= ['.ember'] end def amd? From 59771ba02cc0221d54c26136f35cd577fbe91465 Mon Sep 17 00:00:00 2001 From: Alex Riedler Date: Wed, 18 Feb 2015 08:41:16 -0500 Subject: [PATCH 23/81] Add the handlebars asset version to the sprockets versioning path. Fixes #110 --- lib/handlebars_assets.rb | 4 ++++ lib/handlebars_assets/engine.rb | 1 + 2 files changed, 5 insertions(+) diff --git a/lib/handlebars_assets.rb b/lib/handlebars_assets.rb index 4bd9791..5580e21 100644 --- a/lib/handlebars_assets.rb +++ b/lib/handlebars_assets.rb @@ -31,6 +31,10 @@ def self.register_extensions(sprockets_environment) end end + def self.add_to_asset_versioning(sprockets_environment) + sprockets_environment.config.version += "-#{HandlebarsAssets::VERSION}" + end + end # Register the engine (which will register extension in the app) diff --git a/lib/handlebars_assets/engine.rb b/lib/handlebars_assets/engine.rb index d95a105..f875dfd 100644 --- a/lib/handlebars_assets/engine.rb +++ b/lib/handlebars_assets/engine.rb @@ -3,6 +3,7 @@ module HandlebarsAssets class Engine < ::Rails::Engine initializer "handlebars_assets.assets.register", :group => :all do |app| ::HandlebarsAssets::register_extensions(Sprockets) + ::HandlebarsAssets::add_to_asset_versioning(Sprockets) end end end From 72575e25c9b7d13beedae4f006326466fb896b4f Mon Sep 17 00:00:00 2001 From: Alex Riedler Date: Wed, 18 Feb 2015 08:42:39 -0500 Subject: [PATCH 24/81] Release v0.18.1 --- CHANGELOG.md | 4 ++++ lib/handlebars_assets/version.rb | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1e61461..fc18ba5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.18.1 (2015-02-18) + +* Fix issue regarding sprockets versioning of assets + ## 0.18 (2014-09-08) * Update to handlebars v2.0.0 - @AlexRiedler diff --git a/lib/handlebars_assets/version.rb b/lib/handlebars_assets/version.rb index aef986f..e198298 100644 --- a/lib/handlebars_assets/version.rb +++ b/lib/handlebars_assets/version.rb @@ -1,3 +1,3 @@ module HandlebarsAssets - VERSION = "0.18" + VERSION = "0.18.1" end From 6d6f196df7a7d7d404b532b688423d1a443dc4b5 Mon Sep 17 00:00:00 2001 From: Alex Riedler Date: Wed, 18 Feb 2015 08:50:19 -0500 Subject: [PATCH 25/81] Update minitest to latest. --- handlebars_assets.gemspec | 2 +- test/handlebars_assets/compiling_test.rb | 2 +- test/handlebars_assets/hamlbars_test.rb | 2 +- test/handlebars_assets/slimbars_test.rb | 2 +- test/handlebars_assets/tilt_handlebars_test.rb | 2 +- test/test_helper.rb | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/handlebars_assets.gemspec b/handlebars_assets.gemspec index 4f7dee6..ec2f14e 100644 --- a/handlebars_assets.gemspec +++ b/handlebars_assets.gemspec @@ -24,7 +24,7 @@ Gem::Specification.new do |s| s.add_runtime_dependency "multi_json" s.add_runtime_dependency "sprockets", ">= 2.0.3" - s.add_development_dependency "debugger" + s.add_development_dependency "minitest" s.add_development_dependency "haml" s.add_development_dependency "rake" s.add_development_dependency "slim" diff --git a/test/handlebars_assets/compiling_test.rb b/test/handlebars_assets/compiling_test.rb index e627969..e3dc992 100644 --- a/test/handlebars_assets/compiling_test.rb +++ b/test/handlebars_assets/compiling_test.rb @@ -1,7 +1,7 @@ require 'test_helper' module HandlebarsAssets - class CompilingTest < Test::Unit::TestCase + class CompilingTest < ::MiniTest::Test def teardown HandlebarsAssets::Config.reset! diff --git a/test/handlebars_assets/hamlbars_test.rb b/test/handlebars_assets/hamlbars_test.rb index 8a51e6e..7afce25 100644 --- a/test/handlebars_assets/hamlbars_test.rb +++ b/test/handlebars_assets/hamlbars_test.rb @@ -1,7 +1,7 @@ require 'test_helper' module HandlebarsAssets - class HamlbarsTest < Test::Unit::TestCase + class HamlbarsTest < ::Minitest::Test include SprocketsScope include CompilerSupport diff --git a/test/handlebars_assets/slimbars_test.rb b/test/handlebars_assets/slimbars_test.rb index 222bdb5..f162d81 100644 --- a/test/handlebars_assets/slimbars_test.rb +++ b/test/handlebars_assets/slimbars_test.rb @@ -1,7 +1,7 @@ require 'test_helper' module HandlebarsAssets - class SlimbarsTest < Test::Unit::TestCase + class SlimbarsTest < ::Minitest::Test include SprocketsScope include CompilerSupport diff --git a/test/handlebars_assets/tilt_handlebars_test.rb b/test/handlebars_assets/tilt_handlebars_test.rb index 6a76142..d03ec0d 100644 --- a/test/handlebars_assets/tilt_handlebars_test.rb +++ b/test/handlebars_assets/tilt_handlebars_test.rb @@ -1,7 +1,7 @@ require 'test_helper' module HandlebarsAssets - class HandlebarsTemplateTest < Test::Unit::TestCase + class HandlebarsTemplateTest < Minitest::Test include CompilerSupport include SprocketsScope diff --git a/test/test_helper.rb b/test/test_helper.rb index 3ce8e7f..846f327 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -3,7 +3,7 @@ require 'handlebars_assets/handlebars_template' require 'handlebars_assets/handlebars' -require 'test/unit' +require 'minitest/autorun' module SprocketsScope # Try to act like sprockets. From 084ee4ab336df0148c17f0c1e1d7641ecdad7cff Mon Sep 17 00:00:00 2001 From: Alex Riedler Date: Wed, 18 Feb 2015 08:52:12 -0500 Subject: [PATCH 26/81] Update to handlebars v3.0.0 --- vendor/assets/javascripts/handlebars.js | 2321 +++++++++++------ .../assets/javascripts/handlebars.runtime.js | 236 +- 2 files changed, 1645 insertions(+), 912 deletions(-) diff --git a/vendor/assets/javascripts/handlebars.js b/vendor/assets/javascripts/handlebars.js index f826bbf..f5c05ab 100644 --- a/vendor/assets/javascripts/handlebars.js +++ b/vendor/assets/javascripts/handlebars.js @@ -1,6 +1,6 @@ /*! - handlebars v2.0.0 + handlebars v3.0.0 Copyright (C) 2011-2014 by Yehuda Katz @@ -31,33 +31,14 @@ THE SOFTWARE. } else if (typeof exports === 'object') { module.exports = factory(); } else { - root.Handlebars = root.Handlebars || factory(); + root.Handlebars = factory(); } }(this, function () { -// handlebars/safe-string.js -var __module4__ = (function() { - "use strict"; - var __exports__; - // Build out our basic SafeString type - function SafeString(string) { - this.string = string; - } - - SafeString.prototype.toString = function() { - return "" + this.string; - }; - - __exports__ = SafeString; - return __exports__; -})(); - // handlebars/utils.js -var __module3__ = (function(__dependency1__) { +var __module3__ = (function() { "use strict"; var __exports__ = {}; /*jshint -W004 */ - var SafeString = __dependency1__; - var escape = { "&": "&", "<": "<", @@ -107,11 +88,21 @@ var __module3__ = (function(__dependency1__) { return (value && typeof value === 'object') ? toString.call(value) === '[object Array]' : false; }; __exports__.isArray = isArray; + // Older IE versions do not directly support indexOf so we must implement our own, sadly. + function indexOf(array, value) { + for (var i = 0, len = array.length; i < len; i++) { + if (array[i] === value) { + return i; + } + } + return -1; + } + __exports__.indexOf = indexOf; function escapeExpression(string) { // don't escape SafeStrings, since they're already safe - if (string instanceof SafeString) { - return string.toString(); + if (string && string.toHTML) { + return string.toHTML(); } else if (string == null) { return ""; } else if (!string) { @@ -137,27 +128,35 @@ var __module3__ = (function(__dependency1__) { } } - __exports__.isEmpty = isEmpty;function appendContextPath(contextPath, id) { + __exports__.isEmpty = isEmpty;function blockParams(params, ids) { + params.path = ids; + return params; + } + + __exports__.blockParams = blockParams;function appendContextPath(contextPath, id) { return (contextPath ? contextPath + '.' : '') + id; } __exports__.appendContextPath = appendContextPath; return __exports__; -})(__module4__); +})(); // handlebars/exception.js -var __module5__ = (function() { +var __module4__ = (function() { "use strict"; var __exports__; var errorProps = ['description', 'fileName', 'lineNumber', 'message', 'name', 'number', 'stack']; function Exception(message, node) { - var line; - if (node && node.firstLine) { - line = node.firstLine; - - message += ' - ' + line + ':' + node.firstColumn; + var loc = node && node.loc, + line, + column; + if (loc) { + line = loc.start.line; + column = loc.start.column; + + message += ' - ' + line + ':' + column; } var tmp = Error.prototype.constructor.call(this, message); @@ -167,9 +166,9 @@ var __module5__ = (function() { this[errorProps[idx]] = tmp[errorProps[idx]]; } - if (line) { + if (loc) { this.lineNumber = line; - this.column = node.firstColumn; + this.column = column; } } @@ -186,7 +185,7 @@ var __module2__ = (function(__dependency1__, __dependency2__) { var Utils = __dependency1__; var Exception = __dependency2__; - var VERSION = "2.0.0"; + var VERSION = "3.0.0"; __exports__.VERSION = VERSION;var COMPILER_REVISION = 6; __exports__.COMPILER_REVISION = COMPILER_REVISION; var REVISION_CHANGES = { @@ -232,6 +231,9 @@ var __module2__ = (function(__dependency1__, __dependency2__) { if (toString.call(name) === objectType) { Utils.extend(this.partials, name); } else { + if (typeof partial === 'undefined') { + throw new Exception('Attempting to register a partial as undefined'); + } this.partials[name] = partial; } }, @@ -299,36 +301,47 @@ var __module2__ = (function(__dependency1__, __dependency2__) { data = createFrame(options.data); } + function execIteration(key, i, last) { + if (data) { + data.key = key; + data.index = i; + data.first = i === 0; + data.last = !!last; + + if (contextPath) { + data.contextPath = contextPath + key; + } + } + + ret = ret + fn(context[key], { + data: data, + blockParams: Utils.blockParams([context[key], key], [contextPath + key, null]) + }); + } + if(context && typeof context === 'object') { if (isArray(context)) { for(var j = context.length; i 0) { - throw new Exception("Invalid path: " + original, this); - } else if (part === "..") { - depth++; - depthString += '../'; - } else { - this.isScoped = true; - } - } else { - dig.push(part); - } - } + PathExpression: function(data, depth, parts, original, locInfo) { + this.loc = locInfo; + this.type = 'PathExpression'; + this.data = data; this.original = original; - this.parts = dig; - this.string = dig.join('.'); + this.parts = parts; this.depth = depth; - this.idName = depthString + this.string; - - // an ID is simple if it only has one part, and that part is not - // `..` or `this`. - this.isSimple = parts.length === 1 && !this.isScoped && depth === 0; - - this.stringModeValue = this.string; - }, - - PartialNameNode: function(name, locInfo) { - LocationInfo.call(this, locInfo); - this.type = "PARTIAL_NAME"; - this.name = name.original; }, - DataNode: function(id, locInfo) { - LocationInfo.call(this, locInfo); - this.type = "DATA"; - this.id = id; - this.stringModeValue = id.stringModeValue; - this.idName = '@' + id.stringModeValue; + StringLiteral: function(string, locInfo) { + this.loc = locInfo; + this.type = 'StringLiteral'; + this.original = + this.value = string; }, - StringNode: function(string, locInfo) { - LocationInfo.call(this, locInfo); - this.type = "STRING"; + NumberLiteral: function(number, locInfo) { + this.loc = locInfo; + this.type = 'NumberLiteral'; this.original = - this.string = - this.stringModeValue = string; + this.value = Number(number); }, - NumberNode: function(number, locInfo) { - LocationInfo.call(this, locInfo); - this.type = "NUMBER"; + BooleanLiteral: function(bool, locInfo) { + this.loc = locInfo; + this.type = 'BooleanLiteral'; this.original = - this.number = number; - this.stringModeValue = Number(number); + this.value = bool === 'true'; }, - BooleanNode: function(bool, locInfo) { - LocationInfo.call(this, locInfo); - this.type = "BOOLEAN"; - this.bool = bool; - this.stringModeValue = bool === "true"; + Hash: function(pairs, locInfo) { + this.loc = locInfo; + this.type = 'Hash'; + this.pairs = pairs; + }, + HashPair: function(key, value, locInfo) { + this.loc = locInfo; + this.type = 'HashPair'; + this.key = key; + this.value = value; }, - CommentNode: function(comment, locInfo) { - LocationInfo.call(this, locInfo); - this.type = "comment"; - this.comment = comment; + // Public API used to evaluate derived attributes regarding AST nodes + helpers: { + // a mustache is definitely a helper if: + // * it is an eligible helper, and + // * it has at least one parameter or hash segment + // TODO: Make these public utility methods + helperExpression: function(node) { + return !!(node.type === 'SubExpression' || node.params.length || node.hash); + }, + + scopedId: function(path) { + return (/^\.|this\b/).test(path.original); + }, - this.strip = { - inlineStandalone: true - }; + // an ID is simple if it only has one part, and that part is not + // `..` or `this`. + simpleId: function(path) { + return path.parts.length === 1 && !AST.helpers.scopedId(path) && !path.depth; + } } }; // Must be exported as an object rather than the root of the module as the jison lexer - // most modify the object to operate properly. + // must modify the object to operate properly. __exports__ = AST; return __exports__; -})(__module5__); +})(); // handlebars/compiler/parser.js var __module9__ = (function() { @@ -886,16 +880,16 @@ var __module9__ = (function() { var handlebars = (function(){ var parser = {trace: function trace() { }, yy: {}, - symbols_: {"error":2,"root":3,"program":4,"EOF":5,"program_repetition0":6,"statement":7,"mustache":8,"block":9,"rawBlock":10,"partial":11,"CONTENT":12,"COMMENT":13,"openRawBlock":14,"END_RAW_BLOCK":15,"OPEN_RAW_BLOCK":16,"sexpr":17,"CLOSE_RAW_BLOCK":18,"openBlock":19,"block_option0":20,"closeBlock":21,"openInverse":22,"block_option1":23,"OPEN_BLOCK":24,"CLOSE":25,"OPEN_INVERSE":26,"inverseAndProgram":27,"INVERSE":28,"OPEN_ENDBLOCK":29,"path":30,"OPEN":31,"OPEN_UNESCAPED":32,"CLOSE_UNESCAPED":33,"OPEN_PARTIAL":34,"partialName":35,"param":36,"partial_option0":37,"partial_option1":38,"sexpr_repetition0":39,"sexpr_option0":40,"dataName":41,"STRING":42,"NUMBER":43,"BOOLEAN":44,"OPEN_SEXPR":45,"CLOSE_SEXPR":46,"hash":47,"hash_repetition_plus0":48,"hashSegment":49,"ID":50,"EQUALS":51,"DATA":52,"pathSegments":53,"SEP":54,"$accept":0,"$end":1}, - terminals_: {2:"error",5:"EOF",12:"CONTENT",13:"COMMENT",15:"END_RAW_BLOCK",16:"OPEN_RAW_BLOCK",18:"CLOSE_RAW_BLOCK",24:"OPEN_BLOCK",25:"CLOSE",26:"OPEN_INVERSE",28:"INVERSE",29:"OPEN_ENDBLOCK",31:"OPEN",32:"OPEN_UNESCAPED",33:"CLOSE_UNESCAPED",34:"OPEN_PARTIAL",42:"STRING",43:"NUMBER",44:"BOOLEAN",45:"OPEN_SEXPR",46:"CLOSE_SEXPR",50:"ID",51:"EQUALS",52:"DATA",54:"SEP"}, - productions_: [0,[3,2],[4,1],[7,1],[7,1],[7,1],[7,1],[7,1],[7,1],[10,3],[14,3],[9,4],[9,4],[19,3],[22,3],[27,2],[21,3],[8,3],[8,3],[11,5],[11,4],[17,3],[17,1],[36,1],[36,1],[36,1],[36,1],[36,1],[36,3],[47,1],[49,3],[35,1],[35,1],[35,1],[41,2],[30,1],[53,3],[53,1],[6,0],[6,2],[20,0],[20,1],[23,0],[23,1],[37,0],[37,1],[38,0],[38,1],[39,0],[39,2],[40,0],[40,1],[48,1],[48,2]], + symbols_: {"error":2,"root":3,"program":4,"EOF":5,"program_repetition0":6,"statement":7,"mustache":8,"block":9,"rawBlock":10,"partial":11,"content":12,"COMMENT":13,"CONTENT":14,"openRawBlock":15,"END_RAW_BLOCK":16,"OPEN_RAW_BLOCK":17,"helperName":18,"openRawBlock_repetition0":19,"openRawBlock_option0":20,"CLOSE_RAW_BLOCK":21,"openBlock":22,"block_option0":23,"closeBlock":24,"openInverse":25,"block_option1":26,"OPEN_BLOCK":27,"openBlock_repetition0":28,"openBlock_option0":29,"openBlock_option1":30,"CLOSE":31,"OPEN_INVERSE":32,"openInverse_repetition0":33,"openInverse_option0":34,"openInverse_option1":35,"openInverseChain":36,"OPEN_INVERSE_CHAIN":37,"openInverseChain_repetition0":38,"openInverseChain_option0":39,"openInverseChain_option1":40,"inverseAndProgram":41,"INVERSE":42,"inverseChain":43,"inverseChain_option0":44,"OPEN_ENDBLOCK":45,"OPEN":46,"mustache_repetition0":47,"mustache_option0":48,"OPEN_UNESCAPED":49,"mustache_repetition1":50,"mustache_option1":51,"CLOSE_UNESCAPED":52,"OPEN_PARTIAL":53,"partialName":54,"partial_repetition0":55,"partial_option0":56,"param":57,"sexpr":58,"OPEN_SEXPR":59,"sexpr_repetition0":60,"sexpr_option0":61,"CLOSE_SEXPR":62,"hash":63,"hash_repetition_plus0":64,"hashSegment":65,"ID":66,"EQUALS":67,"blockParams":68,"OPEN_BLOCK_PARAMS":69,"blockParams_repetition_plus0":70,"CLOSE_BLOCK_PARAMS":71,"path":72,"dataName":73,"STRING":74,"NUMBER":75,"BOOLEAN":76,"DATA":77,"pathSegments":78,"SEP":79,"$accept":0,"$end":1}, + terminals_: {2:"error",5:"EOF",13:"COMMENT",14:"CONTENT",16:"END_RAW_BLOCK",17:"OPEN_RAW_BLOCK",21:"CLOSE_RAW_BLOCK",27:"OPEN_BLOCK",31:"CLOSE",32:"OPEN_INVERSE",37:"OPEN_INVERSE_CHAIN",42:"INVERSE",45:"OPEN_ENDBLOCK",46:"OPEN",49:"OPEN_UNESCAPED",52:"CLOSE_UNESCAPED",53:"OPEN_PARTIAL",59:"OPEN_SEXPR",62:"CLOSE_SEXPR",66:"ID",67:"EQUALS",69:"OPEN_BLOCK_PARAMS",71:"CLOSE_BLOCK_PARAMS",74:"STRING",75:"NUMBER",76:"BOOLEAN",77:"DATA",79:"SEP"}, + productions_: [0,[3,2],[4,1],[7,1],[7,1],[7,1],[7,1],[7,1],[7,1],[12,1],[10,3],[15,5],[9,4],[9,4],[22,6],[25,6],[36,6],[41,2],[43,3],[43,1],[24,3],[8,5],[8,5],[11,5],[57,1],[57,1],[58,5],[63,1],[65,3],[68,3],[18,1],[18,1],[18,1],[18,1],[18,1],[54,1],[54,1],[73,2],[72,1],[78,3],[78,1],[6,0],[6,2],[19,0],[19,2],[20,0],[20,1],[23,0],[23,1],[26,0],[26,1],[28,0],[28,2],[29,0],[29,1],[30,0],[30,1],[33,0],[33,2],[34,0],[34,1],[35,0],[35,1],[38,0],[38,2],[39,0],[39,1],[40,0],[40,1],[44,0],[44,1],[47,0],[47,2],[48,0],[48,1],[50,0],[50,2],[51,0],[51,1],[55,0],[55,2],[56,0],[56,1],[60,0],[60,2],[61,0],[61,1],[64,1],[64,2],[70,1],[70,2]], performAction: function anonymous(yytext,yyleng,yylineno,yy,yystate,$$,_$) { var $0 = $$.length - 1; switch (yystate) { - case 1: yy.prepareProgram($$[$0-1].statements, true); return $$[$0-1]; + case 1: return $$[$0-1]; break; - case 2:this.$ = new yy.ProgramNode(yy.prepareProgram($$[$0]), {}, this._$); + case 2:this.$ = new yy.Program($$[$0], null, {}, yy.locInfo(this._$)); break; case 3:this.$ = $$[$0]; break; @@ -905,84 +899,128 @@ var __module9__ = (function() { break; case 6:this.$ = $$[$0]; break; - case 7:this.$ = new yy.ContentNode($$[$0], this._$); + case 7:this.$ = $$[$0]; + break; + case 8:this.$ = new yy.CommentStatement(yy.stripComment($$[$0]), yy.stripFlags($$[$0], $$[$0]), yy.locInfo(this._$)); + break; + case 9:this.$ = new yy.ContentStatement($$[$0], yy.locInfo(this._$)); + break; + case 10:this.$ = yy.prepareRawBlock($$[$0-2], $$[$0-1], $$[$0], this._$); + break; + case 11:this.$ = { path: $$[$0-3], params: $$[$0-2], hash: $$[$0-1] }; + break; + case 12:this.$ = yy.prepareBlock($$[$0-3], $$[$0-2], $$[$0-1], $$[$0], false, this._$); + break; + case 13:this.$ = yy.prepareBlock($$[$0-3], $$[$0-2], $$[$0-1], $$[$0], true, this._$); + break; + case 14:this.$ = { path: $$[$0-4], params: $$[$0-3], hash: $$[$0-2], blockParams: $$[$0-1], strip: yy.stripFlags($$[$0-5], $$[$0]) }; + break; + case 15:this.$ = { path: $$[$0-4], params: $$[$0-3], hash: $$[$0-2], blockParams: $$[$0-1], strip: yy.stripFlags($$[$0-5], $$[$0]) }; + break; + case 16:this.$ = { path: $$[$0-4], params: $$[$0-3], hash: $$[$0-2], blockParams: $$[$0-1], strip: yy.stripFlags($$[$0-5], $$[$0]) }; break; - case 8:this.$ = new yy.CommentNode($$[$0], this._$); + case 17:this.$ = { strip: yy.stripFlags($$[$0-1], $$[$0-1]), program: $$[$0] }; break; - case 9:this.$ = new yy.RawBlockNode($$[$0-2], $$[$0-1], $$[$0], this._$); + case 18: + var inverse = yy.prepareBlock($$[$0-2], $$[$0-1], $$[$0], $$[$0], false, this._$), + program = new yy.Program([inverse], null, {}, yy.locInfo(this._$)); + program.chained = true; + + this.$ = { strip: $$[$0-2].strip, program: program, chain: true }; + + break; + case 19:this.$ = $$[$0]; + break; + case 20:this.$ = {path: $$[$0-1], strip: yy.stripFlags($$[$0-2], $$[$0])}; + break; + case 21:this.$ = yy.prepareMustache($$[$0-3], $$[$0-2], $$[$0-1], $$[$0-4], yy.stripFlags($$[$0-4], $$[$0]), this._$); + break; + case 22:this.$ = yy.prepareMustache($$[$0-3], $$[$0-2], $$[$0-1], $$[$0-4], yy.stripFlags($$[$0-4], $$[$0]), this._$); + break; + case 23:this.$ = new yy.PartialStatement($$[$0-3], $$[$0-2], $$[$0-1], yy.stripFlags($$[$0-4], $$[$0]), yy.locInfo(this._$)); + break; + case 24:this.$ = $$[$0]; + break; + case 25:this.$ = $$[$0]; break; - case 10:this.$ = new yy.MustacheNode($$[$0-1], null, '', '', this._$); + case 26:this.$ = new yy.SubExpression($$[$0-3], $$[$0-2], $$[$0-1], yy.locInfo(this._$)); break; - case 11:this.$ = yy.prepareBlock($$[$0-3], $$[$0-2], $$[$0-1], $$[$0], false, this._$); + case 27:this.$ = new yy.Hash($$[$0], yy.locInfo(this._$)); break; - case 12:this.$ = yy.prepareBlock($$[$0-3], $$[$0-2], $$[$0-1], $$[$0], true, this._$); + case 28:this.$ = new yy.HashPair($$[$0-2], $$[$0], yy.locInfo(this._$)); break; - case 13:this.$ = new yy.MustacheNode($$[$0-1], null, $$[$0-2], yy.stripFlags($$[$0-2], $$[$0]), this._$); + case 29:this.$ = $$[$0-1]; break; - case 14:this.$ = new yy.MustacheNode($$[$0-1], null, $$[$0-2], yy.stripFlags($$[$0-2], $$[$0]), this._$); + case 30:this.$ = $$[$0]; break; - case 15:this.$ = { strip: yy.stripFlags($$[$0-1], $$[$0-1]), program: $$[$0] }; + case 31:this.$ = $$[$0]; break; - case 16:this.$ = {path: $$[$0-1], strip: yy.stripFlags($$[$0-2], $$[$0])}; + case 32:this.$ = new yy.StringLiteral($$[$0], yy.locInfo(this._$)); break; - case 17:this.$ = new yy.MustacheNode($$[$0-1], null, $$[$0-2], yy.stripFlags($$[$0-2], $$[$0]), this._$); + case 33:this.$ = new yy.NumberLiteral($$[$0], yy.locInfo(this._$)); break; - case 18:this.$ = new yy.MustacheNode($$[$0-1], null, $$[$0-2], yy.stripFlags($$[$0-2], $$[$0]), this._$); + case 34:this.$ = new yy.BooleanLiteral($$[$0], yy.locInfo(this._$)); break; - case 19:this.$ = new yy.PartialNode($$[$0-3], $$[$0-2], $$[$0-1], yy.stripFlags($$[$0-4], $$[$0]), this._$); + case 35:this.$ = $$[$0]; break; - case 20:this.$ = new yy.PartialNode($$[$0-2], undefined, $$[$0-1], yy.stripFlags($$[$0-3], $$[$0]), this._$); + case 36:this.$ = $$[$0]; break; - case 21:this.$ = new yy.SexprNode([$$[$0-2]].concat($$[$0-1]), $$[$0], this._$); + case 37:this.$ = yy.preparePath(true, $$[$0], this._$); break; - case 22:this.$ = new yy.SexprNode([$$[$0]], null, this._$); + case 38:this.$ = yy.preparePath(false, $$[$0], this._$); break; - case 23:this.$ = $$[$0]; + case 39: $$[$0-2].push({part: $$[$0], separator: $$[$0-1]}); this.$ = $$[$0-2]; break; - case 24:this.$ = new yy.StringNode($$[$0], this._$); + case 40:this.$ = [{part: $$[$0]}]; break; - case 25:this.$ = new yy.NumberNode($$[$0], this._$); + case 41:this.$ = []; break; - case 26:this.$ = new yy.BooleanNode($$[$0], this._$); + case 42:$$[$0-1].push($$[$0]); break; - case 27:this.$ = $$[$0]; + case 43:this.$ = []; break; - case 28:$$[$0-1].isHelper = true; this.$ = $$[$0-1]; + case 44:$$[$0-1].push($$[$0]); break; - case 29:this.$ = new yy.HashNode($$[$0], this._$); + case 51:this.$ = []; break; - case 30:this.$ = [$$[$0-2], $$[$0]]; + case 52:$$[$0-1].push($$[$0]); break; - case 31:this.$ = new yy.PartialNameNode($$[$0], this._$); + case 57:this.$ = []; break; - case 32:this.$ = new yy.PartialNameNode(new yy.StringNode($$[$0], this._$), this._$); + case 58:$$[$0-1].push($$[$0]); break; - case 33:this.$ = new yy.PartialNameNode(new yy.NumberNode($$[$0], this._$)); + case 63:this.$ = []; break; - case 34:this.$ = new yy.DataNode($$[$0], this._$); + case 64:$$[$0-1].push($$[$0]); break; - case 35:this.$ = new yy.IdNode($$[$0], this._$); + case 71:this.$ = []; break; - case 36: $$[$0-2].push({part: $$[$0], separator: $$[$0-1]}); this.$ = $$[$0-2]; + case 72:$$[$0-1].push($$[$0]); break; - case 37:this.$ = [{part: $$[$0]}]; + case 75:this.$ = []; break; - case 38:this.$ = []; + case 76:$$[$0-1].push($$[$0]); break; - case 39:$$[$0-1].push($$[$0]); + case 79:this.$ = []; break; - case 48:this.$ = []; + case 80:$$[$0-1].push($$[$0]); break; - case 49:$$[$0-1].push($$[$0]); + case 83:this.$ = []; break; - case 52:this.$ = [$$[$0]]; + case 84:$$[$0-1].push($$[$0]); break; - case 53:$$[$0-1].push($$[$0]); + case 87:this.$ = [$$[$0]]; + break; + case 88:$$[$0-1].push($$[$0]); + break; + case 89:this.$ = [$$[$0]]; + break; + case 90:$$[$0-1].push($$[$0]); break; } }, - table: [{3:1,4:2,5:[2,38],6:3,12:[2,38],13:[2,38],16:[2,38],24:[2,38],26:[2,38],31:[2,38],32:[2,38],34:[2,38]},{1:[3]},{5:[1,4]},{5:[2,2],7:5,8:6,9:7,10:8,11:9,12:[1,10],13:[1,11],14:16,16:[1,20],19:14,22:15,24:[1,18],26:[1,19],28:[2,2],29:[2,2],31:[1,12],32:[1,13],34:[1,17]},{1:[2,1]},{5:[2,39],12:[2,39],13:[2,39],16:[2,39],24:[2,39],26:[2,39],28:[2,39],29:[2,39],31:[2,39],32:[2,39],34:[2,39]},{5:[2,3],12:[2,3],13:[2,3],16:[2,3],24:[2,3],26:[2,3],28:[2,3],29:[2,3],31:[2,3],32:[2,3],34:[2,3]},{5:[2,4],12:[2,4],13:[2,4],16:[2,4],24:[2,4],26:[2,4],28:[2,4],29:[2,4],31:[2,4],32:[2,4],34:[2,4]},{5:[2,5],12:[2,5],13:[2,5],16:[2,5],24:[2,5],26:[2,5],28:[2,5],29:[2,5],31:[2,5],32:[2,5],34:[2,5]},{5:[2,6],12:[2,6],13:[2,6],16:[2,6],24:[2,6],26:[2,6],28:[2,6],29:[2,6],31:[2,6],32:[2,6],34:[2,6]},{5:[2,7],12:[2,7],13:[2,7],16:[2,7],24:[2,7],26:[2,7],28:[2,7],29:[2,7],31:[2,7],32:[2,7],34:[2,7]},{5:[2,8],12:[2,8],13:[2,8],16:[2,8],24:[2,8],26:[2,8],28:[2,8],29:[2,8],31:[2,8],32:[2,8],34:[2,8]},{17:21,30:22,41:23,50:[1,26],52:[1,25],53:24},{17:27,30:22,41:23,50:[1,26],52:[1,25],53:24},{4:28,6:3,12:[2,38],13:[2,38],16:[2,38],24:[2,38],26:[2,38],28:[2,38],29:[2,38],31:[2,38],32:[2,38],34:[2,38]},{4:29,6:3,12:[2,38],13:[2,38],16:[2,38],24:[2,38],26:[2,38],28:[2,38],29:[2,38],31:[2,38],32:[2,38],34:[2,38]},{12:[1,30]},{30:32,35:31,42:[1,33],43:[1,34],50:[1,26],53:24},{17:35,30:22,41:23,50:[1,26],52:[1,25],53:24},{17:36,30:22,41:23,50:[1,26],52:[1,25],53:24},{17:37,30:22,41:23,50:[1,26],52:[1,25],53:24},{25:[1,38]},{18:[2,48],25:[2,48],33:[2,48],39:39,42:[2,48],43:[2,48],44:[2,48],45:[2,48],46:[2,48],50:[2,48],52:[2,48]},{18:[2,22],25:[2,22],33:[2,22],46:[2,22]},{18:[2,35],25:[2,35],33:[2,35],42:[2,35],43:[2,35],44:[2,35],45:[2,35],46:[2,35],50:[2,35],52:[2,35],54:[1,40]},{30:41,50:[1,26],53:24},{18:[2,37],25:[2,37],33:[2,37],42:[2,37],43:[2,37],44:[2,37],45:[2,37],46:[2,37],50:[2,37],52:[2,37],54:[2,37]},{33:[1,42]},{20:43,27:44,28:[1,45],29:[2,40]},{23:46,27:47,28:[1,45],29:[2,42]},{15:[1,48]},{25:[2,46],30:51,36:49,38:50,41:55,42:[1,52],43:[1,53],44:[1,54],45:[1,56],47:57,48:58,49:60,50:[1,59],52:[1,25],53:24},{25:[2,31],42:[2,31],43:[2,31],44:[2,31],45:[2,31],50:[2,31],52:[2,31]},{25:[2,32],42:[2,32],43:[2,32],44:[2,32],45:[2,32],50:[2,32],52:[2,32]},{25:[2,33],42:[2,33],43:[2,33],44:[2,33],45:[2,33],50:[2,33],52:[2,33]},{25:[1,61]},{25:[1,62]},{18:[1,63]},{5:[2,17],12:[2,17],13:[2,17],16:[2,17],24:[2,17],26:[2,17],28:[2,17],29:[2,17],31:[2,17],32:[2,17],34:[2,17]},{18:[2,50],25:[2,50],30:51,33:[2,50],36:65,40:64,41:55,42:[1,52],43:[1,53],44:[1,54],45:[1,56],46:[2,50],47:66,48:58,49:60,50:[1,59],52:[1,25],53:24},{50:[1,67]},{18:[2,34],25:[2,34],33:[2,34],42:[2,34],43:[2,34],44:[2,34],45:[2,34],46:[2,34],50:[2,34],52:[2,34]},{5:[2,18],12:[2,18],13:[2,18],16:[2,18],24:[2,18],26:[2,18],28:[2,18],29:[2,18],31:[2,18],32:[2,18],34:[2,18]},{21:68,29:[1,69]},{29:[2,41]},{4:70,6:3,12:[2,38],13:[2,38],16:[2,38],24:[2,38],26:[2,38],29:[2,38],31:[2,38],32:[2,38],34:[2,38]},{21:71,29:[1,69]},{29:[2,43]},{5:[2,9],12:[2,9],13:[2,9],16:[2,9],24:[2,9],26:[2,9],28:[2,9],29:[2,9],31:[2,9],32:[2,9],34:[2,9]},{25:[2,44],37:72,47:73,48:58,49:60,50:[1,74]},{25:[1,75]},{18:[2,23],25:[2,23],33:[2,23],42:[2,23],43:[2,23],44:[2,23],45:[2,23],46:[2,23],50:[2,23],52:[2,23]},{18:[2,24],25:[2,24],33:[2,24],42:[2,24],43:[2,24],44:[2,24],45:[2,24],46:[2,24],50:[2,24],52:[2,24]},{18:[2,25],25:[2,25],33:[2,25],42:[2,25],43:[2,25],44:[2,25],45:[2,25],46:[2,25],50:[2,25],52:[2,25]},{18:[2,26],25:[2,26],33:[2,26],42:[2,26],43:[2,26],44:[2,26],45:[2,26],46:[2,26],50:[2,26],52:[2,26]},{18:[2,27],25:[2,27],33:[2,27],42:[2,27],43:[2,27],44:[2,27],45:[2,27],46:[2,27],50:[2,27],52:[2,27]},{17:76,30:22,41:23,50:[1,26],52:[1,25],53:24},{25:[2,47]},{18:[2,29],25:[2,29],33:[2,29],46:[2,29],49:77,50:[1,74]},{18:[2,37],25:[2,37],33:[2,37],42:[2,37],43:[2,37],44:[2,37],45:[2,37],46:[2,37],50:[2,37],51:[1,78],52:[2,37],54:[2,37]},{18:[2,52],25:[2,52],33:[2,52],46:[2,52],50:[2,52]},{12:[2,13],13:[2,13],16:[2,13],24:[2,13],26:[2,13],28:[2,13],29:[2,13],31:[2,13],32:[2,13],34:[2,13]},{12:[2,14],13:[2,14],16:[2,14],24:[2,14],26:[2,14],28:[2,14],29:[2,14],31:[2,14],32:[2,14],34:[2,14]},{12:[2,10]},{18:[2,21],25:[2,21],33:[2,21],46:[2,21]},{18:[2,49],25:[2,49],33:[2,49],42:[2,49],43:[2,49],44:[2,49],45:[2,49],46:[2,49],50:[2,49],52:[2,49]},{18:[2,51],25:[2,51],33:[2,51],46:[2,51]},{18:[2,36],25:[2,36],33:[2,36],42:[2,36],43:[2,36],44:[2,36],45:[2,36],46:[2,36],50:[2,36],52:[2,36],54:[2,36]},{5:[2,11],12:[2,11],13:[2,11],16:[2,11],24:[2,11],26:[2,11],28:[2,11],29:[2,11],31:[2,11],32:[2,11],34:[2,11]},{30:79,50:[1,26],53:24},{29:[2,15]},{5:[2,12],12:[2,12],13:[2,12],16:[2,12],24:[2,12],26:[2,12],28:[2,12],29:[2,12],31:[2,12],32:[2,12],34:[2,12]},{25:[1,80]},{25:[2,45]},{51:[1,78]},{5:[2,20],12:[2,20],13:[2,20],16:[2,20],24:[2,20],26:[2,20],28:[2,20],29:[2,20],31:[2,20],32:[2,20],34:[2,20]},{46:[1,81]},{18:[2,53],25:[2,53],33:[2,53],46:[2,53],50:[2,53]},{30:51,36:82,41:55,42:[1,52],43:[1,53],44:[1,54],45:[1,56],50:[1,26],52:[1,25],53:24},{25:[1,83]},{5:[2,19],12:[2,19],13:[2,19],16:[2,19],24:[2,19],26:[2,19],28:[2,19],29:[2,19],31:[2,19],32:[2,19],34:[2,19]},{18:[2,28],25:[2,28],33:[2,28],42:[2,28],43:[2,28],44:[2,28],45:[2,28],46:[2,28],50:[2,28],52:[2,28]},{18:[2,30],25:[2,30],33:[2,30],46:[2,30],50:[2,30]},{5:[2,16],12:[2,16],13:[2,16],16:[2,16],24:[2,16],26:[2,16],28:[2,16],29:[2,16],31:[2,16],32:[2,16],34:[2,16]}], - defaultActions: {4:[2,1],44:[2,41],47:[2,43],57:[2,47],63:[2,10],70:[2,15],73:[2,45]}, + table: [{3:1,4:2,5:[2,41],6:3,13:[2,41],14:[2,41],17:[2,41],27:[2,41],32:[2,41],46:[2,41],49:[2,41],53:[2,41]},{1:[3]},{5:[1,4]},{5:[2,2],7:5,8:6,9:7,10:8,11:9,12:10,13:[1,11],14:[1,18],15:16,17:[1,21],22:14,25:15,27:[1,19],32:[1,20],37:[2,2],42:[2,2],45:[2,2],46:[1,12],49:[1,13],53:[1,17]},{1:[2,1]},{5:[2,42],13:[2,42],14:[2,42],17:[2,42],27:[2,42],32:[2,42],37:[2,42],42:[2,42],45:[2,42],46:[2,42],49:[2,42],53:[2,42]},{5:[2,3],13:[2,3],14:[2,3],17:[2,3],27:[2,3],32:[2,3],37:[2,3],42:[2,3],45:[2,3],46:[2,3],49:[2,3],53:[2,3]},{5:[2,4],13:[2,4],14:[2,4],17:[2,4],27:[2,4],32:[2,4],37:[2,4],42:[2,4],45:[2,4],46:[2,4],49:[2,4],53:[2,4]},{5:[2,5],13:[2,5],14:[2,5],17:[2,5],27:[2,5],32:[2,5],37:[2,5],42:[2,5],45:[2,5],46:[2,5],49:[2,5],53:[2,5]},{5:[2,6],13:[2,6],14:[2,6],17:[2,6],27:[2,6],32:[2,6],37:[2,6],42:[2,6],45:[2,6],46:[2,6],49:[2,6],53:[2,6]},{5:[2,7],13:[2,7],14:[2,7],17:[2,7],27:[2,7],32:[2,7],37:[2,7],42:[2,7],45:[2,7],46:[2,7],49:[2,7],53:[2,7]},{5:[2,8],13:[2,8],14:[2,8],17:[2,8],27:[2,8],32:[2,8],37:[2,8],42:[2,8],45:[2,8],46:[2,8],49:[2,8],53:[2,8]},{18:22,66:[1,30],72:23,73:24,74:[1,25],75:[1,26],76:[1,27],77:[1,29],78:28},{18:31,66:[1,30],72:23,73:24,74:[1,25],75:[1,26],76:[1,27],77:[1,29],78:28},{4:32,6:3,13:[2,41],14:[2,41],17:[2,41],27:[2,41],32:[2,41],37:[2,41],42:[2,41],45:[2,41],46:[2,41],49:[2,41],53:[2,41]},{4:33,6:3,13:[2,41],14:[2,41],17:[2,41],27:[2,41],32:[2,41],42:[2,41],45:[2,41],46:[2,41],49:[2,41],53:[2,41]},{12:34,14:[1,18]},{18:36,54:35,58:37,59:[1,38],66:[1,30],72:23,73:24,74:[1,25],75:[1,26],76:[1,27],77:[1,29],78:28},{5:[2,9],13:[2,9],14:[2,9],16:[2,9],17:[2,9],27:[2,9],32:[2,9],37:[2,9],42:[2,9],45:[2,9],46:[2,9],49:[2,9],53:[2,9]},{18:39,66:[1,30],72:23,73:24,74:[1,25],75:[1,26],76:[1,27],77:[1,29],78:28},{18:40,66:[1,30],72:23,73:24,74:[1,25],75:[1,26],76:[1,27],77:[1,29],78:28},{18:41,66:[1,30],72:23,73:24,74:[1,25],75:[1,26],76:[1,27],77:[1,29],78:28},{31:[2,71],47:42,59:[2,71],66:[2,71],74:[2,71],75:[2,71],76:[2,71],77:[2,71]},{21:[2,30],31:[2,30],52:[2,30],59:[2,30],62:[2,30],66:[2,30],69:[2,30],74:[2,30],75:[2,30],76:[2,30],77:[2,30]},{21:[2,31],31:[2,31],52:[2,31],59:[2,31],62:[2,31],66:[2,31],69:[2,31],74:[2,31],75:[2,31],76:[2,31],77:[2,31]},{21:[2,32],31:[2,32],52:[2,32],59:[2,32],62:[2,32],66:[2,32],69:[2,32],74:[2,32],75:[2,32],76:[2,32],77:[2,32]},{21:[2,33],31:[2,33],52:[2,33],59:[2,33],62:[2,33],66:[2,33],69:[2,33],74:[2,33],75:[2,33],76:[2,33],77:[2,33]},{21:[2,34],31:[2,34],52:[2,34],59:[2,34],62:[2,34],66:[2,34],69:[2,34],74:[2,34],75:[2,34],76:[2,34],77:[2,34]},{21:[2,38],31:[2,38],52:[2,38],59:[2,38],62:[2,38],66:[2,38],69:[2,38],74:[2,38],75:[2,38],76:[2,38],77:[2,38],79:[1,43]},{66:[1,30],78:44},{21:[2,40],31:[2,40],52:[2,40],59:[2,40],62:[2,40],66:[2,40],69:[2,40],74:[2,40],75:[2,40],76:[2,40],77:[2,40],79:[2,40]},{50:45,52:[2,75],59:[2,75],66:[2,75],74:[2,75],75:[2,75],76:[2,75],77:[2,75]},{23:46,36:48,37:[1,50],41:49,42:[1,51],43:47,45:[2,47]},{26:52,41:53,42:[1,51],45:[2,49]},{16:[1,54]},{31:[2,79],55:55,59:[2,79],66:[2,79],74:[2,79],75:[2,79],76:[2,79],77:[2,79]},{31:[2,35],59:[2,35],66:[2,35],74:[2,35],75:[2,35],76:[2,35],77:[2,35]},{31:[2,36],59:[2,36],66:[2,36],74:[2,36],75:[2,36],76:[2,36],77:[2,36]},{18:56,66:[1,30],72:23,73:24,74:[1,25],75:[1,26],76:[1,27],77:[1,29],78:28},{28:57,31:[2,51],59:[2,51],66:[2,51],69:[2,51],74:[2,51],75:[2,51],76:[2,51],77:[2,51]},{31:[2,57],33:58,59:[2,57],66:[2,57],69:[2,57],74:[2,57],75:[2,57],76:[2,57],77:[2,57]},{19:59,21:[2,43],59:[2,43],66:[2,43],74:[2,43],75:[2,43],76:[2,43],77:[2,43]},{18:63,31:[2,73],48:60,57:61,58:64,59:[1,38],63:62,64:65,65:66,66:[1,67],72:23,73:24,74:[1,25],75:[1,26],76:[1,27],77:[1,29],78:28},{66:[1,68]},{21:[2,37],31:[2,37],52:[2,37],59:[2,37],62:[2,37],66:[2,37],69:[2,37],74:[2,37],75:[2,37],76:[2,37],77:[2,37],79:[1,43]},{18:63,51:69,52:[2,77],57:70,58:64,59:[1,38],63:71,64:65,65:66,66:[1,67],72:23,73:24,74:[1,25],75:[1,26],76:[1,27],77:[1,29],78:28},{24:72,45:[1,73]},{45:[2,48]},{4:74,6:3,13:[2,41],14:[2,41],17:[2,41],27:[2,41],32:[2,41],37:[2,41],42:[2,41],45:[2,41],46:[2,41],49:[2,41],53:[2,41]},{45:[2,19]},{18:75,66:[1,30],72:23,73:24,74:[1,25],75:[1,26],76:[1,27],77:[1,29],78:28},{4:76,6:3,13:[2,41],14:[2,41],17:[2,41],27:[2,41],32:[2,41],45:[2,41],46:[2,41],49:[2,41],53:[2,41]},{24:77,45:[1,73]},{45:[2,50]},{5:[2,10],13:[2,10],14:[2,10],17:[2,10],27:[2,10],32:[2,10],37:[2,10],42:[2,10],45:[2,10],46:[2,10],49:[2,10],53:[2,10]},{18:63,31:[2,81],56:78,57:79,58:64,59:[1,38],63:80,64:65,65:66,66:[1,67],72:23,73:24,74:[1,25],75:[1,26],76:[1,27],77:[1,29],78:28},{59:[2,83],60:81,62:[2,83],66:[2,83],74:[2,83],75:[2,83],76:[2,83],77:[2,83]},{18:63,29:82,31:[2,53],57:83,58:64,59:[1,38],63:84,64:65,65:66,66:[1,67],69:[2,53],72:23,73:24,74:[1,25],75:[1,26],76:[1,27],77:[1,29],78:28},{18:63,31:[2,59],34:85,57:86,58:64,59:[1,38],63:87,64:65,65:66,66:[1,67],69:[2,59],72:23,73:24,74:[1,25],75:[1,26],76:[1,27],77:[1,29],78:28},{18:63,20:88,21:[2,45],57:89,58:64,59:[1,38],63:90,64:65,65:66,66:[1,67],72:23,73:24,74:[1,25],75:[1,26],76:[1,27],77:[1,29],78:28},{31:[1,91]},{31:[2,72],59:[2,72],66:[2,72],74:[2,72],75:[2,72],76:[2,72],77:[2,72]},{31:[2,74]},{21:[2,24],31:[2,24],52:[2,24],59:[2,24],62:[2,24],66:[2,24],69:[2,24],74:[2,24],75:[2,24],76:[2,24],77:[2,24]},{21:[2,25],31:[2,25],52:[2,25],59:[2,25],62:[2,25],66:[2,25],69:[2,25],74:[2,25],75:[2,25],76:[2,25],77:[2,25]},{21:[2,27],31:[2,27],52:[2,27],62:[2,27],65:92,66:[1,93],69:[2,27]},{21:[2,87],31:[2,87],52:[2,87],62:[2,87],66:[2,87],69:[2,87]},{21:[2,40],31:[2,40],52:[2,40],59:[2,40],62:[2,40],66:[2,40],67:[1,94],69:[2,40],74:[2,40],75:[2,40],76:[2,40],77:[2,40],79:[2,40]},{21:[2,39],31:[2,39],52:[2,39],59:[2,39],62:[2,39],66:[2,39],69:[2,39],74:[2,39],75:[2,39],76:[2,39],77:[2,39],79:[2,39]},{52:[1,95]},{52:[2,76],59:[2,76],66:[2,76],74:[2,76],75:[2,76],76:[2,76],77:[2,76]},{52:[2,78]},{5:[2,12],13:[2,12],14:[2,12],17:[2,12],27:[2,12],32:[2,12],37:[2,12],42:[2,12],45:[2,12],46:[2,12],49:[2,12],53:[2,12]},{18:96,66:[1,30],72:23,73:24,74:[1,25],75:[1,26],76:[1,27],77:[1,29],78:28},{36:48,37:[1,50],41:49,42:[1,51],43:98,44:97,45:[2,69]},{31:[2,63],38:99,59:[2,63],66:[2,63],69:[2,63],74:[2,63],75:[2,63],76:[2,63],77:[2,63]},{45:[2,17]},{5:[2,13],13:[2,13],14:[2,13],17:[2,13],27:[2,13],32:[2,13],37:[2,13],42:[2,13],45:[2,13],46:[2,13],49:[2,13],53:[2,13]},{31:[1,100]},{31:[2,80],59:[2,80],66:[2,80],74:[2,80],75:[2,80],76:[2,80],77:[2,80]},{31:[2,82]},{18:63,57:102,58:64,59:[1,38],61:101,62:[2,85],63:103,64:65,65:66,66:[1,67],72:23,73:24,74:[1,25],75:[1,26],76:[1,27],77:[1,29],78:28},{30:104,31:[2,55],68:105,69:[1,106]},{31:[2,52],59:[2,52],66:[2,52],69:[2,52],74:[2,52],75:[2,52],76:[2,52],77:[2,52]},{31:[2,54],69:[2,54]},{31:[2,61],35:107,68:108,69:[1,106]},{31:[2,58],59:[2,58],66:[2,58],69:[2,58],74:[2,58],75:[2,58],76:[2,58],77:[2,58]},{31:[2,60],69:[2,60]},{21:[1,109]},{21:[2,44],59:[2,44],66:[2,44],74:[2,44],75:[2,44],76:[2,44],77:[2,44]},{21:[2,46]},{5:[2,21],13:[2,21],14:[2,21],17:[2,21],27:[2,21],32:[2,21],37:[2,21],42:[2,21],45:[2,21],46:[2,21],49:[2,21],53:[2,21]},{21:[2,88],31:[2,88],52:[2,88],62:[2,88],66:[2,88],69:[2,88]},{67:[1,94]},{18:63,57:110,58:64,59:[1,38],66:[1,30],72:23,73:24,74:[1,25],75:[1,26],76:[1,27],77:[1,29],78:28},{5:[2,22],13:[2,22],14:[2,22],17:[2,22],27:[2,22],32:[2,22],37:[2,22],42:[2,22],45:[2,22],46:[2,22],49:[2,22],53:[2,22]},{31:[1,111]},{45:[2,18]},{45:[2,70]},{18:63,31:[2,65],39:112,57:113,58:64,59:[1,38],63:114,64:65,65:66,66:[1,67],69:[2,65],72:23,73:24,74:[1,25],75:[1,26],76:[1,27],77:[1,29],78:28},{5:[2,23],13:[2,23],14:[2,23],17:[2,23],27:[2,23],32:[2,23],37:[2,23],42:[2,23],45:[2,23],46:[2,23],49:[2,23],53:[2,23]},{62:[1,115]},{59:[2,84],62:[2,84],66:[2,84],74:[2,84],75:[2,84],76:[2,84],77:[2,84]},{62:[2,86]},{31:[1,116]},{31:[2,56]},{66:[1,118],70:117},{31:[1,119]},{31:[2,62]},{14:[2,11]},{21:[2,28],31:[2,28],52:[2,28],62:[2,28],66:[2,28],69:[2,28]},{5:[2,20],13:[2,20],14:[2,20],17:[2,20],27:[2,20],32:[2,20],37:[2,20],42:[2,20],45:[2,20],46:[2,20],49:[2,20],53:[2,20]},{31:[2,67],40:120,68:121,69:[1,106]},{31:[2,64],59:[2,64],66:[2,64],69:[2,64],74:[2,64],75:[2,64],76:[2,64],77:[2,64]},{31:[2,66],69:[2,66]},{21:[2,26],31:[2,26],52:[2,26],59:[2,26],62:[2,26],66:[2,26],69:[2,26],74:[2,26],75:[2,26],76:[2,26],77:[2,26]},{13:[2,14],14:[2,14],17:[2,14],27:[2,14],32:[2,14],37:[2,14],42:[2,14],45:[2,14],46:[2,14],49:[2,14],53:[2,14]},{66:[1,123],71:[1,122]},{66:[2,89],71:[2,89]},{13:[2,15],14:[2,15],17:[2,15],27:[2,15],32:[2,15],42:[2,15],45:[2,15],46:[2,15],49:[2,15],53:[2,15]},{31:[1,124]},{31:[2,68]},{31:[2,29]},{66:[2,90],71:[2,90]},{13:[2,16],14:[2,16],17:[2,16],27:[2,16],32:[2,16],37:[2,16],42:[2,16],45:[2,16],46:[2,16],49:[2,16],53:[2,16]}], + defaultActions: {4:[2,1],47:[2,48],49:[2,19],53:[2,50],62:[2,74],71:[2,78],76:[2,17],80:[2,82],90:[2,46],97:[2,18],98:[2,70],103:[2,86],105:[2,56],108:[2,62],109:[2,11],121:[2,68],122:[2,29]}, parseError: function parseError(str, hash) { throw new Error(str); }, @@ -1279,100 +1317,114 @@ var __module9__ = (function() { } else { this.begin("mu"); } - if(yy_.yytext) return 12; + if(yy_.yytext) return 14; break; - case 1:return 12; + case 1:return 14; break; case 2: this.popState(); - return 12; + return 14; break; case 3: yy_.yytext = yy_.yytext.substr(5, yy_.yyleng-9); this.popState(); - return 15; + return 16; break; - case 4: return 12; + case 4: return 14; break; - case 5:strip(0,4); this.popState(); return 13; + case 5: + this.popState(); + return 13; + break; - case 6:return 45; + case 6:return 59; break; - case 7:return 46; + case 7:return 62; break; - case 8: return 16; + case 8: return 17; break; case 9: this.popState(); this.begin('raw'); - return 18; + return 21; break; - case 10:return 34; + case 10:return 53; break; - case 11:return 24; + case 11:return 27; break; - case 12:return 29; + case 12:return 45; break; - case 13:this.popState(); return 28; + case 13:this.popState(); return 42; break; - case 14:this.popState(); return 28; + case 14:this.popState(); return 42; break; - case 15:return 26; + case 15:return 32; break; - case 16:return 26; + case 16:return 37; break; - case 17:return 32; + case 17:return 49; break; - case 18:return 31; + case 18:return 46; break; - case 19:this.popState(); this.begin('com'); + case 19: + this.unput(yy_.yytext); + this.popState(); + this.begin('com'); + break; - case 20:strip(3,5); this.popState(); return 13; + case 20: + this.popState(); + return 13; + break; - case 21:return 31; + case 21:return 46; break; - case 22:return 51; + case 22:return 67; break; - case 23:return 50; + case 23:return 66; break; - case 24:return 50; + case 24:return 66; break; - case 25:return 54; + case 25:return 79; break; case 26:// ignore whitespace break; - case 27:this.popState(); return 33; + case 27:this.popState(); return 52; + break; + case 28:this.popState(); return 31; + break; + case 29:yy_.yytext = strip(1,2).replace(/\\"/g,'"'); return 74; break; - case 28:this.popState(); return 25; + case 30:yy_.yytext = strip(1,2).replace(/\\'/g,"'"); return 74; break; - case 29:yy_.yytext = strip(1,2).replace(/\\"/g,'"'); return 42; + case 31:return 77; break; - case 30:yy_.yytext = strip(1,2).replace(/\\'/g,"'"); return 42; + case 32:return 76; break; - case 31:return 52; + case 33:return 76; break; - case 32:return 44; + case 34:return 75; break; - case 33:return 44; + case 35:return 69; break; - case 34:return 43; + case 36:return 71; break; - case 35:return 50; + case 37:return 66; break; - case 36:yy_.yytext = strip(1,2); return 50; + case 38:yy_.yytext = strip(1,2); return 66; break; - case 37:return 'INVALID'; + case 39:return 'INVALID'; break; - case 38:return 5; + case 40:return 5; break; } }; - lexer.rules = [/^(?:[^\x00]*?(?=(\{\{)))/,/^(?:[^\x00]+)/,/^(?:[^\x00]{2,}?(?=(\{\{|\\\{\{|\\\\\{\{|$)))/,/^(?:\{\{\{\{\/[^\s!"#%-,\.\/;->@\[-\^`\{-~]+(?=[=}\s\/.])\}\}\}\})/,/^(?:[^\x00]*?(?=(\{\{\{\{\/)))/,/^(?:[\s\S]*?--\}\})/,/^(?:\()/,/^(?:\))/,/^(?:\{\{\{\{)/,/^(?:\}\}\}\})/,/^(?:\{\{(~)?>)/,/^(?:\{\{(~)?#)/,/^(?:\{\{(~)?\/)/,/^(?:\{\{(~)?\^\s*(~)?\}\})/,/^(?:\{\{(~)?\s*else\s*(~)?\}\})/,/^(?:\{\{(~)?\^)/,/^(?:\{\{(~)?\s*else\b)/,/^(?:\{\{(~)?\{)/,/^(?:\{\{(~)?&)/,/^(?:\{\{!--)/,/^(?:\{\{![\s\S]*?\}\})/,/^(?:\{\{(~)?)/,/^(?:=)/,/^(?:\.\.)/,/^(?:\.(?=([=~}\s\/.)])))/,/^(?:[\/.])/,/^(?:\s+)/,/^(?:\}(~)?\}\})/,/^(?:(~)?\}\})/,/^(?:"(\\["]|[^"])*")/,/^(?:'(\\[']|[^'])*')/,/^(?:@)/,/^(?:true(?=([~}\s)])))/,/^(?:false(?=([~}\s)])))/,/^(?:-?[0-9]+(?:\.[0-9]+)?(?=([~}\s)])))/,/^(?:([^\s!"#%-,\.\/;->@\[-\^`\{-~]+(?=([=~}\s\/.)]))))/,/^(?:\[[^\]]*\])/,/^(?:.)/,/^(?:$)/]; - lexer.conditions = {"mu":{"rules":[6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38],"inclusive":false},"emu":{"rules":[2],"inclusive":false},"com":{"rules":[5],"inclusive":false},"raw":{"rules":[3,4],"inclusive":false},"INITIAL":{"rules":[0,1,38],"inclusive":true}}; + lexer.rules = [/^(?:[^\x00]*?(?=(\{\{)))/,/^(?:[^\x00]+)/,/^(?:[^\x00]{2,}?(?=(\{\{|\\\{\{|\\\\\{\{|$)))/,/^(?:\{\{\{\{\/[^\s!"#%-,\.\/;->@\[-\^`\{-~]+(?=[=}\s\/.])\}\}\}\})/,/^(?:[^\x00]*?(?=(\{\{\{\{\/)))/,/^(?:[\s\S]*?--(~)?\}\})/,/^(?:\()/,/^(?:\))/,/^(?:\{\{\{\{)/,/^(?:\}\}\}\})/,/^(?:\{\{(~)?>)/,/^(?:\{\{(~)?#)/,/^(?:\{\{(~)?\/)/,/^(?:\{\{(~)?\^\s*(~)?\}\})/,/^(?:\{\{(~)?\s*else\s*(~)?\}\})/,/^(?:\{\{(~)?\^)/,/^(?:\{\{(~)?\s*else\b)/,/^(?:\{\{(~)?\{)/,/^(?:\{\{(~)?&)/,/^(?:\{\{(~)?!--)/,/^(?:\{\{(~)?![\s\S]*?\}\})/,/^(?:\{\{(~)?)/,/^(?:=)/,/^(?:\.\.)/,/^(?:\.(?=([=~}\s\/.)|])))/,/^(?:[\/.])/,/^(?:\s+)/,/^(?:\}(~)?\}\})/,/^(?:(~)?\}\})/,/^(?:"(\\["]|[^"])*")/,/^(?:'(\\[']|[^'])*')/,/^(?:@)/,/^(?:true(?=([~}\s)])))/,/^(?:false(?=([~}\s)])))/,/^(?:-?[0-9]+(?:\.[0-9]+)?(?=([~}\s)])))/,/^(?:as\s+\|)/,/^(?:\|)/,/^(?:([^\s!"#%-,\.\/;->@\[-\^`\{-~]+(?=([=~}\s\/.)|]))))/,/^(?:\[[^\]]*\])/,/^(?:.)/,/^(?:$)/]; + lexer.conditions = {"mu":{"rules":[6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40],"inclusive":false},"emu":{"rules":[2],"inclusive":false},"com":{"rules":[5],"inclusive":false},"raw":{"rules":[3,4],"inclusive":false},"INITIAL":{"rules":[0,1,40],"inclusive":true}}; return lexer;})() parser.lexer = lexer; function Parser () { this.yy = {}; }Parser.prototype = parser;parser.Parser = Parser; @@ -1382,176 +1434,328 @@ var __module9__ = (function() { return __exports__; })(); -// handlebars/compiler/helpers.js -var __module10__ = (function(__dependency1__) { +// handlebars/compiler/visitor.js +var __module11__ = (function(__dependency1__, __dependency2__) { "use strict"; - var __exports__ = {}; + var __exports__; var Exception = __dependency1__; + var AST = __dependency2__; - function stripFlags(open, close) { - return { - left: open.charAt(2) === '~', - right: close.charAt(close.length-3) === '~' - }; + function Visitor() { + this.parents = []; } - __exports__.stripFlags = stripFlags; - function prepareBlock(mustache, program, inverseAndProgram, close, inverted, locInfo) { - /*jshint -W040 */ - if (mustache.sexpr.id.original !== close.path.original) { - throw new Exception(mustache.sexpr.id.original + ' doesn\'t match ' + close.path.original, mustache); - } - - var inverse = inverseAndProgram && inverseAndProgram.program; - - var strip = { - left: mustache.strip.left, - right: close.strip.right, + Visitor.prototype = { + constructor: Visitor, + mutating: false, + + // Visits a given value. If mutating, will replace the value if necessary. + acceptKey: function(node, name) { + var value = this.accept(node[name]); + if (this.mutating) { + // Hacky sanity check: + if (value && (!value.type || !AST[value.type])) { + throw new Exception('Unexpected node type "' + value.type + '" found when accepting ' + name + ' on ' + node.type); + } + node[name] = value; + } + }, - // Determine the standalone candiacy. Basically flag our content as being possibly standalone - // so our parent can determine if we actually are standalone - openStandalone: isNextWhitespace(program.statements), - closeStandalone: isPrevWhitespace((inverse || program).statements) - }; + // Performs an accept operation with added sanity check to ensure + // required keys are not removed. + acceptRequired: function(node, name) { + this.acceptKey(node, name); - if (mustache.strip.right) { - omitRight(program.statements, null, true); - } + if (!node[name]) { + throw new Exception(node.type + ' requires ' + name); + } + }, - if (inverse) { - var inverseStrip = inverseAndProgram.strip; + // Traverses a given array. If mutating, empty respnses will be removed + // for child elements. + acceptArray: function(array) { + for (var i = 0, l = array.length; i < l; i++) { + this.acceptKey(array, i); - if (inverseStrip.left) { - omitLeft(program.statements, null, true); + if (!array[i]) { + array.splice(i, 1); + i--; + l--; + } } - if (inverseStrip.right) { - omitRight(inverse.statements, null, true); + }, + + accept: function(object) { + if (!object) { + return; } - if (close.strip.left) { - omitLeft(inverse.statements, null, true); + + if (this.current) { + this.parents.unshift(this.current); } + this.current = object; - // Find standalone else statments - if (isPrevWhitespace(program.statements) - && isNextWhitespace(inverse.statements)) { + var ret = this[object.type](object); - omitLeft(program.statements); - omitRight(inverse.statements); - } - } else { - if (close.strip.left) { - omitLeft(program.statements, null, true); + this.current = this.parents.shift(); + + if (!this.mutating || ret) { + return ret; + } else if (ret !== false) { + return object; } - } + }, - if (inverted) { - return new this.BlockNode(mustache, inverse, program, strip, locInfo); - } else { - return new this.BlockNode(mustache, program, inverse, strip, locInfo); + Program: function(program) { + this.acceptArray(program.body); + }, + + MustacheStatement: function(mustache) { + this.acceptRequired(mustache, 'path'); + this.acceptArray(mustache.params); + this.acceptKey(mustache, 'hash'); + }, + + BlockStatement: function(block) { + this.acceptRequired(block, 'path'); + this.acceptArray(block.params); + this.acceptKey(block, 'hash'); + + this.acceptKey(block, 'program'); + this.acceptKey(block, 'inverse'); + }, + + PartialStatement: function(partial) { + this.acceptRequired(partial, 'name'); + this.acceptArray(partial.params); + this.acceptKey(partial, 'hash'); + }, + + ContentStatement: function(/* content */) {}, + CommentStatement: function(/* comment */) {}, + + SubExpression: function(sexpr) { + this.acceptRequired(sexpr, 'path'); + this.acceptArray(sexpr.params); + this.acceptKey(sexpr, 'hash'); + }, + PartialExpression: function(partial) { + this.acceptRequired(partial, 'name'); + this.acceptArray(partial.params); + this.acceptKey(partial, 'hash'); + }, + + PathExpression: function(/* path */) {}, + + StringLiteral: function(/* string */) {}, + NumberLiteral: function(/* number */) {}, + BooleanLiteral: function(/* bool */) {}, + + Hash: function(hash) { + this.acceptArray(hash.pairs); + }, + HashPair: function(pair) { + this.acceptRequired(pair, 'value'); } + }; + + __exports__ = Visitor; + return __exports__; +})(__module4__, __module7__); + +// handlebars/compiler/whitespace-control.js +var __module10__ = (function(__dependency1__) { + "use strict"; + var __exports__; + var Visitor = __dependency1__; + + function WhitespaceControl() { } + WhitespaceControl.prototype = new Visitor(); - __exports__.prepareBlock = prepareBlock; - function prepareProgram(statements, isRoot) { - for (var i = 0, l = statements.length; i < l; i++) { - var current = statements[i], - strip = current.strip; + WhitespaceControl.prototype.Program = function(program) { + var isRoot = !this.isRootSeen; + this.isRootSeen = true; + + var body = program.body; + for (var i = 0, l = body.length; i < l; i++) { + var current = body[i], + strip = this.accept(current); if (!strip) { continue; } - var _isPrevWhitespace = isPrevWhitespace(statements, i, isRoot, current.type === 'partial'), - _isNextWhitespace = isNextWhitespace(statements, i, isRoot), + var _isPrevWhitespace = isPrevWhitespace(body, i, isRoot), + _isNextWhitespace = isNextWhitespace(body, i, isRoot), openStandalone = strip.openStandalone && _isPrevWhitespace, closeStandalone = strip.closeStandalone && _isNextWhitespace, inlineStandalone = strip.inlineStandalone && _isPrevWhitespace && _isNextWhitespace; - if (strip.right) { - omitRight(statements, i, true); + if (strip.close) { + omitRight(body, i, true); } - if (strip.left) { - omitLeft(statements, i, true); + if (strip.open) { + omitLeft(body, i, true); } if (inlineStandalone) { - omitRight(statements, i); + omitRight(body, i); - if (omitLeft(statements, i)) { + if (omitLeft(body, i)) { // If we are on a standalone node, save the indent info for partials - if (current.type === 'partial') { - current.indent = (/([ \t]+$)/).exec(statements[i-1].original) ? RegExp.$1 : ''; + if (current.type === 'PartialStatement') { + // Pull out the whitespace from the final line + current.indent = (/([ \t]+$)/).exec(body[i-1].original)[1]; } } } if (openStandalone) { - omitRight((current.program || current.inverse).statements); + omitRight((current.program || current.inverse).body); // Strip out the previous content node if it's whitespace only - omitLeft(statements, i); + omitLeft(body, i); } if (closeStandalone) { // Always strip the next node - omitRight(statements, i); + omitRight(body, i); - omitLeft((current.inverse || current.program).statements); + omitLeft((current.inverse || current.program).body); } } - return statements; - } + return program; + }; + WhitespaceControl.prototype.BlockStatement = function(block) { + this.accept(block.program); + this.accept(block.inverse); - __exports__.prepareProgram = prepareProgram;function isPrevWhitespace(statements, i, isRoot) { - if (i === undefined) { - i = statements.length; - } + // Find the inverse program that is involed with whitespace stripping. + var program = block.program || block.inverse, + inverse = block.program && block.inverse, + firstInverse = inverse, + lastInverse = inverse; - // Nodes that end with newlines are considered whitespace (but are special - // cased for strip operations) - var prev = statements[i-1], - sibling = statements[i-2]; - if (!prev) { - return isRoot; - } + if (inverse && inverse.chained) { + firstInverse = inverse.body[0].program; - if (prev.type === 'content') { - return (sibling || !isRoot ? (/\r?\n\s*?$/) : (/(^|\r?\n)\s*?$/)).test(prev.original); - } - } - function isNextWhitespace(statements, i, isRoot) { - if (i === undefined) { - i = -1; + // Walk the inverse chain to find the last inverse that is actually in the chain. + while (lastInverse.chained) { + lastInverse = lastInverse.body[lastInverse.body.length-1].program; + } } - var next = statements[i+1], - sibling = statements[i+2]; - if (!next) { - return isRoot; - } + var strip = { + open: block.openStrip.open, + close: block.closeStrip.close, - if (next.type === 'content') { - return (sibling || !isRoot ? (/^\s*?\r?\n/) : (/^\s*?(\r?\n|$)/)).test(next.original); - } - } + // Determine the standalone candiacy. Basically flag our content as being possibly standalone + // so our parent can determine if we actually are standalone + openStandalone: isNextWhitespace(program.body), + closeStandalone: isPrevWhitespace((firstInverse || program).body) + }; - // Marks the node to the right of the position as omitted. - // I.e. {{foo}}' ' will mark the ' ' node as omitted. - // - // If i is undefined, then the first child will be marked as such. - // - // If mulitple is truthy then all whitespace will be stripped out until non-whitespace - // content is met. - function omitRight(statements, i, multiple) { - var current = statements[i == null ? 0 : i + 1]; - if (!current || current.type !== 'content' || (!multiple && current.rightStripped)) { - return; + if (block.openStrip.close) { + omitRight(program.body, null, true); } - var original = current.string; - current.string = current.string.replace(multiple ? (/^\s+/) : (/^[ \t]*\r?\n?/), ''); - current.rightStripped = current.string !== original; - } + if (inverse) { + var inverseStrip = block.inverseStrip; + + if (inverseStrip.open) { + omitLeft(program.body, null, true); + } + + if (inverseStrip.close) { + omitRight(firstInverse.body, null, true); + } + if (block.closeStrip.open) { + omitLeft(lastInverse.body, null, true); + } + + // Find standalone else statments + if (isPrevWhitespace(program.body) + && isNextWhitespace(firstInverse.body)) { + + omitLeft(program.body); + omitRight(firstInverse.body); + } + } else { + if (block.closeStrip.open) { + omitLeft(program.body, null, true); + } + } + + return strip; + }; + + WhitespaceControl.prototype.MustacheStatement = function(mustache) { + return mustache.strip; + }; + + WhitespaceControl.prototype.PartialStatement = + WhitespaceControl.prototype.CommentStatement = function(node) { + /* istanbul ignore next */ + var strip = node.strip || {}; + return { + inlineStandalone: true, + open: strip.open, + close: strip.close + }; + }; + + + function isPrevWhitespace(body, i, isRoot) { + if (i === undefined) { + i = body.length; + } + + // Nodes that end with newlines are considered whitespace (but are special + // cased for strip operations) + var prev = body[i-1], + sibling = body[i-2]; + if (!prev) { + return isRoot; + } + + if (prev.type === 'ContentStatement') { + return (sibling || !isRoot ? (/\r?\n\s*?$/) : (/(^|\r?\n)\s*?$/)).test(prev.original); + } + } + function isNextWhitespace(body, i, isRoot) { + if (i === undefined) { + i = -1; + } + + var next = body[i+1], + sibling = body[i+2]; + if (!next) { + return isRoot; + } + + if (next.type === 'ContentStatement') { + return (sibling || !isRoot ? (/^\s*?\r?\n/) : (/^\s*?(\r?\n|$)/)).test(next.original); + } + } + + // Marks the node to the right of the position as omitted. + // I.e. {{foo}}' ' will mark the ' ' node as omitted. + // + // If i is undefined, then the first child will be marked as such. + // + // If mulitple is truthy then all whitespace will be stripped out until non-whitespace + // content is met. + function omitRight(body, i, multiple) { + var current = body[i == null ? 0 : i + 1]; + if (!current || current.type !== 'ContentStatement' || (!multiple && current.rightStripped)) { + return; + } + + var original = current.value; + current.value = current.value.replace(multiple ? (/^\s+/) : (/^[ \t]*\r?\n?/), ''); + current.rightStripped = current.value !== original; + } // Marks the node to the left of the position as omitted. // I.e. ' '{{foo}} will mark the ' ' node as omitted. @@ -1560,57 +1764,194 @@ var __module10__ = (function(__dependency1__) { // // If mulitple is truthy then all whitespace will be stripped out until non-whitespace // content is met. - function omitLeft(statements, i, multiple) { - var current = statements[i == null ? statements.length - 1 : i - 1]; - if (!current || current.type !== 'content' || (!multiple && current.leftStripped)) { + function omitLeft(body, i, multiple) { + var current = body[i == null ? body.length - 1 : i - 1]; + if (!current || current.type !== 'ContentStatement' || (!multiple && current.leftStripped)) { return; } // We omit the last node if it's whitespace only and not preceeded by a non-content node. - var original = current.string; - current.string = current.string.replace(multiple ? (/\s+$/) : (/[ \t]+$/), ''); - current.leftStripped = current.string !== original; + var original = current.value; + current.value = current.value.replace(multiple ? (/\s+$/) : (/[ \t]+$/), ''); + current.leftStripped = current.value !== original; return current.leftStripped; } + + __exports__ = WhitespaceControl; + return __exports__; +})(__module11__); + +// handlebars/compiler/helpers.js +var __module12__ = (function(__dependency1__) { + "use strict"; + var __exports__ = {}; + var Exception = __dependency1__; + + function SourceLocation(source, locInfo) { + this.source = source; + this.start = { + line: locInfo.first_line, + column: locInfo.first_column + }; + this.end = { + line: locInfo.last_line, + column: locInfo.last_column + }; + } + + __exports__.SourceLocation = SourceLocation;function stripFlags(open, close) { + return { + open: open.charAt(2) === '~', + close: close.charAt(close.length-3) === '~' + }; + } + + __exports__.stripFlags = stripFlags;function stripComment(comment) { + return comment.replace(/^\{\{~?\!-?-?/, '') + .replace(/-?-?~?\}\}$/, ''); + } + + __exports__.stripComment = stripComment;function preparePath(data, parts, locInfo) { + /*jshint -W040 */ + locInfo = this.locInfo(locInfo); + + var original = data ? '@' : '', + dig = [], + depth = 0, + depthString = ''; + + for(var i=0,l=parts.length; i 0) { + throw new Exception('Invalid path: ' + original, {loc: locInfo}); + } else if (part === '..') { + depth++; + depthString += '../'; + } + } else { + dig.push(part); + } + } + + return new this.PathExpression(data, depth, dig, original, locInfo); + } + + __exports__.preparePath = preparePath;function prepareMustache(path, params, hash, open, strip, locInfo) { + /*jshint -W040 */ + // Must use charAt to support IE pre-10 + var escapeFlag = open.charAt(3) || open.charAt(2), + escaped = escapeFlag !== '{' && escapeFlag !== '&'; + + return new this.MustacheStatement(path, params, hash, escaped, strip, this.locInfo(locInfo)); + } + + __exports__.prepareMustache = prepareMustache;function prepareRawBlock(openRawBlock, content, close, locInfo) { + /*jshint -W040 */ + if (openRawBlock.path.original !== close) { + var errorNode = {loc: openRawBlock.path.loc}; + + throw new Exception(openRawBlock.path.original + " doesn't match " + close, errorNode); + } + + locInfo = this.locInfo(locInfo); + var program = new this.Program([content], null, {}, locInfo); + + return new this.BlockStatement( + openRawBlock.path, openRawBlock.params, openRawBlock.hash, + program, undefined, + {}, {}, {}, + locInfo); + } + + __exports__.prepareRawBlock = prepareRawBlock;function prepareBlock(openBlock, program, inverseAndProgram, close, inverted, locInfo) { + /*jshint -W040 */ + // When we are chaining inverse calls, we will not have a close path + if (close && close.path && openBlock.path.original !== close.path.original) { + var errorNode = {loc: openBlock.path.loc}; + + throw new Exception(openBlock.path.original + ' doesn\'t match ' + close.path.original, errorNode); + } + + program.blockParams = openBlock.blockParams; + + var inverse, + inverseStrip; + + if (inverseAndProgram) { + if (inverseAndProgram.chain) { + inverseAndProgram.program.body[0].closeStrip = close.strip; + } + + inverseStrip = inverseAndProgram.strip; + inverse = inverseAndProgram.program; + } + + if (inverted) { + inverted = inverse; + inverse = program; + program = inverted; + } + + return new this.BlockStatement( + openBlock.path, openBlock.params, openBlock.hash, + program, inverse, + openBlock.strip, inverseStrip, close && close.strip, + this.locInfo(locInfo)); + } + + __exports__.prepareBlock = prepareBlock; return __exports__; -})(__module5__); +})(__module4__); // handlebars/compiler/base.js -var __module8__ = (function(__dependency1__, __dependency2__, __dependency3__, __dependency4__) { +var __module8__ = (function(__dependency1__, __dependency2__, __dependency3__, __dependency4__, __dependency5__) { "use strict"; var __exports__ = {}; var parser = __dependency1__; var AST = __dependency2__; - var Helpers = __dependency3__; - var extend = __dependency4__.extend; + var WhitespaceControl = __dependency3__; + var Helpers = __dependency4__; + var extend = __dependency5__.extend; __exports__.parser = parser; var yy = {}; extend(yy, Helpers, AST); - function parse(input) { - // Just return if an already-compile AST was passed in. - if (input.constructor === AST.ProgramNode) { return input; } + function parse(input, options) { + // Just return if an already-compiled AST was passed in. + if (input.type === 'Program') { return input; } parser.yy = yy; - return parser.parse(input); + // Altering the shared object here, but this is ok as parser is a sync operation + yy.locInfo = function(locInfo) { + return new yy.SourceLocation(options && options.srcName, locInfo); + }; + + var strip = new WhitespaceControl(); + return strip.accept(parser.parse(input)); } __exports__.parse = parse; return __exports__; -})(__module9__, __module7__, __module10__, __module3__); +})(__module9__, __module7__, __module10__, __module12__, __module3__); // handlebars/compiler/compiler.js -var __module11__ = (function(__dependency1__, __dependency2__) { +var __module13__ = (function(__dependency1__, __dependency2__, __dependency3__) { "use strict"; var __exports__ = {}; var Exception = __dependency1__; var isArray = __dependency2__.isArray; + var indexOf = __dependency2__.indexOf; + var AST = __dependency3__; var slice = [].slice; + function Compiler() {} __exports__.Compiler = Compiler;// the foundHelper register will disambiguate helper lookup from finding a @@ -1650,16 +1991,18 @@ var __module11__ = (function(__dependency1__, __dependency2__) { guid: 0, compile: function(program, options) { + this.sourceNode = []; this.opcodes = []; this.children = []; - this.depths = {list: []}; this.options = options; this.stringParams = options.stringParams; this.trackIds = options.trackIds; + options.blockParams = options.blockParams || []; + // These changes will propagate to the other compiler components - var knownHelpers = this.options.knownHelpers; - this.options.knownHelpers = { + var knownHelpers = options.knownHelpers; + options.knownHelpers = { 'helperMissing': true, 'blockHelperMissing': true, 'each': true, @@ -1671,79 +2014,72 @@ var __module11__ = (function(__dependency1__, __dependency2__) { }; if (knownHelpers) { for (var name in knownHelpers) { - this.options.knownHelpers[name] = knownHelpers[name]; + options.knownHelpers[name] = knownHelpers[name]; } } return this.accept(program); }, - accept: function(node) { - return this[node.type](node); - }, - - program: function(program) { - var statements = program.statements; - - for(var i=0, l=statements.length; i 1) { + throw new Exception('Unsupported number of partial arguments: ' + params.length, partial); + } else if (!params.length) { + params.push({type: 'PathExpression', parts: [], depth: 0}); } - if (partial.context) { - this.accept(partial.context); - } else { - this.opcode('getContext', 0); - this.opcode('pushContext'); + var partialName = partial.name.original, + isDynamic = partial.name.type === 'SubExpression'; + if (isDynamic) { + this.accept(partial.name); } - this.opcode('invokePartial', partialName.name, partial.indent || ''); - this.opcode('append'); - }, + this.setupFullMustacheParams(partial, undefined, undefined, true); - content: function(content) { - if (content.string) { - this.opcode('appendContent', content.string); + var indent = partial.indent || ''; + if (this.options.preventIndent && indent) { + this.opcode('appendContent', indent); + indent = ''; } + + this.opcode('invokePartial', isDynamic, partialName, indent); + this.opcode('append'); }, - mustache: function(mustache) { - this.sexpr(mustache.sexpr); + MustacheStatement: function(mustache) { + this.SubExpression(mustache); if(mustache.escaped && !this.options.noEscape) { this.opcode('appendEscaped'); @@ -1807,122 +2130,143 @@ var __module11__ = (function(__dependency1__, __dependency2__) { } }, + ContentStatement: function(content) { + if (content.value) { + this.opcode('appendContent', content.value); + } + }, + + CommentStatement: function() {}, + + SubExpression: function(sexpr) { + transformLiteralToPath(sexpr); + var type = this.classifySexpr(sexpr); + + if (type === 'simple') { + this.simpleSexpr(sexpr); + } else if (type === 'helper') { + this.helperSexpr(sexpr); + } else { + this.ambiguousSexpr(sexpr); + } + }, ambiguousSexpr: function(sexpr, program, inverse) { - var id = sexpr.id, - name = id.parts[0], + var path = sexpr.path, + name = path.parts[0], isBlock = program != null || inverse != null; - this.opcode('getContext', id.depth); + this.opcode('getContext', path.depth); this.opcode('pushProgram', program); this.opcode('pushProgram', inverse); - this.ID(id); + this.accept(path); this.opcode('invokeAmbiguous', name, isBlock); }, simpleSexpr: function(sexpr) { - var id = sexpr.id; - - if (id.type === 'DATA') { - this.DATA(id); - } else if (id.parts.length) { - this.ID(id); - } else { - // Simplified ID for `this` - this.addDepth(id.depth); - this.opcode('getContext', id.depth); - this.opcode('pushContext'); - } - + this.accept(sexpr.path); this.opcode('resolvePossibleLambda'); }, helperSexpr: function(sexpr, program, inverse) { var params = this.setupFullMustacheParams(sexpr, program, inverse), - id = sexpr.id, - name = id.parts[0]; + path = sexpr.path, + name = path.parts[0]; if (this.options.knownHelpers[name]) { this.opcode('invokeKnownHelper', params.length, name); } else if (this.options.knownHelpersOnly) { throw new Exception("You specified knownHelpersOnly, but used the unknown helper " + name, sexpr); } else { - id.falsy = true; + path.falsy = true; - this.ID(id); - this.opcode('invokeHelper', params.length, id.original, id.isSimple); + this.accept(path); + this.opcode('invokeHelper', params.length, path.original, AST.helpers.simpleId(path)); } }, - sexpr: function(sexpr) { - var type = this.classifySexpr(sexpr); - - if (type === "simple") { - this.simpleSexpr(sexpr); - } else if (type === "helper") { - this.helperSexpr(sexpr); - } else { - this.ambiguousSexpr(sexpr); - } - }, + PathExpression: function(path) { + this.addDepth(path.depth); + this.opcode('getContext', path.depth); - ID: function(id) { - this.addDepth(id.depth); - this.opcode('getContext', id.depth); + var name = path.parts[0], + scoped = AST.helpers.scopedId(path), + blockParamId = !path.depth && !scoped && this.blockParamIndex(name); - var name = id.parts[0]; - if (!name) { + if (blockParamId) { + this.opcode('lookupBlockParam', blockParamId, path.parts); + } else if (!name) { // Context reference, i.e. `{{foo .}}` or `{{foo ..}}` this.opcode('pushContext'); + } else if (path.data) { + this.options.data = true; + this.opcode('lookupData', path.depth, path.parts); } else { - this.opcode('lookupOnContext', id.parts, id.falsy, id.isScoped); + this.opcode('lookupOnContext', path.parts, path.falsy, scoped); } }, - DATA: function(data) { - this.options.data = true; - this.opcode('lookupData', data.id.depth, data.id.parts); + StringLiteral: function(string) { + this.opcode('pushString', string.value); }, - STRING: function(string) { - this.opcode('pushString', string.string); + NumberLiteral: function(number) { + this.opcode('pushLiteral', number.value); }, - NUMBER: function(number) { - this.opcode('pushLiteral', number.number); + BooleanLiteral: function(bool) { + this.opcode('pushLiteral', bool.value); }, - BOOLEAN: function(bool) { - this.opcode('pushLiteral', bool.bool); - }, + Hash: function(hash) { + var pairs = hash.pairs, i, l; + + this.opcode('pushHash'); - comment: function() {}, + for (i=0, l=pairs.length; i= 0) { + return [depth, param]; + } + } } }; function precompile(input, options, env) { - if (input == null || (typeof input !== 'string' && input.constructor !== env.AST.ProgramNode)) { + if (input == null || (typeof input !== 'string' && input.type !== 'Program')) { throw new Exception("You must pass a string or Handlebars AST to Handlebars.precompile. You passed " + input); } @@ -1993,13 +2371,13 @@ var __module11__ = (function(__dependency1__, __dependency2__) { options.useDepths = true; } - var ast = env.parse(input); + var ast = env.parse(input, options); var environment = new env.Compiler().compile(ast, options); return new env.JavaScriptCompiler().compile(environment, options); } __exports__.precompile = precompile;function compile(input, options, env) { - if (input == null || (typeof input !== 'string' && input.constructor !== env.AST.ProgramNode)) { + if (input == null || (typeof input !== 'string' && input.type !== 'Program')) { throw new Exception("You must pass a string or Handlebars AST to Handlebars.compile. You passed " + input); } @@ -2015,7 +2393,7 @@ var __module11__ = (function(__dependency1__, __dependency2__) { var compiled; function compileInput() { - var ast = env.parse(input); + var ast = env.parse(input, options); var environment = new env.Compiler().compile(ast, options); var templateSpec = new env.JavaScriptCompiler().compile(environment, options, undefined, true); return env.template(templateSpec); @@ -2034,11 +2412,11 @@ var __module11__ = (function(__dependency1__, __dependency2__) { } return compiled._setup(options); }; - ret._child = function(i, data, depths) { + ret._child = function(i, data, blockParams, depths) { if (!compiled) { compiled = compileInput(); } - return compiled._child(i, data, depths); + return compiled._child(i, data, blockParams, depths); }; return ret; } @@ -2057,16 +2435,187 @@ var __module11__ = (function(__dependency1__, __dependency2__) { return true; } } + + function transformLiteralToPath(sexpr) { + if (!sexpr.path.parts) { + var literal = sexpr.path; + // Casting to string here to make false and 0 literal values play nicely with the rest + // of the system. + sexpr.path = new AST.PathExpression(false, 0, [literal.original+''], literal.original+'', literal.log); + } + } + return __exports__; +})(__module4__, __module3__, __module7__); + +// handlebars/compiler/code-gen.js +var __module15__ = (function(__dependency1__) { + "use strict"; + var __exports__; + var isArray = __dependency1__.isArray; + + try { + var SourceMap = require('source-map'), + SourceNode = SourceMap.SourceNode; + } catch (err) { + /* istanbul ignore next: tested but not covered in istanbul due to dist build */ + SourceNode = function(line, column, srcFile, chunks) { + this.src = ''; + if (chunks) { + this.add(chunks); + } + }; + /* istanbul ignore next */ + SourceNode.prototype = { + add: function(chunks) { + if (isArray(chunks)) { + chunks = chunks.join(''); + } + this.src += chunks; + }, + prepend: function(chunks) { + if (isArray(chunks)) { + chunks = chunks.join(''); + } + this.src = chunks + this.src; + }, + toStringWithSourceMap: function() { + return {code: this.toString()}; + }, + toString: function() { + return this.src; + } + }; + } + + + function castChunk(chunk, codeGen, loc) { + if (isArray(chunk)) { + var ret = []; + + for (var i = 0, len = chunk.length; i < len; i++) { + ret.push(codeGen.wrap(chunk[i], loc)); + } + return ret; + } else if (typeof chunk === 'boolean' || typeof chunk === 'number') { + // Handle primitives that the SourceNode will throw up on + return chunk+''; + } + return chunk; + } + + + function CodeGen(srcFile) { + this.srcFile = srcFile; + this.source = []; + } + + CodeGen.prototype = { + prepend: function(source, loc) { + this.source.unshift(this.wrap(source, loc)); + }, + push: function(source, loc) { + this.source.push(this.wrap(source, loc)); + }, + + merge: function() { + var source = this.empty(); + this.each(function(line) { + source.add([' ', line, '\n']); + }); + return source; + }, + + each: function(iter) { + for (var i = 0, len = this.source.length; i < len; i++) { + iter(this.source[i]); + } + }, + + empty: function(loc) { + loc = loc || this.currentLocation || {start:{}}; + return new SourceNode(loc.start.line, loc.start.column, this.srcFile); + }, + wrap: function(chunk, loc) { + if (chunk instanceof SourceNode) { + return chunk; + } + + loc = loc || this.currentLocation || {start:{}}; + chunk = castChunk(chunk, this, loc); + + return new SourceNode(loc.start.line, loc.start.column, this.srcFile, chunk); + }, + + functionCall: function(fn, type, params) { + params = this.generateList(params); + return this.wrap([fn, type ? '.' + type + '(' : '(', params, ')']); + }, + + quotedString: function(str) { + return '"' + (str + '') + .replace(/\\/g, '\\\\') + .replace(/"/g, '\\"') + .replace(/\n/g, '\\n') + .replace(/\r/g, '\\r') + .replace(/\u2028/g, '\\u2028') // Per Ecma-262 7.3 + 7.8.4 + .replace(/\u2029/g, '\\u2029') + '"'; + }, + + objectLiteral: function(obj) { + var pairs = []; + + for (var key in obj) { + if (obj.hasOwnProperty(key)) { + var value = castChunk(obj[key], this); + if (value !== 'undefined') { + pairs.push([this.quotedString(key), ':', value]); + } + } + } + + var ret = this.generateList(pairs); + ret.prepend('{'); + ret.add('}'); + return ret; + }, + + + generateList: function(entries, loc) { + var ret = this.empty(loc); + + for (var i = 0, len = entries.length; i < len; i++) { + if (i) { + ret.add(','); + } + + ret.add(castChunk(entries[i], this, loc)); + } + + return ret; + }, + + generateArray: function(entries, loc) { + var ret = this.generateList(entries, loc); + ret.prepend('['); + ret.add(']'); + + return ret; + } + }; + + __exports__ = CodeGen; return __exports__; -})(__module5__, __module3__); +})(__module3__); // handlebars/compiler/javascript-compiler.js -var __module12__ = (function(__dependency1__, __dependency2__) { +var __module14__ = (function(__dependency1__, __dependency2__, __dependency3__, __dependency4__) { "use strict"; var __exports__; var COMPILER_REVISION = __dependency1__.COMPILER_REVISION; var REVISION_CHANGES = __dependency1__.REVISION_CHANGES; var Exception = __dependency2__; + var isArray = __dependency3__.isArray; + var CodeGen = __dependency4__; function Literal(value) { this.value = value; @@ -2079,15 +2628,13 @@ var __module12__ = (function(__dependency1__, __dependency2__) { // alternative compiled forms for name lookup and buffering semantics nameLookup: function(parent, name /* , type*/) { if (JavaScriptCompiler.isValidJavaScriptVariableName(name)) { - return parent + "." + name; + return [parent, ".", name]; } else { - return parent + "['" + name + "']"; + return [parent, "['", name, "']"]; } }, depthedLookup: function(name) { - this.aliases.lookup = 'this.lookup'; - - return 'lookup(depths, "' + name + '")'; + return [this.aliasable('this.lookup'), '(depths, "', name, '")']; }, compilerInfo: function() { @@ -2096,23 +2643,29 @@ var __module12__ = (function(__dependency1__, __dependency2__) { return [revision, versions]; }, - appendToBuffer: function(string) { + appendToBuffer: function(source, location, explicit) { + // Force a source as this simplifies the merge logic. + if (!isArray(source)) { + source = [source]; + } + source = this.source.wrap(source, location); + if (this.environment.isSimple) { - return "return " + string + ";"; + return ['return ', source, ';']; + } else if (explicit) { + // This is a case where the buffer operation occurs as a child of another + // construct, generally braces. We have to explicitly output these buffer + // operations to ensure that the emitted code goes in the correct location. + return ['buffer += ', source, ';']; } else { - return { - appendToBuffer: true, - content: string, - toString: function() { return "buffer += " + string + ";"; } - }; + source.appendToBuffer = true; + return source; } }, initializeBuffer: function() { return this.quotedString(""); }, - - namespace: "Handlebars", // END PUBLIC API compile: function(environment, options, context, asObject) { @@ -2138,23 +2691,29 @@ var __module12__ = (function(__dependency1__, __dependency2__) { this.hashes = []; this.compileStack = []; this.inlineStack = []; + this.blockParams = []; this.compileChildren(environment, options); - this.useDepths = this.useDepths || environment.depths.list.length || this.options.compat; + this.useDepths = this.useDepths || environment.useDepths || this.options.compat; + this.useBlockParams = this.useBlockParams || environment.useBlockParams; var opcodes = environment.opcodes, opcode, + firstLoc, i, l; for (i = 0, l = opcodes.length; i < l; i++) { opcode = opcodes[i]; + this.source.currentLocation = opcode.loc; + firstLoc = firstLoc || opcode.loc; this[opcode.opcode].apply(this, opcode.args); } // Flush any trailing content that might be pending. + this.source.currentLocation = firstLoc; this.pushSource(''); /* istanbul ignore next */ @@ -2184,13 +2743,27 @@ var __module12__ = (function(__dependency1__, __dependency2__) { if (this.useDepths) { ret.useDepths = true; } + if (this.useBlockParams) { + ret.useBlockParams = true; + } if (this.options.compat) { ret.compat = true; } if (!asObject) { ret.compiler = JSON.stringify(ret.compiler); + + this.source.currentLocation = {start: {line: 1, column: 0}}; ret = this.objectLiteral(ret); + + if (options.srcName) { + ret = ret.toStringWithSourceMap({file: options.destName}); + ret.map = ret.map && ret.map.toString(); + } else { + ret = ret.toString(); + } + } else { + ret.compilerOptions = this.options; } return ret; @@ -2203,7 +2776,7 @@ var __module12__ = (function(__dependency1__, __dependency2__) { // track the last context pushed into place to allow skipping the // getContext opcode when it would be a noop this.lastContext = 0; - this.source = []; + this.source = new CodeGen(this.options.srcName); }, createFunctionContext: function(asObject) { @@ -2215,14 +2788,26 @@ var __module12__ = (function(__dependency1__, __dependency2__) { } // Generate minimizer alias mappings + // + // When using true SourceNodes, this will update all references to the given alias + // as the source nodes are reused in situ. For the non-source node compilation mode, + // aliases will not be used, but this case is already being run on the client and + // we aren't concern about minimizing the template size. + var aliasCount = 0; for (var alias in this.aliases) { - if (this.aliases.hasOwnProperty(alias)) { - varDeclarations += ', ' + alias + '=' + this.aliases[alias]; + var node = this.aliases[alias]; + + if (this.aliases.hasOwnProperty(alias) && node.children && node.referenceCount > 1) { + varDeclarations += ', alias' + (++aliasCount) + '=' + alias; + node.children[0] = 'alias' + aliasCount; } } var params = ["depth0", "helpers", "partials", "data"]; + if (this.useBlockParams || this.useDepths) { + params.push('blockParams'); + } if (this.useDepths) { params.push('depths'); } @@ -2235,59 +2820,67 @@ var __module12__ = (function(__dependency1__, __dependency2__) { return Function.apply(this, params); } else { - return 'function(' + params.join(',') + ') {\n ' + source + '}'; + return this.source.wrap(['function(', params.join(','), ') {\n ', source, '}']); } }, mergeSource: function(varDeclarations) { - var source = '', - buffer, + var isSimple = this.environment.isSimple, appendOnly = !this.forceBuffer, - appendFirst; + appendFirst, - for (var i = 0, len = this.source.length; i < len; i++) { - var line = this.source[i]; + sourceSeen, + bufferStart, + bufferEnd; + this.source.each(function(line) { if (line.appendToBuffer) { - if (buffer) { - buffer = buffer + '\n + ' + line.content; + if (bufferStart) { + line.prepend(' + '); } else { - buffer = line.content; + bufferStart = line; } + bufferEnd = line; } else { - if (buffer) { - if (!source) { + if (bufferStart) { + if (!sourceSeen) { appendFirst = true; - source = buffer + ';\n '; } else { - source += 'buffer += ' + buffer + ';\n '; + bufferStart.prepend('buffer += '); } - buffer = undefined; + bufferEnd.add(';'); + bufferStart = bufferEnd = undefined; } - source += line + '\n '; - if (!this.environment.isSimple) { + sourceSeen = true; + if (!isSimple) { appendOnly = false; } } - } + }); + if (appendOnly) { - if (buffer || !source) { - source += 'return ' + (buffer || '""') + ';\n'; + if (bufferStart) { + bufferStart.prepend('return '); + bufferEnd.add(';'); + } else if (!sourceSeen) { + this.source.push('return "";'); } } else { varDeclarations += ", buffer = " + (appendFirst ? '' : this.initializeBuffer()); - if (buffer) { - source += 'return buffer + ' + buffer + ';\n'; + + if (bufferStart) { + bufferStart.prepend('return buffer + '); + bufferEnd.add(';'); } else { - source += 'return buffer;\n'; + this.source.push('return buffer;'); } } if (varDeclarations) { - source = 'var ' + varDeclarations.substring(2) + (appendFirst ? '' : ';\n ') + source; + this.source.prepend('var ' + varDeclarations.substring(2) + (appendFirst ? '' : ';\n')); } - return source; + return this.source.merge(); }, // [blockValue] @@ -2300,15 +2893,14 @@ var __module12__ = (function(__dependency1__, __dependency2__) { // replace it on the stack with the result of properly // invoking blockHelperMissing. blockValue: function(name) { - this.aliases.blockHelperMissing = 'helpers.blockHelperMissing'; - - var params = [this.contextName(0)]; - this.setupParams(name, 0, params); + var blockHelperMissing = this.aliasable('helpers.blockHelperMissing'), + params = [this.contextName(0)]; + this.setupHelperArgs(name, 0, params); var blockName = this.popStack(); params.splice(1, 0, blockName); - this.push('blockHelperMissing.call(' + params.join(', ') + ')'); + this.push(this.source.functionCall(blockHelperMissing, 'call', params)); }, // [ambiguousBlockValue] @@ -2318,18 +2910,20 @@ var __module12__ = (function(__dependency1__, __dependency2__) { // On stack, after, if no lastHelper: same as [blockValue] // On stack, after, if lastHelper: value ambiguousBlockValue: function() { - this.aliases.blockHelperMissing = 'helpers.blockHelperMissing'; - // We're being a bit cheeky and reusing the options value from the prior exec - var params = [this.contextName(0)]; - this.setupParams('', 0, params, true); + var blockHelperMissing = this.aliasable('helpers.blockHelperMissing'), + params = [this.contextName(0)]; + this.setupHelperArgs('', 0, params, true); this.flushInline(); var current = this.topStack(); params.splice(1, 0, current); - this.pushSource("if (!" + this.lastHelper + ") { " + current + " = blockHelperMissing.call(" + params.join(", ") + "); }"); + this.pushSource([ + 'if (!', this.lastHelper, ') { ', + current, ' = ', this.source.functionCall(blockHelperMissing, 'call', params), + '}']); }, // [appendContent] @@ -2341,6 +2935,8 @@ var __module12__ = (function(__dependency1__, __dependency2__) { appendContent: function(content) { if (this.pendingContent) { content = this.pendingContent + content; + } else { + this.pendingLocation = this.source.currentLocation; } this.pendingContent = content; @@ -2356,13 +2952,18 @@ var __module12__ = (function(__dependency1__, __dependency2__) { // If `value` is truthy, or 0, it is coerced into a string and appended // Otherwise, the empty string is appended append: function() { - // Force anything that is inlined onto the stack so we don't have duplication - // when we examine local - this.flushInline(); - var local = this.popStack(); - this.pushSource('if (' + local + ' != null) { ' + this.appendToBuffer(local) + ' }'); - if (this.environment.isSimple) { - this.pushSource("else { " + this.appendToBuffer("''") + " }"); + if (this.isInline()) { + this.replaceStack(function(current) { + return [' != null ? ', current, ' : ""']; + }); + + this.pushSource(this.appendToBuffer(this.popStack())); + } else { + var local = this.popStack(); + this.pushSource(['if (', local, ' != null) { ', this.appendToBuffer(local, undefined, true), ' }']); + if (this.environment.isSimple) { + this.pushSource(['else { ', this.appendToBuffer("''", undefined, true), ' }']); + } } }, @@ -2373,9 +2974,8 @@ var __module12__ = (function(__dependency1__, __dependency2__) { // // Escape `value` and append it to the buffer appendEscaped: function() { - this.aliases.escapeExpression = 'this.escapeExpression'; - - this.pushSource(this.appendToBuffer("escapeExpression(" + this.popStack() + ")")); + this.pushSource(this.appendToBuffer( + [this.aliasable('this.escapeExpression'), '(', this.popStack(), ')'])); }, // [getContext] @@ -2407,9 +3007,7 @@ var __module12__ = (function(__dependency1__, __dependency2__) { // Looks up the value of `name` on the current context and pushes // it onto the stack. lookupOnContext: function(parts, falsy, scoped) { - /*jshint -W083 */ - var i = 0, - len = parts.length; + var i = 0; if (!scoped && this.options.compat && !this.lastContext) { // The depthed query is expected to handle the undefined logic for the root level that @@ -2419,19 +3017,21 @@ var __module12__ = (function(__dependency1__, __dependency2__) { this.pushContext(); } - for (; i < len; i++) { - this.replaceStack(function(current) { - var lookup = this.nameLookup(current, parts[i], 'context'); - // We want to ensure that zero and false are handled properly if the context (falsy flag) - // needs to have the special handling for these values. - if (!falsy) { - return ' != null ? ' + lookup + ' : ' + current; - } else { - // Otherwise we can use generic falsy handling - return ' && ' + lookup; - } - }); - } + this.resolvePath('context', parts, i, falsy); + }, + + // [lookupBlockParam] + // + // On stack, before: ... + // On stack, after: blockParam[name], ... + // + // Looks up the value of `parts` on the given block param and pushes + // it onto the stack. + lookupBlockParam: function(blockParamId, parts) { + this.useBlockParams = true; + + this.push(['blockParams[', blockParamId[0], '][', blockParamId[1], ']']); + this.resolvePath('context', parts, 1); }, // [lookupData] @@ -2448,10 +3048,28 @@ var __module12__ = (function(__dependency1__, __dependency2__) { this.pushStackLiteral('this.data(data, ' + depth + ')'); } + this.resolvePath('data', parts, 0, true); + }, + + resolvePath: function(type, parts, i, falsy) { + /*jshint -W083 */ + if (this.options.strict || this.options.assumeObjects) { + this.push(strictLookup(this.options.strict, this, parts, type)); + return; + } + var len = parts.length; - for (var i = 0; i < len; i++) { + for (; i < len; i++) { this.replaceStack(function(current) { - return ' && ' + this.nameLookup(current, parts[i], 'data'); + var lookup = this.nameLookup(current, parts[i], type); + // We want to ensure that zero and false are handled properly if the context (falsy flag) + // needs to have the special handling for these values. + if (!falsy) { + return [' != null ? ', lookup, ' : ', current]; + } else { + // Otherwise we can use generic falsy handling + return [' && ', lookup]; + } }); } }, @@ -2464,9 +3082,7 @@ var __module12__ = (function(__dependency1__, __dependency2__) { // If the `value` is a lambda, replace it on the stack by // the return value of the lambda resolvePossibleLambda: function() { - this.aliases.lambda = 'this.lambda'; - - this.push('lambda(' + this.popStack() + ', ' + this.contextName(0) + ')'); + this.push([this.aliasable('this.lambda'), '(', this.popStack(), ', ', this.contextName(0), ')']); }, // [pushStringParam] @@ -2483,7 +3099,7 @@ var __module12__ = (function(__dependency1__, __dependency2__) { // If it's a subexpression, the string result // will be pushed after this opcode. - if (type !== 'sexpr') { + if (type !== 'SubExpression') { if (typeof string === 'string') { this.pushString(string); } else { @@ -2492,9 +3108,7 @@ var __module12__ = (function(__dependency1__, __dependency2__) { } }, - emptyHash: function() { - this.pushStackLiteral('{}'); - + emptyHash: function(omitEmpty) { if (this.trackIds) { this.push('{}'); // hashIds } @@ -2502,6 +3116,7 @@ var __module12__ = (function(__dependency1__, __dependency2__) { this.push('{}'); // hashContexts this.push('{}'); // hashTypes } + this.pushStackLiteral(omitEmpty ? 'undefined' : '{}'); }, pushHash: function() { if (this.hash) { @@ -2514,14 +3129,14 @@ var __module12__ = (function(__dependency1__, __dependency2__) { this.hash = this.hashes.pop(); if (this.trackIds) { - this.push('{' + hash.ids.join(',') + '}'); + this.push(this.objectLiteral(hash.ids)); } if (this.stringParams) { - this.push('{' + hash.contexts.join(',') + '}'); - this.push('{' + hash.types.join(',') + '}'); + this.push(this.objectLiteral(hash.contexts)); + this.push(this.objectLiteral(hash.types)); } - this.push('{\n ' + hash.values.join(',\n ') + '\n }'); + this.push(this.objectLiteral(hash.values)); }, // [pushString] @@ -2534,17 +3149,6 @@ var __module12__ = (function(__dependency1__, __dependency2__) { this.pushStackLiteral(this.quotedString(string)); }, - // [push] - // - // On stack, before: ... - // On stack, after: expr, ... - // - // Push an expression onto the stack - push: function(expr) { - this.inlineStack.push(expr); - return expr; - }, - // [pushLiteral] // // On stack, before: ... @@ -2583,13 +3187,17 @@ var __module12__ = (function(__dependency1__, __dependency2__) { // // If the helper is not found, `helperMissing` is called. invokeHelper: function(paramSize, name, isSimple) { - this.aliases.helperMissing = 'helpers.helperMissing'; - var nonHelper = this.popStack(); var helper = this.setupHelper(paramSize, name); + var simple = isSimple ? [helper.name, ' || '] : ''; - var lookup = (isSimple ? helper.name + ' || ' : '') + nonHelper + ' || helperMissing'; - this.push('((' + lookup + ').call(' + helper.callParams + '))'); + var lookup = ['('].concat(simple, nonHelper); + if (!this.options.strict) { + lookup.push(' || ', this.aliasable('helpers.helperMissing')); + } + lookup.push(')'); + + this.push(this.source.functionCall(lookup, 'call', helper.callParams)); }, // [invokeKnownHelper] @@ -2601,7 +3209,7 @@ var __module12__ = (function(__dependency1__, __dependency2__) { // so a `helperMissing` fallback is not required. invokeKnownHelper: function(paramSize, name) { var helper = this.setupHelper(paramSize, name); - this.push(helper.name + ".call(" + helper.callParams + ")"); + this.push(this.source.functionCall(helper.name, 'call', helper.callParams)); }, // [invokeAmbiguous] @@ -2617,8 +3225,6 @@ var __module12__ = (function(__dependency1__, __dependency2__) { // and can be avoided by passing the `knownHelpers` and // `knownHelpersOnly` flags at compile-time. invokeAmbiguous: function(name, helperCall) { - this.aliases.functionType = '"function"'; - this.aliases.helperMissing = 'helpers.helperMissing'; this.useRegister('helper'); var nonHelper = this.popStack(); @@ -2628,10 +3234,21 @@ var __module12__ = (function(__dependency1__, __dependency2__) { var helperName = this.lastHelper = this.nameLookup('helpers', name, 'helper'); - this.push( - '((helper = (helper = ' + helperName + ' || ' + nonHelper + ') != null ? helper : helperMissing' - + (helper.paramsInit ? '),(' + helper.paramsInit : '') + '),' - + '(typeof helper === functionType ? helper.call(' + helper.callParams + ') : helper))'); + var lookup = ['(', '(helper = ', helperName, ' || ', nonHelper, ')']; + if (!this.options.strict) { + lookup[0] = '(helper = '; + lookup.push( + ' != null ? helper : ', + this.aliasable('helpers.helperMissing') + ); + } + + this.push([ + '(', lookup, + (helper.paramsInit ? ['),(', helper.paramsInit] : []), '),', + '(typeof helper === ', this.aliasable('"function"'), ' ? ', + this.source.functionCall('helper','call', helper.callParams), ' : helper))' + ]); }, // [invokePartial] @@ -2641,19 +3258,34 @@ var __module12__ = (function(__dependency1__, __dependency2__) { // // This operation pops off a context, invokes a partial with that context, // and pushes the result of the invocation back. - invokePartial: function(name, indent) { - var params = [this.nameLookup('partials', name, 'partial'), "'" + indent + "'", "'" + name + "'", this.popStack(), this.popStack(), "helpers", "partials"]; + invokePartial: function(isDynamic, name, indent) { + var params = [], + options = this.setupParams(name, 1, params, false); - if (this.options.data) { - params.push("data"); - } else if (this.options.compat) { - params.push('undefined'); + if (isDynamic) { + name = this.popStack(); + delete options.name; + } + + if (indent) { + options.indent = JSON.stringify(indent); + } + options.helpers = 'helpers'; + options.partials = 'partials'; + + if (!isDynamic) { + params.unshift(this.nameLookup('partials', name, 'partial')); + } else { + params.unshift(name); } + if (this.options.compat) { - params.push('depths'); + options.depths = 'depths'; } + options = this.objectLiteral(options); + params.push(options); - this.push("this.invokePartial(" + params.join(", ") + ")"); + this.push(this.source.functionCall('this.invokePartial', '', params)); }, // [assignToHash] @@ -2678,21 +3310,25 @@ var __module12__ = (function(__dependency1__, __dependency2__) { var hash = this.hash; if (context) { - hash.contexts.push("'" + key + "': " + context); + hash.contexts[key] = context; } if (type) { - hash.types.push("'" + key + "': " + type); + hash.types[key] = type; } if (id) { - hash.ids.push("'" + key + "': " + id); + hash.ids[key] = id; } - hash.values.push("'" + key + "': (" + value + ")"); + hash.values[key] = value; }, - pushId: function(type, name) { - if (type === 'ID' || type === 'DATA') { + pushId: function(type, name, child) { + if (type === 'BlockParam') { + this.pushStackLiteral( + 'blockParams[' + name[0] + '].path[' + name[1] + ']' + + (child ? ' + ' + JSON.stringify('.' + child) : '')); + } else if (type === 'PathExpression') { this.pushString(name); - } else if (type === 'sexpr') { + } else if (type === 'SubExpression') { this.pushStackLiteral('true'); } else { this.pushStackLiteral('null'); @@ -2721,9 +3357,13 @@ var __module12__ = (function(__dependency1__, __dependency2__) { this.context.environments[index] = child; this.useDepths = this.useDepths || compiler.useDepths; + this.useBlockParams = this.useBlockParams || compiler.useBlockParams; } else { child.index = index; child.name = 'program' + index; + + this.useDepths = this.useDepths || child.useDepths; + this.useBlockParams = this.useBlockParams || child.useBlockParams; } } }, @@ -2738,13 +3378,12 @@ var __module12__ = (function(__dependency1__, __dependency2__) { programExpression: function(guid) { var child = this.environment.children[guid], - depths = child.depths.list, - useDepths = this.useDepths, - depth; + programParams = [child.index, 'data', child.blockParams]; - var programParams = [child.index, 'data']; - - if (useDepths) { + if (this.useBlockParams || this.useDepths) { + programParams.push('blockParams'); + } + if (this.useDepths) { programParams.push('depths'); } @@ -2758,13 +3397,23 @@ var __module12__ = (function(__dependency1__, __dependency2__) { } }, + push: function(expr) { + if (!(expr instanceof Literal)) { + expr = this.source.wrap(expr); + } + + this.inlineStack.push(expr); + return expr; + }, + pushStackLiteral: function(item) { - return this.push(new Literal(item)); + this.push(new Literal(item)); }, pushSource: function(source) { if (this.pendingContent) { - this.source.push(this.appendToBuffer(this.quotedString(this.pendingContent))); + this.source.push( + this.appendToBuffer(this.source.quotedString(this.pendingContent), this.pendingLocation)); this.pendingContent = undefined; } @@ -2773,18 +3422,8 @@ var __module12__ = (function(__dependency1__, __dependency2__) { } }, - pushStack: function(item) { - this.flushInline(); - - var stack = this.incrStack(); - this.pushSource(stack + " = " + item + ";"); - this.compileStack.push(stack); - return stack; - }, - replaceStack: function(callback) { - var prefix = '', - inline = this.isInline(), + var prefix = ['('], stack, createdStack, usedLiteral; @@ -2799,14 +3438,15 @@ var __module12__ = (function(__dependency1__, __dependency2__) { if (top instanceof Literal) { // Literals do not need to be inlined - prefix = stack = top.value; + stack = [top.value]; + prefix = ['(', stack]; usedLiteral = true; } else { // Get or create the current stack name for use by the inline - createdStack = !this.stackSlot; - var name = !createdStack ? this.topStackName() : this.incrStack(); + createdStack = true; + var name = this.incrStack(); - prefix = '(' + this.push(name) + ' = ' + top + ')'; + prefix = ['((', this.push(name), ' = ', top, ')']; stack = this.topStack(); } @@ -2818,7 +3458,7 @@ var __module12__ = (function(__dependency1__, __dependency2__) { if (createdStack) { this.stackSlot--; } - this.push('(' + prefix + item + ')'); + this.push(prefix.concat(item, ')')); }, incrStack: function() { @@ -2831,15 +3471,16 @@ var __module12__ = (function(__dependency1__, __dependency2__) { }, flushInline: function() { var inlineStack = this.inlineStack; - if (inlineStack.length) { - this.inlineStack = []; - for (var i = 0, len = inlineStack.length; i < len; i++) { - var entry = inlineStack[i]; - if (entry instanceof Literal) { - this.compileStack.push(entry); - } else { - this.pushStack(entry); - } + this.inlineStack = []; + for (var i = 0, len = inlineStack.length; i < len; i++) { + var entry = inlineStack[i]; + /* istanbul ignore if */ + if (entry instanceof Literal) { + this.compileStack.push(entry); + } else { + var stack = this.incrStack(); + this.pushSource([stack, ' = ', entry, ';']); + this.compileStack.push(stack); } } }, @@ -2869,6 +3510,7 @@ var __module12__ = (function(__dependency1__, __dependency2__) { var stack = (this.isInline() ? this.inlineStack : this.compileStack), item = stack[stack.length - 1]; + /* istanbul ignore if */ if (item instanceof Literal) { return item.value; } else { @@ -2885,42 +3527,42 @@ var __module12__ = (function(__dependency1__, __dependency2__) { }, quotedString: function(str) { - return '"' + str - .replace(/\\/g, '\\\\') - .replace(/"/g, '\\"') - .replace(/\n/g, '\\n') - .replace(/\r/g, '\\r') - .replace(/\u2028/g, '\\u2028') // Per Ecma-262 7.3 + 7.8.4 - .replace(/\u2029/g, '\\u2029') + '"'; + return this.source.quotedString(str); }, objectLiteral: function(obj) { - var pairs = []; + return this.source.objectLiteral(obj); + }, - for (var key in obj) { - if (obj.hasOwnProperty(key)) { - pairs.push(this.quotedString(key) + ':' + obj[key]); - } + aliasable: function(name) { + var ret = this.aliases[name]; + if (ret) { + ret.referenceCount++; + return ret; } - return '{' + pairs.join(',') + '}'; + ret = this.aliases[name] = this.source.wrap(name); + ret.aliasable = true; + ret.referenceCount = 1; + + return ret; }, setupHelper: function(paramSize, name, blockHelper) { var params = [], - paramsInit = this.setupParams(name, paramSize, params, blockHelper); + paramsInit = this.setupHelperArgs(name, paramSize, params, blockHelper); var foundHelper = this.nameLookup('helpers', name, 'helper'); return { params: params, paramsInit: paramsInit, name: foundHelper, - callParams: [this.contextName(0)].concat(params).join(", ") + callParams: [this.contextName(0)].concat(params) }; }, - setupOptions: function(helper, paramSize, params) { - var options = {}, contexts = [], types = [], ids = [], param, inverse, program; + setupParams: function(helper, paramSize, params) { + var options = {}, contexts = [], types = [], ids = [], param; options.name = this.quotedString(helper); options.hash = this.popStack(); @@ -2933,22 +3575,14 @@ var __module12__ = (function(__dependency1__, __dependency2__) { options.hashContexts = this.popStack(); } - inverse = this.popStack(); - program = this.popStack(); + var inverse = this.popStack(), + program = this.popStack(); // Avoid setting fn and inverse if neither are set. This allows // helpers to do a check for `if (options.fn)` if (program || inverse) { - if (!program) { - program = 'this.noop'; - } - - if (!inverse) { - inverse = 'this.noop'; - } - - options.fn = program; - options.inverse = inverse; + options.fn = program || 'this.noop'; + options.inverse = inverse || 'this.noop'; } // The parameters go on to the stack in order (making sure that they are evaluated in order) @@ -2968,29 +3602,29 @@ var __module12__ = (function(__dependency1__, __dependency2__) { } if (this.trackIds) { - options.ids = "[" + ids.join(",") + "]"; + options.ids = this.source.generateArray(ids); } if (this.stringParams) { - options.types = "[" + types.join(",") + "]"; - options.contexts = "[" + contexts.join(",") + "]"; + options.types = this.source.generateArray(types); + options.contexts = this.source.generateArray(contexts); } if (this.options.data) { - options.data = "data"; + options.data = 'data'; + } + if (this.useBlockParams) { + options.blockParams = 'blockParams'; } - return options; }, - // the params and contexts arguments are passed in arrays - // to fill in - setupParams: function(helperName, paramSize, params, useRegister) { - var options = this.objectLiteral(this.setupOptions(helperName, paramSize, params)); - + setupHelperArgs: function(helper, paramSize, params, useRegister) { + var options = this.setupParams(helper, paramSize, params, true); + options = this.objectLiteral(options); if (useRegister) { this.useRegister('options'); params.push('options'); - return 'options=' + options; + return ['options=', options]; } else { params.push(options); return ''; @@ -2998,6 +3632,7 @@ var __module12__ = (function(__dependency1__, __dependency2__) { } }; + var reservedWords = ( "break else new var" + " case finally return void" + @@ -3013,7 +3648,8 @@ var __module12__ = (function(__dependency1__, __dependency2__) { " class float package throws" + " const goto private transient" + " debugger implements protected volatile" + - " double import public let yield" + " double import public let yield await" + + " null true false" ).split(" "); var compilerWords = JavaScriptCompiler.RESERVED_WORDS = {}; @@ -3026,9 +3662,29 @@ var __module12__ = (function(__dependency1__, __dependency2__) { return !JavaScriptCompiler.RESERVED_WORDS[name] && /^[a-zA-Z_$][0-9a-zA-Z_$]*$/.test(name); }; + function strictLookup(requireTerminal, compiler, parts, type) { + var stack = compiler.popStack(); + + var i = 0, + len = parts.length; + if (requireTerminal) { + len--; + } + + for (; i < len; i++) { + stack = compiler.nameLookup(stack, parts[i], type); + } + + if (requireTerminal) { + return [compiler.aliasable('this.strict'), '(', stack, ', ', compiler.quotedString(parts[i]), ')']; + } else { + return stack; + } + } + __exports__ = JavaScriptCompiler; return __exports__; -})(__module2__, __module5__); +})(__module2__, __module4__, __module3__, __module15__); // handlebars.js var __module0__ = (function(__dependency1__, __dependency2__, __dependency3__, __dependency4__, __dependency5__) { @@ -3069,11 +3725,22 @@ var __module0__ = (function(__dependency1__, __dependency2__, __dependency3__, _ Handlebars = create(); Handlebars.create = create; + /*jshint -W040 */ + /* istanbul ignore next */ + var root = typeof global !== 'undefined' ? global : window, + $Handlebars = root.Handlebars; + /* istanbul ignore next */ + Handlebars.noConflict = function() { + if (root.Handlebars === Handlebars) { + root.Handlebars = $Handlebars; + } + }; + Handlebars['default'] = Handlebars; __exports__ = Handlebars; return __exports__; -})(__module1__, __module7__, __module8__, __module11__, __module12__); +})(__module1__, __module7__, __module8__, __module13__, __module14__); return __module0__; })); diff --git a/vendor/assets/javascripts/handlebars.runtime.js b/vendor/assets/javascripts/handlebars.runtime.js index 932fb7a..1a29150 100644 --- a/vendor/assets/javascripts/handlebars.runtime.js +++ b/vendor/assets/javascripts/handlebars.runtime.js @@ -1,6 +1,6 @@ /*! - handlebars v2.0.0 + handlebars v3.0.0 Copyright (C) 2011-2014 by Yehuda Katz @@ -31,33 +31,14 @@ THE SOFTWARE. } else if (typeof exports === 'object') { module.exports = factory(); } else { - root.Handlebars = root.Handlebars || factory(); + root.Handlebars = factory(); } }(this, function () { -// handlebars/safe-string.js -var __module3__ = (function() { - "use strict"; - var __exports__; - // Build out our basic SafeString type - function SafeString(string) { - this.string = string; - } - - SafeString.prototype.toString = function() { - return "" + this.string; - }; - - __exports__ = SafeString; - return __exports__; -})(); - // handlebars/utils.js -var __module2__ = (function(__dependency1__) { +var __module2__ = (function() { "use strict"; var __exports__ = {}; /*jshint -W004 */ - var SafeString = __dependency1__; - var escape = { "&": "&", "<": "<", @@ -107,11 +88,21 @@ var __module2__ = (function(__dependency1__) { return (value && typeof value === 'object') ? toString.call(value) === '[object Array]' : false; }; __exports__.isArray = isArray; + // Older IE versions do not directly support indexOf so we must implement our own, sadly. + function indexOf(array, value) { + for (var i = 0, len = array.length; i < len; i++) { + if (array[i] === value) { + return i; + } + } + return -1; + } + __exports__.indexOf = indexOf; function escapeExpression(string) { // don't escape SafeStrings, since they're already safe - if (string instanceof SafeString) { - return string.toString(); + if (string && string.toHTML) { + return string.toHTML(); } else if (string == null) { return ""; } else if (!string) { @@ -137,27 +128,35 @@ var __module2__ = (function(__dependency1__) { } } - __exports__.isEmpty = isEmpty;function appendContextPath(contextPath, id) { + __exports__.isEmpty = isEmpty;function blockParams(params, ids) { + params.path = ids; + return params; + } + + __exports__.blockParams = blockParams;function appendContextPath(contextPath, id) { return (contextPath ? contextPath + '.' : '') + id; } __exports__.appendContextPath = appendContextPath; return __exports__; -})(__module3__); +})(); // handlebars/exception.js -var __module4__ = (function() { +var __module3__ = (function() { "use strict"; var __exports__; var errorProps = ['description', 'fileName', 'lineNumber', 'message', 'name', 'number', 'stack']; function Exception(message, node) { - var line; - if (node && node.firstLine) { - line = node.firstLine; - - message += ' - ' + line + ':' + node.firstColumn; + var loc = node && node.loc, + line, + column; + if (loc) { + line = loc.start.line; + column = loc.start.column; + + message += ' - ' + line + ':' + column; } var tmp = Error.prototype.constructor.call(this, message); @@ -167,9 +166,9 @@ var __module4__ = (function() { this[errorProps[idx]] = tmp[errorProps[idx]]; } - if (line) { + if (loc) { this.lineNumber = line; - this.column = node.firstColumn; + this.column = column; } } @@ -186,7 +185,7 @@ var __module1__ = (function(__dependency1__, __dependency2__) { var Utils = __dependency1__; var Exception = __dependency2__; - var VERSION = "2.0.0"; + var VERSION = "3.0.0"; __exports__.VERSION = VERSION;var COMPILER_REVISION = 6; __exports__.COMPILER_REVISION = COMPILER_REVISION; var REVISION_CHANGES = { @@ -232,6 +231,9 @@ var __module1__ = (function(__dependency1__, __dependency2__) { if (toString.call(name) === objectType) { Utils.extend(this.partials, name); } else { + if (typeof partial === 'undefined') { + throw new Exception('Attempting to register a partial as undefined'); + } this.partials[name] = partial; } }, @@ -299,36 +301,47 @@ var __module1__ = (function(__dependency1__, __dependency2__) { data = createFrame(options.data); } + function execIteration(key, i, last) { + if (data) { + data.key = key; + data.index = i; + data.first = i === 0; + data.last = !!last; + + if (contextPath) { + data.contextPath = contextPath + key; + } + } + + ret = ret + fn(context[key], { + data: data, + blockParams: Utils.blockParams([context[key], key], [contextPath + key, null]) + }); + } + if(context && typeof context === 'object') { if (isArray(context)) { for(var j = context.length; i Date: Wed, 18 Feb 2015 21:06:07 -0500 Subject: [PATCH 27/81] should be asset version. --- lib/handlebars_assets/engine.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/handlebars_assets/engine.rb b/lib/handlebars_assets/engine.rb index f875dfd..8a4be6e 100644 --- a/lib/handlebars_assets/engine.rb +++ b/lib/handlebars_assets/engine.rb @@ -2,8 +2,8 @@ module HandlebarsAssets # NOTE: must be an engine because we are including assets in the gem class Engine < ::Rails::Engine initializer "handlebars_assets.assets.register", :group => :all do |app| - ::HandlebarsAssets::register_extensions(Sprockets) - ::HandlebarsAssets::add_to_asset_versioning(Sprockets) + ::HandlebarsAssets::register_extensions(app.assets) + app.assets.version += "#{::HandlebarsAssets::VERSION}" end end end From 434358274df058abb1f0109f7d76f477a4d65331 Mon Sep 17 00:00:00 2001 From: Alex Riedler Date: Wed, 18 Feb 2015 21:12:33 -0500 Subject: [PATCH 28/81] fix a few things if window is not defined. --- test/test_helper.rb | 2 +- vendor/assets/javascripts/handlebars.js | 26 +++++++++++-------- .../assets/javascripts/handlebars.runtime.js | 6 ++++- 3 files changed, 21 insertions(+), 13 deletions(-) diff --git a/test/test_helper.rb b/test/test_helper.rb index 846f327..d0f33dc 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -23,7 +23,7 @@ module CompilerSupport def compile_hbs(source) compiler_src = Pathname(HandlebarsAssets::Config.compiler_path).join(HandlebarsAssets::Config.compiler).read - ExecJS.compile(compiler_src).call('Handlebars.precompile', source, HandlebarsAssets::Config.options) + ExecJS.compile("var window = {}; " + compiler_src).call('Handlebars.precompile', source, HandlebarsAssets::Config.options) end def hbs_compiled(template_name, source) diff --git a/vendor/assets/javascripts/handlebars.js b/vendor/assets/javascripts/handlebars.js index f5c05ab..6bd742a 100644 --- a/vendor/assets/javascripts/handlebars.js +++ b/vendor/assets/javascripts/handlebars.js @@ -25,6 +25,10 @@ THE SOFTWARE. @license */ /* exported Handlebars */ +if (!window) { + var window = {}; +} + (function (root, factory) { if (typeof define === 'function' && define.amd) { define([], factory); @@ -331,7 +335,7 @@ var __module2__ = (function(__dependency1__, __dependency2__) { if(context.hasOwnProperty(key)) { // We're running the iterations one step out of sync so we can detect // the last iteration without have to scan the object twice and create - // an itermediate keys array. + // an itermediate keys array. if (priorKey) { execIteration(priorKey, i-1); } @@ -887,7 +891,7 @@ var __module9__ = (function() { var $0 = $$.length - 1; switch (yystate) { - case 1: return $$[$0-1]; + case 1: return $$[$0-1]; break; case 2:this.$ = new yy.Program($$[$0], null, {}, yy.locInfo(this._$)); break; @@ -927,7 +931,7 @@ var __module9__ = (function() { program.chained = true; this.$ = { strip: $$[$0-2].strip, program: program, chain: true }; - + break; case 19:this.$ = $$[$0]; break; @@ -969,7 +973,7 @@ var __module9__ = (function() { break; case 38:this.$ = yy.preparePath(false, $$[$0], this._$); break; - case 39: $$[$0-2].push({part: $$[$0], separator: $$[$0-1]}); this.$ = $$[$0-2]; + case 39: $$[$0-2].push({part: $$[$0], separator: $$[$0-1]}); this.$ = $$[$0-2]; break; case 40:this.$ = [{part: $$[$0]}]; break; @@ -1318,22 +1322,22 @@ var __module9__ = (function() { this.begin("mu"); } if(yy_.yytext) return 14; - + break; case 1:return 14; break; case 2: this.popState(); return 14; - + break; case 3: yy_.yytext = yy_.yytext.substr(5, yy_.yyleng-9); this.popState(); return 16; - + break; - case 4: return 14; + case 4: return 14; break; case 5: this.popState(); @@ -1344,13 +1348,13 @@ var __module9__ = (function() { break; case 7:return 62; break; - case 8: return 17; + case 8: return 17; break; case 9: this.popState(); this.begin('raw'); return 21; - + break; case 10:return 53; break; @@ -1694,7 +1698,7 @@ var __module10__ = (function(__dependency1__) { return mustache.strip; }; - WhitespaceControl.prototype.PartialStatement = + WhitespaceControl.prototype.PartialStatement = WhitespaceControl.prototype.CommentStatement = function(node) { /* istanbul ignore next */ var strip = node.strip || {}; diff --git a/vendor/assets/javascripts/handlebars.runtime.js b/vendor/assets/javascripts/handlebars.runtime.js index 1a29150..142458a 100644 --- a/vendor/assets/javascripts/handlebars.runtime.js +++ b/vendor/assets/javascripts/handlebars.runtime.js @@ -25,6 +25,10 @@ THE SOFTWARE. @license */ /* exported Handlebars */ +if (!window) { + var window = {}; +} + (function (root, factory) { if (typeof define === 'function' && define.amd) { define([], factory); @@ -331,7 +335,7 @@ var __module1__ = (function(__dependency1__, __dependency2__) { if(context.hasOwnProperty(key)) { // We're running the iterations one step out of sync so we can detect // the last iteration without have to scan the object twice and create - // an itermediate keys array. + // an itermediate keys array. if (priorKey) { execIteration(priorKey, i-1); } From 9497c57696f80a5979ec31834dd738cca5597127 Mon Sep 17 00:00:00 2001 From: Alex Riedler Date: Wed, 18 Feb 2015 21:13:09 -0500 Subject: [PATCH 29/81] Release v0.19 --- CHANGELOG.md | 5 +++++ lib/handlebars_assets/version.rb | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fc18ba5..756efea 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +## 0.19 (2015-02-18) + +* Upgrade to Handlebars v3.0 +* Re-fix the issue regarding sprockets + ## 0.18.1 (2015-02-18) * Fix issue regarding sprockets versioning of assets diff --git a/lib/handlebars_assets/version.rb b/lib/handlebars_assets/version.rb index e198298..241220b 100644 --- a/lib/handlebars_assets/version.rb +++ b/lib/handlebars_assets/version.rb @@ -1,3 +1,3 @@ module HandlebarsAssets - VERSION = "0.18.1" + VERSION = "0.19" end From b2df60d1de0bfdd2f7328644d44b10288740f7a7 Mon Sep 17 00:00:00 2001 From: Alex Riedler Date: Fri, 20 Feb 2015 09:46:50 -0500 Subject: [PATCH 30/81] Fix extension handling error and refactor. --- lib/handlebars_assets/handlebars_template.rb | 40 +++++++++---------- .../handlebars_assets/tilt_handlebars_test.rb | 1 + 2 files changed, 19 insertions(+), 22 deletions(-) diff --git a/lib/handlebars_assets/handlebars_template.rb b/lib/handlebars_assets/handlebars_template.rb index 19d2d35..66c63ab 100644 --- a/lib/handlebars_assets/handlebars_template.rb +++ b/lib/handlebars_assets/handlebars_template.rb @@ -144,15 +144,21 @@ def initialize(path) @full_path = path end + def check_extension(ext) + result = false + if ext.start_with? '.' + ext = "\\#{ext}" + result ||= !(@full_path =~ /#{ext}(\..*)*$/).nil? + else + result ||= !(@full_path =~ /\.#{ext}(\..*)*$/).nil? + end + result + end + def is_haml? result = false ::HandlebarsAssets::Config.hamlbars_extensions.each do |ext| - if ext.start_with? '.' - ext = '\\#{ext}' - result ||= !(@full_path =~ /#{ext}(\..*)*$/).nil? - else - result ||= !(@full_path =~ /\.#{ext}(\..*)*$/).nil? - end + result ||= check_extension(ext) end result end @@ -160,33 +166,23 @@ def is_haml? def is_slim? result = false ::HandlebarsAssets::Config.slimbars_extensions.each do |ext| - if ext.start_with? '.' - ext = '\\#{ext}' - result ||= !(@full_path =~ /#{ext}(\..*)*$/).nil? - else - result ||= !(@full_path =~ /\.#{ext}(\..*)*$/).nil? - end + result ||= check_extension(ext) end result end - def is_partial? - @full_path.gsub(%r{.*/}, '').start_with?('_') - end - def is_ember? result = false ::HandlebarsAssets::Config.ember_extensions.each do |ext| - if ext.start_with? '.' - ext = '\\#{ext}' - result ||= !(@full_path =~ /#{ext}(\..*)*$/).nil? - else - result ||= !(@full_path =~ /\.#{ext}(\..*)*$/).nil? - end + result ||= check_extension(ext) end result end + def is_partial? + @full_path.gsub(%r{.*/}, '').start_with?('_') + end + def name template_name end diff --git a/test/handlebars_assets/tilt_handlebars_test.rb b/test/handlebars_assets/tilt_handlebars_test.rb index d03ec0d..da4ec40 100644 --- a/test/handlebars_assets/tilt_handlebars_test.rb +++ b/test/handlebars_assets/tilt_handlebars_test.rb @@ -143,6 +143,7 @@ def test_ember_render source = "This is {{handlebars}}" HandlebarsAssets::Config.ember = true + HandlebarsAssets::Config.multiple_frameworks = false template = HandlebarsAssets::HandlebarsTemplate.new(scope.pathname.to_s) { source } expected_compiled = %{window.Ember.TEMPLATES["test_render"] = Ember.Handlebars.compile("This is {{handlebars}}");}; From 4871883963525bf49b34559147ffeb1c4b335743 Mon Sep 17 00:00:00 2001 From: Alex Riedler Date: Fri, 20 Feb 2015 09:47:12 -0500 Subject: [PATCH 31/81] Release v0.19.1 --- lib/handlebars_assets/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/handlebars_assets/version.rb b/lib/handlebars_assets/version.rb index 241220b..717e7e4 100644 --- a/lib/handlebars_assets/version.rb +++ b/lib/handlebars_assets/version.rb @@ -1,3 +1,3 @@ module HandlebarsAssets - VERSION = "0.19" + VERSION = "0.19.1" end From 128ee0cde89876f676f4de856705060a6a44abed Mon Sep 17 00:00:00 2001 From: Alex Riedler Date: Sun, 22 Feb 2015 13:28:54 -0500 Subject: [PATCH 32/81] Fix some issues with dependencies. --- handlebars_assets.gemspec | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/handlebars_assets.gemspec b/handlebars_assets.gemspec index ec2f14e..bb4c337 100644 --- a/handlebars_assets.gemspec +++ b/handlebars_assets.gemspec @@ -10,7 +10,7 @@ Gem::Specification.new do |s| s.email = ["leshill@gmail.com"] s.homepage = "https://github.com/leshill/handlebars_assets" s.summary = "Compile Handlebars templates in the Rails asset pipeline." - s.description = "Compile Handlebars templates in the Rails asset pipeline." + s.description = "A Railities Gem to compile hbs assets" s.rubyforge_project = "handlebars_assets" @@ -19,14 +19,16 @@ Gem::Specification.new do |s| s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) } s.require_paths = ["lib"] - s.add_runtime_dependency "execjs", ">= 1.2.9" - s.add_runtime_dependency "tilt" - s.add_runtime_dependency "multi_json" - s.add_runtime_dependency "sprockets", ">= 2.0.3" + s.add_runtime_dependency "execjs", "~> 2.0" + s.add_runtime_dependency "tilt", "~> 1.2" + s.add_runtime_dependency "multi_json", "~> 1.0" + s.add_runtime_dependency "sprockets", "~> 2.0" - s.add_development_dependency "minitest" - s.add_development_dependency "haml" - s.add_development_dependency "rake" - s.add_development_dependency "slim" - s.add_development_dependency 'json', '~> 1.7.7' + s.add_development_dependency "minitest", '~> 5.5' + s.add_development_dependency "haml", '~> 4.0' + s.add_development_dependency "rake", '~> 10.0' + s.add_development_dependency "slim", '~> 3.0' + s.add_development_dependency 'json', '~> 1.7' + + s.post_install_message = "Remember to rake assets:clean or rake assets:purge on update!" end From 7d8cae4b0740373a009af4f14a4f804a1a45bfc4 Mon Sep 17 00:00:00 2001 From: Alex Riedler Date: Sun, 22 Feb 2015 13:29:18 -0500 Subject: [PATCH 33/81] Release v0.19.2 --- lib/handlebars_assets/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/handlebars_assets/version.rb b/lib/handlebars_assets/version.rb index 717e7e4..b748140 100644 --- a/lib/handlebars_assets/version.rb +++ b/lib/handlebars_assets/version.rb @@ -1,3 +1,3 @@ module HandlebarsAssets - VERSION = "0.19.1" + VERSION = "0.19.2" end From e1102a795d6d47ef2ce8c26e098c4faa1d7e1291 Mon Sep 17 00:00:00 2001 From: Alex Riedler Date: Mon, 23 Feb 2015 15:06:45 -0500 Subject: [PATCH 34/81] Add window workaround for compiler context. --- CHANGELOG.md | 5 +++++ lib/handlebars_assets/handlebars.rb | 2 ++ vendor/assets/javascripts/handlebars.runtime.js | 4 ---- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 756efea..b476ec9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +## 0.20 (2015-02-23) + +* Fix issues with window object, revert to native HB.js +* Fix extension handling bug on some versions of rails + ## 0.19 (2015-02-18) * Upgrade to Handlebars v3.0 diff --git a/lib/handlebars_assets/handlebars.rb b/lib/handlebars_assets/handlebars.rb index 7e2eb20..77fb3ba 100644 --- a/lib/handlebars_assets/handlebars.rb +++ b/lib/handlebars_assets/handlebars.rb @@ -24,6 +24,8 @@ def apply_patches_to_source append_patch(patch_file) end end + # HACK/workaround because of invalid wrapper by handlebars v3.0.0 + self.source += """if (typeof window === 'undefined') { this.window = {}; }""" source end diff --git a/vendor/assets/javascripts/handlebars.runtime.js b/vendor/assets/javascripts/handlebars.runtime.js index 142458a..fb93cde 100644 --- a/vendor/assets/javascripts/handlebars.runtime.js +++ b/vendor/assets/javascripts/handlebars.runtime.js @@ -25,10 +25,6 @@ THE SOFTWARE. @license */ /* exported Handlebars */ -if (!window) { - var window = {}; -} - (function (root, factory) { if (typeof define === 'function' && define.amd) { define([], factory); From ee873f1f59dff1e1e5c207ff5f2ef82a6a3037ad Mon Sep 17 00:00:00 2001 From: Alex Riedler Date: Mon, 23 Feb 2015 15:07:10 -0500 Subject: [PATCH 35/81] Release v0.20 --- lib/handlebars_assets/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/handlebars_assets/version.rb b/lib/handlebars_assets/version.rb index b748140..23d16b9 100644 --- a/lib/handlebars_assets/version.rb +++ b/lib/handlebars_assets/version.rb @@ -1,3 +1,3 @@ module HandlebarsAssets - VERSION = "0.19.2" + VERSION = "0.20.0" end From 1cf5256e6ead274b9137f8c2b4b1805e12796d7a Mon Sep 17 00:00:00 2001 From: Alex Riedler Date: Tue, 24 Feb 2015 19:02:47 -0500 Subject: [PATCH 36/81] Release v0.20.1 --- CHANGELOG.md | 4 ++++ lib/handlebars_assets/handlebars.rb | 4 +--- lib/handlebars_assets/version.rb | 2 +- vendor/assets/javascripts/handlebars.js | 4 ---- 4 files changed, 6 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b476ec9..4acb2aa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.20.1 (2015-02-24) + +* Actually revert to native HB.js + ## 0.20 (2015-02-23) * Fix issues with window object, revert to native HB.js diff --git a/lib/handlebars_assets/handlebars.rb b/lib/handlebars_assets/handlebars.rb index 77fb3ba..8ae8c75 100644 --- a/lib/handlebars_assets/handlebars.rb +++ b/lib/handlebars_assets/handlebars.rb @@ -24,8 +24,6 @@ def apply_patches_to_source append_patch(patch_file) end end - # HACK/workaround because of invalid wrapper by handlebars v3.0.0 - self.source += """if (typeof window === 'undefined') { this.window = {}; }""" source end @@ -34,7 +32,7 @@ def context end def source - @source ||= path.read + @source ||= "if (!window) { var window = {}; }\n#{path.read}" end def patch_path diff --git a/lib/handlebars_assets/version.rb b/lib/handlebars_assets/version.rb index 23d16b9..7124978 100644 --- a/lib/handlebars_assets/version.rb +++ b/lib/handlebars_assets/version.rb @@ -1,3 +1,3 @@ module HandlebarsAssets - VERSION = "0.20.0" + VERSION = "0.20.1" end diff --git a/vendor/assets/javascripts/handlebars.js b/vendor/assets/javascripts/handlebars.js index 6bd742a..e5c3dbb 100644 --- a/vendor/assets/javascripts/handlebars.js +++ b/vendor/assets/javascripts/handlebars.js @@ -25,10 +25,6 @@ THE SOFTWARE. @license */ /* exported Handlebars */ -if (!window) { - var window = {}; -} - (function (root, factory) { if (typeof define === 'function' && define.amd) { define([], factory); From c5306b89e894ab37baf844effea67bf7db3dcf50 Mon Sep 17 00:00:00 2001 From: Andrew Date: Thu, 5 Mar 2015 15:29:02 -0800 Subject: [PATCH 37/81] Add chomp for partials --- lib/handlebars_assets/config.rb | 11 ++++++++++- lib/handlebars_assets/handlebars_template.rb | 6 +++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/lib/handlebars_assets/config.rb b/lib/handlebars_assets/config.rb index 79b5c10..f74d146 100644 --- a/lib/handlebars_assets/config.rb +++ b/lib/handlebars_assets/config.rb @@ -11,7 +11,8 @@ module Config :patch_files, :patch_path, :path_prefix, :slim_options, :template_namespace, :precompile, :haml_enabled, :slim_enabled, :handlebars_extensions, :hamlbars_extensions, :slimbars_extensions, - :amd, :handlebars_amd_path, :amd_with_template_namespace + :amd, :handlebars_amd_path, :amd_with_template_namespace, + :chomp_underscore_for_partials def compiler @compiler || 'handlebars.js' @@ -125,6 +126,14 @@ def handlebars_amd_path @handlebars_amd_path || 'handlebars' end + # Indicate if leading underscore should be allowed + # when creating partial definition. + # Allows compatibility with handlebars-rails + # https://github.com/cowboyd/handlebars-rails/blob/f73a2d11df8aa2c21d335b8f04a8c5b59ae6a790/lib/handlebars-rails/tilt.rb#L18 + def chomp_underscore_for_partials? + @chomp_underscore_for_partials || false + end + private def generate_known_helpers_hash diff --git a/lib/handlebars_assets/handlebars_template.rb b/lib/handlebars_assets/handlebars_template.rb index 66c63ab..3d885e2 100644 --- a/lib/handlebars_assets/handlebars_template.rb +++ b/lib/handlebars_assets/handlebars_template.rb @@ -190,7 +190,11 @@ def name private def relative_path - @full_path.match(/.*#{HandlebarsAssets::Config.path_prefix}\/((.*\/)*([^.]*)).*$/)[1] + path = @full_path.match(/.*#{HandlebarsAssets::Config.path_prefix}\/((.*\/)*([^.]*)).*$/)[1] + if is_partial? && ::HandlebarsAssets::Config.chomp_underscore_for_partials? + path.gsub!(%r~/_~, '/') + end + path end def template_name From c9c98843f7099284cda4aff7a22ee13ae0efe387 Mon Sep 17 00:00:00 2001 From: Andrew Date: Fri, 6 Mar 2015 01:28:40 -0800 Subject: [PATCH 38/81] Add test for chomp. Adjust chomp to account for root level partials --- lib/handlebars_assets/handlebars_template.rb | 3 +++ .../handlebars_assets/tilt_handlebars_test.rb | 25 +++++++++++++++++++ test/test_helper.rb | 1 + 3 files changed, 29 insertions(+) diff --git a/lib/handlebars_assets/handlebars_template.rb b/lib/handlebars_assets/handlebars_template.rb index 3d885e2..c0fd0bd 100644 --- a/lib/handlebars_assets/handlebars_template.rb +++ b/lib/handlebars_assets/handlebars_template.rb @@ -192,6 +192,9 @@ def name def relative_path path = @full_path.match(/.*#{HandlebarsAssets::Config.path_prefix}\/((.*\/)*([^.]*)).*$/)[1] if is_partial? && ::HandlebarsAssets::Config.chomp_underscore_for_partials? + #handle case if partial is in root level of template folder + path.gsub!(%r~^_~, '') + #handle case if partial is in a subfolder within the template folder path.gsub!(%r~/_~, '/') end path diff --git a/test/handlebars_assets/tilt_handlebars_test.rb b/test/handlebars_assets/tilt_handlebars_test.rb index da4ec40..57b4983 100644 --- a/test/handlebars_assets/tilt_handlebars_test.rb +++ b/test/handlebars_assets/tilt_handlebars_test.rb @@ -74,6 +74,31 @@ def test_underscore_partials assert_equal hbs_compiled_partial('some/thing/_test_underscore', source), template2.render(scope2, {}) end + def test_chomped_underscore_partials + assert_equal HandlebarsAssets::Config.chomp_underscore_for_partials?, false + + HandlebarsAssets::Config.chomp_underscore_for_partials = true + assert_equal HandlebarsAssets::Config.chomp_underscore_for_partials?, true + + root = '/myapp/app/assets/javascripts' + file1 = 'app/templates/_test_underscore.hbs' + scope1 = make_scope root, file1 + file2 = 'app/templates/some/thing/_test_underscore.hbs' + scope2 = make_scope root, file2 + source = "This is {{handlebars}}" + + HandlebarsAssets::Config.path_prefix = 'app/templates' + + template1 = HandlebarsAssets::HandlebarsTemplate.new(scope1.pathname.to_s) { source } + + assert_equal hbs_compiled_partial('test_underscore', source), template1.render(scope1, {}) + + template2 = HandlebarsAssets::HandlebarsTemplate.new(scope2.pathname.to_s) { source } + + assert_equal hbs_compiled_partial('some/thing/test_underscore', source), template2.render(scope2, {}) + + end + def test_without_known_helpers_opt root = '/myapp/app/assets/templates' file = 'test_without_known.hbs' diff --git a/test/test_helper.rb b/test/test_helper.rb index d0f33dc..c829413 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -55,6 +55,7 @@ module Config extend self def reset! + @chomp_underscore_for_partials = nil @compiler = nil @compiler_path = nil @haml_options = nil From ca0a578ba320d3b1a76b47a72ab7056d2c3a8e0b Mon Sep 17 00:00:00 2001 From: Francois Harbec Date: Fri, 8 May 2015 11:38:00 -0700 Subject: [PATCH 39/81] relax sprockets dependency --- handlebars_assets.gemspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/handlebars_assets.gemspec b/handlebars_assets.gemspec index bb4c337..b915693 100644 --- a/handlebars_assets.gemspec +++ b/handlebars_assets.gemspec @@ -22,7 +22,7 @@ Gem::Specification.new do |s| s.add_runtime_dependency "execjs", "~> 2.0" s.add_runtime_dependency "tilt", "~> 1.2" s.add_runtime_dependency "multi_json", "~> 1.0" - s.add_runtime_dependency "sprockets", "~> 2.0" + s.add_runtime_dependency "sprockets", ">= 2.0.0", "< 4.0" s.add_development_dependency "minitest", '~> 5.5' s.add_development_dependency "haml", '~> 4.0' From d2f100669009f03bd78c74fc032eedb7052e9c40 Mon Sep 17 00:00:00 2001 From: Alex Riedler Date: Fri, 8 May 2015 15:44:30 -0400 Subject: [PATCH 40/81] Release v0.20.2 --- CHANGELOG.md | 5 +++++ lib/handlebars_assets/version.rb | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4acb2aa..fb8c38c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +## 0.20.2 (2015-02-24) + +* Relax Sprockets Dependencies - @rounders +* Add option to CHOMP underscores on partials - @GreyKn + ## 0.20.1 (2015-02-24) * Actually revert to native HB.js diff --git a/lib/handlebars_assets/version.rb b/lib/handlebars_assets/version.rb index 7124978..f59110e 100644 --- a/lib/handlebars_assets/version.rb +++ b/lib/handlebars_assets/version.rb @@ -1,3 +1,3 @@ module HandlebarsAssets - VERSION = "0.20.1" + VERSION = "0.20.2" end From 4ef0ac442048c2ff968a68e92ca6d36e8d07acc7 Mon Sep 17 00:00:00 2001 From: Alex Riedler Date: Sat, 26 Sep 2015 20:55:56 -0400 Subject: [PATCH 41/81] Update handlebars to v4.0.2 --- lib/handlebars_assets/version.rb | 2 +- vendor/assets/javascripts/handlebars.js | 8302 +++++++++-------- .../assets/javascripts/handlebars.runtime.js | 1917 ++-- 3 files changed, 5796 insertions(+), 4425 deletions(-) diff --git a/lib/handlebars_assets/version.rb b/lib/handlebars_assets/version.rb index f59110e..ad54dce 100644 --- a/lib/handlebars_assets/version.rb +++ b/lib/handlebars_assets/version.rb @@ -1,3 +1,3 @@ module HandlebarsAssets - VERSION = "0.20.2" + VERSION = "0.21.0" end diff --git a/vendor/assets/javascripts/handlebars.js b/vendor/assets/javascripts/handlebars.js index e5c3dbb..ebbf027 100644 --- a/vendor/assets/javascripts/handlebars.js +++ b/vendor/assets/javascripts/handlebars.js @@ -1,8 +1,8 @@ /*! - handlebars v3.0.0 + handlebars v4.0.2 -Copyright (C) 2011-2014 by Yehuda Katz +Copyright (C) 2011-2015 by Yehuda Katz Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal @@ -24,3723 +24,4581 @@ THE SOFTWARE. @license */ -/* exported Handlebars */ -(function (root, factory) { - if (typeof define === 'function' && define.amd) { - define([], factory); - } else if (typeof exports === 'object') { - module.exports = factory(); - } else { - root.Handlebars = factory(); - } -}(this, function () { -// handlebars/utils.js -var __module3__ = (function() { - "use strict"; - var __exports__ = {}; - /*jshint -W004 */ - var escape = { - "&": "&", - "<": "<", - ">": ">", - '"': """, - "'": "'", - "`": "`" - }; - - var badChars = /[&<>"'`]/g; - var possible = /[&<>"'`]/; - - function escapeChar(chr) { - return escape[chr]; - } - - function extend(obj /* , ...source */) { - for (var i = 1; i < arguments.length; i++) { - for (var key in arguments[i]) { - if (Object.prototype.hasOwnProperty.call(arguments[i], key)) { - obj[key] = arguments[i][key]; - } - } - } - - return obj; - } - - __exports__.extend = extend;var toString = Object.prototype.toString; - __exports__.toString = toString; - // Sourced from lodash - // https://github.com/bestiejs/lodash/blob/master/LICENSE.txt - var isFunction = function(value) { - return typeof value === 'function'; - }; - // fallback for older versions of Chrome and Safari - /* istanbul ignore next */ - if (isFunction(/x/)) { - isFunction = function(value) { - return typeof value === 'function' && toString.call(value) === '[object Function]'; - }; - } - var isFunction; - __exports__.isFunction = isFunction; - /* istanbul ignore next */ - var isArray = Array.isArray || function(value) { - return (value && typeof value === 'object') ? toString.call(value) === '[object Array]' : false; - }; - __exports__.isArray = isArray; - // Older IE versions do not directly support indexOf so we must implement our own, sadly. - function indexOf(array, value) { - for (var i = 0, len = array.length; i < len; i++) { - if (array[i] === value) { - return i; - } - } - return -1; - } - - __exports__.indexOf = indexOf; - function escapeExpression(string) { - // don't escape SafeStrings, since they're already safe - if (string && string.toHTML) { - return string.toHTML(); - } else if (string == null) { - return ""; - } else if (!string) { - return string + ''; - } - - // Force a string conversion as this will be done by the append regardless and - // the regex test will do this transparently behind the scenes, causing issues if - // an object's to string has escaped characters in it. - string = "" + string; - - if(!possible.test(string)) { return string; } - return string.replace(badChars, escapeChar); - } - - __exports__.escapeExpression = escapeExpression;function isEmpty(value) { - if (!value && value !== 0) { - return true; - } else if (isArray(value) && value.length === 0) { - return true; - } else { - return false; - } - } - - __exports__.isEmpty = isEmpty;function blockParams(params, ids) { - params.path = ids; - return params; - } - - __exports__.blockParams = blockParams;function appendContextPath(contextPath, id) { - return (contextPath ? contextPath + '.' : '') + id; - } - - __exports__.appendContextPath = appendContextPath; - return __exports__; -})(); - -// handlebars/exception.js -var __module4__ = (function() { - "use strict"; - var __exports__; - - var errorProps = ['description', 'fileName', 'lineNumber', 'message', 'name', 'number', 'stack']; - - function Exception(message, node) { - var loc = node && node.loc, - line, - column; - if (loc) { - line = loc.start.line; - column = loc.start.column; - - message += ' - ' + line + ':' + column; - } - - var tmp = Error.prototype.constructor.call(this, message); - - // Unfortunately errors are not enumerable in Chrome (at least), so `for prop in tmp` doesn't work. - for (var idx = 0; idx < errorProps.length; idx++) { - this[errorProps[idx]] = tmp[errorProps[idx]]; - } - - if (loc) { - this.lineNumber = line; - this.column = column; - } - } - - Exception.prototype = new Error(); - - __exports__ = Exception; - return __exports__; -})(); - -// handlebars/base.js -var __module2__ = (function(__dependency1__, __dependency2__) { - "use strict"; - var __exports__ = {}; - var Utils = __dependency1__; - var Exception = __dependency2__; - - var VERSION = "3.0.0"; - __exports__.VERSION = VERSION;var COMPILER_REVISION = 6; - __exports__.COMPILER_REVISION = COMPILER_REVISION; - var REVISION_CHANGES = { - 1: '<= 1.0.rc.2', // 1.0.rc.2 is actually rev2 but doesn't report it - 2: '== 1.0.0-rc.3', - 3: '== 1.0.0-rc.4', - 4: '== 1.x.x', - 5: '== 2.0.0-alpha.x', - 6: '>= 2.0.0-beta.1' - }; - __exports__.REVISION_CHANGES = REVISION_CHANGES; - var isArray = Utils.isArray, - isFunction = Utils.isFunction, - toString = Utils.toString, - objectType = '[object Object]'; - - function HandlebarsEnvironment(helpers, partials) { - this.helpers = helpers || {}; - this.partials = partials || {}; - - registerDefaultHelpers(this); - } - - __exports__.HandlebarsEnvironment = HandlebarsEnvironment;HandlebarsEnvironment.prototype = { - constructor: HandlebarsEnvironment, - - logger: logger, - log: log, - - registerHelper: function(name, fn) { - if (toString.call(name) === objectType) { - if (fn) { throw new Exception('Arg not supported with multiple helpers'); } - Utils.extend(this.helpers, name); - } else { - this.helpers[name] = fn; - } - }, - unregisterHelper: function(name) { - delete this.helpers[name]; - }, - - registerPartial: function(name, partial) { - if (toString.call(name) === objectType) { - Utils.extend(this.partials, name); - } else { - if (typeof partial === 'undefined') { - throw new Exception('Attempting to register a partial as undefined'); - } - this.partials[name] = partial; - } - }, - unregisterPartial: function(name) { - delete this.partials[name]; - } - }; - - function registerDefaultHelpers(instance) { - instance.registerHelper('helperMissing', function(/* [args, ]options */) { - if(arguments.length === 1) { - // A missing field in a {{foo}} constuct. - return undefined; - } else { - // Someone is actually trying to call something, blow up. - throw new Exception("Missing helper: '" + arguments[arguments.length-1].name + "'"); - } - }); - - instance.registerHelper('blockHelperMissing', function(context, options) { - var inverse = options.inverse, - fn = options.fn; - - if(context === true) { - return fn(this); - } else if(context === false || context == null) { - return inverse(this); - } else if (isArray(context)) { - if(context.length > 0) { - if (options.ids) { - options.ids = [options.name]; - } - - return instance.helpers.each(context, options); - } else { - return inverse(this); - } - } else { - if (options.data && options.ids) { - var data = createFrame(options.data); - data.contextPath = Utils.appendContextPath(options.data.contextPath, options.name); - options = {data: data}; - } - - return fn(context, options); - } - }); - - instance.registerHelper('each', function(context, options) { - if (!options) { - throw new Exception('Must pass iterator to #each'); - } - - var fn = options.fn, inverse = options.inverse; - var i = 0, ret = "", data; - - var contextPath; - if (options.data && options.ids) { - contextPath = Utils.appendContextPath(options.data.contextPath, options.ids[0]) + '.'; - } - - if (isFunction(context)) { context = context.call(this); } - - if (options.data) { - data = createFrame(options.data); - } - - function execIteration(key, i, last) { - if (data) { - data.key = key; - data.index = i; - data.first = i === 0; - data.last = !!last; - - if (contextPath) { - data.contextPath = contextPath + key; - } - } - - ret = ret + fn(context[key], { - data: data, - blockParams: Utils.blockParams([context[key], key], [contextPath + key, null]) - }); - } - - if(context && typeof context === 'object') { - if (isArray(context)) { - for(var j = context.length; i 2) { - expected.push("'" + this.terminals_[p] + "'"); - } - if (this.lexer.showPosition) { - errStr = "Parse error on line " + (yylineno + 1) + ":\n" + this.lexer.showPosition() + "\nExpecting " + expected.join(", ") + ", got '" + (this.terminals_[symbol] || symbol) + "'"; - } else { - errStr = "Parse error on line " + (yylineno + 1) + ": Unexpected " + (symbol == 1?"end of input":"'" + (this.terminals_[symbol] || symbol) + "'"); - } - this.parseError(errStr, {text: this.lexer.match, token: this.terminals_[symbol] || symbol, line: this.lexer.yylineno, loc: yyloc, expected: expected}); - } - } - if (action[0] instanceof Array && action.length > 1) { - throw new Error("Parse Error: multiple actions possible at state: " + state + ", token: " + symbol); - } - switch (action[0]) { - case 1: - stack.push(symbol); - vstack.push(this.lexer.yytext); - lstack.push(this.lexer.yylloc); - stack.push(action[1]); - symbol = null; - if (!preErrorSymbol) { - yyleng = this.lexer.yyleng; - yytext = this.lexer.yytext; - yylineno = this.lexer.yylineno; - yyloc = this.lexer.yylloc; - if (recovering > 0) - recovering--; - } else { - symbol = preErrorSymbol; - preErrorSymbol = null; - } - break; - case 2: - len = this.productions_[action[1]][1]; - yyval.$ = vstack[vstack.length - len]; - 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}; - if (ranges) { - yyval._$.range = [lstack[lstack.length - (len || 1)].range[0], lstack[lstack.length - 1].range[1]]; - } - r = this.performAction.call(yyval, yytext, yyleng, yylineno, this.yy, action[1], vstack, lstack); - if (typeof r !== "undefined") { - return r; - } - if (len) { - stack = stack.slice(0, -1 * len * 2); - vstack = vstack.slice(0, -1 * len); - lstack = lstack.slice(0, -1 * len); - } - stack.push(this.productions_[action[1]][0]); - vstack.push(yyval.$); - lstack.push(yyval._$); - newState = table[stack[stack.length - 2]][stack[stack.length - 1]]; - stack.push(newState); - break; - case 3: - return true; - } - } - return true; - } - }; - /* Jison generated lexer */ - var lexer = (function(){ - var lexer = ({EOF:1, - parseError:function parseError(str, hash) { - if (this.yy.parser) { - this.yy.parser.parseError(str, hash); - } else { - throw new Error(str); - } - }, - setInput:function (input) { - this._input = input; - this._more = this._less = this.done = false; - this.yylineno = this.yyleng = 0; - this.yytext = this.matched = this.match = ''; - this.conditionStack = ['INITIAL']; - this.yylloc = {first_line:1,first_column:0,last_line:1,last_column:0}; - if (this.options.ranges) this.yylloc.range = [0,0]; - this.offset = 0; - return this; - }, - input:function () { - var ch = this._input[0]; - this.yytext += ch; - this.yyleng++; - this.offset++; - this.match += ch; - this.matched += ch; - var lines = ch.match(/(?:\r\n?|\n).*/g); - if (lines) { - this.yylineno++; - this.yylloc.last_line++; - } else { - this.yylloc.last_column++; - } - if (this.options.ranges) this.yylloc.range[1]++; - - this._input = this._input.slice(1); - return ch; - }, - unput:function (ch) { - var len = ch.length; - var lines = ch.split(/(?:\r\n?|\n)/g); - - this._input = ch + this._input; - this.yytext = this.yytext.substr(0, this.yytext.length-len-1); - //this.yyleng -= len; - this.offset -= len; - var oldLines = this.match.split(/(?:\r\n?|\n)/g); - this.match = this.match.substr(0, this.match.length-1); - this.matched = this.matched.substr(0, this.matched.length-1); - - if (lines.length-1) this.yylineno -= lines.length-1; - var r = this.yylloc.range; - - this.yylloc = {first_line: this.yylloc.first_line, - last_line: this.yylineno+1, - first_column: this.yylloc.first_column, - last_column: lines ? - (lines.length === oldLines.length ? this.yylloc.first_column : 0) + oldLines[oldLines.length - lines.length].length - lines[0].length: - this.yylloc.first_column - len - }; - - if (this.options.ranges) { - this.yylloc.range = [r[0], r[0] + this.yyleng - len]; - } - return this; - }, - more:function () { - this._more = true; - return this; - }, - less:function (n) { - this.unput(this.match.slice(n)); - }, - pastInput:function () { - var past = this.matched.substr(0, this.matched.length - this.match.length); - return (past.length > 20 ? '...':'') + past.substr(-20).replace(/\n/g, ""); - }, - upcomingInput:function () { - var next = this.match; - if (next.length < 20) { - next += this._input.substr(0, 20-next.length); - } - return (next.substr(0,20)+(next.length > 20 ? '...':'')).replace(/\n/g, ""); - }, - showPosition:function () { - var pre = this.pastInput(); - var c = new Array(pre.length + 1).join("-"); - return pre + this.upcomingInput() + "\n" + c+"^"; - }, - next:function () { - if (this.done) { - return this.EOF; - } - if (!this._input) this.done = true; - - var token, - match, - tempMatch, - index, - col, - lines; - if (!this._more) { - this.yytext = ''; - this.match = ''; - } - var rules = this._currentRules(); - for (var i=0;i < rules.length; i++) { - tempMatch = this._input.match(this.rules[rules[i]]); - if (tempMatch && (!match || tempMatch[0].length > match[0].length)) { - match = tempMatch; - index = i; - if (!this.options.flex) break; - } - } - if (match) { - lines = match[0].match(/(?:\r\n?|\n).*/g); - if (lines) this.yylineno += lines.length; - this.yylloc = {first_line: this.yylloc.last_line, - last_line: this.yylineno+1, - first_column: this.yylloc.last_column, - last_column: lines ? lines[lines.length-1].length-lines[lines.length-1].match(/\r?\n?/)[0].length : this.yylloc.last_column + match[0].length}; - this.yytext += match[0]; - this.match += match[0]; - this.matches = match; - this.yyleng = this.yytext.length; - if (this.options.ranges) { - this.yylloc.range = [this.offset, this.offset += this.yyleng]; - } - this._more = false; - this._input = this._input.slice(match[0].length); - this.matched += match[0]; - token = this.performAction.call(this, this.yy, this, rules[index],this.conditionStack[this.conditionStack.length-1]); - if (this.done && this._input) this.done = false; - if (token) return token; - else return; - } - if (this._input === "") { - return this.EOF; - } else { - return this.parseError('Lexical error on line '+(this.yylineno+1)+'. Unrecognized text.\n'+this.showPosition(), - {text: "", token: null, line: this.yylineno}); - } - }, - lex:function lex() { - var r = this.next(); - if (typeof r !== 'undefined') { - return r; - } else { - return this.lex(); - } - }, - begin:function begin(condition) { - this.conditionStack.push(condition); - }, - popState:function popState() { - return this.conditionStack.pop(); - }, - _currentRules:function _currentRules() { - return this.conditions[this.conditionStack[this.conditionStack.length-1]].rules; - }, - topState:function () { - return this.conditionStack[this.conditionStack.length-2]; - }, - pushState:function begin(condition) { - this.begin(condition); - }}); - lexer.options = {}; - lexer.performAction = function anonymous(yy,yy_,$avoiding_name_collisions,YY_START) { - - - function strip(start, end) { - return yy_.yytext = yy_.yytext.substr(start, yy_.yyleng-end); - } - - - var YYSTATE=YY_START - switch($avoiding_name_collisions) { - case 0: - if(yy_.yytext.slice(-2) === "\\\\") { - strip(0,1); - this.begin("mu"); - } else if(yy_.yytext.slice(-1) === "\\") { - strip(0,1); - this.begin("emu"); - } else { - this.begin("mu"); - } - if(yy_.yytext) return 14; - - break; - case 1:return 14; - break; - case 2: - this.popState(); - return 14; - - break; - case 3: - yy_.yytext = yy_.yytext.substr(5, yy_.yyleng-9); - this.popState(); - return 16; - - break; - case 4: return 14; - break; - case 5: - this.popState(); - return 13; - - break; - case 6:return 59; - break; - case 7:return 62; - break; - case 8: return 17; - break; - case 9: - this.popState(); - this.begin('raw'); - return 21; - - break; - case 10:return 53; - break; - case 11:return 27; - break; - case 12:return 45; - break; - case 13:this.popState(); return 42; - break; - case 14:this.popState(); return 42; - break; - case 15:return 32; - break; - case 16:return 37; - break; - case 17:return 49; - break; - case 18:return 46; - break; - case 19: - this.unput(yy_.yytext); - this.popState(); - this.begin('com'); - - break; - case 20: - this.popState(); - return 13; - - break; - case 21:return 46; - break; - case 22:return 67; - break; - case 23:return 66; - break; - case 24:return 66; - break; - case 25:return 79; - break; - case 26:// ignore whitespace - break; - case 27:this.popState(); return 52; - break; - case 28:this.popState(); return 31; - break; - case 29:yy_.yytext = strip(1,2).replace(/\\"/g,'"'); return 74; - break; - case 30:yy_.yytext = strip(1,2).replace(/\\'/g,"'"); return 74; - break; - case 31:return 77; - break; - case 32:return 76; - break; - case 33:return 76; - break; - case 34:return 75; - break; - case 35:return 69; - break; - case 36:return 71; - break; - case 37:return 66; - break; - case 38:yy_.yytext = strip(1,2); return 66; - break; - case 39:return 'INVALID'; - break; - case 40:return 5; - break; - } - }; - lexer.rules = [/^(?:[^\x00]*?(?=(\{\{)))/,/^(?:[^\x00]+)/,/^(?:[^\x00]{2,}?(?=(\{\{|\\\{\{|\\\\\{\{|$)))/,/^(?:\{\{\{\{\/[^\s!"#%-,\.\/;->@\[-\^`\{-~]+(?=[=}\s\/.])\}\}\}\})/,/^(?:[^\x00]*?(?=(\{\{\{\{\/)))/,/^(?:[\s\S]*?--(~)?\}\})/,/^(?:\()/,/^(?:\))/,/^(?:\{\{\{\{)/,/^(?:\}\}\}\})/,/^(?:\{\{(~)?>)/,/^(?:\{\{(~)?#)/,/^(?:\{\{(~)?\/)/,/^(?:\{\{(~)?\^\s*(~)?\}\})/,/^(?:\{\{(~)?\s*else\s*(~)?\}\})/,/^(?:\{\{(~)?\^)/,/^(?:\{\{(~)?\s*else\b)/,/^(?:\{\{(~)?\{)/,/^(?:\{\{(~)?&)/,/^(?:\{\{(~)?!--)/,/^(?:\{\{(~)?![\s\S]*?\}\})/,/^(?:\{\{(~)?)/,/^(?:=)/,/^(?:\.\.)/,/^(?:\.(?=([=~}\s\/.)|])))/,/^(?:[\/.])/,/^(?:\s+)/,/^(?:\}(~)?\}\})/,/^(?:(~)?\}\})/,/^(?:"(\\["]|[^"])*")/,/^(?:'(\\[']|[^'])*')/,/^(?:@)/,/^(?:true(?=([~}\s)])))/,/^(?:false(?=([~}\s)])))/,/^(?:-?[0-9]+(?:\.[0-9]+)?(?=([~}\s)])))/,/^(?:as\s+\|)/,/^(?:\|)/,/^(?:([^\s!"#%-,\.\/;->@\[-\^`\{-~]+(?=([=~}\s\/.)|]))))/,/^(?:\[[^\]]*\])/,/^(?:.)/,/^(?:$)/]; - lexer.conditions = {"mu":{"rules":[6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40],"inclusive":false},"emu":{"rules":[2],"inclusive":false},"com":{"rules":[5],"inclusive":false},"raw":{"rules":[3,4],"inclusive":false},"INITIAL":{"rules":[0,1,40],"inclusive":true}}; - return lexer;})() - parser.lexer = lexer; - function Parser () { this.yy = {}; }Parser.prototype = parser;parser.Parser = Parser; - return new Parser; - })();__exports__ = handlebars; - /* jshint ignore:end */ - return __exports__; -})(); - -// handlebars/compiler/visitor.js -var __module11__ = (function(__dependency1__, __dependency2__) { - "use strict"; - var __exports__; - var Exception = __dependency1__; - var AST = __dependency2__; - - function Visitor() { - this.parents = []; - } - - Visitor.prototype = { - constructor: Visitor, - mutating: false, - - // Visits a given value. If mutating, will replace the value if necessary. - acceptKey: function(node, name) { - var value = this.accept(node[name]); - if (this.mutating) { - // Hacky sanity check: - if (value && (!value.type || !AST[value.type])) { - throw new Exception('Unexpected node type "' + value.type + '" found when accepting ' + name + ' on ' + node.type); - } - node[name] = value; - } - }, - - // Performs an accept operation with added sanity check to ensure - // required keys are not removed. - acceptRequired: function(node, name) { - this.acceptKey(node, name); - - if (!node[name]) { - throw new Exception(node.type + ' requires ' + name); - } - }, - - // Traverses a given array. If mutating, empty respnses will be removed - // for child elements. - acceptArray: function(array) { - for (var i = 0, l = array.length; i < l; i++) { - this.acceptKey(array, i); - - if (!array[i]) { - array.splice(i, 1); - i--; - l--; - } - } - }, - - accept: function(object) { - if (!object) { - return; - } - - if (this.current) { - this.parents.unshift(this.current); - } - this.current = object; - - var ret = this[object.type](object); - - this.current = this.parents.shift(); - - if (!this.mutating || ret) { - return ret; - } else if (ret !== false) { - return object; - } - }, - - Program: function(program) { - this.acceptArray(program.body); - }, - - MustacheStatement: function(mustache) { - this.acceptRequired(mustache, 'path'); - this.acceptArray(mustache.params); - this.acceptKey(mustache, 'hash'); - }, - - BlockStatement: function(block) { - this.acceptRequired(block, 'path'); - this.acceptArray(block.params); - this.acceptKey(block, 'hash'); - - this.acceptKey(block, 'program'); - this.acceptKey(block, 'inverse'); - }, - - PartialStatement: function(partial) { - this.acceptRequired(partial, 'name'); - this.acceptArray(partial.params); - this.acceptKey(partial, 'hash'); - }, - - ContentStatement: function(/* content */) {}, - CommentStatement: function(/* comment */) {}, - - SubExpression: function(sexpr) { - this.acceptRequired(sexpr, 'path'); - this.acceptArray(sexpr.params); - this.acceptKey(sexpr, 'hash'); - }, - PartialExpression: function(partial) { - this.acceptRequired(partial, 'name'); - this.acceptArray(partial.params); - this.acceptKey(partial, 'hash'); - }, - - PathExpression: function(/* path */) {}, - - StringLiteral: function(/* string */) {}, - NumberLiteral: function(/* number */) {}, - BooleanLiteral: function(/* bool */) {}, - - Hash: function(hash) { - this.acceptArray(hash.pairs); - }, - HashPair: function(pair) { - this.acceptRequired(pair, 'value'); - } - }; - - __exports__ = Visitor; - return __exports__; -})(__module4__, __module7__); - -// handlebars/compiler/whitespace-control.js -var __module10__ = (function(__dependency1__) { - "use strict"; - var __exports__; - var Visitor = __dependency1__; - - function WhitespaceControl() { - } - WhitespaceControl.prototype = new Visitor(); - - WhitespaceControl.prototype.Program = function(program) { - var isRoot = !this.isRootSeen; - this.isRootSeen = true; - - var body = program.body; - for (var i = 0, l = body.length; i < l; i++) { - var current = body[i], - strip = this.accept(current); - - if (!strip) { - continue; - } - - var _isPrevWhitespace = isPrevWhitespace(body, i, isRoot), - _isNextWhitespace = isNextWhitespace(body, i, isRoot), - - openStandalone = strip.openStandalone && _isPrevWhitespace, - closeStandalone = strip.closeStandalone && _isNextWhitespace, - inlineStandalone = strip.inlineStandalone && _isPrevWhitespace && _isNextWhitespace; - - if (strip.close) { - omitRight(body, i, true); - } - if (strip.open) { - omitLeft(body, i, true); - } - - if (inlineStandalone) { - omitRight(body, i); - - if (omitLeft(body, i)) { - // If we are on a standalone node, save the indent info for partials - if (current.type === 'PartialStatement') { - // Pull out the whitespace from the final line - current.indent = (/([ \t]+$)/).exec(body[i-1].original)[1]; - } - } - } - if (openStandalone) { - omitRight((current.program || current.inverse).body); - - // Strip out the previous content node if it's whitespace only - omitLeft(body, i); - } - if (closeStandalone) { - // Always strip the next node - omitRight(body, i); - - omitLeft((current.inverse || current.program).body); - } - } - - return program; - }; - WhitespaceControl.prototype.BlockStatement = function(block) { - this.accept(block.program); - this.accept(block.inverse); - - // Find the inverse program that is involed with whitespace stripping. - var program = block.program || block.inverse, - inverse = block.program && block.inverse, - firstInverse = inverse, - lastInverse = inverse; - - if (inverse && inverse.chained) { - firstInverse = inverse.body[0].program; - - // Walk the inverse chain to find the last inverse that is actually in the chain. - while (lastInverse.chained) { - lastInverse = lastInverse.body[lastInverse.body.length-1].program; - } - } - - var strip = { - open: block.openStrip.open, - close: block.closeStrip.close, - - // Determine the standalone candiacy. Basically flag our content as being possibly standalone - // so our parent can determine if we actually are standalone - openStandalone: isNextWhitespace(program.body), - closeStandalone: isPrevWhitespace((firstInverse || program).body) - }; - - if (block.openStrip.close) { - omitRight(program.body, null, true); - } - - if (inverse) { - var inverseStrip = block.inverseStrip; - - if (inverseStrip.open) { - omitLeft(program.body, null, true); - } - - if (inverseStrip.close) { - omitRight(firstInverse.body, null, true); - } - if (block.closeStrip.open) { - omitLeft(lastInverse.body, null, true); - } - - // Find standalone else statments - if (isPrevWhitespace(program.body) - && isNextWhitespace(firstInverse.body)) { - - omitLeft(program.body); - omitRight(firstInverse.body); - } - } else { - if (block.closeStrip.open) { - omitLeft(program.body, null, true); - } - } - - return strip; - }; - - WhitespaceControl.prototype.MustacheStatement = function(mustache) { - return mustache.strip; - }; - - WhitespaceControl.prototype.PartialStatement = - WhitespaceControl.prototype.CommentStatement = function(node) { - /* istanbul ignore next */ - var strip = node.strip || {}; - return { - inlineStandalone: true, - open: strip.open, - close: strip.close - }; - }; - - - function isPrevWhitespace(body, i, isRoot) { - if (i === undefined) { - i = body.length; - } - - // Nodes that end with newlines are considered whitespace (but are special - // cased for strip operations) - var prev = body[i-1], - sibling = body[i-2]; - if (!prev) { - return isRoot; - } - - if (prev.type === 'ContentStatement') { - return (sibling || !isRoot ? (/\r?\n\s*?$/) : (/(^|\r?\n)\s*?$/)).test(prev.original); - } - } - function isNextWhitespace(body, i, isRoot) { - if (i === undefined) { - i = -1; - } - - var next = body[i+1], - sibling = body[i+2]; - if (!next) { - return isRoot; - } - - if (next.type === 'ContentStatement') { - return (sibling || !isRoot ? (/^\s*?\r?\n/) : (/^\s*?(\r?\n|$)/)).test(next.original); - } - } - - // Marks the node to the right of the position as omitted. - // I.e. {{foo}}' ' will mark the ' ' node as omitted. - // - // If i is undefined, then the first child will be marked as such. - // - // If mulitple is truthy then all whitespace will be stripped out until non-whitespace - // content is met. - function omitRight(body, i, multiple) { - var current = body[i == null ? 0 : i + 1]; - if (!current || current.type !== 'ContentStatement' || (!multiple && current.rightStripped)) { - return; - } - - var original = current.value; - current.value = current.value.replace(multiple ? (/^\s+/) : (/^[ \t]*\r?\n?/), ''); - current.rightStripped = current.value !== original; - } - - // Marks the node to the left of the position as omitted. - // I.e. ' '{{foo}} will mark the ' ' node as omitted. - // - // If i is undefined then the last child will be marked as such. - // - // If mulitple is truthy then all whitespace will be stripped out until non-whitespace - // content is met. - function omitLeft(body, i, multiple) { - var current = body[i == null ? body.length - 1 : i - 1]; - if (!current || current.type !== 'ContentStatement' || (!multiple && current.leftStripped)) { - return; - } - - // We omit the last node if it's whitespace only and not preceeded by a non-content node. - var original = current.value; - current.value = current.value.replace(multiple ? (/\s+$/) : (/[ \t]+$/), ''); - current.leftStripped = current.value !== original; - return current.leftStripped; - } - - __exports__ = WhitespaceControl; - return __exports__; -})(__module11__); - -// handlebars/compiler/helpers.js -var __module12__ = (function(__dependency1__) { - "use strict"; - var __exports__ = {}; - var Exception = __dependency1__; - - function SourceLocation(source, locInfo) { - this.source = source; - this.start = { - line: locInfo.first_line, - column: locInfo.first_column - }; - this.end = { - line: locInfo.last_line, - column: locInfo.last_column - }; - } - - __exports__.SourceLocation = SourceLocation;function stripFlags(open, close) { - return { - open: open.charAt(2) === '~', - close: close.charAt(close.length-3) === '~' - }; - } - - __exports__.stripFlags = stripFlags;function stripComment(comment) { - return comment.replace(/^\{\{~?\!-?-?/, '') - .replace(/-?-?~?\}\}$/, ''); - } - - __exports__.stripComment = stripComment;function preparePath(data, parts, locInfo) { - /*jshint -W040 */ - locInfo = this.locInfo(locInfo); - - var original = data ? '@' : '', - dig = [], - depth = 0, - depthString = ''; - - for(var i=0,l=parts.length; i 0) { - throw new Exception('Invalid path: ' + original, {loc: locInfo}); - } else if (part === '..') { - depth++; - depthString += '../'; - } - } else { - dig.push(part); - } - } - - return new this.PathExpression(data, depth, dig, original, locInfo); - } - - __exports__.preparePath = preparePath;function prepareMustache(path, params, hash, open, strip, locInfo) { - /*jshint -W040 */ - // Must use charAt to support IE pre-10 - var escapeFlag = open.charAt(3) || open.charAt(2), - escaped = escapeFlag !== '{' && escapeFlag !== '&'; - - return new this.MustacheStatement(path, params, hash, escaped, strip, this.locInfo(locInfo)); - } - - __exports__.prepareMustache = prepareMustache;function prepareRawBlock(openRawBlock, content, close, locInfo) { - /*jshint -W040 */ - if (openRawBlock.path.original !== close) { - var errorNode = {loc: openRawBlock.path.loc}; - - throw new Exception(openRawBlock.path.original + " doesn't match " + close, errorNode); - } - - locInfo = this.locInfo(locInfo); - var program = new this.Program([content], null, {}, locInfo); - - return new this.BlockStatement( - openRawBlock.path, openRawBlock.params, openRawBlock.hash, - program, undefined, - {}, {}, {}, - locInfo); - } - - __exports__.prepareRawBlock = prepareRawBlock;function prepareBlock(openBlock, program, inverseAndProgram, close, inverted, locInfo) { - /*jshint -W040 */ - // When we are chaining inverse calls, we will not have a close path - if (close && close.path && openBlock.path.original !== close.path.original) { - var errorNode = {loc: openBlock.path.loc}; - - throw new Exception(openBlock.path.original + ' doesn\'t match ' + close.path.original, errorNode); - } - - program.blockParams = openBlock.blockParams; - - var inverse, - inverseStrip; - - if (inverseAndProgram) { - if (inverseAndProgram.chain) { - inverseAndProgram.program.body[0].closeStrip = close.strip; - } - - inverseStrip = inverseAndProgram.strip; - inverse = inverseAndProgram.program; - } - - if (inverted) { - inverted = inverse; - inverse = program; - program = inverted; - } - - return new this.BlockStatement( - openBlock.path, openBlock.params, openBlock.hash, - program, inverse, - openBlock.strip, inverseStrip, close && close.strip, - this.locInfo(locInfo)); - } - - __exports__.prepareBlock = prepareBlock; - return __exports__; -})(__module4__); - -// handlebars/compiler/base.js -var __module8__ = (function(__dependency1__, __dependency2__, __dependency3__, __dependency4__, __dependency5__) { - "use strict"; - var __exports__ = {}; - var parser = __dependency1__; - var AST = __dependency2__; - var WhitespaceControl = __dependency3__; - var Helpers = __dependency4__; - var extend = __dependency5__.extend; - - __exports__.parser = parser; - - var yy = {}; - extend(yy, Helpers, AST); - - function parse(input, options) { - // Just return if an already-compiled AST was passed in. - if (input.type === 'Program') { return input; } - - parser.yy = yy; - - // Altering the shared object here, but this is ok as parser is a sync operation - yy.locInfo = function(locInfo) { - return new yy.SourceLocation(options && options.srcName, locInfo); - }; - - var strip = new WhitespaceControl(); - return strip.accept(parser.parse(input)); - } - - __exports__.parse = parse; - return __exports__; -})(__module9__, __module7__, __module10__, __module12__, __module3__); - -// handlebars/compiler/compiler.js -var __module13__ = (function(__dependency1__, __dependency2__, __dependency3__) { - "use strict"; - var __exports__ = {}; - var Exception = __dependency1__; - var isArray = __dependency2__.isArray; - var indexOf = __dependency2__.indexOf; - var AST = __dependency3__; - - var slice = [].slice; - - - function Compiler() {} - - __exports__.Compiler = Compiler;// the foundHelper register will disambiguate helper lookup from finding a - // function in a context. This is necessary for mustache compatibility, which - // requires that context functions in blocks are evaluated by blockHelperMissing, - // and then proceed as if the resulting value was provided to blockHelperMissing. - - Compiler.prototype = { - compiler: Compiler, - - equals: function(other) { - var len = this.opcodes.length; - if (other.opcodes.length !== len) { - return false; - } - - for (var i = 0; i < len; i++) { - var opcode = this.opcodes[i], - otherOpcode = other.opcodes[i]; - if (opcode.opcode !== otherOpcode.opcode || !argEquals(opcode.args, otherOpcode.args)) { - return false; - } - } - - // We know that length is the same between the two arrays because they are directly tied - // to the opcode behavior above. - len = this.children.length; - for (i = 0; i < len; i++) { - if (!this.children[i].equals(other.children[i])) { - return false; - } - } - - return true; - }, - - guid: 0, - - compile: function(program, options) { - this.sourceNode = []; - this.opcodes = []; - this.children = []; - this.options = options; - this.stringParams = options.stringParams; - this.trackIds = options.trackIds; - - options.blockParams = options.blockParams || []; - - // These changes will propagate to the other compiler components - var knownHelpers = options.knownHelpers; - options.knownHelpers = { - 'helperMissing': true, - 'blockHelperMissing': true, - 'each': true, - 'if': true, - 'unless': true, - 'with': true, - 'log': true, - 'lookup': true - }; - if (knownHelpers) { - for (var name in knownHelpers) { - options.knownHelpers[name] = knownHelpers[name]; - } - } - - return this.accept(program); - }, - - compileProgram: function(program) { - var result = new this.compiler().compile(program, this.options); - var guid = this.guid++; - - this.usePartial = this.usePartial || result.usePartial; - - this.children[guid] = result; - this.useDepths = this.useDepths || result.useDepths; - - return guid; - }, - - accept: function(node) { - this.sourceNode.unshift(node); - var ret = this[node.type](node); - this.sourceNode.shift(); - return ret; - }, - - Program: function(program) { - this.options.blockParams.unshift(program.blockParams); - - var body = program.body; - for(var i=0, l=body.length; i 1) { - throw new Exception('Unsupported number of partial arguments: ' + params.length, partial); - } else if (!params.length) { - params.push({type: 'PathExpression', parts: [], depth: 0}); - } - - var partialName = partial.name.original, - isDynamic = partial.name.type === 'SubExpression'; - if (isDynamic) { - this.accept(partial.name); - } - - this.setupFullMustacheParams(partial, undefined, undefined, true); - - var indent = partial.indent || ''; - if (this.options.preventIndent && indent) { - this.opcode('appendContent', indent); - indent = ''; - } - - this.opcode('invokePartial', isDynamic, partialName, indent); - this.opcode('append'); - }, - - MustacheStatement: function(mustache) { - this.SubExpression(mustache); - - if(mustache.escaped && !this.options.noEscape) { - this.opcode('appendEscaped'); - } else { - this.opcode('append'); - } - }, - - ContentStatement: function(content) { - if (content.value) { - this.opcode('appendContent', content.value); - } - }, - - CommentStatement: function() {}, - - SubExpression: function(sexpr) { - transformLiteralToPath(sexpr); - var type = this.classifySexpr(sexpr); - - if (type === 'simple') { - this.simpleSexpr(sexpr); - } else if (type === 'helper') { - this.helperSexpr(sexpr); - } else { - this.ambiguousSexpr(sexpr); - } - }, - ambiguousSexpr: function(sexpr, program, inverse) { - var path = sexpr.path, - name = path.parts[0], - isBlock = program != null || inverse != null; - - this.opcode('getContext', path.depth); - - this.opcode('pushProgram', program); - this.opcode('pushProgram', inverse); - - this.accept(path); - - this.opcode('invokeAmbiguous', name, isBlock); - }, - - simpleSexpr: function(sexpr) { - this.accept(sexpr.path); - this.opcode('resolvePossibleLambda'); - }, - - helperSexpr: function(sexpr, program, inverse) { - var params = this.setupFullMustacheParams(sexpr, program, inverse), - path = sexpr.path, - name = path.parts[0]; - - if (this.options.knownHelpers[name]) { - this.opcode('invokeKnownHelper', params.length, name); - } else if (this.options.knownHelpersOnly) { - throw new Exception("You specified knownHelpersOnly, but used the unknown helper " + name, sexpr); - } else { - path.falsy = true; - - this.accept(path); - this.opcode('invokeHelper', params.length, path.original, AST.helpers.simpleId(path)); - } - }, - - PathExpression: function(path) { - this.addDepth(path.depth); - this.opcode('getContext', path.depth); - - var name = path.parts[0], - scoped = AST.helpers.scopedId(path), - blockParamId = !path.depth && !scoped && this.blockParamIndex(name); - - if (blockParamId) { - this.opcode('lookupBlockParam', blockParamId, path.parts); - } else if (!name) { - // Context reference, i.e. `{{foo .}}` or `{{foo ..}}` - this.opcode('pushContext'); - } else if (path.data) { - this.options.data = true; - this.opcode('lookupData', path.depth, path.parts); - } else { - this.opcode('lookupOnContext', path.parts, path.falsy, scoped); - } - }, - - StringLiteral: function(string) { - this.opcode('pushString', string.value); - }, - - NumberLiteral: function(number) { - this.opcode('pushLiteral', number.value); - }, - - BooleanLiteral: function(bool) { - this.opcode('pushLiteral', bool.value); - }, - - Hash: function(hash) { - var pairs = hash.pairs, i, l; - - this.opcode('pushHash'); - - for (i=0, l=pairs.length; i= 0) { - return [depth, param]; - } - } - } - }; - - function precompile(input, options, env) { - if (input == null || (typeof input !== 'string' && input.type !== 'Program')) { - throw new Exception("You must pass a string or Handlebars AST to Handlebars.precompile. You passed " + input); - } - - options = options || {}; - if (!('data' in options)) { - options.data = true; - } - if (options.compat) { - options.useDepths = true; - } - - var ast = env.parse(input, options); - var environment = new env.Compiler().compile(ast, options); - return new env.JavaScriptCompiler().compile(environment, options); - } - - __exports__.precompile = precompile;function compile(input, options, env) { - if (input == null || (typeof input !== 'string' && input.type !== 'Program')) { - throw new Exception("You must pass a string or Handlebars AST to Handlebars.compile. You passed " + input); - } - - options = options || {}; - - if (!('data' in options)) { - options.data = true; - } - if (options.compat) { - options.useDepths = true; - } - - var compiled; - - function compileInput() { - var ast = env.parse(input, options); - var environment = new env.Compiler().compile(ast, options); - var templateSpec = new env.JavaScriptCompiler().compile(environment, options, undefined, true); - return env.template(templateSpec); - } - - // Template is only compiled on first use and cached after that point. - var ret = function(context, options) { - if (!compiled) { - compiled = compileInput(); - } - return compiled.call(this, context, options); - }; - ret._setup = function(options) { - if (!compiled) { - compiled = compileInput(); - } - return compiled._setup(options); - }; - ret._child = function(i, data, blockParams, depths) { - if (!compiled) { - compiled = compileInput(); - } - return compiled._child(i, data, blockParams, depths); - }; - return ret; - } - - __exports__.compile = compile;function argEquals(a, b) { - if (a === b) { - return true; - } - - if (isArray(a) && isArray(b) && a.length === b.length) { - for (var i = 0; i < a.length; i++) { - if (!argEquals(a[i], b[i])) { - return false; - } - } - return true; - } - } - - function transformLiteralToPath(sexpr) { - if (!sexpr.path.parts) { - var literal = sexpr.path; - // Casting to string here to make false and 0 literal values play nicely with the rest - // of the system. - sexpr.path = new AST.PathExpression(false, 0, [literal.original+''], literal.original+'', literal.log); - } - } - return __exports__; -})(__module4__, __module3__, __module7__); - -// handlebars/compiler/code-gen.js -var __module15__ = (function(__dependency1__) { - "use strict"; - var __exports__; - var isArray = __dependency1__.isArray; - - try { - var SourceMap = require('source-map'), - SourceNode = SourceMap.SourceNode; - } catch (err) { - /* istanbul ignore next: tested but not covered in istanbul due to dist build */ - SourceNode = function(line, column, srcFile, chunks) { - this.src = ''; - if (chunks) { - this.add(chunks); - } - }; - /* istanbul ignore next */ - SourceNode.prototype = { - add: function(chunks) { - if (isArray(chunks)) { - chunks = chunks.join(''); - } - this.src += chunks; - }, - prepend: function(chunks) { - if (isArray(chunks)) { - chunks = chunks.join(''); - } - this.src = chunks + this.src; - }, - toStringWithSourceMap: function() { - return {code: this.toString()}; - }, - toString: function() { - return this.src; - } - }; - } - - - function castChunk(chunk, codeGen, loc) { - if (isArray(chunk)) { - var ret = []; - - for (var i = 0, len = chunk.length; i < len; i++) { - ret.push(codeGen.wrap(chunk[i], loc)); - } - return ret; - } else if (typeof chunk === 'boolean' || typeof chunk === 'number') { - // Handle primitives that the SourceNode will throw up on - return chunk+''; - } - return chunk; - } - - - function CodeGen(srcFile) { - this.srcFile = srcFile; - this.source = []; - } - - CodeGen.prototype = { - prepend: function(source, loc) { - this.source.unshift(this.wrap(source, loc)); - }, - push: function(source, loc) { - this.source.push(this.wrap(source, loc)); - }, - - merge: function() { - var source = this.empty(); - this.each(function(line) { - source.add([' ', line, '\n']); - }); - return source; - }, - - each: function(iter) { - for (var i = 0, len = this.source.length; i < len; i++) { - iter(this.source[i]); - } - }, - - empty: function(loc) { - loc = loc || this.currentLocation || {start:{}}; - return new SourceNode(loc.start.line, loc.start.column, this.srcFile); - }, - wrap: function(chunk, loc) { - if (chunk instanceof SourceNode) { - return chunk; - } - - loc = loc || this.currentLocation || {start:{}}; - chunk = castChunk(chunk, this, loc); - - return new SourceNode(loc.start.line, loc.start.column, this.srcFile, chunk); - }, - - functionCall: function(fn, type, params) { - params = this.generateList(params); - return this.wrap([fn, type ? '.' + type + '(' : '(', params, ')']); - }, - - quotedString: function(str) { - return '"' + (str + '') - .replace(/\\/g, '\\\\') - .replace(/"/g, '\\"') - .replace(/\n/g, '\\n') - .replace(/\r/g, '\\r') - .replace(/\u2028/g, '\\u2028') // Per Ecma-262 7.3 + 7.8.4 - .replace(/\u2029/g, '\\u2029') + '"'; - }, - - objectLiteral: function(obj) { - var pairs = []; - - for (var key in obj) { - if (obj.hasOwnProperty(key)) { - var value = castChunk(obj[key], this); - if (value !== 'undefined') { - pairs.push([this.quotedString(key), ':', value]); - } - } - } - - var ret = this.generateList(pairs); - ret.prepend('{'); - ret.add('}'); - return ret; - }, - - - generateList: function(entries, loc) { - var ret = this.empty(loc); - - for (var i = 0, len = entries.length; i < len; i++) { - if (i) { - ret.add(','); - } - - ret.add(castChunk(entries[i], this, loc)); - } - - return ret; - }, - - generateArray: function(entries, loc) { - var ret = this.generateList(entries, loc); - ret.prepend('['); - ret.add(']'); - - return ret; - } - }; - - __exports__ = CodeGen; - return __exports__; -})(__module3__); - -// handlebars/compiler/javascript-compiler.js -var __module14__ = (function(__dependency1__, __dependency2__, __dependency3__, __dependency4__) { - "use strict"; - var __exports__; - var COMPILER_REVISION = __dependency1__.COMPILER_REVISION; - var REVISION_CHANGES = __dependency1__.REVISION_CHANGES; - var Exception = __dependency2__; - var isArray = __dependency3__.isArray; - var CodeGen = __dependency4__; - - function Literal(value) { - this.value = value; - } - - function JavaScriptCompiler() {} - - JavaScriptCompiler.prototype = { - // PUBLIC API: You can override these methods in a subclass to provide - // alternative compiled forms for name lookup and buffering semantics - nameLookup: function(parent, name /* , type*/) { - if (JavaScriptCompiler.isValidJavaScriptVariableName(name)) { - return [parent, ".", name]; - } else { - return [parent, "['", name, "']"]; - } - }, - depthedLookup: function(name) { - return [this.aliasable('this.lookup'), '(depths, "', name, '")']; - }, - - compilerInfo: function() { - var revision = COMPILER_REVISION, - versions = REVISION_CHANGES[revision]; - return [revision, versions]; - }, - - appendToBuffer: function(source, location, explicit) { - // Force a source as this simplifies the merge logic. - if (!isArray(source)) { - source = [source]; - } - source = this.source.wrap(source, location); - - if (this.environment.isSimple) { - return ['return ', source, ';']; - } else if (explicit) { - // This is a case where the buffer operation occurs as a child of another - // construct, generally braces. We have to explicitly output these buffer - // operations to ensure that the emitted code goes in the correct location. - return ['buffer += ', source, ';']; - } else { - source.appendToBuffer = true; - return source; - } - }, - - initializeBuffer: function() { - return this.quotedString(""); - }, - // END PUBLIC API - - compile: function(environment, options, context, asObject) { - this.environment = environment; - this.options = options; - this.stringParams = this.options.stringParams; - this.trackIds = this.options.trackIds; - this.precompile = !asObject; - - this.name = this.environment.name; - this.isChild = !!context; - this.context = context || { - programs: [], - environments: [] - }; - - this.preamble(); - - this.stackSlot = 0; - this.stackVars = []; - this.aliases = {}; - this.registers = { list: [] }; - this.hashes = []; - this.compileStack = []; - this.inlineStack = []; - this.blockParams = []; - - this.compileChildren(environment, options); - - this.useDepths = this.useDepths || environment.useDepths || this.options.compat; - this.useBlockParams = this.useBlockParams || environment.useBlockParams; - - var opcodes = environment.opcodes, - opcode, - firstLoc, - i, - l; - - for (i = 0, l = opcodes.length; i < l; i++) { - opcode = opcodes[i]; - - this.source.currentLocation = opcode.loc; - firstLoc = firstLoc || opcode.loc; - this[opcode.opcode].apply(this, opcode.args); - } - - // Flush any trailing content that might be pending. - this.source.currentLocation = firstLoc; - this.pushSource(''); - - /* istanbul ignore next */ - if (this.stackSlot || this.inlineStack.length || this.compileStack.length) { - throw new Exception('Compile completed with content left on stack'); - } - - var fn = this.createFunctionContext(asObject); - if (!this.isChild) { - var ret = { - compiler: this.compilerInfo(), - main: fn - }; - var programs = this.context.programs; - for (i = 0, l = programs.length; i < l; i++) { - if (programs[i]) { - ret[i] = programs[i]; - } - } - - if (this.environment.usePartial) { - ret.usePartial = true; - } - if (this.options.data) { - ret.useData = true; - } - if (this.useDepths) { - ret.useDepths = true; - } - if (this.useBlockParams) { - ret.useBlockParams = true; - } - if (this.options.compat) { - ret.compat = true; - } - - if (!asObject) { - ret.compiler = JSON.stringify(ret.compiler); - - this.source.currentLocation = {start: {line: 1, column: 0}}; - ret = this.objectLiteral(ret); - - if (options.srcName) { - ret = ret.toStringWithSourceMap({file: options.destName}); - ret.map = ret.map && ret.map.toString(); - } else { - ret = ret.toString(); - } - } else { - ret.compilerOptions = this.options; - } - - return ret; - } else { - return fn; - } - }, - - preamble: function() { - // track the last context pushed into place to allow skipping the - // getContext opcode when it would be a noop - this.lastContext = 0; - this.source = new CodeGen(this.options.srcName); - }, - - createFunctionContext: function(asObject) { - var varDeclarations = ''; - - var locals = this.stackVars.concat(this.registers.list); - if(locals.length > 0) { - varDeclarations += ", " + locals.join(", "); - } - - // Generate minimizer alias mappings - // - // When using true SourceNodes, this will update all references to the given alias - // as the source nodes are reused in situ. For the non-source node compilation mode, - // aliases will not be used, but this case is already being run on the client and - // we aren't concern about minimizing the template size. - var aliasCount = 0; - for (var alias in this.aliases) { - var node = this.aliases[alias]; - - if (this.aliases.hasOwnProperty(alias) && node.children && node.referenceCount > 1) { - varDeclarations += ', alias' + (++aliasCount) + '=' + alias; - node.children[0] = 'alias' + aliasCount; - } - } - - var params = ["depth0", "helpers", "partials", "data"]; - - if (this.useBlockParams || this.useDepths) { - params.push('blockParams'); - } - if (this.useDepths) { - params.push('depths'); - } - - // Perform a second pass over the output to merge content when possible - var source = this.mergeSource(varDeclarations); - - if (asObject) { - params.push(source); - - return Function.apply(this, params); - } else { - return this.source.wrap(['function(', params.join(','), ') {\n ', source, '}']); - } - }, - mergeSource: function(varDeclarations) { - var isSimple = this.environment.isSimple, - appendOnly = !this.forceBuffer, - appendFirst, - - sourceSeen, - bufferStart, - bufferEnd; - this.source.each(function(line) { - if (line.appendToBuffer) { - if (bufferStart) { - line.prepend(' + '); - } else { - bufferStart = line; - } - bufferEnd = line; - } else { - if (bufferStart) { - if (!sourceSeen) { - appendFirst = true; - } else { - bufferStart.prepend('buffer += '); - } - bufferEnd.add(';'); - bufferStart = bufferEnd = undefined; - } - - sourceSeen = true; - if (!isSimple) { - appendOnly = false; - } - } - }); - - - if (appendOnly) { - if (bufferStart) { - bufferStart.prepend('return '); - bufferEnd.add(';'); - } else if (!sourceSeen) { - this.source.push('return "";'); - } - } else { - varDeclarations += ", buffer = " + (appendFirst ? '' : this.initializeBuffer()); - - if (bufferStart) { - bufferStart.prepend('return buffer + '); - bufferEnd.add(';'); - } else { - this.source.push('return buffer;'); - } - } - - if (varDeclarations) { - this.source.prepend('var ' + varDeclarations.substring(2) + (appendFirst ? '' : ';\n')); - } - - return this.source.merge(); - }, - - // [blockValue] - // - // On stack, before: hash, inverse, program, value - // On stack, after: return value of blockHelperMissing - // - // The purpose of this opcode is to take a block of the form - // `{{#this.foo}}...{{/this.foo}}`, resolve the value of `foo`, and - // replace it on the stack with the result of properly - // invoking blockHelperMissing. - blockValue: function(name) { - var blockHelperMissing = this.aliasable('helpers.blockHelperMissing'), - params = [this.contextName(0)]; - this.setupHelperArgs(name, 0, params); - - var blockName = this.popStack(); - params.splice(1, 0, blockName); - - this.push(this.source.functionCall(blockHelperMissing, 'call', params)); - }, - - // [ambiguousBlockValue] - // - // On stack, before: hash, inverse, program, value - // Compiler value, before: lastHelper=value of last found helper, if any - // On stack, after, if no lastHelper: same as [blockValue] - // On stack, after, if lastHelper: value - ambiguousBlockValue: function() { - // We're being a bit cheeky and reusing the options value from the prior exec - var blockHelperMissing = this.aliasable('helpers.blockHelperMissing'), - params = [this.contextName(0)]; - this.setupHelperArgs('', 0, params, true); - - this.flushInline(); - - var current = this.topStack(); - params.splice(1, 0, current); - - this.pushSource([ - 'if (!', this.lastHelper, ') { ', - current, ' = ', this.source.functionCall(blockHelperMissing, 'call', params), - '}']); - }, - - // [appendContent] - // - // On stack, before: ... - // On stack, after: ... - // - // Appends the string value of `content` to the current buffer - appendContent: function(content) { - if (this.pendingContent) { - content = this.pendingContent + content; - } else { - this.pendingLocation = this.source.currentLocation; - } - - this.pendingContent = content; - }, - - // [append] - // - // On stack, before: value, ... - // On stack, after: ... - // - // Coerces `value` to a String and appends it to the current buffer. - // - // If `value` is truthy, or 0, it is coerced into a string and appended - // Otherwise, the empty string is appended - append: function() { - if (this.isInline()) { - this.replaceStack(function(current) { - return [' != null ? ', current, ' : ""']; - }); - - this.pushSource(this.appendToBuffer(this.popStack())); - } else { - var local = this.popStack(); - this.pushSource(['if (', local, ' != null) { ', this.appendToBuffer(local, undefined, true), ' }']); - if (this.environment.isSimple) { - this.pushSource(['else { ', this.appendToBuffer("''", undefined, true), ' }']); - } - } - }, - - // [appendEscaped] - // - // On stack, before: value, ... - // On stack, after: ... - // - // Escape `value` and append it to the buffer - appendEscaped: function() { - this.pushSource(this.appendToBuffer( - [this.aliasable('this.escapeExpression'), '(', this.popStack(), ')'])); - }, - - // [getContext] - // - // On stack, before: ... - // On stack, after: ... - // Compiler value, after: lastContext=depth - // - // Set the value of the `lastContext` compiler value to the depth - getContext: function(depth) { - this.lastContext = depth; - }, - - // [pushContext] - // - // On stack, before: ... - // On stack, after: currentContext, ... - // - // Pushes the value of the current context onto the stack. - pushContext: function() { - this.pushStackLiteral(this.contextName(this.lastContext)); - }, - - // [lookupOnContext] - // - // On stack, before: ... - // On stack, after: currentContext[name], ... - // - // Looks up the value of `name` on the current context and pushes - // it onto the stack. - lookupOnContext: function(parts, falsy, scoped) { - var i = 0; - - if (!scoped && this.options.compat && !this.lastContext) { - // The depthed query is expected to handle the undefined logic for the root level that - // is implemented below, so we evaluate that directly in compat mode - this.push(this.depthedLookup(parts[i++])); - } else { - this.pushContext(); - } - - this.resolvePath('context', parts, i, falsy); - }, - - // [lookupBlockParam] - // - // On stack, before: ... - // On stack, after: blockParam[name], ... - // - // Looks up the value of `parts` on the given block param and pushes - // it onto the stack. - lookupBlockParam: function(blockParamId, parts) { - this.useBlockParams = true; - - this.push(['blockParams[', blockParamId[0], '][', blockParamId[1], ']']); - this.resolvePath('context', parts, 1); - }, - - // [lookupData] - // - // On stack, before: ... - // On stack, after: data, ... - // - // Push the data lookup operator - lookupData: function(depth, parts) { - /*jshint -W083 */ - if (!depth) { - this.pushStackLiteral('data'); - } else { - this.pushStackLiteral('this.data(data, ' + depth + ')'); - } - - this.resolvePath('data', parts, 0, true); - }, - - resolvePath: function(type, parts, i, falsy) { - /*jshint -W083 */ - if (this.options.strict || this.options.assumeObjects) { - this.push(strictLookup(this.options.strict, this, parts, type)); - return; - } - - var len = parts.length; - for (; i < len; i++) { - this.replaceStack(function(current) { - var lookup = this.nameLookup(current, parts[i], type); - // We want to ensure that zero and false are handled properly if the context (falsy flag) - // needs to have the special handling for these values. - if (!falsy) { - return [' != null ? ', lookup, ' : ', current]; - } else { - // Otherwise we can use generic falsy handling - return [' && ', lookup]; - } - }); - } - }, - - // [resolvePossibleLambda] - // - // On stack, before: value, ... - // On stack, after: resolved value, ... - // - // If the `value` is a lambda, replace it on the stack by - // the return value of the lambda - resolvePossibleLambda: function() { - this.push([this.aliasable('this.lambda'), '(', this.popStack(), ', ', this.contextName(0), ')']); - }, - - // [pushStringParam] - // - // On stack, before: ... - // On stack, after: string, currentContext, ... - // - // This opcode is designed for use in string mode, which - // provides the string value of a parameter along with its - // depth rather than resolving it immediately. - pushStringParam: function(string, type) { - this.pushContext(); - this.pushString(type); - - // If it's a subexpression, the string result - // will be pushed after this opcode. - if (type !== 'SubExpression') { - if (typeof string === 'string') { - this.pushString(string); - } else { - this.pushStackLiteral(string); - } - } - }, - - emptyHash: function(omitEmpty) { - if (this.trackIds) { - this.push('{}'); // hashIds - } - if (this.stringParams) { - this.push('{}'); // hashContexts - this.push('{}'); // hashTypes - } - this.pushStackLiteral(omitEmpty ? 'undefined' : '{}'); - }, - pushHash: function() { - if (this.hash) { - this.hashes.push(this.hash); - } - this.hash = {values: [], types: [], contexts: [], ids: []}; - }, - popHash: function() { - var hash = this.hash; - this.hash = this.hashes.pop(); - - if (this.trackIds) { - this.push(this.objectLiteral(hash.ids)); - } - if (this.stringParams) { - this.push(this.objectLiteral(hash.contexts)); - this.push(this.objectLiteral(hash.types)); - } - - this.push(this.objectLiteral(hash.values)); - }, - - // [pushString] - // - // On stack, before: ... - // On stack, after: quotedString(string), ... - // - // Push a quoted version of `string` onto the stack - pushString: function(string) { - this.pushStackLiteral(this.quotedString(string)); - }, - - // [pushLiteral] - // - // On stack, before: ... - // On stack, after: value, ... - // - // Pushes a value onto the stack. This operation prevents - // the compiler from creating a temporary variable to hold - // it. - pushLiteral: function(value) { - this.pushStackLiteral(value); - }, - - // [pushProgram] - // - // On stack, before: ... - // On stack, after: program(guid), ... - // - // Push a program expression onto the stack. This takes - // a compile-time guid and converts it into a runtime-accessible - // expression. - pushProgram: function(guid) { - if (guid != null) { - this.pushStackLiteral(this.programExpression(guid)); - } else { - this.pushStackLiteral(null); - } - }, - - // [invokeHelper] - // - // On stack, before: hash, inverse, program, params..., ... - // On stack, after: result of helper invocation - // - // Pops off the helper's parameters, invokes the helper, - // and pushes the helper's return value onto the stack. - // - // If the helper is not found, `helperMissing` is called. - invokeHelper: function(paramSize, name, isSimple) { - var nonHelper = this.popStack(); - var helper = this.setupHelper(paramSize, name); - var simple = isSimple ? [helper.name, ' || '] : ''; - - var lookup = ['('].concat(simple, nonHelper); - if (!this.options.strict) { - lookup.push(' || ', this.aliasable('helpers.helperMissing')); - } - lookup.push(')'); - - this.push(this.source.functionCall(lookup, 'call', helper.callParams)); - }, - - // [invokeKnownHelper] - // - // On stack, before: hash, inverse, program, params..., ... - // On stack, after: result of helper invocation - // - // This operation is used when the helper is known to exist, - // so a `helperMissing` fallback is not required. - invokeKnownHelper: function(paramSize, name) { - var helper = this.setupHelper(paramSize, name); - this.push(this.source.functionCall(helper.name, 'call', helper.callParams)); - }, - - // [invokeAmbiguous] - // - // On stack, before: hash, inverse, program, params..., ... - // On stack, after: result of disambiguation - // - // This operation is used when an expression like `{{foo}}` - // is provided, but we don't know at compile-time whether it - // is a helper or a path. - // - // This operation emits more code than the other options, - // and can be avoided by passing the `knownHelpers` and - // `knownHelpersOnly` flags at compile-time. - invokeAmbiguous: function(name, helperCall) { - this.useRegister('helper'); - - var nonHelper = this.popStack(); - - this.emptyHash(); - var helper = this.setupHelper(0, name, helperCall); - - var helperName = this.lastHelper = this.nameLookup('helpers', name, 'helper'); - - var lookup = ['(', '(helper = ', helperName, ' || ', nonHelper, ')']; - if (!this.options.strict) { - lookup[0] = '(helper = '; - lookup.push( - ' != null ? helper : ', - this.aliasable('helpers.helperMissing') - ); - } - - this.push([ - '(', lookup, - (helper.paramsInit ? ['),(', helper.paramsInit] : []), '),', - '(typeof helper === ', this.aliasable('"function"'), ' ? ', - this.source.functionCall('helper','call', helper.callParams), ' : helper))' - ]); - }, - - // [invokePartial] - // - // On stack, before: context, ... - // On stack after: result of partial invocation - // - // This operation pops off a context, invokes a partial with that context, - // and pushes the result of the invocation back. - invokePartial: function(isDynamic, name, indent) { - var params = [], - options = this.setupParams(name, 1, params, false); - - if (isDynamic) { - name = this.popStack(); - delete options.name; - } - - if (indent) { - options.indent = JSON.stringify(indent); - } - options.helpers = 'helpers'; - options.partials = 'partials'; - - if (!isDynamic) { - params.unshift(this.nameLookup('partials', name, 'partial')); - } else { - params.unshift(name); - } - - if (this.options.compat) { - options.depths = 'depths'; - } - options = this.objectLiteral(options); - params.push(options); - - this.push(this.source.functionCall('this.invokePartial', '', params)); - }, - - // [assignToHash] - // - // On stack, before: value, ..., hash, ... - // On stack, after: ..., hash, ... - // - // Pops a value off the stack and assigns it to the current hash - assignToHash: function(key) { - var value = this.popStack(), - context, - type, - id; - - if (this.trackIds) { - id = this.popStack(); - } - if (this.stringParams) { - type = this.popStack(); - context = this.popStack(); - } - - var hash = this.hash; - if (context) { - hash.contexts[key] = context; - } - if (type) { - hash.types[key] = type; - } - if (id) { - hash.ids[key] = id; - } - hash.values[key] = value; - }, - - pushId: function(type, name, child) { - if (type === 'BlockParam') { - this.pushStackLiteral( - 'blockParams[' + name[0] + '].path[' + name[1] + ']' - + (child ? ' + ' + JSON.stringify('.' + child) : '')); - } else if (type === 'PathExpression') { - this.pushString(name); - } else if (type === 'SubExpression') { - this.pushStackLiteral('true'); - } else { - this.pushStackLiteral('null'); - } - }, - - // HELPERS - - compiler: JavaScriptCompiler, - - compileChildren: function(environment, options) { - var children = environment.children, child, compiler; - - for(var i=0, l=children.length; i this.stackVars.length) { this.stackVars.push("stack" + this.stackSlot); } - return this.topStackName(); - }, - topStackName: function() { - return "stack" + this.stackSlot; - }, - flushInline: function() { - var inlineStack = this.inlineStack; - this.inlineStack = []; - for (var i = 0, len = inlineStack.length; i < len; i++) { - var entry = inlineStack[i]; - /* istanbul ignore if */ - if (entry instanceof Literal) { - this.compileStack.push(entry); - } else { - var stack = this.incrStack(); - this.pushSource([stack, ' = ', entry, ';']); - this.compileStack.push(stack); - } - } - }, - isInline: function() { - return this.inlineStack.length; - }, - - popStack: function(wrapped) { - var inline = this.isInline(), - item = (inline ? this.inlineStack : this.compileStack).pop(); - - if (!wrapped && (item instanceof Literal)) { - return item.value; - } else { - if (!inline) { - /* istanbul ignore next */ - if (!this.stackSlot) { - throw new Exception('Invalid stack pop'); - } - this.stackSlot--; - } - return item; - } - }, - - topStack: function() { - var stack = (this.isInline() ? this.inlineStack : this.compileStack), - item = stack[stack.length - 1]; - - /* istanbul ignore if */ - if (item instanceof Literal) { - return item.value; - } else { - return item; - } - }, - - contextName: function(context) { - if (this.useDepths && context) { - return 'depths[' + context + ']'; - } else { - return 'depth' + context; - } - }, - - quotedString: function(str) { - return this.source.quotedString(str); - }, - - objectLiteral: function(obj) { - return this.source.objectLiteral(obj); - }, - - aliasable: function(name) { - var ret = this.aliases[name]; - if (ret) { - ret.referenceCount++; - return ret; - } - - ret = this.aliases[name] = this.source.wrap(name); - ret.aliasable = true; - ret.referenceCount = 1; - - return ret; - }, - - setupHelper: function(paramSize, name, blockHelper) { - var params = [], - paramsInit = this.setupHelperArgs(name, paramSize, params, blockHelper); - var foundHelper = this.nameLookup('helpers', name, 'helper'); - - return { - params: params, - paramsInit: paramsInit, - name: foundHelper, - callParams: [this.contextName(0)].concat(params) - }; - }, - - setupParams: function(helper, paramSize, params) { - var options = {}, contexts = [], types = [], ids = [], param; - - options.name = this.quotedString(helper); - options.hash = this.popStack(); - - if (this.trackIds) { - options.hashIds = this.popStack(); - } - if (this.stringParams) { - options.hashTypes = this.popStack(); - options.hashContexts = this.popStack(); - } - - var inverse = this.popStack(), - program = this.popStack(); - - // Avoid setting fn and inverse if neither are set. This allows - // helpers to do a check for `if (options.fn)` - if (program || inverse) { - options.fn = program || 'this.noop'; - options.inverse = inverse || 'this.noop'; - } - - // The parameters go on to the stack in order (making sure that they are evaluated in order) - // so we need to pop them off the stack in reverse order - var i = paramSize; - while (i--) { - param = this.popStack(); - params[i] = param; - - if (this.trackIds) { - ids[i] = this.popStack(); - } - if (this.stringParams) { - types[i] = this.popStack(); - contexts[i] = this.popStack(); - } - } - - if (this.trackIds) { - options.ids = this.source.generateArray(ids); - } - if (this.stringParams) { - options.types = this.source.generateArray(types); - options.contexts = this.source.generateArray(contexts); - } - - if (this.options.data) { - options.data = 'data'; - } - if (this.useBlockParams) { - options.blockParams = 'blockParams'; - } - return options; - }, - - setupHelperArgs: function(helper, paramSize, params, useRegister) { - var options = this.setupParams(helper, paramSize, params, true); - options = this.objectLiteral(options); - if (useRegister) { - this.useRegister('options'); - params.push('options'); - return ['options=', options]; - } else { - params.push(options); - return ''; - } - } - }; - - - var reservedWords = ( - "break else new var" + - " case finally return void" + - " catch for switch while" + - " continue function this with" + - " default if throw" + - " delete in try" + - " do instanceof typeof" + - " abstract enum int short" + - " boolean export interface static" + - " byte extends long super" + - " char final native synchronized" + - " class float package throws" + - " const goto private transient" + - " debugger implements protected volatile" + - " double import public let yield await" + - " null true false" - ).split(" "); - - var compilerWords = JavaScriptCompiler.RESERVED_WORDS = {}; - - for(var i=0, l=reservedWords.length; i= 2.0.0-beta.1', + 7: '>= 4.0.0' + }; + + exports.REVISION_CHANGES = REVISION_CHANGES; + var objectType = '[object Object]'; + + function HandlebarsEnvironment(helpers, partials, decorators) { + this.helpers = helpers || {}; + this.partials = partials || {}; + this.decorators = decorators || {}; + + _helpers.registerDefaultHelpers(this); + _decorators.registerDefaultDecorators(this); + } + + HandlebarsEnvironment.prototype = { + constructor: HandlebarsEnvironment, + + logger: _logger2['default'], + log: _logger2['default'].log, + + registerHelper: function registerHelper(name, fn) { + if (_utils.toString.call(name) === objectType) { + if (fn) { + throw new _exception2['default']('Arg not supported with multiple helpers'); + } + _utils.extend(this.helpers, name); + } else { + this.helpers[name] = fn; + } + }, + unregisterHelper: function unregisterHelper(name) { + delete this.helpers[name]; + }, + + registerPartial: function registerPartial(name, partial) { + if (_utils.toString.call(name) === objectType) { + _utils.extend(this.partials, name); + } else { + if (typeof partial === 'undefined') { + throw new _exception2['default']('Attempting to register a partial as undefined'); + } + this.partials[name] = partial; + } + }, + unregisterPartial: function unregisterPartial(name) { + delete this.partials[name]; + }, + + registerDecorator: function registerDecorator(name, fn) { + if (_utils.toString.call(name) === objectType) { + if (fn) { + throw new _exception2['default']('Arg not supported with multiple decorators'); + } + _utils.extend(this.decorators, name); + } else { + this.decorators[name] = fn; + } + }, + unregisterDecorator: function unregisterDecorator(name) { + delete this.decorators[name]; + } + }; + + var log = _logger2['default'].log; + + exports.log = log; + exports.createFrame = _utils.createFrame; + exports.logger = _logger2['default']; + +/***/ }, +/* 5 */ +/***/ function(module, exports) { + + 'use strict'; + + exports.__esModule = true; + exports.extend = extend; + exports.indexOf = indexOf; + exports.escapeExpression = escapeExpression; + exports.isEmpty = isEmpty; + exports.createFrame = createFrame; + exports.blockParams = blockParams; + exports.appendContextPath = appendContextPath; + var escape = { + '&': '&', + '<': '<', + '>': '>', + '"': '"', + "'": ''', + '`': '`', + '=': '=' + }; + + var badChars = /[&<>"'`=]/g, + possible = /[&<>"'`=]/; + + function escapeChar(chr) { + return escape[chr]; + } + + function extend(obj /* , ...source */) { + for (var i = 1; i < arguments.length; i++) { + for (var key in arguments[i]) { + if (Object.prototype.hasOwnProperty.call(arguments[i], key)) { + obj[key] = arguments[i][key]; + } + } + } + + return obj; + } + + var toString = Object.prototype.toString; + + exports.toString = toString; + // Sourced from lodash + // https://github.com/bestiejs/lodash/blob/master/LICENSE.txt + /* eslint-disable func-style */ + var isFunction = function isFunction(value) { + return typeof value === 'function'; + }; + // fallback for older versions of Chrome and Safari + /* istanbul ignore next */ + if (isFunction(/x/)) { + exports.isFunction = isFunction = function (value) { + return typeof value === 'function' && toString.call(value) === '[object Function]'; + }; + } + exports.isFunction = isFunction; + + /* eslint-enable func-style */ + + /* istanbul ignore next */ + var isArray = Array.isArray || function (value) { + return value && typeof value === 'object' ? toString.call(value) === '[object Array]' : false; + }; + + exports.isArray = isArray; + // Older IE versions do not directly support indexOf so we must implement our own, sadly. + + function indexOf(array, value) { + for (var i = 0, len = array.length; i < len; i++) { + if (array[i] === value) { + return i; + } + } + return -1; + } + + function escapeExpression(string) { + if (typeof string !== 'string') { + // don't escape SafeStrings, since they're already safe + if (string && string.toHTML) { + return string.toHTML(); + } else if (string == null) { + return ''; + } else if (!string) { + return string + ''; + } + + // Force a string conversion as this will be done by the append regardless and + // the regex test will do this transparently behind the scenes, causing issues if + // an object's to string has escaped characters in it. + string = '' + string; + } + + if (!possible.test(string)) { + return string; + } + return string.replace(badChars, escapeChar); + } + + function isEmpty(value) { + if (!value && value !== 0) { + return true; + } else if (isArray(value) && value.length === 0) { + return true; + } else { + return false; + } + } + + function createFrame(object) { + var frame = extend({}, object); + frame._parent = object; + return frame; + } + + function blockParams(params, ids) { + params.path = ids; + return params; + } + + function appendContextPath(contextPath, id) { + return (contextPath ? contextPath + '.' : '') + id; + } + +/***/ }, +/* 6 */ +/***/ function(module, exports) { + + 'use strict'; + + exports.__esModule = true; + + var errorProps = ['description', 'fileName', 'lineNumber', 'message', 'name', 'number', 'stack']; + + function Exception(message, node) { + var loc = node && node.loc, + line = undefined, + column = undefined; + if (loc) { + line = loc.start.line; + column = loc.start.column; + + message += ' - ' + line + ':' + column; + } + + var tmp = Error.prototype.constructor.call(this, message); + + // Unfortunately errors are not enumerable in Chrome (at least), so `for prop in tmp` doesn't work. + for (var idx = 0; idx < errorProps.length; idx++) { + this[errorProps[idx]] = tmp[errorProps[idx]]; + } + + /* istanbul ignore else */ + if (Error.captureStackTrace) { + Error.captureStackTrace(this, Exception); + } + + if (loc) { + this.lineNumber = line; + this.column = column; + } + } + + Exception.prototype = new Error(); + + exports['default'] = Exception; + module.exports = exports['default']; + +/***/ }, +/* 7 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + var _interopRequireDefault = __webpack_require__(1)['default']; + + exports.__esModule = true; + exports.registerDefaultHelpers = registerDefaultHelpers; + + var _helpersBlockHelperMissing = __webpack_require__(8); + + var _helpersBlockHelperMissing2 = _interopRequireDefault(_helpersBlockHelperMissing); + + var _helpersEach = __webpack_require__(9); + + var _helpersEach2 = _interopRequireDefault(_helpersEach); + + var _helpersHelperMissing = __webpack_require__(10); + + var _helpersHelperMissing2 = _interopRequireDefault(_helpersHelperMissing); + + var _helpersIf = __webpack_require__(11); + + var _helpersIf2 = _interopRequireDefault(_helpersIf); + + var _helpersLog = __webpack_require__(12); + + var _helpersLog2 = _interopRequireDefault(_helpersLog); + + var _helpersLookup = __webpack_require__(13); + + var _helpersLookup2 = _interopRequireDefault(_helpersLookup); + + var _helpersWith = __webpack_require__(14); + + var _helpersWith2 = _interopRequireDefault(_helpersWith); + + function registerDefaultHelpers(instance) { + _helpersBlockHelperMissing2['default'](instance); + _helpersEach2['default'](instance); + _helpersHelperMissing2['default'](instance); + _helpersIf2['default'](instance); + _helpersLog2['default'](instance); + _helpersLookup2['default'](instance); + _helpersWith2['default'](instance); + } + +/***/ }, +/* 8 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + exports.__esModule = true; + + var _utils = __webpack_require__(5); + + exports['default'] = function (instance) { + instance.registerHelper('blockHelperMissing', function (context, options) { + var inverse = options.inverse, + fn = options.fn; + + if (context === true) { + return fn(this); + } else if (context === false || context == null) { + return inverse(this); + } else if (_utils.isArray(context)) { + if (context.length > 0) { + if (options.ids) { + options.ids = [options.name]; + } + + return instance.helpers.each(context, options); + } else { + return inverse(this); + } + } else { + if (options.data && options.ids) { + var data = _utils.createFrame(options.data); + data.contextPath = _utils.appendContextPath(options.data.contextPath, options.name); + options = { data: data }; + } + + return fn(context, options); + } + }); + }; + + module.exports = exports['default']; + +/***/ }, +/* 9 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + var _interopRequireDefault = __webpack_require__(1)['default']; + + exports.__esModule = true; + + var _utils = __webpack_require__(5); + + var _exception = __webpack_require__(6); + + var _exception2 = _interopRequireDefault(_exception); + + exports['default'] = function (instance) { + instance.registerHelper('each', function (context, options) { + if (!options) { + throw new _exception2['default']('Must pass iterator to #each'); + } + + var fn = options.fn, + inverse = options.inverse, + i = 0, + ret = '', + data = undefined, + contextPath = undefined; + + if (options.data && options.ids) { + contextPath = _utils.appendContextPath(options.data.contextPath, options.ids[0]) + '.'; + } + + if (_utils.isFunction(context)) { + context = context.call(this); + } + + if (options.data) { + data = _utils.createFrame(options.data); + } + + function execIteration(field, index, last) { + // Don't iterate over undefined values since we can't execute blocks against them + // in non-strict (js) mode. + if (context[field] == null) { + return; + } + + if (data) { + data.key = field; + data.index = index; + data.first = index === 0; + data.last = !!last; + + if (contextPath) { + data.contextPath = contextPath + field; + } + } + + ret = ret + fn(context[field], { + data: data, + blockParams: _utils.blockParams([context[field], field], [contextPath + field, null]) + }); + } + + if (context && typeof context === 'object') { + if (_utils.isArray(context)) { + for (var j = context.length; i < j; i++) { + execIteration(i, i, i === context.length - 1); + } + } else { + var priorKey = undefined; + + for (var key in context) { + if (context.hasOwnProperty(key)) { + // We're running the iterations one step out of sync so we can detect + // the last iteration without have to scan the object twice and create + // an itermediate keys array. + if (priorKey !== undefined) { + execIteration(priorKey, i - 1); + } + priorKey = key; + i++; + } + } + if (priorKey !== undefined) { + execIteration(priorKey, i - 1, true); + } + } + } + + if (i === 0) { + ret = inverse(this); + } + + return ret; + }); + }; + + module.exports = exports['default']; + +/***/ }, +/* 10 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + var _interopRequireDefault = __webpack_require__(1)['default']; + + exports.__esModule = true; + + var _exception = __webpack_require__(6); + + var _exception2 = _interopRequireDefault(_exception); + + exports['default'] = function (instance) { + instance.registerHelper('helperMissing', function () /* [args, ]options */{ + if (arguments.length === 1) { + // A missing field in a {{foo}} construct. + return undefined; + } else { + // Someone is actually trying to call something, blow up. + throw new _exception2['default']('Missing helper: "' + arguments[arguments.length - 1].name + '"'); + } + }); + }; + + module.exports = exports['default']; + +/***/ }, +/* 11 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + exports.__esModule = true; + + var _utils = __webpack_require__(5); + + exports['default'] = function (instance) { + instance.registerHelper('if', function (conditional, options) { + if (_utils.isFunction(conditional)) { + conditional = conditional.call(this); + } + + // Default behavior is to render the positive path if the value is truthy and not empty. + // The `includeZero` option may be set to treat the condtional as purely not empty based on the + // behavior of isEmpty. Effectively this determines if 0 is handled by the positive path or negative. + if (!options.hash.includeZero && !conditional || _utils.isEmpty(conditional)) { + return options.inverse(this); + } else { + return options.fn(this); + } + }); + + instance.registerHelper('unless', function (conditional, options) { + return instance.helpers['if'].call(this, conditional, { fn: options.inverse, inverse: options.fn, hash: options.hash }); + }); + }; + + module.exports = exports['default']; + +/***/ }, +/* 12 */ +/***/ function(module, exports) { + + 'use strict'; + + exports.__esModule = true; + + exports['default'] = function (instance) { + instance.registerHelper('log', function () /* message, options */{ + var args = [undefined], + options = arguments[arguments.length - 1]; + for (var i = 0; i < arguments.length - 1; i++) { + args.push(arguments[i]); + } + + var level = 1; + if (options.hash.level != null) { + level = options.hash.level; + } else if (options.data && options.data.level != null) { + level = options.data.level; + } + args[0] = level; + + instance.log.apply(instance, args); + }); + }; + + module.exports = exports['default']; + +/***/ }, +/* 13 */ +/***/ function(module, exports) { + + 'use strict'; + + exports.__esModule = true; + + exports['default'] = function (instance) { + instance.registerHelper('lookup', function (obj, field) { + return obj && obj[field]; + }); + }; + + module.exports = exports['default']; + +/***/ }, +/* 14 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + exports.__esModule = true; + + var _utils = __webpack_require__(5); + + exports['default'] = function (instance) { + instance.registerHelper('with', function (context, options) { + if (_utils.isFunction(context)) { + context = context.call(this); + } + + var fn = options.fn; + + if (!_utils.isEmpty(context)) { + var data = options.data; + if (options.data && options.ids) { + data = _utils.createFrame(options.data); + data.contextPath = _utils.appendContextPath(options.data.contextPath, options.ids[0]); + } + + return fn(context, { + data: data, + blockParams: _utils.blockParams([context], [data && data.contextPath]) + }); + } else { + return options.inverse(this); + } + }); + }; + + module.exports = exports['default']; + +/***/ }, +/* 15 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + var _interopRequireDefault = __webpack_require__(1)['default']; + + exports.__esModule = true; + exports.registerDefaultDecorators = registerDefaultDecorators; + + var _decoratorsInline = __webpack_require__(16); + + var _decoratorsInline2 = _interopRequireDefault(_decoratorsInline); + + function registerDefaultDecorators(instance) { + _decoratorsInline2['default'](instance); + } + +/***/ }, +/* 16 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + exports.__esModule = true; + + var _utils = __webpack_require__(5); + + exports['default'] = function (instance) { + instance.registerDecorator('inline', function (fn, props, container, options) { + var ret = fn; + if (!props.partials) { + props.partials = {}; + ret = function (context, options) { + // Create a new partials stack frame prior to exec. + var original = container.partials; + container.partials = _utils.extend({}, original, props.partials); + var ret = fn(context, options); + container.partials = original; + return ret; + }; + } + + props.partials[options.args[0]] = options.fn; + + return ret; + }); + }; + + module.exports = exports['default']; + +/***/ }, +/* 17 */ +/***/ function(module, exports) { + + 'use strict'; + + exports.__esModule = true; + var logger = { + methodMap: ['debug', 'info', 'warn', 'error'], + level: 'info', + + // Maps a given level value to the `methodMap` indexes above. + lookupLevel: function lookupLevel(level) { + if (typeof level === 'string') { + var levelMap = logger.methodMap.indexOf(level.toLowerCase()); + if (levelMap >= 0) { + level = levelMap; + } else { + level = parseInt(level, 10); + } + } + + return level; + }, + + // Can be overridden in the host environment + log: function log(level) { + level = logger.lookupLevel(level); + + if (typeof console !== 'undefined' && logger.lookupLevel(logger.level) <= level) { + var method = logger.methodMap[level]; + if (!console[method]) { + // eslint-disable-line no-console + method = 'log'; + } + + for (var _len = arguments.length, message = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { + message[_key - 1] = arguments[_key]; + } + + console[method].apply(console, message); // eslint-disable-line no-console + } + } + }; + + exports['default'] = logger; + module.exports = exports['default']; + +/***/ }, +/* 18 */ +/***/ function(module, exports) { + + // Build out our basic SafeString type + 'use strict'; + + exports.__esModule = true; + function SafeString(string) { + this.string = string; + } + + SafeString.prototype.toString = SafeString.prototype.toHTML = function () { + return '' + this.string; + }; + + exports['default'] = SafeString; + module.exports = exports['default']; + +/***/ }, +/* 19 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + var _interopRequireWildcard = __webpack_require__(3)['default']; + + var _interopRequireDefault = __webpack_require__(1)['default']; + + exports.__esModule = true; + exports.checkRevision = checkRevision; + exports.template = template; + exports.wrapProgram = wrapProgram; + exports.resolvePartial = resolvePartial; + exports.invokePartial = invokePartial; + exports.noop = noop; + + var _utils = __webpack_require__(5); + + var Utils = _interopRequireWildcard(_utils); + + var _exception = __webpack_require__(6); + + var _exception2 = _interopRequireDefault(_exception); + + var _base = __webpack_require__(4); + + function checkRevision(compilerInfo) { + var compilerRevision = compilerInfo && compilerInfo[0] || 1, + currentRevision = _base.COMPILER_REVISION; + + if (compilerRevision !== currentRevision) { + if (compilerRevision < currentRevision) { + var runtimeVersions = _base.REVISION_CHANGES[currentRevision], + compilerVersions = _base.REVISION_CHANGES[compilerRevision]; + throw new _exception2['default']('Template was precompiled with an older version of Handlebars than the current runtime. ' + 'Please update your precompiler to a newer version (' + runtimeVersions + ') or downgrade your runtime to an older version (' + compilerVersions + ').'); + } else { + // Use the embedded version info since the runtime doesn't know about this revision yet + throw new _exception2['default']('Template was precompiled with a newer version of Handlebars than the current runtime. ' + 'Please update your runtime to a newer version (' + compilerInfo[1] + ').'); + } + } + } + + function template(templateSpec, env) { + /* istanbul ignore next */ + if (!env) { + throw new _exception2['default']('No environment passed to template'); + } + if (!templateSpec || !templateSpec.main) { + throw new _exception2['default']('Unknown template object: ' + typeof templateSpec); + } + + templateSpec.main.decorator = templateSpec.main_d; + + // Note: Using env.VM references rather than local var references throughout this section to allow + // for external users to override these as psuedo-supported APIs. + env.VM.checkRevision(templateSpec.compiler); + + function invokePartialWrapper(partial, context, options) { + if (options.hash) { + context = Utils.extend({}, context, options.hash); + if (options.ids) { + options.ids[0] = true; + } + } + + partial = env.VM.resolvePartial.call(this, partial, context, options); + var result = env.VM.invokePartial.call(this, partial, context, options); + + if (result == null && env.compile) { + options.partials[options.name] = env.compile(partial, templateSpec.compilerOptions, env); + result = options.partials[options.name](context, options); + } + if (result != null) { + if (options.indent) { + var lines = result.split('\n'); + for (var i = 0, l = lines.length; i < l; i++) { + if (!lines[i] && i + 1 === l) { + break; + } + + lines[i] = options.indent + lines[i]; + } + result = lines.join('\n'); + } + return result; + } else { + throw new _exception2['default']('The partial ' + options.name + ' could not be compiled when running in runtime-only mode'); + } + } + + // Just add water + var container = { + strict: function strict(obj, name) { + if (!(name in obj)) { + throw new _exception2['default']('"' + name + '" not defined in ' + obj); + } + return obj[name]; + }, + lookup: function lookup(depths, name) { + var len = depths.length; + for (var i = 0; i < len; i++) { + if (depths[i] && depths[i][name] != null) { + return depths[i][name]; + } + } + }, + lambda: function lambda(current, context) { + return typeof current === 'function' ? current.call(context) : current; + }, + + escapeExpression: Utils.escapeExpression, + invokePartial: invokePartialWrapper, + + fn: function fn(i) { + var ret = templateSpec[i]; + ret.decorator = templateSpec[i + '_d']; + return ret; + }, + + programs: [], + program: function program(i, data, declaredBlockParams, blockParams, depths) { + var programWrapper = this.programs[i], + fn = this.fn(i); + if (data || depths || blockParams || declaredBlockParams) { + programWrapper = wrapProgram(this, i, fn, data, declaredBlockParams, blockParams, depths); + } else if (!programWrapper) { + programWrapper = this.programs[i] = wrapProgram(this, i, fn); + } + return programWrapper; + }, + + data: function data(value, depth) { + while (value && depth--) { + value = value._parent; + } + return value; + }, + merge: function merge(param, common) { + var obj = param || common; + + if (param && common && param !== common) { + obj = Utils.extend({}, common, param); + } + + return obj; + }, + + noop: env.VM.noop, + compilerInfo: templateSpec.compiler + }; + + function ret(context) { + var options = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1]; + + var data = options.data; + + ret._setup(options); + if (!options.partial && templateSpec.useData) { + data = initData(context, data); + } + var depths = undefined, + blockParams = templateSpec.useBlockParams ? [] : undefined; + if (templateSpec.useDepths) { + if (options.depths) { + depths = context !== options.depths[0] ? [context].concat(options.depths) : options.depths; + } else { + depths = [context]; + } + } + + function main(context /*, options*/) { + return '' + templateSpec.main(container, context, container.helpers, container.partials, data, blockParams, depths); + } + main = executeDecorators(templateSpec.main, main, container, options.depths || [], data, blockParams); + return main(context, options); + } + ret.isTop = true; + + ret._setup = function (options) { + if (!options.partial) { + container.helpers = container.merge(options.helpers, env.helpers); + + if (templateSpec.usePartial) { + container.partials = container.merge(options.partials, env.partials); + } + if (templateSpec.usePartial || templateSpec.useDecorators) { + container.decorators = container.merge(options.decorators, env.decorators); + } + } else { + container.helpers = options.helpers; + container.partials = options.partials; + container.decorators = options.decorators; + } + }; + + ret._child = function (i, data, blockParams, depths) { + if (templateSpec.useBlockParams && !blockParams) { + throw new _exception2['default']('must pass block params'); + } + if (templateSpec.useDepths && !depths) { + throw new _exception2['default']('must pass parent depths'); + } + + return wrapProgram(container, i, templateSpec[i], data, 0, blockParams, depths); + }; + return ret; + } + + function wrapProgram(container, i, fn, data, declaredBlockParams, blockParams, depths) { + function prog(context) { + var options = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1]; + + var currentDepths = depths; + if (depths && context !== depths[0]) { + currentDepths = [context].concat(depths); + } + + return fn(container, context, container.helpers, container.partials, options.data || data, blockParams && [options.blockParams].concat(blockParams), currentDepths); + } + + prog = executeDecorators(fn, prog, container, depths, data, blockParams); + + prog.program = i; + prog.depth = depths ? depths.length : 0; + prog.blockParams = declaredBlockParams || 0; + return prog; + } + + function resolvePartial(partial, context, options) { + if (!partial) { + if (options.name === '@partial-block') { + partial = options.data['partial-block']; + } else { + partial = options.partials[options.name]; + } + } else if (!partial.call && !options.name) { + // This is a dynamic partial that returned a string + options.name = partial; + partial = options.partials[partial]; + } + return partial; + } + + function invokePartial(partial, context, options) { + options.partial = true; + if (options.ids) { + options.data.contextPath = options.ids[0] || options.data.contextPath; + } + + var partialBlock = undefined; + if (options.fn && options.fn !== noop) { + partialBlock = options.data['partial-block'] = options.fn; + + if (partialBlock.partials) { + options.partials = Utils.extend({}, options.partials, partialBlock.partials); + } + } + + if (partial === undefined && partialBlock) { + partial = partialBlock; + } + + if (partial === undefined) { + throw new _exception2['default']('The partial ' + options.name + ' could not be found'); + } else if (partial instanceof Function) { + return partial(context, options); + } + } + + function noop() { + return ''; + } + + function initData(context, data) { + if (!data || !('root' in data)) { + data = data ? _base.createFrame(data) : {}; + data.root = context; + } + return data; + } + + function executeDecorators(fn, prog, container, depths, data, blockParams) { + if (fn.decorator) { + var props = {}; + prog = fn.decorator(prog, props, container, depths && depths[0], data, blockParams, depths); + Utils.extend(prog, props); + } + return prog; + } + +/***/ }, +/* 20 */ +/***/ function(module, exports) { + + /* WEBPACK VAR INJECTION */(function(global) {/* global window */ + 'use strict'; + + exports.__esModule = true; + + exports['default'] = function (Handlebars) { + /* istanbul ignore next */ + var root = typeof global !== 'undefined' ? global : window, + $Handlebars = root.Handlebars; + /* istanbul ignore next */ + Handlebars.noConflict = function () { + if (root.Handlebars === Handlebars) { + root.Handlebars = $Handlebars; + } + }; + }; + + module.exports = exports['default']; + /* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }()))) + +/***/ }, +/* 21 */ +/***/ function(module, exports) { + + 'use strict'; + + exports.__esModule = true; + var AST = { + // Public API used to evaluate derived attributes regarding AST nodes + helpers: { + // a mustache is definitely a helper if: + // * it is an eligible helper, and + // * it has at least one parameter or hash segment + helperExpression: function helperExpression(node) { + return node.type === 'SubExpression' || (node.type === 'MustacheStatement' || node.type === 'BlockStatement') && !!(node.params && node.params.length || node.hash); + }, + + scopedId: function scopedId(path) { + return (/^\.|this\b/.test(path.original) + ); + }, + + // an ID is simple if it only has one part, and that part is not + // `..` or `this`. + simpleId: function simpleId(path) { + return path.parts.length === 1 && !AST.helpers.scopedId(path) && !path.depth; + } + } + }; + + // Must be exported as an object rather than the root of the module as the jison lexer + // must modify the object to operate properly. + exports['default'] = AST; + module.exports = exports['default']; + +/***/ }, +/* 22 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + var _interopRequireDefault = __webpack_require__(1)['default']; + + var _interopRequireWildcard = __webpack_require__(3)['default']; + + exports.__esModule = true; + exports.parse = parse; + + var _parser = __webpack_require__(23); + + var _parser2 = _interopRequireDefault(_parser); + + var _whitespaceControl = __webpack_require__(24); + + var _whitespaceControl2 = _interopRequireDefault(_whitespaceControl); + + var _helpers = __webpack_require__(26); + + var Helpers = _interopRequireWildcard(_helpers); + + var _utils = __webpack_require__(5); + + exports.parser = _parser2['default']; + + var yy = {}; + _utils.extend(yy, Helpers); + + function parse(input, options) { + // Just return if an already-compiled AST was passed in. + if (input.type === 'Program') { + return input; + } + + _parser2['default'].yy = yy; + + // Altering the shared object here, but this is ok as parser is a sync operation + yy.locInfo = function (locInfo) { + return new yy.SourceLocation(options && options.srcName, locInfo); + }; + + var strip = new _whitespaceControl2['default'](options); + return strip.accept(_parser2['default'].parse(input)); + } + +/***/ }, +/* 23 */ +/***/ function(module, exports) { + + /* istanbul ignore next */ + /* Jison generated parser */ + "use strict"; + + var handlebars = (function () { + var parser = { trace: function trace() {}, + yy: {}, + symbols_: { "error": 2, "root": 3, "program": 4, "EOF": 5, "program_repetition0": 6, "statement": 7, "mustache": 8, "block": 9, "rawBlock": 10, "partial": 11, "partialBlock": 12, "content": 13, "COMMENT": 14, "CONTENT": 15, "openRawBlock": 16, "rawBlock_repetition_plus0": 17, "END_RAW_BLOCK": 18, "OPEN_RAW_BLOCK": 19, "helperName": 20, "openRawBlock_repetition0": 21, "openRawBlock_option0": 22, "CLOSE_RAW_BLOCK": 23, "openBlock": 24, "block_option0": 25, "closeBlock": 26, "openInverse": 27, "block_option1": 28, "OPEN_BLOCK": 29, "openBlock_repetition0": 30, "openBlock_option0": 31, "openBlock_option1": 32, "CLOSE": 33, "OPEN_INVERSE": 34, "openInverse_repetition0": 35, "openInverse_option0": 36, "openInverse_option1": 37, "openInverseChain": 38, "OPEN_INVERSE_CHAIN": 39, "openInverseChain_repetition0": 40, "openInverseChain_option0": 41, "openInverseChain_option1": 42, "inverseAndProgram": 43, "INVERSE": 44, "inverseChain": 45, "inverseChain_option0": 46, "OPEN_ENDBLOCK": 47, "OPEN": 48, "mustache_repetition0": 49, "mustache_option0": 50, "OPEN_UNESCAPED": 51, "mustache_repetition1": 52, "mustache_option1": 53, "CLOSE_UNESCAPED": 54, "OPEN_PARTIAL": 55, "partialName": 56, "partial_repetition0": 57, "partial_option0": 58, "openPartialBlock": 59, "OPEN_PARTIAL_BLOCK": 60, "openPartialBlock_repetition0": 61, "openPartialBlock_option0": 62, "param": 63, "sexpr": 64, "OPEN_SEXPR": 65, "sexpr_repetition0": 66, "sexpr_option0": 67, "CLOSE_SEXPR": 68, "hash": 69, "hash_repetition_plus0": 70, "hashSegment": 71, "ID": 72, "EQUALS": 73, "blockParams": 74, "OPEN_BLOCK_PARAMS": 75, "blockParams_repetition_plus0": 76, "CLOSE_BLOCK_PARAMS": 77, "path": 78, "dataName": 79, "STRING": 80, "NUMBER": 81, "BOOLEAN": 82, "UNDEFINED": 83, "NULL": 84, "DATA": 85, "pathSegments": 86, "SEP": 87, "$accept": 0, "$end": 1 }, + terminals_: { 2: "error", 5: "EOF", 14: "COMMENT", 15: "CONTENT", 18: "END_RAW_BLOCK", 19: "OPEN_RAW_BLOCK", 23: "CLOSE_RAW_BLOCK", 29: "OPEN_BLOCK", 33: "CLOSE", 34: "OPEN_INVERSE", 39: "OPEN_INVERSE_CHAIN", 44: "INVERSE", 47: "OPEN_ENDBLOCK", 48: "OPEN", 51: "OPEN_UNESCAPED", 54: "CLOSE_UNESCAPED", 55: "OPEN_PARTIAL", 60: "OPEN_PARTIAL_BLOCK", 65: "OPEN_SEXPR", 68: "CLOSE_SEXPR", 72: "ID", 73: "EQUALS", 75: "OPEN_BLOCK_PARAMS", 77: "CLOSE_BLOCK_PARAMS", 80: "STRING", 81: "NUMBER", 82: "BOOLEAN", 83: "UNDEFINED", 84: "NULL", 85: "DATA", 87: "SEP" }, + productions_: [0, [3, 2], [4, 1], [7, 1], [7, 1], [7, 1], [7, 1], [7, 1], [7, 1], [7, 1], [13, 1], [10, 3], [16, 5], [9, 4], [9, 4], [24, 6], [27, 6], [38, 6], [43, 2], [45, 3], [45, 1], [26, 3], [8, 5], [8, 5], [11, 5], [12, 3], [59, 5], [63, 1], [63, 1], [64, 5], [69, 1], [71, 3], [74, 3], [20, 1], [20, 1], [20, 1], [20, 1], [20, 1], [20, 1], [20, 1], [56, 1], [56, 1], [79, 2], [78, 1], [86, 3], [86, 1], [6, 0], [6, 2], [17, 1], [17, 2], [21, 0], [21, 2], [22, 0], [22, 1], [25, 0], [25, 1], [28, 0], [28, 1], [30, 0], [30, 2], [31, 0], [31, 1], [32, 0], [32, 1], [35, 0], [35, 2], [36, 0], [36, 1], [37, 0], [37, 1], [40, 0], [40, 2], [41, 0], [41, 1], [42, 0], [42, 1], [46, 0], [46, 1], [49, 0], [49, 2], [50, 0], [50, 1], [52, 0], [52, 2], [53, 0], [53, 1], [57, 0], [57, 2], [58, 0], [58, 1], [61, 0], [61, 2], [62, 0], [62, 1], [66, 0], [66, 2], [67, 0], [67, 1], [70, 1], [70, 2], [76, 1], [76, 2]], + performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$) { + + var $0 = $$.length - 1; + switch (yystate) { + case 1: + return $$[$0 - 1]; + break; + case 2: + this.$ = yy.prepareProgram($$[$0]); + break; + case 3: + this.$ = $$[$0]; + break; + case 4: + this.$ = $$[$0]; + break; + case 5: + this.$ = $$[$0]; + break; + case 6: + this.$ = $$[$0]; + break; + case 7: + this.$ = $$[$0]; + break; + case 8: + this.$ = $$[$0]; + break; + case 9: + this.$ = { + type: 'CommentStatement', + value: yy.stripComment($$[$0]), + strip: yy.stripFlags($$[$0], $$[$0]), + loc: yy.locInfo(this._$) + }; + + break; + case 10: + this.$ = { + type: 'ContentStatement', + original: $$[$0], + value: $$[$0], + loc: yy.locInfo(this._$) + }; + + break; + case 11: + this.$ = yy.prepareRawBlock($$[$0 - 2], $$[$0 - 1], $$[$0], this._$); + break; + case 12: + this.$ = { path: $$[$0 - 3], params: $$[$0 - 2], hash: $$[$0 - 1] }; + break; + case 13: + this.$ = yy.prepareBlock($$[$0 - 3], $$[$0 - 2], $$[$0 - 1], $$[$0], false, this._$); + break; + case 14: + this.$ = yy.prepareBlock($$[$0 - 3], $$[$0 - 2], $$[$0 - 1], $$[$0], true, this._$); + break; + case 15: + this.$ = { open: $$[$0 - 5], path: $$[$0 - 4], params: $$[$0 - 3], hash: $$[$0 - 2], blockParams: $$[$0 - 1], strip: yy.stripFlags($$[$0 - 5], $$[$0]) }; + break; + case 16: + this.$ = { path: $$[$0 - 4], params: $$[$0 - 3], hash: $$[$0 - 2], blockParams: $$[$0 - 1], strip: yy.stripFlags($$[$0 - 5], $$[$0]) }; + break; + case 17: + this.$ = { path: $$[$0 - 4], params: $$[$0 - 3], hash: $$[$0 - 2], blockParams: $$[$0 - 1], strip: yy.stripFlags($$[$0 - 5], $$[$0]) }; + break; + case 18: + this.$ = { strip: yy.stripFlags($$[$0 - 1], $$[$0 - 1]), program: $$[$0] }; + break; + case 19: + var inverse = yy.prepareBlock($$[$0 - 2], $$[$0 - 1], $$[$0], $$[$0], false, this._$), + program = yy.prepareProgram([inverse], $$[$0 - 1].loc); + program.chained = true; + + this.$ = { strip: $$[$0 - 2].strip, program: program, chain: true }; + + break; + case 20: + this.$ = $$[$0]; + break; + case 21: + this.$ = { path: $$[$0 - 1], strip: yy.stripFlags($$[$0 - 2], $$[$0]) }; + break; + case 22: + this.$ = yy.prepareMustache($$[$0 - 3], $$[$0 - 2], $$[$0 - 1], $$[$0 - 4], yy.stripFlags($$[$0 - 4], $$[$0]), this._$); + break; + case 23: + this.$ = yy.prepareMustache($$[$0 - 3], $$[$0 - 2], $$[$0 - 1], $$[$0 - 4], yy.stripFlags($$[$0 - 4], $$[$0]), this._$); + break; + case 24: + this.$ = { + type: 'PartialStatement', + name: $$[$0 - 3], + params: $$[$0 - 2], + hash: $$[$0 - 1], + indent: '', + strip: yy.stripFlags($$[$0 - 4], $$[$0]), + loc: yy.locInfo(this._$) + }; + + break; + case 25: + this.$ = yy.preparePartialBlock($$[$0 - 2], $$[$0 - 1], $$[$0], this._$); + break; + case 26: + this.$ = { path: $$[$0 - 3], params: $$[$0 - 2], hash: $$[$0 - 1], strip: yy.stripFlags($$[$0 - 4], $$[$0]) }; + break; + case 27: + this.$ = $$[$0]; + break; + case 28: + this.$ = $$[$0]; + break; + case 29: + this.$ = { + type: 'SubExpression', + path: $$[$0 - 3], + params: $$[$0 - 2], + hash: $$[$0 - 1], + loc: yy.locInfo(this._$) + }; + + break; + case 30: + this.$ = { type: 'Hash', pairs: $$[$0], loc: yy.locInfo(this._$) }; + break; + case 31: + this.$ = { type: 'HashPair', key: yy.id($$[$0 - 2]), value: $$[$0], loc: yy.locInfo(this._$) }; + break; + case 32: + this.$ = yy.id($$[$0 - 1]); + break; + case 33: + this.$ = $$[$0]; + break; + case 34: + this.$ = $$[$0]; + break; + case 35: + this.$ = { type: 'StringLiteral', value: $$[$0], original: $$[$0], loc: yy.locInfo(this._$) }; + break; + case 36: + this.$ = { type: 'NumberLiteral', value: Number($$[$0]), original: Number($$[$0]), loc: yy.locInfo(this._$) }; + break; + case 37: + this.$ = { type: 'BooleanLiteral', value: $$[$0] === 'true', original: $$[$0] === 'true', loc: yy.locInfo(this._$) }; + break; + case 38: + this.$ = { type: 'UndefinedLiteral', original: undefined, value: undefined, loc: yy.locInfo(this._$) }; + break; + case 39: + this.$ = { type: 'NullLiteral', original: null, value: null, loc: yy.locInfo(this._$) }; + break; + case 40: + this.$ = $$[$0]; + break; + case 41: + this.$ = $$[$0]; + break; + case 42: + this.$ = yy.preparePath(true, $$[$0], this._$); + break; + case 43: + this.$ = yy.preparePath(false, $$[$0], this._$); + break; + case 44: + $$[$0 - 2].push({ part: yy.id($$[$0]), original: $$[$0], separator: $$[$0 - 1] });this.$ = $$[$0 - 2]; + break; + case 45: + this.$ = [{ part: yy.id($$[$0]), original: $$[$0] }]; + break; + case 46: + this.$ = []; + break; + case 47: + $$[$0 - 1].push($$[$0]); + break; + case 48: + this.$ = [$$[$0]]; + break; + case 49: + $$[$0 - 1].push($$[$0]); + break; + case 50: + this.$ = []; + break; + case 51: + $$[$0 - 1].push($$[$0]); + break; + case 58: + this.$ = []; + break; + case 59: + $$[$0 - 1].push($$[$0]); + break; + case 64: + this.$ = []; + break; + case 65: + $$[$0 - 1].push($$[$0]); + break; + case 70: + this.$ = []; + break; + case 71: + $$[$0 - 1].push($$[$0]); + break; + case 78: + this.$ = []; + break; + case 79: + $$[$0 - 1].push($$[$0]); + break; + case 82: + this.$ = []; + break; + case 83: + $$[$0 - 1].push($$[$0]); + break; + case 86: + this.$ = []; + break; + case 87: + $$[$0 - 1].push($$[$0]); + break; + case 90: + this.$ = []; + break; + case 91: + $$[$0 - 1].push($$[$0]); + break; + case 94: + this.$ = []; + break; + case 95: + $$[$0 - 1].push($$[$0]); + break; + case 98: + this.$ = [$$[$0]]; + break; + case 99: + $$[$0 - 1].push($$[$0]); + break; + case 100: + this.$ = [$$[$0]]; + break; + case 101: + $$[$0 - 1].push($$[$0]); + break; + } + }, + table: [{ 3: 1, 4: 2, 5: [2, 46], 6: 3, 14: [2, 46], 15: [2, 46], 19: [2, 46], 29: [2, 46], 34: [2, 46], 48: [2, 46], 51: [2, 46], 55: [2, 46], 60: [2, 46] }, { 1: [3] }, { 5: [1, 4] }, { 5: [2, 2], 7: 5, 8: 6, 9: 7, 10: 8, 11: 9, 12: 10, 13: 11, 14: [1, 12], 15: [1, 20], 16: 17, 19: [1, 23], 24: 15, 27: 16, 29: [1, 21], 34: [1, 22], 39: [2, 2], 44: [2, 2], 47: [2, 2], 48: [1, 13], 51: [1, 14], 55: [1, 18], 59: 19, 60: [1, 24] }, { 1: [2, 1] }, { 5: [2, 47], 14: [2, 47], 15: [2, 47], 19: [2, 47], 29: [2, 47], 34: [2, 47], 39: [2, 47], 44: [2, 47], 47: [2, 47], 48: [2, 47], 51: [2, 47], 55: [2, 47], 60: [2, 47] }, { 5: [2, 3], 14: [2, 3], 15: [2, 3], 19: [2, 3], 29: [2, 3], 34: [2, 3], 39: [2, 3], 44: [2, 3], 47: [2, 3], 48: [2, 3], 51: [2, 3], 55: [2, 3], 60: [2, 3] }, { 5: [2, 4], 14: [2, 4], 15: [2, 4], 19: [2, 4], 29: [2, 4], 34: [2, 4], 39: [2, 4], 44: [2, 4], 47: [2, 4], 48: [2, 4], 51: [2, 4], 55: [2, 4], 60: [2, 4] }, { 5: [2, 5], 14: [2, 5], 15: [2, 5], 19: [2, 5], 29: [2, 5], 34: [2, 5], 39: [2, 5], 44: [2, 5], 47: [2, 5], 48: [2, 5], 51: [2, 5], 55: [2, 5], 60: [2, 5] }, { 5: [2, 6], 14: [2, 6], 15: [2, 6], 19: [2, 6], 29: [2, 6], 34: [2, 6], 39: [2, 6], 44: [2, 6], 47: [2, 6], 48: [2, 6], 51: [2, 6], 55: [2, 6], 60: [2, 6] }, { 5: [2, 7], 14: [2, 7], 15: [2, 7], 19: [2, 7], 29: [2, 7], 34: [2, 7], 39: [2, 7], 44: [2, 7], 47: [2, 7], 48: [2, 7], 51: [2, 7], 55: [2, 7], 60: [2, 7] }, { 5: [2, 8], 14: [2, 8], 15: [2, 8], 19: [2, 8], 29: [2, 8], 34: [2, 8], 39: [2, 8], 44: [2, 8], 47: [2, 8], 48: [2, 8], 51: [2, 8], 55: [2, 8], 60: [2, 8] }, { 5: [2, 9], 14: [2, 9], 15: [2, 9], 19: [2, 9], 29: [2, 9], 34: [2, 9], 39: [2, 9], 44: [2, 9], 47: [2, 9], 48: [2, 9], 51: [2, 9], 55: [2, 9], 60: [2, 9] }, { 20: 25, 72: [1, 35], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 20: 36, 72: [1, 35], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 4: 37, 6: 3, 14: [2, 46], 15: [2, 46], 19: [2, 46], 29: [2, 46], 34: [2, 46], 39: [2, 46], 44: [2, 46], 47: [2, 46], 48: [2, 46], 51: [2, 46], 55: [2, 46], 60: [2, 46] }, { 4: 38, 6: 3, 14: [2, 46], 15: [2, 46], 19: [2, 46], 29: [2, 46], 34: [2, 46], 44: [2, 46], 47: [2, 46], 48: [2, 46], 51: [2, 46], 55: [2, 46], 60: [2, 46] }, { 13: 40, 15: [1, 20], 17: 39 }, { 20: 42, 56: 41, 64: 43, 65: [1, 44], 72: [1, 35], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 4: 45, 6: 3, 14: [2, 46], 15: [2, 46], 19: [2, 46], 29: [2, 46], 34: [2, 46], 47: [2, 46], 48: [2, 46], 51: [2, 46], 55: [2, 46], 60: [2, 46] }, { 5: [2, 10], 14: [2, 10], 15: [2, 10], 18: [2, 10], 19: [2, 10], 29: [2, 10], 34: [2, 10], 39: [2, 10], 44: [2, 10], 47: [2, 10], 48: [2, 10], 51: [2, 10], 55: [2, 10], 60: [2, 10] }, { 20: 46, 72: [1, 35], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 20: 47, 72: [1, 35], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 20: 48, 72: [1, 35], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 20: 42, 56: 49, 64: 43, 65: [1, 44], 72: [1, 35], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 33: [2, 78], 49: 50, 65: [2, 78], 72: [2, 78], 80: [2, 78], 81: [2, 78], 82: [2, 78], 83: [2, 78], 84: [2, 78], 85: [2, 78] }, { 23: [2, 33], 33: [2, 33], 54: [2, 33], 65: [2, 33], 68: [2, 33], 72: [2, 33], 75: [2, 33], 80: [2, 33], 81: [2, 33], 82: [2, 33], 83: [2, 33], 84: [2, 33], 85: [2, 33] }, { 23: [2, 34], 33: [2, 34], 54: [2, 34], 65: [2, 34], 68: [2, 34], 72: [2, 34], 75: [2, 34], 80: [2, 34], 81: [2, 34], 82: [2, 34], 83: [2, 34], 84: [2, 34], 85: [2, 34] }, { 23: [2, 35], 33: [2, 35], 54: [2, 35], 65: [2, 35], 68: [2, 35], 72: [2, 35], 75: [2, 35], 80: [2, 35], 81: [2, 35], 82: [2, 35], 83: [2, 35], 84: [2, 35], 85: [2, 35] }, { 23: [2, 36], 33: [2, 36], 54: [2, 36], 65: [2, 36], 68: [2, 36], 72: [2, 36], 75: [2, 36], 80: [2, 36], 81: [2, 36], 82: [2, 36], 83: [2, 36], 84: [2, 36], 85: [2, 36] }, { 23: [2, 37], 33: [2, 37], 54: [2, 37], 65: [2, 37], 68: [2, 37], 72: [2, 37], 75: [2, 37], 80: [2, 37], 81: [2, 37], 82: [2, 37], 83: [2, 37], 84: [2, 37], 85: [2, 37] }, { 23: [2, 38], 33: [2, 38], 54: [2, 38], 65: [2, 38], 68: [2, 38], 72: [2, 38], 75: [2, 38], 80: [2, 38], 81: [2, 38], 82: [2, 38], 83: [2, 38], 84: [2, 38], 85: [2, 38] }, { 23: [2, 39], 33: [2, 39], 54: [2, 39], 65: [2, 39], 68: [2, 39], 72: [2, 39], 75: [2, 39], 80: [2, 39], 81: [2, 39], 82: [2, 39], 83: [2, 39], 84: [2, 39], 85: [2, 39] }, { 23: [2, 43], 33: [2, 43], 54: [2, 43], 65: [2, 43], 68: [2, 43], 72: [2, 43], 75: [2, 43], 80: [2, 43], 81: [2, 43], 82: [2, 43], 83: [2, 43], 84: [2, 43], 85: [2, 43], 87: [1, 51] }, { 72: [1, 35], 86: 52 }, { 23: [2, 45], 33: [2, 45], 54: [2, 45], 65: [2, 45], 68: [2, 45], 72: [2, 45], 75: [2, 45], 80: [2, 45], 81: [2, 45], 82: [2, 45], 83: [2, 45], 84: [2, 45], 85: [2, 45], 87: [2, 45] }, { 52: 53, 54: [2, 82], 65: [2, 82], 72: [2, 82], 80: [2, 82], 81: [2, 82], 82: [2, 82], 83: [2, 82], 84: [2, 82], 85: [2, 82] }, { 25: 54, 38: 56, 39: [1, 58], 43: 57, 44: [1, 59], 45: 55, 47: [2, 54] }, { 28: 60, 43: 61, 44: [1, 59], 47: [2, 56] }, { 13: 63, 15: [1, 20], 18: [1, 62] }, { 15: [2, 48], 18: [2, 48] }, { 33: [2, 86], 57: 64, 65: [2, 86], 72: [2, 86], 80: [2, 86], 81: [2, 86], 82: [2, 86], 83: [2, 86], 84: [2, 86], 85: [2, 86] }, { 33: [2, 40], 65: [2, 40], 72: [2, 40], 80: [2, 40], 81: [2, 40], 82: [2, 40], 83: [2, 40], 84: [2, 40], 85: [2, 40] }, { 33: [2, 41], 65: [2, 41], 72: [2, 41], 80: [2, 41], 81: [2, 41], 82: [2, 41], 83: [2, 41], 84: [2, 41], 85: [2, 41] }, { 20: 65, 72: [1, 35], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 26: 66, 47: [1, 67] }, { 30: 68, 33: [2, 58], 65: [2, 58], 72: [2, 58], 75: [2, 58], 80: [2, 58], 81: [2, 58], 82: [2, 58], 83: [2, 58], 84: [2, 58], 85: [2, 58] }, { 33: [2, 64], 35: 69, 65: [2, 64], 72: [2, 64], 75: [2, 64], 80: [2, 64], 81: [2, 64], 82: [2, 64], 83: [2, 64], 84: [2, 64], 85: [2, 64] }, { 21: 70, 23: [2, 50], 65: [2, 50], 72: [2, 50], 80: [2, 50], 81: [2, 50], 82: [2, 50], 83: [2, 50], 84: [2, 50], 85: [2, 50] }, { 33: [2, 90], 61: 71, 65: [2, 90], 72: [2, 90], 80: [2, 90], 81: [2, 90], 82: [2, 90], 83: [2, 90], 84: [2, 90], 85: [2, 90] }, { 20: 75, 33: [2, 80], 50: 72, 63: 73, 64: 76, 65: [1, 44], 69: 74, 70: 77, 71: 78, 72: [1, 79], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 72: [1, 80] }, { 23: [2, 42], 33: [2, 42], 54: [2, 42], 65: [2, 42], 68: [2, 42], 72: [2, 42], 75: [2, 42], 80: [2, 42], 81: [2, 42], 82: [2, 42], 83: [2, 42], 84: [2, 42], 85: [2, 42], 87: [1, 51] }, { 20: 75, 53: 81, 54: [2, 84], 63: 82, 64: 76, 65: [1, 44], 69: 83, 70: 77, 71: 78, 72: [1, 79], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 26: 84, 47: [1, 67] }, { 47: [2, 55] }, { 4: 85, 6: 3, 14: [2, 46], 15: [2, 46], 19: [2, 46], 29: [2, 46], 34: [2, 46], 39: [2, 46], 44: [2, 46], 47: [2, 46], 48: [2, 46], 51: [2, 46], 55: [2, 46], 60: [2, 46] }, { 47: [2, 20] }, { 20: 86, 72: [1, 35], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 4: 87, 6: 3, 14: [2, 46], 15: [2, 46], 19: [2, 46], 29: [2, 46], 34: [2, 46], 47: [2, 46], 48: [2, 46], 51: [2, 46], 55: [2, 46], 60: [2, 46] }, { 26: 88, 47: [1, 67] }, { 47: [2, 57] }, { 5: [2, 11], 14: [2, 11], 15: [2, 11], 19: [2, 11], 29: [2, 11], 34: [2, 11], 39: [2, 11], 44: [2, 11], 47: [2, 11], 48: [2, 11], 51: [2, 11], 55: [2, 11], 60: [2, 11] }, { 15: [2, 49], 18: [2, 49] }, { 20: 75, 33: [2, 88], 58: 89, 63: 90, 64: 76, 65: [1, 44], 69: 91, 70: 77, 71: 78, 72: [1, 79], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 65: [2, 94], 66: 92, 68: [2, 94], 72: [2, 94], 80: [2, 94], 81: [2, 94], 82: [2, 94], 83: [2, 94], 84: [2, 94], 85: [2, 94] }, { 5: [2, 25], 14: [2, 25], 15: [2, 25], 19: [2, 25], 29: [2, 25], 34: [2, 25], 39: [2, 25], 44: [2, 25], 47: [2, 25], 48: [2, 25], 51: [2, 25], 55: [2, 25], 60: [2, 25] }, { 20: 93, 72: [1, 35], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 20: 75, 31: 94, 33: [2, 60], 63: 95, 64: 76, 65: [1, 44], 69: 96, 70: 77, 71: 78, 72: [1, 79], 75: [2, 60], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 20: 75, 33: [2, 66], 36: 97, 63: 98, 64: 76, 65: [1, 44], 69: 99, 70: 77, 71: 78, 72: [1, 79], 75: [2, 66], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 20: 75, 22: 100, 23: [2, 52], 63: 101, 64: 76, 65: [1, 44], 69: 102, 70: 77, 71: 78, 72: [1, 79], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 20: 75, 33: [2, 92], 62: 103, 63: 104, 64: 76, 65: [1, 44], 69: 105, 70: 77, 71: 78, 72: [1, 79], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 33: [1, 106] }, { 33: [2, 79], 65: [2, 79], 72: [2, 79], 80: [2, 79], 81: [2, 79], 82: [2, 79], 83: [2, 79], 84: [2, 79], 85: [2, 79] }, { 33: [2, 81] }, { 23: [2, 27], 33: [2, 27], 54: [2, 27], 65: [2, 27], 68: [2, 27], 72: [2, 27], 75: [2, 27], 80: [2, 27], 81: [2, 27], 82: [2, 27], 83: [2, 27], 84: [2, 27], 85: [2, 27] }, { 23: [2, 28], 33: [2, 28], 54: [2, 28], 65: [2, 28], 68: [2, 28], 72: [2, 28], 75: [2, 28], 80: [2, 28], 81: [2, 28], 82: [2, 28], 83: [2, 28], 84: [2, 28], 85: [2, 28] }, { 23: [2, 30], 33: [2, 30], 54: [2, 30], 68: [2, 30], 71: 107, 72: [1, 108], 75: [2, 30] }, { 23: [2, 98], 33: [2, 98], 54: [2, 98], 68: [2, 98], 72: [2, 98], 75: [2, 98] }, { 23: [2, 45], 33: [2, 45], 54: [2, 45], 65: [2, 45], 68: [2, 45], 72: [2, 45], 73: [1, 109], 75: [2, 45], 80: [2, 45], 81: [2, 45], 82: [2, 45], 83: [2, 45], 84: [2, 45], 85: [2, 45], 87: [2, 45] }, { 23: [2, 44], 33: [2, 44], 54: [2, 44], 65: [2, 44], 68: [2, 44], 72: [2, 44], 75: [2, 44], 80: [2, 44], 81: [2, 44], 82: [2, 44], 83: [2, 44], 84: [2, 44], 85: [2, 44], 87: [2, 44] }, { 54: [1, 110] }, { 54: [2, 83], 65: [2, 83], 72: [2, 83], 80: [2, 83], 81: [2, 83], 82: [2, 83], 83: [2, 83], 84: [2, 83], 85: [2, 83] }, { 54: [2, 85] }, { 5: [2, 13], 14: [2, 13], 15: [2, 13], 19: [2, 13], 29: [2, 13], 34: [2, 13], 39: [2, 13], 44: [2, 13], 47: [2, 13], 48: [2, 13], 51: [2, 13], 55: [2, 13], 60: [2, 13] }, { 38: 56, 39: [1, 58], 43: 57, 44: [1, 59], 45: 112, 46: 111, 47: [2, 76] }, { 33: [2, 70], 40: 113, 65: [2, 70], 72: [2, 70], 75: [2, 70], 80: [2, 70], 81: [2, 70], 82: [2, 70], 83: [2, 70], 84: [2, 70], 85: [2, 70] }, { 47: [2, 18] }, { 5: [2, 14], 14: [2, 14], 15: [2, 14], 19: [2, 14], 29: [2, 14], 34: [2, 14], 39: [2, 14], 44: [2, 14], 47: [2, 14], 48: [2, 14], 51: [2, 14], 55: [2, 14], 60: [2, 14] }, { 33: [1, 114] }, { 33: [2, 87], 65: [2, 87], 72: [2, 87], 80: [2, 87], 81: [2, 87], 82: [2, 87], 83: [2, 87], 84: [2, 87], 85: [2, 87] }, { 33: [2, 89] }, { 20: 75, 63: 116, 64: 76, 65: [1, 44], 67: 115, 68: [2, 96], 69: 117, 70: 77, 71: 78, 72: [1, 79], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 33: [1, 118] }, { 32: 119, 33: [2, 62], 74: 120, 75: [1, 121] }, { 33: [2, 59], 65: [2, 59], 72: [2, 59], 75: [2, 59], 80: [2, 59], 81: [2, 59], 82: [2, 59], 83: [2, 59], 84: [2, 59], 85: [2, 59] }, { 33: [2, 61], 75: [2, 61] }, { 33: [2, 68], 37: 122, 74: 123, 75: [1, 121] }, { 33: [2, 65], 65: [2, 65], 72: [2, 65], 75: [2, 65], 80: [2, 65], 81: [2, 65], 82: [2, 65], 83: [2, 65], 84: [2, 65], 85: [2, 65] }, { 33: [2, 67], 75: [2, 67] }, { 23: [1, 124] }, { 23: [2, 51], 65: [2, 51], 72: [2, 51], 80: [2, 51], 81: [2, 51], 82: [2, 51], 83: [2, 51], 84: [2, 51], 85: [2, 51] }, { 23: [2, 53] }, { 33: [1, 125] }, { 33: [2, 91], 65: [2, 91], 72: [2, 91], 80: [2, 91], 81: [2, 91], 82: [2, 91], 83: [2, 91], 84: [2, 91], 85: [2, 91] }, { 33: [2, 93] }, { 5: [2, 22], 14: [2, 22], 15: [2, 22], 19: [2, 22], 29: [2, 22], 34: [2, 22], 39: [2, 22], 44: [2, 22], 47: [2, 22], 48: [2, 22], 51: [2, 22], 55: [2, 22], 60: [2, 22] }, { 23: [2, 99], 33: [2, 99], 54: [2, 99], 68: [2, 99], 72: [2, 99], 75: [2, 99] }, { 73: [1, 109] }, { 20: 75, 63: 126, 64: 76, 65: [1, 44], 72: [1, 35], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 5: [2, 23], 14: [2, 23], 15: [2, 23], 19: [2, 23], 29: [2, 23], 34: [2, 23], 39: [2, 23], 44: [2, 23], 47: [2, 23], 48: [2, 23], 51: [2, 23], 55: [2, 23], 60: [2, 23] }, { 47: [2, 19] }, { 47: [2, 77] }, { 20: 75, 33: [2, 72], 41: 127, 63: 128, 64: 76, 65: [1, 44], 69: 129, 70: 77, 71: 78, 72: [1, 79], 75: [2, 72], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 5: [2, 24], 14: [2, 24], 15: [2, 24], 19: [2, 24], 29: [2, 24], 34: [2, 24], 39: [2, 24], 44: [2, 24], 47: [2, 24], 48: [2, 24], 51: [2, 24], 55: [2, 24], 60: [2, 24] }, { 68: [1, 130] }, { 65: [2, 95], 68: [2, 95], 72: [2, 95], 80: [2, 95], 81: [2, 95], 82: [2, 95], 83: [2, 95], 84: [2, 95], 85: [2, 95] }, { 68: [2, 97] }, { 5: [2, 21], 14: [2, 21], 15: [2, 21], 19: [2, 21], 29: [2, 21], 34: [2, 21], 39: [2, 21], 44: [2, 21], 47: [2, 21], 48: [2, 21], 51: [2, 21], 55: [2, 21], 60: [2, 21] }, { 33: [1, 131] }, { 33: [2, 63] }, { 72: [1, 133], 76: 132 }, { 33: [1, 134] }, { 33: [2, 69] }, { 15: [2, 12] }, { 14: [2, 26], 15: [2, 26], 19: [2, 26], 29: [2, 26], 34: [2, 26], 47: [2, 26], 48: [2, 26], 51: [2, 26], 55: [2, 26], 60: [2, 26] }, { 23: [2, 31], 33: [2, 31], 54: [2, 31], 68: [2, 31], 72: [2, 31], 75: [2, 31] }, { 33: [2, 74], 42: 135, 74: 136, 75: [1, 121] }, { 33: [2, 71], 65: [2, 71], 72: [2, 71], 75: [2, 71], 80: [2, 71], 81: [2, 71], 82: [2, 71], 83: [2, 71], 84: [2, 71], 85: [2, 71] }, { 33: [2, 73], 75: [2, 73] }, { 23: [2, 29], 33: [2, 29], 54: [2, 29], 65: [2, 29], 68: [2, 29], 72: [2, 29], 75: [2, 29], 80: [2, 29], 81: [2, 29], 82: [2, 29], 83: [2, 29], 84: [2, 29], 85: [2, 29] }, { 14: [2, 15], 15: [2, 15], 19: [2, 15], 29: [2, 15], 34: [2, 15], 39: [2, 15], 44: [2, 15], 47: [2, 15], 48: [2, 15], 51: [2, 15], 55: [2, 15], 60: [2, 15] }, { 72: [1, 138], 77: [1, 137] }, { 72: [2, 100], 77: [2, 100] }, { 14: [2, 16], 15: [2, 16], 19: [2, 16], 29: [2, 16], 34: [2, 16], 44: [2, 16], 47: [2, 16], 48: [2, 16], 51: [2, 16], 55: [2, 16], 60: [2, 16] }, { 33: [1, 139] }, { 33: [2, 75] }, { 33: [2, 32] }, { 72: [2, 101], 77: [2, 101] }, { 14: [2, 17], 15: [2, 17], 19: [2, 17], 29: [2, 17], 34: [2, 17], 39: [2, 17], 44: [2, 17], 47: [2, 17], 48: [2, 17], 51: [2, 17], 55: [2, 17], 60: [2, 17] }], + defaultActions: { 4: [2, 1], 55: [2, 55], 57: [2, 20], 61: [2, 57], 74: [2, 81], 83: [2, 85], 87: [2, 18], 91: [2, 89], 102: [2, 53], 105: [2, 93], 111: [2, 19], 112: [2, 77], 117: [2, 97], 120: [2, 63], 123: [2, 69], 124: [2, 12], 136: [2, 75], 137: [2, 32] }, + parseError: function parseError(str, hash) { + throw new Error(str); + }, + parse: function parse(input) { + var self = this, + stack = [0], + vstack = [null], + lstack = [], + table = this.table, + yytext = "", + yylineno = 0, + yyleng = 0, + recovering = 0, + TERROR = 2, + EOF = 1; + this.lexer.setInput(input); + this.lexer.yy = this.yy; + this.yy.lexer = this.lexer; + this.yy.parser = this; + if (typeof this.lexer.yylloc == "undefined") this.lexer.yylloc = {}; + var yyloc = this.lexer.yylloc; + lstack.push(yyloc); + var ranges = this.lexer.options && this.lexer.options.ranges; + if (typeof this.yy.parseError === "function") this.parseError = this.yy.parseError; + function popStack(n) { + stack.length = stack.length - 2 * n; + vstack.length = vstack.length - n; + lstack.length = lstack.length - n; + } + function lex() { + var token; + token = self.lexer.lex() || 1; + if (typeof token !== "number") { + token = self.symbols_[token] || token; + } + return token; + } + var symbol, + preErrorSymbol, + state, + action, + a, + r, + yyval = {}, + p, + len, + newState, + expected; + while (true) { + state = stack[stack.length - 1]; + if (this.defaultActions[state]) { + action = this.defaultActions[state]; + } else { + if (symbol === null || typeof symbol == "undefined") { + symbol = lex(); + } + action = table[state] && table[state][symbol]; + } + if (typeof action === "undefined" || !action.length || !action[0]) { + var errStr = ""; + if (!recovering) { + expected = []; + for (p in table[state]) if (this.terminals_[p] && p > 2) { + expected.push("'" + this.terminals_[p] + "'"); + } + if (this.lexer.showPosition) { + errStr = "Parse error on line " + (yylineno + 1) + ":\n" + this.lexer.showPosition() + "\nExpecting " + expected.join(", ") + ", got '" + (this.terminals_[symbol] || symbol) + "'"; + } else { + errStr = "Parse error on line " + (yylineno + 1) + ": Unexpected " + (symbol == 1 ? "end of input" : "'" + (this.terminals_[symbol] || symbol) + "'"); + } + this.parseError(errStr, { text: this.lexer.match, token: this.terminals_[symbol] || symbol, line: this.lexer.yylineno, loc: yyloc, expected: expected }); + } + } + if (action[0] instanceof Array && action.length > 1) { + throw new Error("Parse Error: multiple actions possible at state: " + state + ", token: " + symbol); + } + switch (action[0]) { + case 1: + stack.push(symbol); + vstack.push(this.lexer.yytext); + lstack.push(this.lexer.yylloc); + stack.push(action[1]); + symbol = null; + if (!preErrorSymbol) { + yyleng = this.lexer.yyleng; + yytext = this.lexer.yytext; + yylineno = this.lexer.yylineno; + yyloc = this.lexer.yylloc; + if (recovering > 0) recovering--; + } else { + symbol = preErrorSymbol; + preErrorSymbol = null; + } + break; + case 2: + len = this.productions_[action[1]][1]; + yyval.$ = vstack[vstack.length - len]; + 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 }; + if (ranges) { + yyval._$.range = [lstack[lstack.length - (len || 1)].range[0], lstack[lstack.length - 1].range[1]]; + } + r = this.performAction.call(yyval, yytext, yyleng, yylineno, this.yy, action[1], vstack, lstack); + if (typeof r !== "undefined") { + return r; + } + if (len) { + stack = stack.slice(0, -1 * len * 2); + vstack = vstack.slice(0, -1 * len); + lstack = lstack.slice(0, -1 * len); + } + stack.push(this.productions_[action[1]][0]); + vstack.push(yyval.$); + lstack.push(yyval._$); + newState = table[stack[stack.length - 2]][stack[stack.length - 1]]; + stack.push(newState); + break; + case 3: + return true; + } + } + return true; + } + }; + /* Jison generated lexer */ + var lexer = (function () { + var lexer = { EOF: 1, + parseError: function parseError(str, hash) { + if (this.yy.parser) { + this.yy.parser.parseError(str, hash); + } else { + throw new Error(str); + } + }, + setInput: function setInput(input) { + this._input = input; + this._more = this._less = this.done = false; + this.yylineno = this.yyleng = 0; + this.yytext = this.matched = this.match = ''; + this.conditionStack = ['INITIAL']; + this.yylloc = { first_line: 1, first_column: 0, last_line: 1, last_column: 0 }; + if (this.options.ranges) this.yylloc.range = [0, 0]; + this.offset = 0; + return this; + }, + input: function input() { + var ch = this._input[0]; + this.yytext += ch; + this.yyleng++; + this.offset++; + this.match += ch; + this.matched += ch; + var lines = ch.match(/(?:\r\n?|\n).*/g); + if (lines) { + this.yylineno++; + this.yylloc.last_line++; + } else { + this.yylloc.last_column++; + } + if (this.options.ranges) this.yylloc.range[1]++; + + this._input = this._input.slice(1); + return ch; + }, + unput: function unput(ch) { + var len = ch.length; + var lines = ch.split(/(?:\r\n?|\n)/g); + + this._input = ch + this._input; + this.yytext = this.yytext.substr(0, this.yytext.length - len - 1); + //this.yyleng -= len; + this.offset -= len; + var oldLines = this.match.split(/(?:\r\n?|\n)/g); + this.match = this.match.substr(0, this.match.length - 1); + this.matched = this.matched.substr(0, this.matched.length - 1); + + if (lines.length - 1) this.yylineno -= lines.length - 1; + var r = this.yylloc.range; + + this.yylloc = { first_line: this.yylloc.first_line, + last_line: this.yylineno + 1, + first_column: this.yylloc.first_column, + last_column: lines ? (lines.length === oldLines.length ? this.yylloc.first_column : 0) + oldLines[oldLines.length - lines.length].length - lines[0].length : this.yylloc.first_column - len + }; + + if (this.options.ranges) { + this.yylloc.range = [r[0], r[0] + this.yyleng - len]; + } + return this; + }, + more: function more() { + this._more = true; + return this; + }, + less: function less(n) { + this.unput(this.match.slice(n)); + }, + pastInput: function pastInput() { + var past = this.matched.substr(0, this.matched.length - this.match.length); + return (past.length > 20 ? '...' : '') + past.substr(-20).replace(/\n/g, ""); + }, + upcomingInput: function upcomingInput() { + var next = this.match; + if (next.length < 20) { + next += this._input.substr(0, 20 - next.length); + } + return (next.substr(0, 20) + (next.length > 20 ? '...' : '')).replace(/\n/g, ""); + }, + showPosition: function showPosition() { + var pre = this.pastInput(); + var c = new Array(pre.length + 1).join("-"); + return pre + this.upcomingInput() + "\n" + c + "^"; + }, + next: function next() { + if (this.done) { + return this.EOF; + } + if (!this._input) this.done = true; + + var token, match, tempMatch, index, col, lines; + if (!this._more) { + this.yytext = ''; + this.match = ''; + } + var rules = this._currentRules(); + for (var i = 0; i < rules.length; i++) { + tempMatch = this._input.match(this.rules[rules[i]]); + if (tempMatch && (!match || tempMatch[0].length > match[0].length)) { + match = tempMatch; + index = i; + if (!this.options.flex) break; + } + } + if (match) { + lines = match[0].match(/(?:\r\n?|\n).*/g); + if (lines) this.yylineno += lines.length; + this.yylloc = { first_line: this.yylloc.last_line, + last_line: this.yylineno + 1, + first_column: this.yylloc.last_column, + last_column: lines ? lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + match[0].length }; + this.yytext += match[0]; + this.match += match[0]; + this.matches = match; + this.yyleng = this.yytext.length; + if (this.options.ranges) { + this.yylloc.range = [this.offset, this.offset += this.yyleng]; + } + this._more = false; + this._input = this._input.slice(match[0].length); + this.matched += match[0]; + token = this.performAction.call(this, this.yy, this, rules[index], this.conditionStack[this.conditionStack.length - 1]); + if (this.done && this._input) this.done = false; + if (token) return token;else return; + } + if (this._input === "") { + return this.EOF; + } else { + return this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. Unrecognized text.\n' + this.showPosition(), { text: "", token: null, line: this.yylineno }); + } + }, + lex: function lex() { + var r = this.next(); + if (typeof r !== 'undefined') { + return r; + } else { + return this.lex(); + } + }, + begin: function begin(condition) { + this.conditionStack.push(condition); + }, + popState: function popState() { + return this.conditionStack.pop(); + }, + _currentRules: function _currentRules() { + return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules; + }, + topState: function topState() { + return this.conditionStack[this.conditionStack.length - 2]; + }, + pushState: function begin(condition) { + this.begin(condition); + } }; + lexer.options = {}; + lexer.performAction = function anonymous(yy, yy_, $avoiding_name_collisions, YY_START) { + + function strip(start, end) { + return yy_.yytext = yy_.yytext.substr(start, yy_.yyleng - end); + } + + var YYSTATE = YY_START; + switch ($avoiding_name_collisions) { + case 0: + if (yy_.yytext.slice(-2) === "\\\\") { + strip(0, 1); + this.begin("mu"); + } else if (yy_.yytext.slice(-1) === "\\") { + strip(0, 1); + this.begin("emu"); + } else { + this.begin("mu"); + } + if (yy_.yytext) return 15; + + break; + case 1: + return 15; + break; + case 2: + this.popState(); + return 15; + + break; + case 3: + this.begin('raw');return 15; + break; + case 4: + this.popState(); + // Should be using `this.topState()` below, but it currently + // returns the second top instead of the first top. Opened an + // issue about it at https://github.com/zaach/jison/issues/291 + if (this.conditionStack[this.conditionStack.length - 1] === 'raw') { + return 15; + } else { + yy_.yytext = yy_.yytext.substr(5, yy_.yyleng - 9); + return 'END_RAW_BLOCK'; + } + + break; + case 5: + return 15; + break; + case 6: + this.popState(); + return 14; + + break; + case 7: + return 65; + break; + case 8: + return 68; + break; + case 9: + return 19; + break; + case 10: + this.popState(); + this.begin('raw'); + return 23; + + break; + case 11: + return 55; + break; + case 12: + return 60; + break; + case 13: + return 29; + break; + case 14: + return 47; + break; + case 15: + this.popState();return 44; + break; + case 16: + this.popState();return 44; + break; + case 17: + return 34; + break; + case 18: + return 39; + break; + case 19: + return 51; + break; + case 20: + return 48; + break; + case 21: + this.unput(yy_.yytext); + this.popState(); + this.begin('com'); + + break; + case 22: + this.popState(); + return 14; + + break; + case 23: + return 48; + break; + case 24: + return 73; + break; + case 25: + return 72; + break; + case 26: + return 72; + break; + case 27: + return 87; + break; + case 28: + // ignore whitespace + break; + case 29: + this.popState();return 54; + break; + case 30: + this.popState();return 33; + break; + case 31: + yy_.yytext = strip(1, 2).replace(/\\"/g, '"');return 80; + break; + case 32: + yy_.yytext = strip(1, 2).replace(/\\'/g, "'");return 80; + break; + case 33: + return 85; + break; + case 34: + return 82; + break; + case 35: + return 82; + break; + case 36: + return 83; + break; + case 37: + return 84; + break; + case 38: + return 81; + break; + case 39: + return 75; + break; + case 40: + return 77; + break; + case 41: + return 72; + break; + case 42: + return 72; + break; + case 43: + return 'INVALID'; + break; + case 44: + return 5; + break; + } + }; + lexer.rules = [/^(?:[^\x00]*?(?=(\{\{)))/, /^(?:[^\x00]+)/, /^(?:[^\x00]{2,}?(?=(\{\{|\\\{\{|\\\\\{\{|$)))/, /^(?:\{\{\{\{(?=[^/]))/, /^(?:\{\{\{\{\/[^\s!"#%-,\.\/;->@\[-\^`\{-~]+(?=[=}\s\/.])\}\}\}\})/, /^(?:[^\x00]*?(?=(\{\{\{\{)))/, /^(?:[\s\S]*?--(~)?\}\})/, /^(?:\()/, /^(?:\))/, /^(?:\{\{\{\{)/, /^(?:\}\}\}\})/, /^(?:\{\{(~)?>)/, /^(?:\{\{(~)?#>)/, /^(?:\{\{(~)?#\*?)/, /^(?:\{\{(~)?\/)/, /^(?:\{\{(~)?\^\s*(~)?\}\})/, /^(?:\{\{(~)?\s*else\s*(~)?\}\})/, /^(?:\{\{(~)?\^)/, /^(?:\{\{(~)?\s*else\b)/, /^(?:\{\{(~)?\{)/, /^(?:\{\{(~)?&)/, /^(?:\{\{(~)?!--)/, /^(?:\{\{(~)?![\s\S]*?\}\})/, /^(?:\{\{(~)?\*?)/, /^(?:=)/, /^(?:\.\.)/, /^(?:\.(?=([=~}\s\/.)|])))/, /^(?:[\/.])/, /^(?:\s+)/, /^(?:\}(~)?\}\})/, /^(?:(~)?\}\})/, /^(?:"(\\["]|[^"])*")/, /^(?:'(\\[']|[^'])*')/, /^(?:@)/, /^(?:true(?=([~}\s)])))/, /^(?:false(?=([~}\s)])))/, /^(?:undefined(?=([~}\s)])))/, /^(?:null(?=([~}\s)])))/, /^(?:-?[0-9]+(?:\.[0-9]+)?(?=([~}\s)])))/, /^(?:as\s+\|)/, /^(?:\|)/, /^(?:([^\s!"#%-,\.\/;->@\[-\^`\{-~]+(?=([=~}\s\/.)|]))))/, /^(?:\[[^\]]*\])/, /^(?:.)/, /^(?:$)/]; + lexer.conditions = { "mu": { "rules": [7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44], "inclusive": false }, "emu": { "rules": [2], "inclusive": false }, "com": { "rules": [6], "inclusive": false }, "raw": { "rules": [3, 4, 5], "inclusive": false }, "INITIAL": { "rules": [0, 1, 44], "inclusive": true } }; + return lexer; + })(); + parser.lexer = lexer; + function Parser() { + this.yy = {}; + }Parser.prototype = parser;parser.Parser = Parser; + return new Parser(); + })();exports.__esModule = true; + exports['default'] = handlebars; + +/***/ }, +/* 24 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + var _interopRequireDefault = __webpack_require__(1)['default']; + + exports.__esModule = true; + + var _visitor = __webpack_require__(25); + + var _visitor2 = _interopRequireDefault(_visitor); + + function WhitespaceControl() { + var options = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0]; + + this.options = options; + } + WhitespaceControl.prototype = new _visitor2['default'](); + + WhitespaceControl.prototype.Program = function (program) { + var doStandalone = !this.options.ignoreStandalone; + + var isRoot = !this.isRootSeen; + this.isRootSeen = true; + + var body = program.body; + for (var i = 0, l = body.length; i < l; i++) { + var current = body[i], + strip = this.accept(current); + + if (!strip) { + continue; + } + + var _isPrevWhitespace = isPrevWhitespace(body, i, isRoot), + _isNextWhitespace = isNextWhitespace(body, i, isRoot), + openStandalone = strip.openStandalone && _isPrevWhitespace, + closeStandalone = strip.closeStandalone && _isNextWhitespace, + inlineStandalone = strip.inlineStandalone && _isPrevWhitespace && _isNextWhitespace; + + if (strip.close) { + omitRight(body, i, true); + } + if (strip.open) { + omitLeft(body, i, true); + } + + if (doStandalone && inlineStandalone) { + omitRight(body, i); + + if (omitLeft(body, i)) { + // If we are on a standalone node, save the indent info for partials + if (current.type === 'PartialStatement') { + // Pull out the whitespace from the final line + current.indent = /([ \t]+$)/.exec(body[i - 1].original)[1]; + } + } + } + if (doStandalone && openStandalone) { + omitRight((current.program || current.inverse).body); + + // Strip out the previous content node if it's whitespace only + omitLeft(body, i); + } + if (doStandalone && closeStandalone) { + // Always strip the next node + omitRight(body, i); + + omitLeft((current.inverse || current.program).body); + } + } + + return program; + }; + + WhitespaceControl.prototype.BlockStatement = WhitespaceControl.prototype.DecoratorBlock = WhitespaceControl.prototype.PartialBlockStatement = function (block) { + this.accept(block.program); + this.accept(block.inverse); + + // Find the inverse program that is involed with whitespace stripping. + var program = block.program || block.inverse, + inverse = block.program && block.inverse, + firstInverse = inverse, + lastInverse = inverse; + + if (inverse && inverse.chained) { + firstInverse = inverse.body[0].program; + + // Walk the inverse chain to find the last inverse that is actually in the chain. + while (lastInverse.chained) { + lastInverse = lastInverse.body[lastInverse.body.length - 1].program; + } + } + + var strip = { + open: block.openStrip.open, + close: block.closeStrip.close, + + // Determine the standalone candiacy. Basically flag our content as being possibly standalone + // so our parent can determine if we actually are standalone + openStandalone: isNextWhitespace(program.body), + closeStandalone: isPrevWhitespace((firstInverse || program).body) + }; + + if (block.openStrip.close) { + omitRight(program.body, null, true); + } + + if (inverse) { + var inverseStrip = block.inverseStrip; + + if (inverseStrip.open) { + omitLeft(program.body, null, true); + } + + if (inverseStrip.close) { + omitRight(firstInverse.body, null, true); + } + if (block.closeStrip.open) { + omitLeft(lastInverse.body, null, true); + } + + // Find standalone else statments + if (!this.options.ignoreStandalone && isPrevWhitespace(program.body) && isNextWhitespace(firstInverse.body)) { + omitLeft(program.body); + omitRight(firstInverse.body); + } + } else if (block.closeStrip.open) { + omitLeft(program.body, null, true); + } + + return strip; + }; + + WhitespaceControl.prototype.Decorator = WhitespaceControl.prototype.MustacheStatement = function (mustache) { + return mustache.strip; + }; + + WhitespaceControl.prototype.PartialStatement = WhitespaceControl.prototype.CommentStatement = function (node) { + /* istanbul ignore next */ + var strip = node.strip || {}; + return { + inlineStandalone: true, + open: strip.open, + close: strip.close + }; + }; + + function isPrevWhitespace(body, i, isRoot) { + if (i === undefined) { + i = body.length; + } + + // Nodes that end with newlines are considered whitespace (but are special + // cased for strip operations) + var prev = body[i - 1], + sibling = body[i - 2]; + if (!prev) { + return isRoot; + } + + if (prev.type === 'ContentStatement') { + return (sibling || !isRoot ? /\r?\n\s*?$/ : /(^|\r?\n)\s*?$/).test(prev.original); + } + } + function isNextWhitespace(body, i, isRoot) { + if (i === undefined) { + i = -1; + } + + var next = body[i + 1], + sibling = body[i + 2]; + if (!next) { + return isRoot; + } + + if (next.type === 'ContentStatement') { + return (sibling || !isRoot ? /^\s*?\r?\n/ : /^\s*?(\r?\n|$)/).test(next.original); + } + } + + // Marks the node to the right of the position as omitted. + // I.e. {{foo}}' ' will mark the ' ' node as omitted. + // + // If i is undefined, then the first child will be marked as such. + // + // If mulitple is truthy then all whitespace will be stripped out until non-whitespace + // content is met. + function omitRight(body, i, multiple) { + var current = body[i == null ? 0 : i + 1]; + if (!current || current.type !== 'ContentStatement' || !multiple && current.rightStripped) { + return; + } + + var original = current.value; + current.value = current.value.replace(multiple ? /^\s+/ : /^[ \t]*\r?\n?/, ''); + current.rightStripped = current.value !== original; + } + + // Marks the node to the left of the position as omitted. + // I.e. ' '{{foo}} will mark the ' ' node as omitted. + // + // If i is undefined then the last child will be marked as such. + // + // If mulitple is truthy then all whitespace will be stripped out until non-whitespace + // content is met. + function omitLeft(body, i, multiple) { + var current = body[i == null ? body.length - 1 : i - 1]; + if (!current || current.type !== 'ContentStatement' || !multiple && current.leftStripped) { + return; + } + + // We omit the last node if it's whitespace only and not preceeded by a non-content node. + var original = current.value; + current.value = current.value.replace(multiple ? /\s+$/ : /[ \t]+$/, ''); + current.leftStripped = current.value !== original; + return current.leftStripped; + } + + exports['default'] = WhitespaceControl; + module.exports = exports['default']; + +/***/ }, +/* 25 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + var _interopRequireDefault = __webpack_require__(1)['default']; + + exports.__esModule = true; + + var _exception = __webpack_require__(6); + + var _exception2 = _interopRequireDefault(_exception); + + function Visitor() { + this.parents = []; + } + + Visitor.prototype = { + constructor: Visitor, + mutating: false, + + // Visits a given value. If mutating, will replace the value if necessary. + acceptKey: function acceptKey(node, name) { + var value = this.accept(node[name]); + if (this.mutating) { + // Hacky sanity check: This may have a few false positives for type for the helper + // methods but will generally do the right thing without a lot of overhead. + if (value && !Visitor.prototype[value.type]) { + throw new _exception2['default']('Unexpected node type "' + value.type + '" found when accepting ' + name + ' on ' + node.type); + } + node[name] = value; + } + }, + + // Performs an accept operation with added sanity check to ensure + // required keys are not removed. + acceptRequired: function acceptRequired(node, name) { + this.acceptKey(node, name); + + if (!node[name]) { + throw new _exception2['default'](node.type + ' requires ' + name); + } + }, + + // Traverses a given array. If mutating, empty respnses will be removed + // for child elements. + acceptArray: function acceptArray(array) { + for (var i = 0, l = array.length; i < l; i++) { + this.acceptKey(array, i); + + if (!array[i]) { + array.splice(i, 1); + i--; + l--; + } + } + }, + + accept: function accept(object) { + if (!object) { + return; + } + + /* istanbul ignore next: Sanity code */ + if (!this[object.type]) { + throw new _exception2['default']('Unknown type: ' + object.type, object); + } + + if (this.current) { + this.parents.unshift(this.current); + } + this.current = object; + + var ret = this[object.type](object); + + this.current = this.parents.shift(); + + if (!this.mutating || ret) { + return ret; + } else if (ret !== false) { + return object; + } + }, + + Program: function Program(program) { + this.acceptArray(program.body); + }, + + MustacheStatement: visitSubExpression, + Decorator: visitSubExpression, + + BlockStatement: visitBlock, + DecoratorBlock: visitBlock, + + PartialStatement: visitPartial, + PartialBlockStatement: function PartialBlockStatement(partial) { + visitPartial.call(this, partial); + + this.acceptKey(partial, 'program'); + }, + + ContentStatement: function ContentStatement() /* content */{}, + CommentStatement: function CommentStatement() /* comment */{}, + + SubExpression: visitSubExpression, + + PathExpression: function PathExpression() /* path */{}, + + StringLiteral: function StringLiteral() /* string */{}, + NumberLiteral: function NumberLiteral() /* number */{}, + BooleanLiteral: function BooleanLiteral() /* bool */{}, + UndefinedLiteral: function UndefinedLiteral() /* literal */{}, + NullLiteral: function NullLiteral() /* literal */{}, + + Hash: function Hash(hash) { + this.acceptArray(hash.pairs); + }, + HashPair: function HashPair(pair) { + this.acceptRequired(pair, 'value'); + } + }; + + function visitSubExpression(mustache) { + this.acceptRequired(mustache, 'path'); + this.acceptArray(mustache.params); + this.acceptKey(mustache, 'hash'); + } + function visitBlock(block) { + visitSubExpression.call(this, block); + + this.acceptKey(block, 'program'); + this.acceptKey(block, 'inverse'); + } + function visitPartial(partial) { + this.acceptRequired(partial, 'name'); + this.acceptArray(partial.params); + this.acceptKey(partial, 'hash'); + } + + exports['default'] = Visitor; + module.exports = exports['default']; + +/***/ }, +/* 26 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + var _interopRequireDefault = __webpack_require__(1)['default']; + + exports.__esModule = true; + exports.SourceLocation = SourceLocation; + exports.id = id; + exports.stripFlags = stripFlags; + exports.stripComment = stripComment; + exports.preparePath = preparePath; + exports.prepareMustache = prepareMustache; + exports.prepareRawBlock = prepareRawBlock; + exports.prepareBlock = prepareBlock; + exports.prepareProgram = prepareProgram; + exports.preparePartialBlock = preparePartialBlock; + + var _exception = __webpack_require__(6); + + var _exception2 = _interopRequireDefault(_exception); + + function validateClose(open, close) { + close = close.path ? close.path.original : close; + + if (open.path.original !== close) { + var errorNode = { loc: open.path.loc }; + + throw new _exception2['default'](open.path.original + " doesn't match " + close, errorNode); + } + } + + function SourceLocation(source, locInfo) { + this.source = source; + this.start = { + line: locInfo.first_line, + column: locInfo.first_column + }; + this.end = { + line: locInfo.last_line, + column: locInfo.last_column + }; + } + + function id(token) { + if (/^\[.*\]$/.test(token)) { + return token.substr(1, token.length - 2); + } else { + return token; + } + } + + function stripFlags(open, close) { + return { + open: open.charAt(2) === '~', + close: close.charAt(close.length - 3) === '~' + }; + } + + function stripComment(comment) { + return comment.replace(/^\{\{~?\!-?-?/, '').replace(/-?-?~?\}\}$/, ''); + } + + function preparePath(data, parts, loc) { + loc = this.locInfo(loc); + + var original = data ? '@' : '', + dig = [], + depth = 0, + depthString = ''; + + for (var i = 0, l = parts.length; i < l; i++) { + var part = parts[i].part, + + // If we have [] syntax then we do not treat path references as operators, + // i.e. foo.[this] resolves to approximately context.foo['this'] + isLiteral = parts[i].original !== part; + original += (parts[i].separator || '') + part; + + if (!isLiteral && (part === '..' || part === '.' || part === 'this')) { + if (dig.length > 0) { + throw new _exception2['default']('Invalid path: ' + original, { loc: loc }); + } else if (part === '..') { + depth++; + depthString += '../'; + } + } else { + dig.push(part); + } + } + + return { + type: 'PathExpression', + data: data, + depth: depth, + parts: dig, + original: original, + loc: loc + }; + } + + function prepareMustache(path, params, hash, open, strip, locInfo) { + // Must use charAt to support IE pre-10 + var escapeFlag = open.charAt(3) || open.charAt(2), + escaped = escapeFlag !== '{' && escapeFlag !== '&'; + + var decorator = /\*/.test(open); + return { + type: decorator ? 'Decorator' : 'MustacheStatement', + path: path, + params: params, + hash: hash, + escaped: escaped, + strip: strip, + loc: this.locInfo(locInfo) + }; + } + + function prepareRawBlock(openRawBlock, contents, close, locInfo) { + validateClose(openRawBlock, close); + + locInfo = this.locInfo(locInfo); + var program = { + type: 'Program', + body: contents, + strip: {}, + loc: locInfo + }; + + return { + type: 'BlockStatement', + path: openRawBlock.path, + params: openRawBlock.params, + hash: openRawBlock.hash, + program: program, + openStrip: {}, + inverseStrip: {}, + closeStrip: {}, + loc: locInfo + }; + } + + function prepareBlock(openBlock, program, inverseAndProgram, close, inverted, locInfo) { + if (close && close.path) { + validateClose(openBlock, close); + } + + var decorator = /\*/.test(openBlock.open); + + program.blockParams = openBlock.blockParams; + + var inverse = undefined, + inverseStrip = undefined; + + if (inverseAndProgram) { + if (decorator) { + throw new _exception2['default']('Unexpected inverse block on decorator', inverseAndProgram); + } + + if (inverseAndProgram.chain) { + inverseAndProgram.program.body[0].closeStrip = close.strip; + } + + inverseStrip = inverseAndProgram.strip; + inverse = inverseAndProgram.program; + } + + if (inverted) { + inverted = inverse; + inverse = program; + program = inverted; + } + + return { + type: decorator ? 'DecoratorBlock' : 'BlockStatement', + path: openBlock.path, + params: openBlock.params, + hash: openBlock.hash, + program: program, + inverse: inverse, + openStrip: openBlock.strip, + inverseStrip: inverseStrip, + closeStrip: close && close.strip, + loc: this.locInfo(locInfo) + }; + } + + function prepareProgram(statements, loc) { + if (!loc && statements.length) { + var firstLoc = statements[0].loc, + lastLoc = statements[statements.length - 1].loc; + + /* istanbul ignore else */ + if (firstLoc && lastLoc) { + loc = { + source: firstLoc.source, + start: { + line: firstLoc.start.line, + column: firstLoc.start.column + }, + end: { + line: lastLoc.end.line, + column: lastLoc.end.column + } + }; + } + } + + return { + type: 'Program', + body: statements, + strip: {}, + loc: loc + }; + } + + function preparePartialBlock(open, program, close, locInfo) { + validateClose(open, close); + + return { + type: 'PartialBlockStatement', + name: open.path, + params: open.params, + hash: open.hash, + program: program, + openStrip: open.strip, + closeStrip: close && close.strip, + loc: this.locInfo(locInfo) + }; + } + +/***/ }, +/* 27 */ +/***/ function(module, exports, __webpack_require__) { + + /* eslint-disable new-cap */ + + 'use strict'; + + var _interopRequireDefault = __webpack_require__(1)['default']; + + exports.__esModule = true; + exports.Compiler = Compiler; + exports.precompile = precompile; + exports.compile = compile; + + var _exception = __webpack_require__(6); + + var _exception2 = _interopRequireDefault(_exception); + + var _utils = __webpack_require__(5); + + var _ast = __webpack_require__(21); + + var _ast2 = _interopRequireDefault(_ast); + + var slice = [].slice; + + function Compiler() {} + + // the foundHelper register will disambiguate helper lookup from finding a + // function in a context. This is necessary for mustache compatibility, which + // requires that context functions in blocks are evaluated by blockHelperMissing, + // and then proceed as if the resulting value was provided to blockHelperMissing. + + Compiler.prototype = { + compiler: Compiler, + + equals: function equals(other) { + var len = this.opcodes.length; + if (other.opcodes.length !== len) { + return false; + } + + for (var i = 0; i < len; i++) { + var opcode = this.opcodes[i], + otherOpcode = other.opcodes[i]; + if (opcode.opcode !== otherOpcode.opcode || !argEquals(opcode.args, otherOpcode.args)) { + return false; + } + } + + // We know that length is the same between the two arrays because they are directly tied + // to the opcode behavior above. + len = this.children.length; + for (var i = 0; i < len; i++) { + if (!this.children[i].equals(other.children[i])) { + return false; + } + } + + return true; + }, + + guid: 0, + + compile: function compile(program, options) { + this.sourceNode = []; + this.opcodes = []; + this.children = []; + this.options = options; + this.stringParams = options.stringParams; + this.trackIds = options.trackIds; + + options.blockParams = options.blockParams || []; + + // These changes will propagate to the other compiler components + var knownHelpers = options.knownHelpers; + options.knownHelpers = { + 'helperMissing': true, + 'blockHelperMissing': true, + 'each': true, + 'if': true, + 'unless': true, + 'with': true, + 'log': true, + 'lookup': true + }; + if (knownHelpers) { + for (var _name in knownHelpers) { + /* istanbul ignore else */ + if (_name in knownHelpers) { + options.knownHelpers[_name] = knownHelpers[_name]; + } + } + } + + return this.accept(program); + }, + + compileProgram: function compileProgram(program) { + var childCompiler = new this.compiler(), + // eslint-disable-line new-cap + result = childCompiler.compile(program, this.options), + guid = this.guid++; + + this.usePartial = this.usePartial || result.usePartial; + + this.children[guid] = result; + this.useDepths = this.useDepths || result.useDepths; + + return guid; + }, + + accept: function accept(node) { + /* istanbul ignore next: Sanity code */ + if (!this[node.type]) { + throw new _exception2['default']('Unknown type: ' + node.type, node); + } + + this.sourceNode.unshift(node); + var ret = this[node.type](node); + this.sourceNode.shift(); + return ret; + }, + + Program: function Program(program) { + this.options.blockParams.unshift(program.blockParams); + + var body = program.body, + bodyLength = body.length; + for (var i = 0; i < bodyLength; i++) { + this.accept(body[i]); + } + + this.options.blockParams.shift(); + + this.isSimple = bodyLength === 1; + this.blockParams = program.blockParams ? program.blockParams.length : 0; + + return this; + }, + + BlockStatement: function BlockStatement(block) { + transformLiteralToPath(block); + + var program = block.program, + inverse = block.inverse; + + program = program && this.compileProgram(program); + inverse = inverse && this.compileProgram(inverse); + + var type = this.classifySexpr(block); + + if (type === 'helper') { + this.helperSexpr(block, program, inverse); + } else if (type === 'simple') { + this.simpleSexpr(block); + + // now that the simple mustache is resolved, we need to + // evaluate it by executing `blockHelperMissing` + this.opcode('pushProgram', program); + this.opcode('pushProgram', inverse); + this.opcode('emptyHash'); + this.opcode('blockValue', block.path.original); + } else { + this.ambiguousSexpr(block, program, inverse); + + // now that the simple mustache is resolved, we need to + // evaluate it by executing `blockHelperMissing` + this.opcode('pushProgram', program); + this.opcode('pushProgram', inverse); + this.opcode('emptyHash'); + this.opcode('ambiguousBlockValue'); + } + + this.opcode('append'); + }, + + DecoratorBlock: function DecoratorBlock(decorator) { + var program = decorator.program && this.compileProgram(decorator.program); + var params = this.setupFullMustacheParams(decorator, program, undefined), + path = decorator.path; + + this.useDecorators = true; + this.opcode('registerDecorator', params.length, path.original); + }, + + PartialStatement: function PartialStatement(partial) { + this.usePartial = true; + + var program = partial.program; + if (program) { + program = this.compileProgram(partial.program); + } + + var params = partial.params; + if (params.length > 1) { + throw new _exception2['default']('Unsupported number of partial arguments: ' + params.length, partial); + } else if (!params.length) { + if (this.options.explicitPartialContext) { + this.opcode('pushLiteral', 'undefined'); + } else { + params.push({ type: 'PathExpression', parts: [], depth: 0 }); + } + } + + var partialName = partial.name.original, + isDynamic = partial.name.type === 'SubExpression'; + if (isDynamic) { + this.accept(partial.name); + } + + this.setupFullMustacheParams(partial, program, undefined, true); + + var indent = partial.indent || ''; + if (this.options.preventIndent && indent) { + this.opcode('appendContent', indent); + indent = ''; + } + + this.opcode('invokePartial', isDynamic, partialName, indent); + this.opcode('append'); + }, + PartialBlockStatement: function PartialBlockStatement(partialBlock) { + this.PartialStatement(partialBlock); + }, + + MustacheStatement: function MustacheStatement(mustache) { + this.SubExpression(mustache); + + if (mustache.escaped && !this.options.noEscape) { + this.opcode('appendEscaped'); + } else { + this.opcode('append'); + } + }, + Decorator: function Decorator(decorator) { + this.DecoratorBlock(decorator); + }, + + ContentStatement: function ContentStatement(content) { + if (content.value) { + this.opcode('appendContent', content.value); + } + }, + + CommentStatement: function CommentStatement() {}, + + SubExpression: function SubExpression(sexpr) { + transformLiteralToPath(sexpr); + var type = this.classifySexpr(sexpr); + + if (type === 'simple') { + this.simpleSexpr(sexpr); + } else if (type === 'helper') { + this.helperSexpr(sexpr); + } else { + this.ambiguousSexpr(sexpr); + } + }, + ambiguousSexpr: function ambiguousSexpr(sexpr, program, inverse) { + var path = sexpr.path, + name = path.parts[0], + isBlock = program != null || inverse != null; + + this.opcode('getContext', path.depth); + + this.opcode('pushProgram', program); + this.opcode('pushProgram', inverse); + + path.strict = true; + this.accept(path); + + this.opcode('invokeAmbiguous', name, isBlock); + }, + + simpleSexpr: function simpleSexpr(sexpr) { + var path = sexpr.path; + path.strict = true; + this.accept(path); + this.opcode('resolvePossibleLambda'); + }, + + helperSexpr: function helperSexpr(sexpr, program, inverse) { + var params = this.setupFullMustacheParams(sexpr, program, inverse), + path = sexpr.path, + name = path.parts[0]; + + if (this.options.knownHelpers[name]) { + this.opcode('invokeKnownHelper', params.length, name); + } else if (this.options.knownHelpersOnly) { + throw new _exception2['default']('You specified knownHelpersOnly, but used the unknown helper ' + name, sexpr); + } else { + path.strict = true; + path.falsy = true; + + this.accept(path); + this.opcode('invokeHelper', params.length, path.original, _ast2['default'].helpers.simpleId(path)); + } + }, + + PathExpression: function PathExpression(path) { + this.addDepth(path.depth); + this.opcode('getContext', path.depth); + + var name = path.parts[0], + scoped = _ast2['default'].helpers.scopedId(path), + blockParamId = !path.depth && !scoped && this.blockParamIndex(name); + + if (blockParamId) { + this.opcode('lookupBlockParam', blockParamId, path.parts); + } else if (!name) { + // Context reference, i.e. `{{foo .}}` or `{{foo ..}}` + this.opcode('pushContext'); + } else if (path.data) { + this.options.data = true; + this.opcode('lookupData', path.depth, path.parts, path.strict); + } else { + this.opcode('lookupOnContext', path.parts, path.falsy, path.strict, scoped); + } + }, + + StringLiteral: function StringLiteral(string) { + this.opcode('pushString', string.value); + }, + + NumberLiteral: function NumberLiteral(number) { + this.opcode('pushLiteral', number.value); + }, + + BooleanLiteral: function BooleanLiteral(bool) { + this.opcode('pushLiteral', bool.value); + }, + + UndefinedLiteral: function UndefinedLiteral() { + this.opcode('pushLiteral', 'undefined'); + }, + + NullLiteral: function NullLiteral() { + this.opcode('pushLiteral', 'null'); + }, + + Hash: function Hash(hash) { + var pairs = hash.pairs, + i = 0, + l = pairs.length; + + this.opcode('pushHash'); + + for (; i < l; i++) { + this.pushParam(pairs[i].value); + } + while (i--) { + this.opcode('assignToHash', pairs[i].key); + } + this.opcode('popHash'); + }, + + // HELPERS + opcode: function opcode(name) { + this.opcodes.push({ opcode: name, args: slice.call(arguments, 1), loc: this.sourceNode[0].loc }); + }, + + addDepth: function addDepth(depth) { + if (!depth) { + return; + } + + this.useDepths = true; + }, + + classifySexpr: function classifySexpr(sexpr) { + var isSimple = _ast2['default'].helpers.simpleId(sexpr.path); + + var isBlockParam = isSimple && !!this.blockParamIndex(sexpr.path.parts[0]); + + // a mustache is an eligible helper if: + // * its id is simple (a single part, not `this` or `..`) + var isHelper = !isBlockParam && _ast2['default'].helpers.helperExpression(sexpr); + + // if a mustache is an eligible helper but not a definite + // helper, it is ambiguous, and will be resolved in a later + // pass or at runtime. + var isEligible = !isBlockParam && (isHelper || isSimple); + + // if ambiguous, we can possibly resolve the ambiguity now + // An eligible helper is one that does not have a complex path, i.e. `this.foo`, `../foo` etc. + if (isEligible && !isHelper) { + var _name2 = sexpr.path.parts[0], + options = this.options; + + if (options.knownHelpers[_name2]) { + isHelper = true; + } else if (options.knownHelpersOnly) { + isEligible = false; + } + } + + if (isHelper) { + return 'helper'; + } else if (isEligible) { + return 'ambiguous'; + } else { + return 'simple'; + } + }, + + pushParams: function pushParams(params) { + for (var i = 0, l = params.length; i < l; i++) { + this.pushParam(params[i]); + } + }, + + pushParam: function pushParam(val) { + var value = val.value != null ? val.value : val.original || ''; + + if (this.stringParams) { + if (value.replace) { + value = value.replace(/^(\.?\.\/)*/g, '').replace(/\//g, '.'); + } + + if (val.depth) { + this.addDepth(val.depth); + } + this.opcode('getContext', val.depth || 0); + this.opcode('pushStringParam', value, val.type); + + if (val.type === 'SubExpression') { + // SubExpressions get evaluated and passed in + // in string params mode. + this.accept(val); + } + } else { + if (this.trackIds) { + var blockParamIndex = undefined; + if (val.parts && !_ast2['default'].helpers.scopedId(val) && !val.depth) { + blockParamIndex = this.blockParamIndex(val.parts[0]); + } + if (blockParamIndex) { + var blockParamChild = val.parts.slice(1).join('.'); + this.opcode('pushId', 'BlockParam', blockParamIndex, blockParamChild); + } else { + value = val.original || value; + if (value.replace) { + value = value.replace(/^this(?:\.|$)/, '').replace(/^\.\//, '').replace(/^\.$/, ''); + } + + this.opcode('pushId', val.type, value); + } + } + this.accept(val); + } + }, + + setupFullMustacheParams: function setupFullMustacheParams(sexpr, program, inverse, omitEmpty) { + var params = sexpr.params; + this.pushParams(params); + + this.opcode('pushProgram', program); + this.opcode('pushProgram', inverse); + + if (sexpr.hash) { + this.accept(sexpr.hash); + } else { + this.opcode('emptyHash', omitEmpty); + } + + return params; + }, + + blockParamIndex: function blockParamIndex(name) { + for (var depth = 0, len = this.options.blockParams.length; depth < len; depth++) { + var blockParams = this.options.blockParams[depth], + param = blockParams && _utils.indexOf(blockParams, name); + if (blockParams && param >= 0) { + return [depth, param]; + } + } + } + }; + + function precompile(input, options, env) { + if (input == null || typeof input !== 'string' && input.type !== 'Program') { + throw new _exception2['default']('You must pass a string or Handlebars AST to Handlebars.precompile. You passed ' + input); + } + + options = options || {}; + if (!('data' in options)) { + options.data = true; + } + if (options.compat) { + options.useDepths = true; + } + + var ast = env.parse(input, options), + environment = new env.Compiler().compile(ast, options); + return new env.JavaScriptCompiler().compile(environment, options); + } + + function compile(input, options, env) { + if (options === undefined) options = {}; + + if (input == null || typeof input !== 'string' && input.type !== 'Program') { + throw new _exception2['default']('You must pass a string or Handlebars AST to Handlebars.compile. You passed ' + input); + } + + if (!('data' in options)) { + options.data = true; + } + if (options.compat) { + options.useDepths = true; + } + + var compiled = undefined; + + function compileInput() { + var ast = env.parse(input, options), + environment = new env.Compiler().compile(ast, options), + templateSpec = new env.JavaScriptCompiler().compile(environment, options, undefined, true); + return env.template(templateSpec); + } + + // Template is only compiled on first use and cached after that point. + function ret(context, execOptions) { + if (!compiled) { + compiled = compileInput(); + } + return compiled.call(this, context, execOptions); + } + ret._setup = function (setupOptions) { + if (!compiled) { + compiled = compileInput(); + } + return compiled._setup(setupOptions); + }; + ret._child = function (i, data, blockParams, depths) { + if (!compiled) { + compiled = compileInput(); + } + return compiled._child(i, data, blockParams, depths); + }; + return ret; + } + + function argEquals(a, b) { + if (a === b) { + return true; + } + + if (_utils.isArray(a) && _utils.isArray(b) && a.length === b.length) { + for (var i = 0; i < a.length; i++) { + if (!argEquals(a[i], b[i])) { + return false; + } + } + return true; + } + } + + function transformLiteralToPath(sexpr) { + if (!sexpr.path.parts) { + var literal = sexpr.path; + // Casting to string here to make false and 0 literal values play nicely with the rest + // of the system. + sexpr.path = { + type: 'PathExpression', + data: false, + depth: 0, + parts: [literal.original + ''], + original: literal.original + '', + loc: literal.loc + }; + } + } + +/***/ }, +/* 28 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + var _interopRequireDefault = __webpack_require__(1)['default']; + + exports.__esModule = true; + + var _base = __webpack_require__(4); + + var _exception = __webpack_require__(6); + + var _exception2 = _interopRequireDefault(_exception); + + var _utils = __webpack_require__(5); + + var _codeGen = __webpack_require__(29); + + var _codeGen2 = _interopRequireDefault(_codeGen); + + function Literal(value) { + this.value = value; + } + + function JavaScriptCompiler() {} + + JavaScriptCompiler.prototype = { + // PUBLIC API: You can override these methods in a subclass to provide + // alternative compiled forms for name lookup and buffering semantics + nameLookup: function nameLookup(parent, name /* , type*/) { + if (JavaScriptCompiler.isValidJavaScriptVariableName(name)) { + return [parent, '.', name]; + } else { + return [parent, '[', JSON.stringify(name), ']']; + } + }, + depthedLookup: function depthedLookup(name) { + return [this.aliasable('container.lookup'), '(depths, "', name, '")']; + }, + + compilerInfo: function compilerInfo() { + var revision = _base.COMPILER_REVISION, + versions = _base.REVISION_CHANGES[revision]; + return [revision, versions]; + }, + + appendToBuffer: function appendToBuffer(source, location, explicit) { + // Force a source as this simplifies the merge logic. + if (!_utils.isArray(source)) { + source = [source]; + } + source = this.source.wrap(source, location); + + if (this.environment.isSimple) { + return ['return ', source, ';']; + } else if (explicit) { + // This is a case where the buffer operation occurs as a child of another + // construct, generally braces. We have to explicitly output these buffer + // operations to ensure that the emitted code goes in the correct location. + return ['buffer += ', source, ';']; + } else { + source.appendToBuffer = true; + return source; + } + }, + + initializeBuffer: function initializeBuffer() { + return this.quotedString(''); + }, + // END PUBLIC API + + compile: function compile(environment, options, context, asObject) { + this.environment = environment; + this.options = options; + this.stringParams = this.options.stringParams; + this.trackIds = this.options.trackIds; + this.precompile = !asObject; + + this.name = this.environment.name; + this.isChild = !!context; + this.context = context || { + decorators: [], + programs: [], + environments: [] + }; + + this.preamble(); + + this.stackSlot = 0; + this.stackVars = []; + this.aliases = {}; + this.registers = { list: [] }; + this.hashes = []; + this.compileStack = []; + this.inlineStack = []; + this.blockParams = []; + + this.compileChildren(environment, options); + + this.useDepths = this.useDepths || environment.useDepths || environment.useDecorators || this.options.compat; + this.useBlockParams = this.useBlockParams || environment.useBlockParams; + + var opcodes = environment.opcodes, + opcode = undefined, + firstLoc = undefined, + i = undefined, + l = undefined; + + for (i = 0, l = opcodes.length; i < l; i++) { + opcode = opcodes[i]; + + this.source.currentLocation = opcode.loc; + firstLoc = firstLoc || opcode.loc; + this[opcode.opcode].apply(this, opcode.args); + } + + // Flush any trailing content that might be pending. + this.source.currentLocation = firstLoc; + this.pushSource(''); + + /* istanbul ignore next */ + if (this.stackSlot || this.inlineStack.length || this.compileStack.length) { + throw new _exception2['default']('Compile completed with content left on stack'); + } + + if (!this.decorators.isEmpty()) { + this.useDecorators = true; + + this.decorators.prepend('var decorators = container.decorators;\n'); + this.decorators.push('return fn;'); + + if (asObject) { + this.decorators = Function.apply(this, ['fn', 'props', 'container', 'depth0', 'data', 'blockParams', 'depths', this.decorators.merge()]); + } else { + this.decorators.prepend('function(fn, props, container, depth0, data, blockParams, depths) {\n'); + this.decorators.push('}\n'); + this.decorators = this.decorators.merge(); + } + } else { + this.decorators = undefined; + } + + var fn = this.createFunctionContext(asObject); + if (!this.isChild) { + var ret = { + compiler: this.compilerInfo(), + main: fn + }; + + if (this.decorators) { + ret.main_d = this.decorators; // eslint-disable-line camelcase + ret.useDecorators = true; + } + + var _context = this.context; + var programs = _context.programs; + var decorators = _context.decorators; + + for (i = 0, l = programs.length; i < l; i++) { + if (programs[i]) { + ret[i] = programs[i]; + if (decorators[i]) { + ret[i + '_d'] = decorators[i]; + ret.useDecorators = true; + } + } + } + + if (this.environment.usePartial) { + ret.usePartial = true; + } + if (this.options.data) { + ret.useData = true; + } + if (this.useDepths) { + ret.useDepths = true; + } + if (this.useBlockParams) { + ret.useBlockParams = true; + } + if (this.options.compat) { + ret.compat = true; + } + + if (!asObject) { + ret.compiler = JSON.stringify(ret.compiler); + + this.source.currentLocation = { start: { line: 1, column: 0 } }; + ret = this.objectLiteral(ret); + + if (options.srcName) { + ret = ret.toStringWithSourceMap({ file: options.destName }); + ret.map = ret.map && ret.map.toString(); + } else { + ret = ret.toString(); + } + } else { + ret.compilerOptions = this.options; + } + + return ret; + } else { + return fn; + } + }, + + preamble: function preamble() { + // track the last context pushed into place to allow skipping the + // getContext opcode when it would be a noop + this.lastContext = 0; + this.source = new _codeGen2['default'](this.options.srcName); + this.decorators = new _codeGen2['default'](this.options.srcName); + }, + + createFunctionContext: function createFunctionContext(asObject) { + var varDeclarations = ''; + + var locals = this.stackVars.concat(this.registers.list); + if (locals.length > 0) { + varDeclarations += ', ' + locals.join(', '); + } + + // Generate minimizer alias mappings + // + // When using true SourceNodes, this will update all references to the given alias + // as the source nodes are reused in situ. For the non-source node compilation mode, + // aliases will not be used, but this case is already being run on the client and + // we aren't concern about minimizing the template size. + var aliasCount = 0; + for (var alias in this.aliases) { + // eslint-disable-line guard-for-in + var node = this.aliases[alias]; + + if (this.aliases.hasOwnProperty(alias) && node.children && node.referenceCount > 1) { + varDeclarations += ', alias' + ++aliasCount + '=' + alias; + node.children[0] = 'alias' + aliasCount; + } + } + + var params = ['container', 'depth0', 'helpers', 'partials', 'data']; + + if (this.useBlockParams || this.useDepths) { + params.push('blockParams'); + } + if (this.useDepths) { + params.push('depths'); + } + + // Perform a second pass over the output to merge content when possible + var source = this.mergeSource(varDeclarations); + + if (asObject) { + params.push(source); + + return Function.apply(this, params); + } else { + return this.source.wrap(['function(', params.join(','), ') {\n ', source, '}']); + } + }, + mergeSource: function mergeSource(varDeclarations) { + var isSimple = this.environment.isSimple, + appendOnly = !this.forceBuffer, + appendFirst = undefined, + sourceSeen = undefined, + bufferStart = undefined, + bufferEnd = undefined; + this.source.each(function (line) { + if (line.appendToBuffer) { + if (bufferStart) { + line.prepend(' + '); + } else { + bufferStart = line; + } + bufferEnd = line; + } else { + if (bufferStart) { + if (!sourceSeen) { + appendFirst = true; + } else { + bufferStart.prepend('buffer += '); + } + bufferEnd.add(';'); + bufferStart = bufferEnd = undefined; + } + + sourceSeen = true; + if (!isSimple) { + appendOnly = false; + } + } + }); + + if (appendOnly) { + if (bufferStart) { + bufferStart.prepend('return '); + bufferEnd.add(';'); + } else if (!sourceSeen) { + this.source.push('return "";'); + } + } else { + varDeclarations += ', buffer = ' + (appendFirst ? '' : this.initializeBuffer()); + + if (bufferStart) { + bufferStart.prepend('return buffer + '); + bufferEnd.add(';'); + } else { + this.source.push('return buffer;'); + } + } + + if (varDeclarations) { + this.source.prepend('var ' + varDeclarations.substring(2) + (appendFirst ? '' : ';\n')); + } + + return this.source.merge(); + }, + + // [blockValue] + // + // On stack, before: hash, inverse, program, value + // On stack, after: return value of blockHelperMissing + // + // The purpose of this opcode is to take a block of the form + // `{{#this.foo}}...{{/this.foo}}`, resolve the value of `foo`, and + // replace it on the stack with the result of properly + // invoking blockHelperMissing. + blockValue: function blockValue(name) { + var blockHelperMissing = this.aliasable('helpers.blockHelperMissing'), + params = [this.contextName(0)]; + this.setupHelperArgs(name, 0, params); + + var blockName = this.popStack(); + params.splice(1, 0, blockName); + + this.push(this.source.functionCall(blockHelperMissing, 'call', params)); + }, + + // [ambiguousBlockValue] + // + // On stack, before: hash, inverse, program, value + // Compiler value, before: lastHelper=value of last found helper, if any + // On stack, after, if no lastHelper: same as [blockValue] + // On stack, after, if lastHelper: value + ambiguousBlockValue: function ambiguousBlockValue() { + // We're being a bit cheeky and reusing the options value from the prior exec + var blockHelperMissing = this.aliasable('helpers.blockHelperMissing'), + params = [this.contextName(0)]; + this.setupHelperArgs('', 0, params, true); + + this.flushInline(); + + var current = this.topStack(); + params.splice(1, 0, current); + + this.pushSource(['if (!', this.lastHelper, ') { ', current, ' = ', this.source.functionCall(blockHelperMissing, 'call', params), '}']); + }, + + // [appendContent] + // + // On stack, before: ... + // On stack, after: ... + // + // Appends the string value of `content` to the current buffer + appendContent: function appendContent(content) { + if (this.pendingContent) { + content = this.pendingContent + content; + } else { + this.pendingLocation = this.source.currentLocation; + } + + this.pendingContent = content; + }, + + // [append] + // + // On stack, before: value, ... + // On stack, after: ... + // + // Coerces `value` to a String and appends it to the current buffer. + // + // If `value` is truthy, or 0, it is coerced into a string and appended + // Otherwise, the empty string is appended + append: function append() { + if (this.isInline()) { + this.replaceStack(function (current) { + return [' != null ? ', current, ' : ""']; + }); + + this.pushSource(this.appendToBuffer(this.popStack())); + } else { + var local = this.popStack(); + this.pushSource(['if (', local, ' != null) { ', this.appendToBuffer(local, undefined, true), ' }']); + if (this.environment.isSimple) { + this.pushSource(['else { ', this.appendToBuffer("''", undefined, true), ' }']); + } + } + }, + + // [appendEscaped] + // + // On stack, before: value, ... + // On stack, after: ... + // + // Escape `value` and append it to the buffer + appendEscaped: function appendEscaped() { + this.pushSource(this.appendToBuffer([this.aliasable('container.escapeExpression'), '(', this.popStack(), ')'])); + }, + + // [getContext] + // + // On stack, before: ... + // On stack, after: ... + // Compiler value, after: lastContext=depth + // + // Set the value of the `lastContext` compiler value to the depth + getContext: function getContext(depth) { + this.lastContext = depth; + }, + + // [pushContext] + // + // On stack, before: ... + // On stack, after: currentContext, ... + // + // Pushes the value of the current context onto the stack. + pushContext: function pushContext() { + this.pushStackLiteral(this.contextName(this.lastContext)); + }, + + // [lookupOnContext] + // + // On stack, before: ... + // On stack, after: currentContext[name], ... + // + // Looks up the value of `name` on the current context and pushes + // it onto the stack. + lookupOnContext: function lookupOnContext(parts, falsy, strict, scoped) { + var i = 0; + + if (!scoped && this.options.compat && !this.lastContext) { + // The depthed query is expected to handle the undefined logic for the root level that + // is implemented below, so we evaluate that directly in compat mode + this.push(this.depthedLookup(parts[i++])); + } else { + this.pushContext(); + } + + this.resolvePath('context', parts, i, falsy, strict); + }, + + // [lookupBlockParam] + // + // On stack, before: ... + // On stack, after: blockParam[name], ... + // + // Looks up the value of `parts` on the given block param and pushes + // it onto the stack. + lookupBlockParam: function lookupBlockParam(blockParamId, parts) { + this.useBlockParams = true; + + this.push(['blockParams[', blockParamId[0], '][', blockParamId[1], ']']); + this.resolvePath('context', parts, 1); + }, + + // [lookupData] + // + // On stack, before: ... + // On stack, after: data, ... + // + // Push the data lookup operator + lookupData: function lookupData(depth, parts, strict) { + if (!depth) { + this.pushStackLiteral('data'); + } else { + this.pushStackLiteral('container.data(data, ' + depth + ')'); + } + + this.resolvePath('data', parts, 0, true, strict); + }, + + resolvePath: function resolvePath(type, parts, i, falsy, strict) { + // istanbul ignore next + + var _this = this; + + if (this.options.strict || this.options.assumeObjects) { + this.push(strictLookup(this.options.strict && strict, this, parts, type)); + return; + } + + var len = parts.length; + for (; i < len; i++) { + /* eslint-disable no-loop-func */ + this.replaceStack(function (current) { + var lookup = _this.nameLookup(current, parts[i], type); + // We want to ensure that zero and false are handled properly if the context (falsy flag) + // needs to have the special handling for these values. + if (!falsy) { + return [' != null ? ', lookup, ' : ', current]; + } else { + // Otherwise we can use generic falsy handling + return [' && ', lookup]; + } + }); + /* eslint-enable no-loop-func */ + } + }, + + // [resolvePossibleLambda] + // + // On stack, before: value, ... + // On stack, after: resolved value, ... + // + // If the `value` is a lambda, replace it on the stack by + // the return value of the lambda + resolvePossibleLambda: function resolvePossibleLambda() { + this.push([this.aliasable('container.lambda'), '(', this.popStack(), ', ', this.contextName(0), ')']); + }, + + // [pushStringParam] + // + // On stack, before: ... + // On stack, after: string, currentContext, ... + // + // This opcode is designed for use in string mode, which + // provides the string value of a parameter along with its + // depth rather than resolving it immediately. + pushStringParam: function pushStringParam(string, type) { + this.pushContext(); + this.pushString(type); + + // If it's a subexpression, the string result + // will be pushed after this opcode. + if (type !== 'SubExpression') { + if (typeof string === 'string') { + this.pushString(string); + } else { + this.pushStackLiteral(string); + } + } + }, + + emptyHash: function emptyHash(omitEmpty) { + if (this.trackIds) { + this.push('{}'); // hashIds + } + if (this.stringParams) { + this.push('{}'); // hashContexts + this.push('{}'); // hashTypes + } + this.pushStackLiteral(omitEmpty ? 'undefined' : '{}'); + }, + pushHash: function pushHash() { + if (this.hash) { + this.hashes.push(this.hash); + } + this.hash = { values: [], types: [], contexts: [], ids: [] }; + }, + popHash: function popHash() { + var hash = this.hash; + this.hash = this.hashes.pop(); + + if (this.trackIds) { + this.push(this.objectLiteral(hash.ids)); + } + if (this.stringParams) { + this.push(this.objectLiteral(hash.contexts)); + this.push(this.objectLiteral(hash.types)); + } + + this.push(this.objectLiteral(hash.values)); + }, + + // [pushString] + // + // On stack, before: ... + // On stack, after: quotedString(string), ... + // + // Push a quoted version of `string` onto the stack + pushString: function pushString(string) { + this.pushStackLiteral(this.quotedString(string)); + }, + + // [pushLiteral] + // + // On stack, before: ... + // On stack, after: value, ... + // + // Pushes a value onto the stack. This operation prevents + // the compiler from creating a temporary variable to hold + // it. + pushLiteral: function pushLiteral(value) { + this.pushStackLiteral(value); + }, + + // [pushProgram] + // + // On stack, before: ... + // On stack, after: program(guid), ... + // + // Push a program expression onto the stack. This takes + // a compile-time guid and converts it into a runtime-accessible + // expression. + pushProgram: function pushProgram(guid) { + if (guid != null) { + this.pushStackLiteral(this.programExpression(guid)); + } else { + this.pushStackLiteral(null); + } + }, + + // [registerDecorator] + // + // On stack, before: hash, program, params..., ... + // On stack, after: ... + // + // Pops off the decorator's parameters, invokes the decorator, + // and inserts the decorator into the decorators list. + registerDecorator: function registerDecorator(paramSize, name) { + var foundDecorator = this.nameLookup('decorators', name, 'decorator'), + options = this.setupHelperArgs(name, paramSize); + + this.decorators.push(['fn = ', this.decorators.functionCall(foundDecorator, '', ['fn', 'props', 'container', options]), ' || fn;']); + }, + + // [invokeHelper] + // + // On stack, before: hash, inverse, program, params..., ... + // On stack, after: result of helper invocation + // + // Pops off the helper's parameters, invokes the helper, + // and pushes the helper's return value onto the stack. + // + // If the helper is not found, `helperMissing` is called. + invokeHelper: function invokeHelper(paramSize, name, isSimple) { + var nonHelper = this.popStack(), + helper = this.setupHelper(paramSize, name), + simple = isSimple ? [helper.name, ' || '] : ''; + + var lookup = ['('].concat(simple, nonHelper); + if (!this.options.strict) { + lookup.push(' || ', this.aliasable('helpers.helperMissing')); + } + lookup.push(')'); + + this.push(this.source.functionCall(lookup, 'call', helper.callParams)); + }, + + // [invokeKnownHelper] + // + // On stack, before: hash, inverse, program, params..., ... + // On stack, after: result of helper invocation + // + // This operation is used when the helper is known to exist, + // so a `helperMissing` fallback is not required. + invokeKnownHelper: function invokeKnownHelper(paramSize, name) { + var helper = this.setupHelper(paramSize, name); + this.push(this.source.functionCall(helper.name, 'call', helper.callParams)); + }, + + // [invokeAmbiguous] + // + // On stack, before: hash, inverse, program, params..., ... + // On stack, after: result of disambiguation + // + // This operation is used when an expression like `{{foo}}` + // is provided, but we don't know at compile-time whether it + // is a helper or a path. + // + // This operation emits more code than the other options, + // and can be avoided by passing the `knownHelpers` and + // `knownHelpersOnly` flags at compile-time. + invokeAmbiguous: function invokeAmbiguous(name, helperCall) { + this.useRegister('helper'); + + var nonHelper = this.popStack(); + + this.emptyHash(); + var helper = this.setupHelper(0, name, helperCall); + + var helperName = this.lastHelper = this.nameLookup('helpers', name, 'helper'); + + var lookup = ['(', '(helper = ', helperName, ' || ', nonHelper, ')']; + if (!this.options.strict) { + lookup[0] = '(helper = '; + lookup.push(' != null ? helper : ', this.aliasable('helpers.helperMissing')); + } + + this.push(['(', lookup, helper.paramsInit ? ['),(', helper.paramsInit] : [], '),', '(typeof helper === ', this.aliasable('"function"'), ' ? ', this.source.functionCall('helper', 'call', helper.callParams), ' : helper))']); + }, + + // [invokePartial] + // + // On stack, before: context, ... + // On stack after: result of partial invocation + // + // This operation pops off a context, invokes a partial with that context, + // and pushes the result of the invocation back. + invokePartial: function invokePartial(isDynamic, name, indent) { + var params = [], + options = this.setupParams(name, 1, params); + + if (isDynamic) { + name = this.popStack(); + delete options.name; + } + + if (indent) { + options.indent = JSON.stringify(indent); + } + options.helpers = 'helpers'; + options.partials = 'partials'; + options.decorators = 'container.decorators'; + + if (!isDynamic) { + params.unshift(this.nameLookup('partials', name, 'partial')); + } else { + params.unshift(name); + } + + if (this.options.compat) { + options.depths = 'depths'; + } + options = this.objectLiteral(options); + params.push(options); + + this.push(this.source.functionCall('container.invokePartial', '', params)); + }, + + // [assignToHash] + // + // On stack, before: value, ..., hash, ... + // On stack, after: ..., hash, ... + // + // Pops a value off the stack and assigns it to the current hash + assignToHash: function assignToHash(key) { + var value = this.popStack(), + context = undefined, + type = undefined, + id = undefined; + + if (this.trackIds) { + id = this.popStack(); + } + if (this.stringParams) { + type = this.popStack(); + context = this.popStack(); + } + + var hash = this.hash; + if (context) { + hash.contexts[key] = context; + } + if (type) { + hash.types[key] = type; + } + if (id) { + hash.ids[key] = id; + } + hash.values[key] = value; + }, + + pushId: function pushId(type, name, child) { + if (type === 'BlockParam') { + this.pushStackLiteral('blockParams[' + name[0] + '].path[' + name[1] + ']' + (child ? ' + ' + JSON.stringify('.' + child) : '')); + } else if (type === 'PathExpression') { + this.pushString(name); + } else if (type === 'SubExpression') { + this.pushStackLiteral('true'); + } else { + this.pushStackLiteral('null'); + } + }, + + // HELPERS + + compiler: JavaScriptCompiler, + + compileChildren: function compileChildren(environment, options) { + var children = environment.children, + child = undefined, + compiler = undefined; + + for (var i = 0, l = children.length; i < l; i++) { + child = children[i]; + compiler = new this.compiler(); // eslint-disable-line new-cap + + var index = this.matchExistingProgram(child); + + if (index == null) { + this.context.programs.push(''); // Placeholder to prevent name conflicts for nested children + index = this.context.programs.length; + child.index = index; + child.name = 'program' + index; + this.context.programs[index] = compiler.compile(child, options, this.context, !this.precompile); + this.context.decorators[index] = compiler.decorators; + this.context.environments[index] = child; + + this.useDepths = this.useDepths || compiler.useDepths; + this.useBlockParams = this.useBlockParams || compiler.useBlockParams; + } else { + child.index = index; + child.name = 'program' + index; + + this.useDepths = this.useDepths || child.useDepths; + this.useBlockParams = this.useBlockParams || child.useBlockParams; + } + } + }, + matchExistingProgram: function matchExistingProgram(child) { + for (var i = 0, len = this.context.environments.length; i < len; i++) { + var environment = this.context.environments[i]; + if (environment && environment.equals(child)) { + return i; + } + } + }, + + programExpression: function programExpression(guid) { + var child = this.environment.children[guid], + programParams = [child.index, 'data', child.blockParams]; + + if (this.useBlockParams || this.useDepths) { + programParams.push('blockParams'); + } + if (this.useDepths) { + programParams.push('depths'); + } + + return 'container.program(' + programParams.join(', ') + ')'; + }, + + useRegister: function useRegister(name) { + if (!this.registers[name]) { + this.registers[name] = true; + this.registers.list.push(name); + } + }, + + push: function push(expr) { + if (!(expr instanceof Literal)) { + expr = this.source.wrap(expr); + } + + this.inlineStack.push(expr); + return expr; + }, + + pushStackLiteral: function pushStackLiteral(item) { + this.push(new Literal(item)); + }, + + pushSource: function pushSource(source) { + if (this.pendingContent) { + this.source.push(this.appendToBuffer(this.source.quotedString(this.pendingContent), this.pendingLocation)); + this.pendingContent = undefined; + } + + if (source) { + this.source.push(source); + } + }, + + replaceStack: function replaceStack(callback) { + var prefix = ['('], + stack = undefined, + createdStack = undefined, + usedLiteral = undefined; + + /* istanbul ignore next */ + if (!this.isInline()) { + throw new _exception2['default']('replaceStack on non-inline'); + } + + // We want to merge the inline statement into the replacement statement via ',' + var top = this.popStack(true); + + if (top instanceof Literal) { + // Literals do not need to be inlined + stack = [top.value]; + prefix = ['(', stack]; + usedLiteral = true; + } else { + // Get or create the current stack name for use by the inline + createdStack = true; + var _name = this.incrStack(); + + prefix = ['((', this.push(_name), ' = ', top, ')']; + stack = this.topStack(); + } + + var item = callback.call(this, stack); + + if (!usedLiteral) { + this.popStack(); + } + if (createdStack) { + this.stackSlot--; + } + this.push(prefix.concat(item, ')')); + }, + + incrStack: function incrStack() { + this.stackSlot++; + if (this.stackSlot > this.stackVars.length) { + this.stackVars.push('stack' + this.stackSlot); + } + return this.topStackName(); + }, + topStackName: function topStackName() { + return 'stack' + this.stackSlot; + }, + flushInline: function flushInline() { + var inlineStack = this.inlineStack; + this.inlineStack = []; + for (var i = 0, len = inlineStack.length; i < len; i++) { + var entry = inlineStack[i]; + /* istanbul ignore if */ + if (entry instanceof Literal) { + this.compileStack.push(entry); + } else { + var stack = this.incrStack(); + this.pushSource([stack, ' = ', entry, ';']); + this.compileStack.push(stack); + } + } + }, + isInline: function isInline() { + return this.inlineStack.length; + }, + + popStack: function popStack(wrapped) { + var inline = this.isInline(), + item = (inline ? this.inlineStack : this.compileStack).pop(); + + if (!wrapped && item instanceof Literal) { + return item.value; + } else { + if (!inline) { + /* istanbul ignore next */ + if (!this.stackSlot) { + throw new _exception2['default']('Invalid stack pop'); + } + this.stackSlot--; + } + return item; + } + }, + + topStack: function topStack() { + var stack = this.isInline() ? this.inlineStack : this.compileStack, + item = stack[stack.length - 1]; + + /* istanbul ignore if */ + if (item instanceof Literal) { + return item.value; + } else { + return item; + } + }, + + contextName: function contextName(context) { + if (this.useDepths && context) { + return 'depths[' + context + ']'; + } else { + return 'depth' + context; + } + }, + + quotedString: function quotedString(str) { + return this.source.quotedString(str); + }, + + objectLiteral: function objectLiteral(obj) { + return this.source.objectLiteral(obj); + }, + + aliasable: function aliasable(name) { + var ret = this.aliases[name]; + if (ret) { + ret.referenceCount++; + return ret; + } + + ret = this.aliases[name] = this.source.wrap(name); + ret.aliasable = true; + ret.referenceCount = 1; + + return ret; + }, + + setupHelper: function setupHelper(paramSize, name, blockHelper) { + var params = [], + paramsInit = this.setupHelperArgs(name, paramSize, params, blockHelper); + var foundHelper = this.nameLookup('helpers', name, 'helper'); + + return { + params: params, + paramsInit: paramsInit, + name: foundHelper, + callParams: [this.contextName(0)].concat(params) + }; + }, + + setupParams: function setupParams(helper, paramSize, params) { + var options = {}, + contexts = [], + types = [], + ids = [], + objectArgs = !params, + param = undefined; + + if (objectArgs) { + params = []; + } + + options.name = this.quotedString(helper); + options.hash = this.popStack(); + + if (this.trackIds) { + options.hashIds = this.popStack(); + } + if (this.stringParams) { + options.hashTypes = this.popStack(); + options.hashContexts = this.popStack(); + } + + var inverse = this.popStack(), + program = this.popStack(); + + // Avoid setting fn and inverse if neither are set. This allows + // helpers to do a check for `if (options.fn)` + if (program || inverse) { + options.fn = program || 'container.noop'; + options.inverse = inverse || 'container.noop'; + } + + // The parameters go on to the stack in order (making sure that they are evaluated in order) + // so we need to pop them off the stack in reverse order + var i = paramSize; + while (i--) { + param = this.popStack(); + params[i] = param; + + if (this.trackIds) { + ids[i] = this.popStack(); + } + if (this.stringParams) { + types[i] = this.popStack(); + contexts[i] = this.popStack(); + } + } + + if (objectArgs) { + options.args = this.source.generateArray(params); + } + + if (this.trackIds) { + options.ids = this.source.generateArray(ids); + } + if (this.stringParams) { + options.types = this.source.generateArray(types); + options.contexts = this.source.generateArray(contexts); + } + + if (this.options.data) { + options.data = 'data'; + } + if (this.useBlockParams) { + options.blockParams = 'blockParams'; + } + return options; + }, + + setupHelperArgs: function setupHelperArgs(helper, paramSize, params, useRegister) { + var options = this.setupParams(helper, paramSize, params); + options = this.objectLiteral(options); + if (useRegister) { + this.useRegister('options'); + params.push('options'); + return ['options=', options]; + } else if (params) { + params.push(options); + return ''; + } else { + return options; + } + } + }; + + (function () { + var reservedWords = ('break else new var' + ' case finally return void' + ' catch for switch while' + ' continue function this with' + ' default if throw' + ' delete in try' + ' do instanceof typeof' + ' abstract enum int short' + ' boolean export interface static' + ' byte extends long super' + ' char final native synchronized' + ' class float package throws' + ' const goto private transient' + ' debugger implements protected volatile' + ' double import public let yield await' + ' null true false').split(' '); + + var compilerWords = JavaScriptCompiler.RESERVED_WORDS = {}; + + for (var i = 0, l = reservedWords.length; i < l; i++) { + compilerWords[reservedWords[i]] = true; + } + })(); + + JavaScriptCompiler.isValidJavaScriptVariableName = function (name) { + return !JavaScriptCompiler.RESERVED_WORDS[name] && /^[a-zA-Z_$][0-9a-zA-Z_$]*$/.test(name); + }; + + function strictLookup(requireTerminal, compiler, parts, type) { + var stack = compiler.popStack(), + i = 0, + len = parts.length; + if (requireTerminal) { + len--; + } + + for (; i < len; i++) { + stack = compiler.nameLookup(stack, parts[i], type); + } + + if (requireTerminal) { + return [compiler.aliasable('container.strict'), '(', stack, ', ', compiler.quotedString(parts[i]), ')']; + } else { + return stack; + } + } + + exports['default'] = JavaScriptCompiler; + module.exports = exports['default']; + +/***/ }, +/* 29 */ +/***/ function(module, exports, __webpack_require__) { + + /* global define */ + 'use strict'; + + exports.__esModule = true; + + var _utils = __webpack_require__(5); + + var SourceNode = undefined; + + try { + /* istanbul ignore next */ + if (false) { + // We don't support this in AMD environments. For these environments, we asusme that + // they are running on the browser and thus have no need for the source-map library. + var SourceMap = require('source-map'); + SourceNode = SourceMap.SourceNode; + } + } catch (err) {} + /* NOP */ + + /* istanbul ignore if: tested but not covered in istanbul due to dist build */ + if (!SourceNode) { + SourceNode = function (line, column, srcFile, chunks) { + this.src = ''; + if (chunks) { + this.add(chunks); + } + }; + /* istanbul ignore next */ + SourceNode.prototype = { + add: function add(chunks) { + if (_utils.isArray(chunks)) { + chunks = chunks.join(''); + } + this.src += chunks; + }, + prepend: function prepend(chunks) { + if (_utils.isArray(chunks)) { + chunks = chunks.join(''); + } + this.src = chunks + this.src; + }, + toStringWithSourceMap: function toStringWithSourceMap() { + return { code: this.toString() }; + }, + toString: function toString() { + return this.src; + } + }; + } + + function castChunk(chunk, codeGen, loc) { + if (_utils.isArray(chunk)) { + var ret = []; + + for (var i = 0, len = chunk.length; i < len; i++) { + ret.push(codeGen.wrap(chunk[i], loc)); + } + return ret; + } else if (typeof chunk === 'boolean' || typeof chunk === 'number') { + // Handle primitives that the SourceNode will throw up on + return chunk + ''; + } + return chunk; + } + + function CodeGen(srcFile) { + this.srcFile = srcFile; + this.source = []; + } + + CodeGen.prototype = { + isEmpty: function isEmpty() { + return !this.source.length; + }, + prepend: function prepend(source, loc) { + this.source.unshift(this.wrap(source, loc)); + }, + push: function push(source, loc) { + this.source.push(this.wrap(source, loc)); + }, + + merge: function merge() { + var source = this.empty(); + this.each(function (line) { + source.add([' ', line, '\n']); + }); + return source; + }, + + each: function each(iter) { + for (var i = 0, len = this.source.length; i < len; i++) { + iter(this.source[i]); + } + }, + + empty: function empty() { + var loc = this.currentLocation || { start: {} }; + return new SourceNode(loc.start.line, loc.start.column, this.srcFile); + }, + wrap: function wrap(chunk) { + var loc = arguments.length <= 1 || arguments[1] === undefined ? this.currentLocation || { start: {} } : arguments[1]; + + if (chunk instanceof SourceNode) { + return chunk; + } + + chunk = castChunk(chunk, this, loc); + + return new SourceNode(loc.start.line, loc.start.column, this.srcFile, chunk); + }, + + functionCall: function functionCall(fn, type, params) { + params = this.generateList(params); + return this.wrap([fn, type ? '.' + type + '(' : '(', params, ')']); + }, + + quotedString: function quotedString(str) { + return '"' + (str + '').replace(/\\/g, '\\\\').replace(/"/g, '\\"').replace(/\n/g, '\\n').replace(/\r/g, '\\r').replace(/\u2028/g, '\\u2028') // Per Ecma-262 7.3 + 7.8.4 + .replace(/\u2029/g, '\\u2029') + '"'; + }, + + objectLiteral: function objectLiteral(obj) { + var pairs = []; + + for (var key in obj) { + if (obj.hasOwnProperty(key)) { + var value = castChunk(obj[key], this); + if (value !== 'undefined') { + pairs.push([this.quotedString(key), ':', value]); + } + } + } + + var ret = this.generateList(pairs); + ret.prepend('{'); + ret.add('}'); + return ret; + }, + + generateList: function generateList(entries) { + var ret = this.empty(); + + for (var i = 0, len = entries.length; i < len; i++) { + if (i) { + ret.add(','); + } + + ret.add(castChunk(entries[i], this)); + } + + return ret; + }, + + generateArray: function generateArray(entries) { + var ret = this.generateList(entries); + ret.prepend('['); + ret.add(']'); + + return ret; + } + }; + + exports['default'] = CodeGen; + module.exports = exports['default']; + +/***/ } +/******/ ]) +}); +; \ No newline at end of file diff --git a/vendor/assets/javascripts/handlebars.runtime.js b/vendor/assets/javascripts/handlebars.runtime.js index fb93cde..cd5a6bf 100644 --- a/vendor/assets/javascripts/handlebars.runtime.js +++ b/vendor/assets/javascripts/handlebars.runtime.js @@ -1,8 +1,8 @@ /*! - handlebars v3.0.0 + handlebars v4.0.2 -Copyright (C) 2011-2014 by Yehuda Katz +Copyright (C) 2011-2015 by Yehuda Katz Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal @@ -24,703 +24,1216 @@ THE SOFTWARE. @license */ -/* exported Handlebars */ -(function (root, factory) { - if (typeof define === 'function' && define.amd) { - define([], factory); - } else if (typeof exports === 'object') { - module.exports = factory(); - } else { - root.Handlebars = factory(); - } -}(this, function () { -// handlebars/utils.js -var __module2__ = (function() { - "use strict"; - var __exports__ = {}; - /*jshint -W004 */ - var escape = { - "&": "&", - "<": "<", - ">": ">", - '"': """, - "'": "'", - "`": "`" - }; - - var badChars = /[&<>"'`]/g; - var possible = /[&<>"'`]/; - - function escapeChar(chr) { - return escape[chr]; - } - - function extend(obj /* , ...source */) { - for (var i = 1; i < arguments.length; i++) { - for (var key in arguments[i]) { - if (Object.prototype.hasOwnProperty.call(arguments[i], key)) { - obj[key] = arguments[i][key]; - } - } - } - - return obj; - } - - __exports__.extend = extend;var toString = Object.prototype.toString; - __exports__.toString = toString; - // Sourced from lodash - // https://github.com/bestiejs/lodash/blob/master/LICENSE.txt - var isFunction = function(value) { - return typeof value === 'function'; - }; - // fallback for older versions of Chrome and Safari - /* istanbul ignore next */ - if (isFunction(/x/)) { - isFunction = function(value) { - return typeof value === 'function' && toString.call(value) === '[object Function]'; - }; - } - var isFunction; - __exports__.isFunction = isFunction; - /* istanbul ignore next */ - var isArray = Array.isArray || function(value) { - return (value && typeof value === 'object') ? toString.call(value) === '[object Array]' : false; - }; - __exports__.isArray = isArray; - // Older IE versions do not directly support indexOf so we must implement our own, sadly. - function indexOf(array, value) { - for (var i = 0, len = array.length; i < len; i++) { - if (array[i] === value) { - return i; - } - } - return -1; - } - - __exports__.indexOf = indexOf; - function escapeExpression(string) { - // don't escape SafeStrings, since they're already safe - if (string && string.toHTML) { - return string.toHTML(); - } else if (string == null) { - return ""; - } else if (!string) { - return string + ''; - } - - // Force a string conversion as this will be done by the append regardless and - // the regex test will do this transparently behind the scenes, causing issues if - // an object's to string has escaped characters in it. - string = "" + string; - - if(!possible.test(string)) { return string; } - return string.replace(badChars, escapeChar); - } - - __exports__.escapeExpression = escapeExpression;function isEmpty(value) { - if (!value && value !== 0) { - return true; - } else if (isArray(value) && value.length === 0) { - return true; - } else { - return false; - } - } - - __exports__.isEmpty = isEmpty;function blockParams(params, ids) { - params.path = ids; - return params; - } - - __exports__.blockParams = blockParams;function appendContextPath(contextPath, id) { - return (contextPath ? contextPath + '.' : '') + id; - } - - __exports__.appendContextPath = appendContextPath; - return __exports__; -})(); - -// handlebars/exception.js -var __module3__ = (function() { - "use strict"; - var __exports__; - - var errorProps = ['description', 'fileName', 'lineNumber', 'message', 'name', 'number', 'stack']; - - function Exception(message, node) { - var loc = node && node.loc, - line, - column; - if (loc) { - line = loc.start.line; - column = loc.start.column; - - message += ' - ' + line + ':' + column; - } - - var tmp = Error.prototype.constructor.call(this, message); - - // Unfortunately errors are not enumerable in Chrome (at least), so `for prop in tmp` doesn't work. - for (var idx = 0; idx < errorProps.length; idx++) { - this[errorProps[idx]] = tmp[errorProps[idx]]; - } - - if (loc) { - this.lineNumber = line; - this.column = column; - } - } - - Exception.prototype = new Error(); - - __exports__ = Exception; - return __exports__; -})(); - -// handlebars/base.js -var __module1__ = (function(__dependency1__, __dependency2__) { - "use strict"; - var __exports__ = {}; - var Utils = __dependency1__; - var Exception = __dependency2__; - - var VERSION = "3.0.0"; - __exports__.VERSION = VERSION;var COMPILER_REVISION = 6; - __exports__.COMPILER_REVISION = COMPILER_REVISION; - var REVISION_CHANGES = { - 1: '<= 1.0.rc.2', // 1.0.rc.2 is actually rev2 but doesn't report it - 2: '== 1.0.0-rc.3', - 3: '== 1.0.0-rc.4', - 4: '== 1.x.x', - 5: '== 2.0.0-alpha.x', - 6: '>= 2.0.0-beta.1' - }; - __exports__.REVISION_CHANGES = REVISION_CHANGES; - var isArray = Utils.isArray, - isFunction = Utils.isFunction, - toString = Utils.toString, - objectType = '[object Object]'; - - function HandlebarsEnvironment(helpers, partials) { - this.helpers = helpers || {}; - this.partials = partials || {}; - - registerDefaultHelpers(this); - } - - __exports__.HandlebarsEnvironment = HandlebarsEnvironment;HandlebarsEnvironment.prototype = { - constructor: HandlebarsEnvironment, - - logger: logger, - log: log, - - registerHelper: function(name, fn) { - if (toString.call(name) === objectType) { - if (fn) { throw new Exception('Arg not supported with multiple helpers'); } - Utils.extend(this.helpers, name); - } else { - this.helpers[name] = fn; - } - }, - unregisterHelper: function(name) { - delete this.helpers[name]; - }, - - registerPartial: function(name, partial) { - if (toString.call(name) === objectType) { - Utils.extend(this.partials, name); - } else { - if (typeof partial === 'undefined') { - throw new Exception('Attempting to register a partial as undefined'); - } - this.partials[name] = partial; - } - }, - unregisterPartial: function(name) { - delete this.partials[name]; - } - }; - - function registerDefaultHelpers(instance) { - instance.registerHelper('helperMissing', function(/* [args, ]options */) { - if(arguments.length === 1) { - // A missing field in a {{foo}} constuct. - return undefined; - } else { - // Someone is actually trying to call something, blow up. - throw new Exception("Missing helper: '" + arguments[arguments.length-1].name + "'"); - } - }); - - instance.registerHelper('blockHelperMissing', function(context, options) { - var inverse = options.inverse, - fn = options.fn; - - if(context === true) { - return fn(this); - } else if(context === false || context == null) { - return inverse(this); - } else if (isArray(context)) { - if(context.length > 0) { - if (options.ids) { - options.ids = [options.name]; - } - - return instance.helpers.each(context, options); - } else { - return inverse(this); - } - } else { - if (options.data && options.ids) { - var data = createFrame(options.data); - data.contextPath = Utils.appendContextPath(options.data.contextPath, options.name); - options = {data: data}; - } - - return fn(context, options); - } - }); - - instance.registerHelper('each', function(context, options) { - if (!options) { - throw new Exception('Must pass iterator to #each'); - } - - var fn = options.fn, inverse = options.inverse; - var i = 0, ret = "", data; - - var contextPath; - if (options.data && options.ids) { - contextPath = Utils.appendContextPath(options.data.contextPath, options.ids[0]) + '.'; - } - - if (isFunction(context)) { context = context.call(this); } - - if (options.data) { - data = createFrame(options.data); - } - - function execIteration(key, i, last) { - if (data) { - data.key = key; - data.index = i; - data.first = i === 0; - data.last = !!last; - - if (contextPath) { - data.contextPath = contextPath + key; - } - } - - ret = ret + fn(context[key], { - data: data, - blockParams: Utils.blockParams([context[key], key], [contextPath + key, null]) - }); - } - - if(context && typeof context === 'object') { - if (isArray(context)) { - for(var j = context.length; i= 2.0.0-beta.1', + 7: '>= 4.0.0' + }; + + exports.REVISION_CHANGES = REVISION_CHANGES; + var objectType = '[object Object]'; + + function HandlebarsEnvironment(helpers, partials, decorators) { + this.helpers = helpers || {}; + this.partials = partials || {}; + this.decorators = decorators || {}; + + _helpers.registerDefaultHelpers(this); + _decorators.registerDefaultDecorators(this); + } + + HandlebarsEnvironment.prototype = { + constructor: HandlebarsEnvironment, + + logger: _logger2['default'], + log: _logger2['default'].log, + + registerHelper: function registerHelper(name, fn) { + if (_utils.toString.call(name) === objectType) { + if (fn) { + throw new _exception2['default']('Arg not supported with multiple helpers'); + } + _utils.extend(this.helpers, name); + } else { + this.helpers[name] = fn; + } + }, + unregisterHelper: function unregisterHelper(name) { + delete this.helpers[name]; + }, + + registerPartial: function registerPartial(name, partial) { + if (_utils.toString.call(name) === objectType) { + _utils.extend(this.partials, name); + } else { + if (typeof partial === 'undefined') { + throw new _exception2['default']('Attempting to register a partial as undefined'); + } + this.partials[name] = partial; + } + }, + unregisterPartial: function unregisterPartial(name) { + delete this.partials[name]; + }, + + registerDecorator: function registerDecorator(name, fn) { + if (_utils.toString.call(name) === objectType) { + if (fn) { + throw new _exception2['default']('Arg not supported with multiple decorators'); + } + _utils.extend(this.decorators, name); + } else { + this.decorators[name] = fn; + } + }, + unregisterDecorator: function unregisterDecorator(name) { + delete this.decorators[name]; + } + }; + + var log = _logger2['default'].log; + + exports.log = log; + exports.createFrame = _utils.createFrame; + exports.logger = _logger2['default']; + +/***/ }, +/* 4 */ +/***/ function(module, exports) { + + 'use strict'; + + exports.__esModule = true; + exports.extend = extend; + exports.indexOf = indexOf; + exports.escapeExpression = escapeExpression; + exports.isEmpty = isEmpty; + exports.createFrame = createFrame; + exports.blockParams = blockParams; + exports.appendContextPath = appendContextPath; + var escape = { + '&': '&', + '<': '<', + '>': '>', + '"': '"', + "'": ''', + '`': '`', + '=': '=' + }; + + var badChars = /[&<>"'`=]/g, + possible = /[&<>"'`=]/; + + function escapeChar(chr) { + return escape[chr]; + } + + function extend(obj /* , ...source */) { + for (var i = 1; i < arguments.length; i++) { + for (var key in arguments[i]) { + if (Object.prototype.hasOwnProperty.call(arguments[i], key)) { + obj[key] = arguments[i][key]; + } + } + } + + return obj; + } + + var toString = Object.prototype.toString; + + exports.toString = toString; + // Sourced from lodash + // https://github.com/bestiejs/lodash/blob/master/LICENSE.txt + /* eslint-disable func-style */ + var isFunction = function isFunction(value) { + return typeof value === 'function'; + }; + // fallback for older versions of Chrome and Safari + /* istanbul ignore next */ + if (isFunction(/x/)) { + exports.isFunction = isFunction = function (value) { + return typeof value === 'function' && toString.call(value) === '[object Function]'; + }; + } + exports.isFunction = isFunction; + + /* eslint-enable func-style */ + + /* istanbul ignore next */ + var isArray = Array.isArray || function (value) { + return value && typeof value === 'object' ? toString.call(value) === '[object Array]' : false; + }; + + exports.isArray = isArray; + // Older IE versions do not directly support indexOf so we must implement our own, sadly. + + function indexOf(array, value) { + for (var i = 0, len = array.length; i < len; i++) { + if (array[i] === value) { + return i; + } + } + return -1; + } + + function escapeExpression(string) { + if (typeof string !== 'string') { + // don't escape SafeStrings, since they're already safe + if (string && string.toHTML) { + return string.toHTML(); + } else if (string == null) { + return ''; + } else if (!string) { + return string + ''; + } + + // Force a string conversion as this will be done by the append regardless and + // the regex test will do this transparently behind the scenes, causing issues if + // an object's to string has escaped characters in it. + string = '' + string; + } + + if (!possible.test(string)) { + return string; + } + return string.replace(badChars, escapeChar); + } + + function isEmpty(value) { + if (!value && value !== 0) { + return true; + } else if (isArray(value) && value.length === 0) { + return true; + } else { + return false; + } + } + + function createFrame(object) { + var frame = extend({}, object); + frame._parent = object; + return frame; + } + + function blockParams(params, ids) { + params.path = ids; + return params; + } + + function appendContextPath(contextPath, id) { + return (contextPath ? contextPath + '.' : '') + id; + } + +/***/ }, +/* 5 */ +/***/ function(module, exports) { + + 'use strict'; + + exports.__esModule = true; + + var errorProps = ['description', 'fileName', 'lineNumber', 'message', 'name', 'number', 'stack']; + + function Exception(message, node) { + var loc = node && node.loc, + line = undefined, + column = undefined; + if (loc) { + line = loc.start.line; + column = loc.start.column; + + message += ' - ' + line + ':' + column; + } + + var tmp = Error.prototype.constructor.call(this, message); + + // Unfortunately errors are not enumerable in Chrome (at least), so `for prop in tmp` doesn't work. + for (var idx = 0; idx < errorProps.length; idx++) { + this[errorProps[idx]] = tmp[errorProps[idx]]; + } + + /* istanbul ignore else */ + if (Error.captureStackTrace) { + Error.captureStackTrace(this, Exception); + } + + if (loc) { + this.lineNumber = line; + this.column = column; + } + } + + Exception.prototype = new Error(); + + exports['default'] = Exception; + module.exports = exports['default']; + +/***/ }, +/* 6 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + var _interopRequireDefault = __webpack_require__(2)['default']; + + exports.__esModule = true; + exports.registerDefaultHelpers = registerDefaultHelpers; + + var _helpersBlockHelperMissing = __webpack_require__(7); + + var _helpersBlockHelperMissing2 = _interopRequireDefault(_helpersBlockHelperMissing); + + var _helpersEach = __webpack_require__(8); + + var _helpersEach2 = _interopRequireDefault(_helpersEach); + + var _helpersHelperMissing = __webpack_require__(9); + + var _helpersHelperMissing2 = _interopRequireDefault(_helpersHelperMissing); + + var _helpersIf = __webpack_require__(10); + + var _helpersIf2 = _interopRequireDefault(_helpersIf); + + var _helpersLog = __webpack_require__(11); + + var _helpersLog2 = _interopRequireDefault(_helpersLog); + + var _helpersLookup = __webpack_require__(12); + + var _helpersLookup2 = _interopRequireDefault(_helpersLookup); + + var _helpersWith = __webpack_require__(13); + + var _helpersWith2 = _interopRequireDefault(_helpersWith); + + function registerDefaultHelpers(instance) { + _helpersBlockHelperMissing2['default'](instance); + _helpersEach2['default'](instance); + _helpersHelperMissing2['default'](instance); + _helpersIf2['default'](instance); + _helpersLog2['default'](instance); + _helpersLookup2['default'](instance); + _helpersWith2['default'](instance); + } + +/***/ }, +/* 7 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + exports.__esModule = true; + + var _utils = __webpack_require__(4); + + exports['default'] = function (instance) { + instance.registerHelper('blockHelperMissing', function (context, options) { + var inverse = options.inverse, + fn = options.fn; + + if (context === true) { + return fn(this); + } else if (context === false || context == null) { + return inverse(this); + } else if (_utils.isArray(context)) { + if (context.length > 0) { + if (options.ids) { + options.ids = [options.name]; + } + + return instance.helpers.each(context, options); + } else { + return inverse(this); + } + } else { + if (options.data && options.ids) { + var data = _utils.createFrame(options.data); + data.contextPath = _utils.appendContextPath(options.data.contextPath, options.name); + options = { data: data }; + } + + return fn(context, options); + } + }); + }; + + module.exports = exports['default']; + +/***/ }, +/* 8 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + var _interopRequireDefault = __webpack_require__(2)['default']; + + exports.__esModule = true; + + var _utils = __webpack_require__(4); + + var _exception = __webpack_require__(5); + + var _exception2 = _interopRequireDefault(_exception); + + exports['default'] = function (instance) { + instance.registerHelper('each', function (context, options) { + if (!options) { + throw new _exception2['default']('Must pass iterator to #each'); + } + + var fn = options.fn, + inverse = options.inverse, + i = 0, + ret = '', + data = undefined, + contextPath = undefined; + + if (options.data && options.ids) { + contextPath = _utils.appendContextPath(options.data.contextPath, options.ids[0]) + '.'; + } + + if (_utils.isFunction(context)) { + context = context.call(this); + } + + if (options.data) { + data = _utils.createFrame(options.data); + } + + function execIteration(field, index, last) { + // Don't iterate over undefined values since we can't execute blocks against them + // in non-strict (js) mode. + if (context[field] == null) { + return; + } + + if (data) { + data.key = field; + data.index = index; + data.first = index === 0; + data.last = !!last; + + if (contextPath) { + data.contextPath = contextPath + field; + } + } + + ret = ret + fn(context[field], { + data: data, + blockParams: _utils.blockParams([context[field], field], [contextPath + field, null]) + }); + } + + if (context && typeof context === 'object') { + if (_utils.isArray(context)) { + for (var j = context.length; i < j; i++) { + execIteration(i, i, i === context.length - 1); + } + } else { + var priorKey = undefined; + + for (var key in context) { + if (context.hasOwnProperty(key)) { + // We're running the iterations one step out of sync so we can detect + // the last iteration without have to scan the object twice and create + // an itermediate keys array. + if (priorKey !== undefined) { + execIteration(priorKey, i - 1); + } + priorKey = key; + i++; + } + } + if (priorKey !== undefined) { + execIteration(priorKey, i - 1, true); + } + } + } + + if (i === 0) { + ret = inverse(this); + } + + return ret; + }); + }; + + module.exports = exports['default']; + +/***/ }, +/* 9 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + var _interopRequireDefault = __webpack_require__(2)['default']; + + exports.__esModule = true; + + var _exception = __webpack_require__(5); + + var _exception2 = _interopRequireDefault(_exception); + + exports['default'] = function (instance) { + instance.registerHelper('helperMissing', function () /* [args, ]options */{ + if (arguments.length === 1) { + // A missing field in a {{foo}} construct. + return undefined; + } else { + // Someone is actually trying to call something, blow up. + throw new _exception2['default']('Missing helper: "' + arguments[arguments.length - 1].name + '"'); + } + }); + }; + + module.exports = exports['default']; + +/***/ }, +/* 10 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + exports.__esModule = true; + + var _utils = __webpack_require__(4); + + exports['default'] = function (instance) { + instance.registerHelper('if', function (conditional, options) { + if (_utils.isFunction(conditional)) { + conditional = conditional.call(this); + } + + // Default behavior is to render the positive path if the value is truthy and not empty. + // The `includeZero` option may be set to treat the condtional as purely not empty based on the + // behavior of isEmpty. Effectively this determines if 0 is handled by the positive path or negative. + if (!options.hash.includeZero && !conditional || _utils.isEmpty(conditional)) { + return options.inverse(this); + } else { + return options.fn(this); + } + }); + + instance.registerHelper('unless', function (conditional, options) { + return instance.helpers['if'].call(this, conditional, { fn: options.inverse, inverse: options.fn, hash: options.hash }); + }); + }; + + module.exports = exports['default']; + +/***/ }, +/* 11 */ +/***/ function(module, exports) { + + 'use strict'; + + exports.__esModule = true; + + exports['default'] = function (instance) { + instance.registerHelper('log', function () /* message, options */{ + var args = [undefined], + options = arguments[arguments.length - 1]; + for (var i = 0; i < arguments.length - 1; i++) { + args.push(arguments[i]); + } + + var level = 1; + if (options.hash.level != null) { + level = options.hash.level; + } else if (options.data && options.data.level != null) { + level = options.data.level; + } + args[0] = level; + + instance.log.apply(instance, args); + }); + }; + + module.exports = exports['default']; + +/***/ }, +/* 12 */ +/***/ function(module, exports) { + + 'use strict'; + + exports.__esModule = true; + + exports['default'] = function (instance) { + instance.registerHelper('lookup', function (obj, field) { + return obj && obj[field]; + }); + }; + + module.exports = exports['default']; + +/***/ }, +/* 13 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + exports.__esModule = true; + + var _utils = __webpack_require__(4); + + exports['default'] = function (instance) { + instance.registerHelper('with', function (context, options) { + if (_utils.isFunction(context)) { + context = context.call(this); + } + + var fn = options.fn; + + if (!_utils.isEmpty(context)) { + var data = options.data; + if (options.data && options.ids) { + data = _utils.createFrame(options.data); + data.contextPath = _utils.appendContextPath(options.data.contextPath, options.ids[0]); + } + + return fn(context, { + data: data, + blockParams: _utils.blockParams([context], [data && data.contextPath]) + }); + } else { + return options.inverse(this); + } + }); + }; + + module.exports = exports['default']; + +/***/ }, +/* 14 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + var _interopRequireDefault = __webpack_require__(2)['default']; + + exports.__esModule = true; + exports.registerDefaultDecorators = registerDefaultDecorators; + + var _decoratorsInline = __webpack_require__(15); + + var _decoratorsInline2 = _interopRequireDefault(_decoratorsInline); + + function registerDefaultDecorators(instance) { + _decoratorsInline2['default'](instance); + } + +/***/ }, +/* 15 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + exports.__esModule = true; + + var _utils = __webpack_require__(4); + + exports['default'] = function (instance) { + instance.registerDecorator('inline', function (fn, props, container, options) { + var ret = fn; + if (!props.partials) { + props.partials = {}; + ret = function (context, options) { + // Create a new partials stack frame prior to exec. + var original = container.partials; + container.partials = _utils.extend({}, original, props.partials); + var ret = fn(context, options); + container.partials = original; + return ret; + }; + } + + props.partials[options.args[0]] = options.fn; + + return ret; + }); + }; + + module.exports = exports['default']; + +/***/ }, +/* 16 */ +/***/ function(module, exports) { + + 'use strict'; + + exports.__esModule = true; + var logger = { + methodMap: ['debug', 'info', 'warn', 'error'], + level: 'info', + + // Maps a given level value to the `methodMap` indexes above. + lookupLevel: function lookupLevel(level) { + if (typeof level === 'string') { + var levelMap = logger.methodMap.indexOf(level.toLowerCase()); + if (levelMap >= 0) { + level = levelMap; + } else { + level = parseInt(level, 10); + } + } + + return level; + }, + + // Can be overridden in the host environment + log: function log(level) { + level = logger.lookupLevel(level); + + if (typeof console !== 'undefined' && logger.lookupLevel(logger.level) <= level) { + var method = logger.methodMap[level]; + if (!console[method]) { + // eslint-disable-line no-console + method = 'log'; + } + + for (var _len = arguments.length, message = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { + message[_key - 1] = arguments[_key]; + } + + console[method].apply(console, message); // eslint-disable-line no-console + } + } + }; + + exports['default'] = logger; + module.exports = exports['default']; + +/***/ }, +/* 17 */ +/***/ function(module, exports) { + + // Build out our basic SafeString type + 'use strict'; + + exports.__esModule = true; + function SafeString(string) { + this.string = string; + } + + SafeString.prototype.toString = SafeString.prototype.toHTML = function () { + return '' + this.string; + }; + + exports['default'] = SafeString; + module.exports = exports['default']; + +/***/ }, +/* 18 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + var _interopRequireWildcard = __webpack_require__(1)['default']; + + var _interopRequireDefault = __webpack_require__(2)['default']; + + exports.__esModule = true; + exports.checkRevision = checkRevision; + exports.template = template; + exports.wrapProgram = wrapProgram; + exports.resolvePartial = resolvePartial; + exports.invokePartial = invokePartial; + exports.noop = noop; + + var _utils = __webpack_require__(4); + + var Utils = _interopRequireWildcard(_utils); + + var _exception = __webpack_require__(5); + + var _exception2 = _interopRequireDefault(_exception); + + var _base = __webpack_require__(3); + + function checkRevision(compilerInfo) { + var compilerRevision = compilerInfo && compilerInfo[0] || 1, + currentRevision = _base.COMPILER_REVISION; + + if (compilerRevision !== currentRevision) { + if (compilerRevision < currentRevision) { + var runtimeVersions = _base.REVISION_CHANGES[currentRevision], + compilerVersions = _base.REVISION_CHANGES[compilerRevision]; + throw new _exception2['default']('Template was precompiled with an older version of Handlebars than the current runtime. ' + 'Please update your precompiler to a newer version (' + runtimeVersions + ') or downgrade your runtime to an older version (' + compilerVersions + ').'); + } else { + // Use the embedded version info since the runtime doesn't know about this revision yet + throw new _exception2['default']('Template was precompiled with a newer version of Handlebars than the current runtime. ' + 'Please update your runtime to a newer version (' + compilerInfo[1] + ').'); + } + } + } + + function template(templateSpec, env) { + /* istanbul ignore next */ + if (!env) { + throw new _exception2['default']('No environment passed to template'); + } + if (!templateSpec || !templateSpec.main) { + throw new _exception2['default']('Unknown template object: ' + typeof templateSpec); + } + + templateSpec.main.decorator = templateSpec.main_d; + + // Note: Using env.VM references rather than local var references throughout this section to allow + // for external users to override these as psuedo-supported APIs. + env.VM.checkRevision(templateSpec.compiler); + + function invokePartialWrapper(partial, context, options) { + if (options.hash) { + context = Utils.extend({}, context, options.hash); + if (options.ids) { + options.ids[0] = true; + } + } + + partial = env.VM.resolvePartial.call(this, partial, context, options); + var result = env.VM.invokePartial.call(this, partial, context, options); + + if (result == null && env.compile) { + options.partials[options.name] = env.compile(partial, templateSpec.compilerOptions, env); + result = options.partials[options.name](context, options); + } + if (result != null) { + if (options.indent) { + var lines = result.split('\n'); + for (var i = 0, l = lines.length; i < l; i++) { + if (!lines[i] && i + 1 === l) { + break; + } + + lines[i] = options.indent + lines[i]; + } + result = lines.join('\n'); + } + return result; + } else { + throw new _exception2['default']('The partial ' + options.name + ' could not be compiled when running in runtime-only mode'); + } + } + + // Just add water + var container = { + strict: function strict(obj, name) { + if (!(name in obj)) { + throw new _exception2['default']('"' + name + '" not defined in ' + obj); + } + return obj[name]; + }, + lookup: function lookup(depths, name) { + var len = depths.length; + for (var i = 0; i < len; i++) { + if (depths[i] && depths[i][name] != null) { + return depths[i][name]; + } + } + }, + lambda: function lambda(current, context) { + return typeof current === 'function' ? current.call(context) : current; + }, + + escapeExpression: Utils.escapeExpression, + invokePartial: invokePartialWrapper, + + fn: function fn(i) { + var ret = templateSpec[i]; + ret.decorator = templateSpec[i + '_d']; + return ret; + }, + + programs: [], + program: function program(i, data, declaredBlockParams, blockParams, depths) { + var programWrapper = this.programs[i], + fn = this.fn(i); + if (data || depths || blockParams || declaredBlockParams) { + programWrapper = wrapProgram(this, i, fn, data, declaredBlockParams, blockParams, depths); + } else if (!programWrapper) { + programWrapper = this.programs[i] = wrapProgram(this, i, fn); + } + return programWrapper; + }, + + data: function data(value, depth) { + while (value && depth--) { + value = value._parent; + } + return value; + }, + merge: function merge(param, common) { + var obj = param || common; + + if (param && common && param !== common) { + obj = Utils.extend({}, common, param); + } + + return obj; + }, + + noop: env.VM.noop, + compilerInfo: templateSpec.compiler + }; + + function ret(context) { + var options = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1]; + + var data = options.data; + + ret._setup(options); + if (!options.partial && templateSpec.useData) { + data = initData(context, data); + } + var depths = undefined, + blockParams = templateSpec.useBlockParams ? [] : undefined; + if (templateSpec.useDepths) { + if (options.depths) { + depths = context !== options.depths[0] ? [context].concat(options.depths) : options.depths; + } else { + depths = [context]; + } + } + + function main(context /*, options*/) { + return '' + templateSpec.main(container, context, container.helpers, container.partials, data, blockParams, depths); + } + main = executeDecorators(templateSpec.main, main, container, options.depths || [], data, blockParams); + return main(context, options); + } + ret.isTop = true; + + ret._setup = function (options) { + if (!options.partial) { + container.helpers = container.merge(options.helpers, env.helpers); + + if (templateSpec.usePartial) { + container.partials = container.merge(options.partials, env.partials); + } + if (templateSpec.usePartial || templateSpec.useDecorators) { + container.decorators = container.merge(options.decorators, env.decorators); + } + } else { + container.helpers = options.helpers; + container.partials = options.partials; + container.decorators = options.decorators; + } + }; + + ret._child = function (i, data, blockParams, depths) { + if (templateSpec.useBlockParams && !blockParams) { + throw new _exception2['default']('must pass block params'); + } + if (templateSpec.useDepths && !depths) { + throw new _exception2['default']('must pass parent depths'); + } + + return wrapProgram(container, i, templateSpec[i], data, 0, blockParams, depths); + }; + return ret; + } + + function wrapProgram(container, i, fn, data, declaredBlockParams, blockParams, depths) { + function prog(context) { + var options = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1]; + + var currentDepths = depths; + if (depths && context !== depths[0]) { + currentDepths = [context].concat(depths); + } + + return fn(container, context, container.helpers, container.partials, options.data || data, blockParams && [options.blockParams].concat(blockParams), currentDepths); + } + + prog = executeDecorators(fn, prog, container, depths, data, blockParams); + + prog.program = i; + prog.depth = depths ? depths.length : 0; + prog.blockParams = declaredBlockParams || 0; + return prog; + } + + function resolvePartial(partial, context, options) { + if (!partial) { + if (options.name === '@partial-block') { + partial = options.data['partial-block']; + } else { + partial = options.partials[options.name]; + } + } else if (!partial.call && !options.name) { + // This is a dynamic partial that returned a string + options.name = partial; + partial = options.partials[partial]; + } + return partial; + } + + function invokePartial(partial, context, options) { + options.partial = true; + if (options.ids) { + options.data.contextPath = options.ids[0] || options.data.contextPath; + } + + var partialBlock = undefined; + if (options.fn && options.fn !== noop) { + partialBlock = options.data['partial-block'] = options.fn; + + if (partialBlock.partials) { + options.partials = Utils.extend({}, options.partials, partialBlock.partials); + } + } + + if (partial === undefined && partialBlock) { + partial = partialBlock; + } + + if (partial === undefined) { + throw new _exception2['default']('The partial ' + options.name + ' could not be found'); + } else if (partial instanceof Function) { + return partial(context, options); + } + } + + function noop() { + return ''; + } + + function initData(context, data) { + if (!data || !('root' in data)) { + data = data ? _base.createFrame(data) : {}; + data.root = context; + } + return data; + } + + function executeDecorators(fn, prog, container, depths, data, blockParams) { + if (fn.decorator) { + var props = {}; + prog = fn.decorator(prog, props, container, depths && depths[0], data, blockParams, depths); + Utils.extend(prog, props); + } + return prog; + } + +/***/ }, +/* 19 */ +/***/ function(module, exports) { + + /* WEBPACK VAR INJECTION */(function(global) {/* global window */ + 'use strict'; + + exports.__esModule = true; + + exports['default'] = function (Handlebars) { + /* istanbul ignore next */ + var root = typeof global !== 'undefined' ? global : window, + $Handlebars = root.Handlebars; + /* istanbul ignore next */ + Handlebars.noConflict = function () { + if (root.Handlebars === Handlebars) { + root.Handlebars = $Handlebars; + } + }; + }; + + module.exports = exports['default']; + /* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }()))) + +/***/ } +/******/ ]) +}); +; \ No newline at end of file From 3a50c942d6f60ae708d8848ddd1cb8a3f080c72e Mon Sep 17 00:00:00 2001 From: Alex Riedler Date: Sat, 26 Sep 2015 20:57:01 -0400 Subject: [PATCH 42/81] Bump version. --- CHANGELOG.md | 4 ++++ handlebars_assets.gemspec | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fb8c38c..21235a8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.21.0 (2015-02-24) + +* Update Handlebars to v4.0.2 + ## 0.20.2 (2015-02-24) * Relax Sprockets Dependencies - @rounders diff --git a/handlebars_assets.gemspec b/handlebars_assets.gemspec index b915693..1117bc1 100644 --- a/handlebars_assets.gemspec +++ b/handlebars_assets.gemspec @@ -30,5 +30,5 @@ Gem::Specification.new do |s| s.add_development_dependency "slim", '~> 3.0' s.add_development_dependency 'json', '~> 1.7' - s.post_install_message = "Remember to rake assets:clean or rake assets:purge on update!" + s.post_install_message = "Remember to rake assets:clean or rake assets:purge on update! this is required because of handlebars updates" end From a07cc3b47d5afa496f8f875f05e2287a27d8efbd Mon Sep 17 00:00:00 2001 From: Alex Riedler Date: Sat, 26 Sep 2015 21:00:10 -0400 Subject: [PATCH 43/81] Missing requires needed for tests. --- test/handlebars_assets/tilt_handlebars_test.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/test/handlebars_assets/tilt_handlebars_test.rb b/test/handlebars_assets/tilt_handlebars_test.rb index 57b4983..5ecb89c 100644 --- a/test/handlebars_assets/tilt_handlebars_test.rb +++ b/test/handlebars_assets/tilt_handlebars_test.rb @@ -1,4 +1,6 @@ require 'test_helper' +require 'haml' +require 'slim' module HandlebarsAssets class HandlebarsTemplateTest < Minitest::Test @@ -11,11 +13,11 @@ def teardown end def compile_haml(source) - Haml::Engine.new(source, HandlebarsAssets::Config.haml_options).render + ::Haml::Engine.new(source, HandlebarsAssets::Config.haml_options).render end def compile_slim(source) - Slim::Template.new(HandlebarsAssets::Config.slim_options) { source }.render + ::Slim::Template.new(HandlebarsAssets::Config.slim_options) { source }.render end def test_render From 53443fa7f92c011714bd6aa5831be6074131cfca Mon Sep 17 00:00:00 2001 From: Alex Riedler Date: Tue, 24 Nov 2015 17:20:03 -0500 Subject: [PATCH 44/81] Update to Handlebars v4.0.5 --- CHANGELOG.md | 4 ++ lib/handlebars_assets/version.rb | 2 +- vendor/assets/javascripts/handlebars.js | 40 ++++++++++--------- .../assets/javascripts/handlebars.runtime.js | 25 ++++++------ 4 files changed, 40 insertions(+), 31 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 21235a8..daf8deb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.22.0 (2015-11-23) + +* Update Handlebars to v4.0.5 + ## 0.21.0 (2015-02-24) * Update Handlebars to v4.0.2 diff --git a/lib/handlebars_assets/version.rb b/lib/handlebars_assets/version.rb index ad54dce..424c8af 100644 --- a/lib/handlebars_assets/version.rb +++ b/lib/handlebars_assets/version.rb @@ -1,3 +1,3 @@ module HandlebarsAssets - VERSION = "0.21.0" + VERSION = "0.22.0" end diff --git a/vendor/assets/javascripts/handlebars.js b/vendor/assets/javascripts/handlebars.js index ebbf027..289ae45 100644 --- a/vendor/assets/javascripts/handlebars.js +++ b/vendor/assets/javascripts/handlebars.js @@ -1,6 +1,6 @@ /*! - handlebars v4.0.2 + handlebars v4.0.5 Copyright (C) 2011-2015 by Yehuda Katz @@ -275,7 +275,7 @@ return /******/ (function(modules) { // webpackBootstrap var _logger2 = _interopRequireDefault(_logger); - var VERSION = '4.0.2'; + var VERSION = '4.0.5'; exports.VERSION = VERSION; var COMPILER_REVISION = 7; @@ -327,7 +327,7 @@ return /******/ (function(modules) { // webpackBootstrap _utils.extend(this.partials, name); } else { if (typeof partial === 'undefined') { - throw new _exception2['default']('Attempting to register a partial as undefined'); + throw new _exception2['default']('Attempting to register a partial called "' + name + '" as undefined'); } this.partials[name] = partial; } @@ -663,12 +663,6 @@ return /******/ (function(modules) { // webpackBootstrap } function execIteration(field, index, last) { - // Don't iterate over undefined values since we can't execute blocks against them - // in non-strict (js) mode. - if (context[field] == null) { - return; - } - if (data) { data.key = field; data.index = index; @@ -689,7 +683,9 @@ return /******/ (function(modules) { // webpackBootstrap if (context && typeof context === 'object') { if (_utils.isArray(context)) { for (var j = context.length; i < j; i++) { - execIteration(i, i, i === context.length - 1); + if (i in context) { + execIteration(i, i, i === context.length - 1); + } } } else { var priorKey = undefined; @@ -920,11 +916,14 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, /* 17 */ -/***/ function(module, exports) { +/***/ function(module, exports, __webpack_require__) { 'use strict'; exports.__esModule = true; + + var _utils = __webpack_require__(5); + var logger = { methodMap: ['debug', 'info', 'warn', 'error'], level: 'info', @@ -932,7 +931,7 @@ return /******/ (function(modules) { // webpackBootstrap // Maps a given level value to the `methodMap` indexes above. lookupLevel: function lookupLevel(level) { if (typeof level === 'string') { - var levelMap = logger.methodMap.indexOf(level.toLowerCase()); + var levelMap = _utils.indexOf(logger.methodMap, level.toLowerCase()); if (levelMap >= 0) { level = levelMap; } else { @@ -1238,6 +1237,7 @@ return /******/ (function(modules) { // webpackBootstrap var partialBlock = undefined; if (options.fn && options.fn !== noop) { + options.data = _base.createFrame(options.data); partialBlock = options.data['partial-block'] = options.fn; if (partialBlock.partials) { @@ -1295,6 +1295,7 @@ return /******/ (function(modules) { // webpackBootstrap if (root.Handlebars === Handlebars) { root.Handlebars = $Handlebars; } + return Handlebars; }; }; @@ -1399,7 +1400,8 @@ return /******/ (function(modules) { // webpackBootstrap symbols_: { "error": 2, "root": 3, "program": 4, "EOF": 5, "program_repetition0": 6, "statement": 7, "mustache": 8, "block": 9, "rawBlock": 10, "partial": 11, "partialBlock": 12, "content": 13, "COMMENT": 14, "CONTENT": 15, "openRawBlock": 16, "rawBlock_repetition_plus0": 17, "END_RAW_BLOCK": 18, "OPEN_RAW_BLOCK": 19, "helperName": 20, "openRawBlock_repetition0": 21, "openRawBlock_option0": 22, "CLOSE_RAW_BLOCK": 23, "openBlock": 24, "block_option0": 25, "closeBlock": 26, "openInverse": 27, "block_option1": 28, "OPEN_BLOCK": 29, "openBlock_repetition0": 30, "openBlock_option0": 31, "openBlock_option1": 32, "CLOSE": 33, "OPEN_INVERSE": 34, "openInverse_repetition0": 35, "openInverse_option0": 36, "openInverse_option1": 37, "openInverseChain": 38, "OPEN_INVERSE_CHAIN": 39, "openInverseChain_repetition0": 40, "openInverseChain_option0": 41, "openInverseChain_option1": 42, "inverseAndProgram": 43, "INVERSE": 44, "inverseChain": 45, "inverseChain_option0": 46, "OPEN_ENDBLOCK": 47, "OPEN": 48, "mustache_repetition0": 49, "mustache_option0": 50, "OPEN_UNESCAPED": 51, "mustache_repetition1": 52, "mustache_option1": 53, "CLOSE_UNESCAPED": 54, "OPEN_PARTIAL": 55, "partialName": 56, "partial_repetition0": 57, "partial_option0": 58, "openPartialBlock": 59, "OPEN_PARTIAL_BLOCK": 60, "openPartialBlock_repetition0": 61, "openPartialBlock_option0": 62, "param": 63, "sexpr": 64, "OPEN_SEXPR": 65, "sexpr_repetition0": 66, "sexpr_option0": 67, "CLOSE_SEXPR": 68, "hash": 69, "hash_repetition_plus0": 70, "hashSegment": 71, "ID": 72, "EQUALS": 73, "blockParams": 74, "OPEN_BLOCK_PARAMS": 75, "blockParams_repetition_plus0": 76, "CLOSE_BLOCK_PARAMS": 77, "path": 78, "dataName": 79, "STRING": 80, "NUMBER": 81, "BOOLEAN": 82, "UNDEFINED": 83, "NULL": 84, "DATA": 85, "pathSegments": 86, "SEP": 87, "$accept": 0, "$end": 1 }, terminals_: { 2: "error", 5: "EOF", 14: "COMMENT", 15: "CONTENT", 18: "END_RAW_BLOCK", 19: "OPEN_RAW_BLOCK", 23: "CLOSE_RAW_BLOCK", 29: "OPEN_BLOCK", 33: "CLOSE", 34: "OPEN_INVERSE", 39: "OPEN_INVERSE_CHAIN", 44: "INVERSE", 47: "OPEN_ENDBLOCK", 48: "OPEN", 51: "OPEN_UNESCAPED", 54: "CLOSE_UNESCAPED", 55: "OPEN_PARTIAL", 60: "OPEN_PARTIAL_BLOCK", 65: "OPEN_SEXPR", 68: "CLOSE_SEXPR", 72: "ID", 73: "EQUALS", 75: "OPEN_BLOCK_PARAMS", 77: "CLOSE_BLOCK_PARAMS", 80: "STRING", 81: "NUMBER", 82: "BOOLEAN", 83: "UNDEFINED", 84: "NULL", 85: "DATA", 87: "SEP" }, productions_: [0, [3, 2], [4, 1], [7, 1], [7, 1], [7, 1], [7, 1], [7, 1], [7, 1], [7, 1], [13, 1], [10, 3], [16, 5], [9, 4], [9, 4], [24, 6], [27, 6], [38, 6], [43, 2], [45, 3], [45, 1], [26, 3], [8, 5], [8, 5], [11, 5], [12, 3], [59, 5], [63, 1], [63, 1], [64, 5], [69, 1], [71, 3], [74, 3], [20, 1], [20, 1], [20, 1], [20, 1], [20, 1], [20, 1], [20, 1], [56, 1], [56, 1], [79, 2], [78, 1], [86, 3], [86, 1], [6, 0], [6, 2], [17, 1], [17, 2], [21, 0], [21, 2], [22, 0], [22, 1], [25, 0], [25, 1], [28, 0], [28, 1], [30, 0], [30, 2], [31, 0], [31, 1], [32, 0], [32, 1], [35, 0], [35, 2], [36, 0], [36, 1], [37, 0], [37, 1], [40, 0], [40, 2], [41, 0], [41, 1], [42, 0], [42, 1], [46, 0], [46, 1], [49, 0], [49, 2], [50, 0], [50, 1], [52, 0], [52, 2], [53, 0], [53, 1], [57, 0], [57, 2], [58, 0], [58, 1], [61, 0], [61, 2], [62, 0], [62, 1], [66, 0], [66, 2], [67, 0], [67, 1], [70, 1], [70, 2], [76, 1], [76, 2]], - performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$) { + performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$ + /**/) { var $0 = $$.length - 1; switch (yystate) { @@ -1936,7 +1938,8 @@ return /******/ (function(modules) { // webpackBootstrap this.begin(condition); } }; lexer.options = {}; - lexer.performAction = function anonymous(yy, yy_, $avoiding_name_collisions, YY_START) { + lexer.performAction = function anonymous(yy, yy_, $avoiding_name_collisions, YY_START + /**/) { function strip(start, end) { return yy_.yytext = yy_.yytext.substr(start, yy_.yyleng - end); @@ -2103,7 +2106,7 @@ return /******/ (function(modules) { // webpackBootstrap return 72; break; case 42: - return 72; + yy_.yytext = yy_.yytext.replace(/\\([\\\]])/g, '$1');return 72; break; case 43: return 'INVALID'; @@ -2113,7 +2116,7 @@ return /******/ (function(modules) { // webpackBootstrap break; } }; - lexer.rules = [/^(?:[^\x00]*?(?=(\{\{)))/, /^(?:[^\x00]+)/, /^(?:[^\x00]{2,}?(?=(\{\{|\\\{\{|\\\\\{\{|$)))/, /^(?:\{\{\{\{(?=[^/]))/, /^(?:\{\{\{\{\/[^\s!"#%-,\.\/;->@\[-\^`\{-~]+(?=[=}\s\/.])\}\}\}\})/, /^(?:[^\x00]*?(?=(\{\{\{\{)))/, /^(?:[\s\S]*?--(~)?\}\})/, /^(?:\()/, /^(?:\))/, /^(?:\{\{\{\{)/, /^(?:\}\}\}\})/, /^(?:\{\{(~)?>)/, /^(?:\{\{(~)?#>)/, /^(?:\{\{(~)?#\*?)/, /^(?:\{\{(~)?\/)/, /^(?:\{\{(~)?\^\s*(~)?\}\})/, /^(?:\{\{(~)?\s*else\s*(~)?\}\})/, /^(?:\{\{(~)?\^)/, /^(?:\{\{(~)?\s*else\b)/, /^(?:\{\{(~)?\{)/, /^(?:\{\{(~)?&)/, /^(?:\{\{(~)?!--)/, /^(?:\{\{(~)?![\s\S]*?\}\})/, /^(?:\{\{(~)?\*?)/, /^(?:=)/, /^(?:\.\.)/, /^(?:\.(?=([=~}\s\/.)|])))/, /^(?:[\/.])/, /^(?:\s+)/, /^(?:\}(~)?\}\})/, /^(?:(~)?\}\})/, /^(?:"(\\["]|[^"])*")/, /^(?:'(\\[']|[^'])*')/, /^(?:@)/, /^(?:true(?=([~}\s)])))/, /^(?:false(?=([~}\s)])))/, /^(?:undefined(?=([~}\s)])))/, /^(?:null(?=([~}\s)])))/, /^(?:-?[0-9]+(?:\.[0-9]+)?(?=([~}\s)])))/, /^(?:as\s+\|)/, /^(?:\|)/, /^(?:([^\s!"#%-,\.\/;->@\[-\^`\{-~]+(?=([=~}\s\/.)|]))))/, /^(?:\[[^\]]*\])/, /^(?:.)/, /^(?:$)/]; + lexer.rules = [/^(?:[^\x00]*?(?=(\{\{)))/, /^(?:[^\x00]+)/, /^(?:[^\x00]{2,}?(?=(\{\{|\\\{\{|\\\\\{\{|$)))/, /^(?:\{\{\{\{(?=[^/]))/, /^(?:\{\{\{\{\/[^\s!"#%-,\.\/;->@\[-\^`\{-~]+(?=[=}\s\/.])\}\}\}\})/, /^(?:[^\x00]*?(?=(\{\{\{\{)))/, /^(?:[\s\S]*?--(~)?\}\})/, /^(?:\()/, /^(?:\))/, /^(?:\{\{\{\{)/, /^(?:\}\}\}\})/, /^(?:\{\{(~)?>)/, /^(?:\{\{(~)?#>)/, /^(?:\{\{(~)?#\*?)/, /^(?:\{\{(~)?\/)/, /^(?:\{\{(~)?\^\s*(~)?\}\})/, /^(?:\{\{(~)?\s*else\s*(~)?\}\})/, /^(?:\{\{(~)?\^)/, /^(?:\{\{(~)?\s*else\b)/, /^(?:\{\{(~)?\{)/, /^(?:\{\{(~)?&)/, /^(?:\{\{(~)?!--)/, /^(?:\{\{(~)?![\s\S]*?\}\})/, /^(?:\{\{(~)?\*?)/, /^(?:=)/, /^(?:\.\.)/, /^(?:\.(?=([=~}\s\/.)|])))/, /^(?:[\/.])/, /^(?:\s+)/, /^(?:\}(~)?\}\})/, /^(?:(~)?\}\})/, /^(?:"(\\["]|[^"])*")/, /^(?:'(\\[']|[^'])*')/, /^(?:@)/, /^(?:true(?=([~}\s)])))/, /^(?:false(?=([~}\s)])))/, /^(?:undefined(?=([~}\s)])))/, /^(?:null(?=([~}\s)])))/, /^(?:-?[0-9]+(?:\.[0-9]+)?(?=([~}\s)])))/, /^(?:as\s+\|)/, /^(?:\|)/, /^(?:([^\s!"#%-,\.\/;->@\[-\^`\{-~]+(?=([=~}\s\/.)|]))))/, /^(?:\[(\\\]|[^\]])*\])/, /^(?:.)/, /^(?:$)/]; lexer.conditions = { "mu": { "rules": [7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44], "inclusive": false }, "emu": { "rules": [2], "inclusive": false }, "com": { "rules": [6], "inclusive": false }, "raw": { "rules": [3, 4, 5], "inclusive": false }, "INITIAL": { "rules": [0, 1, 44], "inclusive": true } }; return lexer; })(); @@ -4296,13 +4299,14 @@ return /******/ (function(modules) { // webpackBootstrap setupHelper: function setupHelper(paramSize, name, blockHelper) { var params = [], paramsInit = this.setupHelperArgs(name, paramSize, params, blockHelper); - var foundHelper = this.nameLookup('helpers', name, 'helper'); + var foundHelper = this.nameLookup('helpers', name, 'helper'), + callContext = this.aliasable(this.contextName(0) + ' != null ? ' + this.contextName(0) + ' : {}'); return { params: params, paramsInit: paramsInit, name: foundHelper, - callParams: [this.contextName(0)].concat(params) + callParams: [callContext].concat(params) }; }, diff --git a/vendor/assets/javascripts/handlebars.runtime.js b/vendor/assets/javascripts/handlebars.runtime.js index cd5a6bf..95049f3 100644 --- a/vendor/assets/javascripts/handlebars.runtime.js +++ b/vendor/assets/javascripts/handlebars.runtime.js @@ -1,6 +1,6 @@ /*! - handlebars v4.0.2 + handlebars v4.0.5 Copyright (C) 2011-2015 by Yehuda Katz @@ -207,7 +207,7 @@ return /******/ (function(modules) { // webpackBootstrap var _logger2 = _interopRequireDefault(_logger); - var VERSION = '4.0.2'; + var VERSION = '4.0.5'; exports.VERSION = VERSION; var COMPILER_REVISION = 7; @@ -259,7 +259,7 @@ return /******/ (function(modules) { // webpackBootstrap _utils.extend(this.partials, name); } else { if (typeof partial === 'undefined') { - throw new _exception2['default']('Attempting to register a partial as undefined'); + throw new _exception2['default']('Attempting to register a partial called "' + name + '" as undefined'); } this.partials[name] = partial; } @@ -595,12 +595,6 @@ return /******/ (function(modules) { // webpackBootstrap } function execIteration(field, index, last) { - // Don't iterate over undefined values since we can't execute blocks against them - // in non-strict (js) mode. - if (context[field] == null) { - return; - } - if (data) { data.key = field; data.index = index; @@ -621,7 +615,9 @@ return /******/ (function(modules) { // webpackBootstrap if (context && typeof context === 'object') { if (_utils.isArray(context)) { for (var j = context.length; i < j; i++) { - execIteration(i, i, i === context.length - 1); + if (i in context) { + execIteration(i, i, i === context.length - 1); + } } } else { var priorKey = undefined; @@ -852,11 +848,14 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, /* 16 */ -/***/ function(module, exports) { +/***/ function(module, exports, __webpack_require__) { 'use strict'; exports.__esModule = true; + + var _utils = __webpack_require__(4); + var logger = { methodMap: ['debug', 'info', 'warn', 'error'], level: 'info', @@ -864,7 +863,7 @@ return /******/ (function(modules) { // webpackBootstrap // Maps a given level value to the `methodMap` indexes above. lookupLevel: function lookupLevel(level) { if (typeof level === 'string') { - var levelMap = logger.methodMap.indexOf(level.toLowerCase()); + var levelMap = _utils.indexOf(logger.methodMap, level.toLowerCase()); if (levelMap >= 0) { level = levelMap; } else { @@ -1170,6 +1169,7 @@ return /******/ (function(modules) { // webpackBootstrap var partialBlock = undefined; if (options.fn && options.fn !== noop) { + options.data = _base.createFrame(options.data); partialBlock = options.data['partial-block'] = options.fn; if (partialBlock.partials) { @@ -1227,6 +1227,7 @@ return /******/ (function(modules) { // webpackBootstrap if (root.Handlebars === Handlebars) { root.Handlebars = $Handlebars; } + return Handlebars; }; }; From b08c93c9d73f2d9a7e420084e0cc37107c942e62 Mon Sep 17 00:00:00 2001 From: Travis Grathwell Date: Wed, 23 Sep 2015 16:21:09 -0700 Subject: [PATCH 45/81] Sprockets 4 support --- handlebars_assets.gemspec | 2 +- lib/handlebars_assets.rb | 8 + lib/handlebars_assets/engine.rb | 9 +- lib/handlebars_assets/handlebars_template.rb | 85 +++++-- .../handlebars_processor_test.rb | 17 ++ .../handlebars_assets/shared/adapter_tests.rb | 199 +++++++++++++++ .../handlebars_assets/tilt_handlebars_test.rb | 228 +----------------- 7 files changed, 301 insertions(+), 247 deletions(-) create mode 100644 test/handlebars_assets/handlebars_processor_test.rb create mode 100644 test/handlebars_assets/shared/adapter_tests.rb diff --git a/handlebars_assets.gemspec b/handlebars_assets.gemspec index 1117bc1..6d5b5f9 100644 --- a/handlebars_assets.gemspec +++ b/handlebars_assets.gemspec @@ -22,7 +22,7 @@ Gem::Specification.new do |s| s.add_runtime_dependency "execjs", "~> 2.0" s.add_runtime_dependency "tilt", "~> 1.2" s.add_runtime_dependency "multi_json", "~> 1.0" - s.add_runtime_dependency "sprockets", ">= 2.0.0", "< 4.0" + s.add_runtime_dependency "sprockets", ">= 2.0.0" s.add_development_dependency "minitest", '~> 5.5' s.add_development_dependency "haml", '~> 4.0' diff --git a/lib/handlebars_assets.rb b/lib/handlebars_assets.rb index 5580e21..b95d342 100644 --- a/lib/handlebars_assets.rb +++ b/lib/handlebars_assets.rb @@ -4,6 +4,7 @@ module HandlebarsAssets autoload(:Config, 'handlebars_assets/config') autoload(:Handlebars, 'handlebars_assets/handlebars') autoload(:HandlebarsTemplate, 'handlebars_assets/handlebars_template') + autoload(:HandlebarsProcessor, 'handlebars_assets/handlebars_template') PATH = File.expand_path('../../vendor/assets/javascripts', __FILE__) @@ -31,6 +32,13 @@ def self.register_extensions(sprockets_environment) end end + def self.register_transformers(config) + config.assets.configure do |env| + env.register_mime_type 'text/x-handlebars-template', extensions: Config.handlebars_extensions + env.register_transformer 'text/x-handlebars-template', 'application/javascript', HandlebarsProcessor + end + end + def self.add_to_asset_versioning(sprockets_environment) sprockets_environment.config.version += "-#{HandlebarsAssets::VERSION}" end diff --git a/lib/handlebars_assets/engine.rb b/lib/handlebars_assets/engine.rb index 8a4be6e..80369e8 100644 --- a/lib/handlebars_assets/engine.rb +++ b/lib/handlebars_assets/engine.rb @@ -2,8 +2,13 @@ module HandlebarsAssets # NOTE: must be an engine because we are including assets in the gem class Engine < ::Rails::Engine initializer "handlebars_assets.assets.register", :group => :all do |app| - ::HandlebarsAssets::register_extensions(app.assets) - app.assets.version += "#{::HandlebarsAssets::VERSION}" + if Gem::Version.new(Sprockets::VERSION) < Gem::Version.new('4') + ::HandlebarsAssets::register_extensions(app.assets) + app.assets.version += "#{::HandlebarsAssets::VERSION}" + else + ::HandlebarsAssets::register_transformers(config) + config.assets.version += "#{::HandlebarsAssets::VERSION}" + end end end end diff --git a/lib/handlebars_assets/handlebars_template.rb b/lib/handlebars_assets/handlebars_template.rb index c0fd0bd..cea8900 100644 --- a/lib/handlebars_assets/handlebars_template.rb +++ b/lib/handlebars_assets/handlebars_template.rb @@ -12,15 +12,63 @@ def unindent(heredoc) end end + # Sprockets <= 3 class HandlebarsTemplate < Tilt::Template - - include Unindent - def self.default_mime_type 'application/javascript' end def initialize_engine + HandleHelper.initialize_engine + end + + def prepare + @template_path = HandleHelper::TemplatePath.new(@file) + @engine = helper.choose_engine(data) + end + + def evaluate(scope, locals, &block) + source = + if @engine + @engine.render(scope, locals, &block) + else + data + end + + helper.compile(source) + end + + private + + def helper + @helper ||= HandleHelper.new(path: @file) + end + end + + # Sprockets 4 + class HandlebarsProcessor + def self.call(input) + HandleHelper.initialize_engine + + hh = HandleHelper.new(path: input[:filename]) + + template_string = input[:data] + + engine = hh.choose_engine(template_string) + if engine + hh.compile(engine.render) + else + hh.compile(template_string) + end + end + end + + class HandleHelper + include Unindent + + def self.initialize_engine + return if @initialized + begin require 'haml' rescue LoadError @@ -31,28 +79,25 @@ def initialize_engine rescue LoadError # slim not available end + + @initialized = true end - def prepare - @template_path = TemplatePath.new(@file) - @engine = - if @template_path.is_haml? - Haml::Engine.new(data, HandlebarsAssets::Config.haml_options) - elsif @template_path.is_slim? - Slim::Template.new(HandlebarsAssets::Config.slim_options) { data } - else - nil - end + def initialize(options) + @template_path = TemplatePath.new(options[:path]) end - def evaluate(scope, locals, &block) - source = - if @engine - @engine.render(scope, locals, &block) - else - data - end + def choose_engine(data) + if @template_path.is_haml? + Haml::Engine.new(data, HandlebarsAssets::Config.haml_options) + elsif @template_path.is_slim? + Slim::Template.new(HandlebarsAssets::Config.slim_options) { data } + else + nil + end + end + def compile(source) # remove trailing \n on file, for some reason the directives pipeline adds this source.chomp!($/) diff --git a/test/handlebars_assets/handlebars_processor_test.rb b/test/handlebars_assets/handlebars_processor_test.rb new file mode 100644 index 0000000..c740ad5 --- /dev/null +++ b/test/handlebars_assets/handlebars_processor_test.rb @@ -0,0 +1,17 @@ +require 'test_helper' +require_relative 'shared/adapter_tests' + +module HandlebarsAssets + class HandlebarsProcessorTest < Minitest::Test + include AdapterTests + + def teardown + HandlebarsAssets::Config.reset! + HandlebarsAssets::Handlebars.reset! + end + + def render_it(scope, source) + HandlebarsAssets::HandlebarsProcessor.call(filename: scope.pathname.to_s, data: source) + end + end +end diff --git a/test/handlebars_assets/shared/adapter_tests.rb b/test/handlebars_assets/shared/adapter_tests.rb new file mode 100644 index 0000000..64f306f --- /dev/null +++ b/test/handlebars_assets/shared/adapter_tests.rb @@ -0,0 +1,199 @@ +require 'test_helper' +require 'haml' +require 'slim' + +module AdapterTests + include CompilerSupport + include SprocketsScope + + def compile_haml(source) + ::Haml::Engine.new(source, HandlebarsAssets::Config.haml_options).render + end + + def compile_slim(source) + ::Slim::Template.new(HandlebarsAssets::Config.slim_options) { source }.render + end + + def test_render + root = '/myapp/app/assets/templates' + file = 'test_render.hbs' + scope = make_scope root, file + source = "This is {{handlebars}}" + + assert_equal hbs_compiled('test_render', source), render_it(scope, source) + end + + # Sprockets does not add nested root paths (i.e. + # app/assets/javascripts/templates is rooted at app/assets/javascripts) + def test_template_misnaming + root = '/myapp/app/assets/javascripts' + file = 'templates/test_template_misnaming.hbs' + scope = make_scope root, file + source = "This is {{handlebars}}" + + assert_equal hbs_compiled('test_template_misnaming', source), render_it(scope, source) + end + + def test_path_prefix + root = '/myapp/app/assets/javascripts' + file = 'app/templates/test_path_prefix.hbs' + scope = make_scope root, file + source = "This is {{handlebars}}" + + HandlebarsAssets::Config.path_prefix = 'app/templates' + + assert_equal hbs_compiled('test_path_prefix', source), render_it(scope, source) + end + + def test_underscore_partials + root = '/myapp/app/assets/javascripts' + file1 = 'app/templates/_test_underscore.hbs' + scope1 = make_scope root, file1 + file2 = 'app/templates/some/thing/_test_underscore.hbs' + scope2 = make_scope root, file2 + source = "This is {{handlebars}}" + + HandlebarsAssets::Config.path_prefix = 'app/templates' + + assert_equal hbs_compiled_partial('_test_underscore', source), render_it(scope1, source) + + assert_equal hbs_compiled_partial('some/thing/_test_underscore', source), render_it(scope2, source) + end + + def test_chomped_underscore_partials + assert_equal HandlebarsAssets::Config.chomp_underscore_for_partials?, false + + HandlebarsAssets::Config.chomp_underscore_for_partials = true + assert_equal HandlebarsAssets::Config.chomp_underscore_for_partials?, true + + root = '/myapp/app/assets/javascripts' + file1 = 'app/templates/_test_underscore.hbs' + scope1 = make_scope root, file1 + file2 = 'app/templates/some/thing/_test_underscore.hbs' + scope2 = make_scope root, file2 + source = "This is {{handlebars}}" + + HandlebarsAssets::Config.path_prefix = 'app/templates' + + assert_equal hbs_compiled_partial('test_underscore', source), render_it(scope1, source) + + assert_equal hbs_compiled_partial('some/thing/test_underscore', source), render_it(scope2, source) + + end + + def test_without_known_helpers_opt + root = '/myapp/app/assets/templates' + file = 'test_without_known.hbs' + scope = make_scope root, file + source = "{{#with author}}By {{first_name}} {{last_name}}{{/with}}" + + assert_equal hbs_compiled('test_without_known', source), render_it(scope, source) + end + + def test_known_helpers_opt + root = '/myapp/app/assets/templates' + file = 'test_known.hbs' + scope = make_scope root, file + source = "{{#with author}}By {{first_name}} {{last_name}}{{/with}}" + + HandlebarsAssets::Config.known_helpers_only = true + + assert_equal hbs_compiled('test_known', source), render_it(scope, source) + end + + def test_with_custom_helpers + root = '/myapp/app/assets/templates' + file = 'test_custom_helper.hbs' + scope = make_scope root, file + source = "{{#custom author}}By {{first_name}} {{last_name}}{{/custom}}" + + assert_equal hbs_compiled('test_custom_helper', source), render_it(scope, source) + end + + def test_with_custom_known_helpers + root = '/myapp/app/assets/templates' + file = 'test_custom_known_helper.hbs' + scope = make_scope root, file + source = "{{#custom author}}By {{first_name}} {{last_name}}{{/custom}}" + + HandlebarsAssets::Config.known_helpers_only = true + HandlebarsAssets::Config.known_helpers = %w(custom) + + assert_equal hbs_compiled('test_custom_known_helper', source), render_it(scope, source) + end + + def test_template_namespace + root = '/myapp/app/assets/javascripts/templates' + file = 'test_template_namespace.hbs' + scope = make_scope root, file + source = "This is {{handlebars}}" + + HandlebarsAssets::Config.template_namespace = 'JST' + + assert_equal hbs_compiled('test_template_namespace', source), render_it(scope, source) + end + + def test_ember_render + root = '/myapp/app/assets/templates' + file = 'test_render.hbs' + scope = make_scope root, file + source = "This is {{handlebars}}" + + HandlebarsAssets::Config.ember = true + HandlebarsAssets::Config.multiple_frameworks = false + + expected_compiled = %{window.Ember.TEMPLATES["test_render"] = Ember.Handlebars.compile("This is {{handlebars}}");}; + assert_equal expected_compiled, render_it(scope, source) + end + + def test_multiple_frameworks_with_ember_render + root = '/myapp/app/assets/templates' + non_ember = 'test_render.hbs' + non_ember_but_with_ember = 'test_member.hbs' + ember_ext_no_hbs = 'test_render.ember' + ember_ext = 'test_render.ember.hbs' + ember_with_haml = 'test_render.ember.hamlbars' + ember_with_slim = 'test_render.ember.slimbars' + ember_ext_with_erb = 'test_render.ember.hbs.erb' + + HandlebarsAssets::Config.ember = true + HandlebarsAssets::Config.multiple_frameworks = true + + # File without ember extension should compile to default namespace + scope = make_scope root, non_ember + source = "This is {{handlebars}}" + assert_equal hbs_compiled('test_render', source), render_it(scope, source) + + # File without ember extension but with ember in it should compile to default namespace + scope = make_scope root, non_ember_but_with_ember + source = "This is {{handlebars}}" + assert_equal hbs_compiled('test_member', source), render_it(scope, source) + + # File with ember extension should compile to ember specific namespace + expected_compiled = %{window.Ember.TEMPLATES["test_render"] = Ember.Handlebars.compile("This is {{handlebars}}");}; + scope = make_scope root, ember_ext_no_hbs + assert_equal expected_compiled, render_it(scope, source) + + # File with ember and erb extension should compile to ember specific namespace + expected_compiled = %{window.Ember.TEMPLATES["test_render"] = Ember.Handlebars.compile("This is {{handlebars}}");}; + scope = make_scope root, ember_ext_with_erb + assert_equal expected_compiled, render_it(scope, source) + + # File with ember.hbs extension should compile to ember specific namespace + expected_compiled = %{window.Ember.TEMPLATES["test_render"] = Ember.Handlebars.compile("This is {{handlebars}}");}; + scope = make_scope root, ember_ext + assert_equal expected_compiled, render_it(scope, source) + + # File with ember.hamlbars extension should compile to ember specific namespace + expected_compiled = %{window.Ember.TEMPLATES["test_render"] = Ember.Handlebars.compile("

This is {{handlebars}}

");}; + scope = make_scope root, ember_with_haml + source = "%p This is {{handlebars}}" + assert_equal expected_compiled, render_it(scope, source) + + # File with ember.slimbars extension should compile to ember specific namespace + expected_compiled = %{window.Ember.TEMPLATES["test_render"] = Ember.Handlebars.compile("

This is {{handlebars}}

");}; + source = "p This is {{handlebars}}" + scope = make_scope root, ember_with_slim + assert_equal expected_compiled, render_it(scope, source) + end +end diff --git a/test/handlebars_assets/tilt_handlebars_test.rb b/test/handlebars_assets/tilt_handlebars_test.rb index 5ecb89c..b700fcf 100644 --- a/test/handlebars_assets/tilt_handlebars_test.rb +++ b/test/handlebars_assets/tilt_handlebars_test.rb @@ -1,238 +1,18 @@ require 'test_helper' -require 'haml' -require 'slim' +require_relative 'shared/adapter_tests' module HandlebarsAssets class HandlebarsTemplateTest < Minitest::Test - include CompilerSupport - include SprocketsScope + include AdapterTests def teardown HandlebarsAssets::Config.reset! HandlebarsAssets::Handlebars.reset! end - def compile_haml(source) - ::Haml::Engine.new(source, HandlebarsAssets::Config.haml_options).render - end - - def compile_slim(source) - ::Slim::Template.new(HandlebarsAssets::Config.slim_options) { source }.render - end - - def test_render - root = '/myapp/app/assets/templates' - file = 'test_render.hbs' - scope = make_scope root, file - source = "This is {{handlebars}}" - - template = HandlebarsAssets::HandlebarsTemplate.new(scope.pathname.to_s) { source } - - assert_equal hbs_compiled('test_render', source), template.render(scope, {}) - end - - # Sprockets does not add nested root paths (i.e. - # app/assets/javascripts/templates is rooted at app/assets/javascripts) - def test_template_misnaming - root = '/myapp/app/assets/javascripts' - file = 'templates/test_template_misnaming.hbs' - scope = make_scope root, file - source = "This is {{handlebars}}" - - template = HandlebarsAssets::HandlebarsTemplate.new(scope.pathname.to_s) { source } - - assert_equal hbs_compiled('test_template_misnaming', source), template.render(scope, {}) - end - - def test_path_prefix - root = '/myapp/app/assets/javascripts' - file = 'app/templates/test_path_prefix.hbs' - scope = make_scope root, file - source = "This is {{handlebars}}" - - HandlebarsAssets::Config.path_prefix = 'app/templates' - - template = HandlebarsAssets::HandlebarsTemplate.new(scope.pathname.to_s) { source } - - assert_equal hbs_compiled('test_path_prefix', source), template.render(scope, {}) - end - - def test_underscore_partials - root = '/myapp/app/assets/javascripts' - file1 = 'app/templates/_test_underscore.hbs' - scope1 = make_scope root, file1 - file2 = 'app/templates/some/thing/_test_underscore.hbs' - scope2 = make_scope root, file2 - source = "This is {{handlebars}}" - - HandlebarsAssets::Config.path_prefix = 'app/templates' - - template1 = HandlebarsAssets::HandlebarsTemplate.new(scope1.pathname.to_s) { source } - - assert_equal hbs_compiled_partial('_test_underscore', source), template1.render(scope1, {}) - - template2 = HandlebarsAssets::HandlebarsTemplate.new(scope2.pathname.to_s) { source } - - assert_equal hbs_compiled_partial('some/thing/_test_underscore', source), template2.render(scope2, {}) - end - - def test_chomped_underscore_partials - assert_equal HandlebarsAssets::Config.chomp_underscore_for_partials?, false - - HandlebarsAssets::Config.chomp_underscore_for_partials = true - assert_equal HandlebarsAssets::Config.chomp_underscore_for_partials?, true - - root = '/myapp/app/assets/javascripts' - file1 = 'app/templates/_test_underscore.hbs' - scope1 = make_scope root, file1 - file2 = 'app/templates/some/thing/_test_underscore.hbs' - scope2 = make_scope root, file2 - source = "This is {{handlebars}}" - - HandlebarsAssets::Config.path_prefix = 'app/templates' - - template1 = HandlebarsAssets::HandlebarsTemplate.new(scope1.pathname.to_s) { source } - - assert_equal hbs_compiled_partial('test_underscore', source), template1.render(scope1, {}) - - template2 = HandlebarsAssets::HandlebarsTemplate.new(scope2.pathname.to_s) { source } - - assert_equal hbs_compiled_partial('some/thing/test_underscore', source), template2.render(scope2, {}) - - end - - def test_without_known_helpers_opt - root = '/myapp/app/assets/templates' - file = 'test_without_known.hbs' - scope = make_scope root, file - source = "{{#with author}}By {{first_name}} {{last_name}}{{/with}}" - - template = HandlebarsAssets::HandlebarsTemplate.new(scope.pathname.to_s) { source } - - assert_equal hbs_compiled('test_without_known', source), template.render(scope, {}) - end - - def test_known_helpers_opt - root = '/myapp/app/assets/templates' - file = 'test_known.hbs' - scope = make_scope root, file - source = "{{#with author}}By {{first_name}} {{last_name}}{{/with}}" - - HandlebarsAssets::Config.known_helpers_only = true - + def render_it(scope, source) template = HandlebarsAssets::HandlebarsTemplate.new(scope.pathname.to_s) { source } - - assert_equal hbs_compiled('test_known', source), template.render(scope, {}) - end - - def test_with_custom_helpers - root = '/myapp/app/assets/templates' - file = 'test_custom_helper.hbs' - scope = make_scope root, file - source = "{{#custom author}}By {{first_name}} {{last_name}}{{/custom}}" - - template = HandlebarsAssets::HandlebarsTemplate.new(scope.pathname.to_s) { source } - - assert_equal hbs_compiled('test_custom_helper', source), template.render(scope, {}) - end - - def test_with_custom_known_helpers - root = '/myapp/app/assets/templates' - file = 'test_custom_known_helper.hbs' - scope = make_scope root, file - source = "{{#custom author}}By {{first_name}} {{last_name}}{{/custom}}" - - HandlebarsAssets::Config.known_helpers_only = true - HandlebarsAssets::Config.known_helpers = %w(custom) - - template = HandlebarsAssets::HandlebarsTemplate.new(scope.pathname.to_s) { source } - - assert_equal hbs_compiled('test_custom_known_helper', source), template.render(scope, {}) - end - - def test_template_namespace - root = '/myapp/app/assets/javascripts/templates' - file = 'test_template_namespace.hbs' - scope = make_scope root, file - source = "This is {{handlebars}}" - - HandlebarsAssets::Config.template_namespace = 'JST' - - template = HandlebarsAssets::HandlebarsTemplate.new(scope.pathname.to_s) { source } - - assert_equal hbs_compiled('test_template_namespace', source), template.render(scope, {}) - end - - def test_ember_render - root = '/myapp/app/assets/templates' - file = 'test_render.hbs' - scope = make_scope root, file - source = "This is {{handlebars}}" - - HandlebarsAssets::Config.ember = true - HandlebarsAssets::Config.multiple_frameworks = false - template = HandlebarsAssets::HandlebarsTemplate.new(scope.pathname.to_s) { source } - - expected_compiled = %{window.Ember.TEMPLATES["test_render"] = Ember.Handlebars.compile("This is {{handlebars}}");}; - assert_equal expected_compiled, template.render(scope, {}) - end - - def test_multiple_frameworks_with_ember_render - root = '/myapp/app/assets/templates' - non_ember = 'test_render.hbs' - non_ember_but_with_ember = 'test_member.hbs' - ember_ext_no_hbs = 'test_render.ember' - ember_ext = 'test_render.ember.hbs' - ember_with_haml = 'test_render.ember.hamlbars' - ember_with_slim = 'test_render.ember.slimbars' - ember_ext_with_erb = 'test_render.ember.hbs.erb' - - HandlebarsAssets::Config.ember = true - HandlebarsAssets::Config.multiple_frameworks = true - - # File without ember extension should compile to default namespace - scope = make_scope root, non_ember - source = "This is {{handlebars}}" - template = HandlebarsAssets::HandlebarsTemplate.new(scope.pathname.to_s) { source } - assert_equal hbs_compiled('test_render', source), template.render(scope, {}) - - # File without ember extension but with ember in it should compile to default namespace - scope = make_scope root, non_ember_but_with_ember - source = "This is {{handlebars}}" - template = HandlebarsAssets::HandlebarsTemplate.new(scope.pathname.to_s) { source } - assert_equal hbs_compiled('test_member', source), template.render(scope, {}) - - # File with ember extension should compile to ember specific namespace - expected_compiled = %{window.Ember.TEMPLATES["test_render"] = Ember.Handlebars.compile("This is {{handlebars}}");}; - scope = make_scope root, ember_ext_no_hbs - template = HandlebarsAssets::HandlebarsTemplate.new(scope.pathname.to_s) { source } - assert_equal expected_compiled, template.render(scope, {}) - - # File with ember and erb extension should compile to ember specific namespace - expected_compiled = %{window.Ember.TEMPLATES["test_render"] = Ember.Handlebars.compile("This is {{handlebars}}");}; - scope = make_scope root, ember_ext_with_erb - template = HandlebarsAssets::HandlebarsTemplate.new(scope.pathname.to_s) { source } - assert_equal expected_compiled, template.render(scope, {}) - - # File with ember.hbs extension should compile to ember specific namespace - expected_compiled = %{window.Ember.TEMPLATES["test_render"] = Ember.Handlebars.compile("This is {{handlebars}}");}; - scope = make_scope root, ember_ext - template = HandlebarsAssets::HandlebarsTemplate.new(scope.pathname.to_s) { source } - assert_equal expected_compiled, template.render(scope, {}) - - # File with ember.hamlbars extension should compile to ember specific namespace - expected_compiled = %{window.Ember.TEMPLATES["test_render"] = Ember.Handlebars.compile("

This is {{handlebars}}

");}; - scope = make_scope root, ember_with_haml - source = "%p This is {{handlebars}}" - template = HandlebarsAssets::HandlebarsTemplate.new(scope.pathname.to_s) { compile_haml(source) } - assert_equal expected_compiled, template.render(scope, {}) - - # File with ember.slimbars extension should compile to ember specific namespace - expected_compiled = %{window.Ember.TEMPLATES["test_render"] = Ember.Handlebars.compile("

This is {{handlebars}}

");}; - source = "p This is {{handlebars}}" - scope = make_scope root, ember_with_slim - template = HandlebarsAssets::HandlebarsTemplate.new(scope.pathname.to_s) { compile_slim(source) } - assert_equal expected_compiled, template.render(scope, {}) + template.render(scope, {}) end end end From 5dc1fbe5f1cb779d580025cbe49f1ae36c65c234 Mon Sep 17 00:00:00 2001 From: Alex Riedler Date: Sat, 19 Dec 2015 19:16:44 -0500 Subject: [PATCH 46/81] Add Apprails for testing multiple versions. --- .gitignore | 1 + Appraisals | 11 +++++++++++ Rakefile | 4 +++- gemfiles/rails_4_1.gemfile | 7 +++++++ gemfiles/rails_4_2.gemfile | 7 +++++++ gemfiles/rails_5.gemfile | 7 +++++++ handlebars_assets.gemspec | 3 ++- 7 files changed, 38 insertions(+), 2 deletions(-) create mode 100644 Appraisals create mode 100644 gemfiles/rails_4_1.gemfile create mode 100644 gemfiles/rails_4_2.gemfile create mode 100644 gemfiles/rails_5.gemfile diff --git a/.gitignore b/.gitignore index 91e2b6a..e9f6489 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ .bundle pkg/* Gemfile.lock +gemfiles/*.lock diff --git a/Appraisals b/Appraisals new file mode 100644 index 0000000..60cb415 --- /dev/null +++ b/Appraisals @@ -0,0 +1,11 @@ +appraise "rails-5" do + gem "rails", "5.0.0.beta1" +end + +appraise "rails-4-2" do + gem "rails", "4.2.5" +end + +appraise "rails-4-1" do + gem "rails", "4.1.14" +end diff --git a/Rakefile b/Rakefile index 15940a3..f77e199 100644 --- a/Rakefile +++ b/Rakefile @@ -1,5 +1,7 @@ +require "rubygems" +require "bundler/setup" require "bundler/gem_tasks" -require 'rake/testtask' +require "rake/testtask" Rake::TestTask.new do |t| t.libs << 'test' diff --git a/gemfiles/rails_4_1.gemfile b/gemfiles/rails_4_1.gemfile new file mode 100644 index 0000000..1cb9248 --- /dev/null +++ b/gemfiles/rails_4_1.gemfile @@ -0,0 +1,7 @@ +# This file was generated by Appraisal + +source "http://rubygems.org" + +gem "rails", "4.1.14" + +gemspec :path => "../" diff --git a/gemfiles/rails_4_2.gemfile b/gemfiles/rails_4_2.gemfile new file mode 100644 index 0000000..b0f199e --- /dev/null +++ b/gemfiles/rails_4_2.gemfile @@ -0,0 +1,7 @@ +# This file was generated by Appraisal + +source "http://rubygems.org" + +gem "rails", "4.2.5" + +gemspec :path => "../" diff --git a/gemfiles/rails_5.gemfile b/gemfiles/rails_5.gemfile new file mode 100644 index 0000000..42f1c4b --- /dev/null +++ b/gemfiles/rails_5.gemfile @@ -0,0 +1,7 @@ +# This file was generated by Appraisal + +source "http://rubygems.org" + +gem "rails", "5.0.0.beta1" + +gemspec :path => "../" diff --git a/handlebars_assets.gemspec b/handlebars_assets.gemspec index 6d5b5f9..468789c 100644 --- a/handlebars_assets.gemspec +++ b/handlebars_assets.gemspec @@ -28,7 +28,8 @@ Gem::Specification.new do |s| s.add_development_dependency "haml", '~> 4.0' s.add_development_dependency "rake", '~> 10.0' s.add_development_dependency "slim", '~> 3.0' - s.add_development_dependency 'json', '~> 1.7' + s.add_development_dependency "json", '~> 1.7' + s.add_development_dependency "appraisal" s.post_install_message = "Remember to rake assets:clean or rake assets:purge on update! this is required because of handlebars updates" end From b5df9193385b1cc1ce5161d6308ddacf77b3cd68 Mon Sep 17 00:00:00 2001 From: Alex Riedler Date: Sat, 19 Dec 2015 19:27:30 -0500 Subject: [PATCH 47/81] Get some multi-testing going on with tilt+sprockets versions. --- Appraisals | 16 ++++++++++------ gemfiles/rails_4_1.gemfile | 1 + gemfiles/rails_4_2.gemfile | 1 + gemfiles/rails_5.gemfile | 1 + gemfiles/sprockets_2.gemfile | 7 +++++++ gemfiles/sprockets_3.gemfile | 7 +++++++ gemfiles/tilt_1.gemfile | 7 +++++++ gemfiles/tilt_2.gemfile | 7 +++++++ handlebars_assets.gemspec | 2 +- 9 files changed, 42 insertions(+), 7 deletions(-) create mode 100644 gemfiles/sprockets_2.gemfile create mode 100644 gemfiles/sprockets_3.gemfile create mode 100644 gemfiles/tilt_1.gemfile create mode 100644 gemfiles/tilt_2.gemfile diff --git a/Appraisals b/Appraisals index 60cb415..f7fc564 100644 --- a/Appraisals +++ b/Appraisals @@ -1,11 +1,15 @@ -appraise "rails-5" do - gem "rails", "5.0.0.beta1" +appraise "sprockets-3" do + gem "sprockets", "3.0.0" end -appraise "rails-4-2" do - gem "rails", "4.2.5" +appraise "sprockets-2" do + gem "sprockets", "2.3.3" end -appraise "rails-4-1" do - gem "rails", "4.1.14" +appraise "tilt-2" do + gem "tilt", "2.0.1" +end + +appraise "tilt-1" do + gem "tilt", "1.4.1" end diff --git a/gemfiles/rails_4_1.gemfile b/gemfiles/rails_4_1.gemfile index 1cb9248..3a96594 100644 --- a/gemfiles/rails_4_1.gemfile +++ b/gemfiles/rails_4_1.gemfile @@ -3,5 +3,6 @@ source "http://rubygems.org" gem "rails", "4.1.14" +gem "rails-sprockets", "2.3.3" gemspec :path => "../" diff --git a/gemfiles/rails_4_2.gemfile b/gemfiles/rails_4_2.gemfile index b0f199e..cc2618d 100644 --- a/gemfiles/rails_4_2.gemfile +++ b/gemfiles/rails_4_2.gemfile @@ -3,5 +3,6 @@ source "http://rubygems.org" gem "rails", "4.2.5" +gem "rails-sprockets", "2.3.3" gemspec :path => "../" diff --git a/gemfiles/rails_5.gemfile b/gemfiles/rails_5.gemfile index 42f1c4b..8285f70 100644 --- a/gemfiles/rails_5.gemfile +++ b/gemfiles/rails_5.gemfile @@ -3,5 +3,6 @@ source "http://rubygems.org" gem "rails", "5.0.0.beta1" +gem "rails-sprockets", "3.0.0" gemspec :path => "../" diff --git a/gemfiles/sprockets_2.gemfile b/gemfiles/sprockets_2.gemfile new file mode 100644 index 0000000..e0f5788 --- /dev/null +++ b/gemfiles/sprockets_2.gemfile @@ -0,0 +1,7 @@ +# This file was generated by Appraisal + +source "http://rubygems.org" + +gem "sprockets", "2.3.3" + +gemspec :path => "../" diff --git a/gemfiles/sprockets_3.gemfile b/gemfiles/sprockets_3.gemfile new file mode 100644 index 0000000..52b0e11 --- /dev/null +++ b/gemfiles/sprockets_3.gemfile @@ -0,0 +1,7 @@ +# This file was generated by Appraisal + +source "http://rubygems.org" + +gem "sprockets", "3.0.0" + +gemspec :path => "../" diff --git a/gemfiles/tilt_1.gemfile b/gemfiles/tilt_1.gemfile new file mode 100644 index 0000000..2236fe6 --- /dev/null +++ b/gemfiles/tilt_1.gemfile @@ -0,0 +1,7 @@ +# This file was generated by Appraisal + +source "http://rubygems.org" + +gem "tilt", "1.4.1" + +gemspec :path => "../" diff --git a/gemfiles/tilt_2.gemfile b/gemfiles/tilt_2.gemfile new file mode 100644 index 0000000..8af0eca --- /dev/null +++ b/gemfiles/tilt_2.gemfile @@ -0,0 +1,7 @@ +# This file was generated by Appraisal + +source "http://rubygems.org" + +gem "tilt", "2.0.1" + +gemspec :path => "../" diff --git a/handlebars_assets.gemspec b/handlebars_assets.gemspec index 468789c..b3f3647 100644 --- a/handlebars_assets.gemspec +++ b/handlebars_assets.gemspec @@ -20,7 +20,7 @@ Gem::Specification.new do |s| s.require_paths = ["lib"] s.add_runtime_dependency "execjs", "~> 2.0" - s.add_runtime_dependency "tilt", "~> 1.2" + s.add_runtime_dependency "tilt", ">= 1.2" s.add_runtime_dependency "multi_json", "~> 1.0" s.add_runtime_dependency "sprockets", ">= 2.0.0" From 6abfbfae21286006008aa68297ad7c0108a61dd2 Mon Sep 17 00:00:00 2001 From: Alex Riedler Date: Sat, 19 Dec 2015 21:07:02 -0500 Subject: [PATCH 48/81] Cleanup for next release, fix issues with Sprockets 3.x, slimbars + hamlbars for Sprockets 3.x --- lib/handlebars_assets.rb | 19 +++--- lib/handlebars_assets/engine.rb | 9 +-- lib/handlebars_assets/handlebars_template.rb | 62 ++++++++++++-------- 3 files changed, 52 insertions(+), 38 deletions(-) diff --git a/lib/handlebars_assets.rb b/lib/handlebars_assets.rb index b95d342..2177dae 100644 --- a/lib/handlebars_assets.rb +++ b/lib/handlebars_assets.rb @@ -17,6 +17,7 @@ def self.configure end def self.register_extensions(sprockets_environment) + if Gem::Version.new(Sprockets::VERSION) < Gem::Version.new('3') Config.handlebars_extensions.each do |ext| sprockets_environment.register_engine(ext, HandlebarsTemplate) end @@ -30,19 +31,21 @@ def self.register_extensions(sprockets_environment) sprockets_environment.register_engine(ext, HandlebarsTemplate) end end - end - - def self.register_transformers(config) - config.assets.configure do |env| - env.register_mime_type 'text/x-handlebars-template', extensions: Config.handlebars_extensions - env.register_transformer 'text/x-handlebars-template', 'application/javascript', HandlebarsProcessor + else + sprockets_environment.register_mime_type 'text/x-handlebars-template', extensions: Config.handlebars_extensions + if Config.slim_enabled? && Config.slim_available? + sprockets_environment.register_mime_type 'text/x-handlebars-template', extensions: Config.slimbars_extensions + end + if Config.haml_enabled? && Config.haml_available? + sprockets_environment.register_mime_type 'text/x-handlebars-template', extensions: Config.hamlbars_extensions + end + sprockets_environment.register_transformer 'text/x-handlebars-template', 'application/javascript', HandlebarsProcessor end end def self.add_to_asset_versioning(sprockets_environment) - sprockets_environment.config.version += "-#{HandlebarsAssets::VERSION}" + sprockets_environment.version += "-#{HandlebarsAssets::VERSION}" end - end # Register the engine (which will register extension in the app) diff --git a/lib/handlebars_assets/engine.rb b/lib/handlebars_assets/engine.rb index 80369e8..9db845e 100644 --- a/lib/handlebars_assets/engine.rb +++ b/lib/handlebars_assets/engine.rb @@ -2,12 +2,9 @@ module HandlebarsAssets # NOTE: must be an engine because we are including assets in the gem class Engine < ::Rails::Engine initializer "handlebars_assets.assets.register", :group => :all do |app| - if Gem::Version.new(Sprockets::VERSION) < Gem::Version.new('4') - ::HandlebarsAssets::register_extensions(app.assets) - app.assets.version += "#{::HandlebarsAssets::VERSION}" - else - ::HandlebarsAssets::register_transformers(config) - config.assets.version += "#{::HandlebarsAssets::VERSION}" + ::HandlebarsAssets::register_extensions(app.assets) + if Gem::Version.new(Sprockets::VERSION) < Gem::Version.new('3') + ::HandlebarsAssets::add_to_asset_versioning(app.assets) end end end diff --git a/lib/handlebars_assets/handlebars_template.rb b/lib/handlebars_assets/handlebars_template.rb index cea8900..17f2e83 100644 --- a/lib/handlebars_assets/handlebars_template.rb +++ b/lib/handlebars_assets/handlebars_template.rb @@ -19,51 +19,64 @@ def self.default_mime_type end def initialize_engine - HandleHelper.initialize_engine + HandlebarsRenderer.initialize_engine end def prepare - @template_path = HandleHelper::TemplatePath.new(@file) - @engine = helper.choose_engine(data) + @engine = renderer.choose_engine(data) end def evaluate(scope, locals, &block) - source = - if @engine - @engine.render(scope, locals, &block) - else - data - end - - helper.compile(source) + source = @engine.render(scope, locals, &block) + renderer.compile(source) end private - def helper - @helper ||= HandleHelper.new(path: @file) + def renderer + @renderer ||= HandlebarsRenderer.new(path: @file) end end # Sprockets 4 class HandlebarsProcessor + + def self.instance + @instance ||= new + end + def self.call(input) - HandleHelper.initialize_engine + instance.call(input) + end - hh = HandleHelper.new(path: input[:filename]) + def self.cache_key + instance.cache_key + end - template_string = input[:data] + attr_reader :cache_key - engine = hh.choose_engine(template_string) - if engine - hh.compile(engine.render) - else - hh.compile(template_string) - end + def initialize(options = {}) + @cache_key = [self.class.name, ::HandlebarsAssets::VERSION, options].freeze + end + + def call(input) + renderer = HandlebarsRenderer.new(path: input[:filename]) + engine = renderer.choose_engine(input[:data]) + renderer.compile(engine.render) + end + end + + class NoOpEngine + def initialize(data) + @data = data + end + + def render(*args) + @data end end - class HandleHelper + class HandlebarsRenderer include Unindent def self.initialize_engine @@ -84,6 +97,7 @@ def self.initialize_engine end def initialize(options) + self.class.initialize_engine @template_path = TemplatePath.new(options[:path]) end @@ -93,7 +107,7 @@ def choose_engine(data) elsif @template_path.is_slim? Slim::Template.new(HandlebarsAssets::Config.slim_options) { data } else - nil + NoOpEngine.new(data) end end From f7174150c99062608dba8f71a4d16e6bf8a5186f Mon Sep 17 00:00:00 2001 From: Alex Riedler Date: Sat, 19 Dec 2015 21:16:14 -0500 Subject: [PATCH 49/81] Handle when asset compilation is off in rails. --- lib/handlebars_assets/engine.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/handlebars_assets/engine.rb b/lib/handlebars_assets/engine.rb index 9db845e..fddda26 100644 --- a/lib/handlebars_assets/engine.rb +++ b/lib/handlebars_assets/engine.rb @@ -2,9 +2,10 @@ module HandlebarsAssets # NOTE: must be an engine because we are including assets in the gem class Engine < ::Rails::Engine initializer "handlebars_assets.assets.register", :group => :all do |app| - ::HandlebarsAssets::register_extensions(app.assets) + sprockets_env = app.assets || Sprockets + ::HandlebarsAssets::register_extensions(sprockets_env) if Gem::Version.new(Sprockets::VERSION) < Gem::Version.new('3') - ::HandlebarsAssets::add_to_asset_versioning(app.assets) + ::HandlebarsAssets::add_to_asset_versioning(sprockets_env) end end end From a5791642cc8821be7e8bfb917f46c27c2a560d83 Mon Sep 17 00:00:00 2001 From: Alex Riedler Date: Sat, 19 Dec 2015 21:39:23 -0500 Subject: [PATCH 50/81] Only load if asset compilation is enabled. --- lib/handlebars_assets/engine.rb | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/handlebars_assets/engine.rb b/lib/handlebars_assets/engine.rb index fddda26..e1f8fa0 100644 --- a/lib/handlebars_assets/engine.rb +++ b/lib/handlebars_assets/engine.rb @@ -2,10 +2,11 @@ module HandlebarsAssets # NOTE: must be an engine because we are including assets in the gem class Engine < ::Rails::Engine initializer "handlebars_assets.assets.register", :group => :all do |app| - sprockets_env = app.assets || Sprockets - ::HandlebarsAssets::register_extensions(sprockets_env) - if Gem::Version.new(Sprockets::VERSION) < Gem::Version.new('3') - ::HandlebarsAssets::add_to_asset_versioning(sprockets_env) + config.assets.configure do |sprockets_env| + ::HandlebarsAssets::register_extensions(sprockets_env) + if Gem::Version.new(Sprockets::VERSION) < Gem::Version.new('3') + ::HandlebarsAssets::add_to_asset_versioning(sprockets_env) + end end end end From fd29451ad539e41fcacf4584db734aa0fbb46ffb Mon Sep 17 00:00:00 2001 From: Dimitris Zorbas Date: Tue, 22 Dec 2015 18:32:24 +0200 Subject: [PATCH 51/81] Fix Railties typo in gemspec --- handlebars_assets.gemspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/handlebars_assets.gemspec b/handlebars_assets.gemspec index b3f3647..3b63f27 100644 --- a/handlebars_assets.gemspec +++ b/handlebars_assets.gemspec @@ -10,7 +10,7 @@ Gem::Specification.new do |s| s.email = ["leshill@gmail.com"] s.homepage = "https://github.com/leshill/handlebars_assets" s.summary = "Compile Handlebars templates in the Rails asset pipeline." - s.description = "A Railities Gem to compile hbs assets" + s.description = "A Railties Gem to compile hbs assets" s.rubyforge_project = "handlebars_assets" From 20010567d066dfa5d39d339630d65200cf0e2ecf Mon Sep 17 00:00:00 2001 From: Alex Riedler Date: Tue, 26 Jan 2016 10:40:36 -0500 Subject: [PATCH 52/81] Release v0.23.0 --- lib/handlebars_assets/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/handlebars_assets/version.rb b/lib/handlebars_assets/version.rb index 424c8af..3d0bee7 100644 --- a/lib/handlebars_assets/version.rb +++ b/lib/handlebars_assets/version.rb @@ -1,3 +1,3 @@ module HandlebarsAssets - VERSION = "0.22.0" + VERSION = "0.23.0" end From f7779a4e1e39e39bd472a17da96b3f0f6c4fbad7 Mon Sep 17 00:00:00 2001 From: Alex Riedler Date: Tue, 26 Jan 2016 21:04:16 -0500 Subject: [PATCH 53/81] Update CHANGELOG.md for v0.23.0 --- CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index daf8deb..b81881b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +## 0.23.0 (2016-01-26) + +* Fixes for Railties and certain versions of Rails +* Only load if asset compilation is enabled +* Add support for Sprockets 3.x + 4.x - @tjgrathwell + ## 0.22.0 (2015-11-23) * Update Handlebars to v4.0.5 From 70a738c2011ff793a78980dec4cc180ac2cdad3c Mon Sep 17 00:00:00 2001 From: Michael Lawlor Date: Thu, 21 Apr 2016 16:50:37 -0700 Subject: [PATCH 54/81] Fixes a bug that was preventing Rails app startup Error was: ``` 'method_missing': undefined method `assets' for # (NoMethodError) from handlebars_assets/lib/handlebars_assets/engine.rb:5:in 'block in ' ``` --- lib/handlebars_assets/engine.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/handlebars_assets/engine.rb b/lib/handlebars_assets/engine.rb index e1f8fa0..0d175a0 100644 --- a/lib/handlebars_assets/engine.rb +++ b/lib/handlebars_assets/engine.rb @@ -2,7 +2,7 @@ module HandlebarsAssets # NOTE: must be an engine because we are including assets in the gem class Engine < ::Rails::Engine initializer "handlebars_assets.assets.register", :group => :all do |app| - config.assets.configure do |sprockets_env| + app.config.assets.configure do |sprockets_env| ::HandlebarsAssets::register_extensions(sprockets_env) if Gem::Version.new(Sprockets::VERSION) < Gem::Version.new('3') ::HandlebarsAssets::add_to_asset_versioning(sprockets_env) From a76c885ca0a921474e7d45c1d6b83f3a0592bbf3 Mon Sep 17 00:00:00 2001 From: Alex Riedler Date: Thu, 4 Aug 2016 18:32:45 -0400 Subject: [PATCH 55/81] Release 0.23.1 --- CHANGELOG.md | 4 ++++ lib/handlebars_assets/version.rb | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b81881b..46960dc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.23.1 (2016-08-04) + +* Fixes for Issue on Boot with Rails 3 and 4 + ## 0.23.0 (2016-01-26) * Fixes for Railties and certain versions of Rails diff --git a/lib/handlebars_assets/version.rb b/lib/handlebars_assets/version.rb index 3d0bee7..65b37de 100644 --- a/lib/handlebars_assets/version.rb +++ b/lib/handlebars_assets/version.rb @@ -1,3 +1,3 @@ module HandlebarsAssets - VERSION = "0.23.0" + VERSION = "0.23.1" end From 7a92daa0464a186bb79da2bb20de917f853c4595 Mon Sep 17 00:00:00 2001 From: John Hawthorn Date: Sun, 7 May 2017 14:47:42 -0700 Subject: [PATCH 56/81] Remove dependency on json, multi_json JSON is built in to ruby since 1.9, and multi_json isn't used. --- handlebars_assets.gemspec | 2 -- 1 file changed, 2 deletions(-) diff --git a/handlebars_assets.gemspec b/handlebars_assets.gemspec index 3b63f27..2b51658 100644 --- a/handlebars_assets.gemspec +++ b/handlebars_assets.gemspec @@ -21,14 +21,12 @@ Gem::Specification.new do |s| s.add_runtime_dependency "execjs", "~> 2.0" s.add_runtime_dependency "tilt", ">= 1.2" - s.add_runtime_dependency "multi_json", "~> 1.0" s.add_runtime_dependency "sprockets", ">= 2.0.0" s.add_development_dependency "minitest", '~> 5.5' s.add_development_dependency "haml", '~> 4.0' s.add_development_dependency "rake", '~> 10.0' s.add_development_dependency "slim", '~> 3.0' - s.add_development_dependency "json", '~> 1.7' s.add_development_dependency "appraisal" s.post_install_message = "Remember to rake assets:clean or rake assets:purge on update! this is required because of handlebars updates" From fb0733064166500380fa4f5c2cfd230e5b281cdd Mon Sep 17 00:00:00 2001 From: Alex Riedler Date: Sun, 7 May 2017 22:19:53 -0400 Subject: [PATCH 57/81] Bump to 0.23.2 --- lib/handlebars_assets/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/handlebars_assets/version.rb b/lib/handlebars_assets/version.rb index 65b37de..68953c4 100644 --- a/lib/handlebars_assets/version.rb +++ b/lib/handlebars_assets/version.rb @@ -1,3 +1,3 @@ module HandlebarsAssets - VERSION = "0.23.1" + VERSION = "0.23.2" end From a171d6cd684aec43a492afc3f24548225689bbac Mon Sep 17 00:00:00 2001 From: Alex Riedler Date: Sun, 7 May 2017 23:02:43 -0400 Subject: [PATCH 58/81] Update Changelog for v0.23.2. --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 46960dc..e000254 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.23.2 (2017-05-07) + +* Remove requirement for MultiJSON + ## 0.23.1 (2016-08-04) * Fixes for Issue on Boot with Rails 3 and 4 From d826c61fd9d54b63afb4478996e2c5e3d92b72df Mon Sep 17 00:00:00 2001 From: Lutz Lengemann Date: Thu, 14 Feb 2019 09:51:07 +0100 Subject: [PATCH 59/81] Update Handlebars to v4.1.0 There is a security warning with any version <4.0.13 https://www.npmjs.com/advisories/755 --- vendor/assets/javascripts/handlebars.js | 412 ++++++++++++++---- .../assets/javascripts/handlebars.runtime.js | 321 ++++++++++++-- 2 files changed, 595 insertions(+), 138 deletions(-) diff --git a/vendor/assets/javascripts/handlebars.js b/vendor/assets/javascripts/handlebars.js index 289ae45..b0b8cdc 100644 --- a/vendor/assets/javascripts/handlebars.js +++ b/vendor/assets/javascripts/handlebars.js @@ -1,8 +1,8 @@ -/*! +/**! - handlebars v4.0.5 + handlebars v4.1.0 -Copyright (C) 2011-2015 by Yehuda Katz +Copyright (C) 2011-2017 by Yehuda Katz Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal @@ -22,7 +22,6 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -@license */ (function webpackUniversalModuleDefinition(root, factory) { if(typeof exports === 'object' && typeof module === 'object') @@ -92,23 +91,23 @@ return /******/ (function(modules) { // webpackBootstrap // Compiler imports - var _handlebarsCompilerAst = __webpack_require__(21); + var _handlebarsCompilerAst = __webpack_require__(35); var _handlebarsCompilerAst2 = _interopRequireDefault(_handlebarsCompilerAst); - var _handlebarsCompilerBase = __webpack_require__(22); + var _handlebarsCompilerBase = __webpack_require__(36); - var _handlebarsCompilerCompiler = __webpack_require__(27); + var _handlebarsCompilerCompiler = __webpack_require__(41); - var _handlebarsCompilerJavascriptCompiler = __webpack_require__(28); + var _handlebarsCompilerJavascriptCompiler = __webpack_require__(42); var _handlebarsCompilerJavascriptCompiler2 = _interopRequireDefault(_handlebarsCompilerJavascriptCompiler); - var _handlebarsCompilerVisitor = __webpack_require__(25); + var _handlebarsCompilerVisitor = __webpack_require__(39); var _handlebarsCompilerVisitor2 = _interopRequireDefault(_handlebarsCompilerVisitor); - var _handlebarsNoConflict = __webpack_require__(20); + var _handlebarsNoConflict = __webpack_require__(34); var _handlebarsNoConflict2 = _interopRequireDefault(_handlebarsNoConflict); @@ -177,7 +176,7 @@ return /******/ (function(modules) { // webpackBootstrap // Each of these augment the Handlebars object. No need to setup here. // (This is done to easily share code between commonjs and browse envs) - var _handlebarsSafeString = __webpack_require__(18); + var _handlebarsSafeString = __webpack_require__(21); var _handlebarsSafeString2 = _interopRequireDefault(_handlebarsSafeString); @@ -189,11 +188,11 @@ return /******/ (function(modules) { // webpackBootstrap var Utils = _interopRequireWildcard(_handlebarsUtils); - var _handlebarsRuntime = __webpack_require__(19); + var _handlebarsRuntime = __webpack_require__(22); var runtime = _interopRequireWildcard(_handlebarsRuntime); - var _handlebarsNoConflict = __webpack_require__(20); + var _handlebarsNoConflict = __webpack_require__(34); var _handlebarsNoConflict2 = _interopRequireDefault(_handlebarsNoConflict); @@ -267,15 +266,15 @@ return /******/ (function(modules) { // webpackBootstrap var _exception2 = _interopRequireDefault(_exception); - var _helpers = __webpack_require__(7); + var _helpers = __webpack_require__(10); - var _decorators = __webpack_require__(15); + var _decorators = __webpack_require__(18); - var _logger = __webpack_require__(17); + var _logger = __webpack_require__(20); var _logger2 = _interopRequireDefault(_logger); - var VERSION = '4.0.5'; + var VERSION = '4.1.0'; exports.VERSION = VERSION; var COMPILER_REVISION = 7; @@ -487,10 +486,12 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, /* 6 */ -/***/ function(module, exports) { +/***/ function(module, exports, __webpack_require__) { 'use strict'; + var _Object$defineProperty = __webpack_require__(7)['default']; + exports.__esModule = true; var errorProps = ['description', 'fileName', 'lineNumber', 'message', 'name', 'number', 'stack']; @@ -518,9 +519,23 @@ return /******/ (function(modules) { // webpackBootstrap Error.captureStackTrace(this, Exception); } - if (loc) { - this.lineNumber = line; - this.column = column; + try { + if (loc) { + this.lineNumber = line; + + // Work around issue under safari where we can't directly set the column value + /* istanbul ignore next */ + if (_Object$defineProperty) { + Object.defineProperty(this, 'column', { + value: column, + enumerable: true + }); + } else { + this.column = column; + } + } + } catch (nop) { + /* Ignore if the browser is very particular */ } } @@ -531,6 +546,39 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, /* 7 */ +/***/ function(module, exports, __webpack_require__) { + + module.exports = { "default": __webpack_require__(8), __esModule: true }; + +/***/ }, +/* 8 */ +/***/ function(module, exports, __webpack_require__) { + + var $ = __webpack_require__(9); + module.exports = function defineProperty(it, key, desc){ + return $.setDesc(it, key, desc); + }; + +/***/ }, +/* 9 */ +/***/ function(module, exports) { + + var $Object = Object; + module.exports = { + create: $Object.create, + getProto: $Object.getPrototypeOf, + isEnum: {}.propertyIsEnumerable, + getDesc: $Object.getOwnPropertyDescriptor, + setDesc: $Object.defineProperty, + setDescs: $Object.defineProperties, + getKeys: $Object.keys, + getNames: $Object.getOwnPropertyNames, + getSymbols: $Object.getOwnPropertySymbols, + each: [].forEach + }; + +/***/ }, +/* 10 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; @@ -540,31 +588,31 @@ return /******/ (function(modules) { // webpackBootstrap exports.__esModule = true; exports.registerDefaultHelpers = registerDefaultHelpers; - var _helpersBlockHelperMissing = __webpack_require__(8); + var _helpersBlockHelperMissing = __webpack_require__(11); var _helpersBlockHelperMissing2 = _interopRequireDefault(_helpersBlockHelperMissing); - var _helpersEach = __webpack_require__(9); + var _helpersEach = __webpack_require__(12); var _helpersEach2 = _interopRequireDefault(_helpersEach); - var _helpersHelperMissing = __webpack_require__(10); + var _helpersHelperMissing = __webpack_require__(13); var _helpersHelperMissing2 = _interopRequireDefault(_helpersHelperMissing); - var _helpersIf = __webpack_require__(11); + var _helpersIf = __webpack_require__(14); var _helpersIf2 = _interopRequireDefault(_helpersIf); - var _helpersLog = __webpack_require__(12); + var _helpersLog = __webpack_require__(15); var _helpersLog2 = _interopRequireDefault(_helpersLog); - var _helpersLookup = __webpack_require__(13); + var _helpersLookup = __webpack_require__(16); var _helpersLookup2 = _interopRequireDefault(_helpersLookup); - var _helpersWith = __webpack_require__(14); + var _helpersWith = __webpack_require__(17); var _helpersWith2 = _interopRequireDefault(_helpersWith); @@ -579,7 +627,7 @@ return /******/ (function(modules) { // webpackBootstrap } /***/ }, -/* 8 */ +/* 11 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; @@ -622,7 +670,7 @@ return /******/ (function(modules) { // webpackBootstrap module.exports = exports['default']; /***/ }, -/* 9 */ +/* 12 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; @@ -719,7 +767,7 @@ return /******/ (function(modules) { // webpackBootstrap module.exports = exports['default']; /***/ }, -/* 10 */ +/* 13 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; @@ -747,7 +795,7 @@ return /******/ (function(modules) { // webpackBootstrap module.exports = exports['default']; /***/ }, -/* 11 */ +/* 14 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; @@ -780,7 +828,7 @@ return /******/ (function(modules) { // webpackBootstrap module.exports = exports['default']; /***/ }, -/* 12 */ +/* 15 */ /***/ function(module, exports) { 'use strict'; @@ -810,7 +858,7 @@ return /******/ (function(modules) { // webpackBootstrap module.exports = exports['default']; /***/ }, -/* 13 */ +/* 16 */ /***/ function(module, exports) { 'use strict'; @@ -826,7 +874,7 @@ return /******/ (function(modules) { // webpackBootstrap module.exports = exports['default']; /***/ }, -/* 14 */ +/* 17 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; @@ -863,7 +911,7 @@ return /******/ (function(modules) { // webpackBootstrap module.exports = exports['default']; /***/ }, -/* 15 */ +/* 18 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; @@ -873,7 +921,7 @@ return /******/ (function(modules) { // webpackBootstrap exports.__esModule = true; exports.registerDefaultDecorators = registerDefaultDecorators; - var _decoratorsInline = __webpack_require__(16); + var _decoratorsInline = __webpack_require__(19); var _decoratorsInline2 = _interopRequireDefault(_decoratorsInline); @@ -882,7 +930,7 @@ return /******/ (function(modules) { // webpackBootstrap } /***/ }, -/* 16 */ +/* 19 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; @@ -915,7 +963,7 @@ return /******/ (function(modules) { // webpackBootstrap module.exports = exports['default']; /***/ }, -/* 17 */ +/* 20 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; @@ -966,7 +1014,7 @@ return /******/ (function(modules) { // webpackBootstrap module.exports = exports['default']; /***/ }, -/* 18 */ +/* 21 */ /***/ function(module, exports) { // Build out our basic SafeString type @@ -985,11 +1033,13 @@ return /******/ (function(modules) { // webpackBootstrap module.exports = exports['default']; /***/ }, -/* 19 */ +/* 22 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; + var _Object$seal = __webpack_require__(23)['default']; + var _interopRequireWildcard = __webpack_require__(3)['default']; var _interopRequireDefault = __webpack_require__(1)['default']; @@ -1132,6 +1182,8 @@ return /******/ (function(modules) { // webpackBootstrap return obj; }, + // An empty object to use as replacement for null-contexts + nullContext: _Object$seal({}), noop: env.VM.noop, compilerInfo: templateSpec.compiler @@ -1150,7 +1202,7 @@ return /******/ (function(modules) { // webpackBootstrap blockParams = templateSpec.useBlockParams ? [] : undefined; if (templateSpec.useDepths) { if (options.depths) { - depths = context !== options.depths[0] ? [context].concat(options.depths) : options.depths; + depths = context != options.depths[0] ? [context].concat(options.depths) : options.depths; } else { depths = [context]; } @@ -1199,7 +1251,7 @@ return /******/ (function(modules) { // webpackBootstrap var options = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1]; var currentDepths = depths; - if (depths && context !== depths[0]) { + if (depths && context != depths[0] && !(context === container.nullContext && depths[0] === null)) { currentDepths = [context].concat(depths); } @@ -1230,6 +1282,8 @@ return /******/ (function(modules) { // webpackBootstrap } function invokePartial(partial, context, options) { + // Use the current closure context to save the partial-block if this partial + var currentPartialBlock = options.data && options.data['partial-block']; options.partial = true; if (options.ids) { options.data.contextPath = options.ids[0] || options.data.contextPath; @@ -1237,12 +1291,23 @@ return /******/ (function(modules) { // webpackBootstrap var partialBlock = undefined; if (options.fn && options.fn !== noop) { - options.data = _base.createFrame(options.data); - partialBlock = options.data['partial-block'] = options.fn; - - if (partialBlock.partials) { - options.partials = Utils.extend({}, options.partials, partialBlock.partials); - } + (function () { + options.data = _base.createFrame(options.data); + // Wrapper function to get access to currentPartialBlock from the closure + var fn = options.fn; + partialBlock = options.data['partial-block'] = function partialBlockWrapper(context) { + var options = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1]; + + // Restore the partial-block from the closure for the execution of the block + // i.e. the part inside the block of the partial call. + options.data = _base.createFrame(options.data); + options.data['partial-block'] = currentPartialBlock; + return fn(context, options); + }; + if (fn.partials) { + options.partials = Utils.extend({}, options.partials, fn.partials); + } + })(); } if (partial === undefined && partialBlock) { @@ -1278,7 +1343,169 @@ return /******/ (function(modules) { // webpackBootstrap } /***/ }, -/* 20 */ +/* 23 */ +/***/ function(module, exports, __webpack_require__) { + + module.exports = { "default": __webpack_require__(24), __esModule: true }; + +/***/ }, +/* 24 */ +/***/ function(module, exports, __webpack_require__) { + + __webpack_require__(25); + module.exports = __webpack_require__(30).Object.seal; + +/***/ }, +/* 25 */ +/***/ function(module, exports, __webpack_require__) { + + // 19.1.2.17 Object.seal(O) + var isObject = __webpack_require__(26); + + __webpack_require__(27)('seal', function($seal){ + return function seal(it){ + return $seal && isObject(it) ? $seal(it) : it; + }; + }); + +/***/ }, +/* 26 */ +/***/ function(module, exports) { + + module.exports = function(it){ + return typeof it === 'object' ? it !== null : typeof it === 'function'; + }; + +/***/ }, +/* 27 */ +/***/ function(module, exports, __webpack_require__) { + + // most Object methods by ES6 should accept primitives + var $export = __webpack_require__(28) + , core = __webpack_require__(30) + , fails = __webpack_require__(33); + module.exports = function(KEY, exec){ + var fn = (core.Object || {})[KEY] || Object[KEY] + , exp = {}; + exp[KEY] = exec(fn); + $export($export.S + $export.F * fails(function(){ fn(1); }), 'Object', exp); + }; + +/***/ }, +/* 28 */ +/***/ function(module, exports, __webpack_require__) { + + var global = __webpack_require__(29) + , core = __webpack_require__(30) + , ctx = __webpack_require__(31) + , PROTOTYPE = 'prototype'; + + var $export = function(type, name, source){ + var IS_FORCED = type & $export.F + , IS_GLOBAL = type & $export.G + , IS_STATIC = type & $export.S + , IS_PROTO = type & $export.P + , IS_BIND = type & $export.B + , IS_WRAP = type & $export.W + , exports = IS_GLOBAL ? core : core[name] || (core[name] = {}) + , target = IS_GLOBAL ? global : IS_STATIC ? global[name] : (global[name] || {})[PROTOTYPE] + , key, own, out; + if(IS_GLOBAL)source = name; + for(key in source){ + // contains in native + own = !IS_FORCED && target && key in target; + if(own && key in exports)continue; + // export native or passed + out = own ? target[key] : source[key]; + // prevent global pollution for namespaces + exports[key] = IS_GLOBAL && typeof target[key] != 'function' ? source[key] + // bind timers to global for call from export context + : IS_BIND && own ? ctx(out, global) + // wrap global constructors for prevent change them in library + : IS_WRAP && target[key] == out ? (function(C){ + var F = function(param){ + return this instanceof C ? new C(param) : C(param); + }; + F[PROTOTYPE] = C[PROTOTYPE]; + return F; + // make static versions for prototype methods + })(out) : IS_PROTO && typeof out == 'function' ? ctx(Function.call, out) : out; + if(IS_PROTO)(exports[PROTOTYPE] || (exports[PROTOTYPE] = {}))[key] = out; + } + }; + // type bitmap + $export.F = 1; // forced + $export.G = 2; // global + $export.S = 4; // static + $export.P = 8; // proto + $export.B = 16; // bind + $export.W = 32; // wrap + module.exports = $export; + +/***/ }, +/* 29 */ +/***/ function(module, exports) { + + // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028 + var global = module.exports = typeof window != 'undefined' && window.Math == Math + ? window : typeof self != 'undefined' && self.Math == Math ? self : Function('return this')(); + if(typeof __g == 'number')__g = global; // eslint-disable-line no-undef + +/***/ }, +/* 30 */ +/***/ function(module, exports) { + + var core = module.exports = {version: '1.2.6'}; + if(typeof __e == 'number')__e = core; // eslint-disable-line no-undef + +/***/ }, +/* 31 */ +/***/ function(module, exports, __webpack_require__) { + + // optional / simple context binding + var aFunction = __webpack_require__(32); + module.exports = function(fn, that, length){ + aFunction(fn); + if(that === undefined)return fn; + switch(length){ + case 1: return function(a){ + return fn.call(that, a); + }; + case 2: return function(a, b){ + return fn.call(that, a, b); + }; + case 3: return function(a, b, c){ + return fn.call(that, a, b, c); + }; + } + return function(/* ...args */){ + return fn.apply(that, arguments); + }; + }; + +/***/ }, +/* 32 */ +/***/ function(module, exports) { + + module.exports = function(it){ + if(typeof it != 'function')throw TypeError(it + ' is not a function!'); + return it; + }; + +/***/ }, +/* 33 */ +/***/ function(module, exports) { + + module.exports = function(exec){ + try { + return !!exec(); + } catch(e){ + return true; + } + }; + +/***/ }, +/* 34 */ /***/ function(module, exports) { /* WEBPACK VAR INJECTION */(function(global) {/* global window */ @@ -1303,7 +1530,7 @@ return /******/ (function(modules) { // webpackBootstrap /* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }()))) /***/ }, -/* 21 */ +/* 35 */ /***/ function(module, exports) { 'use strict'; @@ -1338,7 +1565,7 @@ return /******/ (function(modules) { // webpackBootstrap module.exports = exports['default']; /***/ }, -/* 22 */ +/* 36 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; @@ -1350,15 +1577,15 @@ return /******/ (function(modules) { // webpackBootstrap exports.__esModule = true; exports.parse = parse; - var _parser = __webpack_require__(23); + var _parser = __webpack_require__(37); var _parser2 = _interopRequireDefault(_parser); - var _whitespaceControl = __webpack_require__(24); + var _whitespaceControl = __webpack_require__(38); var _whitespaceControl2 = _interopRequireDefault(_whitespaceControl); - var _helpers = __webpack_require__(26); + var _helpers = __webpack_require__(40); var Helpers = _interopRequireWildcard(_helpers); @@ -1387,21 +1614,21 @@ return /******/ (function(modules) { // webpackBootstrap } /***/ }, -/* 23 */ +/* 37 */ /***/ function(module, exports) { - /* istanbul ignore next */ + // File ignored in coverage tests via setting in .istanbul.yml /* Jison generated parser */ "use strict"; + exports.__esModule = true; var handlebars = (function () { var parser = { trace: function trace() {}, yy: {}, symbols_: { "error": 2, "root": 3, "program": 4, "EOF": 5, "program_repetition0": 6, "statement": 7, "mustache": 8, "block": 9, "rawBlock": 10, "partial": 11, "partialBlock": 12, "content": 13, "COMMENT": 14, "CONTENT": 15, "openRawBlock": 16, "rawBlock_repetition_plus0": 17, "END_RAW_BLOCK": 18, "OPEN_RAW_BLOCK": 19, "helperName": 20, "openRawBlock_repetition0": 21, "openRawBlock_option0": 22, "CLOSE_RAW_BLOCK": 23, "openBlock": 24, "block_option0": 25, "closeBlock": 26, "openInverse": 27, "block_option1": 28, "OPEN_BLOCK": 29, "openBlock_repetition0": 30, "openBlock_option0": 31, "openBlock_option1": 32, "CLOSE": 33, "OPEN_INVERSE": 34, "openInverse_repetition0": 35, "openInverse_option0": 36, "openInverse_option1": 37, "openInverseChain": 38, "OPEN_INVERSE_CHAIN": 39, "openInverseChain_repetition0": 40, "openInverseChain_option0": 41, "openInverseChain_option1": 42, "inverseAndProgram": 43, "INVERSE": 44, "inverseChain": 45, "inverseChain_option0": 46, "OPEN_ENDBLOCK": 47, "OPEN": 48, "mustache_repetition0": 49, "mustache_option0": 50, "OPEN_UNESCAPED": 51, "mustache_repetition1": 52, "mustache_option1": 53, "CLOSE_UNESCAPED": 54, "OPEN_PARTIAL": 55, "partialName": 56, "partial_repetition0": 57, "partial_option0": 58, "openPartialBlock": 59, "OPEN_PARTIAL_BLOCK": 60, "openPartialBlock_repetition0": 61, "openPartialBlock_option0": 62, "param": 63, "sexpr": 64, "OPEN_SEXPR": 65, "sexpr_repetition0": 66, "sexpr_option0": 67, "CLOSE_SEXPR": 68, "hash": 69, "hash_repetition_plus0": 70, "hashSegment": 71, "ID": 72, "EQUALS": 73, "blockParams": 74, "OPEN_BLOCK_PARAMS": 75, "blockParams_repetition_plus0": 76, "CLOSE_BLOCK_PARAMS": 77, "path": 78, "dataName": 79, "STRING": 80, "NUMBER": 81, "BOOLEAN": 82, "UNDEFINED": 83, "NULL": 84, "DATA": 85, "pathSegments": 86, "SEP": 87, "$accept": 0, "$end": 1 }, terminals_: { 2: "error", 5: "EOF", 14: "COMMENT", 15: "CONTENT", 18: "END_RAW_BLOCK", 19: "OPEN_RAW_BLOCK", 23: "CLOSE_RAW_BLOCK", 29: "OPEN_BLOCK", 33: "CLOSE", 34: "OPEN_INVERSE", 39: "OPEN_INVERSE_CHAIN", 44: "INVERSE", 47: "OPEN_ENDBLOCK", 48: "OPEN", 51: "OPEN_UNESCAPED", 54: "CLOSE_UNESCAPED", 55: "OPEN_PARTIAL", 60: "OPEN_PARTIAL_BLOCK", 65: "OPEN_SEXPR", 68: "CLOSE_SEXPR", 72: "ID", 73: "EQUALS", 75: "OPEN_BLOCK_PARAMS", 77: "CLOSE_BLOCK_PARAMS", 80: "STRING", 81: "NUMBER", 82: "BOOLEAN", 83: "UNDEFINED", 84: "NULL", 85: "DATA", 87: "SEP" }, productions_: [0, [3, 2], [4, 1], [7, 1], [7, 1], [7, 1], [7, 1], [7, 1], [7, 1], [7, 1], [13, 1], [10, 3], [16, 5], [9, 4], [9, 4], [24, 6], [27, 6], [38, 6], [43, 2], [45, 3], [45, 1], [26, 3], [8, 5], [8, 5], [11, 5], [12, 3], [59, 5], [63, 1], [63, 1], [64, 5], [69, 1], [71, 3], [74, 3], [20, 1], [20, 1], [20, 1], [20, 1], [20, 1], [20, 1], [20, 1], [56, 1], [56, 1], [79, 2], [78, 1], [86, 3], [86, 1], [6, 0], [6, 2], [17, 1], [17, 2], [21, 0], [21, 2], [22, 0], [22, 1], [25, 0], [25, 1], [28, 0], [28, 1], [30, 0], [30, 2], [31, 0], [31, 1], [32, 0], [32, 1], [35, 0], [35, 2], [36, 0], [36, 1], [37, 0], [37, 1], [40, 0], [40, 2], [41, 0], [41, 1], [42, 0], [42, 1], [46, 0], [46, 1], [49, 0], [49, 2], [50, 0], [50, 1], [52, 0], [52, 2], [53, 0], [53, 1], [57, 0], [57, 2], [58, 0], [58, 1], [61, 0], [61, 2], [62, 0], [62, 1], [66, 0], [66, 2], [67, 0], [67, 1], [70, 1], [70, 2], [76, 1], [76, 2]], - performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$ - /**/) { + performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$) { var $0 = $$.length - 1; switch (yystate) { @@ -1938,8 +2165,7 @@ return /******/ (function(modules) { // webpackBootstrap this.begin(condition); } }; lexer.options = {}; - lexer.performAction = function anonymous(yy, yy_, $avoiding_name_collisions, YY_START - /**/) { + lexer.performAction = function anonymous(yy, yy_, $avoiding_name_collisions, YY_START) { function strip(start, end) { return yy_.yytext = yy_.yytext.substr(start, yy_.yyleng - end); @@ -2116,7 +2342,7 @@ return /******/ (function(modules) { // webpackBootstrap break; } }; - lexer.rules = [/^(?:[^\x00]*?(?=(\{\{)))/, /^(?:[^\x00]+)/, /^(?:[^\x00]{2,}?(?=(\{\{|\\\{\{|\\\\\{\{|$)))/, /^(?:\{\{\{\{(?=[^/]))/, /^(?:\{\{\{\{\/[^\s!"#%-,\.\/;->@\[-\^`\{-~]+(?=[=}\s\/.])\}\}\}\})/, /^(?:[^\x00]*?(?=(\{\{\{\{)))/, /^(?:[\s\S]*?--(~)?\}\})/, /^(?:\()/, /^(?:\))/, /^(?:\{\{\{\{)/, /^(?:\}\}\}\})/, /^(?:\{\{(~)?>)/, /^(?:\{\{(~)?#>)/, /^(?:\{\{(~)?#\*?)/, /^(?:\{\{(~)?\/)/, /^(?:\{\{(~)?\^\s*(~)?\}\})/, /^(?:\{\{(~)?\s*else\s*(~)?\}\})/, /^(?:\{\{(~)?\^)/, /^(?:\{\{(~)?\s*else\b)/, /^(?:\{\{(~)?\{)/, /^(?:\{\{(~)?&)/, /^(?:\{\{(~)?!--)/, /^(?:\{\{(~)?![\s\S]*?\}\})/, /^(?:\{\{(~)?\*?)/, /^(?:=)/, /^(?:\.\.)/, /^(?:\.(?=([=~}\s\/.)|])))/, /^(?:[\/.])/, /^(?:\s+)/, /^(?:\}(~)?\}\})/, /^(?:(~)?\}\})/, /^(?:"(\\["]|[^"])*")/, /^(?:'(\\[']|[^'])*')/, /^(?:@)/, /^(?:true(?=([~}\s)])))/, /^(?:false(?=([~}\s)])))/, /^(?:undefined(?=([~}\s)])))/, /^(?:null(?=([~}\s)])))/, /^(?:-?[0-9]+(?:\.[0-9]+)?(?=([~}\s)])))/, /^(?:as\s+\|)/, /^(?:\|)/, /^(?:([^\s!"#%-,\.\/;->@\[-\^`\{-~]+(?=([=~}\s\/.)|]))))/, /^(?:\[(\\\]|[^\]])*\])/, /^(?:.)/, /^(?:$)/]; + lexer.rules = [/^(?:[^\x00]*?(?=(\{\{)))/, /^(?:[^\x00]+)/, /^(?:[^\x00]{2,}?(?=(\{\{|\\\{\{|\\\\\{\{|$)))/, /^(?:\{\{\{\{(?=[^\/]))/, /^(?:\{\{\{\{\/[^\s!"#%-,\.\/;->@\[-\^`\{-~]+(?=[=}\s\/.])\}\}\}\})/, /^(?:[^\x00]*?(?=(\{\{\{\{)))/, /^(?:[\s\S]*?--(~)?\}\})/, /^(?:\()/, /^(?:\))/, /^(?:\{\{\{\{)/, /^(?:\}\}\}\})/, /^(?:\{\{(~)?>)/, /^(?:\{\{(~)?#>)/, /^(?:\{\{(~)?#\*?)/, /^(?:\{\{(~)?\/)/, /^(?:\{\{(~)?\^\s*(~)?\}\})/, /^(?:\{\{(~)?\s*else\s*(~)?\}\})/, /^(?:\{\{(~)?\^)/, /^(?:\{\{(~)?\s*else\b)/, /^(?:\{\{(~)?\{)/, /^(?:\{\{(~)?&)/, /^(?:\{\{(~)?!--)/, /^(?:\{\{(~)?![\s\S]*?\}\})/, /^(?:\{\{(~)?\*?)/, /^(?:=)/, /^(?:\.\.)/, /^(?:\.(?=([=~}\s\/.)|])))/, /^(?:[\/.])/, /^(?:\s+)/, /^(?:\}(~)?\}\})/, /^(?:(~)?\}\})/, /^(?:"(\\["]|[^"])*")/, /^(?:'(\\[']|[^'])*')/, /^(?:@)/, /^(?:true(?=([~}\s)])))/, /^(?:false(?=([~}\s)])))/, /^(?:undefined(?=([~}\s)])))/, /^(?:null(?=([~}\s)])))/, /^(?:-?[0-9]+(?:\.[0-9]+)?(?=([~}\s)])))/, /^(?:as\s+\|)/, /^(?:\|)/, /^(?:([^\s!"#%-,\.\/;->@\[-\^`\{-~]+(?=([=~}\s\/.)|]))))/, /^(?:\[(\\\]|[^\]])*\])/, /^(?:.)/, /^(?:$)/]; lexer.conditions = { "mu": { "rules": [7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44], "inclusive": false }, "emu": { "rules": [2], "inclusive": false }, "com": { "rules": [6], "inclusive": false }, "raw": { "rules": [3, 4, 5], "inclusive": false }, "INITIAL": { "rules": [0, 1, 44], "inclusive": true } }; return lexer; })(); @@ -2125,11 +2351,11 @@ return /******/ (function(modules) { // webpackBootstrap this.yy = {}; }Parser.prototype = parser;parser.Parser = Parser; return new Parser(); - })();exports.__esModule = true; - exports['default'] = handlebars; + })();exports["default"] = handlebars; + module.exports = exports["default"]; /***/ }, -/* 24 */ +/* 38 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; @@ -2138,7 +2364,7 @@ return /******/ (function(modules) { // webpackBootstrap exports.__esModule = true; - var _visitor = __webpack_require__(25); + var _visitor = __webpack_require__(39); var _visitor2 = _interopRequireDefault(_visitor); @@ -2353,7 +2579,7 @@ return /******/ (function(modules) { // webpackBootstrap module.exports = exports['default']; /***/ }, -/* 25 */ +/* 39 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; @@ -2496,7 +2722,7 @@ return /******/ (function(modules) { // webpackBootstrap module.exports = exports['default']; /***/ }, -/* 26 */ +/* 40 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; @@ -2557,7 +2783,7 @@ return /******/ (function(modules) { // webpackBootstrap } function stripComment(comment) { - return comment.replace(/^\{\{~?\!-?-?/, '').replace(/-?-?~?\}\}$/, ''); + return comment.replace(/^\{\{~?!-?-?/, '').replace(/-?-?~?\}\}$/, ''); } function preparePath(data, parts, loc) { @@ -2565,8 +2791,7 @@ return /******/ (function(modules) { // webpackBootstrap var original = data ? '@' : '', dig = [], - depth = 0, - depthString = ''; + depth = 0; for (var i = 0, l = parts.length; i < l; i++) { var part = parts[i].part, @@ -2581,7 +2806,6 @@ return /******/ (function(modules) { // webpackBootstrap throw new _exception2['default']('Invalid path: ' + original, { loc: loc }); } else if (part === '..') { depth++; - depthString += '../'; } } else { dig.push(part); @@ -2729,7 +2953,7 @@ return /******/ (function(modules) { // webpackBootstrap } /***/ }, -/* 27 */ +/* 41 */ /***/ function(module, exports, __webpack_require__) { /* eslint-disable new-cap */ @@ -2749,7 +2973,7 @@ return /******/ (function(modules) { // webpackBootstrap var _utils = __webpack_require__(5); - var _ast = __webpack_require__(21); + var _ast = __webpack_require__(35); var _ast2 = _interopRequireDefault(_ast); @@ -2816,11 +3040,11 @@ return /******/ (function(modules) { // webpackBootstrap 'lookup': true }; if (knownHelpers) { + // the next line should use "Object.keys", but the code has been like this a long time and changing it, might + // cause backwards-compatibility issues... It's an old library... + // eslint-disable-next-line guard-for-in for (var _name in knownHelpers) { - /* istanbul ignore else */ - if (_name in knownHelpers) { - options.knownHelpers[_name] = knownHelpers[_name]; - } + this.options.knownHelpers[_name] = knownHelpers[_name]; } } @@ -3234,6 +3458,7 @@ return /******/ (function(modules) { // webpackBootstrap throw new _exception2['default']('You must pass a string or Handlebars AST to Handlebars.compile. You passed ' + input); } + options = _utils.extend({}, options); if (!('data' in options)) { options.data = true; } @@ -3304,7 +3529,7 @@ return /******/ (function(modules) { // webpackBootstrap } /***/ }, -/* 28 */ +/* 42 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; @@ -3321,7 +3546,7 @@ return /******/ (function(modules) { // webpackBootstrap var _utils = __webpack_require__(5); - var _codeGen = __webpack_require__(29); + var _codeGen = __webpack_require__(43); var _codeGen2 = _interopRequireDefault(_codeGen); @@ -3335,6 +3560,9 @@ return /******/ (function(modules) { // webpackBootstrap // PUBLIC API: You can override these methods in a subclass to provide // alternative compiled forms for name lookup and buffering semantics nameLookup: function nameLookup(parent, name /* , type*/) { + if (name === 'constructor') { + return ['(', parent, '.propertyIsEnumerable(\'constructor\') ? ', parent, '.constructor : undefined', ')']; + } if (JavaScriptCompiler.isValidJavaScriptVariableName(name)) { return [parent, '.', name]; } else { @@ -4092,11 +4320,11 @@ return /******/ (function(modules) { // webpackBootstrap child = children[i]; compiler = new this.compiler(); // eslint-disable-line new-cap - var index = this.matchExistingProgram(child); + var existing = this.matchExistingProgram(child); - if (index == null) { + if (existing == null) { this.context.programs.push(''); // Placeholder to prevent name conflicts for nested children - index = this.context.programs.length; + var index = this.context.programs.length; child.index = index; child.name = 'program' + index; this.context.programs[index] = compiler.compile(child, options, this.context, !this.precompile); @@ -4105,12 +4333,14 @@ return /******/ (function(modules) { // webpackBootstrap this.useDepths = this.useDepths || compiler.useDepths; this.useBlockParams = this.useBlockParams || compiler.useBlockParams; + child.useDepths = this.useDepths; + child.useBlockParams = this.useBlockParams; } else { - child.index = index; - child.name = 'program' + index; + child.index = existing.index; + child.name = 'program' + existing.index; - this.useDepths = this.useDepths || child.useDepths; - this.useBlockParams = this.useBlockParams || child.useBlockParams; + this.useDepths = this.useDepths || existing.useDepths; + this.useBlockParams = this.useBlockParams || existing.useBlockParams; } } }, @@ -4118,7 +4348,7 @@ return /******/ (function(modules) { // webpackBootstrap for (var i = 0, len = this.context.environments.length; i < len; i++) { var environment = this.context.environments[i]; if (environment && environment.equals(child)) { - return i; + return environment; } } }, @@ -4300,7 +4530,7 @@ return /******/ (function(modules) { // webpackBootstrap var params = [], paramsInit = this.setupHelperArgs(name, paramSize, params, blockHelper); var foundHelper = this.nameLookup('helpers', name, 'helper'), - callContext = this.aliasable(this.contextName(0) + ' != null ? ' + this.contextName(0) + ' : {}'); + callContext = this.aliasable(this.contextName(0) + ' != null ? ' + this.contextName(0) + ' : (container.nullContext || {})'); return { params: params, @@ -4433,7 +4663,7 @@ return /******/ (function(modules) { // webpackBootstrap module.exports = exports['default']; /***/ }, -/* 29 */ +/* 43 */ /***/ function(module, exports, __webpack_require__) { /* global define */ @@ -4604,5 +4834,5 @@ return /******/ (function(modules) { // webpackBootstrap /***/ } /******/ ]) -}); +}; ; \ No newline at end of file diff --git a/vendor/assets/javascripts/handlebars.runtime.js b/vendor/assets/javascripts/handlebars.runtime.js index 95049f3..407d805 100644 --- a/vendor/assets/javascripts/handlebars.runtime.js +++ b/vendor/assets/javascripts/handlebars.runtime.js @@ -1,8 +1,8 @@ -/*! +/**! - handlebars v4.0.5 + handlebars v4.1.0 -Copyright (C) 2011-2015 by Yehuda Katz +Copyright (C) 2011-2017 by Yehuda Katz Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal @@ -22,7 +22,6 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -@license */ (function webpackUniversalModuleDefinition(root, factory) { if(typeof exports === 'object' && typeof module === 'object') @@ -34,7 +33,7 @@ THE SOFTWARE. else root["Handlebars"] = factory(); })(this, function() { -return /******/ (function(modules) { // webpackBootstrap +return /******/ function(modules) { // webpackBootstrap /******/ // The module cache /******/ var installedModules = {}; @@ -78,7 +77,7 @@ return /******/ (function(modules) { // webpackBootstrap /************************************************************************/ /******/ ([ /* 0 */ -/***/ function(module, exports, __webpack_require__) { +/***/ (function(module, exports, __webpack_require__) { 'use strict'; @@ -95,7 +94,7 @@ return /******/ (function(modules) { // webpackBootstrap // Each of these augment the Handlebars object. No need to setup here. // (This is done to easily share code between commonjs and browse envs) - var _handlebarsSafeString = __webpack_require__(17); + var _handlebarsSafeString = __webpack_require__(20); var _handlebarsSafeString2 = _interopRequireDefault(_handlebarsSafeString); @@ -107,11 +106,11 @@ return /******/ (function(modules) { // webpackBootstrap var Utils = _interopRequireWildcard(_handlebarsUtils); - var _handlebarsRuntime = __webpack_require__(18); + var _handlebarsRuntime = __webpack_require__(21); var runtime = _interopRequireWildcard(_handlebarsRuntime); - var _handlebarsNoConflict = __webpack_require__(19); + var _handlebarsNoConflict = __webpack_require__(33); var _handlebarsNoConflict2 = _interopRequireDefault(_handlebarsNoConflict); @@ -199,15 +198,15 @@ return /******/ (function(modules) { // webpackBootstrap var _exception2 = _interopRequireDefault(_exception); - var _helpers = __webpack_require__(6); + var _helpers = __webpack_require__(9); - var _decorators = __webpack_require__(14); + var _decorators = __webpack_require__(17); - var _logger = __webpack_require__(16); + var _logger = __webpack_require__(19); var _logger2 = _interopRequireDefault(_logger); - var VERSION = '4.0.5'; + var VERSION = '4.1.0'; exports.VERSION = VERSION; var COMPILER_REVISION = 7; @@ -419,10 +418,12 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, /* 5 */ -/***/ function(module, exports) { +/***/ function(module, exports, __webpack_require__) { 'use strict'; + var _Object$defineProperty = __webpack_require__(6)['default']; + exports.__esModule = true; var errorProps = ['description', 'fileName', 'lineNumber', 'message', 'name', 'number', 'stack']; @@ -450,9 +451,23 @@ return /******/ (function(modules) { // webpackBootstrap Error.captureStackTrace(this, Exception); } - if (loc) { - this.lineNumber = line; - this.column = column; + try { + if (loc) { + this.lineNumber = line; + + // Work around issue under safari where we can't directly set the column value + /* istanbul ignore next */ + if (_Object$defineProperty) { + Object.defineProperty(this, 'column', { + value: column, + enumerable: true + }); + } else { + this.column = column; + } + } + } catch (nop) { + /* Ignore if the browser is very particular */ } } @@ -463,6 +478,39 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, /* 6 */ +/***/ function(module, exports, __webpack_require__) { + + module.exports = { "default": __webpack_require__(7), __esModule: true }; + +/***/ }, +/* 7 */ +/***/ function(module, exports, __webpack_require__) { + + var $ = __webpack_require__(8); + module.exports = function defineProperty(it, key, desc){ + return $.setDesc(it, key, desc); + }; + +/***/ }, +/* 8 */ +/***/ function(module, exports) { + + var $Object = Object; + module.exports = { + create: $Object.create, + getProto: $Object.getPrototypeOf, + isEnum: {}.propertyIsEnumerable, + getDesc: $Object.getOwnPropertyDescriptor, + setDesc: $Object.defineProperty, + setDescs: $Object.defineProperties, + getKeys: $Object.keys, + getNames: $Object.getOwnPropertyNames, + getSymbols: $Object.getOwnPropertySymbols, + each: [].forEach + }; + +/***/ }, +/* 9 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; @@ -472,31 +520,31 @@ return /******/ (function(modules) { // webpackBootstrap exports.__esModule = true; exports.registerDefaultHelpers = registerDefaultHelpers; - var _helpersBlockHelperMissing = __webpack_require__(7); + var _helpersBlockHelperMissing = __webpack_require__(10); var _helpersBlockHelperMissing2 = _interopRequireDefault(_helpersBlockHelperMissing); - var _helpersEach = __webpack_require__(8); + var _helpersEach = __webpack_require__(11); var _helpersEach2 = _interopRequireDefault(_helpersEach); - var _helpersHelperMissing = __webpack_require__(9); + var _helpersHelperMissing = __webpack_require__(12); var _helpersHelperMissing2 = _interopRequireDefault(_helpersHelperMissing); - var _helpersIf = __webpack_require__(10); + var _helpersIf = __webpack_require__(13); var _helpersIf2 = _interopRequireDefault(_helpersIf); - var _helpersLog = __webpack_require__(11); + var _helpersLog = __webpack_require__(14); var _helpersLog2 = _interopRequireDefault(_helpersLog); - var _helpersLookup = __webpack_require__(12); + var _helpersLookup = __webpack_require__(15); var _helpersLookup2 = _interopRequireDefault(_helpersLookup); - var _helpersWith = __webpack_require__(13); + var _helpersWith = __webpack_require__(16); var _helpersWith2 = _interopRequireDefault(_helpersWith); @@ -511,7 +559,7 @@ return /******/ (function(modules) { // webpackBootstrap } /***/ }, -/* 7 */ +/* 10 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; @@ -554,7 +602,7 @@ return /******/ (function(modules) { // webpackBootstrap module.exports = exports['default']; /***/ }, -/* 8 */ +/* 11 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; @@ -651,7 +699,7 @@ return /******/ (function(modules) { // webpackBootstrap module.exports = exports['default']; /***/ }, -/* 9 */ +/* 12 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; @@ -679,7 +727,7 @@ return /******/ (function(modules) { // webpackBootstrap module.exports = exports['default']; /***/ }, -/* 10 */ +/* 13 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; @@ -712,7 +760,7 @@ return /******/ (function(modules) { // webpackBootstrap module.exports = exports['default']; /***/ }, -/* 11 */ +/* 14 */ /***/ function(module, exports) { 'use strict'; @@ -742,7 +790,7 @@ return /******/ (function(modules) { // webpackBootstrap module.exports = exports['default']; /***/ }, -/* 12 */ +/* 15 */ /***/ function(module, exports) { 'use strict'; @@ -758,7 +806,7 @@ return /******/ (function(modules) { // webpackBootstrap module.exports = exports['default']; /***/ }, -/* 13 */ +/* 16 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; @@ -795,7 +843,7 @@ return /******/ (function(modules) { // webpackBootstrap module.exports = exports['default']; /***/ }, -/* 14 */ +/* 17 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; @@ -805,7 +853,7 @@ return /******/ (function(modules) { // webpackBootstrap exports.__esModule = true; exports.registerDefaultDecorators = registerDefaultDecorators; - var _decoratorsInline = __webpack_require__(15); + var _decoratorsInline = __webpack_require__(18); var _decoratorsInline2 = _interopRequireDefault(_decoratorsInline); @@ -814,7 +862,7 @@ return /******/ (function(modules) { // webpackBootstrap } /***/ }, -/* 15 */ +/* 18 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; @@ -847,7 +895,7 @@ return /******/ (function(modules) { // webpackBootstrap module.exports = exports['default']; /***/ }, -/* 16 */ +/* 19 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; @@ -898,7 +946,7 @@ return /******/ (function(modules) { // webpackBootstrap module.exports = exports['default']; /***/ }, -/* 17 */ +/* 20 */ /***/ function(module, exports) { // Build out our basic SafeString type @@ -917,11 +965,13 @@ return /******/ (function(modules) { // webpackBootstrap module.exports = exports['default']; /***/ }, -/* 18 */ +/* 21 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; + var _Object$seal = __webpack_require__(22)['default']; + var _interopRequireWildcard = __webpack_require__(1)['default']; var _interopRequireDefault = __webpack_require__(2)['default']; @@ -1064,6 +1114,8 @@ return /******/ (function(modules) { // webpackBootstrap return obj; }, + // An empty object to use as replacement for null-contexts + nullContext: _Object$seal({}), noop: env.VM.noop, compilerInfo: templateSpec.compiler @@ -1082,7 +1134,7 @@ return /******/ (function(modules) { // webpackBootstrap blockParams = templateSpec.useBlockParams ? [] : undefined; if (templateSpec.useDepths) { if (options.depths) { - depths = context !== options.depths[0] ? [context].concat(options.depths) : options.depths; + depths = context != options.depths[0] ? [context].concat(options.depths) : options.depths; } else { depths = [context]; } @@ -1131,7 +1183,7 @@ return /******/ (function(modules) { // webpackBootstrap var options = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1]; var currentDepths = depths; - if (depths && context !== depths[0]) { + if (depths && context != depths[0] && !(context === container.nullContext && depths[0] === null)) { currentDepths = [context].concat(depths); } @@ -1162,6 +1214,8 @@ return /******/ (function(modules) { // webpackBootstrap } function invokePartial(partial, context, options) { + // Use the current closure context to save the partial-block if this partial + var currentPartialBlock = options.data && options.data['partial-block']; options.partial = true; if (options.ids) { options.data.contextPath = options.ids[0] || options.data.contextPath; @@ -1169,12 +1223,23 @@ return /******/ (function(modules) { // webpackBootstrap var partialBlock = undefined; if (options.fn && options.fn !== noop) { - options.data = _base.createFrame(options.data); - partialBlock = options.data['partial-block'] = options.fn; - - if (partialBlock.partials) { - options.partials = Utils.extend({}, options.partials, partialBlock.partials); - } + (function () { + options.data = _base.createFrame(options.data); + // Wrapper function to get access to currentPartialBlock from the closure + var fn = options.fn; + partialBlock = options.data['partial-block'] = function partialBlockWrapper(context) { + var options = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1]; + + // Restore the partial-block from the closure for the execution of the block + // i.e. the part inside the block of the partial call. + options.data = _base.createFrame(options.data); + options.data['partial-block'] = currentPartialBlock; + return fn(context, options); + }; + if (fn.partials) { + options.partials = Utils.extend({}, options.partials, fn.partials); + } + })(); } if (partial === undefined && partialBlock) { @@ -1210,7 +1275,169 @@ return /******/ (function(modules) { // webpackBootstrap } /***/ }, -/* 19 */ +/* 22 */ +/***/ function(module, exports, __webpack_require__) { + + module.exports = { "default": __webpack_require__(23), __esModule: true }; + +/***/ }, +/* 23 */ +/***/ function(module, exports, __webpack_require__) { + + __webpack_require__(24); + module.exports = __webpack_require__(29).Object.seal; + +/***/ }, +/* 24 */ +/***/ function(module, exports, __webpack_require__) { + + // 19.1.2.17 Object.seal(O) + var isObject = __webpack_require__(25); + + __webpack_require__(26)('seal', function($seal){ + return function seal(it){ + return $seal && isObject(it) ? $seal(it) : it; + }; + }); + +/***/ }, +/* 25 */ +/***/ function(module, exports) { + + module.exports = function(it){ + return typeof it === 'object' ? it !== null : typeof it === 'function'; + }; + +/***/ }, +/* 26 */ +/***/ function(module, exports, __webpack_require__) { + + // most Object methods by ES6 should accept primitives + var $export = __webpack_require__(27) + , core = __webpack_require__(29) + , fails = __webpack_require__(32); + module.exports = function(KEY, exec){ + var fn = (core.Object || {})[KEY] || Object[KEY] + , exp = {}; + exp[KEY] = exec(fn); + $export($export.S + $export.F * fails(function(){ fn(1); }), 'Object', exp); + }; + +/***/ }, +/* 27 */ +/***/ function(module, exports, __webpack_require__) { + + var global = __webpack_require__(28) + , core = __webpack_require__(29) + , ctx = __webpack_require__(30) + , PROTOTYPE = 'prototype'; + + var $export = function(type, name, source){ + var IS_FORCED = type & $export.F + , IS_GLOBAL = type & $export.G + , IS_STATIC = type & $export.S + , IS_PROTO = type & $export.P + , IS_BIND = type & $export.B + , IS_WRAP = type & $export.W + , exports = IS_GLOBAL ? core : core[name] || (core[name] = {}) + , target = IS_GLOBAL ? global : IS_STATIC ? global[name] : (global[name] || {})[PROTOTYPE] + , key, own, out; + if(IS_GLOBAL)source = name; + for(key in source){ + // contains in native + own = !IS_FORCED && target && key in target; + if(own && key in exports)continue; + // export native or passed + out = own ? target[key] : source[key]; + // prevent global pollution for namespaces + exports[key] = IS_GLOBAL && typeof target[key] != 'function' ? source[key] + // bind timers to global for call from export context + : IS_BIND && own ? ctx(out, global) + // wrap global constructors for prevent change them in library + : IS_WRAP && target[key] == out ? (function(C){ + var F = function(param){ + return this instanceof C ? new C(param) : C(param); + }; + F[PROTOTYPE] = C[PROTOTYPE]; + return F; + // make static versions for prototype methods + })(out) : IS_PROTO && typeof out == 'function' ? ctx(Function.call, out) : out; + if(IS_PROTO)(exports[PROTOTYPE] || (exports[PROTOTYPE] = {}))[key] = out; + } + }; + // type bitmap + $export.F = 1; // forced + $export.G = 2; // global + $export.S = 4; // static + $export.P = 8; // proto + $export.B = 16; // bind + $export.W = 32; // wrap + module.exports = $export; + +/***/ }, +/* 28 */ +/***/ function(module, exports) { + + // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028 + var global = module.exports = typeof window != 'undefined' && window.Math == Math + ? window : typeof self != 'undefined' && self.Math == Math ? self : Function('return this')(); + if(typeof __g == 'number')__g = global; // eslint-disable-line no-undef + +/***/ }, +/* 29 */ +/***/ function(module, exports) { + + var core = module.exports = {version: '1.2.6'}; + if(typeof __e == 'number')__e = core; // eslint-disable-line no-undef + +/***/ }, +/* 30 */ +/***/ function(module, exports, __webpack_require__) { + + // optional / simple context binding + var aFunction = __webpack_require__(31); + module.exports = function(fn, that, length){ + aFunction(fn); + if(that === undefined)return fn; + switch(length){ + case 1: return function(a){ + return fn.call(that, a); + }; + case 2: return function(a, b){ + return fn.call(that, a, b); + }; + case 3: return function(a, b, c){ + return fn.call(that, a, b, c); + }; + } + return function(/* ...args */){ + return fn.apply(that, arguments); + }; + }; + +/***/ }, +/* 31 */ +/***/ function(module, exports) { + + module.exports = function(it){ + if(typeof it != 'function')throw TypeError(it + ' is not a function!'); + return it; + }; + +/***/ }, +/* 32 */ +/***/ function(module, exports) { + + module.exports = function(exec){ + try { + return !!exec(); + } catch(e){ + return true; + } + }; + +/***/ }, +/* 33 */ /***/ function(module, exports) { /* WEBPACK VAR INJECTION */(function(global) {/* global window */ @@ -1236,5 +1463,5 @@ return /******/ (function(modules) { // webpackBootstrap /***/ } /******/ ]) -}); +}; ; \ No newline at end of file From d13421b7759cbd3473000a14e3e8f16ab2cf23cf Mon Sep 17 00:00:00 2001 From: Alex Riedler Date: Thu, 14 Feb 2019 09:30:36 -0500 Subject: [PATCH 60/81] Use v4.1.0 as grabbed from main source instead of PR. --- vendor/assets/javascripts/handlebars.js | 179 +++++++++--------- .../assets/javascripts/handlebars.runtime.js | 139 +++++++------- 2 files changed, 160 insertions(+), 158 deletions(-) diff --git a/vendor/assets/javascripts/handlebars.js b/vendor/assets/javascripts/handlebars.js index b0b8cdc..9df337f 100644 --- a/vendor/assets/javascripts/handlebars.js +++ b/vendor/assets/javascripts/handlebars.js @@ -1,5 +1,6 @@ /**! + @license handlebars v4.1.0 Copyright (C) 2011-2017 by Yehuda Katz @@ -77,7 +78,7 @@ return /******/ (function(modules) { // webpackBootstrap /************************************************************************/ /******/ ([ /* 0 */ -/***/ function(module, exports, __webpack_require__) { +/***/ (function(module, exports, __webpack_require__) { 'use strict'; @@ -143,9 +144,9 @@ return /******/ (function(modules) { // webpackBootstrap exports['default'] = inst; module.exports = exports['default']; -/***/ }, +/***/ }), /* 1 */ -/***/ function(module, exports) { +/***/ (function(module, exports) { "use strict"; @@ -157,9 +158,9 @@ return /******/ (function(modules) { // webpackBootstrap exports.__esModule = true; -/***/ }, +/***/ }), /* 2 */ -/***/ function(module, exports, __webpack_require__) { +/***/ (function(module, exports, __webpack_require__) { 'use strict'; @@ -224,9 +225,9 @@ return /******/ (function(modules) { // webpackBootstrap exports['default'] = inst; module.exports = exports['default']; -/***/ }, +/***/ }), /* 3 */ -/***/ function(module, exports) { +/***/ (function(module, exports) { "use strict"; @@ -249,9 +250,9 @@ return /******/ (function(modules) { // webpackBootstrap exports.__esModule = true; -/***/ }, +/***/ }), /* 4 */ -/***/ function(module, exports, __webpack_require__) { +/***/ (function(module, exports, __webpack_require__) { 'use strict'; @@ -356,9 +357,9 @@ return /******/ (function(modules) { // webpackBootstrap exports.createFrame = _utils.createFrame; exports.logger = _logger2['default']; -/***/ }, +/***/ }), /* 5 */ -/***/ function(module, exports) { +/***/ (function(module, exports) { 'use strict'; @@ -484,9 +485,9 @@ return /******/ (function(modules) { // webpackBootstrap return (contextPath ? contextPath + '.' : '') + id; } -/***/ }, +/***/ }), /* 6 */ -/***/ function(module, exports, __webpack_require__) { +/***/ (function(module, exports, __webpack_require__) { 'use strict'; @@ -544,24 +545,24 @@ return /******/ (function(modules) { // webpackBootstrap exports['default'] = Exception; module.exports = exports['default']; -/***/ }, +/***/ }), /* 7 */ -/***/ function(module, exports, __webpack_require__) { +/***/ (function(module, exports, __webpack_require__) { module.exports = { "default": __webpack_require__(8), __esModule: true }; -/***/ }, +/***/ }), /* 8 */ -/***/ function(module, exports, __webpack_require__) { +/***/ (function(module, exports, __webpack_require__) { var $ = __webpack_require__(9); module.exports = function defineProperty(it, key, desc){ return $.setDesc(it, key, desc); }; -/***/ }, +/***/ }), /* 9 */ -/***/ function(module, exports) { +/***/ (function(module, exports) { var $Object = Object; module.exports = { @@ -577,9 +578,9 @@ return /******/ (function(modules) { // webpackBootstrap each: [].forEach }; -/***/ }, +/***/ }), /* 10 */ -/***/ function(module, exports, __webpack_require__) { +/***/ (function(module, exports, __webpack_require__) { 'use strict'; @@ -626,9 +627,9 @@ return /******/ (function(modules) { // webpackBootstrap _helpersWith2['default'](instance); } -/***/ }, +/***/ }), /* 11 */ -/***/ function(module, exports, __webpack_require__) { +/***/ (function(module, exports, __webpack_require__) { 'use strict'; @@ -669,9 +670,9 @@ return /******/ (function(modules) { // webpackBootstrap module.exports = exports['default']; -/***/ }, +/***/ }), /* 12 */ -/***/ function(module, exports, __webpack_require__) { +/***/ (function(module, exports, __webpack_require__) { 'use strict'; @@ -766,9 +767,9 @@ return /******/ (function(modules) { // webpackBootstrap module.exports = exports['default']; -/***/ }, +/***/ }), /* 13 */ -/***/ function(module, exports, __webpack_require__) { +/***/ (function(module, exports, __webpack_require__) { 'use strict'; @@ -794,9 +795,9 @@ return /******/ (function(modules) { // webpackBootstrap module.exports = exports['default']; -/***/ }, +/***/ }), /* 14 */ -/***/ function(module, exports, __webpack_require__) { +/***/ (function(module, exports, __webpack_require__) { 'use strict'; @@ -827,9 +828,9 @@ return /******/ (function(modules) { // webpackBootstrap module.exports = exports['default']; -/***/ }, +/***/ }), /* 15 */ -/***/ function(module, exports) { +/***/ (function(module, exports) { 'use strict'; @@ -857,9 +858,9 @@ return /******/ (function(modules) { // webpackBootstrap module.exports = exports['default']; -/***/ }, +/***/ }), /* 16 */ -/***/ function(module, exports) { +/***/ (function(module, exports) { 'use strict'; @@ -873,9 +874,9 @@ return /******/ (function(modules) { // webpackBootstrap module.exports = exports['default']; -/***/ }, +/***/ }), /* 17 */ -/***/ function(module, exports, __webpack_require__) { +/***/ (function(module, exports, __webpack_require__) { 'use strict'; @@ -910,9 +911,9 @@ return /******/ (function(modules) { // webpackBootstrap module.exports = exports['default']; -/***/ }, +/***/ }), /* 18 */ -/***/ function(module, exports, __webpack_require__) { +/***/ (function(module, exports, __webpack_require__) { 'use strict'; @@ -929,9 +930,9 @@ return /******/ (function(modules) { // webpackBootstrap _decoratorsInline2['default'](instance); } -/***/ }, +/***/ }), /* 19 */ -/***/ function(module, exports, __webpack_require__) { +/***/ (function(module, exports, __webpack_require__) { 'use strict'; @@ -962,9 +963,9 @@ return /******/ (function(modules) { // webpackBootstrap module.exports = exports['default']; -/***/ }, +/***/ }), /* 20 */ -/***/ function(module, exports, __webpack_require__) { +/***/ (function(module, exports, __webpack_require__) { 'use strict'; @@ -1013,9 +1014,9 @@ return /******/ (function(modules) { // webpackBootstrap exports['default'] = logger; module.exports = exports['default']; -/***/ }, +/***/ }), /* 21 */ -/***/ function(module, exports) { +/***/ (function(module, exports) { // Build out our basic SafeString type 'use strict'; @@ -1032,9 +1033,9 @@ return /******/ (function(modules) { // webpackBootstrap exports['default'] = SafeString; module.exports = exports['default']; -/***/ }, +/***/ }), /* 22 */ -/***/ function(module, exports, __webpack_require__) { +/***/ (function(module, exports, __webpack_require__) { 'use strict'; @@ -1342,22 +1343,22 @@ return /******/ (function(modules) { // webpackBootstrap return prog; } -/***/ }, +/***/ }), /* 23 */ -/***/ function(module, exports, __webpack_require__) { +/***/ (function(module, exports, __webpack_require__) { module.exports = { "default": __webpack_require__(24), __esModule: true }; -/***/ }, +/***/ }), /* 24 */ -/***/ function(module, exports, __webpack_require__) { +/***/ (function(module, exports, __webpack_require__) { __webpack_require__(25); module.exports = __webpack_require__(30).Object.seal; -/***/ }, +/***/ }), /* 25 */ -/***/ function(module, exports, __webpack_require__) { +/***/ (function(module, exports, __webpack_require__) { // 19.1.2.17 Object.seal(O) var isObject = __webpack_require__(26); @@ -1368,17 +1369,17 @@ return /******/ (function(modules) { // webpackBootstrap }; }); -/***/ }, +/***/ }), /* 26 */ -/***/ function(module, exports) { +/***/ (function(module, exports) { module.exports = function(it){ return typeof it === 'object' ? it !== null : typeof it === 'function'; }; -/***/ }, +/***/ }), /* 27 */ -/***/ function(module, exports, __webpack_require__) { +/***/ (function(module, exports, __webpack_require__) { // most Object methods by ES6 should accept primitives var $export = __webpack_require__(28) @@ -1391,9 +1392,9 @@ return /******/ (function(modules) { // webpackBootstrap $export($export.S + $export.F * fails(function(){ fn(1); }), 'Object', exp); }; -/***/ }, +/***/ }), /* 28 */ -/***/ function(module, exports, __webpack_require__) { +/***/ (function(module, exports, __webpack_require__) { var global = __webpack_require__(29) , core = __webpack_require__(30) @@ -1442,25 +1443,25 @@ return /******/ (function(modules) { // webpackBootstrap $export.W = 32; // wrap module.exports = $export; -/***/ }, +/***/ }), /* 29 */ -/***/ function(module, exports) { +/***/ (function(module, exports) { // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028 var global = module.exports = typeof window != 'undefined' && window.Math == Math ? window : typeof self != 'undefined' && self.Math == Math ? self : Function('return this')(); if(typeof __g == 'number')__g = global; // eslint-disable-line no-undef -/***/ }, +/***/ }), /* 30 */ -/***/ function(module, exports) { +/***/ (function(module, exports) { var core = module.exports = {version: '1.2.6'}; if(typeof __e == 'number')__e = core; // eslint-disable-line no-undef -/***/ }, +/***/ }), /* 31 */ -/***/ function(module, exports, __webpack_require__) { +/***/ (function(module, exports, __webpack_require__) { // optional / simple context binding var aFunction = __webpack_require__(32); @@ -1483,18 +1484,18 @@ return /******/ (function(modules) { // webpackBootstrap }; }; -/***/ }, +/***/ }), /* 32 */ -/***/ function(module, exports) { +/***/ (function(module, exports) { module.exports = function(it){ if(typeof it != 'function')throw TypeError(it + ' is not a function!'); return it; }; -/***/ }, +/***/ }), /* 33 */ -/***/ function(module, exports) { +/***/ (function(module, exports) { module.exports = function(exec){ try { @@ -1504,9 +1505,9 @@ return /******/ (function(modules) { // webpackBootstrap } }; -/***/ }, +/***/ }), /* 34 */ -/***/ function(module, exports) { +/***/ (function(module, exports) { /* WEBPACK VAR INJECTION */(function(global) {/* global window */ 'use strict'; @@ -1529,9 +1530,9 @@ return /******/ (function(modules) { // webpackBootstrap module.exports = exports['default']; /* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }()))) -/***/ }, +/***/ }), /* 35 */ -/***/ function(module, exports) { +/***/ (function(module, exports) { 'use strict'; @@ -1564,9 +1565,9 @@ return /******/ (function(modules) { // webpackBootstrap exports['default'] = AST; module.exports = exports['default']; -/***/ }, +/***/ }), /* 36 */ -/***/ function(module, exports, __webpack_require__) { +/***/ (function(module, exports, __webpack_require__) { 'use strict'; @@ -1613,9 +1614,9 @@ return /******/ (function(modules) { // webpackBootstrap return strip.accept(_parser2['default'].parse(input)); } -/***/ }, +/***/ }), /* 37 */ -/***/ function(module, exports) { +/***/ (function(module, exports) { // File ignored in coverage tests via setting in .istanbul.yml /* Jison generated parser */ @@ -2354,9 +2355,9 @@ return /******/ (function(modules) { // webpackBootstrap })();exports["default"] = handlebars; module.exports = exports["default"]; -/***/ }, +/***/ }), /* 38 */ -/***/ function(module, exports, __webpack_require__) { +/***/ (function(module, exports, __webpack_require__) { 'use strict'; @@ -2578,9 +2579,9 @@ return /******/ (function(modules) { // webpackBootstrap exports['default'] = WhitespaceControl; module.exports = exports['default']; -/***/ }, +/***/ }), /* 39 */ -/***/ function(module, exports, __webpack_require__) { +/***/ (function(module, exports, __webpack_require__) { 'use strict'; @@ -2721,9 +2722,9 @@ return /******/ (function(modules) { // webpackBootstrap exports['default'] = Visitor; module.exports = exports['default']; -/***/ }, +/***/ }), /* 40 */ -/***/ function(module, exports, __webpack_require__) { +/***/ (function(module, exports, __webpack_require__) { 'use strict'; @@ -2952,9 +2953,9 @@ return /******/ (function(modules) { // webpackBootstrap }; } -/***/ }, +/***/ }), /* 41 */ -/***/ function(module, exports, __webpack_require__) { +/***/ (function(module, exports, __webpack_require__) { /* eslint-disable new-cap */ @@ -3528,9 +3529,9 @@ return /******/ (function(modules) { // webpackBootstrap } } -/***/ }, +/***/ }), /* 42 */ -/***/ function(module, exports, __webpack_require__) { +/***/ (function(module, exports, __webpack_require__) { 'use strict'; @@ -4662,9 +4663,9 @@ return /******/ (function(modules) { // webpackBootstrap exports['default'] = JavaScriptCompiler; module.exports = exports['default']; -/***/ }, +/***/ }), /* 43 */ -/***/ function(module, exports, __webpack_require__) { +/***/ (function(module, exports, __webpack_require__) { /* global define */ 'use strict'; @@ -4832,7 +4833,7 @@ return /******/ (function(modules) { // webpackBootstrap exports['default'] = CodeGen; module.exports = exports['default']; -/***/ } +/***/ }) /******/ ]) -}; +}); ; \ No newline at end of file diff --git a/vendor/assets/javascripts/handlebars.runtime.js b/vendor/assets/javascripts/handlebars.runtime.js index 407d805..5ad00c3 100644 --- a/vendor/assets/javascripts/handlebars.runtime.js +++ b/vendor/assets/javascripts/handlebars.runtime.js @@ -1,5 +1,6 @@ /**! + @license handlebars v4.1.0 Copyright (C) 2011-2017 by Yehuda Katz @@ -33,7 +34,7 @@ THE SOFTWARE. else root["Handlebars"] = factory(); })(this, function() { -return /******/ function(modules) { // webpackBootstrap +return /******/ (function(modules) { // webpackBootstrap /******/ // The module cache /******/ var installedModules = {}; @@ -142,9 +143,9 @@ return /******/ function(modules) { // webpackBootstrap exports['default'] = inst; module.exports = exports['default']; -/***/ }, +/***/ }), /* 1 */ -/***/ function(module, exports) { +/***/ (function(module, exports) { "use strict"; @@ -167,9 +168,9 @@ return /******/ function(modules) { // webpackBootstrap exports.__esModule = true; -/***/ }, +/***/ }), /* 2 */ -/***/ function(module, exports) { +/***/ (function(module, exports) { "use strict"; @@ -181,9 +182,9 @@ return /******/ function(modules) { // webpackBootstrap exports.__esModule = true; -/***/ }, +/***/ }), /* 3 */ -/***/ function(module, exports, __webpack_require__) { +/***/ (function(module, exports, __webpack_require__) { 'use strict'; @@ -288,9 +289,9 @@ return /******/ function(modules) { // webpackBootstrap exports.createFrame = _utils.createFrame; exports.logger = _logger2['default']; -/***/ }, +/***/ }), /* 4 */ -/***/ function(module, exports) { +/***/ (function(module, exports) { 'use strict'; @@ -416,9 +417,9 @@ return /******/ function(modules) { // webpackBootstrap return (contextPath ? contextPath + '.' : '') + id; } -/***/ }, +/***/ }), /* 5 */ -/***/ function(module, exports, __webpack_require__) { +/***/ (function(module, exports, __webpack_require__) { 'use strict'; @@ -476,24 +477,24 @@ return /******/ function(modules) { // webpackBootstrap exports['default'] = Exception; module.exports = exports['default']; -/***/ }, +/***/ }), /* 6 */ -/***/ function(module, exports, __webpack_require__) { +/***/ (function(module, exports, __webpack_require__) { module.exports = { "default": __webpack_require__(7), __esModule: true }; -/***/ }, +/***/ }), /* 7 */ -/***/ function(module, exports, __webpack_require__) { +/***/ (function(module, exports, __webpack_require__) { var $ = __webpack_require__(8); module.exports = function defineProperty(it, key, desc){ return $.setDesc(it, key, desc); }; -/***/ }, +/***/ }), /* 8 */ -/***/ function(module, exports) { +/***/ (function(module, exports) { var $Object = Object; module.exports = { @@ -509,9 +510,9 @@ return /******/ function(modules) { // webpackBootstrap each: [].forEach }; -/***/ }, +/***/ }), /* 9 */ -/***/ function(module, exports, __webpack_require__) { +/***/ (function(module, exports, __webpack_require__) { 'use strict'; @@ -558,9 +559,9 @@ return /******/ function(modules) { // webpackBootstrap _helpersWith2['default'](instance); } -/***/ }, +/***/ }), /* 10 */ -/***/ function(module, exports, __webpack_require__) { +/***/ (function(module, exports, __webpack_require__) { 'use strict'; @@ -601,9 +602,9 @@ return /******/ function(modules) { // webpackBootstrap module.exports = exports['default']; -/***/ }, +/***/ }), /* 11 */ -/***/ function(module, exports, __webpack_require__) { +/***/ (function(module, exports, __webpack_require__) { 'use strict'; @@ -698,9 +699,9 @@ return /******/ function(modules) { // webpackBootstrap module.exports = exports['default']; -/***/ }, +/***/ }), /* 12 */ -/***/ function(module, exports, __webpack_require__) { +/***/ (function(module, exports, __webpack_require__) { 'use strict'; @@ -726,9 +727,9 @@ return /******/ function(modules) { // webpackBootstrap module.exports = exports['default']; -/***/ }, +/***/ }), /* 13 */ -/***/ function(module, exports, __webpack_require__) { +/***/ (function(module, exports, __webpack_require__) { 'use strict'; @@ -759,9 +760,9 @@ return /******/ function(modules) { // webpackBootstrap module.exports = exports['default']; -/***/ }, +/***/ }), /* 14 */ -/***/ function(module, exports) { +/***/ (function(module, exports) { 'use strict'; @@ -789,9 +790,9 @@ return /******/ function(modules) { // webpackBootstrap module.exports = exports['default']; -/***/ }, +/***/ }), /* 15 */ -/***/ function(module, exports) { +/***/ (function(module, exports) { 'use strict'; @@ -805,9 +806,9 @@ return /******/ function(modules) { // webpackBootstrap module.exports = exports['default']; -/***/ }, +/***/ }), /* 16 */ -/***/ function(module, exports, __webpack_require__) { +/***/ (function(module, exports, __webpack_require__) { 'use strict'; @@ -842,9 +843,9 @@ return /******/ function(modules) { // webpackBootstrap module.exports = exports['default']; -/***/ }, +/***/ }), /* 17 */ -/***/ function(module, exports, __webpack_require__) { +/***/ (function(module, exports, __webpack_require__) { 'use strict'; @@ -861,9 +862,9 @@ return /******/ function(modules) { // webpackBootstrap _decoratorsInline2['default'](instance); } -/***/ }, +/***/ }), /* 18 */ -/***/ function(module, exports, __webpack_require__) { +/***/ (function(module, exports, __webpack_require__) { 'use strict'; @@ -894,9 +895,9 @@ return /******/ function(modules) { // webpackBootstrap module.exports = exports['default']; -/***/ }, +/***/ }), /* 19 */ -/***/ function(module, exports, __webpack_require__) { +/***/ (function(module, exports, __webpack_require__) { 'use strict'; @@ -945,9 +946,9 @@ return /******/ function(modules) { // webpackBootstrap exports['default'] = logger; module.exports = exports['default']; -/***/ }, +/***/ }), /* 20 */ -/***/ function(module, exports) { +/***/ (function(module, exports) { // Build out our basic SafeString type 'use strict'; @@ -964,9 +965,9 @@ return /******/ function(modules) { // webpackBootstrap exports['default'] = SafeString; module.exports = exports['default']; -/***/ }, +/***/ }), /* 21 */ -/***/ function(module, exports, __webpack_require__) { +/***/ (function(module, exports, __webpack_require__) { 'use strict'; @@ -1274,22 +1275,22 @@ return /******/ function(modules) { // webpackBootstrap return prog; } -/***/ }, +/***/ }), /* 22 */ -/***/ function(module, exports, __webpack_require__) { +/***/ (function(module, exports, __webpack_require__) { module.exports = { "default": __webpack_require__(23), __esModule: true }; -/***/ }, +/***/ }), /* 23 */ -/***/ function(module, exports, __webpack_require__) { +/***/ (function(module, exports, __webpack_require__) { __webpack_require__(24); module.exports = __webpack_require__(29).Object.seal; -/***/ }, +/***/ }), /* 24 */ -/***/ function(module, exports, __webpack_require__) { +/***/ (function(module, exports, __webpack_require__) { // 19.1.2.17 Object.seal(O) var isObject = __webpack_require__(25); @@ -1300,17 +1301,17 @@ return /******/ function(modules) { // webpackBootstrap }; }); -/***/ }, +/***/ }), /* 25 */ -/***/ function(module, exports) { +/***/ (function(module, exports) { module.exports = function(it){ return typeof it === 'object' ? it !== null : typeof it === 'function'; }; -/***/ }, +/***/ }), /* 26 */ -/***/ function(module, exports, __webpack_require__) { +/***/ (function(module, exports, __webpack_require__) { // most Object methods by ES6 should accept primitives var $export = __webpack_require__(27) @@ -1323,9 +1324,9 @@ return /******/ function(modules) { // webpackBootstrap $export($export.S + $export.F * fails(function(){ fn(1); }), 'Object', exp); }; -/***/ }, +/***/ }), /* 27 */ -/***/ function(module, exports, __webpack_require__) { +/***/ (function(module, exports, __webpack_require__) { var global = __webpack_require__(28) , core = __webpack_require__(29) @@ -1374,25 +1375,25 @@ return /******/ function(modules) { // webpackBootstrap $export.W = 32; // wrap module.exports = $export; -/***/ }, +/***/ }), /* 28 */ -/***/ function(module, exports) { +/***/ (function(module, exports) { // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028 var global = module.exports = typeof window != 'undefined' && window.Math == Math ? window : typeof self != 'undefined' && self.Math == Math ? self : Function('return this')(); if(typeof __g == 'number')__g = global; // eslint-disable-line no-undef -/***/ }, +/***/ }), /* 29 */ -/***/ function(module, exports) { +/***/ (function(module, exports) { var core = module.exports = {version: '1.2.6'}; if(typeof __e == 'number')__e = core; // eslint-disable-line no-undef -/***/ }, +/***/ }), /* 30 */ -/***/ function(module, exports, __webpack_require__) { +/***/ (function(module, exports, __webpack_require__) { // optional / simple context binding var aFunction = __webpack_require__(31); @@ -1415,18 +1416,18 @@ return /******/ function(modules) { // webpackBootstrap }; }; -/***/ }, +/***/ }), /* 31 */ -/***/ function(module, exports) { +/***/ (function(module, exports) { module.exports = function(it){ if(typeof it != 'function')throw TypeError(it + ' is not a function!'); return it; }; -/***/ }, +/***/ }), /* 32 */ -/***/ function(module, exports) { +/***/ (function(module, exports) { module.exports = function(exec){ try { @@ -1436,9 +1437,9 @@ return /******/ function(modules) { // webpackBootstrap } }; -/***/ }, +/***/ }), /* 33 */ -/***/ function(module, exports) { +/***/ (function(module, exports) { /* WEBPACK VAR INJECTION */(function(global) {/* global window */ 'use strict'; @@ -1461,7 +1462,7 @@ return /******/ function(modules) { // webpackBootstrap module.exports = exports['default']; /* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }()))) -/***/ } +/***/ }) /******/ ]) -}; +}); ; \ No newline at end of file From 4870314ea36fecf35cb040d21ad2ca14bdcb1da1 Mon Sep 17 00:00:00 2001 From: Alex Riedler Date: Tue, 19 Feb 2019 22:05:25 -0500 Subject: [PATCH 61/81] Bump handlebars_assets to 0.23.3 --- lib/handlebars_assets/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/handlebars_assets/version.rb b/lib/handlebars_assets/version.rb index 68953c4..27beab8 100644 --- a/lib/handlebars_assets/version.rb +++ b/lib/handlebars_assets/version.rb @@ -1,3 +1,3 @@ module HandlebarsAssets - VERSION = "0.23.2" + VERSION = "0.23.3" end From c913bb1b68ffe2318b5794d09732da3fe006244c Mon Sep 17 00:00:00 2001 From: Nick Smith Date: Fri, 31 May 2019 14:18:58 -0500 Subject: [PATCH 62/81] Update to 4.1.2 to fix https://www.npmjs.com/advisories/755 --- vendor/assets/javascripts/handlebars.js | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/vendor/assets/javascripts/handlebars.js b/vendor/assets/javascripts/handlebars.js index 9df337f..6ccf977 100644 --- a/vendor/assets/javascripts/handlebars.js +++ b/vendor/assets/javascripts/handlebars.js @@ -1,7 +1,7 @@ /**! @license - handlebars v4.1.0 + handlebars v4.1.2 Copyright (C) 2011-2017 by Yehuda Katz @@ -275,7 +275,7 @@ return /******/ (function(modules) { // webpackBootstrap var _logger2 = _interopRequireDefault(_logger); - var VERSION = '4.1.0'; + var VERSION = '4.1.2'; exports.VERSION = VERSION; var COMPILER_REVISION = 7; @@ -868,7 +868,13 @@ return /******/ (function(modules) { // webpackBootstrap exports['default'] = function (instance) { instance.registerHelper('lookup', function (obj, field) { - return obj && obj[field]; + if (!obj) { + return obj; + } + if (field === 'constructor' && !obj.propertyIsEnumerable(field)) { + return undefined; + } + return obj[field]; }); }; @@ -2169,7 +2175,7 @@ return /******/ (function(modules) { // webpackBootstrap lexer.performAction = function anonymous(yy, yy_, $avoiding_name_collisions, YY_START) { function strip(start, end) { - return yy_.yytext = yy_.yytext.substr(start, yy_.yyleng - end); + return yy_.yytext = yy_.yytext.substring(start, yy_.yyleng - end + start); } var YYSTATE = YY_START; @@ -2206,7 +2212,7 @@ return /******/ (function(modules) { // webpackBootstrap if (this.conditionStack[this.conditionStack.length - 1] === 'raw') { return 15; } else { - yy_.yytext = yy_.yytext.substr(5, yy_.yyleng - 9); + strip(5, 9); return 'END_RAW_BLOCK'; } @@ -2770,7 +2776,7 @@ return /******/ (function(modules) { // webpackBootstrap function id(token) { if (/^\[.*\]$/.test(token)) { - return token.substr(1, token.length - 2); + return token.substring(1, token.length - 1); } else { return token; } @@ -4836,4 +4842,4 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }) /******/ ]) }); -; \ No newline at end of file +; From 0b69711fba56e11444c8f7d4ee57362ce16bb4b5 Mon Sep 17 00:00:00 2001 From: Nick Smith Date: Fri, 31 May 2019 14:20:30 -0500 Subject: [PATCH 63/81] Update to 4.1.2 to fix https://www.npmjs.com/advisories/755 --- vendor/assets/javascripts/handlebars.runtime.js | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/vendor/assets/javascripts/handlebars.runtime.js b/vendor/assets/javascripts/handlebars.runtime.js index 5ad00c3..3b0d60a 100644 --- a/vendor/assets/javascripts/handlebars.runtime.js +++ b/vendor/assets/javascripts/handlebars.runtime.js @@ -1,7 +1,7 @@ /**! @license - handlebars v4.1.0 + handlebars v4.1.2 Copyright (C) 2011-2017 by Yehuda Katz @@ -207,7 +207,7 @@ return /******/ (function(modules) { // webpackBootstrap var _logger2 = _interopRequireDefault(_logger); - var VERSION = '4.1.0'; + var VERSION = '4.1.2'; exports.VERSION = VERSION; var COMPILER_REVISION = 7; @@ -800,7 +800,13 @@ return /******/ (function(modules) { // webpackBootstrap exports['default'] = function (instance) { instance.registerHelper('lookup', function (obj, field) { - return obj && obj[field]; + if (!obj) { + return obj; + } + if (field === 'constructor' && !obj.propertyIsEnumerable(field)) { + return undefined; + } + return obj[field]; }); }; @@ -1465,4 +1471,4 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }) /******/ ]) }); -; \ No newline at end of file +; From c27bc4b21b90fe706d03a95baefc222615078e8d Mon Sep 17 00:00:00 2001 From: Alex Riedler Date: Sat, 1 Jun 2019 18:36:48 -0400 Subject: [PATCH 64/81] Bump handlebars_assets to 0.23.4 --- lib/handlebars_assets/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/handlebars_assets/version.rb b/lib/handlebars_assets/version.rb index 27beab8..f573ab6 100644 --- a/lib/handlebars_assets/version.rb +++ b/lib/handlebars_assets/version.rb @@ -1,3 +1,3 @@ module HandlebarsAssets - VERSION = "0.23.3" + VERSION = "0.23.4" end From 8715830ad4a373bb3a649e358c6c42af87ca7b4b Mon Sep 17 00:00:00 2001 From: Alex Riedler Date: Mon, 3 Jun 2019 19:03:21 -0400 Subject: [PATCH 65/81] Update CHANGELOG.md --- CHANGELOG.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index e000254..efce246 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,11 @@ +## 0.23.3 (2019-02-20) + +* Update Handlebars to v4.1.2 + +## 0.23.3 (2019-02-20) + +* Update Handlebars to v4.1.0 + ## 0.23.2 (2017-05-07) * Remove requirement for MultiJSON From fdfeb9f645fa6e3c6656104de9a80e918dc22ce2 Mon Sep 17 00:00:00 2001 From: SrinandanPai Date: Tue, 4 Jun 2019 17:15:00 +0530 Subject: [PATCH 66/81] Corrected 0.23.4 version in CHANGELOG.md --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index efce246..57c5c2c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,4 @@ -## 0.23.3 (2019-02-20) +## 0.23.4 (2019-06-03) * Update Handlebars to v4.1.2 From 5011aa9b1d10c225c6124997071c84e078fdcb92 Mon Sep 17 00:00:00 2001 From: Alex Riedler Date: Wed, 25 Sep 2019 19:09:27 -0400 Subject: [PATCH 67/81] Upgrade Handlebars.js to v4.3.1 --- vendor/assets/javascripts/handlebars.js | 121 ++++++++++++------ .../assets/javascripts/handlebars.runtime.js | 86 ++++++++----- 2 files changed, 137 insertions(+), 70 deletions(-) diff --git a/vendor/assets/javascripts/handlebars.js b/vendor/assets/javascripts/handlebars.js index 6ccf977..0d8445c 100644 --- a/vendor/assets/javascripts/handlebars.js +++ b/vendor/assets/javascripts/handlebars.js @@ -1,7 +1,7 @@ /**! @license - handlebars v4.1.2 + handlebars v4.3.1 Copyright (C) 2011-2017 by Yehuda Katz @@ -275,11 +275,13 @@ return /******/ (function(modules) { // webpackBootstrap var _logger2 = _interopRequireDefault(_logger); - var VERSION = '4.1.2'; + var VERSION = '4.3.1'; exports.VERSION = VERSION; - var COMPILER_REVISION = 7; - + var COMPILER_REVISION = 8; exports.COMPILER_REVISION = COMPILER_REVISION; + var LAST_COMPATIBLE_COMPILER_REVISION = 7; + + exports.LAST_COMPATIBLE_COMPILER_REVISION = LAST_COMPATIBLE_COMPILER_REVISION; var REVISION_CHANGES = { 1: '<= 1.0.rc.2', // 1.0.rc.2 is actually rev2 but doesn't report it 2: '== 1.0.0-rc.3', @@ -287,7 +289,8 @@ return /******/ (function(modules) { // webpackBootstrap 4: '== 1.x.x', 5: '== 2.0.0-alpha.x', 6: '>= 2.0.0-beta.1', - 7: '>= 4.0.0' + 7: '>= 4.0.0 <4.3.0', + 8: '>= 4.3.0' }; exports.REVISION_CHANGES = REVISION_CHANGES; @@ -371,6 +374,7 @@ return /******/ (function(modules) { // webpackBootstrap exports.createFrame = createFrame; exports.blockParams = blockParams; exports.appendContextPath = appendContextPath; + var escape = { '&': '&', '<': '<', @@ -588,6 +592,7 @@ return /******/ (function(modules) { // webpackBootstrap exports.__esModule = true; exports.registerDefaultHelpers = registerDefaultHelpers; + exports.moveHelperToHooks = moveHelperToHooks; var _helpersBlockHelperMissing = __webpack_require__(11); @@ -627,6 +632,15 @@ return /******/ (function(modules) { // webpackBootstrap _helpersWith2['default'](instance); } + function moveHelperToHooks(instance, helperName, keepHelper) { + if (instance.helpers[helperName]) { + instance.hooks[helperName] = instance.helpers[helperName]; + if (!keepHelper) { + delete instance.helpers[helperName]; + } + } + } + /***/ }), /* 11 */ /***/ (function(module, exports, __webpack_require__) { @@ -1069,23 +1083,28 @@ return /******/ (function(modules) { // webpackBootstrap var _base = __webpack_require__(4); + var _helpers = __webpack_require__(10); + function checkRevision(compilerInfo) { var compilerRevision = compilerInfo && compilerInfo[0] || 1, currentRevision = _base.COMPILER_REVISION; - if (compilerRevision !== currentRevision) { - if (compilerRevision < currentRevision) { - var runtimeVersions = _base.REVISION_CHANGES[currentRevision], - compilerVersions = _base.REVISION_CHANGES[compilerRevision]; - throw new _exception2['default']('Template was precompiled with an older version of Handlebars than the current runtime. ' + 'Please update your precompiler to a newer version (' + runtimeVersions + ') or downgrade your runtime to an older version (' + compilerVersions + ').'); - } else { - // Use the embedded version info since the runtime doesn't know about this revision yet - throw new _exception2['default']('Template was precompiled with a newer version of Handlebars than the current runtime. ' + 'Please update your runtime to a newer version (' + compilerInfo[1] + ').'); - } + if (compilerRevision >= _base.LAST_COMPATIBLE_COMPILER_REVISION && compilerRevision <= _base.COMPILER_REVISION) { + return; + } + + if (compilerRevision < _base.LAST_COMPATIBLE_COMPILER_REVISION) { + var runtimeVersions = _base.REVISION_CHANGES[currentRevision], + compilerVersions = _base.REVISION_CHANGES[compilerRevision]; + throw new _exception2['default']('Template was precompiled with an older version of Handlebars than the current runtime. ' + 'Please update your precompiler to a newer version (' + runtimeVersions + ') or downgrade your runtime to an older version (' + compilerVersions + ').'); + } else { + // Use the embedded version info since the runtime doesn't know about this revision yet + throw new _exception2['default']('Template was precompiled with a newer version of Handlebars than the current runtime. ' + 'Please update your runtime to a newer version (' + compilerInfo[1] + ').'); } } function template(templateSpec, env) { + /* istanbul ignore next */ if (!env) { throw new _exception2['default']('No environment passed to template'); @@ -1097,9 +1116,12 @@ return /******/ (function(modules) { // webpackBootstrap templateSpec.main.decorator = templateSpec.main_d; // Note: Using env.VM references rather than local var references throughout this section to allow - // for external users to override these as psuedo-supported APIs. + // for external users to override these as pseudo-supported APIs. env.VM.checkRevision(templateSpec.compiler); + // backwards compatibility for precompiled templates with compiler-version 7 (<4.3.0) + var templateWasPrecompiledWithCompilerV7 = templateSpec.compiler && templateSpec.compiler[0] === 7; + function invokePartialWrapper(partial, context, options) { if (options.hash) { context = Utils.extend({}, context, options.hash); @@ -1107,13 +1129,15 @@ return /******/ (function(modules) { // webpackBootstrap options.ids[0] = true; } } - partial = env.VM.resolvePartial.call(this, partial, context, options); - var result = env.VM.invokePartial.call(this, partial, context, options); + + var optionsWithHooks = Utils.extend({}, options, { hooks: this.hooks }); + + var result = env.VM.invokePartial.call(this, partial, context, optionsWithHooks); if (result == null && env.compile) { options.partials[options.name] = env.compile(partial, templateSpec.compilerOptions, env); - result = options.partials[options.name](context, options); + result = options.partials[options.name](context, optionsWithHooks); } if (result != null) { if (options.indent) { @@ -1180,15 +1204,6 @@ return /******/ (function(modules) { // webpackBootstrap } return value; }, - merge: function merge(param, common) { - var obj = param || common; - - if (param && common && param !== common) { - obj = Utils.extend({}, common, param); - } - - return obj; - }, // An empty object to use as replacement for null-contexts nullContext: _Object$seal({}), @@ -1225,18 +1240,25 @@ return /******/ (function(modules) { // webpackBootstrap ret._setup = function (options) { if (!options.partial) { - container.helpers = container.merge(options.helpers, env.helpers); + container.helpers = Utils.extend({}, env.helpers, options.helpers); if (templateSpec.usePartial) { - container.partials = container.merge(options.partials, env.partials); + container.partials = Utils.extend({}, env.partials, options.partials); } if (templateSpec.usePartial || templateSpec.useDecorators) { - container.decorators = container.merge(options.decorators, env.decorators); + container.decorators = Utils.extend({}, env.decorators, options.decorators); } + + container.hooks = {}; + + var keepHelperInHelpers = options.allowCallsToHelperMissing || templateWasPrecompiledWithCompilerV7; + _helpers.moveHelperToHooks(container, 'helperMissing', keepHelperInHelpers); + _helpers.moveHelperToHooks(container, 'blockHelperMissing', keepHelperInHelpers); } else { container.helpers = options.helpers; container.partials = options.partials; container.decorators = options.decorators; + container.hooks = options.hooks; } }; @@ -1273,6 +1295,10 @@ return /******/ (function(modules) { // webpackBootstrap return prog; } + /** + * This is currently part of the official API, therefore implementation details should not be changed. + */ + function resolvePartial(partial, context, options) { if (!partial) { if (options.name === '@partial-block') { @@ -2575,7 +2601,7 @@ return /******/ (function(modules) { // webpackBootstrap return; } - // We omit the last node if it's whitespace only and not preceeded by a non-content node. + // We omit the last node if it's whitespace only and not preceded by a non-content node. var original = current.value; current.value = current.value.replace(multiple ? /\s+$/ : /[ \t]+$/, ''); current.leftStripped = current.value !== original; @@ -3867,7 +3893,7 @@ return /******/ (function(modules) { // webpackBootstrap // replace it on the stack with the result of properly // invoking blockHelperMissing. blockValue: function blockValue(name) { - var blockHelperMissing = this.aliasable('helpers.blockHelperMissing'), + var blockHelperMissing = this.aliasable('container.hooks.blockHelperMissing'), params = [this.contextName(0)]; this.setupHelperArgs(name, 0, params); @@ -3885,7 +3911,7 @@ return /******/ (function(modules) { // webpackBootstrap // On stack, after, if lastHelper: value ambiguousBlockValue: function ambiguousBlockValue() { // We're being a bit cheeky and reusing the options value from the prior exec - var blockHelperMissing = this.aliasable('helpers.blockHelperMissing'), + var blockHelperMissing = this.aliasable('container.hooks.blockHelperMissing'), params = [this.contextName(0)]; this.setupHelperArgs('', 0, params, true); @@ -4176,18 +4202,33 @@ return /******/ (function(modules) { // webpackBootstrap // If the helper is not found, `helperMissing` is called. invokeHelper: function invokeHelper(paramSize, name, isSimple) { var nonHelper = this.popStack(), - helper = this.setupHelper(paramSize, name), - simple = isSimple ? [helper.name, ' || '] : ''; + helper = this.setupHelper(paramSize, name); - var lookup = ['('].concat(simple, nonHelper); + var possibleFunctionCalls = []; + + if (isSimple) { + // direct call to helper + possibleFunctionCalls.push(helper.name); + } + // call a function from the input object + possibleFunctionCalls.push(nonHelper); if (!this.options.strict) { - lookup.push(' || ', this.aliasable('helpers.helperMissing')); + possibleFunctionCalls.push(this.aliasable('container.hooks.helperMissing')); } - lookup.push(')'); - this.push(this.source.functionCall(lookup, 'call', helper.callParams)); + var functionLookupCode = ['(', this.itemsSeparatedBy(possibleFunctionCalls, '||'), ')']; + var functionCall = this.source.functionCall(functionLookupCode, 'call', helper.callParams); + this.push(functionCall); }, + itemsSeparatedBy: function itemsSeparatedBy(items, separator) { + var result = []; + result.push(items[0]); + for (var i = 1; i < items.length; i++) { + result.push(separator, items[i]); + } + return result; + }, // [invokeKnownHelper] // // On stack, before: hash, inverse, program, params..., ... @@ -4225,7 +4266,7 @@ return /******/ (function(modules) { // webpackBootstrap var lookup = ['(', '(helper = ', helperName, ' || ', nonHelper, ')']; if (!this.options.strict) { lookup[0] = '(helper = '; - lookup.push(' != null ? helper : ', this.aliasable('helpers.helperMissing')); + lookup.push(' != null ? helper : ', this.aliasable('container.hooks.helperMissing')); } this.push(['(', lookup, helper.paramsInit ? ['),(', helper.paramsInit] : [], '),', '(typeof helper === ', this.aliasable('"function"'), ' ? ', this.source.functionCall('helper', 'call', helper.callParams), ' : helper))']); diff --git a/vendor/assets/javascripts/handlebars.runtime.js b/vendor/assets/javascripts/handlebars.runtime.js index 3b0d60a..518e0cd 100644 --- a/vendor/assets/javascripts/handlebars.runtime.js +++ b/vendor/assets/javascripts/handlebars.runtime.js @@ -1,7 +1,7 @@ /**! @license - handlebars v4.1.2 + handlebars v4.3.1 Copyright (C) 2011-2017 by Yehuda Katz @@ -207,11 +207,13 @@ return /******/ (function(modules) { // webpackBootstrap var _logger2 = _interopRequireDefault(_logger); - var VERSION = '4.1.2'; + var VERSION = '4.3.1'; exports.VERSION = VERSION; - var COMPILER_REVISION = 7; - + var COMPILER_REVISION = 8; exports.COMPILER_REVISION = COMPILER_REVISION; + var LAST_COMPATIBLE_COMPILER_REVISION = 7; + + exports.LAST_COMPATIBLE_COMPILER_REVISION = LAST_COMPATIBLE_COMPILER_REVISION; var REVISION_CHANGES = { 1: '<= 1.0.rc.2', // 1.0.rc.2 is actually rev2 but doesn't report it 2: '== 1.0.0-rc.3', @@ -219,7 +221,8 @@ return /******/ (function(modules) { // webpackBootstrap 4: '== 1.x.x', 5: '== 2.0.0-alpha.x', 6: '>= 2.0.0-beta.1', - 7: '>= 4.0.0' + 7: '>= 4.0.0 <4.3.0', + 8: '>= 4.3.0' }; exports.REVISION_CHANGES = REVISION_CHANGES; @@ -303,6 +306,7 @@ return /******/ (function(modules) { // webpackBootstrap exports.createFrame = createFrame; exports.blockParams = blockParams; exports.appendContextPath = appendContextPath; + var escape = { '&': '&', '<': '<', @@ -520,6 +524,7 @@ return /******/ (function(modules) { // webpackBootstrap exports.__esModule = true; exports.registerDefaultHelpers = registerDefaultHelpers; + exports.moveHelperToHooks = moveHelperToHooks; var _helpersBlockHelperMissing = __webpack_require__(10); @@ -559,6 +564,15 @@ return /******/ (function(modules) { // webpackBootstrap _helpersWith2['default'](instance); } + function moveHelperToHooks(instance, helperName, keepHelper) { + if (instance.helpers[helperName]) { + instance.hooks[helperName] = instance.helpers[helperName]; + if (!keepHelper) { + delete instance.helpers[helperName]; + } + } + } + /***/ }), /* 10 */ /***/ (function(module, exports, __webpack_require__) { @@ -1001,23 +1015,28 @@ return /******/ (function(modules) { // webpackBootstrap var _base = __webpack_require__(3); + var _helpers = __webpack_require__(9); + function checkRevision(compilerInfo) { var compilerRevision = compilerInfo && compilerInfo[0] || 1, currentRevision = _base.COMPILER_REVISION; - if (compilerRevision !== currentRevision) { - if (compilerRevision < currentRevision) { - var runtimeVersions = _base.REVISION_CHANGES[currentRevision], - compilerVersions = _base.REVISION_CHANGES[compilerRevision]; - throw new _exception2['default']('Template was precompiled with an older version of Handlebars than the current runtime. ' + 'Please update your precompiler to a newer version (' + runtimeVersions + ') or downgrade your runtime to an older version (' + compilerVersions + ').'); - } else { - // Use the embedded version info since the runtime doesn't know about this revision yet - throw new _exception2['default']('Template was precompiled with a newer version of Handlebars than the current runtime. ' + 'Please update your runtime to a newer version (' + compilerInfo[1] + ').'); - } + if (compilerRevision >= _base.LAST_COMPATIBLE_COMPILER_REVISION && compilerRevision <= _base.COMPILER_REVISION) { + return; + } + + if (compilerRevision < _base.LAST_COMPATIBLE_COMPILER_REVISION) { + var runtimeVersions = _base.REVISION_CHANGES[currentRevision], + compilerVersions = _base.REVISION_CHANGES[compilerRevision]; + throw new _exception2['default']('Template was precompiled with an older version of Handlebars than the current runtime. ' + 'Please update your precompiler to a newer version (' + runtimeVersions + ') or downgrade your runtime to an older version (' + compilerVersions + ').'); + } else { + // Use the embedded version info since the runtime doesn't know about this revision yet + throw new _exception2['default']('Template was precompiled with a newer version of Handlebars than the current runtime. ' + 'Please update your runtime to a newer version (' + compilerInfo[1] + ').'); } } function template(templateSpec, env) { + /* istanbul ignore next */ if (!env) { throw new _exception2['default']('No environment passed to template'); @@ -1029,9 +1048,12 @@ return /******/ (function(modules) { // webpackBootstrap templateSpec.main.decorator = templateSpec.main_d; // Note: Using env.VM references rather than local var references throughout this section to allow - // for external users to override these as psuedo-supported APIs. + // for external users to override these as pseudo-supported APIs. env.VM.checkRevision(templateSpec.compiler); + // backwards compatibility for precompiled templates with compiler-version 7 (<4.3.0) + var templateWasPrecompiledWithCompilerV7 = templateSpec.compiler && templateSpec.compiler[0] === 7; + function invokePartialWrapper(partial, context, options) { if (options.hash) { context = Utils.extend({}, context, options.hash); @@ -1039,13 +1061,15 @@ return /******/ (function(modules) { // webpackBootstrap options.ids[0] = true; } } - partial = env.VM.resolvePartial.call(this, partial, context, options); - var result = env.VM.invokePartial.call(this, partial, context, options); + + var optionsWithHooks = Utils.extend({}, options, { hooks: this.hooks }); + + var result = env.VM.invokePartial.call(this, partial, context, optionsWithHooks); if (result == null && env.compile) { options.partials[options.name] = env.compile(partial, templateSpec.compilerOptions, env); - result = options.partials[options.name](context, options); + result = options.partials[options.name](context, optionsWithHooks); } if (result != null) { if (options.indent) { @@ -1112,15 +1136,6 @@ return /******/ (function(modules) { // webpackBootstrap } return value; }, - merge: function merge(param, common) { - var obj = param || common; - - if (param && common && param !== common) { - obj = Utils.extend({}, common, param); - } - - return obj; - }, // An empty object to use as replacement for null-contexts nullContext: _Object$seal({}), @@ -1157,18 +1172,25 @@ return /******/ (function(modules) { // webpackBootstrap ret._setup = function (options) { if (!options.partial) { - container.helpers = container.merge(options.helpers, env.helpers); + container.helpers = Utils.extend({}, env.helpers, options.helpers); if (templateSpec.usePartial) { - container.partials = container.merge(options.partials, env.partials); + container.partials = Utils.extend({}, env.partials, options.partials); } if (templateSpec.usePartial || templateSpec.useDecorators) { - container.decorators = container.merge(options.decorators, env.decorators); + container.decorators = Utils.extend({}, env.decorators, options.decorators); } + + container.hooks = {}; + + var keepHelperInHelpers = options.allowCallsToHelperMissing || templateWasPrecompiledWithCompilerV7; + _helpers.moveHelperToHooks(container, 'helperMissing', keepHelperInHelpers); + _helpers.moveHelperToHooks(container, 'blockHelperMissing', keepHelperInHelpers); } else { container.helpers = options.helpers; container.partials = options.partials; container.decorators = options.decorators; + container.hooks = options.hooks; } }; @@ -1205,6 +1227,10 @@ return /******/ (function(modules) { // webpackBootstrap return prog; } + /** + * This is currently part of the official API, therefore implementation details should not be changed. + */ + function resolvePartial(partial, context, options) { if (!partial) { if (options.name === '@partial-block') { From a7742a8cf56c03919cae701a2a4743c3f32a3d2d Mon Sep 17 00:00:00 2001 From: Alex Riedler Date: Wed, 25 Sep 2019 19:16:16 -0400 Subject: [PATCH 68/81] Bump handlebars_assets to 0.23.5 --- CHANGELOG.md | 4 ++++ lib/handlebars_assets/version.rb | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 57c5c2c..7df0241 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.23.5 (2019-09-25) + +* Update Handlebars to v4.3.1 + ## 0.23.4 (2019-06-03) * Update Handlebars to v4.1.2 diff --git a/lib/handlebars_assets/version.rb b/lib/handlebars_assets/version.rb index f573ab6..0704b30 100644 --- a/lib/handlebars_assets/version.rb +++ b/lib/handlebars_assets/version.rb @@ -1,3 +1,3 @@ module HandlebarsAssets - VERSION = "0.23.4" + VERSION = "0.23.5" end From dd35c8e46f8cec349d5e097008740fc280c80146 Mon Sep 17 00:00:00 2001 From: Elaine Date: Fri, 1 Nov 2019 15:24:54 -0400 Subject: [PATCH 69/81] Fixed typo in README --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 05c5395..86e6e0d 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ Yea, I think so too. That is why I wrote **handlebars_assets**. Give your Handle Using `sprockets` with Sinatra or another framework? **handlebars_assets** works outside of Rails too (as of v0.2.0) -# BREAKING CHANGES AS OF OF v0.17 +# BREAKING CHANGES AS OF v0.17 @AlexRiedler has made some larger changes to this repository for going forward; If you have existing monkey patches they may not work, and the configuration schema has changed slightly to handle multiple extensions for the same compilation pipeline. From 7c9ac164db15f190c71e0bb2570143dfc7801387 Mon Sep 17 00:00:00 2001 From: Alex Riedler Date: Thu, 14 Nov 2019 20:11:20 -0500 Subject: [PATCH 70/81] Upgrade Handlebars.js to v4.5.2 --- vendor/assets/javascripts/handlebars.js | 109 ++++++++++++++---- .../assets/javascripts/handlebars.runtime.js | 61 ++++++++-- 2 files changed, 136 insertions(+), 34 deletions(-) diff --git a/vendor/assets/javascripts/handlebars.js b/vendor/assets/javascripts/handlebars.js index 0d8445c..76b8e43 100644 --- a/vendor/assets/javascripts/handlebars.js +++ b/vendor/assets/javascripts/handlebars.js @@ -1,7 +1,7 @@ /**! @license - handlebars v4.3.1 + handlebars v4.5.2 Copyright (C) 2011-2017 by Yehuda Katz @@ -128,6 +128,7 @@ return /******/ (function(modules) { // webpackBootstrap hb.JavaScriptCompiler = _handlebarsCompilerJavascriptCompiler2['default']; hb.Parser = _handlebarsCompilerBase.parser; hb.parse = _handlebarsCompilerBase.parse; + hb.parseWithoutProcessing = _handlebarsCompilerBase.parseWithoutProcessing; return hb; } @@ -275,7 +276,7 @@ return /******/ (function(modules) { // webpackBootstrap var _logger2 = _interopRequireDefault(_logger); - var VERSION = '4.3.1'; + var VERSION = '4.5.2'; exports.VERSION = VERSION; var COMPILER_REVISION = 8; exports.COMPILER_REVISION = COMPILER_REVISION; @@ -499,15 +500,20 @@ return /******/ (function(modules) { // webpackBootstrap exports.__esModule = true; - var errorProps = ['description', 'fileName', 'lineNumber', 'message', 'name', 'number', 'stack']; + var errorProps = ['description', 'fileName', 'lineNumber', 'endLineNumber', 'message', 'name', 'number', 'stack']; function Exception(message, node) { var loc = node && node.loc, line = undefined, - column = undefined; + endLineNumber = undefined, + column = undefined, + endColumn = undefined; + if (loc) { line = loc.start.line; + endLineNumber = loc.end.line; column = loc.start.column; + endColumn = loc.end.column; message += ' - ' + line + ':' + column; } @@ -527,6 +533,7 @@ return /******/ (function(modules) { // webpackBootstrap try { if (loc) { this.lineNumber = line; + this.endLineNumber = endLineNumber; // Work around issue under safari where we can't directly set the column value /* istanbul ignore next */ @@ -535,8 +542,13 @@ return /******/ (function(modules) { // webpackBootstrap value: column, enumerable: true }); + Object.defineProperty(this, 'endColumn', { + value: endColumn, + enumerable: true + }); } else { this.column = column; + this.endColumn = endColumn; } } } catch (nop) { @@ -688,7 +700,7 @@ return /******/ (function(modules) { // webpackBootstrap /* 12 */ /***/ (function(module, exports, __webpack_require__) { - 'use strict'; + /* WEBPACK VAR INJECTION */(function(global) {'use strict'; var _interopRequireDefault = __webpack_require__(1)['default']; @@ -750,6 +762,16 @@ return /******/ (function(modules) { // webpackBootstrap execIteration(i, i, i === context.length - 1); } } + } else if (global.Symbol && context[global.Symbol.iterator]) { + var newContext = []; + var iterator = context[global.Symbol.iterator](); + for (var it = iterator.next(); !it.done; it = iterator.next()) { + newContext.push(it.value); + } + context = newContext; + for (var j = context.length; i < j; i++) { + execIteration(i, i, i === context.length - 1); + } } else { var priorKey = undefined; @@ -780,6 +802,7 @@ return /******/ (function(modules) { // webpackBootstrap }; module.exports = exports['default']; + /* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }()))) /***/ }), /* 13 */ @@ -815,12 +838,21 @@ return /******/ (function(modules) { // webpackBootstrap 'use strict'; + var _interopRequireDefault = __webpack_require__(1)['default']; + exports.__esModule = true; var _utils = __webpack_require__(5); + var _exception = __webpack_require__(6); + + var _exception2 = _interopRequireDefault(_exception); + exports['default'] = function (instance) { instance.registerHelper('if', function (conditional, options) { + if (arguments.length != 2) { + throw new _exception2['default']('#if requires exactly one argument'); + } if (_utils.isFunction(conditional)) { conditional = conditional.call(this); } @@ -836,6 +868,9 @@ return /******/ (function(modules) { // webpackBootstrap }); instance.registerHelper('unless', function (conditional, options) { + if (arguments.length != 2) { + throw new _exception2['default']('#unless requires exactly one argument'); + } return instance.helpers['if'].call(this, conditional, { fn: options.inverse, inverse: options.fn, hash: options.hash }); }); }; @@ -885,7 +920,7 @@ return /******/ (function(modules) { // webpackBootstrap if (!obj) { return obj; } - if (field === 'constructor' && !obj.propertyIsEnumerable(field)) { + if (String(field) === 'constructor' && !obj.propertyIsEnumerable(field)) { return undefined; } return obj[field]; @@ -900,12 +935,21 @@ return /******/ (function(modules) { // webpackBootstrap 'use strict'; + var _interopRequireDefault = __webpack_require__(1)['default']; + exports.__esModule = true; var _utils = __webpack_require__(5); + var _exception = __webpack_require__(6); + + var _exception2 = _interopRequireDefault(_exception); + exports['default'] = function (instance) { instance.registerHelper('with', function (context, options) { + if (arguments.length != 2) { + throw new _exception2['default']('#with requires exactly one argument'); + } if (_utils.isFunction(context)) { context = context.call(this); } @@ -1159,9 +1203,9 @@ return /******/ (function(modules) { // webpackBootstrap // Just add water var container = { - strict: function strict(obj, name) { - if (!(name in obj)) { - throw new _exception2['default']('"' + name + '" not defined in ' + obj); + strict: function strict(obj, name, loc) { + if (!obj || !(name in obj)) { + throw new _exception2['default']('"' + name + '" not defined in ' + obj, { loc: loc }); } return obj[name]; }, @@ -1608,6 +1652,7 @@ return /******/ (function(modules) { // webpackBootstrap var _interopRequireWildcard = __webpack_require__(3)['default']; exports.__esModule = true; + exports.parseWithoutProcessing = parseWithoutProcessing; exports.parse = parse; var _parser = __webpack_require__(37); @@ -1629,7 +1674,7 @@ return /******/ (function(modules) { // webpackBootstrap var yy = {}; _utils.extend(yy, Helpers); - function parse(input, options) { + function parseWithoutProcessing(input, options) { // Just return if an already-compiled AST was passed in. if (input.type === 'Program') { return input; @@ -1642,8 +1687,16 @@ return /******/ (function(modules) { // webpackBootstrap return new yy.SourceLocation(options && options.srcName, locInfo); }; + var ast = _parser2['default'].parse(input); + + return ast; + } + + function parse(input, options) { + var ast = parseWithoutProcessing(input, options); var strip = new _whitespaceControl2['default'](options); - return strip.accept(_parser2['default'].parse(input)); + + return strip.accept(ast); } /***/ }), @@ -1658,9 +1711,9 @@ return /******/ (function(modules) { // webpackBootstrap var handlebars = (function () { var parser = { trace: function trace() {}, yy: {}, - symbols_: { "error": 2, "root": 3, "program": 4, "EOF": 5, "program_repetition0": 6, "statement": 7, "mustache": 8, "block": 9, "rawBlock": 10, "partial": 11, "partialBlock": 12, "content": 13, "COMMENT": 14, "CONTENT": 15, "openRawBlock": 16, "rawBlock_repetition_plus0": 17, "END_RAW_BLOCK": 18, "OPEN_RAW_BLOCK": 19, "helperName": 20, "openRawBlock_repetition0": 21, "openRawBlock_option0": 22, "CLOSE_RAW_BLOCK": 23, "openBlock": 24, "block_option0": 25, "closeBlock": 26, "openInverse": 27, "block_option1": 28, "OPEN_BLOCK": 29, "openBlock_repetition0": 30, "openBlock_option0": 31, "openBlock_option1": 32, "CLOSE": 33, "OPEN_INVERSE": 34, "openInverse_repetition0": 35, "openInverse_option0": 36, "openInverse_option1": 37, "openInverseChain": 38, "OPEN_INVERSE_CHAIN": 39, "openInverseChain_repetition0": 40, "openInverseChain_option0": 41, "openInverseChain_option1": 42, "inverseAndProgram": 43, "INVERSE": 44, "inverseChain": 45, "inverseChain_option0": 46, "OPEN_ENDBLOCK": 47, "OPEN": 48, "mustache_repetition0": 49, "mustache_option0": 50, "OPEN_UNESCAPED": 51, "mustache_repetition1": 52, "mustache_option1": 53, "CLOSE_UNESCAPED": 54, "OPEN_PARTIAL": 55, "partialName": 56, "partial_repetition0": 57, "partial_option0": 58, "openPartialBlock": 59, "OPEN_PARTIAL_BLOCK": 60, "openPartialBlock_repetition0": 61, "openPartialBlock_option0": 62, "param": 63, "sexpr": 64, "OPEN_SEXPR": 65, "sexpr_repetition0": 66, "sexpr_option0": 67, "CLOSE_SEXPR": 68, "hash": 69, "hash_repetition_plus0": 70, "hashSegment": 71, "ID": 72, "EQUALS": 73, "blockParams": 74, "OPEN_BLOCK_PARAMS": 75, "blockParams_repetition_plus0": 76, "CLOSE_BLOCK_PARAMS": 77, "path": 78, "dataName": 79, "STRING": 80, "NUMBER": 81, "BOOLEAN": 82, "UNDEFINED": 83, "NULL": 84, "DATA": 85, "pathSegments": 86, "SEP": 87, "$accept": 0, "$end": 1 }, + symbols_: { "error": 2, "root": 3, "program": 4, "EOF": 5, "program_repetition0": 6, "statement": 7, "mustache": 8, "block": 9, "rawBlock": 10, "partial": 11, "partialBlock": 12, "content": 13, "COMMENT": 14, "CONTENT": 15, "openRawBlock": 16, "rawBlock_repetition0": 17, "END_RAW_BLOCK": 18, "OPEN_RAW_BLOCK": 19, "helperName": 20, "openRawBlock_repetition0": 21, "openRawBlock_option0": 22, "CLOSE_RAW_BLOCK": 23, "openBlock": 24, "block_option0": 25, "closeBlock": 26, "openInverse": 27, "block_option1": 28, "OPEN_BLOCK": 29, "openBlock_repetition0": 30, "openBlock_option0": 31, "openBlock_option1": 32, "CLOSE": 33, "OPEN_INVERSE": 34, "openInverse_repetition0": 35, "openInverse_option0": 36, "openInverse_option1": 37, "openInverseChain": 38, "OPEN_INVERSE_CHAIN": 39, "openInverseChain_repetition0": 40, "openInverseChain_option0": 41, "openInverseChain_option1": 42, "inverseAndProgram": 43, "INVERSE": 44, "inverseChain": 45, "inverseChain_option0": 46, "OPEN_ENDBLOCK": 47, "OPEN": 48, "mustache_repetition0": 49, "mustache_option0": 50, "OPEN_UNESCAPED": 51, "mustache_repetition1": 52, "mustache_option1": 53, "CLOSE_UNESCAPED": 54, "OPEN_PARTIAL": 55, "partialName": 56, "partial_repetition0": 57, "partial_option0": 58, "openPartialBlock": 59, "OPEN_PARTIAL_BLOCK": 60, "openPartialBlock_repetition0": 61, "openPartialBlock_option0": 62, "param": 63, "sexpr": 64, "OPEN_SEXPR": 65, "sexpr_repetition0": 66, "sexpr_option0": 67, "CLOSE_SEXPR": 68, "hash": 69, "hash_repetition_plus0": 70, "hashSegment": 71, "ID": 72, "EQUALS": 73, "blockParams": 74, "OPEN_BLOCK_PARAMS": 75, "blockParams_repetition_plus0": 76, "CLOSE_BLOCK_PARAMS": 77, "path": 78, "dataName": 79, "STRING": 80, "NUMBER": 81, "BOOLEAN": 82, "UNDEFINED": 83, "NULL": 84, "DATA": 85, "pathSegments": 86, "SEP": 87, "$accept": 0, "$end": 1 }, terminals_: { 2: "error", 5: "EOF", 14: "COMMENT", 15: "CONTENT", 18: "END_RAW_BLOCK", 19: "OPEN_RAW_BLOCK", 23: "CLOSE_RAW_BLOCK", 29: "OPEN_BLOCK", 33: "CLOSE", 34: "OPEN_INVERSE", 39: "OPEN_INVERSE_CHAIN", 44: "INVERSE", 47: "OPEN_ENDBLOCK", 48: "OPEN", 51: "OPEN_UNESCAPED", 54: "CLOSE_UNESCAPED", 55: "OPEN_PARTIAL", 60: "OPEN_PARTIAL_BLOCK", 65: "OPEN_SEXPR", 68: "CLOSE_SEXPR", 72: "ID", 73: "EQUALS", 75: "OPEN_BLOCK_PARAMS", 77: "CLOSE_BLOCK_PARAMS", 80: "STRING", 81: "NUMBER", 82: "BOOLEAN", 83: "UNDEFINED", 84: "NULL", 85: "DATA", 87: "SEP" }, - productions_: [0, [3, 2], [4, 1], [7, 1], [7, 1], [7, 1], [7, 1], [7, 1], [7, 1], [7, 1], [13, 1], [10, 3], [16, 5], [9, 4], [9, 4], [24, 6], [27, 6], [38, 6], [43, 2], [45, 3], [45, 1], [26, 3], [8, 5], [8, 5], [11, 5], [12, 3], [59, 5], [63, 1], [63, 1], [64, 5], [69, 1], [71, 3], [74, 3], [20, 1], [20, 1], [20, 1], [20, 1], [20, 1], [20, 1], [20, 1], [56, 1], [56, 1], [79, 2], [78, 1], [86, 3], [86, 1], [6, 0], [6, 2], [17, 1], [17, 2], [21, 0], [21, 2], [22, 0], [22, 1], [25, 0], [25, 1], [28, 0], [28, 1], [30, 0], [30, 2], [31, 0], [31, 1], [32, 0], [32, 1], [35, 0], [35, 2], [36, 0], [36, 1], [37, 0], [37, 1], [40, 0], [40, 2], [41, 0], [41, 1], [42, 0], [42, 1], [46, 0], [46, 1], [49, 0], [49, 2], [50, 0], [50, 1], [52, 0], [52, 2], [53, 0], [53, 1], [57, 0], [57, 2], [58, 0], [58, 1], [61, 0], [61, 2], [62, 0], [62, 1], [66, 0], [66, 2], [67, 0], [67, 1], [70, 1], [70, 2], [76, 1], [76, 2]], + productions_: [0, [3, 2], [4, 1], [7, 1], [7, 1], [7, 1], [7, 1], [7, 1], [7, 1], [7, 1], [13, 1], [10, 3], [16, 5], [9, 4], [9, 4], [24, 6], [27, 6], [38, 6], [43, 2], [45, 3], [45, 1], [26, 3], [8, 5], [8, 5], [11, 5], [12, 3], [59, 5], [63, 1], [63, 1], [64, 5], [69, 1], [71, 3], [74, 3], [20, 1], [20, 1], [20, 1], [20, 1], [20, 1], [20, 1], [20, 1], [56, 1], [56, 1], [79, 2], [78, 1], [86, 3], [86, 1], [6, 0], [6, 2], [17, 0], [17, 2], [21, 0], [21, 2], [22, 0], [22, 1], [25, 0], [25, 1], [28, 0], [28, 1], [30, 0], [30, 2], [31, 0], [31, 1], [32, 0], [32, 1], [35, 0], [35, 2], [36, 0], [36, 1], [37, 0], [37, 1], [40, 0], [40, 2], [41, 0], [41, 1], [42, 0], [42, 1], [46, 0], [46, 1], [49, 0], [49, 2], [50, 0], [50, 1], [52, 0], [52, 2], [53, 0], [53, 1], [57, 0], [57, 2], [58, 0], [58, 1], [61, 0], [61, 2], [62, 0], [62, 1], [66, 0], [66, 2], [67, 0], [67, 1], [70, 1], [70, 2], [76, 1], [76, 2]], performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$) { var $0 = $$.length - 1; @@ -1840,7 +1893,7 @@ return /******/ (function(modules) { // webpackBootstrap $$[$0 - 1].push($$[$0]); break; case 48: - this.$ = [$$[$0]]; + this.$ = []; break; case 49: $$[$0 - 1].push($$[$0]); @@ -1913,8 +1966,8 @@ return /******/ (function(modules) { // webpackBootstrap break; } }, - table: [{ 3: 1, 4: 2, 5: [2, 46], 6: 3, 14: [2, 46], 15: [2, 46], 19: [2, 46], 29: [2, 46], 34: [2, 46], 48: [2, 46], 51: [2, 46], 55: [2, 46], 60: [2, 46] }, { 1: [3] }, { 5: [1, 4] }, { 5: [2, 2], 7: 5, 8: 6, 9: 7, 10: 8, 11: 9, 12: 10, 13: 11, 14: [1, 12], 15: [1, 20], 16: 17, 19: [1, 23], 24: 15, 27: 16, 29: [1, 21], 34: [1, 22], 39: [2, 2], 44: [2, 2], 47: [2, 2], 48: [1, 13], 51: [1, 14], 55: [1, 18], 59: 19, 60: [1, 24] }, { 1: [2, 1] }, { 5: [2, 47], 14: [2, 47], 15: [2, 47], 19: [2, 47], 29: [2, 47], 34: [2, 47], 39: [2, 47], 44: [2, 47], 47: [2, 47], 48: [2, 47], 51: [2, 47], 55: [2, 47], 60: [2, 47] }, { 5: [2, 3], 14: [2, 3], 15: [2, 3], 19: [2, 3], 29: [2, 3], 34: [2, 3], 39: [2, 3], 44: [2, 3], 47: [2, 3], 48: [2, 3], 51: [2, 3], 55: [2, 3], 60: [2, 3] }, { 5: [2, 4], 14: [2, 4], 15: [2, 4], 19: [2, 4], 29: [2, 4], 34: [2, 4], 39: [2, 4], 44: [2, 4], 47: [2, 4], 48: [2, 4], 51: [2, 4], 55: [2, 4], 60: [2, 4] }, { 5: [2, 5], 14: [2, 5], 15: [2, 5], 19: [2, 5], 29: [2, 5], 34: [2, 5], 39: [2, 5], 44: [2, 5], 47: [2, 5], 48: [2, 5], 51: [2, 5], 55: [2, 5], 60: [2, 5] }, { 5: [2, 6], 14: [2, 6], 15: [2, 6], 19: [2, 6], 29: [2, 6], 34: [2, 6], 39: [2, 6], 44: [2, 6], 47: [2, 6], 48: [2, 6], 51: [2, 6], 55: [2, 6], 60: [2, 6] }, { 5: [2, 7], 14: [2, 7], 15: [2, 7], 19: [2, 7], 29: [2, 7], 34: [2, 7], 39: [2, 7], 44: [2, 7], 47: [2, 7], 48: [2, 7], 51: [2, 7], 55: [2, 7], 60: [2, 7] }, { 5: [2, 8], 14: [2, 8], 15: [2, 8], 19: [2, 8], 29: [2, 8], 34: [2, 8], 39: [2, 8], 44: [2, 8], 47: [2, 8], 48: [2, 8], 51: [2, 8], 55: [2, 8], 60: [2, 8] }, { 5: [2, 9], 14: [2, 9], 15: [2, 9], 19: [2, 9], 29: [2, 9], 34: [2, 9], 39: [2, 9], 44: [2, 9], 47: [2, 9], 48: [2, 9], 51: [2, 9], 55: [2, 9], 60: [2, 9] }, { 20: 25, 72: [1, 35], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 20: 36, 72: [1, 35], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 4: 37, 6: 3, 14: [2, 46], 15: [2, 46], 19: [2, 46], 29: [2, 46], 34: [2, 46], 39: [2, 46], 44: [2, 46], 47: [2, 46], 48: [2, 46], 51: [2, 46], 55: [2, 46], 60: [2, 46] }, { 4: 38, 6: 3, 14: [2, 46], 15: [2, 46], 19: [2, 46], 29: [2, 46], 34: [2, 46], 44: [2, 46], 47: [2, 46], 48: [2, 46], 51: [2, 46], 55: [2, 46], 60: [2, 46] }, { 13: 40, 15: [1, 20], 17: 39 }, { 20: 42, 56: 41, 64: 43, 65: [1, 44], 72: [1, 35], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 4: 45, 6: 3, 14: [2, 46], 15: [2, 46], 19: [2, 46], 29: [2, 46], 34: [2, 46], 47: [2, 46], 48: [2, 46], 51: [2, 46], 55: [2, 46], 60: [2, 46] }, { 5: [2, 10], 14: [2, 10], 15: [2, 10], 18: [2, 10], 19: [2, 10], 29: [2, 10], 34: [2, 10], 39: [2, 10], 44: [2, 10], 47: [2, 10], 48: [2, 10], 51: [2, 10], 55: [2, 10], 60: [2, 10] }, { 20: 46, 72: [1, 35], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 20: 47, 72: [1, 35], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 20: 48, 72: [1, 35], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 20: 42, 56: 49, 64: 43, 65: [1, 44], 72: [1, 35], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 33: [2, 78], 49: 50, 65: [2, 78], 72: [2, 78], 80: [2, 78], 81: [2, 78], 82: [2, 78], 83: [2, 78], 84: [2, 78], 85: [2, 78] }, { 23: [2, 33], 33: [2, 33], 54: [2, 33], 65: [2, 33], 68: [2, 33], 72: [2, 33], 75: [2, 33], 80: [2, 33], 81: [2, 33], 82: [2, 33], 83: [2, 33], 84: [2, 33], 85: [2, 33] }, { 23: [2, 34], 33: [2, 34], 54: [2, 34], 65: [2, 34], 68: [2, 34], 72: [2, 34], 75: [2, 34], 80: [2, 34], 81: [2, 34], 82: [2, 34], 83: [2, 34], 84: [2, 34], 85: [2, 34] }, { 23: [2, 35], 33: [2, 35], 54: [2, 35], 65: [2, 35], 68: [2, 35], 72: [2, 35], 75: [2, 35], 80: [2, 35], 81: [2, 35], 82: [2, 35], 83: [2, 35], 84: [2, 35], 85: [2, 35] }, { 23: [2, 36], 33: [2, 36], 54: [2, 36], 65: [2, 36], 68: [2, 36], 72: [2, 36], 75: [2, 36], 80: [2, 36], 81: [2, 36], 82: [2, 36], 83: [2, 36], 84: [2, 36], 85: [2, 36] }, { 23: [2, 37], 33: [2, 37], 54: [2, 37], 65: [2, 37], 68: [2, 37], 72: [2, 37], 75: [2, 37], 80: [2, 37], 81: [2, 37], 82: [2, 37], 83: [2, 37], 84: [2, 37], 85: [2, 37] }, { 23: [2, 38], 33: [2, 38], 54: [2, 38], 65: [2, 38], 68: [2, 38], 72: [2, 38], 75: [2, 38], 80: [2, 38], 81: [2, 38], 82: [2, 38], 83: [2, 38], 84: [2, 38], 85: [2, 38] }, { 23: [2, 39], 33: [2, 39], 54: [2, 39], 65: [2, 39], 68: [2, 39], 72: [2, 39], 75: [2, 39], 80: [2, 39], 81: [2, 39], 82: [2, 39], 83: [2, 39], 84: [2, 39], 85: [2, 39] }, { 23: [2, 43], 33: [2, 43], 54: [2, 43], 65: [2, 43], 68: [2, 43], 72: [2, 43], 75: [2, 43], 80: [2, 43], 81: [2, 43], 82: [2, 43], 83: [2, 43], 84: [2, 43], 85: [2, 43], 87: [1, 51] }, { 72: [1, 35], 86: 52 }, { 23: [2, 45], 33: [2, 45], 54: [2, 45], 65: [2, 45], 68: [2, 45], 72: [2, 45], 75: [2, 45], 80: [2, 45], 81: [2, 45], 82: [2, 45], 83: [2, 45], 84: [2, 45], 85: [2, 45], 87: [2, 45] }, { 52: 53, 54: [2, 82], 65: [2, 82], 72: [2, 82], 80: [2, 82], 81: [2, 82], 82: [2, 82], 83: [2, 82], 84: [2, 82], 85: [2, 82] }, { 25: 54, 38: 56, 39: [1, 58], 43: 57, 44: [1, 59], 45: 55, 47: [2, 54] }, { 28: 60, 43: 61, 44: [1, 59], 47: [2, 56] }, { 13: 63, 15: [1, 20], 18: [1, 62] }, { 15: [2, 48], 18: [2, 48] }, { 33: [2, 86], 57: 64, 65: [2, 86], 72: [2, 86], 80: [2, 86], 81: [2, 86], 82: [2, 86], 83: [2, 86], 84: [2, 86], 85: [2, 86] }, { 33: [2, 40], 65: [2, 40], 72: [2, 40], 80: [2, 40], 81: [2, 40], 82: [2, 40], 83: [2, 40], 84: [2, 40], 85: [2, 40] }, { 33: [2, 41], 65: [2, 41], 72: [2, 41], 80: [2, 41], 81: [2, 41], 82: [2, 41], 83: [2, 41], 84: [2, 41], 85: [2, 41] }, { 20: 65, 72: [1, 35], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 26: 66, 47: [1, 67] }, { 30: 68, 33: [2, 58], 65: [2, 58], 72: [2, 58], 75: [2, 58], 80: [2, 58], 81: [2, 58], 82: [2, 58], 83: [2, 58], 84: [2, 58], 85: [2, 58] }, { 33: [2, 64], 35: 69, 65: [2, 64], 72: [2, 64], 75: [2, 64], 80: [2, 64], 81: [2, 64], 82: [2, 64], 83: [2, 64], 84: [2, 64], 85: [2, 64] }, { 21: 70, 23: [2, 50], 65: [2, 50], 72: [2, 50], 80: [2, 50], 81: [2, 50], 82: [2, 50], 83: [2, 50], 84: [2, 50], 85: [2, 50] }, { 33: [2, 90], 61: 71, 65: [2, 90], 72: [2, 90], 80: [2, 90], 81: [2, 90], 82: [2, 90], 83: [2, 90], 84: [2, 90], 85: [2, 90] }, { 20: 75, 33: [2, 80], 50: 72, 63: 73, 64: 76, 65: [1, 44], 69: 74, 70: 77, 71: 78, 72: [1, 79], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 72: [1, 80] }, { 23: [2, 42], 33: [2, 42], 54: [2, 42], 65: [2, 42], 68: [2, 42], 72: [2, 42], 75: [2, 42], 80: [2, 42], 81: [2, 42], 82: [2, 42], 83: [2, 42], 84: [2, 42], 85: [2, 42], 87: [1, 51] }, { 20: 75, 53: 81, 54: [2, 84], 63: 82, 64: 76, 65: [1, 44], 69: 83, 70: 77, 71: 78, 72: [1, 79], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 26: 84, 47: [1, 67] }, { 47: [2, 55] }, { 4: 85, 6: 3, 14: [2, 46], 15: [2, 46], 19: [2, 46], 29: [2, 46], 34: [2, 46], 39: [2, 46], 44: [2, 46], 47: [2, 46], 48: [2, 46], 51: [2, 46], 55: [2, 46], 60: [2, 46] }, { 47: [2, 20] }, { 20: 86, 72: [1, 35], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 4: 87, 6: 3, 14: [2, 46], 15: [2, 46], 19: [2, 46], 29: [2, 46], 34: [2, 46], 47: [2, 46], 48: [2, 46], 51: [2, 46], 55: [2, 46], 60: [2, 46] }, { 26: 88, 47: [1, 67] }, { 47: [2, 57] }, { 5: [2, 11], 14: [2, 11], 15: [2, 11], 19: [2, 11], 29: [2, 11], 34: [2, 11], 39: [2, 11], 44: [2, 11], 47: [2, 11], 48: [2, 11], 51: [2, 11], 55: [2, 11], 60: [2, 11] }, { 15: [2, 49], 18: [2, 49] }, { 20: 75, 33: [2, 88], 58: 89, 63: 90, 64: 76, 65: [1, 44], 69: 91, 70: 77, 71: 78, 72: [1, 79], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 65: [2, 94], 66: 92, 68: [2, 94], 72: [2, 94], 80: [2, 94], 81: [2, 94], 82: [2, 94], 83: [2, 94], 84: [2, 94], 85: [2, 94] }, { 5: [2, 25], 14: [2, 25], 15: [2, 25], 19: [2, 25], 29: [2, 25], 34: [2, 25], 39: [2, 25], 44: [2, 25], 47: [2, 25], 48: [2, 25], 51: [2, 25], 55: [2, 25], 60: [2, 25] }, { 20: 93, 72: [1, 35], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 20: 75, 31: 94, 33: [2, 60], 63: 95, 64: 76, 65: [1, 44], 69: 96, 70: 77, 71: 78, 72: [1, 79], 75: [2, 60], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 20: 75, 33: [2, 66], 36: 97, 63: 98, 64: 76, 65: [1, 44], 69: 99, 70: 77, 71: 78, 72: [1, 79], 75: [2, 66], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 20: 75, 22: 100, 23: [2, 52], 63: 101, 64: 76, 65: [1, 44], 69: 102, 70: 77, 71: 78, 72: [1, 79], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 20: 75, 33: [2, 92], 62: 103, 63: 104, 64: 76, 65: [1, 44], 69: 105, 70: 77, 71: 78, 72: [1, 79], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 33: [1, 106] }, { 33: [2, 79], 65: [2, 79], 72: [2, 79], 80: [2, 79], 81: [2, 79], 82: [2, 79], 83: [2, 79], 84: [2, 79], 85: [2, 79] }, { 33: [2, 81] }, { 23: [2, 27], 33: [2, 27], 54: [2, 27], 65: [2, 27], 68: [2, 27], 72: [2, 27], 75: [2, 27], 80: [2, 27], 81: [2, 27], 82: [2, 27], 83: [2, 27], 84: [2, 27], 85: [2, 27] }, { 23: [2, 28], 33: [2, 28], 54: [2, 28], 65: [2, 28], 68: [2, 28], 72: [2, 28], 75: [2, 28], 80: [2, 28], 81: [2, 28], 82: [2, 28], 83: [2, 28], 84: [2, 28], 85: [2, 28] }, { 23: [2, 30], 33: [2, 30], 54: [2, 30], 68: [2, 30], 71: 107, 72: [1, 108], 75: [2, 30] }, { 23: [2, 98], 33: [2, 98], 54: [2, 98], 68: [2, 98], 72: [2, 98], 75: [2, 98] }, { 23: [2, 45], 33: [2, 45], 54: [2, 45], 65: [2, 45], 68: [2, 45], 72: [2, 45], 73: [1, 109], 75: [2, 45], 80: [2, 45], 81: [2, 45], 82: [2, 45], 83: [2, 45], 84: [2, 45], 85: [2, 45], 87: [2, 45] }, { 23: [2, 44], 33: [2, 44], 54: [2, 44], 65: [2, 44], 68: [2, 44], 72: [2, 44], 75: [2, 44], 80: [2, 44], 81: [2, 44], 82: [2, 44], 83: [2, 44], 84: [2, 44], 85: [2, 44], 87: [2, 44] }, { 54: [1, 110] }, { 54: [2, 83], 65: [2, 83], 72: [2, 83], 80: [2, 83], 81: [2, 83], 82: [2, 83], 83: [2, 83], 84: [2, 83], 85: [2, 83] }, { 54: [2, 85] }, { 5: [2, 13], 14: [2, 13], 15: [2, 13], 19: [2, 13], 29: [2, 13], 34: [2, 13], 39: [2, 13], 44: [2, 13], 47: [2, 13], 48: [2, 13], 51: [2, 13], 55: [2, 13], 60: [2, 13] }, { 38: 56, 39: [1, 58], 43: 57, 44: [1, 59], 45: 112, 46: 111, 47: [2, 76] }, { 33: [2, 70], 40: 113, 65: [2, 70], 72: [2, 70], 75: [2, 70], 80: [2, 70], 81: [2, 70], 82: [2, 70], 83: [2, 70], 84: [2, 70], 85: [2, 70] }, { 47: [2, 18] }, { 5: [2, 14], 14: [2, 14], 15: [2, 14], 19: [2, 14], 29: [2, 14], 34: [2, 14], 39: [2, 14], 44: [2, 14], 47: [2, 14], 48: [2, 14], 51: [2, 14], 55: [2, 14], 60: [2, 14] }, { 33: [1, 114] }, { 33: [2, 87], 65: [2, 87], 72: [2, 87], 80: [2, 87], 81: [2, 87], 82: [2, 87], 83: [2, 87], 84: [2, 87], 85: [2, 87] }, { 33: [2, 89] }, { 20: 75, 63: 116, 64: 76, 65: [1, 44], 67: 115, 68: [2, 96], 69: 117, 70: 77, 71: 78, 72: [1, 79], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 33: [1, 118] }, { 32: 119, 33: [2, 62], 74: 120, 75: [1, 121] }, { 33: [2, 59], 65: [2, 59], 72: [2, 59], 75: [2, 59], 80: [2, 59], 81: [2, 59], 82: [2, 59], 83: [2, 59], 84: [2, 59], 85: [2, 59] }, { 33: [2, 61], 75: [2, 61] }, { 33: [2, 68], 37: 122, 74: 123, 75: [1, 121] }, { 33: [2, 65], 65: [2, 65], 72: [2, 65], 75: [2, 65], 80: [2, 65], 81: [2, 65], 82: [2, 65], 83: [2, 65], 84: [2, 65], 85: [2, 65] }, { 33: [2, 67], 75: [2, 67] }, { 23: [1, 124] }, { 23: [2, 51], 65: [2, 51], 72: [2, 51], 80: [2, 51], 81: [2, 51], 82: [2, 51], 83: [2, 51], 84: [2, 51], 85: [2, 51] }, { 23: [2, 53] }, { 33: [1, 125] }, { 33: [2, 91], 65: [2, 91], 72: [2, 91], 80: [2, 91], 81: [2, 91], 82: [2, 91], 83: [2, 91], 84: [2, 91], 85: [2, 91] }, { 33: [2, 93] }, { 5: [2, 22], 14: [2, 22], 15: [2, 22], 19: [2, 22], 29: [2, 22], 34: [2, 22], 39: [2, 22], 44: [2, 22], 47: [2, 22], 48: [2, 22], 51: [2, 22], 55: [2, 22], 60: [2, 22] }, { 23: [2, 99], 33: [2, 99], 54: [2, 99], 68: [2, 99], 72: [2, 99], 75: [2, 99] }, { 73: [1, 109] }, { 20: 75, 63: 126, 64: 76, 65: [1, 44], 72: [1, 35], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 5: [2, 23], 14: [2, 23], 15: [2, 23], 19: [2, 23], 29: [2, 23], 34: [2, 23], 39: [2, 23], 44: [2, 23], 47: [2, 23], 48: [2, 23], 51: [2, 23], 55: [2, 23], 60: [2, 23] }, { 47: [2, 19] }, { 47: [2, 77] }, { 20: 75, 33: [2, 72], 41: 127, 63: 128, 64: 76, 65: [1, 44], 69: 129, 70: 77, 71: 78, 72: [1, 79], 75: [2, 72], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 5: [2, 24], 14: [2, 24], 15: [2, 24], 19: [2, 24], 29: [2, 24], 34: [2, 24], 39: [2, 24], 44: [2, 24], 47: [2, 24], 48: [2, 24], 51: [2, 24], 55: [2, 24], 60: [2, 24] }, { 68: [1, 130] }, { 65: [2, 95], 68: [2, 95], 72: [2, 95], 80: [2, 95], 81: [2, 95], 82: [2, 95], 83: [2, 95], 84: [2, 95], 85: [2, 95] }, { 68: [2, 97] }, { 5: [2, 21], 14: [2, 21], 15: [2, 21], 19: [2, 21], 29: [2, 21], 34: [2, 21], 39: [2, 21], 44: [2, 21], 47: [2, 21], 48: [2, 21], 51: [2, 21], 55: [2, 21], 60: [2, 21] }, { 33: [1, 131] }, { 33: [2, 63] }, { 72: [1, 133], 76: 132 }, { 33: [1, 134] }, { 33: [2, 69] }, { 15: [2, 12] }, { 14: [2, 26], 15: [2, 26], 19: [2, 26], 29: [2, 26], 34: [2, 26], 47: [2, 26], 48: [2, 26], 51: [2, 26], 55: [2, 26], 60: [2, 26] }, { 23: [2, 31], 33: [2, 31], 54: [2, 31], 68: [2, 31], 72: [2, 31], 75: [2, 31] }, { 33: [2, 74], 42: 135, 74: 136, 75: [1, 121] }, { 33: [2, 71], 65: [2, 71], 72: [2, 71], 75: [2, 71], 80: [2, 71], 81: [2, 71], 82: [2, 71], 83: [2, 71], 84: [2, 71], 85: [2, 71] }, { 33: [2, 73], 75: [2, 73] }, { 23: [2, 29], 33: [2, 29], 54: [2, 29], 65: [2, 29], 68: [2, 29], 72: [2, 29], 75: [2, 29], 80: [2, 29], 81: [2, 29], 82: [2, 29], 83: [2, 29], 84: [2, 29], 85: [2, 29] }, { 14: [2, 15], 15: [2, 15], 19: [2, 15], 29: [2, 15], 34: [2, 15], 39: [2, 15], 44: [2, 15], 47: [2, 15], 48: [2, 15], 51: [2, 15], 55: [2, 15], 60: [2, 15] }, { 72: [1, 138], 77: [1, 137] }, { 72: [2, 100], 77: [2, 100] }, { 14: [2, 16], 15: [2, 16], 19: [2, 16], 29: [2, 16], 34: [2, 16], 44: [2, 16], 47: [2, 16], 48: [2, 16], 51: [2, 16], 55: [2, 16], 60: [2, 16] }, { 33: [1, 139] }, { 33: [2, 75] }, { 33: [2, 32] }, { 72: [2, 101], 77: [2, 101] }, { 14: [2, 17], 15: [2, 17], 19: [2, 17], 29: [2, 17], 34: [2, 17], 39: [2, 17], 44: [2, 17], 47: [2, 17], 48: [2, 17], 51: [2, 17], 55: [2, 17], 60: [2, 17] }], - defaultActions: { 4: [2, 1], 55: [2, 55], 57: [2, 20], 61: [2, 57], 74: [2, 81], 83: [2, 85], 87: [2, 18], 91: [2, 89], 102: [2, 53], 105: [2, 93], 111: [2, 19], 112: [2, 77], 117: [2, 97], 120: [2, 63], 123: [2, 69], 124: [2, 12], 136: [2, 75], 137: [2, 32] }, + table: [{ 3: 1, 4: 2, 5: [2, 46], 6: 3, 14: [2, 46], 15: [2, 46], 19: [2, 46], 29: [2, 46], 34: [2, 46], 48: [2, 46], 51: [2, 46], 55: [2, 46], 60: [2, 46] }, { 1: [3] }, { 5: [1, 4] }, { 5: [2, 2], 7: 5, 8: 6, 9: 7, 10: 8, 11: 9, 12: 10, 13: 11, 14: [1, 12], 15: [1, 20], 16: 17, 19: [1, 23], 24: 15, 27: 16, 29: [1, 21], 34: [1, 22], 39: [2, 2], 44: [2, 2], 47: [2, 2], 48: [1, 13], 51: [1, 14], 55: [1, 18], 59: 19, 60: [1, 24] }, { 1: [2, 1] }, { 5: [2, 47], 14: [2, 47], 15: [2, 47], 19: [2, 47], 29: [2, 47], 34: [2, 47], 39: [2, 47], 44: [2, 47], 47: [2, 47], 48: [2, 47], 51: [2, 47], 55: [2, 47], 60: [2, 47] }, { 5: [2, 3], 14: [2, 3], 15: [2, 3], 19: [2, 3], 29: [2, 3], 34: [2, 3], 39: [2, 3], 44: [2, 3], 47: [2, 3], 48: [2, 3], 51: [2, 3], 55: [2, 3], 60: [2, 3] }, { 5: [2, 4], 14: [2, 4], 15: [2, 4], 19: [2, 4], 29: [2, 4], 34: [2, 4], 39: [2, 4], 44: [2, 4], 47: [2, 4], 48: [2, 4], 51: [2, 4], 55: [2, 4], 60: [2, 4] }, { 5: [2, 5], 14: [2, 5], 15: [2, 5], 19: [2, 5], 29: [2, 5], 34: [2, 5], 39: [2, 5], 44: [2, 5], 47: [2, 5], 48: [2, 5], 51: [2, 5], 55: [2, 5], 60: [2, 5] }, { 5: [2, 6], 14: [2, 6], 15: [2, 6], 19: [2, 6], 29: [2, 6], 34: [2, 6], 39: [2, 6], 44: [2, 6], 47: [2, 6], 48: [2, 6], 51: [2, 6], 55: [2, 6], 60: [2, 6] }, { 5: [2, 7], 14: [2, 7], 15: [2, 7], 19: [2, 7], 29: [2, 7], 34: [2, 7], 39: [2, 7], 44: [2, 7], 47: [2, 7], 48: [2, 7], 51: [2, 7], 55: [2, 7], 60: [2, 7] }, { 5: [2, 8], 14: [2, 8], 15: [2, 8], 19: [2, 8], 29: [2, 8], 34: [2, 8], 39: [2, 8], 44: [2, 8], 47: [2, 8], 48: [2, 8], 51: [2, 8], 55: [2, 8], 60: [2, 8] }, { 5: [2, 9], 14: [2, 9], 15: [2, 9], 19: [2, 9], 29: [2, 9], 34: [2, 9], 39: [2, 9], 44: [2, 9], 47: [2, 9], 48: [2, 9], 51: [2, 9], 55: [2, 9], 60: [2, 9] }, { 20: 25, 72: [1, 35], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 20: 36, 72: [1, 35], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 4: 37, 6: 3, 14: [2, 46], 15: [2, 46], 19: [2, 46], 29: [2, 46], 34: [2, 46], 39: [2, 46], 44: [2, 46], 47: [2, 46], 48: [2, 46], 51: [2, 46], 55: [2, 46], 60: [2, 46] }, { 4: 38, 6: 3, 14: [2, 46], 15: [2, 46], 19: [2, 46], 29: [2, 46], 34: [2, 46], 44: [2, 46], 47: [2, 46], 48: [2, 46], 51: [2, 46], 55: [2, 46], 60: [2, 46] }, { 15: [2, 48], 17: 39, 18: [2, 48] }, { 20: 41, 56: 40, 64: 42, 65: [1, 43], 72: [1, 35], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 4: 44, 6: 3, 14: [2, 46], 15: [2, 46], 19: [2, 46], 29: [2, 46], 34: [2, 46], 47: [2, 46], 48: [2, 46], 51: [2, 46], 55: [2, 46], 60: [2, 46] }, { 5: [2, 10], 14: [2, 10], 15: [2, 10], 18: [2, 10], 19: [2, 10], 29: [2, 10], 34: [2, 10], 39: [2, 10], 44: [2, 10], 47: [2, 10], 48: [2, 10], 51: [2, 10], 55: [2, 10], 60: [2, 10] }, { 20: 45, 72: [1, 35], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 20: 46, 72: [1, 35], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 20: 47, 72: [1, 35], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 20: 41, 56: 48, 64: 42, 65: [1, 43], 72: [1, 35], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 33: [2, 78], 49: 49, 65: [2, 78], 72: [2, 78], 80: [2, 78], 81: [2, 78], 82: [2, 78], 83: [2, 78], 84: [2, 78], 85: [2, 78] }, { 23: [2, 33], 33: [2, 33], 54: [2, 33], 65: [2, 33], 68: [2, 33], 72: [2, 33], 75: [2, 33], 80: [2, 33], 81: [2, 33], 82: [2, 33], 83: [2, 33], 84: [2, 33], 85: [2, 33] }, { 23: [2, 34], 33: [2, 34], 54: [2, 34], 65: [2, 34], 68: [2, 34], 72: [2, 34], 75: [2, 34], 80: [2, 34], 81: [2, 34], 82: [2, 34], 83: [2, 34], 84: [2, 34], 85: [2, 34] }, { 23: [2, 35], 33: [2, 35], 54: [2, 35], 65: [2, 35], 68: [2, 35], 72: [2, 35], 75: [2, 35], 80: [2, 35], 81: [2, 35], 82: [2, 35], 83: [2, 35], 84: [2, 35], 85: [2, 35] }, { 23: [2, 36], 33: [2, 36], 54: [2, 36], 65: [2, 36], 68: [2, 36], 72: [2, 36], 75: [2, 36], 80: [2, 36], 81: [2, 36], 82: [2, 36], 83: [2, 36], 84: [2, 36], 85: [2, 36] }, { 23: [2, 37], 33: [2, 37], 54: [2, 37], 65: [2, 37], 68: [2, 37], 72: [2, 37], 75: [2, 37], 80: [2, 37], 81: [2, 37], 82: [2, 37], 83: [2, 37], 84: [2, 37], 85: [2, 37] }, { 23: [2, 38], 33: [2, 38], 54: [2, 38], 65: [2, 38], 68: [2, 38], 72: [2, 38], 75: [2, 38], 80: [2, 38], 81: [2, 38], 82: [2, 38], 83: [2, 38], 84: [2, 38], 85: [2, 38] }, { 23: [2, 39], 33: [2, 39], 54: [2, 39], 65: [2, 39], 68: [2, 39], 72: [2, 39], 75: [2, 39], 80: [2, 39], 81: [2, 39], 82: [2, 39], 83: [2, 39], 84: [2, 39], 85: [2, 39] }, { 23: [2, 43], 33: [2, 43], 54: [2, 43], 65: [2, 43], 68: [2, 43], 72: [2, 43], 75: [2, 43], 80: [2, 43], 81: [2, 43], 82: [2, 43], 83: [2, 43], 84: [2, 43], 85: [2, 43], 87: [1, 50] }, { 72: [1, 35], 86: 51 }, { 23: [2, 45], 33: [2, 45], 54: [2, 45], 65: [2, 45], 68: [2, 45], 72: [2, 45], 75: [2, 45], 80: [2, 45], 81: [2, 45], 82: [2, 45], 83: [2, 45], 84: [2, 45], 85: [2, 45], 87: [2, 45] }, { 52: 52, 54: [2, 82], 65: [2, 82], 72: [2, 82], 80: [2, 82], 81: [2, 82], 82: [2, 82], 83: [2, 82], 84: [2, 82], 85: [2, 82] }, { 25: 53, 38: 55, 39: [1, 57], 43: 56, 44: [1, 58], 45: 54, 47: [2, 54] }, { 28: 59, 43: 60, 44: [1, 58], 47: [2, 56] }, { 13: 62, 15: [1, 20], 18: [1, 61] }, { 33: [2, 86], 57: 63, 65: [2, 86], 72: [2, 86], 80: [2, 86], 81: [2, 86], 82: [2, 86], 83: [2, 86], 84: [2, 86], 85: [2, 86] }, { 33: [2, 40], 65: [2, 40], 72: [2, 40], 80: [2, 40], 81: [2, 40], 82: [2, 40], 83: [2, 40], 84: [2, 40], 85: [2, 40] }, { 33: [2, 41], 65: [2, 41], 72: [2, 41], 80: [2, 41], 81: [2, 41], 82: [2, 41], 83: [2, 41], 84: [2, 41], 85: [2, 41] }, { 20: 64, 72: [1, 35], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 26: 65, 47: [1, 66] }, { 30: 67, 33: [2, 58], 65: [2, 58], 72: [2, 58], 75: [2, 58], 80: [2, 58], 81: [2, 58], 82: [2, 58], 83: [2, 58], 84: [2, 58], 85: [2, 58] }, { 33: [2, 64], 35: 68, 65: [2, 64], 72: [2, 64], 75: [2, 64], 80: [2, 64], 81: [2, 64], 82: [2, 64], 83: [2, 64], 84: [2, 64], 85: [2, 64] }, { 21: 69, 23: [2, 50], 65: [2, 50], 72: [2, 50], 80: [2, 50], 81: [2, 50], 82: [2, 50], 83: [2, 50], 84: [2, 50], 85: [2, 50] }, { 33: [2, 90], 61: 70, 65: [2, 90], 72: [2, 90], 80: [2, 90], 81: [2, 90], 82: [2, 90], 83: [2, 90], 84: [2, 90], 85: [2, 90] }, { 20: 74, 33: [2, 80], 50: 71, 63: 72, 64: 75, 65: [1, 43], 69: 73, 70: 76, 71: 77, 72: [1, 78], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 72: [1, 79] }, { 23: [2, 42], 33: [2, 42], 54: [2, 42], 65: [2, 42], 68: [2, 42], 72: [2, 42], 75: [2, 42], 80: [2, 42], 81: [2, 42], 82: [2, 42], 83: [2, 42], 84: [2, 42], 85: [2, 42], 87: [1, 50] }, { 20: 74, 53: 80, 54: [2, 84], 63: 81, 64: 75, 65: [1, 43], 69: 82, 70: 76, 71: 77, 72: [1, 78], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 26: 83, 47: [1, 66] }, { 47: [2, 55] }, { 4: 84, 6: 3, 14: [2, 46], 15: [2, 46], 19: [2, 46], 29: [2, 46], 34: [2, 46], 39: [2, 46], 44: [2, 46], 47: [2, 46], 48: [2, 46], 51: [2, 46], 55: [2, 46], 60: [2, 46] }, { 47: [2, 20] }, { 20: 85, 72: [1, 35], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 4: 86, 6: 3, 14: [2, 46], 15: [2, 46], 19: [2, 46], 29: [2, 46], 34: [2, 46], 47: [2, 46], 48: [2, 46], 51: [2, 46], 55: [2, 46], 60: [2, 46] }, { 26: 87, 47: [1, 66] }, { 47: [2, 57] }, { 5: [2, 11], 14: [2, 11], 15: [2, 11], 19: [2, 11], 29: [2, 11], 34: [2, 11], 39: [2, 11], 44: [2, 11], 47: [2, 11], 48: [2, 11], 51: [2, 11], 55: [2, 11], 60: [2, 11] }, { 15: [2, 49], 18: [2, 49] }, { 20: 74, 33: [2, 88], 58: 88, 63: 89, 64: 75, 65: [1, 43], 69: 90, 70: 76, 71: 77, 72: [1, 78], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 65: [2, 94], 66: 91, 68: [2, 94], 72: [2, 94], 80: [2, 94], 81: [2, 94], 82: [2, 94], 83: [2, 94], 84: [2, 94], 85: [2, 94] }, { 5: [2, 25], 14: [2, 25], 15: [2, 25], 19: [2, 25], 29: [2, 25], 34: [2, 25], 39: [2, 25], 44: [2, 25], 47: [2, 25], 48: [2, 25], 51: [2, 25], 55: [2, 25], 60: [2, 25] }, { 20: 92, 72: [1, 35], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 20: 74, 31: 93, 33: [2, 60], 63: 94, 64: 75, 65: [1, 43], 69: 95, 70: 76, 71: 77, 72: [1, 78], 75: [2, 60], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 20: 74, 33: [2, 66], 36: 96, 63: 97, 64: 75, 65: [1, 43], 69: 98, 70: 76, 71: 77, 72: [1, 78], 75: [2, 66], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 20: 74, 22: 99, 23: [2, 52], 63: 100, 64: 75, 65: [1, 43], 69: 101, 70: 76, 71: 77, 72: [1, 78], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 20: 74, 33: [2, 92], 62: 102, 63: 103, 64: 75, 65: [1, 43], 69: 104, 70: 76, 71: 77, 72: [1, 78], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 33: [1, 105] }, { 33: [2, 79], 65: [2, 79], 72: [2, 79], 80: [2, 79], 81: [2, 79], 82: [2, 79], 83: [2, 79], 84: [2, 79], 85: [2, 79] }, { 33: [2, 81] }, { 23: [2, 27], 33: [2, 27], 54: [2, 27], 65: [2, 27], 68: [2, 27], 72: [2, 27], 75: [2, 27], 80: [2, 27], 81: [2, 27], 82: [2, 27], 83: [2, 27], 84: [2, 27], 85: [2, 27] }, { 23: [2, 28], 33: [2, 28], 54: [2, 28], 65: [2, 28], 68: [2, 28], 72: [2, 28], 75: [2, 28], 80: [2, 28], 81: [2, 28], 82: [2, 28], 83: [2, 28], 84: [2, 28], 85: [2, 28] }, { 23: [2, 30], 33: [2, 30], 54: [2, 30], 68: [2, 30], 71: 106, 72: [1, 107], 75: [2, 30] }, { 23: [2, 98], 33: [2, 98], 54: [2, 98], 68: [2, 98], 72: [2, 98], 75: [2, 98] }, { 23: [2, 45], 33: [2, 45], 54: [2, 45], 65: [2, 45], 68: [2, 45], 72: [2, 45], 73: [1, 108], 75: [2, 45], 80: [2, 45], 81: [2, 45], 82: [2, 45], 83: [2, 45], 84: [2, 45], 85: [2, 45], 87: [2, 45] }, { 23: [2, 44], 33: [2, 44], 54: [2, 44], 65: [2, 44], 68: [2, 44], 72: [2, 44], 75: [2, 44], 80: [2, 44], 81: [2, 44], 82: [2, 44], 83: [2, 44], 84: [2, 44], 85: [2, 44], 87: [2, 44] }, { 54: [1, 109] }, { 54: [2, 83], 65: [2, 83], 72: [2, 83], 80: [2, 83], 81: [2, 83], 82: [2, 83], 83: [2, 83], 84: [2, 83], 85: [2, 83] }, { 54: [2, 85] }, { 5: [2, 13], 14: [2, 13], 15: [2, 13], 19: [2, 13], 29: [2, 13], 34: [2, 13], 39: [2, 13], 44: [2, 13], 47: [2, 13], 48: [2, 13], 51: [2, 13], 55: [2, 13], 60: [2, 13] }, { 38: 55, 39: [1, 57], 43: 56, 44: [1, 58], 45: 111, 46: 110, 47: [2, 76] }, { 33: [2, 70], 40: 112, 65: [2, 70], 72: [2, 70], 75: [2, 70], 80: [2, 70], 81: [2, 70], 82: [2, 70], 83: [2, 70], 84: [2, 70], 85: [2, 70] }, { 47: [2, 18] }, { 5: [2, 14], 14: [2, 14], 15: [2, 14], 19: [2, 14], 29: [2, 14], 34: [2, 14], 39: [2, 14], 44: [2, 14], 47: [2, 14], 48: [2, 14], 51: [2, 14], 55: [2, 14], 60: [2, 14] }, { 33: [1, 113] }, { 33: [2, 87], 65: [2, 87], 72: [2, 87], 80: [2, 87], 81: [2, 87], 82: [2, 87], 83: [2, 87], 84: [2, 87], 85: [2, 87] }, { 33: [2, 89] }, { 20: 74, 63: 115, 64: 75, 65: [1, 43], 67: 114, 68: [2, 96], 69: 116, 70: 76, 71: 77, 72: [1, 78], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 33: [1, 117] }, { 32: 118, 33: [2, 62], 74: 119, 75: [1, 120] }, { 33: [2, 59], 65: [2, 59], 72: [2, 59], 75: [2, 59], 80: [2, 59], 81: [2, 59], 82: [2, 59], 83: [2, 59], 84: [2, 59], 85: [2, 59] }, { 33: [2, 61], 75: [2, 61] }, { 33: [2, 68], 37: 121, 74: 122, 75: [1, 120] }, { 33: [2, 65], 65: [2, 65], 72: [2, 65], 75: [2, 65], 80: [2, 65], 81: [2, 65], 82: [2, 65], 83: [2, 65], 84: [2, 65], 85: [2, 65] }, { 33: [2, 67], 75: [2, 67] }, { 23: [1, 123] }, { 23: [2, 51], 65: [2, 51], 72: [2, 51], 80: [2, 51], 81: [2, 51], 82: [2, 51], 83: [2, 51], 84: [2, 51], 85: [2, 51] }, { 23: [2, 53] }, { 33: [1, 124] }, { 33: [2, 91], 65: [2, 91], 72: [2, 91], 80: [2, 91], 81: [2, 91], 82: [2, 91], 83: [2, 91], 84: [2, 91], 85: [2, 91] }, { 33: [2, 93] }, { 5: [2, 22], 14: [2, 22], 15: [2, 22], 19: [2, 22], 29: [2, 22], 34: [2, 22], 39: [2, 22], 44: [2, 22], 47: [2, 22], 48: [2, 22], 51: [2, 22], 55: [2, 22], 60: [2, 22] }, { 23: [2, 99], 33: [2, 99], 54: [2, 99], 68: [2, 99], 72: [2, 99], 75: [2, 99] }, { 73: [1, 108] }, { 20: 74, 63: 125, 64: 75, 65: [1, 43], 72: [1, 35], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 5: [2, 23], 14: [2, 23], 15: [2, 23], 19: [2, 23], 29: [2, 23], 34: [2, 23], 39: [2, 23], 44: [2, 23], 47: [2, 23], 48: [2, 23], 51: [2, 23], 55: [2, 23], 60: [2, 23] }, { 47: [2, 19] }, { 47: [2, 77] }, { 20: 74, 33: [2, 72], 41: 126, 63: 127, 64: 75, 65: [1, 43], 69: 128, 70: 76, 71: 77, 72: [1, 78], 75: [2, 72], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 5: [2, 24], 14: [2, 24], 15: [2, 24], 19: [2, 24], 29: [2, 24], 34: [2, 24], 39: [2, 24], 44: [2, 24], 47: [2, 24], 48: [2, 24], 51: [2, 24], 55: [2, 24], 60: [2, 24] }, { 68: [1, 129] }, { 65: [2, 95], 68: [2, 95], 72: [2, 95], 80: [2, 95], 81: [2, 95], 82: [2, 95], 83: [2, 95], 84: [2, 95], 85: [2, 95] }, { 68: [2, 97] }, { 5: [2, 21], 14: [2, 21], 15: [2, 21], 19: [2, 21], 29: [2, 21], 34: [2, 21], 39: [2, 21], 44: [2, 21], 47: [2, 21], 48: [2, 21], 51: [2, 21], 55: [2, 21], 60: [2, 21] }, { 33: [1, 130] }, { 33: [2, 63] }, { 72: [1, 132], 76: 131 }, { 33: [1, 133] }, { 33: [2, 69] }, { 15: [2, 12], 18: [2, 12] }, { 14: [2, 26], 15: [2, 26], 19: [2, 26], 29: [2, 26], 34: [2, 26], 47: [2, 26], 48: [2, 26], 51: [2, 26], 55: [2, 26], 60: [2, 26] }, { 23: [2, 31], 33: [2, 31], 54: [2, 31], 68: [2, 31], 72: [2, 31], 75: [2, 31] }, { 33: [2, 74], 42: 134, 74: 135, 75: [1, 120] }, { 33: [2, 71], 65: [2, 71], 72: [2, 71], 75: [2, 71], 80: [2, 71], 81: [2, 71], 82: [2, 71], 83: [2, 71], 84: [2, 71], 85: [2, 71] }, { 33: [2, 73], 75: [2, 73] }, { 23: [2, 29], 33: [2, 29], 54: [2, 29], 65: [2, 29], 68: [2, 29], 72: [2, 29], 75: [2, 29], 80: [2, 29], 81: [2, 29], 82: [2, 29], 83: [2, 29], 84: [2, 29], 85: [2, 29] }, { 14: [2, 15], 15: [2, 15], 19: [2, 15], 29: [2, 15], 34: [2, 15], 39: [2, 15], 44: [2, 15], 47: [2, 15], 48: [2, 15], 51: [2, 15], 55: [2, 15], 60: [2, 15] }, { 72: [1, 137], 77: [1, 136] }, { 72: [2, 100], 77: [2, 100] }, { 14: [2, 16], 15: [2, 16], 19: [2, 16], 29: [2, 16], 34: [2, 16], 44: [2, 16], 47: [2, 16], 48: [2, 16], 51: [2, 16], 55: [2, 16], 60: [2, 16] }, { 33: [1, 138] }, { 33: [2, 75] }, { 33: [2, 32] }, { 72: [2, 101], 77: [2, 101] }, { 14: [2, 17], 15: [2, 17], 19: [2, 17], 29: [2, 17], 34: [2, 17], 39: [2, 17], 44: [2, 17], 47: [2, 17], 48: [2, 17], 51: [2, 17], 55: [2, 17], 60: [2, 17] }], + defaultActions: { 4: [2, 1], 54: [2, 55], 56: [2, 20], 60: [2, 57], 73: [2, 81], 82: [2, 85], 86: [2, 18], 90: [2, 89], 101: [2, 53], 104: [2, 93], 110: [2, 19], 111: [2, 77], 116: [2, 97], 119: [2, 63], 122: [2, 69], 135: [2, 75], 136: [2, 32] }, parseError: function parseError(str, hash) { throw new Error(str); }, @@ -2375,7 +2428,7 @@ return /******/ (function(modules) { // webpackBootstrap break; } }; - lexer.rules = [/^(?:[^\x00]*?(?=(\{\{)))/, /^(?:[^\x00]+)/, /^(?:[^\x00]{2,}?(?=(\{\{|\\\{\{|\\\\\{\{|$)))/, /^(?:\{\{\{\{(?=[^\/]))/, /^(?:\{\{\{\{\/[^\s!"#%-,\.\/;->@\[-\^`\{-~]+(?=[=}\s\/.])\}\}\}\})/, /^(?:[^\x00]*?(?=(\{\{\{\{)))/, /^(?:[\s\S]*?--(~)?\}\})/, /^(?:\()/, /^(?:\))/, /^(?:\{\{\{\{)/, /^(?:\}\}\}\})/, /^(?:\{\{(~)?>)/, /^(?:\{\{(~)?#>)/, /^(?:\{\{(~)?#\*?)/, /^(?:\{\{(~)?\/)/, /^(?:\{\{(~)?\^\s*(~)?\}\})/, /^(?:\{\{(~)?\s*else\s*(~)?\}\})/, /^(?:\{\{(~)?\^)/, /^(?:\{\{(~)?\s*else\b)/, /^(?:\{\{(~)?\{)/, /^(?:\{\{(~)?&)/, /^(?:\{\{(~)?!--)/, /^(?:\{\{(~)?![\s\S]*?\}\})/, /^(?:\{\{(~)?\*?)/, /^(?:=)/, /^(?:\.\.)/, /^(?:\.(?=([=~}\s\/.)|])))/, /^(?:[\/.])/, /^(?:\s+)/, /^(?:\}(~)?\}\})/, /^(?:(~)?\}\})/, /^(?:"(\\["]|[^"])*")/, /^(?:'(\\[']|[^'])*')/, /^(?:@)/, /^(?:true(?=([~}\s)])))/, /^(?:false(?=([~}\s)])))/, /^(?:undefined(?=([~}\s)])))/, /^(?:null(?=([~}\s)])))/, /^(?:-?[0-9]+(?:\.[0-9]+)?(?=([~}\s)])))/, /^(?:as\s+\|)/, /^(?:\|)/, /^(?:([^\s!"#%-,\.\/;->@\[-\^`\{-~]+(?=([=~}\s\/.)|]))))/, /^(?:\[(\\\]|[^\]])*\])/, /^(?:.)/, /^(?:$)/]; + lexer.rules = [/^(?:[^\x00]*?(?=(\{\{)))/, /^(?:[^\x00]+)/, /^(?:[^\x00]{2,}?(?=(\{\{|\\\{\{|\\\\\{\{|$)))/, /^(?:\{\{\{\{(?=[^\/]))/, /^(?:\{\{\{\{\/[^\s!"#%-,\.\/;->@\[-\^`\{-~]+(?=[=}\s\/.])\}\}\}\})/, /^(?:[^\x00]+?(?=(\{\{\{\{)))/, /^(?:[\s\S]*?--(~)?\}\})/, /^(?:\()/, /^(?:\))/, /^(?:\{\{\{\{)/, /^(?:\}\}\}\})/, /^(?:\{\{(~)?>)/, /^(?:\{\{(~)?#>)/, /^(?:\{\{(~)?#\*?)/, /^(?:\{\{(~)?\/)/, /^(?:\{\{(~)?\^\s*(~)?\}\})/, /^(?:\{\{(~)?\s*else\s*(~)?\}\})/, /^(?:\{\{(~)?\^)/, /^(?:\{\{(~)?\s*else\b)/, /^(?:\{\{(~)?\{)/, /^(?:\{\{(~)?&)/, /^(?:\{\{(~)?!--)/, /^(?:\{\{(~)?![\s\S]*?\}\})/, /^(?:\{\{(~)?\*?)/, /^(?:=)/, /^(?:\.\.)/, /^(?:\.(?=([=~}\s\/.)|])))/, /^(?:[\/.])/, /^(?:\s+)/, /^(?:\}(~)?\}\})/, /^(?:(~)?\}\})/, /^(?:"(\\["]|[^"])*")/, /^(?:'(\\[']|[^'])*')/, /^(?:@)/, /^(?:true(?=([~}\s)])))/, /^(?:false(?=([~}\s)])))/, /^(?:undefined(?=([~}\s)])))/, /^(?:null(?=([~}\s)])))/, /^(?:-?[0-9]+(?:\.[0-9]+)?(?=([~}\s)])))/, /^(?:as\s+\|)/, /^(?:\|)/, /^(?:([^\s!"#%-,\.\/;->@\[-\^`\{-~]+(?=([=~}\s\/.)|]))))/, /^(?:\[(\\\]|[^\]])*\])/, /^(?:.)/, /^(?:$)/]; lexer.conditions = { "mu": { "rules": [7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44], "inclusive": false }, "emu": { "rules": [2], "inclusive": false }, "com": { "rules": [6], "inclusive": false }, "raw": { "rules": [3, 4, 5], "inclusive": false }, "INITIAL": { "rules": [0, 1, 44], "inclusive": true } }; return lexer; })(); @@ -3593,13 +3646,19 @@ return /******/ (function(modules) { // webpackBootstrap // PUBLIC API: You can override these methods in a subclass to provide // alternative compiled forms for name lookup and buffering semantics nameLookup: function nameLookup(parent, name /* , type*/) { + var isEnumerable = [this.aliasable('container.propertyIsEnumerable'), '.call(', parent, ',"constructor")']; + if (name === 'constructor') { - return ['(', parent, '.propertyIsEnumerable(\'constructor\') ? ', parent, '.constructor : undefined', ')']; + return ['(', isEnumerable, '?', _actualLookup(), ' : undefined)']; } - if (JavaScriptCompiler.isValidJavaScriptVariableName(name)) { - return [parent, '.', name]; - } else { - return [parent, '[', JSON.stringify(name), ']']; + return _actualLookup(); + + function _actualLookup() { + if (JavaScriptCompiler.isValidJavaScriptVariableName(name)) { + return [parent, '.', name]; + } else { + return [parent, '[', JSON.stringify(name), ']']; + } } }, depthedLookup: function depthedLookup(name) { @@ -3798,7 +3857,6 @@ return /******/ (function(modules) { // webpackBootstrap for (var alias in this.aliases) { // eslint-disable-line guard-for-in var node = this.aliases[alias]; - if (this.aliases.hasOwnProperty(alias) && node.children && node.referenceCount > 1) { varDeclarations += ', alias' + ++aliasCount + '=' + alias; node.children[0] = 'alias' + aliasCount; @@ -4122,7 +4180,7 @@ return /******/ (function(modules) { // webpackBootstrap if (this.hash) { this.hashes.push(this.hash); } - this.hash = { values: [], types: [], contexts: [], ids: [] }; + this.hash = { values: {}, types: [], contexts: [], ids: [] }; }, popHash: function popHash() { var hash = this.hash; @@ -4660,6 +4718,7 @@ return /******/ (function(modules) { // webpackBootstrap setupHelperArgs: function setupHelperArgs(helper, paramSize, params, useRegister) { var options = this.setupParams(helper, paramSize, params); + options.loc = JSON.stringify(this.source.currentLocation); options = this.objectLiteral(options); if (useRegister) { this.useRegister('options'); @@ -4701,7 +4760,7 @@ return /******/ (function(modules) { // webpackBootstrap } if (requireTerminal) { - return [compiler.aliasable('container.strict'), '(', stack, ', ', compiler.quotedString(parts[i]), ')']; + return [compiler.aliasable('container.strict'), '(', stack, ', ', compiler.quotedString(parts[i]), ', ', JSON.stringify(compiler.source.currentLocation), ' )']; } else { return stack; } diff --git a/vendor/assets/javascripts/handlebars.runtime.js b/vendor/assets/javascripts/handlebars.runtime.js index 518e0cd..8a8fa61 100644 --- a/vendor/assets/javascripts/handlebars.runtime.js +++ b/vendor/assets/javascripts/handlebars.runtime.js @@ -1,7 +1,7 @@ /**! @license - handlebars v4.3.1 + handlebars v4.5.2 Copyright (C) 2011-2017 by Yehuda Katz @@ -207,7 +207,7 @@ return /******/ (function(modules) { // webpackBootstrap var _logger2 = _interopRequireDefault(_logger); - var VERSION = '4.3.1'; + var VERSION = '4.5.2'; exports.VERSION = VERSION; var COMPILER_REVISION = 8; exports.COMPILER_REVISION = COMPILER_REVISION; @@ -431,15 +431,20 @@ return /******/ (function(modules) { // webpackBootstrap exports.__esModule = true; - var errorProps = ['description', 'fileName', 'lineNumber', 'message', 'name', 'number', 'stack']; + var errorProps = ['description', 'fileName', 'lineNumber', 'endLineNumber', 'message', 'name', 'number', 'stack']; function Exception(message, node) { var loc = node && node.loc, line = undefined, - column = undefined; + endLineNumber = undefined, + column = undefined, + endColumn = undefined; + if (loc) { line = loc.start.line; + endLineNumber = loc.end.line; column = loc.start.column; + endColumn = loc.end.column; message += ' - ' + line + ':' + column; } @@ -459,6 +464,7 @@ return /******/ (function(modules) { // webpackBootstrap try { if (loc) { this.lineNumber = line; + this.endLineNumber = endLineNumber; // Work around issue under safari where we can't directly set the column value /* istanbul ignore next */ @@ -467,8 +473,13 @@ return /******/ (function(modules) { // webpackBootstrap value: column, enumerable: true }); + Object.defineProperty(this, 'endColumn', { + value: endColumn, + enumerable: true + }); } else { this.column = column; + this.endColumn = endColumn; } } } catch (nop) { @@ -620,7 +631,7 @@ return /******/ (function(modules) { // webpackBootstrap /* 11 */ /***/ (function(module, exports, __webpack_require__) { - 'use strict'; + /* WEBPACK VAR INJECTION */(function(global) {'use strict'; var _interopRequireDefault = __webpack_require__(2)['default']; @@ -682,6 +693,16 @@ return /******/ (function(modules) { // webpackBootstrap execIteration(i, i, i === context.length - 1); } } + } else if (global.Symbol && context[global.Symbol.iterator]) { + var newContext = []; + var iterator = context[global.Symbol.iterator](); + for (var it = iterator.next(); !it.done; it = iterator.next()) { + newContext.push(it.value); + } + context = newContext; + for (var j = context.length; i < j; i++) { + execIteration(i, i, i === context.length - 1); + } } else { var priorKey = undefined; @@ -712,6 +733,7 @@ return /******/ (function(modules) { // webpackBootstrap }; module.exports = exports['default']; + /* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }()))) /***/ }), /* 12 */ @@ -747,12 +769,21 @@ return /******/ (function(modules) { // webpackBootstrap 'use strict'; + var _interopRequireDefault = __webpack_require__(2)['default']; + exports.__esModule = true; var _utils = __webpack_require__(4); + var _exception = __webpack_require__(5); + + var _exception2 = _interopRequireDefault(_exception); + exports['default'] = function (instance) { instance.registerHelper('if', function (conditional, options) { + if (arguments.length != 2) { + throw new _exception2['default']('#if requires exactly one argument'); + } if (_utils.isFunction(conditional)) { conditional = conditional.call(this); } @@ -768,6 +799,9 @@ return /******/ (function(modules) { // webpackBootstrap }); instance.registerHelper('unless', function (conditional, options) { + if (arguments.length != 2) { + throw new _exception2['default']('#unless requires exactly one argument'); + } return instance.helpers['if'].call(this, conditional, { fn: options.inverse, inverse: options.fn, hash: options.hash }); }); }; @@ -817,7 +851,7 @@ return /******/ (function(modules) { // webpackBootstrap if (!obj) { return obj; } - if (field === 'constructor' && !obj.propertyIsEnumerable(field)) { + if (String(field) === 'constructor' && !obj.propertyIsEnumerable(field)) { return undefined; } return obj[field]; @@ -832,12 +866,21 @@ return /******/ (function(modules) { // webpackBootstrap 'use strict'; + var _interopRequireDefault = __webpack_require__(2)['default']; + exports.__esModule = true; var _utils = __webpack_require__(4); + var _exception = __webpack_require__(5); + + var _exception2 = _interopRequireDefault(_exception); + exports['default'] = function (instance) { instance.registerHelper('with', function (context, options) { + if (arguments.length != 2) { + throw new _exception2['default']('#with requires exactly one argument'); + } if (_utils.isFunction(context)) { context = context.call(this); } @@ -1091,9 +1134,9 @@ return /******/ (function(modules) { // webpackBootstrap // Just add water var container = { - strict: function strict(obj, name) { - if (!(name in obj)) { - throw new _exception2['default']('"' + name + '" not defined in ' + obj); + strict: function strict(obj, name, loc) { + if (!obj || !(name in obj)) { + throw new _exception2['default']('"' + name + '" not defined in ' + obj, { loc: loc }); } return obj[name]; }, From d187d924d675d8830d374a280cf2dada68114c18 Mon Sep 17 00:00:00 2001 From: Alex Riedler Date: Thu, 14 Nov 2019 20:13:01 -0500 Subject: [PATCH 71/81] Bump handlebars_assets to 0.23.6 --- lib/handlebars_assets/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/handlebars_assets/version.rb b/lib/handlebars_assets/version.rb index 0704b30..5a90ea8 100644 --- a/lib/handlebars_assets/version.rb +++ b/lib/handlebars_assets/version.rb @@ -1,3 +1,3 @@ module HandlebarsAssets - VERSION = "0.23.5" + VERSION = "0.23.6" end From 1aeeb71c2a41ef789b4648906fdc8c03dab97f90 Mon Sep 17 00:00:00 2001 From: Alex Riedler Date: Wed, 20 Nov 2019 23:27:45 -0500 Subject: [PATCH 72/81] Upgrade Handlebars.js to v4.5.3 --- vendor/assets/javascripts/handlebars.js | 513 ++++++++++-------- .../assets/javascripts/handlebars.runtime.js | 391 +++++++------ 2 files changed, 509 insertions(+), 395 deletions(-) diff --git a/vendor/assets/javascripts/handlebars.js b/vendor/assets/javascripts/handlebars.js index 76b8e43..c390da2 100644 --- a/vendor/assets/javascripts/handlebars.js +++ b/vendor/assets/javascripts/handlebars.js @@ -1,7 +1,7 @@ /**! @license - handlebars v4.5.2 + handlebars v4.5.3 Copyright (C) 2011-2017 by Yehuda Katz @@ -92,23 +92,23 @@ return /******/ (function(modules) { // webpackBootstrap // Compiler imports - var _handlebarsCompilerAst = __webpack_require__(35); + var _handlebarsCompilerAst = __webpack_require__(40); var _handlebarsCompilerAst2 = _interopRequireDefault(_handlebarsCompilerAst); - var _handlebarsCompilerBase = __webpack_require__(36); + var _handlebarsCompilerBase = __webpack_require__(41); - var _handlebarsCompilerCompiler = __webpack_require__(41); + var _handlebarsCompilerCompiler = __webpack_require__(46); - var _handlebarsCompilerJavascriptCompiler = __webpack_require__(42); + var _handlebarsCompilerJavascriptCompiler = __webpack_require__(49); var _handlebarsCompilerJavascriptCompiler2 = _interopRequireDefault(_handlebarsCompilerJavascriptCompiler); - var _handlebarsCompilerVisitor = __webpack_require__(39); + var _handlebarsCompilerVisitor = __webpack_require__(44); var _handlebarsCompilerVisitor2 = _interopRequireDefault(_handlebarsCompilerVisitor); - var _handlebarsNoConflict = __webpack_require__(34); + var _handlebarsNoConflict = __webpack_require__(39); var _handlebarsNoConflict2 = _interopRequireDefault(_handlebarsNoConflict); @@ -178,7 +178,7 @@ return /******/ (function(modules) { // webpackBootstrap // Each of these augment the Handlebars object. No need to setup here. // (This is done to easily share code between commonjs and browse envs) - var _handlebarsSafeString = __webpack_require__(21); + var _handlebarsSafeString = __webpack_require__(33); var _handlebarsSafeString2 = _interopRequireDefault(_handlebarsSafeString); @@ -190,11 +190,11 @@ return /******/ (function(modules) { // webpackBootstrap var Utils = _interopRequireWildcard(_handlebarsUtils); - var _handlebarsRuntime = __webpack_require__(22); + var _handlebarsRuntime = __webpack_require__(34); var runtime = _interopRequireWildcard(_handlebarsRuntime); - var _handlebarsNoConflict = __webpack_require__(34); + var _handlebarsNoConflict = __webpack_require__(39); var _handlebarsNoConflict2 = _interopRequireDefault(_handlebarsNoConflict); @@ -270,13 +270,13 @@ return /******/ (function(modules) { // webpackBootstrap var _helpers = __webpack_require__(10); - var _decorators = __webpack_require__(18); + var _decorators = __webpack_require__(30); - var _logger = __webpack_require__(20); + var _logger = __webpack_require__(32); var _logger2 = _interopRequireDefault(_logger); - var VERSION = '4.5.2'; + var VERSION = '4.5.3'; exports.VERSION = VERSION; var COMPILER_REVISION = 8; exports.COMPILER_REVISION = COMPILER_REVISION; @@ -614,23 +614,23 @@ return /******/ (function(modules) { // webpackBootstrap var _helpersEach2 = _interopRequireDefault(_helpersEach); - var _helpersHelperMissing = __webpack_require__(13); + var _helpersHelperMissing = __webpack_require__(25); var _helpersHelperMissing2 = _interopRequireDefault(_helpersHelperMissing); - var _helpersIf = __webpack_require__(14); + var _helpersIf = __webpack_require__(26); var _helpersIf2 = _interopRequireDefault(_helpersIf); - var _helpersLog = __webpack_require__(15); + var _helpersLog = __webpack_require__(27); var _helpersLog2 = _interopRequireDefault(_helpersLog); - var _helpersLookup = __webpack_require__(16); + var _helpersLookup = __webpack_require__(28); var _helpersLookup2 = _interopRequireDefault(_helpersLookup); - var _helpersWith = __webpack_require__(17); + var _helpersWith = __webpack_require__(29); var _helpersWith2 = _interopRequireDefault(_helpersWith); @@ -702,6 +702,8 @@ return /******/ (function(modules) { // webpackBootstrap /* WEBPACK VAR INJECTION */(function(global) {'use strict'; + var _Object$keys = __webpack_require__(13)['default']; + var _interopRequireDefault = __webpack_require__(1)['default']; exports.__esModule = true; @@ -773,10 +775,10 @@ return /******/ (function(modules) { // webpackBootstrap execIteration(i, i, i === context.length - 1); } } else { - var priorKey = undefined; + (function () { + var priorKey = undefined; - for (var key in context) { - if (context.hasOwnProperty(key)) { + _Object$keys(context).forEach(function (key) { // We're running the iterations one step out of sync so we can detect // the last iteration without have to scan the object twice and create // an itermediate keys array. @@ -785,11 +787,11 @@ return /******/ (function(modules) { // webpackBootstrap } priorKey = key; i++; + }); + if (priorKey !== undefined) { + execIteration(priorKey, i - 1, true); } - } - if (priorKey !== undefined) { - execIteration(priorKey, i - 1, true); - } + })(); } } @@ -806,6 +808,180 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }), /* 13 */ +/***/ (function(module, exports, __webpack_require__) { + + module.exports = { "default": __webpack_require__(14), __esModule: true }; + +/***/ }), +/* 14 */ +/***/ (function(module, exports, __webpack_require__) { + + __webpack_require__(15); + module.exports = __webpack_require__(21).Object.keys; + +/***/ }), +/* 15 */ +/***/ (function(module, exports, __webpack_require__) { + + // 19.1.2.14 Object.keys(O) + var toObject = __webpack_require__(16); + + __webpack_require__(18)('keys', function($keys){ + return function keys(it){ + return $keys(toObject(it)); + }; + }); + +/***/ }), +/* 16 */ +/***/ (function(module, exports, __webpack_require__) { + + // 7.1.13 ToObject(argument) + var defined = __webpack_require__(17); + module.exports = function(it){ + return Object(defined(it)); + }; + +/***/ }), +/* 17 */ +/***/ (function(module, exports) { + + // 7.2.1 RequireObjectCoercible(argument) + module.exports = function(it){ + if(it == undefined)throw TypeError("Can't call method on " + it); + return it; + }; + +/***/ }), +/* 18 */ +/***/ (function(module, exports, __webpack_require__) { + + // most Object methods by ES6 should accept primitives + var $export = __webpack_require__(19) + , core = __webpack_require__(21) + , fails = __webpack_require__(24); + module.exports = function(KEY, exec){ + var fn = (core.Object || {})[KEY] || Object[KEY] + , exp = {}; + exp[KEY] = exec(fn); + $export($export.S + $export.F * fails(function(){ fn(1); }), 'Object', exp); + }; + +/***/ }), +/* 19 */ +/***/ (function(module, exports, __webpack_require__) { + + var global = __webpack_require__(20) + , core = __webpack_require__(21) + , ctx = __webpack_require__(22) + , PROTOTYPE = 'prototype'; + + var $export = function(type, name, source){ + var IS_FORCED = type & $export.F + , IS_GLOBAL = type & $export.G + , IS_STATIC = type & $export.S + , IS_PROTO = type & $export.P + , IS_BIND = type & $export.B + , IS_WRAP = type & $export.W + , exports = IS_GLOBAL ? core : core[name] || (core[name] = {}) + , target = IS_GLOBAL ? global : IS_STATIC ? global[name] : (global[name] || {})[PROTOTYPE] + , key, own, out; + if(IS_GLOBAL)source = name; + for(key in source){ + // contains in native + own = !IS_FORCED && target && key in target; + if(own && key in exports)continue; + // export native or passed + out = own ? target[key] : source[key]; + // prevent global pollution for namespaces + exports[key] = IS_GLOBAL && typeof target[key] != 'function' ? source[key] + // bind timers to global for call from export context + : IS_BIND && own ? ctx(out, global) + // wrap global constructors for prevent change them in library + : IS_WRAP && target[key] == out ? (function(C){ + var F = function(param){ + return this instanceof C ? new C(param) : C(param); + }; + F[PROTOTYPE] = C[PROTOTYPE]; + return F; + // make static versions for prototype methods + })(out) : IS_PROTO && typeof out == 'function' ? ctx(Function.call, out) : out; + if(IS_PROTO)(exports[PROTOTYPE] || (exports[PROTOTYPE] = {}))[key] = out; + } + }; + // type bitmap + $export.F = 1; // forced + $export.G = 2; // global + $export.S = 4; // static + $export.P = 8; // proto + $export.B = 16; // bind + $export.W = 32; // wrap + module.exports = $export; + +/***/ }), +/* 20 */ +/***/ (function(module, exports) { + + // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028 + var global = module.exports = typeof window != 'undefined' && window.Math == Math + ? window : typeof self != 'undefined' && self.Math == Math ? self : Function('return this')(); + if(typeof __g == 'number')__g = global; // eslint-disable-line no-undef + +/***/ }), +/* 21 */ +/***/ (function(module, exports) { + + var core = module.exports = {version: '1.2.6'}; + if(typeof __e == 'number')__e = core; // eslint-disable-line no-undef + +/***/ }), +/* 22 */ +/***/ (function(module, exports, __webpack_require__) { + + // optional / simple context binding + var aFunction = __webpack_require__(23); + module.exports = function(fn, that, length){ + aFunction(fn); + if(that === undefined)return fn; + switch(length){ + case 1: return function(a){ + return fn.call(that, a); + }; + case 2: return function(a, b){ + return fn.call(that, a, b); + }; + case 3: return function(a, b, c){ + return fn.call(that, a, b, c); + }; + } + return function(/* ...args */){ + return fn.apply(that, arguments); + }; + }; + +/***/ }), +/* 23 */ +/***/ (function(module, exports) { + + module.exports = function(it){ + if(typeof it != 'function')throw TypeError(it + ' is not a function!'); + return it; + }; + +/***/ }), +/* 24 */ +/***/ (function(module, exports) { + + module.exports = function(exec){ + try { + return !!exec(); + } catch(e){ + return true; + } + }; + +/***/ }), +/* 25 */ /***/ (function(module, exports, __webpack_require__) { 'use strict'; @@ -833,7 +1009,7 @@ return /******/ (function(modules) { // webpackBootstrap module.exports = exports['default']; /***/ }), -/* 14 */ +/* 26 */ /***/ (function(module, exports, __webpack_require__) { 'use strict'; @@ -878,7 +1054,7 @@ return /******/ (function(modules) { // webpackBootstrap module.exports = exports['default']; /***/ }), -/* 15 */ +/* 27 */ /***/ (function(module, exports) { 'use strict'; @@ -908,29 +1084,30 @@ return /******/ (function(modules) { // webpackBootstrap module.exports = exports['default']; /***/ }), -/* 16 */ +/* 28 */ /***/ (function(module, exports) { 'use strict'; exports.__esModule = true; + var dangerousPropertyRegex = /^(constructor|__defineGetter__|__defineSetter__|__lookupGetter__|__proto__)$/; + + exports.dangerousPropertyRegex = dangerousPropertyRegex; exports['default'] = function (instance) { instance.registerHelper('lookup', function (obj, field) { if (!obj) { return obj; } - if (String(field) === 'constructor' && !obj.propertyIsEnumerable(field)) { + if (dangerousPropertyRegex.test(String(field)) && !Object.prototype.propertyIsEnumerable.call(obj, field)) { return undefined; } return obj[field]; }); }; - module.exports = exports['default']; - /***/ }), -/* 17 */ +/* 29 */ /***/ (function(module, exports, __webpack_require__) { 'use strict'; @@ -976,7 +1153,7 @@ return /******/ (function(modules) { // webpackBootstrap module.exports = exports['default']; /***/ }), -/* 18 */ +/* 30 */ /***/ (function(module, exports, __webpack_require__) { 'use strict'; @@ -986,7 +1163,7 @@ return /******/ (function(modules) { // webpackBootstrap exports.__esModule = true; exports.registerDefaultDecorators = registerDefaultDecorators; - var _decoratorsInline = __webpack_require__(19); + var _decoratorsInline = __webpack_require__(31); var _decoratorsInline2 = _interopRequireDefault(_decoratorsInline); @@ -995,7 +1172,7 @@ return /******/ (function(modules) { // webpackBootstrap } /***/ }), -/* 19 */ +/* 31 */ /***/ (function(module, exports, __webpack_require__) { 'use strict'; @@ -1028,7 +1205,7 @@ return /******/ (function(modules) { // webpackBootstrap module.exports = exports['default']; /***/ }), -/* 20 */ +/* 32 */ /***/ (function(module, exports, __webpack_require__) { 'use strict'; @@ -1079,7 +1256,7 @@ return /******/ (function(modules) { // webpackBootstrap module.exports = exports['default']; /***/ }), -/* 21 */ +/* 33 */ /***/ (function(module, exports) { // Build out our basic SafeString type @@ -1098,12 +1275,12 @@ return /******/ (function(modules) { // webpackBootstrap module.exports = exports['default']; /***/ }), -/* 22 */ +/* 34 */ /***/ (function(module, exports, __webpack_require__) { 'use strict'; - var _Object$seal = __webpack_require__(23)['default']; + var _Object$seal = __webpack_require__(35)['default']; var _interopRequireWildcard = __webpack_require__(3)['default']; @@ -1420,33 +1597,33 @@ return /******/ (function(modules) { // webpackBootstrap } /***/ }), -/* 23 */ +/* 35 */ /***/ (function(module, exports, __webpack_require__) { - module.exports = { "default": __webpack_require__(24), __esModule: true }; + module.exports = { "default": __webpack_require__(36), __esModule: true }; /***/ }), -/* 24 */ +/* 36 */ /***/ (function(module, exports, __webpack_require__) { - __webpack_require__(25); - module.exports = __webpack_require__(30).Object.seal; + __webpack_require__(37); + module.exports = __webpack_require__(21).Object.seal; /***/ }), -/* 25 */ +/* 37 */ /***/ (function(module, exports, __webpack_require__) { // 19.1.2.17 Object.seal(O) - var isObject = __webpack_require__(26); + var isObject = __webpack_require__(38); - __webpack_require__(27)('seal', function($seal){ + __webpack_require__(18)('seal', function($seal){ return function seal(it){ return $seal && isObject(it) ? $seal(it) : it; }; }); /***/ }), -/* 26 */ +/* 38 */ /***/ (function(module, exports) { module.exports = function(it){ @@ -1454,135 +1631,7 @@ return /******/ (function(modules) { // webpackBootstrap }; /***/ }), -/* 27 */ -/***/ (function(module, exports, __webpack_require__) { - - // most Object methods by ES6 should accept primitives - var $export = __webpack_require__(28) - , core = __webpack_require__(30) - , fails = __webpack_require__(33); - module.exports = function(KEY, exec){ - var fn = (core.Object || {})[KEY] || Object[KEY] - , exp = {}; - exp[KEY] = exec(fn); - $export($export.S + $export.F * fails(function(){ fn(1); }), 'Object', exp); - }; - -/***/ }), -/* 28 */ -/***/ (function(module, exports, __webpack_require__) { - - var global = __webpack_require__(29) - , core = __webpack_require__(30) - , ctx = __webpack_require__(31) - , PROTOTYPE = 'prototype'; - - var $export = function(type, name, source){ - var IS_FORCED = type & $export.F - , IS_GLOBAL = type & $export.G - , IS_STATIC = type & $export.S - , IS_PROTO = type & $export.P - , IS_BIND = type & $export.B - , IS_WRAP = type & $export.W - , exports = IS_GLOBAL ? core : core[name] || (core[name] = {}) - , target = IS_GLOBAL ? global : IS_STATIC ? global[name] : (global[name] || {})[PROTOTYPE] - , key, own, out; - if(IS_GLOBAL)source = name; - for(key in source){ - // contains in native - own = !IS_FORCED && target && key in target; - if(own && key in exports)continue; - // export native or passed - out = own ? target[key] : source[key]; - // prevent global pollution for namespaces - exports[key] = IS_GLOBAL && typeof target[key] != 'function' ? source[key] - // bind timers to global for call from export context - : IS_BIND && own ? ctx(out, global) - // wrap global constructors for prevent change them in library - : IS_WRAP && target[key] == out ? (function(C){ - var F = function(param){ - return this instanceof C ? new C(param) : C(param); - }; - F[PROTOTYPE] = C[PROTOTYPE]; - return F; - // make static versions for prototype methods - })(out) : IS_PROTO && typeof out == 'function' ? ctx(Function.call, out) : out; - if(IS_PROTO)(exports[PROTOTYPE] || (exports[PROTOTYPE] = {}))[key] = out; - } - }; - // type bitmap - $export.F = 1; // forced - $export.G = 2; // global - $export.S = 4; // static - $export.P = 8; // proto - $export.B = 16; // bind - $export.W = 32; // wrap - module.exports = $export; - -/***/ }), -/* 29 */ -/***/ (function(module, exports) { - - // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028 - var global = module.exports = typeof window != 'undefined' && window.Math == Math - ? window : typeof self != 'undefined' && self.Math == Math ? self : Function('return this')(); - if(typeof __g == 'number')__g = global; // eslint-disable-line no-undef - -/***/ }), -/* 30 */ -/***/ (function(module, exports) { - - var core = module.exports = {version: '1.2.6'}; - if(typeof __e == 'number')__e = core; // eslint-disable-line no-undef - -/***/ }), -/* 31 */ -/***/ (function(module, exports, __webpack_require__) { - - // optional / simple context binding - var aFunction = __webpack_require__(32); - module.exports = function(fn, that, length){ - aFunction(fn); - if(that === undefined)return fn; - switch(length){ - case 1: return function(a){ - return fn.call(that, a); - }; - case 2: return function(a, b){ - return fn.call(that, a, b); - }; - case 3: return function(a, b, c){ - return fn.call(that, a, b, c); - }; - } - return function(/* ...args */){ - return fn.apply(that, arguments); - }; - }; - -/***/ }), -/* 32 */ -/***/ (function(module, exports) { - - module.exports = function(it){ - if(typeof it != 'function')throw TypeError(it + ' is not a function!'); - return it; - }; - -/***/ }), -/* 33 */ -/***/ (function(module, exports) { - - module.exports = function(exec){ - try { - return !!exec(); - } catch(e){ - return true; - } - }; - -/***/ }), -/* 34 */ +/* 39 */ /***/ (function(module, exports) { /* WEBPACK VAR INJECTION */(function(global) {/* global window */ @@ -1607,7 +1656,7 @@ return /******/ (function(modules) { // webpackBootstrap /* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }()))) /***/ }), -/* 35 */ +/* 40 */ /***/ (function(module, exports) { 'use strict'; @@ -1642,7 +1691,7 @@ return /******/ (function(modules) { // webpackBootstrap module.exports = exports['default']; /***/ }), -/* 36 */ +/* 41 */ /***/ (function(module, exports, __webpack_require__) { 'use strict'; @@ -1655,15 +1704,15 @@ return /******/ (function(modules) { // webpackBootstrap exports.parseWithoutProcessing = parseWithoutProcessing; exports.parse = parse; - var _parser = __webpack_require__(37); + var _parser = __webpack_require__(42); var _parser2 = _interopRequireDefault(_parser); - var _whitespaceControl = __webpack_require__(38); + var _whitespaceControl = __webpack_require__(43); var _whitespaceControl2 = _interopRequireDefault(_whitespaceControl); - var _helpers = __webpack_require__(40); + var _helpers = __webpack_require__(45); var Helpers = _interopRequireWildcard(_helpers); @@ -1700,7 +1749,7 @@ return /******/ (function(modules) { // webpackBootstrap } /***/ }), -/* 37 */ +/* 42 */ /***/ (function(module, exports) { // File ignored in coverage tests via setting in .istanbul.yml @@ -2441,7 +2490,7 @@ return /******/ (function(modules) { // webpackBootstrap module.exports = exports["default"]; /***/ }), -/* 38 */ +/* 43 */ /***/ (function(module, exports, __webpack_require__) { 'use strict'; @@ -2450,7 +2499,7 @@ return /******/ (function(modules) { // webpackBootstrap exports.__esModule = true; - var _visitor = __webpack_require__(39); + var _visitor = __webpack_require__(44); var _visitor2 = _interopRequireDefault(_visitor); @@ -2665,7 +2714,7 @@ return /******/ (function(modules) { // webpackBootstrap module.exports = exports['default']; /***/ }), -/* 39 */ +/* 44 */ /***/ (function(module, exports, __webpack_require__) { 'use strict'; @@ -2808,7 +2857,7 @@ return /******/ (function(modules) { // webpackBootstrap module.exports = exports['default']; /***/ }), -/* 40 */ +/* 45 */ /***/ (function(module, exports, __webpack_require__) { 'use strict'; @@ -3039,13 +3088,15 @@ return /******/ (function(modules) { // webpackBootstrap } /***/ }), -/* 41 */ +/* 46 */ /***/ (function(module, exports, __webpack_require__) { /* eslint-disable new-cap */ 'use strict'; + var _Object$create = __webpack_require__(47)['default']; + var _interopRequireDefault = __webpack_require__(1)['default']; exports.__esModule = true; @@ -3059,7 +3110,7 @@ return /******/ (function(modules) { // webpackBootstrap var _utils = __webpack_require__(5); - var _ast = __webpack_require__(35); + var _ast = __webpack_require__(40); var _ast2 = _interopRequireDefault(_ast); @@ -3113,9 +3164,7 @@ return /******/ (function(modules) { // webpackBootstrap options.blockParams = options.blockParams || []; - // These changes will propagate to the other compiler components - var knownHelpers = options.knownHelpers; - options.knownHelpers = { + options.knownHelpers = _utils.extend(_Object$create(null), { 'helperMissing': true, 'blockHelperMissing': true, 'each': true, @@ -3124,15 +3173,7 @@ return /******/ (function(modules) { // webpackBootstrap 'with': true, 'log': true, 'lookup': true - }; - if (knownHelpers) { - // the next line should use "Object.keys", but the code has been like this a long time and changing it, might - // cause backwards-compatibility issues... It's an old library... - // eslint-disable-next-line guard-for-in - for (var _name in knownHelpers) { - this.options.knownHelpers[_name] = knownHelpers[_name]; - } - } + }, options.knownHelpers); return this.accept(program); }, @@ -3426,10 +3467,9 @@ return /******/ (function(modules) { // webpackBootstrap // if ambiguous, we can possibly resolve the ambiguity now // An eligible helper is one that does not have a complex path, i.e. `this.foo`, `../foo` etc. if (isEligible && !isHelper) { - var _name2 = sexpr.path.parts[0], + var _name = sexpr.path.parts[0], options = this.options; - - if (options.knownHelpers[_name2]) { + if (options.knownHelpers[_name]) { isHelper = true; } else if (options.knownHelpersOnly) { isEligible = false; @@ -3615,11 +3655,28 @@ return /******/ (function(modules) { // webpackBootstrap } /***/ }), -/* 42 */ +/* 47 */ +/***/ (function(module, exports, __webpack_require__) { + + module.exports = { "default": __webpack_require__(48), __esModule: true }; + +/***/ }), +/* 48 */ +/***/ (function(module, exports, __webpack_require__) { + + var $ = __webpack_require__(9); + module.exports = function create(P, D){ + return $.create(P, D); + }; + +/***/ }), +/* 49 */ /***/ (function(module, exports, __webpack_require__) { 'use strict'; + var _Object$keys = __webpack_require__(13)['default']; + var _interopRequireDefault = __webpack_require__(1)['default']; exports.__esModule = true; @@ -3632,10 +3689,12 @@ return /******/ (function(modules) { // webpackBootstrap var _utils = __webpack_require__(5); - var _codeGen = __webpack_require__(43); + var _codeGen = __webpack_require__(50); var _codeGen2 = _interopRequireDefault(_codeGen); + var _helpersLookup = __webpack_require__(28); + function Literal(value) { this.value = value; } @@ -3646,9 +3705,8 @@ return /******/ (function(modules) { // webpackBootstrap // PUBLIC API: You can override these methods in a subclass to provide // alternative compiled forms for name lookup and buffering semantics nameLookup: function nameLookup(parent, name /* , type*/) { - var isEnumerable = [this.aliasable('container.propertyIsEnumerable'), '.call(', parent, ',"constructor")']; - - if (name === 'constructor') { + if (_helpersLookup.dangerousPropertyRegex.test(name)) { + var isEnumerable = [this.aliasable('container.propertyIsEnumerable'), '.call(', parent, ',', JSON.stringify(name), ')']; return ['(', isEnumerable, '?', _actualLookup(), ' : undefined)']; } return _actualLookup(); @@ -3840,6 +3898,10 @@ return /******/ (function(modules) { // webpackBootstrap }, createFunctionContext: function createFunctionContext(asObject) { + // istanbul ignore next + + var _this = this; + var varDeclarations = ''; var locals = this.stackVars.concat(this.registers.list); @@ -3854,14 +3916,13 @@ return /******/ (function(modules) { // webpackBootstrap // aliases will not be used, but this case is already being run on the client and // we aren't concern about minimizing the template size. var aliasCount = 0; - for (var alias in this.aliases) { - // eslint-disable-line guard-for-in - var node = this.aliases[alias]; - if (this.aliases.hasOwnProperty(alias) && node.children && node.referenceCount > 1) { + _Object$keys(this.aliases).forEach(function (alias) { + var node = _this.aliases[alias]; + if (node.children && node.referenceCount > 1) { varDeclarations += ', alias' + ++aliasCount + '=' + alias; node.children[0] = 'alias' + aliasCount; } - } + }); var params = ['container', 'depth0', 'helpers', 'partials', 'data']; @@ -4107,7 +4168,7 @@ return /******/ (function(modules) { // webpackBootstrap resolvePath: function resolvePath(type, parts, i, falsy, strict) { // istanbul ignore next - var _this = this; + var _this2 = this; if (this.options.strict || this.options.assumeObjects) { this.push(strictLookup(this.options.strict && strict, this, parts, type)); @@ -4118,7 +4179,7 @@ return /******/ (function(modules) { // webpackBootstrap for (; i < len; i++) { /* eslint-disable no-loop-func */ this.replaceStack(function (current) { - var lookup = _this.nameLookup(current, parts[i], type); + var lookup = _this2.nameLookup(current, parts[i], type); // We want to ensure that zero and false are handled properly if the context (falsy flag) // needs to have the special handling for these values. if (!falsy) { @@ -4770,12 +4831,14 @@ return /******/ (function(modules) { // webpackBootstrap module.exports = exports['default']; /***/ }), -/* 43 */ +/* 50 */ /***/ (function(module, exports, __webpack_require__) { /* global define */ 'use strict'; + var _Object$keys = __webpack_require__(13)['default']; + exports.__esModule = true; var _utils = __webpack_require__(5); @@ -4896,16 +4959,18 @@ return /******/ (function(modules) { // webpackBootstrap }, objectLiteral: function objectLiteral(obj) { + // istanbul ignore next + + var _this = this; + var pairs = []; - for (var key in obj) { - if (obj.hasOwnProperty(key)) { - var value = castChunk(obj[key], this); - if (value !== 'undefined') { - pairs.push([this.quotedString(key), ':', value]); - } + _Object$keys(obj).forEach(function (key) { + var value = castChunk(obj[key], _this); + if (value !== 'undefined') { + pairs.push([_this.quotedString(key), ':', value]); } - } + }); var ret = this.generateList(pairs); ret.prepend('{'); diff --git a/vendor/assets/javascripts/handlebars.runtime.js b/vendor/assets/javascripts/handlebars.runtime.js index 8a8fa61..5e1fd07 100644 --- a/vendor/assets/javascripts/handlebars.runtime.js +++ b/vendor/assets/javascripts/handlebars.runtime.js @@ -1,7 +1,7 @@ /**! @license - handlebars v4.5.2 + handlebars v4.5.3 Copyright (C) 2011-2017 by Yehuda Katz @@ -95,7 +95,7 @@ return /******/ (function(modules) { // webpackBootstrap // Each of these augment the Handlebars object. No need to setup here. // (This is done to easily share code between commonjs and browse envs) - var _handlebarsSafeString = __webpack_require__(20); + var _handlebarsSafeString = __webpack_require__(32); var _handlebarsSafeString2 = _interopRequireDefault(_handlebarsSafeString); @@ -107,11 +107,11 @@ return /******/ (function(modules) { // webpackBootstrap var Utils = _interopRequireWildcard(_handlebarsUtils); - var _handlebarsRuntime = __webpack_require__(21); + var _handlebarsRuntime = __webpack_require__(33); var runtime = _interopRequireWildcard(_handlebarsRuntime); - var _handlebarsNoConflict = __webpack_require__(33); + var _handlebarsNoConflict = __webpack_require__(38); var _handlebarsNoConflict2 = _interopRequireDefault(_handlebarsNoConflict); @@ -201,13 +201,13 @@ return /******/ (function(modules) { // webpackBootstrap var _helpers = __webpack_require__(9); - var _decorators = __webpack_require__(17); + var _decorators = __webpack_require__(29); - var _logger = __webpack_require__(19); + var _logger = __webpack_require__(31); var _logger2 = _interopRequireDefault(_logger); - var VERSION = '4.5.2'; + var VERSION = '4.5.3'; exports.VERSION = VERSION; var COMPILER_REVISION = 8; exports.COMPILER_REVISION = COMPILER_REVISION; @@ -545,23 +545,23 @@ return /******/ (function(modules) { // webpackBootstrap var _helpersEach2 = _interopRequireDefault(_helpersEach); - var _helpersHelperMissing = __webpack_require__(12); + var _helpersHelperMissing = __webpack_require__(24); var _helpersHelperMissing2 = _interopRequireDefault(_helpersHelperMissing); - var _helpersIf = __webpack_require__(13); + var _helpersIf = __webpack_require__(25); var _helpersIf2 = _interopRequireDefault(_helpersIf); - var _helpersLog = __webpack_require__(14); + var _helpersLog = __webpack_require__(26); var _helpersLog2 = _interopRequireDefault(_helpersLog); - var _helpersLookup = __webpack_require__(15); + var _helpersLookup = __webpack_require__(27); var _helpersLookup2 = _interopRequireDefault(_helpersLookup); - var _helpersWith = __webpack_require__(16); + var _helpersWith = __webpack_require__(28); var _helpersWith2 = _interopRequireDefault(_helpersWith); @@ -633,6 +633,8 @@ return /******/ (function(modules) { // webpackBootstrap /* WEBPACK VAR INJECTION */(function(global) {'use strict'; + var _Object$keys = __webpack_require__(12)['default']; + var _interopRequireDefault = __webpack_require__(2)['default']; exports.__esModule = true; @@ -704,10 +706,10 @@ return /******/ (function(modules) { // webpackBootstrap execIteration(i, i, i === context.length - 1); } } else { - var priorKey = undefined; + (function () { + var priorKey = undefined; - for (var key in context) { - if (context.hasOwnProperty(key)) { + _Object$keys(context).forEach(function (key) { // We're running the iterations one step out of sync so we can detect // the last iteration without have to scan the object twice and create // an itermediate keys array. @@ -716,11 +718,11 @@ return /******/ (function(modules) { // webpackBootstrap } priorKey = key; i++; + }); + if (priorKey !== undefined) { + execIteration(priorKey, i - 1, true); } - } - if (priorKey !== undefined) { - execIteration(priorKey, i - 1, true); - } + })(); } } @@ -737,6 +739,180 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }), /* 12 */ +/***/ (function(module, exports, __webpack_require__) { + + module.exports = { "default": __webpack_require__(13), __esModule: true }; + +/***/ }), +/* 13 */ +/***/ (function(module, exports, __webpack_require__) { + + __webpack_require__(14); + module.exports = __webpack_require__(20).Object.keys; + +/***/ }), +/* 14 */ +/***/ (function(module, exports, __webpack_require__) { + + // 19.1.2.14 Object.keys(O) + var toObject = __webpack_require__(15); + + __webpack_require__(17)('keys', function($keys){ + return function keys(it){ + return $keys(toObject(it)); + }; + }); + +/***/ }), +/* 15 */ +/***/ (function(module, exports, __webpack_require__) { + + // 7.1.13 ToObject(argument) + var defined = __webpack_require__(16); + module.exports = function(it){ + return Object(defined(it)); + }; + +/***/ }), +/* 16 */ +/***/ (function(module, exports) { + + // 7.2.1 RequireObjectCoercible(argument) + module.exports = function(it){ + if(it == undefined)throw TypeError("Can't call method on " + it); + return it; + }; + +/***/ }), +/* 17 */ +/***/ (function(module, exports, __webpack_require__) { + + // most Object methods by ES6 should accept primitives + var $export = __webpack_require__(18) + , core = __webpack_require__(20) + , fails = __webpack_require__(23); + module.exports = function(KEY, exec){ + var fn = (core.Object || {})[KEY] || Object[KEY] + , exp = {}; + exp[KEY] = exec(fn); + $export($export.S + $export.F * fails(function(){ fn(1); }), 'Object', exp); + }; + +/***/ }), +/* 18 */ +/***/ (function(module, exports, __webpack_require__) { + + var global = __webpack_require__(19) + , core = __webpack_require__(20) + , ctx = __webpack_require__(21) + , PROTOTYPE = 'prototype'; + + var $export = function(type, name, source){ + var IS_FORCED = type & $export.F + , IS_GLOBAL = type & $export.G + , IS_STATIC = type & $export.S + , IS_PROTO = type & $export.P + , IS_BIND = type & $export.B + , IS_WRAP = type & $export.W + , exports = IS_GLOBAL ? core : core[name] || (core[name] = {}) + , target = IS_GLOBAL ? global : IS_STATIC ? global[name] : (global[name] || {})[PROTOTYPE] + , key, own, out; + if(IS_GLOBAL)source = name; + for(key in source){ + // contains in native + own = !IS_FORCED && target && key in target; + if(own && key in exports)continue; + // export native or passed + out = own ? target[key] : source[key]; + // prevent global pollution for namespaces + exports[key] = IS_GLOBAL && typeof target[key] != 'function' ? source[key] + // bind timers to global for call from export context + : IS_BIND && own ? ctx(out, global) + // wrap global constructors for prevent change them in library + : IS_WRAP && target[key] == out ? (function(C){ + var F = function(param){ + return this instanceof C ? new C(param) : C(param); + }; + F[PROTOTYPE] = C[PROTOTYPE]; + return F; + // make static versions for prototype methods + })(out) : IS_PROTO && typeof out == 'function' ? ctx(Function.call, out) : out; + if(IS_PROTO)(exports[PROTOTYPE] || (exports[PROTOTYPE] = {}))[key] = out; + } + }; + // type bitmap + $export.F = 1; // forced + $export.G = 2; // global + $export.S = 4; // static + $export.P = 8; // proto + $export.B = 16; // bind + $export.W = 32; // wrap + module.exports = $export; + +/***/ }), +/* 19 */ +/***/ (function(module, exports) { + + // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028 + var global = module.exports = typeof window != 'undefined' && window.Math == Math + ? window : typeof self != 'undefined' && self.Math == Math ? self : Function('return this')(); + if(typeof __g == 'number')__g = global; // eslint-disable-line no-undef + +/***/ }), +/* 20 */ +/***/ (function(module, exports) { + + var core = module.exports = {version: '1.2.6'}; + if(typeof __e == 'number')__e = core; // eslint-disable-line no-undef + +/***/ }), +/* 21 */ +/***/ (function(module, exports, __webpack_require__) { + + // optional / simple context binding + var aFunction = __webpack_require__(22); + module.exports = function(fn, that, length){ + aFunction(fn); + if(that === undefined)return fn; + switch(length){ + case 1: return function(a){ + return fn.call(that, a); + }; + case 2: return function(a, b){ + return fn.call(that, a, b); + }; + case 3: return function(a, b, c){ + return fn.call(that, a, b, c); + }; + } + return function(/* ...args */){ + return fn.apply(that, arguments); + }; + }; + +/***/ }), +/* 22 */ +/***/ (function(module, exports) { + + module.exports = function(it){ + if(typeof it != 'function')throw TypeError(it + ' is not a function!'); + return it; + }; + +/***/ }), +/* 23 */ +/***/ (function(module, exports) { + + module.exports = function(exec){ + try { + return !!exec(); + } catch(e){ + return true; + } + }; + +/***/ }), +/* 24 */ /***/ (function(module, exports, __webpack_require__) { 'use strict'; @@ -764,7 +940,7 @@ return /******/ (function(modules) { // webpackBootstrap module.exports = exports['default']; /***/ }), -/* 13 */ +/* 25 */ /***/ (function(module, exports, __webpack_require__) { 'use strict'; @@ -809,7 +985,7 @@ return /******/ (function(modules) { // webpackBootstrap module.exports = exports['default']; /***/ }), -/* 14 */ +/* 26 */ /***/ (function(module, exports) { 'use strict'; @@ -839,29 +1015,30 @@ return /******/ (function(modules) { // webpackBootstrap module.exports = exports['default']; /***/ }), -/* 15 */ +/* 27 */ /***/ (function(module, exports) { 'use strict'; exports.__esModule = true; + var dangerousPropertyRegex = /^(constructor|__defineGetter__|__defineSetter__|__lookupGetter__|__proto__)$/; + + exports.dangerousPropertyRegex = dangerousPropertyRegex; exports['default'] = function (instance) { instance.registerHelper('lookup', function (obj, field) { if (!obj) { return obj; } - if (String(field) === 'constructor' && !obj.propertyIsEnumerable(field)) { + if (dangerousPropertyRegex.test(String(field)) && !Object.prototype.propertyIsEnumerable.call(obj, field)) { return undefined; } return obj[field]; }); }; - module.exports = exports['default']; - /***/ }), -/* 16 */ +/* 28 */ /***/ (function(module, exports, __webpack_require__) { 'use strict'; @@ -907,7 +1084,7 @@ return /******/ (function(modules) { // webpackBootstrap module.exports = exports['default']; /***/ }), -/* 17 */ +/* 29 */ /***/ (function(module, exports, __webpack_require__) { 'use strict'; @@ -917,7 +1094,7 @@ return /******/ (function(modules) { // webpackBootstrap exports.__esModule = true; exports.registerDefaultDecorators = registerDefaultDecorators; - var _decoratorsInline = __webpack_require__(18); + var _decoratorsInline = __webpack_require__(30); var _decoratorsInline2 = _interopRequireDefault(_decoratorsInline); @@ -926,7 +1103,7 @@ return /******/ (function(modules) { // webpackBootstrap } /***/ }), -/* 18 */ +/* 30 */ /***/ (function(module, exports, __webpack_require__) { 'use strict'; @@ -959,7 +1136,7 @@ return /******/ (function(modules) { // webpackBootstrap module.exports = exports['default']; /***/ }), -/* 19 */ +/* 31 */ /***/ (function(module, exports, __webpack_require__) { 'use strict'; @@ -1010,7 +1187,7 @@ return /******/ (function(modules) { // webpackBootstrap module.exports = exports['default']; /***/ }), -/* 20 */ +/* 32 */ /***/ (function(module, exports) { // Build out our basic SafeString type @@ -1029,12 +1206,12 @@ return /******/ (function(modules) { // webpackBootstrap module.exports = exports['default']; /***/ }), -/* 21 */ +/* 33 */ /***/ (function(module, exports, __webpack_require__) { 'use strict'; - var _Object$seal = __webpack_require__(22)['default']; + var _Object$seal = __webpack_require__(34)['default']; var _interopRequireWildcard = __webpack_require__(1)['default']; @@ -1351,33 +1528,33 @@ return /******/ (function(modules) { // webpackBootstrap } /***/ }), -/* 22 */ +/* 34 */ /***/ (function(module, exports, __webpack_require__) { - module.exports = { "default": __webpack_require__(23), __esModule: true }; + module.exports = { "default": __webpack_require__(35), __esModule: true }; /***/ }), -/* 23 */ +/* 35 */ /***/ (function(module, exports, __webpack_require__) { - __webpack_require__(24); - module.exports = __webpack_require__(29).Object.seal; + __webpack_require__(36); + module.exports = __webpack_require__(20).Object.seal; /***/ }), -/* 24 */ +/* 36 */ /***/ (function(module, exports, __webpack_require__) { // 19.1.2.17 Object.seal(O) - var isObject = __webpack_require__(25); + var isObject = __webpack_require__(37); - __webpack_require__(26)('seal', function($seal){ + __webpack_require__(17)('seal', function($seal){ return function seal(it){ return $seal && isObject(it) ? $seal(it) : it; }; }); /***/ }), -/* 25 */ +/* 37 */ /***/ (function(module, exports) { module.exports = function(it){ @@ -1385,135 +1562,7 @@ return /******/ (function(modules) { // webpackBootstrap }; /***/ }), -/* 26 */ -/***/ (function(module, exports, __webpack_require__) { - - // most Object methods by ES6 should accept primitives - var $export = __webpack_require__(27) - , core = __webpack_require__(29) - , fails = __webpack_require__(32); - module.exports = function(KEY, exec){ - var fn = (core.Object || {})[KEY] || Object[KEY] - , exp = {}; - exp[KEY] = exec(fn); - $export($export.S + $export.F * fails(function(){ fn(1); }), 'Object', exp); - }; - -/***/ }), -/* 27 */ -/***/ (function(module, exports, __webpack_require__) { - - var global = __webpack_require__(28) - , core = __webpack_require__(29) - , ctx = __webpack_require__(30) - , PROTOTYPE = 'prototype'; - - var $export = function(type, name, source){ - var IS_FORCED = type & $export.F - , IS_GLOBAL = type & $export.G - , IS_STATIC = type & $export.S - , IS_PROTO = type & $export.P - , IS_BIND = type & $export.B - , IS_WRAP = type & $export.W - , exports = IS_GLOBAL ? core : core[name] || (core[name] = {}) - , target = IS_GLOBAL ? global : IS_STATIC ? global[name] : (global[name] || {})[PROTOTYPE] - , key, own, out; - if(IS_GLOBAL)source = name; - for(key in source){ - // contains in native - own = !IS_FORCED && target && key in target; - if(own && key in exports)continue; - // export native or passed - out = own ? target[key] : source[key]; - // prevent global pollution for namespaces - exports[key] = IS_GLOBAL && typeof target[key] != 'function' ? source[key] - // bind timers to global for call from export context - : IS_BIND && own ? ctx(out, global) - // wrap global constructors for prevent change them in library - : IS_WRAP && target[key] == out ? (function(C){ - var F = function(param){ - return this instanceof C ? new C(param) : C(param); - }; - F[PROTOTYPE] = C[PROTOTYPE]; - return F; - // make static versions for prototype methods - })(out) : IS_PROTO && typeof out == 'function' ? ctx(Function.call, out) : out; - if(IS_PROTO)(exports[PROTOTYPE] || (exports[PROTOTYPE] = {}))[key] = out; - } - }; - // type bitmap - $export.F = 1; // forced - $export.G = 2; // global - $export.S = 4; // static - $export.P = 8; // proto - $export.B = 16; // bind - $export.W = 32; // wrap - module.exports = $export; - -/***/ }), -/* 28 */ -/***/ (function(module, exports) { - - // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028 - var global = module.exports = typeof window != 'undefined' && window.Math == Math - ? window : typeof self != 'undefined' && self.Math == Math ? self : Function('return this')(); - if(typeof __g == 'number')__g = global; // eslint-disable-line no-undef - -/***/ }), -/* 29 */ -/***/ (function(module, exports) { - - var core = module.exports = {version: '1.2.6'}; - if(typeof __e == 'number')__e = core; // eslint-disable-line no-undef - -/***/ }), -/* 30 */ -/***/ (function(module, exports, __webpack_require__) { - - // optional / simple context binding - var aFunction = __webpack_require__(31); - module.exports = function(fn, that, length){ - aFunction(fn); - if(that === undefined)return fn; - switch(length){ - case 1: return function(a){ - return fn.call(that, a); - }; - case 2: return function(a, b){ - return fn.call(that, a, b); - }; - case 3: return function(a, b, c){ - return fn.call(that, a, b, c); - }; - } - return function(/* ...args */){ - return fn.apply(that, arguments); - }; - }; - -/***/ }), -/* 31 */ -/***/ (function(module, exports) { - - module.exports = function(it){ - if(typeof it != 'function')throw TypeError(it + ' is not a function!'); - return it; - }; - -/***/ }), -/* 32 */ -/***/ (function(module, exports) { - - module.exports = function(exec){ - try { - return !!exec(); - } catch(e){ - return true; - } - }; - -/***/ }), -/* 33 */ +/* 38 */ /***/ (function(module, exports) { /* WEBPACK VAR INJECTION */(function(global) {/* global window */ From 2c89bb36add9e853eeafdc0d01bbd5aa819f0e62 Mon Sep 17 00:00:00 2001 From: Alex Riedler Date: Wed, 20 Nov 2019 23:28:08 -0500 Subject: [PATCH 73/81] Bump handlebars_assets to 0.23.7 --- lib/handlebars_assets/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/handlebars_assets/version.rb b/lib/handlebars_assets/version.rb index 5a90ea8..85bf8aa 100644 --- a/lib/handlebars_assets/version.rb +++ b/lib/handlebars_assets/version.rb @@ -1,3 +1,3 @@ module HandlebarsAssets - VERSION = "0.23.6" + VERSION = "0.23.7" end From 9d86ef1ede4debb6922ba813fe5d18250747d99e Mon Sep 17 00:00:00 2001 From: Alex Riedler Date: Wed, 20 Nov 2019 23:31:17 -0500 Subject: [PATCH 74/81] Update changelog. --- CHANGELOG.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7df0241..cdf8a22 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,11 @@ +## 0.23.7 (2019-11-20) + +* Update Handlebars to v4.5.3 + +## 0.23.6 (2019-11-14) + +* Update Handlebars to v4.5.2 + ## 0.23.5 (2019-09-25) * Update Handlebars to v4.3.1 From ed98741c20141cd84954612ea5c5c0a64162cdc8 Mon Sep 17 00:00:00 2001 From: Alex Riedler Date: Mon, 24 Feb 2020 07:55:32 -0500 Subject: [PATCH 75/81] Upgrade Handlebars.js to v4.7.3 --- CHANGELOG.md | 4 + test/test_helper.rb | 22 +- vendor/assets/javascripts/handlebars.js | 398 +++++++++++++----- .../assets/javascripts/handlebars.runtime.js | 284 +++++++++++-- 4 files changed, 560 insertions(+), 148 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index cdf8a22..82c2649 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.23.8 (2019-02-24) + +* Update Handlebars to v4.7.3 + ## 0.23.7 (2019-11-20) * Update Handlebars to v4.5.3 diff --git a/test/test_helper.rb b/test/test_helper.rb index c829413..8518570 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -27,25 +27,25 @@ def compile_hbs(source) end def hbs_compiled(template_name, source) - compiled_hbs = compile_hbs(source) + compiled_hbs = compile_hbs(source).strip template_namespace = HandlebarsAssets::Config.template_namespace - unindent <<-END_EXPECTED - (function() { - this.#{template_namespace} || (this.#{template_namespace} = {}); - this.#{template_namespace}[#{template_name.dump}] = Handlebars.template(#{compiled_hbs}); - return this.#{template_namespace}[#{template_name.dump}]; - }).call(this); + <<-END_EXPECTED +(function() { + this.#{template_namespace} || (this.#{template_namespace} = {}); + this.#{template_namespace}[#{template_name.dump}] = Handlebars.template(#{compiled_hbs}); + return this.#{template_namespace}[#{template_name.dump}]; +}).call(this); END_EXPECTED end def hbs_compiled_partial(partial_name, source) compiled_hbs = compile_hbs(source) - unindent <<-END_EXPECTED - (function() { - Handlebars.registerPartial(#{partial_name.dump}, Handlebars.template(#{compiled_hbs})); - }).call(this); + <<-END_EXPECTED +(function() { + Handlebars.registerPartial(#{partial_name.dump}, Handlebars.template(#{compiled_hbs})); +}).call(this); END_EXPECTED end end diff --git a/vendor/assets/javascripts/handlebars.js b/vendor/assets/javascripts/handlebars.js index c390da2..0f15865 100644 --- a/vendor/assets/javascripts/handlebars.js +++ b/vendor/assets/javascripts/handlebars.js @@ -1,9 +1,9 @@ /**! @license - handlebars v4.5.3 + handlebars v4.7.3 -Copyright (C) 2011-2017 by Yehuda Katz +Copyright (C) 2011-2019 by Yehuda Katz Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal @@ -92,23 +92,23 @@ return /******/ (function(modules) { // webpackBootstrap // Compiler imports - var _handlebarsCompilerAst = __webpack_require__(40); + var _handlebarsCompilerAst = __webpack_require__(45); var _handlebarsCompilerAst2 = _interopRequireDefault(_handlebarsCompilerAst); - var _handlebarsCompilerBase = __webpack_require__(41); + var _handlebarsCompilerBase = __webpack_require__(46); - var _handlebarsCompilerCompiler = __webpack_require__(46); + var _handlebarsCompilerCompiler = __webpack_require__(51); - var _handlebarsCompilerJavascriptCompiler = __webpack_require__(49); + var _handlebarsCompilerJavascriptCompiler = __webpack_require__(52); var _handlebarsCompilerJavascriptCompiler2 = _interopRequireDefault(_handlebarsCompilerJavascriptCompiler); - var _handlebarsCompilerVisitor = __webpack_require__(44); + var _handlebarsCompilerVisitor = __webpack_require__(49); var _handlebarsCompilerVisitor2 = _interopRequireDefault(_handlebarsCompilerVisitor); - var _handlebarsNoConflict = __webpack_require__(39); + var _handlebarsNoConflict = __webpack_require__(44); var _handlebarsNoConflict2 = _interopRequireDefault(_handlebarsNoConflict); @@ -178,7 +178,7 @@ return /******/ (function(modules) { // webpackBootstrap // Each of these augment the Handlebars object. No need to setup here. // (This is done to easily share code between commonjs and browse envs) - var _handlebarsSafeString = __webpack_require__(33); + var _handlebarsSafeString = __webpack_require__(37); var _handlebarsSafeString2 = _interopRequireDefault(_handlebarsSafeString); @@ -190,11 +190,11 @@ return /******/ (function(modules) { // webpackBootstrap var Utils = _interopRequireWildcard(_handlebarsUtils); - var _handlebarsRuntime = __webpack_require__(34); + var _handlebarsRuntime = __webpack_require__(38); var runtime = _interopRequireWildcard(_handlebarsRuntime); - var _handlebarsNoConflict = __webpack_require__(39); + var _handlebarsNoConflict = __webpack_require__(44); var _handlebarsNoConflict2 = _interopRequireDefault(_handlebarsNoConflict); @@ -276,7 +276,9 @@ return /******/ (function(modules) { // webpackBootstrap var _logger2 = _interopRequireDefault(_logger); - var VERSION = '4.5.3'; + var _internalProtoAccess = __webpack_require__(33); + + var VERSION = '4.7.3'; exports.VERSION = VERSION; var COMPILER_REVISION = 8; exports.COMPILER_REVISION = COMPILER_REVISION; @@ -352,6 +354,13 @@ return /******/ (function(modules) { // webpackBootstrap }, unregisterDecorator: function unregisterDecorator(name) { delete this.decorators[name]; + }, + /** + * Reset the memory of illegal property accesses that have already been logged. + * @deprecated should only be used in handlebars test-cases + */ + resetLoggedPropertyAccesses: function resetLoggedPropertyAccesses() { + _internalProtoAccess.resetLoggedProperties(); } }; @@ -375,7 +384,6 @@ return /******/ (function(modules) { // webpackBootstrap exports.createFrame = createFrame; exports.blockParams = blockParams; exports.appendContextPath = appendContextPath; - var escape = { '&': '&', '<': '<', @@ -499,7 +507,6 @@ return /******/ (function(modules) { // webpackBootstrap var _Object$defineProperty = __webpack_require__(7)['default']; exports.__esModule = true; - var errorProps = ['description', 'fileName', 'lineNumber', 'endLineNumber', 'message', 'name', 'number', 'stack']; function Exception(message, node) { @@ -1047,7 +1054,11 @@ return /******/ (function(modules) { // webpackBootstrap if (arguments.length != 2) { throw new _exception2['default']('#unless requires exactly one argument'); } - return instance.helpers['if'].call(this, conditional, { fn: options.inverse, inverse: options.fn, hash: options.hash }); + return instance.helpers['if'].call(this, conditional, { + fn: options.inverse, + inverse: options.fn, + hash: options.hash + }); }); }; @@ -1090,22 +1101,19 @@ return /******/ (function(modules) { // webpackBootstrap 'use strict'; exports.__esModule = true; - var dangerousPropertyRegex = /^(constructor|__defineGetter__|__defineSetter__|__lookupGetter__|__proto__)$/; - - exports.dangerousPropertyRegex = dangerousPropertyRegex; exports['default'] = function (instance) { - instance.registerHelper('lookup', function (obj, field) { + instance.registerHelper('lookup', function (obj, field, options) { if (!obj) { + // Note for 5.0: Change to "obj == null" in 5.0 return obj; } - if (dangerousPropertyRegex.test(String(field)) && !Object.prototype.propertyIsEnumerable.call(obj, field)) { - return undefined; - } - return obj[field]; + return options.lookupProperty(obj, field); }); }; + module.exports = exports['default']; + /***/ }), /* 29 */ /***/ (function(module, exports, __webpack_require__) { @@ -1238,8 +1246,8 @@ return /******/ (function(modules) { // webpackBootstrap if (typeof console !== 'undefined' && logger.lookupLevel(logger.level) <= level) { var method = logger.methodMap[level]; + // eslint-disable-next-line no-console if (!console[method]) { - // eslint-disable-line no-console method = 'log'; } @@ -1257,6 +1265,129 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }), /* 33 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var _Object$create = __webpack_require__(34)['default']; + + var _Object$keys = __webpack_require__(13)['default']; + + var _interopRequireWildcard = __webpack_require__(3)['default']; + + exports.__esModule = true; + exports.createProtoAccessControl = createProtoAccessControl; + exports.resultIsAllowed = resultIsAllowed; + exports.resetLoggedProperties = resetLoggedProperties; + + var _createNewLookupObject = __webpack_require__(36); + + var _logger = __webpack_require__(32); + + var logger = _interopRequireWildcard(_logger); + + var loggedProperties = _Object$create(null); + + function createProtoAccessControl(runtimeOptions) { + var defaultMethodWhiteList = _Object$create(null); + defaultMethodWhiteList['constructor'] = false; + defaultMethodWhiteList['__defineGetter__'] = false; + defaultMethodWhiteList['__defineSetter__'] = false; + defaultMethodWhiteList['__lookupGetter__'] = false; + + var defaultPropertyWhiteList = _Object$create(null); + // eslint-disable-next-line no-proto + defaultPropertyWhiteList['__proto__'] = false; + + return { + properties: { + whitelist: _createNewLookupObject.createNewLookupObject(defaultPropertyWhiteList, runtimeOptions.allowedProtoProperties), + defaultValue: runtimeOptions.allowProtoPropertiesByDefault + }, + methods: { + whitelist: _createNewLookupObject.createNewLookupObject(defaultMethodWhiteList, runtimeOptions.allowedProtoMethods), + defaultValue: runtimeOptions.allowProtoMethodsByDefault + } + }; + } + + function resultIsAllowed(result, protoAccessControl, propertyName) { + if (typeof result === 'function') { + return checkWhiteList(protoAccessControl.methods, propertyName); + } else { + return checkWhiteList(protoAccessControl.properties, propertyName); + } + } + + function checkWhiteList(protoAccessControlForType, propertyName) { + if (protoAccessControlForType.whitelist[propertyName] !== undefined) { + return protoAccessControlForType.whitelist[propertyName] === true; + } + if (protoAccessControlForType.defaultValue !== undefined) { + return protoAccessControlForType.defaultValue; + } + logUnexpecedPropertyAccessOnce(propertyName); + return false; + } + + function logUnexpecedPropertyAccessOnce(propertyName) { + if (loggedProperties[propertyName] !== true) { + loggedProperties[propertyName] = true; + logger.log('error', 'Handlebars: Access has been denied to resolve the property "' + propertyName + '" because it is not an "own property" of its parent.\n' + 'You can add a runtime option to disable the check or this warning:\n' + 'See https://handlebarsjs.com/api-reference/runtime-options.html#options-to-control-prototype-access for details'); + } + } + + function resetLoggedProperties() { + _Object$keys(loggedProperties).forEach(function (propertyName) { + delete loggedProperties[propertyName]; + }); + } + +/***/ }), +/* 34 */ +/***/ (function(module, exports, __webpack_require__) { + + module.exports = { "default": __webpack_require__(35), __esModule: true }; + +/***/ }), +/* 35 */ +/***/ (function(module, exports, __webpack_require__) { + + var $ = __webpack_require__(9); + module.exports = function create(P, D){ + return $.create(P, D); + }; + +/***/ }), +/* 36 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var _Object$create = __webpack_require__(34)['default']; + + exports.__esModule = true; + exports.createNewLookupObject = createNewLookupObject; + + var _utils = __webpack_require__(5); + + /** + * Create a new object with "null"-prototype to avoid truthy results on prototype properties. + * The resulting object can be used with "object[property]" to check if a property exists + * @param {...object} sources a varargs parameter of source objects that will be merged + * @returns {object} + */ + + function createNewLookupObject() { + for (var _len = arguments.length, sources = Array(_len), _key = 0; _key < _len; _key++) { + sources[_key] = arguments[_key]; + } + + return _utils.extend.apply(undefined, [_Object$create(null)].concat(sources)); + } + +/***/ }), +/* 37 */ /***/ (function(module, exports) { // Build out our basic SafeString type @@ -1275,12 +1406,14 @@ return /******/ (function(modules) { // webpackBootstrap module.exports = exports['default']; /***/ }), -/* 34 */ +/* 38 */ /***/ (function(module, exports, __webpack_require__) { 'use strict'; - var _Object$seal = __webpack_require__(35)['default']; + var _Object$seal = __webpack_require__(39)['default']; + + var _Object$keys = __webpack_require__(13)['default']; var _interopRequireWildcard = __webpack_require__(3)['default']; @@ -1306,6 +1439,10 @@ return /******/ (function(modules) { // webpackBootstrap var _helpers = __webpack_require__(10); + var _internalWrapHelper = __webpack_require__(43); + + var _internalProtoAccess = __webpack_require__(33); + function checkRevision(compilerInfo) { var compilerRevision = compilerInfo && compilerInfo[0] || 1, currentRevision = _base.COMPILER_REVISION; @@ -1325,7 +1462,6 @@ return /******/ (function(modules) { // webpackBootstrap } function template(templateSpec, env) { - /* istanbul ignore next */ if (!env) { throw new _exception2['default']('No environment passed to template'); @@ -1352,13 +1488,16 @@ return /******/ (function(modules) { // webpackBootstrap } partial = env.VM.resolvePartial.call(this, partial, context, options); - var optionsWithHooks = Utils.extend({}, options, { hooks: this.hooks }); + var extendedOptions = Utils.extend({}, options, { + hooks: this.hooks, + protoAccessControl: this.protoAccessControl + }); - var result = env.VM.invokePartial.call(this, partial, context, optionsWithHooks); + var result = env.VM.invokePartial.call(this, partial, context, extendedOptions); if (result == null && env.compile) { options.partials[options.name] = env.compile(partial, templateSpec.compilerOptions, env); - result = options.partials[options.name](context, optionsWithHooks); + result = options.partials[options.name](context, extendedOptions); } if (result != null) { if (options.indent) { @@ -1382,14 +1521,31 @@ return /******/ (function(modules) { // webpackBootstrap var container = { strict: function strict(obj, name, loc) { if (!obj || !(name in obj)) { - throw new _exception2['default']('"' + name + '" not defined in ' + obj, { loc: loc }); + throw new _exception2['default']('"' + name + '" not defined in ' + obj, { + loc: loc + }); } return obj[name]; }, + lookupProperty: function lookupProperty(parent, propertyName) { + var result = parent[propertyName]; + if (result == null) { + return result; + } + if (Object.prototype.hasOwnProperty.call(parent, propertyName)) { + return result; + } + + if (_internalProtoAccess.resultIsAllowed(result, container.protoAccessControl, propertyName)) { + return result; + } + return undefined; + }, lookup: function lookup(depths, name) { var len = depths.length; for (var i = 0; i < len; i++) { - if (depths[i] && depths[i][name] != null) { + var result = depths[i] && container.lookupProperty(depths[i], name); + if (result != null) { return depths[i][name]; } } @@ -1425,6 +1581,15 @@ return /******/ (function(modules) { // webpackBootstrap } return value; }, + mergeIfNeeded: function mergeIfNeeded(param, common) { + var obj = param || common; + + if (param && common && param !== common) { + obj = Utils.extend({}, common, param); + } + + return obj; + }, // An empty object to use as replacement for null-contexts nullContext: _Object$seal({}), @@ -1454,28 +1619,35 @@ return /******/ (function(modules) { // webpackBootstrap function main(context /*, options*/) { return '' + templateSpec.main(container, context, container.helpers, container.partials, data, blockParams, depths); } + main = executeDecorators(templateSpec.main, main, container, options.depths || [], data, blockParams); return main(context, options); } + ret.isTop = true; ret._setup = function (options) { if (!options.partial) { - container.helpers = Utils.extend({}, env.helpers, options.helpers); + var mergedHelpers = Utils.extend({}, env.helpers, options.helpers); + wrapHelpersToPassLookupProperty(mergedHelpers, container); + container.helpers = mergedHelpers; if (templateSpec.usePartial) { - container.partials = Utils.extend({}, env.partials, options.partials); + // Use mergeIfNeeded here to prevent compiling global partials multiple times + container.partials = container.mergeIfNeeded(options.partials, env.partials); } if (templateSpec.usePartial || templateSpec.useDecorators) { container.decorators = Utils.extend({}, env.decorators, options.decorators); } container.hooks = {}; + container.protoAccessControl = _internalProtoAccess.createProtoAccessControl(options); var keepHelperInHelpers = options.allowCallsToHelperMissing || templateWasPrecompiledWithCompilerV7; _helpers.moveHelperToHooks(container, 'helperMissing', keepHelperInHelpers); _helpers.moveHelperToHooks(container, 'blockHelperMissing', keepHelperInHelpers); } else { + container.protoAccessControl = options.protoAccessControl; // internal option container.helpers = options.helpers; container.partials = options.partials; container.decorators = options.decorators; @@ -1596,25 +1768,39 @@ return /******/ (function(modules) { // webpackBootstrap return prog; } + function wrapHelpersToPassLookupProperty(mergedHelpers, container) { + _Object$keys(mergedHelpers).forEach(function (helperName) { + var helper = mergedHelpers[helperName]; + mergedHelpers[helperName] = passLookupPropertyOption(helper, container); + }); + } + + function passLookupPropertyOption(helper, container) { + var lookupProperty = container.lookupProperty; + return _internalWrapHelper.wrapHelper(helper, function (options) { + return Utils.extend({ lookupProperty: lookupProperty }, options); + }); + } + /***/ }), -/* 35 */ +/* 39 */ /***/ (function(module, exports, __webpack_require__) { - module.exports = { "default": __webpack_require__(36), __esModule: true }; + module.exports = { "default": __webpack_require__(40), __esModule: true }; /***/ }), -/* 36 */ +/* 40 */ /***/ (function(module, exports, __webpack_require__) { - __webpack_require__(37); + __webpack_require__(41); module.exports = __webpack_require__(21).Object.seal; /***/ }), -/* 37 */ +/* 41 */ /***/ (function(module, exports, __webpack_require__) { // 19.1.2.17 Object.seal(O) - var isObject = __webpack_require__(38); + var isObject = __webpack_require__(42); __webpack_require__(18)('seal', function($seal){ return function seal(it){ @@ -1623,7 +1809,7 @@ return /******/ (function(modules) { // webpackBootstrap }); /***/ }), -/* 38 */ +/* 42 */ /***/ (function(module, exports) { module.exports = function(it){ @@ -1631,12 +1817,34 @@ return /******/ (function(modules) { // webpackBootstrap }; /***/ }), -/* 39 */ +/* 43 */ /***/ (function(module, exports) { - /* WEBPACK VAR INJECTION */(function(global) {/* global window */ 'use strict'; + exports.__esModule = true; + exports.wrapHelper = wrapHelper; + + function wrapHelper(helper, transformOptionsFn) { + if (typeof helper !== 'function') { + // This should not happen, but apparently it does in https://github.com/wycats/handlebars.js/issues/1639 + // We try to make the wrapper least-invasive by not wrapping it, if the helper is not a function. + return helper; + } + var wrapper = function wrapper() /* dynamic arguments */{ + var options = arguments[arguments.length - 1]; + arguments[arguments.length - 1] = transformOptionsFn(options); + return helper.apply(this, arguments); + }; + return wrapper; + } + +/***/ }), +/* 44 */ +/***/ (function(module, exports) { + + /* WEBPACK VAR INJECTION */(function(global) {'use strict'; + exports.__esModule = true; exports['default'] = function (Handlebars) { @@ -1656,7 +1864,7 @@ return /******/ (function(modules) { // webpackBootstrap /* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }()))) /***/ }), -/* 40 */ +/* 45 */ /***/ (function(module, exports) { 'use strict'; @@ -1691,7 +1899,7 @@ return /******/ (function(modules) { // webpackBootstrap module.exports = exports['default']; /***/ }), -/* 41 */ +/* 46 */ /***/ (function(module, exports, __webpack_require__) { 'use strict'; @@ -1704,15 +1912,15 @@ return /******/ (function(modules) { // webpackBootstrap exports.parseWithoutProcessing = parseWithoutProcessing; exports.parse = parse; - var _parser = __webpack_require__(42); + var _parser = __webpack_require__(47); var _parser2 = _interopRequireDefault(_parser); - var _whitespaceControl = __webpack_require__(43); + var _whitespaceControl = __webpack_require__(48); var _whitespaceControl2 = _interopRequireDefault(_whitespaceControl); - var _helpers = __webpack_require__(45); + var _helpers = __webpack_require__(50); var Helpers = _interopRequireWildcard(_helpers); @@ -1749,7 +1957,7 @@ return /******/ (function(modules) { // webpackBootstrap } /***/ }), -/* 42 */ +/* 47 */ /***/ (function(module, exports) { // File ignored in coverage tests via setting in .istanbul.yml @@ -2490,7 +2698,7 @@ return /******/ (function(modules) { // webpackBootstrap module.exports = exports["default"]; /***/ }), -/* 43 */ +/* 48 */ /***/ (function(module, exports, __webpack_require__) { 'use strict'; @@ -2499,7 +2707,7 @@ return /******/ (function(modules) { // webpackBootstrap exports.__esModule = true; - var _visitor = __webpack_require__(44); + var _visitor = __webpack_require__(49); var _visitor2 = _interopRequireDefault(_visitor); @@ -2714,7 +2922,7 @@ return /******/ (function(modules) { // webpackBootstrap module.exports = exports['default']; /***/ }), -/* 44 */ +/* 49 */ /***/ (function(module, exports, __webpack_require__) { 'use strict'; @@ -2857,7 +3065,7 @@ return /******/ (function(modules) { // webpackBootstrap module.exports = exports['default']; /***/ }), -/* 45 */ +/* 50 */ /***/ (function(module, exports, __webpack_require__) { 'use strict'; @@ -3088,14 +3296,14 @@ return /******/ (function(modules) { // webpackBootstrap } /***/ }), -/* 46 */ +/* 51 */ /***/ (function(module, exports, __webpack_require__) { /* eslint-disable new-cap */ 'use strict'; - var _Object$create = __webpack_require__(47)['default']; + var _Object$create = __webpack_require__(34)['default']; var _interopRequireDefault = __webpack_require__(1)['default']; @@ -3110,7 +3318,7 @@ return /******/ (function(modules) { // webpackBootstrap var _utils = __webpack_require__(5); - var _ast = __webpack_require__(40); + var _ast = __webpack_require__(45); var _ast2 = _interopRequireDefault(_ast); @@ -3165,14 +3373,14 @@ return /******/ (function(modules) { // webpackBootstrap options.blockParams = options.blockParams || []; options.knownHelpers = _utils.extend(_Object$create(null), { - 'helperMissing': true, - 'blockHelperMissing': true, - 'each': true, + helperMissing: true, + blockHelperMissing: true, + each: true, 'if': true, - 'unless': true, + unless: true, 'with': true, - 'log': true, - 'lookup': true + log: true, + lookup: true }, options.knownHelpers); return this.accept(program); @@ -3439,7 +3647,11 @@ return /******/ (function(modules) { // webpackBootstrap // HELPERS opcode: function opcode(name) { - this.opcodes.push({ opcode: name, args: slice.call(arguments, 1), loc: this.sourceNode[0].loc }); + this.opcodes.push({ + opcode: name, + args: slice.call(arguments, 1), + loc: this.sourceNode[0].loc + }); }, addDepth: function addDepth(depth) { @@ -3655,22 +3867,7 @@ return /******/ (function(modules) { // webpackBootstrap } /***/ }), -/* 47 */ -/***/ (function(module, exports, __webpack_require__) { - - module.exports = { "default": __webpack_require__(48), __esModule: true }; - -/***/ }), -/* 48 */ -/***/ (function(module, exports, __webpack_require__) { - - var $ = __webpack_require__(9); - module.exports = function create(P, D){ - return $.create(P, D); - }; - -/***/ }), -/* 49 */ +/* 52 */ /***/ (function(module, exports, __webpack_require__) { 'use strict'; @@ -3689,12 +3886,10 @@ return /******/ (function(modules) { // webpackBootstrap var _utils = __webpack_require__(5); - var _codeGen = __webpack_require__(50); + var _codeGen = __webpack_require__(53); var _codeGen2 = _interopRequireDefault(_codeGen); - var _helpersLookup = __webpack_require__(28); - function Literal(value) { this.value = value; } @@ -3704,20 +3899,8 @@ return /******/ (function(modules) { // webpackBootstrap JavaScriptCompiler.prototype = { // PUBLIC API: You can override these methods in a subclass to provide // alternative compiled forms for name lookup and buffering semantics - nameLookup: function nameLookup(parent, name /* , type*/) { - if (_helpersLookup.dangerousPropertyRegex.test(name)) { - var isEnumerable = [this.aliasable('container.propertyIsEnumerable'), '.call(', parent, ',', JSON.stringify(name), ')']; - return ['(', isEnumerable, '?', _actualLookup(), ' : undefined)']; - } - return _actualLookup(); - - function _actualLookup() { - if (JavaScriptCompiler.isValidJavaScriptVariableName(name)) { - return [parent, '.', name]; - } else { - return [parent, '[', JSON.stringify(name), ']']; - } - } + nameLookup: function nameLookup(parent, name /*, type */) { + return this.internalNameLookup(parent, name); }, depthedLookup: function depthedLookup(name) { return [this.aliasable('container.lookup'), '(depths, "', name, '")']; @@ -3753,6 +3936,12 @@ return /******/ (function(modules) { // webpackBootstrap return this.quotedString(''); }, // END PUBLIC API + internalNameLookup: function internalNameLookup(parent, name) { + this.lookupPropertyFunctionIsUsed = true; + return ['lookupProperty(', parent, ',', JSON.stringify(name), ')']; + }, + + lookupPropertyFunctionIsUsed: false, compile: function compile(environment, options, context, asObject) { this.environment = environment; @@ -3811,7 +4000,7 @@ return /******/ (function(modules) { // webpackBootstrap if (!this.decorators.isEmpty()) { this.useDecorators = true; - this.decorators.prepend('var decorators = container.decorators;\n'); + this.decorators.prepend(['var decorators = container.decorators, ', this.lookupPropertyFunctionVarDeclaration(), ';\n']); this.decorators.push('return fn;'); if (asObject) { @@ -3924,6 +4113,10 @@ return /******/ (function(modules) { // webpackBootstrap } }); + if (this.lookupPropertyFunctionIsUsed) { + varDeclarations += ', ' + this.lookupPropertyFunctionVarDeclaration(); + } + var params = ['container', 'depth0', 'helpers', 'partials', 'data']; if (this.useBlockParams || this.useDepths) { @@ -4002,6 +4195,10 @@ return /******/ (function(modules) { // webpackBootstrap return this.source.merge(); }, + lookupPropertyFunctionVarDeclaration: function lookupPropertyFunctionVarDeclaration() { + return '\n lookupProperty = container.lookupProperty || function(parent, propertyName) {\n if (Object.prototype.hasOwnProperty.call(parent, propertyName)) {\n return parent[propertyName];\n }\n return undefined\n }\n '.trim(); + }, + // [blockValue] // // On stack, before: hash, inverse, program, value @@ -4804,6 +5001,9 @@ return /******/ (function(modules) { // webpackBootstrap } })(); + /** + * @deprecated May be removed in the next major version + */ JavaScriptCompiler.isValidJavaScriptVariableName = function (name) { return !JavaScriptCompiler.RESERVED_WORDS[name] && /^[a-zA-Z_$][0-9a-zA-Z_$]*$/.test(name); }; @@ -4831,7 +5031,7 @@ return /******/ (function(modules) { // webpackBootstrap module.exports = exports['default']; /***/ }), -/* 50 */ +/* 53 */ /***/ (function(module, exports, __webpack_require__) { /* global define */ @@ -5007,4 +5207,4 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }) /******/ ]) }); -; +; \ No newline at end of file diff --git a/vendor/assets/javascripts/handlebars.runtime.js b/vendor/assets/javascripts/handlebars.runtime.js index 5e1fd07..3516859 100644 --- a/vendor/assets/javascripts/handlebars.runtime.js +++ b/vendor/assets/javascripts/handlebars.runtime.js @@ -1,9 +1,9 @@ /**! @license - handlebars v4.5.3 + handlebars v4.7.3 -Copyright (C) 2011-2017 by Yehuda Katz +Copyright (C) 2011-2019 by Yehuda Katz Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal @@ -95,7 +95,7 @@ return /******/ (function(modules) { // webpackBootstrap // Each of these augment the Handlebars object. No need to setup here. // (This is done to easily share code between commonjs and browse envs) - var _handlebarsSafeString = __webpack_require__(32); + var _handlebarsSafeString = __webpack_require__(36); var _handlebarsSafeString2 = _interopRequireDefault(_handlebarsSafeString); @@ -107,11 +107,11 @@ return /******/ (function(modules) { // webpackBootstrap var Utils = _interopRequireWildcard(_handlebarsUtils); - var _handlebarsRuntime = __webpack_require__(33); + var _handlebarsRuntime = __webpack_require__(37); var runtime = _interopRequireWildcard(_handlebarsRuntime); - var _handlebarsNoConflict = __webpack_require__(38); + var _handlebarsNoConflict = __webpack_require__(43); var _handlebarsNoConflict2 = _interopRequireDefault(_handlebarsNoConflict); @@ -207,7 +207,9 @@ return /******/ (function(modules) { // webpackBootstrap var _logger2 = _interopRequireDefault(_logger); - var VERSION = '4.5.3'; + var _internalProtoAccess = __webpack_require__(32); + + var VERSION = '4.7.3'; exports.VERSION = VERSION; var COMPILER_REVISION = 8; exports.COMPILER_REVISION = COMPILER_REVISION; @@ -283,6 +285,13 @@ return /******/ (function(modules) { // webpackBootstrap }, unregisterDecorator: function unregisterDecorator(name) { delete this.decorators[name]; + }, + /** + * Reset the memory of illegal property accesses that have already been logged. + * @deprecated should only be used in handlebars test-cases + */ + resetLoggedPropertyAccesses: function resetLoggedPropertyAccesses() { + _internalProtoAccess.resetLoggedProperties(); } }; @@ -306,7 +315,6 @@ return /******/ (function(modules) { // webpackBootstrap exports.createFrame = createFrame; exports.blockParams = blockParams; exports.appendContextPath = appendContextPath; - var escape = { '&': '&', '<': '<', @@ -430,7 +438,6 @@ return /******/ (function(modules) { // webpackBootstrap var _Object$defineProperty = __webpack_require__(6)['default']; exports.__esModule = true; - var errorProps = ['description', 'fileName', 'lineNumber', 'endLineNumber', 'message', 'name', 'number', 'stack']; function Exception(message, node) { @@ -978,7 +985,11 @@ return /******/ (function(modules) { // webpackBootstrap if (arguments.length != 2) { throw new _exception2['default']('#unless requires exactly one argument'); } - return instance.helpers['if'].call(this, conditional, { fn: options.inverse, inverse: options.fn, hash: options.hash }); + return instance.helpers['if'].call(this, conditional, { + fn: options.inverse, + inverse: options.fn, + hash: options.hash + }); }); }; @@ -1021,22 +1032,19 @@ return /******/ (function(modules) { // webpackBootstrap 'use strict'; exports.__esModule = true; - var dangerousPropertyRegex = /^(constructor|__defineGetter__|__defineSetter__|__lookupGetter__|__proto__)$/; - - exports.dangerousPropertyRegex = dangerousPropertyRegex; exports['default'] = function (instance) { - instance.registerHelper('lookup', function (obj, field) { + instance.registerHelper('lookup', function (obj, field, options) { if (!obj) { + // Note for 5.0: Change to "obj == null" in 5.0 return obj; } - if (dangerousPropertyRegex.test(String(field)) && !Object.prototype.propertyIsEnumerable.call(obj, field)) { - return undefined; - } - return obj[field]; + return options.lookupProperty(obj, field); }); }; + module.exports = exports['default']; + /***/ }), /* 28 */ /***/ (function(module, exports, __webpack_require__) { @@ -1169,8 +1177,8 @@ return /******/ (function(modules) { // webpackBootstrap if (typeof console !== 'undefined' && logger.lookupLevel(logger.level) <= level) { var method = logger.methodMap[level]; + // eslint-disable-next-line no-console if (!console[method]) { - // eslint-disable-line no-console method = 'log'; } @@ -1188,6 +1196,129 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }), /* 32 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var _Object$create = __webpack_require__(33)['default']; + + var _Object$keys = __webpack_require__(12)['default']; + + var _interopRequireWildcard = __webpack_require__(1)['default']; + + exports.__esModule = true; + exports.createProtoAccessControl = createProtoAccessControl; + exports.resultIsAllowed = resultIsAllowed; + exports.resetLoggedProperties = resetLoggedProperties; + + var _createNewLookupObject = __webpack_require__(35); + + var _logger = __webpack_require__(31); + + var logger = _interopRequireWildcard(_logger); + + var loggedProperties = _Object$create(null); + + function createProtoAccessControl(runtimeOptions) { + var defaultMethodWhiteList = _Object$create(null); + defaultMethodWhiteList['constructor'] = false; + defaultMethodWhiteList['__defineGetter__'] = false; + defaultMethodWhiteList['__defineSetter__'] = false; + defaultMethodWhiteList['__lookupGetter__'] = false; + + var defaultPropertyWhiteList = _Object$create(null); + // eslint-disable-next-line no-proto + defaultPropertyWhiteList['__proto__'] = false; + + return { + properties: { + whitelist: _createNewLookupObject.createNewLookupObject(defaultPropertyWhiteList, runtimeOptions.allowedProtoProperties), + defaultValue: runtimeOptions.allowProtoPropertiesByDefault + }, + methods: { + whitelist: _createNewLookupObject.createNewLookupObject(defaultMethodWhiteList, runtimeOptions.allowedProtoMethods), + defaultValue: runtimeOptions.allowProtoMethodsByDefault + } + }; + } + + function resultIsAllowed(result, protoAccessControl, propertyName) { + if (typeof result === 'function') { + return checkWhiteList(protoAccessControl.methods, propertyName); + } else { + return checkWhiteList(protoAccessControl.properties, propertyName); + } + } + + function checkWhiteList(protoAccessControlForType, propertyName) { + if (protoAccessControlForType.whitelist[propertyName] !== undefined) { + return protoAccessControlForType.whitelist[propertyName] === true; + } + if (protoAccessControlForType.defaultValue !== undefined) { + return protoAccessControlForType.defaultValue; + } + logUnexpecedPropertyAccessOnce(propertyName); + return false; + } + + function logUnexpecedPropertyAccessOnce(propertyName) { + if (loggedProperties[propertyName] !== true) { + loggedProperties[propertyName] = true; + logger.log('error', 'Handlebars: Access has been denied to resolve the property "' + propertyName + '" because it is not an "own property" of its parent.\n' + 'You can add a runtime option to disable the check or this warning:\n' + 'See https://handlebarsjs.com/api-reference/runtime-options.html#options-to-control-prototype-access for details'); + } + } + + function resetLoggedProperties() { + _Object$keys(loggedProperties).forEach(function (propertyName) { + delete loggedProperties[propertyName]; + }); + } + +/***/ }), +/* 33 */ +/***/ (function(module, exports, __webpack_require__) { + + module.exports = { "default": __webpack_require__(34), __esModule: true }; + +/***/ }), +/* 34 */ +/***/ (function(module, exports, __webpack_require__) { + + var $ = __webpack_require__(8); + module.exports = function create(P, D){ + return $.create(P, D); + }; + +/***/ }), +/* 35 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var _Object$create = __webpack_require__(33)['default']; + + exports.__esModule = true; + exports.createNewLookupObject = createNewLookupObject; + + var _utils = __webpack_require__(4); + + /** + * Create a new object with "null"-prototype to avoid truthy results on prototype properties. + * The resulting object can be used with "object[property]" to check if a property exists + * @param {...object} sources a varargs parameter of source objects that will be merged + * @returns {object} + */ + + function createNewLookupObject() { + for (var _len = arguments.length, sources = Array(_len), _key = 0; _key < _len; _key++) { + sources[_key] = arguments[_key]; + } + + return _utils.extend.apply(undefined, [_Object$create(null)].concat(sources)); + } + +/***/ }), +/* 36 */ /***/ (function(module, exports) { // Build out our basic SafeString type @@ -1206,12 +1337,14 @@ return /******/ (function(modules) { // webpackBootstrap module.exports = exports['default']; /***/ }), -/* 33 */ +/* 37 */ /***/ (function(module, exports, __webpack_require__) { 'use strict'; - var _Object$seal = __webpack_require__(34)['default']; + var _Object$seal = __webpack_require__(38)['default']; + + var _Object$keys = __webpack_require__(12)['default']; var _interopRequireWildcard = __webpack_require__(1)['default']; @@ -1237,6 +1370,10 @@ return /******/ (function(modules) { // webpackBootstrap var _helpers = __webpack_require__(9); + var _internalWrapHelper = __webpack_require__(42); + + var _internalProtoAccess = __webpack_require__(32); + function checkRevision(compilerInfo) { var compilerRevision = compilerInfo && compilerInfo[0] || 1, currentRevision = _base.COMPILER_REVISION; @@ -1256,7 +1393,6 @@ return /******/ (function(modules) { // webpackBootstrap } function template(templateSpec, env) { - /* istanbul ignore next */ if (!env) { throw new _exception2['default']('No environment passed to template'); @@ -1283,13 +1419,16 @@ return /******/ (function(modules) { // webpackBootstrap } partial = env.VM.resolvePartial.call(this, partial, context, options); - var optionsWithHooks = Utils.extend({}, options, { hooks: this.hooks }); + var extendedOptions = Utils.extend({}, options, { + hooks: this.hooks, + protoAccessControl: this.protoAccessControl + }); - var result = env.VM.invokePartial.call(this, partial, context, optionsWithHooks); + var result = env.VM.invokePartial.call(this, partial, context, extendedOptions); if (result == null && env.compile) { options.partials[options.name] = env.compile(partial, templateSpec.compilerOptions, env); - result = options.partials[options.name](context, optionsWithHooks); + result = options.partials[options.name](context, extendedOptions); } if (result != null) { if (options.indent) { @@ -1313,14 +1452,31 @@ return /******/ (function(modules) { // webpackBootstrap var container = { strict: function strict(obj, name, loc) { if (!obj || !(name in obj)) { - throw new _exception2['default']('"' + name + '" not defined in ' + obj, { loc: loc }); + throw new _exception2['default']('"' + name + '" not defined in ' + obj, { + loc: loc + }); } return obj[name]; }, + lookupProperty: function lookupProperty(parent, propertyName) { + var result = parent[propertyName]; + if (result == null) { + return result; + } + if (Object.prototype.hasOwnProperty.call(parent, propertyName)) { + return result; + } + + if (_internalProtoAccess.resultIsAllowed(result, container.protoAccessControl, propertyName)) { + return result; + } + return undefined; + }, lookup: function lookup(depths, name) { var len = depths.length; for (var i = 0; i < len; i++) { - if (depths[i] && depths[i][name] != null) { + var result = depths[i] && container.lookupProperty(depths[i], name); + if (result != null) { return depths[i][name]; } } @@ -1356,6 +1512,15 @@ return /******/ (function(modules) { // webpackBootstrap } return value; }, + mergeIfNeeded: function mergeIfNeeded(param, common) { + var obj = param || common; + + if (param && common && param !== common) { + obj = Utils.extend({}, common, param); + } + + return obj; + }, // An empty object to use as replacement for null-contexts nullContext: _Object$seal({}), @@ -1385,28 +1550,35 @@ return /******/ (function(modules) { // webpackBootstrap function main(context /*, options*/) { return '' + templateSpec.main(container, context, container.helpers, container.partials, data, blockParams, depths); } + main = executeDecorators(templateSpec.main, main, container, options.depths || [], data, blockParams); return main(context, options); } + ret.isTop = true; ret._setup = function (options) { if (!options.partial) { - container.helpers = Utils.extend({}, env.helpers, options.helpers); + var mergedHelpers = Utils.extend({}, env.helpers, options.helpers); + wrapHelpersToPassLookupProperty(mergedHelpers, container); + container.helpers = mergedHelpers; if (templateSpec.usePartial) { - container.partials = Utils.extend({}, env.partials, options.partials); + // Use mergeIfNeeded here to prevent compiling global partials multiple times + container.partials = container.mergeIfNeeded(options.partials, env.partials); } if (templateSpec.usePartial || templateSpec.useDecorators) { container.decorators = Utils.extend({}, env.decorators, options.decorators); } container.hooks = {}; + container.protoAccessControl = _internalProtoAccess.createProtoAccessControl(options); var keepHelperInHelpers = options.allowCallsToHelperMissing || templateWasPrecompiledWithCompilerV7; _helpers.moveHelperToHooks(container, 'helperMissing', keepHelperInHelpers); _helpers.moveHelperToHooks(container, 'blockHelperMissing', keepHelperInHelpers); } else { + container.protoAccessControl = options.protoAccessControl; // internal option container.helpers = options.helpers; container.partials = options.partials; container.decorators = options.decorators; @@ -1527,25 +1699,39 @@ return /******/ (function(modules) { // webpackBootstrap return prog; } + function wrapHelpersToPassLookupProperty(mergedHelpers, container) { + _Object$keys(mergedHelpers).forEach(function (helperName) { + var helper = mergedHelpers[helperName]; + mergedHelpers[helperName] = passLookupPropertyOption(helper, container); + }); + } + + function passLookupPropertyOption(helper, container) { + var lookupProperty = container.lookupProperty; + return _internalWrapHelper.wrapHelper(helper, function (options) { + return Utils.extend({ lookupProperty: lookupProperty }, options); + }); + } + /***/ }), -/* 34 */ +/* 38 */ /***/ (function(module, exports, __webpack_require__) { - module.exports = { "default": __webpack_require__(35), __esModule: true }; + module.exports = { "default": __webpack_require__(39), __esModule: true }; /***/ }), -/* 35 */ +/* 39 */ /***/ (function(module, exports, __webpack_require__) { - __webpack_require__(36); + __webpack_require__(40); module.exports = __webpack_require__(20).Object.seal; /***/ }), -/* 36 */ +/* 40 */ /***/ (function(module, exports, __webpack_require__) { // 19.1.2.17 Object.seal(O) - var isObject = __webpack_require__(37); + var isObject = __webpack_require__(41); __webpack_require__(17)('seal', function($seal){ return function seal(it){ @@ -1554,7 +1740,7 @@ return /******/ (function(modules) { // webpackBootstrap }); /***/ }), -/* 37 */ +/* 41 */ /***/ (function(module, exports) { module.exports = function(it){ @@ -1562,12 +1748,34 @@ return /******/ (function(modules) { // webpackBootstrap }; /***/ }), -/* 38 */ +/* 42 */ /***/ (function(module, exports) { - /* WEBPACK VAR INJECTION */(function(global) {/* global window */ 'use strict'; + exports.__esModule = true; + exports.wrapHelper = wrapHelper; + + function wrapHelper(helper, transformOptionsFn) { + if (typeof helper !== 'function') { + // This should not happen, but apparently it does in https://github.com/wycats/handlebars.js/issues/1639 + // We try to make the wrapper least-invasive by not wrapping it, if the helper is not a function. + return helper; + } + var wrapper = function wrapper() /* dynamic arguments */{ + var options = arguments[arguments.length - 1]; + arguments[arguments.length - 1] = transformOptionsFn(options); + return helper.apply(this, arguments); + }; + return wrapper; + } + +/***/ }), +/* 43 */ +/***/ (function(module, exports) { + + /* WEBPACK VAR INJECTION */(function(global) {'use strict'; + exports.__esModule = true; exports['default'] = function (Handlebars) { @@ -1589,4 +1797,4 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }) /******/ ]) }); -; +; \ No newline at end of file From 365bd0e9d21fe52ea8190a2b52deee8cea6af9a3 Mon Sep 17 00:00:00 2001 From: Alex Riedler Date: Mon, 24 Feb 2020 07:57:32 -0500 Subject: [PATCH 76/81] Bump handlebars_assets to 0.23.8 --- lib/handlebars_assets/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/handlebars_assets/version.rb b/lib/handlebars_assets/version.rb index 85bf8aa..88801fe 100644 --- a/lib/handlebars_assets/version.rb +++ b/lib/handlebars_assets/version.rb @@ -1,3 +1,3 @@ module HandlebarsAssets - VERSION = "0.23.7" + VERSION = "0.23.8" end From a90a00f2f6c85d26730505c42375d395e45b7993 Mon Sep 17 00:00:00 2001 From: KL079208 Date: Thu, 18 Mar 2021 09:08:04 -0500 Subject: [PATCH 77/81] Updating handlebars.js and handlebars.runtime.js to version 4.7.7 --- vendor/assets/javascripts/handlebars.js | 8 ++++---- vendor/assets/javascripts/handlebars.runtime.js | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/vendor/assets/javascripts/handlebars.js b/vendor/assets/javascripts/handlebars.js index 0f15865..baad5d3 100644 --- a/vendor/assets/javascripts/handlebars.js +++ b/vendor/assets/javascripts/handlebars.js @@ -1,7 +1,7 @@ /**! @license - handlebars v4.7.3 + handlebars v4.7.7 Copyright (C) 2011-2019 by Yehuda Katz @@ -278,7 +278,7 @@ return /******/ (function(modules) { // webpackBootstrap var _internalProtoAccess = __webpack_require__(33); - var VERSION = '4.7.3'; + var VERSION = '4.7.7'; exports.VERSION = VERSION; var COMPILER_REVISION = 8; exports.COMPILER_REVISION = COMPILER_REVISION; @@ -1525,7 +1525,7 @@ return /******/ (function(modules) { // webpackBootstrap loc: loc }); } - return obj[name]; + return container.lookupProperty(obj, name); }, lookupProperty: function lookupProperty(parent, propertyName) { var result = parent[propertyName]; @@ -3903,7 +3903,7 @@ return /******/ (function(modules) { // webpackBootstrap return this.internalNameLookup(parent, name); }, depthedLookup: function depthedLookup(name) { - return [this.aliasable('container.lookup'), '(depths, "', name, '")']; + return [this.aliasable('container.lookup'), '(depths, ', JSON.stringify(name), ')']; }, compilerInfo: function compilerInfo() { diff --git a/vendor/assets/javascripts/handlebars.runtime.js b/vendor/assets/javascripts/handlebars.runtime.js index 3516859..4bed375 100644 --- a/vendor/assets/javascripts/handlebars.runtime.js +++ b/vendor/assets/javascripts/handlebars.runtime.js @@ -1,7 +1,7 @@ /**! @license - handlebars v4.7.3 + handlebars v4.7.7 Copyright (C) 2011-2019 by Yehuda Katz @@ -209,7 +209,7 @@ return /******/ (function(modules) { // webpackBootstrap var _internalProtoAccess = __webpack_require__(32); - var VERSION = '4.7.3'; + var VERSION = '4.7.7'; exports.VERSION = VERSION; var COMPILER_REVISION = 8; exports.COMPILER_REVISION = COMPILER_REVISION; @@ -1456,7 +1456,7 @@ return /******/ (function(modules) { // webpackBootstrap loc: loc }); } - return obj[name]; + return container.lookupProperty(obj, name); }, lookupProperty: function lookupProperty(parent, propertyName) { var result = parent[propertyName]; From 0582cf97e7f2292c92c3269aa461242f9aad9a82 Mon Sep 17 00:00:00 2001 From: Alex Riedler Date: Thu, 18 Mar 2021 19:15:05 -0400 Subject: [PATCH 78/81] Bump handlebars_assets to 0.23.9 --- lib/handlebars_assets/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/handlebars_assets/version.rb b/lib/handlebars_assets/version.rb index 88801fe..9592aff 100644 --- a/lib/handlebars_assets/version.rb +++ b/lib/handlebars_assets/version.rb @@ -1,3 +1,3 @@ module HandlebarsAssets - VERSION = "0.23.8" + VERSION = "0.23.9" end From 84bd95dc69490aedb3b642725004cdf084b88143 Mon Sep 17 00:00:00 2001 From: Alex Riedler Date: Thu, 18 Mar 2021 19:17:10 -0400 Subject: [PATCH 79/81] Update changelog for 0.23.9 --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 82c2649..f0cf139 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.23.8 (2021-03-18) + +* Update Handlebars to v4.7.7 + ## 0.23.8 (2019-02-24) * Update Handlebars to v4.7.3 From 058bb860fb892050cb477eced3d6571befc7108d Mon Sep 17 00:00:00 2001 From: Srinandan Pai <31960499+SrinandanPai@users.noreply.github.com> Date: Fri, 26 Mar 2021 01:59:33 +0530 Subject: [PATCH 80/81] Corrected 0.23.9 version in CHANGELOG.md --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f0cf139..bf928be 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,4 @@ -## 0.23.8 (2021-03-18) +## 0.23.9 (2021-03-18) * Update Handlebars to v4.7.7 From b8b042a1b32eefad1eaa1aa1ab7538ab066d578a Mon Sep 17 00:00:00 2001 From: Benjamin Wood Date: Mon, 23 Jan 2023 15:46:19 -0800 Subject: [PATCH 81/81] Bring back handlebars 1.3.0 on latest master upstream We need the latest changes for sprockets compatibility, but do not want to upgrade handlebars to 4.7.7 yet. --- vendor/assets/javascripts/handlebars.js | 7912 ++++++----------- .../assets/javascripts/handlebars.runtime.js | 2286 ++--- 2 files changed, 3232 insertions(+), 6966 deletions(-) diff --git a/vendor/assets/javascripts/handlebars.js b/vendor/assets/javascripts/handlebars.js index baad5d3..bec7085 100644 --- a/vendor/assets/javascripts/handlebars.js +++ b/vendor/assets/javascripts/handlebars.js @@ -1,9 +1,8 @@ -/**! +/*! - @license - handlebars v4.7.7 + handlebars v1.3.0 -Copyright (C) 2011-2019 by Yehuda Katz +Copyright (C) 2011 by Yehuda Katz Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal @@ -23,5188 +22,2725 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +@license */ -(function webpackUniversalModuleDefinition(root, factory) { - if(typeof exports === 'object' && typeof module === 'object') - module.exports = factory(); - else if(typeof define === 'function' && define.amd) - define([], factory); - else if(typeof exports === 'object') - exports["Handlebars"] = factory(); - else - root["Handlebars"] = factory(); -})(this, function() { -return /******/ (function(modules) { // webpackBootstrap -/******/ // The module cache -/******/ var installedModules = {}; - -/******/ // The require function -/******/ function __webpack_require__(moduleId) { - -/******/ // Check if module is in cache -/******/ if(installedModules[moduleId]) -/******/ return installedModules[moduleId].exports; - -/******/ // Create a new module (and put it into the cache) -/******/ var module = installedModules[moduleId] = { -/******/ exports: {}, -/******/ id: moduleId, -/******/ loaded: false -/******/ }; - -/******/ // Execute the module function -/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); - -/******/ // Flag the module as loaded -/******/ module.loaded = true; - -/******/ // Return the exports of the module -/******/ return module.exports; -/******/ } - - -/******/ // expose the modules object (__webpack_modules__) -/******/ __webpack_require__.m = modules; - -/******/ // expose the module cache -/******/ __webpack_require__.c = installedModules; - -/******/ // __webpack_public_path__ -/******/ __webpack_require__.p = ""; - -/******/ // Load entry module and return exports -/******/ return __webpack_require__(0); -/******/ }) -/************************************************************************/ -/******/ ([ -/* 0 */ -/***/ (function(module, exports, __webpack_require__) { - - 'use strict'; - - var _interopRequireDefault = __webpack_require__(1)['default']; - - exports.__esModule = true; - - var _handlebarsRuntime = __webpack_require__(2); - - var _handlebarsRuntime2 = _interopRequireDefault(_handlebarsRuntime); - - // Compiler imports - - var _handlebarsCompilerAst = __webpack_require__(45); - - var _handlebarsCompilerAst2 = _interopRequireDefault(_handlebarsCompilerAst); - - var _handlebarsCompilerBase = __webpack_require__(46); - - var _handlebarsCompilerCompiler = __webpack_require__(51); - - var _handlebarsCompilerJavascriptCompiler = __webpack_require__(52); - - var _handlebarsCompilerJavascriptCompiler2 = _interopRequireDefault(_handlebarsCompilerJavascriptCompiler); - - var _handlebarsCompilerVisitor = __webpack_require__(49); - - var _handlebarsCompilerVisitor2 = _interopRequireDefault(_handlebarsCompilerVisitor); - - var _handlebarsNoConflict = __webpack_require__(44); - - var _handlebarsNoConflict2 = _interopRequireDefault(_handlebarsNoConflict); - - var _create = _handlebarsRuntime2['default'].create; - function create() { - var hb = _create(); - - hb.compile = function (input, options) { - return _handlebarsCompilerCompiler.compile(input, options, hb); - }; - hb.precompile = function (input, options) { - return _handlebarsCompilerCompiler.precompile(input, options, hb); - }; - - hb.AST = _handlebarsCompilerAst2['default']; - hb.Compiler = _handlebarsCompilerCompiler.Compiler; - hb.JavaScriptCompiler = _handlebarsCompilerJavascriptCompiler2['default']; - hb.Parser = _handlebarsCompilerBase.parser; - hb.parse = _handlebarsCompilerBase.parse; - hb.parseWithoutProcessing = _handlebarsCompilerBase.parseWithoutProcessing; - - return hb; - } - - var inst = create(); - inst.create = create; - - _handlebarsNoConflict2['default'](inst); - - inst.Visitor = _handlebarsCompilerVisitor2['default']; - - inst['default'] = inst; - - exports['default'] = inst; - module.exports = exports['default']; - -/***/ }), -/* 1 */ -/***/ (function(module, exports) { - - "use strict"; - - exports["default"] = function (obj) { - return obj && obj.__esModule ? obj : { - "default": obj - }; - }; - - exports.__esModule = true; - -/***/ }), -/* 2 */ -/***/ (function(module, exports, __webpack_require__) { - - 'use strict'; - - var _interopRequireWildcard = __webpack_require__(3)['default']; - - var _interopRequireDefault = __webpack_require__(1)['default']; - - exports.__esModule = true; - - var _handlebarsBase = __webpack_require__(4); - - var base = _interopRequireWildcard(_handlebarsBase); - - // Each of these augment the Handlebars object. No need to setup here. - // (This is done to easily share code between commonjs and browse envs) - - var _handlebarsSafeString = __webpack_require__(37); - - var _handlebarsSafeString2 = _interopRequireDefault(_handlebarsSafeString); - - var _handlebarsException = __webpack_require__(6); - - var _handlebarsException2 = _interopRequireDefault(_handlebarsException); - - var _handlebarsUtils = __webpack_require__(5); - - var Utils = _interopRequireWildcard(_handlebarsUtils); - - var _handlebarsRuntime = __webpack_require__(38); - - var runtime = _interopRequireWildcard(_handlebarsRuntime); - - var _handlebarsNoConflict = __webpack_require__(44); - - var _handlebarsNoConflict2 = _interopRequireDefault(_handlebarsNoConflict); - - // For compatibility and usage outside of module systems, make the Handlebars object a namespace - function create() { - var hb = new base.HandlebarsEnvironment(); - - Utils.extend(hb, base); - hb.SafeString = _handlebarsSafeString2['default']; - hb.Exception = _handlebarsException2['default']; - hb.Utils = Utils; - hb.escapeExpression = Utils.escapeExpression; - - hb.VM = runtime; - hb.template = function (spec) { - return runtime.template(spec, hb); - }; - - return hb; - } - - var inst = create(); - inst.create = create; - - _handlebarsNoConflict2['default'](inst); - - inst['default'] = inst; - - exports['default'] = inst; - module.exports = exports['default']; - -/***/ }), -/* 3 */ -/***/ (function(module, exports) { - - "use strict"; - - exports["default"] = function (obj) { - if (obj && obj.__esModule) { - return obj; - } else { - var newObj = {}; - - if (obj != null) { - for (var key in obj) { - if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; - } - } - - newObj["default"] = obj; - return newObj; - } - }; - - exports.__esModule = true; - -/***/ }), -/* 4 */ -/***/ (function(module, exports, __webpack_require__) { - - 'use strict'; - - var _interopRequireDefault = __webpack_require__(1)['default']; - - exports.__esModule = true; - exports.HandlebarsEnvironment = HandlebarsEnvironment; - - var _utils = __webpack_require__(5); - - var _exception = __webpack_require__(6); - - var _exception2 = _interopRequireDefault(_exception); - - var _helpers = __webpack_require__(10); - - var _decorators = __webpack_require__(30); - - var _logger = __webpack_require__(32); - - var _logger2 = _interopRequireDefault(_logger); - - var _internalProtoAccess = __webpack_require__(33); - - var VERSION = '4.7.7'; - exports.VERSION = VERSION; - var COMPILER_REVISION = 8; - exports.COMPILER_REVISION = COMPILER_REVISION; - var LAST_COMPATIBLE_COMPILER_REVISION = 7; - - exports.LAST_COMPATIBLE_COMPILER_REVISION = LAST_COMPATIBLE_COMPILER_REVISION; - var REVISION_CHANGES = { - 1: '<= 1.0.rc.2', // 1.0.rc.2 is actually rev2 but doesn't report it - 2: '== 1.0.0-rc.3', - 3: '== 1.0.0-rc.4', - 4: '== 1.x.x', - 5: '== 2.0.0-alpha.x', - 6: '>= 2.0.0-beta.1', - 7: '>= 4.0.0 <4.3.0', - 8: '>= 4.3.0' - }; - - exports.REVISION_CHANGES = REVISION_CHANGES; - var objectType = '[object Object]'; - - function HandlebarsEnvironment(helpers, partials, decorators) { - this.helpers = helpers || {}; - this.partials = partials || {}; - this.decorators = decorators || {}; - - _helpers.registerDefaultHelpers(this); - _decorators.registerDefaultDecorators(this); - } - - HandlebarsEnvironment.prototype = { - constructor: HandlebarsEnvironment, - - logger: _logger2['default'], - log: _logger2['default'].log, - - registerHelper: function registerHelper(name, fn) { - if (_utils.toString.call(name) === objectType) { - if (fn) { - throw new _exception2['default']('Arg not supported with multiple helpers'); - } - _utils.extend(this.helpers, name); - } else { - this.helpers[name] = fn; - } - }, - unregisterHelper: function unregisterHelper(name) { - delete this.helpers[name]; - }, - - registerPartial: function registerPartial(name, partial) { - if (_utils.toString.call(name) === objectType) { - _utils.extend(this.partials, name); - } else { - if (typeof partial === 'undefined') { - throw new _exception2['default']('Attempting to register a partial called "' + name + '" as undefined'); - } - this.partials[name] = partial; - } - }, - unregisterPartial: function unregisterPartial(name) { - delete this.partials[name]; - }, - - registerDecorator: function registerDecorator(name, fn) { - if (_utils.toString.call(name) === objectType) { - if (fn) { - throw new _exception2['default']('Arg not supported with multiple decorators'); - } - _utils.extend(this.decorators, name); - } else { - this.decorators[name] = fn; - } - }, - unregisterDecorator: function unregisterDecorator(name) { - delete this.decorators[name]; - }, - /** - * Reset the memory of illegal property accesses that have already been logged. - * @deprecated should only be used in handlebars test-cases - */ - resetLoggedPropertyAccesses: function resetLoggedPropertyAccesses() { - _internalProtoAccess.resetLoggedProperties(); - } - }; - - var log = _logger2['default'].log; - - exports.log = log; - exports.createFrame = _utils.createFrame; - exports.logger = _logger2['default']; - -/***/ }), -/* 5 */ -/***/ (function(module, exports) { - - 'use strict'; - - exports.__esModule = true; - exports.extend = extend; - exports.indexOf = indexOf; - exports.escapeExpression = escapeExpression; - exports.isEmpty = isEmpty; - exports.createFrame = createFrame; - exports.blockParams = blockParams; - exports.appendContextPath = appendContextPath; - var escape = { - '&': '&', - '<': '<', - '>': '>', - '"': '"', - "'": ''', - '`': '`', - '=': '=' - }; - - var badChars = /[&<>"'`=]/g, - possible = /[&<>"'`=]/; - - function escapeChar(chr) { - return escape[chr]; - } - - function extend(obj /* , ...source */) { - for (var i = 1; i < arguments.length; i++) { - for (var key in arguments[i]) { - if (Object.prototype.hasOwnProperty.call(arguments[i], key)) { - obj[key] = arguments[i][key]; - } - } - } - - return obj; - } - - var toString = Object.prototype.toString; - - exports.toString = toString; - // Sourced from lodash - // https://github.com/bestiejs/lodash/blob/master/LICENSE.txt - /* eslint-disable func-style */ - var isFunction = function isFunction(value) { - return typeof value === 'function'; - }; - // fallback for older versions of Chrome and Safari - /* istanbul ignore next */ - if (isFunction(/x/)) { - exports.isFunction = isFunction = function (value) { - return typeof value === 'function' && toString.call(value) === '[object Function]'; - }; - } - exports.isFunction = isFunction; - - /* eslint-enable func-style */ - - /* istanbul ignore next */ - var isArray = Array.isArray || function (value) { - return value && typeof value === 'object' ? toString.call(value) === '[object Array]' : false; - }; - - exports.isArray = isArray; - // Older IE versions do not directly support indexOf so we must implement our own, sadly. - - function indexOf(array, value) { - for (var i = 0, len = array.length; i < len; i++) { - if (array[i] === value) { - return i; - } - } - return -1; - } - - function escapeExpression(string) { - if (typeof string !== 'string') { - // don't escape SafeStrings, since they're already safe - if (string && string.toHTML) { - return string.toHTML(); - } else if (string == null) { - return ''; - } else if (!string) { - return string + ''; - } - - // Force a string conversion as this will be done by the append regardless and - // the regex test will do this transparently behind the scenes, causing issues if - // an object's to string has escaped characters in it. - string = '' + string; - } - - if (!possible.test(string)) { - return string; - } - return string.replace(badChars, escapeChar); - } - - function isEmpty(value) { - if (!value && value !== 0) { - return true; - } else if (isArray(value) && value.length === 0) { - return true; - } else { - return false; - } - } - - function createFrame(object) { - var frame = extend({}, object); - frame._parent = object; - return frame; - } - - function blockParams(params, ids) { - params.path = ids; - return params; - } - - function appendContextPath(contextPath, id) { - return (contextPath ? contextPath + '.' : '') + id; - } - -/***/ }), -/* 6 */ -/***/ (function(module, exports, __webpack_require__) { - - 'use strict'; - - var _Object$defineProperty = __webpack_require__(7)['default']; - - exports.__esModule = true; - var errorProps = ['description', 'fileName', 'lineNumber', 'endLineNumber', 'message', 'name', 'number', 'stack']; - - function Exception(message, node) { - var loc = node && node.loc, - line = undefined, - endLineNumber = undefined, - column = undefined, - endColumn = undefined; - - if (loc) { - line = loc.start.line; - endLineNumber = loc.end.line; - column = loc.start.column; - endColumn = loc.end.column; - - message += ' - ' + line + ':' + column; - } - - var tmp = Error.prototype.constructor.call(this, message); - - // Unfortunately errors are not enumerable in Chrome (at least), so `for prop in tmp` doesn't work. - for (var idx = 0; idx < errorProps.length; idx++) { - this[errorProps[idx]] = tmp[errorProps[idx]]; - } - - /* istanbul ignore else */ - if (Error.captureStackTrace) { - Error.captureStackTrace(this, Exception); - } - - try { - if (loc) { - this.lineNumber = line; - this.endLineNumber = endLineNumber; - - // Work around issue under safari where we can't directly set the column value - /* istanbul ignore next */ - if (_Object$defineProperty) { - Object.defineProperty(this, 'column', { - value: column, - enumerable: true - }); - Object.defineProperty(this, 'endColumn', { - value: endColumn, - enumerable: true - }); - } else { - this.column = column; - this.endColumn = endColumn; - } - } - } catch (nop) { - /* Ignore if the browser is very particular */ - } - } - - Exception.prototype = new Error(); - - exports['default'] = Exception; - module.exports = exports['default']; - -/***/ }), -/* 7 */ -/***/ (function(module, exports, __webpack_require__) { - - module.exports = { "default": __webpack_require__(8), __esModule: true }; - -/***/ }), -/* 8 */ -/***/ (function(module, exports, __webpack_require__) { - - var $ = __webpack_require__(9); - module.exports = function defineProperty(it, key, desc){ - return $.setDesc(it, key, desc); - }; - -/***/ }), -/* 9 */ -/***/ (function(module, exports) { - - var $Object = Object; - module.exports = { - create: $Object.create, - getProto: $Object.getPrototypeOf, - isEnum: {}.propertyIsEnumerable, - getDesc: $Object.getOwnPropertyDescriptor, - setDesc: $Object.defineProperty, - setDescs: $Object.defineProperties, - getKeys: $Object.keys, - getNames: $Object.getOwnPropertyNames, - getSymbols: $Object.getOwnPropertySymbols, - each: [].forEach - }; - -/***/ }), -/* 10 */ -/***/ (function(module, exports, __webpack_require__) { - - 'use strict'; - - var _interopRequireDefault = __webpack_require__(1)['default']; - - exports.__esModule = true; - exports.registerDefaultHelpers = registerDefaultHelpers; - exports.moveHelperToHooks = moveHelperToHooks; - - var _helpersBlockHelperMissing = __webpack_require__(11); - - var _helpersBlockHelperMissing2 = _interopRequireDefault(_helpersBlockHelperMissing); - - var _helpersEach = __webpack_require__(12); - - var _helpersEach2 = _interopRequireDefault(_helpersEach); - - var _helpersHelperMissing = __webpack_require__(25); - - var _helpersHelperMissing2 = _interopRequireDefault(_helpersHelperMissing); - - var _helpersIf = __webpack_require__(26); - - var _helpersIf2 = _interopRequireDefault(_helpersIf); - - var _helpersLog = __webpack_require__(27); - - var _helpersLog2 = _interopRequireDefault(_helpersLog); - - var _helpersLookup = __webpack_require__(28); - - var _helpersLookup2 = _interopRequireDefault(_helpersLookup); - - var _helpersWith = __webpack_require__(29); - - var _helpersWith2 = _interopRequireDefault(_helpersWith); - - function registerDefaultHelpers(instance) { - _helpersBlockHelperMissing2['default'](instance); - _helpersEach2['default'](instance); - _helpersHelperMissing2['default'](instance); - _helpersIf2['default'](instance); - _helpersLog2['default'](instance); - _helpersLookup2['default'](instance); - _helpersWith2['default'](instance); - } - - function moveHelperToHooks(instance, helperName, keepHelper) { - if (instance.helpers[helperName]) { - instance.hooks[helperName] = instance.helpers[helperName]; - if (!keepHelper) { - delete instance.helpers[helperName]; - } - } - } - -/***/ }), -/* 11 */ -/***/ (function(module, exports, __webpack_require__) { - - 'use strict'; - - exports.__esModule = true; - - var _utils = __webpack_require__(5); - - exports['default'] = function (instance) { - instance.registerHelper('blockHelperMissing', function (context, options) { - var inverse = options.inverse, - fn = options.fn; - - if (context === true) { - return fn(this); - } else if (context === false || context == null) { - return inverse(this); - } else if (_utils.isArray(context)) { - if (context.length > 0) { - if (options.ids) { - options.ids = [options.name]; - } - - return instance.helpers.each(context, options); - } else { - return inverse(this); - } - } else { - if (options.data && options.ids) { - var data = _utils.createFrame(options.data); - data.contextPath = _utils.appendContextPath(options.data.contextPath, options.name); - options = { data: data }; - } - - return fn(context, options); - } - }); - }; - - module.exports = exports['default']; - -/***/ }), -/* 12 */ -/***/ (function(module, exports, __webpack_require__) { - - /* WEBPACK VAR INJECTION */(function(global) {'use strict'; - - var _Object$keys = __webpack_require__(13)['default']; - - var _interopRequireDefault = __webpack_require__(1)['default']; - - exports.__esModule = true; - - var _utils = __webpack_require__(5); - - var _exception = __webpack_require__(6); - - var _exception2 = _interopRequireDefault(_exception); - - exports['default'] = function (instance) { - instance.registerHelper('each', function (context, options) { - if (!options) { - throw new _exception2['default']('Must pass iterator to #each'); - } - - var fn = options.fn, - inverse = options.inverse, - i = 0, - ret = '', - data = undefined, - contextPath = undefined; - - if (options.data && options.ids) { - contextPath = _utils.appendContextPath(options.data.contextPath, options.ids[0]) + '.'; - } - - if (_utils.isFunction(context)) { - context = context.call(this); - } - - if (options.data) { - data = _utils.createFrame(options.data); - } - - function execIteration(field, index, last) { - if (data) { - data.key = field; - data.index = index; - data.first = index === 0; - data.last = !!last; - - if (contextPath) { - data.contextPath = contextPath + field; - } - } - - ret = ret + fn(context[field], { - data: data, - blockParams: _utils.blockParams([context[field], field], [contextPath + field, null]) - }); - } - - if (context && typeof context === 'object') { - if (_utils.isArray(context)) { - for (var j = context.length; i < j; i++) { - if (i in context) { - execIteration(i, i, i === context.length - 1); - } - } - } else if (global.Symbol && context[global.Symbol.iterator]) { - var newContext = []; - var iterator = context[global.Symbol.iterator](); - for (var it = iterator.next(); !it.done; it = iterator.next()) { - newContext.push(it.value); - } - context = newContext; - for (var j = context.length; i < j; i++) { - execIteration(i, i, i === context.length - 1); - } - } else { - (function () { - var priorKey = undefined; - - _Object$keys(context).forEach(function (key) { - // We're running the iterations one step out of sync so we can detect - // the last iteration without have to scan the object twice and create - // an itermediate keys array. - if (priorKey !== undefined) { - execIteration(priorKey, i - 1); - } - priorKey = key; - i++; - }); - if (priorKey !== undefined) { - execIteration(priorKey, i - 1, true); - } - })(); - } - } - - if (i === 0) { - ret = inverse(this); - } - - return ret; - }); - }; - - module.exports = exports['default']; - /* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }()))) - -/***/ }), -/* 13 */ -/***/ (function(module, exports, __webpack_require__) { - - module.exports = { "default": __webpack_require__(14), __esModule: true }; - -/***/ }), -/* 14 */ -/***/ (function(module, exports, __webpack_require__) { - - __webpack_require__(15); - module.exports = __webpack_require__(21).Object.keys; - -/***/ }), -/* 15 */ -/***/ (function(module, exports, __webpack_require__) { - - // 19.1.2.14 Object.keys(O) - var toObject = __webpack_require__(16); - - __webpack_require__(18)('keys', function($keys){ - return function keys(it){ - return $keys(toObject(it)); - }; - }); - -/***/ }), -/* 16 */ -/***/ (function(module, exports, __webpack_require__) { - - // 7.1.13 ToObject(argument) - var defined = __webpack_require__(17); - module.exports = function(it){ - return Object(defined(it)); - }; - -/***/ }), -/* 17 */ -/***/ (function(module, exports) { - - // 7.2.1 RequireObjectCoercible(argument) - module.exports = function(it){ - if(it == undefined)throw TypeError("Can't call method on " + it); - return it; - }; - -/***/ }), -/* 18 */ -/***/ (function(module, exports, __webpack_require__) { - - // most Object methods by ES6 should accept primitives - var $export = __webpack_require__(19) - , core = __webpack_require__(21) - , fails = __webpack_require__(24); - module.exports = function(KEY, exec){ - var fn = (core.Object || {})[KEY] || Object[KEY] - , exp = {}; - exp[KEY] = exec(fn); - $export($export.S + $export.F * fails(function(){ fn(1); }), 'Object', exp); - }; - -/***/ }), -/* 19 */ -/***/ (function(module, exports, __webpack_require__) { - - var global = __webpack_require__(20) - , core = __webpack_require__(21) - , ctx = __webpack_require__(22) - , PROTOTYPE = 'prototype'; - - var $export = function(type, name, source){ - var IS_FORCED = type & $export.F - , IS_GLOBAL = type & $export.G - , IS_STATIC = type & $export.S - , IS_PROTO = type & $export.P - , IS_BIND = type & $export.B - , IS_WRAP = type & $export.W - , exports = IS_GLOBAL ? core : core[name] || (core[name] = {}) - , target = IS_GLOBAL ? global : IS_STATIC ? global[name] : (global[name] || {})[PROTOTYPE] - , key, own, out; - if(IS_GLOBAL)source = name; - for(key in source){ - // contains in native - own = !IS_FORCED && target && key in target; - if(own && key in exports)continue; - // export native or passed - out = own ? target[key] : source[key]; - // prevent global pollution for namespaces - exports[key] = IS_GLOBAL && typeof target[key] != 'function' ? source[key] - // bind timers to global for call from export context - : IS_BIND && own ? ctx(out, global) - // wrap global constructors for prevent change them in library - : IS_WRAP && target[key] == out ? (function(C){ - var F = function(param){ - return this instanceof C ? new C(param) : C(param); - }; - F[PROTOTYPE] = C[PROTOTYPE]; - return F; - // make static versions for prototype methods - })(out) : IS_PROTO && typeof out == 'function' ? ctx(Function.call, out) : out; - if(IS_PROTO)(exports[PROTOTYPE] || (exports[PROTOTYPE] = {}))[key] = out; - } - }; - // type bitmap - $export.F = 1; // forced - $export.G = 2; // global - $export.S = 4; // static - $export.P = 8; // proto - $export.B = 16; // bind - $export.W = 32; // wrap - module.exports = $export; - -/***/ }), -/* 20 */ -/***/ (function(module, exports) { - - // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028 - var global = module.exports = typeof window != 'undefined' && window.Math == Math - ? window : typeof self != 'undefined' && self.Math == Math ? self : Function('return this')(); - if(typeof __g == 'number')__g = global; // eslint-disable-line no-undef - -/***/ }), -/* 21 */ -/***/ (function(module, exports) { - - var core = module.exports = {version: '1.2.6'}; - if(typeof __e == 'number')__e = core; // eslint-disable-line no-undef - -/***/ }), -/* 22 */ -/***/ (function(module, exports, __webpack_require__) { - - // optional / simple context binding - var aFunction = __webpack_require__(23); - module.exports = function(fn, that, length){ - aFunction(fn); - if(that === undefined)return fn; - switch(length){ - case 1: return function(a){ - return fn.call(that, a); - }; - case 2: return function(a, b){ - return fn.call(that, a, b); - }; - case 3: return function(a, b, c){ - return fn.call(that, a, b, c); - }; - } - return function(/* ...args */){ - return fn.apply(that, arguments); - }; - }; - -/***/ }), -/* 23 */ -/***/ (function(module, exports) { - - module.exports = function(it){ - if(typeof it != 'function')throw TypeError(it + ' is not a function!'); - return it; - }; - -/***/ }), -/* 24 */ -/***/ (function(module, exports) { - - module.exports = function(exec){ - try { - return !!exec(); - } catch(e){ - return true; - } - }; - -/***/ }), -/* 25 */ -/***/ (function(module, exports, __webpack_require__) { - - 'use strict'; - - var _interopRequireDefault = __webpack_require__(1)['default']; - - exports.__esModule = true; - - var _exception = __webpack_require__(6); - - var _exception2 = _interopRequireDefault(_exception); - - exports['default'] = function (instance) { - instance.registerHelper('helperMissing', function () /* [args, ]options */{ - if (arguments.length === 1) { - // A missing field in a {{foo}} construct. - return undefined; - } else { - // Someone is actually trying to call something, blow up. - throw new _exception2['default']('Missing helper: "' + arguments[arguments.length - 1].name + '"'); - } - }); - }; - - module.exports = exports['default']; - -/***/ }), -/* 26 */ -/***/ (function(module, exports, __webpack_require__) { - - 'use strict'; - - var _interopRequireDefault = __webpack_require__(1)['default']; - - exports.__esModule = true; - - var _utils = __webpack_require__(5); - - var _exception = __webpack_require__(6); - - var _exception2 = _interopRequireDefault(_exception); - - exports['default'] = function (instance) { - instance.registerHelper('if', function (conditional, options) { - if (arguments.length != 2) { - throw new _exception2['default']('#if requires exactly one argument'); - } - if (_utils.isFunction(conditional)) { - conditional = conditional.call(this); - } - - // Default behavior is to render the positive path if the value is truthy and not empty. - // The `includeZero` option may be set to treat the condtional as purely not empty based on the - // behavior of isEmpty. Effectively this determines if 0 is handled by the positive path or negative. - if (!options.hash.includeZero && !conditional || _utils.isEmpty(conditional)) { - return options.inverse(this); - } else { - return options.fn(this); - } - }); - - instance.registerHelper('unless', function (conditional, options) { - if (arguments.length != 2) { - throw new _exception2['default']('#unless requires exactly one argument'); - } - return instance.helpers['if'].call(this, conditional, { - fn: options.inverse, - inverse: options.fn, - hash: options.hash - }); - }); - }; - - module.exports = exports['default']; - -/***/ }), -/* 27 */ -/***/ (function(module, exports) { - - 'use strict'; - - exports.__esModule = true; - - exports['default'] = function (instance) { - instance.registerHelper('log', function () /* message, options */{ - var args = [undefined], - options = arguments[arguments.length - 1]; - for (var i = 0; i < arguments.length - 1; i++) { - args.push(arguments[i]); - } - - var level = 1; - if (options.hash.level != null) { - level = options.hash.level; - } else if (options.data && options.data.level != null) { - level = options.data.level; - } - args[0] = level; - - instance.log.apply(instance, args); - }); - }; - - module.exports = exports['default']; - -/***/ }), -/* 28 */ -/***/ (function(module, exports) { - - 'use strict'; - - exports.__esModule = true; - - exports['default'] = function (instance) { - instance.registerHelper('lookup', function (obj, field, options) { - if (!obj) { - // Note for 5.0: Change to "obj == null" in 5.0 - return obj; - } - return options.lookupProperty(obj, field); - }); - }; - - module.exports = exports['default']; - -/***/ }), -/* 29 */ -/***/ (function(module, exports, __webpack_require__) { - - 'use strict'; - - var _interopRequireDefault = __webpack_require__(1)['default']; - - exports.__esModule = true; - - var _utils = __webpack_require__(5); - - var _exception = __webpack_require__(6); - - var _exception2 = _interopRequireDefault(_exception); - - exports['default'] = function (instance) { - instance.registerHelper('with', function (context, options) { - if (arguments.length != 2) { - throw new _exception2['default']('#with requires exactly one argument'); - } - if (_utils.isFunction(context)) { - context = context.call(this); - } - - var fn = options.fn; - - if (!_utils.isEmpty(context)) { - var data = options.data; - if (options.data && options.ids) { - data = _utils.createFrame(options.data); - data.contextPath = _utils.appendContextPath(options.data.contextPath, options.ids[0]); - } - - return fn(context, { - data: data, - blockParams: _utils.blockParams([context], [data && data.contextPath]) - }); - } else { - return options.inverse(this); - } - }); - }; - - module.exports = exports['default']; - -/***/ }), -/* 30 */ -/***/ (function(module, exports, __webpack_require__) { - - 'use strict'; - - var _interopRequireDefault = __webpack_require__(1)['default']; - - exports.__esModule = true; - exports.registerDefaultDecorators = registerDefaultDecorators; - - var _decoratorsInline = __webpack_require__(31); - - var _decoratorsInline2 = _interopRequireDefault(_decoratorsInline); - - function registerDefaultDecorators(instance) { - _decoratorsInline2['default'](instance); - } - -/***/ }), -/* 31 */ -/***/ (function(module, exports, __webpack_require__) { - - 'use strict'; - - exports.__esModule = true; - - var _utils = __webpack_require__(5); - - exports['default'] = function (instance) { - instance.registerDecorator('inline', function (fn, props, container, options) { - var ret = fn; - if (!props.partials) { - props.partials = {}; - ret = function (context, options) { - // Create a new partials stack frame prior to exec. - var original = container.partials; - container.partials = _utils.extend({}, original, props.partials); - var ret = fn(context, options); - container.partials = original; - return ret; - }; - } - - props.partials[options.args[0]] = options.fn; - - return ret; - }); - }; - - module.exports = exports['default']; - -/***/ }), -/* 32 */ -/***/ (function(module, exports, __webpack_require__) { - - 'use strict'; - - exports.__esModule = true; - - var _utils = __webpack_require__(5); - - var logger = { - methodMap: ['debug', 'info', 'warn', 'error'], - level: 'info', - - // Maps a given level value to the `methodMap` indexes above. - lookupLevel: function lookupLevel(level) { - if (typeof level === 'string') { - var levelMap = _utils.indexOf(logger.methodMap, level.toLowerCase()); - if (levelMap >= 0) { - level = levelMap; - } else { - level = parseInt(level, 10); - } - } - - return level; - }, - - // Can be overridden in the host environment - log: function log(level) { - level = logger.lookupLevel(level); - - if (typeof console !== 'undefined' && logger.lookupLevel(logger.level) <= level) { - var method = logger.methodMap[level]; - // eslint-disable-next-line no-console - if (!console[method]) { - method = 'log'; - } - - for (var _len = arguments.length, message = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { - message[_key - 1] = arguments[_key]; - } - - console[method].apply(console, message); // eslint-disable-line no-console - } - } - }; - - exports['default'] = logger; - module.exports = exports['default']; - -/***/ }), -/* 33 */ -/***/ (function(module, exports, __webpack_require__) { - - 'use strict'; - - var _Object$create = __webpack_require__(34)['default']; - - var _Object$keys = __webpack_require__(13)['default']; - - var _interopRequireWildcard = __webpack_require__(3)['default']; - - exports.__esModule = true; - exports.createProtoAccessControl = createProtoAccessControl; - exports.resultIsAllowed = resultIsAllowed; - exports.resetLoggedProperties = resetLoggedProperties; - - var _createNewLookupObject = __webpack_require__(36); - - var _logger = __webpack_require__(32); - - var logger = _interopRequireWildcard(_logger); - - var loggedProperties = _Object$create(null); - - function createProtoAccessControl(runtimeOptions) { - var defaultMethodWhiteList = _Object$create(null); - defaultMethodWhiteList['constructor'] = false; - defaultMethodWhiteList['__defineGetter__'] = false; - defaultMethodWhiteList['__defineSetter__'] = false; - defaultMethodWhiteList['__lookupGetter__'] = false; - - var defaultPropertyWhiteList = _Object$create(null); - // eslint-disable-next-line no-proto - defaultPropertyWhiteList['__proto__'] = false; - - return { - properties: { - whitelist: _createNewLookupObject.createNewLookupObject(defaultPropertyWhiteList, runtimeOptions.allowedProtoProperties), - defaultValue: runtimeOptions.allowProtoPropertiesByDefault - }, - methods: { - whitelist: _createNewLookupObject.createNewLookupObject(defaultMethodWhiteList, runtimeOptions.allowedProtoMethods), - defaultValue: runtimeOptions.allowProtoMethodsByDefault - } - }; - } - - function resultIsAllowed(result, protoAccessControl, propertyName) { - if (typeof result === 'function') { - return checkWhiteList(protoAccessControl.methods, propertyName); - } else { - return checkWhiteList(protoAccessControl.properties, propertyName); - } - } - - function checkWhiteList(protoAccessControlForType, propertyName) { - if (protoAccessControlForType.whitelist[propertyName] !== undefined) { - return protoAccessControlForType.whitelist[propertyName] === true; - } - if (protoAccessControlForType.defaultValue !== undefined) { - return protoAccessControlForType.defaultValue; - } - logUnexpecedPropertyAccessOnce(propertyName); - return false; - } - - function logUnexpecedPropertyAccessOnce(propertyName) { - if (loggedProperties[propertyName] !== true) { - loggedProperties[propertyName] = true; - logger.log('error', 'Handlebars: Access has been denied to resolve the property "' + propertyName + '" because it is not an "own property" of its parent.\n' + 'You can add a runtime option to disable the check or this warning:\n' + 'See https://handlebarsjs.com/api-reference/runtime-options.html#options-to-control-prototype-access for details'); - } - } - - function resetLoggedProperties() { - _Object$keys(loggedProperties).forEach(function (propertyName) { - delete loggedProperties[propertyName]; - }); - } - -/***/ }), -/* 34 */ -/***/ (function(module, exports, __webpack_require__) { - - module.exports = { "default": __webpack_require__(35), __esModule: true }; - -/***/ }), -/* 35 */ -/***/ (function(module, exports, __webpack_require__) { - - var $ = __webpack_require__(9); - module.exports = function create(P, D){ - return $.create(P, D); - }; - -/***/ }), -/* 36 */ -/***/ (function(module, exports, __webpack_require__) { - - 'use strict'; - - var _Object$create = __webpack_require__(34)['default']; - - exports.__esModule = true; - exports.createNewLookupObject = createNewLookupObject; - - var _utils = __webpack_require__(5); - - /** - * Create a new object with "null"-prototype to avoid truthy results on prototype properties. - * The resulting object can be used with "object[property]" to check if a property exists - * @param {...object} sources a varargs parameter of source objects that will be merged - * @returns {object} - */ - - function createNewLookupObject() { - for (var _len = arguments.length, sources = Array(_len), _key = 0; _key < _len; _key++) { - sources[_key] = arguments[_key]; - } - - return _utils.extend.apply(undefined, [_Object$create(null)].concat(sources)); - } - -/***/ }), -/* 37 */ -/***/ (function(module, exports) { - - // Build out our basic SafeString type - 'use strict'; - - exports.__esModule = true; - function SafeString(string) { - this.string = string; - } - - SafeString.prototype.toString = SafeString.prototype.toHTML = function () { - return '' + this.string; - }; - - exports['default'] = SafeString; - module.exports = exports['default']; - -/***/ }), -/* 38 */ -/***/ (function(module, exports, __webpack_require__) { - - 'use strict'; - - var _Object$seal = __webpack_require__(39)['default']; - - var _Object$keys = __webpack_require__(13)['default']; - - var _interopRequireWildcard = __webpack_require__(3)['default']; - - var _interopRequireDefault = __webpack_require__(1)['default']; - - exports.__esModule = true; - exports.checkRevision = checkRevision; - exports.template = template; - exports.wrapProgram = wrapProgram; - exports.resolvePartial = resolvePartial; - exports.invokePartial = invokePartial; - exports.noop = noop; - - var _utils = __webpack_require__(5); - - var Utils = _interopRequireWildcard(_utils); - - var _exception = __webpack_require__(6); - - var _exception2 = _interopRequireDefault(_exception); - - var _base = __webpack_require__(4); - - var _helpers = __webpack_require__(10); - - var _internalWrapHelper = __webpack_require__(43); - - var _internalProtoAccess = __webpack_require__(33); - - function checkRevision(compilerInfo) { - var compilerRevision = compilerInfo && compilerInfo[0] || 1, - currentRevision = _base.COMPILER_REVISION; - - if (compilerRevision >= _base.LAST_COMPATIBLE_COMPILER_REVISION && compilerRevision <= _base.COMPILER_REVISION) { - return; - } - - if (compilerRevision < _base.LAST_COMPATIBLE_COMPILER_REVISION) { - var runtimeVersions = _base.REVISION_CHANGES[currentRevision], - compilerVersions = _base.REVISION_CHANGES[compilerRevision]; - throw new _exception2['default']('Template was precompiled with an older version of Handlebars than the current runtime. ' + 'Please update your precompiler to a newer version (' + runtimeVersions + ') or downgrade your runtime to an older version (' + compilerVersions + ').'); - } else { - // Use the embedded version info since the runtime doesn't know about this revision yet - throw new _exception2['default']('Template was precompiled with a newer version of Handlebars than the current runtime. ' + 'Please update your runtime to a newer version (' + compilerInfo[1] + ').'); - } - } - - function template(templateSpec, env) { - /* istanbul ignore next */ - if (!env) { - throw new _exception2['default']('No environment passed to template'); - } - if (!templateSpec || !templateSpec.main) { - throw new _exception2['default']('Unknown template object: ' + typeof templateSpec); - } - - templateSpec.main.decorator = templateSpec.main_d; - - // Note: Using env.VM references rather than local var references throughout this section to allow - // for external users to override these as pseudo-supported APIs. - env.VM.checkRevision(templateSpec.compiler); - - // backwards compatibility for precompiled templates with compiler-version 7 (<4.3.0) - var templateWasPrecompiledWithCompilerV7 = templateSpec.compiler && templateSpec.compiler[0] === 7; - - function invokePartialWrapper(partial, context, options) { - if (options.hash) { - context = Utils.extend({}, context, options.hash); - if (options.ids) { - options.ids[0] = true; - } - } - partial = env.VM.resolvePartial.call(this, partial, context, options); - - var extendedOptions = Utils.extend({}, options, { - hooks: this.hooks, - protoAccessControl: this.protoAccessControl - }); - - var result = env.VM.invokePartial.call(this, partial, context, extendedOptions); - - if (result == null && env.compile) { - options.partials[options.name] = env.compile(partial, templateSpec.compilerOptions, env); - result = options.partials[options.name](context, extendedOptions); - } - if (result != null) { - if (options.indent) { - var lines = result.split('\n'); - for (var i = 0, l = lines.length; i < l; i++) { - if (!lines[i] && i + 1 === l) { - break; - } - - lines[i] = options.indent + lines[i]; - } - result = lines.join('\n'); - } - return result; - } else { - throw new _exception2['default']('The partial ' + options.name + ' could not be compiled when running in runtime-only mode'); - } - } - - // Just add water - var container = { - strict: function strict(obj, name, loc) { - if (!obj || !(name in obj)) { - throw new _exception2['default']('"' + name + '" not defined in ' + obj, { - loc: loc - }); - } - return container.lookupProperty(obj, name); - }, - lookupProperty: function lookupProperty(parent, propertyName) { - var result = parent[propertyName]; - if (result == null) { - return result; - } - if (Object.prototype.hasOwnProperty.call(parent, propertyName)) { - return result; - } - - if (_internalProtoAccess.resultIsAllowed(result, container.protoAccessControl, propertyName)) { - return result; - } - return undefined; - }, - lookup: function lookup(depths, name) { - var len = depths.length; - for (var i = 0; i < len; i++) { - var result = depths[i] && container.lookupProperty(depths[i], name); - if (result != null) { - return depths[i][name]; - } - } - }, - lambda: function lambda(current, context) { - return typeof current === 'function' ? current.call(context) : current; - }, - - escapeExpression: Utils.escapeExpression, - invokePartial: invokePartialWrapper, - - fn: function fn(i) { - var ret = templateSpec[i]; - ret.decorator = templateSpec[i + '_d']; - return ret; - }, - - programs: [], - program: function program(i, data, declaredBlockParams, blockParams, depths) { - var programWrapper = this.programs[i], - fn = this.fn(i); - if (data || depths || blockParams || declaredBlockParams) { - programWrapper = wrapProgram(this, i, fn, data, declaredBlockParams, blockParams, depths); - } else if (!programWrapper) { - programWrapper = this.programs[i] = wrapProgram(this, i, fn); - } - return programWrapper; - }, - - data: function data(value, depth) { - while (value && depth--) { - value = value._parent; - } - return value; - }, - mergeIfNeeded: function mergeIfNeeded(param, common) { - var obj = param || common; - - if (param && common && param !== common) { - obj = Utils.extend({}, common, param); - } - - return obj; - }, - // An empty object to use as replacement for null-contexts - nullContext: _Object$seal({}), - - noop: env.VM.noop, - compilerInfo: templateSpec.compiler - }; - - function ret(context) { - var options = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1]; - - var data = options.data; - - ret._setup(options); - if (!options.partial && templateSpec.useData) { - data = initData(context, data); - } - var depths = undefined, - blockParams = templateSpec.useBlockParams ? [] : undefined; - if (templateSpec.useDepths) { - if (options.depths) { - depths = context != options.depths[0] ? [context].concat(options.depths) : options.depths; - } else { - depths = [context]; - } - } - - function main(context /*, options*/) { - return '' + templateSpec.main(container, context, container.helpers, container.partials, data, blockParams, depths); - } - - main = executeDecorators(templateSpec.main, main, container, options.depths || [], data, blockParams); - return main(context, options); - } - - ret.isTop = true; - - ret._setup = function (options) { - if (!options.partial) { - var mergedHelpers = Utils.extend({}, env.helpers, options.helpers); - wrapHelpersToPassLookupProperty(mergedHelpers, container); - container.helpers = mergedHelpers; - - if (templateSpec.usePartial) { - // Use mergeIfNeeded here to prevent compiling global partials multiple times - container.partials = container.mergeIfNeeded(options.partials, env.partials); - } - if (templateSpec.usePartial || templateSpec.useDecorators) { - container.decorators = Utils.extend({}, env.decorators, options.decorators); - } - - container.hooks = {}; - container.protoAccessControl = _internalProtoAccess.createProtoAccessControl(options); - - var keepHelperInHelpers = options.allowCallsToHelperMissing || templateWasPrecompiledWithCompilerV7; - _helpers.moveHelperToHooks(container, 'helperMissing', keepHelperInHelpers); - _helpers.moveHelperToHooks(container, 'blockHelperMissing', keepHelperInHelpers); - } else { - container.protoAccessControl = options.protoAccessControl; // internal option - container.helpers = options.helpers; - container.partials = options.partials; - container.decorators = options.decorators; - container.hooks = options.hooks; - } - }; - - ret._child = function (i, data, blockParams, depths) { - if (templateSpec.useBlockParams && !blockParams) { - throw new _exception2['default']('must pass block params'); - } - if (templateSpec.useDepths && !depths) { - throw new _exception2['default']('must pass parent depths'); - } - - return wrapProgram(container, i, templateSpec[i], data, 0, blockParams, depths); - }; - return ret; - } - - function wrapProgram(container, i, fn, data, declaredBlockParams, blockParams, depths) { - function prog(context) { - var options = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1]; - - var currentDepths = depths; - if (depths && context != depths[0] && !(context === container.nullContext && depths[0] === null)) { - currentDepths = [context].concat(depths); - } - - return fn(container, context, container.helpers, container.partials, options.data || data, blockParams && [options.blockParams].concat(blockParams), currentDepths); - } - - prog = executeDecorators(fn, prog, container, depths, data, blockParams); - - prog.program = i; - prog.depth = depths ? depths.length : 0; - prog.blockParams = declaredBlockParams || 0; - return prog; - } - - /** - * This is currently part of the official API, therefore implementation details should not be changed. - */ - - function resolvePartial(partial, context, options) { - if (!partial) { - if (options.name === '@partial-block') { - partial = options.data['partial-block']; - } else { - partial = options.partials[options.name]; - } - } else if (!partial.call && !options.name) { - // This is a dynamic partial that returned a string - options.name = partial; - partial = options.partials[partial]; - } - return partial; - } - - function invokePartial(partial, context, options) { - // Use the current closure context to save the partial-block if this partial - var currentPartialBlock = options.data && options.data['partial-block']; - options.partial = true; - if (options.ids) { - options.data.contextPath = options.ids[0] || options.data.contextPath; - } - - var partialBlock = undefined; - if (options.fn && options.fn !== noop) { - (function () { - options.data = _base.createFrame(options.data); - // Wrapper function to get access to currentPartialBlock from the closure - var fn = options.fn; - partialBlock = options.data['partial-block'] = function partialBlockWrapper(context) { - var options = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1]; - - // Restore the partial-block from the closure for the execution of the block - // i.e. the part inside the block of the partial call. - options.data = _base.createFrame(options.data); - options.data['partial-block'] = currentPartialBlock; - return fn(context, options); - }; - if (fn.partials) { - options.partials = Utils.extend({}, options.partials, fn.partials); - } - })(); - } - - if (partial === undefined && partialBlock) { - partial = partialBlock; - } - - if (partial === undefined) { - throw new _exception2['default']('The partial ' + options.name + ' could not be found'); - } else if (partial instanceof Function) { - return partial(context, options); - } - } - - function noop() { - return ''; - } - - function initData(context, data) { - if (!data || !('root' in data)) { - data = data ? _base.createFrame(data) : {}; - data.root = context; - } - return data; - } - - function executeDecorators(fn, prog, container, depths, data, blockParams) { - if (fn.decorator) { - var props = {}; - prog = fn.decorator(prog, props, container, depths && depths[0], data, blockParams, depths); - Utils.extend(prog, props); - } - return prog; - } - - function wrapHelpersToPassLookupProperty(mergedHelpers, container) { - _Object$keys(mergedHelpers).forEach(function (helperName) { - var helper = mergedHelpers[helperName]; - mergedHelpers[helperName] = passLookupPropertyOption(helper, container); - }); - } - - function passLookupPropertyOption(helper, container) { - var lookupProperty = container.lookupProperty; - return _internalWrapHelper.wrapHelper(helper, function (options) { - return Utils.extend({ lookupProperty: lookupProperty }, options); - }); - } - -/***/ }), -/* 39 */ -/***/ (function(module, exports, __webpack_require__) { - - module.exports = { "default": __webpack_require__(40), __esModule: true }; - -/***/ }), -/* 40 */ -/***/ (function(module, exports, __webpack_require__) { - - __webpack_require__(41); - module.exports = __webpack_require__(21).Object.seal; - -/***/ }), -/* 41 */ -/***/ (function(module, exports, __webpack_require__) { - - // 19.1.2.17 Object.seal(O) - var isObject = __webpack_require__(42); - - __webpack_require__(18)('seal', function($seal){ - return function seal(it){ - return $seal && isObject(it) ? $seal(it) : it; - }; - }); - -/***/ }), -/* 42 */ -/***/ (function(module, exports) { - - module.exports = function(it){ - return typeof it === 'object' ? it !== null : typeof it === 'function'; - }; - -/***/ }), -/* 43 */ -/***/ (function(module, exports) { - - 'use strict'; - - exports.__esModule = true; - exports.wrapHelper = wrapHelper; - - function wrapHelper(helper, transformOptionsFn) { - if (typeof helper !== 'function') { - // This should not happen, but apparently it does in https://github.com/wycats/handlebars.js/issues/1639 - // We try to make the wrapper least-invasive by not wrapping it, if the helper is not a function. - return helper; - } - var wrapper = function wrapper() /* dynamic arguments */{ - var options = arguments[arguments.length - 1]; - arguments[arguments.length - 1] = transformOptionsFn(options); - return helper.apply(this, arguments); - }; - return wrapper; - } - -/***/ }), -/* 44 */ -/***/ (function(module, exports) { - - /* WEBPACK VAR INJECTION */(function(global) {'use strict'; - - exports.__esModule = true; - - exports['default'] = function (Handlebars) { - /* istanbul ignore next */ - var root = typeof global !== 'undefined' ? global : window, - $Handlebars = root.Handlebars; - /* istanbul ignore next */ - Handlebars.noConflict = function () { - if (root.Handlebars === Handlebars) { - root.Handlebars = $Handlebars; - } - return Handlebars; - }; - }; - - module.exports = exports['default']; - /* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }()))) - -/***/ }), -/* 45 */ -/***/ (function(module, exports) { - - 'use strict'; - - exports.__esModule = true; - var AST = { - // Public API used to evaluate derived attributes regarding AST nodes - helpers: { - // a mustache is definitely a helper if: - // * it is an eligible helper, and - // * it has at least one parameter or hash segment - helperExpression: function helperExpression(node) { - return node.type === 'SubExpression' || (node.type === 'MustacheStatement' || node.type === 'BlockStatement') && !!(node.params && node.params.length || node.hash); - }, - - scopedId: function scopedId(path) { - return (/^\.|this\b/.test(path.original) - ); - }, - - // an ID is simple if it only has one part, and that part is not - // `..` or `this`. - simpleId: function simpleId(path) { - return path.parts.length === 1 && !AST.helpers.scopedId(path) && !path.depth; - } - } - }; - - // Must be exported as an object rather than the root of the module as the jison lexer - // must modify the object to operate properly. - exports['default'] = AST; - module.exports = exports['default']; - -/***/ }), -/* 46 */ -/***/ (function(module, exports, __webpack_require__) { - - 'use strict'; - - var _interopRequireDefault = __webpack_require__(1)['default']; - - var _interopRequireWildcard = __webpack_require__(3)['default']; - - exports.__esModule = true; - exports.parseWithoutProcessing = parseWithoutProcessing; - exports.parse = parse; - - var _parser = __webpack_require__(47); - - var _parser2 = _interopRequireDefault(_parser); - - var _whitespaceControl = __webpack_require__(48); - - var _whitespaceControl2 = _interopRequireDefault(_whitespaceControl); - - var _helpers = __webpack_require__(50); - - var Helpers = _interopRequireWildcard(_helpers); - - var _utils = __webpack_require__(5); - - exports.parser = _parser2['default']; - - var yy = {}; - _utils.extend(yy, Helpers); - - function parseWithoutProcessing(input, options) { - // Just return if an already-compiled AST was passed in. - if (input.type === 'Program') { - return input; - } - - _parser2['default'].yy = yy; - - // Altering the shared object here, but this is ok as parser is a sync operation - yy.locInfo = function (locInfo) { - return new yy.SourceLocation(options && options.srcName, locInfo); - }; - - var ast = _parser2['default'].parse(input); - - return ast; - } - - function parse(input, options) { - var ast = parseWithoutProcessing(input, options); - var strip = new _whitespaceControl2['default'](options); - - return strip.accept(ast); - } - -/***/ }), -/* 47 */ -/***/ (function(module, exports) { - - // File ignored in coverage tests via setting in .istanbul.yml - /* Jison generated parser */ - "use strict"; - - exports.__esModule = true; - var handlebars = (function () { - var parser = { trace: function trace() {}, - yy: {}, - symbols_: { "error": 2, "root": 3, "program": 4, "EOF": 5, "program_repetition0": 6, "statement": 7, "mustache": 8, "block": 9, "rawBlock": 10, "partial": 11, "partialBlock": 12, "content": 13, "COMMENT": 14, "CONTENT": 15, "openRawBlock": 16, "rawBlock_repetition0": 17, "END_RAW_BLOCK": 18, "OPEN_RAW_BLOCK": 19, "helperName": 20, "openRawBlock_repetition0": 21, "openRawBlock_option0": 22, "CLOSE_RAW_BLOCK": 23, "openBlock": 24, "block_option0": 25, "closeBlock": 26, "openInverse": 27, "block_option1": 28, "OPEN_BLOCK": 29, "openBlock_repetition0": 30, "openBlock_option0": 31, "openBlock_option1": 32, "CLOSE": 33, "OPEN_INVERSE": 34, "openInverse_repetition0": 35, "openInverse_option0": 36, "openInverse_option1": 37, "openInverseChain": 38, "OPEN_INVERSE_CHAIN": 39, "openInverseChain_repetition0": 40, "openInverseChain_option0": 41, "openInverseChain_option1": 42, "inverseAndProgram": 43, "INVERSE": 44, "inverseChain": 45, "inverseChain_option0": 46, "OPEN_ENDBLOCK": 47, "OPEN": 48, "mustache_repetition0": 49, "mustache_option0": 50, "OPEN_UNESCAPED": 51, "mustache_repetition1": 52, "mustache_option1": 53, "CLOSE_UNESCAPED": 54, "OPEN_PARTIAL": 55, "partialName": 56, "partial_repetition0": 57, "partial_option0": 58, "openPartialBlock": 59, "OPEN_PARTIAL_BLOCK": 60, "openPartialBlock_repetition0": 61, "openPartialBlock_option0": 62, "param": 63, "sexpr": 64, "OPEN_SEXPR": 65, "sexpr_repetition0": 66, "sexpr_option0": 67, "CLOSE_SEXPR": 68, "hash": 69, "hash_repetition_plus0": 70, "hashSegment": 71, "ID": 72, "EQUALS": 73, "blockParams": 74, "OPEN_BLOCK_PARAMS": 75, "blockParams_repetition_plus0": 76, "CLOSE_BLOCK_PARAMS": 77, "path": 78, "dataName": 79, "STRING": 80, "NUMBER": 81, "BOOLEAN": 82, "UNDEFINED": 83, "NULL": 84, "DATA": 85, "pathSegments": 86, "SEP": 87, "$accept": 0, "$end": 1 }, - terminals_: { 2: "error", 5: "EOF", 14: "COMMENT", 15: "CONTENT", 18: "END_RAW_BLOCK", 19: "OPEN_RAW_BLOCK", 23: "CLOSE_RAW_BLOCK", 29: "OPEN_BLOCK", 33: "CLOSE", 34: "OPEN_INVERSE", 39: "OPEN_INVERSE_CHAIN", 44: "INVERSE", 47: "OPEN_ENDBLOCK", 48: "OPEN", 51: "OPEN_UNESCAPED", 54: "CLOSE_UNESCAPED", 55: "OPEN_PARTIAL", 60: "OPEN_PARTIAL_BLOCK", 65: "OPEN_SEXPR", 68: "CLOSE_SEXPR", 72: "ID", 73: "EQUALS", 75: "OPEN_BLOCK_PARAMS", 77: "CLOSE_BLOCK_PARAMS", 80: "STRING", 81: "NUMBER", 82: "BOOLEAN", 83: "UNDEFINED", 84: "NULL", 85: "DATA", 87: "SEP" }, - productions_: [0, [3, 2], [4, 1], [7, 1], [7, 1], [7, 1], [7, 1], [7, 1], [7, 1], [7, 1], [13, 1], [10, 3], [16, 5], [9, 4], [9, 4], [24, 6], [27, 6], [38, 6], [43, 2], [45, 3], [45, 1], [26, 3], [8, 5], [8, 5], [11, 5], [12, 3], [59, 5], [63, 1], [63, 1], [64, 5], [69, 1], [71, 3], [74, 3], [20, 1], [20, 1], [20, 1], [20, 1], [20, 1], [20, 1], [20, 1], [56, 1], [56, 1], [79, 2], [78, 1], [86, 3], [86, 1], [6, 0], [6, 2], [17, 0], [17, 2], [21, 0], [21, 2], [22, 0], [22, 1], [25, 0], [25, 1], [28, 0], [28, 1], [30, 0], [30, 2], [31, 0], [31, 1], [32, 0], [32, 1], [35, 0], [35, 2], [36, 0], [36, 1], [37, 0], [37, 1], [40, 0], [40, 2], [41, 0], [41, 1], [42, 0], [42, 1], [46, 0], [46, 1], [49, 0], [49, 2], [50, 0], [50, 1], [52, 0], [52, 2], [53, 0], [53, 1], [57, 0], [57, 2], [58, 0], [58, 1], [61, 0], [61, 2], [62, 0], [62, 1], [66, 0], [66, 2], [67, 0], [67, 1], [70, 1], [70, 2], [76, 1], [76, 2]], - performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$) { - - var $0 = $$.length - 1; - switch (yystate) { - case 1: - return $$[$0 - 1]; - break; - case 2: - this.$ = yy.prepareProgram($$[$0]); - break; - case 3: - this.$ = $$[$0]; - break; - case 4: - this.$ = $$[$0]; - break; - case 5: - this.$ = $$[$0]; - break; - case 6: - this.$ = $$[$0]; - break; - case 7: - this.$ = $$[$0]; - break; - case 8: - this.$ = $$[$0]; - break; - case 9: - this.$ = { - type: 'CommentStatement', - value: yy.stripComment($$[$0]), - strip: yy.stripFlags($$[$0], $$[$0]), - loc: yy.locInfo(this._$) - }; - - break; - case 10: - this.$ = { - type: 'ContentStatement', - original: $$[$0], - value: $$[$0], - loc: yy.locInfo(this._$) - }; - - break; - case 11: - this.$ = yy.prepareRawBlock($$[$0 - 2], $$[$0 - 1], $$[$0], this._$); - break; - case 12: - this.$ = { path: $$[$0 - 3], params: $$[$0 - 2], hash: $$[$0 - 1] }; - break; - case 13: - this.$ = yy.prepareBlock($$[$0 - 3], $$[$0 - 2], $$[$0 - 1], $$[$0], false, this._$); - break; - case 14: - this.$ = yy.prepareBlock($$[$0 - 3], $$[$0 - 2], $$[$0 - 1], $$[$0], true, this._$); - break; - case 15: - this.$ = { open: $$[$0 - 5], path: $$[$0 - 4], params: $$[$0 - 3], hash: $$[$0 - 2], blockParams: $$[$0 - 1], strip: yy.stripFlags($$[$0 - 5], $$[$0]) }; - break; - case 16: - this.$ = { path: $$[$0 - 4], params: $$[$0 - 3], hash: $$[$0 - 2], blockParams: $$[$0 - 1], strip: yy.stripFlags($$[$0 - 5], $$[$0]) }; - break; - case 17: - this.$ = { path: $$[$0 - 4], params: $$[$0 - 3], hash: $$[$0 - 2], blockParams: $$[$0 - 1], strip: yy.stripFlags($$[$0 - 5], $$[$0]) }; - break; - case 18: - this.$ = { strip: yy.stripFlags($$[$0 - 1], $$[$0 - 1]), program: $$[$0] }; - break; - case 19: - var inverse = yy.prepareBlock($$[$0 - 2], $$[$0 - 1], $$[$0], $$[$0], false, this._$), - program = yy.prepareProgram([inverse], $$[$0 - 1].loc); - program.chained = true; - - this.$ = { strip: $$[$0 - 2].strip, program: program, chain: true }; - - break; - case 20: - this.$ = $$[$0]; - break; - case 21: - this.$ = { path: $$[$0 - 1], strip: yy.stripFlags($$[$0 - 2], $$[$0]) }; - break; - case 22: - this.$ = yy.prepareMustache($$[$0 - 3], $$[$0 - 2], $$[$0 - 1], $$[$0 - 4], yy.stripFlags($$[$0 - 4], $$[$0]), this._$); - break; - case 23: - this.$ = yy.prepareMustache($$[$0 - 3], $$[$0 - 2], $$[$0 - 1], $$[$0 - 4], yy.stripFlags($$[$0 - 4], $$[$0]), this._$); - break; - case 24: - this.$ = { - type: 'PartialStatement', - name: $$[$0 - 3], - params: $$[$0 - 2], - hash: $$[$0 - 1], - indent: '', - strip: yy.stripFlags($$[$0 - 4], $$[$0]), - loc: yy.locInfo(this._$) - }; - - break; - case 25: - this.$ = yy.preparePartialBlock($$[$0 - 2], $$[$0 - 1], $$[$0], this._$); - break; - case 26: - this.$ = { path: $$[$0 - 3], params: $$[$0 - 2], hash: $$[$0 - 1], strip: yy.stripFlags($$[$0 - 4], $$[$0]) }; - break; - case 27: - this.$ = $$[$0]; - break; - case 28: - this.$ = $$[$0]; - break; - case 29: - this.$ = { - type: 'SubExpression', - path: $$[$0 - 3], - params: $$[$0 - 2], - hash: $$[$0 - 1], - loc: yy.locInfo(this._$) - }; - - break; - case 30: - this.$ = { type: 'Hash', pairs: $$[$0], loc: yy.locInfo(this._$) }; - break; - case 31: - this.$ = { type: 'HashPair', key: yy.id($$[$0 - 2]), value: $$[$0], loc: yy.locInfo(this._$) }; - break; - case 32: - this.$ = yy.id($$[$0 - 1]); - break; - case 33: - this.$ = $$[$0]; - break; - case 34: - this.$ = $$[$0]; - break; - case 35: - this.$ = { type: 'StringLiteral', value: $$[$0], original: $$[$0], loc: yy.locInfo(this._$) }; - break; - case 36: - this.$ = { type: 'NumberLiteral', value: Number($$[$0]), original: Number($$[$0]), loc: yy.locInfo(this._$) }; - break; - case 37: - this.$ = { type: 'BooleanLiteral', value: $$[$0] === 'true', original: $$[$0] === 'true', loc: yy.locInfo(this._$) }; - break; - case 38: - this.$ = { type: 'UndefinedLiteral', original: undefined, value: undefined, loc: yy.locInfo(this._$) }; - break; - case 39: - this.$ = { type: 'NullLiteral', original: null, value: null, loc: yy.locInfo(this._$) }; - break; - case 40: - this.$ = $$[$0]; - break; - case 41: - this.$ = $$[$0]; - break; - case 42: - this.$ = yy.preparePath(true, $$[$0], this._$); - break; - case 43: - this.$ = yy.preparePath(false, $$[$0], this._$); - break; - case 44: - $$[$0 - 2].push({ part: yy.id($$[$0]), original: $$[$0], separator: $$[$0 - 1] });this.$ = $$[$0 - 2]; - break; - case 45: - this.$ = [{ part: yy.id($$[$0]), original: $$[$0] }]; - break; - case 46: - this.$ = []; - break; - case 47: - $$[$0 - 1].push($$[$0]); - break; - case 48: - this.$ = []; - break; - case 49: - $$[$0 - 1].push($$[$0]); - break; - case 50: - this.$ = []; - break; - case 51: - $$[$0 - 1].push($$[$0]); - break; - case 58: - this.$ = []; - break; - case 59: - $$[$0 - 1].push($$[$0]); - break; - case 64: - this.$ = []; - break; - case 65: - $$[$0 - 1].push($$[$0]); - break; - case 70: - this.$ = []; - break; - case 71: - $$[$0 - 1].push($$[$0]); - break; - case 78: - this.$ = []; - break; - case 79: - $$[$0 - 1].push($$[$0]); - break; - case 82: - this.$ = []; - break; - case 83: - $$[$0 - 1].push($$[$0]); - break; - case 86: - this.$ = []; - break; - case 87: - $$[$0 - 1].push($$[$0]); - break; - case 90: - this.$ = []; - break; - case 91: - $$[$0 - 1].push($$[$0]); - break; - case 94: - this.$ = []; - break; - case 95: - $$[$0 - 1].push($$[$0]); - break; - case 98: - this.$ = [$$[$0]]; - break; - case 99: - $$[$0 - 1].push($$[$0]); - break; - case 100: - this.$ = [$$[$0]]; - break; - case 101: - $$[$0 - 1].push($$[$0]); - break; - } - }, - table: [{ 3: 1, 4: 2, 5: [2, 46], 6: 3, 14: [2, 46], 15: [2, 46], 19: [2, 46], 29: [2, 46], 34: [2, 46], 48: [2, 46], 51: [2, 46], 55: [2, 46], 60: [2, 46] }, { 1: [3] }, { 5: [1, 4] }, { 5: [2, 2], 7: 5, 8: 6, 9: 7, 10: 8, 11: 9, 12: 10, 13: 11, 14: [1, 12], 15: [1, 20], 16: 17, 19: [1, 23], 24: 15, 27: 16, 29: [1, 21], 34: [1, 22], 39: [2, 2], 44: [2, 2], 47: [2, 2], 48: [1, 13], 51: [1, 14], 55: [1, 18], 59: 19, 60: [1, 24] }, { 1: [2, 1] }, { 5: [2, 47], 14: [2, 47], 15: [2, 47], 19: [2, 47], 29: [2, 47], 34: [2, 47], 39: [2, 47], 44: [2, 47], 47: [2, 47], 48: [2, 47], 51: [2, 47], 55: [2, 47], 60: [2, 47] }, { 5: [2, 3], 14: [2, 3], 15: [2, 3], 19: [2, 3], 29: [2, 3], 34: [2, 3], 39: [2, 3], 44: [2, 3], 47: [2, 3], 48: [2, 3], 51: [2, 3], 55: [2, 3], 60: [2, 3] }, { 5: [2, 4], 14: [2, 4], 15: [2, 4], 19: [2, 4], 29: [2, 4], 34: [2, 4], 39: [2, 4], 44: [2, 4], 47: [2, 4], 48: [2, 4], 51: [2, 4], 55: [2, 4], 60: [2, 4] }, { 5: [2, 5], 14: [2, 5], 15: [2, 5], 19: [2, 5], 29: [2, 5], 34: [2, 5], 39: [2, 5], 44: [2, 5], 47: [2, 5], 48: [2, 5], 51: [2, 5], 55: [2, 5], 60: [2, 5] }, { 5: [2, 6], 14: [2, 6], 15: [2, 6], 19: [2, 6], 29: [2, 6], 34: [2, 6], 39: [2, 6], 44: [2, 6], 47: [2, 6], 48: [2, 6], 51: [2, 6], 55: [2, 6], 60: [2, 6] }, { 5: [2, 7], 14: [2, 7], 15: [2, 7], 19: [2, 7], 29: [2, 7], 34: [2, 7], 39: [2, 7], 44: [2, 7], 47: [2, 7], 48: [2, 7], 51: [2, 7], 55: [2, 7], 60: [2, 7] }, { 5: [2, 8], 14: [2, 8], 15: [2, 8], 19: [2, 8], 29: [2, 8], 34: [2, 8], 39: [2, 8], 44: [2, 8], 47: [2, 8], 48: [2, 8], 51: [2, 8], 55: [2, 8], 60: [2, 8] }, { 5: [2, 9], 14: [2, 9], 15: [2, 9], 19: [2, 9], 29: [2, 9], 34: [2, 9], 39: [2, 9], 44: [2, 9], 47: [2, 9], 48: [2, 9], 51: [2, 9], 55: [2, 9], 60: [2, 9] }, { 20: 25, 72: [1, 35], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 20: 36, 72: [1, 35], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 4: 37, 6: 3, 14: [2, 46], 15: [2, 46], 19: [2, 46], 29: [2, 46], 34: [2, 46], 39: [2, 46], 44: [2, 46], 47: [2, 46], 48: [2, 46], 51: [2, 46], 55: [2, 46], 60: [2, 46] }, { 4: 38, 6: 3, 14: [2, 46], 15: [2, 46], 19: [2, 46], 29: [2, 46], 34: [2, 46], 44: [2, 46], 47: [2, 46], 48: [2, 46], 51: [2, 46], 55: [2, 46], 60: [2, 46] }, { 15: [2, 48], 17: 39, 18: [2, 48] }, { 20: 41, 56: 40, 64: 42, 65: [1, 43], 72: [1, 35], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 4: 44, 6: 3, 14: [2, 46], 15: [2, 46], 19: [2, 46], 29: [2, 46], 34: [2, 46], 47: [2, 46], 48: [2, 46], 51: [2, 46], 55: [2, 46], 60: [2, 46] }, { 5: [2, 10], 14: [2, 10], 15: [2, 10], 18: [2, 10], 19: [2, 10], 29: [2, 10], 34: [2, 10], 39: [2, 10], 44: [2, 10], 47: [2, 10], 48: [2, 10], 51: [2, 10], 55: [2, 10], 60: [2, 10] }, { 20: 45, 72: [1, 35], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 20: 46, 72: [1, 35], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 20: 47, 72: [1, 35], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 20: 41, 56: 48, 64: 42, 65: [1, 43], 72: [1, 35], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 33: [2, 78], 49: 49, 65: [2, 78], 72: [2, 78], 80: [2, 78], 81: [2, 78], 82: [2, 78], 83: [2, 78], 84: [2, 78], 85: [2, 78] }, { 23: [2, 33], 33: [2, 33], 54: [2, 33], 65: [2, 33], 68: [2, 33], 72: [2, 33], 75: [2, 33], 80: [2, 33], 81: [2, 33], 82: [2, 33], 83: [2, 33], 84: [2, 33], 85: [2, 33] }, { 23: [2, 34], 33: [2, 34], 54: [2, 34], 65: [2, 34], 68: [2, 34], 72: [2, 34], 75: [2, 34], 80: [2, 34], 81: [2, 34], 82: [2, 34], 83: [2, 34], 84: [2, 34], 85: [2, 34] }, { 23: [2, 35], 33: [2, 35], 54: [2, 35], 65: [2, 35], 68: [2, 35], 72: [2, 35], 75: [2, 35], 80: [2, 35], 81: [2, 35], 82: [2, 35], 83: [2, 35], 84: [2, 35], 85: [2, 35] }, { 23: [2, 36], 33: [2, 36], 54: [2, 36], 65: [2, 36], 68: [2, 36], 72: [2, 36], 75: [2, 36], 80: [2, 36], 81: [2, 36], 82: [2, 36], 83: [2, 36], 84: [2, 36], 85: [2, 36] }, { 23: [2, 37], 33: [2, 37], 54: [2, 37], 65: [2, 37], 68: [2, 37], 72: [2, 37], 75: [2, 37], 80: [2, 37], 81: [2, 37], 82: [2, 37], 83: [2, 37], 84: [2, 37], 85: [2, 37] }, { 23: [2, 38], 33: [2, 38], 54: [2, 38], 65: [2, 38], 68: [2, 38], 72: [2, 38], 75: [2, 38], 80: [2, 38], 81: [2, 38], 82: [2, 38], 83: [2, 38], 84: [2, 38], 85: [2, 38] }, { 23: [2, 39], 33: [2, 39], 54: [2, 39], 65: [2, 39], 68: [2, 39], 72: [2, 39], 75: [2, 39], 80: [2, 39], 81: [2, 39], 82: [2, 39], 83: [2, 39], 84: [2, 39], 85: [2, 39] }, { 23: [2, 43], 33: [2, 43], 54: [2, 43], 65: [2, 43], 68: [2, 43], 72: [2, 43], 75: [2, 43], 80: [2, 43], 81: [2, 43], 82: [2, 43], 83: [2, 43], 84: [2, 43], 85: [2, 43], 87: [1, 50] }, { 72: [1, 35], 86: 51 }, { 23: [2, 45], 33: [2, 45], 54: [2, 45], 65: [2, 45], 68: [2, 45], 72: [2, 45], 75: [2, 45], 80: [2, 45], 81: [2, 45], 82: [2, 45], 83: [2, 45], 84: [2, 45], 85: [2, 45], 87: [2, 45] }, { 52: 52, 54: [2, 82], 65: [2, 82], 72: [2, 82], 80: [2, 82], 81: [2, 82], 82: [2, 82], 83: [2, 82], 84: [2, 82], 85: [2, 82] }, { 25: 53, 38: 55, 39: [1, 57], 43: 56, 44: [1, 58], 45: 54, 47: [2, 54] }, { 28: 59, 43: 60, 44: [1, 58], 47: [2, 56] }, { 13: 62, 15: [1, 20], 18: [1, 61] }, { 33: [2, 86], 57: 63, 65: [2, 86], 72: [2, 86], 80: [2, 86], 81: [2, 86], 82: [2, 86], 83: [2, 86], 84: [2, 86], 85: [2, 86] }, { 33: [2, 40], 65: [2, 40], 72: [2, 40], 80: [2, 40], 81: [2, 40], 82: [2, 40], 83: [2, 40], 84: [2, 40], 85: [2, 40] }, { 33: [2, 41], 65: [2, 41], 72: [2, 41], 80: [2, 41], 81: [2, 41], 82: [2, 41], 83: [2, 41], 84: [2, 41], 85: [2, 41] }, { 20: 64, 72: [1, 35], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 26: 65, 47: [1, 66] }, { 30: 67, 33: [2, 58], 65: [2, 58], 72: [2, 58], 75: [2, 58], 80: [2, 58], 81: [2, 58], 82: [2, 58], 83: [2, 58], 84: [2, 58], 85: [2, 58] }, { 33: [2, 64], 35: 68, 65: [2, 64], 72: [2, 64], 75: [2, 64], 80: [2, 64], 81: [2, 64], 82: [2, 64], 83: [2, 64], 84: [2, 64], 85: [2, 64] }, { 21: 69, 23: [2, 50], 65: [2, 50], 72: [2, 50], 80: [2, 50], 81: [2, 50], 82: [2, 50], 83: [2, 50], 84: [2, 50], 85: [2, 50] }, { 33: [2, 90], 61: 70, 65: [2, 90], 72: [2, 90], 80: [2, 90], 81: [2, 90], 82: [2, 90], 83: [2, 90], 84: [2, 90], 85: [2, 90] }, { 20: 74, 33: [2, 80], 50: 71, 63: 72, 64: 75, 65: [1, 43], 69: 73, 70: 76, 71: 77, 72: [1, 78], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 72: [1, 79] }, { 23: [2, 42], 33: [2, 42], 54: [2, 42], 65: [2, 42], 68: [2, 42], 72: [2, 42], 75: [2, 42], 80: [2, 42], 81: [2, 42], 82: [2, 42], 83: [2, 42], 84: [2, 42], 85: [2, 42], 87: [1, 50] }, { 20: 74, 53: 80, 54: [2, 84], 63: 81, 64: 75, 65: [1, 43], 69: 82, 70: 76, 71: 77, 72: [1, 78], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 26: 83, 47: [1, 66] }, { 47: [2, 55] }, { 4: 84, 6: 3, 14: [2, 46], 15: [2, 46], 19: [2, 46], 29: [2, 46], 34: [2, 46], 39: [2, 46], 44: [2, 46], 47: [2, 46], 48: [2, 46], 51: [2, 46], 55: [2, 46], 60: [2, 46] }, { 47: [2, 20] }, { 20: 85, 72: [1, 35], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 4: 86, 6: 3, 14: [2, 46], 15: [2, 46], 19: [2, 46], 29: [2, 46], 34: [2, 46], 47: [2, 46], 48: [2, 46], 51: [2, 46], 55: [2, 46], 60: [2, 46] }, { 26: 87, 47: [1, 66] }, { 47: [2, 57] }, { 5: [2, 11], 14: [2, 11], 15: [2, 11], 19: [2, 11], 29: [2, 11], 34: [2, 11], 39: [2, 11], 44: [2, 11], 47: [2, 11], 48: [2, 11], 51: [2, 11], 55: [2, 11], 60: [2, 11] }, { 15: [2, 49], 18: [2, 49] }, { 20: 74, 33: [2, 88], 58: 88, 63: 89, 64: 75, 65: [1, 43], 69: 90, 70: 76, 71: 77, 72: [1, 78], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 65: [2, 94], 66: 91, 68: [2, 94], 72: [2, 94], 80: [2, 94], 81: [2, 94], 82: [2, 94], 83: [2, 94], 84: [2, 94], 85: [2, 94] }, { 5: [2, 25], 14: [2, 25], 15: [2, 25], 19: [2, 25], 29: [2, 25], 34: [2, 25], 39: [2, 25], 44: [2, 25], 47: [2, 25], 48: [2, 25], 51: [2, 25], 55: [2, 25], 60: [2, 25] }, { 20: 92, 72: [1, 35], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 20: 74, 31: 93, 33: [2, 60], 63: 94, 64: 75, 65: [1, 43], 69: 95, 70: 76, 71: 77, 72: [1, 78], 75: [2, 60], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 20: 74, 33: [2, 66], 36: 96, 63: 97, 64: 75, 65: [1, 43], 69: 98, 70: 76, 71: 77, 72: [1, 78], 75: [2, 66], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 20: 74, 22: 99, 23: [2, 52], 63: 100, 64: 75, 65: [1, 43], 69: 101, 70: 76, 71: 77, 72: [1, 78], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 20: 74, 33: [2, 92], 62: 102, 63: 103, 64: 75, 65: [1, 43], 69: 104, 70: 76, 71: 77, 72: [1, 78], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 33: [1, 105] }, { 33: [2, 79], 65: [2, 79], 72: [2, 79], 80: [2, 79], 81: [2, 79], 82: [2, 79], 83: [2, 79], 84: [2, 79], 85: [2, 79] }, { 33: [2, 81] }, { 23: [2, 27], 33: [2, 27], 54: [2, 27], 65: [2, 27], 68: [2, 27], 72: [2, 27], 75: [2, 27], 80: [2, 27], 81: [2, 27], 82: [2, 27], 83: [2, 27], 84: [2, 27], 85: [2, 27] }, { 23: [2, 28], 33: [2, 28], 54: [2, 28], 65: [2, 28], 68: [2, 28], 72: [2, 28], 75: [2, 28], 80: [2, 28], 81: [2, 28], 82: [2, 28], 83: [2, 28], 84: [2, 28], 85: [2, 28] }, { 23: [2, 30], 33: [2, 30], 54: [2, 30], 68: [2, 30], 71: 106, 72: [1, 107], 75: [2, 30] }, { 23: [2, 98], 33: [2, 98], 54: [2, 98], 68: [2, 98], 72: [2, 98], 75: [2, 98] }, { 23: [2, 45], 33: [2, 45], 54: [2, 45], 65: [2, 45], 68: [2, 45], 72: [2, 45], 73: [1, 108], 75: [2, 45], 80: [2, 45], 81: [2, 45], 82: [2, 45], 83: [2, 45], 84: [2, 45], 85: [2, 45], 87: [2, 45] }, { 23: [2, 44], 33: [2, 44], 54: [2, 44], 65: [2, 44], 68: [2, 44], 72: [2, 44], 75: [2, 44], 80: [2, 44], 81: [2, 44], 82: [2, 44], 83: [2, 44], 84: [2, 44], 85: [2, 44], 87: [2, 44] }, { 54: [1, 109] }, { 54: [2, 83], 65: [2, 83], 72: [2, 83], 80: [2, 83], 81: [2, 83], 82: [2, 83], 83: [2, 83], 84: [2, 83], 85: [2, 83] }, { 54: [2, 85] }, { 5: [2, 13], 14: [2, 13], 15: [2, 13], 19: [2, 13], 29: [2, 13], 34: [2, 13], 39: [2, 13], 44: [2, 13], 47: [2, 13], 48: [2, 13], 51: [2, 13], 55: [2, 13], 60: [2, 13] }, { 38: 55, 39: [1, 57], 43: 56, 44: [1, 58], 45: 111, 46: 110, 47: [2, 76] }, { 33: [2, 70], 40: 112, 65: [2, 70], 72: [2, 70], 75: [2, 70], 80: [2, 70], 81: [2, 70], 82: [2, 70], 83: [2, 70], 84: [2, 70], 85: [2, 70] }, { 47: [2, 18] }, { 5: [2, 14], 14: [2, 14], 15: [2, 14], 19: [2, 14], 29: [2, 14], 34: [2, 14], 39: [2, 14], 44: [2, 14], 47: [2, 14], 48: [2, 14], 51: [2, 14], 55: [2, 14], 60: [2, 14] }, { 33: [1, 113] }, { 33: [2, 87], 65: [2, 87], 72: [2, 87], 80: [2, 87], 81: [2, 87], 82: [2, 87], 83: [2, 87], 84: [2, 87], 85: [2, 87] }, { 33: [2, 89] }, { 20: 74, 63: 115, 64: 75, 65: [1, 43], 67: 114, 68: [2, 96], 69: 116, 70: 76, 71: 77, 72: [1, 78], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 33: [1, 117] }, { 32: 118, 33: [2, 62], 74: 119, 75: [1, 120] }, { 33: [2, 59], 65: [2, 59], 72: [2, 59], 75: [2, 59], 80: [2, 59], 81: [2, 59], 82: [2, 59], 83: [2, 59], 84: [2, 59], 85: [2, 59] }, { 33: [2, 61], 75: [2, 61] }, { 33: [2, 68], 37: 121, 74: 122, 75: [1, 120] }, { 33: [2, 65], 65: [2, 65], 72: [2, 65], 75: [2, 65], 80: [2, 65], 81: [2, 65], 82: [2, 65], 83: [2, 65], 84: [2, 65], 85: [2, 65] }, { 33: [2, 67], 75: [2, 67] }, { 23: [1, 123] }, { 23: [2, 51], 65: [2, 51], 72: [2, 51], 80: [2, 51], 81: [2, 51], 82: [2, 51], 83: [2, 51], 84: [2, 51], 85: [2, 51] }, { 23: [2, 53] }, { 33: [1, 124] }, { 33: [2, 91], 65: [2, 91], 72: [2, 91], 80: [2, 91], 81: [2, 91], 82: [2, 91], 83: [2, 91], 84: [2, 91], 85: [2, 91] }, { 33: [2, 93] }, { 5: [2, 22], 14: [2, 22], 15: [2, 22], 19: [2, 22], 29: [2, 22], 34: [2, 22], 39: [2, 22], 44: [2, 22], 47: [2, 22], 48: [2, 22], 51: [2, 22], 55: [2, 22], 60: [2, 22] }, { 23: [2, 99], 33: [2, 99], 54: [2, 99], 68: [2, 99], 72: [2, 99], 75: [2, 99] }, { 73: [1, 108] }, { 20: 74, 63: 125, 64: 75, 65: [1, 43], 72: [1, 35], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 5: [2, 23], 14: [2, 23], 15: [2, 23], 19: [2, 23], 29: [2, 23], 34: [2, 23], 39: [2, 23], 44: [2, 23], 47: [2, 23], 48: [2, 23], 51: [2, 23], 55: [2, 23], 60: [2, 23] }, { 47: [2, 19] }, { 47: [2, 77] }, { 20: 74, 33: [2, 72], 41: 126, 63: 127, 64: 75, 65: [1, 43], 69: 128, 70: 76, 71: 77, 72: [1, 78], 75: [2, 72], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 5: [2, 24], 14: [2, 24], 15: [2, 24], 19: [2, 24], 29: [2, 24], 34: [2, 24], 39: [2, 24], 44: [2, 24], 47: [2, 24], 48: [2, 24], 51: [2, 24], 55: [2, 24], 60: [2, 24] }, { 68: [1, 129] }, { 65: [2, 95], 68: [2, 95], 72: [2, 95], 80: [2, 95], 81: [2, 95], 82: [2, 95], 83: [2, 95], 84: [2, 95], 85: [2, 95] }, { 68: [2, 97] }, { 5: [2, 21], 14: [2, 21], 15: [2, 21], 19: [2, 21], 29: [2, 21], 34: [2, 21], 39: [2, 21], 44: [2, 21], 47: [2, 21], 48: [2, 21], 51: [2, 21], 55: [2, 21], 60: [2, 21] }, { 33: [1, 130] }, { 33: [2, 63] }, { 72: [1, 132], 76: 131 }, { 33: [1, 133] }, { 33: [2, 69] }, { 15: [2, 12], 18: [2, 12] }, { 14: [2, 26], 15: [2, 26], 19: [2, 26], 29: [2, 26], 34: [2, 26], 47: [2, 26], 48: [2, 26], 51: [2, 26], 55: [2, 26], 60: [2, 26] }, { 23: [2, 31], 33: [2, 31], 54: [2, 31], 68: [2, 31], 72: [2, 31], 75: [2, 31] }, { 33: [2, 74], 42: 134, 74: 135, 75: [1, 120] }, { 33: [2, 71], 65: [2, 71], 72: [2, 71], 75: [2, 71], 80: [2, 71], 81: [2, 71], 82: [2, 71], 83: [2, 71], 84: [2, 71], 85: [2, 71] }, { 33: [2, 73], 75: [2, 73] }, { 23: [2, 29], 33: [2, 29], 54: [2, 29], 65: [2, 29], 68: [2, 29], 72: [2, 29], 75: [2, 29], 80: [2, 29], 81: [2, 29], 82: [2, 29], 83: [2, 29], 84: [2, 29], 85: [2, 29] }, { 14: [2, 15], 15: [2, 15], 19: [2, 15], 29: [2, 15], 34: [2, 15], 39: [2, 15], 44: [2, 15], 47: [2, 15], 48: [2, 15], 51: [2, 15], 55: [2, 15], 60: [2, 15] }, { 72: [1, 137], 77: [1, 136] }, { 72: [2, 100], 77: [2, 100] }, { 14: [2, 16], 15: [2, 16], 19: [2, 16], 29: [2, 16], 34: [2, 16], 44: [2, 16], 47: [2, 16], 48: [2, 16], 51: [2, 16], 55: [2, 16], 60: [2, 16] }, { 33: [1, 138] }, { 33: [2, 75] }, { 33: [2, 32] }, { 72: [2, 101], 77: [2, 101] }, { 14: [2, 17], 15: [2, 17], 19: [2, 17], 29: [2, 17], 34: [2, 17], 39: [2, 17], 44: [2, 17], 47: [2, 17], 48: [2, 17], 51: [2, 17], 55: [2, 17], 60: [2, 17] }], - defaultActions: { 4: [2, 1], 54: [2, 55], 56: [2, 20], 60: [2, 57], 73: [2, 81], 82: [2, 85], 86: [2, 18], 90: [2, 89], 101: [2, 53], 104: [2, 93], 110: [2, 19], 111: [2, 77], 116: [2, 97], 119: [2, 63], 122: [2, 69], 135: [2, 75], 136: [2, 32] }, - parseError: function parseError(str, hash) { - throw new Error(str); - }, - parse: function parse(input) { - var self = this, - stack = [0], - vstack = [null], - lstack = [], - table = this.table, - yytext = "", - yylineno = 0, - yyleng = 0, - recovering = 0, - TERROR = 2, - EOF = 1; - this.lexer.setInput(input); - this.lexer.yy = this.yy; - this.yy.lexer = this.lexer; - this.yy.parser = this; - if (typeof this.lexer.yylloc == "undefined") this.lexer.yylloc = {}; - var yyloc = this.lexer.yylloc; - lstack.push(yyloc); - var ranges = this.lexer.options && this.lexer.options.ranges; - if (typeof this.yy.parseError === "function") this.parseError = this.yy.parseError; - function popStack(n) { - stack.length = stack.length - 2 * n; - vstack.length = vstack.length - n; - lstack.length = lstack.length - n; - } - function lex() { - var token; - token = self.lexer.lex() || 1; - if (typeof token !== "number") { - token = self.symbols_[token] || token; - } - return token; - } - var symbol, - preErrorSymbol, - state, - action, - a, - r, - yyval = {}, - p, - len, - newState, - expected; - while (true) { - state = stack[stack.length - 1]; - if (this.defaultActions[state]) { - action = this.defaultActions[state]; - } else { - if (symbol === null || typeof symbol == "undefined") { - symbol = lex(); - } - action = table[state] && table[state][symbol]; - } - if (typeof action === "undefined" || !action.length || !action[0]) { - var errStr = ""; - if (!recovering) { - expected = []; - for (p in table[state]) if (this.terminals_[p] && p > 2) { - expected.push("'" + this.terminals_[p] + "'"); - } - if (this.lexer.showPosition) { - errStr = "Parse error on line " + (yylineno + 1) + ":\n" + this.lexer.showPosition() + "\nExpecting " + expected.join(", ") + ", got '" + (this.terminals_[symbol] || symbol) + "'"; - } else { - errStr = "Parse error on line " + (yylineno + 1) + ": Unexpected " + (symbol == 1 ? "end of input" : "'" + (this.terminals_[symbol] || symbol) + "'"); - } - this.parseError(errStr, { text: this.lexer.match, token: this.terminals_[symbol] || symbol, line: this.lexer.yylineno, loc: yyloc, expected: expected }); - } - } - if (action[0] instanceof Array && action.length > 1) { - throw new Error("Parse Error: multiple actions possible at state: " + state + ", token: " + symbol); - } - switch (action[0]) { - case 1: - stack.push(symbol); - vstack.push(this.lexer.yytext); - lstack.push(this.lexer.yylloc); - stack.push(action[1]); - symbol = null; - if (!preErrorSymbol) { - yyleng = this.lexer.yyleng; - yytext = this.lexer.yytext; - yylineno = this.lexer.yylineno; - yyloc = this.lexer.yylloc; - if (recovering > 0) recovering--; - } else { - symbol = preErrorSymbol; - preErrorSymbol = null; - } - break; - case 2: - len = this.productions_[action[1]][1]; - yyval.$ = vstack[vstack.length - len]; - 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 }; - if (ranges) { - yyval._$.range = [lstack[lstack.length - (len || 1)].range[0], lstack[lstack.length - 1].range[1]]; - } - r = this.performAction.call(yyval, yytext, yyleng, yylineno, this.yy, action[1], vstack, lstack); - if (typeof r !== "undefined") { - return r; - } - if (len) { - stack = stack.slice(0, -1 * len * 2); - vstack = vstack.slice(0, -1 * len); - lstack = lstack.slice(0, -1 * len); - } - stack.push(this.productions_[action[1]][0]); - vstack.push(yyval.$); - lstack.push(yyval._$); - newState = table[stack[stack.length - 2]][stack[stack.length - 1]]; - stack.push(newState); - break; - case 3: - return true; - } - } - return true; - } - }; - /* Jison generated lexer */ - var lexer = (function () { - var lexer = { EOF: 1, - parseError: function parseError(str, hash) { - if (this.yy.parser) { - this.yy.parser.parseError(str, hash); - } else { - throw new Error(str); - } - }, - setInput: function setInput(input) { - this._input = input; - this._more = this._less = this.done = false; - this.yylineno = this.yyleng = 0; - this.yytext = this.matched = this.match = ''; - this.conditionStack = ['INITIAL']; - this.yylloc = { first_line: 1, first_column: 0, last_line: 1, last_column: 0 }; - if (this.options.ranges) this.yylloc.range = [0, 0]; - this.offset = 0; - return this; - }, - input: function input() { - var ch = this._input[0]; - this.yytext += ch; - this.yyleng++; - this.offset++; - this.match += ch; - this.matched += ch; - var lines = ch.match(/(?:\r\n?|\n).*/g); - if (lines) { - this.yylineno++; - this.yylloc.last_line++; - } else { - this.yylloc.last_column++; - } - if (this.options.ranges) this.yylloc.range[1]++; - - this._input = this._input.slice(1); - return ch; - }, - unput: function unput(ch) { - var len = ch.length; - var lines = ch.split(/(?:\r\n?|\n)/g); - - this._input = ch + this._input; - this.yytext = this.yytext.substr(0, this.yytext.length - len - 1); - //this.yyleng -= len; - this.offset -= len; - var oldLines = this.match.split(/(?:\r\n?|\n)/g); - this.match = this.match.substr(0, this.match.length - 1); - this.matched = this.matched.substr(0, this.matched.length - 1); - - if (lines.length - 1) this.yylineno -= lines.length - 1; - var r = this.yylloc.range; - - this.yylloc = { first_line: this.yylloc.first_line, - last_line: this.yylineno + 1, - first_column: this.yylloc.first_column, - last_column: lines ? (lines.length === oldLines.length ? this.yylloc.first_column : 0) + oldLines[oldLines.length - lines.length].length - lines[0].length : this.yylloc.first_column - len - }; - - if (this.options.ranges) { - this.yylloc.range = [r[0], r[0] + this.yyleng - len]; - } - return this; - }, - more: function more() { - this._more = true; - return this; - }, - less: function less(n) { - this.unput(this.match.slice(n)); - }, - pastInput: function pastInput() { - var past = this.matched.substr(0, this.matched.length - this.match.length); - return (past.length > 20 ? '...' : '') + past.substr(-20).replace(/\n/g, ""); - }, - upcomingInput: function upcomingInput() { - var next = this.match; - if (next.length < 20) { - next += this._input.substr(0, 20 - next.length); - } - return (next.substr(0, 20) + (next.length > 20 ? '...' : '')).replace(/\n/g, ""); - }, - showPosition: function showPosition() { - var pre = this.pastInput(); - var c = new Array(pre.length + 1).join("-"); - return pre + this.upcomingInput() + "\n" + c + "^"; - }, - next: function next() { - if (this.done) { - return this.EOF; - } - if (!this._input) this.done = true; - - var token, match, tempMatch, index, col, lines; - if (!this._more) { - this.yytext = ''; - this.match = ''; - } - var rules = this._currentRules(); - for (var i = 0; i < rules.length; i++) { - tempMatch = this._input.match(this.rules[rules[i]]); - if (tempMatch && (!match || tempMatch[0].length > match[0].length)) { - match = tempMatch; - index = i; - if (!this.options.flex) break; - } - } - if (match) { - lines = match[0].match(/(?:\r\n?|\n).*/g); - if (lines) this.yylineno += lines.length; - this.yylloc = { first_line: this.yylloc.last_line, - last_line: this.yylineno + 1, - first_column: this.yylloc.last_column, - last_column: lines ? lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + match[0].length }; - this.yytext += match[0]; - this.match += match[0]; - this.matches = match; - this.yyleng = this.yytext.length; - if (this.options.ranges) { - this.yylloc.range = [this.offset, this.offset += this.yyleng]; - } - this._more = false; - this._input = this._input.slice(match[0].length); - this.matched += match[0]; - token = this.performAction.call(this, this.yy, this, rules[index], this.conditionStack[this.conditionStack.length - 1]); - if (this.done && this._input) this.done = false; - if (token) return token;else return; - } - if (this._input === "") { - return this.EOF; - } else { - return this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. Unrecognized text.\n' + this.showPosition(), { text: "", token: null, line: this.yylineno }); - } - }, - lex: function lex() { - var r = this.next(); - if (typeof r !== 'undefined') { - return r; - } else { - return this.lex(); - } - }, - begin: function begin(condition) { - this.conditionStack.push(condition); - }, - popState: function popState() { - return this.conditionStack.pop(); - }, - _currentRules: function _currentRules() { - return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules; - }, - topState: function topState() { - return this.conditionStack[this.conditionStack.length - 2]; - }, - pushState: function begin(condition) { - this.begin(condition); - } }; - lexer.options = {}; - lexer.performAction = function anonymous(yy, yy_, $avoiding_name_collisions, YY_START) { - - function strip(start, end) { - return yy_.yytext = yy_.yytext.substring(start, yy_.yyleng - end + start); - } - - var YYSTATE = YY_START; - switch ($avoiding_name_collisions) { - case 0: - if (yy_.yytext.slice(-2) === "\\\\") { - strip(0, 1); - this.begin("mu"); - } else if (yy_.yytext.slice(-1) === "\\") { - strip(0, 1); - this.begin("emu"); - } else { - this.begin("mu"); - } - if (yy_.yytext) return 15; - - break; - case 1: - return 15; - break; - case 2: - this.popState(); - return 15; - - break; - case 3: - this.begin('raw');return 15; - break; - case 4: - this.popState(); - // Should be using `this.topState()` below, but it currently - // returns the second top instead of the first top. Opened an - // issue about it at https://github.com/zaach/jison/issues/291 - if (this.conditionStack[this.conditionStack.length - 1] === 'raw') { - return 15; - } else { - strip(5, 9); - return 'END_RAW_BLOCK'; - } - - break; - case 5: - return 15; - break; - case 6: - this.popState(); - return 14; - - break; - case 7: - return 65; - break; - case 8: - return 68; - break; - case 9: - return 19; - break; - case 10: - this.popState(); - this.begin('raw'); - return 23; - - break; - case 11: - return 55; - break; - case 12: - return 60; - break; - case 13: - return 29; - break; - case 14: - return 47; - break; - case 15: - this.popState();return 44; - break; - case 16: - this.popState();return 44; - break; - case 17: - return 34; - break; - case 18: - return 39; - break; - case 19: - return 51; - break; - case 20: - return 48; - break; - case 21: - this.unput(yy_.yytext); - this.popState(); - this.begin('com'); - - break; - case 22: - this.popState(); - return 14; - - break; - case 23: - return 48; - break; - case 24: - return 73; - break; - case 25: - return 72; - break; - case 26: - return 72; - break; - case 27: - return 87; - break; - case 28: - // ignore whitespace - break; - case 29: - this.popState();return 54; - break; - case 30: - this.popState();return 33; - break; - case 31: - yy_.yytext = strip(1, 2).replace(/\\"/g, '"');return 80; - break; - case 32: - yy_.yytext = strip(1, 2).replace(/\\'/g, "'");return 80; - break; - case 33: - return 85; - break; - case 34: - return 82; - break; - case 35: - return 82; - break; - case 36: - return 83; - break; - case 37: - return 84; - break; - case 38: - return 81; - break; - case 39: - return 75; - break; - case 40: - return 77; - break; - case 41: - return 72; - break; - case 42: - yy_.yytext = yy_.yytext.replace(/\\([\\\]])/g, '$1');return 72; - break; - case 43: - return 'INVALID'; - break; - case 44: - return 5; - break; - } - }; - lexer.rules = [/^(?:[^\x00]*?(?=(\{\{)))/, /^(?:[^\x00]+)/, /^(?:[^\x00]{2,}?(?=(\{\{|\\\{\{|\\\\\{\{|$)))/, /^(?:\{\{\{\{(?=[^\/]))/, /^(?:\{\{\{\{\/[^\s!"#%-,\.\/;->@\[-\^`\{-~]+(?=[=}\s\/.])\}\}\}\})/, /^(?:[^\x00]+?(?=(\{\{\{\{)))/, /^(?:[\s\S]*?--(~)?\}\})/, /^(?:\()/, /^(?:\))/, /^(?:\{\{\{\{)/, /^(?:\}\}\}\})/, /^(?:\{\{(~)?>)/, /^(?:\{\{(~)?#>)/, /^(?:\{\{(~)?#\*?)/, /^(?:\{\{(~)?\/)/, /^(?:\{\{(~)?\^\s*(~)?\}\})/, /^(?:\{\{(~)?\s*else\s*(~)?\}\})/, /^(?:\{\{(~)?\^)/, /^(?:\{\{(~)?\s*else\b)/, /^(?:\{\{(~)?\{)/, /^(?:\{\{(~)?&)/, /^(?:\{\{(~)?!--)/, /^(?:\{\{(~)?![\s\S]*?\}\})/, /^(?:\{\{(~)?\*?)/, /^(?:=)/, /^(?:\.\.)/, /^(?:\.(?=([=~}\s\/.)|])))/, /^(?:[\/.])/, /^(?:\s+)/, /^(?:\}(~)?\}\})/, /^(?:(~)?\}\})/, /^(?:"(\\["]|[^"])*")/, /^(?:'(\\[']|[^'])*')/, /^(?:@)/, /^(?:true(?=([~}\s)])))/, /^(?:false(?=([~}\s)])))/, /^(?:undefined(?=([~}\s)])))/, /^(?:null(?=([~}\s)])))/, /^(?:-?[0-9]+(?:\.[0-9]+)?(?=([~}\s)])))/, /^(?:as\s+\|)/, /^(?:\|)/, /^(?:([^\s!"#%-,\.\/;->@\[-\^`\{-~]+(?=([=~}\s\/.)|]))))/, /^(?:\[(\\\]|[^\]])*\])/, /^(?:.)/, /^(?:$)/]; - lexer.conditions = { "mu": { "rules": [7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44], "inclusive": false }, "emu": { "rules": [2], "inclusive": false }, "com": { "rules": [6], "inclusive": false }, "raw": { "rules": [3, 4, 5], "inclusive": false }, "INITIAL": { "rules": [0, 1, 44], "inclusive": true } }; - return lexer; - })(); - parser.lexer = lexer; - function Parser() { - this.yy = {}; - }Parser.prototype = parser;parser.Parser = Parser; - return new Parser(); - })();exports["default"] = handlebars; - module.exports = exports["default"]; - -/***/ }), -/* 48 */ -/***/ (function(module, exports, __webpack_require__) { - - 'use strict'; - - var _interopRequireDefault = __webpack_require__(1)['default']; - - exports.__esModule = true; - - var _visitor = __webpack_require__(49); - - var _visitor2 = _interopRequireDefault(_visitor); - - function WhitespaceControl() { - var options = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0]; - - this.options = options; - } - WhitespaceControl.prototype = new _visitor2['default'](); - - WhitespaceControl.prototype.Program = function (program) { - var doStandalone = !this.options.ignoreStandalone; - - var isRoot = !this.isRootSeen; - this.isRootSeen = true; - - var body = program.body; - for (var i = 0, l = body.length; i < l; i++) { - var current = body[i], - strip = this.accept(current); - - if (!strip) { - continue; - } - - var _isPrevWhitespace = isPrevWhitespace(body, i, isRoot), - _isNextWhitespace = isNextWhitespace(body, i, isRoot), - openStandalone = strip.openStandalone && _isPrevWhitespace, - closeStandalone = strip.closeStandalone && _isNextWhitespace, - inlineStandalone = strip.inlineStandalone && _isPrevWhitespace && _isNextWhitespace; - - if (strip.close) { - omitRight(body, i, true); - } - if (strip.open) { - omitLeft(body, i, true); - } - - if (doStandalone && inlineStandalone) { - omitRight(body, i); - - if (omitLeft(body, i)) { - // If we are on a standalone node, save the indent info for partials - if (current.type === 'PartialStatement') { - // Pull out the whitespace from the final line - current.indent = /([ \t]+$)/.exec(body[i - 1].original)[1]; - } - } - } - if (doStandalone && openStandalone) { - omitRight((current.program || current.inverse).body); - - // Strip out the previous content node if it's whitespace only - omitLeft(body, i); - } - if (doStandalone && closeStandalone) { - // Always strip the next node - omitRight(body, i); - - omitLeft((current.inverse || current.program).body); - } - } - - return program; - }; - - WhitespaceControl.prototype.BlockStatement = WhitespaceControl.prototype.DecoratorBlock = WhitespaceControl.prototype.PartialBlockStatement = function (block) { - this.accept(block.program); - this.accept(block.inverse); - - // Find the inverse program that is involed with whitespace stripping. - var program = block.program || block.inverse, - inverse = block.program && block.inverse, - firstInverse = inverse, - lastInverse = inverse; - - if (inverse && inverse.chained) { - firstInverse = inverse.body[0].program; - - // Walk the inverse chain to find the last inverse that is actually in the chain. - while (lastInverse.chained) { - lastInverse = lastInverse.body[lastInverse.body.length - 1].program; - } - } - - var strip = { - open: block.openStrip.open, - close: block.closeStrip.close, - - // Determine the standalone candiacy. Basically flag our content as being possibly standalone - // so our parent can determine if we actually are standalone - openStandalone: isNextWhitespace(program.body), - closeStandalone: isPrevWhitespace((firstInverse || program).body) - }; - - if (block.openStrip.close) { - omitRight(program.body, null, true); - } - - if (inverse) { - var inverseStrip = block.inverseStrip; - - if (inverseStrip.open) { - omitLeft(program.body, null, true); - } - - if (inverseStrip.close) { - omitRight(firstInverse.body, null, true); - } - if (block.closeStrip.open) { - omitLeft(lastInverse.body, null, true); - } - - // Find standalone else statments - if (!this.options.ignoreStandalone && isPrevWhitespace(program.body) && isNextWhitespace(firstInverse.body)) { - omitLeft(program.body); - omitRight(firstInverse.body); - } - } else if (block.closeStrip.open) { - omitLeft(program.body, null, true); - } - - return strip; - }; - - WhitespaceControl.prototype.Decorator = WhitespaceControl.prototype.MustacheStatement = function (mustache) { - return mustache.strip; - }; - - WhitespaceControl.prototype.PartialStatement = WhitespaceControl.prototype.CommentStatement = function (node) { - /* istanbul ignore next */ - var strip = node.strip || {}; - return { - inlineStandalone: true, - open: strip.open, - close: strip.close - }; - }; - - function isPrevWhitespace(body, i, isRoot) { - if (i === undefined) { - i = body.length; - } - - // Nodes that end with newlines are considered whitespace (but are special - // cased for strip operations) - var prev = body[i - 1], - sibling = body[i - 2]; - if (!prev) { - return isRoot; - } - - if (prev.type === 'ContentStatement') { - return (sibling || !isRoot ? /\r?\n\s*?$/ : /(^|\r?\n)\s*?$/).test(prev.original); - } - } - function isNextWhitespace(body, i, isRoot) { - if (i === undefined) { - i = -1; - } - - var next = body[i + 1], - sibling = body[i + 2]; - if (!next) { - return isRoot; - } - - if (next.type === 'ContentStatement') { - return (sibling || !isRoot ? /^\s*?\r?\n/ : /^\s*?(\r?\n|$)/).test(next.original); - } - } - - // Marks the node to the right of the position as omitted. - // I.e. {{foo}}' ' will mark the ' ' node as omitted. - // - // If i is undefined, then the first child will be marked as such. - // - // If mulitple is truthy then all whitespace will be stripped out until non-whitespace - // content is met. - function omitRight(body, i, multiple) { - var current = body[i == null ? 0 : i + 1]; - if (!current || current.type !== 'ContentStatement' || !multiple && current.rightStripped) { - return; - } - - var original = current.value; - current.value = current.value.replace(multiple ? /^\s+/ : /^[ \t]*\r?\n?/, ''); - current.rightStripped = current.value !== original; - } - - // Marks the node to the left of the position as omitted. - // I.e. ' '{{foo}} will mark the ' ' node as omitted. - // - // If i is undefined then the last child will be marked as such. - // - // If mulitple is truthy then all whitespace will be stripped out until non-whitespace - // content is met. - function omitLeft(body, i, multiple) { - var current = body[i == null ? body.length - 1 : i - 1]; - if (!current || current.type !== 'ContentStatement' || !multiple && current.leftStripped) { - return; - } - - // We omit the last node if it's whitespace only and not preceded by a non-content node. - var original = current.value; - current.value = current.value.replace(multiple ? /\s+$/ : /[ \t]+$/, ''); - current.leftStripped = current.value !== original; - return current.leftStripped; - } - - exports['default'] = WhitespaceControl; - module.exports = exports['default']; - -/***/ }), -/* 49 */ -/***/ (function(module, exports, __webpack_require__) { - - 'use strict'; - - var _interopRequireDefault = __webpack_require__(1)['default']; - - exports.__esModule = true; - - var _exception = __webpack_require__(6); - - var _exception2 = _interopRequireDefault(_exception); - - function Visitor() { - this.parents = []; - } - - Visitor.prototype = { - constructor: Visitor, - mutating: false, - - // Visits a given value. If mutating, will replace the value if necessary. - acceptKey: function acceptKey(node, name) { - var value = this.accept(node[name]); - if (this.mutating) { - // Hacky sanity check: This may have a few false positives for type for the helper - // methods but will generally do the right thing without a lot of overhead. - if (value && !Visitor.prototype[value.type]) { - throw new _exception2['default']('Unexpected node type "' + value.type + '" found when accepting ' + name + ' on ' + node.type); - } - node[name] = value; - } - }, - - // Performs an accept operation with added sanity check to ensure - // required keys are not removed. - acceptRequired: function acceptRequired(node, name) { - this.acceptKey(node, name); - - if (!node[name]) { - throw new _exception2['default'](node.type + ' requires ' + name); - } - }, - - // Traverses a given array. If mutating, empty respnses will be removed - // for child elements. - acceptArray: function acceptArray(array) { - for (var i = 0, l = array.length; i < l; i++) { - this.acceptKey(array, i); - - if (!array[i]) { - array.splice(i, 1); - i--; - l--; - } - } - }, - - accept: function accept(object) { - if (!object) { - return; - } - - /* istanbul ignore next: Sanity code */ - if (!this[object.type]) { - throw new _exception2['default']('Unknown type: ' + object.type, object); - } - - if (this.current) { - this.parents.unshift(this.current); - } - this.current = object; - - var ret = this[object.type](object); - - this.current = this.parents.shift(); - - if (!this.mutating || ret) { - return ret; - } else if (ret !== false) { - return object; - } - }, - - Program: function Program(program) { - this.acceptArray(program.body); - }, - - MustacheStatement: visitSubExpression, - Decorator: visitSubExpression, - - BlockStatement: visitBlock, - DecoratorBlock: visitBlock, - - PartialStatement: visitPartial, - PartialBlockStatement: function PartialBlockStatement(partial) { - visitPartial.call(this, partial); - - this.acceptKey(partial, 'program'); - }, - - ContentStatement: function ContentStatement() /* content */{}, - CommentStatement: function CommentStatement() /* comment */{}, - - SubExpression: visitSubExpression, - - PathExpression: function PathExpression() /* path */{}, - - StringLiteral: function StringLiteral() /* string */{}, - NumberLiteral: function NumberLiteral() /* number */{}, - BooleanLiteral: function BooleanLiteral() /* bool */{}, - UndefinedLiteral: function UndefinedLiteral() /* literal */{}, - NullLiteral: function NullLiteral() /* literal */{}, - - Hash: function Hash(hash) { - this.acceptArray(hash.pairs); - }, - HashPair: function HashPair(pair) { - this.acceptRequired(pair, 'value'); - } - }; - - function visitSubExpression(mustache) { - this.acceptRequired(mustache, 'path'); - this.acceptArray(mustache.params); - this.acceptKey(mustache, 'hash'); - } - function visitBlock(block) { - visitSubExpression.call(this, block); - - this.acceptKey(block, 'program'); - this.acceptKey(block, 'inverse'); - } - function visitPartial(partial) { - this.acceptRequired(partial, 'name'); - this.acceptArray(partial.params); - this.acceptKey(partial, 'hash'); - } - - exports['default'] = Visitor; - module.exports = exports['default']; - -/***/ }), -/* 50 */ -/***/ (function(module, exports, __webpack_require__) { - - 'use strict'; - - var _interopRequireDefault = __webpack_require__(1)['default']; - - exports.__esModule = true; - exports.SourceLocation = SourceLocation; - exports.id = id; - exports.stripFlags = stripFlags; - exports.stripComment = stripComment; - exports.preparePath = preparePath; - exports.prepareMustache = prepareMustache; - exports.prepareRawBlock = prepareRawBlock; - exports.prepareBlock = prepareBlock; - exports.prepareProgram = prepareProgram; - exports.preparePartialBlock = preparePartialBlock; - - var _exception = __webpack_require__(6); - - var _exception2 = _interopRequireDefault(_exception); - - function validateClose(open, close) { - close = close.path ? close.path.original : close; - - if (open.path.original !== close) { - var errorNode = { loc: open.path.loc }; - - throw new _exception2['default'](open.path.original + " doesn't match " + close, errorNode); - } - } - - function SourceLocation(source, locInfo) { - this.source = source; - this.start = { - line: locInfo.first_line, - column: locInfo.first_column - }; - this.end = { - line: locInfo.last_line, - column: locInfo.last_column - }; - } - - function id(token) { - if (/^\[.*\]$/.test(token)) { - return token.substring(1, token.length - 1); - } else { - return token; - } - } - - function stripFlags(open, close) { - return { - open: open.charAt(2) === '~', - close: close.charAt(close.length - 3) === '~' - }; - } - - function stripComment(comment) { - return comment.replace(/^\{\{~?!-?-?/, '').replace(/-?-?~?\}\}$/, ''); - } - - function preparePath(data, parts, loc) { - loc = this.locInfo(loc); - - var original = data ? '@' : '', - dig = [], - depth = 0; - - for (var i = 0, l = parts.length; i < l; i++) { - var part = parts[i].part, - - // If we have [] syntax then we do not treat path references as operators, - // i.e. foo.[this] resolves to approximately context.foo['this'] - isLiteral = parts[i].original !== part; - original += (parts[i].separator || '') + part; - - if (!isLiteral && (part === '..' || part === '.' || part === 'this')) { - if (dig.length > 0) { - throw new _exception2['default']('Invalid path: ' + original, { loc: loc }); - } else if (part === '..') { - depth++; - } - } else { - dig.push(part); - } - } - - return { - type: 'PathExpression', - data: data, - depth: depth, - parts: dig, - original: original, - loc: loc - }; - } - - function prepareMustache(path, params, hash, open, strip, locInfo) { - // Must use charAt to support IE pre-10 - var escapeFlag = open.charAt(3) || open.charAt(2), - escaped = escapeFlag !== '{' && escapeFlag !== '&'; - - var decorator = /\*/.test(open); - return { - type: decorator ? 'Decorator' : 'MustacheStatement', - path: path, - params: params, - hash: hash, - escaped: escaped, - strip: strip, - loc: this.locInfo(locInfo) - }; - } - - function prepareRawBlock(openRawBlock, contents, close, locInfo) { - validateClose(openRawBlock, close); - - locInfo = this.locInfo(locInfo); - var program = { - type: 'Program', - body: contents, - strip: {}, - loc: locInfo - }; - - return { - type: 'BlockStatement', - path: openRawBlock.path, - params: openRawBlock.params, - hash: openRawBlock.hash, - program: program, - openStrip: {}, - inverseStrip: {}, - closeStrip: {}, - loc: locInfo - }; - } - - function prepareBlock(openBlock, program, inverseAndProgram, close, inverted, locInfo) { - if (close && close.path) { - validateClose(openBlock, close); - } - - var decorator = /\*/.test(openBlock.open); - - program.blockParams = openBlock.blockParams; - - var inverse = undefined, - inverseStrip = undefined; - - if (inverseAndProgram) { - if (decorator) { - throw new _exception2['default']('Unexpected inverse block on decorator', inverseAndProgram); - } - - if (inverseAndProgram.chain) { - inverseAndProgram.program.body[0].closeStrip = close.strip; - } - - inverseStrip = inverseAndProgram.strip; - inverse = inverseAndProgram.program; - } - - if (inverted) { - inverted = inverse; - inverse = program; - program = inverted; - } - - return { - type: decorator ? 'DecoratorBlock' : 'BlockStatement', - path: openBlock.path, - params: openBlock.params, - hash: openBlock.hash, - program: program, - inverse: inverse, - openStrip: openBlock.strip, - inverseStrip: inverseStrip, - closeStrip: close && close.strip, - loc: this.locInfo(locInfo) - }; - } - - function prepareProgram(statements, loc) { - if (!loc && statements.length) { - var firstLoc = statements[0].loc, - lastLoc = statements[statements.length - 1].loc; - - /* istanbul ignore else */ - if (firstLoc && lastLoc) { - loc = { - source: firstLoc.source, - start: { - line: firstLoc.start.line, - column: firstLoc.start.column - }, - end: { - line: lastLoc.end.line, - column: lastLoc.end.column - } - }; - } - } - - return { - type: 'Program', - body: statements, - strip: {}, - loc: loc - }; - } - - function preparePartialBlock(open, program, close, locInfo) { - validateClose(open, close); - - return { - type: 'PartialBlockStatement', - name: open.path, - params: open.params, - hash: open.hash, - program: program, - openStrip: open.strip, - closeStrip: close && close.strip, - loc: this.locInfo(locInfo) - }; - } - -/***/ }), -/* 51 */ -/***/ (function(module, exports, __webpack_require__) { - - /* eslint-disable new-cap */ - - 'use strict'; - - var _Object$create = __webpack_require__(34)['default']; - - var _interopRequireDefault = __webpack_require__(1)['default']; - - exports.__esModule = true; - exports.Compiler = Compiler; - exports.precompile = precompile; - exports.compile = compile; - - var _exception = __webpack_require__(6); - - var _exception2 = _interopRequireDefault(_exception); - - var _utils = __webpack_require__(5); - - var _ast = __webpack_require__(45); - - var _ast2 = _interopRequireDefault(_ast); - - var slice = [].slice; - - function Compiler() {} - - // the foundHelper register will disambiguate helper lookup from finding a - // function in a context. This is necessary for mustache compatibility, which - // requires that context functions in blocks are evaluated by blockHelperMissing, - // and then proceed as if the resulting value was provided to blockHelperMissing. - - Compiler.prototype = { - compiler: Compiler, - - equals: function equals(other) { - var len = this.opcodes.length; - if (other.opcodes.length !== len) { - return false; - } - - for (var i = 0; i < len; i++) { - var opcode = this.opcodes[i], - otherOpcode = other.opcodes[i]; - if (opcode.opcode !== otherOpcode.opcode || !argEquals(opcode.args, otherOpcode.args)) { - return false; - } - } - - // We know that length is the same between the two arrays because they are directly tied - // to the opcode behavior above. - len = this.children.length; - for (var i = 0; i < len; i++) { - if (!this.children[i].equals(other.children[i])) { - return false; - } - } - - return true; - }, - - guid: 0, - - compile: function compile(program, options) { - this.sourceNode = []; - this.opcodes = []; - this.children = []; - this.options = options; - this.stringParams = options.stringParams; - this.trackIds = options.trackIds; - - options.blockParams = options.blockParams || []; - - options.knownHelpers = _utils.extend(_Object$create(null), { - helperMissing: true, - blockHelperMissing: true, - each: true, - 'if': true, - unless: true, - 'with': true, - log: true, - lookup: true - }, options.knownHelpers); - - return this.accept(program); - }, - - compileProgram: function compileProgram(program) { - var childCompiler = new this.compiler(), - // eslint-disable-line new-cap - result = childCompiler.compile(program, this.options), - guid = this.guid++; - - this.usePartial = this.usePartial || result.usePartial; - - this.children[guid] = result; - this.useDepths = this.useDepths || result.useDepths; - - return guid; - }, - - accept: function accept(node) { - /* istanbul ignore next: Sanity code */ - if (!this[node.type]) { - throw new _exception2['default']('Unknown type: ' + node.type, node); - } - - this.sourceNode.unshift(node); - var ret = this[node.type](node); - this.sourceNode.shift(); - return ret; - }, - - Program: function Program(program) { - this.options.blockParams.unshift(program.blockParams); - - var body = program.body, - bodyLength = body.length; - for (var i = 0; i < bodyLength; i++) { - this.accept(body[i]); - } - - this.options.blockParams.shift(); - - this.isSimple = bodyLength === 1; - this.blockParams = program.blockParams ? program.blockParams.length : 0; - - return this; - }, - - BlockStatement: function BlockStatement(block) { - transformLiteralToPath(block); - - var program = block.program, - inverse = block.inverse; - - program = program && this.compileProgram(program); - inverse = inverse && this.compileProgram(inverse); - - var type = this.classifySexpr(block); - - if (type === 'helper') { - this.helperSexpr(block, program, inverse); - } else if (type === 'simple') { - this.simpleSexpr(block); - - // now that the simple mustache is resolved, we need to - // evaluate it by executing `blockHelperMissing` - this.opcode('pushProgram', program); - this.opcode('pushProgram', inverse); - this.opcode('emptyHash'); - this.opcode('blockValue', block.path.original); - } else { - this.ambiguousSexpr(block, program, inverse); - - // now that the simple mustache is resolved, we need to - // evaluate it by executing `blockHelperMissing` - this.opcode('pushProgram', program); - this.opcode('pushProgram', inverse); - this.opcode('emptyHash'); - this.opcode('ambiguousBlockValue'); - } - - this.opcode('append'); - }, - - DecoratorBlock: function DecoratorBlock(decorator) { - var program = decorator.program && this.compileProgram(decorator.program); - var params = this.setupFullMustacheParams(decorator, program, undefined), - path = decorator.path; - - this.useDecorators = true; - this.opcode('registerDecorator', params.length, path.original); - }, - - PartialStatement: function PartialStatement(partial) { - this.usePartial = true; - - var program = partial.program; - if (program) { - program = this.compileProgram(partial.program); - } - - var params = partial.params; - if (params.length > 1) { - throw new _exception2['default']('Unsupported number of partial arguments: ' + params.length, partial); - } else if (!params.length) { - if (this.options.explicitPartialContext) { - this.opcode('pushLiteral', 'undefined'); - } else { - params.push({ type: 'PathExpression', parts: [], depth: 0 }); - } - } - - var partialName = partial.name.original, - isDynamic = partial.name.type === 'SubExpression'; - if (isDynamic) { - this.accept(partial.name); - } - - this.setupFullMustacheParams(partial, program, undefined, true); - - var indent = partial.indent || ''; - if (this.options.preventIndent && indent) { - this.opcode('appendContent', indent); - indent = ''; - } - - this.opcode('invokePartial', isDynamic, partialName, indent); - this.opcode('append'); - }, - PartialBlockStatement: function PartialBlockStatement(partialBlock) { - this.PartialStatement(partialBlock); - }, - - MustacheStatement: function MustacheStatement(mustache) { - this.SubExpression(mustache); - - if (mustache.escaped && !this.options.noEscape) { - this.opcode('appendEscaped'); - } else { - this.opcode('append'); - } - }, - Decorator: function Decorator(decorator) { - this.DecoratorBlock(decorator); - }, - - ContentStatement: function ContentStatement(content) { - if (content.value) { - this.opcode('appendContent', content.value); - } - }, - - CommentStatement: function CommentStatement() {}, - - SubExpression: function SubExpression(sexpr) { - transformLiteralToPath(sexpr); - var type = this.classifySexpr(sexpr); - - if (type === 'simple') { - this.simpleSexpr(sexpr); - } else if (type === 'helper') { - this.helperSexpr(sexpr); - } else { - this.ambiguousSexpr(sexpr); - } - }, - ambiguousSexpr: function ambiguousSexpr(sexpr, program, inverse) { - var path = sexpr.path, - name = path.parts[0], - isBlock = program != null || inverse != null; - - this.opcode('getContext', path.depth); - - this.opcode('pushProgram', program); - this.opcode('pushProgram', inverse); - - path.strict = true; - this.accept(path); - - this.opcode('invokeAmbiguous', name, isBlock); - }, - - simpleSexpr: function simpleSexpr(sexpr) { - var path = sexpr.path; - path.strict = true; - this.accept(path); - this.opcode('resolvePossibleLambda'); - }, - - helperSexpr: function helperSexpr(sexpr, program, inverse) { - var params = this.setupFullMustacheParams(sexpr, program, inverse), - path = sexpr.path, - name = path.parts[0]; - - if (this.options.knownHelpers[name]) { - this.opcode('invokeKnownHelper', params.length, name); - } else if (this.options.knownHelpersOnly) { - throw new _exception2['default']('You specified knownHelpersOnly, but used the unknown helper ' + name, sexpr); - } else { - path.strict = true; - path.falsy = true; - - this.accept(path); - this.opcode('invokeHelper', params.length, path.original, _ast2['default'].helpers.simpleId(path)); - } - }, - - PathExpression: function PathExpression(path) { - this.addDepth(path.depth); - this.opcode('getContext', path.depth); - - var name = path.parts[0], - scoped = _ast2['default'].helpers.scopedId(path), - blockParamId = !path.depth && !scoped && this.blockParamIndex(name); - - if (blockParamId) { - this.opcode('lookupBlockParam', blockParamId, path.parts); - } else if (!name) { - // Context reference, i.e. `{{foo .}}` or `{{foo ..}}` - this.opcode('pushContext'); - } else if (path.data) { - this.options.data = true; - this.opcode('lookupData', path.depth, path.parts, path.strict); - } else { - this.opcode('lookupOnContext', path.parts, path.falsy, path.strict, scoped); - } - }, - - StringLiteral: function StringLiteral(string) { - this.opcode('pushString', string.value); - }, - - NumberLiteral: function NumberLiteral(number) { - this.opcode('pushLiteral', number.value); - }, - - BooleanLiteral: function BooleanLiteral(bool) { - this.opcode('pushLiteral', bool.value); - }, - - UndefinedLiteral: function UndefinedLiteral() { - this.opcode('pushLiteral', 'undefined'); - }, - - NullLiteral: function NullLiteral() { - this.opcode('pushLiteral', 'null'); - }, - - Hash: function Hash(hash) { - var pairs = hash.pairs, - i = 0, - l = pairs.length; - - this.opcode('pushHash'); - - for (; i < l; i++) { - this.pushParam(pairs[i].value); - } - while (i--) { - this.opcode('assignToHash', pairs[i].key); - } - this.opcode('popHash'); - }, - - // HELPERS - opcode: function opcode(name) { - this.opcodes.push({ - opcode: name, - args: slice.call(arguments, 1), - loc: this.sourceNode[0].loc - }); - }, - - addDepth: function addDepth(depth) { - if (!depth) { - return; - } - - this.useDepths = true; - }, - - classifySexpr: function classifySexpr(sexpr) { - var isSimple = _ast2['default'].helpers.simpleId(sexpr.path); - - var isBlockParam = isSimple && !!this.blockParamIndex(sexpr.path.parts[0]); - - // a mustache is an eligible helper if: - // * its id is simple (a single part, not `this` or `..`) - var isHelper = !isBlockParam && _ast2['default'].helpers.helperExpression(sexpr); - - // if a mustache is an eligible helper but not a definite - // helper, it is ambiguous, and will be resolved in a later - // pass or at runtime. - var isEligible = !isBlockParam && (isHelper || isSimple); - - // if ambiguous, we can possibly resolve the ambiguity now - // An eligible helper is one that does not have a complex path, i.e. `this.foo`, `../foo` etc. - if (isEligible && !isHelper) { - var _name = sexpr.path.parts[0], - options = this.options; - if (options.knownHelpers[_name]) { - isHelper = true; - } else if (options.knownHelpersOnly) { - isEligible = false; - } - } - - if (isHelper) { - return 'helper'; - } else if (isEligible) { - return 'ambiguous'; - } else { - return 'simple'; - } - }, - - pushParams: function pushParams(params) { - for (var i = 0, l = params.length; i < l; i++) { - this.pushParam(params[i]); - } - }, - - pushParam: function pushParam(val) { - var value = val.value != null ? val.value : val.original || ''; - - if (this.stringParams) { - if (value.replace) { - value = value.replace(/^(\.?\.\/)*/g, '').replace(/\//g, '.'); - } - - if (val.depth) { - this.addDepth(val.depth); - } - this.opcode('getContext', val.depth || 0); - this.opcode('pushStringParam', value, val.type); - - if (val.type === 'SubExpression') { - // SubExpressions get evaluated and passed in - // in string params mode. - this.accept(val); - } - } else { - if (this.trackIds) { - var blockParamIndex = undefined; - if (val.parts && !_ast2['default'].helpers.scopedId(val) && !val.depth) { - blockParamIndex = this.blockParamIndex(val.parts[0]); - } - if (blockParamIndex) { - var blockParamChild = val.parts.slice(1).join('.'); - this.opcode('pushId', 'BlockParam', blockParamIndex, blockParamChild); - } else { - value = val.original || value; - if (value.replace) { - value = value.replace(/^this(?:\.|$)/, '').replace(/^\.\//, '').replace(/^\.$/, ''); - } - - this.opcode('pushId', val.type, value); - } - } - this.accept(val); - } - }, - - setupFullMustacheParams: function setupFullMustacheParams(sexpr, program, inverse, omitEmpty) { - var params = sexpr.params; - this.pushParams(params); - - this.opcode('pushProgram', program); - this.opcode('pushProgram', inverse); - - if (sexpr.hash) { - this.accept(sexpr.hash); - } else { - this.opcode('emptyHash', omitEmpty); - } - - return params; - }, - - blockParamIndex: function blockParamIndex(name) { - for (var depth = 0, len = this.options.blockParams.length; depth < len; depth++) { - var blockParams = this.options.blockParams[depth], - param = blockParams && _utils.indexOf(blockParams, name); - if (blockParams && param >= 0) { - return [depth, param]; - } - } - } - }; - - function precompile(input, options, env) { - if (input == null || typeof input !== 'string' && input.type !== 'Program') { - throw new _exception2['default']('You must pass a string or Handlebars AST to Handlebars.precompile. You passed ' + input); - } - - options = options || {}; - if (!('data' in options)) { - options.data = true; - } - if (options.compat) { - options.useDepths = true; - } - - var ast = env.parse(input, options), - environment = new env.Compiler().compile(ast, options); - return new env.JavaScriptCompiler().compile(environment, options); - } - - function compile(input, options, env) { - if (options === undefined) options = {}; - - if (input == null || typeof input !== 'string' && input.type !== 'Program') { - throw new _exception2['default']('You must pass a string or Handlebars AST to Handlebars.compile. You passed ' + input); - } - - options = _utils.extend({}, options); - if (!('data' in options)) { - options.data = true; - } - if (options.compat) { - options.useDepths = true; - } - - var compiled = undefined; - - function compileInput() { - var ast = env.parse(input, options), - environment = new env.Compiler().compile(ast, options), - templateSpec = new env.JavaScriptCompiler().compile(environment, options, undefined, true); - return env.template(templateSpec); - } - - // Template is only compiled on first use and cached after that point. - function ret(context, execOptions) { - if (!compiled) { - compiled = compileInput(); - } - return compiled.call(this, context, execOptions); - } - ret._setup = function (setupOptions) { - if (!compiled) { - compiled = compileInput(); - } - return compiled._setup(setupOptions); - }; - ret._child = function (i, data, blockParams, depths) { - if (!compiled) { - compiled = compileInput(); - } - return compiled._child(i, data, blockParams, depths); - }; - return ret; - } - - function argEquals(a, b) { - if (a === b) { - return true; - } - - if (_utils.isArray(a) && _utils.isArray(b) && a.length === b.length) { - for (var i = 0; i < a.length; i++) { - if (!argEquals(a[i], b[i])) { - return false; - } - } - return true; - } - } - - function transformLiteralToPath(sexpr) { - if (!sexpr.path.parts) { - var literal = sexpr.path; - // Casting to string here to make false and 0 literal values play nicely with the rest - // of the system. - sexpr.path = { - type: 'PathExpression', - data: false, - depth: 0, - parts: [literal.original + ''], - original: literal.original + '', - loc: literal.loc - }; - } - } - -/***/ }), -/* 52 */ -/***/ (function(module, exports, __webpack_require__) { - - 'use strict'; - - var _Object$keys = __webpack_require__(13)['default']; - - var _interopRequireDefault = __webpack_require__(1)['default']; - - exports.__esModule = true; - - var _base = __webpack_require__(4); - - var _exception = __webpack_require__(6); - - var _exception2 = _interopRequireDefault(_exception); - - var _utils = __webpack_require__(5); - - var _codeGen = __webpack_require__(53); - - var _codeGen2 = _interopRequireDefault(_codeGen); - - function Literal(value) { - this.value = value; - } - - function JavaScriptCompiler() {} - - JavaScriptCompiler.prototype = { - // PUBLIC API: You can override these methods in a subclass to provide - // alternative compiled forms for name lookup and buffering semantics - nameLookup: function nameLookup(parent, name /*, type */) { - return this.internalNameLookup(parent, name); - }, - depthedLookup: function depthedLookup(name) { - return [this.aliasable('container.lookup'), '(depths, ', JSON.stringify(name), ')']; - }, - - compilerInfo: function compilerInfo() { - var revision = _base.COMPILER_REVISION, - versions = _base.REVISION_CHANGES[revision]; - return [revision, versions]; - }, - - appendToBuffer: function appendToBuffer(source, location, explicit) { - // Force a source as this simplifies the merge logic. - if (!_utils.isArray(source)) { - source = [source]; - } - source = this.source.wrap(source, location); - - if (this.environment.isSimple) { - return ['return ', source, ';']; - } else if (explicit) { - // This is a case where the buffer operation occurs as a child of another - // construct, generally braces. We have to explicitly output these buffer - // operations to ensure that the emitted code goes in the correct location. - return ['buffer += ', source, ';']; - } else { - source.appendToBuffer = true; - return source; - } - }, - - initializeBuffer: function initializeBuffer() { - return this.quotedString(''); - }, - // END PUBLIC API - internalNameLookup: function internalNameLookup(parent, name) { - this.lookupPropertyFunctionIsUsed = true; - return ['lookupProperty(', parent, ',', JSON.stringify(name), ')']; - }, - - lookupPropertyFunctionIsUsed: false, - - compile: function compile(environment, options, context, asObject) { - this.environment = environment; - this.options = options; - this.stringParams = this.options.stringParams; - this.trackIds = this.options.trackIds; - this.precompile = !asObject; - - this.name = this.environment.name; - this.isChild = !!context; - this.context = context || { - decorators: [], - programs: [], - environments: [] - }; - - this.preamble(); - - this.stackSlot = 0; - this.stackVars = []; - this.aliases = {}; - this.registers = { list: [] }; - this.hashes = []; - this.compileStack = []; - this.inlineStack = []; - this.blockParams = []; - - this.compileChildren(environment, options); - - this.useDepths = this.useDepths || environment.useDepths || environment.useDecorators || this.options.compat; - this.useBlockParams = this.useBlockParams || environment.useBlockParams; - - var opcodes = environment.opcodes, - opcode = undefined, - firstLoc = undefined, - i = undefined, - l = undefined; - - for (i = 0, l = opcodes.length; i < l; i++) { - opcode = opcodes[i]; - - this.source.currentLocation = opcode.loc; - firstLoc = firstLoc || opcode.loc; - this[opcode.opcode].apply(this, opcode.args); - } - - // Flush any trailing content that might be pending. - this.source.currentLocation = firstLoc; - this.pushSource(''); - - /* istanbul ignore next */ - if (this.stackSlot || this.inlineStack.length || this.compileStack.length) { - throw new _exception2['default']('Compile completed with content left on stack'); - } - - if (!this.decorators.isEmpty()) { - this.useDecorators = true; - - this.decorators.prepend(['var decorators = container.decorators, ', this.lookupPropertyFunctionVarDeclaration(), ';\n']); - this.decorators.push('return fn;'); - - if (asObject) { - this.decorators = Function.apply(this, ['fn', 'props', 'container', 'depth0', 'data', 'blockParams', 'depths', this.decorators.merge()]); - } else { - this.decorators.prepend('function(fn, props, container, depth0, data, blockParams, depths) {\n'); - this.decorators.push('}\n'); - this.decorators = this.decorators.merge(); - } - } else { - this.decorators = undefined; - } - - var fn = this.createFunctionContext(asObject); - if (!this.isChild) { - var ret = { - compiler: this.compilerInfo(), - main: fn - }; - - if (this.decorators) { - ret.main_d = this.decorators; // eslint-disable-line camelcase - ret.useDecorators = true; - } - - var _context = this.context; - var programs = _context.programs; - var decorators = _context.decorators; - - for (i = 0, l = programs.length; i < l; i++) { - if (programs[i]) { - ret[i] = programs[i]; - if (decorators[i]) { - ret[i + '_d'] = decorators[i]; - ret.useDecorators = true; - } - } - } - - if (this.environment.usePartial) { - ret.usePartial = true; - } - if (this.options.data) { - ret.useData = true; - } - if (this.useDepths) { - ret.useDepths = true; - } - if (this.useBlockParams) { - ret.useBlockParams = true; - } - if (this.options.compat) { - ret.compat = true; - } - - if (!asObject) { - ret.compiler = JSON.stringify(ret.compiler); - - this.source.currentLocation = { start: { line: 1, column: 0 } }; - ret = this.objectLiteral(ret); - - if (options.srcName) { - ret = ret.toStringWithSourceMap({ file: options.destName }); - ret.map = ret.map && ret.map.toString(); - } else { - ret = ret.toString(); - } - } else { - ret.compilerOptions = this.options; - } - - return ret; - } else { - return fn; - } - }, - - preamble: function preamble() { - // track the last context pushed into place to allow skipping the - // getContext opcode when it would be a noop - this.lastContext = 0; - this.source = new _codeGen2['default'](this.options.srcName); - this.decorators = new _codeGen2['default'](this.options.srcName); - }, - - createFunctionContext: function createFunctionContext(asObject) { - // istanbul ignore next - - var _this = this; - - var varDeclarations = ''; - - var locals = this.stackVars.concat(this.registers.list); - if (locals.length > 0) { - varDeclarations += ', ' + locals.join(', '); - } - - // Generate minimizer alias mappings - // - // When using true SourceNodes, this will update all references to the given alias - // as the source nodes are reused in situ. For the non-source node compilation mode, - // aliases will not be used, but this case is already being run on the client and - // we aren't concern about minimizing the template size. - var aliasCount = 0; - _Object$keys(this.aliases).forEach(function (alias) { - var node = _this.aliases[alias]; - if (node.children && node.referenceCount > 1) { - varDeclarations += ', alias' + ++aliasCount + '=' + alias; - node.children[0] = 'alias' + aliasCount; - } - }); - - if (this.lookupPropertyFunctionIsUsed) { - varDeclarations += ', ' + this.lookupPropertyFunctionVarDeclaration(); - } - - var params = ['container', 'depth0', 'helpers', 'partials', 'data']; - - if (this.useBlockParams || this.useDepths) { - params.push('blockParams'); - } - if (this.useDepths) { - params.push('depths'); - } - - // Perform a second pass over the output to merge content when possible - var source = this.mergeSource(varDeclarations); - - if (asObject) { - params.push(source); - - return Function.apply(this, params); - } else { - return this.source.wrap(['function(', params.join(','), ') {\n ', source, '}']); - } - }, - mergeSource: function mergeSource(varDeclarations) { - var isSimple = this.environment.isSimple, - appendOnly = !this.forceBuffer, - appendFirst = undefined, - sourceSeen = undefined, - bufferStart = undefined, - bufferEnd = undefined; - this.source.each(function (line) { - if (line.appendToBuffer) { - if (bufferStart) { - line.prepend(' + '); - } else { - bufferStart = line; - } - bufferEnd = line; - } else { - if (bufferStart) { - if (!sourceSeen) { - appendFirst = true; - } else { - bufferStart.prepend('buffer += '); - } - bufferEnd.add(';'); - bufferStart = bufferEnd = undefined; - } - - sourceSeen = true; - if (!isSimple) { - appendOnly = false; - } - } - }); - - if (appendOnly) { - if (bufferStart) { - bufferStart.prepend('return '); - bufferEnd.add(';'); - } else if (!sourceSeen) { - this.source.push('return "";'); - } - } else { - varDeclarations += ', buffer = ' + (appendFirst ? '' : this.initializeBuffer()); - - if (bufferStart) { - bufferStart.prepend('return buffer + '); - bufferEnd.add(';'); - } else { - this.source.push('return buffer;'); - } - } - - if (varDeclarations) { - this.source.prepend('var ' + varDeclarations.substring(2) + (appendFirst ? '' : ';\n')); - } - - return this.source.merge(); - }, - - lookupPropertyFunctionVarDeclaration: function lookupPropertyFunctionVarDeclaration() { - return '\n lookupProperty = container.lookupProperty || function(parent, propertyName) {\n if (Object.prototype.hasOwnProperty.call(parent, propertyName)) {\n return parent[propertyName];\n }\n return undefined\n }\n '.trim(); - }, - - // [blockValue] - // - // On stack, before: hash, inverse, program, value - // On stack, after: return value of blockHelperMissing - // - // The purpose of this opcode is to take a block of the form - // `{{#this.foo}}...{{/this.foo}}`, resolve the value of `foo`, and - // replace it on the stack with the result of properly - // invoking blockHelperMissing. - blockValue: function blockValue(name) { - var blockHelperMissing = this.aliasable('container.hooks.blockHelperMissing'), - params = [this.contextName(0)]; - this.setupHelperArgs(name, 0, params); - - var blockName = this.popStack(); - params.splice(1, 0, blockName); - - this.push(this.source.functionCall(blockHelperMissing, 'call', params)); - }, - - // [ambiguousBlockValue] - // - // On stack, before: hash, inverse, program, value - // Compiler value, before: lastHelper=value of last found helper, if any - // On stack, after, if no lastHelper: same as [blockValue] - // On stack, after, if lastHelper: value - ambiguousBlockValue: function ambiguousBlockValue() { - // We're being a bit cheeky and reusing the options value from the prior exec - var blockHelperMissing = this.aliasable('container.hooks.blockHelperMissing'), - params = [this.contextName(0)]; - this.setupHelperArgs('', 0, params, true); - - this.flushInline(); - - var current = this.topStack(); - params.splice(1, 0, current); - - this.pushSource(['if (!', this.lastHelper, ') { ', current, ' = ', this.source.functionCall(blockHelperMissing, 'call', params), '}']); - }, - - // [appendContent] - // - // On stack, before: ... - // On stack, after: ... - // - // Appends the string value of `content` to the current buffer - appendContent: function appendContent(content) { - if (this.pendingContent) { - content = this.pendingContent + content; - } else { - this.pendingLocation = this.source.currentLocation; - } - - this.pendingContent = content; - }, - - // [append] - // - // On stack, before: value, ... - // On stack, after: ... - // - // Coerces `value` to a String and appends it to the current buffer. - // - // If `value` is truthy, or 0, it is coerced into a string and appended - // Otherwise, the empty string is appended - append: function append() { - if (this.isInline()) { - this.replaceStack(function (current) { - return [' != null ? ', current, ' : ""']; - }); - - this.pushSource(this.appendToBuffer(this.popStack())); - } else { - var local = this.popStack(); - this.pushSource(['if (', local, ' != null) { ', this.appendToBuffer(local, undefined, true), ' }']); - if (this.environment.isSimple) { - this.pushSource(['else { ', this.appendToBuffer("''", undefined, true), ' }']); - } - } - }, - - // [appendEscaped] - // - // On stack, before: value, ... - // On stack, after: ... - // - // Escape `value` and append it to the buffer - appendEscaped: function appendEscaped() { - this.pushSource(this.appendToBuffer([this.aliasable('container.escapeExpression'), '(', this.popStack(), ')'])); - }, - - // [getContext] - // - // On stack, before: ... - // On stack, after: ... - // Compiler value, after: lastContext=depth - // - // Set the value of the `lastContext` compiler value to the depth - getContext: function getContext(depth) { - this.lastContext = depth; - }, - - // [pushContext] - // - // On stack, before: ... - // On stack, after: currentContext, ... - // - // Pushes the value of the current context onto the stack. - pushContext: function pushContext() { - this.pushStackLiteral(this.contextName(this.lastContext)); - }, - - // [lookupOnContext] - // - // On stack, before: ... - // On stack, after: currentContext[name], ... - // - // Looks up the value of `name` on the current context and pushes - // it onto the stack. - lookupOnContext: function lookupOnContext(parts, falsy, strict, scoped) { - var i = 0; - - if (!scoped && this.options.compat && !this.lastContext) { - // The depthed query is expected to handle the undefined logic for the root level that - // is implemented below, so we evaluate that directly in compat mode - this.push(this.depthedLookup(parts[i++])); - } else { - this.pushContext(); - } - - this.resolvePath('context', parts, i, falsy, strict); - }, - - // [lookupBlockParam] - // - // On stack, before: ... - // On stack, after: blockParam[name], ... - // - // Looks up the value of `parts` on the given block param and pushes - // it onto the stack. - lookupBlockParam: function lookupBlockParam(blockParamId, parts) { - this.useBlockParams = true; - - this.push(['blockParams[', blockParamId[0], '][', blockParamId[1], ']']); - this.resolvePath('context', parts, 1); - }, - - // [lookupData] - // - // On stack, before: ... - // On stack, after: data, ... - // - // Push the data lookup operator - lookupData: function lookupData(depth, parts, strict) { - if (!depth) { - this.pushStackLiteral('data'); - } else { - this.pushStackLiteral('container.data(data, ' + depth + ')'); - } - - this.resolvePath('data', parts, 0, true, strict); - }, - - resolvePath: function resolvePath(type, parts, i, falsy, strict) { - // istanbul ignore next - - var _this2 = this; - - if (this.options.strict || this.options.assumeObjects) { - this.push(strictLookup(this.options.strict && strict, this, parts, type)); - return; - } - - var len = parts.length; - for (; i < len; i++) { - /* eslint-disable no-loop-func */ - this.replaceStack(function (current) { - var lookup = _this2.nameLookup(current, parts[i], type); - // We want to ensure that zero and false are handled properly if the context (falsy flag) - // needs to have the special handling for these values. - if (!falsy) { - return [' != null ? ', lookup, ' : ', current]; - } else { - // Otherwise we can use generic falsy handling - return [' && ', lookup]; - } - }); - /* eslint-enable no-loop-func */ - } - }, - - // [resolvePossibleLambda] - // - // On stack, before: value, ... - // On stack, after: resolved value, ... - // - // If the `value` is a lambda, replace it on the stack by - // the return value of the lambda - resolvePossibleLambda: function resolvePossibleLambda() { - this.push([this.aliasable('container.lambda'), '(', this.popStack(), ', ', this.contextName(0), ')']); - }, - - // [pushStringParam] - // - // On stack, before: ... - // On stack, after: string, currentContext, ... - // - // This opcode is designed for use in string mode, which - // provides the string value of a parameter along with its - // depth rather than resolving it immediately. - pushStringParam: function pushStringParam(string, type) { - this.pushContext(); - this.pushString(type); - - // If it's a subexpression, the string result - // will be pushed after this opcode. - if (type !== 'SubExpression') { - if (typeof string === 'string') { - this.pushString(string); - } else { - this.pushStackLiteral(string); - } - } - }, - - emptyHash: function emptyHash(omitEmpty) { - if (this.trackIds) { - this.push('{}'); // hashIds - } - if (this.stringParams) { - this.push('{}'); // hashContexts - this.push('{}'); // hashTypes - } - this.pushStackLiteral(omitEmpty ? 'undefined' : '{}'); - }, - pushHash: function pushHash() { - if (this.hash) { - this.hashes.push(this.hash); - } - this.hash = { values: {}, types: [], contexts: [], ids: [] }; - }, - popHash: function popHash() { - var hash = this.hash; - this.hash = this.hashes.pop(); - - if (this.trackIds) { - this.push(this.objectLiteral(hash.ids)); - } - if (this.stringParams) { - this.push(this.objectLiteral(hash.contexts)); - this.push(this.objectLiteral(hash.types)); - } - - this.push(this.objectLiteral(hash.values)); - }, - - // [pushString] - // - // On stack, before: ... - // On stack, after: quotedString(string), ... - // - // Push a quoted version of `string` onto the stack - pushString: function pushString(string) { - this.pushStackLiteral(this.quotedString(string)); - }, - - // [pushLiteral] - // - // On stack, before: ... - // On stack, after: value, ... - // - // Pushes a value onto the stack. This operation prevents - // the compiler from creating a temporary variable to hold - // it. - pushLiteral: function pushLiteral(value) { - this.pushStackLiteral(value); - }, - - // [pushProgram] - // - // On stack, before: ... - // On stack, after: program(guid), ... - // - // Push a program expression onto the stack. This takes - // a compile-time guid and converts it into a runtime-accessible - // expression. - pushProgram: function pushProgram(guid) { - if (guid != null) { - this.pushStackLiteral(this.programExpression(guid)); - } else { - this.pushStackLiteral(null); - } - }, - - // [registerDecorator] - // - // On stack, before: hash, program, params..., ... - // On stack, after: ... - // - // Pops off the decorator's parameters, invokes the decorator, - // and inserts the decorator into the decorators list. - registerDecorator: function registerDecorator(paramSize, name) { - var foundDecorator = this.nameLookup('decorators', name, 'decorator'), - options = this.setupHelperArgs(name, paramSize); - - this.decorators.push(['fn = ', this.decorators.functionCall(foundDecorator, '', ['fn', 'props', 'container', options]), ' || fn;']); - }, - - // [invokeHelper] - // - // On stack, before: hash, inverse, program, params..., ... - // On stack, after: result of helper invocation - // - // Pops off the helper's parameters, invokes the helper, - // and pushes the helper's return value onto the stack. - // - // If the helper is not found, `helperMissing` is called. - invokeHelper: function invokeHelper(paramSize, name, isSimple) { - var nonHelper = this.popStack(), - helper = this.setupHelper(paramSize, name); - - var possibleFunctionCalls = []; - - if (isSimple) { - // direct call to helper - possibleFunctionCalls.push(helper.name); - } - // call a function from the input object - possibleFunctionCalls.push(nonHelper); - if (!this.options.strict) { - possibleFunctionCalls.push(this.aliasable('container.hooks.helperMissing')); - } - - var functionLookupCode = ['(', this.itemsSeparatedBy(possibleFunctionCalls, '||'), ')']; - var functionCall = this.source.functionCall(functionLookupCode, 'call', helper.callParams); - this.push(functionCall); - }, - - itemsSeparatedBy: function itemsSeparatedBy(items, separator) { - var result = []; - result.push(items[0]); - for (var i = 1; i < items.length; i++) { - result.push(separator, items[i]); - } - return result; - }, - // [invokeKnownHelper] - // - // On stack, before: hash, inverse, program, params..., ... - // On stack, after: result of helper invocation - // - // This operation is used when the helper is known to exist, - // so a `helperMissing` fallback is not required. - invokeKnownHelper: function invokeKnownHelper(paramSize, name) { - var helper = this.setupHelper(paramSize, name); - this.push(this.source.functionCall(helper.name, 'call', helper.callParams)); - }, - - // [invokeAmbiguous] - // - // On stack, before: hash, inverse, program, params..., ... - // On stack, after: result of disambiguation - // - // This operation is used when an expression like `{{foo}}` - // is provided, but we don't know at compile-time whether it - // is a helper or a path. - // - // This operation emits more code than the other options, - // and can be avoided by passing the `knownHelpers` and - // `knownHelpersOnly` flags at compile-time. - invokeAmbiguous: function invokeAmbiguous(name, helperCall) { - this.useRegister('helper'); - - var nonHelper = this.popStack(); - - this.emptyHash(); - var helper = this.setupHelper(0, name, helperCall); - - var helperName = this.lastHelper = this.nameLookup('helpers', name, 'helper'); - - var lookup = ['(', '(helper = ', helperName, ' || ', nonHelper, ')']; - if (!this.options.strict) { - lookup[0] = '(helper = '; - lookup.push(' != null ? helper : ', this.aliasable('container.hooks.helperMissing')); - } - - this.push(['(', lookup, helper.paramsInit ? ['),(', helper.paramsInit] : [], '),', '(typeof helper === ', this.aliasable('"function"'), ' ? ', this.source.functionCall('helper', 'call', helper.callParams), ' : helper))']); - }, - - // [invokePartial] - // - // On stack, before: context, ... - // On stack after: result of partial invocation - // - // This operation pops off a context, invokes a partial with that context, - // and pushes the result of the invocation back. - invokePartial: function invokePartial(isDynamic, name, indent) { - var params = [], - options = this.setupParams(name, 1, params); - - if (isDynamic) { - name = this.popStack(); - delete options.name; - } - - if (indent) { - options.indent = JSON.stringify(indent); - } - options.helpers = 'helpers'; - options.partials = 'partials'; - options.decorators = 'container.decorators'; - - if (!isDynamic) { - params.unshift(this.nameLookup('partials', name, 'partial')); - } else { - params.unshift(name); - } - - if (this.options.compat) { - options.depths = 'depths'; - } - options = this.objectLiteral(options); - params.push(options); - - this.push(this.source.functionCall('container.invokePartial', '', params)); - }, - - // [assignToHash] - // - // On stack, before: value, ..., hash, ... - // On stack, after: ..., hash, ... - // - // Pops a value off the stack and assigns it to the current hash - assignToHash: function assignToHash(key) { - var value = this.popStack(), - context = undefined, - type = undefined, - id = undefined; - - if (this.trackIds) { - id = this.popStack(); - } - if (this.stringParams) { - type = this.popStack(); - context = this.popStack(); - } - - var hash = this.hash; - if (context) { - hash.contexts[key] = context; - } - if (type) { - hash.types[key] = type; - } - if (id) { - hash.ids[key] = id; - } - hash.values[key] = value; - }, - - pushId: function pushId(type, name, child) { - if (type === 'BlockParam') { - this.pushStackLiteral('blockParams[' + name[0] + '].path[' + name[1] + ']' + (child ? ' + ' + JSON.stringify('.' + child) : '')); - } else if (type === 'PathExpression') { - this.pushString(name); - } else if (type === 'SubExpression') { - this.pushStackLiteral('true'); - } else { - this.pushStackLiteral('null'); - } - }, - - // HELPERS - - compiler: JavaScriptCompiler, - - compileChildren: function compileChildren(environment, options) { - var children = environment.children, - child = undefined, - compiler = undefined; - - for (var i = 0, l = children.length; i < l; i++) { - child = children[i]; - compiler = new this.compiler(); // eslint-disable-line new-cap - - var existing = this.matchExistingProgram(child); - - if (existing == null) { - this.context.programs.push(''); // Placeholder to prevent name conflicts for nested children - var index = this.context.programs.length; - child.index = index; - child.name = 'program' + index; - this.context.programs[index] = compiler.compile(child, options, this.context, !this.precompile); - this.context.decorators[index] = compiler.decorators; - this.context.environments[index] = child; - - this.useDepths = this.useDepths || compiler.useDepths; - this.useBlockParams = this.useBlockParams || compiler.useBlockParams; - child.useDepths = this.useDepths; - child.useBlockParams = this.useBlockParams; - } else { - child.index = existing.index; - child.name = 'program' + existing.index; - - this.useDepths = this.useDepths || existing.useDepths; - this.useBlockParams = this.useBlockParams || existing.useBlockParams; - } - } - }, - matchExistingProgram: function matchExistingProgram(child) { - for (var i = 0, len = this.context.environments.length; i < len; i++) { - var environment = this.context.environments[i]; - if (environment && environment.equals(child)) { - return environment; - } - } - }, - - programExpression: function programExpression(guid) { - var child = this.environment.children[guid], - programParams = [child.index, 'data', child.blockParams]; - - if (this.useBlockParams || this.useDepths) { - programParams.push('blockParams'); - } - if (this.useDepths) { - programParams.push('depths'); - } - - return 'container.program(' + programParams.join(', ') + ')'; - }, - - useRegister: function useRegister(name) { - if (!this.registers[name]) { - this.registers[name] = true; - this.registers.list.push(name); - } - }, - - push: function push(expr) { - if (!(expr instanceof Literal)) { - expr = this.source.wrap(expr); - } - - this.inlineStack.push(expr); - return expr; - }, - - pushStackLiteral: function pushStackLiteral(item) { - this.push(new Literal(item)); - }, - - pushSource: function pushSource(source) { - if (this.pendingContent) { - this.source.push(this.appendToBuffer(this.source.quotedString(this.pendingContent), this.pendingLocation)); - this.pendingContent = undefined; - } - - if (source) { - this.source.push(source); - } - }, - - replaceStack: function replaceStack(callback) { - var prefix = ['('], - stack = undefined, - createdStack = undefined, - usedLiteral = undefined; - - /* istanbul ignore next */ - if (!this.isInline()) { - throw new _exception2['default']('replaceStack on non-inline'); - } - - // We want to merge the inline statement into the replacement statement via ',' - var top = this.popStack(true); - - if (top instanceof Literal) { - // Literals do not need to be inlined - stack = [top.value]; - prefix = ['(', stack]; - usedLiteral = true; - } else { - // Get or create the current stack name for use by the inline - createdStack = true; - var _name = this.incrStack(); - - prefix = ['((', this.push(_name), ' = ', top, ')']; - stack = this.topStack(); - } - - var item = callback.call(this, stack); - - if (!usedLiteral) { - this.popStack(); - } - if (createdStack) { - this.stackSlot--; - } - this.push(prefix.concat(item, ')')); - }, - - incrStack: function incrStack() { - this.stackSlot++; - if (this.stackSlot > this.stackVars.length) { - this.stackVars.push('stack' + this.stackSlot); - } - return this.topStackName(); - }, - topStackName: function topStackName() { - return 'stack' + this.stackSlot; - }, - flushInline: function flushInline() { - var inlineStack = this.inlineStack; - this.inlineStack = []; - for (var i = 0, len = inlineStack.length; i < len; i++) { - var entry = inlineStack[i]; - /* istanbul ignore if */ - if (entry instanceof Literal) { - this.compileStack.push(entry); - } else { - var stack = this.incrStack(); - this.pushSource([stack, ' = ', entry, ';']); - this.compileStack.push(stack); - } - } - }, - isInline: function isInline() { - return this.inlineStack.length; - }, - - popStack: function popStack(wrapped) { - var inline = this.isInline(), - item = (inline ? this.inlineStack : this.compileStack).pop(); - - if (!wrapped && item instanceof Literal) { - return item.value; - } else { - if (!inline) { - /* istanbul ignore next */ - if (!this.stackSlot) { - throw new _exception2['default']('Invalid stack pop'); - } - this.stackSlot--; - } - return item; - } - }, - - topStack: function topStack() { - var stack = this.isInline() ? this.inlineStack : this.compileStack, - item = stack[stack.length - 1]; - - /* istanbul ignore if */ - if (item instanceof Literal) { - return item.value; - } else { - return item; - } - }, - - contextName: function contextName(context) { - if (this.useDepths && context) { - return 'depths[' + context + ']'; - } else { - return 'depth' + context; - } - }, - - quotedString: function quotedString(str) { - return this.source.quotedString(str); - }, - - objectLiteral: function objectLiteral(obj) { - return this.source.objectLiteral(obj); - }, - - aliasable: function aliasable(name) { - var ret = this.aliases[name]; - if (ret) { - ret.referenceCount++; - return ret; - } - - ret = this.aliases[name] = this.source.wrap(name); - ret.aliasable = true; - ret.referenceCount = 1; - - return ret; - }, - - setupHelper: function setupHelper(paramSize, name, blockHelper) { - var params = [], - paramsInit = this.setupHelperArgs(name, paramSize, params, blockHelper); - var foundHelper = this.nameLookup('helpers', name, 'helper'), - callContext = this.aliasable(this.contextName(0) + ' != null ? ' + this.contextName(0) + ' : (container.nullContext || {})'); - - return { - params: params, - paramsInit: paramsInit, - name: foundHelper, - callParams: [callContext].concat(params) - }; - }, - - setupParams: function setupParams(helper, paramSize, params) { - var options = {}, - contexts = [], - types = [], - ids = [], - objectArgs = !params, - param = undefined; - - if (objectArgs) { - params = []; - } - - options.name = this.quotedString(helper); - options.hash = this.popStack(); - - if (this.trackIds) { - options.hashIds = this.popStack(); - } - if (this.stringParams) { - options.hashTypes = this.popStack(); - options.hashContexts = this.popStack(); - } - - var inverse = this.popStack(), - program = this.popStack(); - - // Avoid setting fn and inverse if neither are set. This allows - // helpers to do a check for `if (options.fn)` - if (program || inverse) { - options.fn = program || 'container.noop'; - options.inverse = inverse || 'container.noop'; - } - - // The parameters go on to the stack in order (making sure that they are evaluated in order) - // so we need to pop them off the stack in reverse order - var i = paramSize; - while (i--) { - param = this.popStack(); - params[i] = param; - - if (this.trackIds) { - ids[i] = this.popStack(); - } - if (this.stringParams) { - types[i] = this.popStack(); - contexts[i] = this.popStack(); - } - } - - if (objectArgs) { - options.args = this.source.generateArray(params); - } - - if (this.trackIds) { - options.ids = this.source.generateArray(ids); - } - if (this.stringParams) { - options.types = this.source.generateArray(types); - options.contexts = this.source.generateArray(contexts); - } - - if (this.options.data) { - options.data = 'data'; - } - if (this.useBlockParams) { - options.blockParams = 'blockParams'; - } - return options; - }, - - setupHelperArgs: function setupHelperArgs(helper, paramSize, params, useRegister) { - var options = this.setupParams(helper, paramSize, params); - options.loc = JSON.stringify(this.source.currentLocation); - options = this.objectLiteral(options); - if (useRegister) { - this.useRegister('options'); - params.push('options'); - return ['options=', options]; - } else if (params) { - params.push(options); - return ''; - } else { - return options; - } - } - }; - - (function () { - var reservedWords = ('break else new var' + ' case finally return void' + ' catch for switch while' + ' continue function this with' + ' default if throw' + ' delete in try' + ' do instanceof typeof' + ' abstract enum int short' + ' boolean export interface static' + ' byte extends long super' + ' char final native synchronized' + ' class float package throws' + ' const goto private transient' + ' debugger implements protected volatile' + ' double import public let yield await' + ' null true false').split(' '); - - var compilerWords = JavaScriptCompiler.RESERVED_WORDS = {}; - - for (var i = 0, l = reservedWords.length; i < l; i++) { - compilerWords[reservedWords[i]] = true; - } - })(); - - /** - * @deprecated May be removed in the next major version - */ - JavaScriptCompiler.isValidJavaScriptVariableName = function (name) { - return !JavaScriptCompiler.RESERVED_WORDS[name] && /^[a-zA-Z_$][0-9a-zA-Z_$]*$/.test(name); - }; - - function strictLookup(requireTerminal, compiler, parts, type) { - var stack = compiler.popStack(), - i = 0, - len = parts.length; - if (requireTerminal) { - len--; - } - - for (; i < len; i++) { - stack = compiler.nameLookup(stack, parts[i], type); - } - - if (requireTerminal) { - return [compiler.aliasable('container.strict'), '(', stack, ', ', compiler.quotedString(parts[i]), ', ', JSON.stringify(compiler.source.currentLocation), ' )']; - } else { - return stack; - } - } - - exports['default'] = JavaScriptCompiler; - module.exports = exports['default']; - -/***/ }), -/* 53 */ -/***/ (function(module, exports, __webpack_require__) { - - /* global define */ - 'use strict'; - - var _Object$keys = __webpack_require__(13)['default']; - - exports.__esModule = true; - - var _utils = __webpack_require__(5); - - var SourceNode = undefined; - - try { - /* istanbul ignore next */ - if (false) { - // We don't support this in AMD environments. For these environments, we asusme that - // they are running on the browser and thus have no need for the source-map library. - var SourceMap = require('source-map'); - SourceNode = SourceMap.SourceNode; - } - } catch (err) {} - /* NOP */ - - /* istanbul ignore if: tested but not covered in istanbul due to dist build */ - if (!SourceNode) { - SourceNode = function (line, column, srcFile, chunks) { - this.src = ''; - if (chunks) { - this.add(chunks); - } - }; - /* istanbul ignore next */ - SourceNode.prototype = { - add: function add(chunks) { - if (_utils.isArray(chunks)) { - chunks = chunks.join(''); - } - this.src += chunks; - }, - prepend: function prepend(chunks) { - if (_utils.isArray(chunks)) { - chunks = chunks.join(''); - } - this.src = chunks + this.src; - }, - toStringWithSourceMap: function toStringWithSourceMap() { - return { code: this.toString() }; - }, - toString: function toString() { - return this.src; - } - }; - } - - function castChunk(chunk, codeGen, loc) { - if (_utils.isArray(chunk)) { - var ret = []; - - for (var i = 0, len = chunk.length; i < len; i++) { - ret.push(codeGen.wrap(chunk[i], loc)); - } - return ret; - } else if (typeof chunk === 'boolean' || typeof chunk === 'number') { - // Handle primitives that the SourceNode will throw up on - return chunk + ''; - } - return chunk; - } - - function CodeGen(srcFile) { - this.srcFile = srcFile; - this.source = []; - } - - CodeGen.prototype = { - isEmpty: function isEmpty() { - return !this.source.length; - }, - prepend: function prepend(source, loc) { - this.source.unshift(this.wrap(source, loc)); - }, - push: function push(source, loc) { - this.source.push(this.wrap(source, loc)); - }, - - merge: function merge() { - var source = this.empty(); - this.each(function (line) { - source.add([' ', line, '\n']); - }); - return source; - }, - - each: function each(iter) { - for (var i = 0, len = this.source.length; i < len; i++) { - iter(this.source[i]); - } - }, - - empty: function empty() { - var loc = this.currentLocation || { start: {} }; - return new SourceNode(loc.start.line, loc.start.column, this.srcFile); - }, - wrap: function wrap(chunk) { - var loc = arguments.length <= 1 || arguments[1] === undefined ? this.currentLocation || { start: {} } : arguments[1]; - - if (chunk instanceof SourceNode) { - return chunk; - } - - chunk = castChunk(chunk, this, loc); - - return new SourceNode(loc.start.line, loc.start.column, this.srcFile, chunk); - }, - - functionCall: function functionCall(fn, type, params) { - params = this.generateList(params); - return this.wrap([fn, type ? '.' + type + '(' : '(', params, ')']); - }, - - quotedString: function quotedString(str) { - return '"' + (str + '').replace(/\\/g, '\\\\').replace(/"/g, '\\"').replace(/\n/g, '\\n').replace(/\r/g, '\\r').replace(/\u2028/g, '\\u2028') // Per Ecma-262 7.3 + 7.8.4 - .replace(/\u2029/g, '\\u2029') + '"'; - }, - - objectLiteral: function objectLiteral(obj) { - // istanbul ignore next - - var _this = this; - - var pairs = []; - - _Object$keys(obj).forEach(function (key) { - var value = castChunk(obj[key], _this); - if (value !== 'undefined') { - pairs.push([_this.quotedString(key), ':', value]); - } - }); - - var ret = this.generateList(pairs); - ret.prepend('{'); - ret.add('}'); - return ret; - }, - - generateList: function generateList(entries) { - var ret = this.empty(); - - for (var i = 0, len = entries.length; i < len; i++) { - if (i) { - ret.add(','); - } - - ret.add(castChunk(entries[i], this)); - } - - return ret; - }, - - generateArray: function generateArray(entries) { - var ret = this.generateList(entries); - ret.prepend('['); - ret.add(']'); - - return ret; - } - }; - - exports['default'] = CodeGen; - module.exports = exports['default']; - -/***/ }) -/******/ ]) -}); -; \ No newline at end of file +/* exported Handlebars */ +var Handlebars = (function() { +// handlebars/safe-string.js +var __module4__ = (function() { + "use strict"; + var __exports__; + // Build out our basic SafeString type + function SafeString(string) { + this.string = string; + } + + SafeString.prototype.toString = function() { + return "" + this.string; + }; + + __exports__ = SafeString; + return __exports__; +})(); + +// handlebars/utils.js +var __module3__ = (function(__dependency1__) { + "use strict"; + var __exports__ = {}; + /*jshint -W004 */ + var SafeString = __dependency1__; + + var escape = { + "&": "&", + "<": "<", + ">": ">", + '"': """, + "'": "'", + "`": "`" + }; + + var badChars = /[&<>"'`]/g; + var possible = /[&<>"'`]/; + + function escapeChar(chr) { + return escape[chr] || "&"; + } + + function extend(obj, value) { + for(var key in value) { + if(Object.prototype.hasOwnProperty.call(value, key)) { + obj[key] = value[key]; + } + } + } + + __exports__.extend = extend;var toString = Object.prototype.toString; + __exports__.toString = toString; + // Sourced from lodash + // https://github.com/bestiejs/lodash/blob/master/LICENSE.txt + var isFunction = function(value) { + return typeof value === 'function'; + }; + // fallback for older versions of Chrome and Safari + if (isFunction(/x/)) { + isFunction = function(value) { + return typeof value === 'function' && toString.call(value) === '[object Function]'; + }; + } + var isFunction; + __exports__.isFunction = isFunction; + var isArray = Array.isArray || function(value) { + return (value && typeof value === 'object') ? toString.call(value) === '[object Array]' : false; + }; + __exports__.isArray = isArray; + + function escapeExpression(string) { + // don't escape SafeStrings, since they're already safe + if (string instanceof SafeString) { + return string.toString(); + } else if (!string && string !== 0) { + return ""; + } + + // Force a string conversion as this will be done by the append regardless and + // the regex test will do this transparently behind the scenes, causing issues if + // an object's to string has escaped characters in it. + string = "" + string; + + if(!possible.test(string)) { return string; } + return string.replace(badChars, escapeChar); + } + + __exports__.escapeExpression = escapeExpression;function isEmpty(value) { + if (!value && value !== 0) { + return true; + } else if (isArray(value) && value.length === 0) { + return true; + } else { + return false; + } + } + + __exports__.isEmpty = isEmpty; + return __exports__; +})(__module4__); + +// handlebars/exception.js +var __module5__ = (function() { + "use strict"; + var __exports__; + + var errorProps = ['description', 'fileName', 'lineNumber', 'message', 'name', 'number', 'stack']; + + function Exception(message, node) { + var line; + if (node && node.firstLine) { + line = node.firstLine; + + message += ' - ' + line + ':' + node.firstColumn; + } + + var tmp = Error.prototype.constructor.call(this, message); + + // Unfortunately errors are not enumerable in Chrome (at least), so `for prop in tmp` doesn't work. + for (var idx = 0; idx < errorProps.length; idx++) { + this[errorProps[idx]] = tmp[errorProps[idx]]; + } + + if (line) { + this.lineNumber = line; + this.column = node.firstColumn; + } + } + + Exception.prototype = new Error(); + + __exports__ = Exception; + return __exports__; +})(); + +// handlebars/base.js +var __module2__ = (function(__dependency1__, __dependency2__) { + "use strict"; + var __exports__ = {}; + var Utils = __dependency1__; + var Exception = __dependency2__; + + var VERSION = "1.3.0"; + __exports__.VERSION = VERSION;var COMPILER_REVISION = 4; + __exports__.COMPILER_REVISION = COMPILER_REVISION; + var REVISION_CHANGES = { + 1: '<= 1.0.rc.2', // 1.0.rc.2 is actually rev2 but doesn't report it + 2: '== 1.0.0-rc.3', + 3: '== 1.0.0-rc.4', + 4: '>= 1.0.0' + }; + __exports__.REVISION_CHANGES = REVISION_CHANGES; + var isArray = Utils.isArray, + isFunction = Utils.isFunction, + toString = Utils.toString, + objectType = '[object Object]'; + + function HandlebarsEnvironment(helpers, partials) { + this.helpers = helpers || {}; + this.partials = partials || {}; + + registerDefaultHelpers(this); + } + + __exports__.HandlebarsEnvironment = HandlebarsEnvironment;HandlebarsEnvironment.prototype = { + constructor: HandlebarsEnvironment, + + logger: logger, + log: log, + + registerHelper: function(name, fn, inverse) { + if (toString.call(name) === objectType) { + if (inverse || fn) { throw new Exception('Arg not supported with multiple helpers'); } + Utils.extend(this.helpers, name); + } else { + if (inverse) { fn.not = inverse; } + this.helpers[name] = fn; + } + }, + + registerPartial: function(name, str) { + if (toString.call(name) === objectType) { + Utils.extend(this.partials, name); + } else { + this.partials[name] = str; + } + } + }; + + function registerDefaultHelpers(instance) { + instance.registerHelper('helperMissing', function(arg) { + if(arguments.length === 2) { + return undefined; + } else { + throw new Exception("Missing helper: '" + arg + "'"); + } + }); + + instance.registerHelper('blockHelperMissing', function(context, options) { + var inverse = options.inverse || function() {}, fn = options.fn; + + if (isFunction(context)) { context = context.call(this); } + + if(context === true) { + return fn(this); + } else if(context === false || context == null) { + return inverse(this); + } else if (isArray(context)) { + if(context.length > 0) { + return instance.helpers.each(context, options); + } else { + return inverse(this); + } + } else { + return fn(context); + } + }); + + instance.registerHelper('each', function(context, options) { + var fn = options.fn, inverse = options.inverse; + var i = 0, ret = "", data; + + if (isFunction(context)) { context = context.call(this); } + + if (options.data) { + data = createFrame(options.data); + } + + if(context && typeof context === 'object') { + if (isArray(context)) { + for(var j = context.length; i 0) { + throw new Exception("Invalid path: " + original, this); + } else if (part === "..") { + depth++; + } else { + this.isScoped = true; + } + } else { + dig.push(part); + } + } + + this.original = original; + this.parts = dig; + this.string = dig.join('.'); + this.depth = depth; + + // an ID is simple if it only has one part, and that part is not + // `..` or `this`. + this.isSimple = parts.length === 1 && !this.isScoped && depth === 0; + + this.stringModeValue = this.string; + }, + + PartialNameNode: function(name, locInfo) { + LocationInfo.call(this, locInfo); + this.type = "PARTIAL_NAME"; + this.name = name.original; + }, + + DataNode: function(id, locInfo) { + LocationInfo.call(this, locInfo); + this.type = "DATA"; + this.id = id; + }, + + StringNode: function(string, locInfo) { + LocationInfo.call(this, locInfo); + this.type = "STRING"; + this.original = + this.string = + this.stringModeValue = string; + }, + + IntegerNode: function(integer, locInfo) { + LocationInfo.call(this, locInfo); + this.type = "INTEGER"; + this.original = + this.integer = integer; + this.stringModeValue = Number(integer); + }, + + BooleanNode: function(bool, locInfo) { + LocationInfo.call(this, locInfo); + this.type = "BOOLEAN"; + this.bool = bool; + this.stringModeValue = bool === "true"; + }, + + CommentNode: function(comment, locInfo) { + LocationInfo.call(this, locInfo); + this.type = "comment"; + this.comment = comment; + } + }; + + // Must be exported as an object rather than the root of the module as the jison lexer + // most modify the object to operate properly. + __exports__ = AST; + return __exports__; +})(__module5__); + +// handlebars/compiler/parser.js +var __module9__ = (function() { + "use strict"; + var __exports__; + /* jshint ignore:start */ + /* Jison generated parser */ + var handlebars = (function(){ + var parser = {trace: function trace() { }, + yy: {}, + 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,"sexpr":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,"sexpr_repetition0":28,"sexpr_option0":29,"dataName":30,"param":31,"STRING":32,"INTEGER":33,"BOOLEAN":34,"OPEN_SEXPR":35,"CLOSE_SEXPR":36,"hash":37,"hash_repetition_plus0":38,"hashSegment":39,"ID":40,"EQUALS":41,"DATA":42,"pathSegments":43,"SEP":44,"$accept":0,"$end":1}, + 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",35:"OPEN_SEXPR",36:"CLOSE_SEXPR",40:"ID",41:"EQUALS",42:"DATA",44:"SEP"}, + 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],[31,3],[37,1],[39,3],[26,1],[26,1],[26,1],[30,2],[21,1],[43,3],[43,1],[27,0],[27,1],[28,0],[28,2],[29,0],[29,1],[38,1],[38,2]], + performAction: function anonymous(yytext,yyleng,yylineno,yy,yystate,$$,_$) { + + var $0 = $$.length - 1; + switch (yystate) { + case 1: return new yy.ProgramNode($$[$0-1], this._$); + break; + case 2: return new yy.ProgramNode([], this._$); + break; + case 3:this.$ = new yy.ProgramNode([], $$[$0-1], $$[$0], this._$); + break; + case 4:this.$ = new yy.ProgramNode($$[$0-2], $$[$0-1], $$[$0], this._$); + break; + case 5:this.$ = new yy.ProgramNode($$[$0-1], $$[$0], [], this._$); + break; + case 6:this.$ = new yy.ProgramNode($$[$0], this._$); + break; + case 7:this.$ = new yy.ProgramNode([], this._$); + break; + case 8:this.$ = new yy.ProgramNode([], this._$); + break; + case 9:this.$ = [$$[$0]]; + break; + case 10: $$[$0-1].push($$[$0]); this.$ = $$[$0-1]; + break; + case 11:this.$ = new yy.BlockNode($$[$0-2], $$[$0-1].inverse, $$[$0-1], $$[$0], this._$); + break; + case 12:this.$ = new yy.BlockNode($$[$0-2], $$[$0-1], $$[$0-1].inverse, $$[$0], this._$); + break; + case 13:this.$ = $$[$0]; + break; + case 14:this.$ = $$[$0]; + break; + case 15:this.$ = new yy.ContentNode($$[$0], this._$); + break; + case 16:this.$ = new yy.CommentNode($$[$0], this._$); + break; + case 17:this.$ = new yy.MustacheNode($$[$0-1], null, $$[$0-2], stripFlags($$[$0-2], $$[$0]), this._$); + break; + case 18:this.$ = new yy.MustacheNode($$[$0-1], null, $$[$0-2], stripFlags($$[$0-2], $$[$0]), this._$); + break; + case 19:this.$ = {path: $$[$0-1], strip: stripFlags($$[$0-2], $$[$0])}; + break; + case 20:this.$ = new yy.MustacheNode($$[$0-1], null, $$[$0-2], stripFlags($$[$0-2], $$[$0]), this._$); + break; + case 21:this.$ = new yy.MustacheNode($$[$0-1], null, $$[$0-2], stripFlags($$[$0-2], $$[$0]), this._$); + break; + case 22:this.$ = new yy.PartialNode($$[$0-2], $$[$0-1], stripFlags($$[$0-3], $$[$0]), this._$); + break; + case 23:this.$ = stripFlags($$[$0-1], $$[$0]); + break; + case 24:this.$ = new yy.SexprNode([$$[$0-2]].concat($$[$0-1]), $$[$0], this._$); + break; + case 25:this.$ = new yy.SexprNode([$$[$0]], null, this._$); + break; + case 26:this.$ = $$[$0]; + break; + case 27:this.$ = new yy.StringNode($$[$0], this._$); + break; + case 28:this.$ = new yy.IntegerNode($$[$0], this._$); + break; + case 29:this.$ = new yy.BooleanNode($$[$0], this._$); + break; + case 30:this.$ = $$[$0]; + break; + case 31:$$[$0-1].isHelper = true; this.$ = $$[$0-1]; + break; + case 32:this.$ = new yy.HashNode($$[$0], this._$); + break; + case 33:this.$ = [$$[$0-2], $$[$0]]; + break; + case 34:this.$ = new yy.PartialNameNode($$[$0], this._$); + break; + case 35:this.$ = new yy.PartialNameNode(new yy.StringNode($$[$0], this._$), this._$); + break; + case 36:this.$ = new yy.PartialNameNode(new yy.IntegerNode($$[$0], this._$)); + break; + case 37:this.$ = new yy.DataNode($$[$0], this._$); + break; + case 38:this.$ = new yy.IdNode($$[$0], this._$); + break; + case 39: $$[$0-2].push({part: $$[$0], separator: $$[$0-1]}); this.$ = $$[$0-2]; + break; + case 40:this.$ = [{part: $$[$0]}]; + break; + case 43:this.$ = []; + break; + case 44:$$[$0-1].push($$[$0]); + break; + case 47:this.$ = [$$[$0]]; + break; + case 48:$$[$0-1].push($$[$0]); + break; + } + }, + 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,40:[1,28],42:[1,27],43:26},{17:29,21:24,30:25,40:[1,28],42:[1,27],43:26},{17:30,21:24,30:25,40:[1,28],42:[1,27],43:26},{17:31,21:24,30:25,40:[1,28],42:[1,27],43:26},{21:33,26:32,32:[1,34],33:[1,35],40:[1,28],43: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,40:[1,28],42:[1,27],43:26},{10:41,20:[1,37]},{18:[1,42]},{18:[2,43],24:[2,43],28:43,32:[2,43],33:[2,43],34:[2,43],35:[2,43],36:[2,43],40:[2,43],42:[2,43]},{18:[2,25],24:[2,25],36:[2,25]},{18:[2,38],24:[2,38],32:[2,38],33:[2,38],34:[2,38],35:[2,38],36:[2,38],40:[2,38],42:[2,38],44:[1,44]},{21:45,40:[1,28],43:26},{18:[2,40],24:[2,40],32:[2,40],33:[2,40],34:[2,40],35:[2,40],36:[2,40],40:[2,40],42:[2,40],44:[2,40]},{18:[1,46]},{18:[1,47]},{24:[1,48]},{18:[2,41],21:50,27:49,40:[1,28],43:26},{18:[2,34],40:[2,34]},{18:[2,35],40:[2,35]},{18:[2,36],40:[2,36]},{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,40:[1,28],43: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,45],21:56,24:[2,45],29:53,30:60,31:54,32:[1,57],33:[1,58],34:[1,59],35:[1,61],36:[2,45],37:55,38:62,39:63,40:[1,64],42:[1,27],43:26},{40:[1,65]},{18:[2,37],24:[2,37],32:[2,37],33:[2,37],34:[2,37],35:[2,37],36:[2,37],40:[2,37],42:[2,37]},{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,66]},{18:[2,42]},{18:[1,67]},{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],36:[2,24]},{18:[2,44],24:[2,44],32:[2,44],33:[2,44],34:[2,44],35:[2,44],36:[2,44],40:[2,44],42:[2,44]},{18:[2,46],24:[2,46],36:[2,46]},{18:[2,26],24:[2,26],32:[2,26],33:[2,26],34:[2,26],35:[2,26],36:[2,26],40:[2,26],42:[2,26]},{18:[2,27],24:[2,27],32:[2,27],33:[2,27],34:[2,27],35:[2,27],36:[2,27],40:[2,27],42:[2,27]},{18:[2,28],24:[2,28],32:[2,28],33:[2,28],34:[2,28],35:[2,28],36:[2,28],40:[2,28],42:[2,28]},{18:[2,29],24:[2,29],32:[2,29],33:[2,29],34:[2,29],35:[2,29],36:[2,29],40:[2,29],42:[2,29]},{18:[2,30],24:[2,30],32:[2,30],33:[2,30],34:[2,30],35:[2,30],36:[2,30],40:[2,30],42:[2,30]},{17:68,21:24,30:25,40:[1,28],42:[1,27],43:26},{18:[2,32],24:[2,32],36:[2,32],39:69,40:[1,70]},{18:[2,47],24:[2,47],36:[2,47],40:[2,47]},{18:[2,40],24:[2,40],32:[2,40],33:[2,40],34:[2,40],35:[2,40],36:[2,40],40:[2,40],41:[1,71],42:[2,40],44:[2,40]},{18:[2,39],24:[2,39],32:[2,39],33:[2,39],34:[2,39],35:[2,39],36:[2,39],40:[2,39],42:[2,39],44:[2,39]},{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]},{36:[1,72]},{18:[2,48],24:[2,48],36:[2,48],40:[2,48]},{41:[1,71]},{21:56,30:60,31:73,32:[1,57],33:[1,58],34:[1,59],35:[1,61],40:[1,28],42:[1,27],43:26},{18:[2,31],24:[2,31],32:[2,31],33:[2,31],34:[2,31],35:[2,31],36:[2,31],40:[2,31],42:[2,31]},{18:[2,33],24:[2,33],36:[2,33],40:[2,33]}], + defaultActions: {3:[2,2],16:[2,1],50:[2,42]}, + parseError: function parseError(str, hash) { + throw new Error(str); + }, + parse: function parse(input) { + var self = this, stack = [0], vstack = [null], lstack = [], table = this.table, yytext = "", yylineno = 0, yyleng = 0, recovering = 0, TERROR = 2, EOF = 1; + this.lexer.setInput(input); + this.lexer.yy = this.yy; + this.yy.lexer = this.lexer; + this.yy.parser = this; + if (typeof this.lexer.yylloc == "undefined") + this.lexer.yylloc = {}; + var yyloc = this.lexer.yylloc; + lstack.push(yyloc); + var ranges = this.lexer.options && this.lexer.options.ranges; + if (typeof this.yy.parseError === "function") + this.parseError = this.yy.parseError; + function popStack(n) { + stack.length = stack.length - 2 * n; + vstack.length = vstack.length - n; + lstack.length = lstack.length - n; + } + function lex() { + var token; + token = self.lexer.lex() || 1; + if (typeof token !== "number") { + token = self.symbols_[token] || token; + } + return token; + } + var symbol, preErrorSymbol, state, action, a, r, yyval = {}, p, len, newState, expected; + while (true) { + state = stack[stack.length - 1]; + if (this.defaultActions[state]) { + action = this.defaultActions[state]; + } else { + if (symbol === null || typeof symbol == "undefined") { + symbol = lex(); + } + action = table[state] && table[state][symbol]; + } + if (typeof action === "undefined" || !action.length || !action[0]) { + var errStr = ""; + if (!recovering) { + expected = []; + for (p in table[state]) + if (this.terminals_[p] && p > 2) { + expected.push("'" + this.terminals_[p] + "'"); + } + if (this.lexer.showPosition) { + errStr = "Parse error on line " + (yylineno + 1) + ":\n" + this.lexer.showPosition() + "\nExpecting " + expected.join(", ") + ", got '" + (this.terminals_[symbol] || symbol) + "'"; + } else { + errStr = "Parse error on line " + (yylineno + 1) + ": Unexpected " + (symbol == 1?"end of input":"'" + (this.terminals_[symbol] || symbol) + "'"); + } + this.parseError(errStr, {text: this.lexer.match, token: this.terminals_[symbol] || symbol, line: this.lexer.yylineno, loc: yyloc, expected: expected}); + } + } + if (action[0] instanceof Array && action.length > 1) { + throw new Error("Parse Error: multiple actions possible at state: " + state + ", token: " + symbol); + } + switch (action[0]) { + case 1: + stack.push(symbol); + vstack.push(this.lexer.yytext); + lstack.push(this.lexer.yylloc); + stack.push(action[1]); + symbol = null; + if (!preErrorSymbol) { + yyleng = this.lexer.yyleng; + yytext = this.lexer.yytext; + yylineno = this.lexer.yylineno; + yyloc = this.lexer.yylloc; + if (recovering > 0) + recovering--; + } else { + symbol = preErrorSymbol; + preErrorSymbol = null; + } + break; + case 2: + len = this.productions_[action[1]][1]; + yyval.$ = vstack[vstack.length - len]; + 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}; + if (ranges) { + yyval._$.range = [lstack[lstack.length - (len || 1)].range[0], lstack[lstack.length - 1].range[1]]; + } + r = this.performAction.call(yyval, yytext, yyleng, yylineno, this.yy, action[1], vstack, lstack); + if (typeof r !== "undefined") { + return r; + } + if (len) { + stack = stack.slice(0, -1 * len * 2); + vstack = vstack.slice(0, -1 * len); + lstack = lstack.slice(0, -1 * len); + } + stack.push(this.productions_[action[1]][0]); + vstack.push(yyval.$); + lstack.push(yyval._$); + newState = table[stack[stack.length - 2]][stack[stack.length - 1]]; + stack.push(newState); + break; + case 3: + return true; + } + } + return true; + } + }; + + + function stripFlags(open, close) { + return { + left: open.charAt(2) === '~', + right: close.charAt(0) === '~' || close.charAt(1) === '~' + }; + } + + /* Jison generated lexer */ + var lexer = (function(){ + var lexer = ({EOF:1, + parseError:function parseError(str, hash) { + if (this.yy.parser) { + this.yy.parser.parseError(str, hash); + } else { + throw new Error(str); + } + }, + setInput:function (input) { + this._input = input; + this._more = this._less = this.done = false; + this.yylineno = this.yyleng = 0; + this.yytext = this.matched = this.match = ''; + this.conditionStack = ['INITIAL']; + this.yylloc = {first_line:1,first_column:0,last_line:1,last_column:0}; + if (this.options.ranges) this.yylloc.range = [0,0]; + this.offset = 0; + return this; + }, + input:function () { + var ch = this._input[0]; + this.yytext += ch; + this.yyleng++; + this.offset++; + this.match += ch; + this.matched += ch; + var lines = ch.match(/(?:\r\n?|\n).*/g); + if (lines) { + this.yylineno++; + this.yylloc.last_line++; + } else { + this.yylloc.last_column++; + } + if (this.options.ranges) this.yylloc.range[1]++; + + this._input = this._input.slice(1); + return ch; + }, + unput:function (ch) { + var len = ch.length; + var lines = ch.split(/(?:\r\n?|\n)/g); + + this._input = ch + this._input; + this.yytext = this.yytext.substr(0, this.yytext.length-len-1); + //this.yyleng -= len; + this.offset -= len; + var oldLines = this.match.split(/(?:\r\n?|\n)/g); + this.match = this.match.substr(0, this.match.length-1); + this.matched = this.matched.substr(0, this.matched.length-1); + + if (lines.length-1) this.yylineno -= lines.length-1; + var r = this.yylloc.range; + + this.yylloc = {first_line: this.yylloc.first_line, + last_line: this.yylineno+1, + first_column: this.yylloc.first_column, + last_column: lines ? + (lines.length === oldLines.length ? this.yylloc.first_column : 0) + oldLines[oldLines.length - lines.length].length - lines[0].length: + this.yylloc.first_column - len + }; + + if (this.options.ranges) { + this.yylloc.range = [r[0], r[0] + this.yyleng - len]; + } + return this; + }, + more:function () { + this._more = true; + return this; + }, + less:function (n) { + this.unput(this.match.slice(n)); + }, + pastInput:function () { + var past = this.matched.substr(0, this.matched.length - this.match.length); + return (past.length > 20 ? '...':'') + past.substr(-20).replace(/\n/g, ""); + }, + upcomingInput:function () { + var next = this.match; + if (next.length < 20) { + next += this._input.substr(0, 20-next.length); + } + return (next.substr(0,20)+(next.length > 20 ? '...':'')).replace(/\n/g, ""); + }, + showPosition:function () { + var pre = this.pastInput(); + var c = new Array(pre.length + 1).join("-"); + return pre + this.upcomingInput() + "\n" + c+"^"; + }, + next:function () { + if (this.done) { + return this.EOF; + } + if (!this._input) this.done = true; + + var token, + match, + tempMatch, + index, + col, + lines; + if (!this._more) { + this.yytext = ''; + this.match = ''; + } + var rules = this._currentRules(); + for (var i=0;i < rules.length; i++) { + tempMatch = this._input.match(this.rules[rules[i]]); + if (tempMatch && (!match || tempMatch[0].length > match[0].length)) { + match = tempMatch; + index = i; + if (!this.options.flex) break; + } + } + if (match) { + lines = match[0].match(/(?:\r\n?|\n).*/g); + if (lines) this.yylineno += lines.length; + this.yylloc = {first_line: this.yylloc.last_line, + last_line: this.yylineno+1, + first_column: this.yylloc.last_column, + last_column: lines ? lines[lines.length-1].length-lines[lines.length-1].match(/\r?\n?/)[0].length : this.yylloc.last_column + match[0].length}; + this.yytext += match[0]; + this.match += match[0]; + this.matches = match; + this.yyleng = this.yytext.length; + if (this.options.ranges) { + this.yylloc.range = [this.offset, this.offset += this.yyleng]; + } + this._more = false; + this._input = this._input.slice(match[0].length); + this.matched += match[0]; + token = this.performAction.call(this, this.yy, this, rules[index],this.conditionStack[this.conditionStack.length-1]); + if (this.done && this._input) this.done = false; + if (token) return token; + else return; + } + if (this._input === "") { + return this.EOF; + } else { + return this.parseError('Lexical error on line '+(this.yylineno+1)+'. Unrecognized text.\n'+this.showPosition(), + {text: "", token: null, line: this.yylineno}); + } + }, + lex:function lex() { + var r = this.next(); + if (typeof r !== 'undefined') { + return r; + } else { + return this.lex(); + } + }, + begin:function begin(condition) { + this.conditionStack.push(condition); + }, + popState:function popState() { + return this.conditionStack.pop(); + }, + _currentRules:function _currentRules() { + return this.conditions[this.conditionStack[this.conditionStack.length-1]].rules; + }, + topState:function () { + return this.conditionStack[this.conditionStack.length-2]; + }, + pushState:function begin(condition) { + this.begin(condition); + }}); + lexer.options = {}; + lexer.performAction = function anonymous(yy,yy_,$avoiding_name_collisions,YY_START) { + + + function strip(start, end) { + return yy_.yytext = yy_.yytext.substr(start, yy_.yyleng-end); + } + + + var YYSTATE=YY_START + switch($avoiding_name_collisions) { + case 0: + if(yy_.yytext.slice(-2) === "\\\\") { + strip(0,1); + this.begin("mu"); + } else if(yy_.yytext.slice(-1) === "\\") { + strip(0,1); + this.begin("emu"); + } else { + this.begin("mu"); + } + if(yy_.yytext) return 14; + + break; + case 1:return 14; + break; + case 2: + this.popState(); + return 14; + + break; + case 3:strip(0,4); this.popState(); return 15; + break; + case 4:return 35; + break; + case 5:return 36; + break; + case 6:return 25; + break; + case 7:return 16; + break; + case 8:return 20; + break; + case 9:return 19; + break; + case 10:return 19; + break; + case 11:return 23; + break; + case 12:return 22; + break; + case 13:this.popState(); this.begin('com'); + break; + case 14:strip(3,5); this.popState(); return 15; + break; + case 15:return 22; + break; + case 16:return 41; + break; + case 17:return 40; + break; + case 18:return 40; + break; + case 19:return 44; + break; + case 20:// ignore whitespace + break; + case 21:this.popState(); return 24; + break; + case 22:this.popState(); return 18; + break; + case 23:yy_.yytext = strip(1,2).replace(/\\"/g,'"'); return 32; + break; + case 24:yy_.yytext = strip(1,2).replace(/\\'/g,"'"); return 32; + break; + case 25:return 42; + break; + case 26:return 34; + break; + case 27:return 34; + break; + case 28:return 33; + break; + case 29:return 40; + break; + case 30:yy_.yytext = strip(1,2); return 40; + break; + case 31:return 'INVALID'; + break; + case 32:return 5; + break; + } + }; + lexer.rules = [/^(?:[^\x00]*?(?=(\{\{)))/,/^(?:[^\x00]+)/,/^(?:[^\x00]{2,}?(?=(\{\{|\\\{\{|\\\\\{\{|$)))/,/^(?:[\s\S]*?--\}\})/,/^(?:\()/,/^(?:\))/,/^(?:\{\{(~)?>)/,/^(?:\{\{(~)?#)/,/^(?:\{\{(~)?\/)/,/^(?:\{\{(~)?\^)/,/^(?:\{\{(~)?\s*else\b)/,/^(?:\{\{(~)?\{)/,/^(?:\{\{(~)?&)/,/^(?:\{\{!--)/,/^(?:\{\{![\s\S]*?\}\})/,/^(?:\{\{(~)?)/,/^(?:=)/,/^(?:\.\.)/,/^(?:\.(?=([=~}\s\/.)])))/,/^(?:[\/.])/,/^(?:\s+)/,/^(?:\}(~)?\}\})/,/^(?:(~)?\}\})/,/^(?:"(\\["]|[^"])*")/,/^(?:'(\\[']|[^'])*')/,/^(?:@)/,/^(?:true(?=([~}\s)])))/,/^(?:false(?=([~}\s)])))/,/^(?:-?[0-9]+(?=([~}\s)])))/,/^(?:([^\s!"#%-,\.\/;->@\[-\^`\{-~]+(?=([=~}\s\/.)]))))/,/^(?:\[[^\]]*\])/,/^(?:.)/,/^(?:$)/]; + 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,31,32],"inclusive":false},"emu":{"rules":[2],"inclusive":false},"com":{"rules":[3],"inclusive":false},"INITIAL":{"rules":[0,1,32],"inclusive":true}}; + return lexer;})() + parser.lexer = lexer; + function Parser () { this.yy = {}; }Parser.prototype = parser;parser.Parser = Parser; + return new Parser; + })();__exports__ = handlebars; + /* jshint ignore:end */ + return __exports__; +})(); + +// handlebars/compiler/base.js +var __module8__ = (function(__dependency1__, __dependency2__) { + "use strict"; + var __exports__ = {}; + var parser = __dependency1__; + var AST = __dependency2__; + + __exports__.parser = parser; + + function parse(input) { + // Just return if an already-compile AST was passed in. + if(input.constructor === AST.ProgramNode) { return input; } + + parser.yy = AST; + return parser.parse(input); + } + + __exports__.parse = parse; + return __exports__; +})(__module9__, __module7__); + +// handlebars/compiler/compiler.js +var __module10__ = (function(__dependency1__) { + "use strict"; + var __exports__ = {}; + var Exception = __dependency1__; + + function Compiler() {} + + __exports__.Compiler = Compiler;// the foundHelper register will disambiguate helper lookup from finding a + // function in a context. This is necessary for mustache compatibility, which + // requires that context functions in blocks are evaluated by blockHelperMissing, + // and then proceed as if the resulting value was provided to blockHelperMissing. + + Compiler.prototype = { + compiler: Compiler, + + disassemble: function() { + var opcodes = this.opcodes, opcode, out = [], params, param; + + for (var i=0, l=opcodes.length; i 0) { + this.source[1] = this.source[1] + ", " + locals.join(", "); + } + + // Generate minimizer alias mappings + if (!this.isChild) { + for (var alias in this.context.aliases) { + if (this.context.aliases.hasOwnProperty(alias)) { + this.source[1] = this.source[1] + ', ' + alias + '=' + this.context.aliases[alias]; + } + } + } + + if (this.source[1]) { + this.source[1] = "var " + this.source[1].substring(2) + ";"; + } + + // Merge children + if (!this.isChild) { + this.source[1] += '\n' + this.context.programs.join('\n') + '\n'; + } + + if (!this.environment.isSimple) { + this.pushSource("return buffer;"); + } + + var params = this.isChild ? ["depth0", "data"] : ["Handlebars", "depth0", "helpers", "partials", "data"]; + + for(var i=0, l=this.environment.depths.list.length; i this.stackVars.length) { this.stackVars.push("stack" + this.stackSlot); } + return this.topStackName(); + }, + topStackName: function() { + return "stack" + this.stackSlot; + }, + flushInline: function() { + var inlineStack = this.inlineStack; + if (inlineStack.length) { + this.inlineStack = []; + for (var i = 0, len = inlineStack.length; i < len; i++) { + var entry = inlineStack[i]; + if (entry instanceof Literal) { + this.compileStack.push(entry); + } else { + this.pushStack(entry); + } + } + } + }, + isInline: function() { + return this.inlineStack.length; + }, + + popStack: function(wrapped) { + var inline = this.isInline(), + item = (inline ? this.inlineStack : this.compileStack).pop(); + + if (!wrapped && (item instanceof Literal)) { + return item.value; + } else { + if (!inline) { + if (!this.stackSlot) { + throw new Exception('Invalid stack pop'); + } + this.stackSlot--; + } + return item; + } + }, + + topStack: function(wrapped) { + var stack = (this.isInline() ? this.inlineStack : this.compileStack), + item = stack[stack.length - 1]; + + if (!wrapped && (item instanceof Literal)) { + return item.value; + } else { + return item; + } + }, + + quotedString: function(str) { + return '"' + str + .replace(/\\/g, '\\\\') + .replace(/"/g, '\\"') + .replace(/\n/g, '\\n') + .replace(/\r/g, '\\r') + .replace(/\u2028/g, '\\u2028') // Per Ecma-262 7.3 + 7.8.4 + .replace(/\u2029/g, '\\u2029') + '"'; + }, + + setupHelper: function(paramSize, name, missingParams) { + var params = [], + paramsInit = this.setupParams(paramSize, params, missingParams); + var foundHelper = this.nameLookup('helpers', name, 'helper'); + + return { + params: params, + paramsInit: paramsInit, + name: foundHelper, + callParams: ["depth0"].concat(params).join(", "), + helperMissingParams: missingParams && ["depth0", this.quotedString(name)].concat(params).join(", ") + }; + }, + + setupOptions: function(paramSize, params) { + var options = [], contexts = [], types = [], param, inverse, program; + + options.push("hash:" + this.popStack()); + + if (this.options.stringParams) { + options.push("hashTypes:" + this.popStack()); + options.push("hashContexts:" + this.popStack()); + } + + inverse = this.popStack(); + program = this.popStack(); + + // Avoid setting fn and inverse if neither are set. This allows + // helpers to do a check for `if (options.fn)` + if (program || inverse) { + if (!program) { + this.context.aliases.self = "this"; + program = "self.noop"; + } + + if (!inverse) { + this.context.aliases.self = "this"; + inverse = "self.noop"; + } + + options.push("inverse:" + inverse); + options.push("fn:" + program); + } + + for(var i=0; i= 2.0.0-beta.1', - 7: '>= 4.0.0 <4.3.0', - 8: '>= 4.3.0' - }; - - exports.REVISION_CHANGES = REVISION_CHANGES; - var objectType = '[object Object]'; - - function HandlebarsEnvironment(helpers, partials, decorators) { - this.helpers = helpers || {}; - this.partials = partials || {}; - this.decorators = decorators || {}; - - _helpers.registerDefaultHelpers(this); - _decorators.registerDefaultDecorators(this); - } - - HandlebarsEnvironment.prototype = { - constructor: HandlebarsEnvironment, - - logger: _logger2['default'], - log: _logger2['default'].log, - - registerHelper: function registerHelper(name, fn) { - if (_utils.toString.call(name) === objectType) { - if (fn) { - throw new _exception2['default']('Arg not supported with multiple helpers'); - } - _utils.extend(this.helpers, name); - } else { - this.helpers[name] = fn; - } - }, - unregisterHelper: function unregisterHelper(name) { - delete this.helpers[name]; - }, - - registerPartial: function registerPartial(name, partial) { - if (_utils.toString.call(name) === objectType) { - _utils.extend(this.partials, name); - } else { - if (typeof partial === 'undefined') { - throw new _exception2['default']('Attempting to register a partial called "' + name + '" as undefined'); - } - this.partials[name] = partial; - } - }, - unregisterPartial: function unregisterPartial(name) { - delete this.partials[name]; - }, - - registerDecorator: function registerDecorator(name, fn) { - if (_utils.toString.call(name) === objectType) { - if (fn) { - throw new _exception2['default']('Arg not supported with multiple decorators'); - } - _utils.extend(this.decorators, name); - } else { - this.decorators[name] = fn; - } - }, - unregisterDecorator: function unregisterDecorator(name) { - delete this.decorators[name]; - }, - /** - * Reset the memory of illegal property accesses that have already been logged. - * @deprecated should only be used in handlebars test-cases - */ - resetLoggedPropertyAccesses: function resetLoggedPropertyAccesses() { - _internalProtoAccess.resetLoggedProperties(); - } - }; - - var log = _logger2['default'].log; - - exports.log = log; - exports.createFrame = _utils.createFrame; - exports.logger = _logger2['default']; - -/***/ }), -/* 4 */ -/***/ (function(module, exports) { - - 'use strict'; - - exports.__esModule = true; - exports.extend = extend; - exports.indexOf = indexOf; - exports.escapeExpression = escapeExpression; - exports.isEmpty = isEmpty; - exports.createFrame = createFrame; - exports.blockParams = blockParams; - exports.appendContextPath = appendContextPath; - var escape = { - '&': '&', - '<': '<', - '>': '>', - '"': '"', - "'": ''', - '`': '`', - '=': '=' - }; - - var badChars = /[&<>"'`=]/g, - possible = /[&<>"'`=]/; - - function escapeChar(chr) { - return escape[chr]; - } - - function extend(obj /* , ...source */) { - for (var i = 1; i < arguments.length; i++) { - for (var key in arguments[i]) { - if (Object.prototype.hasOwnProperty.call(arguments[i], key)) { - obj[key] = arguments[i][key]; - } - } - } - - return obj; - } - - var toString = Object.prototype.toString; - - exports.toString = toString; - // Sourced from lodash - // https://github.com/bestiejs/lodash/blob/master/LICENSE.txt - /* eslint-disable func-style */ - var isFunction = function isFunction(value) { - return typeof value === 'function'; - }; - // fallback for older versions of Chrome and Safari - /* istanbul ignore next */ - if (isFunction(/x/)) { - exports.isFunction = isFunction = function (value) { - return typeof value === 'function' && toString.call(value) === '[object Function]'; - }; - } - exports.isFunction = isFunction; - - /* eslint-enable func-style */ - - /* istanbul ignore next */ - var isArray = Array.isArray || function (value) { - return value && typeof value === 'object' ? toString.call(value) === '[object Array]' : false; - }; - - exports.isArray = isArray; - // Older IE versions do not directly support indexOf so we must implement our own, sadly. - - function indexOf(array, value) { - for (var i = 0, len = array.length; i < len; i++) { - if (array[i] === value) { - return i; - } - } - return -1; - } - - function escapeExpression(string) { - if (typeof string !== 'string') { - // don't escape SafeStrings, since they're already safe - if (string && string.toHTML) { - return string.toHTML(); - } else if (string == null) { - return ''; - } else if (!string) { - return string + ''; - } - - // Force a string conversion as this will be done by the append regardless and - // the regex test will do this transparently behind the scenes, causing issues if - // an object's to string has escaped characters in it. - string = '' + string; - } - - if (!possible.test(string)) { - return string; - } - return string.replace(badChars, escapeChar); - } - - function isEmpty(value) { - if (!value && value !== 0) { - return true; - } else if (isArray(value) && value.length === 0) { - return true; - } else { - return false; - } - } - - function createFrame(object) { - var frame = extend({}, object); - frame._parent = object; - return frame; - } - - function blockParams(params, ids) { - params.path = ids; - return params; - } - - function appendContextPath(contextPath, id) { - return (contextPath ? contextPath + '.' : '') + id; - } - -/***/ }), -/* 5 */ -/***/ (function(module, exports, __webpack_require__) { - - 'use strict'; - - var _Object$defineProperty = __webpack_require__(6)['default']; - - exports.__esModule = true; - var errorProps = ['description', 'fileName', 'lineNumber', 'endLineNumber', 'message', 'name', 'number', 'stack']; - - function Exception(message, node) { - var loc = node && node.loc, - line = undefined, - endLineNumber = undefined, - column = undefined, - endColumn = undefined; - - if (loc) { - line = loc.start.line; - endLineNumber = loc.end.line; - column = loc.start.column; - endColumn = loc.end.column; - - message += ' - ' + line + ':' + column; - } - - var tmp = Error.prototype.constructor.call(this, message); - - // Unfortunately errors are not enumerable in Chrome (at least), so `for prop in tmp` doesn't work. - for (var idx = 0; idx < errorProps.length; idx++) { - this[errorProps[idx]] = tmp[errorProps[idx]]; - } - - /* istanbul ignore else */ - if (Error.captureStackTrace) { - Error.captureStackTrace(this, Exception); - } - - try { - if (loc) { - this.lineNumber = line; - this.endLineNumber = endLineNumber; - - // Work around issue under safari where we can't directly set the column value - /* istanbul ignore next */ - if (_Object$defineProperty) { - Object.defineProperty(this, 'column', { - value: column, - enumerable: true - }); - Object.defineProperty(this, 'endColumn', { - value: endColumn, - enumerable: true - }); - } else { - this.column = column; - this.endColumn = endColumn; - } - } - } catch (nop) { - /* Ignore if the browser is very particular */ - } - } - - Exception.prototype = new Error(); - - exports['default'] = Exception; - module.exports = exports['default']; - -/***/ }), -/* 6 */ -/***/ (function(module, exports, __webpack_require__) { - - module.exports = { "default": __webpack_require__(7), __esModule: true }; - -/***/ }), -/* 7 */ -/***/ (function(module, exports, __webpack_require__) { - - var $ = __webpack_require__(8); - module.exports = function defineProperty(it, key, desc){ - return $.setDesc(it, key, desc); - }; - -/***/ }), -/* 8 */ -/***/ (function(module, exports) { - - var $Object = Object; - module.exports = { - create: $Object.create, - getProto: $Object.getPrototypeOf, - isEnum: {}.propertyIsEnumerable, - getDesc: $Object.getOwnPropertyDescriptor, - setDesc: $Object.defineProperty, - setDescs: $Object.defineProperties, - getKeys: $Object.keys, - getNames: $Object.getOwnPropertyNames, - getSymbols: $Object.getOwnPropertySymbols, - each: [].forEach - }; - -/***/ }), -/* 9 */ -/***/ (function(module, exports, __webpack_require__) { - - 'use strict'; - - var _interopRequireDefault = __webpack_require__(2)['default']; - - exports.__esModule = true; - exports.registerDefaultHelpers = registerDefaultHelpers; - exports.moveHelperToHooks = moveHelperToHooks; - - var _helpersBlockHelperMissing = __webpack_require__(10); - - var _helpersBlockHelperMissing2 = _interopRequireDefault(_helpersBlockHelperMissing); - - var _helpersEach = __webpack_require__(11); - - var _helpersEach2 = _interopRequireDefault(_helpersEach); - - var _helpersHelperMissing = __webpack_require__(24); - - var _helpersHelperMissing2 = _interopRequireDefault(_helpersHelperMissing); - - var _helpersIf = __webpack_require__(25); - - var _helpersIf2 = _interopRequireDefault(_helpersIf); - - var _helpersLog = __webpack_require__(26); - - var _helpersLog2 = _interopRequireDefault(_helpersLog); - - var _helpersLookup = __webpack_require__(27); - - var _helpersLookup2 = _interopRequireDefault(_helpersLookup); - - var _helpersWith = __webpack_require__(28); - - var _helpersWith2 = _interopRequireDefault(_helpersWith); - - function registerDefaultHelpers(instance) { - _helpersBlockHelperMissing2['default'](instance); - _helpersEach2['default'](instance); - _helpersHelperMissing2['default'](instance); - _helpersIf2['default'](instance); - _helpersLog2['default'](instance); - _helpersLookup2['default'](instance); - _helpersWith2['default'](instance); - } - - function moveHelperToHooks(instance, helperName, keepHelper) { - if (instance.helpers[helperName]) { - instance.hooks[helperName] = instance.helpers[helperName]; - if (!keepHelper) { - delete instance.helpers[helperName]; - } - } - } - -/***/ }), -/* 10 */ -/***/ (function(module, exports, __webpack_require__) { - - 'use strict'; - - exports.__esModule = true; - - var _utils = __webpack_require__(4); - - exports['default'] = function (instance) { - instance.registerHelper('blockHelperMissing', function (context, options) { - var inverse = options.inverse, - fn = options.fn; - - if (context === true) { - return fn(this); - } else if (context === false || context == null) { - return inverse(this); - } else if (_utils.isArray(context)) { - if (context.length > 0) { - if (options.ids) { - options.ids = [options.name]; - } - - return instance.helpers.each(context, options); - } else { - return inverse(this); - } - } else { - if (options.data && options.ids) { - var data = _utils.createFrame(options.data); - data.contextPath = _utils.appendContextPath(options.data.contextPath, options.name); - options = { data: data }; - } - - return fn(context, options); - } - }); - }; - - module.exports = exports['default']; - -/***/ }), -/* 11 */ -/***/ (function(module, exports, __webpack_require__) { - - /* WEBPACK VAR INJECTION */(function(global) {'use strict'; - - var _Object$keys = __webpack_require__(12)['default']; - - var _interopRequireDefault = __webpack_require__(2)['default']; - - exports.__esModule = true; - - var _utils = __webpack_require__(4); - - var _exception = __webpack_require__(5); - - var _exception2 = _interopRequireDefault(_exception); - - exports['default'] = function (instance) { - instance.registerHelper('each', function (context, options) { - if (!options) { - throw new _exception2['default']('Must pass iterator to #each'); - } - - var fn = options.fn, - inverse = options.inverse, - i = 0, - ret = '', - data = undefined, - contextPath = undefined; - - if (options.data && options.ids) { - contextPath = _utils.appendContextPath(options.data.contextPath, options.ids[0]) + '.'; - } - - if (_utils.isFunction(context)) { - context = context.call(this); - } - - if (options.data) { - data = _utils.createFrame(options.data); - } - - function execIteration(field, index, last) { - if (data) { - data.key = field; - data.index = index; - data.first = index === 0; - data.last = !!last; - - if (contextPath) { - data.contextPath = contextPath + field; - } - } - - ret = ret + fn(context[field], { - data: data, - blockParams: _utils.blockParams([context[field], field], [contextPath + field, null]) - }); - } - - if (context && typeof context === 'object') { - if (_utils.isArray(context)) { - for (var j = context.length; i < j; i++) { - if (i in context) { - execIteration(i, i, i === context.length - 1); - } - } - } else if (global.Symbol && context[global.Symbol.iterator]) { - var newContext = []; - var iterator = context[global.Symbol.iterator](); - for (var it = iterator.next(); !it.done; it = iterator.next()) { - newContext.push(it.value); - } - context = newContext; - for (var j = context.length; i < j; i++) { - execIteration(i, i, i === context.length - 1); - } - } else { - (function () { - var priorKey = undefined; - - _Object$keys(context).forEach(function (key) { - // We're running the iterations one step out of sync so we can detect - // the last iteration without have to scan the object twice and create - // an itermediate keys array. - if (priorKey !== undefined) { - execIteration(priorKey, i - 1); - } - priorKey = key; - i++; - }); - if (priorKey !== undefined) { - execIteration(priorKey, i - 1, true); - } - })(); - } - } - - if (i === 0) { - ret = inverse(this); - } - - return ret; - }); - }; - - module.exports = exports['default']; - /* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }()))) - -/***/ }), -/* 12 */ -/***/ (function(module, exports, __webpack_require__) { - - module.exports = { "default": __webpack_require__(13), __esModule: true }; - -/***/ }), -/* 13 */ -/***/ (function(module, exports, __webpack_require__) { - - __webpack_require__(14); - module.exports = __webpack_require__(20).Object.keys; - -/***/ }), -/* 14 */ -/***/ (function(module, exports, __webpack_require__) { - - // 19.1.2.14 Object.keys(O) - var toObject = __webpack_require__(15); - - __webpack_require__(17)('keys', function($keys){ - return function keys(it){ - return $keys(toObject(it)); - }; - }); - -/***/ }), -/* 15 */ -/***/ (function(module, exports, __webpack_require__) { - - // 7.1.13 ToObject(argument) - var defined = __webpack_require__(16); - module.exports = function(it){ - return Object(defined(it)); - }; - -/***/ }), -/* 16 */ -/***/ (function(module, exports) { - - // 7.2.1 RequireObjectCoercible(argument) - module.exports = function(it){ - if(it == undefined)throw TypeError("Can't call method on " + it); - return it; - }; - -/***/ }), -/* 17 */ -/***/ (function(module, exports, __webpack_require__) { - - // most Object methods by ES6 should accept primitives - var $export = __webpack_require__(18) - , core = __webpack_require__(20) - , fails = __webpack_require__(23); - module.exports = function(KEY, exec){ - var fn = (core.Object || {})[KEY] || Object[KEY] - , exp = {}; - exp[KEY] = exec(fn); - $export($export.S + $export.F * fails(function(){ fn(1); }), 'Object', exp); - }; - -/***/ }), -/* 18 */ -/***/ (function(module, exports, __webpack_require__) { - - var global = __webpack_require__(19) - , core = __webpack_require__(20) - , ctx = __webpack_require__(21) - , PROTOTYPE = 'prototype'; - - var $export = function(type, name, source){ - var IS_FORCED = type & $export.F - , IS_GLOBAL = type & $export.G - , IS_STATIC = type & $export.S - , IS_PROTO = type & $export.P - , IS_BIND = type & $export.B - , IS_WRAP = type & $export.W - , exports = IS_GLOBAL ? core : core[name] || (core[name] = {}) - , target = IS_GLOBAL ? global : IS_STATIC ? global[name] : (global[name] || {})[PROTOTYPE] - , key, own, out; - if(IS_GLOBAL)source = name; - for(key in source){ - // contains in native - own = !IS_FORCED && target && key in target; - if(own && key in exports)continue; - // export native or passed - out = own ? target[key] : source[key]; - // prevent global pollution for namespaces - exports[key] = IS_GLOBAL && typeof target[key] != 'function' ? source[key] - // bind timers to global for call from export context - : IS_BIND && own ? ctx(out, global) - // wrap global constructors for prevent change them in library - : IS_WRAP && target[key] == out ? (function(C){ - var F = function(param){ - return this instanceof C ? new C(param) : C(param); - }; - F[PROTOTYPE] = C[PROTOTYPE]; - return F; - // make static versions for prototype methods - })(out) : IS_PROTO && typeof out == 'function' ? ctx(Function.call, out) : out; - if(IS_PROTO)(exports[PROTOTYPE] || (exports[PROTOTYPE] = {}))[key] = out; - } - }; - // type bitmap - $export.F = 1; // forced - $export.G = 2; // global - $export.S = 4; // static - $export.P = 8; // proto - $export.B = 16; // bind - $export.W = 32; // wrap - module.exports = $export; - -/***/ }), -/* 19 */ -/***/ (function(module, exports) { - - // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028 - var global = module.exports = typeof window != 'undefined' && window.Math == Math - ? window : typeof self != 'undefined' && self.Math == Math ? self : Function('return this')(); - if(typeof __g == 'number')__g = global; // eslint-disable-line no-undef - -/***/ }), -/* 20 */ -/***/ (function(module, exports) { - - var core = module.exports = {version: '1.2.6'}; - if(typeof __e == 'number')__e = core; // eslint-disable-line no-undef - -/***/ }), -/* 21 */ -/***/ (function(module, exports, __webpack_require__) { - - // optional / simple context binding - var aFunction = __webpack_require__(22); - module.exports = function(fn, that, length){ - aFunction(fn); - if(that === undefined)return fn; - switch(length){ - case 1: return function(a){ - return fn.call(that, a); - }; - case 2: return function(a, b){ - return fn.call(that, a, b); - }; - case 3: return function(a, b, c){ - return fn.call(that, a, b, c); - }; - } - return function(/* ...args */){ - return fn.apply(that, arguments); - }; - }; - -/***/ }), -/* 22 */ -/***/ (function(module, exports) { - - module.exports = function(it){ - if(typeof it != 'function')throw TypeError(it + ' is not a function!'); - return it; - }; - -/***/ }), -/* 23 */ -/***/ (function(module, exports) { - - module.exports = function(exec){ - try { - return !!exec(); - } catch(e){ - return true; - } - }; - -/***/ }), -/* 24 */ -/***/ (function(module, exports, __webpack_require__) { - - 'use strict'; - - var _interopRequireDefault = __webpack_require__(2)['default']; - - exports.__esModule = true; - - var _exception = __webpack_require__(5); - - var _exception2 = _interopRequireDefault(_exception); - - exports['default'] = function (instance) { - instance.registerHelper('helperMissing', function () /* [args, ]options */{ - if (arguments.length === 1) { - // A missing field in a {{foo}} construct. - return undefined; - } else { - // Someone is actually trying to call something, blow up. - throw new _exception2['default']('Missing helper: "' + arguments[arguments.length - 1].name + '"'); - } - }); - }; - - module.exports = exports['default']; - -/***/ }), -/* 25 */ -/***/ (function(module, exports, __webpack_require__) { - - 'use strict'; - - var _interopRequireDefault = __webpack_require__(2)['default']; - - exports.__esModule = true; - - var _utils = __webpack_require__(4); - - var _exception = __webpack_require__(5); - - var _exception2 = _interopRequireDefault(_exception); - - exports['default'] = function (instance) { - instance.registerHelper('if', function (conditional, options) { - if (arguments.length != 2) { - throw new _exception2['default']('#if requires exactly one argument'); - } - if (_utils.isFunction(conditional)) { - conditional = conditional.call(this); - } - - // Default behavior is to render the positive path if the value is truthy and not empty. - // The `includeZero` option may be set to treat the condtional as purely not empty based on the - // behavior of isEmpty. Effectively this determines if 0 is handled by the positive path or negative. - if (!options.hash.includeZero && !conditional || _utils.isEmpty(conditional)) { - return options.inverse(this); - } else { - return options.fn(this); - } - }); - - instance.registerHelper('unless', function (conditional, options) { - if (arguments.length != 2) { - throw new _exception2['default']('#unless requires exactly one argument'); - } - return instance.helpers['if'].call(this, conditional, { - fn: options.inverse, - inverse: options.fn, - hash: options.hash - }); - }); - }; - - module.exports = exports['default']; - -/***/ }), -/* 26 */ -/***/ (function(module, exports) { - - 'use strict'; - - exports.__esModule = true; - - exports['default'] = function (instance) { - instance.registerHelper('log', function () /* message, options */{ - var args = [undefined], - options = arguments[arguments.length - 1]; - for (var i = 0; i < arguments.length - 1; i++) { - args.push(arguments[i]); - } - - var level = 1; - if (options.hash.level != null) { - level = options.hash.level; - } else if (options.data && options.data.level != null) { - level = options.data.level; - } - args[0] = level; - - instance.log.apply(instance, args); - }); - }; - - module.exports = exports['default']; - -/***/ }), -/* 27 */ -/***/ (function(module, exports) { - - 'use strict'; - - exports.__esModule = true; - - exports['default'] = function (instance) { - instance.registerHelper('lookup', function (obj, field, options) { - if (!obj) { - // Note for 5.0: Change to "obj == null" in 5.0 - return obj; - } - return options.lookupProperty(obj, field); - }); - }; - - module.exports = exports['default']; - -/***/ }), -/* 28 */ -/***/ (function(module, exports, __webpack_require__) { - - 'use strict'; - - var _interopRequireDefault = __webpack_require__(2)['default']; - - exports.__esModule = true; - - var _utils = __webpack_require__(4); - - var _exception = __webpack_require__(5); - - var _exception2 = _interopRequireDefault(_exception); - - exports['default'] = function (instance) { - instance.registerHelper('with', function (context, options) { - if (arguments.length != 2) { - throw new _exception2['default']('#with requires exactly one argument'); - } - if (_utils.isFunction(context)) { - context = context.call(this); - } - - var fn = options.fn; - - if (!_utils.isEmpty(context)) { - var data = options.data; - if (options.data && options.ids) { - data = _utils.createFrame(options.data); - data.contextPath = _utils.appendContextPath(options.data.contextPath, options.ids[0]); - } - - return fn(context, { - data: data, - blockParams: _utils.blockParams([context], [data && data.contextPath]) - }); - } else { - return options.inverse(this); - } - }); - }; - - module.exports = exports['default']; - -/***/ }), -/* 29 */ -/***/ (function(module, exports, __webpack_require__) { - - 'use strict'; - - var _interopRequireDefault = __webpack_require__(2)['default']; - - exports.__esModule = true; - exports.registerDefaultDecorators = registerDefaultDecorators; - - var _decoratorsInline = __webpack_require__(30); - - var _decoratorsInline2 = _interopRequireDefault(_decoratorsInline); - - function registerDefaultDecorators(instance) { - _decoratorsInline2['default'](instance); - } - -/***/ }), -/* 30 */ -/***/ (function(module, exports, __webpack_require__) { - - 'use strict'; - - exports.__esModule = true; - - var _utils = __webpack_require__(4); - - exports['default'] = function (instance) { - instance.registerDecorator('inline', function (fn, props, container, options) { - var ret = fn; - if (!props.partials) { - props.partials = {}; - ret = function (context, options) { - // Create a new partials stack frame prior to exec. - var original = container.partials; - container.partials = _utils.extend({}, original, props.partials); - var ret = fn(context, options); - container.partials = original; - return ret; - }; - } - - props.partials[options.args[0]] = options.fn; - - return ret; - }); - }; - - module.exports = exports['default']; - -/***/ }), -/* 31 */ -/***/ (function(module, exports, __webpack_require__) { - - 'use strict'; - - exports.__esModule = true; - - var _utils = __webpack_require__(4); - - var logger = { - methodMap: ['debug', 'info', 'warn', 'error'], - level: 'info', - - // Maps a given level value to the `methodMap` indexes above. - lookupLevel: function lookupLevel(level) { - if (typeof level === 'string') { - var levelMap = _utils.indexOf(logger.methodMap, level.toLowerCase()); - if (levelMap >= 0) { - level = levelMap; - } else { - level = parseInt(level, 10); - } - } - - return level; - }, - - // Can be overridden in the host environment - log: function log(level) { - level = logger.lookupLevel(level); - - if (typeof console !== 'undefined' && logger.lookupLevel(logger.level) <= level) { - var method = logger.methodMap[level]; - // eslint-disable-next-line no-console - if (!console[method]) { - method = 'log'; - } - - for (var _len = arguments.length, message = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { - message[_key - 1] = arguments[_key]; - } - - console[method].apply(console, message); // eslint-disable-line no-console - } - } - }; - - exports['default'] = logger; - module.exports = exports['default']; - -/***/ }), -/* 32 */ -/***/ (function(module, exports, __webpack_require__) { - - 'use strict'; - - var _Object$create = __webpack_require__(33)['default']; - - var _Object$keys = __webpack_require__(12)['default']; - - var _interopRequireWildcard = __webpack_require__(1)['default']; - - exports.__esModule = true; - exports.createProtoAccessControl = createProtoAccessControl; - exports.resultIsAllowed = resultIsAllowed; - exports.resetLoggedProperties = resetLoggedProperties; - - var _createNewLookupObject = __webpack_require__(35); - - var _logger = __webpack_require__(31); - - var logger = _interopRequireWildcard(_logger); - - var loggedProperties = _Object$create(null); - - function createProtoAccessControl(runtimeOptions) { - var defaultMethodWhiteList = _Object$create(null); - defaultMethodWhiteList['constructor'] = false; - defaultMethodWhiteList['__defineGetter__'] = false; - defaultMethodWhiteList['__defineSetter__'] = false; - defaultMethodWhiteList['__lookupGetter__'] = false; - - var defaultPropertyWhiteList = _Object$create(null); - // eslint-disable-next-line no-proto - defaultPropertyWhiteList['__proto__'] = false; - - return { - properties: { - whitelist: _createNewLookupObject.createNewLookupObject(defaultPropertyWhiteList, runtimeOptions.allowedProtoProperties), - defaultValue: runtimeOptions.allowProtoPropertiesByDefault - }, - methods: { - whitelist: _createNewLookupObject.createNewLookupObject(defaultMethodWhiteList, runtimeOptions.allowedProtoMethods), - defaultValue: runtimeOptions.allowProtoMethodsByDefault - } - }; - } - - function resultIsAllowed(result, protoAccessControl, propertyName) { - if (typeof result === 'function') { - return checkWhiteList(protoAccessControl.methods, propertyName); - } else { - return checkWhiteList(protoAccessControl.properties, propertyName); - } - } - - function checkWhiteList(protoAccessControlForType, propertyName) { - if (protoAccessControlForType.whitelist[propertyName] !== undefined) { - return protoAccessControlForType.whitelist[propertyName] === true; - } - if (protoAccessControlForType.defaultValue !== undefined) { - return protoAccessControlForType.defaultValue; - } - logUnexpecedPropertyAccessOnce(propertyName); - return false; - } - - function logUnexpecedPropertyAccessOnce(propertyName) { - if (loggedProperties[propertyName] !== true) { - loggedProperties[propertyName] = true; - logger.log('error', 'Handlebars: Access has been denied to resolve the property "' + propertyName + '" because it is not an "own property" of its parent.\n' + 'You can add a runtime option to disable the check or this warning:\n' + 'See https://handlebarsjs.com/api-reference/runtime-options.html#options-to-control-prototype-access for details'); - } - } - - function resetLoggedProperties() { - _Object$keys(loggedProperties).forEach(function (propertyName) { - delete loggedProperties[propertyName]; - }); - } - -/***/ }), -/* 33 */ -/***/ (function(module, exports, __webpack_require__) { - - module.exports = { "default": __webpack_require__(34), __esModule: true }; - -/***/ }), -/* 34 */ -/***/ (function(module, exports, __webpack_require__) { - - var $ = __webpack_require__(8); - module.exports = function create(P, D){ - return $.create(P, D); - }; - -/***/ }), -/* 35 */ -/***/ (function(module, exports, __webpack_require__) { - - 'use strict'; - - var _Object$create = __webpack_require__(33)['default']; - - exports.__esModule = true; - exports.createNewLookupObject = createNewLookupObject; - - var _utils = __webpack_require__(4); - - /** - * Create a new object with "null"-prototype to avoid truthy results on prototype properties. - * The resulting object can be used with "object[property]" to check if a property exists - * @param {...object} sources a varargs parameter of source objects that will be merged - * @returns {object} - */ - - function createNewLookupObject() { - for (var _len = arguments.length, sources = Array(_len), _key = 0; _key < _len; _key++) { - sources[_key] = arguments[_key]; - } - - return _utils.extend.apply(undefined, [_Object$create(null)].concat(sources)); - } - -/***/ }), -/* 36 */ -/***/ (function(module, exports) { - - // Build out our basic SafeString type - 'use strict'; - - exports.__esModule = true; - function SafeString(string) { - this.string = string; - } - - SafeString.prototype.toString = SafeString.prototype.toHTML = function () { - return '' + this.string; - }; - - exports['default'] = SafeString; - module.exports = exports['default']; - -/***/ }), -/* 37 */ -/***/ (function(module, exports, __webpack_require__) { - - 'use strict'; - - var _Object$seal = __webpack_require__(38)['default']; - - var _Object$keys = __webpack_require__(12)['default']; - - var _interopRequireWildcard = __webpack_require__(1)['default']; - - var _interopRequireDefault = __webpack_require__(2)['default']; - - exports.__esModule = true; - exports.checkRevision = checkRevision; - exports.template = template; - exports.wrapProgram = wrapProgram; - exports.resolvePartial = resolvePartial; - exports.invokePartial = invokePartial; - exports.noop = noop; - - var _utils = __webpack_require__(4); - - var Utils = _interopRequireWildcard(_utils); - - var _exception = __webpack_require__(5); - - var _exception2 = _interopRequireDefault(_exception); - - var _base = __webpack_require__(3); - - var _helpers = __webpack_require__(9); - - var _internalWrapHelper = __webpack_require__(42); - - var _internalProtoAccess = __webpack_require__(32); - - function checkRevision(compilerInfo) { - var compilerRevision = compilerInfo && compilerInfo[0] || 1, - currentRevision = _base.COMPILER_REVISION; - - if (compilerRevision >= _base.LAST_COMPATIBLE_COMPILER_REVISION && compilerRevision <= _base.COMPILER_REVISION) { - return; - } - - if (compilerRevision < _base.LAST_COMPATIBLE_COMPILER_REVISION) { - var runtimeVersions = _base.REVISION_CHANGES[currentRevision], - compilerVersions = _base.REVISION_CHANGES[compilerRevision]; - throw new _exception2['default']('Template was precompiled with an older version of Handlebars than the current runtime. ' + 'Please update your precompiler to a newer version (' + runtimeVersions + ') or downgrade your runtime to an older version (' + compilerVersions + ').'); - } else { - // Use the embedded version info since the runtime doesn't know about this revision yet - throw new _exception2['default']('Template was precompiled with a newer version of Handlebars than the current runtime. ' + 'Please update your runtime to a newer version (' + compilerInfo[1] + ').'); - } - } - - function template(templateSpec, env) { - /* istanbul ignore next */ - if (!env) { - throw new _exception2['default']('No environment passed to template'); - } - if (!templateSpec || !templateSpec.main) { - throw new _exception2['default']('Unknown template object: ' + typeof templateSpec); - } - - templateSpec.main.decorator = templateSpec.main_d; - - // Note: Using env.VM references rather than local var references throughout this section to allow - // for external users to override these as pseudo-supported APIs. - env.VM.checkRevision(templateSpec.compiler); - - // backwards compatibility for precompiled templates with compiler-version 7 (<4.3.0) - var templateWasPrecompiledWithCompilerV7 = templateSpec.compiler && templateSpec.compiler[0] === 7; - - function invokePartialWrapper(partial, context, options) { - if (options.hash) { - context = Utils.extend({}, context, options.hash); - if (options.ids) { - options.ids[0] = true; - } - } - partial = env.VM.resolvePartial.call(this, partial, context, options); - - var extendedOptions = Utils.extend({}, options, { - hooks: this.hooks, - protoAccessControl: this.protoAccessControl - }); - - var result = env.VM.invokePartial.call(this, partial, context, extendedOptions); - - if (result == null && env.compile) { - options.partials[options.name] = env.compile(partial, templateSpec.compilerOptions, env); - result = options.partials[options.name](context, extendedOptions); - } - if (result != null) { - if (options.indent) { - var lines = result.split('\n'); - for (var i = 0, l = lines.length; i < l; i++) { - if (!lines[i] && i + 1 === l) { - break; - } - - lines[i] = options.indent + lines[i]; - } - result = lines.join('\n'); - } - return result; - } else { - throw new _exception2['default']('The partial ' + options.name + ' could not be compiled when running in runtime-only mode'); - } - } - - // Just add water - var container = { - strict: function strict(obj, name, loc) { - if (!obj || !(name in obj)) { - throw new _exception2['default']('"' + name + '" not defined in ' + obj, { - loc: loc - }); - } - return container.lookupProperty(obj, name); - }, - lookupProperty: function lookupProperty(parent, propertyName) { - var result = parent[propertyName]; - if (result == null) { - return result; - } - if (Object.prototype.hasOwnProperty.call(parent, propertyName)) { - return result; - } - - if (_internalProtoAccess.resultIsAllowed(result, container.protoAccessControl, propertyName)) { - return result; - } - return undefined; - }, - lookup: function lookup(depths, name) { - var len = depths.length; - for (var i = 0; i < len; i++) { - var result = depths[i] && container.lookupProperty(depths[i], name); - if (result != null) { - return depths[i][name]; - } - } - }, - lambda: function lambda(current, context) { - return typeof current === 'function' ? current.call(context) : current; - }, - - escapeExpression: Utils.escapeExpression, - invokePartial: invokePartialWrapper, - - fn: function fn(i) { - var ret = templateSpec[i]; - ret.decorator = templateSpec[i + '_d']; - return ret; - }, - - programs: [], - program: function program(i, data, declaredBlockParams, blockParams, depths) { - var programWrapper = this.programs[i], - fn = this.fn(i); - if (data || depths || blockParams || declaredBlockParams) { - programWrapper = wrapProgram(this, i, fn, data, declaredBlockParams, blockParams, depths); - } else if (!programWrapper) { - programWrapper = this.programs[i] = wrapProgram(this, i, fn); - } - return programWrapper; - }, - - data: function data(value, depth) { - while (value && depth--) { - value = value._parent; - } - return value; - }, - mergeIfNeeded: function mergeIfNeeded(param, common) { - var obj = param || common; - - if (param && common && param !== common) { - obj = Utils.extend({}, common, param); - } - - return obj; - }, - // An empty object to use as replacement for null-contexts - nullContext: _Object$seal({}), - - noop: env.VM.noop, - compilerInfo: templateSpec.compiler - }; - - function ret(context) { - var options = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1]; - - var data = options.data; - - ret._setup(options); - if (!options.partial && templateSpec.useData) { - data = initData(context, data); - } - var depths = undefined, - blockParams = templateSpec.useBlockParams ? [] : undefined; - if (templateSpec.useDepths) { - if (options.depths) { - depths = context != options.depths[0] ? [context].concat(options.depths) : options.depths; - } else { - depths = [context]; - } - } - - function main(context /*, options*/) { - return '' + templateSpec.main(container, context, container.helpers, container.partials, data, blockParams, depths); - } - - main = executeDecorators(templateSpec.main, main, container, options.depths || [], data, blockParams); - return main(context, options); - } - - ret.isTop = true; - - ret._setup = function (options) { - if (!options.partial) { - var mergedHelpers = Utils.extend({}, env.helpers, options.helpers); - wrapHelpersToPassLookupProperty(mergedHelpers, container); - container.helpers = mergedHelpers; - - if (templateSpec.usePartial) { - // Use mergeIfNeeded here to prevent compiling global partials multiple times - container.partials = container.mergeIfNeeded(options.partials, env.partials); - } - if (templateSpec.usePartial || templateSpec.useDecorators) { - container.decorators = Utils.extend({}, env.decorators, options.decorators); - } - - container.hooks = {}; - container.protoAccessControl = _internalProtoAccess.createProtoAccessControl(options); - - var keepHelperInHelpers = options.allowCallsToHelperMissing || templateWasPrecompiledWithCompilerV7; - _helpers.moveHelperToHooks(container, 'helperMissing', keepHelperInHelpers); - _helpers.moveHelperToHooks(container, 'blockHelperMissing', keepHelperInHelpers); - } else { - container.protoAccessControl = options.protoAccessControl; // internal option - container.helpers = options.helpers; - container.partials = options.partials; - container.decorators = options.decorators; - container.hooks = options.hooks; - } - }; - - ret._child = function (i, data, blockParams, depths) { - if (templateSpec.useBlockParams && !blockParams) { - throw new _exception2['default']('must pass block params'); - } - if (templateSpec.useDepths && !depths) { - throw new _exception2['default']('must pass parent depths'); - } - - return wrapProgram(container, i, templateSpec[i], data, 0, blockParams, depths); - }; - return ret; - } - - function wrapProgram(container, i, fn, data, declaredBlockParams, blockParams, depths) { - function prog(context) { - var options = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1]; - - var currentDepths = depths; - if (depths && context != depths[0] && !(context === container.nullContext && depths[0] === null)) { - currentDepths = [context].concat(depths); - } - - return fn(container, context, container.helpers, container.partials, options.data || data, blockParams && [options.blockParams].concat(blockParams), currentDepths); - } - - prog = executeDecorators(fn, prog, container, depths, data, blockParams); - - prog.program = i; - prog.depth = depths ? depths.length : 0; - prog.blockParams = declaredBlockParams || 0; - return prog; - } - - /** - * This is currently part of the official API, therefore implementation details should not be changed. - */ - - function resolvePartial(partial, context, options) { - if (!partial) { - if (options.name === '@partial-block') { - partial = options.data['partial-block']; - } else { - partial = options.partials[options.name]; - } - } else if (!partial.call && !options.name) { - // This is a dynamic partial that returned a string - options.name = partial; - partial = options.partials[partial]; - } - return partial; - } - - function invokePartial(partial, context, options) { - // Use the current closure context to save the partial-block if this partial - var currentPartialBlock = options.data && options.data['partial-block']; - options.partial = true; - if (options.ids) { - options.data.contextPath = options.ids[0] || options.data.contextPath; - } - - var partialBlock = undefined; - if (options.fn && options.fn !== noop) { - (function () { - options.data = _base.createFrame(options.data); - // Wrapper function to get access to currentPartialBlock from the closure - var fn = options.fn; - partialBlock = options.data['partial-block'] = function partialBlockWrapper(context) { - var options = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1]; - - // Restore the partial-block from the closure for the execution of the block - // i.e. the part inside the block of the partial call. - options.data = _base.createFrame(options.data); - options.data['partial-block'] = currentPartialBlock; - return fn(context, options); - }; - if (fn.partials) { - options.partials = Utils.extend({}, options.partials, fn.partials); - } - })(); - } - - if (partial === undefined && partialBlock) { - partial = partialBlock; - } - - if (partial === undefined) { - throw new _exception2['default']('The partial ' + options.name + ' could not be found'); - } else if (partial instanceof Function) { - return partial(context, options); - } - } - - function noop() { - return ''; - } - - function initData(context, data) { - if (!data || !('root' in data)) { - data = data ? _base.createFrame(data) : {}; - data.root = context; - } - return data; - } - - function executeDecorators(fn, prog, container, depths, data, blockParams) { - if (fn.decorator) { - var props = {}; - prog = fn.decorator(prog, props, container, depths && depths[0], data, blockParams, depths); - Utils.extend(prog, props); - } - return prog; - } - - function wrapHelpersToPassLookupProperty(mergedHelpers, container) { - _Object$keys(mergedHelpers).forEach(function (helperName) { - var helper = mergedHelpers[helperName]; - mergedHelpers[helperName] = passLookupPropertyOption(helper, container); - }); - } - - function passLookupPropertyOption(helper, container) { - var lookupProperty = container.lookupProperty; - return _internalWrapHelper.wrapHelper(helper, function (options) { - return Utils.extend({ lookupProperty: lookupProperty }, options); - }); - } - -/***/ }), -/* 38 */ -/***/ (function(module, exports, __webpack_require__) { - - module.exports = { "default": __webpack_require__(39), __esModule: true }; - -/***/ }), -/* 39 */ -/***/ (function(module, exports, __webpack_require__) { - - __webpack_require__(40); - module.exports = __webpack_require__(20).Object.seal; - -/***/ }), -/* 40 */ -/***/ (function(module, exports, __webpack_require__) { - - // 19.1.2.17 Object.seal(O) - var isObject = __webpack_require__(41); - - __webpack_require__(17)('seal', function($seal){ - return function seal(it){ - return $seal && isObject(it) ? $seal(it) : it; - }; - }); - -/***/ }), -/* 41 */ -/***/ (function(module, exports) { - - module.exports = function(it){ - return typeof it === 'object' ? it !== null : typeof it === 'function'; - }; - -/***/ }), -/* 42 */ -/***/ (function(module, exports) { - - 'use strict'; - - exports.__esModule = true; - exports.wrapHelper = wrapHelper; - - function wrapHelper(helper, transformOptionsFn) { - if (typeof helper !== 'function') { - // This should not happen, but apparently it does in https://github.com/wycats/handlebars.js/issues/1639 - // We try to make the wrapper least-invasive by not wrapping it, if the helper is not a function. - return helper; - } - var wrapper = function wrapper() /* dynamic arguments */{ - var options = arguments[arguments.length - 1]; - arguments[arguments.length - 1] = transformOptionsFn(options); - return helper.apply(this, arguments); - }; - return wrapper; - } - -/***/ }), -/* 43 */ -/***/ (function(module, exports) { - - /* WEBPACK VAR INJECTION */(function(global) {'use strict'; - - exports.__esModule = true; - - exports['default'] = function (Handlebars) { - /* istanbul ignore next */ - var root = typeof global !== 'undefined' ? global : window, - $Handlebars = root.Handlebars; - /* istanbul ignore next */ - Handlebars.noConflict = function () { - if (root.Handlebars === Handlebars) { - root.Handlebars = $Handlebars; - } - return Handlebars; - }; - }; - - module.exports = exports['default']; - /* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }()))) - -/***/ }) -/******/ ]) -}); -; \ No newline at end of file +/* exported Handlebars */ +var Handlebars = (function() { +// handlebars/safe-string.js +var __module3__ = (function() { + "use strict"; + var __exports__; + // Build out our basic SafeString type + function SafeString(string) { + this.string = string; + } + + SafeString.prototype.toString = function() { + return "" + this.string; + }; + + __exports__ = SafeString; + return __exports__; +})(); + +// handlebars/utils.js +var __module2__ = (function(__dependency1__) { + "use strict"; + var __exports__ = {}; + /*jshint -W004 */ + var SafeString = __dependency1__; + + var escape = { + "&": "&", + "<": "<", + ">": ">", + '"': """, + "'": "'", + "`": "`" + }; + + var badChars = /[&<>"'`]/g; + var possible = /[&<>"'`]/; + + function escapeChar(chr) { + return escape[chr] || "&"; + } + + function extend(obj, value) { + for(var key in value) { + if(Object.prototype.hasOwnProperty.call(value, key)) { + obj[key] = value[key]; + } + } + } + + __exports__.extend = extend;var toString = Object.prototype.toString; + __exports__.toString = toString; + // Sourced from lodash + // https://github.com/bestiejs/lodash/blob/master/LICENSE.txt + var isFunction = function(value) { + return typeof value === 'function'; + }; + // fallback for older versions of Chrome and Safari + if (isFunction(/x/)) { + isFunction = function(value) { + return typeof value === 'function' && toString.call(value) === '[object Function]'; + }; + } + var isFunction; + __exports__.isFunction = isFunction; + var isArray = Array.isArray || function(value) { + return (value && typeof value === 'object') ? toString.call(value) === '[object Array]' : false; + }; + __exports__.isArray = isArray; + + function escapeExpression(string) { + // don't escape SafeStrings, since they're already safe + if (string instanceof SafeString) { + return string.toString(); + } else if (!string && string !== 0) { + return ""; + } + + // Force a string conversion as this will be done by the append regardless and + // the regex test will do this transparently behind the scenes, causing issues if + // an object's to string has escaped characters in it. + string = "" + string; + + if(!possible.test(string)) { return string; } + return string.replace(badChars, escapeChar); + } + + __exports__.escapeExpression = escapeExpression;function isEmpty(value) { + if (!value && value !== 0) { + return true; + } else if (isArray(value) && value.length === 0) { + return true; + } else { + return false; + } + } + + __exports__.isEmpty = isEmpty; + return __exports__; +})(__module3__); + +// handlebars/exception.js +var __module4__ = (function() { + "use strict"; + var __exports__; + + var errorProps = ['description', 'fileName', 'lineNumber', 'message', 'name', 'number', 'stack']; + + function Exception(message, node) { + var line; + if (node && node.firstLine) { + line = node.firstLine; + + message += ' - ' + line + ':' + node.firstColumn; + } + + var tmp = Error.prototype.constructor.call(this, message); + + // Unfortunately errors are not enumerable in Chrome (at least), so `for prop in tmp` doesn't work. + for (var idx = 0; idx < errorProps.length; idx++) { + this[errorProps[idx]] = tmp[errorProps[idx]]; + } + + if (line) { + this.lineNumber = line; + this.column = node.firstColumn; + } + } + + Exception.prototype = new Error(); + + __exports__ = Exception; + return __exports__; +})(); + +// handlebars/base.js +var __module1__ = (function(__dependency1__, __dependency2__) { + "use strict"; + var __exports__ = {}; + var Utils = __dependency1__; + var Exception = __dependency2__; + + var VERSION = "1.3.0"; + __exports__.VERSION = VERSION;var COMPILER_REVISION = 4; + __exports__.COMPILER_REVISION = COMPILER_REVISION; + var REVISION_CHANGES = { + 1: '<= 1.0.rc.2', // 1.0.rc.2 is actually rev2 but doesn't report it + 2: '== 1.0.0-rc.3', + 3: '== 1.0.0-rc.4', + 4: '>= 1.0.0' + }; + __exports__.REVISION_CHANGES = REVISION_CHANGES; + var isArray = Utils.isArray, + isFunction = Utils.isFunction, + toString = Utils.toString, + objectType = '[object Object]'; + + function HandlebarsEnvironment(helpers, partials) { + this.helpers = helpers || {}; + this.partials = partials || {}; + + registerDefaultHelpers(this); + } + + __exports__.HandlebarsEnvironment = HandlebarsEnvironment;HandlebarsEnvironment.prototype = { + constructor: HandlebarsEnvironment, + + logger: logger, + log: log, + + registerHelper: function(name, fn, inverse) { + if (toString.call(name) === objectType) { + if (inverse || fn) { throw new Exception('Arg not supported with multiple helpers'); } + Utils.extend(this.helpers, name); + } else { + if (inverse) { fn.not = inverse; } + this.helpers[name] = fn; + } + }, + + registerPartial: function(name, str) { + if (toString.call(name) === objectType) { + Utils.extend(this.partials, name); + } else { + this.partials[name] = str; + } + } + }; + + function registerDefaultHelpers(instance) { + instance.registerHelper('helperMissing', function(arg) { + if(arguments.length === 2) { + return undefined; + } else { + throw new Exception("Missing helper: '" + arg + "'"); + } + }); + + instance.registerHelper('blockHelperMissing', function(context, options) { + var inverse = options.inverse || function() {}, fn = options.fn; + + if (isFunction(context)) { context = context.call(this); } + + if(context === true) { + return fn(this); + } else if(context === false || context == null) { + return inverse(this); + } else if (isArray(context)) { + if(context.length > 0) { + return instance.helpers.each(context, options); + } else { + return inverse(this); + } + } else { + return fn(context); + } + }); + + instance.registerHelper('each', function(context, options) { + var fn = options.fn, inverse = options.inverse; + var i = 0, ret = "", data; + + if (isFunction(context)) { context = context.call(this); } + + if (options.data) { + data = createFrame(options.data); + } + + if(context && typeof context === 'object') { + if (isArray(context)) { + for(var j = context.length; i