fluentd-ui 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of fluentd-ui might be problematic. Click here for more details.
- checksums.yaml +7 -0
- data/.bowerrc +3 -0
- data/.gitignore +31 -0
- data/.rspec +1 -0
- data/ChangeLog +3 -0
- data/Gemfile +21 -0
- data/Gemfile.lock +247 -0
- data/Gemfile.production +3 -0
- data/README.md +53 -0
- data/Rakefile +8 -0
- data/app/assets/images/.keep +0 -0
- data/app/assets/javascripts/alert.js +51 -0
- data/app/assets/javascripts/application.js +22 -0
- data/app/assets/javascripts/nested_setting.js +41 -0
- data/app/assets/javascripts/setting_format.js +15 -0
- data/app/assets/javascripts/tutorial.js +58 -0
- data/app/assets/javascripts/vue/fluent_log.js +64 -0
- data/app/assets/javascripts/vue/in_tail_format.js +153 -0
- data/app/assets/javascripts/vue/treeview.js +97 -0
- data/app/assets/javascripts/vue_common.js +4 -0
- data/app/assets/stylesheets/application.css +18 -0
- data/app/assets/stylesheets/common.css.scss +152 -0
- data/app/controllers/api_controller.rb +37 -0
- data/app/controllers/application_controller.rb +110 -0
- data/app/controllers/concerns/.keep +0 -0
- data/app/controllers/fluentd/agents_controller.rb +35 -0
- data/app/controllers/fluentd/settings/in_syslog_controller.rb +34 -0
- data/app/controllers/fluentd/settings/in_tail_controller.rb +57 -0
- data/app/controllers/fluentd/settings/out_forward_controller.rb +42 -0
- data/app/controllers/fluentd/settings/out_mongo_controller.rb +36 -0
- data/app/controllers/fluentd/settings/out_s3_controller.rb +36 -0
- data/app/controllers/fluentd/settings/out_td_controller.rb +36 -0
- data/app/controllers/fluentd/settings_controller.rb +18 -0
- data/app/controllers/fluentd_controller.rb +62 -0
- data/app/controllers/misc_controller.rb +69 -0
- data/app/controllers/plugins_controller.rb +44 -0
- data/app/controllers/polling_controller.rb +20 -0
- data/app/controllers/sessions_controller.rb +45 -0
- data/app/controllers/tutorials_controller.rb +40 -0
- data/app/controllers/users_controller.rb +28 -0
- data/app/controllers/welcome_controller.rb +5 -0
- data/app/helpers/application_helper.rb +55 -0
- data/app/helpers/fluentd/settings_helper.rb +2 -0
- data/app/helpers/miscs_helper.rb +2 -0
- data/app/helpers/settings_helper.rb +43 -0
- data/app/mailers/.keep +0 -0
- data/app/models/.keep +0 -0
- data/app/models/concerns/.keep +0 -0
- data/app/models/fluentd.rb +178 -0
- data/app/models/fluentd/agent.rb +28 -0
- data/app/models/fluentd/agent/common.rb +76 -0
- data/app/models/fluentd/agent/configuration.rb +35 -0
- data/app/models/fluentd/agent/fluentd_gem.rb +104 -0
- data/app/models/fluentd/agent/local_common.rb +101 -0
- data/app/models/fluentd/agent/remote.rb +7 -0
- data/app/models/fluentd/agent/td_agent.rb +44 -0
- data/app/models/fluentd/api.rb +6 -0
- data/app/models/fluentd/api/http.rb +26 -0
- data/app/models/fluentd/setting.rb +4 -0
- data/app/models/fluentd/setting/common.rb +185 -0
- data/app/models/fluentd/setting/in_syslog.rb +16 -0
- data/app/models/fluentd/setting/in_tail.rb +107 -0
- data/app/models/fluentd/setting/out_forward.rb +70 -0
- data/app/models/fluentd/setting/out_mongo.rb +35 -0
- data/app/models/fluentd/setting/out_s3.rb +29 -0
- data/app/models/fluentd/setting/out_td.rb +26 -0
- data/app/models/plugin.rb +193 -0
- data/app/models/settings.rb +4 -0
- data/app/models/user.rb +52 -0
- data/app/views/fluentd/_form.html.haml +31 -0
- data/app/views/fluentd/edit.html.haml +3 -0
- data/app/views/fluentd/errors.html.haml +19 -0
- data/app/views/fluentd/log.html.haml +9 -0
- data/app/views/fluentd/new.html.haml +3 -0
- data/app/views/fluentd/settings/_form.html.haml +43 -0
- data/app/views/fluentd/settings/edit.html.haml +7 -0
- data/app/views/fluentd/settings/in_syslog/_form.html.haml +9 -0
- data/app/views/fluentd/settings/in_syslog/show.html.haml +6 -0
- data/app/views/fluentd/settings/in_tail/_form.html.haml +42 -0
- data/app/views/fluentd/settings/in_tail/after_file_choose.html.haml +19 -0
- data/app/views/fluentd/settings/in_tail/after_format.html.haml +10 -0
- data/app/views/fluentd/settings/in_tail/confirm.html.haml +13 -0
- data/app/views/fluentd/settings/in_tail/show.html.haml +5 -0
- data/app/views/fluentd/settings/out_forward/_form.html.haml +22 -0
- data/app/views/fluentd/settings/out_forward/show.html.haml +6 -0
- data/app/views/fluentd/settings/out_mongo/_form.html.haml +30 -0
- data/app/views/fluentd/settings/out_mongo/finish.html.haml +4 -0
- data/app/views/fluentd/settings/out_mongo/show.html.haml +6 -0
- data/app/views/fluentd/settings/out_s3/_form.html.haml +39 -0
- data/app/views/fluentd/settings/out_s3/show.html.haml +6 -0
- data/app/views/fluentd/settings/out_td/_form.html.haml +18 -0
- data/app/views/fluentd/settings/out_td/show.html.haml +6 -0
- data/app/views/fluentd/settings/show.html.haml +10 -0
- data/app/views/fluentd/settings/source_and_output.html.haml +45 -0
- data/app/views/fluentd/show.html.haml +60 -0
- data/app/views/layouts/application.html.erb +102 -0
- data/app/views/layouts/sign_in.html.erb +28 -0
- data/app/views/misc/information.html.haml +75 -0
- data/app/views/misc/update_fluentd_ui.html.haml +45 -0
- data/app/views/plugins/installed.html.haml +67 -0
- data/app/views/plugins/recommended.html.haml +59 -0
- data/app/views/plugins/updated.html.haml +29 -0
- data/app/views/sessions/new.html.haml +13 -0
- data/app/views/shared/_error.html.haml +3 -0
- data/app/views/shared/_flash.html.haml +10 -0
- data/app/views/shared/_fluentd_nav.html.haml +12 -0
- data/app/views/shared/_global_nav.html.erb +80 -0
- data/app/views/shared/_initial_setup.html.haml +13 -0
- data/app/views/shared/_modal.html.erb +25 -0
- data/app/views/shared/_setting_errors.html.haml +5 -0
- data/app/views/shared/vue/_fluent_log.html.erb +25 -0
- data/app/views/shared/vue/_in_tail_format.html.erb +53 -0
- data/app/views/shared/vue/_treeview.html.erb +30 -0
- data/app/views/tutorials/chapter1.html.erb +31 -0
- data/app/views/tutorials/chapter2.html.haml +12 -0
- data/app/views/tutorials/chapter3.html.haml +12 -0
- data/app/views/tutorials/chapter4.html.haml +12 -0
- data/app/views/tutorials/chapter5.html.haml +10 -0
- data/app/views/tutorials/index.html.haml +26 -0
- data/app/views/users/show.html.haml +22 -0
- data/app/workers/all_plugin_check_update.rb +14 -0
- data/app/workers/fluentd_ui_restart.rb +41 -0
- data/app/workers/fluentd_ui_update_check.rb +15 -0
- data/app/workers/gem_installer.rb +17 -0
- data/app/workers/gem_uninstaller.rb +15 -0
- data/app/workers/gem_update_check.rb +10 -0
- data/bin/bundle +3 -0
- data/bin/fluentd-ui +13 -0
- data/bin/fluentd-ui-restart +12 -0
- data/bin/rails +8 -0
- data/bin/rake +8 -0
- data/bin/spring +18 -0
- data/bower.json +10 -0
- data/circle.yml +8 -0
- data/config.ru +4 -0
- data/config/application.rb +48 -0
- data/config/application.yml +211 -0
- data/config/boot.rb +4 -0
- data/config/environment.rb +5 -0
- data/config/environments/development.rb +36 -0
- data/config/environments/production.rb +69 -0
- data/config/environments/test.rb +40 -0
- data/config/initializers/backtrace_silencers.rb +7 -0
- data/config/initializers/cookies_serializer.rb +3 -0
- data/config/initializers/filter_parameter_logging.rb +4 -0
- data/config/initializers/inflections.rb +16 -0
- data/config/initializers/mime_types.rb +4 -0
- data/config/initializers/prefetch_gem_updates.rb +1 -0
- data/config/initializers/session_store.rb +3 -0
- data/config/initializers/wrap_parameters.rb +14 -0
- data/config/locales/en.yml +204 -0
- data/config/locales/ja.yml +194 -0
- data/config/locales/translation_en.yml +255 -0
- data/config/locales/translation_ja.yml +255 -0
- data/config/locales/tutorial_en.yml +117 -0
- data/config/locales/tutorial_ja.yml +120 -0
- data/config/routes.rb +93 -0
- data/config/secrets.yml +22 -0
- data/db/schema.rb +0 -0
- data/db/seeds.rb +11 -0
- data/fluentd-ui-ss01.png +0 -0
- data/fluentd-ui-ss02.png +0 -0
- data/fluentd-ui-ss03.png +0 -0
- data/fluentd-ui-ss04.png +0 -0
- data/fluentd-ui-ss05.png +0 -0
- data/fluentd-ui.gemspec +46 -0
- data/lib/assets/.keep +0 -0
- data/lib/file_reverse_reader.rb +56 -0
- data/lib/fluentd-ui.rb +22 -0
- data/lib/fluentd-ui/command.rb +52 -0
- data/lib/fluentd-ui/version.rb +3 -0
- data/lib/grok_converter.rb +39 -0
- data/lib/regexp_preview.rb +48 -0
- data/lib/tasks/.keep +0 -0
- data/lib/treeview.rb +45 -0
- data/log/.keep +0 -0
- data/public/404.html +67 -0
- data/public/422.html +67 -0
- data/public/500.html +66 -0
- data/public/favicon.ico +0 -0
- data/public/fluentd-logo-right-text.png +0 -0
- data/public/fluentd-logo.png +0 -0
- data/public/fluentd.png +0 -0
- data/public/robots.txt +5 -0
- data/spec/controllers/plugins_controller_spec.rb +5 -0
- data/spec/controllers/polling_controller_spec.rb +5 -0
- data/spec/controllers/sessions_controller_spec.rb +5 -0
- data/spec/controllers/tutorials_controller_spec.rb +5 -0
- data/spec/factories/fluentd.rb +11 -0
- data/spec/factories/plugins.rb +8 -0
- data/spec/factories/user.rb +6 -0
- data/spec/features/fluentd/setting/out_forward_spec.rb +45 -0
- data/spec/features/fluentd/setting/out_td_spec.rb +35 -0
- data/spec/features/sessions_spec.rb +55 -0
- data/spec/features/shared_examples/login_required.rb +4 -0
- data/spec/features/users_spec.rb +9 -0
- data/spec/grok_converter_spec.rb +50 -0
- data/spec/lib/file_reverse_reader_spec.rb +73 -0
- data/spec/lib/fluentd-ui_spec.rb +35 -0
- data/spec/models/fluentd/agent_spec.rb +91 -0
- data/spec/models/fluentd/setting/common_spec.rb +178 -0
- data/spec/models/fluentd/setting/in_syslog_spec.rb +35 -0
- data/spec/models/fluentd/setting/out_mongo_spec.rb +40 -0
- data/spec/models/fluentd/setting/out_td_spec.rb +38 -0
- data/spec/models/fluentd_spec.rb +166 -0
- data/spec/models/plugin_spec.rb +191 -0
- data/spec/models/user_spec.rb +15 -0
- data/spec/spec_helper.rb +58 -0
- data/spec/support/fixtures/error0.log +12 -0
- data/spec/support/fixtures/error2.log +130 -0
- data/spec/support/fluentd_agent_common_behavior.rb +114 -0
- data/spec/support/fluentd_agent_restart_strategy.rb +94 -0
- data/tmp/.gitkeep +0 -0
- data/vendor/assets/javascripts/.keep +0 -0
- data/vendor/assets/javascripts/bower/es6-promise/.bower.json +15 -0
- data/vendor/assets/javascripts/bower/es6-promise/bower.json +5 -0
- data/vendor/assets/javascripts/bower/es6-promise/promise.js +684 -0
- data/vendor/assets/javascripts/bower/es6-promise/promise.min.js +1 -0
- data/vendor/assets/javascripts/bower/lodash/.bower.json +33 -0
- data/vendor/assets/javascripts/bower/lodash/LICENSE.txt +22 -0
- data/vendor/assets/javascripts/bower/lodash/bower.json +23 -0
- data/vendor/assets/javascripts/bower/lodash/dist/lodash.compat.js +7157 -0
- data/vendor/assets/javascripts/bower/lodash/dist/lodash.compat.min.js +61 -0
- data/vendor/assets/javascripts/bower/lodash/dist/lodash.js +6785 -0
- data/vendor/assets/javascripts/bower/lodash/dist/lodash.min.js +56 -0
- data/vendor/assets/javascripts/bower/lodash/dist/lodash.underscore.js +4979 -0
- data/vendor/assets/javascripts/bower/lodash/dist/lodash.underscore.min.js +39 -0
- data/vendor/assets/javascripts/bower/vue/.bower.json +29 -0
- data/vendor/assets/javascripts/bower/vue/LICENSE +21 -0
- data/vendor/assets/javascripts/bower/vue/dist/vue.js +4713 -0
- data/vendor/assets/javascripts/bower/vue/dist/vue.min.js +7 -0
- data/vendor/assets/javascripts/bower/vue/src/batcher.js +45 -0
- data/vendor/assets/javascripts/bower/vue/src/binding.js +103 -0
- data/vendor/assets/javascripts/bower/vue/src/compiler.js +1037 -0
- data/vendor/assets/javascripts/bower/vue/src/config.js +19 -0
- data/vendor/assets/javascripts/bower/vue/src/deps-parser.js +65 -0
- data/vendor/assets/javascripts/bower/vue/src/directive.js +258 -0
- data/vendor/assets/javascripts/bower/vue/src/directives/html.js +41 -0
- data/vendor/assets/javascripts/bower/vue/src/directives/if.js +56 -0
- data/vendor/assets/javascripts/bower/vue/src/directives/index.js +129 -0
- data/vendor/assets/javascripts/bower/vue/src/directives/model.js +174 -0
- data/vendor/assets/javascripts/bower/vue/src/directives/on.js +56 -0
- data/vendor/assets/javascripts/bower/vue/src/directives/partial.js +50 -0
- data/vendor/assets/javascripts/bower/vue/src/directives/repeat.js +246 -0
- data/vendor/assets/javascripts/bower/vue/src/directives/style.js +40 -0
- data/vendor/assets/javascripts/bower/vue/src/directives/view.js +56 -0
- data/vendor/assets/javascripts/bower/vue/src/directives/with.js +50 -0
- data/vendor/assets/javascripts/bower/vue/src/emitter.js +97 -0
- data/vendor/assets/javascripts/bower/vue/src/exp-parser.js +190 -0
- data/vendor/assets/javascripts/bower/vue/src/filters.js +190 -0
- data/vendor/assets/javascripts/bower/vue/src/fragment.js +84 -0
- data/vendor/assets/javascripts/bower/vue/src/main.js +186 -0
- data/vendor/assets/javascripts/bower/vue/src/observer.js +446 -0
- data/vendor/assets/javascripts/bower/vue/src/text-parser.js +96 -0
- data/vendor/assets/javascripts/bower/vue/src/transition.js +228 -0
- data/vendor/assets/javascripts/bower/vue/src/utils.js +321 -0
- data/vendor/assets/javascripts/bower/vue/src/viewmodel.js +180 -0
- data/vendor/assets/javascripts/sb-admin-v2/bootstrap.js +1951 -0
- data/vendor/assets/javascripts/sb-admin-v2/bootstrap.min.js +6 -0
- data/vendor/assets/javascripts/sb-admin-v2/demo/dashboard-demo.js +117 -0
- data/vendor/assets/javascripts/sb-admin-v2/demo/flot-demo.js +1242 -0
- data/vendor/assets/javascripts/sb-admin-v2/demo/morris-demo.js +155 -0
- data/vendor/assets/javascripts/sb-admin-v2/jquery-1.10.2.js +6 -0
- data/vendor/assets/javascripts/sb-admin-v2/plugins/dataTables/dataTables.bootstrap.js +245 -0
- data/vendor/assets/javascripts/sb-admin-v2/plugins/dataTables/jquery.dataTables.js +14013 -0
- data/vendor/assets/javascripts/sb-admin-v2/plugins/flot/excanvas.min.js +1 -0
- data/vendor/assets/javascripts/sb-admin-v2/plugins/flot/jquery.flot.js +2599 -0
- data/vendor/assets/javascripts/sb-admin-v2/plugins/flot/jquery.flot.pie.js +750 -0
- data/vendor/assets/javascripts/sb-admin-v2/plugins/flot/jquery.flot.resize.js +60 -0
- data/vendor/assets/javascripts/sb-admin-v2/plugins/flot/jquery.flot.tooltip.min.js +12 -0
- data/vendor/assets/javascripts/sb-admin-v2/plugins/metisMenu/jquery.metisMenu.js +45 -0
- data/vendor/assets/javascripts/sb-admin-v2/plugins/morris/morris.js +1888 -0
- data/vendor/assets/javascripts/sb-admin-v2/plugins/morris/raphael-2.1.0.min.js +10 -0
- data/vendor/assets/javascripts/sb-admin-v2/sb-admin.js +18 -0
- data/vendor/assets/stylesheets/.keep +0 -0
- data/vendor/assets/stylesheets/sb-admin-v2/bootstrap.css +5830 -0
- data/vendor/assets/stylesheets/sb-admin-v2/bootstrap.min.css +7 -0
- data/vendor/assets/stylesheets/sb-admin-v2/font-awesome/css/font-awesome.css +1338 -0
- data/vendor/assets/stylesheets/sb-admin-v2/font-awesome/css/font-awesome.min.css +4 -0
- data/vendor/assets/stylesheets/sb-admin-v2/font-awesome/fonts/FontAwesome.otf +0 -0
- data/vendor/assets/stylesheets/sb-admin-v2/font-awesome/fonts/fontawesome-webfont.eot +0 -0
- data/vendor/assets/stylesheets/sb-admin-v2/font-awesome/fonts/fontawesome-webfont.svg +414 -0
- data/vendor/assets/stylesheets/sb-admin-v2/font-awesome/fonts/fontawesome-webfont.ttf +0 -0
- data/vendor/assets/stylesheets/sb-admin-v2/font-awesome/fonts/fontawesome-webfont.woff +0 -0
- data/vendor/assets/stylesheets/sb-admin-v2/font-awesome/scss/_bordered-pulled.scss +16 -0
- data/vendor/assets/stylesheets/sb-admin-v2/font-awesome/scss/_core.scss +12 -0
- data/vendor/assets/stylesheets/sb-admin-v2/font-awesome/scss/_fixed-width.scss +6 -0
- data/vendor/assets/stylesheets/sb-admin-v2/font-awesome/scss/_icons.scss +412 -0
- data/vendor/assets/stylesheets/sb-admin-v2/font-awesome/scss/_larger.scss +13 -0
- data/vendor/assets/stylesheets/sb-admin-v2/font-awesome/scss/_list.scss +19 -0
- data/vendor/assets/stylesheets/sb-admin-v2/font-awesome/scss/_mixins.scss +20 -0
- data/vendor/assets/stylesheets/sb-admin-v2/font-awesome/scss/_path.scss +14 -0
- data/vendor/assets/stylesheets/sb-admin-v2/font-awesome/scss/_rotated-flipped.scss +9 -0
- data/vendor/assets/stylesheets/sb-admin-v2/font-awesome/scss/_spinning.scss +30 -0
- data/vendor/assets/stylesheets/sb-admin-v2/font-awesome/scss/_stacked.scss +20 -0
- data/vendor/assets/stylesheets/sb-admin-v2/font-awesome/scss/_variables.scss +381 -0
- data/vendor/assets/stylesheets/sb-admin-v2/font-awesome/scss/font-awesome.scss +17 -0
- data/vendor/assets/stylesheets/sb-admin-v2/fonts/glyphicons-halflings-regular.eot +0 -0
- data/vendor/assets/stylesheets/sb-admin-v2/fonts/glyphicons-halflings-regular.svg +229 -0
- data/vendor/assets/stylesheets/sb-admin-v2/fonts/glyphicons-halflings-regular.ttf +0 -0
- data/vendor/assets/stylesheets/sb-admin-v2/fonts/glyphicons-halflings-regular.woff +0 -0
- data/vendor/assets/stylesheets/sb-admin-v2/plugins/dataTables/dataTables.bootstrap.css +233 -0
- data/vendor/assets/stylesheets/sb-admin-v2/plugins/morris/morris-0.4.3.min.css +2 -0
- data/vendor/assets/stylesheets/sb-admin-v2/plugins/social-buttons/social-buttons.css +68 -0
- data/vendor/assets/stylesheets/sb-admin-v2/plugins/timeline/timeline.css +144 -0
- data/vendor/assets/stylesheets/sb-admin-v2/sb-admin.css +329 -0
- data/vendor/patterns/firewalls +60 -0
- data/vendor/patterns/grok-patterns +94 -0
- data/vendor/patterns/haproxy +37 -0
- data/vendor/patterns/java +3 -0
- data/vendor/patterns/junos +9 -0
- data/vendor/patterns/linux-syslog +16 -0
- data/vendor/patterns/mcollective +1 -0
- data/vendor/patterns/mcollective-patterns +4 -0
- data/vendor/patterns/mongodb +4 -0
- data/vendor/patterns/nagios +108 -0
- data/vendor/patterns/postgresql +3 -0
- data/vendor/patterns/redis +3 -0
- data/vendor/patterns/ruby +2 -0
- metadata +659 -0
@@ -0,0 +1,7 @@
|
|
1
|
+
/*
|
2
|
+
Vue.js v0.10.5
|
3
|
+
(c) 2014 Evan You
|
4
|
+
License: MIT
|
5
|
+
*/
|
6
|
+
!function(){"use strict";function e(t,i,r){var n=e.resolve(t);if(null!=n){var s=e.modules[n];if(!s._resolving&&!s.exports){var o={};o.exports={},o.client=o.component=!0,s._resolving=!0,s.call(this,o.exports,e.relative(n),o),delete s._resolving,s.exports=o.exports}return s.exports}}e.modules={},e.aliases={},e.exts=["",".js",".json","/index.js","/index.json"],e.resolve=function(t){"/"===t.charAt(0)&&(t=t.slice(1));for(var i=0;5>i;i++){var r=t+e.exts[i];if(e.modules.hasOwnProperty(r))return r;if(e.aliases.hasOwnProperty(r))return e.aliases[r]}},e.normalize=function(e,t){var i=[];if("."!=t.charAt(0))return t;e=e.split("/"),t=t.split("/");for(var r=0;r<t.length;++r)".."===t[r]?e.pop():"."!=t[r]&&""!=t[r]&&i.push(t[r]);return e.concat(i).join("/")},e.register=function(t,i){e.modules[t]=i},e.alias=function(t,i){e.modules.hasOwnProperty(t)&&(e.aliases[i]=t)},e.relative=function(t){function i(r){var n=i.resolve(r);return e(n,t,r)}var r=e.normalize(t,"..");return i.resolve=function(i){var n=i.charAt(0);if("/"===n)return i.slice(1);if("."===n)return e.normalize(r,i);for(var s=t.split("/"),o=s.length;o--&&"deps"!==s[o];);return i=s.slice(0,o+2).join("/")+"/deps/"+i},i.exists=function(t){return e.modules.hasOwnProperty(i.resolve(t))},i},e.register("vue/src/main.js",function(e,t,i){function r(e){var t=this;e.data&&(e.defaultData=e.data,delete e.data),t!==o&&(e=n(e,t.options,!0)),a.processOptions(e);var i=function(i,r){r||(i=n(i,e,!0)),t.call(this,i,!0)},s=i.prototype=Object.create(t.prototype);return a.defProtected(s,"constructor",i),i.extend=r,i.super=t,i.options=e,l.forEach(function(e){i[e]=o[e]}),i.use=o.use,i.require=o.require,i}function n(e,t,i){if(e=e||{},!t)return e;for(var r in t)if("el"!==r){var s=e[r],c=t[r];i&&"function"==typeof s&&c?(e[r]=[s],Array.isArray(c)?e[r]=e[r].concat(c):e[r].push(c)):!i||!a.isTrueObject(s)&&!a.isTrueObject(c)||c instanceof o?void 0===s&&(e[r]=c):e[r]=n(s,c)}return e}var s=t("./config"),o=t("./viewmodel"),a=t("./utils"),c=a.hash,l=["directive","filter","partial","effect","component"];t("./observer"),t("./transition"),o.options=s.globalAssets={directives:t("./directives"),filters:t("./filters"),partials:c(),effects:c(),components:c()},l.forEach(function(e){o[e]=function(t,i){var r=this.options[e+"s"];return r||(r=this.options[e+"s"]=c()),i?("partial"===e?i=a.toFragment(i):"component"===e?i=a.toConstructor(i):"filter"===e&&a.checkFilter(i),r[t]=i,this):r[t]}}),o.config=function(e,t){if("string"==typeof e){if(void 0===t)return s[e];s[e]=t}else a.extend(s,e);return this},o.use=function(e){if("string"==typeof e)try{e=t(e)}catch(i){return}var r=[].slice.call(arguments,1);return r.unshift(this),"function"==typeof e.install?e.install.apply(e,r):e.apply(null,r),this},o.require=function(e){return t("./"+e)},o.extend=r,o.nextTick=a.nextTick,i.exports=o}),e.register("vue/src/emitter.js",function(e,t,i){function r(e){this._ctx=e||this}var n=[].slice,s=r.prototype;s.on=function(e,t){return this._cbs=this._cbs||{},(this._cbs[e]=this._cbs[e]||[]).push(t),this},s.once=function(e,t){function i(){r.off(e,i),t.apply(this,arguments)}var r=this;return this._cbs=this._cbs||{},i.fn=t,this.on(e,i),this},s.off=function(e,t){if(this._cbs=this._cbs||{},!arguments.length)return this._cbs={},this;var i=this._cbs[e];if(!i)return this;if(1===arguments.length)return delete this._cbs[e],this;for(var r,n=0;n<i.length;n++)if(r=i[n],r===t||r.fn===t){i.splice(n,1);break}return this},s.emit=function(e,t,i,r){this._cbs=this._cbs||{};var n=this._cbs[e];if(n){n=n.slice(0);for(var s=0,o=n.length;o>s;s++)n[s].call(this._ctx,t,i,r)}return this},s.applyEmit=function(e){this._cbs=this._cbs||{};var t,i=this._cbs[e];if(i){i=i.slice(0),t=n.call(arguments,1);for(var r=0,s=i.length;s>r;r++)i[r].apply(this._ctx,t)}return this},i.exports=r}),e.register("vue/src/config.js",function(e,t,i){var r=t("./text-parser");i.exports={prefix:"v",debug:!1,silent:!1,enterClass:"v-enter",leaveClass:"v-leave",interpolate:!0},Object.defineProperty(i.exports,"delimiters",{get:function(){return r.delimiters},set:function(e){r.setDelimiters(e)}})}),e.register("vue/src/utils.js",function(e,t,i){function r(e){return e.indexOf("[")<0?e:e.replace(h,".$1").replace(f,".$1")}var n,s=t("./config"),o={}.toString,a=window,c=(a.console,Object.defineProperty),l="object",u=/[^\w]this[^\w]/,h=/\['([^']+)'\]/g,f=/\["([^"]+)"\]/g,d="classList"in document.documentElement,p=a.requestAnimationFrame||a.webkitRequestAnimationFrame||a.setTimeout,v=i.exports={toFragment:t("./fragment"),get:function(e,t){if(t=r(t),t.indexOf(".")<0)return e[t];for(var i=t.split("."),n=-1,s=i.length;++n<s&&null!=e;)e=e[i[n]];return e},set:function(e,t,i){if(t=r(t),t.indexOf(".")<0)return void(e[t]=i);for(var n=t.split("."),s=-1,o=n.length-1;++s<o;)null==e[n[s]]&&(e[n[s]]={}),e=e[n[s]];e[n[s]]=i},baseKey:function(e){return e.indexOf(".")>0?e.split(".")[0]:e},hash:function(){return Object.create(null)},attr:function(e,t){var i=s.prefix+"-"+t,r=e.getAttribute(i);return null!==r&&e.removeAttribute(i),r},defProtected:function(e,t,i,r,n){c(e,t,{value:i,enumerable:r,writable:n,configurable:!0})},isObject:function(e){return typeof e===l&&e&&!Array.isArray(e)},isTrueObject:function(e){return"[object Object]"===o.call(e)},bind:function(e,t){return function(i){return e.call(t,i)}},guard:function(e){return null==e?"":"object"==typeof e?JSON.stringify(e):e},checkNumber:function(e){return isNaN(e)||null===e||"boolean"==typeof e?e:Number(e)},extend:function(e,t){for(var i in t)e[i]!==t[i]&&(e[i]=t[i]);return e},unique:function(e){for(var t,i=v.hash(),r=e.length,n=[];r--;)t=e[r],i[t]||(i[t]=1,n.push(t));return n},toConstructor:function(e){return n=n||t("./viewmodel"),v.isObject(e)?n.extend(e):"function"==typeof e?e:null},checkFilter:function(e){u.test(e.toString())&&(e.computed=!0)},processOptions:function(e){var t,i=e.components,r=e.partials,n=e.template,s=e.filters;if(i)for(t in i)i[t]=v.toConstructor(i[t]);if(r)for(t in r)r[t]=v.toFragment(r[t]);if(s)for(t in s)v.checkFilter(s[t]);n&&(e.template=v.toFragment(n))},nextTick:function(e){p(e,0)},addClass:function(e,t){if(d)e.classList.add(t);else{var i=" "+e.className+" ";i.indexOf(" "+t+" ")<0&&(e.className=(i+t).trim())}},removeClass:function(e,t){if(d)e.classList.remove(t);else{for(var i=" "+e.className+" ",r=" "+t+" ";i.indexOf(r)>=0;)i=i.replace(r," ");e.className=i.trim()}},objectToArray:function(e){var t,i,r=[];for(var n in e)t=e[n],i=v.isObject(t)?t:{$value:t},i.$key=n,r.push(i);return r}}}),e.register("vue/src/fragment.js",function(e,t,i){var r={legend:[1,"<fieldset>","</fieldset>"],tr:[2,"<table><tbody>","</tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],_default:[0,"",""]};r.td=r.th=[3,"<table><tbody><tr>","</tr></tbody></table>"],r.option=r.optgroup=[1,'<select multiple="multiple">',"</select>"],r.thead=r.tbody=r.colgroup=r.caption=r.tfoot=[1,"<table>","</table>"],r.text=r.circle=r.ellipse=r.line=r.path=r.polygon=r.polyline=r.rect=[1,'<svg xmlns="http://www.w3.org/2000/svg" version="1.1">',"</svg>"];var n=/<([\w:]+)/;i.exports=function(e){if("string"!=typeof e)return e;if("#"===e.charAt(0)){var t=document.getElementById(e.slice(1));if(!t)return;if("TEMPLATE"===t.tagName&&t.content)return t.content;e=t.innerHTML}var i=document.createDocumentFragment(),s=n.exec(e);if(!s)return i.appendChild(document.createTextNode(e)),i;var o=s[1],a=r[o]||r._default,c=a[0],l=a[1],u=a[2],h=document.createElement("div");for(h.innerHTML=l+e.trim()+u;c--;)h=h.lastChild;if(h.firstChild===h.lastChild)return i.appendChild(h.firstChild),i;for(var f;f=h.firstChild;)1===h.nodeType&&i.appendChild(f);return i}}),e.register("vue/src/compiler.js",function(e,t,i){function r(e,t){var i,r,s=this;s.init=!0,s.destroyed=!1,t=s.options=t||{},l.processOptions(t),m(s,t.compilerOptions),s.repeat=s.repeat||!1,s.expCache=s.expCache||{};var a=s.el=s.setupElement(t);s.vm=a.vue_vm=e,s.bindings=l.hash(),s.dirs=[],s.deferred=[],s.computed=[],s.children=[],s.emitter=new o(e),e.$={},e.$el=a,e.$options=t,e.$compiler=s,e.$event=null;var c=t.parent;if(c&&(s.parent=c.$compiler,c.$compiler.children.push(s),e.$parent=c,"lazy"in t||(t.lazy=s.parent.options.lazy)),e.$root=n(s).vm,s.setupObserver(),t.methods)for(i in t.methods)s.createBinding(i);if(t.computed)for(i in t.computed)s.createBinding(i);var u=s.data=t.data||{},h=t.defaultData;if(h)for(i in h)g.call(u,i)||(u[i]=h[i]);var f=t.paramAttributes;if(f)for(r=f.length;r--;)u[f[r]]=l.checkNumber(s.eval(a.getAttribute(f[r])));m(e,u),e.$data=u,s.execHook("created"),u=s.data=e.$data;var p;for(i in e)p=e[i],"$"!==i.charAt(0)&&u[i]!==p&&"function"!=typeof p&&(u[i]=p);for(s.observeData(u),t.template&&this.resolveContent(),s.compile(a,!0),r=s.deferred.length;r--;)s.bindDirective(s.deferred[r]);s.deferred=null,this.computed.length&&d.parse(this.computed),s.init=!1,s.execHook("ready")}function n(e){for(;e.parent;)e=e.parent;return e}var s,o=t("./emitter"),a=t("./observer"),c=t("./config"),l=t("./utils"),u=t("./binding"),h=t("./directive"),f=t("./text-parser"),d=t("./deps-parser"),p=t("./exp-parser"),v=[].slice,m=l.extend,g={}.hasOwnProperty,b=Object.defineProperty,y=["created","ready","beforeDestroy","afterDestroy","attached","detached"],_=["if","repeat","view","component"],x=r.prototype;x.setupElement=function(e){var t,i,r,n,s,o="string"==typeof e.el?document.querySelector(e.el):e.el||document.createElement(e.tagName||"div"),a=e.template;if(a){if(o.hasChildNodes())for(this.rawContent=document.createElement("div");t=o.firstChild;)this.rawContent.appendChild(t);if(e.replace&&a.firstChild===a.lastChild){if(i=a.firstChild.cloneNode(!0),o.parentNode&&(o.parentNode.insertBefore(i,o),o.parentNode.removeChild(o)),o.hasAttributes())for(r=o.attributes.length;r--;)n=o.attributes[r],i.setAttribute(n.name,n.value);o=i}else o.appendChild(a.cloneNode(!0))}if(e.id&&(o.id=e.id),e.className&&(o.className=e.className),s=e.attributes)for(n in s)o.setAttribute(n,s[n]);return o},x.resolveContent=function(){function e(e,t){for(var i=e.parentNode,r=0,n=t.length;n>r;r++)i.insertBefore(t[r],e);i.removeChild(e)}var t,i,r,n,s,o=v.call(this.el.getElementsByTagName("content")),a=this.rawContent;if(r=o.length){for(;r--;)t=o[r],a?(i=t.getAttribute("select"),i?t.content=v.call(a.querySelectorAll(i)):s=t):t.content=v.call(t.childNodes);for(r=0,n=o.length;n>r;r++)t=o[r],t!==s&&e(t,t.content);a&&s&&e(s,v.call(a.childNodes))}this.rawContent=null},x.setupObserver=function(){function e(e){n(e),d.catcher.emit("get",a[e])}function t(e,t,i){l.emit("change:"+e,t,i),n(e),a[e].update(t)}function i(e,t){l.on("hook:"+e,function(){t.call(s.vm)})}function r(e){var t=s.children;if(t)for(var i,r=t.length;r--;)i=t[r],i.el.parentNode&&(e="hook:"+(e?"attached":"detached"),i.observer.emit(e),i.emitter.emit(e))}function n(e){a[e]||s.createBinding(e)}var s=this,a=s.bindings,c=s.options,l=s.observer=new o(s.vm);l.proxies={},l.on("get",e).on("set",t).on("mutate",t);for(var u,h,f,p=y.length;p--;)if(h=y[p],f=c[h],Array.isArray(f))for(u=f.length;u--;)i(h,f[u]);else f&&i(h,f);l.on("hook:attached",function(){r(1)}).on("hook:detached",function(){r(0)})},x.observeData=function(e){function t(e){"$data"!==e&&i()}function i(){s.update(r.data),n.emit("change:$data",r.data)}var r=this,n=r.observer;a.observe(e,"",n);var s=r.bindings.$data=new u(r,"$data");s.update(e),b(r.vm,"$data",{get:function(){return r.observer.emit("get","$data"),r.data},set:function(e){var t=r.data;a.unobserve(t,"",n),r.data=e,a.copyPaths(e,t),a.observe(e,"",n),i()}}),n.on("set",t).on("mutate",t)},x.compile=function(e,t){var i=e.nodeType;1===i&&"SCRIPT"!==e.tagName?this.compileElement(e,t):3===i&&c.interpolate&&this.compileTextNode(e)},x.checkPriorityDir=function(e,t,i){var r,n,s;if("component"===e&&i!==!0&&(s=this.resolveComponent(t,void 0,!0))?(n=this.parseDirective(e,"",t),n.Ctor=s):(r=l.attr(t,e),n=r&&this.parseDirective(e,r,t)),n){if(i===!0)return;return this.deferred.push(n),!0}},x.compileElement=function(e,t){if("TEXTAREA"===e.tagName&&e.value&&(e.value=this.eval(e.value)),e.hasAttributes()||e.tagName.indexOf("-")>-1){if(null!==l.attr(e,"pre"))return;var i,r,n,s;for(i=0,r=_.length;r>i;i++)if(this.checkPriorityDir(_[i],e,t))return;e.vue_trans=l.attr(e,"transition"),e.vue_anim=l.attr(e,"animation"),e.vue_effect=this.eval(l.attr(e,"effect"));var o,a,u,h,d,p,m,g=c.prefix+"-",b=this.options.paramAttributes;if(t){var y=l.attr(e,"with");if(y)for(d=this.parseDirective("with",y,e,!0),n=0,s=d.length;s>n;n++)this.bindDirective(d[n],this.parent)}var x=v.call(e.attributes);for(i=0,r=x.length;r>i;i++){if(o=x[i],a=o.name,u=!1,0===a.indexOf(g))for(u=!0,m=a.slice(g.length),d=this.parseDirective(m,o.value,e,!0),n=0,s=d.length;s>n;n++)this.bindDirective(d[n]);else c.interpolate&&(h=f.parseAttr(o.value),h&&(p=this.parseDirective("attr",h,e),p.arg=a,b&&b.indexOf(a)>-1?this.bindDirective(p,this.parent):this.bindDirective(p)));u&&"cloak"!==m&&e.removeAttribute(a)}}e.hasChildNodes()&&v.call(e.childNodes).forEach(this.compile,this)},x.compileTextNode=function(e){var t=f.parse(e.nodeValue);if(t){for(var i,r,n,s=0,o=t.length;o>s;s++)r=t[s],n=null,r.key?">"===r.key.charAt(0)?(i=document.createComment("ref"),n=this.parseDirective("partial",r.key.slice(1),i)):r.html?(i=document.createComment(c.prefix+"-html"),n=this.parseDirective("html",r.key,i)):(i=document.createTextNode(""),n=this.parseDirective("text",r.key,i)):i=document.createTextNode(r),e.parentNode.insertBefore(i,e),this.bindDirective(n);e.parentNode.removeChild(e)}},x.parseDirective=function(e,t,i,r){function n(t){return new h(e,t,o,s,i)}var s=this,o=s.getOption("directives",e);if(o){var a=h.parse(t);return r?a.map(n):n(a[0])}},x.bindDirective=function(e,t){if(e){if(this.dirs.push(e),e.isEmpty||e.isLiteral)return void(e.bind&&e.bind());var i,r=t||this,n=e.key;if(e.isExp)i=r.createBinding(n,e);else{for(;r&&!r.hasKey(n);)r=r.parent;r=r||this,i=r.bindings[n]||r.createBinding(n)}i.dirs.push(e),e.binding=i;var s=i.val();e.bind&&e.bind(s),e.$update(s,!0)}},x.createBinding=function(e,t){var i=this,r=i.options.methods,n=t&&t.isExp,s=t&&t.isFn||r&&r[e],o=i.bindings,c=i.options.computed,h=new u(i,e,n,s);if(n)i.defineExp(e,h,t);else if(s)o[e]=h,i.defineVmProp(e,h,r[e]);else if(o[e]=h,h.root)c&&c[e]?i.defineComputed(e,h,c[e]):"$"!==e.charAt(0)?i.defineDataProp(e,h):(i.defineVmProp(e,h,i.data[e]),delete i.data[e]);else if(c&&c[l.baseKey(e)])i.defineExp(e,h);else{a.ensurePath(i.data,e);var f=e.slice(0,e.lastIndexOf("."));o[f]||i.createBinding(f)}return h},x.defineDataProp=function(e,t){var i=this,r=i.data,n=r.__emitter__;g.call(r,e)||(r[e]=void 0),n&&!g.call(n.values,e)&&a.convertKey(r,e),t.value=r[e],b(i.vm,e,{get:function(){return i.data[e]},set:function(t){i.data[e]=t}})},x.defineVmProp=function(e,t,i){var r=this.observer;t.value=i,b(this.vm,e,{get:function(){return a.shouldGet&&r.emit("get",e),t.value},set:function(t){r.emit("set",e,t)}})},x.defineExp=function(e,t,i){var r=i&&i.computedKey,n=r?i.expression:e,s=this.expCache[n];s||(s=this.expCache[n]=p.parse(r||e,this)),s&&this.markComputed(t,s)},x.defineComputed=function(e,t,i){this.markComputed(t,i),b(this.vm,e,{get:t.value.$get,set:t.value.$set})},x.markComputed=function(e,t){e.isComputed=!0,e.isFn?e.value=t:("function"==typeof t&&(t={$get:t}),e.value={$get:l.bind(t.$get,this.vm),$set:t.$set?l.bind(t.$set,this.vm):void 0}),this.computed.push(e)},x.getOption=function(e,t,i){var r=this.options,n=this.parent,s=c.globalAssets,o=r[e]&&r[e][t]||(n?n.getOption(e,t,i):s[e]&&s[e][t]);return o},x.execHook=function(e){e="hook:"+e,this.observer.emit(e),this.emitter.emit(e)},x.hasKey=function(e){var t=l.baseKey(e);return g.call(this.data,t)||g.call(this.vm,t)},x.eval=function(e,t){var i=f.parseAttr(e);return i?p.eval(i,this,t):e},x.resolveComponent=function(e,i,r){s=s||t("./viewmodel");var n=l.attr(e,"component"),o=e.tagName,a=this.eval(n,i),c=o.indexOf("-")>0&&o.toLowerCase(),u=this.getOption("components",a||c,!0);return r?""===n?s:u:u||s},x.destroy=function(e){if(!this.destroyed){var t,i,r,n,s,o,c=this,l=c.vm,u=c.el,h=c.dirs,f=c.computed,d=c.bindings,p=c.children,v=c.parent;for(c.execHook("beforeDestroy"),a.unobserve(c.data,"",c.observer),t=p.length;t--;)p[t].destroy(!0);for(t=h.length;t--;)n=h[t],n.binding&&n.binding.compiler!==c&&(s=n.binding.dirs,s&&(i=s.indexOf(n),i>-1&&s.splice(i,1))),n.$unbind();for(t=f.length;t--;)f[t].unbind();for(r in d)o=d[r],o&&o.unbind();v&&(i=v.children.indexOf(c),i>-1&&v.children.splice(i,1)),e||(u===document.body?u.innerHTML="":l.$remove()),u.vue_vm=null,c.destroyed=!0,c.execHook("afterDestroy"),c.observer.off(),c.emitter.off()}},i.exports=r}),e.register("vue/src/viewmodel.js",function(e,t,i){function r(e){new s(this,e)}function n(e){return"string"==typeof e?document.querySelector(e):e}var s=t("./compiler"),o=t("./utils"),a=t("./transition"),c=t("./batcher"),l=[].slice,u=o.defProtected,h=o.nextTick,f=new c,d=1,p=r.prototype;u(p,"$get",function(e){var t=o.get(this,e);return void 0===t&&this.$parent?this.$parent.$get(e):t}),u(p,"$set",function(e,t){o.set(this,e,t)}),u(p,"$watch",function(e,t){function i(){var e=l.call(arguments);f.push({id:r,override:!0,execute:function(){t.apply(n,e)}})}var r=d++,n=this;t._fn=i,n.$compiler.observer.on("change:"+e,i)}),u(p,"$unwatch",function(e,t){var i=["change:"+e],r=this.$compiler.observer;t&&i.push(t._fn),r.off.apply(r,i)}),u(p,"$destroy",function(){this.$compiler.destroy()}),u(p,"$broadcast",function(){for(var e,t=this.$compiler.children,i=t.length;i--;)e=t[i],e.emitter.applyEmit.apply(e.emitter,arguments),e.vm.$broadcast.apply(e.vm,arguments)}),u(p,"$dispatch",function(){var e=this.$compiler,t=e.emitter,i=e.parent;t.applyEmit.apply(t,arguments),i&&i.vm.$dispatch.apply(i.vm,arguments)}),["emit","on","off","once"].forEach(function(e){var t="emit"===e?"applyEmit":e;u(p,"$"+e,function(){var e=this.$compiler.emitter;e[t].apply(e,arguments)})}),u(p,"$appendTo",function(e,t){e=n(e);var i=this.$el;a(i,1,function(){e.appendChild(i),t&&h(t)},this.$compiler)}),u(p,"$remove",function(e){var t=this.$el;a(t,-1,function(){t.parentNode&&t.parentNode.removeChild(t),e&&h(e)},this.$compiler)}),u(p,"$before",function(e,t){e=n(e);var i=this.$el;a(i,1,function(){e.parentNode.insertBefore(i,e),t&&h(t)},this.$compiler)}),u(p,"$after",function(e,t){e=n(e);var i=this.$el;a(i,1,function(){e.nextSibling?e.parentNode.insertBefore(i,e.nextSibling):e.parentNode.appendChild(i),t&&h(t)},this.$compiler)}),i.exports=r}),e.register("vue/src/binding.js",function(e,t,i){function r(e,t,i,r){this.id=o++,this.value=void 0,this.isExp=!!i,this.isFn=r,this.root=!this.isExp&&-1===t.indexOf("."),this.compiler=e,this.key=t,this.dirs=[],this.subs=[],this.deps=[],this.unbound=!1}var n=t("./batcher"),s=new n,o=1,a=r.prototype;a.update=function(e){if((!this.isComputed||this.isFn)&&(this.value=e),this.dirs.length||this.subs.length){var t=this;s.push({id:this.id,execute:function(){t.unbound||t._update()}})}},a._update=function(){for(var e=this.dirs.length,t=this.val();e--;)this.dirs[e].$update(t);this.pub()},a.val=function(){return this.isComputed&&!this.isFn?this.value.$get():this.value},a.pub=function(){for(var e=this.subs.length;e--;)this.subs[e].update()},a.unbind=function(){this.unbound=!0;for(var e=this.dirs.length;e--;)this.dirs[e].$unbind();e=this.deps.length;for(var t;e--;){t=this.deps[e].subs;var i=t.indexOf(this);i>-1&&t.splice(i,1)}},i.exports=r}),e.register("vue/src/observer.js",function(e,t,i){function r(e){x(j,e,function(){var t,i,r=E.call(arguments),o=Array.prototype[e].apply(this,r);return"push"===e||"unshift"===e?t=r:"pop"===e||"shift"===e?i=[o]:"splice"===e&&(t=r.slice(2),i=o),n(this,t),s(this,i),this.__emitter__.emit("mutate","",this,{method:e,args:r,result:o,inserted:t,removed:i}),o},!A)}function n(e,t){if(t)for(var i,r,n=t.length;n--;)i=t[n],o(i)&&(i.__emitter__||(a(i),l(i)),r=i.__emitter__.owners,r.indexOf(e)<0&&r.push(e))}function s(e,t){if(t)for(var i,r=t.length;r--;)if(i=t[r],i&&i.__emitter__){var n=i.__emitter__.owners;n&&n.splice(n.indexOf(e))}}function o(e){return"object"==typeof e&&e&&!e.$compiler}function a(e){if(e.__emitter__)return!0;var t=new y;return x(e,"__emitter__",t),t.on("set",function(t,i,r){r&&c(e)}).on("mutate",function(){c(e)}),t.values=_.hash(),t.owners=[],!1}function c(e){for(var t=e.__emitter__.owners,i=t.length;i--;)t[i].__emitter__.emit("set","","",!0)}function l(e){k(e)?f(e):h(e)}function u(e,t){if(A)e.__proto__=t;else for(var i in t)x(e,i,t[i])}function h(e){u(e,O);for(var t in e)d(e,t)}function f(e){u(e,j),n(e,e)}function d(e,t,i){function r(e,i){o[t]=e,s.emit("set",t,e,i),k(e)&&s.emit("set",t+".length",e.length,i),g(e,t,s)}var n=t.charAt(0);if("$"!==n&&"_"!==n){var s=e.__emitter__,o=s.values;r(e[t],i),C(e,t,{enumerable:!0,configurable:!0,get:function(){var e=o[t];return N.shouldGet&&s.emit("get",t),e},set:function(e){var i=o[t];b(i,t,s),v(e,i),r(e,!0)}})}}function p(e){var t=e&&e.__emitter__;if(t)if(k(e))t.emit("set","length",e.length);else{var i,r;for(i in e)r=e[i],t.emit("set",i,r),p(r)}}function v(e,t){if($(e)&&$(t)){var i,r,n;for(i in t)w.call(e,i)||(r=t[i],k(r)?e[i]=[]:$(r)?(n=e[i]={},v(n,r)):e[i]=void 0)}}function m(e,t){for(var i,r=t.split("."),n=0,s=r.length-1;s>n;n++)i=r[n],e[i]||(e[i]={},e.__emitter__&&d(e,i)),e=e[i];$(e)&&(i=r[n],w.call(e,i)||(e[i]=void 0,e.__emitter__&&d(e,i)))}function g(e,t,i){if(o(e)){var r=t?t+".":"",n=a(e),s=e.__emitter__;i.proxies=i.proxies||{};var c=i.proxies[r]={get:function(e){i.emit("get",r+e)},set:function(n,s,o){n&&i.emit("set",r+n,s),t&&o&&i.emit("set",t,e,!0)},mutate:function(e,n,s){var o=e?r+e:t;i.emit("mutate",o,n,s);var a=s.method;"sort"!==a&&"reverse"!==a&&i.emit("set",o+".length",n.length)}};s.on("get",c.get).on("set",c.set).on("mutate",c.mutate),n?p(e):l(e)}}function b(e,t,i){if(e&&e.__emitter__){t=t?t+".":"";var r=i.proxies[t];r&&(e.__emitter__.off("get",r.get).off("set",r.set).off("mutate",r.mutate),i.proxies[t]=null)}}var y=t("./emitter"),_=t("./utils"),x=_.defProtected,$=_.isObject,k=Array.isArray,w={}.hasOwnProperty,C=Object.defineProperty,E=[].slice,A={}.__proto__,j=Object.create(Array.prototype);["push","pop","shift","unshift","splice","sort","reverse"].forEach(r),x(j,"$set",function(e,t){return this.splice(e,1,t)[0]},!A),x(j,"$remove",function(e){return"number"!=typeof e&&(e=this.indexOf(e)),e>-1?this.splice(e,1)[0]:void 0},!A);var O=Object.create(Object.prototype);x(O,"$add",function(e,t){w.call(this,e)||(this[e]=t,d(this,e,!0))},!A),x(O,"$delete",function(e){w.call(this,e)&&(this[e]=void 0,delete this[e],this.__emitter__.emit("delete",e))},!A);var N=i.exports={shouldGet:!1,observe:g,unobserve:b,ensurePath:m,copyPaths:v,watch:l,convert:a,convertKey:d}}),e.register("vue/src/directive.js",function(e,t,i){function r(e,t,i,n,o){this.id=s++,this.name=e,this.compiler=n,this.vm=n.vm,this.el=o,this.computeFilters=!1,this.key=t.key,this.arg=t.arg,this.expression=t.expression;var a=""===this.expression;if("function"==typeof i)this[a?"bind":"update"]=i;else for(var u in i)this[u]=i[u];if(a||this.isEmpty)return void(this.isEmpty=!0);h.Regex.test(this.key)&&(this.key=n.eval(this.key),this.isLiteral&&(this.expression=this.key));var f,d,p,v,m,g=t.filters;if(g)for(this.filters=[],p=0,v=g.length;v>p;p++)f=g[p],d=this.compiler.getOption("filters",f.name),d&&(f.apply=d,this.filters.push(f),d.computed&&(m=!0));this.filters&&this.filters.length||(this.filters=null),m&&(this.computedKey=r.inlineFilters(this.key,this.filters),this.filters=null),this.isExp=m||!l.test(this.key)||c.test(this.key)}function n(e){return e.indexOf('"')>-1?e.replace(u,"'"):e}var s=1,o=/^[\w\$-]+$/,a=/[^\s'"]+|'[^']+'|"[^"]+"/g,c=/^\$(parent|root)\./,l=/^[\w\.$]+$/,u=/"/g,h=t("./text-parser"),f=r.prototype;f.$update=function(e,t){this.$lock||(t||e!==this.value||e&&"object"==typeof e)&&(this.value=e,this.update&&this.update(this.filters&&!this.computeFilters?this.$applyFilters(e):e,t))},f.$applyFilters=function(e){for(var t,i=e,r=0,n=this.filters.length;n>r;r++)t=this.filters[r],i=t.apply.apply(this.vm,[i].concat(t.args));return i},f.$unbind=function(){this.el&&this.vm&&(this.unbind&&this.unbind(),this.vm=this.el=this.binding=this.compiler=null)},r.parse=function(e){function t(){v.expression=e.slice(f,g).trim(),void 0===v.key?v.key=e.slice(d,g).trim():m!==f&&i(),(0===g||v.key)&&p.push(v)}function i(){var t,i=e.slice(m,g).trim();if(i){t={};var r=i.match(a);t.name=r[0],t.args=r.length>1?r.slice(1):null}t&&(v.filters=v.filters||[]).push(t),m=g+1}for(var r,n,s=!1,c=!1,l=0,u=0,h=0,f=0,d=0,p=[],v={},m=0,g=0,b=e.length;b>g;g++)n=e.charAt(g),s?"'"===n&&(s=!s):c?'"'===n&&(c=!c):","!==n||h||l||u?":"!==n||v.key||v.arg?"|"===n&&"|"!==e.charAt(g+1)&&"|"!==e.charAt(g-1)?void 0===v.key?(m=g+1,v.key=e.slice(d,g).trim()):i():'"'===n?c=!0:"'"===n?s=!0:"("===n?h++:")"===n?h--:"["===n?u++:"]"===n?u--:"{"===n?l++:"}"===n&&l--:(r=e.slice(f,g).trim(),o.test(r)&&(d=g+1,v.arg=r)):(t(),v={},f=d=m=g+1);return(0===g||f!==g)&&t(),p},r.inlineFilters=function(e,t){for(var i,r,s=0,o=t.length;o>s;s++)r=t[s],i=r.args?',"'+r.args.map(n).join('","')+'"':"",e='this.$compiler.getOption("filters", "'+r.name+'").call(this,'+e+i+")";return e},i.exports=r}),e.register("vue/src/exp-parser.js",function(e,t){function i(e){return e=e.replace(p,"").replace(v,",").replace(d,"").replace(m,"").replace(g,""),e?e.split(/,+/):[]}function r(e,t,i){var r="",n=0,s=t;if(i&&void 0!==o.get(i,e))return"$temp.";for(;t&&!t.hasKey(e);)t=t.parent,n++;if(t){for(;n--;)r+="$parent.";t.bindings[e]||"$"===e.charAt(0)||t.createBinding(e)}else s.createBinding(e);return r}function n(e,t){var i;try{i=new Function(e)}catch(r){}return i}function s(e){return"$"===e.charAt(0)?"\\"+e:e}var o=t("./utils"),a=/"(?:[^"\\]|\\.)*"|'(?:[^'\\]|\\.)*'/g,c=/"(\d+)"/g,l=/\n/g,u=new RegExp("constructor".split("").join("['\"+, ]*")),h=/\\u\d\d\d\d/,f="break,case,catch,continue,debugger,default,delete,do,else,false,finally,for,function,if,in,instanceof,new,null,return,switch,this,throw,true,try,typeof,var,void,while,with,undefined,abstract,boolean,byte,char,class,const,double,enum,export,extends,final,float,goto,implements,import,int,interface,long,native,package,private,protected,public,short,static,super,synchronized,throws,transient,volatile,arguments,let,yield,Math",d=new RegExp(["\\b"+f.replace(/,/g,"\\b|\\b")+"\\b"].join("|"),"g"),p=/\/\*(?:.|\n)*?\*\/|\/\/[^\n]*\n|\/\/[^\n]*$|'[^']*'|"[^"]*"|[\s\t\n]*\.[\s\t\n]*[$\w\.]+|[\{,]\s*[\w\$_]+\s*:/g,v=/[^\w$]+/g,m=/\b\d[^,]*/g,g=/^,+|,+$/g;e.parse=function(e,t,f){function d(e){var t=y.length;return y[t]=e.replace(l,"\\n"),'"'+t+'"'}function p(e){var i=e.charAt(0);e=e.slice(1);var n="this."+r(e,t,f)+e;return b[e]||(g+=n+";",b[e]=1),i+n}function v(e,t){return y[t]}if(!h.test(e)&&!u.test(e)){var m=i(e);if(!m.length)return n("return "+e,e);m=o.unique(m);var g="",b=o.hash(),y=[],_=new RegExp("[^$\\w\\.]("+m.map(s).join("|")+")[$\\w\\.]*\\b","g"),x=(" "+e).replace(a,d).replace(_,p).replace(c,v);return x=g+"return "+x,n(x,e)}},e.eval=function(t,i,r){var n,s=e.parse(t,i,r);return s&&(i.vm.$temp=r,n=s.call(i.vm),delete i.vm.$temp),n}}),e.register("vue/src/text-parser.js",function(e,t){function i(){var e=r(l),t=r(u);return new RegExp(e+e+e+"?(.+?)"+t+"?"+t+t)}function r(e){return e.replace(h,"\\$&")}function n(t){l=t[0],u=t[1],e.delimiters=t,e.Regex=i()}function s(t){if(!e.Regex.test(t))return null;for(var i,r,n,s,o=[];i=t.match(e.Regex);)r=i.index,r>0&&o.push(t.slice(0,r)),n={key:i[1].trim()},s=i[0],n.html=s.charAt(2)===l&&s.charAt(s.length-3)===u,o.push(n),t=t.slice(r+i[0].length);return t.length&&o.push(t),o}function o(e){c=c||t("./directive");var i=s(e);if(!i)return null;if(1===i.length)return i[0].key;for(var r,n=[],o=0,l=i.length;l>o;o++)r=i[o],n.push(r.key?a(r.key):'"'+r+'"');return n.join("+")}function a(e){if(e.indexOf("|")>-1){var t=c.parse(e),i=t&&t[0];i&&i.filters&&(e=c.inlineFilters(i.key,i.filters))}return"("+e+")"}var c,l="{",u="}",h=/[-.*+?^${}()|[\]\/\\]/g;e.Regex=i(),e.parse=s,e.parseAttr=o,e.setDelimiters=n,e.delimiters=[l,u]}),e.register("vue/src/deps-parser.js",function(e,t,i){function r(e){if(!e.isFn){var t=o.hash();e.deps=[],c.on("get",function(i){var r=t[i.key];r&&r.compiler===i.compiler||i.compiler.repeat&&!n(i.compiler,e.compiler)||(t[i.key]=i,e.deps.push(i),i.subs.push(e))}),e.value.$get(),c.off("get")}}function n(e,t){for(;t;){if(e===t)return!0;t=t.parent}}var s=t("./emitter"),o=t("./utils"),a=t("./observer"),c=new s;i.exports={catcher:c,parse:function(e){a.shouldGet=!0,e.forEach(r),a.shouldGet=!1}}}),e.register("vue/src/filters.js",function(e,t,i){function r(e,t){if(s.isObject(e)){for(var i in e)if(r(e[i],t))return!0}else if(null!=e)return e.toString().toLowerCase().indexOf(t)>-1}function n(e){return c.test(e)?e.slice(1,-1):void 0}var s=t("./utils"),o=s.get,a=[].slice,c=/^'.*'$/,l=i.exports=s.hash();l.capitalize=function(e){return e||0===e?(e=e.toString(),e.charAt(0).toUpperCase()+e.slice(1)):""},l.uppercase=function(e){return e||0===e?e.toString().toUpperCase():""},l.lowercase=function(e){return e||0===e?e.toString().toLowerCase():""},l.currency=function(e,t){if(!e&&0!==e)return"";t=t||"$";var i=Math.floor(e).toString(),r=i.length%3,n=r>0?i.slice(0,r)+(i.length>3?",":""):"",s="."+e.toFixed(2).slice(-2);return t+n+i.slice(r).replace(/(\d{3})(?=\d)/g,"$1,")+s},l.pluralize=function(e){var t=a.call(arguments,1);return t.length>1?t[e-1]||t[t.length-1]:t[e-1]||t[0]+"s"};var u={enter:13,tab:9,"delete":46,up:38,left:37,right:39,down:40,esc:27};l.key=function(e,t){if(e){var i=u[t];return i||(i=parseInt(t,10)),function(t){return t.keyCode===i?e.call(this,t):void 0}}},l.filterBy=function(e,t,i,a){i&&"in"!==i&&(a=i);var c=n(t)||this.$get(t);return c?(c=c.toLowerCase(),a=a&&(n(a)||this.$get(a)),Array.isArray(e)||(e=s.objectToArray(e)),e.filter(function(e){return a?r(o(e,a),c):r(e,c)})):e},l.filterBy.computed=!0,l.orderBy=function(e,t,i){var r=n(t)||this.$get(t);if(!r)return e;Array.isArray(e)||(e=s.objectToArray(e));var a=1;return i&&("-1"===i?a=-1:"!"===i.charAt(0)?(i=i.slice(1),a=this.$get(i)?1:-1):a=this.$get(i)?-1:1),e.slice().sort(function(e,t){return e=o(e,r),t=o(t,r),e===t?0:e>t?a:-a})},l.orderBy.computed=!0}),e.register("vue/src/transition.js",function(e,t,i){function r(e,t,i,r){if(!o.trans)return i(),f.CSS_SKIP;var n,s=e.classList,c=e.vue_trans_cb,u=a.enterClass,h=a.leaveClass,d=r?o.anim:o.trans;return c&&(e.removeEventListener(d,c),s.remove(u),s.remove(h),e.vue_trans_cb=null),t>0?(s.add(u),i(),r?(n=function(t){t.target===e&&(e.removeEventListener(d,n),e.vue_trans_cb=null,s.remove(u))},e.addEventListener(d,n),e.vue_trans_cb=n):l.push({execute:function(){s.remove(u)}}),f.CSS_E):(e.offsetWidth||e.offsetHeight?(s.add(h),n=function(t){t.target===e&&(e.removeEventListener(d,n),e.vue_trans_cb=null,i(),s.remove(h))},e.addEventListener(d,n),e.vue_trans_cb=n):i(),f.CSS_L)}function n(e,t,i,r,n){function s(t,i){var r=u(function(){t(),l.splice(l.indexOf(r),1),l.length||(e.vue_timeouts=null)},i);l.push(r)}var o=n.getOption("effects",r);if(!o)return i(),f.JS_SKIP;var a=o.enter,c=o.leave,l=e.vue_timeouts;if(l)for(var d=l.length;d--;)h(l[d]);return l=e.vue_timeouts=[],t>0?"function"!=typeof a?(i(),f.JS_SKIP_E):(a(e,i,s),f.JS_E):"function"!=typeof c?(i(),f.JS_SKIP_L):(c(e,i,s),f.JS_L)}function s(){var e=document.createElement("vue"),t="transitionend",i={webkitTransition:"webkitTransitionEnd",transition:t,mozTransition:t},r={};for(var n in i)if(void 0!==e.style[n]){r.trans=i[n];break}return r.anim=""===e.style.animation?"animationend":"webkitAnimationEnd",r}var o=s(),a=t("./config"),c=t("./batcher"),l=new c,u=window.setTimeout,h=window.clearTimeout,f={CSS_E:1,CSS_L:2,JS_E:3,JS_L:4,CSS_SKIP:-1,JS_SKIP:-2,JS_SKIP_E:-3,JS_SKIP_L:-4,INIT:-5,SKIP:-6};l._preFlush=function(){document.body.offsetHeight};var d=i.exports=function(e,t,i,s){var o=function(){i(),s.execHook(t>0?"attached":"detached")};if(s.init)return o(),f.INIT;var a=""===e.vue_trans,c=""===e.vue_anim,l=e.vue_effect;return l?n(e,t,o,l,s):a||c?r(e,t,o,c):(o(),f.SKIP)};d.codes=f,d.sniff=s}),e.register("vue/src/batcher.js",function(e,t,i){function r(){this.reset()}var n=t("./utils"),s=r.prototype;s.push=function(e){if(e.id&&this.has[e.id]){if(e.override){var t=this.has[e.id];
|
7
|
+
t.cancelled=!0,this.queue.push(e),this.has[e.id]=e}}else this.queue.push(e),this.has[e.id]=e,this.waiting||(this.waiting=!0,n.nextTick(n.bind(this.flush,this)))},s.flush=function(){this._preFlush&&this._preFlush();for(var e=0;e<this.queue.length;e++){var t=this.queue[e];t.cancelled||t.execute()}this.reset()},s.reset=function(){this.has=n.hash(),this.queue=[],this.waiting=!1},i.exports=r}),e.register("vue/src/directives/index.js",function(e,t,i){var r=t("../utils"),n=t("../config"),s=t("../transition"),o=i.exports=r.hash();o.component={isLiteral:!0,bind:function(){this.el.vue_vm||(this.childVM=new this.Ctor({el:this.el,parent:this.vm}))},unbind:function(){this.childVM&&this.childVM.$destroy()}},o.attr={bind:function(){var e=this.vm.$options.paramAttributes;this.isParam=e&&e.indexOf(this.arg)>-1},update:function(e){e||0===e?this.el.setAttribute(this.arg,e):this.el.removeAttribute(this.arg),this.isParam&&(this.vm[this.arg]=r.checkNumber(e))}},o.text={bind:function(){this.attr=3===this.el.nodeType?"nodeValue":"textContent"},update:function(e){this.el[this.attr]=r.guard(e)}},o.show=function(e){var t=this.el,i=e?"":"none",r=function(){t.style.display=i};s(t,e?1:-1,r,this.compiler)},o["class"]=function(e){this.arg?r[e?"addClass":"removeClass"](this.el,this.arg):(this.lastVal&&r.removeClass(this.el,this.lastVal),e&&(r.addClass(this.el,e),this.lastVal=e))},o.cloak={isEmpty:!0,bind:function(){var e=this.el;this.compiler.observer.once("hook:ready",function(){e.removeAttribute(n.prefix+"-cloak")})}},o.ref={isLiteral:!0,bind:function(){var e=this.expression;e&&(this.vm.$parent.$[e]=this.vm)},unbind:function(){var e=this.expression;e&&delete this.vm.$parent.$[e]}},o.on=t("./on"),o.repeat=t("./repeat"),o.model=t("./model"),o["if"]=t("./if"),o["with"]=t("./with"),o.html=t("./html"),o.style=t("./style"),o.partial=t("./partial"),o.view=t("./view")}),e.register("vue/src/directives/if.js",function(e,t,i){var r=t("../utils");i.exports={bind:function(){this.parent=this.el.parentNode,this.ref=document.createComment("vue-if"),this.Ctor=this.compiler.resolveComponent(this.el),this.parent.insertBefore(this.ref,this.el),this.parent.removeChild(this.el),r.attr(this.el,"view"),r.attr(this.el,"repeat")},update:function(e){e?this.childVM||(this.childVM=new this.Ctor({el:this.el.cloneNode(!0),parent:this.vm}),this.compiler.init?this.parent.insertBefore(this.childVM.$el,this.ref):this.childVM.$before(this.ref)):this.unbind()},unbind:function(){this.childVM&&(this.childVM.$destroy(),this.childVM=null)}}}),e.register("vue/src/directives/repeat.js",function(e,t,i){function r(e,t){for(var i,r=0,n=e.length;n>r;r++)if(i=e[r],!i.$reused&&i.$value===t)return r;return-1}var n=t("../utils"),s=t("../config");i.exports={bind:function(){this.identifier="$r"+this.id,this.expCache=n.hash();var e=this.el,t=this.container=e.parentNode;this.childId=this.compiler.eval(n.attr(e,"ref")),this.ref=document.createComment(s.prefix+"-repeat-"+this.key),t.insertBefore(this.ref,e),t.removeChild(e),this.collection=null,this.vms=null},update:function(e){Array.isArray(e)||n.isObject(e)&&(e=n.objectToArray(e)),this.oldVMs=this.vms,this.oldCollection=this.collection,e=this.collection=e||[];var t=e[0]&&n.isObject(e[0]);this.vms=this.oldCollection?this.diff(e,t):this.init(e,t),this.childId&&(this.vm.$[this.childId]=this.vms)},init:function(e,t){for(var i,r=[],n=0,s=e.length;s>n;n++)i=this.build(e[n],n,t),r.push(i),this.compiler.init?this.container.insertBefore(i.$el,this.ref):i.$before(this.ref);return r},diff:function(e,t){var i,n,s,o,a,c,l,u,h=this.container,f=this.oldVMs,d=[];for(d.length=e.length,i=0,n=e.length;n>i;i++)s=e[i],t?(s.$index=i,s.__emitter__&&s.__emitter__[this.identifier]?s.$reused=!0:d[i]=this.build(s,i,t)):(a=r(f,s),a>-1?(f[a].$reused=!0,f[a].$data.$index=i):d[i]=this.build(s,i,t));for(i=0,n=f.length;n>i;i++)o=f[i],s=this.arg?o.$data[this.arg]:o.$data,s.$reused&&(o.$reused=!0,delete s.$reused),o.$reused?(o.$index=s.$index,s.$key&&s.$key!==o.$key&&(o.$key=s.$key),d[o.$index]=o):(s.__emitter__&&delete s.__emitter__[this.identifier],o.$destroy());for(i=d.length;i--;)if(o=d[i],s=o.$data,c=d[i+1],o.$reused){for(u=o.$el.nextSibling;!u.vue_vm&&u!==this.ref;)u=u.nextSibling;if(l=u.vue_vm,l!==c)if(c){for(u=c.$el;!u.parentNode;)c=d[u.vue_vm.$index+1],u=c?c.$el:this.ref;h.insertBefore(o.$el,u)}else h.insertBefore(o.$el,this.ref);delete o.$reused,delete s.$index,delete s.$key}else o.$before(c?c.$el:this.ref);return d},build:function(e,t,i){var r,n,s=!i||this.arg;s&&(r=e,n=this.arg||"$value",e={},e[n]=r),e.$index=t;var o=this.el.cloneNode(!0),a=this.compiler.resolveComponent(o,e),c=new a({el:o,data:e,parent:this.vm,compilerOptions:{repeat:!0,expCache:this.expCache}});return i&&((r||e).__emitter__[this.identifier]=!0),c},unbind:function(){if(this.childId&&delete this.vm.$[this.childId],this.vms)for(var e=this.vms.length;e--;)this.vms[e].$destroy()}}}),e.register("vue/src/directives/on.js",function(e,t,i){t("../utils");i.exports={isFn:!0,bind:function(){if(this.context=this.binding.isExp?this.vm:this.binding.compiler.vm,"IFRAME"===this.el.tagName&&"load"!==this.arg){var e=this;this.iframeBind=function(){e.el.contentWindow.addEventListener(e.arg,e.handler)},this.el.addEventListener("load",this.iframeBind)}},update:function(e){if("function"==typeof e){this.reset();var t=this.vm,i=this.context;this.handler=function(r){r.targetVM=t,i.$event=r;var n=e.call(i,r);return i.$event=null,n},this.iframeBind?this.iframeBind():this.el.addEventListener(this.arg,this.handler)}},reset:function(){var e=this.iframeBind?this.el.contentWindow:this.el;e.removeEventListener(this.arg,this.handler)},unbind:function(){this.reset(),this.el.removeEventListener("load",this.iframeBind)}}}),e.register("vue/src/directives/model.js",function(e,t,i){function r(e){return o.call(e.options,function(e){return e.selected}).map(function(e){return e.value||e.text})}var n=t("../utils"),s=navigator.userAgent.indexOf("MSIE 9.0")>0,o=[].filter;i.exports={bind:function(){var e=this,t=e.el,i=t.type,r=t.tagName;e.lock=!1,e.ownerVM=e.binding.compiler.vm,e.event=e.compiler.options.lazy||"SELECT"===r||"checkbox"===i||"radio"===i?"change":"input",e.attr="checkbox"===i?"checked":"INPUT"===r||"SELECT"===r||"TEXTAREA"===r?"value":"innerHTML","SELECT"===r&&t.hasAttribute("multiple")&&(this.multi=!0);var o=!1;e.cLock=function(){o=!0},e.cUnlock=function(){o=!1},t.addEventListener("compositionstart",this.cLock),t.addEventListener("compositionend",this.cUnlock),e.set=e.filters?function(){if(!o){var i;try{i=t.selectionStart}catch(r){}e._set(),n.nextTick(function(){void 0!==i&&t.setSelectionRange(i,i)})}}:function(){o||(e.lock=!0,e._set(),n.nextTick(function(){e.lock=!1}))},t.addEventListener(e.event,e.set),s&&(e.onCut=function(){n.nextTick(function(){e.set()})},e.onDel=function(t){(46===t.keyCode||8===t.keyCode)&&e.set()},t.addEventListener("cut",e.onCut),t.addEventListener("keyup",e.onDel))},_set:function(){this.ownerVM.$set(this.key,this.multi?r(this.el):this.el[this.attr])},update:function(e,t){if(t&&void 0===e)return this._set();if(!this.lock){var i=this.el;"SELECT"===i.tagName?(i.selectedIndex=-1,this.multi&&Array.isArray(e)?e.forEach(this.updateSelect,this):this.updateSelect(e)):"radio"===i.type?i.checked=e==i.value:"checkbox"===i.type?i.checked=!!e:i[this.attr]=n.guard(e)}},updateSelect:function(e){for(var t=this.el.options,i=t.length;i--;)if(t[i].value==e){t[i].selected=!0;break}},unbind:function(){var e=this.el;e.removeEventListener(this.event,this.set),e.removeEventListener("compositionstart",this.cLock),e.removeEventListener("compositionend",this.cUnlock),s&&(e.removeEventListener("cut",this.onCut),e.removeEventListener("keyup",this.onDel))}}}),e.register("vue/src/directives/with.js",function(e,t,i){var r=t("../utils");i.exports={bind:function(){var e=this,t=e.arg,i=e.key,n=e.compiler,s=e.binding.compiler;return n===s?void(this.alone=!0):void(t&&(n.bindings[t]||n.createBinding(t),n.observer.on("change:"+t,function(t){n.init||(e.lock||(e.lock=!0,r.nextTick(function(){e.lock=!1})),s.vm.$set(i,t))})))},update:function(e){this.alone||this.lock||(this.arg?this.vm.$set(this.arg,e):this.vm.$data!==e&&(this.vm.$data=e))}}}),e.register("vue/src/directives/html.js",function(e,t,i){var r=t("../utils"),n=[].slice;i.exports={bind:function(){8===this.el.nodeType&&(this.nodes=[])},update:function(e){e=r.guard(e),this.nodes?this.swap(e):this.el.innerHTML=e},swap:function(e){for(var t=this.el.parentNode,i=this.nodes,s=i.length;s--;)t.removeChild(i[s]);var o=r.toFragment(e);this.nodes=n.call(o.childNodes),t.insertBefore(o,this.el)}}}),e.register("vue/src/directives/style.js",function(e,t,i){var r=["-webkit-","-moz-","-ms-"];i.exports={bind:function(){var e=this.arg;e&&("$"===e.charAt(0)&&(e=e.slice(1),this.prefixed=!0),this.prop=e)},update:function(e){var t=this.prop;if(t){var i="!important"===e.slice(-10)?"important":"";if(i&&(e=e.slice(0,-10).trim()),this.el.style.setProperty(t,e,i),this.prefixed)for(var n=r.length;n--;)this.el.style.setProperty(r[n]+t,e,i)}else this.el.style.cssText=e}}}),e.register("vue/src/directives/partial.js",function(e,t,i){t("../utils");i.exports={isLiteral:!0,bind:function(){var e=this.expression;if(e){var t=this.el,i=this.compiler,r=i.getOption("partials",e);if(r)if(r=r.cloneNode(!0),8===t.nodeType){var n=[].slice.call(r.childNodes),s=t.parentNode;s.insertBefore(r,t),s.removeChild(t),n.forEach(i.compile,i)}else t.innerHTML="",t.appendChild(r)}}}}),e.register("vue/src/directives/view.js",function(e,t,i){i.exports={bind:function(){var e=this.raw=this.el,t=e.parentNode,i=this.ref=document.createComment("v-view");t.insertBefore(i,e),t.removeChild(e);for(var r,n=this.inner=document.createElement("div");r=e.firstChild;)n.appendChild(r)},update:function(e){this.unbind();var t=this.compiler.getOption("components",e);t&&(this.childVM=new t({el:this.raw.cloneNode(!0),parent:this.vm,compilerOptions:{rawContent:this.inner.cloneNode(!0)}}),this.el=this.childVM.$el,this.compiler.init?this.ref.parentNode.insertBefore(this.el,this.ref):this.childVM.$before(this.ref))},unbind:function(){this.childVM&&this.childVM.$destroy()}}}),e.alias("vue/src/main.js","vue/index.js"),"object"==typeof exports?module.exports=e("vue"):"function"==typeof define&&define.amd?define(function(){return e("vue")}):window.Vue=e("vue")}();
|
@@ -0,0 +1,45 @@
|
|
1
|
+
var utils = require('./utils')
|
2
|
+
|
3
|
+
function Batcher () {
|
4
|
+
this.reset()
|
5
|
+
}
|
6
|
+
|
7
|
+
var BatcherProto = Batcher.prototype
|
8
|
+
|
9
|
+
BatcherProto.push = function (job) {
|
10
|
+
if (!job.id || !this.has[job.id]) {
|
11
|
+
this.queue.push(job)
|
12
|
+
this.has[job.id] = job
|
13
|
+
if (!this.waiting) {
|
14
|
+
this.waiting = true
|
15
|
+
utils.nextTick(utils.bind(this.flush, this))
|
16
|
+
}
|
17
|
+
} else if (job.override) {
|
18
|
+
var oldJob = this.has[job.id]
|
19
|
+
oldJob.cancelled = true
|
20
|
+
this.queue.push(job)
|
21
|
+
this.has[job.id] = job
|
22
|
+
}
|
23
|
+
}
|
24
|
+
|
25
|
+
BatcherProto.flush = function () {
|
26
|
+
// before flush hook
|
27
|
+
if (this._preFlush) this._preFlush()
|
28
|
+
// do not cache length because more jobs might be pushed
|
29
|
+
// as we execute existing jobs
|
30
|
+
for (var i = 0; i < this.queue.length; i++) {
|
31
|
+
var job = this.queue[i]
|
32
|
+
if (!job.cancelled) {
|
33
|
+
job.execute()
|
34
|
+
}
|
35
|
+
}
|
36
|
+
this.reset()
|
37
|
+
}
|
38
|
+
|
39
|
+
BatcherProto.reset = function () {
|
40
|
+
this.has = utils.hash()
|
41
|
+
this.queue = []
|
42
|
+
this.waiting = false
|
43
|
+
}
|
44
|
+
|
45
|
+
module.exports = Batcher
|
@@ -0,0 +1,103 @@
|
|
1
|
+
var Batcher = require('./batcher'),
|
2
|
+
bindingBatcher = new Batcher(),
|
3
|
+
bindingId = 1
|
4
|
+
|
5
|
+
/**
|
6
|
+
* Binding class.
|
7
|
+
*
|
8
|
+
* each property on the viewmodel has one corresponding Binding object
|
9
|
+
* which has multiple directive instances on the DOM
|
10
|
+
* and multiple computed property dependents
|
11
|
+
*/
|
12
|
+
function Binding (compiler, key, isExp, isFn) {
|
13
|
+
this.id = bindingId++
|
14
|
+
this.value = undefined
|
15
|
+
this.isExp = !!isExp
|
16
|
+
this.isFn = isFn
|
17
|
+
this.root = !this.isExp && key.indexOf('.') === -1
|
18
|
+
this.compiler = compiler
|
19
|
+
this.key = key
|
20
|
+
this.dirs = []
|
21
|
+
this.subs = []
|
22
|
+
this.deps = []
|
23
|
+
this.unbound = false
|
24
|
+
}
|
25
|
+
|
26
|
+
var BindingProto = Binding.prototype
|
27
|
+
|
28
|
+
/**
|
29
|
+
* Update value and queue instance updates.
|
30
|
+
*/
|
31
|
+
BindingProto.update = function (value) {
|
32
|
+
if (!this.isComputed || this.isFn) {
|
33
|
+
this.value = value
|
34
|
+
}
|
35
|
+
if (this.dirs.length || this.subs.length) {
|
36
|
+
var self = this
|
37
|
+
bindingBatcher.push({
|
38
|
+
id: this.id,
|
39
|
+
execute: function () {
|
40
|
+
if (!self.unbound) {
|
41
|
+
self._update()
|
42
|
+
}
|
43
|
+
}
|
44
|
+
})
|
45
|
+
}
|
46
|
+
}
|
47
|
+
|
48
|
+
/**
|
49
|
+
* Actually update the directives.
|
50
|
+
*/
|
51
|
+
BindingProto._update = function () {
|
52
|
+
var i = this.dirs.length,
|
53
|
+
value = this.val()
|
54
|
+
while (i--) {
|
55
|
+
this.dirs[i].$update(value)
|
56
|
+
}
|
57
|
+
this.pub()
|
58
|
+
}
|
59
|
+
|
60
|
+
/**
|
61
|
+
* Return the valuated value regardless
|
62
|
+
* of whether it is computed or not
|
63
|
+
*/
|
64
|
+
BindingProto.val = function () {
|
65
|
+
return this.isComputed && !this.isFn
|
66
|
+
? this.value.$get()
|
67
|
+
: this.value
|
68
|
+
}
|
69
|
+
|
70
|
+
/**
|
71
|
+
* Notify computed properties that depend on this binding
|
72
|
+
* to update themselves
|
73
|
+
*/
|
74
|
+
BindingProto.pub = function () {
|
75
|
+
var i = this.subs.length
|
76
|
+
while (i--) {
|
77
|
+
this.subs[i].update()
|
78
|
+
}
|
79
|
+
}
|
80
|
+
|
81
|
+
/**
|
82
|
+
* Unbind the binding, remove itself from all of its dependencies
|
83
|
+
*/
|
84
|
+
BindingProto.unbind = function () {
|
85
|
+
// Indicate this has been unbound.
|
86
|
+
// It's possible this binding will be in
|
87
|
+
// the batcher's flush queue when its owner
|
88
|
+
// compiler has already been destroyed.
|
89
|
+
this.unbound = true
|
90
|
+
var i = this.dirs.length
|
91
|
+
while (i--) {
|
92
|
+
this.dirs[i].$unbind()
|
93
|
+
}
|
94
|
+
i = this.deps.length
|
95
|
+
var subs
|
96
|
+
while (i--) {
|
97
|
+
subs = this.deps[i].subs
|
98
|
+
var j = subs.indexOf(this)
|
99
|
+
if (j > -1) subs.splice(j, 1)
|
100
|
+
}
|
101
|
+
}
|
102
|
+
|
103
|
+
module.exports = Binding
|
@@ -0,0 +1,1037 @@
|
|
1
|
+
var Emitter = require('./emitter'),
|
2
|
+
Observer = require('./observer'),
|
3
|
+
config = require('./config'),
|
4
|
+
utils = require('./utils'),
|
5
|
+
Binding = require('./binding'),
|
6
|
+
Directive = require('./directive'),
|
7
|
+
TextParser = require('./text-parser'),
|
8
|
+
DepsParser = require('./deps-parser'),
|
9
|
+
ExpParser = require('./exp-parser'),
|
10
|
+
ViewModel,
|
11
|
+
|
12
|
+
// cache methods
|
13
|
+
slice = [].slice,
|
14
|
+
extend = utils.extend,
|
15
|
+
hasOwn = ({}).hasOwnProperty,
|
16
|
+
def = Object.defineProperty,
|
17
|
+
|
18
|
+
// hooks to register
|
19
|
+
hooks = [
|
20
|
+
'created', 'ready',
|
21
|
+
'beforeDestroy', 'afterDestroy',
|
22
|
+
'attached', 'detached'
|
23
|
+
],
|
24
|
+
|
25
|
+
// list of priority directives
|
26
|
+
// that needs to be checked in specific order
|
27
|
+
priorityDirectives = [
|
28
|
+
'if',
|
29
|
+
'repeat',
|
30
|
+
'view',
|
31
|
+
'component'
|
32
|
+
]
|
33
|
+
|
34
|
+
/**
|
35
|
+
* The DOM compiler
|
36
|
+
* scans a DOM node and compile bindings for a ViewModel
|
37
|
+
*/
|
38
|
+
function Compiler (vm, options) {
|
39
|
+
|
40
|
+
var compiler = this,
|
41
|
+
key, i
|
42
|
+
|
43
|
+
// default state
|
44
|
+
compiler.init = true
|
45
|
+
compiler.destroyed = false
|
46
|
+
|
47
|
+
// process and extend options
|
48
|
+
options = compiler.options = options || {}
|
49
|
+
utils.processOptions(options)
|
50
|
+
|
51
|
+
// copy compiler options
|
52
|
+
extend(compiler, options.compilerOptions)
|
53
|
+
// repeat indicates this is a v-repeat instance
|
54
|
+
compiler.repeat = compiler.repeat || false
|
55
|
+
// expCache will be shared between v-repeat instances
|
56
|
+
compiler.expCache = compiler.expCache || {}
|
57
|
+
|
58
|
+
// initialize element
|
59
|
+
var el = compiler.el = compiler.setupElement(options)
|
60
|
+
utils.log('\nnew VM instance: ' + el.tagName + '\n')
|
61
|
+
|
62
|
+
// set other compiler properties
|
63
|
+
compiler.vm = el.vue_vm = vm
|
64
|
+
compiler.bindings = utils.hash()
|
65
|
+
compiler.dirs = []
|
66
|
+
compiler.deferred = []
|
67
|
+
compiler.computed = []
|
68
|
+
compiler.children = []
|
69
|
+
compiler.emitter = new Emitter(vm)
|
70
|
+
|
71
|
+
// VM ---------------------------------------------------------------------
|
72
|
+
|
73
|
+
// set VM properties
|
74
|
+
vm.$ = {}
|
75
|
+
vm.$el = el
|
76
|
+
vm.$options = options
|
77
|
+
vm.$compiler = compiler
|
78
|
+
vm.$event = null
|
79
|
+
|
80
|
+
// set parent & root
|
81
|
+
var parentVM = options.parent
|
82
|
+
if (parentVM) {
|
83
|
+
compiler.parent = parentVM.$compiler
|
84
|
+
parentVM.$compiler.children.push(compiler)
|
85
|
+
vm.$parent = parentVM
|
86
|
+
// inherit lazy option
|
87
|
+
if (!('lazy' in options)) {
|
88
|
+
options.lazy = compiler.parent.options.lazy
|
89
|
+
}
|
90
|
+
}
|
91
|
+
vm.$root = getRoot(compiler).vm
|
92
|
+
|
93
|
+
// DATA -------------------------------------------------------------------
|
94
|
+
|
95
|
+
// setup observer
|
96
|
+
// this is necesarry for all hooks and data observation events
|
97
|
+
compiler.setupObserver()
|
98
|
+
|
99
|
+
// create bindings for computed properties
|
100
|
+
if (options.methods) {
|
101
|
+
for (key in options.methods) {
|
102
|
+
compiler.createBinding(key)
|
103
|
+
}
|
104
|
+
}
|
105
|
+
|
106
|
+
// create bindings for methods
|
107
|
+
if (options.computed) {
|
108
|
+
for (key in options.computed) {
|
109
|
+
compiler.createBinding(key)
|
110
|
+
}
|
111
|
+
}
|
112
|
+
|
113
|
+
// initialize data
|
114
|
+
var data = compiler.data = options.data || {},
|
115
|
+
defaultData = options.defaultData
|
116
|
+
if (defaultData) {
|
117
|
+
for (key in defaultData) {
|
118
|
+
if (!hasOwn.call(data, key)) {
|
119
|
+
data[key] = defaultData[key]
|
120
|
+
}
|
121
|
+
}
|
122
|
+
}
|
123
|
+
|
124
|
+
// copy paramAttributes
|
125
|
+
var params = options.paramAttributes
|
126
|
+
if (params) {
|
127
|
+
i = params.length
|
128
|
+
while (i--) {
|
129
|
+
data[params[i]] = utils.checkNumber(
|
130
|
+
compiler.eval(
|
131
|
+
el.getAttribute(params[i])
|
132
|
+
)
|
133
|
+
)
|
134
|
+
}
|
135
|
+
}
|
136
|
+
|
137
|
+
// copy data properties to vm
|
138
|
+
// so user can access them in the created hook
|
139
|
+
extend(vm, data)
|
140
|
+
vm.$data = data
|
141
|
+
|
142
|
+
// beforeCompile hook
|
143
|
+
compiler.execHook('created')
|
144
|
+
|
145
|
+
// the user might have swapped the data ...
|
146
|
+
data = compiler.data = vm.$data
|
147
|
+
|
148
|
+
// user might also set some properties on the vm
|
149
|
+
// in which case we should copy back to $data
|
150
|
+
var vmProp
|
151
|
+
for (key in vm) {
|
152
|
+
vmProp = vm[key]
|
153
|
+
if (
|
154
|
+
key.charAt(0) !== '$' &&
|
155
|
+
data[key] !== vmProp &&
|
156
|
+
typeof vmProp !== 'function'
|
157
|
+
) {
|
158
|
+
data[key] = vmProp
|
159
|
+
}
|
160
|
+
}
|
161
|
+
|
162
|
+
// now we can observe the data.
|
163
|
+
// this will convert data properties to getter/setters
|
164
|
+
// and emit the first batch of set events, which will
|
165
|
+
// in turn create the corresponding bindings.
|
166
|
+
compiler.observeData(data)
|
167
|
+
|
168
|
+
// COMPILE ----------------------------------------------------------------
|
169
|
+
|
170
|
+
// before compiling, resolve content insertion points
|
171
|
+
if (options.template) {
|
172
|
+
this.resolveContent()
|
173
|
+
}
|
174
|
+
|
175
|
+
// now parse the DOM and bind directives.
|
176
|
+
// During this stage, we will also create bindings for
|
177
|
+
// encountered keypaths that don't have a binding yet.
|
178
|
+
compiler.compile(el, true)
|
179
|
+
|
180
|
+
// Any directive that creates child VMs are deferred
|
181
|
+
// so that when they are compiled, all bindings on the
|
182
|
+
// parent VM have been created.
|
183
|
+
i = compiler.deferred.length
|
184
|
+
while (i--) {
|
185
|
+
compiler.bindDirective(compiler.deferred[i])
|
186
|
+
}
|
187
|
+
compiler.deferred = null
|
188
|
+
|
189
|
+
// extract dependencies for computed properties.
|
190
|
+
// this will evaluated all collected computed bindings
|
191
|
+
// and collect get events that are emitted.
|
192
|
+
if (this.computed.length) {
|
193
|
+
DepsParser.parse(this.computed)
|
194
|
+
}
|
195
|
+
|
196
|
+
// done!
|
197
|
+
compiler.init = false
|
198
|
+
|
199
|
+
// post compile / ready hook
|
200
|
+
compiler.execHook('ready')
|
201
|
+
}
|
202
|
+
|
203
|
+
var CompilerProto = Compiler.prototype
|
204
|
+
|
205
|
+
/**
|
206
|
+
* Initialize the VM/Compiler's element.
|
207
|
+
* Fill it in with the template if necessary.
|
208
|
+
*/
|
209
|
+
CompilerProto.setupElement = function (options) {
|
210
|
+
// create the node first
|
211
|
+
var el = typeof options.el === 'string'
|
212
|
+
? document.querySelector(options.el)
|
213
|
+
: options.el || document.createElement(options.tagName || 'div')
|
214
|
+
|
215
|
+
var template = options.template,
|
216
|
+
child, replacer, i, attr, attrs
|
217
|
+
|
218
|
+
if (template) {
|
219
|
+
// collect anything already in there
|
220
|
+
if (el.hasChildNodes()) {
|
221
|
+
this.rawContent = document.createElement('div')
|
222
|
+
/* jshint boss: true */
|
223
|
+
while (child = el.firstChild) {
|
224
|
+
this.rawContent.appendChild(child)
|
225
|
+
}
|
226
|
+
}
|
227
|
+
// replace option: use the first node in
|
228
|
+
// the template directly
|
229
|
+
if (options.replace && template.firstChild === template.lastChild) {
|
230
|
+
replacer = template.firstChild.cloneNode(true)
|
231
|
+
if (el.parentNode) {
|
232
|
+
el.parentNode.insertBefore(replacer, el)
|
233
|
+
el.parentNode.removeChild(el)
|
234
|
+
}
|
235
|
+
// copy over attributes
|
236
|
+
if (el.hasAttributes()) {
|
237
|
+
i = el.attributes.length
|
238
|
+
while (i--) {
|
239
|
+
attr = el.attributes[i]
|
240
|
+
replacer.setAttribute(attr.name, attr.value)
|
241
|
+
}
|
242
|
+
}
|
243
|
+
// replace
|
244
|
+
el = replacer
|
245
|
+
} else {
|
246
|
+
el.appendChild(template.cloneNode(true))
|
247
|
+
}
|
248
|
+
|
249
|
+
}
|
250
|
+
|
251
|
+
// apply element options
|
252
|
+
if (options.id) el.id = options.id
|
253
|
+
if (options.className) el.className = options.className
|
254
|
+
attrs = options.attributes
|
255
|
+
if (attrs) {
|
256
|
+
for (attr in attrs) {
|
257
|
+
el.setAttribute(attr, attrs[attr])
|
258
|
+
}
|
259
|
+
}
|
260
|
+
|
261
|
+
return el
|
262
|
+
}
|
263
|
+
|
264
|
+
/**
|
265
|
+
* Deal with <content> insertion points
|
266
|
+
* per the Web Components spec
|
267
|
+
*/
|
268
|
+
CompilerProto.resolveContent = function () {
|
269
|
+
|
270
|
+
var outlets = slice.call(this.el.getElementsByTagName('content')),
|
271
|
+
raw = this.rawContent,
|
272
|
+
outlet, select, i, j, main
|
273
|
+
|
274
|
+
i = outlets.length
|
275
|
+
if (i) {
|
276
|
+
// first pass, collect corresponding content
|
277
|
+
// for each outlet.
|
278
|
+
while (i--) {
|
279
|
+
outlet = outlets[i]
|
280
|
+
if (raw) {
|
281
|
+
select = outlet.getAttribute('select')
|
282
|
+
if (select) { // select content
|
283
|
+
outlet.content =
|
284
|
+
slice.call(raw.querySelectorAll(select))
|
285
|
+
} else { // default content
|
286
|
+
main = outlet
|
287
|
+
}
|
288
|
+
} else { // fallback content
|
289
|
+
outlet.content =
|
290
|
+
slice.call(outlet.childNodes)
|
291
|
+
}
|
292
|
+
}
|
293
|
+
// second pass, actually insert the contents
|
294
|
+
for (i = 0, j = outlets.length; i < j; i++) {
|
295
|
+
outlet = outlets[i]
|
296
|
+
if (outlet === main) continue
|
297
|
+
insert(outlet, outlet.content)
|
298
|
+
}
|
299
|
+
// finally insert the main content
|
300
|
+
if (raw && main) {
|
301
|
+
insert(main, slice.call(raw.childNodes))
|
302
|
+
}
|
303
|
+
}
|
304
|
+
|
305
|
+
function insert (outlet, contents) {
|
306
|
+
var parent = outlet.parentNode,
|
307
|
+
i = 0, j = contents.length
|
308
|
+
for (; i < j; i++) {
|
309
|
+
parent.insertBefore(contents[i], outlet)
|
310
|
+
}
|
311
|
+
parent.removeChild(outlet)
|
312
|
+
}
|
313
|
+
|
314
|
+
this.rawContent = null
|
315
|
+
}
|
316
|
+
|
317
|
+
/**
|
318
|
+
* Setup observer.
|
319
|
+
* The observer listens for get/set/mutate events on all VM
|
320
|
+
* values/objects and trigger corresponding binding updates.
|
321
|
+
* It also listens for lifecycle hooks.
|
322
|
+
*/
|
323
|
+
CompilerProto.setupObserver = function () {
|
324
|
+
|
325
|
+
var compiler = this,
|
326
|
+
bindings = compiler.bindings,
|
327
|
+
options = compiler.options,
|
328
|
+
observer = compiler.observer = new Emitter(compiler.vm)
|
329
|
+
|
330
|
+
// a hash to hold event proxies for each root level key
|
331
|
+
// so they can be referenced and removed later
|
332
|
+
observer.proxies = {}
|
333
|
+
|
334
|
+
// add own listeners which trigger binding updates
|
335
|
+
observer
|
336
|
+
.on('get', onGet)
|
337
|
+
.on('set', onSet)
|
338
|
+
.on('mutate', onSet)
|
339
|
+
|
340
|
+
// register hooks
|
341
|
+
var i = hooks.length, j, hook, fns
|
342
|
+
while (i--) {
|
343
|
+
hook = hooks[i]
|
344
|
+
fns = options[hook]
|
345
|
+
if (Array.isArray(fns)) {
|
346
|
+
j = fns.length
|
347
|
+
// since hooks were merged with child at head,
|
348
|
+
// we loop reversely.
|
349
|
+
while (j--) {
|
350
|
+
registerHook(hook, fns[j])
|
351
|
+
}
|
352
|
+
} else if (fns) {
|
353
|
+
registerHook(hook, fns)
|
354
|
+
}
|
355
|
+
}
|
356
|
+
|
357
|
+
// broadcast attached/detached hooks
|
358
|
+
observer
|
359
|
+
.on('hook:attached', function () {
|
360
|
+
broadcast(1)
|
361
|
+
})
|
362
|
+
.on('hook:detached', function () {
|
363
|
+
broadcast(0)
|
364
|
+
})
|
365
|
+
|
366
|
+
function onGet (key) {
|
367
|
+
check(key)
|
368
|
+
DepsParser.catcher.emit('get', bindings[key])
|
369
|
+
}
|
370
|
+
|
371
|
+
function onSet (key, val, mutation) {
|
372
|
+
observer.emit('change:' + key, val, mutation)
|
373
|
+
check(key)
|
374
|
+
bindings[key].update(val)
|
375
|
+
}
|
376
|
+
|
377
|
+
function registerHook (hook, fn) {
|
378
|
+
observer.on('hook:' + hook, function () {
|
379
|
+
fn.call(compiler.vm)
|
380
|
+
})
|
381
|
+
}
|
382
|
+
|
383
|
+
function broadcast (event) {
|
384
|
+
var children = compiler.children
|
385
|
+
if (children) {
|
386
|
+
var child, i = children.length
|
387
|
+
while (i--) {
|
388
|
+
child = children[i]
|
389
|
+
if (child.el.parentNode) {
|
390
|
+
event = 'hook:' + (event ? 'attached' : 'detached')
|
391
|
+
child.observer.emit(event)
|
392
|
+
child.emitter.emit(event)
|
393
|
+
}
|
394
|
+
}
|
395
|
+
}
|
396
|
+
}
|
397
|
+
|
398
|
+
function check (key) {
|
399
|
+
if (!bindings[key]) {
|
400
|
+
compiler.createBinding(key)
|
401
|
+
}
|
402
|
+
}
|
403
|
+
}
|
404
|
+
|
405
|
+
CompilerProto.observeData = function (data) {
|
406
|
+
|
407
|
+
var compiler = this,
|
408
|
+
observer = compiler.observer
|
409
|
+
|
410
|
+
// recursively observe nested properties
|
411
|
+
Observer.observe(data, '', observer)
|
412
|
+
|
413
|
+
// also create binding for top level $data
|
414
|
+
// so it can be used in templates too
|
415
|
+
var $dataBinding = compiler.bindings['$data'] = new Binding(compiler, '$data')
|
416
|
+
$dataBinding.update(data)
|
417
|
+
|
418
|
+
// allow $data to be swapped
|
419
|
+
def(compiler.vm, '$data', {
|
420
|
+
get: function () {
|
421
|
+
compiler.observer.emit('get', '$data')
|
422
|
+
return compiler.data
|
423
|
+
},
|
424
|
+
set: function (newData) {
|
425
|
+
var oldData = compiler.data
|
426
|
+
Observer.unobserve(oldData, '', observer)
|
427
|
+
compiler.data = newData
|
428
|
+
Observer.copyPaths(newData, oldData)
|
429
|
+
Observer.observe(newData, '', observer)
|
430
|
+
update()
|
431
|
+
}
|
432
|
+
})
|
433
|
+
|
434
|
+
// emit $data change on all changes
|
435
|
+
observer
|
436
|
+
.on('set', onSet)
|
437
|
+
.on('mutate', onSet)
|
438
|
+
|
439
|
+
function onSet (key) {
|
440
|
+
if (key !== '$data') update()
|
441
|
+
}
|
442
|
+
|
443
|
+
function update () {
|
444
|
+
$dataBinding.update(compiler.data)
|
445
|
+
observer.emit('change:$data', compiler.data)
|
446
|
+
}
|
447
|
+
}
|
448
|
+
|
449
|
+
/**
|
450
|
+
* Compile a DOM node (recursive)
|
451
|
+
*/
|
452
|
+
CompilerProto.compile = function (node, root) {
|
453
|
+
var nodeType = node.nodeType
|
454
|
+
if (nodeType === 1 && node.tagName !== 'SCRIPT') { // a normal node
|
455
|
+
this.compileElement(node, root)
|
456
|
+
} else if (nodeType === 3 && config.interpolate) {
|
457
|
+
this.compileTextNode(node)
|
458
|
+
}
|
459
|
+
}
|
460
|
+
|
461
|
+
/**
|
462
|
+
* Check for a priority directive
|
463
|
+
* If it is present and valid, return true to skip the rest
|
464
|
+
*/
|
465
|
+
CompilerProto.checkPriorityDir = function (dirname, node, root) {
|
466
|
+
var expression, directive, Ctor
|
467
|
+
if (
|
468
|
+
dirname === 'component' &&
|
469
|
+
root !== true &&
|
470
|
+
(Ctor = this.resolveComponent(node, undefined, true))
|
471
|
+
) {
|
472
|
+
directive = this.parseDirective(dirname, '', node)
|
473
|
+
directive.Ctor = Ctor
|
474
|
+
} else {
|
475
|
+
expression = utils.attr(node, dirname)
|
476
|
+
directive = expression && this.parseDirective(dirname, expression, node)
|
477
|
+
}
|
478
|
+
if (directive) {
|
479
|
+
if (root === true) {
|
480
|
+
utils.warn(
|
481
|
+
'Directive v-' + dirname + ' cannot be used on an already instantiated ' +
|
482
|
+
'VM\'s root node. Use it from the parent\'s template instead.'
|
483
|
+
)
|
484
|
+
return
|
485
|
+
}
|
486
|
+
this.deferred.push(directive)
|
487
|
+
return true
|
488
|
+
}
|
489
|
+
}
|
490
|
+
|
491
|
+
/**
|
492
|
+
* Compile normal directives on a node
|
493
|
+
*/
|
494
|
+
CompilerProto.compileElement = function (node, root) {
|
495
|
+
|
496
|
+
// textarea is pretty annoying
|
497
|
+
// because its value creates childNodes which
|
498
|
+
// we don't want to compile.
|
499
|
+
if (node.tagName === 'TEXTAREA' && node.value) {
|
500
|
+
node.value = this.eval(node.value)
|
501
|
+
}
|
502
|
+
|
503
|
+
// only compile if this element has attributes
|
504
|
+
// or its tagName contains a hyphen (which means it could
|
505
|
+
// potentially be a custom element)
|
506
|
+
if (node.hasAttributes() || node.tagName.indexOf('-') > -1) {
|
507
|
+
|
508
|
+
// skip anything with v-pre
|
509
|
+
if (utils.attr(node, 'pre') !== null) {
|
510
|
+
return
|
511
|
+
}
|
512
|
+
|
513
|
+
var i, l, j, k
|
514
|
+
|
515
|
+
// check priority directives.
|
516
|
+
// if any of them are present, it will take over the node with a childVM
|
517
|
+
// so we can skip the rest
|
518
|
+
for (i = 0, l = priorityDirectives.length; i < l; i++) {
|
519
|
+
if (this.checkPriorityDir(priorityDirectives[i], node, root)) {
|
520
|
+
return
|
521
|
+
}
|
522
|
+
}
|
523
|
+
|
524
|
+
// check transition & animation properties
|
525
|
+
node.vue_trans = utils.attr(node, 'transition')
|
526
|
+
node.vue_anim = utils.attr(node, 'animation')
|
527
|
+
node.vue_effect = this.eval(utils.attr(node, 'effect'))
|
528
|
+
|
529
|
+
var prefix = config.prefix + '-',
|
530
|
+
params = this.options.paramAttributes,
|
531
|
+
attr, attrname, isDirective, exp, directives, directive, dirname
|
532
|
+
|
533
|
+
// v-with has special priority among the rest
|
534
|
+
// it needs to pull in the value from the parent before
|
535
|
+
// computed properties are evaluated, because at this stage
|
536
|
+
// the computed properties have not set up their dependencies yet.
|
537
|
+
if (root) {
|
538
|
+
var withExp = utils.attr(node, 'with')
|
539
|
+
if (withExp) {
|
540
|
+
directives = this.parseDirective('with', withExp, node, true)
|
541
|
+
for (j = 0, k = directives.length; j < k; j++) {
|
542
|
+
this.bindDirective(directives[j], this.parent)
|
543
|
+
}
|
544
|
+
}
|
545
|
+
}
|
546
|
+
|
547
|
+
var attrs = slice.call(node.attributes)
|
548
|
+
for (i = 0, l = attrs.length; i < l; i++) {
|
549
|
+
|
550
|
+
attr = attrs[i]
|
551
|
+
attrname = attr.name
|
552
|
+
isDirective = false
|
553
|
+
|
554
|
+
if (attrname.indexOf(prefix) === 0) {
|
555
|
+
// a directive - split, parse and bind it.
|
556
|
+
isDirective = true
|
557
|
+
dirname = attrname.slice(prefix.length)
|
558
|
+
// build with multiple: true
|
559
|
+
directives = this.parseDirective(dirname, attr.value, node, true)
|
560
|
+
// loop through clauses (separated by ",")
|
561
|
+
// inside each attribute
|
562
|
+
for (j = 0, k = directives.length; j < k; j++) {
|
563
|
+
this.bindDirective(directives[j])
|
564
|
+
}
|
565
|
+
} else if (config.interpolate) {
|
566
|
+
// non directive attribute, check interpolation tags
|
567
|
+
exp = TextParser.parseAttr(attr.value)
|
568
|
+
if (exp) {
|
569
|
+
directive = this.parseDirective('attr', exp, node)
|
570
|
+
directive.arg = attrname
|
571
|
+
if (params && params.indexOf(attrname) > -1) {
|
572
|
+
// a param attribute... we should use the parent binding
|
573
|
+
// to avoid circular updates like size={{size}}
|
574
|
+
this.bindDirective(directive, this.parent)
|
575
|
+
} else {
|
576
|
+
this.bindDirective(directive)
|
577
|
+
}
|
578
|
+
}
|
579
|
+
}
|
580
|
+
|
581
|
+
if (isDirective && dirname !== 'cloak') {
|
582
|
+
node.removeAttribute(attrname)
|
583
|
+
}
|
584
|
+
}
|
585
|
+
|
586
|
+
}
|
587
|
+
|
588
|
+
// recursively compile childNodes
|
589
|
+
if (node.hasChildNodes()) {
|
590
|
+
slice.call(node.childNodes).forEach(this.compile, this)
|
591
|
+
}
|
592
|
+
}
|
593
|
+
|
594
|
+
/**
|
595
|
+
* Compile a text node
|
596
|
+
*/
|
597
|
+
CompilerProto.compileTextNode = function (node) {
|
598
|
+
|
599
|
+
var tokens = TextParser.parse(node.nodeValue)
|
600
|
+
if (!tokens) return
|
601
|
+
var el, token, directive
|
602
|
+
|
603
|
+
for (var i = 0, l = tokens.length; i < l; i++) {
|
604
|
+
|
605
|
+
token = tokens[i]
|
606
|
+
directive = null
|
607
|
+
|
608
|
+
if (token.key) { // a binding
|
609
|
+
if (token.key.charAt(0) === '>') { // a partial
|
610
|
+
el = document.createComment('ref')
|
611
|
+
directive = this.parseDirective('partial', token.key.slice(1), el)
|
612
|
+
} else {
|
613
|
+
if (!token.html) { // text binding
|
614
|
+
el = document.createTextNode('')
|
615
|
+
directive = this.parseDirective('text', token.key, el)
|
616
|
+
} else { // html binding
|
617
|
+
el = document.createComment(config.prefix + '-html')
|
618
|
+
directive = this.parseDirective('html', token.key, el)
|
619
|
+
}
|
620
|
+
}
|
621
|
+
} else { // a plain string
|
622
|
+
el = document.createTextNode(token)
|
623
|
+
}
|
624
|
+
|
625
|
+
// insert node
|
626
|
+
node.parentNode.insertBefore(el, node)
|
627
|
+
// bind directive
|
628
|
+
this.bindDirective(directive)
|
629
|
+
|
630
|
+
}
|
631
|
+
node.parentNode.removeChild(node)
|
632
|
+
}
|
633
|
+
|
634
|
+
/**
|
635
|
+
* Parse a directive name/value pair into one or more
|
636
|
+
* directive instances
|
637
|
+
*/
|
638
|
+
CompilerProto.parseDirective = function (name, value, el, multiple) {
|
639
|
+
var compiler = this,
|
640
|
+
definition = compiler.getOption('directives', name)
|
641
|
+
if (definition) {
|
642
|
+
// parse into AST-like objects
|
643
|
+
var asts = Directive.parse(value)
|
644
|
+
return multiple
|
645
|
+
? asts.map(build)
|
646
|
+
: build(asts[0])
|
647
|
+
}
|
648
|
+
function build (ast) {
|
649
|
+
return new Directive(name, ast, definition, compiler, el)
|
650
|
+
}
|
651
|
+
}
|
652
|
+
|
653
|
+
/**
|
654
|
+
* Add a directive instance to the correct binding & viewmodel
|
655
|
+
*/
|
656
|
+
CompilerProto.bindDirective = function (directive, bindingOwner) {
|
657
|
+
|
658
|
+
if (!directive) return
|
659
|
+
|
660
|
+
// keep track of it so we can unbind() later
|
661
|
+
this.dirs.push(directive)
|
662
|
+
|
663
|
+
// for empty or literal directives, simply call its bind()
|
664
|
+
// and we're done.
|
665
|
+
if (directive.isEmpty || directive.isLiteral) {
|
666
|
+
if (directive.bind) directive.bind()
|
667
|
+
return
|
668
|
+
}
|
669
|
+
|
670
|
+
// otherwise, we got more work to do...
|
671
|
+
var binding,
|
672
|
+
compiler = bindingOwner || this,
|
673
|
+
key = directive.key
|
674
|
+
|
675
|
+
if (directive.isExp) {
|
676
|
+
// expression bindings are always created on current compiler
|
677
|
+
binding = compiler.createBinding(key, directive)
|
678
|
+
} else {
|
679
|
+
// recursively locate which compiler owns the binding
|
680
|
+
while (compiler) {
|
681
|
+
if (compiler.hasKey(key)) {
|
682
|
+
break
|
683
|
+
} else {
|
684
|
+
compiler = compiler.parent
|
685
|
+
}
|
686
|
+
}
|
687
|
+
compiler = compiler || this
|
688
|
+
binding = compiler.bindings[key] || compiler.createBinding(key)
|
689
|
+
}
|
690
|
+
binding.dirs.push(directive)
|
691
|
+
directive.binding = binding
|
692
|
+
|
693
|
+
var value = binding.val()
|
694
|
+
// invoke bind hook if exists
|
695
|
+
if (directive.bind) {
|
696
|
+
directive.bind(value)
|
697
|
+
}
|
698
|
+
// set initial value
|
699
|
+
directive.$update(value, true)
|
700
|
+
}
|
701
|
+
|
702
|
+
/**
|
703
|
+
* Create binding and attach getter/setter for a key to the viewmodel object
|
704
|
+
*/
|
705
|
+
CompilerProto.createBinding = function (key, directive) {
|
706
|
+
|
707
|
+
utils.log(' created binding: ' + key)
|
708
|
+
|
709
|
+
var compiler = this,
|
710
|
+
methods = compiler.options.methods,
|
711
|
+
isExp = directive && directive.isExp,
|
712
|
+
isFn = (directive && directive.isFn) || (methods && methods[key]),
|
713
|
+
bindings = compiler.bindings,
|
714
|
+
computed = compiler.options.computed,
|
715
|
+
binding = new Binding(compiler, key, isExp, isFn)
|
716
|
+
|
717
|
+
if (isExp) {
|
718
|
+
// expression bindings are anonymous
|
719
|
+
compiler.defineExp(key, binding, directive)
|
720
|
+
} else if (isFn) {
|
721
|
+
bindings[key] = binding
|
722
|
+
compiler.defineVmProp(key, binding, methods[key])
|
723
|
+
} else {
|
724
|
+
bindings[key] = binding
|
725
|
+
if (binding.root) {
|
726
|
+
// this is a root level binding. we need to define getter/setters for it.
|
727
|
+
if (computed && computed[key]) {
|
728
|
+
// computed property
|
729
|
+
compiler.defineComputed(key, binding, computed[key])
|
730
|
+
} else if (key.charAt(0) !== '$') {
|
731
|
+
// normal property
|
732
|
+
compiler.defineDataProp(key, binding)
|
733
|
+
} else {
|
734
|
+
// properties that start with $ are meta properties
|
735
|
+
// they should be kept on the vm but not in the data object.
|
736
|
+
compiler.defineVmProp(key, binding, compiler.data[key])
|
737
|
+
delete compiler.data[key]
|
738
|
+
}
|
739
|
+
} else if (computed && computed[utils.baseKey(key)]) {
|
740
|
+
// nested path on computed property
|
741
|
+
compiler.defineExp(key, binding)
|
742
|
+
} else {
|
743
|
+
// ensure path in data so that computed properties that
|
744
|
+
// access the path don't throw an error and can collect
|
745
|
+
// dependencies
|
746
|
+
Observer.ensurePath(compiler.data, key)
|
747
|
+
var parentKey = key.slice(0, key.lastIndexOf('.'))
|
748
|
+
if (!bindings[parentKey]) {
|
749
|
+
// this is a nested value binding, but the binding for its parent
|
750
|
+
// has not been created yet. We better create that one too.
|
751
|
+
compiler.createBinding(parentKey)
|
752
|
+
}
|
753
|
+
}
|
754
|
+
}
|
755
|
+
return binding
|
756
|
+
}
|
757
|
+
|
758
|
+
/**
|
759
|
+
* Define the getter/setter to proxy a root-level
|
760
|
+
* data property on the VM
|
761
|
+
*/
|
762
|
+
CompilerProto.defineDataProp = function (key, binding) {
|
763
|
+
var compiler = this,
|
764
|
+
data = compiler.data,
|
765
|
+
ob = data.__emitter__
|
766
|
+
|
767
|
+
// make sure the key is present in data
|
768
|
+
// so it can be observed
|
769
|
+
if (!(hasOwn.call(data, key))) {
|
770
|
+
data[key] = undefined
|
771
|
+
}
|
772
|
+
|
773
|
+
// if the data object is already observed, but the key
|
774
|
+
// is not observed, we need to add it to the observed keys.
|
775
|
+
if (ob && !(hasOwn.call(ob.values, key))) {
|
776
|
+
Observer.convertKey(data, key)
|
777
|
+
}
|
778
|
+
|
779
|
+
binding.value = data[key]
|
780
|
+
|
781
|
+
def(compiler.vm, key, {
|
782
|
+
get: function () {
|
783
|
+
return compiler.data[key]
|
784
|
+
},
|
785
|
+
set: function (val) {
|
786
|
+
compiler.data[key] = val
|
787
|
+
}
|
788
|
+
})
|
789
|
+
}
|
790
|
+
|
791
|
+
/**
|
792
|
+
* Define a vm property, e.g. $index, $key, or mixin methods
|
793
|
+
* which are bindable but only accessible on the VM,
|
794
|
+
* not in the data.
|
795
|
+
*/
|
796
|
+
CompilerProto.defineVmProp = function (key, binding, value) {
|
797
|
+
var ob = this.observer
|
798
|
+
binding.value = value
|
799
|
+
def(this.vm, key, {
|
800
|
+
get: function () {
|
801
|
+
if (Observer.shouldGet) ob.emit('get', key)
|
802
|
+
return binding.value
|
803
|
+
},
|
804
|
+
set: function (val) {
|
805
|
+
ob.emit('set', key, val)
|
806
|
+
}
|
807
|
+
})
|
808
|
+
}
|
809
|
+
|
810
|
+
/**
|
811
|
+
* Define an expression binding, which is essentially
|
812
|
+
* an anonymous computed property
|
813
|
+
*/
|
814
|
+
CompilerProto.defineExp = function (key, binding, directive) {
|
815
|
+
var computedKey = directive && directive.computedKey,
|
816
|
+
exp = computedKey ? directive.expression : key,
|
817
|
+
getter = this.expCache[exp]
|
818
|
+
if (!getter) {
|
819
|
+
getter = this.expCache[exp] = ExpParser.parse(computedKey || key, this)
|
820
|
+
}
|
821
|
+
if (getter) {
|
822
|
+
this.markComputed(binding, getter)
|
823
|
+
}
|
824
|
+
}
|
825
|
+
|
826
|
+
/**
|
827
|
+
* Define a computed property on the VM
|
828
|
+
*/
|
829
|
+
CompilerProto.defineComputed = function (key, binding, value) {
|
830
|
+
this.markComputed(binding, value)
|
831
|
+
def(this.vm, key, {
|
832
|
+
get: binding.value.$get,
|
833
|
+
set: binding.value.$set
|
834
|
+
})
|
835
|
+
}
|
836
|
+
|
837
|
+
/**
|
838
|
+
* Process a computed property binding
|
839
|
+
* so its getter/setter are bound to proper context
|
840
|
+
*/
|
841
|
+
CompilerProto.markComputed = function (binding, value) {
|
842
|
+
binding.isComputed = true
|
843
|
+
// bind the accessors to the vm
|
844
|
+
if (binding.isFn) {
|
845
|
+
binding.value = value
|
846
|
+
} else {
|
847
|
+
if (typeof value === 'function') {
|
848
|
+
value = { $get: value }
|
849
|
+
}
|
850
|
+
binding.value = {
|
851
|
+
$get: utils.bind(value.$get, this.vm),
|
852
|
+
$set: value.$set
|
853
|
+
? utils.bind(value.$set, this.vm)
|
854
|
+
: undefined
|
855
|
+
}
|
856
|
+
}
|
857
|
+
// keep track for dep parsing later
|
858
|
+
this.computed.push(binding)
|
859
|
+
}
|
860
|
+
|
861
|
+
/**
|
862
|
+
* Retrive an option from the compiler
|
863
|
+
*/
|
864
|
+
CompilerProto.getOption = function (type, id, silent) {
|
865
|
+
var opts = this.options,
|
866
|
+
parent = this.parent,
|
867
|
+
globalAssets = config.globalAssets,
|
868
|
+
res = (opts[type] && opts[type][id]) || (
|
869
|
+
parent
|
870
|
+
? parent.getOption(type, id, silent)
|
871
|
+
: globalAssets[type] && globalAssets[type][id]
|
872
|
+
)
|
873
|
+
if (!res && !silent && typeof id === 'string') {
|
874
|
+
utils.warn('Unknown ' + type.slice(0, -1) + ': ' + id)
|
875
|
+
}
|
876
|
+
return res
|
877
|
+
}
|
878
|
+
|
879
|
+
/**
|
880
|
+
* Emit lifecycle events to trigger hooks
|
881
|
+
*/
|
882
|
+
CompilerProto.execHook = function (event) {
|
883
|
+
event = 'hook:' + event
|
884
|
+
this.observer.emit(event)
|
885
|
+
this.emitter.emit(event)
|
886
|
+
}
|
887
|
+
|
888
|
+
/**
|
889
|
+
* Check if a compiler's data contains a keypath
|
890
|
+
*/
|
891
|
+
CompilerProto.hasKey = function (key) {
|
892
|
+
var baseKey = utils.baseKey(key)
|
893
|
+
return hasOwn.call(this.data, baseKey) ||
|
894
|
+
hasOwn.call(this.vm, baseKey)
|
895
|
+
}
|
896
|
+
|
897
|
+
/**
|
898
|
+
* Do a one-time eval of a string that potentially
|
899
|
+
* includes bindings. It accepts additional raw data
|
900
|
+
* because we need to dynamically resolve v-component
|
901
|
+
* before a childVM is even compiled...
|
902
|
+
*/
|
903
|
+
CompilerProto.eval = function (exp, data) {
|
904
|
+
var parsed = TextParser.parseAttr(exp)
|
905
|
+
return parsed
|
906
|
+
? ExpParser.eval(parsed, this, data)
|
907
|
+
: exp
|
908
|
+
}
|
909
|
+
|
910
|
+
/**
|
911
|
+
* Resolve a Component constructor for an element
|
912
|
+
* with the data to be used
|
913
|
+
*/
|
914
|
+
CompilerProto.resolveComponent = function (node, data, test) {
|
915
|
+
|
916
|
+
// late require to avoid circular deps
|
917
|
+
ViewModel = ViewModel || require('./viewmodel')
|
918
|
+
|
919
|
+
var exp = utils.attr(node, 'component'),
|
920
|
+
tagName = node.tagName,
|
921
|
+
id = this.eval(exp, data),
|
922
|
+
tagId = (tagName.indexOf('-') > 0 && tagName.toLowerCase()),
|
923
|
+
Ctor = this.getOption('components', id || tagId, true)
|
924
|
+
|
925
|
+
if (id && !Ctor) {
|
926
|
+
utils.warn('Unknown component: ' + id)
|
927
|
+
}
|
928
|
+
|
929
|
+
return test
|
930
|
+
? exp === ''
|
931
|
+
? ViewModel
|
932
|
+
: Ctor
|
933
|
+
: Ctor || ViewModel
|
934
|
+
}
|
935
|
+
|
936
|
+
/**
|
937
|
+
* Unbind and remove element
|
938
|
+
*/
|
939
|
+
CompilerProto.destroy = function (noRemove) {
|
940
|
+
|
941
|
+
// avoid being called more than once
|
942
|
+
// this is irreversible!
|
943
|
+
if (this.destroyed) return
|
944
|
+
|
945
|
+
var compiler = this,
|
946
|
+
i, j, key, dir, dirs, binding,
|
947
|
+
vm = compiler.vm,
|
948
|
+
el = compiler.el,
|
949
|
+
directives = compiler.dirs,
|
950
|
+
computed = compiler.computed,
|
951
|
+
bindings = compiler.bindings,
|
952
|
+
children = compiler.children,
|
953
|
+
parent = compiler.parent
|
954
|
+
|
955
|
+
compiler.execHook('beforeDestroy')
|
956
|
+
|
957
|
+
// unobserve data
|
958
|
+
Observer.unobserve(compiler.data, '', compiler.observer)
|
959
|
+
|
960
|
+
// destroy all children
|
961
|
+
// do not remove their elements since the parent
|
962
|
+
// may have transitions and the children may not
|
963
|
+
i = children.length
|
964
|
+
while (i--) {
|
965
|
+
children[i].destroy(true)
|
966
|
+
}
|
967
|
+
|
968
|
+
// unbind all direcitves
|
969
|
+
i = directives.length
|
970
|
+
while (i--) {
|
971
|
+
dir = directives[i]
|
972
|
+
// if this directive is an instance of an external binding
|
973
|
+
// e.g. a directive that refers to a variable on the parent VM
|
974
|
+
// we need to remove it from that binding's directives
|
975
|
+
// * empty and literal bindings do not have binding.
|
976
|
+
if (dir.binding && dir.binding.compiler !== compiler) {
|
977
|
+
dirs = dir.binding.dirs
|
978
|
+
if (dirs) {
|
979
|
+
j = dirs.indexOf(dir)
|
980
|
+
if (j > -1) dirs.splice(j, 1)
|
981
|
+
}
|
982
|
+
}
|
983
|
+
dir.$unbind()
|
984
|
+
}
|
985
|
+
|
986
|
+
// unbind all computed, anonymous bindings
|
987
|
+
i = computed.length
|
988
|
+
while (i--) {
|
989
|
+
computed[i].unbind()
|
990
|
+
}
|
991
|
+
|
992
|
+
// unbind all keypath bindings
|
993
|
+
for (key in bindings) {
|
994
|
+
binding = bindings[key]
|
995
|
+
if (binding) {
|
996
|
+
binding.unbind()
|
997
|
+
}
|
998
|
+
}
|
999
|
+
|
1000
|
+
// remove self from parent
|
1001
|
+
if (parent) {
|
1002
|
+
j = parent.children.indexOf(compiler)
|
1003
|
+
if (j > -1) parent.children.splice(j, 1)
|
1004
|
+
}
|
1005
|
+
|
1006
|
+
// finally remove dom element
|
1007
|
+
if (!noRemove) {
|
1008
|
+
if (el === document.body) {
|
1009
|
+
el.innerHTML = ''
|
1010
|
+
} else {
|
1011
|
+
vm.$remove()
|
1012
|
+
}
|
1013
|
+
}
|
1014
|
+
el.vue_vm = null
|
1015
|
+
|
1016
|
+
compiler.destroyed = true
|
1017
|
+
// emit destroy hook
|
1018
|
+
compiler.execHook('afterDestroy')
|
1019
|
+
|
1020
|
+
// finally, unregister all listeners
|
1021
|
+
compiler.observer.off()
|
1022
|
+
compiler.emitter.off()
|
1023
|
+
}
|
1024
|
+
|
1025
|
+
// Helpers --------------------------------------------------------------------
|
1026
|
+
|
1027
|
+
/**
|
1028
|
+
* shorthand for getting root compiler
|
1029
|
+
*/
|
1030
|
+
function getRoot (compiler) {
|
1031
|
+
while (compiler.parent) {
|
1032
|
+
compiler = compiler.parent
|
1033
|
+
}
|
1034
|
+
return compiler
|
1035
|
+
}
|
1036
|
+
|
1037
|
+
module.exports = Compiler
|